Indigresso Wiki

Open Source Stuff for DASH7

User Tools

Site Tools


opentag:otlib:ot_types_h

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

opentag:otlib:ot_types_h [2012/03/26 21:14] (current)
jpnorair created
Line 1: Line 1:
 +====== OT_types.h (OTlib) ======
 +OT_types.h contains the primary data types used by [[opentag:​main|OpenTag]]. ​ Most data types begin with "​ot_"​ in order to prevent namespace collision with other data types.
 +
 +===== OTlib/​OT_types.h =====
 +Rather than making a section for each data type, the business-end of the OT_types.h file is presented here.  Any C developer should be able to figure it out.  One note are the Twobytes and Fourbytes unions, which should be used with the offset constants defined in [[opentag:​otlib:​ot_config_h|OT_config.h]] ​ You may also refer to the [[opentag:​doxygen|doxygen code documentation]].
 +<​code>​
 +/** @typedef ot_bool
 +  * Boolean, takes True or False
 +  */
 +typedef enum { False = 0, True = !False } ot_bool;
 +    ​
 +/** @typedef ot_s8
 +  * equivalent to @c signed @c char
 +  */
 +typedef signed char         ​ot_s8;​
 +    ​
 +/** @typedef ot_u8
 +  * equivalent to @c unsigned @c char
 +  */
 +typedef unsigned char       ​ot_u8;​
 +    ​
 +/** @typedef ot_int
 +  * Generic integer: typically equivalent to @c signed @c short but may need to 
 +  * be re-evaluated if OpenTag is ported to an 8bit platform
 +  */
 +typedef signed short        ot_int;
 +typedef signed short        ot_s16;
 +    ​
 +/** @typedef ot_uint
 +  * Generic unsigned integer: typically equivalent to @c unsigned @c short but 
 +  * may need to be re-evaluated if OpenTag is ported to an 8bit platform
 +  */
 +typedef unsigned short      ot_uint;
 +typedef unsigned short      ot_u16;
 +    ​
 +/** @typedef ot_long
 +  * equivalent to @c signed @c long.  A word in OpenTag is ALWAYS 32 bits.
 +  */
 +typedef signed long         ​ot_long;​
 +typedef signed long         ​ot_s32;​
 +    ​
 +    ​
 +/** @typedef ot_ulong
 +  * equivalent to @c unsigned @c long.  A word in OpenTag is ALWAYS 32 bits.
 +  */
 +typedef unsigned long       ​ot_ulong;​
 +typedef unsigned long       ​ot_u32;​
 +    ​
 +        ​
 +/** @typedef Twobytes
 +  * A union of one uintg and two ubyte. ​ Useful for datastream parsing.
 +  */
 +typedef union {
 +    ot_u16 ushort;
 +    ot_s16 sshort;
 +    ot_u8  ubyte[2];
 +    ot_s8  sbyte[2];
 +} Twobytes;
 +
 +/** @typedef Fourbytes
 +  * A union of one uword, two uintg, and four ubyte. ​ Useful for datastream parsing.
 +  */
 +typedef union {
 +    ot_u32 ulong;
 +    ot_s32 slong;
 +    ot_u16 ushort[2];
 +    ot_s16 sshort;
 +    ot_u8  ubyte[4];
 +    ot_s8  sbyte[4];
 +} Fourbytes;
 +
 +
 +/** @typedef ot_sub
 +  * Pure subroutine pointer that can be used nicely in manual jump tables
 +  * looks like: void subroutine(void)
 +  */
 +typedef void (*ot_sub)(void);​
 +
 +
 +/** @typedef ot_sig
 +  * One-argument signal callback (classic POSIX)
 +  * looks like: void callback(ot_int)
 +  */
 +typedef void (*ot_sig)(ot_int);​
 +
 +
 +/** @typedef ot_sig2
 +  * Two-argument signal callback
 +  * looks like: void callback(ot_int,​ ot_int)
 +  */
 +typedef void (*ot_sig2)(ot_int,​ ot_int);
 +
 +
 +/** @typedef ot_sigv
 +  * void-pointer-argument signal callback (endless possibilities)
 +  * looks like: void callback(void*)
 +  */
 +typedef void (*ot_sigv)(void*);​
 +</​code>​
  
opentag/otlib/ot_types_h.txt ยท Last modified: 2012/03/26 21:14 by jpnorair