Imported Upstream version 4.6.0
[debian/atlc] / src / non_gui / create_bmp_for_rect_in_circ.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 ntlworld.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 #ifdef HAVE_STDLIB_H
30 #include <stdlib.h>
31 #endif  
32
33 #ifdef WINDOWS
34 #pragma hrdstop
35 #include <condefs.h>
36 #endif
37
38 #include "definitions.h"
39 #include "exit_codes.h"
40
41
42 double DD, ww, hh, xx, yy, Er1, Er2;
43 int D, w, h, x, y, W, H;
44
45 int verbose=FALSE;
46 int lowest=2500, highest=10000;
47 int fileflag=FALSE;
48
49 extern int main(int argc, char **argv) /* Read parameters from command line here   */
50 {
51    int  bmp_size=DEFAULT_BMP_SIZE;
52    int q;
53    struct transmission_line_properties not_used;
54    FILE *image_data_fp=stdout;
55
56    not_used.W=1; /* Keeps SGI's MipsPro compiler happy */
57
58    while((q=get_options(argc,argv,"b:f:v")) != -1)
59    switch (q) 
60    {
61       case 'b':
62       bmp_size=atol(my_optarg); 
63       break;
64       case 'f':
65       /* By default bitmap image goes to stdout, but we can send to a file 
66       with the -f option. */
67       if((image_data_fp=fopen(my_optarg,"wb"))==NULL)
68       {
69          fprintf(stderr,"Can't write to %s. Exiting ...\n",my_optarg);
70          exit_with_msg_and_exit_code("",CANT_OPEN_FOR_WRITING);
71       }
72       fileflag=TRUE;
73       break;
74       case 'v':
75       verbose=TRUE; 
76       break;
77       case '?':
78       printf("read a ? exiting\n");
79    }
80       /*usage_create_bmp_for_rect_in_circ();*/
81       fprintf(stderr,"SORRY create_bmp_for_rect_in_circ IS NOT YET WORKING, SO HAS BEEN DISABLED. IT\n");
82       exit_with_msg_and_exit_code("BE ENABLED ON A FORTHCOMING VERSION",PROGRAM_NOT_IMPLEMENTED);
83    if(argc-my_optind == 6)
84    {
85       DD=atof(argv[my_optind]);
86       ww=atof(argv[my_optind+1]);
87       hh=atof(argv[my_optind+2]);
88       xx=atof(argv[my_optind+3]);
89       yy=atof(argv[my_optind+4]);
90       Er1=atof(argv[my_optind+5]);
91       check_parameters_of_create_bmp_for_rect_in_circ();
92       convert_create_bmp_for_rect_in_circ_dimensions_to_integers(bmp_size);
93       write_bitmap(image_data_fp, not_used);
94    }
95    else
96       usage_create_bmp_for_rect_in_circ();
97    return(0);
98 }