Changeset 372


Ignore:
Timestamp:
04/22/15 04:14:59 (10 years ago)
Author:
sz
Message:

Renamed some classes and functions to make their purpose more obvious:

All MessageHandlers? must now be given the explicit "Enable" argument if you want them to automatically become active. This makes side effects clearly visible.

Location:
cpp
Files:
4 deleted
39 edited
5 copied
3 moved

Legend:

Unmodified
Added
Removed
  • cpp/common/hmessage.cpp

    r371 r372  
    33// See LICENSE.txt for details.
    44
    5 #include "framsg.h"
     5#include "hmessage.h"
    66#include <common/nonstd_stdio.h>
    77#include "stl-util.h"
    88#include "Convert.h"
    99
    10 const char* MSG_LEVEL[]={"[DEBUG] ","","[WARN] ","[ERROR] ","[CRITICAL] "};
     10const char* HMSG_LEVEL[]={"[DEBUG] ","","[WARN] ","[ERROR] ","[CRITICAL] "};
    1111
    12 void FramMessage(const char *o, const char *m, const char *txt, int w)
     12void Hmessage(const char *o, const char *m, const char *txt, int w)
    1313{
    1414        int line = 0; //all lines except the first one get the "..." prefix
     
    2424                {
    2525                        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);
    2727                        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);
    2929                }
    3030                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 simple
     31                        _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
    3232                line++;
    3333                if ((nextsep[0] == '\r') && (nextsep[1] == '\n'))
     
    3939
    4040
    41 void FMprintf_va(const char *o,const char *m,int w,const char *bl,va_list va)
     41void Hprintf_va(const char *o,const char *m,int w,const char *bl,va_list va)
    4242{
    4343        string buf=ssprintf_va(bl,va);
    44         FramMessage(o,m,buf.c_str(),w);
     44        Hmessage(o,m,buf.c_str(),w);
    4545}
    4646
    47 void FMprintf(const char *o,const char *m,int w,const char *bl, ...)
     47void Hprintf(const char *o,const char *m,int w,const char *bl, ...)
    4848{
    4949        va_list argptr;
    5050        va_start(argptr,bl);
    51         FMprintf_va(o,m,w,bl,argptr);
     51        Hprintf_va(o,m,w,bl,argptr);
    5252        va_end(argptr);
    5353}
    5454
    55 void printFM(const char *bl,...)
     55void printH(const char *bl,...)
    5656{
    5757        va_list argptr;
    5858        va_start(argptr,bl);
    59         FMprintf_va("Message","printf",FMLV_INFO,bl,argptr);
     59        Hprintf_va("Message","printf",HMLV_INFO,bl,argptr);
    6060        va_end(argptr);
    6161}
  • cpp/common/hmessage.h

    r371 r372  
    33// See LICENSE.txt for details.
    44
    5 #ifndef _FRAMSG_H_
    6 #define _FRAMSG_H_
     5#ifndef _HMESSAGE_H_
     6#define _HMESSAGE_H_
    77
    88#include <stdarg.h>
    99
    10 extern const char* MSG_LEVEL[];
    11 #define FRAMSG_FORMAT "%s%s.%s: %s"
    12 #define FRAMSG_MULTILINE_CONTINUATION "..."
     10extern const char* HMSG_LEVEL[];
     11#define HMSG_FORMAT "%s%s.%s: %s"
     12#define HMSG_MULTILINE_CONTINUATION "..."
    1313
    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 function
    16 void printFM(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);
     14void Hprintf(const char *o,const char *m,int w,const char *bl, ...);
     15void 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
     16void 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)
     17void Hmessage(const char *o,const char *m,const char *txt,int w);
    1818
    19 void _FramMessageSingleLine(const char *o,const char *m,const char *txt,int w); //don't call this directly - it is used internally
     19void _HmessageSingleLine(const char *o,const char *m,const char *txt,int w); //don't call this directly - it is used internally
    2020
    21 #define FMLV_DEBUG -1
    22 #define FMLV_INFO 0
    23 #define FMLV_WARN 1
    24 #define FMLV_ERROR 2
    25 #define FMLV_CRITICAL 3
     21#define HMLV_DEBUG -1
     22#define HMLV_INFO 0
     23#define HMLV_WARN 1
     24#define HMLV_ERROR 2
     25#define HMLV_CRITICAL 3
    2626
    2727/*
  • cpp/common/nonstd_math.cpp

    r286 r372  
    8181// 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)
    8282
    83 #include "framsg.h"
     83#include "hmessage.h"
    8484
    8585unsigned int fp_control_word_std;
     
    8989{
    9090        //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);
    9292        fp_control_word_std=_control87(0, 0);             //4978 = 1001101110010
    9393        // Make the new fp env same as the old one, except for the changes we're going to make
     
    9898{
    9999        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);
    101101        _control87(fp_control_word_std, 0xffffffff);
    102         //FMprintf("","fpExceptEnable ",FMLV_INFO,"control87 flags are %08x", _control87(0, 0)); //kontrola co sie ustawilo
     102        //Hprintf("","fpExceptEnable ",HMLV_INFO,"control87 flags are %08x", _control87(0, 0)); //kontrola co sie ustawilo
    103103}
    104104
     
    106106{
    107107        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);
    109109        _control87(fp_control_word_muted, 0xffffffff);
    110         //FMprintf("","fpExceptDisable",FMLV_INFO,"control87 flags are %08x", _control87(0, 0)); //kontrola co sie ustawilo
     110        //Hprintf("","fpExceptDisable",HMLV_INFO,"control87 flags are %08x", _control87(0, 0)); //kontrola co sie ustawilo
    111111}
    112112
  • cpp/common/nonstd_stdio.cpp

    r297 r372  
    241241
    242242#ifdef __ANDROID__
    243 #include "framsg.h"
     243#include "hmessage.h"
    244244#include "nonstd.h"
    245245#include "nonstd_stl.h"
     
    247247{
    248248        string respath=getAppResourcesDir();
    249         //printFM("Opening '%s', mode='%s'",path,mode);
    250         //printFM("getAppResourcesDir()='%s'",respath.c_str());
     249        //printH("Opening '%s', mode='%s'",path,mode);
     250        //printH("getAppResourcesDir()='%s'",respath.c_str());
    251251        NvFile *rfile=NULL; //can only read
    252252        FILE *rwfile=NULL;
     
    255255                path+=respath.length(); //strip the prefix, we need a relative path in assets
    256256                if (strstr(mode,"w"))
    257                         printFM("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);
    258258                rfile=NvFOpen(path); //"mode" not supported! can only read
    259                 //printFM("Opened RES file as %p",rfile);
     259                //printH("Opened RES file as %p",rfile);
    260260                if (rfile==NULL) return NULL;
    261261        } else //a "normal" access (HOME)
    262262        {
    263263                rwfile=fopen(path,mode);
    264                 //printFM("Opened HOME file as %p",rwfile);
     264                //printH("Opened HOME file as %p",rwfile);
    265265                if (rwfile==NULL) return NULL;
    266266        }
  • cpp/common/stl-util.cpp

    r319 r372  
    99#include "Convert.h"
    1010#include "nonstd.h"
    11 #include "framsg.h"
     11#include "hmessage.h"
    1212#include <assert.h>
    1313#ifdef USE_VIRTFILE
     
    107107        }
    108108        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);
    110110        return ok;
    111111}
     
    137137        }
    138138        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);
    140140        return ok;
    141141}
  • cpp/frams/Makefile-SDK-files

    r365 r372  
    22
    33# 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}
     4ALL_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}
    55
    66GENMANF4=frams/genetics/f4/oper_f4.o
     
    1919GENMAN_COMMON_OBJS=frams/genetics/genman.o frams/param/mutableparam.o frams/param/mutparamlist.o frams/neuro/geneticneuroparam.o frams/neuro/neurolibparam.o
    2020
    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.o
     21SDK_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
    2222
    2323GEOMETRY_OBJS=frams/model/geometry/meshbuilder.o frams/model/geometry/modelgeometryinfo.o frams/model/geometry/geometryutils.o
     
    2525#### sdk_tests
    2626
    27 GENOMANIPULATION_OBJS= frams/_demos/genomanipulation.o frams/errmgr/stdouterr.o frams/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
     27GENOMANIPULATION_OBJS= frams/_demos/genomanipulation.o frams/mhandlers/stdouthandler.o frams/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    2828
    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)
     29MULTILINE_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)
    3030
    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)
     31F0_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)
    3232
    3333LOADER_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)
    3434
    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)
     35LOADER_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)
    3636
    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)
     37GENOCONV_TEST_OBJS= frams/_demos/genoconv_test.o frams/_demos/printconvmap.o frams/mhandlers/stdouthandler.o frams/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
    3838
    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)
     39GENO_TEST_OBJS= frams/_demos/geno_test.o frams/virtfile/virtfile.o frams/mhandlers/stdouthandler.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    4040
    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)
     41GENOOPER_TEST_OBJS=frams/_demos/genooper_test.o frams/virtfile/virtfile.o frams/mhandlers/stdouthandler.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    4242
    4343GENOOPER_TEST_FTEST_OBJS=frams/_demos/genooper_test_fTest.o frams/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) $(GENMAN_FT)
    4444
    45 NEURO_TEST_OBJS= frams/_demos/neuro_test.o frams/errmgr/stdouterr.o frams/virtfile/virtfile.o \
     45NEURO_TEST_OBJS= frams/_demos/neuro_test.o frams/mhandlers/stdouthandler.o frams/virtfile/virtfile.o \
    4646        frams/neuro/neuroimpl.o frams/neuro/neurofactory.o frams/neuro/impl/neuroimpl-simple.o frams/neuro/impl/neuroimpl-channels.o \
    4747        frams/neuro/impl/neuroimpl-fuzzy.o frams/neuro/impl/neuroimpl-fuzzy-f0.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    4848
    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)
     49FULL_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)
    5050
    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)
     51SHAPECONVERT_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)
    5252
    5353SERIAL_TEST_OBJS= frams/_demos/serial_test.o frams/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
     
    5555PART_SHAPES_OBJS= frams/_demos/part_shapes.o frams/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
    5656
    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.o
     57NEURO_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
    5858
    5959GEOMETRY_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)
     
    6666
    6767SIMIL_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)
    6969
    7070SIMIL_UNITTESTS_OBJS=frams/_demos/simil_unittests.o frams/model/similarity/simil_match.o
  • cpp/frams/Makefile-maintain

    r353 r372  
    44endif
    55
     6MISSING_ALL_DIRS=$(strip $(foreach DIR,$(shell echo $(ALL_DIRS)), $(if $(wildcard $(DIR)),,$(DIR))))
     7
    68clean:
    79ifeq "$(ALL_DIRS)$(ALL_DIRS)" ""
    810        @echo "Makefile-maintain clean: ALL_DIRS and/or EXTRA_CLEAN_FILES must be defined"
    911else
     12        @echo -e -n $(if $(MISSING_ALL_DIRS),\\nMissing ALL_DIRS paths:\\n$(MISSING_ALL_DIRS)\\n\\n)
    1013        rm -f $(EXTRA_CLEAN_FILES) $(ALL_DIRS)/*.{a,o,d}
    1114endif
  • cpp/frams/_demos/f0_variants_test.cpp

    r348 r372  
    1010#include <frams/genetics/defgenoconv.h>
    1111#include <frams/model/model.h>
    12 #include <frams/errmgr/stdouterr.h>
     12#include <frams/mhandlers/stdouthandler.h>
    1313
    1414void save_as_f0(SString &gen,Model &m,bool omit_default_values)
     
    7474int main(int argc,char*argv[])
    7575{
    76 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output)
     76MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable);
    7777
    7878//without converters the application would only handle "format 0" genotypes
  • cpp/frams/_demos/full_props.cpp

    r348 r372  
    99
    1010#include <frams/model/model.h>
    11 #include <frams/errmgr/stdouterr.h>
     11#include <frams/mhandlers/stdouthandler.h>
    1212#include <frams/genetics/preconfigured.h>
    1313
     
    5050{
    5151StdioFILE::setStdio();//setup VirtFILE::Vstdin/out/err
    52 StdoutErrorHandler err(ErrorHandlerBase::DontBlock,VirtFILE::Vstderr); //errors -> stderr, don't interfere with stdout
     52MessageHandlerToStdout messages_to_stderr(MessageHandlerBase::Enable | MessageHandlerBase::DontBlock,VirtFILE::Vstderr); //errors -> stderr, don't interfere with stdout
    5353
    5454PreconfiguredGenetics genetics;
     
    7979if (!m.isValid())
    8080        {
    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");
    8282        return 2;       
    8383        }
  • cpp/frams/_demos/geno_test.cpp

    r365 r372  
    66#include <frams/util/sstringutils.h>
    77#include <frams/genetics/preconfigured.h>
    8 #include <frams/errmgr/stdouterr.h>
     8#include <frams/mhandlers/stdouthandler.h>
    99
    1010/**
     
    1818{
    1919        PreconfiguredGenetics genetics;
    20         StdoutErrorHandler stdouterr; //comment this object out to mute error/warning messages
     20        MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); //comment this object out to mute error/warning messages
    2121
    2222        if (argc <= 1)
  • cpp/frams/_demos/genoconv_test.cpp

    r348 r372  
    99
    1010#include "printconvmap.h"
    11 #include <frams/errmgr/stdouterr.h>
     11#include <frams/mhandlers/stdouthandler.h>
    1212
    1313/**
     
    117117int main(int argc,char *argv[])
    118118{
    119 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output)
     119MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable);
    120120
    121121DefaultGenoConvManager gcm;
  • cpp/frams/_demos/genomanipulation.cpp

    r348 r372  
    1010#include <frams/model/model.h>
    1111#include <frams/genetics/preconfigured.h>
    12 #include <frams/errmgr/stdouterr.h>
     12#include <frams/mhandlers/stdouthandler.h>
    1313
    1414/**
     
    266266int main(int argc,char*argv[])
    267267{
    268 StdoutErrorHandler err; //redirect model-related errors to stdout
     268MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable); //redirect model-related errors to stdout
    269269
    270270srand(time(0));
  • cpp/frams/_demos/genooper_test.cpp

    r348 r372  
    33// See LICENSE.txt for details.
    44
    5 #include <frams/errmgr/stdouterr.h>
     5#include <frams/mhandlers/stdouthandler.h>
    66#include <frams/genetics/preconfigured.h>
    77
     
    2121int main(int argc, char *argv[])
    2222{
    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);
    2424        PreconfiguredGenetics genetics;
    2525
  • cpp/frams/_demos/loader_test_param.cpp

    r348 r372  
    55#include <frams/param/multiparamload.h>
    66#include <frams/virtfile/stdiofile.h>
    7 #include <frams/errmgr/stdouterr.h>
     7#include <frams/mhandlers/stdouthandler.h>
    88
    99/**
     
    6666        StdioFILEDontClose virt_stderr(stderr);
    6767        StdioFILEDontClose virt_stdout(stdout);
    68         StdoutErrorHandler error_handler(0, &virt_stderr);
     68        MessageHandlerToStdout messages_to_stderr(MessageHandlerBase::Enable, &virt_stderr);
    6969        StdioFileSystem_autoselect stdiofilesys;
    7070        MultiParamLoader loader(argv[1]);
  • cpp/frams/_demos/multiline_f0_test.cpp

    r348 r372  
    1010#include <frams/genetics/preconfigured.h>
    1111#include <frams/model/model.h>
    12 #include <frams/errmgr/stdouterr.h>
     12#include <frams/mhandlers/stdouthandler.h>
    1313#include <frams/virtfile/stringfile.h>
    1414
    1515int main(int argc,char*argv[])
    1616{
    17 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output)
     17MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable);
    1818PreconfiguredGenetics genetics;
    1919
  • cpp/frams/_demos/neuro_layout_test.cpp

    r348 r372  
    77#include <frams/genetics/preconfigured.h>
    88#include <frams/model/model.h>
    9 #include <frams/errmgr/stdouterr.h>
     9#include <frams/mhandlers/stdouthandler.h>
    1010#include <frams/canvas/nn_layout_model.h>
    1111
     
    8383int main(int argc,char*argv[])
    8484{
    85 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output)
     85MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable);
    8686PreconfiguredGenetics genetics;
    8787
  • cpp/frams/_demos/neuro_test.cpp

    r348 r372  
    99#include <frams/neuro/neuroimpl.h>
    1010#include <frams/neuro/neurofactory.h>
    11 #include <frams/errmgr/stdouterr.h>
     11#include <frams/mhandlers/stdouthandler.h>
    1212
    1313/**
     
    6060int main(int argc,char*argv[])
    6161{
    62 StdoutErrorHandler err;//the default ErrorHandler constructor automatically registers this object to receive framsg messages (and in this case, redirect them to standard output)
     62MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable);
    6363PreconfiguredGenetics genetics;
    6464
  • cpp/frams/_demos/shapeconvert.cpp

    r348 r372  
    99
    1010#include <frams/model/model.h>
    11 #include <frams/errmgr/stdouterr.h>
     11#include <frams/mhandlers/stdouthandler.h>
    1212#include <frams/genetics/preconfigured.h>
    1313
     
    3434{
    3535        StdioFILE::setStdio();//setup VirtFILE::Vstdin/out/err
    36         StdoutErrorHandler err(ErrorHandlerBase::DontBlock, VirtFILE::Vstderr); //errors -> stderr, don't interfere with stdout
     36        MessageHandlerToStdout messages_to_stderr(MessageHandlerBase::Enable | MessageHandlerBase::DontBlock, VirtFILE::Vstderr); //errors -> stderr, don't interfere with stdout
    3737
    3838        PreconfiguredGenetics genetics;
     
    5050                                if ((shape != Part::SHAPE_ELLIPSOID) && (shape != Part::SHAPE_CUBOID) && (shape != Part::SHAPE_CYLINDER))
    5151                                {
    52                                         FMprintf("", "shapeconvert", FMLV_ERROR, "Invalid shape");
     52                                        Hprintf("", "shapeconvert", HMLV_ERROR, "Invalid shape");
    5353                                        return 4;
    5454                                }
     
    7171        if (!m.isValid())
    7272        {
    73                 FMprintf("", "shapeconvert", FMLV_ERROR, "Cannot build Model from the supplied genotype");
     73                Hprintf("", "shapeconvert", HMLV_ERROR, "Cannot build Model from the supplied genotype");
    7474                return 2;
    7575        }
     
    7777        if (m.getShape() != Model::SHAPE_OLD)
    7878        {
    79                 FMprintf("", "shapeconvert", FMLV_ERROR, "Only old style shapes can be converted");
     79                Hprintf("", "shapeconvert", HMLV_ERROR, "Only old style shapes can be converted");
    8080                return 3;
    8181        }
  • cpp/frams/_demos/simil_test.cpp

    r361 r372  
    55
    66#include <vector>
    7 #include "frams/errmgr/stdouterr.h"
     7#include "frams/mhandlers/stdouthandler.h"
    88#include "frams/_demos/genotypeloader.h"
    99#include "frams/genetics/preconfigured.h"
     
    3939int main(int argc, char *argv[])
    4040{
    41     StdoutErrorHandler stdouterr; //comment this object out to mute error/warning messages
     41    MessageHandlerToStdout messages_to_stdout(MessageHandlerBase::Enable);
    4242    typedef double *pDouble;
    4343    int iCurrParam = 0; // index of the currently processed parameter
  • cpp/frams/genetics/f1/conv_f1.cpp

    r348 r372  
    55#include "conv_f1.h"
    66#include <common/nonstd_stl.h>
    7 #include <common/framsg.h>
     7#include <common/hmessage.h>
    88#include <frams/util/multirange.h>
    99#include <frams/util/multimap.h>
     
    6363                if ((n1<0) || (n2<0) || (n1>=neuro_f1_to_f0.size()) || (n2>=neuro_f1_to_f0.size()))
    6464                        {
    65                         if (final) FMprintf("GenoConvF1","addInput",FMLV_WARN,
     65                        if (final) Hprintf("GenoConvF1","addInput",HMLV_WARN,
    6666                                            "illegal neuron connection %d <- %d (ignored)",n1,n2);
    6767                        return 0;
     
    178178                else
    179179                        {
    180                         FramMessage("GenoConv_F1","grow","Illegal neuron position (ignored)",1);
     180                        Hmessage("GenoConv_F1","grow","Illegal neuron position (ignored)",1);
    181181                        g=skipNeuro(g+1);
    182182                        }
  • cpp/frams/genetics/f4/conv_f4.cpp

    r287 r372  
    66
    77#include "conv_f4.h"
    8 #include <common/framsg.h>
     8#include <common/hmessage.h>
    99#include "../oper_fx.h" //for GENOPER_OK constant
    1010
     
    110110                if (res)
    111111                {
    112                         FramMessage("f4_Model", "buildModelRec", "Error in building Model", 2);
     112                        Hmessage("f4_Model", "buildModelRec", "Error in building Model", 2);
    113113                        error = res;
    114114                        break;
     
    134134                        return cells->C[i];
    135135        // none!
    136         FramMessage("f4_Model", "getStick", "Not a single stick", 2);
     136        Hmessage("f4_Model", "getStick", "Not a single stick", 2);
    137137        return NULL;
    138138}
  • cpp/frams/genetics/f4/f4_general.cpp

    r348 r372  
    77#include "f4_general.h"
    88#include <common/nonstd_stl.h>
    9 #include <common/framsg.h>
     9#include <common/hmessage.h>
    1010#include <frams/model/model.h> // for min and max attributes
    1111#include "../oper_fx.h" //for GENOPER_ constants
     
    581581                        char buf[40];
    582582                        sprintf(buf, "unknown code '%c'", gcur->name);
    583                         FramMessage("f4_Cell", "onestep", buf, 2);
     583                        Hmessage("f4_Cell", "onestep", buf, 2);
    584584                        // fix: delete it
    585585                        org->setRepairRemove(gcur->pos, gcur);
  • cpp/frams/genetics/f4/oper_f4.cpp

    r286 r372  
    88#include "oper_f4.h"
    99#include <frams/util/sstring.h>
    10 #include <common/framsg.h>
     10#include <common/hmessage.h>
    1111
    1212#include <stdio.h>
     
    5151        mutation_method_names[index++] = "deleted a node";
    5252        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);
    5454}
    5555
  • cpp/frams/genetics/genman.cpp

    r348 r372  
    66#include <frams/vm/classes/genoobj.h>
    77#include GEN_CONFIG_FILE //configuration of active genetic operators
    8 #include "common/framsg.h"
     8#include "common/hmessage.h"
    99#include "common/nonstd_math.h"
    1010#include "common/stl-util.h"
    11 #include <frams/errmgr/errmanager.h>
     11#include <frams/mhandlers/mhandlers.h>
    1212
    1313
     
    267267                if (gf->mutate(gn, chg, method) == GENOPER_OK)
    268268                {
    269                         ErrorHandler eh(ErrorHandler::StoreFirstMessage); //mute testValidity()
     269                        MessageHandlerToMemory eh(MessageHandlerBase::Enable | MessageHandlerToMemory::StoreFirstMessage); //mute testValidity()
    270270                        Geno G(gn, gv.getFormat(), "", "");
    271271                        canvalidate = true;
     
    284284                if (!ok && (count - pcount > 100))
    285285                {
    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());
    287287                        return Geno("", -1, "", "GENOPER_OPFAIL: Mutate() tried 100x and failed");
    288288                }
     
    308308
    309309        {
    310                 ErrorHandler eh(ErrorHandler::StoreFirstMessage); //mute testValidity()
     310                MessageHandlerToMemory eh(MessageHandlerBase::Enable | MessageHandlerToMemory::StoreFirstMessage); //mute testValidity()
    311311                bool canvalidate = true;
    312312                if (testValidity(g1v, canvalidate) > 0 && canvalidate == false)
     
    333333                        if (g1n[0]) { gn = g1n; chg = chg1; }
    334334                        else { gn = g2n; chg = chg2; }
    335                         ErrorHandler eh(ErrorHandler::StoreFirstMessage); //mute testValidity()
     335                        MessageHandlerToMemory eh(MessageHandlerBase::Enable | MessageHandlerToMemory::StoreFirstMessage); //mute testValidity()
    336336                        Geno G(gn, g1v.getFormat(), "", "");
    337337                        bool canvalidate = true;
     
    351351                if (!ok && (count - pcount > 100))
    352352                {
    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());
    354354                        return Geno("", -1, "", "GENOPER_OPFAIL: CrossOver() tried 100x and failed");
    355355                }
     
    500500        l.chg = chg;
    501501        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());
    503503        GenoLinkList.push_back(l);
    504504}
     
    533533        float f1, f2;
    534534        int m;
    535         FramMessage("GenMan", "Report", "The following genetic operators are available:", 0);
     535        Hmessage("GenMan", "Report", "The following genetic operators are available:", 0);
    536536        for (unsigned int i = 0; i < oper_fx_list.size(); i++)
    537537        {
     
    549549                }
    550550                //      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",
    552552                        oper_fx_list[i]->supported_format, oper_fx_list[i]->name.c_str(), l.c_str());
    553553        }
  • cpp/frams/genetics/geno.cpp

    r348 r372  
    250250                }
    251251        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);
    253253}
    254254
  • cpp/frams/genetics/oper_fx.cpp

    r348 r372  
    55#include <ctype.h>  //isupper()
    66#include "oper_fx.h"
    7 #include <common/framsg.h>
     7#include <common/hmessage.h>
    88#include <common/nonstd_math.h>
    99#include <frams/util/rndutil.h>
     
    173173                }
    174174                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);
    176176}
    177177
     
    250250{
    251251        if (s == NULL)
    252                 FramMessage("GenoOperators", "skipWS", "NULL reference!", FMLV_WARN);
     252                Hmessage("GenoOperators", "skipWS", "NULL reference!", HMLV_WARN);
    253253        else
    254254        while (isWS(*s)) s++;
  • cpp/frams/mhandlers/mhandlers.cpp

    r371 r372  
    33// See LICENSE.txt for details.
    44
    5 #include "errmanager.h"
     5#include "mhandlers.h"
    66#include <common/stl-util.h>
    77
    8 void _FramMessageSingleLine(const char *o, const char *m, const char *txt, int w)
     8void _HmessageSingleLine(const char *o, const char *m, const char *txt, int w)
    99{
    10         tlsGetRef(errmgr_instance).send(o, m, txt, w);
     10        tlsGetRef(message_handler_manager_instance).send(o, m, txt, w);
    1111}
    1212
    13 THREAD_LOCAL_DEF(ErrorManager, errmgr_instance);
     13THREAD_LOCAL_DEF(MessageHandlerManager, message_handler_manager_instance);
    1414
    15 void ErrorManager::send(int level, const char *o, const char *m, const char *bl, int w)
     15void MessageHandlerManager::send(int level, const char *o, const char *m, const char *bl, int w)
    1616{
    1717        if (level >= handlers.size()) level = handlers.size() - 1;
     
    1919        for (int i = level; i >= 0; i--)
    2020        {
    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)))
    2424                {
    2525                        r->handle(o, m, bl, w);
    26                         if (!(r->options & ErrorHandlerBase::DontBlock)) blocked = 1;
     26                        if (!(r->options & MessageHandlerBase::DontBlock)) blocked = 1;
    2727                }
    2828        }
    2929}
    3030
    31 int ErrorManager::add(ErrorHandlerBase *h)
     31int MessageHandlerManager::add(MessageHandlerBase *h)
    3232{
    3333        h->mgr = this;
     
    3636}
    3737
    38 void ErrorManager::remove(int i)
     38void MessageHandlerManager::remove(int i)
    3939{
    40         ErrorHandlerBase *h = handlers(i);
     40        MessageHandlerBase *h = handlers(i);
    4141        h->mgr = 0;
    4242        handlers.remove(i);
    4343}
    4444
    45 void ErrorManager::remove(ErrorHandlerBase *h)
     45void MessageHandlerManager::remove(MessageHandlerBase *h)
    4646{
    4747        int i;
     
    5050}
    5151
    52 void ErrorManager::removeAll()
     52void MessageHandlerManager::removeAll()
    5353{
    5454        while (handlers.size() > 0)
     
    5858//////////////////////////////////
    5959
    60 void ErrorHandlerBase::send(const char *o, const char *m, const char *bl, int w)
     60void MessageHandlerBase::send(const char *o, const char *m, const char *bl, int w)
    6161{
    6262        if (!isEnabled()) return;
     
    6565}
    6666
    67 void ErrorHandlerBase::FMprintf(const char *o, const char *m, int w, const char *bl, ...)
     67void MessageHandlerBase::Hprintf(const char *o, const char *m, int w, const char *bl, ...)
    6868{
    6969        if (!isEnabled()) return;
     
    7777
    7878
    79 void ErrorHandlerBase::enable()
     79void MessageHandlerBase::enable()
    8080{
    8181        if (isEnabled()) return;
    82         tlsGetRef(errmgr_instance).add(this);
     82        tlsGetRef(message_handler_manager_instance).add(this);
    8383}
    8484
    85 void ErrorHandlerBase::disable()
     85void MessageHandlerBase::disable()
    8686{
    8787        if (!isEnabled()) return;
    88         tlsGetRef(errmgr_instance).remove(this);
     88        tlsGetRef(message_handler_manager_instance).remove(this);
    8989}
    9090
    91 void ErrorHandlerBase::pause()
     91void MessageHandlerBase::pause()
    9292{
    9393        if (isPaused()) return;
     
    9595}
    9696
    97 void ErrorHandlerBase::resume()
     97void MessageHandlerBase::resume()
    9898{
    9999        if (!isPaused()) return;
     
    103103/////////////////////////////////
    104104
    105 void ErrorHandler::handle(const char *o, const char *m, const char *bl, int w)
     105void MessageHandlerToMemory::handle(const char *o, const char *m, const char *bl, int w)
    106106{
    107107        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++;
    111111
    112112        if (w >= storlevel)
  • cpp/frams/mhandlers/mhandlers.h

    r371 r372  
    33// See LICENSE.txt for details.
    44
    5 #ifndef _ERRMANAGER_H_
    6 #define _ERRMANAGER_H_
     5#ifndef _MHANDLERS_H_
     6#define _MHANDLERS_H_
    77
    88#include <frams/util/list.h>
    99#include <frams/util/sstring.h>
    10 #include <common/framsg.h>
     10#include <common/hmessage.h>
    1111#include <common/threads.h>
    1212
    13 class ErrorHandlerBase;
     13class MessageHandlerBase;
    1414
    15 class ErrorManager
     15class MessageHandlerManager
    1616{
    17         friend class ErrorHandlerBase;
    18         SListTempl<ErrorHandlerBase*> handlers;
     17        friend class MessageHandlerBase;
     18        SListTempl<MessageHandlerBase*> handlers;
    1919        void send(int level, const char *o, const char *m, const char *bl, int w);
    2020public:
    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);
    2323        void remove(int i);
    24         void remove(ErrorHandlerBase *r);
     24        void remove(MessageHandlerBase *r);
    2525        void removeAll();
    2626        void send(const char *o, const char *m, const char *bl, int w)
     
    2828                send(handlers.size() - 1, o, m, bl, w);
    2929        }
    30         ~ErrorManager() { removeAll(); }
     30        ~MessageHandlerManager() { removeAll(); }
    3131};
    3232
    33 extern THREAD_LOCAL_DECL(ErrorManager, errmgr_instance);
     33extern THREAD_LOCAL_DECL(MessageHandlerManager, message_handler_manager_instance);
    3434
    3535////////////////////////////////////////
    3636
    37 class ErrorHandlerBase
     37class MessageHandlerBase
    3838{
    39         friend class ErrorManager;
     39        friend class MessageHandlerManager;
    4040protected:
    41         ErrorManager* mgr;
     41        MessageHandlerManager* mgr;
    4242        int options;
    4343
     
    4646        enum HandlerOptions
    4747        {
    48                 DontBlock = 1, CannotBeBlocked = 2, DontEnable = 4, Paused = 8
     48                DontBlock = 1, CannotBeBlocked = 2, Enable = 4, Paused = 8
    4949        };
    5050
    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, ...);
    5252        void send(const char *o, const char *m, const char *bl, int w);
    5353
     
    5959        void resume();
    6060
    61         ErrorHandlerBase(int opts = 0) :mgr(0), options(opts)
     61        MessageHandlerBase(int opts = 0) :mgr(0), options(opts)
    6262        {
    63                 if (!(options&DontEnable)) enable();
     63                if (options&Enable) enable();
    6464        }
    65         virtual ~ErrorHandlerBase()
     65        virtual ~MessageHandlerBase()
    6666        {
    6767                disable();
     
    7373///////////////////////////////////////////
    7474
    75 class ErrorHandler : public ErrorHandlerBase
     75class MessageHandlerToMemory : public MessageHandlerBase
    7676{
    7777protected:
     
    8181public:
    8282
    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; }
    8484
    8585        enum Options2
     
    9595        const SString& getMessages() { return msgs; }
    9696
    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)
    9898        {
    9999                reset();
     
    103103};
    104104
    105 class ErrorRedirector : public ErrorHandlerBase
     105class RedirectingMessageHandler : public MessageHandlerBase
    106106{
    107         ErrorManager *other_mgr;
     107        MessageHandlerManager *other_mgr;
    108108public:
    109         ErrorRedirector(ErrorManager *om)
    110                 :ErrorHandlerBase(), other_mgr(om) {}
     109        RedirectingMessageHandler(MessageHandlerManager *om,int opts=0)
     110                :MessageHandlerBase(opts), other_mgr(om) {}
    111111
    112112        void handle(const char *o, const char *m, const char *bl, int w)
  • cpp/frams/mhandlers/stderrors.cpp

    r348 r372  
    55#include "stderrors.h"
    66#include <frams/util/sstringutils.h>
    7 #include <common/framsg.h>
     7#include <common/hmessage.h>
    88
    99bool listIndexCheck(SList* list,int index,const char* msgobj,const char* msgfun)
     
    1313        {
    1414        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);
    1616        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);
    1818        return 0;
    1919        }
     
    2929        {
    3030        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());
    3232        }
    3333return corrected;
  • cpp/frams/mhandlers/stdouthandler.cpp

    r371 r372  
    33// See LICENSE.txt for details.
    44
    5 #include "stdouterr.h"
     5#include "stdouthandler.h"
    66#ifdef SHP
    77#include <FBaseSys.h> //AppLog
     
    1010#endif
    1111
    12 void StdoutErrorHandler::handle(const char *o, const char *m, const char *bl, int w)
     12void MessageHandlerToStdout::handle(const char *o, const char *m, const char *bl, int w)
    1313{
    1414        if (w < -1) w = -1; else if (w>3) w = 3;
    1515#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);
    1717#else
    1818        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);
    2020        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);
    2222#endif
    2323}
  • cpp/frams/mhandlers/stdouthandler.h

    r371 r372  
    33// See LICENSE.txt for details.
    44
    5 #ifndef _STDOUTERRORHANDLER_H_
    6 #define _STDOUTERRORHANDLER_H_
     5#ifndef _STDOUTHANDLER_H_
     6#define _STDOUTHANDLER_H_
    77
    8 #include "errmanager.h"
     8#include "mhandlers.h"
    99#include <frams/virtfile/virtfile.h>
    1010
    11 class StdoutErrorHandler : public ErrorHandlerBase
     11class MessageHandlerToStdout : public MessageHandlerBase
    1212{
    1313        VirtFILE *file;
    1414public:
    15         StdoutErrorHandler(int opts = DontBlock, VirtFILE *_file = NULL) :ErrorHandlerBase(opts), file(_file) {}
     15        MessageHandlerToStdout(int opts = 0, VirtFILE *_file = NULL) :MessageHandlerBase(opts), file(_file) {}
    1616        void handle(const char *o, const char *m, const char *bl, int w);
    1717};
  • cpp/frams/model/geometry/geometryutils.cpp

    r286 r372  
    8282                        break;
    8383        }
    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);
    8585        return false;
    8686}
     
    102102                        break;
    103103        }
    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);
    105105        return false;
    106106}
  • cpp/frams/model/geometry/meshbuilder.cpp

    r322 r372  
    639639
    640640                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);
    642642        }
    643643}
     
    725725
    726726                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);
    728728        }
    729729}
  • cpp/frams/model/geometry/modelgeometryinfo.cpp

    r286 r372  
    1616        if (points.size() < 1) //maybe 1 or 2 points are also not enough for findSizesAndAxesOfPointsGroup() to work...
    1717        {
    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());
    1919                sizes = Pt3D_0;
    2020                axes = Orient_1;
     
    116116                        return externalAreaOfCylinder(model, partIndex, density);
    117117        }
    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);
    119119        return 0;
    120120}
  • cpp/frams/model/model.cpp

    r348 r372  
    55#include <common/nonstd_math.h>
    66#include "model.h"
    7 #include <common/framsg.h>
     7#include <common/hmessage.h>
    88#include <frams/util/multimap.h>
    9 #include <frams/errmgr/errmanager.h>
     9#include <frams/mhandlers/mhandlers.h>
    1010
    1111Model::Model()
     
    317317SString line;
    318318MultiRange frommap;
    319 ErrorHandler err(ErrorHandler::DontBlock);
     319MessageHandlerToMemory mh(MessageHandlerBase::Enable | MessageHandlerBase::DontBlock);
    320320for (;f0txt.getNextToken(pos,line,'\n');lnum++)
    321321        {
     
    325325                frommap.add(lastpos,pos-1);
    326326                }
    327         err.reset();
     327        mh.reset();
    328328        if (singleStepBuild(line,autobuildmaps ? (&frommap) : 0)==-1)
    329329                {
    330330                buildstatus=invalid;
    331                 FMprintf("Model","build",FMLV_ERROR,
     331                Hprintf("Model","build",HMLV_ERROR,
    332332                         geno.getName().len()?"illegal f0 code at line %d (%s)":"illegal f0 code at line %d",
    333333                         lnum,geno.getName().c_str());
     
    336336                return;
    337337                }
    338         if (err.getWarningCount())
     338        if (mh.getWarningCount())
    339339                {if (f0warnposition<0) f0warnposition=lastpos;}
    340340        lastpos=pos;
    341341        }
    342 err.disable();
     342mh.disable();
    343343close();
    344344if (convmap)
     
    513513{
    514514if (buildstatus!=building)
    515         FMprintf("Model","close",FMLV_WARN,"unexpected close() - no open()");
     515        Hprintf("Model","close",HMLV_WARN,"unexpected close() - no open()");
    516516if (internalcheck(1)>0)
    517517        {
     
    609609                {
    610610                delete j;
    611                 FMprintf("Model","build",FMLV_ERROR,
     611                Hprintf("Model","build",HMLV_ERROR,
    612612                         "invalid part reference for joint #%d",getJointCount()-1);
    613613                return -1;
     
    694694                return 0;
    695695                }
    696         FMprintf("Model","build",FMLV_ERROR,
     696        Hprintf("Model","build",HMLV_ERROR,
    697697                 "invalid neuron connection #%d <- #%d",c.n1_refno,c.n2_refno);
    698698        return -1;
     
    782782                        else
    783783                                {
    784                                 FMprintf("Model","internalCheck",FMLV_ERROR,
     784                                Hprintf("Model","internalCheck",HMLV_ERROR,
    785785                                         "illegal N-N connection #%d (reference to #%d) (%s)",
    786786                                         i,n->conn_refno,(const char*)geno.getName());
     
    853853if (var -> field < getMin ## template () . field) \
    854854        { 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);} \
    856856else if (var -> field > getMax ## template () . field) \
    857857        { 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);}
    859859
    860860#define LINKFLAG 0x8000000
     
    912912                        {
    913913                        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)");
    915915                        }
    916916                }
     
    941941                                {
    942942                                ret=0;
    943                                 FMprintf("Model","internalCheck",FMLV_ERROR,
     943                                Hprintf("Model","internalCheck",HMLV_ERROR,
    944944                                         "delta joint cycle detected at joint#%d (%s)",
    945945                                         i,geno.getName().c_str());
     
    978978                        {
    979979                        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)",
    981981                                 i,geno.getName().c_str());
    982982                        }
     
    984984                        {
    985985                        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)",
    987987                                 i,geno.getName().c_str());
    988988                        }
     
    992992        else
    993993                {
    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)",
    995995                         i,geno.getName().c_str());
    996996                ret=0;
     
    10011001                        {
    10021002                        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)");
    10041004                        }
    10051005                }
     
    10711071                if (!(p->flags&LINKFLAG))
    10721072                        {
    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)",
    10741074                                 i,geno.getName().c_str());
    10751075                        ret=0;
     
    10841084        if (j->p1_refno==j->p2_refno)
    10851085                {
    1086                 FMprintf("Model","internalCheck",FMLV_ERROR,"illegal self connection, joint #%d (%s)",
     1086                Hprintf("Model","internalCheck",HMLV_ERROR,"illegal self connection, joint #%d (%s)",
    10871087                         i,geno.getName().c_str());
    10881088                ret=0;
     
    10951095                    || ((j->p1_refno==j2->p2_refno)&&(j->p2_refno==j2->p1_refno)))
    10961096                        {
    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)",
    10981098                                 i,k,geno.getName().c_str());
    10991099                        ret=0;
     
    11251125{
    11261126if (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()");
    11281128if (buildstatus!=valid)
    11291129        return Geno("",'0',"","invalid");
  • cpp/frams/neuro/neurofactory.cpp

    r348 r372  
    9898        }
    9999if (removed.len())
    100         FMprintf("NeuroFactory","removeUninmplemented",FMLV_INFO,
     100        Hprintf("NeuroFactory","removeUninmplemented",HMLV_INFO,
    101101         "Removed Neuro classes: %s",removed.c_str());
    102102}
  • cpp/frams/neuro/neuroimpl.cpp

    r348 r372  
    7272        n->userdata[mytags_id]=ni;
    7373        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",
    7575                         i,n->getClassName().c_str());
    7676                continue; } // implementation not available?!
     
    8787        if (!ni->lateinit())
    8888                { 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",
    9090                         i,n->getClassName().c_str());
    9191                continue; }
  • cpp/frams/neuro/neuroimpl.h

    r286 r372  
    88#include <frams/model/model.h>
    99#include <frams/param/param.h>
    10 #include <common/framsg.h>
     10#include <common/hmessage.h>
    1111#ifdef NEURO_SIGNALS
    1212#include <frams/simul/signals.h>
  • cpp/frams/param/multiparamload.cpp

    r348 r372  
    55#include "multiparamload.h"
    66#include <frams/util/sstringutils.h>
    7 #include "common/framsg.h"
     7#include "common/hmessage.h"
    88#include <ctype.h>
    99
     
    107107        else if (status==BeforeUnknown)
    108108                {
    109                 FMprintf("MultiParamLoader","go",FMLV_WARN,"Skipping object '%s'",lastunknown.c_str());
     109                Hprintf("MultiParamLoader","go",HMLV_WARN,"Skipping object '%s'",lastunknown.c_str());
    110110                loadObjectNow(&emptyparam,false);
    111111                continue;
     
    137137                                {
    138138                                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(),
    140140                                         (thisfilename?" in ":""),(thisfilename?thisfilename:""));
    141141                                }
     
    204204if (alreadyIncluded(newfilename.c_str()))
    205205        {
    206         FMprintf("MultiParamLoader","include",FMLV_WARN,"circular reference ignored (\"%s\")",
     206        Hprintf("MultiParamLoader","include",HMLV_WARN,"circular reference ignored (\"%s\")",
    207207                    filename.c_str());
    208208        return;
     
    212212if (!f)
    213213        {
    214         FMprintf("MultiParamLoader","include",FMLV_WARN,"\"%s\" not found",newfilename.c_str());
     214        Hprintf("MultiParamLoader","include",HMLV_WARN,"\"%s\" not found",newfilename.c_str());
    215215        }
    216216else
  • cpp/frams/param/param.cpp

    r366 r372  
    88#include "param.h"
    99#include <frams/util/extvalue.h>
    10 #include "common/framsg.h"
     10#include "common/hmessage.h"
    1111#include <frams/util/sstringutils.h>
    1212
     
    445445                {
    446446                        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());
    448448                }
    449449
     
    518518        case 'o':       ret.setObject(getObject(i)); break;
    519519        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));
    521521        }
    522522}
     
    562562                        if (v.type == TObj)
    563563                        {
    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());
    565565                                return 0;
    566566                        }
     
    574574                        if (v.type == TObj)
    575575                        {
    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());
    577577                                return 0;
    578578                        }
     
    583583        case 'o': return setObject(i, v.getObject());
    584584        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));
    586586        }
    587587        return 0;
     
    605605                        if ((after == NULL) || (*after))
    606606                        {
    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));
    608608                                e.setEmpty();
    609609                        }
     
    690690        }
    691691        if (err!=NULL)
    692                 FMprintf("SimpleAbstractParam","sanityCheck", FMLV_ERROR,
     692                Hprintf("SimpleAbstractParam","sanityCheck", HMLV_ERROR,
    693693                "Invalid ParamEntry for %s.%s (%s)", getName(), pe->id, err);
    694694}       
     
    961961        else
    962962        {
    963                 FMprintf("SimpleAbstractParam", "call", FMLV_ERROR,
     963                Hprintf("SimpleAbstractParam", "call", HMLV_ERROR,
    964964                        (*pe->type != 'p') ? "'%s.%s' is not a function" : "Internal error - undefined function pointer for '%s.%s'", getName(), pe->id);
    965965                ret->setInvalid();
     
    10601060                        {
    10611061                                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());
    10631063                        }
    10641064                        t = equals_sign + 1; // t=value
     
    10701070#endif
    10711071                        {
    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')",
    10731073                                getName(), id(i) ? id(i) : "unknown property?");
    10741074                        }
     
    10921092                        fields_loaded++;
    10931093                        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)",
    10951095                                id(i), getName(), (ret&PSET_HITMAX) ? "big" : "small");
    10961096                        *(char*)valstop = remember;
  • cpp/frams/param/param.h

    r348 r372  
    1212#include <frams/util/statrick.h>
    1313#include <frams/virtfile/virtfile.h>
    14 #include <common/framsg.h>
     14#include <common/hmessage.h>
    1515
    1616class ExtValue;
     
    273273                        SString svaluetoset = SString::valueOf(valuetoset); //converts any type to SString
    274274                        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.",
    276276                                getName(), id(i), svaluetoset.c_str(), (setflags&PSET_HITMAX) ? "big" : "small", actual.c_str());
    277277                }
  • cpp/frams/util/3d.cpp

    r321 r372  
    44
    55#include <common/nonstd_math.h>
    6 #include <common/framsg.h>
     6#include <common/hmessage.h>
    77#include "3d.h"
    88
     
    1717{
    1818        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; }
    2020        return sqrt(q);
    2121}
     
    2424{
    2525        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; }
    2727        operator/=(len);
    2828        return true;
     
    6464        if (dx == 0 && dy == 0)
    6565        {
    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);
    6767                return 0; // incorrect result, but there is no correct one
    6868        }
     
    147147{
    148148        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; }
    150150        return sqrt(q);
    151151}
  • cpp/frams/util/extvalue.cpp

    r371 r372  
    9898        if (warn)
    9999        {
    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());
    101101        }
    102102
     
    269269                        if (tmp.len() > 30) tmp = tmp.substr(0, 30) + "...";
    270270                        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());
    272272                }
    273273                return NULL;
     
    419419                                context->v2->typeAndValue().c_str());
    420420                }
    421                 FMprintf("ExtValue", "interpretCompare", FMLV_ERROR, "%s", msg.c_str());
     421                Hprintf("ExtValue", "interpretCompare", HMLV_ERROR, "%s", msg.c_str());
    422422                ret = -1;
    423423        }
     
    448448                {
    449449                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());
    451451                        setDouble(double(getInt()) + src.getDouble());
    452452                        return;
     
    487487        default:;
    488488        }
    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());
    490490}
    491491
     
    502502                        return;
    503503                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());
    505505                        setDouble(double(getInt()) - src.getDouble());
    506506                        return;
     
    520520        default:;
    521521        }
    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());
    523523}
    524524
     
    535535                        return;
    536536                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());
    538538                        setDouble(double(getInt())*src.getDouble());
    539539                        return;
     
    591591        default:;
    592592        }
    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
    597596/*#include "fpu_control.h"
    598597#include <signal.h>
     
    612611        else
    613612        {
    614                 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Division by zero: %d/0", idata());
     613                Hprintf("ExtValue", "divide", HMLV_CRITICAL, "Division by zero: %d/0", idata());
    615614                setInvalid();
    616615        }
     
    621620        if (a == 0.0)
    622621        {
    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());
    624623                setInvalid();
    625624        }
     
    630629                if (!finite(tmp))
    631630                {
    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();
    633632                }
    634633                else
     
    636635                // niby dobrze ale lepiej byloby to robic bardziej systematycznie a nie tylko w dzieleniu?
    637636                //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(); }
    639638                fpExceptEnable();
    640639        }
     
    652651                        return;
    653652                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());
    655654                        divDouble(src.ddata());
    656655                        return;
     
    674673        default:;
    675674        }
    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());
    677676}
    678677
     
    779778
    780779        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());
    782781
    783782        default:;
     
    792791        {
    793792                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)" : "");
    795794                return false;
    796795        }
     
    806805        {
    807806                if (error)
    808                         FMprintf("ExtValue", "parseDouble", FMLV_ERROR, "Could not parse '%s'", s);
     807                        Hprintf("ExtValue", "parseDouble", HMLV_ERROR, "Could not parse '%s'", s);
    809808                return false;
    810809        }
     
    837836        case TString: return getInt(sdata().c_str());
    838837        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());
    840839                return (paInt)(intptr_t)odata().param;
    841840        default:;
     
    852851        case TString: return getDouble(sdata().c_str());
    853852        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());
    855854                return (double)(intptr_t)odata().param;
    856855        default:;
     
    990989                else
    991990                {
    992                         FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Missing '\"' in string: '%s'", ret);
     991                        Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Missing '\"' in string: '%s'", ret);
    993992                        return NULL;
    994993                }
     
    10121011                                else if (*p != ']')
    10131012                                {
    1014                                         FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Missing ',' in Vector: '%s'", p);
     1013                                        Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Missing ',' in Vector: '%s'", p);
    10151014                                        return NULL;
    10161015                                }
     
    10381037                        if ((!ret) || (args[1].getType() != TString)) { p = NULL; break; }
    10391038                        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; }
    10411040                        p++;
    10421041                        ret = args[0].deserialize(p);
     
    10471046                        else if (*p != '}')
    10481047                        {
    1049                                 FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Missing ',' in Dictionary: '%s'", p);
     1048                                Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Missing ',' in Dictionary: '%s'", p);
    10501049                                return NULL;
    10511050                        }
     
    10871086                        }
    10881087                }
    1089                 FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Invalid reference: '%s'", in - 1);
     1088                Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Invalid reference: '%s'", in - 1);
    10901089                return NULL;
    10911090        }
     
    11341133                }
    11351134                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());
    11371136                return ret;
    11381137        }
    1139         FMprintf("ExtValue", "deserialize", FMLV_ERROR, "Bad syntax: '%s'", in);
     1138        Hprintf("ExtValue", "deserialize", HMLV_ERROR, "Bad syntax: '%s'", in);
    11401139        setEmpty();
    11411140        return NULL;
  • cpp/frams/util/sstringutils.cpp

    r348 r372  
    55#include "sstringutils.h"
    66#include <frams/virtfile/virtfile.h>
    7 #include <common/framsg.h>
     7#include <common/hmessage.h>
    88#include <common/nonstd.h>
    99
     
    1919        }
    2020        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);
    2222        return ret;
    2323}
  • cpp/frams/virtfile/stdiofile.cpp

    r298 r372  
    66#include <common/nonstd_dir.h>
    77#include <common/nonstd_stdio.h>
    8 #include <common/framsg.h>
     8#include <common/hmessage.h>
    99#include <common/Convert.h>
    1010
    1111VirtFILE* StdioFileSystem::Vfopen(const char *path, const char *mode)
    1212{
    13         //printFM("Vfopen %s %s",path,mode);
     13        //printH("Vfopen %s %s",path,mode);
    1414#ifdef _WIN32
    1515        FILE *f = _wfopen(Convert::utf8ToUtf16(path).c_str(), Convert::strTOwstr(mode).c_str());
     
    2121#endif
    2222#endif
    23         //printFM("%p",f);
     23        //printH("%p",f);
    2424        if (f) return new StdioFILE(f, path); else return NULL;
    2525}
     
    2727VirtDIR* StdioFileSystem::Vopendir(const char* path)
    2828{
    29         //printFM("Vopendir %s",path);
     29        //printH("Vopendir %s",path);
    3030#ifdef _WIN32
    3131        DIRTYPE *d = wopendir(Convert::utf8ToUtf16(path).c_str());
     
    3333        DIR *d = opendir(path);
    3434#endif
    35         //printFM("%p",d);
     35        //printH("%p",d);
    3636        if (d) return new StdioDIR(d); else return NULL;
    3737}
     
    5656dirent* StdioDIR::Vreaddir()
    5757{
    58         //printFM("Vreaddir %s",dir);
     58        //printH("Vreaddir %s",dir);
    5959#ifdef _WIN32
    6060        wdirent *wde=wreaddir(dir);
  • cpp/frams/vm/classes/collectionobj.cpp

    r371 r372  
    55#include "collectionobj.h"
    66#include <common/nonstd_math.h> //sqrt in borland
    7 #include <frams/errmgr/stderrors.h>
     7#include <frams/mhandlers/stderrors.h>
    88#include <common/nonstd_stl.h>
    99#include <frams/util/sstringutils.h>
     
    232232        {
    233233        ret=false;
    234         FMprintf("VectorElementComparator","",FMLV_ERROR,"Comparison function returned no value");
     234        Hprintf("VectorElementComparator","",HMLV_ERROR,"Comparison function returned no value");
    235235        }
    236236else
Note: See TracChangeset for help on using the changeset viewer.