History

Use 4.14 alpha1 and fix the fallout

malc committed 4 years ago

Commit 21ca13a1 parent 59c9db73 files · +32 −33Browse files

Unified · Split

3 files
  1. build.bash +2 −2
  2. lablGL/ml_gl.c +6 −6
  3. lablGL/ml_raw.c +24 −25
build.bash+2−2
@@ -104,8 +104,8 @@ mflags() { · 103 unmodified lines
104}104}
105 105
106overs=$(ocamlc -vnum 2>/dev/null) || overs=""106overs=$(ocamlc -vnum 2>/dev/null) || overs=""
107if test "$overs" != "4.13.1"; then107if test "$overs" != "4.14.0~alpha1"; then
108 url=https://caml.inria.fr/pub/distrib/ocaml-4.13/ocaml-4.13.1.tar.xz108 url=https://caml.inria.fr/pub/distrib/ocaml-4.14/ocaml-4.14.0~alpha1.tar.xz
109 txz=$outd/$(basename $url)109 txz=$outd/$(basename $url)
110 keycmd="printf $url; digest $txz;"110 keycmd="printf $url; digest $txz;"
111 isfresh $txz "$(eval $keycmd)" || {111 isfresh $txz "$(eval $keycmd)" || {
lablGL/ml_gl.c+6−6
@@ -32,17 +32,17 @@ void ml_raise_gl(const char *errmsg) · 31 unmodified lines
32 static value const * gl_exn;32 static value const * gl_exn;
33 if (gl_exn == NULL)33 if (gl_exn == NULL)
34 gl_exn = caml_named_value("glerror");34 gl_exn = caml_named_value("glerror");
35 raise_with_string(*gl_exn, (char*)errmsg);35 caml_raise_with_string(*gl_exn, (char*)errmsg);
36}36}
37 37
38value copy_string_check (const char *str)38value copy_string_check (const char *str)
39{39{
40 if (!str) ml_raise_gl("Null string");40 if (!str) ml_raise_gl("Null string");
41 return copy_string ((char*) str);41 return caml_copy_string ((char*) str);
42}42}
43 43
44struct record {44struct record {
45 value key; 45 value key;
46 GLenum data;46 GLenum data;
47};47};
48 48
@@ -59,7 +59,7 @@ CAMLprim value ml_gl_make_table (value unit) · 10 unmodified lines
59 int i;59 int i;
60 unsigned int hash;60 unsigned int hash;
61 61
62 tag_table = stat_alloc (TABLE_SIZE * sizeof(struct record));62 tag_table = caml_stat_alloc (TABLE_SIZE * sizeof(struct record));
63 memset ((char *) tag_table, 0, TABLE_SIZE * sizeof(struct record));63 memset ((char *) tag_table, 0, TABLE_SIZE * sizeof(struct record));
64 for (i = 0; i < TAG_NUMBER; i++) {64 for (i = 0; i < TAG_NUMBER; i++) {
65 hash = (unsigned long) input_table[i].key % TABLE_SIZE;65 hash = (unsigned long) input_table[i].key % TABLE_SIZE;
@@ -266,7 +266,7 @@ CAMLprim value ml_glLight (value n, value param) /* ML */ · 200 unmodified lines
266 float params[4];266 float params[4];
267 int i;267 int i;
268 268
269 if (Int_val(n) >= GL_MAX_LIGHTS) invalid_argument ("Gl.light");269 if (Int_val(n) >= GL_MAX_LIGHTS) caml_invalid_argument ("Gl.light");
270 switch (Field(param,0))270 switch (Field(param,0))
271 {271 {
272 case MLTAG_ambient:272 case MLTAG_ambient:
@@ -712,7 +712,7 @@ CAMLprim value ml_glCallLists (value indexes) /* ML */ · 439 unmodified lines
712 712
713 switch (Field(indexes,0)) {713 switch (Field(indexes,0)) {
714 case MLTAG_byte:714 case MLTAG_byte:
715 glCallLists (string_length(Field(indexes,1)),715 glCallLists (caml_string_length(Field(indexes,1)),
716 GL_UNSIGNED_BYTE,716 GL_UNSIGNED_BYTE,
717 String_val(Field(indexes,1)));717 String_val(Field(indexes,1)));
718 break;718 break;
lablGL/ml_raw.c+24−25
@@ -16,8 +16,7 @@ · 15 unmodified lines
16#define SIZE_FLOAT sizeof(float)16#define SIZE_FLOAT sizeof(float)
17#define SIZE_DOUBLE sizeof(double)17#define SIZE_DOUBLE sizeof(double)
18 18
19extern void invalid_argument (char *) Noreturn;19extern void caml_invalid_argument (char *) Noreturn;
20extern void raise_out_of_memory (void) Noreturn;
21 20
22static int raw_sizeof (value kind)21static int raw_sizeof (value kind)
23{22{
@@ -52,7 +51,7 @@ static void check_size (value raw, long pos, char *msg) · 28 unmodified lines
52{51{
53 if (pos < 0 ||52 if (pos < 0 ||
54 (pos+1) * raw_sizeof(Kind_raw(raw)) > Int_val(Size_raw(raw)))53 (pos+1) * raw_sizeof(Kind_raw(raw)) > Int_val(Size_raw(raw)))
55 invalid_argument (msg);54 caml_invalid_argument (msg);
56}55}
57 56
58CAMLprim value ml_raw_get (value raw, value pos) /* ML */57CAMLprim value ml_raw_get (value raw, value pos) /* ML */
@@ -89,8 +88,8 @@ CAMLprim value ml_raw_read (value raw, value pos, value len) /* ML */ · 30 unmodified lines
89 value ret;88 value ret;
90 89
91 check_size (raw,s+l-1,"Raw.read");90 check_size (raw,s+l-1,"Raw.read");
92 if (l<0 || s<0) invalid_argument("Raw.read");91 if (l<0 || s<0) caml_invalid_argument("Raw.read");
93 ret = alloc_shr (l, 0);92 ret = caml_alloc_shr (l, 0);
94 switch (Kind_raw(raw)) {93 switch (Kind_raw(raw)) {
95 case MLTAG_bitmap:94 case MLTAG_bitmap:
96 case MLTAG_ubyte:95 case MLTAG_ubyte:
@@ -161,8 +160,8 @@ CAMLprim value ml_raw_read_string (value raw, value pos, value len) /* ML */ · 64 unmodified lines
161 value ret;160 value ret;
162 161
163 if (l<0 || s<0 || s+l > Int_val(Size_raw(raw)))162 if (l<0 || s<0 || s+l > Int_val(Size_raw(raw)))
164 invalid_argument("Raw.read_string");163 caml_invalid_argument("Raw.read_string");
165 ret = alloc_string (l);164 ret = caml_alloc_string (l);
166 memcpy (Bp_val(ret), Bp_val(Addr_raw(raw))+s, l);165 memcpy (Bp_val(ret), Bp_val(Addr_raw(raw))+s, l);
167 CAMLreturn(ret);166 CAMLreturn(ret);
168}167}
@@ -170,10 +169,10 @@ CAMLprim value ml_raw_read_string (value raw, value pos, value len) /* ML */ · 1 unmodified line
170CAMLprim value ml_raw_write_string (value raw, value pos, value data) /* ML */169CAMLprim value ml_raw_write_string (value raw, value pos, value data) /* ML */
171{170{
172 int s = Int_val(pos);171 int s = Int_val(pos);
173 int l = string_length(data);172 int l = caml_string_length(data);
174 173
175 if (s<0 || s+l > Int_val(Size_raw(raw)))174 if (s<0 || s+l > Int_val(Size_raw(raw)))
176 invalid_argument("Raw.write_string");175 caml_invalid_argument("Raw.write_string");
177 memcpy (Bp_val(Addr_raw(raw))+s, String_val(data), l);176 memcpy (Bp_val(Addr_raw(raw))+s, String_val(data), l);
178 return Val_unit;177 return Val_unit;
179}178}
@@ -215,7 +214,7 @@ CAMLprim value ml_raw_write (value raw, value pos, value data) /* ML */ · 35 unmodified lines
215 int i, l = Wosize_val(data);214 int i, l = Wosize_val(data);
216 215
217 check_size (raw,s+l-1,"Raw.write");216 check_size (raw,s+l-1,"Raw.write");
218 if (s<0) invalid_argument("Raw.write");217 if (s<0) caml_invalid_argument("Raw.write");
219 218
220 switch (Kind_raw(raw)) {219 switch (Kind_raw(raw)) {
221 case MLTAG_bitmap:220 case MLTAG_bitmap:
@@ -273,9 +272,9 @@ CAMLprim value ml_raw_get_float (value raw, value pos) /* ML */ · 51 unmodified lines
273 272
274 check_size (raw,i,"Raw.get_float");273 check_size (raw,i,"Raw.get_float");
275 if (Kind_raw(raw) == MLTAG_float)274 if (Kind_raw(raw) == MLTAG_float)
276 return copy_double ((double) Float_raw(raw)[i]);275 return caml_copy_double ((double) Float_raw(raw)[i]);
277 else276 else
278 return copy_double (Double_raw(raw)[i]);277 return caml_copy_double (Double_raw(raw)[i]);
279}278}
280 279
281CAMLprim value ml_raw_read_float (value raw, value pos, value len) /* ML */280CAMLprim value ml_raw_read_float (value raw, value pos, value len) /* ML */
@@ -285,8 +284,8 @@ CAMLprim value ml_raw_read_float (value raw, value pos, value len) /* ML */ · 3 unmodified lines
285 value ret = Val_unit;284 value ret = Val_unit;
286 285
287 check_size (raw,s+l-1,"Raw.read_float");286 check_size (raw,s+l-1,"Raw.read_float");
288 if (l<0 || s<0) invalid_argument("Raw.read_float");287 if (l<0 || s<0) caml_invalid_argument("Raw.read_float");
289 ret = alloc_shr (l*sizeof(double)/sizeof(value), Double_array_tag);288 ret = caml_alloc_shr (l*sizeof(double)/sizeof(value), Double_array_tag);
290 if (Kind_raw(raw) == MLTAG_float) {289 if (Kind_raw(raw) == MLTAG_float) {
291 float *float_raw = Float_raw(raw)+s;290 float *float_raw = Float_raw(raw)+s;
292 for (i = 0; i < l; i++)291 for (i = 0; i < l; i++)
@@ -317,7 +316,7 @@ CAMLprim value ml_raw_write_float (value raw, value pos, value data) /* ML */ · 24 unmodified lines
317 int i, l = Wosize_val(data)*sizeof(value)/sizeof(double);316 int i, l = Wosize_val(data)*sizeof(value)/sizeof(double);
318 317
319 check_size (raw,s+l-1,"Raw.write_float");318 check_size (raw,s+l-1,"Raw.write_float");
320 if (s<0) invalid_argument("Raw.write_float");319 if (s<0) caml_invalid_argument("Raw.write_float");
321 if (Kind_raw(raw) == MLTAG_float) {320 if (Kind_raw(raw) == MLTAG_float) {
322 float *float_raw = Float_raw(raw)+s;321 float *float_raw = Float_raw(raw)+s;
323 for (i = 0; i < l; i++)322 for (i = 0; i < l; i++)
@@ -428,10 +427,10 @@ CAMLprim value ml_raw_get_long (value raw, value pos) /* ML */ · 104 unmodified lines
428 switch (Kind_raw(raw)) {427 switch (Kind_raw(raw)) {
429 case MLTAG_int:428 case MLTAG_int:
430 case MLTAG_uint:429 case MLTAG_uint:
431 return copy_nativeint (Int_raw(raw)[i]);430 return caml_copy_nativeint (Int_raw(raw)[i]);
432 case MLTAG_long:431 case MLTAG_long:
433 case MLTAG_ulong:432 case MLTAG_ulong:
434 return copy_nativeint (Long_raw(raw)[i]);433 return caml_copy_nativeint (Long_raw(raw)[i]);
435 }434 }
436 return Val_unit;435 return Val_unit;
437}436}
@@ -463,10 +462,10 @@ CAMLprim value ml_raw_alloc (value kind, value len) /* ML */ · 25 unmodified lines
463 int offset = 0;462 int offset = 0;
464 463
465 if (kind == MLTAG_double && sizeof(double) > sizeof(value)) {464 if (kind == MLTAG_double && sizeof(double) > sizeof(value)) {
466 data = alloc_shr ((size-1)/sizeof(value)+2, Abstract_tag);465 data = caml_alloc_shr ((size-1)/sizeof(value)+2, Abstract_tag);
467 offset = (data % sizeof(double) ? sizeof(value) : 0);466 offset = (data % sizeof(double) ? sizeof(value) : 0);
468 } else data = alloc_shr ((size-1)/sizeof(value)+1, Abstract_tag);467 } else data = caml_alloc_shr ((size-1)/sizeof(value)+1, Abstract_tag);
469 raw = alloc_small (SIZE_RAW,0);468 raw = caml_alloc_small (SIZE_RAW,0);
470 Kind_raw(raw) = kind;469 Kind_raw(raw) = kind;
471 Size_raw(raw) = Val_int(size);470 Size_raw(raw) = Val_int(size);
472 Base_raw(raw) = data;471 Base_raw(raw) = data;
@@ -483,10 +482,10 @@ CAMLprim value ml_raw_alloc_static (value kind, value len) /* ML */ · 10 unmodified lines
483 int offset = 0;482 int offset = 0;
484 483
485 if (kind == MLTAG_double && sizeof(double) > sizeof(long)) {484 if (kind == MLTAG_double && sizeof(double) > sizeof(long)) {
486 data = stat_alloc (size+sizeof(long));485 data = caml_stat_alloc (size+sizeof(long));
487 offset = ((long)data % sizeof(double) ? sizeof(value) : 0);486 offset = ((long)data % sizeof(double) ? sizeof(value) : 0);
488 } else data = stat_alloc (size);487 } else data = caml_stat_alloc (size);
489 raw = alloc_small (SIZE_RAW, 0);488 raw = caml_alloc_small (SIZE_RAW, 0);
490 Kind_raw(raw) = kind;489 Kind_raw(raw) = kind;
491 Size_raw(raw) = Val_int(size);490 Size_raw(raw) = Val_int(size);
492 Base_raw(raw) = (value) data;491 Base_raw(raw) = (value) data;
@@ -497,8 +496,8 @@ CAMLprim value ml_raw_alloc_static (value kind, value len) /* ML */ · 4 unmodified lines
497 496
498CAMLprim value ml_raw_free_static (value raw) /* ML */497CAMLprim value ml_raw_free_static (value raw) /* ML */
499{498{
500 if (Static_raw(raw) != Val_int(1)) invalid_argument ("Raw.free_static");499 if (Static_raw(raw) != Val_int(1)) caml_invalid_argument ("Raw.free_static");
501 stat_free (Void_raw(raw));500 caml_stat_free (Void_raw(raw));
502 Base_raw(raw) = Val_unit;501 Base_raw(raw) = Val_unit;
503 Size_raw(raw) = Val_unit;502 Size_raw(raw) = Val_unit;
504 Offset_raw(raw) = Val_unit;503 Offset_raw(raw) = Val_unit;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t