annotate ueda/sverp-bind/main.c @ 12:51893347bc42

unet-bind implementation started
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sat, 01 Aug 2015 23:33:05 +0000
parents
children c59f52e4bacf
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;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 static void
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 usage()
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 {
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 fprintf(stderr, "usage: unet-bind input.unet [output.unet]\n");
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 exit(1);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 }
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 static void
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 process_options(argc, argv)
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 char **argv;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 {
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 extern char *optarg;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 register int c;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 while ((c = getopt(argc, argv, "I:M:")) != EOF) {
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 switch (c) {
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 case 'I':
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 add_symfile_dir(optarg);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 continue;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 case 'M':
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 MCLfile = optarg;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 break;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 default:
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 usage();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 main(argc, argv)
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 char **argv;
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 extern int optind;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 process_options(argc, argv);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 if (argc < optind + 1 || argc > optind + 2)
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 usage();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 input_filename = argv[optind];
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 output_filename = argv[optind+1];
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 /* process all inputs from the MCL */
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 read_MCL();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52 set_default_sympath();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53 read_pinouts();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 init_outcomp_from_MCL();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 /* remaining functionality remains to be implemented */
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 exit(0);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58 }