OSDN Git Service

In reading the 7.4.2 docs, the sql reference page for PREPARE doesn't
[pg-rex/syncrep.git] / src / bin / pgtclsh / pgtkAppInit.c
1 /*
2  * pgtkAppInit.c
3  *
4  *              a skeletal Tcl_AppInit that provides pgtcl initialization
5  *        to create a tclsh that can talk to pglite backends
6  *
7  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1993 The Regents of the University of California.
9  * Copyright (c) 1994 Sun Microsystems, Inc.
10  *
11  * See the file "license.terms" for information on usage and redistribution
12  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13  */
14
15 #include <tk.h>
16 #include "libpgtcl.h"
17
18 /*
19  * The following variable is a special hack that is needed in order for
20  * Sun shared libraries to be used for Tcl.
21  */
22
23 #ifdef NEED_MATHERR
24 extern int      matherr();
25 int                *tclDummyMathPtr = (int *) matherr;
26 #endif
27
28
29 /*
30  *----------------------------------------------------------------------
31  *
32  * main
33  *
34  *              This is the main program for the application.
35  *
36  * Results:
37  *              None: Tk_Main never returns here, so this procedure never
38  *              returns either.
39  *
40  * Side effects:
41  *              Whatever the application does.
42  *
43  *----------------------------------------------------------------------
44  */
45
46 int
47 main(int argc, char **argv)
48 {
49         Tk_Main(argc, argv, Tcl_AppInit);
50         return 0;                                       /* Needed only to prevent compiler
51                                                                  * warning. */
52 }
53
54
55 /*
56  *----------------------------------------------------------------------
57  *
58  * Tcl_AppInit
59  *
60  *              This procedure performs application-specific initialization.
61  *              Most applications, especially those that incorporate additional
62  *              packages, will have their own version of this procedure.
63  *
64  * Results:
65  *              Returns a standard Tcl completion code, and leaves an error
66  *              message in interp->result if an error occurs.
67  *
68  * Side effects:
69  *              Depends on the startup script.
70  *
71  *----------------------------------------------------------------------
72  */
73
74 int
75 Tcl_AppInit(Tcl_Interp *interp)
76 {
77         if (Tcl_Init(interp) == TCL_ERROR)
78                 return TCL_ERROR;
79         if (Tk_Init(interp) == TCL_ERROR)
80                 return TCL_ERROR;
81
82         /*
83          * Call the init procedures for included packages.      Each call should
84          * look like this:
85          *
86          * if (Mod_Init(interp) == TCL_ERROR) { return TCL_ERROR; }
87          *
88          * where "Mod" is the name of the module.
89          */
90
91         if (Pgtcl_Init(interp) == TCL_ERROR)
92                 return TCL_ERROR;
93
94         /*
95          * Call Tcl_CreateCommand for application-specific commands, if they
96          * weren't already created by the init procedures called above.
97          */
98
99         /*
100          * Specify a user-specific startup file to invoke if the application
101          * is run interactively.  Typically the startup file is "~/.apprc"
102          * where "app" is the name of the application.  If this line is
103          * deleted then no user-specific startup file will be run under any
104          * conditions.
105          */
106
107 #if (TCL_MAJOR_VERSION <= 7) && (TCL_MINOR_VERSION < 5)
108         tcl_RcFileName = "~/.wishrc";
109 #else
110         Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
111 #endif
112
113         return TCL_OK;
114 }