ooRexx  4.2.0-source
About: ooRexx (Open Object Rexx) is a free implementation of Object Rexx. Object Rexx is an enhancement of the classic Rexx interpreter; a full-featured programming language with a human-oriented syntax.
  Fossies Dox: ooRexx-4.2.0-source.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

RexxActivation.cpp
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
4 /* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */
5 /* */
6 /* This program and the accompanying materials are made available under */
7 /* the terms of the Common Public License v1.0 which accompanies this */
8 /* distribution. A copy is also available at the following address: */
9 /* http://www.oorexx.org/license.html */
10 /* */
11 /* Redistribution and use in source and binary forms, with or */
12 /* without modification, are permitted provided that the following */
13 /* conditions are met: */
14 /* */
15 /* Redistributions of source code must retain the above copyright */
16 /* notice, this list of conditions and the following disclaimer. */
17 /* Redistributions in binary form must reproduce the above copyright */
18 /* notice, this list of conditions and the following disclaimer in */
19 /* the documentation and/or other materials provided with the distribution. */
20 /* */
21 /* Neither the name of Rexx Language Association nor the names */
22 /* of its contributors may be used to endorse or promote products */
23 /* derived from this software without specific prior written permission. */
24 /* */
25 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
26 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
27 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
28 /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
29 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
30 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
31 /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
32 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
33 /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
34 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
35 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36 /* */
37 /*----------------------------------------------------------------------------*/
38 /******************************************************************************/
39 /* REXX Kernel */
40 /* */
41 /* Primitive Activation Class */
42 /* */
43 /* NOTE: activations are an execution time only object. They are never */
44 /* flattened or saved in the image, and hence will never be in old */
45 /* space. Because of this, activations "cheat" and do not use */
46 /* OrefSet to assign values to get better performance. Care must be */
47 /* used to maintain this situation. */
48 /* */
49 /******************************************************************************/
50 /******************************************************************************/
51 #include <ctype.h>
52 #include <string.h>
53 #include "RexxCore.h"
54 #include "StringClass.hpp"
55 #include "BufferClass.hpp"
56 #include "DirectoryClass.hpp"
58 #include "RexxActivation.hpp"
59 #include "RexxActivity.hpp"
60 #include "MethodClass.hpp"
61 #include "MessageClass.hpp"
62 #include "RexxCode.hpp"
63 #include "SourceFile.hpp"
64 #include "RexxInstruction.hpp"
65 #include "CallInstruction.hpp"
66 #include "DoBlock.hpp"
67 #include "DoInstruction.hpp"
68 #include "ProtectedObject.hpp"
69 #include "ActivityManager.hpp"
70 #include "Interpreter.hpp"
71 #include "SystemInterpreter.hpp"
72 #include "RexxInternalApis.h"
73 #include "PackageManager.hpp"
74 #include "RexxCompoundTail.hpp"
75 #include "CommandHandler.hpp"
76 #include "ActivationFrame.hpp"
77 #include "StackFrameClass.hpp"
78 #include "InterpreterInstance.hpp"
79 #include "PackageClass.hpp"
80 
81 /* max instructions without a yield */
82 #define MAX_INSTRUCTIONS 100
83  /* default template for a new */
84  /* activation. This must be changed */
85  /* whenever the settings definition */
86  /* changes */
88 // constants use for different activation settings
89 
90 const size_t RexxActivation::trace_off = 0x00000000; /* trace nothing */
91 const size_t RexxActivation::trace_debug = 0x00000001; /* interactive trace mode flag */
92 const size_t RexxActivation::trace_all = 0x00000002; /* trace all instructions */
93 const size_t RexxActivation::trace_results = 0x00000004; /* trace all results */
94 const size_t RexxActivation::trace_intermediates = 0x00000008; /* trace all instructions */
95 const size_t RexxActivation::trace_commands = 0x00000010; /* trace all commands */
96 const size_t RexxActivation::trace_labels = 0x00000020; /* trace all labels */
97 const size_t RexxActivation::trace_errors = 0x00000040; /* trace all command errors */
98 const size_t RexxActivation::trace_failures = 0x00000080; /* trace all command failures */
99 const size_t RexxActivation::trace_suppress = 0x00000100; /* tracing is suppressed during skips*/
100 const size_t RexxActivation::trace_flags = 0x000001ff; /* all tracing flags */
101  // the default trace setting
102 const size_t RexxActivation::default_trace_flags = trace_failures;
103 
104 // now the flag sets for different settings
105 const size_t RexxActivation::trace_all_flags = (trace_all | trace_labels | trace_commands);
106 const size_t RexxActivation::trace_results_flags = (trace_all | trace_labels | trace_results | trace_commands);
107 const size_t RexxActivation::trace_intermediates_flags = (trace_all | trace_labels | trace_results | trace_commands | trace_intermediates);
108 
109 const size_t RexxActivation::single_step = 0x00000800; /* we are single stepping execution */
110 const size_t RexxActivation::single_step_nested = 0x00001000; /* this is a nested stepping */
111 const size_t RexxActivation::debug_prompt_issued = 0x00002000; /* debug prompt already issued */
112 const size_t RexxActivation::debug_bypass = 0x00004000; /* skip next debug pause */
113 const size_t RexxActivation::procedure_valid = 0x00008000; /* procedure instruction is valid */
114 const size_t RexxActivation::clause_boundary = 0x00010000; /* work required at clause boundary */
115 const size_t RexxActivation::halt_condition = 0x00020000; /* a HALT condition occurred */
116 const size_t RexxActivation::trace_on = 0x00040000; /* external trace condition occurred */
117 const size_t RexxActivation::source_traced = 0x00080000; /* source string has been traced */
118 const size_t RexxActivation::clause_exits = 0x00100000; /* need to call clause boundary exits*/
119 const size_t RexxActivation::external_yield = 0x00200000; /* activity wants us to yield */
120 const size_t RexxActivation::forwarded = 0x00400000; /* forward instruction active */
121 const size_t RexxActivation::reply_issued = 0x00800000; /* reply has already been issued */
122 const size_t RexxActivation::set_trace_on = 0x01000000; /* trace turned on externally */
123 const size_t RexxActivation::set_trace_off = 0x02000000; /* trace turned off externally */
124 const size_t RexxActivation::traps_copied = 0x04000000; /* copy of trap info has been made */
125 const size_t RexxActivation::return_status_set = 0x08000000; /* had our first host command */
126 const size_t RexxActivation::transfer_failed = 0x10000000; /* transfer of variable lock failure */
127 
128 const size_t RexxActivation::elapsed_reset = 0x20000000; // The elapsed time stamp was reset via time('r')
129 const size_t RexxActivation::guarded_method = 0x40000000; // this is a guarded method
130 
131 void * RexxActivation::operator new(size_t size)
132 /******************************************************************************/
133 /* Function: Create a new activation object */
134 /******************************************************************************/
135 {
136  /* Get new object */
137  return new_object(size, T_Activation);
138 }
139 
140 
146 {
147  this->setHasNoReferences(); // nothing referenced from this either
148 }
149 
150 
159 {
160  this->clearObject(); /* start with a fresh object */
161  this->activity = _activity; /* save the activity pointer */
162  this->scope = _method->getScope(); // save the scope
163  this->code = _code; /* get the REXX method object */
164  this->executable = _method; // save this as the base executable
165  // save the source object reference also
166  this->sourceObject = _method->getSourceObject();
167  this->settings.intermediate_trace = false;
168  this->activation_context = METHODCALL; // the context is a method call
169  this->parent = OREF_NULL; // we don't have a parent stack frame when invoked as a method
170  this->execution_state = ACTIVE; /* we are now in active execution */
171  this->object_scope = SCOPE_RELEASED; /* scope not reserved yet */
172  /* create a new evaluation stack. This must be done before a */
173  /* local variable frame is created. */
174  this->setHasNoReferences(); /* during allocateStack.. */
175  /* a live marking can happen without */
176  /* a properly set up stack (::live() */
177  /* is called). Setting the NoRefBit */
178  /* when creating the stack avoids it.*/
179  _activity->allocateStackFrame(&this->stack, this->code->getMaxStackSize());
180  this->setHasReferences();
181 
182  // get initial settings template
183  // NOTE: Anything that alters information in the settings must happen AFTER
184  // this point.
186  // and override with the package-defined settings
191 
192  if (_method->isGuarded()) // make sure we set the appropriate guarded state
193  {
194  setGuarded();
195  }
196  /* save the source also */
197  this->settings.parent_code = this->code;
198 
199  /* allocate a frame for the local variables from activity stack */
202  /* set the initial and initial */
203  /* alternate address settings */
206  /* get initial random seed value */
207  this->random_seed = this->activity->getRandomSeed();
208  /* copy the source security manager */
210  if (this->settings.securityManager == OREF_NULL)
211  {
213  }
214  // and the call type is METHOD
215  this->settings.calltype = OREF_METHODNAME;
216 }
217 
218 
231 RexxActivation::RexxActivation(RexxActivity *_activity, RexxActivation *_parent, RexxCode *_code, int context)
232 {
233  this->clearObject(); /* start with a fresh object */
234  this->activity = _activity; /* save the activity pointer */
235  this->code = _code; /* get the REXX method object */
236 
237  if (context == DEBUGPAUSE) /* actually a debug pause? */
238  {
239  this->debug_pause = true; /* set up for debugging intercepts */
240  context = INTERPRET; /* this is really an interpret */
241  }
242  this->activation_context = context; /* save the context */
243  this->settings.intermediate_trace = false;
244  // the sender is our parent activity
245  this->parent = _parent;
246  this->execution_state = ACTIVE; /* we are now in active execution */
247  this->object_scope = SCOPE_RELEASED; /* scope not reserved yet */
248  /* create a new evaluation stack. This must be done before a */
249  /* local variable frame is created. */
250  this->setHasNoReferences(); /* during allocateStack.. */
251  /* a live marking can happen without */
252  /* a properly set up stack (::live() */
253  /* is called). Setting the NoRefBit */
254  /* when creating the stack avoids it.*/
255  _activity->allocateStackFrame(&stack, code->getMaxStackSize());
256  this->setHasReferences();
257  /* inherit parents settings */
258  _parent->putSettings(this->settings);
259  // step the trace indentation level for this internal nesting
261  // the random seed is copied from the calling activity, this led
262  // to reproducable random sequences even though no specific seed was given!
263  // see feat. 900 for example program.
265  if (context == INTERNALCALL) /* internal call? */
266  {
267  /* force a new copy of the traps */
268  /* table to be created whenever it */
269  /* is changed */
270  this->settings.flags &= ~traps_copied;
271  this->settings.flags &= ~reply_issued; /* this is a new activation that can use its own return */
272  /* invalidate the timestamp */
273  this->settings.timestamp.valid = false;
274  }
275  /* this is a nested call until we issue a procedure */
277  // get the executable from the parent.
278  this->executable = _parent->getExecutable();
279  // for internal calls, this is the same source object as the parent
281  {
282  // save the source object reference also
284  }
285  else
286  {
287  // use the source object for the interpret so error tracebacks are correct.
288  this->sourceObject = code->getSourceObject();
289  }
290 }
291 
292 
305  RexxString *calltype, RexxString *env, int context)
306 {
307  this->clearObject(); /* start with a fresh object */
308  this->activity = _activity; /* save the activity pointer */
309  this->code = _code; /* get the REXX method object */
310  this->executable = _routine; // save this as the base executable
311  // save the source object reference also
312  this->sourceObject = _routine->getSourceObject();
313 
314  this->activation_context = context; /* save the context */
315  this->settings.intermediate_trace = false;
316  this->parent = OREF_NULL; // there's no parent for a top level call
317  this->execution_state = ACTIVE; /* we are now in active execution */
318  this->object_scope = SCOPE_RELEASED; /* scope not reserved yet */
319  /* create a new evaluation stack. This must be done before a */
320  /* local variable frame is created. */
321  this->setHasNoReferences(); /* during allocateStack.. */
322  /* a live marking can happen without */
323  /* a properly set up stack (::live() */
324  /* is called). Setting the NoRefBit */
325  /* when creating the stack avoids it.*/
326  _activity->allocateStackFrame(&stack, code->getMaxStackSize());
327  this->setHasReferences();
328  /* get initial settings template */
330  // and override with the package-defined settings
335  /* save the source also */
336  this->settings.parent_code = this->code;
337 
338  /* allocate a frame for the local variables from activity stack */
341  /* set the initial and initial */
342  /* alternate address settings */
345  /* get initial random seed value */
346  this->random_seed = this->activity->getRandomSeed();
347  // the random seed is copied from the calling activity, this led
348  // to reproducable random sequences even though no specific seed was given!
349  // see feat. 900 for example program.
351  /* copy the source security manager */
353  // but use the default if not set
354  if (this->settings.securityManager == OREF_NULL)
355  {
357  }
358 
359  // if we have a default environment specified, apply the override.
360  if (env != OREF_NULL)
361  {
362  setDefaultAddress(env);
363  }
364  // set the call type
365  if (calltype != OREF_NULL)
366  {
367  this->settings.calltype = calltype;
368  }
369 }
370 
371 
373 /******************************************************************************/
374 /* Function: Re-dispatch an activation after a REPLY */
375 /******************************************************************************/
376 {
377  ProtectedObject r;
378  /* go run this */
379  return this->run(receiver, settings.msgname, arglist, argcount, OREF_NULL, r);
380 }
381 
382 
383 RexxObject * RexxActivation::run(RexxObject *_receiver, RexxString *msgname, RexxObject **_arglist,
384  size_t _argcount, RexxInstruction * start, ProtectedObject &resultObj)
385 /******************************************************************************/
386 /* Function: Run a REXX method...this is it! This is the heart of the */
387 /* interpreter that makes the whole thing run! */
388 /******************************************************************************/
389 {
390  // add the frame to the execution stack
391  RexxActivationFrame frame(activity, this);
392 
393  RexxActivity *oldActivity; /* old activity */
394 #ifndef FIXEDTIMERS /* currently disabled */
395  size_t instructionCount; /* instructions without yielding */
396 #endif
397  this->receiver = _receiver; /* save the message receiver */
398  // the "msgname" can also be the name of an external routine, the label
399  // name of an internal routine.
400  this->settings.msgname = msgname;
401 
402  /* not a reply restart situation? */
403  if (this->execution_state != REPLIED)
404  {
405  /* exits possible? We don't use exits for methods in the image */
406  if (!this->code->isOldSpace() && this->activity->isClauseExitUsed())
407  {
408  /* check at the end of each clause */
409  this->settings.flags |= clause_boundary;
410  /* remember that we have sys exits */
411  this->settings.flags |= clause_exits;
412  }
413  this->arglist = _arglist; /* set the argument list */
414  this->argcount = _argcount;
415  /* first entry into here? */
416  if (this->isTopLevelCall())
417  {
418  /* save entry argument list for */
419  /* variable pool fetch private */
420  /* access */
423  this->code->install(this); /* do any required installations */
424  this->next = this->code->getFirstInstruction(); /* ask the method for the start point*/
425  this->current = this->next; /* set the current too (for errors) */
426  /* not an internal method? */
427  if (this->isProgramLevelCall())
428  {
429  /* run initialization exit */
431  activity->getInstance()->setupProgram(this); /* do any system specific setup */
432  }
433  else
434  {
435  /* guarded method? */
436  if (isGuarded())
437  {
438  /* get the object variables */
440  /* reserve the variable scope */
442  /* and remember for later */
444  }
445  /* initialize the this variable */
446  this->setLocalVariable(OREF_SELF, VARIABLE_SELF, this->receiver);
447  /* initialize the SUPER variable */
448  this->setLocalVariable(OREF_SUPER, VARIABLE_SUPER, this->receiver->superScope(this->scope));
449  }
450  }
451  else
452  {
453  if (start == OREF_NULL) /* no starting location given? */
454  {
455  this->next = this->code->getFirstInstruction(); /* ask the method for the start point*/
456  }
457  else
458  {
459  this->next = start; /* set that as the current */
460  }
461  this->current = this->next; /* set the current too (for errors) */
462  }
463  }
464  else
465  { /* resuming after a reply */
466  /* need to reaquire the lock? */
467  if (this->settings.flags&transfer_failed)
468  {
469  /* re-lock the variable dictionary */
471  /* turn off the failure flag */
472  this->settings.flags &= ~transfer_failed;
473  }
474  }
475  /* internal call? */
476  if (this->isInternalCall())
477  {
478  start = this->next; /* get the starting point */
479  /* scan over the internal labels */
480  while (start != OREF_NULL && start->isType(KEYWORD_LABEL))
481  {
482  start = start->nextInstruction; /* step to the next one */
483  }
484  /* this a procedure instruction */
485  if (start != OREF_NULL && start->isType(KEYWORD_PROCEDURE))
486  {
487  /* flip on the procedure flag */
488  this->settings.flags |= procedure_valid;
489  }
490  }
491  this->execution_state = ACTIVE; /* we are now actively processing */
492 
493  if (tracingAll() && isMethodOrRoutine())
494  {
495  traceEntry();
496  }
497 
498  while (true) // loop until we get a terminating condition
499  {
500  try
501  {
502  RexxExpressionStack *localStack = &this->stack; /* load up the stack */
503 #ifndef FIXEDTIMERS /* currently disabled */
504  instructionCount = 0; /* no instructions yet */
505 #endif
506  RexxInstruction *nextInst = this->next; /* get the next instruction */
507  /* loop until we get a terminating */
508  while (nextInst != OREF_NULL)
509  { /* condition */
510 
511 #ifdef FIXEDTIMERS /* currently disabled (active on Win)*/
512  /* has time Slice expired? */
514  {
515  this->activity->relinquish(); /* yield control to the activity */
516  }
517 #else
518  /* need to give someone else a shot? */
519  if (++instructionCount > MAX_INSTRUCTIONS)
520  {
521  this->activity->relinquish(); /* yield control to the activity */
522  instructionCount = 0; /* reset to zero */
523  }
524 #endif
525 
526  this->current = nextInst; /* set the next instruction */
527  this->next = nextInst->nextInstruction;/* prefetch the next clause */
528 
529  nextInst->execute(this, localStack); /* execute the instruction */
530  localStack->clear(); /* Force the stack clear */
531  this->settings.timestamp.valid = false;
532  /* need to process inter-clause stuff*/
533  if (this->settings.flags&clause_boundary)
534  {
535  this->processClauseBoundary(); /* go do the clause boundary stuff */
536  }
537  nextInst = this->next; /* get the next instruction */
538  }
539  if (this->execution_state == ACTIVE) /* implicit exit? */
540  {
541  this->implicitExit(); /* treat this like an EXIT */
542  }
543  /* is this a return situation? */
544  if (this->execution_state == RETURNED)
545  {
546  this->termination(); /* do activation termination process */
547  if (this->isInterpret())
548  {
549  /* save the nested setting */
550  bool nested = this->parent->settings.local_variables.isNested();
551  /* propagate parent's settings back */
552  this->parent->getSettings(this->settings);
553  if (!nested)
554  {
555  /* if our calling variable context was not nested, we */
556  /* need to clear it. */
558  }
559  /* merge any pending conditions */
560  this->parent->mergeTraps(this->condition_queue, this->handler_queue);
561  }
562  resultObj = this->result; /* save the result */
563  this->activity->popStackFrame(false); /* now pop the current activity */
564  /* now go run the uninit stuff */
566  }
567  else
568  { /* execution_state is REPLIED */
569  resultObj = this->result; /* save the result */
570  /* reset the next instruction */
571  this->next = this->current->nextInstruction;
572  oldActivity = this->activity; /* save the current activity */
573  /* clone the current activity */
574  this->activity = oldActivity->spawnReply();
575 
576  /* save the pointer to the start of our stack frame. We're */
577  /* going to need to release this after we migrate everything */
578  /* over. */
579  RexxObject **framePtr = localStack->getFrame();
580  /* migrate the local variables and the expression stack to the */
581  /* new activity. NOTE: these must be done in this order to */
582  /* get them allocated from the new activity in the correct */
583  /* order. */
584  localStack->migrate(this->activity);
586  /* if we have arguments, we need to migrate those also, as they are subject to overwriting once we return to the parent activation. */
587  if (argcount > 0)
588  {
589  RexxObject **newArguments = activity->allocateFrame(argcount);
590  memcpy(newArguments, arglist, sizeof(RexxObject *) * argcount);
591  this->arglist = newArguments; /* must be set on "this" */
592  settings.parent_arglist = newArguments;
593  }
594 
595  /* return our stack frame space back to the old activity. */
596  oldActivity->releaseStackFrame(framePtr);
597 
598  this->activity->pushStackFrame(this);/* push it on to the activity stack */
599  // pop the old one off of the stack frame (but without returning it to
600  // the activation cache)
601  oldActivity->popStackFrame(true); /* pop existing one off the stack */
602  /* is the scope reserved? */
603  if (this->object_scope == SCOPE_RESERVED)
604  {
605  /* transfer the reservation */
606  if (!this->settings.object_variables->transfer(this->activity))
607  {
608  /* remember the failure */
609  this->settings.flags |= transfer_failed;
610  }
611  }
612  this->activity->run(); /* continue running the new activity */
613  oldActivity->relinquish(); /* give other activity a chance to go*/
614  }
615  return resultObj; /* return the result object */
616  }
617  catch (RexxActivation *t)
618  {
619  // if we're not the target of this throw, we've already been unwound
620  // keep throwing this until it reaches the target activation.
621  if (t != this )
622  {
623  throw;
624  }
625  // unwind the activation stack back to our frame
626  activity->unwindToFrame(this);
627 
628  this->stack.clear(); /* Force the stack clear */
629  /* invalidate the timestamp */
630  this->settings.timestamp.valid = false;
631  if (this->debug_pause)
632  { /* in a debug pause? */
633  this->execution_state = RETURNED;/* cause termination */
634  this->next = OREF_NULL; /* turn off execution engine */
635  }
636  /* have pending conditions? */
637  if (this->condition_queue != OREF_NULL)
638  {
639  /* get the pending count */
640  this->pending_count = this->condition_queue->getSize();
641  }
642  if (this->pending_count != 0)
643  { /* do we have trapped conditions? */
644  this->processTraps(); /* go dispatch the traps */
645  if (this->pending_count != 0) /* have deferred conditions? */
646  {
647  /* need to check each time around */
648  this->settings.flags |= clause_boundary;
649  }
650  }
651  }
652  }
653 }
654 
656 /******************************************************************************/
657 /* Function: process pending condition traps before going on to execute a */
658 /* clause */
659 /******************************************************************************/
660 {
661  size_t i = this->pending_count; /* get the pending count */
662  while (i--) /* while pending conditions */
663  {
664  /* get the handler off the queue */
665  RexxArray *trapHandler = (RexxArray *)this->handler_queue->pullRexx();
666  /* condition in DELAY state? */
667  if ((RexxString *)this->trapState((RexxString *)trapHandler->get(3)) == OREF_DELAY)
668  {
669  /* add to the end of the queue */
670  this->handler_queue->addLast(trapHandler);
671  /* move condition object to the end */
673  }
674  else
675  {
676  this->pending_count--; /* decrement the pending count */
677  /* get the current condition object */
678  RexxDirectory *conditionObj = (RexxDirectory *)this->condition_queue->pullRexx();
679  RexxObject *rc = conditionObj->at(OREF_RC); /* get any return code information */
680  if (rc != OREF_NULL) /* have something to assign to RC? */
681  {
682  /* initialize the RC variable */
683  this->setLocalVariable(OREF_RC, VARIABLE_RC, rc);
684  }
685  // it's possible that the condition can raise an error because of a
686  // missing label, so we need to catch any conditions that might be thrown
687  try
688  {
689  /* call the condition handler */
690  ((RexxInstructionCallBase *)trapHandler->get(1))->trap(this, conditionObj);
691  }
692  catch (RexxActivation *t)
693  {
694  // if we're not the target of this throw, we've already been unwound
695  // keep throwing this until it reaches the target activation.
696  if (t != this )
697  {
698  throw;
699  }
700  }
701  }
702  }
703 }
704 
705 
707  wholenumber_t skipcount, /* clauses to skip pausing */
708  bool notrace ) /* tracing suppression flag */
709 /******************************************************************************/
710 /* Function: Process a numeric "debug skip" TRACE instruction to suppress */
711 /* pauses or tracing for a given number of instructions. */
712 /******************************************************************************/
713 {
714  if (!this->debug_pause) /* not an allowed state? */
715  {
716  /* report the error */
718  }
719  /* copy the execution count */
720  this->settings.trace_skip = skipcount;
721  /* set the skip flag */
722  if (notrace) /* turning suppression on? */
723  {
724  /* flip on the flag */
725  this->settings.flags |= trace_suppress;
726  }
727  else /* skipping pauses only */
728  {
729  this->settings.flags &= ~trace_suppress;
730  }
731  this->settings.flags |= debug_bypass;/* let debug prompt know of changes */
732 }
733 
735 /******************************************************************************/
736 /* Function: Generate a string form of the current trace setting */
737 /******************************************************************************/
738 {
739  // have the source file process this
741 }
742 
743 
750 {
751  size_t newsetting; /* new trace setting */
752  size_t traceFlags; // the optimized trace flags
753 
754  char traceOption = 0; // a potential bad character
755 
756  if (!RexxSource::parseTraceSetting(setting, newsetting, traceFlags, traceOption))
757  {
759  }
760  /* now change the setting */
761  setTrace(newsetting, traceFlags);
762 }
763 
764 
772 void RexxActivation::setTrace(size_t traceOption, size_t traceFlags)
773 {
774  /* turn off the trace suppression */
775  this->settings.flags &= ~trace_suppress;
776  this->settings.trace_skip = 0; /* and allow debug pauses */
777 
778  // we might need to transfer some information from the
779  // current settings
780  if ((traceOption&RexxSource::DEBUG_TOGGLE) != 0)
781  {
782  // if nothing else was specified, this was a pure toggle
783  // operation, which maintains the existing settings
784  if (traceFlags == 0)
785  {
786  // pick up the existing flags
787  traceFlags = settings.flags&trace_flags;
788  traceOption = settings.traceOption;
789  }
790 
791  /* switch to the opposite setting */
792  /* already on? */
793  if ((this->settings.flags&trace_debug) != 0)
794  {
795  /* switch the setting off */
796  traceFlags &= ~trace_debug;
797  traceOption &= ~RexxSource::DEBUG_ON;
798  // flipping out of debug mode. Reissue the debug prompt when
799  // turned back on again
801  }
802  else
803  {
804  // switch the setting on in both the flags and the setting
805  traceFlags |= trace_debug;
806  traceOption |= RexxSource::DEBUG_ON;
807  }
808  }
809  // are we in debug mode already? A trace setting with no "?" maintains the
810  // debug setting, unless it is Trace Off
811  else if ((settings.flags&trace_debug) != 0)
812  {
813  if (traceFlags == 0)
814  {
815  // flipping out of debug mode. Reissue the debug prompt when
816  // turned back on again
818  }
819  else
820  {
821  // add debug mode into the new settings if on
822  traceFlags |= trace_debug;
823  traceOption |= RexxSource::DEBUG_ON;
824  }
825  }
826 
827  // save the option so it can be formatted back into a trace value
828  this->settings.traceOption = traceOption;
829  // clear the current trace options
831  // set the new flags
832  settings.flags |= traceFlags;
833  // if tracing intermediates, turn on the special fast check flag
835  {
836  /* turn on the special fast-path test */
837  this->settings.intermediate_trace = true;
838  }
839 
840  if (this->debug_pause) /* issued from a debug prompt? */
841  {
842  /* let debug prompt know of changes */
843  this->settings.flags |= debug_bypass;
844  }
845 }
846 
847 
858 size_t RexxActivation::processTraceSetting(size_t traceSetting)
859 {
860  size_t flags = 0;
861  switch (traceSetting & TRACE_DEBUG_MASK)
862  {
863  case RexxSource::DEBUG_ON: /* turn on interactive debug */
864  /* switch the setting on */
865  flags |= trace_debug;
866  break;
867 
868  case RexxSource::DEBUG_OFF: /* turn off interactive debug */
869  /* switch the setting off */
870  flags &= ~trace_debug;
871  break;
872  // These two have no meaning in a staticically defined situation, so
873  // they'll need to be handled at runtime.
874  case RexxSource::DEBUG_TOGGLE: /* toggle interactive debug setting */
875  case RexxSource::DEBUG_IGNORE: /* no changes to debug setting */
876  break;
877  }
878  // now optimize the trace setting flags
880  {
881  case RexxSource::TRACE_ALL: /* TRACE ALL; */
882  /* trace instructions, labels and */
883  /* all commands */
884  flags |= (trace_all | trace_labels | trace_commands);
885  break;
886 
887  case RexxSource::TRACE_COMMANDS: /* TRACE COMMANDS; */
888  flags |= trace_commands;
889  break;
890 
891  case RexxSource::TRACE_LABELS: /* TRACE LABELS */
892  flags |= trace_labels;
893  break;
894 
895  case RexxSource::TRACE_NORMAL: /* TRACE NORMAL */
896  case RexxSource::TRACE_FAILURES: /* TRACE FAILURES */
897  /* just trace command failures */
898  flags |= trace_failures;
899  break;
900 
901  case RexxSource::TRACE_ERRORS: /* TRACE ERRORS */
902  /* trace command failures and error */
903  flags |= (trace_failures | trace_errors);
904  break;
905 
906  case RexxSource::TRACE_RESULTS: /* TRACE RESULTS */
908  break;
909 
910  case RexxSource::TRACE_INTERMEDIATES: /* TRACE INTERMEDIATES */
911  /* trace just about every things */
913  break;
914 
915  case RexxSource::TRACE_OFF: /* TRACE OFF */
916  flags = trace_off; // turn of all trace options, including debug flags
917  break;
918 
919  case RexxSource::TRACE_IGNORE: /* don't change trace setting */
920  break;
921  }
922  return flags;
923 }
924 
925 void RexxActivation::live(size_t liveMark)
926 /******************************************************************************/
927 /* Function: Normal garbage collection live marking */
928 /******************************************************************************/
929 {
930  memory_mark(this->previous);
931  memory_mark(this->executable);
932  memory_mark(this->scope);
933  memory_mark(this->code);
935  memory_mark(this->receiver);
936  memory_mark(this->activity);
937  memory_mark(this->parent);
938  memory_mark(this->dostack);
939  /* the stack and the local variables handle their own marking. */
940  this->stack.live(liveMark);
941  this->settings.local_variables.live(liveMark);
942  memory_mark(this->current);
943  memory_mark(this->next);
944  memory_mark(this->result);
945  memory_mark(this->trapinfo);
946  memory_mark(this->objnotify);
948  memory_mark(this->handler_queue);
950  memory_mark(this->settings.traps);
960  memory_mark(this->contextObject);
961 
962  /* We're hold a pointer back to our arguments directly where they */
963  /* are created. Since in some places, this argument list comes */
964  /* from the C stack, we need to handle the marker ourselves. */
965  size_t i;
966  for (i = 0; i < argcount; i++)
967  {
968  memory_mark(arglist[i]);
969  }
970 
971  for (i = 0; i < settings.parent_argcount; i++)
972  {
974  }
975 }
976 
978 /******************************************************************************/
979 /* Function: Generalized object marking */
980 /******************************************************************************/
981 {
984  memory_mark_general(this->code);
990  /* the stack and the local variables handle their own marking. */
991  this->stack.liveGeneral(reason);
992  this->settings.local_variables.liveGeneral(reason);
994  memory_mark_general(this->next);
1012 
1013  /* We're hold a pointer back to our arguments directly where they */
1014  /* are created. Since in some places, this argument list comes */
1015  /* from the C stack, we need to handle the marker ourselves. */
1016  size_t i;
1017  for (i = 0; i < argcount; i++)
1018  {
1020  }
1021 
1022  for (i = 0; i < settings.parent_argcount; i++)
1023  {
1025  }
1026 }
1027 
1028 
1030  RexxObject * resultObj) /* returned REPLY result */
1031 /******************************************************************************/
1032 /* Function: Process a REXX REPLY instruction */
1033 /******************************************************************************/
1034 {
1035  /* already had a reply issued? */
1036  if (this->settings.flags&reply_issued)
1037  {
1038  /* flag this as an error */
1040  }
1041  this->settings.flags |= reply_issued;/* turn on the replied flag */
1042  /* change execution state to */
1043  this->execution_state = REPLIED; /* terminate the main loop */
1044  this->next = OREF_NULL; /* turn off execution engine */
1045  this->result = resultObj; /* save the result value */
1046 }
1047 
1048 
1050  RexxObject * resultObj) /* returned RETURN/EXIT result */
1051 /******************************************************************************/
1052 /* Function: process a REXX RETURN instruction */
1053 /******************************************************************************/
1054 {
1055  /* already had a reply issued? */
1056  if (this->settings.flags&reply_issued && resultObj != OREF_NULL)
1057  {
1058  /* flag this as an error */
1060  }
1061  /* processing an Interpret */
1062  if (this->isInterpret())
1063  {
1064  this->execution_state = RETURNED; /* this is a returned state */
1065  this->next = OREF_NULL; /* turn off execution engine */
1066  /* cause a return in the parent */
1067  this->parent->returnFrom(resultObj); /* activity */
1068  }
1069  else
1070  {
1071  this->execution_state = RETURNED; /* the state is returned */
1072  this->next = OREF_NULL; /* turn off execution engine */
1073  this->result = resultObj; /* save the return result */
1074  /* real program call? */
1075  if (this->isProgramLevelCall())
1076  {
1077  /* run termination exit */
1079  }
1080  }
1081  /* switch debug off to avoid debug */
1082  /* pause after exit entered from an */
1083  this->settings.flags &= ~trace_debug;/* interactive debug prompt */
1084  this->settings.flags |= debug_bypass;/* let debug prompt know of changes */
1085 }
1086 
1087 
1089  RexxString * name ) /* name specified on iterate */
1090 /******************************************************************************/
1091 /* Function: Process a REXX ITERATE instruction */
1092 /******************************************************************************/
1093 {
1094  RexxDoBlock *doblock = this->topBlock(); /* get the first stack item */
1095 
1096  while (doblock != OREF_NULL)
1097  { /* while still DO blocks to process */
1098  RexxBlockInstruction *loop = doblock->getParent(); /* get the actual loop instruction */
1099  if (name == OREF_NULL) // leaving the inner-most loop?
1100  {
1101  // we only recognize LOOP constructs for this.
1102  if (loop->isLoop())
1103  {
1104  /* reset the indentation */
1105  this->setIndent(doblock->getIndent());
1106  ((RexxInstructionDo *)loop)->reExecute(this, &this->stack, doblock);
1107  return; /* we're finished */
1108  }
1109 
1110  }
1111  // a named LEAVE can be either a labeled block or a loop.
1112  else if (loop->isLabel(name))
1113  {
1114  if (!loop->isLoop())
1115  {
1117  }
1118  /* reset the indentation */
1119  this->setIndent(doblock->getIndent());
1120  ((RexxInstructionDo *)loop)->reExecute(this, &this->stack, doblock);
1121  return; /* we're finished */
1122  }
1123  this->popBlock(); /* cause termination cleanup */
1124  this->removeBlock(); /* remove the execution nest */
1125  doblock = this->topBlock(); /* get the new stack top */
1126  }
1127  if (name != OREF_NULL) /* have a name? */
1128  {
1129  /* report exception with the name */
1131  }
1132  else
1133  {
1134  /* have a misplaced ITERATE */
1136  }
1137 }
1138 
1139 
1141  RexxString * name ) /* name specified on leave */
1142 /******************************************************************************/
1143 /* Function: Process a REXX LEAVE instruction */
1144 /******************************************************************************/
1145 {
1146  RexxDoBlock *doblock = this->topBlock(); /* get the first stack item */
1147 
1148  while (doblock != OREF_NULL)
1149  { /* while still DO blocks to process */
1150  RexxBlockInstruction *loop = doblock->getParent(); /* get the actual loop instruction */
1151  if (name == OREF_NULL) // leaving the inner-most loop?
1152  {
1153  // we only recognize LOOP constructs for this.
1154  if (loop->isLoop())
1155  {
1156  loop->terminate(this, doblock); /* terminate the loop */
1157  return; /* we're finished */
1158  }
1159 
1160  }
1161  // a named LEAVE can be either a labeled block or a loop.
1162  else if (loop->isLabel(name))
1163  {
1164  loop->terminate(this, doblock); /* terminate the loop */
1165  return; /* we're finished */
1166  }
1167  this->popBlock(); /* cause termination cleanup */
1168  this->removeBlock(); /* remove the execution nest */
1169  /* get the first stack item again */
1170  doblock = this->topBlock(); /* get the new stack top */
1171  }
1172  if (name != OREF_NULL) /* have a name? */
1173  {
1174  /* report exception with the name */
1176  }
1177  else
1178  {
1179  /* have a misplaced LEAVE */
1181  }
1182 }
1183 
1185 /******************************************************************************/
1186 /* Function: Return the line number of the current instruction */
1187 /******************************************************************************/
1188 {
1189  if (this->current != OREF_NULL) /* have a current line? */
1190  {
1191  return this->current->getLineNumber(); /* return the line number */
1192  }
1193  else
1194  {
1195  return 1; /* error on the loading */
1196  }
1197 }
1198 
1199 
1201  RexxVariableBase **variables, size_t count)
1202 /******************************************************************************/
1203 /* Function: Expose variables for a PROCEDURE instruction */
1204 /******************************************************************************/
1205 {
1206  /* procedure not allowed here? */
1207  if (!(this->settings.flags&procedure_valid))
1208  {
1209  /* raise the appropriate error! */
1211  }
1212  /* disable further procedures */
1213  this->settings.flags &= ~procedure_valid;
1214 
1215  /* get a new */
1217  /* make sure we clear out the dictionary, otherwise we'll see the */
1218  /* dynamic entries from the previous level. */
1220 
1221  /* now expose each individual variable */
1222  for (size_t i = 0; i < count; i++)
1223  {
1224  variables[i]->procedureExpose(this, parent, &stack);
1225  }
1226 }
1227 
1228 
1230  RexxVariableBase **variables, size_t count)
1231 /******************************************************************************/
1232 /* Function: Expose variables for an EXPOSE instruction */
1233 /******************************************************************************/
1234 {
1235  /* get the variable set for this object */
1236  RexxVariableDictionary * object_variables = getObjectVariables();
1237 
1238  /* now expose each individual variable */
1239  for (size_t i = 0; i < count; i++)
1240  {
1241  variables[i]->expose(this, &stack, object_variables);
1242  }
1243 }
1244 
1245 
1247  RexxObject * target, /* target object */
1248  RexxString * message, /* message to send */
1249  RexxObject * superClass, /* class over ride */
1250  RexxObject ** _arguments, /* message arguments */
1251  size_t _argcount, /* count of message arguments */
1252  bool continuing) /* return/continue flag */
1253 /******************************************************************************/
1254 /* Function: Process a REXX FORWARD instruction */
1255 /******************************************************************************/
1256 {
1257  if (target == OREF_NULL) /* no target? */
1258  {
1259  target = this->receiver; /* use this */
1260  }
1261  if (message == OREF_NULL) /* no message override? */
1262  {
1263  message = this->settings.msgname; /* use same message name */
1264  }
1265  if (_arguments == OREF_NULL)
1266  { /* no arguments given? */
1267  _arguments = this->arglist; /* use the same arguments */
1268  _argcount = this->argcount;
1269  }
1270  if (continuing)
1271  { /* just processing the message? */
1272  ProtectedObject r;
1273  if (superClass == OREF_NULL) /* no override? */
1274  {
1275  /* issue the message and return */
1276  target->messageSend(message, _arguments, _argcount, r);
1277  }
1278  else
1279  {
1280  /* issue the message with override */
1281  target->messageSend(message, _arguments, _argcount, superClass, r);
1282  }
1283  return(RexxObject *)r;
1284  }
1285  else
1286  { /* got to shut down and issue */
1287  this->settings.flags |= forwarded; /* we are now a phantom activation */
1288  /* already had a reply issued? */
1289  if (this->settings.flags&reply_issued && this->result != OREF_NULL)
1290  {
1291  /* flag this as an error */
1293  }
1294  this->execution_state = RETURNED; /* this is an EXIT for real */
1295  this->next = OREF_NULL; /* turn off execution engine */
1296  /* switch debug off to avoid debug */
1297  /* pause after exit entered from an */
1298  /* interactive debug prompt */
1299  this->settings.flags &= ~trace_debug;
1300  /* let debug prompt know of changes */
1301  this->settings.flags |= debug_bypass;
1302  ProtectedObject r;
1303  if (superClass == OREF_NULL) /* no over ride? */
1304  {
1305  /* issue the simple message */
1306  target->messageSend(message, _arguments, _argcount, r);
1307  }
1308  else
1309  {
1310  /* use the full override */
1311  target->messageSend(message, _arguments, _argcount, superClass, r);
1312  }
1313  this->result = (RexxObject *)r; /* save the result value */
1314  /* already had a reply issued? */
1315  if (this->settings.flags&reply_issued && this->result != OREF_NULL)
1316  {
1317  /* flag this as an error */
1319  }
1320  this->termination(); /* run "program" termination method */
1321  /* if there are stream objects */
1322  return OREF_NULL; /* just return nothing */
1323  }
1324 }
1325 
1327  RexxObject * resultObj) /* EXIT result */
1328 /******************************************************************************/
1329 /* Function: Process a REXX exit instruction */
1330 /******************************************************************************/
1331 {
1332  RexxActivation *activation; /* unwound activation */
1333 
1334  this->execution_state = RETURNED; /* this is an EXIT for real */
1335  this->next = OREF_NULL; /* turn off execution engine */
1336  this->result = resultObj; /* save the result value */
1337  /* switch debug off to avoid debug */
1338  /* pause after exit entered from an */
1339  this->settings.flags &= ~trace_debug;/* interactive debug prompt */
1340  this->settings.flags |= debug_bypass;/* let debug prompt know of changes */
1341  /* at a main program level? */
1342  if (this->isTopLevelCall())
1343  {
1344  /* already had a reply issued? */
1345  if (this->settings.flags&reply_issued && result != OREF_NULL)
1346  {
1347  /* flag this as an error */
1349  }
1350  /* real program call? */
1351  if (this->isProgramLevelCall())
1352  {
1353  /* run termination exit */
1355  }
1356  }
1357  else
1358  { /* internal routine or Interpret */
1359  /* start terminating with this level */
1360  activation = this;
1361  do
1362  {
1363  activation->termination(); /* make sure this level cleans up */
1364  ActivityManager::currentActivity->popStackFrame(false); /* pop this level off */
1365  /* get the next level */
1367  } while (!activation->isTopLevel());
1368 
1369  activation->exitFrom(resultObj); /* tell this level to terminate */
1370  /* unwind and process the termination*/
1371  throw activation; // throw this as an exception to start the unwinding
1372  }
1373 }
1374 
1375 #if 0
1377 /******************************************************************************/
1378 /* Function: Process a "fall of the end" exit condition */
1379 /******************************************************************************/
1380 {
1381  /* at a main program level or completing an INTERPRET */
1382  /* instruction? */
1383  if (this->isTopLevelCall() || this->isInterpret())
1384  {
1385  /* real program call? */
1386  if (this->isProgramLevelCall())
1387  {
1388  /* run termination exit */
1389  this->activity->callTerminationExit(this);
1390  }
1391  this->execution_state = RETURNED;/* this is an EXIT for real */
1392  return; /* we're finished here */
1393  }
1394  this->exitFrom(OREF_NULL); /* we've had a nested exit, we need to process this more fully */
1395 }
1396 #endif
1397 
1399 /******************************************************************************/
1400 /* Function: do any cleanup due to a program terminating. */
1401 /******************************************************************************/
1402 {
1403  this->guardOff(); /* Remove any guards for this activatio*/
1404 
1405  /* were there any SETLOCAL calls for */
1406  /* this method? And are there any */
1407  /* that didn't have a matching ENDLOC*/
1408  if (this->environmentList != OREF_NULL && this->environmentList->getSize() != 0)
1409  {
1410  /* Yes, then restore the environment */
1411  /* to the ist on added. */
1413  }
1414  this->environmentList = OREF_NULL; /* Clear out the env list */
1415  this->closeStreams(); /* close any open streams */
1416  /* release the stack frame, which also releases the frame for the */
1417  /* variable cache. */
1419  /* do the variable termination */
1421  // deactivate the context object if we created one.
1422  if (contextObject != OREF_NULL)
1423  {
1424  contextObject->detach();
1425  }
1426 }
1427 
1428 
1430 /******************************************************************************/
1431 /* Function: Create/copy a trap table as needed */
1432 /******************************************************************************/
1433 {
1434  /* no trap table created yet? */
1435  if (this->settings.traps == OREF_NULL)
1436  {
1437  /* create the trap table */
1438  this->settings.traps = new_directory();
1439  }
1440  /* have to copy the trap table for an*/
1441  /* internal routine call? */
1442  else if (this->isInternalCall() && !(this->settings.flags&traps_copied))
1443  {
1444  /* copy the table */
1445  this->settings.traps = (RexxDirectory *)this->settings.traps->copy();
1446  /* record that we've copied this */
1447  this->settings.flags |= traps_copied;
1448  }
1449 }
1450 
1452  RexxString * condition, /* condition name */
1453  /* handler for this trap */
1454  RexxInstructionCallBase * handler )
1455 /******************************************************************************/
1456 /* Function: Activate a condition trap */
1457 /******************************************************************************/
1458 {
1459  this->checkTrapTable(); /* make sure we have a table */
1460  /* add the trap to the table */
1461  this->settings.traps->put(new_array((RexxObject *)handler, OREF_ON, condition), condition);
1462  /* novalue condition or any? */
1463  if (condition->strCompare(CHAR_NOVALUE) || condition->strCompare(CHAR_ANY))
1464  {
1465  /* tag the method dictionary */
1467  }
1468 }
1469 
1470 
1472  RexxString * condition) /* condition name */
1473 /******************************************************************************/
1474 /* Function: Disable a condition trap */
1475 /******************************************************************************/
1476 {
1477  this->checkTrapTable(); /* make sure we have a table */
1478  /* remove the trap */
1479  this->settings.traps->remove(condition);
1480  /* novalue condition? */
1481  if (!this->isInternalCall() && condition->strCompare(CHAR_NOVALUE))
1482  {
1483  /* not also trapping ANY? */
1484  if (this->settings.traps->at(OREF_ANY) == OREF_NULL)
1485  {
1486  /* tag the method dictionary */
1488  }
1489  }
1490 }
1491 
1493 /******************************************************************************/
1494 /* Function: Return the top level external activation */
1495 /******************************************************************************/
1496 {
1497  /* if an internal call or an */
1498  /* interpret, we need to pass this */
1499  /* along */
1500  if (this->isInternalLevelCall())
1501  {
1502  return this->parent->external(); /* get our sender method */
1503  }
1504  else
1505  {
1506  return this; /* already at the top level */
1507  }
1508 }
1509 
1510 
1512  RexxString * condition, /* condition to raise */
1513  RexxObject * rc, /* information assigned to RC */
1514  RexxString * description, /* description of the condition */
1515  RexxObject * additional, /* extra descriptive information */
1516  RexxObject * resultObj, /* return result */
1517  RexxDirectory * conditionobj ) /* propagated condition object */
1518 /******************************************************************************/
1519 /* Function: Raise a condition using exit semantics for the returned value. */
1520 /******************************************************************************/
1521 {
1522  /* not internal routine or Interpret */
1523  /* instruction activation? */
1524  if (this->isTopLevelCall())
1525  {
1526  /* do the real condition raise */
1527  this->raise(condition, rc, description, additional, resultObj, conditionobj);
1528  return; /* return if processed */
1529  }
1530 
1531  /* reached the top level? */
1532  if (this->parent == OREF_NULL)
1533  {
1534  this->exitFrom(resultObj); /* turn into an exit instruction */
1535  }
1536  else
1537  {
1538  /* real program call? */
1539  if (this->isProgramLevelCall())
1540  {
1541  /* run termination exit */
1543  }
1544  ProtectedObject p(this);
1545  this->termination(); /* remove guarded status on object */
1546  this->activity->popStackFrame(false); /* pop ourselves off active list */
1547  /* propogate the condition backward */
1548  this->parent->raiseExit(condition, rc, description, additional, resultObj, conditionobj);
1549  }
1550 }
1551 
1552 
1554  RexxString * condition, /* condition to raise */
1555  RexxObject * rc, /* information assigned to RC */
1556  RexxString * description, /* description of the condition */
1557  RexxObject * additional, /* extra descriptive information */
1558  RexxObject * resultObj, /* return result */
1559  RexxDirectory * conditionobj ) /* propagated condition object */
1560 /******************************************************************************/
1561 /* Function: Raise a give REXX condition */
1562 /******************************************************************************/
1563 {
1564  bool propagated; /* propagated syntax condition */
1565 
1566  /* propagating an existing condition?*/
1567  if (condition->strCompare(CHAR_PROPAGATE))
1568  {
1569  /* get the original condition name */
1570  condition = (RexxString *)conditionobj->at(OREF_CONDITION);
1571  propagated = true; /* this is propagated */
1572  /* fill in the propagation status */
1573  conditionobj->put(TheTrueObject, OREF_PROPAGATED);
1574  if (resultObj == OREF_NULL) /* no result specified? */
1575  {
1576  resultObj = conditionobj->at(OREF_RESULT);
1577  }
1578  }
1579  else
1580  { /* build a condition object */
1581  conditionobj = new_directory(); /* get a new directory */
1582  /* put in the condition name */
1583  conditionobj->put(condition, OREF_CONDITION);
1584  /* fill in default description */
1585  conditionobj->put(OREF_NULLSTRING, OREF_DESCRIPTION);
1586  /* fill in the propagation status */
1587  conditionobj->put(TheFalseObject, OREF_PROPAGATED);
1588  propagated = false; /* remember for later */
1589  }
1590  if (rc != OREF_NULL) /* have an RC value? */
1591  {
1592  conditionobj->put(rc, OREF_RC); /* add to the condition argument */
1593  }
1594  if (description != OREF_NULL) /* any description to add? */
1595  {
1596  conditionobj->put(description, OREF_DESCRIPTION);
1597  }
1598  if (additional != OREF_NULL) /* or additional information */
1599  {
1600  conditionobj->put(additional, OREF_ADDITIONAL);
1601  }
1602  if (resultObj != OREF_NULL) /* or a result object */
1603  {
1604  conditionobj->put(resultObj, OREF_RESULT);
1605  }
1606 
1607  /* fatal SYNTAX error? */
1608  if (condition->strCompare(CHAR_SYNTAX))
1609  {
1610  ProtectedObject p(this);
1611  if (propagated)
1612  { /* reraising a condition? */
1613  this->termination(); /* do the termination cleanup on ourselves */
1614  this->activity->popStackFrame(false); /* pop ourselves off active list */
1615  /* go propagate the condition */
1617  }
1618  else
1619  {
1620  /* go raise the error */
1621  ActivityManager::currentActivity->raiseException(((RexxInteger *)rc)->getValue(), description, (RexxArray *)additional, resultObj);
1622  }
1623  }
1624  else
1625  { /* normal condition trapping */
1626  /* get the sender object (if any) */
1627  // find a predecessor Rexx activation
1628  RexxActivation *_sender = this->senderActivation();
1629  /* do we have a sender that is */
1630  /* trapping this condition? */
1631  /* do we have a sender? */
1632  bool trapped = false;
1633  if (_sender != OREF_NULL)
1634  {
1635  /* "tickle them" with this */
1636  trapped = _sender->trap(condition, conditionobj);
1637  }
1638 
1639  /* is this an untrapped halt condition? Need to transform into a SYNTAX error */
1640  if (!trapped && condition->strCompare(CHAR_HALT))
1641  {
1642  /* raise as a syntax error */
1644  }
1645 
1646  this->returnFrom(resultObj); /* process the return part */
1647  throw this; /* unwind and process the termination*/
1648  }
1649 }
1650 
1651 
1653 /******************************************************************************/
1654 /* Function: Return the associated object variables vdict */
1655 /******************************************************************************/
1656 {
1657  /* no retrieved yet? */
1658  if (this->settings.object_variables == OREF_NULL)
1659  {
1660  /* get the object variables */
1662  if (isGuarded()) /* guarded method? */
1663  {
1664  /* reserve the variable scope */
1665  this->settings.object_variables->reserve(this->activity);
1666  /* and remember for later */
1667  this->object_scope = SCOPE_RESERVED;
1668  }
1669  }
1670  /* return the vdict */
1671  return this->settings.object_variables;
1672 }
1673 
1674 
1686 RexxObject *RexxActivation::resolveStream(RexxString *name, bool input, RexxString **fullName, bool *added)
1687 {
1688  if (added != NULL)
1689  {
1690  *added = false; /* when caller requires stream table entry then initialize */
1691  }
1692  RexxDirectory *streamTable = getStreams(); /* get the current stream set */
1693  if (fullName) /* fullName requested? */
1694  {
1695  *fullName = name; /* initialize to name */
1696  }
1697  /* if length of name is 0, then it's the same as omitted */
1698  if (name == OREF_NULL || name->getLength() == 0) /* no name? */
1699  {
1700  if (input) /* input operation? */
1701  {
1702  /* get the default output stream */
1703  return getLocalEnvironment(OREF_INPUT);
1704  }
1705  else
1706  {
1707  /* get the default output stream */
1708  return getLocalEnvironment(OREF_OUTPUT);
1709  }
1710  }
1711  /* standard input stream? */
1712  else if (name->strCaselessCompare(CHAR_STDIN) || name->strCaselessCompare(CHAR_CSTDIN))
1713  {
1714  /* get the default output stream */
1715  return getLocalEnvironment(OREF_INPUT);
1716  }
1717  /* standard output stream? */
1719  {
1720  /* get the default output stream */
1721  return getLocalEnvironment(OREF_OUTPUT);
1722  }
1723  /* standard error stream? */
1725  {
1726  /* get the default output stream */
1727  return getLocalEnvironment(OREF_ERRORNAME);
1728  }
1729  else
1730  {
1731  /* go get the qualified name */
1733  if (fullName) /* fullName requested? */
1734  {
1735  *fullName = qualifiedName; /* provide qualified name */
1736  }
1737  // protect from GC
1738  ProtectedObject p(qualifiedName);
1739  /* Note: stream name is pushed to the stack to be protected from GC; */
1740  /* e.g. it is used by the caller to remove stream from stream table. */
1741  /* The stack will be reset after the function was executed and the */
1742  /* protection is released */
1743  /* see if we've already opened this */
1744  RexxObject *stream = streamTable->at(qualifiedName);
1745  if (stream == OREF_NULL) /* not open */
1746  {
1748  stream = manager->checkStreamAccess(qualifiedName);
1749  if (stream != OREF_NULL)
1750  {
1751  streamTable->put(stream, qualifiedName);
1752  return stream; /* return the stream object */
1753  }
1754  /* get the stream class */
1755  RexxObject *streamClass = TheEnvironment->at(OREF_STREAM);
1756  /* create a new stream object */
1757  stream = streamClass->sendMessage(OREF_NEW, name);
1758 
1759  if (added) /* open the stream? begin */
1760  {
1761  /* add to the streams table */
1762  streamTable->put(stream, qualifiedName);
1763  *added = true; /* mark it as added to stream table */
1764  }
1765  }
1766  return stream; /* return the stream object */
1767  }
1768 }
1769 
1771 /******************************************************************************/
1772 /* Function: Return the associated object variables stream table */
1773 /******************************************************************************/
1774 {
1775  /* not created yet? */
1776  if (this->settings.streams == OREF_NULL)
1777  {
1778  /* first entry into here? */
1779  if (this->isProgramOrMethod())
1780  {
1781  /* always use a new directory */
1782  this->settings.streams = new_directory();
1783  }
1784  else
1785  {
1786  // get the caller frame. If it is not a Rexx one, then
1787  // we use a fresh stream table
1788  RexxActivationBase *callerFrame = getPreviousStackFrame();
1789  if (callerFrame == OREF_NULL || !callerFrame->isRexxContext())
1790  {
1791  this->settings.streams = new_directory();
1792  }
1793  else
1794  {
1795 
1796  /* alway's use caller's for internal */
1797  /* call, external call or interpret */
1798  this->settings.streams = ((RexxActivation *)callerFrame)->getStreams();
1799  }
1800  }
1801  }
1802  return this->settings.streams; /* return the stream table */
1803 }
1804 
1806  RexxInstruction * target ) /* target instruction */
1807 /******************************************************************************/
1808 /* Function: Signal to a targer instruction */
1809 /******************************************************************************/
1810 {
1811  /* internal routine or Interpret */
1812  /* instruction activation? */
1813  if (this->isInterpret())
1814  {
1815  this->execution_state = RETURNED; /* signal interpret termination */
1816  this->next = OREF_NULL; /* turn off execution engine */
1817  this->parent->signalTo(target); /* propogate the signal backward */
1818  }
1819  else
1820  {
1821  /* initialize the SIGL variable */
1822  size_t lineNum = this->current->getLineNumber();/* get the instruction line number */
1823  this->setLocalVariable(OREF_SIGL, VARIABLE_SIGL, new_integer(lineNum));
1824  this->next = target; /* set the new target location */
1825  this->dostack = OREF_NULL; /* clear the do loop stack */
1826  this->blockNest = 0; /* no more active blocks */
1827  this->settings.traceindent = 0; /* reset trace indentation */
1828  }
1829 }
1830 
1832 /******************************************************************************/
1833 /* Function: Toggle the address setting between the current and alternate */
1834 /******************************************************************************/
1835 {
1836  RexxString *temp = this->settings.current_env; /* save the current environment */
1837  /* make the alternate the current */
1839  this->settings.alternate_env = temp; /* old current is now the alternate */
1840 }
1841 
1842 
1844  RexxString * address ) /* new address environment */
1845 /******************************************************************************/
1846 /* Function: Set the new current address, moving the current one to the */
1847 /* alternate address */
1848 /******************************************************************************/
1849 {
1850  /* old current is now the alternate */
1852  this->settings.current_env = address;/* set new current environment */
1853 }
1854 
1855 
1857  RexxString * address ) /* new address environment */
1858 /******************************************************************************/
1859 /* Function: Set up a default address environment so that both the primary */
1860 /* and the alternate address are the same value */
1861 /******************************************************************************/
1862 {
1863  /* old current is the new one */
1864  this->settings.alternate_env = address;
1865  this->settings.current_env = address;/* set new current environment */
1866 }
1867 
1868 
1870  RexxString * name ) /* target label name */
1871 /******************************************************************************/
1872 /* Function: Signal to a computed label target */
1873 /******************************************************************************/
1874 {
1875  RexxInstruction *target = OREF_NULL; /* no target yet */
1876  RexxDirectory *labels = this->getLabels(); /* get the labels */
1877  if (labels != OREF_NULL) /* have labels? */
1878  {
1879  /* look up label and go to normal */
1880  /* signal processing */
1881  target = (RexxInstruction *)labels->at(name);
1882  }
1883  if (target == OREF_NULL) /* unknown label? */
1884  {
1885  /* raise an error */
1887  }
1888  this->signalTo(target); /* now switch to the label location */
1889 }
1890 
1891 
1893 /******************************************************************************/
1894 /* Function: Turn on the activations guarded state */
1895 /******************************************************************************/
1896 {
1897  /* currently in unguarded state? */
1898  if (this->object_scope == SCOPE_RELEASED)
1899  {
1900  /* not retrieved yet? */
1901  if (this->settings.object_variables == OREF_NULL)
1902  {
1903  /* get the object variables */
1905  }
1906  /* lock the variable dictionary */
1907  this->settings.object_variables->reserve(this->activity);
1908  /* set the state here also */
1909  this->object_scope = SCOPE_RESERVED;
1910  }
1911 }
1912 
1914 /******************************************************************************/
1915 /* Function: Return the current digits setting */
1916 /******************************************************************************/
1917 {
1918  return this->settings.numericSettings.digits;
1919 }
1920 
1922 /******************************************************************************/
1923 /* Function: Return the current fuzz setting */
1924 /******************************************************************************/
1925 {
1926  return this->settings.numericSettings.fuzz;
1927 }
1928 
1930 /******************************************************************************/
1931 /* Function: Return the current FORM setting */
1932 /******************************************************************************/
1933 {
1934  return this->settings.numericSettings.form;
1935 }
1936 
1941 {
1943 }
1944 
1945 void RexxActivation::setDigits(size_t digitsVal)
1946 /******************************************************************************/
1947 /* Function: Set a new digits setting */
1948 /******************************************************************************/
1949 {
1950  this->settings.numericSettings.digits = digitsVal;
1951 }
1952 
1957 {
1959 }
1960 
1961 
1962 
1963 void RexxActivation::setFuzz(size_t fuzzVal)
1964 /******************************************************************************/
1965 /* Function: Set a new FUZZ setting */
1966 /******************************************************************************/
1967 {
1968  this->settings.numericSettings.fuzz = fuzzVal;
1969 }
1970 
1975 {
1977 }
1978 
1979 
1980 
1981 void RexxActivation::setForm(bool formVal)
1982 /******************************************************************************/
1983 /* Function: Set the new current NUMERIC FORM setting */
1984 /******************************************************************************/
1985 {
1986  this->settings.numericSettings.form = formVal;
1987 }
1988 
1989 
1997 {
1998  return this; // I am my own grampa...I mean Rexx context.
1999 }
2000 
2001 
2009 {
2010  return this; // I am my own grampa...I mean Rexx context.
2011 }
2012 
2013 
2020 {
2021  return true;
2022 }
2023 
2024 
2031 {
2032  return &(this->settings.numericSettings);
2033 }
2034 
2035 
2043 {
2044  if (this->isInterpret())
2045  {
2046  return parent->getReceiver();
2047  }
2048  return receiver;
2049 }
2050 
2051 
2053  RexxString * condition) /* condition trapped */
2054 /******************************************************************************/
2055 /* Function: Return the current state for a trap as either ON, OFF, or DELAY */
2056 /******************************************************************************/
2057 {
2058  RexxString *state = OREF_OFF; /* default to OFF state */
2059  /* actually have any traps? */
2060  if (this->settings.traps != OREF_NULL)
2061  {
2062  /* see if this trap is enabled */
2063  RexxArray *traphandler = (RexxArray *)this->settings.traps->at(condition);
2064  if (traphandler != OREF_NULL) /* have a trap for this? */
2065  {
2066  /* get the trap state */
2067  state = (RexxString *)traphandler->get(2);
2068  }
2069  }
2070  return state; /* return this state */
2071 }
2072 
2073 
2075  RexxString * condition) /* condition trapped */
2076 /******************************************************************************/
2077 /* Function: Put a condition trap into the delay state. */
2078 /******************************************************************************/
2079 {
2080  this->checkTrapTable(); /* make sure we've got the tables */
2081  /* see if this one is enabled */
2082  RexxArray *traphandler = (RexxArray *)this->settings.traps->at(condition);
2083  if (traphandler != OREF_NULL) /* have a trap for this? */
2084  {
2085  traphandler->put(OREF_DELAY, 2); /* change the trap state */
2086  }
2087 }
2088 
2089 
2091  RexxString * condition) /* condition trapped */
2092 /******************************************************************************/
2093 /* Function: Remove a trap from the DELAY state */
2094 /******************************************************************************/
2095 {
2096  this->checkTrapTable(); /* make sure we've got the tables */
2097  /* see if this one is enabled */
2098  RexxArray *traphandler = (RexxArray *)this->settings.traps->at(condition);
2099  if (traphandler != OREF_NULL) /* have a trap for this? */
2100  {
2101  traphandler->put(OREF_ON, 2); /* change the trap state */
2102  }
2103 }
2104 
2105 
2106 bool RexxActivation::trap( /* trap a condition */
2107  RexxString * condition, /* condition to process */
2108  RexxDirectory * exception_object) /* associated condition object */
2109 /******************************************************************************/
2110 /* Function: Check the activation to see if this is trapping a condition. */
2111 /* For SIGNAL traps, control goes back to the point of the trap */
2112 /* via throw. For CALL ON traps, the condition is saved, and */
2113 /* the method returns true to indicate the trap was handled. */
2114 /******************************************************************************/
2115 {
2116  if (this->settings.flags&forwarded)
2117  {/* in the act of forwarding? */
2118  RexxActivationBase *activation = this->getPreviousStackFrame(); /* get the sender activation */
2119  /* have a predecessor? */
2120  while (activation != OREF_NULL && isOfClass(Activation, activation))
2121  {
2122  if (!activation->isForwarded()) /* non forwarded? */
2123  {
2124  /* pretend he is we */
2125  return activation->trap(condition, exception_object);
2126  }
2127  activation = activation->getPreviousStackFrame(); /* step to the next one */
2128  }
2129  return false; /* not really here, can't handle */
2130  }
2131  /* do we need to notify a message */
2132  /*obj? */
2133  if (this->objnotify != OREF_NULL && condition->strCompare(CHAR_SYNTAX))
2134  {
2135  /* yes, send error message and */
2136  /*condition object */
2137  this->objnotify->error(exception_object);
2138  }
2139  bool handled = false; /* not handled yet */
2140  RexxArray *traphandler = OREF_NULL; /* no traps to process yet */
2141  if (this->debug_pause)
2142  { /* working from the debug prompt? */
2143  /* non-terminal condition? */
2144  if (!condition->strCompare(CHAR_SYNTAX))
2145  {
2146  return false; /* flag as not-handled */
2147  }
2148  /* go display the messages */
2149  this->activity->displayDebug(exception_object);
2150  throw this; /* unwind and process the trap */
2151  }
2152  /* no trap table yet? */
2153  if (this->settings.traps == OREF_NULL)
2154  {
2155  return false; /* can't very well handle this! */
2156  }
2157  /* see if this one is enabled */
2158  traphandler = (RexxArray *)this->settings.traps->at(condition);
2159 
2160  if (traphandler == OREF_NULL)
2161  { /* not there? try for an ANY handler*/
2162  /* get this from the same table */
2163  traphandler = (RexxArray *)this->settings.traps->at(OREF_ANY);
2164  if (traphandler != OREF_NULL)
2165  { /* have an any handler? */
2166  /* get the handler info */
2167  RexxInstructionCallBase *handler = (RexxInstructionCallBase *)traphandler->get(1);
2168  /* condition not trappable with CALL?*/
2169  if (handler->isType(KEYWORD_CALL) &&
2170  (condition->strCompare(CHAR_SYNTAX) ||
2171  condition->strCompare(CHAR_NOVALUE) ||
2172  condition->strCompare(CHAR_LOSTDIGITS) ||
2173  condition->strCompare(CHAR_NOMETHOD) ||
2174  condition->strCompare(CHAR_NOSTRING)))
2175  {
2176  return false; /* not trapped */
2177  }
2178  }
2179  }
2180  /* if the condition is being trapped, do the CALL or SIGNAL */
2181  if (traphandler != OREF_NULL)
2182  { /* have a trap for this? */
2183  /* if this is a HALT */
2184  if (condition->strCompare(CHAR_HALT))
2185  {
2186  /* call the sys exit to clear it */
2187  this->activity->callHaltClearExit(this);
2188  }
2189  /* get the handler info */
2190  RexxInstructionCallBase *handler = (RexxInstructionCallBase *)traphandler->get(1);
2191  /* no condition queue yet? */
2192  if (this->condition_queue == OREF_NULL)
2193  {
2194  /* create a pending queue */
2195  this->condition_queue = new_queue();
2196  /* and a handler queue */
2197  this->handler_queue = new_queue();
2198  }
2199 
2200  RexxString *instruction = OREF_CALL;
2201  if (handler->isType(KEYWORD_SIGNAL))
2202  {
2203  instruction = OREF_SIGNAL; /* this is trapped by a SIGNAL */
2204  }
2205  /* add the instruction trap info */
2206  exception_object->put(instruction, OREF_INSTRUCTION);
2207  /* create a new condition object and */
2208  /* add the condition object to queue */
2209  this->condition_queue->addLast(exception_object);
2210  /* and the corresponding trap info */
2211  this->handler_queue->addLast(traphandler);
2212  this->pending_count++; /* bump pending condition count */
2213  // clear this from the activity if we're trapping this here
2215  /* is this a signal instruction */
2216  /* no the non-returnable PROPAGATE? */
2217  if (handler->isType(KEYWORD_SIGNAL))
2218  {
2219  /* not an Interpret instruction? */
2220  if (!this->isInterpret())
2221  {
2222  throw this; /* unwind and process the trap */
2223  }
2224  else
2225  { /* unwind interpret activations */
2226  /* merge the traps */
2227  this->parent->mergeTraps(this->condition_queue, this->handler_queue);
2228  this->parent->unwindTrap(this);/* go unwind this */
2229  }
2230  }
2231  else
2232  {
2233  handled = true; /* tell caller we're processing later*/
2234  /* tell clause boundary to process */
2235  this->settings.flags |= clause_boundary;
2236  }
2237  }
2238  return handled; /* let call know if we've handled */
2239 }
2240 
2241 
2251 {
2252  RexxObject *value = this->novalueHandler(name);
2253  // If the handler returns anything other than .nil, this is a
2254  // value
2255  if (value != TheNilObject)
2256  {
2257  return value;
2258  }
2259  // give any external novalue handler a chance at this
2260  if (!activity->callNovalueExit(this, name, value))
2261  {
2262  // set this variable to the object found in the engine
2263  variable->set(value);
2264  return value;
2265  }
2266  // raise novalue?
2267  if (novalueEnabled())
2268  {
2269  reportNovalue(name);
2270  }
2271 
2272  // the provided default value is the returned value
2273  return defaultValue;
2274 }
2275 
2276 
2277 
2279  RexxQueue * source_condition_queue, /* previous condition queue */
2280  RexxQueue * source_handler_queue ) /* current condition handlers queue */
2281 /******************************************************************************/
2282 /* Function: Merge a list of trapped conditions from an interpret into the */
2283 /* parent activation's queues. */
2284 /******************************************************************************/
2285 {
2286  if (source_condition_queue != OREF_NULL)
2287  {
2288  /* no condition queue yet? */
2289  if (this->condition_queue == OREF_NULL)
2290  {
2291  /* just copy over */
2292  this->condition_queue = source_condition_queue;
2293  /* ...both queues */
2294  this->handler_queue = source_handler_queue;
2295  }
2296  else
2297  {
2298  /* get the item count */
2299  size_t items = source_condition_queue->getSize();
2300  while (items--)
2301  {
2302  /* add to the end of the queue */
2303  this->handler_queue->addLast(source_handler_queue->pullRexx());
2304  /* move condition object to the end */
2305  this->condition_queue->addLast(source_condition_queue->pullRexx());
2306  }
2307  }
2308  /* reset the counter size */
2309  this->pending_count = this->condition_queue->getSize();
2310  }
2311 }
2312 
2313 
2315 /******************************************************************************/
2316 /* Function: Unwind a chain of interpret activations to process a SIGNAL ON */
2317 /* or PROPAGATE condition trap. This ensures that the SIGNAL */
2318 /* or PROPAGATE returns to the correct condition level */
2319 /******************************************************************************/
2320 {
2321  /* still an interpret level? */
2322  if (this->isInterpret())
2323  {
2324  /* merge the traps */
2325  this->parent->mergeTraps(this->condition_queue, this->handler_queue);
2326  this->parent->unwindTrap(child); /* unwind another level */
2327  }
2328  else /* reached the "parent" level */
2329  {
2330  /* pull back the settings */
2331  child->putSettings(this->settings);
2332  throw this; /* unwind and process the trap */
2333  }
2334 }
2335 
2336 
2338 /******************************************************************************/
2339 /* Function: Retrieve the activation that activated this activation (whew) */
2340 /******************************************************************************/
2341 {
2342  /* get the sender from the activity */
2343  RexxActivationBase *_sender = this->getPreviousStackFrame();
2344  /* spin down to non-native activation*/
2345  while (_sender != OREF_NULL && isOfClass(NativeActivation, _sender))
2346  {
2347  _sender = _sender->getPreviousStackFrame();
2348  }
2349  return(RexxActivation *)_sender; /* return that activation */
2350 }
2351 
2353 /******************************************************************************/
2354 /* Function: Translate and interpret a string of data as a piece of REXX */
2355 /* code within the current program context. */
2356 /******************************************************************************/
2357 {
2358  ActivityManager::currentActivity->checkStackSpace(); /* have enough stack space? */
2359  /* translate the code */
2360  RexxCode * newCode = this->code->interpret(codestring, this->current->getLineNumber());
2361  /* create a new activation */
2362  RexxActivation *newActivation = ActivityManager::newActivation(this->activity, this, newCode, INTERPRET);
2363  this->activity->pushStackFrame(newActivation); /* push on the activity stack */
2364  ProtectedObject r;
2365  /* run the internal routine on the */
2366  /* new activation */
2367  newActivation->run(OREF_NULL, OREF_NULL, arglist, argcount, OREF_NULL, r);
2368 }
2369 
2370 
2371 void RexxActivation::debugInterpret( /* interpret interactive debug input */
2372  RexxString * codestring) /* entered instruction */
2373 /******************************************************************************/
2374 /* Function: Interpret a string created for interactive debug */
2375 /******************************************************************************/
2376 {
2377  this->debug_pause = true; /* now in debug pause */
2378  try
2379  {
2380  /* translate the code */
2381  RexxCode *newCode = this->code->interpret(codestring, this->current->getLineNumber());
2382  /* create a new activation */
2383  RexxActivation *newActivation = ActivityManager::newActivation(this->activity, this, newCode, DEBUGPAUSE);
2384  this->activity->pushStackFrame(newActivation); /* push on the activity stack */
2385  ProtectedObject r;
2386  /* run the internal routine on the */
2387  /* new activation */
2388  newActivation->run(receiver, settings.msgname, arglist, argcount, OREF_NULL, r);
2389  // turn this off when done executing
2390  this->debug_pause = false;
2391  }
2392  catch (RexxActivation *t)
2393  {
2394  // turn this off unconditionally for any errors
2395  // if we're not the target of this throw, we've already been unwound
2396  // keep throwing this until it reaches the target activation.
2397  if (t != this )
2398  {
2399  throw;
2400  }
2401  }
2402 }
2403 
2404 RexxObject * RexxActivation::rexxVariable( /* retrieve a program entry */
2405  RexxString * name ) /* target program entry name */
2406 /******************************************************************************/
2407 /* Function: Retrieve a REXX defined "dot" environment variable */
2408 /******************************************************************************/
2409 {
2410  if (name->strCompare(CHAR_METHODS)) /* is this ".methods" */
2411  {
2412  /* get the methods directory */
2413  return(RexxObject *)this->settings.parent_code->getMethods();
2414  }
2415  else if (name->strCompare(CHAR_ROUTINES)) /* is this ".routines" */
2416  {
2417  /* get the methods directory */
2418  return(RexxObject *)this->settings.parent_code->getRoutines();
2419  }
2420  else if (name->strCompare(CHAR_RS)) /* command return status (".rs")? */
2421  {
2422  if (this->settings.flags&return_status_set)
2423  {
2424  /* returned as an integer object */
2425  return new_integer(this->settings.return_status);
2426  }
2427  else /* just return the name */
2428  {
2429  return name->concatToCstring(".");
2430  }
2431  }
2432  else if (name->strCompare(CHAR_LINE)) /* current line (".line")? */
2433  {
2434  // if this is an interpret, we need to report the line number of
2435  // the context that calls the interpret.
2436  if (this->isInterpret())
2437  {
2438  return parent->rexxVariable(name);
2439  }
2440  else
2441  {
2442 
2443  return new_integer(this->current->getLineNumber());
2444  }
2445  }
2446  else if (name->strCompare(CHAR_CONTEXT)) /* current execution context (".context")? */
2447  {
2448  // if this is an interpret, we need to report the line number of
2449  // the context that calls the interpret.
2450  if (this->isInterpret())
2451  {
2452  return parent->rexxVariable(name);
2453  }
2454  else
2455  {
2456  // retrieve the context object (potentially creating it on the first request)
2457  return getContextObject();
2458  }
2459  }
2460  return OREF_NULL; // not recognized
2461 }
2462 
2463 
2470 {
2471  // the context object is created on demand...much of the time, this
2472  // is not needed for an actvation
2473  if (contextObject == OREF_NULL)
2474  {
2475  contextObject = new RexxContext(this);
2476  }
2477  return contextObject;
2478 }
2479 
2480 
2487 {
2488  // if this is an interpret, we need to report the line number of
2489  // the context that calls the interpret.
2490  if (this->isInterpret())
2491  {
2492  return parent->getContextLine();
2493  }
2494  else
2495  {
2496 
2497  return new_integer(this->current->getLineNumber());
2498  }
2499 }
2500 
2501 
2508 {
2509  // if this is an interpret, we need to report the line number of
2510  // the context that calls the interpret.
2511  if (this->isInterpret())
2512  {
2513  return parent->getContextLineNumber();
2514  }
2515  else
2516  {
2517 
2518  return this->current->getLineNumber();
2519  }
2520 }
2521 
2522 
2529 {
2530  if (this->settings.flags&return_status_set)
2531  {
2532  /* returned as an integer object */
2533  return new_integer(this->settings.return_status);
2534  }
2535  else
2536  {
2537  return TheNilObject;
2538  }
2539 }
2540 
2541 
2555  size_t _argcount, RexxString * calltype, int order, ProtectedObject &_result)
2556 {
2557  unsigned short position; /* located macro search position */
2558  const char *macroName = target->getStringData(); /* point to the string data */
2559  /* did we find this one? */
2560  if (RexxQueryMacro(macroName, &position) == 0)
2561  {
2562  /* but not at the right time? */
2563  if (order == MS_PREORDER && position == RXMACRO_SEARCH_AFTER)
2564  {
2565  return false; /* didn't really find this */
2566  }
2567  /* unflatten the method now */
2568  RoutineClass *routine = getMacroCode(target);
2569  // not restoreable is a call failure
2570  if (routine == OREF_NULL)
2571  {
2572  return false;
2573  }
2574  /* run as a call */
2575  routine->call(activity, target, _arguments, _argcount, calltype, OREF_NULL, EXTERNALCALL, _result);
2576  // merge (class) definitions from macro with current settings
2578  return true; /* return success we found it flag */
2579  }
2580  return false; /* nope, nothing to find here */
2581 }
2582 
2583 
2598  RexxString *calltype, ProtectedObject &resultObj)
2599 {
2600  /* get the arguments array */
2601  RexxObject **_arguments = _stack->arguments(_argcount);
2602 
2603  // Step 1: Check the global functions directory
2604  // this is actually considered part of the built-in functions, but these are
2605  // written in ooRexx. The names are also case sensitive
2606  RoutineClass *routine = (RoutineClass *)TheFunctionsDirectory->get(target);
2607  if (routine != OREF_NULL) /* not found yet? */
2608  {
2609  // call and return the result
2610  routine->call(this->activity, target, _arguments, _argcount, calltype, OREF_NULL, EXTERNALCALL, resultObj);
2611  return(RexxObject *)resultObj;
2612  }
2613 
2614  // Step 2: Check for a ::ROUTINE definition in the local context
2615  routine = this->settings.parent_code->findRoutine(target);
2616  if (routine != OREF_NULL)
2617  {
2618  // call and return the result
2619  routine->call(this->activity, target, _arguments, _argcount, calltype, OREF_NULL, EXTERNALCALL, resultObj);
2620  return(RexxObject *)resultObj;
2621  }
2622  // Step 2a: See if the function call exit fields this one
2623  if (!activity->callObjectFunctionExit(this, target, calltype, resultObj, _arguments, _argcount))
2624  {
2625  return(RexxObject *)resultObj;
2626  }
2627 
2628  // Step 2b: See if the function call exit fields this one
2629  if (!activity->callFunctionExit(this, target, calltype, resultObj, _arguments, _argcount))
2630  {
2631  return(RexxObject *)resultObj;
2632  }
2633 
2634  // Step 3: Perform all platform-specific searches
2635  if (SystemInterpreter::invokeExternalFunction(this, this->activity, target, _arguments, _argcount, calltype, resultObj))
2636  {
2637  return(RexxObject *)resultObj;
2638  }
2639 
2640  // Step 4: Check scripting exit, which is after most of the checks
2641  if (!activity->callScriptingExit(this, target, calltype, resultObj, _arguments, _argcount))
2642  {
2643  return(RexxObject *)resultObj;
2644  }
2645 
2646  // if it's made it through all of these steps without finding anything, we
2647  // finally have a routine non found situation
2649  return OREF_NULL; // prevent compile error
2650 }
2651 
2652 
2653 
2654 
2669  RexxString * target, /* Name of external function */
2670  RexxObject ** _arguments, /* Argument array */
2671  size_t _argcount, /* number of arguments in the call */
2672  RexxString * calltype, /* Type of call */
2673  ProtectedObject &resultObj) /* Result of function call */
2674 /******************************************************************************/
2675 /* Function: Call a rexx protram as an external routine */
2676 /******************************************************************************/
2677 {
2678  /* Get full name including path */
2679  RexxString *filename = resolveProgramName(target);
2680  if (filename != OREF_NULL) /* found something? */
2681  {
2682  this->stack.push(filename); /* protect the file name here */
2683  // try for a saved program or translate anew.
2684  RoutineClass *routine = RoutineClass::fromFile(filename);
2685  this->stack.pop(); /* remove the protected name */
2686  if (routine == OREF_NULL) /* Do we have a method??? */
2687  {
2688  return false; /* No, return not found */
2689  }
2690  else /* Try to run method */
2691  {
2692  ProtectedObject p(routine);
2693  /* run as a call */
2694  routine->call(this->activity, target, _arguments, _argcount, calltype, this->settings.current_env, EXTERNALCALL, resultObj);
2695  /* now merge all of the public info */
2697  return true; /* Return routine found flag */
2698  }
2699  }
2700  else
2701  {
2702  return false; /* this wasn't found */
2703  }
2704 }
2705 
2706 
2715 {
2716  RXSTRING macroImage;
2717  RoutineClass * macroRoutine = OREF_NULL;
2718 
2719  macroImage.strptr = NULL;
2720  const char *name = macroName->getStringData();
2721  int rc;
2722  {
2723  UnsafeBlock releaser;
2724 
2725  rc = RexxResolveMacroFunction(name, &macroImage);
2726  }
2727 
2728  if (rc == 0)
2729  {
2730  macroRoutine = RoutineClass::restore(&macroImage, macroName);
2731  // return the allocated buffer
2732  if (macroImage.strptr != NULL)
2733  {
2735  }
2736  }
2737  return macroRoutine;
2738 }
2739 
2740 
2750 {
2751  return code->resolveProgramName(activity, name);
2752 }
2753 
2754 
2763 {
2764  RexxClass *classObject = getSourceObject()->findClass(name);
2765  // we need to filter this to always return a class object
2766  if (classObject != OREF_NULL && classObject->isInstanceOf(TheClassClass))
2767  {
2768  return classObject;
2769  }
2770  return OREF_NULL;
2771 }
2772 
2773 
2782 {
2783  // if not an interpret, then resolve directly.
2785  {
2786  return getSourceObject()->findClass(name);
2787  }
2788  else
2789  {
2790  // otherwise, send this up the call chain and resolve in the
2791  // original source context
2792  return parent->resolveDotVariable(name);
2793  }
2794 }
2795 
2796 
2806 {
2807  // this will cause the correct location to be used for error reporting
2808  this->current = instruction;
2809 
2810  // the loading/merging is done by the source object
2811  return getSourceObject()->loadRequires(activity, target);
2812 }
2813 
2814 
2824 {
2825  // this will cause the correct location to be used for error reporting
2826  this->current = instruction;
2827  // have the package manager resolve the package
2829 }
2830 
2831 
2845  size_t _argcount, RexxExpressionStack *_stack, ProtectedObject &returnObject)
2846 {
2847  RexxActivation * newActivation; /* new activation for call */
2848  size_t lineNum; /* line number of the call */
2849  RexxObject ** _arguments = _stack->arguments(_argcount);
2850 
2851  lineNum = this->current->getLineNumber(); /* get the current line number */
2852  /* initialize the SIGL variable */
2853  this->setLocalVariable(OREF_SIGL, VARIABLE_SIGL, new_integer(lineNum));
2854  /* create a new activation */
2855  newActivation = ActivityManager::newActivation(this->activity, this, this->settings.parent_code, INTERNALCALL);
2856 
2857  this->activity->pushStackFrame(newActivation); /* push on the activity stack */
2858  /* run the internal routine on the */
2859  /* new activation */
2860  return newActivation->run(receiver, name, _arguments, _argcount, target, returnObject);
2861 }
2862 
2875  RexxDirectory *conditionObj, ProtectedObject &resultObj)
2876 {
2877 
2878  this->stack.push(conditionObj); /* protect the condition object */
2879  size_t lineNum = this->current->getLineNumber(); /* get the current line number */
2880  /* initialize the SIGL variable */
2881  this->setLocalVariable(OREF_SIGL, VARIABLE_SIGL, new_integer(lineNum));
2882  /* create a new activation */
2884  /* set the new condition object */
2885  newActivation->setConditionObj(conditionObj);
2886  this->activity->pushStackFrame(newActivation); /* push on the activity stack */
2887  /* run the internal routine on the */
2888  /* new activation */
2889  return newActivation->run(OREF_NULL, name, NULL, 0, target, resultObj);
2890 }
2891 
2892 
2893 
2895 /******************************************************************************/
2896 /* Function: Wait for a variable in a guard expression to get updated. */
2897 /******************************************************************************/
2898 {
2899  int initial_state = this->object_scope; /* save the initial state */
2900  /* have the scope reserved? */
2901  if (this->object_scope == SCOPE_RESERVED)
2902  {
2903  /* tell the receiver to release this */
2904  this->settings.object_variables->release(this->activity);
2905  /* and change our local state */
2906  this->object_scope = SCOPE_RELEASED; /* do an assignment! */
2907  }
2908  this->activity->guardWait(); /* wait on a variable inform event */
2909  /* did we release the scope? */
2910  if (initial_state == SCOPE_RESERVED)
2911  {
2912  /* tell the receiver to reserve this */
2913  this->settings.object_variables->reserve(this->activity);
2914  /* and change our local state */
2915  this->object_scope = SCOPE_RESERVED; /* do an assignment! */
2916  }
2917 }
2918 
2919 
2926 {
2927  return formatTrace(this->current, getSourceObject());
2928 }
2929 
2930 
2932 /******************************************************************************/
2933 /* Function: Retrieve the current activation timestamp, retrieving a new */
2934 /* timestamp if this is the first call for a clause */
2935 /******************************************************************************/
2936 {
2937  /* not a valid time stamp? */
2938  if (!this->settings.timestamp.valid)
2939  {
2940  // IMPORTANT: If a time call resets the elapsed time clock, we don't
2941  // clear the value out. The time needs to stay valid until the clause is
2942  // complete. The time stamp value that needs to be used for the next
2943  // elapsed time call is the timstamp that was valid at the point of the
2944  // last call, which is our current old invalid one. So, we need to grab
2945  // that value and set the elapsed time start point, then clear the flag
2946  // so that it will remain current.
2947  if (isElapsedTimerReset())
2948  {
2951  }
2952  /* get a fresh time stamp */
2954  /* got a new one */
2955  this->settings.timestamp.valid = true;
2956  }
2957  /* return the current time */
2958  return this->settings.timestamp;
2959 }
2960 
2961 
2963 /******************************************************************************/
2964 /* Function: Retrieve the current elapsed time counter start time, starting */
2965 /* the counter from the current time stamp if this is the first */
2966 /* call */
2967 /******************************************************************************/
2968 {
2969  // no active elapsed time clock yet?
2970  if (this->settings.elapsed_time == 0)
2971  {
2972 
2974  }
2975  return settings.elapsed_time;
2976 }
2977 
2978 
2979 void RexxActivation::resetElapsed() /* reset activation elapsed time */
2980 /******************************************************************************/
2981 /* Function: Retrieve the current elapsed time counter start time, starting */
2982 /* the counter from the current time stamp if this is the first */
2983 /* call */
2984 /******************************************************************************/
2985 {
2986  // Just invalidate the flat so that we'll refresh this the next time we
2987  // obtain a new timestamp value.
2989 }
2990 
2991 
2992 #define DEFAULT_MIN 0 /* default random minimum value */
2993 #define DEFAULT_MAX 999 /* default random maximum value */
2994 #define MAX_DIFFERENCE 999999999 /* max spread between min and max */
2995 
2996 
2998 {
2999  /* currently in an internal routine */
3000  /* or interpret instruction? */
3001  if (this->isInternalLevelCall())
3002  {
3003  /* forward along */
3004  return this->parent->getRandomSeed(seed);
3005  }
3006  /* have a seed supplied? */
3007  if (seed != OREF_NULL)
3008  {
3009  wholenumber_t seed_value = seed->getValue(); /* get the value */
3010  if (seed_value < 0) /* negative value? */
3011  {
3012  /* got an error */
3014  }
3015  /* set the saved seed value */
3016  this->random_seed = seed_value;
3017  /* flip all of the bits */
3018  this->random_seed = ~this->random_seed;
3019  /* randomize the seed number a bit */
3020  for (size_t i = 0; i < 13; i++)
3021  {
3022  /* scramble the seed a bit */
3023  this->random_seed = RANDOMIZE(this->random_seed);
3024  }
3025  }
3026  /* step the randomization */
3027  this->random_seed = RANDOMIZE(this->random_seed);
3028  /* set the seed at the activity level*/
3029  this->activity->setRandomSeed(this->random_seed);
3030  return this->random_seed; /* return the seed value */
3031 }
3032 
3033 
3035  RexxInteger * randmin, /* RANDOM minimum range */
3036  RexxInteger * randmax, /* RANDOM maximum range */
3037  RexxInteger * randseed ) /* RANDOM seed */
3038 /******************************************************************************/
3039 /* Function: Process the random function, using the current activation */
3040 /* seed value. */
3041 /******************************************************************************/
3042 {
3043  size_t i; /* loop counter */
3044 
3045  /* go get the seed value */
3046  uint64_t seed = this->getRandomSeed(randseed);
3047 
3048  wholenumber_t minimum = DEFAULT_MIN; /* get the default MIN value */
3049  wholenumber_t maximum = DEFAULT_MAX; /* get the default MAX value */
3050  /* minimum specified? */
3051  if (randmin != OREF_NULL)
3052  {
3053  /* no maximum value specified */
3054  /* and no seed specified */
3055  if ((randmax == OREF_NULL) && (randseed == OREF_NULL))
3056  {
3057  maximum = randmin->getValue(); /* this is actually a max value */
3058  }
3059  /* minimum value specified */
3060  /* maximum value not specified */
3061  /* seed specified */
3062  else if ((randmin != OREF_NULL) && (randmax == OREF_NULL) && (randseed != OREF_NULL))
3063  {
3064  minimum = randmin->getValue();
3065  }
3066  else
3067  {
3068  minimum = randmin->getValue(); /* give both max and min values */
3069  maximum = randmax->getValue();
3070  }
3071  }
3072  else if (randmax != OREF_NULL) /* only given a maximum? */
3073  {
3074  maximum = randmax->getValue(); /* use the supplied maximum */
3075  }
3076 
3077  if (maximum < minimum) /* range problem? */
3078  {
3079  /* this is an error */
3080  reportException(Error_Incorrect_call_random, randmin, randmax);
3081  }
3082  /* too big of a spread ? */
3083  if (maximum - minimum > MAX_DIFFERENCE)
3084  {
3085  /* this is an error */
3087  }
3088 
3089  /* have real work to do? */
3090  if (minimum != maximum)
3091  {
3092  // this will invert the bits of the value
3093  uint64_t work = 0; /* start with zero */
3094  for (i = 0; i < sizeof(uint64_t) * 8; i++)
3095  {
3096  work <<= 1; /* shift working num left one */
3097  /* add in next seed bit value */
3098  work = work | (seed & 0x01LL);
3099  seed >>= 1; /* shift off the right most seed bit */
3100  }
3101  /* adjust for requested range */
3102  minimum += (wholenumber_t)(work % (uint64_t)(maximum - minimum + 1));
3103  }
3104  return new_integer(minimum); /* return the random number */
3105 }
3106 
3107 static const char * trace_prefix_table[] = { /* table of trace prefixes */
3108  "*-*", /* TRACE_PREFIX_CLAUSE */
3109  "+++", /* TRACE_PREFIX_ERROR */
3110  ">>>", /* TRACE_PREFIX_RESULT */
3111  ">.>", /* TRACE_PREFIX_DUMMY */
3112  ">V>", /* TRACE_PREFIX_VARIABLE */
3113  ">E>", /* TRACE_PREFIX_DOTVARIABLE */
3114  ">L>", /* TRACE_PREFIX_LITERAL */
3115  ">F>", /* TRACE_PREFIX_FUNCTION */
3116  ">P>", /* TRACE_PREFIX_PREFIX */
3117  ">O>", /* TRACE_PREFIX_OPERATOR */
3118  ">C>", /* TRACE_PREFIX_COMPOUND */
3119  ">M>", /* TRACE_PREFIX_MESSAGE */
3120  ">A>", /* TRACE_PREFIX_ARGUMENT */
3121  ">=>", /* TRACE_PREFIX_ASSIGNMENT */
3122  ">I>", /* TRACE_PREFIX_INVOCATION */
3123 };
3124 
3125  /* extra space required to format a */
3126  /* result line. This overhead is */
3127  /* 6 leading spaces for the line */
3128  /* number, + 1 space + length of the */
3129  /* message prefix (3) + 1 space + */
3130  /* 2 for an indent + 2 for the */
3131  /* quotes surrounding the value */
3132 #define TRACE_OVERHEAD 15
3133  /* overhead for a traced instruction */
3134  /* (6 digit line number, blank, */
3135  /* 3 character prefix, and a blank */
3136 #define INSTRUCTION_OVERHEAD 11
3137 #define LINENUMBER 6 /* size of a line number */
3138 #define PREFIX_OFFSET (LINENUMBER + 1) /* location of the prefix field */
3139 #define PREFIX_LENGTH 3 /* length of the prefix flag */
3140 #define INDENT_SPACING 2 /* spaces per indentation amount */
3141 // over head for adding quotes
3142 #define QUOTES_OVERHEAD 2
3143 
3148 {
3149  // since we're advertising the entry location up front, we want to disable
3150  // the normal trace-turn on notice. We'll get one or the other, but not
3151  // both
3152  this->settings.flags |= source_traced;
3153 
3154  RexxArray *info = OREF_NULL;
3155 
3156  if (isMethod())
3157  {
3158  info = new_array(getMessageName(), scope->getId(), getPackage()->getName());
3159  }
3160  else
3161  {
3162  info = new_array(getExecutable()->getName(), getPackage()->getName());
3163  }
3164  ProtectedObject p(info);
3165 
3167  p = message;
3168 
3169  /* get a string large enough to */
3170  size_t outlength = message->getLength() + INSTRUCTION_OVERHEAD;
3171  RexxString *buffer = raw_string(outlength); /* get an output string */
3172  /* insert the leading blanks */
3173  buffer->set(0, ' ', INSTRUCTION_OVERHEAD);
3174  /* add the trace prefix */
3176  /* copy the string value */
3177  buffer->put(INSTRUCTION_OVERHEAD, message->getStringData(), message->getLength());
3178  /* write out the line */
3179  activity->traceOutput(this, buffer);
3180 }
3181 
3182 
3183 void RexxActivation::traceValue( /* trace an intermediate value */
3184  RexxObject * value, /* value to trace */
3185  int prefix ) /* traced result type */
3186 /******************************************************************************/
3187 /* Function: Trace an intermediate value or instruction result value */
3188 /******************************************************************************/
3189 {
3190  /* tracing currently suppressed or */
3191  /* no value was received? */
3192  if (this->settings.flags&trace_suppress || this->debug_pause || value == OREF_NULL)
3193  {
3194  return; /* just ignore this call */
3195  }
3196 
3197  if (!this->code->isTraceable()) /* if we don't have real source */
3198  {
3199  return; /* just ignore for this */
3200  }
3201  /* get the string version */
3202  RexxString *stringvalue = value->stringValue();
3203  /* get a string large enough to */
3204  size_t outlength = stringvalue->getLength() + TRACE_OVERHEAD + this->settings.traceindent * INDENT_SPACING;
3205  RexxString *buffer = raw_string(outlength); /* get an output string */
3206  ProtectedObject p(buffer);
3207  /* insert the leading blanks */
3208  buffer->set(0, ' ', TRACE_OVERHEAD + this->settings.traceindent * INDENT_SPACING);
3209  /* add the trace prefix */
3211  /* add a quotation mark */
3212  buffer->putChar(TRACE_OVERHEAD - 2 + this->settings.traceindent * INDENT_SPACING, '\"');
3213  /* copy the string value */
3214  buffer->put(TRACE_OVERHEAD - 1 + this->settings.traceindent * INDENT_SPACING, stringvalue->getStringData(), stringvalue->getLength());
3215  buffer->putChar(outlength - 1, '\"');/* add the trailing quotation mark */
3216  /* write out the line */
3217  this->activity->traceOutput(this, buffer);
3218 }
3219 
3220 
3232 void RexxActivation::traceTaggedValue(int prefix, const char *tagPrefix, bool quoteTag,
3233  RexxString *tag, const char *marker, RexxObject * value)
3234 {
3235  // the trace settings would normally require us to trace this, but there are conditions
3236  // where we just skip doing this anyway.
3237  if (this->settings.flags&trace_suppress || this->debug_pause || value == OREF_NULL || !code->isTraceable())
3238  {
3239  return;
3240  }
3241 
3242  // get the string value from the traced object.
3243  RexxString *stringVal = value->stringValue();
3244 
3245  // now calculate the length of the traced string
3246  stringsize_t outLength = tag->getLength() + stringVal->getLength();
3247  // these are fixed overheads
3248  outLength += TRACE_OVERHEAD + strlen(marker);
3249  // now the indent spacing
3250  outLength += this->settings.traceindent * INDENT_SPACING;
3251  // now other conditionals
3252  outLength += quoteTag ? QUOTES_OVERHEAD : 0;
3253  // this is usually null, but dot variables add a "." to the tag.
3254  outLength += tagPrefix == NULL ? 0 : strlen(tagPrefix);
3255 
3256  // now get a buffer to write this out into
3257  RexxString *buffer = raw_string(outLength);
3258  ProtectedObject p(buffer);
3259 
3260  // get a cursor for filling in the formatted data
3261  stringsize_t dataOffset = TRACE_OVERHEAD + this->settings.traceindent * INDENT_SPACING - 2;
3262  /* insert the leading blanks */
3263  buffer->set(0, ' ', TRACE_OVERHEAD + this->settings.traceindent * INDENT_SPACING);
3264  /* add the trace prefix */
3266 
3267  // if this is a quoted tag (operators do this), add quotes before coping the tag
3268  if (quoteTag)
3269  {
3270  buffer->putChar(dataOffset, '\"');
3271  dataOffset++;
3272  }
3273  // is the tag prefixed? Add this before the name
3274  if (tagPrefix != NULL)
3275  {
3276  stringsize_t prefixLength = strlen(tagPrefix);
3277  buffer->put(dataOffset, tagPrefix, prefixLength);
3278  dataOffset += prefixLength;
3279  }
3280 
3281  // add in the tag name
3282  buffer->put(dataOffset, tag);
3283  dataOffset += tag->getLength();
3284 
3285  // might need a closing quote.
3286  if (quoteTag)
3287  {
3288  buffer->putChar(dataOffset, '\"');
3289  dataOffset++;
3290  }
3291 
3292  // now add the data marker
3293  buffer->put(dataOffset, marker, strlen(marker));
3294  dataOffset += strlen(marker);
3295 
3296  // the leading quote around the value
3297  buffer->putChar(dataOffset, '\"');
3298  dataOffset++;
3299 
3300  // the traced value
3301  buffer->put(dataOffset, stringVal);
3302  dataOffset += stringVal->getLength();
3303 
3304  // and finally, the trailing quote
3305  buffer->putChar(dataOffset, '\"');
3306  dataOffset++;
3307  /* write out the line */
3308  this->activity->traceOutput(this, buffer);
3309 }
3310 
3311 
3323 void RexxActivation::traceOperatorValue(int prefix, const char *tag, RexxObject *value)
3324 {
3325  // the trace settings would normally require us to trace this, but there are conditions
3326  // where we just skip doing this anyway.
3327  if (this->settings.flags&trace_suppress || this->debug_pause || value == OREF_NULL || !code->isTraceable())
3328  {
3329  return;
3330  }
3331 
3332  // get the string value from the traced object.
3333  RexxString *stringVal = value->stringValue();
3334 
3335  // now calculate the length of the traced string
3336  stringsize_t outLength = strlen(tag) + stringVal->getLength();
3337  // these are fixed overheads
3338  outLength += TRACE_OVERHEAD + strlen(VALUE_MARKER);
3339  // now the indent spacing
3340  outLength += this->settings.traceindent * INDENT_SPACING;
3341  // now other conditionals
3342  outLength += QUOTES_OVERHEAD;
3343 
3344  // now get a buffer to write this out into
3345  RexxString *buffer = raw_string(outLength);
3346  ProtectedObject p(buffer);
3347 
3348  // get a cursor for filling in the formatted data
3349  stringsize_t dataOffset = TRACE_OVERHEAD + this->settings.traceindent * INDENT_SPACING - 2;
3350  /* insert the leading blanks */
3351  buffer->set(0, ' ', TRACE_OVERHEAD + this->settings.traceindent * INDENT_SPACING);
3352  /* add the trace prefix */
3354 
3355  // operators are quoted.
3356  buffer->putChar(dataOffset, '\"');
3357  dataOffset++;
3358 
3359  // add in the tag name
3360  buffer->put(dataOffset, tag, strlen(tag));
3361  dataOffset += strlen(tag);
3362 
3363  // need a closing quote.
3364  buffer->putChar(dataOffset, '\"');
3365  dataOffset++;
3366 
3367  // now add the data marker
3368  buffer->put(dataOffset, VALUE_MARKER, strlen(VALUE_MARKER));
3369  dataOffset += strlen(VALUE_MARKER);
3370 
3371  // the leading quote around the value
3372  buffer->putChar(dataOffset, '\"');
3373  dataOffset++;
3374 
3375  // the traced value
3376  buffer->put(dataOffset, stringVal);
3377  dataOffset += stringVal->getLength();
3378 
3379  // and finally, the trailing quote
3380  buffer->putChar(dataOffset, '\"');
3381  dataOffset++;
3382  /* write out the line */
3383  this->activity->traceOutput(this, buffer);
3384 }
3385 
3386 
3397 void RexxActivation::traceCompoundValue(int prefix, RexxString *stemName, RexxObject **tails, size_t tailCount,
3398  RexxCompoundTail *tail)
3399 {
3400  traceCompoundValue(TRACE_PREFIX_COMPOUND, stemName, tails, tailCount, VALUE_MARKER, tail->createCompoundName(stemName));
3401 }
3402 
3403 
3414 void RexxActivation::traceCompoundValue(int prefix, RexxString *stemName, RexxObject **tails, size_t tailCount, const char *marker,
3415  RexxObject * value)
3416 {
3417  // the trace settings would normally require us to trace this, but there are conditions
3418  // where we just skip doing this anyway.
3419  if (this->settings.flags&trace_suppress || this->debug_pause || value == OREF_NULL || !code->isTraceable())
3420  {
3421  return;
3422  }
3423 
3424  // get the string value from the traced object.
3425  RexxString *stringVal = value->stringValue();
3426 
3427  // now calculate the length of the traced string
3428  stringsize_t outLength = stemName->getLength() + stringVal->getLength();
3429 
3430  // build an unresolved tail name
3431  RexxCompoundTail tail(tails, tailCount, false);
3432 
3433  outLength += tail.getLength();
3434 
3435  // add in the number of added dots
3436  outLength += tailCount - 1;
3437 
3438  // these are fixed overheads
3439  outLength += TRACE_OVERHEAD + strlen(marker);
3440  // now the indent spacing
3441  outLength += this->settings.traceindent * INDENT_SPACING;
3442 
3443  // now get a buffer to write this out into
3444  RexxString *buffer = raw_string(outLength);
3445  ProtectedObject p(buffer);
3446 
3447  // get a cursor for filling in the formatted data
3448  stringsize_t dataOffset = TRACE_OVERHEAD + this->settings.traceindent * INDENT_SPACING - 2;
3449  /* insert the leading blanks */
3450  buffer->set(0, ' ', TRACE_OVERHEAD + this->settings.traceindent * INDENT_SPACING);
3451  /* add the trace prefix */
3453 
3454  // add in the stem name
3455  buffer->put(dataOffset, stemName);
3456  dataOffset += stemName->getLength();
3457 
3458  // copy the tail portion of the compound name
3459  buffer->put(dataOffset, tail.getTail(), tail.getLength());
3460  dataOffset += tail.getLength();
3461 
3462  // now add the data marker
3463  buffer->put(dataOffset, marker, strlen(marker));
3464  dataOffset += strlen(marker);
3465 
3466  // the leading quote around the value
3467  buffer->putChar(dataOffset, '\"');
3468  dataOffset++;
3469 
3470  // the traced value
3471  buffer->put(dataOffset, stringVal);
3472  dataOffset += stringVal->getLength();
3473 
3474  // and finally, the trailing quote
3475  buffer->putChar(dataOffset, '\"');
3476  dataOffset++;
3477  /* write out the line */
3478  this->activity->traceOutput(this, buffer);
3479 }
3480 
3481 
3483 /******************************************************************************/
3484 /* Function: Trace the source string at debug mode start */
3485 /******************************************************************************/
3486 {
3487  /* already traced? */
3488  if (this->settings.flags&source_traced)
3489  {
3490  return; /* don't do it again */
3491  }
3492  /* tag this as traced */
3493  this->settings.flags |= source_traced;
3494  /* get the string version */
3495  RexxString *string = this->sourceString(); /* get the source string */
3496  /* get a string large enough to */
3497  size_t outlength = string->getLength() + INSTRUCTION_OVERHEAD + 2;
3498  RexxString *buffer = raw_string(outlength); /* get an output string */
3499  /* insert the leading blanks */
3500  buffer->set(0, ' ', INSTRUCTION_OVERHEAD);
3501  /* add the trace prefix */
3503  /* add a quotation mark */
3504  buffer->putChar(INSTRUCTION_OVERHEAD, '\"');
3505  /* copy the string value */
3506  buffer->put(INSTRUCTION_OVERHEAD + 1, string->getStringData(), string->getLength());
3507  buffer->putChar(outlength - 1, '\"');/* add the trailing quotation mark */
3508  /* write out the line */
3509  this->activity->traceOutput(this, buffer);
3510 }
3511 
3512 
3514  RexxInstruction * instruction, /* instruction to trace */
3515  RexxSource * _source ) /* program source */
3516 /******************************************************************************/
3517 /* Function: Format a source line for traceback or tracing */
3518 /******************************************************************************/
3519 {
3520  if (instruction == OREF_NULL) /* no current instruction? */
3521  {
3522  return OREF_NULL; /* nothing to trace here */
3523  }
3524  // get the instruction location
3525  SourceLocation location = instruction->getLocation();
3526  /* extract the source string */
3527  /* (formatted for tracing) */
3529  {
3530  return _source->traceBack(this, location, this->settings.traceindent, true);
3531  }
3532  else
3533  {
3534  return _source->traceBack(this, location, MAX_TRACEBACK_INDENT, true);
3535  }
3536 }
3537 
3538  /* process clause boundary stuff */
3540 /******************************************************************************/
3541 /* Function: Handle all clause boundary processing (raising of halt */
3542 /* conditions, turning on of external traces, and calling of halt */
3543 /* and trace clause boundary exits */
3544 /******************************************************************************/
3545 {
3546  if (this->pending_count != 0) /* do we have trapped conditions? */
3547  {
3548  this->processTraps(); /* go dispatch the traps */
3549  }
3550 
3551  this->activity->callHaltTestExit(this); /* Sys exit want to raise a halt? */
3552  /* did sysexit change trace state */
3553  if (!this->activity->callTraceTestExit(this, this->isExternalTraceOn()))
3554  {
3555  /* remember new state... */
3556  if (this->isExternalTraceOn()) /* if current setting is on */
3557  {
3558  this->setExternalTraceOff(); /* turn it off */
3559  }
3560  else /* otherwise */
3561  {
3562  this->setExternalTraceOn(); /* turn it on */
3563  }
3564  }
3565  /* yield situation occurred? */
3566  if (this->settings.flags&external_yield)
3567  {
3568  /* turn off the yield flag */
3569  this->settings.flags &= ~external_yield;
3570  this->activity->relinquish(); /* yield control to the activity */
3571  }
3572  /* halt condition occurred? */
3573  if (this->settings.flags&halt_condition)
3574  {
3575  /* turn off the halt flag */
3576  this->settings.flags &= ~halt_condition;
3577  /* yes, raise the flag */
3578  /* process as common condition */
3580  {
3581  /* raise as a syntax error */
3583  }
3584  }
3585  /* need to turn on tracing? */
3586  if (this->settings.flags&set_trace_on)
3587  {
3588  /* turn off the trace flag */
3589  this->settings.flags &= ~set_trace_on;
3590  this->setExternalTraceOn(); /* and save the current state */
3591  /* turn on tracing */
3593  }
3594  /* need to turn off tracing? */
3595  if (this->settings.flags&set_trace_off)
3596  {
3597  /* turn off the trace flag */
3598  this->settings.flags &= ~set_trace_off;
3599  this->setExternalTraceOff(); /* and save the current state */
3600  /* turn on tracing */
3602  }
3603  /* no clause exits and all conditions*/
3604  /* have been processed? */
3605  if (!(this->settings.flags&clause_exits) && this->pending_count == 0)
3606  {
3607  /* turn off boundary processing */
3608  this->settings.flags &= ~clause_boundary;
3609  }
3610 }
3611 
3612 
3618 {
3620 }
3621 
3622 
3633 {
3634  // if there's no halt condition pending, set this
3635  if ((settings.flags&halt_condition) == 0)
3636  {
3637  /* store the description */
3638  this->settings.halt_description = description;
3639  /* turn on the HALT flag */
3640  this->settings.flags |= halt_condition;
3641  /* turn on clause boundary checking */
3642  this->settings.flags |= clause_boundary;
3643  return true;
3644  }
3645  else
3646  {
3647  // we're not in a good position to process this
3648  return false;
3649  }
3650 }
3651 
3653 /******************************************************************************/
3654 /* Function: Flip ON the externally activated TRACE bit. */
3655 /******************************************************************************/
3656 {
3657  /* turn on the yield flag */
3658  this->settings.flags |= external_yield;
3659  /* turn on clause boundary checking */
3660  this->settings.flags |= clause_boundary;
3661 }
3662 
3664 /******************************************************************************/
3665 /* Function: Flip ON the externally activated TRACE bit. */
3666 /******************************************************************************/
3667 {
3668  this->settings.flags |= set_trace_on;/* turn on the tracing flag */
3669  /* turn on clause boundary checking */
3670  this->settings.flags |= clause_boundary;
3671  /* turn on tracing */
3673 }
3674 
3676 /******************************************************************************/
3677 /* Function: Flip OFF the externally activated TRACE bit. */
3678 /******************************************************************************/
3679 {
3680  /* turn off the tracing flag */
3681  this->settings.flags |= set_trace_off;
3682  /* turn on clause boundary checking */
3683  this->settings.flags |= clause_boundary;
3684 }
3685 
3686 
3688 /******************************************************************************/
3689 /* Function: Process an individual debug pause for an instruction */
3690 /******************************************************************************/
3691 {
3692  if (this->debug_pause) /* instruction during debug pause? */
3693  {
3694  return false; /* just get out quick */
3695  }
3696 
3697  if (this->settings.flags&debug_bypass)
3698  {
3699  /* turn off for the next time */
3700  this->settings.flags &= ~debug_bypass;
3701  }
3702  /* debug pauses suppressed? */
3703  else if (this->settings.trace_skip > 0)
3704  {
3705  this->settings.trace_skip--; /* account for this one */
3706  if (this->settings.trace_skip == 0)/* gone to zero? */
3707  {
3708  /* turn tracing back on again (this */
3709  /* ensures the next pause also has */
3710  /* the instruction traced */
3711  this->settings.flags &= ~trace_suppress;
3712  }
3713  }
3714  else
3715  {
3716  if (!this->code->isTraceable()) /* if we don't have real source */
3717  {
3718  return false; /* just ignore for this */
3719  }
3720  /* newly into debug mode? */
3721  if (!(this->settings.flags&debug_prompt_issued))
3722  {
3723  /* write the initial prompt */
3725  /* remember we've issued this */
3727  }
3728  RexxInstruction *currentInst = this->next; /* save the next location target */
3729  for (;;)
3730  {
3731  RexxString *response;
3732  /* read a line from the screen */
3733  response = this->activity->traceInput(this);
3734 
3735  if (response->getLength() == 0) /* just a "null" line entered? */
3736  {
3737  break; /* just end the pausing */
3738  }
3739  /* a re-execute request? */
3740  else if (response->getLength() == 1 && response->getChar(0) == '=')
3741  {
3742  this->next = this->current; /* reset the execution pointer */
3743  return true; /* finished (inform block instrs) */
3744  }
3745  else
3746  {
3747  this->debugInterpret(response);/* go execute this */
3748  if (currentInst != this->next) /* flow of control change? */
3749  {
3750  break; /* end of this pause */
3751  }
3752  /* has the use changed the trace */
3753  /* setting on us? */
3754  else if (this->settings.flags&debug_bypass)
3755  {
3756  /* turn off for the next time */
3757  this->settings.flags &= ~debug_bypass;
3758  break; /* we also skip repausing */
3759  }
3760  }
3761  }
3762  }
3763  return false; /* no re-execute */
3764 }
3765 
3766 void RexxActivation::traceClause( /* trace a REXX instruction */
3767  RexxInstruction * clause, /* value to trace */
3768  int prefix ) /* prefix to use */
3769 /******************************************************************************/
3770 /* Function: Trace an individual line of a source file */
3771 /******************************************************************************/
3772 {
3773  /* tracing currently suppressed? */
3774  if (this->settings.flags&trace_suppress || this->debug_pause)
3775  {
3776  return; /* just ignore this call */
3777  }
3778  if (!this->code->isTraceable()) /* if we don't have real source */
3779  {
3780  return; /* just ignore for this */
3781  }
3782  /* format the line */
3783  RexxString *line = this->formatTrace(clause, this->code->getSourceObject());
3784  if (line != OREF_NULL) /* have a source line? */
3785  {
3786  /* newly into debug mode? */
3787  if ((this->settings.flags&trace_debug && !(this->settings.flags&source_traced)))
3788  {
3789  this->traceSourceString(); /* trace the source string */
3790  }
3791  /* write out the line */
3792  this->activity->traceOutput(this, line);
3793  }
3794 }
3795 
3805 void RexxActivation::command(RexxString *address, RexxString *commandString)
3806 {
3807  bool instruction_traced; /* instruction has been traced */
3808  ProtectedObject condition;
3809  ProtectedObject commandResult;
3810 
3811  /* instruction already traced? */
3812  if (tracingAll() || tracingCommands())
3813  {
3814  instruction_traced = true; /* remember we traced this */
3815  }
3816  else
3817  {
3818  instruction_traced = false; /* not traced yet */
3819  }
3820  /* if exit declines call */
3821  if (this->activity->callCommandExit(this, address, commandString, commandResult, condition))
3822  {
3823  // first check for registered command handlers
3824  CommandHandler *handler = activity->resolveCommandHandler(address);
3825  if (handler != OREF_NULL)
3826  {
3827  handler->call(activity, this, address, commandString, commandResult, condition);
3828  }
3829  else
3830  {
3831  // No handler for this environment
3832  commandResult = new_integer(RXSUBCOM_NOTREG); // just use the not registered return code
3833  // raise the condition when things are done
3834  condition = activity->createConditionObject(OREF_FAILURENAME, (RexxObject *)commandResult, commandString, OREF_NULL, OREF_NULL);
3835  }
3836  }
3837 
3838  RexxObject *rc = (RexxObject *)commandResult;
3839  RexxDirectory *conditionObj = (RexxDirectory *)(RexxObject *)condition;
3840 
3841  bool failureCondition = false; // don't have a failure condition yet
3842 
3843  int returnStatus = RETURN_STATUS_NORMAL;
3844  // did a handler raise a condition? We need to pull the rc value from the
3845  // condition object
3846  if (conditionObj != OREF_NULL)
3847  {
3848  RexxObject *temp = conditionObj->at(OREF_RC);
3849  if (temp == OREF_NULL)
3850  {
3851  // see if we have a result and make sure the condition object
3852  // fills this as the RC value
3853  temp = conditionObj->at(OREF_RESULT);
3854  if (temp != OREF_NULL)
3855  {
3856  conditionObj->put(temp, OREF_RC);
3857  }
3858  }
3859  // replace the RC value
3860  if (temp != OREF_NULL)
3861  {
3862  rc = temp;
3863  }
3864 
3865  RexxString *conditionName = (RexxString *)conditionObj->at(OREF_CONDITION);
3866  // check for an error or failure condition, since these get special handling
3867  if (conditionName->strCompare(CHAR_FAILURENAME))
3868  {
3869  // unconditionally update the RC value
3870  conditionObj->put(temp, OREF_RC);
3871  // failure conditions require special handling when raising the condition
3872  // we'll need to reraise this as an ERROR condition if not trapped.
3873  failureCondition = true;
3874  // set the appropriate return status
3875  returnStatus = RETURN_STATUS_FAILURE;
3876  }
3877  if (conditionName->strCompare(CHAR_ERROR))
3878  {
3879  // unconditionally update the RC value
3880  conditionObj->put(temp, OREF_RC);
3881  // set the appropriate return status
3882  returnStatus = RETURN_STATUS_ERROR;
3883  }
3884  }
3885 
3886  // a handler might not return a value, so default the return code to zero
3887  // if nothing is received.
3888  if (rc == OREF_NULL)
3889  {
3890  rc = TheFalseObject;
3891  }
3892 
3893  // if this was done during a debug pause, we don't update RC
3894  // and .RS.
3895  if (!this->debug_pause)
3896  {
3897  // set the RC value before anything
3898  this->setLocalVariable(OREF_RC, VARIABLE_RC, rc);
3899  /* tracing command errors or fails? */
3900  if ((returnStatus == RETURN_STATUS_ERROR && tracingErrors()) ||
3901  (returnStatus == RETURN_STATUS_FAILURE && (tracingFailures())))
3902  {
3903  /* trace the current instruction */
3904  this->traceClause(this->current, TRACE_PREFIX_CLAUSE);
3905  /* then we always trace full command */
3906  this->traceValue(commandString, TRACE_PREFIX_RESULT);
3907  instruction_traced = true; /* we've now traced this */
3908  }
3909 
3910  wholenumber_t rcValue;
3911  /* need to trace the RC info too? */
3912  if (instruction_traced && rc->numberValue(rcValue) && rcValue != 0)
3913  {
3914  /* get RC as a string */
3915  RexxString *rc_trace = rc->stringValue();
3916  /* tack on the return code */
3917  rc_trace = rc_trace->concatToCstring("RC(");
3918  /* add the closing part */
3919  rc_trace = rc_trace->concatWithCstring(")");
3920  /* trace the return code */
3921  this->traceValue(rc_trace, TRACE_PREFIX_ERROR);
3922  }
3923  // set the return status
3924  setReturnStatus(returnStatus);
3925 
3926  // now handle any conditions we might need to raise
3927  // these are also not raised if it's a debug pause.
3928  if (conditionObj != OREF_NULL)
3929  {
3930  // try to raise the condition, and if it isn't handled, we might
3931  // munge this into an ERROR condition
3932  if (!activity->raiseCondition(conditionObj))
3933  {
3934  // untrapped failure condition? Turn into an ERROR condition and
3935  // reraise
3936  if (failureCondition)
3937  {
3938  // just change the condition name
3939  conditionObj->put(OREF_ERRORNAME, OREF_CONDITION);
3940  activity->raiseCondition(conditionObj);
3941  }
3942  }
3943  }
3944  // do debug pause if necessary. necessary is defined by: we are
3945  // tracing ALL or COMMANDS, OR, we /* using TRACE NORMAL and a FAILURE
3946  // return code was received OR we receive an ERROR return code and
3947  // have TRACE ERROR in effect.
3948  if (instruction_traced && inDebug())
3949  {
3950  this->debugPause(); /* do the debug pause */
3951  }
3952  }
3953 }
3954 
3961 {
3962  this->settings.return_status = status;
3963  this->settings.flags |= return_status_set;
3964 }
3965 
3966 
3968 /******************************************************************************/
3969 /* Function: Return the name of the current program file */
3970 /******************************************************************************/
3971 {
3972  return this->code->getProgramName(); /* get the name from the code */
3973 }
3974 
3976 /******************************************************************************/
3977 /* Function: Return the directory of labels for this method */
3978 /******************************************************************************/
3979 {
3980  return this->code->getLabels(); /* get the labels from the code */
3981 }
3982 
3984 /******************************************************************************/
3985 /* Function: Create the source string returned by parse source */
3986 /******************************************************************************/
3987 {
3988  /* produce the system specific string*/
3989  return SystemInterpreter::getSourceString(this->settings.calltype, this->code->getProgramName());
3990 }
3991 
3992 
4000 {
4001  // get the directory of external functions
4003 
4004  // if it does not exist, it will be created
4005  if (routines == OREF_NULL)
4006  {
4007 
4009  routines = settings.parent_code->getLocalRoutines();
4010  }
4011  // if a method by that name exists, it will be OVERWRITTEN!
4012  routines->setEntry(name, _method);
4013 }
4014 
4015 
4023 {
4024  return code->getPublicRoutines();
4025 }
4026 
4027 
4028 
4030  RexxMessage * notify) /* activation to notify */
4031 /******************************************************************************/
4032 /* Function: Set an error notification tag on the activation. */
4033 /******************************************************************************/
4034 {
4035  this->objnotify = notify;
4036 }
4037 
4038 
4040  RexxObject * environment) /* new local environment buffer */
4041 /******************************************************************************/
4042 /* Function: Push the new environment buffer onto the EnvLIst */
4043 /******************************************************************************/
4044 {
4045  /* internal call or interpret? */
4046  if (this->isTopLevelCall())
4047  {
4048  /* nope, push environment here. */
4049  /* DO we have a environment list? */
4050  if (!this->environmentList)
4051  {
4052  /* nope, create one */
4053  this->environmentList = new_list();
4054  }
4055  this->environmentList->addFirst(environment);
4056  }
4057  else /* nope, process up the chain. */
4058  {
4059  /* Yes, forward on the message. */
4060  this->parent->pushEnvironment(environment);
4061  }
4062 }
4063 
4065 /******************************************************************************/
4066 /* Function: return the top level local Environemnt */
4067 /******************************************************************************/
4068 {
4069  /* internal call or interpret? */
4070  if (this->isTopLevelCall())
4071  {
4072  /* nope, we puop Environemnt here */
4073  /* DO we have a environment list? */
4074  if (this->environmentList)
4075  {
4076  /* yup, return first element */
4077  return this->environmentList->removeFirst();
4078 
4079  }
4080  else /* nope, return .nil */
4081  {
4082  return TheNilObject;
4083  }
4084  }
4085  else
4086  { /* nope, pass on up the chain. */
4087  /* Yes, forward on the message. */
4088  return this->parent->popEnvironment();
4089  }
4090 }
4091 
4093 /******************************************************************************/
4094 /* Function: Close any streams opened by the I/O builtin functions */
4095 /******************************************************************************/
4096 {
4097  RexxString *index; /* index for stream directory */
4098 
4099  /* exiting a bottom level? */
4100  if (this->isProgramOrMethod())
4101  {
4102  RexxDirectory *streams = this->settings.streams; /* get the streams directory */
4103  /* actually have a table? */
4104  if (streams != OREF_NULL)
4105  {
4106  /* traverse this */
4107  for (HashLink j = streams->first(); (index = (RexxString *)streams->index(j)) != OREF_NULL; j = streams->next(j))
4108  {
4109  /* closing each stream */
4110  streams->at(index)->sendMessage(OREF_CLOSE);
4111  }
4112  }
4113  }
4114 }
4115 
4116 
4118  RexxString *name ) /* name to retrieve */
4119 /******************************************************************************/
4120 /* Function: process unitialized variable over rides */
4121 /******************************************************************************/
4122 {
4123  /* get the handler from .local */
4124  RexxObject *novalue_handler = getLocalEnvironment(OREF_NOVALUE);
4125  if (novalue_handler != OREF_NULL) /* have a novalue handler? */
4126  {
4127  /* ask it to process this */
4128  return novalue_handler->sendMessage(OREF_NOVALUE, name);
4129  }
4130  return TheNilObject; /* return the handled result */
4131 }
4132 
4140 {
4141  return executable->getPackage();
4142 }
4143 
4144 
4145 RexxObject *RexxActivation::evaluateLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
4146 {
4147  /* new tail for compound */
4148  RexxCompoundTail resolved_tail(this, tail, tailCount);
4149 
4150  RexxStem *stem_table = getLocalStem(stemName, index); /* get the stem entry from this dictionary */
4151  RexxObject *value = stem_table->evaluateCompoundVariableValue(this, stemName, &resolved_tail);
4152  /* need to trace? */
4153  if (tracingIntermediates())
4154  {
4155  traceCompoundName(stemName, tail, tailCount, &resolved_tail);
4156  /* trace variable value */
4157  traceCompound(stemName, tail, tailCount, value);
4158  }
4159  return value;
4160 }
4161 
4162 
4163 RexxObject *RexxActivation::getLocalCompoundVariableValue(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
4164 {
4165  /* new tail for compound */
4166  RexxCompoundTail resolved_tail(this, tail, tailCount);
4167 
4168  RexxStem *stem_table = getLocalStem(stemName, index); /* get the stem entry from this dictionary */
4169  return stem_table->getCompoundVariableValue(&resolved_tail);
4170 }
4171 
4172 
4173 RexxObject *RexxActivation::getLocalCompoundVariableRealValue(RexxString *localstem, size_t index, RexxObject **tail, size_t tailCount)
4174 {
4175  /* new tail for compound */
4176  RexxCompoundTail resolved_tail(this, tail, tailCount);
4177 
4178  RexxStem *stem_table = getLocalStem(localstem, index); /* get the stem entry from this dictionary */
4179  return stem_table->getCompoundVariableRealValue(&resolved_tail);
4180 }
4181 
4182 
4183 RexxCompoundElement *RexxActivation::getLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
4184 {
4185  /* new tail for compound */
4186  RexxCompoundTail resolved_tail(this, tail, tailCount);
4187 
4188  RexxStem *stem_table = getLocalStem(stemName, index); /* get the stem entry from this dictionary */
4189  return stem_table->getCompoundVariable(&resolved_tail);
4190 }
4191 
4192 
4194 {
4195  /* new tail for compound */
4196  RexxCompoundTail resolved_tail(this, tail, tailCount);
4197 
4198  RexxStem *stem_table = getLocalStem(stemName, index); /* get the stem entry from this dictionary */
4199  return stem_table->exposeCompoundVariable(&resolved_tail);
4200 }
4201 
4202 
4203 bool RexxActivation::localCompoundVariableExists(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
4204 {
4205  /* new tail for compound */
4206  RexxCompoundTail resolved_tail(this, tail, tailCount);
4207 
4208  RexxStem *stem_table = getLocalStem(stemName, index); /* get the stem entry from this dictionary */
4209  return stem_table->compoundVariableExists(&resolved_tail);
4210 }
4211 
4212 
4213 void RexxActivation::assignLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount, RexxObject *value)
4214 {
4215  /* new tail for compound */
4216  RexxCompoundTail resolved_tail(this, tail, tailCount);
4217 
4218  RexxStem *stem_table = getLocalStem(stemName, index); /* get the stem entry from this dictionary */
4219  /* and set the value */
4220  stem_table->setCompoundVariable(&resolved_tail, value);
4221  /* trace resolved compound name */
4222  if (tracingIntermediates())
4223  {
4224  traceCompoundName(stemName, tail, tailCount, &resolved_tail);
4225  /* trace variable value */
4226  traceCompoundAssignment(stemName, tail, tailCount, value);
4227  }
4228 }
4229 
4230 
4231 void RexxActivation::setLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount, RexxObject *value)
4232 {
4233  /* new tail for compound */
4234  RexxCompoundTail resolved_tail(this, tail, tailCount);
4235 
4236  RexxStem *stem_table = getLocalStem(stemName, index); /* get the stem entry from this dictionary */
4237  /* and set the value */
4238  stem_table->setCompoundVariable(&resolved_tail, value);
4239 }
4240 
4241 
4242 void RexxActivation::dropLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
4243 {
4244  /* new tail for compound */
4245  RexxCompoundTail resolved_tail(this, tail, tailCount);
4246 
4247  RexxStem *stem_table = getLocalStem(stemName, index); /* get the stem entry from this dictionary */
4248  /* and set the value */
4249  stem_table->dropCompoundVariable(&resolved_tail);
4250 }
4251 
4252 
4260 {
4261  return this->settings.securityManager;
4262 }
4263 
4264 
4272 {
4273  SecurityManager *manager = this->settings.securityManager;
4274  if (manager != OREF_NULL)
4275  {
4276  return manager;
4277  }
4279 }
4280 
4281 
4290 {
4291  return activity->getLocalEnvironment(name);
4292 }
4293 
4294 
4301 {
4302  const char *type = FRAME_METHOD;
4304  RexxObject *target = OREF_NULL;
4305 
4306  if (isInterpret())
4307  {
4309  }
4310  else if (isInternalCall())
4311  {
4313  arguments = getArguments();
4314  }
4315  else if (isMethod())
4316  {
4317  type = FRAME_METHOD;
4318  arguments = getArguments();
4319  target = receiver;
4320  }
4321  else if (isProgram())
4322  {
4323  type = FRAME_PROGRAM;
4324  arguments = getArguments();
4325  }
4326  else if (isRoutine())
4327  {
4328  type = FRAME_ROUTINE;
4329  arguments = getArguments();
4330  }
4331 
4332  // construct the traceback line before we allocate the stack frame object.
4333  // calling this in the constructor argument list can cause the stack frame instance
4334  // to be inadvertently reclaimed if a GC is triggered while evaluating the constructor
4335  // arguments.
4336  RexxString *traceback = getTraceBack();
4338 }
4339 
4351 {
4352  // if this is a method invocation, then we can give the method name and scope.
4353  if (isMethod())
4354  {
4355  RexxArray *info = new_array(getMessageName(), scope->getId(), packageName);
4356  ProtectedObject p(info);
4357 
4359  }
4360  else if (isRoutine())
4361  {
4362  RexxArray *info = new_array(getMessageName(), packageName);
4363  ProtectedObject p(info);
4364 
4366  }
4367  else
4368  {
4369  RexxArray *info = new_array(packageName);
4370  ProtectedObject p(info);
4371 
4373  }
4374 }
4375 
4376 
4383 {
4384  return activity->generateStackFrames(skipFirst);
4385 }
RexxActivity::traceInput
RexxString * traceInput(RexxActivation *)
Definition: RexxActivity.cpp:2861
ActivityManager::newActivation
static RexxActivation * newActivation(RexxActivity *activity, RoutineClass *routine, RexxCode *code, RexxString *calltype, RexxString *environment, int context)
Definition: ActivityManager.cpp:254
RexxActivity::callInitializationExit
void callInitializationExit(RexxActivation *)
Definition: RexxActivity.cpp:2054
RexxActivation::getRexxContext
virtual RexxActivation * getRexxContext()
Definition: RexxActivation.cpp:1996
RexxActivation::setExternalTraceOff
void setExternalTraceOff()
Definition: RexxActivation.hpp:415
RexxLocalVariables::migrate
void migrate(RexxActivity *)
Definition: RexxLocalVariables.cpp:91
RexxActivation::callExternalRexx
bool callExternalRexx(RexxString *, RexxObject **, size_t, RexxString *, ProtectedObject &)
Definition: RexxActivation.cpp:2668
RexxActivation::trace_results
static const size_t trace_results
Definition: RexxActivation.hpp:638
RexxActivation::internalCall
RexxObject * internalCall(RexxString *, RexxInstruction *, size_t, RexxExpressionStack *, ProtectedObject &)
Definition: RexxActivation.cpp:2844
RexxActivation::trace_failures
static const size_t trace_failures
Definition: RexxActivation.hpp:643
Error_Unexpected_procedure_call
#define Error_Unexpected_procedure_call
Definition: RexxErrorCodes.h:113
ActivationSettings::numericSettings
NumericSettings numericSettings
Definition: RexxActivation.hpp:125
RexxActivation::contextObject
RexxContext * contextObject
Definition: RexxActivation.hpp:615
RexxCode::findRoutine
RoutineClass * findRoutine(RexxString *n)
Definition: RexxCode.hpp:91
RexxActivation::traceSetting
RexxString * traceSetting()
Definition: RexxActivation.cpp:734
RexxActivation::getArguments
RexxArray * getArguments()
Definition: RexxActivation.hpp:434
RexxActivation::setReturnStatus
void setReturnStatus(int status)
Definition: RexxActivation.cpp:3960
RexxMethod::isGuarded
bool isGuarded()
Definition: MethodClass.hpp:133
SystemInterpreter::releaseResultMemory
static void releaseResultMemory(void *)
Definition: MemorySupport.cpp:75
RexxObject::sendMessage
void sendMessage(RexxString *, RexxArray *, ProtectedObject &)
Definition: ObjectClass.cpp:668
RexxActivation::trapState
RexxString * trapState(RexxString *)
Definition: RexxActivation.cpp:2052
CHAR_STDERR
char CHAR_STDERR[]
new_array
RexxArray * new_array(size_t s)
Definition: ArrayClass.hpp:250
RexxActivation::handler_queue
RexxQueue * handler_queue
Definition: RexxActivation.hpp:624
RexxExpressionStack
Definition: ExpressionStack.hpp:53
RexxActivation::forward
RexxObject * forward(RexxObject *, RexxString *, RexxObject *, RexxObject **, size_t, bool)
Definition: RexxActivation.cpp:1246
RexxActivation::isInternalLevelCall
bool isInternalLevelCall()
Definition: RexxActivation.hpp:204
RexxHashTableCollection::index
RexxObject * index(HashLink pos)
Definition: RexxCollection.hpp:90
RexxActivation::isExternalTraceOn
bool isExternalTraceOn()
Definition: RexxActivation.hpp:413
RexxHashTableCollection::next
HashLink next(HashLink pos)
Definition: RexxCollection.hpp:88
RexxArray
Definition: ArrayClass.hpp:100
ActivationSettings::local_variables
RexxLocalVariables local_variables
Definition: RexxActivation.hpp:129
RexxActivation::externalCall
RexxObject * externalCall(RexxString *, size_t, RexxExpressionStack *, RexxString *, ProtectedObject &)
Definition: RexxActivation.cpp:2597
RexxCompoundElement
Definition: RexxCompoundElement.hpp:50
PackageManager::getLibrary
static LibraryPackage * getLibrary(RexxString *name)
Definition: PackageManager.cpp:185
RexxActivation::liveGeneral
void liveGeneral(int reason)
Definition: RexxActivation.cpp:977
RexxSource::DEBUG_IGNORE
static const size_t DEBUG_IGNORE
Definition: SourceFile.hpp:428
RexxObject::isInstanceOf
bool isInstanceOf(RexxClass *)
Definition: ObjectClass.cpp:226
RXMACRO_SEARCH_AFTER
#define RXMACRO_SEARCH_AFTER
Definition: rexxapidefs.h:221
RexxActivation::currentLine
size_t currentLine()
Definition: RexxActivation.cpp:1184
RexxActivation::getLocalCompoundVariableValue
RexxObject * getLocalCompoundVariableValue(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
Definition: RexxActivation.cpp:4163
RexxActivation::transfer_failed
static const size_t transfer_failed
Definition: RexxActivation.hpp:668
RexxActivation::isTopLevelCall
bool isTopLevelCall()
Definition: RexxActivation.hpp:202
BaseExecutable::getSourceObject
RexxSource * getSourceObject()
Definition: MethodClass.hpp:85
SystemInterpreter::invokeExternalFunction
static bool invokeExternalFunction(RexxActivation *, RexxActivity *, RexxString *, RexxObject **, size_t, RexxString *, ProtectedObject &)
Definition: ExternalFunctions.cpp:344
RexxActivation::getLocalCompoundVariable
RexxCompoundElement * getLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
Definition: RexxActivation.cpp:4183
RexxActivation::setIndent
void setIndent(size_t v)
Definition: RexxActivation.hpp:346
CHAR_CONTEXT
char CHAR_CONTEXT[]
RexxActivation::traceOperatorValue
void traceOperatorValue(int prefix, const char *tag, RexxObject *value)
Definition: RexxActivation.cpp:3323
NumericSettings
Definition: Numerics.hpp:49
RexxActivation::single_step_nested
static const size_t single_step_nested
Definition: RexxActivation.hpp:652
RexxInstruction::getLocation
const SourceLocation & getLocation()
Definition: RexxInstruction.hpp:68
RexxMemory::checkUninitQueue
void checkUninitQueue()
Definition: RexxMemory.hpp:200
RexxLocalVariables::clearNested
void clearNested()
Definition: RexxLocalVariables.hpp:133
RexxActivation::yield
void yield()
Definition: RexxActivation.cpp:3652
RexxList::removeFirst
RexxObject * removeFirst()
Definition: ListClass.hpp:109
RexxActivation::forwarded
static const size_t forwarded
Definition: RexxActivation.hpp:662
RexxSource::getForm
bool getForm()
Definition: SourceFile.hpp:400
TheFalseObject
#define TheFalseObject
Definition: RexxCore.h:184
RexxActivation::signalTo
void signalTo(RexxInstruction *)
Definition: RexxActivation.cpp:1805
DEBUG_OFF
const int DEBUG_OFF
Definition: SourceFile.hpp:93
CommandHandler
Definition: CommandHandler.hpp:52
RexxActivation::setLocalCompoundVariable
void setLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount, RexxObject *value)
Definition: RexxActivation.cpp:4231
CHAR_HALT
char CHAR_HALT[]
TRACE_PREFIX_ERROR
Definition: RexxActivity.hpp:81
RexxActivity::relinquish
void relinquish()
Definition: RexxActivity.cpp:1853
MethodClass.hpp
RexxActivation::localCompoundVariableExists
bool localCompoundVariableExists(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
Definition: RexxActivation.cpp:4203
RexxSource::TRACE_IGNORE
static const size_t TRACE_IGNORE
Definition: SourceFile.hpp:417
PackageClass.hpp
RexxDateTime::valid
bool valid
Definition: RexxDateTime.hpp:173
RexxQueue::pullRexx
RexxObject * pullRexx()
Definition: QueueClass.cpp:64
BaseExecutable::getPackage
PackageClass * getPackage()
Definition: MethodClass.cpp:130
new_integer
RexxInteger * new_integer(wholenumber_t v)
Definition: IntegerClass.hpp:198
RexxActivity::callObjectFunctionExit
bool callObjectFunctionExit(RexxActivation *, RexxString *, RexxObject *, ProtectedObject &, RexxObject **, size_t)
Definition: RexxActivity.cpp:2303
RexxActivation::guardOff
void guardOff()
Definition: RexxActivation.hpp:185
memory_mark_general
#define memory_mark_general(oref)
Definition: RexxMemory.hpp:437
memoryObject
RexxMemory memoryObject
Definition: RexxMemory.cpp:84
RexxActivation::getSourceObject
RexxSource * getSourceObject()
Definition: RexxActivation.hpp:325
RexxQueue
Definition: QueueClass.hpp:49
RexxActivation::trapUndelay
void trapUndelay(RexxString *)
Definition: RexxActivation.cpp:2090
RexxActivation::checkTrapTable
void checkTrapTable()
Definition: RexxActivation.cpp:1429
RETURN_STATUS_ERROR
#define RETURN_STATUS_ERROR
Definition: RexxActivation.hpp:82
RexxActivation.hpp
type
int type
Definition: cmdparse.cpp:1965
RexxActivation::formatSourcelessTraceLine
RexxString * formatSourcelessTraceLine(RexxString *packageName)
Definition: RexxActivation.cpp:4350
RexxVariableDictionary::release
void release(RexxActivity *)
Definition: RexxVariableDictionary.cpp:379
Error_Execution_reply
#define Error_Execution_reply
Definition: RexxErrorCodes.h:539
ActivationSettings::traceindent
size_t traceindent
Definition: RexxActivation.hpp:124
RexxCode::isTraceable
bool isTraceable()
Definition: RexxCode.hpp:83
RexxActivation::tracingCommands
bool tracingCommands(void)
Definition: RexxActivation.hpp:399
StackFrameClass
Definition: StackFrameClass.hpp:59
RexxSource::TRACE_FAILURES
static const size_t TRACE_FAILURES
Definition: SourceFile.hpp:412
ActivationSettings::object_variables
RexxVariableDictionary * object_variables
Definition: RexxActivation.hpp:114
RexxActivationFrame
Definition: ActivationFrame.hpp:80
RexxActivationBase::previous
RexxActivationBase * previous
Definition: ObjectClass.hpp:602
Error_Incorrect_call_random_range
#define Error_Incorrect_call_random_range
Definition: RexxErrorCodes.h:352
RexxActivation::code
RexxCode * code
Definition: RexxActivation.hpp:600
RexxActivity::unwindToFrame
void unwindToFrame(RexxActivation *frame)
Definition: RexxActivity.cpp:1627
RexxActivation::activity
RexxActivity * activity
Definition: RexxActivation.hpp:604
RexxActivity::allocateFrame
RexxObject ** allocateFrame(size_t entries)
Definition: RexxActivity.hpp:304
RexxActivation::trace_suppress
static const size_t trace_suppress
Definition: RexxActivation.hpp:644
RexxActivation::scope
RexxClass * scope
Definition: RexxActivation.hpp:602
RexxActivation::findClass
RexxClass * findClass(RexxString *name)
Definition: RexxActivation.cpp:2762
RexxSource::TRACE_LABELS
static const size_t TRACE_LABELS
Definition: SourceFile.hpp:410
RexxActivity::traceOutput
void traceOutput(RexxActivation *, RexxString *)
Definition: RexxActivity.cpp:2811
RexxActivation::setDigits
void setDigits()
Definition: RexxActivation.cpp:1940
RexxActivation::getObjectVariables
RexxVariableDictionary * getObjectVariables()
Definition: RexxActivation.cpp:1652
RexxActivation::debug_pause
bool debug_pause
Definition: RexxActivation.hpp:611
RexxCode::install
void install(RexxActivation *activation)
Definition: RexxCode.hpp:87
RexxCode::getFirstInstruction
RexxInstruction * getFirstInstruction()
Definition: RexxCode.hpp:75
FRAME_METHOD
#define FRAME_METHOD
Definition: StackFrameClass.hpp:51
METHODCALL
#define METHODCALL
Definition: RexxActivation.hpp:137
RexxLocalVariables::init
void init(RexxActivation *creator, size_t poolSize)
Definition: RexxLocalVariables.hpp:74
LL
struct _LL LL
ActivationSettings::calltype
RexxString * calltype
Definition: RexxActivation.hpp:115
RexxCode::mergeRequired
void mergeRequired(RexxSource *s)
Definition: RexxCode.hpp:93
RexxContext
Definition: ContextClass.hpp:53
RoutineClass
Definition: RoutineClass.hpp:49
RexxMethod::getScope
RexxClass * getScope()
Definition: MethodClass.hpp:143
RexxDirectory::copy
RexxObject * copy()
Definition: DirectoryClass.cpp:109
ACTIVE
#define ACTIVE
Definition: RexxActivation.hpp:77
RexxActivation::settings
ActivationSettings settings
Definition: RexxActivation.hpp:598
RexxStem::dropCompoundVariable
void dropCompoundVariable(RexxCompoundTail *name)
Definition: StemClass.cpp:600
RexxActivation::trace_off
static const size_t trace_off
Definition: RexxActivation.hpp:635
SystemInterpreter::restoreEnvironment
static void restoreEnvironment(void *CurrentEnv)
Definition: ExternalFunctions.cpp:504
RexxClass::getId
RexxString * getId()
Definition: ClassClass.cpp:250
RexxActivation::tracingFailures
bool tracingFailures(void)
Definition: RexxActivation.hpp:395
ActivityManager.hpp
RexxActivation::clause_boundary
static const size_t clause_boundary
Definition: RexxActivation.hpp:656
RexxCode::resolveProgramName
RexxString * resolveProgramName(RexxActivity *activity, RexxString *name)
Definition: RexxCode.hpp:92
CHAR_FAILURENAME
char CHAR_FAILURENAME[]
RexxActivation::set_trace_off
static const size_t set_trace_off
Definition: RexxActivation.hpp:665
RexxActivity::buildMessage
RexxString * buildMessage(wholenumber_t, RexxArray *)
Definition: RexxActivity.cpp:1011
RexxVariableBase::procedureExpose
virtual void procedureExpose(RexxActivation *, RexxActivation *, RexxExpressionStack *)
Definition: ExpressionBaseVariable.hpp:59
RexxActivation::termination
void termination()
Definition: RexxActivation.cpp:1398
RexxActivation::dostack
RexxDoBlock * dostack
Definition: RexxActivation.hpp:608
SCOPE_RESERVED
#define SCOPE_RESERVED
Definition: RexxActivation.hpp:153
Message_Translations_sourceless_program_invocation
#define Message_Translations_sourceless_program_invocation
Definition: RexxErrorCodes.h:626
ActivationSettings::alternate_env
RexxString * alternate_env
Definition: RexxActivation.hpp:111
RexxActivity::run
void run()
Definition: RexxActivity.cpp:1384
RexxActivation::arguments
void arguments(RexxObject *)
Error_Execution_reply_return
#define Error_Execution_reply_return
Definition: RexxErrorCodes.h:540
FRAME_PROGRAM
#define FRAME_PROGRAM
Definition: StackFrameClass.hpp:54
RexxString::getLength
size_t getLength()
Definition: StringClass.hpp:330
RexxStem::setCompoundVariable
void setCompoundVariable(RexxCompoundTail *name, RexxObject *value)
Definition: StemClass.cpp:640
RexxActivation::condition_queue
RexxQueue * condition_queue
Definition: RexxActivation.hpp:626
ActivationSettings::securityManager
SecurityManager * securityManager
Definition: RexxActivation.hpp:118
RexxInstructionCallBase
Definition: CallInstruction.hpp:50
RexxObject::messageSend
void messageSend(RexxString *, RexxObject **, size_t, ProtectedObject &)
Definition: ObjectClass.cpp:759
RexxActivation::next
RexxInstruction * next
Definition: RexxActivation.hpp:610
Error_Incorrect_call_random
#define Error_Incorrect_call_random
Definition: RexxErrorCodes.h:346
RexxCode
Definition: RexxCode.hpp:58
_RXSTRING::strptr
char * strptr
Definition: rexx.h:158
RexxActivation::reply_issued
static const size_t reply_issued
Definition: RexxActivation.hpp:663
FRAME_INTERPRET
#define FRAME_INTERPRET
Definition: StackFrameClass.hpp:53
RANDOMIZE
uint64_t RANDOMIZE(uint64_t seed)
Definition: RexxActivation.hpp:72
RexxVariableDictionary::reserve
void reserve(RexxActivity *)
Definition: RexxVariableDictionary.cpp:343
RexxActivation::externalTraceOff
void externalTraceOff()
Definition: RexxActivation.cpp:3675
CHAR_LOSTDIGITS
char CHAR_LOSTDIGITS[]
RexxSource::TRACE_ALL
static const size_t TRACE_ALL
Definition: SourceFile.hpp:408
RexxActivation::findRexxContext
virtual RexxActivation * findRexxContext()
Definition: RexxActivation.cpp:2008
RexxObject::getObjectVariables
RexxVariableDictionary * getObjectVariables(RexxObject *)
Definition: ObjectClass.cpp:2170
RexxInstruction
Definition: RexxInstruction.hpp:54
MAX_INSTRUCTIONS
#define MAX_INSTRUCTIONS
Definition: RexxActivation.cpp:82
RexxSource::TRACE_SETTING_MASK
static const size_t TRACE_SETTING_MASK
Definition: SourceFile.hpp:422
RexxActivation::current
RexxInstruction * current
Definition: RexxActivation.hpp:609
CHAR_PROPAGATE
char CHAR_PROPAGATE[]
reportNovalue
void reportNovalue(RexxString *description)
Definition: ActivityManager.hpp:133
RexxStem::exposeCompoundVariable
RexxCompoundElement * exposeCompoundVariable(RexxCompoundTail *name)
Definition: StemClass.cpp:552
RexxActivity::guardWait
void guardWait()
Definition: RexxActivity.cpp:1807
RexxActivity::allocateLocalVariableFrame
void allocateLocalVariableFrame(RexxLocalVariables *locals)
Definition: RexxActivity.hpp:314
UnsafeBlock
Definition: ActivityManager.hpp:280
TRACE_PREFIX_RESULT
Definition: RexxActivity.hpp:82
CHAR_NOSTRING
char CHAR_NOSTRING[]
RexxVariableDictionary
Definition: RexxVariableDictionary.hpp:55
RexxActivation::exitFrom
void exitFrom(RexxObject *)
Definition: RexxActivation.cpp:1326
RexxActivity::checkStackSpace
void checkStackSpace()
Definition: RexxActivity.cpp:1964
ActivationFrame.hpp
RexxActivation::iterate
void iterate(RexxString *)
Definition: RexxActivation.cpp:1088
RexxStem::getCompoundVariable
RexxCompoundElement * getCompoundVariable(RexxCompoundTail *name)
Definition: StemClass.cpp:540
RexxActivation::processClauseBoundary
void processClauseBoundary()
Definition: RexxActivation.cpp:3539
RexxDirectory::at
RexxObject * at(RexxString *)
Definition: DirectoryClass.cpp:567
Error_Invalid_trace_debug
#define Error_Invalid_trace_debug
Definition: RexxErrorCodes.h:186
RexxVariableBase
Definition: ExpressionBaseVariable.hpp:47
Error_Execution_reply_exit
#define Error_Execution_reply_exit
Definition: RexxErrorCodes.h:541
RexxActivation::halt_condition
static const size_t halt_condition
Definition: RexxActivation.hpp:657
reportException
void reportException(wholenumber_t error)
Definition: ActivityManager.hpp:136
RexxActivation::topBlock
RexxDoBlock * topBlock()
Definition: RexxActivation.hpp:336
RexxActivation::trapinfo
RexxArray * trapinfo
Definition: RexxActivation.hpp:614
DEFAULT_MAX
#define DEFAULT_MAX
Definition: RexxActivation.cpp:2993
SourceLocation
Definition: SourceLocation.hpp:48
RexxActivation::createStackFrame
StackFrameClass * createStackFrame()
Definition: RexxActivation.cpp:4300
RexxActivation::trapDelay
void trapDelay(RexxString *)
Definition: RexxActivation.cpp:2074
INTERPRET
#define INTERPRET
Definition: RexxActivation.hpp:139
RexxActivation::traceSourceString
void traceSourceString()
Definition: RexxActivation.cpp:3482
RexxInstructionDo
Definition: DoInstruction.hpp:67
RexxActivationBase::executable
BaseExecutable * executable
Definition: ObjectClass.hpp:603
RexxInstruction.hpp
RexxActivation::assignLocalCompoundVariable
void assignLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount, RexxObject *value)
Definition: RexxActivation.cpp:4213
RexxActivation::trapOn
void trapOn(RexxString *, RexxInstructionCallBase *)
Definition: RexxActivation.cpp:1451
RexxCode::getMethods
RexxDirectory * getMethods()
Definition: RexxCode.hpp:89
RexxActivationBase::isForwarded
virtual bool isForwarded()
Definition: ObjectClass.hpp:592
DoBlock.hpp
TheClassClass
#define TheClassClass
Definition: RexxCore.h:149
Error_Label_not_found_name
#define Error_Label_not_found_name
Definition: RexxErrorCodes.h:111
RexxActivation::environmentList
RexxList * environmentList
Definition: RexxActivation.hpp:622
RexxLocalVariables::liveGeneral
void liveGeneral(int reason)
Definition: RexxLocalVariables.cpp:70
RexxActivation::loadRequires
PackageClass * loadRequires(RexxString *, RexxInstruction *)
Definition: RexxActivation.cpp:2805
RexxString::strCaselessCompare
bool strCaselessCompare(const char *s)
Definition: StringClass.hpp:347
TheTrueObject
#define TheTrueObject
Definition: RexxCore.h:185
RexxString::getStringData
const char * getStringData()
Definition: StringClass.hpp:333
RexxActivation::resetElapsed
void resetElapsed()
Definition: RexxActivation.cpp:2979
RexxActivation::processTraps
void processTraps()
Definition: RexxActivation.cpp:655
RexxActivation::single_step
static const size_t single_step
Definition: RexxActivation.hpp:651
RexxString::getChar
char getChar(size_t p)
Definition: StringClass.hpp:338
RexxActivationBase
Definition: ObjectClass.hpp:574
RexxBlockInstruction::isLabel
virtual bool isLabel(RexxString *)
Definition: RexxInstruction.hpp:96
CHAR_CSTDERR
char CHAR_CSTDERR[]
RexxActivation::trace_commands
static const size_t trace_commands
Definition: RexxActivation.hpp:640
RexxActivation::isTopLevel
bool isTopLevel()
Definition: RexxActivation.hpp:408
ActivationSettings::traceOption
size_t traceOption
Definition: RexxActivation.hpp:120
RexxActivation::setTrace
void setTrace(size_t, size_t)
Definition: RexxActivation.cpp:772
RexxActivity::reraiseException
void reraiseException(RexxDirectory *)
Definition: RexxActivity.cpp:1105
RexxActivation::getPublicRoutines
RexxDirectory * getPublicRoutines()
Definition: RexxActivation.cpp:4022
work
char work[256]
Definition: rxqueue.cpp:82
RexxActivation::loadLibrary
void loadLibrary(RexxString *target, RexxInstruction *instruction)
Definition: RexxActivation.cpp:2823
RexxActivation::interpret
void interpret(RexxString *)
Definition: RexxActivation.cpp:2352
RexxActivation::adjustRandomSeed
void adjustRandomSeed()
Definition: RexxActivation.hpp:311
RexxInternalObject::clearObject
void clearObject()
Definition: ObjectClass.hpp:231
RexxStem::getCompoundVariableValue
RexxObject * getCompoundVariableValue(RexxCompoundTail *resolved_tail)
Definition: StemClass.cpp:730
RexxBuffer
Definition: BufferClass.hpp:91
RexxList::addFirst
void addFirst(RexxObject *value)
Definition: ListClass.cpp:485
Error_Invalid_leave_leave
#define Error_Invalid_leave_leave
Definition: RexxErrorCodes.h:239
RexxActivation::tracingAll
bool tracingAll(void)
Definition: RexxActivation.hpp:400
RoutineClass::restore
static RoutineClass * restore(RexxBuffer *, char *, size_t length)
Definition: RoutineClass.cpp:722
RexxArray::get
RexxObject * get(size_t pos)
Definition: ArrayClass.hpp:201
CommandHandler.hpp
RexxActivation::clearTraceSettings
void clearTraceSettings()
Definition: RexxActivation.hpp:349
RexxVariableDictionary::transfer
bool transfer(RexxActivity *)
Definition: RexxVariableDictionary.cpp:409
T_Activation
Definition: ClassTypeCodes.h:187
RexxActivation::traceClause
void traceClause(RexxInstruction *, int)
Definition: RexxActivation.cpp:3766
RexxSource::parseTraceSetting
static bool parseTraceSetting(RexxString *, size_t &, size_t &, char &)
Definition: SourceFile.cpp:5715
Message_Translations_routine_invocation
#define Message_Translations_routine_invocation
Definition: RexxErrorCodes.h:618
RexxActivity::pushStackFrame
void pushStackFrame(RexxActivationBase *new_activation)
Definition: RexxActivity.cpp:1462
Interpreter.hpp
RexxActivation::isInternalCall
bool isInternalCall()
Definition: RexxActivation.hpp:198
RexxActivation::isRoutine
bool isRoutine()
Definition: RexxActivation.hpp:200
isOfClass
#define isOfClass(t, r)
Definition: RexxCore.h:211
RexxActivation::trapOff
void trapOff(RexxString *)
Definition: RexxActivation.cpp:1471
SecurityManager::checkStreamAccess
RexxObject * checkStreamAccess(RexxString *name)
Definition: SecurityManager.cpp:281
new_queue
RexxQueue * new_queue()
Definition: QueueClass.hpp:89
RexxActivationBase::isRexxContext
virtual bool isRexxContext()
Definition: ObjectClass.hpp:594
RexxActivation::getContextObject
RexxObject * getContextObject()
Definition: RexxActivation.cpp:2469
RexxActivation::form
bool form()
Definition: RexxActivation.cpp:1929
RexxExpressionStack::pop
RexxObject * pop()
Definition: ExpressionStack.hpp:78
CHAR_NOMETHOD
char CHAR_NOMETHOD[]
RexxActivation::getProgramName
RexxString * getProgramName()
Definition: RexxActivation.cpp:3967
RexxActivation::result
RexxObject * result
Definition: RexxActivation.hpp:613
RexxActivity::allocateStackFrame
void allocateStackFrame(RexxExpressionStack *stack, size_t entries)
Definition: RexxActivity.hpp:299
RexxActivation::traceEntry
void traceEntry()
Definition: RexxActivation.cpp:3147
INDENT_SPACING
#define INDENT_SPACING
Definition: RexxActivation.cpp:3140
RexxList::lastItem
RexxObject * lastItem()
Definition: ListClass.cpp:696
DEFAULT_MIN
#define DEFAULT_MIN
Definition: RexxActivation.cpp:2992
ActivationSettings::current_env
RexxString * current_env
Definition: RexxActivation.hpp:110
RexxActivation::isProgram
bool isProgram()
Definition: RexxActivation.hpp:201
RexxActivationBase::getExecutable
BaseExecutable * getExecutable()
Definition: ObjectClass.hpp:598
RexxActivation::trace_flags
static const size_t trace_flags
Definition: RexxActivation.hpp:645
ActivationSettings::streams
RexxDirectory * streams
Definition: RexxActivation.hpp:116
RexxActivation::default_trace_flags
static const size_t default_trace_flags
Definition: RexxActivation.hpp:646
VARIABLE_SELF
#define VARIABLE_SELF
Definition: RexxLocalVariables.hpp:54
raw_string
RexxString * raw_string(stringsize_t l)
Definition: StringClass.hpp:529
RexxActivity::raiseException
void raiseException(wholenumber_t, RexxString *, RexxArray *, RexxObject *)
Definition: RexxActivity.cpp:740
RexxSource::formatTraceSetting
static RexxString * formatTraceSetting(size_t source)
Definition: SourceFile.cpp:5821
CHAR_METHODS
char CHAR_METHODS[]
RexxActivation::tracingIntermediates
bool tracingIntermediates()
Definition: RexxActivation.hpp:348
RexxHashTableCollection::first
HashLink first()
Definition: RexxCollection.hpp:87
MAX_DIFFERENCE
#define MAX_DIFFERENCE
Definition: RexxActivation.cpp:2994
ActivationSettings::parent_argcount
size_t parent_argcount
Definition: RexxActivation.hpp:107
RexxSource
Definition: SourceFile.hpp:131
ActivationSettings::traps
RexxDirectory * traps
Definition: RexxActivation.hpp:104
RexxActivity::getCurrentRexxFrame
RexxActivation * getCurrentRexxFrame()
Definition: RexxActivity.hpp:280
RexxActivation::guarded_method
static const size_t guarded_method
Definition: RexxActivation.hpp:671
RexxActivation::traceCompoundAssignment
void traceCompoundAssignment(RexxString *stemVar, RexxObject **tails, size_t tailCount, RexxObject *value)
Definition: RexxActivation.hpp:391
RexxSource::DEBUG_OFF
static const size_t DEBUG_OFF
Definition: SourceFile.hpp:430
RexxCompoundTail.hpp
RexxInstruction::nextInstruction
RexxInstruction * nextInstruction
Definition: RexxInstruction.hpp:85
RexxActivation::getLocalEnvironment
RexxObject * getLocalEnvironment(RexxString *name)
Definition: RexxActivation.cpp:4289
RexxStem
Definition: StemClass.hpp:70
RoutineClass::call
void call(RexxActivity *, RexxString *, RexxObject **, size_t, RexxString *, RexxString *, int, ProtectedObject &)
Definition: RoutineClass.cpp:237
RexxSource::setLocalRoutines
void setLocalRoutines(RexxDirectory *r)
Definition: SourceFile.hpp:371
RexxActivation::callMacroSpaceFunction
bool callMacroSpaceFunction(RexxString *, RexxObject **, size_t, RexxString *, int, ProtectedObject &)
Definition: RexxActivation.cpp:2554
CHAR_STDIN
char CHAR_STDIN[]
RexxDoBlock::getIndent
size_t getIndent()
Definition: DoBlock.hpp:73
RexxActivation::novalueEnabled
bool novalueEnabled()
Definition: RexxActivation.hpp:542
new_string
RexxString * new_string(const char *s, stringsize_t l)
Definition: StringClass.hpp:524
RexxActivation::isInterpret
bool isInterpret()
Definition: RexxActivation.hpp:197
RexxDateTime
Definition: RexxDateTime.hpp:110
Error_Invalid_leave_iterate_name
#define Error_Invalid_leave_iterate_name
Definition: RexxErrorCodes.h:243
SystemInterpreter.hpp
FRAME_INTERNAL_CALL
#define FRAME_INTERNAL_CALL
Definition: StackFrameClass.hpp:52
RexxInternalObject::setHasReferences
void setHasReferences()
Definition: ObjectClass.hpp:239
RexxActivation::getRandomSeed
uint64_t getRandomSeed(RexxInteger *)
Definition: RexxActivation.cpp:2997
RexxResolveMacroFunction
RexxReturnCode REXXENTRY RexxResolveMacroFunction(const char *, PRXSTRING)
RexxContext::detach
void detach()
Definition: ContextClass.hpp:84
RexxActivity::callCommandExit
bool callCommandExit(RexxActivation *, RexxString *, RexxString *, ProtectedObject &result, ProtectedObject &condition)
Definition: RexxActivity.cpp:2435
Message_Translations_debug_prompt
#define Message_Translations_debug_prompt
Definition: RexxErrorCodes.h:605
RexxInteger::getValue
RexxObject * getValue(RexxActivation *)
Definition: IntegerClass.cpp:1162
RexxSource::DEBUG_TOGGLE
static const size_t DEBUG_TOGGLE
Definition: SourceFile.hpp:431
RexxActivation::fuzz
size_t fuzz()
Definition: RexxActivation.cpp:1921
RexxActivation::random
RexxInteger * random(RexxInteger *, RexxInteger *, RexxInteger *)
Definition: RexxActivation.cpp:3034
OREF_NULL
#define OREF_NULL
Definition: RexxCore.h:60
RexxLocalVariables::procedure
void procedure(RexxActivation *activation)
Definition: RexxLocalVariables.hpp:136
RexxSource::TRACE_ERRORS
static const size_t TRACE_ERRORS
Definition: SourceFile.hpp:413
RexxLocalVariables::setNovalueOff
void setNovalueOff()
Definition: RexxLocalVariables.hpp:130
RexxActivity::releaseStackFrame
void releaseStackFrame(RexxObject **frame)
Definition: RexxActivity.hpp:309
RexxSource::getTraceFlags
size_t getTraceFlags()
Definition: SourceFile.hpp:403
MS_PREORDER
#define MS_PREORDER
Definition: RexxActivation.hpp:86
RexxCode::getProgramName
RexxString * getProgramName()
Definition: RexxCode.cpp:201
RexxActivation::procedureExpose
void procedureExpose(RexxVariableBase **variables, size_t count)
Definition: RexxActivation.cpp:1200
RexxActivation::getContextLine
RexxObject * getContextLine()
Definition: RexxActivation.cpp:2486
RexxCompoundTail::getLength
size_t getLength()
Definition: RexxCompoundTail.hpp:164
RexxActivity
Definition: RexxActivity.hpp:127
TRACE_PREFIX_CLAUSE
Definition: RexxActivity.hpp:80
RexxActivation::getSettings
void getSettings(ActivationSettings &s)
Definition: RexxActivation.hpp:355
_RXSTRING
Definition: rexx.h:156
QUOTES_OVERHEAD
#define QUOTES_OVERHEAD
Definition: RexxActivation.cpp:3142
TRACE_PREFIX_INVOCATION
Definition: RexxActivity.hpp:94
REPLIED
#define REPLIED
Definition: RexxActivation.hpp:78
RexxBlockInstruction::isLoop
virtual bool isLoop()
Definition: RexxInstruction.hpp:98
RexxArray::put
void put(RexxObject *eref, size_t pos)
Definition: ArrayClass.cpp:203
RexxActivation::source_traced
static const size_t source_traced
Definition: RexxActivation.hpp:659
RexxActivation::return_status_set
static const size_t return_status_set
Definition: RexxActivation.hpp:667
RexxSource::getDigits
size_t getDigits()
Definition: SourceFile.hpp:399
PackageClass::getName
RexxString * getName()
Definition: PackageClass.cpp:124
RexxDirectory
Definition: DirectoryClass.hpp:49
RexxInstruction::getLineNumber
size_t getLineNumber()
Definition: RexxInstruction.hpp:79
RexxActivation::getContextLineNumber
size_t getContextLineNumber()
Definition: RexxActivation.cpp:2507
RexxCode::getLocalRoutines
RexxDirectory * getLocalRoutines()
Definition: RexxCode.hpp:79
RexxActivation::external
RexxActivation * external()
Definition: RexxActivation.cpp:1492
RexxString::set
void set(size_t s, int c, size_t l)
Definition: StringClass.hpp:337
CommandHandler::call
void call(RexxActivity *activity, RexxActivation *activation, RexxString *address, RexxString *command, ProtectedObject &rc, ProtectedObject &condition)
Definition: CommandHandler.cpp:98
RexxClass
Definition: ClassClass.hpp:49
RexxActivation::debugSkip
void debugSkip(wholenumber_t, bool)
Definition: RexxActivation.cpp:706
RexxActivity::raiseCondition
bool raiseCondition(RexxString *, RexxObject *, RexxString *, RexxObject *, RexxObject *)
Definition: RexxActivity.cpp:434
ProtectedObject.hpp
RexxActivity::callTraceTestExit
bool callTraceTestExit(RexxActivation *, bool)
Definition: RexxActivity.cpp:2682
RexxActivation::implicitExit
void implicitExit()
Definition: RexxActivation.hpp:272
RexxActivation::setExternalTraceOn
void setExternalTraceOn()
Definition: RexxActivation.hpp:414
RexxActivity::callFunctionExit
bool callFunctionExit(RexxActivation *, RexxString *, RexxObject *, ProtectedObject &, RexxObject **, size_t)
Definition: RexxActivity.cpp:2187
RexxActivation::getElapsed
int64_t getElapsed()
Definition: RexxActivation.cpp:2962
RETURN_STATUS_NORMAL
#define RETURN_STATUS_NORMAL
Definition: RexxActivation.hpp:81
RexxExpressionStack::live
void live(size_t)
Definition: ExpressionStack.cpp:50
DoInstruction.hpp
IntegerThree
#define IntegerThree
Definition: RexxCore.h:191
RexxString::concatToCstring
RexxString * concatToCstring(const char *)
Definition: StringClass.cpp:1251
CHAR_STDOUT
char CHAR_STDOUT[]
RexxActivation::trace_all
static const size_t trace_all
Definition: RexxActivation.hpp:637
RexxCode::getLocalVariableSize
size_t getLocalVariableSize()
Definition: RexxCode.hpp:78
RexxActivation::setLocalVariable
void setLocalVariable(RexxString *name, size_t index, RexxObject *value)
Definition: RexxActivation.hpp:520
ProtectedObject
Definition: ProtectedObject.hpp:46
MessageClass.hpp
RexxActivation::toggleAddress
void toggleAddress()
Definition: RexxActivation.cpp:1831
RexxActivation::debugPause
bool debugPause(RexxInstruction *instr=OREF_NULL)
Definition: RexxActivation.cpp:3687
StringClass.hpp
SystemInterpreter::getMessageText
static RexxString * getMessageText(wholenumber_t code)
Definition: ErrorMessages.cpp:99
RexxActivation::traceCompoundName
void traceCompoundName(RexxString *stemVar, RexxObject **tails, size_t tailCount, RexxCompoundTail *tail)
Definition: RexxActivation.hpp:388
RexxActivation::removeBlock
void removeBlock()
Definition: RexxActivation.hpp:340
TRACE_DEBUG_MASK
const size_t TRACE_DEBUG_MASK
Definition: SourceFile.hpp:98
RexxActivation::formatTrace
RexxString * formatTrace(RexxInstruction *, RexxSource *)
Definition: RexxActivation.cpp:3513
KEYWORD_PROCEDURE
#define KEYWORD_PROCEDURE
Definition: Token.hpp:152
RexxActivation::procedure_valid
static const size_t procedure_valid
Definition: RexxActivation.hpp:655
RexxActivation::getMacroCode
static RoutineClass * getMacroCode(RexxString *macroName)
Definition: RexxActivation.cpp:2714
RexxActivity::getRandomSeed
uint64_t getRandomSeed()
Definition: RexxActivity.hpp:291
StackFrameClass.hpp
RexxActivation::command
void command(RexxString *, RexxString *)
Definition: RexxActivation.cpp:3805
RexxInternalObject::isOldSpace
bool isOldSpace()
Definition: ObjectClass.hpp:252
ActivationSettings::parent_arglist
RexxObject ** parent_arglist
Definition: RexxActivation.hpp:106
RexxSource::TRACE_COMMANDS
static const size_t TRACE_COMMANDS
Definition: SourceFile.hpp:409
RexxActivity::resolveCommandHandler
CommandHandler * resolveCommandHandler(RexxString *)
Definition: RexxActivity.cpp:3215
RexxActivation::sourceObject
RexxSource * sourceObject
Definition: RexxActivation.hpp:601
RexxActivation::debug_prompt_issued
static const size_t debug_prompt_issued
Definition: RexxActivation.hpp:653
RexxActivation::objnotify
RexxMessage * objnotify
Definition: RexxActivation.hpp:620
RexxActivation::getReceiver
virtual RexxObject * getReceiver()
Definition: RexxActivation.cpp:2042
Message_Translations_sourceless_method_invocation
#define Message_Translations_sourceless_method_invocation
Definition: RexxErrorCodes.h:624
RexxActivation::popEnvironment
RexxObject * popEnvironment()
Definition: RexxActivation.cpp:4064
RexxActivity::popStackFrame
void popStackFrame(bool reply)
Definition: RexxActivity.cpp:1508
ActivationSettings
Definition: RexxActivation.hpp:99
RexxActivation::traps_copied
static const size_t traps_copied
Definition: RexxActivation.hpp:666
RexxActivation::traceCompound
void traceCompound(RexxString *stemVar, RexxObject **tails, size_t tailCount, RexxObject *value)
Definition: RexxActivation.hpp:390
RexxActivity::callScriptingExit
bool callScriptingExit(RexxActivation *, RexxString *, RexxObject *, ProtectedObject &, RexxObject **, size_t)
Definition: RexxActivity.cpp:2374
RexxActivity::callTerminationExit
void callTerminationExit(RexxActivation *)
Definition: RexxActivity.cpp:2071
PackageClass
Definition: PackageClass.hpp:48
Message_Translations_method_invocation
#define Message_Translations_method_invocation
Definition: RexxErrorCodes.h:619
ActivationSettings::trace_skip
wholenumber_t trace_skip
Definition: RexxActivation.hpp:122
RexxActivation::setForm
void setForm()
Definition: RexxActivation.cpp:1974
DEBUGPAUSE
#define DEBUGPAUSE
Definition: RexxActivation.hpp:136
RexxActivation::isMethod
bool isMethod()
Definition: RexxActivation.hpp:199
RexxActivation::trace_all_flags
static const size_t trace_all_flags
Definition: RexxActivation.hpp:647
TheEnvironment
#define TheEnvironment
Definition: RexxCore.h:173
RexxActivation::traceTaggedValue
void traceTaggedValue(int prefix, const char *tagPrefix, bool quoteTag, RexxString *tag, const char *marker, RexxObject *value)
Definition: RexxActivation.cpp:3232
RexxSource::getFuzz
size_t getFuzz()
Definition: SourceFile.hpp:401
RXSUBCOM_NOTREG
#define RXSUBCOM_NOTREG
Definition: rexxapidefs.h:90
RexxActivation::expose
void expose(RexxVariableBase **variables, size_t count)
Definition: RexxActivation.cpp:1229
PREFIX_LENGTH
#define PREFIX_LENGTH
Definition: RexxActivation.cpp:3139
ActivationSettings::flags
size_t flags
Definition: RexxActivation.hpp:121
RexxMessage
Definition: MessageClass.hpp:54
RexxVariable::set
void set(RexxObject *value)
Definition: RexxVariable.hpp:67
RexxActivation::trace_debug
static const size_t trace_debug
Definition: RexxActivation.hpp:636
RexxLocalVariables::live
void live(size_t)
Definition: RexxLocalVariables.cpp:50
CHAR_CSTDOUT
char CHAR_CSTDOUT[]
ActivationSettings::timestamp
RexxDateTime timestamp
Definition: RexxActivation.hpp:127
RexxExpressionStack::push
void push(RexxObject *value)
Definition: ExpressionStack.hpp:77
RexxDirectory::put
RexxObject * put(RexxObject *, RexxString *)
Definition: DirectoryClass.cpp:636
RexxActivation::getLocalStem
RexxStem * getLocalStem(RexxString *name, size_t index)
Definition: RexxActivation.hpp:482
RexxActivation::addLocalRoutine
void addLocalRoutine(RexxString *name, RexxMethod *method)
Definition: RexxActivation.cpp:3999
RexxCode::getMaxStackSize
size_t getMaxStackSize()
Definition: RexxCode.hpp:77
RexxActivation::trap
bool trap(RexxString *, RexxDirectory *)
Definition: RexxActivation.cpp:2106
RexxActivation::pushEnvironment
void pushEnvironment(RexxObject *)
Definition: RexxActivation.cpp:4039
RexxCode::getSourceObject
RexxSource * getSourceObject()
Definition: RexxCode.hpp:74
RexxActivation::closeStreams
void closeStreams()
Definition: RexxActivation.cpp:4092
RexxDoBlock::getParent
RexxBlockInstruction * getParent()
Definition: DoBlock.hpp:67
RexxActivation::putSettings
void putSettings(ActivationSettings &s)
Definition: RexxActivation.hpp:356
NumericSettings::digits
size_t digits
Definition: Numerics.hpp:53
KEYWORD_SIGNAL
#define KEYWORD_SIGNAL
Definition: Token.hpp:160
RexxActivation::returnFrom
void returnFrom(RexxObject *result)
Definition: RexxActivation.cpp:1049
Error_Incorrect_call_nonnegative
#define Error_Incorrect_call_nonnegative
Definition: RexxErrorCodes.h:334
RexxActivation::traceValue
void traceValue(RexxObject *, int)
Definition: RexxActivation.cpp:3183
memory_mark
#define memory_mark(oref)
Definition: RexxMemory.hpp:436
RexxActivation::debugInterpret
void debugInterpret(RexxString *)
Definition: RexxActivation.cpp:2371
RexxCode.hpp
RexxActivity::displayDebug
RexxObject * displayDebug(RexxDirectory *)
Definition: RexxActivity.cpp:1283
RexxActivation::unwindTrap
void unwindTrap(RexxActivation *)
Definition: RexxActivation.cpp:2314
activationSettingsTemplate
static ActivationSettings activationSettingsTemplate
Definition: RexxActivation.cpp:87
CallInstruction.hpp
RexxActivation::signalValue
void signalValue(RexxString *)
Definition: RexxActivation.cpp:1869
RexxActivation::guardOn
void guardOn()
Definition: RexxActivation.cpp:1892
HashLink
size_t HashLink
Definition: RexxHashTable.hpp:49
RexxActivation::getLocalCompoundVariableRealValue
RexxObject * getLocalCompoundVariableRealValue(RexxString *localstem, size_t index, RexxObject **tail, size_t tailCount)
Definition: RexxActivation.cpp:4173
RexxActivation::trace_intermediates
static const size_t trace_intermediates
Definition: RexxActivation.hpp:639
RexxActivation::execution_state
int execution_state
Definition: RexxActivation.hpp:617
Error_Invalid_leave_iteratevar
#define Error_Invalid_leave_iteratevar
Definition: RexxErrorCodes.h:242
RexxCompoundTail::createCompoundName
RexxString * createCompoundName(RexxString *)
Definition: RexxCompoundTail.cpp:319
RexxActivation::enableExternalTrace
void enableExternalTrace()
Definition: RexxActivation.cpp:3617
RETURNED
#define RETURNED
Definition: RexxActivation.hpp:79
trace_prefix_table
static const char * trace_prefix_table[]
Definition: RexxActivation.cpp:3107
RexxActivation::arglist
RexxObject ** arglist
Definition: RexxActivation.hpp:606
ActivationSettings::intermediate_trace
bool intermediate_trace
Definition: RexxActivation.hpp:128
SCOPE_RELEASED
#define SCOPE_RELEASED
Definition: RexxActivation.hpp:154
RexxCode::getSecurityManager
SecurityManager * getSecurityManager()
Definition: RexxCode.hpp:86
SecurityManager
Definition: SecurityManager.hpp:52
TheFunctionsDirectory
#define TheFunctionsDirectory
Definition: RexxCore.h:175
RexxSource::getTraceSetting
size_t getTraceSetting()
Definition: SourceFile.hpp:402
KEYWORD_LABEL
#define KEYWORD_LABEL
Definition: Token.hpp:178
RexxActivation::getEffectiveSecurityManager
SecurityManager * getEffectiveSecurityManager()
Definition: RexxActivation.cpp:4271
RexxInternalApis.h
RexxCompoundTail::getTail
const char * getTail()
Definition: RexxCompoundTail.hpp:165
RexxActivation::isMethodOrRoutine
bool isMethodOrRoutine()
Definition: RexxActivation.hpp:206
RexxActivation::trace_results_flags
static const size_t trace_results_flags
Definition: RexxActivation.hpp:648
TRACE_OFF
const size_t TRACE_OFF
Definition: SourceFile.hpp:81
BaseExecutable
Definition: MethodClass.hpp:82
RexxActivation::internalCallTrap
RexxObject * internalCallTrap(RexxString *, RexxInstruction *, RexxDirectory *, ProtectedObject &)
Definition: RexxActivation.cpp:2874
RexxActivation::blockNest
size_t blockNest
Definition: RexxActivation.hpp:629
MAX_TRACEBACK_INDENT
#define MAX_TRACEBACK_INDENT
Definition: RexxActivity.hpp:105
RexxObject::numberValue
virtual bool numberValue(wholenumber_t &result, size_t precision)
Definition: ObjectClass.cpp:963
RexxActivation::activation_context
int activation_context
Definition: RexxActivation.hpp:619
RexxDirectory::setEntry
RexxObject * setEntry(RexxString *, RexxObject *)
Definition: DirectoryClass.cpp:382
RexxActivation::handleNovalueEvent
RexxObject * handleNovalueEvent(RexxString *name, RexxObject *defaultValue, RexxVariable *variable)
Definition: RexxActivation.cpp:2250
RexxActivity::generateStackFrames
RexxArray * generateStackFrames(bool skipFirst)
Definition: RexxActivity.cpp:976
RexxActivation
Definition: RexxActivation.hpp:156
RexxActivity::getInstanceSecurityManager
SecurityManager * getInstanceSecurityManager()
Definition: RexxActivity.cpp:2803
RexxInternalObject::setHasNoReferences
void setHasNoReferences()
Definition: ObjectClass.hpp:240
RexxString::strCompare
bool strCompare(const char *s)
Definition: StringClass.hpp:346
RexxStem::compoundVariableExists
bool compoundVariableExists(RexxCompoundTail *resolved_tail)
Definition: StemClass.hpp:138
RexxString::putChar
char putChar(size_t p, char c)
Definition: StringClass.hpp:339
RexxActivation::inDebug
bool inDebug()
Definition: RexxActivation.hpp:363
RexxActivation::pending_count
size_t pending_count
Definition: RexxActivation.hpp:623
RexxSource::TRACE_OFF
static const size_t TRACE_OFF
Definition: SourceFile.hpp:416
RexxActivation::halt
bool halt(RexxString *)
Definition: RexxActivation.cpp:3632
RexxString::concatWithCstring
RexxString * concatWithCstring(const char *)
Definition: StringClass.cpp:1271
new_directory
RexxDirectory * new_directory()
Definition: DirectoryClass.hpp:101
wholenumber_t
ssize_t wholenumber_t
Definition: rexx.h:229
CHAR_CSTDIN
char CHAR_CSTDIN[]
RexxActivation::object_scope
int object_scope
Definition: RexxActivation.hpp:612
RexxActivation::tracingErrors
bool tracingErrors(void)
Definition: RexxActivation.hpp:394
RexxActivationBase::trap
virtual bool trap(RexxString *, RexxDirectory *)
Definition: ObjectClass.hpp:588
RexxActivation::novalueHandler
RexxObject * novalueHandler(RexxString *)
Definition: RexxActivation.cpp:4117
RexxActivation::traceCompoundValue
void traceCompoundValue(int prefix, RexxString *stemName, RexxObject **tails, size_t tailCount, RexxCompoundTail *tail)
Definition: RexxActivation.cpp:3397
RexxActivation::stack
RexxExpressionStack stack
Definition: RexxActivation.hpp:599
RexxActivation::setDefaultAddress
void setDefaultAddress(RexxString *)
Definition: RexxActivation.cpp:1856
TRACE_PREFIX_COMPOUND
Definition: RexxActivity.hpp:90
RexxActivation::reply
void reply(RexxObject *)
Definition: RexxActivation.cpp:1029
RexxActivation::mergeTraps
void mergeTraps(RexxQueue *, RexxQueue *)
Definition: RexxActivation.cpp:2278
RexxActivation::getStreams
RexxDirectory * getStreams()
Definition: RexxActivation.cpp:1770
RexxActivation::trace_labels
static const size_t trace_labels
Definition: RexxActivation.hpp:641
RexxActivation::sourceString
RexxString * sourceString()
Definition: RexxActivation.cpp:3983
RexxInternalObject::getValue
virtual RexxObject * getValue(RexxActivation *)
Definition: ObjectClass.hpp:270
stringsize_t
size_t stringsize_t
Definition: rexx.h:228
RexxActivation::argcount
size_t argcount
Definition: RexxActivation.hpp:607
RexxActivation::digits
size_t digits()
Definition: RexxActivation.cpp:1913
CHAR_ERROR
char CHAR_ERROR[]
RexxCode::interpret
RexxCode * interpret(RexxString *s, size_t n)
Definition: RexxCode.hpp:88
NumericSettings::form
bool form
Definition: Numerics.hpp:55
RexxMessage::error
void error(RexxDirectory *)
Definition: MessageClass.cpp:381
new_list
RexxList * new_list()
Definition: ListClass.hpp:147
RexxActivation::getMessageName
RexxString * getMessageName()
Definition: RexxActivation.hpp:352
RexxActivation::getContextReturnStatus
RexxObject * getContextReturnStatus()
Definition: RexxActivation.cpp:2528
TRACE_RESULTS
const size_t TRACE_RESULTS
Definition: SourceFile.hpp:79
RexxActivity::callHaltClearExit
bool callHaltClearExit(RexxActivation *)
Definition: RexxActivity.cpp:2661
RexxActivity::clearCurrentCondition
void clearCurrentCondition()
Definition: RexxActivity.hpp:320
RexxStem::getCompoundVariableRealValue
RexxObject * getCompoundVariableRealValue(RexxCompoundTail *resolved_tail)
Definition: StemClass.cpp:780
RexxInstruction::isType
bool isType(size_t type)
Definition: RexxInstruction.hpp:78
RexxActivation::isProgramLevelCall
bool isProgramLevelCall()
Definition: RexxActivation.hpp:203
CHAR_RS
char CHAR_RS[]
RexxSource::loadRequires
PackageClass * loadRequires(RexxActivity *activity, RexxString *target)
Definition: SourceFile.cpp:6072
RexxActivation::debug_bypass
static const size_t debug_bypass
Definition: RexxActivation.hpp:654
RexxLocalVariables::isNested
bool isNested()
Definition: RexxLocalVariables.hpp:134
VALUE_MARKER
#define VALUE_MARKER
Definition: RexxActivity.hpp:99
RexxActivity::setRandomSeed
void setRandomSeed(uint64_t seed)
Definition: RexxActivity.hpp:292
RexxActivation::getTraceBack
RexxString * getTraceBack()
Definition: RexxActivation.cpp:2925
RexxSource::TRACE_INTERMEDIATES
static const size_t TRACE_INTERMEDIATES
Definition: SourceFile.hpp:415
RexxActivity::callHaltTestExit
bool callHaltTestExit(RexxActivation *)
Definition: RexxActivity.cpp:2631
RexxActivation::evaluateLocalCompoundVariable
RexxObject * evaluateLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
Definition: RexxActivation.cpp:4145
CHAR_ANY
char CHAR_ANY[]
RexxActivation::setObjNotify
void setObjNotify(RexxMessage *)
Definition: RexxActivation.cpp:4029
SystemInterpreter::getSourceString
static RexxString * getSourceString(RexxString *callType, RexxString *programName)
Definition: MiscSystem.cpp:144
CHAR_ROUTINES
char CHAR_ROUTINES[]
RexxActivation::getNumericSettings
virtual NumericSettings * getNumericSettings()
Definition: RexxActivation.cpp:2030
TheNilObject
#define TheNilObject
Definition: RexxCore.h:180
ActivityManager::currentActivity
static RexxActivity *volatile currentActivity
Definition: ActivityManager.hpp:95
RexxActivation::setAddress
void setAddress(RexxString *)
Definition: RexxActivation.cpp:1843
RexxActivation::isProgramOrMethod
bool isProgramOrMethod()
Definition: RexxActivation.hpp:205
RexxActivation::dispatch
RexxObject * dispatch()
Definition: RexxActivation.cpp:372
RexxActivation::trace_errors
static const size_t trace_errors
Definition: RexxActivation.hpp:642
VARIABLE_SUPER
#define VARIABLE_SUPER
Definition: RexxLocalVariables.hpp:55
RexxActivation::getSecurityManager
SecurityManager * getSecurityManager()
Definition: RexxActivation.cpp:4259
RexxActivation::rexxVariable
RexxObject * rexxVariable(RexxString *)
Definition: RexxActivation.cpp:2404
RexxActivation::cleanupLocalVariables
void cleanupLocalVariables()
Definition: RexxActivation.hpp:570
SystemInterpreter::qualifyFileSystemName
static RexxString * qualifyFileSystemName(RexxString *name)
Definition: FileSystem.cpp:218
Error_Routine_not_found_name
#define Error_Routine_not_found_name
Definition: RexxErrorCodes.h:382
FRAME_ROUTINE
#define FRAME_ROUTINE
Definition: StackFrameClass.hpp:50
RexxActivation::setFuzz
void setFuzz()
Definition: RexxActivation.cpp:1956
RexxActivation::run
RexxObject * run(RexxObject *_receiver, RexxString *msgname, RexxObject **_arglist, size_t _argcount, RexxInstruction *start, ProtectedObject &resultObj)
Definition: RexxActivation.cpp:383
RexxActivity::getLocalEnvironment
RexxObject * getLocalEnvironment(RexxString *name)
Definition: RexxActivity.cpp:3200
RexxActivation::trace_on
static const size_t trace_on
Definition: RexxActivation.hpp:658
RexxActivation::raise
void raise(RexxString *, RexxObject *, RexxString *, RexxObject *, RexxObject *, RexxDirectory *)
Definition: RexxActivation.cpp:1553
RexxActivation::isRexxContext
virtual bool isRexxContext()
Definition: RexxActivation.cpp:2019
RexxList::getSize
size_t getSize()
Definition: ListClass.hpp:126
RexxActivation::isElapsedTimerReset
bool isElapsedTimerReset()
Definition: RexxActivation.hpp:418
DEBUG_ON
const int DEBUG_ON
Definition: SourceFile.hpp:92
RexxActivity.hpp
RexxActivation::setConditionObj
void setConditionObj(RexxDirectory *condition)
Definition: RexxActivation.hpp:359
RexxActivation::set_trace_on
static const size_t set_trace_on
Definition: RexxActivation.hpp:664
RexxActivation::setGuarded
void setGuarded()
Definition: RexxActivation.hpp:411
RexxSource::DEBUG_ON
static const size_t DEBUG_ON
Definition: SourceFile.hpp:429
RexxActivation::getLabels
RexxDirectory * getLabels()
Definition: RexxActivation.cpp:3975
RexxDirectory::remove
RexxObject * remove(RexxString *)
Definition: DirectoryClass.cpp:433
CHAR_LINE
char CHAR_LINE[]
RexxActivationBase::getExecutableObject
RexxObject * getExecutableObject()
Definition: ObjectClass.hpp:599
RexxActivation::senderActivation
RexxActivation * senderActivation()
Definition: RexxActivation.cpp:2337
RexxInstruction::execute
virtual void execute(RexxActivation *, RexxExpressionStack *)
Definition: RexxInstruction.hpp:71
Error_Invalid_leave_iterate
#define Error_Invalid_leave_iterate
Definition: RexxErrorCodes.h:240
RexxActivation::dropLocalCompoundVariable
void dropLocalCompoundVariable(RexxString *stemName, size_t index, RexxObject **tail, size_t tailCount)
Definition: RexxActivation.cpp:4242
RexxString::put
void put(size_t s, const void *b, size_t l)
Definition: StringClass.hpp:335
RexxActivation::RexxActivation
RexxActivation()
Definition: RexxActivation.cpp:145
RexxActivity::isClauseExitUsed
bool isClauseExitUsed()
Definition: RexxActivity.hpp:216
CHAR_SYNTAX
char CHAR_SYNTAX[]
RexxActivation::setElapsedTimerInvalid
void setElapsedTimerInvalid()
Definition: RexxActivation.hpp:419
RoutineClass::fromFile
static RoutineClass * fromFile(RexxString *filename)
Definition: RoutineClass.cpp:845
RexxLocalVariables::setNested
void setNested()
Definition: RexxLocalVariables.hpp:132
ActivationSettings::conditionObj
RexxDirectory * conditionObj
Definition: RexxActivation.hpp:105
RexxActivationBase::getPreviousStackFrame
RexxActivationBase * getPreviousStackFrame()
Definition: ObjectClass.hpp:597
Message_Translations_sourceless_routine_invocation
#define Message_Translations_sourceless_routine_invocation
Definition: RexxErrorCodes.h:625
InterpreterInstance.hpp
RexxExpressionStack::getFrame
RexxObject ** getFrame()
Definition: ExpressionStack.hpp:94
SystemInterpreter::getCurrentTime
static void getCurrentTime(RexxDateTime *Date)
Definition: TimeSupport.cpp:58
Error_Invalid_trace_trace
#define Error_Invalid_trace_trace
Definition: RexxErrorCodes.h:185
RexxExpressionStack::migrate
void migrate(RexxActivity *)
Definition: ExpressionStack.cpp:97
RexxSource::traceBack
RexxString * traceBack(RexxActivation *, SourceLocation &, size_t, bool)
Definition: SourceFile.cpp:946
PREFIX_OFFSET
#define PREFIX_OFFSET
Definition: RexxActivation.cpp:3138
RexxActivation::getStackFrames
RexxArray * getStackFrames(bool skipFirst)
Definition: RexxActivation.cpp:4382
ActivationSettings::return_status
int return_status
Definition: RexxActivation.hpp:123
RexxActivation::isGuarded
bool isGuarded()
Definition: RexxActivation.hpp:410
RexxCore.h
RexxActivity::spawnReply
RexxActivity * spawnReply()
Definition: RexxActivity.cpp:292
RexxSource::TRACE_NORMAL
static const size_t TRACE_NORMAL
Definition: SourceFile.hpp:411
RexxActivation::trace_intermediates_flags
static const size_t trace_intermediates_flags
Definition: RexxActivation.hpp:649
RexxActivation::guardWait
void guardWait()
Definition: RexxActivation.cpp:2894
RexxSource::findClass
RexxClass * findClass(RexxString *)
Definition: SourceFile.cpp:1609<