Index: /cpp/gdk/defassign.m4
===================================================================
--- /cpp/gdk/defassign.m4	(revision 81)
+++ /cpp/gdk/defassign.m4	(revision 82)
@@ -12,5 +12,5 @@
 define(`ENDCLASS',`dnl')
 define(`CLASS',`ifelse($2,USECLASS,
-`// default assignments for $1 : define(`PROP',`ifelse($'8`,,`dnl',$'9`=MAYBE_QUOTE($'5`,$'8`));')dnl'
+`// default assignments for $1 : define(`PROP',`ifelse($'8`,,`dnl',ifelse($'10`,,$'9`=MAYBE_QUOTE($'5`,$'8`);))')dnl'
 ,
 `define(`PROP',`dnl')dnl'
Index: /cpp/gdk/extvalue.cpp
===================================================================
--- /cpp/gdk/extvalue.cpp	(revision 81)
+++ /cpp/gdk/extvalue.cpp	(revision 82)
@@ -196,5 +196,9 @@
 		double d=ddata();
 		d/=src.getDouble();
+#ifdef IPHONE
+        if (!isinf(d))
+#else
 		if (finite(d))
+#endif
 			ddata()=d;
 		else
Index: /cpp/gdk/framsg.cpp
===================================================================
--- /cpp/gdk/framsg.cpp	(revision 81)
+++ /cpp/gdk/framsg.cpp	(revision 82)
@@ -1,9 +1,35 @@
-// This file is a part of the Framsticks GDK library.
-// Copyright (C) 2002-2011  Szymon Ulatowski.  See LICENSE.txt for details.
-// Refer to http://www.framsticks.com/ for further information.
+#include "framsg.h"
+#include "nonstd_stdio.h"
 
-#include "nonstd.h"
-#include "framsg.h"
-#include <stdio.h>
+#ifdef SHP
+#include <FBaseSys.h> //AppLog
+#endif
+
+#ifdef MOBILE2D
+#include <Winbase.h>
+#include "Util.h"
+#endif
+
+static const char *warn="[warn] ";
+static const char *err="[ERROR] ";
+
+/* TODO integracja z error managerem 
+void FramMessage(const char *o,const char *m,const char *bl,int w)
+{
+  const char *lvl="";
+  if (w==1) lvl=warn; else if (w>1) lvl=err;
+#ifdef SHP
+  //jesli chcemy zeby nawet w trybie release wysylal komunikaty:
+  //#define AppLog(...)      __App_info(__PRETTY_FUNCTION__ , __LINE__, __VA_ARGS__)
+	AppLog("%s%s::%s - %s\n",lvl,o,m,bl);
+#elif defined MOBILE2D
+	char buf[1000];
+	sprintf(buf,"%s%s::%s - %s\n",lvl,o,m,bl);
+	OutputDebugString(Util::strTOwstr(buf).c_str());
+#else
+	fprintf(w>0?stderr:stdout,"%s%s::%s - %s\n",lvl,o,m,bl);
+#endif
+}
+*/
 
 void FMprintf(const char *o,const char *m,int w,const char *bl, ...)
@@ -12,6 +38,6 @@
    va_list argptr;
    va_start(argptr,bl);
-   vsnprintf(buf,10000,bl,argptr);
-   va_end(argptr);
+	 vsnprintf(buf,10000,bl,argptr);
+	 va_end(argptr);
    FramMessage(o,m,buf,w);
 }
@@ -23,2 +49,10 @@
    FramMessage(o,m,buf,w);
 }
+
+void FMprintf(const char *bl,...)
+{
+	va_list argptr;
+	va_start(argptr,bl);
+	FMprintf("Message","printf",0,bl,argptr);
+	va_end(argptr);
+}
Index: /cpp/gdk/framsg.h
===================================================================
--- /cpp/gdk/framsg.h	(revision 81)
+++ /cpp/gdk/framsg.h	(revision 82)
@@ -1,6 +1,2 @@
-// This file is a part of the Framsticks GDK library.
-// Copyright (C) 2002-2011  Szymon Ulatowski.  See LICENSE.txt for details.
-// Refer to http://www.framsticks.com/ for further information.
-
 #ifndef _FRAMSG_H_
 #define _FRAMSG_H_
@@ -10,4 +6,5 @@
 void FMprintf(const char *o,const char *m,int w,const char *bl, ...);
 void FMprintf(const char *o,const char *m,int w,const char *bl,va_list va);
+void FMprintf(const char *bl,...); //dla leniwych - zastepuje printf
 void FramMessage(const char *o,const char *m,const char *bl,int w);
 
Index: /cpp/gdk/gen-config.h
===================================================================
--- /cpp/gdk/gen-config.h	(revision 81)
+++ /cpp/gdk/gen-config.h	(revision 82)
@@ -8,18 +8,35 @@
  USE_GENCONV_xxx - configure converters
  USE_GENMAN_xxx - configure genman
+*/
 
- */
+#define BASIC_GENETICS //excludes f0-fuzzy and f8 (which is not stable for incorrect genotypes) 
 
 #define USE_GENCONV_F10
-//#define USE_GENCONV_F21
-//#define USE_GENCONV_F30
-//#define USE_GENCONV_F40
+#define USE_GENCONV_F20
+#define USE_GENCONV_F32
+#define USE_GENCONV_F40
 //#define USE_GENCONV_F41_TEST
 //#define USE_GENCONV_F50
+//#define USE_GENCONV_F60
+#define USE_GENCONV_F70
+#ifndef BASIC_GENETICS
+ #define USE_GENCONV_F81
+#endif
+#define USE_GENCONV_F90
 
-//#define USE_GENMAN_F0
-//#define USE_GENMAN_F1
-//#define USE_GENMAN_F2
-//#define USE_GENMAN_F3
-//#define USE_GENMAN_F4
+#define USE_GENMAN_F0
+#ifndef BASIC_GENETICS
+ #define USE_GENMAN_F0FUZZY
+#endif
+#define USE_GENMAN_F1
+#define USE_GENMAN_F2
+#define USE_GENMAN_F3
+#define USE_GENMAN_F4
 //#define USE_GENMAN_F5
+//#define USE_GENMAN_F6
+#define USE_GENMAN_F7
+#ifndef BASIC_GENETICS
+ #define USE_GENMAN_F8
+#endif
+#define USE_GENMAN_F9
+
Index: /cpp/gdk/genoconv.cpp
===================================================================
--- /cpp/gdk/genoconv.cpp	(revision 81)
+++ /cpp/gdk/genoconv.cpp	(revision 82)
@@ -90,8 +90,8 @@
 GenoConverter *gc;
 for (converters.start();gc=(GenoConverter*)converters();) delete gc;
-if (globalobject==this) globalobject=0;
-}
-
-GenoConvManager *GenoConvManager::globalobject=0;
+if (globalobject==this) globalobject=NULL;
+}
+
+GenoConvManager *GenoConvManager::globalobject=NULL;
 
 void GenoConvManager::addConverter(GenoConverter *gc)
