Changeset 82
- Timestamp:
- 02/08/13 03:44:31 (12 years ago)
- Location:
- cpp/gdk
- Files:
-
- 5 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/gdk/defassign.m4
r66 r82 12 12 define(`ENDCLASS',`dnl') 13 13 define(`CLASS',`ifelse($2,USECLASS, 14 `// default assignments for $1 : define(`PROP',`ifelse($'8`,,`dnl', $'9`=MAYBE_QUOTE($'5`,$'8`));')dnl'14 `// default assignments for $1 : define(`PROP',`ifelse($'8`,,`dnl',ifelse($'10`,,$'9`=MAYBE_QUOTE($'5`,$'8`);))')dnl' 15 15 , 16 16 `define(`PROP',`dnl')dnl' -
cpp/gdk/extvalue.cpp
r74 r82 196 196 double d=ddata(); 197 197 d/=src.getDouble(); 198 #ifdef IPHONE 199 if (!isinf(d)) 200 #else 198 201 if (finite(d)) 202 #endif 199 203 ddata()=d; 200 204 else -
cpp/gdk/framsg.cpp
r66 r82 1 // This file is a part of the Framsticks GDK library. 2 // Copyright (C) 2002-2011 Szymon Ulatowski. See LICENSE.txt for details. 3 // Refer to http://www.framsticks.com/ for further information. 1 #include "framsg.h" 2 #include "nonstd_stdio.h" 4 3 5 #include "nonstd.h" 6 #include "framsg.h" 7 #include <stdio.h> 4 #ifdef SHP 5 #include <FBaseSys.h> //AppLog 6 #endif 7 8 #ifdef MOBILE2D 9 #include <Winbase.h> 10 #include "Util.h" 11 #endif 12 13 static const char *warn="[warn] "; 14 static const char *err="[ERROR] "; 15 16 /* TODO integracja z error managerem 17 void FramMessage(const char *o,const char *m,const char *bl,int w) 18 { 19 const char *lvl=""; 20 if (w==1) lvl=warn; else if (w>1) lvl=err; 21 #ifdef SHP 22 //jesli chcemy zeby nawet w trybie release wysylal komunikaty: 23 //#define AppLog(...) __App_info(__PRETTY_FUNCTION__ , __LINE__, __VA_ARGS__) 24 AppLog("%s%s::%s - %s\n",lvl,o,m,bl); 25 #elif defined MOBILE2D 26 char buf[1000]; 27 sprintf(buf,"%s%s::%s - %s\n",lvl,o,m,bl); 28 OutputDebugString(Util::strTOwstr(buf).c_str()); 29 #else 30 fprintf(w>0?stderr:stdout,"%s%s::%s - %s\n",lvl,o,m,bl); 31 #endif 32 } 33 */ 8 34 9 35 void FMprintf(const char *o,const char *m,int w,const char *bl, ...) … … 12 38 va_list argptr; 13 39 va_start(argptr,bl); 14 15 40 vsnprintf(buf,10000,bl,argptr); 41 va_end(argptr); 16 42 FramMessage(o,m,buf,w); 17 43 } … … 23 49 FramMessage(o,m,buf,w); 24 50 } 51 52 void FMprintf(const char *bl,...) 53 { 54 va_list argptr; 55 va_start(argptr,bl); 56 FMprintf("Message","printf",0,bl,argptr); 57 va_end(argptr); 58 } -
cpp/gdk/framsg.h
r66 r82 1 // This file is a part of the Framsticks GDK library.2 // Copyright (C) 2002-2011 Szymon Ulatowski. See LICENSE.txt for details.3 // Refer to http://www.framsticks.com/ for further information.4 5 1 #ifndef _FRAMSG_H_ 6 2 #define _FRAMSG_H_ … … 10 6 void FMprintf(const char *o,const char *m,int w,const char *bl, ...); 11 7 void FMprintf(const char *o,const char *m,int w,const char *bl,va_list va); 8 void FMprintf(const char *bl,...); //dla leniwych - zastepuje printf 12 9 void FramMessage(const char *o,const char *m,const char *bl,int w); 13 10 -
cpp/gdk/gen-config.h
r66 r82 8 8 USE_GENCONV_xxx - configure converters 9 9 USE_GENMAN_xxx - configure genman 10 */ 10 11 11 */ 12 #define BASIC_GENETICS //excludes f0-fuzzy and f8 (which is not stable for incorrect genotypes) 12 13 13 14 #define USE_GENCONV_F10 14 //#define USE_GENCONV_F21 15 //#define USE_GENCONV_F30 16 //#define USE_GENCONV_F4015 #define USE_GENCONV_F20 16 #define USE_GENCONV_F32 17 #define USE_GENCONV_F40 17 18 //#define USE_GENCONV_F41_TEST 18 19 //#define USE_GENCONV_F50 20 //#define USE_GENCONV_F60 21 #define USE_GENCONV_F70 22 #ifndef BASIC_GENETICS 23 #define USE_GENCONV_F81 24 #endif 25 #define USE_GENCONV_F90 19 26 20 //#define USE_GENMAN_F0 21 //#define USE_GENMAN_F1 22 //#define USE_GENMAN_F2 23 //#define USE_GENMAN_F3 24 //#define USE_GENMAN_F4 27 #define USE_GENMAN_F0 28 #ifndef BASIC_GENETICS 29 #define USE_GENMAN_F0FUZZY 30 #endif 31 #define USE_GENMAN_F1 32 #define USE_GENMAN_F2 33 #define USE_GENMAN_F3 34 #define USE_GENMAN_F4 25 35 //#define USE_GENMAN_F5 36 //#define USE_GENMAN_F6 37 #define USE_GENMAN_F7 38 #ifndef BASIC_GENETICS 39 #define USE_GENMAN_F8 40 #endif 41 #define USE_GENMAN_F9 42 -
cpp/gdk/genoconv.cpp
r66 r82 90 90 GenoConverter *gc; 91 91 for (converters.start();gc=(GenoConverter*)converters();) delete gc; 92 if (globalobject==this) globalobject= 0;93 } 94 95 GenoConvManager *GenoConvManager::globalobject= 0;92 if (globalobject==this) globalobject=NULL; 93 } 94 95 GenoConvManager *GenoConvManager::globalobject=NULL; 96 96 97 97 void GenoConvManager::addConverter(GenoConverter *gc) -
cpp/gdk/model.cpp
r66 r82 3 3 // Refer to http://www.framsticks.com/ for further information. 4 4 5 #include "nonstd .h"5 #include "nonstd_math.h" 6 6 #include "model.h" 7 7 #include "framsg.h" 8 8 #include "multimap.h" 9 9 #include "errmanager.h" 10 11 #include <math.h>12 10 13 11 #define FIELDSTRUCT Model … … 384 382 } 385 383 386 void Model::makeGeno(Geno &g,MultiMap *map )384 void Model::makeGeno(Geno &g,MultiMap *map,bool handle_defaults) 387 385 { 388 386 if ((buildstatus!=valid)&&(buildstatus!=building)) … … 419 417 modelparam.select(this); 420 418 gen+="m:"; 421 modelparam.save2(gen, &defaultmodel);419 modelparam.save2(gen,handle_defaults ? &defaultmodel : NULL,true,!handle_defaults); 422 420 } 423 421 … … 427 425 len=gen.len(); 428 426 gen+="p:"; 429 partparam.save2(gen, &defaultpart);427 partparam.save2(gen,handle_defaults ? &defaultpart : NULL,true,!handle_defaults); 430 428 if (map) 431 429 map->add(len,gen.len()-1,partToMap(i)); … … 437 435 jointparam.setParamTab(j->usedelta?f0_joint_paramtab:f0_nodeltajoint_paramtab); 438 436 gen+="j:"; 439 jointparam.save2(gen, &defaultjoint);437 jointparam.save2(gen,handle_defaults ? &defaultjoint : NULL,true,!handle_defaults); 440 438 if (map) 441 439 map->add(len,gen.len()-1,jointToMap(i)); … … 446 444 len=gen.len(); 447 445 gen+="n:"; 448 neuroparam.save2(gen, &defaultneuro);446 neuroparam.save2(gen,handle_defaults ? &defaultneuro : NULL,true,!handle_defaults); 449 447 if (map) 450 448 map->add(len,gen.len()-1,neuroToMap(i)); … … 477 475 len=gen.len(); 478 476 gen+="c:"; 479 connparam.save2(gen, &defaultconn);477 connparam.save2(gen,handle_defaults ? &defaultconn : NULL,true,!handle_defaults); 480 478 if (map) 481 479 map->add(len,gen.len()-1,neuroToMap(n->refno)); -
cpp/gdk/model.h
r66 r82 6 6 #define _MODEL_H_ 7 7 8 #include "nonstd_math.h" 8 9 #include <stdlib.h> 9 #include <math.h>10 10 #include <stdio.h> 11 11 … … 109 109 /// make the model from current genotype 110 110 void build(); 111 112 /// make f0 genotype from current construction113 void makeGeno(Geno &,MultiMap *map=0);114 111 115 112 friend class NeuroNetFactory; … … 217 214 const Geno &getF0Geno(); 218 215 216 /// make f0 genotype from current construction (low level version of getF0Geno) 217 void makeGeno(Geno &,MultiMap *map=0,bool handle_defaults=true); 218 219 219 /** @return mapping from source genotype (0-based position in text) to model elements reference numbers. 220 220 the map can be empty if the mapping hasn't been requested earlier (in constructor) -
cpp/gdk/multirange.cpp
r66 r82 4 4 5 5 #include "multirange.h" 6 #include "nonstd_stl.h" 6 7 7 8 #include <stdio.h> -
cpp/gdk/neuroimpl-channels.cpp
r66 r82 4 4 5 5 #include "neuroimpl-channels.h" 6 #include "nonstd_stl.h" 6 7 7 8 void NI_Channelize::go() -
cpp/gdk/neuroimpl-fuzzy-f0.cpp
r66 r82 7 7 8 8 #include "neuroimpl-fuzzy-f0.h" 9 // nonstd z powodu max() 10 #include "nonstd.h" 9 #include "nonstd_stl.h" //min,max 11 10 12 11 //this part concerns fuzzy sets transformation -
cpp/gdk/neuroimpl-fuzzy.cpp
r66 r82 5 5 #include "neuroimpl-fuzzy.h" 6 6 #include "neuroimpl-fuzzy-f0.h" 7 #include "nonstd_stl.h" //min,max 7 8 8 9 int NI_FuzzyNeuro::countOuts(const Model *m, const Neuro *fuzzy) -
cpp/gdk/nonstd.h
r69 r82 1 //Define rnd01, rnd0N, and randomN so that they 2 //work in your C++ environment. 3 //Some other functions/macros may also be needed if they 4 //are missing in your environment, like min, max, etc. 1 #ifndef _NONSTD_H_ 2 #define _NONSTD_H_ 5 3 6 #ifndef __NONSTD_H7 #define __NONSTD_H8 9 #define APPLICATION_NAME "Framsticks"10 #define MAIN_FRAMSTICKS11 4 #define SAFEDELETE(p) {if (p) {delete p; p=NULL;}} 12 5 #define SAFEDELETEARRAY(p) {if (p) {delete[] p; p=NULL;}} 13 6 14 //#ifndef _Windows included below? 15 //#include <stdlib.h> 16 //#endif 7 #define roundToInt(x) ((int)(floor((x)+0.5))) 8 9 10 #define CPP_STR(s) CPP_XSTR(s) 11 #define CPP_XSTR(s) #s 12 17 13 18 14 #define DB(x) //output debug info. If needed, use #define DB(x) x 19 15 //#define DB(x) x 20 16 17 21 18 // ms visual c++ 22 19 #ifdef _MSC_VER 23 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 24 #include <windows.h> 25 #include <stdio.h> 26 #include <stdarg.h> 20 #include <stdio.h> //musi byc najpierw ten include zeby robic definy ponizej (albo bedzie '_vsnprintf': attributes inconsistent with previous declaration, stdio.h:358) 27 21 #define vsnprintf _vsnprintf 28 #define _USE_MATH_DEFINES //after this is defined, the next #include <math.h> or <cmath> will define: 29 //#ifndef M_PI 30 //#define M_PI 3.1415926535897932384626433832795 31 //#endif 32 //#ifndef M_PI_2 33 //#define M_PI_2 (M_PI/2) 34 //#endif 22 #define snprintf _snprintf 23 #endif 35 24 25 #ifdef MOBILE2D 26 #define strdup _strdup 36 27 #endif 37 28 38 29 /////////////////////////////////////////////////////// 64-bit int type and other macros 39 #ifdef _W indows30 #ifdef _WIN32 40 31 typedef __int64 LONGLONG; 41 #define PATH SEPARATORCHAR '\\'42 #define PATH SEPARATORSTRING "\\"32 #define PATH_SEPARATOR_CHAR '\\' 33 #define PATH_SEPARATOR_STRING "\\" 43 34 #define FPU_THROWS_EXCEPTIONS 44 35 #define FOPEN_READ "rt" … … 47 38 #else 48 39 #define LONGLONG long long int 49 #define PATH SEPARATORCHAR '/'50 #define PATH SEPARATORSTRING "/"40 #define PATH_SEPARATOR_CHAR '/' 41 #define PATH_SEPARATOR_STRING "/" 51 42 #define FOPEN_READ "r" 52 43 #define FOPEN_WRITE "w" … … 54 45 #endif 55 46 56 #ifdef __BORLANDC__57 #define fileExists(f) (!access(f,0))58 #include "stdlib.h" //random59 #define rnd01 ((double)((double)_lrand()/(double)(LRAND_MAX+1)))60 //#define rnd01 ((double)((double)rand()/(RAND_MAX+1)))61 #define rnd0N(num) ((double)((num)*rnd01))62 #define randomN(num) random(num) //uses _lrand63 #else64 #ifdef _MSC_VER65 #define fileExists(f) (!access(f,0))66 #else67 #define fileExists(f) (!access(f,R_OK))68 #endif69 47 70 //#define FLOATRAND 71 #ifdef FLOATRAND 72 #define randomN(x) ((int)((x)*drand48())) 73 #define rnd01 (drand48()) 74 #define rnd0N(x) (drand48()*(x)) 75 #else 76 #define rnd01 ((double)(rand()/(RAND_MAX+1.0))) 77 #define rnd0N(x) ((x)*rnd01) 78 #define randomN(x) ((int)rnd0N(x)) 79 #endif 48 49 #ifdef LINUX 50 #include <strings.h> 51 #define stricmp(a,b) strcasecmp(a,b) 52 #define _isnan(a) isnan(a) //do nonstd_math.h? 53 #define GET_APP_HOME "./" 54 #define GET_APP_RESOURCES "./" 80 55 #endif 81 56 82 83 #ifdef __GNUC__ 84 /* 85 #define min(a,b) (((a)>(b))?(b):(a)) 86 #define max(a,b) (((a)>(b))?(a):(b)) 87 #define abs(a) ((a)>=0?(a):-(a)) 88 */ 89 #include <algorithm> 90 using namespace std; 57 #ifdef IPHONE 58 #include <string> 59 #define _isnan(a) isnan(a) //do nonstd_math.h? 60 std::string getAppHome(); //w tym pliku deklaracja funkcji nie pasuje... 61 std::string getAppResources(); 62 #define GET_APP_HOME getAppHome() 63 #define GET_APP_RESOURCES getAppResources() 91 64 #endif 92 65 93 #ifdef DEFINE_STRICMP_AS_STRCASECMP 94 #define stricmp(a,b) strcasecmp(a,b) 66 #ifdef SHP 67 //#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" 68 #define GET_APP_HOME "/Home/" 69 #define GET_APP_RESOURCES "/Res/" 95 70 #endif 96 71 72 #if defined(_WIN32) && !defined(SHP) 73 #define GET_APP_HOME ".\\" 74 #define GET_APP_RESOURCES ".\\" 97 75 #endif 76 77 //typedef unsigned char boolean; //niestety nie mozna uzyc 'bool' bo VC w rpcndr.h wlasnie tak definiuje booleana, jako unsigned char 78 //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. 79 80 #endif
Note: See TracChangeset
for help on using the changeset viewer.