tcl wrapper (no need to have tcl.h to build ngsolve)

This commit is contained in:
mhochsteger@cerbsim.com 2021-10-11 16:04:00 +02:00
parent 5fc8f4b2c4
commit dbd9c34d17
3 changed files with 51 additions and 1 deletions

View File

@ -14,7 +14,7 @@ endif(WIN32)
if(USE_GUI)
add_library(gui SHARED
gui.cpp ngpkg.cpp demoview.cpp parallelfunc.cpp
gui.cpp ngpkg.cpp demoview.cpp parallelfunc.cpp ngtcl.cpp
../libsrc/stlgeom/stlpkg.cpp ../libsrc/visualization/visualpkg.cpp
../libsrc/csg/csgpkg.cpp ../libsrc/geom2d/geom2dpkg.cpp
../libsrc/occ/occpkg.cpp ../libsrc/occ/vsocc.cpp
@ -83,5 +83,9 @@ if(USE_GUI)
endif()
add_subdirectory(Togl2.1)
install(FILES
ngtcl.hpp
DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel
)
endif(USE_GUI)

16
ng/ngtcl.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "ngtcl.hpp"
#include <inctcl.hpp>
namespace netgen
{
void Ng_Tcl_SetResult(Tcl_Interp *interp, char *result, const int freeProc)
{
Tcl_SetResult(interp, result, (Tcl_FreeProc*)freeProc);
}
void Ng_Tcl_CreateCommand(Tcl_Interp *interp, const char *cmdName, Tcl_CmdProc *proc)
{
Tcl_CreateCommand(interp, cmdName, proc, nullptr, nullptr);
}
}

30
ng/ngtcl.hpp Normal file
View File

@ -0,0 +1,30 @@
#ifndef FILE_NG_TCL_HPP
#define FILE_NG_TCL_HPP
#include <myadt.hpp>
class Tcl_Interp;
class Tcl_cmdProc;
namespace netgen
{
typedef int (Tcl_CmdProc) (void * clientData, Tcl_Interp *interp,
int argc, const char *argv[]);
inline constexpr int NG_TCL_VOLATILE = 1;
inline constexpr int NG_TCL_STATIC = 0;
inline constexpr int NG_TCL_DYNAMIC = 3;
inline constexpr int NG_TCL_OK = 0;
inline constexpr int NG_TCL_ERROR = 1;
inline constexpr int NG_TCL_RETURN = 2;
inline constexpr int NG_TCL_BREAK = 3;
inline constexpr int NG_TCL_CONTINUE = 4;
DLL_HEADER void Ng_Tcl_SetResult(Tcl_Interp *interp, char *result, const int freeProc);
DLL_HEADER void Ng_Tcl_CreateCommand(Tcl_Interp *interp,
const char *cmdName, Tcl_CmdProc *proc);
}
#endif // FILE_NG_TCL_HPP