Go to the source code of this file.
Macros | |
#define | _CDECL |
#define | RECURSIVE_ROUTINE1 |
#define | RECURSIVE_ROUTINE2 |
Functions | |
bool | checkForCondition (RexxThreadContext *c, bool clear) |
void | printInterpreterVersion (RexxInstance *) |
int _CDECL | main (int argc, char **argv) |
wholenumber_t | conditionSubCode (RexxCondition *condition) |
void | standardConditionMsg (RexxThreadContext *c, RexxDirectoryObject condObj, RexxCondition *condition) |
#define _CDECL |
A simple example that creates an instance of the interpreter and uses that instance to execute a Rexx routine defined in this program.
Both routines cause an infinite recursion. One version of the routine traps any error, the other does not. This shows how to handle conditions raised inside the interpreter execution, i.e., outside of your native code execution.
To have the second routine execute, specify any argument on the command line. For example:
stackOverflow 1
With no argument, the first routine is used:
starckOverflow
Definition at line 64 of file stackOverflow.cpp.
#define RECURSIVE_ROUTINE1 |
Definition at line 67 of file stackOverflow.cpp.
#define RECURSIVE_ROUTINE2 |
Definition at line 78 of file stackOverflow.cpp.
bool checkForCondition | ( | RexxThreadContext * | c, |
bool | clear | ||
) |
Given a thread context, checks for a raised condition, and prints out the standard condition message if there is a condition.
c | Thread context we are operating in. |
clear | Whether to clear the condition or not. |
Definition at line 222 of file stackOverflow.cpp.
References NULLOBJECT, and standardConditionMsg().
Referenced by main().
|
inline |
Given a condition object, extracts and returns as a whole number the subcode of the condition.
Definition at line 166 of file stackOverflow.cpp.
References RexxCondition::code, and RexxCondition::rc.
Referenced by standardConditionMsg().
int _CDECL main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 91 of file stackOverflow.cpp.
References checkForCondition(), printInterpreterVersion(), RECURSIVE_ROUTINE1, RECURSIVE_ROUTINE2, and RexxCreateInterpreter().
void printInterpreterVersion | ( | RexxInstance * | interpreter | ) |
Below are several helper functions that demonstrate how to use some of the different C++ native APIs. Given an interpreter instance, prints out the interpreter version and language version. The documentation in the ooRexx programming guide explains the byte encoding of the version numbers.
Definition at line 153 of file stackOverflow.cpp.
Referenced by main().
void standardConditionMsg | ( | RexxThreadContext * | c, |
RexxDirectoryObject | condObj, | ||
RexxCondition * | condition | ||
) |
Outputs the typical condition message. For example:
4 *-* say dt~number
Error 97 running C:\work\qTest.rex line 4: Object method not found Error 97.1: Object "a DateTime" does not understand message "NUMBER"
c | The thread context we are operating in. |
condObj | The condition information object. The object returned from the C++ API GetConditionInfo() |
condition | The RexxCondition struct. The filled in struct from the C++ API DecodeConditionInfo(). |
@assumes There is a condition and that condObj and condition are valid.
Definition at line 187 of file stackOverflow.cpp.
References conditionSubCode(), RexxCondition::errortext, RexxCondition::message, NULLOBJECT, RexxCondition::position, RexxCondition::program, and RexxCondition::rc.
Referenced by checkForCondition().