changed the compiler to remove all leading spaces from a method name when composing a primitive identifer.
started enhancing the compiler to support the #pragma directive
This commit is contained in:
parent
d8bcb6e012
commit
76b975a152
@ -187,14 +187,14 @@ extend Apex
|
|||||||
|
|
||||||
method(#dual) isNil
|
method(#dual) isNil
|
||||||
{
|
{
|
||||||
"^self == nil."
|
## ^self == nil.
|
||||||
^false
|
^false
|
||||||
}
|
}
|
||||||
|
|
||||||
method(#dual) notNil
|
method(#dual) notNil
|
||||||
{
|
{
|
||||||
"^(self == nil) not"
|
## ^(self == nil) not
|
||||||
"^self ~= nil."
|
## ^self ~= nil.
|
||||||
^true.
|
^true.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,21 +115,21 @@ class(#pointer,#final,#limited) BlockContext(Context)
|
|||||||
|
|
||||||
method fork
|
method fork
|
||||||
{
|
{
|
||||||
"crate a new process in the runnable state"
|
## crate a new process in the runnable state
|
||||||
^self newProcess resume.
|
^self newProcess resume.
|
||||||
}
|
}
|
||||||
|
|
||||||
method newProcess
|
method newProcess
|
||||||
{
|
{
|
||||||
"create a new process in the suspended state"
|
## create a new process in the suspended state
|
||||||
<primitive: #_block_new_process>
|
<primitive: #_block_new_process>
|
||||||
self primitiveFailed.
|
self primitiveFailed.
|
||||||
}
|
}
|
||||||
|
|
||||||
method newProcessWith: anArray
|
method newProcessWith: anArray
|
||||||
{
|
{
|
||||||
"create a new process in the suspended state passing the elements
|
## create a new process in the suspended state passing the elements
|
||||||
of anArray as block arguments"
|
## of anArray as block arguments
|
||||||
<primitive: #_block_new_process>
|
<primitive: #_block_new_process>
|
||||||
self primitiveFailed.
|
self primitiveFailed.
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ class(#pointer,#final,#limited) BlockContext(Context)
|
|||||||
* --------------------------------------------------
|
* --------------------------------------------------
|
||||||
| pc |
|
| pc |
|
||||||
pc := thisContext pcplus1.
|
pc := thisContext pcplus1.
|
||||||
(self value) ifTrue: [ ^nil "^self" ].
|
(self value) ifTrue: [ ^nil ]. ## ^self
|
||||||
aBlock value.
|
aBlock value.
|
||||||
thisContext goto: pc.
|
thisContext goto: pc.
|
||||||
* -------------------------------------------------- *)
|
* -------------------------------------------------- *)
|
||||||
@ -293,7 +293,7 @@ class(#pointer,#final,#limited) BlockContext(Context)
|
|||||||
* --------------------------------------------------
|
* --------------------------------------------------
|
||||||
| pc |
|
| pc |
|
||||||
pc := thisContext pcplus1.
|
pc := thisContext pcplus1.
|
||||||
(self value) ifTrue: [ ^nil "^self" ].
|
(self value) ifTrue: [ ^nil ]. ## ^self
|
||||||
thisContext goto: pc.
|
thisContext goto: pc.
|
||||||
* -------------------------------------------------- *)
|
* -------------------------------------------------- *)
|
||||||
while ((self value) == false) { }.
|
while ((self value) == false) { }.
|
||||||
|
@ -80,7 +80,7 @@ while (ctx notNil)
|
|||||||
System logNl: '== END OF BACKTRACE =='.
|
System logNl: '== END OF BACKTRACE =='.
|
||||||
|
|
||||||
thisContext unwindTo: (thisProcess initialContext) return: nil.
|
thisContext unwindTo: (thisProcess initialContext) return: nil.
|
||||||
('### EXCEPTION NOT HANDLED #### ' & self class name & ' - ' & self messageText) dump.
|
('### EXCEPTION NOT HANDLED(Exception) #### ' & self class name & ' - ' & self messageText) dump.
|
||||||
## TODO: debug the current process???? "
|
## TODO: debug the current process???? "
|
||||||
|
|
||||||
##Processor activeProcess terminate.
|
##Processor activeProcess terminate.
|
||||||
|
@ -210,26 +210,10 @@ method(#class,#abstract) xxx. => method(#class) xxx { self subclassResponsibilit
|
|||||||
method(#class) new: size { self messageProhibited: #new: }
|
method(#class) new: size { self messageProhibited: #new: }
|
||||||
*)
|
*)
|
||||||
|
|
||||||
method(#primitive) _addSemaphore: sem.
|
method(#primitive) addSemaphore: sem.
|
||||||
method(#primitive) _removeSemaphore: sem.
|
method(#primitive) removeSemaphore: sem.
|
||||||
method(#primitive) _wait.
|
method(#primitive) _wait.
|
||||||
|
|
||||||
method addSemaphore: sem
|
|
||||||
{
|
|
||||||
| x |
|
|
||||||
x := self _addSemaphore: sem.
|
|
||||||
if (x isError) { Exception signal: ('Cannot add a semaphore - ' & x asString) }.
|
|
||||||
^x
|
|
||||||
}
|
|
||||||
|
|
||||||
method removeSemaphore: sem
|
|
||||||
{
|
|
||||||
| x |
|
|
||||||
x := self _removeSemaphore: sem.
|
|
||||||
if (x isError) { Exception signal: ('Cannot remove a semaphore - ' & x asString) }.
|
|
||||||
^x
|
|
||||||
}
|
|
||||||
|
|
||||||
method wait
|
method wait
|
||||||
{
|
{
|
||||||
| x |
|
| x |
|
||||||
|
@ -110,6 +110,7 @@ class MyObject(Object)
|
|||||||
'wrong module name'
|
'wrong module name'
|
||||||
'failed to import module'
|
'failed to import module'
|
||||||
'#include error'
|
'#include error'
|
||||||
|
'wrong pragma name'
|
||||||
'wrong namespace name'
|
'wrong namespace name'
|
||||||
'wrong pool dictionary name'
|
'wrong pool dictionary name'
|
||||||
'duplicate pool dictionary name'
|
'duplicate pool dictionary name'
|
||||||
|
@ -155,8 +155,8 @@ 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. "
|
## after the caller has already returned.
|
||||||
|
|
||||||
method(#class) xxxx
|
method(#class) xxxx
|
||||||
{
|
{
|
||||||
@ -180,7 +180,7 @@ class MyObject(TestObject)
|
|||||||
method(#class) main66
|
method(#class) main66
|
||||||
{
|
{
|
||||||
self yyyy.
|
self yyyy.
|
||||||
t2 := t2 value. "can t2 return? it should return somewhere into the method context of yyy. but it has already terminated"
|
t2 := t2 value. ## can t2 return? it should return somewhere into the method context of yyy. but it has already terminated
|
||||||
t2 dump.
|
t2 dump.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ class MyObject(TestObject)
|
|||||||
t1 := 1.
|
t1 := 1.
|
||||||
self xxxx.
|
self xxxx.
|
||||||
|
|
||||||
t2 := t2 value. "can t2 return? it should return somewhere into the method context of yyy. but it has already terminated"
|
t2 := t2 value. ## can t2 return? it should return somewhere into the method context of yyy. but it has already terminated
|
||||||
t2 dump.
|
t2 dump.
|
||||||
}
|
}
|
||||||
## ----------------------------------------------------------------------
|
## ----------------------------------------------------------------------
|
||||||
@ -215,7 +215,7 @@ class MyObject(TestObject)
|
|||||||
(#[3 2 1] at: 3) dump.
|
(#[3 2 1] at: 3) dump.
|
||||||
|
|
||||||
|
|
||||||
## thisContext value. "the message value must be unresolvable as thisContext is a method context"
|
## thisContext value. ## the message value must be unresolvable as thisContext is a method context
|
||||||
## [thisContext value] value.
|
## [thisContext value] value.
|
||||||
'-------------------------' dump.
|
'-------------------------' dump.
|
||||||
b := 0.
|
b := 0.
|
||||||
@ -354,7 +354,9 @@ PROCESS TESTING
|
|||||||
|
|
||||||
(2r1111111111111111111111111111111111111111111111111111111111111111 printStringRadix:2) dump.
|
(2r1111111111111111111111111111111111111111111111111111111111111111 printStringRadix:2) dump.
|
||||||
|
|
||||||
"(16rF0FFFF bitOr: 16r111111) dump.
|
(* -----------------------
|
||||||
|
|
||||||
|
(16rF0FFFF bitOr: 16r111111) dump.
|
||||||
|
|
||||||
(16r11 bitOr: 16r20000000000000000000000000000000FFFFFFFFFFFFFFFF11111100000000000000000001) dump.
|
(16r11 bitOr: 16r20000000000000000000000000000000FFFFFFFFFFFFFFFF11111100000000000000000001) dump.
|
||||||
((16r11 bitOr: 16r20000000000000000000000000000000FFFFFFFFFFFFFFFF11111100000000000000000001) bitOr: 16r1100) dump.
|
((16r11 bitOr: 16r20000000000000000000000000000000FFFFFFFFFFFFFFFF11111100000000000000000001) bitOr: 16r1100) dump.
|
||||||
@ -365,7 +367,8 @@ PROCESS TESTING
|
|||||||
((2r11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 bitXor: 2r11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111) printStringRadix: 2) dump.
|
((2r11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 bitXor: 2r11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111) printStringRadix: 2) dump.
|
||||||
|
|
||||||
((2r10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 bitAnd: 2r01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010) printStringRadix: 2) dump.
|
((2r10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 bitAnd: 2r01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010) printStringRadix: 2) dump.
|
||||||
"
|
|
||||||
|
--------------------- *)
|
||||||
|
|
||||||
(16rFFFFFFFFFFFFFFFF bitOr: 16rFFFFFFFFFFFFFFFFFFFFFFFF) dump.
|
(16rFFFFFFFFFFFFFFFF bitOr: 16rFFFFFFFFFFFFFFFFFFFFFFFF) dump.
|
||||||
(-16rFFFFFFFFFFFFFFFF bitOr: 16rFFFFFFFFFFFFFFFFFFFFFFFF) dump.
|
(-16rFFFFFFFFFFFFFFFF bitOr: 16rFFFFFFFFFFFFFFFFFFFFFFFF) dump.
|
||||||
|
103
moo/lib/comp.c
103
moo/lib/comp.c
@ -138,8 +138,10 @@ static struct voca_t
|
|||||||
{ 8, { '#','p','o','i','n','t','e','r' } },
|
{ 8, { '#','p','o','i','n','t','e','r' } },
|
||||||
{ 7, { 'p','o','o','l','d','i','c' } },
|
{ 7, { 'p','o','o','l','d','i','c' } },
|
||||||
{ 8, { '#','p','o','o','l','d','i','c' } },
|
{ 8, { '#','p','o','o','l','d','i','c' } },
|
||||||
|
{ 7, { '#','p','r','a','g','m','a' } },
|
||||||
{ 10, { 'p','r','i','m','i','t','i','v','e',':' } },
|
{ 10, { 'p','r','i','m','i','t','i','v','e',':' } },
|
||||||
{ 10, { '#','p','r','i','m','i','t','i','v','e' } },
|
{ 10, { '#','p','r','i','m','i','t','i','v','e' } },
|
||||||
|
{ 2, { 'q','c' } },
|
||||||
{ 4, { 's','e','l','f' } },
|
{ 4, { 's','e','l','f' } },
|
||||||
{ 6, { 's','e','l','f','n','s' } },
|
{ 6, { 's','e','l','f','n','s' } },
|
||||||
{ 4, { '#','s','e','t' } },
|
{ 4, { '#','s','e','t' } },
|
||||||
@ -198,8 +200,10 @@ enum voca_id_t
|
|||||||
VOCA_POINTER_S,
|
VOCA_POINTER_S,
|
||||||
VOCA_POOLDIC,
|
VOCA_POOLDIC,
|
||||||
VOCA_POOLDIC_S,
|
VOCA_POOLDIC_S,
|
||||||
|
VOCA_PRAGMA_S,
|
||||||
VOCA_PRIMITIVE_COLON,
|
VOCA_PRIMITIVE_COLON,
|
||||||
VOCA_PRIMITIVE_S,
|
VOCA_PRIMITIVE_S,
|
||||||
|
VOCA_QC,
|
||||||
VOCA_SELF,
|
VOCA_SELF,
|
||||||
VOCA_SELFNS,
|
VOCA_SELFNS,
|
||||||
VOCA_SET_S,
|
VOCA_SET_S,
|
||||||
@ -456,7 +460,7 @@ static int copy_string_to (moo_t* moo, const moo_oocs_t* src, moo_oocs_t* dst, m
|
|||||||
*dst_capa = capa;
|
*dst_capa = capa;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (append && delim_char) dst->ptr[pos++] = delim_char;
|
if (append && delim_char != '\0') dst->ptr[pos++] = delim_char;
|
||||||
moo_copyoochars (&dst->ptr[pos], src->ptr, src->len);
|
moo_copyoochars (&dst->ptr[pos], src->ptr, src->len);
|
||||||
dst->len = len;
|
dst->len = len;
|
||||||
return 0;
|
return 0;
|
||||||
@ -914,6 +918,7 @@ static int skip_comment (moo_t* moo)
|
|||||||
moo_ooci_t c = moo->c->lxc.c;
|
moo_ooci_t c = moo->c->lxc.c;
|
||||||
moo_iolxc_t lc;
|
moo_iolxc_t lc;
|
||||||
|
|
||||||
|
#if defined(MOO_ENABLE_QUOTED_COMMENT)
|
||||||
if (c == '"')
|
if (c == '"')
|
||||||
{
|
{
|
||||||
/* skip up to the closing " */
|
/* skip up to the closing " */
|
||||||
@ -927,7 +932,9 @@ static int skip_comment (moo_t* moo)
|
|||||||
if (c == '"') GET_CHAR (moo); /* keep the next character in lxc */
|
if (c == '"') GET_CHAR (moo); /* keep the next character in lxc */
|
||||||
return 1; /* double-quoted comment */
|
return 1; /* double-quoted comment */
|
||||||
}
|
}
|
||||||
else if (c == '(')
|
else
|
||||||
|
#endif
|
||||||
|
if (c == '(')
|
||||||
{
|
{
|
||||||
/* handle (* ... *) */
|
/* handle (* ... *) */
|
||||||
lc = moo->c->lxc;
|
lc = moo->c->lxc;
|
||||||
@ -1869,6 +1876,13 @@ retry:
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(MOO_ENABLE_QUOTED_COMMENT)
|
||||||
|
case '"':
|
||||||
|
if (get_string(moo, '"', '\\', 0, 0) <= -1) return -1;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case 'C': /* a character with a C-style escape sequence */
|
case 'C': /* a character with a C-style escape sequence */
|
||||||
case 'S': /* a string with a C-style escape sequences */
|
case 'S': /* a string with a C-style escape sequences */
|
||||||
case 'M': /* a symbol with a C-style escape sequences */
|
case 'M': /* a symbol with a C-style escape sequences */
|
||||||
@ -3789,9 +3803,9 @@ static int compile_method_pragma (moo_t* moo)
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* method-pragma := "<" "primitive:" integer ">" |
|
* method-pragma := "<" "primitive:" integer ">" |
|
||||||
* "<" "primitive:" symbol ">" |
|
* "<" "primitive:" symbol ">" |
|
||||||
* "<" "exception" ">" |
|
* "<" "exception" ">" |
|
||||||
* "<" "ensure" ">"
|
* "<" "ensure" ">"
|
||||||
*/
|
*/
|
||||||
moo_ooi_t pfnum;
|
moo_ooi_t pfnum;
|
||||||
const moo_ooch_t* ptr, * end;
|
const moo_ooch_t* ptr, * end;
|
||||||
@ -6434,14 +6448,38 @@ static int __compile_method_definition (moo_t* moo)
|
|||||||
moo_oow_t savedlen;
|
moo_oow_t savedlen;
|
||||||
moo_ooi_t pfnum;
|
moo_ooi_t pfnum;
|
||||||
moo_pfbase_t* pfbase;
|
moo_pfbase_t* pfbase;
|
||||||
|
moo_oocs_t mthname;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* primitive identifer = classname_methodname */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* remove all leading underscores from the method name when building a primitive
|
||||||
|
* identifer. multiple methods can map to the same primitive handler.
|
||||||
|
* for class X, you may have method(#primitive) aa and method(#primitive) _aa
|
||||||
|
* to map to the X_aa primitive handler.
|
||||||
|
*/
|
||||||
|
mthname = moo->c->mth.name;
|
||||||
|
while (mthname.len > 0)
|
||||||
|
{
|
||||||
|
if (*mthname.ptr != '_') break;
|
||||||
|
mthname.ptr++;
|
||||||
|
mthname.len--;
|
||||||
|
}
|
||||||
|
if (mthname.len == 0)
|
||||||
|
{
|
||||||
|
MOO_DEBUG2 (moo, "Invalid primitive function name - %.*js\n", moo->c->mth.name.len, moo->c->mth.name.ptr);
|
||||||
|
set_syntax_error (moo, MOO_SYNERR_PFIDINVAL, &moo->c->mth.name_loc, &moo->c->mth.name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compose the identifer into the back of the cls.modname buffer.
|
||||||
|
* i'll revert it when done. */
|
||||||
savedlen = moo->c->cls.modname.len;
|
savedlen = moo->c->cls.modname.len;
|
||||||
|
|
||||||
/* primitive identifer = classname_methodname
|
if (copy_string_to(moo, &moo->c->cls.name, &moo->c->cls.modname, &moo->c->cls.modname_capa, 1, '\0') <= -1 ||
|
||||||
* let me compose the identifer into the back of the cls.modname buffer.
|
copy_string_to(moo, &mthname, &moo->c->cls.modname, &moo->c->cls.modname_capa, 1, '_') <= -1)
|
||||||
* i'll revert it when done */
|
|
||||||
if (copy_string_to (moo, &moo->c->cls.name, &moo->c->cls.modname, &moo->c->cls.modname_capa, 1, '\0') <= -1 ||
|
|
||||||
copy_string_to (moo, &moo->c->mth.name, &moo->c->cls.modname, &moo->c->cls.modname_capa, 1, '_') <= -1)
|
|
||||||
{
|
{
|
||||||
moo->c->cls.modname.len = savedlen;
|
moo->c->cls.modname.len = savedlen;
|
||||||
return -1;
|
return -1;
|
||||||
@ -7862,6 +7900,46 @@ static int compile_pooldic_definition (moo_t* moo, moo_pooldic_t* pd)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int compile_pragma_definition (moo_t* moo)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
GET_TOKEN (moo);
|
||||||
|
|
||||||
|
if (TOKEN_TYPE(moo) != MOO_IOTOK_IDENT)
|
||||||
|
{
|
||||||
|
set_syntax_error (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_token_word(moo, VOCA_QC))
|
||||||
|
{
|
||||||
|
/* #pragma qc */
|
||||||
|
/* TODO: #pragma qc=on, #progma qc=off, #pragma qc(on), $pragma qc(off) */
|
||||||
|
/* TODO ... */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_syntax_error (moo, MOO_SYNERR_PRAGMAINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
GET_TOKEN (moo);
|
||||||
|
if (TOKEN_TYPE(moo) == MOO_IOTOK_PERIOD) goto done;
|
||||||
|
}
|
||||||
|
while (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA);
|
||||||
|
|
||||||
|
if (TOKEN_TYPE(moo) != MOO_IOTOK_PERIOD)
|
||||||
|
{
|
||||||
|
set_syntax_error (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
GET_TOKEN (moo);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int compile_stream (moo_t* moo)
|
static int compile_stream (moo_t* moo)
|
||||||
{
|
{
|
||||||
GET_TOKEN (moo);
|
GET_TOKEN (moo);
|
||||||
@ -7879,6 +7957,11 @@ static int compile_stream (moo_t* moo)
|
|||||||
}
|
}
|
||||||
if (begin_include(moo) <= -1) return -1;
|
if (begin_include(moo) <= -1) return -1;
|
||||||
}
|
}
|
||||||
|
else if (is_token_symbol(moo, VOCA_PRAGMA_S))
|
||||||
|
{
|
||||||
|
/*GET_TOKEN (moo);*/
|
||||||
|
if (compile_pragma_definition(moo) <= -1) return -1;
|
||||||
|
}
|
||||||
else if (is_token_word(moo, VOCA_CLASS))
|
else if (is_token_word(moo, VOCA_CLASS))
|
||||||
{
|
{
|
||||||
/* class Selfclass(Superclass) { } */
|
/* class Selfclass(Superclass) { } */
|
||||||
|
@ -137,13 +137,14 @@ static moo_ooch_t synerrstr_60[] = {'w','r','o','n','g',' ','p','r','i','m','i',
|
|||||||
static moo_ooch_t synerrstr_61[] = {'w','r','o','n','g',' ','m','o','d','u','l','e',' ','n','a','m','e','\0'};
|
static moo_ooch_t synerrstr_61[] = {'w','r','o','n','g',' ','m','o','d','u','l','e',' ','n','a','m','e','\0'};
|
||||||
static moo_ooch_t synerrstr_62[] = {'f','a','i','l','e','d',' ','t','o',' ','i','m','p','o','r','t',' ','m','o','d','u','l','e','\0'};
|
static moo_ooch_t synerrstr_62[] = {'f','a','i','l','e','d',' ','t','o',' ','i','m','p','o','r','t',' ','m','o','d','u','l','e','\0'};
|
||||||
static moo_ooch_t synerrstr_63[] = {'#','i','n','c','l','u','d','e',' ','e','r','r','o','r','\0'};
|
static moo_ooch_t synerrstr_63[] = {'#','i','n','c','l','u','d','e',' ','e','r','r','o','r','\0'};
|
||||||
static moo_ooch_t synerrstr_64[] = {'w','r','o','n','g',' ','n','a','m','e','s','p','a','c','e',' ','n','a','m','e','\0'};
|
static moo_ooch_t synerrstr_64[] = {'w','r','o','n','g',' ','p','r','a','g','m','a',' ','n','a','m','e','\0'};
|
||||||
static moo_ooch_t synerrstr_65[] = {'w','r','o','n','g',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'};
|
static moo_ooch_t synerrstr_65[] = {'w','r','o','n','g',' ','n','a','m','e','s','p','a','c','e',' ','n','a','m','e','\0'};
|
||||||
static moo_ooch_t synerrstr_66[] = {'d','u','p','l','i','c','a','t','e',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'};
|
static moo_ooch_t synerrstr_66[] = {'w','r','o','n','g',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'};
|
||||||
static moo_ooch_t synerrstr_67[] = {'l','i','t','e','r','a','l',' ','e','x','p','e','c','t','e','d','\0'};
|
static moo_ooch_t synerrstr_67[] = {'d','u','p','l','i','c','a','t','e',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'};
|
||||||
static moo_ooch_t synerrstr_68[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','n','o','t',' ','w','i','t','h','i','n',' ','a',' ','l','o','o','p','\0'};
|
static moo_ooch_t synerrstr_68[] = {'l','i','t','e','r','a','l',' ','e','x','p','e','c','t','e','d','\0'};
|
||||||
static moo_ooch_t synerrstr_69[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','w','i','t','h','i','n',' ','a',' ','b','l','o','c','k','\0'};
|
static moo_ooch_t synerrstr_69[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','n','o','t',' ','w','i','t','h','i','n',' ','a',' ','l','o','o','p','\0'};
|
||||||
static moo_ooch_t synerrstr_70[] = {'w','h','i','l','e',' ','e','x','p','e','c','t','e','d','\0'};
|
static moo_ooch_t synerrstr_70[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','w','i','t','h','i','n',' ','a',' ','b','l','o','c','k','\0'};
|
||||||
|
static moo_ooch_t synerrstr_71[] = {'w','h','i','l','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||||
static moo_ooch_t* synerrstr[] =
|
static moo_ooch_t* synerrstr[] =
|
||||||
{
|
{
|
||||||
synerrstr_0, synerrstr_1, synerrstr_2, synerrstr_3, synerrstr_4, synerrstr_5, synerrstr_6, synerrstr_7,
|
synerrstr_0, synerrstr_1, synerrstr_2, synerrstr_3, synerrstr_4, synerrstr_5, synerrstr_6, synerrstr_7,
|
||||||
@ -154,7 +155,7 @@ static moo_ooch_t* synerrstr[] =
|
|||||||
synerrstr_40, synerrstr_41, synerrstr_42, synerrstr_43, synerrstr_44, synerrstr_45, synerrstr_46, synerrstr_47,
|
synerrstr_40, synerrstr_41, synerrstr_42, synerrstr_43, synerrstr_44, synerrstr_45, synerrstr_46, synerrstr_47,
|
||||||
synerrstr_48, synerrstr_49, synerrstr_50, synerrstr_51, synerrstr_52, synerrstr_53, synerrstr_54, synerrstr_55,
|
synerrstr_48, synerrstr_49, synerrstr_50, synerrstr_51, synerrstr_52, synerrstr_53, synerrstr_54, synerrstr_55,
|
||||||
synerrstr_56, synerrstr_57, synerrstr_58, synerrstr_59, synerrstr_60, synerrstr_61, synerrstr_62, synerrstr_63,
|
synerrstr_56, synerrstr_57, synerrstr_58, synerrstr_59, synerrstr_60, synerrstr_61, synerrstr_62, synerrstr_63,
|
||||||
synerrstr_64, synerrstr_65, synerrstr_66, synerrstr_67, synerrstr_68, synerrstr_69, synerrstr_70
|
synerrstr_64, synerrstr_65, synerrstr_66, synerrstr_67, synerrstr_68, synerrstr_69, synerrstr_70, synerrstr_71
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/* END: GENERATED WITH generr.moo */
|
/* END: GENERATED WITH generr.moo */
|
||||||
|
@ -1616,11 +1616,11 @@ static moo_pfrc_t pf_dump (moo_t* moo, moo_ooi_t nargs)
|
|||||||
MOO_ASSERT (moo, nargs >= 0);
|
MOO_ASSERT (moo, nargs >= 0);
|
||||||
|
|
||||||
/*moo_logbfmt (moo, 0, "RECEIVER: %O IN PID %d SP %d XSP %d\n", MOO_STACK_GET(moo, moo->sp - nargs), (int)MOO_OOP_TO_SMOOI(moo->processor->active->id), (int)moo->sp, (int)MOO_OOP_TO_SMOOI(moo->processor->active->sp));*/
|
/*moo_logbfmt (moo, 0, "RECEIVER: %O IN PID %d SP %d XSP %d\n", MOO_STACK_GET(moo, moo->sp - nargs), (int)MOO_OOP_TO_SMOOI(moo->processor->active->id), (int)moo->sp, (int)MOO_OOP_TO_SMOOI(moo->processor->active->sp));*/
|
||||||
moo_logbfmt (moo, 0, "RECEIVER: %O IN PID %d\n", MOO_STACK_GET(moo, moo->sp - nargs), (int)MOO_OOP_TO_SMOOI(moo->processor->active->id));
|
moo_logbfmt (moo, MOO_LOG_FATAL | MOO_LOG_APP, "RECEIVER: %O IN PID %d\n", MOO_STACK_GET(moo, moo->sp - nargs), (int)MOO_OOP_TO_SMOOI(moo->processor->active->id));
|
||||||
for (i = nargs; i > 0; )
|
for (i = nargs; i > 0; )
|
||||||
{
|
{
|
||||||
--i;
|
--i;
|
||||||
moo_logbfmt (moo, 0, "ARGUMENT %zd: %O\n", i, MOO_STACK_GET(moo, moo->sp - i));
|
moo_logbfmt (moo, MOO_LOG_FATAL | MOO_LOG_APP, "ARGUMENT %zd: %O\n", i, MOO_STACK_GET(moo, moo->sp - i));
|
||||||
}
|
}
|
||||||
|
|
||||||
MOO_STACK_SETRETTORCV (moo, nargs); /* ^self */
|
MOO_STACK_SETRETTORCV (moo, nargs); /* ^self */
|
||||||
@ -2582,7 +2582,7 @@ static moo_pfrc_t pf_semaphore_group_add_semaphore (moo_t* moo, moo_ooi_t nargs)
|
|||||||
MOO_PF_CHECK_RCV (moo, moo_iskindof(moo, (moo_oop_t)rcv, moo->_semaphore_group));
|
MOO_PF_CHECK_RCV (moo, moo_iskindof(moo, (moo_oop_t)rcv, moo->_semaphore_group));
|
||||||
|
|
||||||
sem = (moo_oop_semaphore_t)MOO_STACK_GETARG (moo, nargs, 0);
|
sem = (moo_oop_semaphore_t)MOO_STACK_GETARG (moo, nargs, 0);
|
||||||
MOO_PF_CHECK_ARGS (moo, nargs, moo_iskindof(moo, (moo_oop_t)sem, moo->_semaphore));
|
MOO_PF_CHECK_ARGS_STRICT (moo, nargs, moo_iskindof(moo, (moo_oop_t)sem, moo->_semaphore));
|
||||||
|
|
||||||
if ((moo_oop_t)sem->group == moo->_nil)
|
if ((moo_oop_t)sem->group == moo->_nil)
|
||||||
{
|
{
|
||||||
@ -4354,9 +4354,9 @@ static pf_t pftab[] =
|
|||||||
{ "_integer_inttostr", { pf_integer_inttostr, 1, 1 } },
|
{ "_integer_inttostr", { pf_integer_inttostr, 1, 1 } },
|
||||||
|
|
||||||
{ "Apex_addToBeFinalized", { pf_add_to_be_finalized, 0, 0 } },
|
{ "Apex_addToBeFinalized", { pf_add_to_be_finalized, 0, 0 } },
|
||||||
{ "Apex__basicNew", { pf_basic_new, 0, 0 } },
|
{ "Apex_basicNew", { pf_basic_new, 0, 0 } },
|
||||||
{ "Apex__basicNew:", { pf_basic_new, 1, 1 } },
|
{ "Apex_basicNew:", { pf_basic_new, 1, 1 } },
|
||||||
{ "Apex__basicSize", { pf_basic_size, 0, 0 } },
|
{ "Apex_basicSize", { pf_basic_size, 0, 0 } },
|
||||||
{ "Apex_basicNew", { pf_basic_new, 0, 0 } },
|
{ "Apex_basicNew", { pf_basic_new, 0, 0 } },
|
||||||
{ "Apex_basicNew:", { pf_basic_new, 1, 1 } },
|
{ "Apex_basicNew:", { pf_basic_new, 1, 1 } },
|
||||||
{ "Apex_basicSize", { pf_basic_size, 0, 0 } },
|
{ "Apex_basicSize", { pf_basic_size, 0, 0 } },
|
||||||
@ -4373,13 +4373,13 @@ static pf_t pftab[] =
|
|||||||
{ "Process_sp", { pf_process_sp, 0, 0 } },
|
{ "Process_sp", { pf_process_sp, 0, 0 } },
|
||||||
{ "Process_suspend", { pf_process_suspend, 0, 0 } },
|
{ "Process_suspend", { pf_process_suspend, 0, 0 } },
|
||||||
{ "Process_yield", { pf_process_yield, 0, 0 } },
|
{ "Process_yield", { pf_process_yield, 0, 0 } },
|
||||||
{ "Process__terminate", { pf_process_terminate, 0, 0 } },
|
{ "Process_terminate", { pf_process_terminate, 0, 0 } },
|
||||||
|
|
||||||
{ "Semaphore_signal", { pf_semaphore_signal, 0, 0 } },
|
{ "Semaphore_signal", { pf_semaphore_signal, 0, 0 } },
|
||||||
{ "Semaphore__wait", { pf_semaphore_wait, 0, 0 } },
|
{ "Semaphore_wait", { pf_semaphore_wait, 0, 0 } },
|
||||||
{ "SemaphoreGroup__addSemaphore:", { pf_semaphore_group_add_semaphore, 1, 1 } },
|
{ "SemaphoreGroup_addSemaphore:", { pf_semaphore_group_add_semaphore, 1, 1 } },
|
||||||
{ "SemaphoreGroup__removeSemaphore:", { pf_semaphore_group_remove_semaphore, 1, 1 } },
|
{ "SemaphoreGroup_removeSemaphore:", { pf_semaphore_group_remove_semaphore, 1, 1 } },
|
||||||
{ "SemaphoreGroup__wait", { pf_semaphore_group_wait, 0, 0 } },
|
{ "SemaphoreGroup_wait", { pf_semaphore_group_wait, 0, 0 } },
|
||||||
|
|
||||||
{ "SmallInteger_asCharacter", { pf_smooi_as_character, 0, 0 } },
|
{ "SmallInteger_asCharacter", { pf_smooi_as_character, 0, 0 } },
|
||||||
{ "SmallInteger_asError", { pf_smooi_as_error, 0, 0 } },
|
{ "SmallInteger_asError", { pf_smooi_as_error, 0, 0 } },
|
||||||
@ -4403,37 +4403,36 @@ static pf_t pftab[] =
|
|||||||
{ "SmallPointer_putUint32", { pf_smptr_put_uint32, 2, 2 } },
|
{ "SmallPointer_putUint32", { pf_smptr_put_uint32, 2, 2 } },
|
||||||
{ "SmallPointer_putUint64", { pf_smptr_put_uint64, 2, 2 } },
|
{ "SmallPointer_putUint64", { pf_smptr_put_uint64, 2, 2 } },
|
||||||
|
|
||||||
{ "String__strlen", { pf_strlen, 0, 0 } },
|
|
||||||
{ "String_strlen", { pf_strlen, 0, 0 } },
|
{ "String_strlen", { pf_strlen, 0, 0 } },
|
||||||
|
|
||||||
{ "System__calloc", { pf_system_calloc, 1, 1 } },
|
{ "System_calloc", { pf_system_calloc, 1, 1 } },
|
||||||
{ "System__free", { pf_system_free, 1, 1 } },
|
{ "System_free", { pf_system_free, 1, 1 } },
|
||||||
{ "System__getInt16", { pf_system_get_int16, 2, 2 } },
|
{ "System_getInt16", { pf_system_get_int16, 2, 2 } },
|
||||||
{ "System__getInt32", { pf_system_get_int32, 2, 2 } },
|
{ "System_getInt32", { pf_system_get_int32, 2, 2 } },
|
||||||
{ "System__getInt64", { pf_system_get_int64, 2, 2 } },
|
{ "System_getInt64", { pf_system_get_int64, 2, 2 } },
|
||||||
{ "System__getInt8", { pf_system_get_int8, 2, 2 } },
|
{ "System_getInt8", { pf_system_get_int8, 2, 2 } },
|
||||||
{ "System__getUint16", { pf_system_get_uint16, 2, 2 } },
|
{ "System_getUint16", { pf_system_get_uint16, 2, 2 } },
|
||||||
{ "System__getUint32", { pf_system_get_uint32, 2, 2 } },
|
{ "System_getUint32", { pf_system_get_uint32, 2, 2 } },
|
||||||
{ "System__getUint64", { pf_system_get_uint64, 2, 2 } },
|
{ "System_getUint64", { pf_system_get_uint64, 2, 2 } },
|
||||||
{ "System__getUint8", { pf_system_get_uint8, 2, 2 } },
|
{ "System_getUint8", { pf_system_get_uint8, 2, 2 } },
|
||||||
{ "System__malloc", { pf_system_malloc, 1, 1 } },
|
{ "System_malloc", { pf_system_malloc, 1, 1 } },
|
||||||
{ "System__popCollectable", { pf_system_pop_collectable, 0, 0 } },
|
{ "System_popCollectable", { pf_system_pop_collectable, 0, 0 } },
|
||||||
{ "System__putInt8", { pf_system_put_int8, 3, 3 } },
|
{ "System_putInt8", { pf_system_put_int8, 3, 3 } },
|
||||||
{ "System__putInt16", { pf_system_put_int16, 3, 3 } },
|
{ "System_putInt16", { pf_system_put_int16, 3, 3 } },
|
||||||
{ "System__putInt32", { pf_system_put_int32, 3, 3 } },
|
{ "System_putInt32", { pf_system_put_int32, 3, 3 } },
|
||||||
{ "System__putInt64", { pf_system_put_int64, 3, 3 } },
|
{ "System_putInt64", { pf_system_put_int64, 3, 3 } },
|
||||||
{ "System__putUint8", { pf_system_put_uint8, 3, 3 } },
|
{ "System_putUint8", { pf_system_put_uint8, 3, 3 } },
|
||||||
{ "System__putUint16", { pf_system_put_uint16, 3, 3 } },
|
{ "System_putUint16", { pf_system_put_uint16, 3, 3 } },
|
||||||
{ "System__putUint32", { pf_system_put_uint32, 3, 3 } },
|
{ "System_putUint32", { pf_system_put_uint32, 3, 3 } },
|
||||||
{ "System__putUint64", { pf_system_put_uint64, 3, 3 } },
|
{ "System_putUint64", { pf_system_put_uint64, 3, 3 } },
|
||||||
|
|
||||||
{ "System__signal:afterSecs:", { pf_system_add_timed_semaphore, 2, 2 } },
|
{ "System_signal:afterSecs:", { pf_system_add_timed_semaphore, 2, 2 } },
|
||||||
{ "System__signal:afterSecs:nanosecs:", { pf_system_add_timed_semaphore, 3, 3 } },
|
{ "System_signal:afterSecs:nanosecs:", { pf_system_add_timed_semaphore, 3, 3 } },
|
||||||
{ "System__signal:onInput:", { pf_system_add_input_semaphore, 2, 2 } },
|
{ "System_signal:onInput:", { pf_system_add_input_semaphore, 2, 2 } },
|
||||||
{ "System__signal:onInOutput:", { pf_system_add_inoutput_semaphore, 2, 2 } },
|
{ "System_signal:onInOutput:", { pf_system_add_inoutput_semaphore, 2, 2 } },
|
||||||
{ "System__signal:onOutput:", { pf_system_add_output_semaphore, 2, 2 } },
|
{ "System_signal:onOutput:", { pf_system_add_output_semaphore, 2, 2 } },
|
||||||
{ "System__signalOnGCFin:", { pf_system_add_gcfin_semaphore, 1, 1 } },
|
{ "System_signalOnGCFin:", { pf_system_add_gcfin_semaphore, 1, 1 } },
|
||||||
{ "System__unsignal:", { pf_system_remove_semaphore, 1, 1 } },
|
{ "System_unsignal:", { pf_system_remove_semaphore, 1, 1 } },
|
||||||
|
|
||||||
{ "System_collectGarbage", { pf_system_collect_garbage, 0, 0 } },
|
{ "System_collectGarbage", { pf_system_collect_garbage, 0, 0 } },
|
||||||
{ "System_log", { pf_system_log, 2, MA } },
|
{ "System_log", { pf_system_log, 2, MA } },
|
||||||
@ -4751,7 +4750,7 @@ static int start_method (moo_t* moo, moo_oop_method_t method, moo_oow_t nargs)
|
|||||||
if (method->code == moo->_nil)
|
if (method->code == moo->_nil)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* no byte code to execute - make it a hard failure */
|
/* no byte code to execute - invoke 'self primitiveFailed' */
|
||||||
|
|
||||||
static moo_ooch_t prim_fail_msg[] = {
|
static moo_ooch_t prim_fail_msg[] = {
|
||||||
'p', 'r', 'i', 'm', 'i', 't', 'i', 'v', 'e',
|
'p', 'r', 'i', 'm', 'i', 't', 'i', 'v', 'e',
|
||||||
|
@ -2097,10 +2097,12 @@ static int handle_logopt (moo_t* moo, const moo_bch_t* str)
|
|||||||
|
|
||||||
}
|
}
|
||||||
while (cm);
|
while (cm);
|
||||||
|
|
||||||
|
xtn->logmask |= MOO_LOG_ALL_LEVELS; /* TODO: parse leves also */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xtn->logmask = MOO_LOG_ALL_TYPES;
|
xtn->logmask = MOO_LOG_ALL_LEVELS | MOO_LOG_ALL_TYPES;
|
||||||
}
|
}
|
||||||
|
|
||||||
xtn->logfd = open (xstr, O_CREAT | O_WRONLY | O_APPEND , 0644);
|
xtn->logfd = open (xstr, O_CREAT | O_WRONLY | O_APPEND , 0644);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "moo-cmn.h"
|
#include "moo-cmn.h"
|
||||||
|
|
||||||
/**\file
|
/** \file
|
||||||
* This file provides a red-black tree encapsulated in the #moo_rbt_t type that
|
* This file provides a red-black tree encapsulated in the #moo_rbt_t type that
|
||||||
* implements a self-balancing binary search tree.Its interface is very close
|
* implements a self-balancing binary search tree.Its interface is very close
|
||||||
* to #moo_htb_t.
|
* to #moo_htb_t.
|
||||||
|
@ -37,6 +37,12 @@
|
|||||||
* this is used to embed bytes codes into the back of a compile method
|
* this is used to embed bytes codes into the back of a compile method
|
||||||
* object instead of putting in in a separate byte array. */
|
* object instead of putting in in a separate byte array. */
|
||||||
#define MOO_USE_METHOD_TRAILER
|
#define MOO_USE_METHOD_TRAILER
|
||||||
|
|
||||||
|
|
||||||
|
/* TODO: turn this to per-file pragma
|
||||||
|
* for instance, #pragma qc.
|
||||||
|
/*#define MOO_ENABLE_QUOTED_COMMENT*/
|
||||||
|
|
||||||
/* ========================================================================== */
|
/* ========================================================================== */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1021,8 +1027,9 @@ struct moo_pfinfo_t
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define MOO_PF_CHECK_ARGS_STRICT(moo,nargs,cond) do { \
|
#define MOO_PF_CHECK_ARGS_STRICT(moo,nargs,cond) do { \
|
||||||
if (!(cond)) { MOO_STACK_SETRETTOERROR ((moo), (nargs), MOO_EINVAL); return MOO_PF_FAILURE; } \
|
if (!(cond)) { moo_seterrnum (moo, MOO_EINVAL); return MOO_PF_FAILURE; } \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
* MODULE MANIPULATION
|
* MODULE MANIPULATION
|
||||||
* ========================================================================= */
|
* ========================================================================= */
|
||||||
@ -1512,6 +1519,7 @@ enum moo_synerrnum_t
|
|||||||
MOO_SYNERR_MODNAMEINVAL, /* wrong module name */
|
MOO_SYNERR_MODNAMEINVAL, /* wrong module name */
|
||||||
MOO_SYNERR_MODIMPFAIL, /* failed to import module */
|
MOO_SYNERR_MODIMPFAIL, /* failed to import module */
|
||||||
MOO_SYNERR_INCLUDE, /* #include error */
|
MOO_SYNERR_INCLUDE, /* #include error */
|
||||||
|
MOO_SYNERR_PRAGMAINVAL, /* wrong pragma name */
|
||||||
MOO_SYNERR_NAMESPACEINVAL, /* wrong namespace name */
|
MOO_SYNERR_NAMESPACEINVAL, /* wrong namespace name */
|
||||||
MOO_SYNERR_POOLDICINVAL, /* wrong pool dictionary */
|
MOO_SYNERR_POOLDICINVAL, /* wrong pool dictionary */
|
||||||
MOO_SYNERR_POOLDICDUPL, /* duplicate pool dictionary */
|
MOO_SYNERR_POOLDICDUPL, /* duplicate pool dictionary */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user