Changeset 81


Ignore:
Timestamp:
02/08/13 03:29:17 (11 years ago)
Author:
Maciej Komosinski
Message:

improved parsing of properties (e.g. in f0 genotypes)

Location:
cpp/gdk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • cpp/gdk/defgenoconv.cpp

    r66 r81  
    11#include "defgenoconv.h"
    22
    3 #include "gen-config.h"
     3#include GEN_CONFIG_FILE
    44
    55#ifdef USE_GENCONV_F10
     
    2929#ifdef USE_GENCONV_F81
    3030#include "conv_f8tof1.h"
     31#endif
     32#ifdef USE_GENCONV_F90
     33#include "conv_f9.h"
    3134#endif
    3235
     
    5861#endif
    5962#ifdef USE_GENCONV_F81
    60 GenoConv_F8ToF1 *gc81=new GenoConv_F8ToF1();
    61 GenoConv_F8ToF1::staticpar=gc81->par; //a trick so that the simulator can see this param
    62 addConverter(gc81);
     63addConverter(new GenoConv_F8ToF1());
     64#endif
     65#ifdef USE_GENCONV_F90
     66addConverter(new GenoConv_F90);
    6367#endif
    6468
  • cpp/gdk/gdktest.cpp

    r73 r81  
    3333for (int i=0;i<pi.getPropCount();i++)
    3434        {
     35        const char* type=pi.type(i);
     36        if (*type=='p') continue;
    3537        printf("%2d. %8s = %-20s %-3s %-10s  %-10s\n",i,pi.id(i),(const char*)pi.get(i),pi.type(i),pi.name(i),pi.grname(pi.group(i)));
    3638        }
  • cpp/gdk/geno.cpp

    r71 r81  
    114114Geno::Geno(const SString& src)
    115115{
    116 init(src,-1,SString::empty,SString::empty);
     116init(src,-1,SString::empty(),SString::empty());
    117117}
    118118
     
    128128{
    129129freeF0();
    130 init(g,-1,SString::empty,SString::empty);
     130init(g,-1,SString::empty(),SString::empty());
    131131}
    132132
  • cpp/gdk/modelparts.cpp

    r69 r81  
    193193#include "defassign-f0_neuro.h"
    194194state=0.0;
    195 myclass=0;
    196 knownclass=1;
     195myclass=NULL;
     196myclassname="N";//default d="N" but f0.def is unable to set this (d is GETSET, not a regular FIELD)
     197knownclass=0;
    197198refno=0;
    198199pos=Pt3D_0; rot=Pt3D_0;
     
    343344}
    344345
    345 SyntParam Neuro::classProperties()
     346SyntParam Neuro::classProperties(bool handle_defaults_when_saving)
    346347{
    347348NeuroClass *cl=getClass();
    348349ParamEntry *pe = cl ? cl->getParamTab() : emptyParamTab;
    349 return SyntParam(pe,&myclassparams);
     350return SyntParam(pe,&myclassparams,handle_defaults_when_saving);
    350351}
    351352
     
    507508        ret->setEmpty();
    508509else
    509         ret->setObject(ExtObject(&st_neuroparam,inputs(i).n));
     510        ret->setObject(ExtObject(&Neuro::getStaticParam(),inputs(i).n));
    510511}
    511512
     
    648649}
    649650
     651Param& Part::getStaticParam()
     652{
     653static Param p(f0_part_paramtab,0,"Part");
     654return p;
     655}
     656
     657
    650658///////////////////////////
    651659
     
    707715return usedelta;
    708716}
     717
     718Param& Joint::getStaticParam()
     719{
     720static Param p(f0_joint_paramtab,0,"Joint");
     721return p;
     722}
     723
    709724
    710725/////////////////////////////////////////////////////////////////
     
    822837};
    823838
     839Param& Neuro::getStaticParam()
     840{
     841static Param p(f0_neuro_paramtab,0,"NeuroDef");
     842return p;
     843}
     844
    824845////////////////////////
    825846
     
    843864{setClassName(arg->getString());return PSET_CHANGED;}
    844865
    845 Param st_neuroparam(f0_neuro_paramtab,0,"NeuroDef");
    846 Param st_jointparam(f0_joint_paramtab,0,"Joint");
    847 Param st_partparam(f0_part_paramtab,0,"Part");
    848 
    849 
     866
  • cpp/gdk/modelparts.h

    r66 r81  
    8989//Slist neurons; // "select * from owner->neurons where part=this" ;-)
    9090
     91Pt3D vcolor;
     92double vsize;
     93
    9194Part();
    9295Part(const Part& src):PartBase(getDefaultStyle()) {operator=(src);}
    9396void operator=(const Part& src);
     97
     98static Param& getStaticParam();
    9499};
    95100
     
    150155    set by 'singlestep' if j: attributes use delta option */
    151156int usedelta;
     157Pt3D vcolor;
     158
     159static Param& getStaticParam();
    152160};
    153161
     
    352360#undef STATRICKCLASS
    353361
    354 SyntParam classProperties();
     362///@param handle_defaults_when_saving see SyntParam
     363SyntParam classProperties(bool handle_defaults_when_saving=true);
    355364// base properties:
    356365long refno; ///< unique reference number (former 'neuro' refno)
     
    482491Orient o;       ///< rotation matrix calculated from "rot"
    483492static ParamEntry emptyParamTab[];
     493static Param& getStaticParam();
    484494};
    485495
     
    515525
    516526extern ParamEntry f0_part_paramtab[],f0_joint_paramtab[],f0_nodeltajoint_paramtab[],f0_neuro_paramtab[],f0_neuroconn_paramtab[],f0_neuroitem_paramtab[];
    517 extern Param st_neuroparam,st_jointparam,st_partparam;
    518527
    519528#endif
  • cpp/gdk/multiparamload.cpp

    r66 r81  
    193193const char* thisfilename=file->VgetPath();
    194194SString newfilename;
    195 const char* t=thisfilename?strrchr(thisfilename,PATHSEPARATORCHAR):0;
     195const char* t=thisfilename?strrchr(thisfilename,PATH_SEPARATOR_CHAR):0;
    196196
    197197if (thisfilename && t)
  • cpp/gdk/neurofactory.cpp

    r66 r81  
    77#include "param.h"
    88#include "neuroimpl.h"
    9 #include "neuroimplfiles.h"
     9#include NEURO_IMPL_FILES
    1010
    1111int NeuroFactory::used=0;
     
    3737}
    3838
    39 #include "neuroimplfiles.h"
    40 #include "neurocls-factory.h"
     39#include NEURO_CLS_FACTORY
    4140
    4241void NeuroFactory::setImplementation()
  • cpp/gdk/neuroimpl-simple.h

    r66 r81  
    77
    88#include "neuroimpl.h"
     9#include "nonstd_math.h"
    910
    1011extern ParamEntry NI_StdNeuron_tab[];
  • cpp/gdk/neuroimpl.cpp

    r72 r81  
    66#include "neurofactory.h"
    77#include "rndutil.h"
     8#include "nonstd_math.h"
    89#ifndef GDK_WITHOUT_FRAMS
    910#include "creature.h"
     
    3839{}
    3940
    40 NeuroNetConfig NeuroNetConfig::globalconfig;
     41NeuroNetConfig& NeuroNetConfig::getGlobalConfig()
     42{
     43static NeuroNetConfig globalconfig;
     44return globalconfig;
     45}
    4146
    4247/////////////////////////////////////////////////////////////////
     
    200205                chstate=chnewstate;
    201206        neuro->state=newstate;
    202         if (NeuroNetConfig::globalconfig.nnoise>0.0)
     207        if (NeuroNetConfig::getGlobalConfig().nnoise>0.0)
    203208                {
    204                 neuro->state+=RndGen.GaussStd()*NeuroNetConfig::globalconfig.nnoise;
     209                neuro->state+=RndGen.GaussStd()*NeuroNetConfig::getGlobalConfig().nnoise;
    205210                if (channels>1)
    206211                        for(int i=0;i<chstate.size();i++)
    207                                 chstate(0)+=RndGen.GaussStd()*NeuroNetConfig::globalconfig.nnoise;
     212                                chstate(0)+=RndGen.GaussStd()*NeuroNetConfig::getGlobalConfig().nnoise;
    208213                }
    209214        }
     
    274279int zero=0;
    275280par.load2(neuro->getClassParams(),zero);
     281}
     282
     283Param& NeuroImpl::getStaticParam()
     284{
     285static Param p(neuroimpl_tab,0,"Neuro");
     286return p;
    276287}
    277288
     
    340351ParamEntry neurosignals_paramtab[]=
    341352 {
    342 {"NeuroSignals",1,8,"NeuroSignals","Signals attached to the neuron.\nSee also: Signal, WorldSignals, CreatureSignals.\nscripts/light.neuro and scripts/seelight.neuro are simple custom neuron examples demonstrating how to send/receive signals between creatures.",},
     353{"NeuroSignals",1,8,"NeuroSignals","Signals attached to a neuron.\nSee also: Signal, WorldSignals, CreatureSignals.\nscripts/light.neuro and scripts/seelight.neuro are simple custom neuron examples demonstrating how to send/receive signals between creatures.",},
    343354
    344355#define FIELDSTRUCT NeuroSignals
    345 {"add",0,PARAM_NOSTATIC,"Add","p(s channel)",PROCEDURE(p_add),"Create a new signal"},
    346 {"receive",0,PARAM_NOSTATIC,"Receive","p f(s channel)",PROCEDURE(p_receive),"Receive the aggregated signal power in a given channel."},
    347 {"receiveSet",0,PARAM_NOSTATIC,"Receive","p oVector(s channel,f max distance)",PROCEDURE(p_receiveSet),"Get all signals in the specified range. Returns a readonly vector object containing Signal objects (individual signals can be accessed as result[0] throught result[result.size-1])."},
    348 {"receiveFilter",0,PARAM_NOSTATIC,"receive","p f(s channel,f max distance,f flavor,f filter)",PROCEDURE(p_receiveFilter),"Receive the aggregated signal power in a given channel.\n\nAdditional filtering options:\n- Max distance only receives the neighbor signals (based on their physical location)\n- Flavor filtering: only signals having the flavor close to the specified one will be received. The filter value is the maximum allowed difference."},
    349 {"receiveSingle",0,PARAM_NOSTATIC,"Receive","p oSignal(s channel,f range)",PROCEDURE(p_receiveSingle),"Find the signal source having the highest signal power (including the distance)"},
     356SIGNPAR_ADD(""),
     357SIGNPAR_RECEIVE(""),
     358SIGNPAR_RECEIVESET(""),
     359SIGNPAR_RECEIVEFILTER(""),
     360SIGNPAR_RECEIVESINGLE(""),
    350361#undef FIELDSTRUCT
    351362
    352363#define FIELDSTRUCT SignalSet
    353 {"get",0,PARAM_NOSTATIC,"Get","p oSignal(d index)",PROCEDURE(p_get),},
    354 {"size",0,1+PARAM_NOSTATIC,"Size","d",GETONLY(size),},
    355 {"clear",0,1+PARAM_NOSTATIC,"Clear","p()",PROCEDURE(p_clear),},
     364SIGNSETPAR_GET,
     365SIGNSETPAR_SIZE,
     366SIGNSETPAR_CLEAR,
    356367#undef FIELDSTRUCT
    357368{0,0,0,},
    358369 };
    359 Param neurosignals_param(neurosignals_paramtab,0);
    360 #endif
    361 
    362 Param st_neuroimplparam(neuroimpl_tab,0,"Neuro");
     370
     371Param& NeuroSignals::getStaticParam()
     372{
     373static Param p(neurosignals_paramtab,0);
     374return p;
     375}
     376#endif
    363377
    364378#ifdef NEURO_SIGNALS
     
    474488Part *pa;
    475489if (pa=neuro->getPart())
    476         ret->setObject(ExtObject(&mechpart_param,((MechPart *)pa->userdata[CreatMechObject::modeltags_id])));
     490        ret->setObject(ExtObject(&MechPart::getStaticParam(),((MechPart *)pa->userdata[CreatMechObject::modeltags_id])));
    477491else
    478492        ret->setEmpty();
     
    485499Joint *jo;
    486500if (jo=neuro->getJoint())
    487         ret->setObject(ExtObject(&mechjoint_param,((MechJoint*)jo->userdata[CreatMechObject::modeltags_id])));
     501        ret->setObject(ExtObject(&MechJoint::getStaticParam(),((MechJoint*)jo->userdata[CreatMechObject::modeltags_id])));
    488502else
    489503        ret->setEmpty();
     
    534548void NeuroImpl::get_neurodef(ExtValue *ret)
    535549{
    536 ret->setObject(ExtObject(&st_neuroparam,neuro));
     550ret->setObject(ExtObject(&Neuro::getStaticParam(),neuro));
    537551}
    538552
  • cpp/gdk/neuroimpl.h

    r72 r81  
    1515class NeuroImpl;
    1616extern ParamEntry neuroimpl_tab[];
    17 #ifdef NEURO_SIGNALS
    18 extern Param neurosignals_param;
    19 #endif
    2017
    2118class Creature;
     
    3128double touchrange;
    3229
    33 static NeuroNetConfig globalconfig;
     30static NeuroNetConfig& getGlobalConfig();
    3431};
    3532
     
    5451PARAMPROCDEF(p_receiveSingle);
    5552#undef STATRICKCLASS
     53
     54static Param& getStaticParam();
    5655};
    5756#endif
     
    7574static double getStateFromNeuro(Neuro *n);
    7675int getErrorCount() {return errorcount;}
    77 NeuroNetImpl(Model& model, NeuroNetConfig& conf = NeuroNetConfig::globalconfig
     76NeuroNetImpl(Model& model, NeuroNetConfig& conf = NeuroNetConfig::getGlobalConfig()
    7877#ifdef NEURO_SIGNALS
    7978, ChannelSpace *ch=0
     
    250249NeuroImpl():owner(0),neuro(0),newstate(0),paramentries(0),simorder(1),status(BeforeInit),channels(1),fields_param(0),fields_object(0)
    251250#ifdef NEURO_SIGNALS
    252 ,sigs(this),sigs_obj(&neurosignals_param,&sigs)
     251,sigs(this),sigs_obj(&NeuroSignals::getStaticParam(),&sigs)
    253252#endif
    254253 {}
     
    298297PARAMGETDEF(classObject);
    299298#undef STATRICKCLASS
     299
     300  static Param& getStaticParam();
    300301};
    301302
  • cpp/gdk/neurolibrary.cpp

    r66 r81  
    4545void NeuroLibrary::addStandardClasses()
    4646{
    47 #include "neurocls-library.h"
     47#include NEURO_CLS_LIBRARY
    4848}
    4949
  • cpp/gdk/param.cpp

    r66 r81  
    283283}
    284284
    285 void SimpleAbstractParam::save2(SString& f,void *defdata,int addcr)
     285void SimpleAbstractParam::save2(SString& f,void *defdata,bool addcr,bool all_names)
    286286{ // defdata!=NULL -> nie zapisuje wartosci domyslnych
    287287const char *p;
     
    303303#ifndef SAVE_ALL_NAMES
    304304#ifdef SAVE_SELECTED_NAMES
    305                 if (needlabel || !(fl & PARAM_CANOMITNAME))
     305                if (needlabel || all_names || !(fl & PARAM_CANOMITNAME))
    306306#else
    307307                if (needlabel)
     
    312312                        { // string - special case
    313313                        SString str=getString(i);
    314                         if (strContainsOneOf(str,", \\\n\r\t"))
     314                        if (strContainsOneOf(str,", \\\n\r\t\""))
    315315                                {
    316316                                t+="\"";
     
    439439}
    440440
     441static bool stringIsNumeric(const char* str)
     442{//   /-?.?[0-9]+/
     443if (!str) return false;
     444if (*str=='-') str++;
     445if (*str=='.') str++;
     446return isdigit(*str);
     447}
     448
     449int ParamInterface::setInt(int i,const char* str)
     450{
     451if (!stringIsNumeric(str))
     452        {
     453        long a,b,c;
     454        if (getMinMax(i,a,b,c)>=3)
     455                return setInt(i,c);
     456        else
     457                return setInt(i,(long)0);
     458        }
     459else
     460        return setInt(i,atol(str));
     461}
     462
     463int ParamInterface::setDouble(int i,const char* str)
     464{
     465if (!stringIsNumeric(str))
     466        {
     467        double a,b,c;
     468        if (getMinMax(i,a,b,c)>=3)
     469                return setDouble(i,c);
     470        else
     471                return setDouble(i,(double)0);
     472        }
     473else
     474        return setDouble(i,atof(str));
     475}
     476
    441477int ParamInterface::set(int i,const ExtValue &v)
    442478{
    443479switch(type(i)[0])
    444480        {
    445         case 'd': return setInt(i,v.getInt());
    446         case 'f': return setDouble(i,v.getDouble());
     481        case 'd': if ((v.type==TInt)||(v.type==TDouble)) return setInt(i,v.getInt()); else return setInt(i,(const char*)v.getString());
     482        case 'f': if ((v.type==TInt)||(v.type==TDouble)) return setDouble(i,v.getDouble()); else return setDouble(i,(const char*)v.getString());
    447483        case 's': { SString t=v.getString(); return setString(i,t); }
    448484        case 'o': return setObject(i,v.getObject());
     
    457493switch(type(i)[0])
    458494        {
    459         case 'd': return setInt(i,atol(v));
    460         case 'f': return setDouble(i,atof(v));
     495        case 'd': return setInt(i,v);
     496        case 'f': return setDouble(i,v);
    461497        case 's': { SString t(v); return setString(i,t); }
    462498        case 'x':
  • cpp/gdk/param.h

    r66 r81  
    102102ExtValue getById(const char* prop);
    103103
     104int setInt(int i,const char* str);
     105int setDouble(int i,const char* str);
    104106virtual int setInt(int,long)=0;         ///< set long value, you can only use this for "d" type prop
    105107virtual int setDouble(int,double)=0;    ///< set double value, you can only use this for "f" type prop
     
    244246
    245247int isequal(int i,void* defdata);
    246 void save2(SString&,void *defdata,int addcr=1);
     248void save2(SString&,void *defdata,bool addcr=true,bool all_names=true);
    247249
    248250virtual void setDefault(bool numericonly=false);
  • cpp/gdk/paramobj.cpp

    r66 r81  
    55#include "paramobj.h"
    66#include "extvalue.h"
     7#include "nonstd_stl.h"
    78
    89static const char* maybedup(bool dup,const char* src)
     
    105106        case 'd': v->setInt(0); break;
    106107        case 'f': v->setDouble(0); break;
    107         case 's': v->setString(SString::empty); break;
     108        case 's': v->setString(SString::empty()); break;
    108109        case 'o': v->setObject(ExtObject()); break;
    109110        case 'x': break;
  • cpp/gdk/sstring.cpp

    r66 r81  
    55
    66#include "sstring.h"
    7 #include "nonstd.h"
     7#include "nonstd_stl.h"
    88
    99
     
    120120void SString::initEmpty()
    121121{
    122 buf=&SBuf::empty;
     122buf=&SBuf::empty();
    123123memhint=-1;
    124124}
     
    131131void SString::detachEmpty(int ensuresize)
    132132{
    133 if (buf==&SBuf::empty) { buf=new SBuf(ensuresize,memhint); return; }
     133if (buf==&SBuf::empty()) { buf=new SBuf(ensuresize,memhint); return; }
    134134if (buf->refcount<2) buf->ensureSize(ensuresize,memhint);
    135135else
     
    142142void SString::detach()
    143143{
    144 if (buf==&SBuf::empty) return;
     144if (buf==&SBuf::empty()) return;
    145145if (!--buf->refcount) delete buf;
    146146}
     
    148148void SString::detachCopy(int ensuresize)
    149149{
    150 if (buf==&SBuf::empty) { buf=new SBuf(ensuresize,memhint); return; }
     150if (buf==&SBuf::empty()) { buf=new SBuf(ensuresize,memhint); return; }
    151151if (buf->refcount<2)
    152152        {
     
    319319}
    320320
    321 
    322 SString SString::empty;
    323 SBuf SBuf::empty;
     321SString &SString::empty()
     322{
     323static SString empty;
     324return empty;
     325}
     326
     327SBuf &SBuf::empty()
     328{
     329static SBuf empty;
     330return empty;
     331}
  • cpp/gdk/sstring.h

    r74 r81  
    2121void freeBuf();
    2222void append(const char* ch, int chlen=-1);
    23 static SBuf empty;
     23static SBuf &empty();
    2424SBuf(int initsize, int memhint=-1);
    2525friend class SString;
     
    157157static const SString& valueOf(double);
    158158
    159 static SString empty;
     159static SString &empty();
    160160};
    161161
  • cpp/gdk/sstringutils.cpp

    r66 r81  
    121121                case '\t': tmp+="\\t"; changed=1; break;
    122122                case '\"': tmp+="\\\""; changed=1; break;
     123                case '\\': tmp+="\\\\"; changed=1; break;
    123124                default: tmp+=*x;
    124125                }
  • cpp/gdk/stdiofile.cpp

    r66 r81  
    44
    55#include "stdiofile.h"
    6 #include "nonstd.h"
    7 #include "nonstd_io.h"
     6#include "nonstd_dir.h"
     7#include "nonstd_stdio.h"
     8#include "framsg.h"
    89
    910VirtFILE* StdioFileSystem::Vfopen(const char* path,const char*mode)
    1011{
    11 FILE *f=fopen(path,mode);
    12 if (f) return new StdioFILE(f,path); else return 0;
     12        //FMprintf("Vfopen %s %s",path,mode);
     13        FILE *f=fopen(path,mode);
     14        //FMprintf("%p",f);
     15        if (f) return new StdioFILE(f,path); else return 0;
    1316}
    1417
    1518VirtDIR* StdioFileSystem::Vopendir(const char* path)
    1619{
    17 #ifndef _MSC_VER
    18 DIR *d=opendir(path);
    19 if (d) return new StdioDIR(d); else
    20 #endif
    21 return 0;
     20        //FMprintf("Vopendir %s",path);
     21        DIR *d=opendir(path);
     22        //FMprintf("%p",d);
     23        if (d) return new StdioDIR(d); else return 0;
    2224}
    2325
    2426int StdioFileSystem::Vfexists(const char* path)
    25 {return fileExists(path);}
     27{
     28        return fileExists(path);
     29}
    2630
    2731void StdioFILE::setStdio()
    2832{
    29 static StdioFILEDontClose si(stdin);
    30 static StdioFILEDontClose so(stdout);
    31 static StdioFILEDontClose se(stderr);
    32 setVstdin(&si);
    33 setVstdout(&so);
    34 setVstderr(&se);
     33        static StdioFILEDontClose si(stdin);
     34        static StdioFILEDontClose so(stdout);
     35        static StdioFILEDontClose se(stderr);
     36        setVstdin(&si);
     37        setVstdout(&so);
     38        setVstderr(&se);
    3539}
    3640
    37 #ifndef _MSC_VER
    3841dirent* StdioDIR::Vreaddir()
    3942{
    40 return readdir(dir);
     43        //FMprintf("Vreaddir %s",dir);
     44        return readdir(dir);
    4145}
    42 #endif
  • cpp/gdk/stdiofile.h

    r66 r81  
    99#include "sstring.h"
    1010#include <stdio.h>
    11 #ifndef _MSC_VER
    12 #include <dirent.h>
    13 #endif
     11#include "nonstd_dir.h"
    1412
    1513class StdioFileSystem: public VirtFileSystem
     
    4947class StdioDIR: public VirtDIR
    5048{
    51 #ifndef _MSC_VER
    5249DIR *dir;
    5350  public:
     
    5552~StdioDIR() {if (dir) closedir(dir);}
    5653dirent* Vreaddir();
    57 #endif
    5854};
    5955
  • cpp/gdk/stdouterr.cpp

    r66 r81  
    44
    55#include "stdouterr.h"
     6#ifdef SHP
     7#include <FBaseSys.h> //AppLog
     8#else
    69#include <stdio.h>
     10#endif
    711
    812void StdoutErrorHandler::handle(const char *o,const char *m,const char *bl,int w)
     
    1014static char* level[]={"DEBUG","INFO","WARN","ERROR","CRITICAL"};
    1115if (w<-1) w=-1; else if (w>3) w=3;
    12 printf("[%s] %s::%s - %s\n",level[w+1],o,m,bl);
     16#ifdef SHP
     17AppLog("[%s] %s::%s - %s\n",level[w+1],o,m,bl);
     18#else
     19if (file)
     20        file->printf("[%s] %s::%s - %s\n",level[w+1],o,m,bl);
     21else
     22        printf("[%s] %s::%s - %s\n",level[w+1],o,m,bl);
     23#endif
    1324}
  • cpp/gdk/stdouterr.h

    r66 r81  
    77
    88#include "errmanager.h"
     9#include "virtfile.h"
    910
    1011class StdoutErrorHandler: public ErrorHandlerBase
    1112{
     13VirtFILE *file;
    1214  public:
    13 StdoutErrorHandler(int opts=DontBlock):ErrorHandlerBase(opts) {}
     15StdoutErrorHandler(int opts=DontBlock,VirtFILE *_file=NULL):ErrorHandlerBase(opts),file(_file) {}
    1416void handle(const char *o,const char *m,const char *bl,int w);
    1517};
  • cpp/gdk/syntparam.cpp

    r66 r81  
    88#include <math.h>
    99
    10 SyntParam::SyntParam(ParamEntry *init_pe,SString* autostr)
     10SyntParam::SyntParam(ParamEntry *init_pe,SString* autostr,bool handle_defaults_when_saving)
    1111        :autostring(autostr)
    1212{
     
    1414pe=ParamObject::makeParamTab(this);
    1515Param::setParamTab(pe);
     16if (handle_defaults_when_saving)
     17        {
     18        def_obj=ParamObject::makeObject(pe);
     19        Param::select(def_obj);
     20        Param::setDefault();
     21        }
     22else
     23        def_obj=NULL;
    1624obj=ParamObject::makeObject(pe);
    1725Param::select(obj);
     
    2735Param::setParamTab(pe);
    2836obj=ParamObject::dupObject(src.obj);
     37def_obj=src.def_obj ? ParamObject::dupObject(src.def_obj) : NULL;
    2938Param::select(obj);
    3039}
     
    3544ParamObject::freeParamTab(pe);
    3645ParamObject::freeObject(obj);
     46ParamObject::freeObject(def_obj);
    3747}
    3848
     
    4050{
    4151if (!s) s=autostring;
    42 if (s) {*s=""; Param::save2(*s,0,0);}
     52if (s) {*s=""; Param::save2(*s,def_obj,0);}
    4353}
    4454
  • cpp/gdk/syntparam.h

    r66 r81  
    88#include "param.h"
    99
     10/** Creates param + matching temporary object (ParamObject)
     11    using the supplied ParamEntry'ies as a template.
     12    This is mainly used for manipulating specialized neuron properties
     13    (Neuro.d field) in absence of live neuron implementations
     14    (these are only available in live creatures, but not when operating
     15    on Models and Genotypes).
     16
     17    See also: gdktest.cpp
     18 */
    1019class SyntParam: public Param
    1120{
    12 void* obj;
     21void* obj,*def_obj;
    1322ParamEntry *pe;
    1423SString* autostring;
    1524  public:
    16 SyntParam(ParamEntry *pe,SString* autostring=0);
     25/** @param handle_defaults_when_saving creates a second object holding the default values so Param::save2 can use it for omitting defaults. can be disabled for compatiblity with previous behavior (defaults were ignored in SyntParam)
     26 */
     27SyntParam(ParamEntry *pe,SString* autostring=0,bool handle_defaults_when_saving=true);
    1728SyntParam(const SyntParam& src);
    1829~SyntParam();
  • cpp/gdk/virtfile.cpp

    r66 r81  
    6464#undef feof
    6565#endif
     66#ifdef SHP
     67#undef feof
     68#endif
    6669int feof(VirtFILE* f) {return f->Veof();}
    6770#ifdef __BORLANDC__
  • cpp/gdk/virtfile.h

    r66 r81  
    7575#undef feof
    7676#endif
     77#ifdef SHP //nie wiem co to robi i jak ma byc, ale sie kompiluje z tym undefem a bez nie. tak samo w cpp
     78#undef feof
     79#endif
    7780DLLEXP int feof(VirtFILE* f);// {return f->Veof();}
    7881#ifdef __BORLANDC__
Note: See TracChangeset for help on using the changeset viewer.