summaryrefslogtreecommitdiffstats
path: root/mac/tkMacProlog.c
diff options
context:
space:
mode:
authorrjohnson <rjohnson>1998-04-01 09:51:44 (GMT)
committerrjohnson <rjohnson>1998-04-01 09:51:44 (GMT)
commit066ea7fd88d49cb456f74da71dbe875e4fc0aabb (patch)
tree8fb30cb152c4dc191be47fa043d2e6f5ea38c7ba /mac/tkMacProlog.c
parent13242623d2ff3ea02ab6a62bfb48a7dbb5c27e22 (diff)
downloadtk-066ea7fd88d49cb456f74da71dbe875e4fc0aabb.zip
tk-066ea7fd88d49cb456f74da71dbe875e4fc0aabb.tar.gz
tk-066ea7fd88d49cb456f74da71dbe875e4fc0aabb.tar.bz2
Initial revision
Diffstat (limited to 'mac/tkMacProlog.c')
-rw-r--r--mac/tkMacProlog.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/mac/tkMacProlog.c b/mac/tkMacProlog.c
new file mode 100644
index 0000000..21cf67c
--- /dev/null
+++ b/mac/tkMacProlog.c
@@ -0,0 +1,61 @@
+/*
+ * tkMacProlog.c --
+ *
+ * Implements a method on the Macintosh to get the prolog
+ * from the resource fork of our application (or the shared
+ * library).
+ *
+ * Copyright (c) 1996-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.
+ *
+ * SCCS: @(#) tkMacProlog.c 1.6 97/05/21 10:01:07
+ */
+
+#include "tkInt.h"
+#include "tclMacInt.h"
+#include <Resources.h>
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkGetNativeProlog --
+ *
+ * Locate and load the postscript prolog from the resource
+ * fork of the application. If it can't be found then we
+ * will try looking for the file in the system folder.
+ *
+ * Results:
+ * A standard Tcl Result. If everything is OK the prolog
+ * will be located in the result string of the interpreter.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+int
+TkGetNativeProlog(
+ Tcl_Interp *interp) /* Places the prolog in the result. */
+{
+ Handle resource;
+ char *stringPtr;
+ int releaseIt;
+
+
+ resource = Tcl_MacFindResource(interp, 'TEXT', "prolog", -1,
+ NULL, &releaseIt);
+
+ if (resource != NULL) {
+ stringPtr = Tcl_MacConvertTextResource(resource);
+ Tcl_SetResult(interp, stringPtr, TCL_DYNAMIC);
+ if (releaseIt) {
+ ReleaseResource(resource);
+ }
+ return TCL_OK;
+ } else {
+ return TkGetProlog(interp);
+ }
+}