1 /* 2 * Common text filter definitions for CUPS. 3 * 4 * Copyright 2007-2010 by Apple Inc. 5 * Copyright 1997-2005 by Easy Software Products. 6 * 7 * These coded instructions, statements, and computer programs are the 8 * property of Apple Inc. and are protected by Federal copyright 9 * law. Distribution and use rights are outlined in the file "COPYING" 10 * which should have been included with this file. 11 */ 12 13 /* 14 * Include necessary headers... 15 */ 16 17 #include "common.h" 18 19 20 /* 21 * C++ magic... 22 */ 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif /* __cplusplus */ 27 28 29 /* 30 * Constants... 31 */ 32 33 #define ATTR_NORMAL 0x00 34 #define ATTR_BOLD 0x01 35 #define ATTR_ITALIC 0x02 36 #define ATTR_BOLDITALIC 0x03 37 #define ATTR_FONT 0x03 38 39 #define ATTR_UNDERLINE 0x04 40 #define ATTR_RAISED 0x08 41 #define ATTR_LOWERED 0x10 42 #define ATTR_RED 0x20 43 #define ATTR_GREEN 0x40 44 #define ATTR_BLUE 0x80 45 46 #define PRETTY_OFF 0 47 #define PRETTY_PLAIN 1 48 #define PRETTY_CODE 2 49 #define PRETTY_SHELL 3 50 #define PRETTY_PERL 4 51 #define PRETTY_HTML 5 52 53 54 /* 55 * Structures... 56 */ 57 58 typedef struct /**** Character/attribute structure... ****/ 59 { 60 unsigned short ch, /* Character */ 61 attr; /* Any attributes */ 62 } lchar_t; 63 64 65 /* 66 * Globals... 67 */ 68 69 extern int WrapLines, /* Wrap text in lines */ 70 SizeLines, /* Number of lines on a page */ 71 SizeColumns, /* Number of columns on a line */ 72 PageColumns, /* Number of columns on a page */ 73 ColumnGutter, /* Number of characters between text columns */ 74 ColumnWidth, /* Width of each column */ 75 PrettyPrint, /* Do pretty code formatting? */ 76 Copies; /* Number of copies to produce */ 77 extern lchar_t **Page; /* Page characters */ 78 extern int NumPages; /* Number of pages in document */ 79 extern float CharsPerInch, /* Number of character columns per inch */ 80 LinesPerInch; /* Number of lines per inch */ 81 extern int UTF8, /* Use UTF-8 encoding? */ 82 NumKeywords; /* Number of known keywords */ 83 extern char **Keywords; /* List of known keywords... */ 84 85 86 /* 87 * Required functions... 88 */ 89 90 extern int TextMain(const char *name, int argc, char *argv[]); 91 extern void WriteEpilogue(void); 92 extern void WritePage(void); 93 extern void WriteProlog(const char *title, const char *user, 94 const char *classification, const char *label, 95 ppd_file_t *ppd); 96 97 98 /* 99 * C++ magic... 100 */ 101 102 #ifdef __cplusplus 103 } 104 #endif /* __cplusplus */ 105 106