- Timestamp:
- 02/08/13 03:29:17 (12 years ago)
- Location:
- cpp/gdk
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/gdk/defgenoconv.cpp
r66 r81 1 1 #include "defgenoconv.h" 2 2 3 #include "gen-config.h"3 #include GEN_CONFIG_FILE 4 4 5 5 #ifdef USE_GENCONV_F10 … … 29 29 #ifdef USE_GENCONV_F81 30 30 #include "conv_f8tof1.h" 31 #endif 32 #ifdef USE_GENCONV_F90 33 #include "conv_f9.h" 31 34 #endif 32 35 … … 58 61 #endif 59 62 #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); 63 addConverter(new GenoConv_F8ToF1()); 64 #endif 65 #ifdef USE_GENCONV_F90 66 addConverter(new GenoConv_F90); 63 67 #endif 64 68 -
cpp/gdk/gdktest.cpp
r73 r81 33 33 for (int i=0;i<pi.getPropCount();i++) 34 34 { 35 const char* type=pi.type(i); 36 if (*type=='p') continue; 35 37 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))); 36 38 } -
cpp/gdk/geno.cpp
r71 r81 114 114 Geno::Geno(const SString& src) 115 115 { 116 init(src,-1,SString::empty ,SString::empty);116 init(src,-1,SString::empty(),SString::empty()); 117 117 } 118 118 … … 128 128 { 129 129 freeF0(); 130 init(g,-1,SString::empty ,SString::empty);130 init(g,-1,SString::empty(),SString::empty()); 131 131 } 132 132 -
cpp/gdk/modelparts.cpp
r69 r81 193 193 #include "defassign-f0_neuro.h" 194 194 state=0.0; 195 myclass=0; 196 knownclass=1; 195 myclass=NULL; 196 myclassname="N";//default d="N" but f0.def is unable to set this (d is GETSET, not a regular FIELD) 197 knownclass=0; 197 198 refno=0; 198 199 pos=Pt3D_0; rot=Pt3D_0; … … 343 344 } 344 345 345 SyntParam Neuro::classProperties( )346 SyntParam Neuro::classProperties(bool handle_defaults_when_saving) 346 347 { 347 348 NeuroClass *cl=getClass(); 348 349 ParamEntry *pe = cl ? cl->getParamTab() : emptyParamTab; 349 return SyntParam(pe,&myclassparams );350 return SyntParam(pe,&myclassparams,handle_defaults_when_saving); 350 351 } 351 352 … … 507 508 ret->setEmpty(); 508 509 else 509 ret->setObject(ExtObject(& st_neuroparam,inputs(i).n));510 ret->setObject(ExtObject(&Neuro::getStaticParam(),inputs(i).n)); 510 511 } 511 512 … … 648 649 } 649 650 651 Param& Part::getStaticParam() 652 { 653 static Param p(f0_part_paramtab,0,"Part"); 654 return p; 655 } 656 657 650 658 /////////////////////////// 651 659 … … 707 715 return usedelta; 708 716 } 717 718 Param& Joint::getStaticParam() 719 { 720 static Param p(f0_joint_paramtab,0,"Joint"); 721 return p; 722 } 723 709 724 710 725 ///////////////////////////////////////////////////////////////// … … 822 837 }; 823 838 839 Param& Neuro::getStaticParam() 840 { 841 static Param p(f0_neuro_paramtab,0,"NeuroDef"); 842 return p; 843 } 844 824 845 //////////////////////// 825 846 … … 843 864 {setClassName(arg->getString());return PSET_CHANGED;} 844 865 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 89 89 //Slist neurons; // "select * from owner->neurons where part=this" ;-) 90 90 91 Pt3D vcolor; 92 double vsize; 93 91 94 Part(); 92 95 Part(const Part& src):PartBase(getDefaultStyle()) {operator=(src);} 93 96 void operator=(const Part& src); 97 98 static Param& getStaticParam(); 94 99 }; 95 100 … … 150 155 set by 'singlestep' if j: attributes use delta option */ 151 156 int usedelta; 157 Pt3D vcolor; 158 159 static Param& getStaticParam(); 152 160 }; 153 161 … … 352 360 #undef STATRICKCLASS 353 361 354 SyntParam classProperties(); 362 ///@param handle_defaults_when_saving see SyntParam 363 SyntParam classProperties(bool handle_defaults_when_saving=true); 355 364 // base properties: 356 365 long refno; ///< unique reference number (former 'neuro' refno) … … 482 491 Orient o; ///< rotation matrix calculated from "rot" 483 492 static ParamEntry emptyParamTab[]; 493 static Param& getStaticParam(); 484 494 }; 485 495 … … 515 525 516 526 extern 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;518 527 519 528 #endif -
cpp/gdk/multiparamload.cpp
r66 r81 193 193 const char* thisfilename=file->VgetPath(); 194 194 SString newfilename; 195 const char* t=thisfilename?strrchr(thisfilename,PATH SEPARATORCHAR):0;195 const char* t=thisfilename?strrchr(thisfilename,PATH_SEPARATOR_CHAR):0; 196 196 197 197 if (thisfilename && t) -
cpp/gdk/neurofactory.cpp
r66 r81 7 7 #include "param.h" 8 8 #include "neuroimpl.h" 9 #include "neuroimplfiles.h"9 #include NEURO_IMPL_FILES 10 10 11 11 int NeuroFactory::used=0; … … 37 37 } 38 38 39 #include "neuroimplfiles.h" 40 #include "neurocls-factory.h" 39 #include NEURO_CLS_FACTORY 41 40 42 41 void NeuroFactory::setImplementation() -
cpp/gdk/neuroimpl-simple.h
r66 r81 7 7 8 8 #include "neuroimpl.h" 9 #include "nonstd_math.h" 9 10 10 11 extern ParamEntry NI_StdNeuron_tab[]; -
cpp/gdk/neuroimpl.cpp
r72 r81 6 6 #include "neurofactory.h" 7 7 #include "rndutil.h" 8 #include "nonstd_math.h" 8 9 #ifndef GDK_WITHOUT_FRAMS 9 10 #include "creature.h" … … 38 39 {} 39 40 40 NeuroNetConfig NeuroNetConfig::globalconfig; 41 NeuroNetConfig& NeuroNetConfig::getGlobalConfig() 42 { 43 static NeuroNetConfig globalconfig; 44 return globalconfig; 45 } 41 46 42 47 ///////////////////////////////////////////////////////////////// … … 200 205 chstate=chnewstate; 201 206 neuro->state=newstate; 202 if (NeuroNetConfig::g lobalconfig.nnoise>0.0)207 if (NeuroNetConfig::getGlobalConfig().nnoise>0.0) 203 208 { 204 neuro->state+=RndGen.GaussStd()*NeuroNetConfig::g lobalconfig.nnoise;209 neuro->state+=RndGen.GaussStd()*NeuroNetConfig::getGlobalConfig().nnoise; 205 210 if (channels>1) 206 211 for(int i=0;i<chstate.size();i++) 207 chstate(0)+=RndGen.GaussStd()*NeuroNetConfig::g lobalconfig.nnoise;212 chstate(0)+=RndGen.GaussStd()*NeuroNetConfig::getGlobalConfig().nnoise; 208 213 } 209 214 } … … 274 279 int zero=0; 275 280 par.load2(neuro->getClassParams(),zero); 281 } 282 283 Param& NeuroImpl::getStaticParam() 284 { 285 static Param p(neuroimpl_tab,0,"Neuro"); 286 return p; 276 287 } 277 288 … … 340 351 ParamEntry neurosignals_paramtab[]= 341 352 { 342 {"NeuroSignals",1,8,"NeuroSignals","Signals attached to theneuron.\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.",}, 343 354 344 355 #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)"},356 SIGNPAR_ADD(""), 357 SIGNPAR_RECEIVE(""), 358 SIGNPAR_RECEIVESET(""), 359 SIGNPAR_RECEIVEFILTER(""), 360 SIGNPAR_RECEIVESINGLE(""), 350 361 #undef FIELDSTRUCT 351 362 352 363 #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),},364 SIGNSETPAR_GET, 365 SIGNSETPAR_SIZE, 366 SIGNSETPAR_CLEAR, 356 367 #undef FIELDSTRUCT 357 368 {0,0,0,}, 358 369 }; 359 Param neurosignals_param(neurosignals_paramtab,0); 360 #endif 361 362 Param st_neuroimplparam(neuroimpl_tab,0,"Neuro"); 370 371 Param& NeuroSignals::getStaticParam() 372 { 373 static Param p(neurosignals_paramtab,0); 374 return p; 375 } 376 #endif 363 377 364 378 #ifdef NEURO_SIGNALS … … 474 488 Part *pa; 475 489 if (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]))); 477 491 else 478 492 ret->setEmpty(); … … 485 499 Joint *jo; 486 500 if (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]))); 488 502 else 489 503 ret->setEmpty(); … … 534 548 void NeuroImpl::get_neurodef(ExtValue *ret) 535 549 { 536 ret->setObject(ExtObject(& st_neuroparam,neuro));550 ret->setObject(ExtObject(&Neuro::getStaticParam(),neuro)); 537 551 } 538 552 -
cpp/gdk/neuroimpl.h
r72 r81 15 15 class NeuroImpl; 16 16 extern ParamEntry neuroimpl_tab[]; 17 #ifdef NEURO_SIGNALS18 extern Param neurosignals_param;19 #endif20 17 21 18 class Creature; … … 31 28 double touchrange; 32 29 33 static NeuroNetConfig globalconfig;30 static NeuroNetConfig& getGlobalConfig(); 34 31 }; 35 32 … … 54 51 PARAMPROCDEF(p_receiveSingle); 55 52 #undef STATRICKCLASS 53 54 static Param& getStaticParam(); 56 55 }; 57 56 #endif … … 75 74 static double getStateFromNeuro(Neuro *n); 76 75 int getErrorCount() {return errorcount;} 77 NeuroNetImpl(Model& model, NeuroNetConfig& conf = NeuroNetConfig::g lobalconfig76 NeuroNetImpl(Model& model, NeuroNetConfig& conf = NeuroNetConfig::getGlobalConfig() 78 77 #ifdef NEURO_SIGNALS 79 78 , ChannelSpace *ch=0 … … 250 249 NeuroImpl():owner(0),neuro(0),newstate(0),paramentries(0),simorder(1),status(BeforeInit),channels(1),fields_param(0),fields_object(0) 251 250 #ifdef NEURO_SIGNALS 252 ,sigs(this),sigs_obj(& neurosignals_param,&sigs)251 ,sigs(this),sigs_obj(&NeuroSignals::getStaticParam(),&sigs) 253 252 #endif 254 253 {} … … 298 297 PARAMGETDEF(classObject); 299 298 #undef STATRICKCLASS 299 300 static Param& getStaticParam(); 300 301 }; 301 302 -
cpp/gdk/neurolibrary.cpp
r66 r81 45 45 void NeuroLibrary::addStandardClasses() 46 46 { 47 #include "neurocls-library.h"47 #include NEURO_CLS_LIBRARY 48 48 } 49 49 -
cpp/gdk/param.cpp
r66 r81 283 283 } 284 284 285 void SimpleAbstractParam::save2(SString& f,void *defdata, int addcr)285 void SimpleAbstractParam::save2(SString& f,void *defdata,bool addcr,bool all_names) 286 286 { // defdata!=NULL -> nie zapisuje wartosci domyslnych 287 287 const char *p; … … 303 303 #ifndef SAVE_ALL_NAMES 304 304 #ifdef SAVE_SELECTED_NAMES 305 if (needlabel || !(fl & PARAM_CANOMITNAME))305 if (needlabel || all_names || !(fl & PARAM_CANOMITNAME)) 306 306 #else 307 307 if (needlabel) … … 312 312 { // string - special case 313 313 SString str=getString(i); 314 if (strContainsOneOf(str,", \\\n\r\t "))314 if (strContainsOneOf(str,", \\\n\r\t\"")) 315 315 { 316 316 t+="\""; … … 439 439 } 440 440 441 static bool stringIsNumeric(const char* str) 442 {// /-?.?[0-9]+/ 443 if (!str) return false; 444 if (*str=='-') str++; 445 if (*str=='.') str++; 446 return isdigit(*str); 447 } 448 449 int ParamInterface::setInt(int i,const char* str) 450 { 451 if (!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 } 459 else 460 return setInt(i,atol(str)); 461 } 462 463 int ParamInterface::setDouble(int i,const char* str) 464 { 465 if (!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 } 473 else 474 return setDouble(i,atof(str)); 475 } 476 441 477 int ParamInterface::set(int i,const ExtValue &v) 442 478 { 443 479 switch(type(i)[0]) 444 480 { 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()); 447 483 case 's': { SString t=v.getString(); return setString(i,t); } 448 484 case 'o': return setObject(i,v.getObject()); … … 457 493 switch(type(i)[0]) 458 494 { 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); 461 497 case 's': { SString t(v); return setString(i,t); } 462 498 case 'x': -
cpp/gdk/param.h
r66 r81 102 102 ExtValue getById(const char* prop); 103 103 104 int setInt(int i,const char* str); 105 int setDouble(int i,const char* str); 104 106 virtual int setInt(int,long)=0; ///< set long value, you can only use this for "d" type prop 105 107 virtual int setDouble(int,double)=0; ///< set double value, you can only use this for "f" type prop … … 244 246 245 247 int isequal(int i,void* defdata); 246 void save2(SString&,void *defdata, int addcr=1);248 void save2(SString&,void *defdata,bool addcr=true,bool all_names=true); 247 249 248 250 virtual void setDefault(bool numericonly=false); -
cpp/gdk/paramobj.cpp
r66 r81 5 5 #include "paramobj.h" 6 6 #include "extvalue.h" 7 #include "nonstd_stl.h" 7 8 8 9 static const char* maybedup(bool dup,const char* src) … … 105 106 case 'd': v->setInt(0); break; 106 107 case 'f': v->setDouble(0); break; 107 case 's': v->setString(SString::empty ); break;108 case 's': v->setString(SString::empty()); break; 108 109 case 'o': v->setObject(ExtObject()); break; 109 110 case 'x': break; -
cpp/gdk/sstring.cpp
r66 r81 5 5 6 6 #include "sstring.h" 7 #include "nonstd .h"7 #include "nonstd_stl.h" 8 8 9 9 … … 120 120 void SString::initEmpty() 121 121 { 122 buf=&SBuf::empty ;122 buf=&SBuf::empty(); 123 123 memhint=-1; 124 124 } … … 131 131 void SString::detachEmpty(int ensuresize) 132 132 { 133 if (buf==&SBuf::empty ) { buf=new SBuf(ensuresize,memhint); return; }133 if (buf==&SBuf::empty()) { buf=new SBuf(ensuresize,memhint); return; } 134 134 if (buf->refcount<2) buf->ensureSize(ensuresize,memhint); 135 135 else … … 142 142 void SString::detach() 143 143 { 144 if (buf==&SBuf::empty ) return;144 if (buf==&SBuf::empty()) return; 145 145 if (!--buf->refcount) delete buf; 146 146 } … … 148 148 void SString::detachCopy(int ensuresize) 149 149 { 150 if (buf==&SBuf::empty ) { buf=new SBuf(ensuresize,memhint); return; }150 if (buf==&SBuf::empty()) { buf=new SBuf(ensuresize,memhint); return; } 151 151 if (buf->refcount<2) 152 152 { … … 319 319 } 320 320 321 322 SString SString::empty; 323 SBuf SBuf::empty; 321 SString &SString::empty() 322 { 323 static SString empty; 324 return empty; 325 } 326 327 SBuf &SBuf::empty() 328 { 329 static SBuf empty; 330 return empty; 331 } -
cpp/gdk/sstring.h
r74 r81 21 21 void freeBuf(); 22 22 void append(const char* ch, int chlen=-1); 23 static SBuf empty;23 static SBuf &empty(); 24 24 SBuf(int initsize, int memhint=-1); 25 25 friend class SString; … … 157 157 static const SString& valueOf(double); 158 158 159 static SString empty;159 static SString &empty(); 160 160 }; 161 161 -
cpp/gdk/sstringutils.cpp
r66 r81 121 121 case '\t': tmp+="\\t"; changed=1; break; 122 122 case '\"': tmp+="\\\""; changed=1; break; 123 case '\\': tmp+="\\\\"; changed=1; break; 123 124 default: tmp+=*x; 124 125 } -
cpp/gdk/stdiofile.cpp
r66 r81 4 4 5 5 #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" 8 9 9 10 VirtFILE* StdioFileSystem::Vfopen(const char* path,const char*mode) 10 11 { 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; 13 16 } 14 17 15 18 VirtDIR* StdioFileSystem::Vopendir(const char* path) 16 19 { 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; 22 24 } 23 25 24 26 int StdioFileSystem::Vfexists(const char* path) 25 {return fileExists(path);} 27 { 28 return fileExists(path); 29 } 26 30 27 31 void StdioFILE::setStdio() 28 32 { 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); 35 39 } 36 40 37 #ifndef _MSC_VER38 41 dirent* StdioDIR::Vreaddir() 39 42 { 40 return readdir(dir); 43 //FMprintf("Vreaddir %s",dir); 44 return readdir(dir); 41 45 } 42 #endif -
cpp/gdk/stdiofile.h
r66 r81 9 9 #include "sstring.h" 10 10 #include <stdio.h> 11 #ifndef _MSC_VER 12 #include <dirent.h> 13 #endif 11 #include "nonstd_dir.h" 14 12 15 13 class StdioFileSystem: public VirtFileSystem … … 49 47 class StdioDIR: public VirtDIR 50 48 { 51 #ifndef _MSC_VER52 49 DIR *dir; 53 50 public: … … 55 52 ~StdioDIR() {if (dir) closedir(dir);} 56 53 dirent* Vreaddir(); 57 #endif58 54 }; 59 55 -
cpp/gdk/stdouterr.cpp
r66 r81 4 4 5 5 #include "stdouterr.h" 6 #ifdef SHP 7 #include <FBaseSys.h> //AppLog 8 #else 6 9 #include <stdio.h> 10 #endif 7 11 8 12 void StdoutErrorHandler::handle(const char *o,const char *m,const char *bl,int w) … … 10 14 static char* level[]={"DEBUG","INFO","WARN","ERROR","CRITICAL"}; 11 15 if (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 17 AppLog("[%s] %s::%s - %s\n",level[w+1],o,m,bl); 18 #else 19 if (file) 20 file->printf("[%s] %s::%s - %s\n",level[w+1],o,m,bl); 21 else 22 printf("[%s] %s::%s - %s\n",level[w+1],o,m,bl); 23 #endif 13 24 } -
cpp/gdk/stdouterr.h
r66 r81 7 7 8 8 #include "errmanager.h" 9 #include "virtfile.h" 9 10 10 11 class StdoutErrorHandler: public ErrorHandlerBase 11 12 { 13 VirtFILE *file; 12 14 public: 13 StdoutErrorHandler(int opts=DontBlock ):ErrorHandlerBase(opts) {}15 StdoutErrorHandler(int opts=DontBlock,VirtFILE *_file=NULL):ErrorHandlerBase(opts),file(_file) {} 14 16 void handle(const char *o,const char *m,const char *bl,int w); 15 17 }; -
cpp/gdk/syntparam.cpp
r66 r81 8 8 #include <math.h> 9 9 10 SyntParam::SyntParam(ParamEntry *init_pe,SString* autostr )10 SyntParam::SyntParam(ParamEntry *init_pe,SString* autostr,bool handle_defaults_when_saving) 11 11 :autostring(autostr) 12 12 { … … 14 14 pe=ParamObject::makeParamTab(this); 15 15 Param::setParamTab(pe); 16 if (handle_defaults_when_saving) 17 { 18 def_obj=ParamObject::makeObject(pe); 19 Param::select(def_obj); 20 Param::setDefault(); 21 } 22 else 23 def_obj=NULL; 16 24 obj=ParamObject::makeObject(pe); 17 25 Param::select(obj); … … 27 35 Param::setParamTab(pe); 28 36 obj=ParamObject::dupObject(src.obj); 37 def_obj=src.def_obj ? ParamObject::dupObject(src.def_obj) : NULL; 29 38 Param::select(obj); 30 39 } … … 35 44 ParamObject::freeParamTab(pe); 36 45 ParamObject::freeObject(obj); 46 ParamObject::freeObject(def_obj); 37 47 } 38 48 … … 40 50 { 41 51 if (!s) s=autostring; 42 if (s) {*s=""; Param::save2(*s, 0,0);}52 if (s) {*s=""; Param::save2(*s,def_obj,0);} 43 53 } 44 54 -
cpp/gdk/syntparam.h
r66 r81 8 8 #include "param.h" 9 9 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 */ 10 19 class SyntParam: public Param 11 20 { 12 void* obj ;21 void* obj,*def_obj; 13 22 ParamEntry *pe; 14 23 SString* autostring; 15 24 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 */ 27 SyntParam(ParamEntry *pe,SString* autostring=0,bool handle_defaults_when_saving=true); 17 28 SyntParam(const SyntParam& src); 18 29 ~SyntParam(); -
cpp/gdk/virtfile.cpp
r66 r81 64 64 #undef feof 65 65 #endif 66 #ifdef SHP 67 #undef feof 68 #endif 66 69 int feof(VirtFILE* f) {return f->Veof();} 67 70 #ifdef __BORLANDC__ -
cpp/gdk/virtfile.h
r66 r81 75 75 #undef feof 76 76 #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 77 80 DLLEXP int feof(VirtFILE* f);// {return f->Veof();} 78 81 #ifdef __BORLANDC__
Note: See TracChangeset
for help on using the changeset viewer.