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
36 #ifdef WINDOWS
37 #pragma hrdstop
38 #include <condefs.h>
39 #endif
40
41 int W, H;
42 double Er1, Er2;
main(int argc,char ** argv)43 int main(int argc, char **argv) /* Read parameters from command line here */
44 {
45 struct transmission_line_properties pcb;
46 FILE *image_data_fp;
47 int q;
48 pcb.verbose_level=0;
49
50 pcb.bmp_size=DEFAULT_BMP_SIZE;
51 pcb.WW=-1;
52 pcb.HH=-1;
53
54 while((q=get_options(argc,argv,"b:W:H:v")) != -1)
55 switch (q)
56 {
57 case 'b':
58 pcb.bmp_size=atol(my_optarg);
59 break;
60 case 'H':
61 pcb.HH=atof(my_optarg);
62 break;
63 case 'W':
64 pcb.WW=atof(my_optarg);
65 break;
66 case 'v':
67 pcb.verbose_level++;
68 break;
69 case '?':
70 printf("read a ? exiting\n");
71 }
72 if(argc-my_optind ==8)
73 {
74 pcb.ww=atof(argv[my_optind]);
75 pcb.ss=atof(argv[my_optind+1]);
76 pcb.gg=atof(argv[my_optind+2]);
77 pcb.hh=atof(argv[my_optind+3]);
78 pcb.tt=atof(argv[my_optind+4]);
79 pcb.Er1=atof(argv[my_optind+5]);
80 pcb.Er2=atof(argv[my_optind+6]);
81 Er1=pcb.Er1;
82 Er2=pcb.Er2;
83 if(pcb.WW<0)
84 pcb.WW=6*pcb.hh+6*pcb.gg+6*pcb.ww+4*pcb.ss;
85 if(pcb.HH<0)
86 pcb.HH=6*(pcb.hh+pcb.tt);
87 /* Do some sanaity checks */
88 check_parameters_of_create_bmp_for_microstrip_coupler(pcb);
89 convert_create_create_bmp_for_coupled_microstrip_dimensions_to_integers(&pcb);
90 W=pcb.W;
91 H=pcb.H;
92 image_data_fp=fopen(argv[my_optind+7],"wb");
93 /*fprintf(stderr,"ints W=%d H=%d w=%d s=%d g=%d h=%d t=%d\n",pcb.W,pcb.H,pcb.w,pcb.s,pcb.g,pcb.h,pcb.t);*/
94 write_bitmap(image_data_fp, pcb);
95 }
96 else
97 usage_create_bmp_for_microstrip_coupler();
98 return(0);
99 }
100