// CITIfile to Qucs conversion. int citi2qucs (struct actionset_t * action, char * infile, char * outfile) { int ret = 0; citi_init (); if ((citi_in = open_file (infile, "r")) == NULL) { ret = -1; } else if (citi_parse () != 0) { ret = -1; } else if (citi_check () != 0) { ret = -1; } citi_lex_destroy (); if (citi_in) fclose (citi_in); if (ret) { citi_destroy (); return -1; } if (!strcmp (action->out, "qucsdata")) { citi_result->setFile (outfile); qucsdata_producer (citi_result); } citi_destroy (); return 0; }
/* The function read a full dataset from the given CITIfile and returns it. On failure the function emits appropriate error messages and returns NULL. */ dataset * dataset::load_citi (const char * file) { FILE * f; if ((f = fopen (file, "r")) == NULL) { logprint (LOG_ERROR, "error loading `%s': %s\n", file, strerror (errno)); return NULL; } citi_in = f; citi_restart (citi_in); if (citi_parse () != 0) { fclose (f); return NULL; } if (citi_check () != 0) { fclose (f); return NULL; } fclose (f); citi_lex_destroy (); citi_result->setFile (file); return citi_result; }