On 08.10.2025 13:27, Rick McGuire wrote:
When a new activation of Rexx code is created, that activation copies the settings from the
package at initialization to have its own local copy that can then be modified. So changing the
settings at the package level will only affect new code activations.
Yes, that would be fine (it would need to be explicitly documented).
However, it seems that the trace settings change in Package.cpp changes the local copy and not the
(default) traceSettings at Package object creation time. Maybe something is wrong in my code, here
the relevant excerpt from the testwise implementation of changing digits and trace in Package.cpp:
... cut ... getting the traceSettings:
TraceSetting ts=packageSettings.traceSettings;
... cut ... changing default digits:
case digits:
{
wholenumber_t newDigits = numberArgument(strNewValue,2);
if (newDigits<1)
{
reportException(Error_Incorrect_method_positive,
new_integer(2), strNewValue);
}
packageSettings.setDigits(newDigits);
}
break;
... cut ... changing default trace option:
case trace:
{
char c = Utilities::toUpper(strNewValue->getChar(0));
c = optionArgument(strNewValue, "NARICEFLO", 2);
switch (c)
{
case 'N':
ts.setTraceNormal();
break;
case 'A':
ts.setTraceAll();
break;
case 'R':
ts.setTraceResults();
break;
case 'I':
ts.setTraceIntermediates();
break;
case 'C':
ts.setTraceCommands();
break;
case 'E':
ts.setTraceErrors();
break;
case 'F':
ts.setTraceFailures();
break;
case 'L':
ts.setTraceLabels();
break;
case 'O':
ts.setTraceOff();
break;
}
fprintf(stderr, "... PackageClass.cpp #%d: trace '%c', toString()=[%s]\n",
__LINE__, c, ts.toString()->getStringData());fflush(stderr);
}
break;
The changes in packageSettings prevail, the ones in traceSettings are lost upon return from the
'options' method. Maybe I am looking at the wrong spot to change the default trace option of the
package?
---rony
On Wed, Oct 8, 2025 at 7:20 AM Rony G. Flatscher <[email protected]>
wrote:
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
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel
--
--
__________________________________________________________________________________
Prof. Dr. Rony G. Flatscher, iR
Department Wirtschaftsinformatik und Operations Management
WU Wien
Welthandelsplatz 1
A-1020 Wien/Vienna, Austria/Europe
http://www.wu.ac.at
__________________________________________________________________________________
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel