Zen API
 All Classes Files Functions Variables Typedefs Macros Groups Pages
kApiDef.h File Reference

Description

Essential API declarations.

Go to the source code of this file.

Macros

#define k16S_MAX   (32767)
 k16s maximum value.
 
#define k16S_MIN   (-k16S_MAX -1)
 k16s minimum value.
 
#define k16S_NULL   (k16S_MIN)
 k16s invalid value.
 
#define k16U_MAX   (65535U)
 k16u maximum value.
 
#define k16U_MIN   (0)
 k16u minimum value.
 
#define k16U_NULL   (k16U_MAX)
 k16u invalid value.
 
#define k32F_MAX   (3.402823466e+38F)
 k32f largest positive value.
 
#define k32F_MIN   (1.175494351e-38F)
 k32f smallest positive value.
 
#define k32F_NULL   (-k32F_MAX)
 k32f invalid value.
 
#define k32S_MAX   (2147483647)
 k32s maximum value.
 
#define k32S_MIN   (-k32S_MAX -1)
 k32s minimum value.
 
#define k32S_NULL   (k32S_MIN)
 k32s invalid value.
 
#define k32U_MAX   (4294967295U)
 k32u maximum value.
 
#define k32U_MIN   (0)
 k32u minimum value.
 
#define k32U_NULL   (k32U_MAX)
 k32u invalid value.
 
#define k64F_MAX   (1.7976931348623157e+308)
 k64f largest positive value.
 
#define k64F_MIN   (2.2250738585072014e-308)
 k64f smallest positive value.
 
#define k64F_NULL   (-k64F_MAX)
 k64f invalid value.
 
#define k64S(CONST)   kx64S(CONST)
 Declares a 64-bit signed integer literal.
 
#define k64S_MAX   k64S(9223372036854775807)
 k64s maximum value.
 
#define k64S_MIN   (-k64S_MAX -1)
 k64s minimum value.
 
#define k64S_NULL   (k64S_MIN)
 k64s invalid value.
 
#define k64U(CONST)   kx64U(CONST)
 Declares a 64-bit unsigned integer literal.
 
#define k64U_MAX   k64U(18446744073709551615)
 k64u maximum value.
 
#define k64U_MIN   k64U(0)
 k64u minimum value.
 
#define k64U_NULL   (k64U_MAX)
 k64u invalid value.
 
#define k8S_MAX   (127)
 k8s maximum value.
 
#define k8S_MIN   (-k8S_MAX -1)
 k8s minimum value.
 
#define k8S_NULL   (k8S_MIN)
 k8s invalid value.
 
#define k8U_MAX   (255U)
 k8u maximum value.
 
#define k8U_MIN   (0)
 k8u minimum value.
 
#define k8U_NULL   (k8U_MAX)
 k8u invalid value.
 
#define kAbs_(A)   kxAbs_(A)
 Returns the absolute value of a number. More...
 
#define kAddDependency(SYMBOL)   kAddDependency_(SYMBOL)
 Within an assembly definition, specifies a dependency on another assembly. More...
 
#define kAddEnumerator(VALUE, ENUMERATOR)   kAddEnumerator_(VALUE, ENUMERATOR)
 Within an enumeration type definition, indicates that an enumeration has the specified enumerator. More...
 
#define kAddField(VALUE, FIELD_TYPE, FIELD)   kAddField_(VALUE, FIELD_TYPE, FIELD)
 Within a structure type definition, indicates that a structure has the specified field. More...
 
#define kAddFlags(TYPE, FLAGS)   kAddFlags_(TYPE, FLAGS)
 Adds specific flags to type metadata. More...
 
#define kAddInterface(SYMBOL, IFACE)   kAddInterface_(SYMBOL, IFACE)
 Within a type definition, indicates that a type implements the specified interface. More...
 
#define kAddIVMethod(IN_TYPE, FROM_IFACE, IMETHOD, CMETHOD)   kAddIVMethod_(IN_TYPE, FROM_IFACE, IMETHOD, CMETHOD)
 Within a type definition, indicates that a type implements the specified interface method. More...
 
#define kAddMethod(SYMBOL, METHOD)   kAddMethod_(SYMBOL, METHOD)
 Within a type definition, indicates that a type has the specified non-virtual method. More...
 
#define kAddPriority(SYMBOL)   kAddPriority_(SYMBOL)
 Within an assembly definition, indicates a requirement on static initialization order. More...
 
#define kAddType(SYMBOL)   kAddType_(SYMBOL)
 Within an assembly definition, adds a type to the assembly. More...
 
#define kAddVersion(TYPE, FORMAT, FORMAT_VER, GUID, WRITE_METHOD, READ_METHOD)   kAddVersion_(TYPE, FORMAT, FORMAT_VER, GUID, WRITE_METHOD, READ_METHOD)
 Within a type definition, indicates that a type has the specified serialization version. More...
 
#define kAddVMethod(IN_TYPE, FROM_TYPE, METHOD)   kAddVMethod_(IN_TYPE, FROM_TYPE, METHOD)
 Within a type definition, indicates that a type overrides the specified virtual method. More...
 
#define kArgb_Init_(ARGB, A, R, G, B)   kxArgb_Init_(ARGB, A, R, G, B)
 Initializes a kArgb structure. More...
 
#define kAssemblyOf(SYMBOL)   kAssemblyOf_(SYMBOL)
 Returns the kAssembly object associated with the specified assembly symbol. More...
 
#define kAssert(EXPRESSION)   kAssert_(EXPRESSION)
 Aborts execution if EXPRESSION is kFALSE. More...
 
#define kAssertType(OBJECT, SYMBOL)   kAssertType_(OBJECT, SYMBOL)
 Aborts execution if the type of the OBJECT argument is not equivalent to kTypeOf(SYMBOL). More...
 
#define kBeginArrayValue(PREFIX, SYMBOL, TYPE, BASE)   kBeginArrayValue_(PREFIX, SYMBOL, TYPE, BASE)
 Starts the definition of an array-based value type. More...
 
#define kBeginAssembly(PREFIX, SYMBOL, VERSION)   kBeginAssembly_(PREFIX, SYMBOL, VERSION)
 Starts the definition of a type assembly. More...
 
#define kBeginBitEnum(PREFIX, SYMBOL, BASE)   kBeginBitEnum_(PREFIX, SYMBOL, BASE)
 Starts the definition of a bit-flag enumeration value type. More...
 
#define kBeginClass(PREFIX, SYMBOL, BASE)   kBeginClass_(PREFIX, SYMBOL, BASE)
 Starts the definition of a class type that does not require an expanded vtable and does not have static data. More...
 
#define kBeginEnum(PREFIX, SYMBOL, BASE)   kBeginEnum_(PREFIX, SYMBOL, BASE)
 Starts the definition of an enumeration value type. More...
 
#define kBeginFullClass(PREFIX, SYMBOL, BASE)   kBeginFullClass_(PREFIX, SYMBOL, BASE)
 Starts the definition of a class type. More...
 
#define kBeginInterface(PREFIX, SYMBOL, BASE)   kBeginInterface_(PREFIX, SYMBOL, BASE)
 Starts the definition of an interface type. More...
 
#define kBeginStaticClass(PREFIX, SYMBOL)   kBeginStaticClass_(PREFIX, SYMBOL)
 Starts the definition of a class type that has only static data. More...
 
#define kBeginValue(PREFIX, SYMBOL, BASE)   kBeginValue_(PREFIX, SYMBOL, BASE)
 Starts the definition of a structure value type. More...
 
#define kBeginVirtualClass(PREFIX, SYMBOL, BASE)   kBeginVirtualClass_(PREFIX, SYMBOL, BASE)
 Starts the definition of a class type that requires an expanded vtable but does not have static data. More...
 
#define kCall   kxCall
 kApi standard function calling convention.
 
#define kCast(TYPE, ITEM)   kCast_(TYPE, ITEM)
 Casts the ITEM argument to the specified TYPE. More...
 
#define kCatch(STATUS_POINTER)   kCatch_(STATUS_POINTER)
 Closes a kTry block and opens a kCatch error-handling block. More...
 
#define kCatchEx(STATUS_POINTER)   kCatchEx_(STATUS_POINTER)
 Closes a kTry block and opens a kCatchEx error-handling block. More...
 
#define kCFA_BAYER_BGGR   (1)
 Bayer filter: BG/GR.
 
#define kCFA_BAYER_GBRG   (2)
 Bayer filter: GB/RG.
 
#define kCFA_BAYER_GRBG   (4)
 Bayer filter: GR/BG.
 
#define kCFA_BAYER_RGGB   (3)
 Bayer filter: RG/GB.
 
#define kCFA_NONE   (0)
 No color filter.
 
#define kCheck(EXPRESSION)   kCheck_(EXPRESSION)
 Executes a return statement if the given expression is not kOK. More...
 
#define kCheckArgs(EXPRESSION)   kCheckArgs_(EXPRESSION)
 Executes a return statement if the given expression is not kTRUE. More...
 
#define kCheckState(EXPRESSION)   kCheckState_(EXPRESSION)
 Executes a return statement if the given expression is not kTRUE. More...
 
#define kClamp_(V, VMIN, VMAX)   kxClamp_((V), (VMIN), (VMAX))
 Returns a value limited to the specified range. More...
 
#define kCOMPARISON_EQ   (0)
 Is equal.
 
#define kCOMPARISON_GT   (4)
 Is greater than.
 
#define kCOMPARISON_GTE   (5)
 Is greater than or equal.
 
#define kCOMPARISON_LT   (2)
 Is less than.
 
#define kCOMPARISON_LTE   (3)
 Is less than or equal.
 
#define kCOMPARISON_NEQ   (1)
 Is not equal.
 
#define kCountOf(CARRAY)   kCountOf_(CARRAY)
 Returns the number of elements in a C array. More...
 
#define kDeclareArrayValue(PREFIX, SYMBOL, BASE)   kDeclareArrayValue_(PREFIX, SYMBOL, BASE)
 Declares type information for an array-based value type. More...
 
#define kDeclareAssembly(PREFIX, SYMBOL)   kDeclareAssembly_(PREFIX, SYMBOL)
 Declares a type assembly. More...
 
#define kDeclareBitEnum(PREFIX, SYMBOL, BASE)   kDeclareBitEnum_(PREFIX, SYMBOL, BASE)
 Declares type information for a bit-flag enumeration value type. More...
 
#define kDeclareClass(PREFIX, SYMBOL, BASE)   kDeclareClass_(PREFIX, SYMBOL, BASE)
 Declares type information for a class type that does not require an expanded vtable and does not have static data. More...
 
#define kDeclareEnum(PREFIX, SYMBOL, BASE)   kDeclareEnum_(PREFIX, SYMBOL, BASE)
 Declares type information for an enumeration value type. More...
 
#define kDeclareFullClass(PREFIX, SYMBOL, BASE)   kDeclareFullClass_(PREFIX, SYMBOL, BASE)
 Declares type information for a class type. More...
 
#define kDeclareInterface(PREFIX, SYMBOL, BASE)   kDeclareInterface_(PREFIX, SYMBOL, BASE)
 Declares type information for an interface type. More...
 
#define kDeclareStaticClass(PREFIX, SYMBOL)   kDeclareStaticClass_(PREFIX, SYMBOL)
 Declares type information for a class type that has only static data. More...
 
#define kDeclareValue(PREFIX, SYMBOL, BASE)   kDeclareValue_(PREFIX, SYMBOL, BASE)
 Declares type information for a structure value type. More...
 
#define kDeclareVirtualClass(PREFIX, SYMBOL, BASE)   kDeclareVirtualClass_(PREFIX, SYMBOL, BASE)
 Declares type information for a class type that requires an expanded vtable but does not have static data. More...
 
#define kDlCall   kxDlCall
 kApi dynamic load function calling convention.
 
