[MLton-commit] r4112

Stephen Weeks MLton@mlton.org
Mon, 17 Oct 2005 22:44:49 -0700


Applied patch from John Reppy for Mac OS.

Caught up with changes to MLB annotations and _export.


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

U   mlton/trunk/lib/opengl/GLUT.sml
U   mlton/trunk/lib/opengl/GLUT_c.c
U   mlton/trunk/lib/opengl/GLU_c.c
U   mlton/trunk/lib/opengl/GL_c.c
U   mlton/trunk/lib/opengl/Makefile
A   mlton/trunk/lib/opengl/platform.h

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

Modified: mlton/trunk/lib/opengl/GLUT.sml
===================================================================
--- mlton/trunk/lib/opengl/GLUT.sml	2005-10-17 00:44:33 UTC (rev 4111)
+++ mlton/trunk/lib/opengl/GLUT.sml	2005-10-18 05:44:47 UTC (rev 4112)
@@ -243,35 +243,35 @@
 
 
             (* Create Menu callback *)
-            val gCreateMenuFA = _export "glutCreateMenuArgument": int -> unit;
+            val gCreateMenuFA = _export "glutCreateMenuArgument": (int -> unit) -> unit;
             val callGCreateMenuF = _import "callGlutCreateMenu": unit -> int;
 
             (* Display function callback *)
-            val gDisplayFA = _export "glutDisplayFuncArgument": unit -> unit;
+            val gDisplayFA = _export "glutDisplayFuncArgument": (unit -> unit) -> unit;
             val callGDisplayF = _import "callGlutDisplayFunc": unit -> unit;
 
             (* Idle function callback *)
-            val gIdleFA = _export "glutIdleFuncArgument": unit -> unit;
+            val gIdleFA = _export "glutIdleFuncArgument": (unit -> unit) -> unit;
             val callGIdleF = _import "callGlutIdleFunc": unit -> unit;
 
             (* Reshape function callback *)
-            val gReshapeFA = _export "glutReshapeFuncArgument": int * int -> unit;
+            val gReshapeFA = _export "glutReshapeFuncArgument": (int * int -> unit) -> unit;
             val callGReshapeF = _import "callGlutReshapeFunc": unit -> unit;
 
             (* Keyboard function callback *)
-            val gKbdFA = _export "glutKeyboardFuncArgument": char * int * int -> unit;
+            val gKbdFA = _export "glutKeyboardFuncArgument": (char * int * int -> unit) -> unit;
             val callGKbdF = _import "callGlutKeyboardFunc": unit -> unit;
 
             (* Mouse function callback *)
-            val gMouseFA = _export "glutMouseFuncArgument": GLenum * GLenum * int * int -> unit;
+            val gMouseFA = _export "glutMouseFuncArgument": (GLenum * GLenum * int * int -> unit) -> unit;
             val callGMouseF = _import "callGlutMouseFunc": unit -> unit;
 
             (* Special function callback *)
-            val gSpecFA = _export "glutSpecialFuncArgument": int * int * int -> unit;
+            val gSpecFA = _export "glutSpecialFuncArgument": (int * int * int -> unit) -> unit;
             val callGSpecF = _import "callGlutSpecialFunc": unit -> unit;
 
             (* Visibility function callback *)
-            val gVisibilityFA = _export "glutVisibilityFuncArgument": Word32.word -> unit;
+            val gVisibilityFA = _export "glutVisibilityFuncArgument": (Word32.word -> unit) -> unit;
             val callGVisibilityF = _import "callGlutVisibilityFunc": unit -> unit;
 
 

Modified: mlton/trunk/lib/opengl/GLUT_c.c
===================================================================
--- mlton/trunk/lib/opengl/GLUT_c.c	2005-10-17 00:44:33 UTC (rev 4111)
+++ mlton/trunk/lib/opengl/GLUT_c.c	2005-10-18 05:44:47 UTC (rev 4112)
@@ -1,6 +1,5 @@
 /* Glut-export.c */
-#include <GL/gl.h>
-#include <GL/glut.h>
+#include "platform.h"
 #include "GLUT_h.h"
 
 int callGlutCreateMenu ()

Modified: mlton/trunk/lib/opengl/GLU_c.c
===================================================================
--- mlton/trunk/lib/opengl/GLU_c.c	2005-10-17 00:44:33 UTC (rev 4111)
+++ mlton/trunk/lib/opengl/GLU_c.c	2005-10-18 05:44:47 UTC (rev 4112)
@@ -1,5 +1,5 @@
 /* GLU-export.c */
-#include <GL/glu.h>
+#include "platform.h"
 #include "GLU_h.h"
 
 

Modified: mlton/trunk/lib/opengl/GL_c.c
===================================================================
--- mlton/trunk/lib/opengl/GL_c.c	2005-10-17 00:44:33 UTC (rev 4111)
+++ mlton/trunk/lib/opengl/GL_c.c	2005-10-18 05:44:47 UTC (rev 4112)
@@ -1,5 +1,5 @@
 /* Gl-export.c */
-#include <GL/gl.h>
+#include "platform.h"
 #include "GL_h.h"
 
 

Modified: mlton/trunk/lib/opengl/Makefile
===================================================================
--- mlton/trunk/lib/opengl/Makefile	2005-10-17 00:44:33 UTC (rev 4111)
+++ mlton/trunk/lib/opengl/Makefile	2005-10-18 05:44:47 UTC (rev 4112)
@@ -1,8 +1,8 @@
 mlton = mlton
 MLTON_FLAGS = \
-	-default-ann 'allowExport true' \
-	-default-ann 'allowImport true' \
+	-default-ann 'allowFFI true' \
 	-target-link-opt cygwin '-L/lib/w32api -lglut32 -lglu32 -lopengl32' \
+        -target-link-opt darwin '-framework GLUT -framework OpenGL -framework Foundation' \
 	-target-link-opt linux '-lglut -lGLU -lGL'
 
 GL_OBJS  = GL_c.o GLUT_c.o

Added: mlton/trunk/lib/opengl/platform.h
===================================================================
--- mlton/trunk/lib/opengl/platform.h	2005-10-17 00:44:33 UTC (rev 4111)
+++ mlton/trunk/lib/opengl/platform.h	2005-10-18 05:44:47 UTC (rev 4112)
@@ -0,0 +1,9 @@
+#if defined(__APPLE__) && defined(__MACH__)
+#include <GLUT/glut.h>
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <GL/glut.h>
+#endif