2769e808cb0a58962e91d39fce589d1f3c80f6cf
[ghc-hetmet.git] / ghc / lib / std / cbits / stgio.h
1 #ifndef STGIO_H
2 #define STGIO_H
3
4 #include "fileObject.h"
5
6 /* Decls for routines in ghc/lib/cbits/ only used there.
7  * This file is used when compiling the Haskell library
8  * that _ccalls_ those routines; and when compiling those
9  * routines (to check consistency).
10  */
11
12 /* closeFile.lc */
13 StgAddr allocMemory__ PROTO((StgInt));
14
15 /* closeFile.lc */
16 StgInt closeFile PROTO((StgForeignObj,StgInt));
17
18 /* createDirectory.lc */
19 StgInt createDirectory PROTO((StgByteArray));
20
21 /* directoryAux.lc */
22 StgAddr openDir__ PROTO((StgByteArray));
23 StgAddr readDir__ PROTO((StgAddr));
24
25 /* echoAux.lc */
26 StgInt setTerminalEcho PROTO((StgForeignObj, StgInt));
27 StgInt getTerminalEcho PROTO((StgForeignObj));
28 StgInt isTerminalDevice PROTO((StgForeignObj));
29
30 /* env.lc */
31 char *  strDup          PROTO((const char *));
32 int     setenviron      PROTO((char **));
33 int     copyenv         (STG_NO_ARGS);
34 int     _setenv         PROTO((char *));
35 int     delenv          PROTO((char *));
36
37 /* errno.lc */
38 extern  int ghc_errno;
39 extern  int ghc_errtype;
40 void    cvtErrno(STG_NO_ARGS);
41 void    stdErrno(STG_NO_ARGS);
42 StgAddr getErrStr__(STG_NO_ARGS);
43 StgInt  getErrNo__(STG_NO_ARGS);
44 StgInt  getErrType__(STG_NO_ARGS);
45
46 /* execvpe.lc */
47 int     execvpe PROTO((char *, char **, char **));
48
49 /* fileEOF.lc */
50 StgInt  fileEOF PROTO((StgForeignObj));
51 /* fileGetc.lc */
52 StgInt  fileGetc PROTO((StgForeignObj));
53
54 /* fileLookAhead.lc */
55 StgInt  fileLookAhead PROTO((StgForeignObj));
56 StgInt  ungetChar PROTO((StgForeignObj,StgChar));
57
58 /* fileObject.lc */
59 void    setBufFlags PROTO((StgForeignObj, StgInt));
60 void    setBufWPtr  PROTO((StgForeignObj, StgInt));
61 StgInt  getBufWPtr  PROTO((StgForeignObj));
62 void    setBuf      PROTO((StgForeignObj, StgAddr, StgInt));
63 StgAddr getBuf      PROTO((StgForeignObj));
64 StgAddr getWriteableBuf PROTO((StgForeignObj));
65 StgAddr getBufStart PROTO((StgForeignObj,StgInt));
66 StgInt  getBufSize  PROTO((StgForeignObj));
67 void    setFilePtr  PROTO((StgForeignObj, StgAddr));
68 StgAddr getFilePtr  PROTO((StgForeignObj));
69 void    setConnectedTo  PROTO((StgForeignObj, StgForeignObj, StgInt));
70 void    setPushbackBufSize PROTO((StgInt));
71 StgInt  getPushbackBufSize (STG_NO_ARGS);
72 void    setNonBlockingIOFlag__ PROTO((StgForeignObj));
73 void    clearNonBlockingIOFlag__ PROTO((StgForeignObj));
74 void    setConnNonBlockingIOFlag__ PROTO((StgForeignObj));
75 void    clearConnNonBlockingIOFlag__ PROTO((StgForeignObj));
76 StgInt  getFileFd  PROTO((StgForeignObj));
77 StgInt  getConnFileFd  PROTO((StgForeignObj));
78
79 /* filePosn.lc */
80 StgInt  getFilePosn PROTO((StgForeignObj));
81 StgInt  setFilePosn PROTO((StgForeignObj, StgInt));
82
83 /* filePutc.lc */
84 StgInt  filePutc    PROTO((StgForeignObj, StgChar));
85
86 /* fileSize.lc */
87 StgInt  fileSize    PROTO((StgForeignObj, StgByteArray));
88
89 /* flushFile.lc */
90 StgInt  flushFile   PROTO((StgForeignObj));
91 StgInt  flushBuffer PROTO((StgForeignObj));
92 StgInt  flushReadBuffer PROTO((StgForeignObj));
93 void    flushConnectedHandle PROTO((StgForeignObj));
94
95 /* freeFile.lc */
96 void freeStdFile PROTO((StgForeignObj));
97 void freeFile PROTO((StgForeignObj));
98 void freeStdFileObject PROTO((StgForeignObj));
99 void freeFileObject PROTO((StgForeignObj));
100
101 /* getBufferMode.lc */
102 StgInt  getBufferMode PROTO((StgForeignObj));
103
104 /* getClockTime.lc */
105 StgInt  getClockTime PROTO((StgByteArray, StgByteArray));
106 StgAddr showTime     PROTO((I_, StgByteArray, StgByteArray));
107 StgAddr toClockSec   PROTO((I_, I_, I_, I_, I_, I_, I_, StgByteArray));
108 StgAddr toLocalTime  PROTO((I_, StgByteArray, StgByteArray));
109 StgAddr toUTCTime    PROTO((I_, StgByteArray, StgByteArray));
110
111 /* getCPUTime.lc */
112 StgByteArray getCPUTime PROTO((StgByteArray));
113 StgInt clockTicks();
114
115 /* getCurrentDirectory.lc */
116 StgAddr getCurrentDirectory(STG_NO_ARGS);
117
118 /* getLock.lc */
119 int     lockFile    PROTO((int, int));
120 int     unlockFile  PROTO((int));
121 StgInt  getLock     PROTO((StgInt, StgInt));
122
123 /* inputReady.lc */
124 StgInt  inputReady  PROTO((StgForeignObj,StgInt));
125
126 /* openFile.lc */
127 IOFileObject* openFile    PROTO((StgByteArray, StgInt, StgInt, StgInt));
128 IOFileObject* openFd      PROTO((StgInt, StgInt, StgInt));
129 IOFileObject* openStdFile PROTO((StgInt, StgInt, StgInt));
130
131 /* readFile.lc */
132 StgInt  readBlock PROTO((StgForeignObj));
133 StgInt  readChunk PROTO((StgForeignObj,StgAddr,StgInt));
134 StgInt  readLine PROTO((StgForeignObj));
135 StgInt  readChar PROTO((StgForeignObj));
136
137 /* removeDirectory.lc */
138 StgInt removeDirectory PROTO((StgByteArray));
139
140 /* removeFile.lc */
141 StgInt removeFile PROTO((StgByteArray));
142
143 /* renameDirectory.lc */
144 StgInt renameDirectory PROTO((StgByteArray, StgByteArray));
145
146 /* renameFile.lc */
147 StgInt renameFile PROTO((StgByteArray, StgByteArray));
148
149 /* seekFile.lc */
150 StgInt  seekFile  PROTO((StgForeignObj, StgInt, StgInt, StgByteArray));
151 StgInt  seekFileP PROTO((StgForeignObj));
152
153 /* setBuffering.lc */
154 StgInt  setBuffering PROTO((StgForeignObj, StgInt));
155
156 /* setCurrentDirectory.lc */
157 StgInt setCurrentDirectory PROTO((StgByteArray));
158
159 /* showTime.lc */
160 StgAddr showTime PROTO((StgInt, StgByteArray, StgByteArray));
161
162 /* system.lc */
163 StgInt  systemCmd PROTO((StgByteArray));
164
165 /* toLocalTime.lc */
166 StgAddr toLocalTime PROTO((StgInt, StgByteArray, StgByteArray));
167
168 /* toUTCTime.lc */
169 StgAddr toUTCTime PROTO((StgInt, StgByteArray, StgByteArray));
170
171 /* toClockSec.lc */
172 StgAddr toClockSec PROTO((StgInt, StgInt, StgInt, StgInt, StgInt, StgInt, StgInt, StgByteArray));
173
174 /* writeError.lc */
175 void    writeErrString__ PROTO((StgAddr, StgByteArray, StgInt));
176 /* writeFile.lc */
177 StgInt  writeFile PROTO((StgAddr, StgForeignObj, StgInt));
178 StgInt  writeBuf  PROTO((StgForeignObj, StgAddr, StgInt));
179 StgInt  writeBufBA  PROTO((StgForeignObj, StgByteArray, StgInt));
180 StgInt  writeFileObject PROTO((StgForeignObj, StgInt));
181 StgInt  writeBuffer PROTO((StgForeignObj, StgInt));
182
183 #endif /* ! STGIO_H */