/*  filo -- manipulate a `rolodex'-like database
 *  Copyright (C) 1994 David Deaven, Jennifer Corkill
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: filo.h,v 1.3 1995/10/26 19:53:43 deaven Exp $
 */

enum filo_mode {
  DISPLAY_MODE,		/* Display entries in ASCII to stdout */
  ENVELOPE_MODE,	/* Print envelope(s) in PostScript */
  ENVELOPE_KIT_MODE,	/* Print envelope kit(s) in PostScript */
  DIRECTORY_MODE,	/* Print a directory in PostScript */
  DEBUG_MODE
};

enum directory_style {
  ASCII_STYLE,
  TEX_STYLE,
  POSTSCRIPT_STYLE
};

#define COM10_SX        241     /* mm */
#define COM10_SY        105     /* mm */ 

struct filo_settings {
  enum filo_mode mode;		/* general operating mode */
  enum directory_style dstyle;	/* how to render a directory */
  int ignore_case;		/* case-sensitive */
  int outline;			/* draw an envelope outline */
  int do_barzip;		/* use the bar code zipcode */
  int sx, sy;			/* envelope size in mm */
  int xoff, yoff;		/* printer feeder offset adjustment */
  int to_x, to_y;		/* to address position */
  int from_x, from_y;		/* from address position */
  int stamp_x, stamp_y;		/* stamp position */
  int bar_x, bar_y;		/* bar code position */
  char *filopath;		/* path to filo files */
  char *header;
  char *sender;
  char *stamp;
  char *ofn;			/* output file */
  char *filodex;		/* database file */
};

void set_defaults(struct filo_settings *set);
char **set_from_args(struct filo_settings *set, int *argc, char **argv);
void print_usage(int argc, char **argv);

char *strconcat(char *s1, char *s2);
char *tryenv(char *envname, char *defalt);
void finsert(char *fn, char *path, FILE *f);
char *read_filo(FILE *fin);
void addps(FILE *f, char *s);
void barzip(FILE *f, char *s, int x, int y);
void fps_string(FILE *f, char *s);

char *scan_address(char *s);
char *scan_keyword(char *s, char *keyword);

void RegExpCompile(char *pattern, int ignore_case);
int RegExpCompare(char *s);

void AddDirectory(char *record);
void PrintDirectory(FILE *f, enum directory_style style);

void PrintHeader(FILE *f);
