X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=nesc.git;a=blobdiff_plain;f=src%2Fnesc-main.c;fp=src%2Fnesc-main.c;h=c01f099fc07e27dd6abcce01e20407c8b12ab4bf;hp=072767a0c6cf78fc4fa82d8c91d105a4e50c6654;hb=7b54393e237ed8f23c0c74f0a6cbc8de26c5bf98;hpb=57d4530c4d6814fa25338a00cc65b95938c723b6 diff --git a/src/nesc-main.c b/src/nesc-main.c index 072767a..c01f099 100644 --- a/src/nesc-main.c +++ b/src/nesc-main.c @@ -47,18 +47,21 @@ Boston, MA 02111-1307, USA. */ #include "machine.h" #include "nesc-atomic.h" #include "unparse.h" +#include "nesc-main.h" + /* The set of C files to require before loading the main component */ struct ilist { struct ilist *next; char *name; + bool name_is_path; }; static struct ilist *includelist, **includelist_end = &includelist; static region includeregion; -void add_nesc_include(const char *name) +void add_nesc_include(const char *name, bool name_is_path) { struct ilist *np; @@ -68,6 +71,7 @@ void add_nesc_include(const char *name) np = ralloc(includeregion, struct ilist); np->next = NULL; np->name = rstrdup(includeregion, name); + np->name_is_path = name_is_path; *includelist_end = np; includelist_end = &np->next; @@ -177,7 +181,7 @@ int nesc_option(char *p) } else if (!strncmp (p, "fnesc-include=", strlen("fnesc-include="))) { - add_nesc_include(p + strlen("fnesc-include=")); + add_nesc_include(p + strlen("fnesc-include="), FALSE); } else if (!strncmp (p, "fnesc-path=", strlen("fnesc-path="))) { @@ -263,6 +267,8 @@ int nesc_option(char *p) flag_default_safe = 1; else if (!strcmp (p, "fnesc-default-unsafe")) flag_default_safe = 0; + else if (!strcmp (p, "fnesc-gccize")) + flag_gccize = 1; else if (!strcmp (p, "Wnesc-docstring")) warn_unexpected_docstring = 1; else if (!strcmp (p, "Wno-nesc-docstring")) @@ -365,7 +371,10 @@ void nesc_compile(const char *filename, const char *target_name) target->init(); for (includes = includelist; includes; includes = includes->next) - require_c(toplevel_location, includes->name); + if (includes->name_is_path) + load_c(toplevel_location, includes->name, TRUE); + else + require_c(toplevel_location, includes->name); if (flag_use_scheduler) load_scheduler();