fixed an error in moo_seterrbfmt() and moo_seterrufmt()

This commit is contained in:
hyunghwan.chung
2017-05-16 02:04:18 +00:00
parent 5e7771b799
commit a639fe9f93
9 changed files with 379 additions and 189 deletions

View File

@ -90,12 +90,13 @@ extend Apex
## -------------------------------------------------------
## -------------------------------------------------------
##method(#primitive,#lenient) _shallowCopy.
##method(#dual,#primitive,#lenient) _shallowCopy.
##method(#dual,#primitive) shallowCopy.
method(#dual) shallowCopy
{
<primitive: #_shallow_copy>
self primitiveFailed.
self primitiveFailed(thisContext method).
}

View File

@ -112,6 +112,12 @@ class(#character) String(Array)
{
}
*)
(* The strlen method returns the number of characters before a terminating null.
* if no terminating null character exists, it returns the same value as the size method *)
method(#primitive,#lenient) _strlen.
method(#primitive) strlen.
}
## -------------------------------------------------------------------------------

View File

@ -431,12 +431,34 @@ class ProhibitedMessageException(Exception)
{
}
(*
pooldic ErrorToException
{
ErrorCode.EINVAL := InvalidArgumentException.
ErrorCode.ENOIMPL := NotImplementedException.
}
*)
extend Apex
{
method(#dual,#liberal) primitiveFailed(method)
{
| a b msg ec ex |
(* since method is an argument, the caller can call this method
* from a context chain where the method context actually doesn't exist.
* when a primitive method is defined using the #primitive method,
* the VM invokes this primtiveFailed method without creating
* the context for the primitive method.
* method(#primitive) xxx.
* method(#primitive) xxx { <primitive: #_xxx> ^self primitiveFailed(thisContext method). }
* in the former definition, primitiveFailed is called without
* an activate context for the method xxx if the primitive fails.
* on the other handle, in the latter definition, the context
* for the method is activated first before primitiveFailed is
* invoked. in the context chain, the method for xxx is found.
*)
(*System logNl: 'Arguments: '.
a := 0.
b := thisContext vargCount.
@ -445,11 +467,13 @@ extend Apex
System logNl: (thisContext vargAt: a) asString.
a := a + 1.
}.*)
ec := thisProcess primError.
msg := ec asString.
msg := thisProcess primErrorMessage.
if (msg isNil) { msg := ec asString }.
if (method notNil) { msg := msg & ' - ' & (method owner name) & '>>' & (method name) }.
(PrimitiveFailureException withErrorCode: ec) signal: msg.
(PrimitiveFailureException (* in: method *) withErrorCode: ec) signal: msg.
}
method(#dual) doesNotUnderstand: message_name

View File

@ -1,7 +1,7 @@
class(#pointer,#final,#limited) Process(Object)
{
var initial_context, current_context, state, sp, prev, next, sem, perr.
var initial_context, current_context, state, sp, prev, next, sem, perr, perrmsg.
method prev { ^self.prev }
method next { ^self.next }
@ -10,30 +10,16 @@ class(#pointer,#final,#limited) Process(Object)
method prev: process { self.prev := process }
method primError { ^self.perr }
method primErrorMessage { ^self.perrmsg }
method resume
{
<primitive: #_process_resume>
self primitiveFailed
##^Processor resume: self.
}
method _terminate
{
<primitive: #_process_terminate>
self primitiveFailed
}
method _suspend
{
<primitive: #_process_suspend>
self primitiveFailed
}
method(#primitive) resume.
method(#primitive) yield.
method(#primitive) _terminate.
method(#primitive) _suspend.
method terminate
{
##search from the top contextof the process down to intial_contextand find ensure blocks and execute them.
##search from the top contextof the process down to intial_context and find ensure blocks and execute them.
## if a different process calls 'terminate' on a process,
## the ensureblock is not executed in the context of the
## process being terminated, but in the context of terminatig process.
@ -62,12 +48,6 @@ class(#pointer,#final,#limited) Process(Object)
^self _terminate
}
method yield
{
<primitive: #_process_yield>
self primitiveFailed
}
method sp
{
^self.sp.