boxes/src/boxes.h.in

197 lines
5.9 KiB
C
Raw Normal View History

1999-03-19 18:51:19 +01:00
/*
* File: boxes.h
* Date created: March 18, 1999 (Thursday, 15:09h)
* Author: Thomas Jensen
* tsjensen@stud.informatik.uni-erlangen.de
* Version: $Id: boxes.h,v 1.10 1999/06/20 14:19:31 tsjensen Exp tsjensen $
1999-03-19 18:51:19 +01:00
* Language: ANSI C
* Purpose: Project-wide globals and data structures
* Remarks: ---
*
* Revision History:
*
* $Log: boxes.h,v $
* Revision 1.10 1999/06/20 14:19:31 tsjensen
* Added padding member to design struct
*
1999-06-20 16:19:31 +02:00
* Revision 1.9 1999/06/17 19:08:50 tsjensen
* Removed #pragma ident "string"
* Changed VERSION to 1.0 beta
* Added line_t and empty_line() prototype
*
* Revision 1.8 1999/06/14 12:11:54 tsjensen
* Added struct members for regexp reversion code
* Renamed current_reprule to current_rule, now used for both directions
*
1999-06-03 20:54:33 +02:00
* Revision 1.6 1999/04/09 13:32:55 tsjensen
* Removed code related to OFFSET blocks (obsolete)
*
* Revision 1.5 1999/04/04 16:10:51 tsjensen
* Added some flags to design structure
* Move default settings here from boxes.c
*
* Revision 1.4 1999/03/31 17:34:43 tsjensen
* ... still programming ...
* Added minwidth and minheight to design structure
*
* Revision 1.3 1999/03/30 09:36:58 tsjensen
* ... still programming ...
* It drew a correct box for the first time!
*
1999-03-19 18:51:19 +01:00
* Revision 1.1 1999/03/18 15:09:34 tsjensen
* Initial revision
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
1999-03-18 16:08:57 +01:00
#ifndef BOXES_H
#define BOXES_H
/* #define DEBUG */
/* #define REGEXP_DEBUG */
#include "regexp.h"
1999-03-18 16:08:57 +01:00
#define PROJECT "boxes" /* name of program */
#define VERSION "1.0 beta" /* current release of project */
1999-03-18 16:08:57 +01:00
/*
* default settings of all kinds (THIS PARAGRAPH MAY BE EDITED)
*/
#define DEF_TABSTOP 8 /* default tab stop distance (-t) */
#define DEF_INDENTMODE 'b' /* indent box, not text by default */
#define DEF_DESIGN "C" /* default design name */
#define __TJ(s) fprintf (stderr, s);
/*
* some systems (especially sunos4) do not define EXIT_* constants
*/
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
/* max. allowed tab stop distance
*/
#define MAX_TABSTOP 16
/* max. supported line length
* This is how many characters of a line will be read. Anything beyond
* will be discarded. The line feed character at the end does not count.
* (This should have been done via sysconf(), but I didn't do it in order
* to ease porting to non-unix platforms.)
*/
#if defined(LINE_MAX) && (LINE_MAX < 1024)
#undef LINE_MAX
#endif
#ifndef LINE_MAX
#define LINE_MAX 2048
#endif
1999-03-19 18:51:19 +01:00
extern char *shape_name[];
1999-03-18 16:08:57 +01:00
#define ANZ_SHAPES 16
typedef enum {
NW, NNW, N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW
} shape_t;
1999-03-19 18:51:19 +01:00
#define SHAPES_PER_SIDE 5
#define ANZ_SIDES 4
#define ANZ_CORNERS 4
extern shape_t north_side[SHAPES_PER_SIDE]; /* groups of shapes, clockwise */
extern shape_t east_side[SHAPES_PER_SIDE];
extern shape_t south_side[SHAPES_PER_SIDE];
extern shape_t west_side[SHAPES_PER_SIDE];
extern shape_t corners[ANZ_CORNERS];
extern shape_t *sides[ANZ_SIDES];
1999-03-19 18:51:19 +01:00
#define BTOP 0 /* for use width sides */
#define BRIG 1
#define BBOT 2
#define BLEF 3
1999-03-18 16:08:57 +01:00
typedef struct {
char **chars;
size_t height;
size_t width;
int elastic; /* elastic is used only in orginial definition */
1999-03-18 16:08:57 +01:00
} sentry_t;
#define SENTRY_INITIALIZER (sentry_t) {NULL, 0, 0, 0}
typedef struct {
char *search;
char *repstr;
regexp *prog; /* compiled search pattern */
int line; /* line of definition in config file */
char mode; /* 'g' or 'o' */
} reprule_t;
1999-03-18 16:08:57 +01:00
typedef struct {
char *name;
char *author;
char *created; /* date created, free format */
char *revision; /* revision number of design */
char *revdate; /* date of current revision */
char *sample;
char indentmode; /* 'b', 't', or 'n' */
sentry_t shape[ANZ_SHAPES];
size_t minwidth;
size_t minheight;
1999-06-20 16:19:31 +02:00
int padding[ANZ_SIDES];
reprule_t *current_rule;
reprule_t *reprules; /* applied when drawing a box */
size_t anz_reprules;
reprule_t *revrules; /* applied upon removal of a box */
size_t anz_revrules;
1999-03-18 16:08:57 +01:00
} design_t;
typedef struct {
size_t len;
char *text;
} line_t;
1999-03-18 16:08:57 +01:00
extern design_t *designs;
extern int design_idx;
extern int yylineno;
extern char *yyfilename;
typedef struct { /* Command line options: */
int l; /* list available designs */
int r; /* remove box from input */
int tabstop; /* tab stop distance */
int padding[ANZ_SIDES]; /* in spaces or lines resp. */
design_t *design; /* currently used box design */
int design_choice_by_user; /* true if design was chosen by user */
long reqwidth; /* requested box width (-s) */
long reqheight; /* requested box height (-s) */
char valign; /* text position inside box */
char halign; /* ( h[lcr]v[tcb] ) */
FILE *infile; /* where we get our input */
FILE *outfile; /* where we put our output */
} opt_t;
extern opt_t opt;
1999-03-18 16:08:57 +01:00
int isempty (const sentry_t *);
size_t widest (const sentry_t *, const int, ...);
size_t highest (const sentry_t *, const int, ...);
1999-03-18 16:08:57 +01:00
#endif /* BOXES_H */
/*EOF*/ /* vim: set cindent sw=4: */