Fixing the documentation internal links to work
This commit is contained in:
parent
16bb63582d
commit
6443a98a06
117
README.md
117
README.md
|
|
@ -192,9 +192,11 @@ and work, they should work too.
|
||||||
- [Loko](https://scheme.fail/)
|
- [Loko](https://scheme.fail/)
|
||||||
- Desires no C interop, I can respect that
|
- Desires no C interop, I can respect that
|
||||||
|
|
||||||
## Documentation <a name="documentation"></a>
|
## Documentation
|
||||||
|
<a name="documentation"></a>
|
||||||
|
|
||||||
### Installation <a name="installation"></a>
|
### Installation
|
||||||
|
<a name="installation"></a>
|
||||||
|
|
||||||
Download the latest release from
|
Download the latest release from
|
||||||
[https://git.sr.ht/~retropikzel/r7rs-pffi/refs](https://git.sr.ht/~retropikzel/r7rs-pffi/refs).
|
[https://git.sr.ht/~retropikzel/r7rs-pffi/refs](https://git.sr.ht/~retropikzel/r7rs-pffi/refs).
|
||||||
|
|
@ -202,24 +204,29 @@ Download the latest release from
|
||||||
Unpack it somewhere and copy the directory called "retropikzel" to your projects
|
Unpack it somewhere and copy the directory called "retropikzel" to your projects
|
||||||
library directory. For the rest of this documentation it is assumed to be ./snow.
|
library directory. For the rest of this documentation it is assumed to be ./snow.
|
||||||
|
|
||||||
#### Compiling the libary <a name="compiling-the-library"></a>
|
#### Compiling the libary
|
||||||
|
<a name="compiling-the-library"></a>
|
||||||
Some implementations need extra step of compiling the library. Change directory
|
Some implementations need extra step of compiling the library. Change directory
|
||||||
to ./snow/retropikzel/pffi and run command corresponding to your implementation.
|
to ./snow/retropikzel/pffi and run command corresponding to your implementation.
|
||||||
|
|
||||||
##### Chibi <a name="compiling-the-library-chibi"></a>
|
##### Chibi
|
||||||
|
<a name="compiling-the-library-chibi"></a>
|
||||||
|
|
||||||
make -C ./snow/retropikzel/pffi chibi-pffi.so
|
make -C ./snow/retropikzel/pffi chibi-pffi.so
|
||||||
|
|
||||||
##### Gauche <a name="compiling-the-library-gauche"></a>
|
##### Gauche
|
||||||
|
<a name="compiling-the-library-gauche"></a>
|
||||||
|
|
||||||
make -C ./snow/retropikzel/pffi gauche-pffi.so
|
make -C ./snow/retropikzel/pffi gauche-pffi.so
|
||||||
|
|
||||||
#### Dependencies <a name="dependencies"></a>
|
#### Dependencies
|
||||||
|
<a name="dependencies"></a>
|
||||||
|
|
||||||
Some implementations have extra dependencies/requirements beyond just the
|
Some implementations have extra dependencies/requirements beyond just the
|
||||||
library.
|
library.
|
||||||
|
|
||||||
#### Chibi <a name="dependencies-chibi"></a>
|
#### Chibi
|
||||||
|
<a name="dependencies-chibi"></a>
|
||||||
|
|
||||||
Building depends on libffi.
|
Building depends on libffi.
|
||||||
|
|
||||||
|
|
@ -227,13 +234,15 @@ Debian/Ubuntu/Mint install with:
|
||||||
|
|
||||||
apt install libffi-dev
|
apt install libffi-dev
|
||||||
|
|
||||||
#### Chicken <a name="dependencies-chicken"></a>
|
#### Chicken
|
||||||
|
<a name="dependencies-chicken"></a>
|
||||||
|
|
||||||
Needs [r7rs egg](https://wiki.call-cc.org/eggref/5/r7rs), install with:
|
Needs [r7rs egg](https://wiki.call-cc.org/eggref/5/r7rs), install with:
|
||||||
|
|
||||||
chicken-install r7rs
|
chicken-install r7rs
|
||||||
|
|
||||||
#### Gauche <a name="dependencies-gauche"></a>
|
#### Gauche
|
||||||
|
<a name="dependencies-gauche"></a>
|
||||||
|
|
||||||
Building depends on libffi.
|
Building depends on libffi.
|
||||||
|
|
||||||
|
|
@ -241,13 +250,15 @@ Debian/Ubuntu/Mint install with:
|
||||||
|
|
||||||
apt install libffi-dev
|
apt install libffi-dev
|
||||||
|
|
||||||
#### Racket <a name="dependencies-racket"></a>
|
#### Racket
|
||||||
|
<a name="dependencies-racket"></a>
|
||||||
|
|
||||||
Needs [racket-r7rs](https://github.com/lexi-lambda/racket-r7rs), install with:
|
Needs [racket-r7rs](https://github.com/lexi-lambda/racket-r7rs), install with:
|
||||||
|
|
||||||
raco pkg install --auto r7rs
|
raco pkg install --auto r7rs
|
||||||
|
|
||||||
#### Kawa <a name="dependencies-kawa"></a>
|
#### Kawa
|
||||||
|
<a name="dependencies-kawa"></a>
|
||||||
|
|
||||||
Kawa Needs at least Java version 22 and jvm flags:
|
Kawa Needs at least Java version 22 and jvm flags:
|
||||||
|
|
||||||
|
|
@ -291,26 +302,30 @@ Types are given as symbols, for example 'int8 or 'pointer.
|
||||||
|
|
||||||
Some of these are procedures and some macros, it might also change implementation to implementation.
|
Some of these are procedures and some macros, it might also change implementation to implementation.
|
||||||
|
|
||||||
#### pffi-init <a name="pffi-init"></a>
|
#### pffi-init
|
||||||
|
<a name="pffi-init"></a>
|
||||||
|
|
||||||
**pffi-init**
|
**pffi-init**
|
||||||
|
|
||||||
Always call this first, on most implementation it does nothing but some implementations might need
|
Always call this first, on most implementation it does nothing but some implementations might need
|
||||||
initialisation run.
|
initialisation run.
|
||||||
|
|
||||||
#### pffi-size-of <a name="pffi-size-of"></a>
|
#### pffi-size-of
|
||||||
|
<a name="pffi-size-of"></a>
|
||||||
|
|
||||||
**pffi-size-of** object -> number
|
**pffi-size-of** object -> number
|
||||||
|
|
||||||
Returns the size of the pffi-struct, pffi-enum or pffi-type.
|
Returns the size of the pffi-struct, pffi-enum or pffi-type.
|
||||||
|
|
||||||
#### pffi-align-of <a name="pffi-align-of"></a>
|
#### pffi-align-of
|
||||||
|
<a name="pffi-align-of"></a>
|
||||||
|
|
||||||
**pffi-align-of** type -> number
|
**pffi-align-of** type -> number
|
||||||
|
|
||||||
Returns the align of the type.
|
Returns the align of the type.
|
||||||
|
|
||||||
#### pffi-define-library <a name="pffi-define-library"></a>
|
#### pffi-define-library
|
||||||
|
<a name="pffi-define-library"></a>
|
||||||
|
|
||||||
**pffi-define-library** headers shared-object-name [options] -> object
|
**pffi-define-library** headers shared-object-name [options] -> object
|
||||||
|
|
||||||
|
|
@ -355,43 +370,50 @@ implementations.
|
||||||
- Do pass the options using quote
|
- Do pass the options using quote
|
||||||
- As '(... and not (list...
|
- As '(... and not (list...
|
||||||
|
|
||||||
#### pffi-pointer-null <a name="pffi-pointer-null"></a>
|
#### pffi-pointer-null
|
||||||
|
<a name="pffi-pointer-null"></a>
|
||||||
|
|
||||||
**pffi-pointer-null** -> pointer
|
**pffi-pointer-null** -> pointer
|
||||||
|
|
||||||
Returns a new NULL pointer.
|
Returns a new NULL pointer.
|
||||||
|
|
||||||
#### pffi-pointer-null? <a name="pffi-pointer-null?"></a>
|
#### pffi-pointer-null?
|
||||||
|
<a name="pffi-pointer-null?"></a>
|
||||||
|
|
||||||
**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 <a name="pffi-pointer-allocate"></a>
|
#### pffi-pointer-allocate
|
||||||
|
<a name="pffi-pointer-allocate"></a>
|
||||||
|
|
||||||
**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-address <a name="pffi-pointer-address"></a>
|
#### pffi-pointer-address
|
||||||
|
<a name="pffi-pointer-address"></a>
|
||||||
|
|
||||||
**pffi-pointer-address** pointer -> number
|
**pffi-pointer-address** pointer -> number
|
||||||
|
|
||||||
Returns the address of given pointer as number.
|
Returns the address of given pointer as number.
|
||||||
|
|
||||||
#### pffi-pointer? <a name="pffi-pointer?"></a>
|
#### pffi-pointer?
|
||||||
|
<a name="pffi-pointer?"></a>
|
||||||
|
|
||||||
**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 <a name="pffi-pointer-free"></a>
|
#### pffi-pointer-free
|
||||||
|
<a name="pffi-pointer-free"></a>
|
||||||
|
|
||||||
**pffi-pointer-free** pointer
|
**pffi-pointer-free** pointer
|
||||||
|
|
||||||
Frees given pointer.
|
Frees given pointer.
|
||||||
|
|
||||||
#### pffi-pointer-set! <a name="pffi-pointer-set!"></a>
|
#### pffi-pointer-set!
|
||||||
|
<a name="pffi-pointer-set!"></a>
|
||||||
|
|
||||||
**pffi-pointer-set!** pointer type offset value
|
**pffi-pointer-set!** pointer type offset value
|
||||||
|
|
||||||
|
|
@ -402,7 +424,8 @@ 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 <a name="pffi-pointer-get"></a>
|
#### pffi-pointer-get
|
||||||
|
<a name="pffi-pointer-get"></a>
|
||||||
|
|
||||||
**pffi-pointer-get** pointer type offset -> object
|
**pffi-pointer-get** pointer type offset -> object
|
||||||
|
|
||||||
|
|
@ -413,19 +436,22 @@ 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 <a name="pffi-string-to-pointer"></a>
|
#### pffi-string->pointer
|
||||||
|
<a name="pffi-string-to-pointer"></a>
|
||||||
|
|
||||||
**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 <a name="pffi-pointer-to-string"></a>
|
#### pffi-pointer->string
|
||||||
|
<a name="pffi-pointer-to-string"></a>
|
||||||
|
|
||||||
**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 <a name="pffi-struct-make"></a>
|
#### pffi-struct-make
|
||||||
|
<a name="pffi-struct-make"></a>
|
||||||
|
|
||||||
**pffi-struct-make** c-type members . pointer -> pffi-struct
|
**pffi-struct-make** c-type members . pointer -> pffi-struct
|
||||||
|
|
||||||
|
|
@ -437,7 +463,8 @@ names and types. For example:
|
||||||
|
|
||||||
C-type argument can be symbol or a string.
|
C-type argument can be symbol or a string.
|
||||||
|
|
||||||
#### pffi-struct-pointer <a name="pffi-struct-pointer"></a>
|
#### pffi-struct-pointer
|
||||||
|
<a name="pffi-struct-pointer"></a>
|
||||||
|
|
||||||
**pffi-struct-pointer** pffi-struct -> pointer
|
**pffi-struct-pointer** pffi-struct -> pointer
|
||||||
|
|
||||||
|
|
@ -447,68 +474,79 @@ 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 <a name="pffi-struct-offset-get"></a>
|
#### pffi-struct-offset-get
|
||||||
|
<a name="pffi-struct-offset-get"></a>
|
||||||
|
|
||||||
**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 <a name="pffi-struct-get"></a>
|
#### pffi-struct-get
|
||||||
|
<a name="pffi-struct-get"></a>
|
||||||
|
|
||||||
**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! <a name="pffi-struct-set!"></a>
|
#### pffi-struct-set!
|
||||||
|
<a name="pffi-struct-set!"></a>
|
||||||
|
|
||||||
**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-array-allocate <a name="pffi-array-allocate"></a>
|
#### pffi-array-allocate
|
||||||
|
<a name="pffi-array-allocate"></a>
|
||||||
|
|
||||||
**pffi-array-allocate** type size
|
**pffi-array-allocate** type size
|
||||||
|
|
||||||
Allocates pointer array of given type and size.
|
Allocates pointer array of given type and size.
|
||||||
|
|
||||||
#### pffi-array? <a name="pffi-is-array"></a>
|
#### pffi-array?
|
||||||
|
<a name="pffi-is-array"></a>
|
||||||
|
|
||||||
**pffi-array?** object
|
**pffi-array?** object
|
||||||
|
|
||||||
Returns #t of given object is array, #f otherwise.
|
Returns #t of given object is array, #f otherwise.
|
||||||
|
|
||||||
#### pffi-pointer->array <a name="pffi-pointer->array"></a>
|
#### pffi-pointer->array
|
||||||
|
<a name="pffi-pointer->array"></a>
|
||||||
|
|
||||||
**pffi-pointer->array** pointer type size
|
**pffi-pointer->array** pointer type size
|
||||||
|
|
||||||
Converts given pointer to an array of giben type and size.
|
Converts given pointer to an array of giben type and size.
|
||||||
|
|
||||||
#### pffi-array-get <a name="pffi-array-get"></a>
|
#### pffi-array-get
|
||||||
|
<a name="pffi-array-get"></a>
|
||||||
|
|
||||||
**pffi-array-get** array index
|
**pffi-array-get** array index
|
||||||
|
|
||||||
Returns the value of given index from given array.
|
Returns the value of given index from given array.
|
||||||
|
|
||||||
#### pffi-array-set! <a name="pffi-array-set!"></a>
|
#### pffi-array-set!
|
||||||
|
<a name="pffi-array-set!"></a>
|
||||||
|
|
||||||
**pffi-array-set!** array index value
|
**pffi-array-set!** array index value
|
||||||
|
|
||||||
Sets the given value of given index in given array.
|
Sets the given value of given index in given array.
|
||||||
|
|
||||||
#### pffi-list->array <a name="pffi-list-to-array"></a>
|
#### pffi-list->array
|
||||||
|
<a name="pffi-list-to-array"></a>
|
||||||
|
|
||||||
**pffi-list->array** type list
|
**pffi-list->array** type list
|
||||||
|
|
||||||
Converts given list into C array of given type.
|
Converts given list into C array of given type.
|
||||||
|
|
||||||
#### pffi-array->list <a name="pffi-array-to-list"></a>
|
#### pffi-array->list
|
||||||
|
<a name="pffi-array-to-list"></a>
|
||||||
|
|
||||||
**pffi-array->list** type list length
|
**pffi-array->list** type list length
|
||||||
|
|
||||||
Converts given C array into list of given type and length.
|
Converts given C array into list of given type and length.
|
||||||
|
|
||||||
#### pffi-define <a name="pffi-define"></a>
|
#### pffi-define
|
||||||
|
<a name="pffi-define"></a>
|
||||||
|
|
||||||
**pffi-define** scheme-name shared-object c-name return-type argument-types
|
**pffi-define** scheme-name shared-object c-name return-type argument-types
|
||||||
|
|
||||||
|
|
@ -520,7 +558,8 @@ Defines a new foreign function to be used from Scheme code. For example:
|
||||||
(pffi-define c-puts libc-stdlib 'puts 'int '(pointer))
|
(pffi-define c-puts libc-stdlib 'puts 'int '(pointer))
|
||||||
(c-puts "Message brought to you by FFI!")
|
(c-puts "Message brought to you by FFI!")
|
||||||
|
|
||||||
#### pffi-define-callback <a name="pffi-define-callback"></a>
|
#### pffi-define-callback
|
||||||
|
<a name="pffi-define-callback"></a>
|
||||||
|
|
||||||
**pffi-define-callback** scheme-name return-type argument-types procedure
|
**pffi-define-callback** scheme-name return-type argument-types procedure
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue