Commit 4ee0f622 authored by simonmar's avatar simonmar

[project @ 1999-12-08 15:47:06 by simonmar]

misc ansification and -Wall cleanup
parent 9c370d69
......@@ -600,7 +600,7 @@ type MBytes = MutableByteArray RealWorld Int
foreign import "libHS_cbits" "sizeof_time_t" sizeof_time_t :: Int
foreign import "libHS_cbits" "prim_SETZONE" unsafe prim_SETZONE :: MBytes -> MBytes -> IO Int
foreign import "libHS_cbits" "prim_SETZONE" unsafe prim_SETZONE :: MBytes -> MBytes -> IO ()
#ifdef __HUGS__
foreign import "libHS_cbits" "prim_toLocalTime" unsafe prim_toLocalTime :: Int64 -> MBytes -> IO Int
foreign import "libHS_cbits" "prim_toUTCTime" unsafe prim_toUTCTime :: Int64 -> MBytes -> IO Int
......
# $Id: Makefile,v 1.11 1999/12/07 15:49:53 simonmar Exp $
# $Id: Makefile,v 1.12 1999/12/08 15:47:07 simonmar Exp $
TOP = ../../..
include $(TOP)/mk/boilerplate.mk
......@@ -15,7 +15,7 @@ C_SRCS= $(wildcard *.c)
C_OBJS = $(C_SRCS:.c=.$(way_)o)
LIBOBJS = $(C_OBJS)
SRC_CC_OPTS += -O -I$(GHC_INCLUDE_DIR) -I$(GHC_RUNTIME_DIR) $(GhcLibCcOpts)
SRC_CC_OPTS += -O -I$(GHC_INCLUDE_DIR) -I$(GHC_RUNTIME_DIR) $(GhcLibCcOpts) -Wall
ifneq "$(way)" "dll"
SRC_CC_OPTS += -static
......@@ -36,7 +36,7 @@ SRC_BLD_DLL_OPTS += -lwinmm -lwsock32 -lHSrts_imp -lgmp -L. -L../../../rts/gmp -
#
# Compile the files using the Haskell compiler (ghc really).
#
CC=$(GHC_INPLACE)
# CC=$(GHC_INPLACE)
SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: fileGetc.c,v 1.4 1999/11/26 16:25:55 simonmar Exp $
* $Id: fileGetc.c,v 1.5 1999/12/08 15:47:07 simonmar Exp $
*
* hGetChar Runtime Support
*/
......@@ -17,7 +17,7 @@ fileGetc(ptr)
StgForeignPtr ptr;
{
IOFileObject* fo = (IOFileObject*)ptr;
int l,rc=0;
int rc=0;
unsigned char c;
#if 0
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: fileLookAhead.c,v 1.4 1999/11/25 16:54:14 simonmar Exp $
* $Id: fileLookAhead.c,v 1.5 1999/12/08 15:47:07 simonmar Exp $
*
* hLookAhead Runtime Support
*/
......@@ -47,7 +47,7 @@ StgInt
ungetChar(StgForeignPtr ptr, StgChar c)
{
IOFileObject* fo = (IOFileObject*)ptr;
int rc = 0, sz = 0;
int sz = 0;
#if 0
fprintf(stderr, "ug: %d %d %c\n",fo->bufRPtr, fo->bufWPtr,(char)c, fo->flags);
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: filePosn.c,v 1.5 1999/09/20 08:36:35 panne Exp $
* $Id: filePosn.c,v 1.6 1999/12/08 15:47:07 simonmar Exp $
*
* hGetPosn and hSetPosn Runtime Support
*/
......@@ -57,13 +57,10 @@ StgForeignPtr ptr;
(this is ensured by making the Haskell file posn. type abstract.)
*/
StgInt
setFilePosn(ptr, size, d)
StgForeignPtr ptr;
StgInt size;
StgByteArray d;
setFilePosn(StgForeignPtr ptr, StgInt size, StgByteArray d)
{
IOFileObject* fo = (IOFileObject*)ptr;
int rc, mode;
int rc;
off_t offset;
/*
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: filePutc.c,v 1.10 1999/11/26 16:25:56 simonmar Exp $
* $Id: filePutc.c,v 1.11 1999/12/08 15:47:07 simonmar Exp $
*
* hPutChar Runtime Support
*/
......@@ -76,19 +76,19 @@ filePutc(StgForeignPtr ptr, StgChar c)
}
/* Unbuffered, write the character directly. */
while (rc = (
while ((rc = (
#ifdef USE_WINSOCK
fo->flags & FILEOBJ_WINSOCK ?
send(fo->fd, &c, 1, 0) :
write(fo->fd, &c, 1)) <= 0) {
write(fo->fd, &c, 1))) <= 0) {
#else
write(fo->fd, &c, 1)) <= 0) {
write(fo->fd, &c, 1))) <= 0) {
#endif
if ( rc == -1 && errno == EAGAIN) {
errno = 0;
return FILEOBJ_BLOCKED_WRITE;
} else if (rc == 0 || rc == -1 && errno != EINTR) {
} else if (rc == 0 || (rc == -1 && errno != EINTR)) {
cvtErrno();
stdErrno();
return -1;
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: getLock.c,v 1.6 1999/05/05 10:33:16 sof Exp $
* $Id: getLock.c,v 1.7 1999/12/08 15:47:07 simonmar Exp $
*
* stdin/stout/stderr Runtime Support
*/
......@@ -134,7 +134,7 @@ int
unlockFile(fd)
int fd;
{
int i, rc;
int i;
for (i = 0; i < readLocks; i++)
if (readLock[i].fd == fd) {
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: inputReady.c,v 1.5 1999/09/12 16:24:46 sof Exp $
* $Id: inputReady.c,v 1.6 1999/12/08 15:47:08 simonmar Exp $
*
* hReady Runtime Support
*/
......@@ -56,7 +56,7 @@ StgForeignPtr ptr;
StgInt msecs;
{
IOFileObject* fo = (IOFileObject*)ptr;
int c, fd, maxfd, ready;
int fd, maxfd, ready;
#ifndef mingw32_TARGET_OS
fd_set rfd;
struct timeval tv;
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: openFile.c,v 1.13 1999/12/08 14:04:32 simonmar Exp $
* $Id: openFile.c,v 1.14 1999/12/08 15:47:08 simonmar Exp $
*
* openFile Runtime Support
*/
......@@ -33,9 +33,7 @@
#endif
IOFileObject*
openStdFile(fd,rd)
StgInt fd;
StgInt rd;
openStdFile(StgInt fd, StgInt rd)
{
IOFileObject* fo;
long fd_flags;
......@@ -69,12 +67,8 @@ StgInt rd;
#define OPENFILE_READ_WRITE 3
IOFileObject*
openFile(file, how, binary)
StgByteArray file;
StgInt how;
StgInt binary;
openFile(StgByteArray file, StgInt how, StgInt binary)
{
FILE *fp;
int fd;
int oflags;
int for_writing;
......@@ -290,10 +284,9 @@ StgInt binary;
/* `Lock' file descriptor and return file object. */
IOFileObject*
openFd(StgInt fd,StgInt oflags,StgInt flags)
openFd(StgInt fd, StgInt oflags, StgInt flags)
{
int for_writing;
FILE* fp;
IOFileObject* fo;
for_writing = ( ((oflags & O_WRONLY) || (oflags & O_RDWR)) ? 1 : 0);
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: readFile.c,v 1.8 1999/09/16 13:14:43 simonmar Exp $
* $Id: readFile.c,v 1.9 1999/12/08 15:47:08 simonmar Exp $
*
* hGetContents Runtime Support
*/
......@@ -211,7 +211,6 @@ readLine(ptr)
StgForeignPtr ptr;
{
IOFileObject* fo = (IOFileObject*)ptr;
char *s;
int rc=0, count;
/* Check if someone hasn't zapped us */
......
/* -----------------------------------------------------------------------------
* $Id: stgio.h,v 1.15 1999/11/26 16:25:56 simonmar Exp $
* $Id: stgio.h,v 1.16 1999/12/08 15:47:08 simonmar Exp $
*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1999
*
......@@ -199,22 +199,22 @@ StgInt showTime (StgInt, StgByteArray, StgInt, StgByteArray);
StgInt systemCmd (StgByteArray);
/* timezone.c */
StgInt get_tm_sec ( StgAddr );
StgInt get_tm_min ( StgAddr );
StgInt get_tm_hour ( StgAddr );
StgInt get_tm_mday ( StgAddr );
StgInt get_tm_mon ( StgAddr );
StgInt get_tm_year ( StgAddr );
StgInt get_tm_wday ( StgAddr );
StgInt get_tm_yday ( StgAddr );
StgInt get_tm_isdst ( StgAddr );
StgAddr prim_ZONE ( StgAddr );
StgInt prim_GMTOFF ( StgAddr );
StgInt prim_SETZONE ( StgAddr, StgAddr );
StgInt sizeof_word ( void );
StgInt sizeof_struct_tm ( void );
StgInt sizeof_time_t ( void );
char* get_ZONE ( StgAddr );
StgInt get_tm_sec ( StgAddr );
StgInt get_tm_min ( StgAddr );
StgInt get_tm_hour ( StgAddr );
StgInt get_tm_mday ( StgAddr );
StgInt get_tm_mon ( StgAddr );
StgInt get_tm_year ( StgAddr );
StgInt get_tm_wday ( StgAddr );
StgInt get_tm_yday ( StgAddr );
StgInt get_tm_isdst ( StgAddr );
StgAddr prim_ZONE ( StgAddr );
StgInt prim_GMTOFF ( StgAddr );
void prim_SETZONE ( StgAddr, StgAddr );
StgInt sizeof_word ( void );
StgInt sizeof_struct_tm ( void );
StgInt sizeof_time_t ( void );
char* get_ZONE ( StgAddr );
/* toLocalTime.c */
StgAddr toLocalTime (StgInt, StgByteArray, StgByteArray);
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: system.c,v 1.5 1999/03/01 08:57:57 sof Exp $
* $Id: system.c,v 1.6 1999/12/08 15:47:08 simonmar Exp $
*
* system Runtime Support
*/
......@@ -28,8 +28,7 @@
#endif
StgInt
systemCmd(cmd)
StgByteArray cmd;
systemCmd(StgByteArray cmd)
{
#if defined(mingw32_TARGET_OS)
if (system(cmd) < 0) {
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: timezone.c,v 1.5 1999/09/19 19:22:14 sof Exp $
* $Id: timezone.c,v 1.6 1999/12/08 15:47:08 simonmar Exp $
*
* Timezone Runtime Support
*/
......@@ -22,7 +22,8 @@ StgInt get_tm_isdst ( StgAddr x ) { return ((struct tm*)x)->tm_isdst; }
StgAddr prim_ZONE ( StgAddr x ) { return ZONE(x); }
StgInt prim_GMTOFF ( StgAddr x ) { return GMTOFF(x); }
StgInt prim_SETZONE ( StgAddr x, StgAddr y )
void
prim_SETZONE ( StgAddr x, StgAddr y )
{
SETZONE(x,y);
}
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: writeFile.c,v 1.11 1999/11/26 16:25:57 simonmar Exp $
* $Id: writeFile.c,v 1.12 1999/12/08 15:47:08 simonmar Exp $
*
* hPutStr Runtime Support
*/
......@@ -23,8 +23,6 @@ writeFileObject(StgForeignPtr ptr, StgInt bytes)
int rc=0;
IOFileObject* fo = (IOFileObject*)ptr;
char *p = (char *) fo->buf;
/* If we've got a r/w file object in our hand, flush the
(input) buffer contents first.
*/
......@@ -40,7 +38,7 @@ writeFileObject(StgForeignPtr ptr, StgInt bytes)
StgInt
writeBuffer(StgForeignPtr ptr, StgInt bytes)
{
int count, rc=0;
int count;
IOFileObject* fo = (IOFileObject*)ptr;
char *pBuf = (char *) fo->buf + fo->bufStart;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment