Changeset 473 for cpp/frams/_demos/loader_test.cpp
- Timestamp:
- 02/18/16 02:32:57 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/_demos/loader_test.cpp
r382 r473 17 17 if (argc<2) 18 18 { 19 fprintf(stderr,"Arguments: filename [ optional: genotype name or index (1-based)]\n"20 "If a genotype is indicated (by providing the optional genotype identifier), the program will output the raw genotype, suitable for Framsticks Theater's genotype viewer mode. If the second optionalargument is not given, the genotype names from the file will be listed.\n"19 fprintf(stderr,"Arguments: filename [genotype name or index (1-based) [field name]]\n" 20 "If a genotype is indicated (by providing the optional genotype identifier), the program will output the raw genotype, suitable for Framsticks Theater's genotype viewer mode. If a genotype and a field name is given, the field value (instead of the raw genotype) is printed. If the second argument is not given, the genotype names from the file will be listed.\n" 21 21 "Example: loader_test walking.gen \"Basic Quadruped\" | theater -g -\n" 22 22 ); … … 28 28 MiniGenotypeLoader loader(argv[1]); 29 29 const char* selected=(argc<3)?NULL:argv[2]; 30 const char* field_name=(argc<4)?NULL:argv[3]; 30 31 int selected_index=(selected&&isdigit(selected[0]))?atol(selected):0; 31 32 // using char* constructor (passing the file name to open) … … 48 49 continue; 49 50 } 50 puts(loaded->genotype.c_str()); 51 if (field_name) 52 { 53 Param p(minigenotype_paramtab,loaded); 54 int field_index=p.findId(field_name); 55 if (field_index<0) 56 { 57 printf("Field '%s' not found\n",field_name); 58 return 3; 59 } 60 else 61 puts(p.get(field_index).c_str()); 62 } 63 else 64 puts(loaded->genotype.c_str()); 51 65 return 0; 52 66 }
Note: See TracChangeset
for help on using the changeset viewer.