1/*----------------------------------------------------------------------------
2|   Copyright (c) 1999 Jochen Loewer (loewerj@hotmail.com)
3+-----------------------------------------------------------------------------
4|
5|   $Id: tdominit.c,v 1.16 2005/08/25 22:59:49 rolf Exp $
6|
7|
8|   A DOM implementation for Tcl using James Clark's expat XML parser
9|
10|
11|   The contents of this file are subject to the Mozilla Public License
12|   Version 1.1 (the "License"); you may not use this file except in
13|   compliance with the License. You may obtain a copy of the License at
14|   http://www.mozilla.org/MPL/
15|
16|   Software distributed under the License is distributed on an "AS IS"
17|   basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
18|   License for the specific language governing rights and limitations
19|   under the License.
20|
21|   The Original Code is tDOM.
22|
23|   The Initial Developer of the Original Code is Jochen Loewer
24|   Portions created by Jochen Loewer are Copyright (C) 1998, 1999
25|   Jochen Loewer. All Rights Reserved.
26|
27|   Contributor(s):
28|
29|
30|   written by Jochen Loewer
31|   April, 1999
32|
33\---------------------------------------------------------------------------*/
34
35
36
37/*----------------------------------------------------------------------------
38|   Includes
39|
40\---------------------------------------------------------------------------*/
41#include <tcl.h>
42#include <dom.h>
43#include <tdom.h>
44#include <tcldom.h>
45
46extern TdomStubs tdomStubs;
47
48/*
49 *----------------------------------------------------------------------------
50 *
51 * Tdom_Init --
52 *
53 *	Initialization routine for loadable module
54 *
55 * Results:
56 *	None.
57 *
58 * Side effects:
59 *	Defines "expat"/"dom" commands in the interpreter.
60 *
61 *----------------------------------------------------------------------------
62 */
63
64int
65Tdom_Init (interp)
66     Tcl_Interp *interp; /* Interpreter to initialize. */
67{
68
69#ifdef USE_TCL_STUBS
70    Tcl_InitStubs(interp, "8", 0);
71#endif
72
73    domModuleInitialize();
74
75#ifdef TCL_THREADS
76    tcldom_initialize();
77#endif /* TCL_THREADS */
78
79#ifndef TDOM_NO_UNKNOWN_CMD
80    Tcl_Eval(interp, "rename unknown unknown_tdom");
81    Tcl_CreateObjCommand(interp, "unknown", tcldom_unknownCmd,  NULL, NULL );
82#endif
83
84    Tcl_CreateObjCommand(interp, "dom",     tcldom_DomObjCmd,   NULL, NULL );
85    Tcl_CreateObjCommand(interp, "domDoc",  tcldom_DocObjCmd,   NULL, NULL );
86    Tcl_CreateObjCommand(interp, "domNode", tcldom_NodeObjCmd,  NULL, NULL );
87    Tcl_CreateObjCommand(interp, "tdom",    TclTdomObjCmd,      NULL, NULL );
88
89#ifndef TDOM_NO_EXPAT
90    Tcl_CreateObjCommand(interp, "expat",       TclExpatObjCmd, NULL, NULL );
91    Tcl_CreateObjCommand(interp, "xml::parser", TclExpatObjCmd, NULL, NULL );
92#endif
93
94#ifdef USE_TCL_STUBS
95    Tcl_PkgProvideEx(interp, PACKAGE_NAME, PACKAGE_VERSION,
96                     (ClientData) &tdomStubs);
97#else
98    Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION);
99#endif
100
101    return TCL_OK;
102}
103
104int
105Tdom_SafeInit (interp)
106     Tcl_Interp *interp;
107{
108    return Tdom_Init (interp);
109}
110
111/*
112 * Load the AOLserver stub. This allows the library
113 * to be loaded as AOLserver module.
114 */
115
116#if defined (NS_AOLSERVER)
117# include "aolstub.cpp"
118#endif
119
120