#define kEndArrayValue()   kEndArrayValue_()
 Ends the definition of an array-based value type. More...
 
#define kEndAssembly()   kEndAssembly_()
 Ends the definition of a type assembly. More...
 
#define kEndBitEnum()   kEndBitEnum_()
 Ends the definition of a bit-flag enumeration value type. More...
 
#define kEndCatch(STATUS)   kEndCatch_(STATUS)
 Closes a kCatch block. More...
 
#define kEndCatchEx(STATUS)   kEndCatchEx_(STATUS)
 Closes a kCatchEx block. More...
 
#define kEndClass()   kEndClass_()
 Ends the definition of a class type that does not require an expanded vtable and does not have static data. More...
 
#define kEndEnum()   kEndEnum_()
 Ends the definition of an enumeration value type. More...
 
#define kEndFinally()   kEndFinally_()
 Closes a kFinally block. More...
 
#define kEndFinallyEx()   kEndFinallyEx_()
 Closes a kFinallyEx block. More...
 
#define kEndFullClass()   kEndFullClass_()
 Ends the definition of a class type. More...
 
#define kEndInterface()   kEndInterface_()
 Ends the definition of an interface type. More...
 
#define kEndStaticClass()   kEndStaticClass_()
 Ends the definition of a class type that has only static data. More...
 
#define kEndValue()   kEndValue_()
 Ends the definition of a structure value type. More...
 
#define kEndVirtualClass()   kEndVirtualClass_()
 Ends the definition of a class type that requires an expanded vtable but does not have static data. More...
 
#define kERROR   (0)
 General error.
 
#define kERROR_ABORT   (-988)
 Operation aborted.
 
#define kERROR_ALREADY_EXISTS   (-987)
 Conflicts with existing item.
 
#define kERROR_BUSY   (-981)
 Agent is busy (cannot service request).
 
#define kERROR_CLOSED   (-990)
 Resource is no longer available.
 
#define kERROR_COMMAND   (-998)
 Command not recognized.
 
#define kERROR_CONFLICT   (-980)
 State conflicts with another object.
 
#define kERROR_DEVICE   (-978)
 Hardware device error.
 
#define kERROR_FORMAT   (-984)
 Data parsing/formatting error.
 
#define kERROR_FULL   (-977)
 Resource is already fully utilized.
 
#define kERROR_HEAP   (-985)
 Heap error (leak/double-free).
 
#define kERROR_IN_PROGRESS   (-976)
 Operation is in progress, but not yet complete.
 
#define kERROR_INCOMPLETE   (-992)
 Buffer insufficient for data.
 
#define kERROR_MEMORY   (-994)
 Out of memory.
 
#define kERROR_NETWORK   (-986)
 Network setup/resource error.
 
#define kERROR_NOT_FOUND   (-999)
 Item is not found.
 
#define kERROR_OS   (-979)
 Generic error reported by underlying OS.
 
#define kERROR_PARAMETER   (-997)
 Parameter is invalid.
 
#define kERROR_READ_ONLY   (-983)
 Object is read-only (cannot be written).
 
#define kERROR_STATE   (-1000)
 Invalid state.
 
#define kERROR_STREAM   (-991)
 Error in stream.
 
#define kERROR_TIMEOUT   (-993)
 Action timed out.
 
#define kERROR_UNIMPLEMENTED   (-996)
 Feature not implemented.
 
#define kERROR_VERSION   (-989)
 Incompatible version.
 
#define kERROR_WRITE_ONLY   (-982)
 Object is write-only (cannot be read).
 
#define kFALSE   (0)
 Boolean false.
 
#define kFILE_MODE_READ   (0x1)
 Open the file with permission to read.
 
#define kFILE_MODE_UPDATE   (0x4)
 Preserve contents when opened for writing.
 
#define kFILE_MODE_WRITE   (0x2)
 Open the file with permission to write.
 
#define kFinally   kFinally_
 Closes a kTry block and opens a kFinally block. More...
 
#define kFinallyEx   kFinallyEx_
 Opens a kFinallyEx block. More...
 
#define kINFINITE   k64U_MAX
 Infinity (used for k64u timeouts).
 
#define kIsError(EXPRESSION)   kIsError_(EXPRESSION)
 Returns kTRUE if the given status value is not kOK. More...
 
#define kIsNull(POINTER)   kIsNull_(POINTER)
 Tests for equality with null pointer. More...
 
#define kItemAt_(BASE, INDEX, SIZE)   kAt_((BASE), (INDEX)*(SIZE))
 Gets a pointer to the Nth element of an array. More...
 
#define kItemCopy_(DEST, SRC, SIZE)   kxItemCopy_(DEST, SRC, SIZE)
 Performs a small copy with minimal overhead. More...
 
#define kItemSet_(DEST, FILL, SIZE)   kxItemSet_(DEST, FILL, SIZE)
 Performs a small fill with minimal overhead. More...
 
#define kItemZero_(DEST, SIZE)   kItemSet_(DEST, 0, SIZE)
 Zero-initializes a small amount of memory with minimal overhead. More...
 
#define kMax_(A, B)   kxMax_(A, B)
 Returns the maximum of two numbers. More...
 
#define kMin_(A, B)   kxMin_(A, B)
 Returns the minimum of two numbers. More...
 
#define kNULL   (0)
 Null pointer.
 
#define kOK   (1)
 Operation successful.
 
#define kPIXEL_FORMAT_8BPC_BGRX   (3)
 8-bits-per-channel color with 4 channels (blue/green/red/unused)(kRgb)
 
#define kPIXEL_FORMAT_8BPP_CFA   (2)
 8-bit color filter array (k8u)
 
#define kPIXEL_FORMAT_8BPP_GREYSCALE   (1)
 8-bit greyscale (k8u)
 
#define kPIXEL_FORMAT_NULL   (0)
 Unknown pixel format.
 
#define kPoint3d_Init_(POINT, X, Y, Z)   kxPoint3d_Init_(POINT, X, Y, Z)
 Initializes a 3d point structure. More...
 
