home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- subject: v09i016: FPLAN 6/6
- from: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
- Reply-To: tynor@prism.gatech.edu (Steve Tynor)
-
- Posting-number: Volume 9, Issue 16
- Submitted-by: tynor@prism.gatech.edu (Steve Tynor)
- Archive-name: fplan/part06
-
- #This is part 6/6 of FPLAN
- #!/bin/sh
- # shar: Shell Archiver (v1.22)
- # Packed Mon Nov 20 19:28:42 EST 1989 by gaffa!tynor
- # from directory /files/home/users/tynor/src/fplan
- #
- # Run the following text with /bin/sh to create:
- # fp_lex.l
- # fp_yacc.y
- # sv_draw.c
- # dosbuild.bat
- # mystring.h
- # wp_info.h
- # reverse.c
- # version.h
- #
- echo "x - extracting fp_lex.l (Text)"
- sed 's/^X//' << 'SHAR_EOF' > fp_lex.l &&
- X%{
- X/*
- X * $Id: fp_lex.l,v 2.4 89/11/14 20:28:11 tynor Exp $
- X *----------------------------------------------------------------------------
- X * FPLAN - Flight Planner
- X * Steve Tynor
- X * tynor@prism.gatech.edu
- X *
- X * This program is in the public domain. Permission to copy,
- X * distribute, modify this program is hearby given as long as this header
- X * remains. If you redistribute this program after modifying it, please
- X * document your changes so that I do not take the blame (or credit) for
- X * those changes. If you fix bugs or add features, please send me a
- X * patch so that I can keep the 'official' version up-to-date.
- X *
- X * Bug reports are welcome and I'll make an attempt to fix those
- X * that are reported.
- X *
- X * USE AT YOUR OWN RISK! I assume no responsibility for any
- X * errors in this program, its database or documentation. I will make an
- X * effort to fix bugs, but if you crash and burn because, for example,
- X * fuel estimates in this program were inaccurate, it's your own fault
- X * for trusting somebody else's code! Remember, as PIC, it's _your_
- X * responsibility to do complete preflight planning. Use this program as
- X * a flight planning aid, but verify its results before using them.
- X *----------------------------------------------------------------------------
- X */
- X
- X#include "fp_tok.h"
- X
- Xstatic char rcsid[] = "$Id: fp_lex.l,v 2.4 89/11/14 20:28:11 tynor Exp $";
- X
- Xdouble yydval;
- Xextern double atof();
- X
- X%}
- X
- X%%
- X
- X\#.*$ ; /* comment */
- X\" { int i;
- X for (i = 0; (yytext[i] = input()) != '\"'; i++) {
- X if (yytext[i] == '\"')
- X break;
- X if (yytext[i] == '\\')
- X yytext[i] = input();
- X }
- X yytext[i] = '\0';
- X return TOK_STRING;
- X };
- Xalt return TOK_ALT;
- Xvia return TOK_VIA;
- Xfrom return TOK_FROM;
- Xto return TOK_TO;
- Xmi return TOK_MI;
- Xnm return TOK_NM;
- Xmph return TOK_MPH;
- Xkts return TOK_KTS;
- Xnav return TOK_NAV;
- Xwind return TOK_WIND;
- Xtas return TOK_TAS;
- Xfuel_amt return TOK_FUEL_AMT;
- Xfuel_rate return TOK_FUEL_RATE;
- Xfuel_used return TOK_FUEL_USED;
- X
- X\@ return TOK_ATSIGN;
- X
- X[\+\-]?[0-9]+\.[0-9]+ { yydval = atof (yytext);
- X return TOK_REAL;
- X };
- X[\+\-]?[0-9]+ { yydval = atof (yytext);
- X return TOK_INTEGER;
- X };
- X\_?[0-9A-Za-z]+ return TOK_SYMBOL; /* use a leading _ for personal waypoints */
- X\:\= return TOK_ASSIGN;
- X\; return TOK_SEMICOLON;
- X\, return TOK_COMMA;
- X\( return TOK_LPAREN;
- X\) return TOK_RPAREN;
- X[ \t\n] ; /* ignore whitespace */
- X. ; /* ignore anything else too */
- X%%
- SHAR_EOF
- chmod 0444 fp_lex.l || echo "restore of fp_lex.l fails"
- echo "x - extracting fp_yacc.y (Text)"
- sed 's/^X//' << 'SHAR_EOF' > fp_yacc.y &&
- X%{
- X/*
- X * $Id: fp_yacc.y,v 2.5 89/11/11 19:17:00 tynor Exp $
- X *----------------------------------------------------------------------------
- X * FPLAN - Flight Planner
- X * Steve Tynor
- X * tynor@prism.gatech.edu
- X *
- X * This program is in the public domain. Permission to copy,
- X * distribute, modify this program is hearby given as long as this header
- X * remains. If you redistribute this program after modifying it, please
- X * document your changes so that I do not take the blame (or credit) for
- X * those changes. If you fix bugs or add features, please send me a
- X * patch so that I can keep the 'official' version up-to-date.
- X *
- X * Bug reports are welcome and I'll make an attempt to fix those
- X * that are reported.
- X *
- X * USE AT YOUR OWN RISK! I assume no responsibility for any
- X * errors in this program, its database or documentation. I will make an
- X * effort to fix bugs, but if you crash and burn because, for example,
- X * fuel estimates in this program were inaccurate, it's your own fault
- X * for trusting somebody else's code! Remember, as PIC, it's _your_
- X * responsibility to do complete preflight planning. Use this program as
- X * a flight planning aid, but verify its results before using them.
- X *----------------------------------------------------------------------------
- X */
- X
- X#include "wp_info.h"
- X#include "mystring.h"
- X
- Xstatic char rcsid[] = "$Id: fp_yacc.y,v 2.5 89/11/11 19:17:00 tynor Exp $";
- X
- Xextern double degrees_mins_2_decimal ();
- X
- Xextern double yydval;
- Xextern char yytext[];
- X
- Xtypedef union {
- X int ival;
- X double dval;
- X char *sval;
- X WAYPOINT_KIND kval;
- X} YYSTYPE;
- X
- X%}
- X
- X%type <kval> waypoint_kind
- X /*
- X * %type <dval> radial
- X */
- X%type <dval> number
- X%type <dval> latitude
- X%type <dval> longitude
- X%type <dval> heading
- X%type <dval> distance
- X%type <dval> speed
- X%type <sval> optional_string
- X%type <sval> desig
- X
- X%token TOK_SEMICOLON
- X%token TOK_ASSIGN
- X%token TOK_VIA
- X%token TOK_ALT
- X%token TOK_FROM
- X%token TOK_TO
- X%token TOK_MI
- X%token TOK_NM
- X%token TOK_MPH
- X%token TOK_KTS
- X%token TOK_COMMA
- X%token TOK_REAL
- X%token TOK_INTEGER
- X%token TOK_NAV
- X%token TOK_WIND
- X%token TOK_TAS
- X%token TOK_LPAREN
- X%token TOK_RPAREN
- X%token TOK_FUEL_AMT
- X%token TOK_FUEL_RATE
- X%token TOK_FUEL_USED
- X%token TOK_STRING
- X%token TOK_SYMBOL
- X%token TOK_ATSIGN
- X
- X%start fplan
- X
- X%%
- X
- Xfplan : directives
- X ;
- X
- Xdirectives : /* empty */
- X | directives directive
- X ;
- X
- Xdirective : named_waypoint TOK_SEMICOLON
- X | inc_waypoint TOK_SEMICOLON
- X /* | int_waypoint TOK_SEMICOLON */
- X | lat_waypoint TOK_SEMICOLON
- X | nav_fix TOK_SEMICOLON
- X | true_airspeed TOK_SEMICOLON
- X | wind TOK_SEMICOLON
- X | fuel_amt TOK_SEMICOLON
- X | fuel_rate TOK_SEMICOLON
- X | fuel_used TOK_SEMICOLON
- X | flight_altitude TOK_SEMICOLON
- X ;
- X
- Xnamed_waypoint : waypoint_kind desig
- X {add_named_waypoint ($1, $2);}
- X
- Xinc_waypoint : waypoint_kind distance
- X optional_string optional_string optional_string
- X {add_inc_waypoint ($2, $3, $4, $5);}
- X ;
- X
- X/*
- X *int_waypoint : waypoint_kind desig TOK_COMMA radial TOK_COMMA desig
- X * TOK_COMMA radial optional_string
- X * {add_int_waypoint ($1, $2, $4, $6, $8, $9);}
- X * ;
- X */
- X
- Xlat_waypoint : waypoint_kind latitude TOK_COMMA longitude
- X optional_string optional_string optional_string
- X {add_lat_waypoint ($1, $2, $4, $5, $6, $7);}
- X ;
- X
- Xwaypoint_kind : TOK_FROM {$$ = WP_FROM;}
- X | TOK_VIA {$$ = WP_VIA;}
- X | TOK_TO {$$ = WP_TO;}
- X ;
- X
- Xnav_fix : TOK_NAV TOK_LPAREN number TOK_RPAREN desig
- X {set_xfix ((int) $3, $5);}
- X ;
- X
- Xtrue_airspeed : TOK_TAS speed {set_tas ($2);}
- X ;
- X
- Xwind : TOK_WIND heading TOK_ATSIGN speed
- X {set_wind ($2, $4);}
- X ;
- X
- Xfuel_amt : TOK_FUEL_AMT number {set_fuel_amt ($2);}
- X ;
- X
- Xfuel_rate : TOK_FUEL_RATE number {set_fuel_rate ($2);}
- X ;
- X
- Xfuel_used : TOK_FUEL_USED number {set_extra_fuel_burn ($2);}
- X ;
- X
- Xflight_altitude : TOK_ALT number {set_altitude ($2);}
- X ;
- X
- Xlatitude : TOK_REAL {$$ = degrees_mins_2_decimal (yydval);}
- X ;
- X
- Xlongitude : TOK_REAL {$$ = degrees_mins_2_decimal (yydval);}
- X ;
- X
- Xoptional_string : /* empty */ {$$ = (char*) 0;}
- X | TOK_COMMA TOK_STRING {$$ = strdup (yytext);}
- X ;
- X
- Xdesig : TOK_SYMBOL {$$ = strdup (yytext);}
- X ;
- X
- Xnumber : TOK_REAL {$$ = yydval;}
- X | TOK_INTEGER {$$ = yydval;}
- X ;
- X
- Xdistance : number TOK_MI {$$ = $1 / MI_PER_NM;}
- X | number {$$ = $1;}
- X | number TOK_NM {$$ = $1;}
- X ;
- X
- Xspeed : number TOK_MPH {$$ = $1 / MI_PER_NM;}
- X | number {$$ = $1;}
- X | number TOK_KTS {$$ = $1;}
- X ;
- X
- X/*
- X *radial : heading
- X * ;
- X */
- X
- Xheading : number {$$ = $1;}
- X ;
- SHAR_EOF
- chmod 0444 fp_yacc.y || echo "restore of fp_yacc.y fails"
- echo "x - extracting sv_draw.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > sv_draw.c &&
- X/*
- X * $Id: sv_draw.c,v 1.3 89/11/11 19:43:17 tynor Exp $
- X *----------------------------------------------------------------------------
- X * FPLAN - Flight Planner
- X * Steve Tynor
- X * tynor@prism.gatech.edu
- X *
- X * This program is in the public domain. Permission to copy,
- X * distribute, modify this program is hearby given as long as this header
- X * remains. If you redistribute this program after modifying it, please
- X * document your changes so that I do not take the blame (or credit) for
- X * those changes. If you fix bugs or add features, please send me a
- X * patch so that I can keep the 'official' version up-to-date.
- X *
- X * Bug reports are welcome and I'll make an attempt to fix those
- X * that are reported.
- X *
- X * USE AT YOUR OWN RISK! I assume no responsibility for any
- X * errors in this program, its database or documentation. I will make an
- X * effort to fix bugs, but if you crash and burn because, for example,
- X * fuel estimates in this program were inaccurate, it's your own fault
- X * for trusting somebody else's code! Remember, as PIC, it's _your_
- X * responsibility to do complete preflight planning. Use this program as
- X * a flight planning aid, but verify its results before using them.
- X *----------------------------------------------------------------------------
- X */
- X
- X#ifdef GFX_SUNVIEW
- X
- X/*
- X *==============================================================================
- X * Graphics routines for Sunview
- X *==============================================================================
- X */
- X
- X#include "wp_info.h"
- X#include <suntool/sunview.h>
- X#include <suntool/canvas.h>
- X#include <suntool/panel.h>
- X#include <suntool/scrollbar.h>
- X
- Xstatic char rcsid[] = "$Id: sv_draw.c,v 1.3 89/11/11 19:43:17 tynor Exp $";
- X
- Xstatic double min_lat;
- Xstatic double max_lat;
- Xstatic double min_long;
- Xstatic double max_long;
- X
- X#define PIX_OR (PIX_SRC | PIX_DST) /* Rasterop */
- X
- XPixfont *font;
- X#define DEFAULT_SCALE 100 /* pixels per degree */
- X#define SV_MARGIN 40
- X
- XPanel panel;
- XFrame frame;
- XCanvas canvas;
- Xstatic BOOLEAN brief_mode;
- Xint scale = DEFAULT_SCALE;
- XBOOLEAN first_time;
- XScrollbar vert_scroll, horiz_scroll;
- X
- X/*----------------------------------------------------------------------------*/
- Xstatic void sv_draw_pt (canvas, x, y)
- X Canvas canvas;
- X int x, y;
- X{
- X pw_writebackground (canvas_pixwin (canvas), x-1, y-1, 3, 3,
- X PIX_NOT (PIX_SRC));
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xstatic void sv_draw_str (canvas, x, y, str)
- X Canvas canvas;
- X int x, y;
- X char *str;
- X{
- X pw_text (canvas_pixwin (canvas), x+3, y+3, PIX_OR, font, str);
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xstatic void sv_project (latitude, longitude, x, y)
- Xdouble latitude, longitude;
- Xint *x, *y;
- X{
- X /*
- X * NOTE: this is "Tynor's naive projection system" - ignores the curvature
- X * of the earth:
- X */
- X
- X *x = SV_MARGIN + (int) ((max_long - longitude) * (double) scale);
- X *y = SV_MARGIN + (int) ((max_lat - latitude ) * (double) scale);
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xstatic void sv_draw_db (canvas, db)
- X Canvas canvas;
- X DATABASE_INFO *db;
- X{
- X int x, y;
- X
- X sv_project (db->latitude, db->longitude, &x, &y);
- X sv_draw_pt (canvas, x, y);
- X sv_draw_str (canvas, x, y,
- X (db->mode != WP_INCREMENTAL) ? db->desig : db->name);
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xstatic void sv_draw_leg (canvas, db1, db2)
- X Canvas canvas;
- X DATABASE_INFO *db1, *db2;
- X{
- X int x1, y1, x2, y2;
- X
- X sv_project (db1->latitude, db1->longitude, &x1, &y1);
- X sv_project (db2->latitude, db2->longitude, &x2, &y2);
- X
- X pw_vector (canvas_pixwin (canvas), x1, y1, x2, y2, PIX_OR, 1);
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xstatic void sv_scroll_to (db)
- X DATABASE_INFO *db;
- X{
- X int x, y;
- X
- X sv_project (db->latitude, db->longitude, &x, &y);
- X
- X /*
- X * try to center the waypoint on the canvas
- X */
- X scrollbar_scroll_to (horiz_scroll,
- X MIN ((int)window_get (canvas, CANVAS_WIDTH, 0),
- X MAX (0,
- X x - (int)window_get (canvas,
- X WIN_WIDTH, 0) / 2)));
- X scrollbar_scroll_to (vert_scroll,
- X MIN ((int)window_get (canvas, CANVAS_HEIGHT, 0),
- X MAX (0,
- X y - (int)window_get (canvas,
- X WIN_HEIGHT, 0) / 2)));
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xstatic void sv_redraw ()
- X{
- X int width, height, i;
- X
- X#define MIN_WIDTH 400
- X#define XTRA_WIDTH 30 /* frame needs to be this much bigger than the canvas */
- X#define XTRA_HEIGHT 100 /* frame needs to be this much bigger than the canvas */
- X
- X width = ABS ((int) ((max_long - min_long) * (double) scale)) +
- X 2 * SV_MARGIN;
- X height = ABS ((int) ((max_lat - min_lat) * (double) scale)) +
- X 2 * SV_MARGIN;
- X
- X width = MAX (width, MIN_WIDTH);
- X
- X window_set (canvas, CANVAS_HEIGHT, height, 0);
- X window_set (canvas, CANVAS_WIDTH, width, 0);
- X
- X pw_writebackground (canvas_pixwin (canvas), 0, 0, 3000, 3000, PIX_SRC);
- X
- X for (i = 0; i < num_cached; i++) {
- X sv_draw_db (canvas, cache[i]);
- X }
- X
- X for (i = 0; i < num_waypoints - 1; i++) {
- X sv_draw_leg (canvas, waypoints[i].db, waypoints[i+1].db);
- X if ((!brief_mode) && (waypoints[i].db->mode == WP_INCREMENTAL))
- X sv_draw_db (canvas, waypoints[i].db);
- X }
- X
- X if (first_time) {
- X Pixrect *screen = pr_open ("/dev/fb");
- X
- X window_set (frame, WIN_WIDTH, MIN (screen->pr_size.x,
- X XTRA_WIDTH + width), 0);
- X window_set (frame, WIN_HEIGHT, MIN (screen->pr_size.y,
- X XTRA_HEIGHT + height), 0);
- X first_time = FALSE;
- X sv_scroll_to (waypoints[0].db);
- X }
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xsv_quit_event_proc (item, event)
- X Panel_item item;
- X Event *event;
- X{
- X window_destroy (frame);
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xsv_brief_event_proc (item, event)
- X Panel_item item;
- X Event *event;
- X{
- X brief_mode = (int) panel_get (item, PANEL_VALUE, 0);
- X sv_redraw ();
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xsv_tofirst_event_proc (item, event)
- X Panel_item item;
- X Event *event;
- X{
- X sv_scroll_to (waypoints[0].db);
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xsv_tolast_event_proc (item, event)
- X Panel_item item;
- X Event *event;
- X{
- X sv_scroll_to (waypoints[num_waypoints-1].db);
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xsv_scale_event_proc (item, event)
- X Panel_item item;
- X Event *event;
- X{
- X scale = (int) panel_get (item, PANEL_VALUE, 0);
- X sv_redraw ();
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xvoid sv_draw (brief)
- X BOOLEAN brief;
- X{
- X
- X min_max_lat_long (&min_lat, &max_lat, &min_long, &max_long);
- X
- X brief_mode = brief;
- X font = pf_open ("/usr/lib/fonts/fixedwidthfonts/screen.r.7");
- X
- X frame = window_create (NULL, FRAME,
- X FRAME_LABEL, "FPLAN",
- X 0);
- X
- X panel = window_create (frame, PANEL,
- X 0);
- X
- X panel_create_item (panel, PANEL_BUTTON,
- X PANEL_NOTIFY_PROC, sv_quit_event_proc,
- X PANEL_LABEL_IMAGE, panel_button_image (panel,
- X "Quit", 0, 0),
- X PANEL_ITEM_X, ATTR_COL (0),
- X PANEL_ITEM_Y, ATTR_ROW (0),
- X 0);
- X
- X panel_create_item (panel, PANEL_BUTTON,
- X PANEL_NOTIFY_PROC, sv_tofirst_event_proc,
- X PANEL_LABEL_IMAGE, panel_button_image (panel,
- X "To First", 0, 0),
- X 0);
- X
- X panel_create_item (panel, PANEL_BUTTON,
- X PANEL_NOTIFY_PROC, sv_tolast_event_proc,
- X PANEL_LABEL_IMAGE, panel_button_image (panel,
- X "To Last", 0, 0),
- X 0);
- X
- X panel_create_item (panel, PANEL_CYCLE,
- X PANEL_LABEL_STRING, "Brief:",
- X PANEL_CHOICE_STRINGS, "NO", "YES", 0,
- X PANEL_NOTIFY_PROC, sv_brief_event_proc,
- X PANEL_VALUE, brief_mode,
- X 0);
- X
- X panel_create_item (panel, PANEL_SLIDER,
- X PANEL_LABEL_STRING, "Scale:",
- X PANEL_VALUE, scale,
- X PANEL_MIN_VALUE, 5,
- X PANEL_MAX_VALUE, 400,
- X PANEL_SLIDER_WIDTH, 200,
- X PANEL_NOTIFY_PROC, sv_scale_event_proc,
- X 0);
- X
- X window_fit_height (panel);
- X
- X horiz_scroll = scrollbar_create(0);
- X vert_scroll = scrollbar_create(0);
- X
- X canvas = window_create (frame, CANVAS,
- X CANVAS_AUTO_SHRINK, FALSE,
- X WIN_VERTICAL_SCROLLBAR, vert_scroll,
- X WIN_HORIZONTAL_SCROLLBAR, horiz_scroll,
- X CANVAS_WIDTH, 1,
- X CANVAS_HEIGHT, 1,
- X 0);
- X scrollbar_set (horiz_scroll, SCROLL_ADVANCED_MODE, 1, 0);
- X scrollbar_set (vert_scroll, SCROLL_ADVANCED_MODE, 1, 0);
- X
- X first_time = TRUE;
- X sv_redraw ();
- X window_main_loop (frame);
- X}
- X
- X#endif /* GFX_SUNVIEW */
- SHAR_EOF
- chmod 0444 sv_draw.c || echo "restore of sv_draw.c fails"
- echo "x - extracting dosbuild.bat (Text)"
- sed 's/^X//' << 'SHAR_EOF' > dosbuild.bat &&
- X: $Id: dosbuild.bat,v 1.5 89/11/19 16:14:19 tynor Exp $
- X:----------------------------------------------------------------------------
- X: FPLAN - Flight Planner
- X: Steve Tynor
- X: tynor@prism.gatech.edu
- X:
- X: This program is in the public domain. Permission to copy,
- X: distribute, modify this program is hearby given as long as this header
- X: remains. If you redistribute this program after modifying it, please
- X: document your changes so that I do not take the blame (or credit) for
- X: those changes. If you fix bugs or add features, please send me a
- X: patch so that I can keep the 'official' version up-to-date.
- X:
- X: Bug reports are welcome and I'll make an attempt to fix those
- X: that are reported.
- X:
- X: USE AT YOUR OWN RISK! I assume no responsibility for any
- X: errors in this program, its database or documentation. I will make an
- X: effort to fix bugs, but if you crash and burn because, for example,
- X: fuel estimates in this program were inaccurate, it's your own fault
- X: for trusting somebody else's code! Remember, as PIC, it's _your_
- X: responsibility to do complete preflight planning. Use this program as
- X: a flight planning aid, but verify its results before using them.
- X: ---------------------------------------------------------------------------
- X
- X: ---------------------------------------------------------------------------
- X: This is a MessyDOS batch file to compile FPLAN -
- X:
- X: Uncomment the approriate lines to compile with whatever compiler you have.
- X: ---------------------------------------------------------------------------
- X
- X: ---------------------------------------------------------------------------
- X: Zortech:
- Xztc -c -ml -w -p fp_lex.c
- Xztc -c -ml -w -p fp_yacc.c
- Xztc -c -ml -w -p add.c
- Xztc -c -ml -w -p compute.c
- Xztc -c -ml -w -p db.c
- Xztc -c -ml -w -p main.c
- Xztc -c -ml -w -p misc.c
- Xztc -c -ml -w -p output.c
- Xztc -c -ml -w -p strings.c
- Xztc -c -ml -w -p reverse.c
- Xztc -ml -L -ofplan.exe fp_lex.obj fp_yacc.obj add.obj compute.obj db.obj main.obj misc.obj output.obj strings.obj reverse.obj
- X
- X: ---------------------------------------------------------------------------
- X: Microsoft:
- X:cl /c /AL fp_lex.c
- X:cl /c /AL fp_yacc.c
- X:cl /c /AL add.c
- X:cl /c /AL compute.c
- X:cl /c /AL db.c
- X:cl /c /AL main.c
- X:cl /c /AL misc.c
- X:cl /c /AL output.c
- X:cl /c /AL strings.c
- X:cl /c /AL reverse.c
- X:cl /Fefplan.exe fp_lex fp_yacc add compute db main misc output strings reverse /link
- X
- SHAR_EOF
- chmod 0444 dosbuild.bat || echo "restore of dosbuild.bat fails"
- echo "x - extracting mystring.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > mystring.h &&
- X/*
- X * $Id: mystring.h,v 1.2 89/11/11 19:17:04 tynor Exp $
- X *----------------------------------------------------------------------------
- X * FPLAN - Flight Planner
- X * Steve Tynor
- X * tynor@prism.gatech.edu
- X *
- X * This program is in the public domain. Permission to copy,
- X * distribute, modify this program is hearby given as long as this header
- X * remains. If you redistribute this program after modifying it, please
- X * document your changes so that I do not take the blame (or credit) for
- X * those changes. If you fix bugs or add features, please send me a
- X * patch so that I can keep the 'official' version up-to-date.
- X *
- X * Bug reports are welcome and I'll make an attempt to fix those
- X * that are reported.
- X *
- X * USE AT YOUR OWN RISK! I assume no responsibility for any
- X * errors in this program, its database or documentation. I will make an
- X * effort to fix bugs, but if you crash and burn because, for example,
- X * fuel estimates in this program were inaccurate, it's your own fault
- X * for trusting somebody else's code! Remember, as PIC, it's _your_
- X * responsibility to do complete preflight planning. Use this program as
- X * a flight planning aid, but verify its results before using them.
- X *----------------------------------------------------------------------------
- X */
- X
- X/*
- X * define a couple of functions that are in SunOS string(3), but apparently
- X * aren't 'standard' - so much for the wonder of the portability of the
- X * standard C library...
- X *
- X * The only thing we count on is strlen().
- X */
- X
- Xextern char *strdup();
- Xextern char *strtok();
- Xextern char *index();
- Xextern int strlen();
- SHAR_EOF
- chmod 0444 mystring.h || echo "restore of mystring.h fails"
- echo "x - extracting wp_info.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > wp_info.h &&
- X/*
- X * $Id: wp_info.h,v 2.7 89/11/05 17:34:38 tynor Exp $
- X *----------------------------------------------------------------------------
- X * FPLAN - Flight Planner
- X * Steve Tynor
- X * tynor@prism.gatech.edu
- X *
- X * This program is in the public domain. Permission to copy,
- X * distribute, modify this program is hearby given as long as this header
- X * remains. If you redistribute this program after modifying it, please
- X * document your changes so that I do not take the blame (or credit) for
- X * those changes. If you fix bugs or add features, please send me a
- X * patch so that I can keep the 'official' version up-to-date.
- X *
- X * Bug reports are welcome and I'll make an attempt to fix those
- X * that are reported.
- X *
- X * USE AT YOUR OWN RISK! I assume no responsibility for any
- X * errors in this program, its database or documentation. I will make an
- X * effort to fix bugs, but if you crash and burn because, for example,
- X * fuel estimates in this program were inaccurate, it's your own fault
- X * for trusting somebody else's code! Remember, as PIC, it's _your_
- X * responsibility to do complete preflight planning. Use this program as
- X * a flight planning aid, but verify its results before using them.
- X *----------------------------------------------------------------------------
- X */
- X
- Xtypedef int BOOLEAN;
- X#define FALSE ((BOOLEAN)0)
- X#define TRUE ((BOOLEAN)1)
- X
- X#define MI_PER_NM 1.3242928862 /* statute miles per natutical miles */
- X
- Xtypedef enum {WP_FROM, WP_VIA, WP_TO} WAYPOINT_KIND;
- X
- Xtypedef enum {WP_VOR, WP_AIRPORT, WP_NAMED_INTERSECTION,
- X WP_INTERSECTION, WP_INCREMENTAL, WP_LAT_LONG,
- X WP_NDB, WP_DME, WP_TAC, WP_ILS, WP_WPT, WP_LOM, WP_LMM, WP_UNK
- X } WAYPOINT_MODE;
- X
- X#define MAX_NUM_WAYPOINTS 100
- X#define MAX_NUM_VOR_FIXES 6
- X
- Xtypedef enum {FROM, TO} FROM_TO;
- X
- Xtypedef struct {
- X BOOLEAN valid;
- X double value;
- X} OPTIONAL_DBL;
- X
- Xtypedef struct {
- X WAYPOINT_MODE mode;
- X double latitude; /* stored in decimal - not degrees/min/sec */
- X double longitude;
- X char *desig;
- X char *city;
- X char *name;
- X char *comment;
- X OPTIONAL_DBL freq;
- X OPTIONAL_DBL altitude;
- X double mag_variation;
- X union {
- X /* when wp_mode == WP_INCREMENTAL */
- X double dist_since_last_wp;
- X } u;
- X} DATABASE_INFO;
- X
- Xtypedef struct {
- X BOOLEAN valid;
- X DATABASE_INFO *db;
- X double heading;
- X double distance;
- X FROM_TO from_to;
- X} VOR_FIX;
- X
- X/*
- X * NOTE: ALL VALUES STORED INTERNALLY IN KNOTS AND NAUTICAL MILES
- X */
- Xtypedef struct {
- X WAYPOINT_KIND wp_kind;
- X DATABASE_INFO *db;
- X OPTIONAL_DBL tc;
- X OPTIONAL_DBL mc;
- X OPTIONAL_DBL mh;
- X OPTIONAL_DBL wind_speed;
- X OPTIONAL_DBL wind_direction;
- X OPTIONAL_DBL dist_leg;
- X OPTIONAL_DBL dist;
- X OPTIONAL_DBL dist_remain;
- X OPTIONAL_DBL eta_leg;
- X OPTIONAL_DBL eta;
- X BOOLEAN refuel;
- X OPTIONAL_DBL extra_fuel_burn;
- X OPTIONAL_DBL fuel_amt;
- X OPTIONAL_DBL fuel_rate;
- X OPTIONAL_DBL fuel_leg;
- X OPTIONAL_DBL altitude;
- X OPTIONAL_DBL tas;
- X OPTIONAL_DBL egs;
- X VOR_FIX vor_fix [MAX_NUM_VOR_FIXES];
- X} WAYPOINT_INFO;
- X
- X
- XWAYPOINT_INFO waypoints[MAX_NUM_WAYPOINTS];
- X
- Xint num_waypoints;
- X
- X#define MAX(x,y) (((x) > (y)) ? (x) : (y))
- X#define MIN(x,y) (((x) < (y)) ? (x) : (y))
- X#define ABS(x) (((x) < 0) ? -(x) : (x))
- X
- X
- X#define PI ((double) 3.14159265358979323846)
- X
- X#define DEG2RAD(x) ((x)*PI/180.0)
- X#define RAD2DEG(x) ((x)*180.0/PI)
- X
- Xint max_nav;
- X
- X#define CACHE_SIZE MAX_NUM_WAYPOINTS
- XDATABASE_INFO *cache [CACHE_SIZE];
- Xint num_cached;
- X
- SHAR_EOF
- chmod 0444 wp_info.h || echo "restore of wp_info.h fails"
- echo "x - extracting reverse.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > reverse.c &&
- X/*
- X * $Id: reverse.c,v 1.2 89/11/05 11:23:58 tynor Exp $
- X *----------------------------------------------------------------------------
- X * FPLAN - Flight Planner
- X * Steve Tynor
- X * tynor@prism.gatech.edu
- X *
- X * This program is in the public domain. Permission to copy,
- X * distribute, modify this program is hearby given as long as this header
- X * remains. If you redistribute this program after modifying it, please
- X * document your changes so that I do not take the blame (or credit) for
- X * those changes. If you fix bugs or add features, please send me a
- X * patch so that I can keep the 'official' version up-to-date.
- X *
- X * Bug reports are welcome and I'll make an attempt to fix those
- X * that are reported.
- X *
- X * USE AT YOUR OWN RISK! I assume no responsibility for any
- X * errors in this program, its database or documentation. I will make an
- X * effort to fix bugs, but if you crash and burn because, for example,
- X * fuel estimates in this program were inaccurate, it's your own fault
- X * for trusting somebody else's code! Remember, as PIC, it's _your_
- X * responsibility to do complete preflight planning. Use this program as
- X * a flight planning aid, but verify its results before using them.
- X *----------------------------------------------------------------------------
- X */
- X
- Xstatic char rcsid[] = "$Id: reverse.c,v 1.2 89/11/05 11:23:58 tynor Exp $";
- X
- X#include <stdio.h>
- X#include "wp_info.h"
- X
- Xextern void distance_and_heading ();
- X
- X/*----------------------------------------------------------------------------*/
- Xstatic void reverse_incrementals ()
- X{
- X int i;
- X int last_non_inc = num_waypoints - 1;
- X double h;
- X
- X for (i = num_waypoints - 2; i >= 0; i--)
- X if (waypoints[i].db->mode == WP_INCREMENTAL)
- X distance_and_heading (waypoints[i].db->latitude,
- X waypoints[i].db->longitude,
- X waypoints[last_non_inc].db->latitude,
- X waypoints[last_non_inc].db->longitude,
- X &waypoints[i].db->u.dist_since_last_wp, &h);
- X else
- X last_non_inc = i;
- X}
- X
- X/*----------------------------------------------------------------------------*/
- Xvoid print_reverse ()
- X{
- X int i, j;
- X
- X reverse_incrementals ();
- X
- X for (i = num_waypoints - 1; i >= 0; i--) {
- X for (j = 1; j <= max_nav; j++) {
- X if ((i == num_waypoints - 1) ||
- X (strcmp (waypoints[i].vor_fix[j].db->desig,
- X waypoints[i+1].vor_fix[j].db->desig))) {
- X printf ("nav(%d) %s;\n", j+1, waypoints[i].vor_fix[j].db->desig);
- X }
- X }
- X if (waypoints[i].wp_kind == WP_TO)
- X printf ("\nfrom %s;\n", waypoints[i].db->desig);
- X else if (waypoints[i].wp_kind == WP_FROM)
- X printf ("to %s;\n", waypoints[i].db->desig);
- X else if (waypoints[i].db->mode != WP_INCREMENTAL)
- X printf ("\tvia %s;\n", waypoints[i].db->desig);
- X else {
- X printf ("\t\tvia %1.0lf", waypoints[i].db->u.dist_since_last_wp);
- X if (waypoints[i].db->name)
- X printf (", \"%s\"", waypoints[i].db->name);
- X if (waypoints[i].db->city)
- X printf (", \"%s\"", waypoints[i].db->city);
- X if (waypoints[i].db->comment)
- X printf (", \"%s\"", waypoints[i].db->comment);
- X printf (";\n");
- X }
- X }
- X}
- X
- X
- SHAR_EOF
- chmod 0444 reverse.c || echo "restore of reverse.c fails"
- echo "x - extracting version.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > version.h &&
- X#define VERSION "1.1"
- SHAR_EOF
- chmod 0444 version.h || echo "restore of version.h fails"
- exit 0
-
-