- Timestamp:
- 04/09/15 23:51:28 (10 years ago)
- Location:
- cpp/frams
- Files:
-
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/_demos/f0_variants_test.cpp
r286 r348 79 79 DefaultGenoConvManager gcm; 80 80 gcm.addDefaultConverters(); 81 Geno::useConverters( gcm);81 Geno::useConverters(&gcm); 82 82 83 Geno::Validators validators; 84 Geno::useValidators(&validators); 83 85 ModelGenoValidator model_validator; 84 Geno::addValidator(&model_validator); //This simple validator handles all cases where a converter for a particular format is available but there is no genetic operator. Converters may be less strict in detecting invalid genotypes but it is better than nothing86 validators+=&model_validator; //This simple validator handles all cases where a converter for a particular format is available but there is no genetic operator. Converters may be less strict in detecting invalid genotypes but it is better than nothing 85 87 86 88 SString gen(argc>1?argv[1]:"X[|G:1.23]"); 87 if (!strcmp(gen ,"-"))89 if (!strcmp(gen.c_str(),"-")) 88 90 { 89 91 gen=0; … … 92 94 } 93 95 Geno g(gen); 94 printf("\nSource genotype: '%s'\n", (const char*)g.getGene());96 printf("\nSource genotype: '%s'\n",g.getGene().c_str()); 95 97 printf(" ( format %c %s)\n", 96 g.getFormat(), (const char*)g.getComment());98 g.getFormat(), g.getComment().c_str()); 97 99 98 100 Model m(g);//.getConverted('0')); … … 112 114 save_as_f0(f0_no_skipping_defaults,m,false); 113 115 114 printf("\n==== with defdata (skips default values) ======\n%s\n", (const char*)f0_skipping_defaults);115 printf("\n==== without defdata (saves all fields) ======\n%s\n", (const char*)f0_no_skipping_defaults);116 printf("\n==== with defdata (skips default values) ======\n%s\n",f0_skipping_defaults.c_str()); 117 printf("\n==== without defdata (saves all fields) ======\n%s\n",f0_no_skipping_defaults.c_str()); 116 118 117 119 return 0; -
cpp/frams/_demos/full_props.cpp
r286 r348 97 97 Geno f0_g; 98 98 m.makeGeno(f0_g,NULL,reverse);//third arg is "handle_defaults" == whether f0 should omit default property values 99 puts( (const char*)f0_g.toString());99 puts(f0_g.toString().c_str()); 100 100 101 101 return 0; -
cpp/frams/_demos/geno_test.cpp
r286 r348 24 24 } 25 25 SString gen(argv[1]); 26 if (!strcmp(gen ,"-"))26 if (!strcmp(gen.c_str(),"-")) 27 27 { 28 28 gen=0; -
cpp/frams/_demos/genoconv_test.cpp
r286 r348 77 77 { 78 78 SString dst; 79 const char* src=in ;79 const char* src=in.c_str(); 80 80 const char* t; 81 81 int insideneuron=0; … … 112 112 { 113 113 printf("Genotype:\n%s\nFormat: %c\nValid: %s\nComment: %s\n", 114 (const char*)g.getGene(),g.getFormat(),g.isValid()?"yes":"no",(const char*)g.getComment());114 g.getGene().c_str(),g.getFormat(),g.isValid()?"yes":"no",g.getComment().c_str()); 115 115 } 116 116 … … 124 124 gcm.addConverter(new GenoConv_Test2()); 125 125 gcm.addConverter(new GenoConv_Test3()); 126 Geno::useConverters( gcm);126 Geno::useConverters(&gcm); 127 127 128 Geno::Validators validators; 128 129 ModelGenoValidator model_validator; 129 Geno::addValidator(&model_validator); 130 validators+=&model_validator; 131 Geno::useValidators(&validators); 130 132 131 133 const char* src=(argc>1)?argv[1]:"X"; -
cpp/frams/_demos/genomanipulation.cpp
r291 r348 34 34 const char* type=pi.type(i); 35 35 if (*type=='p') continue; 36 printf("%2d. %8s = %-20s %-3s %-10s %-10s\n",i,pi.id(i), (const char*)pi.get(i),pi.type(i),pi.name(i),pi.grname(pi.group(i)));36 printf("%2d. %8s = %-20s %-3s %-10s %-10s\n",i,pi.id(i),pi.get(i).c_str(),pi.type(i),pi.name(i),pi.grname(pi.group(i))); 37 37 } 38 38 } … … 47 47 pi.getMinMax(i,minprop,maxprop,def); 48 48 printf(" Change property #%d to random value from range [%g..%g]\n",i,minprop,maxprop); 49 printf(" Current value of '%s' (%s) is '%s'\n",pi.id(i),pi.name(i), (const char*)pi.get(i));49 printf(" Current value of '%s' (%s) is '%s'\n",pi.id(i),pi.name(i),pi.get(i).c_str()); 50 50 char t[100]; 51 51 sprintf(t,"%g",minprop+(rnd01)*(maxprop-minprop)); 52 52 printf(" Setting new value... [ using ParamInterface::set() ]\n"); 53 53 pi.set(i,t); 54 printf(" The value is now '%s'\n", (const char*)pi.get(i));54 printf(" The value is now '%s'\n",pi.get(i).c_str()); 55 55 } 56 56 … … 79 79 CHANGE_ONE_PROPERTY(p->extraProperties()); 80 80 p->getModel().close(); 81 printf("\nLet's see f0... (check out part #%d !)\n\n%s\n", p->refno, (const char*)p->getModel().getF0Geno().getGene());81 printf("\nLet's see f0... (check out part #%d !)\n\n%s\n", p->refno, p->getModel().getF0Geno().getGene().c_str()); 82 82 } 83 83 … … 91 91 j->getModel().close(); 92 92 printf("The Part's position is changed, but everything else stays intact:\n\n%s\n", 93 (const char*)j->getModel().getF0Geno().getGene());93 j->getModel().getF0Geno().getGene().c_str()); 94 94 } 95 95 … … 104 104 j->getModel().close(); 105 105 printf("Position of the second Part referenced by this joint (part #%d) is now changed:\n\n%s\n", 106 j->part2->refno, (const char*)j->getModel().getF0Geno().getGene());106 j->part2->refno, j->getModel().getF0Geno().getGene().c_str()); 107 107 printf("If no delta fields are defined, they will be computed automatically.\n" 108 108 "You can always delete existing delta values by using Joint::resetDelta().\n" … … 112 112 j->resetDelta(); 113 113 j->getModel().close(); 114 printf("As you can see, Joint's delta fields have altered:\n\n%s\n", (const char*)j->getModel().getF0Geno().getGene());114 printf("As you can see, Joint's delta fields have altered:\n\n%s\n", j->getModel().getF0Geno().getGene().c_str()); 115 115 } 116 116 … … 123 123 j->getModel().close(); 124 124 printf("f0 is now:\n\n%s\n...so this is %s joint.\n", 125 (const char*)j->getModel().getF0Geno().getGene(), option?"a delta":"an absolute");125 j->getModel().getF0Geno().getGene().c_str(), option?"a delta":"an absolute"); 126 126 127 127 } … … 155 155 CHANGE_ONE_PROPERTY(j->extraProperties()); 156 156 j->getModel().close(); 157 printf("And after that we have this genotype:\n\n%s\n", (const char*)j->getModel().getF0Geno().getGene());157 printf("And after that we have this genotype:\n\n%s\n", j->getModel().getF0Geno().getGene().c_str()); 158 158 } 159 159 … … 178 178 printf("\nThe most unusual thing is 'details' field (d).\n" 179 179 "It is something like separate object with its own set of properties.\n" 180 "Currently the value of 'd' is '%s'.\n", (const char*)n->getDetails());180 "Currently the value of 'd' is '%s'.\n",n->getDetails().c_str()); 181 181 182 182 { 183 183 NeuroClass* cl=n->getClass(); 184 184 if (!cl) 185 printf("It should contain the class name but the meaning of '%s' is unknown\n", (const char*)n->getDetails());185 printf("It should contain the class name but the meaning of '%s' is unknown\n",n->getDetails().c_str()); 186 186 else 187 187 { 188 188 189 189 printf("'%s' is the class name (Neuro::getClassName() == '%s') and means '%s'.\n", 190 (const char*)cl->getName(),(const char*)cl->getName(),(const char*)cl->getLongName());190 cl->getName().c_str(),cl->getName().c_str(),cl->getLongName().c_str()); 191 191 printf("Neuro::getClass() gives you information about basic characteristic\n" 192 192 "of the class, that can be analyzed automatically.\n"); … … 208 208 p.update(); 209 209 n->getModel().close(); 210 printf("After that, 'details' contains the new object: '%s'.\n", (const char*)n->getDetails());210 printf("After that, 'details' contains the new object: '%s'.\n",n->getDetails().c_str()); 211 211 } 212 212 else … … 224 224 NeuroClass* cl=n->getClass(i); 225 225 Param p=cl->getProperties(); 226 printf("%2d.%6s %-20s %2d\n",i, (const char*)cl->getName(),(const char*)cl->getLongName(),p.getPropCount());226 printf("%2d.%6s %-20s %2d\n",i,cl->getName().c_str(),cl->getLongName().c_str(),p.getPropCount()); 227 227 } 228 228 int cl=rand() % n->getClassCount(); 229 printf("\nLet's change the Neuro's class to '%s'...\n", (const char*)n->getClassName(cl));229 printf("\nLet's change the Neuro's class to '%s'...\n",n->getClassName(cl).c_str()); 230 230 n->getModel().open(); 231 231 n->setClass(n->getClass(cl)); … … 242 242 if (n->getInputCount()>0) 243 243 { 244 printf("Info for input #0 = \"%s\"\n", (const char*)n->getInputInfo(0));245 printf("Info for input #0, field \"%s\" = \"%s\"\n", "abc", (const char*)n->getInputInfo(0,"abc"));244 printf("Info for input #0 = \"%s\"\n",n->getInputInfo(0).c_str()); 245 printf("Info for input #0, field \"%s\" = \"%s\"\n", "abc", n->getInputInfo(0,"abc").c_str()); 246 246 n->setInputInfo(0,"test",44); 247 247 n->setInputInfo(0,"abc","yeah"); … … 250 250 n->getModel().close(); 251 251 printf("The final object description will be then: '%s'\nAnd the full f0 genotype:\n\n%s\n", 252 (const char*)n->getDetails(), (const char*)n->getModel().getF0Geno().getGene());252 n->getDetails().c_str(), n->getModel().getF0Geno().getGene().c_str()); 253 253 254 254 … … 257 257 void findingConverters() 258 258 { 259 GenoConverter *gc=Geno::getConverters() .findConverters(0,'1');259 GenoConverter *gc=Geno::getConverters()->findConverters(0,'1'); 260 260 if (gc) printf("found converter accepting f1: \"%s\"\n",gc->name); 261 261 SListTempl<GenoConverter*> found; 262 Geno::getConverters() .findConverters(&found,-1,'0');262 Geno::getConverters()->findConverters(&found,-1,'0'); 263 263 printf("found %d converter(s) producing f0\n",found.size()); 264 264 } … … 274 274 275 275 SString gen(argc>1?argv[1]:"X[|G:1.23]"); 276 if (!strcmp(gen ,"-"))276 if (!strcmp(gen.c_str(),"-")) 277 277 { 278 278 gen=0; … … 281 281 } 282 282 Geno g(gen); 283 printf("\nSource genotype: '%s'\n", (const char*)g.getGene());283 printf("\nSource genotype: '%s'\n",g.getGene().c_str()); 284 284 printf(" ( format %c %s)\n", 285 g.getFormat(), (const char*)g.getComment());285 g.getFormat(), g.getComment().c_str()); 286 286 287 287 Model m(g);//.getConverted('0')); … … 292 292 return 2; 293 293 } 294 printf("Converted to f0:\n%s\n", (const char*)m.getF0Geno().getGene());294 printf("Converted to f0:\n%s\n",m.getF0Geno().getGene().c_str()); 295 295 296 296 printf("Model contains: %d part(s)\n" … … 340 340 NeuroItem *ni=n->getNeuroItem(j); 341 341 printf(" item #%d - '%s', conn=%d, weight=%g\n", 342 j, (const char*)ni->getDetails(),ni->conn_refno,ni->weight);342 j,ni->getDetails().c_str(),ni->conn_refno,ni->weight); 343 343 } 344 344 } -
cpp/frams/_demos/genooper_test.cpp
r286 r348 9 9 { 10 10 printf("Genotype: %s\nFormat: %c\nValid: %s\nComment: %s\n", 11 (const char*)g.getGene(), g.getFormat(), g.isValid() ? "yes" : "no", g.getComment().len() == 0 ? "(empty)" : (const char*)g.getComment());11 g.getGene().c_str(), g.getFormat(), g.isValid() ? "yes" : "no", g.getComment().len() == 0 ? "(empty)" : g.getComment().c_str()); 12 12 } 13 13 … … 47 47 printGenAndTitle(gvalidated, "validated"); 48 48 49 printf("\nHTMLized: %s\n", (const char*)genetics.genman.HTMLize((const char*)gvalidated.getGene()));49 printf("\nHTMLized: %s\n", genetics.genman.HTMLize(gvalidated.getGene().c_str()).c_str()); 50 50 51 51 return 0; -
cpp/frams/_demos/geometry/apices_test.cpp
r286 r348 47 47 // Finishing result Model and printing its genotype. 48 48 resultModel.close(); 49 puts( (const char*)resultModel.getF0Geno().toString());49 puts(resultModel.getF0Geno().toString().c_str()); 50 50 } 51 51 -
cpp/frams/_demos/geometry/geometrytestutils.cpp
r318 r348 25 25 26 26 fprintf(stderr, "%d. (%6d chars) %s\n", count, genotype->genotype.len(), 27 (const char*)genotype->name);27 genotype->name.c_str()); 28 28 } 29 29 30 30 if (loader.getStatus() == MiniGenotypeLoader::OnError) 31 31 { 32 fprintf(stderr, "Error: %s\n", (const char*)loader.getError());32 fprintf(stderr, "Error: %s\n", loader.getError().c_str()); 33 33 return 2; 34 34 } … … 58 58 count++; 59 59 60 if ((genoIndex == count) || (strcmp( (const char*)genotype->name, genoName) == 0))60 if ((genoIndex == count) || (strcmp(genotype->name.c_str(), genoName) == 0)) 61 61 { 62 62 Model model(genotype->genotype); … … 75 75 if (loader.getStatus() == MiniGenotypeLoader::OnError) 76 76 { 77 fprintf(stderr, "Error: %s\n", (const char*)loader.getError());77 fprintf(stderr, "Error: %s\n", loader.getError().c_str()); 78 78 return 2; 79 79 } … … 156 156 "GENO_ID - either genotype name or index (1-based)\n" 157 157 "SHAPE - 1=ellipsoid, 2=cuboid, 3=cylinder, others or none=random\n", 158 (const char*)header);158 header.c_str()); 159 159 return 1; 160 160 } … … 220 220 "DENSITY - minimal number of samples per unit\n" 221 221 "SHAPE - 1=ellipsoid, 2=cuboid, 3=cylinder, others or none=random\n", 222 (const char*)header);222 header.c_str()); 223 223 return 1; 224 224 } -
cpp/frams/_demos/geometry/info_test.cpp
r286 r348 72 72 // Finishing result Model and printing its genotype. 73 73 resultModel.close(); 74 puts( (const char*)resultModel.getF0Geno().toString());74 puts(resultModel.getF0Geno().toString().c_str()); 75 75 76 76 // Printing calculated values. -
cpp/frams/_demos/geometry/surface_test.cpp
r286 r348 47 47 // Finishing result Model and printing its genotype. 48 48 resultModel.close(); 49 puts( (const char*)resultModel.getF0Geno().toString());49 puts(resultModel.getF0Geno().toString().c_str()); 50 50 } 51 51 -
cpp/frams/_demos/geometry/volume_test.cpp
r286 r348 39 39 // Finishing result Model and printing its genotype. 40 40 resultModel.close(); 41 puts( (const char*)resultModel.getF0Geno().toString());41 puts(resultModel.getF0Geno().toString().c_str()); 42 42 } 43 43 -
cpp/frams/_demos/loader_test.cpp
r299 r348 45 45 else 46 46 { 47 if (strcmp( (const char*)loaded->name,selected))47 if (strcmp(loaded->name.c_str(),selected)) 48 48 continue; 49 49 } 50 puts( (const char*)loaded->genotype);50 puts(loaded->genotype.c_str()); 51 51 return 0; 52 52 } 53 fprintf(stderr,"%d. %s\t(%d characters)\n",count, (const char*)loaded->name,loaded->genotype.len());53 fprintf(stderr,"%d. %s\t(%d characters)\n",count,loaded->name.c_str(),loaded->genotype.len()); 54 54 } 55 55 // the loop repeats until loaded==NULL, which could be beacause of error 56 56 if (loader.getStatus()==MiniGenotypeLoader::OnError) 57 fprintf(stderr,"Error: %s", (const char*)loader.getError());57 fprintf(stderr,"Error: %s",loader.getError().c_str()); 58 58 // (otherwise it was the end of the file) 59 59 if (selected) -
cpp/frams/_demos/loader_test_param.cpp
r330 r348 84 84 { 85 85 case MultiParamLoader::OnComment: 86 fprintf(stderr, "comment: '%s'\n", (const char*)loader.getComment());86 fprintf(stderr, "comment: '%s'\n", loader.getComment().c_str()); 87 87 break; 88 88 … … 92 92 // In fact, this method is used not just for truly unknown objects but also for 93 93 // dynamic objects that cannot be added using MultiParamLoader.addObject(). 94 fprintf(stderr, "unknown object found: '%s' (will be skipped)\n", (const char*)loader.getObjectName());94 fprintf(stderr, "unknown object found: '%s' (will be skipped)\n", loader.getObjectName().c_str()); 95 95 break; 96 96 … … 98 98 fprintf(stderr, "loaded:\n"); 99 99 for (int i = 0; i < param.getPropCount(); i++) 100 fprintf(stderr, "%s=%s\n", param.id(i), (const char*)param.getText(i));101 fprintf(stderr, "type of 'x1' is: %s\n", (const char*)data.x1.typeDescription());102 fprintf(stderr, "type of 'x2' is: %s\n", (const char*)data.x2.typeDescription());100 fprintf(stderr, "%s=%s\n", param.id(i), param.getText(i).c_str()); 101 fprintf(stderr, "type of 'x1' is: %s\n", data.x1.typeDescription().c_str()); 102 fprintf(stderr, "type of 'x2' is: %s\n", data.x2.typeDescription().c_str()); 103 103 fprintf(stderr, "-----\n\n"); 104 104 param.save(&virt_stdout); … … 112 112 113 113 case MultiParamLoader::OnError: 114 fprintf(stderr, "Error: %s", (const char*)loader.getError());114 fprintf(stderr, "Error: %s", loader.getError().c_str()); 115 115 } 116 116 } -
cpp/frams/_demos/multiline_f0_test.cpp
r286 r348 19 19 20 20 SString gen(argc>1?argv[1]:"X[|G:1.23]"); 21 if (!strcmp(gen ,"-"))21 if (!strcmp(gen.c_str(),"-")) 22 22 { 23 23 gen=0; … … 26 26 } 27 27 Geno g(gen); 28 printf("\nSource genotype: '%s'\n", (const char*)g.getGene());28 printf("\nSource genotype: '%s'\n",g.getGene().c_str()); 29 29 printf(" ( format %c %s)\n", 30 g.getFormat(), (const char*)g.getComment());30 g.getFormat(), g.getComment().c_str()); 31 31 32 32 Model m(g);//.getConverted('0')); … … 37 37 return 2; 38 38 } 39 printf("Converted to f0:\n%s\n", (const char*)m.getF0Geno().getGene());39 printf("Converted to f0:\n%s\n",m.getF0Geno().getGene().c_str()); 40 40 41 41 printf("\nusing Param::save() to create the \"expanded\" form of the f0 genotype...\n(MultiParamLoader should be able to load this)"); … … 87 87 } 88 88 89 printf("\n============================\n%s\n", (const char*)f.getString());89 printf("\n============================\n%s\n",f.getString().c_str()); 90 90 91 91 return 0; -
cpp/frams/_demos/neuro_layout_test.cpp
r317 r348 94 94 } 95 95 SString gen(argv[1]); 96 if (!strcmp(gen ,"-"))96 if (!strcmp(gen.c_str(),"-")) 97 97 { 98 98 gen=0; … … 116 116 { 117 117 int *xywh=nn_layout.GetXYWH(i); 118 printf("#%-3d %s\t%d,%d\t%dx%d\n",i, (const char*)m.getNeuro(i)->getClassName(),118 printf("#%-3d %s\t%d,%d\t%dx%d\n",i,m.getNeuro(i)->getClassName().c_str(), 119 119 xywh[0],xywh[1],xywh[2],xywh[3]); 120 120 } … … 130 130 { 131 131 int *xywh=nn_layout.GetXYWH(i); 132 SString label=SString::sprintf("%d:%s",i, (const char*)m.getNeuro(i)->getClassName());133 screen.put(xywh[0],xywh[1], (const char*)label);132 SString label=SString::sprintf("%d:%s",i,m.getNeuro(i)->getClassName().c_str()); 133 screen.put(xywh[0],xywh[1],label.c_str()); 134 134 } 135 135 screen.print(); -
cpp/frams/_demos/neuro_test.cpp
r288 r348 69 69 } 70 70 SString gen(argv[1]); 71 if (!strcmp(gen ,"-"))71 if (!strcmp(gen.c_str(),"-")) 72 72 { 73 73 gen=0; … … 98 98 { 99 99 if (no_impl) no_impl_names+=','; 100 no_impl_names+=SString::sprintf("#%d.%s",i, (const char*)n->getClassName());100 no_impl_names+=SString::sprintf("#%d.%s",i,n->getClassName().c_str()); 101 101 no_impl++; 102 102 } … … 104 104 { 105 105 if (init_err) init_err_names+=','; 106 init_err_names+=SString::sprintf("#%d.%s",i, (const char*)n->getClassName());106 init_err_names+=SString::sprintf("#%d.%s",i,n->getClassName().c_str()); 107 107 init_err++; 108 108 } 109 109 } 110 110 printf("\n"); 111 if (no_impl) printf("%d x missing implementation (%s)\n",no_impl, (const char*)no_impl_names);112 if (init_err) printf("%d x failed initialization (%s)\n",init_err, (const char*)init_err_names);111 if (no_impl) printf("%d x missing implementation (%s)\n",no_impl,no_impl_names.c_str()); 112 if (init_err) printf("%d x failed initialization (%s)\n",init_err,init_err_names.c_str()); 113 113 } 114 114 int steps=1; … … 119 119 { 120 120 n=m.getNeuro(i); 121 printf("\t#%d.%s",i, (const char*)n->getClassName());121 printf("\t#%d.%s",i,n->getClassName().c_str()); 122 122 } 123 123 printf("\n"); -
cpp/frams/_demos/part_shapes.cpp
r319 r348 52 52 53 53 m.close(); 54 puts( (const char*)m.getF0Geno().toString());54 puts(m.getF0Geno().toString().c_str()); 55 55 // the genotype can be fed directly to the genotype viewer, like this: 56 56 // part_shapes | theater -g - -
cpp/frams/_demos/printconvmap.cpp
r286 r348 56 56 SString g2=gen2; 57 57 stripstring(g2); 58 const char* g=g1 ;58 const char* g=g1.c_str(); 59 59 y=0; 60 60 MultiRange *mr; 61 61 MultiRange emptyrange; 62 62 printN(' ',GEN1MAX); 63 printf(" %s\n", (const char*)g2);63 printf(" %s\n",g2.c_str()); 64 64 int begin=map.getBegin(); 65 65 int end=map.getEnd(); … … 83 83 if ((y2-y) > GEN1MAX) y2=y+GEN1MAX; 84 84 if (y2>(y+len1)) y2=y+len1; 85 printmapping(g+y,y2-y,*mr,g2 ,g2.len());85 printmapping(g+y,y2-y,*mr,g2.c_str(),g2.len()); 86 86 y=y2; 87 87 } -
cpp/frams/_demos/serial_test.cpp
r319 r348 60 60 { 61 61 printIndent(indent+3); 62 printf("key \"%s\"\n", (const char*)it->key);62 printf("key \"%s\"\n",it->key.c_str()); 63 63 print((ExtValue*)it->value,indent+6,&next_trace); 64 64 } … … 67 67 } 68 68 } 69 puts( (const char*)v->getString());69 puts(v->getString().c_str()); 70 70 } 71 71 -
cpp/frams/_demos/shapeconvert.cpp
r286 r348 87 87 88 88 Geno f0_g = newmodel.getF0Geno(); 89 puts( (const char*)f0_g.toString());89 puts(f0_g.toString().c_str()); 90 90 91 91 return 0; -
cpp/frams/canvas/neurodiagram.cpp
r286 r348 271 271 if (size.y > 4 * textHeight()) 272 272 { 273 const char* t = label ;273 const char* t = label.c_str(); 274 274 setColor(ColorDefs::neurosymbol); 275 275 drawAlignedText(size.x / 2, size.y - textHeight(), 0, t); … … 445 445 NeuroProbe::NeuroProbe(NeuroSymbol* ns) 446 446 :DCanvasWindow(DCanvasWindow::Title + DCanvasWindow::Border + DCanvasWindow::Close + DCanvasWindow::Size, 447 (const char*)ns->getLabel(), &neurochart, &neurochart)447 ns->getLabel().c_str(), &neurochart, &neurochart) 448 448 { 449 449 holdismine = 0; -
cpp/frams/config/version.h
r286 r348 3 3 // See LICENSE.txt for details. 4 4 5 #define MAIN_REL_ID "4. 0"5 #define MAIN_REL_ID "4.2rc1" -
cpp/frams/errmgr/stderrors.cpp
r286 r348 29 29 { 30 30 SString msg2=SString(msg)+": \"%s\" (adjusted to \"%s\")"; 31 FMprintf(msgobj,msgfun,FMLV_WARN, (const char*)msg2,(const char*)in,(const char*)corrected);31 FMprintf(msgobj,msgfun,FMLV_WARN,msg2.c_str(),in.c_str(),corrected.c_str()); 32 32 } 33 33 return corrected; -
cpp/frams/genetics/f1/conv_f1.cpp
r319 r348 102 102 SString GenoConv_f1::convert(SString &i,MultiMap *map) 103 103 { 104 const char* g= (const char*)i;104 const char* g=i.c_str(); 105 105 Builder builder(g,map?1:0); 106 106 builder.model.open(); … … 403 403 lastNeuroClassParam(); 404 404 //special handling: muscle properties (can be overwritten by subsequent property assignments) 405 if (!strcmp(cls->getName() ,"|"))405 if (!strcmp(cls->getName().c_str(),"|")) 406 406 { 407 407 neuro_cls_param->setDoubleById("p",lastjoint_muscle_power); 408 408 neuro_cls_param->setDoubleById("r",props.bendrange); 409 409 } 410 else if (!strcmp(cls->getName() ,"@"))410 else if (!strcmp(cls->getName().c_str(),"@")) 411 411 { 412 412 neuro_cls_param->setDoubleById("p",lastjoint_muscle_power); … … 485 485 SString name(begin,colon-begin); 486 486 SString value(colon+1,end-(colon+1)); 487 addClassParam(name ,value);488 } 489 } 487 addClassParam(name.c_str(),value.c_str()); 488 } 489 } -
cpp/frams/genetics/f4/f4_general.cpp
r287 r348 714 714 // transform geno from string to nodes 715 715 f4rootnode = new f4_node(); 716 res = f4_processrec( (const char*)genome, (unsigned)0, f4rootnode);716 res = f4_processrec(genome.c_str(), (unsigned)0, f4rootnode); 717 717 if ((res < 0) || (1 != f4rootnode->childCount())) 718 718 { … … 1197 1197 buf = (char*)realloc(buf, len + 1); 1198 1198 } 1199 strcpy(buf, (const char*)out);1199 strcpy(buf, out.c_str()); 1200 1200 } 1201 1201 -
cpp/frams/genetics/f9/oper_f9.cpp
r319 r348 42 42 if (strchr(turtle_commands_f9, gene[i])) validated += gene[i]; //validated contains only turtle_commands_f9 43 43 free(gene); 44 gene = strdup(validated ); //reallocate44 gene = strdup(validated.c_str()); //reallocate 45 45 return GENOPER_OK; 46 46 } … … 84 84 } 85 85 free(gene); 86 gene = strdup(newgeno ); //reallocate86 gene = strdup(newgeno.c_str()); //reallocate 87 87 } 88 88 -
cpp/frams/genetics/fF/conv_fF.cpp
r319 r348 39 39 { 40 40 fF_growth_params gp; 41 if (!gp.load(in )) //invalid input genotype?41 if (!gp.load(in.c_str())) //invalid input genotype? 42 42 return ""; //so we return an invalid f0 genotype 43 43 -
cpp/frams/genetics/fF/fF_genotype.h
r286 r348 43 43 SString tmp; 44 44 param.save2(tmp, NULL/*object containing default values for comparison*/, false/*add CR*/, false/*force field names*/); 45 return string( (const char*)tmp);45 return string(tmp.c_str()); 46 46 } 47 47 }; -
cpp/frams/genetics/fT/oper_fTest.cpp
r319 r348 77 77 if (strchr("ATGC", gene[i])) validated += gene[i]; //validated contains only ATGC 78 78 free(gene); 79 gene = strdup(validated ); //reallocate79 gene = strdup(validated.c_str()); //reallocate 80 80 return GENOPER_OK; 81 81 } -
cpp/frams/genetics/genman.cpp
r344 r348 199 199 { 200 200 SString ggs=g.getGene(); 201 const char *gg = ggs ;201 const char *gg = ggs.c_str(); 202 202 GenoOperators *gf = getOper_f(g.getFormat()); 203 203 int check1; … … 237 237 if (gf == NULL) 238 238 return Geno(SString::empty(), -1, SString::empty(), SString::sprintf("GENOPER_NOOPER: Validate(): don't know how to handle genetic format %c", format)); 239 char *g2 = strdup(geny.getGene() ); //copy for validation239 char *g2 = strdup(geny.getGene().c_str()); //copy for validation 240 240 int res = gf->validate(g2); 241 241 SString sg2 = g2; … … 263 263 while (!ok) 264 264 { 265 char *gn = strdup(gv.getGene() ); //copy for mutation265 char *gn = strdup(gv.getGene().c_str()); //copy for mutation 266 266 chg = 0; 267 267 if (gf->mutate(gn, chg, method) == GENOPER_OK) … … 284 284 if (!ok && (count - pcount > 100)) 285 285 { 286 FMprintf("GenMan", "Mutate", 2, "Tried 100x and failed: %s", (const char*)g.getGene());286 FMprintf("GenMan", "Mutate", 2, "Tried 100x and failed: %s", g.getGene().c_str()); 287 287 return Geno("", -1, "", "GENOPER_OPFAIL: Mutate() tried 100x and failed"); 288 288 } 289 289 } 290 290 mutchg += chg; 291 if (history) saveLink( (const char*)g.getGene(), "", (const char*)gv.getGene(), chg);291 if (history) saveLink(g.getGene().c_str(), "", gv.getGene().c_str(), chg); 292 292 SString mutinfo; 293 if (extmutinfo == 0) mutinfo = SString::sprintf("%.2f%% mutation of '%s'", 100 * chg, (const char*)g.getName()); else294 if (extmutinfo == 1) mutinfo = SString::sprintf("%.2f%% mutation(%d) of '%s'", 100 * chg, method, (const char*)g.getName()); else295 mutinfo = SString::sprintf("%.2f%% mutation(%s) of '%s'", 100 * chg, gf->mutation_method_names ? gf->mutation_method_names[method] : "unspecified method name", (const char*)g.getName());293 if (extmutinfo == 0) mutinfo = SString::sprintf("%.2f%% mutation of '%s'", 100 * chg, g.getName().c_str()); else 294 if (extmutinfo == 1) mutinfo = SString::sprintf("%.2f%% mutation(%d) of '%s'", 100 * chg, method, g.getName().c_str()); else 295 mutinfo = SString::sprintf("%.2f%% mutation(%s) of '%s'", 100 * chg, gf->mutation_method_names ? gf->mutation_method_names[method] : "unspecified method name", g.getName().c_str()); 296 296 gv.setComment(mutinfo); 297 297 return gv; … … 324 324 { 325 325 float chg1, chg2; 326 char *g1n = strdup(g1.getGene() ); //copy for crossover327 char *g2n = strdup(g2.getGene() ); //copy for crossover326 char *g1n = strdup(g1.getGene().c_str()); //copy for crossover 327 char *g2n = strdup(g2.getGene().c_str()); //copy for crossover 328 328 chg1 = chg2 = 0; 329 329 if (gf->crossOver(g1n, g2n, chg1, chg2) == GENOPER_OK) … … 351 351 if (!ok && (count - pcount > 100)) 352 352 { 353 FMprintf("GenMan", "CrossOver", 2, "Tried 100x and failed: %s and %s", (const char*)g1.getGene(), (const char*)g2.getGene());353 FMprintf("GenMan", "CrossOver", 2, "Tried 100x and failed: %s and %s", g1.getGene().c_str(), g2.getGene().c_str()); 354 354 return Geno("", -1, "", "GENOPER_OPFAIL: CrossOver() tried 100x and failed"); 355 355 } … … 357 357 // result in g1v 358 358 xochg += chg; 359 if (history) saveLink( (const char*)g1.getGene(), (const char*)g2.getGene(), (const char*)g1v.getGene(), chg);359 if (history) saveLink(g1.getGene().c_str(), g2.getGene().c_str(), g1v.getGene().c_str(), chg); 360 360 SString xoinfo = SString::sprintf("Crossing over of '%s' (%.2f%%) and '%s' (%.2f%%)", 361 (const char*)g1.getName(), 100 * chg, (const char*)g2.getName(), 100 * (1 - chg));361 g1.getName().c_str(), 100 * chg, g2.getName().c_str(), 100 * (1 - chg)); 362 362 g1v.setComment(xoinfo); 363 363 return g1v; … … 369 369 if (format != g2.getFormat()) return GENOPER_NOOPER; 370 370 GenoOperators *gf = getOper_f(format); 371 if (!gf) return GENOPER_NOOPER; else return gf->similarity(g1.getGene() , g2.getGene());371 if (!gf) return GENOPER_NOOPER; else return gf->similarity(g1.getGene().c_str(), g2.getGene().c_str()); 372 372 } 373 373 … … 378 378 GenoOperators *gf = getOper_f(G.getFormat()); 379 379 if (!gf) return GENSTYLE_CS(0, 0); //black & valid 380 else return gf->style(G.getGene() , pos);380 else return gf->style(G.getGene().c_str(), pos); 381 381 } 382 382 … … 391 391 if (posmapped == -1) styletab[pos] = GENSTYLE_COMMENT; 392 392 else if (!gf) styletab[pos] = GENSTYLE_CS(0, 0); //black & valid 393 else styletab[pos] = gf->style(geny , posmapped);393 else styletab[pos] = gf->style(geny.c_str(), posmapped); 394 394 } 395 395 } … … 448 448 void GenMan::p_htmlize(ExtValue *args, ExtValue *ret) 449 449 { 450 ret->setString(HTMLize(args->getString() ));450 ret->setString(HTMLize(args->getString().c_str())); 451 451 } 452 452 453 453 void GenMan::p_htmlizeshort(ExtValue *args, ExtValue *ret) 454 454 { 455 ret->setString(HTMLizeShort(args->getString() ));455 ret->setString(HTMLizeShort(args->getString().c_str())); 456 456 } 457 457 -
cpp/frams/genetics/geno.cpp
r346 r348 7 7 #include <frams/model/model.h> 8 8 9 GenoConvManager *Geno::converters = NULL; 10 11 THREAD_LOCAL_DEF(Geno::Validators, geno_validators); 12 13 Geno::Validators& Geno::getValidators() {return tlsGetRef(geno_validators);} 9 THREAD_LOCAL_DEF_PTR(Geno::Validators, geno_validators); 10 THREAD_LOCAL_DEF_PTR(GenoConvManager, geno_converters); 11 12 Geno::Validators* Geno::getValidators() {return tlsGetPtr(geno_validators);} 13 GenoConvManager* Geno::getConverters() {return tlsGetPtr(geno_converters);} 14 15 Geno::Validators* Geno::useValidators(Validators* val) 16 {return tlsSetPtr(geno_validators,val);} 17 GenoConvManager* Geno::useConverters(GenoConvManager* gcm) 18 {return tlsSetPtr(geno_converters,gcm);} 14 19 15 20 void Geno::init(const SString& genstring, char genformat, const SString& genname, const SString& comment) … … 78 83 if (!name.len()) name = genname; 79 84 if (!txt.len()) txt = comment; 80 multiline = (strchr( (const char*)gen, '\n') != 0);85 multiline = (strchr(gen.c_str(), '\n') != 0); 81 86 // mapoutshift...? 82 87 } … … 237 242 if (isvalid >= 0) return; 238 243 if (gen.len() == 0) { isvalid = 0; return; } 239 Validators& vals=getValidators(); 240 FOREACH(GenoValidator*, v, vals) 244 Validators* vals=getValidators(); 245 if (vals!=NULL) 246 { 247 FOREACH(GenoValidator*, v, (*vals)) 241 248 if ((isvalid = v->testGenoValidity(*this)) >= 0) 242 249 return; 250 } 243 251 isvalid = 0; 244 252 FMprintf("Geno", "validate", FMLV_WARN, "Wrong configuration? No genotype validators defined for genetic format f%c.", format); … … 255 263 if (otherformat == getFormat()) { if (converter_missing) *converter_missing = false; return *this; } 256 264 #ifndef NO_GENOCONVMANAGER 265 GenoConvManager *converters=getConverters(); 257 266 if (converters) 258 267 { -
cpp/frams/genetics/geno.h
r346 r348 118 118 119 119 // managing global Geno-related objects (used for validation and conversion) 120 static Validators& getValidators(); 121 static void addValidator(GenoValidator* gv,int at_position=9999) { getValidators().insert(at_position,gv); } 122 static void removeValidator(GenoValidator* gv) { getValidators() -= gv; } 123 static void useConverters(GenoConvManager& gcm) { converters = &gcm; } 124 static GenoConvManager &getConverters() { return *converters; } 125 protected: 126 static GenoConvManager *converters; 120 static Validators* useValidators(Validators* val); 121 static Validators* getValidators(); 122 123 static GenoConvManager* useConverters(GenoConvManager* gcm); 124 static GenoConvManager* getConverters(); 127 125 }; 128 126 -
cpp/frams/genetics/oper_fx.cpp
r286 r348 192 192 for (int i = 0; i<Neuro::getClassCount(); i++) 193 193 { 194 const char *n = Neuro::getClass(i)->name ;194 const char *n = Neuro::getClass(i)->name.c_str(); 195 195 int l = (int)strlen(n); 196 196 if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = Neuro::getClass(i); Len = l; } -
cpp/frams/genetics/preconfigured.h
r346 r348 18 18 DefaultGenoConvManager gcm; 19 19 GenMan genman; 20 Geno::Validators validators; 20 21 ModelGenoValidator model_validator; //validation through conversion 21 22 … … 23 24 { 24 25 gcm.addDefaultConverters(); //without converters, the application would only handle "format 0" genotypes 25 Geno::useConverters( gcm);26 Geno::useConverters(&gcm); 26 27 27 Geno::addValidator(&genman); //primary validation: use the extended validity checking (through dedicated genetic operators) 28 Geno::addValidator(&model_validator); //secondary validation: this simple validator handles all cases when there is no dedicated genetic validation operator, but a converter for a particular format is available. Converters may be less strict in detecting invalid genotypes but using them and checking whether they produced a valid f0 genotype is also some way to tell whether the initial genotype was valid. Otherwise, without dedicated genetic validation operator, we would have no validity check at all. 29 } 30 }; 31 32 /** Initialization procedure for applications adding their own validators */ 33 class PreconfiguredGenetics_NoValidators 34 { 35 public: 36 DefaultGenoConvManager gcm; 37 38 PreconfiguredGenetics_NoValidators() 39 { 40 gcm.addDefaultConverters(); //without converters, the application would only handle "format 0" genotypes 41 Geno::useConverters(gcm); 28 Geno::useValidators(&validators); 29 validators+=&genman; //primary validation: use the extended validity checking (through dedicated genetic operators) 30 validators+=&model_validator; //secondary validation: this simple validator handles all cases when there is no dedicated genetic validation operator, but a converter for a particular format is available. Converters may be less strict in detecting invalid genotypes but using them and checking whether they produced a valid f0 genotype is also some way to tell whether the initial genotype was valid. Otherwise, without dedicated genetic validation operator, we would have no validity check at all. 42 31 } 43 32 }; 44 33 45 34 #endif 46 -
cpp/frams/model/autoname.cpp
r343 r348 38 38 unsigned int s1 = 0, s2 = 0, s3 = 0; 39 39 SString g = model.getGeno().getGene(); 40 const char *x = g ;40 const char *x = g.c_str(); 41 41 for (; *x; x++) { s1 += *x; s2 = s2**x + *x; s3 = (s3^*x) + *x; } 42 42 char* t = buf; -
cpp/frams/model/model.cpp
r319 r348 331 331 FMprintf("Model","build",FMLV_ERROR, 332 332 geno.getName().len()?"illegal f0 code at line %d (%s)":"illegal f0 code at line %d", 333 lnum, (const char*)geno.getName());333 lnum,geno.getName().c_str()); 334 334 f0errorposition=lastpos; 335 335 if (convmap) delete convmap; … … 473 473 } 474 474 } 475 g=Geno(gen ,'0');475 g=Geno(gen.c_str(),'0'); 476 476 } 477 477 … … 559 559 int Model::singleStepBuild(const SString &line,const MultiRange* srcrange) 560 560 { 561 int pos=0; const char*t= (const char*)line;561 int pos=0; const char*t=line.c_str(); 562 562 for (;*t;t++,pos++) 563 563 if (!strchr(" \r\t",*t)) break; … … 943 943 FMprintf("Model","internalCheck",FMLV_ERROR, 944 944 "delta joint cycle detected at joint#%d (%s)", 945 i, (const char*)geno.getName());945 i,geno.getName().c_str()); 946 946 } 947 947 j->resetDeltaMarkers(); … … 979 979 ret=0; 980 980 FMprintf("Model","internalCheck",FMLV_ERROR,"delta too big in joint #%d (%s)", 981 i, (const char*)geno.getName());981 i,geno.getName().c_str()); 982 982 } 983 983 else if (j->d()<getMinJoint().d.x) … … 985 985 ret=0; 986 986 FMprintf("Model","internalCheck",FMLV_ERROR,"delta too small in joint #%d (%s)", 987 i, (const char*)geno.getName());987 i,geno.getName().c_str()); 988 988 } 989 989 } … … 993 993 { 994 994 FMprintf("Model","internalCheck",FMLV_ERROR,"illegal part references in joint #%d (%s)", 995 i, (const char*)geno.getName());995 i,geno.getName().c_str()); 996 996 ret=0; 997 997 } … … 1072 1072 { 1073 1073 FMprintf("Model","internalCheck",FMLV_ERROR,"not all parts connected (eg.#0-#%d) (%s)", 1074 i, (const char*)geno.getName());1074 i,geno.getName().c_str()); 1075 1075 ret=0; 1076 1076 break; … … 1085 1085 { 1086 1086 FMprintf("Model","internalCheck",FMLV_ERROR,"illegal self connection, joint #%d (%s)", 1087 i, (const char*)geno.getName());1087 i,geno.getName().c_str()); 1088 1088 ret=0; 1089 1089 break; … … 1096 1096 { 1097 1097 FMprintf("Model","internalCheck",FMLV_ERROR,"illegal duplicate joints #%d and #%d (%s)", 1098 i,k, (const char*)geno.getName());1098 i,k,geno.getName().c_str()); 1099 1099 ret=0; 1100 1100 break; -
cpp/frams/neuro/impl/neuroimpl-fuzzy-f0.cpp
r286 r348 23 23 break; 24 24 else 25 numbers[have++]=atof(t );25 numbers[have++]=atof(t.c_str()); 26 26 27 27 //check if number of read numbers (separated with semicolon) is equal to declared … … 122 122 t += str.charAt(pos++); 123 123 pos++; 124 rules[j][k]=atol(t ); //convert cut out string into number124 rules[j][k]=atol(t.c_str()); //convert cut out string into number 125 125 //fuzzy sets - odd index table - are counted from 0, 126 126 //so if 5 fuzzy sets declared, values acceptable are 0,1,2,3,4 -
cpp/frams/neuro/impl/neuroimpl-fuzzy.cpp
r286 r348 35 35 rulesDef = new int[2*rulesNr]; //for each rule remembers number of inputs and outputs 36 36 //check correctness of string and fill in the rulesDef 37 if (FuzzyF0String::countInputsOutputs(fuzzyRulesString , rulesDef, rulesNr) == 0)37 if (FuzzyF0String::countInputsOutputs(fuzzyRulesString.c_str(), rulesDef, rulesNr) == 0) 38 38 { 39 39 defuzzParam = new double[rulesNr]; // parameters used in defuzyfication process -
cpp/frams/neuro/neurofactory.cpp
r286 r348 99 99 if (removed.len()) 100 100 FMprintf("NeuroFactory","removeUninmplemented",FMLV_INFO, 101 "Removed Neuro classes: %s", (const char*)removed);101 "Removed Neuro classes: %s",removed.c_str()); 102 102 } 103 103 -
cpp/frams/neuro/neuroimpl.cpp
r288 r348 73 73 if (!ni) { errorcount++; 74 74 FMprintf("NeuroNetImpl","create",FMLV_WARN,"neuron #%d (%s) implementation not available", 75 i, (const char*)n->getClassName());75 i,n->getClassName().c_str()); 76 76 continue; } // implementation not available?! 77 77 ni->owner=this; … … 88 88 { ni->status=NeuroImpl::InitError; errorcount++; 89 89 FMprintf("NeuroNetImpl","create",FMLV_WARN,"neuron #%d (%s) initialization failed", 90 i, (const char*)n->getClassName());90 i,n->getClassName().c_str()); 91 91 continue; } 92 92 ni->status=NeuroImpl::InitOk; -
cpp/frams/neuro/neurolibparam.cpp
r286 r348 51 51 t+=n; 52 52 } 53 return t ;53 return t.c_str(); 54 54 } 55 55 … … 59 59 t=Neuro::getClass(i)->getLongName(); 60 60 t+=" ("; t+=Neuro::getClassName(i); t+=")"; 61 return t ;61 return t.c_str(); 62 62 } 63 63 … … 66 66 static SString t; 67 67 t=Neuro::getClass(i)->getSummary(); 68 return t ;68 return t.c_str(); 69 69 } 70 70 -
cpp/frams/param/multiparamload.cpp
r333 r348 107 107 else if (status==BeforeUnknown) 108 108 { 109 FMprintf("MultiParamLoader","go",FMLV_WARN,"Skipping object '%s'", (const char*)lastunknown);109 FMprintf("MultiParamLoader","go",FMLV_WARN,"Skipping object '%s'",lastunknown.c_str()); 110 110 loadObjectNow(&emptyparam,false); 111 111 continue; … … 126 126 if (buf.startsWith("#include")) 127 127 { 128 const char* t=strchr( (const char*)buf,'\"'),*t2=0;128 const char* t=strchr(buf.c_str(),'\"'),*t2=0; 129 129 if (t) 130 130 t2=strchr(t+1,'\"'); … … 137 137 { 138 138 const char* thisfilename=file->VgetPath(); 139 FMprintf("MultiParamLoader","go",FMLV_WARN,"invalid \"%s\"%s%s", (const char*)buf,139 FMprintf("MultiParamLoader","go",FMLV_WARN,"invalid \"%s\"%s%s",buf.c_str(), 140 140 (thisfilename?" in ":""),(thisfilename?thisfilename:"")); 141 141 } … … 157 157 FOREACH(ExtObject*,o,objects) 158 158 { 159 if (!strcmp(o->interfaceName(),lastunknown )) {lastobject=*o; break;}159 if (!strcmp(o->interfaceName(),lastunknown.c_str())) {lastobject=*o; break;} 160 160 } 161 161 if (!lastobject.isEmpty()) … … 202 202 newfilename=filename; 203 203 204 if (alreadyIncluded(newfilename ))204 if (alreadyIncluded(newfilename.c_str())) 205 205 { 206 206 FMprintf("MultiParamLoader","include",FMLV_WARN,"circular reference ignored (\"%s\")", 207 (const char*)filename);207 filename.c_str()); 208 208 return; 209 209 } 210 210 211 VirtFILE *f=Vfopen(newfilename ,FOPEN_READ_BINARY);211 VirtFILE *f=Vfopen(newfilename.c_str(),FOPEN_READ_BINARY); 212 212 if (!f) 213 213 { 214 FMprintf("MultiParamLoader","include",FMLV_WARN,"\"%s\" not found", (const char*)newfilename);214 FMprintf("MultiParamLoader","include",FMLV_WARN,"\"%s\" not found",newfilename.c_str()); 215 215 } 216 216 else -
cpp/frams/param/mutableparam.cpp
r286 r348 33 33 if (ignoreprefix) 34 34 { 35 const char *noprefix= (const char*)groupname(i);35 const char *noprefix=groupname(i).c_str(); 36 36 if ((int)strlen(noprefix) < skipprefix) continue; 37 37 noprefix+=skipprefix; 38 if (!strcmp(noprefix, (const char*)name)) return i;38 if (!strcmp(noprefix,name.c_str())) return i; 39 39 } 40 40 else … … 183 183 void MutableParam::p_addprop(ExtValue *args,ExtValue *ret) 184 184 { 185 int i=addProperty(0,args[2].getString() ,args[1].getString(),args[0].getString());185 int i=addProperty(0,args[2].getString().c_str(),args[1].getString().c_str(),args[0].getString().c_str()); 186 186 ret->setInt(i); 187 187 } … … 284 284 { 285 285 SString *n=(SString*)store(i); 286 int prop=p.findId( (const char*)*n);286 int prop=p.findId(n->c_str()); 287 287 if (prop<0) 288 prop=p.addProperty(0, (const char*)*n,"x",0,0,0,0,-1);288 prop=p.addProperty(0,n->c_str(),"x",0,0,0,0,-1); 289 289 p.setExtValue(prop,*(ExtValue*)store(i+1)); 290 290 } -
cpp/frams/param/mutableparam.h
r286 r348 36 36 int getGroupCount() {return groups.size();} 37 37 int getPropCount() {return entries.size()+staticprops;} 38 const char *grname(int i) {return (i>=groups.size()) ? 0 : (const char*)groupname(i);}38 const char *grname(int i) {return (i>=groups.size()) ? 0 : groupname(i).c_str();} 39 39 int grmember(int g,int a); 40 40 -
cpp/frams/param/param.cpp
r343 r348 301 301 ws = get(i); 302 302 quoteTilde(ws); 303 w = ws ;303 w = ws.c_str(); 304 304 if (ws.len() > 50) cr = 1; 305 305 else for (t = w; *t; t++) if ((*t == 10) || (*t == 13)) { cr = 1; break; } … … 372 372 { // string - special case 373 373 SString str = getString(i); 374 if (strContainsOneOf(str , ", \\\n\r\t\""))374 if (strContainsOneOf(str.c_str(), ", \\\n\r\t\"")) 375 375 { 376 376 t += "\""; … … 403 403 { 404 404 if (linenum) (*linenum)++; 405 const char* t = (const char*)buf;405 const char* t = buf.c_str(); 406 406 p0 = t; while ((*p0 == ' ') || (*p0 == '\t')) p0++; 407 407 if (!*p0) break; … … 419 419 czytdotyldy(f, s); 420 420 int lfcount = 1; 421 const char* tmp = s ;421 const char* tmp = s.c_str(); 422 422 while (tmp) 423 423 if ((tmp = strchr(tmp, '\n'))) … … 430 430 if (linenum && (flags(i)&PARAM_LINECOMMENT)) 431 431 s = SString::sprintf("@file %s\n@line %d\n", f->VgetPath(), *linenum + 1) + s; 432 set(i, (const char*)s);432 set(i, s.c_str()); 433 433 if (linenum) 434 434 (*linenum) += lfcount; … … 445 445 { 446 446 SString name(p0, p_len); 447 FMprintf("ParamInterface", "load", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", (const char*)name, getName());447 FMprintf("ParamInterface", "load", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", name.c_str(), getName()); 448 448 } 449 449 … … 454 454 if (linenum) 455 455 { 456 const char* tmp = s ;456 const char* tmp = s.c_str(); 457 457 int lfcount = 1; 458 458 while (tmp) … … 562 562 if (v.type == TObj) 563 563 { 564 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting integer value from object reference (%s)", (const char*)v.getString());564 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting integer value from object reference (%s)", v.getString().c_str()); 565 565 return 0; 566 566 } 567 567 else 568 return setInt(i, (const char*)v.getString());568 return setInt(i, v.getString().c_str()); 569 569 } 570 570 case 'f': … … 574 574 if (v.type == TObj) 575 575 { 576 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting floating point value from object reference (%s)", (const char*)v.getString());576 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting floating point value from object reference (%s)", v.getString().c_str()); 577 577 return 0; 578 578 } 579 579 else 580 return setDouble(i, (const char*)v.getString());580 return setDouble(i, v.getString().c_str()); 581 581 } 582 582 case 's': { SString t = v.getString(); return setString(i, t); } … … 990 990 static const char *getline(const SString &s, int &poz, int &len) 991 991 { 992 const char *beg = (const char*)s+ poz;993 if (poz >= s.len()) { poz = s.len(); len = 0; return (const char*)s+ s.len(); }992 const char *beg = s.c_str() + poz; 993 if (poz >= s.len()) { poz = s.len(); len = 0; return s.c_str() + s.len(); } 994 994 const char *lf = strchr(beg, '\n'); 995 if (!lf) { lf = (const char*)s+ s.len() - 1; poz = s.len(); }996 else { poz = (int)(lf - (const char*)s) + 1; if (poz > s.len()) poz = s.len(); }995 if (!lf) { lf = s.c_str() + s.len() - 1; poz = s.len(); } 996 else { poz = (int)(lf - s.c_str()) + 1; if (poz > s.len()) poz = s.len(); } 997 997 while (lf >= beg) if ((*lf == '\n') || (*lf == '\r')) lf--; else break; 998 998 len = (int)(lf - beg) + 1; … … 1014 1014 SString tmpvalue; 1015 1015 if (poz >= s.len()) return fields_loaded; 1016 t = (const char*)s+ poz;1016 t = s.c_str() + poz; 1017 1017 1018 1018 lin = getline(s, poz, len); // all fields must be encoded in a single line … … 1060 1060 { 1061 1061 SString name(t, (int)(equals_sign - t)); 1062 FMprintf("Param", "load2", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", (const char*)name, getName());1062 FMprintf("Param", "load2", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", name.c_str(), getName()); 1063 1063 } 1064 1064 t = equals_sign + 1; // t=value … … 1081 1081 tmpvalue.copyFrom(quote + 1, (int)(quote2 - quote) - 1); 1082 1082 sstringUnquote(tmpvalue); 1083 value = tmpvalue ;1083 value = tmpvalue.c_str(); 1084 1084 valstop = quote2; 1085 1085 } -
cpp/frams/param/param.h
r333 r348 274 274 SString actual = get(i); 275 275 FMprintf("Param", "set", FMLV_WARN, "Setting '%s.%s = %s' exceeded allowed range (too %s). Adjusted to %s.", 276 getName(), id(i), (const char*)svaluetoset, (setflags&PSET_HITMAX) ? "big" : "small", (const char*)actual);276 getName(), id(i), svaluetoset.c_str(), (setflags&PSET_HITMAX) ? "big" : "small", actual.c_str()); 277 277 } 278 278 } -
cpp/frams/param/paramobj.cpp
r326 r348 58 58 t->name = maybedup(dupentries, "create new object"); 59 59 SString tmp = SString::sprintf("p o%s()", pi->getName()); 60 t->type = maybedup(dupentries, (const char*)tmp);60 t->type = maybedup(dupentries, tmp.c_str()); 61 61 t->help = maybedup(dupentries, pi->help(i)); 62 62 t->flags = 0; -
cpp/frams/util/extvalue.cpp
r337 r348 269 269 if (tmp.len() > 30) tmp = tmp.substr(0, 30) + "..."; 270 270 if (type == TString) tmp = SString("\"") + tmp + SString("\""); 271 FMprintf("ExtValue", "getObjectTarget", FMLV_WARN, "%s object expected, %s found", classname, (const char*)tmp);271 FMprintf("ExtValue", "getObjectTarget", FMLV_WARN, "%s object expected, %s found", classname, tmp.c_str()); 272 272 } 273 273 return NULL; … … 329 329 static ExtValue::CompareResult compareString(const SString &a, const SString &b) 330 330 { 331 const char* s1 = (const char*)a;332 const char* s2 = (const char*)b;331 const char* s1 = a.c_str(); 332 const char* s2 = b.c_str(); 333 333 return longsign(strcmp(s1, s2)); 334 334 } … … 415 415 if (context->v1 && context->v2) 416 416 msg += SString::sprintf(": %s %s %s", 417 (const char*)context->v1->typeAndValue(),417 context->v1->typeAndValue().c_str(), 418 418 cmp_op_names[op - CmpFIRST], 419 (const char*)context->v2->typeAndValue());420 } 421 FMprintf("ExtValue", "interpretCompare", FMLV_ERROR, "%s", (const char*)msg);419 context->v2->typeAndValue().c_str()); 420 } 421 FMprintf("ExtValue", "interpretCompare", FMLV_ERROR, "%s", msg.c_str()); 422 422 ret = -1; 423 423 } … … 448 448 { 449 449 case TDouble: 450 FMprintf("ExtValue", "add", FMLV_WARN, "Adding %s to %s", (const char*)src.typeAndValue(), (const char*)typeAndValue());450 FMprintf("ExtValue", "add", FMLV_WARN, "Adding %s to %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 451 451 setDouble(double(getInt()) + src.getDouble()); 452 452 return; … … 487 487 default:; 488 488 } 489 FMprintf("ExtValue", "add", FMLV_ERROR, "Can't add %s to %s", (const char*)src.typeAndValue(), (const char*)typeAndValue());489 FMprintf("ExtValue", "add", FMLV_ERROR, "Can't add %s to %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 490 490 } 491 491 … … 502 502 return; 503 503 case TDouble: 504 FMprintf("ExtValue", "subtract", FMLV_WARN, "Subtracting %s from %s", (const char*)src.typeAndValue(), (const char*)typeAndValue());504 FMprintf("ExtValue", "subtract", FMLV_WARN, "Subtracting %s from %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 505 505 setDouble(double(getInt()) - src.getDouble()); 506 506 return; … … 520 520 default:; 521 521 } 522 FMprintf("ExtValue", "subtract", FMLV_ERROR, "Can't subtract %s from %s", (const char*)src.typeAndValue(), (const char*)typeAndValue());522 FMprintf("ExtValue", "subtract", FMLV_ERROR, "Can't subtract %s from %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 523 523 } 524 524 … … 535 535 return; 536 536 case TDouble: 537 FMprintf("ExtValue", "multiply", FMLV_WARN, "Multiplying %s by %s", (const char*)typeAndValue(), (const char*)src.typeAndValue());537 FMprintf("ExtValue", "multiply", FMLV_WARN, "Multiplying %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 538 538 setDouble(double(getInt())*src.getDouble()); 539 539 return; … … 591 591 default:; 592 592 } 593 FMprintf("ExtValue", "multiply", FMLV_WARN, "Can't multiply %s by %s", (const char*)typeAndValue(), (const char*)src.typeAndValue());593 FMprintf("ExtValue", "multiply", FMLV_WARN, "Can't multiply %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 594 594 } 595 595 … … 621 621 if (a == 0.0) 622 622 { 623 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Division by zero: %s/0.0", (const char*)getString());623 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Division by zero: %s/0.0", getString().c_str()); 624 624 setInvalid(); 625 625 } … … 630 630 if (!finite(tmp)) 631 631 { 632 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Overflow %s/%g", (const char*)getString(), a); setInvalid();632 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Overflow %s/%g", getString().c_str(), a); setInvalid(); 633 633 } 634 634 else … … 652 652 return; 653 653 case TDouble: 654 FMprintf("ExtValue", "divide", FMLV_WARN, "Dividing %s by %s", (const char*)typeAndValue(), (const char*)src.typeAndValue());654 FMprintf("ExtValue", "divide", FMLV_WARN, "Dividing %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 655 655 divDouble(src.ddata()); 656 656 return; … … 674 674 default:; 675 675 } 676 FMprintf("ExtValue", "divide", FMLV_ERROR, "Can't divide %s by %s", (const char*)typeAndValue(), (const char*)src.typeAndValue());676 FMprintf("ExtValue", "divide", FMLV_ERROR, "Can't divide %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 677 677 } 678 678 … … 687 687 // ^-cur ^-next 688 688 // ^^^^^^^^^^___sub 689 const char* begin = (const char*)fmt, *end = begin + fmt.len(), *curr = begin;689 const char* begin = fmt.c_str(), *end = begin + fmt.len(), *curr = begin; 690 690 int type = 0; 691 691 … … 733 733 switch (type) 734 734 { 735 case 'd': a = args.getNext(); ret += SString::sprintf( (const char*)sub, a ? a->getInt() : 0); break;736 case 'f': a = args.getNext(); ret += SString::sprintf( (const char*)sub, a ? a->getDouble() : 0); break;737 case 's': {a = args.getNext(); SString tmp; if (a) tmp = a->getString(); ret += SString::sprintf( (const char*)sub, (const char*)tmp); } break;735 case 'd': a = args.getNext(); ret += SString::sprintf(sub.c_str(), a ? a->getInt() : 0); break; 736 case 'f': a = args.getNext(); ret += SString::sprintf(sub.c_str(), a ? a->getDouble() : 0); break; 737 case 's': {a = args.getNext(); SString tmp; if (a) tmp = a->getString(); ret += SString::sprintf(sub.c_str(), tmp.c_str()); } break; 738 738 case 't': case 'T': 739 739 { … … 779 779 780 780 case TObj: case TUnknown: case TInvalid: 781 FMprintf("ExtValue", "modulo", FMLV_WARN, "Can't apply modulo to %s", (const char*)typeDescription());781 FMprintf("ExtValue", "modulo", FMLV_WARN, "Can't apply modulo to %s", typeDescription().c_str()); 782 782 783 783 default:; … … 835 835 case TInt: return idata(); 836 836 case TDouble: return (int)ddata(); 837 case TString: return getInt( (const char*)sdata());837 case TString: return getInt(sdata().c_str()); 838 838 case TObj: 839 FMprintf("ExtValue", "getInt", FMLV_WARN, "Getting integer value from object reference (%s)", (const char*)getString());839 FMprintf("ExtValue", "getInt", FMLV_WARN, "Getting integer value from object reference (%s)", getString().c_str()); 840 840 return (paInt)(intptr_t)odata().param; 841 841 default:; … … 850 850 case TDouble: return ddata(); 851 851 case TInt: return (double)idata(); 852 case TString: return getDouble( (const char*)sdata());852 case TString: return getDouble(sdata().c_str()); 853 853 case TObj: 854 FMprintf("ExtValue", "getDouble", FMLV_WARN, "Getting floating point value from object reference (%s)", (const char*)getString());854 FMprintf("ExtValue", "getDouble", FMLV_WARN, "Getting floating point value from object reference (%s)", getString().c_str()); 855 855 return (double)(intptr_t)odata().param; 856 856 default:; … … 1095 1095 ExtValue tmp; 1096 1096 ret = tmp.deserialize(ret); 1097 ParamInterface *cls = findDeserializableClass(clsname );1097 ParamInterface *cls = findDeserializableClass(clsname.c_str()); 1098 1098 if (cls && (tmp.getType() != TUnknown) && (tmp.getType() != TInvalid)) 1099 1099 { … … 1134 1134 } 1135 1135 setEmpty(); 1136 FMprintf("ExtValue", "deserialize", FMLV_WARN, "object of class \"%s\" could not be deserialized", (const char*)clsname);1136 FMprintf("ExtValue", "deserialize", FMLV_WARN, "object of class \"%s\" could not be deserialized", clsname.c_str()); 1137 1137 return ret; 1138 1138 } -
cpp/frams/util/hashtable.cpp
r286 r348 161 161 printf(" %d:",n); 162 162 for (;e;e=e->next) 163 printf(" (%x)%s=%p",e->hash, (const char*)e->key,e->value);163 printf(" (%x)%s=%p",e->hash,e->key.c_str(),e->value); 164 164 printf("\n"); 165 165 } -
cpp/frams/util/sstring.cpp
r347 r348 251 251 void SString::operator+=(const SString&s) 252 252 { 253 append( (const char*)s,s.len());253 append(s.c_str(),s.len()); 254 254 } 255 255 … … 323 323 int SString::indexOf(const SString & substring,int start) const 324 324 { 325 char *found=strstr(buf->txt+start, ((const char*)substring));325 char *found=strstr(buf->txt+start,substring.c_str()); 326 326 return found?found-buf->txt:-1; 327 327 } … … 341 341 int SString::startsWith(const char *pattern) const 342 342 { 343 const char *t= (const char*)(*this);343 const char *t=this->c_str(); 344 344 for (;*pattern;pattern++,t++) 345 345 if (*t != *pattern) return 0; … … 358 358 { 359 359 SString tmp=SString::sprintf("%.15g",d); 360 if ((!strchr(tmp ,'.'))&&(!strchr(tmp,'e'))) tmp+=".0";360 if ((!strchr(tmp.c_str(),'.'))&&(!strchr(tmp.c_str(),'e'))) tmp+=".0"; 361 361 return tmp; 362 362 } -
cpp/frams/util/sstring.h
r286 r348 144 144 int indexOf(const SString & substring,int start=0) const; 145 145 146 operator const char*() const {return buf->txt;} ///< get SString's readonly buffer146 const char* c_str() const {return buf->txt;} ///< get SString's readonly buffer 147 147 //operator char*() {detachCopy(len()); return buf->txt;} ///< get SString's writable buffer 148 148 void operator=(const char*t); ///< assign from const char* -
cpp/frams/util/sstringutils.cpp
r319 r348 63 63 int quoteTilde(SString &target) 64 64 { 65 const char* x = target ;65 const char* x = target.c_str(); 66 66 SString tmp; 67 67 char *f; … … 88 88 int unquoteTilde(SString &target) 89 89 { 90 const char* x = target ;90 const char* x = target.c_str(); 91 91 SString tmp; 92 92 char *f; … … 134 134 bool sstringQuote(SString& target) 135 135 { 136 const char* x = target ;136 const char* x = target.c_str(); 137 137 bool changed = 0; 138 138 SString tmp; … … 169 169 int sstringUnquote(SString &target) 170 170 { 171 const char* x = target ;171 const char* x = target.c_str(); 172 172 SString tmp; 173 173 char *f; … … 200 200 int strFindField(const SString& txt, const SString& name, int &end) 201 201 { 202 const char* t = txt , *n;202 const char* t = txt.c_str(), *n; 203 203 int pos = 0; 204 204 while (1) 205 205 { 206 206 n = strchr(t + pos, ','); 207 if ((!strncmp(t + pos, name , name.len())) && (t[pos + name.len()] == '='))207 if ((!strncmp(t + pos, name.c_str(), name.len())) && (t[pos + name.len()] == '=')) 208 208 { 209 209 if (n) end = n - t; else end = txt.len(); … … 234 234 char *b = t; 235 235 if (txt.len()) *(t++) = ','; 236 strcpy(t, name ); t += name.len();236 strcpy(t, name.c_str()); t += name.len(); 237 237 *(t++) = '='; 238 strcpy(t, value ); t += value.len();238 strcpy(t, value.c_str()); t += value.len(); 239 239 txt.endAppend(t - b); 240 240 } … … 253 253 char *t = txt.directWrite(txt.len() + value.len() - (e - p)); 254 254 memmove(t + p + value.len(), t + e, txt.len() - e); 255 memmove(t + p, value , value.len());255 memmove(t + p, value.c_str(), value.len()); 256 256 txt.endWrite(txt.len() + value.len() - (e - p)); 257 257 } … … 261 261 SString trim(SString& s) 262 262 { 263 const unsigned char*b = (const unsigned char*) (const char*)s;263 const unsigned char*b = (const unsigned char*)s.c_str(); 264 264 const unsigned char*e = b + s.len(); 265 265 while ((b < e) && (*b <= ' ')) b++; … … 275 275 bool removeCR(SString& s) 276 276 { 277 const char* p = (const char*)s;277 const char* p = s.c_str(); 278 278 const char* cr = strchr(p, '\r'); 279 279 if (!cr) return false; … … 299 299 SString after = pattern.substr(aster + 1); 300 300 if (!word.len()) return false; 301 if (before.len()) if (!word.startsWith(before )) return false;301 if (before.len()) if (!word.startsWith(before.c_str())) return false; 302 302 if (after.len()) 303 303 if ((word.len() < after.len()) 304 || (strcmp( (const char*)after, ((const char*)word) + word.len() - after.len())))304 || (strcmp(after.c_str(), word.c_str() + word.len() - after.len()))) 305 305 return false; 306 306 return true; -
cpp/frams/virtfile/stringfile.cpp
r295 r348 13 13 int need = (int)(size*nmemb); 14 14 if (need > have) { nmemb = have / size; need = (int)(size*nmemb); } 15 memcpy(ptr, ((const char*)str) + pos, need);15 memcpy(ptr, str.c_str() + pos, need); 16 16 pos += need; 17 17 return nmemb; … … 32 32 if (size < 0) size = 0; 33 33 if (have > size) have = size - 1; 34 const char* src = ((const char*)str) + pos;34 const char* src = str.c_str() + pos; 35 35 char *dest = s; 36 36 while (have-- > 0) -
cpp/frams/vm/framscript.l
r335 r348 115 115 int len=src.len(); 116 116 SString ret((len*11)/10+10); 117 const char*t= (const char*)src;117 const char*t=src.c_str(); 118 118 while(len>0) 119 119 { -
cpp/frams/vm/framscript.y
r345 r348 467 467 {trctx.err->printf("%s can't be iterated\n",str($4)); return 1;} 468 468 if ($4.objname) 469 trctx.out->printf("move %s.iterator,m[--m0]\n", (const char*)$4.getString());469 trctx.out->printf("move %s.iterator,m[--m0]\n",$4.getString().c_str()); 470 470 else 471 471 trctx.out->printf("move s%d,m1\nmove [m1].\"iterator\",m[--m0]\n",0); … … 662 662 663 663 | OBJNAME ':' IDENT {$$.constant=0; $$.ident=0; 664 trctx.out->printf("push %s:%s\n", (const char*)$1.getString(),665 (const char*)$3.getString());664 trctx.out->printf("push %s:%s\n",$1.getString().c_str(), 665 $3.getString().c_str()); 666 666 trstack.adjust(-1); 667 667 } … … 688 688 trstack.adjust(-1);} 689 689 else if (globalOk($1)) 690 { trctx.out->printf("push @%s\n%s @%s\n", (const char*)$1.getString(),691 $2.getInt()?"inc":"dec", (const char*)$1.getString());690 { trctx.out->printf("push @%s\n%s @%s\n",$1.getString().c_str(), 691 $2.getInt()?"inc":"dec",$1.getString().c_str()); 692 692 trstack.adjust(-1);} 693 693 else {badVariable($$,$1); return 1;} … … 697 697 if (!handleAssignOp($$,$1,$3,assign_op_names[$2.getInt()])) 698 698 if (globalOk($1)) {SString t="@"; t+=$1.getString(); 699 handleAssignOp2($$, (const char*)t,$3,assign_op_names[$2.getInt()],0,1);}699 handleAssignOp2($$,t.c_str(),$3,assign_op_names[$2.getInt()],0,1);} 700 700 else { badVariable($$,$1); return 1; } 701 701 } … … 895 895 if ($3.constant) 896 896 { 897 handleAssignOp2($$, (const char*)t,$5,assign_op_names[$4.getInt()],0,1);897 handleAssignOp2($$,t.c_str(),$5,assign_op_names[$4.getInt()],0,1); 898 898 } 899 899 else … … 902 902 t=$1.getString();t+=".[m1]"; 903 903 trctx.out->printf("move s0,m1\n",str($1)); 904 handleAssignOp2($$, (const char*)t,$5,assign_op_names[$4.getInt()],sp,0);904 handleAssignOp2($$,t.c_str(),$5,assign_op_names[$4.getInt()],sp,0); 905 905 if (sp) {trctx.out->printf("inc m0\n"); trstack.adjust(1);} 906 906 } … … 1008 1008 | FUNCTION IDENT 1009 1009 { trctx.emitLine(); $$.constant=0; $$.ident=0; SString t=":"; t+=$1.getString(); $$.setString(t); 1010 trctx.out->printf("push :%s\n", (const char*)$2.getString());1010 trctx.out->printf("push :%s\n",$2.getString().c_str()); 1011 1011 trstack.adjust(-1); 1012 1012 } … … 1053 1053 {sp=1; trctx.out->printf("move s1,m1\n");} 1054 1054 t="[m1]."; t+=str($3); 1055 handleAssignOp2($$, (const char*)t,$5,assign_op_names[$4.getInt()],sp,0);1055 handleAssignOp2($$,t.c_str(),$5,assign_op_names[$4.getInt()],sp,0); 1056 1056 if (sp) {trctx.out->printf("inc m0\n");trstack.adjust(1);} 1057 1057 } … … 1295 1295 SString ret((len*11)/10+10); 1296 1296 ret+='\"'; 1297 const char*t= (const char*)s;1297 const char*t=s.c_str(); 1298 1298 while(len>0) 1299 1299 { … … 1464 1464 SymTabEntry* found=trstack.globals.find(var.getString()); 1465 1465 if (found) return true; 1466 return framscriptIsGlobalName(var.getString() );1466 return framscriptIsGlobalName(var.getString().c_str()); 1467 1467 } 1468 1468 … … 1539 1539 else if (globalOk(var)) 1540 1540 { 1541 trctx.out->printf("push @%s\n", (const char*)var.getString());1541 trctx.out->printf("push @%s\n",var.getString().c_str()); 1542 1542 trstack.adjust(-1); 1543 1543 return true;
Note: See TracChangeset
for help on using the changeset viewer.