FreeCalypso > hg > ueda-linux
diff ueda/unet-bind/main.c @ 101:ffab0a4424ad
ueda: unet-bind program moved into sensibly named unet-bind subdir
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 29 Sep 2019 22:42:41 +0000 |
parents | ueda/sverp-bind/main.c@61272ee5aadc |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ueda/unet-bind/main.c Sun Sep 29 22:42:41 2019 +0000 @@ -0,0 +1,104 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <unistd.h> +#include "struct.h" + +extern char *MCLfile; + +char *input_filename, *output_filename; +char *starpoints_file; +int check_completeness, unbound_instances; + +struct wantattr *want_attr_list; +static struct wantattr **wantattr_tailp = &want_attr_list; + +static void +add_wanted_attr(attr) + char *attr; +{ + struct wantattr *wa; + + wa = (struct wantattr *) malloc(sizeof(struct wantattr) + + strlen(attr) + 1); + if (!wa) { + perror("malloc"); + exit(1); + } + wa->name = (char *)(wa + 1); + strcpy(wa->name, attr); + wa->next = 0; + *wantattr_tailp = wa; + wantattr_tailp = &wa->next; +} + +static void +usage() +{ + fprintf(stderr, + "usage: unet-bind [options] input.unet [output.unet]\n"); + exit(1); +} + +static void +process_options(argc, argv) + char **argv; +{ + extern char *optarg; + register int c; + + while ((c = getopt(argc, argv, "a:cI:M:s:")) != EOF) { + switch (c) { + case 'a': + add_wanted_attr(optarg); + continue; + case 'c': + check_completeness++; + continue; + case 'I': + add_symfile_dir(optarg); + continue; + case 'M': + MCLfile = optarg; + continue; + case 's': + starpoints_file = optarg; + continue; + default: + usage(); + } + } +} + +main(argc, argv) + char **argv; +{ + extern int optind; + + process_options(argc, argv); + if (argc < optind + 1 || argc > optind + 2) + usage(); + input_filename = argv[optind]; + output_filename = argv[optind+1]; + + /* process all inputs from the MCL */ + read_MCL(); + set_default_sympath(); + read_pinouts(); + init_outcomp_from_MCL(); + /* do we have any star points? */ + if (starpoints_file) + process_starpoints_file(); + /* read the netlist from sverp */ + process_input_unet(); + if (unbound_instances) { + fprintf(stderr, + "error: %s input contains unbound instances, aborting\n", + input_filename); + exit(1); + } + check_unclaimed_instances(); + generate_output(); + exit(0); +}