started using a comma as a parameter/argument separator.
changed to use & as a string concatenation method in the string class. added some code to support variadic arguments
This commit is contained in:
@ -325,7 +325,7 @@
|
||||
|
||||
#method handleException: exception
|
||||
{
|
||||
('### EXCEPTION NOT HANDLED #### ', exception class name, ' - ', exception messageText) dump.
|
||||
('### EXCEPTION NOT HANDLED #### ' & exception class name & ' - ' & exception messageText) dump.
|
||||
## TODO: debug the current process???? "
|
||||
## TODO: ensure to execute ensure blocks as well....
|
||||
####Processor activeProcess terminate.
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
#class(#character) String(Array)
|
||||
{
|
||||
#method , aString
|
||||
#method & aString
|
||||
{
|
||||
## concatenate two strings.
|
||||
## TOOD: make this a primitive for performance.
|
||||
|
@ -11,6 +11,35 @@
|
||||
{
|
||||
^self.ip < 0
|
||||
}
|
||||
|
||||
#method temporaryCount
|
||||
{
|
||||
^self.ntmprs
|
||||
}
|
||||
|
||||
(* ---------------------------------
|
||||
#method varargCount
|
||||
{
|
||||
method context,
|
||||
|
||||
|
||||
^do calculation...
|
||||
|
||||
for a block context, it must access homeContext first and call varargCount
|
||||
|
||||
^self.home varargCount...
|
||||
}
|
||||
|
||||
#method varargAt: index
|
||||
{
|
||||
method context
|
||||
^do calculation...
|
||||
|
||||
block context...
|
||||
^self.home varargAt: index
|
||||
}
|
||||
|
||||
---------------------------------- *)
|
||||
}
|
||||
|
||||
#class(#pointer) MethodContext(Context)
|
||||
@ -58,12 +87,22 @@
|
||||
{
|
||||
^self.method
|
||||
}
|
||||
|
||||
#method varArgCount
|
||||
{
|
||||
^self basicSize - self class specNumInstVars - self.ntmprs
|
||||
}
|
||||
}
|
||||
|
||||
#class(#pointer) BlockContext(Context)
|
||||
{
|
||||
#dcl nargs source home origin.
|
||||
|
||||
#method varArgCount
|
||||
{
|
||||
^self.home varArgCount
|
||||
}
|
||||
|
||||
#method fork
|
||||
{
|
||||
"crate a new process in the runnable state"
|
||||
|
@ -62,7 +62,7 @@
|
||||
##thisContext unwindTo: nil return: nil.
|
||||
##thisContext unwindTo: (Processor activeProcess initialContext) return: nil.
|
||||
thisContext unwindTo: (thisProcess initialContext) return: nil.
|
||||
('### EXCEPTION NOT HANDLED #### ', self class name, ' - ', self messageText) dump.
|
||||
('### EXCEPTION NOT HANDLED #### ' & self class name & ' - ' & self messageText) dump.
|
||||
## TODO: debug the current process???? "
|
||||
|
||||
##Processor activeProcess terminate.
|
||||
@ -352,7 +352,7 @@
|
||||
ctx := thisContext.
|
||||
[ctx notNil] whileTrue: [
|
||||
(ctx class == MethodContext)
|
||||
ifTrue: [ (ctx method owner name, '>>', ctx method name) dump ].
|
||||
ifTrue: [ (ctx method owner name & '>>' & ctx method name) dump ].
|
||||
## TODO: include blockcontext???
|
||||
ctx := ctx sender.
|
||||
].
|
||||
@ -368,7 +368,7 @@ ctx := thisContext.
|
||||
#method(#class) doesNotUnderstand: messageSymbol
|
||||
{
|
||||
## TODO: implement this properly
|
||||
NoSuchMessageException signal: (messageSymbol, ' not understood by ', (self name)).
|
||||
NoSuchMessageException signal: (messageSymbol & ' not understood by ' & (self name)).
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
}
|
||||
|
||||
|
||||
(* ---------------------
|
||||
#method(#class) input
|
||||
{
|
||||
^(super new) open: 0 for: 'r'
|
||||
@ -41,6 +42,7 @@
|
||||
{
|
||||
^(super new) open: 2 for: 'w'
|
||||
}
|
||||
------------------------ *)
|
||||
|
||||
(*
|
||||
#method format: fmt with: ...
|
||||
@ -49,11 +51,13 @@
|
||||
}
|
||||
*)
|
||||
|
||||
#method format (fmt. args)
|
||||
#method format (fmt, args)
|
||||
{
|
||||
| a b c |
|
||||
'THIS IS FORMAT' dump.
|
||||
fmt dump.
|
||||
args dump.
|
||||
thisContext temporaryCount dump.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,12 +120,12 @@
|
||||
k := 99.
|
||||
[
|
||||
[
|
||||
##[ Exception signal: 'simulated error' ] ensure: [('ensure 1 ', (k asString)) dump ].
|
||||
[ ^ 20 ] ensure: [ ('ensure 1 ', (k asString)) dump. ].
|
||||
##[ Exception signal: 'simulated error' ] ensure: [('ensure 1 ' & (k asString)) dump ].
|
||||
[ ^ 20 ] ensure: [ ('ensure 1 ' & (k asString)) dump. ].
|
||||
] ensure: ['ensure 2' dump ].
|
||||
] ensure: ['ensure 3' dump ].
|
||||
] on: Exception do: [:ex |
|
||||
('EXCETION - ' , ex messageText) dump.
|
||||
('EXCETION - ' & ex messageText) dump.
|
||||
## Exception signal: 'qqq'.
|
||||
].
|
||||
^v1
|
||||
@ -145,7 +145,7 @@
|
||||
|
||||
"[
|
||||
[ Exception signal: 'simulated error' ] ensure: ['ensure 1' dump ].
|
||||
] on: Exception do: [:ex | ('EXCETION - ' , ex messageText) dump. Exception signal: 'qqq'. ]."
|
||||
] on: Exception do: [:ex | ('EXCETION - ' & ex messageText) dump. Exception signal: 'qqq'. ]."
|
||||
|
||||
"[1 xxx] ifCurtailed: ['XXXXXXXX CURTAILED XXXXXXXXX' dump. Exception signal: 'jjjj']."
|
||||
|
||||
@ -154,12 +154,12 @@
|
||||
k := 99.
|
||||
[
|
||||
[
|
||||
##[ Exception signal: 'simulated error' ] ensure: [('ensure 1 ', (k asString)) dump ].
|
||||
[ ^20 ] ensure: [('ensure 1 ', (k asString)) dump ].
|
||||
##[ Exception signal: 'simulated error' ] ensure: [('ensure 1 ' & (k asString)) dump ].
|
||||
[ ^20 ] ensure: [('ensure 1 ' & (k asString)) dump ].
|
||||
] ensure: ['ensure 2' dump ].
|
||||
] ensure: ['ensure 3' dump ].
|
||||
] on: Exception do: [:ex |
|
||||
('EXCETION - ' , ex messageText) dump.
|
||||
('EXCETION - ' & ex messageText) dump.
|
||||
## Exception signal: 'qqq'.
|
||||
].
|
||||
"
|
||||
|
@ -165,7 +165,7 @@
|
||||
p := [
|
||||
[ Exception signal: 'Exception in a new process of test12' ]
|
||||
on: Exception do: [:ex |
|
||||
('EXCEPTION CAUGHT...in test12 ==> ', (ex messageText)) dump.
|
||||
('EXCEPTION CAUGHT...in test12 ==> ' & (ex messageText)) dump.
|
||||
]
|
||||
] newProcess.
|
||||
'JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ' dump.
|
||||
|
@ -100,7 +100,7 @@
|
||||
|
||||
v2 at: 0 put: $H.
|
||||
|
||||
System logNl: ('START OF MAIN - ' , v2).
|
||||
System logNl: ('START OF MAIN - ' & v2).
|
||||
|
||||
v1 := MyConsole output.
|
||||
v1 clear.
|
||||
@ -142,10 +142,12 @@ procecure call is treated as if it is a unary message...
|
||||
].
|
||||
*)
|
||||
|
||||
v1 format(10 . 20) isNil ifFalse: [
|
||||
v1 format(10, 20) isNil ifFalse: [
|
||||
'Beautiful life' dump.
|
||||
].
|
||||
|
||||
thisContext varArgCount dump.
|
||||
thisContext varArgCount (10, 20) dump.
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user