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 / pgtclAppInit.c
1 /*
2  * pgtclAppInit.c
3  *              a skeletal Tcl_AppInit that provides pgtcl initialization
4  *        to create a tclsh that can talk to pglite backends
5  *
6  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1993 The Regents of the University of California.
8  * Copyright (c) 1994 Sun Microsystems, Inc.
9  *
10  * See the file "license.terms" for information on usage and redistribution
11  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12  */
13
14 #include <tcl.h>
15
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: Tcl_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         Tcl_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
80         /*
81          * Call the init procedures for included packages.      Each call should
82          * look like this:
83          *
84          * if (Mod_Init(interp) == TCL_ERROR) { return TCL_ERROR; }
85          *
86          * where "Mod" is the name of the module.
87          */
88
89         if (Pgtcl_Init(interp) == TCL_ERROR)
90                 return TCL_ERROR;
91
92         /*
93          * Call Tcl_CreateCommand for application-specific commands, if they
94          * weren't already created by the init procedures called above.
95          */
96
97         /*
98          * Specify a user-specific startup file to invoke if the application
99          * is run interactively.  Typically the startup file is "~/.apprc"
100          * where "app" is the name of the application.  If this line is
101          * deleted then no user-specific startup file will be run under any
102          * conditions.
103          */
104
105 #if (TCL_MAJOR_VERSION <= 7) && (TCL_MINOR_VERSION < 5)
106         tcl_RcFileName = "~/.tclshrc";
107 #else
108         Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);
109 #endif
110
111         return TCL_OK;
112 }