3 ;;; GNU Mes --- Maxwell Equations of Software
4 ;;; Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
6 ;;; This file is part of GNU Mes.
8 ;;; GNU Mes is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Mes is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (mes guile)
56 ;;#:re-export (open-input-file open-input-string with-input-from-string)
62 (define %host-type (string-append (utsname:machine (uname)) "linux-gnu")))
67 (define pmatch-car car)
68 (define pmatch-cdr cdr)
69 (define core:exit exit)
70 (define core:display display)
71 (define core:display-port display)
72 (define (core:display-error o) (display o (current-error-port)))
73 (define core:write write)
74 (define (core:write-error o) (write o (current-error-port)))
75 (define core:write-port write)
76 (define core:macro-expand identity)
77 (define (core:apply f a . m) (apply f a))
78 (define (core:car f a . m) (apply f a))
79 (define append2 append)
80 (define equal2? equal?)
82 (define guile:keyword? keyword?)
83 (define guile:number? number?)
84 (define guile:pair? pair?)
85 (define guile:string? string?)
86 (define guile:symbol? symbol?)
88 (define <cell:char> 0)
89 (define <cell:keyword> 4)
90 (define <cell:number> 6)
91 (define <cell:pair> 7)
92 (define <cell:string> 10)
93 (define <cell:symbol> 11)
94 (define <cell:vector> 15)
95 (define %arch (car (string-split %host-type #\-)))
96 (define %compiler "gnuc")
98 (define %compiler "gnuc")
99 (define keyword->string (compose symbol->string keyword->symbol))
101 (define (core:type x)
102 (cond ((guile:keyword? x) <cell:keyword>)
103 ((guile:number? x) <cell:number>)
104 ((guile:pair? x) <cell:pair>)
105 ((guile:string? x) <cell:string>)
106 ((guile:symbol? x) <cell:symbol>)))
108 (cond ((guile:string? x) (string->list x))))
109 (define (core:make-cell type car cdr)
110 (cond ((eq? type <cell:string>) (list->string car)))))
117 (use-modules (ice-9 syncase))
118 (define (compose proc . rest)
119 (if (null? rest) proc
121 (proc (apply (apply compose rest) args)))))