#define kPoint_Init_(POINT, X, Y)   kxPoint_Init_(POINT, X, Y)
 Initializes a point structure. More...
 
#define kRect_Init_(RECT, X, Y, W, H)   kxRect_Init_(RECT, X, Y, W, H)
 Initializes a rectangle structure. More...
 
#define kRgb_Init_(RGB, R, G, B)   kxRgb_Init_(RGB, R, G, B)
 Initializes a kRgb structure. More...
 
#define kRotatedRect_Init_(RECT, XC, YC, W, H, A)   kxRotatedRect_Init_(RECT, XC, YC, W, H, A)
 Initializes a rotated rectangle structure. More...
 
#define kSEEK_ORIGIN_BEGIN   (0)
 Seek relative to the start of stream.
 
#define kSEEK_ORIGIN_CURRENT   (1)
 Seek relative to the current position.
 
#define kSEEK_ORIGIN_END   (2)
 Seek relative to the end of stream.
 
#define kSIZE_MAX   kxSIZE_MAX
 Maximum value contained by kSize.
 
#define kSIZE_NULL   kSIZE_MAX
 Invalid size value.
 
#define kSSIZE_MAX   kxSSIZE_MAX
 Maximum value contained by kSSize.
 
#define kSSIZE_MIN   kxSSIZE_MIN
 Minimum value contained by kSSize.
 
#define kSSIZE_NULL   kSSIZE_MIN
 Invalid kSSize value.
 
#define kStaticInitialized(SYMBOL)   kStaticInitialized_(SYMBOL)
 Indicates whether static initialization has completed for the specified type symbol. More...
 
#define kStaticOf(SYMBOL)   kStaticOf_(SYMBOL)
 Returns static data associated with the specified class symbol. More...
 
#define kSuccess(EXPRESSION)   kSuccess_(EXPRESSION)
 Returns kTRUE if the given expression value is kOK. More...
 
#define kTest(EXPRESSION)   kTest_(EXPRESSION)
 Used within a kTry block to conditionally jump to the first error handling block (e.g. More...
 
#define kTestArgs(EXPRESSION)   kTestArgs_(EXPRESSION)
 Within a kTry block, throws kERROR_PARAMETER if the expression result is kFALSE. More...
 
#define kTestState(EXPRESSION)   kTestState_(EXPRESSION)
 Within a kTry block, throws kERROR_STATE if the expression result is kFALSE. More...
 
#define kThrow(EXPRESSION)   kThrow_(EXPRESSION)
 Used within a kTry block to jump to the first error handling block (e.g. More...
 
#define kTrace(TAG)   kTrace_(TAG)
 Generates a trace event using the given tag (string literals only). More...
 
#define kTRUE   (1)
 Boolean true.
 
#define kTry   kTry_
 Opens a kTry error-checking block. More...
 
#define kTypeOf(SYMBOL)   kTypeOf_(SYMBOL)
 Returns the kType object associated with the specified class, interface, or value symbol. More...
 
#define kZero_(VALUE)   kxZero_(VALUE)
 Sets all bits of a structure to zero. More...
 

Typedefs

typedef kStatus(kCallkCallbackFx )(kPointer receiver, kPointer sender, void *args)
 Callback signature for a generic event handler. More...
 
typedef kBool(kCallkEqualsFx )(const void *item1, const void *item2)
 Callback signature to determine equality of two items. More...
 
typedef void(kCallkFunction )()
 Generic pointer to function.
 
typedef kSize(kCallkHashFx )(const void *item)
 Callback signature to determine hash code of an item. More...
 

Macro Definition Documentation

#define kAbs_ (   A)    kxAbs_(A)

Returns the absolute value of a number.

Parameters
AInput value.
Returns
Absolute value of input argument.
#define kAddDependency (   SYMBOL)    kAddDependency_(SYMBOL)

Within an assembly definition, specifies a dependency on another assembly.

Parameters
SYMBOLDependency target (e.g. kApi).
See also
Extending Zen
#define kAddEnumerator (   VALUE,
  ENUMERATOR 
)    kAddEnumerator_(VALUE, ENUMERATOR)

Within an enumeration type definition, indicates that an enumeration has the specified enumerator.

Parameters
VALUEEnumeration type (e.g. kStatus).
ENUMERATOREnumerator(e.g. kERROR).
See also
Extending Zen
#define kAddField (   VALUE,
  FIELD_TYPE,
  FIELD 
)    kAddField_(VALUE, FIELD_TYPE, FIELD)

Within a structure type definition, indicates that a structure has the specified field.

Parameters
VALUEStructure type (e.g. kPoint32s).
FIELD_TYPEField type (e.g. k32s).
FIELDField name (e.g. x).
See also
Extending Zen
#define kAddFlags (   TYPE,
  FLAGS 
)    kAddFlags_(TYPE, FLAGS)

Adds specific flags to type metadata.

Parameters
TYPEType (e.g. kObject).
FLAGSType flags (e.g. kTYPE_FLAGS_ABSTRACT).
See also
Extending Zen
#define kAddInterface (   SYMBOL,
  IFACE 
)    kAddInterface_(SYMBOL, IFACE)

Within a type definition, indicates that a type implements the specified interface.

Parameters
SYMBOLType symbol (e.g. kArrayList).
IFACEInterface symbol (e.g. kCollection).
See also
Extending Zen
#define kAddIVMethod (   IN_TYPE,
  FROM_IFACE,
  IMETHOD,
  CMETHOD 
)    kAddIVMethod_(IN_TYPE, FROM_IFACE, IMETHOD, CMETHOD)

Within a type definition, indicates that a type implements the specified interface method.

Parameters
IN_TYPEOverriding type (e.g. kArrayList).
FROM_IFACEOverridden interface (e.g. kCollection).
IMETHODInterface method name (e.g. VGetIterator).
CMETHODType method name (e.g. GetIterator).
See also
Extending Zen
#define kAddMethod (   SYMBOL,
  METHOD 
)    kAddMethod_(SYMBOL, METHOD)

