diff options
Diffstat (limited to 'unix/tkUnixInit.c')
-rw-r--r-- | unix/tkUnixInit.c | 89 |
1 files changed, 50 insertions, 39 deletions
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c index 05dcc49..4fbef46 100644 --- a/unix/tkUnixInit.c +++ b/unix/tkUnixInit.c @@ -1,31 +1,31 @@ -/* +/* * 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. * - * RCS: @(#) $Id: tkUnixInit.c,v 1.6 2005/05/23 20:25:04 das Exp $ + * RCS: @(#) $Id: tkUnixInit.c,v 1.7 2005/11/14 11:54:21 dkf Exp $ */ #include "tkInt.h" #include "tkUnixInt.h" /* - * The Init script (common to Windows and Unix platforms) is - * defined in tkInitScript.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 */ - /* *---------------------------------------------------------------------- @@ -36,8 +36,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. @@ -46,13 +46,11 @@ static int MacOSXGetLibraryPath _ANSI_ARGS_(( */ int -TkpInit(interp) - Tcl_Interp *interp; +TkpInit( + Tcl_Interp *interp) { TkCreateXEventSource(); -#ifdef HAVE_COREFOUNDATION - MacOSXGetLibraryPath(interp); -#endif /* HAVE_COREFOUNDATION */ + GetLibraryPath(interp); return Tcl_Eval(interp, initScript); } @@ -61,9 +59,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. @@ -75,9 +73,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; @@ -98,8 +96,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. @@ -111,9 +109,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) { @@ -124,14 +122,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. @@ -142,19 +141,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: + */ |