From fd13741eb363866aa6ab0564c923f361122d09b5 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 3 Jan 2018 08:33:55 +0100 Subject: [PATCH] mescc: Resurrect guile-1.8. * guile/mescc.scm: Use GUILE_LOAD_COMPILED_PATH instead of -C. [guile]: Include syncase. * module/language/c99/compiler.scm [guile]: Stub pretty-print-c99. Set stack to unlimited. * module/language/c99/info.scm [guile]: Include (ice-9 syncase). * module/mes/as-i386.scm [guile]: Likewise. * module/mes/guile.scm [guile]: Add compose, export it. --- guile/mescc.scm | 8 +++++++- module/language/c99/compiler.scm | 14 +++++++++++--- module/language/c99/info.scm | 3 ++- module/mes/as-i386.scm | 8 +++++++- module/mes/guile.scm | 7 ++++++- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/guile/mescc.scm b/guile/mescc.scm index 5c5fcab8..ce372e85 100755 --- a/guile/mescc.scm +++ b/guile/mescc.scm @@ -5,7 +5,8 @@ GUILEDIR=${GUILEDIR-@GUILEDIR@} [ "$GODIR" = @"GODIR"@ ] && GODIR=$(dirname $0) [ "$GUILEDIR" = @"GUILEDIR"@ ] && GUILEDIR=$(dirname $0) export GUILE_AUTO_COMPILE=${GUILE_AUTO_COMPILE-0} -exec ${GUILE-guile} -L $GUILEDIR -C $GODIR -e '(mescc)' -s "$0" "$@" +GUILE_LOAD_COMPILED_PATH=$GODIR:$GUILE_LOAD_COMPILED_PATH +exec ${GUILE-guile} -L $GUILEDIR -e '(mescc)' -s "$0" "$@" !# ;;; Mes --- The Maxwell Equations of Software @@ -45,6 +46,11 @@ GUILE='~/src/guile-1.8/build/pre-inst-guile --debug -q' guile/mescc.scm #:use-module (srfi srfi-26) #:export (main)) +(cond-expand + (guile-2) + (guile + (use-modules (ice-9 syncase)))) + (define %prefix (if (string-prefix? "@PREFIX" "@PREFIX@") (or (getenv "MES_PREFIX") "") "@PREFIX@")) (module-define! (resolve-module '(language c99 compiler)) '%prefix %prefix) diff --git a/module/language/c99/compiler.scm b/module/language/c99/compiler.scm index c7e8644e..552ba1fe 100644 --- a/module/language/c99/compiler.scm +++ b/module/language/c99/compiler.scm @@ -1,7 +1,7 @@ ;;; -*-scheme-*- ;;; Mes --- Maxwell Equations of Software -;;; Copyright © 2016,2017 Jan Nieuwenhuizen +;;; Copyright © 2016,2017,2018 Jan Nieuwenhuizen ;;; ;;; This file is part of Mes. ;;; @@ -29,7 +29,7 @@ #:use-module (ice-9 optargs) #:use-module (ice-9 pretty-print) #:use-module (nyacc lang c99 parser) - #:use-module (nyacc lang c99 pprint) + ;;#:use-module (nyacc lang c99 pprint) #:use-module (mes guile) #:use-module (mes as) #:use-module (mes as-i386) @@ -44,9 +44,17 @@ info->object)) (cond-expand - (guile-2) + (guile-2 + (use-modules (nyacc lang c99 pprint))) (guile + (debug-set! stack 0) + (use-modules (ice-9 optargs)) (use-modules (ice-9 syncase))) + ;; guile-1.8 does not have (sxml match), short-circuit me + (define* (pretty-print-c99 tree + #:optional (port (current-output-port)) + #:key ugly per-line-prefix (basic-offset 2)) + (write tree port)) (mes)) (include-from-path "language/c99/compiler.mes") diff --git a/module/language/c99/info.scm b/module/language/c99/info.scm index 9c001ee4..41f546e8 100644 --- a/module/language/c99/info.scm +++ b/module/language/c99/info.scm @@ -63,7 +63,8 @@ (cond-expand (guile-2) (guile - (use-modules (ice-9 syncase))) + (use-modules (ice-9 syncase)) + (use-modules (ice-9 optargs))) (mes (mes-use-module (mes optargs)))) diff --git a/module/mes/as-i386.scm b/module/mes/as-i386.scm index 4df68864..c999be47 100644 --- a/module/mes/as-i386.scm +++ b/module/mes/as-i386.scm @@ -1,7 +1,7 @@ ;;; -*-scheme-*- ;;; Mes --- Maxwell Equations of Software -;;; Copyright © 2016,2017 Jan Nieuwenhuizen +;;; Copyright © 2016,2017,2018 Jan Nieuwenhuizen ;;; ;;; This file is part of Mes. ;;; @@ -152,4 +152,10 @@ i386:z->accu )) +(cond-expand + (guile-2) + (guile + (use-modules (ice-9 syncase))) + (mes)) + (include-from-path "mes/as-i386.mes") diff --git a/module/mes/guile.scm b/module/mes/guile.scm index ab9f0fb6..8e81a7e3 100644 --- a/module/mes/guile.scm +++ b/module/mes/guile.scm @@ -77,5 +77,10 @@ #'(include fn)))))))) (export include-from-path)) (guile - (use-modules (ice-9 syncase))) + (use-modules (ice-9 syncase)) + (define (compose proc . rest) + (if (null? rest) proc + (lambda args + (proc (apply (apply compose rest) args))))) + (export compose)) (mes))