75 #include "SystemInterpreter.hpp"
87 bool firstDispatch =
true;
97 size_t activityLevel = 0;
105 this->
runsem.
wait(
"RexxActivity::runThread", 0);
117 firstDispatch =
false;
217 void *RexxActivity::operator
new(
size_t size)
235 : runsem(
"RexxActivity::runsem"), guardsem(
"RexxActivity::guardsem")
330 for (
int i = 0; i < 13; i++)
468 bool handled =
false;
476 handled = activation->trap(condition, conditionObj);
509 conditionObj->
put(condition, OREF_CONDITION);
511 conditionObj->
put(description ==
OREF_NULL ? OREF_NULLSTRING : description, OREF_DESCRIPTION);
516 conditionObj->
put(rc, OREF_RC);
520 conditionObj->
put(additional, OREF_ADDITIONAL);
524 conditionObj->
put(result, OREF_RESULT);
623 RexxArray *substitutions =
new_array(substitution1, substitution2, substitution3, substitution4);
639 RexxArray *substitutions =
new_array(substitution1, substitution2, substitution3, substitution4, substitution5);
646 const char *substitution1,
648 const char *substitution3,
658 RexxArray *substitutions =
new_array(ssubstitution1, substitution2, ssubstitution3, substitution4);
1058 if (topFrame == activation)
1130 snprintf(
work,
sizeof work,
"%ld.%1ld",
long(errcode/1000),
long(errcode - primary));
1132 exobj->
put(code, OREF_CODE);
1136 exobj->
put(rc, OREF_RC);
1144 exobj->
put(errortext, OREF_ERRORTEXT);
1153 exobj->
put(additional, OREF_ADDITIONAL);
1155 if (primary != errcode)
1160 exobj->
put(message, OREF_NAME_MESSAGE);
1173 exobj->
put(OREF_NULLSTRING, OREF_DESCRIPTION);
1177 exobj->
put(description, OREF_DESCRIPTION);
1182 exobj->
put(result, OREF_RESULT);
1189 exobj->
put(OREF_SYNTAX, OREF_CONDITION);
1207 exobj->
put(stackFrames, OREF_STACKFRAMES);
1211 exobj->
put(traceback, OREF_TRACEBACK);
1218 while (frame != NULL)
1224 firstFrame = stackFrame;
1227 stackFrames->
append(stackFrame);
1229 frame = frame->
next;
1238 exobj->
put(lineNumber, OREF_POSITION);
1252 exobj->
put(OREF_NULLSTRING, OREF_PROGRAM);
1274 while (frame != NULL)
1284 stackFrames->
append(stackFrame);
1286 frame = frame->
next;
1323 size_t substitutions = additional->
size();
1327 for (
size_t i = 1; i <= substitutions; i++)
1330 size_t subposition = message->
pos(OREF_AND, 0);
1331 if (subposition == 0)
1345 if (selector < '0' || selector >
'9')
1354 if ((
size_t)selector <= substitutions)
1388 newmessage = newmessage->
concat(front_stringVal);
1389 p_newmessage = newmessage;
1393 newmessage = newmessage->
concat(message);
1416 exobj->
remove(OREF_POSITION);
1417 exobj->
remove(OREF_PROGRAM);
1418 exobj->
remove(OREF_PACKAGE);
1426 if (errornumber != primary)
1431 snprintf(
work,
sizeof work,
"%1ld%3.3ld",
long(errornumber/1000),
long(errornumber - primary));
1432 errornumber = atol(
work);
1440 exobj->
put(message, OREF_NAME_MESSAGE);
1461 activation->
trap(condition, conditionObj);
1476 this->
kill(conditionObj);
1494 size_t tracebackSize = trace_back->
size();
1496 for (
size_t i = 1; i <= tracebackSize; i++)
1531 if (programname !=
OREF_NULL && programname != OREF_NULLSTRING)
1549 text = text->
concatWith(positionString,
' ');
1566 rc = exobj->
at(OREF_CODE);
1588 text = text->
concat(secondary);
1623 secondary = (
RexxString *)exobj->
at(OREF_NAME_MESSAGE);
1635 text = text->
concat(secondary);
1883 while (poppedStackFrame != target)
2109 if (owningActivity == targetActivity)
2194 if (activation != NULL)
2196 activation->
yield();
2215 if (activation != NULL)
2218 return activation->
halt(d);
2238 if (activation != NULL)
2304 printf(
"RexxActivity::checkStackSpace : SP=%16.16x stackBase=%16.16x delta=%i MIN_C_STACK=%i %i %i\n",
2307 ((
char *)&temp - (
char *)this->stackBase),
2309 ((
char *)&temp - (
char *)this->stackBase) <
MIN_C_STACK,
2381 const char *exitName,
int function,
2382 int subfunction,
void *exitbuffer)
2386 int rc = handler.
call(
this, activation,
function, subfunction, exitbuffer);
2391 if (
function ==
RXSIO)
2572 exit_parm.
rxfnc_argc = (
unsigned short)argcount;
2587 for (
size_t argindex=0; argindex < exit_parm.
rxfnc_argc; argindex++)
2601 argrxarray[argindex].strlength = 0;
2602 argrxarray[argindex].strptr = (
const char *)NULL;
2660 size_t named_argcount)
2670 if (manager->
checkFunctionCall(rname, argcount, named_argcount, arguments, funcresult))
2792 if (manager->
checkCommand(
this, address, command, result, condition))
3035 bool currentsetting)
3170 p_line =
line->stringTrace();
3185 concurrencyInfos.
lock);
3186 p_line = ((
RexxString*)p_line)->concatToCstring(buffer);
3253 value = OREF_NULLSTRING;
3258 value = OREF_NULLSTRING;
3286 value = this->
lineIn(activation);
3302 length =
line->getLength();
3303 data =
line->getStringData();
3304 printf(
"%.*s\n",(
int)length, data);
3328 value = OREF_NULLSTRING;
3333 value = OREF_NULLSTRING;
3412 newNActa->
run(target);
3464 new_activation->
run(target);
3484 new_activation->
run(target);
void reportException(wholenumber_t error)
RexxArray * new_array(size_t s)
RexxDirectory * new_directory()
RexxInteger * new_integer(wholenumber_t v)
uint64_t RANDOMIZE(uint64_t seed)
const size_t ACT_STACK_SIZE
wholenumber_t requestAccessCount
RexxString * REQUEST_STRING(RexxObject *object)
#define Message_Translations_debug_error
#define Error_Function_no_data_function
#define Error_System_resources
#define Error_Interpretation
#define Message_Translations_running
#define Error_Control_stack_full
#define Error_Execution_invalid_thread
#define Message_Translations_error
#define Error_System_service_service
#define Message_Translations_line
#define Error_Execution_error_condition
#define Error_Incorrect_call_external
#define Error_Routine_not_found_name
#define Error_Execution_deadlock
RexxInternalStack * new_internalstack(size_t s)
#define memory_mark(oref)
RexxObject * new_object(size_t s)
#define memory_mark_general(oref)
RexxString * new_string(const char *s, stringsize_t l)
ssize_t integer(RexxObject *obj, const char *errorMessage)
#define CONCURRENCY_TRACE
#define CONCURRENCY_BUFFER_SIZE
virtual RexxMethod * method()=0
virtual StackFrameClass * createStackFrame()=0
virtual RexxString * messageName()=0
virtual RexxSource * getSource()=0
virtual void handleError(wholenumber_t, RexxDirectory *)
RexxDirectory * conditionData
static RexxNativeActivation * newNativeActivation(RexxActivity *activity, RexxActivation *parent)
static void relinquish(RexxActivity *activity)
static bool lockKernelImmediate()
static void unlockKernel()
static void activityEnded(RexxActivity *)
static void addWaitingActivity(RexxActivity *a, bool release)
static RexxActivity *volatile currentActivity
int call(RexxActivity *activity, RexxActivation *activation, int major, int minor, void *parms)
static wholenumber_t messageNumber(RexxString *)
static RexxString * getCurrentQueue()
bool poolActivity(RexxActivity *activity)
RexxObject * getLocalEnvironment(RexxString *)
RexxInstance * getInstanceContext()
ExitHandler & getExitHandler(int exitNum)
SecurityManager * getSecurityManager()
RexxDirectory * getLocal()
RexxActivity * spawnActivity(RexxActivity *parent)
RexxString * resolveProgramName(RexxString *name, RexxString *dir, RexxString *ext)
CommandHandler * resolveCommandHandler(RexxString *name)
static NumericSettings * setDefaultSettings()
static NumericSettings * getDefaultSettings()
static wholenumber_t maxVal(wholenumber_t n1, wholenumber_t n2)
static void setCurrentSettings(NumericSettings *s)
RexxObject * protectedObject
virtual NumericSettings * getNumericSettings()
virtual bool trap(RexxString *, RexxDirectory *)
virtual RexxObject * dispatch()
virtual void termination()
virtual bool isStackBase()
virtual SecurityManager * getSecurityManager()=0
virtual RexxActivation * findRexxContext()
void setPreviousStackFrame(RexxActivationBase *p)
RexxSource * getSourceObject()
SecurityManager * getEffectiveSecurityManager()
void liveGeneral(int reason)
size_t getActivationLevel()
bool callTraceTestExit(RexxActivation *, bool)
RexxActivity * nestedActivity
CommandHandler * resolveCommandHandler(RexxString *)
void queue(RexxActivation *, RexxString *, int)
void pushStackFrame(RexxActivationBase *new_activation)
void setupAttachedActivity(InterpreterInstance *interpreter)
static void initializeThreadContext()
void restoreActivationLevel(size_t l)
bool callScriptingExit(RexxActivation *, RexxString *, RexxObject *, ProtectedObject &, RexxObject **, size_t)
RexxDirectory * getThreadLocal()
void reportAnException(wholenumber_t, const char *)
RexxNativeActivation * getApiContext()
static MethodContextInterface methodContextFunctions
void callTerminationExit(RexxActivation *)
RexxActivation * currentRexxFrame
void kill(RexxDirectory *)
static wholenumber_t requestAccessCounter()
thread_id_t threadIdMethod()
void enterCurrentThread()
bool callHaltTestExit(RexxActivation *)
bool callQueueNameExit(RexxActivation *, RexxString *&)
RexxActivationStack frameStack
void generateProgramInformation(RexxDirectory *exObj)
ExitHandler sysexits[LAST_EXIT]
SecurityManager * getEffectiveSecurityManager()
RexxObject * displayDebug(RexxDirectory *)
RexxString * pullInput(RexxActivation *)
bool callObjectFunctionExit(RexxActivation *, RexxString *, RexxObject *, ProtectedObject &, RexxObject **, size_t, size_t)
void inheritSettings(RexxActivity *parent)
bool callNovalueExit(RexxActivation *, RexxString *, RexxObject *&)
void traceOutput(RexxActivation *, RexxString *)
void callInitializationExit(RexxActivation *)
static ExitContextInterface exitContextFunctions
RexxObject * getLocalEnvironment(RexxString *name)
void createMethodContext(MethodContext &context, RexxNativeActivation *owner)
bool callFunctionExit(RexxActivation *, RexxString *, RexxObject *, ProtectedObject &, RexxObject **, size_t)
RexxString * messageSubstitution(RexxString *, RexxArray *)
void raiseException(wholenumber_t, RexxString *, RexxArray *, RexxObject *)
void terminatePoolActivity()
RexxString * getLastMessageName()
size_t activationStackSize
RexxInternalStack * activations
ActivationFrame * activationFrames
RexxActivationBase * topStackFrame
void disableExit(int exitNum)
void popStackFrame(bool reply)
SysActivity currentThread
void cleanupActivityResources()
RexxActivity * spawnReply()
void liveGeneral(int reason)
RexxDirectory * threadLocalEnvironment
bool callTraceExit(RexxActivation *, RexxString *)
void unwindToDepth(size_t depth)
InterpreterInstance * instance
RexxString * buildMessage(wholenumber_t, RexxArray *)
NumericSettings * numericSettings
void addToInstance(InterpreterInstance *interpreter)
void reraiseException(RexxDirectory *)
bool isExitEnabled(int exitNum)
wholenumber_t displayCondition(RexxDirectory *conditionObject)
RexxString * lineIn(RexxActivation *)
void updateFrameMarkers()
void unwindToFrame(RexxActivation *frame)
RexxDirectory * conditionobj
void createNewActivationStack()
bool callPullExit(RexxActivation *, RexxString *&)
void createCallContext(CallContext &context, RexxNativeActivation *owner)
void resetRunningRequires()
void createExitContext(ExitContext &context, RexxNativeActivation *owner)
SecurityManager * getInstanceSecurityManager()
wholenumber_t errorNumber(RexxDirectory *conditionObject)
RexxMessage * dispatchMessage
void checkActivationStack()
void clearCurrentCondition()
void raisePropagate(RexxDirectory *)
bool callPushExit(RexxActivation *, RexxString *, int)
RexxDirectory * createConditionObject(RexxString *, RexxObject *, RexxString *, RexxObject *, RexxObject *)
RexxMethod * getLastMethod()
static CallContextInterface callContextFunctions
bool callHaltClearExit(RexxActivation *)
static RexxThreadInterface threadContextFunctions
RexxTable * requiresTable
bool callExit(RexxActivation *activation, const char *exitName, int function, int subfunction, void *exitbuffer)
RexxString * resolveProgramName(RexxString *, RexxString *, RexxString *)
void generateRandomNumberSeed()
RexxActivationBase * getTopStackFrame()
void sayOutput(RexxActivation *, RexxString *)
bool callQueueSizeExit(RexxActivation *, RexxInteger *&)
bool callCommandExit(RexxActivation *, RexxString *, RexxString *, ProtectedObject &result, ProtectedObject &condition)
RexxDirectory * getLocal()
ActivityContext threadContext
RexxArray * generateStackFrames(bool skipFirst)
bool callValueExit(RexxActivation *, RexxString *, RexxString *, RexxObject *, RexxObject *&)
RexxObject * display(RexxDirectory *)
void flatten(RexxEnvelope *)
void checkDeadLock(RexxActivity *)
RexxDirectory * createExceptionObject(wholenumber_t, RexxString *, RexxArray *, RexxObject *)
void setSuspended(bool s)
RexxObject * waitingObject
ProtectedObject * protectedObjects
ExitHandler & getExitHandler(int exitNum)
bool callSayExit(RexxActivation *, RexxString *)
RexxObject * lineOut(RexxString *)
void cleanupStackFrame(RexxActivationBase *poppedStackFrame)
bool callTerminalInputExit(RexxActivation *, RexxString *&)
void waitReserve(RexxObject *)
bool raiseCondition(RexxString *, RexxObject *, RexxString *, RexxObject *, RexxObject *)
bool callDebugInputExit(RexxActivation *, RexxString *&)
RexxActivation * getCurrentRexxFrame()
RexxString * traceInput(RexxActivation *)
size_t append(RexxObject *)
RexxObject * get(size_t pos)
RexxObject * at(RexxString *)
RexxObject * put(RexxObject *, RexxString *)
RexxObject * remove(RexxString *)
void setHasNoReferences()
RexxObject * peek(size_t v)
void push(RexxObject *value)
RexxObject * append(RexxObject *)
void verboseMessage(const char *message)
void run(RexxMethod *_method, RexxNativeMethod *_code, RexxObject *_receiver, RexxString *_msgname, RexxObject **_arglist, size_t _argcount, size_t _named_argcount, ProtectedObject &resultObj)
void setConditionInfo(RexxDirectory *info)
void enableVariablepool()
RexxString * stringValue()
void sendMessage(RexxString *, RexxArray *, RexxDirectory *, ProtectedObject &)
virtual bool numberValue(wholenumber_t &result, size_t precision)
virtual RexxString * defaultName()
RexxString * getProgramName()
PackageClass * getPackage()
void toRxstring(CONSTRXSTRING &r)
size_t pos(RexxString *, size_t)
const char * getStringData()
RexxString * extract(size_t offset, size_t sublength)
RexxString * concatWithCstring(const char *)
bool isEqual(RexxObject *)
RexxString * concat(RexxString *)
RexxString * concatWith(RexxString *, char)
bool checkFunctionCall(RexxString *functionName, size_t count, size_t named_count, RexxObject **arguments, ProtectedObject &result)
bool checkCommand(RexxActivity *, RexxString *address, RexxString *command, ProtectedObject &result, ProtectedObject &condition)
RexxString * getTraceLine()
thread_id_t getThreadID()
void create(RexxActivity *activity, size_t stackSize)
char * getStackBase(int32_t *base, size_t stackSize)
void wait(const char *ds, int di)
void setSemVariable(const char *variable)
static void getCurrentTime(RexxDateTime *Date)
static void * allocateResultMemory(size_t)
static RexxString * getMessageText(wholenumber_t code)
static RexxString * getMessageHeader(wholenumber_t code)
static void releaseResultMemory(void *)
static void GetConcurrencyInfos(struct ConcurrencyInfos &concurrencyInfos)
static bool traceConcurrency()
static int snprintf(char *buffer, size_t count, const char *format,...)
struct _RexxStringObject * RexxStringObject
CONSTANT_RXSTRING * PCONSTRXSTRING
struct _RexxObjectPtr * RexxObjectPtr
#define MAKERXSTRING(r, p, l)
#define RXEXIT_RAISE_ERROR
CONSTANT_STRING rxcmd_address
unsigned short rxcmd_dll_len
unsigned short rxcmd_addressl
CONSTANT_STRING rxcmd_dll
CONSTANT_RXSTRING rxcmd_command
CONSTANT_RXSTRING rxfnc_name
RexxObjectPtr * rxfnc_argv
PCONSTRXSTRING rxfnc_argv
unsigned short rxfnc_namel
CONSTANT_STRING rxfnc_que
unsigned short rxfnc_quel
unsigned short rxfnc_argc
CONSTANT_STRING rxfnc_name
CONSTANT_RXSTRING rxmsq_value
CONSTANT_RXSTRING rxfnc_name
RexxObjectPtr * rxfnc_argv
CONSTANT_RXSTRING rxsio_string
RexxStringObject variable_name
RexxStringObject selector
RexxStringObject variable_name
RexxActivity * owningActivity
RexxThreadContext threadContext
RexxNativeActivation * context
RexxCallContext threadContext
RexxVariableDictionary * variableDictionary
RexxActivation * activation
unsigned short reserveCount
RexxNativeActivation * context
RexxExitContext threadContext
RexxNativeActivation * context
RexxMethodContext threadContext
CallContextInterface * functions
RexxThreadContext * threadContext
RexxThreadContext * threadContext
ExitContextInterface * functions
MethodContextInterface * functions
RexxThreadContext * threadContext
RexxThreadInterface * functions
RexxStringObject RexxNullString
unsigned __int64 uint64_t