1 /* atlc - arbitrary transmission line calculator, for the analysis of
2 transmission lines are directional couplers.
4 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
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.
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.
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,
21 Dr. David Kirkby, e-mail drkirkby at gmail.com
30 #include "definitions.h"
31 #include "exit_codes.h"
38 int main(int argc, char **argv)
43 int one=0, zero=0, minusone=0, other=0, length=0, i, reverse=0;
45 while((q=get_options(argc,argv,"Cr")) != -1)
49 print_copyright("2002");
50 exit_with_msg_and_exit_code("",OKAY);
58 if(argc-my_optind == 1)
60 fp=fopen(argv[my_optind],"rb");
63 fprintf(stderr,"Can't open %s for reading\n",argv[my_optind]);
64 exit_with_msg_and_exit_code("Can't open file for reading",CANT_OPEN_FILE_FOR_READING);
66 if (fseek(fp,0,SEEK_END) != 0)
67 exit_with_msg_and_exit_code("failed to fseek in readbin.c #1", FSEEK_FAILURE);
69 printf("file length=%d bytes. There are %ld pixels\n", length, (long)
70 length/sizeof(double));
71 data=dvector(0,length);
72 if( fseek(fp,0,SEEK_SET) != 0)
73 exit_with_msg_and_exit_code("failed to fseek in readbin.c #2", FSEEK_FAILURE);
75 if (fread(&(data[0]), (size_t) length, (size_t) 1,fp) != 1)
76 exit_with_msg_and_exit_code("can't read all fo the file in readbin.c", CANT_READ_ALL_OF_FILE);
77 for(i=0;i<length/sizeof(double);++i)
84 else if ( x > 0.9999999999 && x < 1.000000000000001)
86 else if (x < -0.9999999999 && x > -1.000000000000001)
88 else if (x == METAL_ER)
93 free_dvector(data,0L,(long) length);