removed the S'' literals from the moo codes

This commit is contained in:
hyunghwan.chung 2019-06-27 08:06:33 +00:00
parent ea4d782c1d
commit 4c7b5f2df8
13 changed files with 149 additions and 149 deletions

View File

@ -306,7 +306,7 @@ class UndefinedObject(Apex)
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.
@ -369,18 +369,18 @@ extend Error
//thisContext unwindTo: (Processor activeProcess initialContext) return: nil.
// TOOD: IMPROVE THIS EXPERIMENTAL BACKTRACE...
System logNl: '== BACKTRACE =='.
System logNl: "== BACKTRACE ==".
ctx := thisContext.
while (ctx notNil)
{
if (ctx class == MethodContext) { System logNl: (' ' & ctx method owner name & '>>' & ctx method name) }.
if (ctx class == MethodContext) { System logNl: (" " & ctx method owner name & ">>" & ctx method name) }.
// TODO: include blockcontext???
ctx := ctx sender.
}.
System logNl: '== END OF BACKTRACE =='.
System logNl: "== END OF BACKTRACE ==".
thisContext unwindTo: (thisProcess initialContext) return: nil.
('//# ERROR NOT HANDLED //// ' & self class name & ' - ' & self asString) dump.
("### ERROR NOT HANDLED #### " & self class name & " - " & self asString) dump.
// TODO: debug the current process???? "
//Processor activeProcess terminate.

View File