Index: /cpp/gdk/model.cpp
===================================================================
--- /cpp/gdk/model.cpp	(revision 81)
+++ /cpp/gdk/model.cpp	(revision 82)
@@ -3,11 +3,9 @@
 // Refer to http://www.framsticks.com/ for further information.
 
-#include "nonstd.h"
+#include "nonstd_math.h"
 #include "model.h"
 #include "framsg.h"
 #include "multimap.h"
 #include "errmanager.h"
-
-#include <math.h>
 
 #define FIELDSTRUCT Model
@@ -384,5 +382,5 @@
 }
 
-void Model::makeGeno(Geno &g,MultiMap *map)
+void Model::makeGeno(Geno &g,MultiMap *map,bool handle_defaults)
 {
 if ((buildstatus!=valid)&&(buildstatus!=building))
@@ -419,5 +417,5 @@
 	modelparam.select(this);
 	gen+="m:";
-	modelparam.save2(gen,&defaultmodel);
+	modelparam.save2(gen,handle_defaults ? &defaultmodel : NULL,true,!handle_defaults);
 	}
 
@@ -427,5 +425,5 @@
 	len=gen.len();
 	gen+="p:";
-	partparam.save2(gen,&defaultpart);
+	partparam.save2(gen,handle_defaults ? &defaultpart : NULL,true,!handle_defaults);
 	if (map)
 		map->add(len,gen.len()-1,partToMap(i));
@@ -437,5 +435,5 @@
 	jointparam.setParamTab(j->usedelta?f0_joint_paramtab:f0_nodeltajoint_paramtab);
 	gen+="j:";
