Changeset 372 for cpp/common
- Timestamp:
- 04/22/15 04:14:59 (10 years ago)
- Location:
- cpp/common
- Files:
-
- 3 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/hmessage.cpp
r371 r372 3 3 // See LICENSE.txt for details. 4 4 5 #include " framsg.h"5 #include "hmessage.h" 6 6 #include <common/nonstd_stdio.h> 7 7 #include "stl-util.h" 8 8 #include "Convert.h" 9 9 10 const char* MSG_LEVEL[]={"[DEBUG] ","","[WARN] ","[ERROR] ","[CRITICAL] "};10 const char* HMSG_LEVEL[]={"[DEBUG] ","","[WARN] ","[ERROR] ","[CRITICAL] "}; 11 11 12 void FramMessage(const char *o, const char *m, const char *txt, int w)12 void Hmessage(const char *o, const char *m, const char *txt, int w) 13 13 { 14 14 int line = 0; //all lines except the first one get the "..." prefix … … 24 24 { 25 25 if (*nextsep == 0) //there was only one line! no need to modify it in any way. 26 _ FramMessageSingleLine(o, m, txt, w);26 _HmessageSingleLine(o, m, txt, w); 27 27 else //first line from multi-line 28 _ FramMessageSingleLine(o, m, string(txt, nextsep - txt).c_str(), w);28 _HmessageSingleLine(o, m, string(txt, nextsep - txt).c_str(), w); 29 29 } 30 30 else //consecutive lines from multi-line 31 _ FramMessageSingleLine(o, m, (FRAMSG_MULTILINE_CONTINUATION + string(txt, nextsep - txt)).c_str(), w); //could also add line numbers like ...(3)... but let's keep the prefix short and simple31 _HmessageSingleLine(o, m, (HMSG_MULTILINE_CONTINUATION + string(txt, nextsep - txt)).c_str(), w); //could also add line numbers like ...(3)... but let's keep the prefix short and simple 32 32 line++; 33 33 if ((nextsep[0] == '\r') && (nextsep[1] == '\n')) … … 39 39 40 40 41 void FMprintf_va(const char *o,const char *m,int w,const char *bl,va_list va)41 void Hprintf_va(const char *o,const char *m,int w,const char *bl,va_list va) 42 42 { 43 43 string buf=ssprintf_va(bl,va); 44 FramMessage(o,m,buf.c_str(),w);44 Hmessage(o,m,buf.c_str(),w); 45 45 } 46 46 47 void FMprintf(const char *o,const char *m,int w,const char *bl, ...)47 void Hprintf(const char *o,const char *m,int w,const char *bl, ...) 48 48 { 49 49 va_list argptr; 50 50 va_start(argptr,bl); 51 FMprintf_va(o,m,w,bl,argptr);51 Hprintf_va(o,m,w,bl,argptr); 52 52 va_end(argptr); 53 53 } 54 54 55 void print FM(const char *bl,...)55 void printH(const char *bl,...) 56 56 { 57 57 va_list argptr; 58 58 va_start(argptr,bl); 59 FMprintf_va("Message","printf",FMLV_INFO,bl,argptr);59 Hprintf_va("Message","printf",HMLV_INFO,bl,argptr); 60 60 va_end(argptr); 61 61 } -
cpp/common/hmessage.h
r371 r372 3 3 // See LICENSE.txt for details. 4 4 5 #ifndef _ FRAMSG_H_6 #define _ FRAMSG_H_5 #ifndef _HMESSAGE_H_ 6 #define _HMESSAGE_H_ 7 7 8 8 #include <stdarg.h> 9 9 10 extern const char* MSG_LEVEL[];11 #define FRAMSG_FORMAT "%s%s.%s: %s"12 #define FRAMSG_MULTILINE_CONTINUATION "..."10 extern const char* HMSG_LEVEL[]; 11 #define HMSG_FORMAT "%s%s.%s: %s" 12 #define HMSG_MULTILINE_CONTINUATION "..." 13 13 14 void FMprintf(const char *o,const char *m,int w,const char *bl, ...);15 void FMprintf_va(const char *o,const char *m,int w,const char *bl,va_list va); //a different name than FMprintf - otherwise the compiler could confuse the "string" parameter with va_list and could call the wrong function16 void print FM(const char *bl,...); //a shorthand for printf (a different name again to avoid the risk of confusion with the two functions above. This would be unlikely but possible when the argument types would match)17 void FramMessage(const char *o,const char *m,const char *txt,int w);14 void Hprintf(const char *o,const char *m,int w,const char *bl, ...); 15 void Hprintf_va(const char *o,const char *m,int w,const char *bl,va_list va); //a different name than Hprintf - otherwise the compiler could confuse the "string" parameter with va_list and could call the wrong function 16 void printH(const char *bl,...); //a shorthand for printf (a different name again to avoid the risk of confusion with the two functions above. This would be unlikely but possible when the argument types would match) 17 void Hmessage(const char *o,const char *m,const char *txt,int w); 18 18 19 void _ FramMessageSingleLine(const char *o,const char *m,const char *txt,int w); //don't call this directly - it is used internally19 void _HmessageSingleLine(const char *o,const char *m,const char *txt,int w); //don't call this directly - it is used internally 20 20 21 #define FMLV_DEBUG -122 #define FMLV_INFO 023 #define FMLV_WARN 124 #define FMLV_ERROR 225 #define FMLV_CRITICAL 321 #define HMLV_DEBUG -1 22 #define HMLV_INFO 0 23 #define HMLV_WARN 1 24 #define HMLV_ERROR 2 25 #define HMLV_CRITICAL 3 26 26 27 27 /* -
cpp/common/nonstd_math.cpp
r286 r372 81 81 // But it was resolved by restarting windows and cleaning all intermediate compilation files :o (restarting windows was the key element! restarting BC++Builder and deleting files would not help) 82 82 83 #include " framsg.h"83 #include "hmessage.h" 84 84 85 85 unsigned int fp_control_word_std; … … 89 89 { 90 90 //unsigned int was=_clear87(); 91 // FMprintf("","fpExceptInit",FMLV_INFO,"control87 status before clear was %08x", was);91 //Hprintf("","fpExceptInit",HMLV_INFO,"control87 status before clear was %08x", was); 92 92 fp_control_word_std=_control87(0, 0); //4978 = 1001101110010 93 93 // Make the new fp env same as the old one, except for the changes we're going to make … … 98 98 { 99 99 unsigned int was=_clear87(); //trzeba czyscic zeby nie bylo exception... 100 // FMprintf("","fpExceptEnable ",FMLV_INFO,"control87 status before clear was %08x", was);100 //Hprintf("","fpExceptEnable ",HMLV_INFO,"control87 status before clear was %08x", was); 101 101 _control87(fp_control_word_std, 0xffffffff); 102 // FMprintf("","fpExceptEnable ",FMLV_INFO,"control87 flags are %08x", _control87(0, 0)); //kontrola co sie ustawilo102 //Hprintf("","fpExceptEnable ",HMLV_INFO,"control87 flags are %08x", _control87(0, 0)); //kontrola co sie ustawilo 103 103 } 104 104 … … 106 106 { 107 107 unsigned int was=_clear87(); //trzeba czyscic zeby nie bylo exception... 108 // FMprintf("","fpExceptDisable",FMLV_INFO,"control87 status before clear was %08x", was);108 //Hprintf("","fpExceptDisable",HMLV_INFO,"control87 status before clear was %08x", was); 109 109 _control87(fp_control_word_muted, 0xffffffff); 110 // FMprintf("","fpExceptDisable",FMLV_INFO,"control87 flags are %08x", _control87(0, 0)); //kontrola co sie ustawilo110 //Hprintf("","fpExceptDisable",HMLV_INFO,"control87 flags are %08x", _control87(0, 0)); //kontrola co sie ustawilo 111 111 } 112 112 -
cpp/common/nonstd_stdio.cpp
r297 r372 241 241 242 242 #ifdef __ANDROID__ 243 #include " framsg.h"243 #include "hmessage.h" 244 244 #include "nonstd.h" 245 245 #include "nonstd_stl.h" … … 247 247 { 248 248 string respath=getAppResourcesDir(); 249 //print FM("Opening '%s', mode='%s'",path,mode);250 //print FM("getAppResourcesDir()='%s'",respath.c_str());249 //printH("Opening '%s', mode='%s'",path,mode); 250 //printH("getAppResourcesDir()='%s'",respath.c_str()); 251 251 NvFile *rfile=NULL; //can only read 252 252 FILE *rwfile=NULL; … … 255 255 path+=respath.length(); //strip the prefix, we need a relative path in assets 256 256 if (strstr(mode,"w")) 257 print FM("Warning: attempt to open a read-only resource '%s' in writable mode '%s'",path,mode);257 printH("Warning: attempt to open a read-only resource '%s' in writable mode '%s'",path,mode); 258 258 rfile=NvFOpen(path); //"mode" not supported! can only read 259 //print FM("Opened RES file as %p",rfile);259 //printH("Opened RES file as %p",rfile); 260 260 if (rfile==NULL) return NULL; 261 261 } else //a "normal" access (HOME) 262 262 { 263 263 rwfile=fopen(path,mode); 264 //print FM("Opened HOME file as %p",rwfile);264 //printH("Opened HOME file as %p",rwfile); 265 265 if (rwfile==NULL) return NULL; 266 266 } -
cpp/common/stl-util.cpp
r319 r372 9 9 #include "Convert.h" 10 10 #include "nonstd.h" 11 #include " framsg.h"11 #include "hmessage.h" 12 12 #include <assert.h> 13 13 #ifdef USE_VIRTFILE … … 107 107 } 108 108 if (warn_on_missing_file && !ok) 109 FMprintf("stl-util", "readCompleteFile", FMLV_WARN, "Couldn't open file '%s'", filename);109 Hprintf("stl-util", "readCompleteFile", HMLV_WARN, "Couldn't open file '%s'", filename); 110 110 return ok; 111 111 } … … 137 137 } 138 138 if (warn_on_fail && !ok) 139 FMprintf("stl-util", "writeCompleteFile", FMLV_WARN, "couldn't write file '%s'", filename);139 Hprintf("stl-util", "writeCompleteFile", HMLV_WARN, "couldn't write file '%s'", filename); 140 140 return ok; 141 141 }
Note: See TracChangeset
for help on using the changeset viewer.