Commit fe7a19c1 authored by Erick Gallesio's avatar Erick Gallesio

- Fixed a path problem which prevent compilation on system without

  STklos already installed ((a consequence of require-library
  generalization). Use of a shell variable to indicate that we are
  building STklos (STKLOS_BUILDING)
- Added the %%publish-syntax primitive for ScmPkg
parent a5d3a703
......@@ -2,7 +2,7 @@
#
# Author: Erick Gallesio [eg@unice.fr]
# Creation date: 11-Apr-2000 10:30 (eg)
# Last file update: 25-Apr-2007 23:59 (eg)
# Last file update: 26-Apr-2007 16:47 (eg)
SUBDIRS = Match.d SILex.d Lalr.d ScmPkg.d @LURCDIR@
......@@ -127,18 +127,27 @@ all: boot $(scheme_OBJS)
boot: ../src/boot.img
../src/boot.img: $(scheme_BOOT)
../src/stklos -q -c -b ../src/boot.img -f bb.stk boot.img0 instr0
../src/stklos -q -c -b ./boot.img0 -f bb.stk boot.img1 instr1
../src/stklos -q -c -b ./boot.img1 -f bb.stk boot.img2 instr2
../src/stklos -q -c -b ./boot.img2 -f bb.stk boot.img3 instr3
@echo "*** Boot 0"; \
(export STKLOS_BUILDING=1; \
../src/stklos -q -c -b ../src/boot.img -f bb.stk boot.img0 instr0)
@echo "*** Boot 1"; \
(export STKLOS_BUILDING=1; \
../src/stklos -q -c -b ./boot.img0 -f bb.stk boot.img1 instr1)
@echo "*** Boot 2"; \
(export STKLOS_BUILDING=1; \
../src/stklos -q -c -b ./boot.img1 -f bb.stk boot.img2 instr2)
@echo "*** Boot 3"; \
(export STKLOS_BUILDING=1; \
../src/stklos -q -c -b ./boot.img2 -f bb.stk boot.img3 instr3)
@if cmp ./boot.img2 ./boot.img3 ;then \
echo "*** New boot file created"; \
cp ../src/boot.img ../src/boot.ok; \
cp ./boot.img3 ../src/boot.img; \
cp ./instr3 ../src/vm-instr.h; \
echo "*** Create new boot.c"; \
../src/stklos -q -c -b ../src/boot.img \
-f make-C-boot.stk -- boot.img3 ../src/boot.c; \
(export STKLOS_BUILDING=1; \
./src/stklos -q -c -b ../src/boot.img \
-f make-C-boot.stk -- boot.img3 ../src/boot.c); \
echo "*** Recompile STklos"; \
(cd ../src; make stklos); \
echo "*** Cleaning useless images"; \
......
......@@ -18,7 +18,7 @@
#
# Author: Erick Gallesio [eg@unice.fr]
# Creation date: 11-Apr-2000 10:30 (eg)
# Last file update: 25-Apr-2007 23:59 (eg)
# Last file update: 26-Apr-2007 16:47 (eg)
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
......@@ -642,18 +642,27 @@ all: boot $(scheme_OBJS)
boot: ../src/boot.img
../src/boot.img: $(scheme_BOOT)
../src/stklos -q -c -b ../src/boot.img -f bb.stk boot.img0 instr0
../src/stklos -q -c -b ./boot.img0 -f bb.stk boot.img1 instr1
../src/stklos -q -c -b ./boot.img1 -f bb.stk boot.img2 instr2
../src/stklos -q -c -b ./boot.img2 -f bb.stk boot.img3 instr3
@echo "*** Boot 0"; \
(export STKLOS_BUILDING=1; \
../src/stklos -q -c -b ../src/boot.img -f bb.stk boot.img0 instr0)
@echo "*** Boot 1"; \
(export STKLOS_BUILDING=1; \
../src/stklos -q -c -b ./boot.img0 -f bb.stk boot.img1 instr1)
@echo "*** Boot 2"; \
(export STKLOS_BUILDING=1; \
../src/stklos -q -c -b ./boot.img1 -f bb.stk boot.img2 instr2)
@echo "*** Boot 3"; \
(export STKLOS_BUILDING=1; \
../src/stklos -q -c -b ./boot.img2 -f bb.stk boot.img3 instr3)
@if cmp ./boot.img2 ./boot.img3 ;then \
echo "*** New boot file created"; \
cp ../src/boot.img ../src/boot.ok; \
cp ./boot.img3 ../src/boot.img; \
cp ./instr3 ../src/vm-instr.h; \
echo "*** Create new boot.c"; \
../src/stklos -q -c -b ../src/boot.img \
-f make-C-boot.stk -- boot.img3 ../src/boot.c; \
(export STKLOS_BUILDING=1; \
./src/stklos -q -c -b ../src/boot.img \
-f make-C-boot.stk -- boot.img3 ../src/boot.c); \
echo "*** Recompile STklos"; \
(cd ../src; make stklos); \
echo "*** Cleaning useless images"; \
......
......@@ -2,10 +2,10 @@
#
# Author: Erick Gallesio [eg@unice.fr]
# Creation date: 20-Dec-2006 10:09 (eg)
# Last file update: 12-Apr-2007 18:34 (eg)
# Last file update: 26-Apr-2007 16:07 (eg)
SRCS = scmpkg-interface.stk scmpkg-languages.stk
OBJ = scmpkg-support.ostk
OBJ = ../scmpkg-support.ostk
......@@ -27,6 +27,6 @@ $(OBJ): scmpkg-support.stk $(SRCS)
clean:
/bin/rm -f *.ostk *~
/bin/rm -f $(OBJ) *~
distclean: clean
......@@ -18,7 +18,7 @@
#
# Author: Erick Gallesio [eg@unice.fr]
# Creation date: 20-Dec-2006 10:09 (eg)
# Last file update: 12-Apr-2007 18:34 (eg)
# Last file update: 26-Apr-2007 16:07 (eg)
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
......@@ -186,7 +186,7 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SRCS = scmpkg-interface.stk scmpkg-languages.stk
OBJ = scmpkg-support.ostk
OBJ = ../scmpkg-support.ostk
scheme_libdir = $(prefix)/share/@PACKAGE@/@VERSION@
scheme_lib_DATA = scmpkg-support.stk $(OBJ)
scheme_scmpkgdir = $(scheme_libdir)/ScmPkg.d
......@@ -398,7 +398,7 @@ all: $(OBJ)
$(OBJ): scmpkg-support.stk $(SRCS)
clean:
/bin/rm -f *.ostk *~
/bin/rm -f $(OBJ) *~
distclean: clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
......
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@essi.fr]
;;;; Creation date: 11-Dec-2006 14:39 (eg)
;;;; Last file update: 13-Apr-2007 15:37 (eg)
;;;; Last file update: 26-Apr-2007 10:59 (eg)
;;;;
......@@ -108,6 +108,9 @@
symbs
(cons (cdar lst) aliases))))))
(define (publish-syntaxes lst)
`(%%publish-syntax ,@lst))
(let* ((pi (in-module |ScmPkg| parse-interface))
(pkg (pi name body))
(imp (scmpkg-package-imports pkg))
......@@ -115,11 +118,12 @@
(lang (scmpkg-package-language pkg))
(req (merge-imports-exports imp exp))
(allreq (find-imports lang req))
(allimp (find-imports lang imp)))
(allimp (find-imports lang imp))
(macs (append (scmpkg-package-macros pkg)
(scmpkg-package-syntaxes pkg))))
`(begin
;; Require scmpkg-support
(require "scmpkg-support")
(require-library "scmpkg-support")
;; Require all the imported modules
,@(map (lambda (x)
`(require-for-syntax ,(symbol->string (if (pair? x) (car x) x))))
......@@ -133,7 +137,9 @@
;; Exports
,(do-exports exp)
;; Body
(include ,(scmpkg-package-source pkg)))
(include ,(scmpkg-package-source pkg))
;; Publish macros and syntaxes
,(publish-syntaxes macs))
;; Provide
(provide ,(symbol->string name)))))
......@@ -162,8 +168,8 @@
(match-case x
((from ?mod . ?rest) ;; re-exportation
(%push! exports x))
((macro . ?rest) ;; export a macro
(%push! (scmpkg-package-macros pkg) rest))
((macro (?name . ?rest)) ;; export a macro
(%push! (scmpkg-package-macros pkg) name))
((syntax ?args . ?-) ;; export a syntax
(%push! (scmpkg-package-syntaxes pkg) args))
(else
......
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 17-Mar-2001 12:11 (eg)
;;;; Last file update: 4-Mar-2007 16:33 (eg)
;;;; Last file update: 26-Apr-2007 12:19 (eg)
;;;;
(select-module STKLOS-COMPILER)
......@@ -42,7 +42,7 @@
;; Return informations
(list :version (version)
:globals globs
:expanders (expander-sources))))
:expanders (expander-published-sources))))
(let ((out (open-output-file output))
(globs (compiler-known-globals))
......@@ -50,7 +50,7 @@
(copts (compiler:warn-use-undefined-postpone)))
;; Clear the list containing macros sources
(expander-sources-set! '())
(expander-published-reset!)
;; Defer warning til the end of the compilation of file
;(compiler:warn-use-undefined-postpone #t)
......
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 26-Feb-2000 10:47 (eg)
;;;; Last file update: 3-Apr-2007 22:12 (eg)
;;;; Last file update: 26-Apr-2007 12:15 (eg)
;;;;
(define-module STKLOS-COMPILER
......@@ -1468,6 +1468,15 @@ doc>
(compile-normal-call (car e) (cdr e) (length e) env e tail))
;;;;
;;;; PUBLISH-SYNTAX
;;;;
(define (compile-%%pubsyntax e env tail)
(for-each (lambda (x)
(if (symbol? x)
(expander-published-add! x)
(error '%%publish-syntax "bad symbol ~S" x)))
(cdr e)))
;;;;
;;;; REQUIRE-FOR-SYNTAX
......@@ -1569,6 +1578,7 @@ doc>
((%%source-pos) (compile-%%source-pos e env tail?))
((%%label) (compile-%%label e env tail?))
((%%goto) (compile-%%goto e env tail?))
((%%publish-syntax) (compile-%%pubsyntax e env tail?))
;; Unmatched cases
(else (let ((first (car e)))
......
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 17-May-2000 14:55 (eg)
;;;; Last file update: 13-Apr-2007 18:54 (eg)
;;;; Last file update: 26-Apr-2007 16:37 (eg)
;;;;
......@@ -295,8 +295,14 @@ doc>
(define provided? #f)
(define require/provide #f)
(let ((provided '()))
(set! %%require (lambda (what lib-only?)
(let ((provided '())
(stklos-building? (getenv "STKLOS_BUILDING")))
(set! %%require (lambda (what :optional lib-only?)
(when stklos-building?
;; When building STklos, require-library == require.
;; Otherwise, we need an already installed STklos
(set! lib-only? #f))
(unless (member what provided)
(%load what
(if lib-only?
......
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 1-Jun-2000 12:26 (eg)
;;;; Last file update: 13-Apr-2007 14:33 (eg)
;;;; Last file update: 26-Apr-2007 10:58 (eg)
;;;;
......@@ -359,7 +359,6 @@ doc>
symbols)
`(%module-export (current-module) ',symbols))))
(define-macro (export-syntax . arg)
#f)
......
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 15-Mar-2001 22:49 (eg)
;;;; Last file update: 13-Apr-2007 09:45 (eg)
;;;; Last file update: 26-Apr-2007 12:26 (eg)
;;;;
......@@ -76,7 +76,7 @@
;;; ----------------------------------------------------------------------
(define *expander-list* '()) ; the macros
(define *expander-list-src* '()) ; their source code
(define *expander-published* '()) ; names of the macro to "publish"
(define (expander? x)
(assq x *expander-list*))
......@@ -128,15 +128,26 @@
(loop (cdr lst) lst)))))
;;;
;;; Expander-list-src management
;;;
(define (expander-sources)
*expander-list-src*)
(define (expander-sources-set! v)
(set! *expander-list-src* '()))
;;; Published macro management
;;;
(define (expander-published-reset!)
(set! *expander-list-src* '())
(set! *expander-published* '()))
(define (expander-published-sources)
(let Loop ((lst *expander-published*)
(res '()))
(if (null? lst)
(reverse! res)
(let ((mac (assoc (car lst) *expander-list-src*)))
(if mac
(Loop (cdr lst) (cons mac res))
(error "cannot find source of syntax named ~S" (car lst)))))))
(define (expander-published-add! name)
(eprintf "ajout publish ~S\n" name)
(unless (memq name *expander-published*)
(set! *expander-published* (cons name *expander-published*))))
;;;
;;; Runtime support for R5RS macro
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -22,7 +22,7 @@
#
# Author: Erick Gallesio [eg@unice.fr]
# Creation date: 1-Jan-2002 18:57 (eg)
# Last file update: 5-Mar-2007 12:11 (eg)
# Last file update: 26-Apr-2007 16:15 (eg)
#
# This script is only used to compile the different components of the
......@@ -47,7 +47,8 @@ else
fi
STKLOS_LOAD_PATH="${prefix}/lib${sep}${prefix}/gtklos"
export STKLOS_LOAD_PATH
STKLOS_BUILDING=1
export STKLOS_LOAD_PATH STKLOS_BUILDING
${prefix}/src/stklos -c -q -b ${prefix}/src/boot.img \
-f ${prefix}/utils/stklos-compile.stk -- \
......
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