1 #include <../../nmodlconf.h>
11 #if MAC && TARGET_API_MAC_CARBON
20 int isend(
char*,
char*);
28 #if __TURBOC__ || SYSV || VMS || defined(MINGW)
39 if ((cp =
index(
buf,
'!')) != (
char*) 0) {
42 while (cp >=
buf && isspace(*cp)) {
46 for (cp =
buf; *cp !=
'\0' && isspace(*cp); cp++) {
63 if (cp == (
char*) 0) {
65 diag(s,
"block goes to end of file");
71 q->itemtype = VERBATIM;
77 char *cp, word[256], *wp, test[256];
82 while (*cp ==
' ' || *cp ==
'\t')
85 for (wp = word; isalpha(*cp);) {
89 if (strcmp(test, word) == 0) {
108 for (
i = 0;
i < size; ++
i) {
110 if (
c == EOF ||
c == 26 ||
c == 4) {
126 if (c < 0 || c > 127) {
130 diag(
"Non-Ascii character in file:",
buf);
151 if (
ctp == (
char*) 0 || *
ctp ==
'\0') {
158 if (
ctp == (
char*) 0) {
179 diag(
"internal error in unGetc",
"");
189 while ((
c =
Getc()) != EOF &&
c !=
'\n') {
196 }
else if (
c == EOF) {
199 diag(
"internal error in Gets()",
"");
212 diag(
"internal error in unGets()",
"");
234 void diag(
char* s1,
char* s2) {
255 #if MAC && TARGET_API_MAC_CARBON
256 SIOUXSettings.autocloseonquit =
true;
257 RunApplicationEventLoop();
263 static Symbol *symq[20], **symhead = symq, **symtail = symq;
282 if (symhead >= symtail)
287 if (f == (FILE *) 0) {
316 return (
prefix[0] !=
'\0');
327 if (
fname[0] ==
'/') {
360 dirs =
getenv(
"MODL_INCLUDE");
365 for (dirs = colon; *dirs; dirs = colon) {
367 for (; *colon; ++colon) {
374 buf2 =
static_cast<char*
>(
emalloc(strlen(dirs) + 2 + strlen(
fname)));
378 f =
fopen(buf2,
"r");
386 fprintf(stderr,
"Couldn't open: %s\n", buf2);
458 const size_t len = strlen(path);
459 char mypath[PATH_MAX];
465 if (len >
sizeof(mypath) - 1) {
466 fprintf(stderr,
"Output directory path too long\n");
470 strcpy(mypath, path);
473 for (
p = mypath + 1; *
p;
p++) {
479 if (_mkdir(mypath) != 0) {
481 if (mkdir(mypath, S_IRWXU) != 0) {
491 if (_mkdir(mypath) != 0) {
493 if (mkdir(mypath, S_IRWXU) != 0) {
sprintf(buf, " if (secondorder) {\n" " int _i;\n" " for (_i = 0; _i < %d; ++_i) {\n" " _p[_slist%d[_i]] += dt*_p[_dlist%d[_i]];\n" " }}\n", numeqn, listnum, listnum)
char finname[NRN_BUFSIZE]
char * getenv(const char *s)
NMODL parser global flags / functions.
struct FileStackItem FileStackItem
char * Fgets(char *buf, int size, FILE *f)
void diag(char *s1, char *s2)
void include_file(Item *q)
Item * putintoken(char *s, short type, short toktype)
Item * lappendstr(List *list, char *str)
void replacstr(Item *q, char *s)
char * emalloc(unsigned n)
char * stralloc(char *buf, char *rel)
Item * lappendsym(List *list, Symbol *sym)
static struct prefix prefix[]
static int getprefix(char *prefix, char *s)
int mkdir_p(const char *path)
static FILE * include_open(char *fname, int err)
static char inlinebuf[2][NRN_BUFSIZE]
static int file_stack_empty()
int isend(char *, char *)
void enquextern(Symbol *)
static double remove(void *v)
char finname[NRN_BUFSIZE]
static const char * fname(const char *name)