2016-08-20 05:17:47 +00:00
|
|
|
|
2017-01-09 12:52:37 +00:00
|
|
|
#include 'Moo.moo'.
|
2016-08-20 05:17:47 +00:00
|
|
|
|
2019-06-27 06:29:09 +00:00
|
|
|
////////////////////////////////////////////////////////////////#
|
|
|
|
// MAIN
|
|
|
|
////////////////////////////////////////////////////////////////#
|
2016-08-20 05:17:47 +00:00
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
extend Apex
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
extend SmallInteger
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
2017-01-06 09:53:40 +00:00
|
|
|
method getTrue: anInteger
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
|
|
|
^anInteger + 9999.
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method inc
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
|
|
|
^self + 1.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
class TestObject(Object)
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
2017-04-24 09:20:27 +00:00
|
|
|
var(#class) Q, R.
|
|
|
|
var(#classinst) a1, a2.
|
2016-08-20 05:17:47 +00:00
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method test999
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
|
|
|
^self.Q
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
class B.TestObject(Object)
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
2017-06-07 04:46:14 +00:00
|
|
|
var(#class) Q, R.
|
|
|
|
var(#classinst) a1, a2.
|
2016-08-20 05:17:47 +00:00
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method test000
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
|
|
|
^self.Q
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
pooldic ABC
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
2019-09-30 08:46:50 +00:00
|
|
|
KKK := 20
|
2016-08-20 05:17:47 +00:00
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
pooldic SRX.ABC
|
2016-08-29 06:10:02 +00:00
|
|
|
{
|
2019-09-30 08:46:50 +00:00
|
|
|
JJJ := 1000
|
2016-08-29 06:10:02 +00:00
|
|
|
}
|
2017-01-06 09:53:40 +00:00
|
|
|
class MyConsole(Console)
|
2016-08-23 00:37:22 +00:00
|
|
|
{
|
2017-01-06 09:53:40 +00:00
|
|
|
method box: origin corner: corner
|
2016-08-23 00:37:22 +00:00
|
|
|
{
|
|
|
|
| tmp |
|
|
|
|
self setCursor: origin.
|
|
|
|
self write: '+'.
|
2016-08-29 06:10:02 +00:00
|
|
|
(corner x - origin x - 1) timesRepeat: [self write: '-'].
|
2016-08-23 00:37:22 +00:00
|
|
|
self write: '+'.
|
|
|
|
|
|
|
|
tmp := Point new.
|
|
|
|
|
|
|
|
(origin y + 1) to: (corner y - 1) by: 1 do: [ :i |
|
|
|
|
tmp x: origin x y: i.
|
|
|
|
self setCursor: tmp.
|
|
|
|
self write: '|'.
|
|
|
|
|
|
|
|
tmp x: corner x.
|
|
|
|
self setCursor: tmp.
|
|
|
|
self write: '|'.
|
|
|
|
].
|
|
|
|
|
|
|
|
tmp x: origin x y: corner y.
|
|
|
|
self setCursor: tmp.
|
|
|
|
self write: '+'.
|
2016-08-29 06:10:02 +00:00
|
|
|
(corner x - origin x - 1) timesRepeat: [self write: '-'].
|
2016-08-23 00:37:22 +00:00
|
|
|
self write: '+'.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
class MyObject(TestObject)
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
2019-06-27 06:29:09 +00:00
|
|
|
//import(#pooldic) ABC, SRX.ABC.
|
2017-04-24 09:20:27 +00:00
|
|
|
import ABC, SRX.ABC.
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) main
|
2016-08-20 05:17:47 +00:00
|
|
|
{
|
|
|
|
| v1 v2 |
|
2016-09-14 04:56:00 +00:00
|
|
|
|
2016-11-12 03:02:12 +00:00
|
|
|
v2 := 'have fun'.
|
2016-09-14 04:56:00 +00:00
|
|
|
|
|
|
|
v2 at: 0 put: $H.
|
|
|
|
|
2016-12-13 15:18:19 +00:00
|
|
|
System logNl: ('START OF MAIN - ' & v2).
|
2016-08-20 05:17:47 +00:00
|
|
|
|
2016-08-23 00:37:22 +00:00
|
|
|
v1 := MyConsole output.
|
|
|
|
v1 clear.
|
|
|
|
v1 box: 0@0 corner: 80@20.
|
2019-06-27 08:06:33 +00:00
|
|
|
v1 write: "hello, 월드 이거 좋지 않니\n".
|
|
|
|
v1 write: "하하하하하하하하 좋아좋아 可愛くってしょうがない(^o^) ほのかちゃん、しおりちゃん元気そうだね! 久しぶりに見た。しおりちゃんどうしたのかな?좋아 하라하하\n".
|
2016-08-20 05:17:47 +00:00
|
|
|
v1 close.
|
|
|
|
|
2016-11-12 03:02:12 +00:00
|
|
|
self main2.
|
2016-11-09 15:50:18 +00:00
|
|
|
|
|
|
|
System logNl: (9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
|
|
* 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888) asString.
|
|
|
|
System logNl: (9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
|
|
- 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888) asString.
|
|
|
|
System logNl: (8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
|
|
|
|
- 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999) asString.
|
|
|
|
System logNl:(820186817651640487320479808367534510238779540102526006236474836166734016865205999870833760242352512045225158774173869894826877890589130978987229877889333678492731896878236182891224254464936050871086340438798130266913122427332418216677813151305680453358955006355665628938266331979307689540884269372365762883678113227136498054422414501840232090872158915536978847443767922315217311444711397048331496139248250188991402851129033493732164230227458717486395514436574417275149404197774547389507462779807727615
|
|
|
|
* 765507696474864454832447821143032209556194237429024272487376513755618415740858933212778176226195677908876814855895611901838419364549855580388081219363378099926549770419687104031809304167273647479680584409544921582452247598843590335565958941218635089801691339265287920342381909847353843571491984747541378691432905678660731517460920201717549951480681654501180257614183394160869490681730637245109396396631700176391975994387097927483353281545628136320635813474136122790139443917922910896873631927820545774) asString.
|
|
|
|
System logNl:(-820186817651640487320479808367534510238779540102526006236474836166734016865205999870833760242352512045225158774173869894826877890589130978987229877889333678492731896878236182891224254464936050871086340438798130266913122427332418216677813151305680453358955006355665628938266331979307689540884269372365762883678113227136498054422414501840232090872158915536978847443767922315217311444711397048331496139248250188991402851129033493732164230227458717486395514436574417275149404197774547389507462779807727615
|
|
|
|
* 765507696474864454832447821143032209556194237429024272487376513755618415740858933212778176226195677908876814855895611901838419364549855580388081219363378099926549770419687104031809304167273647479680584409544921582452247598843590335565958941218635089801691339265287920342381909847353843571491984747541378691432905678660731517460920201717549951480681654501180257614183394160869490681730637245109396396631700176391975994387097927483353281545628136320635813474136122790139443917922910896873631927820545774) asString.
|
2019-06-27 08:06:33 +00:00
|
|
|
System logNl: "\0\0\0END OF MAIN\0AB\0\0\0C\0\0\0".
|
2016-11-18 18:11:13 +00:00
|
|
|
|
|
|
|
|
2019-06-27 06:29:09 +00:00
|
|
|
//v1 := Stdio2 open: '/tmp/1.txt' for: 'w+'.
|
2017-03-30 14:59:55 +00:00
|
|
|
v1 := Stdio2 new open('/tmp/1.txt', 'w+').
|
2016-12-26 18:44:47 +00:00
|
|
|
(v1 isError)
|
|
|
|
ifTrue: [
|
2016-12-27 18:15:35 +00:00
|
|
|
System logNl: ('Error in opening a file....' & v1 asString).
|
2016-12-26 18:44:47 +00:00
|
|
|
]
|
|
|
|
ifFalse: [
|
2019-06-27 06:29:09 +00:00
|
|
|
// v1 puts: 'hello'.
|
2016-12-28 13:42:12 +00:00
|
|
|
v1 puts ('hello', 'world', 'good', C'\n', C'\t', 'under my umbrella 123.', C'\n').
|
2016-12-26 18:44:47 +00:00
|
|
|
v1 close.
|
|
|
|
|
2019-06-19 12:38:09 +00:00
|
|
|
/*v1 format(10, 20) isNil ifFalse: [
|
2016-12-26 18:44:47 +00:00
|
|
|
'Beautiful life' dump.
|
2019-06-19 12:38:09 +00:00
|
|
|
].*/
|
2016-12-26 18:44:47 +00:00
|
|
|
].
|
2016-11-21 13:56:20 +00:00
|
|
|
nil isNil ifTrue: [ 'NIL NIL NIL' dump. ].
|
|
|
|
(Apex new) notNil ifTrue: [ 'APEX NIL NIL NIL' dump. ].
|
2016-12-06 17:21:47 +00:00
|
|
|
|
2016-12-14 07:18:01 +00:00
|
|
|
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.
|
2017-04-01 06:54:27 +00:00
|
|
|
self varg_test3 (10, 20, 30, 40, 50, 60, 70, 80, 90, 100) dump.
|
2016-12-14 07:18:01 +00:00
|
|
|
thisContext vargCount dump.
|
|
|
|
thisContext vargCount dump.
|
2016-12-28 13:42:12 +00:00
|
|
|
|
|
|
|
((2305843009213693951 bitAt: 61) = 0) ifFalse: [
|
|
|
|
System logNl: 'Test 1 failed'.
|
|
|
|
thisProcess terminate
|
|
|
|
].
|
|
|
|
|
|
|
|
((-2305843009213693951 bitAt: 62) = 1) ifFalse: [
|
|
|
|
System logNl: 'Test 2 failed'.
|
|
|
|
thisProcess terminate
|
|
|
|
].
|
|
|
|
|
|
|
|
((2r1000000000000000000000000000100000000000000000000000000000000000000000000000 bitAt: 120) = 0) ifFalse: [
|
|
|
|
System logNl: 'Test 3 failed'.
|
|
|
|
thisProcess terminate
|
|
|
|
].
|
|
|
|
|
|
|
|
((-2r1000000000000000000000000000100000000000000000000000000000000000000000000000 bitAt: 16rFFFFFFFFFFFFFFFF0) = 1) ifFalse: [
|
|
|
|
System logNl: 'Test 4 failed'.
|
|
|
|
thisProcess terminate
|
|
|
|
].
|
|
|
|
|
|
|
|
0 priorTo: 200 do: [:i |
|
|
|
|
| k |
|
|
|
|
k := 1 bitShift: i.
|
2019-06-27 06:29:09 +00:00
|
|
|
// (k printStringRadix: 2) dump.
|
2016-12-28 13:42:12 +00:00
|
|
|
((k bitAt: i) = 1) ifFalse: [
|
|
|
|
System logNl: 'Test 5 failed'.
|
|
|
|
thisProcess terminate.
|
|
|
|
].
|
|
|
|
((k bitAt: i - 1) = 0) ifFalse: [
|
|
|
|
System logNl: 'Test 6 failed'.
|
|
|
|
thisProcess terminate.
|
|
|
|
].
|
|
|
|
].
|
|
|
|
|
|
|
|
2r100000000_10001111_01010000 dump.
|
|
|
|
16rFFFFFFFF_12345678 dump.
|
2016-12-28 19:12:14 +00:00
|
|
|
|
|
|
|
(v1 := self t001()) isError ifTrue: [('t001 Error 111....' & v1 asInteger asString) dump].
|
|
|
|
(v1 := self t001(10)) isError ifTrue: [('t001 Error 222....' & v1 asInteger asString) dump].
|
|
|
|
(v1 := self t001(20)) isError ifTrue: [('t001 Error 333....' & v1 asInteger asString) dump].
|
2018-10-09 15:27:35 +00:00
|
|
|
#\e9999 dump.
|
|
|
|
#\e9999 asInteger dump.
|
2017-01-06 09:53:40 +00:00
|
|
|
|
|
|
|
v2 := (16rFFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFF) basicAt: 1 put: 1; yourself.
|
|
|
|
v2 dump.
|
2016-08-20 05:17:47 +00:00
|
|
|
}
|
|
|
|
|
2017-03-30 14:59:55 +00:00
|
|
|
method(#class,#variadic) varg_test()
|
2016-12-14 07:18:01 +00:00
|
|
|
{
|
|
|
|
0 to: (thisContext vargCount - 1) do: [:k |
|
|
|
|
(thisContext vargAt: k) dump.
|
|
|
|
].
|
|
|
|
^999
|
|
|
|
}
|
2017-03-30 14:59:55 +00:00
|
|
|
method(#class,#variadic) varg_test2(a,b,c)
|
2016-12-14 07:18:01 +00:00
|
|
|
{
|
2017-04-01 06:54:27 +00:00
|
|
|
'varg_test2 start .....' dump.
|
|
|
|
a dump.
|
|
|
|
b dump.
|
|
|
|
c dump.
|
|
|
|
'varg_test2 varg .....' dump.
|
|
|
|
0 priorTo: (thisContext vargCount) do: [:k |
|
2016-12-14 07:18:01 +00:00
|
|
|
(thisContext vargAt: k) dump.
|
|
|
|
].
|
2017-04-01 06:54:27 +00:00
|
|
|
'varg_test2 end .....' dump.
|
2016-12-14 07:18:01 +00:00
|
|
|
^a
|
|
|
|
}
|
2017-04-01 06:54:27 +00:00
|
|
|
method(#class,#liberal) varg_test3(a,b,c,d,e,f)
|
2016-12-14 07:18:01 +00:00
|
|
|
{
|
2017-04-01 06:54:27 +00:00
|
|
|
'varg_test3 start .....' dump.
|
|
|
|
0 priorTo: (thisContext vargCount) do: [:k |
|
2016-12-14 07:18:01 +00:00
|
|
|
(thisContext vargAt: k) dump.
|
|
|
|
].
|
2017-04-01 06:54:27 +00:00
|
|
|
'varg_test3 end .....' dump.
|
2019-06-27 06:29:09 +00:00
|
|
|
// ^b * 100
|
2016-12-14 07:18:01 +00:00
|
|
|
^f
|
|
|
|
}
|
2016-12-28 13:42:12 +00:00
|
|
|
|
2017-04-01 06:54:27 +00:00
|
|
|
method(#class,#liberal) t001(a)
|
2016-12-28 13:42:12 +00:00
|
|
|
{
|
2018-10-09 15:27:35 +00:00
|
|
|
a isNil ifTrue: [^#\e10].
|
|
|
|
(a = 20) ifTrue: [^#\e0 ].
|
2016-12-28 19:12:14 +00:00
|
|
|
(a = 10) ifTrue: [^123 asError].
|
2016-12-28 13:42:12 +00:00
|
|
|
^a.
|
|
|
|
|
2016-12-28 19:12:14 +00:00
|
|
|
#! a := error(10).
|
|
|
|
#! [ a = error(10) ] ifTrue: [....].
|
|
|
|
|
|
|
|
#! self t001 (error:10).
|
2017-01-05 10:16:04 +00:00
|
|
|
#! self t001: (error:10)
|
2016-12-28 13:42:12 +00:00
|
|
|
}
|
2016-08-20 05:17:47 +00:00
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
extend MyObject
|
2016-08-29 06:10:02 +00:00
|
|
|
{
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) main2
|
2016-08-29 06:10:02 +00:00
|
|
|
{
|
|
|
|
System logNl: KKK.
|
|
|
|
System logNl: SRX.ABC.JJJ.
|
|
|
|
System logNl: JJJ.
|
2016-10-04 17:58:28 +00:00
|
|
|
System logNl: -200 asString.
|
2016-08-29 06:10:02 +00:00
|
|
|
}
|
2017-03-30 14:59:55 +00:00
|
|
|
}
|