00001 #ifndef __HEMI__UTIL_H__
00002 #define __HEMI__UTIL_H__
00003
00004 #include "hemi.h"
00005 #include <stdarg.h>
00006
00007 #define HLINEHACK(x) #x
00008 #define HLINEHACK2(x) HLINEHACK(x)
00009
00010
00011 #define hverify(a,e,f,b,c...) _hverify(a,e,f,__FILE__,__LINE__,b,c)
00012 #define hverifyptr(a,e,f,b,c...) _hverifyptr(a,e,f,__FILE__,__LINE__,b,c)
00013 #define hvfy(a,e,f) _hverify(a,e,f,__FILE__,__LINE__,HLINEHACK2(a))
00014 #define hvfyptr(a,e,f) _hverifyptr(a,e,f,__FILE__,__LINE__,HLINEHACK2(a))
00015 int _hverify(int,int*,int,const char*,int,const char*,...);
00016 void* _hverifyptr(void*,int*,int,const char*,int,const char*,...);
00017
00018
00019 #define halloc(a,b,c,e) _halloc(a,sizeof(b),c,-1,e,__FILE__,__LINE__)
00020 #define hcalloc(a,b,c,d,e) _halloc(a,sizeof(b),c,d,e,__FILE__,__LINE__)
00021 void* _halloc(void*,int,int,int,int*,const char*,int);
00022
00023
00024 #define hfread(a,b,c,d,e) _hfread(a,sizeof(b),c,d,e,__FILE__,__LINE__)
00025 int _hfread(void*,int,int,FILE*,int*,const char*,int);
00026
00027 #define hskip(a,e) _hskip(a,1," \n\r\t",e,__FILE__,__LINE__)
00028 #define hskipn(a,b,e) _hskip(a,b," \n\r\t",e,__FILE__,__LINE__)
00029 #define hskipln(a,e) _hskip(a,1,"\n",e,__FILE__,__LINE__)
00030 char* _hskip(char*,int,const char*,int*,const char*,int);
00031
00032 #define hskipto(a,b,e) _hskipto(a,b,e,__FILE__,__LINE__)
00033 char* _hskipto(char*,char*,int*,const char*,int);
00034
00035 #define hfskip(a,e) _hfskip(a,1," \n\r\t",e,__FILE__,__LINE__)
00036 #define hfskipn(a,b,e) _hfskip(a,b," \n\r\t",e,__FILE__,__LINE__)
00037 #define hfskipln(a,e) _hfskip(a,1,"\n",e,__FILE__,__LINE__)
00038 int _hfskip(FILE*,int,const char*,int*,const char*,int);
00039
00040 #define hfskipto(a,b,e) _hfskipto(a,b,e,__FILE__,__LINE__)
00041 int _hfskipto(FILE*,char*,int*,const char*,int);
00042
00043
00044 #define hallocstrcpy(a,e) _hallocstrcpy(a,e,__FILE__,__LINE__)
00045 char* _hallocstrcpy(char*,int*,const char*,int);
00046
00047 #define hallocfread(a,b,c,d,e) _hallocfread((void**)a,sizeof(b),c,d,e,__FILE__,__LINE__)
00048 int _hallocfread(void**,int,int,FILE*,int*,const char*,int);
00049
00050 #endif