clean up the mess.
-/*
- * (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"
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[closeFile.lc]{hClose Runtime Support}
+
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
StgInt
-closeFile(StgAddr fp)
+closeFile(fp)
+StgForeignObj fp;
{
int rc;
return 0;
}
+\end{code}
+
-/*
- * (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}
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[createDirectory.lc]{createDirectory Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#endif
StgInt
-createDirectory(StgByteArray path)
+createDirectory(path)
+StgByteArray path;
{
int rc;
struct stat sb;
}
return 0;
}
+
+\end{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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[errno.lc]{GHC Error Number Conversion}
+
+\begin{code}
-#include "Rts.h"
+#include "rtsdefs.h"
#include "stgio.h"
int ghc_errno = 0;
/* Collect all of the grotty #ifdef's in one place. */
-void cvtErrno(void)
+void cvtErrno(STG_NO_ARGS)
{
switch(errno) {
#ifdef E2BIG
}
void
-stdErrno(void)
+stdErrno(STG_NO_ARGS)
{
switch(ghc_errno) {
default:
break;
}
}
+
+\end{code}
+++ /dev/null
-/*
- * (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
+++ /dev/null
-/*
- * (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;
-}
--- /dev/null
+%
+% (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}
+++ /dev/null
-/*
- * (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;
-}
--- /dev/null
+%
+% (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}
+++ /dev/null
-/*
- * (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;
-}
--- /dev/null
+%
+% (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}
-/*
- * (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"
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[filePosn.lc]{hGetPosn and hSetPosn Runtime Support}
+
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
StgInt
-getFilePosn(StgAddr fp)
+getFilePosn(fp)
+StgForeignObj fp;
{
StgInt posn;
/* The following is only called with a position that we've already visited */
StgInt
-setFilePosn(StgAddr fp, I_ posn)
+setFilePosn(fp, posn)
+StgForeignObj fp;
+StgInt posn;
{
while (fseek((FILE *) fp, posn, SEEK_SET) != 0) {
if (errno != EINTR) {
return 0;
}
+\end{code}
+
+
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[filePut.lc]{hPutChar Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#include "error.h"
StgInt
-filePutc(StgAddr fp, I_ c)
+filePutc(fp, c)
+StgForeignObj fp;
+StgInt c;
{
int rc;
return 0;
}
+
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[fileSize.lc]{hfileSize Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#endif
StgInt
-fileSize(StgAddr fp, StgByteArray result)
+fileSize(fp, result)
+StgForeignObj fp;
+StgByteArray result;
{
struct stat sb;
return -1;
}
}
+
+\end{code}
-/*
- * (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.
- */
-
-/*
+%
+%
+%
+
+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? )
-*/
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "ieee-flpt.h"
#include "floatExtreme.h"
#ifdef IEEE_FLOATING_POINT
StgInt
-isDoubleNaN(StgDouble d)
+isDoubleNaN(d)
+StgDouble d;
{
union { double d; int i[2]; } u;
int hx,lx;
}
StgInt
-isDoubleInfinite(StgDouble d)
+isDoubleInfinite(d)
+StgDouble d;
{
union { double d; int i[2]; } u;
int hx,lx;
}
StgInt
-isDoubleDenormalized(StgDouble d)
+isDoubleDenormalized(d)
+StgDouble d;
{
union { double d; int i[2]; } u;
int high, iexp;
}
StgInt
-isDoubleNegativeZero(StgDouble d)
+isDoubleNegativeZero(d)
+StgDouble d;
{
union { double d; int i[2]; } u;
int high, iexp;
/* Same tests, this time for StgFloats. */
StgInt
-isFloatNaN(StgFloat f)
+isFloatNaN(f)
+StgFloat f;
{
#if !defined(alpha_TARGET_OS)
/* StgFloat = double on alphas */
}
StgInt
-isFloatInfinite(StgFloat f)
+isFloatInfinite(f)
+StgFloat f;
{
#if !defined(alpha_TARGET_OS)
/* StgFloat = double on alphas */
}
StgInt
-isFloatDenormalized(StgFloat f)
+isFloatDenormalized(f)
+StgFloat f;
{
#if !defined(alpha_TARGET_OS)
/* StgFloat = double on alphas */
}
StgInt
-isFloatNegativeZero(StgFloat f)
+isFloatNegativeZero(f)
+StgFloat f;
{
#if !defined(alpha_TARGET_OS)
/* StgFloat = double on alphas */
StgInt isFloatNegativeZero(f) StgFloat f; { return 0; }
#endif
+
+
+\end{code}
+++ /dev/null
-/*
- * (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;
-}
--- /dev/null
+%
+% (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}
+
+
+
-/*
- * (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"
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1997
+%
+\subsection[freeFile.lc]{Giving up files}
+
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
/* sigh, the FILEs attached to the standard descriptors are
ForeignObj finaliser, as we probably want to use these
before we *really* shut down (dumping stats etc.)
*/
-void freeStdFile(StgAddr fp)
+void freeStdFile(fp)
+StgForeignObj fp;
{ return; }
-void freeFile(StgAddr fp)
+void freeFile(fp)
+StgForeignObj fp;
{
int rc;
return;
}
+\end{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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[getBufferMode.lc]{hIs...Buffered Runtime Support}
+
+\begin{code}
-#include "Rts.h"
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#define GBM_ERR (-3)
StgInt
-getBufferMode(StgAddr fp)
+getBufferMode(fp)
+StgForeignObj fp;
{
struct stat sb;
else
return GBM_BB;
}
+
+\end{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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[getCPUTime.lc]{getCPUTime Runtime Support}
+
+\begin{code}
#ifndef _AIX
#define NON_POSIX_SOURCE /*needed for solaris2 only?*/
#define _INCLUDE_HPUX_SOURCE
#endif
-#include "Rts.h"
+#include "rtsdefs.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
StgInt
-clockTicks (void)
+clockTicks ()
{
return (
#if defined(CLK_TCK)
return NULL;
# endif
#endif
- return (StgByteArray)cpuStruct;
+ return (StgByteArray) cpuStruct;
}
+
+\end{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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[getClockTime.lc]{getClockTime Runtime Support}
+
+\begin{code}
#ifndef _AIX
#define NON_POSIX_SOURCE /* gettimeofday */
#endif
-#include "Rts.h"
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_GETCLOCK
#endif
#endif
}
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[getCurrentDirectory.lc]{getCurrentDirectory Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifndef PATH_MAX
#endif
StgAddr
-getCurrentDirectory(void)
+getCurrentDirectory(STG_NO_ARGS)
{
char *pwd;
int alloc;
}
return (StgAddr) pwd;
}
+
+\end{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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[getDirectoryContents.lc]{getDirectoryContents Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
*/
StgAddr
-getDirectoryContents(StgByteArray path)
+getDirectoryContents(path)
+StgByteArray path;
{
struct stat sb;
DIR *dir;
}
}
}
+
+\end{code}
-/*
- * (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"
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[getLock.lc]{stdin/stout/stderr Runtime Support}
+
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
static int writeLocks = 0;
int
-lockFile(int fd, int exclusive)
+lockFile(fd, exclusive)
+int fd;
+int exclusive;
{
int i;
struct stat sb;
}
int
-unlockFile(int fd)
+unlockFile(fd)
+int fd;
{
int i, rc;
}
StgInt
-getLock(StgAddr fp, StgInt exclusive)
+getLock(fp, exclusive)
+StgForeignObj fp;
+StgInt exclusive;
{
if (lockFile(fileno((FILE *) fp), exclusive) < 0) {
if (errno == EBADF)
return 1;
}
+\end{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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[inputReady.lc]{hReady Runtime Support}
+
+\begin{code}
/* select and supporting types is not */
#ifndef _AIX
#define NON_POSIX_SOURCE
#endif
-#include "Rts.h"
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#endif
StgInt
-inputReady(StgAddr fp, StgInt nsecs)
+inputReady(fp, nsecs)
+StgForeignObj fp;
+StgInt nsecs;
{
int flags, c, fd, maxfd, ready;
fd_set rfd;
return 1;
*/
}
+
+\end{code}
-/*
- * (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"
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[openFile.lc]{openFile Runtime Support}
+
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#endif
StgAddr
-openFile(StgByteArray file, StgByteArray how)
+openFile(file, how)
+StgByteArray file;
+StgByteArray how;
{
FILE *fp;
int fd;
break;
default:
fprintf(stderr, "openFile: unknown mode `%s'\n", how);
- exit(EXIT_FAILURE);
+ EXIT(EXIT_FAILURE);
}
/* First try to open without creating */
return (StgAddr) fp;
}
+
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[readFile.lc]{hGetContents Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#define EOT 4
StgInt
-readBlock(StgAddr buf, StgAddr fp, StgInt size)
+readBlock(buf, fp, size)
+StgAddr buf;
+StgForeignObj fp;
+StgInt size;
{
int count;
}
StgInt
-readLine(StgAddr buf, StgAddr fp, StgInt size)
+readLine(buf, fp, size)
+StgAddr buf;
+StgForeignObj fp;
+StgInt size;
{
if (feof((FILE *) fp)) {
ghc_errtype = ERR_EOF;
}
StgInt
-readChar(StgAddr fp)
+readChar(fp)
+StgForeignObj fp;
{
int c;
else
return c;
}
+
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[removeDirectory.lc]{removeDirectory Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#endif
StgInt
-removeDirectory(StgByteArray path)
+removeDirectory(path)
+StgByteArray path;
{
struct stat sb;
}
return 0;
}
+
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[removeFile.lc]{removeFile Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#endif
StgInt
-removeFile(StgByteArray path)
+removeFile(path)
+StgByteArray path;
{
struct stat sb;
}
return 0;
}
+
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[renameDirectory.lc]{renameDirectory Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#endif
StgInt
-renameDirectory(StgByteArray opath, StgByteArray npath)
+renameDirectory(opath, npath)
+StgByteArray opath;
+StgByteArray npath;
{
struct stat sb;
}
return 0;
}
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[renameFile.lc]{renameFile Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#endif
StgInt
-renameFile(StgByteArray opath, StgByteArray npath)
+renameFile(opath, npath)
+StgByteArray opath;
+StgByteArray npath;
{
struct stat sb;
int fd;
close(fd);
return 0;
}
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[seekFile.lc]{hSeek and hIsSeekable Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#endif
StgInt
-seekFile(StgAddr fp, StgInt whence, StgInt size, StgByteArray d)
+seekFile(fp, whence, size, d)
+StgForeignObj fp;
+StgInt whence;
+StgInt size;
+StgByteArray d;
{
struct stat sb;
long int offset;
}
StgInt
-seekFileP(StgAddr fp)
+seekFileP(fp)
+StgForeignObj fp;
{
struct stat sb;
return 0;
}
}
+
+\end{code}
+
+
+
-/*
- * (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"
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[setBuffering.lc]{hSetBuffering Runtime Support}
+
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_TYPES_H
#define SB_BB (-2)
StgInt
-setBuffering(StgAddr fp, StgInt size)
+setBuffering(fp, size)
+StgForeignObj fp;
+StgInt size;
{
int flags;
int input;
}
return 0;
}
+
+\end{code}
+++ /dev/null
-/*
- * (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;
-}
--- /dev/null
+%
+% (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}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[showTime.lc]{ClockTime.showsPrec Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#if TIME_WITH_SYS_TIME
return (StgAddr)buf;
return (StgAddr)strcpy(buf, "ClockTime.show{LibTime}: internal error");
}
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[system.lc]{system Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
#ifdef HAVE_SYS_WAIT_H
#endif
StgInt
-systemCmd(StgByteArray cmd)
+systemCmd(cmd)
+StgByteArray cmd;
{
#if defined(cygwin32_TARGET_OS)
/* The implementation of std. fork() has its problems
return -1;
#endif
}
+
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[toClockSec.lc]{toClockSec Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "timezone.h"
#include "stgio.h"
*(time_t *)res = t;
return res;
}
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[toLocalTime.lc]{toCalendarTime Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "timezone.h"
#include "stgio.h"
return (StgAddr)res;
}
+\end{code}
-/*
- * (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
- */
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+\subsection[toUTCTime.lc]{toUTCTime Runtime Support}
-#include "Rts.h"
+\begin{code}
+
+#include "rtsdefs.h"
#include "timezone.h"
#include "stgio.h"
return (StgAddr)res;
}
+\end{code}
-/*
- * (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"
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1994
+%
+\subsection[writeFile.lc]{hPutStr Runtime Support}
+
+\begin{code}
+
+#include "rtsdefs.h"
#include "stgio.h"
StgInt
-writeFile(StgAddr buf, StgAddr fp, StgInt bytes)
+writeFile(buf, fp, bytes)
+StgAddr buf;
+StgForeignObj fp;
+StgInt bytes;
{
int count;
char *p = (char *) buf;
StgInt
-writeBuf(StgAddr fp, W_ elt_sz, I_ len, StgAddr buf)
+writeBuf(fp, elt_sz, len, buf)
+StgForeignObj fp;
+StgWord elt_sz;
+StgInt len;
+StgAddr buf;
{
int count;
char *p = (char *) buf;
return 0;
}
+
+\end{code}