Project HomeDocument HomeContents
Library: (ypsilon c-types)
This library provides C typedef and C struct interface.
Summaries:
define-c-enum Defines a C enumeration constant
define-c-typedef Defines a C structure type
define-c-struct-methods Defines a constructor, accessors, and mutators for a C structure type
define-c-struct-type Is a handy macro that combines define-c-typedef and define-c-struct-methods
c-sizeof Returns a byte size of C primitive or C structure type
c-coerce-void* Coerces a C void* value to a C structure object
bytevector-c-short-ref Retrieves a short value from a bytevector
bytevector-c-int-ref Retrieves an int value from a bytevector
bytevector-c-long-ref Retrieves a long value from a bytevector
bytevector-c-long-long-ref Retrieves a long long value from a bytevector
bytevector-c-void*-ref Retrieves a void* value from a bytevector
bytevector-c-float-ref Retrieves a float value from a bytevector
bytevector-c-double-ref Retrieves a double value from a bytevector
bytevector-c-unsigned-short-ref Retrieves an unsigned short value from a bytevector
bytevector-c-unsigned-int-ref Retrieves an unsigned int value from a bytevector
bytevector-c-unsigned-long-ref Retrieves an unsigned long value from a bytevector
bytevector-c-unsigned-long-long-ref Retrieves an unsigned long long value from a bytevector
bytevector-c-int8-ref Retrieves an int8_t value from a bytevector
bytevector-c-int16-ref Retrieves an int16_t value from a bytevector
bytevector-c-int32-ref Retrieves an int32_t value from a bytevector
bytevector-c-int64-ref Retrieves an int64_t value from a bytevector
bytevector-c-uint8-ref Retrieves an uint8_t value from a bytevector
bytevector-c-uint16-ref Retrieves an uint16_t value from a bytevector
bytevector-c-uint32-ref Retrieves an uint32_t value from a bytevector
bytevector-c-uint64-ref Retrieves an uint64_t value from a bytevector
bytevector-c-short-set! Stores a short value to a bytevector
bytevector-c-int-set! Stores an int value to a bytevector
bytevector-c-long-set! Stores a long value to a bytevector
bytevector-c-long-long-set! Stores a long long value to a bytevector
bytevector-c-void*-set! Stores a void* value to a bytevector
bytevector-c-float-set! Stores a float value to a bytevector
bytevector-c-double-set! Stores a double value to a bytevector
bytevector-c-int8-set! Stores an int8_t value to a bytevector
bytevector-c-int16-set! Stores an int16_t value to a bytevector
bytevector-c-int32-set! Stores an int32_t value to a bytevector
bytevector-c-int64-set! Stores an int64_t value to a bytevector
bytevector-c-strlen Returns a C string length of its contents
make-c-bool Returns a bytevector contains a bool value
make-c-short Returns a bytevector contains a short value
make-c-int Returns a bytevector contains an int value
make-c-long Returns a bytevector contains a long value
make-c-long-long Returns a bytevector contains a long long value
make-c-void* Returns a bytevector contains a void* value
make-c-float Returns a bytevector contains a float value
make-c-double Returns a bytevector contains a double value
make-c-int8 Returns a bytevector contains an int8_t value
make-c-int16 Returns a bytevector contains an int16_t value
make-c-int32 Returns a bytevector contains an int32_t value
make-c-int64 Returns a bytevector contains an int64_t value
c-bool-ref Retrieves a bool value from a memory
c-short-ref Retrieves a short value from a memory
c-int-ref Retrieves an int value from a memory
c-long-ref Retrieves a long value from a memory
c-long-long-ref Retrieves a long long value from a memory
c-void*-ref Retrieves a void* value from a memory
c-float-ref Retrieves a float value from a memory
c-double-ref Retrieves a double value from a memory
c-unsigned-short-ref Retrieves an unsigned short value from a memory
c-unsigned-int-ref Retrieves an unsigned int value from a memory
c-unsigned-long-ref Retrieves an unsigned long value from a memory
c-unsigned-long-long-ref Retrieves an unsigned long long value from a memory
c-int8-ref Retrieves an int8_t value from a memory
c-int16-ref Retrieves an int16_t value from a memory
c-int32-ref Retrieves an int32_t value from a memory
c-int64-ref Retrieves an int64_t value from a memory
c-uint8-ref Retrieves an uint8_t value from a memory
c-uint16-ref Retrieves an uint16_t value from a memory
c-uint32-ref Retrieves an uint32_t value from a memory
c-uint64-ref Retrieves an uint64_t value from a memory
c-string-ref Retrieves a C string from a memory
c-bool-set! Stores a bool value to a memory
c-short-set! Stores a short value to a memory
c-int-set! Stores a int value to a memory
c-long-set! Stores a long value to a memory
c-long-long-set! C-long-set! stores a long long value to a memory
c-void*-set! Stores a void* value to a memory
c-float-set! Stores a float value to a memory
c-double-set! Stores a double value to a memory
c-int8-set! Stores a int8_t value to a memory
c-int16-set! Stores a int16_t value to a memory
c-int32-set! Stores a int32_t value to a memory
c-int64-set! Stores a int64_t value to a memory
c-string-set! Stores a C string to a memory
alignof:bool <constant>
alignof:short <constant>
alignof:int <constant>
alignof:long <constant>
alignof:long-long <constant>
alignof:size_t <constant>
alignof:void* <constant>
alignof:float <constant>
alignof:double <constant>
alignof:int8_t <constant>
alignof:int16_t <constant>
alignof:int32_t <constant>
alignof:int64_t <constant>
sizeof:bool <constant>
sizeof:short <constant>
sizeof:int <constant>
sizeof:long <constant>
sizeof:size_t <constant>
sizeof:void* <constant>
[Back] [Top]
Macro: define-c-enum
define-c-enum defines a C enumeration constant. This macro has an analogy to the C enum statement.
syntax:
(define-c-enum spec ...)
arguments:
spec:
<subform>
spec
—a enumeration specifier. It should be either symbol or (symbol . value). In the later case, constant will be assigned to the value.
examples:
> (import (rnrs) (ypsilon c-types))
> (define-c-enum FOO (BAR . 10) BAZ)
> (list FOO BAR BAZ)
(0 10 11)
[Back] [Top]
Macro: define-c-typedef
define-c-typedef defines a C structure type. This macro has an analogy to the C typedef statement.
syntax:
(define-c-typedef type-name (struct (field-type field-name) ...))
arguments:
type-name:
field-type:
field-name:
<symbol>
<symbol>
<symbol>
type-name
—a type name.
field-type
—a field type declarator. Valid declarators are listed below:
short, int, long, int8_t, int16_t, int32_t, and int64_t;
specifies a signed integer field, and a size of the field is the same as in C.
bool, char, unsigned-short, unsigned-int, unsigned-long, size_t, uint8_t, uint16_t, uint32_t, uint64_t, and void*;
specifies an unsigned integer field, and a size of the field is the same as in C.
float and double;
specifies an IEEE floating number field, and a size of the field is the same as in C.
field-name
—a field name.
description:
A defined type is bound to type-name, and subsequent define-c-typedef can use it for field names to define compound types.
syntax:
(define-c-typedef new-name old-name)
arguments:
new-name:
old-name:
<symbol>
<symbol>
description:
This syntax defines an alias type name for an existing type.
notes:
define-c-typedef does not define a constructor, accessors, nor mutators, use define-c-struct-methods to define them.
examples:
> (import (rnrs) (ypsilon c-types))
> (define-c-typedef time_t long)
> (define-c-typedef suseconds_t long)
> (define-c-typedef timeval (struct (time_t tv_sec) (suseconds_t tv_usec)))
> timeval
#<c-typedef timeval 8 4 (struct (time_t tv_sec) (suseconds_t tv_usec))>
[Back] [Top]
Macro: define-c-struct-methods
define-c-struct-methods defines a constructor, accessors, and mutators for a C structure type.
syntax:
(define-c-struct-methods type-name ...)
arguments:
type-name:
<symbol>
description:
The constructor returns a bytevector for a strage to hold field values. The mutator stores a two's complement representation of a value to a field, and it is an assertion violation if the value does not fit to the field. Methods defined by define-c-struct-methods are macro, and following naming convention is used to name them:
The constructor's name is generated by appending 'make-' and type-name. Each accessor's name is generated by appending type-name, '-', and a field name. Each mutator's name is generated by appending type-name, '-', a field name, and '-set!'.
examples:
> (import (rnrs) (ypsilon c-types))
> (define-c-typedef point (struct (int x) (int y)))
> point
#<c-typedef point 8 4 (struct (int x) (int y))>
> (define-c-struct-methods point)
> (define pt (make-point)) ; make-point
> pt
#vu8(0 0 0 0 0 0 0 0)
> (point-x-set! pt 1000)   ; point-x-set!
> (point-y-set! pt -500)   ; point-y-set!
> pt
#vu8(232 3 0 0 12 254 255 255)
> (point-x pt)             ; point-x
1000
> (point-y pt)             ; point-y
-500
;; demonstrate assignments to 32bit fields
> (import (rnrs) (ypsilon c-types))
> (define-c-typedef type32b (struct (uint32_t u) (int32_t s)))
> (define-c-struct-methods type32b)
> (define nums (make-type32b))
> (type32b-u-set! nums #xffffffff)
> (type32b-u nums)
4294967295

;; int32_t s = (signed)4294967295U;
;; cout << s; /* prints -1 */
> (type32b-s-set! nums 4294967295)
> (type32b-s nums)
-1

;; uint32_t u = (unsigned)-1;
;; cout << u; /* prints 4294967295 */
> (type32b-u-set! nums -1)
> (type32b-u nums)
4294967295
[Back] [Top]
Macro: define-c-struct-type
syntax:
(define-c-struct-type type-name (field-type field-name) ...)
arguments:
type-name:
field-type:
field-name:
<symbol>
<symbol>
<symbol>
examples:
> (import (rnrs) (ypsilon c-types))
> (define-c-struct-type point (int x) (int y))
> (define pt (make-point))
> (point-x-set! pt 1000)
> (point-y-set! pt -500)
> pt
#vu8(232 3 0 0 12 254 255 255)
> (point-x pt)
1000
> (point-y pt)
-500
[Back] [Top]
Macro: c-sizeof
c-sizeof returns a byte size of C primitive or C structure type.
syntax:
(c-sizeof type-name)
arguments:
type-name:
<symbol>
examples:
> (import (ypsilon c-types))
;; primitive type
> (c-sizeof unsigned-int)
4
;; structure type
> (define-c-typedef foo (struct (int8_t u8) (int32_t u32)))
> (c-sizeof foo)
8
[Back] [Top]
Macro: c-coerce-void*
c-coerce-void* coerces a C void* value to a C structure object.
syntax:
(c-coerce-void* expression type-name)
arguments:
expression:
type-name:
<subform>
<symbol>
The expression must be evaluated as an exact integer.
notes:
Be aware that misuse of this procedure causes a fatal error, segmentation fault for an example.
examples:
> (import (ypsilon sdl))
> (SDL_Init SDL_INIT_EVERYTHING)
0 ; init success
> (define screen (SDL_SetVideoMode 256 256 32 SDL_SWSURFACE))
> screen
159419344 ; 0x9808bd0
> (define surface (c-coerce-void* screen SDL_Surface))
> surface
#<bytevector-mapping 0x9808bd0 60>
> (SDL_MapRGB (SDL_Surface-format surface) #x20 #xff #x10)
2162448 ; 0x20ff10
[Back] [Top]
Procedure: bytevector-c-short-ref
bytevector-c-short-ref retrieves a short value from a bytevector.
syntax:
(bytevector-c-short-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-int-ref
bytevector-c-int-ref retrieves an int value from a bytevector.
syntax:
(bytevector-c-int-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-long-ref
bytevector-c-long-ref retrieves a long value from a bytevector.
syntax:
(bytevector-c-long-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-long-long-ref
bytevector-c-long-long-ref retrieves a long long value from a bytevector.
syntax:
(bytevector-c-long-long-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-void*-ref
bytevector-c-void*-ref retrieves a void* value from a bytevector.
syntax:
(bytevector-c-void*-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-float-ref
bytevector-c-float-ref retrieves a float value from a bytevector.
syntax:
(bytevector-c-float-ref bytevector byteoffset) => <flonum>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-double-ref
bytevector-c-double-ref retrieves a double value from a bytevector.
syntax:
(bytevector-c-double-ref bytevector byteoffset) => <flonum>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-unsigned-short-ref
bytevector-c-unsigned-short-ref retrieves an unsigned short value from a bytevector.
syntax:
(bytevector-c-unsigned-short-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-unsigned-int-ref
bytevector-c-unsigned-int-ref retrieves an unsigned int value from a bytevector.
syntax:
(bytevector-c-unsigned-int-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-unsigned-long-ref
bytevector-c-unsigned-long-ref retrieves an unsigned long value from a bytevector.
syntax:
(bytevector-c-unsigned-long-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-unsigned-long-long-ref
bytevector-c-unsigned-long-long-ref retrieves an unsigned long long value from a bytevector.
syntax:
(bytevector-c-unsigned-long-long-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-int8-ref
bytevector-c-int8-ref retrieves an int8_t value from a bytevector.
syntax:
(bytevector-c-int8-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-int16-ref
bytevector-c-int16-ref retrieves an int16_t value from a bytevector.
syntax:
(bytevector-c-int16-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-int32-ref
bytevector-c-int32-ref retrieves an int32_t value from a bytevector.
syntax:
(bytevector-c-int32-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-int64-ref
bytevector-c-int64-ref retrieves an int64_t value from a bytevector.
syntax:
(bytevector-c-int64-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-uint8-ref
bytevector-c-uint8-ref retrieves an uint8_t value from a bytevector.
syntax:
(bytevector-c-uint8-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-uint16-ref
bytevector-c-uint16-ref retrieves an uint16_t value from a bytevector.
syntax:
(bytevector-c-uint16-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-uint32-ref
bytevector-c-uint32-ref retrieves an uint32_t value from a bytevector.
syntax:
(bytevector-c-uint32-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-uint64-ref
bytevector-c-uint64-ref retrieves an uint64_t value from a bytevector.
syntax:
(bytevector-c-uint64-ref bytevector byteoffset) => <int>
arguments:
bytevector:
byteoffset:
<bytevector>
<int>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-short-set!
bytevector-c-short-set! stores a short value to a bytevector.
syntax:
(bytevector-c-short-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<int>
The byteoffset must be non-negative.
The value must be within the range [SHORT_MIN, USHORT_MAX].
[Back] [Top]
Procedure: bytevector-c-int-set!
bytevector-c-int-set! stores an int value to a bytevector.
syntax:
(bytevector-c-int-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<int>
The byteoffset must be non-negative.
The value must be within the range [INT_MIN, UINT_MAX].
[Back] [Top]
Procedure: bytevector-c-long-set!
bytevector-c-long-set! stores a long value to a bytevector.
syntax:
(bytevector-c-long-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<int>
The byteoffset must be non-negative.
The value must be within the range [LONG_MIN, ULONG_MAX].
[Back] [Top]
Procedure: bytevector-c-long-long-set!
bytevector-c-long-long-set! stores a long long value to a bytevector.
syntax:
(bytevector-c-long-long-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<int>
The byteoffset must be non-negative.
The value must be within the range [LONGLONG_MIN, ULONGLONG_MAX].
[Back] [Top]
Procedure: bytevector-c-void*-set!
bytevector-c-void*-set! stores a void* value to a bytevector.
syntax:
(bytevector-c-void*-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<int>
The byteoffset must be non-negative.
The value must be within the range [INTPTR_MIN, UINTPTR_MAX].
[Back] [Top]
Procedure: bytevector-c-float-set!
bytevector-c-float-set! stores a float value to a bytevector.
syntax:
(bytevector-c-float-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<flonum>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-double-set!
bytevector-c-double-set! stores a double value to a bytevector.
syntax:
(bytevector-c-double-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<flonum>
The byteoffset must be non-negative.
[Back] [Top]
Procedure: bytevector-c-int8-set!
bytevector-c-int8-set! stores an int8_t value to a bytevector.
syntax:
(bytevector-c-int8-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<int>
The byteoffset must be non-negative.
The value must be within the range [INT8_MIN, UINT8_MAX].
[Back] [Top]
Procedure: bytevector-c-int16-set!
bytevector-c-int16-set! stores an int16_t value to a bytevector.
syntax:
(bytevector-c-int16-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<int>
The byteoffset must be non-negative.
The value must be within the range [INT16_MIN, UINT16_MAX].
[Back] [Top]
Procedure: bytevector-c-int32-set!
bytevector-c-int32-set! stores an int32_t value to a bytevector.
syntax:
(bytevector-c-int32-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<int>
The byteoffset must be non-negative.
The value must be within the range [INT32_MIN, UINT32_MAX].
[Back] [Top]
Procedure: bytevector-c-int64-set!
bytevector-c-int64-set! stores an int64_t value to a bytevector.
syntax:
(bytevector-c-int64-set! bytevector byteoffset value) => unspecified
arguments:
bytevector:
byteoffset:
value:
<bytevector>
<int>
<int>
The byteoffset must be non-negative.
The value must be within the range [INT64_MIN, UINT64_MAX].
[Back] [Top]
Procedure: bytevector-c-strlen
bytevector-c-strlen returns a C string length of its contents.
syntax:
(bytevector-c-strlen bytevector) => <int>
arguments:
bytevector:
<bytevector>
description:
If no terminating zero byte exists in the bytevector, bytevector-c-strlen returns bytevector-length of the bytevector.
[Back] [Top]
Procedure: make-c-bool
make-c-bool returns a bytevector contains a bool value.
syntax:
(make-c-bool value) => <bytevector>
arguments:
value:
<int>
[Back] [Top]
Procedure: make-c-short
make-c-short returns a bytevector contains a short value.
syntax:
(make-c-short value) => <bytevector>
arguments:
value:
<int>
The value must be within the range [SHORT_MIN, USHORT_MAX].
[Back] [Top]
Procedure: make-c-int
make-c-int returns a bytevector contains an int value.
syntax:
(make-c-int value) => <bytevector>
arguments:
value:
<int>
The value must be within the range [INT_MIN, UINT_MAX].
[Back] [Top]
Procedure: make-c-long
make-c-long returns a bytevector contains a long value.
syntax:
(make-c-long value) => <bytevector>
arguments:
value:
<int>
The value must be within the range [LONG_MIN, ULONG_MAX].
[Back] [Top]
Procedure: make-c-long-long
make-c-long-long returns a bytevector contains a long long value.
syntax:
(make-c-long-long value) => <bytevector>
arguments:
value:
<int>
The value must be within the range [LONGLONG_MIN, ULONGLONG_MAX].
[Back] [Top]
Procedure: make-c-void*
make-c-void* returns a bytevector contains a void* value.
syntax:
(make-c-void* value) => <bytevector>
arguments:
value:
<int>
The value must be within the range [INTPTR_MIN, UINTPTR_MAX].
[Back] [Top]
Procedure: make-c-float
make-c-float returns a bytevector contains a float value.
syntax:
(make-c-float value) => <bytevector>
arguments:
value:
<flonum>
[Back] [Top]
Procedure: make-c-double
make-c-double returns a bytevector contains a double value.
syntax:
(make-c-double value) => <bytevector>
arguments:
value:
<flonum>
[Back] [Top]
Procedure: make-c-int8
make-c-int8 returns a bytevector contains an int8_t value.
syntax:
(make-c-int8 value) => <bytevector>
arguments:
value:
<int>
The value must be within the range [INT8_MIN, UINT8_MAX].
[Back] [Top]
Procedure: make-c-int16
make-c-int16 returns a bytevector contains an int16_t value.
syntax:
(make-c-int16 value) => <bytevector>
arguments:
value:
<int>
The value must be within the range [INT16_MIN, UINT16_MAX].
[Back] [Top]
Procedure: make-c-int32
make-c-int32 returns a bytevector contains an int32_t value.
syntax:
(make-c-int32 value) => <bytevector>
arguments:
value:
<int>
The value must be within the range [INT32_MIN, UINT32_MAX].
[Back] [Top]
Procedure: make-c-int64
make-c-int64 returns a bytevector contains an int64_t value.
syntax:
(make-c-int64 value) => <bytevector>
arguments:
value:
<int>
The value must be within the range [INT64_MIN, UINT64_MAX].
[Back] [Top]
Procedure: make-c-string
make-c-string returns a bytevector contains a C string.
syntax:
(make-c-string value) => <bytevector>
arguments:
value:
<string>
description:
A terminating zero byte will be appended.
[Back] [Top]
Procedure: c-bool-ref
c-bool-ref retrieves a bool value from a memory.
syntax:
(c-bool-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-short-ref
c-short-ref retrieves a short value from a memory.
syntax:
(c-short-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-int-ref
c-int-ref retrieves an int value from a memory.
syntax:
(c-int-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-long-ref
c-long-ref retrieves a long value from a memory.
syntax:
(c-long-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-long-long-ref
c-long-long-ref retrieves a long long value from a memory.
syntax:
(c-long-long-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-void*-ref
c-void*-ref retrieves a void* value from a memory.
syntax:
(c-void*-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-float-ref
c-float-ref retrieves a float value from a memory.
syntax:
(c-float-ref location) => <flonum>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-double-ref
c-double-ref retrieves a double value from a memory.
syntax:
(c-double-ref location) => <flonum>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-unsigned-short-ref
c-unsigned-short-ref retrieves an unsigned short value from a memory.
syntax:
(c-unsigned-short-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-unsigned-int-ref
c-unsigned-int-ref retrieves an unsigned int value from a memory.
syntax:
(c-unsigned-int-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-unsigned-long-ref
c-unsigned-long-ref retrieves an unsigned long value from a memory.
syntax:
(c-unsigned-long-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-unsigned-long-long-ref
c-unsigned-long-long-ref retrieves an unsigned long long value from a memory.
syntax:
(c-unsigned-long-long-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-int8-ref
c-int8-ref retrieves an int8_t value from a memory.
syntax:
(c-int8-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-int16-ref
c-int16-ref retrieves an int16_t value from a memory.
syntax:
(c-int16-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-int32-ref
c-int32-ref retrieves an int32_t value from a memory.
syntax:
(c-int32-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-int64-ref
c-int64-ref retrieves an int64_t value from a memory.
syntax:
(c-int64-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-uint8-ref
c-uint8-ref retrieves an uint8_t value from a memory.
syntax:
(c-uint8-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-uint16-ref
c-uint16-ref retrieves an uint16_t value from a memory.
syntax:
(c-uint16-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-uint32-ref
c-uint32-ref retrieves an uint32_t value from a memory.
syntax:
(c-uint32-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-uint64-ref
c-uint64-ref retrieves an uint64_t value from a memory.
syntax:
(c-uint64-ref location) => <int>
arguments:
location:
<address> or <bytevector>
[Back] [Top]
Procedure: c-string-ref
c-string-ref retrieves a C string from a memory.
syntax:
(c-string-ref location) => <string>
arguments:
location:
<address> or <bytevector>
description:
A terminating zero byte will be removed.
[Back] [Top]
Procedure: c-bool-set!
c-bool-set! stores a bool value to a memory.
syntax:
(c-bool-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
[Back] [Top]
Procedure: c-short-set!
c-short-set! stores a short value to a memory.
syntax:
(c-short-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
The value must be within the range [SHORT_MIN, USHORT_MAX].
[Back] [Top]
Procedure: c-int-set!
c-int-set! stores a int value to a memory.
syntax:
(c-int-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
The value must be within the range [INT_MIN, UINT_MAX].
[Back] [Top]
Procedure: c-long-set!
c-long-set! stores a long value to a memory.
syntax:
(c-long-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
The value must be within the range [LONG_MIN, ULONG_MAX].
[Back] [Top]
Procedure: c-long-long-set!
c-long-set! stores a long long value to a memory.
syntax:
(c-long-long-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
The value must be within the range [LONGLONG_MIN, ULONGLONG_MAX].
[Back] [Top]
Procedure: c-void*-set!
c-void*-set! stores a void* value to a memory.
syntax:
(c-void*-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
The value must be within the range [INTPTR_MIN, UINTPTR_MAX].
[Back] [Top]
Procedure: c-float-set!
c-float-set! stores a float value to a memory.
syntax:
(c-float-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<flonum>
[Back] [Top]
Procedure: c-double-set!
c-double-set! stores a double value to a memory.
syntax:
(c-double-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<flonum>
[Back] [Top]
Procedure: c-int8-set!
c-int8-set! stores a int8_t value to a memory.
syntax:
(c-int8-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
The value must be within the range [INT8_MIN, UINT8_MAX].
[Back] [Top]
Procedure: c-int16-set!
c-int16-set! stores a int16_t value to a memory.
syntax:
(c-int16-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
The value must be within the range [INT16_MIN, UINT16_MAX].
[Back] [Top]
Procedure: c-int32-set!
c-int32-set! stores a int32_t value to a memory.
syntax:
(c-int32-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
The value must be within the range [INT32_MIN, UINT32_MAX].
[Back] [Top]
Procedure: c-int64-set!
c-int64-set! stores a int64_t value to a memory.
syntax:
(c-int64-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<int>
The value must be within the range [INT64_MIN, UINT64_MAX].
[Back] [Top]
Procedure: c-string-set!
c-string-set! stores a C string to a memory.
syntax:
(c-string-set! location value) => unspecified
arguments:
location:
value:
<address> or <bytevector>
<string>
description:
A terminating zero byte will be appended.
[Back] [Top]
Constants:  alignof:bool, alignof:short, alignof:int, alignof:long, alignof:long-long, alignof:size_t, alignof:void*, alignof:float, alignof:double, alignof:int8_t, alignof:int16_t, alignof:int32_t, alignof:int64_t
Each constant is defined to an alignment size of correspondent C types.
[Back] [Top]
Constants:  sizeof:bool, sizeof:short, sizeof:int, sizeof:long, sizof:long-long, sizeof:size_t, sizeof:void*
Each constant is defined to a byte size of correspondent C types.
[Back] [Top]
Identifiers exported from (ypsilon c-types) library
Contexual list of all exports:
define-c-enum
define-c-typedef
define-c-struct-methods
define-c-struct-type
c-sizeof
c-coerce-void*
make-bytevector-mapping
bytevector-c-short-ref
bytevector-c-int-ref
bytevector-c-long-ref
bytevector-c-long-long-ref
bytevector-c-void*-ref
bytevector-c-float-ref
bytevector-c-double-ref
bytevector-c-unsigned-short-ref
bytevector-c-unsigned-int-ref
bytevector-c-unsigned-long-ref
bytevector-c-unsigned-long-long-ref
bytevector-c-int8-ref
bytevector-c-int16-ref
bytevector-c-int32-ref
bytevector-c-int64-ref
bytevector-c-uint8-ref
bytevector-c-uint16-ref
bytevector-c-uint32-ref
bytevector-c-uint64-ref
bytevector-c-short-set!
bytevector-c-int-set!
bytevector-c-long-set!
bytevector-c-long-long-set!
bytevector-c-void*-set!
bytevector-c-float-set!
bytevector-c-double-set!
bytevector-c-int8-set!
bytevector-c-int16-set!
bytevector-c-int32-set!
bytevector-c-int64-set!
bytevector-c-strlen
make-c-bool
make-c-short
make-c-int
make-c-long
make-c-long-long
make-c-void*
make-c-float
make-c-double
make-c-int8
make-c-int16
make-c-int32
make-c-int64
c-bool-ref
c-short-ref
c-int-ref
c-long-ref
c-long-long-ref
c-void*-ref
c-float-ref
c-double-ref
c-unsigned-short-ref
c-unsigned-int-ref
c-unsigned-long-ref
c-unsigned-long-long-ref
c-int8-ref
c-int16-ref
c-int32-ref
c-int64-ref
c-uint8-ref
c-uint16-ref
c-uint32-ref
c-uint64-ref
c-string-ref
c-bool-set!
c-short-set!
c-int-set!
c-long-set!
c-long-long-set!
c-void*-set!
c-float-set!
c-double-set!
c-int8-set!
c-int16-set!
c-int32-set!
c-int64-set!
c-string-set!
alignof:bool
alignof:short
alignof:int
alignof:long
alignof:long-long
alignof:size_t
alignof:void*
alignof:float
alignof:double
alignof:int8_t
alignof:int16_t
alignof:int32_t
alignof:int64_t
sizeof:bool
sizeof:short
sizeof:int
sizeof:long
sizeof:long-long
sizeof:size_t
sizeof:void*
Alphabetical list of all exports:
alignof:bool
alignof:double
alignof:float
alignof:int
alignof:int16_t
alignof:int32_t
alignof:int64_t
alignof:int8_t
alignof:long
alignof:long-long
alignof:short
alignof:size_t
alignof:void*
bytevector-c-double-ref
bytevector-c-double-set!
bytevector-c-float-ref
bytevector-c-float-set!
bytevector-c-int-ref
bytevector-c-int-set!
bytevector-c-int16-ref
bytevector-c-int16-set!
bytevector-c-int32-ref
bytevector-c-int32-set!
bytevector-c-int64-ref
bytevector-c-int64-set!
bytevector-c-int8-ref
bytevector-c-int8-set!
bytevector-c-long-long-ref
bytevector-c-long-long-set!
bytevector-c-long-ref
bytevector-c-long-set!
bytevector-c-short-ref
bytevector-c-short-set!
bytevector-c-strlen
bytevector-c-uint16-ref
bytevector-c-uint32-ref
bytevector-c-uint64-ref
bytevector-c-uint8-ref
bytevector-c-unsigned-int-ref
bytevector-c-unsigned-long-long-ref
bytevector-c-unsigned-long-ref
bytevector-c-unsigned-short-ref
bytevector-c-void*-ref
bytevector-c-void*-set!
c-bool-ref
c-bool-set!
c-coerce-void*
c-double-ref
c-double-set!
c-float-ref
c-float-set!
c-int-ref
c-int-set!
c-int16-ref
c-int16-set!
c-int32-ref
c-int32-set!
c-int64-ref
c-int64-set!
c-int8-ref
c-int8-set!
c-long-long-ref
c-long-long-set!
c-long-ref
c-long-set!
c-short-ref
c-short-set!
c-sizeof
c-string-ref
c-string-set!
c-uint16-ref
c-uint32-ref
c-uint64-ref
c-uint8-ref
c-unsigned-int-ref
c-unsigned-long-long-ref
c-unsigned-long-ref
c-unsigned-short-ref
c-void*-ref
c-void*-set!
define-c-enum
define-c-struct-methods
define-c-struct-type
define-c-typedef
make-bytevector-mapping
make-c-bool
make-c-double
make-c-float
make-c-int
make-c-int16
make-c-int32
make-c-int64
make-c-int8
make-c-long
make-c-long-long
make-c-short
make-c-void*
sizeof:bool
sizeof:int
sizeof:long
sizeof:long-long
sizeof:short
sizeof:size_t
sizeof:void*
[Back] [Top]