[Gd-chatter] r11284 - in trunk/fundev: . admin/builds sources/common-dylan sources/dfmc/c-linker sources/dfmc/c-run-time sources/lib/build-system sources/registry/ppc-darwin sources/registry/x86-darwin sources/system sources/system/file-system

rayiner at gwydiondylan.org rayiner at gwydiondylan.org
Tue Apr 24 02:10:53 CEST 2007


Author: rayiner
Date: Tue Apr 24 02:10:48 2007
New Revision: 11284

Added:
   trunk/fundev/sources/common-dylan/darwin-common-dylan.lid   (contents, props changed)
   trunk/fundev/sources/common-dylan/darwin-common-extensions.dylan   (contents, props changed)
   trunk/fundev/sources/dfmc/c-run-time/ppc-darwin-build.jam   (contents, props changed)
   trunk/fundev/sources/dfmc/c-run-time/x86-darwin-build.jam   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/
   trunk/fundev/sources/registry/ppc-darwin/Open-Source-License.txt   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/basic-pentium-dw   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/c-ffi   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/common-dylan   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/dood   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/io   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/jam   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/network   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/system   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/unix-portability   (contents, props changed)
   trunk/fundev/sources/registry/ppc-darwin/variable-search   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/
   trunk/fundev/sources/registry/x86-darwin/Open-Source-License.txt   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/basic-pentium-dw   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/c-ffi   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/common-dylan   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/dood   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/io   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/jam   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/network   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/system   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/unix-portability   (contents, props changed)
   trunk/fundev/sources/registry/x86-darwin/variable-search   (contents, props changed)
   trunk/fundev/sources/system/ppc-darwin-operating-system.dylan   (contents, props changed)
   trunk/fundev/sources/system/ppc-darwin-system.lid   (contents, props changed)
   trunk/fundev/sources/system/x86-darwin-operating-system.dylan   (contents, props changed)
   trunk/fundev/sources/system/x86-darwin-system.lid   (contents, props changed)
Modified:
   trunk/fundev/Makefile.in
   trunk/fundev/admin/builds/fdmake.pl
   trunk/fundev/autogen.sh
   trunk/fundev/configure.ac
   trunk/fundev/sources/dfmc/c-linker/c-gluefile.dylan
   trunk/fundev/sources/dfmc/c-run-time/Makefile.in
   trunk/fundev/sources/dfmc/c-run-time/run-time.c
   trunk/fundev/sources/dfmc/c-run-time/run-time.h
   trunk/fundev/sources/lib/build-system/jam-build.dylan
   trunk/fundev/sources/system/file-system/unix-ffi.dylan
   trunk/fundev/sources/system/file-system/unix-interface.dylan
Log:
Job: fd

- Add support for OS X (Darwin) on x86 and ppc, based heavily on FreeBSD port.



Modified: trunk/fundev/Makefile.in
==============================================================================
--- trunk/fundev/Makefile.in	(original)
+++ trunk/fundev/Makefile.in	Tue Apr 24 02:10:48 2007
@@ -7,6 +7,8 @@
 fd_host		= @fd_host@
 fd_target	= @fd_target@
 
+rt_srcdir	= @RT_SRCDIR@
+
 fdmake		= @PERL@ $(srcdir)/admin/builds/fdmake.pl
 
 FDCOMPILE	= @FDCOMPILE@
@@ -42,8 +44,8 @@
 	mkdir Bootstrap.1/bin
 	mkdir Bootstrap.1/lib
 
-Bootstrap.1/lib/$(fd_build)-build.jam: Bootstrap.1 $(srcdir)/sources/lib/run-time/pentium-linux/$(fd_build)-build.jam
-	cp $(srcdir)/sources/lib/run-time/pentium-linux/$(fd_build)-build.jam \
+Bootstrap.1/lib/$(fd_build)-build.jam: Bootstrap.1 $(rt_srcdir)/$(fd_build)-build.jam
+	cp $(rt_srcdir)/$(fd_build)-build.jam \
 	   Bootstrap.1/lib/$(fd_build)-build.jam
 
 BOOTSTRAP1_REGISTRY = $(srcdir)/sources/bootstrap1-registry
@@ -100,9 +102,7 @@
 Bootstrap.2/bin/minimal-console-compiler: stage-1-bootstrap
 	@echo Building stage 2 bootstrap...
 	OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.2 \
-	  $(MAKE) -C sources/lib/run-time/pentium-linux install
-	OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.2 \
-	  $(MAKE) -C sources/dfmc/c-run-time install
+	  $(MAKE) -C $(rt_srcdir) install
 	@OPEN_DYLAN_PLATFORM_NAME=$(fd_build) \
 	  OPEN_DYLAN_RELEASE_ROOT=$(abs_builddir)/Bootstrap.2 \
 	  OPEN_DYLAN_RELEASE_INSTALL=$(abs_builddir)/Bootstrap.2 \
@@ -128,9 +128,7 @@
 Bootstrap.3/bin/minimal-console-compiler: stage-2-bootstrap
 	@echo Building stage 3 bootstrap...
 	OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.3 \
-	  $(MAKE) -C sources/lib/run-time/pentium-linux install
-	OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.3 \
-	  $(MAKE) -C sources/dfmc/c-run-time install
+	  $(MAKE) -C $(rt_srcdir) install
 	@OPEN_DYLAN_PLATFORM_NAME=$(fd_build) \
 	  OPEN_DYLAN_RELEASE_ROOT=$(abs_builddir)/Bootstrap.2 \
 	  OPEN_DYLAN_BUILD_LOGS=$(abs_builddir)/Bootstrap.3/logs \
@@ -166,9 +164,7 @@
 final-bootstrap: Bootstrap.final
 	@echo Building final stage bootstrap...
 	OPEN_DYLAN_USER_INSTALL=$(prefix) \
-	  $(MAKE) -C sources/lib/run-time/pentium-linux install
-	OPEN_DYLAN_USER_INSTALL=$(prefix) \
-	  $(MAKE) -C sources/dfmc/c-run-time install
+	  $(MAKE) -C $(rt_srcdir) install
 	@$(FINAL_ENV) $(FDCOMPILE) \
 		$(FINAL_LIBRARIES)
 

Modified: trunk/fundev/admin/builds/fdmake.pl
==============================================================================
--- trunk/fundev/admin/builds/fdmake.pl	(original)
+++ trunk/fundev/admin/builds/fdmake.pl	Tue Apr 24 02:10:48 2007
@@ -9,6 +9,11 @@
 
 my $platform_name = $ENV{'OPEN_DYLAN_PLATFORM_NAME'};
 
+my $library_extension = "so";
+if($platform_name =~ m/darwin/) {
+    $library_extension = "dylib";
+}
+
 my $user_root = $ENV{'OPEN_DYLAN_USER_ROOT'};
 my $user_build = $ENV{'OPEN_DYLAN_USER_BUILD'};
 my $user_install = $ENV{'OPEN_DYLAN_USER_INSTALL'};
@@ -71,7 +76,7 @@
     
     &scan_lidfile($lidfile, $header, $dir);
 
-    my $needs_rebuild = !-f "$user_root/lib/lib${library}.so";
+    my $needs_rebuild = !-f "$user_root/lib/lib${library}.${library_extension}";
 
     if(defined $deps{$library}) {
 	foreach my $dep (@{$deps{$library}}) {
@@ -82,7 +87,7 @@
     }
 
     if(!$needs_rebuild) {
-	my $libdate = (stat "$user_root/lib/lib${library}.so")[9];
+	my $libdate = (stat "$user_root/lib/lib${library}.${library_extension}")[9];
 	foreach my $source (split /\s+/, $$header{'files'}) {
 	    unless($source =~ /\.dylan$/) {
 		$source = "$source.dylan";
@@ -122,7 +127,7 @@
 
     system $command || die "Couldn't execute $compiler";
     if($? != 0
-       || !(-f "$user_root/lib/lib${library}.so"
+       || !(-f "$user_root/lib/lib${library}.${library_extension}"
 	    || -f "$user_root/bin/$library")) {
 	print "\n";
 	if(defined $build_logs && !$debugger) {

Modified: trunk/fundev/autogen.sh
==============================================================================
Binary files. No diff available.

Modified: trunk/fundev/configure.ac
==============================================================================
--- trunk/fundev/configure.ac	(original)
+++ trunk/fundev/configure.ac	Tue Apr 24 02:10:48 2007
@@ -11,11 +11,13 @@
 case $1 in
 i*86-*-linux*) $2=x86-linux ;;
 i*86-*-freebsd*) $2=x86-bsd ;;
+i*86-*-darwin*) $2=x86-darwin ;;
+powerpc-*-darwin*) $2=ppc-darwin ;;
 powerpc-*-linux-gnu*) $2=ppc-linux ;;
 powerpc-apple-darwin*) $2=ppc-darwin ;;
 *) AC_MSG_ERROR([The $1 platform is not supported.]) ;;
 esac])
