experimental code for better module handling

This commit is contained in:
hyunghwan.chung
2016-11-18 18:11:13 +00:00
parent dab3423f12
commit eaa9dbc958
21 changed files with 1314 additions and 323 deletions

View File

@ -66,6 +66,8 @@
#method(#class) new: anInteger
{
| x |
## TODO: check if the class is a fixed class.
## if so, raise an exception.
x := self basicNew: anInteger.
x initialize. "TODO: assess if it's good to call 'initialize' from new."
^x.
@ -175,6 +177,11 @@
## TODO: add = and ~= for equality check.
## -------------------------------------------------------
## COMMON QUERIES
## -------------------------------------------------------
#method isNil
{
"^self == nil."
@ -201,6 +208,16 @@
^true.
}
#method isError
{
^false
}
#method(#class) isError
{
^false
}
## -------------------------------------------------------
## -------------------------------------------------------
@ -287,6 +304,7 @@
{
self class cannotInstantiate
}
}
#class Object(Apex)

View File

@ -1,4 +1,7 @@
##
## the Class object should be a variable-pointer object because
## it needs to accomodate class instance variables.
##
#class(#pointer) Class(Apex)
{
#dcl spec selfspec superclass subclasses name instvars classvars classinstvars pooldics instmthdic classmthdic.

40
stix/kernel/Stdio.st Normal file
View File

@ -0,0 +1,40 @@
#class(#word) Stdio(Object)
{
#method(#class) new: size
{
##self prohibited
##raise exception. prohibited...
^nil.
}
#method(#class) new
{
##self prohibited
##raise exception. prohibited...
^nil.
}
#method(#class) open: name for: mode
{
^(super new: 1) open: name for: mode
}
#method open: name for: mode
{
<primitive: #stdio_open>
}
#method close
{
<primitive: #stdio_close>
}
#method xxx
{
self basicSize dump.
}
}
#class(#word) Stdio2 (Stdio)
{
}

View File

@ -11,6 +11,11 @@
"accept an arbitary object instead of a string.
the object can be sent displayString for string conversion"
}
#method isError
{
^true
}
}
#class Magnitude(Object)
@ -379,4 +384,5 @@ f isNil ifTrue: [ self error: 'No such function' ].
#########################################################################################
#include 'Stdio.st'.
#include 'Console.st'.

View File

@ -122,6 +122,11 @@
System logNl:(-820186817651640487320479808367534510238779540102526006236474836166734016865205999870833760242352512045225158774173869894826877890589130978987229877889333678492731896878236182891224254464936050871086340438798130266913122427332418216677813151305680453358955006355665628938266331979307689540884269372365762883678113227136498054422414501840232090872158915536978847443767922315217311444711397048331496139248250188991402851129033493732164230227458717486395514436574417275149404197774547389507462779807727615
* 765507696474864454832447821143032209556194237429024272487376513755618415740858933212778176226195677908876814855895611901838419364549855580388081219363378099926549770419687104031809304167273647479680584409544921582452247598843590335565958941218635089801691339265287920342381909847353843571491984747541378691432905678660731517460920201717549951480681654501180257614183394160869490681730637245109396396631700176391975994387097927483353281545628136320635813474136122790139443917922910896873631927820545774) asString.
System logNl: S'\0\0\0END OF MAIN\0AB\0\0\0C\0\0\0'.
v1 := Stdio open: '/tmp/1.txt' for: 'w+'.
v1 xxx.
v1 close.
}
}