Changeset 22115 in project


Ignore:
Timestamp:
12/25/10 16:20:16 (10 years ago)
Author:
Ivan Raikov
Message:

9ML-toolkit: NineMLrepr and NineMLparse as .so extensions

Location:
release/4/9ML-toolkit/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • release/4/9ML-toolkit/trunk/9ML-toolkit.setup

    r22027 r22115  
    1717        (run (csi -s expr.grm)))
    1818
     19       ((dynld-name "NineMLparse") ("NineMLparse.scm" "NineML.l.scm" "NineML.grm.scm" "expr.grm.scm" "expr-parser.scm")
     20        (compile -O -d2 -S -s NineMLparse.scm -j NineMLparse))
     21
     22       ((dynld-name "NineMLparse.import") ("NineMLparse.import.scm")
     23        (compile  -s NineMLparse.import.scm))
     24
     25       ((dynld-name "NineMLrepr") ("NineMLrepr.scm" "SXML.scm" "SXML-to-XML.scm" )
     26        (compile -O -d2 -S -s NineMLrepr.scm -j NineMLrepr))
     27
     28       ((dynld-name "NineMLrepr.import") ("NineMLrepr.import.scm")
     29        (compile  -s NineMLrepr.import.scm))
     30
    1931       ("9ML-report"
    2032        ("NineMLcore.scm" "NineMLsignal.scm" "NineMLdiagram.scm" "NineMLinterval.scm"  "NineMLgraph.scm"
    21          "NineMLparse.scm" "NineML.l.scm" "NineML.grm.scm" "expr.grm.scm" "expr-parser.scm"
    22          "NineMLrepr.scm"  "report.scm" )
     33         "report.scm" )
    2334        (compile -O -d2 -S report.scm -o 9ML-report ))
    2435
    2536       ("9ML-ivp"
    2637        ("NineMLcore.scm" "NineMLsignal.scm" "NineMLdiagram.scm" "NineMLinterval.scm" "NineMLgraph.scm" "NineMLivp.scm"
    27          "NineMLparse.scm" "NineML.l.scm" "NineML.grm.scm" "expr.grm.scm" "expr-parser.scm"
    28          "NineMLrepr.scm" "ivp.scm" )
     38         "ivp.scm" )
    2939        (compile -O -d2 -S ivp.scm -o 9ML-ivp ))
    3040
    3141       ("9ML-shell"
    3242        ("NineMLcore.scm" "NineMLsignal.scm" "NineMLdiagram.scm" "NineMLinterval.scm" "NineMLgraph.scm" 
    33          "NineMLparse.scm" "NineML.l.scm" "NineML.grm.scm" "expr.grm.scm" "expr-parser.scm"
    34          "NineMLrepr.scm" "shell.scm" )
     43         "shell.scm" )
    3544        (compile -O -d2 -S shell.scm -o 9ML-shell ))
    3645
    3746       )
    3847
    39   (list "9ML-report" "9ML-ivp" "9ML-shell")
     48  (list (dynld-name "NineMLrepr") (dynld-name "NineMLrepr.import")
     49        (dynld-name "NineMLparse") (dynld-name "NineMLparse.import")
     50        "9ML-report" "9ML-ivp" "9ML-shell")
    4051
    4152  )
     53
     54
     55(install-extension
     56
     57  ; Name of your extension:
     58  'NineMLrepr
     59
     60  ; Files to install for your extension:
     61  `(,(dynld-name "NineMLrepr") ,(dynld-name "NineMLrepr.import") )
     62
     63  ; Assoc list with properties for your extension:
     64  `((version 1.1)
     65    ))
     66
     67
     68(install-extension
     69
     70  ; Name of your extension:
     71  'NineMLparse
     72
     73  ; Files to install for your extension:
     74  `(,(dynld-name "NineMLparse") ,(dynld-name "NineMLparse.import") )
     75
     76  ; Assoc list with properties for your extension:
     77  `((version 1.1)
     78    ))
    4279
    4380
  • release/4/9ML-toolkit/trunk/NineMLrepr.scm

    r22114 r22115  
     1
     2;;
     3;;  Different internal representations for NineML.
     4;;
     5;; Copyright 2010 Ivan Raikov and the Okinawa Institute of
     6;; Science and Technology.
     7;;
     8;; This program is free software: you can redistribute it and/or
     9;; modify it under the terms of the GNU General Public License as
     10;; published by the Free Software Foundation, either version 3 of the
     11;; License, or (at your option) any later version.
     12;;
     13;; This program 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 GNU
     16;; General Public License for more details.
     17;;
     18;; A full copy of the GPL license can be found at
     19;; <http://www.gnu.org/licenses/>.
     20;;
     21
     22
     23(module NineMLrepr
     24
     25        (sxml-value->sexpr print-fragments
     26         print-eval-env print-type-env print-source-defs print-nxml )
     27
     28        (import scheme chicken
     29                (only srfi-1 fold combine every unzip2 filter-map partition delete-duplicates)
     30                (only data-structures compose identity atom? )
     31                (only extras fprintf pp)
     32                )
     33
     34        (require-extension matchable datatype static-modules miniML miniMLeval signal-diagram
     35                           ssax sxml-transforms sxpath sxpath-lolevel)
     36
     37
     38(include "SXML.scm")
     39(include "SXML-to-XML.scm")
     40
     41
    142
    243(define-record-printer (value x out)
     
    950                  (Prim_v (p) `(Prim ,p))
    1051                  (Tuple_v (d) `(Data ,d)))))
     52
     53
     54(define (enumvars expr ax)
     55  (if (pair? expr)
     56      (case (car expr)
     57        ((cond)  (fold (lambda (x ax) (enumvars x ax)) ax (cdr expr)))
     58        (else  (if (symbol? (car expr))  (fold (lambda (x ax) (enumvars x ax)) ax (cdr expr)) ax)))
     59      (if (symbol? expr) (cons expr ax) ax)))
     60
     61(define (sexpr->function sexpr)  (make-function (enumvars sexpr '()) sexpr))
    1162
    1263
     
    141192
    142193(define (signal-op->mathml op)
    143   (case
    144       ((add) 'plus)
    145       ((sub) 'minus)
    146       ((mul) 'multiply)
    147       ((div) 'divide)
    148       (else op)))
     194  (case op
     195    ((add) 'plus)
     196    ((sub) 'minus)
     197    ((mul) 'multiply)
     198    ((div) 'divide)
     199    (else op)))
    149200
    150201
     
    394445                   (let ((node (cons tag elems)))
    395446                     (let ((formal (sxml:attr node 'formal))
    396                            (body   (sxml:kid node 'body)))
     447                           (body   (sxml:kidn node 'body)))
    397448                       `(Core:Function (@ (formal ,formal)) ,body)
    398449                       ))))
     
    446497           
    447498      ))))
     499)
  • release/4/9ML-toolkit/trunk/ivp.scm

    r22114 r22115  
    2323(require-extension getopt-long ssax sxml-transforms sxpath sxpath-lolevel object-graph)
    2424(require-extension signal-diagram )
     25(require-extension NineMLparse NineMLrepr)
    2526
    2627(include "SXML.scm")
     
    4344(include "NineMLgraph.scm")
    4445(include "NineMLivp.scm")
    45 
    46 (include "NineMLrepr.scm")
    47 (include "NineMLparse.scm")
    48 (import NineMLparse)
    4946
    5047(define init-scope      (make-parameter st-empty))
     
    207204
    208205
    209   (define (sexpr->function sexpr)  (make-function (enumvars sexpr '()) sexpr))
     206
    210207
    211208  (define (sexpr->diagram+initial+fundecls h sexpr)
  • release/4/9ML-toolkit/trunk/report.scm

    r22114 r22115  
    2222(require-extension setup-api srfi-13 datatype static-modules miniML miniMLsyntax miniMLeval )
    2323(require-extension getopt-long ssax sxml-transforms sxpath sxpath-lolevel object-graph)
     24(require-extension NineMLrepr NineMLparse)
    2425
    2526(include "SXML.scm")
     
    4243(include "NineMLgraph.scm")
    4344
    44 (include "NineMLrepr.scm")
    45 (include "NineMLparse.scm")
    46 (import NineMLparse)
    4745
    4846(define init-scope      (make-parameter st-empty))
     
    148146(define (html-report prefix uenv)
    149147
    150   (define (enumvars expr ax)
    151     (if (pair? expr)
    152         (case (car expr)
    153           ((cond)  (fold (lambda (x ax) (enumvars x ax)) ax (cdr expr)))
    154           (else  (if (symbol? (car expr))  (fold (lambda (x ax) (enumvars x ax)) ax (cdr expr)) ax)))
    155         (if (symbol? expr) (cons expr ax) ax)))
    156 
    157 
    158 
    159 
    160   (define (sexpr->function sexpr)  (make-function (enumvars sexpr '()) sexpr))
    161148
    162149  (define (sexpr->diagram+initial+fundecls h sexpr)
  • release/4/9ML-toolkit/trunk/shell.scm

    r22114 r22115  
    2222(require-extension setup-api srfi-13 datatype matchable static-modules miniML miniMLsyntax miniMLeval )
    2323(require-extension getopt-long ssax sxml-transforms sxpath sxpath-lolevel object-graph)
     24(require-extension NineMLparse NineMLrepr)
    2425
    2526(include "SXML.scm")
     
    4243(include "NineMLinterval.scm")
    4344(include "NineMLgraph.scm")
    44 
    45 (include "NineMLrepr.scm")
    46 (include "NineMLparse.scm")
    47 (import NineMLparse)
    4845
    4946(define init-scope      (make-parameter st-empty))
Note: See TracChangeset for help on using the changeset viewer.