56 #define _CDECL __cdecl
70 char *programName = NULL;
73 programName = argv[1];
76 if ( programName == NULL || *programName ==
'\0' )
78 printf(
"You must pass in the name of a Rexx program on the command line.\n");
79 printf(
" For example: %s crash.rex.\n", argv[0]);
92 printf(
"Failed to create interpreter, aborting.\n");
101 if ( strcmp(
"backward.fnc", programName) == 0 )
103 RexxStringObject str = threadContext->String(
"These words will be swapped");
104 args = threadContext->ArrayOfOne(str);
108 printf(
"Using interpreter to execute %s\n\n", programName);
109 RexxObjectPtr result = threadContext->CallProgram(programName, args);
116 if (threadContext->CheckCondition())
125 printf(
"\nProgram result=%s\n\n", threadContext->ObjectToStringValue(result));
129 interpreter->Terminate();
148 printf(
"Created interpreter instance version=%ld.%ld.%ld language level=%ld.%02ld\n\n",
149 long((ver & 0xff0000) >> 16),
long((ver & 0x00ff00) >> 8),
long(ver & 0x0000ff),
long((lang & 0xff00) >> 8),
long(lang & 0x00ff));
159 return (condition->
code - (condition->
rc * 1000));
186 size_t count = c->ArrayItems(a);
187 for (
size_t i = 1; i <= count; i++ )
192 printf(
"%s\n", c->ObjectToStringValue(o));
197 printf(
"Error %ld running %s line %zd: %s\n",
long(condition->
rc), c->CString(condition->
program),
215 if ( c->CheckCondition() )
222 c->DecodeConditionInfo(condObj, &condition);
RexxReturnCode RexxEntry RexxCreateInterpreter(RexxInstance **instance, RexxThreadContext **context, RexxOption *options)
struct _RexxStringObject * RexxStringObject
struct _RexxArrayObject * RexxArrayObject
struct _RexxObjectPtr * RexxObjectPtr
struct _RexxDirectoryObject * RexxDirectoryObject
wholenumber_t conditionSubCode(RexxCondition *condition)
bool checkForCondition(RexxThreadContext *c, bool clear)
void standardConditionMsg(RexxThreadContext *c, RexxDirectoryObject condObj, RexxCondition *condition)
void printInterpreterVersion(RexxInstance *)
int _CDECL main(int argc, char **argv)
RexxStringObject errortext