2016-07-01 16:31:47 +00:00
|
|
|
|
2019-06-27 08:06:33 +00:00
|
|
|
#include "Moo.moo".
|
2016-07-01 16:31:47 +00:00
|
|
|
|
2019-06-27 06:29:09 +00:00
|
|
|
////////////////////////////////////////////////////////////////#
|
|
|
|
// MAIN
|
|
|
|
////////////////////////////////////////////////////////////////#
|
2016-07-01 16:31:47 +00:00
|
|
|
|
2019-06-27 06:29:09 +00:00
|
|
|
// TODO: use #define to define a class or use #class to define a class.
|
|
|
|
// use #extend to extend a class
|
|
|
|
// using #class for both feels confusing.
|
2016-07-01 16:31:47 +00:00
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
extend Apex
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
extend SmallInteger
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
2017-01-06 09:53:40 +00:00
|
|
|
method getTrue: anInteger
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
|
|
|
^anInteger + 9999.
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method inc
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
|
|
|
^self + 1.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
class TestObject(Object)
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
2017-04-24 09:20:27 +00:00
|
|
|
var(#class) Q, R.
|
|
|
|
var(#classinst) a1, a2.
|
2016-07-01 16:31:47 +00:00
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method test999
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
|
|
|
^self.Q
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
class B.TestObject(Object)
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
2017-04-24 09:20:27 +00:00
|
|
|
var(#class) Q, R.
|
|
|
|
var(#classinst) a1, a2.
|
2016-07-01 16:31:47 +00:00
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method test000
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
|
|
|
^self.Q
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
pooldic ABC
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
2019-09-30 08:46:50 +00:00
|
|
|
KKK := 20
|
2016-07-01 16:31:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
class MyObject(TestObject)
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) main
|
2016-07-01 16:31:47 +00:00
|
|
|
{
|
|
|
|
| v1 v2 |
|
2019-06-27 08:06:33 +00:00
|
|
|
System logNl: "START OF MAIN".
|
2016-07-01 16:31:47 +00:00
|
|
|
v2 := [
|
2019-06-27 08:06:33 +00:00
|
|
|
[ v1 := [ System logNl: "xxxxxxxxxxxxxxxxc". Exception signal: "qqqqq" ] value.
|
|
|
|
"OK OK OK" dump. ] ensure: [ System logNl: "ENSURE ENSURE ENSURE"].
|
2016-07-01 16:31:47 +00:00
|
|
|
]
|
|
|
|
on: Exception
|
|
|
|
do: [:ex |
|
2019-06-27 08:06:33 +00:00
|
|
|
System logNl: ("Exception: " & ex messageText).
|
2016-07-01 16:31:47 +00:00
|
|
|
ex return: 10.
|
2019-06-27 06:29:09 +00:00
|
|
|
//ex retry.
|
2019-06-27 08:06:33 +00:00
|
|
|
System logNl: "--- THIS MUST NOT BE PRINTED ---".
|
2016-07-01 16:31:47 +00:00
|
|
|
].
|
|
|
|
|
|
|
|
|
2019-06-27 08:06:33 +00:00
|
|
|
System logNl: "---------------------".
|
|
|
|
System log: "v1=>"; log: v1; log: " v2=>"; logNl: v2.
|
2016-07-01 16:31:47 +00:00
|
|
|
|
|
|
|
v1 := [
|
|
|
|
[
|
|
|
|
[
|
2019-06-27 06:29:09 +00:00
|
|
|
//1 to: 20000 by: 1 do: [:i | System logNl: i asString. "System sleepForSecs: 1." ]
|
2016-07-04 15:36:10 +00:00
|
|
|
Processor activeProcess terminate.
|
2019-06-27 08:06:33 +00:00
|
|
|
] ensure: [ System logNl: "<<<PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP>>>" ].
|
2016-07-01 16:31:47 +00:00
|
|
|
|
2019-06-27 08:06:33 +00:00
|
|
|
] ensure: [ System logNl: "<<--------------------->>" ].
|
2016-07-01 16:31:47 +00:00
|
|
|
] newProcess.
|
|
|
|
|
2019-06-27 08:06:33 +00:00
|
|
|
System logNl: "RESUMING v1".
|
2016-07-01 16:31:47 +00:00
|
|
|
v1 resume.
|
2017-11-05 16:47:13 +00:00
|
|
|
System sleepForSecs: 1.
|
2016-07-01 16:31:47 +00:00
|
|
|
v1 terminate.
|
|
|
|
|
2019-06-27 06:29:09 +00:00
|
|
|
//[
|
2019-06-27 08:06:33 +00:00
|
|
|
// [ Processor activeProcess terminate. ] ensure: [System logNl: "<<<PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP>>>" ].
|
|
|
|
//] ensure: [ System logNl: "<<--------------------->>" ].
|
2016-07-01 16:31:47 +00:00
|
|
|
|
2019-06-27 08:06:33 +00:00
|
|
|
System logNl: "\0\0\0END OF MAIN\0AB\0\0\0C\0\0\0".
|
2016-07-01 16:31:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|