command environments and command line arguments 
Author Message
 command environments and command line arguments

Do any Scheme implementations have functions for accessing command
environment variables (using getenv)?

Do any Scheme implementations have functions for accessing command
line arguments (scheme -heap 32423 foo.scm ...)?



Sat, 19 Feb 1994 04:19:26 GMT  
 command environments and command line arguments

   Do any Scheme implementations have functions for accessing command
   line arguments (scheme -heap 32423 foo.scm ...)?

Doesn't siod have command line switches?  But then, is it Scheme?  OK, OK,
erase that last sentence.  Forget I _even_ thought of it.

-- Vladimir
--
Vladimir G. Ivanovic                            Sun Microsystems, Inc
(415) 336-2315                                  MTV12-33

{decwrl,hplabs,ucbvax}!sun!Eng!vladimir         Mountain View, CA 94043-1100
                         Disclaimer: I speak for myself.



Sat, 19 Feb 1994 14:49:10 GMT  
 command environments and command line arguments

Quote:

> Do any Scheme implementations have functions for accessing command
> environment variables (using getenv)?

The `unix' extension of Elk has such a primitive.  Evaluating

   (require 'unix 'unix.o)     or     (load 'unix.o)

in the top-level defines (among others) a primitive `getenv'.  It
expects as argument a string or symbol (the name of the environment
variable) and returns the variable's value as a string (or #f if it
isn't there).

Quote:
> Do any Scheme implementations have functions for accessing command
> line arguments (scheme -heap 32423 foo.scm ...)?

In Elk the shell command line arguments are available through a
primitive `command-line-args'; it returns the arguments as a list of
strings.  However, the options to the interpreter are not accessible
from within a Scheme program.  If one wants to pass options to the
Scheme program, they have to be delimited from the `real' options
by `--'.  Example:

   % scheme -h 1024 -- -i foo bar
   > (command-line-args)
   ("-i" "foo" "bar")
   >

--



Sat, 19 Feb 1994 16:20:05 GMT  
 command environments and command line arguments

Quote:

> Do any Scheme implementations have functions for accessing command
> line arguments (scheme -heap 32423 foo.scm ...)?

Yale T has a function command-line which returns a list containing the
command line used to invoke T:

occs$ t -h 10000000
10000000 bytes per heap, 131071 bytes reserved
T 3.1 (13) MIPS/UNIX  Copyright (C) 1989 Yale University
;Loading  /usr/users/guest/carlton/init.t into USER-ENV
[Redefining SUBSTRING]
T Top level

Quote:
> (command-line)

("t" "-h" "10000000")

Personally, I would prefer having a global variable *command-line* - I
think that the Scheme standard could stand having an infusion of
global variables - but that is another question entirely.

david carlton

       Th' MIND is the Pizza Palace of th' SOUL



Sun, 20 Feb 1994 03:54:40 GMT  
 command environments and command line arguments
Quote:

> Do any Scheme implementations have functions for accessing command
> environment variables (using getenv)?

> Do any Scheme implementations have functions for accessing command
> line arguments (scheme -heap 32423 foo.scm ...)?

In PC Scheme (from Texas Instruments) the undocumented variable
PCS-INITIAL-ARGUMENTS contains the command line arguments.
I call PCS via a batch file that contains:
...
set > $$$env.
pcs

And my scheme.ini file contains
code to read the contents of $$$env.

Pierre Chartier



Tue, 22 Feb 1994 12:54:19 GMT  
 command environments and command line arguments

Incase anybody cares... here's another datapoint.

If your Lisp has a Motif or Xtoolkit interface, and the implementation pays
attention to initializing your Lisp application correctly with respect to
the Xtoolkit (some don't), you can access the command line arguments via
the resources XtNargv/XtNargc on the application-shell widget returned by
XtInitialize() (or the equivalent calls to XtToolkitInitialize() &
XtCreateApplicationContext() & XtOpenDisplay() & XtAppCreateShell()...)

In WINTERP (my XLISP-based Motif Widget INTERPreter), access to these
arrays is provided by APPLICATION_SHELL_WIDGET_CLASS method :GET_ARGV and
:SET_ARGV. For example, evaling the following s-exp on the current WINTERP
invocation:
        (send *toplevel_widget* :get_argv)
returns the array
        #(winterp -no_xtwarn_brk
          -unix_socket_file /usr/local/mayer/.winterp_serv
          -init_file /usr/local/mayer/.winterp -iconic)

FYI, the :get_argv / :set_argv methods are particularly useful for having X
session managers automaticaly restart an application that has been
terminated by the session manager at the end of the previous session.
Sometimes you need to call :set_argv if the application wants itsef to
start up with a modified argument list the next time it is run. An example
of a session manager that supports such restarting is HP's VUE.

-------------------------------------------------------------------------------

                  Human-Computer Interaction Department
                       Hewlett-Packard Laboratories
                              Palo Alto, CA.
                                   *



Wed, 23 Feb 1994 05:11:49 GMT  
 command environments and command line arguments

   Personally, I would prefer having a global variable *command-line* - I
   think that the Scheme standard could stand having an infusion of
   global variables - but that is another question entirely.

It has a lot of global variables!  They happen to have procedures as
values, not other objects. :-)



Mon, 07 Mar 1994 07:13:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Command Line Arguments & Environment Variables Proposal

2. Fortran command to read command line argument?

3. command line/environment: example

4. Harlequin Q: Command line args / environment variables

5. J hack capturing command line arguments

6. Command Line Arguments

7. Command line argument

8. Command line arguments

9. How do you obtain command line arguments?

10. Command line arguments

11. COMMAND LINES ARGUMENTS IN WIN32FOR 3.3

12. Command Line Arguments in Labview

 

 
Powered by phpBB® Forum Software