OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tix/] [generic/] [tixInit.c] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
2
 * tixInit.c --
3
 *
4
 *      Initialze the internals of Tix.
5
 *
6
 * Copyright (c) 1996, Expert Interface Technologies
7
 *
8
 * See the file "license.terms" for information on usage and redistribution
9
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10
 *
11
 */
12
 
13
#include <tixPort.h>
14
#include <tixInt.h>
15
 
16
#ifdef ITCL_2
17
#include <itcl.h>
18
#endif
19
 
20
#ifdef _WINDOWS
21
#include <tkWinInt.h>
22
#endif
23
 
24
static Tix_TclCmd commands[] = {
25
    /*
26
     * Commands that are part of the intrinsics:
27
     */
28
    {"tixCallMethod",           Tix_CallMethodCmd},
29
    {"tixChainMethod",          Tix_ChainMethodCmd},
30
    {"tixClass",                Tix_ClassCmd},
31
    {"tixDisplayStyle",         Tix_ItemStyleCmd},
32
    {"tixDoWhenIdle",           Tix_DoWhenIdleCmd},
33
    {"tixDoWhenMapped",         Tix_DoWhenMappedCmd},
34
    {"tixFalse",                Tix_FalseCmd},
35
    {"tixFile",                 Tix_FileCmd},
36
    {"tixFlushX",               Tix_FlushXCmd},
37
    {"tixForm",                 Tix_FormCmd},
38
    {"tixHList",                Tix_HListCmd},
39
    {"tixItemStyle",            Tix_ItemStyleCmd},      /* Old name */
40
    {"tixGeometryRequest",      Tix_GeometryRequestCmd},
41
    {"tixGet3DBorder",          Tix_Get3DBorderCmd},
42
    {"tixGetBoolean",           Tix_GetBooleanCmd},
43
    {"tixGetInt",               Tix_GetIntCmd},
44
    {"tixGetMethod",            Tix_GetMethodCmd},
45
    {"tixHandleOptions",        Tix_HandleOptionsCmd},
46
#ifndef _WINDOWS
47
    {"tixInputOnly",            Tix_InputOnlyCmd},
48
#endif
49
    {"tixManageGeometry",       Tix_ManageGeometryCmd},
50
    {"tixMapWindow",            Tix_MapWindowCmd},
51
    {"tixMoveResizeWindow",     Tix_MoveResizeWindowCmd},
52
#ifndef _WINDOWS
53
    {"tixMwm",                  Tix_MwmCmd},
54
#endif
55
    {"tixNoteBookFrame",        Tix_NoteBookFrameCmd},
56
    {"tixRaiseWindow",          Tix_RaiseWindowCmd},
57
    {"tixStringSub",            Tix_StringSubCmd},
58
    {"tixStrEq",                Tix_StrEqCmd},
59
    {"tixTmpLine",              Tix_TmpLineCmd},
60
    {"tixTrue",                 Tix_TrueCmd},
61
    {"tixUnmapWindow",          Tix_UnmapWindowCmd},
62
    {"tixWidgetClass",          Tix_ClassCmd},
63
    {"tixWidgetDoWhenIdle",     Tix_DoWhenIdleCmd},
64
 
65
#ifndef TIX_VERSION_4_0_x
66
    {"tixTList",                Tix_TListCmd},
67
    {"tixGrid",                 Tix_GridCmd},
68
#endif
69
 
70
    {(char *) NULL,             (Tix_CmdProc)NULL}
71
};
72
 
73
typedef struct {
74
    int         isBeta;
75
    char      * binding;
76
    int         isDebug;
77
    char      * fontSet;
78
    char      * tixlibrary;
79
    char      * scheme;
80
    char      * schemePriority;
81
} OptionStruct;
82
 
83
static OptionStruct tixOption;
84
 
85
/*
86
 * TIX_DEF_FONTSET and TIX_DEF_SCHEME should have been defined in the
87
 * Makefile by the configure script. We define them here just in case
88
 * the configure script failed to determine the proper values.
89
 */
90
 
91
#ifndef TIX_DEF_FONTSET
92
#ifdef _WINDOWS
93
#define TIX_DEF_FONTSET "TkWin"
94
#else
95
#define TIX_DEF_FONTSET "TK"
96
#endif
97
#endif
98
 
