Do more. Code less. Free software for GPU computing.
<scroll to top>

defines.h

Go to the documentation of this file.
00001 #pragma once
00002 
00003 typedef enum {
00004     AF_SUCCESS=0,    
00005     AF_ERR_INTERNAL, 
00006     AF_ERR_NOMEM,    
00007     AF_ERR_BATCH,    
00008     AF_ERR_ARG,      
00009     AF_ERR_NOTSUP,   
00010     AF_ERR_DRIVER,   
00011     AF_ERR_RUNTIME,  
00012     AF_ERR_EXTERN,   
00013     AF_ERR_LICENSE,  
00014     AF_ERR_SYSTEM,   
00015 } afError;
00016 
00017 
00018 typedef enum {
00019     // note: order important
00020     afUNKNOWN_CLASS = 0,
00021     afCELL_CLASS,
00022     afSTRUCT_CLASS,
00023     afLOGICAL_CLASS,
00024     afCHAR_CLASS,
00025     afVOID_CLASS,
00026     afDOUBLE_CLASS,
00027     afSINGLE_CLASS,
00028     afINT8_CLASS,
00029     afUINT8_CLASS,
00030     afINT16_CLASS,
00031     afUINT16_CLASS,
00032     afINT32_CLASS,
00033     afUINT32_CLASS,
00034     afINT64_CLASS,
00035     afUINT64_CLASS,
00036     afFUNCTION_CLASS,
00037     afOPAQUE_CLASS,
00038     afOBJECT_CLASS,
00039 #if defined(ARCH_64)
00040     afINDEX_CLASS = afUINT64_CLASS,
00041 #else
00042     afINDEX_CLASS = afUINT32_CLASS
00043 #endif
00044 } af_class_id;
00045 
00046 #if defined(_WIN32) || defined(_MSC_VER)
00047   // http://msdn.microsoft.com/en-us/library/b0084kay(v=VS.80).aspx
00048   // http://msdn.microsoft.com/en-us/library/3y1sfaz2%28v=VS.80%29.aspx
00049   #ifdef AFDLL // libaf
00050     #define AFAPI  __declspec(dllexport)
00051   #else
00052     #define AFAPI  __declspec(dllimport)
00053   #endif
00054   #ifdef AFXDLL // libafGFX
00055     #define AFXAPI  __declspec(dllexport)
00056   #else
00057     #define AFXAPI  __declspec(dllimport)
00058   #endif
00059   // bool
00060   #ifndef __cplusplus
00061     #define bool unsigned char
00062     #define false 0
00063     #define true  1
00064   #endif
00065   #define __PRETTY_FUNCTION__ __FUNCSIG__
00066 #else
00067   #define AFAPI   __attribute__((visibility("default")))
00068   #define AFXAPI  __attribute__((visibility("default")))
00069   #include <stdbool.h>
00070 #endif
00071 
00072 #include <stdlib.h>
00073 
00075 AFAPI afError af_errno(void);
00076 
00081 AFAPI const char *af_errstr(void);
00082 
00087 AFAPI afError af_malloc(void **ptr, size_t bytes);
00092 AFAPI afError af_free(void *ptr);
00093 
00095 typedef afError (*af_alloc_fn)(void **, size_t bytes);
00096 typedef afError (*af_free_fn)(void *);
00097 typedef afError (*af_garbage_fn)(size_t bytes);
00098 
00112 AFAPI afError af_init(af_alloc_fn alloc, af_free_fn free, af_garbage_fn garbage);
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines