File: PowInit.c

package info (click to toggle)
ftools-fv 5.5.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,076 kB
  • sloc: tcl: 50,770; ansic: 17,858; exp: 2,004; makefile: 172; cpp: 169; sh: 113; csh: 10
file content (560 lines) | stat: -rw-r--r-- 20,078 bytes parent folder | download | duplicates (4)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
#ifdef __WIN32__
#include <windows.h>
#endif
#include "pow.h"
#include "stretcharrow.xbm"

	   
/*
 *----------------------------------------------------------------------
 *
 * DllEntryPoint --
 *
 *	This wrapper function is used by Windows to invoke the
 *	initialization code for the DLL.  If we are compiling
 *	with Visual C++, this routine will be renamed to DllMain.
 *	routine.
 *
 * Results:
 *	Returns TRUE;
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

#ifdef __WIN32__
int WINAPI
dllEntry(HANDLE hDll, DWORD reason, LPVOID reserved)
{
    return TRUE;
}
#endif
 

int pixelSizes[6] = {1,2,4,4,8,8};
char *WCSpih_Message[] = { "Success.",
                           "Null wcsprm pointer passed.",
                           "Memory allocation failed.",
                           "Linear transformation matrix is singular.",
                           "Inconsistent or unrecognized coordinate axis types.",
                           "Invalid parameter value.",
                           "Invalid coordinate transformation parameters.",
                           "Ill-conditioned coordinate transformation parameters.",
                           "One or more of the world coordinates were invalid." };

char *WCStrans_Message[] = {
                          "Success",
                          "Null wcsprm pointer passed",
                          "Memory allocation failed",
                          "Linear transformation matrix is singular",
                          "Inconsistent or unrecognized coordinate axis types",
                          "Invalid parameter value",
                          "Invalid coordinate transformation parameters",
                          "Ill-conditioned coordinate transformation parameters",
                          "One or more of the pixel coordinates were invalid",
                          "One or more of the world coordinates were invalid",
                          "Invalid world coordinate",
                          "No solution found in the specified interval",
                          "Invalid subimage specification",
                          "Non-separable subimage coordinate system"};

/* globals linked with tcl variables */

int tty = 0;
int Pow_Done = 0;  /* current method for event handling, will change */
#
extern int Pow_Allocated;

Tcl_HashTable PowDataTable;
Tcl_HashTable PowImageTable;
Tcl_HashTable PowVectorTable;
Tcl_HashTable PowCurveTable;
Tcl_HashTable PowGraphTable;


Tcl_Interp *interp = NULL;		/* Interpreter for application. */
Tk_Window mainWindow;	/* The main window for the application.  If
				 * NULL then the application no longer
				 * exists. */

/*This stuff currently lives here for plugin purposes */
#ifdef PLUGIN
extern int singleBarFastGen(ClientData clientData, Tcl_Interp *interp,
			    int argc, char *argv[]);
extern int singleRollMe(ClientData clientData, Tcl_Interp *interp,
			int argc, char *argv[]);
extern int c_given_RADecMJD_return_Roll(ClientData clientData,
					Tcl_Interp *interp,
					int argc, char *argv[]);

#endif /*PLUGIN */



int Pow_Init(Tcl_Interp *interp_instance) {
  Tcl_DString pow_env;
  const char *charptr;
  char temp[1000];

  Tcl_DStringInit(&pow_env);


  interp = interp_instance;


  if (Visu_Init(interp) == TCL_ERROR) {
    return TCL_ERROR;
  }

  Tcl_PkgRequire(interp, "Itcl", NULL, 0);

#if defined(MAC_TCL) && defined(PLUGIN)


   strcpy(temp,"source -rsrc html_library\n");
   strcat(temp,"source -rsrc notebook\n");
   strcat(temp,"source -rsrc pow\n");
   strcat(temp,"source -rsrc powEdit\n");
   strcat(temp,"source -rsrc powRgn\n");
   strcat(temp,"source -rsrc powMovie\n");
   strcat(temp,"source -rsrc powScript\n");
   strcat(temp,"powInitGlobals\n");
   if( Tcl_GlobalEval(interp,temp) == TCL_ERROR ) {
   	return TCL_ERROR;
   }

#else

  charptr = Tcl_GetVar2(interp,"env", "POW_LIBRARY", TCL_GLOBAL_ONLY);
  if( charptr == NULL ) {
    charptr = "/usr/share/ftools/POW";
  }
  Tcl_DStringAppend(&pow_env,charptr, -1);

  /*  Brackets needed around %s to prevent Windows-style paths  */
  /*  ... eg, c:\fv... from getting converted to control chars  */
  /*  when doing the GlobalEval.                                */
  sprintf(temp,"lappend auto_path {%s}; powInitGlobals",charptr);
  if( Tcl_GlobalEval(interp,temp) == TCL_ERROR )
     return TCL_ERROR;

  /*  Lets try using auto_path instead of all these sources....
	
  Tcl_SetVar(interp, "powsrcdir",Tcl_DStringValue(&pow_env), TCL_GLOBAL_ONLY);

  Tcl_DStringInit(&pow_script);
  Tcl_DStringAppend(&pow_script,Tcl_DStringValue(&pow_env),-1);
  Tcl_DStringAppend(&pow_script,"/html_library.tcl",-1);
  if( Tcl_EvalFile(interp,Tcl_DStringValue(&pow_script))  == TCL_ERROR) {
    fprintf(stderr, "%s\n", interp->result);
    return TCL_ERROR;
  }
  Tcl_DStringFree(&pow_script);

  Tcl_DStringInit(&pow_script);
  Tcl_DStringAppend(&pow_script,Tcl_DStringValue(&pow_env),-1);
  Tcl_DStringAppend(&pow_script,"/notebook.tcl",-1);
  if( Tcl_EvalFile(interp,Tcl_DStringValue(&pow_script))  == TCL_ERROR) {
    fprintf(stderr, "%s\n", interp->result);
    return TCL_ERROR;
  }
  Tcl_DStringFree(&pow_script);

  Tcl_DStringInit(&pow_script);
  Tcl_DStringAppend(&pow_script,Tcl_DStringValue(&pow_env),-1);
  Tcl_DStringAppend(&pow_script,"/pow.tcl",-1); 
  if( Tcl_EvalFile(interp,Tcl_DStringValue(&pow_script))  == TCL_ERROR) {
    fprintf(stderr, "%s\n", interp->result);
    return TCL_ERROR;
  }
  Tcl_DStringFree(&pow_script);

  Tcl_DStringInit(&pow_script);
  Tcl_DStringAppend(&pow_script,Tcl_DStringValue(&pow_env),-1);
  Tcl_DStringAppend(&pow_script,"/powEdit.tcl",-1); 
  if( Tcl_EvalFile(interp,Tcl_DStringValue(&pow_script))  == TCL_ERROR) {
    fprintf(stderr, "%s\n", interp->result);
    return TCL_ERROR;
  }
  Tcl_DStringFree(&pow_script);

  Tcl_DStringInit(&pow_script);
  Tcl_DStringAppend(&pow_script,Tcl_DStringValue(&pow_env),-1);
  Tcl_DStringAppend(&pow_script,"/powRgn.tcl",-1); 
  if( Tcl_EvalFile(interp,Tcl_DStringValue(&pow_script))  == TCL_ERROR) {
    fprintf(stderr, "%s\n", interp->result);
    return TCL_ERROR;
  }
  Tcl_DStringFree(&pow_script);
  */

#endif  /*  MAC_TCL  and PLUGIN*/ 
  
  Tcl_InitHashTable(&PowDataTable, TCL_STRING_KEYS);
  Tcl_InitHashTable(&PowImageTable, TCL_STRING_KEYS);
  Tcl_InitHashTable(&PowVectorTable, TCL_STRING_KEYS);
  Tcl_InitHashTable(&PowCurveTable, TCL_STRING_KEYS);
  Tcl_InitHashTable(&PowGraphTable, TCL_STRING_KEYS);

  Tk_DefineBitmap(interp, Tk_GetUid("stretcharrow"), stretcharrow_bits,
            stretcharrow_width, stretcharrow_height);




#if !(defined(__WIN32__) || defined(macintosh))

  /*  Keeps track of whether Pow has allocated its PseudoColor cells or not  */
  strcpy(temp,"Pow_Allocated");
  Tcl_LinkVar(interp,temp,(char *) &Pow_Allocated,TCL_LINK_INT);

#endif

  Pow_CreateCommands(interp); 

  Tk_CreateItemType(&tkPowCurveType);

  Tcl_PkgProvide(interp, "POW", "3.0");

  return TCL_OK;
}

/* initialization only for Unix standalone */
int Pow_InitExec(Tcl_Interp *interp_instance) {
  Tcl_DString pow_env;
#if !(defined(__WIN32__) || defined(macintosh))
  char temp[1000];
#endif

  Tcl_DStringInit(&pow_env);


  interp = interp_instance;


  if (Visu_Init(interp) == TCL_ERROR) {
    return TCL_ERROR;
  }

#if defined(MAC_TCL) && defined(PLUGIN)


   strcpy(temp,"source -rsrc html_library\n");
   strcat(temp,"source -rsrc notebook\n");
   strcat(temp,"source -rsrc pow\n");
   strcat(temp,"source -rsrc powEdit\n");
   strcat(temp,"source -rsrc powRgn\n");
   strcat(temp,"source -rsrc powMovie\n");
   strcat(temp,"source -rsrc powScript\n");
   strcat(temp,"powInitGlobals\n");
   if( Tcl_GlobalEval(interp,temp) == TCL_ERROR ) {
   	return TCL_ERROR;
   }

#else


#endif  /*  MAC_TCL  and PLUGIN*/ 
  
  Tcl_InitHashTable(&PowDataTable, TCL_STRING_KEYS);
  Tcl_InitHashTable(&PowImageTable, TCL_STRING_KEYS);
  Tcl_InitHashTable(&PowVectorTable, TCL_STRING_KEYS);
  Tcl_InitHashTable(&PowCurveTable, TCL_STRING_KEYS);
  Tcl_InitHashTable(&PowGraphTable, TCL_STRING_KEYS);

  Tk_DefineBitmap(interp, Tk_GetUid("stretcharrow"), stretcharrow_bits,
            stretcharrow_width, stretcharrow_height);




#if !(defined(__WIN32__) || defined(macintosh))

  /*  Keeps track of whether Pow has allocated its PseudoColor cells or not  */
  strcpy(temp,"Pow_Allocated");
  Tcl_LinkVar(interp,temp,(char *) &Pow_Allocated,TCL_LINK_INT);

#endif

  Pow_CreateCommands(interp); 

  Tk_CreateItemType(&tkPowCurveType);
  return TCL_OK;
}