-	jointparam.save2(gen,&defaultjoint);
+	jointparam.save2(gen,handle_defaults ? &defaultjoint : NULL,true,!handle_defaults);
 	if (map)
 		map->add(len,gen.len()-1,jointToMap(i));
@@ -446,5 +444,5 @@
 	len=gen.len();
 	gen+="n:";
-	neuroparam.save2(gen,&defaultneuro);
+	neuroparam.save2(gen,handle_defaults ? &defaultneuro : NULL,true,!handle_defaults);
 	if (map)
 		map->add(len,gen.len()-1,neuroToMap(i));
@@ -477,5 +475,5 @@
 		len=gen.len();
 		gen+="c:";
-		connparam.save2(gen,&defaultconn);
+		connparam.save2(gen,handle_defaults ? &defaultconn : NULL,true,!handle_defaults);
 		if (map)
 			map->add(len,gen.len()-1,neuroToMap(n->refno));
Index: /cpp/gdk/model.h
===================================================================
--- /cpp/gdk/model.h	(revision 81)
+++ /cpp/gdk/model.h	(revision 82)
@@ -6,6 +6,6 @@
 #define _MODEL_H_
 
+#include "nonstd_math.h"
 #include <stdlib.h>
-#include <math.h>
 #include <stdio.h>
 
@@ -109,7 +109,4 @@
 /// make the model from current genotype
 void build();
-
-/// make f0 genotype from current construction
-void makeGeno(Geno &,MultiMap *map=0);
 
 friend class NeuroNetFactory;
@@ -217,4 +214,7 @@
 const Geno &getF0Geno();
 