99
#ifndef TIX_DEF_SCHEME
100
#ifdef _WINDOWS
101
#define TIX_DEF_SCHEME "TkWin"
102
#else
103
#define TIX_DEF_SCHEME "TK"
104
#endif
105
#endif
106
 
107
 
108
#define DEF_TIX_TOOLKIT_OPTION_BETA             "1"
109
#define DEF_TIX_TOOLKIT_OPTION_BINDING          "Motif"
110
#define DEF_TIX_TOOLKIT_OPTION_DEBUG            "1"
111
#define DEF_TIX_TOOLKIT_OPTION_FONTSET          TIX_DEF_FONTSET
112
#define DEF_TIX_TOOLKIT_OPTION_LIBRARY          ""
113
#define DEF_TIX_TOOLKIT_OPTION_SCHEME           TIX_DEF_SCHEME
114
#define DEF_TIX_TOOLKIT_OPTION_SCHEME_PRIORITY  "79"
115
 
116
static Tk_ConfigSpec configSpecs[] = {
117
    {TK_CONFIG_BOOLEAN, "-beta", "tixBeta", "TixBeta",
118
       DEF_TIX_TOOLKIT_OPTION_BETA, Tk_Offset(OptionStruct, isBeta),
119
       0},
120
    {TK_CONFIG_STRING, "-binding", "binding", "TixBinding",
121
       DEF_TIX_TOOLKIT_OPTION_BINDING, Tk_Offset(OptionStruct, binding),
122
       0},
123
    {TK_CONFIG_BOOLEAN, "-debug", "tixDebug", "TixDebug",
124
       DEF_TIX_TOOLKIT_OPTION_DEBUG, Tk_Offset(OptionStruct, isDebug),
125
       0},
126
    {TK_CONFIG_STRING, "-fontset", "tixFontSet", "TixFontSet",
127
       DEF_TIX_TOOLKIT_OPTION_FONTSET, Tk_Offset(OptionStruct, fontSet),
128
       0},
129
    {TK_CONFIG_STRING, "-scheme", "tixScheme", "TixScheme",
130
       DEF_TIX_TOOLKIT_OPTION_SCHEME, Tk_Offset(OptionStruct, scheme),
131
       0},
132
    {TK_CONFIG_STRING, "-scheme", "tixSchemePriority", "TixSchemePriority",
133
       DEF_TIX_TOOLKIT_OPTION_SCHEME_PRIORITY,
134
       Tk_Offset(OptionStruct, schemePriority),
135
       0},
136
    {TK_CONFIG_STRING, "-tixlibrary", "tixLibrary", "TixLibrary",
137
       DEF_TIX_TOOLKIT_OPTION_LIBRARY, Tk_Offset(OptionStruct, tixlibrary),
138
       TK_CONFIG_NULL_OK},
139
    {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
140
       (char *) NULL, 0, 0}
141
};
142
 
143
#ifndef TIX_LIBRARY
144
#ifndef _WINDOWS
145
#define TIX_LIBRARY "/usr/local/lib/tix"
146
#else
147
#define TIX_LIBRARY "../../library"
148
#endif
149
#endif
150
 
151
/*----------------------------------------------------------------------
152
 *
153
 *                      Some global variables
154
 *
155
 *----------------------------------------------------------------------
156
 */
157
Tk_Uid tixNormalUid   = (Tk_Uid)NULL;
158
Tk_Uid tixCellUid     = (Tk_Uid)NULL;
159
Tk_Uid tixRowUid      = (Tk_Uid)NULL;
160
Tk_Uid tixColumnUid   = (Tk_Uid)NULL;
161
Tk_Uid tixDisabledUid = (Tk_Uid)NULL;
162
 
163
/*----------------------------------------------------------------------
164
 *
165
 *                      The Display Item types
166
 *
167
 *----------------------------------------------------------------------
168
 */
169
 
170
extern Tix_DItemInfo tix_ImageTextItemType;
171
extern Tix_DItemInfo tix_TextItemType;
172
extern Tix_DItemInfo tix_WindowItemType;
173
extern Tix_DItemInfo tix_ImageItemType;
174
 
175
static int              ParseToolkitOptions _ANSI_ARGS_((Tcl_Interp * interp));
176
extern int              TixMwmProtocolHandler _ANSI_ARGS_((
177
                            ClientData clientData, XEvent *eventPtr));
178
static int              Tix_Init_Internal _ANSI_ARGS_((Tcl_Interp * interp,
179
                             int doSource));
