Changeset 27219 in project


Ignore:
Timestamp:
08/07/12 04:26:35 (9 years ago)
Author:
Ivan Raikov
Message:

nemo: ensure that system functions have access to global constants in Matlab/Octave? backend

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/nemo/trunk/nemo-matlab.scm

    r27120 r27219  
    423423 
    424424(define (make-define-fn)
    425   (lambda (indent n proc)
     425  (lambda (globals indent n proc)
    426426    (let ((lst (procedure-data proc))
    427427          (indent+ (+ 2 indent)))
     
    432432            (body     (lookup-def 'body lst)))
    433433        (pp indent ,nl (function ,retval = ,(matlab-name n) (,(slp ", " vars)) ))
     434        (if (not (null? globals))
     435            (pp indent+ (global ,(slp " " (filter (lambda (x) (not (member x vars))) globals)))))
    434436        (let* ((body0 (rhsexpr/MATLAB body))
    435437               (body1 (canonicalize-expr/MATLAB body0))
     
    952954                               (with-output-to-port output1
    953955                                 (lambda ()
    954                                    (apply define-fn (cons indent fndef))
     956                                   (apply define-fn (cons globals (cons indent fndef)))
    955957                                   (pp indent ,nl)))
    956958                               (if (not output) (close-output-port output1)))))
Note: See TracChangeset for help on using the changeset viewer.