@ -37,7 +37,7 @@ TODO: can i convert 'thisProcess primError' to a relevant exception?
method asString
{
^(self class name) & ' - ' & self.messageText.
^(self class name) & " - " & self.messageText.
}
method signal
@ -70,18 +70,18 @@ TODO: can i convert 'thisProcess primError' to a relevant exception?
//thisContext unwindTo: (Processor activeProcess initialContext) return: nil.
// TOOD: IMPROVE THIS EXPERIMENTAL BACKTRACE...
System logNl: '== BACKTRACE =='.
System logNl: "== BACKTRACE ==".
ctx := thisContext.
while (ctx notNil)
{
if (ctx class == MethodContext) { System logNl: (' ' & ctx method owner name & '>>' & ctx method name) }.
if (ctx class == MethodContext) { System logNl: (" " & ctx method owner name & ">>" & ctx method name) }.
// TODO: include blockcontext???
ctx := ctx sender.
}.
System logNl: '== END OF BACKTRACE =='.
System logNl: "== END OF BACKTRACE ==".
thisContext unwindTo: (thisProcess initialContext) return: nil.
('//# EXCEPTION NOT HANDLED(Exception) //// ' & self class name & ' - ' & self messageText) dump.
("### EXCEPTION NOT HANDLED(Exception) #### " & self class name & " - " & self messageText) dump.
// TODO: debug the current process???? "
//Processor activeProcess terminate.
@ -502,7 +502,7 @@ extend Apex
ec := thisProcess primError.
msg := thisProcess primErrorMessage.
if (msg isNil) { msg := ec asString }.
if (method notNil) { msg := msg & ' - ' & (method owner name) & '>>' & (method name) }.
if (method notNil) { msg := msg & " - " & (method owner name) & ">>" & (method name) }.
//# TODO: convert an exception to a more specific one depending on the error code.
//#if (ec == Error.Code.ERANGE) { self index: index outOfRange: (self basicSize) }
@ -519,46 +519,46 @@ extend Apex
class_name := if (self class == Class) { self name } else { self class name }.
// TOOD: IMPROVE THIS EXPERIMENTAL BACKTRACE...
System logNl: '== BACKTRACE =='.
System logNl: "== BACKTRACE ==".
ctx := thisContext.
while (ctx notNil)
{
if (ctx class == MethodContext) { System logNl: (' ' & ctx method owner name & '>>' & ctx method name) }.
if (ctx class == MethodContext) { System logNl: (" " & ctx method owner name & ">>" & ctx method name) }.
// TODO: include blockcontext???
ctx := ctx sender.
}.
System logNl: '== END OF BACKTRACE =='.
System logNl: "== END OF BACKTRACE ==".
NoSuchMessageException signal: (message_name & ' not understood by ' & class_name).
NoSuchMessageException signal: (message_name & " not understood by " & class_name).
}
method(#dual) index: index outOfRange: ubound
{
IndexOutOfRangeException signal: 'Out of range'.
IndexOutOfRangeException signal: "Out of range".
}
method(#dual) subclassResponsibility: method_name
{
SubclassResponsibilityException signal: ('Subclass must implement ' & method_name).
SubclassResponsibilityException signal: ("Subclass must implement " & method_name).
}
method(#dual) shouldNotImplement: method_name
{
SubclassResponsibilityException signal: ('Message should not be implemented - ' & method_name).
SubclassResponsibilityException signal: ("Message should not be implemented - " & method_name).
}
method(#dual) notImplemented: method_name
{
| class_name |
class_name := if (self class == Class) { self name } else { self class name }.
NotImplementedException signal: (method_name & ' not implemented by ' & class_name).
NotImplementedException signal: (method_name & " not implemented by " & class_name).
}
method(#dual) messageProhibited: method_name
{
| class_name |
class_name := if (self class == Class) { self name } else { self class name }.
ProhibitedMessageException signal: (method_name & ' not allowed for ' & class_name).
ProhibitedMessageException signal: (method_name & " not allowed for " & class_name).
}
}

View File

@ -51,53 +51,53 @@ class MyObject(Object)
d := Dictionary new.
d at: #abc put: 20.
d at: #dddd put: 40.
d at: #jjjj put: 'hello world'.
d at: #moo put: 'good?'.
d at: #moo put: 'not good?'.
d at: #jjjj put: "hello world".
d at: #moo put: "good?".
d at: #moo put: "not good?".
/* (d at: #abc) dump.
/* (d at: #dddd) dump. */
/*d do: [:v | v dump].*/
d keysAndValuesDo: [:k :v| System logNl: (k asString) & ' => ' & (v asString) ].
d keysAndValuesDo: [:k :v| System logNl: (k asString) & " => " & (v asString) ].
//(d includesAssociation: (Association key: #moo value: 'not good?')) dump.
'-------------------------' dump.
//(d includesAssociation: (Association key: #moo value: "not good?")) dump.
"-------------------------" dump.
//(System at: #MyObject) dump.
(d removeKey: #moo) dump.
d removeKey: #abc ifAbsent: [System logNl: '#moo not found'].
d keysAndValuesDo: [:k :v| System logNl: (k asString) & ' => ' & (v asString) ].
d removeKey: #abc ifAbsent: [System logNl: "#moo not found"].
d keysAndValuesDo: [:k :v| System logNl: (k asString) & " => " & (v asString) ].
'-------------------------' dump.
"-------------------------" dump.
(d at: #jjjj) dump.
(d at: #jjjja) dump.
/*
System keysAndValuesDo: [:k :v|
System logNl: (k asString) & ' => ' & (v asString)
System logNl: (k asString) & " => " & (v asString)
].
*/
//System keysDo: [:k| System logNl: (k asString)]
/*[
[Exception hash dump] ensure: ['xxxx' dump].
] on: Exception do: [:ex | ('Exception caught - ' & ex asString) dump ].*/
[Exception hash dump] ensure: ["xxxx" dump].
] on: Exception do: [:ex | ("Exception caught - " & ex asString) dump ].*/
ffi := FFI new: '/lib64/libc.so.6'.
ffi := FFI new: "/lib64/libc.so.6".
if (ffi isError)
{
System logNl: 'cannot open libc.so'
System logNl: "cannot open libc.so"
}
else
{
(ffi call: #getpid signature: ')i' arguments: nil) dump.
(ffi call: #printf signature: 's|iis)i' arguments: #(S'A=>%d B=>%d Hello, world %s\n' 1 2 'fly away')) dump.
(ffi call: #printf signature: 's|iis)i' arguments: #(S'A=>%d B=>%d Hello, world %s\n' 1 2 'jump down')) dump.
(ffi call: #getpid signature: ")i" arguments: nil) dump.
(ffi call: #printf signature: "s|iis)i" arguments: #("A=>%d B=>%d Hello, world %s\n" 1 2 "fly away")) dump.
(ffi call: #printf signature: "s|iis)i" arguments: #("A=>%d B=>%d Hello, world %s\n" 1 2 "jump down")) dump.
ffi close.
}.
(('abcd' == 'abcd') ifTrue: [1] ifFalse: [2]) dump.
(("abcd" == "abcd") ifTrue: [1] ifFalse: [2]) dump.
}
@ -106,28 +106,28 @@ class MyObject(Object)
{
|a k|
'BEGINNING OF main...........' dump.
"BEGINNING OF main..........." dump.
a :=
if ([System logNl: 'xxxx'. 'abcd' == 'bcde'. false] value)
if ([System logNl: "xxxx". "abcd" == "bcde". false] value)
{
System logNl: 'XXXXXXXXX'.
System logNl: "XXXXXXXXX".
1111
}
elsif ('abcd' ~= 'abcd')
elsif ("abcd" ~= "abcd")
{
System logNl: 'second if'.
System logNl: "second if".
}
elsif ([k := 20. System logNl: 'k => ' & (k asString). k + 20. true] value)
elsif ([k := 20. System logNl: "k => " & (k asString). k + 20. true] value)
{
System logNl: 'THIRID forever.............' & (k asString)
System logNl: "THIRID forever............." & (k asString)
}
elsif (true = true)
{
System logNl: 'forever.............'
System logNl: "forever............."
}
else
{
System logNl: 'NO MATCH'.
System logNl: "NO MATCH".
[true] value.
}.
@ -135,12 +135,12 @@ class MyObject(Object)
(if (false) { 10 } else { 16rFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}) dump.
System logNl: 'DONE DONE DONE...'.
System logNl: "DONE DONE DONE...".
(if (false) {} else {1.} ) dump.
'TESTING ^^....' dump.
"TESTING ^^...." dump.
a := 10.
([
a := a + 3.
@ -152,11 +152,11 @@ class MyObject(Object)
([true] whileTrue: [
[true] whileTrue: [
[
'aaa' dump.
"aaa" dump.
if (a > 20) { ^^506070 }.
a := a + 1.
'bbb' dump.
] ensure: [('xxxxx' & a asString) dump].
"bbb" dump.
] ensure: [("xxxxx" & a asString) dump].
]
]) dump.
@ -187,7 +187,7 @@ class MyObject(Object)
a := 5.
do {
a := do {
('in loop.....' & a asString) dump.
("in loop....." & a asString) dump.
//if (a > 5) { break }.
a := a + 1.
} while(a < 10).
@ -225,7 +225,7 @@ class MyObject(Object)
1 + 1,
##( 1, 2, ##(a, a := a + 1, a, if (a > 10) { a + 20 } ), 3),
2 + 2,
#'a b c'
#"a b c"
).
/* Dictionary ???
@ -246,7 +246,7 @@ class MyObject(Object)
k dump.
a dump.
*/
'---------- END ------------' dump.
"---------- END ------------" dump.
//System sleepForSecs: 20.
}
@ -276,23 +276,23 @@ class MyObject(Object)
a := ##{
'aaa' -> 10,
'bbb' -> 20,
'bbb' -> 30,
"aaa" -> 10,
"bbb" -> 20,
"bbb" -> 30,
#bbb -> 40,
Association key: 12343 value: 129908123,
//5 -> 99,
'ccc' -> 890
"ccc" -> 890
}.
/*a removeKey: 'bbb'.
/*a removeKey: "bbb".
a remove: :(#bbb).*/
//1 to: 100 do: [ :i | a at: i put: (i * 2) ].
a keysAndValuesDo: [:k :v |
k dump.
v dump.
'------------' dump.
"------------" dump.
].
(a associationAt: (#aaa -> nil)) dump.
@ -309,16 +309,16 @@ class MyObject(Object)
/* basicAt: 12 to access the nsdic field. use a proper method once it's defined in Class */
/* basicAt: 12 to access the nsdic field. use a proper method once it"s defined in Class */
// (System nsdic) keysAndValuesDo: [:k :v |
// k dump.
// v dump.
// '------------' dump.
// "------------" dump.
// ].
(System at: #Processor) dump.
System logNl: 'Sleeping start now....'.
System logNl: "Sleeping start now....".
a := System malloc(200).
@ -349,7 +349,7 @@ a free.
{
| event |
Timer fire: [ 'Timer job' dump. ] in: 3000.
Timer fire: [ "Timer job" dump. ] in: 3000.
GUI on: #XXX do: [:evt | ... ].
GUI on: #YYYY do: [:evt | ... ].

View File

@ -178,15 +178,15 @@ TODO: how to pass all variadic arguments to another variadic methods???
// | x |
// x := Array new: 2.
// x at: 0 put: message.
// x at: 1 put: S'\n'.
// x at: 1 put: "\n".
// ^self atLevel: level log: x.
^self atLevel: level log: message and: S'\n'.
^self atLevel: level log: message and: "\n".
}
method(#class) atLevel: level logNl: message and: message2
{
^self atLevel: level log: message and: message2 and: S'\n'.
^self atLevel: level log: message and: message2 and: "\n".
}
method(#class) log: message
@ -201,7 +201,7 @@ TODO: how to pass all variadic arguments to another variadic methods???
method(#class) logNl
{
^self atLevel: System.Log.INFO log: S'\n'.
^self atLevel: System.Log.INFO log: "\n".
}
method(#class) logNl: message

View File

@ -1,4 +1,4 @@
#include 'Moo.moo'.
#include "Moo.moo".
interface X11able
{
@ -27,7 +27,7 @@ method(#dual) abc { ^nil }
method(#dual,#liberal) def(x, z) { ^nil }
}
class X11(Object) [X11able,selfns.X11able3] from 'x11'
class X11(Object) [X11able,selfns.X11able3] from "x11"
{
// =====================================================================
// this part of the class must match the internal
@ -252,7 +252,7 @@ class X11.GC(Object)
widget displayServer dump.
widget windowHandle dump.
gc := widget displayServer _create_gc (widget windowHandle).
if (gc isError) { selfns.Exception signal: 'Cannot create a graphics context' }.
if (gc isError) { selfns.Exception signal: "Cannot create a graphics context" }.
self.gcHandle := gc.
self.widget := widget.
}
@ -287,7 +287,7 @@ widget windowHandle dump.
{
if (self.widget displayServer _apply_gc (self) isError)
{
X11.Exception signal: 'Cannot apply GC settings'
X11.Exception signal: "Cannot apply GC settings"
}
}
}
@ -332,13 +332,13 @@ class X11.Widget(Object)
disp := self displayServer.
if (disp isNil)
{
X11.Exception signal: 'Cannot realize a widget not added to a display server'
X11.Exception signal: "Cannot realize a widget not added to a display server"
}.
wind := disp __create_window(self parentWindowHandle, self.x, self.y, self.width, self.height, self.fgcolor, self.bgcolor, self).
if (wind isError)
{
self.Exception signal: 'Cannot create widget window'.
self.Exception signal: "Cannot create widget window".
}.
self.windowHandle := wind.
@ -455,7 +455,7 @@ class X11.Composite(X11.Widget)
{
if (widget parent notNil)
{
selfns.Exception signal: 'Cannot add an already added widget'.
selfns.Exception signal: "Cannot add an already added widget".
}.
self.children addLast: widget.
@ -467,7 +467,7 @@ class X11.Composite(X11.Widget)
| link |
if (widget parent ~~ self)
{
selfns.Exception sinal: 'Cannot remove an unknown widget'
selfns.Exception sinal: "Cannot remove an unknown widget"
}.
link := self.children findIdenticalLink: widget.

View File

@ -146,15 +146,15 @@ class MyObject(Object)
].
f puts(S'static moo_ooch_t* ', name, S'[] =\n{\n').
f puts("static moo_ooch_t* ", name, "[] =\n{\n").
0 to: c do: [:i |
((i rem: 8) = 0) ifTrue: [ f putc(C'\t') ].
((i rem: 8) = 0) ifTrue: [ f putc(C"\t") ].
f puts(prefix, (i asString)).
(i = c) ifFalse: [f puts(S',') ].
(((i + 1) rem: 8) = 0) ifTrue: [ f putc(C'\n') ] ifFalse: [ f putc(C' ') ].
(i = c) ifFalse: [f puts(",") ].
(((i + 1) rem: 8) = 0) ifTrue: [ f putc(C"\n") ] ifFalse: [ f putc(C' ') ].
].
(((c + 1) rem: 8) = 0) ifFalse: [ f putc(C'\n') ].
f puts(S'};\n').
(((c + 1) rem: 8) = 0) ifFalse: [ f putc(C"\n") ].
f puts("};\n").
}
method(#class) printString: s prefix: prefix index: index on: f
@ -162,7 +162,7 @@ class MyObject(Object)
| c |
c := s size - 1.
f puts('static moo_ooch_t ', prefix, index asString, '[] = {').
f puts("static moo_ooch_t ", prefix, index asString, '[] = {').
0 to: c do: [:i |
| ch |
@ -178,6 +178,6 @@ class MyObject(Object)
(i = c) ifFalse: [f putc($,) ].
].
f puts(S',\'\\0\'};\n').
f puts(",\'\\0\'};\n").
}
}

View File

@ -2,7 +2,7 @@
// TEST CASES for namespacing
//
#include 'Moo.moo'.
#include "Moo.moo".
class MyObject(Object)
@ -425,7 +425,7 @@ extend MyObject
0 priorTo: limit by: 1 do: [ :idx |
| tb |
tb := tc at: idx.
System log(System.Log.INFO, idx asString, (if (tb value) { ' PASS' } else { ' FAIL' }), S'\n').
System log(System.Log.INFO, idx asString, (if (tb value) { " PASS" } else { " FAIL" }), "\n").
].
}
}

View File

@ -1,5 +1,5 @@
#include 'Moo.moo'.
#include "Moo.moo".
////////////////////////////////////////////////////////////////#
// MAIN
@ -179,7 +179,7 @@ class MyObject(Object)
0 priorTo: limit by: 1 do: [ :idx |
| tb |
tb := tc at: idx.
System log(System.Log.INFO, idx asString, (if (tb value) { ' PASS' } else { ' FAIL' }), S'\n').
System log(System.Log.INFO, idx asString, (if (tb value) { " PASS" } else { " FAIL" }), "\n").
].
}
}

View File

@ -2,7 +2,7 @@
// TEST CASES for basic methods
//
#include 'Moo.moo'.
#include "Moo.moo".
////////////////////////////////////////////////////////////////#
// MAIN
@ -42,7 +42,7 @@ class MyObject(Object)
3 to: 100 do: [ :i |
//(results at: i - 2) dump.
//(results at: i - 3) dump.
//'----------' dump.
//"----------" dump.
results add: (rec value: (results at: i - 2) value: (results at: i - 3)).
].
@ -79,9 +79,9 @@ class MyObject(Object)
[([] isKindOf: Context) == true],
// 15-20
[('string' isKindOf: String) == true],
[("string" isKindOf: String) == true],
[(#symbol isKindOf: String) == true],
[('string' isKindOf: Symbol) == false],
[("string" isKindOf: Symbol) == false],
[(#symbol isKindOf: Symbol) == true]
).
@ -90,11 +90,11 @@ class MyObject(Object)
0 priorTo: limit by: 1 do: [ :idx |
| tb |
tb := tc at: idx.
System log(System.Log.INFO, idx asString, (if (tb value) { ' PASS' } else { ' FAIL' }), "\n").
System log(System.Log.INFO, idx asString, (if (tb value) { " PASS" } else { " FAIL" }), "\n").
].
// TODO:
String format('%s', " 나 는\\\"") dump.
String format("%s", " 나 는\\\"") dump.
#"a b\nc" dump.
}
}

View File

@ -49,7 +49,7 @@ class MyObject(Object)
System sleepForSecs: 1.
sg wait.
sg removeSemaphore: s1.
'********** END OF TESTER *************' dump.
"********** END OF TESTER *************" dump.
}
method(#class) main
@ -67,9 +67,9 @@ sg removeSemaphore: s1.
0 priorTo: limit by: 1 do: [ :idx |
| tb |
tb := tc at: idx.
System log(System.Log.INFO, idx asString, (if (tb value) { ' PASS' } else { ' FAIL' }), S'\n').
System log(System.Log.INFO, idx asString, (if (tb value) { " PASS" } else { " FAIL" }), "\n").
].
'********** END OF MAIN PROGRAM *************' dump.
"********** END OF MAIN PROGRAM *************" dump.
}
}

View File

@ -1,5 +1,5 @@
#include 'Moo.moo'.
#include "Moo.moo".
////////////////////////////////////////////////////////////////#
// MAIN
@ -66,7 +66,7 @@ class MyObject(TestObject)
{
| a |
a := self yyy: aBlock.
'KKKKKKKKKKKKKKKKKKKKKKKKKKKKK' dump.
"KKKKKKKKKKKKKKKKKKKKKKKKKKKKK" dump.
^a.
}
method(#class) main2
@ -116,12 +116,12 @@ class MyObject(TestObject)
#[ 1 2 3] dump.
#[ 4 5 6] dump.
#(#abc:def: 2 'string is good' 3 4 #(5 6) #(7 #(8 9)) 10) dump.
#(#abc:def: 2 "string is good" 3 4 #(5 6) #(7 #(8 9)) 10) dump.
#(#[] #[]) dump.
a := #(#abc:def: -2 'string is good' 3 #[2 3 4] 4 #(5 6) #(7 #(8 #[4 56] 'hello' 9)) 10 -93952 #self true false nil #thisContext #super).
a at: 3 put: 'hello world'; dump.
a := #(#abc:def: -2 "string is good" 3 #[2 3 4] 4 #(5 6) #(7 #(8 #[4 56] "hello" 9)) 10 -93952 #self true false nil #thisContext #super).
a at: 3 put: "hello world"; dump.
a := self new.
@ -131,8 +131,8 @@ class MyObject(TestObject)
b := 0.
[ b < 9 ] whileTrue: [ b dump. b := b + 1 ].
S'hello \t\u78966\u8765\u3456\u2723\x20\123world\uD57C\uB85C\uC6B0' dump.
C'\n' dump.
"hello \t\u78966\u8765\u3456\u2723\x20\123world\uD57C\uB85C\uC6B0" dump.
C"\n" dump.
#abc:def: dump.
//a := (11 < 10) ifTrue: [5] ifFalse: [20].
@ -155,7 +155,7 @@ class MyObject(TestObject)
// ---------------------------------------------------------------------------
// this sample demonstrates what happens when a block context returns to the origin's caller
// this sample demonstrates what happens when a block context returns to the origin"s caller
// after the caller has already returned.
method(#class) xxxx
@ -202,22 +202,22 @@ class MyObject(TestObject)
sum := [ :n | (n < 2) ifTrue: [1] ifFalse: [ n + (sum value: (n - 1))] ].
(sum value: 5) dump.
'-------------------------' dump.
"-------------------------" dump.
b := 0.
[ b < 2000 ] whileTrue: [ b dump. b := b + 1 ].
'-------------------------' dump.
"-------------------------" dump.
b := 0.
[ b < 10 ] whileTrue: [ b dump. b := b + 1 ].
'-------------------------' dump.
"-------------------------" dump.
a := #[4 5 6 7] at: 3.
(#[3 2 1] at: 3) dump.
// thisContext value. // the message value must be unresolvable as thisContext is a method context
// [thisContext value] value.
'-------------------------' dump.
"-------------------------" dump.
b := 0.
[ b := b + 1. b dump. thisContext value] value.
@ -245,18 +245,18 @@ class MyObject(TestObject)
method(#class) getABlock
{
^ [ 'a block returned by getABlock' dump. "^ self"]
^ [ "a block returned by getABlock" dump. "^ self"]
}
method(#class) test_ffi
{
| ffi |
ffi := FFI new: 'libc.so.6'.
ffi := FFI new: "libc.so.6".
// ffi call: #printf with: #((str '%d') (int 10) (long 20)).
ffi call: #printf signature: '|s|ici)i' arguments: #("hello world %d %c %d\n" 11123 $X 9876543).
//ffi call: #puts signature: 's)i' arguments: #('hello world').
// ffi call: #printf with: #((str "%d") (int 10) (long 20)).
ffi call: #printf signature: "|s|ici)i" arguments: #("hello world %d %c %d\n" 11123 $X 9876543).
//ffi call: #puts signature: "s)i" arguments: #("hello world").
ffi close.
}
@ -264,8 +264,8 @@ class MyObject(TestObject)
{
// ---------------------------------------------------------------
// getABlock has returned.
// aBlock's home context is getABlock. getABlock has returned
// when 'aBlock value' is executed. so when aBlock is really
// aBlock"s home context is getABlock. getABlock has returned
// when "aBlock value" is executed. so when aBlock is really
// executed, ^self is a double return attempt. should this be made
// illegal??
|aBlock|
@ -278,16 +278,16 @@ class MyObject(TestObject)
/* -----------------------------
PROCESS TESTING
| p |
'000000000000000000' dump.
// p := [ | 'xxxxxxxxxxx' dump. 'yyyyyyyyyy' dump. ^10. ] newProcess.
"000000000000000000" dump.
// p := [ | "xxxxxxxxxxx" dump. "yyyyyyyyyy" dump. ^10. ] newProcess.
p := [ :a :b :c :d | a dump. b dump. (c + d) dump. ^10. ] newProcessWith: #(abc def 10 20).
'999999999999999999' dump.
"999999999999999999" dump.
p resume.
'111111111111111111' dump.
'222222222222222222' dump.
'333333333333333333' dump.
'444444444444444444' dump.
"111111111111111111" dump.
"222222222222222222" dump.
"333333333333333333" dump.
"444444444444444444" dump.
---------------------------- */
@ -436,20 +436,20 @@ PROCESS TESTING
[1 + [100 + 200] value] value dump.
'====================' dump.
"====================" dump.
[
| a b |
'--------------' dump.
"--------------" dump.
[a := 20. b := [ a + 20 ]. b value.] value dump.
a dump.
b dump.
] value.
'====================' dump.
"====================" dump.
([ :a :b | /*a := 20.*/ b := [ a + 20 ]. b value.] value: 99 value: 100) dump.
'====================' dump.
"====================" dump.
[ :a :b | a dump. b dump. a := 20. b := [ a + 20 ]. b value.] value dump. // not sufficient arguments. it must fail
//[ :a :b | a dump. b dump. a := 20. b := [ a + 20 ]. b value.] on: Exception do: [:ex | 'Exception' dump].
//[ :a :b | a dump. b dump. a := 20. b := [ a + 20 ]. b value.] on: Exception do: [:ex | "Exception" dump].
/*
FFI isNil dump.
@ -503,9 +503,9 @@ bc2 bc4 is shallow-copied of bc3. (bc3 value)
bc4.
--------------------------------------------------------------------------------
'home' is set when the context is created by blockCopy.
'caller' is set when the context is activated.
all 'origin' fields point to mc1 as a result.
"home" is set when the context is created by blockCopy.
"caller" is set when the context is activated.
all "origin" fields point to mc1 as a result.
self represents the receiver. that is bc->origin->receiver which is mc1->receiver.
--------------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
#include 'Moo.moo'.
#include "Moo.moo".
////////////////////////////////////////////////////////////////#
// MAIN
@ -60,43 +60,43 @@ class MyObject(TestObject)
method(#class) main
{
| v1 v2 |
System logNl: 'START OF MAIN'.
System logNl: "START OF MAIN".
v2 := [
[ v1 := [ System logNl: 'xxxxxxxxxxxxxxxxc'. Exception signal: 'qqqqq' ] value.
'OK OK OK' dump. ] ensure: [ System logNl: 'ENSURE ENSURE ENSURE'].
[ v1 := [ System logNl: "xxxxxxxxxxxxxxxxc". Exception signal: "qqqqq" ] value.
"OK OK OK" dump. ] ensure: [ System logNl: "ENSURE ENSURE ENSURE"].
]
on: Exception
do: [:ex |
System logNl: ('Exception: ' & ex messageText).
System logNl: ("Exception: " & ex messageText).
ex return: 10.
//ex retry.
System logNl: '--- THIS MUST NOT BE PRINTED ---'.
System logNl: "--- THIS MUST NOT BE PRINTED ---".
].
System logNl: '---------------------'.
System log: 'v1=>'; log: v1; log: ' v2=>'; logNl: v2.
System logNl: "---------------------".
System log: "v1=>"; log: v1; log: " v2=>"; logNl: v2.
v1 := [
[
[
//1 to: 20000 by: 1 do: [:i | System logNl: i asString. "System sleepForSecs: 1." ]
Processor activeProcess terminate.
] ensure: [ System logNl: '<<<PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP>>>' ].
] ensure: [ System logNl: "<<<PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP>>>" ].
] ensure: [ System logNl: '<<--------------------->>' ].
] ensure: [ System logNl: "<<--------------------->>" ].
] newProcess.
System logNl: 'RESUMING v1'.
System logNl: "RESUMING v1".
v1 resume.
System sleepForSecs: 1.
v1 terminate.
//[
// [ Processor activeProcess terminate. ] ensure: [System logNl: '<<<PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP>>>' ].
//] ensure: [ System logNl: '<<--------------------->>' ].
// [ Processor activeProcess terminate. ] ensure: [System logNl: "<<<PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP>>>" ].
//] ensure: [ System logNl: "<<--------------------->>" ].
System logNl: S'\0\0\0END OF MAIN\0AB\0\0\0C\0\0\0'.
System logNl: "\0\0\0END OF MAIN\0AB\0\0\0C\0\0\0".
}
}

View File

@ -102,8 +102,8 @@ class MyObject(TestObject)
v1 := MyConsole output.
v1 clear.
v1 box: 0@0 corner: 80@20.
v1 write: S'hello, \n'.
v1 write: S'하하하하하하하하 (^o^) ほのかちゃん \n'.
v1 write: "hello, 월드 이거 좋지 않니\n".
v1 write: "하하하하하하하하 좋아좋아 可愛くってしょうがない(^o^) ほのかちゃん、しおりちゃん元気そうだね! 久しぶりに見た。しおりちゃんどうしたのかな?좋아 하라하하\n".
v1 close.
self main2.
@ -118,7 +118,7 @@ class MyObject(TestObject)
* 765507696474864454832447821143032209556194237429024272487376513755618415740858933212778176226195677908876814855895611901838419364549855580388081219363378099926549770419687104031809304167273647479680584409544921582452247598843590335565958941218635089801691339265287920342381909847353843571491984747541378691432905678660731517460920201717549951480681654501180257614183394160869490681730637245109396396631700176391975994387097927483353281545628136320635813474136122790139443917922910896873631927820545774) asString.
System logNl:(-820186817651640487320479808367534510238779540102526006236474836166734016865205999870833760242352512045225158774173869894826877890589130978987229877889333678492731896878236182891224254464936050871086340438798130266913122427332418216677813151305680453358955006355665628938266331979307689540884269372365762883678113227136498054422414501840232090872158915536978847443767922315217311444711397048331496139248250188991402851129033493732164230227458717486395514436574417275149404197774547389507462779807727615
* 765507696474864454832447821143032209556194237429024272487376513755618415740858933212778176226195677908876814855895611901838419364549855580388081219363378099926549770419687104031809304167273647479680584409544921582452247598843590335565958941218635089801691339265287920342381909847353843571491984747541378691432905678660731517460920201717549951480681654501180257614183394160869490681730637245109396396631700176391975994387097927483353281545628136320635813474136122790139443917922910896873631927820545774) asString.
System logNl: S'\0\0\0END OF MAIN\0AB\0\0\0C\0\0\0'.
System logNl: "\0\0\0END OF MAIN\0AB\0\0\0C\0\0\0".
//v1 := Stdio2 open: '/tmp/1.txt' for: 'w+'.