Index: cpp/gdk/defgenoconv.cpp
===================================================================
--- cpp/gdk/defgenoconv.cpp	(revision 80)
+++ cpp/gdk/defgenoconv.cpp	(revision 81)
@@ -1,5 +1,5 @@
 #include "defgenoconv.h"
 
-#include "gen-config.h"
+#include GEN_CONFIG_FILE
 
 #ifdef USE_GENCONV_F10
@@ -29,4 +29,7 @@
 #ifdef USE_GENCONV_F81
 #include "conv_f8tof1.h"
+#endif
+#ifdef USE_GENCONV_F90
+#include "conv_f9.h"
 #endif
 
@@ -58,7 +61,8 @@
 #endif
 #ifdef USE_GENCONV_F81
-GenoConv_F8ToF1 *gc81=new GenoConv_F8ToF1();
-GenoConv_F8ToF1::staticpar=gc81->par; //a trick so that the simulator can see this param
-addConverter(gc81);
+addConverter(new GenoConv_F8ToF1());
+#endif
+#ifdef USE_GENCONV_F90
+addConverter(new GenoConv_F90);
 #endif
 
Index: cpp/gdk/gdktest.cpp
===================================================================
--- cpp/gdk/gdktest.cpp	(revision 80)
+++ cpp/gdk/gdktest.cpp	(revision 81)
@@ -33,4 +33,6 @@
 for (int i=0;i<pi.getPropCount();i++)
 	{
+	const char* type=pi.type(i);
+	if (*type=='p') continue;
 	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)));
 	}
Index: cpp/gdk/geno.cpp
===================================================================
--- cpp/gdk/geno.cpp	(revision 80)
+++ cpp/gdk/geno.cpp	(revision 81)
@@ -114,5 +114,5 @@
 Geno::Geno(const SString& src)
 {
-init(src,-1,SString::empty,SString::empty);
+init(src,-1,SString::empty(),SString::empty());
 }
 
@@ -128,5 +128,5 @@
 {
 freeF0();
-init(g,-1,SString::empty,SString::empty);
+init(g,-1,SString::empty(),SString::empty());
 }
 
Index: cpp/gdk/modelparts.cpp
===================================================================
--- cpp/gdk/modelparts.cpp	(revision 80)
+++ cpp/gdk/modelparts.cpp	(revision 81)
@@ -193,6 +193,7 @@
 #include "defassign-f0_neuro.h"
 state=0.0;
-myclass=0;
-knownclass=1;
+myclass=NULL;
+myclassname="N";//default d="N" but f0.def is unable to set this (d is GETSET, not a regular FIELD)
+knownclass=0;
 refno=0;
 pos=Pt3D_0; rot=Pt3D_0;
@@ -343,9 +344,9 @@
 }
 
-SyntParam Neuro::classProperties()
+SyntParam Neuro::classProperties(bool handle_defaults_when_saving)
 {
 NeuroClass *cl=getClass();
 ParamEntry *pe = cl ? cl->getParamTab() : emptyParamTab;
-return SyntParam(pe,&myclassparams);
+return SyntParam(pe,&myclassparams,handle_defaults_when_saving);
 }
 
@@ -507,5 +508,5 @@
 	ret->setEmpty();
 else
-	ret->setObject(ExtObject(&st_neuroparam,inputs(i).n));
+	ret->setObject(ExtObject(&Neuro::getStaticParam(),inputs(i).n));
 }
 
@@ -648,4 +649,11 @@
 }
 
+Param& Part::getStaticParam()
+{
+static Param p(f0_part_paramtab,0,"Part");
+return p;
+}
+
+
 ///////////////////////////
 
@@ -707,4 +715,11 @@
 return usedelta;
 }
+
+Param& Joint::getStaticParam()
+{
+static Param p(f0_joint_paramtab,0,"Joint");
+return p;
+}
+
 
 /////////////////////////////////////////////////////////////////
@@ -822,4 +837,10 @@
 };
 
+Param& Neuro::getStaticParam()
+{
+static Param p(f0_neuro_paramtab,0,"NeuroDef");
+return p;
+}
+
 ////////////////////////
 
@@ -843,7 +864,3 @@
 {setClassName(arg->getString());return PSET_CHANGED;}
 
