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
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
#
# 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
*/
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
*/
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
*/
(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
*/
}
/* 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
*/
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
*/
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
*/
#endif
IOFileObject*
-openStdFile(fd,rd)
-StgInt fd;
-StgInt rd;
+openStdFile(StgInt fd, StgInt rd)
{
IOFileObject* fo;
long fd_flags;
#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;
/* `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
*/
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
*
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
*/
#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
*/
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
*/
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.
*/
StgInt
writeBuffer(StgForeignPtr ptr, StgInt bytes)
{
- int count, rc=0;
+ int count;
IOFileObject* fo = (IOFileObject*)ptr;
char *pBuf = (char *) fo->buf + fo->bufStart;