/********************************************************************
**  YEARCAL.DEF v0.17T  Copyright (c) 1987, 1988, 1989 by Paul M. Sittler.
**  All rights reserved.  The copyright owner hereby authorizes the
**  no-charge, noncommercial making and/or distribution of copies of
**  the entirety of this work unchanged and unincorporated in any
**  other work (except "LiBRary" or "ARChive" disk files for the sole
**  purpose of no-charge noncommercial distribution).  No other
**  reproduction or use is authorized without the express prior
**  written consent of the copyright owner.
**
**************************************************************/

#define DEF_SIG "Copyright 1988, 1989, Paul M. Sittler.  All rights reserved."
#define ERROR	(-1)
#define TRUE 	1
#define FALSE	0
#define BUF	272
#define LIN	80


/* Function Prototypes */
void agg_printer(int year, char out, char base,
		 int lang, char pause);
void cal_printer(int year, char out,
		 int bm,   char fy,
		 int bd,   char base,
		 int lang, char pause);
char *center(char *str, int width);
char *char_str(int length, char c);
void ferr( char *fmt);
int  get_int(int defalt, int digits, int lowest, int highest);
void get_opts(char *name);
int  get_yn(char defalt);
void hold(void);
void jul_printer(int year, char out, char base,
		 int lang, char pause);
int  leap(int years);
void prep_cal(int year);
void put_opts(char *name);
void sched_printer(int year, char out,
		   int bm, int bd, int bh,
		   int nh, int pl, int pw,
		   char sched_type, char title[][LIN],
		   char base,  int lang,
		   char pause, int indent, int lds);
void setup_files(char out);
void signon(void);
char *trim(char *str);
int  weekday(int YYYY, int MM, int DD);


struct month
{
    int  length;
    int  first_day;
};



struct options
{
    char signature[ sizeof(DEF_SIG) ];
    int chksum;
    int bh,	/* Beginning hour for schedules */
      copies,   /* Number of copies to print */
      indent,	/* Left Margin Indent in spaces */
      lang,	/* Language desired for calendar */
      lds,	/* Line Drawing Character set to use */
      more_yrs, /* Number of successive periods to print */
      nh,	/* Number of Hours to schedule */
      pl,	/* Page Length in lines */
      pw;	/* Page Width in characters or columns */
    char aggie;	/* Aggie calendar flag */
    char base;	/* Number base for Programmers Calendar, 0, H(ex), O(ctal) */
    char fy;	/* Fiscal year flag */
    char julian;/* Julian calendar flag */
    char pause;	/* Page pause flag */
    char mil;	/* Military time flag */
    char sched_type;/* Schedule type M(onthly), W(eekly), D(aily) */
    char title[8][LIN];
    /* This structure also contains fields for every option that
     * the user can change at runtime.  These are the default values
     * that are used if no other values have been specified by the
     * user during a run.
     */
} ;



struct LineDraw
{
    int nw,				/* North-West corner */
	ne,				/* North-East corner */
	se,				/* South-East corner */
	sw,				/* South-West corner */
	side,				/* Sides */
	line,				/* Upper and lower frame */
	ni,				/* North Intersection */
	si,				/* South Intersection */
	wi,				/* West Intersection */
	ei,				/* East Intersection */
	ns,				/* North-South (vertical) line */
	ew,				/* East-West (horizontal) line */
	isi,				/* Internal South Intersection */
	cross;				/* Internal Cross Intersection */
} ;
