Fix cpointer and cstruct tag text
This commit is contained in:
parent
534d89b983
commit
07c5c076e2
|
@ -22,9 +22,10 @@ to Racket, and accept only such tagged pointers when going to C. An
|
|||
optional @racket[ptr-type] can be given to be used as the base pointer
|
||||
type, instead of @racket[_pointer].
|
||||
|
||||
By convention, tags should be symbols named after the
|
||||
type they point to. For example, the cpointer @racket[_car] should
|
||||
be created using @racket['car] as the key.
|
||||
By convention, tags are symbols named after the
|
||||
type they point to. For example, the cpointer @racket[_car] would
|
||||
be created using @racket['car] as the key. However, any symbol can be
|
||||
used as the tag.
|
||||
Pointer tags are checked with @racket[cpointer-has-tag?] and changed
|
||||
with @racket[cpointer-push-tag!] which means that other tags are
|
||||
preserved. Specifically, if a base @racket[ptr-type] is given and is
|
||||
|
@ -46,7 +47,7 @@ are not tagged.}
|
|||
scheme-to-c-expr c-to-scheme-expr)]]{
|
||||
|
||||
A macro version of @racket[_cpointer] and @racket[_cpointer/null],
|
||||
using the defined name for a tag string, and defining a predicate
|
||||
using the defined name for a tag symbol, and defining a predicate
|
||||
too. The @racket[_id] must start with @litchar{_}.
|
||||
|
||||
The optional expressions produce optional arguments to @racket[_cpointer].
|
||||
|
@ -56,7 +57,7 @@ In addition to defining @racket[_id] to a type generated by
|
|||
type produced by @racket[_cpointer/null] type. Finally,
|
||||
@racketvarfont{id}@racketidfont{?} is defined as a predicate, and
|
||||
@racketvarfont{id}@racketidfont{-tag} is defined as an accessor to
|
||||
obtain a tag. The tag is the string form of @racketvarfont{id}.}
|
||||
obtain a tag. The tag is the symbol form of @racketvarfont{id}.}
|
||||
|
||||
@defproc*[([(cpointer-has-tag? [cptr any/c] [tag any/c]) boolean?]
|
||||
[(cpointer-push-tag! [cptr any/c] [tag any/c]) void])]{
|
||||
|
|
|
@ -857,8 +857,10 @@ The resulting bindings are as follows:
|
|||
|
||||
@item{@racketvarfont{id}@racketidfont{?}: a predicate for the new type.}
|
||||
|
||||
@item{@racketvarfont{id}@racketidfont{-tag}: the tag string object that is
|
||||
used with instances.}
|
||||
@item{@racketvarfont{id}@racketidfont{-tag}: the tag object that is
|
||||
used with instances. The tag object may be the symbol form of
|
||||
@racketvarfont{id} or a list of symbols containing the @racketvarfont{id}
|
||||
symbol and other symbols, such as the @racketvarfont[super-id] symbol.}
|
||||
|
||||
@item{@racketidfont{make-}@racketvarfont{id} : a constructor, which expects
|
||||
an argument for each type.}
|
||||
|
@ -879,7 +881,8 @@ The resulting bindings are as follows:
|
|||
]
|
||||
|
||||
Objects of the new type are actually C pointers, with a type tag that
|
||||
is a list that contains the string form of @racketvarfont{id}. Since
|
||||
is the symbol form of @racketvarfont{id} or a list that contains the
|
||||
symbol form of @racketvarfont{id}. Since
|
||||
structs are implemented as pointers, they can be used for a
|
||||
@racket[_pointer] input to a foreign function: their address will be
|
||||
used. To make this a little safer, the corresponding cpointer type is
|
||||
|
|
Loading…
Reference in New Issue
Block a user