as you suggested in another thread, i use the command "remcirc"
after processing the circuit file.
While doing some misuse tests in a debug session i found out, my
application crashes when simulating an empty circuit file( and
also for example using a cpp - file).
First i load the circuit file in a text highlighting editor.
In my case this happens, when the editor is empty and the user
presses the simulate/run button.
Asking the return value of "bg_run" is for the birds.
I could implement some features
- test, if first character is a '*'
- test, if ".END" appears
- test, if ".tran" appears
- test ending of file ( but user is able to type in by hand )
- as a standard always load a minimum valid circuit.
...
My question is, do you have a flag within the library, which indicates
a valid circuit after a successful "bg_run.", which i can request, before
calling "remcirc"?
Otherwise i've to use only a call to "dlcose".
You may say, why do simulate an empty file ore just nonsense. But
users do and out of experience it's always the programmer who fails!
regards, Craggan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
normally ngspice should just report: "Error: there is no circuit loaded.", after 'remcirc' has been called, and there is no circuit. In fact there is a bug in runcoms2.c, which may under certain circumstances lead to a crash. I will upload a bugfix a.s.a.p.
Holger
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Holger,
as you suggested in another thread, i use the command "remcirc"
after processing the circuit file.
While doing some misuse tests in a debug session i found out, my
application crashes when simulating an empty circuit file( and
also for example using a cpp - file).
First i load the circuit file in a text highlighting editor.
In my case this happens, when the editor is empty and the user
presses the simulate/run button.
Asking the return value of "bg_run" is for the birds.
I could implement some features
- test, if first character is a '*'
- test, if ".END" appears
- test, if ".tran" appears
- test ending of file ( but user is able to type in by hand )
- as a standard always load a minimum valid circuit.
...
My question is, do you have a flag within the library, which indicates
a valid circuit after a successful "bg_run.", which i can request, before
calling "remcirc"?
Otherwise i've to use only a call to "dlcose".
You may say, why do simulate an empty file ore just nonsense. But
users do and out of experience it's always the programmer who fails!
regards, Craggan
Craggan,
normally ngspice should just report: "Error: there is no circuit loaded.", after 'remcirc' has been called, and there is no circuit. In fact there is a bug in runcoms2.c, which may under certain circumstances lead to a crash. I will upload a bugfix a.s.a.p.
Holger
fix is uploaded to git
Holger
Thanks
Craggan