Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions pyffi.scm
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,8 @@ EOF
(%begin (r 'begin))
(%set! (r 'set!))
(not (r 'not))
(alist-ref (r 'alist-ref))
(alist-update! (r 'alist-update!))
(hash-table-ref/default (r 'hash-table-ref/default))
(hash-table-set! (r 'hash-table-set!))
(py-eval (r 'py-eval))
(py-apply (r 'py-apply))
(raise-python-exception (r 'raise-python-exception))
Expand Down Expand Up @@ -646,6 +646,7 @@ EOF
(let ((scheme-name (member 'scheme-name: rest))
(kw (member 'kw: rest)))
(let ((%define (r 'define))
(%receive (r 'receive))
(%quote (r 'quote))
(%cons (r 'cons))
(%list (r 'list))
Expand All @@ -658,6 +659,8 @@ EOF
(%if (r 'if))
(%list->vector (r 'list->vector))
(%->string (r '->string))
(args (r 'args))
(kwargs (r 'kwargs))
(parse-argument-list (r 'parse-argument-list))
(PyObject_GetAttrString (r 'PyObject_GetAttrString))
(PyObject_CallObject (r 'PyObject_CallObject))
Expand All @@ -671,15 +674,15 @@ EOF
(,PyObject_CallObject
(,PyObject_GetAttrString ,obj ,(->string name) )
(,%list->vector ,rest)))
(let ((kwargs (map (compose string->keyword symbol->string) (cadr kw))))
(let ((the-kwargs (map (compose string->keyword symbol->string) (cadr kw))))
`(,%define (,proc-name ,obj #!rest ,rest)
(receive
(args kwargs)
(,parse-argument-list ,rest ',kwargs)
(,%receive
(,args ,kwargs)
(,parse-argument-list ,rest ',the-kwargs)
(,PyObject_Call
(,PyObject_GetAttrString ,obj ,(->string name) )
(list->vector args)
(,%if (,%null? kwargs) #f kwargs))
(list->vector ,args)
(,%if (,%null? ,kwargs) #f ,kwargs))
))
))
))
Expand Down
Loading