From: andy Date: Wed, 24 Nov 1999 09:32:30 +0000 (+0000) Subject: [project @ 1999-11-24 09:32:30 by andy] X-Git-Tag: Approximately_9120_patches~5502 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=43b39f96af3774f515124aa540bd0cf97c08bd6a;p=ghc-hetmet.git [project @ 1999-11-24 09:32:30 by andy] Fixes to allow compilation under cygwin and Win32. --- diff --git a/ghc/interpreter/nHandle.c b/ghc/interpreter/nHandle.c index c68ff3e..ecc5f8f 100644 --- a/ghc/interpreter/nHandle.c +++ b/ghc/interpreter/nHandle.c @@ -9,12 +9,15 @@ #include #include #include +#ifndef _WIN32 #include #include #include #include +#endif #include +#ifndef _WIN32 double nh_getCPUtime ( void ) { double usertime; @@ -30,10 +33,25 @@ double nh_getCPUprec ( void ) /* or perhaps CLOCKS_PER_SEC ? */ return 1.0 / (double)(CLK_TCK); } +#else +double nh_getCPUtime ( void ) +{ + return 1; +} + +double nh_getCPUprec ( void ) +{ + return 1; +} +#endif int nh_getPID ( void ) { +#ifndef _WIN32 return (int) getpid(); +#else + return (int) 0; +#endif } void nh_exitwith ( int code ) @@ -58,10 +76,15 @@ int nh_iseof ( FILE* f ) int nh_filesize ( FILE* f ) { +#ifndef _WIN32 struct stat buf; errno = 0; fstat ( fileno(f), &buf ); return buf.st_size; +#else + errno = EPERM; + return 0; +#endif } int nh_stdin ( void ) @@ -150,23 +173,3 @@ int nh_getenv ( int p ) return (int)getenv ( (const char *)p ); } -#if 0 -int prog_argc; -char** prog_argv; - -int nh_init_args ( int argc, char *argv[] ) -{ - prog_argc = argc; - prog_argv = argv; -} - -int nh_argc ( void ) -{ - return prog_argc; -} - -int nh_argvb ( int argno, int offset ) -{ - return prog_argv[argno][offset]; -} -#endif