mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
Working prototype with strlen()
This commit is contained in:
parent
3a9777735a
commit
2faa5fbb9a
1 changed files with 10 additions and 9 deletions
|
@ -15,9 +15,8 @@
|
||||||
(cdr expr))
|
(cdr expr))
|
||||||
`(Cyc-foreign-code ,@(cdr expr)))))
|
`(Cyc-foreign-code ,@(cdr expr)))))
|
||||||
|
|
||||||
;(pretty-print
|
;(pretty-print (
|
||||||
;(
|
(define-syntax define-foreign-lambda
|
||||||
(define-syntax define-foreign-code
|
|
||||||
(er-macro-transformer
|
(er-macro-transformer
|
||||||
(lambda (expr rename compare)
|
(lambda (expr rename compare)
|
||||||
(let* ((scm-fnc (cadr expr))
|
(let* ((scm-fnc (cadr expr))
|
||||||
|
@ -46,7 +45,7 @@
|
||||||
(apply string-append
|
(apply string-append
|
||||||
(map
|
(map
|
||||||
(lambda (sym/unbox)
|
(lambda (sym/unbox)
|
||||||
(string-append "," (car sym/unbox)))
|
(string-append ", object " (car sym/unbox)))
|
||||||
arg-syms/unbox))
|
arg-syms/unbox))
|
||||||
")"))
|
")"))
|
||||||
(body
|
(body
|
||||||
|
@ -54,12 +53,14 @@
|
||||||
(string-append
|
(string-append
|
||||||
"return_closcall1(data, k, obj_int2obj(" c-fnc "(" (string-join (map cdr arg-syms/unbox) ",") ")));"))
|
"return_closcall1(data, k, obj_int2obj(" c-fnc "(" (string-join (map cdr arg-syms/unbox) ",") ")));"))
|
||||||
)
|
)
|
||||||
`((define-c ,scm-fnc ,args ,body)
|
`(define-c ,scm-fnc ,args ,body)
|
||||||
)))
|
))
|
||||||
; '(define-foreign-lambda scm-strlen int "strlen" string)
|
'(define-foreign-lambda scm-strlen int "strlen" string)
|
||||||
; list
|
list
|
||||||
; list)
|
list
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
(define-foreign-lambda scm-strlen int "strlen" string)
|
(define-foreign-lambda scm-strlen int "strlen" string)
|
||||||
(display (scm-strlen "testing 1, 2, 3"))
|
(display (scm-strlen "testing 1, 2, 3"))
|
||||||
(newline)
|
(newline)
|
||||||
|
|
Loading…
Add table
Reference in a new issue