[comp.sys.handhelds] specifying paths w/variables & progs

231b3618@fergvax.unl.edu (Ben Hollingsworth) (04/05/91)

All this talk of renaming variables on the 48sx has made
me wonder:  is it possible to specify a path when naming/
executing a variable/program?  Or how about jumping 
instantly to a given directory (like cd)?

I haven't yet read all 900 pages of the manuals, so it may
be in there and I just haven't seen it, but even so, does
anyone know if this can be done?

				Just curious,
				Obi-Wan

-- 
 |\_/|  AACK! || The views expressed || "Obi-Wan" (Ben Hollingsworth)
\'o.0'/       || are those of myself || MicroImages, Inc.      Lincoln, Nebraska
=(___)=       || and everybody else  || University of Nebraska - Lincoln
   U   PTHAT! || I've ever met.      || email:          231b3618@fergvax.unl.edu
 |\_/|  AACK! || The views expressed || "Obi-Wan" (Ben Hollingsworth)
\'o.0'/       || are those of myself || MicroImages, Inc.      Lincoln, Nebraska
=(___)=       || and everybody else  || University of Nebraska - Lincoln
   U   PTHAT! || I've ever met.      || email:          231b3618@fergvax.unl.edu

rkb@po.CWRU.Edu (Robert K. Brunner) (04/05/91)

In a previous article, 231b3618@fergvax.unl.edu (Ben Hollingsworth) says:

>All this talk of renaming variables on the 48sx has made
>me wonder:  is it possible to specify a path when naming/
>executing a variable/program?  Or how about jumping 
>instantly to a given directory (like cd)?
>

Suppose you have the following directory structure:

{ HOME }
SUBDIR1  (A directory in the home menu)
SUBDIR2  (A directory in the SUBDIR1 menu)
MYPROG   (A program in SUBDIR2)

The command:
{ HOME SUBDIR1 SUBDIR2 } EVAL will change the current directory
to SUBDIR2 from anywhere.  (Like cd \subdir1\subdir2 )

{ SUBDIR1 SUBDIR2 } EVAL will change the current directory
to SUBDIR2 from HOME.      (Like cd .\subdir1\subdir2 )

{ HOME SUBDIR1 SUBDIR2 MYPROG } EVAL will change the current directory
to SUBDIR2 from anywhere and execute MYPROG.  After MYPROG terminates,
{ HOME SUBDIR1 SUBDIR2 } remains the current directory.  This is a very
annoying feature.

{ HOME SUBDIR1 SUBDIR2 MYPROG } RCL EVAL will run MYPROG without changing
the current directory.

Gotta go now.

Robert

sburke@jarthur.Claremont.EDU (Scott Burke) (04/05/91)

Way back when there was a lot of talk about setting up a Work directory, so
that all the miscellaneous useful utilities could be left in the HOME
directory.  Others have gone to libraries, so that their utilities were
available anywhere.  Here's a simple alternative, which was touched upon in
the original post to which I am responding:

Put this program in HOME:

EXEC
\<<
  PATH \-> path
  \<<
    HOME EVAL path EVAL
  \>>
\>>

Then, make CST do all the work by storing softkey definitions such as:

{ "SEE" \<< { UTILS SEE } EXEC \>> }

This executes EXEC, which requires something to do on the stack--in this
case, a list providing the path to the utility SEE inside the HOME UTILS
sub-directory.  EXEC is polite and returns you to your original directory
after executing the chosen utility, unless that utility somehow badly 
crashes.

Scott.

d89-mlt@sm.luth.se (Morgan Lindqvist) (04/05/91)

231b3618@fergvax.unl.edu (Ben Hollingsworth) writes:

>All this talk of renaming variables on the 48sx has made
>me wonder:  is it possible to specify a path when naming/
>executing a variable/program?  Or how about jumping 
>instantly to a given directory (like cd)?

1) When I want to run a program on an other directory in a program I do
   like this:

   \<< ... { HOME BINP ASC\-> } PP ... \>>

   This program runs ASC\-> on directory BINP under HOME.
   PP (Path Program ) is on HOME and looks like this:

   \<< PATH \-> path \<< EVAL path EVAL \>> \>>

2) If you just want to jumb to the directory BINP just key in:
   { HOME BINP } EVAL

Morgan Lindqvist d89-mlt@sm.luth.se

jthornto@ee.ubc.ca (Johan Thornton) (04/17/91)

