Updating readme
This commit is contained in:
parent
ff48dd8dff
commit
b391c81f90
42
README.md
42
README.md
|
|
@ -172,19 +172,14 @@ initialisation run.
|
||||||
|
|
||||||
Returns the size of the type.
|
Returns the size of the type.
|
||||||
|
|
||||||
|
|
||||||
#### pffi-align-of
|
|
||||||
|
|
||||||
**pffi-align-of** type -> number
|
**pffi-align-of** type -> number
|
||||||
|
|
||||||
Returns the align of the type.
|
Returns the align of the type.
|
||||||
|
|
||||||
#### pffi-shared-object-auto-load
|
**pffi-shared-object-auto-load**
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
#### pffi-shared-object-load
|
|
||||||
|
|
||||||
**pffi-shared-object-load** headers path
|
**pffi-shared-object-load** headers path
|
||||||
|
|
||||||
It is recommended to use the pffi-shared-object-auto-load instead of this
|
It is recommended to use the pffi-shared-object-auto-load instead of this
|
||||||
|
|
@ -198,39 +193,26 @@ Path is the full path of the shared object without any "lib" prefix or ".so/.dll
|
||||||
|
|
||||||
"curl"
|
"curl"
|
||||||
|
|
||||||
### pffi-pointer-null
|
|
||||||
|
|
||||||
**pffi-pointer-null** -> pointer
|
**pffi-pointer-null** -> pointer
|
||||||
|
|
||||||
Returns a new NULL pointer.
|
Returns a new NULL pointer.
|
||||||
|
|
||||||
#### pffi-pointer-null?
|
|
||||||
|
|
||||||
**pffi-pointer-null?** pointer -> boolean
|
**pffi-pointer-null?** pointer -> boolean
|
||||||
|
|
||||||
Returns #t if given pointer is null pointer, #f otherwise.
|
Returns #t if given pointer is null pointer, #f otherwise.
|
||||||
|
|
||||||
### pffi-pointer-allocate
|
|
||||||
|
|
||||||
**pffi-pointer-allocate** size -> pointer
|
**pffi-pointer-allocate** size -> pointer
|
||||||
|
|
||||||
Returns newly allocated pointer of given size.
|
Returns newly allocated pointer of given size.
|
||||||
|
|
||||||
### pffi-pointer?
|
|
||||||
|
|
||||||
**pffi-pointer?** object -> boolean
|
**pffi-pointer?** object -> boolean
|
||||||
|
|
||||||
Returns #t if given object is pointer, #f otherwise.
|
Returns #t if given object is pointer, #f otherwise.
|
||||||
|
|
||||||
|
|
||||||
### pffi-pointer-free
|
|
||||||
|
|
||||||
**pffi-pointer-free** pointer
|
**pffi-pointer-free** pointer
|
||||||
|
|
||||||
Frees given pointer.
|
Frees given pointer.
|
||||||
|
|
||||||
### pffi-pointer-set!
|
|
||||||
|
|
||||||
**pffi-pointer-set!** pointer type offset value
|
**pffi-pointer-set!** pointer type offset value
|
||||||
|
|
||||||
Sets the value on a pointer on given offset. For example:
|
Sets the value on a pointer on given offset. For example:
|
||||||
|
|
@ -240,8 +222,6 @@ Sets the value on a pointer on given offset. For example:
|
||||||
|
|
||||||
Would set the offset of 64, on pointer p to value 100.
|
Would set the offset of 64, on pointer p to value 100.
|
||||||
|
|
||||||
### pffi-pointer-get
|
|
||||||
|
|
||||||
**pffi-pointer-get** pointer type offset -> object
|
**pffi-pointer-get** pointer type offset -> object
|
||||||
|
|
||||||
Gets the value from a pointer on given offset. For example:
|
Gets the value from a pointer on given offset. For example:
|
||||||
|
|
@ -251,20 +231,14 @@ Gets the value from a pointer on given offset. For example:
|
||||||
(pffi-pointer-get p 'int 64)
|
(pffi-pointer-get p 'int 64)
|
||||||
> 100
|
> 100
|
||||||
|
|
||||||
### pffi-string->pointer
|
|
||||||
|
|
||||||
**pffi-string->pointer** string -> pointer
|
**pffi-string->pointer** string -> pointer
|
||||||
|
|
||||||
Makes pointer out of a given string.
|
Makes pointer out of a given string.
|
||||||
|
|
||||||
### pffi-pointer->string
|
|
||||||
|
|
||||||
**pffi-pointer->string** pointer -> string
|
**pffi-pointer->string** pointer -> string
|
||||||
|
|
||||||
Makes string out of a given pointer.
|
Makes string out of a given pointer.
|
||||||
|
|
||||||
### pffi-struct-make
|
|
||||||
|
|
||||||
**pffi-struct-make** name members . pointer -> pffi-struct
|
**pffi-struct-make** name members . pointer -> pffi-struct
|
||||||
|
|
||||||
Creates a new pffi-struct and allocates pointer for it. The members argument is a list of member
|
Creates a new pffi-struct and allocates pointer for it. The members argument is a list of member
|
||||||
|
|
@ -272,8 +246,6 @@ names and types. For example:
|
||||||
|
|
||||||
(define s (pffi-struct-make 'test '((int . r) (int . g) (int . b))))
|
(define s (pffi-struct-make 'test '((int . r) (int . g) (int . b))))
|
||||||
|
|
||||||
### pffi-struct-size
|
|
||||||
|
|
||||||
**pffi-struct-size** pffi-struct -> number
|
**pffi-struct-size** pffi-struct -> number
|
||||||
|
|
||||||
Returns the size of a given pffi-struct. For example:
|
Returns the size of a given pffi-struct. For example:
|
||||||
|
|
@ -282,8 +254,6 @@ Returns the size of a given pffi-struct. For example:
|
||||||
(pffi-struct-size s)
|
(pffi-struct-size s)
|
||||||
> 12
|
> 12
|
||||||
|
|
||||||
### pffi-struct-pointer
|
|
||||||
|
|
||||||
**pffi-struct-pointer** pffi-struct -> pointer
|
**pffi-struct-pointer** pffi-struct -> pointer
|
||||||
|
|
||||||
Returns the pointer that holds the struct content. You need to use this when passing a struct as
|
Returns the pointer that holds the struct content. You need to use this when passing a struct as
|
||||||
|
|
@ -292,27 +262,19 @@ a pointer to foreign functions.
|
||||||
(define s (pffi-struct-make 'test '((int . r) (int . g) (int . b))))
|
(define s (pffi-struct-make 'test '((int . r) (int . g) (int . b))))
|
||||||
(pffi-struct-pointer s)
|
(pffi-struct-pointer s)
|
||||||
|
|
||||||
### pffi-struct-offset-get
|
|
||||||
|
|
||||||
**pffi-struct-offset-get** member-name -> number
|
**pffi-struct-offset-get** member-name -> number
|
||||||
|
|
||||||
Returns the offset of a struct member with given name.
|
Returns the offset of a struct member with given name.
|
||||||
|
|
||||||
### pffi-struct-get
|
|
||||||
|
|
||||||
**pffi-struct-get** pffi-struct member-name -> object
|
**pffi-struct-get** pffi-struct member-name -> object
|
||||||
|
|
||||||
Returns the value of the givens struct member.
|
Returns the value of the givens struct member.
|
||||||
|
|
||||||
### pffi-struct-set!
|
|
||||||
|
|
||||||
**pffi-struct-set!** pffi-struct member-name value
|
**pffi-struct-set!** pffi-struct member-name value
|
||||||
|
|
||||||
Sets the value of the givens struct member. It is up to you to make sure that the type of value is
|
Sets the value of the givens struct member. It is up to you to make sure that the type of value is
|
||||||
correct.
|
correct.
|
||||||
|
|
||||||
### pffi-define
|
|
||||||
|
|
||||||
**pffi-define** scheme-name shared-object c-name return-type argument-types
|
**pffi-define** scheme-name shared-object c-name return-type argument-types
|
||||||
|
|
||||||
Defines a new foreign function to be used from Scheme code. For example:
|
Defines a new foreign function to be used from Scheme code. For example:
|
||||||
|
|
@ -324,8 +286,6 @@ Defines a new foreign function to be used from Scheme code. For example:
|
||||||
(pffi-define c-puts libc-stdlib 'puts 'int (list 'pointer))
|
(pffi-define c-puts libc-stdlib 'puts 'int (list 'pointer))
|
||||||
(c-puts "Message brought to you by FFI!")
|
(c-puts "Message brought to you by FFI!")
|
||||||
|
|
||||||
### pffi-define-callback
|
|
||||||
|
|
||||||
**pffi-define-callback** scheme-name return-type argument-types procedure
|
**pffi-define-callback** scheme-name return-type argument-types procedure
|
||||||
|
|
||||||
Defines a new Sceme function to be used as callback to C code. For example:
|
Defines a new Sceme function to be used as callback to C code. For example:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue