summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixInit.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tkUnixInit.c')
-rw-r--r--unix/tkUnixInit.c91
1 files changed, 47 insertions, 44 deletions
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c
index 1b1b4ab..1cc90a5 100644
--- a/unix/tkUnixInit.c
+++ b/unix/tkUnixInit.c
@@ -1,29 +1,21 @@
-/*
+/*
* tkUnixInit.c --
*
- * This file contains Unix-specific interpreter initialization
- * functions.
+ * This file contains Unix-specific interpreter initialization functions.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkInt.h"
#include "tkUnixInt.h"
-/*
- * The Init script (common to Windows and Unix platforms) is
- * defined in tkInitScript.h
- */
-#include "tkInitScript.h"
-
#ifdef HAVE_COREFOUNDATION
-static int MacOSXGetLibraryPath _ANSI_ARGS_((
- Tcl_Interp *interp));
+static int GetLibraryPath(Tcl_Interp *interp);
+#else
+#define GetLibraryPath(dummy) (void)0
#endif /* HAVE_COREFOUNDATION */
-
/*
*----------------------------------------------------------------------
@@ -34,8 +26,8 @@ static int MacOSXGetLibraryPath _ANSI_ARGS_((
* tk_library variable.
*
* Results:
- * Returns a standard Tcl result. Leaves an error message or result
- * in the interp's result.
+ * Returns a standard Tcl result. Leaves an error message or result in
+ * the interp's result.
*
* Side effects:
* Sets "tk_library" Tcl variable, runs "tk.tcl" script.
@@ -44,14 +36,12 @@ static int MacOSXGetLibraryPath _ANSI_ARGS_((
*/
int
-TkpInit(interp)
- Tcl_Interp *interp;
+TkpInit(
+ Tcl_Interp *interp)
{
TkCreateXEventSource();
-#ifdef HAVE_COREFOUNDATION
- MacOSXGetLibraryPath(interp);
-#endif /* HAVE_COREFOUNDATION */
- return Tcl_Eval(interp, initScript);
+ GetLibraryPath(interp);
+ return TCL_OK;
}
/*
@@ -59,9 +49,9 @@ TkpInit(interp)
*
* TkpGetAppName --
*
- * Retrieves the name of the current application from a platform
- * specific location. For Unix, the application name is the tail
- * of the path contained in the tcl variable argv0.
+ * Retrieves the name of the current application from a platform specific
+ * location. For Unix, the application name is the tail of the path
+ * contained in the tcl variable argv0.
*
* Results:
* Returns the application name in the given Tcl_DString.
@@ -73,9 +63,9 @@ TkpInit(interp)
*/
void
-TkpGetAppName(interp, namePtr)
- Tcl_Interp *interp;
- Tcl_DString *namePtr; /* A previously initialized Tcl_DString. */
+TkpGetAppName(
+ Tcl_Interp *interp,
+ Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */
{
CONST char *p, *name;
@@ -96,8 +86,8 @@ TkpGetAppName(interp, namePtr)
*
* TkpDisplayWarning --
*
- * This routines is called from Tk_Main to display warning
- * messages that occur during startup.
+ * This routines is called from Tk_Main to display warning messages that
+ * occur during startup.
*
* Results:
* None.
@@ -109,9 +99,9 @@ TkpGetAppName(interp, namePtr)
*/
void
-TkpDisplayWarning(msg, title)
- CONST char *msg; /* Message to be displayed. */
- CONST char *title; /* Title of warning. */
+TkpDisplayWarning(
+ CONST char *msg, /* Message to be displayed. */
+ CONST char *title) /* Title of warning. */
{
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
@@ -122,14 +112,15 @@ TkpDisplayWarning(msg, title)
}
}
+#ifdef HAVE_COREFOUNDATION
+
/*
*----------------------------------------------------------------------
*
- * MacOSXGetLibraryPath --
+ * GetLibraryPath --
*
- * If we have a bundle structure for the Tk installation,
- * then check there first to see if we can find the libraries
- * there.
+ * If we have a bundle structure for the Tk installation, then check
+ * there first to see if we can find the libraries there.
*
* Results:
* TCL_OK if we have found the tk library; TCL_ERROR otherwise.
@@ -140,19 +131,31 @@ TkpDisplayWarning(msg, title)
*----------------------------------------------------------------------
*/
-#ifdef HAVE_COREFOUNDATION
static int
-MacOSXGetLibraryPath(Tcl_Interp *interp)
+GetLibraryPath(
+ Tcl_Interp *interp)
{
- int foundInFramework = TCL_ERROR;
#ifdef TK_FRAMEWORK
+ int foundInFramework = TCL_ERROR;
char tkLibPath[PATH_MAX + 1];
- foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp,
- "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX, tkLibPath);
+
+ foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp,
+ "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX,
+ tkLibPath);
if (tkLibPath[0] != '\0') {
Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY);
}
-#endif
return foundInFramework;
+#else
+ return TCL_ERROR;
+#endif
}
#endif /* HAVE_COREFOUNDATION */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */