[79546] branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Pextlib.c
cal at macports.org
cal at macports.org
Fri Jun 17 11:53:16 PDT 2011
Revision: 79546
http://trac.macports.org/changeset/79546
Author: cal at macports.org
Date: 2011-06-17 11:53:16 -0700 (Fri, 17 Jun 2011)
Log Message:
-----------
rev-upgrade: Moved fileIsBinary to conditional __MACH__ section, added static keyword and comment
Modified Paths:
--------------
branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Pextlib.c
Modified: branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Pextlib.c 2011-06-17 18:10:52 UTC (rev 79545)
+++ branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Pextlib.c 2011-06-17 18:53:16 UTC (rev 79546)
@@ -54,14 +54,10 @@
#include <strings.h>
#include <unistd.h>
-/*
- people use this on non-mac systems
- #include <mach-o/loader.h>
- #include <mach-o/fat.h>
-*/
-#define MH_MAGIC (0xfeedface)
-#define MH_MAGIC_64 (0xfeedfacf)
-#define FAT_MAGIC (0xcafebabe)
+#ifdef __MACH__
+#include <mach-o/loader.h>
+#include <mach-o/fat.h>
+#endif
#include <tcl.h>
@@ -473,7 +469,14 @@
return TCL_OK;
}
-int fileIsBinaryCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+#ifdef __MACH__
+/**
+ * Tcl function to determine whether a file given by path is binary (in terms of being Mach-O)
+ * Defined on Mac-Systems only, because the necessary headers are only available there.
+ *
+ * Synopsis: fileIsBinary filename
+ */
+static int fileIsBinaryCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
const char *path;
FILE *file;
uint32_t magic;
@@ -561,8 +564,8 @@
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(false));
return TCL_OK;
}
+#endif
-
int Pextlib_Init(Tcl_Interp *interp)
{
if (Tcl_InitStubs(interp, "8.4", 0) == NULL)
@@ -595,8 +598,10 @@
Tcl_CreateObjCommand(interp, "symlink", CreateSymlinkCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "unsetenv", UnsetEnvCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "lchown", lchownCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "realpath", RealpathCmd, NULL, NULL);
+#ifdef __MACH__
Tcl_CreateObjCommand(interp, "fileIsBinary", fileIsBinaryCmd, NULL, NULL);
- Tcl_CreateObjCommand(interp, "realpath", RealpathCmd, NULL, NULL);
+#endif
Tcl_CreateObjCommand(interp, "readline", ReadlineCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "rl_history", RLHistoryCmd, NULL, NULL);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110617/42203e68/attachment.html>
More information about the macports-changes
mailing list