Example #1
0
static lib_t elab_find_lib(ident_t name, const elab_ctx_t *ctx)
{
   lib_t tmp = lib_work();
   lib_set_work(ctx->library);
   lib_t lib = lib_find(ident_until(name, '.'), true);
   lib_set_work(tmp);
   return lib;
}
Example #2
0
File: elab.c Project: sylphase/nvc
static lib_t elab_find_lib(ident_t name, const elab_ctx_t *ctx)
{
   lib_t tmp = lib_work();
   lib_set_work(ctx->library);
   lib_t lib = lib_find(istr(ident_until(name, '.')), true, true);
   if (lib == NULL)
      fatal("cannot continue");
   lib_set_work(tmp);
   return lib;
}
Example #3
0
static void setup(void)
{
   lib_set_work(lib_tmp());
   opt_set_int("bootstrap", 0);
   opt_set_int("cover", 0);
   opt_set_int("unit-test", 1);
   opt_set_int("prefer-explicit", 0);
}
Example #4
0
static void set_work_lib(void)
{
   const char *work_name = opt_get_str("work-name");
   lib_t work = lib_find(work_name, false, false);
   if (work == NULL)
      work = lib_new(work_name);

   lib_set_work(work);
}
Example #5
0
File: nvc.c Project: jkone27/nvc
int main(int argc, char **argv)
{
   term_init();
   set_default_opts();
   intern_strings();

   if (getenv("NVC_GDB") != NULL)
      register_gdb_signal_handlers();
   else
      register_trace_signal_handlers();

   if (is_debugger_running())
      atexit(tree_gc);

   atexit(fbuf_cleanup);

   static struct option long_options[] = {
      { "help",        no_argument,       0, 'h' },
      { "version",     no_argument,       0, 'v' },
      { "work",        required_argument, 0, 'w' },
      { "std",         required_argument, 0, 's' },
      { "messages",    required_argument, 0, 'M' },
      { "map",         required_argument, 0, 'p' },
      { "ignore-time", no_argument,       0, 'i' },
      { "force-init",  no_argument,       0, 'f' },
      { 0, 0, 0, 0 }
   };

   opterr = 0;

   const char *work_name = "work";
   const char *work_path = work_name;
   lib_t work = NULL;

   const int next_cmd = scan_cmd(1, argc, argv);
   int c, index = 0;
   const char *spec = "aehrvL:";
   while ((c = getopt_long(next_cmd, argv, spec, long_options, &index)) != -1) {
      switch (c) {
      case 0:
         // Set a flag
         break;
      case 'h':
         usage();
         exit(EXIT_SUCCESS);
      case 'v':
         printf("%s\n%s\n", version_string, copy_string);
         exit(EXIT_SUCCESS);
      case 'w':
         parse_work_name(optarg, &work_name, &work_path);
         break;
      case 'L':
         lib_add_search_path(optarg);
         break;
      case 's':
         set_standard(parse_standard(optarg));
         break;
      case 'M':
         set_message_style(parse_message_style(optarg));
         break;
      case 'p':
         parse_library_map(optarg);
         break;
      case 'i':
         opt_set_int("ignore-time", 1);
         break;
      case 'f':
         opt_set_int("force-init", 1);
         break;
      case '?':
         fatal("unrecognised global option %s", argv[optind - 1]);
      default:
         abort();
      }
   }

   work = lib_new(work_name, work_path);
   lib_set_work(work);

   argc -= next_cmd - 1;
   argv += next_cmd - 1;

   return process_command(argc, argv);
}