From: partain Date: Sun, 30 Jun 1996 16:50:14 +0000 (+0000) Subject: [project @ 1996-06-30 16:44:25 by partain] X-Git-Tag: Approximately_1000_patches_recorded~900 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=c6c43e43be1f913cd90cb7cb5bb87e90e6552691;hp=063eda14b18aadc138bc27eb460e1af93b09ca9b;p=ghc-hetmet.git [project @ 1996-06-30 16:44:25 by partain] partain changes through 960629 --- diff --git a/configure.in b/configure.in index 3a57a3c..b799d4f 100644 --- a/configure.in +++ b/configure.in @@ -762,8 +762,12 @@ if echo $CPP | egrep gcc >/dev/null 2>&1; then echo > conftest.c gcc -v -E conftest.c >/dev/null 2>conftest.out echo '/(\S+\/cpp)/ && print "$1";' > conftest.pl - GNUCPP="`eval $PerlCmd -n conftest.pl conftest.out`" + # GNUCPP: used in jmake.c (GnuCppCmd) and in mkdependC + # (where we could do with the usual pre-#defines) + GNUCPP="gcc -E" test -n "$verbose" && echo " setting GNUCPP to $GNUCPP" + # RAWCPP: we do not want *any* pre-#defines... + # (e.g., hscpp, mkdependHS) RAWCPP="`eval $PerlCmd -n conftest.pl conftest.out` -traditional" test -n "$verbose" && echo " setting RAWCPP to $RAWCPP" rm -fr conftest* @@ -830,7 +834,7 @@ AC_HEADER_STDC # dnl ** check for specific header (.h) files that we are interested in # -AC_CHECK_HEADERS(dirent.h fcntl.h grp.h malloc.h memory.h nlist.h pwd.h siginfo.h signal.h stdlib.h string.h sys/fault.h sys/file.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/vadvise.h sys/wait.h termios.h time.h types.h unistd.h utime.h vfork.h ) +AC_CHECK_HEADERS(dirent.h fcntl.h grp.h malloc.h memory.h nlist.h pwd.h siginfo.h signal.h stdlib.h string.h sys/fault.h sys/file.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/vadvise.h sys/wait.h termios.h time.h types.h unistd.h utime.h vfork.h ) # dnl ** check if it is safe to include both and # @@ -878,49 +882,45 @@ char **argv; }], LeadingUnderscore='YES', LeadingUnderscore='NO', LeadingUnderscore='YES') test -n "$verbose" && echo " setting LeadingUnderscore to $LeadingUnderscore" -# ------------------------------------------------------------------------- -dnl -dnl * `GHC' CONFIGURATION STUFF - -if test "xxx$DoingGHC" = 'xxxghc' ; then -# a very big "if"! -# +dnl ------------------------------------------------------- dnl ** which builds to build? +dnl ** (applies to anything w/ libraries (ghc, hslibs, ???) +dnl ------------------------------------------------------- # builds: normal = sequential _ap_o ; _p = profiling (sequential); # _t = ticky; _u = unregisterized -GhcBuild_normal='YES' -GhcBuild_p='YES' -GhcBuild_t='NO' -GhcBuild_u='NO' +Build_normal='YES' +Build_p='YES' +Build_t='NO' +Build_u='NO' # _mc = concurrent; _mr = profiled concurrent; _mt = ticky concurrent # _mp = parallel; _mg = gransim -GhcBuild_mc='NO' -GhcBuild_mr='NO' -GhcBuild_mt='NO' -GhcBuild_mp='NO' -GhcBuild_mg='NO' +Build_mc='NO' +Build_mr='NO' +Build_mt='NO' +Build_mp='NO' +Build_mg='NO' # GC builds: _2s, _1s, _du (, _gn) -GhcBuild_2s='NO' -GhcBuild_1s='NO' -GhcBuild_du='NO' +Build_2s='NO' +Build_1s='NO' +Build_du='NO' # user builds: a...o -GhcBuild_a='NO' -GhcBuild_b='NO' -GhcBuild_c='NO' -GhcBuild_d='NO' -GhcBuild_e='NO' -GhcBuild_f='NO' -GhcBuild_g='NO' -GhcBuild_h='NO' -GhcBuild_i='NO' -GhcBuild_j='NO' -GhcBuild_k='NO' -GhcBuild_l='NO' -GhcBuild_m='NO' -GhcBuild_n='NO' -GhcBuild_o='NO' -GhcBuild_A='NO' -GhcBuild_B='NO' +Build_a='NO' +Build_b='NO' +Build_c='NO' +Build_d='NO' +Build_e='NO' +Build_f='NO' +Build_g='NO' +Build_h='NO' +Build_i='NO' +Build_j='NO' +Build_k='NO' +Build_l='NO' +Build_m='NO' +Build_n='NO' +Build_o='NO' +Build_A='NO' +Build_B='NO' # More could be added here... AC_ARG_ENABLE(normal-build, @@ -932,9 +932,9 @@ Choose all the \`builds' of GHC that you want: --disable-normal-build do *not* build GHC for normal sequential code], [case "$enableval" in - yes) GhcBuild_normal='YES' + yes) Build_normal='YES' ;; - no) GhcBuild_normal='NO' + no) Build_normal='NO' ;; *) echo "I don't understand this option: --enable-normal-build=$enableval" exit 1 @@ -944,9 +944,9 @@ Choose all the \`builds' of GHC that you want: AC_ARG_ENABLE(profiling, [--disable-profiling do *not* build profiling features], [case "$enableval" in - yes) GhcBuild_p='YES' + yes) Build_p='YES' ;; - no) GhcBuild_p='NO' + no) Build_p='NO' ;; *) echo "I don't understand this option: --enable-profiling=$enableval" exit 1 @@ -956,9 +956,9 @@ AC_ARG_ENABLE(profiling, AC_ARG_ENABLE(ticky, [--enable-ticky build for \`ticky-ticky' profiling (for implementors)], [case "$enableval" in - yes) GhcBuild_t='YES' + yes) Build_t='YES' ;; - no) GhcBuild_t='NO' + no) Build_t='NO' ;; *) echo "I don't understand this option: --enable-ticky=$enableval" exit 1 @@ -968,9 +968,9 @@ AC_ARG_ENABLE(ticky, AC_ARG_ENABLE(concurrent, [--enable-concurrent turn on \`concurrent Haskell' features], [case "$enableval" in - yes) GhcBuild_mc='YES' + yes) Build_mc='YES' ;; - no) GhcBuild_mc='NO' + no) Build_mc='NO' ;; *) echo "I don't understand this option: --enable-concurrent=$enableval" exit 1 @@ -980,9 +980,9 @@ AC_ARG_ENABLE(concurrent, AC_ARG_ENABLE(profiled-concurrent, [--enable-profiled-concurrent turn on profiling for \`concurrent Haskell'], [case "$enableval" in - yes) GhcBuild_mr='YES' + yes) Build_mr='YES' ;; - no) GhcBuild_mr='NO' + no) Build_mr='NO' ;; *) echo "I don't understand this option: --enable-profiled-concurrent=$enableval" exit 1 @@ -992,9 +992,9 @@ AC_ARG_ENABLE(profiled-concurrent, AC_ARG_ENABLE(ticky-concurrent, [--enable-ticky-concurrent turn on \`ticky-ticky' profiling for \`concurrent Haskell'], [case "$enableval" in - yes) GhcBuild_mt='YES' + yes) Build_mt='YES' ;; - no) GhcBuild_mt='NO' + no) Build_mt='NO' ;; *) echo "I don't understand this option: --enable-ticky-concurrent=$enableval" exit 1 @@ -1004,9 +1004,9 @@ AC_ARG_ENABLE(ticky-concurrent, AC_ARG_ENABLE(parallel, [--enable-parallel turn on \`parallel Haskell' features], [case "$enableval" in - yes) GhcBuild_mp='YES'; + yes) Build_mp='YES'; ;; - no) GhcBuild_mp='NO' + no) Build_mp='NO' ;; *) echo "I don't understand this option: --enable-parallel=$enableval" exit 1 @@ -1016,9 +1016,9 @@ AC_ARG_ENABLE(parallel, AC_ARG_ENABLE(gransim, [--enable-gransim turn on GranSim parallel simulator], [case "$enableval" in - yes) GhcBuild_mg='YES'; + yes) Build_mg='YES'; ;; - no) GhcBuild_mg='NO' + no) Build_mg='NO' ;; *) echo "I don't understand this option: --enable-gransim=$enableval" exit 1 @@ -1028,9 +1028,9 @@ AC_ARG_ENABLE(gransim, AC_ARG_ENABLE(gc-2s, [--enable-gc-2s a build with the 2-space copying garbage collector], [case "$enableval" in - yes) GhcBuild_2s='YES' + yes) Build_2s='YES' ;; - no) GhcBuild_2s='NO' + no) Build_2s='NO' ;; *) echo "I don't understand this option: --enable-gc-2s=$enableval" exit 1 @@ -1040,9 +1040,9 @@ AC_ARG_ENABLE(gc-2s, AC_ARG_ENABLE(gc-1s, [--enable-gc-1s a build with the 1-space compacting garbage collector], [case "$enableval" in - yes) GhcBuild_1s='YES' + yes) Build_1s='YES' ;; - no) GhcBuild_1s='NO' + no) Build_1s='NO' ;; *) echo "I don't understand this option: --enable-gc-1s=$enableval" exit 1 @@ -1052,9 +1052,9 @@ AC_ARG_ENABLE(gc-1s, AC_ARG_ENABLE(gc-du, [--enable-gc-du a build with \`dual-mode' (1s/2s) garbage collector], [case "$enableval" in - yes) GhcBuild_du='YES' + yes) Build_du='YES' ;; - no) GhcBuild_du='NO' + no) Build_du='NO' ;; *) echo "I don't understand this option: --enable-gc-du=$enableval" exit 1 @@ -1064,9 +1064,9 @@ AC_ARG_ENABLE(gc-du, AC_ARG_ENABLE(user-way-a, [--enable-user-way-a build for \`user way a' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_a='YES' + yes) Build_a='YES' ;; - no) GhcBuild_a='NO' + no) Build_a='NO' ;; *) echo "I don't understand this option: --enable-user-way-a=$enableval" exit 1 @@ -1076,9 +1076,9 @@ AC_ARG_ENABLE(user-way-a, AC_ARG_ENABLE(user-way-b, [--enable-user-way-b build for \`user way b' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_b='YES' + yes) Build_b='YES' ;; - no) GhcBuild_b='NO' + no) Build_b='NO' ;; *) echo "I don't understand this option: --enable-user-way-b=$enableval" exit 1 @@ -1088,9 +1088,9 @@ AC_ARG_ENABLE(user-way-b, AC_ARG_ENABLE(user-way-c, [--enable-user-way-c build for \`user way c' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_c='YES' + yes) Build_c='YES' ;; - no) GhcBuild_c='NO' + no) Build_c='NO' ;; *) echo "I don't understand this option: --enable-user-way-c=$enableval" exit 1 @@ -1100,9 +1100,9 @@ AC_ARG_ENABLE(user-way-c, AC_ARG_ENABLE(user-way-d, [--enable-user-way-d build for \`user way d' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_d='YES' + yes) Build_d='YES' ;; - no) GhcBuild_d='NO' + no) Build_d='NO' ;; *) echo "I don't understand this option: --enable-user-way-d=$enableval" exit 1 @@ -1112,9 +1112,9 @@ AC_ARG_ENABLE(user-way-d, AC_ARG_ENABLE(user-way-e, [--enable-user-way-e build for \`user way e' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_e='YES' + yes) Build_e='YES' ;; - no) GhcBuild_e='NO' + no) Build_e='NO' ;; *) echo "I don't understand this option: --enable-user-way-e=$enableval" exit 1 @@ -1124,9 +1124,9 @@ AC_ARG_ENABLE(user-way-e, AC_ARG_ENABLE(user-way-f, [--enable-user-way-f build for \`user way f' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_f='YES' + yes) Build_f='YES' ;; - no) GhcBuild_f='NO' + no) Build_f='NO' ;; *) echo "I don't understand this option: --enable-user-way-f=$enableval" exit 1 @@ -1136,9 +1136,9 @@ AC_ARG_ENABLE(user-way-f, AC_ARG_ENABLE(user-way-g, [--enable-user-way-g build for \`user way g' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_g='YES' + yes) Build_g='YES' ;; - no) GhcBuild_g='NO' + no) Build_g='NO' ;; *) echo "I don't understand this option: --enable-user-way-g=$enableval" exit 1 @@ -1148,9 +1148,9 @@ AC_ARG_ENABLE(user-way-g, AC_ARG_ENABLE(user-way-h, [--enable-user-way-h build for \`user way h' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_h='YES' + yes) Build_h='YES' ;; - no) GhcBuild_h='NO' + no) Build_h='NO' ;; *) echo "I don't understand this option: --enable-user-way-h=$enableval" exit 1 @@ -1160,9 +1160,9 @@ AC_ARG_ENABLE(user-way-h, AC_ARG_ENABLE(user-way-i, [--enable-user-way-i build for \`user way i' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_i='YES' + yes) Build_i='YES' ;; - no) GhcBuild_i='NO' + no) Build_i='NO' ;; *) echo "I don't understand this option: --enable-user-way-i=$enableval" exit 1 @@ -1172,9 +1172,9 @@ AC_ARG_ENABLE(user-way-i, AC_ARG_ENABLE(user-way-j, [--enable-user-way-j build for \`user way j' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_j='YES' + yes) Build_j='YES' ;; - no) GhcBuild_j='NO' + no) Build_j='NO' ;; *) echo "I don't understand this option: --enable-user-way-j=$enableval" exit 1 @@ -1184,9 +1184,9 @@ AC_ARG_ENABLE(user-way-j, AC_ARG_ENABLE(user-way-k, [--enable-user-way-k build for \`user way k' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_k='YES' + yes) Build_k='YES' ;; - no) GhcBuild_k='NO' + no) Build_k='NO' ;; *) echo "I don't understand this option: --enable-user-way-k=$enableval" exit 1 @@ -1196,9 +1196,9 @@ AC_ARG_ENABLE(user-way-k, AC_ARG_ENABLE(user-way-l, [--enable-user-way-l build for \`user way l' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_l='YES' + yes) Build_l='YES' ;; - no) GhcBuild_l='NO' + no) Build_l='NO' ;; *) echo "I don't understand this option: --enable-user-way-l=$enableval" exit 1 @@ -1208,9 +1208,9 @@ AC_ARG_ENABLE(user-way-l, AC_ARG_ENABLE(user-way-m, [--enable-user-way-m build for \`user way m' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_m='YES' + yes) Build_m='YES' ;; - no) GhcBuild_m='NO' + no) Build_m='NO' ;; *) echo "I don't understand this option: --enable-user-way-m=$enableval" exit 1 @@ -1220,9 +1220,9 @@ AC_ARG_ENABLE(user-way-m, AC_ARG_ENABLE(user-way-n, [--enable-user-way-n build for \`user way n' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_n='YES' + yes) Build_n='YES' ;; - no) GhcBuild_n='NO' + no) Build_n='NO' ;; *) echo "I don't understand this option: --enable-user-way-n=$enableval" exit 1 @@ -1232,9 +1232,9 @@ AC_ARG_ENABLE(user-way-n, AC_ARG_ENABLE(user-way-o, [--enable-user-way-o build for \`user way o' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_o='YES' + yes) Build_o='YES' ;; - no) GhcBuild_o='NO' + no) Build_o='NO' ;; *) echo "I don't understand this option: --enable-user-way-o=$enableval" exit 1 @@ -1244,9 +1244,9 @@ AC_ARG_ENABLE(user-way-o, AC_ARG_ENABLE(user-way-A, [--enable-user-way-A build for \`user way A' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_A='YES' + yes) Build_A='YES' ;; - no) GhcBuild_A='NO' + no) Build_A='NO' ;; *) echo "I don't understand this option: --enable-user-way-A=$enableval" exit 1 @@ -1256,49 +1256,26 @@ AC_ARG_ENABLE(user-way-A, AC_ARG_ENABLE(user-way-B, [--enable-user-way-B build for \`user way B' (mostly for implementors)], [case "$enableval" in - yes) GhcBuild_B='YES' + yes) Build_B='YES' ;; - no) GhcBuild_B='NO' + no) Build_B='NO' ;; *) echo "I don't understand this option: --enable-user-way-B=$enableval" exit 1 ;; esac]) -dnl We do not use AC_SUBST to communicate the GhcBuild_* info, +dnl We do not use AC_SUBST to communicate the Build_* info, dnl as some seds (notably OSF) only allow 99 commands (!!!). dnl We will do the equivalent by a HACK further down. -dnl AC_SUBST(GhcBuild_normal) -dnl AC_SUBST(GhcBuild_p) -dnl AC_SUBST(GhcBuild_t) -dnl AC_SUBST(GhcBuild_u) -dnl AC_SUBST(GhcBuild_mc) -dnl AC_SUBST(GhcBuild_mr) -dnl AC_SUBST(GhcBuild_mt) -dnl AC_SUBST(GhcBuild_mp) -dnl AC_SUBST(GhcBuild_mg) -dnl AC_SUBST(GhcBuild_2s) -dnl AC_SUBST(GhcBuild_1s) -dnl AC_SUBST(GhcBuild_du) -dnl AC_SUBST(GhcBuild_a) -dnl AC_SUBST(GhcBuild_b) -dnl AC_SUBST(GhcBuild_c) -dnl AC_SUBST(GhcBuild_d) -dnl AC_SUBST(GhcBuild_e) -dnl AC_SUBST(GhcBuild_f) -dnl AC_SUBST(GhcBuild_g) -dnl AC_SUBST(GhcBuild_h) -dnl AC_SUBST(GhcBuild_i) -dnl AC_SUBST(GhcBuild_j) -dnl AC_SUBST(GhcBuild_k) -dnl AC_SUBST(GhcBuild_l) -dnl AC_SUBST(GhcBuild_m) -dnl AC_SUBST(GhcBuild_n) -dnl AC_SUBST(GhcBuild_o) -dnl AC_SUBST(GhcBuild_A) -dnl AC_SUBST(GhcBuild_B) +# ------------------------------------------------------------------------- +dnl +dnl * `GHC' CONFIGURATION STUFF +if test "xxx$DoingGHC" = 'xxxghc' ; then +# a very big "if"! +# #--------------------------------------------------------------- # dnl ** which Haskell compiler to bootstrap GHC with? @@ -1399,9 +1376,9 @@ fi AC_SUBST(GhcWithRegisterised) if test $GhcWithRegisterised = 'NO'; then - GhcBuild_u='YES' - GhcBuild_normal='NO' - GhcBuild_p='NO' + Build_u='YES' + Build_normal='NO' + Build_p='NO' fi # ToDo: make sure we can do concurrent for platform/circs... # ToDo: make sure we can do profiling for platform/circs... @@ -1535,22 +1512,7 @@ AC_ARG_ENABLE(sockets-library, esac]) AC_SUBST(GhcWithSockets) -dnl ** build the interpreter? -BuildGHCI='NO' -AC_ARG_ENABLE(ghci, - [--enable-ghci build Glasgow Haskell interpreter (HACKERS ONLY)], - [case "$enableval" in - yes) BuildGHCI='YES' - ;; - no) BuildGHCI='NO' - ;; - *) echo "I don't understand this option: --enable-ghci=$enableval" - exit 1 - ;; - esac]) -AC_SUBST(BuildGHCI) - -# Here, by HACK means, we dump all the GhcBuild_ info +# Here, by HACK means, we dump all the Build_ info # into a file. See comment above. rm -f ghc/mkworld/buildinfo.jm echo creating ghc/mkworld/buildinfo.jm @@ -1560,10 +1522,10 @@ XCOMM This file is obliterated every time 'configure' is run! EOF for xx in normal p t u mc mr mt mp mg 2s 1s du a b c d e f g h i j k l m n o A B ; do - eval "yy=\$GhcBuild_$xx" - echo "#ifndef GhcBuild_$xx" >> ghc/mkworld/buildinfo.jm - echo "#define GhcBuild_$xx $yy" >> ghc/mkworld/buildinfo.jm - echo "#endif" >> ghc/mkworld/buildinfo.jm + eval "yy=\$Build_$xx" + echo "#ifndef Build_$xx" >> ghc/mkworld/buildinfo.jm + echo "#define Build_$xx $yy" >> ghc/mkworld/buildinfo.jm + echo "#endif" >> ghc/mkworld/buildinfo.jm done # here ends a very big if DoingGHC = 'ghc' ... @@ -1625,7 +1587,7 @@ esac AC_SUBST(WithHsLibsHc) AC_SUBST(WithHsLibsHcType) -# Here, by HACK means, we dump all the GhcBuild_ info +# Here, by HACK means, we dump all the Build_ info # into a file. See comment above. rm -f hslibs/mkworld/buildinfo.jm echo creating hslibs/mkworld/buildinfo.jm @@ -1634,13 +1596,12 @@ XCOMM ** DO NOT EDIT! ** XCOMM This file is obliterated every time 'configure' is run! EOF -dnl Do not really know what to put here: -dnl for xx in normal p t u mc mr mt mp mg 2s 1s du a b c d e f g h i j k l m n o A B ; do -dnl eval "yy=\$GhcBuild_$xx" -dnl echo "#ifndef GhcBuild_$xx" >> ghc/mkworld/buildinfo.jm -dnl echo "#define GhcBuild_$xx $yy" >> ghc/mkworld/buildinfo.jm -dnl echo "#endif" >> ghc/mkworld/buildinfo.jm -dnl done +for xx in normal p t u mc mr mt mp mg 2s 1s du a b c d e f g h i j k l m n o A B ; do + eval "yy=\$Build_$xx" + echo "#ifndef Build_$xx" >> hslibs/mkworld/buildinfo.jm + echo "#define Build_$xx $yy" >> hslibs/mkworld/buildinfo.jm + echo "#endif" >> hslibs/mkworld/buildinfo.jm +done # here ends a very big if DoingHsLibs = 'hslibs' ... fi @@ -1783,6 +1744,8 @@ esac AC_SUBST(WithHaggisHc) AC_SUBST(WithHaggisHcType) +# builds stuff?? ToDo + # here ends a very big if DoingHaggis = 'haggis' ... fi # @@ -2071,6 +2034,22 @@ for xx in Real Spectral Imaginary GHC_ONLY Specialise PRIVATE Parallel ; do echo "#endif" >> nofib/mkworld/buildinfo.jm done +# Here, by HACK means, we dump all the Build_ info +# into a file. See comment above. +rm -f nofib/mkworld/buildinfo.jm +echo creating nofib/mkworld/buildinfo.jm +cat > nofib/mkworld/buildinfo.jm <> nofib/mkworld/buildinfo.jm + echo "#define Build_$xx $yy" >> nofib/mkworld/buildinfo.jm + echo "#endif" >> nofib/mkworld/buildinfo.jm +done + # here ends a very big if DoingNoFib = 'nofib' ... fi # diff --git a/ghc/docs/install_guide/installing.lit b/ghc/docs/install_guide/installing.lit index 5cdd189..69e4427 100644 --- a/ghc/docs/install_guide/installing.lit +++ b/ghc/docs/install_guide/installing.lit @@ -1,5 +1,5 @@ % -% $Header: /srv/cvs/cvs.haskell.org/fptools/ghc/docs/install_guide/Attic/installing.lit,v 1.2 1996/06/27 15:57:32 partain Exp $ +% $Header: /srv/cvs/cvs.haskell.org/fptools/ghc/docs/install_guide/Attic/installing.lit,v 1.3 1996/06/30 16:45:00 partain Exp $ % \begin{onlystandalone} \documentstyle[11pt,literate]{article} @@ -1800,11 +1800,11 @@ probably best to send email to us, asking how. %$$ To create a ``user way'' or setup, put %$$ something like this somewhere (more on ``somewhere'', below): %$$ \begin{verbatim} -%$$ #ifndef GhcBuild_UserWay_a -%$$ #define GhcBuild_UserWay_a YES +%$$ #ifndef Build_UserWay_a +%$$ #define Build_UserWay_a YES %$$ GHC_USER_WAY_FLAG_a = -ticky %$$ GHC_USER_WAY_OPTS_a = -fstg-reduction-counts -O -%$$ #endif /* ! GhcBuild_UserWay_a */ +%$$ #endif /* ! Build_UserWay_a */ %$$ \end{verbatim} %$$ You'll be able to invoke the driver with a \tr{-ticky} option, which %$$ will be as if you typed in all that other stuff. It will also arrange diff --git a/ghc/docs/users_guide/glasgow_exts.lit b/ghc/docs/users_guide/glasgow_exts.lit index e480f8c..f09235b 100644 --- a/ghc/docs/users_guide/glasgow_exts.lit +++ b/ghc/docs/users_guide/glasgow_exts.lit @@ -249,11 +249,11 @@ For example, typedef unsigned long *StgMallocPtr; typedef long StgInt; -extern void initialiseEFS PROTO( (StgInt size) ); -extern StgInt terminateEFS (); -extern StgMallocPtr emptyEFS(); -extern StgMallocPtr updateEFS PROTO( (StgMallocPtr a, StgInt i, StgInt x) ); -extern StgInt lookupEFS PROTO( (StgMallocPtr a, StgInt i) ); +void initialiseEFS PROTO( (StgInt size) ); +StgInt terminateEFS (); +StgMallocPtr emptyEFS(); +StgMallocPtr updateEFS PROTO( (StgMallocPtr a, StgInt i, StgInt x) ); +StgInt lookupEFS PROTO( (StgMallocPtr a, StgInt i) ); \end{verbatim} You can find appropriate definitions for \tr{StgInt}, diff --git a/ghc/driver/ghc.lprl b/ghc/driver/ghc.lprl index 09f1bef..94b1eda 100644 --- a/ghc/driver/ghc.lprl +++ b/ghc/driver/ghc.lprl @@ -408,7 +408,7 @@ require special handling. : ( "$TopPwd/$(CURRENT_DIR)/$(GHC_LIBSRC)/prelude" , "$TopPwd/$(CURRENT_DIR)/$(GHC_LIBSRC)/required" ); -$GhcVersionInfo = 201; # ToDo: int ($(PROJECTVERSION) * 100); +$GhcVersionInfo = int ($(PROJECTVERSION) * 100); $Haskell1Version = 3; # i.e., Haskell 1.3 @Cpp_define = (); @@ -2519,7 +2519,7 @@ sub run_something { next if /from .*(stg|rts)defs\.h:/; next if /from ghc\d+.c:\d+:/; next if /from .*\.lc/; - next if /from .*SMinternal\.lh/; + next if /from .*SMinternal\.l?h/; next if /ANSI C does not support \`long long\'/; next if /warning:.*was declared \`extern\' and later \`static\'/; next if /warning: assignment discards \`const\' from pointer target type/; diff --git a/ghc/lib/Jmakefile b/ghc/lib/Jmakefile index cf763fb..c25b3b4 100644 --- a/ghc/lib/Jmakefile +++ b/ghc/lib/Jmakefile @@ -16,23 +16,19 @@ GHC_OPTS, just for fun. * * ****************************************************************/ +#define IHaveSubdirs #if IncludeTestDirsInBuild == YES -#define IHaveSubdirs #define __ghc_lib_tests_dir tests #else #define __ghc_lib_tests_dir /* nothing */ #endif -SUBDIRS = __ghc_lib_tests_dir +SUBDIRS = cbits __ghc_lib_tests_dir -/* only subdir is the (empty :-() test suite */ -#define NoAllTargetForSubdirs #define NoDocsTargetForSubdirs -#define NoInstallTargetForSubdirs #define NoInstallDocsTargetForSubdirs #define NoDependTargetForSubdirs -#define NoTagTargetForSubdirs GhcDriverNeededHere(depend all) EtagsNeededHere(tags) @@ -54,103 +50,13 @@ PREL_OPTS=/*???-fcompiling-ghc-internals -fno-implicit-prelude*/ /* per-build options: shared with RTS */ #define rts_or_lib(r,l) l -/*later: #include "../mkworld/GHC_OPTS" */ +#include "../mkworld/GHC_OPTS" /* this is just friendliness to "hstags" */ HSTAGS_OPTS=-fglasgow-exts /***************************************************************/ -#define SrcThingVars(blob) @@\ -CAT2(blob,_HC_norm) = $(CAT2(blob,_HS):.hs=.hc) @@\ -CAT2(blob,_HC_p) = $(CAT2(blob,_HS):.hs=.p_hc) @@\ -CAT2(blob,_HC_t) = $(CAT2(blob,_HS):.hs=.t_hc) @@\ -CAT2(blob,_HC_u) = $(CAT2(blob,_HS):.hs=.u_hc) @@\ -CAT2(blob,_HC_mc) = $(CAT2(blob,_HS):.hs=.mc_hc) @@\ -CAT2(blob,_HC_mr) = $(CAT2(blob,_HS):.hs=.mr_hc) @@\ -CAT2(blob,_HC_mt) = $(CAT2(blob,_HS):.hs=.mt_hc) @@\ -CAT2(blob,_HC_mp) = $(CAT2(blob,_HS):.hs=.mp_hc) @@\ -CAT2(blob,_HC_mg) = $(CAT2(blob,_HS):.hs=.mg_hc) @@\ -CAT2(blob,_HC_2s) = $(CAT2(blob,_HS):.hs=.2s_hc) @@\ -CAT2(blob,_HC_1s) = $(CAT2(blob,_HS):.hs=.1s_hc) @@\ -CAT2(blob,_HC_du) = $(CAT2(blob,_HS):.hs=.du_hc) @@\ -CAT2(blob,_HC_a) = $(CAT2(blob,_HS):.hs=.a_hc) @@\ -CAT2(blob,_HC_b) = $(CAT2(blob,_HS):.hs=.b_hc) @@\ -CAT2(blob,_HC_c) = $(CAT2(blob,_HS):.hs=.c_hc) @@\ -CAT2(blob,_HC_d) = $(CAT2(blob,_HS):.hs=.d_hc) @@\ -CAT2(blob,_HC_e) = $(CAT2(blob,_HS):.hs=.e_hc) @@\ -CAT2(blob,_HC_f) = $(CAT2(blob,_HS):.hs=.f_hc) @@\ -CAT2(blob,_HC_g) = $(CAT2(blob,_HS):.hs=.g_hc) @@\ -CAT2(blob,_HC_h) = $(CAT2(blob,_HS):.hs=.h_hc) @@\ -CAT2(blob,_HC_i) = $(CAT2(blob,_HS):.hs=.i_hc) @@\ -CAT2(blob,_HC_j) = $(CAT2(blob,_HS):.hs=.j_hc) @@\ -CAT2(blob,_HC_k) = $(CAT2(blob,_HS):.hs=.k_hc) @@\ -CAT2(blob,_HC_l) = $(CAT2(blob,_HS):.hs=.l_hc) @@\ -CAT2(blob,_HC_m) = $(CAT2(blob,_HS):.hs=.m_hc) @@\ -CAT2(blob,_HC_n) = $(CAT2(blob,_HS):.hs=.n_hc) @@\ -CAT2(blob,_HC_o) = $(CAT2(blob,_HS):.hs=.o_hc) @@\ -CAT2(blob,_HC_A) = $(CAT2(blob,_HS):.hs=.A_hc) @@\ -CAT2(blob,_HC_B) = $(CAT2(blob,_HS):.hs=.B_hc) @@\ - @@\ -CAT2(blob,_DEP_norm) = $(CAT2(blob,_HC_norm):.hc=.o) @@\ -CAT2(blob,_DEP_p) = $(CAT2(blob,_HC_p):.p_hc=.p_o) @@\ -CAT2(blob,_DEP_t) = $(CAT2(blob,_HC_t):.t_hc=.t_o) @@\ -CAT2(blob,_DEP_u) = $(CAT2(blob,_HC_u):.u_hc=.u_o) @@\ -CAT2(blob,_DEP_a) = $(CAT2(blob,_HC_a):.a_hc=.a_o) @@\ -CAT2(blob,_DEP_b) = $(CAT2(blob,_HC_b):.b_hc=.b_o) @@\ -CAT2(blob,_DEP_c) = $(CAT2(blob,_HC_c):.c_hc=.c_o) @@\ -CAT2(blob,_DEP_d) = $(CAT2(blob,_HC_d):.d_hc=.d_o) @@\ -CAT2(blob,_DEP_e) = $(CAT2(blob,_HC_e):.e_hc=.e_o) @@\ -CAT2(blob,_DEP_f) = $(CAT2(blob,_HC_f):.f_hc=.f_o) @@\ -CAT2(blob,_DEP_g) = $(CAT2(blob,_HC_g):.g_hc=.g_o) @@\ -CAT2(blob,_DEP_h) = $(CAT2(blob,_HC_h):.h_hc=.h_o) @@\ -CAT2(blob,_DEP_i) = $(CAT2(blob,_HC_i):.i_hc=.i_o) @@\ -CAT2(blob,_DEP_j) = $(CAT2(blob,_HC_j):.j_hc=.j_o) @@\ -CAT2(blob,_DEP_k) = $(CAT2(blob,_HC_k):.k_hc=.k_o) @@\ -CAT2(blob,_DEP_l) = $(CAT2(blob,_HC_l):.l_hc=.l_o) @@\ -CAT2(blob,_DEP_m) = $(CAT2(blob,_HC_m):.m_hc=.m_o) @@\ -CAT2(blob,_DEP_n) = $(CAT2(blob,_HC_n):.n_hc=.n_o) @@\ -CAT2(blob,_DEP_o) = $(CAT2(blob,_HC_o):.o_hc=.o_o) @@\ -CAT2(blob,_DEP_A) = $(CAT2(blob,_HC_A):.A_hc=.A_o) @@\ -CAT2(blob,_DEP_B) = $(CAT2(blob,_HC_B):.B_hc=.B_o) @@\ -CAT2(blob,_DEP_mc) = $(CAT2(blob,_HC_mc):.mc_hc=.mc_o) @@\ -CAT2(blob,_DEP_mr) = $(CAT2(blob,_HC_mr):.mr_hc=.mr_o) @@\ -CAT2(blob,_DEP_mt) = $(CAT2(blob,_HC_mt):.mt_hc=.mt_o) @@\ -CAT2(blob,_DEP_mp) = $(CAT2(blob,_HC_mp):.mp_hc=.mp_o) @@\ -CAT2(blob,_DEP_mg) = $(CAT2(blob,_HC_mg):.mg_hc=.mg_o) @@\ -CAT2(blob,_DEP_2s) = $(CAT2(blob,_HC_2s):.2s_hc=.2s_o) @@\ -CAT2(blob,_DEP_1s) = $(CAT2(blob,_HC_1s):.1s_hc=.1s_o) @@\ -CAT2(blob,_DEP_du) = $(CAT2(blob,_HC_du):.du_hc=.du_o) @@\ - @@\ -CAT2(blob,_HIs_p) = $(CAT2(blob,_HIs):.hi=.p_hi) @@\ -CAT2(blob,_HIs_t) = $(CAT2(blob,_HIs):.hi=.t_hi) @@\ -CAT2(blob,_HIs_u) = $(CAT2(blob,_HIs):.hi=.u_hi) @@\ -CAT2(blob,_HIs_a) = $(CAT2(blob,_HIs):.hi=.a_hi) @@\ -CAT2(blob,_HIs_b) = $(CAT2(blob,_HIs):.hi=.b_hi) @@\ -CAT2(blob,_HIs_c) = $(CAT2(blob,_HIs):.hi=.c_hi) @@\ -CAT2(blob,_HIs_d) = $(CAT2(blob,_HIs):.hi=.d_hi) @@\ -CAT2(blob,_HIs_e) = $(CAT2(blob,_HIs):.hi=.e_hi) @@\ -CAT2(blob,_HIs_f) = $(CAT2(blob,_HIs):.hi=.f_hi) @@\ -CAT2(blob,_HIs_g) = $(CAT2(blob,_HIs):.hi=.g_hi) @@\ -CAT2(blob,_HIs_h) = $(CAT2(blob,_HIs):.hi=.h_hi) @@\ -CAT2(blob,_HIs_i) = $(CAT2(blob,_HIs):.hi=.i_hi) @@\ -CAT2(blob,_HIs_j) = $(CAT2(blob,_HIs):.hi=.j_hi) @@\ -CAT2(blob,_HIs_k) = $(CAT2(blob,_HIs):.hi=.k_hi) @@\ -CAT2(blob,_HIs_l) = $(CAT2(blob,_HIs):.hi=.l_hi) @@\ -CAT2(blob,_HIs_m) = $(CAT2(blob,_HIs):.hi=.m_hi) @@\ -CAT2(blob,_HIs_n) = $(CAT2(blob,_HIs):.hi=.n_hi) @@\ -CAT2(blob,_HIs_o) = $(CAT2(blob,_HIs):.hi=.o_hi) @@\ -CAT2(blob,_HIs_A) = $(CAT2(blob,_HIs):.hi=.A_hi) @@\ -CAT2(blob,_HIs_B) = $(CAT2(blob,_HIs):.hi=.B_hi) @@\ -CAT2(blob,_HIs_mc) = $(CAT2(blob,_HIs):.hi=.mc_hi) @@\ -CAT2(blob,_HIs_mr) = $(CAT2(blob,_HIs):.hi=.mr_hi) @@\ -CAT2(blob,_HIs_mt) = $(CAT2(blob,_HIs):.hi=.mt_hi) @@\ -CAT2(blob,_HIs_mp) = $(CAT2(blob,_HIs):.hi=.mp_hi) @@\ -CAT2(blob,_HIs_mg) = $(CAT2(blob,_HIs):.hi=.mg_hi) @@\ -CAT2(blob,_HIs_2s) = $(CAT2(blob,_HIs):.hi=.2s_hi) @@\ -CAT2(blob,_HIs_1s) = $(CAT2(blob,_HIs):.hi=.1s_hi) @@\ -CAT2(blob,_HIs_du) = $(CAT2(blob,_HIs):.hi=.du_hi) - /**************************************************************** * * * what it is we are compiling; * @@ -186,10 +92,10 @@ concurrent/SampleVar.hs \ concurrent/Semaphore.hs \ concurrent/Concurrent.hs - BASIC_OBJS_DIRS = $(BASIC_HS:.hs=) -SrcThingVars(BASIC) +/* easy way to make many many Make variables: */ +WayThingVars(BASIC) /************************************************************************ * * @@ -254,126 +160,42 @@ InstallTarget(basic_his) InstallMultNonExecTargets(basic_his, $(BASIC_HIs), $(INSTDATADIR_GHC)/imports) #endif /* installing */ -IfGhcBuild_normal(BigBuildTarget(,'*.o',basic_his \ -, $(BASIC_DEP_norm), $(BASIC_HIs) \ -)) - -IfGhcBuild_p(BigBuildTarget(_p,'*.p_o',his_p \ -, $(BASIC_DEP_p), $(BASIC_HIs_p) \ -)) - -IfGhcBuild_t(BigBuildTarget(_t,'*.t_o',his_t \ -, $(BASIC_DEP_t), $(BASIC_HIs_t) \ -)) - -IfGhcBuild_u(BigBuildTarget(,'*.u_o',his_u \ -, $(BASIC_DEP_u), $(BASIC_HIs_u) \ -)) - -IfGhcBuild_mc(BigBuildTarget(_mc,'*.mc_o',his_mc \ -, $(BASIC_DEP_mc), $(BASIC_HIs_mc) \ -)) - -IfGhcBuild_mr(BigBuildTarget(_mr,'*.mr_o',his_mr \ -, $(BASIC_DEP_mr), $(BASIC_HIs_mr) \ -)) - -IfGhcBuild_mt(BigBuildTarget(_mr,'*.mt_o',his_mt \ -, $(BASIC_DEP_mt), $(BASIC_HIs_mt) \ -)) - -IfGhcBuild_mp(BigBuildTarget(_mp,'*.mp_o',his_mp \ -, $(BASIC_DEP_mp), $(BASIC_HIs_mp) \ -)) - -IfGhcBuild_mg(BigBuildTarget(_mg,'*.mg_o',his_mg \ -, $(BASIC_DEP_mg), $(BASIC_HIs_mg) \ -)) +IfBuild_normal(BigBuildTarget(,'*.o',basic_his, $(BASIC_DEP_norm), $(BASIC_HIs))) +IfBuild_p(BigBuildTarget(_p,'*.p_o',his_p, $(BASIC_DEP_p), $(BASIC_HIs_p))) +IfBuild_t(BigBuildTarget(_t,'*.t_o',his_t, $(BASIC_DEP_t), $(BASIC_HIs_t))) +IfBuild_u(BigBuildTarget(,'*.u_o',his_u, $(BASIC_DEP_u), $(BASIC_HIs_u))) +IfBuild_mc(BigBuildTarget(_mc,'*.mc_o',his_mc, $(BASIC_DEP_mc), $(BASIC_HIs_mc))) +IfBuild_mr(BigBuildTarget(_mr,'*.mr_o',his_mr, $(BASIC_DEP_mr), $(BASIC_HIs_mr))) +IfBuild_mt(BigBuildTarget(_mr,'*.mt_o',his_mt, $(BASIC_DEP_mt), $(BASIC_HIs_mt))) +IfBuild_mp(BigBuildTarget(_mp,'*.mp_o',his_mp, $(BASIC_DEP_mp), $(BASIC_HIs_mp))) +IfBuild_mg(BigBuildTarget(_mg,'*.mg_o',his_mg, $(BASIC_DEP_mg), $(BASIC_HIs_mg))) /* these GC ones do not *really* need separate .hi files, but it really makes life easier to do it this way */ -IfGhcBuild_2s(BigBuildTarget(_2s,'*.2s_o',his_2s \ -, $(BASIC_DEP_2s), $(BASIC_HIs_2s) \ -)) - -IfGhcBuild_1s(BigBuildTarget(_1s,'*.1s_o',his_1s \ -, $(BASIC_DEP_1s), $(BASIC_HIs_1s) \ -)) - -IfGhcBuild_du(BigBuildTarget(_du,'*.du_o',his_du \ -, $(BASIC_DEP_du), $(BASIC_HIs_du) \ -)) +IfBuild_2s(BigBuildTarget(_2s,'*.2s_o',his_2s, $(BASIC_DEP_2s), $(BASIC_HIs_2s))) +IfBuild_1s(BigBuildTarget(_1s,'*.1s_o',his_1s, $(BASIC_DEP_1s), $(BASIC_HIs_1s))) +IfBuild_du(BigBuildTarget(_du,'*.du_o',his_du, $(BASIC_DEP_du), $(BASIC_HIs_du))) /* user ways -- yeeps! */ -IfGhcBuild_a(BigBuildTarget(_a,'*.a_o',his_a \ -, $(BASIC_DEP_a), $(BASIC_HIs_a) \ -)) - -IfGhcBuild_b(BigBuildTarget(_b,'*.b_o',his_b \ -, $(BASIC_DEP_b), $(BASIC_HIs_b) \ -)) - -IfGhcBuild_c(BigBuildTarget(_c,'*.c_o',his_c \ -, $(BASIC_DEP_c), $(BASIC_HIs_c) \ -)) - -IfGhcBuild_d(BigBuildTarget(_d,'*.d_o',his_d \ -, $(BASIC_DEP_d), $(BASIC_HIs_d) \ -)) - -IfGhcBuild_e(BigBuildTarget(_e,'*.e_o',his_e \ -, $(BASIC_DEP_e), $(BASIC_HIs_e) \ -)) - -IfGhcBuild_f(BigBuildTarget(_f,'*.f_o',his_f \ -, $(BASIC_DEP_f), $(BASIC_HIs_f) \ -)) - -IfGhcBuild_g(BigBuildTarget(_g,'*.g_o',his_g \ -, $(BASIC_DEP_g), $(BASIC_HIs_g) \ -)) - -IfGhcBuild_h(BigBuildTarget(_h,'*.h_o',his_h \ -, $(BASIC_DEP_h), $(BASIC_HIs_h) \ -)) - -IfGhcBuild_i(BigBuildTarget(_i,'*.i_o',his_i \ -, $(BASIC_DEP_i), $(BASIC_HIs_i) \ -)) - -IfGhcBuild_j(BigBuildTarget(_j,'*.j_o',his_j \ -, $(BASIC_DEP_j), $(BASIC_HIs_j) \ -)) - -IfGhcBuild_k(BigBuildTarget(_k,'*.k_o',his_k \ -, $(BASIC_DEP_k), $(BASIC_HIs_k) \ -)) - -IfGhcBuild_l(BigBuildTarget(_l,'*.l_o',his_l \ -, $(BASIC_DEP_l), $(BASIC_HIs_l) \ -)) - -IfGhcBuild_m(BigBuildTarget(_m,'*.m_o',his_m \ -, $(BASIC_DEP_m), $(BASIC_HIs_m) \ -)) - -IfGhcBuild_n(BigBuildTarget(_n,'*.n_o',his_n \ -, $(BASIC_DEP_n), $(BASIC_HIs_n) \ -)) - -IfGhcBuild_o(BigBuildTarget(_o,'*.o_o',his_o \ -, $(BASIC_DEP_o), $(BASIC_HIs_o) \ -)) - -IfGhcBuild_A(BigBuildTarget(_A,'*.A_o',his_A \ -, $(BASIC_DEP_A), $(BASIC_HIs_A) \ -)) - -IfGhcBuild_B(BigBuildTarget(_B,'*.B_o',his_B \ -, $(BASIC_DEP_B), $(BASIC_HIs_B) \ -)) +IfBuild_a(BigBuildTarget(_a,'*.a_o',his_a, $(BASIC_DEP_a), $(BASIC_HIs_a))) +IfBuild_b(BigBuildTarget(_b,'*.b_o',his_b, $(BASIC_DEP_b), $(BASIC_HIs_b))) +IfBuild_c(BigBuildTarget(_c,'*.c_o',his_c, $(BASIC_DEP_c), $(BASIC_HIs_c))) +IfBuild_d(BigBuildTarget(_d,'*.d_o',his_d, $(BASIC_DEP_d), $(BASIC_HIs_d))) +IfBuild_e(BigBuildTarget(_e,'*.e_o',his_e, $(BASIC_DEP_e), $(BASIC_HIs_e))) +IfBuild_f(BigBuildTarget(_f,'*.f_o',his_f, $(BASIC_DEP_f), $(BASIC_HIs_f))) +IfBuild_g(BigBuildTarget(_g,'*.g_o',his_g, $(BASIC_DEP_g), $(BASIC_HIs_g))) +IfBuild_h(BigBuildTarget(_h,'*.h_o',his_h, $(BASIC_DEP_h), $(BASIC_HIs_h))) +IfBuild_i(BigBuildTarget(_i,'*.i_o',his_i, $(BASIC_DEP_i), $(BASIC_HIs_i))) +IfBuild_j(BigBuildTarget(_j,'*.j_o',his_j, $(BASIC_DEP_j), $(BASIC_HIs_j))) +IfBuild_k(BigBuildTarget(_k,'*.k_o',his_k, $(BASIC_DEP_k), $(BASIC_HIs_k))) +IfBuild_l(BigBuildTarget(_l,'*.l_o',his_l, $(BASIC_DEP_l), $(BASIC_HIs_l))) +IfBuild_m(BigBuildTarget(_m,'*.m_o',his_m, $(BASIC_DEP_m), $(BASIC_HIs_m))) +IfBuild_n(BigBuildTarget(_n,'*.n_o',his_n, $(BASIC_DEP_n), $(BASIC_HIs_n))) +IfBuild_o(BigBuildTarget(_o,'*.o_o',his_o, $(BASIC_DEP_o), $(BASIC_HIs_o))) +IfBuild_A(BigBuildTarget(_A,'*.A_o',his_A, $(BASIC_DEP_A), $(BASIC_HIs_A))) +IfBuild_B(BigBuildTarget(_B,'*.B_o',his_B, $(BASIC_DEP_B), $(BASIC_HIs_B))) /**************************************************************** * * @@ -391,95 +213,39 @@ IfGhcBuild_B(BigBuildTarget(_B,'*.B_o',his_B \ /* some "helpful" internal macros first... */ #if GhcWithHscBuiltViaC == YES && HaskellCompilerType == HC_USE_HC_FILES -#define CompilePreludishly__(file,isuf,way,flags) @@\ -clean :: @@\ - $(RM) CAT3(file,way,.hc) - -#else /* normal case */ -#define CompilePreludishly__(file,isuf,way,flags) @@\ -CAT3(file,way,.hc) : file.isuf @@\ - : do not $(RM) CAT3(file,way,.hc) @@\ - $(GHC) -C $(GHCFLAGS) flags file.isuf -o CAT3(file,way,.hc) @@\ -clean :: @@\ +#define CompileWayishly__(hc,file,isuf,way,flags) @@\ +clean :: @@\ $(RM) CAT3(file,way,.hc) #endif -#define ObjectifyPreludishly__(file,way,flags,osuff,find_pat) @@\ -CAT3(file,way,.o) : CAT3(file,way,.hc) @@\ - $(RM) CAT3(file,way,.o) @@\ - @if [ ! -d file ] ; then mkdir file ; else exit 0 ; fi @@\ - @find file -name find_pat -print | xargs $(RM) __rm_food @@\ - $(GHC) -c $(GHCFLAGS) flags CAT3(file,way,.hc) -odir file -osuf osuff @@\ - touch CAT3(file,way,.o) @@\ -clean :: @@\ - $(RM) CAT3(file,way,.o) @@\ - find file -name find_pat -print | xargs $(RM) __rm_food - -#define DoHs(file,isuf,way,flags,osuf,find_pat) \ -CompilePreludishly__(file,isuf,way,flags) @@\ -ObjectifyPreludishly__(file,way,flags,osuf,find_pat) - -/* here we go: (NB: do not make .hc files for _u [unregisterized]) */ - -#define CompilePreludishly(file,isuf,flags) @@\ -IfGhcBuild_normal(DoHs(file,isuf,,flags $(GHC_OPTS_norm),'o', '*.o')) \ -IfGhcBuild_p(DoHs(file,isuf,_p, flags $(GHC_OPTS_p), 'p_o', '*.p_o')) \ -IfGhcBuild_t(DoHs(file,isuf,_t, flags $(GHC_OPTS_t), 't_o', '*.t_o')) \ -IfGhcBuild_mc(DoHs(file,isuf,_mc, flags $(GHC_OPTS_mc), 'mc_o', '*.mc_o')) \ -IfGhcBuild_mr(DoHs(file,isuf,_mr, flags $(GHC_OPTS_mr), 'mr_o', '*.mr_o')) \ -IfGhcBuild_mt(DoHs(file,isuf,_mt, flags $(GHC_OPTS_mt), 'mt_o', '*.mt_o')) \ -IfGhcBuild_mp(DoHs(file,isuf,_mp, flags $(GHC_OPTS_mp), 'mp_o', '*.mp_o')) \ -IfGhcBuild_mg(DoHs(file,isuf,_mg, flags $(GHC_OPTS_mg), 'mg_o', '*.mg_o')) \ -IfGhcBuild_2s(DoHs(file,isuf,_2s, flags $(GHC_OPTS_2s), '2s_o', '*.2s_o')) \ -IfGhcBuild_1s(DoHs(file,isuf,_1s, flags $(GHC_OPTS_1s), '1s_o', '*.1s_o')) \ -IfGhcBuild_du(DoHs(file,isuf,_du, flags $(GHC_OPTS_du), 'du_o', '*.du_o')) \ -IfGhcBuild_a(DoHs(file,isuf,_a, flags $(GHC_OPTS_a), 'a_o', '*.a_o')) \ -IfGhcBuild_b(DoHs(file,isuf,_b, flags $(GHC_OPTS_b), 'b_o', '*.b_o')) \ -IfGhcBuild_c(DoHs(file,isuf,_c, flags $(GHC_OPTS_c), 'c_o', '*.c_o')) \ -IfGhcBuild_d(DoHs(file,isuf,_d, flags $(GHC_OPTS_d), 'd_o', '*.d_o')) \ -IfGhcBuild_e(DoHs(file,isuf,_e, flags $(GHC_OPTS_e), 'e_o', '*.e_o')) \ -IfGhcBuild_f(DoHs(file,isuf,_f, flags $(GHC_OPTS_f), 'f_o', '*.f_o')) \ -IfGhcBuild_g(DoHs(file,isuf,_g, flags $(GHC_OPTS_g), 'g_o', '*.g_o')) \ -IfGhcBuild_h(DoHs(file,isuf,_h, flags $(GHC_OPTS_h), 'h_o', '*.h_o')) \ -IfGhcBuild_i(DoHs(file,isuf,_i, flags $(GHC_OPTS_i), 'i_o', '*.i_o')) \ -IfGhcBuild_j(DoHs(file,isuf,_j, flags $(GHC_OPTS_j), 'j_o', '*.j_o')) \ -IfGhcBuild_k(DoHs(file,isuf,_k, flags $(GHC_OPTS_k), 'k_o', '*.k_o')) \ -IfGhcBuild_l(DoHs(file,isuf,_l, flags $(GHC_OPTS_l), 'l_o', '*.l_o')) \ -IfGhcBuild_m(DoHs(file,isuf,_m, flags $(GHC_OPTS_m), 'm_o', '*.m_o')) \ -IfGhcBuild_n(DoHs(file,isuf,_n, flags $(GHC_OPTS_n), 'n_o', '*.n_o')) \ -IfGhcBuild_o(DoHs(file,isuf,_o, flags $(GHC_OPTS_o), 'o_o', '*.o_o')) \ -IfGhcBuild_A(DoHs(file,isuf,_A, flags $(GHC_OPTS_A), 'A_o', '*.A_o')) \ -IfGhcBuild_B(DoHs(file,isuf,_B, flags $(GHC_OPTS_B), 'B_o', '*.B_o')) - /* now use the macro: */ -CompilePreludishly(prelude/Prelude,hs,-iprelude -fglasgow-exts -fcompiling-ghc-internals Prelude -fno-implicit-prelude) -CompilePreludishly(prelude/GHCbase,hs,-iprelude -fglasgow-exts -fcompiling-ghc-internals GHCbase) -CompilePreludishly(prelude/GHCbase2,hs,-iprelude -fglasgow-exts -fcompiling-ghc-internals GHCbase2) -CompilePreludishly(prelude/GHCps,hs, -iprelude -fglasgow-exts) -CompilePreludishly(prelude/GHCio,hs, -iprelude -fglasgow-exts) -CompilePreludishly(prelude/GHCmain,hs,-iprelude -fglasgow-exts) -CompilePreludishly(prelude/PreludeGlaST,hs,-iprelude -fglasgow-exts) - -CompilePreludishly(required/Array,hs,-fglasgow-exts -iprelude) -CompilePreludishly(required/Char,hs,) -CompilePreludishly(required/Complex,hs,) -CompilePreludishly(required/Directory,hs,-fglasgow-exts) -CompilePreludishly(required/IO,hs,-fglasgow-exts) -CompilePreludishly(required/Ix,hs,-fglasgow-exts) -CompilePreludishly(required/List,hs,) -CompilePreludishly(required/Maybe,hs,) -CompilePreludishly(required/Monad,hs,) -CompilePreludishly(required/Ratio,hs,) -CompilePreludishly(required/System,hs,-fglasgow-exts) - -CompilePreludishly(concurrent/Channel,hs,) -CompilePreludishly(concurrent/ChannelVar,hs,) -CompilePreludishly(concurrent/Merge,hs,-iconcurrent) -CompilePreludishly(concurrent/Parallel,hs,) -CompilePreludishly(concurrent/SampleVar,hs,) -CompilePreludishly(concurrent/Semaphore,hs,) -CompilePreludishly(concurrent/Concurrent,hs,-iconcurrent) +CompileWayishly(GHC,prelude/Prelude,hs,-iprelude -fglasgow-exts -fcompiling-ghc-internals Prelude -fno-implicit-prelude) +CompileWayishly(GHC,prelude/GHCbase,hs,-iprelude -fglasgow-exts -fcompiling-ghc-internals GHCbase) +CompileWayishly(GHC,prelude/GHCps,hs, -iprelude -fglasgow-exts) +CompileWayishly(GHC,prelude/GHCio,hs, -iprelude -fglasgow-exts) +CompileWayishly(GHC,prelude/GHCmain,hs,-iprelude -fglasgow-exts) +CompileWayishly(GHC,prelude/PreludeGlaST,hs,-iprelude -fglasgow-exts) + +CompileWayishly(GHC,required/Array,hs,-fglasgow-exts -iprelude) +CompileWayishly(GHC,required/Char,hs,) +CompileWayishly(GHC,required/Complex,hs,) +CompileWayishly(GHC,required/Directory,hs,-fglasgow-exts) +CompileWayishly(GHC,required/IO,hs,-fglasgow-exts) +CompileWayishly(GHC,required/Ix,hs,-fglasgow-exts) +CompileWayishly(GHC,required/List,hs,) +CompileWayishly(GHC,required/Maybe,hs,) +CompileWayishly(GHC,required/Monad,hs,) +CompileWayishly(GHC,required/Ratio,hs,) +CompileWayishly(GHC,required/System,hs,-fglasgow-exts) + +CompileWayishly(GHC,concurrent/Channel,hs,) +CompileWayishly(GHC,concurrent/ChannelVar,hs,) +CompileWayishly(GHC,concurrent/Merge,hs,-iconcurrent) +CompileWayishly(GHC,concurrent/Parallel,hs,) +CompileWayishly(GHC,concurrent/SampleVar,hs,) +CompileWayishly(GHC,concurrent/Semaphore,hs,) +CompileWayishly(GHC,concurrent/Concurrent,hs,-iconcurrent) /**************************************************************** * * diff --git a/ghc/lib/cbits/Jmakefile b/ghc/lib/cbits/Jmakefile new file mode 100644 index 0000000..e69de29 diff --git a/ghc/lib/cbits/closeFile.lc b/ghc/lib/cbits/closeFile.lc new file mode 100644 index 0000000..f3efb34 --- /dev/null +++ b/ghc/lib/cbits/closeFile.lc @@ -0,0 +1,32 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1994 +% +\subsection[closeFile.lc]{hClose Runtime Support} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" + +StgInt +closeFile(fp) +StgAddr fp; +{ + int rc; + + unlockFile(fileno((FILE *) fp)); + + while ((rc = fclose((FILE *) fp)) != 0) { + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return rc; + } + } + return 0; +} + +\end{code} + + + diff --git a/ghc/lib/cbits/createDirectory.lc b/ghc/lib/cbits/createDirectory.lc new file mode 100644 index 0000000..759e99c --- /dev/null +++ b/ghc/lib/cbits/createDirectory.lc @@ -0,0 +1,58 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1995 +% +\subsection[createDirectory.lc]{createDirectory Runtime Support} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +StgInt +createDirectory(path) +StgByteArray path; +{ + int rc; + struct stat sb; + + while((rc = mkdir(path, 0777)) != 0) { + if (errno != EINTR) { + cvtErrno(); + switch (ghc_errno) { + default: + stdErrno(); + break; + case GHC_ENOENT: + case GHC_ENOTDIR: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "no path to directory"; + break; + case GHC_EEXIST: + if (stat(path, &sb) != 0) { + ghc_errtype = ERR_OTHERERROR; + ghc_errstr = "cannot stat existing file"; + } + if (S_ISDIR(sb.st_mode)) { + ghc_errtype = ERR_ALREADYEXISTS; + ghc_errstr = "directory already exists"; + } else { + ghc_errtype = ERR_INAPPROPRIATETYPE; + ghc_errstr = "file already exists"; + } + break; + } + return -1; + } + } + return 0; +} + +\end{code} diff --git a/ghc/lib/cbits/errno.lc b/ghc/lib/cbits/errno.lc new file mode 100644 index 0000000..24ea25d --- /dev/null +++ b/ghc/lib/cbits/errno.lc @@ -0,0 +1,925 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1994 +% +\subsection[errno.lc]{GHC Error Number Conversion} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" + +int ghc_errno = 0; +int ghc_errtype = 0; + +char *ghc_errstr = NULL; + +/* Collect all of the grotty #ifdef's in one place. */ + +void cvtErrno(STG_NO_ARGS) +{ + switch(errno) { +#ifdef E2BIG + case E2BIG: + ghc_errno = GHC_E2BIG; + break; +#endif +#ifdef EACCES + case EACCES: + ghc_errno = GHC_EACCES; + break; +#endif +#ifdef EADDRINUSE + case EADDRINUSE: + ghc_errno = GHC_EADDRINUSE; + break; +#endif +#ifdef EADDRNOTAVAIL + case EADDRNOTAVAIL: + ghc_errno = GHC_EADDRNOTAVAIL; + break; +#endif +#ifdef EADV + case EADV: + ghc_errno = GHC_EADV; + break; +#endif +#ifdef EAFNOSUPPORT + case EAFNOSUPPORT: + ghc_errno = GHC_EAFNOSUPPORT; + break; +#endif +#ifdef EAGAIN + case EAGAIN: + ghc_errno = GHC_EAGAIN; + break; +#endif +#ifdef EALREADY + case EALREADY: + ghc_errno = GHC_EALREADY; + break; +#endif +#ifdef EBADF + case EBADF: + ghc_errno = GHC_EBADF; + break; +#endif +#ifdef EBADMSG + case EBADMSG: + ghc_errno = GHC_EBADMSG; + break; +#endif +#ifdef EBADRPC + case EBADRPC: + ghc_errno = GHC_EBADRPC; + break; +#endif +#ifdef EBUSY + case EBUSY: + ghc_errno = GHC_EBUSY; + break; +#endif +#ifdef ECHILD + case ECHILD: + ghc_errno = GHC_ECHILD; + break; +#endif +#ifdef ECOMM + case ECOMM: + ghc_errno = GHC_ECOMM; + break; +#endif +#ifdef ECONNABORTED + case ECONNABORTED: + ghc_errno = GHC_ECONNABORTED; + break; +#endif +#ifdef ECONNREFUSED + case ECONNREFUSED: + ghc_errno = GHC_ECONNREFUSED; + break; +#endif +#ifdef ECONNRESET + case ECONNRESET: + ghc_errno = GHC_ECONNRESET; + break; +#endif +#ifdef EDEADLK + case EDEADLK: + ghc_errno = GHC_EDEADLK; + break; +#endif +#ifdef EDESTADDRREQ + case EDESTADDRREQ: + ghc_errno = GHC_EDESTADDRREQ; + break; +#endif +#ifdef EDIRTY + case EDIRTY: + ghc_errno = GHC_EDIRTY; + break; +#endif +#ifdef EDOM + case EDOM: + ghc_errno = GHC_EDOM; + break; +#endif +#ifdef EDQUOT + case EDQUOT: + ghc_errno = GHC_EDQUOT; + break; +#endif +#ifdef EEXIST + case EEXIST: + ghc_errno = GHC_EEXIST; + break; +#endif +#ifdef EFAULT + case EFAULT: + ghc_errno = GHC_EFAULT; + break; +#endif +#ifdef EFBIG + case EFBIG: + ghc_errno = GHC_EFBIG; + break; +#endif +#ifdef EFTYPE + case EFTYPE: + ghc_errno = GHC_EFTYPE; + break; +#endif +#ifdef EHOSTDOWN + case EHOSTDOWN: + ghc_errno = GHC_EHOSTDOWN; + break; +#endif +#ifdef EHOSTUNREACH + case EHOSTUNREACH: + ghc_errno = GHC_EHOSTUNREACH; + break; +#endif +#ifdef EIDRM + case EIDRM: + ghc_errno = GHC_EIDRM; + break; +#endif +#ifdef EILSEQ + case EILSEQ: + ghc_errno = GHC_EILSEQ; + break; +#endif +#ifdef EINPROGRESS + case EINPROGRESS: + ghc_errno = GHC_EINPROGRESS; + break; +#endif +#ifdef EINTR + case EINTR: + ghc_errno = GHC_EINTR; + break; +#endif +#ifdef EINVAL + case EINVAL: + ghc_errno = GHC_EINVAL; + break; +#endif +#ifdef EIO + case EIO: + ghc_errno = GHC_EIO; + break; +#endif +#ifdef EISCONN + case EISCONN: + ghc_errno = GHC_EISCONN; + break; +#endif +#ifdef EISDIR + case EISDIR: + ghc_errno = GHC_EISDIR; + break; +#endif +#ifdef ELOOP + case ELOOP: + ghc_errno = GHC_ELOOP; + break; +#endif +#ifdef EMFILE + case EMFILE: + ghc_errno = GHC_EMFILE; + break; +#endif +#ifdef EMLINK + case EMLINK: + ghc_errno = GHC_EMLINK; + break; +#endif +#ifdef EMSGSIZE + case EMSGSIZE: + ghc_errno = GHC_EMSGSIZE; + break; +#endif +#ifdef EMULTIHOP + case EMULTIHOP: + ghc_errno = GHC_EMULTIHOP; + break; +#endif +#ifdef ENAMETOOLONG + case ENAMETOOLONG: + ghc_errno = GHC_ENAMETOOLONG; + break; +#endif +#ifdef ENETDOWN + case ENETDOWN: + ghc_errno = GHC_ENETDOWN; + break; +#endif +#ifdef ENETRESET + case ENETRESET: + ghc_errno = GHC_ENETRESET; + break; +#endif +#ifdef ENETUNREACH + case ENETUNREACH: + ghc_errno = GHC_ENETUNREACH; + break; +#endif +#ifdef ENFILE + case ENFILE: + ghc_errno = GHC_ENFILE; + break; +#endif +#ifdef ENOBUFS + case ENOBUFS: + ghc_errno = GHC_ENOBUFS; + break; +#endif +#ifdef ENODATA + case ENODATA: + ghc_errno = GHC_ENODATA; + break; +#endif +#ifdef ENODEV + case ENODEV: + ghc_errno = GHC_ENODEV; + break; +#endif +#ifdef ENOENT + case ENOENT: + ghc_errno = GHC_ENOENT; + break; +#endif +#ifdef ENOEXEC + case ENOEXEC: + ghc_errno = GHC_ENOEXEC; + break; +#endif +#ifdef ENOLCK + case ENOLCK: + ghc_errno = GHC_ENOLCK; + break; +#endif +#ifdef ENOLINK + case ENOLINK: + ghc_errno = GHC_ENOLINK; + break; +#endif +#ifdef ENOMEM + case ENOMEM: + ghc_errno = GHC_ENOMEM; + break; +#endif +#ifdef ENOMSG + case ENOMSG: + ghc_errno = GHC_ENOMSG; + break; +#endif +#ifdef ENONET + case ENONET: + ghc_errno = GHC_ENONET; + break; +#endif +#ifdef ENOPROTOOPT + case ENOPROTOOPT: + ghc_errno = GHC_ENOPROTOOPT; + break; +#endif +#ifdef ENOSPC + case ENOSPC: + ghc_errno = GHC_ENOSPC; + break; +#endif +#ifdef ENOSR + case ENOSR: + ghc_errno = GHC_ENOSR; + break; +#endif +#ifdef ENOSTR + case ENOSTR: + ghc_errno = GHC_ENOSTR; + break; +#endif +#ifdef ENOSYS + case ENOSYS: + ghc_errno = GHC_ENOSYS; + break; +#endif +#ifdef ENOTBLK + case ENOTBLK: + ghc_errno = GHC_ENOTBLK; + break; +#endif +#ifdef ENOTCONN + case ENOTCONN: + ghc_errno = GHC_ENOTCONN; + break; +#endif +#ifdef ENOTDIR + case ENOTDIR: + ghc_errno = GHC_ENOTDIR; + break; +#endif +#ifdef ENOTEMPTY + case ENOTEMPTY: + ghc_errno = GHC_ENOTEMPTY; + break; +#endif +#ifdef ENOTSOCK + case ENOTSOCK: + ghc_errno = GHC_ENOTSOCK; + break; +#endif +#ifdef ENOTTY + case ENOTTY: + ghc_errno = GHC_ENOTTY; + break; +#endif +#ifdef ENXIO + case ENXIO: + ghc_errno = GHC_ENXIO; + break; +#endif +#ifdef EOPNOTSUPP + case EOPNOTSUPP: + ghc_errno = GHC_EOPNOTSUPP; + break; +#endif +#ifdef EPERM + case EPERM: + ghc_errno = GHC_EPERM; + break; +#endif +#ifdef EPFNOSUPPORT + case EPFNOSUPPORT: + ghc_errno = GHC_EPFNOSUPPORT; + break; +#endif +#ifdef EPIPE + case EPIPE: + ghc_errno = GHC_EPIPE; + break; +#endif +#ifdef EPROCLIM + case EPROCLIM: + ghc_errno = GHC_EPROCLIM; + break; +#endif +#ifdef EPROCUNAVAIL + case EPROCUNAVAIL: + ghc_errno = GHC_EPROCUNAVAIL; + break; +#endif +#ifdef EPROGMISMATCH + case EPROGMISMATCH: + ghc_errno = GHC_EPROGMISMATCH; + break; +#endif +#ifdef EPROGUNAVAIL + case EPROGUNAVAIL: + ghc_errno = GHC_EPROGUNAVAIL; + break; +#endif +#ifdef EPROTO + case EPROTO: + ghc_errno = GHC_EPROTO; + break; +#endif +#ifdef EPROTONOSUPPORT + case EPROTONOSUPPORT: + ghc_errno = GHC_EPROTONOSUPPORT; + break; +#endif +#ifdef EPROTOTYPE + case EPROTOTYPE: + ghc_errno = GHC_EPROTOTYPE; + break; +#endif +#ifdef ERANGE + case ERANGE: + ghc_errno = GHC_ERANGE; + break; +#endif +#ifdef EREMCHG + case EREMCHG: + ghc_errno = GHC_EREMCHG; + break; +#endif +#ifdef EREMOTE + case EREMOTE: + ghc_errno = GHC_EREMOTE; + break; +#endif +#ifdef EROFS + case EROFS: + ghc_errno = GHC_EROFS; + break; +#endif +#ifdef ERPCMISMATCH + case ERPCMISMATCH: + ghc_errno = GHC_ERPCMISMATCH; + break; +#endif +#ifdef ERREMOTE + case ERREMOTE: + ghc_errno = GHC_ERREMOTE; + break; +#endif +#ifdef ESHUTDOWN + case ESHUTDOWN: + ghc_errno = GHC_ESHUTDOWN; + break; +#endif +#ifdef ESOCKTNOSUPPORT + case ESOCKTNOSUPPORT: + ghc_errno = GHC_ESOCKTNOSUPPORT; + break; +#endif +#ifdef ESPIPE + case ESPIPE: + ghc_errno = GHC_ESPIPE; + break; +#endif +#ifdef ESRCH + case ESRCH: + ghc_errno = GHC_ESRCH; + break; +#endif +#ifdef ESRMNT + case ESRMNT: + ghc_errno = GHC_ESRMNT; + break; +#endif +#ifdef ESTALE + case ESTALE: + ghc_errno = GHC_ESTALE; + break; +#endif +#ifdef ETIME + case ETIME: + ghc_errno = GHC_ETIME; + break; +#endif +#ifdef ETIMEDOUT + case ETIMEDOUT: + ghc_errno = GHC_ETIMEDOUT; + break; +#endif +#ifdef ETOOMANYREFS + case ETOOMANYREFS: + ghc_errno = GHC_ETOOMANYREFS; + break; +#endif +#ifdef ETXTBSY + case ETXTBSY: + ghc_errno = GHC_ETXTBSY; + break; +#endif +#ifdef EUSERS + case EUSERS: + ghc_errno = GHC_EUSERS; + break; +#endif +#if 0 +#ifdef EWOULDBLOCK + case EWOULDBLOCK: + ghc_errno = GHC_EWOULDBLOCK; + break; +#endif +#endif +#ifdef EXDEV + case EXDEV: + ghc_errno = GHC_EXDEV; + break; +#endif + default: + ghc_errno = errno; + break; + } +} + +void +stdErrno(STG_NO_ARGS) +{ + switch(ghc_errno) { + default: + ghc_errtype = ERR_OTHERERROR; + ghc_errstr = "unexpected error"; + break; + case 0: + ghc_errtype = ERR_OTHERERROR; + ghc_errstr = "no error"; + case GHC_E2BIG: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "argument list too long"; + break; + case GHC_EACCES: + ghc_errtype = ERR_PERMISSIONDENIED; + ghc_errstr = "inadequate access permission"; + break; + case GHC_EADDRINUSE: + ghc_errtype = ERR_RESOURCEBUSY; + ghc_errstr = "address already in use"; + break; + case GHC_EADDRNOTAVAIL: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "address not available"; + break; + case GHC_EADV: + ghc_errtype = ERR_OTHERERROR; + ghc_errstr = "RFS advertise error"; + break; + case GHC_EAFNOSUPPORT: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "address family not supported by protocol family"; + break; + case GHC_EAGAIN: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "insufficient resources"; + break; + case GHC_EALREADY: + ghc_errtype = ERR_ALREADYEXISTS; + ghc_errstr = "operation already in progress"; + break; + case GHC_EBADF: + ghc_errtype = ERR_OTHERERROR; + ghc_errstr = "internal error (EBADF)"; + break; + case GHC_EBADMSG: + ghc_errtype = ERR_INAPPROPRIATETYPE; + ghc_errstr = "next message has wrong type"; + break; + case GHC_EBADRPC: + ghc_errtype = ERR_OTHERERROR; + ghc_errstr = "invalid RPC request or response"; + break; + case GHC_EBUSY: + ghc_errtype = ERR_RESOURCEBUSY; + ghc_errstr = "device busy"; + break; + case GHC_ECHILD: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "no child processes"; + break; + case GHC_ECOMM: + ghc_errtype = ERR_RESOURCEVANISHED; + ghc_errstr = "no virtual circuit could be found"; + break; + case GHC_ECONNABORTED: + ghc_errtype = ERR_OTHERERROR; + ghc_errstr = "aborted connection"; + break; + case GHC_ECONNREFUSED: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "no listener on remote host"; + break; + case GHC_ECONNRESET: + ghc_errtype = ERR_RESOURCEVANISHED; + ghc_errstr = "connection reset by peer"; + break; + case GHC_EDEADLK: + ghc_errtype = ERR_RESOURCEBUSY; + ghc_errstr = "resource deadlock avoided"; + break; + case GHC_EDESTADDRREQ: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "destination address required"; + break; + case GHC_EDIRTY: + ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS; + ghc_errstr = "file system dirty"; + break; + case GHC_EDOM: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "argument too large"; + break; + case GHC_EDQUOT: + ghc_errtype = ERR_PERMISSIONDENIED; + ghc_errstr = "quota exceeded"; + break; + case GHC_EEXIST: + ghc_errtype = ERR_ALREADYEXISTS; + ghc_errstr = "file already exists"; + break; + case GHC_EFAULT: + ghc_errtype = ERR_OTHERERROR; + ghc_errstr = "internal error (EFAULT)"; + break; + case GHC_EFBIG: + ghc_errtype = ERR_PERMISSIONDENIED; + ghc_errstr = "file too large"; + break; + case GHC_EFTYPE: + ghc_errtype = ERR_INAPPROPRIATETYPE; + ghc_errstr = "inappropriate NFS file type or format"; + break; + case GHC_EHOSTDOWN: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "destination host down"; + break; + case GHC_EHOSTUNREACH: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "remote host is unreachable"; + break; + case GHC_EIDRM: + ghc_errtype = ERR_RESOURCEVANISHED; + ghc_errstr = "IPC identifier removed"; + break; + case GHC_EILSEQ: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "invalid wide character"; + break; + case GHC_EINPROGRESS: + ghc_errtype = ERR_ALREADYEXISTS; + ghc_errstr = "operation now in progress"; + break; + case GHC_EINTR: + ghc_errtype = ERR_INTERRUPTED; + ghc_errstr = "interrupted system call"; + break; + case GHC_EINVAL: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "invalid argument"; + break; + case GHC_EIO: + ghc_errtype = ERR_HARDWAREFAULT; + ghc_errstr = "unknown I/O fault"; + break; + case GHC_EISCONN: + ghc_errtype = ERR_ALREADYEXISTS; + ghc_errstr = "socket is already connected"; + break; + case GHC_EISDIR: + ghc_errtype = ERR_INAPPROPRIATETYPE; + ghc_errstr = "file is a directory"; + break; + case GHC_ELOOP: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "too many symbolic links"; + break; + case GHC_EMFILE: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "process file table full"; + break; + case GHC_EMLINK: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "too many links"; + break; + case GHC_EMSGSIZE: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "message too long"; + break; + case GHC_EMULTIHOP: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "multi-hop RFS request"; + break; + case GHC_ENAMETOOLONG: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "filename too long"; + break; + case GHC_ENETDOWN: + ghc_errtype = ERR_RESOURCEVANISHED; + ghc_errstr = "network is down"; + break; + case GHC_ENETRESET: + ghc_errtype = ERR_RESOURCEVANISHED; + ghc_errstr = "remote host rebooted; connection lost"; + break; + case GHC_ENETUNREACH: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "remote network is unreachable"; + break; + case GHC_ENFILE: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "system file table full"; + break; + case GHC_ENOBUFS: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "no buffer space available"; + break; + case GHC_ENODATA: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "no message on the stream head read queue"; + break; + case GHC_ENODEV: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "no such device"; + break; + case GHC_ENOENT: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "no such file or directory"; + break; + case GHC_ENOEXEC: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "not an executable file"; + break; + case GHC_ENOLCK: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "no file locks available"; + break; + case GHC_ENOLINK: + ghc_errtype = ERR_RESOURCEVANISHED; + ghc_errstr = "RFS link has been severed"; + break; + case GHC_ENOMEM: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "not enough virtual memory"; + break; + case GHC_ENOMSG: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "no message of desired type"; + break; + case GHC_ENONET: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "host is not on a network"; + break; + case GHC_ENOPROTOOPT: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "operation not supported by protocol"; + break; + case GHC_ENOSPC: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "no space left on device"; + break; + case GHC_ENOSR: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "out of stream resources"; + break; + case GHC_ENOSTR: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "not a stream device"; + break; + case GHC_ENOSYS: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "function not implemented"; + break; + case GHC_ENOTBLK: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "not a block device"; + break; + case GHC_ENOTCONN: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "socket is not connected"; + break; + case GHC_ENOTDIR: + ghc_errtype = ERR_INAPPROPRIATETYPE; + ghc_errstr = "not a directory"; + break; + case GHC_ENOTEMPTY: + ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS; + ghc_errstr = "directory not empty"; + break; + case GHC_ENOTSOCK: + ghc_errtype = ERR_INVALIDARGUMENT; + ghc_errstr = "not a socket"; + break; + case GHC_ENOTTY: + ghc_errtype = ERR_ILLEGALOPERATION; + ghc_errstr = "inappropriate ioctl for device"; + break; + case GHC_ENXIO: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "no such device or address"; + break; + case GHC_EOPNOTSUPP: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "operation not supported on socket"; + break; + case GHC_EPERM: + ghc_errtype = ERR_PERMISSIONDENIED; + ghc_errstr = "privileged operation"; + break; + case GHC_EPFNOSUPPORT: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "protocol family not supported"; + break; + case GHC_EPIPE: + ghc_errtype = ERR_RESOURCEVANISHED; + ghc_errstr = "broken pipe"; + break; + case GHC_EPROCLIM: + ghc_errtype = ERR_PERMISSIONDENIED; + ghc_errstr = "too many processes"; + break; + case GHC_EPROCUNAVAIL: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "unimplemented RPC procedure"; + break; + case GHC_EPROGMISMATCH: + ghc_errtype = ERR_PROTOCOLERROR; + ghc_errstr = "unsupported RPC program version"; + break; + case GHC_EPROGUNAVAIL: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "RPC program unavailable"; + break; + case GHC_EPROTO: + ghc_errtype = ERR_PROTOCOLERROR; + ghc_errstr = "error in streams protocol"; + break; + case GHC_EPROTONOSUPPORT: + ghc_errtype = ERR_PROTOCOLERROR; + ghc_errstr = "protocol not supported"; + break; + case GHC_EPROTOTYPE: + ghc_errtype = ERR_PROTOCOLERROR; + ghc_errstr = "wrong protocol for socket"; + break; + case GHC_ERANGE: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "result too large"; + break; + case GHC_EREMCHG: + ghc_errtype = ERR_RESOURCEVANISHED; + ghc_errstr = "remote address changed"; + break; + case GHC_EREMOTE: + ghc_errtype = ERR_ILLEGALOPERATION; + ghc_errstr = "too many levels of remote in path"; + break; + case GHC_EROFS: + ghc_errtype = ERR_PERMISSIONDENIED; + ghc_errstr = "read-only file system"; + break; + case GHC_ERPCMISMATCH: + ghc_errtype = ERR_PROTOCOLERROR; + ghc_errstr = "RPC version is wrong"; + break; + case GHC_ERREMOTE: + ghc_errtype = ERR_ILLEGALOPERATION; + ghc_errstr = "object is remote"; + break; + case GHC_ESHUTDOWN: + ghc_errtype = ERR_ILLEGALOPERATION; + ghc_errstr = "can't send after socket shutdown"; + break; + case GHC_ESOCKTNOSUPPORT: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "socket type not supported"; + break; + case GHC_ESPIPE: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "can't seek on a pipe"; + break; + case GHC_ESRCH: + ghc_errtype = ERR_NOSUCHTHING; + ghc_errstr = "no such process"; + break; + case GHC_ESRMNT: + ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS; + ghc_errstr = "RFS resources still mounted by remote host(s)"; + break; + case GHC_ESTALE: + ghc_errtype = ERR_RESOURCEVANISHED; + ghc_errstr = "stale NFS file handle"; + break; + case GHC_ETIME: + ghc_errtype = ERR_TIMEEXPIRED; + ghc_errstr = "timer expired"; + break; + case GHC_ETIMEDOUT: + ghc_errtype = ERR_TIMEEXPIRED; + ghc_errstr = "connection timed out"; + break; + case GHC_ETOOMANYREFS: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "too many references; can't splice"; + break; + case GHC_ETXTBSY: + ghc_errtype = ERR_RESOURCEBUSY; + ghc_errstr = "text file in-use"; + break; + case GHC_EUSERS: + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "quota table full"; + break; + case GHC_EWOULDBLOCK: + ghc_errtype = ERR_OTHERERROR; + ghc_errstr = "operation would block"; + break; + case GHC_EXDEV: + ghc_errtype = ERR_UNSUPPORTEDOPERATION; + ghc_errstr = "can't make a cross-device link"; + break; + } +} + +\end{code} diff --git a/ghc/lib/cbits/fileEOF.lc b/ghc/lib/cbits/fileEOF.lc new file mode 100644 index 0000000..81128d4 --- /dev/null +++ b/ghc/lib/cbits/fileEOF.lc @@ -0,0 +1,23 @@ +% +% (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) +StgAddr 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/cbits/fileGetc.lc b/ghc/lib/cbits/fileGetc.lc new file mode 100644 index 0000000..336c0d9 --- /dev/null +++ b/ghc/lib/cbits/fileGetc.lc @@ -0,0 +1,38 @@ +% +% (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) +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; +} + +\end{code} diff --git a/ghc/lib/cbits/fileLookAhead.lc b/ghc/lib/cbits/fileLookAhead.lc new file mode 100644 index 0000000..df0d332 --- /dev/null +++ b/ghc/lib/cbits/fileLookAhead.lc @@ -0,0 +1,27 @@ +% +% (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) +StgAddr 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/cbits/filePosn.lc b/ghc/lib/cbits/filePosn.lc new file mode 100644 index 0000000..826c4f4 --- /dev/null +++ b/ghc/lib/cbits/filePosn.lc @@ -0,0 +1,48 @@ +% +% (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(fp) +StgAddr fp; +{ + StgInt posn; + + while ((posn = ftell((FILE *) fp)) == -1) { + /* the possibility seems awfully remote */ + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return -1; + } + } + return posn; +} + +/* The following is only called with a position that we've already visited */ + +StgInt +setFilePosn(fp, posn) +StgAddr fp; +StgInt posn; +{ + while (fseek((FILE *) fp, posn, SEEK_SET) != 0) { + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return -1; + } + } + return 0; +} + +\end{code} + + + diff --git a/ghc/lib/cbits/filePutc.lc b/ghc/lib/cbits/filePutc.lc new file mode 100644 index 0000000..bca57ba --- /dev/null +++ b/ghc/lib/cbits/filePutc.lc @@ -0,0 +1,32 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1994 +% +\subsection[filePuc.lc]{hPutChar Runtime Support} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" +#include "error.h" + +StgInt +filePutc(fp, c) +StgAddr fp; +StgInt c; +{ + int rc; + + /* Try to read a character */ + while ((rc = putc((int) c, (FILE *) fp)) == EOF && errno == EINTR) + clearerr((FILE *) fp); + + if (rc == EOF) { + cvtErrno(); + stdErrno(); + return -1; + } + + return 0; +} + +\end{code} diff --git a/ghc/lib/cbits/fileSize.lc b/ghc/lib/cbits/fileSize.lc new file mode 100644 index 0000000..ed3da3c --- /dev/null +++ b/ghc/lib/cbits/fileSize.lc @@ -0,0 +1,45 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1994 +% +\subsection[fileSize.lc]{hfileSize Runtime Support} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +StgInt +fileSize(fp, result) +StgAddr fp; +StgByteArray result; +{ + struct stat sb; + + while (fstat(fileno((FILE *) fp), &sb) < 0) { + /* highly unlikely */ + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return -1; + } + } + if (S_ISREG(sb.st_mode)) { + /* result will be word aligned */ + *(off_t *) result = sb.st_size; + return 0; + } else { + ghc_errtype = ERR_INAPPROPRIATETYPE; + ghc_errstr = "not a regular file"; + return -1; + } +} + +\end{code} diff --git a/ghc/lib/cbits/flushFile.lc b/ghc/lib/cbits/flushFile.lc new file mode 100644 index 0000000..68aa445 --- /dev/null +++ b/ghc/lib/cbits/flushFile.lc @@ -0,0 +1,30 @@ +% +% (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) +StgAddr 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/cbits/getBufferMode.lc b/ghc/lib/cbits/getBufferMode.lc new file mode 100644 index 0000000..0c6bb44 --- /dev/null +++ b/ghc/lib/cbits/getBufferMode.lc @@ -0,0 +1,52 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1994 +% +\subsection[getBufferMode.lc]{hIs...Buffered Runtime Support} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +/* + * We try to guess what the default buffer mode is going to be based + * on the type of file we're attached to. + */ + +#define GBM_NB (0) +#define GBM_LB (-1) +#define GBM_BB (-2) +#define GBM_ERR (-3) + +StgInt +getBufferMode(fp) +StgAddr fp; +{ + struct stat sb; + + /* Try to find out the file type */ + while (fstat(fileno((FILE *) fp), &sb) < 0) { + /* highly unlikely */ + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return GBM_ERR; + } + } + /* Terminals are line-buffered by default */ + if (S_ISCHR(sb.st_mode) && isatty(fileno((FILE *) fp)) == 1) + return GBM_LB; + /* Default size block buffering for the others */ + else + return GBM_BB; +} + +\end{code} diff --git a/ghc/lib/cbits/getCurrentDirectory.lc b/ghc/lib/cbits/getCurrentDirectory.lc new file mode 100644 index 0000000..4da895a --- /dev/null +++ b/ghc/lib/cbits/getCurrentDirectory.lc @@ -0,0 +1,48 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1995 +% +\subsection[getCurrentDirectory.lc]{getCurrentDirectory Runtime Support} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" + +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + +StgAddr +getCurrentDirectory(STG_NO_ARGS) +{ + char *pwd; + int alloc; + + alloc = PATH_MAX; + if ((pwd = malloc(alloc)) == NULL) { + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "not enough virtual memory"; + return NULL; + } + while (getcwd(pwd, alloc) == NULL) { + if (errno == ERANGE) { + alloc += PATH_MAX; + if ((pwd = realloc(pwd, alloc)) == NULL) { + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "not enough virtual memory"; + return NULL; + } + } else if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return NULL; + } + } + return (StgAddr) pwd; +} + +\end{code} diff --git a/ghc/lib/cbits/getDirectoryContents.lc b/ghc/lib/cbits/getDirectoryContents.lc new file mode 100644 index 0000000..025aae9 --- /dev/null +++ b/ghc/lib/cbits/getDirectoryContents.lc @@ -0,0 +1,124 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1995 +% +\subsection[getDirectoryContents.lc]{getDirectoryContents Runtime Support} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_DIRENT_H +#include +#endif + +#ifndef LINK_MAX +#define LINK_MAX 1024 +#endif + +/* For cleanup of partial answer on error */ + +static void +freeEntries(char **entries, int count) +{ + int i; + + for (i = 0; i < count; i++) + free(entries[i]); + free(entries); +} + +/* + * Our caller expects a malloc'ed array of malloc'ed string pointers. + * To ensure consistency when mixing this with other directory + * operations, we collect the entire list in one atomic operation, + * rather than reading the directory lazily. + */ + +StgAddr +getDirectoryContents(path) +StgByteArray path; +{ + struct stat sb; + DIR *dir; + struct dirent *d; + char **entries; + int alloc, count; + + /* Check for an actual directory */ + while (stat(path, &sb) != 0) { + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return NULL; + } + } + if (!S_ISDIR(sb.st_mode)) { + ghc_errtype = ERR_INAPPROPRIATETYPE; + ghc_errstr = "not a directory"; + return NULL; + } + + alloc = LINK_MAX; + if ((entries = (char **) malloc(alloc * sizeof(char *))) == NULL) { + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "not enough virtual memory"; + return NULL; + } + + while ((dir = opendir(path)) == NULL) { + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + free(entries); + return NULL; + } + } + + count = 0; + for (;;) { + errno = 0; /* unchanged by readdir on EOF */ + while ((d = readdir(dir)) == NULL) { + if (errno == 0) { + entries[count] = NULL; + (void) closedir(dir); + return (StgAddr) entries; + } else if (errno != EINTR) { + cvtErrno(); + stdErrno(); + freeEntries(entries, count); + (void) closedir(dir); + return NULL; + } + errno = 0; + } + if ((entries[count] = malloc(strlen(d->d_name))) == NULL) { + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "not enough virtual memory"; + freeEntries(entries, count); + (void) closedir(dir); + return NULL; + } + strcpy(entries[count], d->d_name); + if (++count == alloc) { + alloc += LINK_MAX; + if ((entries = (char **) realloc(entries, alloc * sizeof(char *))) == NULL) { + ghc_errtype = ERR_RESOURCEEXHAUSTED; + ghc_errstr = "not enough virtual memory"; + freeEntries(entries, count); + (void) closedir(dir); + return NULL; + } + } + } +} + +\end{code} diff --git a/ghc/lib/cbits/stgio.h b/ghc/lib/cbits/stgio.h new file mode 100644 index 0000000..26f09ee --- /dev/null +++ b/ghc/lib/cbits/stgio.h @@ -0,0 +1,160 @@ +#ifndef STGIO_H +#define STGIO_H + +/* Decls for routines in ghc/runtime/io/ only used there. + * This file is used when compiling the Haskell library + * that _ccalls_ those routines; and when compiling those + * routines (to check consistency). + */ + +/* closeFile.lc */ +StgInt closeFile PROTO((StgAddr)); + +/* createDirectory.lc */ +StgInt createDirectory PROTO((StgByteArray)); + +/* env.lc */ +char * strDup PROTO((const char *)); +int setenviron PROTO((char **)); +int copyenv (STG_NO_ARGS); +int _setenv PROTO((char *)); +int delenv PROTO((char *)); + +/* errno.lc */ +extern int ghc_errno; +extern int ghc_errtype; +void cvtErrno(STG_NO_ARGS); +void stdErrno(STG_NO_ARGS); + +/* execvpe.lc */ +int execvpe PROTO((char *, char **, char **)); + +/* fileEOF.lc */ +StgInt fileEOF PROTO((StgAddr)); + +/* fileGetc.lc */ +StgInt fileGetc PROTO((StgAddr)); + +/* fileLookAhead.lc */ +StgInt fileLookAhead PROTO((StgAddr)); + +/* filePosn.lc */ +StgInt getFilePosn PROTO((StgAddr)); +StgInt setFilePosn PROTO((StgAddr, StgInt)); + +/* filePutc.lc */ +StgInt filePutc PROTO((StgAddr, StgInt)); + +/* fileSize.lc */ +StgInt fileSize PROTO((StgAddr, StgByteArray)); + +/* flushFile.lc */ +StgInt flushFile PROTO((StgAddr)); + +/* getBufferMode.lc */ +StgInt getBufferMode PROTO((StgAddr)); + +/* getClockTime.lc */ +StgInt getClockTime PROTO((StgByteArray, StgByteArray)); + +/* getCPUTime.lc */ +StgByteArray getCPUTime PROTO((StgByteArray)); + +/* getCurrentDirectory.lc */ +StgAddr getCurrentDirectory(STG_NO_ARGS); + +/* getDirectoryContents.lc */ +StgAddr getDirectoryContents PROTO((StgByteArray)); + +/* getLock.lc */ +int lockFile PROTO((int, int)); +void unlockFile PROTO((int)); +StgInt getLock PROTO((StgAddr, StgInt)); + +/* inputReady.lc */ +StgInt inputReady PROTO((StgAddr)); + +/* openFile.lc */ +StgAddr openFile PROTO((StgByteArray, StgByteArray)); + +/* readFile.lc */ +StgInt readBlock PROTO((StgAddr, StgAddr, StgInt)); +StgInt readLine PROTO((StgAddr, StgAddr, StgInt)); +StgInt readChar PROTO((StgAddr)); + +/* removeDirectory.lc */ +StgInt removeDirectory PROTO((StgByteArray)); + +/* removeFile.lc */ +StgInt removeFile PROTO((StgByteArray)); + +/* renameDirectory.lc */ +StgInt renameDirectory PROTO((StgByteArray, StgByteArray)); + +/* renameFile.lc */ +StgInt renameFile PROTO((StgByteArray, StgByteArray)); + +/* seekFile.lc */ +StgInt seekFile PROTO((StgAddr, StgInt, StgInt, StgByteArray)); +StgInt seekFileP PROTO((StgAddr)); + +/* setBuffering.lc */ +StgInt setBuffering PROTO((StgAddr, StgInt)); + +/* setCurrentDirectory.lc */ +StgInt setCurrentDirectory PROTO((StgByteArray)); + +/* showTime.lc */ +StgAddr showTime PROTO((StgInt, StgByteArray, StgByteArray)); + +/* system.lc */ +StgInt systemCmd PROTO((StgByteArray)); + +/* toLocalTime.lc */ +StgAddr toLocalTime PROTO((StgInt, StgByteArray, StgByteArray)); + +/* toUTCTime.lc */ +StgAddr toUTCTime PROTO((StgInt, StgByteArray, StgByteArray)); + +/* toClockSec.lc */ +StgAddr toClockSec PROTO((StgInt, StgInt, StgInt, StgInt, StgInt, StgInt, StgInt, StgByteArray)); + +/* writeFile.lc */ +StgInt writeFile PROTO((StgAddr, StgAddr, StgInt)); + +/* SOCKET THINGS ALL TOGETHER: */ + +#if 0 +LATER +/* acceptSocket.lc */ +StgInt acceptSocket(I_ sockfd, A_ peer, A_ addrlen); + +/* bindSocket.lc */ +StgInt bindSocket(I_ sockfd, A_ myaddr, I_ addrlen, I_ isUnixDomain); + +/* connectSocket.lc */ +StgInt connectSocket(I_ sockfd, A_ servaddr, I_ addrlen, I_ isUnixDomain); + +/* createSocket.lc */ +StgInt createSocket(I_ family, I_ type, I_ protocol); + +/* getPeerName.lc */ +StgInt getPeerName(int sockfd, struct sockaddr *peer, int *namelen); + +/* getSockName.lc */ +StgInt getSockName(int sockfd, struct sockaddr *peer, int *namelen); + +/* listenSocket.lc */ +StgInt listenSocket(int sockfd, int backlog); + +/* readDescriptor.lc */ +StgInt readDescriptor(int fd, char *buf, int nbytes); + +/* shutdownSocket.lc */ +StgInt shutdownSocket(int sockfd, int how); + +/* writeDescriptor.lc */ +StgInt writeDescriptor(int fd, char *buf, int nbytes); +#endif /* 0 */ + +#endif /* ! STGIO_H */ diff --git a/ghc/lib/make_extra_deps b/ghc/lib/make_extra_deps index 213f7e8..7c1f74a 100644 --- a/ghc/lib/make_extra_deps +++ b/ghc/lib/make_extra_deps @@ -24,7 +24,7 @@ while () { $copy =~ s/\.hc\b/$k.hc/; $copy =~ s/\.hi\b/$k.hi/; - print STDOUT "IfGhcBuild$k(", $copy, ")\n"; + print STDOUT "IfBuild$k(", $copy, ")\n"; } } diff --git a/ghc/mkworld/GHC_OPTS b/ghc/mkworld/GHC_OPTS index df06f3c..e0cc61c 100644 --- a/ghc/mkworld/GHC_OPTS +++ b/ghc/mkworld/GHC_OPTS @@ -2,33 +2,33 @@ each build is compiled consistently */ -GHC_OPTS_norm=-O rts_or_lib(-optc-DGCap,) -GHC_OPTS_p =-hisuf p_hi -O -prof -GPrelude rts_or_lib(-optc-DGCap,) -GHC_OPTS_t =-hisuf t_hi -O -ticky -optc-DDEBUG rts_or_lib(-optc-DGCap,) -GHC_OPTS_u =-hisuf u_hi -O -unregisterised ???? -ticky rts_or_lib(-optc-DGCap,) -GHC_OPTS_mc=-hisuf mc_hi -O -concurrent rts_or_lib(-optc-DGCap,) -GHC_OPTS_mr=-hisuf mr_hi -O -concurrent -prof -GPrelude rts_or_lib(-optc-DGCap,) -GHC_OPTS_mt=-hisuf mt_hi -O -concurrent -ticky -optc-DDEBUG rts_or_lib(-optc-DGCap,) -GHC_OPTS_mp=-hisuf mp_hi -O -parallel rts_or_lib(-optc-DGCap,) -GHC_OPTS_mg=-hisuf mg_hi -O -gransim rts_or_lib(-optc-DGCap,) -GHC_OPTS_2s=-hisuf 2s_hi -O -gc-2s rts_or_lib(-optc-DGC2s,) -GHC_OPTS_1s=-hisuf 1s_hi -O -gc-1s rts_or_lib(-optc-DGC1s,) -GHC_OPTS_du=-hisuf du_hi -O -gc-du rts_or_lib(-optc-DGCdu,) +GHC_norm_OPTS=-O rts_or_lib(-optc-DGCap,) +GHC_p_OPTS =-hisuf p_hi -O -prof -GPrelude rts_or_lib(-optc-DGCap,) +GHC_t_OPTS =-hisuf t_hi -O -ticky -optc-DDEBUG rts_or_lib(-optc-DGCap,) +GHC_u_OPTS =-hisuf u_hi -O -unregisterised ???? -ticky rts_or_lib(-optc-DGCap,) +GHC_mc_OPTS=-hisuf mc_hi -O -concurrent rts_or_lib(-optc-DGCap,) +GHC_mr_OPTS=-hisuf mr_hi -O -concurrent -prof -GPrelude rts_or_lib(-optc-DGCap,) +GHC_mt_OPTS=-hisuf mt_hi -O -concurrent -ticky -optc-DDEBUG rts_or_lib(-optc-DGCap,) +GHC_mp_OPTS=-hisuf mp_hi -O -parallel rts_or_lib(-optc-DGCap,) +GHC_mg_OPTS=-hisuf mg_hi -O -gransim rts_or_lib(-optc-DGCap,) +GHC_2s_OPTS=-hisuf 2s_hi -O -gc-2s rts_or_lib(-optc-DGC2s,) +GHC_1s_OPTS=-hisuf 1s_hi -O -gc-1s rts_or_lib(-optc-DGC1s,) +GHC_du_OPTS=-hisuf du_hi -O -gc-du rts_or_lib(-optc-DGCdu,) /* ToDo: mkworld-ify these user-way opts */ -GHC_OPTS_a =-hisuf a_hi -user-setup-a rts_or_lib(-optc-DGCap,) -GHC_OPTS_b =-hisuf b_hi -user-setup-b rts_or_lib(-optc-DGCap,) -GHC_OPTS_c =-hisuf c_hi -user-setup-c rts_or_lib(-optc-DGCap,) -GHC_OPTS_d =-hisuf d_hi -user-setup-d rts_or_lib(-optc-DGCap,) -GHC_OPTS_e =-hisuf e_hi -user-setup-e rts_or_lib(-optc-DGCap,) -GHC_OPTS_f =-hisuf f_hi -user-setup-f rts_or_lib(-optc-DGCap,) -GHC_OPTS_g =-hisuf g_hi -user-setup-g rts_or_lib(-optc-DGCap,) -GHC_OPTS_h =-hisuf h_hi -user-setup-h rts_or_lib(-optc-DGCap,) -GHC_OPTS_i =-hisuf i_hi -user-setup-i rts_or_lib(-optc-DGCap,) -GHC_OPTS_j =-hisuf j_hi -user-setup-j rts_or_lib(-optc-DGCap,) -GHC_OPTS_k =-hisuf k_hi -user-setup-k rts_or_lib(-optc-DGCap,) -GHC_OPTS_l =-hisuf l_hi -user-setup-l rts_or_lib(-optc-DGCap,) -GHC_OPTS_m =-hisuf m_hi -user-setup-m rts_or_lib(-optc-DGCap,) -GHC_OPTS_n =-hisuf n_hi -user-setup-n rts_or_lib(-optc-DGCap,) -GHC_OPTS_o =-hisuf o_hi -user-setup-o rts_or_lib(-optc-DGCap,) -GHC_OPTS_A =-hisuf A_hi -user-setup-A rts_or_lib(-optc-DGCap,) -GHC_OPTS_B =-hisuf B_hi -user-setup-B rts_or_lib(-optc-DGCap,) +GHC_a_OPTS =-hisuf a_hi -user-setup-a rts_or_lib(-optc-DGCap,) +GHC_b_OPTS =-hisuf b_hi -user-setup-b rts_or_lib(-optc-DGCap,) +GHC_c_OPTS =-hisuf c_hi -user-setup-c rts_or_lib(-optc-DGCap,) +GHC_d_OPTS =-hisuf d_hi -user-setup-d rts_or_lib(-optc-DGCap,) +GHC_e_OPTS =-hisuf e_hi -user-setup-e rts_or_lib(-optc-DGCap,) +GHC_f_OPTS =-hisuf f_hi -user-setup-f rts_or_lib(-optc-DGCap,) +GHC_g_OPTS =-hisuf g_hi -user-setup-g rts_or_lib(-optc-DGCap,) +GHC_h_OPTS =-hisuf h_hi -user-setup-h rts_or_lib(-optc-DGCap,) +GHC_i_OPTS =-hisuf i_hi -user-setup-i rts_or_lib(-optc-DGCap,) +GHC_j_OPTS =-hisuf j_hi -user-setup-j rts_or_lib(-optc-DGCap,) +GHC_k_OPTS =-hisuf k_hi -user-setup-k rts_or_lib(-optc-DGCap,) +GHC_l_OPTS =-hisuf l_hi -user-setup-l rts_or_lib(-optc-DGCap,) +GHC_m_OPTS =-hisuf m_hi -user-setup-m rts_or_lib(-optc-DGCap,) +GHC_n_OPTS =-hisuf n_hi -user-setup-n rts_or_lib(-optc-DGCap,) +GHC_o_OPTS =-hisuf o_hi -user-setup-o rts_or_lib(-optc-DGCap,) +GHC_A_OPTS =-hisuf A_hi -user-setup-A rts_or_lib(-optc-DGCap,) +GHC_B_OPTS =-hisuf B_hi -user-setup-B rts_or_lib(-optc-DGCap,) diff --git a/ghc/mkworld/site-ghc.jm.in b/ghc/mkworld/site-ghc.jm.in index 2fea38b..41b8289 100644 --- a/ghc/mkworld/site-ghc.jm.in +++ b/ghc/mkworld/site-ghc.jm.in @@ -65,9 +65,6 @@ #endif GHC_WITH_NATIVE_CODEGEN=GhcWithNativeCodeGen -#ifndef BuildGHCI -#define BuildGHCI @BuildGHCI@ -#endif #ifndef GhcWithDeforester #define GhcWithDeforester @GhcWithDeforester@ #endif @@ -86,91 +83,91 @@ GHC_WITH_NATIVE_CODEGEN=GhcWithNativeCodeGen do it this way, rather than AC_SUBSTing the info into this file because some sed's (notably OSF and maybe HP-UX) only allow 99 commands (!!!), which is way too few if we want to do the - GhcBuild_ stuff as well as everything else. WDP 96/04 + Build_ stuff as well as everything else. WDP 96/04 */ #include "buildinfo.jm" /* normal sequential */ -#if GhcBuild_normal == YES -# define IfGhcBuild_normal(x) x +#if Build_normal == YES +# define IfBuild_normal(x) x GHC_BUILD_FLAG_normal = -build-normal-defined #else -# define IfGhcBuild_normal(x) /**/ +# define IfBuild_normal(x) /**/ GHC_BUILD_FLAG_normal = -build-normal-not-defined #endif /* profiled sequential */ -#if GhcBuild_p == YES -# define IfGhcBuild_p(x) x +#if Build_p == YES +# define IfBuild_p(x) x GHC_BUILD_FLAG_p = -build-p-defined #else -# define IfGhcBuild_p(x) /**/ +# define IfBuild_p(x) /**/ GHC_BUILD_FLAG_p = -build-p-not-defined #endif /* ticky-ticky "profiling" (sequential) */ -#if GhcBuild_t == YES -# define IfGhcBuild_t(x) x +#if Build_t == YES +# define IfBuild_t(x) x GHC_BUILD_FLAG_t = -build-t-defined #else -# define IfGhcBuild_t(x) /**/ +# define IfBuild_t(x) /**/ GHC_BUILD_FLAG_t = -build-t-not-defined #endif /* unregisterized (most basic boot) */ -#if GhcBuild_u == YES -# define IfGhcBuild_u(x) x +#if Build_u == YES +# define IfBuild_u(x) x GHC_BUILD_FLAG_u = -build-u-defined #else -# define IfGhcBuild_u(x) /**/ +# define IfBuild_u(x) /**/ GHC_BUILD_FLAG_u = -build-u-not-defined #endif /* === builds: concurrent and parallel ============================ */ /* concurrent */ -#if GhcBuild_mc == YES -# define IfGhcBuild_mc(x) x +#if Build_mc == YES +# define IfBuild_mc(x) x GHC_BUILD_FLAG_mc = -build-mc-defined #else -# define IfGhcBuild_mc(x) /**/ +# define IfBuild_mc(x) /**/ GHC_BUILD_FLAG_mc = -build-mc-not-defined #endif /* profiled concurrent */ -#if GhcBuild_mr == YES -# define IfGhcBuild_mr(x) x +#if Build_mr == YES +# define IfBuild_mr(x) x GHC_BUILD_FLAG_mr = -build-mr-defined #else -# define IfGhcBuild_mr(x) /**/ +# define IfBuild_mr(x) /**/ GHC_BUILD_FLAG_mr = -build-mr-not-defined #endif /* ticky concurrent */ -#if GhcBuild_mt == YES -# define IfGhcBuild_mt(x) x +#if Build_mt == YES +# define IfBuild_mt(x) x GHC_BUILD_FLAG_mt = -build-mt-defined #else -# define IfGhcBuild_mt(x) /**/ +# define IfBuild_mt(x) /**/ GHC_BUILD_FLAG_mt = -build-mt-not-defined #endif /* parallel (GUM, PVM-based) */ -#if GhcBuild_mp == YES -# define IfGhcBuild_mp(x) x +#if Build_mp == YES +# define IfBuild_mp(x) x GHC_BUILD_FLAG_mp = -build-mp-defined #else -# define IfGhcBuild_mp(x) /**/ +# define IfBuild_mp(x) /**/ GHC_BUILD_FLAG_mp = -build-mp-not-defined #endif /* GranSim */ -#if GhcBuild_mg == YES -# define IfGhcBuild_mg(x) x +#if Build_mg == YES +# define IfBuild_mg(x) x GHC_BUILD_FLAG_mg = -build-mg-defined #else -# define IfGhcBuild_mg(x) /**/ +# define IfBuild_mg(x) /**/ GHC_BUILD_FLAG_mg = -build-mg-not-defined #endif @@ -180,200 +177,200 @@ GHC_BUILD_FLAG_mg = -build-mg-not-defined */ /* sequential -- 2-space collector */ -#if GhcBuild_2s == YES -# define IfGhcBuild_2s(x) x +#if Build_2s == YES +# define IfBuild_2s(x) x GHC_BUILD_FLAG_2s = -gc-2s #else -# define IfGhcBuild_2s(x) /**/ +# define IfBuild_2s(x) /**/ GHC_BUILD_FLAG_2s = -build-2s-not-defined #endif /* sequential -- 1-space collector */ -#if GhcBuild_1s == YES -# define IfGhcBuild_1s(x) x +#if Build_1s == YES +# define IfBuild_1s(x) x GHC_BUILD_FLAG_1s = -gc-1s #else -# define IfGhcBuild_1s(x) /**/ +# define IfBuild_1s(x) /**/ GHC_BUILD_FLAG_1s = -build-1s-not-defined #endif /* sequential -- dual-mode collector */ -#if GhcBuild_du == YES -# define IfGhcBuild_du(x) x +#if Build_du == YES +# define IfBuild_du(x) x GHC_BUILD_FLAG_du = -gc-du #else -# define IfGhcBuild_du(x) /**/ +# define IfBuild_du(x) /**/ GHC_BUILD_FLAG_du = -build-du-not-defined #endif /* === builds: "user ways" ======================================= */ -#if GhcBuild_a == YES -# define IfGhcBuild_a(x) x +#if Build_a == YES +# define IfBuild_a(x) x GHC_BUILD_FLAG_a = -build-a-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_a = -build-a-not-defined-error #else -# define IfGhcBuild_a(x) /**/ +# define IfBuild_a(x) /**/ GHC_BUILD_FLAG_a = -build-a-not-defined GHC_BUILD_OPTS_a = -build-a-not-defined-error #endif -#if GhcBuild_b == YES -# define IfGhcBuild_b(x) x +#if Build_b == YES +# define IfBuild_b(x) x GHC_BUILD_FLAG_b = -build-b-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_b = -build-b-not-defined-error #else -# define IfGhcBuild_b(x) /**/ +# define IfBuild_b(x) /**/ GHC_BUILD_FLAG_b = -build-b-not-defined GHC_BUILD_OPTS_b = -build-b-not-defined-error #endif -#if GhcBuild_c == YES -# define IfGhcBuild_c(x) x +#if Build_c == YES +# define IfBuild_c(x) x GHC_BUILD_FLAG_c = -build-c-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_c = -build-c-not-defined-error #else -# define IfGhcBuild_c(x) /**/ +# define IfBuild_c(x) /**/ GHC_BUILD_FLAG_c = -build-c-not-defined GHC_BUILD_OPTS_c = -build-c-not-defined-error #endif -#if GhcBuild_d == YES -# define IfGhcBuild_d(x) x +#if Build_d == YES +# define IfBuild_d(x) x GHC_BUILD_FLAG_d = -build-d-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_d = -build-d-not-defined-error #else -# define IfGhcBuild_d(x) /**/ +# define IfBuild_d(x) /**/ GHC_BUILD_FLAG_d = -build-d-not-defined GHC_BUILD_OPTS_d = -build-d-not-defined-error #endif -#if GhcBuild_e == YES -# define IfGhcBuild_e(x) x +#if Build_e == YES +# define IfBuild_e(x) x GHC_BUILD_FLAG_e = -build-e-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_e = -build-e-not-defined-error #else -# define IfGhcBuild_e(x) /**/ +# define IfBuild_e(x) /**/ GHC_BUILD_FLAG_e = -build-e-not-defined GHC_BUILD_OPTS_e = -build-e-not-defined-error #endif -#if GhcBuild_f == YES -# define IfGhcBuild_f(x) x +#if Build_f == YES +# define IfBuild_f(x) x GHC_BUILD_FLAG_f = -build-f-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_f = -build-f-not-defined-error #else -# define IfGhcBuild_f(x) /**/ +# define IfBuild_f(x) /**/ GHC_BUILD_FLAG_f = -build-f-not-defined GHC_BUILD_OPTS_f = -build-f-not-defined-error #endif -#if GhcBuild_g == YES -# define IfGhcBuild_g(x) x +#if Build_g == YES +# define IfBuild_g(x) x GHC_BUILD_FLAG_g = -build-g-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_g = -build-g-not-defined-error #else -# define IfGhcBuild_g(x) /**/ +# define IfBuild_g(x) /**/ GHC_BUILD_FLAG_g = -build-g-not-defined GHC_BUILD_OPTS_g = -build-g-not-defined-error #endif -#if GhcBuild_h == YES -# define IfGhcBuild_h(x) x +#if Build_h == YES +# define IfBuild_h(x) x GHC_BUILD_FLAG_h = -build-h-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_h = -build-h-not-defined-error #else -# define IfGhcBuild_h(x) /**/ +# define IfBuild_h(x) /**/ GHC_BUILD_FLAG_h = -build-h-not-defined GHC_BUILD_OPTS_h = -build-h-not-defined-error #endif -#if GhcBuild_i == YES -# define IfGhcBuild_i(x) x +#if Build_i == YES +# define IfBuild_i(x) x GHC_BUILD_FLAG_i = -build-i-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_i = -build-i-not-defined-error #else -# define IfGhcBuild_i(x) /**/ +# define IfBuild_i(x) /**/ GHC_BUILD_FLAG_i = -build-i-not-defined GHC_BUILD_OPTS_i = -build-i-not-defined-error #endif -#if GhcBuild_j == YES -# define IfGhcBuild_j(x) x +#if Build_j == YES +# define IfBuild_j(x) x GHC_BUILD_FLAG_j = -build-j-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_j = -build-j-not-defined-error #else -# define IfGhcBuild_j(x) /**/ +# define IfBuild_j(x) /**/ GHC_BUILD_FLAG_j = -build-j-not-defined GHC_BUILD_OPTS_j = -build-j-not-defined-error #endif -#if GhcBuild_k == YES -# define IfGhcBuild_k(x) x +#if Build_k == YES +# define IfBuild_k(x) x GHC_BUILD_FLAG_k = -build-k-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_k = -build-k-not-defined-error #else -# define IfGhcBuild_k(x) /**/ +# define IfBuild_k(x) /**/ GHC_BUILD_FLAG_k = -build-k-not-defined GHC_BUILD_OPTS_k = -build-k-not-defined-error #endif -#if GhcBuild_l == YES -# define IfGhcBuild_l(x) x +#if Build_l == YES +# define IfBuild_l(x) x GHC_BUILD_FLAG_l = -build-l-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_l = -build-l-not-defined-error #else -# define IfGhcBuild_l(x) /**/ +# define IfBuild_l(x) /**/ GHC_BUILD_FLAG_l = -build-l-not-defined GHC_BUILD_OPTS_l = -build-l-not-defined-error #endif -#if GhcBuild_m == YES -# define IfGhcBuild_m(x) x +#if Build_m == YES +# define IfBuild_m(x) x GHC_BUILD_FLAG_m = -build-m-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_m = -build-m-not-defined-error #else -# define IfGhcBuild_m(x) /**/ +# define IfBuild_m(x) /**/ GHC_BUILD_FLAG_m = -build-m-not-defined GHC_BUILD_OPTS_m = -build-m-not-defined-error #endif -#if GhcBuild_n == YES -# define IfGhcBuild_n(x) x +#if Build_n == YES +# define IfBuild_n(x) x GHC_BUILD_FLAG_n = -build-n-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_n = -build-n-not-defined-error #else -# define IfGhcBuild_n(x) /**/ +# define IfBuild_n(x) /**/ GHC_BUILD_FLAG_n = -build-n-not-defined GHC_BUILD_OPTS_n = -build-n-not-defined-error #endif -#if GhcBuild_o == YES -# define IfGhcBuild_o(x) x +#if Build_o == YES +# define IfBuild_o(x) x GHC_BUILD_FLAG_o = -build-o-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_o = -build-o-not-defined-error #else -# define IfGhcBuild_o(x) /**/ +# define IfBuild_o(x) /**/ GHC_BUILD_FLAG_o = -build-o-not-defined GHC_BUILD_OPTS_o = -build-o-not-defined-error #endif -#if GhcBuild_A == YES -# define IfGhcBuild_A(x) x +#if Build_A == YES +# define IfBuild_A(x) x GHC_BUILD_FLAG_A = -build-A-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_A = -build-A-not-defined-error #else -# define IfGhcBuild_A(x) /**/ +# define IfBuild_A(x) /**/ GHC_BUILD_FLAG_A = -build-A-not-defined GHC_BUILD_OPTS_A = -build-A-not-defined-error #endif -#if GhcBuild_B == YES -# define IfGhcBuild_B(x) x +#if Build_B == YES +# define IfBuild_B(x) x GHC_BUILD_FLAG_B = -build-B-not-defined /* >>>change here<<< if required */ GHC_BUILD_OPTS_B = -build-B-not-defined-error #else -# define IfGhcBuild_B(x) /**/ +# define IfBuild_B(x) /**/ GHC_BUILD_FLAG_B = -build-B-not-defined GHC_BUILD_OPTS_B = -build-B-not-defined-error #endif diff --git a/ghc/utils/hp2ps/AreaBelow.h b/ghc/utils/hp2ps/AreaBelow.h index 3bd9c92..d7f713f 100644 --- a/ghc/utils/hp2ps/AreaBelow.h +++ b/ghc/utils/hp2ps/AreaBelow.h @@ -1,6 +1,6 @@ #ifndef AREA_BELOW_H #define AREA_BELOW_H -extern floatish AreaBelow PROTO((void)); +floatish AreaBelow PROTO((void)); #endif /* AREA_BELOW_H */ diff --git a/ghc/utils/hp2ps/AuxFile.h b/ghc/utils/hp2ps/AuxFile.h index 1118bc8..6e962c4 100644 --- a/ghc/utils/hp2ps/AuxFile.h +++ b/ghc/utils/hp2ps/AuxFile.h @@ -1,7 +1,7 @@ #ifndef AUX_FILE_H #define AUX_FILE_H -extern void PutAuxFile PROTO((FILE *)); -extern void GetAuxFile PROTO((FILE *)); +void PutAuxFile PROTO((FILE *)); +void GetAuxFile PROTO((FILE *)); #endif /* AUX_FILE_H */ diff --git a/ghc/utils/hp2ps/Axes.h b/ghc/utils/hp2ps/Axes.h index f41b9ef..e4be505 100644 --- a/ghc/utils/hp2ps/Axes.h +++ b/ghc/utils/hp2ps/Axes.h @@ -1,6 +1,6 @@ #ifndef AXES_H #define AXES_H -extern void Axes PROTO((void)); +void Axes PROTO((void)); #endif /* AXES_H */ diff --git a/ghc/utils/hp2ps/Curves.h b/ghc/utils/hp2ps/Curves.h index 4493f2d..0aa397f 100644 --- a/ghc/utils/hp2ps/Curves.h +++ b/ghc/utils/hp2ps/Curves.h @@ -1,10 +1,10 @@ #ifndef CURVES_H #define CURVES_H -extern void Curves PROTO((void)); -extern void CurvesInit PROTO((void)); +void Curves PROTO((void)); +void CurvesInit PROTO((void)); -extern floatish xpage PROTO((floatish)); -extern floatish ypage PROTO((floatish)); +floatish xpage PROTO((floatish)); +floatish ypage PROTO((floatish)); #endif /* CURVES_H */ diff --git a/ghc/utils/hp2ps/Deviation.h b/ghc/utils/hp2ps/Deviation.h index 08bed6e..14e4df1 100644 --- a/ghc/utils/hp2ps/Deviation.h +++ b/ghc/utils/hp2ps/Deviation.h @@ -1,7 +1,7 @@ #ifndef DEVIATION_H #define DEVIATION_H -extern void Deviation PROTO((void)); -extern void Identorder PROTO((int)); +void Deviation PROTO((void)); +void Identorder PROTO((int)); #endif /* DEVIATION_H */ diff --git a/ghc/utils/hp2ps/Dimensions.h b/ghc/utils/hp2ps/Dimensions.h index 1b66712..7bcc05b 100644 --- a/ghc/utils/hp2ps/Dimensions.h +++ b/ghc/utils/hp2ps/Dimensions.h @@ -16,7 +16,7 @@ extern floatish graphy0; extern floatish graphheight; extern floatish graphwidth; -extern void Dimensions PROTO((void)); -extern floatish StringSize PROTO((char *)); +void Dimensions PROTO((void)); +floatish StringSize PROTO((char *)); #endif /* DIMENSIONS_H */ diff --git a/ghc/utils/hp2ps/Error.c b/ghc/utils/hp2ps/Error.c index bdbb43d..649c82b 100644 --- a/ghc/utils/hp2ps/Error.c +++ b/ghc/utils/hp2ps/Error.c @@ -5,7 +5,7 @@ /* own stuff */ #include "Error.h" -extern void exit PROTO((int)); +void exit PROTO((int)); /*VARARGS0*/ void diff --git a/ghc/utils/hp2ps/HpFile.c b/ghc/utils/hp2ps/HpFile.c index 98b6204..adcbc15 100644 --- a/ghc/utils/hp2ps/HpFile.c +++ b/ghc/utils/hp2ps/HpFile.c @@ -9,7 +9,7 @@ #include "Utilities.h" #ifndef atof -extern double atof PROTO((const char *)); +double atof PROTO((const char *)); #endif /* own stuff already included */ diff --git a/ghc/utils/hp2ps/HpFile.h b/ghc/utils/hp2ps/HpFile.h index 919b1b4..1c43f73 100644 --- a/ghc/utils/hp2ps/HpFile.h +++ b/ghc/utils/hp2ps/HpFile.h @@ -52,21 +52,21 @@ extern token thetok; extern int linenum; extern int endfile; -extern char *TokenToString PROTO((token)); +char *TokenToString PROTO((token)); extern struct entry** identtable; extern floatish *samplemap; extern floatish *markmap; -extern void GetHpFile PROTO((FILE *)); -extern void StoreSample PROTO((struct entry *, intish, floatish)); -extern struct entry *MakeEntry PROTO((char *)); +void GetHpFile PROTO((FILE *)); +void StoreSample PROTO((struct entry *, intish, floatish)); +struct entry *MakeEntry PROTO((char *)); -extern token GetNumber PROTO((FILE *)); -extern void GetIdent PROTO((FILE *)); -extern void GetString PROTO((FILE *)); -extern boolish IsIdChar PROTO((int)); /* int is a "char" from getc */ +token GetNumber PROTO((FILE *)); +void GetIdent PROTO((FILE *)); +void GetString PROTO((FILE *)); +boolish IsIdChar PROTO((int)); /* int is a "char" from getc */ extern char *jobstring; extern char *datestring; diff --git a/ghc/utils/hp2ps/Key.h b/ghc/utils/hp2ps/Key.h index 432541e..d2a7b8e 100644 --- a/ghc/utils/hp2ps/Key.h +++ b/ghc/utils/hp2ps/Key.h @@ -1,6 +1,6 @@ #ifndef KEY_H #define KEY_H -extern void Key PROTO((void)); +void Key PROTO((void)); #endif /* KEY_H */ diff --git a/ghc/utils/hp2ps/Main.c b/ghc/utils/hp2ps/Main.c index 099b081..2e2c3cc 100644 --- a/ghc/utils/hp2ps/Main.c +++ b/ghc/utils/hp2ps/Main.c @@ -16,7 +16,7 @@ #include "Utilities.h" #ifndef atof -extern double atof PROTO((char *)); +double atof PROTO((char *)); #endif boolish pflag = 0; /* read auxiliary file */ diff --git a/ghc/utils/hp2ps/Marks.h b/ghc/utils/hp2ps/Marks.h index 07127c9..41956f6 100644 --- a/ghc/utils/hp2ps/Marks.h +++ b/ghc/utils/hp2ps/Marks.h @@ -1,6 +1,6 @@ #ifndef MARKS_H #define MARKS_H -extern void Marks PROTO((void)); +void Marks PROTO((void)); #endif /* MARKS_H */ diff --git a/ghc/utils/hp2ps/PsFile.h b/ghc/utils/hp2ps/PsFile.h index 50559d1..acec070 100644 --- a/ghc/utils/hp2ps/PsFile.h +++ b/ghc/utils/hp2ps/PsFile.h @@ -1,6 +1,6 @@ #ifndef PS_FILE_H #define PS_FILE_H -extern void PutPsFile PROTO((void)); +void PutPsFile PROTO((void)); #endif /* PS_FILE_H */ diff --git a/ghc/utils/hp2ps/Reorder.h b/ghc/utils/hp2ps/Reorder.h index 09ab359..089ef75 100644 --- a/ghc/utils/hp2ps/Reorder.h +++ b/ghc/utils/hp2ps/Reorder.h @@ -1,8 +1,8 @@ #ifndef REORDER_H #define REORDER_H -extern void Reorder PROTO((void)); -extern int OrderOf PROTO((char *)); -extern void OrderFor PROTO((char *, int)); +void Reorder PROTO((void)); +int OrderOf PROTO((char *)); +void OrderFor PROTO((char *, int)); #endif /* REORDER_H */ diff --git a/ghc/utils/hp2ps/Scale.h b/ghc/utils/hp2ps/Scale.h index a1c4051..0c19d6c 100644 --- a/ghc/utils/hp2ps/Scale.h +++ b/ghc/utils/hp2ps/Scale.h @@ -1,7 +1,7 @@ #ifndef SCALE_H #define SCALE_H -extern floatish MaxCombinedHeight PROTO((void)); -extern void Scale PROTO((void)); +floatish MaxCombinedHeight PROTO((void)); +void Scale PROTO((void)); #endif /* SCALE_H */ diff --git a/ghc/utils/hp2ps/Shade.h b/ghc/utils/hp2ps/Shade.h index 951b723..0e49c90 100644 --- a/ghc/utils/hp2ps/Shade.h +++ b/ghc/utils/hp2ps/Shade.h @@ -1,8 +1,8 @@ #ifndef SHADE_H #define SHADE_H -extern floatish ShadeOf PROTO((char *)); -extern void ShadeFor PROTO((char *, floatish)); -extern void SetPSColour PROTO((floatish)); +floatish ShadeOf PROTO((char *)); +void ShadeFor PROTO((char *, floatish)); +void SetPSColour PROTO((floatish)); #endif /* SHADE_H */ diff --git a/ghc/utils/hp2ps/TopTwenty.h b/ghc/utils/hp2ps/TopTwenty.h index 4dff203..53a7aed 100644 --- a/ghc/utils/hp2ps/TopTwenty.h +++ b/ghc/utils/hp2ps/TopTwenty.h @@ -1,6 +1,6 @@ #ifndef TOP_TWENTY_H #define TOP_TWENTY_H -extern void TopTwenty PROTO((void)); +void TopTwenty PROTO((void)); #endif /* TOP_TWENTY_H */ diff --git a/ghc/utils/hp2ps/TraceElement.h b/ghc/utils/hp2ps/TraceElement.h index d843392..03b151c 100644 --- a/ghc/utils/hp2ps/TraceElement.h +++ b/ghc/utils/hp2ps/TraceElement.h @@ -1,6 +1,6 @@ #ifndef TRACE_ELEMENT_H #define TRACE_ELEMENT_H -void TraceElement PROTO((void)); +TraceElement PROTO((void)); #endif /* TRACE_ELEMENT_H */ diff --git a/ghc/utils/hp2ps/Utilities.h b/ghc/utils/hp2ps/Utilities.h index d8195b7..d6e9a17 100644 --- a/ghc/utils/hp2ps/Utilities.h +++ b/ghc/utils/hp2ps/Utilities.h @@ -1,13 +1,13 @@ #ifndef UTILITIES_H #define UTILITIES_H -extern char* Basename PROTO((char *)); -extern void DropSuffix PROTO((char *, char *)); -extern FILE* OpenFile PROTO((char *, char *)); -extern void CommaPrint PROTO((FILE *, int)); -extern char *copystring PROTO((char *)); -extern char *copystring2 PROTO((char *, char *)); -extern void *xmalloc PROTO((int)); -extern void *xrealloc PROTO((void *, int)); +char* Basename PROTO((char *)); +void DropSuffix PROTO((char *, char *)); +FILE* OpenFile PROTO((char *, char *)); +void CommaPrint PROTO((FILE *, int)); +char *copystring PROTO((char *)); +char *copystring2 PROTO((char *, char *)); +void *xmalloc PROTO((int)); +void *xrealloc PROTO((void *, int)); #endif /* UTILITIES_H */ diff --git a/ghc/utils/ugen/funs.h b/ghc/utils/ugen/funs.h index fc105ef..7ae2f29 100644 --- a/ghc/utils/ugen/funs.h +++ b/ghc/utils/ugen/funs.h @@ -1,28 +1,28 @@ /* fwd decls*/ -extern void g_consels PROTO((tree, id)); -extern void g_tagfun PROTO((id)); -extern void g_typconsel PROTO((tree, id)); -extern void ge_typdef PROTO((tree)); -extern void ge_typlist PROTO((tree)); -extern void gencons PROTO((id, tree)); -extern void genmkfillin PROTO((tree)); -extern void genmkparamdekl PROTO((tree)); -extern void genmkparamlist PROTO((tree)); -extern void genmkprotodekl PROTO((tree)); -extern void gensels PROTO((id, id, tree)); -extern void gentype PROTO((tree)); +void g_consels PROTO((tree, id)); +void g_tagfun PROTO((id)); +void g_typconsel PROTO((tree, id)); +void ge_typdef PROTO((tree)); +void ge_typlist PROTO((tree)); +void gencons PROTO((id, tree)); +void genmkfillin PROTO((tree)); +void genmkparamdekl PROTO((tree)); +void genmkparamlist PROTO((tree)); +void genmkprotodekl PROTO((tree)); +void gensels PROTO((id, id, tree)); +void gentype PROTO((tree)); -extern void gs_def PROTO((tree, id)); -extern void gs_itemlist PROTO((tree)); -extern void gs_typlist PROTO((tree, id)); +void gs_def PROTO((tree, id)); +void gs_itemlist PROTO((tree)); +void gs_typlist PROTO((tree, id)); -extern void hs_def PROTO((tree)); -extern void hs_itemlist PROTO((tree)); -extern void hs_typlist PROTO((tree)); -extern void gen_hs_reader PROTO((id, tree)); -extern void gen_hs_rdalts PROTO((id, tree)); -extern void gen_hs_rdalt PROTO((id, tree)); -extern void gen_hs_rdcomponents PROTO((id, id, tree)); -extern void gen_hs_retcomponents PROTO((id, id, tree)); +void hs_def PROTO((tree)); +void hs_itemlist PROTO((tree)); +void hs_typlist PROTO((tree)); +void gen_hs_reader PROTO((id, tree)); +void gen_hs_rdalts PROTO((id, tree)); +void gen_hs_rdalt PROTO((id, tree)); +void gen_hs_rdcomponents PROTO((id, id, tree)); +void gen_hs_retcomponents PROTO((id, id, tree)); -extern id installid PROTO((char *)); +id installid PROTO((char *)); diff --git a/glafp-utils/scripts/mkdependC.prl b/glafp-utils/scripts/mkdependC.prl index cca167d..83a396b 100644 --- a/glafp-utils/scripts/mkdependC.prl +++ b/glafp-utils/scripts/mkdependC.prl @@ -135,7 +135,7 @@ sub slurp_file { # follows an example in the `open' item in perl man page $fname = &tidy_dir_names($fname); - unless (open($fhandle, "$(RAWCPP) $Include_dirs @Defines $fname |")) { + unless (open($fhandle, "$(GNUCPP) $Include_dirs @Defines $fname |")) { die "$Pgm: Can't open $fname: $!\n"; } line: while (<$fhandle>) {