Browse Source

inpcom.c, introduce find_back_assignment()

pre-master-46
rlar 9 years ago
parent
commit
511389ad10
  1. 21
      src/frontend/inpcom.c
  2. 2
      src/include/ngspice/fteext.h

21
src/frontend/inpcom.c

@ -436,6 +436,27 @@ find_assignment(const char *str)
} }
/*
* backward search for an assignment
* fixme, doesn't honour neither " nor ' quotes
*/
char *
find_back_assignment(const char *p, const char *start)
{
while (--p >= start) {
if (*p != '=')
continue;
// check for '!=', '<=', '>=', '=='
if (p <= start || !strchr("!<=>", p[-1]))
return (char *) p;
p--;
}
return NULL;
}
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
Read the entire input file and return a pointer to the first line of Read the entire input file and return a pointer to the first line of
the linked list of 'card' records in data. The pointer is stored in the linked list of 'card' records in data. The pointer is stored in

2
src/include/ngspice/fteext.h

@ -216,6 +216,8 @@ extern struct line *inp_readall(FILE *fp, char *dir_name, bool comfile, bool int
extern FILE *inp_pathopen(char *name, char *mode); extern FILE *inp_pathopen(char *name, char *mode);
extern char *search_identifier(char *str, const char *identifier, char *str_begin); extern char *search_identifier(char *str, const char *identifier, char *str_begin);
extern char *find_assignment(const char *s); extern char *find_assignment(const char *s);
extern char *find_back_assignment(const char *s, const char *start);
extern struct line *line_nconc(struct line *head, struct line *rest); extern struct line *line_nconc(struct line *head, struct line *rest);
extern struct line *line_reverse(struct line *head); extern struct line *line_reverse(struct line *head);

Loading…
Cancel
Save