diff options
30 files changed, 289 insertions, 196 deletions
diff --git a/compiler/ghci/keepCAFsForGHCi.c b/compiler/ghci/keepCAFsForGHCi.c index f125d4c4d0..805088e753 100644 --- a/compiler/ghci/keepCAFsForGHCi.c +++ b/compiler/ghci/keepCAFsForGHCi.c @@ -7,9 +7,9 @@ // files. #ifdef DYNAMIC -static void keepCAFsForGHCi() __attribute__((constructor)); +static void keepCAFsForGHCi(void) __attribute__((constructor)); -static void keepCAFsForGHCi() +static void keepCAFsForGHCi(void) { keepCAFs = 1; } diff --git a/compiler/main/HscMain.lhs b/compiler/main/HscMain.lhs index ff52d2de76..48f60f074b 100644 --- a/compiler/main/HscMain.lhs +++ b/compiler/main/HscMain.lhs @@ -944,8 +944,11 @@ checkSafeImports dflags hsc_env tcg_env (modulePackageId m) -- Is a module trusted? Return Nothing if True, or a String - -- if it isn't, containing the reason it isn't - isModSafe :: Module -> SrcSpan -> Hsc (Maybe SDoc) + -- if it isn't, containing the reason it isn't. Also return + -- if the module trustworthy (true) or safe (false) so we know + -- if we should check if the package itself is trusted in the + -- future. + isModSafe :: Module -> SrcSpan -> Hsc (Maybe SDoc, Bool) isModSafe m l = do iface <- lookup' m case iface of @@ -963,11 +966,12 @@ checkSafeImports dflags hsc_env tcg_env -- check package is trusted safeP = packageTrusted trust trust_own_pkg m if safeM && safeP - then return Nothing - else return $ Just $ if safeM - then text "The package (" <> ppr (modulePackageId m) <> - text ") the module resides in isn't trusted." - else text "The module itself isn't safe." + then return (Nothing, trust == Sf_Trustworthy) + else let err = Just $ if safeM + then text "The package (" <> ppr (modulePackageId m) <> + text ") the module resides in isn't trusted." + else text "The module itself isn't safe." + in return (err, False) -- Here we check the transitive package trust requirements are OK still. checkPkgTrust :: [PackageId] -> Hsc () @@ -988,14 +992,15 @@ checkSafeImports dflags hsc_env tcg_env checkSafe :: (Module, SrcSpan, IsSafeImport) -> Hsc (Maybe PackageId) checkSafe (_, _, False) = return Nothing checkSafe (m, l, True ) = do - module_safe <- isModSafe m l + (module_safe, tw) <- isModSafe m l case module_safe of - Nothing -> return pkg + Nothing -> return $ pkg tw Just s -> liftIO $ throwIO $ mkSrcErr $ unitBag $ mkPlainErrMsg l $ ppr m <+> text "can't be safely imported!" <+> s - where pkg | isHomePkg m = Nothing - | otherwise = Just (modulePackageId m) + where pkg False = Nothing + pkg True | isHomePkg m = Nothing + | otherwise = Just (modulePackageId m) -------------------------------------------------------------- -- Simplifiers diff --git a/compiler/prelude/PrelNames.lhs b/compiler/prelude/PrelNames.lhs index c5f123d61c..d677c74000 100644 --- a/compiler/prelude/PrelNames.lhs +++ b/compiler/prelude/PrelNames.lhs @@ -289,7 +289,7 @@ pRELUDE = mkBaseModule_ pRELUDE_NAME gHC_PRIM, gHC_TYPES, gHC_UNIT, gHC_ORDERING, gHC_GENERICS, gHC_MAGIC, gHC_CLASSES, gHC_BASE, gHC_ENUM, gHC_CSTRING, - gHC_SHOW, gHC_READ, gHC_NUM, gHC_INTEGER, gHC_INTEGER_TYPE, gHC_LIST, + gHC_SHOW, gHC_READ, gHC_NUM, gHC_INTEGER_TYPE, gHC_LIST, gHC_TUPLE, dATA_TUPLE, dATA_EITHER, dATA_STRING, dATA_FOLDABLE, dATA_TRAVERSABLE, gHC_CONC, gHC_IO, gHC_IO_Exception, gHC_ST, gHC_ARR, gHC_STABLE, gHC_PTR, gHC_ERR, gHC_REAL, @@ -312,7 +312,6 @@ gHC_ENUM = mkBaseModule (fsLit "GHC.Enum") gHC_SHOW = mkBaseModule (fsLit "GHC.Show") gHC_READ = mkBaseModule (fsLit "GHC.Read") gHC_NUM = mkBaseModule (fsLit "GHC.Num") -gHC_INTEGER = mkIntegerModule (fsLit "GHC.Integer") gHC_INTEGER_TYPE= mkIntegerModule (fsLit "GHC.Integer.Type") gHC_LIST = mkBaseModule (fsLit "GHC.List") gHC_TUPLE = mkPrimModule (fsLit "GHC.Tuple") @@ -799,30 +798,30 @@ integerTyConName, plusIntegerName, timesIntegerName, smallIntegerName, andIntegerName, orIntegerName, xorIntegerName, complementIntegerName, shiftLIntegerName, shiftRIntegerName :: Name integerTyConName = tcQual gHC_INTEGER_TYPE (fsLit "Integer") integerTyConKey -plusIntegerName = varQual gHC_INTEGER (fsLit "plusInteger") plusIntegerIdKey -timesIntegerName = varQual gHC_INTEGER (fsLit "timesInteger") timesIntegerIdKey -smallIntegerName = varQual gHC_INTEGER (fsLit "smallInteger") smallIntegerIdKey -integerToWordName = varQual gHC_INTEGER (fsLit "integerToWord") integerToWordIdKey -integerToIntName = varQual gHC_INTEGER (fsLit "integerToInt") integerToIntIdKey -minusIntegerName = varQual gHC_INTEGER (fsLit "minusInteger") minusIntegerIdKey -negateIntegerName = varQual gHC_INTEGER (fsLit "negateInteger") negateIntegerIdKey -eqIntegerName = varQual gHC_INTEGER (fsLit "eqInteger") eqIntegerIdKey -neqIntegerName = varQual gHC_INTEGER (fsLit "neqInteger") neqIntegerIdKey -absIntegerName = varQual gHC_INTEGER (fsLit "absInteger") absIntegerIdKey -signumIntegerName = varQual gHC_INTEGER (fsLit "signumInteger") signumIntegerIdKey -leIntegerName = varQual gHC_INTEGER (fsLit "leInteger") leIntegerIdKey -gtIntegerName = varQual gHC_INTEGER (fsLit "gtInteger") gtIntegerIdKey -ltIntegerName = varQual gHC_INTEGER (fsLit "ltInteger") ltIntegerIdKey -geIntegerName = varQual gHC_INTEGER (fsLit "geInteger") geIntegerIdKey -compareIntegerName = varQual gHC_INTEGER (fsLit "compareInteger") compareIntegerIdKey -gcdIntegerName = varQual gHC_INTEGER (fsLit "gcdInteger") gcdIntegerIdKey -lcmIntegerName = varQual gHC_INTEGER (fsLit "lcmInteger") lcmIntegerIdKey -andIntegerName = varQual gHC_INTEGER (fsLit "andInteger") andIntegerIdKey -orIntegerName = varQual gHC_INTEGER (fsLit "orInteger") orIntegerIdKey -xorIntegerName = varQual gHC_INTEGER (fsLit "xorInteger") xorIntegerIdKey -complementIntegerName = varQual gHC_INTEGER (fsLit "complementInteger") complementIntegerIdKey -shiftLIntegerName = varQual gHC_INTEGER (fsLit "shiftLInteger") shiftLIntegerIdKey -shiftRIntegerName = varQual gHC_INTEGER (fsLit "shiftRInteger") shiftRIntegerIdKey +plusIntegerName = varQual gHC_INTEGER_TYPE (fsLit "plusInteger") plusIntegerIdKey +timesIntegerName = varQual gHC_INTEGER_TYPE (fsLit "timesInteger") timesIntegerIdKey +smallIntegerName = varQual gHC_INTEGER_TYPE (fsLit "smallInteger") smallIntegerIdKey +integerToWordName = varQual gHC_INTEGER_TYPE (fsLit "integerToWord") integerToWordIdKey +integerToIntName = varQual gHC_INTEGER_TYPE (fsLit "integerToInt") integerToIntIdKey +minusIntegerName = varQual gHC_INTEGER_TYPE (fsLit "minusInteger") minusIntegerIdKey +negateIntegerName = varQual gHC_INTEGER_TYPE (fsLit "negateInteger") negateIntegerIdKey +eqIntegerName = varQual gHC_INTEGER_TYPE (fsLit "eqInteger") eqIntegerIdKey +neqIntegerName = varQual gHC_INTEGER_TYPE (fsLit "neqInteger") neqIntegerIdKey +absIntegerName = varQual gHC_INTEGER_TYPE (fsLit "absInteger") absIntegerIdKey +signumIntegerName = varQual gHC_INTEGER_TYPE (fsLit "signumInteger") signumIntegerIdKey +leIntegerName = varQual gHC_INTEGER_TYPE (fsLit "leInteger") leIntegerIdKey +gtIntegerName = varQual gHC_INTEGER_TYPE (fsLit "gtInteger") gtIntegerIdKey +ltIntegerName = varQual gHC_INTEGER_TYPE (fsLit "ltInteger") ltIntegerIdKey +geIntegerName = varQual gHC_INTEGER_TYPE (fsLit "geInteger") geIntegerIdKey +compareIntegerName = varQual gHC_INTEGER_TYPE (fsLit "compareInteger") compareIntegerIdKey +gcdIntegerName = varQual gHC_INTEGER_TYPE (fsLit "gcdInteger") gcdIntegerIdKey +lcmIntegerName = varQual gHC_INTEGER_TYPE (fsLit "lcmInteger") lcmIntegerIdKey +andIntegerName = varQual gHC_INTEGER_TYPE (fsLit "andInteger") andIntegerIdKey +orIntegerName = varQual gHC_INTEGER_TYPE (fsLit "orInteger") orIntegerIdKey +xorIntegerName = varQual gHC_INTEGER_TYPE (fsLit "xorInteger") xorIntegerIdKey +complementIntegerName = varQual gHC_INTEGER_TYPE (fsLit "complementInteger") complementIntegerIdKey +shiftLIntegerName = varQual gHC_INTEGER_TYPE (fsLit "shiftLInteger") shiftLIntegerIdKey +shiftRIntegerName = varQual gHC_INTEGER_TYPE (fsLit "shiftRInteger") shiftRIntegerIdKey -- GHC.Real types and classes rationalTyConName, ratioTyConName, ratioDataConName, realClassName, diff --git a/compiler/typecheck/TcInteract.lhs b/compiler/typecheck/TcInteract.lhs index 4c450f7557..983df3c503 100644 --- a/compiler/typecheck/TcInteract.lhs +++ b/compiler/typecheck/TcInteract.lhs @@ -111,7 +111,7 @@ updCCanMap (a,ct) cmap Given {} -> cmap { cts_given = insert_into (cts_given cmap) } Derived {} -> cmap { cts_derived = insert_into (cts_derived cmap) } where - insert_into m = addToUFM_C unionBags m a (singleCCan ct) + insert_into m = addToUFM_C (flip unionBags) m a (singleCCan ct) getRelevantCts :: Uniquable a => a -> CCanMap a -> (CanonicalCts, CCanMap a) -- Gets the relevant constraints and returns the rest of the CCanMap diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index facba914c2..a37800458b 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -50,7 +50,36 @@ AC_PATH_PROG(SedCmd,gsed sed,sed) # dnl ** How to invoke gcc/cpp ** # -FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc]) +if test "$TargetOS_CPP" = "darwin" +then + AC_MSG_CHECKING(XCode version) + XCodeVersion=`xcodebuild -version | grep Xcode | sed "s/Xcode //"` + # Old XCode versions don't actually give the XCode version + if test "$XCodeVersion" = "" + then + AC_MSG_RESULT(not found (too old?)) + else + AC_MSG_RESULT($XCodeVersion) + XCodeVersion1=`echo "$XCodeVersion" | sed 's/\..*//'` +changequote(, )dnl + XCodeVersion2=`echo "$XCodeVersion" | sed 's/[^.]*\.\([^.]*\).*/\1/'` +changequote([, ])dnl + AC_MSG_NOTICE(XCode version component 1: $XCodeVersion1) + AC_MSG_NOTICE(XCode version component 2: $XCodeVersion2) + fi +fi + +dnl ** Which gcc to use? +dnl -------------------------------------------------------------- +if test "$TargetOS_CPP" = "darwin" && + test "$XCodeVersion1" -ge 4 +then + # From Xcode 4, use 'gcc-4.2' to force the use of the gcc legacy backend (instead of the LLVM + # backend) + FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc-4.2]) +else + FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc]) +fi export CC WhatGccIsCalled="$CC" AC_SUBST(WhatGccIsCalled) diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h index 3c6e6f6e26..e57ffd23cf 100644 --- a/includes/rts/storage/GC.h +++ b/includes/rts/storage/GC.h @@ -181,6 +181,50 @@ void setKeepCAFs (void); Stats -------------------------------------------------------------------------- */ +typedef struct _GCStats { + StgWord64 bytes_allocated; + StgWord64 num_gcs; + StgWord64 num_byte_usage_samples; + StgWord64 max_bytes_used; + StgWord64 cumulative_bytes_used; + StgWord64 bytes_copied; + StgWord64 current_bytes_used; + StgWord64 current_bytes_slop; + StgWord64 max_bytes_slop; + StgWord64 peak_megabytes_allocated; + StgWord64 par_avg_bytes_copied; + StgWord64 par_max_bytes_copied; + StgDouble mutator_cpu_seconds; + StgDouble mutator_wall_seconds; + StgDouble gc_cpu_seconds; + StgDouble gc_wall_seconds; +} GCStats; +void getGCStats (GCStats *s); + +// These don't change over execution, so do them elsewhere +// StgDouble init_cpu_seconds; +// StgDouble init_wall_seconds; + +typedef struct _ParGCStats { + StgWord64 avg_copied; + StgWord64 max_copied; +} ParGCStats; +void getParGCStats (ParGCStats *s); + +/* +typedef struct _TaskStats { + StgWord64 mut_time; + StgWord64 mut_etime; + StgWord64 gc_time; + StgWord64 gc_etime; +} TaskStats; +// would need to allocate arbitrarily large amount of memory +// because it's a linked list of results +void getTaskStats (TaskStats **s); +// Need to stuff SparkCounters in a public header file... +void getSparkStats (SparkCounters *s); +*/ + // Returns the total number of bytes allocated since the start of the program. HsInt64 getAllocations (void); diff --git a/rts/Linker.c b/rts/Linker.c index 781f705536..f5b90d41b9 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -793,6 +793,7 @@ typedef struct _RtsSymbolVal { SymI_HasProto(getOrSetGHCConcWindowsProddingStore) \ SymI_HasProto(getOrSetSystemEventThreadEventManagerStore) \ SymI_HasProto(getOrSetSystemEventThreadIOManagerThreadStore) \ + SymI_HasProto(getGCStats) \ SymI_HasProto(genSymZh) \ SymI_HasProto(genericRaise) \ SymI_HasProto(getProgArgv) \ diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index fcc1f49a36..eda327dd50 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -236,6 +236,7 @@ usage_text[] = { " -I<sec> Perform full GC after <sec> idle time (default: 0.3, 0 == off)", #endif "", +" -T Collect GC statistics (useful for in-program statistics access)" " -t[<file>] One-line GC statistics (if <file> omitted, uses stderr)", " -s[<file>] Summary GC statistics (if <file> omitted, uses stderr)", " -S[<file>] Detailed GC statistics (if <file> omitted, uses stderr)", @@ -841,6 +842,10 @@ error = rtsTrue; } break; + case 'T': + RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS; + break; /* Don't initialize statistics file. */ + case 'S': RtsFlags.GcFlags.giveStats = VERBOSE_GC_STATS; goto stats; diff --git a/rts/Stats.c b/rts/Stats.c index c071ec0202..ebe239f06e 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -56,9 +56,12 @@ static Ticks HCe_start_time, HCe_tot_time = 0; // heap census prof elap time #define PROF_VAL(x) 0 #endif -static lnat max_residency = 0; // in words; for stats only +// current = current as of last GC +static lnat current_residency = 0; // in words; for stats only +static lnat max_residency = 0; static lnat cumulative_residency = 0; static lnat residency_samples = 0; // for stats only +static lnat current_slop = 0; static lnat max_slop = 0; static lnat GC_end_faults = 0; @@ -367,6 +370,7 @@ stat_endGC (gc_thread *gct, if (live > max_residency) { max_residency = live; } + current_residency = live; residency_samples++; cumulative_residency += live; } @@ -510,6 +514,9 @@ StgInt TOTAL_CALLS=1; statsPrintf(" (SLOW_CALLS_" #arity ") %% of (TOTAL_CALLS) : %.1f%%\n", \ SLOW_CALLS_##arity * 100.0/TOTAL_CALLS) +static inline Ticks get_init_cpu(void) { return end_init_cpu - start_init_cpu; } +static inline Ticks get_init_elapsed(void) { return end_init_elapsed - start_init_elapsed; } + void stat_exit(int alloc) { @@ -553,8 +560,8 @@ stat_exit(int alloc) gc_elapsed += GC_coll_elapsed[i]; } - init_cpu = end_init_cpu - start_init_cpu; - init_elapsed = end_init_elapsed - start_init_elapsed; + init_cpu = get_init_cpu(); + init_elapsed = get_init_elapsed(); exit_cpu = end_exit_cpu - start_exit_cpu; exit_elapsed = end_exit_elapsed - start_exit_elapsed; @@ -844,6 +851,70 @@ statDescribeGens(void) extern HsInt64 getAllocations( void ) { return (HsInt64)GC_tot_alloc * sizeof(W_); } +/* EZY: I'm not convinced I got all the casting right. */ + +extern void getGCStats( GCStats *s ) +{ + nat total_collections = 0; + nat g; + Ticks gc_cpu = 0; + Ticks gc_elapsed = 0; + Ticks current_elapsed = 0; + Ticks current_cpu = 0; + + getProcessTimes(¤t_cpu, ¤t_elapsed); + + /* EZY: static inline'ify these */ + for (g = 0; g < RtsFlags.GcFlags.generations; g++) + total_collections += generations[g].collections; + + for (g = 0; g < RtsFlags.GcFlags.generations; g++) { + gc_cpu += GC_coll_cpu[g]; + gc_elapsed += GC_coll_elapsed[g]; + } + + s->bytes_allocated = GC_tot_alloc*(StgWord64)sizeof(W_); + s->num_gcs = total_collections; + s->num_byte_usage_samples = residency_samples; + s->max_bytes_used = max_residency*sizeof(W_); + s->cumulative_bytes_used = cumulative_residency*(StgWord64)sizeof(W_); + s->peak_megabytes_allocated = (StgWord64)(peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)); + s->bytes_copied = GC_tot_copied*(StgWord64)sizeof(W_); + s->max_bytes_slop = max_slop*(StgWord64)sizeof(W_); + s->current_bytes_used = current_residency*(StgWord64)sizeof(W_); + s->current_bytes_slop = current_slop*(StgWord64)sizeof(W_); + /* + s->init_cpu_seconds = TICK_TO_DBL(get_init_cpu()); + s->init_wall_seconds = TICK_TO_DBL(get_init_elapsed()); + */ + s->mutator_cpu_seconds = TICK_TO_DBL(current_cpu - end_init_cpu - gc_cpu - PROF_VAL(RP_tot_time + HC_tot_time)); + s->mutator_wall_seconds = TICK_TO_DBL(current_elapsed- end_init_elapsed - gc_elapsed); + s->gc_cpu_seconds = TICK_TO_DBL(gc_cpu); + s->gc_wall_seconds = TICK_TO_DBL(gc_elapsed); + s->par_avg_bytes_copied = GC_par_avg_copied*(StgWord64)sizeof(W_); + s->par_max_bytes_copied = GC_par_max_copied*(StgWord64)sizeof(W_); +} +// extern void getTaskStats( TaskStats **s ) {} +#if 0 +extern void getSparkStats( SparkCounters *s ) { + nat i; + s->created = 0; + s->dud = 0; + s->overflowed = 0; + s->converted = 0; + s->gcd = 0; + s->fizzled = 0; + for (i = 0; i < n_capabilities; i++) { + s->created += capabilities[i].spark_stats.created; + s->dud += capabilities[i].spark_stats.dud; + s->overflowed+= capabilities[i].spark_stats.overflowed; + s->converted += capabilities[i].spark_stats.converted; + s->gcd += capabilities[i].spark_stats.gcd; + s->fizzled += capabilities[i].spark_stats.fizzled; + } +} +#endif + /* ----------------------------------------------------------------------------- Dumping stuff in the stats file, or via the debug message interface -------------------------------------------------------------------------- */ diff --git a/rts/hooks/OnExit.c b/rts/hooks/OnExit.c index e8019c046b..30764acba2 100644 --- a/rts/hooks/OnExit.c +++ b/rts/hooks/OnExit.c @@ -15,6 +15,6 @@ */ void -OnExitHook () +OnExitHook (void) { } diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 29cb23eb6d..cc3baeb1bb 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -101,14 +101,14 @@ waitCondition ( Condition* pCond, Mutex* pMut ) } void -yieldThread() +yieldThread(void) { sched_yield(); return; } void -shutdownThread() +shutdownThread(void) { pthread_exit(NULL); } @@ -123,7 +123,7 @@ createOSThread (OSThreadId* pId, OSThreadProc *startProc, void *param) } OSThreadId -osThreadId() +osThreadId(void) { return pthread_self(); } diff --git a/utils/hp2ps/AreaBelow.c b/utils/hp2ps/AreaBelow.c index ec80e1ed48..0ce2077772 100644 --- a/utils/hp2ps/AreaBelow.c +++ b/utils/hp2ps/AreaBelow.c @@ -15,7 +15,7 @@ */ floatish -AreaBelow() +AreaBelow(void) { intish i; intish j; diff --git a/utils/hp2ps/AuxFile.c b/utils/hp2ps/AuxFile.c index 9998d3fc13..39add0fcde 100644 --- a/utils/hp2ps/AuxFile.c +++ b/utils/hp2ps/AuxFile.c @@ -15,8 +15,7 @@ static void GetAuxLine PROTO((FILE *)); /* forward */ static void GetAuxTok PROTO((FILE *)); /* forward */ void -GetAuxFile(auxfp) - FILE* auxfp; +GetAuxFile(FILE *auxfp) { ch = ' '; endfile = 0; @@ -39,8 +38,7 @@ GetAuxFile(auxfp) */ static void -GetAuxLine(auxfp) - FILE* auxfp; +GetAuxLine(FILE *auxfp) { switch (thetok) { case X_RANGE_TOK: @@ -108,8 +106,7 @@ GetAuxLine(auxfp) * in the case of identifiers it is assigned to "theident". */ -static void GetAuxTok(auxfp) -FILE* auxfp; +static void GetAuxTok(FILE *auxfp) { while (isspace(ch)) { /* skip whitespace */ @@ -147,8 +144,7 @@ FILE* auxfp; } void -PutAuxFile(auxfp) - FILE* auxfp; +PutAuxFile(FILE *auxfp) { int i; diff --git a/utils/hp2ps/Axes.c b/utils/hp2ps/Axes.c index a2641cd676..4c2e4f5e95 100644 --- a/utils/hp2ps/Axes.c +++ b/utils/hp2ps/Axes.c @@ -21,15 +21,14 @@ static void YAxisMark PROTO((floatish, floatish, mkb)); /* forward */ static floatish Round PROTO((floatish)); /* forward */ void -Axes() +Axes(void) { XAxis(); YAxis(); } static void -XAxisMark(x, num) - floatish x; floatish num; +XAxisMark(floatish x, floatish num) { /* calibration mark */ fprintf(psfp, "%f %f moveto\n", xpage(x), ypage(0.0)); @@ -54,7 +53,7 @@ extern floatish xrange; extern char *sampleunitstring; static void -XAxis() +XAxis(void) { floatish increment, i; floatish t, x; @@ -93,8 +92,7 @@ XAxis() } static void -YAxisMark(y, num, unit) - floatish y; floatish num; mkb unit; +YAxisMark(floatish y, floatish num, mkb unit) { /* calibration mark */ fprintf(psfp, "%f %f moveto\n", xpage(0.0), ypage(y)); @@ -141,7 +139,7 @@ extern floatish yrange; extern char *valueunitstring; static void -YAxis() +YAxis(void) { floatish increment, i; floatish t, y; @@ -200,8 +198,7 @@ YAxis() static floatish OneTwoFive PROTO((floatish)); /* forward */ static floatish -Round(y) - floatish y; +Round(floatish y) { int i; @@ -228,8 +225,7 @@ Round(y) */ static floatish -OneTwoFive(y) - floatish y; +OneTwoFive(floatish y) { if (y > 4.0) { return (5.0); diff --git a/utils/hp2ps/Curves.c b/utils/hp2ps/Curves.c index ec05c98336..03952743f2 100644 --- a/utils/hp2ps/Curves.c +++ b/utils/hp2ps/Curves.c @@ -20,7 +20,7 @@ static void ShadeCurve PROTO((floatish *x, floatish *y, floatish *py, floatish shade)); void -Curves() +Curves(void) { intish i; @@ -35,8 +35,7 @@ Curves() */ static void -Curve(e) - struct entry* e; +Curve(struct entry *e) { struct chunk* ch; int j; @@ -61,8 +60,7 @@ static void SaveCurve PROTO((floatish *, floatish *)); /* forward */ */ floatish -xpage(x) - floatish x; +xpage(floatish x) { return (x + graphx0); } @@ -74,8 +72,7 @@ xpage(x) */ floatish -ypage(y) - floatish y; +ypage(floatish y) { return (y + graphy0); } @@ -87,8 +84,7 @@ ypage(y) */ static void -ShadeCurve(x, y, py, shade) - floatish *x; floatish *y; floatish *py; floatish shade; +ShadeCurve(floatish *x, floatish *y, floatish *py, floatish shade) { fprintf(psfp, "%f %f moveto\n", xpage(x[0]), ypage(py[0])); PlotCurveLeftToRight(x, py); @@ -111,8 +107,7 @@ ShadeCurve(x, y, py, shade) } static void -PlotCurveLeftToRight(x,y) - floatish *x; floatish *y; +PlotCurveLeftToRight(floatish *x, floatish *y) { intish i; @@ -122,8 +117,7 @@ PlotCurveLeftToRight(x,y) } static void -PlotCurveRightToLeft(x,y) - floatish *x; floatish *y; +PlotCurveRightToLeft(floatish *x, floatish *y) { intish i; @@ -137,8 +131,7 @@ PlotCurveRightToLeft(x,y) */ static void -SaveCurve(y, py) - floatish *y; floatish* py; +SaveCurve(floatish *y, floatish *py) { intish i; @@ -150,7 +143,7 @@ SaveCurve(y, py) extern floatish xrange; void -CurvesInit() +CurvesInit(void) { intish i; diff --git a/utils/hp2ps/Deviation.c b/utils/hp2ps/Deviation.c index ecf7faba16..fe1be70fcf 100644 --- a/utils/hp2ps/Deviation.c +++ b/utils/hp2ps/Deviation.c @@ -18,7 +18,7 @@ */ void -Deviation() +Deviation(void) { intish i; intish j; @@ -96,8 +96,7 @@ Deviation() } void -Identorder(iflag) - int iflag; /* a funny three-way flag ? WDP 95/03 */ +Identorder(int iflag) /* iflag is a funny three-way flag ? WDP 95/03 */ { int i; int j; diff --git a/utils/hp2ps/Dimensions.c b/utils/hp2ps/Dimensions.c index 878dd4efe2..a13ca33617 100644 --- a/utils/hp2ps/Dimensions.c +++ b/utils/hp2ps/Dimensions.c @@ -31,7 +31,7 @@ floatish graphwidth; static floatish KeyWidth PROTO((void)); /* forward */ void -Dimensions() +Dimensions(void) { boolish keyOnGraph; @@ -63,7 +63,7 @@ Dimensions() */ static floatish -KeyWidth() +KeyWidth(void) { intish i; floatish c; @@ -193,8 +193,7 @@ floatish fonttab[] = { #define FUDGE (2.834646 * 0.6) floatish -StringSize(s) - char* s; +StringSize(char *s) { floatish r; diff --git a/utils/hp2ps/Error.c b/utils/hp2ps/Error.c index 68f88d8c91..346e267eb1 100644 --- a/utils/hp2ps/Error.c +++ b/utils/hp2ps/Error.c @@ -37,8 +37,7 @@ Disaster(const char *fmt, ...) } void -Usage(str) - const char *str; +Usage(const char *str) { if (str) printf("error: %s\n", str); printf("usage: %s -b -d -ef -g -i -p -mn -p -s -tf -y [file[.hp]]\n", programname); diff --git a/utils/hp2ps/HpFile.c b/utils/hp2ps/HpFile.c index 787a268229..86cbfb2049 100644 --- a/utils/hp2ps/HpFile.c +++ b/utils/hp2ps/HpFile.c @@ -66,8 +66,7 @@ floatish *markmap; /* sample marks */ */ void -GetHpFile(infp) - FILE *infp; +GetHpFile(FILE *infp) { nsamples = 0; nmarks = 0; @@ -117,8 +116,7 @@ GetHpFile(infp) */ static void -GetHpLine(infp) - FILE* infp; +GetHpLine(FILE *infp) { static intish nmarkmax = 0, nsamplemax = 0; @@ -246,8 +244,7 @@ GetHpLine(infp) char * -TokenToString(t) - token t; +TokenToString(token t) { switch (t) { case EOF_TOK: return "EOF"; @@ -280,8 +277,7 @@ TokenToString(t) */ static void -GetHpTok(infp) - FILE* infp; +GetHpTok(FILE *infp) { while (isspace(ch)) { /* skip whitespace */ @@ -339,8 +335,7 @@ GetHpTok(infp) static char numberstring[ NUMBER_LENGTH - 1 ]; token -GetNumber(infp) - FILE* infp; +GetNumber(FILE *infp) { int i; int containsdot; @@ -374,8 +369,7 @@ GetNumber(infp) */ void -GetIdent(infp) - FILE *infp; +GetIdent(FILE *infp) { unsigned int i; char idbuffer[5000]; @@ -400,8 +394,7 @@ GetIdent(infp) */ void -GetString(infp) - FILE *infp; +GetString(FILE *infp) { unsigned int i; char *stringbuffer; @@ -436,8 +429,7 @@ GetString(infp) } boolish -IsIdChar(ch) - int ch; +IsIdChar(int ch) { return (!isspace(ch)); } @@ -454,8 +446,7 @@ IsIdChar(ch) static struct entry* hashtable[ N_HASH ]; static intish -Hash(s) - char *s; +Hash(char *s) { int r; @@ -474,7 +465,7 @@ Hash(s) */ static struct chunk* -MakeChunk() +MakeChunk(void) { struct chunk* ch; struct datapoint* d; @@ -496,8 +487,7 @@ MakeChunk() */ struct entry * -MakeEntry(name) - char *name; +MakeEntry(char *name) { struct entry* e; @@ -513,8 +503,7 @@ MakeEntry(name) */ static struct entry * -GetEntry(name) - char* name; +GetEntry(char *name) { intish h; struct entry* e; @@ -544,8 +533,7 @@ GetEntry(name) */ void -StoreSample(en, bucket, value) - struct entry* en; intish bucket; floatish value; +StoreSample(struct entry *en, intish bucket, floatish value) { struct chunk* chk; @@ -575,7 +563,7 @@ struct entry** identtable; */ static void -MakeIdentTable() +MakeIdentTable(void) { intish i; intish j; diff --git a/utils/hp2ps/Key.c b/utils/hp2ps/Key.c index 314a682dd6..5fa76ab6d7 100644 --- a/utils/hp2ps/Key.c +++ b/utils/hp2ps/Key.c @@ -12,7 +12,7 @@ static void KeyEntry PROTO((floatish, char *, floatish)); -void Key() +void Key(void) { intish i; floatish c; @@ -39,8 +39,7 @@ void Key() static void -KeyEntry(centreline, name, colour) - floatish centreline; char* name; floatish colour; +KeyEntry(floatish centreline, char *name, floatish colour) { floatish namebase; floatish keyboxbase; diff --git a/utils/hp2ps/Main.c b/utils/hp2ps/Main.c index 947ff46731..1c21d2b2cb 100644 --- a/utils/hp2ps/Main.c +++ b/utils/hp2ps/Main.c @@ -63,9 +63,7 @@ intish nidents; floatish THRESHOLD_PERCENT = DEFAULT_THRESHOLD; int TWENTY = DEFAULT_TWENTY; -int main(argc, argv) -int argc; -char* argv[]; +int main(int argc, char *argv[]) { programname = copystring(Basename(argv[0])); @@ -195,8 +193,7 @@ typedef enum {POINTS, INCHES, MILLIMETRES} pim; static pim Units PROTO((char *)); /* forward */ static floatish -WidthInPoints(wstr) - char *wstr; +WidthInPoints(char *wstr) { floatish result; @@ -221,8 +218,7 @@ WidthInPoints(wstr) static pim -Units(wstr) - char* wstr; +Units(char *wstr) { int i; @@ -240,8 +236,7 @@ int i; } static FILE * -Fp(rootname, filename, suffix, mode) - char* rootname; char** filename; char* suffix; char* mode; +Fp(char *rootname, char **filename, char *suffix, char *mode) { *filename = copystring2(rootname, suffix); diff --git a/utils/hp2ps/Marks.c b/utils/hp2ps/Marks.c index 8d6f924e17..feb341ee03 100644 --- a/utils/hp2ps/Marks.c +++ b/utils/hp2ps/Marks.c @@ -10,7 +10,7 @@ static void Caret PROTO((floatish, floatish, floatish)); void -Marks() +Marks(void) { intish i; floatish m; @@ -27,8 +27,7 @@ Marks() */ static void -Caret(x,y,d) - floatish x; floatish y; floatish d; +Caret(floatish x, floatish y, floatish d) { fprintf(psfp, "%f %f moveto\n", x - d, y); fprintf(psfp, "%f %f rlineto\n", d, -d); diff --git a/utils/hp2ps/PsFile.c b/utils/hp2ps/PsFile.c index 1324da6f08..6013a073e4 100644 --- a/utils/hp2ps/PsFile.c +++ b/utils/hp2ps/PsFile.c @@ -21,7 +21,7 @@ static void TitleOutlineBox PROTO((void)); /* forward */ static void BigTitleText PROTO((void)); /* forward */ static void TitleText PROTO((void)); /* forward */ -static void DoTitleAndBox() +static void DoTitleAndBox(void) { BorderOutlineBox(); @@ -37,14 +37,14 @@ static void DoTitleAndBox() static void Landscape PROTO((void)); /* forward */ static void Portrait PROTO((void)); /* forward */ -void NextPage() { +void NextPage(void) { fprintf(psfp, "showpage\n"); if (gflag) Portrait(); else Landscape(); DoTitleAndBox(); } void -PutPsFile() +PutPsFile(void) { Prologue(); Variables(); @@ -75,7 +75,7 @@ static void EPSFSpecialComments PROTO((floatish)); /* forward */ static void Scaling PROTO((floatish)); /* forward */ static void -Prologue() +Prologue(void) { if (eflag) { floatish epsfscale = epsfwidth / (floatish) borderwidth; @@ -91,7 +91,7 @@ extern char *jobstring; extern char *datestring; static void -StandardSpecialComments() +StandardSpecialComments(void) { fprintf(psfp, "%%!PS-Adobe-2.0\n"); fprintf(psfp, "%%%%Title: %s\n", jobstring); @@ -101,8 +101,7 @@ StandardSpecialComments() } static void -EPSFSpecialComments(epsfscale) - floatish epsfscale; +EPSFSpecialComments(floatish epsfscale) { fprintf(psfp, "%%!PS-Adobe-2.0\n"); fprintf(psfp, "%%%%Title: %s\n", jobstring); @@ -117,7 +116,7 @@ EPSFSpecialComments(epsfscale) static void -Landscape() +Landscape(void) { fprintf(psfp, "-90 rotate\n"); fprintf(psfp, "%f %f translate\n", -(borderwidth + (floatish) START_Y), @@ -125,21 +124,20 @@ Landscape() } static void -Portrait() +Portrait(void) { fprintf(psfp, "%f %f translate\n", (floatish) START_X, (floatish) START_Y); } static void -Scaling(epsfscale) - floatish epsfscale; +Scaling(floatish epsfscale) { fprintf(psfp, "%f %f scale\n", epsfscale, epsfscale); } static void -Variables() +Variables(void) { fprintf(psfp, "/HE%d /Helvetica findfont %d scalefont def\n", NORMAL_FONT, NORMAL_FONT); @@ -150,7 +148,7 @@ Variables() static void -BorderOutlineBox() +BorderOutlineBox(void) { fprintf(psfp, "newpath\n"); fprintf(psfp, "0 0 moveto\n"); @@ -163,7 +161,7 @@ BorderOutlineBox() } static void -BigTitleOutlineBox() +BigTitleOutlineBox(void) { fprintf(psfp, "newpath\n"); fprintf(psfp, "%f %f moveto\n", borderspace, @@ -183,7 +181,7 @@ BigTitleOutlineBox() static void -TitleOutlineBox() +TitleOutlineBox(void) { fprintf(psfp, "newpath\n"); fprintf(psfp, "%f %f moveto\n", borderspace, @@ -199,7 +197,7 @@ TitleOutlineBox() static void EscapePrint PROTO((char *, int)); /* forward */ static void -BigTitleText() +BigTitleText(void) { floatish x, y; @@ -238,7 +236,7 @@ BigTitleText() static void -TitleText() +TitleText(void) { floatish x, y; @@ -283,8 +281,7 @@ TitleText() */ static void -EscapePrint(s,w) - char* s; int w; +EscapePrint(char *s, int w) { for ( ; *s && w > 0; s++, w--) { if (*s == '(') { /* escape required */ diff --git a/utils/hp2ps/Reorder.c b/utils/hp2ps/Reorder.c index afeed52d85..2a7fb98375 100644 --- a/utils/hp2ps/Reorder.c +++ b/utils/hp2ps/Reorder.c @@ -20,9 +20,7 @@ static int ordermapindex = 0; void -OrderFor(ident, order) - char* ident; - int order; +OrderFor(char *ident, int order) { if (! ordermap) { ordermapmax = (nidents > TWENTY ? nidents : TWENTY) * 2; @@ -46,8 +44,7 @@ OrderFor(ident, order) */ int -OrderOf(ident) - char* ident; +OrderOf(char *ident) { int i; @@ -65,7 +62,7 @@ OrderOf(ident) */ void -Reorder() +Reorder(void) { intish i; intish j; diff --git a/utils/hp2ps/Scale.c b/utils/hp2ps/Scale.c index 32120407b3..a471bde47e 100644 --- a/utils/hp2ps/Scale.c +++ b/utils/hp2ps/Scale.c @@ -18,7 +18,7 @@ */ floatish -MaxCombinedHeight() +MaxCombinedHeight(void) { intish i; intish j; @@ -64,7 +64,7 @@ extern floatish xrange; extern floatish yrange; void -Scale() +Scale(void) { intish i; intish j; diff --git a/utils/hp2ps/Shade.c b/utils/hp2ps/Shade.c index 9e3274bf69..d67faee92f 100644 --- a/utils/hp2ps/Shade.c +++ b/utils/hp2ps/Shade.c @@ -22,9 +22,7 @@ static int shademapindex = 0; */ void -ShadeFor(ident, shade) - char* ident; - floatish shade; +ShadeFor(char *ident, floatish shade) { if (! shademap) { shademapmax = (nidents > TWENTY ? nidents : TWENTY) * 2; @@ -51,8 +49,7 @@ ShadeFor(ident, shade) static floatish ThinkOfAShade PROTO((void)); /* forward */ floatish -ShadeOf(ident) - char* ident; +ShadeOf(char *ident) { int i; floatish shade; @@ -93,7 +90,7 @@ static floatish c_shades[ N_COLOUR_SHADES ] = { }; static floatish -ThinkOfAShade() +ThinkOfAShade(void) { static int thisshade = -1; @@ -104,9 +101,7 @@ ThinkOfAShade() } static floatish -extract_colour(shade,factor) - floatish shade; - intish factor; +extract_colour(floatish shade, intish factor) { intish i,j; @@ -116,8 +111,7 @@ extract_colour(shade,factor) } void -SetPSColour(shade) - floatish shade; +SetPSColour(floatish shade) { if (cflag) { fprintf(psfp, "%f %f %f setrgbcolor\n", diff --git a/utils/hp2ps/TopTwenty.c b/utils/hp2ps/TopTwenty.c index bbb6be4390..b47d55a9cb 100644 --- a/utils/hp2ps/TopTwenty.c +++ b/utils/hp2ps/TopTwenty.c @@ -19,7 +19,7 @@ */ void -TopTwenty() +TopTwenty(void) { intish i; intish j; diff --git a/utils/hp2ps/TraceElement.c b/utils/hp2ps/TraceElement.c index c14062dced..eec17e839d 100644 --- a/utils/hp2ps/TraceElement.c +++ b/utils/hp2ps/TraceElement.c @@ -19,7 +19,7 @@ extern floatish thresholdpercent; -void TraceElement() +void TraceElement(void) { intish i; intish j; diff --git a/utils/hp2ps/Utilities.c b/utils/hp2ps/Utilities.c index c9fb612f0e..5139144d53 100644 --- a/utils/hp2ps/Utilities.c +++ b/utils/hp2ps/Utilities.c @@ -6,8 +6,7 @@ extern void* malloc(); char* -Basename(name) - char* name; +Basename(char *name) { char* t; @@ -24,8 +23,7 @@ Basename(name) } void -DropSuffix(name, suffix) - char* name; char* suffix; +DropSuffix(char *name, char *suffix) { char* t; @@ -44,8 +42,7 @@ DropSuffix(name, suffix) } FILE* -OpenFile(s, mode) - char* s; char* mode; +OpenFile(char *s, char *mode) { FILE* r; @@ -65,9 +62,7 @@ OpenFile(s, mode) */ void -CommaPrint(fp,n) - FILE* fp; - intish n; +CommaPrint(FILE *fp, intish n) { if (n < ONETHOUSAND) { fprintf(fp, "%d", (int)n); @@ -78,8 +73,7 @@ CommaPrint(fp,n) } void * -xmalloc(n) - size_t n; +xmalloc(size_t n) { void *r; @@ -92,9 +86,7 @@ xmalloc(n) } void * -xrealloc(p, n) - void *p; - size_t n; +xrealloc(void *p, size_t n) { void *r; extern void *realloc(); @@ -108,8 +100,7 @@ xrealloc(p, n) } char * -copystring(s) - char *s; +copystring(char *s) { char *r; @@ -119,8 +110,7 @@ copystring(s) } char * -copystring2(s, t) - char *s, *t; +copystring2(char *s, char *t) { char *r; diff --git a/utils/unlit/unlit.c b/utils/unlit/unlit.c index 1269b81463..76877bec15 100644 --- a/utils/unlit/unlit.c +++ b/utils/unlit/unlit.c @@ -121,8 +121,7 @@ void myputc(char c, FILE *ostream) /* As getc, but does TAB expansion */ int -egetc(istream) -FILE *istream; +egetc(FILE *istream) { static int spleft = 0; static int linepos = 0; @@ -170,8 +169,7 @@ FILE *istream; * stream. */ -line readline(istream,ostream) -FILE *istream, *ostream; { +line readline(FILE *istream, FILE *ostream) { int c, c1; char buf[100]; int i; |
