# New Ticket Created by  Kevin Falcone 
# Please include the string:  [netlabs #652]
# in the subject line of all future correspondence about this issue. 
# <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=652 >



I happen to have access to an OSX box, but it doesn't have fink
installed, nor does it appear that it will be installed any time
soon. 

This is my attempt at ripping things out of Perl5 and putting them
into parrot (although without much in the way of error checking)

I would like to hear from someone _with_ fink installed to know if
there are any wacky conflicts.  I've included the new platform.[ch]
files as patches against /dev/null

Also, is the platforms directory still relevant? It looks like
Configure.pl is simply pulling things out of config/gen/platform.

-kevin

Index: config/init/hints/darwin.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/darwin.pl,v
retrieving revision 1.3
diff -u -p -r1.3 darwin.pl
--- config/init/hints/darwin.pl 24 May 2002 22:13:40 -0000      1.3
+++ config/init/hints/darwin.pl 3 Jun 2002 04:23:50 -0000
@@ -1,9 +1,8 @@
 my($ccflags, $ldflags, $libs)=Configure::Data->get(qw(ccflags ldflags
 libs));
 
-$ccflags .= " -I/sw/include ";
+$ccflags .= " -pipe -fno-common ";
 $ccflags =~ s/-flat_namespace\s*//;
 $ldflags =~ s/-flat_namespace\s*//;
-$ldflags .= " -L/sw/lib -flat_namespace ";
 $libs    .= " -ldl ";
 
 Configure::Data->set(

--- /dev/null   Mon Jun  3 00:22:22 2002
+++ config/gen/platform/darwin.c        Sun Jun  2 23:36:06 2002
@@ -0,0 +1,137 @@
+/*
+** platform.c [generic version]
+*/
+
+#include <time.h>
+#include <sys/time.h>
+
+#undef environ
+#undef bool
+#import <mach-o/dyld.h>
+
+#include "parrot/parrot.h"
+
+#define PARROT_DLOPEN_FLAGS RTLD_LAZY
+
+/*
+** Parrot_intval_time()
+*/
+
+INTVAL
+Parrot_intval_time(void)
+{
+    return time(NULL);
+}
+
+
+/*
+** Parrot_floatval_time()
+*/
+
+FLOATVAL
+Parrot_floatval_time(void)
+{
+    struct timeval t;
+    gettimeofday(&t, NULL);
+    return (FLOATVAL)t.tv_sec + ((FLOATVAL)t.tv_usec / 1000000.0);
+}
+
+
+/*
+** Parrot_sleep()
+*/
+
+void
+Parrot_sleep(unsigned int seconds)
+{
+    sleep(seconds);
+}
+
+
+/*
+** Parrot_setenv()
+*/
+
+#ifdef HAS_SETENV
+void
+Parrot_setenv(const char *name, const char *value)
+{
+    setenv(name, value, 1);
+}
+#else
+/* putenv-based version might go here, but see perl5's util.c for
+   warnings and workarounds.
+*/
+#endif
+
+/*
+** Parrot_dlopen()
+*/
+
+void *
+Parrot_dlopen(const char *filename)
+{
+
+    int dyld_result;
+    NSObjectFileImage ofile;
+    NSModule handle = NULL;
+
+    dyld_result = NSCreateObjectFileImageFromFile(filename, &ofile);
+    handle = NSLinkModule(ofile, filename, TRUE);
+    NSDestroyObjectFileImage(ofile);
+
+    return handle;
+
+}
+
+
+/*
+** Parrot_dlerror()
+*/
+
+const char *
+Parrot_dlerror(void)
+{
+    return NULL;
+}
+
+
+/*
+** Parrot_dlsym()
+*/
+
+void *
+Parrot_dlsym(void *handle, char *symbol)
+{
+
+    void *addr;
+
+    if (NSIsSymbolNameDefined(symbol))
+        addr = NSAddressOfSymbol(NSLookupAndBindSymbol(symbol));
+    else
+        addr = NULL;
+
+    return addr;
+
+}
+
+
+/*
+** Parrot_dlclose()
+*/
+
+int
+Parrot_dlclose(void *handle)
+{
+    return 0;
+}
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */

--- /dev/null   Mon Jun  3 00:22:22 2002
+++ config/gen/platform/darwin.h        Mon Jun  3 00:27:36 2002
@@ -0,0 +1,44 @@
+/*
+** platform.h [generic version]
+*/
+
+
+/*
+** I/O:
+*/
+
+#define DEFAULT_OPEN_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+#ifndef S_ISREG
+#   define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
+#endif
+
+/*
+** Miscellaneous:
+*/
+
+void Parrot_sleep(unsigned int seconds);
+INTVAL Parrot_intval_time(void);
+FLOATVAL Parrot_floatval_time(void);
+void Parrot_setenv(const char *name, const char *value);
+
+
+/*
+** Dynamic Loading:
+*/
+
+#define PARROT_DLOPEN_FLAGS RTLD_LAZY
+
+void *Parrot_dlopen(const char *filename);
+const char *Parrot_dlerror(void);
+void *Parrot_dlsym(void *handle, char *symbol);
+int Parrot_dlclose(void *handle);
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */


-- 
The programmer is fighting against the two most destructive forces in
the universe: entropy and human stupidity. They're not things you can
always overcome with a "methodology" or on a schedule. --Damian Conway

Reply via email to