1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
/* ts.c - Mainmodul ts */
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <tk.h>
#define TS_VERSION "1998/02"
/* Prototypes of functions defined in exec.et */
extern int StartTty();
extern int InstallCommandsExec();
extern int CreateTerm();
extern void KillAllProcesses();
int main(int argc, char **argv)
{
Et_Init(&argc, argv);
ET_INSTALL_COMMANDS;
InstallCommandsExec();
Tcl_SetVar(Et_Interp, "TS_BASE", TS_BASE, 0);
Tcl_SetVar(Et_Interp, "TS_VERSION", TS_VERSION, 0);
#ifdef DEBUG
Tcl_SetVar2(Et_Interp, "params", "debug", "1", 0);
#else
Tcl_SetVar2(Et_Interp, "params", "debug", "0", 0);
#endif
ET_INCLUDE(ts_dlg.tcl);
ET_INCLUDE(ts_editopt.tcl);
ET_INCLUDE(ts_filedlg.tcl);
ET_INCLUDE(html_library.tcl);
ET_INCLUDE(ts_help.tcl);
ET_INCLUDE(ts_opt.tcl);
ET_INCLUDE(ts_optmenu.tcl);
ET_INCLUDE(ts_prtdlg.tcl);
ET_INCLUDE(ts_ide.tcl);
ET_INCLUDE(ts_edit.tcl);
ET_INCLUDE(ts_term.tcl);
ET_INCLUDE(ts.tcl);
ET_INCLUDE(ts_param.tcl);
ET_INCLUDE(ts_prj.tcl);
ET_INCLUDE(ts_template.tcl);
StartTty();
ET(main);
#ifdef DEBUG
Et_ReadStdin();
#endif
Et_MainLoop();
KillAllProcesses();
return 0;
}
ET_PROC( CreateTerm )
{
CreateTerm();
return ET_OK;
}
ET_PROC( cutdir )
{
char *prim_dir, *dir;
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " path\"", 0);
return ET_ERROR;
}
prim_dir = Tcl_GetVar2(interp, "params", "Primary_dir", TCL_GLOBAL_ONLY);
if (strncmp(prim_dir, argv[1], strlen(prim_dir)) == 0) {
dir = argv[1]+strlen(prim_dir);
if (*dir == '/') dir++;
} else
dir = argv[1];
Tcl_AppendResult(interp, dir, 0);
return ET_OK;
}
ET_PROC( sync )
{
sync();
return ET_OK;
}
ET_PROC( chkcode )
{
char c;
int i, esc;
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " string codechar\"", 0);
return ET_ERROR;
}
c = argv[2][0];
for (i = 0,esc = 0; argv[1][i]; i++) {
if (argv[1][i] == '\\') esc = !esc;
else {
if (!esc && argv[1][i] == c) {
sprintf(interp->result, "%d", i);
return ET_OK;
}
esc = 0;
}
}
Tcl_SetResult(interp, "-1",0);
return ET_OK;
}
|