On 25.01.2024 15:40, Rick McGuire wrote:
Um, .DateTime~new does this. This is how the time stamp used by the date/time functions is managed
such that there is consistencies across all terms used in expressions.
Was able to create them. In the first step I used a StringTable to serve as a TraceObject with the
intent to create a proper TraceObject class taking the StringTable as a role model (copying its
definitions and enhancing the new class eventually with the makeString method).
The "mtPrefix" attribute (meant as a class attribute) got renamed to "option" which is a more
neutral and a more intuitive name I hope.
While thinking about all kind of scenarios for analyzing the trace ex post, there was one idea that
might prove helpful: allow the traceObjects to be collected such that one could collect (and then
analyze) specific trace runs/probes. For this to make it as simple as possible for the Rexx
programmer the idea is to define a class attribute "collector" which is set to .nil. Whenever a Rexx
programmer sets it to an object that understands the "append(object)" message (e.g. any
orderedCollection could be therefore used) any created traceObject will get appended to it. The Rexx
programmer can set "collector" to .nil (no appending will take place from then on) or change the
"collector" to a different collector object. [This is meant for testing at the moment. The collected
traceObjects should make analyzing ex post even much easier, having a timestamp in each traceObject
will allow to sort into the trace sequence at any time later, but also for creating profile data,
even if they may be coarse, they would help improve the analysis of trace data as one can deduct the
beginning dateTime of a routine from the ending dateTime of that routine etc.]
Not having really worked with the interpreter itself, this is more than a huge challenge for me,
very time consuming (although interesting, but I really have been long out of time). My C++ is more
than rusty, having not coded in it really for decades (any free time mostly allotted to ooRexx and
Java/BSF4ooRexx).
In the current attempt I ran into a linking problem with the fields meant to serve as class
attributes for TraceObject that at the moment I do not know how to solve.
So I would like to ask another question in this context: after having created almost a copy of
StringTable named TraceObject, I am experimenting with adding the class attributes "option" and
"collector" to the new class. Here the current TraceObjectClass.hpp:
#ifndef Included_TraceObjectClass
#define Included_TraceObjectClass
#include "HashCollection.hpp"
/**
* Exported table class where indexing is done using string
* objects only.
*
*/
class TraceObject : public StringHashCollection
{
public:
void *operator new(size_t);
inline void operator delete(void *) { ; }
inline TraceObject(RESTORETYPE restoreType) { ; }
TraceObject(size_t capacity = HashCollection::DefaultTableSize)
: StringHashCollection(capacity) { }
TraceObject(bool fromRexx) { }
RexxObject *newRexx(RexxObject **args, size_t argc);
void live(size_t) override;
void liveGeneral(MarkReason reason) override;
void flatten(Envelope *) override;
static void createInstance();
static RexxClass *classInstance;
RexxObject *getCollector();
void setCollector(RexxObject *);
void setCollectorRexx(RexxObject *);
RexxString *getOption();
void setOption(RexxString *);
void setOptionRexx(RexxString *);
protected:
static RexxObject *collector; // any object that understands the
APPEND(obj) message
static RexxString *option; // default to 'N'ormal, else 'S'tandard,
'F'ull makeString
};
inline TraceObject *new_trace_object(size_t capacity =
HashCollection::DefaultTableSize) { return new TraceObject(capacity); }
#endif
Here the attempt to define the class in Setup.cpp (trying to add the getter and setter methods for
"collector" and "option" at the class level):
/***************************************************************************/
/* TRACEOBJECT
*/
/***************************************************************************/
StartClassDefinition(TraceObject);
AddClassMethod("New", TraceObject::newRexx, A_COUNT);
AddClassMethod("Collector", TraceObject::getCollector, 0);
AddClassMethod("Collector=", TraceObject::setCollectorRexx, 1);
AddClassMethod("Option", TraceObject::getOption, 0);
AddClassMethod("Option=", TraceObject::setOptionRexx, 1);
CompleteClassMethodDefinitions();
// most of the hash collection methods can be inherited
InheritInstanceMethods(IdentityTable);
AddMethod("Unknown", StringHashCollection::unknownRexx, 2);
AddMethod("Entry", StringHashCollection::entryRexx, 1);
AddMethod("HasEntry", StringHashCollection::hasEntryRexx, 1);
AddMethod("SetEntry", StringHashCollection::setEntryRexx, 2);
AddMethod("RemoveEntry", StringHashCollection::removeEntryRexx, 1);
CompleteMethodDefinitions();
CompleteClassDefinition(TraceObject);
EndClassDefinition(TraceObject);
After many hours of trial and errors and researching the different files where appropriate changes
need to be defined, I added what I thought were the needed definitions for this new class (looking
how other classes get defined, but I found no class that would use attributes at the class level).
In the end compiling succeeds (TraceObject is not yet fully implemented and some code needs to be
improved). However I get the following error in the link step for rexx.dll:
[ 7%] Linking CXX shared library bin\rexx.dll
LINK Pass 1: command "E:\PROGRA~2\MICROS~3.0\VC\bin\amd64\link.exe /nologo
@CMakeFiles\rexx.dir\objects1 /out:bin\rexx.dll /implib:lib\rexx.lib
/pdb:D:\orx.work202312\work
\debug64.trunk\bin\rexx.pdb /dll /version:0.0 /machine:x64 /debug
/INCREMENTAL
/DEF:D:\orx.work202312\main_trunk\interpreter\platform\windows\rexx.def
comctl32.lib shlwapi
.lib version.lib lib\rexxapi.lib wsock32.lib kernel32.lib user32.lib
gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib
advapi32.lib /MANIFEST
/MANIFESTFILE:CMakeFiles\rexx.dir/intermediate.manifest
CMakeFiles\rexx.dir/manifest.res" failed (exit code 1120) with the following
output:
Creating library lib\rexx.lib and object lib\rexx.exp
*TraceObjectClass.cpp.obj : error LNK2001: unresolved external symbol
"protected: static class
RexxObject * TraceObject::collector"
(?collector@TraceObject@@1PEAVRexxObject @@EA)
TraceObjectClass.cpp.obj : error LNK2001: unresolved external symbol
"protected: static class
RexxString * TraceObject::option" (?option@TraceObject@@1PEAVRexxString@@EA)
bin\rexx.dll :
fatal error LNK1120: 2 unresolved externals*
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return
code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"E:\Programme\Microsoft Visual Studio
14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"E:\Programme\Microsoft Visual Studio
14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
So the fields meant to serve as the class attributes "option" and "collector"
cannot be resolved.
Here the currently modified files:
D:\orx.work202312\main_trunk\interpreter>svn stat
M RexxClasses/CoreClasses.orx
M behaviour/ClassTypeCodes.h
M behaviour/PrimitiveBehaviourNames.h
M behaviour/PrimitiveBehaviours.cpp
M behaviour/PrimitiveClasses.xml
M behaviour/VirtualFunctionTable.cpp
? classes/TraceObjectClass.cpp
? classes/TraceObjectClass.hpp
M concurrency/Activity.cpp
M concurrency/Activity.hpp
M execution/CPPCode.cpp
M execution/RexxActivation.cpp
M execution/RexxActivation.hpp
M execution/VariableDictionary.cpp
M execution/VariableDictionary.hpp
M memory/GlobalNames.h
M memory/RexxMemory.cpp
M memory/Setup.cpp
M platform/unix/SysInterpreterInstance.cpp
M platform/unix/SysInterpreterInstance.hpp
M platform/windows/SysInterpreterInstance.cpp
M platform/windows/SysInterpreterInstance.hpp
M runtime/InterpreterInstance.cpp
M runtime/InterpreterInstance.hpp
M runtime/RexxCore.h
How could I possibly fix this?
---rony
P.S.: I can supply all the changes (or for specific files) as a "svn diff" of course, if that would
help better.
On Thu, Jan 25, 2024 at 8:52 AM Rony G. Flatscher <rony.flatsc...@wu.ac.at>
wrote:
Experimenting with tracing and one idea that came up with was to also supply
Activation::getTime()
which is an internal interpreter/classes/support/RexxDateTime object and as
such cannot be used
directly as an argument to put().
The attempt is to create a TIMESTAMP entry in a StringTable making the
Activation::getTime()
information available as a .DateTime object to the Rexx programmer.
How would one become able to achieve that?
---rony
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel