From 8835ed164d897ee29aaa0c19fad265d505e5e230 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Fri, 4 Sep 2020 16:19:06 +0100 Subject: [PATCH 1/4] Don't export caml_input_scan_line --- runtime/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/io.c b/runtime/io.c index f36f3251c..9415e5324 100644 --- a/runtime/io.c +++ b/runtime/io.c @@ -369,7 +369,7 @@ CAMLexport file_offset caml_pos_in(struct channel *channel) return channel->offset - (file_offset)(channel->max - channel->curr); } -CAMLexport intnat caml_input_scan_line(struct channel *channel) +intnat caml_input_scan_line(struct channel *channel) { char * p; int n; From 0f6d3a3128829c052b6b6679310b1fcda8f9793b Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Fri, 4 Sep 2020 16:21:03 +0100 Subject: [PATCH 2/4] Add missing channel declarations in caml/io.h --- runtime/caml/io.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/caml/io.h b/runtime/caml/io.h index bc8316084..34bd5d14c 100644 --- a/runtime/caml/io.h +++ b/runtime/caml/io.h @@ -69,7 +69,11 @@ enum { CAMLextern struct channel * caml_open_descriptor_in (int); CAMLextern struct channel * caml_open_descriptor_out (int); CAMLextern void caml_close_channel (struct channel *); - +CAMLextern file_offset caml_channel_size (struct channel *); +CAMLextern void caml_seek_in (struct channel *, file_offset); +CAMLextern void caml_seek_out (struct channel *, file_offset); +CAMLextern file_offset caml_pos_in (struct channel *); +CAMLextern file_offset caml_pos_out (struct channel *); /* I/O on channels from C. The channel must be locked (see below) before calling any of the functions and macros below */ From bf05018a1a849ece1621fcd5dff9929897b31cbf Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Fri, 4 Sep 2020 16:22:10 +0100 Subject: [PATCH 3/4] Formalise the Cash exports --- runtime/caml/io.h | 3 +++ runtime/io.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/caml/io.h b/runtime/caml/io.h index 34bd5d14c..d7624ef57 100644 --- a/runtime/caml/io.h +++ b/runtime/caml/io.h @@ -75,6 +75,9 @@ CAMLextern void caml_seek_out (struct channel *, file_offset); CAMLextern file_offset caml_pos_in (struct channel *); CAMLextern file_offset caml_pos_out (struct channel *); +CAMLextern void caml_finalize_channel (value); +CAMLextern int caml_do_read (int, char *, unsigned int); + /* I/O on channels from C. The channel must be locked (see below) before calling any of the functions and macros below */ diff --git a/runtime/io.c b/runtime/io.c index 9415e5324..9d19ab3a9 100644 --- a/runtime/io.c +++ b/runtime/io.c @@ -416,7 +416,7 @@ intnat caml_input_scan_line(struct channel *channel) objects into a heap-allocated object. Perform locking and unlocking around the I/O operations. */ -/* FIXME CAMLexport, but not in io.h exported for Cash ? */ +/* caml_finalize_channel is exported for Cash */ CAMLexport void caml_finalize_channel(value vchan) { struct channel * chan = Channel(vchan); From 422c20013d323ab9d2f9d8a3d609b30ae6222ebd Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Mon, 7 Sep 2020 13:54:08 +0100 Subject: [PATCH 4/4] Remove CAMLexport from Cash-exported primitives --- runtime/caml/io.h | 3 --- runtime/io.c | 6 ++---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/runtime/caml/io.h b/runtime/caml/io.h index d7624ef57..34bd5d14c 100644 --- a/runtime/caml/io.h +++ b/runtime/caml/io.h @@ -75,9 +75,6 @@ CAMLextern void caml_seek_out (struct channel *, file_offset); CAMLextern file_offset caml_pos_in (struct channel *); CAMLextern file_offset caml_pos_out (struct channel *); -CAMLextern void caml_finalize_channel (value); -CAMLextern int caml_do_read (int, char *, unsigned int); - /* I/O on channels from C. The channel must be locked (see below) before calling any of the functions and macros below */ diff --git a/runtime/io.c b/runtime/io.c index 9d19ab3a9..deed1d401 100644 --- a/runtime/io.c +++ b/runtime/io.c @@ -266,8 +266,7 @@ CAMLexport file_offset caml_pos_out(struct channel *channel) /* Input */ -/* caml_do_read is exported for Cash */ -CAMLexport int caml_do_read(int fd, char *p, unsigned int n) +int caml_do_read(int fd, char *p, unsigned int n) { int r; do { @@ -416,8 +415,7 @@ intnat caml_input_scan_line(struct channel *channel) objects into a heap-allocated object. Perform locking and unlocking around the I/O operations. */ -/* caml_finalize_channel is exported for Cash */ -CAMLexport void caml_finalize_channel(value vchan) +void caml_finalize_channel(value vchan) { struct channel * chan = Channel(vchan); if ((chan->flags & CHANNEL_FLAG_MANAGED_BY_GC) == 0) return;