missed one!
[debian/atlc] / src / create_bmp_for_rect_in_rect.c
1 /* atlc - arbitrary transmission line calculator, for the analysis of
2 transmission lines are directional couplers. 
3
4 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either package_version 2
9 of the License, or (at your option) any later package_version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
19 USA.
20
21 Dr. David Kirkby, e-mail drkirkby at gmail.com 
22
23 */
24
25 /* The program create_bmp_for_rect_in_rect is a pre-processor for atlc. It produces bitmaps of rectangular
26 inner and rectangular outer */
27 #include "config.h"
28
29
30 #ifdef HAVE_STDLIB_H
31 #include <stdlib.h>
32 #endif  
33
34 #include "definitions.h"
35 #include "exit_codes.h"
36
37 #ifdef WINDOWS
38 #pragma hrdstop
39 #include <condefs.h>
40 #endif
41
42 double WW, HH, aa, bb, cc, dd, ww, hh, Er1, Er2, DD;
43 int W, H, a, b, c, d, w, h;
44 int verbose;
45
46 /* The following are only needed, so I can link in two  
47 convert_circ_in_circ_dimensions_to_integers.c
48 and
49 convert_create_bmp_for_rect_in_rect_dimensions_to_integers.c
50 */
51
52 int lowest=2500, highest=10000;
53 int fileflag=FALSE;
54
55 int main(int argc, char **argv) /* Read parameters from command line here   */
56 {
57    int  bmp_size=DEFAULT_BMP_SIZE;
58    int q;
59    FILE *image_data_fp=stdout;
60    struct transmission_line_properties not_used_currently;
61    int verbose_level=0;
62
63    /* The following jut keeps compilers happy. SGI's is very fussy!! */
64
65    not_used_currently.W=1;
66
67    while((q=get_options(argc,argv,"b:v")) != -1)
68    switch (q) 
69    {
70       case 'b':
71       bmp_size=atol(my_optarg); 
72       break;
73       case 'v':
74       verbose_level=1; 
75       break;
76       case '?':
77       printf("read a ? exiting\n");
78    }
79    if(argc-my_optind ==11)
80    {
81       WW=atof(argv[my_optind]);
82       HH=atof(argv[my_optind+1]);
83       aa=atof(argv[my_optind+2]);
84       bb=atof(argv[my_optind+3]);
85       cc=atof(argv[my_optind+4]);
86       dd=atof(argv[my_optind+5]);
87       ww=atof(argv[my_optind+6]);
88       hh=atof(argv[my_optind+7]);
89       Er1=atof(argv[my_optind+8]);
90       Er2=atof(argv[my_optind+9]);
91       if((image_data_fp=fopen(argv[my_optind+10],"wb"))==NULL)
92         exit_with_msg_and_exit_code("Cant't open file for writing in create_bmp_for_rect_in_rect.c",CANT_OPEN_FOR_WRITING);
93       if(verbose_level==1)
94         printf("WW=%f HH=%f aa=%f bb=%f cc=%f dd=%f ww=%f hh=%f Er1=%f Er2=%f\n",WW,HH,aa,bb,cc,dd,ww,hh,Er1,Er2);
95       check_parameters_of_create_bmp_for_rect_in_rect();
96       convert_create_bmp_for_rect_in_rect_dimensions_to_integers(bmp_size);
97       if(verbose_level==1)
98         printf("W=%d H=%d a=%d b=%d c=%d d=%d w=%d h=%d\n",W,H,a,b,c,d,w,h);
99       write_bitmap(image_data_fp, not_used_currently);
100    }
101    else
102       usage_create_bmp_for_rect_in_rect();
103    return(OKAY);
104 }