Node:Invoking mixguile, Next:, Previous:mixguile, Up:mixguile



Invoking mixguile

Invoking mixguile without arguments will enter the Guile REPL (read-eval-print loop) after loading, if it exists, the user's initialisation file (~/.mdk/mixguile.scm).

mixguile accepts the same command line options than Guile:

     mixguile [-s SCRIPT] [-c EXPR] [-l FILE] [-e FUNCTION] [-qhv]
              [--help] [--version]
     

The meaning of these options is as follows:

-h User Option
-help User Option
Prints usage summary and exits.

-v User Option
-version User Option
Prints version and copyleft information and exits.

-s SCRIPT User Option
Loads Scheme code from script, evaluates it and exits. This option can be used to write executable Scheme scripts, as described in Scheme scripts.

-c EXPR User Option
Evaluates the given Scheme expression and exits.

-l FILE User Option
Loads the given Scheme file and enters the REPL (read-eval-print loop).

-e FUNCTION User Option
After reading the script, executes the given function using the provided command line arguments. For instance, you can write the following Scheme script:
          #! /usr/bin/mixguile \
          -e main -s
          !#
          
          ;;; execute a given program and print the registers.
          
          (define main
            (lambda (args)
              ;; load the file provided as a command line argument
              (mix-load (cadr args))
              ;; execute it
              (mix-run)
              ;; print the contents of registers
              (mix-pall)))
          
          

save it in a file called, say, foo, make it executable, and run it as

          $ ./foo hello
          

This invocation will cause the evaluation of the main function with a list of command line parameters as its argument (("./foo" "hello") in the above example. Note that command line options to mixguile must be written in their own line after the \ symbol.

-q User Option
Do not load user's initialisation file. When mixguile starts up, it looks for a file named mixguile.scm in the user's MDK configuration directory (~/.mdk), and loads it if it exists. This option tells mixguile to skip this initialisation file loading.