annotate 3rdparty/packages/ed/tools.h @ 3226:9749d0dfc4a2

Changed a puls PC to rts to save cycles
author David Ladd <drencor-xeen@users.sourceforge.net>
date Sat, 20 Jan 2018 19:32:22 -0600
parents 4098fe141a3d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
994
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
1 /* tools.h */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
2 /*
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
3 * #defines for non-printing ASCII characters
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
4 */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
5
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
6 #define NUL 0x00 /* ^@ */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
7 #define EOS 0x00 /* end of string */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
8 #define SOH 0x01 /* ^A */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
9 #define STX 0x02 /* ^B */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
10 #define ETX 0x03 /* ^C */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
11 #define EOT 0x04 /* ^D */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
12 #define ENQ 0x05 /* ^E */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
13 #define ACK 0x06 /* ^F */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
14 #define BEL 0x07 /* ^G */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
15 #define BS 0x08 /* ^H */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
16 #define HT 0x09 /* ^I */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
17 #define LF 0x0a /* ^J */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
18 #define NL '\n'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
19 #define VT 0x0b /* ^K */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
20 #define FF 0x0c /* ^L */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
21 #define CR 0x0d /* ^M */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
22 #define SO 0x0e /* ^N */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
23 #define SI 0x0f /* ^O */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
24 #define DLE 0x10 /* ^P */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
25 #define DC1 0x11 /* ^Q */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
26 #define DC2 0x12 /* ^R */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
27 #define DC3 0x13 /* ^S */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
28 #define DC4 0x14 /* ^T */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
29 #define NAK 0x15 /* ^U */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
30 #define SYN 0x16 /* ^V */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
31 #define ETB 0x17 /* ^W */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
32 #define CAN 0x18 /* ^X */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
33 #define EM 0x19 /* ^Y */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
34 #define SUB 0x1a /* ^Z */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
35 #define ESC 0x1b /* ^[ */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
36 #define FS 0x1c /* ^\ */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
37 #define GS 0x1d /* ^] */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
38 #define RS 0x1e /* ^^ */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
39 #define US 0x1f /* ^_ */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
40 #define SP 0x20 /* space */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
41 #define DEL 0x7f /* DEL */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
42
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
43 #define TRUE 1
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
44 #define FALSE 0
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
45 #define ERR -2
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
46
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
47 /* Definitions of meta-characters used in pattern matching
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
48 * routines. LITCHAR & NCCL are only used as token identifiers;
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
49 * all the others are also both token identifier and actual symbol
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
50 * used in the regular expression.
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
51 */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
52
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
53 #define BOL '^'
1867
4098fe141a3d makefile added
boisy
parents: 994
diff changeset
54 #undef EOL
994
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
55 #define EOL '$'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
56 #define ANY '.'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
57 #define LITCHAR 'L'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
58 #define ESCAPE '\\'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
59 #define CCL '[' /* Character class: [...] */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
60 #define CCLEND ']'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
61 #define NEGATE '~'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
62 #define NCCL '!' /* Negative character class [^...] */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
63 #define CLOSURE '*'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
64 #define OR_SYM '|'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
65 #define DITTO '&'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
66 #define OPEN '('
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
67 #define CLOSE ')'
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
68
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
69 /* Largest permitted size for an expanded character class. (i.e. the class
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
70 * [a-z] will expand into 26 symbols; [a-z0-9] will expand into 36.)
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
71 */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
72 #define CLS_SIZE 128
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
73
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
74 /*
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
75 * Tokens are used to hold pattern templates. (see makepat())
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
76 */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
77 typedef char BITMAP;
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
78
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
79 typedef struct token {
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
80 char tok;
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
81 char lchar;
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
82 BITMAP *bitmap;
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
83 struct token *next;
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
84 } TOKEN;
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
85
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
86 #define TOKSIZE sizeof (TOKEN)
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
87
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
88 /*
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
89 * An absolute maximun for strings.
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
90 */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
91
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
92 #define MAXSTR 132 /* Maximum numbers of characters in a line */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
93
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
94 /* Macros */
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
95 #define max(a,b) ((a>b)?a:b)
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
96 #define min(a,b) ((a<b)?a:b)
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
97 #define toupper(c) (c>='a'&&c<='z'?c-32:c)
bef1844de0dc The ED editor ported from Minix
roug
parents:
diff changeset
98