Lely core libraries 2.3.4
|
This header file is part of the CANopen library; it contains the CANopen value declarations. More...
#include <lely/co/type.h>
#include <lely/util/util.h>
#include <float.h>
#include <stddef.h>
#include <lely/co/def/type.def>
Go to the source code of this file.
Data Structures | |
union | co_val |
A union of the CANopen static data types. More... | |
struct | co_array_hdr |
The header directly preceding the bytes in a CANopen array. More... | |
Macros | |
#define | CO_BOOLEAN_INIT 0 |
The default value of a boolean truth value (false). | |
#define | CO_BOOLEAN_MIN 0 |
The minimum value of a boolean truth value (false). | |
#define | CO_BOOLEAN_MAX 1 |
The maximum value of a boolean truth value (true). | |
#define | CO_INTEGER8_INIT 0 |
The default value of an 8-bit signed integer. | |
#define | CO_INTEGER8_MIN (-INT8_C(0x7f) - 1) |
The minimum value of an 8-bit signed integer. | |
#define | CO_INTEGER8_MAX INT8_C(0x7f) |
The maximum value of an 8-bit signed integer. | |
#define | CO_INTEGER16_INIT 0 |
The default value of a 16-bit signed integer. | |
#define | CO_INTEGER16_MIN (-INT16_C(0x7fff) - 1) |
The minimum value of a 16-bit signed integer. | |
#define | CO_INTEGER16_MAX INT16_C(0x7fff) |
The maximum value of a 16-bit signed integer. | |
#define | CO_INTEGER32_INIT 0 |
The default value of a 32-bit signed integer. | |
#define | CO_INTEGER32_MIN (-INT32_C(0x7fffffff) - 1) |
The minimum value of a 32-bit signed integer. | |
#define | CO_INTEGER32_MAX INT32_C(0x7fffffff) |
The maximum value of a 32-bit signed integer. | |
#define | CO_UNSIGNED8_INIT 0 |
The default value of an 8-bit unsigned integer. | |
#define | CO_UNSIGNED8_MIN 0 |
The minimum value of an 8-bit unsigned integer. | |
#define | CO_UNSIGNED8_MAX UINT8_C(0xff) |
The maximum value of an 8-bit unsigned integer. | |
#define | CO_UNSIGNED16_INIT 0 |
The default value of a 16-bit unsigned integer. | |
#define | CO_UNSIGNED16_MIN 0 |
The minimum value of a 16-bit unsigned integer. | |
#define | CO_UNSIGNED16_MAX UINT16_C(0xffff) |
The maximum value of a 16-bit unsigned integer. | |
#define | CO_UNSIGNED32_INIT 0 |
The default value of a 32-bit unsigned integer. | |
#define | CO_UNSIGNED32_MIN 0 |
The minimum value of a 32-bit unsigned integer. | |
#define | CO_UNSIGNED32_MAX UINT32_C(0xffffffff) |
The maximum value of a 32-bit unsigned integer. | |
#define | CO_REAL32_INIT 0 |
The default value of a 32-bit IEEE-754 floating-point number. | |
#define | CO_REAL32_MIN (-FLT_MAX) |
The minimum value of a 32-bit IEEE-754 floating-point number. | |
#define | CO_REAL32_MAX FLT_MAX |
The maximum value of a 32-bit IEEE-754 floating-point number. | |
#define | CO_VISIBLE_STRING_INIT NULL |
The default value of an array of visible characters. | |
#define | CO_OCTET_STRING_INIT NULL |
The default value of an array of octets. | |
#define | CO_UNICODE_STRING_INIT NULL |
The default value of an array of (16-bit) Unicode characters. | |
#define | CO_TIME_OF_DAY_INIT |
The default value of a 48-bit structure representing the absolute time. | |
#define | CO_TIME_OF_DAY_MIN |
The minimum value of a 48-bit structure representing the absolute time. | |
#define | CO_TIME_OF_DAY_MAX |
The maximum value of a 48-bit structure representing the absolute time. | |
#define | CO_TIME_DIFF_INIT CO_TIME_OF_DAY_INIT |
The default value of a 48-bit structure representing a time difference. | |
#define | CO_TIME_DIFF_MIN CO_TIME_OF_DAY_MIN |
The minimum value of a 48-bit structure representing a time difference. | |
#define | CO_TIME_DIFF_MAX CO_TIME_OF_DAY_MAX |
The maximum value of a 48-bit structure representing a time difference. | |
#define | CO_DOMAIN_INIT NULL |
The default value of an arbitrary large block of data.. | |
#define | CO_INTEGER24_INIT 0 |
The default value of a 24-bit signed integer (encoded as an int32_t). | |
#define | CO_INTEGER24_MIN (-INT32_C(0x007fffff) - 1) |
The minimum value of a 24-bit signed integer (encoded as an int32_t). | |
#define | CO_INTEGER24_MAX INT32_C(0x007fffff) |
The maximum value of a 24-bit signed integer (encoded as an int32_t). | |
#define | CO_REAL64_INIT 0 |
The default value of a 64-bit IEEE-754 floating-point number. | |
#define | CO_REAL64_MIN (-DBL_MAX) |
The minimum value of a 64-bit IEEE-754 floating-point number. | |
#define | CO_REAL64_MAX DBL_MAX |
The maximum value of a 64-bit IEEE-754 floating-point number. | |
#define | CO_INTEGER40_INIT 0 |
The default value of a 40-bit signed integer (encoded as an int64_t). | |
#define | CO_INTEGER40_MIN (-INT64_C(0x0000007fffffffff) - 1) |
The minimum value of a 40-bit signed integer (encoded as an int64_t). | |
#define | CO_INTEGER40_MAX INT64_C(0x0000007fffffffff) |
The maximum value of a 40-bit signed integer (encoded as an int64_t). | |
#define | CO_INTEGER48_INIT 0 |
The default value of a 48-bit signed integer (encoded as an int64_t). | |
#define | CO_INTEGER48_MIN (-INT64_C(0x00007fffffffffff) - 1) |
The minimum value of a 48-bit signed integer (encoded as an int64_t). | |
#define | CO_INTEGER48_MAX INT64_C(0x00007fffffffffff) |
The maximum value of a 48-bit signed integer (encoded as an int64_t). | |
#define | CO_INTEGER56_INIT 0 |
The default value of a 56-bit signed integer (encoded as an int64_t). | |
#define | CO_INTEGER56_MIN (-INT64_C(0x007fffffffffffff) - 1) |
The minimum value of a 56-bit signed integer (encoded as an int64_t). | |
#define | CO_INTEGER56_MAX INT64_C(0x007fffffffffffff) |
The maximum value of a 56-bit signed integer (encoded as an int64_t). | |
#define | CO_INTEGER64_INIT 0 |
The default value of a 64-bit signed integer. | |
#define | CO_INTEGER64_MIN (-INT64_C(0x7fffffffffffffff) - 1) |
The minimum value of a 64-bit signed integer. | |
#define | CO_INTEGER64_MAX INT64_C(0x7fffffffffffffff) |
The maximum value of a 64-bit signed integer. | |
#define | CO_UNSIGNED24_INIT 0 |
The default value of a 24-bit unsigned integer (encoded as a uint32_t). | |
#define | CO_UNSIGNED24_MIN 0 |
The minimum value of a 24-bit unsigned integer (encoded as a uint32_t). | |
#define | CO_UNSIGNED24_MAX UINT32_C(0x00ffffff) |
The maximum value of a 24-bit unsigned integer (encoded as a uint32_t). | |
#define | CO_UNSIGNED40_INIT 0 |
The default value of a 40-bit unsigned integer (encoded as a uint64_t). | |
#define | CO_UNSIGNED40_MIN 0 |
The minimum value of a 40-bit unsigned integer (encoded as a uint64_t). | |
#define | CO_UNSIGNED40_MAX UINT64_C(0x000000ffffffffff) |
The maximum value of a 40-bit unsigned integer (encoded as a uint64_t). | |
#define | CO_UNSIGNED48_INIT 0 |
The default value of a 48-bit unsigned integer (encoded as a uint64_t). | |
#define | CO_UNSIGNED48_MIN 0 |
The minimum value of a 48-bit unsigned integer (encoded as a uint64_t). | |
#define | CO_UNSIGNED48_MAX UINT64_C(0x0000ffffffffffff) |
The maximum value of a 48-bit unsigned integer (encoded as a uint64_t). | |
#define | CO_UNSIGNED56_INIT 0 |
The default value of a 56-bit unsigned integer (encoded as a uint64_t). | |
#define | CO_UNSIGNED56_MIN 0 |
The minimum value of a 56-bit unsigned integer (encoded as a uint64_t). | |
#define | CO_UNSIGNED56_MAX UINT64_C(0x00ffffffffffffff) |
The maximum value of a 56-bit unsigned integer (encoded as a uint64_t). | |
#define | CO_UNSIGNED64_INIT 0 |
The default value of a 64-bit unsigned integer. | |
#define | CO_UNSIGNED64_MIN 0 |
The minimum value of a 64-bit unsigned integer. | |
#define | CO_UNSIGNED64_MAX UINT64_C(0xffffffffffffffff) |
The maximum value of a 64-bit unsigned integer. | |
#define | CO_ARRAY_CAPACITY 0 |
The default capacity (in bytes) of a statically allocated CANopen array. | |
#define | CO_VISIBLE_STRING_NC(n, c) |
Converts a visible string literal to a CANopen array with a capacity of at least n bytes. | |
#define | CO_VISIBLE_STRING_C(c) CO_VISIBLE_STRING_NC(CO_ARRAY_CAPACITY, c) |
Converts a visible string literal to a CANopen array. | |
#define | CO_OCTET_STRING_NC(n, c) |
Converts an octet string literal to a CANopen array with a capacity of at least n bytes. | |
#define | CO_OCTET_STRING_C(c) CO_OCTET_STRING_NC(CO_ARRAY_CAPACITY, c) |
Converts an octet string literal to a CANopen array. | |
#define | CO_UNICODE_STRING_NC(n, ...) _CO_UNICODE_STRING_NC(n, _CO_ARRAY(__VA_ARGS__)) |
Converts a (16-bit) Unicode string literal to a CANopen array with a capacity of at least n bytes. | |
#define | CO_UNICODE_STRING_C(...) _CO_UNICODE_STRING_NC(CO_ARRAY_CAPACITY, _CO_ARRAY(__VA_ARGS__)) |
Converts a (16-bit) Unicode string literal to a CANopen array. | |
#define | CO_DOMAIN_NC(type, n, ...) _CO_DOMAIN_NC(type, n, _CO_ARRAY(__VA_ARGS__)) |
Converts an array literal with elements of type type to a CANopen array with a capacity of at least n bytes. | |
#define | CO_DOMAIN_C(type, ...) _CO_DOMAIN_NC(type, CO_ARRAY_CAPACITY, _CO_ARRAY(__VA_ARGS__)) |
Converts an array literal with elements of type type to a CANopen array. | |
Functions | |
int | co_val_init (co_unsigned16_t type, void *val) |
Initializes a value of the specified data type to zero. | |
int | co_val_init_min (co_unsigned16_t type, void *val) |
Initializes a value of the specified data type with its lower limit. | |
int | co_val_init_max (co_unsigned16_t type, void *val) |
Initializes a value of the specified data type with its upper limit. | |
int | co_val_init_vs (char **val, const char *vs) |
Initializes an array of visible characters (CO_DEFTYPE_VISIBLE_STRING). | |
int | co_val_init_vs_n (char **val, const char *vs, size_t n) |
Initializes an array of visible characters (CO_DEFTYPE_VISIBLE_STRING). | |
int | co_val_init_os (uint_least8_t **val, const uint_least8_t *os, size_t n) |
Initializes an array of octets (CO_DEFTYPE_OCTET_STRING). | |
int | co_val_init_us (char16_t **val, const char16_t *us) |
Initializes an array of (16-bit) Unicode characters (CO_DEFTYPE_UNICODE_STRING). | |
int | co_val_init_us_n (char16_t **val, const char16_t *us, size_t n) |
Initializes an array of (16-bit) Unicode characters (CO_DEFTYPE_UNICODE_STRING). | |
int | co_val_init_dom (void **val, const void *dom, size_t n) |
Initializes an arbitrary large block of data (CO_DEFTYPE_DOMAIN). | |
void | co_val_fini (co_unsigned16_t type, void *val) |
Finalizes a value of the specified data type. | |
const void * | co_val_addressof (co_unsigned16_t type, const void *val) |
Returns the address of the first byte in a value of the specified data type. | |
size_t | co_val_sizeof (co_unsigned16_t type, const void *val) |
Returns the size (in bytes) of a value of the specified data type. | |
size_t | co_val_make (co_unsigned16_t type, void *val, const void *ptr, size_t n) |
Constructs a value of the specified data type. | |
size_t | co_val_copy (co_unsigned16_t type, void *dst, const void *src) |
Copies one value to another. | |
size_t | co_val_move (co_unsigned16_t type, void *dst, void *src) |
Moves one value to another. | |
int | co_val_cmp (co_unsigned16_t type, const void *v1, const void *v2) |
Compares two values of the specified data type. | |
size_t | co_val_read (co_unsigned16_t type, void *val, const uint_least8_t *begin, const uint_least8_t *end) |
Reads a value of the specified data type from a memory buffer. | |
size_t | co_val_read_file (co_unsigned16_t type, void *val, const char *filename) |
Reads a value of the specified data type from a file. | |
size_t | co_val_read_frbuf (co_unsigned16_t type, void *val, struct __frbuf *buf) |
Reads a value of the specified data type from the current position in a read file buffer. | |
co_unsigned32_t | co_val_read_sdo (co_unsigned16_t type, void *val, const void *ptr, size_t n) |
Reads a value of the specified data type from an SDO buffer. | |
size_t | co_val_write (co_unsigned16_t type, const void *val, uint_least8_t *begin, uint_least8_t *end) |
Writes a value of the specified data type to a memory buffer. | |
size_t | co_val_write_file (co_unsigned16_t type, const void *val, const char *filename) |
Writes a value of the specified data type to a file. | |
size_t | co_val_write_fwbuf (co_unsigned16_t type, const void *val, struct __fwbuf *buf) |
Writes a value of the specified data type to the current position in a write file buffer. | |
size_t | co_val_lex (co_unsigned16_t type, void *val, const char *begin, const char *end, struct floc *at) |
Lexes a value of the specified data type from a memory buffer. | |
size_t | co_val_print (co_unsigned16_t type, const void *val, char **pbegin, char *end) |
Prints a value of the specified data type to a memory buffer. | |
This header file is part of the CANopen library; it contains the CANopen value declarations.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file val.h.
int co_val_init | ( | co_unsigned16_t | type, |
void * | val | ||
) |
Initializes a value of the specified data type to zero.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be initialized. In the case of strings or domains, this MUST be the address of pointer. |
int co_val_init_min | ( | co_unsigned16_t | type, |
void * | val | ||
) |
Initializes a value of the specified data type with its lower limit.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be initialized. In the case of strings or domains, this MUST be the address of pointer, which will be set to NULL. |
int co_val_init_max | ( | co_unsigned16_t | type, |
void * | val | ||
) |
Initializes a value of the specified data type with its upper limit.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be initialized. In the case of strings or domains, this MUST be the address of pointer, which will be set to NULL. |
int co_val_init_vs | ( | char ** | val, |
const char * | vs | ||
) |
Initializes an array of visible characters (CO_DEFTYPE_VISIBLE_STRING).
val | the address of a pointer. On success, *val points to the first character in the string. |
vs | a pointer to the (null-terminated) string with which *val should be initialized (can be NULL). |
int co_val_init_vs_n | ( | char ** | val, |
const char * | vs, | ||
size_t | n | ||
) |
Initializes an array of visible characters (CO_DEFTYPE_VISIBLE_STRING).
val | the address of a pointer. On success, *val points to the first character in the string. |
vs | a pointer to the string with which *val should be initialized (can be NULL). |
n | the number of characters in the value to be created (excluding the terminating null byte) and the maximum number of characters to copy from vs (unless vs is NULL). |
int co_val_init_os | ( | uint_least8_t ** | val, |
const uint_least8_t * | os, | ||
size_t | n | ||
) |
Initializes an array of octets (CO_DEFTYPE_OCTET_STRING).
val | the address of a pointer. On success, *val points to the first octet in the string. |
os | a pointer to the array of octets with which *val should be initialized (can be NULL). |
n | the number of octets in the value to be created (and the number of octets at os unless os is NULL). |
int co_val_init_us | ( | char16_t ** | val, |
const char16_t * | us | ||
) |
Initializes an array of (16-bit) Unicode characters (CO_DEFTYPE_UNICODE_STRING).
val | the address of a pointer. On success, *val points to the first character in the string. |
us | a pointer to the (null-terminated) string with which *val should be initialized (can be NULL). |
int co_val_init_us_n | ( | char16_t ** | val, |
const char16_t * | us, | ||
size_t | n | ||
) |
Initializes an array of (16-bit) Unicode characters (CO_DEFTYPE_UNICODE_STRING).
val | the address of a pointer. On success, *val points to the first character in the string. |
us | a pointer to the string with which *val should be initialized (can be NULL). |
n | the number of (16-bit) Unicode characters in the value to be created (excluding the terminating null bytes) and the maximum number of characters to copy from us (unless us is NULL). |
int co_val_init_dom | ( | void ** | val, |
const void * | dom, | ||
size_t | n | ||
) |
Initializes an arbitrary large block of data (CO_DEFTYPE_DOMAIN).
val | the address of a pointer. On success, *val points to the first byte. |
dom | a pointer to the bytes with which *val should be initialized (can be NULL). |
n | the number of bytes in the value to be created (and the number of bytes at dom unless dom is NULL). |
void co_val_fini | ( | co_unsigned16_t | type, |
void * | val | ||
) |
Finalizes a value of the specified data type.
It is safe to invoke this function multiple times on the same value.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be finalized (can be NULL). In the case of strings or domains, this MUST be the address of pointer. |
const void * co_val_addressof | ( | co_unsigned16_t | type, |
const void * | val | ||
) |
Returns the address of the first byte in a value of the specified data type.
In the case of strings or domains, this is the address of the first byte in the array.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value (can be NULL). In the case of strings or domains, this MUST be the address of pointer. |
size_t co_val_sizeof | ( | co_unsigned16_t | type, |
const void * | val | ||
) |
Returns the size (in bytes) of a value of the specified data type.
In the case of strings or domains, this is the number of bytes in the array.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value (can be NULL). In the case of strings or domains, this MUST be the address of pointer. |
size_t co_val_make | ( | co_unsigned16_t | type, |
void * | val, | ||
const void * | ptr, | ||
size_t | n | ||
) |
Constructs a value of the specified data type.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be constructed. In the case of strings or domains, this MUST be the address of pointer. Note that this value is not finalized before the copy is performed. |
ptr | a pointer to the bytes to be copied. In case of strings or domains, ptr MUST point to the first byte in the array. |
n | the number of bytes at ptr. In case of strings, n SHOULD exclude the terminating null byte(s). |
size_t co_val_copy | ( | co_unsigned16_t | type, |
void * | dst, | ||
const void * | src | ||
) |
Copies one value to another.
In case of strings or domains, this function performs a deep copy (i.e, it copies the array).
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
dst | a pointer to the destination value. In the case of strings or domains, this MUST be the address of pointer. Note that this value is not finalized before the copy is performed. |
src | a pointer to the source value. In the case of strings or domains, this MUST be the address of pointer. |
co_val_sizeof(type, src)
), or 0 on error. In the latter case, the error number can be obtained with get_errc().size_t co_val_move | ( | co_unsigned16_t | type, |
void * | dst, | ||
void * | src | ||
) |
Moves one value to another.
In case of strings or domains, this function performs a shallow copy (i.e., it copies the pointer to the array).
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
dst | a pointer to the destination value. In the case of strings or domains, this MUST be the address of pointer. Note that this value is not finalized before the move is performed. |
src | a pointer to the source value. In the case of strings or domains, this MUST be the address of pointer (which is set to NULL on exit). |
co_type_sizeof(type)
), or 0 on error. In the latter case, the error number can be obtained with get_errc().int co_val_cmp | ( | co_unsigned16_t | type, |
const void * | v1, | ||
const void * | v2 | ||
) |
Compares two values of the specified data type.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
v1 | a pointer to the first value. In case of string or domains, this MUST be the address of pointer. |
v2 | a pointer to the second value. In case of string or domains, this MUST be the address of pointer. |
size_t co_val_read | ( | co_unsigned16_t | type, |
void * | val, | ||
const uint_least8_t * | begin, | ||
const uint_least8_t * | end | ||
) |
Reads a value of the specified data type from a memory buffer.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address at which to store the value. On success, if val is not NULL, *val contains the read value. On error, *val is left untouched. In the case of strings or domains, val MUST be the address of a pointer. Note that this value is not finalized before the read value is stored. |
begin | a pointer to the start of the buffer. |
end | a pointer to one past the last byte in the buffer. At most end - begin bytes are read. For strings and domains, all bytes are considered to be part of the value. |
size_t co_val_read_file | ( | co_unsigned16_t | type, |
void * | val, | ||
const char * | filename | ||
) |
Reads a value of the specified data type from a file.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address at which to store the value. On success, if val is not NULL, *val contains the read value. In the case of strings or domains, val MUST be the address of a pointer. Note that this value is not finalized before the read value is stored. |
filename | a pointer to the name of the file. |
size_t co_val_read_frbuf | ( | co_unsigned16_t | type, |
void * | val, | ||
struct __frbuf * | buf | ||
) |
Reads a value of the specified data type from the current position in a read file buffer.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address at which to store the value. On success, if val is not NULL, *val contains the read value. In the case of strings or domains, val MUST be the address of a pointer. Note that this value is not finalized before the read value is stored. |
buf | a pointer to a read file buffer. |
co_unsigned32_t co_val_read_sdo | ( | co_unsigned16_t | type, |
void * | val, | ||
const void * | ptr, | ||
size_t | n | ||
) |
Reads a value of the specified data type from an SDO buffer.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address at which to store the value. On success, if val is not NULL, *val contains the read value. On error, *val is left untouched. In the case of strings or domains, val MUST be the address of pointer. Note that this value is not finalized before the read value is stored. |
ptr | a pointer to the bytes in the SDO. |
n | the number of bytes at ptr. |
size_t co_val_write | ( | co_unsigned16_t | type, |
const void * | val, | ||
uint_least8_t * | begin, | ||
uint_least8_t * | end | ||
) |
Writes a value of the specified data type to a memory buffer.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of strings or domains, this MUST be the address of pointer. |
begin | a pointer to the start of the buffer. If begin is NULL, nothing is written. |
end | a pointer to one past the last byte in the buffer. If end is not NULL, and the buffer is too small (i.e., end - begin is less than the return value), nothing is written. |
size_t co_val_write_file | ( | co_unsigned16_t | type, |
const void * | val, | ||
const char * | filename | ||
) |
Writes a value of the specified data type to a file.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of strings or domains, this MUST be the address of pointer. |
filename | a pointer to the name of the file. |
size_t co_val_write_fwbuf | ( | co_unsigned16_t | type, |
const void * | val, | ||
struct __fwbuf * | buf | ||
) |
Writes a value of the specified data type to the current position in a write file buffer.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of strings or domains, this MUST be the address of pointer. |
buf | a pointer to a write file buffer. |
size_t co_val_lex | ( | co_unsigned16_t | type, |
void * | val, | ||
const char * | begin, | ||
const char * | end, | ||
struct floc * | at | ||
) |
Lexes a value of the specified data type from a memory buffer.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address at which to store the value. On success, if val is not NULL, *val contains the lexed value. On error, *val is left untouched. In the case of strings or domains, val MUST be the address of pointer. Note that this value is not finalized before the parsed value is stored. |
begin | a pointer to the start of the buffer. |
end | a pointer to one past the last character in the buffer (can be NULL if the buffer is null-terminated). |
at | an optional pointer to the file location of begin (used for diagnostic purposes). On success, if at != NULL , *at points to one past the last character lexed. On error, *at is left untouched. |
size_t co_val_print | ( | co_unsigned16_t | type, |
const void * | val, | ||
char ** | pbegin, | ||
char * | end | ||
) |
Prints a value of the specified data type to a memory buffer.
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of string or domains, this MUST be the address of pointer. |
pbegin | the address of a pointer to the start of the buffer. If pbegin or *pbegin is NULL, nothing is written; Otherwise, on exit, *pbegin points to one past the last character written. |
end | a pointer to one past the last character in the buffer. If end is not NULL, at most end - *pbegin characters are written, and the output may be truncated. |