From: MattG on
I would like to reference a program in a subdirectory from another
program in the parent. Kind of like storing various subroutines that
I can call from other programs. How is this done? I thought that it
would work simply by storing the program in the subdirectory of the
parent but it simply put the name of the other program on the stack.

Thanks for your help!!


Matt
From: Yann on
You need to handle the "path" context in this case.

Rule is : a program in a subdirectory can call programs in higher
directories (such as programs in HOME for example).
The other way round is not correct : a program in higher directory
level cannot "see" programs/variables in lower levels.

So for example, let's say you want to call your program "ROUTINE"
stored in a subdirectory called "SUBDIR".
In your main program, you simply call :
<< SUBDIR ROUTINE >>
Pretty simple isn't it ?
Note in this case, you'll finish your program in subdirectory ROUTINE.

So if you want to finish back in your original directory, you need to
add an UPDIR :
<< SUBDIR ROUTINE UPDIR >>
From: Martin Bruckmeier on

Yann hat geschrieben:
> You need to handle the "path" context in this case.

{ HOME SUBDIR ROUTINE } RCL EVAL

This is done without changing the directory.

>
> Rule is : a program in a subdirectory can call programs in higher
> directories (such as programs in HOME for example).
> The other way round is not correct : a program in higher directory
> level cannot "see" programs/variables in lower levels.
>
> So for example, let's say you want to call your program "ROUTINE"
> stored in a subdirectory called "SUBDIR".
> In your main program, you simply call :
> << SUBDIR ROUTINE >>
> Pretty simple isn't it ?
> Note in this case, you'll finish your program in subdirectory ROUTINE.
>
> So if you want to finish back in your original directory, you need to
> add an UPDIR :
> << SUBDIR ROUTINE UPDIR >>
From: Virgil on
In article <h71c6r$8fv$1(a)svr7.m-online.net>,
Martin Bruckmeier <m.b(a)tiscali.de> wrote:

> Yann hat geschrieben:
> > You need to handle the "path" context in this case.
>
> { HOME SUBDIR ROUTINE } RCL EVAL
>
> This is done without changing the directory.

If SUBDIR is actually a subdirectory of the current directory and that
current directory is not the home directory , your sequence of commands,
will not work because of the HOME will take you out of the current
directory, but
{ SUBDIR ROUTINE } RCL EVAL
will work regardless of which directory your are in, so long as the
current directory contains SUBDIR as an immediate subdirectory and that
SUBDIR contains the routine ROUTINE.
>
> >
> > Rule is : a program in a subdirectory can call programs in higher
> > directories (such as programs in HOME for example).
> > The other way round is not correct : a program in higher directory
> > level cannot "see" programs/variables in lower levels.
> >
> > So for example, let's say you want to call your program "ROUTINE"
> > stored in a subdirectory called "SUBDIR".
> > In your main program, you simply call :
> > << SUBDIR ROUTINE >>
> > Pretty simple isn't it ?
> > Note in this case, you'll finish your program in subdirectory ROUTINE.
> >
> > So if you want to finish back in your original directory, you need to
> > add an UPDIR :
> > << SUBDIR ROUTINE UPDIR >>
From: opticsmith on
In general (or at least in my case ... ;-) ) programs stored in other
directories might need access to other programs in their own
directory. So code like the following is useful. Please excuse my not
using the proper 3-character glyph substitutes; the code is simple
enough that I hope it is clear.
Say the routine you want is PROG1 in DIR2 under DIR1 in HOME.
<< PATH -> MyPath << ... [code you need before calling PROG1 ...]
{DIR1 DIR2} EVAL PROG1 MyPath EVAL ... >> >>
That is, save the local path in a local variable, then when you need
to run PROG1 switch to its directory and then, when done, return to
the starting directory. If your routine has other local variables,
place them appropriately before the PATH call and place their names
before MyPath. If PROG1 has no need of any stuff in its own directory
path chain, then replace {DIR1 DIR2} EVAL PROG1 with simply {DIR1 DIR2
PROG1} RCL EVAL.
Irl
On Aug 25, 3:28 pm, Virgil <Vir...(a)home.esc> wrote:
> In article <h71c6r$8f...(a)svr7.m-online.net>,
>  Martin Bruckmeier <m...(a)tiscali.de> wrote:
>
> > Yann hat geschrieben:
> > > You need to handle the "path" context in this case.
>
> > { HOME SUBDIR ROUTINE } RCL EVAL
>
> > This is done without changing the directory.
>
> If SUBDIR is actually a subdirectory of the current directory and that
> current directory is not the home directory , your sequence of commands,  
> will not work because of the HOME will take you out of the current
> directory,  but
>    { SUBDIR ROUTINE } RCL EVAL
> will work regardless of which directory your are in, so long as the
> current directory contains SUBDIR as an immediate subdirectory and that
> SUBDIR contains the routine ROUTINE.
>
>
>
> > > Rule is : a program in a subdirectory can call programs in higher
> > > directories (such as programs in HOME for example).
> > > The other way round is not correct : a program in higher directory
> > > level cannot "see" programs/variables in lower levels.
>
> > > So for example, let's say you want to call your program "ROUTINE"
> > > stored in a subdirectory called "SUBDIR".
> > > In your main program, you simply call :
> > > << SUBDIR ROUTINE >>
> > > Pretty simple isn't it ?
> > > Note in this case, you'll finish your program in subdirectory ROUTINE..
>
> > > So if you want to finish back in your original directory, you need to
> > > add an UPDIR :
> > > << SUBDIR ROUTINE UPDIR >>