From: simonm Date: Fri, 10 Apr 1998 10:55:01 +0000 (+0000) Subject: [project @ 1998-04-10 10:54:14 by simonm] X-Git-Tag: Approx_2487_patches~813 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=3f9b5688990aa7c1170c8d995df69087b43dabeb;p=ghc-hetmet.git [project @ 1998-04-10 10:54:14 by simonm] New Run-Time System Support, includes: - New code generator - Modifications to the mangler - Unboxed Tuple support - Various other minor changes. --- diff --git a/ghc/lib/std/cbits/closeFile.lc b/ghc/lib/std/cbits/closeFile.c similarity index 61% rename from ghc/lib/std/cbits/closeFile.lc rename to ghc/lib/std/cbits/closeFile.c index 9f4c80e..90eeb9d 100644 --- a/ghc/lib/std/cbits/closeFile.lc +++ b/ghc/lib/std/cbits/closeFile.c @@ -1,16 +1,16 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[closeFile.lc]{hClose Runtime Support} - -\begin{code} - -#include "rtsdefs.h" +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: closeFile.c,v 1.1 1998/04/10 10:54:14 simonm Exp $ + * + * hClose Runtime Support + */ + +#include "Rts.h" #include "stgio.h" StgInt -closeFile(fp) -StgForeignObj fp; +closeFile(StgAddr fp) { int rc; @@ -29,7 +29,5 @@ StgForeignObj fp; return 0; } -\end{code} - diff --git a/ghc/lib/std/cbits/createDirectory.lc b/ghc/lib/std/cbits/createDirectory.c similarity index 79% rename from ghc/lib/std/cbits/createDirectory.lc rename to ghc/lib/std/cbits/createDirectory.c index 759e99c..6165518 100644 --- a/ghc/lib/std/cbits/createDirectory.lc +++ b/ghc/lib/std/cbits/createDirectory.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[createDirectory.lc]{createDirectory Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: createDirectory.c,v 1.1 1998/04/10 10:54:16 simonm Exp $ + * + * createDirectory Runtime Support} + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -17,8 +18,7 @@ #endif StgInt -createDirectory(path) -StgByteArray path; +createDirectory(StgByteArray path) { int rc; struct stat sb; @@ -54,5 +54,3 @@ StgByteArray path; } return 0; } - -\end{code} diff --git a/ghc/lib/std/cbits/errno.lc b/ghc/lib/std/cbits/errno.c similarity index 98% rename from ghc/lib/std/cbits/errno.lc rename to ghc/lib/std/cbits/errno.c index 0eaa9d1..fc32980 100644 --- a/ghc/lib/std/cbits/errno.lc +++ b/ghc/lib/std/cbits/errno.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[errno.lc]{GHC Error Number Conversion} - -\begin{code} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: errno.c,v 1.1 1998/04/10 10:54:18 simonm Exp $ + * + * GHC Error Number Conversion + */ -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" int ghc_errno = 0; @@ -15,7 +16,7 @@ char *ghc_errstr = NULL; /* Collect all of the grotty #ifdef's in one place. */ -void cvtErrno(STG_NO_ARGS) +void cvtErrno(void) { switch(errno) { #ifdef E2BIG @@ -526,7 +527,7 @@ void cvtErrno(STG_NO_ARGS) } void -stdErrno(STG_NO_ARGS) +stdErrno(void) { switch(ghc_errno) { default: @@ -930,5 +931,3 @@ stdErrno(STG_NO_ARGS) break; } } - -\end{code} diff --git a/ghc/lib/std/cbits/error.h b/ghc/lib/std/cbits/error.h new file mode 100644 index 0000000..785fadb --- /dev/null +++ b/ghc/lib/std/cbits/error.h @@ -0,0 +1,150 @@ +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: error.h,v 1.1 1998/04/10 10:54:20 simonm Exp $ + * + * Error codes used by the IO subsystem. + */ + +#if !defined(COMPILING_NCG) && !defined(__GLASGOW_HASKELL__) +extern int ghc_errno; +extern int ghc_errtype; +extern char *ghc_errstr; + +void cvtErrno (void); +void stdErrno (void); +#endif + +#define ERR_ALREADYEXISTS 1 +#define ERR_HARDWAREFAULT 2 +#define ERR_ILLEGALOPERATION 3 +#define ERR_INAPPROPRIATETYPE 4 +#define ERR_INTERRUPTED 5 +#define ERR_INVALIDARGUMENT 6 +#define ERR_NOSUCHTHING 7 +#define ERR_OTHERERROR 8 +#define ERR_PERMISSIONDENIED 9 +#define ERR_PROTOCOLERROR 10 +#define ERR_RESOURCEBUSY 11 +#define ERR_RESOURCEEXHAUSTED 12 +#define ERR_RESOURCEVANISHED 13 +#define ERR_SYSTEMERROR 14 +#define ERR_TIMEEXPIRED 15 +#define ERR_UNSATISFIEDCONSTRAINTS 16 +#define ERR_UNSUPPORTEDOPERATION 17 +#define ERR_USERERROR 18 +#define ERR_EOF 19 + +#define GHC_E2BIG -1 +#define GHC_EACCES -2 +#define GHC_EADDRINUSE -3 +#define GHC_EADDRNOTAVAIL -4 +#define GHC_EADV -5 +#define GHC_EAFNOSUPPORT -6 +#define GHC_EAGAIN -7 +#define GHC_EAIO -8 +#define GHC_EALREADY -9 +#define GHC_EBADF -10 +#define GHC_EBADMSG -11 +#define GHC_EBADRPC -12 +#define GHC_EBUSY -13 +#define GHC_ECANCELED -14 +#define GHC_ECHILD -15 +#define GHC_ECLONEME -16 +#define GHC_ECOMM -17 +#define GHC_ECONNABORTED -18 +#define GHC_ECONNREFUSED -19 +#define GHC_ECONNRESET -20 +#define GHC_EDEADLK -21 +#define GHC_EDESTADDRREQ -22 +#define GHC_EDIRTY -23 +#define GHC_EDOM -24 +#define GHC_EDOTDOT -25 +#define GHC_EDQUOT -26 +#define GHC_EDUPPKG -27 +#define GHC_EEXIST -28 +#define GHC_EFAIL -29 +#define GHC_EFAULT -30 +#define GHC_EFBIG -31 +#define GHC_EFTYPE -32 +#define GHC_EHOSTDOWN -33 +#define GHC_EHOSTUNREACH -34 +#define GHC_EIDRM -35 +#define GHC_EILSEQ -36 +#define GHC_EINPROG -37 +#define GHC_EINPROGRESS -38 +#define GHC_EINTR -39 +#define GHC_EINVAL -40 +#define GHC_EIO -41 +#define GHC_EISCONN -42 +#define GHC_EISDIR -43 +#define GHC_ELOOP -44 +#define GHC_EMEDIA -45 +#define GHC_EMFILE -46 +#define GHC_EMLINK -47 +#define GHC_EMSGSIZE -48 +#define GHC_EMTIMERS -49 +#define GHC_EMULTIHOP -50 +#define GHC_ENAMETOOLONG -51 +#define GHC_ENETDOWN -52 +#define GHC_ENETRESET -53 +#define GHC_ENETUNREACH -54 +#define GHC_ENFILE -55 +#define GHC_ENOBUFS -56 +#define GHC_ENODATA -57 +#define GHC_ENODEV -58 +#define GHC_ENOENT -59 +#define GHC_ENOEXEC -60 +#define GHC_ENOLCK -61 +#define GHC_ENOLINK -62 +#define GHC_ENOMEM -63 +#define GHC_ENOMSG -64 +#define GHC_ENONET -65 +#define GHC_ENOPKG -66 +#define GHC_ENOPROTOOPT -67 +#define GHC_ENOSPC -68 +#define GHC_ENOSR -69 +#define GHC_ENOSTR -70 +#define GHC_ENOSYM -71 +#define GHC_ENOSYS -72 +#define GHC_ENOTBLK -73 +#define GHC_ENOTCONN -74 +#define GHC_ENOTDIR -75 +#define GHC_ENOTEMPTY -76 +#define GHC_ENOTSOCK -77 +#define GHC_ENOTSUP -78 +#define GHC_ENOTTY -79 +#define GHC_ENXIO -80 +#define GHC_EOPNOTSUPP -81 +#define GHC_EPERM -82 +#define GHC_EPFNOSUPPORT -83 +#define GHC_EPIPE -84 +#define GHC_EPROCLIM -85 +#define GHC_EPROCUNAVAIL -86 +#define GHC_EPROGMISMATCH -87 +#define GHC_EPROGUNAVAIL -88 +#define GHC_EPROTO -89 +#define GHC_EPROTONOSUPPORT -90 +#define GHC_EPROTOTYPE -91 +#define GHC_ERANGE -92 +#define GHC_ERELOCATED -93 +#define GHC_EREMCHG -94 +#define GHC_EREMOTE -95 +#define GHC_EROFS -96 +#define GHC_ERPCMISMATCH -97 +#define GHC_ERREMOTE -98 +#define GHC_ESHUTDOWN -99 +#define GHC_ESOCKTNOSUPPORT -100 +#define GHC_ESOFT -101 +#define GHC_ESPIPE -102 +#define GHC_ESRCH -103 +#define GHC_ESRMNT -104 +#define GHC_ESTALE -105 +#define GHC_ETIME -106 +#define GHC_ETIMEDOUT -107 +#define GHC_ETOOMANYREFS -108 +#define GHC_ETXTBSY -109 +#define GHC_EUSERS -110 +#define GHC_EVERSION -111 +#define GHC_EWOULDBLOCK -112 +#define GHC_EXDEV -113 diff --git a/ghc/lib/std/cbits/fileEOF.c b/ghc/lib/std/cbits/fileEOF.c new file mode 100644 index 0000000..ba97822 --- /dev/null +++ b/ghc/lib/std/cbits/fileEOF.c @@ -0,0 +1,21 @@ +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: fileEOF.c,v 1.1 1998/04/10 10:54:21 simonm Exp $ + * + * hIsEOF Runtime Support + */ + +#include "Rts.h" +#include "stgio.h" + +StgInt +fileEOF(StgAddr fp) +{ + if (fileLookAhead(fp) != EOF) + return 0; + else if (ghc_errtype == ERR_EOF) + return 1; + else + return -1; +} diff --git a/ghc/lib/std/cbits/fileEOF.lc b/ghc/lib/std/cbits/fileEOF.lc deleted file mode 100644 index cdd3eb2..0000000 --- a/ghc/lib/std/cbits/fileEOF.lc +++ /dev/null @@ -1,23 +0,0 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[fileEOF.lc]{hIsEOF Runtime Support} - -\begin{code} - -#include "rtsdefs.h" -#include "stgio.h" - -StgInt -fileEOF(fp) -StgForeignObj fp; -{ - if (fileLookAhead(fp) != EOF) - return 0; - else if (ghc_errtype == ERR_EOF) - return 1; - else - return -1; -} - -\end{code} diff --git a/ghc/lib/std/cbits/fileGetc.c b/ghc/lib/std/cbits/fileGetc.c new file mode 100644 index 0000000..9c7b33f --- /dev/null +++ b/ghc/lib/std/cbits/fileGetc.c @@ -0,0 +1,36 @@ +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: fileGetc.c,v 1.1 1998/04/10 10:54:22 simonm Exp $ + * + * hGetChar Runtime Support + */ + +#include "Rts.h" +#include "stgio.h" +#include "error.h" + +StgInt +fileGetc(StgAddr fp) +{ + int c; + + if (feof((FILE *)fp)) { + ghc_errtype = ERR_EOF; + ghc_errstr = ""; + return EOF; + } + + /* Try to read a character */ + while ((c = getc((FILE *)fp)) == EOF && errno == EINTR) + clearerr((FILE *)fp); + + if (feof((FILE *)fp)) { + ghc_errtype = ERR_EOF; + ghc_errstr = ""; + } else if (c == EOF) { + cvtErrno(); + stdErrno(); + } + return c; +} diff --git a/ghc/lib/std/cbits/fileGetc.lc b/ghc/lib/std/cbits/fileGetc.lc deleted file mode 100644 index 131c956..0000000 --- a/ghc/lib/std/cbits/fileGetc.lc +++ /dev/null @@ -1,38 +0,0 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[fileGetc.lc]{hGetChar Runtime Support} - -\begin{code} - -#include "rtsdefs.h" -#include "stgio.h" -#include "error.h" - -StgInt -fileGetc(fp) -StgForeignObj fp; -{ - int c; - - if (feof((FILE *) fp)) { - ghc_errtype = ERR_EOF; - ghc_errstr = ""; - return EOF; - } - - /* Try to read a character */ - while ((c = getc((FILE *) fp)) == EOF && errno == EINTR) - clearerr((FILE *) fp); - - if (feof((FILE *) fp)) { - ghc_errtype = ERR_EOF; - ghc_errstr = ""; - } else if (c == EOF) { - cvtErrno(); - stdErrno(); - } - return c; -} - -\end{code} diff --git a/ghc/lib/std/cbits/fileLookAhead.c b/ghc/lib/std/cbits/fileLookAhead.c new file mode 100644 index 0000000..360f119 --- /dev/null +++ b/ghc/lib/std/cbits/fileLookAhead.c @@ -0,0 +1,25 @@ +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: fileLookAhead.c,v 1.1 1998/04/10 10:54:24 simonm Exp $ + * + * hLookAhead Runtime Support + */ + +#include "Rts.h" +#include "stgio.h" + +StgInt +fileLookAhead(StgAddr fp) +{ + int c; + + if ((c = fileGetc((FILE *)fp)) == EOF) { + return c; + } else if (ungetc(c, (FILE *)fp) == EOF) { + cvtErrno(); + stdErrno(); + return EOF; + } else + return c; +} diff --git a/ghc/lib/std/cbits/fileLookAhead.lc b/ghc/lib/std/cbits/fileLookAhead.lc deleted file mode 100644 index 91a1722..0000000 --- a/ghc/lib/std/cbits/fileLookAhead.lc +++ /dev/null @@ -1,27 +0,0 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[fileLookAhead.lc]{hLookAhead Runtime Support} - -\begin{code} - -#include "rtsdefs.h" -#include "stgio.h" - -StgInt -fileLookAhead(fp) -StgForeignObj fp; -{ - int c; - - if ((c = fileGetc(fp)) == EOF) { - return c; - } else if (ungetc(c, (FILE *) fp) == EOF) { - cvtErrno(); - stdErrno(); - return EOF; - } else - return c; -} - -\end{code} diff --git a/ghc/lib/std/cbits/filePosn.lc b/ghc/lib/std/cbits/filePosn.c similarity index 65% rename from ghc/lib/std/cbits/filePosn.lc rename to ghc/lib/std/cbits/filePosn.c index 7a0d790..e8131da 100644 --- a/ghc/lib/std/cbits/filePosn.lc +++ b/ghc/lib/std/cbits/filePosn.c @@ -1,16 +1,16 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[filePosn.lc]{hGetPosn and hSetPosn Runtime Support} - -\begin{code} - -#include "rtsdefs.h" +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: filePosn.c,v 1.1 1998/04/10 10:54:25 simonm Exp $ + * + * hGetPosn and hSetPosn Runtime Support + */ + +#include "Rts.h" #include "stgio.h" StgInt -getFilePosn(fp) -StgForeignObj fp; +getFilePosn(StgAddr fp) { StgInt posn; @@ -28,9 +28,7 @@ StgForeignObj fp; /* The following is only called with a position that we've already visited */ StgInt -setFilePosn(fp, posn) -StgForeignObj fp; -StgInt posn; +setFilePosn(StgAddr fp, I_ posn) { while (fseek((FILE *) fp, posn, SEEK_SET) != 0) { if (errno != EINTR) { @@ -42,7 +40,4 @@ StgInt posn; return 0; } -\end{code} - - diff --git a/ghc/lib/std/cbits/filePutc.lc b/ghc/lib/std/cbits/filePutc.c similarity index 57% rename from ghc/lib/std/cbits/filePutc.lc rename to ghc/lib/std/cbits/filePutc.c index 980aa63..446304d 100644 --- a/ghc/lib/std/cbits/filePutc.lc +++ b/ghc/lib/std/cbits/filePutc.c @@ -1,18 +1,17 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[filePut.lc]{hPutChar Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: filePutc.c,v 1.1 1998/04/10 10:54:26 simonm Exp $ + * + * hPutChar Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #include "error.h" StgInt -filePutc(fp, c) -StgForeignObj fp; -StgInt c; +filePutc(StgAddr fp, I_ c) { int rc; @@ -28,5 +27,3 @@ StgInt c; return 0; } - -\end{code} diff --git a/ghc/lib/std/cbits/fileSize.lc b/ghc/lib/std/cbits/fileSize.c similarity index 70% rename from ghc/lib/std/cbits/fileSize.lc rename to ghc/lib/std/cbits/fileSize.c index 34348fe..3720251 100644 --- a/ghc/lib/std/cbits/fileSize.lc +++ b/ghc/lib/std/cbits/fileSize.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[fileSize.lc]{hfileSize Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: fileSize.c,v 1.1 1998/04/10 10:54:27 simonm Exp $ + * + * hClose Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -17,9 +18,7 @@ #endif StgInt -fileSize(fp, result) -StgForeignObj fp; -StgByteArray result; +fileSize(StgAddr fp, StgByteArray result) { struct stat sb; @@ -41,5 +40,3 @@ StgByteArray result; return -1; } } - -\end{code} diff --git a/ghc/lib/std/cbits/floatExtreme.lc b/ghc/lib/std/cbits/floatExtreme.c similarity index 82% rename from ghc/lib/std/cbits/floatExtreme.lc rename to ghc/lib/std/cbits/floatExtreme.c index 3dbecde..997e6a9 100644 --- a/ghc/lib/std/cbits/floatExtreme.lc +++ b/ghc/lib/std/cbits/floatExtreme.c @@ -1,19 +1,21 @@ -% -% -% - -Stubs to check for extremities of (IEEE) floats, -the tests have been (artfully) lifted from the hbc-0.9999.3 (lib/fltcode.c) -source. - +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: floatExtreme.c,v 1.1 1998/04/10 10:54:28 simonm Exp $ + * + * Stubs to check for extremities of (IEEE) floats, + * the tests have been (artfully) lifted from the hbc-0.9999.3 (lib/fltcode.c) + * source. + */ + +/* ToDo: - avoid hard-wiring the fact that on an Alpha we repr. a StgFloat as a double. (introduce int equivalent of {ASSIGN,PK}_FLT? ) +*/ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "ieee-flpt.h" #include "floatExtreme.h" @@ -28,8 +30,7 @@ ToDo: #ifdef IEEE_FLOATING_POINT StgInt -isDoubleNaN(d) -StgDouble d; +isDoubleNaN(StgDouble d) { union { double d; int i[2]; } u; int hx,lx; @@ -46,8 +47,7 @@ StgDouble d; } StgInt -isDoubleInfinite(d) -StgDouble d; +isDoubleInfinite(StgDouble d) { union { double d; int i[2]; } u; int hx,lx; @@ -62,8 +62,7 @@ StgDouble d; } StgInt -isDoubleDenormalized(d) -StgDouble d; +isDoubleDenormalized(StgDouble d) { union { double d; int i[2]; } u; int high, iexp; @@ -75,8 +74,7 @@ StgDouble d; } StgInt -isDoubleNegativeZero(d) -StgDouble d; +isDoubleNegativeZero(StgDouble d) { union { double d; int i[2]; } u; int high, iexp; @@ -88,8 +86,7 @@ StgDouble d; /* Same tests, this time for StgFloats. */ StgInt -isFloatNaN(f) -StgFloat f; +isFloatNaN(StgFloat f) { #if !defined(alpha_TARGET_OS) /* StgFloat = double on alphas */ @@ -107,8 +104,7 @@ StgFloat f; } StgInt -isFloatInfinite(f) -StgFloat f; +isFloatInfinite(StgFloat f) { #if !defined(alpha_TARGET_OS) /* StgFloat = double on alphas */ @@ -125,8 +121,7 @@ StgFloat f; } StgInt -isFloatDenormalized(f) -StgFloat f; +isFloatDenormalized(StgFloat f) { #if !defined(alpha_TARGET_OS) /* StgFloat = double on alphas */ @@ -142,8 +137,7 @@ StgFloat f; } StgInt -isFloatNegativeZero(f) -StgFloat f; +isFloatNegativeZero(StgFloat f) { #if !defined(alpha_TARGET_OS) /* StgFloat = double on alphas */ @@ -169,6 +163,3 @@ StgInt isFloatDenormalized(f) StgFloat f; { return 0; } StgInt isFloatNegativeZero(f) StgFloat f; { return 0; } #endif - - -\end{code} diff --git a/ghc/lib/std/cbits/flushFile.c b/ghc/lib/std/cbits/flushFile.c new file mode 100644 index 0000000..54cf106 --- /dev/null +++ b/ghc/lib/std/cbits/flushFile.c @@ -0,0 +1,25 @@ +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: flushFile.c,v 1.1 1998/04/10 10:54:30 simonm Exp $ + * + * hFlush Runtime Support + */ + +#include "Rts.h" +#include "stgio.h" + +StgInt +flushFile(StgAddr fp) +{ + int rc; + + while ((rc = fflush((FILE *) fp)) != 0) { + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return rc; + } + } + return 0; +} diff --git a/ghc/lib/std/cbits/flushFile.lc b/ghc/lib/std/cbits/flushFile.lc deleted file mode 100644 index 6cfd484..0000000 --- a/ghc/lib/std/cbits/flushFile.lc +++ /dev/null @@ -1,30 +0,0 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[flushFile.lc]{hFlush Runtime Support} - -\begin{code} - -#include "rtsdefs.h" -#include "stgio.h" - -StgInt -flushFile(fp) -StgForeignObj fp; -{ - int rc; - - while ((rc = fflush((FILE *) fp)) != 0) { - if (errno != EINTR) { - cvtErrno(); - stdErrno(); - return rc; - } - } - return 0; -} - -\end{code} - - - diff --git a/ghc/lib/std/cbits/freeFile.lc b/ghc/lib/std/cbits/freeFile.c similarity index 81% rename from ghc/lib/std/cbits/freeFile.lc rename to ghc/lib/std/cbits/freeFile.c index 1ac3d52..751a48f 100644 --- a/ghc/lib/std/cbits/freeFile.lc +++ b/ghc/lib/std/cbits/freeFile.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1997 -% -\subsection[freeFile.lc]{Giving up files} - -\begin{code} - -#include "rtsdefs.h" +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: freeFile.c,v 1.1 1998/04/10 10:54:31 simonm Exp $ + * + * Giving up files + */ + +#include "Rts.h" #include "stgio.h" /* sigh, the FILEs attached to the standard descriptors are @@ -13,12 +14,10 @@ ForeignObj finaliser, as we probably want to use these before we *really* shut down (dumping stats etc.) */ -void freeStdFile(fp) -StgForeignObj fp; +void freeStdFile(StgAddr fp) { return; } -void freeFile(fp) -StgForeignObj fp; +void freeFile(StgAddr fp) { int rc; @@ -49,4 +48,3 @@ StgForeignObj fp; return; } -\end{code} diff --git a/ghc/lib/std/cbits/getBufferMode.lc b/ghc/lib/std/cbits/getBufferMode.c similarity index 78% rename from ghc/lib/std/cbits/getBufferMode.lc rename to ghc/lib/std/cbits/getBufferMode.c index cb0b984..a34b317 100644 --- a/ghc/lib/std/cbits/getBufferMode.lc +++ b/ghc/lib/std/cbits/getBufferMode.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[getBufferMode.lc]{hIs...Buffered Runtime Support} - -\begin{code} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: getBufferMode.c,v 1.1 1998/04/10 10:54:33 simonm Exp $ + * + * hIs...Buffered Runtime Support + */ -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -27,8 +28,7 @@ #define GBM_ERR (-3) StgInt -getBufferMode(fp) -StgForeignObj fp; +getBufferMode(StgAddr fp) { struct stat sb; @@ -48,5 +48,3 @@ StgForeignObj fp; else return GBM_BB; } - -\end{code} diff --git a/ghc/lib/std/cbits/getCPUTime.lc b/ghc/lib/std/cbits/getCPUTime.c similarity index 88% rename from ghc/lib/std/cbits/getCPUTime.lc rename to ghc/lib/std/cbits/getCPUTime.c index d3d7b2a..250e51c 100644 --- a/ghc/lib/std/cbits/getCPUTime.lc +++ b/ghc/lib/std/cbits/getCPUTime.c @@ -1,9 +1,10 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[getCPUTime.lc]{getCPUTime Runtime Support} - -\begin{code} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: getCPUTime.c,v 1.1 1998/04/10 10:54:34 simonm Exp $ + * + * getCPUTime Runtime Support + */ #ifndef _AIX #define NON_POSIX_SOURCE /*needed for solaris2 only?*/ @@ -14,7 +15,7 @@ #define _INCLUDE_HPUX_SOURCE #endif -#include "rtsdefs.h" +#include "Rts.h" #ifdef HAVE_SYS_TYPES_H #include @@ -47,7 +48,7 @@ #endif StgInt -clockTicks () +clockTicks (void) { return ( #if defined(CLK_TCK) @@ -100,8 +101,5 @@ getCPUTime(StgByteArray cpuStruct) return NULL; # endif #endif - return (StgByteArray) cpuStruct; + return (StgByteArray)cpuStruct; } - -\end{code} - diff --git a/ghc/lib/std/cbits/getClockTime.lc b/ghc/lib/std/cbits/getClockTime.c similarity index 85% rename from ghc/lib/std/cbits/getClockTime.lc rename to ghc/lib/std/cbits/getClockTime.c index b6f42e6..9f031bf 100644 --- a/ghc/lib/std/cbits/getClockTime.lc +++ b/ghc/lib/std/cbits/getClockTime.c @@ -1,15 +1,16 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[getClockTime.lc]{getClockTime Runtime Support} - -\begin{code} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: getClockTime.c,v 1.1 1998/04/10 10:54:35 simonm Exp $ + * + * getClockTime Runtime Support + */ #ifndef _AIX #define NON_POSIX_SOURCE /* gettimeofday */ #endif -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_GETCLOCK @@ -74,4 +75,3 @@ getClockTime(StgByteArray sec, StgByteArray nsec) #endif #endif } -\end{code} diff --git a/ghc/lib/std/cbits/getCurrentDirectory.lc b/ghc/lib/std/cbits/getCurrentDirectory.c similarity index 75% rename from ghc/lib/std/cbits/getCurrentDirectory.lc rename to ghc/lib/std/cbits/getCurrentDirectory.c index 4da895a..a132e0b 100644 --- a/ghc/lib/std/cbits/getCurrentDirectory.lc +++ b/ghc/lib/std/cbits/getCurrentDirectory.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[getCurrentDirectory.lc]{getCurrentDirectory Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: getCurrentDirectory.c,v 1.1 1998/04/10 10:54:37 simonm Exp $ + * + * getCurrentDirectory Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifndef PATH_MAX @@ -17,7 +18,7 @@ #endif StgAddr -getCurrentDirectory(STG_NO_ARGS) +getCurrentDirectory(void) { char *pwd; int alloc; @@ -44,5 +45,3 @@ getCurrentDirectory(STG_NO_ARGS) } return (StgAddr) pwd; } - -\end{code} diff --git a/ghc/lib/std/cbits/getDirectoryContents.lc b/ghc/lib/std/cbits/getDirectoryContents.c similarity index 90% rename from ghc/lib/std/cbits/getDirectoryContents.lc rename to ghc/lib/std/cbits/getDirectoryContents.c index 025aae9..d51f760 100644 --- a/ghc/lib/std/cbits/getDirectoryContents.lc +++ b/ghc/lib/std/cbits/getDirectoryContents.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[getDirectoryContents.lc]{getDirectoryContents Runtime Support} - -\begin{code} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: getDirectoryContents.c,v 1.1 1998/04/10 10:54:38 simonm Exp $ + * + * getDirectoryContents Runtime Support + */ -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -44,8 +45,7 @@ freeEntries(char **entries, int count) */ StgAddr -getDirectoryContents(path) -StgByteArray path; +getDirectoryContents(StgByteArray path) { struct stat sb; DIR *dir; @@ -120,5 +120,3 @@ StgByteArray path; } } } - -\end{code} diff --git a/ghc/lib/std/cbits/getLock.lc b/ghc/lib/std/cbits/getLock.c similarity index 87% rename from ghc/lib/std/cbits/getLock.lc rename to ghc/lib/std/cbits/getLock.c index 1ed0dbf..c2b4762 100644 --- a/ghc/lib/std/cbits/getLock.lc +++ b/ghc/lib/std/cbits/getLock.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[getLock.lc]{stdin/stout/stderr Runtime Support} - -\begin{code} - -#include "rtsdefs.h" +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: getLock.c,v 1.1 1998/04/10 10:54:39 simonm Exp $ + * + * stdin/stout/stderr Runtime Support + */ + +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -41,9 +42,7 @@ static int readLocks = 0; static int writeLocks = 0; int -lockFile(fd, exclusive) -int fd; -int exclusive; +lockFile(int fd, int exclusive) { int i; struct stat sb; @@ -86,8 +85,7 @@ int exclusive; } int -unlockFile(fd) -int fd; +unlockFile(int fd) { int i, rc; @@ -111,9 +109,7 @@ int fd; } StgInt -getLock(fp, exclusive) -StgForeignObj fp; -StgInt exclusive; +getLock(StgAddr fp, StgInt exclusive) { if (lockFile(fileno((FILE *) fp), exclusive) < 0) { if (errno == EBADF) @@ -137,4 +133,3 @@ StgInt exclusive; return 1; } -\end{code} diff --git a/ghc/lib/std/cbits/inputReady.lc b/ghc/lib/std/cbits/inputReady.c similarity index 91% rename from ghc/lib/std/cbits/inputReady.lc rename to ghc/lib/std/cbits/inputReady.c index 8baa582..e987e5a 100644 --- a/ghc/lib/std/cbits/inputReady.lc +++ b/ghc/lib/std/cbits/inputReady.c @@ -1,16 +1,17 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[inputReady.lc]{hReady Runtime Support} - -\begin{code} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: inputReady.c,v 1.1 1998/04/10 10:54:40 simonm Exp $ + * + * hReady Runtime Support + */ /* select and supporting types is not */ #ifndef _AIX #define NON_POSIX_SOURCE #endif -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -36,9 +37,7 @@ #endif StgInt -inputReady(fp, nsecs) -StgForeignObj fp; -StgInt nsecs; +inputReady(StgAddr fp, StgInt nsecs) { int flags, c, fd, maxfd, ready; fd_set rfd; @@ -122,5 +121,3 @@ StgInt nsecs; return 1; */ } - -\end{code} diff --git a/ghc/lib/std/cbits/openFile.lc b/ghc/lib/std/cbits/openFile.c similarity index 94% rename from ghc/lib/std/cbits/openFile.lc rename to ghc/lib/std/cbits/openFile.c index 4b92aca..d203bbb 100644 --- a/ghc/lib/std/cbits/openFile.lc +++ b/ghc/lib/std/cbits/openFile.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[openFile.lc]{openFile Runtime Support} - -\begin{code} - -#include "rtsdefs.h" +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: openFile.c,v 1.1 1998/04/10 10:54:42 simonm Exp $ + * + * openFile Runtime Support + */ + +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -25,9 +26,7 @@ #endif StgAddr -openFile(file, how) -StgByteArray file; -StgByteArray how; +openFile(StgByteArray file, StgByteArray how) { FILE *fp; int fd; @@ -56,7 +55,7 @@ StgByteArray how; break; default: fprintf(stderr, "openFile: unknown mode `%s'\n", how); - EXIT(EXIT_FAILURE); + exit(EXIT_FAILURE); } /* First try to open without creating */ @@ -213,5 +212,3 @@ StgByteArray how; return (StgAddr) fp; } - -\end{code} diff --git a/ghc/lib/std/cbits/readFile.lc b/ghc/lib/std/cbits/readFile.c similarity index 79% rename from ghc/lib/std/cbits/readFile.lc rename to ghc/lib/std/cbits/readFile.c index 0cc9c2c..2ae839c 100644 --- a/ghc/lib/std/cbits/readFile.lc +++ b/ghc/lib/std/cbits/readFile.c @@ -1,20 +1,18 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[readFile.lc]{hGetContents Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: readFile.c,v 1.1 1998/04/10 10:54:43 simonm Exp $ + * + * hGetContents Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #define EOT 4 StgInt -readBlock(buf, fp, size) -StgAddr buf; -StgForeignObj fp; -StgInt size; +readBlock(StgAddr buf, StgAddr fp, StgInt size) { int count; @@ -41,10 +39,7 @@ StgInt size; } StgInt -readLine(buf, fp, size) -StgAddr buf; -StgForeignObj fp; -StgInt size; +readLine(StgAddr buf, StgAddr fp, StgInt size) { if (feof((FILE *) fp)) { ghc_errtype = ERR_EOF; @@ -69,8 +64,7 @@ StgInt size; } StgInt -readChar(fp) -StgForeignObj fp; +readChar(StgAddr fp) { int c; @@ -98,5 +92,3 @@ StgForeignObj fp; else return c; } - -\end{code} diff --git a/ghc/lib/std/cbits/removeDirectory.lc b/ghc/lib/std/cbits/removeDirectory.c similarity index 77% rename from ghc/lib/std/cbits/removeDirectory.lc rename to ghc/lib/std/cbits/removeDirectory.c index 3347fd7..9eb5310 100644 --- a/ghc/lib/std/cbits/removeDirectory.lc +++ b/ghc/lib/std/cbits/removeDirectory.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[removeDirectory.lc]{removeDirectory Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: removeDirectory.c,v 1.1 1998/04/10 10:54:44 simonm Exp $ + * + * removeDirectory Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -17,8 +18,7 @@ #endif StgInt -removeDirectory(path) -StgByteArray path; +removeDirectory(StgByteArray path) { struct stat sb; @@ -53,5 +53,3 @@ StgByteArray path; } return 0; } - -\end{code} diff --git a/ghc/lib/std/cbits/removeFile.lc b/ghc/lib/std/cbits/removeFile.c similarity index 72% rename from ghc/lib/std/cbits/removeFile.lc rename to ghc/lib/std/cbits/removeFile.c index 095b621..12f2e99 100644 --- a/ghc/lib/std/cbits/removeFile.lc +++ b/ghc/lib/std/cbits/removeFile.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[removeFile.lc]{removeFile Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: removeFile.c,v 1.1 1998/04/10 10:54:45 simonm Exp $ + * + * removeFile Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -17,8 +18,7 @@ #endif StgInt -removeFile(path) -StgByteArray path; +removeFile(StgByteArray path) { struct stat sb; @@ -44,5 +44,3 @@ StgByteArray path; } return 0; } - -\end{code} diff --git a/ghc/lib/std/cbits/renameDirectory.lc b/ghc/lib/std/cbits/renameDirectory.c similarity index 69% rename from ghc/lib/std/cbits/renameDirectory.lc rename to ghc/lib/std/cbits/renameDirectory.c index 2a41186..95c3af1 100644 --- a/ghc/lib/std/cbits/renameDirectory.lc +++ b/ghc/lib/std/cbits/renameDirectory.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[renameDirectory.lc]{renameDirectory Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: renameDirectory.c,v 1.1 1998/04/10 10:54:47 simonm Exp $ + * + * renameDirectory Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -17,9 +18,7 @@ #endif StgInt -renameDirectory(opath, npath) -StgByteArray opath; -StgByteArray npath; +renameDirectory(StgByteArray opath, StgByteArray npath) { struct stat sb; @@ -45,4 +44,3 @@ StgByteArray npath; } return 0; } -\end{code} diff --git a/ghc/lib/std/cbits/renameFile.lc b/ghc/lib/std/cbits/renameFile.c similarity index 91% rename from ghc/lib/std/cbits/renameFile.lc rename to ghc/lib/std/cbits/renameFile.c index 2bcb9c0..c52d575 100644 --- a/ghc/lib/std/cbits/renameFile.lc +++ b/ghc/lib/std/cbits/renameFile.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[renameFile.lc]{renameFile Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: renameFile.c,v 1.1 1998/04/10 10:54:48 simonm Exp $ + * + * renameFile Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -21,9 +22,7 @@ #endif StgInt -renameFile(opath, npath) -StgByteArray opath; -StgByteArray npath; +renameFile(StgByteArray opath, StgByteArray npath) { struct stat sb; int fd; @@ -129,4 +128,3 @@ StgByteArray npath; close(fd); return 0; } -\end{code} diff --git a/ghc/lib/std/cbits/seekFile.lc b/ghc/lib/std/cbits/seekFile.c similarity index 88% rename from ghc/lib/std/cbits/seekFile.lc rename to ghc/lib/std/cbits/seekFile.c index 48c0cf7..2946fe2 100644 --- a/ghc/lib/std/cbits/seekFile.lc +++ b/ghc/lib/std/cbits/seekFile.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[seekFile.lc]{hSeek and hIsSeekable Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: seekFile.c,v 1.1 1998/04/10 10:54:49 simonm Exp $ + * + * hSeek and hIsSeekable Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -17,11 +18,7 @@ #endif StgInt -seekFile(fp, whence, size, d) -StgForeignObj fp; -StgInt whence; -StgInt size; -StgByteArray d; +seekFile(StgAddr fp, StgInt whence, StgInt size, StgByteArray d) { struct stat sb; long int offset; @@ -105,8 +102,7 @@ StgByteArray d; } StgInt -seekFileP(fp) -StgForeignObj fp; +seekFileP(StgAddr fp) { struct stat sb; @@ -128,8 +124,3 @@ StgForeignObj fp; return 0; } } - -\end{code} - - - diff --git a/ghc/lib/std/cbits/setBuffering.lc b/ghc/lib/std/cbits/setBuffering.c similarity index 89% rename from ghc/lib/std/cbits/setBuffering.lc rename to ghc/lib/std/cbits/setBuffering.c index 0169b50..b8cf413 100644 --- a/ghc/lib/std/cbits/setBuffering.lc +++ b/ghc/lib/std/cbits/setBuffering.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[setBuffering.lc]{hSetBuffering Runtime Support} - -\begin{code} - -#include "rtsdefs.h" +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: setBuffering.c,v 1.1 1998/04/10 10:54:51 simonm Exp $ + * + * hSetBuffering Runtime Support + */ + +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_TYPES_H @@ -29,9 +30,7 @@ #define SB_BB (-2) StgInt -setBuffering(fp, size) -StgForeignObj fp; -StgInt size; +setBuffering(StgAddr fp, StgInt size) { int flags; int input; @@ -119,5 +118,3 @@ StgInt size; } return 0; } - -\end{code} diff --git a/ghc/lib/std/cbits/setCurrentDirectory.c b/ghc/lib/std/cbits/setCurrentDirectory.c new file mode 100644 index 0000000..60fbdaf --- /dev/null +++ b/ghc/lib/std/cbits/setCurrentDirectory.c @@ -0,0 +1,23 @@ +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: setCurrentDirectory.c,v 1.1 1998/04/10 10:54:52 simonm Exp $ + * + * setCurrentDirectory Runtime Support + */ + +#include "Rts.h" +#include "stgio.h" + +StgInt +setCurrentDirectory(StgByteArray path) +{ + while (chdir(path) != 0) { + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return -1; + } + } + return 0; +} diff --git a/ghc/lib/std/cbits/setCurrentDirectory.lc b/ghc/lib/std/cbits/setCurrentDirectory.lc deleted file mode 100644 index 96fdf59..0000000 --- a/ghc/lib/std/cbits/setCurrentDirectory.lc +++ /dev/null @@ -1,25 +0,0 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[setCurrentDirectory.lc]{setCurrentDirectory Runtime Support} - -\begin{code} - -#include "rtsdefs.h" -#include "stgio.h" - -StgInt -setCurrentDirectory(path) -StgByteArray path; -{ - while (chdir(path) != 0) { - if (errno != EINTR) { - cvtErrno(); - stdErrno(); - return -1; - } - } - return 0; -} - -\end{code} diff --git a/ghc/lib/std/cbits/showTime.lc b/ghc/lib/std/cbits/showTime.c similarity index 83% rename from ghc/lib/std/cbits/showTime.lc rename to ghc/lib/std/cbits/showTime.c index 08adcd5..3e2bfd7 100644 --- a/ghc/lib/std/cbits/showTime.lc +++ b/ghc/lib/std/cbits/showTime.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[showTime.lc]{ClockTime.showsPrec Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: showTime.c,v 1.1 1998/04/10 10:54:53 simonm Exp $ + * + * ClockTime.showsPrec Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #if TIME_WITH_SYS_TIME @@ -48,4 +49,3 @@ showTime(I_ size, StgByteArray d, StgByteArray buf) return (StgAddr)buf; return (StgAddr)strcpy(buf, "ClockTime.show{LibTime}: internal error"); } -\end{code} diff --git a/ghc/lib/std/cbits/system.lc b/ghc/lib/std/cbits/system.c similarity index 86% rename from ghc/lib/std/cbits/system.lc rename to ghc/lib/std/cbits/system.c index 924c8d4..aff3a88 100644 --- a/ghc/lib/std/cbits/system.lc +++ b/ghc/lib/std/cbits/system.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[system.lc]{system Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: system.c,v 1.1 1998/04/10 10:54:55 simonm Exp $ + * + * system Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "stgio.h" #ifdef HAVE_SYS_WAIT_H @@ -21,8 +22,7 @@ #endif StgInt -systemCmd(cmd) -StgByteArray cmd; +systemCmd(StgByteArray cmd) { #if defined(cygwin32_TARGET_OS) /* The implementation of std. fork() has its problems @@ -77,5 +77,3 @@ StgByteArray cmd; return -1; #endif } - -\end{code} diff --git a/ghc/lib/std/cbits/toClockSec.lc b/ghc/lib/std/cbits/toClockSec.c similarity index 75% rename from ghc/lib/std/cbits/toClockSec.lc rename to ghc/lib/std/cbits/toClockSec.c index 3107ae3..3d4a5d1 100644 --- a/ghc/lib/std/cbits/toClockSec.lc +++ b/ghc/lib/std/cbits/toClockSec.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[toClockSec.lc]{toClockSec Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: toClockSec.c,v 1.1 1998/04/10 10:54:57 simonm Exp $ + * + * toClockSec Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "timezone.h" #include "stgio.h" @@ -38,4 +39,3 @@ toClockSec(I_ year, I_ mon, I_ mday, I_ hour, I_ min, I_ sec, I_ isdst, StgByteA *(time_t *)res = t; return res; } -\end{code} diff --git a/ghc/lib/std/cbits/toLocalTime.lc b/ghc/lib/std/cbits/toLocalTime.c similarity index 87% rename from ghc/lib/std/cbits/toLocalTime.lc rename to ghc/lib/std/cbits/toLocalTime.c index 11a1e30..6e775b7 100644 --- a/ghc/lib/std/cbits/toLocalTime.lc +++ b/ghc/lib/std/cbits/toLocalTime.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[toLocalTime.lc]{toCalendarTime Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: toLocalTime.c,v 1.1 1998/04/10 10:54:58 simonm Exp $ + * + * toCalendarTime Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "timezone.h" #include "stgio.h" @@ -64,4 +65,3 @@ toLocalTime(I_ size, StgByteArray d, StgByteArray res) return (StgAddr)res; } -\end{code} diff --git a/ghc/lib/std/cbits/toUTCTime.lc b/ghc/lib/std/cbits/toUTCTime.c similarity index 88% rename from ghc/lib/std/cbits/toUTCTime.lc rename to ghc/lib/std/cbits/toUTCTime.c index 86f449e..80c41a3 100644 --- a/ghc/lib/std/cbits/toUTCTime.lc +++ b/ghc/lib/std/cbits/toUTCTime.c @@ -1,11 +1,12 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[toUTCTime.lc]{toUTCTime Runtime Support} +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: toUTCTime.c,v 1.1 1998/04/10 10:54:59 simonm Exp $ + * + * toUTCTime Runtime Support + */ -\begin{code} - -#include "rtsdefs.h" +#include "Rts.h" #include "timezone.h" #include "stgio.h" @@ -69,4 +70,3 @@ toUTCTime(I_ size, StgByteArray d, StgByteArray res) return (StgAddr)res; } -\end{code} diff --git a/ghc/lib/std/cbits/writeFile.lc b/ghc/lib/std/cbits/writeFile.c similarity index 69% rename from ghc/lib/std/cbits/writeFile.lc rename to ghc/lib/std/cbits/writeFile.c index 80b946f..65e1f95 100644 --- a/ghc/lib/std/cbits/writeFile.lc +++ b/ghc/lib/std/cbits/writeFile.c @@ -1,18 +1,16 @@ -% -% (c) The GRASP/AQUA Project, Glasgow University, 1994 -% -\subsection[writeFile.lc]{hPutStr Runtime Support} - -\begin{code} - -#include "rtsdefs.h" +/* + * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 + * + * $Id: writeFile.c,v 1.1 1998/04/10 10:55:00 simonm Exp $ + * + * hPutStr Runtime Support + */ + +#include "Rts.h" #include "stgio.h" StgInt -writeFile(buf, fp, bytes) -StgAddr buf; -StgForeignObj fp; -StgInt bytes; +writeFile(StgAddr buf, StgAddr fp, StgInt bytes) { int count; char *p = (char *) buf; @@ -37,11 +35,7 @@ StgInt bytes; StgInt -writeBuf(fp, elt_sz, len, buf) -StgForeignObj fp; -StgWord elt_sz; -StgInt len; -StgAddr buf; +writeBuf(StgAddr fp, W_ elt_sz, I_ len, StgAddr buf) { int count; char *p = (char *) buf; @@ -63,5 +57,3 @@ StgAddr buf; return 0; } - -\end{code}