96 if ((fd = fopen (file, flag)) == NULL) {
97 fprintf (stderr,
"cannot open file `%s': %s, using %s instead\n",
98 file, strerror (errno), flag[0] ==
'r' ?
"stdin" :
"stdout");
99 fd = flag[0] ==
'r' ? stdin : stdout;
103 fd = flag[0] ==
'r' ? stdin : stdout;
109 int main (
int argc,
char ** argv) {
111 char * infile = NULL, * outfile = NULL, * input = NULL, * output = NULL;
117 for (
int i = 1;
i < argc;
i++) {
118 if (!strcmp (argv[
i],
"-v") || !strcmp (argv[i],
"--version")) {
120 "QucsConverter " PACKAGE_VERSION
"\n"
121 "Copyright (C) 2004, 2005, 2006, 2007 Stefan Jahn <stefan@lkcc.org>\n"
122 "\nThis is free software; see the source for copying "
123 "conditions. There is NO\n"
124 "warranty; not even for MERCHANTABILITY or FITNESS FOR A "
125 "PARTICULAR PURPOSE.\n");
128 if (!strcmp (argv[i],
"-h") || !strcmp (argv[i],
"--help")) {
130 "Usage: %s [OPTION]...\n\n"
131 " -h, --help display this help and exit\n"
132 " -v, --version display version information and exit\n"
133 " -i FILENAME use file as input file (default stdin)\n"
134 " -o FILENAME use file as output file (default stdout)\n"
135 " -if FORMAT input data specification (e.g. spice)\n"
136 " -of FORMAT output data specification (e.g. qucs)\n"
137 " -a, --noaction do not include netlist actions in the output\n"
138 " -g GNDNODE replace ground node\n"
139 " -d DATANAME data variable specification\n"
140 " -c, --correct enable node correction\n"
141 "\nReport bugs to <" PACKAGE_BUGREPORT
">.\n", argv[0]);
144 else if (!strcmp (argv[i],
"-i")) {
147 else if (!strcmp (argv[i],
"-o")) {
150 else if (!strcmp (argv[i],
"-if")) {
153 else if (!strcmp (argv[i],
"-of")) {
156 else if (!strcmp (argv[i],
"-a") || !strcmp (argv[i],
"--noaction")) {
159 else if (!strcmp (argv[i],
"-g")) {
162 else if (!strcmp (argv[i],
"-d")) {
165 else if (!strcmp (argv[i],
"-c") || !strcmp (argv[i],
"--correct")) {
175 if (input && !strcmp (input,
actionset[j].in)) {
188 fprintf (stderr,
"invalid input data specification `%s'\n",
189 input ? input :
"not given");
192 fprintf (stderr,
"invalid output data specification `%s'\n",
193 output ? output :
"not given");
195 fprintf (stderr,
"invalid input/output data specification `%s->%s'\n",
196 input ? input :
"not given", output ? output :
"not given");
220 if (!strcmp (action->
out,
"qucs"))
250 if (!strcmp (action->
out,
"qucsdata"))
281 if (!strcmp (action->
out,
"csv")) {
285 fprintf (stderr,
"no data variable given (passed by -d option)\n");
318 if (!strcmp (action->
out,
"touchstone")) {
350 if (!strcmp (action->
out,
"matlab")) {
377 if (!strcmp (action->
out,
"qucsdata")) {
404 if (!strcmp (action->
out,
"qucsdata")) {
431 if (!strcmp (action->
out,
"qucsdata")) {
457 if (!strcmp (action->
out,
"qucsdata")) {
483 if (!strcmp (action->
out,
"qucsdata")) {
__BEGIN_DECLS int dataset_parse(void)
__BEGIN_DECLS int csv_parse(void)
int dataset_check(dataset *data)
void touchstone_init(void)
void qucsdata_producer(dataset *data)
void qucsdata_producer_vcd(void)
void matlab_producer(void)
int citi2qucs(struct actionset_t *, char *, char *)
int mdl_lex_destroy(void)
int qucs2mat(struct actionset_t *, char *, char *)
FILE * open_file(char *file, const char *flag)
int touchstone_lex_destroy(void)
int zvr_lex_destroy(void)
int touch2qucs(struct actionset_t *, char *, char *)
void touchstone_destroy(void)
int main(int argc, char **argv)
int mdl2qucs(struct actionset_t *, char *, char *)
struct actionset_t actionset[]
int csv2qucs(struct actionset_t *, char *, char *)
int spice2qucs(struct actionset_t *, char *, char *)
int touchstone_parse(void)
int vcd_lex_destroy(void)
int csv_lex_destroy(void)
int citi_lex_destroy(void)
qucs::dataset * citi_result
int qucs2csv(struct actionset_t *, char *, char *)
int touchstone_check(void)
int zvr2qucs(struct actionset_t *, char *, char *)
int vcd2qucs(struct actionset_t *, char *, char *)
qucs::dataset * qucs_data
void qucslib_producer(void)
int(* execute)(struct actionset_t *, char *infile, char *outfile)
int spice_lex_destroy(void)
void csv_producer(char *variable, const char *sep)
dataset * touchstone_result
void touchstone_producer(const char *variable)
int qucs2touch(struct actionset_t *, char *, char *)
void setFile(const char *)
int dataset_lex_destroy(void)