Next: , Previous: mixguile, Up: mixguile


8.1 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:

— User Option: -h
— User Option: –help

Prints usage summary and exits.

— User Option: -v
— User Option: –version

Prints version and copyleft information and exits.

— User Option: -s SCRIPT

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

— User Option: -c EXPR

Evaluates the given Scheme expression and exits.

— User Option: -l FILE

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

— User Option: -e FUNCTION

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.

— User Option: -q

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.