diff options
author | No author <no_author@ocaml.org> | 1995-06-15 16:08:54 +0000 |
---|---|---|
committer | No author <no_author@ocaml.org> | 1995-06-15 16:08:54 +0000 |
commit | 77b1c8b89fd8940a63b17c41eb37161e5d159831 (patch) | |
tree | 43dbfb3982d9166b717199cb8faa97bdce30add7 /byterun/array.c | |
parent | ba79d4bd1f01a70b892c69f6a5e6e86714a023d6 (diff) | |
download | ocaml-unlabeled-1.2.2.tar.gz |
This commit was manufactured by cvs2svn to create branchunlabeled-1.2.2
'unlabeled-1.2.2'.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/unlabeled-1.2.2@37 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/array.c')
-rw-r--r-- | byterun/array.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/byterun/array.c b/byterun/array.c deleted file mode 100644 index 304cc545e6..0000000000 --- a/byterun/array.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Operations on arrays */ - -#include "alloc.h" -#include "fail.h" -#include "memory.h" -#include "misc.h" -#include "mlvalues.h" - -value array_get(array, index) /* ML */ - value array, index; -{ - long idx = Long_val(index); - if (idx < 0 || idx >= Wosize_val(array)) invalid_argument("Array.get"); - return Field(array, idx); -} - -value array_set(array, index, newval) /* ML */ - value array, index, newval; -{ - long idx = Long_val(index); - if (idx < 0 || idx >= Wosize_val(array)) invalid_argument("Array.set"); - Modify(&Field(array, idx), newval); - return Val_unit; -} - -value make_vect(len, init) /* ML */ - value len, init; -{ - value res; - mlsize_t size, i; - Push_roots(root, 1); - - size = Long_val(len); - if (size > Max_wosize) { - Pop_roots(); - invalid_argument("Array.new"); - } - if (size == 0) { - res = Atom(0); - } - else if (size < Max_young_wosize) { - root[0] = init; - res = alloc(size, 0); - init = root[0]; - for (i = 0; i < size; i++) Field(res, i) = init; - } - else if (Is_block(init) && Is_young(init)) { - root[0] = init; - minor_collection(); - res = alloc_shr(size, 0); - init = root[0]; - for (i = 0; i < size; i++) Field(res, i) = init; - } - else { - root[0] = init; - res = alloc_shr(size, 0); - init = root[0]; - for (i = 0; i < size; i++) initialize(&Field(res, i), init); - } - Pop_roots(); - return res; -} |