180
int                     Tix_EtInit _ANSI_ARGS_((Tcl_Interp * interp));
181
 
182
/*----------------------------------------------------------------------
183
 * ParseToolkitOptions() --
184
 *
185
 *      Before the Tix initialized, we need to determine the toolkit
186
 *      options which are set by the options database.
187
 *----------------------------------------------------------------------
188
 */
189
static int
190
ParseToolkitOptions(interp)
191
    Tcl_Interp * interp;
192
{
193
    char buff[10];
194
    int flag;
195
 
196
    tixOption.isBeta = 0;
197
    tixOption.binding = NULL;
198
    tixOption.isDebug = 0;
199
    tixOption.fontSet = NULL;
200
    tixOption.tixlibrary = NULL;
201
    tixOption.scheme = NULL;
202
    tixOption.schemePriority = NULL;
203
 
204
    /*
205
     * The toolkit options may be set in the resources of the main window
206
     */
207
    if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs,
208
            0, 0, (char *) &tixOption, 0) != TCL_OK) {
209
        return TCL_ERROR;
210
    }
211
 
212
    /*
213
     * Now lets set the Tix toolkit variables so that the Toolkit can
214
     * initialize according to user options.
215
     */
216
    flag = TCL_GLOBAL_ONLY;
217
    sprintf(buff, "%d", tixOption.isBeta);
218
    Tcl_SetVar2(interp, "tix_priv", "-beta", buff, flag);
219
    sprintf(buff, "%d", tixOption.isDebug);
220
    Tcl_SetVar2(interp, "tix_priv", "-debug", buff, flag);
221
 
222
    if (tixOption.tixlibrary == 0 || strlen(tixOption.tixlibrary) == 0) {
223
        /*
224
         * Set up the TCL variable "tix_library" according to the environment
225
         * variable.
226
         */
227
        if (tixOption.tixlibrary != NULL) {
228
            ckfree((char*)tixOption.tixlibrary);
229
        }
230
 
231
        tixOption.tixlibrary = (char*)getenv("TIX_LIBRARY");
232
        if (tixOption.tixlibrary == NULL) {
233
            tixOption.tixlibrary = TIX_LIBRARY;
234
        }
235
        Tcl_SetVar2(interp, "tix_priv", "-libdir",
236
                tixOption.tixlibrary, flag);
237
    } else {
238
        Tcl_SetVar2(interp, "tix_priv", "-libdir",
239
                tixOption.tixlibrary, flag);
240
        ckfree((char*)tixOption.tixlibrary);
241
    }
242
 
243
    /*
244
     * tixOption.tixlibrary may not be allocated by Tk_ConfigureWidget().
245
     * We have already freed it (if necessary). We set it to NULL so
246
     * that Tk_FreeOptions() won't try to free it.
247
     */
248
    tixOption.tixlibrary = NULL;
249
 
250
    Tcl_SetVar2(interp, "tix_priv", "-binding",
251
        tixOption.binding,              flag);
252
    Tcl_SetVar2(interp, "tix_priv", "-fontset",
253
        tixOption.fontSet,              flag);
254
    Tcl_SetVar2(interp, "tix_priv", "-scheme",
255
        tixOption.scheme,               flag);
256
    Tcl_SetVar2(interp, "tix_priv", "-schemepriority",
257
        tixOption.schemePriority,     flag);
258
 
259
    Tk_FreeOptions(configSpecs, (char *)&tixOption,
260
        Tk_Display(Tk_MainWindow(interp)), 0);
261
 
262
    return TCL_OK;
263
}
264
 
265
/*----------------------------------------------------------------------
266
 * Tix_Init_Internal() --
267
 *
268
 *      Initialize the Tix library. The doSource argument specifies
269
 *      we should source the file Init.tcl from the Tix script library
270
 *      path. A doSource is not necessary if Tix was included in an ET
271
 *      applicattion.
272
 *----------------------------------------------------------------------
273
 */
274
 
275
static int
276
Tix_Init_Internal(interp, doSource)
277
         Tcl_Interp * interp;
278
         int doSource;
279
{
280
    Tk_Window topLevel;
281
    char * appName;
282
    static int globalInitialized = 0;
283
 
284
    /*
285
     * This procedure may be called  several times for several
286
     * interpreters. Since some global variables are shared by
287
     * all of the interpreters, we initialize these variables only
288
     * once. The variable "globalInitialized" keeps track of this
289
     */
290
 
291
    extern Tk_ImageType tixPixmapImageType;
292
    extern Tk_ImageType tixCompoundImageType;
293
 
294
 
295
#ifdef TCL_7_5_OR_LATER
296
    /*
297
     * The new package mechanism, available in Tcl7.5 or later
298
     */
299
    if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 1) == NULL) {
300
        return TCL_ERROR;
301
    }
302
    if (Tcl_PkgRequire(interp, "Tk", TK_VERSION, 1) == NULL) {
303
        return TCL_ERROR;
304
    }
305
#ifdef ITCL_2
306
    if (Tcl_PkgRequire(interp, "Itcl", ITCL_VERSION, 0) == NULL) {
307
        return TCL_ERROR;
308
    }
309
    if (Tcl_PkgRequire(interp, "Itk", ITCL_VERSION, 0) == NULL) {
310
        return TCL_ERROR;
311
    }
312
#endif
313
/*
314
 * // This is now done in Init.tcl
315
 *   if (Tcl_PkgProvide(interp, "Tix", TIX_VERSION) != TCL_OK) {
316
 *      return TCL_ERROR;
317
 *   }
318
 */
319
#endif
320
 
321
    topLevel = Tk_MainWindow(interp);
322
 
323
    if (!globalInitialized) {
324
        globalInitialized = 1;
325
 
326
        /*
327
         * Initialize the global variables shared by all interpreters
328
         */
329
        tixNormalUid   = Tk_GetUid("normal");
330
        tixCellUid     = Tk_GetUid("cell");
331
        tixRowUid      = Tk_GetUid("row");
332
        tixColumnUid   = Tk_GetUid("column");
333
        tixDisabledUid = Tk_GetUid("disabled");
334
 
335
#ifndef _WINDOWS
336
        /* This is for tixMwm command */
337
        Tk_CreateGenericHandler(TixMwmProtocolHandler, NULL);
338
#endif
339
 
340
        /* Initialize the image readers */
341
#if 0   /* CYGNUS LOCAL: turn off Tix xpm handling; we have it in
342
           libide.  */
343
        Tk_CreateImageType(&tixPixmapImageType);
344
#endif /* END CYGNUS LOCAL */
345
        Tk_CreateImageType(&tixCompoundImageType);
346
 
347
        /* Initialize the display item types */
348
        Tix_AddDItemType(&tix_ImageTextItemType);
349
        Tix_AddDItemType(&tix_TextItemType);
350
        Tix_AddDItemType(&tix_WindowItemType);
351
        Tix_AddDItemType(&tix_ImageItemType);
352
 
353
        /*
354
         * Initializes all the Tix built-in bitmaps.
355
         */
356
#define Et_Interp interp
357
#include "tixBitmaps.h"
358
 
359
    }
360
    else {
361
        /*
362
         * This variable is used in the __tixInit procedure.
363
         */
364
        Tcl_SetVar2(interp, "tix_priv", "slaveInterp", "", TCL_GLOBAL_ONLY);
365
    }
366
 
367
    /*
368
     * Initialize the per-interpreter variables
369
     */
370
 
371
    /*  Set the "tix_version" variable */
372
    Tcl_SetVar(interp, "tix_version",    TIX_VERSION,    TCL_GLOBAL_ONLY);
373
    Tcl_SetVar(interp, "tix_patchLevel", TIX_PATCHLEVEL, TCL_GLOBAL_ONLY);
374
    Tcl_SetVar(interp, "tix_release",    TIX_RELEASE,    TCL_GLOBAL_ONLY);
375
 
376
    /* Initialize the Tix commands */
377
    Tix_CreateCommands(interp, commands, (ClientData) topLevel,
378
        (void (*)_ANSI_ARGS_((ClientData))) NULL);
379
 
380
#ifdef _WINDOWS
381
    Tcl_GlobalEval(interp, "set tixPriv(isWindows) 1");
382
#endif
383
 
384
    /* Parse options database for fontSets, schemes, etc */
385
    if (ParseToolkitOptions(interp) == TCL_ERROR) {
386
        return TCL_ERROR;
387
    }
388
 
389
    if ((appName = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY))== NULL) {
390
        appName = "tixwish";
391
    }
392
 
393
    if (doSource) {
394
 
395
        if (TixLoadLibrary(interp) != TCL_OK) {
396
            return TCL_ERROR;
397
        }
398
 
399
        /*
400
         * Check whether the TIX_LIBRARY variable is set to a
401
         * pre-4.0.2 version of Tix. (All 4.0.2+ version will
402
         * correctly identify their own versions and will print out
403
         * warning messages if the version of the binary does not
404
         * match with the script library
405
         */
406
        if (Tcl_GlobalEval(interp, "tixScriptVersion") != TCL_OK) {
407
            char *tixLibraryStr;
408
            fprintf(stderr,
409
                "Warning: Tix script library version (pre 4.0.2)\n");
410
 
411
            /* CYGNUS LOCAL - You are not guaranteed that tix_library
412
             * is set.  Check that so you don't crash printing the
413
             * error message...
414
             */
415
 
416
            tixLibraryStr = Tcl_GetVar(interp, "tix_library",
417
                    TCL_GLOBAL_ONLY);
418
            if (tixLibraryStr != NULL) {
419
                fprintf(stderr, "  in \"%s\"\n", tixLibraryStr);
420
            }
421
 
422
            /*
423
             * END CYGNUS LOCAL
424
             */
425
 
426
            fprintf(stderr, "  does not match binary version (%s).\n",
427
                TIX_PATCHLEVEL);
428
            fprintf(stderr, "  Please check your TIX_LIBRARY environment ");
429
            fprintf(stderr, "variable and your Tix installation.\n");
430
            Tcl_ResetResult(interp);
431
        }
432
 
433
        if (Tcl_GlobalEval(interp, "__tixInit") != TCL_OK) {
434
            return TCL_ERROR;
435
        }
436
    } else {
437
        Tcl_SetVar(interp, "tix_library", "", TCL_GLOBAL_ONLY);
438
    }
439
 
440
 
441
    return TCL_OK;
442
}
443
 
444
/*----------------------------------------------------------------------
445
 * Tix_Init --
446
 *
447
 *      This is the function to call in your Tcl_AppInit() function
448
 *
449
 *----------------------------------------------------------------------
450
 */
451
 
452
int
453
Tix_Init(interp)
454
    Tcl_Interp * interp;
455
{
456
    int code = Tix_Init_Internal(interp, 1);
457
 
458
#ifdef _WINDOWS
459
    if (code != TCL_OK) {
460
        char * errorInfo;
461
 
462
        errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
463
        if (errorInfo == NULL) {
464
            Tcl_SetVar(interp, "errorInfo", "unknown error", TCL_GLOBAL_ONLY);
465
        }
466
        Tix_GlobalVarEval(interp,
467
            "toplevel .err; ",
468
                "bind .err <Destroy> {set err_ok 1}; ",
469
                "frame .err.f; pack .err.f -side bottom -fill both; "
470
            "button .err.f.i -text Ignore -width 6 -command {set err_ok 1}; ",
471
            "button .err.f.e -text Exit   -width 6 -command {exit}; ",
472
            "pack .err.f.i -side left -padx 4 -pady 4;"
473
            "pack .err.f.e -side left -padx 4 -pady 4; "
474
            "text .err.text -width 70 -wrap none -height 5; "
475
            "pack .err.text -side top -expand yes -fill both; "
476
            ".err.text insert end $errorInfo; ",
477
            "tkwait variable err_ok; ",
478
            "catch {destroy .err}; ",
479
            NULL);
480
    }
481
#endif
482
    return code;
483
}
484
 
485
/*----------------------------------------------------------------------
486
 * TixInitSam --
487
 *
488
 *      This takes special care when you initialize the Tix library
489
 *      to run in stand-alone mode.
490
 *----------------------------------------------------------------------
491
 */
492
int TixInitSam(interp)
493
    Tcl_Interp * interp;
494
{
495
    return Tix_Init_Internal(interp, 0);
496
}
497
 
498
/*----------------------------------------------------------------------
499
 * Tix_SafeInit --
500
 *
501
 *      This is the function to call in your Tcl_AppInit() function
502
 *
503
 *----------------------------------------------------------------------
504
 */
505
 
506
int
507
Tix_SafeInit(interp)
508
    Tcl_Interp * interp;
509
{
510
    Tcl_SetVar2(interp, "tix_priv", "isSafe", "1", TCL_GLOBAL_ONLY);
511
    return Tix_Init(interp);
512
}
513
 