Within a type definition, indicates that a type has the specified non-virtual method.

Parameters
SYMBOLType symbol (e.g. kArrayList).
METHODMethod name (e.g. Remove).
See also
Extending Zen
#define kAddPriority (   SYMBOL)    kAddPriority_(SYMBOL)

Within an assembly definition, indicates a requirement on static initialization order.

The order of kAddPriority statements within an assembly definition determines the order in which types will be initialized. If initialization priorities are not given, types can be initialized in any order.

Parameters
SYMBOLType symbol (e.g. kArrayList).
See also
Extending Zen
#define kAddType (   SYMBOL)    kAddType_(SYMBOL)

Within an assembly definition, adds a type to the assembly.

Parameters
SYMBOLType symbol (e.g. kArrayList).
See also
Extending Zen
#define kAddVersion (   TYPE,
  FORMAT,
  FORMAT_VER,
  GUID,
  WRITE_METHOD,
  READ_METHOD 
)    kAddVersion_(TYPE, FORMAT, FORMAT_VER, GUID, WRITE_METHOD, READ_METHOD)

Within a type definition, indicates that a type has the specified serialization version.

Parameters
TYPEType symbol (e.g. kArrayList).
FORMATSerialization format name string (e.g. "kdat6").
FORMAT_VERSerialization format version string (e.g. "5.7.1.0").
GUIDType identifier string within serialization format (e.g. "kArrayList-0").
WRITE_METHODSerialization write method (e.g. WriteDat6V0).
READ_METHODSerialization read method (e.g. ReadDat6V0).
See also
Extending Zen, kSerializer
#define kAddVMethod (   IN_TYPE,
  FROM_TYPE,
  METHOD 
)    kAddVMethod_(IN_TYPE, FROM_TYPE, METHOD)

Within a type definition, indicates that a type overrides the specified virtual method.

Parameters
IN_TYPEOverriding type (e.g. kArrayList).
FROM_TYPEOverridden type (e.g. kObject).
METHODMethod name (e.g. VRelease).
See also
Extending Zen
#define kArgb_Init_ (   ARGB,
  A,
  R,
  G,
 
)    kxArgb_Init_(ARGB, A, R, G, B)

Initializes a kArgb structure.

Parameters
ARGBPointer to a kArgb structure.
Aa field value.
Rr field value.
Gg field value.
Bb field value.
#define kAssemblyOf (   SYMBOL)    kAssemblyOf_(SYMBOL)

Returns the kAssembly object associated with the specified assembly symbol.

This macro is used to access assembly information by compile-time symbol name. E.g.

#include <kApi/kApiLib.h>
void PrintCoreAssemblyInfo()
{
kAssembly assembly = kAssemblyOf(kApiLib);
printf("Assembly name: %s\n", kAssembly_Name(assembly));
printf("Type count: %u\n", (k32u) kAssembly_TypeCount(assembly));
}

Use of this macro requires that the header file defining the specified assembly symbol has been included. For example, kAssemblyOf(kApiLib) requires inclusion of <kApi/kApiLib.h>

Parameters
SYMBOLAssembly symbol, such as kApiLib.
Returns
kAssembly object representing metadata about the specified assembly.
#define kAssert (   EXPRESSION)    kAssert_(EXPRESSION)

Aborts execution if EXPRESSION is kFALSE.

kAssert statements are omitted if neither K_DEBUG nor K_ASSERT is defined.

Parameters
EXPRESSIONExpression that evaluates to a kBool value.
#define kAssertType (   OBJECT,
  SYMBOL 
)    kAssertType_(OBJECT, SYMBOL)

Aborts execution if the type of the OBJECT argument is not equivalent to kTypeOf(SYMBOL).

Type is equivalence is determined using kObject_Is.

kAssertType statements are omitted if neither K_DEBUG nor K_ASSERT is defined.

Parameters
OBJECTExpression that evaluates to a kType value.
SYMBOLType symbol, such as kArrayList.
#define kBeginArrayValue (   PREFIX,
  SYMBOL,
  TYPE,
  BASE 
)    kBeginArrayValue_(PREFIX, SYMBOL, TYPE, BASE)

Starts the definition of an array-based value type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLValue symbol(e.g. kText32).
TYPEArray element type symbol(e.g. kChar).
BASEValue base symbol (typically kValue).
See also
Extending Zen, kEndArrayValue
#define kBeginAssembly (   PREFIX,
  SYMBOL,
  VERSION 
)    kBeginAssembly_(PREFIX, SYMBOL, VERSION)

Starts the definition of a type assembly.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLAssembly symbol name (e.g. kApi).
VERSIONAssembly version string (e.g. "6.0.0.0").
See also
Extending Zen, kEndAssembly
#define kBeginBitEnum (   PREFIX,
  SYMBOL,
  BASE 
)    kBeginBitEnum_(PREFIX, SYMBOL, BASE)

Starts the definition of a bit-flag enumeration value type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLValue symbol(e.g. kFileMode).
BASEValue base symbol (typically kValue).
See also
Extending Zen, kEndBitEnum
#define kBeginClass (   PREFIX,
  SYMBOL,
  BASE 
)    kBeginClass_(PREFIX, SYMBOL, BASE)

Starts the definition of a class type that does not require an expanded vtable and does not have static data.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLClass symbol(e.g. kArrayList).
BASEClass base symbol (e.g. kObject).
See also
Extending Zen, kEndClass
#define kBeginEnum (   PREFIX,
  SYMBOL,
  BASE 
)    kBeginEnum_(PREFIX, SYMBOL, BASE)

Starts the definition of an enumeration value type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLValue symbol(e.g. kStatus).
BASEValue base symbol (typically kValue).
See also
Extending Zen, kEndEnum
#define kBeginFullClass (   PREFIX,
  SYMBOL,
  BASE 
)    kBeginFullClass_(PREFIX, SYMBOL, BASE)

Starts the definition of a class type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLClass symbol(e.g. kFile).
BASEClass base symbol (e.g. kObject).
See also
Extending Zen, kEndFullClass
#define kBeginInterface (   PREFIX,
  SYMBOL,
  BASE 
)    kBeginInterface_(PREFIX, SYMBOL, BASE)

Starts the definition of an interface type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLInterface symbol(e.g. kCollection).
BASEInterface base symbol (typically kNull).
See also
Extending Zen, kEndInterface
#define kBeginStaticClass (   PREFIX,
  SYMBOL 
)    kBeginStaticClass_(PREFIX, SYMBOL)

Starts the definition of a class type that has only static data.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLClass symbol(e.g. kNetwork).
See also
Extending Zen, kEndFullClass
#define kBeginValue (   PREFIX,
  SYMBOL,
  BASE 
)    kBeginValue_(PREFIX, SYMBOL, BASE)

Starts the definition of a structure value type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLValue symbol(e.g. k32s).
BASEValue base symbol (typically kValue).
See also
Extending Zen, kEndValue
#define kBeginVirtualClass (   PREFIX,
  SYMBOL,
  BASE 
)    kBeginVirtualClass_(PREFIX, SYMBOL, BASE)

Starts the definition of a class type that requires an expanded vtable but does not have static data.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLClass symbol(e.g. kAlloc).
BASEClass base symbol (e.g. kObject).
See also
Extending Zen, kEndVirtualClass
#define kCast (   TYPE,
  ITEM 
)    kCast_(TYPE, ITEM)

Casts the ITEM argument to the specified TYPE.

Equivalent (TYPE)(ITEM).

This macro is guaranteed to evaluate its arguments only once.

Parameters
TYPEType to which the item is cast.
ITEMValue to be cast.
Returns
Result of the cast.
#define kCatch (   STATUS_POINTER)    kCatch_(STATUS_POINTER)

Closes a kTry block and opens a kCatch error-handling block.

This macro is guaranteed to evaluate its arguments only once.

Parameters
STATUS_POINTERReceives the exception code.
See also
Error Handling
#define kCatchEx (   STATUS_POINTER)    kCatchEx_(STATUS_POINTER)

Closes a kTry block and opens a kCatchEx error-handling block.

This macro is guaranteed to evaluate its arguments only once.

Parameters
STATUS_POINTERReceives the exception code.
See also
Error Handling
#define kCheck (   EXPRESSION)    kCheck_(EXPRESSION)

Executes a return statement if the given expression is not kOK.

If the expression result is not kOK, the current function will return the expression result.

This macro is guaranteed to evaluate its arguments only once.

Parameters
EXPRESSIONExpression that evaluates to a kStatus value.
See also
Error Handling
#define kCheckArgs (   EXPRESSION)    kCheckArgs_(EXPRESSION)

Executes a return statement if the given expression is not kTRUE.

If the expression result is kFALSE, the current function will return kERROR_PARAMETER.

This macro is guaranteed to evaluate its arguments only once.

Parameters
EXPRESSIONExpression that evaluates to a kBool value.
See also
Error Handling
#define kCheckState (   EXPRESSION)    kCheckState_(EXPRESSION)

Executes a return statement if the given expression is not kTRUE.

If the expression result is kFALSE, the current function will return kERROR_STATE.

This macro is guaranteed to evaluate its arguments only once.

Parameters
EXPRESSIONExpression that evaluates to a kBool value.
See also
Error Handling
#define kClamp_ (   V,
  VMIN,
  VMAX 
)    kxClamp_((V), (VMIN), (VMAX))

Returns a value limited to the specified range.

Parameters
VInput value.
VMINMinimum output value.
VMAXMaximum output value.
Returns
The input value, limited to [VMIN, VMAX].
#define kCountOf (   CARRAY)    kCountOf_(CARRAY)

Returns the number of elements in a C array.

Equivalent to sizeof(CARRAY)/sizeof(CARRAY[0]).

Parameters
CARRAYC array variable name.
Returns
Count of array elements.
#define kDeclareArrayValue (   PREFIX,
  SYMBOL,
  BASE 
)    kDeclareArrayValue_(PREFIX, SYMBOL, BASE)

Declares type information for an array-based value type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLValue symbol(e.g. kText32).
BASEValue base symbol (typically kValue).
See also
Extending Zen, kBeginArrayValue, kEndArrayValue
#define kDeclareAssembly (   PREFIX,
  SYMBOL 
)    kDeclareAssembly_(PREFIX, SYMBOL)

Declares a type assembly.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLAssembly symbol name (e.g. kApi).
See also
Extending Zen, kBeginAssembly, kEndAssembly
#define kDeclareBitEnum (   PREFIX,
  SYMBOL,
  BASE 
)    kDeclareBitEnum_(PREFIX, SYMBOL, BASE)

Declares type information for a bit-flag enumeration value type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLValue symbol(e.g. kFileMode).
BASEValue base symbol (typically kValue).
See also
Extending Zen, kBeginBitEnum, kEndBitEnum
#define kDeclareClass (   PREFIX,
  SYMBOL,
  BASE 
)    kDeclareClass_(PREFIX, SYMBOL, BASE)

Declares type information for a class type that does not require an expanded vtable and does not have static data.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLClass symbol(e.g. kArrayList).
BASEClass base symbol (e.g. kObject).
See also
Extending Zen, kBeginClass, kEndClass
#define kDeclareEnum (   PREFIX,
  SYMBOL,
  BASE 
)    kDeclareEnum_(PREFIX, SYMBOL, BASE)

Declares type information for an enumeration value type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLValue symbol(e.g. kStatus).
BASEValue base symbol (typically kValue).
See also
Extending Zen, kBeginEnum, kEndEnum
#define kDeclareFullClass (   PREFIX,
  SYMBOL,
  BASE 
)    kDeclareFullClass_(PREFIX, SYMBOL, BASE)

Declares type information for a class type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLClass symbol(e.g. kFile).
BASEClass base symbol (e.g. kObject).
See also
Extending Zen, kBeginFullClass, kEndFullClass
#define kDeclareInterface (   PREFIX,
  SYMBOL,
  BASE 
)    kDeclareInterface_(PREFIX, SYMBOL, BASE)