+/// make f0 genotype from current construction (low level version of getF0Geno)
+void makeGeno(Geno &,MultiMap *map=0,bool handle_defaults=true);
+
 /** @return mapping from source genotype (0-based position in text) to model elements reference numbers.
     the map can be empty if the mapping hasn't been requested earlier (in constructor)
Index: /cpp/gdk/multirange.cpp
===================================================================
--- /cpp/gdk/multirange.cpp	(revision 81)
+++ /cpp/gdk/multirange.cpp	(revision 82)
@@ -4,4 +4,5 @@
 
 #include "multirange.h"
+#include "nonstd_stl.h"
 
 #include <stdio.h>
Index: /cpp/gdk/neuroimpl-channels.cpp
===================================================================
--- /cpp/gdk/neuroimpl-channels.cpp	(revision 81)
+++ /cpp/gdk/neuroimpl-channels.cpp	(revision 82)
@@ -4,4 +4,5 @@
 
 #include "neuroimpl-channels.h"
+#include "nonstd_stl.h"
 
 void NI_Channelize::go()
Index: /cpp/gdk/neuroimpl-fuzzy-f0.cpp
===================================================================
--- /cpp/gdk/neuroimpl-fuzzy-f0.cpp	(revision 81)
+++ /cpp/gdk/neuroimpl-fuzzy-f0.cpp	(revision 82)
@@ -7,6 +7,5 @@
 
 #include "neuroimpl-fuzzy-f0.h"
-// nonstd z powodu max()
-#include "nonstd.h"
+#include "nonstd_stl.h" //min,max
 
 //this part concerns fuzzy sets transformation
Index: /cpp/gdk/neuroimpl-fuzzy.cpp
===================================================================
--- /cpp/gdk/neuroimpl-fuzzy.cpp	(revision 81)
+++ /cpp/gdk/neuroimpl-fuzzy.cpp	(revision 82)
@@ -5,4 +5,5 @@
 #include "neuroimpl-fuzzy.h"
 #include "neuroimpl-fuzzy-f0.h"
+#include "nonstd_stl.h" //min,max
 
 int NI_FuzzyNeuro::countOuts(const Model *m, const Neuro *fuzzy)
Index: /cpp/gdk/nonstd.h
===================================================================
--- /cpp/gdk/nonstd.h	(revision 81)
+++ /cpp/gdk/nonstd.h	(revision 82)
@@ -1,44 +1,35 @@
-//Define rnd01, rnd0N, and randomN so that they
-//work in your C++ environment.
-//Some other functions/macros may also be needed if they
-//are missing in your environment, like min, max, etc.
+#ifndef _NONSTD_H_
+#define _NONSTD_H_
 
-#ifndef __NONSTD_H
-#define __NONSTD_H
-
-#define APPLICATION_NAME "Framsticks"
-#define MAIN_FRAMSTICKS
 #define SAFEDELETE(p) {if (p) {delete p; p=NULL;}}
 #define SAFEDELETEARRAY(p) {if (p) {delete[] p; p=NULL;}}
 
-//#ifndef _Windows   included below?
-//#include <stdlib.h>
-//#endif
+#define roundToInt(x) ((int)(floor((x)+0.5)))
+
+
+#define CPP_STR(s) CPP_XSTR(s)
+#define CPP_XSTR(s) #s
+
 
 #define DB(x) //output debug info. If needed, use #define DB(x) x
 //#define DB(x) x
 
+
 // ms visual c++
 #ifdef _MSC_VER
- #define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
- #include <windows.h>
- #include <stdio.h>
- #include <stdarg.h>
+ #include <stdio.h> //musi byc najpierw ten include zeby robic definy ponizej (albo bedzie '_vsnprintf': attributes inconsistent with previous declaration, stdio.h:358)
  #define vsnprintf _vsnprintf
- #define _USE_MATH_DEFINES //after this is defined, the next #include <math.h> or <cmath> will define:
- //#ifndef M_PI
- //#define M_PI 3.1415926535897932384626433832795
- //#endif
- //#ifndef M_PI_2
- //#define M_PI_2 (M_PI/2)
- //#endif
+ #define snprintf _snprintf
+#endif
 
+#ifdef MOBILE2D
+ #define strdup _strdup
 #endif
 
 /////////////////////////////////////////////////////// 64-bit int type and other macros
-#ifdef _Windows
+#ifdef _WIN32
 	typedef __int64 LONGLONG;
-	#define PATHSEPARATORCHAR '\\'
-	#define PATHSEPARATORSTRING "\\"
+	#define PATH_SEPARATOR_CHAR '\\'
+	#define PATH_SEPARATOR_STRING "\\"
 	#define FPU_THROWS_EXCEPTIONS
 	#define FOPEN_READ "rt"
@@ -47,6 +38,6 @@
 #else
 	#define LONGLONG long long int
-	#define PATHSEPARATORCHAR '/'
-	#define PATHSEPARATORSTRING "/" 
+	#define PATH_SEPARATOR_CHAR '/'
+	#define PATH_SEPARATOR_STRING "/"
 	#define FOPEN_READ "r"
 	#define FOPEN_WRITE "w"
@@ -54,44 +45,36 @@
 #endif
 
-#ifdef __BORLANDC__
-	#define fileExists(f) (!access(f,0))
-        #include "stdlib.h" //random
-	#define rnd01 ((double)((double)_lrand()/(double)(LRAND_MAX+1)))
-	//#define rnd01 ((double)((double)rand()/(RAND_MAX+1)))
-	#define rnd0N(num) ((double)((num)*rnd01))
-	#define randomN(num) random(num) //uses _lrand
-#else
-	#ifdef _MSC_VER
-	#define fileExists(f) (!access(f,0))
-	#else
-	#define fileExists(f) (!access(f,R_OK))
-	#endif
 
-	//#define FLOATRAND
-	#ifdef FLOATRAND
-		#define randomN(x) ((int)((x)*drand48()))
-		#define rnd01 (drand48())
-  		#define rnd0N(x) (drand48()*(x))
-	#else
-		#define rnd01 ((double)(rand()/(RAND_MAX+1.0)))
-		#define rnd0N(x) ((x)*rnd01)
-		#define randomN(x) ((int)rnd0N(x))
-	#endif
+
+#ifdef LINUX
+ #include <strings.h>
+ #define stricmp(a,b) strcasecmp(a,b)
+ #define _isnan(a) isnan(a) //do nonstd_math.h?
+ #define GET_APP_HOME "./"
+ #define GET_APP_RESOURCES "./"
 #endif
 
-
-#ifdef __GNUC__
-/*
-	#define min(a,b) (((a)>(b))?(b):(a))
-	#define max(a,b) (((a)>(b))?(a):(b))
-	#define abs(a) ((a)>=0?(a):-(a))
-*/
-#include <algorithm>
-using namespace std;
+#ifdef IPHONE
+ #include <string>
+ #define _isnan(a) isnan(a) //do nonstd_math.h?
+ std::string getAppHome(); //w tym pliku deklaracja funkcji nie pasuje...
+ std::string getAppResources();
+ #define GET_APP_HOME getAppHome()
+ #define GET_APP_RESOURCES getAppResources()
 #endif
 
