While implementing testwise the mentioned 'options' method in the Package.cpp class, changes to
digits, form, fuzz, conditions take effect for invoking routines and methods in the same package.
However, changing the trace option seem to be nullified upon return from the options~message that
changed the default trace opiton for the package, the change is therefore not reflected in a newly
invoked routine or method of that package.
Here the ooRexx test program:
call a_routine say "---" pkg=.context~package say "pkg~options('digits',
20):"
pkg~options('digits', 20) say "digits():" digits() "pkg~options('digits'):"
pkg~options('digits') say "pkg~options('trace', 'results'):"
pkg~options('trace', 'results') say
"trace():" trace() "pkg~options('trace'):" pkg~options('trace') say call a_routine say
"---"
.test~a_method ::routine a_routine say "#" .line":" .context~name
"(".context~executable")" say
"#" .line":" "digits():" digits() say "#" .line":" "trace() :" trace() say "#"
.line":"
"trace('O'):" trace('O') say "#" .line":" "trace() :" trace() a='say "trace()
:" trace()' say
"#" .line":" 'INTERPRET' a interpret a say "#" .line":" "trace() :" trace()
::class test
::method a_method class say "#" .line":" .context~name "(".context~executable")"
"scope:"
.context~executable~scope say "#" .line":" "digits():" digits() say "#" .line":"
"trace() :"
trace() say "#" .line":" "trace('O'):" trace('O') say "#" .line":" "trace()
:" trace() a='say
"trace() :" trace()' say "#" .line":" 'INTERPRET' a interpret a say "#" .line":"
"trace() :" trace()
Here the output (including a debug output from the options method as currently implemented in
Packages.cpp):
G:\test\orx\options>rexx test3
*# 14: A_ROUTINE (a Routine)*
*# 15: digits(): 9*
# 16: trace() : N
# 17: trace('O'): N
# 18: trace() : O
# 21: INTERPRET say "trace() :" trace()
trace() : O
# 23: trace() : O
---
... PackageClass.cpp #2384: arg1/strOptionName=[*digits*],
arg2/*strNewValue=[20]*
pkg~options('digits', 20): 9
digits(): 9 pkg~options('digits'): 20
... PackageClass.cpp #2355: isTraceOff()=0, toString()=[N]
... PackageClass.cpp #2384: arg1/strOptionName=[*trace*],
arg2/*strNewValue=[results]*
... PackageClass.cpp #2583: trace 'R', toString()=*[R]*
*pkg~options('trace', 'results'): N*
... PackageClass.cpp #2355: isTraceOff()=0, toString()=[N]
trace(): N pkg~options('trace'): N
*# 14: A_ROUTINE (a Routine)*
*# 15: digits(): 20*
# 16: trace() :*N*
# 17: trace('O'): N
# 18: trace() : O
# 21: INTERPRET say "trace() :" trace()
trace() : O
# 23: trace() : O
---
*# 27: A_METHOD (a Method) scope: The TEST class*
*# 28: digits(): 20*
# 29: trace() :*N*
# 30: trace('O'): N
# 31: trace() : O
# 34: INTERPRET say "trace() :" trace()
trace() : O
# 36: trace() : O
As can be seen from the output, the change of the default digits value at runtime is possible and if
invoking a routine or method defined in that package will get the changed digits value (from the
default digits value).
However, the same is not true for changing the traceSettings (attempt to change 'Normal' to
'Results'). It is as if the invocation of the new 'options' method in Package.cpp gets a temporary
packageSettings.traceSettings (defined in PackageSetting.hpp) which gets changed, not the
packageSettings.traceSettings as defined at Package object creation. RexxActivation.cpp will set the
settings in effect in the method
/**
* Inherit the settings from our package object.
*/
void RexxActivation::inheritPackageSettings()
{
// just copy the whole initial settings piece.
settings.packageSettings = packageObject->getSettings();
// if tracing intermediates, turn on the special fast check flag
settings.intermediateTrace =
settings.packageSettings.traceSettings.tracingIntermediates();
}
Here "settings" references ActivationSettings.hpp which has a member packageSettings which gets its
value from the Package object (getSettings()). At that point in time the packageSettings of the
Package object at creation time get returned, including the default traceSettings.
The question: is it possible from a method in Package.cpp to get at the default traceSettings (as
defined for the Package object at its creation time) at runtime, and if so, how? If not, what would
be possible approaches to allow changing the default traceSettings in a Package object?
TIA for any thoughts, tips, hints!
---rony
P.S.: One idea would be to add a "defaultPackageSettings" to the Package class and use that
explicitly in RexxActivation::inheritPackageSettings() instead, and change that in the Package
class. Would that be feasible, acceptable?
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel