github.com/256dpi/max-go@v0.7.0/lib/max/max_types.h (about)

     1  #ifndef _MAX_TYPES_H_
     2  #define _MAX_TYPES_H_
     3  
     4  #include "ext_infer_system.h"
     5  
     6  #include <stdint.h>
     7  
     8  typedef unsigned int t_uint; 			///< an unsigned int as defined by the architecture / platform  @ingroup misc
     9  typedef int8_t t_int8; 					///< a 1-byte int  @ingroup misc
    10  typedef uint8_t t_uint8;		    	///< an unsigned 1-byte int  @ingroup misc
    11  typedef int16_t t_int16; 				///< a 2-byte int  @ingroup misc
    12  typedef uint16_t t_uint16; 		        ///< an unsigned 2-byte int  @ingroup misc
    13  typedef int32_t t_int32; 				///< a 4-byte int  @ingroup misc
    14  typedef uint32_t t_uint32; 			    ///< an unsigned 4-byte int  @ingroup misc
    15  typedef int64_t t_int64;				///< an 8-byte int  @ingroup misc
    16  typedef uint64_t t_uint64;	            ///< an unsigned 8-byte int  @ingroup misc
    17  typedef t_uint32 t_fourcc; 				///< an integer of suitable size to hold a four char code / identifier  @ingroup misc
    18  
    19  
    20  typedef uintptr_t t_ptr_uint;	///< an unsigned pointer-sized int  @ingroup misc
    21  typedef  intptr_t t_ptr_int; 			///< a pointer-sized int  @ingroup misc
    22  
    23  #ifdef C74_X64
    24  typedef double t_atom_float;			///< the type that is an A_FLOAT in a #t_atom  @ingroup misc
    25  typedef t_ptr_uint t_getbytes_size;		///< like size_t but for getbytes()  @ingroup misc
    26  #define ATOM_LONG_FMT_MODIFIER "ll"
    27  #define ATOM_FLOAT_FMT_MODIFIER "l"		// for scanf "%lf" will read into a double 
    28  
    29  #ifdef WIN_VERSION
    30  #define INT32_FMT_MODIFIER ""
    31  #define INT64_FMT_MODIFIER "ll"
    32  #endif
    33  
    34  #if defined(MAC_VERSION) || defined(LINUX_VERSION)
    35  #define INT32_FMT_MODIFIER ""
    36  #define INT64_FMT_MODIFIER "l"
    37  #endif
    38  
    39  #else
    40  typedef float t_atom_float; 			///< the type that is an A_FLOAT in a #t_atom  @ingroup misc
    41  typedef short t_getbytes_size; 			///< like size_t but for getbytes()  @ingroup misc
    42  #define ATOM_LONG_FMT_MODIFIER "l"
    43  #define ATOM_FLOAT_FMT_MODIFIER ""		// for scanf we just want "%f" for scanf to read a float 
    44  #define INT32_FMT_MODIFIER ""
    45  #define INT64_FMT_MODIFIER "ll"
    46  #endif
    47  
    48  #define C74_INT16_MAX		INT16_MAX
    49  #define C74_INT32_MAX		INT32_MAX
    50  #define C74_INT64_MAX		INT64_MAX
    51  #define C74_INT16_MIN		INT16_MIN
    52  #define C74_INT32_MIN		INT32_MIN
    53  #define C74_INT64_MIN		INT64_MIN
    54  #define C74_UINT16_MAX		UINT16_MAX
    55  #define C74_UINT32_MAX		UINT32_MAX
    56  #define C74_UINT64_MAX		UINT64_MAX
    57  
    58  #define C74_PTR_INT_MIN		INTPTR_MIN
    59  #define C74_PTR_INT_MAX		INTPTR_MAX
    60  #define C74_PTR_UINT_MAX	UINTPTR_MAX
    61  
    62  #define C74_ATOM_LONG_MIN	C74_PTR_INT_MIN
    63  #define C74_ATOM_LONG_MAX	C74_PTR_INT_MAX
    64  
    65  #if defined(MAC_VERSION) || defined(LINUX_VERSION)
    66  #define C74_LONG_INT_MIN	C74_PTR_INT_MIN
    67  #define C74_LONG_INT_MAX	C74_PTR_INT_MAX
    68  #define C74_ULONG_INT_MAX	C74_PTR_UINT_MAX
    69  #else
    70  #define C74_LONG_INT_MIN	C74_INT32_MIN
    71  #define C74_LONG_INT_MAX	C74_INT32_MAX
    72  #define C74_ULONG_INT_MAX	C74_UINT32_MAX
    73  #endif
    74  
    75  typedef t_ptr_int t_int;			///< an integer  @ingroup misc
    76  typedef t_ptr_uint t_ptr_size;		///< unsigned pointer-sized value for counting (like size_t)  @ingroup misc
    77  typedef t_ptr_int t_atom_long;		///< the type that is an A_LONG in a #t_atom  @ingroup misc
    78  typedef t_atom_long t_max_err;		///< an integer value suitable to be returned as an error code  @ingroup misc
    79  
    80  typedef char **t_handle;			///< a handle (address of a pointer)  @ingroup misc
    81  typedef char *t_ptr;				///< a pointer  @ingroup misc
    82  
    83  typedef t_uint8 t_bool; 			///< a true/false variable  @ingroup misc
    84  typedef t_int16 t_filepath;			///< i.e. path/vol in file APIs identifying a folder  @ingroup misc
    85  
    86  #ifdef WIN_VERSION
    87  typedef t_int16 t_refnum;
    88  
    89  #ifndef __cplusplus 
    90  #define bool int
    91  #define false (0)
    92  #define true (1)
    93  #endif
    94  
    95  #endif
    96  
    97  #ifdef MAC_VERSION
    98  // typedef FSIORefNum t_refnum;		// don't want to require Carbon include for build
    99  #ifdef C74_X64
   100  typedef int t_refnum;    // for x64 an FSIORefNum is an int
   101  #else
   102  typedef short t_refnum; 
   103  #endif
   104  #endif // #ifdef MAC_VERSION
   105  
   106  #ifdef LINUX_VERSION
   107  typedef int t_refnum;
   108  #endif
   109  
   110  
   111  #ifndef bool
   112  #include <stdbool.h>
   113  #endif
   114  
   115  /** Standard values returned by function calls with a return type of #t_max_err
   116  	@ingroup misc */
   117  typedef enum {
   118  	MAX_ERR_NONE =			0,	///< No error
   119  	MAX_ERR_GENERIC =		-1,	///< Generic error
   120  	MAX_ERR_INVALID_PTR =	-2,	///< Invalid Pointer
   121  	MAX_ERR_DUPLICATE =		-3,	///< Duplicate
   122  	MAX_ERR_OUT_OF_MEM =	-4	///< Out of memory
   123  } e_max_errorcodes;
   124  
   125  #endif // #ifdef _MAX_TYPES_H_