-#ifdef DEFINE_STRICMP_AS_STRCASECMP
-#define stricmp(a,b) strcasecmp(a,b)
+#ifdef SHP
+ //#define __assert_func(a,b,c,d) 0 //Currently, we are sorry to inform you that assert() is not yet supported. We have considered your request for internal discussion. No ale na szczêcie w³asna (byle by by³a, bo i tak zak³adamy ze assert ktore przeciez dziala tylko w trybie debug nie jest potrzebne na bada) implementacja w "bada-assert.cpp"
+ #define GET_APP_HOME "/Home/"
+ #define GET_APP_RESOURCES "/Res/"
 #endif
 
+#if defined(_WIN32) && !defined(SHP)
+    #define GET_APP_HOME ".\\"
+    #define GET_APP_RESOURCES ".\\"
 #endif
+
+//typedef unsigned char boolean; //niestety nie mozna uzyc 'bool' bo VC w rpcndr.h wlasnie tak definiuje booleana, jako unsigned char
+//typedef char byte; //rozne srodowiska c++ definiuja byte jako unsigned char! w javie jest inaczej -> trzeba i tak zmienic w portowanych zrodlach byte na char.
+
+#endif
Index: /cpp/gdk/nonstd_dir.h
===================================================================
--- /cpp/gdk/nonstd_dir.h	(revision 82)
+++ /cpp/gdk/nonstd_dir.h	(revision 82)
@@ -0,0 +1,15 @@
+#ifndef _NONSTD_DIR_H_
+#define _NONSTD_DIR_H_
+
+#if defined _WIN32 && !defined SHP && !defined __BORLANDC__
+#include "dirent_windows.h"
+#else
+#ifdef SHP
+#include "dirent_bada.h"
+#else
+#include <dirent.h>
+#endif
+#endif
+
+#endif
+
Index: /cpp/gdk/nonstd_math.h
===================================================================
--- /cpp/gdk/nonstd_math.h	(revision 82)
+++ /cpp/gdk/nonstd_math.h	(revision 82)
@@ -0,0 +1,51 @@
+#ifndef _NONSTD_MATH_H_
+#define _NONSTD_MATH_H_
+
+
+#ifdef _MSC_VER
+ #define _USE_MATH_DEFINES //after this is defined, the next #include <math.h> or <cmath> will define M_PI etc.
+ #include <math.h> //w vc2008 dzia³a³o tu <cmath>, ale w vc2010 juz nie bo "co" (jaki inny .h stl'a?) includuje wczeniej <cmath> bez _USE_MATH_DEFINES, a <cmath> includuje <math.h> (ale tylko raz bo ma "include guards" jak kazdy .h)
+#else //m.in. __BORLANDC__
+ #include <math.h>
+#endif
+
+
+
+//support for random numbers:
+
+#include "stdlib.h"
+
+#ifdef __BORLANDC__
+	#define rnd01 ((double)((double)_lrand()/(double)(LRAND_MAX+1)))
+	//#define rnd01 ((double)((double)rand()/(RAND_MAX+1)))
+	#define rnd0N(num) ((double)((num)*rnd01))
+	#define randomN(num) random(num) //uses _lrand
+#else
+
+	//#define FLOATRAND
+	#ifdef FLOATRAND
+		#define randomN(x) ((int)((x)*drand48()))
+		#define rnd01 (drand48())
+  		#define rnd0N(x) (drand48()*(x))
+	#else
+		#define rnd01 ((double)(rand()/(RAND_MAX+1.0)))
+		#define rnd0N(x) ((x)*rnd01)
+		#define randomN(x) ((int)rnd0N(x))
+	#endif
+#endif
+
+#ifdef SHP
+ //#define __assert_func(a,b,c,d) 0 //Currently, we are sorry to inform you that assert() is not yet supported. We have considered your request for internal discussion. Na szczêcie jest w³asna (byle by by³a, bo i tak zak³adamy ze assert ktore przeciez dziala tylko w trybie debug nie jest potrzebne na bada) implementacja w "bada-assert.cpp"
+ #define _isnan(a) isnan(a)
+ #define isnan(a) false //...i isnan() tez sie nie linkuje
+ #include <cstdlib> //RAND_MAX defined incorrectly
+ #ifdef BADA_SIMULATOR //...but only in simulator libs
+  #undef RAND_MAX
+  #define RAND_MAX 32768 //...this is the actual value used by rand()
+ #endif
+#endif
+
+
+
+#endif
+
Index: /cpp/gdk/nonstd_stdio.cpp
===================================================================
--- /cpp/gdk/nonstd_stdio.cpp	(revision 82)
+++ /cpp/gdk/nonstd_stdio.cpp	(revision 82)
@@ -0,0 +1,114 @@
+#include "nonstd_stdio.h"
+#if defined _WIN32 && !defined SHP
+//tu nie trzeba includów zeby dzialal unlink()
+#else
+#include <unistd.h>
+#endif
+
+bool fileExists(const char* path)
+{
+//lepiej gdyby uzywalo stat bo mfopen mogloby cos niepotrzebnie wczytywac przy otwarciu pliku ale mfopen wiadomo ze zadziala wszedzie tak samo
+MFILE *f=mfopen(path,"r");
+if (f==NULL) return false;
+mfclose(f);
+return true;
+}
+
+bool removeFile(const char* path)
+{
+  return unlink(path)==0; //VS: "The POSIX name is deprecated. Instead, use the ISO C++ conformant name: _unlink"
+}
+
+
+#if defined SHP && defined BADA_API_1
+
+MFILE *mfopen(const char*path, const char*mode)
+{
+	Osp::Io::File *f = new Osp::Io::File();
+	result r = f->Construct(path, mode);
+	if (IsFailed(r))
+	{
+		delete f;
+		f = NULL;
+	}
+	return f;
+}
+
+void mfclose(MFILE *f)
+{
+	delete f;
+}
+
+int mfread(void *ptr, int size, int count, MFILE *f)
+{
+	int bytes = size * count;
+	int przeczytane = f->Read(ptr, bytes);
+	return przeczytane != bytes ? przeczytane / size : count;
+}
+
+int mfwrite(const void *ptr, int size, int count, MFILE *f)
+{
+	result r = f->Write(ptr, size * count);
+	if (IsFailed(r))
+		return 0; //nie mozemy wykryc jesli udalo sie zapisac czêæ
+	else
+		return count;
+}
+
+int mfputs(const char *txt, MFILE *f)
+{
+	int len = strlen(txt);
+	int res = mfwrite(txt, len, 1, f);
+	return res == 1 ? 1 : EOF;
+}
+
+char* mfgets(char *str, int num, MFILE *f)
+{
+	bool err = false;
+	int przeczytane = 0;
+	num--; //zeby zawsze zostalo miejsce na wpisanie koncz¹cego NULL
+	do
+	{
+		err = f->Read(str, 1) != 1;
+		if (!err)
+		{
+			str++;
+			przeczytane++;
+		}
+	} while (!err && przeczytane<num && *str != '\n');
+	if (*str == '\n' && przeczytane<num)
+		*(str + 1) = 0;
+	return przeczytane == 0 ? NULL : str;
+}
+
+int mfeof(MFILE *f)
+{
+	//brzydkie obejscie zeby w bada wykryc czy FILE jest w stanie EOF
+	static char buf[1];
+	int pos = f->Tell();
+	int przeczytane = f->Read(&buf, 1);
+	f->Seek(Osp::Io::FILESEEKPOSITION_BEGIN,pos);
+	return przeczytane == 1 ? 0 : 1;
+}
+
+int mfseek(MFILE *f, long position, int type)
+{
+	result r;
+	if (type == SEEK_SET)
+		r = f->Seek(Osp::Io::FILESEEKPOSITION_BEGIN, position);
+	else if (type == SEEK_CUR)
+		r = f->Seek(Osp::Io::FILESEEKPOSITION_CURRENT, position);
+	else if (type == SEEK_END)
+		r = f->Seek(Osp::Io::FILESEEKPOSITION_END, position);
+	else
+		return 1;
+	return IsFailed(r) ? 1 : 0;
+}
+
+long mftell(MFILE *f)
+{
+	return f->Tell();
+}
+
+#endif
+
Index: /cpp/gdk/nonstd_stdio.h
===================================================================
--- /cpp/gdk/nonstd_stdio.h	(revision 82)
+++ /cpp/gdk/nonstd_stdio.h	(revision 82)
@@ -0,0 +1,75 @@
+#ifndef _NONSTD_STDIO_H_
+#define _NONSTD_STDIO_H_
+
+bool fileExists(const char* path);
+bool removeFile(const char* path);
+
+#ifdef _WIN32
+
+
+#ifndef _MSC_VER
+ #include <dir.h>
+#else
+ #ifndef MOBILE2D
+ #include <direct.h>
+ #endif
+ #define mkdir _mkdir
+#endif
+
+#ifndef MOBILE2D
+ #include <io.h> //borland compiler: include <io.h> before <dir.h> causes the SimWorld class in "simul.h" be unrecognized, for unknown reason :O moreover, this problem is only pertinent to the CLI project, not GUI. Maybe this is caused by global defines like NOVCL, NO_STRICT etc.?
+ #define makeDirectory(name) mkdir(name) 
+#endif
+
+
+#else
+
+
+ #include <unistd.h>
+ #include <sys/stat.h>
+ #define makeDirectory(name) mkdir(name,0777)
+
+#endif
+
+
+#include <stdio.h>
+
+#if defined SHP && defined BADA_API_1
+
+//sprintf* and others that work correctly are taken from <stdio.h>...
+
+#include <FIo.h>
+
+
+typedef Osp::Io::File MFILE;
+MFILE *mfopen(const char*path,const char*mode);
+void mfclose(MFILE *f);
+int mfread(void *ptr, int size, int n, MFILE *f);
+int mfwrite(const void *ptr, int size, int n, MFILE *f);
+int mfputs(const char *, MFILE *);
+int	mfseek(MFILE *, long, int);
+long mftell(MFILE *);
+char *mfgets(char *str, int num, MFILE *f);
+int mfeof(MFILE *f);
+
+//#define	SEEK_SET	0	/* set file offset to offset */
+//#define	SEEK_CUR	1	/* set file offset to current plus offset */
+//#define	SEEK_END	2	/* set file offset to EOF plus offset */
+//int	sprintf(char *, const char *, ...);
+//int	vsnprintf(char *,int, const char *, ...);
+
+#else
+ typedef FILE MFILE;
+ #define mfopen fopen
+ #define mfclose fclose
+ #define mfread fread
+ #define mfwrite fwrite
+ #define mfputs fputs
+ #define mfgets fgets
+ #define mfeof feof
+ #define mfseek fseek
+ #define mftell ftell
+#endif
+
+#endif
+
Index: /cpp/gdk/nonstd_stl.h
===================================================================
--- /cpp/gdk/nonstd_stl.h	(revision 82)
+++ /cpp/gdk/nonstd_stl.h	(revision 82)
@@ -0,0 +1,44 @@
+#ifndef _NONSTD_STL_H_
+#define _NONSTD_STL_H_
+
+//stl is not non-standard :-)
+
+#include <string>
+using std::string;
+
+#include <vector>
+using std::vector;
+
+#include <algorithm> //std::min,max,swap
+using std::min;
+using std::max;
+using std::swap;
+
+
+// ------------------- ARRAY_LENGTH -------------------
+
+//staromodne makro, niezabezpieczone przed uzyciem wskaznika w roli "x"
+//#define ARRAY_LENGTH(x) (sizeof(x)/sizeof((x)[0]))
+
+//hakerskie makro ktore wykrywa czesc pomy³kowych przypadkow uzycia
+//#define ARRAY_LENGTH(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
+
+//szablonowa funkcja pisana przez sredniozaawansowanych, jak to funkcja - nie daje niestety sta³ej w czasie kompilacji
+//template<typename T, std::size_t N> inline std::size_t ARRAY_LENGTH( T(&)[N] ) { return N; } //"constexpr" dopiero w C++0x
+
+//szablony hakerskie: tablica bajtow o dlugosci N - tak dluga jak tablica o któr¹ pytamy...
+template <typename T, std::size_t N>
+char (&array_temp(T (&a)[N]))[N];
+
+// As litb noted in comments, you need this overload to handle array rvalues
+// correctly (e.g. when array is a member of a struct returned from function),
+// since they won't bind to non-const reference in the overload above.
+template <typename T, std::size_t N>
+char (&array_temp(const T (&a)[N]))[N];
+
+//...ktor¹ mozna potem uzyc normalnie w sizeof i dzieki temu mamy const w compile-time. tak uzyteczne jak staromodne makro ale z pelna kontrola bledow
+#define ARRAY_LENGTH(x) sizeof(array_temp(x))
+
+
+#endif
+
