ML Reference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00004 00009 //---------------------------------------------------------------------------------- 00010 #ifndef __mlUtilsSystemC_H 00011 #define __mlUtilsSystemC_H 00012 00013 #ifdef MLUTILS_EXPORTS 00014 00015 #define ML_UTILS_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE 00016 #else 00017 00018 #define ML_UTILS_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE 00019 #endif 00020 00021 // Include global compiler switches for the ML. 00022 #ifndef __mlConfig_H 00023 #include "mlConfig.h" 00024 #endif 00025 00026 #ifndef __mlTypeDefs_H 00027 #include "mlTypeDefs.h" 00028 #endif 00029 00030 #include "mlSystemWarningsDisable.h" 00031 00032 // We always need stdlib.h for e.g., size_t. 00033 #include <stdlib.h> 00034 00035 // We always need stdio.h for e.g., FILE in mlFileSystem. 00036 #include <stdio.h> 00037 00038 #include "mlSystemWarningsRestore.h" 00039 00040 #ifdef __cplusplus 00041 extern "C" { 00042 #endif 00043 00044 //-------------------------------------------------------------------------------------------- 00045 // 00047 00048 // 00049 //-------------------------------------------------------------------------------------------- 00050 00056 extern ML_UTILS_EXPORT int MLAlwaysTrue; 00057 00063 extern ML_UTILS_EXPORT int MLAlwaysFalse; 00064 00070 ML_UTILS_EXPORT int MLAlwaysExecuted(); 00072 00073 //---------------------------------------------------------------------------------- 00075 //---------------------------------------------------------------------------------- 00076 00077 // Make the _snprintf function of Microsoft available as snprintf to resolve 00078 // platform independencies between Unix and Microsoft since Unix supplies 00079 // snprintf. 00080 #ifdef WIN32 00081 00082 // WIN32 case: 00084 #define strcasecmp(a,b) _stricmp((a),(b)) 00085 00087 #define strncasecmp(a,b,c) _strnicmp((a),(b),(c)) 00088 00091 #define strtold(a,b) strtod((a),(b)) 00092 00093 // Provide standard snprintf version, which is only available with underscore on WIN32. 00094 #define snprintf _snprintf 00095 00096 // WIN32 versions also supplying platform independent usage of %I64L format strings. 00097 #define MLsnprintf _snprintf 00098 #define MLsscanf sscanf 00099 00100 #else 00101 00102 // NON WIN32 case: 00103 00105 ML_UTILS_EXPORT char* strlwr(char* a); 00106 00107 // On Unix we cannot use I64L format specifications for snprintf and sscanf. 00108 // So we use a reimplemented version as described in _MLsnprintf and _MLsscanf. 00109 #define MLsnprintf _MLsnprintf 00110 #define MLsscanf _MLsscanf 00111 00117 // The attribute checks printf syntax, the format parameters (third parameter) and passed parameters starting with 4th one. 00118 ML_UTILS_EXPORT int _MLsnprintf(char*s, size_t maxChars, const char* format, ...) __attribute__((format(printf,3,4))); 00119 00125 // The attribute checks scanf syntax, the format parameters (second parameter) and passed parameters starting with 3rd one. 00126 ML_UTILS_EXPORT int _MLsscanf(const char*s, const char* format, ...) __attribute__((format(scanf,2,3))) ML_RETURN_VALUE_SHOULD_BE_USED; 00127 00128 #endif 00129 00138 ML_UTILS_EXPORT MLint64 MLint64Scan(const char* source, char** endPtr) ML_RETURN_VALUE_SHOULD_BE_USED; 00139 00148 ML_UTILS_EXPORT MLuint64 MLuint64Scan(const char* source, char** endPtr) ML_RETURN_VALUE_SHOULD_BE_USED; 00150 00151 #ifdef __cplusplus 00152 } 00153 #endif 00154 00155 #endif // __mlUtilsSystemC_H 00156