1 #ifdef HAVE_STDLIB_H
2 #include <stdlib.h>
3 #endif
4 #include <math.h>
5 #include <stdio.h>
6 #include "yagi.h"
7 /* This function is supposed to allow the user to change the weights etc
8 while the program is running. Until I can find a way of doing it under
9 unix, it will stay commented out. */
10
dynamic_changing_of_weights(int i,int divisor,struct performance_data * weight)11 void dynamic_changing_of_weights(int i, int divisor, struct performance_data *weight)
12 {
13 char c, *str;
14 if(i%divisor==0)
15 {
16 #define MAXINPUTLINE 100L
17 str=string(0L,MAXINPUTLINE);
18 if((fopen("change","rt"))!=NULL)
19 {
20 system("rm change");
21 printf("Enter a letter - G, F, P, R, S or X\n");
22 c=getc(stdin);
23 switch (c)
24 {
25 case 'G':
26 printf("Enter new weight for gain -current weight=%f\n",weight->gain);
27 fgets(str, MAXINPUTLINE-1, stdin);
28 weight->gain=atof(str);
29 fflush(stdin);
30 break;
31
32 case 'F':
33 printf("Enter new weight for FB -current weight=%f\n",weight->fb);
34 fgets(str, MAXINPUTLINE-1, stdin);
35 weight->fb=atof(str);
36 break;
37
38 case 'P':
39 printf("Enter new weight for sidelobe -current weight=%f\n",weight->sidelobe);
40 fgets(str, MAXINPUTLINE-1, stdin);
41 weight->sidelobe=atof(str);
42 break;
43 } /* end of switch statement */
44 } /* end of if file exits/user hit keyboard */
45 free_string(str,0L,MAXINPUTLINE);
46 } /* end of if divisor%10==0 */
47 } /* function */
48