← Back to team overview

kicad-developers team mailing list archive

Re: Additional parameters on simulation dialog

 

Hi Sylwester-

On 2019-06-23 16:27, Sylwester Kocjan wrote:
In KiCad's codebase, \n is standard. But we don't really worry (...)
I think we have misunderstanding here. I was wondering not about
Windows/Unix line endings in source files, but rather line endings used
in string literals in KiCad source code, for example:

netlist_exporter_pspice_sim.cpp:

100:            simCmd += wxString::Format( "%s\r\n", dir );
..
217:        aFormatter->Print( 0, "%s\n", (const char*)
m_simCommand.c_str() );

netlist_exporter_pspice.cpp:

410:            wxStringTokenizer tokenizer( text, "\r\n" );
..
483:        aFormatter->Print( 0, "%s\n", (const char*) dir.c_str() );

Maybe they should be unified somehow?

In the first example, we are writing the netlist in the pspice format. Spice actually requires the carriage return (or did for many years) and so we write that for compatibility.

In the second example, this is tokenizing a string, so we accept either \r, \n or both as delimiters.

I had a quick look through the code base and I only see one example where we might suggest changing it. This is in the sim frame csv export function. We hard-code \r\n here but I think that's still OK as it assures compatibility with Windows and doesn't negatively affect Mac/Linux. However, it might make sense to add a check box here with an option to save using Windows line endings or standard.

-Seth


References