X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsFlags.c;h=6de188a1b2b72355980bebbf72c2aba18bedd2cb;hb=d255dfff87648bcd4dd1d87faa8d835d358c70a2;hp=ebd55b69d0051ec0b6238bf4bd7680b247a3fa9e;hpb=557947d3f93e11285e36423ddb08d859af60ab47;p=ghc-hetmet.git diff --git a/ghc/rts/RtsFlags.c b/ghc/rts/RtsFlags.c index ebd55b6..6de188a 100644 --- a/ghc/rts/RtsFlags.c +++ b/ghc/rts/RtsFlags.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsFlags.c,v 1.66 2003/02/22 04:51:53 sof Exp $ + * $Id: RtsFlags.c,v 1.71 2003/10/31 16:48:45 sof Exp $ * * (c) The AQUA Project, Glasgow University, 1994-1997 * (c) The GHC Team, 1998-1999 @@ -41,8 +41,9 @@ extern struct RTS_FLAGS RtsFlags; /* * Split argument lists */ -int prog_argc = 0; /* an "int" so as to match normal "argc" */ +int prog_argc = 0; /* an "int" so as to match normal "argc" */ char **prog_argv = NULL; +char *prog_name = NULL; /* 'basename' of prog_argv[0] */ int rts_argc = 0; /* ditto */ char *rts_argv[MAX_RTS_ARGS]; @@ -55,25 +56,9 @@ char *rts_argv[MAX_RTS_ARGS]; #define RTS 1 #define PGM 0 -char *debug_opts_prefix[] = { - "_-", /* scheduler */ - "_.", /* interpreter */ - "_,", /* codegen */ - "_;", /* weak */ - "_~", /* gccafs */ - "_@", /* gc */ - "_#", /* block */ - "_&", /* sanity */ - "_:", /* stable */ - "_!", /* prof */ - "_=", /* gran */ - "_=" /* par */ - "_*" /* linker */ -}; - #if defined(GRAN) -char *gran_debug_opts_strs[] = { +static char *gran_debug_opts_strs[] = { "DEBUG (-bDe, -bD1): event_trace; printing event trace.\n", "DEBUG (-bDE, -bD2): event_stats; printing event statistics.\n", "DEBUG (-bDb, -bD4): bq; check blocking queues\n", @@ -92,32 +77,13 @@ char *gran_debug_opts_strs[] = { }; /* one character codes for the available debug options */ -char gran_debug_opts_flags[] = { +static char gran_debug_opts_flags[] = { 'e', 'E', 'b', 'G', 'q', 'f', 'r', 'F', 'u', 'S', ':', 'o', 'z', 'P', 't' }; -/* prefix strings printed with the debug messages of the corresponding type */ -char *gran_debug_opts_prefix[] = { - "", /* event_trace */ - "", /* event_stats */ - "##", /* bq */ - "**", /* pack */ - "^^", /* checkSparkQ */ - "==", /* thunkStealing */ - "^^", /* randomSteal */ - "+-", /* findWork */ - "", /* unused */ - "++", /* pri */ - "::", /* checkLight */ - "##", /* sortedQ */ - "", /* blockOnFetch */ - "", /* packBuffer */ - "" /* blockOnFetch_sanity */ -}; - #elif defined(PAR) -char *par_debug_opts_strs[] = { +static char *par_debug_opts_strs[] = { "DEBUG (-qDv, -qD1): verbose; be generally verbose with parallel related stuff.\n", "DEBUG (-qDq, -qD2): bq; print blocking queues.\n", "DEBUG (-qDs, -qD4): schedule; scheduling of parallel threads.\n", @@ -135,27 +101,10 @@ char *par_debug_opts_strs[] = { }; /* one character codes for the available debug options */ -char par_debug_opts_flags[] = { +static char par_debug_opts_flags[] = { 'v', 'q', 's', 'e', 'r', 'w', 'F', 'f', 'l', 'o', 'p', 'z' }; -/* prefix strings printed with the debug messages of the corresponding type */ -char *par_debug_opts_prefix[] = { - " ", /* verbose */ - "##", /* bq */ - "--", /* schedule */ - "!!", /* free */ - "[]", /* resume */ - ";;", /* weight */ - "%%", /* fetch */ - //",,", /* ack */ - "$$", /* fish */ - "", /* tables */ - "**", /* packet */ - "**" /* pack */ - ":(" /* paranoia */ -}; - #endif /* PAR */ //@node Static function decls, Command-line option parsing routines, Constants @@ -383,7 +332,7 @@ usage_text[] = { " -? Prints this message and exits; the program is not executed", "", " -K Sets the maximum stack size (default 1M) Egs: -K32k -K512k", -" -k Sets the initial thread stack size (default 1k) Egs: -K4k -K2m", +" -k Sets the initial thread stack size (default 1k) Egs: -k4k -k2m", "", " -A Sets the minimum allocation area size (default 256k) Egs: -A1m -A10k", " -M Sets the maximum heap size (default unlimited) Egs: -M256k -M1G", @@ -508,7 +457,7 @@ usage_text[] = { 0 }; -static __inline__ rtsBool +static inline rtsBool strequal(const char *a, const char * b) { return(strcmp(a, b) == 0); @@ -528,7 +477,7 @@ splitRtsFlags(char *s, int *rts_argc, char *rts_argv[]) if (c1 == c2) { break; } if (*rts_argc < MAX_RTS_ARGS-1) { - s = malloc(c2-c1+1); + s = stgMallocBytes(c2-c1+1, "RtsFlags.c:splitRtsFlags()"); strncpy(s, c1, c2-c1); s[c2-c1] = '\0'; rts_argv[(*rts_argc)++] = s; @@ -549,9 +498,17 @@ setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]) char *last_slash; /* Remove directory from argv[0] -- default files in current directory */ - - if ((last_slash = (char *) strrchr(argv[0], '/')) != NULL) - strcpy(argv[0], last_slash+1); + if ((last_slash = (char *) strrchr(argv[0], +#if !defined(mingw32_TARGET_OS) + '/') +#else + '\\') +#endif + ) != NULL) { + prog_name = last_slash+1; + } else { + prog_name = argv[0]; + } total_arg = *argc; arg = 1;