Index: cpp/frams/Makefile-GDK
===================================================================
--- cpp/frams/Makefile-GDK	(revision 245)
+++ cpp/frams/Makefile-GDK	(revision 247)
@@ -15,54 +15,53 @@
 
 gdk_test: $(GDK_TEST_OBJS)
-	$(CXX) $(GDK_TEST_OBJS) -o $@
+	$(CXX) $(GDK_TEST_OBJS) $(LDFLAGS) -o $@
 
 genoconv_test: $(GENOCONV_TEST_OBJS)
-	$(CXX) $(GENOCONV_TEST_OBJS) -o $@
+	$(CXX) $(GENOCONV_TEST_OBJS) $(LDFLAGS) -o $@
 
 geno_test: $(GENO_TEST_OBJS)
-	$(CXX) $(GENO_TEST_OBJS) -o $@
+	$(CXX) $(GENO_TEST_OBJS) $(LDFLAGS) -o $@
 
 genooper_test: $(GENOOPER_TEST_OBJS)
-	$(CXX) $(GENOOPER_TEST_OBJS) -o $@
+	$(CXX) $(GENOOPER_TEST_OBJS) $(LDFLAGS) -o $@
 
 genooper_test_fTest: $(GENOOPER_TEST_FTEST_OBJS)
-	$(CXX) $(GENOOPER_TEST_FTEST_OBJS) -o $@
+	$(CXX) $(GENOOPER_TEST_FTEST_OBJS) $(LDFLAGS) -o $@
 
 neuro_test: $(NEURO_TEST_OBJS)
-	$(CXX) $(NEURO_TEST_OBJS) -o $@
+	$(CXX) $(NEURO_TEST_OBJS) $(LDFLAGS) -o $@
 
 loader_test: $(LOADER_TEST_OBJS)
-	$(CXX) $(LOADER_TEST_OBJS) -o $@
+	$(CXX) $(LOADER_TEST_OBJS) $(LDFLAGS) -o $@
 
 serial_test: $(SERIAL_TEST_OBJS)
-	$(CXX) $(SERIAL_TEST_OBJS) -o $@
+	$(CXX) $(SERIAL_TEST_OBJS) $(LDFLAGS) -o $@
 
 multiline_f0_test: $(MULTILINE_F0_OBJS)
-	$(CXX) $(MULTILINE_F0_OBJS) -o $@
+	$(CXX) $(MULTILINE_F0_OBJS) $(LDFLAGS) -o $@
 
 f0_variants_test: $(F0_VARIANTS_OBJS)
-	$(CXX) $(F0_VARIANTS_OBJS) -o $@
+	$(CXX) $(F0_VARIANTS_OBJS) $(LDFLAGS) -o $@
 
 full_props: $(FULL_PROPS_OBJS)
-	$(CXX) $(FULL_PROPS_OBJS) -o $@
+	$(CXX) $(FULL_PROPS_OBJS) $(LDFLAGS) -o $@
 
 part_shapes: $(PART_SHAPES_OBJS)
-	$(CXX) $(PART_SHAPES_OBJS) -o $@
+	$(CXX) $(PART_SHAPES_OBJS) $(LDFLAGS) -o $@
 
 neuro_layout_test: $(NEURO_LAYOUT_TEST_OBJS)
-	$(CXX) $(NEURO_LAYOUT_TEST_OBJS) -o $@
-
+	$(CXX) $(NEURO_LAYOUT_TEST_OBJS) $(LDFLAGS) -o $@
 
 geometry_apices_test: $(GEOMETRY_APICES_TEST_OBJS)
-	$(CXX) $(GEOMETRY_APICES_TEST_OBJS) -o $@
+	$(CXX) $(GEOMETRY_APICES_TEST_OBJS) $(LDFLAGS) -o $@
 
 geometry_info_test: $(GEOMETRY_INFO_TEST_OBJS)
-	$(CXX) $(GEOMETRY_INFO_TEST_OBJS) -o $@
+	$(CXX) $(GEOMETRY_INFO_TEST_OBJS) $(LDFLAGS) -o $@
 
 geometry_surface_test: $(GEOMETRY_SURFACE_TEST_OBJS)
-	$(CXX) $(GEOMETRY_SURFACE_TEST_OBJS) -o $@
+	$(CXX) $(GEOMETRY_SURFACE_TEST_OBJS) $(LDFLAGS) -o $@
 
 geometry_volume_test: $(GEOMETRY_VOLUME_TEST_OBJS)
-	$(CXX) $(GEOMETRY_VOLUME_TEST_OBJS) -o $@
+	$(CXX) $(GEOMETRY_VOLUME_TEST_OBJS) $(LDFLAGS) -o $@
 
 
Index: cpp/frams/Makefile-GDK-files
===================================================================
--- cpp/frams/Makefile-GDK-files	(revision 245)
+++ cpp/frams/Makefile-GDK-files	(revision 247)
@@ -19,5 +19,5 @@
 GENMAN_COMMON_OBJS=frams/genetics/genman.o frams/param/mutableparam.o frams/param/mutparamlist.o frams/neuro/geneticneuroparam.o frams/neuro/neurolibparam.o
 
-GDK_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 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
+GDK_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
 
 GEOMETRY_OBJS=frams/model/geometry/meshbuilder.o frams/model/geometry/modelgeometryinfo.o frams/model/geometry/geometryutils.o
@@ -31,5 +31,5 @@
 F0_VARIANTS_OBJS=frams/_demos/f0_variants_test.o frams/virtfile/stringfile.o frams/virtfile/virtfile.o frams/errmgr/stdouterr.o   $(GDK_OBJS) $(GENOCONV_GDK_OBJS)
 
-LOADER_TEST_OBJS=frams/_demos/genotypeloader.o frams/_demos/loader_test.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o common/nonstd_stdio.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS)
+LOADER_TEST_OBJS=frams/_demos/genotypeloader.o frams/_demos/loader_test.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS)
 
 GENOCONV_TEST_OBJS= frams/_demos/genoconv_test.o frams/_demos/printconvmap.o frams/errmgr/stdouterr.o frams/virtfile/virtfile.o  $(GDK_OBJS) $(GENOCONV_GDK_OBJS)
@@ -39,5 +39,5 @@
 GENOOPER_TEST_OBJS=frams/_demos/genooper_test.o frams/virtfile/virtfile.o frams/errmgr/stdouterr.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GENMAN_GDK_OBJS)
 
-GENOOPER_TEST_FTEST_OBJS=frams/_demos/genooper_test_fTest.o frams/virtfile/virtfile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GENMAN_GDK_OBJS)
+GENOOPER_TEST_FTEST_OBJS=frams/_demos/genooper_test_fTest.o frams/virtfile/virtfile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GENMAN_GDK_OBJS) $(GENMAN_FT)
 
 NEURO_TEST_OBJS= frams/_demos/neuro_test.o frams/errmgr/stdouterr.o frams/virtfile/virtfile.o \
@@ -45,5 +45,5 @@
 	frams/neuro/impl/neuroimpl-fuzzy.o frams/neuro/impl/neuroimpl-fuzzy-f0.o  $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GENMAN_GDK_OBJS)
 
-FULL_PROPS_OBJS= frams/_demos/full_props.o frams/errmgr/stdouterr.o frams/virtfile/virtfile.o  frams/virtfile/stdiofile.o common/nonstd_stdio.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GENMAN_GDK_OBJS)
+FULL_PROPS_OBJS= frams/_demos/full_props.o frams/errmgr/stdouterr.o frams/virtfile/virtfile.o  frams/virtfile/stdiofile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GENMAN_GDK_OBJS)
 
 SERIAL_TEST_OBJS= frams/_demos/serial_test.o frams/virtfile/virtfile.o  $(GDK_OBJS) $(GENOCONV_GDK_OBJS)
@@ -53,9 +53,9 @@
 NEURO_LAYOUT_TEST_OBJS= frams/_demos/neuro_layout_test.o frams/virtfile/virtfile.o frams/errmgr/stdouterr.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GENMAN_GDK_OBJS) frams/canvas/nn_layout_model.o frams/canvas/nn_simple_layout.o frams/canvas/nn_smart_layout.o
 
-GEOMETRY_APICES_TEST_OBJS=frams/_demos/geometry/apices_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o common/nonstd_stdio.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GEOMETRY_OBJS)
+GEOMETRY_INFO_TEST_OBJS=frams/_demos/geometry/info_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GEOMETRY_OBJS)
 
-GEOMETRY_INFO_TEST_OBJS=frams/_demos/geometry/info_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o common/nonstd_stdio.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GEOMETRY_OBJS)
+GEOMETRY_SURFACE_TEST_OBJS=frams/_demos/geometry/surface_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GEOMETRY_OBJS)
 
-GEOMETRY_SURFACE_TEST_OBJS=frams/_demos/geometry/surface_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o common/nonstd_stdio.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GEOMETRY_OBJS)
+GEOMETRY_VOLUME_TEST_OBJS=frams/_demos/geometry/volume_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GEOMETRY_OBJS)
 
-GEOMETRY_VOLUME_TEST_OBJS=frams/_demos/geometry/volume_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o common/nonstd_stdio.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GEOMETRY_OBJS)
+GEOMETRY_APICES_TEST_OBJS=frams/_demos/geometry/apices_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile-autoinit.o frams/virtfile/stdiofile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GEOMETRY_OBJS)
Index: cpp/frams/canvas/neurodiagram.cpp
===================================================================
--- cpp/frams/canvas/neurodiagram.cpp	(revision 245)
+++ cpp/frams/canvas/neurodiagram.cpp	(revision 247)
@@ -235,5 +235,5 @@
 }
 
