/****************************************************************************/ /* */ /* Menu Routines for program SATMAP */ /* */ /****************************************************************************/ /* Define those variables used locally by these routines */ char Jobcode[3]; /* Job code of the project */ int RIN1; /* Row Index for 1 */ int RIN2; /* Row Index for 2 */ int RIN3; /* Row Index for 3 */ int RIN4; /* Row Index for 4 */ int RIN5; /* Row Index for 5 */ int CIN1; /* Column Index for 1 */ int CIN2; /* Column Index for 2 */ int CIN3; /* Column Index for 3 */ int CIN4; /* Column Index for 4 */ int CIN5; /* Column Index for 5 */ double COR1; /* Correlation for Row and Column 1 */ double COR2; /* Correlation for Row and Column 2 */ double COR3; /* Correlation for Row and Column 3 */ double COR4; /* Correlation for Row and Column 4 */ double COR5; /* Correlation for Row and Column 5 */ int Start_Year; /* Starting year of the project */ int Start_Month; /* Starting month of the project */ int Start_Day; /* Starting day of the project */ int End_Year; /* Ending year of the project */ int End_Month; /* Ending month of the project */ int End_Day; /* Ending Day of the project */ int Field; /* A counter used for menu screen I/O.*/ int Origin_SSN; /* Origin station serial number and suffix */ int Diff_SSN; /* Differential Sation serial number and suffic */ double DX; /* Delta x */ double SD1; /* Standard Deviation 1 */ double DY; /* Delta y */ double SD2; /* Standard Deviation 2 */ double DZ; /* Delta z */ double SD3; /* Standard Deviation 3 */ char Rejection_Code[2]; /* Rejeciton Code (non-blank to reject */ char Origin_ID[11]; /* Orign Station Data Media Identifier */ char Diff_ID[11]; /* Differential Station Data Media Identifier */ long int F_Act_Date; /* Date of first actual Measurement */ int F_Act_Time; /* Time of first actual Measurement */ long int L_Act_Date; /* Date of last actual Measurement */ int L_Act_Time; /* Time of last actual Measurement */ int Num_Vectors; /* Number of Vectors in Group (Session) */ char Software[17]; /* Software ID, File Type, and Version */ char Orbit_Source[7]; /* Orbit Source */ double Orbit_Accuracy; /* Orbit Accuracy (xxx.x meter) */ int Coordinate_Code; /* Solution Coordinate system code */ int Meteorological_Code; /* Solution Meteorological use code */ int Ionosphere_Code; /* Solution Ionssphere use code */ int Time_Code; /* Solution Time Parameter use code */ int Accuracy_Code; /* Nominal accuracy code */ long int Processing_Date; /* (CCYYMMDD) Date of processing */ char Processing_Agency[7]; /* Processing Agency code */ char temp[10]; char temp1[10]; char temp2[10]; int Base_X; /* First cursor X position on menu. */ int Base_Y; /* First cursor Y position on menu. */ int Bound_Y; /* Last cursor Y position on menu. */ /* Bound_X is the right limit of the screen */ int NumOfOptions; /* The number of options in main menu.*/ int i; char hold[81]; String_35 location; FILE *fopen(), *fd; /****************************************************************************/ /* Initialize parameters for menus */ /****************************************************************************/ void Initialize_Menus () { /* Procedure Initialize_Menus */ fd = fopen("default.fil", "r"); fgets(hold,81,fd); F_Act_Date = atol(hold); fgets(hold,81,fd); L_Act_Date = atol(hold); fgets(hold,81,fd); strncpy(Software, hold, 15); fgets(hold,81,fd); strncpy(Orbit_Source, hold, 5); fgets(hold,81,fd); Coordinate_Code = atoi(hold); fgets(hold,81,fd); Meteorological_Code = atoi(hold); fgets(hold,81,fd); Ionosphere_Code = atoi(hold); fgets(hold,81,fd); Time_Code = atoi(hold); fgets(hold,81,fd); Accuracy_Code = atoi(hold); fgets(hold,81,fd); strncpy(Processing_Agency, hold, 6); fgets(hold,81,fd); Processing_Date = atol(hold); fclose(fd); strcpy(Jobcode,"MD"); Start_Year = 1988; Start_Month = 8; Start_Day = 01; End_Year = 1989; End_Month = 02; End_Day = 15; F_Act_Time = 0; L_Act_Time = 0; Num_Vectors = 1; Orbit_Accuracy = 00.0; Origin_SSN= 100; Diff_SSN = 101; DX = 0; SD1 = 0; DY = 0; SD2 = 0; DZ = 0; SD3 = 0; strcpy(Orbit_Source, "BCST "); strcpy(Rejection_Code, " "); strcpy(Origin_ID, "D1668ASHEP"); strcpy(Diff_ID, "D1668ASHEZ"); RIN1 = 1; CIN1 = 2; RIN2 = 1; CIN2 = 3; RIN3 = 2; CIN3 = 3; }; /* Procedure Initialize_Menus */ /****************************************************************************/ /* Print a menu */ /****************************************************************************/ void Print_Menu (int Menu_Page, int *Base_X, int *Base_Y, int *Bound_Y) { /* This procedure prints the menu corresponding to the 'Menu Page' of */ /* user setectable program options. The variables 'Base_X','Base_Y', and */ /* 'Bound_Y' define the bounds of the cursor: dependent upon the menu */ /* page. */ /* Procedure Print_Menu */ switch (Menu_Page) { case 1 : /* Project Record */ { printf (" Project Record Information. \n"); printf (" -- Use %c and %c to move the cursor ", 24, 25); printf ("to desired option.\n"); printf (" -- Hit when all changes are complete.\n"); printf ("\n"); printf (" 2 Character Job code.......%s\n", Jobcode); printf (" Year, Start of Project.....%04d\n", Start_Year); printf (" Month, Start of Project....%02d\n", Start_Month); printf (" Day, Start of project....%02d\n", Start_Day); printf (" Year, End of Project......%04d\n", End_Year); printf (" Month, End of Project......%02d\n", End_Month); printf (" Day, End of Project......%02d\n", End_Day); *Base_X = 30; *Base_Y = 5; *Bound_Y = 12; break; }; /* Case of Project Record */ case 2 : /* Azimuth/elevation/time calculation parameter menu page */ { printf (" Group Header Record. \n"); printf (" -- Use %c and %c to move the cursor ", 24, 25); printf ("to desired option.\n"); printf (" -- Hit when all changes are complete.\n"); printf ("\n"); printf (" Date, First Actual Measurement (CCYYMMDD)...%08ld\n", F_Act_Date); printf (" Time, First Actual Measurement.(HHMM UTC)...%04d\n", F_Act_Time); printf (" Date, Last Actual Measurement (CCYYMMDD)...%08ld\n", L_Act_Date); printf (" Time, Last Actual Measurement..(HHMM UTC)...%04d\n", L_Act_Time); printf (" Number of Vectors in Group..................%02d\n", Num_Vectors); printf (" Software ID & Version.......................%s\n", Software); printf (" Orbit Source................................%s\n", Orbit_Source); printf (" Orbit Accuracy..............................%03.1f\n", Orbit_Accuracy); printf (" Solution Coordinate System Code.............%02d\n", Coordinate_Code); printf (" Solution Meteorological Use Code............%02d\n", Meteorological_Code); printf (" Solution Ionosphere Use Code................%02d\n", Ionosphere_Code); printf (" Solution Time Parameter Use Code............%02d\n", Time_Code); printf (" Nominal Accuracy Code.......................%01d\n", Accuracy_Code); printf (" Processing Agency Code......................%s\n", Processing_Agency); printf (" Date of Processing..........................%08ld\n", Processing_Date); *Base_X = 47; *Base_Y = 5; *Bound_Y = 20; break; }; /* Azimuth/elevation/time calculation parameter menu page */ case 3: /* Member Record */ { printf (" Member Record \n"); printf (" -- Use %c and %c to move the cursor ", 24, 25); printf ("to desired option.\n"); printf (" -- Hit when all changes are complete.\n"); printf ("\n"); printf (" Origin Station Number and Suffix..(SSN)....%04d\n", Origin_SSN); printf (" Differential Station Number and Suffix.....%04d\n", Diff_SSN); printf (" Delta X....................................%07.4f\n", DX); printf (" Standard Deviation.........................%01.4f\n", SD1); printf (" Delta Y....................................%07.4f\n", DY); printf (" Standard Deviation.........................%01.4f\n", SD2); printf (" Delta Z....................................%07.4f\n", DZ); printf (" Standard Deviation.........................%01.4f\n", SD3); printf (" Rejection Code (non-blank to reject).......%s\n", Rejection_Code); printf (" Origin Station Data Media Identifier.......%s\n", Origin_ID); printf (" Differential Station Data Media Identifier.%s\n", Diff_ID); *Base_X = 46; *Base_Y = 5; *Bound_Y = 16; break; }; /* Member Record parameter menu page */ case 4: /* Correlation Record */ { printf (" Correlation Record \n"); printf (" -- Use %c and %c to move the cursor ", 24, 25); printf ("to desired option.\n"); printf (" -- Hit when all changes are complete.\n"); printf ("\n"); printf (" Row Index Number...........................%03d\n", RIN1); printf (" Column Index Number........................%03d\n", CIN1); printf (" Correlation................................%02.7f\n", COR1); printf (" Row Index Number...........................%03d\n", RIN2); printf (" Column Index Number........................%03d\n", CIN2); printf (" Correlation................................%02.7f\n", COR2); printf (" Row Index Number...........................%03d\n", RIN3); printf (" Column Index Number........................%03d\n", CIN3); printf (" Correlation................................%02.7f\n", COR3); printf (" Row Index Number...........................%03d\n", RIN4); printf (" Column Index Number........................%03d\n", CIN4); printf (" Correlation................................%02.7f\n", COR4); printf (" Row Index Number...........................%03d\n", RIN5); printf (" Column Index Number........................%03d\n", CIN5); printf (" Correlation................................%02.7f\n", COR5); printf ("\n"); printf ("DISREGARD THIS MENU IF YOU ARE DOING DOPPLER\n"); printf ("TRANSLOCATION SOLUTIONS. CONTINUE TO NEXT MENU!\n"); *Base_X = 46; *Base_Y = 5; *Bound_Y = 20; break; }; /* Member Record parameter menu page */ case 5: /* Correlation Record */ { printf (" DEFAULT FILE FORMAT SETUP\n"); printf (" -- Use %c and %c to move the cursor ", 24, 25); printf ("to desired option.\n"); printf (" -- Hit when all changes are complete.\n"); printf ("\n"); printf (" Software ID & Version......................%s\n", Software); printf (" Orbit Source...............................%s\n", Orbit_Source); printf (" Solution Coordinate System Code............%02d\n", Coordinate_Code); printf (" Solution Meteorological Use Code...........%02d\n", Meteorological_Code); printf (" Solution Ionosphere Use Code...............%02d\n", Ionosphere_Code); printf (" Solution Time Parameter Use Code...........%02d\n", Time_Code); printf (" Nominal Accuracy Code......................%d\n", Accuracy_Code); printf (" Processing Agency Code.....................%s\n", Processing_Agency); printf (" Date of Processing.........................%08ld\n", Processing_Date); *Base_X = 46; *Base_Y = 5; *Bound_Y = 14; break; }; /* Member Record parameter menu page */ }; /* Case selection of menus */ gotoxy (*Base_X, *Base_Y); }; /* Procedure Print_Menu */ /*****************************************************************************/ /* Assign a value to a Integer program option. */ /*****************************************************************************/ void Set_Val_I (int Low_Bound, int High_bound, int Field_Length, int Buf_len, int *Data_Field, Data_Buffer Buffer, int Field) { int Holder; /* Holds the integer value of 'Buffer'. */ char string[5]; /* Procedure Set_Val_I */ if (Buf_len != 0) /* The field should be updated: If */ /* Buf_Len = 0 then an illegal */ /* character was entered by the user. */ { /* Extract the integer value stored in the user I/O buffer. */ Holder = atoi(Buffer); /* Check the limits of the buffer value */ if ((Holder < Low_Bound) || (Holder > High_bound)) /* Illegal value */ BEEP (); else /* legal value */ *Data_Field = Holder; }; /* Write the value */ gotoxy (Base_X, Base_Y + Field - 1); sprintf(string, "%%0%dd", Field_Length); printf (string, *Data_Field); clreol (); gotoxy (Base_X, Base_Y + Field - 1); }; /* Procedure Set_Val_I */ /*****************************************************************************/ /* Assign a value to a Date Integer program option. */ /*****************************************************************************/ void Set_Val_Date (int Field_Length, long int Buf_len, long int *Data_Field, Data_Buffer Buffer, long int Field) { char Holder[80]; /* Holds the integer value of 'Buffer'. */ char string[5]; int year; int month; int day; /* Procedure Set_Val_I */ if (Buf_len != 0) /* The field should be updated: If */ /* Buf_Len = 0 then an illegal */ /* character was entered by the user. */ { /* Extract the integer value stored in the user I/O buffer. */ substr(Buffer, string, 0, 4); year = atoi(string); substr(Buffer, string, 4, 2); month = atoi(string); substr(Buffer, string, 6, 2); day = atoi(string); /* Check the limits of the buffer value */ if (((year < 1965) || (year > 2000)) || ((month < 1) || (month > 12)) || ((day < 1) || (day > 31))) /* Illegal value */ BEEP (); else *Data_Field = atol(Buffer); }; /* Write the value */ gotoxy (Base_X, Base_Y + Field - 1); sprintf(string, "%%0%dld", Field_Length); printf (string, *Data_Field); clreol (); gotoxy (Base_X, Base_Y + Field - 1); }; /* Procedure Set_Val_I */ /****************************************************************************/ /* Assign a value to a Real program option. */ /****************************************************************************/ void Set_Val_R (double Low_Bound, double High_bound, int Field_Length, int Float_Length, double *Data_Field, int Buf_len, Data_Buffer Buffer, int Field) { double Holder; /* Holds the real value of 'Buffer'. */ char string[10]; /* Procedure Set_Val_R */ if (Buf_len != 0) /* The field should be updated: If */ /* Buf_Len = 0 then an illegal */ /* character was entered by the user. */ { /* Extract the real value stored in the user I/O buffer. */ Holder = atof(Buffer); /* Check the limits of the buffer value */ if ((Holder < Low_Bound) || (Holder > High_bound)) /* Illegal value */ BEEP (); else /* legal value */ *Data_Field = Holder; }; /* Write the value */ gotoxy (Base_X,Base_Y + Field - 1); sprintf(string, "%%0%d.%dlf", Field_Length, Float_Length); printf (string, *Data_Field); clreol (); gotoxy (Base_X, Base_Y + Field - 1); }; /* Procedure Set_Val_R */ /****************************************************************************/ /* Assign a value to a string program option. */ /****************************************************************************/ void Set_Val_S (int Field_Length, String_35 Data_Field, int Buf_len, Data_Buffer Buffer, int Field) { char T_Buff[255]; /* Holds the character */ /* value of 'Data_Buffer'. */ char Holder[255]; /* Temporary buffer. */ int I; /* Loop control and index variable. */ /* Procedure Set_Val_S */ strcpy (T_Buff, Data_Field); if (Buf_len != 0) /* The field should be updated: If */ /* Buf_Len = 0 then an illegal */ /* character was entered by the user. */ { /* Clear the Buffer */ strcpy (Data_Field, "\0"); strcpy (T_Buff, "\0"); /* Extract the string value stored in the user I/O buffer. */ for (I = 0; I <= Buf_len; I++) Holder [I] = Buffer [I]; /* Check string lengths */ if ((Buf_len < 1) || (Buf_len > Field_Length)) /* Illegal value */ BEEP (); else /* legal value */ for (I = 0; I <= Buf_len; I++) { T_Buff [I] = Holder [I]; Data_Field[I] = Holder [I]; }; }; /* Write the value */ gotoxy (Base_X, Base_Y + Field - 1); printf ("%s", T_Buff); clreol (); gotoxy (Base_X, Base_Y + Field - 1); }; /* Procedure Set_Val_S */ /****************************************************************************/ /* Update the value of a user selectable program option. */ /****************************************************************************/ void Update_Field (int Menu_Page, int Field, int Buf_len, Data_Buffer Buffer) { /* Procedure Update_Field */ switch (Menu_Page) { case 1: /* Project Record */ { switch (Field) { case 1: { Set_Val_S (2, Jobcode, Buf_len, Buffer, Field); break; }; case 2: { Set_Val_I (1965, 2000, 4, Buf_len, &Start_Year, Buffer, Field); break; }; case 3: { Set_Val_I (1, 12, 2, Buf_len, &Start_Month, Buffer, Field); break; }; case 4: { Set_Val_I (1, 31, 2, Buf_len, &Start_Day, Buffer, Field); break; }; case 5: { Set_Val_I (1965, 2000, 4, Buf_len, &End_Year, Buffer, Field); break; }; /* Case of 5 */ case 6: { Set_Val_I (1, 12, 2, Buf_len, &End_Month, Buffer, Field); break; }; case 7: { Set_Val_I (1, 31, 2, Buf_len, &End_Day, Buffer, Field); break; }; }; break; }; /* Case of Project Record menu page */ case 2:{ /* Group Header parameter menu */ switch (Field) { case 1: { Set_Val_Date (8, Buf_len, &F_Act_Date, Buffer, Field); break; }; case 2: { Set_Val_I (0, 2400, 4, Buf_len, &F_Act_Time, Buffer, Field); break; }; case 3: { Set_Val_Date (8, Buf_len, &L_Act_Date, Buffer, Field); break; }; case 4: { Set_Val_I (0, 2400, 4, Buf_len, &L_Act_Time, Buffer, Field); break; }; case 5: { Set_Val_I (1, 25, 2, Buf_len, &Num_Vectors, Buffer, Field); break; }; /* Case of 5 */ case 6: { Set_Val_S (15, Software, Buf_len, Buffer, Field); break; }; case 7: { Set_Val_S (5, Orbit_Source, Buf_len, Buffer, Field); break; }; case 8: { Set_Val_R (0.0, 999.9, 3, 1, &Orbit_Accuracy, Buf_len, Buffer, Field); break; }; case 9: { Set_Val_I (01, 02, 2, Buf_len, &Coordinate_Code, Buffer, Field); break; }; case 10: { Set_Val_I (01, 02, 2, Buf_len, &Meteorological_Code, Buffer, Field); break; }; case 11: { Set_Val_I (01, 02, 2, Buf_len, &Ionosphere_Code, Buffer, Field); break; }; case 12: { Set_Val_I (01, 02, 2, Buf_len, &Time_Code, Buffer, Field); break; }; case 13: { Set_Val_I (4, 6, 1, Buf_len, &Accuracy_Code, Buffer, Field); break; }; case 14: { Set_Val_S (6, Processing_Agency, Buf_len, Buffer, Field); break; }; case 15: { Set_Val_Date (8, Buf_len, &Processing_Date, Buffer, Field); break; }; }; break; }; /* Group Header parameter menu page */ case 3:{ /* Member Record parameter menu page */ switch (Field) { case 1: { Set_Val_I (0, 9999, 4, Buf_len, &Origin_SSN, Buffer, Field); break; }; case 2: { Set_Val_I (0, 9999, 4, Buf_len, &Diff_SSN, Buffer, Field); break; }; case 3: { Set_Val_R (-999999.9999, 9999999.9999, 7, 4, &DX, Buf_len, Buffer, Field); break; }; case 4: { Set_Val_R (0.0, 9.9999, 1, 4, &SD1, Buf_len, Buffer, Field); break; }; case 5: { Set_Val_R (-999999.9999, 9999999.9999, 7, 4, &DY, Buf_len, Buffer, Field); break; }; case 6: { Set_Val_R (0.0, 9.9999, 1, 4, &SD2, Buf_len, Buffer, Field); break; }; case 7: { Set_Val_R (-999999.9999, 9999999.9999, 7, 4, &DZ, Buf_len, Buffer, Field); break; }; case 8: { Set_Val_R (0.0, 9.9999, 1, 4, &SD3, Buf_len, Buffer, Field); break; }; case 9: { Set_Val_S (1, Rejection_Code, Buf_len, Buffer, Field); break; }; case 10: { Set_Val_S (10, Origin_ID, Buf_len, Buffer, Field); break; }; case 11: { Set_Val_S (10, Diff_ID, Buf_len, Buffer, Field); break; }; }; break; }; /* Group Header parameter menu page */ case 4:{ /* Cirrelation Record parameter menu page */ switch (Field) { case 1: { Set_Val_I (0, 999, 3, Buf_len, &RIN1, Buffer, Field); break; }; case 2: { Set_Val_I (0, 999, 3, Buf_len, &CIN1, Buffer, Field); break; }; case 3: { Set_Val_R (-1.0000000, 1.0000000, 2, 7, &COR1, Buf_len, Buffer, Field); break; }; case 4: { Set_Val_I (0, 999, 3, Buf_len, &RIN2, Buffer, Field); break; }; case 5: { Set_Val_I (0, 999, 3, Buf_len, &CIN2, Buffer, Field); break; }; case 6: { Set_Val_R (-1.0000000, 1.0000000, 2, 7, &COR2, Buf_len, Buffer, Field); break; }; case 7: { Set_Val_I (0, 999, 3, Buf_len, &RIN3, Buffer, Field); break; }; case 8: { Set_Val_I (0, 999, 3, Buf_len, &CIN3, Buffer, Field); break; }; case 9: { Set_Val_R (-1.0000000, 1.0000000, 2, 7, &COR3, Buf_len, Buffer, Field); break; }; case 10: { Set_Val_I (0, 999, 3, Buf_len, &RIN4, Buffer, Field); break; }; case 11: { Set_Val_I (0, 999, 3, Buf_len, &CIN4, Buffer, Field); break; }; case 12: { Set_Val_R (-1.0000000, 1.0000000, 2, 7, &COR4, Buf_len, Buffer, Field); break; }; case 13: { Set_Val_I (0, 999, 3, Buf_len, &RIN5, Buffer, Field); break; }; case 14: { Set_Val_I (0, 999, 3, Buf_len, &CIN5, Buffer, Field); break; }; case 15: { Set_Val_R (-1.0000000, 1.0000000, 2, 7, &COR5, Buf_len, Buffer, Field); break; }; }; break; }; /*Correlation Record parameter menu page */ case 5:{ /* Group Header parameter menu */ switch (Field) { case 1: { Set_Val_S (15, Software, Buf_len, Buffer, Field); break; }; case 2: { Set_Val_S (5, Orbit_Source, Buf_len, Buffer, Field); break; }; case 3: { Set_Val_I (01, 02, 2, Buf_len, &Coordinate_Code, Buffer, Field); break; }; case 4: { Set_Val_I (01, 02, 2, Buf_len, &Meteorological_Code, Buffer, Field); break; }; case 5: { Set_Val_I (01, 02, 2, Buf_len, &Ionosphere_Code, Buffer, Field); break; }; case 6: { Set_Val_I (01, 02, 2, Buf_len, &Time_Code, Buffer, Field); break; }; case 7: { Set_Val_I (4, 6, 1, Buf_len, &Accuracy_Code, Buffer, Field); break; }; case 8: { Set_Val_S (6, Processing_Agency, Buf_len, Buffer, Field); break; }; case 9: { Set_Val_Date (8, Buf_len, &Processing_Date, Buffer, Field); break; }; }; break; }; case 10: /* Program Display option Menu */ { }; }; /* Switch of menu selections */ }; /* Procedure Update_Field */ /****************************************************************************/ /* Activate program options selected by user. */ /****************************************************************************/ /****************************************************************************/ /* Add a character to the user buffer */ /****************************************************************************/ void Add_C_to_Buffer (int *In_Len, int Menu_Page, Data_Buffer In_Buff, char C, int Field) { int I; /* Loop control and index variable */ /* Procedure Add_C */ /* Increment the buffer count */ if (! ((Menu_Page == 1) && (Field == 1))) clreol (); else { for (I = (*In_Len) + 1; I < 35; I++) printf ("_"); gotoxy (Base_X + *In_Len+1, Base_Y+Field-1); }; /* Place the character into the buffer */ In_Buff[*In_Len] = C; /* Ensure user input does not cause screen wrap */ if (*In_Len + Base_X >= 79) /* Too long of a Field */ { Update_Field (Menu_Page, Field, *In_Len, In_Buff); *In_Len = 0; strcpy (In_Buff, ""); BEEP (); }; (*In_Len)++; }; /* Procedure Add_C */ /****************************************************************************/ /* Main menu driver. */ /****************************************************************************/ void Menu_Control (int Menu_Page, FILE *fp) { int Field; /* A counter used for menu screen I/O. */ Data_Buffer In_Buff; /* Holds user keyboard input stream. */ int In_Len; /* Counts the number of characters entered for a */ /* given input field. */ int Done; /* Becomes true when all user selected */ /* computation parameters are valid. */ char C; /* User 1-character keyboard character. */ /* Procedure Menu_Control */ do /* Until user has entered correct values */ { clrscr (); /* Print the menu, values of each option, and obtain the cursor control */ /* boundaries. */ Print_Menu (Menu_Page, &Base_X, &Base_Y, &Bound_Y); Field = 1; In_Len = 0; setmem (In_Buff, 255, 0x00); do /* update Fields until */ { Done = 0; C = Keyboard_Char (); if ((C > 31) && (C < 123))/*Legal character to be added to the buffer*/ Add_C_to_Buffer (&In_Len, Menu_Page, In_Buff, C, Field); else if (C == 0) /* Escape : Beginning of cursor control string */ { /* Get movement character */ C = getch (); /* Check for legal cursor movement character */ if (!((C == 80) || (C == 72))) /* Illegal character */ { /* Void the character buffer entered by the user */ In_Len = 0; setmem (In_Buff, 255, 0x00); Update_Field (Menu_Page, Field, In_Len, In_Buff); BEEP (); } else /* Legal character */ { /*Update the field according to the value in the buffer*/ Update_Field (Menu_Page, Field, In_Len, In_Buff); In_Len = 0; setmem (In_Buff, 255, 0x00); /* Change the Feild pointer and move the cursor to that*/ /* field. */ if (C == 80) Field++; else Field--; if (Field+Base_Y > Bound_Y) Field = 1; if (Field < 1) Field = Bound_Y - Base_Y; gotoxy (Base_X, Base_Y + Field - 1); }; } else if (C == 13) /* Carriage return */ /* All values have been updated */ { Done = 1; Update_Field (Menu_Page, Field, In_Len, In_Buff); In_Len = 0; setmem (In_Buff, 255, 0x00); } else { /* illegal character */ In_Len = 0; setmem (In_Buff, 255, 0x00); Update_Field (Menu_Page, Field, In_Len, In_Buff); BEEP (); }; } while (!(Done)); gotoxy (1,24); printf (" All above values correct (Y/N)? \n"); if (Get_YN(40,24,'N') == 'N') { Done = 0; /* Current values not correct */ } else { if(Menu_Page == 1) { strupr(Jobcode); fprintf(fp, "A%-2s%4d%02d%02d%02d%02d\n", Jobcode, Start_Year, Start_Month, Start_Day, End_Year,End_Month,End_Day); } else if(Menu_Page == 2) { strupr(Software); strupr(Orbit_Source); strupr(Processing_Agency); Orbit_Accuracy = Orbit_Accuracy * 10; fprintf(fp, "B%ld%04d%ld%04d%02d%-15s%-5s%04.0f%02d%02d%02d%02d%d%-6s%ld\n", F_Act_Date, F_Act_Time, L_Act_Date, L_Act_Time, Num_Vectors, Software, Orbit_Source, Orbit_Accuracy, Coordinate_Code, Meteorological_Code, Ionosphere_Code, Time_Code, Accuracy_Code, Processing_Agency, Processing_Date); } else if(Menu_Page == 3) { strupr(Origin_SSN); strupr(Diff_SSN); strupr(Origin_ID); strupr(Diff_ID); fprintf(fp,"C%04d%04d%11.0f%5.0f%11.0f%5.0f%11.0f%5.0f%-1s%-9s%-9s\n", Origin_SSN, Diff_SSN, DX*10000, SD1*10000, DY*10000, SD2*10000, DZ*10000, SD3*10000, Rejection_Code, Origin_ID, Diff_ID); } else if(Menu_Page == 4) { fprintf(fp,"D%03d%03d%09.0f%03d%03d%09.0f%03d%03d%09.0f%03d%03d%09.0f%03d%03d%09.0f\n", RIN1,CIN1,COR1*10000000,RIN2,CIN2,COR2*10000000,RIN3,CIN3,COR3*10000000, RIN4,CIN4,COR4*10000000,RIN5,CIN5,COR5*10000000); } else if(Menu_Page == 5) { fprintf(fp,"%ld\n%ld\n%-15s\n%-5s\n%2d\n%2d\n%2d\n%2d\n%d\n%-6s\n%ld\n", F_Act_Date, L_Act_Date, Software, Orbit_Source,Coordinate_Code, Meteorological_Code, Ionosphere_Code, Time_Code, Accuracy_Code, Processing_Agency, Processing_Date); } } } while (!(Done)); /* i.e. all values correct */ }; /* Procedure Menu_Control */