added a new reserved word - thisProcess
This commit is contained in:
parent
a22f5ea0ab
commit
27f00148a1
@ -60,10 +60,13 @@
|
||||
## FATAL ERROR - no exception handler.
|
||||
## -----------------------------------------------------------------
|
||||
##thisContext unwindTo: nil return: nil.
|
||||
thisContext unwindTo: (Processor activeProcess initialContext) return: nil.
|
||||
##thisContext unwindTo: (Processor activeProcess initialContext) return: nil.
|
||||
thisContext unwindTo: (thisProcess initialContext) return: nil.
|
||||
('### EXCEPTION NOT HANDLED #### ', self class name, ' - ', self messageText) dump.
|
||||
## TODO: debug the current process???? "
|
||||
Processor activeProcess terminate.
|
||||
|
||||
##Processor activeProcess terminate.
|
||||
thisProcess terminate.
|
||||
}
|
||||
|
||||
#method signal: text
|
||||
|
@ -65,7 +65,7 @@
|
||||
##
|
||||
## 2) process terminated by itself
|
||||
## p := [
|
||||
## [ Processor activeProcess terminate. ] ensure: [System logNl: 'ensured....']
|
||||
## [ thisProcess terminate. ] ensure: [System logNl: 'ensured....']
|
||||
## ] newProcess.
|
||||
## p resume.
|
||||
## p terminate.
|
||||
@ -74,7 +74,8 @@
|
||||
## the process must not be scheduled.
|
||||
## ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
(Processor activeProcess ~~ self) ifTrue: [ self _suspend ].
|
||||
##(Processor activeProcess ~~ self) ifTrue: [ self _suspend ].
|
||||
(thisProcess ~~ self) ifTrue: [ self _suspend ].
|
||||
self.current_context unwindTo: self.initial_context return: nil.
|
||||
^self _terminate
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ static struct voca_t
|
||||
{ 4, { 's','e','l','f' } },
|
||||
{ 5, { 's','u','p','e','r' } },
|
||||
{ 11, { 't','h','i','s','C','o','n','t','e','x','t' } },
|
||||
{ 11, { 't','h','i','s','P','r','o','c','e','s','s' } },
|
||||
{ 4, { 't','r','u','e' } },
|
||||
{ 4, { 'w','o','r','d' } },
|
||||
|
||||
@ -138,6 +139,7 @@ enum voca_id_t
|
||||
VOCA_SELF,
|
||||
VOCA_SUPER,
|
||||
VOCA_THIS_CONTEXT,
|
||||
VOCA_THIS_PROCESS,
|
||||
VOCA_TRUE,
|
||||
VOCA_WORD,
|
||||
|
||||
@ -292,7 +294,8 @@ static int is_reserved_word (const stix_oocs_t* ucs)
|
||||
VOCA_NIL,
|
||||
VOCA_TRUE,
|
||||
VOCA_FALSE,
|
||||
VOCA_THIS_CONTEXT
|
||||
VOCA_THIS_CONTEXT,
|
||||
VOCA_THIS_PROCESS
|
||||
};
|
||||
int i;
|
||||
|
||||
@ -857,6 +860,10 @@ static int get_ident (stix_t* stix, stix_ooci_t char_read_ahead)
|
||||
{
|
||||
stix->c->tok.type = STIX_IOTOK_THIS_CONTEXT;
|
||||
}
|
||||
else if (is_token_word(stix, VOCA_THIS_PROCESS))
|
||||
{
|
||||
stix->c->tok.type = STIX_IOTOK_THIS_PROCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3271,6 +3278,7 @@ static int __read_array_literal (stix_t* stix, stix_oop_t* xlit)
|
||||
case STIX_IOTOK_SELF:
|
||||
case STIX_IOTOK_SUPER:
|
||||
case STIX_IOTOK_THIS_CONTEXT:
|
||||
case STIX_IOTOK_THIS_PROCESS:
|
||||
lit = stix_makesymbol (stix, stix->c->tok.name.ptr, stix->c->tok.name.len);
|
||||
break;
|
||||
|
||||
@ -3506,6 +3514,11 @@ static int compile_expression_primary (stix_t* stix, const stix_oocs_t* ident, c
|
||||
GET_TOKEN (stix);
|
||||
break;
|
||||
|
||||
case STIX_IOTOK_THIS_PROCESS:
|
||||
if (emit_byte_instruction(stix, BCODE_PUSH_PROCESS) <= -1) return -1;
|
||||
GET_TOKEN (stix);
|
||||
break;
|
||||
|
||||
case STIX_IOTOK_CHARLIT:
|
||||
STIX_ASSERT (stix->c->tok.name.len == 1);
|
||||
if (add_character_literal(stix, stix->c->tok.name.ptr[0], &index) <= -1 ||
|
||||
|
@ -415,6 +415,10 @@ return -1;
|
||||
LOG_INST_0 (stix, "push_context");
|
||||
break;
|
||||
|
||||
case BCODE_PUSH_PROCESS:
|
||||
LOG_INST_0 (stix, "push_process");
|
||||
break;
|
||||
|
||||
case BCODE_PUSH_NEGONE:
|
||||
LOG_INST_0 (stix, "push_negone");
|
||||
break;
|
||||
|
@ -3787,6 +3787,11 @@ return -1;
|
||||
STIX_STACK_PUSH (stix, (stix_oop_t)stix->active_context);
|
||||
break;
|
||||
|
||||
case BCODE_PUSH_PROCESS:
|
||||
LOG_INST_0 (stix, "push_process");
|
||||
STIX_STACK_PUSH (stix, (stix_oop_t)stix->processor->active);
|
||||
break;
|
||||
|
||||
case BCODE_PUSH_NEGONE:
|
||||
LOG_INST_0 (stix, "push_negone");
|
||||
STIX_STACK_PUSH (stix, STIX_SMOOI_TO_OOP(-1));
|
||||
|
@ -330,6 +330,7 @@ struct stix_iotok_t
|
||||
STIX_IOTOK_TRUE,
|
||||
STIX_IOTOK_FALSE,
|
||||
STIX_IOTOK_THIS_CONTEXT,
|
||||
STIX_IOTOK_THIS_PROCESS,
|
||||
STIX_IOTOK_IDENT,
|
||||
STIX_IOTOK_IDENT_DOTTED,
|
||||
STIX_IOTOK_BINSEL,
|
||||
@ -879,10 +880,11 @@ enum stix_bcode_t
|
||||
BCODE_PUSH_TRUE = 0x83, /* 131 */
|
||||
BCODE_PUSH_FALSE = 0x84, /* 132 */
|
||||
BCODE_PUSH_CONTEXT = 0x85, /* 133 */
|
||||
BCODE_PUSH_NEGONE = 0x86, /* 134 */
|
||||
BCODE_PUSH_ZERO = 0x87, /* 135 */
|
||||
BCODE_PUSH_ONE = 0x89, /* 137 */
|
||||
BCODE_PUSH_TWO = 0x8A, /* 138 */
|
||||
BCODE_PUSH_PROCESS = 0x86, /* 134 */
|
||||
BCODE_PUSH_NEGONE = 0x87, /* 135 */
|
||||
BCODE_PUSH_ZERO = 0x89, /* 137 */
|
||||
BCODE_PUSH_ONE = 0x8A, /* 138 */
|
||||
BCODE_PUSH_TWO = 0x8B, /* 139 */
|
||||
|
||||
BCODE_PUSH_INTLIT = 0xB1, /* 177 */
|
||||
BCODE_PUSH_NEGINTLIT = 0xB2, /* 178 */
|
||||
|
Loading…
Reference in New Issue
Block a user