diff --git a/ext2sim/ext2sim.c b/ext2sim/ext2sim.c index 1008cfab..3252bbbb 100644 --- a/ext2sim/ext2sim.c +++ b/ext2sim/ext2sim.c @@ -264,7 +264,7 @@ CmdExtToSim(w, cmd) int option = EXTTOSIM_RUN; int argc = cmd->tx_argc; char **argv = cmd->tx_argv; - char **msg; + const char * const *msg; bool err_result; short s_rclass, d_rclass, sub_rclass; @@ -276,7 +276,7 @@ CmdExtToSim(w, cmd) static EFCapValue LocCapThreshold = 2; static int LocResistThreshold = 10; - static char *cmdExtToSimOption[] = { + static const char * const cmdExtToSimOption[] = { "[run] [options] run exttosim on current cell\n" " use \"run -help\" to get standard options", "alias on|off enable/disable alias (.al) file", @@ -291,14 +291,14 @@ CmdExtToSim(w, cmd) NULL }; - static char *sim_formats[] = { + static const char * const sim_formats[] = { "MIT", "LBL", "SU", NULL }; - static char *yesno[] = { + static const char * const yesno[] = { "yes", "true", "on", @@ -308,7 +308,7 @@ CmdExtToSim(w, cmd) NULL }; - static char *cmdMergeTypes[] = { + static const char * const cmdMergeTypes[] = { "none don't merge parallel devices", "conservative merge devices with same L, W", "aggressive merge devices with same L" @@ -430,7 +430,7 @@ CmdExtToSim(w, cmd) if (cmd->tx_argc == 2) { #ifdef MAGIC_WRAPPER - Tcl_SetResult(magicinterp, sim_formats[esFormat], TCL_STATIC); + Tcl_SetResult(magicinterp, (char*)sim_formats[esFormat], TCL_STATIC); #else TxPrintf("Format: %s\n", sim_formats[esFormat]); #endif diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index e4943e89..7bd1693c 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -269,7 +269,7 @@ CmdExtToSpice(w, cmd) int option = EXTTOSPC_RUN; int argc = cmd->tx_argc; char **argv = cmd->tx_argv; - char **msg; + const char * const *msg; char *resstr = NULL; char *substr = NULL; bool err_result, locDoSubckt; @@ -284,11 +284,11 @@ CmdExtToSpice(w, cmd) static EFCapValue LocCapThreshold = 2; static int LocResistThreshold = INFINITE_THRESHOLD; - static char *spiceFormats[] = { + static const char * const spiceFormats[] = { "SPICE2", "SPICE3", "HSPICE", "NGSPICE", NULL }; - static char *cmdExtToSpcOption[] = { + static const char * const cmdExtToSpcOption[] = { "[run] [options] run exttospice on current cell\n" " use \"run -help\" to get standard options", "default reset to default values", @@ -313,20 +313,20 @@ CmdExtToSpice(w, cmd) NULL }; - static char *cmdMergeTypes[] = { + static const char * const cmdMergeTypes[] = { "none don't merge parallel devices", "conservative merge devices with same L, W", "aggressive merge devices with same L", NULL }; - static char *cmdShortTypes[] = { + static const char * const cmdShortTypes[] = { "none merge shorted ports", "resistor separate shorted ports with 0 ohm resistor", "voltage separate shorted ports with 0 volt source", NULL }; - static char *cmdExtToSpcFormat[] = { + static const char * const cmdExtToSpcFormat[] = { "spice2", "spice3", "hspice", @@ -334,7 +334,7 @@ CmdExtToSpice(w, cmd) NULL }; - static char *yesno[] = { + static const char * const yesno[] = { "yes", "true", "on", @@ -344,7 +344,7 @@ CmdExtToSpice(w, cmd) NULL }; - static char *subcktopts[] = { + static const char * const subcktopts[] = { "yes", "true", "on", @@ -357,7 +357,7 @@ CmdExtToSpice(w, cmd) NULL }; - static char *shorttypes[] = { + static const char * const shorttypes[] = { "none", "resistor", "voltage", @@ -649,7 +649,8 @@ CmdExtToSpice(w, cmd) if (cmd->tx_argc == 2) { #ifdef MAGIC_WRAPPER - Tcl_SetResult(magicinterp, cmdExtToSpcFormat[esFormat], NULL); + /* FIXME check NULL is ok here, should this be TCL_STATIC ? TCL_STATIC==0 maybe using TCL_STATIC is better? */ + Tcl_SetResult(magicinterp, (char*)cmdExtToSpcFormat[esFormat], NULL); #else TxPrintf("Format: %s\n", cmdExtToSpcFormat[esFormat]); #endif @@ -1181,7 +1182,7 @@ main(argc, argv) esSpiceDevsMerged = 0; - static char *spiceFormats[] = { + static const char * const spiceFormats[] = { "SPICE2", "SPICE3", "HSPICE", "NGSPICE", NULL }; diff --git a/windows/windCmdAM.c b/windows/windCmdAM.c index 81f5d4a8..c51ac9eb 100644 --- a/windows/windCmdAM.c +++ b/windows/windCmdAM.c @@ -82,8 +82,8 @@ windBorderCmd(w, cmd) { int place; bool value; - static char *onoff[] = {"on", "off", 0}; - static bool truth[] = {TRUE, FALSE}; + static const char * const onoff[] = {"on", "off", 0}; + static const bool truth[] = {TRUE, FALSE}; if (cmd->tx_argc > 2) goto usage; else if (cmd->tx_argc == 1) @@ -97,7 +97,8 @@ windBorderCmd(w, cmd) value = (w->w_flags & WIND_BORDER) ? 0 : 1; #ifdef MAGIC_WRAPPER - Tcl_SetResult(magicinterp, onoff[value], TCL_STATIC); + /* this cast to remove const is ok, TCL_STATIC conveys the storage handling of this string */ + Tcl_SetResult(magicinterp, (char *)onoff[value], TCL_STATIC); #else TxPrintf("Window border is %s\n", onoff[value]); #endif @@ -151,8 +152,8 @@ windCaptionCmd(w, cmd) { int place; Rect ts; - static char *onoff[] = {"on", "off", 0}; - static bool truth[] = {TRUE, FALSE}; + static const char * const onoff[] = {"on", "off", 0}; + static const bool truth[] = {TRUE, FALSE}; if (cmd->tx_argc > 2) goto usage; else if (cmd->tx_argc == 1) @@ -903,7 +904,7 @@ windLogCommandsCmd(w, cmd) unsigned char flags = 0; int idx = LOG_CMD_STOP; - static char *logKeywords[] = {"start", "stop", "update", "suspend", "resume", 0}; + static const char * const logKeywords[] = {"start", "stop", "update", "suspend", "resume", 0}; if ((cmd->tx_argc < 1) || (cmd->tx_argc > 3)) goto usage;