/* Create the Pow Commands */
int Pow_CreateCommands(Tcl_Interp *interp) {

  Tcl_CreateObjCommand(interp,"powWCSInitImage",PowWCSInitImage,
                       (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp,"powWCSInitCurve",PowWCSInitCurve,
                       (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powWCSexists", PowWCSexists,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powWCSisSwapped", PowWCSisSwapped,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powGetImageOrigin",PowGetImageOrigin,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powGetImageOtherend",PowGetImageOtherend,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powGetImageUnits",PowGetImageUnits,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powDestroyData",PowDestroyData_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powDestroyImage",PowDestroyImage_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powDestroyVector",PowDestroyVector_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powDestroyCurve",PowDestroyCurve_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powDestroyGraph",PowDestroyGraph_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateImage",PowCreateImage_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateGraph",PowCreateGraph_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powFindData",PowFindData_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powFindCurvesMinMax",PowFindCurvesMinMax_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powFetchDataLength",PowFetchDataLength,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powFetchCurveInfoHash",PowFetchCurveInfoHash,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powFetchVectorInfoHash",PowFetchVectorInfoHash,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powFetchImageInfoHash",PowFetchImageInfoHash,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateVector",PowCreateVector_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateVectorEN",PowCreateVectorEN_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateCurve",PowCreateCurve_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateHisto",PowCreateHisto_Tcl,
		    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateDataFlip",PowCreateDataFlip_Tcl,
                    (ClientData) NULL,
                    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateCurveFlip",PowCreateCurveFlip_Tcl,
                    (ClientData) NULL,
                    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateData",PowCreateData_Tcl,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCloneData",PowCloneData,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powRegisterData",PowRegisterData_Tcl,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCreateDataFromList",PowCreateDataFromList,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);

  Tcl_CreateObjCommand(interp,"powCreateDataFromBuffer",
                       PowCreateDataFromBuffer,
                       (ClientData) NULL, 
                       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp,"powCreateDataFromChannel",
                       PowCreateDataFromChannel,
                       (ClientData) NULL, 
                       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp,"powCreateDataFromPtr",
                       PowCreateDataFromPtr,
                       (ClientData) NULL, 
                       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp,"powCreateStrFromPtr",
                       PowCreateStrFromPtr,
                       (ClientData) NULL, 
                       (Tcl_CmdDeleteProc *) NULL);

  Tcl_CreateCommand(interp,"powSetGraphMagstep",PowSetGraphMagstep,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powProcessCurve",PowProcessCurve,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powListGraphs",PowListGraphs,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powListCurves",PowListCurves,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powListImages",PowListImages,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powListVectors",PowListVectors,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powListData",PowListData,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powCleanUp",PowCleanUp,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powSetupColormap",PowSetupColormap,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powSetupPhotoImages",PowSetupPhotoImages,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powTestColormap",PowTestColormap,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powPutZoomedBlock",PowPutZoomedBlock,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powPhotoColorTable",PowPhotoColorTable,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateCommand(interp,"powReditherPhotoBlock",PowReditherPhotoBlock,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp,"powTestMacMemory",PowTestMacMemory,
                       (ClientData) NULL, 
                       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp,"powPhotoCmapStretch",PowPhotoCmapStretch,
                       (ClientData) NULL, 
                       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powImageScale", PowImageScale,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powGetHisto", PowGetHisto,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp,"powGetImageZ",PowGetImageZ,
                       (ClientData) NULL, 
                       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp,"powWorldPos",PowWorldPos,
                       (ClientData) NULL, 
                       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp,"powXYPx",PowXYPx,
                       (ClientData) NULL, 
                       (Tcl_CmdDeleteProc *) NULL);
  
  Tcl_CreateObjCommand(interp, "powGraphToCanvas", PowGraphToCanvas,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powCanvasToGraph", PowCanvasToGraph,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powGraphToPixel",  PowGraphToPixel,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powPixelToGraph",  PowPixelToGraph,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powResetWcsStructure",  PowResetWcsStructure,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powGraphVToPixelV",  PowGraphVToPixelV,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powPixelVToGraphV",  PowPixelVToGraphV,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);
  Tcl_CreateObjCommand(interp, "powGetImageClipbox", PowGetImageClipbox,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);

  Tcl_CreateObjCommand(interp, "powExprGetData", PowExprDataInfo,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);

  Tcl_CreateObjCommand(interp, "powDataPtr", PowDataPtr_Tcl,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);

  Tcl_CreateObjCommand(interp, "powTestImage", PowTestImage,
		       (ClientData) NULL, 
		       (Tcl_CmdDeleteProc *) NULL);

  Tcl_CreateCommand(interp,"powDrawGridLines",PowDrawGridLines,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);

  Tcl_CreateCommand(interp,"powCreateContour",PowCreateContour,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);

  Tcl_CreateCommand(interp,"powGetTics",PowGetTics,
		    (ClientData) NULL, 
		    (Tcl_CmdDeleteProc *) NULL);

  Tcl_CreateCommand(interp,"powGetRegionStatistics", PowGetRegionStatistics, 
		    (ClientData) NULL, 
                    (Tcl_CmdDeleteProc*) NULL); 

#ifdef PLUGIN
  Tcl_CreateCommand(interp_instance,"singleBarFastGen",
		    (Tcl_CmdProc*)singleBarFastGen,
		    (ClientData) NULL, (Tcl_CmdDeleteProc*) NULL);
  Tcl_CreateCommand(interp_instance,"singleRollMe",
		    (Tcl_CmdProc*)singleRollMe,
		    (ClientData) NULL, (Tcl_CmdDeleteProc*) NULL);
  Tcl_CreateCommand(interp_instance,"c_given_RADecMJD_return_Roll",
		    (Tcl_CmdProc*)c_given_RADecMJD_return_Roll,
		    (ClientData) NULL, (Tcl_CmdDeleteProc*) NULL);
  
#endif /*PLUGIN */

  return TCL_OK;
}


void PowInit(char *powSetupColormapArgs, char *powInitArgs, int *status) {
  /*call this one from a standalone C or FORTRAN main (as opposed to a 
   tkAppInit file) */

  if (*status != 0) return;

    
  if (interp == NULL || Tcl_InterpDeleted(interp)) {
    /* the test condition above should ensure that we only create a new
       interpreter if we don't have one already */
    interp = Tcl_CreateInterp();
  
  
    if (Tcl_Init(interp) == TCL_ERROR) {
      *status =  TCL_ERROR;
      fprintf(stderr, "%s\n", Tcl_GetStringResult(interp));
      return;
    }
    if (Tk_Init(interp) == TCL_ERROR) {
      *status =  TCL_ERROR;
      fprintf(stderr, "%s\n", Tcl_GetStringResult(interp));
      return;
    }

    tty = isatty(0);
    Tcl_SetVar(interp, "tcl_interactive",
	       tty ? "1" : "0", TCL_GLOBAL_ONLY);

    Tcl_LinkVar(interp,"Pow_Done",(char *) &Pow_Done,TCL_LINK_INT);    /* currently used for event handling */


    *status = Pow_Init(interp);
  
    if (*status != 0) return;
  }
  
  if (Tcl_RegExpMatch(interp,powSetupColormapArgs,"[^ \t\n\r\f]") == 1) {
    /*if user supplied args for powSetupColormap are not pure whitespace...*/
    if(Tcl_VarEval(interp, "powSetupColormap ", powSetupColormapArgs,
		   (char *) NULL) == TCL_ERROR) {
      *status = TCL_ERROR;
      fprintf(stderr, "Error initializing POW.\n%s\n", Tcl_GetStringResult(interp));
    }
  }
  
  if(Tcl_VarEval(interp, "powInit ", powInitArgs, (char *) NULL) == TCL_ERROR) {
    *status = TCL_ERROR;
    fprintf(stderr, "Error initializing POW.\n%s\n", Tcl_GetStringResult(interp));
  }

}