Declares type information for an interface type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLInterface symbol(e.g. kCollection).
BASEInterface base symbol (typically kNull).
See also
Extending Zen, kBeginInterface, kEndInterface
#define kDeclareStaticClass (   PREFIX,
  SYMBOL 
)    kDeclareStaticClass_(PREFIX, SYMBOL)

Declares type information for a class type that has only static data.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLClass symbol(e.g. kNetwork).
See also
Extending Zen, kBeginStaticClass, kEndStaticClass
#define kDeclareValue (   PREFIX,
  SYMBOL,
  BASE 
)    kDeclareValue_(PREFIX, SYMBOL, BASE)

Declares type information for a structure value type.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLValue symbol(e.g. k32s).
BASEValue base symbol (typically kValue).
See also
Extending Zen, kBeginValue, kEndValue
#define kDeclareVirtualClass (   PREFIX,
  SYMBOL,
  BASE 
)    kDeclareVirtualClass_(PREFIX, SYMBOL, BASE)

Declares type information for a class type that requires an expanded vtable but does not have static data.

Parameters
PREFIXFunction/data declaration prefix (e.g. k).
SYMBOLClass symbol(e.g. kAlloc).
BASEClass base symbol (e.g. kObject).
See also
Extending Zen, kBeginVirtualClass, kEndVirtualClass
#define kEndArrayValue ( )    kEndArrayValue_()

Ends the definition of an array-based value type.

See also
Extending Zen
#define kEndAssembly ( )    kEndAssembly_()

Ends the definition of a type assembly.

See also
Extending Zen
#define kEndBitEnum ( )    kEndBitEnum_()

Ends the definition of a bit-flag enumeration value type.

See also
Extending Zen
#define kEndCatch (   STATUS)    kEndCatch_(STATUS)

Closes a kCatch block.

If the STATUS argument is not kOK, the current function returns STATUS.

This macro is guaranteed to evaluate its arguments only once.

Parameters
STATUSResult of the kCatch block.
See also
Error Handling
#define kEndCatchEx (   STATUS)    kEndCatchEx_(STATUS)

Closes a kCatchEx block.

The exception state is set to the value of the STATUS argument. If the exception state is not kOK, the kFinallyEx block will return the exception code to the caller when kFinallyEndEx is reached.

This macro is guaranteed to evaluate its arguments only once.

Parameters
STATUSResult of the kCatchEx block.
See also
Error Handling
#define kEndClass ( )    kEndClass_()

Ends the definition of a class type that does not require an expanded vtable and does not have static data.

See also
Extending Zen
#define kEndEnum ( )    kEndEnum_()

Ends the definition of an enumeration value type.

See also
Extending Zen
#define kEndFinally ( )    kEndFinally_()

Closes a kFinally block.

If the kTry block produced an exception, the current function returns the exception code. Otherwise, execution continues after the kFinally block.

See also
Error Handling
#define kEndFinallyEx ( )    kEndFinallyEx_()

Closes a kFinallyEx block.

If the exception state passed by kEndCatchEx is not kOK, the current function returns the exception code. Otherwise, execution continues after the kFinallyEx block.

See also
Error Handling
#define kEndFullClass ( )    kEndFullClass_()

Ends the definition of a class type.

See also
Extending Zen
#define kEndInterface ( )    kEndInterface_()

Ends the definition of an interface type.

See also
Extending Zen
#define kEndStaticClass ( )    kEndStaticClass_()

Ends the definition of a class type that has only static data.

See also
Extending Zen
#define kEndValue ( )    kEndValue_()

Ends the definition of a structure value type.

See also
Extending Zen
#define kEndVirtualClass ( )    kEndVirtualClass_()

Ends the definition of a class type that requires an expanded vtable but does not have static data.

See also
Extending Zen
#define kFinally   kFinally_

Closes a kTry block and opens a kFinally block.

See also
Error Handling
#define kFinallyEx   kFinallyEx_

Opens a kFinallyEx block.

See also
Error Handling
#define kIsError (   EXPRESSION)    kIsError_(EXPRESSION)

Returns kTRUE if the given status value is not kOK.

This macro is guaranteed to evaluate its arguments only once.

Parameters
EXPRESSIONExpression that evaluates to a kStatus value.
Returns
kTRUE if the argument is not equal to kOK; kFALSE otherwise.
See also
Error Handling
#define kIsNull (   POINTER)    kIsNull_(POINTER)

Tests for equality with null pointer.

Parameters
POINTERPointer to be compared with null.
Returns
kTRUE if the argument is equal to null; kFALSE otherwise.
#define kItemAt_ (   BASE,
  INDEX,
  SIZE 
)    kAt_((BASE), (INDEX)*(SIZE))

Gets a pointer to the Nth element of an array.

Parameters
BASEArray pointer.
INDEXElement index.
SIZEElement size.
#define kItemCopy_ (   DEST,
  SRC,
  SIZE 
)    kxItemCopy_(DEST, SRC, SIZE)

Performs a small copy with minimal overhead.

Parameters
DESTDestination address.
SRCSource address.
SIZETransfer size (bytes).
#define kItemSet_ (   DEST,
  FILL,
  SIZE 
)    kxItemSet_(DEST, FILL, SIZE)

Performs a small fill with minimal overhead.

Parameters
DESTDestination address.
FILLValue to fill (byte).
SIZEFill size (bytes).
#define kItemZero_ (   DEST,
  SIZE 
)    kItemSet_(DEST, 0, SIZE)

Zero-initializes a small amount of memory with minimal overhead.

Parameters
DESTDestination address.
SIZETransfer size (bytes).
#define kMax_ (   A,
 
)    kxMax_(A, B)

Returns the maximum of two numbers.

Parameters
AFirst value.
BSecond value.
Returns
The greater of A or B.
#define kMin_ (   A,
 
)    kxMin_(A, B)

Returns the minimum of two numbers.