-Param st_neuroparam(f0_neuro_paramtab,0,"NeuroDef");
-Param st_jointparam(f0_joint_paramtab,0,"Joint");
-Param st_partparam(f0_part_paramtab,0,"Part");
-
-
+
Index: cpp/gdk/modelparts.h
===================================================================
--- cpp/gdk/modelparts.h	(revision 80)
+++ cpp/gdk/modelparts.h	(revision 81)
@@ -89,7 +89,12 @@
 //Slist neurons; // "select * from owner->neurons where part=this" ;-)
 
+Pt3D vcolor;
+double vsize;
+
 Part();
 Part(const Part& src):PartBase(getDefaultStyle()) {operator=(src);}
 void operator=(const Part& src);
+
+static Param& getStaticParam();
 };
 
@@ -150,4 +155,7 @@
     set by 'singlestep' if j: attributes use delta option */
 int usedelta;
+Pt3D vcolor;
+
+static Param& getStaticParam();
 };
 
@@ -352,5 +360,6 @@
 #undef STATRICKCLASS
 
-SyntParam classProperties();
+///@param handle_defaults_when_saving see SyntParam
+SyntParam classProperties(bool handle_defaults_when_saving=true);
 // base properties:
 long refno; ///< unique reference number (former 'neuro' refno)
@@ -482,4 +491,5 @@
 Orient o;	///< rotation matrix calculated from "rot"
 static ParamEntry emptyParamTab[];
+static Param& getStaticParam();
 };
 
@@ -515,5 +525,4 @@
 
 extern ParamEntry f0_part_paramtab[],f0_joint_paramtab[],f0_nodeltajoint_paramtab[],f0_neuro_paramtab[],f0_neuroconn_paramtab[],f0_neuroitem_paramtab[];
-extern Param st_neuroparam,st_jointparam,st_partparam;
 
 #endif
Index: cpp/gdk/multiparamload.cpp
===================================================================
--- cpp/gdk/multiparamload.cpp	(revision 80)
+++ cpp/gdk/multiparamload.cpp	(revision 81)
@@ -193,5 +193,5 @@
 const char* thisfilename=file->VgetPath();
 SString newfilename;
-const char* t=thisfilename?strrchr(thisfilename,PATHSEPARATORCHAR):0;
+const char* t=thisfilename?strrchr(thisfilename,PATH_SEPARATOR_CHAR):0;
 
 if (thisfilename && t)
Index: cpp/gdk/neurofactory.cpp
===================================================================
--- cpp/gdk/neurofactory.cpp	(revision 80)
+++ cpp/gdk/neurofactory.cpp	(revision 81)
@@ -7,5 +7,5 @@
 #include "param.h"
 #include "neuroimpl.h"
-#include "neuroimplfiles.h"
+#include NEURO_IMPL_FILES
 
 int NeuroFactory::used=0;
@@ -37,6 +37,5 @@
 }
 
-#include "neuroimplfiles.h"
-#include "neurocls-factory.h"
+#include NEURO_CLS_FACTORY
 
 void NeuroFactory::setImplementation()
Index: cpp/gdk/neuroimpl-simple.h
===================================================================
--- cpp/gdk/neuroimpl-simple.h	(revision 80)
+++ cpp/gdk/neuroimpl-simple.h	(revision 81)
@@ -7,4 +7,5 @@
 
 #include "neuroimpl.h"
+#include "nonstd_math.h"
 
 extern ParamEntry NI_StdNeuron_tab[];
Index: cpp/gdk/neuroimpl.cpp
===================================================================
--- cpp/gdk/neuroimpl.cpp	(revision 80)
+++ cpp/gdk/neuroimpl.cpp	(revision 81)
@@ -6,4 +6,5 @@
 #include "neurofactory.h"
 #include "rndutil.h"
+#include "nonstd_math.h"
 #ifndef GDK_WITHOUT_FRAMS
 #include "creature.h"
@@ -38,5 +39,9 @@
 {}
 
-NeuroNetConfig NeuroNetConfig::globalconfig;
+NeuroNetConfig& NeuroNetConfig::getGlobalConfig()
+{
+static NeuroNetConfig globalconfig;
+return globalconfig;
+}
 
 /////////////////////////////////////////////////////////////////
@@ -200,10 +205,10 @@
 		chstate=chnewstate;
 	neuro->state=newstate;
