1: /* Definitions for data structures callers pass the regex library. 2: Copyright (C) 1985 Richard M. Stallman 3: 4: This program is distributed in the hope that it will be useful, 5: but without any warranty. No author or distributor 6: accepts responsibility to anyone for the consequences of using it 7: or for whether it serves any particular purpose or works at all, 8: unless he says so in writing. 9: 10: Permission is granted to anyone to distribute verbatim copies 11: of this program's source code as received, in any medium, provided that 12: the copyright notice, the nonwarraty notice above 13: and this permission notice are preserved, 14: and that the distributor grants the recipient all rights 15: for further redistribution as permitted by this notice, 16: and informs him of these rights. 17: 18: Permission is granted to distribute modified versions of this 19: program's source code, or of portions of it, under the above 20: conditions, plus the conditions that all changed files carry 21: prominent notices stating who last changed them and that the 22: derived material, including anything packaged together with it and 23: conceptually functioning as a modification of it rather than an 24: application of it, is in its entirety subject to a permission 25: notice identical to this one. 26: 27: Permission is granted to distribute this program (verbatim or 28: as modified) in compiled or executable form, provided verbatim 29: redistribution is permitted as stated above for source code, and 30: A. it is accompanied by the corresponding machine-readable 31: source code, under the above conditions, or 32: B. it is accompanied by a written offer, with no time limit, 33: to distribute the corresponding machine-readable source code, 34: under the above conditions, to any one, in return for reimbursement 35: of the cost of distribution. Verbatim redistribution of the 36: written offer must be permitted. Or, 37: C. it is distributed by someone who received only the 38: compiled or executable form, and is accompanied by a copy of the 39: written offer of source code which he received along with it. 40: 41: Permission is granted to distribute this program (verbatim or as modified) 42: in executable form as part of a larger system provided that the source 43: code for this program, including any modifications used, 44: is also distributed or offered as stated in the preceding paragraph. 45: 46: In other words, you are welcome to use, share and improve this program. 47: You are forbidden to forbid anyone else to use, share and improve 48: what you give them. Help stamp out software-hoarding! */ 49: 50: 51: #ifndef RE_NREGS 52: #define RE_NREGS 10 53: #endif 54: 55: /* This data structure is used to represent a compiled pattern. */ 56: 57: struct re_pattern_buffer 58: { 59: char *buffer; /* Space holding the compiled pattern commands. */ 60: int allocated; /* Size of space that buffer points to */ 61: int used; /* Length of portion of buffer actually occupied */ 62: char *fastmap; /* Pointer to fastmap, if any, or zero if none. */ 63: /* re_search uses the fastmap, if there is one, 64: to skip quickly over totally implausible characters */ 65: char *translate; /* Translate table to apply to all characters before comparing. 66: Or zero for no translation. 67: The translation is applied to a pattern when it is compiled 68: and to data when it is matched. */ 69: char fastmap_accurate; 70: /* Set to zero when a new pattern is stored, 71: set to one when the fastmap is updated from it. */ 72: char can_be_null; /* Set to one by compiling fastmap 73: if this pattern might match the null string. 74: It does not necessarily match the null string 75: in that case, but if this is zero, it cannot. */ 76: }; 77: 78: /* Structure to store "register" contents data in. 79: 80: Pass the address of such a structure as an argument to re_match, etc., 81: if you want this information back. 82: 83: start[i] and end[i] record the string matched by \( ... \) grouping i, 84: for i from 1 to RE_NREGS - 1. 85: start[0] and end[0] record the entire string matched. */ 86: 87: struct re_registers 88: { 89: int start[RE_NREGS]; 90: int end[RE_NREGS]; 91: }; 92: 93: char *re_compile_pattern ();