Lely core libraries  2.2.5
type.c
Go to the documentation of this file.
1 
24 #include "co.h"
25 #include <lely/co/type.h>
26 
27 int
28 co_type_is_basic(co_unsigned16_t type)
29 {
30  switch (type) {
31 #define LELY_CO_DEFINE_TYPE(a, b, c, d) case CO_DEFTYPE_##a:
32 #include <lely/co/def/basic.def>
33 #undef LELY_CO_DEFINE_TYPE
34  return 1;
35  default: return 0;
36  }
37 }
38 
39 int
40 co_type_is_array(co_unsigned16_t type)
41 {
42  switch (type) {
46  case CO_DEFTYPE_DOMAIN: return 1;
47  default: return 0;
48  }
49 }
50 
51 size_t
52 co_type_sizeof(co_unsigned16_t type)
53 {
54  switch (type) {
55 #define LELY_CO_DEFINE_TYPE(a, b, c, d) \
56  case CO_DEFTYPE_##a: \
57  return sizeof(co_##b##_t);
58 #include <lely/co/def/type.def>
59 #undef LELY_CO_DEFINE_TYPE
60  default: return 0;
61  }
62 }
63 
64 size_t
65 co_type_alignof(co_unsigned16_t type)
66 {
67  switch (type) {
68 #define LELY_CO_DEFINE_TYPE(a, b, c, d) \
69  case CO_DEFTYPE_##a: \
70  return _Alignof(co_##b##_t);
71 #include <lely/co/def/type.def>
72 #undef LELY_CO_DEFINE_TYPE
73  default: return 1;
74  }
75 }
co_type_is_array
int co_type_is_array(co_unsigned16_t type)
Returns 1 if the specified (static) data type is an array, and 0 if not.
Definition: type.c:40
co_type_alignof
size_t co_type_alignof(co_unsigned16_t type)
Returns the alignment requirements (in bytes) of a value of the specified data type,...
Definition: type.c:65
CO_DEFTYPE_VISIBLE_STRING
#define CO_DEFTYPE_VISIBLE_STRING
The data type (and object index) of an array of visible characters.
Definition: type.h:56
CO_DEFTYPE_DOMAIN
#define CO_DEFTYPE_DOMAIN
The data type (and object index) of an arbitrary large block of data.
Definition: type.h:77
co.h
co_type_sizeof
size_t co_type_sizeof(co_unsigned16_t type)
Returns the native size (in bytes) of a value of the specified data type, or 0 if it is not a static ...
Definition: type.c:52
type.h
CO_DEFTYPE_OCTET_STRING
#define CO_DEFTYPE_OCTET_STRING
The data type (and object index) of an array of octets.
Definition: type.h:59
co_type_is_basic
int co_type_is_basic(co_unsigned16_t type)
Returns 1 if the specified (static) data type is a basic type, and 0 if not.
Definition: type.c:28
CO_DEFTYPE_UNICODE_STRING
#define CO_DEFTYPE_UNICODE_STRING
The data type (and object index) of an array of (16-bit) Unicode characters.
Definition: type.h:62