Changeset 319
- Timestamp:
- 02/01/15 01:08:50 (10 years ago)
- Location:
- cpp
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/stl-util.cpp
r286 r319 21 21 { 22 22 string s; //clang crashed when this declaration was in s=buf 23 longsize = 256;23 int size = 256; 24 24 char* buf; 25 25 va_list ap_copy; // "va_list ap" can only by used once by printf-type functions as they advance the current argument pointer (crashed on linux x86_64) … … 151 151 string stripExt(const string& filename) 152 152 { 153 int dot = filename.rfind('.');153 size_t dot = filename.rfind('.'); 154 154 if (dot == string::npos) return filename; 155 int sep = filename.rfind(PATH_SEPARATOR_CHAR);155 size_t sep = filename.rfind(PATH_SEPARATOR_CHAR); 156 156 if ((sep == string::npos) || (sep < dot)) 157 157 return filename.substr(0, dot); … … 161 161 string getFileExt(const string& filename) 162 162 { 163 int dot = filename.rfind('.');163 size_t dot = filename.rfind('.'); 164 164 if (dot == string::npos) return string(""); 165 int sep = filename.rfind(PATH_SEPARATOR_CHAR);165 size_t sep = filename.rfind(PATH_SEPARATOR_CHAR); 166 166 if ((sep == string::npos) || (sep < dot)) 167 167 return filename.substr(dot); … … 171 171 string getFileDir(const string& filename) 172 172 { 173 int slash = filename.rfind(PATH_SEPARATOR_CHAR);173 size_t slash = filename.rfind(PATH_SEPARATOR_CHAR); 174 174 if (slash == string::npos) return string(""); 175 175 return filename.substr(0, slash); -
cpp/frams/_demos/genooper_test_fTest.cpp
r286 r319 15 15 { 16 16 int _method; //unused 17 int result =gft.mutate(g, chg, _method);17 /*int result = */gft.mutate(g, chg, _method); 18 18 printf("%s [mutated %.1f%%]\n", g, chg * 100); 19 19 } -
cpp/frams/_demos/part_shapes.cpp
r286 r319 11 11 Model m; 12 12 Part *p1, *p2; 13 Joint *j;14 13 15 14 m.open(); -
cpp/frams/_demos/serial_test.cpp
r286 r319 32 32 { 33 33 case TUnknown: puts("null"); return; 34 case TInvalid: puts("invalid"); return; 34 35 case TInt: printf("int:"); break; 35 36 case TDouble: printf("double:"); break; -
cpp/frams/canvas/nn_smart_layout.cpp
r286 r319 13 13 #endif 14 14 15 #define DB(x) 15 //#define DB(x) x 16 #define DB(x) 16 17 17 18 #if DB(1)+0 … … 105 106 h = maxy - miny + 1; 106 107 map = (char*)calloc(1, w*h); 107 int i, e; 108 DB(printf("mapa bloku #%ld\n", id)); 109 for (i = 0; i < elementy.size(); i++) 110 { 111 e = elementy[i]; 108 DB(printf("mapa bloku #%d\n", id)); 109 for (size_t i = 0; i < elementy.size(); i++) 110 { 111 int e = elementy[i]; 112 112 map[w*(einfo[e].y - miny) + (einfo[e].x - minx)] = 1; 113 113 } 114 DB(for (i = 0; i < h; i++){ for (e = 0; e < w; e++)printf("%c", map[w*i + e] ? '*' : '.'); printf("\n"); })114 DB(for (int i = 0; i < h; i++){ for (int e = 0; e < w; e++)printf("%c", map[w*i + e] ? '*' : '.'); printf("\n"); }) 115 115 } 116 116 … … 154 154 { // return 1 if successful 155 155 if (!moznadolaczyc(b, b2, dx, dy)) return 0; // merging causes no collision 156 DB(printf("#% ld(%ld,%ld,%ld,%ld) + #%ld(%ld,%ld,%ld,%ld)<%ld,%ld>", b->id, b->minx, b->miny, b->maxx, b->maxy, b2->id, b2->minx, b2->miny, b2->maxx, b2->maxy, dx, dy));156 DB(printf("#%d(%d,%d,%d,%d) + #%d(%d,%d,%d,%d)<%d,%d>", b->id, b->minx, b->miny, b->maxx, b->maxy, b2->id, b2->minx, b2->miny, b2->maxx, b2->maxy, dx, dy)); 157 157 158 158 b->zwolnijmape(); 159 int i, e; 160 for (i = 0; i < b2->elementy.size(); i++) 161 { 162 e = b2->elementy[i]; 159 for (size_t i = 0; i < b2->elementy.size(); i++) 160 { 161 int e = b2->elementy[i]; 163 162 b->dodajelement(e, einfo[e].x + dx, einfo[e].y + dy); 164 163 } … … 168 167 b->maxy = max(b->maxy, dy + b2->maxy); 169 168 170 DB(printf(" -> (%ld,%ld,%ld,%ld)\n", b->minx, b->miny, b->maxx, b->maxy)); 171 172 DB(printf(" ...#%ld...(%ld)...", b->id, b->elementy.size())); 173 for (i = 0; i < b->elementy.size(); i++) 174 { 175 e = b->elementy[i]; 176 DB(assert(einfo[e].x >= b->minx);) 177 DB(assert(einfo[e].x <= b->maxx);) 178 DB(assert(einfo[e].y >= b->miny);) 179 DB(assert(einfo[e].y <= b->maxy);) 180 DB(printf("(%ld)%ld,%ld ", e, einfo[e].x, einfo[e].y)); 181 } 182 183 DB(printf("\n")); 169 DB( 170 printf(" -> (%d,%d,%d,%d)\n", b->minx, b->miny, b->maxx, b->maxy); 171 172 printf(" ...#%d...(%d)...", b->id, b->elementy.size()); 173 for (size_t i = 0; i < b->elementy.size(); i++) 174 { 175 int e = b->elementy[i]; 176 assert(einfo[e].x >= b->minx); 177 assert(einfo[e].x <= b->maxx); 178 assert(einfo[e].y >= b->miny); 179 assert(einfo[e].y <= b->maxy); 180 printf("(%d)%d,%d ", e, einfo[e].x, einfo[e].y); 181 } 182 183 printf("\n") 184 ); 184 185 185 186 delete b2; … … 205 206 dx = einfo[e].x - einfo[e2].x; 206 207 dy = einfo[e].y - einfo[e2].y; 207 DB(printf(" elem.% ld (%ld,%ld@%ld) + elem.%ld (%ld,%ld@%ld)...\n", e, einfo[e].x, einfo[e].y, b->id, e2, einfo[e2].x, einfo[e2].y, b2->id));208 DB(printf(" elem.%d (%d,%d@%d) + elem.%d (%d,%d@%d)...\n", e, einfo[e].x, einfo[e].y, b->id, e2, einfo[e2].x, einfo[e2].y, b2->id)); 208 209 if (dolaczblock(b, b2, dx - 1, dy)) return; 209 210 int proba; // retry - increasing the y offset (keeps x offset at -1) … … 222 223 if (einfo[e].block) 223 224 { 224 DB(printf("block#% ld exists\n", e));225 DB(printf("block#%d exists\n", e)); 225 226 return; 226 227 } … … 312 313 { 313 314 DB(printf(" - - setting coordinates - -\n")); 314 int i;315 315 DB(first->odtworzmape()); 316 for ( i = 0; i < first->elementy.size(); i++)316 for (size_t i = 0; i < first->elementy.size(); i++) 317 317 { 318 318 el = first->elementy[i]; -
cpp/frams/genetics/f1/conv_f1.cpp
r286 r319 18 18 { 19 19 public: 20 Builder(const char*g,int mapping=0):invalid(0),genbegin(g),usemapping(mapping), energ(0),energ_div(0),first_part_mapping(NULL) {}20 Builder(const char*g,int mapping=0):invalid(0),genbegin(g),usemapping(mapping),first_part_mapping(NULL),energ(0),energ_div(0) {} 21 21 ~Builder() {SAFEDELETE(first_part_mapping);} 22 22 char tmp[222]; -
cpp/frams/genetics/f9/conv_f9.cpp
r286 r319 91 91 int GenoConv_f90::findVertexAt(vector<XYZ_LOC> &vertices, const XYZ_LOC &vertex) 92 92 { 93 for ( int i = 0; i < vertices.size(); i++)93 for (size_t i = 0; i < vertices.size(); i++) 94 94 if (vertices[i].same_coordinates(vertex)) return i; 95 95 return -1; -
cpp/frams/genetics/f9/oper_f9.cpp
r286 r319 30 30 if (!gene[0]) return 1; //empty is not valid 31 31 bool ok = true; 32 int i;32 size_t i; 33 33 for (i = 0; i < strlen(gene); i++) if (!strchr(turtle_commands_f9, gene[i])) { ok = false; break; } 34 34 return ok ? GENOPER_OK : i + 1; … … 39 39 { 40 40 SString validated; //new genotype (everything except turtle_commands_f9 is skipped) 41 for ( int i = 0; i < strlen(gene); i++)41 for (size_t i = 0; i < strlen(gene); i++) 42 42 if (strchr(turtle_commands_f9, gene[i])) validated += gene[i]; //validated contains only turtle_commands_f9 43 43 free(gene); -
cpp/frams/genetics/fF/conv_fF.cpp
r286 r319 104 104 double pcx = chambers[which - 1]->centerX; 105 105 double pcy = chambers[which - 1]->centerY; 106 double pcz = chambers[which - 1]->centerZ;106 //double pcz = chambers[which - 1]->centerZ; //not used 107 107 108 108 /* aperture of the next to last chamber */ 109 109 double ppx; 110 110 double ppy; 111 double ppz;111 //double ppz; //not used 112 112 113 113 if (which == 1) … … 115 115 ppx = pcx; 116 116 ppy = pcy; 117 ppz = pcz;117 //ppz = pcz; 118 118 } 119 119 else … … 121 121 ppx = chambers[which - 2]->holeX; 122 122 ppy = chambers[which - 2]->holeY; 123 ppz = chambers[which - 2]->holeZ;123 //ppz = chambers[which - 2]->holeZ; 124 124 } 125 125 -
cpp/frams/genetics/fT/oper_fTest.cpp
r286 r319 65 65 if (!gene[0]) return 1; //empty is not valid 66 66 bool ok = true; 67 int i;67 size_t i; 68 68 for (i = 0; i < strlen(gene); i++) if (!strchr("ATGC", gene[i])) { ok = false; break; } 69 69 return ok ? GENOPER_OK : i + 1; … … 74 74 { 75 75 SString validated; //new genotype (everything except ATGC is skipped) 76 for ( int i = 0; i < strlen(gene); i++)76 for (size_t i = 0; i < strlen(gene); i++) 77 77 if (strchr("ATGC", gene[i])) validated += gene[i]; //validated contains only ATGC 78 78 free(gene); -
cpp/frams/genetics/genman.cpp
r286 r319 101 101 GenMan::GenMan() : localpar(GMparam_tab, this), localstats(GMstats_tab, this), 102 102 seloperpar("GenOperators", "Genetics: Active operators"), 103 par("GenMan", "Manages various genetic operations, using appropriate operators for the argument genotype format."),104 neuronsparam("Genetics: Neurons to add", "neuronsAdd", "neuadd_")103 neuronsparam("Genetics: Neurons to add", "neuronsAdd", "neuadd_"), 104 par("GenMan", "Manages various genetic operations, using appropriate operators for the argument genotype format.") 105 105 { 106 106 history = 0; -
cpp/frams/model/model.cpp
r286 r319 1325 1325 if ((oj2->part1==op)||(oj2->part2==op)) 1326 1326 { 1327 Joint *newj=addNewJoint(getPart(j),getPart(j2),Joint::SHAPE_SOLID);1327 addNewJoint(getPart(j),getPart(j2),Joint::SHAPE_SOLID); 1328 1328 } 1329 1329 } -
cpp/frams/param/param.h
r316 r319 60 60 { 61 61 public: 62 virtual ~ParamInterface() {} 63 62 64 virtual int getGroupCount() = 0; ///< @return the number of property groups 63 65 virtual int getPropCount() = 0; ///< @return the number of properties -
cpp/frams/util/sstringutils.cpp
r286 r319 298 298 SString before = pattern.substr(0, aster); 299 299 SString after = pattern.substr(aster + 1); 300 int pos = 0;301 300 if (!word.len()) return false; 302 301 if (before.len()) if (!word.startsWith(before)) return false;
Note: See TracChangeset
for help on using the changeset viewer.