00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __ALICEML_STDINC_H__
00028 #define __ALICEML_STDINC_H__
00029
00030 #include "aliceml.h"
00031
00032 #if HAVE_STDLIB_H
00033 #include <stdlib.h>
00034 #endif
00035
00036 #if HAVE_STDIO_H
00037 #include <stdio.h>
00038 #endif
00039
00040 #if HAVE_STDARG_H
00041 #include <stdarg.h>
00042 #endif
00043
00044 #if HAVE_STRING_H
00045 #include <string.h>
00046 #endif
00047
00048 #if HAVE_MALLOC_H
00049 #include <malloc.h>
00050 #endif
00051
00052 #if HAVE_MEMORY_H
00053 #include <memory.h>
00054 #endif
00055
00056 #if HAVE_ASSERT_H
00057 #include <assert.h>
00058 #endif
00059
00060 #ifdef __cplusplus
00061 extern "C" {
00062 #endif
00063
00065 static const int ML_TRUE_VAR = 1;
00066
00083 #ifndef ML_CHECKUPM
00084 #define ML_CHECKUPM(exp, result, message) ¥
00085 do { ¥
00086 assert(exp); ¥
00087 if (!(exp)) { ¥
00088 ML_SetError("Failed '%s'.", (message)); ¥
00089 return (result); ¥
00090 } ¥
00091 } while(!ML_TRUE_VAR)
00092 #endif
00093
00094 #ifndef ML_CHECKUPVM
00095 #define ML_CHECKUPVM(exp, message) ¥
00096 do { ¥
00097 assert(exp); ¥
00098 if (!(exp)) { ¥
00099 ML_SetError("Failed '%s'.", (message)); ¥
00100 return; ¥
00101 } ¥
00102 } while(!ML_TRUE_VAR)
00103 #endif
00104
00105 #ifndef ML_CHECKUP
00106 #define ML_CHECKUP(exp, result) ¥
00107 ML_CHECKUPM((exp), (result), (#exp))
00108 #endif
00109
00110 #ifndef ML_CHECKUPV
00111 #define ML_CHECKUPV(exp) ¥
00112 ML_CHECKUPVM((exp), (#exp))
00113 #endif
00114
00115
00116 #if 0
00117
00118 extern int ALICEMLCALL ML_TRACE(const char *format, ...);
00120 extern int ALICEMLCALL ML_TRACE_CREATE(const char *type, void *ptr);
00122 extern int ALICEMLCALL ML_TRACE_DESTROY(const char *type, void *ptr);
00123 #else
00124 static ALICEMLINLINE int ALICEMLCALL
00125 ML_TRACE(const char *format, ...) {
00126 (void)format; return 0;
00127 }
00128 static ALICEMLINLINE int ALICEMLCALL
00129 ML_TRACE_CREATE(const char *type, void *ptr) {
00130 (void)type; (void)ptr; return 0;
00131 }
00132 static ALICEMLINLINE int ALICEMLCALL
00133 ML_TRACE_DESTROY(const char *type, void *ptr) {
00134 (void)type; (void)ptr; return 0;
00135 }
00136 #endif
00137
00138 #ifdef __cplusplus
00139 }
00140 #endif
00141
00142 #endif