From 2faa5fbb9ac40d61b3c980224b011c52b28fbdb4 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 21 Apr 2020 19:08:33 -0400 Subject: [PATCH] Working prototype with strlen() --- test-foreign.scm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test-foreign.scm b/test-foreign.scm index 9185c5d1..275a409a 100644 --- a/test-foreign.scm +++ b/test-foreign.scm @@ -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)