Makefile: Nouveau systeme d'autoconfiguration.

io.[ch]: l'argument "longueur" de getblock et putblock est un long.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@627 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 1996-02-13 16:26:14 +00:00
parent 567aebacc7
commit 2560ad0f58
3 changed files with 26 additions and 18 deletions

View File

@ -1,5 +1,4 @@
include ../config/Makefile.h
include ../Makefile.config
include ../config/Makefile
CC=$(BYTECC)
CFLAGS=-O $(BYTECCCOMPOPTS)
@ -19,10 +18,10 @@ PRIMS=array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
all: cslrun
cslrun: $(OBJS) prims.o
$(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) $(LOWADDRESSES) -o cslrun prims.o $(OBJS) $(CCLIBS)
$(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) -o cslrun prims.o $(OBJS) $(CCLIBS)
cslrund: $(DOBJS) prims.o
$(BYTECC) -g $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) $(LOWADDRESSES) -o cslrund prims.o $(DOBJS) $(CCLIBS)
$(BYTECC) -g $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) -o cslrund prims.o $(DOBJS) $(CCLIBS)
install:
cp cslrun $(BINDIR)/cslrun

View File

@ -17,6 +17,9 @@
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#ifdef __STDC__
#include <limits.h>
#endif
#include "alloc.h"
#include "fail.h"
#include "io.h"
@ -29,6 +32,10 @@
#include "ui.h"
#endif
#ifndef INT_MAX
#define INT_MAX 0x7FFFFFFF
#endif
/* Common functions. */
struct channel * open_descr(fd)
@ -132,13 +139,14 @@ value output_int(channel, w) /* ML */
return Val_unit;
}
void putblock(channel, p, n)
void putblock(channel, p, len)
struct channel * channel;
char * p;
unsigned n;
long len;
{
unsigned m;
int n, m;
n = len >= INT_MAX ? INT_MAX : (int) len;
m = channel->end - channel->curr;
if (channel->curr == channel->buff && n >= m) {
really_write(channel->fd, p, n);
@ -170,7 +178,7 @@ value output(channel, buff, start, length) /* ML */
{
putblock((struct channel *) channel,
&Byte(buff, Long_val(start)),
(unsigned) Long_val(length));
Long_val(length));
return Val_unit;
}
@ -276,13 +284,14 @@ value input_int(channel) /* ML */
return Val_long(i);
}
unsigned getblock(channel, p, n)
int getblock(channel, p, len)
struct channel * channel;
char * p;
unsigned n;
long len;
{
unsigned m, l;
int n, m, l;
n = len >= INT_MAX ? INT_MAX : (int) len;
m = channel->max - channel->curr;
if (n <= m) {
bcopy(channel->curr, p, n);
@ -312,11 +321,11 @@ unsigned getblock(channel, p, n)
int really_getblock(chan, p, n)
struct channel * chan;
char * p;
unsigned long n;
long n;
{
unsigned r;
int r;
while (n > 0) {
r = getblock(chan, p, (unsigned) n);
r = getblock(chan, p, n);
if (r == 0) return 0;
p += r;
n -= r;
@ -329,7 +338,7 @@ value input(channel, buff, start, length) /* ML */
{
return Val_long(getblock((struct channel *) channel,
&Byte(buff, Long_val(start)),
(unsigned) Long_val(length)));
Long_val(length)));
}
value seek_in(channel, pos) /* ML */

View File

@ -52,13 +52,13 @@ struct channel {
struct channel * open_descr P((int));
value flush P((struct channel *));
void putword P((struct channel *, uint32));
void putblock P((struct channel *, char *, unsigned));
void putblock P((struct channel *, char *, long));
unsigned char refill P((struct channel *));
value pos_out P((struct channel *));
value seek_out P((struct channel *, value));
uint32 getword P((struct channel *));
unsigned getblock P((struct channel *, char *, unsigned));
int really_getblock P((struct channel *, char *, unsigned long));
int getblock P((struct channel *, char *, long));
int really_getblock P((struct channel *, char *, long));
value close_in P((struct channel *));