Menu

#859 case preservation inside a device card depends on the number of quotes on the line

v1.0 (example)
open
nobody
None
5
2026-08-09
2026-08-09
No

From Claude Code

Version: 46 and 46+
OS: Ubuntu 24.04.4, x86-64
Severity: wrong file path on a case-sensitive filesystem; no diagnostic for one of the two affected parameters

Summary

keep_case_of_cider_param() (src/frontend/inpcom.c:223) preserves case only when the line contains exactly two double quotes:

int numq = 0, keep_case = 0;
...
if (numq == 2) {
...toggle keep_case on each quote...
}

Any other quote count falls through and the entire line is lower-cased. The function is reached for XSPICE code-model cards via is_xspice_model() at inpcom.c:1820-1822, immediately under this comment:

/ lower case excluded for text in quotes for .model of code models
filesource, rable2d, table3d, d_state, d_source, d_process, d_cosim
/

So the stated intent — keep case inside quotes — is not met for any such card carrying two quoted parameters, which is the normal shape for d_cosim and for filesource.

Reproduction

One quoted parameter (two quotes) — case preserved, works:

.model m1 d_cosim simulation="./MixedCase.so" delay=0

Two quoted parameters (four quotes) — whole line folded:

.model m1 d_cosim simulation="./MixedCase.so" sim_args=["Trace.vcd"] delay=0

Instance: a1 Message: d_cosim failed to load simulation binary ./mixedcase.so.

Removing only the sim_args= term from that same card makes the identical simulation= string load correctly. Measured identically on 46 and 46+.

For sim_args there is no diagnostic at all: ngspice hands the mangled string to the code model, the run completes with exit 0 and a correct analog rawfile, and the trace file is written under the lower-cased name (or not at all, if that directory does not exist).

Suggested fix

Toggle keep_case on every quote regardless of the total count, so each quoted region is preserved and unquoted text is still folded. An odd quote count is a malformed line and could reasonably warn.

Discussion


Log in to post a comment.