-
+ 
 AC_CANONICAL_BUILD
 FD_PLATFORM($build,fd_build)
 AC_SUBST(fd_build)
@@ -28,6 +30,12 @@
 FD_PLATFORM($target,fd_target)
 AC_SUBST(fd_target)
 
+case $build in
+*-*-darwin*) RT_SRCDIR=$srcdir/sources/dfmc/c-run-time ;;
+*) RT_SRCDIR=$srcdir/sources/lib/run-time/pentium-linux ;;
+esac
+AC_SUBST(RT_SRCDIR)
+
 AC_PROG_INSTALL
 AC_PROG_LN_S
 

Added: trunk/fundev/sources/common-dylan/darwin-common-dylan.lid
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/common-dylan/darwin-common-dylan.lid	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,31 @@
+Library:      common-dylan
+Module:       dylan-user
+Synopsis:     Common Dylan library definition
+Author:       Andy Armstrong
+Files: library
+       macros
+       common-extensions
+       darwin-common-extensions
+       locators-protocol
+       streams-protocol
+       random
+       format
+       byte-vector
+       transcendentals
+       machine-words/utilities
+       machine-words/machine-word
+       machine-words/logicals
+       machine-words/arithmetic
+       machine-words/division
+       machine-words/shift
+       machine-words/unsigned
+       machine-words/signal-overflow
+       machine-words/double
+       machine-words/unsigned-double
+Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
+              All rights reserved.
+License:      Functional Objects Library Public License Version 1.0
+Dual-license: GNU Lesser General Public License
+Warranty:     Distributed WITHOUT WARRANTY OF ANY KIND
+Other-files: Open-Source-License.txt
+

