added LargePointer handling in moo_fmt_object_()

This commit is contained in:
hyunghwan.chung 2019-09-10 15:20:21 +00:00
parent da1f8cb67b
commit c3c5365fcf
2 changed files with 25 additions and 5 deletions

View File

@ -130,7 +130,7 @@ class System(Apex)
method(#class) __os_sig_handler: caller method(#class) __os_sig_handler: caller
{ {
| os_intr_sem tmp | | os_intr_sem tmp sh |
os_intr_sem := Semaphore new. os_intr_sem := Semaphore new.
os_intr_sem signalOnInput: System _getSigfd. os_intr_sem signalOnInput: System _getSigfd.
@ -144,9 +144,23 @@ class System(Apex)
//TODO: Execute Handler for tmp. //TODO: Execute Handler for tmp.
System logNl: 'Interrupt dectected - signal no - ' & tmp asString. System logNl: 'Interrupt dectected - signal no - ' & tmp asString.
if (tmp == 16rFF or tmp == 2) { /* TODO: terminate all processes except gcfin process??? */ goto done }.
}.
// user-defined signal handler is not allowed for 16rFF
if (tmp == 16rFF) { goto done }.
/*
sh := self.sighandler at: tmp.
if (sh isNil)
{*/
// the default action for sigint(2) is to terminate all processes.
if (tmp == 2) { goto done }.
/*}
else
{
// invoke a user-defined signal handler if available.
sh value: tmp.
}*/
}.
os_intr_sem wait. os_intr_sem wait.
}. }.
done: done:
@ -154,12 +168,12 @@ class System(Apex)
] ]
ensure: [ ensure: [
| pid proc | | pid proc |
// stop subscribing to signals.
os_intr_sem signal. os_intr_sem signal.
os_intr_sem unsignal. os_intr_sem unsignal.
System logNl: '>>>>Requesting to terminate the caller process ' & (caller id) asString.
// the caller must request to terminate all its child processes.. // the caller must request to terminate all its child processes..
// TODO: to avoid this, this process must enumerate all proceses and terminate them except this and gcfin process
// this disables autonomous process switching only. // this disables autonomous process switching only.
// TODO: check if the ensure block code can trigger process switching? // TODO: check if the ensure block code can trigger process switching?
@ -182,6 +196,7 @@ class System(Apex)
proc := System _findProcessByIdGreaterThan: pid. proc := System _findProcessByIdGreaterThan: pid.
}. }.
System logNl: 'Requesting to terminate the caller process of id ' & (caller id) asString.
caller terminate. // terminate the startup process. caller terminate. // terminate the startup process.
self _enableProcessSwitching. self _enableProcessSwitching.

View File

@ -1429,6 +1429,11 @@ int moo_fmt_object_ (moo_fmtout_t* fmtout, moo_oop_t oop)
if (!moo_numtostr(moo, oop, 10 | MOO_NUMTOSTR_NONEWOBJ)) return -1; if (!moo_numtostr(moo, oop, 10 | MOO_NUMTOSTR_NONEWOBJ)) return -1;
if (moo_bfmt_out(fmtout, "%.*js", moo->inttostr.xbuf.len, moo->inttostr.xbuf.ptr) <= -1) return -1; if (moo_bfmt_out(fmtout, "%.*js", moo->inttostr.xbuf.len, moo->inttostr.xbuf.ptr) <= -1) return -1;
} }
else if (c == moo->_large_pointer)
{
if (moo_ptrtooow(moo, oop, &i) <= -1) return -1;
if (moo_bfmt_out(fmtout, "#\\p%zX", i) <= -1) return -1;
}
else if (MOO_OBJ_GET_FLAGS_TYPE(oop) == MOO_OBJ_TYPE_CHAR) else if (MOO_OBJ_GET_FLAGS_TYPE(oop) == MOO_OBJ_TYPE_CHAR)
{ {
moo_ooch_t ch; moo_ooch_t ch;