mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +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))
|
||||
`(Cyc-foreign-code ,@(cdr expr)))))
|
||||
|
||||
;(pretty-print
|
||||
;(
|
||||
(define-syntax define-foreign-code
|
||||
;(pretty-print (
|
||||
(define-syntax define-foreign-lambda
|
||||
(er-macro-transformer
|
||||
(lambda (expr rename compare)
|
||||
(let* ((scm-fnc (cadr expr))
|
||||
|
@ -46,7 +45,7 @@
|
|||
(apply string-append
|
||||
(map
|
||||
(lambda (sym/unbox)
|
||||
(string-append "," (car sym/unbox)))
|
||||
(string-append ", object " (car sym/unbox)))
|
||||
arg-syms/unbox))
|
||||
")"))
|
||||
(body
|
||||
|
@ -54,12 +53,14 @@
|
|||
(string-append
|
||||
"return_closcall1(data, k, obj_int2obj(" c-fnc "(" (string-join (map cdr arg-syms/unbox) ",") ")));"))
|
||||
)
|
||||
`((define-c ,scm-fnc ,args ,body)
|
||||
)))
|
||||
; '(define-foreign-lambda scm-strlen int "strlen" string)
|
||||
; list
|
||||
; list)
|
||||
`(define-c ,scm-fnc ,args ,body)
|
||||
))
|
||||
'(define-foreign-lambda scm-strlen int "strlen" string)
|
||||
list
|
||||
list
|
||||
)
|
||||
)
|
||||
|
||||
(define-foreign-lambda scm-strlen int "strlen" string)
|
||||
(display (scm-strlen "testing 1, 2, 3"))
|
||||
(newline)
|
||||
|
|
Loading…
Add table
Reference in a new issue