Added: trunk/fundev/sources/common-dylan/darwin-common-extensions.dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/common-dylan/darwin-common-extensions.dylan	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,232 @@
+Module:       common-dylan-internals
+Author:       Gary Palter
+Synopsis:     Common extensions to Dylan
+Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
+              All rights reserved.
+License:      Functional Objects Library Public License Version 1.0
+Dual-license: GNU Lesser General Public License
+Warranty:     Distributed WITHOUT WARRANTY OF ANY KIND
+
+define function format-out (format-string :: <string>, #rest format-arguments) => ()
+  let string :: <string> = apply(format-to-string, format-string, format-arguments);
+  write-console(string);
+end function format-out;
+
+define inline function write-console (string :: <string>, #key end: _end) => ()
+  let string-size :: <integer> = _end | size(string);
+  %call-c-function ("write")
+      (fd :: <raw-c-signed-int>, buffer :: <raw-byte-string>, size :: <raw-c-unsigned-long>)
+   => (count :: <raw-c-signed-int>)
+    (integer-as-raw(1), primitive-string-as-raw(string), integer-as-raw(string-size))
+  end;
+  //---*** NOTE: Should we do something here if we can't do the I/O???
+  %call-c-function ("fsync") (fd :: <raw-c-signed-int>) => (result :: <raw-c-signed-int>)
+    (integer-as-raw(1))
+  end;
+end function write-console;
+
+define thread variable *time-buffer* :: <byte-string>
+  = make(<byte-string>, size: ash($machine-word-size, -3), fill: '\0');
+
+define function default-random-seed () => (seed :: <integer>)
+  %call-c-function ("time")
+      (time :: <raw-c-pointer>) => (time :: <raw-c-signed-long>)
+    (primitive-cast-raw-as-pointer(primitive-string-as-raw(*time-buffer*)))
+  end;
+  logior(as(<integer>, *time-buffer*[0]),
+	 ash(as(<integer>, *time-buffer*[1]), 8),
+	 ash(as(<integer>, *time-buffer*[2]), 16))
+    + as(<integer>, *time-buffer*[3])
+end function default-random-seed;
+
+/// Application information
+
+define variable *application-name* :: false-or(<byte-string>) = #f;
+define variable *application-filename* :: false-or(<byte-string>) = #f;
+define variable *application-arguments* :: <simple-object-vector> = #[];
+
+// Darwin sysctl() constants
+define constant $CTL_KERN = 1;
+define constant $KERN_PROCARGS2 = 49;
+
+// Wrap Darwin's sysctl() for the read-only case
+// This allocates an appropriately sized data buffer for you
+define function darwin-sysctl
+  (mib :: <vector>) => (ret :: false-or(<byte-string>))
+  let rmib = make(<byte-string>, size: size(mib), fill: '\0');
+  let wsize = raw-as-integer(primitive-word-size());
+  let rosize = make(<byte-string>, size: wsize, fill: '\0');
+
+  // create the real mib vector
+  for (i from 0 below size(mib))
+    primitive-c-signed-int-at
+      (primitive-cast-raw-as-pointer(primitive-string-as-raw(rmib)),
+        integer-as-raw(0), integer-as-raw(i * wsize)) := integer-as-raw(mib[i])
+  end for;
+  
+  // get the size of the available data
+  when (raw-as-integer(%call-c-function ("sysctl")
+    (mib :: <raw-byte-string>, cnt :: <raw-c-unsigned-int>,
+     out :: <raw-byte-string> , osize :: <raw-byte-string>,
+     in :: <raw-byte-string>, isize :: <raw-byte-string>)
+    => (ret :: <raw-c-signed-int>)
+    (primitive-string-as-raw(rmib), integer-as-raw(size(rmib)),
+     primitive-unwrap-machine-word($machine-word-zero),
+     primitive-string-as-raw(rosize),
+     primitive-unwrap-machine-word($machine-word-zero),
+     primitive-unwrap-machine-word($machine-word-zero)) end) >= 0)
+     
+    let osize = raw-as-integer(primitive-c-unsigned-long-at
+      (primitive-cast-raw-as-pointer(primitive-string-as-raw(rosize)),
+       integer-as-raw(0), integer-as-raw(0))) + 1;
+    let out = make(<byte-string>, size: osize, fill: '\0');
+    
+    primitive-c-unsigned-long-at(primitive-cast-raw-as-pointer
+      (primitive-string-as-raw(rosize)), integer-as-raw(0), integer-as-raw(0))
+      := integer-as-raw(osize); 
+    
+    // do the actual sysctl
+    when(raw-as-integer(%call-c-function ("sysctl")
+      (mib :: <raw-byte-string>, cnt :: <raw-c-unsigned-int>,
+       out :: <raw-byte-string>, osize :: <raw-byte-string>,
+       in :: <raw-byte-string>, isize :: <raw-byte-string>)
+      => (ret :: <raw-c-signed-int>)
+      (primitive-string-as-raw(rmib), integer-as-raw(size(mib)),
+       primitive-string-as-raw(out), primitive-string-as-raw(rosize),
+       primitive-unwrap-machine-word($machine-word-zero), 
+       primitive-unwrap-machine-word($machine-word-zero)) end) >= 0)
+      out
+    end when;
+  end when;
+end function;
+
+/// This code uses one sysctl() to get the process arguments, and another
+/// to get the process's filename. It only works on OS X > 10.3. 
+/// The data format returned by KERN_PROCARGS2 is:
+/// [int32] <--- argc
+/// [string] <--- cmd name
+/// [NUL]* <--- 1-3 padding NUL's, to align next string
+/// [string] <--- cmd name (again)
+/// [NUL]* <--- more padding NUL's
+/// [string] <--- first argument
+/// [NUL]* <--- more padding
+/// ... for each argument, each environment variable
+define inline-only function ensure-application-name-filename-and-arguments () => ()
+  unless (*application-name*)
+    let pid
+      = raw-as-integer(%call-c-function ("getpid") () => (pid :: <raw-c-signed-int>) () end);
+    let cmdline = darwin-sysctl(vector($CTL_KERN, $KERN_PROCARGS2, pid));
+    when (cmdline)
+      let argc = 
+        raw-as-integer(primitive-c-signed-int-at
+          (primitive-cast-raw-as-pointer(primitive-string-as-raw(cmdline)),
+           integer-as-raw(0), integer-as-raw(0)));
+      // tokenize the returned buffer
+      let tokens = make(<stretchy-vector>);
+      let _start = 4;
+      let _end :: <integer> = size(cmdline);
+
+      while ((_start < _end) & (size(tokens) < argc + 1))
+        // skip null padding
+        while ((_start < _end) & (cmdline[_start] = '\0'))
+          _start := _start + 1;
+        end;
+        
+        let token = make(<byte-string>);
+        while ((_start < _end) & cmdline[_start] ~= '\0')
+          token := add(token, cmdline[_start]);
+          _start := _start + 1;
+        end;
+
+        if (~ empty?(token))
+          add!(tokens, token);
+        end;
+      end while;
+      *application-name* := tokens[0];
+      *application-filename* := *application-name*;
+      *application-arguments* 
+        := apply(vector, copy-sequence(tokens, start: 2, end: argc + 1));
+    end when;
+  end unless;
+end function;
+
+define function application-name () => (name :: <byte-string>)
+  ensure-application-name-filename-and-arguments();
+  *application-name*
+end function application-name;
+
+define function application-filename () => (filename :: false-or(<byte-string>))
+  ensure-application-name-filename-and-arguments();
+  *application-filename*
+end function application-filename;
+
+define function application-arguments () => (arguments :: <simple-object-vector>)
+  ensure-application-name-filename-and-arguments();
+  *application-arguments*
+end function application-arguments;
+
+
+///---*** These inline-only functions really want to be local to
+///---*** tokenize-command-line but our compiler doesn't yet
+///---*** inline local functions which are called more than once
+
+define inline-only function whitespace? (c :: <character>) => (whitespace? :: <boolean>)
+  c = ' ' | c = '\t' | c = '\n'
+end function whitespace?;
+
+define inline-only function skip-whitespace
+    (string :: <byte-string>, _start :: <integer>, _end :: <integer>)
+ => (_new-start :: <integer>)
+  while (_start < _end & whitespace?(string[_start]))
+    _start := _start + 1
+  end;
+  _start
+end function skip-whitespace;
+
+define function tokenize-command-line (line :: <byte-string>)
+ => (command :: <byte-string>, #rest arguments :: <byte-string>)
+  let tokens = #();
+  let _start :: <integer> = 0;
+  let _end :: <integer> = size(line);
+  let token = make(<stretchy-vector>);
+  local method next-token () => (token :: false-or(<byte-string>))
+	  _start := skip-whitespace(line, _start, _end);
+	  if (_start < _end)
+	    let escaped? :: <boolean> = #f;
+	    let quoted? :: false-or(<character>) = #f;
+	    let done? :: <boolean> = #f;
+	    token.size := 0;
+	    while (_start < _end & ~done?)
+	      let c :: <character> = line[_start];
+	      case
+		escaped? =>
+		  add!(token, c);
+		  escaped? := #f;
+		quoted? & whitespace?(c) =>
+		  add!(token, c);
+		quoted? = c =>
+		  quoted? := #f;
+		c = '\\' =>
+		  escaped? := #t;
+		c = '"' | c = '\'' =>
+		  quoted? := c;
+		whitespace?(c) =>
+		  done? := #t;
+		otherwise =>
+		  add!(token, c);
+	      end;
+	      _start := _start + 1
+	    end;
+	    concatenate-as(<byte-string>, token)
+	  else
+	    #f
+	  end
+	end method next-token;
+  while (_start < _end)
+    let token = next-token();
+    if (token)
+      tokens := add!(tokens, token)
+    end
+  end;
+  apply(values, reverse!(tokens))
+end function tokenize-command-line;

Modified: trunk/fundev/sources/dfmc/c-linker/c-gluefile.dylan
==============================================================================
--- trunk/fundev/sources/dfmc/c-linker/c-gluefile.dylan	(original)
+++ trunk/fundev/sources/dfmc/c-linker/c-gluefile.dylan	Tue Apr 24 02:10:48 2007
@@ -14,7 +14,8 @@
 						makefile-target(ld),
 						main-unit(lib-name)),
 			  type: "c")
-    write (stream, "#include \"run-time.h\"\n\n");
+    write(stream, "#include \"run-time.h\"\n\n");
+    write(stream, "#include <gc/gc.h>\n\n");
     format(stream, "main (int argc, char *argv[]) {\n");
     format(stream, "  extern void %s ();\n", glue-name(lib-name));
     format(stream, "  extern D %s;\n", command-arguments-name());

Modified: trunk/fundev/sources/dfmc/c-run-time/Makefile.in
==============================================================================
--- trunk/fundev/sources/dfmc/c-run-time/Makefile.in	(original)
+++ trunk/fundev/sources/dfmc/c-run-time/Makefile.in	Tue Apr 24 02:10:48 2007
@@ -45,8 +45,11 @@
 $(RUNTIMELIBDEST):
 	mkdir -p $(RUNTIMELIBDEST)
 
-install-build: $(runtime_srcdir)/c-linux-build.jam
-	cp -fp $(runtime_srcdir)/c-linux-build.jam $(LIBDEST)
+install-build:
+	cp -fp $(top_srcdir)/sources/lib/run-time/mini-jambase.jam $(LIBDEST)
+	cp -fp $(runtime_srcdir)/x86-linux-build.jam $(LIBDEST)
+	cp -fp $(runtime_srcdir)/x86-darwin-build.jam $(LIBDEST)
+	cp -fp $(runtime_srcdir)/ppc-darwin-build.jam $(LIBDEST)
 
 install-header:	$(runtime_srcdir)/run-time.h $(INCDEST)
 	cp -fp $(runtime_srcdir)/run-time.h $(INCDEST)

Added: trunk/fundev/sources/dfmc/c-run-time/ppc-darwin-build.jam
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/dfmc/c-run-time/ppc-darwin-build.jam	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,368 @@
+#
+# Configuration variables
+#
+
+CC	?= gcc ;
+
+MKF	?= dylanmakefile.mkf ;
+
+SUFOBJ	?= .o ;			# object files suffix
+SUFASM	?= .s ;			# assembly source files suffix
+SUFLIB	?= .a ;			# static library suffix
+SUFDLL	?= .dylib ;	# shared library suffix
+SUFMKF	?= .mkf ;   # build-system files
+
+{
+  local _lib = lib ;
+  local _bin = bin ;
+  local _inc = include ;
+
+  # SYSTEM_ROOT is set by the build-system
+  SYSTEM_LIBDIR ?= $(_lib:P=$(SYSTEM_ROOT)) ;
+  SYSTEM_BINDIR ?= $(_bin:P=$(SYSTEM_ROOT)) ;
+  SYSTEM_INCDIR ?= $(_inc:P=$(SYSTEM_ROOT)) ;
+
+  # PERSONAL_ROOT is set by the build-system
+  PERSONAL_LIBDIR ?= $(_lib:P=$(PERSONAL_ROOT)) ;
+  PERSONAL_BINDIR ?= $(_bin:P=$(PERSONAL_ROOT)) ;
+
+  # . is set by the build system
+  LIBDIR ?= $(_lib:P=$(PERSONAL_ROOT:E=$(.:P))) ;
+  BINDIR ?= $(_bin:P=$(PERSONAL_ROOT:E=$(.:P))) ;
+  HDRS ?= $(SYSTEM_INCDIR) ;
+}
+
+CCFLAGS ?= -fdefer-pop -fguess-branch-probability -fcprop-registers -floop-optimize -fif-conversion -fif-conversion2 -ftree-ccp -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs -ftree-sra -ftree-copyrename -ftree-fre -ftree-ch -fmerge-constants -fomit-frame-pointer -fPIC -fno-common -g0 ;
+
+#
+# Runtime
+#
+
+RTOBJS ?= posix-threads.o
+	  debug-print.o
+	  run-time.o ;
+
+rtlibs ?= $(SYSTEM_LIBDIR)/runtime/$(RTOBJS) -lgc -lpthread -ldl -lm ;
+
+guilflags ?= ;
+
+#
+# Jambase
+#
+include $(SYSTEM_LIBDIR)/mini-jambase.jam ;
+
+#
+# Pseudo-targets
+#
+
+NotFile all lib dll exe unify-dll unify-exe release dirs clean clean-all ;
+Always clean clean-all ;
+
+#
+# Rules called from jam-build
+#
+
+# In each of the following rules, $(image[1]) contains the name from
+# the Library: header, and $(image[2]) contains the name from
+# the Executable: header (if present).
+
+rule DylanLibrary image : version {
+  # DylanLibrary image : version ;
+  #Echo DylanLibrary $(image) ":" $(version) ;
+
+  # Link a Dylan library as a shared library or executable image.
+
+  local _dll = [ FDLLName $(image) ] ;
+  local _exe = [ FEXEName $(image) ] ;
+
+  # Here we save the name and search directory of the DLL for this library.
+  
+  _dll_$(image[1]:L) = $(_dll) ;
+  if ! $(SYSTEM) && ! $(PERSONAL_ROOT) {
+    _dir_$(image[1]:L) = $(LIBDIR) ;
+  }
+
+  # Shared libraries and executable images
+
+  MakeLocate $(_dll) : $(LIBDIR) ;
+  MakeLocate $(_exe) : $(BINDIR) ;
+
+  # Initial library search path
+  
+  LIBPATH on $(_dll) = $(PERSONAL_LIBDIR) ;
+  LIBPATH on $(_exe) = $(PERSONAL_LIBDIR:E=$(LIBDIR)) ;
+ 
+  # We'll use the library name as the grist to identify referenced
+  # source and object files.
+  
+  SOURCE_GRIST = $(image[1]:L) ;
+
+  # Save the current dylanmakefile.mkf for reference by other libraries
+  # in the event that it later becomes a system library.
+
+  local _mkf = $(image[1]:LS=$(SUFMKF)) ;
+  MakeLocate $(_mkf) : $(LIBDIR) ;
+  if ! $(SYSTEM) {
+    File $(_mkf) : [ FGristFiles $(MKF) ] ;
+    Depends $(_dll) : $(_mkf) ;
+  }
+
+  # The executable depends only on _main.o and the DLL.
+
+  local _obj = [ FGristFiles _main$(SUFOBJ) ] ;
+  local _c   = [ FGristFiles _main.c   ] ;
+  SEARCH on $(_obj) $(_c) = $(SEARCH_SOURCE) ;
+ 
+  Cc $(_obj) : $(_c) ;
+  Depends $(_exe) : $(_dll) ;
+  LINKLIBS on $(_exe) += -l$(image[1]:L) ;
+  LinkEXE $(_exe) : $(_obj) ;
+
+  # If this is the top-level project, make the dll, exe, and clean
+  # targets depend on its build products.
+  
+  if ! $(PARENT) {
+    Depends dll : $(_dll) ;
+    Depends exe : $(_exe) ;
+
+    Clean clean : $(_dll) $(_exe) $(_mkf) $(_obj) ;
+  }
+  Clean clean-all : $(_dll) $(_exe) $(_mkf) $(_obj) ;
+
+  # Mark the library version
+
+  VERSION on $(_dll) ?= $(version:J=.) ;
+  VERSION on $(_exe) ?= $(version:J=.) ;
+}
+
+rule DylanLibraryFiles image : files {
+  # DylanLibraryFiles image : files ;
+  #Echo DylanLibraryFiles $(image) ":" $(files) ;
+
+  # Link Dylan-derived object files into the resulting shared library.
+  if ! $(SYSTEM) {
+    local _dll = [ FDLLName $(image) ] ;
+    
+    local _obj = [ FGristFiles _glue$(SUFOBJ) $(files:S=$(SUFOBJ)) ] ;
+    local _c =   [ FGristFiles _glue.c $(files:S=.c) ] ;
+    local _el  = [ FGristFiles $(files:S=.el) ] ;
+    SEARCH on $(_obj) $(_c) $(_el) = $(SEARCH_SOURCE) ;
+
+    local _i ;
+    for _i in [ FGristFiles _glue.c $(files:S=.c) ] {
+      SEARCH on $(_i) = $(SEARCH_SOURCE) ;
+      local _mobj = [ FGristFiles $(_i:S=$(SUFOBJ)) ] ;
+      MakeLocate $(_mobj) : $(LOCATE_TARGET) ;
+      
+      Cc $(_mobj) : $(_i) ;
+      
+      LinkDLL $(_dll) : $(_mobj) ;
+    }
+
+    if ! $(PARENT) {
+      Clean clean : $(_obj) $(_el) ;
+    }
+    Clean clean-all : $(_obj) $(_el) ;
+  }
+}
+
+rule DylanLibraryLinkerOptions image : options {
+  # DylanLibraryLinkerOptions image : options ;
+  #Echo DylanLibraryLinkerOptions $(image) ":" $(options) ;
+
+  # Add the given options to the link command line of the shared library
+  # and executable images.
+
+  local _dll = [ FDLLName $(image) ] ;
+  local _exe = [ FEXEName $(image) ] ;
+
+  LINKLIBS on $(_dll) += $(options) ;
+  LINKLIBS on $(_exe) += $(options) ;
+}
+
+rule DylanLibraryBaseAddress image : address {
+  # DylanLibraryBaseAddress image : address ;
+  #Echo DylanLibraryBaseAddress $(image) ":" $(address) ;
+
+  # Set the base address of the shared library.
+  
+  local _dll = [ FDLLName $(image) ] ;
+  BASE on $(_dll) ?= $(address) ;
+}
+
+rule DylanLibraryCLibraries image : libraries {
+  # DylanLibraryCLibraries image : libraries ;
+  #Echo DylanLibraryCLibraries $(image) ":" $(libraries) ;
+
+  # Link C (or other externally-derived) libraries into the shared library.
+  
+  local _dll = [ FDLLName $(image) ] ;
+
+  for lib in $(libraries) {
+    switch $(lib) {
+      case -L* : LINKLIBS on $(_dll) += $(lib) ;
+      case -l* : LINKLIBS on $(_dll) += $(lib) ;
+      case *.a : lib = [ FGristFiles $(lib) ] ;
+		 SEARCH on $(lib) = $(SEARCH_SOURCE) ;
+		 Depends $(_dll) : $(lib) ;
+		 NEEDLIBS on $(_dll) += $(lib) ;
+      case * :   Exit Unknown C library $(lib) ;
+    }
+  }
+}
+
+rule DylanLibraryCObjects image : objects {
+  # DylanLibraryCObjects image : objects ;
+  #Echo DylanLibraryCObjects $(image) ":" $(objects) ;
+
+  # Link C (or other externally-derived) object files into the shared library.
+    if ! $(SYSTEM) {
+      local _dll = [ FDLLName $(image) ] ;
+      SEARCH on $(objects) = $(SEARCH_SOURCE) ;
+      LinkDLL $(_dll) : $(objects) ;
+    }
+}
+
+rule DylanLibraryCSources image : sources {
+  # DylanLibraryCSources image : sources ;
+  #Echo DylanLibraryCSources $(image) ":" $(sources) ;
+
+  # Link C source files into the shared library.
+  if ! $(SYSTEM) {
+    local _dll = [ FDLLName $(image) ] ;
+    local _exe = [ FEXEName $(image) ] ;
+
+    local _i ;
+    for _i in [ FGristFiles $(sources) ] {
+      SEARCH on $(_i) = $(SEARCH_SOURCE) ;
+      local _obj = [ FGristFiles $(_i:S=$(SUFOBJ)) ] ;
+      MakeLocate $(_obj) : $(LOCATE_TARGET) ;
+      
+      Cc $(_obj) : $(_i) ;
+      
+      LinkDLL $(_dll) : $(_obj) ;
+      LinkEXE $(_exe) : $(_obj) ;
+    }
+  }
+}
+
+rule DylanLibraryCHeaders image : headers {
+  # DylanLibraryCHeaders image : headers ;
+  #Echo DylanLibraryCHeaders $(image) ":" $(headers) ;
+
+  # Mark the shared library as depending on the given header files.
+  # TODO: The original build-system didn't do anything with this either.
+}
+
+rule DylanLibraryRCFiles image : rcfiles {
+  # DylanLibraryRCFiles image : rcfiles ;
+  #Echo DylanLibraryRCFiles $(image) ":" $(rcfiles) ;
+  
+  # Link Win32 resource files into the shared library and executable.
+  
+  Echo Ignoring RC file(s) $(rcfiles) ;
+}
+
+rule DylanLibraryJamIncludes image : includes {
+  # DylanLibraryJamIncludes image : includes ;
+  
+  Echo Ignoring Jam include file(s) $(includes) ;
+}
+
+rule DylanLibraryUses image : library : dir {
+  # DylanLibraryUses image : library : dir ;
+  #Echo DylanLibraryUses $(image) ":" $(library) ":" $(dir) ;
+
+  # Link other Dylan libraries into the shared library.
+
+  if ! $(_dll_$(library:L)) {
+    local PARENT = $(image[1]:L) ;
+
+    if $(dir) = system || $(SYSTEM) {
+      # This is a system library; read $(SYSTEM_LIBDIR)/$(library:L).mkf
+
+      local SYSTEM = true ;
+      local LIBDIR = $(SYSTEM_LIBDIR) ;
+      local BINDIR = $(SYSTEM_BINDIR) ;
+      
+      local SEARCH_SOURCE LOCATE_SOURCE LOCATE_TARGET = $(SYSTEM_LIBDIR) ;
+      local SOURCE_GRIST ;
+      
+      local _mkf = $(library:LS=$(SUFMKF)) ;
+      SEARCH on $(_mkf) ?= $(SYSTEM_LIBDIR) ;
+      IncludeMKF $(_mkf) ;
+    }
+    else {
+      # Another personal library; read its mkf from its build directory.
+	
+      local SEARCH_SOURCE LOCATE_SOURCE LOCATE_TARGET
+        = $(dir:R=$(LOCATE_TARGET:E=$(DOT))) ;
+      local SOURCE_GRIST ;
+
+      local LIBDIR BINDIR ;
+      {
+	local _lib = lib ;
+	local _bin = bin ;
+
+	LIBDIR = $(_lib:P=$(PERSONAL_ROOT:E=$(LOCATE_TARGET:P))) ;
+	BINDIR = $(_bin:P=$(PERSONAL_ROOT:E=$(LOCATE_TARGET:P))) ;
+      }
+
+      local _mkf = $(MKF:G=$(library:L)) ;
+      SEARCH on $(_mkf) ?= $(SEARCH_SOURCE) ;
+      IncludeMKF $(_mkf) ;
+    }
+  }
+
+  DylanLibraryClosure $(image) : $(library:L) ;
+}
+
+rule DylanLibraryClosure image : libraries {
+  local _dll = [ FDLLName $(image) ] ;
+  local _exe = [ FEXEName $(image) ] ;
+
+  local _i ;
+  for _i in $(libraries) {
+    if ! $(_i) in $(_use_$(image[1]:L)) {
+      _use_$(image[1]:L) += $(_i) ;
+      Depends $(_dll) $(_exe) : $(_dll_$(_i)) ;
+      LINKLIBS on $(_dll) $(_exe) += -l$(_i) ;
+
+      LIBPATH on $(_dll) $(_exe) += $(_dir_$(_i)) ;
+
+      DylanLibraryClosure $(image) : $(_use_$(_i)) ;
+    }
+  }
+}
+
+#
+# Build rules and actions
+#
+
+rule LinkDLL {
+  Depends $(<) : $(>) ;
+}
+
+actions together LinkDLL bind NEEDLIBS {
+  $(CC) -dynamiclib -flat_namespace -o $(<)  $(LINKFLAGS) $(>) -L"$(LIBPATH)" $(NEEDLIBS) $(LINKLIBS)
+}
+
+rule LinkEXE {
+  Depends $(<) : $(>) ;
+}
+
+actions together LinkEXE bind NEEDLIBS {
+   $(CC) -o $(<)  $(LINKFLAGS) $(>) -L"$(LIBPATH)" $(NEEDLIBS) $(LINKLIBS) -lgc -lc
+}
+
+#
+# Utility rules
+#
+
+rule FDLLName {
+  return lib$(<[1]:LS=$(SUFDLL)) ;
+}
+
+rule FEXEName {
+  return $(<[1]:L) ;
+}

Modified: trunk/fundev/sources/dfmc/c-run-time/run-time.c
==============================================================================
--- trunk/fundev/sources/dfmc/c-run-time/run-time.c	(original)
+++ trunk/fundev/sources/dfmc/c-run-time/run-time.c	Tue Apr 24 02:10:48 2007
@@ -5,6 +5,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <gc/gc.h>
 
 #ifdef macintosh
 #include <MacTypes.h>

Modified: trunk/fundev/sources/dfmc/c-run-time/run-time.h
==============================================================================
--- trunk/fundev/sources/dfmc/c-run-time/run-time.h	(original)
+++ trunk/fundev/sources/dfmc/c-run-time/run-time.h	Tue Apr 24 02:10:48 2007
@@ -1,5 +1,4 @@
 #include <setjmp.h>
-#include <gc/gc.h>
 
 #define OPTIONAL_ARGUMENT_CHECK(fn, req, count)
 #define REQUIRED_ARGUMENT_CHECK(fn, req, count)

Added: trunk/fundev/sources/dfmc/c-run-time/x86-darwin-build.jam
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/dfmc/c-run-time/x86-darwin-build.jam	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,368 @@
+#
+# Configuration variables
+#
+
+CC	?= gcc ;
+
+MKF	?= dylanmakefile.mkf ;
+
+SUFOBJ	?= .o ;			# object files suffix
+SUFASM	?= .s ;			# assembly source files suffix
+SUFLIB	?= .a ;			# static library suffix
+SUFDLL	?= .dylib ;	# shared library suffix
+SUFMKF	?= .mkf ;   # build-system files
+
+{
+  local _lib = lib ;
+  local _bin = bin ;
+  local _inc = include ;
+
+  # SYSTEM_ROOT is set by the build-system
+  SYSTEM_LIBDIR ?= $(_lib:P=$(SYSTEM_ROOT)) ;
+  SYSTEM_BINDIR ?= $(_bin:P=$(SYSTEM_ROOT)) ;
+  SYSTEM_INCDIR ?= $(_inc:P=$(SYSTEM_ROOT)) ;
+
+  # PERSONAL_ROOT is set by the build-system
+  PERSONAL_LIBDIR ?= $(_lib:P=$(PERSONAL_ROOT)) ;
+  PERSONAL_BINDIR ?= $(_bin:P=$(PERSONAL_ROOT)) ;
+
+  # . is set by the build system
+  LIBDIR ?= $(_lib:P=$(PERSONAL_ROOT:E=$(.:P))) ;
+  BINDIR ?= $(_bin:P=$(PERSONAL_ROOT:E=$(.:P))) ;
+  HDRS ?= $(SYSTEM_INCDIR) ;
+}
+
+CCFLAGS ?= -fdefer-pop -fguess-branch-probability -fcprop-registers -floop-optimize -fif-conversion -fif-conversion2 -ftree-ccp -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs -ftree-sra -ftree-copyrename -ftree-fre -ftree-ch -fmerge-constants -fomit-frame-pointer -fPIC -fno-common -g0 ;
+
+#
+# Runtime
+#
+
+RTOBJS ?= posix-threads.o
+	  debug-print.o
+	  run-time.o ;
+
+rtlibs ?= $(SYSTEM_LIBDIR)/runtime/$(RTOBJS) -lgc -lpthread -ldl -lm ;
+
+guilflags ?= ;
+
+#
+# Jambase
+#
+include $(SYSTEM_LIBDIR)/mini-jambase.jam ;
+
+#
+# Pseudo-targets
+#
+
+NotFile all lib dll exe unify-dll unify-exe release dirs clean clean-all ;
+Always clean clean-all ;
+
+#
+# Rules called from jam-build
+#
+
+# In each of the following rules, $(image[1]) contains the name from
+# the Library: header, and $(image[2]) contains the name from
+# the Executable: header (if present).
+
+rule DylanLibrary image : version {
+  # DylanLibrary image : version ;
+  #Echo DylanLibrary $(image) ":" $(version) ;
+
+  # Link a Dylan library as a shared library or executable image.
+
+  local _dll = [ FDLLName $(image) ] ;
+  local _exe = [ FEXEName $(image) ] ;
+
+  # Here we save the name and search directory of the DLL for this library.
+  
+  _dll_$(image[1]:L) = $(_dll) ;
+  if ! $(SYSTEM) && ! $(PERSONAL_ROOT) {
+    _dir_$(image[1]:L) = $(LIBDIR) ;
+  }
+
+  # Shared libraries and executable images
+
+  MakeLocate $(_dll) : $(LIBDIR) ;
+  MakeLocate $(_exe) : $(BINDIR) ;
+
+  # Initial library search path
+  
+  LIBPATH on $(_dll) = $(PERSONAL_LIBDIR) ;
+  LIBPATH on $(_exe) = $(PERSONAL_LIBDIR:E=$(LIBDIR)) ;
+ 
+  # We'll use the library name as the grist to identify referenced
+  # source and object files.
+  
+  SOURCE_GRIST = $(image[1]:L) ;
+
+  # Save the current dylanmakefile.mkf for reference by other libraries
+  # in the event that it later becomes a system library.
+
+  local _mkf = $(image[1]:LS=$(SUFMKF)) ;
+  MakeLocate $(_mkf) : $(LIBDIR) ;
+  if ! $(SYSTEM) {
+    File $(_mkf) : [ FGristFiles $(MKF) ] ;
+    Depends $(_dll) : $(_mkf) ;
+  }
+
+  # The executable depends only on _main.o and the DLL.
+
+  local _obj = [ FGristFiles _main$(SUFOBJ) ] ;
+  local _c   = [ FGristFiles _main.c   ] ;
+  SEARCH on $(_obj) $(_c) = $(SEARCH_SOURCE) ;
+ 
+  Cc $(_obj) : $(_c) ;
+  Depends $(_exe) : $(_dll) ;
+  LINKLIBS on $(_exe) += -l$(image[1]:L) ;
+  LinkEXE $(_exe) : $(_obj) ;
+
+  # If this is the top-level project, make the dll, exe, and clean
+  # targets depend on its build products.
+  
+  if ! $(PARENT) {
+    Depends dll : $(_dll) ;
+    Depends exe : $(_exe) ;
+
+    Clean clean : $(_dll) $(_exe) $(_mkf) $(_obj) ;
+  }
+  Clean clean-all : $(_dll) $(_exe) $(_mkf) $(_obj) ;
+
+  # Mark the library version
+
+  VERSION on $(_dll) ?= $(version:J=.) ;
+  VERSION on $(_exe) ?= $(version:J=.) ;
+}
+
+rule DylanLibraryFiles image : files {
+  # DylanLibraryFiles image : files ;
+  #Echo DylanLibraryFiles $(image) ":" $(files) ;
+
+  # Link Dylan-derived object files into the resulting shared library.
+  if ! $(SYSTEM) {
+    local _dll = [ FDLLName $(image) ] ;
+    
+    local _obj = [ FGristFiles _glue$(SUFOBJ) $(files:S=$(SUFOBJ)) ] ;
+    local _c =   [ FGristFiles _glue.c $(files:S=.c) ] ;
+    local _el  = [ FGristFiles $(files:S=.el) ] ;
+    SEARCH on $(_obj) $(_c) $(_el) = $(SEARCH_SOURCE) ;
+
+    local _i ;
+    for _i in [ FGristFiles _glue.c $(files:S=.c) ] {
+      SEARCH on $(_i) = $(SEARCH_SOURCE) ;
+      local _mobj = [ FGristFiles $(_i:S=$(SUFOBJ)) ] ;
+      MakeLocate $(_mobj) : $(LOCATE_TARGET) ;
+      
+      Cc $(_mobj) : $(_i) ;
+      
+      LinkDLL $(_dll) : $(_mobj) ;
+    }
+
+    if ! $(PARENT) {
+      Clean clean : $(_obj) $(_el) ;
+    }
+    Clean clean-all : $(_obj) $(_el) ;
+  }
+}
+
+rule DylanLibraryLinkerOptions image : options {
+  # DylanLibraryLinkerOptions image : options ;
+  #Echo DylanLibraryLinkerOptions $(image) ":" $(options) ;
+
+  # Add the given options to the link command line of the shared library
+  # and executable images.
+
+  local _dll = [ FDLLName $(image) ] ;
+  local _exe = [ FEXEName $(image) ] ;
+
+  LINKLIBS on $(_dll) += $(options) ;
+  LINKLIBS on $(_exe) += $(options) ;
+}
+
+rule DylanLibraryBaseAddress image : address {
+  # DylanLibraryBaseAddress image : address ;
+  #Echo DylanLibraryBaseAddress $(image) ":" $(address) ;
+
+  # Set the base address of the shared library.
+  
+  local _dll = [ FDLLName $(image) ] ;
+  BASE on $(_dll) ?= $(address) ;
+}
+
+rule DylanLibraryCLibraries image : libraries {
+  # DylanLibraryCLibraries image : libraries ;
+  #Echo DylanLibraryCLibraries $(image) ":" $(libraries) ;
+
+  # Link C (or other externally-derived) libraries into the shared library.
+  
+  local _dll = [ FDLLName $(image) ] ;
+
+  for lib in $(libraries) {
+    switch $(lib) {
+      case -L* : LINKLIBS on $(_dll) += $(lib) ;
+      case -l* : LINKLIBS on $(_dll) += $(lib) ;
+      case *.a : lib = [ FGristFiles $(lib) ] ;
+		 SEARCH on $(lib) = $(SEARCH_SOURCE) ;
+		 Depends $(_dll) : $(lib) ;
+		 NEEDLIBS on $(_dll) += $(lib) ;
+      case * :   Exit Unknown C library $(lib) ;
+    }
+  }
+}
+
+rule DylanLibraryCObjects image : objects {
+  # DylanLibraryCObjects image : objects ;
+  #Echo DylanLibraryCObjects $(image) ":" $(objects) ;
+
+  # Link C (or other externally-derived) object files into the shared library.
+    if ! $(SYSTEM) {
+      local _dll = [ FDLLName $(image) ] ;
+      SEARCH on $(objects) = $(SEARCH_SOURCE) ;
+      LinkDLL $(_dll) : $(objects) ;
+    }
+}
+
+rule DylanLibraryCSources image : sources {
+  # DylanLibraryCSources image : sources ;
+  #Echo DylanLibraryCSources $(image) ":" $(sources) ;
+
+  # Link C source files into the shared library.
+  if ! $(SYSTEM) {
+    local _dll = [ FDLLName $(image) ] ;
+    local _exe = [ FEXEName $(image) ] ;
+
+    local _i ;
+    for _i in [ FGristFiles $(sources) ] {
+      SEARCH on $(_i) = $(SEARCH_SOURCE) ;
+      local _obj = [ FGristFiles $(_i:S=$(SUFOBJ)) ] ;
+      MakeLocate $(_obj) : $(LOCATE_TARGET) ;
+      
+      Cc $(_obj) : $(_i) ;
+      
+      LinkDLL $(_dll) : $(_obj) ;
+      LinkEXE $(_exe) : $(_obj) ;
+    }
+  }
+}
+
+rule DylanLibraryCHeaders image : headers {
+  # DylanLibraryCHeaders image : headers ;
+  #Echo DylanLibraryCHeaders $(image) ":" $(headers) ;
+
+  # Mark the shared library as depending on the given header files.
+  # TODO: The original build-system didn't do anything with this either.
+}
+
+rule DylanLibraryRCFiles image : rcfiles {
+  # DylanLibraryRCFiles image : rcfiles ;
+  #Echo DylanLibraryRCFiles $(image) ":" $(rcfiles) ;
+  
+  # Link Win32 resource files into the shared library and executable.
+  
+  Echo Ignoring RC file(s) $(rcfiles) ;
+}
+
+rule DylanLibraryJamIncludes image : includes {
+  # DylanLibraryJamIncludes image : includes ;
+  
+  Echo Ignoring Jam include file(s) $(includes) ;
+}
+
+rule DylanLibraryUses image : library : dir {
+  # DylanLibraryUses image : library : dir ;
+  #Echo DylanLibraryUses $(image) ":" $(library) ":" $(dir) ;
+
+  # Link other Dylan libraries into the shared library.
+
+  if ! $(_dll_$(library:L)) {
+    local PARENT = $(image[1]:L) ;
+
+    if $(dir) = system || $(SYSTEM) {
+      # This is a system library; read $(SYSTEM_LIBDIR)/$(library:L).mkf
+
+      local SYSTEM = true ;
+      local LIBDIR = $(SYSTEM_LIBDIR) ;
+      local BINDIR = $(SYSTEM_BINDIR) ;
+      
+      local SEARCH_SOURCE LOCATE_SOURCE LOCATE_TARGET = $(SYSTEM_LIBDIR) ;
+      local SOURCE_GRIST ;
+      
+      local _mkf = $(library:LS=$(SUFMKF)) ;
+      SEARCH on $(_mkf) ?= $(SYSTEM_LIBDIR) ;
+      IncludeMKF $(_mkf) ;
+    }
+    else {
+      # Another personal library; read its mkf from its build directory.
+	
+      local SEARCH_SOURCE LOCATE_SOURCE LOCATE_TARGET
+        = $(dir:R=$(LOCATE_TARGET:E=$(DOT))) ;
+      local SOURCE_GRIST ;
+
+      local LIBDIR BINDIR ;
+      {
+	local _lib = lib ;
+	local _bin = bin ;
+
+	LIBDIR = $(_lib:P=$(PERSONAL_ROOT:E=$(LOCATE_TARGET:P))) ;
+	BINDIR = $(_bin:P=$(PERSONAL_ROOT:E=$(LOCATE_TARGET:P))) ;
+      }
+
+      local _mkf = $(MKF:G=$(library:L)) ;
+      SEARCH on $(_mkf) ?= $(SEARCH_SOURCE) ;
+      IncludeMKF $(_mkf) ;
+    }
+  }
+
+  DylanLibraryClosure $(image) : $(library:L) ;
+}
+
+rule DylanLibraryClosure image : libraries {
+  local _dll = [ FDLLName $(image) ] ;
+  local _exe = [ FEXEName $(image) ] ;
+
+  local _i ;
+  for _i in $(libraries) {
+    if ! $(_i) in $(_use_$(image[1]:L)) {
+      _use_$(image[1]:L) += $(_i) ;
+      Depends $(_dll) $(_exe) : $(_dll_$(_i)) ;
+      LINKLIBS on $(_dll) $(_exe) += -l$(_i) ;
+
+      LIBPATH on $(_dll) $(_exe) += $(_dir_$(_i)) ;
+
+      DylanLibraryClosure $(image) : $(_use_$(_i)) ;
+    }
+  }
+}
+
+#
+# Build rules and actions
+#
+
+rule LinkDLL {
+  Depends $(<) : $(>) ;
+}
+
+actions together LinkDLL bind NEEDLIBS {
+  $(CC) -dynamiclib -flat_namespace -o $(<)  $(LINKFLAGS) $(>) -L"$(LIBPATH)" $(NEEDLIBS) $(LINKLIBS)
+}
+
+rule LinkEXE {
+  Depends $(<) : $(>) ;
+}
+
+actions together LinkEXE bind NEEDLIBS {
+   $(CC) -o $(<)  $(LINKFLAGS) $(>) -L"$(LIBPATH)" $(NEEDLIBS) $(LINKLIBS) -lgc -lc
+}
+
+#
+# Utility rules
+#
+
+rule FDLLName {
+  return lib$(<[1]:LS=$(SUFDLL)) ;
+}
+
+rule FEXEName {
+  return $(<[1]:L) ;
+}

Modified: trunk/fundev/sources/lib/build-system/jam-build.dylan
==============================================================================
--- trunk/fundev/sources/lib/build-system/jam-build.dylan	(original)
+++ trunk/fundev/sources/lib/build-system/jam-build.dylan	Tue Apr 24 02:10:48 2007
@@ -112,7 +112,7 @@
     select($os-name)
       #"win32" =>
         jam-variable(state, "NT") := #["true"];
-      #"linux", #"freebsd", #"solaris", #"osf3" =>
+      #"linux", #"freebsd", #"solaris", #"osf3", #"darwin" =>
         jam-variable(state, "UNIX") := #["true"];
     end select;
     

Added: trunk/fundev/sources/registry/ppc-darwin/Open-Source-License.txt
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/Open-Source-License.txt	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,21 @@
+The contents of this library are subject to the Functional Objects Library
+Public License Version 1.0 (the "License"); you may not use this library
+except in compliance with the License. You may obtain a copy of the License
+at http://www.functionalobjects.com/licenses/library-public-license-1.0.txt
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the License.
+
+Original Code is Copyright (c) 1996-2004 Functional Objects, Inc.
+All rights reserved.
+
+Alternatively, the contents of this library may be used under the
+terms of the GNU Lesser General Public License (the "GLGPL"), in which
+case the provisions of the GLGPL are applicable instead of those above. If
+you wish to allow use of your version of this library only under the
+terms of the GLGPL and not to allow others to use your version of this
+library under the License, indicate your decision by deleting the provisions
+above and replace them with the notice and other provisions required
+by the GLGPL. If you do not delete the provisions above, a recipient
+may use your version of this library under either the License or the GLGPL.

Added: trunk/fundev/sources/registry/ppc-darwin/basic-pentium-dw
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/basic-pentium-dw	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/app/dw/basic-pentium-dw.lid

Added: trunk/fundev/sources/registry/ppc-darwin/c-ffi
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/c-ffi	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/c-ffi/unix-c-ffi.lid

Added: trunk/fundev/sources/registry/ppc-darwin/common-dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/common-dylan	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/common-dylan/darwin-common-dylan.lid

Added: trunk/fundev/sources/registry/ppc-darwin/dood
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/dood	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/dood/dood.lid

Added: trunk/fundev/sources/registry/ppc-darwin/io
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/io	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/io/unix-io.lid

Added: trunk/fundev/sources/registry/ppc-darwin/jam
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/jam	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/jam/unix-jam.lid

Added: trunk/fundev/sources/registry/ppc-darwin/network
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/network	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/network/x86-freebsd-network.lid

Added: trunk/fundev/sources/registry/ppc-darwin/system
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/system	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/system/ppc-darwin-system.lid

Added: trunk/fundev/sources/registry/ppc-darwin/unix-portability
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/unix-portability	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/unix-portability/freebsd-portability.lid

Added: trunk/fundev/sources/registry/ppc-darwin/variable-search
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/ppc-darwin/variable-search	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/variable-search/freebsd-variable-search.lid

Added: trunk/fundev/sources/registry/x86-darwin/Open-Source-License.txt
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/Open-Source-License.txt	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,21 @@
+The contents of this library are subject to the Functional Objects Library
+Public License Version 1.0 (the "License"); you may not use this library
+except in compliance with the License. You may obtain a copy of the License
+at http://www.functionalobjects.com/licenses/library-public-license-1.0.txt
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the License.
+
+Original Code is Copyright (c) 1996-2004 Functional Objects, Inc.
+All rights reserved.
+
+Alternatively, the contents of this library may be used under the
+terms of the GNU Lesser General Public License (the "GLGPL"), in which
+case the provisions of the GLGPL are applicable instead of those above. If
+you wish to allow use of your version of this library only under the
+terms of the GLGPL and not to allow others to use your version of this
+library under the License, indicate your decision by deleting the provisions
+above and replace them with the notice and other provisions required
+by the GLGPL. If you do not delete the provisions above, a recipient
+may use your version of this library under either the License or the GLGPL.

Added: trunk/fundev/sources/registry/x86-darwin/basic-pentium-dw
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/basic-pentium-dw	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/app/dw/basic-pentium-dw.lid

Added: trunk/fundev/sources/registry/x86-darwin/c-ffi
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/c-ffi	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/c-ffi/unix-c-ffi.lid

Added: trunk/fundev/sources/registry/x86-darwin/common-dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/common-dylan	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/common-dylan/darwin-common-dylan.lid

Added: trunk/fundev/sources/registry/x86-darwin/dood
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/dood	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/dood/dood.lid

Added: trunk/fundev/sources/registry/x86-darwin/io
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/io	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/io/unix-io.lid

Added: trunk/fundev/sources/registry/x86-darwin/jam
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/jam	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/jam/unix-jam.lid

Added: trunk/fundev/sources/registry/x86-darwin/network
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/network	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/network/x86-freebsd-network.lid

Added: trunk/fundev/sources/registry/x86-darwin/system
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/system	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/system/x86-darwin-system.lid

Added: trunk/fundev/sources/registry/x86-darwin/unix-portability
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/unix-portability	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/unix-portability/freebsd-portability.lid

Added: trunk/fundev/sources/registry/x86-darwin/variable-search
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/registry/x86-darwin/variable-search	Tue Apr 24 02:10:48 2007
@@ -0,0 +1 @@
+abstract://dylan/lib/variable-search/freebsd-variable-search.lid

Modified: trunk/fundev/sources/system/file-system/unix-ffi.dylan
==============================================================================
--- trunk/fundev/sources/system/file-system/unix-ffi.dylan	(original)
+++ trunk/fundev/sources/system/file-system/unix-ffi.dylan	Tue Apr 24 02:10:48 2007
@@ -44,14 +44,14 @@
 
 /// From <sys/stat.h> ...
 
-define system-offset stat-size (alpha-linux 10, x86-linux 22, ppc-linux 22, x86-freebsd 24) 18;
-define system-offset st-mode (x86-linux 4, ppc-linux 4, x86-freebsd 2) 2;
-define system-offset st-uid (x86-linux 6, ppc-linux 6, x86-freebsd 3) 4;
-define system-offset st-gid (x86-linux 7, ppc-linux 7, x86-freebsd 4) 5;
-define system-offset st-size (alpha-linux 4, x86-linux 11, ppc-linux 11, x86-freebsd 12) 7;
-define system-offset st-atime (alpha-linux 10, x86-linux 14, ppc-linux 14, x86-freebsd 6) 8;
-define system-offset st-mtime (alpha-linux 12, x86-linux 16, ppc-linux 16, x86-freebsd 8) 10;
-define system-offset st-ctime (alpha-linux 14, x86-linux 18, ppc-linux 18, x86-freebsd 10) 12;
+define system-offset stat-size (alpha-linux 10, x86-linux 22, ppc-linux 22, x86-freebsd 24, x86-darwin 24, ppc-darwin 24) 18;
+define system-offset st-mode (x86-linux 4, ppc-linux 4, x86-freebsd 2, x86-darwin 2, ppc-darwin 2) 2;
+define system-offset st-uid (x86-linux 6, ppc-linux 6, x86-freebsd 3, x86-darwin 3, ppc-darwin 3) 4;
+define system-offset st-gid (x86-linux 7, ppc-linux 7, x86-freebsd 4, x86-darwin 4, ppc-darwin 4) 5;
+define system-offset st-size (alpha-linux 4, x86-linux 11, ppc-linux 11, x86-freebsd 12, x86-darwin 12, ppc-darwin 12) 7;
+define system-offset st-atime (alpha-linux 10, x86-linux 14, ppc-linux 14, x86-freebsd 6, x86-darwin 6, ppc-darwin 6) 8;
+define system-offset st-mtime (alpha-linux 12, x86-linux 16, ppc-linux 16, x86-freebsd 8, x86-darwin 8, ppc-darwin 8) 10;
+define system-offset st-ctime (alpha-linux 14, x86-linux 18, ppc-linux 18, x86-freebsd 10, x86-darwin 10, ppc-darwin 10) 12;
 
 define constant $STAT_SIZE = 
   $stat-size-offset * raw-as-integer(primitive-word-size());
@@ -86,21 +86,21 @@
 
 define inline-only function st-mode (st :: <machine-word>) => (mode :: <abstract-integer>)
   raw-as-abstract-integer
-  (primitive-c-unsigned-int-at(primitive-unwrap-machine-word(st),
+  (primitive-c-unsigned-short-at(primitive-unwrap-machine-word(st),
 			       integer-as-raw($st-mode-offset),
 			       integer-as-raw(0)))
 end function st-mode;
 
 define inline-only function st-uid (st :: <machine-word>) => (uid :: <abstract-integer>)
   raw-as-abstract-integer
-  (primitive-c-unsigned-int-at(primitive-unwrap-machine-word(st),
+  (primitive-c-unsigned-short-at(primitive-unwrap-machine-word(st),
 			       integer-as-raw($st-uid-offset),
 			       integer-as-raw(0)))
 end function st-uid;
 
 define inline-only function st-gid (st :: <machine-word>) => (gid :: <abstract-integer>)
   raw-as-abstract-integer
-  (primitive-c-unsigned-int-at(primitive-unwrap-machine-word(st),
+  (primitive-c-unsigned-short-at(primitive-unwrap-machine-word(st),
 			       integer-as-raw($st-gid-offset),
 			       integer-as-raw(0)))
 end function st-gid;
@@ -140,7 +140,7 @@
 /// From <pwd.h> ...
 
 define system-offset passwd-name () 0;
-define system-offset passwd-dir (alpha-linux 4, x86-freebsd 7) 5;
+define system-offset passwd-dir (alpha-linux 4, x86-freebsd 7, x86-darwin 7, ppc-darwin 7) 5;
 
 define inline-only function passwd-name (passwd :: <machine-word>) => (name :: <byte-string>)
   primitive-raw-as-string
@@ -173,7 +173,7 @@
 
 /// From <dirent.h> ...
 
-define system-offset dirent-name (x86-linux 11, ppc-linux 11, x86-freebsd 8) 8;
+define system-offset dirent-name (x86-linux 11, ppc-linux 11, x86-freebsd 8, x86-darwin 8, ppc-darwin 8) 8;
 
 define inline-only function dirent-name (dirent :: <machine-word>) => (name :: <byte-string>)
   primitive-raw-as-string

Modified: trunk/fundev/sources/system/file-system/unix-interface.dylan
==============================================================================
--- trunk/fundev/sources/system/file-system/unix-interface.dylan	(original)
+++ trunk/fundev/sources/system/file-system/unix-interface.dylan	Tue Apr 24 02:10:48 2007
@@ -151,14 +151,14 @@
       #"linux"              =>   64;
       #"Solaris2", #"IRIX5" =>  256;
       #"SunOS4", #"OSF3"    =>  512;
-      #"freebsd"            => #x200;
+      #"freebsd", #"darwin" => #x200;
     end;
 
 define constant $o_trunc
   = select ($os-name)
       #"Solaris2", #"IRIX5",  #"linux" =>  512;
       #"SunOS4", #"OSF3"               => 1024;
-      #"freebsd"                       => #x400;
+      #"freebsd", #"darwin"            => #x400;
     end;
 
 define constant $o_sync
@@ -167,7 +167,7 @@
       #"linux"              =>  4096;
       #"SunOS4"             =>  8192;
       #"OSF3"               => 16384;
-      #"freebsd"            => #x80;
+      #"freebsd", #"darwin" => #x80;
     end;
 
 // standard unix error definitions

Added: trunk/fundev/sources/system/ppc-darwin-operating-system.dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/system/ppc-darwin-operating-system.dylan	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,8 @@
+Module:       system-internals
+
+define constant $architecture-little-endian? :: <boolean> = #f;
+
+define constant $machine-name = #"ppc";
+define constant $os-name      = #"darwin";
+
+// eof

Added: trunk/fundev/sources/system/ppc-darwin-system.lid
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/system/ppc-darwin-system.lid	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,38 @@
+Library:      system
+Synopsis:     Portable operating system APIs
+Author:       Gail Zacharias
+Major-Version: 2
+Minor-Version: 1
+Other-Files:   Open-Source-License.txt
+Files: library
+       operating-system
+       ppc-darwin-operating-system
+       unix-operating-system
+       tokenize-variable
+       date
+       unix-date-interface
+       durations
+       locators/utilities
+       locators/locators
+       locators/web-locators
+       file-system/file-system
+       file-system/file-stream
+       file-system/multi-buffered-streams
+       file-system/wrapper-file-accessor
+       file-system/unix-ffi
+       file-system/unix-interface
+       file-system/unix-file-system
+       file-system/unix-file-accessor
+       file-system/posix-locators
+       file-system/microsoft-locators
+       file-system/macintosh-locators
+       file-system/native-posix-locators
+       xml
+       settings/settings
+       settings/dummy-settings
+Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
+              All rights reserved.
+License:      Functional Objects Library Public License Version 1.0
+Dual-license: GNU Lesser General Public License
+Warranty:     Distributed WITHOUT WARRANTY OF ANY KIND
+

Added: trunk/fundev/sources/system/x86-darwin-operating-system.dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/system/x86-darwin-operating-system.dylan	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,8 @@
+Module:       system-internals
+
+define constant $architecture-little-endian? :: <boolean> = #t;
+
+define constant $machine-name = #"x86";
+define constant $os-name      = #"darwin";
+
+// eof

Added: trunk/fundev/sources/system/x86-darwin-system.lid
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/system/x86-darwin-system.lid	Tue Apr 24 02:10:48 2007
@@ -0,0 +1,38 @@
+Library:      system
+Synopsis:     Portable operating system APIs
+Author:       Gail Zacharias
+Major-Version: 2
+Minor-Version: 1
+Other-Files:   Open-Source-License.txt
+Files: library
+       operating-system
+       x86-darwin-operating-system
+       unix-operating-system
+       tokenize-variable
+       date
+       unix-date-interface
+       durations
+       locators/utilities
+       locators/locators
+       locators/web-locators
+       file-system/file-system
+       file-system/file-stream
+       file-system/multi-buffered-streams
+       file-system/wrapper-file-accessor
+       file-system/unix-ffi
+       file-system/unix-interface
+       file-system/unix-file-system
+       file-system/unix-file-accessor
+       file-system/posix-locators
+       file-system/microsoft-locators
+       file-system/macintosh-locators
+       file-system/native-posix-locators
+       xml
+       settings/settings
+       settings/dummy-settings
+Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
+              All rights reserved.
+License:      Functional Objects Library Public License Version 1.0
+Dual-license: GNU Lesser General Public License
+Warranty:     Distributed WITHOUT WARRANTY OF ANY KIND
+



More information about the chatter mailing list