[MLton-commit] r6877

Wesley Terpstra wesley at mlton.org
Mon Sep 22 03:06:35 PDT 2008


The library regression should also test using a different header file name
than the library name. Test the most common example: "foo.h" & "libfoo.a"


----------------------------------------------------------------------

U   mlton/trunk/regression/library/check.c
U   mlton/trunk/regression/library/check.sml
D   mlton/trunk/regression/library/lib1.c
D   mlton/trunk/regression/library/lib1.sml
D   mlton/trunk/regression/library/lib2.c
D   mlton/trunk/regression/library/lib2.sml
D   mlton/trunk/regression/library/lib3.c
D   mlton/trunk/regression/library/lib3.sml
D   mlton/trunk/regression/library/lib4.c
D   mlton/trunk/regression/library/lib4.sml
D   mlton/trunk/regression/library/lib5.c
D   mlton/trunk/regression/library/lib5.sml
A   mlton/trunk/regression/library/libm1.c
A   mlton/trunk/regression/library/libm1.sml
A   mlton/trunk/regression/library/libm2.c
A   mlton/trunk/regression/library/libm2.sml
A   mlton/trunk/regression/library/libm3.c
A   mlton/trunk/regression/library/libm3.sml
A   mlton/trunk/regression/library/libm4.c
A   mlton/trunk/regression/library/libm4.sml
A   mlton/trunk/regression/library/libm5.c
A   mlton/trunk/regression/library/libm5.sml
U   mlton/trunk/regression/library/library-test

----------------------------------------------------------------------

Modified: mlton/trunk/regression/library/check.c
===================================================================
--- mlton/trunk/regression/library/check.c	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/check.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,17 +1,17 @@
 #include <assert.h>
 
 #include "check.h"
-#include "lib5.h"
-#include "lib4.h"
-#include "lib3.h"
+#include "m5.h"
+#include "m4.h"
+#include "m3.h"
 
-extern EXTERNAL void* lib3cSymPublic;
-extern EXTERNAL void* lib3cFnPublic(void);
-extern EXTERNAL void* lib4cSymPublic;
-extern EXTERNAL void* lib4cFnPublic(void);
+extern EXTERNAL void* libm3cSymPublic;
+extern EXTERNAL void* libm3cFnPublic(void);
+extern EXTERNAL void* libm4cSymPublic;
+extern EXTERNAL void* libm4cFnPublic(void);
 
-extern PUBLIC void* lib5cSymPublic;
-extern PUBLIC void* lib5cFnPublic(void);
+extern PUBLIC void* libm5cSymPublic;
+extern PUBLIC void* libm5cFnPublic(void);
 
 PRIVATE void* checkcSymPrivate = 0;
 PUBLIC  void* checkcSymPublic  = 0;
@@ -33,21 +33,21 @@
   assert (checksmlFnPrivate() == &checksmlSymPrivate);
   assert (checksmlFnPublic()  == &checksmlSymPublic);
   
-  /* Check lib3 */
-  assert (&lib3smlFnPublic  == lib3smlSymPublic);
-  assert (&lib3cFnPublic    == lib3cSymPublic);
-  assert (lib3smlFnPublic() == &lib3smlSymPublic);
-  assert (lib3cFnPublic()   == &lib3cSymPublic);
+  /* Check libm3 */
+  assert (&libm3smlFnPublic  == libm3smlSymPublic);
+  assert (&libm3cFnPublic    == libm3cSymPublic);
+  assert (libm3smlFnPublic() == &libm3smlSymPublic);
+  assert (libm3cFnPublic()   == &libm3cSymPublic);
   
-  /* Check lib4 */
-  assert (&lib4smlFnPublic  == lib4smlSymPublic);
-  assert (&lib4cFnPublic    == lib4cSymPublic);
-  assert (lib4smlFnPublic() == &lib4smlSymPublic);
-  assert (lib4cFnPublic()   == &lib4cSymPublic);
+  /* Check libm4 */
+  assert (&libm4smlFnPublic  == libm4smlSymPublic);
+  assert (&libm4cFnPublic    == libm4cSymPublic);
+  assert (libm4smlFnPublic() == &libm4smlSymPublic);
+  assert (libm4cFnPublic()   == &libm4cSymPublic);
   
-  /* Check lib5 */
-  assert (&lib5smlFnPublic  == lib5smlSymPublic);
-  assert (&lib5cFnPublic    == lib5cSymPublic);
-  assert (lib5smlFnPublic() == &lib5smlSymPublic);
-  assert (lib5cFnPublic()   == &lib5cSymPublic);
+  /* Check libm5 */
+  assert (&libm5smlFnPublic  == libm5smlSymPublic);
+  assert (&libm5cFnPublic    == libm5cSymPublic);
+  assert (libm5smlFnPublic() == &libm5smlSymPublic);
+  assert (libm5cFnPublic()   == &libm5cSymPublic);
 }

Modified: mlton/trunk/regression/library/check.sml
===================================================================
--- mlton/trunk/regression/library/check.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/check.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,6 +1,6 @@
 (* Prepare lib5 *)
