Changeset 15143 in project for chicken


Ignore:
Timestamp:
07/03/09 10:46:56 (10 years ago)
Author:
felix
Message:

foreign-code accepts symbol argument

Location:
chicken/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/chicken-ffi-syntax.scm

    r12937 r15143  
    138138 (##sys#er-transformer
    139139  (lambda (form r c)
    140     (##sys#check-syntax 'foreign-value form '(_ string _))
    141     (let ([tmp (gensym 'code_)])
     140    (##sys#check-syntax 'foreign-value form '(_ _ _))
     141    (let ((tmp (gensym 'code_))
     142          (code (cadr form)))
    142143      `(,(r 'begin)
    143         (,(r 'define-foreign-variable) ,tmp ,(caddr form) ,(cadr form))
     144        (,(r 'define-foreign-variable) ,tmp
     145         ,(cond ((string? code) code)
     146                ((symbol? code) (symbol->string code))
     147                (else (syntax-error 'foreign-value "bad argument type - not a string or symbol" code)))
     148         ,(cadr form))
    144149        ,tmp) ) ) ) )
    145150
  • chicken/trunk/eval.scm

    r15119 r15143  
    712712                                   (let-values ([(exp _)
    713713                                                 (##sys#do-the-right-thing (car ids) #f imp?)])
    714                                      `(,(rename 'begin se) ,exp ,(loop (cdr ids))) ) ) )
     714                                     `(##core#begin ,exp ,(loop (cdr ids))) ) ) )
    715715                             e #f tf cntr se) ) ]
    716716
  • chicken/trunk/manual/Accessing external objects

    r13710 r15143  
    2121=== foreign-value
    2222
    23  [syntax] (foreign-value STRING TYPE)
     23 [syntax] (foreign-value CODE TYPE)
    2424
    25 Evaluates the embedded C/C++ expression {{STRING}}, returning a value of type given
     25Evaluates the embedded C/C++ expression {{CODE}} (which may be a string or symbol), returning a value of type given
    2626in the foreign-type specifier {{TYPE}}.
    2727
Note: See TracChangeset for help on using the changeset viewer.