Changeset 20690 for issm/trunk-jpl/src/m/solve/WriteData.js
- Timestamp:
- 06/03/16 10:05:11 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/solve/WriteData.js
r20361 r20690 1 function WriteData(fid ){1 function WriteData(fid,prefix){ 2 2 //WRITEDATA - write model field into binary buffer 3 3 // … … 17 17 obj = options.getfieldvalue('object'); 18 18 fieldname = options.getfieldvalue('fieldname'); 19 if (options.exist('enum')){ 20 enumm = options.getfieldvalue('enum'); 19 name = options.getfieldvalue('name',[prefix+'.'+fieldname ]); 20 if (options.exist('data')){ 21 data = options.getfieldvalue('data'); 21 22 } 22 23 else{ 23 classname = options.getfieldvalue('class',obj.classname()); 24 enumm = BuildEnum(classname + '_' + fieldname); 25 } 26 dataini = obj[fieldname]; 24 dataini = obj[fieldname]; 25 } 27 26 } 28 27 else{ 29 28 //No processing required 30 29 dataini = options.getfieldvalue('data'); 31 enumm = options.getfieldvalue('enum');30 namem = options.getfieldvalue('name'); 32 31 } 33 32 if (IsArray(dataini)){ … … 73 72 } 74 73 75 //Step 1: write the enum to identify this record uniquely 76 fid.fwrite(enumm,'int'); 74 //Step 1: write the name to identify this record uniquely 75 fid.fwrite(name.length,'int'); 76 fid.fwrite(name,'char'); 77 77 78 78 //Step 2: write the data itself. … … 278 278 } 279 279 280 function BuildEnum(string){ // {{{281 //BUILDENUM - build enum out of string282 //283 // Usage:284 // enumm=BuildEnum(string)285 286 var index;287 while( string.indexOf('_') !=-1){288 index=string.indexOf('_');289 string=string.slice(0,index)+string[index+1].toUpperCase() + string.slice(index+2);290 }291 292 //take first letter of string and make it uppercase:293 string = string.charAt(0).toUpperCase() + string.slice(1);294 295 //Get Enum296 enumm=StringToEnum(string);297 298 return enumm;299 } // }}}300 280 function FormatToCode(format){ // {{{ 301 281 //This routine takes the format string, and hardcodes it into an integer, which
Note:
See TracChangeset
for help on using the changeset viewer.