Paste: cond error
Author: | Erich Ocean |
Mode: | factor |
Date: | Thu, 11 Aug 2011 07:28:38 |
Plain Text |
USING:
alien
alien.c-types
alien.libraries
alien.syntax
classes.struct
io.encodings.ascii
combinators
kernel
system
owl
math
fry
io prettyprint math.parser
;
IN: recap2houdini
: print-owl-error ( s n -- )
{
{ [ dup 0 < ] '[ _ write ": " _ . ] }
{ [ dup OWL_NO_ERROR = ] [ drop write ": No Error" . ] }
{ [ dup OWL_INVALID_VALUE = ] [ drop write ": Invalid Value" . ] }
{ [ dup OWL_INVALID_ENUM = ] [ drop write ": Invalid Enum" . ] }
{ [ dup OWL_INVALID_OPERATION = ] [ drop write ": Invalid Operation" . ] }
'[ _ write ": 0x" write _ >hex . ]
} cond ;
Author: | Erich Ocean |
Mode: | factor |
Date: | Thu, 11 Aug 2011 07:42:43 |
Plain Text |
USING:
alien
alien.c-types
alien.libraries
alien.syntax
classes.struct
io.encodings.ascii
combinators
kernel
system
owl
math
fry
io prettyprint math.parser locals
;
IN: recap2houdini
:: print-owl-error ( s n -- )
{
{ [ n 0 < ] [ s write ": " n . ] }
{ [ n OWL_NO_ERROR = ] [ s write ": No Error" . ] }
{ [ n OWL_INVALID_VALUE = ] [ s write ": Invalid Value" . ] }
{ [ n OWL_INVALID_ENUM = ] [ s write ": Invalid Enum" . ] }
{ [ n OWL_INVALID_OPERATION = ] [ s write ": Invalid Operation" . ] }
[ s write ": 0x" write n >hex . ]
} cond ;
Author: | Erich Ocean |
Mode: | c |
Date: | Thu, 11 Aug 2011 07:48:03 |
Plain Text |
void owl_print_error(const char *s, int n)
{
if(n < 0) printf("%s: %d\n", s, n);
else if(n == OWL_NO_ERROR) printf("%s: No Error\n", s);
else if(n == OWL_INVALID_VALUE) printf("%s: Invalid Value\n", s);
else if(n == OWL_INVALID_ENUM) printf("%s: Invalid Enum\n", s);
else if(n == OWL_INVALID_OPERATION) printf("%s: Invalid Operation\n", s);
else printf("%s: 0x%x\n", s, n);
}
Author: | Erich Ocean |
Mode: | factor |
Date: | Thu, 11 Aug 2011 07:51:07 |
Plain Text |
USING:
alien
alien.c-types
alien.libraries
alien.syntax
classes.struct
io.encodings.ascii
combinators
kernel
system
owl
math
fry
io prettyprint math.parser locals
;
IN: recap2houdini
:: print-owl-error ( s n -- )
{
{ [ n 0 < ] [ s write ": " write n . ] }
{ [ n OWL_NO_ERROR = ] [ s write ": No Error" . ] }
{ [ n OWL_INVALID_VALUE = ] [ s write ": Invalid Value" . ] }
{ [ n OWL_INVALID_ENUM = ] [ s write ": Invalid Enum" . ] }
{ [ n OWL_INVALID_OPERATION = ] [ s write ": Invalid Operation" . ] }
[ s write ": 0x" write n >hex . ]
} cond ;
New Annotation