annotate ueda/sverp-bind/main.c @ 15:c59f52e4bacf

unet-bind option -c reports MCL components with no binding
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 02 Aug 2015 00:39:38 +0000
parents 51893347bc42
children 65a515c20db8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 #include <stdio.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 #include <stdlib.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 #include <string.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 #include <strings.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <unistd.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 extern char *MCLfile;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 char *input_filename, *output_filename;
15
c59f52e4bacf unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 12
diff changeset
10 int check_completeness;
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 static void
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 usage()
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 {
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 fprintf(stderr, "usage: unet-bind input.unet [output.unet]\n");
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 exit(1);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 static void
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 process_options(argc, argv)
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 char **argv;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 {
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 extern char *optarg;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 register int c;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25
15
c59f52e4bacf unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 12
diff changeset
26 while ((c = getopt(argc, argv, "cI:M:")) != EOF) {
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 switch (c) {
15
c59f52e4bacf unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 12
diff changeset
28 case 'c':
c59f52e4bacf unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 12
diff changeset
29 check_completeness++;
c59f52e4bacf unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 12
diff changeset
30 break;
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 case 'I':
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 add_symfile_dir(optarg);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 continue;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 case 'M':
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 MCLfile = optarg;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 break;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 default:
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 usage();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 main(argc, argv)
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 char **argv;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 {
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 extern int optind;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 process_options(argc, argv);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49 if (argc < optind + 1 || argc > optind + 2)
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 usage();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 input_filename = argv[optind];
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52 output_filename = argv[optind+1];
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 /* process all inputs from the MCL */
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55 read_MCL();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 set_default_sympath();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 read_pinouts();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58 init_outcomp_from_MCL();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
59
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
60 /* remaining functionality remains to be implemented */
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
61 exit(0);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
62 }