Added stklos support
This commit is contained in:
		
							parent
							
								
									76eb8058a8
								
							
						
					
					
						commit
						d7de538744
					
				| 
						 | 
					@ -461,7 +461,7 @@
 | 
				
			||||||
              pffi-struct-offset-get
 | 
					              pffi-struct-offset-get
 | 
				
			||||||
              pffi-struct-get
 | 
					              pffi-struct-get
 | 
				
			||||||
              pffi-struct-set!
 | 
					              pffi-struct-set!
 | 
				
			||||||
              ;pffi-define
 | 
					              pffi-define
 | 
				
			||||||
              ;pffi-define-callback
 | 
					              ;pffi-define-callback
 | 
				
			||||||
              ))
 | 
					              ))
 | 
				
			||||||
    (tr7
 | 
					    (tr7
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,17 +26,48 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define pffi-pointer?
 | 
					(define pffi-pointer?
 | 
				
			||||||
  (lambda (object)
 | 
					  (lambda (object)
 | 
				
			||||||
 | 
					    (display "HERE: ")
 | 
				
			||||||
 | 
					    (write object)
 | 
				
			||||||
 | 
					    (newline)
 | 
				
			||||||
 | 
					    (write (cpointer? object))
 | 
				
			||||||
 | 
					    (newline)
 | 
				
			||||||
    (cpointer? object)))
 | 
					    (cpointer? object)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define-syntax pffi-define
 | 
					(define-syntax pffi-define
 | 
				
			||||||
  (syntax-rules ()
 | 
					  (syntax-rules ()
 | 
				
			||||||
    ((pffi-define scheme-name shared-object c-name return-type argument-types)
 | 
					    ((pffi-define scheme-name shared-object c-name return-type argument-types)
 | 
				
			||||||
 | 
					     (begin
 | 
				
			||||||
 | 
					       (define pffi-type->native-type
 | 
				
			||||||
 | 
					  (lambda (type)
 | 
				
			||||||
 | 
					    (cond ((equal? type 'int8) :int)
 | 
				
			||||||
 | 
					          ((equal? type 'uint8) :uint)
 | 
				
			||||||
 | 
					          ((equal? type 'int16) :int)
 | 
				
			||||||
 | 
					          ((equal? type 'uint16) :uint)
 | 
				
			||||||
 | 
					          ((equal? type 'int32) :int)
 | 
				
			||||||
 | 
					          ((equal? type 'uint32) :uint)
 | 
				
			||||||
 | 
					          ((equal? type 'int64) :int)
 | 
				
			||||||
 | 
					          ((equal? type 'uint64) :uint)
 | 
				
			||||||
 | 
					          ((equal? type 'char) :char)
 | 
				
			||||||
 | 
					          ((equal? type 'unsigned-char) :uchar)
 | 
				
			||||||
 | 
					          ((equal? type 'short) :short)
 | 
				
			||||||
 | 
					          ((equal? type 'unsigned-short) :ushort)
 | 
				
			||||||
 | 
					          ((equal? type 'int) :int)
 | 
				
			||||||
 | 
					          ((equal? type 'unsigned-int) :uint)
 | 
				
			||||||
 | 
					          ((equal? type 'long) :long)
 | 
				
			||||||
 | 
					          ((equal? type 'unsigned-long) :ulong)
 | 
				
			||||||
 | 
					          ((equal? type 'float) :float)
 | 
				
			||||||
 | 
					          ((equal? type 'double) :double)
 | 
				
			||||||
 | 
					          ((equal? type 'pointer) :pointer)
 | 
				
			||||||
 | 
					          ((equal? type 'string) :string)
 | 
				
			||||||
 | 
					          ((equal? type 'void) :void)
 | 
				
			||||||
 | 
					          ((equal? type 'struct) :void)
 | 
				
			||||||
 | 
					          (else (error "pffi-type->native-type -- No such pffi type" type)))))
 | 
				
			||||||
     (define scheme-name
 | 
					     (define scheme-name
 | 
				
			||||||
       (make-external-function
 | 
					       (make-external-function
 | 
				
			||||||
         (symbol->string c-name)
 | 
					         (symbol->string c-name)
 | 
				
			||||||
         (map pffi-type->native-type argument-types)
 | 
					         (map pffi-type->native-type argument-types)
 | 
				
			||||||
         (pffi-type->native-type return-type)
 | 
					         (pffi-type->native-type return-type)
 | 
				
			||||||
         shared-object)))))
 | 
					         shared-object))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define pffi-define-callback
 | 
					(define pffi-define-callback
 | 
				
			||||||
  (lambda ()
 | 
					  (lambda ()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue