Changeset 372
- Timestamp:
- 04/22/15 04:14:59 (10 years ago)
- Location:
- cpp
- Files:
-
- 4 deleted
- 39 edited
- 5 copied
- 3 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 } -
cpp/frams/Makefile-SDK-files
r365 r372 2 2 3 3 # ALL_DIRS is later expanded by the shell, no spaces/newlines allowed, or it breaks 4 ALL_DIRS={common,frams,frams/canvas,frams/config,frams/ errmgr,frams/genetics,frams/genetics/f0,frams/genetics/f1,frams/genetics/f2,frams/genetics/f3,frams/genetics/f4,frams/genetics/f5,frams/genetics/f6,frams/genetics/f7,frams/genetics/f8,frams/genetics/f9,frams/genetics/fF,frams/genetics/fT,frams/model,frams/neuro,frams/neuro/impl,frams/param,frams/test,frams/util,frams/vm/classes,frams/virtfile,frams/_demos,frams/model/geometry,frams/_demos/geometry,frams/model/similarity,frams/model/similarity/SVD}4 ALL_DIRS={common,frams,frams/canvas,frams/config,frams/mhandlers,frams/genetics,frams/genetics/f0,frams/genetics/f1,frams/genetics/f2,frams/genetics/f3,frams/genetics/f4,frams/genetics/f5,frams/genetics/f6,frams/genetics/f7,frams/genetics/f8,frams/genetics/f9,frams/genetics/fF,frams/genetics/fT,frams/model,frams/neuro,frams/neuro/impl,frams/param,frams/test,frams/util,frams/vm/classes,frams/virtfile,frams/_demos,frams/model/geometry,frams/_demos/geometry,frams/model/similarity,frams/model/similarity/SVD} 5 5 6 6 GENMANF4=frams/genetics/f4/oper_f4.o … … 19 19 GENMAN_COMMON_OBJS=frams/genetics/genman.o frams/param/mutableparam.o frams/param/mutparamlist.o frams/neuro/geneticneuroparam.o frams/neuro/neurolibparam.o 20 20 21 SDK_OBJS=frams/util/list.o frams/util/advlist.o frams/param/param.o frams/util/sstring.o frams/util/sstringutils.o frams/util/3d.o frams/vm/classes/3dobject.o frams/model/model.o frams/model/modelparts.o frams/neuro/neurolibrary.o frams/genetics/geno.o frams/genetics/genoconv.o frams/util/extvalue.o frams/vm/classes/collectionobj.o frams/util/hashtable.o common/ framsg.o common/stl-util.o common/nonstd_stdio.o frams/util/callbacks.o frams/param/syntparam.o frams/util/multirange.o frams/util/multimap.o frams/param/paramtabobj.o frams/errmgr/errmanager.o frams/param/paramobj.o frams/genetics/oper_fx.o common/nonstd_math.o frams/errmgr/stderrors.o common/Convert.o frams/util/rndutil.o21 SDK_OBJS=frams/util/list.o frams/util/advlist.o frams/param/param.o frams/util/sstring.o frams/util/sstringutils.o frams/util/3d.o frams/vm/classes/3dobject.o frams/model/model.o frams/model/modelparts.o frams/neuro/neurolibrary.o frams/genetics/geno.o frams/genetics/genoconv.o frams/util/extvalue.o frams/vm/classes/collectionobj.o frams/util/hashtable.o common/hmessage.o common/stl-util.o common/nonstd_stdio.o frams/util/callbacks.o frams/param/syntparam.o frams/util/multirange.o frams/util/multimap.o frams/param/paramtabobj.o frams/mhandlers/mhandlers.o frams/param/paramobj.o frams/genetics/oper_fx.o common/nonstd_math.o frams/mhandlers/stderrors.o common/Convert.o frams/util/rndutil.o 22 22 23 23 GEOMETRY_OBJS=frams/model/geometry/meshbuilder.o frams/model/geometry/modelgeometryinfo.o frams/model/geometry/geometryutils.o … … 25 25 #### sdk_tests 26 26 27 GENOMANIPULATION_OBJS= frams/_demos/genomanipulation.o frams/ errmgr/stdouterr.o frams/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)27 GENOMANIPULATION_OBJS= frams/_demos/genomanipulation.o frams/mhandlers/stdouthandler.o frams/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) 28 28 29 MULTILINE_F0_OBJS=frams/_demos/multiline_f0_test.o frams/virtfile/stringfile.o frams/virtfile/virtfile.o frams/ errmgr/stdouterr.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)29 MULTILINE_F0_OBJS=frams/_demos/multiline_f0_test.o frams/virtfile/stringfile.o frams/virtfile/virtfile.o frams/mhandlers/stdouthandler.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) 30 30 31 F0_VARIANTS_OBJS=frams/_demos/f0_variants_test.o frams/virtfile/stringfile.o frams/virtfile/virtfile.o frams/ errmgr/stdouterr.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS)31 F0_VARIANTS_OBJS=frams/_demos/f0_variants_test.o frams/virtfile/stringfile.o frams/virtfile/virtfile.o frams/mhandlers/stdouthandler.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) 32 32 33 33 LOADER_TEST_OBJS=frams/_demos/genotypeloader.o frams/_demos/loader_test.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) 34 34 35 LOADER_TEST_PARAM_OBJS=frams/_demos/loader_test_param.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o frams/ errmgr/stdouterr.o $(SDK_OBJS)35 LOADER_TEST_PARAM_OBJS=frams/_demos/loader_test_param.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o frams/mhandlers/stdouthandler.o $(SDK_OBJS) 36 36 37 GENOCONV_TEST_OBJS= frams/_demos/genoconv_test.o frams/_demos/printconvmap.o frams/ errmgr/stdouterr.o frams/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS)37 GENOCONV_TEST_OBJS= frams/_demos/genoconv_test.o frams/_demos/printconvmap.o frams/mhandlers/stdouthandler.o frams/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) 38 38 39 GENO_TEST_OBJS= frams/_demos/geno_test.o frams/virtfile/virtfile.o frams/ errmgr/stdouterr.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)39 GENO_TEST_OBJS= frams/_demos/geno_test.o frams/virtfile/virtfile.o frams/mhandlers/stdouthandler.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) 40 40 41 GENOOPER_TEST_OBJS=frams/_demos/genooper_test.o frams/virtfile/virtfile.o frams/ errmgr/stdouterr.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)41 GENOOPER_TEST_OBJS=frams/_demos/genooper_test.o frams/virtfile/virtfile.o frams/mhandlers/stdouthandler.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) 42 42 43 43 GENOOPER_TEST_FTEST_OBJS=frams/_demos/genooper_test_fTest.o frams/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) $(GENMAN_FT) 44 44 45 NEURO_TEST_OBJS= frams/_demos/neuro_test.o frams/ errmgr/stdouterr.o frams/virtfile/virtfile.o \45 NEURO_TEST_OBJS= frams/_demos/neuro_test.o frams/mhandlers/stdouthandler.o frams/virtfile/virtfile.o \ 46 46 frams/neuro/neuroimpl.o frams/neuro/neurofactory.o frams/neuro/impl/neuroimpl-simple.o frams/neuro/impl/neuroimpl-channels.o \ 47 47 frams/neuro/impl/neuroimpl-fuzzy.o frams/neuro/impl/neuroimpl-fuzzy-f0.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) 48 48 49 FULL_PROPS_OBJS= frams/_demos/full_props.o frams/ errmgr/stdouterr.o frams/virtfile/virtfile.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)49 FULL_PROPS_OBJS= frams/_demos/full_props.o frams/mhandlers/stdouthandler.o frams/virtfile/virtfile.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) 50 50 51 SHAPECONVERT_OBJS= frams/_demos/shapeconvert.o frams/ errmgr/stdouterr.o frams/virtfile/virtfile.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)51 SHAPECONVERT_OBJS= frams/_demos/shapeconvert.o frams/mhandlers/stdouthandler.o frams/virtfile/virtfile.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) 52 52 53 53 SERIAL_TEST_OBJS= frams/_demos/serial_test.o frams/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) … … 55 55 PART_SHAPES_OBJS= frams/_demos/part_shapes.o frams/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) 56 56 57 NEURO_LAYOUT_TEST_OBJS= frams/_demos/neuro_layout_test.o frams/virtfile/virtfile.o frams/ errmgr/stdouterr.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) frams/canvas/nn_layout_model.o frams/canvas/nn_simple_layout.o frams/canvas/nn_smart_layout.o57 NEURO_LAYOUT_TEST_OBJS= frams/_demos/neuro_layout_test.o frams/virtfile/virtfile.o frams/mhandlers/stdouthandler.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) frams/canvas/nn_layout_model.o frams/canvas/nn_simple_layout.o frams/canvas/nn_smart_layout.o 58 58 59 59 GEOMETRY_INFO_TEST_OBJS=frams/_demos/geometry/info_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GEOMETRY_OBJS) … … 66 66 67 67 SIMIL_TEST_OBJS=frams/_demos/simil_test.o frams/model/similarity/SVD/lapack.o frams/model/similarity/SVD/matrix_tools.o frams/model/similarity/simil_match.o frams/model/similarity/simil_model.o \ 68 frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o frams/ errmgr/stdouterr.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)68 frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o frams/mhandlers/stdouthandler.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) 69 69 70 70 SIMIL_UNITTESTS_OBJS=frams/_demos/simil_unittests.o frams/model/similarity/simil_match.o -
cpp/frams/Makefile-maintain
r353 r372 4 4 endif 5 5 6 MISSING_ALL_DIRS=$(strip $(foreach DIR,$(shell echo $(ALL_DIRS)), $(if $(wildcard $(DIR)),,$(DIR)))) 7 6 8 clean: 7 9 ifeq "$(ALL_DIRS)$(ALL_DIRS)" "" 8 10 @echo "Makefile-maintain clean: ALL_DIRS and/or EXTRA_CLEAN_FILES must be defined" 9 11 else 12 @echo -e -n $(if $(MISSING_ALL_DIRS),\\nMissing ALL_DIRS paths:\\n$(MISSING_ALL_DIRS)\\n\\n) 10 13 rm -f $(EXTRA_CLEAN_FILES) $(ALL_DIRS)/*.{a,o,d} 11 14 endif -
cpp/frams/_demos/f0_variants_test.cpp
r348 r372 10 10 #include <frams/genetics/defgenoconv.h> 11 11 #include <frams/model/model.h> 12 #include <frams/ errmgr/stdouterr.h>12 #include <frams/mhandlers/stdouthandler.h> 13 13 14 14 void save_as_f0(SString &gen,Model &m,bool omit_default_values) … … 74 74 int main(int argc,char*argv[]) 75 75 { 76 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output) 76 MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); 77 77 78 78 //without converters the application would only handle "format 0" genotypes -
cpp/frams/_demos/full_props.cpp
r348 r372 9 9 10 10 #include <frams/model/model.h> 11 #include <frams/ errmgr/stdouterr.h>11 #include <frams/mhandlers/stdouthandler.h> 12 12 #include <frams/genetics/preconfigured.h> 13 13 … … 50 50 { 51 51 StdioFILE::setStdio();//setup VirtFILE::Vstdin/out/err 52 StdoutErrorHandler err(ErrorHandlerBase::DontBlock,VirtFILE::Vstderr); //errors -> stderr, don't interfere with stdout52 MessageHandlerToStdout messages_to_stderr(MessageHandlerBase::Enable | MessageHandlerBase::DontBlock,VirtFILE::Vstderr); //errors -> stderr, don't interfere with stdout 53 53 54 54 PreconfiguredGenetics genetics; … … 79 79 if (!m.isValid()) 80 80 { 81 FMprintf("","full_props",FMLV_ERROR,"Cannot build Model from the supplied genotype\n");81 Hprintf("","full_props",HMLV_ERROR,"Cannot build Model from the supplied genotype\n"); 82 82 return 2; 83 83 } -
cpp/frams/_demos/geno_test.cpp
r365 r372 6 6 #include <frams/util/sstringutils.h> 7 7 #include <frams/genetics/preconfigured.h> 8 #include <frams/ errmgr/stdouterr.h>8 #include <frams/mhandlers/stdouthandler.h> 9 9 10 10 /** … … 18 18 { 19 19 PreconfiguredGenetics genetics; 20 StdoutErrorHandler stdouterr; //comment this object out to mute error/warning messages20 MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); //comment this object out to mute error/warning messages 21 21 22 22 if (argc <= 1) -
cpp/frams/_demos/genoconv_test.cpp
r348 r372 9 9 10 10 #include "printconvmap.h" 11 #include <frams/ errmgr/stdouterr.h>11 #include <frams/mhandlers/stdouthandler.h> 12 12 13 13 /** … … 117 117 int main(int argc,char *argv[]) 118 118 { 119 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output) 119 MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); 120 120 121 121 DefaultGenoConvManager gcm; -
cpp/frams/_demos/genomanipulation.cpp
r348 r372 10 10 #include <frams/model/model.h> 11 11 #include <frams/genetics/preconfigured.h> 12 #include <frams/ errmgr/stdouterr.h>12 #include <frams/mhandlers/stdouthandler.h> 13 13 14 14 /** … … 266 266 int main(int argc,char*argv[]) 267 267 { 268 StdoutErrorHandler err; //redirect model-related errors to stdout268 MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); //redirect model-related errors to stdout 269 269 270 270 srand(time(0)); -
cpp/frams/_demos/genooper_test.cpp
r348 r372 3 3 // See LICENSE.txt for details. 4 4 5 #include <frams/ errmgr/stdouterr.h>5 #include <frams/mhandlers/stdouthandler.h> 6 6 #include <frams/genetics/preconfigured.h> 7 7 … … 21 21 int main(int argc, char *argv[]) 22 22 { 23 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output)23 MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); 24 24 PreconfiguredGenetics genetics; 25 25 -
cpp/frams/_demos/loader_test_param.cpp
r348 r372 5 5 #include <frams/param/multiparamload.h> 6 6 #include <frams/virtfile/stdiofile.h> 7 #include <frams/ errmgr/stdouterr.h>7 #include <frams/mhandlers/stdouthandler.h> 8 8 9 9 /** … … 66 66 StdioFILEDontClose virt_stderr(stderr); 67 67 StdioFILEDontClose virt_stdout(stdout); 68 StdoutErrorHandler error_handler(0, &virt_stderr);68 MessageHandlerToStdout messages_to_stderr(MessageHandlerBase::Enable, &virt_stderr); 69 69 StdioFileSystem_autoselect stdiofilesys; 70 70 MultiParamLoader loader(argv[1]); -
cpp/frams/_demos/multiline_f0_test.cpp
r348 r372 10 10 #include <frams/genetics/preconfigured.h> 11 11 #include <frams/model/model.h> 12 #include <frams/ errmgr/stdouterr.h>12 #include <frams/mhandlers/stdouthandler.h> 13 13 #include <frams/virtfile/stringfile.h> 14 14 15 15 int main(int argc,char*argv[]) 16 16 { 17 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output) 17 MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); 18 18 PreconfiguredGenetics genetics; 19 19 -
cpp/frams/_demos/neuro_layout_test.cpp
r348 r372 7 7 #include <frams/genetics/preconfigured.h> 8 8 #include <frams/model/model.h> 9 #include <frams/ errmgr/stdouterr.h>9 #include <frams/mhandlers/stdouthandler.h> 10 10 #include <frams/canvas/nn_layout_model.h> 11 11 … … 83 83 int main(int argc,char*argv[]) 84 84 { 85 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output) 85 MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); 86 86 PreconfiguredGenetics genetics; 87 87 -
cpp/frams/_demos/neuro_test.cpp
r348 r372 9 9 #include <frams/neuro/neuroimpl.h> 10 10 #include <frams/neuro/neurofactory.h> 11 #include <frams/ errmgr/stdouterr.h>11 #include <frams/mhandlers/stdouthandler.h> 12 12 13 13 /** … … 60 60 int main(int argc,char*argv[]) 61 61 { 62 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output) 62 MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); 63 63 PreconfiguredGenetics genetics; 64 64 -
cpp/frams/_demos/shapeconvert.cpp
r348 r372 9 9 10 10 #include <frams/model/model.h> 11 #include <frams/ errmgr/stdouterr.h>11 #include <frams/mhandlers/stdouthandler.h> 12 12 #include <frams/genetics/preconfigured.h> 13 13 … … 34 34 { 35 35 StdioFILE::setStdio();//setup VirtFILE::Vstdin/out/err 36 StdoutErrorHandler err(ErrorHandlerBase::DontBlock, VirtFILE::Vstderr); //errors -> stderr, don't interfere with stdout36 MessageHandlerToStdout messages_to_stderr(MessageHandlerBase::Enable | MessageHandlerBase::DontBlock, VirtFILE::Vstderr); //errors -> stderr, don't interfere with stdout 37 37 38 38 PreconfiguredGenetics genetics; … … 50 50 if ((shape != Part::SHAPE_ELLIPSOID) && (shape != Part::SHAPE_CUBOID) && (shape != Part::SHAPE_CYLINDER)) 51 51 { 52 FMprintf("", "shapeconvert", FMLV_ERROR, "Invalid shape");52 Hprintf("", "shapeconvert", HMLV_ERROR, "Invalid shape"); 53 53 return 4; 54 54 } … … 71 71 if (!m.isValid()) 72 72 { 73 FMprintf("", "shapeconvert", FMLV_ERROR, "Cannot build Model from the supplied genotype");73 Hprintf("", "shapeconvert", HMLV_ERROR, "Cannot build Model from the supplied genotype"); 74 74 return 2; 75 75 } … … 77 77 if (m.getShape() != Model::SHAPE_OLD) 78 78 { 79 FMprintf("", "shapeconvert", FMLV_ERROR, "Only old style shapes can be converted");79 Hprintf("", "shapeconvert", HMLV_ERROR, "Only old style shapes can be converted"); 80 80 return 3; 81 81 } -
cpp/frams/_demos/simil_test.cpp
r361 r372 5 5 6 6 #include <vector> 7 #include "frams/ errmgr/stdouterr.h"7 #include "frams/mhandlers/stdouthandler.h" 8 8 #include "frams/_demos/genotypeloader.h" 9 9 #include "frams/genetics/preconfigured.h" … … 39 39 int main(int argc, char *argv[]) 40 40 { 41 StdoutErrorHandler stdouterr; //comment this object out to mute error/warning messages41 MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); 42 42 typedef double *pDouble; 43 43 int iCurrParam = 0; // index of the currently processed parameter -
cpp/frams/genetics/f1/conv_f1.cpp
r348 r372 5 5 #include "conv_f1.h" 6 6 #include <common/nonstd_stl.h> 7 #include <common/ framsg.h>7 #include <common/hmessage.h> 8 8 #include <frams/util/multirange.h> 9 9 #include <frams/util/multimap.h> … … 63 63 if ((n1<0) || (n2<0) || (n1>=neuro_f1_to_f0.size()) || (n2>=neuro_f1_to_f0.size())) 64 64 { 65 if (final) FMprintf("GenoConvF1","addInput",FMLV_WARN,65 if (final) Hprintf("GenoConvF1","addInput",HMLV_WARN, 66 66 "illegal neuron connection %d <- %d (ignored)",n1,n2); 67 67 return 0; … … 178 178 else 179 179 { 180 FramMessage("GenoConv_F1","grow","Illegal neuron position (ignored)",1);180 Hmessage("GenoConv_F1","grow","Illegal neuron position (ignored)",1); 181 181 g=skipNeuro(g+1); 182 182 } -
cpp/frams/genetics/f4/conv_f4.cpp
r287 r372 6 6 7 7 #include "conv_f4.h" 8 #include <common/ framsg.h>8 #include <common/hmessage.h> 9 9 #include "../oper_fx.h" //for GENOPER_OK constant 10 10 … … 110 110 if (res) 111 111 { 112 FramMessage("f4_Model", "buildModelRec", "Error in building Model", 2);112 Hmessage("f4_Model", "buildModelRec", "Error in building Model", 2); 113 113 error = res; 114 114 break; … … 134 134 return cells->C[i]; 135 135 // none! 136 FramMessage("f4_Model", "getStick", "Not a single stick", 2);136 Hmessage("f4_Model", "getStick", "Not a single stick", 2); 137 137 return NULL; 138 138 } -
cpp/frams/genetics/f4/f4_general.cpp
r348 r372 7 7 #include "f4_general.h" 8 8 #include <common/nonstd_stl.h> 9 #include <common/ framsg.h>9 #include <common/hmessage.h> 10 10 #include <frams/model/model.h> // for min and max attributes 11 11 #include "../oper_fx.h" //for GENOPER_ constants … … 581 581 char buf[40]; 582 582 sprintf(buf, "unknown code '%c'", gcur->name); 583 FramMessage("f4_Cell", "onestep", buf, 2);583 Hmessage("f4_Cell", "onestep", buf, 2); 584 584 // fix: delete it 585 585 org->setRepairRemove(gcur->pos, gcur); -
cpp/frams/genetics/f4/oper_f4.cpp
r286 r372 8 8 #include "oper_f4.h" 9 9 #include <frams/util/sstring.h> 10 #include <common/ framsg.h>10 #include <common/hmessage.h> 11 11 12 12 #include <stdio.h> … … 51 51 mutation_method_names[index++] = "deleted a node"; 52 52 mutation_method_names[index++] = "modified a node"; 53 if (index != F4_COUNT + F4_ADD_COUNT - 1) FramMessage("Geno_f4", "Constructor", "Mutation names init error", 3);53 if (index != F4_COUNT + F4_ADD_COUNT - 1) Hmessage("Geno_f4", "Constructor", "Mutation names init error", 3); 54 54 } 55 55 -
cpp/frams/genetics/genman.cpp
r348 r372 6 6 #include <frams/vm/classes/genoobj.h> 7 7 #include GEN_CONFIG_FILE //configuration of active genetic operators 8 #include "common/ framsg.h"8 #include "common/hmessage.h" 9 9 #include "common/nonstd_math.h" 10 10 #include "common/stl-util.h" 11 #include <frams/ errmgr/errmanager.h>11 #include <frams/mhandlers/mhandlers.h> 12 12 13 13 … … 267 267 if (gf->mutate(gn, chg, method) == GENOPER_OK) 268 268 { 269 ErrorHandler eh(ErrorHandler::StoreFirstMessage); //mute testValidity()269 MessageHandlerToMemory eh(MessageHandlerBase::Enable | MessageHandlerToMemory::StoreFirstMessage); //mute testValidity() 270 270 Geno G(gn, gv.getFormat(), "", ""); 271 271 canvalidate = true; … … 284 284 if (!ok && (count - pcount > 100)) 285 285 { 286 FMprintf("GenMan", "Mutate", 2, "Tried 100x and failed: %s", g.getGene().c_str());286 Hprintf("GenMan", "Mutate", 2, "Tried 100x and failed: %s", g.getGene().c_str()); 287 287 return Geno("", -1, "", "GENOPER_OPFAIL: Mutate() tried 100x and failed"); 288 288 } … … 308 308 309 309 { 310 ErrorHandler eh(ErrorHandler::StoreFirstMessage); //mute testValidity()310 MessageHandlerToMemory eh(MessageHandlerBase::Enable | MessageHandlerToMemory::StoreFirstMessage); //mute testValidity() 311 311 bool canvalidate = true; 312 312 if (testValidity(g1v, canvalidate) > 0 && canvalidate == false) … … 333 333 if (g1n[0]) { gn = g1n; chg = chg1; } 334 334 else { gn = g2n; chg = chg2; } 335 ErrorHandler eh(ErrorHandler::StoreFirstMessage); //mute testValidity()335 MessageHandlerToMemory eh(MessageHandlerBase::Enable | MessageHandlerToMemory::StoreFirstMessage); //mute testValidity() 336 336 Geno G(gn, g1v.getFormat(), "", ""); 337 337 bool canvalidate = true; … … 351 351 if (!ok && (count - pcount > 100)) 352 352 { 353 FMprintf("GenMan", "CrossOver", 2, "Tried 100x and failed: %s and %s", g1.getGene().c_str(), g2.getGene().c_str());353 Hprintf("GenMan", "CrossOver", 2, "Tried 100x and failed: %s and %s", g1.getGene().c_str(), g2.getGene().c_str()); 354 354 return Geno("", -1, "", "GENOPER_OPFAIL: CrossOver() tried 100x and failed"); 355 355 } … … 500 500 l.chg = chg; 501 501 l.fit = 0; //temporarily. Will be set when the genotype dies 502 // FMprintf("GenMan","saveLink",0,"#%d: [%d] '%s' + '%s' -> '%s'",GenoLinkList.size(),count,parent1.c_str(),parent2.c_str(),child.c_str());502 //Hprintf("GenMan","saveLink",0,"#%d: [%d] '%s' + '%s' -> '%s'",GenoLinkList.size(),count,parent1.c_str(),parent2.c_str(),child.c_str()); 503 503 GenoLinkList.push_back(l); 504 504 } … … 533 533 float f1, f2; 534 534 int m; 535 FramMessage("GenMan", "Report", "The following genetic operators are available:", 0);535 Hmessage("GenMan", "Report", "The following genetic operators are available:", 0); 536 536 for (unsigned int i = 0; i < oper_fx_list.size(); i++) 537 537 { … … 549 549 } 550 550 // if (oper_fx_list[i]->similarity("","")!=GENOPER_NOOPER) l+=" similarity"; 551 FMprintf("GenMan", "Report", 0, "format f%c (%s):%s",551 Hprintf("GenMan", "Report", 0, "format f%c (%s):%s", 552 552 oper_fx_list[i]->supported_format, oper_fx_list[i]->name.c_str(), l.c_str()); 553 553 } -
cpp/frams/genetics/geno.cpp
r348 r372 250 250 } 251 251 isvalid = 0; 252 FMprintf("Geno", "validate", FMLV_WARN, "Wrong configuration? No genotype validators defined for genetic format f%c.", format);252 Hprintf("Geno", "validate", HMLV_WARN, "Wrong configuration? No genotype validators defined for genetic format f%c.", format); 253 253 } 254 254 -
cpp/frams/genetics/oper_fx.cpp
r348 r372 5 5 #include <ctype.h> //isupper() 6 6 #include "oper_fx.h" 7 #include <common/ framsg.h>7 #include <common/hmessage.h> 8 8 #include <common/nonstd_math.h> 9 9 #include <frams/util/rndutil.h> … … 173 173 } 174 174 else 175 FMprintf("GenoOperators", "linearMix", FMLV_WARN, "Cannot mix values of types '%c' and '%c'", type1, type2);175 Hprintf("GenoOperators", "linearMix", HMLV_WARN, "Cannot mix values of types '%c' and '%c'", type1, type2); 176 176 } 177 177 … … 250 250 { 251 251 if (s == NULL) 252 FramMessage("GenoOperators", "skipWS", "NULL reference!", FMLV_WARN);252 Hmessage("GenoOperators", "skipWS", "NULL reference!", HMLV_WARN); 253 253 else 254 254 while (isWS(*s)) s++; -
cpp/frams/mhandlers/mhandlers.cpp
r371 r372 3 3 // See LICENSE.txt for details. 4 4 5 #include " errmanager.h"5 #include "mhandlers.h" 6 6 #include <common/stl-util.h> 7 7 8 void _ FramMessageSingleLine(const char *o, const char *m, const char *txt, int w)8 void _HmessageSingleLine(const char *o, const char *m, const char *txt, int w) 9 9 { 10 tlsGetRef( errmgr_instance).send(o, m, txt, w);10 tlsGetRef(message_handler_manager_instance).send(o, m, txt, w); 11 11 } 12 12 13 THREAD_LOCAL_DEF( ErrorManager, errmgr_instance);13 THREAD_LOCAL_DEF(MessageHandlerManager, message_handler_manager_instance); 14 14 15 void ErrorManager::send(int level, const char *o, const char *m, const char *bl, int w)15 void MessageHandlerManager::send(int level, const char *o, const char *m, const char *bl, int w) 16 16 { 17 17 if (level >= handlers.size()) level = handlers.size() - 1; … … 19 19 for (int i = level; i >= 0; i--) 20 20 { 21 ErrorHandlerBase *r = handlers(i);22 if ((!(r->options & ErrorHandlerBase::Paused)) &&23 ((!blocked) || (r->options & ErrorHandlerBase::CannotBeBlocked)))21 MessageHandlerBase *r = handlers(i); 22 if ((!(r->options & MessageHandlerBase::Paused)) && 23 ((!blocked) || (r->options & MessageHandlerBase::CannotBeBlocked))) 24 24 { 25 25 r->handle(o, m, bl, w); 26 if (!(r->options & ErrorHandlerBase::DontBlock)) blocked = 1;26 if (!(r->options & MessageHandlerBase::DontBlock)) blocked = 1; 27 27 } 28 28 } 29 29 } 30 30 31 int ErrorManager::add(ErrorHandlerBase *h)31 int MessageHandlerManager::add(MessageHandlerBase *h) 32 32 { 33 33 h->mgr = this; … … 36 36 } 37 37 38 void ErrorManager::remove(int i)38 void MessageHandlerManager::remove(int i) 39 39 { 40 ErrorHandlerBase *h = handlers(i);40 MessageHandlerBase *h = handlers(i); 41 41 h->mgr = 0; 42 42 handlers.remove(i); 43 43 } 44 44 45 void ErrorManager::remove(ErrorHandlerBase *h)45 void MessageHandlerManager::remove(MessageHandlerBase *h) 46 46 { 47 47 int i; … … 50 50 } 51 51 52 void ErrorManager::removeAll()52 void MessageHandlerManager::removeAll() 53 53 { 54 54 while (handlers.size() > 0) … … 58 58 ////////////////////////////////// 59 59 60 void ErrorHandlerBase::send(const char *o, const char *m, const char *bl, int w)60 void MessageHandlerBase::send(const char *o, const char *m, const char *bl, int w) 61 61 { 62 62 if (!isEnabled()) return; … … 65 65 } 66 66 67 void ErrorHandlerBase::FMprintf(const char *o, const char *m, int w, const char *bl, ...)67 void MessageHandlerBase::Hprintf(const char *o, const char *m, int w, const char *bl, ...) 68 68 { 69 69 if (!isEnabled()) return; … … 77 77 78 78 79 void ErrorHandlerBase::enable()79 void MessageHandlerBase::enable() 80 80 { 81 81 if (isEnabled()) return; 82 tlsGetRef( errmgr_instance).add(this);82 tlsGetRef(message_handler_manager_instance).add(this); 83 83 } 84 84 85 void ErrorHandlerBase::disable()85 void MessageHandlerBase::disable() 86 86 { 87 87 if (!isEnabled()) return; 88 tlsGetRef( errmgr_instance).remove(this);88 tlsGetRef(message_handler_manager_instance).remove(this); 89 89 } 90 90 91 void ErrorHandlerBase::pause()91 void MessageHandlerBase::pause() 92 92 { 93 93 if (isPaused()) return; … … 95 95 } 96 96 97 void ErrorHandlerBase::resume()97 void MessageHandlerBase::resume() 98 98 { 99 99 if (!isPaused()) return; … … 103 103 ///////////////////////////////// 104 104 105 void ErrorHandler::handle(const char *o, const char *m, const char *bl, int w)105 void MessageHandlerToMemory::handle(const char *o, const char *m, const char *bl, int w) 106 106 { 107 107 if (w > maxlevel) maxlevel = w; 108 if (w >= FMLV_INFO) infocount++;109 if (w >= FMLV_WARN) warncount++;110 if (w >= FMLV_ERROR) errcount++;108 if (w >= HMLV_INFO) infocount++; 109 if (w >= HMLV_WARN) warncount++; 110 if (w >= HMLV_ERROR) errcount++; 111 111 112 112 if (w >= storlevel) -
cpp/frams/mhandlers/mhandlers.h
r371 r372 3 3 // See LICENSE.txt for details. 4 4 5 #ifndef _ ERRMANAGER_H_6 #define _ ERRMANAGER_H_5 #ifndef _MHANDLERS_H_ 6 #define _MHANDLERS_H_ 7 7 8 8 #include <frams/util/list.h> 9 9 #include <frams/util/sstring.h> 10 #include <common/ framsg.h>10 #include <common/hmessage.h> 11 11 #include <common/threads.h> 12 12 13 class ErrorHandlerBase;13 class MessageHandlerBase; 14 14 15 class ErrorManager15 class MessageHandlerManager 16 16 { 17 friend class ErrorHandlerBase;18 SListTempl< ErrorHandlerBase*> handlers;17 friend class MessageHandlerBase; 18 SListTempl<MessageHandlerBase*> handlers; 19 19 void send(int level, const char *o, const char *m, const char *bl, int w); 20 20 public: 21 int find( ErrorHandlerBase *r) { return handlers.find(r); }22 int add( ErrorHandlerBase *r);21 int find(MessageHandlerBase *r) { return handlers.find(r); } 22 int add(MessageHandlerBase *r); 23 23 void remove(int i); 24 void remove( ErrorHandlerBase *r);24 void remove(MessageHandlerBase *r); 25 25 void removeAll(); 26 26 void send(const char *o, const char *m, const char *bl, int w) … … 28 28 send(handlers.size() - 1, o, m, bl, w); 29 29 } 30 ~ ErrorManager() { removeAll(); }30 ~MessageHandlerManager() { removeAll(); } 31 31 }; 32 32 33 extern THREAD_LOCAL_DECL( ErrorManager, errmgr_instance);33 extern THREAD_LOCAL_DECL(MessageHandlerManager, message_handler_manager_instance); 34 34 35 35 //////////////////////////////////////// 36 36 37 class ErrorHandlerBase37 class MessageHandlerBase 38 38 { 39 friend class ErrorManager;39 friend class MessageHandlerManager; 40 40 protected: 41 ErrorManager* mgr;41 MessageHandlerManager* mgr; 42 42 int options; 43 43 … … 46 46 enum HandlerOptions 47 47 { 48 DontBlock = 1, CannotBeBlocked = 2, DontEnable = 4, Paused = 848 DontBlock = 1, CannotBeBlocked = 2, Enable = 4, Paused = 8 49 49 }; 50 50 51 void FMprintf(const char *o, const char *m, int w, const char *bl, ...);51 void Hprintf(const char *o, const char *m, int w, const char *bl, ...); 52 52 void send(const char *o, const char *m, const char *bl, int w); 53 53 … … 59 59 void resume(); 60 60 61 ErrorHandlerBase(int opts = 0) :mgr(0), options(opts)61 MessageHandlerBase(int opts = 0) :mgr(0), options(opts) 62 62 { 63 if ( !(options&DontEnable)) enable();63 if (options&Enable) enable(); 64 64 } 65 virtual ~ ErrorHandlerBase()65 virtual ~MessageHandlerBase() 66 66 { 67 67 disable(); … … 73 73 /////////////////////////////////////////// 74 74 75 class ErrorHandler : public ErrorHandlerBase75 class MessageHandlerToMemory : public MessageHandlerBase 76 76 { 77 77 protected: … … 81 81 public: 82 82 83 void reset() { maxlevel = FMLV_INFO - 1; errcount = warncount = storcount = infocount = 0; msgs = 0; }83 void reset() { maxlevel = HMLV_INFO - 1; errcount = warncount = storcount = infocount = 0; msgs = 0; } 84 84 85 85 enum Options2 … … 95 95 const SString& getMessages() { return msgs; } 96 96 97 ErrorHandler(int opts = 0, int store = FMLV_ERROR) :ErrorHandlerBase(opts), storlevel(store)97 MessageHandlerToMemory(int opts = 0, int minimal_level_to_store = HMLV_ERROR) :MessageHandlerBase(opts), storlevel(minimal_level_to_store) 98 98 { 99 99 reset(); … … 103 103 }; 104 104 105 class ErrorRedirector : public ErrorHandlerBase105 class RedirectingMessageHandler : public MessageHandlerBase 106 106 { 107 ErrorManager *other_mgr;107 MessageHandlerManager *other_mgr; 108 108 public: 109 ErrorRedirector(ErrorManager *om)110 : ErrorHandlerBase(), other_mgr(om) {}109 RedirectingMessageHandler(MessageHandlerManager *om,int opts=0) 110 :MessageHandlerBase(opts), other_mgr(om) {} 111 111 112 112 void handle(const char *o, const char *m, const char *bl, int w) -
cpp/frams/mhandlers/stderrors.cpp
r348 r372 5 5 #include "stderrors.h" 6 6 #include <frams/util/sstringutils.h> 7 #include <common/ framsg.h>7 #include <common/hmessage.h> 8 8 9 9 bool listIndexCheck(SList* list,int index,const char* msgobj,const char* msgfun) … … 13 13 { 14 14 if (size>0) 15 FMprintf(msgobj,msgfun,FMLV_ERROR,"Invalid index %d (allowed range is 0..%d)",index,size-1);15 Hprintf(msgobj,msgfun,HMLV_ERROR,"Invalid index %d (allowed range is 0..%d)",index,size-1); 16 16 else 17 FMprintf(msgobj,msgfun,FMLV_ERROR,"Invalid index %d (this list is empty)",index);17 Hprintf(msgobj,msgfun,HMLV_ERROR,"Invalid index %d (this list is empty)",index); 18 18 return 0; 19 19 } … … 29 29 { 30 30 SString msg2=SString(msg)+": \"%s\" (adjusted to \"%s\")"; 31 FMprintf(msgobj,msgfun,FMLV_WARN,msg2.c_str(),in.c_str(),corrected.c_str());31 Hprintf(msgobj,msgfun,HMLV_WARN,msg2.c_str(),in.c_str(),corrected.c_str()); 32 32 } 33 33 return corrected; -
cpp/frams/mhandlers/stdouthandler.cpp
r371 r372 3 3 // See LICENSE.txt for details. 4 4 5 #include "stdout err.h"5 #include "stdouthandler.h" 6 6 #ifdef SHP 7 7 #include <FBaseSys.h> //AppLog … … 10 10 #endif 11 11 12 void StdoutErrorHandler::handle(const char *o, const char *m, const char *bl, int w)12 void MessageHandlerToStdout::handle(const char *o, const char *m, const char *bl, int w) 13 13 { 14 14 if (w < -1) w = -1; else if (w>3) w = 3; 15 15 #ifdef SHP 16 AppLog( FRAMSG_FORMAT "\n",MSG_LEVEL[w+1],o,m,bl);16 AppLog(HMSG_FORMAT "\n",HMSG_LEVEL[w+1],o,m,bl); 17 17 #else 18 18 if (file) 19 file->printf( FRAMSG_FORMAT "\n",MSG_LEVEL[w + 1], o, m, bl);19 file->printf(HMSG_FORMAT "\n", HMSG_LEVEL[w + 1], o, m, bl); 20 20 else 21 printf( FRAMSG_FORMAT "\n",MSG_LEVEL[w + 1], o, m, bl);21 printf(HMSG_FORMAT "\n", HMSG_LEVEL[w + 1], o, m, bl); 22 22 #endif 23 23 } -
cpp/frams/mhandlers/stdouthandler.h
r371 r372 3 3 // See LICENSE.txt for details. 4 4 5 #ifndef _STDOUT ERRORHANDLER_H_6 #define _STDOUT ERRORHANDLER_H_5 #ifndef _STDOUTHANDLER_H_ 6 #define _STDOUTHANDLER_H_ 7 7 8 #include " errmanager.h"8 #include "mhandlers.h" 9 9 #include <frams/virtfile/virtfile.h> 10 10 11 class StdoutErrorHandler : public ErrorHandlerBase11 class MessageHandlerToStdout : public MessageHandlerBase 12 12 { 13 13 VirtFILE *file; 14 14 public: 15 StdoutErrorHandler(int opts = DontBlock, VirtFILE *_file = NULL) :ErrorHandlerBase(opts), file(_file) {}15 MessageHandlerToStdout(int opts = 0, VirtFILE *_file = NULL) :MessageHandlerBase(opts), file(_file) {} 16 16 void handle(const char *o, const char *m, const char *bl, int w); 17 17 }; -
cpp/frams/model/geometry/geometryutils.cpp
r286 r372 82 82 break; 83 83 } 84 FMprintf("GeometryUtils", "isPointInsidePart", FMLV_ERROR, "Part shape=%d not supported", part->shape);84 Hprintf("GeometryUtils", "isPointInsidePart", HMLV_ERROR, "Part shape=%d not supported", part->shape); 85 85 return false; 86 86 } … … 102 102 break; 103 103 } 104 FMprintf("GeometryUtils", "isPointStrictlyInsidePart", FMLV_ERROR, "Part shape=%d not supported", part->shape);104 Hprintf("GeometryUtils", "isPointStrictlyInsidePart", HMLV_ERROR, "Part shape=%d not supported", part->shape); 105 105 return false; 106 106 } -
cpp/frams/model/geometry/meshbuilder.cpp
r322 r372 639 639 640 640 default: 641 FMprintf("MeshBuilder::PartSurface", "initialize", FMLV_WARN, "Part shape=%d not supported, skipping...", part->shape);641 Hprintf("MeshBuilder::PartSurface", "initialize", HMLV_WARN, "Part shape=%d not supported, skipping...", part->shape); 642 642 } 643 643 } … … 725 725 726 726 default: 727 FMprintf("MeshBuilder::PartApices", "initialize", FMLV_WARN, "Part shape=%d not supported, skipping...", part->shape);727 Hprintf("MeshBuilder::PartApices", "initialize", HMLV_WARN, "Part shape=%d not supported, skipping...", part->shape); 728 728 } 729 729 } -
cpp/frams/model/geometry/modelgeometryinfo.cpp
r286 r372 16 16 if (points.size() < 1) //maybe 1 or 2 points are also not enough for findSizesAndAxesOfPointsGroup() to work... 17 17 { 18 FMprintf("ModelGeometryInfo", "findSizesAndAxesOfModel", FMLV_ERROR, "Empty points sample for model with %d part(s)", model.getPartCount());18 Hprintf("ModelGeometryInfo", "findSizesAndAxesOfModel", HMLV_ERROR, "Empty points sample for model with %d part(s)", model.getPartCount()); 19 19 sizes = Pt3D_0; 20 20 axes = Orient_1; … … 116 116 return externalAreaOfCylinder(model, partIndex, density); 117 117 } 118 FMprintf("ModelGeometryInfo", "externalAreaOfPart", FMLV_ERROR, "Part shape=%d not supported", part->shape);118 Hprintf("ModelGeometryInfo", "externalAreaOfPart", HMLV_ERROR, "Part shape=%d not supported", part->shape); 119 119 return 0; 120 120 } -
cpp/frams/model/model.cpp
r348 r372 5 5 #include <common/nonstd_math.h> 6 6 #include "model.h" 7 #include <common/ framsg.h>7 #include <common/hmessage.h> 8 8 #include <frams/util/multimap.h> 9 #include <frams/ errmgr/errmanager.h>9 #include <frams/mhandlers/mhandlers.h> 10 10 11 11 Model::Model() … … 317 317 SString line; 318 318 MultiRange frommap; 319 ErrorHandler err(ErrorHandler::DontBlock);319 MessageHandlerToMemory mh(MessageHandlerBase::Enable | MessageHandlerBase::DontBlock); 320 320 for (;f0txt.getNextToken(pos,line,'\n');lnum++) 321 321 { … … 325 325 frommap.add(lastpos,pos-1); 326 326 } 327 err.reset();327 mh.reset(); 328 328 if (singleStepBuild(line,autobuildmaps ? (&frommap) : 0)==-1) 329 329 { 330 330 buildstatus=invalid; 331 FMprintf("Model","build",FMLV_ERROR,331 Hprintf("Model","build",HMLV_ERROR, 332 332 geno.getName().len()?"illegal f0 code at line %d (%s)":"illegal f0 code at line %d", 333 333 lnum,geno.getName().c_str()); … … 336 336 return; 337 337 } 338 if ( err.getWarningCount())338 if (mh.getWarningCount()) 339 339 {if (f0warnposition<0) f0warnposition=lastpos;} 340 340 lastpos=pos; 341 341 } 342 err.disable();342 mh.disable(); 343 343 close(); 344 344 if (convmap) … … 513 513 { 514 514 if (buildstatus!=building) 515 FMprintf("Model","close",FMLV_WARN,"unexpected close() - no open()");515 Hprintf("Model","close",HMLV_WARN,"unexpected close() - no open()"); 516 516 if (internalcheck(1)>0) 517 517 { … … 609 609 { 610 610 delete j; 611 FMprintf("Model","build",FMLV_ERROR,611 Hprintf("Model","build",HMLV_ERROR, 612 612 "invalid part reference for joint #%d",getJointCount()-1); 613 613 return -1; … … 694 694 return 0; 695 695 } 696 FMprintf("Model","build",FMLV_ERROR,696 Hprintf("Model","build",HMLV_ERROR, 697 697 "invalid neuron connection #%d <- #%d",c.n1_refno,c.n2_refno); 698 698 return -1; … … 782 782 else 783 783 { 784 FMprintf("Model","internalCheck",FMLV_ERROR,784 Hprintf("Model","internalCheck",HMLV_ERROR, 785 785 "illegal N-N connection #%d (reference to #%d) (%s)", 786 786 i,n->conn_refno,(const char*)geno.getName()); … … 853 853 if (var -> field < getMin ## template () . field) \ 854 854 { var->field= getMin ## template () . field; \ 855 FMprintf("Model","internalCheck",FMLV_WARN,# field " too small in " # template "#%d (adjusted)",i);} \855 Hprintf("Model","internalCheck",HMLV_WARN,# field " too small in " # template "#%d (adjusted)",i);} \ 856 856 else if (var -> field > getMax ## template () . field) \ 857 857 { var->field= getMax ## template () . field; \ 858 FMprintf("Model","internalCheck",FMLV_WARN,# field " too big in " # template "#%d (adjusted)",i);}858 Hprintf("Model","internalCheck",HMLV_WARN,# field " too big in " # template "#%d (adjusted)",i);} 859 859 860 860 #define LINKFLAG 0x8000000 … … 912 912 { 913 913 shape=SHAPE_ILLEGAL; 914 FMprintf("Model","internalCheck",FMLV_WARN,"Inconsistent part shapes (mixed old and new shapes)");914 Hprintf("Model","internalCheck",HMLV_WARN,"Inconsistent part shapes (mixed old and new shapes)"); 915 915 } 916 916 } … … 941 941 { 942 942 ret=0; 943 FMprintf("Model","internalCheck",FMLV_ERROR,943 Hprintf("Model","internalCheck",HMLV_ERROR, 944 944 "delta joint cycle detected at joint#%d (%s)", 945 945 i,geno.getName().c_str()); … … 978 978 { 979 979 ret=0; 980 FMprintf("Model","internalCheck",FMLV_ERROR,"delta too big in joint #%d (%s)",980 Hprintf("Model","internalCheck",HMLV_ERROR,"delta too big in joint #%d (%s)", 981 981 i,geno.getName().c_str()); 982 982 } … … 984 984 { 985 985 ret=0; 986 FMprintf("Model","internalCheck",FMLV_ERROR,"delta too small in joint #%d (%s)",986 Hprintf("Model","internalCheck",HMLV_ERROR,"delta too small in joint #%d (%s)", 987 987 i,geno.getName().c_str()); 988 988 } … … 992 992 else 993 993 { 994 FMprintf("Model","internalCheck",FMLV_ERROR,"illegal part references in joint #%d (%s)",994 Hprintf("Model","internalCheck",HMLV_ERROR,"illegal part references in joint #%d (%s)", 995 995 i,geno.getName().c_str()); 996 996 ret=0; … … 1001 1001 { 1002 1002 shape=SHAPE_ILLEGAL; 1003 FMprintf("Model","internalCheck",FMLV_WARN,"Inconsistent joint shapes (mixed old and new shapes)");1003 Hprintf("Model","internalCheck",HMLV_WARN,"Inconsistent joint shapes (mixed old and new shapes)"); 1004 1004 } 1005 1005 } … … 1071 1071 if (!(p->flags&LINKFLAG)) 1072 1072 { 1073 FMprintf("Model","internalCheck",FMLV_ERROR,"not all parts connected (eg.#0-#%d) (%s)",1073 Hprintf("Model","internalCheck",HMLV_ERROR,"not all parts connected (eg.#0-#%d) (%s)", 1074 1074 i,geno.getName().c_str()); 1075 1075 ret=0; … … 1084 1084 if (j->p1_refno==j->p2_refno) 1085 1085 { 1086 FMprintf("Model","internalCheck",FMLV_ERROR,"illegal self connection, joint #%d (%s)",1086 Hprintf("Model","internalCheck",HMLV_ERROR,"illegal self connection, joint #%d (%s)", 1087 1087 i,geno.getName().c_str()); 1088 1088 ret=0; … … 1095 1095 || ((j->p1_refno==j2->p2_refno)&&(j->p2_refno==j2->p1_refno))) 1096 1096 { 1097 FMprintf("Model","internalCheck",FMLV_ERROR,"illegal duplicate joints #%d and #%d (%s)",1097 Hprintf("Model","internalCheck",HMLV_ERROR,"illegal duplicate joints #%d and #%d (%s)", 1098 1098 i,k,geno.getName().c_str()); 1099 1099 ret=0; … … 1125 1125 { 1126 1126 if (buildstatus==building) 1127 FMprintf("Model","getGeno",FMLV_WARN,"model was not completed - missing close()");1127 Hprintf("Model","getGeno",HMLV_WARN,"model was not completed - missing close()"); 1128 1128 if (buildstatus!=valid) 1129 1129 return Geno("",'0',"","invalid"); -
cpp/frams/neuro/neurofactory.cpp
r348 r372 98 98 } 99 99 if (removed.len()) 100 FMprintf("NeuroFactory","removeUninmplemented",FMLV_INFO,100 Hprintf("NeuroFactory","removeUninmplemented",HMLV_INFO, 101 101 "Removed Neuro classes: %s",removed.c_str()); 102 102 } -
cpp/frams/neuro/neuroimpl.cpp
r348 r372 72 72 n->userdata[mytags_id]=ni; 73 73 if (!ni) { errorcount++; 74 FMprintf("NeuroNetImpl","create",FMLV_WARN,"neuron #%d (%s) implementation not available",74 Hprintf("NeuroNetImpl","create",HMLV_WARN,"neuron #%d (%s) implementation not available", 75 75 i,n->getClassName().c_str()); 76 76 continue; } // implementation not available?! … … 87 87 if (!ni->lateinit()) 88 88 { ni->status=NeuroImpl::InitError; errorcount++; 89 FMprintf("NeuroNetImpl","create",FMLV_WARN,"neuron #%d (%s) initialization failed",89 Hprintf("NeuroNetImpl","create",HMLV_WARN,"neuron #%d (%s) initialization failed", 90 90 i,n->getClassName().c_str()); 91 91 continue; } -
cpp/frams/neuro/neuroimpl.h
r286 r372 8 8 #include <frams/model/model.h> 9 9 #include <frams/param/param.h> 10 #include <common/ framsg.h>10 #include <common/hmessage.h> 11 11 #ifdef NEURO_SIGNALS 12 12 #include <frams/simul/signals.h> -
cpp/frams/param/multiparamload.cpp
r348 r372 5 5 #include "multiparamload.h" 6 6 #include <frams/util/sstringutils.h> 7 #include "common/ framsg.h"7 #include "common/hmessage.h" 8 8 #include <ctype.h> 9 9 … … 107 107 else if (status==BeforeUnknown) 108 108 { 109 FMprintf("MultiParamLoader","go",FMLV_WARN,"Skipping object '%s'",lastunknown.c_str());109 Hprintf("MultiParamLoader","go",HMLV_WARN,"Skipping object '%s'",lastunknown.c_str()); 110 110 loadObjectNow(&emptyparam,false); 111 111 continue; … … 137 137 { 138 138 const char* thisfilename=file->VgetPath(); 139 FMprintf("MultiParamLoader","go",FMLV_WARN,"invalid \"%s\"%s%s",buf.c_str(),139 Hprintf("MultiParamLoader","go",HMLV_WARN,"invalid \"%s\"%s%s",buf.c_str(), 140 140 (thisfilename?" in ":""),(thisfilename?thisfilename:"")); 141 141 } … … 204 204 if (alreadyIncluded(newfilename.c_str())) 205 205 { 206 FMprintf("MultiParamLoader","include",FMLV_WARN,"circular reference ignored (\"%s\")",206 Hprintf("MultiParamLoader","include",HMLV_WARN,"circular reference ignored (\"%s\")", 207 207 filename.c_str()); 208 208 return; … … 212 212 if (!f) 213 213 { 214 FMprintf("MultiParamLoader","include",FMLV_WARN,"\"%s\" not found",newfilename.c_str());214 Hprintf("MultiParamLoader","include",HMLV_WARN,"\"%s\" not found",newfilename.c_str()); 215 215 } 216 216 else -
cpp/frams/param/param.cpp
r366 r372 8 8 #include "param.h" 9 9 #include <frams/util/extvalue.h> 10 #include "common/ framsg.h"10 #include "common/hmessage.h" 11 11 #include <frams/util/sstringutils.h> 12 12 … … 445 445 { 446 446 SString name(p0, p_len); 447 FMprintf("ParamInterface", "load", FMLV_WARN, "Ignored unknown property '%s' while reading object '%s'", name.c_str(), getName());447 Hprintf("ParamInterface", "load", HMLV_WARN, "Ignored unknown property '%s' while reading object '%s'", name.c_str(), getName()); 448 448 } 449 449 … … 518 518 case 'o': ret.setObject(getObject(i)); break; 519 519 case 'x': ret = getExtValue(i); break; 520 default: FMprintf("ParamInterface", "get", FMLV_ERROR, "'%s.%s' is not a field", getName(), id(i));520 default: Hprintf("ParamInterface", "get", HMLV_ERROR, "'%s.%s' is not a field", getName(), id(i)); 521 521 } 522 522 } … … 562 562 if (v.type == TObj) 563 563 { 564 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting integer value from object reference (%s)", v.getString().c_str());564 Hprintf("ParamInterface", "set", HMLV_WARN, "Getting integer value from object reference (%s)", v.getString().c_str()); 565 565 return 0; 566 566 } … … 574 574 if (v.type == TObj) 575 575 { 576 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting floating point value from object reference (%s)", v.getString().c_str());576 Hprintf("ParamInterface", "set", HMLV_WARN, "Getting floating point value from object reference (%s)", v.getString().c_str()); 577 577 return 0; 578 578 } … … 583 583 case 'o': return setObject(i, v.getObject()); 584 584 case 'x': return setExtValue(i, v); 585 default: FMprintf("ParamInterface", "set", FMLV_ERROR, "'%s.%s' is not a field", getName(), id(i));585 default: Hprintf("ParamInterface", "set", HMLV_ERROR, "'%s.%s' is not a field", getName(), id(i)); 586 586 } 587 587 return 0; … … 605 605 if ((after == NULL) || (*after)) 606 606 { 607 FMprintf("ParamInterface", "set", FMLV_WARN, "serialization format mismatch in %s.%s", (getName() ? getName() : "<Unknown>"), id(i));607 Hprintf("ParamInterface", "set", HMLV_WARN, "serialization format mismatch in %s.%s", (getName() ? getName() : "<Unknown>"), id(i)); 608 608 e.setEmpty(); 609 609 } … … 690 690 } 691 691 if (err!=NULL) 692 FMprintf("SimpleAbstractParam","sanityCheck", FMLV_ERROR,692 Hprintf("SimpleAbstractParam","sanityCheck", HMLV_ERROR, 693 693 "Invalid ParamEntry for %s.%s (%s)", getName(), pe->id, err); 694 694 } … … 961 961 else 962 962 { 963 FMprintf("SimpleAbstractParam", "call", FMLV_ERROR,963 Hprintf("SimpleAbstractParam", "call", HMLV_ERROR, 964 964 (*pe->type != 'p') ? "'%s.%s' is not a function" : "Internal error - undefined function pointer for '%s.%s'", getName(), pe->id); 965 965 ret->setInvalid(); … … 1060 1060 { 1061 1061 SString name(t, (int)(equals_sign - t)); 1062 FMprintf("Param", "load2", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", name.c_str(), getName());1062 Hprintf("Param", "load2", HMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", name.c_str(), getName()); 1063 1063 } 1064 1064 t = equals_sign + 1; // t=value … … 1070 1070 #endif 1071 1071 { 1072 FMprintf("Param", "load2", FMLV_WARN, "Missing property name in '%s' (assuming '%s')",1072 Hprintf("Param", "load2", HMLV_WARN, "Missing property name in '%s' (assuming '%s')", 1073 1073 getName(), id(i) ? id(i) : "unknown property?"); 1074 1074 } … … 1092 1092 fields_loaded++; 1093 1093 if (ret&(PSET_HITMAX | PSET_HITMIN)) 1094 FMprintf("Param", "load2", FMLV_WARN, "Adjusted '%s' in '%s' (was too %s)",1094 Hprintf("Param", "load2", HMLV_WARN, "Adjusted '%s' in '%s' (was too %s)", 1095 1095 id(i), getName(), (ret&PSET_HITMAX) ? "big" : "small"); 1096 1096 *(char*)valstop = remember; -
cpp/frams/param/param.h
r348 r372 12 12 #include <frams/util/statrick.h> 13 13 #include <frams/virtfile/virtfile.h> 14 #include <common/ framsg.h>14 #include <common/hmessage.h> 15 15 16 16 class ExtValue; … … 273 273 SString svaluetoset = SString::valueOf(valuetoset); //converts any type to SString 274 274 SString actual = get(i); 275 FMprintf("Param", "set", FMLV_WARN, "Setting '%s.%s = %s' exceeded allowed range (too %s). Adjusted to %s.",275 Hprintf("Param", "set", HMLV_WARN, "Setting '%s.%s = %s' exceeded allowed range (too %s). Adjusted to %s.", 276 276 getName(), id(i), svaluetoset.c_str(), (setflags&PSET_HITMAX) ? "big" : "small", actual.c_str()); 277 277 } -
cpp/frams/util/3d.cpp
r321 r372 4 4 5 5 #include <common/nonstd_math.h> 6 #include <common/ framsg.h>6 #include <common/hmessage.h> 7 7 #include "3d.h" 8 8 … … 17 17 { 18 18 double q = x*x + y*y + z*z; 19 if (q < 0) { if (report_errors) FMprintf("Pt3D", "operator()", FMLV_ERROR, "sqrt(%g): domain error", q); return 0; }19 if (q < 0) { if (report_errors) Hprintf("Pt3D", "operator()", HMLV_ERROR, "sqrt(%g): domain error", q); return 0; } 20 20 return sqrt(q); 21 21 } … … 24 24 { 25 25 double len = length(); 26 if (fabs(len) < 1e-50) { if (report_errors) FMprintf("Pt3D", "normalize()", FMLV_WARN, "vector[%g,%g,%g] too small", x, y, z); x = 1; y = 0; z = 0; return false; }26 if (fabs(len) < 1e-50) { if (report_errors) Hprintf("Pt3D", "normalize()", HMLV_WARN, "vector[%g,%g,%g] too small", x, y, z); x = 1; y = 0; z = 0; return false; } 27 27 operator/=(len); 28 28 return true; … … 64 64 if (dx == 0 && dy == 0) 65 65 { 66 if (report_errors) FMprintf("Pt3D", "getAngle()", FMLV_WARN, "atan2(%g,%g)", dy, dx);66 if (report_errors) Hprintf("Pt3D", "getAngle()", HMLV_WARN, "atan2(%g,%g)", dy, dx); 67 67 return 0; // incorrect result, but there is no correct one 68 68 } … … 147 147 { 148 148 double q = x*x + y*y; 149 if (q < 0) { if (Pt3D::report_errors) FMprintf("", "d2()", FMLV_ERROR, "sqrt(%g): domain error", q); return 0; }149 if (q < 0) { if (Pt3D::report_errors) Hprintf("", "d2()", HMLV_ERROR, "sqrt(%g): domain error", q); return 0; } 150 150 return sqrt(q); 151 151 } -
cpp/frams/util/extvalue.cpp
r371 r372 98 98 if (warn) 99 99 { 100 FMprintf("ExtValue", "getObjectTarget", FMLV_WARN, "%s object expected, %s found", classname, interfaceName());100 Hprintf("ExtValue", "getObjectTarget", HMLV_WARN, "%s object expected, %s found", classname, interfaceName()); 101 101 } 102 102 … … 269 269 if (tmp.len() > 30) tmp = tmp.substr(0, 30) + "..."; 270 270 if (type == TString) tmp = SString("\"") + tmp + SString("\""); 271 FMprintf("ExtValue", "getObjectTarget", FMLV_WARN, "%s object expected, %s found", classname, tmp.c_str());271 Hprintf("ExtValue", "getObjectTarget", HMLV_WARN, "%s object expected, %s found", classname, tmp.c_str()); 272 272 } 273 273 return NULL; … … 419 419 context->v2->typeAndValue().c_str()); 420 420 } 421 FMprintf("ExtValue", "interpretCompare", FMLV_ERROR, "%s", msg.c_str());421 Hprintf("ExtValue", "interpretCompare", HMLV_ERROR, "%s", msg.c_str()); 422 422 ret = -1; 423 423 } … … 448 448 { 449 449 case TDouble: 450 FMprintf("ExtValue", "add", FMLV_WARN, "Adding %s to %s", src.typeAndValue().c_str(), typeAndValue().c_str());450 Hprintf("ExtValue", "add", HMLV_WARN, "Adding %s to %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 451 451 setDouble(double(getInt()) + src.getDouble()); 452 452 return; … … 487 487 default:; 488 488 } 489 FMprintf("ExtValue", "add", FMLV_ERROR, "Can't add %s to %s", src.typeAndValue().c_str(), typeAndValue().c_str());489 Hprintf("ExtValue", "add", HMLV_ERROR, "Can't add %s to %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 490 490 } 491 491 … … 502 502 return; 503 503 case TDouble: 504 FMprintf("ExtValue", "subtract", FMLV_WARN, "Subtracting %s from %s", src.typeAndValue().c_str(), typeAndValue().c_str());504 Hprintf("ExtValue", "subtract", HMLV_WARN, "Subtracting %s from %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 505 505 setDouble(double(getInt()) - src.getDouble()); 506 506 return; … … 520 520 default:; 521 521 } 522 FMprintf("ExtValue", "subtract", FMLV_ERROR, "Can't subtract %s from %s", src.typeAndValue().c_str(), typeAndValue().c_str());522 Hprintf("ExtValue", "subtract", HMLV_ERROR, "Can't subtract %s from %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 523 523 } 524 524 … … 535 535 return; 536 536 case TDouble: 537 FMprintf("ExtValue", "multiply", FMLV_WARN, "Multiplying %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str());537 Hprintf("ExtValue", "multiply", HMLV_WARN, "Multiplying %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 538 538 setDouble(double(getInt())*src.getDouble()); 539 539 return; … … 591 591 default:; 592 592 } 593 FMprintf("ExtValue", "multiply", FMLV_WARN, "Can't multiply %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 594 } 595 596 #include <common/framsg.h> 593 Hprintf("ExtValue", "multiply", HMLV_WARN, "Can't multiply %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 594 } 595 597 596 /*#include "fpu_control.h" 598 597 #include <signal.h> … … 612 611 else 613 612 { 614 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Division by zero: %d/0", idata());613 Hprintf("ExtValue", "divide", HMLV_CRITICAL, "Division by zero: %d/0", idata()); 615 614 setInvalid(); 616 615 } … … 621 620 if (a == 0.0) 622 621 { 623 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Division by zero: %s/0.0", getString().c_str());622 Hprintf("ExtValue", "divide", HMLV_CRITICAL, "Division by zero: %s/0.0", getString().c_str()); 624 623 setInvalid(); 625 624 } … … 630 629 if (!finite(tmp)) 631 630 { 632 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Overflow %s/%g", getString().c_str(), a); setInvalid();631 Hprintf("ExtValue", "divide", HMLV_CRITICAL, "Overflow %s/%g", getString().c_str(), a); setInvalid(); 633 632 } 634 633 else … … 636 635 // niby dobrze ale lepiej byloby to robic bardziej systematycznie a nie tylko w dzieleniu? 637 636 //if (isnan(ddata())) //http://www.digitalmars.com/d/archives/c++/Traping_divide_by_zero_5728.html 638 // { FMprintf("ExtValue","divide",FMLV_ERROR,"not-a-number",(const char*)getString()); setInvalid(); }637 // { Hprintf("ExtValue","divide",HMLV_ERROR,"not-a-number",(const char*)getString()); setInvalid(); } 639 638 fpExceptEnable(); 640 639 } … … 652 651 return; 653 652 case TDouble: 654 FMprintf("ExtValue", "divide", FMLV_WARN, "Dividing %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str());653 Hprintf("ExtValue", "divide", HMLV_WARN, "Dividing %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 655 654 divDouble(src.ddata()); 656 655 return; … … 674 673 default:; 675 674 } 676 FMprintf("ExtValue", "divide", FMLV_ERROR, "Can't divide %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str());675 Hprintf("ExtValue", "divide", HMLV_ERROR, "Can't divide %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 677 676 } 678 677 … … 779 778 780 779 case TObj: case TUnknown: case TInvalid: 781 FMprintf("ExtValue", "modulo", FMLV_WARN, "Can't apply modulo to %s", typeDescription().c_str());780 Hprintf("ExtValue", "modulo", HMLV_WARN, "Can't apply modulo to %s", typeDescription().c_str()); 782 781 783 782 default:; … … 792 791 { 793 792 if (error) 794 FMprintf("ExtValue", "parseInt", FMLV_ERROR, "Could not parse '%s'%s", s, strict ? " (strict)" : "");793 Hprintf("ExtValue", "parseInt", HMLV_ERROR, "Could not parse '%s'%s", s, strict ? " (strict)" : ""); 795 794 return false; 796 795 } … … 806 805 { 807 806 if (error) 808 FMprintf("ExtValue", "parseDouble", FMLV_ERROR, "Could not parse '%s'", s);807 Hprintf("ExtValue", "parseDouble", HMLV_ERROR, "Could not parse '%s'", s); 809 808 return false; 810 809 } … … 837 836 case TString: return getInt(sdata().c_str()); 838 837 case TObj: 839 FMprintf("ExtValue", "getInt", FMLV_WARN, "Getting integer value from object reference (%s)", getString().c_str());838 Hprintf("ExtValue", "getInt", HMLV_WARN, "Getting integer value from object reference (%s)", getString().c_str()); 840 839 return (paInt)(intptr_t)odata().param; 841 840 default:; … … 852 851 case TString: return getDouble(sdata().c_str()); 853 852 case TObj: 854 FMprintf("ExtValue", "getDouble", FMLV_WARN, "Getting floating point value from object reference (%s)", getString().c_str());853 Hprintf("ExtValue", "getDouble", HMLV_WARN, "Getting floating point value from object reference (%s)", getString().c_str()); 855 854 return (double)(intptr_t)odata().param; 856 855 default:; … … 990 989 else 991 990 { 992 FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Missing '\"' in string: '%s'", ret);991 Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Missing '\"' in string: '%s'", ret); 993 992 return NULL; 994 993 } … … 1012 1011 else if (*p != ']') 1013 1012 { 1014 FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Missing ',' in Vector: '%s'", p);1013 Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Missing ',' in Vector: '%s'", p); 1015 1014 return NULL; 1016 1015 } … … 1038 1037 if ((!ret) || (args[1].getType() != TString)) { p = NULL; break; } 1039 1038 p = ret; 1040 if (*p != ':') { FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Missing ':' in Dictionary: '%s'", p); p = NULL; break; }1039 if (*p != ':') { Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Missing ':' in Dictionary: '%s'", p); p = NULL; break; } 1041 1040 p++; 1042 1041 ret = args[0].deserialize(p); … … 1047 1046 else if (*p != '}') 1048 1047 { 1049 FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Missing ',' in Dictionary: '%s'", p);1048 Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Missing ',' in Dictionary: '%s'", p); 1050 1049 return NULL; 1051 1050 } … … 1087 1086 } 1088 1087 } 1089 FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Invalid reference: '%s'", in - 1);1088 Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Invalid reference: '%s'", in - 1); 1090 1089 return NULL; 1091 1090 } … … 1134 1133 } 1135 1134 setEmpty(); 1136 FMprintf("ExtValue", "deserialize", FMLV_WARN, "object of class \"%s\" could not be deserialized", clsname.c_str());1135 Hprintf("ExtValue", "deserialize", HMLV_WARN, "object of class \"%s\" could not be deserialized", clsname.c_str()); 1137 1136 return ret; 1138 1137 } 1139 FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Bad syntax: '%s'", in);1138 Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Bad syntax: '%s'", in); 1140 1139 setEmpty(); 1141 1140 return NULL; -
cpp/frams/util/sstringutils.cpp
r348 r372 5 5 #include "sstringutils.h" 6 6 #include <frams/virtfile/virtfile.h> 7 #include <common/ framsg.h>7 #include <common/hmessage.h> 8 8 #include <common/nonstd.h> 9 9 … … 19 19 } 20 20 else if (framsgmodule) 21 FMprintf(framsgmodule, "loadSString", FMLV_WARN, error ? error : "can't open file \"%s\"", filename);21 Hprintf(framsgmodule, "loadSString", HMLV_WARN, error ? error : "can't open file \"%s\"", filename); 22 22 return ret; 23 23 } -
cpp/frams/virtfile/stdiofile.cpp
r298 r372 6 6 #include <common/nonstd_dir.h> 7 7 #include <common/nonstd_stdio.h> 8 #include <common/ framsg.h>8 #include <common/hmessage.h> 9 9 #include <common/Convert.h> 10 10 11 11 VirtFILE* StdioFileSystem::Vfopen(const char *path, const char *mode) 12 12 { 13 //print FM("Vfopen %s %s",path,mode);13 //printH("Vfopen %s %s",path,mode); 14 14 #ifdef _WIN32 15 15 FILE *f = _wfopen(Convert::utf8ToUtf16(path).c_str(), Convert::strTOwstr(mode).c_str()); … … 21 21 #endif 22 22 #endif 23 //print FM("%p",f);23 //printH("%p",f); 24 24 if (f) return new StdioFILE(f, path); else return NULL; 25 25 } … … 27 27 VirtDIR* StdioFileSystem::Vopendir(const char* path) 28 28 { 29 //print FM("Vopendir %s",path);29 //printH("Vopendir %s",path); 30 30 #ifdef _WIN32 31 31 DIRTYPE *d = wopendir(Convert::utf8ToUtf16(path).c_str()); … … 33 33 DIR *d = opendir(path); 34 34 #endif 35 //print FM("%p",d);35 //printH("%p",d); 36 36 if (d) return new StdioDIR(d); else return NULL; 37 37 } … … 56 56 dirent* StdioDIR::Vreaddir() 57 57 { 58 //print FM("Vreaddir %s",dir);58 //printH("Vreaddir %s",dir); 59 59 #ifdef _WIN32 60 60 wdirent *wde=wreaddir(dir); -
cpp/frams/vm/classes/collectionobj.cpp
r371 r372 5 5 #include "collectionobj.h" 6 6 #include <common/nonstd_math.h> //sqrt in borland 7 #include <frams/ errmgr/stderrors.h>7 #include <frams/mhandlers/stderrors.h> 8 8 #include <common/nonstd_stl.h> 9 9 #include <frams/util/sstringutils.h> … … 232 232 { 233 233 ret=false; 234 FMprintf("VectorElementComparator","",FMLV_ERROR,"Comparison function returned no value");234 Hprintf("VectorElementComparator","",HMLV_ERROR,"Comparison function returned no value"); 235 235 } 236 236 else
Note: See TracChangeset
for help on using the changeset viewer.