[5] | 1 | #include "framsg.h" |
---|
[82] | 2 | #include "nonstd_stdio.h" |
---|
[5] | 3 | |
---|
[82] | 4 | #ifdef SHP |
---|
| 5 | #include <FBaseSys.h> //AppLog |
---|
| 6 | #endif |
---|
| 7 | |
---|
| 8 | #ifdef MOBILE2D |
---|
| 9 | #include <Winbase.h> |
---|
| 10 | #include "Util.h" |
---|
| 11 | #endif |
---|
| 12 | |
---|
| 13 | static const char *warn="[warn] "; |
---|
| 14 | static const char *err="[ERROR] "; |
---|
| 15 | |
---|
| 16 | /* TODO integracja z error managerem |
---|
| 17 | void FramMessage(const char *o,const char *m,const char *bl,int w) |
---|
| 18 | { |
---|
| 19 | const char *lvl=""; |
---|
| 20 | if (w==1) lvl=warn; else if (w>1) lvl=err; |
---|
| 21 | #ifdef SHP |
---|
| 22 | //jesli chcemy zeby nawet w trybie release wysylal komunikaty: |
---|
| 23 | //#define AppLog(...) __App_info(__PRETTY_FUNCTION__ , __LINE__, __VA_ARGS__) |
---|
| 24 | AppLog("%s%s::%s - %s\n",lvl,o,m,bl); |
---|
| 25 | #elif defined MOBILE2D |
---|
| 26 | char buf[1000]; |
---|
| 27 | sprintf(buf,"%s%s::%s - %s\n",lvl,o,m,bl); |
---|
| 28 | OutputDebugString(Util::strTOwstr(buf).c_str()); |
---|
| 29 | #else |
---|
| 30 | fprintf(w>0?stderr:stdout,"%s%s::%s - %s\n",lvl,o,m,bl); |
---|
| 31 | #endif |
---|
| 32 | } |
---|
| 33 | */ |
---|
| 34 | |
---|
[5] | 35 | void FMprintf(const char *o,const char *m,int w,const char *bl, ...) |
---|
| 36 | { |
---|
| 37 | char buf[10000]; |
---|
| 38 | va_list argptr; |
---|
| 39 | va_start(argptr,bl); |
---|
[82] | 40 | vsnprintf(buf,10000,bl,argptr); |
---|
| 41 | va_end(argptr); |
---|
[5] | 42 | FramMessage(o,m,buf,w); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | void FMprintf(const char *o,const char *m,int w,const char *bl,va_list va) |
---|
| 46 | { |
---|
| 47 | char buf[10000]; |
---|
| 48 | vsnprintf(buf,10000,bl,va); |
---|
| 49 | FramMessage(o,m,buf,w); |
---|
| 50 | } |
---|
[82] | 51 | |
---|
| 52 | void FMprintf(const char *bl,...) |
---|
| 53 | { |
---|
| 54 | va_list argptr; |
---|
| 55 | va_start(argptr,bl); |
---|
| 56 | FMprintf("Message","printf",0,bl,argptr); |
---|
| 57 | va_end(argptr); |
---|
| 58 | } |
---|