Commit 588d9145 authored by Erick Gallesio's avatar Erick Gallesio

Added the --evaluate option to stklos-compile

parent 709e18bd
......@@ -28,13 +28,17 @@ poor, it should be extended in the future.
Here are the options available in the version @VERSION@ of
.B stklos.
.IP "--case-sensitive, -c"
Symbols are case sensitive
.IP "--output=<file>, -o <file>"
Output the compiled code in the given file instead of
.I a.out.
.IP "--case-sensitive, -c"
Symbols are case sensitive
.IP "--C-code, -C"
Produce the byte-code in a C file instead of a ".ostk" file.
.IP "--evalute=<expr>, e <expr>"
Evaluate the Sexpr <expr> before starting compilation. This is useful,
for loading files which are needed for the compilation (e.g. files
defining new syntaxes).
.IP "--line-info, -l"
Generate line informations to ease debugging (incurs a small
performance penalty).
......
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@essi.fr]
;;;; Creation date: 29-Mar-2005 14:58 (eg)
;;;; Last file update: 13-Nov-2006 18:56 (eg)
;;;; Last file update: 5-Dec-2006 18:50 (eg)
;;;;
;; ----------------------------------------------------------------------
......@@ -29,12 +29,12 @@
;; ----------------------------------------------------------------------
(define (header in out)
(format out "/*
This file was automatically generated on ~A by make-C-boot
This file was automatically generated by make-C-boot
This is a dump of the image in file ~A
***DO NOT EDIT BY HAND***
*/
#include \"stklos.h\"\n\n" (date) (port-file-name in)))
#include \"stklos.h\"\n\n" (port-file-name in)))
;; ----------------------------------------------------------------------
;; write-boot-file ...
......
/*
This file was automatically generated on Tue Dec 5 12:08:03 2006 by make-C-boot
This file was automatically generated by make-C-boot
This is a dump of the image in file /mnt/users/eg/Projects/STklos/lib/boot.img3
***DO NOT EDIT BY HAND***
*/
......
......@@ -21,12 +21,12 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 4-Dec-2001 18:12 (eg)
;;;; Last file update: 3-Nov-2006 16:04 (eg)
;;;; Last file update: 5-Dec-2006 18:53 (eg)
;;;;
(define *output* "a.out")
(define *c-code* #f)
(define *expr* #f)
;; ----------------------------------------------------------------------
;; convert-to-C ...
......@@ -109,12 +109,18 @@
"Usage: stklos-compile [options] file"
"Compile a stklos file to byte codes"
""
(("output" :alternate "o" :arg file :help "Output compiled code in <file>")
(set! *output* file))
"Input options"
(("case-sensitive" :alternate "c" :help "Be case sensitive on symbols")
(read-case-sensitive #t))
"Output options"
(("output" :alternate "o" :arg file :help "Output compiled code in <file>")
(set! *output* file))
(("C-code" :alternate "C" :help "Produce C code")
(set! *c-code* #t))
"Compiling options"
(("evaluate" :alternate "e" :arg expr
:help "evaluate <expr> before compiling file")
(set! *expr* expr))
(("line-info" :alternate "l" :help "Insert line numbers in generated file")
(compiler:gen-line-number #t))
(("no-time" :help "Don't display compilation time")
......@@ -125,6 +131,13 @@
(else
(cond
((= (length other-arguments) 1)
;; Evaluate prelude code
(when (string? *expr*)
(with-handler (lambda (c)
(die (format "Error in --evaluate ~A option" *expr*)))
(eval (read-from-string *expr*)
(interaction-environment))))
;; Produce code
(if *c-code*
(compile-to-C-code (car other-arguments) *output*)
(compile-to-bytecode (car other-arguments) *output*))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment