1 |
< |
#include <cstdlib> |
2 |
< |
#include <cstdio> |
3 |
< |
#include <cstring> |
1 |
> |
#include <stdlib.h> |
2 |
> |
#include <stdio.h> |
3 |
> |
#include <string.h> |
4 |
|
|
5 |
|
#include "Globals.hpp" |
6 |
|
#include "simError.h" |
25 |
|
#define G_RUNTIME 6 |
26 |
|
|
27 |
|
//optional parameters |
28 |
< |
#define G_INITIALCONFIG 7 |
29 |
< |
#define G_FINALCONFIG 8 |
30 |
< |
#define G_NMOL 9 |
31 |
< |
#define G_DENSITY 10 |
32 |
< |
#define G_BOX 11 |
33 |
< |
#define G_BOXX 12 |
34 |
< |
#define G_BOXY 13 |
35 |
< |
#define G_BOXZ 14 |
36 |
< |
#define G_SAMPLETIME 15 |
37 |
< |
#define G_STATUSTIME 16 |
38 |
< |
#define G_ECR 17 |
39 |
< |
#define G_DIELECTRIC 18 |
40 |
< |
#define G_TEMPSET 19 |
41 |
< |
#define G_THERMALTIME 20 |
42 |
< |
#define G_USEPBC 21 |
43 |
< |
#define G_MIXINGRULE 22 |
44 |
< |
#define G_EST 23 |
45 |
< |
#define G_USERF 24 |
28 |
> |
#define G_INITIALCONFIG 7 |
29 |
> |
#define G_FINALCONFIG 8 |
30 |
> |
#define G_NMOL 9 |
31 |
> |
#define G_DENSITY 10 |
32 |
> |
#define G_BOX 11 |
33 |
> |
#define G_BOXX 12 |
34 |
> |
#define G_BOXY 13 |
35 |
> |
#define G_BOXZ 14 |
36 |
> |
#define G_SAMPLETIME 15 |
37 |
> |
#define G_STATUSTIME 16 |
38 |
> |
#define G_ECR 17 |
39 |
> |
#define G_DIELECTRIC 18 |
40 |
> |
#define G_TEMPSET 19 |
41 |
> |
#define G_THERMALTIME 20 |
42 |
> |
#define G_USEPBC 21 |
43 |
> |
#define G_MIXINGRULE 22 |
44 |
> |
#define G_EST 23 |
45 |
> |
#define G_USERF 24 |
46 |
> |
#define G_TARGETPRESSURE 25 |
47 |
> |
#define G_TAUTHERMOSTAT 26 |
48 |
> |
#define G_TAUBAROSTAT 27 |
49 |
> |
#define G_ZCONSTIME 28 |
50 |
> |
#define G_NZCONSTRAINTS 29 |
51 |
> |
#define G_ZCONSTOL 30 |
52 |
> |
#define G_ZCONSFORCEPOLICY 31 |
53 |
> |
#define G_SEED 32 |
54 |
> |
#define G_RESETTIME 33 |
55 |
> |
#define G_USEINITTIME 34 |
56 |
> |
#define G_USEINIT_XS_STATE 35 |
57 |
> |
#define G_ORTHOBOXTOLERANCE 36 |
58 |
|
|
59 |
|
|
60 |
|
Globals::Globals(){ |
61 |
|
|
62 |
|
int i; |
63 |
+ |
|
64 |
+ |
hash_size = 23; |
65 |
+ |
hash_shift = 4; |
66 |
|
|
67 |
|
components = NULL; |
68 |
|
|
86 |
|
addHash( "boxY", G_BOXY ); |
87 |
|
addHash( "boxZ", G_BOXZ ); |
88 |
|
addHash( "sampleTime", G_SAMPLETIME ); |
89 |
+ |
addHash( "resetTime", G_RESETTIME ); |
90 |
|
addHash( "statusTime", G_STATUSTIME ); |
91 |
|
addHash( "electrostaticCutoffRadius", G_ECR ); |
92 |
|
addHash( "dielectric", G_DIELECTRIC ); |
96 |
|
addHash( "usePeriodicBoundaryConditions", G_USEPBC); |
97 |
|
addHash( "electrostaticSkinThickness", G_EST ); |
98 |
|
addHash( "useReactionField", G_USERF ); |
99 |
< |
|
99 |
> |
addHash( "targetPressure", G_TARGETPRESSURE); |
100 |
> |
addHash( "tauThermostat", G_TAUTHERMOSTAT); |
101 |
> |
addHash( "tauBarostat", G_TAUBAROSTAT); |
102 |
> |
addHash( "zconsTime", G_ZCONSTIME); |
103 |
> |
addHash( "nZconstraints", G_NZCONSTRAINTS); |
104 |
> |
addHash( "zconsTol", G_ZCONSTOL); |
105 |
> |
addHash( "zconsForcePolicy", G_ZCONSFORCEPOLICY); |
106 |
> |
addHash( "seed", G_SEED); |
107 |
> |
addHash( "useInitialTime", G_USEINITTIME); |
108 |
> |
addHash( "useInitialExtendedSystemState", G_USEINIT_XS_STATE); |
109 |
> |
addHash( "orthoBoxTolerance", G_ORTHOBOXTOLERANCE); |
110 |
> |
|
111 |
> |
|
112 |
|
// define some default values |
113 |
|
|
114 |
|
strcpy( mixingRule,"standard"); //default mixing rules to standard. |
115 |
|
usePBC = 1; //default periodic boundry conditions to on |
116 |
|
useRF = 0; |
117 |
< |
|
117 |
> |
useInitTime = 1; // default to pull init time from the init file |
118 |
> |
useInitXSstate = 1; // default to pull the extended state from the init file |
119 |
> |
orthoBoxTolerance = 1E-6; |
120 |
> |
|
121 |
|
have_force_field = 0; |
122 |
|
have_n_components = 0; |
123 |
|
have_target_temp = 0; |
136 |
|
have_box_z = 0; |
137 |
|
have_sample_time = 0; |
138 |
|
have_status_time = 0; |
139 |
+ |
have_reset_time = 0; |
140 |
|
have_thermal_time = 0; |
141 |
|
have_ecr = 0; |
142 |
|
have_dielectric = 0; |
143 |
|
have_tempSet = 0; |
144 |
|
have_est = 0; |
145 |
< |
} |
145 |
> |
have_target_pressure =0; |
146 |
> |
have_q_mass = 0; |
147 |
> |
have_tau_thermostat = 0; |
148 |
> |
have_tau_barostat = 0; |
149 |
> |
have_zcons_time = 0; |
150 |
> |
have_n_zConstraints = 0; |
151 |
> |
have_zConstraints = 0; |
152 |
> |
have_zcons_tol = 0; |
153 |
> |
have_seed = 0; |
154 |
|
|
155 |
+ |
} |
156 |
+ |
|
157 |
|
Globals::~Globals(){ |
158 |
|
int i; |
159 |
|
|
226 |
|
return 0; |
227 |
|
} |
228 |
|
|
229 |
< |
int Globals::componentStartIndex( event* the_event ){ |
229 |
> |
int Globals::componentEnd( event* the_event ){ |
230 |
|
|
231 |
< |
current_component->startIndex( the_event->evt.si.array, |
232 |
< |
the_event->evt.si.n_elements ); |
231 |
> |
the_event->err_msg = current_component->checkMe(); |
232 |
> |
if( the_event->err_msg != NULL ) return 0; |
233 |
> |
|
234 |
|
return 1; |
235 |
|
} |
236 |
|
|
237 |
< |
int Globals::componentEnd( event* the_event ){ |
237 |
> |
int Globals::newZconstraint( event* the_event ){ |
238 |
> |
|
239 |
|
|
240 |
< |
the_event->err_msg = current_component->checkMe(); |
240 |
> |
int index = the_event->evt.blk_index; |
241 |
> |
char err[200]; |
242 |
> |
current_zConstraint = new ZconStamp( index ); |
243 |
> |
|
244 |
> |
have_zConstraints = 1; |
245 |
> |
|
246 |
> |
if( have_n_zConstraints && index < n_zConstraints ) |
247 |
> |
zConstraints[index] = current_zConstraint; |
248 |
> |
else{ |
249 |
> |
if( have_n_zConstraints ){ |
250 |
> |
sprintf( err, "Globals error, %d out of nZconstraints range", |
251 |
> |
index ); |
252 |
> |
the_event->err_msg = strdup( err ); |
253 |
> |
return 0; |
254 |
> |
} |
255 |
> |
else{ |
256 |
> |
the_event->err_msg = strdup("Globals error, nZconstraints" |
257 |
> |
" not given before" |
258 |
> |
" first zConstraint declaration." ); |
259 |
> |
return 0; |
260 |
> |
} |
261 |
> |
} |
262 |
> |
|
263 |
> |
return 1; |
264 |
> |
} |
265 |
> |
|
266 |
> |
|
267 |
> |
|
268 |
> |
int Globals::zConstraintAssign( event* the_event ){ |
269 |
> |
|
270 |
> |
switch( the_event->evt.asmt.asmt_type ){ |
271 |
> |
|
272 |
> |
case STRING: |
273 |
> |
return current_zConstraint->assignString( the_event->evt.asmt.lhs, |
274 |
> |
the_event->evt.asmt.rhs.sval, |
275 |
> |
&(the_event->err_msg)); |
276 |
> |
break; |
277 |
> |
|
278 |
> |
case DOUBLE: |
279 |
> |
return current_zConstraint->assignDouble( the_event->evt.asmt.lhs, |
280 |
> |
the_event->evt.asmt.rhs.dval, |
281 |
> |
&(the_event->err_msg)); |
282 |
> |
break; |
283 |
> |
|
284 |
> |
case INT: |
285 |
> |
return current_zConstraint->assignInt( the_event->evt.asmt.lhs, |
286 |
> |
the_event->evt.asmt.rhs.ival, |
287 |
> |
&(the_event->err_msg)); |
288 |
> |
break; |
289 |
> |
|
290 |
> |
default: |
291 |
> |
the_event->err_msg = strdup( "Globals error. Invalid zConstraint" |
292 |
> |
" assignment type" ); |
293 |
> |
return 0; |
294 |
> |
break; |
295 |
> |
} |
296 |
> |
return 0; |
297 |
> |
} |
298 |
> |
|
299 |
> |
int Globals::zConstraintEnd( event* the_event ){ |
300 |
> |
|
301 |
> |
the_event->err_msg = current_zConstraint->checkMe(); |
302 |
|
if( the_event->err_msg != NULL ) return 0; |
303 |
|
|
304 |
|
return 1; |
353 |
|
return 1; |
354 |
|
} |
355 |
|
break; |
356 |
+ |
|
357 |
+ |
case G_NZCONSTRAINTS: |
358 |
+ |
if( the_type == STRING ){ |
359 |
+ |
the_event->err_msg = |
360 |
+ |
strdup("Global error. nZconstraints is not a double or an int.\n" ); |
361 |
+ |
return 0; |
362 |
+ |
} |
363 |
|
|
364 |
+ |
else if( the_type == DOUBLE ){ |
365 |
+ |
n_zConstraints = (int)the_event->evt.asmt.rhs.dval; |
366 |
+ |
zConstraints = new ZconStamp*[n_zConstraints]; |
367 |
+ |
have_n_zConstraints = 1; |
368 |
+ |
return 1; |
369 |
+ |
} |
370 |
+ |
|
371 |
+ |
else{ |
372 |
+ |
n_zConstraints = the_event->evt.asmt.rhs.ival; |
373 |
+ |
zConstraints = new ZconStamp*[n_zConstraints]; |
374 |
+ |
have_n_zConstraints = 1; |
375 |
+ |
return 1; |
376 |
+ |
} |
377 |
+ |
break; |
378 |
+ |
|
379 |
|
case G_TARGETTEMP: |
380 |
|
switch( the_type ){ |
381 |
|
|
404 |
|
break; |
405 |
|
} |
406 |
|
break; |
407 |
+ |
|
408 |
+ |
case G_ORTHOBOXTOLERANCE: |
409 |
+ |
switch( the_type ){ |
410 |
+ |
|
411 |
+ |
case STRING: |
412 |
+ |
the_event->err_msg = |
413 |
+ |
strdup( "Global error. orthoBoxTolerance is not a double or int.\n" ); |
414 |
+ |
return 0; |
415 |
+ |
break; |
416 |
+ |
|
417 |
+ |
case DOUBLE: |
418 |
+ |
orthoBoxTolerance = the_event->evt.asmt.rhs.dval; |
419 |
+ |
have_target_temp = 1; |
420 |
+ |
return 1; |
421 |
+ |
break; |
422 |
+ |
|
423 |
+ |
case INT: |
424 |
+ |
orthoBoxTolerance = (double)the_event->evt.asmt.rhs.ival; |
425 |
+ |
have_target_temp = 1; |
426 |
+ |
return 1; |
427 |
+ |
break; |
428 |
+ |
|
429 |
+ |
default: |
430 |
+ |
the_event->err_msg = |
431 |
+ |
strdup( "Global error.orthoBoxTolerance unrecognized.\n" ); |
432 |
+ |
return 0; |
433 |
+ |
break; |
434 |
+ |
} |
435 |
+ |
break; |
436 |
|
|
437 |
|
case G_ENSEMBLE: |
438 |
|
if( the_type == STRING ){ |
771 |
|
} |
772 |
|
break; |
773 |
|
|
774 |
< |
case G_THERMALTIME: |
774 |
> |
case G_RESETTIME: |
775 |
> |
switch( the_type ){ |
776 |
> |
|
777 |
> |
case STRING: |
778 |
> |
the_event->err_msg = |
779 |
> |
strdup( "Global error. resetTime is not a double or int.\n" ); |
780 |
> |
return 0; |
781 |
> |
break; |
782 |
> |
|
783 |
> |
case DOUBLE: |
784 |
> |
resetTime = the_event->evt.asmt.rhs.dval; |
785 |
> |
have_reset_time = 1; |
786 |
> |
return 1; |
787 |
> |
break; |
788 |
> |
|
789 |
> |
case INT: |
790 |
> |
resetTime = (double)the_event->evt.asmt.rhs.ival; |
791 |
> |
have_reset_time = 1; |
792 |
> |
return 1; |
793 |
> |
break; |
794 |
> |
|
795 |
> |
default: |
796 |
> |
the_event->err_msg = |
797 |
> |
strdup( "Global error. resetTime unrecognized.\n" ); |
798 |
> |
return 0; |
799 |
> |
break; |
800 |
> |
} |
801 |
> |
break; |
802 |
> |
|
803 |
> |
case G_THERMALTIME: |
804 |
|
switch( the_type ){ |
805 |
|
|
806 |
|
case STRING: |
919 |
|
case G_TEMPSET: |
920 |
|
if( the_type == STRING ){ |
921 |
|
|
922 |
< |
if( !strcmp( "true", the_event->evt.asmt.rhs.sval )) tempSet = 1; |
923 |
< |
else if( !strcmp( "false", the_event->evt.asmt.rhs.sval )) tempSet = 0; |
922 |
> |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) tempSet = 1; |
923 |
> |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) tempSet = 0; |
924 |
|
else{ |
925 |
|
the_event->err_msg = |
926 |
|
strdup( "Global error. tempSet was not \"true\" or \"false\".\n" ); |
932 |
|
|
933 |
|
the_event->err_msg = |
934 |
|
strdup( "Global error. tempSet was not \"true\" or \"false\".\n" ); |
935 |
+ |
return 0; |
936 |
+ |
break; |
937 |
+ |
|
938 |
+ |
case G_USEINITTIME: |
939 |
+ |
if( the_type == STRING ){ |
940 |
+ |
|
941 |
+ |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useInitTime = 1; |
942 |
+ |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useInitTime = 0; |
943 |
+ |
else{ |
944 |
+ |
the_event->err_msg = |
945 |
+ |
strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" ); |
946 |
+ |
return 0; |
947 |
+ |
} |
948 |
+ |
return 1; |
949 |
+ |
} |
950 |
+ |
|
951 |
+ |
the_event->err_msg = |
952 |
+ |
strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" ); |
953 |
|
return 0; |
954 |
|
break; |
955 |
+ |
|
956 |
+ |
case G_USEINIT_XS_STATE: |
957 |
+ |
if( the_type == STRING ){ |
958 |
+ |
|
959 |
+ |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) |
960 |
+ |
useInitXSstate = 1; |
961 |
+ |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) |
962 |
+ |
useInitXSstate = 0; |
963 |
+ |
else{ |
964 |
+ |
the_event->err_msg = |
965 |
+ |
strdup( "Global error. useInitExtendedSystemState was not \"true\" or \"false\".\n" ); |
966 |
+ |
return 0; |
967 |
+ |
} |
968 |
+ |
return 1; |
969 |
+ |
} |
970 |
|
|
971 |
+ |
the_event->err_msg = |
972 |
+ |
strdup( "Global error. useInitExtendedSystemState was not \"true\" or \"false\".\n" ); |
973 |
+ |
return 0; |
974 |
+ |
break; |
975 |
+ |
|
976 |
|
case G_USEPBC: |
977 |
|
if( the_type == STRING ){ |
978 |
|
|
979 |
< |
if( !strcmp( "true", the_event->evt.asmt.rhs.sval )) usePBC = 1; |
980 |
< |
else if( !strcmp( "false", the_event->evt.asmt.rhs.sval )) usePBC = 0; |
979 |
> |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) usePBC = 1; |
980 |
> |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) usePBC = 0; |
981 |
|
else{ |
982 |
|
the_event->err_msg = |
983 |
|
strdup( "Global error. usePeriodicBoundaryConditions was not \"true\" or \"false\".\n" ); |
994 |
|
case G_USERF: |
995 |
|
if( the_type == STRING ){ |
996 |
|
|
997 |
< |
if( !strcmp( "true", the_event->evt.asmt.rhs.sval )) useRF = 1; |
998 |
< |
else if( !strcmp( "false", the_event->evt.asmt.rhs.sval )) useRF = 0; |
997 |
> |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useRF = 1; |
998 |
> |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useRF = 0; |
999 |
|
else{ |
1000 |
|
the_event->err_msg = |
1001 |
|
strdup( "Global error. useReactionField was not \"true\" or \"false\".\n" ); |
1009 |
|
return 0; |
1010 |
|
break; |
1011 |
|
|
1012 |
+ |
case G_TARGETPRESSURE: |
1013 |
+ |
switch( the_type ){ |
1014 |
+ |
|
1015 |
+ |
case STRING: |
1016 |
+ |
the_event->err_msg = |
1017 |
+ |
strdup( "Global error. targetPressure is not a double or int.\n" ); |
1018 |
+ |
return 0; |
1019 |
+ |
break; |
1020 |
+ |
|
1021 |
+ |
case DOUBLE: |
1022 |
+ |
target_pressure = the_event->evt.asmt.rhs.dval; |
1023 |
+ |
have_target_pressure = 1; |
1024 |
+ |
return 1; |
1025 |
+ |
break; |
1026 |
+ |
|
1027 |
+ |
case INT: |
1028 |
+ |
target_pressure = (double)the_event->evt.asmt.rhs.ival; |
1029 |
+ |
have_target_pressure = 1; |
1030 |
+ |
return 1; |
1031 |
+ |
break; |
1032 |
+ |
|
1033 |
+ |
default: |
1034 |
+ |
the_event->err_msg = |
1035 |
+ |
strdup( "Global error. targetPressure unrecognized.\n" ); |
1036 |
+ |
return 0; |
1037 |
+ |
break; |
1038 |
+ |
} |
1039 |
+ |
break; |
1040 |
|
|
1041 |
+ |
case G_TAUTHERMOSTAT: |
1042 |
+ |
switch( the_type ){ |
1043 |
+ |
|
1044 |
+ |
case STRING: |
1045 |
+ |
the_event->err_msg = |
1046 |
+ |
strdup( "Global error. tauThermostat is not a double or int.\n" ); |
1047 |
+ |
return 0; |
1048 |
+ |
break; |
1049 |
+ |
|
1050 |
+ |
case DOUBLE: |
1051 |
+ |
tau_thermostat = the_event->evt.asmt.rhs.dval; |
1052 |
+ |
have_tau_thermostat = 1; |
1053 |
+ |
return 1; |
1054 |
+ |
break; |
1055 |
+ |
|
1056 |
+ |
case INT: |
1057 |
+ |
tau_thermostat = (double)the_event->evt.asmt.rhs.ival; |
1058 |
+ |
have_tau_thermostat = 1; |
1059 |
+ |
return 1; |
1060 |
+ |
break; |
1061 |
+ |
|
1062 |
+ |
default: |
1063 |
+ |
the_event->err_msg = |
1064 |
+ |
strdup( "Global error. tauThermostat unrecognized.\n" ); |
1065 |
+ |
return 0; |
1066 |
+ |
break; |
1067 |
+ |
} |
1068 |
+ |
break; |
1069 |
+ |
|
1070 |
+ |
case G_TAUBAROSTAT: |
1071 |
+ |
switch( the_type ){ |
1072 |
+ |
|
1073 |
+ |
case STRING: |
1074 |
+ |
the_event->err_msg = |
1075 |
+ |
strdup( "Global error. tauBarostat is not a double or int.\n" ); |
1076 |
+ |
return 0; |
1077 |
+ |
break; |
1078 |
+ |
|
1079 |
+ |
case DOUBLE: |
1080 |
+ |
tau_barostat = the_event->evt.asmt.rhs.dval; |
1081 |
+ |
have_tau_barostat = 1; |
1082 |
+ |
return 1; |
1083 |
+ |
break; |
1084 |
+ |
|
1085 |
+ |
case INT: |
1086 |
+ |
tau_barostat = (double)the_event->evt.asmt.rhs.ival; |
1087 |
+ |
have_tau_barostat = 1; |
1088 |
+ |
return 1; |
1089 |
+ |
break; |
1090 |
+ |
|
1091 |
+ |
default: |
1092 |
+ |
the_event->err_msg = |
1093 |
+ |
strdup( "Global error. tauBarostat unrecognized.\n" ); |
1094 |
+ |
return 0; |
1095 |
+ |
break; |
1096 |
+ |
} |
1097 |
+ |
break; |
1098 |
+ |
|
1099 |
+ |
case G_ZCONSTIME: |
1100 |
+ |
switch( the_type ){ |
1101 |
+ |
|
1102 |
+ |
case STRING: |
1103 |
+ |
the_event->err_msg = |
1104 |
+ |
strdup( "Global error. zcons_time is not a double or int.\n" ); |
1105 |
+ |
return 0; |
1106 |
+ |
break; |
1107 |
+ |
|
1108 |
+ |
case DOUBLE: |
1109 |
+ |
zcons_time = the_event->evt.asmt.rhs.dval; |
1110 |
+ |
have_zcons_time = 1; |
1111 |
+ |
return 1; |
1112 |
+ |
break; |
1113 |
+ |
|
1114 |
+ |
case INT: |
1115 |
+ |
zcons_time = (double)the_event->evt.asmt.rhs.ival; |
1116 |
+ |
have_zcons_time = 1; |
1117 |
+ |
return 1; |
1118 |
+ |
break; |
1119 |
+ |
|
1120 |
+ |
default: |
1121 |
+ |
the_event->err_msg = |
1122 |
+ |
strdup( "Global error. zcons_time unrecognized.\n" ); |
1123 |
+ |
return 0; |
1124 |
+ |
break; |
1125 |
+ |
} |
1126 |
+ |
break; |
1127 |
+ |
|
1128 |
+ |
case G_ZCONSTOL: |
1129 |
+ |
switch( the_type ){ |
1130 |
+ |
|
1131 |
+ |
case STRING: |
1132 |
+ |
the_event->err_msg = |
1133 |
+ |
strdup( "Global error. zcons_tol is not a double or int.\n" ); |
1134 |
+ |
return 0; |
1135 |
+ |
break; |
1136 |
+ |
|
1137 |
+ |
case DOUBLE: |
1138 |
+ |
zcons_tol = the_event->evt.asmt.rhs.dval; |
1139 |
+ |
have_zcons_tol = 1; |
1140 |
+ |
return 1; |
1141 |
+ |
break; |
1142 |
+ |
|
1143 |
+ |
case INT: |
1144 |
+ |
zcons_tol = (double)the_event->evt.asmt.rhs.ival; |
1145 |
+ |
have_zcons_tol = 1; |
1146 |
+ |
return 1; |
1147 |
+ |
break; |
1148 |
+ |
|
1149 |
+ |
default: |
1150 |
+ |
the_event->err_msg = |
1151 |
+ |
strdup( "Global error. zcons_ol unrecognized.\n" ); |
1152 |
+ |
return 0; |
1153 |
+ |
break; |
1154 |
+ |
} |
1155 |
+ |
break; |
1156 |
+ |
|
1157 |
+ |
case G_ZCONSFORCEPOLICY: |
1158 |
+ |
switch( the_type ){ |
1159 |
+ |
|
1160 |
+ |
case STRING: |
1161 |
+ |
strcpy(zconsForcePolicy, the_event->evt.asmt.rhs.sval); |
1162 |
+ |
|
1163 |
+ |
for(int i = 0; zconsForcePolicy[i] != '\0'; i++) |
1164 |
+ |
{ |
1165 |
+ |
zconsForcePolicy[i] = toupper(zconsForcePolicy[i]); |
1166 |
+ |
} |
1167 |
+ |
have_zcons_force_policy = 1; |
1168 |
+ |
return 1; |
1169 |
+ |
break; |
1170 |
+ |
|
1171 |
+ |
case DOUBLE: |
1172 |
+ |
the_event->err_msg = |
1173 |
+ |
strdup( "Global error. zconsForcePolicy is not a double or int.\n" ); |
1174 |
+ |
return 0; |
1175 |
+ |
break; |
1176 |
+ |
|
1177 |
+ |
case INT: |
1178 |
+ |
the_event->err_msg = |
1179 |
+ |
strdup( "Global error. zconsForcePolicy is not a double or int.\n" ); |
1180 |
+ |
return 0; |
1181 |
+ |
break; |
1182 |
+ |
|
1183 |
+ |
default: |
1184 |
+ |
the_event->err_msg = |
1185 |
+ |
strdup( "Global error. zconsForcePolicy unrecognized.\n" ); |
1186 |
+ |
return 0; |
1187 |
+ |
break; |
1188 |
+ |
} |
1189 |
+ |
break; |
1190 |
+ |
// add more token cases here. |
1191 |
+ |
case G_SEED: |
1192 |
+ |
switch( the_type ){ |
1193 |
+ |
|
1194 |
+ |
case STRING: |
1195 |
+ |
the_event->err_msg = |
1196 |
+ |
strdup( "Global error. seed is not a string.\n" ); |
1197 |
+ |
return 0; |
1198 |
+ |
return 0; |
1199 |
+ |
break; |
1200 |
+ |
|
1201 |
+ |
case DOUBLE: |
1202 |
+ |
have_seed = 1; |
1203 |
+ |
seed = (int)the_event->evt.asmt.rhs.dval; |
1204 |
+ |
return 1; |
1205 |
+ |
break; |
1206 |
+ |
|
1207 |
+ |
case INT: |
1208 |
+ |
have_seed = 1; |
1209 |
+ |
seed = the_event->evt.asmt.rhs.ival ; |
1210 |
+ |
return 1; |
1211 |
+ |
break; |
1212 |
+ |
|
1213 |
+ |
default: |
1214 |
+ |
the_event->err_msg = |
1215 |
+ |
strdup( "Global error. seed unrecognized.\n" ); |
1216 |
+ |
return 0; |
1217 |
+ |
break; |
1218 |
+ |
} |
1219 |
+ |
break; |
1220 |
+ |
// add more token cases here. |
1221 |
+ |
|
1222 |
|
} |
1223 |
|
} |
1224 |
|
|