Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
4ee0f622
Commit
4ee0f622
authored
Dec 08, 1999
by
simonmar
Browse files
[project @ 1999-12-08 15:47:06 by simonmar]
misc ansification and -Wall cleanup
parent
9c370d69
Changes
14
Hide whitespace changes
Inline
Side-by-side
ghc/lib/std/Time.lhs
View file @
4ee0f622
...
...
@@ -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
...
...
ghc/lib/std/cbits/Makefile
View file @
4ee0f622
# $Id: Makefile,v 1.1
1
1999/12/0
7
15:4
9:53
simonmar Exp $
# $Id: Makefile,v 1.1
2
1999/12/0
8
15:4
7: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)
...
...
ghc/lib/std/cbits/fileGetc.c
View file @
4ee0f622
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: fileGetc.c,v 1.
4
1999/1
1/26 16:25:55
simonmar Exp $
* $Id: fileGetc.c,v 1.
5
1999/1
2/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
...
...
ghc/lib/std/cbits/fileLookAhead.c
View file @
4ee0f622
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: fileLookAhead.c,v 1.
4
1999/1
1/25 16:54:14
simonmar Exp $
* $Id: fileLookAhead.c,v 1.
5
1999/1
2/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);
...
...
ghc/lib/std/cbits/filePosn.c
View file @
4ee0f622
/*
* (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
;
/*
...
...
ghc/lib/std/cbits/filePutc.c
View file @
4ee0f622
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: filePutc.c,v 1.1
0
1999/1
1/26 16:25:56
simonmar Exp $
* $Id: filePutc.c,v 1.1
1
1999/1
2/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
;
...
...
ghc/lib/std/cbits/getLock.c
View file @
4ee0f622
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: getLock.c,v 1.
6
1999/
05
/0
5
1
0:33:16 sof
Exp $
* $Id: getLock.c,v 1.
7
1999/
12
/0
8
1
5: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
)
{
...
...
ghc/lib/std/cbits/inputReady.c
View file @
4ee0f622
/*
* (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
;
...
...
ghc/lib/std/cbits/openFile.c
View file @
4ee0f622
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: openFile.c,v 1.1
3
1999/12/08 1
4:04:32
simonmar Exp $
* $Id: openFile.c,v 1.1
4
1999/12/08 1
5: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
);
...
...
ghc/lib/std/cbits/readFile.c
View file @
4ee0f622
/*
* (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 */
...
...
ghc/lib/std/cbits/stgio.h
View file @
4ee0f622
/* -----------------------------------------------------------------------------
* $Id: stgio.h,v 1.1
5
1999/1
1/26 16:25:56
simonmar Exp $
* $Id: stgio.h,v 1.1
6
1999/1
2/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
);
...
...
ghc/lib/std/cbits/system.c
View file @
4ee0f622
/*
* (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
)
{
...
...
ghc/lib/std/cbits/timezone.c
View file @
4ee0f622
/*
* (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
);
}
...
...
ghc/lib/std/cbits/writeFile.c
View file @
4ee0f622
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: writeFile.c,v 1.1
1
1999/1
1/26 16:25:57
simonmar Exp $
* $Id: writeFile.c,v 1.1
2
1999/1
2/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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment