Skip to content

Commit

Permalink
Release 1.0.1
Browse files Browse the repository at this point in the history
Fix packaging mac files by zpm.
Add examples.
  • Loading branch information
atygaev committed Mar 26, 2020
1 parent 163db1b commit 8cbc4cc
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 3 deletions.
7 changes: 4 additions & 3 deletions module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
<Document name="declarative-os.ZPM">
<Module>
<Name>declarative-os</Name>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Packaging>module</Packaging>
<SourcesRoot>src</SourcesRoot>
<Resource Name="DeclarativeOS.PKG"/>

<Resource Name="DeclarativeOS.PKG" Directory="cls"/>
<Resource Name="%ZLANGC01.MAC" Directory="mac"/>
<Resource Name="%ZLANGF00.MAC" Directory="mac"/>
<UnitTest Name="/test" Package="Test.DeclarativeOS.PKG" Phase="test"/>
</Module>
</Document>
Expand Down
70 changes: 70 additions & 0 deletions src/cls/DeclarativeOS/Examples.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Class DeclarativeOS.Examples Extends DeclarativeOS.RegistryHelper
{

/// Returns hex value of the passed value.
///
/// @Declarative("examples:toHex")
ClassMethod toHex(value As %Numeric)
{
return $zhex(value)
}

/// Returns $$$YES if passed value is prime number.
/// Otherwise, returns $$$NO.
///
/// @Declarative("examples:isPrime")
ClassMethod isPrime(value As %Numeric)
{
for i=2:1:$zsqr(value) {
if (value # i = 0) {
return $$$NO
}
}

return $$$YES
}

/// Returns $$$YES if passed value is odd number.
/// Otherwise, returns $$$NO.
///
/// @Declarative("examples:isOdd")
ClassMethod isOdd(value As %Numeric)
{
return value # 2 '= 0
}

/// Returns $$$YES if passed value is even number.
/// Otherwise, returns $$$NO.
///
/// @Declarative("examples:isEven")
ClassMethod isEven(value As %Numeric)
{
return value # 2 = 0
}

/// Returns $$$YES if passed value is palindromic number.
/// Otherwise, returns $$$NO.
///
/// @Declarative("examples:isPalindromic")
ClassMethod isPalindromic(value As %Numeric)
{
return $reverse(value) = value
}

/// Output passed value.
///
/// @Declarative("io:print")
ClassMethod print(value As %Library.DataType)
{
w value
}

/// Output passed value. Add newline symbol.
///
/// @Declarative("io:println")
ClassMethod println(value As %Library.DataType)
{
w value, !
}

}

0 comments on commit 8cbc4cc

Please sign in to comment.