runRexxProgram.cpp File Reference
#include "oorexxapi.h"
#include <stdio.h>
#include <string.h>
Include dependency graph for runRexxProgram.cpp:

Go to the source code of this file.

Macros

#define _CDECL
 

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)
 

Macro Definition Documentation

◆ _CDECL

#define _CDECL

A simple example that creates an instance of the interpreter and uses that instance to execute a Rexx program. The program name must be passed in the command line. For example:

runRexxProgram HelloWorld.rex runRexxProgram backward.fnc runRexxProgram tooRecursiveTrapped.rex runRexxProgram tooRecursiveUnhandled.rex

backward.fnc demonstrates how to pass arguments into the called program.

Definition at line 58 of file runRexxProgram.cpp.

Function Documentation

◆ checkForCondition()

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.

Parameters
cThread context we are operating in.
clearWhether to clear the condition or not.
Returns
True if there was a condition, otherwise false.

Definition at line 213 of file runRexxProgram.cpp.

References NULLOBJECT, and standardConditionMsg().

Referenced by main().

◆ conditionSubCode()

wholenumber_t conditionSubCode ( RexxCondition condition)
inline

Given a condition object, extracts and returns as a whole number the subcode of the condition.

Definition at line 157 of file runRexxProgram.cpp.

References RexxCondition::code, and RexxCondition::rc.

Referenced by standardConditionMsg().

◆ main()

int _CDECL main ( int  argc,
char **  argv 
)

◆ printInterpreterVersion()

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 144 of file runRexxProgram.cpp.

Referenced by main().

◆ standardConditionMsg()

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"

Parameters
cThe thread context we are operating in.
condObjThe condition information object. The object returned from the C++ API GetConditionInfo()
conditionThe 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 178 of file runRexxProgram.cpp.

References conditionSubCode(), RexxCondition::errortext, RexxCondition::message, NULLOBJECT, RexxCondition::position, RexxCondition::program, and RexxCondition::rc.

Referenced by checkForCondition().