10 #ifndef K_API_API_DEF_H
11 #define K_API_API_DEF_H
18 #define kDlCall kxDlCall
21 # define kFx(TYPE) kExportFx(TYPE)
22 # define kDx(TYPE) kExportDx(TYPE)
24 # define kFx(TYPE) kImportFx(TYPE)
25 # define kDx(TYPE) kImportDx(TYPE)
42 #define k8U_MAX (255U)
43 #define k8U_NULL (k8U_MAX)
58 #define k16U_MAX (65535U)
59 #define k16U_NULL (k16U_MAX)
74 #define k32U_MAX (4294967295U)
75 #define k32U_NULL (k32U_MAX)
89 #define k64U(CONST) kx64U(CONST)
90 #define k64U_MIN k64U(0)
91 #define k64U_MAX k64U(18446744073709551615)
92 #define k64U_NULL (k64U_MAX)
95 #define kINFINITE k64U_MAX
108 #define k8S_MAX (127)
109 #define k8S_MIN (-k8S_MAX -1)
110 #define k8S_NULL (k8S_MIN)
124 #define k16S_MAX (32767)
125 #define k16S_MIN (-k16S_MAX -1)
126 #define k16S_NULL (k16S_MIN)
140 #define k32S_MAX (2147483647)
141 #define k32S_MIN (-k32S_MAX -1)
142 #define k32S_NULL (k32S_MIN)
156 #define k64S(CONST) kx64S(CONST)
157 #define k64S_MAX k64S(9223372036854775807)
158 #define k64S_MIN (-k64S_MAX -1)
159 #define k64S_NULL (k64S_MIN)
173 #define k32F_MIN (1.175494351e-38F)
174 #define k32F_MAX (3.402823466e+38F)
175 #define k32F_NULL (-k32F_MAX)
189 #define k64F_MIN (2.2250738585072014e-308)
190 #define k64F_MAX (1.7976931348623157e+308)
191 #define k64F_NULL (-k64F_MAX)
202 typedef kxByte kByte;
212 typedef kxSize
kSize;
215 #define kSIZE_MAX kxSIZE_MAX
216 #define kSIZE_NULL kSIZE_MAX
225 typedef kxSSize kSSize;
228 #define kSSIZE_MIN kxSSIZE_MIN
229 #define kSSIZE_MAX kxSSIZE_MAX
230 #define kSSIZE_NULL kSSIZE_MIN
240 typedef void* kPointer;
250 #define kIsNull(POINTER) kIsNull_(POINTER)
275 typedef kxChar kChar;
338 #define kERROR_STATE (-1000)
339 #define kERROR_NOT_FOUND (-999)
340 #define kERROR_COMMAND (-998)
341 #define kERROR_PARAMETER (-997)
342 #define kERROR_UNIMPLEMENTED (-996)
343 #define kERROR_MEMORY (-994)
344 #define kERROR_TIMEOUT (-993)
345 #define kERROR_INCOMPLETE (-992)
346 #define kERROR_STREAM (-991)
347 #define kERROR_CLOSED (-990)
348 #define kERROR_VERSION (-989)
349 #define kERROR_ABORT (-988)
350 #define kERROR_ALREADY_EXISTS (-987)
351 #define kERROR_NETWORK (-986)
352 #define kERROR_HEAP (-985)
353 #define kERROR_FORMAT (-984)
354 #define kERROR_READ_ONLY (-983)
355 #define kERROR_WRITE_ONLY (-982)
356 #define kERROR_BUSY (-981)
357 #define kERROR_CONFLICT (-980)
358 #define kERROR_OS (-979)
359 #define kERROR_DEVICE (-978)
360 #define kERROR_FULL (-977)
361 #define kERROR_IN_PROGRESS (-976)
375 kFx(const kChar*) kStatus_Name(kStatus status);
386 #define kIsError(EXPRESSION) kIsError_(EXPRESSION)
397 #define kSuccess(EXPRESSION) kSuccess_(EXPRESSION)
409 #define kCheck(EXPRESSION) kCheck_(EXPRESSION)
421 #define kCheckArgs(EXPRESSION) kCheckArgs_(EXPRESSION)
433 #define kCheckState(EXPRESSION) kCheckState_(EXPRESSION)
450 #define kThrow(EXPRESSION) kThrow_(EXPRESSION)
463 #define kTest(EXPRESSION) kTest_(EXPRESSION)
476 #define kTestArgs(EXPRESSION) kTestArgs_(EXPRESSION)
489 #define kTestState(EXPRESSION) kTestState_(EXPRESSION)
499 #define kCatch(STATUS_POINTER) kCatch_(STATUS_POINTER)
511 #define kEndCatch(STATUS) kEndCatch_(STATUS)
518 #define kFinally kFinally_
528 #define kEndFinally() kEndFinally_()
538 #define kCatchEx(STATUS_POINTER) kCatchEx_(STATUS_POINTER)
552 #define kEndCatchEx(STATUS) kEndCatchEx_(STATUS)
559 #define kFinallyEx kFinallyEx_
569 #define kEndFinallyEx() kEndFinallyEx_()
578 #define kAssert(EXPRESSION) kAssert_(EXPRESSION)
590 #define kAssertType(OBJECT, SYMBOL) kAssertType_(OBJECT, SYMBOL)
601 #define kTrace(TAG) kTrace_(TAG)
1096 #define kPoint_Init_(POINT, X, Y) kxPoint_Init_(POINT, X, Y)
1166 #define kPoint3d_Init_(POINT, X, Y, Z) kxPoint3d_Init_(POINT, X, Y, Z)
1241 #define kRect_Init_(RECT, X, Y, W, H) kxRect_Init_(RECT, X, Y, W, H)
1272 #define kRect3d_Init_(RECT, X, Y, Z, W, H, D) kxRect3d_Init_(RECT, X, Y, Z, W, H, D)
1318 #define kRotatedRect_Init_(RECT, XC, YC, W, H, A) kxRotatedRect_Init_(RECT, XC, YC, W, H, A)
1331 #define kPIXEL_FORMAT_NULL (0)
1332 #define kPIXEL_FORMAT_8BPP_GREYSCALE (1)
1333 #define kPIXEL_FORMAT_8BPP_CFA (2)
1334 #define kPIXEL_FORMAT_8BPC_BGRX (3)
1348 #define kCFA_NONE (0)
1349 #define kCFA_BAYER_BGGR (1)
1350 #define kCFA_BAYER_GBRG (2)
1351 #define kCFA_BAYER_RGGB (3)
1352 #define kCFA_BAYER_GRBG (4)
1380 #define kRgb_Init_(RGB, R, G, B) kxRgb_Init_(RGB, R, G, B)
1408 #define kArgb_Init_(ARGB, A, R, G, B) kxArgb_Init_(ARGB, A, R, G, B)
1418 #define kCOMPARISON_EQ (0)
1419 #define kCOMPARISON_NEQ (1)
1420 #define kCOMPARISON_LT (2)
1421 #define kCOMPARISON_LTE (3)
1422 #define kCOMPARISON_GT (4)
1423 #define kCOMPARISON_GTE (5)
1473 #define kFILE_MODE_READ (0x1)
1474 #define kFILE_MODE_WRITE (0x2)
1475 #define kFILE_MODE_UPDATE (0x4)
1484 typedef k32s kSeekOrigin;
1486 #define kSEEK_ORIGIN_BEGIN (0)
1487 #define kSEEK_ORIGIN_CURRENT (1)
1488 #define kSEEK_ORIGIN_END (2)
1498 #define kCountOf(CARRAY) kCountOf_(CARRAY)
1511 #define kCast(TYPE, ITEM) kCast_(TYPE, ITEM)
1520 #define kMin_(A, B) kxMin_(A, B)
1529 #define kMax_(A, B) kxMax_(A, B)
1539 #define kClamp_(V, VMIN, VMAX) kxClamp_((V), (VMIN), (VMAX))
1547 #define kAbs_(A) kxAbs_(A)
1554 #define kZero_(VALUE) kxZero_(VALUE)
1563 #define kItemCopy_(DEST, SRC, SIZE) kxItemCopy_(DEST, SRC, SIZE)
1572 #define kItemSet_(DEST, FILL, SIZE) kxItemSet_(DEST, FILL, SIZE)
1580 #define kItemZero_(DEST, SIZE) kItemSet_(DEST, 0, SIZE)
1589 #define kItemAt_(BASE, INDEX, SIZE) kAt_((BASE), (INDEX)*(SIZE))
1617 #define kTypeOf(SYMBOL) kTypeOf_(SYMBOL)
1644 #define kAssemblyOf(SYMBOL) kAssemblyOf_(SYMBOL)
1654 #define kStaticOf(SYMBOL) kStaticOf_(SYMBOL)
1662 #define kStaticInitialized(SYMBOL) kStaticInitialized_(SYMBOL)
1671 #define kDeclareAssembly(PREFIX, SYMBOL) kDeclareAssembly_(PREFIX, SYMBOL)
1681 #define kBeginAssembly(PREFIX, SYMBOL, VERSION) kBeginAssembly_(PREFIX, SYMBOL, VERSION)
1688 #define kEndAssembly() kEndAssembly_()
1698 #define kDeclareValue(PREFIX, SYMBOL, BASE) kDeclareValue_(PREFIX, SYMBOL, BASE)
1708 #define kBeginValue(PREFIX, SYMBOL, BASE) kBeginValue_(PREFIX, SYMBOL, BASE)
1715 #define kEndValue() kEndValue_()
1725 #define kDeclareEnum(PREFIX, SYMBOL, BASE) kDeclareEnum_(PREFIX, SYMBOL, BASE)
1735 #define kBeginEnum(PREFIX, SYMBOL, BASE) kBeginEnum_(PREFIX, SYMBOL, BASE)
1742 #define kEndEnum() kEndEnum_()
1752 #define kDeclareBitEnum(PREFIX, SYMBOL, BASE) kDeclareBitEnum_(PREFIX, SYMBOL, BASE)
1762 #define kBeginBitEnum(PREFIX, SYMBOL, BASE) kBeginBitEnum_(PREFIX, SYMBOL, BASE)
1769 #define kEndBitEnum() kEndBitEnum_()
1779 #define kDeclareArrayValue(PREFIX, SYMBOL, BASE) kDeclareArrayValue_(PREFIX, SYMBOL, BASE)
1790 #define kBeginArrayValue(PREFIX, SYMBOL, TYPE, BASE) kBeginArrayValue_(PREFIX, SYMBOL, TYPE, BASE)
1797 #define kEndArrayValue() kEndArrayValue_()
1807 #define kDeclareInterface(PREFIX, SYMBOL, BASE) kDeclareInterface_(PREFIX, SYMBOL, BASE)
1817 #define kBeginInterface(PREFIX, SYMBOL, BASE) kBeginInterface_(PREFIX, SYMBOL, BASE)
1824 #define kEndInterface() kEndInterface_()
1834 #define kDeclareFullClass(PREFIX, SYMBOL, BASE) kDeclareFullClass_(PREFIX, SYMBOL, BASE)
1844 #define kBeginFullClass(PREFIX, SYMBOL, BASE) kBeginFullClass_(PREFIX, SYMBOL, BASE)
1851 #define kEndFullClass() kEndFullClass_()
1861 #define kDeclareVirtualClass(PREFIX, SYMBOL, BASE) kDeclareVirtualClass_(PREFIX, SYMBOL, BASE)
1871 #define kBeginVirtualClass(PREFIX, SYMBOL, BASE) kBeginVirtualClass_(PREFIX, SYMBOL, BASE)
1878 #define kEndVirtualClass() kEndVirtualClass_()
1887 #define kDeclareStaticClass(PREFIX, SYMBOL) kDeclareStaticClass_(PREFIX, SYMBOL)
1896 #define kBeginStaticClass(PREFIX, SYMBOL) kBeginStaticClass_(PREFIX, SYMBOL)
1903 #define kEndStaticClass() kEndStaticClass_()
1913 #define kDeclareClass(PREFIX, SYMBOL, BASE) kDeclareClass_(PREFIX, SYMBOL, BASE)
1923 #define kBeginClass(PREFIX, SYMBOL, BASE) kBeginClass_(PREFIX, SYMBOL, BASE)
1930 #define kEndClass() kEndClass_()
1938 #define kAddDependency(SYMBOL) kAddDependency_(SYMBOL)
1946 #define kAddType(SYMBOL) kAddType_(SYMBOL)
1958 #define kAddPriority(SYMBOL) kAddPriority_(SYMBOL)
1967 #define kAddInterface(SYMBOL, IFACE) kAddInterface_(SYMBOL, IFACE)
1976 #define kAddMethod(SYMBOL, METHOD) kAddMethod_(SYMBOL, METHOD)
1986 #define kAddVMethod(IN_TYPE, FROM_TYPE, METHOD) kAddVMethod_(IN_TYPE, FROM_TYPE, METHOD)
1997 #define kAddIVMethod(IN_TYPE, FROM_IFACE, IMETHOD, CMETHOD) kAddIVMethod_(IN_TYPE, FROM_IFACE, IMETHOD, CMETHOD)
2007 #define kAddField(VALUE, FIELD_TYPE, FIELD) kAddField_(VALUE, FIELD_TYPE, FIELD)
2016 #define kAddEnumerator kAddEnumerator_
2029 #define kAddVersion(TYPE, FORMAT, FORMAT_VER, GUID, WRITE_METHOD, READ_METHOD) \
2030 kAddVersion_(TYPE, FORMAT, FORMAT_VER, GUID, WRITE_METHOD, READ_METHOD)
2039 #define kAddFlags(TYPE, FLAGS) kAddFlags_(TYPE, FLAGS)
2063 #define kDefineDebugHints() kDefineDebugHints_()
2067 #include <kApi/kApiDef.x.h>
k32f y
Y-coordinate value.
Definition: kApiDef.h:1072
kStatus k32s_Parse(k32s *value, const kChar *str)
Converts string to k32s value.
k64f height
Height of the rectangular cuboid.
Definition: kApiDef.h:1257
Represents a 64-unit, null-terminated, kChar sequence.
Represents a 32-bit unsigned integer.
k32s y
Y-coordinate of the origin.
Definition: kApiDef.h:1195
kStatus kBool_Parse(kBool *value, const kChar *str)
Converts string to kBool value.
k64f height
Height of the rectangle.
Definition: kApiDef.h:1229
k32f x
X-coordinate of the origin.
Definition: kApiDef.h:1210
Rectangle structure with 32-bit signed integer fields.
Definition: kApiDef.h:1192
3D point structure with 32-bit floating-point fields.
Definition: kApiDef.h:1136
k64f x
X-coordinate of the origin.
Definition: kApiDef.h:1226
k32s width
Width of the rectangle.
Definition: kApiDef.h:1286
k8u b
Blue component value.
Definition: kApiDef.h:1365
k32s y
Y-coordinate value.
Definition: kApiDef.h:1124
k16s width
Width of the rectangle.
Definition: kApiDef.h:1180
32-bit color pixel structure (B/G/R/A).
Definition: kApiDef.h:1390
k16s y
Y-coordinate of the origin.
Definition: kApiDef.h:1179
2D point structure with 16-bit signed integer fields.
Definition: kApiDef.h:1041
Represents a 64-bit unsigned integer.
Architecture/compiler-specific definitions.
Represents a 256-unit, null-terminated, kChar sequence.
kPointer receiver
Callback receiver context pointer.
Definition: kApiDef.h:1461
Rotated rectangle structure with 32-bit floating-point fields.
Definition: kApiDef.h:1299
k64f y
Y-coordinate of the origin.
Definition: kApiDef.h:1227
k32s z
Z-coordinate value.
Definition: kApiDef.h:1125
Represents a void pointer.
32-bit color pixel structure (B/G/R/X).
Definition: kApiDef.h:1363
kStatus kSize_Parse(kSize *value, const kChar *str)
Converts string to kSize value.
k32f x
X-coordinate value.
Definition: kApiDef.h:1071
kStatus kSSize_Parse(kSSize *value, const kChar *str)
Converts string to kSSize value.
k16s z
Z-coordinate value.
Definition: kApiDef.h:1110
kStatus k32f_Format(k32f value, kChar *buffer, kSize capacity)
Converts k32f value to string.
Represents a 16-bit unsigned integer.
kStatus k32u_Format(k32u value, kChar *buffer, kSize capacity)
Converts k32u value to string.
k32s xc
X-coordinate of the rectangle center.
Definition: kApiDef.h:1284
Rotated rectangle structure with 32-bit signed integer fields.
Definition: kApiDef.h:1282
k32f yc
Y-coordinate of the rectangle center.
Definition: kApiDef.h:1302
kStatus kBool_Format(kBool value, kChar *buffer, kSize capacity)
Converts kBool value to string.
Represents an unsigned integer that can store a pointer address.
k32s angle
Rotation angle of the rectangle.
Definition: kApiDef.h:1288
k64f width
Width of the rectangular cuboid.
Definition: kApiDef.h:1256
Represents an 8-bit unsigned integer.
k64f x
X-coordinate of the origin.
Definition: kApiDef.h:1253
k64f depth
Depth of the rectangular cuboid.
Definition: kApiDef.h:1258
k64f y
Y-coordinate value.
Definition: kApiDef.h:1154
k64f x
X-coordinate value.
Definition: kApiDef.h:1153
Represents a single unit (byte) in a UTF-8 character.
kStatus k64s_Format(k64s value, kChar *buffer, kSize capacity)
Converts k64s value to string.
kStatus k16u_Parse(k16u *value, const kChar *str)
Converts string to k16u value.
k16s x
X-coordinate value.
Definition: kApiDef.h:1043
k16s y
Y-coordinate value.
Definition: kApiDef.h:1109
kStatus kSSize_Format(kSSize value, kChar *buffer, kSize capacity)
Converts kSSize value to string.
kSize(kCall * kHashFx)(const void *item)
Callback signature to determine hash code of an item.
Definition: kApiDef.h:1440
kStatus k64f_Parse(k64f *value, const kChar *str)
Converts string to k64f value.
k32f angle
Rotation angle of the rectangle.
Definition: kApiDef.h:1305
Represents a signed integer that can store a pointer address.
k32s height
Height of the rectangle.
Definition: kApiDef.h:1197
Rectangle structure with 32-bit floating-point fields.
Definition: kApiDef.h:1208
k32s kVersion_Compare(kVersion version1, kVersion version2)
Returns an integral value indicating the relationship between the versions.
k32s width
Width of the rectangle.
Definition: kApiDef.h:1196
kStatus k32u_Parse(k32u *value, const kChar *str)
Converts string to k32u value.
k32s x
X-coordinate value.
Definition: kApiDef.h:1057
k32s height
Height of the rectangle.
Definition: kApiDef.h:1287
Rectangle structure with 64-bit floating-point fields.
Definition: kApiDef.h:1224
Represents a 128-unit, null-terminated, kChar sequence.
k32f x
X-coordinate value.
Definition: kApiDef.h:1138
k8u kVersion_Minor(kVersion version)
Returns the minor part of a version number.
kStatus k16s_Format(k16s value, kChar *buffer, kSize capacity)
Converts k16s value to string.
kBool(kCall * kEqualsFx)(const void *item1, const void *item2)
Callback signature to determine equality of two items.
Definition: kApiDef.h:1432
k8u kVersion_Major(kVersion version)
Returns the major part of a version number.
k16s y
Y-coordinate value.
Definition: kApiDef.h:1044
k16s x
X-coordinate value.
Definition: kApiDef.h:1108
k32f z
Z-coordinate value.
Definition: kApiDef.h:1140
kStatus k32f_Parse(k32f *value, const kChar *str)
Converts string to k32f value.
k64f width
Width of the rectangle.
Definition: kApiDef.h:1228
k64f z
Z-coordinate value.
Definition: kApiDef.h:1155
Represents a callback function and context pointer.
Definition: kApiDef.h:1458
k8u kVersion_Build(kVersion version)
Returns the build part of a version number.
k8u r
Red component value.
Definition: kApiDef.h:1394
2D point structure with 32-bit floating-point fields.
Definition: kApiDef.h:1069
k64f y
Y-coordinate of the origin.
Definition: kApiDef.h:1254
kStatus k32s_Format(k32s value, kChar *buffer, kSize capacity)
Converts k32s value to string.
k32s yc
Y-coordinate of the rectangle center.
Definition: kApiDef.h:1285
Represents a 32-bit signed integer.
void(kCall * kFunction)()
Generic pointer to function.
Definition: kApiDef.h:28
k8u r
Red component value.
Definition: kApiDef.h:1367
k32f height
Height of the rectangle.
Definition: kApiDef.h:1304
k64f x
X-coordinate value.
Definition: kApiDef.h:1085
kVersion kVersion_Create(k32u major, k32u minor, k32u release, k32u build)
Creates a version value from its constituent parts.
k8u kVersion_Release(kVersion version)
Returns the release part of a version number.
kStatus k16s_Parse(k16s *value, const kChar *str)
Converts string to k16s value.
2D point structure with 64-bit floating-point fields.
Definition: kApiDef.h:1083
kStatus(kCall * kCallbackFx)(kPointer receiver, kPointer sender, void *args)
Callback signature for a generic event handler.
Definition: kApiDef.h:1450
k8u g
Green component value.
Definition: kApiDef.h:1366
Represents a 64-bit signed integer.
kStatus kSize_Format(kSize value, kChar *buffer, kSize capacity)
Converts kSize value to string.
kStatus kVersion_Format(kVersion version, kChar *buffer, kSize capacity)
Formats a version to a string buffer.
Represents a 16-unit, null-terminated, kChar sequence.
Flags that control how a file is opened.
Represents an 8-bit signed integer.
k32f width
Width of the rectangle.
Definition: kApiDef.h:1303
k8u b
Blue component value.
Definition: kApiDef.h:1392
k16s height
Height of the rectangle.
Definition: kApiDef.h:1181
kStatus k8s_Format(k8s value, kChar *buffer, kSize capacity)
Converts k8s value to string.
k8u g
Green component value.
Definition: kApiDef.h:1393
kStatus k64s_Parse(k64s *value, const kChar *str)
Converts string to k64s value.
k32s x
X-coordinate value.
Definition: kApiDef.h:1123
kStatus kVersion_Parse(kVersion *version, const kChar *buffer)
Parses a version from a formatted string.
Represents a 32-unit, null-terminated, kChar sequence.
3D point structure with 16-bit signed integer fields.
Definition: kApiDef.h:1106
Represents a 16-bit signed integer.
k32f y
Y-coordinate of the origin.
Definition: kApiDef.h:1211
Represents a 32-bit floating-point number.
k64f y
Y-coordinate value.
Definition: kApiDef.h:1086
Represents a version number.
k8u a
Alpha component value.
Definition: kApiDef.h:1395
Represents an error code.
k64f z
Z-coordinate of the origin.
Definition: kApiDef.h:1255
kStatus k64u_Format(k64u value, kChar *buffer, kSize capacity)
Converts k64u value to string.
k8u x
Undefined.
Definition: kApiDef.h:1368
k32s y
Y-coordinate value.
Definition: kApiDef.h:1058
#define kCall
kApi standard function calling convention.
Definition: kApiDef.h:17
k32f width
Width of the rectangle.
Definition: kApiDef.h:1212
kStatus k16u_Format(k16u value, kChar *buffer, kSize capacity)
Converts k16u value to string.
Rectangular cuboid structure with 64-bit floating-point fields.
Definition: kApiDef.h:1251
kStatus k64f_Format(k64f value, kChar *buffer, kSize capacity)
Converts k64f value to string.
Rectangle structure with 16-bit signed integer fields.
Definition: kApiDef.h:1176
kStatus k8u_Format(k8u value, kChar *buffer, kSize capacity)
Converts k8u value to string.
Represents a 64-bit floating-point number.
Represents a comparison type.
k32s x
X-coordinate of the origin.
Definition: kApiDef.h:1194
k32f xc
X-coordinate of the rectangle center.
Definition: kApiDef.h:1301
2D point structure with 32-bit signed integer fields.
Definition: kApiDef.h:1055
Represents a boolean value.
kStatus k64u_Parse(k64u *value, const kChar *str)
Converts string to k64u value.
k16s x
X-coordinate of the origin.
Definition: kApiDef.h:1178
k32f height
Height of the rectangle.
Definition: kApiDef.h:1213
3D point structure with 64-bit floating-point fields.
Definition: kApiDef.h:1151
3D point structure with 32-bit signed integer fields.
Definition: kApiDef.h:1121
kStatus k8u_Parse(k8u *value, const kChar *str)
Converts string to k8u value.
k32f y
Y-coordinate value.
Definition: kApiDef.h:1139
kStatus k8s_Parse(k8s *value, const kChar *str)
Converts string to k8s value.