71 |
* Global variables used by the main program: |
* Global variables used by the main program: |
72 |
*/ |
*/ |
73 |
|
|
74 |
static Tk_Window mainWindow; /* The main window for the application. If |
/* static Tk_Window mainWindow; The main window for the application. If |
75 |
* NULL then the application no longer |
* NULL then the application no longer |
76 |
* exists. */ |
* exists. */ |
77 |
static Tcl_Interp *interp; /* Interpreter for this application. */ |
static Tcl_Interp *interp; /* Interpreter for this application. */ |
190 |
int argc; /* Number of arguments. */ |
int argc; /* Number of arguments. */ |
191 |
char **argv; /* Array of argument strings. */ |
char **argv; /* Array of argument strings. */ |
192 |
{ |
{ |
193 |
char *args, *p, *msg; |
char *args, *p; |
194 |
|
const char *msg; |
195 |
char buf[20]; |
char buf[20]; |
196 |
int code; |
int code; |
197 |
|
|
204 |
* Parse command-line arguments. |
* Parse command-line arguments. |
205 |
*/ |
*/ |
206 |
|
|
207 |
if (Tk_ParseArgv(interp, (Tk_Window) NULL, &argc, argv, argTable, 0) |
if (Tk_ParseArgv(interp, (Tk_Window) NULL, &argc, (const char **)argv, argTable, 0) |
208 |
!= TCL_OK) { |
!= TCL_OK) { |
209 |
fprintf(stderr, "%s\n", interp->result); |
fprintf(stderr, "%s\n", interp->result); |
210 |
exit(1); |
exit(1); |
237 |
* Initialize the Tk application. |
* Initialize the Tk application. |
238 |
*/ |
*/ |
239 |
|
|
240 |
mainWindow = TkCreateMainWindow(interp, display, name/* , "Tk" */); |
/* mainWindow = TkCreateMainWindow(interp, display, name/\* , "Tk" *\/); */ |
241 |
if (mainWindow == NULL) { |
/* if (mainWindow == NULL) { */ |
242 |
fprintf(stderr, "%s\n", interp->result); |
/* fprintf(stderr, "%s\n", interp->result); */ |
243 |
exit(1); |
/* exit(1); */ |
244 |
} |
/* } */ |
245 |
#ifndef __MINGW32__ |
/* #ifndef __MINGW32__ */ |
246 |
if (synchronize) { |
/* if (synchronize) { */ |
247 |
XSynchronize(Tk_Display(mainWindow), True); |
/* XSynchronize(Tk_Display(mainWindow), True); */ |
248 |
} |
/* } */ |
249 |
#endif |
/* #endif */ |
250 |
Tk_GeometryRequest(mainWindow, 200, 200); |
/* Tk_GeometryRequest(mainWindow, 200, 200); */ |
251 |
Tk_UnmapWindow(mainWindow); |
/* Tk_UnmapWindow(mainWindow); */ |
252 |
|
|
253 |
/* |
/* |
254 |
* Make command-line arguments available in the Tcl variables "argc" |
* Make command-line arguments available in the Tcl variables "argc" |
256 |
* specified on the command line. |
* specified on the command line. |
257 |
*/ |
*/ |
258 |
|
|
259 |
args = Tcl_Merge(argc-1, argv+1); |
args = Tcl_Merge(argc-1, (const char **)argv+1); |
260 |
Tcl_SetVar(interp, "argv", args, TCL_GLOBAL_ONLY); |
Tcl_SetVar(interp, "argv", args, TCL_GLOBAL_ONLY); |
261 |
ckfree(args); |
ckfree(args); |
262 |
sprintf(buf, "%d", argc-1); |
sprintf(buf, "%d", argc-1); |
280 |
* interpreter. |
* interpreter. |
281 |
*/ |
*/ |
282 |
|
|
283 |
#ifdef SQUARE_DEMO |
/* #ifdef SQUARE_DEMO */ |
284 |
Tcl_CreateCommand(interp, "square", SquareCmd, (ClientData) mainWindow, |
/* Tcl_CreateCommand(interp, "square", SquareCmd, (ClientData) mainWindow, */ |
285 |
(void (*)()) NULL); |
/* (void (*)()) NULL); */ |
286 |
#endif |
/* #endif */ |
287 |
|
|
288 |
/* |
/* |
289 |
* Invoke application-specific initialization. |
* Invoke application-specific initialization. |
397 |
{ |
{ |
398 |
|
|
399 |
if (being_set_by_lisp == 0) |
if (being_set_by_lisp == 0) |
400 |
{ char *val = Tcl_GetVar2(interp,name1,name2, TCL_GLOBAL_ONLY); |
{ const char *val = Tcl_GetVar2(interp,name1,name2, TCL_GLOBAL_ONLY); |
401 |
char buf[3]; |
char buf[3]; |
402 |
STORE_3BYTES(buf,(long) clientData); |
STORE_3BYTES(buf,(long) clientData); |
403 |
if(sock_write_str2(dsfd, m_set_lisp_loc, buf, 3 , |
if(sock_write_str2(dsfd, m_set_lisp_loc, buf, 3 , |