RFC: fixup.scm -> guile.scm, update sid
Jim Blandy <[email protected]>
| Newsgroups | gmane.comp.emulators.sid.devel,gmane.comp.tools.cgen.devel |
|---|---|
| Message-ID | <[email protected]> |
[I'd posted this earlier, as two separate messages, but it seems to have been swallowed.] I need review from both SID and CGEN folks for this. One of the changes I outlined in my original post was to move away From loading fixup.scm from every cgen-APP.scm file, and instead have the app-specific shell script wrappers (which are the ones that know which Scheme will be used) specify an implementation-specific file like guile.scm or mzscheme.scm. The nice thing is that this can be done one app at a time. We can convert, say, sid/component/cgen-cpu/CGEN.sh.in and cgen/cgen-sid.scm at the same time, without affecting, say, opcodes. While we're in transition, some apps will be using fixup.scm, and some will be using guile.scm. So we'll need to keep the transition brief, and keep fixup.scm and guile.scm synchronized. Here's the first step. cgen/ChangeLog: 2005-02-02 Jim Blandy <[email protected]> * guile.scm: New file, containing Guile-specific definitions and adaptations. This is loaded by the app-specific shell scripts. Initially identical to fixup.scm. * cgen-sid.scm: Don't load fixup.scm here. sid/component/cgen-cpu/ChangeLog: 2005-02-02 Jim Blandy <[email protected]> * CGEN.sh.in: Request on the command line that cgen/guile.scm be loaded before cgen-sid.scm; cgen-sid.scm no longer loads fixup.scm. Index: sid/component/cgen-cpu/CGEN.sh.in =================================================================== RCS file: /cvs/src/src/sid/component/cgen-cpu/CGEN.sh.in,v retrieving revision 1.4 diff -c -p -r1.4 CGEN.sh.in *** sid/component/cgen-cpu/CGEN.sh.in 8 Sep 2003 18:55:35 -0000 1.4 --- sid/component/cgen-cpu/CGEN.sh.in 2 Feb 2005 23:17:16 -0000 *************** then *** 68,74 **** else cgen=guile fi ! rm -f tmp-desc-$$.h1 tmp-desc-$$.h rm -f tmp-cpu-$$.h1 tmp-cpu-$$.h --- 68,74 ---- else cgen=guile fi ! cgen="${cgen} -l ${cgendir}/guile.scm -s" rm -f tmp-desc-$$.h1 tmp-desc-$$.h rm -f tmp-cpu-$$.h1 tmp-cpu-$$.h *************** do *** 96,102 **** esac done ! ${cgen} -s ${cgendir}/cgen-sid.scm \ -s ${cgendir} \ ${cgenflags} \ -f "${archflags}" \ --- 96,102 ---- esac done ! ${cgen} ${cgendir}/cgen-sid.scm \ -s ${cgendir} \ ${cgenflags} \ -f "${archflags}" \ Index: sid/component/cgen-cpu/ChangeLog =================================================================== RCS file: /cvs/src/src/sid/component/cgen-cpu/ChangeLog,v retrieving revision 1.52 diff -c -p -r1.52 ChangeLog *** sid/component/cgen-cpu/ChangeLog 25 Jun 2004 17:44:35 -0000 1.52 --- sid/component/cgen-cpu/ChangeLog 2 Feb 2005 23:17:16 -0000 *************** *** 1,3 **** --- 1,8 ---- + 2005-02-02 Jim Blandy <[email protected]> + + * CGEN.sh.in: Request on the command line that cgen/guile.scm be + loaded before cgen-sid.scm; cgen-sid.scm no longer loads fixup.scm. + 2004-06-25 Dave Brolley <[email protected]> * tracedis.cxx (register_name): Add parameter for the cgen MACH. Save Index: cgen/cgen-sid.scm =================================================================== RCS file: /cvs/src/src/cgen/cgen-sid.scm,v retrieving revision 1.3 diff -c -p -r1.3 cgen-sid.scm *** cgen/cgen-sid.scm 8 Sep 2003 17:17:22 -0000 1.3 --- cgen/cgen-sid.scm 2 Feb 2005 23:17:21 -0000 *************** *** 10,18 **** ; Load the various support routines. (define (load-files srcdir) - ; Fix up Scheme to be what we use (guile is always in flux). - (primitive-load-path (string-append srcdir "/fixup.scm")) - (load (string-append srcdir "/read.scm")) (load (string-append srcdir "/utils-sim.scm")) (load (string-append srcdir "/sid.scm")) --- 10,15 ---- Index: cgen/guile.scm =================================================================== RCS file: cgen/guile.scm diff -N cgen/guile.scm *** cgen/guile.scm 1 Jan 1970 00:00:00 -0000 --- cgen/guile.scm 2 Feb 2005 23:17:21 -0000 *************** *** 0 **** --- 1,59 ---- + ; Guile-specific functions. + ; Copyright (C) 2000, 2004 Red Hat, Inc. + ; This file is part of CGEN. + ; See file COPYING.CGEN for details. + + (define *guile-major-version* (string->number (major-version))) + (define *guile-minor-version* (string->number (minor-version))) + + ; eval takes a module argument in 1.6 and later + + (if (or (> *guile-major-version* 1) + (>= *guile-minor-version* 6)) + (define (eval1 expr) + (eval expr (current-module))) + (define (eval1 expr) + (eval expr)) + ) + + ; symbol-bound? is deprecated in 1.6 + + (if (or (> *guile-major-version* 1) + (>= *guile-minor-version* 6)) + (define (symbol-bound? table s) + (if table + (error "must pass #f for symbol-bound? first arg")) + ; FIXME: Not sure this is 100% correct. + (module-defined? (current-module) s)) + ) + + (if (symbol-bound? #f 'load-from-path) + (begin + (define (load file) + (begin + ;(load-from-path file) + (primitive-load-path file) + )) + ) + ) + + ; FIXME: to be deleted + (define =? =) + (define >=? >=) + + (if (not (symbol-bound? #f '%stat)) + (begin + (define %stat stat) + ) + ) + + (if (symbol-bound? #f 'debug-enable) + (debug-enable 'backtrace) + ) + + ; Guile 1.3 has reverse!, Guile 1.2 has list-reverse!. + ; CGEN uses reverse! + (if (and (not (symbol-bound? #f 'reverse!)) + (symbol-bound? #f 'list-reverse!)) + (define reverse! list-reverse!) + )