2017-07-21 23:29:57 +01:00
|
|
|
;;; -*-scheme-*-
|
|
|
|
|
2018-07-22 13:24:36 +01:00
|
|
|
;;; GNU Mes --- Maxwell Equations of Software
|
2017-11-21 18:22:26 +00:00
|
|
|
;;; Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2017-07-21 23:29:57 +01:00
|
|
|
;;;
|
2018-07-22 13:24:36 +01:00
|
|
|
;;; This file is part of GNU Mes.
|
2017-07-21 23:29:57 +01:00
|
|
|
;;;
|
2018-07-22 13:24:36 +01:00
|
|
|
;;; GNU Mes is free software; you can redistribute it and/or modify it
|
2017-07-21 23:29:57 +01:00
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
;;; your option) any later version.
|
|
|
|
;;;
|
2018-07-22 13:24:36 +01:00
|
|
|
;;; GNU Mes is distributed in the hope that it will be useful, but
|
2017-07-21 23:29:57 +01:00
|
|
|
;;; 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
|
2018-07-22 13:24:36 +01:00
|
|
|
;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
2017-07-21 23:29:57 +01:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2017-12-09 19:10:57 +00:00
|
|
|
(define-module (mes guile)
|
2018-01-25 05:58:44 +00:00
|
|
|
#:export (
|
core: Use single definition rule for cell-type.
* src/mes.c (scm_type_char, scm_type_closure, scm_type_continuation,
scm_type_function, scm_type_keyword, scm_type_macro,
scm_type_number, scm_type_pair, scm_type_ref, scm_type_special,
scm_type_string, scm_type_symbol, scm_type_values,
scm_type_variable, scm_type_vector): New symbol.
(mes_symbols): Add them.
* module/mes/type-0.mes (<cell:char>, <cell:char>, <cell:closure>,
<cell:continuation>, <cell:function>, <cell:keyword>, <cell:macro>,
<cell:number>, <cell:pair>, <cell:ref>, <cell:special>,
<cell:string>, <cell:symbol>, <cell:values>, <cell:variable>,
<cell:vector>, <cell:broken-heart): Remove.
* module/mes/boot-0.scm: Likewise.
* module/mes/boot-01.scm: Likewise.
* module/mes/boot-02.scm: Likewise.
* scaffold/boot/20-define-quote.scm: Likewise.
* scaffold/boot/37-closure-lambda.scm: Likewise.
* scaffold/boot/38-simple-format.scm: Likewise.
* scaffold/boot/4c-quasiquote.scm:
* scaffold/boot/4e-string-split.scm: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scaffold/boot/60-let-syntax.scm: Likewise.
* module/mes/guile.scm: Add some of them.
2018-04-29 12:22:02 +01:00
|
|
|
<cell:char>
|
|
|
|
<cell:keyword>
|
|
|
|
<cell:number>
|
|
|
|
<cell:pair>
|
|
|
|
<cell:string>
|
|
|
|
<cell:symbol>
|
|
|
|
<cell:vector>
|
|
|
|
|
2019-05-22 16:55:20 +01:00
|
|
|
%arch
|
|
|
|
%compiler
|
2018-01-25 05:58:44 +00:00
|
|
|
append2
|
|
|
|
core:apply
|
2018-08-09 08:44:54 +01:00
|
|
|
core:car
|
2018-01-25 05:58:44 +00:00
|
|
|
core:display
|
|
|
|
core:display-error
|
|
|
|
core:display-port
|
|
|
|
core:exit
|
|
|
|
core:macro-expand
|
|
|
|
core:write
|
|
|
|
core:write-error
|
|
|
|
core:write-port
|
2018-04-29 06:46:40 +01:00
|
|
|
core:type
|
2019-05-27 20:33:20 +01:00
|
|
|
%compiler
|
2018-11-11 15:25:36 +00:00
|
|
|
equal2?
|
2019-05-27 21:57:44 +01:00
|
|
|
keyword->string
|
2018-04-29 06:46:40 +01:00
|
|
|
pmatch-car
|
|
|
|
pmatch-cdr
|
|
|
|
)
|
2018-04-28 11:19:40 +01:00
|
|
|
;;#:re-export (open-input-file open-input-string with-input-from-string)
|
|
|
|
)
|
2017-12-09 19:10:57 +00:00
|
|
|
|
2019-05-22 16:55:20 +01:00
|
|
|
(cond-expand
|
|
|
|
(guile-2)
|
|
|
|
(guile
|
|
|
|
(define %host-type (string-append (utsname:machine (uname)) "linux-gnu")))
|
|
|
|
(else))
|
|
|
|
|
2017-12-09 19:10:57 +00:00
|
|
|
(cond-expand
|
|
|
|
(guile
|
2018-04-29 06:46:40 +01:00
|
|
|
(define pmatch-car car)
|
|
|
|
(define pmatch-cdr cdr)
|
2018-01-25 05:58:44 +00:00
|
|
|
(define core:exit exit)
|
2017-12-09 19:10:57 +00:00
|
|
|
(define core:display display)
|
2018-01-25 05:58:44 +00:00
|
|
|
(define core:display-port display)
|
2018-01-02 19:41:59 +00:00
|
|
|
(define (core:display-error o) (display o (current-error-port)))
|
2018-01-25 05:58:44 +00:00
|
|
|
(define core:write write)
|
|
|
|
(define (core:write-error o) (write o (current-error-port)))
|
|
|
|
(define core:write-port write)
|
|
|
|
(define core:macro-expand identity)
|
|
|
|
(define (core:apply f a . m) (apply f a))
|
2018-08-09 08:44:54 +01:00
|
|
|
(define (core:car f a . m) (apply f a))
|
2018-01-25 05:58:44 +00:00
|
|
|
(define append2 append)
|
2018-11-11 15:25:36 +00:00
|
|
|
(define equal2? equal?)
|
2018-01-25 05:58:44 +00:00
|
|
|
|
|
|
|
(define guile:keyword? keyword?)
|
|
|
|
(define guile:number? number?)
|
|
|
|
(define guile:pair? pair?)
|
|
|
|
(define guile:string? string?)
|
|
|
|
(define guile:symbol? symbol?)
|
core: Use single definition rule for cell-type.
* src/mes.c (scm_type_char, scm_type_closure, scm_type_continuation,
scm_type_function, scm_type_keyword, scm_type_macro,
scm_type_number, scm_type_pair, scm_type_ref, scm_type_special,
scm_type_string, scm_type_symbol, scm_type_values,
scm_type_variable, scm_type_vector): New symbol.
(mes_symbols): Add them.
* module/mes/type-0.mes (<cell:char>, <cell:char>, <cell:closure>,
<cell:continuation>, <cell:function>, <cell:keyword>, <cell:macro>,
<cell:number>, <cell:pair>, <cell:ref>, <cell:special>,
<cell:string>, <cell:symbol>, <cell:values>, <cell:variable>,
<cell:vector>, <cell:broken-heart): Remove.
* module/mes/boot-0.scm: Likewise.
* module/mes/boot-01.scm: Likewise.
* module/mes/boot-02.scm: Likewise.
* scaffold/boot/20-define-quote.scm: Likewise.
* scaffold/boot/37-closure-lambda.scm: Likewise.
* scaffold/boot/38-simple-format.scm: Likewise.
* scaffold/boot/4c-quasiquote.scm:
* scaffold/boot/4e-string-split.scm: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scaffold/boot/60-let-syntax.scm: Likewise.
* module/mes/guile.scm: Add some of them.
2018-04-29 12:22:02 +01:00
|
|
|
|
|
|
|
(define <cell:char> 0)
|
|
|
|
(define <cell:keyword> 4)
|
|
|
|
(define <cell:number> 6)
|
|
|
|
(define <cell:pair> 7)
|
2018-04-29 16:48:38 +01:00
|
|
|
(define <cell:string> 10)
|
|
|
|
(define <cell:symbol> 11)
|
|
|
|
(define <cell:vector> 15)
|
2019-05-22 16:55:20 +01:00
|
|
|
(define %arch (car (string-split %host-type #\-)))
|
|
|
|
(define %compiler "gnuc")
|
core: Use single definition rule for cell-type.
* src/mes.c (scm_type_char, scm_type_closure, scm_type_continuation,
scm_type_function, scm_type_keyword, scm_type_macro,
scm_type_number, scm_type_pair, scm_type_ref, scm_type_special,
scm_type_string, scm_type_symbol, scm_type_values,
scm_type_variable, scm_type_vector): New symbol.
(mes_symbols): Add them.
* module/mes/type-0.mes (<cell:char>, <cell:char>, <cell:closure>,
<cell:continuation>, <cell:function>, <cell:keyword>, <cell:macro>,
<cell:number>, <cell:pair>, <cell:ref>, <cell:special>,
<cell:string>, <cell:symbol>, <cell:values>, <cell:variable>,
<cell:vector>, <cell:broken-heart): Remove.
* module/mes/boot-0.scm: Likewise.
* module/mes/boot-01.scm: Likewise.
* module/mes/boot-02.scm: Likewise.
* scaffold/boot/20-define-quote.scm: Likewise.
* scaffold/boot/37-closure-lambda.scm: Likewise.
* scaffold/boot/38-simple-format.scm: Likewise.
* scaffold/boot/4c-quasiquote.scm:
* scaffold/boot/4e-string-split.scm: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scaffold/boot/60-let-syntax.scm: Likewise.
* module/mes/guile.scm: Add some of them.
2018-04-29 12:22:02 +01:00
|
|
|
|
2019-05-27 20:33:20 +01:00
|
|
|
(define %compiler "gnuc")
|
2019-05-27 21:57:44 +01:00
|
|
|
(define keyword->string (compose symbol->string keyword->symbol))
|
2019-05-27 20:33:20 +01:00
|
|
|
|
2018-01-25 05:58:44 +00:00
|
|
|
(define (core:type x)
|
|
|
|
(cond ((guile:keyword? x) <cell:keyword>)
|
|
|
|
((guile:number? x) <cell:number>)
|
|
|
|
((guile:pair? x) <cell:pair>)
|
|
|
|
((guile:string? x) <cell:string>)
|
2018-08-09 08:44:54 +01:00
|
|
|
((guile:symbol? x) <cell:symbol>)))
|
|
|
|
(define (core:car x)
|
2020-05-17 23:40:50 +01:00
|
|
|
(cond ((guile:string? x) (string->list x)))))
|
2017-12-09 19:10:57 +00:00
|
|
|
(mes))
|
2017-07-21 23:29:57 +01:00
|
|
|
|
|
|
|
(cond-expand
|
|
|
|
(guile-2.2)
|
2018-07-07 16:31:06 +01:00
|
|
|
(guile-2)
|
2017-07-21 23:29:57 +01:00
|
|
|
(guile
|
2018-01-03 07:33:55 +00:00
|
|
|
(use-modules (ice-9 syncase))
|
|
|
|
(define (compose proc . rest)
|
|
|
|
(if (null? rest) proc
|
|
|
|
(lambda args
|
|
|
|
(proc (apply (apply compose rest) args)))))
|
|
|
|
(export compose))
|
2017-07-21 23:29:57 +01:00
|
|
|
(mes))
|