mmalloc/mvalloc.c
mmalloc/sbrk-sup.c
mmalloc/TODO
+ocaml_version.ml
README.txt
test_ancient_dict_read.ml
test_ancient_dict_verify.ml
# Mark objects as 'ancient' so they are taken out of the OCaml heap.
-# $Id: Makefile,v 1.8 2006-10-06 15:03:47 rich Exp $
+# $Id: Makefile,v 1.9 2006-10-31 14:39:50 rich Exp $
include Makefile.config
CC := gcc
-CFLAGS := -g -fPIC -Wall -Werror
+CFLAGS := -g -fPIC -Wall -Werror \
+ -DOCAML_VERSION_MAJOR=$(OCAML_VERSION_MAJOR) \
+ -DOCAML_VERSION_MINOR=$(OCAML_VERSION_MINOR)
OCAMLCFLAGS := -g
OCAMLCPACKAGES := -package unix
# Mark objects as 'ancient' so they are taken out of the OCaml heap.
-# $Id: Makefile.config,v 1.7 2006-10-13 15:12:41 rich Exp $
+# $Id: Makefile.config,v 1.8 2006-10-31 14:39:50 rich Exp $
PACKAGE := ancient
VERSION := 0.8.0
+
+OCAML_VERSION_MAJOR := $(shell ocaml ocaml_version.ml major)
+OCAML_VERSION_MINOR := $(shell ocaml ocaml_version.ml minor)
/* Mark objects as 'ancient' so they are taken out of the OCaml heap.
- * $Id: ancient_c.c,v 1.10 2006-10-13 12:28:20 rich Exp $
+ * $Id: ancient_c.c,v 1.11 2006-10-31 14:39:50 rich Exp $
*/
#include <string.h>
#include "mmalloc/mmalloc.h"
+// uintnat, intnat only appeared in Caml 3.09.x.
+#if OCAML_VERSION_MAJOR == 3 && OCAML_VERSION_MINOR < 9
+typedef unsigned long uintnat;
+typedef long intnat;
+#endif
+
// From byterun/misc.h:
typedef char * addr;
-// From byterun/minor_gc.c:
+// From byterun/minor_gc.h:
CAMLextern char *caml_young_start;
CAMLextern char *caml_young_end;
#define Is_young(val) \
--- /dev/null
+(* Get the major or minor part of the OCaml version string.
+ * This doesn't seem t be present in header files (at least not in 3.08.x).
+ * $Id: ocaml_version.ml,v 1.1 2006-10-31 14:39:50 rich Exp $
+ *)
+type t = Major | Minor
+let usage () = failwith "ocaml_version major|minor"
+let t =
+ if Array.length Sys.argv < 2 then
+ usage ()
+ else match Sys.argv.(1) with
+ | "major" -> Major
+ | "minor" -> Minor
+ | _ -> usage ()
+let ocaml_version = Sys.ocaml_version
+let i = String.index ocaml_version '.'
+let s =
+ match t with
+ | Major -> String.sub ocaml_version 0 i
+ | Minor ->
+ let j =
+ try String.index_from ocaml_version (i+1) '.'
+ with Not_found -> String.length ocaml_version in
+ String.sub ocaml_version (i+1) (j-i-1)
+let s = string_of_int (int_of_string s) ;;
+print_endline s