introduced the Error class to represent an error code as an object.

rewrote STIX_ASSERT() to call stix_logbfmt() via stix_assertfailed()
This commit is contained in:
hyunghwan.chung
2016-12-26 18:44:47 +00:00
parent 61f2c89aaa
commit a9c48b75e6
30 changed files with 1003 additions and 1027 deletions

View File

@ -332,4 +332,10 @@
}
}
#class Error(Apex)
{
#method isError
{
^true
}
}

View File

@ -1,5 +1,7 @@
#class(#byte) Stdio(Object) from 'stdio'
{
#dcl(#class) in out err.
(*
* The following methods are generated by the module.
* #method(#class) _newInstSize { <primitive: #stdio._newInstSize> }
@ -9,15 +11,12 @@
#method(#class) new: size
{
##self prohibited
##raise exception. prohibited...
## ignore the specified size
^(super new: (self _newInstSize))
}
#method(#class) new
{
##self prohibited
##raise exception. prohibited...
^(super new: (self _newInstSize))
}
@ -30,17 +29,20 @@
(* ---------------------
#method(#class) input
{
^(super new) open: 0 for: 'r'
self.in isNil ifTrue: [ self.in := ^(super new) open: 0 for: 'r' ].
^self.in.
}
#method(#class) output
{
^(super new) open: 1 for: 'w'
self.out isNil ifTrue: [ self.out := ^(super new) open: 1 for: 'w' ].
^self.out.
}
#method(#class) error
{
^(super new) open: 2 for: 'w'
self.err isNil ifTrue: [ self.err := ^(super new) open: 2 for: 'w' ].
^self.err.
}
------------------------ *)

View File

@ -4,19 +4,6 @@
#########################################################################################
#class Error(Object)
{
#method(#class) signal: aString
{
"accept an arbitary object instead of a string.
the object can be sent displayString for string conversion"
}
#method isError
{
^true
}
}
#class Magnitude(Object)
{

View File

@ -126,26 +126,23 @@
##v1 := Stdio2 open: '/tmp/1.txt' for: 'w+'.
v1 := Stdio2 new open: '/tmp/1.txt' for: 'w+'.
## v1 puts: 'hello'.
v1 puts ('hello', 'world', 'good', C'\n', C'\t', 'under my umbrella.', C'\n').
v1 close.
(v1 isError)
ifTrue: [
System logNl: ('Error in opening a file....').
]
ifFalse: [
## v1 puts: 'hello'.
v1 puts ('hello', 'world', 'good', C'\n', C'\t', 'under my umbrella.', C'\n').
v1 close.
(*v1 format(10, 20) isNil ifFalse: [
'Beautiful life' dump.
].*)
].
nil isNil ifTrue: [ 'NIL NIL NIL' dump. ].
(Apex new) notNil ifTrue: [ 'APEX NIL NIL NIL' dump. ].
(*
v1 format(10 20 30) isNil
procecure call is treated as if it is a unary message...
v1 format(10 , 20 , 30) isNil ifTrue: [
xxxx
].
*)
v1 format(10, 20) isNil ifFalse: [
'Beautiful life' dump.
].
self varg_test (10, 20, 30, 40, 50) dump.
self varg_test2 (10, 20, 30, 40, 50) dump.
self varg_test3 (10, 20, 30, 40, 50) dump.
@ -153,7 +150,6 @@ procecure call is treated as if it is a unary message...
thisContext vargCount dump.
}
#method(#class) varg_test()
{
0 to: (thisContext vargCount - 1) do: [:k |