-	if (NeuroNetConfig::globalconfig.nnoise>0.0)
+	if (NeuroNetConfig::getGlobalConfig().nnoise>0.0)
 		{
-		neuro->state+=RndGen.GaussStd()*NeuroNetConfig::globalconfig.nnoise;
+		neuro->state+=RndGen.GaussStd()*NeuroNetConfig::getGlobalConfig().nnoise;
 		if (channels>1)
 			for(int i=0;i<chstate.size();i++)
-				chstate(0)+=RndGen.GaussStd()*NeuroNetConfig::globalconfig.nnoise;
+				chstate(0)+=RndGen.GaussStd()*NeuroNetConfig::getGlobalConfig().nnoise;
 		}
 	}
@@ -274,4 +279,10 @@
 int zero=0;
 par.load2(neuro->getClassParams(),zero);
+}
+
+Param& NeuroImpl::getStaticParam()
+{
+static Param p(neuroimpl_tab,0,"Neuro");
+return p;
 }
 
@@ -340,25 +351,28 @@
 ParamEntry neurosignals_paramtab[]=
  {
-{"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.",},
+{"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.",},
 
 #define FIELDSTRUCT NeuroSignals
-{"add",0,PARAM_NOSTATIC,"Add","p(s channel)",PROCEDURE(p_add),"Create a new signal"},
-{"receive",0,PARAM_NOSTATIC,"Receive","p f(s channel)",PROCEDURE(p_receive),"Receive the aggregated signal power in a given channel."},
-{"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])."},
-{"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."},
-{"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)"},
+SIGNPAR_ADD(""),
+SIGNPAR_RECEIVE(""),
+SIGNPAR_RECEIVESET(""),
+SIGNPAR_RECEIVEFILTER(""),
+SIGNPAR_RECEIVESINGLE(""),
 #undef FIELDSTRUCT
 
 #define FIELDSTRUCT SignalSet
-{"get",0,PARAM_NOSTATIC,"Get","p oSignal(d index)",PROCEDURE(p_get),},
-{"size",0,1+PARAM_NOSTATIC,"Size","d",GETONLY(size),},
-{"clear",0,1+PARAM_NOSTATIC,"Clear","p()",PROCEDURE(p_clear),},
+SIGNSETPAR_GET,
+SIGNSETPAR_SIZE,
+SIGNSETPAR_CLEAR,
 #undef FIELDSTRUCT
 {0,0,0,},
  }; 
-Param neurosignals_param(neurosignals_paramtab,0);
-#endif
-
-Param st_neuroimplparam(neuroimpl_tab,0,"Neuro");
+
+Param& NeuroSignals::getStaticParam()
+{
+static Param p(neurosignals_paramtab,0);
+return p;
+}
+#endif
 
 #ifdef NEURO_SIGNALS
@@ -474,5 +488,5 @@
 Part *pa;
 if (pa=neuro->getPart())
-	ret->setObject(ExtObject(&mechpart_param,((MechPart *)pa->userdata[CreatMechObject::modeltags_id])));
+	ret->setObject(ExtObject(&MechPart::getStaticParam(),((MechPart *)pa->userdata[CreatMechObject::modeltags_id])));
 else
 	ret->setEmpty();
@@ -485,5 +499,5 @@
 Joint *jo;
 if (jo=neuro->getJoint())
-	ret->setObject(ExtObject(&mechjoint_param,((MechJoint*)jo->userdata[CreatMechObject::modeltags_id])));
+	ret->setObject(ExtObject(&MechJoint::getStaticParam(),((MechJoint*)jo->userdata[CreatMechObject::modeltags_id])));
 else
 	ret->setEmpty();
@@ -534,5 +548,5 @@
 void NeuroImpl::get_neurodef(ExtValue *ret)
 {
-ret->setObject(ExtObject(&st_neuroparam,neuro));
+ret->setObject(ExtObject(&Neuro::getStaticParam(),neuro));
 }
 
Index: cpp/gdk/neuroimpl.h
===================================================================
--- cpp/gdk/neuroimpl.h	(revision 80)
+++ cpp/gdk/neuroimpl.h	(revision 81)
@@ -15,7 +15,4 @@
 class NeuroImpl;
 extern ParamEntry neuroimpl_tab[];
-#ifdef NEURO_SIGNALS
-extern Param neurosignals_param;
-#endif
 
 class Creature;
@@ -31,5 +28,5 @@
 double touchrange;
 
-static NeuroNetConfig globalconfig;
+static NeuroNetConfig& getGlobalConfig();
 };
 
@@ -54,4 +51,6 @@
 PARAMPROCDEF(p_receiveSingle);
 #undef STATRICKCLASS
+
+static Param& getStaticParam();
 };
 #endif
@@ -75,5 +74,5 @@
 static double getStateFromNeuro(Neuro *n);
 int getErrorCount() {return errorcount;}
-NeuroNetImpl(Model& model, NeuroNetConfig& conf = NeuroNetConfig::globalconfig
+NeuroNetImpl(Model& model, NeuroNetConfig& conf = NeuroNetConfig::getGlobalConfig()
 #ifdef NEURO_SIGNALS
 , ChannelSpace *ch=0
@@ -250,5 +249,5 @@
 NeuroImpl():owner(0),neuro(0),newstate(0),paramentries(0),simorder(1),status(BeforeInit),channels(1),fields_param(0),fields_object(0)
 #ifdef NEURO_SIGNALS
-,sigs(this),sigs_obj(&neurosignals_param,&sigs)
+,sigs(this),sigs_obj(&NeuroSignals::getStaticParam(),&sigs)
 #endif
  {}
@@ -298,4 +297,6 @@
 PARAMGETDEF(classObject);
 #undef STATRICKCLASS
+
+  static Param& getStaticParam();
 };
 
Index: cpp/gdk/neurolibrary.cpp
===================================================================
--- cpp/gdk/neurolibrary.cpp	(revision 80)
+++ cpp/gdk/neurolibrary.cpp	(revision 81)
@@ -45,5 +45,5 @@
 void NeuroLibrary::addStandardClasses()
 {
-#include "neurocls-library.h"
+#include NEURO_CLS_LIBRARY
 }
 
Index: cpp/gdk/param.cpp
===================================================================
--- cpp/gdk/param.cpp	(revision 80)
+++ cpp/gdk/param.cpp	(revision 81)
@@ -283,5 +283,5 @@
 }
 