Parameters
AFirst value.
BSecond value.
Returns
The lesser of A or B.
#define kPoint3d_Init_ (   POINT,
  X,
  Y,
 
)    kxPoint3d_Init_(POINT, X, Y, Z)

Initializes a 3d point structure.

Parameters
POINTPointer to a 3d point structure.
Xx field value.
Yy field value.
Zz field value.
#define kPoint_Init_ (   POINT,
  X,
 
)    kxPoint_Init_(POINT, X, Y)

Initializes a point structure.

Parameters
POINTPointer to a point structure.
Xx field value.
Yy field value.
#define kRect_Init_ (   RECT,
  X,
  Y,
  W,
 
)    kxRect_Init_(RECT, X, Y, W, H)

Initializes a rectangle structure.

Parameters
RECTPointer to a rectangle structure.
Xx field value.
Yy field value.
Wwidth field value.
Hheight field value.
#define kRgb_Init_ (   RGB,
  R,
  G,
 
)    kxRgb_Init_(RGB, R, G, B)

Initializes a kRgb structure.

Parameters
RGBPointer to a kRgb structure.
Rr field value.
Gg field value.
Bb field value.
#define kRotatedRect_Init_ (   RECT,
  XC,
  YC,
  W,
  H,
 
)    kxRotatedRect_Init_(RECT, XC, YC, W, H, A)

Initializes a rotated rectangle structure.

Parameters
RECTPointer to a rotated rectangle structure.
XCxc field value.
YCyc field value.
Wwidth field value.
Hheight field value.
Aangle field value.
#define kStaticInitialized (   SYMBOL)    kStaticInitialized_(SYMBOL)

Indicates whether static initialization has completed for the specified type symbol.

Parameters
SYMBOLClass symbol, such as kArrayList.
Returns
kTRUE if initialization has completed; kFALSE otherwise.
#define kStaticOf (   SYMBOL)    kStaticOf_(SYMBOL)

Returns static data associated with the specified class symbol.

This macro is used within class implementations to access static state.

Parameters
SYMBOLClass symbol, such as kArrayList.
Returns
Pointer to static data for the specified class.
#define kSuccess (   EXPRESSION)    kSuccess_(EXPRESSION)

Returns kTRUE if the given expression value is kOK.

This macro is guaranteed to evaluate its arguments only once.

Parameters
EXPRESSIONExpression that evaluates to a kStatus value.
Returns
kTRUE if the argument is equal to kOK; kFALSE otherwise.
See also
Error Handling
#define kTest (   EXPRESSION)    kTest_(EXPRESSION)

Used within a kTry block to conditionally jump to the first error handling block (e.g.

kCatch).

If the EXPRESSION argument does not evaluate to kOK, the result of the expression is passed to an error-handling block. Otherwise, execution continues at the next statement.

This macro is guaranteed to evaluate its arguments only once.

Parameters
EXPRESSIONExpression that evaluates to a kStatus value.
See also
Error Handling
#define kTestArgs (   EXPRESSION)    kTestArgs_(EXPRESSION)

Within a kTry block, throws kERROR_PARAMETER if the expression result is kFALSE.

If the EXPRESSION argument does not evaluate to kTRUE, kERROR_PARAMETER is passed to an error-handling block. Otherwise, execution continues at the next statement.

This macro is guaranteed to evaluate its arguments only once.

Parameters
EXPRESSIONExpression that evaluates to a kBool value.
See also
Error Handling
#define kTestState (   EXPRESSION)    kTestState_(EXPRESSION)

Within a kTry block, throws kERROR_STATE if the expression result is kFALSE.

If the EXPRESSION argument does not evaluate to kTRUE, kERROR_STATE is passed to an error-handling block. Otherwise, execution continues at the next statement.

This macro is guaranteed to evaluate its arguments only once.

Parameters
EXPRESSIONExpression that evaluates to a kBool value.
See also
Error Handling
#define kThrow (   EXPRESSION)    kThrow_(EXPRESSION)

Used within a kTry block to jump to the first error handling block (e.g.

kCatch).

This macro is guaranteed to evaluate its arguments only once.

Parameters
EXPRESSIONExpression that evaluates to a kStatus value.
See also
Error Handling
#define kTrace (   TAG)    kTrace_(TAG)

Generates a trace event using the given tag (string literals only).

Type is equivalence is determined using kObject_Is.

kTrace statements are omitted if K_NO_TRACE is defined.

Parameters
TAGString literal passed to the trace handler.
#define kTry   kTry_

Opens a kTry error-checking block.

See also
Error Handling
#define kTypeOf (   SYMBOL)    kTypeOf_(SYMBOL)

Returns the kType object associated with the specified class, interface, or value symbol.

This macro is used to access type information by compile-time symbol name. E.g.

void PrintImageTypeInfo()
{
kType type = kTypeOf(kImage);
printf("Type name: %s\n", kType_Name(type));
printf("Base class: %s\n", kType_Name(kType_Base(type)));
}

Use of this macro requires that the header file defining the specified type symbol has been included. For example, kTypeOf(kArrayList) requires inclusion of <kApi/Data/kArrayList.h>.

Parameters
SYMBOLType symbol, such as kArrayList or k32s.
Returns
kType object representing metadata about the specified type.
#define kZero_ (   VALUE)    kxZero_(VALUE)

Sets all bits of a structure to zero.

Parameters
VALUEStructure instance.

Typedef Documentation

typedef kStatus(kCall* kCallbackFx)(kPointer receiver, kPointer sender, void *args)

Callback signature for a generic event handler.

Parameters
receiverReceiver context pointer.
senderSender context pointer.
argsPointer to callback argument.
Returns
Operation status.
typedef kBool(kCall* kEqualsFx)(const void *item1, const void *item2)

Callback signature to determine equality of two items.

Parameters
item1Pointer to first item.
item2Pointer to second item.
Returns
kTRUE if the arguments are equal; kFALSE otherwise.
typedef kSize(kCall* kHashFx)(const void *item)

Callback signature to determine hash code of an item.

Parameters
itemPointer to item.
Returns
Item hash code.