added more preamable codes.
enhanced the system to be able to attach trailing spaces to an object upon instantiation, especially for external modules to be able to secure GC-safe free workspace inside an instantiated object added moo_setclasstrsize(), moo_getobjtrailer() for the trailer feature
This commit is contained in:
@ -31,15 +31,20 @@ class Apex(nil)
|
||||
## -------------------------------------------------------
|
||||
## -------------------------------------------------------
|
||||
|
||||
method(#class) __trailer_size
|
||||
{
|
||||
^0
|
||||
}
|
||||
|
||||
method(#class) basicNew
|
||||
{
|
||||
<primitive: #_basic_new>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
method(#class) basicNew: anInteger
|
||||
|
||||
method(#class) basicNew: size
|
||||
{
|
||||
<primitive: #_basic_new_with_size>
|
||||
<primitive: #_basic_new>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
@ -51,7 +56,7 @@ class Apex(nil)
|
||||
|
||||
method(#class) ngcNew: anInteger
|
||||
{
|
||||
<primitive: #_ngc_new_with_size>
|
||||
<primitive: #_ngc_new>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
##
|
||||
class(#pointer) Class(Apex)
|
||||
{
|
||||
dcl spec selfspec superclass subclasses name instvars classvars classinstvars pooldics instmthdic classmthdic nsdic.
|
||||
dcl spec selfspec superclass subclasses name instvars classvars classinstvars pooldics instmthdic classmthdic nsdic trsize.
|
||||
|
||||
method(#class) basicNew
|
||||
{
|
||||
|
@ -187,14 +187,14 @@ extend MethodContext
|
||||
{
|
||||
method isExceptionContext
|
||||
{
|
||||
## 10 - MOO_METHOD_PREAMBLE_EXCEPTION in VM.
|
||||
^self.method preambleCode == 10.
|
||||
## 12 - MOO_METHOD_PREAMBLE_EXCEPTION in VM.
|
||||
^self.method preambleCode == 12.
|
||||
}
|
||||
|
||||
method isEnsureContext
|
||||
{
|
||||
## 10 - MOO_METHOD_PREAMBLE_ENSURE in VM.
|
||||
^self.method preambleCode == 11
|
||||
## 13 - MOO_METHOD_PREAMBLE_ENSURE in VM.
|
||||
^self.method preambleCode == 13
|
||||
}
|
||||
|
||||
method ensureBlock
|
||||
@ -208,7 +208,7 @@ extend MethodContext
|
||||
* 8 instance variables, the ensure block must be at the 9th position
|
||||
* which translates to index 8 *)
|
||||
|
||||
(self.method preambleCode == 11) ifFalse: [^nil].
|
||||
(self.method preambleCode == 13) ifFalse: [^nil].
|
||||
^self basicAt: 8.
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class(#byte) _FFI(Module) from 'ffi'
|
||||
class _FFI(Object) from 'ffi'
|
||||
{
|
||||
(*
|
||||
* the ffi module installs the following methods
|
||||
|
@ -1,18 +0,0 @@
|
||||
class(#byte) Module(Object)
|
||||
{
|
||||
method(#class) _newInstSize
|
||||
{
|
||||
self subclassResponsibility: #_newInstSize
|
||||
}
|
||||
|
||||
method(#class) new: size
|
||||
{
|
||||
## ignore the specified size
|
||||
^(super new: (self _newInstSize))
|
||||
}
|
||||
|
||||
method(#class) new
|
||||
{
|
||||
^(super new: (self _newInstSize))
|
||||
}
|
||||
}
|
@ -8,8 +8,6 @@
|
||||
#include 'Process.moo'.
|
||||
|
||||
(* -------------------------------------------------------------------------- *)
|
||||
#include 'Module.moo'.
|
||||
|
||||
#include 'FFI.moo'.
|
||||
#include 'Stdio.moo'.
|
||||
#include 'Console.moo'.
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
class(#byte) Stdio(Module) from 'stdio'
|
||||
class Stdio(Object) from 'stdio'
|
||||
{
|
||||
dcl(#class) in out err.
|
||||
|
||||
@ -63,7 +63,7 @@ extend Stdio
|
||||
}
|
||||
}
|
||||
|
||||
class(#byte) Stdio2(Stdio)
|
||||
class Stdio2(Stdio)
|
||||
{
|
||||
method(#class) new
|
||||
{
|
||||
|
@ -73,6 +73,7 @@ class MyObject(Object)
|
||||
'duplicate class'
|
||||
'contradictory class definition'
|
||||
'wrong class name'
|
||||
'non-pointer class inheriting superclass with trailer size set'
|
||||
'dcl not allowed'
|
||||
'wrong method name'
|
||||
'duplicate method name'
|
||||
|
Reference in New Issue
Block a user