Permalink
Browse files

- compile-whole-program and compile-whole-library now copy the hash-bang

  line from the wpo file (if it has one) to the object file.
    compile.ss,
    7.ms
- stex is now a submodule.  csug/Makefile and release_notes/Makefile
  set and use the required Scheme and STEXLIB variables accordingly.
  they default the machine type to a6le, but this can be overridden
  and is by the generated top-level Makefile.  the generated top-level
  Makefile now has a new docs target that runs make in both csug and
  release_notes, and an updated distclean target that cleans the same.
  the annoying csug Makefile .fig.pdf rule redefinition is now gone.
  copyright.stex and csug.stex now list May 2016 as the revision month
  and date; this will have to be updated for future releases.
    configure, makefiles/Makefile.in,
    csug/Makefile, copyright.stex, csug.stex,
    release_notes/Makefile
- rebuilt the boot files
  • Loading branch information...
1 parent eb76dc7 commit 4bd78a692dd4ca2f88af5d404fd0993a2d141e7b @dybvig dybvig committed May 5, 2016
View
@@ -4,3 +4,6 @@
[submodule "nanopass"]
path = nanopass
url = https://github.com/nanopass/nanopass-framework-scheme.git
+[submodule "stex"]
+ path = stex
+ url = https://github.com/dybvig/stex
View
@@ -88,3 +88,19 @@
- added pdtml flag, which if set to t causes profile-dump-html to be
called at the end of a mat run.
mats/Mf-base
+- compile-whole-program and compile-whole-library now copy the hash-bang
+ line from the wpo file (if it has one) to the object file.
+ compile.ss,
+ 7.ms
+- stex is now a submodule. csug/Makefile and release_notes/Makefile
+ set and use the required Scheme and STEXLIB variables accordingly.
+ they default the machine type to a6le, but this can be overridden
+ and is by the generated top-level Makefile. the generated top-level
+ Makefile now has a new docs target that runs make in both csug and
+ release_notes, and an updated distclean target that cleans the same.
+ the annoying csug Makefile .fig.pdf rule redefinition is now gone.
+ copyright.stex and csug.stex now list May 2016 as the revision month
+ and date; this will have to be updated for future releases.
+ configure, makefiles/Makefile.in,
+ csug/Makefile, copyright.stex, csug.stex,
+ release_notes/Makefile
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -239,7 +239,9 @@ git submodule init && git submodule update || exit 1
./workarea $m $w
-sed -e 's/$(workarea)/'$w'/g' makefiles/Makefile.in > Makefile
+sed -e 's/$(m)/'$m'/g'\
+ -e 's/$(workarea)/'$w'/g'\
+ makefiles/Makefile.in > Makefile
cat makefiles/Makefile-workarea.in > $w/Makefile
View
@@ -1,9 +1,13 @@
+m = a6le
+Scheme=../$m/bin/$m/scheme -b ../$m/boot/$m/petite.boot -b ../$m/boot/$m/scheme.boot
+STEXLIB=../stex
+installdir=/tmp/csug9
+
x = csug
latex = pdflatex
stexmacrofiles = tspl4-prep
bib = $(x).bib
index=yes
-installdir=/u/dyb/crs/www/csug9
TSPL=tspl4
DIR=$(shell basename `pwd`)
@@ -39,15 +43,7 @@ logcheck2: $(x).thirdrun
false;\
fi
-include ~/stex/Mf-stex
-
-# HACK to prevent lines from dropping below .5pt
-# .5pt = 1/144in = 8.3 1200ths, so go for 10 1200ths
-.fig.pdf:
- fig2dev -Leps $*.fig > $*.eps\
- && grep -q '7.500 slw' $*.eps\
- && sed -e 's/7.500 slw/10.000 slw/' $*.eps | epstopdf --filter > $*.pdf\
- && /bin/rm $*.eps || (echo "CHECK GREP"; false)
+include $(STEXLIB)/Mf-stex
stexsrc = csug.stex title.stex copyright.stex contents.stex\
preface.stex intro.stex use.stex expeditor.stex debug.stex foreign.stex\
@@ -79,15 +75,15 @@ $(x).secondrun: $(x).presecondrun
$(x).presecondrun: $(x).firstrun
cat tspl.aux >> $x.aux
cat tspl.rfm >> $x.rfm
- echo '(summary-make "$x")' | scheme setup.ss summary.ss
+ echo '(summary-make "$x")' | $(Scheme) setup.ss summary.ss
cat tspl.idx >> $x.idx
touch $(x).presecondrun
$(x).thirdrun: $(x).prethirdrun canned/cisco-logo.png
$(x).prethirdrun: $(x).secondrun
cat tspl.aux >> $x.aux
cat tspl.rfm >> $x.rfm
- echo '(summary-make "$x")' | scheme setup.ss summary.ss
+ echo '(summary-make "$x")' | $(Scheme) setup.ss summary.ss
cat tspl.idx >> $x.idx
touch $(x).prethirdrun
@@ -146,7 +142,7 @@ checklibs: $(x).thirdrun
code: $(stexsrc)
extract.pl $(stexsrc) > code
- echo '(load "code" pretty-print)' | vscheme csv7.5 -q
+ echo '(load "code" pretty-print)' | $(Scheme) -q
$(x).clean:
-/bin/rm -f $(x).rfm $(x).sfm $(x).prefirstrun $(x).presecondrun\
View
@@ -22,7 +22,7 @@ Licensed under the Apache License Version 2.0\\
http://www.apache.org/licenses/LICENSE-2.0
% NB: also update corresponding notice in csug.stex
-Revised \INSERTREVISIONMONTHSPACEYEAR for Chez Scheme Version 9.4.
+Revised May 2016 for Chez Scheme Version 9.4.
\medskip\noindent
Cisco and the Cisco logo are trademarks or registered trademarks
View
@@ -44,7 +44,7 @@
Copyright &copy; 2016 Cisco Systems, Inc.<br>
Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License Version 2.0</a>
(<a class=plain href="canned/copyright.html">full copyright notice.</a>).</br>
-Revised \INSERTREVISIONMONTHSPACEYEAR for Chez Scheme Version 9.4<br>
+Revised May 2016 for Chez Scheme Version 9.4<br>
<a class=plain href="canned/about.html">about this book</a>
</tr></table>
}}
@@ -27,10 +27,16 @@ test:
bootfiles:
(cd $(workarea) && $(MAKE) bootfiles)
+docs: build
+ (cd csug && $(MAKE) m=$(m))
+ (cd release_notes && $(MAKE) m=$(m))
+
clean:
(cd $(workarea) && $(MAKE) clean)
distclean:
rm -rf $(workarea)
+ (cd csug ; make reallyreallyclean)
+ (cd release_notes ; make reallyreallyclean)
rm -f Makefile
rm -f Make.out
View
@@ -1952,6 +1952,44 @@ evaluating module init
(equal?
(separate-eval '(load "testfile-wpo-ext-all.so"))
"(9 . 5)\n")
+
+ ; test propagation of #! shell-script line
+ (begin
+ (define $hash-bang-line "#! /usr/bin/scheme --program\n")
+ (delete-file "testfile-wpo-c8.so")
+ (delete-file "testfile-wpo-c8-all.so")
+ (delete-file "testfile-wpo-c8.wpo")
+ (with-output-to-file "testfile-wpo-c8.ss"
+ (lambda ()
+ (display-string $hash-bang-line)
+ (for-each pretty-print
+ '((import (chezscheme))
+ (printf "hello\n"))))
+ 'replace)
+ (separate-compile
+ '(lambda (x)
+ (parameterize ([generate-wpo-files #t])
+ (compile-program x)))
+ 'wpo-c8)
+ (separate-compile
+ '(lambda (x)
+ (compile-whole-program (format "~a.wpo" x) (format "~a-all.so" x)))
+ 'wpo-c8)
+ #t)
+
+ (equal?
+ (separate-eval '(load "testfile-wpo-c8.so"))
+ "hello\n")
+
+ (equal?
+ (separate-eval '(load "testfile-wpo-c8-all.so"))
+ "hello\n")
+
+ (equal?
+ (call-with-port (open-file-input-port "testfile-wpo-c8-all.so")
+ (lambda (ip)
+ (get-bytevector-n ip (string-length $hash-bang-line))))
+ (string->utf8 $hash-bang-line))
)
(mat compile-whole-library
@@ -3037,8 +3075,7 @@ evaluating module init
'cwl-c13)
(separate-compile
'(lambda (x)
- (lambda (op)
- (compile-whole-program (format "~a.wpo" x) (format "~a.so" x))))
+ (compile-whole-program (format "~a.wpo" x) (format "~a.so" x)))
'cwl-c13)
#t)
@@ -1,3 +1,7 @@
+m = a6le
+Scheme=../$m/bin/$m/scheme -b ../$m/boot/$m/petite.boot -b ../$m/boot/$m/scheme.boot
+STEXLIB=../stex
+
# define default document pathname here
# override on command line with 'make x=newdoc'
x = release_notes
@@ -17,7 +21,7 @@ bib =
# define index if an index is to be generated
# index=yes
-include ~/stex/Mf-stex
+include $(STEXLIB)/Mf-stex
# define or override suffixes here
View
@@ -757,17 +757,36 @@
(define read-input-file
(lambda (who ifn)
- (call-with-port ($open-file-input-port who ifn (file-options compressed))
+ (call-with-port ($open-file-input-port who ifn)
(lambda (ip)
(on-reset (close-port ip)
- (if ($compiled-file-header? ip)
- (let loop ([rls '()])
- (let ([x (fasl-read ip)])
- (cond
- [(eof-object? x) (reverse rls)]
- [(Lexpand? x) (loop (cons x rls))]
- [else ($oops who "unexpected wpo file object ~s" x)])))
- ($oops who "input file is source ~s" ifn)))))))
+ (let ([hash-bang-line
+ (let ([start-pos (port-position ip)])
+ (if (and (eqv? (get-u8 ip) (char->integer #\#))
+ (eqv? (get-u8 ip) (char->integer #\!))
+ (let ([b (lookahead-u8 ip)])
+ (or (eqv? b (char->integer #\space))
+ (eqv? b (char->integer #\/)))))
+ (let-values ([(op get-bv) (open-bytevector-output-port)])
+ (put-u8 op (char->integer #\#))
+ (put-u8 op (char->integer #\!))
+ (let loop ()
+ (let ([b (get-u8 ip)])
+ (unless (eof-object? b)
+ (put-u8 op b)
+ (unless (eqv? b (char->integer #\newline))
+ (loop)))))
+ (get-bv))
+ (begin (set-port-position! ip start-pos) #f)))])
+ (port-file-compressed! ip)
+ (if ($compiled-file-header? ip)
+ (let loop ([rls '()])
+ (let ([x (fasl-read ip)])
+ (cond
+ [(eof-object? x) (values hash-bang-line (reverse rls))]
+ [(Lexpand? x) (loop (cons x rls))]
+ [else ($oops who "unexpected wpo file object ~s" x)])))
+ ($oops who "input file is source ~s" ifn))))))))
(define find-library
(lambda (who path what library-ext*)
@@ -794,7 +813,8 @@
(cond
[(find-library who path "wpo" (map (lambda (ext) (cons (car ext) (string-append (path-root (cdr ext)) ".wpo"))) (library-extensions))) =>
(lambda (fn)
- (let-values ([(no-program node*) (process-ir*! (read-input-file who fn) fn #f libs-visible?)])
+ (let*-values ([(hash-bang-line ir*) (read-input-file who fn)]
+ [(no-program node*) (process-ir*! ir* fn #f libs-visible?)])
(values fn node*)))]
[(find-library who path "so" (library-extensions)) =>
(lambda (fn) (values fn (read-binary-file path fn libs-visible?)))]
@@ -1250,13 +1270,12 @@
`(revisit-only ,(build-combined-library-ir node*)))))))
(define finish-compile
- (lambda (who msg ifn ofn x1)
- (let ([op ($open-file-output-port who ofn
- (if (compile-compressed)
- (file-options replace compressed)
- (file-options replace)))])
+ (lambda (who msg ifn ofn hash-bang-line x1)
+ (let ([op ($open-file-output-port who ofn (file-options replace))])
(on-reset (delete-file ofn #f)
(on-reset (close-port op)
+ (when hash-bang-line (put-bytevector op hash-bang-line))
+ (when (compile-compressed) (port-file-compressed! op))
(parameterize ([$target-machine (constant machine-type-name)]
; dummy sfd for block-profile optimization
[$sfd (source-file-descriptor ifn #xc7c7c7)]
@@ -1310,29 +1329,29 @@
[(ifn ofn libs-visible?)
(unless (string? ifn) ($oops who "~s is not a string" ifn))
(unless (string? ofn) ($oops who "~s is not a string" ofn))
- (let ([entry* (read-input-file who ifn)])
- (let-values ([(program-entry lib* no-wpo*) (build-graph who entry* ifn #t #f libs-visible?)])
- (safe-assert program-entry)
- (safe-assert (null? no-wpo*))
- (let ([node* (topological-sort program-entry lib*)])
- (finish-compile who "whole program" ifn ofn
- (build-program-body program-entry node* lib*))
- (build-required-library-list node* lib*))))])))
+ (let*-values ([(hash-bang-line ir*) (read-input-file who ifn)]
+ [(program-entry lib* no-wpo*) (build-graph who ir* ifn #t #f libs-visible?)])
+ (safe-assert program-entry)
+ (safe-assert (null? no-wpo*))
+ (let ([node* (topological-sort program-entry lib*)])
+ (finish-compile who "whole program" ifn ofn hash-bang-line
+ (build-program-body program-entry node* lib*))
+ (build-required-library-list node* lib*)))])))
(set-who! compile-whole-library
(lambda (ifn ofn)
(unless (string? ifn) ($oops who "~s is not a string" ifn))
(unless (string? ofn) ($oops who "~s is not a string" ofn))
- (let ([entry* (read-input-file who ifn)])
- (let-values ([(no-program lib* wpo*) (build-graph who entry* ifn #f (generate-wpo-files) #t)])
- (safe-assert (not no-program))
- (safe-assert (or (not (generate-wpo-files)) (not (null? wpo*))))
- (when (null? lib*) ($oops "did not find libraries in input file ~s" ifn))
- (let ([node* (topological-sort #f lib*)])
- (write-wpo-file who ofn wpo*)
- (finish-compile who "whole library" ifn ofn
- (build-library-body node* lib*))
- (build-required-library-list node* lib*)))))))
+ (let*-values ([(hash-bang-line ir*) (read-input-file who ifn)]
+ [(no-program lib* wpo*) (build-graph who ir* ifn #f (generate-wpo-files) #t)])
+ (safe-assert (not no-program))
+ (safe-assert (or (not (generate-wpo-files)) (not (null? wpo*))))
+ (when (null? lib*) ($oops "did not find libraries in input file ~s" ifn))
+ (let ([node* (topological-sort #f lib*)])
+ (write-wpo-file who ofn wpo*)
+ (finish-compile who "whole library" ifn ofn hash-bang-line
+ (build-library-body node* lib*))
+ (build-required-library-list node* lib*))))))
(set! $c-make-code
(lambda (func subtype free name size code-list info pinfo*)
Submodule stex added at 3bd2b8

0 comments on commit 4bd78a6

Please sign in to comment.