mirror of
https://github.com/NGSolve/netgen.git
synced 2025-02-04 09:00:33 +05:00
setting command line args via Tcl
This commit is contained in:
parent
b1ea81b401
commit
dace165496
27
ng/ngpkg.cpp
27
ng/ngpkg.cpp
@ -1263,6 +1263,28 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
int Ng_SetCommandLineParameter (ClientData clientData,
|
||||
Tcl_Interp * interp,
|
||||
int argc, tcl_const char *argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
Tcl_SetResult (interp, (char*)"Ng_SetCommandLineParameter needs 1 parameter",
|
||||
TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (argv[1][0] == '-')
|
||||
parameters.SetCommandLineFlag (argv[1]);
|
||||
else
|
||||
{
|
||||
if (strstr(argv[1], ".py"))
|
||||
parameters.SetFlag ("py", argv[1]);
|
||||
else
|
||||
parameters.SetFlag ("geofile", argv[1]);
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
int Ng_GetCommandLineParameter (ClientData clientData,
|
||||
@ -3032,6 +3054,11 @@ void PlayAnimFile(const char* name, int speed, int maxcnt)
|
||||
(ClientData)NULL,
|
||||
(Tcl_CmdDeleteProc*) NULL);
|
||||
|
||||
Tcl_CreateCommand (interp, "Ng_SetCommandLineParameter",
|
||||
Ng_SetCommandLineParameter,
|
||||
(ClientData)NULL,
|
||||
(Tcl_CmdDeleteProc*) NULL);
|
||||
|
||||
Tcl_CreateCommand (interp, "Ng_GetCommandLineParameter",
|
||||
Ng_GetCommandLineParameter,
|
||||
(ClientData)NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user