-void NeuroDiagram::onKill(void*obj, long dummy)
+void NeuroDiagram::onKill(void*obj, intptr_t dummy)
 {
 	show(0);
@@ -678,5 +678,5 @@
 ////
 
-void NeuroDiagram::probeSampling(void*obj, long dummy)
+void NeuroDiagram::probeSampling(void*obj, intptr_t dummy)
 {
 	FOREACH(NeuroProbe*,pr,probes) pr->sampling();
Index: cpp/frams/canvas/nn_smart_layout.cpp
===================================================================
--- cpp/frams/canvas/nn_smart_layout.cpp	(revision 245)
+++ cpp/frams/canvas/nn_smart_layout.cpp	(revision 247)
@@ -6,4 +6,7 @@
 #include <vector>
 #include "common/nonstd_stl.h"
+#ifdef __BORLANDC__
+ #include <alloc.h> //borland needs for alloc/free
+#endif
 
 #define DB(x) 
Index: cpp/frams/config/f0.def
===================================================================
--- cpp/frams/config/f0.def	(revision 245)
+++ cpp/frams/config/f0.def	(revision 247)
@@ -47,5 +47,5 @@
 PROP(dy,1,1024,delta.y,f,-2,2,0,d.y)
 PROP(dz,1,1024,delta.z,f,-2,2,0,d.z)
-PROP(sh,1,0,shape,d,0,1,0,shape)
+PROP(sh,2,0,shape,d,0,1,0,shape)
 XPROP(stif,2,0,stiffness,f,0.0,1.0,1.0,stif)
 XPROP(rotstif,2,0,rotation stiffness,f,0.0,1.0,1.0,rotstif)
@@ -65,5 +65,5 @@
 PROP(p1,0,1024,`part1 ref#',d,-1,999999,-1,p1_refno)
 PROP(p2,0,1024,`part2 ref#',d,-1,999999,-1,p2_refno)
-PROP(sh,1,0,shape,d,0,1,0,shape)
+PROP(sh,2,0,shape,d,0,1,0,shape)
 XPROP(stif,2,0,stiffness,f,0.0,1.0,1.0,stif)
 XPROP(rotstif,2,0,rotation stiffness,f,0.0,1.0,1.0,rotstif)
Index: cpp/frams/config/f0def.xml
===================================================================
--- cpp/frams/config/f0def.xml	(revision 245)
+++ cpp/frams/config/f0def.xml	(revision 247)
@@ -50,5 +50,5 @@
   <PROP ID="dy" NAME="delta.y" GROUP="1" FLAGS="1024" TYPE="f" MIN="-2" MAX="2" DEF="0" />
   <PROP ID="dz" NAME="delta.z" GROUP="1" FLAGS="1024" TYPE="f" MIN="-2" MAX="2" DEF="0" />
-  <PROP ID="sh" NAME="shape" GROUP="1" FLAGS="0" TYPE="d" MIN="0" MAX="1" DEF="0" />
+  <PROP ID="sh" NAME="shape" GROUP="2" FLAGS="0" TYPE="d" MIN="0" MAX="1" DEF="0" />
   <PROP ID="stif" XTRA="1" NAME="stiffness" GROUP="2" FLAGS="0" TYPE="f" MIN="0.0" MAX="1.0" DEF="1.0" />
   <PROP ID="rotstif" XTRA="1" NAME="rotation stiffness" GROUP="2" FLAGS="0" TYPE="f" MIN="0.0" MAX="1.0" DEF="1.0" />
Index: cpp/frams/config/version.h
===================================================================
--- cpp/frams/config/version.h	(revision 245)
+++ cpp/frams/config/version.h	(revision 247)
@@ -3,3 +3,3 @@
 // Refer to http://www.framsticks.com/ for further information.
 
-#define MAIN_REL_ID "4.0rc9"
+#define MAIN_REL_ID "4.0rc10"
Index: cpp/frams/genetics/f4/f4_general.cpp
===================================================================
--- cpp/frams/genetics/f4/f4_general.cpp	(revision 245)
+++ cpp/frams/genetics/f4/f4_general.cpp	(revision 247)
@@ -593,5 +593,5 @@
 
 
-int f4_Cell::addlink(f4_Cell * nfrom, double nw, long nt)
+int f4_Cell::addlink(f4_Cell * nfrom, double nw, int nt)
 {
 	if (nolink >= MAXINPUTS - 1) return -1; // full!
@@ -675,5 +675,5 @@
 
 
-f4_CellLink::f4_CellLink(f4_Cell * nfrom, double nw, long nt)
+f4_CellLink::f4_CellLink(f4_Cell * nfrom, double nw, int nt)
 {
 	from = nfrom;
@@ -1234,5 +1234,5 @@
 	int i, j, t, res;
 	char tc1, tc2;
-	long relfrom;
+	int relfrom;
 	double w;
 	unsigned gpos, oldpos;
Index: cpp/frams/genetics/f4/f4_general.h
===================================================================
--- cpp/frams/genetics/f4/f4_general.h	(revision 245)
+++ cpp/frams/genetics/f4/f4_general.h	(revision 247)
@@ -101,5 +101,5 @@
 	int onestep();	// execute one simulation step (till a division)
 
-	int   addlink(f4_Cell * nfrom, double nw, long nt);
+	int   addlink(f4_Cell * nfrom, double nw, int nt);
 	void  adjustRec();
 
@@ -129,9 +129,9 @@
 	//f4_OrientMat OM;
 	double       mz;            // freedom in z
-	long         p2_refno;   // number of last end part object, used in f0
-	long         joint_refno;   // number of the joint object, used in f0
-	long         neuro_refno;   // number of the neuro object, used in f0
-
-	long         ctrl;  // neuron type
+	int          p2_refno;   // number of last end part object, used in f0
+	int          joint_refno;   // number of the joint object, used in f0
+	int          neuro_refno;   // number of the neuro object, used in f0
+
+	int          ctrl;  // neuron type
 	double       state;
 	double       inertia;
@@ -147,8 +147,8 @@
 {
 public:
-	f4_CellLink(f4_Cell * nfrom, double nw, long nt);
+	f4_CellLink(f4_Cell * nfrom, double nw, int nt);
 	f4_Cell *    from;
 	// type: 0: input, 1 '*', 2 'G', 3 'T', 4 'S'
-	long         t;
+	int          t;
 	double       w;
 };
@@ -205,5 +205,5 @@
 	int       pos;        // original position in string
 	int       i1;		// internal int  parameter1
-	long      l1;		// internal long parameter1
+	int       l1;		// internal long parameter1
 	double    f1;		// internal double parameter1
 
Index: cpp/frams/genetics/f4/oper_f4.cpp
===================================================================
--- cpp/frams/genetics/f4/oper_f4.cpp	(revision 245)
+++ cpp/frams/genetics/f4/oper_f4.cpp	(revision 247)
@@ -606,5 +606,5 @@
 
 
-unsigned long Geno_f4::style(const char *g, int pos)
+uint32_t Geno_f4::style(const char *g, int pos)
 {
 	char ch = g[pos];
@@ -616,5 +616,5 @@
 	if (!strchr(STYL4CAT_MODIFIC STYL4CAT_NEUMOD STYL4CAT_DIGIT STYL4CAT_REST, ch))
 		return GENSTYLE_CS(0, GENSTYLE_INVALID);
-	unsigned long style = GENSTYLE_CS(0, GENSTYLE_STRIKEOUT); //default, should be changed below
+	uint32_t style = GENSTYLE_CS(0, GENSTYLE_STRIKEOUT); //default, should be changed below
 	if (strchr("X ", ch))              style = GENSTYLE_CS(0, GENSTYLE_NONE);
 	if (strchr("N", ch))               style = GENSTYLE_RGBS(0, 200, 0, GENSTYLE_NONE);
Index: cpp/frams/genetics/f4/oper_f4.h
===================================================================
--- cpp/frams/genetics/f4/oper_f4.h	(revision 245)
+++ cpp/frams/genetics/f4/oper_f4.h	(revision 247)
@@ -38,5 +38,5 @@
 	int crossOver(char *&g1, char *&g2, float& chg1, float& chg2);
 	const char* getSimplest() { return "X"; }
-	unsigned long style(const char *g, int pos);
+	uint32_t style(const char *g, int pos);
 
 	// mutation probabilities
Index: cpp/frams/genetics/f9/oper_f9.cpp
===================================================================
--- cpp/frams/genetics/f9/oper_f9.cpp	(revision 245)
+++ cpp/frams/genetics/f9/oper_f9.cpp	(revision 247)
@@ -109,8 +109,8 @@
 
 ///Applying some colors and font styles...
-unsigned long GenoOper_f9::style(const char *g, int pos)
+uint32_t GenoOper_f9::style(const char *g, int pos)
 {
 	char ch = g[pos];
-	unsigned long style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below
+	uint32_t style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below
 	char *ptr = strchr((char*)turtle_commands_f9, ch);
 	if (ptr)
Index: cpp/frams/genetics/f9/oper_f9.h
===================================================================
--- cpp/frams/genetics/f9/oper_f9.h	(revision 245)
+++ cpp/frams/genetics/f9/oper_f9.h	(revision 247)
@@ -17,5 +17,5 @@
 	int mutate(char *&g,float& chg,int &method);
 	int crossOver(char *&g1,char *&g2,float& chg1,float& chg2);
-	unsigned long style(const char *g, int pos);
+	uint32_t style(const char *g, int pos);
 	const char* getSimplest() {return "R";}
 
Index: cpp/frams/genetics/fF/oper_fF.cpp
===================================================================
--- cpp/frams/genetics/fF/oper_fF.cpp	(revision 245)
+++ cpp/frams/genetics/fF/oper_fF.cpp	(revision 247)
@@ -89,8 +89,8 @@
 
 ///Applying some colors and font styles...
-unsigned long GenoOper_fF::style(const char *g, int pos)
+uint32_t GenoOper_fF::style(const char *g, int pos)
 {
 	char ch = g[pos];
-	unsigned long style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below
+	uint32_t style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below
 	if (strchr("-.e 0123456789", ch) != NULL)
 		style = GENSTYLE_CS(GENCOLOR_NUMBER, GENSTYLE_NONE);
Index: cpp/frams/genetics/fF/oper_fF.h
===================================================================
--- cpp/frams/genetics/fF/oper_fF.h	(revision 245)
+++ cpp/frams/genetics/fF/oper_fF.h	(revision 247)
@@ -17,5 +17,5 @@
 	int mutate(char *&g, float& chg, int &method);
 	int crossOver(char *&g1, char *&g2, float& chg1, float& chg2);
-	unsigned long style(const char *g, int pos);
+	uint32_t style(const char *g, int pos);
 	const char* getSimplest() { return "6, 1.05, 1.05, 1.05, 0, 0, 0"; }
 
Index: cpp/frams/genetics/fT/oper_fTest.cpp
===================================================================
--- cpp/frams/genetics/fT/oper_fTest.cpp	(revision 245)
+++ cpp/frams/genetics/fT/oper_fTest.cpp	(revision 247)
@@ -115,8 +115,8 @@
 
 ///Applying some colors and font styles...
-unsigned long GenoOper_fTest::style(const char *g, int pos)
+uint32_t GenoOper_fTest::style(const char *g, int pos)
 {
 	char ch = g[pos];
-	unsigned long style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below
+	uint32_t style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below
 	if (ch == 'A') style = GENSTYLE_RGBS(200, 0, 0, GENSTYLE_BOLD);
 	if (ch == 'T') style = GENSTYLE_RGBS(0, 200, 0, GENSTYLE_BOLD);
Index: cpp/frams/genetics/fT/oper_fTest.h
===================================================================
--- cpp/frams/genetics/fT/oper_fTest.h	(revision 245)
+++ cpp/frams/genetics/fT/oper_fTest.h	(revision 247)
@@ -29,5 +29,5 @@
 	int mutate(char *&geno, float& chg, int &method);
 	int crossOver(char *&g1, char *&g2, float& chg1, float& chg2);
-	unsigned long style(const char *g, int pos);
+	uint32_t style(const char *g, int pos);
 	const char* getSimplest() { return "GATCGATTACA"; }
 
Index: cpp/frams/genetics/genman.cpp
===================================================================
--- cpp/frams/genetics/genman.cpp	(revision 245)
+++ cpp/frams/genetics/genman.cpp	(revision 247)
@@ -371,5 +371,5 @@
 }
 
-unsigned long GenMan::Style(const char *g, int pos)
+uint32_t GenMan::Style(const char *g, int pos)
 {
 	Geno G(g);
@@ -380,5 +380,5 @@
 }
 
-void GenMan::GetFullStyle(const char *g, unsigned long *styletab)
+void GenMan::GetFullStyle(const char *g, uint32_t *styletab)
 {
 	Geno G(g);
@@ -404,8 +404,8 @@
 	int chars = 0, lines = 0;
 	bool shortened = false;
-	unsigned long *styletab = new unsigned long[len];
+	uint32_t *styletab = new uint32_t[len];
 	GetFullStyle(g, styletab);
 	SString html = "\n<div style=\"background:white;padding:0.2em;font-family:arial,helvetica,sans-serif;font-size:90%\">";
-	unsigned long prevstyle, prevcolor, style = 0, color = 0;
+	uint32_t prevstyle, prevcolor, style = 0, color = 0;
 	for (int i = 0; i<len; i++)
 	{
@@ -501,5 +501,5 @@
 }
 
-void GenMan::onDelGen(void *obj, long n)
+void GenMan::onDelGen(void *obj, intptr_t n)
 {
 	//old code needs update:
Index: cpp/frams/genetics/genman.h
===================================================================
--- cpp/frams/genetics/genman.h	(revision 245)
+++ cpp/frams/genetics/genman.h	(revision 247)
@@ -46,6 +46,6 @@
 	Geno CrossOver(const Geno&, const Geno&); //returns xover genotype ("child") or empty if errors
 	float Similarity(const Geno&, const Geno&); //returns GENOPER_NOOPER or normalized similarity (1: identical, 0: different)
-	unsigned long Style(const char* g, int pos); //returns Style (and validity) of a genotype char.
-	void GetFullStyle(const char *g, unsigned long *styletab); //optimized. Fills styletab with styles for all genotype chars. sizeof(*styletab) must be at least strlen(g).
+	uint32_t Style(const char* g, int pos); //returns Style (and validity) of a genotype char.
+	void GetFullStyle(const char *g, uint32_t *styletab); //optimized. Fills styletab with styles for all genotype chars. sizeof(*styletab) must be at least strlen(g).
 	SString HTMLize(const char *g); //returns colored genotype in HTML.
 	SString HTMLizeShort(const char *g); //returns colored genotype (abbreviated if needed) in HTML.
@@ -83,5 +83,5 @@
 #undef STATRICKCLASS
 	void clearStats();
-	static void onDelGen(void*, long);
+	static void onDelGen(void*, intptr_t);
 };
 
Index: cpp/frams/genetics/genoconv.h
===================================================================
--- cpp/frams/genetics/genoconv.h	(revision 245)
+++ cpp/frams/genetics/genoconv.h	(revision 247)
@@ -46,6 +46,6 @@
 		out_format;	//< output format, eg. '0'
 	const char *info;	//< detailed info about converter, format or copyright
-	long enabled;	//< don't touch this! (used by configuration module)
-	long mapsupport; //< set to 1 if your converter supports genotype mapping
+	paInt enabled;	//< don't touch this! (used by configuration module)
+	paInt mapsupport; //< set to 1 if your converter supports genotype mapping
 
 	/// You have to reimplement this method.
Index: cpp/frams/genetics/oper_fx.cpp
===================================================================
--- cpp/frams/genetics/oper_fx.cpp	(revision 245)
+++ cpp/frams/genetics/oper_fx.cpp	(revision 247)
@@ -58,5 +58,5 @@
 	if (p->type(i)[0] == 'd')
 	{
-		long _mn = 0, _mx = 1, _def = 0;
+		paInt _mn = 0, _mx = 1, _def = 0;
 		defined = p->getMinMax(i, _mn, _mx, _def);
 		if (defined == 1) _mx = _mn + 1;
@@ -150,5 +150,5 @@
 void GenoOperators::setIntFromDoubleWithProbabilisticDithering(ParamInterface &p, int index, double value) //TODO
 {
-	p.setInt(index, value); //TODO value=2.5 will result in 2 but we want it to be 2 or 3 with equal probability. value=2.1 would be mostly 2, rarely 3. Careful with negative values (test it!)
+	p.setInt(index, (paInt)value); //TODO value=2.5 will result in 2 but we want it to be 2 or 3 with equal probability. value=2.1 would be mostly 2, rarely 3. Careful with negative values (test it!)
 }
 
@@ -187,5 +187,5 @@
 NeuroClass* GenoOperators::parseNeuroClass(char*& s)
 {
-	int len = strlen(s);
+	int len = (int)strlen(s);
 	int Len = 0;
 	NeuroClass *I = NULL;
@@ -193,5 +193,5 @@
 	{
 		const char *n = Neuro::getClass(i)->name;
-		int l = strlen(n);
+		int l = (int)strlen(n);
 		if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = Neuro::getClass(i); Len = l; }
 	}
@@ -210,5 +210,5 @@
 int GenoOperators::neuroClassProp(char*& s, NeuroClass *nc, bool also_v1_N_props)
 {
-	int len = strlen(s);
+	int len = (int)strlen(s);
 	int Len = 0, I = -1;
 	if (nc)
@@ -218,5 +218,5 @@
 		{
 			const char *n = p.id(i);
-			int l = strlen(n);
+			int l = (int)strlen(n);
 			if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = 100 + i; Len = l; }
 			if (also_v1_N_props) //recognize old properties symbols /=!
@@ -225,5 +225,5 @@
 					if (strcmp(n, "in") == 0) n = "="; else
 						if (strcmp(n, "fo") == 0) n = "!";
-				l = strlen(n);
+				l = (int)strlen(n);
 				if (len >= l && l > Len && (strncmp(s, n, l) == 0)) { I = 100 + i; Len = l; }
 			}
@@ -235,5 +235,5 @@
 	{
 		const char *n = p.id(i);
-		int l = strlen(n);
+		int l = (int)strlen(n);
 		if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = i; Len = l; }
 	}
Index: cpp/frams/genetics/oper_fx.h
===================================================================
--- cpp/frams/genetics/oper_fx.h	(revision 245)
+++ cpp/frams/genetics/oper_fx.h	(revision 247)
@@ -31,7 +31,7 @@
 /** \name other useful style/color macros */
 //@{
-#define GENRGB(r,g,b) ((unsigned long)(((unsigned char)(r)|((unsigned short)((unsigned char)(g))<<8))|(((unsigned long)(unsigned char)(b))<<16)))
-#define GENSTYLE_RGBS(r,g,b,s) ((unsigned long)((unsigned char)s)<<24 | GENRGB(r,g,b))
-#define GENSTYLE_CS(rgb,s) ((unsigned long)((unsigned char)s)<<24 | rgb)
+#define GENRGB(r,g,b) ((uint32_t)(((uint8_t)(r)|((uint16_t)((uint8_t)(g))<<8))|(((uint32_t)(uint8_t)(b))<<16)))
+#define GENSTYLE_RGBS(r,g,b,s) ((uint32_t)((uint8_t)s)<<24 | GENRGB(r,g,b))
+#define GENSTYLE_CS(rgb,s) ((uint32_t)((uint8_t)s)<<24 | rgb)
 
 #define GENGETSTYLE(style) ((style)>>24)
@@ -168,5 +168,5 @@
 Assume white background.
 \sa GENSTYLE_* macros, like GENSTYLE_BOLD*/
-   virtual unsigned long style(const char *geno,int pos) {return GENSTYLE_RGBS(0,0,0,GENSTYLE_NONE);}
+   virtual uint32_t style(const char *geno,int pos) {return GENSTYLE_RGBS(0,0,0,GENSTYLE_NONE);}
 
 ///currently not used (similarity of two genotypes)
Index: cpp/frams/model/model.cpp
===================================================================
--- cpp/frams/model/model.cpp	(revision 245)
+++ cpp/frams/model/model.cpp	(revision 247)
@@ -129,5 +129,5 @@
 Model::~Model()
 {
-delmodel_list.action((long)this);
+delmodel_list.action((intptr_t)this);
 clear();
 }
Index: cpp/frams/model/modelparts.cpp
===================================================================
--- cpp/frams/model/modelparts.cpp	(revision 245)
+++ cpp/frams/model/modelparts.cpp	(revision 247)
@@ -163,5 +163,5 @@
 			{
 			case 'd': t+=" integer";
-			{long a,b,c; if (p.getMinMax(i,a,b,c)>=2) t+=SString::sprintf(" %d..%d",a,b);}
+			{paInt a,b,c; if (p.getMinMax(i,a,b,c)>=2) t+=SString::sprintf(" %d..%d",a,b);}
 				break;
 			case 'f': t+=" float";
Index: cpp/frams/model/modelparts.h
===================================================================
--- cpp/frams/model/modelparts.h	(revision 245)
+++ cpp/frams/model/modelparts.h	(revision 247)
@@ -38,5 +38,5 @@
 MultiRange *mapped;
 enum PartBaseFlags { Selected=1 };
-long flags;
+int flags;
 Model *owner;	///< backlink to the model
 
@@ -80,9 +80,9 @@
 Param extraProperties();
 Param properties();
-long refno;
+paInt refno;
 Pt3D rot;///< rotation angles
 
 ///
-long shape;///default=old framsticks compatible, do not mix with shapes>0
+paInt shape;///default=old framsticks compatible, do not mix with shapes>0
 enum Shape {SHAPE_DEFAULT=0, SHAPE_ELLIPSOID=1, SHAPE_CUBOID=2, SHAPE_CYLINDER=3};
 double mass,size,density,friction,ingest,assim;
@@ -119,5 +119,5 @@
 public:
 // base properties:
-long p1_refno,p2_refno; ///< parts' reference numbers
+paInt p1_refno,p2_refno; ///< parts' reference numbers
 
 Part *part1,*part2;	///< references to parts
@@ -125,5 +125,5 @@
 class Pt3D rot;	///< orientation delta between parts expressed as 3 angles
 enum Shape {SHAPE_DEFAULT=0, SHAPE_SOLID=1};
-long shape;///< default=old framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with shape>0,  solid=merge parts into one physical entity
+paInt shape;///< default=old framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with shape>0,  solid=merge parts into one physical entity
 
 Joint();
@@ -159,5 +159,5 @@
 
 // do not touch these:
-long refno; ///< this joint's reference number
+paInt refno; ///< this joint's reference number
 double stamina;
 double stif,rotstif;	///< stiffness for moving and bending forces
@@ -189,8 +189,8 @@
 ParamEntry *props;
 bool ownedprops;//< destructor will free props using ParamObject::freeParamTab
-long prefinputs,prefoutput;
-long preflocation;
+paInt prefinputs,prefoutput;
+paInt preflocation;
 int *vectordata;
-long visualhints;
+paInt visualhints;
 
 //void *impl;
@@ -220,8 +220,8 @@
     extra inputs may be ignored by the object (depends on the class).
  */
-int getPreferredInputs() {return prefinputs;}
+int getPreferredInputs() {return (int)prefinputs;}
 
 /** @return 0 if this object doesn't provide useful output signal. */
-int getPreferredOutput() {return prefoutput;}
+int getPreferredOutput() {return (int)prefoutput;}
 
 /** @return 0 if the object doesn't need any assignment to the body element.
@@ -229,5 +229,5 @@
     @return 2 = the object prefers to have the Joint ( @see Neuro::attachToJoint() )
  */
-int getPreferredLocation() {return preflocation;}
+int getPreferredLocation() {return (int)preflocation;}
 /** vector drawing to be used in neuro net diagram.
     interpretation:
@@ -251,5 +251,5 @@
  */
 int getVisualHints()
- {return visualhints;}
+ {return (int)visualhints;}
 
 enum Hint
@@ -377,8 +377,8 @@
 SyntParam classProperties(bool handle_defaults_when_saving=true);
 // base properties:
-long refno; ///< unique reference number (former 'neuro' refno)
-
-long part_refno; ///< can be used by some items as the part ref#
-long joint_refno; ///< can be used by some items as the joint ref#
+paInt refno; ///< unique reference number (former 'neuro' refno)
+
+paInt part_refno; ///< can be used by some items as the part ref#
+paInt joint_refno; ///< can be used by some items as the joint ref#
 
 Pt3D pos,rot;	///< default = zero
@@ -451,5 +451,5 @@
    or -1 if 'child' is not connected with this Neuro.*/
 int findInput(Neuro* child) const;
-void removeInput(int refno);
+void removeInput(paInt refno);
 /**    @return reference number of the child connection, like findInput() */
 int removeInput(Neuro* child);
@@ -470,6 +470,6 @@
 #ifdef MODEL_V1_COMPATIBLE
 friend class OldItems;
-long neuro_refno; ///< parent ref# (called neuro_refno for compatibility with old Neuro class), @see moredata
-long conn_refno; ///< the other neuron ref# in N-N connections, can be used by some other items
+paInt neuro_refno; ///< parent ref# (called neuro_refno for compatibility with old Neuro class), @see moredata
+paInt conn_refno; ///< the other neuron ref# in N-N connections, can be used by some other items
 double weight; ///< weight of the N-N connection and (all?) receptors
 double inertia,force,sigmo; //!!!
Index: cpp/frams/neuro/geneticneuroparam.cpp
===================================================================
--- cpp/frams/neuro/geneticneuroparam.cpp	(revision 245)
+++ cpp/frams/neuro/geneticneuroparam.cpp	(revision 247)
@@ -11,8 +11,8 @@
 {}
 
-long GeneticNeuroParam::getInt(int i)
+paInt GeneticNeuroParam::getInt(int i)
 {return Neuro::getClass(i)->genactive;}
 
-int GeneticNeuroParam::setInt(int i,long v)
+int GeneticNeuroParam::setInt(int i,paInt v)
 {Neuro::getClass(i)->genactive=v;return PSET_CHANGED;}
 
Index: cpp/frams/neuro/geneticneuroparam.h
===================================================================
--- cpp/frams/neuro/geneticneuroparam.h	(revision 245)
+++ cpp/frams/neuro/geneticneuroparam.h	(revision 247)
@@ -15,6 +15,6 @@
 GeneticNeuroParam(const char* groupname,const char* myname, const char* prefix,const char* typ=0);
 
-long getInt(int i);
-int setInt(int i,long v);
+paInt getInt(int i);
+int setInt(int i,paInt v);
 const char *type(int i) {return types?types:NeuroLibParam::type(i);}
 };
Index: cpp/frams/neuro/neurocls-f0-GDK-factory.h
===================================================================
--- cpp/frams/neuro/neurocls-f0-GDK-factory.h	(revision 245)
+++ cpp/frams/neuro/neurocls-f0-GDK-factory.h	(revision 247)
@@ -1,6 +1,2 @@
-// This file is a part of the Framsticks GDK.
-// Copyright (C) 1999-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
-// Refer to http://www.framsticks.com/ for further information.
-
 
 // do not edit - generated automatically from "f0.def"
Index: cpp/frams/neuro/neurocls-f0-GDK-library.h
===================================================================
--- cpp/frams/neuro/neurocls-f0-GDK-library.h	(revision 245)
+++ cpp/frams/neuro/neurocls-f0-GDK-library.h	(revision 247)
@@ -1,6 +1,2 @@
-// This file is a part of the Framsticks GDK.
-// Copyright (C) 1999-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
-// Refer to http://www.framsticks.com/ for further information.
-
 
 // do not edit - generated automatically from "f0.def"
Index: cpp/frams/neuro/neuroimpl.h
===================================================================
--- cpp/frams/neuro/neuroimpl.h	(revision 245)
+++ cpp/frams/neuro/neuroimpl.h	(revision 247)
@@ -108,5 +108,5 @@
 
 public:
-  long intParameter;
+  paInt intParameter;
   double fpParameter;
   SString txtParameter;
Index: cpp/frams/neuro/neurolibparam.cpp
===================================================================
--- cpp/frams/neuro/neurolibparam.cpp	(revision 245)
+++ cpp/frams/neuro/neurolibparam.cpp	(revision 247)
@@ -22,7 +22,7 @@
 }
 
-void NeuroLibParam::neuroclassAdded(void* data,long i)
+void NeuroLibParam::neuroclassAdded(void* data,intptr_t i)
 {onadd.action(i);}
-void NeuroLibParam::neuroclassRemoved(void* data,long i)
+void NeuroLibParam::neuroclassRemoved(void* data,intptr_t i)
 {ondelete.action(i);}
 
Index: cpp/frams/param/mutableparam.cpp
===================================================================
--- cpp/frams/param/mutableparam.cpp	(revision 245)
+++ cpp/frams/param/mutableparam.cpp	(revision 247)
@@ -108,5 +108,5 @@
 	switch(pe->type[0])
 		{
-		case 'd': d=new int(); *((int*)d)=0; break;
+		case 'd': d=new paInt(); *((paInt*)d)=0; break;
 		case 'f': d=new double(); *((double*)d)=0; break;
 		case 's': d=new SString(); break;
@@ -114,5 +114,5 @@
 		case 'o': d=new ExtObject(); break;
 		}
-	pe->offset=(int)d;
+	pe->offset=(intptr_t)d;
 	}
 onadd.action(position);
@@ -134,5 +134,5 @@
 	switch(pe->type[0])
 		{
-		case 'd': delete (int*)d; break;
+		case 'd': delete (paInt*)d; break;
 		case 'f': delete (double*)d; break;
 		case 's': delete (SString*)d; break;
@@ -173,5 +173,5 @@
 pe->group=(short)group;
 pe->flags=(short)(flags | MUTPARAM_ALLOCENTRY);
-pe->offset=(long)data;
+pe->offset=(intptr_t)data;
 pe->id=strdup(id);
 pe->type=strdup(type);
@@ -209,5 +209,5 @@
 }
 
-int MutableParam::setInt(int i,long v)
+int MutableParam::setInt(int i,paInt v)
 {
 int ret=SimpleAbstractParam::setInt(i,v);
Index: cpp/frams/param/mutableparam.h
===================================================================
--- cpp/frams/param/mutableparam.h	(revision 245)
+++ cpp/frams/param/mutableparam.h	(revision 247)
@@ -23,5 +23,5 @@
 SList entries;
 SList groups;
-long changed;
+int changed;
 ParamEntry *entry(int i) {return (i<staticprops)? pe_tab+i : ((ParamEntry*)entries(i-staticprops));}
 void *getTarget(int i) {return (i<staticprops)? SimpleAbstractParam::getTarget(i) : (void*)entry(i)->offset;}
@@ -54,5 +54,5 @@
 void notify(int id);
 
-int setInt(int,long);
+int setInt(int,paInt);
 int setDouble(int,double);
 int setString(int,const SString &);
Index: cpp/frams/param/mutparamlist.cpp
===================================================================
--- cpp/frams/param/mutparamlist.cpp	(revision 245)
+++ cpp/frams/param/mutparamlist.cpp	(revision 247)
@@ -126,5 +126,5 @@
 }
 
-void MutableParamList::onPropAdd(void* data,long i)
+void MutableParamList::onPropAdd(void* data,intptr_t i)
 {
 ParamInfo *pi=(ParamInfo*)data;
@@ -136,5 +136,5 @@
 }
 
-void MutableParamList::onPropDelete(void* data,long i)
+void MutableParamList::onPropDelete(void* data,intptr_t i)
 {
 ParamInfo *pi=(ParamInfo*)data;
@@ -146,5 +146,5 @@
 }
 
-void MutableParamList::onPropChange(void* data,long i)
+void MutableParamList::onPropChange(void* data,intptr_t i)
 {
 ParamInfo *pi=(ParamInfo*)data;
@@ -152,5 +152,5 @@
 }
 
-void MutableParamList::onPropActivate(void* data,long i)
+void MutableParamList::onPropActivate(void* data,intptr_t i)
 {
 ParamInfo *pi=(ParamInfo*)data;
@@ -158,5 +158,5 @@
 }
 
-void MutableParamList::onGroupAdd(void* data,long i)
+void MutableParamList::onGroupAdd(void* data,intptr_t i)
 {
 ParamInfo *pi=(ParamInfo*)data;
@@ -168,5 +168,5 @@
 }
 
-void MutableParamList::onGroupDelete(void* data,long i)
+void MutableParamList::onGroupDelete(void* data,intptr_t i)
 {
 ParamInfo *pi=(ParamInfo*)data;
@@ -178,5 +178,5 @@
 }
 
-void MutableParamList::onGroupChange(void* data,long i)
+void MutableParamList::onGroupChange(void* data,intptr_t i)
 {
 ParamInfo *pi=(ParamInfo*)data;
@@ -295,7 +295,7 @@
 FUN(int,flags,0)
 FUN(SString,getString,SString())
-FUN(long,getInt,0)
+FUN(paInt,getInt,0)
 FUN(double,getDouble,0)
-FUN(ExtValue,getExtValue,ExtValue((long)0))
+FUN(ExtValue,getExtValue,ExtValue((paInt)0))
 FUN(ExtObject,getObject,ExtObject())
 
@@ -322,5 +322,5 @@
 }
 
-FUN2(int,setInt,long)
+FUN2(int,setInt,paInt)
 FUN2(int,setDouble,double)
 FUN2(int,setString,const SString &)
Index: cpp/frams/param/mutparamlist.h
===================================================================
--- cpp/frams/param/mutparamlist.h	(revision 245)
+++ cpp/frams/param/mutparamlist.h	(revision 247)
@@ -75,10 +75,10 @@
 
 SString getString(int);
-long getInt(int);
+paInt getInt(int);
 double getDouble(int);
 ExtValue getExtValue(int);
 ExtObject getObject(int);
 
-int setInt(int,long);
+int setInt(int,paInt);
 int setDouble(int,double);
 int setString(int,const SString &);
Index: cpp/frams/param/param.cpp
===================================================================
--- cpp/frams/param/param.cpp	(revision 245)
+++ cpp/frams/param/param.cpp	(revision 247)
@@ -37,5 +37,5 @@
 static const char *strchrlimit(const char *t, int ch, const char *limit)
 {
-	int n = limit - t;
+	int n = (int)(limit - t);
 	for (; (n > 0) && *t; t++, n--)
 		if (*t == ch) return t;
@@ -72,9 +72,9 @@
 }
 
-int ParamInterface::getMinMax(int prop, long& minumum, long& maximum, long &def)
+int ParamInterface::getMinMax(int prop, paInt& minumum, paInt& maximum, paInt &def)
 {
 	const char* t = type(prop) + 1;
 	while (*t) if (*t == ' ') break; else t++;
-	return sscanf(t, "%ld %ld %ld", &minumum, &maximum, &def);
+	return sscanf(t, PA_INT_SCANF " " PA_INT_SCANF " " PA_INT_SCANF, &minumum, &maximum, &def);
 }
 
@@ -121,5 +121,5 @@
 	case 'd':
 	{
-		long a = 0, b = 0, c = 0;
+		paInt a = 0, b = 0, c = 0;
 		if (getMinMax(i, a, b, c) < 3) c = a;
 		setInt(i, c);
@@ -144,5 +144,5 @@
 	case 'd':
 	{
-		long a = 0, b = 0, c = 0;
+		paInt a = 0, b = 0, c = 0;
 		getMinMax(i, a, b, c);
 		setInt(i, a);
@@ -167,5 +167,5 @@
 	case 'd':
 	{
-		long a = 0, b = 0, c = 0;
+		paInt a = 0, b = 0, c = 0;
 		getMinMax(i, a, b, c);
 		setInt(i, b);
@@ -178,5 +178,5 @@
 SString ParamInterface::getStringById(const char*prop)
 {int i=findId(prop); if (i>=0) return getString(i); else return SString();}
-long ParamInterface::getIntById(const char*prop)
+paInt ParamInterface::getIntById(const char*prop)
 {int i=findId(prop); if (i>=0) return getInt(i); else return 0;}
 double ParamInterface::getDoubleById(const char*prop)
@@ -187,5 +187,5 @@
 {int i=findId(prop); if (i>=0) return getExtValue(i); else return ExtValue();}
 
-int ParamInterface::setIntById(const char* prop,long v)
+int ParamInterface::setIntById(const char* prop,paInt v)
 {int i=findId(prop); if (i>=0) return setInt(i,v); else return PSET_NOPROPERTY;}
 int ParamInterface::setDoubleById(const char* prop,double v)
@@ -260,5 +260,5 @@
 	{
 		select(defdata);
-		long x = getInt(i);
+		paInt x = getInt(i);
 		select(backup);
 		return x == getInt(i);
@@ -347,5 +347,5 @@
 		if (!*p0) break;
 		p = strchr(p0, ':'); if (!p) continue;
-		p_len = p - p0;
+		p_len = (int)(p - p0);
 		loaded = false;
 		if (p_len && ((i = findIdn(p0, p_len)) >= 0) && (!(flags(i)&PARAM_DONTLOAD)))
@@ -442,9 +442,9 @@
 	if (!stringIsNumeric(str))
 	{
-		long a, b, c;
+		paInt a, b, c;
 		if (getMinMax(i, a, b, c) >= 3)
 			return setInt(i, c);
 		else
-			return setInt(i, (long)0);
+			return setInt(i, (paInt)0);
 	}
 	else
@@ -536,5 +536,5 @@
 			const char *t2 = strchr(t, '~');
 			if (!t2) t2 = t + strlen(t);
-			return SString(t, t2 - t);
+			return SString(t, (int)(t2 - t));
 		}
 	}
@@ -599,5 +599,5 @@
 #endif
 
-long SimpleAbstractParam::getInt(int i)
+paInt SimpleAbstractParam::getInt(int i)
 {
 	SANITY_CHECK(i);
@@ -612,5 +612,5 @@
 	{
 		void *target = getTarget(i);
-		return *((long*)target);
+		return *((paInt*)target);
 	}
 }
@@ -687,5 +687,5 @@
 //////// set
 
-int SimpleAbstractParam::setInt(int i, long x)
+int SimpleAbstractParam::setInt(int i, paInt x)
 {
 	SANITY_CHECK(i);
@@ -693,10 +693,10 @@
 	ParamEntry *pe = entry(i);
 	if (pe->flags&PARAM_READONLY) return PSET_RONLY;
-	long xcopy = x; //only needed for messageOnExceedRange(): retain original, requested value of x because it may be changed below
-	long a = 0, b = 0;
+	paInt xcopy = x; //only needed for messageOnExceedRange(): retain original, requested value of x because it may be changed below
+	paInt a = 0, b = 0;
 	int result = 0;
 	const char* t = pe->type + 1;
 	while (*t) if (*t == ' ') break; else t++;
-	if (sscanf(t, "%ld %ld", &a, &b) == 2)
+	if (sscanf(t, PA_INT_SCANF " " PA_INT_SCANF, &a, &b) == 2)
 		if (a <= b) // if max<min then the min/max constraint check is not supported
 		{
@@ -713,8 +713,8 @@
 	{
 		void *target = getTarget(i);
-		if (dontcheckchanges || (*((long*)target) != x))
+		if (dontcheckchanges || (*((paInt*)target) != x))
 		{
 			result |= PSET_CHANGED;
-			*((long*)target) = x;
+			*((paInt*)target) = x;
 		}
 	}
@@ -770,7 +770,7 @@
 	const char* t = pe->type + 1;
 	while (*t) if (*t == ' ') break; else t++;
-	long a = 0, b = 0;
+	paInt a = 0, b = 0;
 	int result = 0;
-	if (sscanf(t, "%ld %ld", &a, &b) == 2)
+	if (sscanf(t, PA_INT_SCANF " " PA_INT_SCANF, &a, &b) == 2)
 	{
 		if ((x.len() > b) && (b > 0))
@@ -883,7 +883,7 @@
 	const char *lf = strchr(beg, '\n');
 	if (!lf) { lf = (const char*)s + s.len() - 1; poz = s.len(); }
-	else { poz = (lf - (const char*)s) + 1; if (poz > s.len()) poz = s.len(); }
+	else { poz = (int)(lf - (const char*)s) + 1; if (poz > s.len()) poz = s.len(); }
 	while (lf >= beg) if ((*lf == '\n') || (*lf == '\r')) lf--; else break;
-	len = lf - beg + 1;
+	len = (int)(lf - beg) + 1;
 	return beg;
 }
@@ -939,5 +939,5 @@
 		if (equals_sign) // have parameter name
 		{
-			tmpi = findIdn(t, equals_sign - t);
+			tmpi = findIdn(t, (int)(equals_sign - t));
 			i = tmpi;
 			if (tmpi < 0)
@@ -960,5 +960,5 @@
 			if (quote)
 			{
-				tmpvalue.copyFrom(quote + 1, quote2 - quote - 1);
+				tmpvalue.copyFrom(quote + 1, (int)(quote2 - quote) - 1);
 				sstringUnquote(tmpvalue);
 				value = tmpvalue;
Index: cpp/frams/param/param.h
===================================================================
--- cpp/frams/param/param.h	(revision 245)
+++ cpp/frams/param/param.h	(revision 247)
@@ -7,4 +7,5 @@
 
 #include <stdio.h>
+#include <stdint.h>
 #include <frams/util/sstring.h>
 #include <frams/util/list.h>
@@ -33,4 +34,7 @@
 #define PARAM_DEPRECATED	8192
 
+typedef int32_t paInt;
+#define PA_INT_SCANF "%d"
+
 // the result of param::set() is a combination of bits:
 
@@ -92,5 +96,5 @@
 
 	virtual SString getString(int) = 0;	///< get string value, you can only use this for "s" type property
-	virtual long getInt(int) = 0;	///< get long value, you can only use this for "d" type property
+	virtual paInt getInt(int) = 0;	///< get long value, you can only use this for "d" type property
 	virtual double getDouble(int) = 0;	///< get double value, you can only use this for "f" type property
 	virtual ExtObject getObject(int) = 0;	///< get object reference, you can only use this for "o" type property
@@ -101,5 +105,5 @@
 
 	SString getStringById(const char*prop);  ///< get string value, you can only use this for "s" type property
-	long getIntById(const char* prop);    ///< get long value, you can only use this for "d" type property
+	paInt getIntById(const char* prop);    ///< get long value, you can only use this for "d" type property
 	double getDoubleById(const char* prop);///< get double value, you can only use this for "f" type property
 	ExtObject getObjectById(const char* prop);///< get object reference, you can only use this for "o" type property
@@ -109,5 +113,5 @@
 	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 setInt(int, paInt) = 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
 	virtual int setString(int, const SString &) = 0; 	///< set string value, you can only use this for "s" type prop
@@ -119,5 +123,5 @@
 	int set(int, const char*);		///< oldstyle set, can convert string to long or double
 
-	int setIntById(const char* prop, long);///< set long value, you can only use this for "d" type prop
+	int setIntById(const char* prop, paInt);///< set long value, you can only use this for "d" type prop
 	int setDoubleById(const char* prop, double);///< set double value, you can only use this for "f" type prop
 	int setStringById(const char* prop, const SString &);///< set string value, you can only use this for "s" type prop
@@ -128,5 +132,5 @@
 	/** get valid minimum, maximum and default value for property 'prop'
 		@return 0 if min/max/def information is not available */
-	int getMinMax(int prop, long& minumum, long& maximum, long& def);
+	int getMinMax(int prop, paInt& minumum, paInt& maximum, paInt& def);
 	/** get valid minimum, maximum and default value for property 'prop'
 		@return 0 if min/max/def information is not available */
@@ -172,8 +176,8 @@
 #define SETOFFSET(_proc_) ( (int (*)(void*,const ExtValue*)) &(FIELDSTRUCT :: _proc_ ## _statrick))
 
-#define FIELDOFFSET(_fld_) ((long)((char*)(&((FIELDSTRUCT*)&MakeCodeGuardHappy)->_fld_)-((char*)((FIELDSTRUCT*)&MakeCodeGuardHappy))))
+#define FIELDOFFSET(_fld_) ((intptr_t)((char*)(&((FIELDSTRUCT*)&MakeCodeGuardHappy)->_fld_)-((char*)((FIELDSTRUCT*)&MakeCodeGuardHappy))))
 
 #ifdef DEBUG
-#define PARAM_ILLEGAL_OFFSET ((long)0xdeadbeef)
+#define PARAM_ILLEGAL_OFFSET ((intptr_t)0xdeadbeef)
 #else
 #define PARAM_ILLEGAL_OFFSET 0
@@ -205,5 +209,5 @@
 	short group, flags;
 	const char *name, *type;
-	long offset;
+	intptr_t offset;
 	void *fun1; ///< procedure or get
 	void *fun2; ///< set
@@ -214,5 +218,5 @@
 {
 public:
-	ParamEntryConstructor(const char *_id, short _group = 0, short _flags = 0, const char *_name = 0, const char *_type = 0, long _offset = 0, void *_fun1 = 0, void *_fun2 = 0, const char *_help = 0)
+	ParamEntryConstructor(const char *_id, short _group = 0, short _flags = 0, const char *_name = 0, const char *_type = 0, intptr_t _offset = 0, void *_fun1 = 0, void *_fun2 = 0, const char *_help = 0)
 	{
 		id = _id; group = _group; flags = _flags; name = _name; type = _type; offset = _offset; fun1 = _fun1; fun2 = _fun2; help = _help;
@@ -254,5 +258,5 @@
 
 	SString getString(int);
-	long getInt(int);
+	paInt getInt(int);
 	double getDouble(int);
 	ExtObject getObject(int);
@@ -270,5 +274,5 @@
 	}
 
-	int setInt(int, long);
+	int setInt(int, paInt);
 	int setDouble(int, double);
 	int setString(int, const SString &);
Index: cpp/frams/util/callbacks.cpp
===================================================================
--- cpp/frams/util/callbacks.cpp	(revision 245)
+++ cpp/frams/util/callbacks.cpp	(revision 247)
@@ -61,5 +61,5 @@
 }
 
-void Callback::action(long data)
+void Callback::action(intptr_t data)
 {
 if (size()==0) return;
Index: cpp/frams/util/callbacks.h
===================================================================
--- cpp/frams/util/callbacks.h	(revision 245)
+++ cpp/frams/util/callbacks.h	(revision 247)
@@ -8,4 +8,5 @@
 #include "list.h"
 #include "statrick.h"
+#include <stdint.h>
 
 //#define USEMEMBERCALLBACK
@@ -15,5 +16,5 @@
 public:
 virtual ~CallbackNode() {}
-virtual void action(long calldata)=0;
+virtual void action(intptr_t calldata)=0;
 virtual int equals(CallbackNode*n) {return (this==n);}
 };
@@ -25,11 +26,11 @@
 void *userdata;
 CallBase *object;
-void (CallBase::*member)(void*,long);
+void (CallBase::*member)(void*,intptr_t);
   public:
-MemberCallbackNode(CallBase *o,void (CallBase::*m)(void*,long),void *d):object(o),member(m),userdata(d) {}
-void action(long calldata) {(object->*member)(userdata,calldata);}
+MemberCallbackNode(CallBase *o,void (CallBase::*m)(void*,intptr_t),void *d):object(o),member(m),userdata(d) {}
+void action(intptr_t calldata) {(object->*member)(userdata,calldata);}
 int equals(CallbackNode*);
 };
-#define MEMBERCALLBACK(obj,mem,dat) new MemberCallbackNode((CallBase*)(obj),(void (CallBase::*)(void*,long))(mem),(void*)(dat))
+#define MEMBERCALLBACK(obj,mem,dat) new MemberCallbackNode((CallBase*)(obj),(void (CallBase::*)(void*,intptr_t))(mem),(void*)(dat))
 #endif
 
@@ -37,11 +38,11 @@
 {
 void *userdata;
-void (*fun)(void*,long);
+void (*fun)(void*,intptr_t);
   public:
-FunctionCallbackNode(void (*f)(void*,long),void *d):userdata(d),fun(f) {}
-void action(long calldata) {(*fun)(userdata,calldata);}
+FunctionCallbackNode(void (*f)(void*,intptr_t),void *d):userdata(d),fun(f) {}
+void action(intptr_t calldata) {(*fun)(userdata,calldata);}
 int equals(CallbackNode*);
 };
-#define FUNCTIONCALLBACK(fun,dat) new FunctionCallbackNode((void (*)(void*,long))(fun),(void*)(dat))
+#define FUNCTIONCALLBACK(fun,dat) new FunctionCallbackNode((void (*)(void*,intptr_t))(fun),(void*)(dat))
 
 class StatrickCallbackNode :public CallbackNode
@@ -49,11 +50,11 @@
 void *object;
 void *userdata;
-void (*fun)(void*,void*,long);
+void (*fun)(void*,void*,intptr_t);
   public:
-StatrickCallbackNode(void *o,void (*f)(void*,void*,long),void *d):object(o),userdata(d),fun(f) {}
-void action(long calldata) {(*fun)(object,userdata,calldata);}
+StatrickCallbackNode(void *o,void (*f)(void*,void*,intptr_t),void *d):object(o),userdata(d),fun(f) {}
+void action(intptr_t calldata) {(*fun)(object,userdata,calldata);}
 int equals(CallbackNode*);
 };
-#define STATRICKCALLBACK(obj,name,dat) new StatrickCallbackNode((void*)(obj),(void (*)(void*,void*,long))STATRICKNAME(name),(void*)(dat))
+#define STATRICKCALLBACK(obj,name,dat) new StatrickCallbackNode((void*)(obj),(void (*)(void*,void*,intptr_t))STATRICKNAME(name),(void*)(dat))
 
 /**
@@ -61,6 +62,6 @@
       add(Function* fun, void* anydata)
    'fun' will be called with your pointer as the first argument (void*)
-   and event specific value as the second argument (long)
-      fun(void* anydata,long eventdata)
+   and event specific value as the second argument (intptr_t)
+      fun(void* anydata,intptr_t eventdata)
 
    'StatrickCallbackNode' uses static functions to emulate object member calls.
@@ -81,13 +82,13 @@
 ~Callback();
 CallbackNode* add(CallbackNode*n);
-CallbackNode* add(void (*f)(void*,long),void *d)
+CallbackNode* add(void (*f)(void*,intptr_t),void *d)
 	{return add(new FunctionCallbackNode(f,d));}
-void remove(void (*f)(void*,long),void *d)
+void remove(void (*f)(void*,intptr_t),void *d)
 	{remove(new FunctionCallbackNode(f,d));}
 void remove(CallbackNode*n);
 void removeNode(CallbackNode*n);
-void operator+=(void* fun) {add((void (*)(void*,long))fun,0);}
-void operator-=(void* fun) {remove((void (*)(void*,long))fun,0);}
-void action(long data);
+void operator+=(void* fun) {add((void (*)(void*,intptr_t))fun,0);}
+void operator-=(void* fun) {remove((void (*)(void*,intptr_t))fun,0);}
+void action(intptr_t data);
 void action() {action(0);}
 int size() {return SList::size();}
@@ -97,11 +98,11 @@
 ///////////////////
 
-#define STCALLBACKDEF(name) STATRICKDEF2(name,void*,long)
-#define STCALLBACKDEFC(cls,name) STATRICKSTUB2(cls,name,void*,long)  \
-	void name(void* arg1,long arg2)
-#define VIRTCALLBACKDEF(name) STATRICKSTUB2(STATRICKCLASS,name,void*,long)  \
-	virtual void name(void* arg1,long arg2)
-#define VIRTCALLBACKDEFC(cls,name) STATRICKSTUB2(cls,name,void*,long)  \
-	virtual void name(void* arg1,long arg2)
+#define STCALLBACKDEF(name) STATRICKDEF2(name,void*,intptr_t)
+#define STCALLBACKDEFC(cls,name) STATRICKSTUB2(cls,name,void*,intptr_t)  \
+	void name(void* arg1,intptr_t arg2)
+#define VIRTCALLBACKDEF(name) STATRICKSTUB2(STATRICKCLASS,name,void*,intptr_t)  \
+	virtual void name(void* arg1,intptr_t arg2)
+#define VIRTCALLBACKDEFC(cls,name) STATRICKSTUB2(cls,name,void*,intptr_t)  \
+	virtual void name(void* arg1,intptr_t arg2)
 
 /* STCALLBACKDEFC(Class,name)
@@ -115,5 +116,5 @@
  */
 
-#define CALLBACKARGS void* arg1,long arg2
+#define CALLBACKARGS void* arg1,intptr_t arg2
 
 #endif
Index: cpp/frams/util/extvalue.cpp
===================================================================
--- cpp/frams/util/extvalue.cpp	(revision 245)
+++ cpp/frams/util/extvalue.cpp	(revision 247)
@@ -281,5 +281,5 @@
 }
 
-static long longsign(long x)
+static int longsign(paInt x)
 {
 if (x<0) return -1;
@@ -288,5 +288,5 @@
 }
 
-static long compareNull(const ExtValue& v)
+static int compareNull(const ExtValue& v)
 {
 switch(v.type)
@@ -299,9 +299,9 @@
 }
 
-long ExtValue::compare(const ExtValue& src) const
-{
-if (type==TUnknown)
+int ExtValue::compare(const ExtValue& src) const
+{
+if (isNull())
 	return compareNull(src);
-else if (src.type==TUnknown)
+else if (src.isNull())
 	return compareNull(*this);
 switch(type)
@@ -309,5 +309,5 @@
 	case TInt:
 	{
-	long t=src.getInt();
+	paInt t=src.getInt();
 	if (idata()>0)
 		{if (t>0) return longsign(idata()-t); else return +1;}
@@ -545,8 +545,8 @@
 	if (args.finished() && (type!=0) && (type!='%'))
 		{
-		ret+=fmt.substr(curr-begin);
+		ret+=fmt.substr((int)(curr-begin));
 		break;
 		}
-	SString sub=fmt.substr(curr-begin,next-curr);
+	SString sub=fmt.substr((int)(curr-begin),(int)(next-curr));
 	switch(type)
 		{
@@ -601,9 +601,9 @@
 }
 
-long ExtValue::getInt(const char* s)
+paInt ExtValue::getInt(const char* s)
 {
 if ((s[0]=='0')&&(s[1]=='x'))
 	{
-	long val;
+	paInt val;
 	sscanf(s+2,"%lx",&val);
 	return val;
@@ -612,7 +612,7 @@
 	{
 	if (strchr(s,'e')||(strchr(s,'E')))
-		return (long)atof(s);
+		return (paInt)atof(s);
 	else
-		return atol(s);
+		return atoi(s);
 	}
 }
@@ -622,5 +622,5 @@
 if ((s[0]=='0')&&(s[1]=='x'))
 	{
-	long val;
+	paInt val;
 	sscanf(s+2,"%lx",&val);
 	return val;
@@ -630,5 +630,5 @@
 }
 
-long ExtValue::getInt() const
+paInt ExtValue::getInt() const
 {
 switch(type)
@@ -639,5 +639,5 @@
 	case TObj:
 		FMprintf("ExtValue","getInt",FMLV_WARN,"Getting integer value from object reference (%s)",(const char*)getString());
-		return (long)odata().param;
+		return (paInt)(intptr_t)odata().param;
 	default:;
 	}
@@ -654,5 +654,5 @@
 	case TObj:
 		FMprintf("ExtValue","getDouble",FMLV_WARN,"Getting floating point value from object reference (%s)",(const char*)getString());
-		return (double)(long)odata().param;
+		return (double)(intptr_t)odata().param;
 	default:;
 	}
@@ -732,5 +732,5 @@
 	else
 		{
-		setInt(atol(in));
+		setInt(atoi(in));
 		return p;
 		}
@@ -769,5 +769,5 @@
 	{
 	ret=skipQuoteString(in+1,NULL);
-	SString s(in+1,ret-(in+1));
+	SString s(in+1,(int)(ret-(in+1)));
 	sstringUnquote(s);
 	setString(s);
@@ -864,5 +864,5 @@
 else if ((ret=skipWord(in))&&(ret!=in))
 	{
-	SString clsname(in,ret-in);
+	SString clsname(in,(int)(ret-in));
 	ExtValue tmp;
 	ret=tmp.deserialize(ret);
@@ -929,5 +929,5 @@
 ExtValue ExtValue::getExtType()
 {
-if (getType()!=TObj) return ExtValue((long)getType());
+if (getType()!=TObj) return ExtValue((paInt)getType());
 ExtObject& o=odata();
 return ExtValue(SString(o.isEmpty()?"":o.interfaceName()));
Index: cpp/frams/util/extvalue.h
===================================================================
--- cpp/frams/util/extvalue.h	(revision 245)
+++ cpp/frams/util/extvalue.h	(revision 247)
@@ -101,5 +101,5 @@
 #ifdef EXTVALUEUNION
 long data[(EXTVALUEUNIONSIZE+sizeof(long)-1)/sizeof(long)];
-long& idata() const {return (long&)data[0];};
+paInt& idata() const {return (paInt&)data[0];};
 double& ddata() const {return *(double*)data;};
 ExtObject& odata() const {return *(ExtObject*)data;};
@@ -107,10 +107,10 @@
 #else
 union {
-long i;
+paInt i;
 double d;
 SString *s;
 ExtObject *o;
 };
-long& idata() const {return (long&)i;};
+paInt& idata() const {return (paInt&)i;};
 double& ddata() const {return (double&)d;};
 ExtObject& odata() const {return *o;};
@@ -123,10 +123,10 @@
 ExtValue():type(TUnknown){}
 ~ExtValue() {setEmpty();}
-ExtValue(long v) {seti(v);}
+ExtValue(paInt v) {seti(v);}
 ExtValue(double v) {setd(v);}
 ExtValue(const SString &v) {sets(v);}
 ExtValue(const ExtObject &srco) {seto(srco);}
 static ExtValue invalid() {ExtValue v; v.setInvalid(); return v;}
-long compare(const ExtValue& src) const;
+int compare(const ExtValue& src) const;
 int operator==(const ExtValue& src) const;
 void operator+=(const ExtValue& src);
@@ -144,11 +144,11 @@
 ExtPType getType() {return type;}
 void *getObjectTarget(const char* classname,bool warn=true) const;
-void setInt(long v) {if (type!=TInt) setri(v); else idata()=v;}
+void setInt(paInt v) {if (type!=TInt) setri(v); else idata()=v;}
 void setDouble(double v) {if (type!=TDouble) setrd(v); else ddata()=v;}
 void setString(const SString &v) {if (type!=TString) setrs(v); else sdata()=v;}
 void setObject(const ExtObject &src) {if (type!=TObj) setro(src); else odata()=src;}
-static long getInt(const char* s);
+static paInt getInt(const char* s);
 static double getDouble(const char* s);
-long getInt() const;
+paInt getInt() const;
 double getDouble() const;
 SString getString() const;
@@ -176,7 +176,7 @@
 void setr(const ExtValue& src){setEmpty();set(src);}
 void set(const ExtValue& src);
-void setri(long v) {setEmpty();seti(v);}
+void setri(paInt v) {setEmpty();seti(v);}
 void setrd(double v) {setEmpty();setd(v);}
-void seti(long v) {type=TInt;idata()=v;}
+void seti(paInt v) {type=TInt;idata()=v;}
 void setd(double v) {type=TDouble;ddata()=v;}
 #ifdef EXTVALUEUNION
Index: cpp/frams/util/hashtable.h
===================================================================
--- cpp/frams/util/hashtable.h	(revision 245)
+++ cpp/frams/util/hashtable.h	(revision 247)
@@ -29,5 +29,5 @@
 int threshold;
 float load;
-long sync;
+int sync;
 
 int hash(const SString &s);
Index: cpp/frams/util/list.h
===================================================================
--- cpp/frams/util/list.h	(revision 245)
+++ cpp/frams/util/list.h	(revision 247)
@@ -55,5 +55,5 @@
 public:
 
-SListTempl(const SListTempl<T>& src):have(0),used(0),mem(0),pos(0)
+SListTempl(const SListTempl<T>& src):have(0),used(0),pos(0),mem(0)
 	{(*this)=src;}
 SListTempl():have(0),used(0),pos(0),mem(0)
Index: cpp/frams/util/rndutil.cpp
===================================================================
--- cpp/frams/util/rndutil.cpp	(revision 245)
+++ cpp/frams/util/rndutil.cpp	(revision 247)
@@ -5,10 +5,11 @@
 #include "rndutil.h"
 #include <common/nonstd_math.h>
+#include <cstdint>
 #include <stdlib.h>
 
 unsigned short pseudornd(short x)
 {
-	static long seed = 0;
-	long y;
+	static int32_t seed = 0;
+	int32_t y;
 	if (x <= 0) { seed = -x; return 0; }
 	seed = (y = (3677 * seed + 3680) & 0x7fffffff) - 1;
Index: cpp/frams/util/sstring.cpp
===================================================================
--- cpp/frams/util/sstring.cpp	(revision 245)
+++ cpp/frams/util/sstring.cpp	(revision 247)
@@ -113,5 +113,5 @@
 // to be moved somewhere else?
 // public domain source: http://isthe.com/chongo/src/fnv
-typedef unsigned long Fnv32_t;
+typedef uint32_t Fnv32_t;
 
 #define FNV_32_PRIME ((Fnv32_t)0x01000193)
@@ -143,5 +143,5 @@
 //////////////////////////////////////////////////
 
-unsigned long SBuf::hash() const
+uint32_t SBuf::hash() const
 {
 return fnv_32a_buf(txt,used,FNV1_32A_INIT);
@@ -339,8 +339,8 @@
 ///////////////////////////////////////
 
-int SString::equals(const SString& s) const
-{
-if (s.buf==buf) return 1;
-return !strcmp(buf->txt,s.buf->txt);
+bool SString::equals(const SString& s) const
+{
+if (s.buf==buf) return true;
+return strcmp(buf->txt,s.buf->txt)==0;
 }
 
Index: cpp/frams/util/sstring.h
===================================================================
--- cpp/frams/util/sstring.h	(revision 245)
+++ cpp/frams/util/sstring.h	(revision 247)
@@ -22,4 +22,5 @@
 // - mutex required to be thread safe
 
+#include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
@@ -47,5 +48,5 @@
 SBuf();
 ~SBuf();
-unsigned long hash() const; // 32-bit FNV-1 hash -> http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash
+uint32_t hash() const; // 32-bit FNV-1 hash -> http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash
 };
 
@@ -155,7 +156,7 @@
 void operator+=(const SString&); ///< append other SString
 
-int equals(const SString &s) const; ///< TRUE if equal
-int operator==(const SString &s) const {return equals(s);} ///< TRUE if equal
-int operator!=(const SString &s) const {return !equals(s);}
+bool equals(const SString &s) const; ///< TRUE if equal
+bool operator==(const SString &s) const {return equals(s);} ///< TRUE if equal
+bool operator!=(const SString &s) const {return !equals(s);}
 const char* operator()(int p) const {return buf->txt+p;} ///< pointer to p'th character in SString
 char operator[](int i) const {return buf->txt[i];} ///< get char like in array
@@ -175,5 +176,5 @@
 int startsWith(const char *pattern) const;
 char charAt(int pos) const {return buf->txt[pos];}
-unsigned long hash() const {return buf->hash();}
+uint32_t hash() const {return buf->hash();}
 
 static SString valueOf(int);
Index: cpp/frams/virtfile/stdiofile.h
===================================================================
--- cpp/frams/virtfile/stdiofile.h	(revision 245)
+++ cpp/frams/virtfile/stdiofile.h	(revision 247)
@@ -33,11 +33,11 @@
 StdioFILE(MFILE *f,const SString& p) {file=f;path=p;}
 static void setStdio();
-int Vread(void *ptr, size_t size, size_t nmemb) {return mfread(ptr,size,nmemb,file);}
-int Vwrite(const void *ptr, size_t size, size_t nmemb) {return mfwrite(ptr,size,nmemb,file);}
+size_t Vread(void *ptr, size_t size, size_t nmemb) {return mfread(ptr,size,nmemb,file);}
+size_t Vwrite(const void *ptr, size_t size, size_t nmemb) {return mfwrite(ptr,size,nmemb,file);}
 int Veof() {return mfeof(file);}
 int Vputs(const char *s) {return mfputs(s,file);}
 char *Vgets(char *s, int size) {return mfgets(s,size,file);}
 int Vseek(long offset, int whence) {return mfseek(file,offset,whence);}
-int Vtell() {return mftell(file);}
+long Vtell() {return mftell(file);}
 int Vflush() {return 0;/*NOT IMPLEMENTED!*/;}
 const char* VgetPath() {return path;}
@@ -55,6 +55,6 @@
 StdioFILE(FILE *f,const SString& p) {file=f;path=p;}
 static void setStdio();
-int Vread(void *ptr, size_t size, size_t nmemb) {return fread(ptr,size,nmemb,file);}
-int Vwrite(const void *ptr, size_t size, size_t nmemb) {return fwrite(ptr,size,nmemb,file);}
+size_t Vread(void *ptr, size_t size, size_t nmemb) {return fread(ptr,size,nmemb,file);}
+size_t Vwrite(const void *ptr, size_t size, size_t nmemb) {return fwrite(ptr,size,nmemb,file);}
 int Veof() {return feof(file);}
 int Vputc(int c) {return fputc(c,file);}
@@ -64,5 +64,5 @@
 int Vprintf(const char *format, va_list args) { return vfprintf(file,format,args); }
 int Vseek(long offset, int whence) {return fseek(file,offset,whence);}
-int Vtell() {return ftell(file);}
+long Vtell() {return ftell(file);}
 void Vrewind() {rewind(file);}
 int Vflush() {return fflush(file);}
Index: cpp/frams/virtfile/stringfile.cpp
===================================================================
--- cpp/frams/virtfile/stringfile.cpp	(revision 245)
+++ cpp/frams/virtfile/stringfile.cpp	(revision 247)
@@ -7,10 +7,10 @@
 #include <errno.h> //EINVAL
 
-int StringFILE::Vread(void *ptr, size_t size, size_t nmemb)
+size_t StringFILE::Vread(void *ptr, size_t size, size_t nmemb)
 {
-int have=str.len()-pos;
+int have=(int)(str.len()-pos);
 if (have<=0) return 0;
-int need=size*nmemb;
-if (need>have) {nmemb=have/size; need=size*nmemb;}
+int need=(int)(size*nmemb);
+if (need>have) {nmemb=have/size; need=(int)(size*nmemb);}
 memcpy(ptr,((const char*)str)+pos,need);
 pos+=need;
@@ -23,10 +23,10 @@
 	return EOF;
 else
-	return str[pos++];
+	return str.operator[]((int)pos++);
 }
 
 char *StringFILE::Vgets(char *s, int size)
 {
-int have=str.len()-pos;
+int have=str.len()-(int)pos;
 if (have<=0) return 0;
 if (size<0) size=0;
Index: cpp/frams/virtfile/stringfile.h
===================================================================
--- cpp/frams/virtfile/stringfile.h	(revision 245)
+++ cpp/frams/virtfile/stringfile.h	(revision 247)
@@ -16,13 +16,13 @@
   public:
 StringFILE(SString& s):str(s),pos(0) {}
-int Vread(void *ptr, size_t size, size_t nmemb);
-int Vwrite(const void *ptr, size_t size, size_t nmemb) {str.append((const char*)ptr,size*nmemb); return size*nmemb;}
+size_t Vread(void *ptr, size_t size, size_t nmemb);
+size_t Vwrite(const void *ptr, size_t size, size_t nmemb) {str.append((const char*)ptr,(int)(size*nmemb)); return size*nmemb;}
 int Veof() {return pos>=str.len();}
 int Vputc(int c) {str+=(char)c; return c;}
-int Vputs(const char *s) {str.append(s,strlen(s)); return 0;}
+int Vputs(const char *s) {str.append(s,(int)strlen(s)); return 0;}
 int Vgetc();
 char *Vgets(char *s, int size);
 int Vseek(long offset, int whence);
-int Vtell() {return pos;}
+long Vtell() {return pos;}
 int Vflush() {return 0;}
 };
Index: cpp/frams/virtfile/virtfile.cpp
===================================================================
--- cpp/frams/virtfile/virtfile.cpp	(revision 245)
+++ cpp/frams/virtfile/virtfile.cpp	(revision 247)
@@ -45,4 +45,13 @@
 va_end(argptr);
 return ret;
+}
+
+int VirtFILE::getSize()
+{
+  int saved_pos = Vtell();
+  Vseek(0, SEEK_END);
+  int size = Vtell();
+  Vseek(saved_pos, SEEK_SET);
+  return size;
 }
 
Index: cpp/frams/virtfile/virtfile.h
===================================================================
--- cpp/frams/virtfile/virtfile.h	(revision 245)
+++ cpp/frams/virtfile/virtfile.h	(revision 247)
@@ -23,6 +23,6 @@
 {
   public:
-virtual int Vread(void *ptr, size_t size, size_t nmemb)=0;
-virtual int Vwrite(const void *ptr, size_t size, size_t nmemb)=0;
+virtual size_t Vread(void *ptr, size_t size, size_t nmemb)=0;
+virtual size_t Vwrite(const void *ptr, size_t size, size_t nmemb)=0;
 virtual int Veof()=0;
 virtual int Vputc(int c) {unsigned char data=(unsigned char)c; return (Vwrite(&data,1,1)==1)?data:EOF;}
@@ -30,5 +30,5 @@
 virtual int Vgetc() {unsigned char data; if (Vread(&data,1,1)==1) return data; else return EOF;}
 virtual int Vseek(long offset, int whence)=0;
-virtual int Vtell()=0;
+virtual long Vtell()=0;
 virtual void Vrewind() {Vseek(0,SEEK_SET);}
 virtual int Vflush()=0;
@@ -37,4 +37,5 @@
 int printf(const char *format, ...);
 virtual const char *VgetPath() {return 0;} // 0=unspecified path
+virtual int getSize();
 virtual ~VirtFILE();
 static VirtFILE *Vstdin,*Vstdout,*Vstderr;
Index: cpp/frams/vm/classes/3dobject.cpp
===================================================================
--- cpp/frams/vm/classes/3dobject.cpp	(revision 245)
+++ cpp/frams/vm/classes/3dobject.cpp	(revision 247)
@@ -472,123 +472,4 @@
 {return ExtObject(&getStaticParam(),p);}
 
-ParamEntry* ReferenceObj::getStaticParamtab()
-{
-#define FIELDSTRUCT ReferenceObj
-static ParamEntry paramtab[]=
-{
-{"Ref",1,5,"Ref","Reference objects. Useful for returning things from functions.\n\nExample:\nvar x=111;\nsquare(&x);// '&' creates the Reference object\nSimulator.print(x);//x is now 12321\n\nfunction square(r)\n{r.value=r.value*r.value;}\n//square receives the Reference objects and changes its 'value' field"},
-
-{"value",0,PARAM_NOSTATIC,"value","x",GETSET(value),},
-{"newS",0,0,"create new reference","p",PROCEDURE(p_newS),"(for internal use only) use &variablename to create Ref objects.",},
-{"newO",0,0,"create new reference","p",PROCEDURE(p_newO),"(for internal use only) use &variablename to create Ref objects.",},
-{"copyFrom",0,0,"copy the reference","p(oRef)",PROCEDURE(p_copyFrom),"make the reference point to the same target,"},
-{"toString",0,PARAM_READONLY | PARAM_NOSTATIC,"textual form","s",GETONLY(toString),},
-{0,0,0,},
-};
-#undef FIELDSTRUCT
-return paramtab;
-}
-
-Param& ReferenceObj::getStaticParam()
-{
-#ifdef __CODEGUARD__
-static ReferenceObj static_referenceobj;
-static Param static_refobjectparam(getStaticParamtab(),&static_referenceobj);
-#else
-static Param static_refobjectparam(getStaticParamtab());
-#endif
-return static_refobjectparam;
-}
-
-void ReferenceObj::p_newS(ExtValue *args,ExtValue *ret)
-{
-*ret=makeDynamicObject(new ReferenceObj((ExtValue*)args->getInt()));
-}
-
-void ReferenceObj::p_newO(ExtValue *args,ExtValue *ret)
-{
-if (args[0].type==TInt)
-	*ret=makeDynamicObject(new ReferenceObj(args[1].getObject(),args[0].getInt()));
-else
-	*ret=makeDynamicObject(new ReferenceObj(args[1].getObject(),args[0].getString()));
-}
-
-void ReferenceObj::p_copyFrom(ExtValue *args,ExtValue *ret)
-{
-ReferenceObj* other=fromObject(args[0]);
-if (other)
-	{
-	value=other->value;
-	obj=other->obj;
-	prop=other->prop;
-	}
-}
-
-void ReferenceObj::get_toString(ExtValue *ret)
-{
-SString s="(";
-static SListTempl<ReferenceObj*> trace;
-if (trace.find(this)>=0)
-	s+="...";
-else
-	{
-	trace+=this;
-	if (value)
-		s+=value->getString();
-	else
-		{
-		ExtValue v;
-		Param tmp_param;
-		ParamInterface *pi=obj.getParamInterface(tmp_param);
-		pi->get(prop,v);
-		s+=v.getString();
-		}
-	trace-=this;
-	}
-s+=")";
-ret->setString(s);
-}
-
-void ReferenceObj::get_value(ExtValue *ret)
-{
-if (value)
-	*ret=*value;
-else
-	{
-	Param tmp_param;
-	ParamInterface *pi=obj.getParamInterface(tmp_param);
-	pi->get(prop,*ret);
-	}
-}
-
-int ReferenceObj::set_value(const ExtValue *val)
-{
-if (value)
-	*value=*val;
-else
-	{
-	Param tmp_param;
-	ParamInterface *pi=obj.getParamInterface(tmp_param);
-	pi->set(prop,*val);
-	}
-return PSET_CHANGED;
-}
-
-ReferenceObj::ReferenceObj(const ExtObject &o,const SString &p)
-	:value(0),obj(o)
-{
-Param tmp_param;
-ParamInterface *pi=obj.getParamInterface(tmp_param);
-prop=pi->findId(p);
-}
-
-ExtObject ReferenceObj::makeDynamicObject(ReferenceObj* r)
-{return ExtObject(&getStaticParam(),r);}
-
-ReferenceObj* ReferenceObj::fromObject(const ExtValue& v)
-{
-return (ReferenceObj*)v.getObjectTarget(getStaticParam().getName());
-}
-
 /////////////
 
Index: cpp/frams/vm/classes/3dobject.h
===================================================================
--- cpp/frams/vm/classes/3dobject.h	(revision 245)
+++ cpp/frams/vm/classes/3dobject.h	(revision 247)
@@ -82,30 +82,3 @@
 };
 
-class ReferenceObj: public DestrBase
-{
-  public:
-ExtValue *value;
-ExtObject obj;
-int prop;
-
-ReferenceObj(ExtValue *val):value(val) {}
-ReferenceObj() {}
-ReferenceObj(const ExtObject &o,int p):value(0),obj(o),prop(p) {}
-ReferenceObj(const ExtObject &o,const SString &p);
-#define STATRICKCLASS ReferenceObj
-PARAMPROCDEF(p_newS);
-PARAMPROCDEF(p_newO);
-PARAMPROCDEF(p_copyFrom);
-PARAMGETDEF(toString);
-PARAMGETDEF(value);
-PARAMSETDEF(value);
-#undef STATRICKCLASS
-
-static ParamInterface* getInterface();
-static ExtObject makeDynamicObject(ReferenceObj* r);
-static ReferenceObj* fromObject(const ExtValue& v);
-static Param& getStaticParam();
-static ParamEntry* getStaticParamtab();
-};
-
 #endif
Index: cpp/frams/vm/framscript.y
===================================================================
--- cpp/frams/vm/framscript.y	(revision 245)
+++ cpp/frams/vm/framscript.y	(revision 247)
@@ -1003,5 +1003,5 @@
 	if (loc!=TranslatorStack::NOTFOUND)
 		{
-		trctx.out->printf("push &%d\ncall Ref.newS\n",loc-trstack.currentPos());trstack.adjust(-1);
+		trctx.out->printf("push &%d\n",loc-trstack.currentPos());trstack.adjust(-1);
 		}
 	else if (globalOk($2))