-val () = _import "lib5_open" public : int * string vector -> unit; 
-         (1, Vector.fromList ["lib5"])
+val () = _import "m5_open" public : int * string vector -> unit; 
+         (1, Vector.fromList ["libm5"])
 
 type p = MLton.Pointer.t
 type 'a s = (unit -> 'a) * ('a -> unit)
@@ -35,43 +35,43 @@
 val () = check ("checkcFnPrivate", getCI () = _address "checkcSymPrivate" private : p;)
 val () = check ("checkcFnPublic",  getCB () = _address "checkcSymPublic"  public  : p;)
 
-(* Test symbols in lib3 *)
-val (SB, _) = _symbol "lib3smlSymPublic" external : p s;
-val (CB, _) = _symbol "lib3cSymPublic"   external : p s;
-val getSB = _import "lib3smlFnPublic" external : i;
-val getCB = _import "lib3cFnPublic"   external : i;
+(* Test symbols in libm3 *)
+val (SB, _) = _symbol "libm3smlSymPublic" external : p s;
+val (CB, _) = _symbol "libm3cSymPublic"   external : p s;
+val getSB = _import "libm3smlFnPublic" external : i;
+val getCB = _import "libm3cFnPublic"   external : i;
 
 (* Check function pointers *)
-val () = check ("lib3smlFnPublic", SB () = _address "lib3smlFnPublic" external : p;)
-val () = check ("lib3cFnPublic",   CB () = _address "lib3cFnPublic"   external : p;)
+val () = check ("libm3smlFnPublic", SB () = _address "libm3smlFnPublic" external : p;)
+val () = check ("libm3cFnPublic",   CB () = _address "libm3cFnPublic"   external : p;)
 (* Check symbol pointers *)
-val () = check ("lib3smlSymPublic", getSB () = _address "lib3smlSymPublic" external : p;)
-val () = check ("lib3cSymPublic",   getCB () = _address "lib3cSymPublic"   external : p;)
+val () = check ("libm3smlSymPublic", getSB () = _address "libm3smlSymPublic" external : p;)
+val () = check ("libm3cSymPublic",   getCB () = _address "libm3cSymPublic"   external : p;)
 
-(* Test symbols in lib4 *)
-val (SB, _) = _symbol "lib4smlSymPublic" external : p s;
-val (CB, _) = _symbol "lib4cSymPublic"   external : p s;
-val getSB = _import "lib4smlFnPublic" external : i;
-val getCB = _import "lib4cFnPublic"   external : i;
+(* Test symbols in libm4 *)
+val (SB, _) = _symbol "libm4smlSymPublic" external : p s;
+val (CB, _) = _symbol "libm4cSymPublic"   external : p s;
+val getSB = _import "libm4smlFnPublic" external : i;
+val getCB = _import "libm4cFnPublic"   external : i;
 
 (* Check function pointers *)
-val () = check ("lib4smlFnPublic", SB () = _address "lib4smlFnPublic" external : p;)
-val () = check ("lib4cFnPublic",   CB () = _address "lib4cFnPublic"   external : p;)
+val () = check ("libm4smlFnPublic", SB () = _address "libm4smlFnPublic" external : p;)
+val () = check ("libm4cFnPublic",   CB () = _address "libm4cFnPublic"   external : p;)
 (* Check symbol pointers *)
-val () = check ("lib4smlSymPublic", getSB () = _address "lib4smlSymPublic" external : p;)
-val () = check ("lib4cSymPublic",   getCB () = _address "lib4cSymPublic"   external : p;)
+val () = check ("libm4smlSymPublic", getSB () = _address "libm4smlSymPublic" external : p;)
+val () = check ("libm4cSymPublic",   getCB () = _address "libm4cSymPublic"   external : p;)
 
-(* Test symbols in lib5 *)
-val (SB, _) = _symbol "lib5smlSymPublic" public : p s;
-val (CB, _) = _symbol "lib5cSymPublic"   public : p s;
-val getSB = _import "lib5smlFnPublic" public : i;
-val getCB = _import "lib5cFnPublic"   public : i;
+(* Test symbols in libm5 *)
+val (SB, _) = _symbol "libm5smlSymPublic" public : p s;
+val (CB, _) = _symbol "libm5cSymPublic"   public : p s;
+val getSB = _import "libm5smlFnPublic" public : i;
+val getCB = _import "libm5cFnPublic"   public : i;
 
 (* Check function pointers *)
-val () = check ("lib5smlFnPublic", SB () = _address "lib5smlFnPublic" public : p;)
-val () = check ("lib5cFnPublic",   CB () = _address "lib5cFnPublic"   public : p;)
+val () = check ("libm5smlFnPublic", SB () = _address "libm5smlFnPublic" public : p;)
+val () = check ("libm5cFnPublic",   CB () = _address "libm5cFnPublic"   public : p;)
 (* Check symbol pointers *)
-val () = check ("lib5smlSymPublic", getSB () = _address "lib5smlSymPublic" public : p;)
-val () = check ("lib5cSymPublic",   getCB () = _address "lib5cSymPublic"   public : p;)
+val () = check ("libm5smlSymPublic", getSB () = _address "libm5smlSymPublic" public : p;)
+val () = check ("libm5cSymPublic",   getCB () = _address "libm5cSymPublic"   public : p;)
 
 val () = print "check pointer test complete.\n"

Deleted: mlton/trunk/regression/library/lib1.c
===================================================================
--- mlton/trunk/regression/library/lib1.c	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib1.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,25 +0,0 @@
-#include <assert.h>
-
-#define PART_OF_LIBRARY_LIB1
-#include "lib1.h"
-
-PRIVATE void* lib1cSymPrivate = 0;
-PUBLIC  void* lib1cSymPublic  = 0;
-
-PRIVATE void* lib1cFnPrivate(void) {
-  return &lib1cSymPrivate;
-}
-
-PUBLIC void* lib1cFnPublic(void) {
-  return &lib1cSymPublic;
-}
-
-PRIVATE void lib1confirmC(void) {
-  assert (&lib1smlFnPrivate == lib1smlSymPrivate);
-  assert (&lib1smlFnPublic  == lib1smlSymPublic);
-  assert (&lib1cFnPrivate   == lib1cSymPrivate);
-  assert (&lib1cFnPublic    == lib1cSymPublic);
-  
-  assert (lib1smlFnPrivate() == &lib1smlSymPrivate);
-  assert (lib1smlFnPublic()  == &lib1smlSymPublic);
-}

Deleted: mlton/trunk/regression/library/lib1.sml
===================================================================
--- mlton/trunk/regression/library/lib1.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib1.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,35 +0,0 @@
-type p = MLton.Pointer.t
-
-type 'a s = (unit -> 'a) * ('a -> unit)
-val (_, setSI) = _symbol "lib1smlSymPrivate" alloc private : p s;
-val (_, setSB) = _symbol "lib1smlSymPublic"  alloc public  : p s;
-val (_, setCI) = _symbol "lib1cSymPrivate" private : p s;
-val (_, setCB) = _symbol "lib1cSymPublic"  public  : p s;
-
-type i = (unit -> p)
-type e = i -> unit
-val () = _export "lib1smlFnPrivate" private : e;
-         (fn () => _address "lib1smlSymPrivate" private : p;)
-val () = _export "lib1smlFnPublic" public : e;
-         (fn () => _address "lib1smlSymPublic" public : p;)
-val getCI = _import "lib1cFnPrivate" private : i;
-val getCB = _import "lib1cFnPublic" public : i;
-
-(* Store our idea of what the function pointers are in symbols *)
-val () = setSI (_address "lib1smlFnPrivate" private : p;)
-val () = setSB (_address "lib1smlFnPublic"  public  : p;)
-val () = setCI (_address "lib1cFnPrivate"   private : p;)
-val () = setCB (_address "lib1cFnPublic"    public  : p;)
-
-(* Have C confirm that it sees the same function pointers we do.
- * C will check the values of the variables against it's own pointers.
- * C also checks SML functions return his idea of pointers to our exports.
- *)
-val () = _import "lib1confirmC" private : unit -> unit; ()
-
-(* Confirm that C functions return pointers to address as we expect. *)
-fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
-val () = check ("lib1cFnPrivate", getCI () = _address "lib1cSymPrivate" private : p;)
-val () = check ("lib1cFnPublic",  getCB () = _address "lib1cSymPublic"  public  : p;)
-
-val () = print "lib1 pointer test complete.\n"

Deleted: mlton/trunk/regression/library/lib2.c
===================================================================
--- mlton/trunk/regression/library/lib2.c	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib2.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,35 +0,0 @@
-#include <assert.h>
-
-#define PART_OF_LIBRARY_LIB2
-#include "lib2.h"
-#include "lib1.h"
-
-extern PUBLIC void* lib1cSymPublic;
-extern PUBLIC void* lib1cFnPublic(void);
-
-PRIVATE void* lib2cSymPrivate = 0;
-PUBLIC  void* lib2cSymPublic  = 0;
-
-PRIVATE void* lib2cFnPrivate(void) {
-  return &lib2cSymPrivate;
-}
-
-PUBLIC void* lib2cFnPublic(void) {
-  return &lib2cSymPublic;
-}
-
-PRIVATE void lib2confirmC(void) {
-  assert (&lib2smlFnPrivate == lib2smlSymPrivate);
-  assert (&lib2smlFnPublic  == lib2smlSymPublic);
-  assert (&lib2cFnPrivate   == lib2cSymPrivate);
-  assert (&lib2cFnPublic    == lib2cSymPublic);
-  
-  assert (lib2smlFnPrivate() == &lib2smlSymPrivate);
-  assert (lib2smlFnPublic()  == &lib2smlSymPublic);
-  
-  /* Check lib1 */
-  assert (&lib1smlFnPublic  == lib1smlSymPublic);
-  assert (&lib1cFnPublic    == lib1cSymPublic);
-  assert (lib1smlFnPublic() == &lib1smlSymPublic);
-  assert (lib1cFnPublic()   == &lib1cSymPublic);
-}

Deleted: mlton/trunk/regression/library/lib2.sml
===================================================================
--- mlton/trunk/regression/library/lib2.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib2.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,51 +0,0 @@
-(* Prepare lib1 *)
-val () = _import "lib1_open" public : int * string vector -> unit; 
-         (1, Vector.fromList ["lib1"])
-
-type p = MLton.Pointer.t
-type 'a s = (unit -> 'a) * ('a -> unit)
-val (_, setSI) = _symbol "lib2smlSymPrivate" alloc private : p s;
-val (_, setSB) = _symbol "lib2smlSymPublic"  alloc public  : p s;
-val (_, setCI) = _symbol "lib2cSymPrivate" private : p s;
-val (_, setCB) = _symbol "lib2cSymPublic"  public  : p s;
-
-type i = (unit -> p)
-type e = i -> unit
-val () = _export "lib2smlFnPrivate" private : e;
-         (fn () => _address "lib2smlSymPrivate" private : p;)
-val () = _export "lib2smlFnPublic" public : e;
-         (fn () => _address "lib2smlSymPublic" public : p;)
-val getCI = _import "lib2cFnPrivate" private : i;
-val getCB = _import "lib2cFnPublic" public : i;
-
-(* Store our idea of what the function pointers are in symbols *)
-val () = setSI (_address "lib2smlFnPrivate" private : p;)
-val () = setSB (_address "lib2smlFnPublic"  public  : p;)
-val () = setCI (_address "lib2cFnPrivate"   private : p;)
-val () = setCB (_address "lib2cFnPublic"    public  : p;)
-
-(* Have C confirm that it sees the same function pointers we do.
- * C will check the values of the variables against it's own pointers.
- * C also checks SML functions return his idea of pointers to our exports.
- *)
-val () = _import "lib2confirmC" private : unit -> unit; ()
-
-(* Confirm that C functions return pointers to address as we expect. *)
-fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
-val () = check ("lib2cFnPrivate", getCI () = _address "lib2cSymPrivate" private : p;)
-val () = check ("lib2cFnPublic",  getCB () = _address "lib2cSymPublic"  public  : p;)
-
-(* Test symbols in lib1 *)
-val (SB, _) = _symbol "lib1smlSymPublic" public : p s;
-val (CB, _) = _symbol "lib1cSymPublic"   public : p s;
-val getSB = _import "lib1smlFnPublic" public : i;
-val getCB = _import "lib1cFnPublic"   public : i;
-
-(* Check function pointers *)
-val () = check ("lib1smlFnPublic", SB () = _address "lib1smlFnPublic" public : p;)
-val () = check ("lib1cFnPublic",   CB () = _address "lib1cFnPublic"   public : p;)
-(* Check symbol pointers *)
-val () = check ("lib1smlSymPublic", getSB () = _address "lib1smlSymPublic" public : p;)
-val () = check ("lib1cSymPublic",   getCB () = _address "lib1cSymPublic"   public : p;)
-
-val () = print "lib2 pointer test complete.\n"

Deleted: mlton/trunk/regression/library/lib3.c
===================================================================
--- mlton/trunk/regression/library/lib3.c	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib3.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,44 +0,0 @@
-#include <assert.h>
-
-#define PART_OF_LIBRARY_LIB3
-#include "lib3.h"
-#include "lib2.h"
-#include "lib1.h"
-
-extern EXTERNAL void* lib1cSymPublic;
-extern EXTERNAL void* lib1cFnPublic(void);
-extern EXTERNAL void* lib2cSymPublic;
-extern EXTERNAL void* lib2cFnPublic(void);
-
-PRIVATE void* lib3cSymPrivate = 0;
-PUBLIC  void* lib3cSymPublic  = 0;
-
-PRIVATE void* lib3cFnPrivate(void) {
-  return &lib3cSymPrivate;
-}
-
-PUBLIC void* lib3cFnPublic(void) {
-  return &lib3cSymPublic;
-}
-
-PRIVATE void lib3confirmC(void) {
-  assert (&lib3smlFnPrivate == lib3smlSymPrivate);
-  assert (&lib3smlFnPublic  == lib3smlSymPublic);
-  assert (&lib3cFnPrivate   == lib3cSymPrivate);
-  assert (&lib3cFnPublic    == lib3cSymPublic);
-  
-  assert (lib3smlFnPrivate() == &lib3smlSymPrivate);
-  assert (lib3smlFnPublic()  == &lib3smlSymPublic);
-  
-  /* Check lib1 */
-  assert (&lib1smlFnPublic  == lib1smlSymPublic);
-  assert (&lib1cFnPublic    == lib1cSymPublic);
-  assert (lib1smlFnPublic() == &lib1smlSymPublic);
-  assert (lib1cFnPublic()   == &lib1cSymPublic);
-  
-  /* Check lib2 */
-  assert (&lib2smlFnPublic  == lib2smlSymPublic);
-  assert (&lib2cFnPublic    == lib2cSymPublic);
-  assert (lib2smlFnPublic() == &lib2smlSymPublic);
-  assert (lib2cFnPublic()   == &lib2cSymPublic);
-}

Deleted: mlton/trunk/regression/library/lib3.sml
===================================================================
--- mlton/trunk/regression/library/lib3.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib3.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,64 +0,0 @@
-(* Prepare lib2 *)
-val () = _import "lib2_open" external : int * string vector -> unit; 
-         (1, Vector.fromList ["lib2"])
-
-type p = MLton.Pointer.t
-type 'a s = (unit -> 'a) * ('a -> unit)
-val (_, setSI) = _symbol "lib3smlSymPrivate" alloc private : p s;
-val (_, setSB) = _symbol "lib3smlSymPublic"  alloc public  : p s;
-val (_, setCI) = _symbol "lib3cSymPrivate" private : p s;
-val (_, setCB) = _symbol "lib3cSymPublic"  public  : p s;
-
-type i = (unit -> p)
-type e = i -> unit
-val () = _export "lib3smlFnPrivate" private : e;
-         (fn () => _address "lib3smlSymPrivate" private : p;)
-val () = _export "lib3smlFnPublic" public : e;
-         (fn () => _address "lib3smlSymPublic" public : p;)
-val getCI = _import "lib3cFnPrivate" private : i;
-val getCB = _import "lib3cFnPublic" public : i;
-
-(* Store our idea of what the function pointers are in symbols *)
-val () = setSI (_address "lib3smlFnPrivate" private : p;)
-val () = setSB (_address "lib3smlFnPublic"  public  : p;)
-val () = setCI (_address "lib3cFnPrivate"   private : p;)
-val () = setCB (_address "lib3cFnPublic"    public  : p;)
-
-(* Have C confirm that it sees the same function pointers we do.
- * C will check the values of the variables against it's own pointers.
- * C also checks SML functions return his idea of pointers to our exports.
- *)
-val () = _import "lib3confirmC" private : unit -> unit; ()
-
-(* Confirm that C functions return pointers to address as we expect. *)
-fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
-val () = check ("lib3cFnPrivate", getCI () = _address "lib3cSymPrivate" private : p;)
-val () = check ("lib3cFnPublic",  getCB () = _address "lib3cSymPublic"  public  : p;)
-
-(* Test symbols in lib1 *)
-val (SB, _) = _symbol "lib1smlSymPublic" external : p s;
-val (CB, _) = _symbol "lib1cSymPublic"   external : p s;
-val getSB = _import "lib1smlFnPublic" external : i;
-val getCB = _import "lib1cFnPublic"   external : i;
-
-(* Check function pointers *)
-val () = check ("lib1smlFnPublic", SB () = _address "lib1smlFnPublic" external : p;)
-val () = check ("lib1cFnPublic",   CB () = _address "lib1cFnPublic"   external : p;)
-(* Check symbol pointers *)
-val () = check ("lib1smlSymPublic", getSB () = _address "lib1smlSymPublic" external : p;)
-val () = check ("lib1cSymPublic",   getCB () = _address "lib1cSymPublic"   external : p;)
-
-(* Test symbols in lib2 *)
-val (SB, _) = _symbol "lib2smlSymPublic" external : p s;
-val (CB, _) = _symbol "lib2cSymPublic"   external : p s;
-val getSB = _import "lib2smlFnPublic" external : i;
-val getCB = _import "lib2cFnPublic"   external : i;
-
-(* Check function pointers *)
-val () = check ("lib2smlFnPublic", SB () = _address "lib2smlFnPublic" external : p;)
-val () = check ("lib2cFnPublic",   CB () = _address "lib2cFnPublic"   external : p;)
-(* Check symbol pointers *)
-val () = check ("lib2smlSymPublic", getSB () = _address "lib2smlSymPublic" external : p;)
-val () = check ("lib2cSymPublic",   getCB () = _address "lib2cSymPublic"   external : p;)
-
-val () = print "lib3 pointer test complete.\n"

Deleted: mlton/trunk/regression/library/lib4.c
===================================================================
--- mlton/trunk/regression/library/lib4.c	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib4.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,54 +0,0 @@
-#include <assert.h>
-
-#define PART_OF_LIBRARY_LIB4
-#include "lib4.h"
-#include "lib3.h"
-#include "lib2.h"
-#include "lib1.h"
-
-extern EXTERNAL void* lib1cSymPublic;
-extern EXTERNAL void* lib1cFnPublic(void);
-extern EXTERNAL void* lib2cSymPublic;
-extern EXTERNAL void* lib2cFnPublic(void);
-
-extern PUBLIC void* lib3cSymPublic;
-extern PUBLIC void* lib3cFnPublic(void);
-
-PRIVATE void* lib4cSymPrivate = 0;
-PUBLIC  void* lib4cSymPublic  = 0;
-
-PRIVATE void* lib4cFnPrivate(void) {
-  return &lib4cSymPrivate;
-}
-
-PUBLIC void* lib4cFnPublic(void) {
-  return &lib4cSymPublic;
-}
-
-PRIVATE void lib4confirmC(void) {
-  assert (&lib4smlFnPrivate == lib4smlSymPrivate);
-  assert (&lib4smlFnPublic  == lib4smlSymPublic);
-  assert (&lib4cFnPrivate   == lib4cSymPrivate);
-  assert (&lib4cFnPublic    == lib4cSymPublic);
-  
-  assert (lib4smlFnPrivate() == &lib4smlSymPrivate);
-  assert (lib4smlFnPublic()  == &lib4smlSymPublic);
-  
-  /* Check lib1 */
-  assert (&lib1smlFnPublic  == lib1smlSymPublic);
-  assert (&lib1cFnPublic    == lib1cSymPublic);
-  assert (lib1smlFnPublic() == &lib1smlSymPublic);
-  assert (lib1cFnPublic()   == &lib1cSymPublic);
-  
-  /* Check lib2 */
-  assert (&lib2smlFnPublic  == lib2smlSymPublic);
-  assert (&lib2cFnPublic    == lib2cSymPublic);
-  assert (lib2smlFnPublic() == &lib2smlSymPublic);
-  assert (lib2cFnPublic()   == &lib2cSymPublic);
-  
-  /* Check lib3 */
-  assert (&lib3smlFnPublic  == lib3smlSymPublic);
-  assert (&lib3cFnPublic    == lib3cSymPublic);
-  assert (lib3smlFnPublic() == &lib3smlSymPublic);
-  assert (lib3cFnPublic()   == &lib3cSymPublic);
-}

Deleted: mlton/trunk/regression/library/lib4.sml
===================================================================
--- mlton/trunk/regression/library/lib4.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib4.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,77 +0,0 @@
-(* Prepare lib3 *)
-val () = _import "lib3_open" public : int * string vector -> unit; 
-         (1, Vector.fromList ["lib3"])
-
-type p = MLton.Pointer.t
-type 'a s = (unit -> 'a) * ('a -> unit)
-val (_, setSI) = _symbol "lib4smlSymPrivate" alloc private : p s;
-val (_, setSB) = _symbol "lib4smlSymPublic"  alloc public  : p s;
-val (_, setCI) = _symbol "lib4cSymPrivate" private : p s;
-val (_, setCB) = _symbol "lib4cSymPublic"  public  : p s;
-
-type i = (unit -> p)
-type e = i -> unit
-val () = _export "lib4smlFnPrivate" private : e;
-         (fn () => _address "lib4smlSymPrivate" private : p;)
-val () = _export "lib4smlFnPublic" public : e;
-         (fn () => _address "lib4smlSymPublic" public : p;)
-val getCI = _import "lib4cFnPrivate" private : i;
-val getCB = _import "lib4cFnPublic" public : i;
-
-(* Store our idea of what the function pointers are in symbols *)
-val () = setSI (_address "lib4smlFnPrivate" private : p;)
-val () = setSB (_address "lib4smlFnPublic"  public  : p;)
-val () = setCI (_address "lib4cFnPrivate"   private : p;)
-val () = setCB (_address "lib4cFnPublic"    public  : p;)
-
-(* Have C confirm that it sees the same function pointers we do.
- * C will check the values of the variables against it's own pointers.
- * C also checks SML functions return his idea of pointers to our exports.
- *)
-val () = _import "lib4confirmC" private : unit -> unit; ()
-
-(* Confirm that C functions return pointers to address as we expect. *)
-fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
-val () = check ("lib4cFnPrivate", getCI () = _address "lib4cSymPrivate" private : p;)
-val () = check ("lib4cFnPublic",  getCB () = _address "lib4cSymPublic"  public  : p;)
-
-(* Test symbols in lib1 *)
-val (SB, _) = _symbol "lib1smlSymPublic" external : p s;
-val (CB, _) = _symbol "lib1cSymPublic"   external : p s;
-val getSB = _import "lib1smlFnPublic" external : i;
-val getCB = _import "lib1cFnPublic"   external : i;
-
-(* Check function pointers *)
-val () = check ("lib1smlFnPublic", SB () = _address "lib1smlFnPublic" external : p;)
-val () = check ("lib1cFnPublic",   CB () = _address "lib1cFnPublic"   external : p;)
-(* Check symbol pointers *)
-val () = check ("lib1smlSymPublic", getSB () = _address "lib1smlSymPublic" external : p;)
-val () = check ("lib1cSymPublic",   getCB () = _address "lib1cSymPublic"   external : p;)
-
-(* Test symbols in lib2 *)
-val (SB, _) = _symbol "lib2smlSymPublic" external : p s;
-val (CB, _) = _symbol "lib2cSymPublic"   external : p s;
-val getSB = _import "lib2smlFnPublic" external : i;
-val getCB = _import "lib2cFnPublic"   external : i;
-
-(* Check function pointers *)
-val () = check ("lib2smlFnPublic", SB () = _address "lib2smlFnPublic" external : p;)
-val () = check ("lib2cFnPublic",   CB () = _address "lib2cFnPublic"   external : p;)
-(* Check symbol pointers *)
-val () = check ("lib2smlSymPublic", getSB () = _address "lib2smlSymPublic" external : p;)
-val () = check ("lib2cSymPublic",   getCB () = _address "lib2cSymPublic"   external : p;)
-
-(* Test symbols in lib3 *)
-val (SB, _) = _symbol "lib3smlSymPublic" public : p s;
-val (CB, _) = _symbol "lib3cSymPublic"   public : p s;
-val getSB = _import "lib3smlFnPublic" public : i;
-val getCB = _import "lib3cFnPublic"   public : i;
-
-(* Check function pointers *)
-val () = check ("lib3smlFnPublic", SB () = _address "lib3smlFnPublic" public : p;)
-val () = check ("lib3cFnPublic",   CB () = _address "lib3cFnPublic"   public : p;)
-(* Check symbol pointers *)
-val () = check ("lib3smlSymPublic", getSB () = _address "lib3smlSymPublic" public : p;)
-val () = check ("lib3cSymPublic",   getCB () = _address "lib3cSymPublic"   public : p;)
-
-val () = print "lib4 pointer test complete.\n"

Deleted: mlton/trunk/regression/library/lib5.c
===================================================================
--- mlton/trunk/regression/library/lib5.c	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib5.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,44 +0,0 @@
-#include <assert.h>
-
-#define PART_OF_LIBRARY_LIB5
-#include "lib5.h"
-#include "lib4.h"
-#include "lib3.h"
-
-extern EXTERNAL void* lib3cSymPublic;
-extern EXTERNAL void* lib3cFnPublic(void);
-extern EXTERNAL void* lib4cSymPublic;
-extern EXTERNAL void* lib4cFnPublic(void);
-
-PRIVATE void* lib5cSymPrivate = 0;
-PUBLIC  void* lib5cSymPublic  = 0;
-
-PRIVATE void* lib5cFnPrivate(void) {
-  return &lib5cSymPrivate;
-}
-
-PUBLIC void* lib5cFnPublic(void) {
-  return &lib5cSymPublic;
-}
-
-PRIVATE void lib5confirmC(void) {
-  assert (&lib5smlFnPrivate == lib5smlSymPrivate);
-  assert (&lib5smlFnPublic  == lib5smlSymPublic);
-  assert (&lib5cFnPrivate   == lib5cSymPrivate);
-  assert (&lib5cFnPublic    == lib5cSymPublic);
-  
-  assert (lib5smlFnPrivate() == &lib5smlSymPrivate);
-  assert (lib5smlFnPublic()  == &lib5smlSymPublic);
-  
-  /* Check lib3 */
-  assert (&lib3smlFnPublic  == lib3smlSymPublic);
-  assert (&lib3cFnPublic    == lib3cSymPublic);
-  assert (lib3smlFnPublic() == &lib3smlSymPublic);
-  assert (lib3cFnPublic()   == &lib3cSymPublic);
-  
-  /* Check lib4 */
-  assert (&lib4smlFnPublic  == lib4smlSymPublic);
-  assert (&lib4cFnPublic    == lib4cSymPublic);
-  assert (lib4smlFnPublic() == &lib4smlSymPublic);
-  assert (lib4cFnPublic()   == &lib4cSymPublic);
-}

Deleted: mlton/trunk/regression/library/lib5.sml
===================================================================
--- mlton/trunk/regression/library/lib5.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/lib5.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,64 +0,0 @@
-(* Prepare lib4 *)
-val () = _import "lib4_open" external : int * string vector -> unit; 
-         (1, Vector.fromList ["lib4"])
-
-type p = MLton.Pointer.t
-type 'a s = (unit -> 'a) * ('a -> unit)
-val (_, setSI) = _symbol "lib5smlSymPrivate" alloc private : p s;
-val (_, setSB) = _symbol "lib5smlSymPublic"  alloc public  : p s;
-val (_, setCI) = _symbol "lib5cSymPrivate" private : p s;
-val (_, setCB) = _symbol "lib5cSymPublic"  public  : p s;
-
-type i = (unit -> p)
-type e = i -> unit
-val () = _export "lib5smlFnPrivate" private : e;
-         (fn () => _address "lib5smlSymPrivate" private : p;)
-val () = _export "lib5smlFnPublic" public : e;
-         (fn () => _address "lib5smlSymPublic" public : p;)
-val getCI = _import "lib5cFnPrivate" private : i;
-val getCB = _import "lib5cFnPublic" public : i;
-
-(* Store our idea of what the function pointers are in symbols *)
-val () = setSI (_address "lib5smlFnPrivate" private : p;)
-val () = setSB (_address "lib5smlFnPublic"  public  : p;)
-val () = setCI (_address "lib5cFnPrivate"   private : p;)
-val () = setCB (_address "lib5cFnPublic"    public  : p;)
-
-(* Have C confirm that it sees the same function pointers we do.
- * C will check the values of the variables against it's own pointers.
- * C also checks SML functions return his idea of pointers to our exports.
- *)
-val () = _import "lib5confirmC" private : unit -> unit; ()
-
-(* Confirm that C functions return pointers to address as we expect. *)
-fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
-val () = check ("lib5cFnPrivate", getCI () = _address "lib5cSymPrivate" private : p;)
-val () = check ("lib5cFnPublic",  getCB () = _address "lib5cSymPublic"  public  : p;)
-
-(* Test symbols in lib3 *)
-val (SB, _) = _symbol "lib3smlSymPublic" external : p s;
-val (CB, _) = _symbol "lib3cSymPublic"   external : p s;
-val getSB = _import "lib3smlFnPublic" external : i;
-val getCB = _import "lib3cFnPublic"   external : i;
-
-(* Check function pointers *)
-val () = check ("lib3smlFnPublic", SB () = _address "lib3smlFnPublic" external : p;)
-val () = check ("lib3cFnPublic",   CB () = _address "lib3cFnPublic"   external : p;)
-(* Check symbol pointers *)
-val () = check ("lib3smlSymPublic", getSB () = _address "lib3smlSymPublic" external : p;)
-val () = check ("lib3cSymPublic",   getCB () = _address "lib3cSymPublic"   external : p;)
-
-(* Test symbols in lib4 *)
-val (SB, _) = _symbol "lib4smlSymPublic" external : p s;
-val (CB, _) = _symbol "lib4cSymPublic"   external : p s;
-val getSB = _import "lib4smlFnPublic" external : i;
-val getCB = _import "lib4cFnPublic"   external : i;
-
-(* Check function pointers *)
-val () = check ("lib4smlFnPublic", SB () = _address "lib4smlFnPublic" external : p;)
-val () = check ("lib4cFnPublic",   CB () = _address "lib4cFnPublic"   external : p;)
-(* Check symbol pointers *)
-val () = check ("lib4smlSymPublic", getSB () = _address "lib4smlSymPublic" external : p;)
-val () = check ("lib4cSymPublic",   getCB () = _address "lib4cSymPublic"   external : p;)
-
-val () = print "lib5 pointer test complete.\n"

Copied: mlton/trunk/regression/library/libm1.c (from rev 6874, mlton/trunk/regression/library/lib1.c)
===================================================================
--- mlton/trunk/regression/library/lib1.c	2008-09-21 12:53:12 UTC (rev 6874)
+++ mlton/trunk/regression/library/libm1.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,25 @@
+#include <assert.h>
+
+#define PART_OF_LIBRARY_M1
+#include "m1.h"
+
+PRIVATE void* libm1cSymPrivate = 0;
+PUBLIC  void* libm1cSymPublic  = 0;
+
+PRIVATE void* libm1cFnPrivate(void) {
+  return &libm1cSymPrivate;
+}
+
+PUBLIC void* libm1cFnPublic(void) {
+  return &libm1cSymPublic;
+}
+
+PRIVATE void libm1confirmC(void) {
+  assert (&libm1smlFnPrivate == libm1smlSymPrivate);
+  assert (&libm1smlFnPublic  == libm1smlSymPublic);
+  assert (&libm1cFnPrivate   == libm1cSymPrivate);
+  assert (&libm1cFnPublic    == libm1cSymPublic);
+  
+  assert (libm1smlFnPrivate() == &libm1smlSymPrivate);
+  assert (libm1smlFnPublic()  == &libm1smlSymPublic);
+}

Copied: mlton/trunk/regression/library/libm1.sml (from rev 6876, mlton/trunk/regression/library/lib1.sml)
===================================================================
--- mlton/trunk/regression/library/lib1.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/libm1.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,35 @@
+type p = MLton.Pointer.t
+
+type 'a s = (unit -> 'a) * ('a -> unit)
+val (_, setSI) = _symbol "libm1smlSymPrivate" alloc private : p s;
+val (_, setSB) = _symbol "libm1smlSymPublic"  alloc public  : p s;
+val (_, setCI) = _symbol "libm1cSymPrivate" private : p s;
+val (_, setCB) = _symbol "libm1cSymPublic"  public  : p s;
+
+type i = (unit -> p)
+type e = i -> unit
+val () = _export "libm1smlFnPrivate" private : e;
+         (fn () => _address "libm1smlSymPrivate" private : p;)
+val () = _export "libm1smlFnPublic" public : e;
+         (fn () => _address "libm1smlSymPublic" public : p;)
+val getCI = _import "libm1cFnPrivate" private : i;
+val getCB = _import "libm1cFnPublic" public : i;
+
+(* Store our idea of what the function pointers are in symbols *)
+val () = setSI (_address "libm1smlFnPrivate" private : p;)
+val () = setSB (_address "libm1smlFnPublic"  public  : p;)
+val () = setCI (_address "libm1cFnPrivate"   private : p;)
+val () = setCB (_address "libm1cFnPublic"    public  : p;)
+
+(* Have C confirm that it sees the same function pointers we do.
+ * C will check the values of the variables against it's own pointers.
+ * C also checks SML functions return his idea of pointers to our exports.
+ *)
+val () = _import "libm1confirmC" private : unit -> unit; ()
+
+(* Confirm that C functions return pointers to address as we expect. *)
+fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
+val () = check ("libm1cFnPrivate", getCI () = _address "libm1cSymPrivate" private : p;)
+val () = check ("libm1cFnPublic",  getCB () = _address "libm1cSymPublic"  public  : p;)
+
+val () = print "m1 pointer test complete.\n"

Copied: mlton/trunk/regression/library/libm2.c (from rev 6874, mlton/trunk/regression/library/lib2.c)
===================================================================
--- mlton/trunk/regression/library/lib2.c	2008-09-21 12:53:12 UTC (rev 6874)
+++ mlton/trunk/regression/library/libm2.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,35 @@
+#include <assert.h>
+
+#define PART_OF_LIBRARY_M2
+#include "m2.h"
+#include "m1.h"
+
+extern PUBLIC void* libm1cSymPublic;
+extern PUBLIC void* libm1cFnPublic(void);
+
+PRIVATE void* libm2cSymPrivate = 0;
+PUBLIC  void* libm2cSymPublic  = 0;
+
+PRIVATE void* libm2cFnPrivate(void) {
+  return &libm2cSymPrivate;
+}
+
+PUBLIC void* libm2cFnPublic(void) {
+  return &libm2cSymPublic;
+}
+
+PRIVATE void libm2confirmC(void) {
+  assert (&libm2smlFnPrivate == libm2smlSymPrivate);
+  assert (&libm2smlFnPublic  == libm2smlSymPublic);
+  assert (&libm2cFnPrivate   == libm2cSymPrivate);
+  assert (&libm2cFnPublic    == libm2cSymPublic);
+  
+  assert (libm2smlFnPrivate() == &libm2smlSymPrivate);
+  assert (libm2smlFnPublic()  == &libm2smlSymPublic);
+  
+  /* Check libm1 */
+  assert (&libm1smlFnPublic  == libm1smlSymPublic);
+  assert (&libm1cFnPublic    == libm1cSymPublic);
+  assert (libm1smlFnPublic() == &libm1smlSymPublic);
+  assert (libm1cFnPublic()   == &libm1cSymPublic);
+}

Copied: mlton/trunk/regression/library/libm2.sml (from rev 6876, mlton/trunk/regression/library/lib2.sml)
===================================================================
--- mlton/trunk/regression/library/lib2.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/libm2.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,51 @@
+(* Prepare libm1 *)
+val () = _import "m1_open" public : int * string vector -> unit; 
+         (1, Vector.fromList ["libm1"])
+
+type p = MLton.Pointer.t
+type 'a s = (unit -> 'a) * ('a -> unit)
+val (_, setSI) = _symbol "libm2smlSymPrivate" alloc private : p s;
+val (_, setSB) = _symbol "libm2smlSymPublic"  alloc public  : p s;
+val (_, setCI) = _symbol "libm2cSymPrivate" private : p s;
+val (_, setCB) = _symbol "libm2cSymPublic"  public  : p s;
+
+type i = (unit -> p)
+type e = i -> unit
+val () = _export "libm2smlFnPrivate" private : e;
+         (fn () => _address "libm2smlSymPrivate" private : p;)
+val () = _export "libm2smlFnPublic" public : e;
+         (fn () => _address "libm2smlSymPublic" public : p;)
+val getCI = _import "libm2cFnPrivate" private : i;
+val getCB = _import "libm2cFnPublic" public : i;
+
+(* Store our idea of what the function pointers are in symbols *)
+val () = setSI (_address "libm2smlFnPrivate" private : p;)
+val () = setSB (_address "libm2smlFnPublic"  public  : p;)
+val () = setCI (_address "libm2cFnPrivate"   private : p;)
+val () = setCB (_address "libm2cFnPublic"    public  : p;)
+
+(* Have C confirm that it sees the same function pointers we do.
+ * C will check the values of the variables against it's own pointers.
+ * C also checks SML functions return his idea of pointers to our exports.
+ *)
+val () = _import "libm2confirmC" private : unit -> unit; ()
+
+(* Confirm that C functions return pointers to address as we expect. *)
+fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
+val () = check ("libm2cFnPrivate", getCI () = _address "libm2cSymPrivate" private : p;)
+val () = check ("libm2cFnPublic",  getCB () = _address "libm2cSymPublic"  public  : p;)
+
+(* Test symbols in libm1 *)
+val (SB, _) = _symbol "libm1smlSymPublic" public : p s;
+val (CB, _) = _symbol "libm1cSymPublic"   public : p s;
+val getSB = _import "libm1smlFnPublic" public : i;
+val getCB = _import "libm1cFnPublic"   public : i;
+
+(* Check function pointers *)
+val () = check ("libm1smlFnPublic", SB () = _address "libm1smlFnPublic" public : p;)
+val () = check ("libm1cFnPublic",   CB () = _address "libm1cFnPublic"   public : p;)
+(* Check symbol pointers *)
+val () = check ("libm1smlSymPublic", getSB () = _address "libm1smlSymPublic" public : p;)
+val () = check ("libm1cSymPublic",   getCB () = _address "libm1cSymPublic"   public : p;)
+
+val () = print "m2 pointer test complete.\n"

Copied: mlton/trunk/regression/library/libm3.c (from rev 6874, mlton/trunk/regression/library/lib3.c)
===================================================================
--- mlton/trunk/regression/library/lib3.c	2008-09-21 12:53:12 UTC (rev 6874)
+++ mlton/trunk/regression/library/libm3.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,44 @@
+#include <assert.h>
+
+#define PART_OF_LIBRARY_M3
+#include "m3.h"
+#include "m2.h"
+#include "m1.h"
+
+extern EXTERNAL void* libm1cSymPublic;
+extern EXTERNAL void* libm1cFnPublic(void);
+extern EXTERNAL void* libm2cSymPublic;
+extern EXTERNAL void* libm2cFnPublic(void);
+
+PRIVATE void* libm3cSymPrivate = 0;
+PUBLIC  void* libm3cSymPublic  = 0;
+
+PRIVATE void* libm3cFnPrivate(void) {
+  return &libm3cSymPrivate;
+}
+
+PUBLIC void* libm3cFnPublic(void) {
+  return &libm3cSymPublic;
+}
+
+PRIVATE void libm3confirmC(void) {
+  assert (&libm3smlFnPrivate == libm3smlSymPrivate);
+  assert (&libm3smlFnPublic  == libm3smlSymPublic);
+  assert (&libm3cFnPrivate   == libm3cSymPrivate);
+  assert (&libm3cFnPublic    == libm3cSymPublic);
+  
+  assert (libm3smlFnPrivate() == &libm3smlSymPrivate);
+  assert (libm3smlFnPublic()  == &libm3smlSymPublic);
+  
+  /* Check libm1 */
+  assert (&libm1smlFnPublic  == libm1smlSymPublic);
+  assert (&libm1cFnPublic    == libm1cSymPublic);
+  assert (libm1smlFnPublic() == &libm1smlSymPublic);
+  assert (libm1cFnPublic()   == &libm1cSymPublic);
+  
+  /* Check libm2 */
+  assert (&libm2smlFnPublic  == libm2smlSymPublic);
+  assert (&libm2cFnPublic    == libm2cSymPublic);
+  assert (libm2smlFnPublic() == &libm2smlSymPublic);
+  assert (libm2cFnPublic()   == &libm2cSymPublic);
+}

Copied: mlton/trunk/regression/library/libm3.sml (from rev 6876, mlton/trunk/regression/library/lib3.sml)
===================================================================
--- mlton/trunk/regression/library/lib3.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/libm3.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,64 @@
+(* Prepare libm2 *)
+val () = _import "m2_open" external : int * string vector -> unit; 
+         (1, Vector.fromList ["libm2"])
+
+type p = MLton.Pointer.t
+type 'a s = (unit -> 'a) * ('a -> unit)
+val (_, setSI) = _symbol "libm3smlSymPrivate" alloc private : p s;
+val (_, setSB) = _symbol "libm3smlSymPublic"  alloc public  : p s;
+val (_, setCI) = _symbol "libm3cSymPrivate" private : p s;
+val (_, setCB) = _symbol "libm3cSymPublic"  public  : p s;
+
+type i = (unit -> p)
+type e = i -> unit
+val () = _export "libm3smlFnPrivate" private : e;
+         (fn () => _address "libm3smlSymPrivate" private : p;)
+val () = _export "libm3smlFnPublic" public : e;
+         (fn () => _address "libm3smlSymPublic" public : p;)
+val getCI = _import "libm3cFnPrivate" private : i;
+val getCB = _import "libm3cFnPublic" public : i;
+
+(* Store our idea of what the function pointers are in symbols *)
+val () = setSI (_address "libm3smlFnPrivate" private : p;)
+val () = setSB (_address "libm3smlFnPublic"  public  : p;)
+val () = setCI (_address "libm3cFnPrivate"   private : p;)
+val () = setCB (_address "libm3cFnPublic"    public  : p;)
+
+(* Have C confirm that it sees the same function pointers we do.
+ * C will check the values of the variables against it's own pointers.
+ * C also checks SML functions return his idea of pointers to our exports.
+ *)
+val () = _import "libm3confirmC" private : unit -> unit; ()
+
+(* Confirm that C functions return pointers to address as we expect. *)
+fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
+val () = check ("libm3cFnPrivate", getCI () = _address "libm3cSymPrivate" private : p;)
+val () = check ("libm3cFnPublic",  getCB () = _address "libm3cSymPublic"  public  : p;)
+
+(* Test symbols in libm1 *)
+val (SB, _) = _symbol "libm1smlSymPublic" external : p s;
+val (CB, _) = _symbol "libm1cSymPublic"   external : p s;
+val getSB = _import "libm1smlFnPublic" external : i;
+val getCB = _import "libm1cFnPublic"   external : i;
+
+(* Check function pointers *)
+val () = check ("libm1smlFnPublic", SB () = _address "libm1smlFnPublic" external : p;)
+val () = check ("libm1cFnPublic",   CB () = _address "libm1cFnPublic"   external : p;)
+(* Check symbol pointers *)
+val () = check ("libm1smlSymPublic", getSB () = _address "libm1smlSymPublic" external : p;)
+val () = check ("libm1cSymPublic",   getCB () = _address "libm1cSymPublic"   external : p;)
+
+(* Test symbols in libm2 *)
+val (SB, _) = _symbol "libm2smlSymPublic" external : p s;
+val (CB, _) = _symbol "libm2cSymPublic"   external : p s;
+val getSB = _import "libm2smlFnPublic" external : i;
+val getCB = _import "libm2cFnPublic"   external : i;
+
+(* Check function pointers *)
+val () = check ("libm2smlFnPublic", SB () = _address "libm2smlFnPublic" external : p;)
+val () = check ("libm2cFnPublic",   CB () = _address "libm2cFnPublic"   external : p;)
+(* Check symbol pointers *)
+val () = check ("libm2smlSymPublic", getSB () = _address "libm2smlSymPublic" external : p;)
+val () = check ("libm2cSymPublic",   getCB () = _address "libm2cSymPublic"   external : p;)
+
+val () = print "m3 pointer test complete.\n"

Copied: mlton/trunk/regression/library/libm4.c (from rev 6874, mlton/trunk/regression/library/lib4.c)
===================================================================
--- mlton/trunk/regression/library/lib4.c	2008-09-21 12:53:12 UTC (rev 6874)
+++ mlton/trunk/regression/library/libm4.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,54 @@
+#include <assert.h>
+
+#define PART_OF_LIBRARY_M4
+#include "m4.h"
+#include "m3.h"
+#include "m2.h"
+#include "m1.h"
+
+extern EXTERNAL void* libm1cSymPublic;
+extern EXTERNAL void* libm1cFnPublic(void);
+extern EXTERNAL void* libm2cSymPublic;
+extern EXTERNAL void* libm2cFnPublic(void);
+
+extern PUBLIC void* libm3cSymPublic;
+extern PUBLIC void* libm3cFnPublic(void);
+
+PRIVATE void* libm4cSymPrivate = 0;
+PUBLIC  void* libm4cSymPublic  = 0;
+
+PRIVATE void* libm4cFnPrivate(void) {
+  return &libm4cSymPrivate;
+}
+
+PUBLIC void* libm4cFnPublic(void) {
+  return &libm4cSymPublic;
+}
+
+PRIVATE void libm4confirmC(void) {
+  assert (&libm4smlFnPrivate == libm4smlSymPrivate);
+  assert (&libm4smlFnPublic  == libm4smlSymPublic);
+  assert (&libm4cFnPrivate   == libm4cSymPrivate);
+  assert (&libm4cFnPublic    == libm4cSymPublic);
+  
+  assert (libm4smlFnPrivate() == &libm4smlSymPrivate);
+  assert (libm4smlFnPublic()  == &libm4smlSymPublic);
+  
+  /* Check libm1 */
+  assert (&libm1smlFnPublic  == libm1smlSymPublic);
+  assert (&libm1cFnPublic    == libm1cSymPublic);
+  assert (libm1smlFnPublic() == &libm1smlSymPublic);
+  assert (libm1cFnPublic()   == &libm1cSymPublic);
+  
+  /* Check libm2 */
+  assert (&libm2smlFnPublic  == libm2smlSymPublic);
+  assert (&libm2cFnPublic    == libm2cSymPublic);
+  assert (libm2smlFnPublic() == &libm2smlSymPublic);
+  assert (libm2cFnPublic()   == &libm2cSymPublic);
+  
+  /* Check libm3 */
+  assert (&libm3smlFnPublic  == libm3smlSymPublic);
+  assert (&libm3cFnPublic    == libm3cSymPublic);
+  assert (libm3smlFnPublic() == &libm3smlSymPublic);
+  assert (libm3cFnPublic()   == &libm3cSymPublic);
+}

Copied: mlton/trunk/regression/library/libm4.sml (from rev 6876, mlton/trunk/regression/library/lib4.sml)
===================================================================
--- mlton/trunk/regression/library/lib4.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/libm4.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,77 @@
+(* Prepare libm3 *)
+val () = _import "m3_open" public : int * string vector -> unit; 
+         (1, Vector.fromList ["libm3"])
+
+type p = MLton.Pointer.t
+type 'a s = (unit -> 'a) * ('a -> unit)
+val (_, setSI) = _symbol "libm4smlSymPrivate" alloc private : p s;
+val (_, setSB) = _symbol "libm4smlSymPublic"  alloc public  : p s;
+val (_, setCI) = _symbol "libm4cSymPrivate" private : p s;
+val (_, setCB) = _symbol "libm4cSymPublic"  public  : p s;
+
+type i = (unit -> p)
+type e = i -> unit
+val () = _export "libm4smlFnPrivate" private : e;
+         (fn () => _address "libm4smlSymPrivate" private : p;)
+val () = _export "libm4smlFnPublic" public : e;
+         (fn () => _address "libm4smlSymPublic" public : p;)
+val getCI = _import "libm4cFnPrivate" private : i;
+val getCB = _import "libm4cFnPublic" public : i;
+
+(* Store our idea of what the function pointers are in symbols *)
+val () = setSI (_address "libm4smlFnPrivate" private : p;)
+val () = setSB (_address "libm4smlFnPublic"  public  : p;)
+val () = setCI (_address "libm4cFnPrivate"   private : p;)
+val () = setCB (_address "libm4cFnPublic"    public  : p;)
+
+(* Have C confirm that it sees the same function pointers we do.
+ * C will check the values of the variables against it's own pointers.
+ * C also checks SML functions return his idea of pointers to our exports.
+ *)
+val () = _import "libm4confirmC" private : unit -> unit; ()
+
+(* Confirm that C functions return pointers to address as we expect. *)
+fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
+val () = check ("libm4cFnPrivate", getCI () = _address "libm4cSymPrivate" private : p;)
+val () = check ("libm4cFnPublic",  getCB () = _address "libm4cSymPublic"  public  : p;)
+
+(* Test symbols in libm1 *)
+val (SB, _) = _symbol "libm1smlSymPublic" external : p s;
+val (CB, _) = _symbol "libm1cSymPublic"   external : p s;
+val getSB = _import "libm1smlFnPublic" external : i;
+val getCB = _import "libm1cFnPublic"   external : i;
+
+(* Check function pointers *)
+val () = check ("libm1smlFnPublic", SB () = _address "libm1smlFnPublic" external : p;)
+val () = check ("libm1cFnPublic",   CB () = _address "libm1cFnPublic"   external : p;)
+(* Check symbol pointers *)
+val () = check ("libm1smlSymPublic", getSB () = _address "libm1smlSymPublic" external : p;)
+val () = check ("libm1cSymPublic",   getCB () = _address "libm1cSymPublic"   external : p;)
+
+(* Test symbols in libm2 *)
+val (SB, _) = _symbol "libm2smlSymPublic" external : p s;
+val (CB, _) = _symbol "libm2cSymPublic"   external : p s;
+val getSB = _import "libm2smlFnPublic" external : i;
+val getCB = _import "libm2cFnPublic"   external : i;
+
+(* Check function pointers *)
+val () = check ("libm2smlFnPublic", SB () = _address "libm2smlFnPublic" external : p;)
+val () = check ("libm2cFnPublic",   CB () = _address "libm2cFnPublic"   external : p;)
+(* Check symbol pointers *)
+val () = check ("libm2smlSymPublic", getSB () = _address "libm2smlSymPublic" external : p;)
+val () = check ("libm2cSymPublic",   getCB () = _address "libm2cSymPublic"   external : p;)
+
+(* Test symbols in libm3 *)
+val (SB, _) = _symbol "libm3smlSymPublic" public : p s;
+val (CB, _) = _symbol "libm3cSymPublic"   public : p s;
+val getSB = _import "libm3smlFnPublic" public : i;
+val getCB = _import "libm3cFnPublic"   public : i;
+
+(* Check function pointers *)
+val () = check ("libm3smlFnPublic", SB () = _address "libm3smlFnPublic" public : p;)
+val () = check ("libm3cFnPublic",   CB () = _address "libm3cFnPublic"   public : p;)
+(* Check symbol pointers *)
+val () = check ("libm3smlSymPublic", getSB () = _address "libm3smlSymPublic" public : p;)
+val () = check ("libm3cSymPublic",   getCB () = _address "libm3cSymPublic"   public : p;)
+
+val () = print "m4 pointer test complete.\n"

Copied: mlton/trunk/regression/library/libm5.c (from rev 6874, mlton/trunk/regression/library/lib5.c)
===================================================================
--- mlton/trunk/regression/library/lib5.c	2008-09-21 12:53:12 UTC (rev 6874)
+++ mlton/trunk/regression/library/libm5.c	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,44 @@
+#include <assert.h>
+
+#define PART_OF_LIBRARY_M5
+#include "m5.h"
+#include "m4.h"
+#include "m3.h"
+
+extern EXTERNAL void* libm3cSymPublic;
+extern EXTERNAL void* libm3cFnPublic(void);
+extern EXTERNAL void* libm4cSymPublic;
+extern EXTERNAL void* libm4cFnPublic(void);
+
+PRIVATE void* libm5cSymPrivate = 0;
+PUBLIC  void* libm5cSymPublic  = 0;
+
+PRIVATE void* libm5cFnPrivate(void) {
+  return &libm5cSymPrivate;
+}
+
+PUBLIC void* libm5cFnPublic(void) {
+  return &libm5cSymPublic;
+}
+
+PRIVATE void libm5confirmC(void) {
+  assert (&libm5smlFnPrivate == libm5smlSymPrivate);
+  assert (&libm5smlFnPublic  == libm5smlSymPublic);
+  assert (&libm5cFnPrivate   == libm5cSymPrivate);
+  assert (&libm5cFnPublic    == libm5cSymPublic);
+  
+  assert (libm5smlFnPrivate() == &libm5smlSymPrivate);
+  assert (libm5smlFnPublic()  == &libm5smlSymPublic);
+  
+  /* Check libm3 */
+  assert (&libm3smlFnPublic  == libm3smlSymPublic);
+  assert (&libm3cFnPublic    == libm3cSymPublic);
+  assert (libm3smlFnPublic() == &libm3smlSymPublic);
+  assert (libm3cFnPublic()   == &libm3cSymPublic);
+  
+  /* Check libm4 */
+  assert (&libm4smlFnPublic  == libm4smlSymPublic);
+  assert (&libm4cFnPublic    == libm4cSymPublic);
+  assert (libm4smlFnPublic() == &libm4smlSymPublic);
+  assert (libm4cFnPublic()   == &libm4cSymPublic);
+}

Copied: mlton/trunk/regression/library/libm5.sml (from rev 6876, mlton/trunk/regression/library/lib5.sml)
===================================================================
--- mlton/trunk/regression/library/lib5.sml	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/libm5.sml	2008-09-22 10:06:32 UTC (rev 6877)
@@ -0,0 +1,64 @@
+(* Prepare libm4 *)
+val () = _import "m4_open" external : int * string vector -> unit; 
+         (1, Vector.fromList ["libm4"])
+
+type p = MLton.Pointer.t
+type 'a s = (unit -> 'a) * ('a -> unit)
+val (_, setSI) = _symbol "libm5smlSymPrivate" alloc private : p s;
+val (_, setSB) = _symbol "libm5smlSymPublic"  alloc public  : p s;
+val (_, setCI) = _symbol "libm5cSymPrivate" private : p s;
+val (_, setCB) = _symbol "libm5cSymPublic"  public  : p s;
+
+type i = (unit -> p)
+type e = i -> unit
+val () = _export "libm5smlFnPrivate" private : e;
+         (fn () => _address "libm5smlSymPrivate" private : p;)
+val () = _export "libm5smlFnPublic" public : e;
+         (fn () => _address "libm5smlSymPublic" public : p;)
+val getCI = _import "libm5cFnPrivate" private : i;
+val getCB = _import "libm5cFnPublic" public : i;
+
+(* Store our idea of what the function pointers are in symbols *)
+val () = setSI (_address "libm5smlFnPrivate" private : p;)
+val () = setSB (_address "libm5smlFnPublic"  public  : p;)
+val () = setCI (_address "libm5cFnPrivate"   private : p;)
+val () = setCB (_address "libm5cFnPublic"    public  : p;)
+
+(* Have C confirm that it sees the same function pointers we do.
+ * C will check the values of the variables against it's own pointers.
+ * C also checks SML functions return his idea of pointers to our exports.
+ *)
+val () = _import "libm5confirmC" private : unit -> unit; ()
+
+(* Confirm that C functions return pointers to address as we expect. *)
+fun check (s, b) = if b then () else print (s ^ " pointers don't match!\n")
+val () = check ("libm5cFnPrivate", getCI () = _address "libm5cSymPrivate" private : p;)
+val () = check ("libm5cFnPublic",  getCB () = _address "libm5cSymPublic"  public  : p;)
+
+(* Test symbols in libm3 *)
+val (SB, _) = _symbol "libm3smlSymPublic" external : p s;
+val (CB, _) = _symbol "libm3cSymPublic"   external : p s;
+val getSB = _import "libm3smlFnPublic" external : i;
+val getCB = _import "libm3cFnPublic"   external : i;
+
+(* Check function pointers *)
+val () = check ("libm3smlFnPublic", SB () = _address "libm3smlFnPublic" external : p;)
+val () = check ("libm3cFnPublic",   CB () = _address "libm3cFnPublic"   external : p;)
+(* Check symbol pointers *)
+val () = check ("libm3smlSymPublic", getSB () = _address "libm3smlSymPublic" external : p;)
+val () = check ("libm3cSymPublic",   getCB () = _address "libm3cSymPublic"   external : p;)
+
+(* Test symbols in libm4 *)
+val (SB, _) = _symbol "libm4smlSymPublic" external : p s;
+val (CB, _) = _symbol "libm4cSymPublic"   external : p s;
+val getSB = _import "libm4smlFnPublic" external : i;
+val getCB = _import "libm4cFnPublic"   external : i;
+
+(* Check function pointers *)
+val () = check ("libm4smlFnPublic", SB () = _address "libm4smlFnPublic" external : p;)
+val () = check ("libm4cFnPublic",   CB () = _address "libm4cFnPublic"   external : p;)
+(* Check symbol pointers *)
+val () = check ("libm4smlSymPublic", getSB () = _address "libm4smlSymPublic" external : p;)
+val () = check ("libm4cSymPublic",   getCB () = _address "libm4cSymPublic"   external : p;)
+
+val () = print "m5 pointer test complete.\n"

Modified: mlton/trunk/regression/library/library-test
===================================================================
--- mlton/trunk/regression/library/library-test	2008-09-22 09:56:33 UTC (rev 6876)
+++ mlton/trunk/regression/library/library-test	2008-09-22 10:06:32 UTC (rev 6877)
@@ -1,15 +1,15 @@
 #! /usr/bin/env bash
 
-ML=../../build/bin/mlton
+ML=mlton #../../build/bin/mlton
 
 O[0]='-default-ann'
 O[1]='allowFFI true'
 O[2]='-link-opt'
 O[3]='-L.'
-O[4]='-target'
-O[5]='x86_64'
-O[6]='-debug'
-O[7]='true'
+O[4]='-debug'
+O[5]='true'
+#O[6]='-target'
+#O[7]='x86'
 
 LIB="-link-opt -l"
 
@@ -19,16 +19,16 @@
 set -ex
 
 # Compile DSO #1
-$ML "${O[@]}" -format libarchive -export-header lib1.h lib1.sml lib1.c
-$ML "${O[@]}" ${LIB}1 -format library -export-header lib2.h lib2.sml lib2.c
+$ML "${O[@]}" -format libarchive -export-header m1.h libm1.sml libm1.c
+$ML "${O[@]}" ${LIB}m1 -format library -export-header m2.h libm2.sml libm2.c
 
 # Compile DSO #2
-$ML "${O[@]}" -format libarchive -export-header lib3.h lib3.sml lib3.c
-$ML "${O[@]}" ${LIB}2 ${LIB}3 -format library -export-header lib4.h lib4.sml lib4.c
+$ML "${O[@]}" -format libarchive -export-header m3.h libm3.sml libm3.c
+$ML "${O[@]}" ${LIB}m2 ${LIB}m3 -format library -export-header m4.h libm4.sml libm4.c
 
 # Compile executable
-$ML "${O[@]}" -format archive -export-header lib5.h lib5.sml lib5.c
-$ML "${O[@]}" ${LIB}4 ${LIB}5 -format executable -export-header check.h check.sml check.c
+$ML "${O[@]}" -format archive -export-header m5.h libm5.sml libm5.c
+$ML "${O[@]}" ${LIB}m4 ${LIB}m5 -format executable -export-header check.h check.sml check.c
 
 # Check that symbols resolved correctly
 ./check




More information about the MLton-commit mailing list