514
/*
515
 *----------------------------------------------------------------------
516
 * TixLoadLibrary --
517
 *
518
 *      Loads the Tix library.
519
 *
520
 * Results:
521
 *      Standard Tcl result.
522
 *
523
 * Side effects:
524
 *      Tix gets initialized.
525
 *----------------------------------------------------------------------
526
 */
527
 
528
/* CYGNUS_LOCAL: For Tcl8.0.3 and greater use tcl_findLibrary to find he
529
 * Path to the script library.  Note, this will not work with Tcl 8.1b1
530
 * and on.  I didn't add support for Tcl8.1a1,2 because we don't support
531
 * them...
532
 */
533
 
534
#if ((TCL_MAJOR_VERSION < 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION == 0) && (TCL_RELEASE_SERIAL < 3)))
535
static char *initScript =
536
"if [catch {file join a a}] {\n\
537
    proc tixFileJoin {args} {\n\
538
        set p [join $args /]\n\
539
        regsub -all {/+} $p / p\n\
540
        return $p\n\
541
    }\n\
542
} else {\n\
543
    proc tixFileJoin {args} {\n\
544
        return [eval file join $args]\n\
545
   }\n\
546
}\n\
547
\n\
548
proc tix_init {} {\n\
549
    global tix_library tix_version tix_patchLevel env\n\
550
    rename tix_init {}\n\
551
    set dirs {}\n\
552
    set errors {}\n\
553
    if [info exists env(TIX_LIBRARY)] {\n\
554
        lappend dirs $env(TIX_LIBRARY)\n\
555
    }\n\
556
    if [string match {*[ab]*} $tix_patchLevel] {\n\
557
        set lib tix$tix_patchLevel\n\
558
        set Lib Tix$tix_patchLevel\n\
559
    } else {\n\
560
        set lib tix$tix_version\n\
561
        set Lib Tix$tix_version\n\
562
    }\n\
563
    catch {\n\
564
        # [pwd] may not work inside safe Tcl\n\
565
        set p [pwd]\n\
566
        lappend dirs [tixFileJoin $p library]\n\
567
        set p [file dirname $p]\n\
568
        lappend dirs [tixFileJoin $p library]\n\
569
        set p [file dirname $p]\n\
570
        lappend dirs [tixFileJoin $p library]\n\
571
    }\n\
572
    set instDir [file dirname [info library]]\n\
573
    lappend dirs [tixFileJoin $instDir $lib]\n\
574
    lappend dirs [tixFileJoin [tixFileJoin $instDir lib] $lib]\n\
575
    catch {\n\
576
    lappend dirs [tixFileJoin [tixFileJoin [file dirname [file dirname [info nameofexecutable]]] lib] $lib]\n\
577
    }\n\
578
    lappend dirs [tixFileJoin [tixFileJoin [file dirname [file dirname [info library]]] $lib] library]\n\
579
    lappend dirs [tixFileJoin [tixFileJoin [file dirname [file dirname [info library]]] $Lib] library]\n\
580
    foreach i $dirs {\n\
581
        set tix_library $i\n\
582
        set tixfile [tixFileJoin $i Init.tcl]\n\
583
        if {[interp issafe] || [file exists $tixfile]} {\n\
584
            if ![catch {uplevel #0 [list source $tixfile]} err] {\n\
585
                return\n\
586
            } else {\n\
587
                append errors \"$tixfile: $err\n$errorInfo\n\"\n\
588
            }\n\
589
        }\n\
590
    }\n\
591
    set msg \"Can't find a usable Init.tcl in the following directories: \n\"\n\
592
    append msg \"    $dirs\n\"\n\
593
    append msg \"$errors\n\n\"\n\
594
    append msg \"This probably means that Tix wasn't installed properly.\n\"\n\
595
    error $msg\n\
596
}\n\
597
init";
598
 
599
#else
600
static char *initScript =
601
"proc tix_init {} {\n\
602
    global tix_library tix_version tix_patchLevel env\n\
603
    rename tix_init {}\n\
604
    tcl_findLibrary tix $tix_version $tix_patchLevel Init.tcl TIX_LIBRARY tix_library\n\
605
}\n\
606
tix_init\n\
607
";
608
#endif /* CYGNUS LOCAL */
609
 
610
int
611
TixLoadLibrary(interp)
612
    Tcl_Interp * interp;
613
{
614
    return Tcl_Eval(interp, initScript);
615
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.