In article <1523@tau.sm.luth.se> d89-mlt@sm.luth.se (Morgan Lindqvist) writes:
->231b3618@fergvax.unl.edu (Ben Hollingsworth) writes:
>
->>All this talk of renaming variables on the 48sx has made
->>me wonder:  is it possible to specify a path when naming/
->>executing a variable/program?  Or how about jumping
->>instantly to a given directory (like cd)?
->
>1) When I want to run a program on an other directory in a program I do
->   like this:
->
->   \<< ... { HOME BINP ASC\-> } PP ... \>>
->
->   This program runs ASC\-> on directory BINP under HOME.
->   PP (Path Program ) is on HOME and looks like this:
->
->   \<< PATH \-> path \<< EVAL path EVAL \>> \>>
->
->2) If you just want to jumb to the directory BINP just key in:
->   { HOME BINP } EVAL
->
->Morgan Lindqvist d89-mlt@sm.luth.se


This is not a bad idea.  Not much overhead at all.  But note that you
don't have to explicitly say HOME when switching to the BINP directory.
Since that subdirectory is in HOME, it's always in the path.

Likewise for 2), above -- to go to the BINP subdir just execute BINP.


-- 
Johan Thornton
(but my friends call me jthornto@ee.ubc.ca)

edp@jareth.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) (04/20/91)

In article <1617@fs1.ee.ubc.ca>, jthornto@ee.ubc.ca (Johan Thornton) writes:

>->2) If you just want to jumb to the directory BINP just key in:
>->   { HOME BINP } EVAL
>->
>->Morgan Lindqvist d89-mlt@sm.luth.se
>
>
>This is not a bad idea.  Not much overhead at all.  But note that you
>don't have to explicitly say HOME when switching to the BINP directory.
>Since that subdirectory is in HOME, it's always in the path.

That will not always work.  There could be another BINP somewhere along
the current path, in which case evaluating BINP will switch to that
directly.  It is necessary to start from HOME.

Even this can fail if typed in, because local variables can have the
same names as built-in commands.  For example, type \<< 8 \-> HOME \<<
HALT \>> \>>.  Then press EVAL.  If you type in { HOME } and press EVAL
now, you will get 8 on the stack and will not be in the home directory. 
(If { HOME BINP } were entered into a program at a time when there were
no HOME or BINP local variables active, it would be parsed as expected
and would evaluate to the appropriate directory even if evaluated when
local variables were active.)



				-- edp (Eric Postpischil)
				"Always mount a scratch monkey."
				edp@jareth.enet.dec.com

rrd@hpfcso.FC.HP.COM (Ray Depew) (04/22/91)

> Even this can fail if typed in, because local variables can have the
> same names as built-in commands.  For example, type \<< 8 \-> HOME \<<
> HALT \>> \>>.  Then press EVAL.  If you type in { HOME } and press EVAL
> now, you will get 8 on the stack and will not be in the home directory. 
> (If { HOME BINP } were entered into a program at a time when there were
> no HOME or BINP local variables active, it would be parsed as expected
> and would evaluate to the appropriate directory even if evaluated when
> local variables were active.)

I think that assigning variable names such as "HOME" ( or "CLVAR" ) falls
under the heading of "stupid things a user should not do".  If the user
avoids using "HOME" as a variable name, then the { HOME nextdir } idea
should work fine.

Of course, I know that Eric would never do anything like this, and he was
just proposing a hypothetical situation ....


Regards
Ray Depew
HP ICBD -- IC's By Decree
rrd@hpfitst1.hp.com

bqt@cia.docs.uu.se (Johnny Billquist) (04/26/91)

In <1617@fs1.ee.ubc.ca> jthornto@ee.ubc.ca (Johan Thornton) writes:

>In article <1523@tau.sm.luth.se> d89-mlt@sm.luth.se (Morgan Lindqvist) writes:
[stuff deleted...]
>This is not a bad idea.  Not much overhead at all.  But note that you
>don't have to explicitly say HOME when switching to the BINP directory.
>Since that subdirectory is in HOME, it's always in the path.

>Likewise for 2), above -- to go to the BINP subdir just execute BINP.

Not neccesaryily true!

Suppode your directory structure looks like this:

HOME
 |
FOO
 |
FOO
 |
BAR

and you are currently in {HOME FOO FOO BAR}

{FOO} EVAL
and
{HOME FOO} EVAL
does not give the same result.

Not to mention if you have a variable in the current directory with
the same name as the directory you want to switch to.
There are some more possible ways to foul up, so keep sticking to
{HOME ... } when you want to specify a directory.

======================================================================
Everybody know that the DECstation	- I'm on a bus
is a pdp8, which is a RISC, but		- on a psychodelic trip,
where did MIPS computers get into it?	- reading murder books
					- and tryin' to stay hip.

	- Johnny Billquist		- Billy Idol

D89.JOHNNY-BILLQUIST@AIDA.CSD.UU.SE
======================================================================