MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / OpenSeesParseArgv

Function OpenSeesParseArgv

SRC/tcl/commands.cpp:10200–10275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10198}
10199
10200extern "C" int OpenSeesParseArgv(int argc, char **argv)
10201{
10202 if (argc > 1) {
10203 int currentArg = 1;
10204 while (currentArg < argc && argv[currentArg] != NULL) {
10205
10206 if ((strcmp(argv[currentArg], "-par") == 0) || (strcmp(argv[currentArg], "-Par") == 0)) {
10207
10208 if (argc > (currentArg+2)) {
10209
10210 char *parName = argv[currentArg+1];
10211 char *parValue = argv[currentArg+2];
10212
10213 // add a OpenSeesTcl_Parameter to end of list of parameters
10214 OpenSeesTcl_Parameter *nextParam = new OpenSeesTcl_Parameter;
10215 nextParam->name = new char [strlen(parName)+1];
10216 strcpy(nextParam->name, parName);
10217 nextParam->values = 0;
10218
10219 if (theParameters == 0)
10220 theParameters = nextParam;
10221 if (endParameters != 0)
10222 endParameters->next = nextParam;
10223 nextParam->next = 0;
10224 endParameters = nextParam;
10225
10226 // now open par values files to create the values
10227 char nextLine[1000];
10228 FILE *valueFP = fopen(parValue,"r");
10229 if (valueFP != 0) {
10230 OpenSeesTcl_ParameterValues *endValues = 0;
10231
10232 while (fscanf(valueFP, "%s", nextLine) != EOF) {
10233
10234 OpenSeesTcl_ParameterValues *nextValue = new OpenSeesTcl_ParameterValues;
10235 nextValue->value = new char [strlen(nextLine)+1];
10236 strcpy(nextValue->value, nextLine);
10237
10238 if (nextParam->values == 0) {
10239 nextParam->values = nextValue;
10240 }
10241 if (endValues != 0)
10242 endValues->next = nextValue;
10243 endValues = nextValue;
10244 nextValue->next = 0;
10245 }
10246 fclose(valueFP);
10247 } else {
10248
10249 OpenSeesTcl_ParameterValues *nextValue = new OpenSeesTcl_ParameterValues;
10250 nextValue->value = new char [strlen(parValue)+1];
10251
10252 strcpy(nextValue->value, parValue);
10253
10254 nextParam->values = nextValue;
10255 nextValue->next = 0;
10256
10257 }

Callers 4

tclMain.cppFile · 0.85
Tk_MainOpenSeesFunction · 0.85
tclMain85.cppFile · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected