1 #include <../../nrnconf.h>
27 for (
i = 0;
i < size; ++
i) {
29 if (
c == EOF ||
c == 26 ||
c == 4) {
60 if (
ctp == (
char*) 0 || *
ctp ==
'\0') {
65 if (
ctp == (
char*) 0) {
86 diag(
"internal error in unGetc",
"");
96 while ((
c =
Getc()) != EOF &&
c !=
'\n') {
103 }
else if (
c == EOF) {
106 diag(
"internal error in Gets()",
"");
112 void diag(
const char* s1,
const char* s2) {
135 for (
q = q1->
next;
q != q2;
q =
q->next) {
136 switch (
q->itemtype) {
176 return (
Symbol*) ((
q)->element);
183 return (
char*) ((
q)->element);
187 if (!
q ||
q->itemtype !=
ITEM) {
190 return (
Item*) ((
q)->element);
197 return (
Item**) ((
q)->element);
201 if (!
q ||
q->itemtype !=
LIST) {
204 return (
List*) ((
q)->element);
208 Fprintf(stderr,
"Internal error in file \"%s\", line %d\n", file, line);
209 Fprintf(stderr,
"The offending item has the structure:\n");
234 return (
prefix[0] !=
'\0');
242 if (fname[0] ==
'/') {
243 return fopen(fname,
"r");
255 fprintf(stderr,
"Couldn't open: %s\n",
buf);
257 f = fopen(fname,
"r");
262 if ((f = fopen(
buf,
"r")) !=
NULL)
266 fprintf(stderr,
"Couldn't open: %s\n", fname);
269 dirs = getenv(
"MODL_INCLUDE");
274 for (dirs = colon; *dirs; dirs = colon) {
275 for (; *colon; ++colon) {
285 f = fopen(buf2,
"r");
291 fprintf(stderr,
"Couldn't open: %s\n", buf2);
303 strcpy(fname,
STR(
q) + 1);
304 fname[strlen(fname) - 1] =
'\0';
316 diag(
"Couldn't open ", fname);
318 fprintf(stderr,
"INCLUDEing %s\n", fname);
char finname[NRN_BUFSIZE]
List * _LST(Item *q, char *file, int line)
void internal_error(Item *q, char *file, int line)
static int getprefix(char *prefix, char *s)
void diag(const char *s1, const char *s2)
struct FileStackItem FileStackItem
static char inlinebuf[600]
Item * _ITM(Item *q, char *file, int line)
Symbol * _SYM(Item *q, char *file, int line)
static FILE * include_open(char *fname, int err)
char * Fgets(char *buf, int size, FILE *f)
char * _STR(Item *q, char *file, int line)
Item ** _ITMA(Item *q, char *file, int line)
static int file_stack_empty()
void include_file(Item *q)
Item * lappendsym(List *list, Symbol *sym)
List * newlist()
The following routines support the concept of a list.
static void * emalloc(size_t size)
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
static double remove(void *v)
static struct prefix prefix[]
char finname[NRN_BUFSIZE]
int Fprintf(FILE *stream, const char *fmt, Args... args)