mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
move guilec and guile-disasm to be guile-tools scripts
* .gitignore: Some touchups. * configure.in: * src/.cvsignore: * src/Makefile.am: * Makefile.am: No more src/. * scripts/compile: * scripts/disassemble: Moved here from src/ and changed into guile-tools scripts. * scripts/Makefile.am: Add the new scriptes. * guilec.mk: Adapt to new way of invoking the compiler.
This commit is contained in:
parent
89c95c460b
commit
72f7452826
11 changed files with 138 additions and 108 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -37,7 +37,7 @@ autom4te.cache
|
||||||
benchmark-guile
|
benchmark-guile
|
||||||
check-guile
|
check-guile
|
||||||
check-guile.log
|
check-guile.log
|
||||||
compile
|
build-aux/compile
|
||||||
confdefs.h
|
confdefs.h
|
||||||
config.build-subdirs
|
config.build-subdirs
|
||||||
config.cache
|
config.cache
|
||||||
|
|
|
@ -26,7 +26,7 @@ AUTOMAKE_OPTIONS = 1.10
|
||||||
|
|
||||||
SUBDIRS = lib oop libguile ice-9 guile-config guile-readline emacs \
|
SUBDIRS = lib oop libguile ice-9 guile-config guile-readline emacs \
|
||||||
scripts srfi doc examples test-suite benchmark-suite lang am \
|
scripts srfi doc examples test-suite benchmark-suite lang am \
|
||||||
src module testsuite
|
module testsuite
|
||||||
|
|
||||||
bin_SCRIPTS = guile-tools
|
bin_SCRIPTS = guile-tools
|
||||||
|
|
||||||
|
|
|
@ -1555,7 +1555,6 @@ AC_CONFIG_FILES([
|
||||||
srfi/Makefile
|
srfi/Makefile
|
||||||
test-suite/Makefile
|
test-suite/Makefile
|
||||||
test-suite/standalone/Makefile
|
test-suite/standalone/Makefile
|
||||||
src/Makefile
|
|
||||||
module/Makefile
|
module/Makefile
|
||||||
module/system/Makefile
|
module/system/Makefile
|
||||||
module/system/base/Makefile
|
module/system/base/Makefile
|
||||||
|
|
|
@ -8,4 +8,4 @@ CLEANFILES = $(GOBJECTS)
|
||||||
|
|
||||||
SUFFIXES = .scm .go
|
SUFFIXES = .scm .go
|
||||||
.scm.go:
|
.scm.go:
|
||||||
$(top_builddir)/pre-inst-guile -s \$(top_builddir)/src/guilec $<
|
$(top_builddir)/pre-inst-guile-env $(top_builddir)/guile-tools compile $<
|
||||||
|
|
|
@ -25,6 +25,8 @@ AUTOMAKE_OPTIONS = gnu
|
||||||
scripts_sources = \
|
scripts_sources = \
|
||||||
PROGRAM \
|
PROGRAM \
|
||||||
autofrisk \
|
autofrisk \
|
||||||
|
compile \
|
||||||
|
disassemble \
|
||||||
display-commentary \
|
display-commentary \
|
||||||
doc-snarf \
|
doc-snarf \
|
||||||
frisk \
|
frisk \
|
||||||
|
|
92
scripts/compile
Executable file
92
scripts/compile
Executable file
|
@ -0,0 +1,92 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# -*- scheme -*-
|
||||||
|
exec ${GUILE-guile} -e '(@ (scripts compile) compile)' -s $0 "$@"
|
||||||
|
!#
|
||||||
|
;;; Compile --- Command-line Guile Scheme compiler
|
||||||
|
|
||||||
|
;; Copyright 2005,2008 Free Software Foundation, Inc.
|
||||||
|
;;
|
||||||
|
;; This program is free software; you can redistribute it and/or
|
||||||
|
;; modify it under the terms of the GNU General Public License as
|
||||||
|
;; published by the Free Software Foundation; either version 2, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
;;
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
;; General Public License for more details.
|
||||||
|
;;
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this software; see the file COPYING. If not, write to
|
||||||
|
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
;; Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
;;; Author: Ludovic Courtès <ludovic.courtes@laas.fr>
|
||||||
|
;;; Author: Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Usage: compile [ARGS]
|
||||||
|
;;
|
||||||
|
;; PROGRAM does something.
|
||||||
|
;;
|
||||||
|
;; TODO: Write it!
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(read-set! keywords 'prefix)
|
||||||
|
|
||||||
|
(define-module (scripts compile)
|
||||||
|
:use-module (system base compile)
|
||||||
|
:use-module (ice-9 getopt-long)
|
||||||
|
:export (compile))
|
||||||
|
|
||||||
|
(define %options
|
||||||
|
'((help (single-char #\h) (value #f))
|
||||||
|
(optimize (single-char #\O) (value #f))
|
||||||
|
(expand-only (single-char #\e) (value #f))
|
||||||
|
(translate-only (single-char #\t) (value #f))
|
||||||
|
(compile-only (single-char #\c) (value #f))))
|
||||||
|
|
||||||
|
(define (compile args)
|
||||||
|
(let* ((options (getopt-long args %options))
|
||||||
|
(help? (option-ref options 'help #f))
|
||||||
|
(optimize? (option-ref options 'optimize #f))
|
||||||
|
(expand-only? (option-ref options 'expand-only #f))
|
||||||
|
(translate-only? (option-ref options 'translate-only #f))
|
||||||
|
(compile-only? (option-ref options 'compile-only #f)))
|
||||||
|
(if help?
|
||||||
|
(begin
|
||||||
|
(format #t "Usage: compile [OPTION] FILE...
|
||||||
|
Compile each Guile Scheme source file FILE into a Guile object.
|
||||||
|
|
||||||
|
-h, --help print this help message
|
||||||
|
-O, --optimize turn on optimizations
|
||||||
|
-e, --expand-only only go through the code expansion stage
|
||||||
|
-t, --translate-only stop after the translation to GHIL
|
||||||
|
-c, --compile-only stop after the compilation to GLIL
|
||||||
|
|
||||||
|
Report bugs to <guile-user@gnu.org>.~%")
|
||||||
|
(exit 0)))
|
||||||
|
|
||||||
|
(let ((compile-opts (append (if optimize? '(:O) '())
|
||||||
|
(if expand-only? '(:e) '())
|
||||||
|
(if translate-only? '(:t) '())
|
||||||
|
(if compile-only? '(:c) '()))))
|
||||||
|
|
||||||
|
(catch #t
|
||||||
|
(lambda ()
|
||||||
|
(for-each (lambda (file)
|
||||||
|
(apply compile-file file compile-opts))
|
||||||
|
(option-ref options '() '())))
|
||||||
|
(lambda (key . args)
|
||||||
|
(format (current-error-port) "exception `~a' caught~a~%" key
|
||||||
|
(if (null? args) ""
|
||||||
|
(if (string? (car args))
|
||||||
|
(string-append " in subr `" (car args) "'")
|
||||||
|
"")))
|
||||||
|
|
||||||
|
(format (current-error-port) "removing compiled files due to errors~%")
|
||||||
|
(false-if-exception
|
||||||
|
(for-each unlink (map compiled-file-name files)))
|
||||||
|
(exit 1))))))
|
41
scripts/disassemble
Executable file
41
scripts/disassemble
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# -*- scheme -*-
|
||||||
|
exec ${GUILE-guile} -e '(@ (scripts disassemble) disassemble)' -s $0 "$@"
|
||||||
|
!#
|
||||||
|
;;; Disassemble --- Disassemble .go files into something human-readable
|
||||||
|
|
||||||
|
;; Copyright 2005,2008 Free Software Foundation, Inc.
|
||||||
|
;;
|
||||||
|
;; This program is free software; you can redistribute it and/or
|
||||||
|
;; modify it under the terms of the GNU General Public License as
|
||||||
|
;; published by the Free Software Foundation; either version 2, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
;;
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
;; General Public License for more details.
|
||||||
|
;;
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this software; see the file COPYING. If not, write to
|
||||||
|
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
;; Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
;;; Author: Ludovic Courtès <ludovic.courtes@laas.fr>
|
||||||
|
;;; Author: Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Usage: disassemble [ARGS]
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(define-module (scripts disassemble)
|
||||||
|
#:use-module (system vm objcode)
|
||||||
|
#:use-module (system vm disasm)
|
||||||
|
#:export (disassemble))
|
||||||
|
|
||||||
|
(define (disassemble args)
|
||||||
|
(for-each (lambda (file)
|
||||||
|
(disassemble-objcode (load-objcode file)))
|
||||||
|
(cdr args)))
|
|
@ -1,14 +0,0 @@
|
||||||
.libs
|
|
||||||
.deps
|
|
||||||
guilec
|
|
||||||
guile-vm
|
|
||||||
stamp-h
|
|
||||||
config.h
|
|
||||||
config.h.in
|
|
||||||
stamp-h.in
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
*.x
|
|
||||||
*.i
|
|
||||||
*.lo
|
|
||||||
*.la
|
|
|
@ -1,4 +0,0 @@
|
||||||
bin_SCRIPTS = guilec guile-disasm
|
|
||||||
%: %.in
|
|
||||||
sed "s!@guile@!$(bindir)/guile!" $^ > $@
|
|
||||||
@chmod 755 $@
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!@guile@ -s
|
|
||||||
!#
|
|
||||||
|
|
||||||
;; Obviously, this is -*- Scheme -*-.
|
|
||||||
|
|
||||||
(use-modules (system vm objcode)
|
|
||||||
(system vm disasm))
|
|
||||||
|
|
||||||
(for-each (lambda (file)
|
|
||||||
(disassemble-objcode (load-objcode file)))
|
|
||||||
(cdr (command-line)))
|
|
|
@ -1,75 +0,0 @@
|
||||||
#!@guile@ -s
|
|
||||||
# -*- Scheme -*-
|
|
||||||
!#
|
|
||||||
;;; guilec -- Command-line Guile Scheme compiler.
|
|
||||||
;;;
|
|
||||||
;;; Copyright 2005 Ludovic Courtès <ludovic.courtes@laas.fr>
|
|
||||||
;;;
|
|
||||||
;;;
|
|
||||||
;;; This program is free software; you can redistribute it and/or modify
|
|
||||||
;;; it under the terms of the GNU General Public License as published by
|
|
||||||
;;; the Free Software Foundation; either version 2 of the License, or
|
|
||||||
;;; (at your option) any later version.
|
|
||||||
;;;
|
|
||||||
;;; This program is distributed in the hope that it will be useful,
|
|
||||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;;; GNU General Public License for more details.
|
|
||||||
;;;
|
|
||||||
;;; You should have received a copy of the GNU General Public License
|
|
||||||
;;; along with this program; if not, write to the Free Software
|
|
||||||
;;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
(use-modules (system base compile)
|
|
||||||
(ice-9 getopt-long))
|
|
||||||
|
|
||||||
(read-set! keywords 'prefix)
|
|
||||||
|
|
||||||
(define %guilec-options
|
|
||||||
'((help (single-char #\h) (value #f))
|
|
||||||
(optimize (single-char #\O) (value #f))
|
|
||||||
(expand-only (single-char #\e) (value #f))
|
|
||||||
(translate-only (single-char #\t) (value #f))
|
|
||||||
(compile-only (single-char #\c) (value #f))))
|
|
||||||
|
|
||||||
(let* ((options (getopt-long (command-line) %guilec-options))
|
|
||||||
(help? (option-ref options 'help #f))
|
|
||||||
(optimize? (option-ref options 'optimize #f))
|
|
||||||
(expand-only? (option-ref options 'expand-only #f))
|
|
||||||
(translate-only? (option-ref options 'translate-only #f))
|
|
||||||
(compile-only? (option-ref options 'compile-only #f)))
|
|
||||||
(if help?
|
|
||||||
(begin
|
|
||||||
(format #t "Usage: guilec [OPTION] FILE...
|
|
||||||
Compile each Guile Scheme source file FILE into a Guile object.
|
|
||||||
|
|
||||||
-h, --help print this help message
|
|
||||||
-O, --optimize turn on optimizations
|
|
||||||
-e, --expand-only only go through the code expansion stage
|
|
||||||
-t, --translate-only stop after the translation to GHIL
|
|
||||||
-c, --compile-only stop after the compilation to GLIL
|
|
||||||
|
|
||||||
Report bugs to <guile-user@gnu.org>.~%")
|
|
||||||
(exit 0)))
|
|
||||||
|
|
||||||
(let ((compile-opts (append (if optimize? '(:O) '())
|
|
||||||
(if expand-only? '(:e) '())
|
|
||||||
(if translate-only? '(:t) '())
|
|
||||||
(if compile-only? '(:c) '()))))
|
|
||||||
|
|
||||||
(catch #t
|
|
||||||
(lambda ()
|
|
||||||
(for-each (lambda (file)
|
|
||||||
(apply compile-file (cons file compile-opts)))
|
|
||||||
(option-ref options '() '())))
|
|
||||||
(lambda (key . args)
|
|
||||||
(format (current-error-port) "exception `~a' caught~a~%" key
|
|
||||||
(if (null? args) ""
|
|
||||||
(if (string? (car args))
|
|
||||||
(string-append " in subr `" (car args) "'")
|
|
||||||
"")))
|
|
||||||
|
|
||||||
(format (current-error-port) "removing compiled files due to errors~%")
|
|
||||||
(false-if-exception
|
|
||||||
(for-each unlink (map compiled-file-name files)))
|
|
||||||
(exit 1)))))
|
|
Loading…
Add table
Add a link
Reference in a new issue