--- /dev/null
+WOKTCL_CMPLRS.edl
+WOKTCL_DefaultCommand.cxx
+WOKTCL_DefaultCommand.hxx
+WOKTCL_TriggerHandler.cxx
+WOKTCL_TriggerHandler.hxx
+
+
--- /dev/null
+-- File: WOKTCL.cdl
+-- Created: Fri Aug 11 11:33:51 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+package WOKTCL
+
+ ---Purpose:
+
+uses
+
+ WOKTclTools,
+ WOKTools,
+ WOKAPI
+
+is
+
+ class Interpretor;
+
+ ---class LocatorTable
+ --- instantiates HandleTable from WOKTclTools ( Locator from WOKAPI );
+
+end WOKTCL;
--- /dev/null
+-- File: WOKTCL_CMPLRS.edl
+-- Author: Stagiaire Pascal BABIN
+-- History: Tue Jul 9 13:44:05 1996 Stagiaire Pascal BABIN Creation
+-- Copyright: Matra Datavision 1996
+
+@ifnotdefined ( %WOKTCL_CMPLRS_EDL) then
+@set %WOKTCL_CMPLRS_EDL = "";
+
+@if ( (%Station != "wnt") && (%Station != "hp") ) then
+ @string %CMPLRS_CXX_Options = " -I/usr/tcltk/include -I/usr/tcltk/include/itcl -I/usr/include " %CMPLRS_CXX_Options ;
+@endif;
+
+@if ( %Station == "hp" ) then
+ @string %CMPLRS_CXX_Options = " -I/usr/tcltk/include -I/usr/tcltk/include/itcl " %CMPLRS_CXX_Options ;
+@endif;
+
+@if ( %Station == "wnt" ) then
+ @string %CMPLRS_CXX_Options = %CMPLRS_CXX_Options " -ID:/DevTools/TclTk/include ";
+@endif;
+
+@endif;
--- /dev/null
+// File: WOKTCL_DefaultCommand.cxx
+// Created: Mon Oct 28 17:29:44 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+
+#ifdef WNT
+# ifdef TCL_VERSION_75
+# pragma comment( lib, "tcl75.lib" )
+# pragma message( "Information: tcl75.lib is using as TCL library" )
+# include <tcl75.h>
+# elif defined( TCL_VERSION_76 )
+# pragma comment( lib, "tcl76.lib" )
+# pragma message( "Information: tcl76.lib is using as TCL library" )
+# else
+# pragma comment( lib, "tcl76i.lib" )
+# pragma message( "Information: tcl76i.lib is using as TCL library" )
+# endif // TCL75
+#endif // WNT
+
+#include <tcl.h>
+
+#include <strstream.h>
+
+#include <Standard_ErrorHandler.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <WOKTools_StringValue.hxx>
+#include <WOKTools_EnvValue.hxx>
+#include <WOKTools_ChDirValue.hxx>
+#include <WOKTools_Messages.hxx>
+
+#ifdef WNT
+#include <WOKUtils_ShellManager.hxx>
+#define WOKUtils_ProcessManager WOKUtils_ShellManager
+#else
+#include <WOKUtils_ProcessManager.hxx>
+#endif // WNT
+
+#include <WOKAPI_Session.hxx>
+#include <WOKAPI_APICommand.hxx>
+
+#include <WOKTCL_Interpretor.hxx>
+
+#include <WOKTCL_DefaultCommand.hxx>
+
+
+#ifndef WOK_SESSION_KEEP
+#define WOK_SESSION_KEEP 1
+#endif
+
+extern Standard_IMPORT Handle(WOKTclTools_Interpretor) CurrentInterp;
+
+Standard_Integer DefaultCommand(ClientData clientData, Tcl_Interp *,
+ Standard_Integer argc, char* argv[])
+{
+ Standard_Integer status;
+
+ CData* C = (CData*) clientData;
+
+ // set de l'interprete en cours
+ CurrentInterp = C->i;
+
+ WOKAPI_APICommand acmd = C->f;
+
+#ifndef WOK_SESSION_KEEP
+ WOKAPI_Session* asess = (WOKAPI_Session *) &(C->i->Session());
+ asess->Open();
+#endif
+
+ try {
+
+ WOKTools_Return returns;
+
+ WOKUtils_ProcessManager::Arm();
+
+ // appel de la fonction API
+ if(!(*acmd)(C->i->Session(), argc, argv, returns))
+ {
+ if(!C->i->TreatReturn(returns))
+ {
+ WOKUtils_ProcessManager::UnArm();
+ status = TCL_OK;
+ }
+ }
+ else
+ {
+ WOKUtils_ProcessManager::UnArm();
+ status = TCL_ERROR;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) E = Standard_Failure::Caught();
+
+ strstream astream;
+ astream << E << ends;
+
+ ErrorMsg << argv[0] << "Exception was raised : " << astream.str() << endm;
+
+ WOKAPI_Session* asess = (WOKAPI_Session *) &(C->i->Session());
+ asess->GeneralFailure(E);
+
+ WOKUtils_ProcessManager::UnArm();
+
+ status = TCL_ERROR;
+ }
+
+#ifndef WOK_SESSION_KEEP
+ asess->Close();
+#endif
+
+ return status;
+}
+
+void DefaultCommandDelete (ClientData clientData)
+{
+ CData *C = (CData*) clientData;
+ delete C;
+}
+
+
--- /dev/null
+// File: WOKTCL_DefaultCommand.hxx
+// Created: Mon Oct 28 17:28:26 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#ifndef WOKTCL_DefaultCommand_HeaderFile
+#define WOKTCL_DefaultCommand_HeaderFile
+
+
+struct CData {
+ CData(WOKAPI_APICommand ff, Handle(WOKTCL_Interpretor) ii) : f(ff), i(ii) {}
+ WOKAPI_APICommand f;
+ Handle(WOKTCL_Interpretor) i;
+};
+
+
+Standard_Integer DefaultCommand(ClientData , Tcl_Interp *,
+ Standard_Integer , char* []);
+
+void DefaultCommandDelete (ClientData );
+
+#endif
--- /dev/null
+-- File: WOKTCL_Interpretor.cdl
+-- Created: Mon Apr 1 12:48:53 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1996
+
+class Interpretor from WOKTCL
+inherits Interpretor from WOKTclTools
+
+ ---Purpose:
+
+uses
+ Return from WOKTools,
+ PInterp from WOKTclTools,
+ Session from WOKAPI,
+ APICommand from WOKAPI
+
+is
+
+ Create returns Interpretor from WOKTCL;
+ Create(anInterp : PInterp from WOKTclTools) returns Interpretor from WOKTCL;
+
+ Add(me : mutable; Command : CString;
+ Help : CString;
+ Function : APICommand from WOKAPI;
+ Group : CString = "WOK Command");
+
+ Session(me)
+ ---C++: return const &
+ returns Session from WOKAPI;
+
+ ChangeSession(me:mutable)
+ ---C++: return &
+ returns Session from WOKAPI;
+
+
+fields
+
+ mysession : Session from WOKAPI;
+
+end Interpretor;
--- /dev/null
+// File: WOKTCL_Interpretor.cxx
+// Created: Mon Apr 1 19:26:43 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#if defined( WNT ) && defined( TCL_VERSION_75 )
+# include <tcl75.h>
+#endif // WNT
+
+#include <tcl.h>
+#include <strstream.h>
+
+#include <WOKTools_StringValue.hxx>
+#include <WOKTools_EnvValue.hxx>
+#include <WOKTools_ChDirValue.hxx>
+#include <WOKTools_Messages.hxx>
+
+#ifdef WNT
+#include <WOKUtils_ShellManager.hxx>
+#define WOKUtils_ProcessManager WOKUtils_ShellManager
+#else
+#include <WOKUtils_ProcessManager.hxx>
+#endif // WNT
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_ErrorHandler.hxx>
+
+
+#include <WOKTCL_Interpretor.ixx>
+
+
+#include <WOKTCL_DefaultCommand.hxx>
+
+extern Standard_IMPORT Handle(WOKTclTools_Interpretor) CurrentInterp;
+
+//=======================================================================
+//function : WOKTCL_Interpretor
+//purpose :
+//=======================================================================
+WOKTCL_Interpretor::WOKTCL_Interpretor()
+{
+}
+//=======================================================================
+//function : WOKTCL_Interpretor
+//purpose :
+//=======================================================================
+WOKTCL_Interpretor::WOKTCL_Interpretor(const WOKTclTools_PInterp& p)
+: WOKTclTools_Interpretor(p)
+{
+}
+
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+void WOKTCL_Interpretor::Add(const Standard_CString Command,
+ const Standard_CString Help,
+ const WOKAPI_APICommand& Function,
+ const Standard_CString Group)
+{
+ CData* C = new CData(Function,this);
+
+ Tcl_CreateCommand(Interp(), Command, DefaultCommand, (ClientData) C, DefaultCommandDelete);
+
+ // add the help
+ Tcl_SetVar2(Interp(),"WOKTCL_Helps", Command,Help,TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(Interp(),"WOKTCL_Groups",Group,Command,
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+}
+
+
+
+//=======================================================================
+//function : Session
+//purpose :
+//=======================================================================
+const WOKAPI_Session& WOKTCL_Interpretor::Session() const
+{
+ return mysession;
+}
+
+//=======================================================================
+//function : Session
+//purpose :
+//=======================================================================
+WOKAPI_Session& WOKTCL_Interpretor::ChangeSession()
+{
+ return mysession;
+}
+
--- /dev/null
+// File: WOKTCL_TriggerHandler.cxx
+// Created: Thu Nov 14 17:19:45 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+
+#include <WOKUtils_Trigger.hxx>
+#include <WOKTools_Messages.hxx>
+#include <WOKTools_Return.hxx>
+#include <WOKTools_StringValue.hxx>
+#include <WOKTools_InterpFileValue.hxx>
+
+
+
+#include <WOKTclTools_Interpretor.hxx>
+
+#if defined( WNT ) && defined( TCL_VERSION_75 )
+# include <tcl75.h>
+#endif // WNT
+
+#include <tcl.h>
+
+extern Standard_IMPORT Handle(WOKTclTools_Interpretor) CurrentInterp;
+
+Standard_EXPORT WOKUtils_TriggerStatus WOKTCL_TriggerHandler(WOKUtils_Trigger &atrigger)
+{
+ Standard_Integer i;
+
+ const WOKTools_Return& args = atrigger.Args();
+
+ for(i = 1; i <= args.Length() ; i++)
+ {
+ Handle(WOKTools_ReturnValue) avalue = args.Value(i);
+
+ switch(avalue->Type())
+ {
+ case WOKTools_InterpFile:
+ {
+ Handle(WOKTools_InterpFileValue) afile = Handle(WOKTools_InterpFileValue)::DownCast(avalue);
+
+ if(afile->InterpType() == WOKTools_TclInterp)
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_TRIGGER") << "WOKTCL_TriggerHandler"
+ << "LoadFile : " << afile->File() << endm;
+ }
+ CurrentInterp->EvalFile(afile->File()->ToCString());
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if(!atrigger.Name().IsNull())
+ {
+ if(CurrentInterp->IsCmdName(atrigger.Name()->ToCString()))
+ {
+ Handle(TCollection_HAsciiString) acmd = new TCollection_HAsciiString(atrigger.Name());
+
+ WOK_TRACE {
+ VerboseMsg("WOK_TRIGGER") << "WOKTCL_TriggerHandler" << "Handler called for trigger : " << atrigger.Name() << endm;
+
+ // Prise en compte des resultats
+ const WOKTools_Return& args = atrigger.Args();
+
+ for(i = 1; i <= args.Length() ; i++)
+ {
+ Handle(WOKTools_ReturnValue) avalue = args.Value(i);
+
+ switch(avalue->Type())
+ {
+ case WOKTools_String:
+ {
+ Handle(WOKTools_StringValue) astrval = Handle(WOKTools_StringValue)::DownCast(avalue);
+ VerboseMsg("WOK_TRIGGER") << "WOKTCL_TriggerHandler" << "Arg " << i << " is : " << astrval->Value() << endm;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ for(i = 1; i <= args.Length() ; i++)
+ {
+ Handle(WOKTools_ReturnValue) avalue = args.Value(i);
+
+ switch(avalue->Type())
+ {
+ case WOKTools_String:
+ {
+ Handle(WOKTools_StringValue) astrval = Handle(WOKTools_StringValue)::DownCast(avalue);
+ acmd->AssignCat(" \"");
+ acmd->AssignCat(astrval->Value());
+ acmd->AssignCat("\"");
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ WOK_TRACE {
+ VerboseMsg("WOK_TRIGGER") << "WOKTCL_TriggerHandler"
+ << "Command is : " << acmd << endm;
+ }
+ if(CurrentInterp->Eval(acmd->ToCString()))
+ return WOKUtils_Failed;
+ else
+ {
+ CurrentInterp->GetReturnValues(atrigger.ChangeReturn());
+ WOK_TRACE {
+ if(VerboseMsg("WOK_TRIGGER").IsSet())
+ {
+ Standard_Integer i;
+ VerboseMsg << "WOKTCL_TriggerHandler"
+ << "Command returns : " << endm;
+
+ const WOKTools_Return& rets = atrigger.Return();
+
+ for(i=1; i<=rets.Length(); i++)
+ {
+ Handle(WOKTools_ReturnValue) aval = rets.Value(i);
+
+ VerboseMsg << "WOKTCL_TriggerHandler"
+ << " ";
+
+ switch(aval->Type())
+ {
+ case WOKTools_String:
+ {
+ Handle(WOKTools_StringValue) astrval = Handle(WOKTools_StringValue)::DownCast(aval);
+ VerboseMsg << "WOKTCL_TriggerHandler"
+ << " " << i << " : " << astrval->Value() << endm;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ return WOKUtils_Succeeded;
+ }
+ else
+ {
+#ifdef WOK_VERBOSE
+ VerboseMsg("WOK_TRIGGER") << "WOKTCL_TriggerHandler"
+ << "Trigger : " << atrigger.Name() << " not setted" << endm;
+#endif
+ return WOKUtils_NotSetted;
+ }
+ }
+ else
+ {
+#ifdef WOK_VERBOSE
+ VerboseMsg("WOK_TRIGGER") << "WOKTCL_TriggerHandler"
+ << "No Trigger Name" << endm;
+#endif
+ return WOKUtils_NotSetted;
+ }
+}
+
+
--- /dev/null
+// File: WOKTCL_TriggerHandler.hxx
+// Created: Wed Nov 20 16:17:39 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#ifndef WOKTCL_TriggerHandler_HeaderFile
+#define WOKTCL_TriggerHandler_HeaderFile
+
+
+class WOKUtils_Trigger;
+
+#include <WOKUtils_TriggerStatus.hxx>
+
+WOKUtils_TriggerStatus WOKTCL_TriggerHandler(WOKUtils_Trigger &atrigger);
+
+#endif