Changeset 732 for cpp/frams/vm/classes
- Timestamp:
- 02/15/18 00:42:07 (7 years ago)
- Location:
- cpp/frams/vm/classes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/vm/classes/genoobj.cpp
r534 r732 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-201 5Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2018 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 11 11 ParamEntry geno_paramtab[] = 12 12 { 13 { "Geno", 1, 1 5, "Geno", "All information about a single genotype.\nThis is a genetics-only object which does not contain any performance data. See also: Genotype class" },13 { "Geno", 1, 16, "Geno", "All information about a single genotype.\nThis is a genetics-only object which does not contain any performance data. See also: Genotype class" }, 14 14 { "name", 0, PARAM_NOSTATIC, "Name", "s 0 40", GETSET(name), }, 15 15 { "rawgenotype", 0, PARAM_NOSTATIC | PARAM_READONLY, "Raw genotype", "s 1", GETONLY(genotype), "Genotype, excluding the format specifier" }, … … 23 23 "-1 = validity is not known. This is a transient state. The value of \"is_valid\" will never be -1 when read. It is safe to treat is_valid as boolean in statements like \"if (g.is_valid) ...\". Setting \"is_valid=-1\" will make it 0 or 1 again. This third state (-1) is only needed for loading Genotype objects from files where the \"is_valid\" field might not be present." 24 24 }, 25 { "getConverted", 0, PARAM_NOSTATIC, "get converted genotype", "p oGeno(s format)", PROCEDURE(p_getconvert), }, 25 { "getConverted", 0, PARAM_NOSTATIC, "Get converted genotype", "p oGeno(s format)", PROCEDURE(p_getconvert), }, 26 { "getConvertedWithCheckpoints", 0, PARAM_NOSTATIC, "Get converted genotype", "p oGeno(s format)", PROCEDURE(p_getconvert_ch), "See also Model.newWithCheckpoints()" }, 26 27 { "f0genotype", 0, PARAM_NOSTATIC | PARAM_READONLY, "f0 genotype", "s 1", GETONLY(f0genotype), "converted to f0 genotype", }, 27 28 { "new", 0, 0, "create new empty object", "p oGeno()", PROCEDURE(p_new), }, … … 85 86 void GenoObj::get_format(ExtValue *ret) 86 87 { 87 char format_as_string[2] ={getFormat(),0};88 char format_as_string[2] = { getFormat(), 0 }; 88 89 ret->setString(format_as_string); 89 90 } … … 102 103 char GenoObj::formatFromExtValue(ExtValue& v) 103 104 { 104 if (v.getType()==TInt)105 return v.getInt();106 if (v.getType()==TString)105 if (v.getType() == TInt) 106 return v.getInt(); 107 if (v.getType() == TString) 107 108 { 108 SString s=v.getString();109 if (s.len()==1)110 return s.charAt(0);109 SString s = v.getString(); 110 if (s.len() == 1) 111 return s.charAt(0); 111 112 } 112 return Geno::INVALID_FORMAT;113 return Geno::INVALID_FORMAT; 113 114 } 114 115 … … 116 117 { 117 118 *ret = makeDynamicObjectAndDecRef(new Geno(getConverted(formatFromExtValue(args[0])))); 119 } 120 121 void GenoObj::p_getconvert_ch(ExtValue *args, ExtValue *ret) 122 { 123 *ret = makeDynamicObjectAndDecRef(new Geno(getConverted(formatFromExtValue(args[0]), NULL, true))); 118 124 } 119 125 -
cpp/frams/vm/classes/genoobj.h
r516 r732 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-201 5Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2018 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 25 25 PARAMGETDEF(string); 26 26 PARAMPROCDEF(p_getconvert); 27 PARAMPROCDEF(p_getconvert_ch); 27 28 PARAMGETDEF(f0genotype); 28 29 PARAMPROCDEF(p_new);
Note: See TracChangeset
for help on using the changeset viewer.