-void SimpleAbstractParam::save2(SString& f,void *defdata,int addcr)
+void SimpleAbstractParam::save2(SString& f,void *defdata,bool addcr,bool all_names)
 { // defdata!=NULL -> nie zapisuje wartosci domyslnych
 const char *p;
@@ -303,5 +303,5 @@
 #ifndef SAVE_ALL_NAMES
 #ifdef SAVE_SELECTED_NAMES
-		if (needlabel || !(fl & PARAM_CANOMITNAME))
+		if (needlabel || all_names || !(fl & PARAM_CANOMITNAME))
 #else
 		if (needlabel)
@@ -312,5 +312,5 @@
 			{ // string - special case
 			SString str=getString(i);
-			if (strContainsOneOf(str,", \\\n\r\t"))
+			if (strContainsOneOf(str,", \\\n\r\t\""))
 				{
 				t+="\"";
@@ -439,10 +439,46 @@
 }
 
+static bool stringIsNumeric(const char* str)
+{//   /-?.?[0-9]+/
+if (!str) return false;
+if (*str=='-') str++;
+if (*str=='.') str++;
+return isdigit(*str);
+}
+
+int ParamInterface::setInt(int i,const char* str)
+{
+if (!stringIsNumeric(str))
+	{
+	long a,b,c;
+	if (getMinMax(i,a,b,c)>=3)
+		return setInt(i,c);
+	else
+		return setInt(i,(long)0);
+	}
+else
+	return setInt(i,atol(str));
+}
+
+int ParamInterface::setDouble(int i,const char* str)
+{
+if (!stringIsNumeric(str))
+	{
+	double a,b,c;
+	if (getMinMax(i,a,b,c)>=3)
+		return setDouble(i,c);
+	else
+		return setDouble(i,(double)0);
+	}
+else
+	return setDouble(i,atof(str));
+}
+
 int ParamInterface::set(int i,const ExtValue &v)
 {
 switch(type(i)[0])
 	{
-	case 'd': return setInt(i,v.getInt());
-	case 'f': return setDouble(i,v.getDouble());
+	case 'd': if ((v.type==TInt)||(v.type==TDouble)) return setInt(i,v.getInt()); else return setInt(i,(const char*)v.getString());
+	case 'f': if ((v.type==TInt)||(v.type==TDouble)) return setDouble(i,v.getDouble()); else return setDouble(i,(const char*)v.getString());
 	case 's': { SString t=v.getString(); return setString(i,t); }
 	case 'o': return setObject(i,v.getObject());
@@ -457,6 +493,6 @@
 switch(type(i)[0])
 	{
-	case 'd': return setInt(i,atol(v));
-	case 'f': return setDouble(i,atof(v));
+	case 'd': return setInt(i,v);
+	case 'f': return setDouble(i,v);
 	case 's': { SString t(v); return setString(i,t); }
 	case 'x':
Index: cpp/gdk/param.h
===================================================================
--- cpp/gdk/param.h	(revision 80)
+++ cpp/gdk/param.h	(revision 81)
@@ -102,4 +102,6 @@
 ExtValue getById(const char* prop);
 
+int setInt(int i,const char* str);
+int setDouble(int i,const char* str);
 virtual int setInt(int,long)=0;		///< set long value, you can only use this for "d" type prop
 virtual int setDouble(int,double)=0;	///< set double value, you can only use this for "f" type prop
@@ -244,5 +246,5 @@
 
 int isequal(int i,void* defdata);
-void save2(SString&,void *defdata,int addcr=1);
+void save2(SString&,void *defdata,bool addcr=true,bool all_names=true);
 
 virtual void setDefault(bool numericonly=false);
Index: cpp/gdk/paramobj.cpp
===================================================================
--- cpp/gdk/paramobj.cpp	(revision 80)
+++ cpp/gdk/paramobj.cpp	(revision 81)
@@ -5,4 +5,5 @@
 #include "paramobj.h"
 #include "extvalue.h"
+#include "nonstd_stl.h"
 
 static const char* maybedup(bool dup,const char* src)
@@ -105,5 +106,5 @@
 	case 'd': v->setInt(0); break;
 	case 'f': v->setDouble(0); break;
-	case 's': v->setString(SString::empty); break;
+	case 's': v->setString(SString::empty()); break;
 	case 'o': v->setObject(ExtObject()); break;
 	case 'x': break;
Index: cpp/gdk/sstring.cpp
===================================================================
--- cpp/gdk/sstring.cpp	(revision 80)
+++ cpp/gdk/sstring.cpp	(revision 81)
@@ -5,5 +5,5 @@
 
 #include "sstring.h"
-#include "nonstd.h"
+#include "nonstd_stl.h"
 
 
@@ -120,5 +120,5 @@
 void SString::initEmpty()
 {
-buf=&SBuf::empty;
+buf=&SBuf::empty();
 memhint=-1;
 }
@@ -131,5 +131,5 @@
 void SString::detachEmpty(int ensuresize)
 {
-if (buf==&SBuf::empty) { buf=new SBuf(ensuresize,memhint); return; }
+if (buf==&SBuf::empty()) { buf=new SBuf(ensuresize,memhint); return; }
 if (buf->refcount<2) buf->ensureSize(ensuresize,memhint);
 else
@@ -142,5 +142,5 @@
 void SString::detach()
 {
-if (buf==&SBuf::empty) return;
+if (buf==&SBuf::empty()) return;
 if (!--buf->refcount) delete buf;
 }
@@ -148,5 +148,5 @@
 void SString::detachCopy(int ensuresize)
 {
-if (buf==&SBuf::empty) { buf=new SBuf(ensuresize,memhint); return; }
+if (buf==&SBuf::empty()) { buf=new SBuf(ensuresize,memhint); return; }
 if (buf->refcount<2)
 	{
@@ -319,5 +319,13 @@
 }
 
-
-SString SString::empty;
-SBuf SBuf::empty;
+SString &SString::empty()
+{
+static SString empty;
+return empty;
+}
+
+SBuf &SBuf::empty()
+{
+static SBuf empty;
+return empty;
+}
Index: cpp/gdk/sstring.h
===================================================================
--- cpp/gdk/sstring.h	(revision 80)
+++ cpp/gdk/sstring.h	(revision 81)
@@ -21,5 +21,5 @@
 void freeBuf();
 void append(const char* ch, int chlen=-1);
-static SBuf empty;
+static SBuf &empty();
 SBuf(int initsize, int memhint=-1);
 friend class SString;
@@ -157,5 +157,5 @@
 static const SString& valueOf(double);
 
-static SString empty;
+static SString &empty();
 };
 
Index: cpp/gdk/sstringutils.cpp
===================================================================
--- cpp/gdk/sstringutils.cpp	(revision 80)
+++ cpp/gdk/sstringutils.cpp	(revision 81)
@@ -121,4 +121,5 @@
 		case '\t': tmp+="\\t"; changed=1; break;
 		case '\"': tmp+="\\\""; changed=1; break;
+		case '\\': tmp+="\\\\"; changed=1; break;
 		default: tmp+=*x;
 		}
Index: cpp/gdk/stdiofile.cpp
===================================================================
--- cpp/gdk/stdiofile.cpp	(revision 80)
+++ cpp/gdk/stdiofile.cpp	(revision 81)
@@ -4,39 +4,42 @@
 
 #include "stdiofile.h"
-#include "nonstd.h"
-#include "nonstd_io.h"
+#include "nonstd_dir.h"
+#include "nonstd_stdio.h"
+#include "framsg.h"
 
 VirtFILE* StdioFileSystem::Vfopen(const char* path,const char*mode)
 {
-FILE *f=fopen(path,mode);
-if (f) return new StdioFILE(f,path); else return 0;
+	//FMprintf("Vfopen %s %s",path,mode);
+	FILE *f=fopen(path,mode);
+	//FMprintf("%p",f);
+	if (f) return new StdioFILE(f,path); else return 0;
 }
 
 VirtDIR* StdioFileSystem::Vopendir(const char* path)
 {
-#ifndef _MSC_VER
-DIR *d=opendir(path);
-if (d) return new StdioDIR(d); else
-#endif
-return 0;
+	//FMprintf("Vopendir %s",path);
+	DIR *d=opendir(path);
+	//FMprintf("%p",d);
+	if (d) return new StdioDIR(d); else return 0;
 }
 
 int StdioFileSystem::Vfexists(const char* path)
-{return fileExists(path);}
+{
+	return fileExists(path);
+}
 
 void StdioFILE::setStdio()
 {
-static StdioFILEDontClose si(stdin);
-static StdioFILEDontClose so(stdout);
-static StdioFILEDontClose se(stderr);
-setVstdin(&si);
-setVstdout(&so);
-setVstderr(&se);
+	static StdioFILEDontClose si(stdin);
+	static StdioFILEDontClose so(stdout);
+	static StdioFILEDontClose se(stderr);
+	setVstdin(&si);
+	setVstdout(&so);
+	setVstderr(&se);
 }
 
-#ifndef _MSC_VER
 dirent* StdioDIR::Vreaddir()
 {
-return readdir(dir);
+	//FMprintf("Vreaddir %s",dir);
+	return readdir(dir);
 }
-#endif
Index: cpp/gdk/stdiofile.h
===================================================================
--- cpp/gdk/stdiofile.h	(revision 80)
+++ cpp/gdk/stdiofile.h	(revision 81)
@@ -9,7 +9,5 @@
 #include "sstring.h"
 #include <stdio.h>
-#ifndef _MSC_VER
-#include <dirent.h>
-#endif
+#include "nonstd_dir.h"
 
 class StdioFileSystem: public VirtFileSystem
@@ -49,5 +47,4 @@
 class StdioDIR: public VirtDIR
 {
-#ifndef _MSC_VER
 DIR *dir;
   public:
@@ -55,5 +52,4 @@
 ~StdioDIR() {if (dir) closedir(dir);}
 dirent* Vreaddir();
-#endif
 };
 
Index: cpp/gdk/stdouterr.cpp
===================================================================
--- cpp/gdk/stdouterr.cpp	(revision 80)
+++ cpp/gdk/stdouterr.cpp	(revision 81)
@@ -4,5 +4,9 @@
 
 #include "stdouterr.h"
+#ifdef SHP
+#include <FBaseSys.h> //AppLog
+#else
 #include <stdio.h>
+#endif
 
 void StdoutErrorHandler::handle(const char *o,const char *m,const char *bl,int w)
@@ -10,4 +14,11 @@
 static char* level[]={"DEBUG","INFO","WARN","ERROR","CRITICAL"};
 if (w<-1) w=-1; else if (w>3) w=3;
-printf("[%s] %s::%s - %s\n",level[w+1],o,m,bl);
+#ifdef SHP
+AppLog("[%s] %s::%s - %s\n",level[w+1],o,m,bl);
+#else
+if (file)
+	file->printf("[%s] %s::%s - %s\n",level[w+1],o,m,bl);
+else
+	printf("[%s] %s::%s - %s\n",level[w+1],o,m,bl);
+#endif
 }
Index: cpp/gdk/stdouterr.h
===================================================================
--- cpp/gdk/stdouterr.h	(revision 80)
+++ cpp/gdk/stdouterr.h	(revision 81)
@@ -7,9 +7,11 @@
 
 #include "errmanager.h"
+#include "virtfile.h"
 
 class StdoutErrorHandler: public ErrorHandlerBase
 {
+VirtFILE *file;
   public:
-StdoutErrorHandler(int opts=DontBlock):ErrorHandlerBase(opts) {}
+StdoutErrorHandler(int opts=DontBlock,VirtFILE *_file=NULL):ErrorHandlerBase(opts),file(_file) {}
 void handle(const char *o,const char *m,const char *bl,int w);
 };
Index: cpp/gdk/syntparam.cpp
===================================================================
--- cpp/gdk/syntparam.cpp	(revision 80)
+++ cpp/gdk/syntparam.cpp	(revision 81)
@@ -8,5 +8,5 @@
 #include <math.h>
 
-SyntParam::SyntParam(ParamEntry *init_pe,SString* autostr)
+SyntParam::SyntParam(ParamEntry *init_pe,SString* autostr,bool handle_defaults_when_saving)
 	:autostring(autostr)
 {
@@ -14,4 +14,12 @@
 pe=ParamObject::makeParamTab(this);
 Param::setParamTab(pe);
+if (handle_defaults_when_saving)
+	{
+	def_obj=ParamObject::makeObject(pe);
+	Param::select(def_obj);
+	Param::setDefault();
+	}
+else
+	def_obj=NULL;
 obj=ParamObject::makeObject(pe);
 Param::select(obj);
@@ -27,4 +35,5 @@
 Param::setParamTab(pe);
 obj=ParamObject::dupObject(src.obj);
+def_obj=src.def_obj ? ParamObject::dupObject(src.def_obj) : NULL;
 Param::select(obj);
 }
@@ -35,4 +44,5 @@
 ParamObject::freeParamTab(pe);
 ParamObject::freeObject(obj);
+ParamObject::freeObject(def_obj);
 }
 
@@ -40,5 +50,5 @@
 {
 if (!s) s=autostring;
-if (s) {*s=""; Param::save2(*s,0,0);}
+if (s) {*s=""; Param::save2(*s,def_obj,0);}
 }
 
Index: cpp/gdk/syntparam.h
===================================================================
--- cpp/gdk/syntparam.h	(revision 80)
+++ cpp/gdk/syntparam.h	(revision 81)
@@ -8,11 +8,22 @@
 #include "param.h"
 
+/** Creates param + matching temporary object (ParamObject)
+    using the supplied ParamEntry'ies as a template.
+    This is mainly used for manipulating specialized neuron properties
+    (Neuro.d field) in absence of live neuron implementations
+    (these are only available in live creatures, but not when operating
+    on Models and Genotypes).
+
+    See also: gdktest.cpp
+ */
 class SyntParam: public Param
 {
-void* obj;
+void* obj,*def_obj;
 ParamEntry *pe;
 SString* autostring;
   public:
-SyntParam(ParamEntry *pe,SString* autostring=0);
+/** @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)
+ */
+SyntParam(ParamEntry *pe,SString* autostring=0,bool handle_defaults_when_saving=true);
 SyntParam(const SyntParam& src);
 ~SyntParam();
Index: cpp/gdk/virtfile.cpp
===================================================================
--- cpp/gdk/virtfile.cpp	(revision 80)
+++ cpp/gdk/virtfile.cpp	(revision 81)
@@ -64,4 +64,7 @@
 #undef feof
 #endif
+#ifdef SHP
+#undef feof
+#endif
 int feof(VirtFILE* f) {return f->Veof();}
 #ifdef __BORLANDC__
Index: cpp/gdk/virtfile.h
===================================================================
--- cpp/gdk/virtfile.h	(revision 80)
+++ cpp/gdk/virtfile.h	(revision 81)
@@ -75,4 +75,7 @@
 #undef feof
 #endif
+#ifdef SHP //nie wiem co to robi i jak ma byc, ale sie kompiluje z tym undefem a bez nie. tak samo w cpp
+#undef feof
+#endif
 DLLEXP int feof(VirtFILE* f);// {return f->Veof();}
 #ifdef __BORLANDC__
