From: Rick M. <obj...@gm...> - 2008-10-15 20:41:29
|
The test should be isTopLevelCall(). There's only a parent available if this is an internal routine call, interpret, or line typed at a debug pause (which is essentially an interpret). Rick On Wed, Oct 15, 2008 at 4:37 PM, Mark Miesfeld <mie...@gm...> wrote: > This relatively simple program (distilled from something else I was > doing) crashes the interpreter: (revision 3546.) > > j = canWrite("tmp.file") > > ::routine canWrite > use strict arg tmpFile > > j = lineout(tmpFile, "Delete this file if you find it") > j = lineout(tmpFile) > return "" > > In getStreams() there is this code: > > /* first entry into here? */ > if (this->isProgramOrMethod()) > { > /* always use a new directory */ > this->settings.streams = new_directory(); > } > else > { > /* alway's use caller's for internal */ > /* call, external call or interpret */ > this->settings.streams = this->parent->getStreams(); > } > > activation_context is 0x20 so isProgramOrMethod() returns false. But, > this->parent is null so the this->settings.streams = > this->parent->getStreams() crashes. > > Matching up the addresses of the RexxActivation objects, the object > where the crash is was created in this constructor: > > /** > * Create a top-level activation of Rexx code. This will > * either a toplevel program or an external call. > * > ... > RexxActivation::RexxActivation(RexxActivity *_activity, RoutineClass > *_routine, RexxCode *_code, > RexxString *calltype, RexxString *env, int context) > ... > this->parent = OREF_NULL; // there's no parent for a > top level call > > In that constructor call, the passed in context is 0x20 and the > RoutineClass object has an executable name of CANWRITE > > and then I run out of steam. <grin> > > I'm not sure if the line: > > if (this->isProgramOrMethod()) > > should be: > > if (this->isTopLevelCall()) > > or if the wrong RexxActivation constructor is being called. Or, > something altogether different. ;-( > > Seems like the right constructor, because it is a routine. Maybe the > wrong context value passed in? > > -- > Mark Miesfeld > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Oorexx-devel mailing list > Oor...@li... > https://lists.sourceforge.net/lists/listinfo/oorexx-devel > |