home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1995-04-08 | 48.3 KB | [TEXT/TOPC] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Sat Apr 8 00:42:04 1995, modified Sat Apr 8 00:42:04 1995, creator 'TOPC', type ASCII, 48221 bytes "REGEX.C" , at 0xbcdd 960 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [TOPC] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 07 52 45 47 45 58 2e | 43 00 00 00 00 00 00 00 |..REGEX.|C.......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 54 4f 50 | 43 01 00 00 00 00 00 00 |.TEXTTOP|C.......|
|00000050| 00 00 00 00 00 bc 5d 00 | 00 03 c0 ab ab c4 9c ab |......].|........|
|00000060| ab c4 9c 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 4c 32 00 00 |........|....L2..|
|00000080| 2f 2a 20 45 78 74 65 6e | 64 65 64 20 72 65 67 75 |/* Exten|ded regu|
|00000090| 6c 61 72 20 65 78 70 72 | 65 73 73 69 6f 6e 20 6d |lar expr|ession m|
|000000a0| 61 74 63 68 69 6e 67 20 | 61 6e 64 20 73 65 61 72 |atching |and sear|
|000000b0| 63 68 2e 20 2a 2f 0d 2f | 2a 20 43 6f 70 79 72 69 |ch. */./|* Copyri|
|000000c0| 67 68 74 20 a9 20 31 39 | 38 35 2c 20 31 39 39 31 |ght . 19|85, 1991|
|000000d0| 20 74 68 65 20 46 72 65 | 65 20 53 6f 66 74 77 61 | the Fre|e Softwa|
|000000e0| 72 65 20 46 6f 75 6e 64 | 61 74 69 6f 6e 2c 20 49 |re Found|ation, I|
|000000f0| 6e 63 2e 0d 20 2a 20 09 | 09 54 68 69 73 20 66 69 |nc.. * .|.This fi|
|00000100| 6c 65 20 69 73 20 70 61 | 72 74 20 6f 66 20 47 41 |le is pa|rt of GA|
|00000110| 57 4b 2c 20 74 68 65 20 | 47 4e 55 20 69 6d 70 6c |WK, the |GNU impl|
|00000120| 65 6d 65 6e 74 61 74 69 | 6f 6e 20 6f 66 20 74 68 |ementati|on of th|
|00000130| 65 0d 20 2a 20 41 57 4b | 20 50 72 6f 67 61 6d 6d |e. * AWK| Progamm|
|00000140| 69 6e 67 20 4c 61 6e 67 | 75 61 67 65 2c 20 6d 6f |ing Lang|uage, mo|
|00000150| 64 69 66 69 65 64 20 66 | 6f 72 20 74 68 65 20 4d |dified f|or the M|
|00000160| 61 63 69 6e 74 6f 73 68 | 20 28 61 6c 73 6f 20 63 |acintosh| (also c|
|00000170| 61 6c 6c 65 64 20 68 41 | 57 4b 29 2e 0d 20 2a 20 |alled hA|WK).. * |
|00000180| 09 09 47 41 57 4b 20 69 | 73 20 66 72 65 65 20 73 |..GAWK i|s free s|
|00000190| 6f 66 74 77 61 72 65 3b | 20 79 6f 75 20 63 61 6e |oftware;| you can|
|000001a0| 20 72 65 64 69 73 74 72 | 69 62 75 74 65 20 6f 72 | redistr|ibute or|
|000001b0| 20 6d 6f 64 69 66 79 0d | 20 2a 20 69 74 20 75 6e | modify.| * it un|
|000001c0| 64 65 72 20 74 68 65 20 | 74 65 72 6d 73 20 6f 66 |der the |terms of|
|000001d0| 20 74 68 65 20 47 4e 55 | 20 47 65 6e 65 72 61 6c | the GNU| General|
|000001e0| 20 50 75 62 6c 69 63 20 | 4c 69 63 65 6e 73 65 20 | Public |License |
|000001f0| 61 73 20 70 75 62 6c 69 | 73 68 65 64 20 62 79 0d |as publi|shed by.|
|00000200| 20 2a 20 74 68 65 20 46 | 72 65 65 20 53 6f 66 74 | * the F|ree Soft|
|00000210| 77 61 72 65 20 46 6f 75 | 6e 64 61 74 69 6f 6e 3b |ware Fou|ndation;|
|00000220| 20 65 69 74 68 65 72 20 | 76 65 72 73 69 6f 6e 20 | either |version |
|00000230| 31 2c 20 6f 72 20 61 6e | 79 20 6c 61 74 65 72 20 |1, or an|y later |
|00000240| 76 65 72 73 69 6f 6e 2e | 0d 20 2a 20 09 09 47 41 |version.|. * ..GA|
|00000250| 57 4b 20 69 73 20 64 69 | 73 74 72 69 62 75 74 65 |WK is di|stribute|
|00000260| 64 20 69 6e 20 74 68 65 | 20 68 6f 70 65 20 74 68 |d in the| hope th|
|00000270| 61 74 20 69 74 20 77 69 | 6c 6c 20 62 65 20 75 73 |at it wi|ll be us|
|00000280| 65 66 75 6c 2c 0d 20 2a | 20 62 75 74 20 57 49 54 |eful,. *| but WIT|
|00000290| 48 4f 55 54 20 41 4e 59 | 20 57 41 52 52 41 4e 54 |HOUT ANY| WARRANT|
|000002a0| 59 3b 20 77 69 74 68 6f | 75 74 20 65 76 65 6e 20 |Y; witho|ut even |
|000002b0| 74 68 65 20 69 6d 70 6c | 69 65 64 20 77 61 72 72 |the impl|ied warr|
|000002c0| 61 6e 74 79 20 6f 66 0d | 20 2a 20 4d 45 52 43 48 |anty of.| * MERCH|
|000002d0| 41 4e 54 41 42 49 4c 49 | 54 59 20 6f 72 20 46 49 |ANTABILI|TY or FI|
|000002e0| 54 4e 45 53 53 20 46 4f | 52 20 41 20 50 41 52 54 |TNESS FO|R A PART|
|000002f0| 49 43 55 4c 41 52 20 50 | 55 52 50 4f 53 45 2e 20 |ICULAR P|URPOSE. |
|00000300| 53 65 65 20 74 68 65 0d | 20 2a 20 47 4e 55 20 47 |See the.| * GNU G|
|00000310| 65 6e 65 72 61 6c 20 50 | 75 62 6c 69 63 20 4c 69 |eneral P|ublic Li|
|00000320| 63 65 6e 73 65 20 66 6f | 72 20 6d 6f 72 65 20 64 |cense fo|r more d|
|00000330| 65 74 61 69 6c 73 2e 0d | 20 2a 20 09 09 59 6f 75 |etails..| * ..You|
|00000340| 20 73 68 6f 75 6c 64 20 | 68 61 76 65 20 72 65 63 | should |have rec|
|00000350| 65 69 76 65 64 20 61 20 | 63 6f 70 79 20 6f 66 20 |eived a |copy of |
|00000360| 74 68 65 20 47 4e 55 20 | 47 65 6e 65 72 61 6c 20 |the GNU |General |
|00000370| 50 75 62 6c 69 63 20 4c | 69 63 65 6e 73 65 0d 20 |Public L|icense. |
|00000380| 2a 20 61 6c 6f 6e 67 20 | 77 69 74 68 20 47 41 57 |* along |with GAW|
|00000390| 4b 3b 20 73 65 65 20 74 | 68 65 20 66 69 6c 65 20 |K; see t|he file |
|000003a0| 22 43 4f 50 59 49 4e 47 | 20 68 41 57 4b 22 2e 20 |"COPYING| hAWK". |
|000003b0| 49 66 20 6e 6f 74 2c 20 | 77 72 69 74 65 20 74 6f |If not, |write to|
|000003c0| 0d 20 2a 20 74 68 65 20 | 46 72 65 65 20 53 6f 66 |. * the |Free Sof|
|000003d0| 74 77 61 72 65 20 46 6f | 75 6e 64 61 74 69 6f 6e |tware Fo|undation|
|000003e0| 2c 20 36 37 35 20 4d 61 | 73 73 20 41 76 65 2c 20 |, 675 Ma|ss Ave, |
|000003f0| 43 61 6d 62 72 69 64 67 | 65 2c 20 4d 41 20 30 32 |Cambridg|e, MA 02|
|00000400| 31 33 39 2c 20 55 53 41 | 2e 0d 20 2a 20 4d 6f 64 |139, USA|.. * Mod|
|00000410| 69 66 69 65 64 20 66 6f | 72 20 54 48 49 4e 4b 20 |ified fo|r THINK |
|00000420| 43 20 34 20 6f 6e 20 74 | 68 65 20 4d 61 63 69 6e |C 4 on t|he Macin|
|00000430| 74 6f 73 68 20 62 79 20 | 4b 65 6e 20 45 61 72 6c |tosh by |Ken Earl|
|00000440| 65 20 28 44 79 6e 61 62 | 79 74 65 29 20 41 75 67 |e (Dynab|yte) Aug|
|00000450| 20 31 39 39 31 2e 0d 20 | 2a 2f 0d 0d 2f 2a 23 69 | 1991.. |*/../*#i|
|00000460| 6e 63 6c 75 64 65 20 3c | 6d 61 6c 6c 6f 63 2e 68 |nclude <|malloc.h|
|00000470| 3e 2a 2f 0d 23 69 6e 63 | 6c 75 64 65 20 22 41 57 |>*/.#inc|lude "AW|
|00000480| 4b 2e 48 22 0d 0d 2f 2a | 20 43 61 72 72 69 61 67 |K.H"../*| Carriag|
|00000490| 65 20 52 65 74 75 72 6e | 20 6f 66 20 74 68 65 20 |e Return| of the |
|000004a0| 6d 6f 6d 65 6e 74 2e 2e | 2e 20 2a 2f 0d 23 64 65 |moment..|. */.#de|
|000004b0| 66 69 6e 65 20 43 52 20 | 27 5c 6e 27 0d 0d 73 74 |fine CR |'\n'..st|
|000004c0| 61 74 69 63 20 20 76 6f | 69 64 20 69 6e 69 74 5f |atic vo|id init_|
|000004d0| 73 79 6e 74 61 78 5f 6f | 6e 63 65 28 76 6f 69 64 |syntax_o|nce(void|
|000004e0| 20 29 3b 0d 65 78 74 65 | 72 6e 20 20 73 68 6f 72 | );.exte|rn shor|
|000004f0| 74 20 72 65 5f 73 65 74 | 5f 73 79 6e 74 61 78 28 |t re_set|_syntax(|
|00000500| 73 68 6f 72 74 20 73 79 | 6e 74 61 78 29 3b 0d 65 |short sy|ntax);.e|
|00000510| 78 74 65 72 6e 20 20 63 | 68 61 72 20 2a 72 65 5f |xtern c|har *re_|
|00000520| 63 6f 6d 70 69 6c 65 5f | 70 61 74 74 65 72 6e 28 |compile_|pattern(|
|00000530| 63 68 61 72 20 2a 70 61 | 74 74 65 72 6e 2c 73 68 |char *pa|ttern,sh|
|00000540| 6f 72 74 20 73 69 7a 65 | 2c 73 74 72 75 63 74 20 |ort size|,struct |
|00000550| 72 65 5f 70 61 74 74 65 | 72 6e 5f 62 75 66 66 65 |re_patte|rn_buffe|
|00000560| 72 20 2a 62 75 66 70 29 | 3b 0d 73 74 61 74 69 63 |r *bufp)|;.static|
|00000570| 20 20 73 68 6f 72 74 20 | 73 74 6f 72 65 5f 6a 75 | short |store_ju|
|00000580| 6d 70 28 63 68 61 72 20 | 2a 66 72 6f 6d 2c 63 68 |mp(char |*from,ch|
|00000590| 61 72 20 6f 70 63 6f 64 | 65 2c 63 68 61 72 20 2a |ar opcod|e,char *|
|000005a0| 74 6f 29 3b 0d 73 74 61 | 74 69 63 20 20 73 68 6f |to);.sta|tic sho|
|000005b0| 72 74 20 69 6e 73 65 72 | 74 5f 6a 75 6d 70 28 63 |rt inser|t_jump(c|
|000005c0| 68 61 72 20 6f 70 2c 63 | 68 61 72 20 2a 66 72 6f |har op,c|har *fro|
|000005d0| 6d 2c 63 68 61 72 20 2a | 74 6f 2c 63 68 61 72 20 |m,char *|to,char |
|000005e0| 2a 63 75 72 72 65 6e 74 | 5f 65 6e 64 29 3b 0d 65 |*current|_end);.e|
|000005f0| 78 74 65 72 6e 20 20 76 | 6f 69 64 20 72 65 5f 63 |xtern v|oid re_c|
|00000600| 6f 6d 70 69 6c 65 5f 66 | 61 73 74 6d 61 70 28 73 |ompile_f|astmap(s|
|00000610| 74 72 75 63 74 20 72 65 | 5f 70 61 74 74 65 72 6e |truct re|_pattern|
|00000620| 5f 62 75 66 66 65 72 20 | 2a 62 75 66 70 29 3b 0d |_buffer |*bufp);.|
|00000630| 65 78 74 65 72 6e 20 20 | 73 68 6f 72 74 20 72 65 |extern |short re|
|00000640| 5f 73 65 61 72 63 68 28 | 73 74 72 75 63 74 20 72 |_search(|struct r|
|00000650| 65 5f 70 61 74 74 65 72 | 6e 5f 62 75 66 66 65 72 |e_patter|n_buffer|
|00000660| 20 2a 70 62 75 66 70 2c | 63 68 61 72 20 2a 73 74 | *pbufp,|char *st|
|00000670| 72 69 6e 67 2c 73 68 6f | 72 74 20 73 69 7a 65 2c |ring,sho|rt size,|
|00000680| 73 68 6f 72 74 20 73 74 | 61 72 74 70 6f 73 2c 73 |short st|artpos,s|
|00000690| 68 6f 72 74 20 72 61 6e | 67 65 2c 73 74 72 75 63 |hort ran|ge,struc|
|000006a0| 74 20 72 65 5f 72 65 67 | 69 73 74 65 72 73 20 2a |t re_reg|isters *|
|000006b0| 72 65 67 73 29 3b 0d 65 | 78 74 65 72 6e 20 20 73 |regs);.e|xtern s|
|000006c0| 68 6f 72 74 20 72 65 5f | 73 65 61 72 63 68 5f 32 |hort re_|search_2|
|000006d0| 28 73 74 72 75 63 74 20 | 72 65 5f 70 61 74 74 65 |(struct |re_patte|
|000006e0| 72 6e 5f 62 75 66 66 65 | 72 20 2a 70 62 75 66 70 |rn_buffe|r *pbufp|
|000006f0| 2c 63 68 61 72 20 2a 73 | 74 72 69 6e 67 31 2c 73 |,char *s|tring1,s|
|00000700| 68 6f 72 74 20 73 69 7a | 65 31 2c 63 68 61 72 20 |hort siz|e1,char |
|00000710| 2a 73 74 72 69 6e 67 32 | 2c 73 68 6f 72 74 20 73 |*string2|,short s|
|00000720| 69 7a 65 32 2c 73 68 6f | 72 74 20 73 74 61 72 74 |ize2,sho|rt start|
|00000730| 70 6f 73 2c 73 68 6f 72 | 74 20 72 61 6e 67 65 2c |pos,shor|t range,|
|00000740| 73 74 72 75 63 74 20 72 | 65 5f 72 65 67 69 73 74 |struct r|e_regist|
|00000750| 65 72 73 20 2a 72 65 67 | 73 2c 73 68 6f 72 74 20 |ers *reg|s,short |
|00000760| 6d 73 74 6f 70 29 3b 0d | 65 78 74 65 72 6e 20 20 |mstop);.|extern |
|00000770| 73 68 6f 72 74 20 72 65 | 5f 6d 61 74 63 68 28 73 |short re|_match(s|
|00000780| 74 72 75 63 74 20 72 65 | 5f 70 61 74 74 65 72 6e |truct re|_pattern|
|00000790| 5f 62 75 66 66 65 72 20 | 2a 70 62 75 66 70 2c 63 |_buffer |*pbufp,c|
|000007a0| 68 61 72 20 2a 73 74 72 | 69 6e 67 2c 73 68 6f 72 |har *str|ing,shor|
|000007b0| 74 20 73 69 7a 65 2c 73 | 68 6f 72 74 20 70 6f 73 |t size,s|hort pos|
|000007c0| 2c 73 74 72 75 63 74 20 | 72 65 5f 72 65 67 69 73 |,struct |re_regis|
|000007d0| 74 65 72 73 20 2a 72 65 | 67 73 29 3b 0d 65 78 74 |ters *re|gs);.ext|
|000007e0| 65 72 6e 20 20 73 68 6f | 72 74 20 72 65 5f 6d 61 |ern sho|rt re_ma|
|000007f0| 74 63 68 5f 32 28 73 74 | 72 75 63 74 20 72 65 5f |tch_2(st|ruct re_|
|00000800| 70 61 74 74 65 72 6e 5f | 62 75 66 66 65 72 20 2a |pattern_|buffer *|
|00000810| 70 62 75 66 70 2c 75 6e | 73 69 67 6e 65 64 20 63 |pbufp,un|signed c|
|00000820| 68 61 72 20 2a 73 74 72 | 69 6e 67 31 2c 73 68 6f |har *str|ing1,sho|
|00000830| 72 74 20 73 69 7a 65 31 | 2c 75 6e 73 69 67 6e 65 |rt size1|,unsigne|
|00000840| 64 20 63 68 61 72 20 2a | 73 74 72 69 6e 67 32 2c |d char *|string2,|
|00000850| 73 68 6f 72 74 20 73 69 | 7a 65 32 2c 73 68 6f 72 |short si|ze2,shor|
|00000860| 74 20 70 6f 73 2c 73 74 | 72 75 63 74 20 72 65 5f |t pos,st|ruct re_|
|00000870| 72 65 67 69 73 74 65 72 | 73 20 2a 72 65 67 73 2c |register|s *regs,|
|00000880| 73 68 6f 72 74 20 6d 73 | 74 6f 70 29 3b 0d 73 74 |short ms|top);.st|
|00000890| 61 74 69 63 20 20 73 68 | 6f 72 74 20 62 63 6d 70 |atic sh|ort bcmp|
|000008a0| 5f 74 72 61 6e 73 6c 61 | 74 65 28 75 6e 73 69 67 |_transla|te(unsig|
|000008b0| 6e 65 64 20 63 68 61 72 | 20 2a 73 31 2c 75 6e 73 |ned char| *s1,uns|
|000008c0| 69 67 6e 65 64 20 63 68 | 61 72 20 2a 73 32 2c 73 |igned ch|ar *s2,s|
|000008d0| 68 6f 72 74 20 6c 65 6e | 2c 75 6e 73 69 67 6e 65 |hort len|,unsigne|
|000008e0| 64 20 63 68 61 72 20 2a | 74 72 61 6e 73 6c 61 74 |d char *|translat|
|000008f0| 65 29 3b 0d 65 78 74 65 | 72 6e 20 20 63 68 61 72 |e);.exte|rn char|
|00000900| 20 2a 72 65 5f 63 6f 6d | 70 28 63 68 61 72 20 2a | *re_com|p(char *|
|00000910| 73 29 3b 0d 65 78 74 65 | 72 6e 20 20 73 68 6f 72 |s);.exte|rn shor|
|00000920| 74 20 72 65 5f 65 78 65 | 63 28 63 68 61 72 20 2a |t re_exe|c(char *|
|00000930| 73 29 3b 0d 0d 0d 2f 2a | 20 54 6f 20 74 65 73 74 |s);.../*| To test|
|00000940| 2c 20 63 6f 6d 70 69 6c | 65 20 77 69 74 68 20 2d |, compil|e with -|
|00000950| 44 74 65 73 74 2e 0d 20 | 54 68 69 73 20 44 74 65 |Dtest.. |This Dte|
|00000960| 73 74 61 62 6c 65 20 66 | 65 61 74 75 72 65 20 74 |stable f|eature t|
|00000970| 75 72 6e 73 20 74 68 69 | 73 20 69 6e 74 6f 20 61 |urns thi|s into a|
|00000980| 20 73 65 6c 66 2d 63 6f | 6e 74 61 69 6e 65 64 20 | self-co|ntained |
|00000990| 70 72 6f 67 72 61 6d 0d | 20 77 68 69 63 68 20 72 |program.| which r|
|000009a0| 65 61 64 73 20 61 20 70 | 61 74 74 65 72 6e 2c 20 |eads a p|attern, |
|000009b0| 64 65 73 63 72 69 62 65 | 73 20 68 6f 77 20 69 74 |describe|s how it|
|000009c0| 20 63 6f 6d 70 69 6c 65 | 73 2c 0d 20 74 68 65 6e | compile|s,. then|
|000009d0| 20 72 65 61 64 73 20 61 | 20 73 74 72 69 6e 67 20 | reads a| string |
|000009e0| 61 6e 64 20 73 65 61 72 | 63 68 65 73 20 66 6f 72 |and sear|ches for|
|000009f0| 20 69 74 2e 20 20 2a 2f | 0d 0d 23 64 65 66 69 6e | it. */|..#defin|
|00000a00| 65 20 42 43 4f 50 59 5f | 4d 49 53 53 49 4e 47 0d |e BCOPY_|MISSING.|
|00000a10| 0d 0d 23 69 66 64 65 66 | 20 65 6d 61 63 73 0d 0d |..#ifdef| emacs..|
|00000a20| 2f 2a 20 54 68 65 20 60 | 65 6d 61 63 73 27 20 73 |/* The `|emacs' s|
|00000a30| 77 69 74 63 68 20 74 75 | 72 6e 73 20 6f 6e 20 63 |witch tu|rns on c|
|00000a40| 65 72 74 61 69 6e 20 73 | 70 65 63 69 61 6c 20 6d |ertain s|pecial m|
|00000a50| 61 74 63 68 69 6e 67 20 | 63 6f 6d 6d 61 6e 64 73 |atching |commands|
|00000a60| 0d 20 74 68 61 74 20 6d | 61 6b 65 20 73 65 6e 73 |. that m|ake sens|
|00000a70| 65 20 6f 6e 6c 79 20 69 | 6e 20 65 6d 61 63 73 2e |e only i|n emacs.|
|00000a80| 20 2a 2f 0d 0d 23 69 6e | 63 6c 75 64 65 20 22 63 | */..#in|clude "c|
|00000a90| 6f 6e 66 69 67 2e 68 22 | 0d 23 69 6e 63 6c 75 64 |onfig.h"|.#includ|
|00000aa0| 65 20 22 6c 69 73 70 2e | 68 22 0d 23 69 6e 63 6c |e "lisp.|h".#incl|
|00000ab0| 75 64 65 20 22 62 75 66 | 66 65 72 2e 68 22 0d 23 |ude "buf|fer.h".#|
|00000ac0| 69 6e 63 6c 75 64 65 20 | 22 73 79 6e 74 61 78 2e |include |"syntax.|
|00000ad0| 68 22 0d 0d 23 65 6c 73 | 65 20 20 2f 2a 20 6e 6f |h"..#els|e /* no|
|00000ae0| 74 20 65 6d 61 63 73 20 | 2a 2f 0d 0d 23 69 66 64 |t emacs |*/..#ifd|
|00000af0| 65 66 20 42 43 4f 50 59 | 5f 4d 49 53 53 49 4e 47 |ef BCOPY|_MISSING|
|00000b00| 0d 23 64 65 66 69 6e 65 | 20 62 63 6f 70 79 28 73 |.#define| bcopy(s|
|00000b10| 2c 64 2c 6e 29 09 6d 65 | 6d 63 70 79 28 28 64 29 |,d,n).me|mcpy((d)|
|00000b20| 2c 28 73 29 2c 28 6e 29 | 29 0d 23 64 65 66 69 6e |,(s),(n)|).#defin|
|00000b30| 65 20 62 63 6d 70 28 73 | 31 2c 73 32 2c 6e 29 09 |e bcmp(s|1,s2,n).|
|00000b40| 6d 65 6d 63 6d 70 28 28 | 73 31 29 2c 28 73 32 29 |memcmp((|s1),(s2)|
|00000b50| 2c 28 6e 29 29 0d 23 64 | 65 66 69 6e 65 20 62 7a |,(n)).#d|efine bz|
|00000b60| 65 72 6f 28 73 2c 6e 29 | 09 6d 65 6d 73 65 74 28 |ero(s,n)|.memset(|
|00000b70| 28 73 29 2c 30 2c 28 6e | 29 29 0d 23 65 6c 73 65 |(s),0,(n|)).#else|
|00000b80| 0d 76 6f 69 64 20 62 63 | 6f 70 79 28 29 3b 0d 73 |.void bc|opy();.s|
|00000b90| 68 6f 72 74 20 62 63 6d | 70 28 29 3b 0d 76 6f 69 |hort bcm|p();.voi|
|00000ba0| 64 20 62 7a 65 72 6f 28 | 29 3b 0d 23 65 6e 64 69 |d bzero(|);.#endi|
|00000bb0| 66 0d 0d 2f 2a 20 4d 61 | 6b 65 20 61 6c 6c 6f 63 |f../* Ma|ke alloc|
|00000bc0| 61 20 77 6f 72 6b 20 74 | 68 65 20 62 65 73 74 20 |a work t|he best |
|00000bd0| 70 6f 73 73 69 62 6c 65 | 20 77 61 79 2e 20 20 2a |possible| way. *|
|00000be0| 2f 0d 23 69 66 64 65 66 | 20 5f 5f 47 4e 55 43 5f |/.#ifdef| __GNUC_|
|00000bf0| 5f 0d 23 64 65 66 69 6e | 65 20 61 6c 6c 6f 63 61 |_.#defin|e alloca|
|00000c00| 20 5f 5f 62 75 69 6c 74 | 69 6e 5f 61 6c 6c 6f 63 | __built|in_alloc|
|00000c10| 61 0d 23 65 6c 73 65 0d | 23 69 66 64 65 66 20 73 |a.#else.|#ifdef s|
|00000c20| 70 61 72 63 0d 23 69 6e | 63 6c 75 64 65 20 3c 61 |parc.#in|clude <a|
|00000c30| 6c 6c 6f 63 61 2e 68 3e | 0d 23 65 6e 64 69 66 0d |lloca.h>|.#endif.|
|00000c40| 23 65 6e 64 69 66 0d 0d | 2f 2a 0d 20 2a 20 44 65 |#endif..|/*. * De|
|00000c50| 66 69 6e 65 20 74 68 65 | 20 73 79 6e 74 61 78 20 |fine the| syntax |
|00000c60| 73 74 75 66 66 2c 20 73 | 6f 20 77 65 20 63 61 6e |stuff, s|o we can|
|00000c70| 20 64 6f 20 74 68 65 20 | 5c 3c 2e 2e 2e 5c 3e 20 | do the |\<...\> |
|00000c80| 74 68 69 6e 67 73 2e 0d | 20 2a 2f 0d 0d 23 69 66 |things..| */..#if|
|00000c90| 6e 64 65 66 20 53 77 6f | 72 64 20 2f 2a 20 6d 75 |ndef Swo|rd /* mu|
|00000ca0| 73 74 20 62 65 20 6e 6f | 6e 2d 7a 65 72 6f 20 69 |st be no|n-zero i|
|00000cb0| 6e 20 73 6f 6d 65 20 6f | 66 20 74 68 65 20 74 65 |n some o|f the te|
|00000cc0| 73 74 73 20 62 65 6c 6f | 77 2e 2e 2e 20 2a 2f 0d |sts belo|w... */.|
|00000cd0| 23 64 65 66 69 6e 65 20 | 53 77 6f 72 64 20 31 0d |#define |Sword 1.|
|00000ce0| 23 65 6e 64 69 66 0d 0d | 23 64 65 66 69 6e 65 20 |#endif..|#define |
|00000cf0| 53 59 4e 54 41 58 28 63 | 29 20 72 65 5f 73 79 6e |SYNTAX(c|) re_syn|
|00000d00| 74 61 78 5f 74 61 62 6c | 65 5b 63 5d 0d 0d 23 69 |tax_tabl|e[c]..#i|
|00000d10| 66 64 65 66 20 53 59 4e | 54 41 58 5f 54 41 42 4c |fdef SYN|TAX_TABL|
|00000d20| 45 0d 0d 63 68 61 72 20 | 2a 72 65 5f 73 79 6e 74 |E..char |*re_synt|
|00000d30| 61 78 5f 74 61 62 6c 65 | 3b 0d 0d 23 65 6c 73 65 |ax_table|;..#else|
|00000d40| 0d 0d 73 74 61 74 69 63 | 20 63 68 61 72 20 72 65 |..static| char re|
|00000d50| 5f 73 79 6e 74 61 78 5f | 74 61 62 6c 65 5b 32 35 |_syntax_|table[25|
|00000d60| 36 5d 3b 0d 0d 73 74 61 | 74 69 63 20 76 6f 69 64 |6];..sta|tic void|
|00000d70| 0d 69 6e 69 74 5f 73 79 | 6e 74 61 78 5f 6f 6e 63 |.init_sy|ntax_onc|
|00000d80| 65 20 28 29 0d 7b 0d 20 | 20 20 72 65 67 69 73 74 |e ().{. | regist|
|00000d90| 65 72 20 73 68 6f 72 74 | 20 63 3b 0d 20 20 20 73 |er short| c;. s|
|00000da0| 74 61 74 69 63 20 73 68 | 6f 72 74 20 64 6f 6e 65 |tatic sh|ort done|
|00000db0| 20 3d 20 30 3b 0d 0d 20 | 20 20 69 66 20 28 64 6f | = 0;.. | if (do|
|00000dc0| 6e 65 29 0d 20 20 20 20 | 20 72 65 74 75 72 6e 3b |ne). | return;|
|00000dd0| 0d 0d 20 20 20 62 7a 65 | 72 6f 20 28 72 65 5f 73 |.. bze|ro (re_s|
|00000de0| 79 6e 74 61 78 5f 74 61 | 62 6c 65 2c 20 73 69 7a |yntax_ta|ble, siz|
|00000df0| 65 6f 66 20 72 65 5f 73 | 79 6e 74 61 78 5f 74 61 |eof re_s|yntax_ta|
|00000e00| 62 6c 65 29 3b 0d 0d 20 | 20 20 66 6f 72 20 28 63 |ble);.. | for (c|
|00000e10| 20 3d 20 27 61 27 3b 20 | 63 20 3c 3d 20 27 7a 27 | = 'a'; |c <= 'z'|
|00000e20| 3b 20 63 2b 2b 29 0d 20 | 20 20 20 20 72 65 5f 73 |; c++). | re_s|
|00000e30| 79 6e 74 61 78 5f 74 61 | 62 6c 65 5b 63 5d 20 3d |yntax_ta|ble[c] =|
|00000e40| 20 53 77 6f 72 64 3b 0d | 0d 20 20 20 66 6f 72 20 | Sword;.|. for |
|00000e50| 28 63 20 3d 20 27 41 27 | 3b 20 63 20 3c 3d 20 27 |(c = 'A'|; c <= '|
|00000e60| 5a 27 3b 20 63 2b 2b 29 | 0d 20 20 20 20 20 72 65 |Z'; c++)|. re|
|00000e70| 5f 73 79 6e 74 61 78 5f | 74 61 62 6c 65 5b 63 5d |_syntax_|table[c]|
|00000e80| 20 3d 20 53 77 6f 72 64 | 3b 0d 0d 20 20 20 66 6f | = Sword|;.. fo|
|00000e90| 72 20 28 63 20 3d 20 27 | 30 27 3b 20 63 20 3c 3d |r (c = '|0'; c <=|
|00000ea0| 20 27 39 27 3b 20 63 2b | 2b 29 0d 20 20 20 20 20 | '9'; c+|+). |
|00000eb0| 72 65 5f 73 79 6e 74 61 | 78 5f 74 61 62 6c 65 5b |re_synta|x_table[|
|00000ec0| 63 5d 20 3d 20 53 77 6f | 72 64 3b 0d 0d 20 20 20 |c] = Swo|rd;.. |
|00000ed0| 64 6f 6e 65 20 3d 20 31 | 3b 0d 7d 0d 0d 23 65 6e |done = 1|;.}..#en|
|00000ee0| 64 69 66 20 2f 2a 20 53 | 59 4e 54 41 58 5f 54 41 |dif /* S|YNTAX_TA|
|00000ef0| 42 4c 45 20 2a 2f 0d 23 | 65 6e 64 69 66 20 2f 2a |BLE */.#|endif /*|
|00000f00| 20 6e 6f 74 20 65 6d 61 | 63 73 20 2a 2f 0d 0d 2f | not ema|cs */../|
|00000f10| 2a 20 69 6e 63 6c 75 64 | 65 64 20 62 79 20 41 57 |* includ|ed by AW|
|00000f20| 4b 2e 48 20 23 69 6e 63 | 6c 75 64 65 20 22 52 45 |K.H #inc|lude "RE|
|00000f30| 47 45 58 2e 48 22 20 2a | 2f 0d 0d 2f 2a 20 4e 75 |GEX.H" *|/../* Nu|
|00000f40| 6d 62 65 72 20 6f 66 20 | 66 61 69 6c 75 72 65 20 |mber of |failure |
|00000f50| 70 6f 69 6e 74 73 20 74 | 6f 20 61 6c 6c 6f 63 61 |points t|o alloca|
|00000f60| 74 65 20 73 70 61 63 65 | 20 66 6f 72 20 69 6e 69 |te space| for ini|
|00000f70| 74 69 61 6c 6c 79 2c 0d | 20 77 68 65 6e 20 6d 61 |tially,.| when ma|
|00000f80| 74 63 68 69 6e 67 2e 20 | 20 49 66 20 74 68 69 73 |tching. | If this|
|00000f90| 20 6e 75 6d 62 65 72 20 | 69 73 20 65 78 63 65 65 | number |is excee|
|00000fa0| 64 65 64 2c 20 6d 6f 72 | 65 20 73 70 61 63 65 20 |ded, mor|e space |
|00000fb0| 69 73 20 61 6c 6c 6f 63 | 61 74 65 64 2c 0d 20 73 |is alloc|ated,. s|
|00000fc0| 6f 20 69 74 20 69 73 20 | 6e 6f 74 20 61 20 68 61 |o it is |not a ha|
|00000fd0| 72 64 20 6c 69 6d 69 74 | 2e 20 20 2a 2f 0d 0d 23 |rd limit|. */..#|
|00000fe0| 69 66 6e 64 65 66 20 4e | 46 41 49 4c 55 52 45 53 |ifndef N|FAILURES|
|00000ff0| 0d 23 64 65 66 69 6e 65 | 20 4e 46 41 49 4c 55 52 |.#define| NFAILUR|
|00001000| 45 53 20 38 30 0d 23 65 | 6e 64 69 66 20 2f 2a 20 |ES 80.#e|ndif /* |
|00001010| 4e 46 41 49 4c 55 52 45 | 53 20 2a 2f 0d 0d 2f 2a |NFAILURE|S */../*|
|00001020| 20 77 69 64 74 68 20 6f | 66 20 61 20 62 79 74 65 | width o|f a byte|
|00001030| 20 69 6e 20 62 69 74 73 | 20 2a 2f 0d 0d 23 64 65 | in bits| */..#de|
|00001040| 66 69 6e 65 20 42 59 54 | 45 57 49 44 54 48 20 38 |fine BYT|EWIDTH 8|
|00001050| 0d 0d 23 69 66 6e 64 65 | 66 20 53 49 47 4e 5f 45 |..#ifnde|f SIGN_E|
|00001060| 58 54 45 4e 44 5f 43 48 | 41 52 0d 23 64 65 66 69 |XTEND_CH|AR.#defi|
|00001070| 6e 65 20 53 49 47 4e 5f | 45 58 54 45 4e 44 5f 43 |ne SIGN_|EXTEND_C|
|00001080| 48 41 52 28 78 29 20 28 | 78 29 0d 23 65 6e 64 69 |HAR(x) (|x).#endi|
|00001090| 66 0d 0d 73 74 61 74 69 | 63 20 73 68 6f 72 74 20 |f..stati|c short |
|000010a0| 6f 62 73 63 75 72 65 5f | 73 79 6e 74 61 78 20 3d |obscure_|syntax =|
|000010b0| 20 30 3b 0d 0d 2f 2a 20 | 53 70 65 63 69 66 79 20 | 0;../* |Specify |
|000010c0| 74 68 65 20 70 72 65 63 | 69 73 65 20 73 79 6e 74 |the prec|ise synt|
|000010d0| 61 78 20 6f 66 20 72 65 | 67 65 78 70 20 66 6f 72 |ax of re|gexp for|
|000010e0| 20 63 6f 6d 70 69 6c 61 | 74 69 6f 6e 2e 0d 20 20 | compila|tion.. |
|000010f0| 20 54 68 69 73 20 70 72 | 6f 76 69 64 65 73 20 66 | This pr|ovides f|
|00001100| 6f 72 20 63 6f 6d 70 61 | 74 69 62 69 6c 69 74 79 |or compa|tibility|
|00001110| 20 66 6f 72 20 76 61 72 | 69 6f 75 73 20 75 74 69 | for var|ious uti|
|00001120| 6c 69 74 69 65 73 0d 20 | 20 20 77 68 69 63 68 20 |lities. | which |
|00001130| 68 69 73 74 6f 72 69 63 | 61 6c 6c 79 20 68 61 76 |historic|ally hav|
|00001140| 65 20 64 69 66 66 65 72 | 65 6e 74 2c 20 69 6e 63 |e differ|ent, inc|
|00001150| 6f 6d 70 61 74 69 62 6c | 65 20 73 79 6e 74 61 78 |ompatibl|e syntax|
|00001160| 65 73 2e 0d 0d 20 20 20 | 54 68 65 20 61 72 67 75 |es... |The argu|
|00001170| 6d 65 6e 74 20 53 59 4e | 54 41 58 20 69 73 20 61 |ment SYN|TAX is a|
|00001180| 20 62 69 74 2d 6d 61 73 | 6b 20 63 6f 6e 74 61 69 | bit-mas|k contai|
|00001190| 6e 69 6e 67 20 74 68 65 | 20 74 77 6f 20 62 69 74 |ning the| two bit|
|000011a0| 73 0d 20 20 20 52 45 5f | 4e 4f 5f 42 4b 5f 50 41 |s. RE_|NO_BK_PA|
|000011b0| 52 45 4e 53 20 61 6e 64 | 20 52 45 5f 4e 4f 5f 42 |RENS and| RE_NO_B|
|000011c0| 4b 5f 56 42 41 52 2e 20 | 20 2a 2f 0d 0d 73 68 6f |K_VBAR. | */..sho|
|000011d0| 72 74 0d 72 65 5f 73 65 | 74 5f 73 79 6e 74 61 78 |rt.re_se|t_syntax|
|000011e0| 20 28 73 68 6f 72 74 20 | 73 79 6e 74 61 78 29 0d | (short |syntax).|
|000011f0| 7b 0d 20 20 73 68 6f 72 | 74 20 72 65 74 3b 0d 0d |{. shor|t ret;..|
|00001200| 20 20 72 65 74 20 3d 20 | 6f 62 73 63 75 72 65 5f | ret = |obscure_|
|00001210| 73 79 6e 74 61 78 3b 0d | 20 20 6f 62 73 63 75 72 |syntax;.| obscur|
|00001220| 65 5f 73 79 6e 74 61 78 | 20 3d 20 73 79 6e 74 61 |e_syntax| = synta|
|00001230| 78 3b 0d 20 20 72 65 74 | 75 72 6e 20 72 65 74 3b |x;. ret|urn ret;|
|00001240| 0d 7d 0d 0d 2f 2a 20 72 | 65 5f 63 6f 6d 70 69 6c |.}../* r|e_compil|
|00001250| 65 5f 70 61 74 74 65 72 | 6e 20 74 61 6b 65 73 20 |e_patter|n takes |
|00001260| 61 20 72 65 67 75 6c 61 | 72 2d 65 78 70 72 65 73 |a regula|r-expres|
|00001270| 73 69 6f 6e 20 73 74 72 | 69 6e 67 0d 20 20 20 61 |sion str|ing. a|
|00001280| 6e 64 20 63 6f 6e 76 65 | 72 74 73 20 69 74 20 69 |nd conve|rts it i|
|00001290| 6e 74 6f 20 61 20 62 75 | 66 66 65 72 20 66 75 6c |nto a bu|ffer ful|
|000012a0| 6c 20 6f 66 20 62 79 74 | 65 20 63 6f 6d 6d 61 6e |l of byt|e comman|
|000012b0| 64 73 20 66 6f 72 20 6d | 61 74 63 68 69 6e 67 2e |ds for m|atching.|
|000012c0| 0d 0d 20 20 50 41 54 54 | 45 52 4e 20 20 20 69 73 |.. PATT|ERN is|
|000012d0| 20 74 68 65 20 61 64 64 | 72 65 73 73 20 6f 66 20 | the add|ress of |
|000012e0| 74 68 65 20 70 61 74 74 | 65 72 6e 20 73 74 72 69 |the patt|ern stri|
|000012f0| 6e 67 0d 20 20 53 49 5a | 45 20 20 20 20 20 20 69 |ng. SIZ|E i|
|00001300| 73 20 74 68 65 20 6c 65 | 6e 67 74 68 20 6f 66 20 |s the le|ngth of |
|00001310| 69 74 2e 0d 20 20 42 55 | 46 50 09 20 20 20 20 69 |it.. BU|FP. i|
|00001320| 73 20 61 20 20 73 74 72 | 75 63 74 20 72 65 5f 70 |s a str|uct re_p|
|00001330| 61 74 74 65 72 6e 5f 62 | 75 66 66 65 72 20 2a 20 |attern_b|uffer * |
|00001340| 20 77 68 69 63 68 20 70 | 6f 69 6e 74 73 20 74 6f | which p|oints to|
|00001350| 20 74 68 65 20 69 6e 66 | 6f 0d 09 20 20 20 20 6f | the inf|o.. o|
|00001360| 6e 20 77 68 65 72 65 20 | 74 6f 20 73 74 6f 72 65 |n where |to store|
|00001370| 20 74 68 65 20 62 79 74 | 65 20 63 6f 6d 6d 61 6e | the byt|e comman|
|00001380| 64 73 2e 0d 09 20 20 20 | 20 54 68 69 73 20 73 74 |ds... | This st|
|00001390| 72 75 63 74 75 72 65 20 | 63 6f 6e 74 61 69 6e 73 |ructure |contains|
|000013a0| 20 61 20 20 63 68 61 72 | 20 2a 20 20 77 68 69 63 | a char| * whic|
|000013b0| 68 20 70 6f 69 6e 74 73 | 20 74 6f 20 74 68 65 0d |h points| to the.|
|000013c0| 09 20 20 20 20 61 63 74 | 75 61 6c 20 73 70 61 63 |. act|ual spac|
|000013d0| 65 2c 20 77 68 69 63 68 | 20 73 68 6f 75 6c 64 20 |e, which| should |
|000013e0| 68 61 76 65 20 62 65 65 | 6e 20 6f 62 74 61 69 6e |have bee|n obtain|
|000013f0| 65 64 20 77 69 74 68 20 | 6d 61 6c 6c 6f 63 2e 0d |ed with |malloc..|
|00001400| 09 20 20 20 20 72 65 5f | 63 6f 6d 70 69 6c 65 5f |. re_|compile_|
|00001410| 70 61 74 74 65 72 6e 20 | 6d 61 79 20 75 73 65 20 |pattern |may use |
|00001420| 20 72 65 61 6c 6c 6f 63 | 20 20 74 6f 20 67 72 6f | realloc| to gro|
|00001430| 77 20 74 68 65 20 62 75 | 66 66 65 72 20 73 70 61 |w the bu|ffer spa|
|00001440| 63 65 2e 0d 0d 20 20 54 | 68 65 20 6e 75 6d 62 65 |ce... T|he numbe|
|00001450| 72 20 6f 66 20 62 79 74 | 65 73 20 6f 66 20 63 6f |r of byt|es of co|
|00001460| 6d 6d 61 6e 64 73 20 63 | 61 6e 20 62 65 20 66 6f |mmands c|an be fo|
|00001470| 75 6e 64 20 6f 75 74 20 | 62 79 20 6c 6f 6f 6b 69 |und out |by looki|
|00001480| 6e 67 20 69 6e 0d 20 20 | 74 68 65 20 20 73 74 72 |ng in. |the str|
|00001490| 75 63 74 20 72 65 5f 70 | 61 74 74 65 72 6e 5f 62 |uct re_p|attern_b|
|000014a0| 75 66 66 65 72 20 20 74 | 68 61 74 20 62 75 66 70 |uffer t|hat bufp|
|000014b0| 20 70 6f 69 6e 74 65 64 | 20 74 6f 2c 0d 20 20 61 | pointed| to,. a|
|000014c0| 66 74 65 72 20 72 65 5f | 63 6f 6d 70 69 6c 65 5f |fter re_|compile_|
|000014d0| 70 61 74 74 65 72 6e 20 | 72 65 74 75 72 6e 73 2e |pattern |returns.|
|000014e0| 0d 2a 2f 0d 0d 23 64 65 | 66 69 6e 65 20 50 41 54 |.*/..#de|fine PAT|
|000014f0| 50 55 53 48 28 63 68 29 | 20 28 2a 62 2b 2b 20 3d |PUSH(ch)| (*b++ =|
|00001500| 20 28 63 68 61 72 29 20 | 28 63 68 29 29 0d 0d 23 | (char) |(ch))..#|
|00001510| 64 65 66 69 6e 65 20 50 | 41 54 46 45 54 43 48 28 |define P|ATFETCH(|
|00001520| 63 29 20 5c 0d 20 7b 69 | 66 20 28 70 20 3d 3d 20 |c) \. {i|f (p == |
|00001530| 70 65 6e 64 29 20 67 6f | 74 6f 20 65 6e 64 5f 6f |pend) go|to end_o|
|00001540| 66 5f 70 61 74 74 65 72 | 6e 3b 20 5c 0d 20 20 63 |f_patter|n; \. c|
|00001550| 20 3d 20 2a 20 28 75 6e | 73 69 67 6e 65 64 20 63 | = * (un|signed c|
|00001560| 68 61 72 20 2a 29 20 70 | 2b 2b 3b 20 5c 0d 20 20 |har *) p|++; \. |
|00001570| 69 66 20 28 74 72 61 6e | 73 6c 61 74 65 29 20 63 |if (tran|slate) c|
|00001580| 20 3d 20 74 72 61 6e 73 | 6c 61 74 65 5b 63 5d 3b | = trans|late[c];|
|00001590| 20 7d 0d 0d 23 64 65 66 | 69 6e 65 20 50 41 54 46 | }..#def|ine PATF|
|000015a0| 45 54 43 48 5f 52 41 57 | 28 63 29 20 5c 0d 20 7b |ETCH_RAW|(c) \. {|
|000015b0| 69 66 20 28 70 20 3d 3d | 20 70 65 6e 64 29 20 67 |if (p ==| pend) g|
|000015c0| 6f 74 6f 20 65 6e 64 5f | 6f 66 5f 70 61 74 74 65 |oto end_|of_patte|
|000015d0| 72 6e 3b 20 5c 0d 20 20 | 63 20 3d 20 2a 20 28 75 |rn; \. |c = * (u|
|000015e0| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 20 2a 29 20 |nsigned |char *) |
|000015f0| 70 2b 2b 3b 20 7d 0d 0d | 23 64 65 66 69 6e 65 20 |p++; }..|#define |
|00001600| 50 41 54 55 4e 46 45 54 | 43 48 20 70 2d 2d 0d 0d |PATUNFET|CH p--..|
|00001610| 23 69 66 64 65 66 20 4d | 53 44 4f 53 0d 23 64 65 |#ifdef M|SDOS.#de|
|00001620| 66 69 6e 65 20 4d 61 78 | 41 6c 6c 6f 63 61 74 69 |fine Max|Allocati|
|00001630| 6f 6e 20 28 31 3c 3c 31 | 34 29 0d 23 65 6c 73 65 |on (1<<1|4).#else|
|00001640| 0d 2f 2a 20 54 45 53 54 | 20 77 61 73 20 31 3c 3c |./* TEST| was 1<<|
|00001650| 31 36 20 2a 2f 0d 23 64 | 65 66 69 6e 65 20 4d 61 |16 */.#d|efine Ma|
|00001660| 78 41 6c 6c 6f 63 61 74 | 69 6f 6e 20 28 31 3c 3c |xAllocat|ion (1<<|
|00001670| 31 34 29 20 2f 2a 20 31 | 36 2c 33 38 34 20 2a 2f |14) /* 1|6,384 */|
|00001680| 0d 23 65 6e 64 69 66 0d | 0d 2f 2a 20 4d 61 63 20 |.#endif.|./* Mac |
|00001690| 6e 6f 74 65 3a 20 74 68 | 65 20 69 62 6d 2f 75 6e |note: th|e ibm/un|
|000016a0| 69 78 20 76 65 72 73 69 | 6f 6e 20 6f 66 20 45 58 |ix versi|on of EX|
|000016b0| 54 45 4e 44 5f 42 55 46 | 46 45 52 20 68 61 64 0d |TEND_BUF|FER had.|
|000016c0| 09 63 20 3d 20 28 75 6e | 73 69 67 6e 65 64 29 28 |.c = (un|signed)(|
|000016d0| 62 75 66 70 2d 3e 62 75 | 66 66 65 72 20 2d 20 6f |bufp->bu|ffer - o|
|000016e0| 6c 64 5f 62 75 66 66 65 | 72 29 3b 20 77 69 74 68 |ld_buffe|r); with|
|000016f0| 20 63 20 62 65 69 6e 67 | 20 75 6e 73 69 67 6e 65 | c being| unsigne|
|00001700| 64 20 73 68 6f 72 74 2e | 0d 54 68 69 73 20 61 73 |d short.|.This as|
|00001710| 73 75 6d 65 73 20 74 68 | 61 74 20 31 29 20 72 65 |sumes th|at 1) re|
|00001720| 61 6c 6c 6f 63 61 74 69 | 6f 6e 20 77 69 6c 6c 20 |allocati|on will |
|00001730| 61 6c 77 61 79 73 20 62 | 65 20 75 70 77 61 72 64 |always b|e upward|
|00001740| 73 20 69 6e 20 6d 65 6d | 6f 72 79 2c 20 61 6e 64 |s in mem|ory, and|
|00001750| 0d 32 29 20 74 68 65 20 | 61 6d 6f 75 6e 74 20 6f |.2) the |amount o|
|00001760| 66 20 73 68 69 66 74 20 | 77 69 6c 6c 20 66 69 74 |f shift |will fit|
|00001770| 20 69 6e 20 61 6e 20 75 | 6e 73 69 67 6e 65 64 20 | in an u|nsigned |
|00001780| 73 68 6f 72 74 2e 20 42 | 6f 74 68 20 6f 66 20 74 |short. B|oth of t|
|00001790| 68 65 73 65 20 61 73 73 | 75 6d 70 74 69 6f 6e 73 |hese ass|umptions|
|000017a0| 0d 61 72 65 20 66 61 6c | 73 65 20 6f 6e 20 61 20 |.are fal|se on a |
|000017b0| 4d 61 63 2e 20 54 68 65 | 20 4d 61 63 20 76 65 72 |Mac. The| Mac ver|
|000017c0| 73 69 6f 6e 20 75 73 65 | 73 0d 09 62 75 66 66 65 |sion use|s..buffe|
|000017d0| 72 53 68 69 66 74 20 3d | 20 62 75 66 70 2d 3e 62 |rShift =| bufp->b|
|000017e0| 75 66 66 65 72 20 2d 20 | 6f 6c 64 5f 62 75 66 66 |uffer - |old_buff|
|000017f0| 65 72 3b 20 77 69 74 68 | 20 62 75 66 66 65 72 53 |er; with| bufferS|
|00001800| 68 69 66 74 20 62 65 69 | 6e 67 20 61 20 6c 6f 6e |hift bei|ng a lon|
|00001810| 67 20 73 68 6f 72 74 0d | 64 65 63 6c 61 72 65 64 |g short.|declared|
|00001820| 20 69 6e 20 72 65 5f 63 | 6f 6d 70 69 6c 65 5f 70 | in re_c|ompile_p|
|00001830| 61 74 74 65 72 6e 2c 20 | 77 68 69 63 68 20 69 73 |attern, |which is|
|00001840| 20 74 68 65 20 6f 6e 6c | 79 20 66 75 6e 63 74 69 | the onl|y functi|
|00001850| 6f 6e 20 77 68 65 72 65 | 20 45 58 54 45 4e 44 5f |on where| EXTEND_|
|00001860| 42 55 46 46 45 52 0d 69 | 73 20 75 73 65 64 2e 0d |BUFFER.i|s used..|
|00001870| 2a 2f 0d 23 64 65 66 69 | 6e 65 20 45 58 54 45 4e |*/.#defi|ne EXTEN|
|00001880| 44 5f 42 55 46 46 45 52 | 20 5c 0d 20 20 7b 20 63 |D_BUFFER| \. { c|
|00001890| 68 61 72 20 2a 6f 6c 64 | 5f 62 75 66 66 65 72 20 |har *old|_buffer |
|000018a0| 3d 20 62 75 66 70 2d 3e | 62 75 66 66 65 72 3b 20 |= bufp->|buffer; |
|000018b0| 5c 0d 20 20 20 20 69 66 | 20 28 62 75 66 70 2d 3e |\. if| (bufp->|
|000018c0| 61 6c 6c 6f 63 61 74 65 | 64 20 3d 3d 20 4d 61 78 |allocate|d == Max|
|000018d0| 41 6c 6c 6f 63 61 74 69 | 6f 6e 29 20 67 6f 74 6f |Allocati|on) goto|
|000018e0| 20 74 6f 6f 5f 62 69 67 | 3b 20 5c 0d 20 20 20 20 | too_big|; \. |
|000018f0| 62 75 66 70 2d 3e 61 6c | 6c 6f 63 61 74 65 64 20 |bufp->al|located |
|00001900| 2a 3d 20 32 3b 20 5c 0d | 20 20 20 20 69 66 20 28 |*= 2; \.| if (|
|00001910| 62 75 66 70 2d 3e 61 6c | 6c 6f 63 61 74 65 64 20 |bufp->al|located |
|00001920| 3e 20 4d 61 78 41 6c 6c | 6f 63 61 74 69 6f 6e 29 |> MaxAll|ocation)|
|00001930| 20 62 75 66 70 2d 3e 61 | 6c 6c 6f 63 61 74 65 64 | bufp->a|llocated|
|00001940| 20 3d 20 4d 61 78 41 6c | 6c 6f 63 61 74 69 6f 6e | = MaxAl|location|
|00001950| 3b 20 5c 0d 20 20 20 20 | 69 66 20 28 21 28 62 75 |; \. |if (!(bu|
|00001960| 66 70 2d 3e 62 75 66 66 | 65 72 20 3d 20 28 63 68 |fp->buff|er = (ch|
|00001970| 61 72 20 2a 29 20 72 65 | 61 6c 6c 6f 63 20 28 62 |ar *) re|alloc (b|
|00001980| 75 66 70 2d 3e 62 75 66 | 66 65 72 2c 20 62 75 66 |ufp->buf|fer, buf|
|00001990| 70 2d 3e 61 6c 6c 6f 63 | 61 74 65 64 29 29 29 20 |p->alloc|ated))) |
|000019a0| 5c 0d 20 20 20 20 20 20 | 67 6f 74 6f 20 6d 65 6d |\. |goto mem|
|000019b0| 6f 72 79 5f 65 78 68 61 | 75 73 74 65 64 3b 20 5c |ory_exha|usted; \|
|000019c0| 0d 20 20 20 20 62 75 66 | 66 65 72 53 68 69 66 74 |. buf|ferShift|
|000019d0| 20 3d 20 62 75 66 70 2d | 3e 62 75 66 66 65 72 20 | = bufp-|>buffer |
|000019e0| 2d 20 6f 6c 64 5f 62 75 | 66 66 65 72 3b 20 5c 0d |- old_bu|ffer; \.|
|000019f0| 20 20 20 20 62 20 2b 3d | 20 62 75 66 66 65 72 53 | b +=| bufferS|
|00001a00| 68 69 66 74 3b 20 5c 0d | 20 20 20 20 69 66 20 28 |hift; \.| if (|
|00001a10| 66 69 78 75 70 5f 6a 75 | 6d 70 29 20 5c 0d 20 20 |fixup_ju|mp) \. |
|00001a20| 20 20 20 20 66 69 78 75 | 70 5f 6a 75 6d 70 20 2b | fixu|p_jump +|
|00001a30| 3d 20 62 75 66 66 65 72 | 53 68 69 66 74 3b 20 5c |= buffer|Shift; \|
|00001a40| 0d 20 20 20 20 69 66 20 | 28 6c 61 73 74 73 74 61 |. if |(laststa|
|00001a50| 72 74 29 20 5c 0d 20 20 | 20 20 20 20 6c 61 73 74 |rt) \. | last|
|00001a60| 73 74 61 72 74 20 2b 3d | 20 62 75 66 66 65 72 53 |start +=| bufferS|
|00001a70| 68 69 66 74 3b 20 5c 0d | 20 20 20 20 62 65 67 61 |hift; \.| bega|
|00001a80| 6c 74 20 2b 3d 20 62 75 | 66 66 65 72 53 68 69 66 |lt += bu|fferShif|
|00001a90| 74 3b 20 5c 0d 20 20 20 | 20 69 66 20 28 70 65 6e |t; \. | if (pen|
|00001aa0| 64 69 6e 67 5f 65 78 61 | 63 74 29 20 5c 0d 20 20 |ding_exa|ct) \. |
|00001ab0| 20 20 20 20 70 65 6e 64 | 69 6e 67 5f 65 78 61 63 | pend|ing_exac|
|00001ac0| 74 20 2b 3d 20 62 75 66 | 66 65 72 53 68 69 66 74 |t += buf|ferShift|
|00001ad0| 3b 20 5c 0d 20 20 7d 0d | 0d 23 69 66 64 65 66 20 |; \. }.|.#ifdef |
|00001ae0| 4e 45 56 45 52 20 2f 2a | 20 6e 6f 74 20 64 65 66 |NEVER /*| not def|
|00001af0| 69 6e 65 64 20 2d 20 4e | 4f 54 20 43 4f 52 52 45 |ined - N|OT CORRE|
|00001b00| 43 54 45 44 20 46 4f 52 | 20 4d 41 43 20 2d 20 73 |CTED FOR| MAC - s|
|00001b10| 65 65 20 6e 6f 74 65 20 | 66 6f 72 20 45 58 54 45 |ee note |for EXTE|
|00001b20| 4e 44 5f 42 55 46 46 45 | 52 20 61 62 6f 76 65 2e |ND_BUFFE|R above.|
|00001b30| 20 2a 2f 0d 23 64 65 66 | 69 6e 65 20 45 58 54 45 | */.#def|ine EXTE|
|00001b40| 4e 44 5f 42 55 46 46 45 | 52 20 5c 0d 20 20 7b 20 |ND_BUFFE|R \. { |
|00001b50| 75 6e 73 69 67 6e 65 64 | 20 62 5f 6f 66 66 20 3d |unsigned| b_off =|
|00001b60| 20 62 20 2d 20 62 75 66 | 70 2d 3e 62 75 66 66 65 | b - buf|p->buffe|
|00001b70| 72 2c 20 5c 0d 09 09 09 | 20 66 5f 6f 66 66 2c 20 |r, \....| f_off, |
|00001b80| 6c 5f 6f 66 66 2c 20 70 | 5f 6f 66 66 2c 20 5c 0d |l_off, p|_off, \.|
|00001b90| 20 20 20 09 09 09 20 62 | 65 67 5f 6f 66 66 20 3d | ... b|eg_off =|
|00001ba0| 20 62 65 67 61 6c 74 20 | 2d 20 62 75 66 70 2d 3e | begalt |- bufp->|
|00001bb0| 62 75 66 66 65 72 3b 20 | 5c 0d 20 20 20 20 69 66 |buffer; |\. if|
|00001bc0| 20 28 66 69 78 75 70 5f | 6a 75 6d 70 29 20 5c 0d | (fixup_|jump) \.|
|00001bd0| 09 20 20 20 66 5f 6f 66 | 66 20 3d 20 66 69 78 75 |. f_of|f = fixu|
|00001be0| 70 5f 6a 75 6d 70 20 2d | 20 62 75 66 70 2d 3e 62 |p_jump -| bufp->b|
|00001bf0| 75 66 66 65 72 3b 20 5c | 0d 20 20 20 20 69 66 20 |uffer; \|. if |
|00001c00| 28 6c 61 73 74 73 74 61 | 72 74 29 20 5c 0d 09 20 |(laststa|rt) \.. |
|00001c10| 20 20 6c 5f 6f 66 66 20 | 3d 20 6c 61 73 74 73 74 | l_off |= lastst|
|00001c20| 61 72 74 20 2d 20 62 75 | 66 70 2d 3e 62 75 66 66 |art - bu|fp->buff|
|00001c30| 65 72 3b 20 5c 0d 20 20 | 20 20 69 66 20 28 70 65 |er; \. | if (pe|
|00001c40| 6e 64 69 6e 67 5f 65 78 | 61 63 74 29 20 5c 0d 09 |nding_ex|act) \..|
|00001c50| 20 20 20 70 5f 6f 66 66 | 20 3d 20 70 65 6e 64 69 | p_off| = pendi|
|00001c60| 6e 67 5f 65 78 61 63 74 | 20 2d 20 62 75 66 70 2d |ng_exact| - bufp-|
|00001c70| 3e 62 75 66 66 65 72 3b | 20 5c 0d 20 20 20 20 69 |>buffer;| \. i|
|00001c80| 66 20 28 62 75 66 70 2d | 3e 61 6c 6c 6f 63 61 74 |f (bufp-|>allocat|
|00001c90| 65 64 20 3d 3d 20 4d 61 | 78 41 6c 6c 6f 63 61 74 |ed == Ma|xAllocat|
|00001ca0| 69 6f 6e 29 20 67 6f 74 | 6f 20 74 6f 6f 5f 62 69 |ion) got|o too_bi|
|00001cb0| 67 3b 20 5c 0d 20 20 20 | 20 62 75 66 70 2d 3e 61 |g; \. | bufp->a|
|00001cc0| 6c 6c 6f 63 61 74 65 64 | 20 2a 3d 20 32 3b 20 5c |llocated| *= 2; \|
|00001cd0| 0d 20 20 20 20 69 66 20 | 28 62 75 66 70 2d 3e 61 |. if |(bufp->a|
|00001ce0| 6c 6c 6f 63 61 74 65 64 | 20 3e 20 4d 61 78 41 6c |llocated| > MaxAl|
|00001cf0| 6c 6f 63 61 74 69 6f 6e | 29 20 62 75 66 70 2d 3e |location|) bufp->|
|00001d00| 61 6c 6c 6f 63 61 74 65 | 64 20 3d 20 4d 61 78 41 |allocate|d = MaxA|
|00001d10| 6c 6c 6f 63 61 74 69 6f | 6e 3b 20 5c 0d 20 20 20 |llocatio|n; \. |
|00001d20| 20 69 66 20 28 21 28 62 | 75 66 70 2d 3e 62 75 66 | if (!(b|ufp->buf|
|00001d30| 66 65 72 20 3d 20 28 63 | 68 61 72 20 2a 29 20 72 |fer = (c|har *) r|
|00001d40| 65 61 6c 6c 6f 63 20 28 | 62 75 66 70 2d 3e 62 75 |ealloc (|bufp->bu|
|00001d50| 66 66 65 72 2c 20 62 75 | 66 70 2d 3e 61 6c 6c 6f |ffer, bu|fp->allo|
|00001d60| 63 61 74 65 64 29 29 29 | 20 5c 0d 20 20 20 20 20 |cated)))| \. |
|00001d70| 20 67 6f 74 6f 20 6d 65 | 6d 6f 72 79 5f 65 78 68 | goto me|mory_exh|
|00001d80| 61 75 73 74 65 64 3b 20 | 5c 0d 09 62 20 3d 20 62 |austed; |\..b = b|
|00001d90| 75 66 70 2d 3e 62 75 66 | 66 65 72 20 2b 20 62 5f |ufp->buf|fer + b_|
|00001da0| 6f 66 66 3b 20 5c 0d 20 | 20 20 20 69 66 20 28 66 |off; \. | if (f|
|00001db0| 69 78 75 70 5f 6a 75 6d | 70 29 20 5c 0d 20 20 20 |ixup_jum|p) \. |
|00001dc0| 20 20 20 66 69 78 75 70 | 5f 6a 75 6d 70 20 3d 20 | fixup|_jump = |
|00001dd0| 62 75 66 70 2d 3e 62 75 | 66 66 65 72 20 2b 20 66 |bufp->bu|ffer + f|
|00001de0| 5f 6f 66 66 3b 20 5c 0d | 20 20 20 20 69 66 20 28 |_off; \.| if (|
|00001df0| 6c 61 73 74 73 74 61 72 | 74 29 20 5c 0d 20 20 20 |laststar|t) \. |
|00001e00| 20 20 20 6c 61 73 74 73 | 74 61 72 74 20 3d 20 62 | lasts|tart = b|
|00001e10| 75 66 70 2d 3e 62 75 66 | 66 65 72 20 2b 20 6c 5f |ufp->buf|fer + l_|
|00001e20| 6f 66 66 3b 20 5c 0d 20 | 20 20 20 62 65 67 61 6c |off; \. | begal|
|00001e30| 74 20 3d 20 62 75 66 70 | 2d 3e 62 75 66 66 65 72 |t = bufp|->buffer|
|00001e40| 20 2b 20 62 65 67 5f 6f | 66 66 3b 20 5c 0d 20 20 | + beg_o|ff; \. |
|00001e50| 20 20 69 66 20 28 70 65 | 6e 64 69 6e 67 5f 65 78 | if (pe|nding_ex|
|00001e60| 61 63 74 29 20 5c 0d 20 | 20 20 20 20 20 70 65 6e |act) \. | pen|
|00001e70| 64 69 6e 67 5f 65 78 61 | 63 74 20 3d 20 62 75 66 |ding_exa|ct = buf|
|00001e80| 70 2d 3e 62 75 66 66 65 | 72 20 2b 20 70 5f 6f 66 |p->buffe|r + p_of|
|00001e90| 66 3b 20 5c 0d 20 20 7d | 0d 23 65 6e 64 69 66 0d |f; \. }|.#endif.|
|00001ea0| 0d 63 68 61 72 20 2a 0d | 72 65 5f 63 6f 6d 70 69 |.char *.|re_compi|
|00001eb0| 6c 65 5f 70 61 74 74 65 | 72 6e 28 63 68 61 72 20 |le_patte|rn(char |
|00001ec0| 2a 70 61 74 74 65 72 6e | 2c 73 68 6f 72 74 20 73 |*pattern|,short s|
|00001ed0| 69 7a 65 2c 73 74 72 75 | 63 74 20 72 65 5f 70 61 |ize,stru|ct re_pa|
|00001ee0| 74 74 65 72 6e 5f 62 75 | 66 66 65 72 20 2a 62 75 |ttern_bu|ffer *bu|
|00001ef0| 66 70 29 0d 7b 0d 20 20 | 72 65 67 69 73 74 65 72 |fp).{. |register|
|00001f00| 20 63 68 61 72 20 2a 62 | 20 3d 20 62 75 66 70 2d | char *b| = bufp-|
|00001f10| 3e 62 75 66 66 65 72 3b | 0d 20 20 72 65 67 69 73 |>buffer;|. regis|
|00001f20| 74 65 72 20 63 68 61 72 | 20 2a 70 20 3d 20 70 61 |ter char| *p = pa|
|00001f30| 74 74 65 72 6e 3b 0d 20 | 20 63 68 61 72 20 2a 70 |ttern;. | char *p|
|00001f40| 65 6e 64 20 3d 20 70 61 | 74 74 65 72 6e 20 2b 20 |end = pa|ttern + |
|00001f50| 73 69 7a 65 3b 0d 20 20 | 72 65 67 69 73 74 65 72 |size;. |register|
|00001f60| 20 75 6e 73 69 67 6e 65 | 64 20 63 2c 20 63 31 3b | unsigne|d c, c1;|
|00001f70| 0d 20 20 63 68 61 72 20 | 2a 70 31 3b 0d 20 20 75 |. char |*p1;. u|
|00001f80| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 20 2a 74 72 |nsigned |char *tr|
|00001f90| 61 6e 73 6c 61 74 65 20 | 3d 20 28 75 6e 73 69 67 |anslate |= (unsig|
|00001fa0| 6e 65 64 20 63 68 61 72 | 20 2a 29 20 62 75 66 70 |ned char| *) bufp|
|00001fb0| 2d 3e 74 72 61 6e 73 6c | 61 74 65 3b 0d 0d 20 20 |->transl|ate;.. |
|00001fc0| 2f 2a 20 61 64 64 72 65 | 73 73 20 6f 66 20 74 68 |/* addre|ss of th|
|00001fd0| 65 20 63 6f 75 6e 74 2d | 62 79 74 65 20 6f 66 20 |e count-|byte of |
|00001fe0| 74 68 65 20 6d 6f 73 74 | 20 72 65 63 65 6e 74 6c |the most| recentl|
|00001ff0| 79 20 69 6e 73 65 72 74 | 65 64 20 22 65 78 61 63 |y insert|ed "exac|
|00002000| 74 6e 22 20 63 6f 6d 6d | 61 6e 64 2e 0d 20 20 20 |tn" comm|and.. |
|00002010| 20 54 68 69 73 20 6d 61 | 6b 65 73 20 69 74 20 70 | This ma|kes it p|
|00002020| 6f 73 73 69 62 6c 65 20 | 74 6f 20 74 65 6c 6c 20 |ossible |to tell |
|00002030| 77 68 65 74 68 65 72 20 | 61 20 6e 65 77 20 65 78 |whether |a new ex|
|00002040| 61 63 74 2d 6d 61 74 63 | 68 20 63 68 61 72 61 63 |act-matc|h charac|
|00002050| 74 65 72 0d 20 20 20 20 | 63 61 6e 20 62 65 20 61 |ter. |can be a|
|00002060| 64 64 65 64 20 74 6f 20 | 74 68 61 74 20 63 6f 6d |dded to |that com|
|00002070| 6d 61 6e 64 20 6f 72 20 | 72 65 71 75 69 72 65 73 |mand or |requires|
|00002080| 20 61 20 6e 65 77 20 22 | 65 78 61 63 74 6e 22 20 | a new "|exactn" |
|00002090| 63 6f 6d 6d 61 6e 64 2e | 20 2a 2f 0d 20 20 20 20 |command.| */. |
|000020a0| 20 0d 20 20 63 68 61 72 | 20 2a 70 65 6e 64 69 6e | . char| *pendin|
|000020b0| 67 5f 65 78 61 63 74 20 | 3d 20 30 3b 0d 0d 20 20 |g_exact |= 0;.. |
|000020c0| 2f 2a 20 61 64 64 72 65 | 73 73 20 6f 66 20 74 68 |/* addre|ss of th|
|000020d0| 65 20 70 6c 61 63 65 20 | 77 68 65 72 65 20 61 20 |e place |where a |
|000020e0| 66 6f 72 77 61 72 64 2d | 6a 75 6d 70 20 73 68 6f |forward-|jump sho|
|000020f0| 75 6c 64 20 67 6f 0d 20 | 20 20 20 74 6f 20 74 68 |uld go. | to th|
|00002100| 65 20 65 6e 64 20 6f 66 | 20 74 68 65 20 63 6f 6e |e end of| the con|
|00002110| 74 61 69 6e 69 6e 67 20 | 65 78 70 72 65 73 73 69 |taining |expressi|
|00002120| 6f 6e 2e 0d 20 20 20 20 | 45 61 63 68 20 61 6c 74 |on.. |Each alt|
|00002130| 65 72 6e 61 74 69 76 65 | 20 6f 66 20 61 6e 20 22 |ernative| of an "|
|00002140| 6f 72 22 2c 20 65 78 63 | 65 70 74 20 74 68 65 20 |or", exc|ept the |
|00002150| 6c 61 73 74 2c 20 65 6e | 64 73 20 77 69 74 68 20 |last, en|ds with |
|00002160| 61 20 66 6f 72 77 61 72 | 64 2d 6a 75 6d 70 0d 20 |a forwar|d-jump. |
|00002170| 20 20 20 6f 66 20 74 68 | 69 73 20 73 6f 72 74 2e | of th|is sort.|
|00002180| 20 2a 2f 0d 0d 20 20 63 | 68 61 72 20 2a 66 69 78 | */.. c|har *fix|
|00002190| 75 70 5f 6a 75 6d 70 20 | 3d 20 30 3b 0d 0d 20 20 |up_jump |= 0;.. |
|000021a0| 2f 2a 20 61 64 64 72 65 | 73 73 20 6f 66 20 73 74 |/* addre|ss of st|
|000021b0| 61 72 74 20 6f 66 20 74 | 68 65 20 6d 6f 73 74 20 |art of t|he most |
|000021c0| 72 65 63 65 6e 74 6c 79 | 20 66 69 6e 69 73 68 65 |recently| finishe|
|000021d0| 64 20 65 78 70 72 65 73 | 73 69 6f 6e 2e 0d 20 20 |d expres|sion.. |
|000021e0| 20 20 54 68 69 73 20 74 | 65 6c 6c 73 20 70 6f 73 | This t|ells pos|
|000021f0| 74 66 69 78 20 2a 20 77 | 68 65 72 65 20 74 6f 20 |tfix * w|here to |
|00002200| 66 69 6e 64 20 74 68 65 | 20 73 74 61 72 74 20 6f |find the| start o|
|00002210| 66 20 69 74 73 20 6f 70 | 65 72 61 6e 64 2e 20 2a |f its op|erand. *|
|00002220| 2f 0d 0d 20 20 63 68 61 | 72 20 2a 6c 61 73 74 73 |/.. cha|r *lasts|
|00002230| 74 61 72 74 20 3d 20 30 | 3b 0d 0d 20 20 2f 2a 20 |tart = 0|;.. /* |
|00002240| 49 6e 20 70 72 6f 63 65 | 73 73 69 6e 67 20 61 20 |In proce|ssing a |
|00002250| 72 65 70 65 61 74 2c 20 | 31 20 6d 65 61 6e 73 20 |repeat, |1 means |
|00002260| 7a 65 72 6f 20 6d 61 74 | 63 68 65 73 20 69 73 20 |zero mat|ches is |
|00002270| 61 6c 6c 6f 77 65 64 20 | 2a 2f 0d 0d 20 20 63 68 |allowed |*/.. ch|
|00002280| 61 72 20 7a 65 72 6f 5f | 74 69 6d 65 73 5f 6f 6b |ar zero_|times_ok|
|00002290| 3b 0d 0d 20 20 2f 2a 20 | 49 6e 20 70 72 6f 63 65 |;.. /* |In proce|
|000022a0| 73 73 69 6e 67 20 61 20 | 72 65 70 65 61 74 2c 20 |ssing a |repeat, |
|000022b0| 31 20 6d 65 61 6e 73 20 | 6d 61 6e 79 20 6d 61 74 |1 means |many mat|
|000022c0| 63 68 65 73 20 69 73 20 | 61 6c 6c 6f 77 65 64 20 |ches is |allowed |
|000022d0| 2a 2f 0d 0d 20 20 63 68 | 61 72 20 6d 61 6e 79 5f |*/.. ch|ar many_|
|000022e0| 74 69 6d 65 73 5f 6f 6b | 3b 0d 0d 20 20 2f 2a 20 |times_ok|;.. /* |
|000022f0| 61 64 64 72 65 73 73 20 | 6f 66 20 62 65 67 69 6e |address |of begin|
|00002300| 6e 69 6e 67 20 6f 66 20 | 72 65 67 65 78 70 2c 20 |ning of |regexp, |
|00002310| 6f 72 20 69 6e 73 69 64 | 65 20 6f 66 20 6c 61 73 |or insid|e of las|
|00002320| 74 20 5c 28 20 2a 2f 0d | 0d 20 20 63 68 61 72 20 |t \( */.|. char |
|00002330| 2a 62 65 67 61 6c 74 20 | 3d 20 62 3b 0d 0d 20 20 |*begalt |= b;.. |
|00002340| 2f 2a 20 53 74 61 63 6b | 20 6f 66 20 69 6e 66 6f |/* Stack| of info|
|00002350| 72 6d 61 74 69 6f 6e 20 | 73 61 76 65 64 20 62 79 |rmation |saved by|
|00002360| 20 5c 28 20 61 6e 64 20 | 72 65 73 74 6f 72 65 64 | \( and |restored|
|00002370| 20 62 79 20 5c 29 2e 0d | 20 20 20 20 20 46 6f 75 | by \)..| Fou|
|00002380| 72 20 73 74 61 63 6b 20 | 65 6c 65 6d 65 6e 74 73 |r stack |elements|
|00002390| 20 61 72 65 20 70 75 73 | 68 65 64 20 62 79 20 65 | are pus|hed by e|
|000023a0| 61 63 68 20 5c 28 3a 0d | 20 20 20 20 20 20 20 46 |ach \(:.| F|
|000023b0| 69 72 73 74 2c 20 74 68 | 65 20 76 61 6c 75 65 20 |irst, th|e value |
|000023c0| 6f 66 20 62 2e 0d 20 20 | 20 20 20 20 20 53 65 63 |of b.. | Sec|
|000023d0| 6f 6e 64 2c 20 74 68 65 | 20 76 61 6c 75 65 20 6f |ond, the| value o|
|000023e0| 66 20 66 69 78 75 70 5f | 6a 75 6d 70 2e 0d 20 20 |f fixup_|jump.. |
|000023f0| 20 20 20 20 20 54 68 69 | 72 64 2c 20 74 68 65 20 | Thi|rd, the |
|00002400| 76 61 6c 75 65 20 6f 66 | 20 72 65 67 6e 75 6d 2e |value of| regnum.|
|00002410| 0d 20 20 20 20 20 20 20 | 46 6f 75 72 74 68 2c 20 |. |Fourth, |
|00002420| 74 68 65 20 76 61 6c 75 | 65 20 6f 66 20 62 65 67 |the valu|e of beg|
|00002430| 61 6c 74 2e 20 20 2a 2f | 0d 0d 20 20 73 68 6f 72 |alt. */|.. shor|
|00002440| 74 20 73 74 61 63 6b 62 | 5b 34 30 5d 3b 0d 20 20 |t stackb|[40];. |
|00002450| 73 68 6f 72 74 20 2a 73 | 74 61 63 6b 70 20 3d 20 |short *s|tackp = |
|00002460| 73 74 61 63 6b 62 3b 0d | 20 20 73 68 6f 72 74 20 |stackb;.| short |
|00002470| 2a 73 74 61 63 6b 65 20 | 3d 20 73 74 61 63 6b 62 |*stacke |= stackb|
|00002480| 20 2b 20 34 30 3b 0d 20 | 20 73 68 6f 72 74 20 2a | + 40;. | short *|
|00002490| 73 74 61 63 6b 74 3b 0d | 0d 20 20 2f 2a 20 43 6f |stackt;.|. /* Co|
|000024a0| 75 6e 74 73 20 5c 28 27 | 73 20 61 73 20 74 68 65 |unts \('|s as the|
|000024b0| 79 20 61 72 65 20 65 6e | 63 6f 75 6e 74 65 72 65 |y are en|countere|
|000024c0| 64 2e 20 20 52 65 6d 65 | 6d 62 65 72 65 64 20 66 |d. Reme|mbered f|
|000024d0| 6f 72 20 74 68 65 20 6d | 61 74 63 68 69 6e 67 20 |or the m|atching |
|000024e0| 5c 29 2c 0d 20 20 20 20 | 20 77 68 65 72 65 20 69 |\),. | where i|
|000024f0| 74 20 62 65 63 6f 6d 65 | 73 20 74 68 65 20 22 72 |t become|s the "r|
|00002500| 65 67 69 73 74 65 72 20 | 6e 75 6d 62 65 72 22 20 |egister |number" |
|00002510| 74 6f 20 70 75 74 20 69 | 6e 20 74 68 65 20 73 74 |to put i|n the st|
|00002520| 6f 70 5f 6d 65 6d 6f 72 | 79 20 63 6f 6d 6d 61 6e |op_memor|y comman|
|00002530| 64 20 2a 2f 0d 0d 20 20 | 73 68 6f 72 74 20 72 65 |d */.. |short re|
|00002540| 67 6e 75 6d 20 3d 20 31 | 3b 0d 20 20 0d 20 20 6c |gnum = 1|;. . l|
|00002550| 6f 6e 67 09 62 75 66 66 | 65 72 53 68 69 66 74 3b |ong.buff|erShift;|
|00002560| 20 2f 2a 20 46 6f 72 20 | 74 68 65 20 4d 61 63 20 | /* For |the Mac |
|00002570| 76 65 72 73 69 6f 6e 2e | 20 53 65 65 20 45 58 54 |version.| See EXT|
|00002580| 45 4e 44 5f 42 55 46 46 | 45 52 20 61 62 6f 76 65 |END_BUFF|ER above|
|00002590| 2e 20 2a 2f 0d 0d 20 20 | 62 75 66 70 2d 3e 66 61 |. */.. |bufp->fa|
|000025a0| 73 74 6d 61 70 5f 61 63 | 63 75 72 61 74 65 20 3d |stmap_ac|curate =|
|000025b0| 20 30 3b 0d 0d 23 69 66 | 6e 64 65 66 20 65 6d 61 | 0;..#if|ndef ema|
|000025c0| 63 73 0d 23 69 66 6e 64 | 65 66 20 53 59 4e 54 41 |cs.#ifnd|ef SYNTA|
|000025d0| 58 5f 54 41 42 4c 45 0d | 20 20 2f 2a 0d 20 20 20 |X_TABLE.| /*. |
|000025e0| 2a 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 74 68 65 |* Initia|lize the|
|000025f0| 20 73 79 6e 74 61 78 20 | 74 61 62 6c 65 2e 0d 20 | syntax |table.. |
|00002600| 20 20 2a 2f 0d 20 20 20 | 69 6e 69 74 5f 73 79 6e | */. |init_syn|
|00002610| 74 61 78 5f 6f 6e 63 65 | 28 29 3b 0d 23 65 6e 64 |tax_once|();.#end|
|00002620| 69 66 0d 23 65 6e 64 69 | 66 0d 0d 20 20 69 66 20 |if.#endi|f.. if |
|00002630| 28 62 75 66 70 2d 3e 61 | 6c 6c 6f 63 61 74 65 64 |(bufp->a|llocated|
|00002640| 20 3d 3d 20 30 29 0d 20 | 20 20 20 7b 0d 20 20 20 | == 0). | {. |
|00002650| 20 20 20 62 75 66 70 2d | 3e 61 6c 6c 6f 63 61 74 | bufp-|>allocat|
|00002660| 65 64 20 3d 20 32 38 3b | 0d 20 20 20 20 20 20 69 |ed = 28;|. i|
|00002670| 66 20 28 62 75 66 70 2d | 3e 62 75 66 66 65 72 29 |f (bufp-|>buffer)|
|00002680| 0d 09 2f 2a 20 45 58 54 | 45 4e 44 5f 42 55 46 46 |../* EXT|END_BUFF|
|00002690| 45 52 20 6c 6f 73 65 73 | 20 77 68 65 6e 20 62 75 |ER loses| when bu|
|000026a0| 66 70 2d 3e 61 6c 6c 6f | 63 61 74 65 64 20 69 73 |fp->allo|cated is|
|000026b0| 20 30 20 2a 2f 0d 09 62 | 75 66 70 2d 3e 62 75 66 | 0 */..b|ufp->buf|
|000026c0| 66 65 72 20 3d 20 28 63 | 68 61 72 20 2a 29 20 72 |fer = (c|har *) r|
|000026d0| 65 61 6c 6c 6f 63 20 28 | 62 75 66 70 2d 3e 62 75 |ealloc (|bufp->bu|
|000026e0| 66 66 65 72 2c 20 32 38 | 29 3b 0d 20 20 20 20 20 |ffer, 28|);. |
|000026f0| 20 65 6c 73 65 0d 09 2f | 2a 20 43 61 6c 6c 65 72 | else../|* Caller|
|00002700| 20 64 69 64 20 6e 6f 74 | 20 61 6c 6c 6f 63 61 74 | did not| allocat|
|00002710| 65 20 61 20 62 75 66 66 | 65 72 2e 20 20 44 6f 20 |e a buff|er. Do |
|00002720| 69 74 20 66 6f 72 20 68 | 69 6d 20 2a 2f 0d 09 62 |it for h|im */..b|
|00002730| 75 66 70 2d 3e 62 75 66 | 66 65 72 20 3d 20 28 63 |ufp->buf|fer = (c|
|00002740| 68 61 72 20 2a 29 20 6d | 61 6c 6c 6f 63 20 28 32 |har *) m|alloc (2|
|00002750| 38 29 3b 0d 20 20 20 20 | 20 20 69 66 20 28 21 62 |8);. | if (!b|
|00002760| 75 66 70 2d 3e 62 75 66 | 66 65 72 29 20 67 6f 74 |ufp->buf|fer) got|
|00002770| 6f 20 6d 65 6d 6f 72 79 | 5f 65 78 68 61 75 73 74 |o memory|_exhaust|
|00002780| 65 64 3b 0d 20 20 20 20 | 20 20 62 65 67 61 6c 74 |ed;. | begalt|
|00002790| 20 3d 20 62 20 3d 20 62 | 75 66 70 2d 3e 62 75 66 | = b = b|ufp->buf|
|000027a0| 66 65 72 3b 0d 20 20 20 | 20 7d 0d 0d 20 20 77 68 |fer;. | }.. wh|
|000027b0| 69 6c 65 20 28 70 20 21 | 3d 20 70 65 6e 64 29 0d |ile (p !|= pend).|
|000027c0| 20 20 20 20 7b 0d 20 20 | 20 20 20 20 69 66 20 28 | {. | if (|
|000027d0| 28 73 68 6f 72 74 29 28 | 62 20 2d 20 62 75 66 70 |(short)(|b - bufp|
|000027e0| 2d 3e 62 75 66 66 65 72 | 29 20 3e 20 62 75 66 70 |->buffer|) > bufp|
|000027f0| 2d 3e 61 6c 6c 6f 63 61 | 74 65 64 20 2d 20 31 30 |->alloca|ted - 10|
|00002800| 29 0d 09 2f 2a 20 4e 6f | 74 65 20 74 68 61 74 20 |)../* No|te that |
|00002810| 45 58 54 45 4e 44 5f 42 | 55 46 46 45 52 20 63 6c |EXTEND_B|UFFER cl|
|00002820| 6f 62 62 65 72 73 20 63 | 2e 20 4d 61 63 20 6e 6f |obbers c|. Mac no|
|00002830| 74 65 2c 20 6e 6f 74 20 | 6f 6e 6c 79 20 64 69 64 |te, not |only did|
|00002840| 20 69 74 20 63 6c 6f 62 | 62 65 72 20 63 2c 0d 09 | it clob|ber c,..|
|00002850| 69 74 20 63 72 61 73 68 | 65 64 20 74 68 65 20 6d |it crash|ed the m|
|00002860| 61 63 68 69 6e 65 2e 20 | 4e 6f 77 20 54 48 41 54 |achine. |Now THAT|
|00002870| 27 73 20 61 20 63 6c 6f | 62 62 65 72 21 20 2a 2f |'s a clo|bber! */|
|00002880| 0d 09 45 58 54 45 4e 44 | 5f 42 55 46 46 45 52 3b |..EXTEND|_BUFFER;|
|00002890| 0d 0d 20 20 20 20 20 20 | 50 41 54 46 45 54 43 48 |.. |PATFETCH|
|000028a0| 20 28 63 29 3b 0d 0d 20 | 20 20 20 20 20 73 77 69 | (c);.. | swi|
|000028b0| 74 63 68 20 28 63 29 0d | 09 7b 0d 09 63 61 73 65 |tch (c).|.{..case|
|000028c0| 20 27 24 27 3a 0d 09 20 | 20 69 66 20 28 6f 62 73 | '$':.. | if (obs|
|000028d0| 63 75 72 65 5f 73 79 6e | 74 61 78 20 26 20 52 45 |cure_syn|tax & RE|
|000028e0| 5f 54 49 47 48 54 5f 56 | 42 41 52 29 0d 09 20 20 |_TIGHT_V|BAR).. |
|000028f0| 20 20 7b 0d 09 20 20 20 | 20 20 20 69 66 20 28 21 | {.. | if (!|
|00002900| 20 28 6f 62 73 63 75 72 | 65 5f 73 79 6e 74 61 78 | (obscur|e_syntax|
|00002910| 20 26 20 52 45 5f 43 4f | 4e 54 45 58 54 5f 49 4e | & RE_CO|NTEXT_IN|
|00002920| 44 45 50 5f 4f 50 53 29 | 20 26 26 20 70 20 21 3d |DEP_OPS)| && p !=|
|00002930| 20 70 65 6e 64 29 0d 09 | 09 67 6f 74 6f 20 6e 6f | pend)..|.goto no|
|00002940| 72 6d 61 6c 5f 63 68 61 | 72 3b 0d 09 20 20 20 20 |rmal_cha|r;.. |
|00002950| 20 20 2f 2a 20 4d 61 6b | 65 20 6f 70 65 72 61 6e | /* Mak|e operan|
|00002960| 64 20 6f 66 20 6c 61 73 | 74 20 76 62 61 72 20 65 |d of las|t vbar e|
|00002970| 6e 64 20 62 65 66 6f 72 | 65 20 74 68 69 73 20 60 |nd befor|e this `|
|00002980| 24 27 2e 20 20 2a 2f 0d | 09 20 20 20 20 20 20 69 |$'. */.|. i|
|00002990| 66 20 28 66 69 78 75 70 | 5f 6a 75 6d 70 29 0d 09 |f (fixup|_jump)..|
|000029a0| 09 73 74 6f 72 65 5f 6a | 75 6d 70 20 28 66 69 78 |.store_j|ump (fix|
|000029b0| 75 70 5f 6a 75 6d 70 2c | 20 6a 75 6d 70 2c 20 62 |up_jump,| jump, b|
|000029c0| 29 3b 0d 09 20 20 20 20 | 20 20 66 69 78 75 70 5f |);.. | fixup_|
|000029d0| 6a 75 6d 70 20 3d 20 30 | 3b 0d 09 20 20 20 20 20 |jump = 0|;.. |
|000029e0| 20 50 41 54 50 55 53 48 | 20 28 65 6e 64 6c 69 6e | PATPUSH| (endlin|
|000029f0| 65 29 3b 0d 09 20 20 20 | 20 20 20 62 72 65 61 6b |e);.. | break|
|00002a00| 3b 0d 09 20 20 20 20 7d | 0d 0d 09 20 20 2f 2a 20 |;.. }|... /* |
|00002a10| 24 20 6d 65 61 6e 73 20 | 73 75 63 63 65 65 64 20 |$ means |succeed |
|00002a20| 69 66 20 61 74 20 65 6e | 64 20 6f 66 20 6c 69 6e |if at en|d of lin|
|00002a30| 65 2c 20 62 75 74 20 6f | 6e 6c 79 20 69 6e 20 73 |e, but o|nly in s|
|00002a40| 70 65 63 69 61 6c 20 63 | 6f 6e 74 65 78 74 73 2e |pecial c|ontexts.|
|00002a50| 0d 09 20 20 20 20 49 66 | 20 72 61 6e 64 6f 6d 6c |.. If| randoml|
|00002a60| 79 20 69 6e 20 74 68 65 | 20 6d 69 64 64 6c 65 20 |y in the| middle |
|00002a70| 6f 66 20 61 20 70 61 74 | 74 65 72 6e 2c 20 69 74 |of a pat|tern, it|
|00002a80| 20 69 73 20 61 20 6e 6f | 72 6d 61 6c 20 63 68 61 | is a no|rmal cha|
|00002a90| 72 61 63 74 65 72 2e 20 | 2a 2f 0d 09 20 20 69 66 |racter. |*/.. if|
|00002aa0| 20 28 70 20 3d 3d 20 70 | 65 6e 64 20 7c 7c 20 2a | (p == p|end || *|
|00002ab0| 70 20 3d 3d 20 43 52 0d | 09 20 20 20 20 20 20 7c |p == CR.|. ||
|00002ac0| 7c 20 28 6f 62 73 63 75 | 72 65 5f 73 79 6e 74 61 || (obscu|re_synta|
|00002ad0| 78 20 26 20 52 45 5f 43 | 4f 4e 54 45 58 54 5f 49 |x & RE_C|ONTEXT_I|
|00002ae0| 4e 44 45 50 5f 4f 50 53 | 29 0d 09 20 20 20 20 20 |NDEP_OPS|).. |
|00002af0| 20 7c 7c 20 28 6f 62 73 | 63 75 72 65 5f 73 79 6e | || (obs|cure_syn|
|00002b00| 74 61 78 20 26 20 52 45 | 5f 4e 4f 5f 42 4b 5f 50 |tax & RE|_NO_BK_P|
|00002b10| 41 52 45 4e 53 0d 09 09 | 20 20 3f 20 2a 70 20 3d |ARENS...| ? *p =|
|00002b20| 3d 20 27 29 27 0d 09 09 | 20 20 3a 20 2a 70 20 3d |= ')'...| : *p =|
|00002b30| 3d 20 27 5c 5c 27 20 26 | 26 20 70 5b 31 5d 20 3d |= '\\' &|& p[1] =|
|00002b40| 3d 20 27 29 27 29 0d 09 | 20 20 20 20 20 20 7c 7c |= ')')..| |||
|00002b50| 20 28 6f 62 73 63 75 72 | 65 5f 73 79 6e 74 61 78 | (obscur|e_syntax|
|00002b60| 20 26 20 52 45 5f 4e 4f | 5f 42 4b 5f 56 42 41 52 | & RE_NO|_BK_VBAR|
|00002b70| 0d 09 09 20 20 3f 20 2a | 70 20 3d 3d 20 27 7c 27 |... ? *|p == '|'|
|00002b80| 0d 09 09 20 20 3a 20 2a | 70 20 3d 3d 20 27 5c 5c |... : *|p == '\\|
|00002b90| 27 20 26 26 20 70 5b 31 | 5d 20 3d 3d 20 27 7c 27 |' && p[1|] == '|'|
|00002ba0| 29 29 0d 09 20 20 20 20 | 7b 0d 09 20 20 20 20 20 |)).. |{.. |
|00002bb0| 20 50 41 54 50 55 53 48 | 20 28 65 6e 64 6c 69 6e | PATPUSH| (endlin|
|00002bc0| 65 29 3b 0d 09 20 20 20 | 20 20 20 62 72 65 61 6b |e);.. | break|
|00002bd0| 3b 0d 09 20 20 20 20 7d | 0d 09 20 20 67 6f 74 6f |;.. }|.. goto|
|00002be0| 20 6e 6f 72 6d 61 6c 5f | 63 68 61 72 3b 0d 0d 09 | normal_|char;...|
|00002bf0| 63 61 73 65 20 27 5e 27 | 3a 0d 09 20 20 2f 2a 20 |case '^'|:.. /* |
|00002c00| 5e 20 6d 65 61 6e 73 20 | 73 75 63 63 65 65 64 20 |^ means |succeed |
|00002c10| 69 66 20 61 74 20 62 65 | 67 20 6f 66 20 6c 69 6e |if at be|g of lin|
|00002c20| 65 2c 20 62 75 74 20 6f | 6e 6c 79 20 69 66 20 6e |e, but o|nly if n|
|00002c30| 6f 20 70 72 65 63 65 64 | 69 6e 67 20 70 61 74 74 |o preced|ing patt|
|00002c40| 65 72 6e 2e 20 2a 2f 0d | 0d 09 20 20 69 66 20 28 |ern. */.|.. if (|
|00002c50| 6c 61 73 74 73 74 61 72 | 74 20 26 26 20 70 5b 2d |laststar|t && p[-|
|00002c60| 32 5d 20 21 3d 20 43 52 | 0d 09 20 20 20 20 20 20 |2] != CR|.. |
|00002c70| 26 26 20 21 20 28 6f 62 | 73 63 75 72 65 5f 73 79 |&& ! (ob|scure_sy|
|00002c80| 6e 74 61 78 20 26 20 52 | 45 5f 43 4f 4e 54 45 58 |ntax & R|E_CONTEX|
|00002c90| 54 5f 49 4e 44 45 50 5f | 4f 50 53 29 29 0d 09 20 |T_INDEP_|OPS)).. |
|00002ca0| 20 20 20 67 6f 74 6f 20 | 6e 6f 72 6d 61 6c 5f 63 | goto |normal_c|
|00002cb0| 68 61 72 3b 0d 09 20 20 | 69 66 20 28 6f 62 73 63 |har;.. |if (obsc|
|00002cc0| 75 72 65 5f 73 79 6e 74 | 61 78 20 26 20 52 45 5f |ure_synt|ax & RE_|
|00002cd0| 54 49 47 48 54 5f 56 42 | 41 52 29 0d 09 20 20 20 |TIGHT_VB|AR).. |
|00002ce0| 20 7b 0d 09 20 20 20 20 | 20 20 69 66 20 28 70 20 | {.. | if (p |
|00002cf0| 21 3d 20 70 61 74 74 65 | 72 6e 20 2b 20 31 0d 09 |!= patte|rn + 1..|
|00002d00| 09 20 20 26 26 20 21 20 | 28 6f 62 73 63 75 72 65 |. && ! |(obscure|
|00002d10| 5f 73 79 6e 74 61 78 20 | 26 20 52 45 5f 43 4f 4e |_syntax |& RE_CON|
|00002d20| 54 45 58 54 5f 49 4e 44 | 45 50 5f 4f 50 53 29 29 |TEXT_IND|EP_OPS))|
|00002d30| 0d 09 09 67 6f 74 6f 20 | 6e 6f 72 6d 61 6c 5f 63 |...goto |normal_c|
|00002d40| 68 61 72 3b 0d 09 20 20 | 20 20 20 20 50 41 54 50 |har;.. | PATP|
|00002d50| 55 53 48 20 28 62 65 67 | 6c 69 6e 65 29 3b 0d 09 |USH (beg|line);..|
|00002d60| 20 20 20 20 20 20 62 65 | 67 61 6c 74 20 3d 20 62 | be|galt = b|
|00002d70| 3b 0d 09 20 20 20 20 7d | 0d 09 20 20 65 6c 73 65 |;.. }|.. else|
|00002d80| 0d 09 20 20 20 20 50 41 | 54 50 55 53 48 20 28 62 |.. PA|TPUSH (b|
|00002d90| 65 67 6c 69 6e 65 29 3b | 0d 09 20 20 62 72 65 61 |egline);|.. brea|
|00002da0| 6b 3b 0d 0d 09 63 61 73 | 65 20 27 2b 27 3a 0d 09 |k;...cas|e '+':..|
|00002db0| 63 61 73 65 20 27 3f 27 | 3a 0d 09 20 20 69 66 20 |case '?'|:.. if |
|00002dc0| 28 6f 62 73 63 75 72 65 | 5f 73 79 6e 74 61 78 20 |(obscure|_syntax |
|00002dd0| 26 20 52 45 5f 42 4b 5f | 50 4c 55 53 5f 51 4d 29 |& RE_BK_|PLUS_QM)|
|00002de0| 0d 09 20 20 20 20 67 6f | 74 6f 20 6e 6f 72 6d 61 |.. go|to norma|
|00002df0| 6c 5f 63 68 61 72 3b 0d | 09 68 61 6e 64 6c 65 5f |l_char;.|.handle_|
|00002e00| 70 6c 75 73 3a 0d 09 63 | 61 73 65 20 27 2a 27 3a |plus:..c|ase '*':|
|00002e10| 0d 09 20 20 2f 2a 20 49 | 66 20 74 68 65 72 65 20 |.. /* I|f there |
|00002e20| 69 73 20 6e 6f 20 70 72 | 65 76 69 6f 75 73 20 70 |is no pr|evious p|
|00002e30| 61 74 74 65 72 6e 2c 20 | 63 68 61 72 20 6e 6f 74 |attern, |char not|
|00002e40| 20 73 70 65 63 69 61 6c | 2e 20 2a 2f 0d 09 20 20 | special|. */.. |
|00002e50| 69 66 20 28 21 6c 61 73 | 74 73 74 61 72 74 20 26 |if (!las|tstart &|
|00002e60| 26 20 21 20 28 6f 62 73 | 63 75 72 65 5f 73 79 6e |& ! (obs|cure_syn|
|00002e70| 74 61 78 20 26 20 52 45 | 5f 43 4f 4e 54 45 58 54 |tax & RE|_CONTEXT|
|00002e80| 5f 49 4e 44 45 50 5f 4f | 50 53 29 29 0d 09 20 20 |_INDEP_O|PS)).. |
|00002e90| 20 20 67 6f 74 6f 20 6e | 6f 72 6d 61 6c 5f 63 68 | goto n|ormal_ch|
|00002ea0| 61 72 3b 0d 09 20 20 2f | 2a 20 49 66 20 74 68 65 |ar;.. /|* If the|
|00002eb0| 72 65 20 69 73 20 61 20 | 73 65 71 75 65 6e 63 65 |re is a |sequence|
|00002ec0| 20 6f 66 20 72 65 70 65 | 74 69 74 69 6f 6e 20 63 | of repe|tition c|
|00002ed0| 68 61 72 73 2c 0d 09 20 | 20 20 20 20 63 6f 6c 6c |hars,.. | coll|
|00002ee0| 61 70 73 65 20 69 74 20 | 64 6f 77 6e 20 74 6f 20 |apse it |down to |
|00002ef0| 65 71 75 69 76 61 6c 65 | 6e 74 20 74 6f 20 6a 75 |equivale|nt to ju|
|00002f00| 73 74 20 6f 6e 65 2e 20 | 20 2a 2f 0d 09 20 20 7a |st one. | */.. z|
|00002f10| 65 72 6f 5f 74 69 6d 65 | 73 5f 6f 6b 20 3d 20 30 |ero_time|s_ok = 0|
|00002f20| 3b 0d 09 20 20 6d 61 6e | 79 5f 74 69 6d 65 73 5f |;.. man|y_times_|
|00002f30| 6f 6b 20 3d 20 30 3b 0d | 09 20 20 77 68 69 6c 65 |ok = 0;.|. while|
|00002f40| 20 28 31 29 0d 09 20 20 | 20 20 7b 0d 09 20 20 20 | (1).. | {.. |
|00002f50| 20 20 20 7a 65 72 6f 5f | 74 69 6d 65 73 5f 6f 6b | zero_|times_ok|
|00002f60| 20 7c 3d 20 63 20 21 3d | 20 27 2b 27 3b 0d 09 20 | |= c !=| '+';.. |
|00002f70| 20 20 20 20 20 6d 61 6e | 79 5f 74 69 6d 65 73 5f | man|y_times_|
|00002f80| 6f 6b 20 7c 3d 20 63 20 | 21 3d 20 27 3f 27 3b 0d |ok |= c |!= '?';.|
|00002f90| 09 20 20 20 20 20 20 69 | 66 20 28 70 20 3d 3d 20 |. i|f (p == |
|00002fa0| 70 65 6e 64 29 0d 09 09 | 62 72 65 61 6b 3b 0d 09 |pend)...|break;..|
|00002fb0| 20 20 20 20 20 20 50 41 | 54 46 45 54 43 48 20 28 | PA|TFETCH (|
|00002fc0| 63 29 3b 0d 09 20 20 20 | 20 20 20 69 66 20 28 63 |c);.. | if (c|
|00002fd0| 20 3d 3d 20 27 2a 27 29 | 0d 09 09 3b 0d 09 20 20 | == '*')|...;.. |
|00002fe0| 20 20 20 20 65 6c 73 65 | 20 69 66 20 28 21 28 6f | else| if (!(o|
|00002ff0| 62 73 63 75 72 65 5f 73 | 79 6e 74 61 78 20 26 20 |bscure_s|yntax & |
|00003000| 52 45 5f 42 4b 5f 50 4c | 55 53 5f 51 4d 29 0d 09 |RE_BK_PL|US_QM)..|
|00003010| 09 20 20 20 20 20 20 20 | 26 26 20 28 63 20 3d 3d |. |&& (c ==|
|00003020| 20 27 2b 27 20 7c 7c 20 | 63 20 3d 3d 20 27 3f 27 | '+' || |c == '?'|
|00003030| 29 29 0d 09 09 3b 0d 09 | 20 20 20 20 20 20 65 6c |))...;..| el|
|00003040| 73 65 20 69 66 20 28 28 | 6f 62 73 63 75 72 65 5f |se if ((|obscure_|
|00003050| 73 79 6e 74 61 78 20 26 | 20 52 45 5f 42 4b 5f 50 |syntax &| RE_BK_P|
|00003060| 4c 55 53 5f 51 4d 29 0d | 09 09 20 20 20 20 20 20 |LUS_QM).|.. |
|00003070| 20 26 26 20 63 20 3d 3d | 20 27 5c 5c 27 29 0d 09 | && c ==| '\\')..|
|00003080| 09 7b 0d 09 09 20 20 73 | 68 6f 72 74 20 63 31 3b |.{... s|hort c1;|
|00003090| 0d 09 09 20 20 50 41 54 | 46 45 54 43 48 20 28 63 |... PAT|FETCH (c|
|000030a0| 31 29 3b 0d 09 09 20 20 | 69 66 20 28 21 28 63 31 |1);... |if (!(c1|
|000030b0| 20 3d 3d 20 27 2b 27 20 | 7c 7c 20 63 31 20 3d 3d | == '+' ||| c1 ==|
|000030c0| 20 27 3f 27 29 29 0d 09 | 09 20 20 20 20 7b 0d 09 | '?'))..|. {..|
|000030d0| 09 20 20 20 20 20 20 50 | 41 54 55 4e 46 45 54 43 |. P|ATUNFETC|
|000030e0| 48 3b 0d 09 09 20 20 20 | 20 20 20 50 41 54 55 4e |H;... | PATUN|
|000030f0| 46 45 54 43 48 3b 0d 09 | 09 20 20 20 20 20 20 62 |FETCH;..|. b|
|00003100| 72 65 61 6b 3b 0d 09 09 | 20 20 20 20 7d 0d 09 09 |reak;...| }...|
|00003110| 20 20 63 20 3d 20 63 31 | 3b 0d 09 09 7d 0d 09 20 | c = c1|;...}.. |
|00003120| 20 20 20 20 20 65 6c 73 | 65 0d 09 09 7b 0d 09 09 | els|e...{...|
|00003130| 20 20 50 41 54 55 4e 46 | 45 54 43 48 3b 0d 09 09 | PATUNF|ETCH;...|
|00003140| 20 20 62 72 65 61 6b 3b | 0d 09 09 7d 0d 09 20 20 | break;|...}.. |
|00003150| 20 20 7d 0d 0d 09 20 20 | 2f 2a 20 53 74 61 72 2c | }... |/* Star,|
|00003160| 20 65 74 63 2e 20 61 70 | 70 6c 69 65 64 20 74 6f | etc. ap|plied to|
|00003170| 20 61 6e 20 65 6d 70 74 | 79 20 70 61 74 74 65 72 | an empt|y patter|
|00003180| 6e 20 69 73 20 65 71 75 | 69 76 61 6c 65 6e 74 0d |n is equ|ivalent.|
|00003190| 09 20 20 20 20 20 74 6f | 20 61 6e 20 65 6d 70 74 |. to| an empt|
|000031a0| 79 20 70 61 74 74 65 72 | 6e 2e 20 20 2a 2f 0d 09 |y patter|n. */..|
|000031b0| 20 20 69 66 20 28 21 6c | 61 73 74 73 74 61 72 74 | if (!l|aststart|
|000031c0| 29 0d 09 20 20 20 20 62 | 72 65 61 6b 3b 0d 0d 09 |).. b|reak;...|
|000031d0| 20 20 2f 2a 20 4e 6f 77 | 20 77 65 20 6b 6e 6f 77 | /* Now| we know|
|000031e0| 20 77 68 65 74 68 65 72 | 20 30 20 6d 61 74 63 68 | whether| 0 match|
|000031f0| 65 73 20 69 73 20 61 6c | 6c 6f 77 65 64 2c 0d 09 |es is al|lowed,..|
|00003200| 20 20 20 20 20 61 6e 64 | 20 77 68 65 74 68 65 72 | and| whether|
|00003210| 20 32 20 6f 72 20 6d 6f | 72 65 20 6d 61 74 63 68 | 2 or mo|re match|
|00003220| 65 73 20 69 73 20 61 6c | 6c 6f 77 65 64 2e 20 20 |es is al|lowed. |
|00003230| 2a 2f 0d 09 20 20 69 66 | 20 28 6d 61 6e 79 5f 74 |*/.. if| (many_t|
|00003240| 69 6d 65 73 5f 6f 6b 29 | 0d 09 20 20 20 20 7b 0d |imes_ok)|.. {.|
|00003250| 09 20 20 20 20 20 20 2f | 2a 20 49 66 20 6d 6f 72 |. /|* If mor|
|00003260| 65 20 74 68 61 6e 20 6f | 6e 65 20 72 65 70 65 74 |e than o|ne repet|
|00003270| 69 74 69 6f 6e 20 69 73 | 20 61 6c 6c 6f 77 65 64 |ition is| allowed|
|00003280| 2c 0d 09 09 20 70 75 74 | 20 69 6e 20 61 20 62 61 |,... put| in a ba|
|00003290| 63 6b 77 61 72 64 20 6a | 75 6d 70 20 61 74 20 74 |ckward j|ump at t|
|000032a0| 68 65 20 65 6e 64 2e 20 | 20 2a 2f 0d 09 20 20 20 |he end. | */.. |
|000032b0| 20 20 20 73 74 6f 72 65 | 5f 6a 75 6d 70 20 28 62 | store|_jump (b|
|000032c0| 2c 20 6d 61 79 62 65 5f | 66 69 6e 61 6c 69 7a 65 |, maybe_|finalize|
|000032d0| 5f 6a 75 6d 70 2c 20 6c | 61 73 74 73 74 61 72 74 |_jump, l|aststart|
|000032e0| 20 2d 20 33 29 3b 0d 09 | 20 20 20 20 20 20 62 20 | - 3);..| b |
|000032f0| 2b 3d 20 33 3b 0d 09 20 | 20 20 20 7d 0d 09 20 20 |+= 3;.. | }.. |
|00003300| 69 6e 73 65 72 74 5f 6a | 75 6d 70 20 28 6f 6e 5f |insert_j|ump (on_|
|00003310| 66 61 69 6c 75 72 65 5f | 6a 75 6d 70 2c 20 6c 61 |failure_|jump, la|
|00003320| 73 74 73 74 61 72 74 2c | 20 62 20 2b 20 33 2c 20 |ststart,| b + 3, |
|00003330| 62 29 3b 0d 09 20 20 70 | 65 6e 64 69 6e 67 5f 65 |b);.. p|ending_e|
|00003340| 78 61 63 74 20 3d 20 30 | 3b 0d 09 20 20 62 20 2b |xact = 0|;.. b +|
|00003350| 3d 20 33 3b 0d 09 20 20 | 69 66 20 28 21 7a 65 72 |= 3;.. |if (!zer|
|00003360| 6f 5f 74 69 6d 65 73 5f | 6f 6b 29 0d 09 20 20 20 |o_times_|ok).. |
|00003370| 20 7b 0d 09 20 20 20 20 | 20 20 2f 2a 20 41 74 20 | {.. | /* At |
|00003380| 6c 65 61 73 74 20 6f 6e | 65 20 72 65 70 65 74 69 |least on|e repeti|
|00003390| 74 69 6f 6e 20 72 65 71 | 75 69 72 65 64 3a 20 69 |tion req|uired: i|
|000033a0| 6e 73 65 72 74 20 62 65 | 66 6f 72 65 20 74 68 65 |nsert be|fore the|
|000033b0| 20 6c 6f 6f 70 0d 09 09 | 20 61 20 73 6b 69 70 20 | loop...| a skip |
|000033c0| 6f 76 65 72 20 74 68 65 | 20 69 6e 69 74 69 61 6c |over the| initial|
|000033d0| 20 6f 6e 2d 66 61 69 6c | 75 72 65 2d 6a 75 6d 70 | on-fail|ure-jump|
|000033e0| 20 69 6e 73 74 72 75 63 | 74 69 6f 6e 20 2a 2f 0d | instruc|tion */.|
|000033f0| 09 20 20 20 20 20 20 69 | 6e 73 65 72 74 5f 6a 75 |. i|nsert_ju|
|00003400| 6d 70 20 28 64 75 6d 6d | 79 5f 66 61 69 6c 75 72 |mp (dumm|y_failur|
|00003410| 65 5f 6a 75 6d 70 2c 20 | 6c 61 73 74 73 74 61 72 |e_jump, |laststar|
|00003420| 74 2c 20 6c 61 73 74 73 | 74 61 72 74 20 2b 20 36 |t, lasts|tart + 6|
|00003430| 2c 20 62 29 3b 0d 09 20 | 20 20 20 20 20 62 20 2b |, b);.. | b +|
|00003440| 3d 20 33 3b 0d 09 20 20 | 20 20 7d 0d 09 20 20 62 |= 3;.. | }.. b|
|00003450| 72 65 61 6b 3b 0d 0d 09 | 63 61 73 65 20 27 2e 27 |reak;...|case '.'|
|00003460| 3a 0d 09 20 20 6c 61 73 | 74 73 74 61 72 74 20 3d |:.. las|tstart =|
|00003470| 20 62 3b 0d 09 20 20 50 | 41 54 50 55 53 48 20 28 | b;.. P|ATPUSH (|
|00003480| 61 6e 79 63 68 61 72 29 | 3b 0d 09 20 20 62 72 65 |anychar)|;.. bre|
|00003490| 61 6b 3b 0d 0d 09 63 61 | 73 65 20 27 5b 27 3a 0d |ak;...ca|se '[':.|
|000034a0| 09 20 20 77 68 69 6c 65 | 20 28 28 73 68 6f 72 74 |. while| ((short|
|000034b0| 29 28 62 20 2d 20 62 75 | 66 70 2d 3e 62 75 66 66 |)(b - bu|fp->buff|
|000034c0| 65 72 29 0d 09 09 20 3e | 20 62 75 66 70 2d 3e 61 |er)... >| bufp->a|
|000034d0| 6c 6c 6f 63 61 74 65 64 | 20 2d 20 33 20 2d 20 28 |llocated| - 3 - (|
|000034e0| 31 20 3c 3c 20 42 59 54 | 45 57 49 44 54 48 29 20 |1 << BYT|EWIDTH) |
|000034f0| 2f 20 42 59 54 45 57 49 | 44 54 48 29 0d 09 20 20 |/ BYTEWI|DTH).. |
|00003500| 20 20 2f 2a 20 4e 6f 74 | 65 20 74 68 61 74 20 45 | /* Not|e that E|
|00003510| 58 54 45 4e 44 5f 42 55 | 46 46 45 52 20 63 6c 6f |XTEND_BU|FFER clo|
|00003520| 62 62 65 72 73 20 63 2e | 20 4d 61 63 20 6e 6f 74 |bbers c.| Mac not|
|00003530| 65 2c 20 6e 6f 20 6c 6f | 6e 67 65 72 2e 20 2a 2f |e, no lo|nger. */|
|00003540| 0d 09 20 20 20 20 45 58 | 54 45 4e 44 5f 42 55 46 |.. EX|TEND_BUF|
|00003550| 46 45 52 3b 0d 0d 09 20 | 20 6c 61 73 74 73 74 61 |FER;... | laststa|
|00003560| 72 74 20 3d 20 62 3b 0d | 09 20 20 69 66 20 28 2a |rt = b;.|. if (*|
|00003570| 70 20 3d 3d 20 27 5e 27 | 29 0d 09 20 20 20 20 50 |p == '^'|).. P|
|00003580| 41 54 50 55 53 48 20 28 | 63 68 61 72 73 65 74 5f |ATPUSH (|charset_|
|00003590| 6e 6f 74 29 2c 20 70 2b | 2b 3b 0d 09 20 20 65 6c |not), p+|+;.. el|
|000035a0| 73 65 0d 09 20 20 20 20 | 50 41 54 50 55 53 48 20 |se.. |PATPUSH |
|000035b0| 28 63 68 61 72 73 65 74 | 29 3b 0d 09 20 20 70 31 |(charset|);.. p1|
|000035c0| 20 3d 20 70 3b 0d 0d 09 | 20 20 50 41 54 50 55 53 | = p;...| PATPUS|
|000035d0| 48 20 28 28 31 20 3c 3c | 20 42 59 54 45 57 49 44 |H ((1 <<| BYTEWID|
|000035e0| 54 48 29 20 2f 20 42 59 | 54 45 57 49 44 54 48 29 |TH) / BY|TEWIDTH)|
|000035f0| 3b 0d 09 20 20 2f 2a 20 | 43 6c 65 61 72 20 74 68 |;.. /* |Clear th|
|00003600| 65 20 77 68 6f 6c 65 20 | 6d 61 70 20 2a 2f 0d 09 |e whole |map */..|
|00003610| 20 20 62 7a 65 72 6f 20 | 28 62 2c 20 28 31 20 3c | bzero |(b, (1 <|
|00003620| 3c 20 42 59 54 45 57 49 | 44 54 48 29 20 2f 20 42 |< BYTEWI|DTH) / B|
|00003630| 59 54 45 57 49 44 54 48 | 29 3b 0d 09 20 20 2f 2a |YTEWIDTH|);.. /*|
|00003640| 20 52 65 61 64 20 69 6e | 20 63 68 61 72 61 63 74 | Read in| charact|
|00003650| 65 72 73 20 61 6e 64 20 | 72 61 6e 67 65 73 2c 20 |ers and |ranges, |
|00003660| 73 65 74 74 69 6e 67 20 | 6d 61 70 20 62 69 74 73 |setting |map bits|
|00003670| 20 2a 2f 0d 09 20 20 77 | 68 69 6c 65 20 28 31 29 | */.. w|hile (1)|
|00003680| 0d 09 20 20 20 20 7b 0d | 09 20 20 20 20 20 20 50 |.. {.|. P|
|00003690| 41 54 46 45 54 43 48 20 | 28 63 29 3b 0d 0d 09 20 |ATFETCH |(c);... |
|000036a0| 20 20 20 20 20 2f 2a 20 | 49 66 20 61 77 6b 2c 20 | /* |If awk, |
|000036b0| 5c 20 65 73 63 61 70 65 | 73 20 63 68 61 72 61 63 |\ escape|s charac|
|000036c0| 74 65 72 73 20 69 6e 73 | 69 64 65 20 5b 2e 2e 2e |ters ins|ide [...|
|000036d0| 5d 2e 20 20 2a 2f 0d 09 | 20 20 20 20 20 20 69 66 |]. */..| if|
|000036e0| 20 28 28 6f 62 73 63 75 | 72 65 5f 73 79 6e 74 61 | ((obscu|re_synta|
|000036f0| 78 20 26 20 52 45 5f 41 | 57 4b 5f 43 4c 41 53 53 |x & RE_A|WK_CLASS|
|00003700| 5f 48 41 43 4b 29 20 26 | 26 20 63 20 3d 3d 20 27 |_HACK) &|& c == '|
|00003710| 5c 5c 27 29 0d 09 20 20 | 20 20 20 20 20 20 7b 0d |\\').. | {.|
|00003720| 09 20 20 20 20 20 20 20 | 20 20 20 50 41 54 46 45 |. | PATFE|
|00003730| 54 43 48 28 63 31 29 3b | 0d 09 20 20 20 20 20 20 |TCH(c1);|.. |
|00003740| 20 20 20 20 62 5b 63 31 | 20 2f 20 42 59 54 45 57 | b[c1| / BYTEW|
|00003750| 49 44 54 48 5d 20 7c 3d | 20 31 20 3c 3c 20 28 63 |IDTH] |=| 1 << (c|
|00003760| 31 20 25 20 42 59 54 45 | 57 49 44 54 48 29 3b 0d |1 % BYTE|WIDTH);.|
|00003770| 09 20 20 20 20 20 20 20 | 20 20 20 63 6f 6e 74 69 |. | conti|
|00003780| 6e 75 65 3b 0d 09 20 20 | 20 20 20 20 20 20 7d 0d |nue;.. | }.|
|00003790| 0d 09 20 20 20 20 20 20 | 69 66 20 28 63 20 3d 3d |.. |if (c ==|
|000037a0| 20 27 5d 27 20 26 26 20 | 70 20 21 3d 20 70 31 20 | ']' && |p != p1 |
|000037b0| 2b 20 31 29 20 62 72 65 | 61 6b 3b 0d 09 20 20 20 |+ 1) bre|ak;.. |
|000037c0| 20 20 20 69 66 20 28 2a | 70 20 3d 3d 20 27 2d 27 | if (*|p == '-'|
|000037d0| 20 26 26 20 70 5b 31 5d | 20 21 3d 20 27 5d 27 29 | && p[1]| != ']')|
|000037e0| 0d 09 09 7b 0d 09 09 20 | 20 50 41 54 46 45 54 43 |...{... | PATFETC|
|000037f0| 48 20 28 63 31 29 3b 0d | 09 09 20 20 50 41 54 46 |H (c1);.|.. PATF|
|00003800| 45 54 43 48 20 28 63 31 | 29 3b 0d 09 09 20 20 77 |ETCH (c1|);... w|
|00003810| 68 69 6c 65 20 28 63 20 | 3c 3d 20 63 31 29 0d 09 |hile (c |<= c1)..|
|00003820| 09 20 20 20 20 62 5b 63 | 20 2f 20 42 59 54 45 57 |. b[c| / BYTEW|
|00003830| 49 44 54 48 5d 20 7c 3d | 20 31 20 3c 3c 20 28 63 |IDTH] |=| 1 << (c|
|00003840| 20 25 20 42 59 54 45 57 | 49 44 54 48 29 2c 20 63 | % BYTEW|IDTH), c|
|00003850| 2b 2b 3b 0d 09 09 7d 0d | 09 20 20 20 20 20 20 65 |++;...}.|. e|
|00003860| 6c 73 65 0d 09 09 7b 0d | 09 09 20 20 62 5b 63 20 |lse...{.|.. b[c |
|00003870| 2f 20 42 59 54 45 57 49 | 44 54 48 5d 20 7c 3d 20 |/ BYTEWI|DTH] |= |
|00003880| 31 20 3c 3c 20 28 63 20 | 25 20 42 59 54 45 57 49 |1 << (c |% BYTEWI|
|00003890| 44 54 48 29 3b 0d 09 09 | 7d 0d 09 20 20 20 20 7d |DTH);...|}.. }|
|000038a0| 0d 09 20 20 2f 2a 20 44 | 69 73 63 61 72 64 20 61 |.. /* D|iscard a|
|000038b0| 6e 79 20 62 69 74 6d 61 | 70 20 62 79 74 65 73 20 |ny bitma|p bytes |
|000038c0| 74 68 61 74 20 61 72 65 | 20 61 6c 6c 20 30 20 61 |that are| all 0 a|
|000038d0| 74 20 74 68 65 20 65 6e | 64 20 6f 66 20 74 68 65 |t the en|d of the|
|000038e0| 20 6d 61 70 2e 0d 09 20 | 20 20 20 20 44 65 63 72 | map... | Decr|
|000038f0| 65 6d 65 6e 74 20 74 68 | 65 20 6d 61 70 2d 6c 65 |ement th|e map-le|
|00003900| 6e 67 74 68 20 62 79 74 | 65 20 74 6f 6f 2e 20 2a |ngth byt|e too. *|
|00003910| 2f 0d 09 20 20 77 68 69 | 6c 65 20 28 28 73 68 6f |/.. whi|le ((sho|
|00003920| 72 74 29 20 62 5b 2d 31 | 5d 20 3e 20 30 20 26 26 |rt) b[-1|] > 0 &&|
|00003930| 20 62 5b 62 5b 2d 31 5d | 20 2d 20 31 5d 20 3d 3d | b[b[-1]| - 1] ==|
|00003940| 20 30 29 0d 09 20 20 20 | 20 62 5b 2d 31 5d 2d 2d | 0).. | b[-1]--|
|00003950| 3b 0d 09 20 20 62 20 2b | 3d 20 62 5b 2d 31 5d 3b |;.. b +|= b[-1];|
|00003960| 0d 09 20 20 62 72 65 61 | 6b 3b 0d 0d 09 63 61 73 |.. brea|k;...cas|
|00003970| 65 20 27 28 27 3a 0d 09 | 20 20 69 66 20 28 21 20 |e '(':..| if (! |
|00003980| 28 6f 62 73 63 75 72 65 | 5f 73 79 6e 74 61 78 20 |(obscure|_syntax |
|00003990| 26 20 52 45 5f 4e 4f 5f | 42 4b 5f 50 41 52 45 4e |& RE_NO_|BK_PAREN|
|000039a0| 53 29 29 0d 09 20 20 20 | 20 67 6f 74 6f 20 6e 6f |S)).. | goto no|
|000039b0| 72 6d 61 6c 5f 63 68 61 | 72 3b 0d 09 20 20 65 6c |rmal_cha|r;.. el|
|000039c0| 73 65 0d 09 20 20 20 20 | 67 6f 74 6f 20 68 61 6e |se.. |goto han|
|000039d0| 64 6c 65 5f 6f 70 65 6e | 3b 0d 0d 09 63 61 73 65 |dle_open|;...case|
|000039e0| 20 27 29 27 3a 0d 09 20 | 20 69 66 20 28 21 20 28 | ')':.. | if (! (|
|000039f0| 6f 62 73 63 75 72 65 5f | 73 79 6e 74 61 78 20 26 |obscure_|syntax &|
|00003a00| 20 52 45 5f 4e 4f 5f 42 | 4b 5f 50 41 52 45 4e 53 | RE_NO_B|K_PARENS|
|00003a10| 29 29 0d 09 20 20 20 20 | 67 6f 74 6f 20 6e 6f 72 |)).. |goto nor|
|00003a20| 6d 61 6c 5f 63 68 61 72 | 3b 0d 09 20 20 65 6c 73 |mal_char|;.. els|
|00003a30| 65 0d 09 20 20 20 20 67 | 6f 74 6f 20 68 61 6e 64 |e.. g|oto hand|
|00003a40| 6c 65 5f 63 6c 6f 73 65 | 3b 0d 0d 09 63 61 73 65 |le_close|;...case|
|00003a50| 20 43 52 3a 0d 09 20 20 | 69 66 20 28 21 20 28 6f | CR:.. |if (! (o|
|00003a60| 62 73 63 75 72 65 5f 73 | 79 6e 74 61 78 20 26 20 |bscure_s|yntax & |
|00003a70| 52 45 5f 4e 45 57 4c 49 | 4e 45 5f 4f 52 29 29 0d |RE_NEWLI|NE_OR)).|
|00003a80| 09 20 20 20 20 67 6f 74 | 6f 20 6e 6f 72 6d 61 6c |. got|o normal|
|00003a90| 5f 63 68 61 72 3b 0d 09 | 20 20 65 6c 73 65 0d 09 |_char;..| else..|
|00003aa0| 20 20 20 20 67 6f 74 6f | 20 68 61 6e 64 6c 65 5f | goto| handle_|
|00003ab0| 62 61 72 3b 0d 0d 09 63 | 61 73 65 20 27 7c 27 3a |bar;...c|ase '|':|
|00003ac0| 0d 09 20 20 69 66 20 28 | 21 20 28 6f 62 73 63 75 |.. if (|! (obscu|
|00003ad0| 72 65 5f 73 79 6e 74 61 | 78 20 26 20 52 45 5f 4e |re_synta|x & RE_N|
|00003ae0| 4f 5f 42 4b 5f 56 42 41 | 52 29 29 0d 09 20 20 20 |O_BK_VBA|R)).. |
|00003af0| 20 67 6f 74 6f 20 6e 6f | 72 6d 61 6c 5f 63 68 61 | goto no|rmal_cha|
|00003b00| 72 3b 0d 09 20 20 65 6c | 73 65 0d 09 20 20 20 20 |r;.. el|se.. |
|00003b10| 67 6f 74 6f 20 68 61 6e | 64 6c 65 5f 62 61 72 3b |goto han|dle_bar;|
|00003b20| 0d 0d 20 20 20 20 63 61 | 73 65 20 27 5c 5c 27 3a |.. ca|se '\\':|
|00003b30| 0d 09 20 20 69 66 20 28 | 70 20 3d 3d 20 70 65 6e |.. if (|p == pen|
|00003b40| 64 29 20 67 6f 74 6f 20 | 69 6e 76 61 6c 69 64 5f |d) goto |invalid_|
|00003b50| 70 61 74 74 65 72 6e 3b | 0d 09 20 20 50 41 54 46 |pattern;|.. PATF|
|00003b60| 45 54 43 48 5f 52 41 57 | 20 28 63 29 3b 0d 09 20 |ETCH_RAW| (c);.. |
|00003b70| 20 73 77 69 74 63 68 20 | 28 63 29 0d 09 20 20 20 | switch |(c).. |
|00003b80| 20 7b 0d 09 20 20 20 20 | 63 61 73 65 20 27 28 27 | {.. |case '('|
|00003b90| 3a 0d 09 20 20 20 20 20 | 20 69 66 20 28 6f 62 73 |:.. | if (obs|
|00003ba0| 63 75 72 65 5f 73 79 6e | 74 61 78 20 26 20 52 45 |cure_syn|tax & RE|
|00003bb0| 5f 4e 4f 5f 42 4b 5f 50 | 41 52 45 4e 53 29 0d 09 |_NO_BK_P|ARENS)..|
|00003bc0| 09 67 6f 74 6f 20 6e 6f | 72 6d 61 6c 5f 62 61 63 |.goto no|rmal_bac|
|00003bd0| 6b 73 6c 3b 0d 09 20 20 | 20 20 68 61 6e 64 6c 65 |ksl;.. | handle|
|00003be0| 5f 6f 70 65 6e 3a 0d 09 | 20 20 20 20 20 20 69 66 |_open:..| if|
|00003bf0| 20 28 73 74 61 63 6b 70 | 20 3d 3d 20 73 74 61 63 | (stackp| == stac|
|00003c00| 6b 65 29 20 67 6f 74 6f | 20 6e 65 73 74 69 6e 67 |ke) goto| nesting|
|00003c10| 5f 74 6f 6f 5f 64 65 65 | 70 3b 0d 09 20 20 20 20 |_too_dee|p;.. |
|00003c20| 20 20 69 66 20 28 72 65 | 67 6e 75 6d 20 3c 20 52 | if (re|gnum < R|
|00003c30| 45 5f 4e 52 45 47 53 29 | 0d 09 20 20 20 20 20 20 |E_NREGS)|.. |
|00003c40| 20 20 7b 0d 09 09 20 20 | 50 41 54 50 55 53 48 20 | {... |PATPUSH |
|00003c50| 28 73 74 61 72 74 5f 6d | 65 6d 6f 72 79 29 3b 0d |(start_m|emory);.|
|00003c60| 09 09 20 20 50 41 54 50 | 55 53 48 20 28 72 65 67 |.. PATP|USH (reg|
|00003c70| 6e 75 6d 29 3b 0d 09 20 | 20 20 20 20 20 20 20 7d |num);.. | }|
|00003c80| 0d 09 20 20 20 20 20 20 | 2a 73 74 61 63 6b 70 2b |.. |*stackp+|
|00003c90| 2b 20 3d 20 28 73 68 6f | 72 74 29 28 62 20 2d 20 |+ = (sho|rt)(b - |
|00003ca0| 62 75 66 70 2d 3e 62 75 | 66 66 65 72 29 3b 0d 09 |bufp->bu|ffer);..|
|00003cb0| 20 20 20 20 20 20 2a 73 | 74 61 63 6b 70 2b 2b 20 | *s|tackp++ |
|00003cc0| 3d 20 66 69 78 75 70 5f | 6a 75 6d 70 20 3f 20 28 |= fixup_|jump ? (|
|00003cd0| 73 68 6f 72 74 29 28 66 | 69 78 75 70 5f 6a 75 6d |short)(f|ixup_jum|
|00003ce0| 70 20 2d 20 62 75 66 70 | 2d 3e 62 75 66 66 65 72 |p - bufp|->buffer|
|00003cf0| 29 20 2b 20 31 20 3a 20 | 30 3b 0d 09 20 20 20 20 |) + 1 : |0;.. |
|00003d00| 20 20 2a 73 74 61 63 6b | 70 2b 2b 20 3d 20 72 65 | *stack|p++ = re|
|00003d10| 67 6e 75 6d 2b 2b 3b 0d | 09 20 20 20 20 20 20 2a |gnum++;.|. *|
|00003d20| 73 74 61 63 6b 70 2b 2b | 20 3d 20 28 73 68 6f 72 |stackp++| = (shor|
|00003d30| 74 29 28 62 65 67 61 6c | 74 20 2d 20 62 75 66 70 |t)(begal|t - bufp|
|00003d40| 2d 3e 62 75 66 66 65 72 | 29 3b 0d 09 20 20 20 20 |->buffer|);.. |
|00003d50| 20 20 66 69 78 75 70 5f | 6a 75 6d 70 20 3d 20 30 | fixup_|jump = 0|
|00003d60| 3b 0d 09 20 20 20 20 20 | 20 6c 61 73 74 73 74 61 |;.. | laststa|
|00003d70| 72 74 20 3d 20 30 3b 0d | 09 20 20 20 20 20 20 62 |rt = 0;.|. b|
|00003d80| 65 67 61 6c 74 20 3d 20 | 62 3b 0d 09 20 20 20 20 |egalt = |b;.. |
|00003d90| 20 20 62 72 65 61 6b 3b | 0d 0d 09 20 20 20 20 63 | break;|... c|
|00003da0| 61 73 65 20 27 29 27 3a | 0d 09 20 20 20 20 20 20 |ase ')':|.. |
|00003db0| 69 66 20 28 6f 62 73 63 | 75 72 65 5f 73 79 6e 74 |if (obsc|ure_synt|
|00003dc0| 61 78 20 26 20 52 45 5f | 4e 4f 5f 42 4b 5f 50 41 |ax & RE_|NO_BK_PA|
|00003dd0| 52 45 4e 53 29 0d 09 09 | 67 6f 74 6f 20 6e 6f 72 |RENS)...|goto nor|
|00003de0| 6d 61 6c 5f 62 61 63 6b | 73 6c 3b 0d 09 20 20 20 |mal_back|sl;.. |
|00003df0| 20 68 61 6e 64 6c 65 5f | 63 6c 6f 73 65 3a 0d 09 | handle_|close:..|
|00003e00| 20 20 20 20 20 20 69 66 | 20 28 73 74 61 63 6b 70 | if| (stackp|
|00003e10| 20 3d 3d 20 73 74 61 63 | 6b 62 29 20 67 6f 74 6f | == stac|kb) goto|
|00003e20| 20 75 6e 6d 61 74 63 68 | 65 64 5f 63 6c 6f 73 65 | unmatch|ed_close|
|00003e30| 3b 0d 09 20 20 20 20 20 | 20 62 65 67 61 6c 74 20 |;.. | begalt |
|00003e40| 3d 20 2a 2d 2d 73 74 61 | 63 6b 70 20 2b 20 62 75 |= *--sta|ckp + bu|
|00003e50| 66 70 2d 3e 62 75 66 66 | 65 72 3b 0d 09 20 20 20 |fp->buff|er;.. |
|00003e60| 20 20 20 69 66 20 28 66 | 69 78 75 70 5f 6a 75 6d | if (f|ixup_jum|
|00003e70| 70 29 0d 09 09 73 74 6f | 72 65 5f 6a 75 6d 70 20 |p)...sto|re_jump |
|00003e80| 28 66 69 78 75 70 5f 6a | 75 6d 70 2c 20 6a 75 6d |(fixup_j|ump, jum|
|00003e90| 70 2c 20 62 29 3b 0d 09 | 20 20 20 20 20 20 69 66 |p, b);..| if|
|00003ea0| 20 28 73 74 61 63 6b 70 | 5b 2d 31 5d 20 3c 20 52 | (stackp|[-1] < R|
|00003eb0| 45 5f 4e 52 45 47 53 29 | 0d 09 09 7b 0d 09 09 20 |E_NREGS)|...{... |
|00003ec0| 20 50 41 54 50 55 53 48 | 20 28 73 74 6f 70 5f 6d | PATPUSH| (stop_m|
|00003ed0| 65 6d 6f 72 79 29 3b 0d | 09 09 20 20 50 41 54 50 |emory);.|.. PATP|
|00003ee0| 55 53 48 20 28 73 74 61 | 63 6b 70 5b 2d 31 5d 29 |USH (sta|ckp[-1])|
|00003ef0| 3b 0d 09 09 7d 0d 09 20 | 20 20 20 20 20 73 74 61 |;...}.. | sta|
|00003f00| 63 6b 70 20 2d 3d 20 32 | 3b 0d 09 20 20 20 20 20 |ckp -= 2|;.. |
|00003f10| 20 66 69 78 75 70 5f 6a | 75 6d 70 20 3d 20 30 3b | fixup_j|ump = 0;|
|00003f20| 0d 09 20 20 20 20 20 20 | 69 66 20 28 2a 73 74 61 |.. |if (*sta|
|00003f30| 63 6b 70 29 0d 09 09 66 | 69 78 75 70 5f 6a 75 6d |ckp)...f|ixup_jum|
|00003f40| 70 20 3d 20 2a 73 74 61 | 63 6b 70 20 2b 20 62 75 |p = *sta|ckp + bu|
|00003f50| 66 70 2d 3e 62 75 66 66 | 65 72 20 2d 20 31 3b 0d |fp->buff|er - 1;.|
|00003f60| 09 20 20 20 20 20 20 6c | 61 73 74 73 74 61 72 74 |. l|aststart|
|00003f70| 20 3d 20 2a 2d 2d 73 74 | 61 63 6b 70 20 2b 20 62 | = *--st|ackp + b|
|00003f80| 75 66 70 2d 3e 62 75 66 | 66 65 72 3b 0d 09 20 20 |ufp->buf|fer;.. |
|00003f90| 20 20 20 20 62 72 65 61 | 6b 3b 0d 0d 09 20 20 20 | brea|k;... |
|00003fa0| 20 63 61 73 65 20 27 7c | 27 3a 0d 09 20 20 20 20 | case '||':.. |
|00003fb0| 20 20 69 66 20 28 6f 62 | 73 63 75 72 65 5f 73 79 | if (ob|scure_sy|
|00003fc0| 6e 74 61 78 20 26 20 52 | 45 5f 4e 4f 5f 42 4b 5f |ntax & R|E_NO_BK_|
|00003fd0| 56 42 41 52 29 0d 09 09 | 67 6f 74 6f 20 6e 6f 72 |VBAR)...|goto nor|
|00003fe0| 6d 61 6c 5f 62 61 63 6b | 73 6c 3b 0d 09 20 20 20 |mal_back|sl;.. |
|00003ff0| 20 68 61 6e 64 6c 65 5f | 62 61 72 3a 0d 09 20 20 | handle_|bar:.. |
|00004000| 20 20 20 20 69 6e 73 65 | 72 74 5f 6a 75 6d 70 20 | inse|rt_jump |
|00004010| 28 6f 6e 5f 66 61 69 6c | 75 72 65 5f 6a 75 6d 70 |(on_fail|ure_jump|
|00004020| 2c 20 62 65 67 61 6c 74 | 2c 20 62 20 2b 20 36 2c |, begalt|, b + 6,|
|00004030| 20 62 29 3b 0d 09 20 20 | 20 20 20 20 70 65 6e 64 | b);.. | pend|
|00004040| 69 6e 67 5f 65 78 61 63 | 74 20 3d 20 30 3b 0d 09 |ing_exac|t = 0;..|
|00004050| 20 20 20 20 20 20 62 20 | 2b 3d 20 33 3b 0d 09 20 | b |+= 3;.. |
|00004060| 20 20 20 20 20 69 66 20 | 28 66 69 78 75 70 5f 6a | if |(fixup_j|
|00004070| 75 6d 70 29 0d 09 09 73 | 74 6f 72 65 5f 6a 75 6d |ump)...s|tore_jum|
|00004080| 70 20 28 66 69 78 75 70 | 5f 6a 75 6d 70 2c 20 6a |p (fixup|_jump, j|
|00004090| 75 6d 70 2c 20 62 29 3b | 0d 09 20 20 20 20 20 20 |ump, b);|.. |
|000040a0| 66 69 78 75 70 5f 6a 75 | 6d 70 20 3d 20 62 3b 0d |fixup_ju|mp = b;.|
|000040b0| 09 20 20 20 20 20 20 62 | 20 2b 3d 20 33 3b 0d 09 |. b| += 3;..|
|000040c0| 20 20 20 20 20 20 6c 61 | 73 74 73 74 61 72 74 20 | la|ststart |
|000040d0| 3d 20 30 3b 0d 09 20 20 | 20 20 20 20 62 65 67 61 |= 0;.. | bega|
|000040e0| 6c 74 20 3d 20 62 3b 0d | 09 20 20 20 20 20 20 62 |lt = b;.|. b|
|000040f0| 72 65 61 6b 3b 0d 0d 23 | 69 66 64 65 66 20 65 6d |reak;..#|ifdef em|
|00004100| 61 63 73 0d 09 20 20 20 | 20 63 61 73 65 20 27 3d |acs.. | case '=|
|00004110| 27 3a 0d 09 20 20 20 20 | 20 20 50 41 54 50 55 53 |':.. | PATPUS|
|00004120| 48 20 28 61 74 5f 64 6f | 74 29 3b 0d 09 20 20 20 |H (at_do|t);.. |
|00004130| 20 20 20 62 72 65 61 6b | 3b 0d 0d 09 20 20 20 20 | break|;... |
|00004140| 63 61 73 65 20 27 73 27 | 3a 09 0d 09 20 20 20 20 |case 's'|:... |
|00004150| 20 20 6c 61 73 74 73 74 | 61 72 74 20 3d 20 62 3b | lastst|art = b;|
|00004160| 0d 09 20 20 20 20 20 20 | 50 41 54 50 55 53 48 20 |.. |PATPUSH |
|00004170| 28 73 79 6e 74 61 78 73 | 70 65 63 29 3b 0d 09 20 |(syntaxs|pec);.. |
|00004180| 20 20 20 20 20 50 41 54 | 46 45 54 43 48 20 28 63 | PAT|FETCH (c|
|00004190| 29 3b 0d 09 20 20 20 20 | 20 20 50 41 54 50 55 53 |);.. | PATPUS|
|000041a0| 48 20 28 73 79 6e 74 61 | 78 5f 73 70 65 63 5f 63 |H (synta|x_spec_c|
|000041b0| 6f 64 65 5b 63 5d 29 3b | 0d 09 20 20 20 20 20 20 |ode[c]);|.. |
|000041c0| 62 72 65 61 6b 3b 0d 0d | 09 20 20 20 20 63 61 73 |break;..|. cas|
|000041d0| 65 20 27 53 27 3a 0d 09 | 20 20 20 20 20 20 6c 61 |e 'S':..| la|
|000041e0| 73 74 73 74 61 72 74 20 | 3d 20 62 3b 0d 09 20 20 |ststart |= b;.. |
|000041f0| 20 20 20 20 50 41 54 50 | 55 53 48 20 28 6e 6f 74 | PATP|USH (not|
|00004200| 73 79 6e 74 61 78 73 70 | 65 63 29 3b 0d 09 20 20 |syntaxsp|ec);.. |
|00004210| 20 20 20 20 50 41 54 46 | 45 54 43 48 20 28 63 29 | PATF|ETCH (c)|
|00004220| 3b 0d 09 20 20 20 20 20 | 20 50 41 54 50 55 53 48 |;.. | PATPUSH|
|00004230| 20 28 73 79 6e 74 61 78 | 5f 73 70 65 63 5f 63 6f | (syntax|_spec_co|
|00004240| 64 65 5b 63 5d 29 3b 0d | 09 20 20 20 20 20 20 62 |de[c]);.|. b|
|00004250| 72 65 61 6b 3b 0d 23 65 | 6e 64 69 66 20 2f 2a 20 |reak;.#e|ndif /* |
|00004260| 65 6d 61 63 73 20 2a 2f | 0d 0d 09 20 20 20 20 63 |emacs */|... c|
|00004270| 61 73 65 20 27 77 27 3a | 0d 09 20 20 20 20 20 20 |ase 'w':|.. |
|00004280| 6c 61 73 74 73 74 61 72 | 74 20 3d 20 62 3b 0d 09 |laststar|t = b;..|
|00004290| 20 20 20 20 20 20 50 41 | 54 50 55 53 48 20 28 77 | PA|TPUSH (w|
|000042a0| 6f 72 64 63 68 61 72 29 | 3b 0d 09 20 20 20 20 20 |ordchar)|;.. |
|000042b0| 20 62 72 65 61 6b 3b 0d | 0d 09 20 20 20 20 63 61 | break;.|.. ca|
|000042c0| 73 65 20 27 57 27 3a 0d | 09 20 20 20 20 20 20 6c |se 'W':.|. l|
|000042d0| 61 73 74 73 74 61 72 74 | 20 3d 20 62 3b 0d 09 20 |aststart| = b;.. |
|000042e0| 20 20 20 20 20 50 41 54 | 50 55 53 48 20 28 6e 6f | PAT|PUSH (no|
|000042f0| 74 77 6f 72 64 63 68 61 | 72 29 3b 0d 09 20 20 20 |twordcha|r);.. |
|00004300| 20 20 20 62 72 65 61 6b | 3b 0d 0d 09 20 20 20 20 | break|;... |
|00004310| 63 61 73 65 20 27 3c 27 | 3a 0d 09 20 20 20 20 20 |case '<'|:.. |
|00004320| 20 50 41 54 50 55 53 48 | 20 28 77 6f 72 64 62 65 | PATPUSH| (wordbe|
|00004330| 67 29 3b 0d 09 20 20 20 | 20 20 20 62 72 65 61 6b |g);.. | break|
|00004340| 3b 0d 0d 09 20 20 20 20 | 63 61 73 65 20 27 3e 27 |;... |case '>'|
|00004350| 3a 0d 09 20 20 20 20 20 | 20 50 41 54 50 55 53 48 |:.. | PATPUSH|
|00004360| 20 28 77 6f 72 64 65 6e | 64 29 3b 0d 09 20 20 20 | (worden|d);.. |
|00004370| 20 20 20 62 72 65 61 6b | 3b 0d 0d 09 20 20 20 20 | break|;... |
|00004380| 63 61 73 65 20 27 62 27 | 3a 0d 09 20 20 20 20 20 |case 'b'|:.. |
|00004390| 20 50 41 54 50 55 53 48 | 20 28 77 6f 72 64 62 6f | PATPUSH| (wordbo|
|000043a0| 75 6e 64 29 3b 0d 09 20 | 20 20 20 20 20 62 72 65 |und);.. | bre|
|000043b0| 61 6b 3b 0d 0d 09 20 20 | 20 20 63 61 73 65 20 27 |ak;... | case '|
|000043c0| 42 27 3a 0d 09 20 20 20 | 20 20 20 50 41 54 50 55 |B':.. | PATPU|
|000043d0| 53 48 20 28 6e 6f 74 77 | 6f 72 64 62 6f 75 6e 64 |SH (notw|ordbound|
|000043e0| 29 3b 0d 09 20 20 20 20 | 20 20 62 72 65 61 6b 3b |);.. | break;|
|000043f0| 0d 0d 09 20 20 20 20 63 | 61 73 65 20 27 60 27 3a |... c|ase '`':|
|00004400| 0d 09 20 20 20 20 20 20 | 50 41 54 50 55 53 48 20 |.. |PATPUSH |
|00004410| 28 62 65 67 62 75 66 29 | 3b 0d 09 20 20 20 20 20 |(begbuf)|;.. |
|00004420| 20 62 72 65 61 6b 3b 0d | 0d 09 20 20 20 20 63 61 | break;.|.. ca|
|00004430| 73 65 20 27 5c 27 27 3a | 0d 09 20 20 20 20 20 20 |se '\'':|.. |
|00004440| 50 41 54 50 55 53 48 20 | 28 65 6e 64 62 75 66 29 |PATPUSH |(endbuf)|
|00004450| 3b 0d 09 20 20 20 20 20 | 20 62 72 65 61 6b 3b 0d |;.. | break;.|
|00004460| 0d 09 20 20 20 20 63 61 | 73 65 20 27 31 27 3a 0d |.. ca|se '1':.|
|00004470| 09 20 20 20 20 63 61 73 | 65 20 27 32 27 3a 0d 09 |. cas|e '2':..|
|00004480| 20 20 20 20 63 61 73 65 | 20 27 33 27 3a 0d 09 20 | case| '3':.. |
|00004490| 20 20 20 63 61 73 65 20 | 27 34 27 3a 0d 09 20 20 | case |'4':.. |
|000044a0| 20 20 63 61 73 65 20 27 | 35 27 3a 0d 09 20 20 20 | case '|5':.. |
|000044b0| 20 63 61 73 65 20 27 36 | 27 3a 0d 09 20 20 20 20 | case '6|':.. |
|000044c0| 63 61 73 65 20 27 37 27 | 3a 0d 09 20 20 20 20 63 |case '7'|:.. c|
|000044d0| 61 73 65 20 27 38 27 3a | 0d 09 20 20 20 20 63 61 |ase '8':|.. ca|
|000044e0| 73 65 20 27 39 27 3a 0d | 09 20 20 20 20 20 20 63 |se '9':.|. c|
|000044f0| 31 20 3d 20 63 20 2d 20 | 27 30 27 3b 0d 09 20 20 |1 = c - |'0';.. |
|00004500| 20 20 20 20 69 66 20 28 | 63 31 20 3e 3d 20 72 65 | if (|c1 >= re|
|00004510| 67 6e 75 6d 29 0d 09 09 | 67 6f 74 6f 20 6e 6f 72 |gnum)...|goto nor|
|00004520| 6d 61 6c 5f 63 68 61 72 | 3b 0d 09 20 20 20 20 20 |mal_char|;.. |
|00004530| 20 66 6f 72 20 28 73 74 | 61 63 6b 74 20 3d 20 73 | for (st|ackt = s|
|00004540| 74 61 63 6b 70 20 2d 20 | 32 3b 20 20 73 74 61 63 |tackp - |2; stac|
|00004550| 6b 74 20 3e 20 73 74 61 | 63 6b 62 3b 20 20 73 74 |kt > sta|ckb; st|
|00004560| 61 63 6b 74 20 2d 3d 20 | 34 29 0d 20 09 09 69 66 |ackt -= |4). ..if|
|00004570| 20 28 2a 73 74 61 63 6b | 74 20 3d 3d 20 63 31 29 | (*stack|t == c1)|
|00004580| 0d 09 09 20 20 67 6f 74 | 6f 20 6e 6f 72 6d 61 6c |... got|o normal|
|00004590| 5f 63 68 61 72 3b 0d 09 | 20 20 20 20 20 20 6c 61 |_char;..| la|
|000045a0| 73 74 73 74 61 72 74 20 | 3d 20 62 3b 0d 09 20 20 |ststart |= b;.. |
|000045b0| 20 20 20 20 50 41 54 50 | 55 53 48 20 28 64 75 70 | PATP|USH (dup|
|000045c0| 6c 69 63 61 74 65 29 3b | 0d 09 20 20 20 20 20 20 |licate);|.. |
|000045d0| 50 41 54 50 55 53 48 20 | 28 63 31 29 3b 0d 09 20 |PATPUSH |(c1);.. |
|000045e0| 20 20 20 20 20 62 72 65 | 61 6b 3b 0d 0d 09 20 20 | bre|ak;... |
|000045f0| 20 20 63 61 73 65 20 27 | 2b 27 3a 0d 09 20 20 20 | case '|+':.. |
|00004600| 20 63 61 73 65 20 27 3f | 27 3a 0d 09 20 20 20 20 | case '?|':.. |
|00004610| 20 20 69 66 20 28 6f 62 | 73 63 75 72 65 5f 73 79 | if (ob|scure_sy|
|00004620| 6e 74 61 78 20 26 20 52 | 45 5f 42 4b 5f 50 4c 55 |ntax & R|E_BK_PLU|
|00004630| 53 5f 51 4d 29 0d 09 09 | 67 6f 74 6f 20 68 61 6e |S_QM)...|goto han|
|00004640| 64 6c 65 5f 70 6c 75 73 | 3b 0d 0d 09 20 20 20 20 |dle_plus|;... |
|00004650| 64 65 66 61 75 6c 74 3a | 0d 09 20 20 20 20 6e 6f |default:|.. no|
|00004660| 72 6d 61 6c 5f 62 61 63 | 6b 73 6c 3a 0d 09 20 20 |rmal_bac|ksl:.. |
|00004670| 20 20 20 20 2f 2a 20 59 | 6f 75 20 6d 69 67 68 74 | /* Y|ou might|
|00004680| 20 74 68 69 6e 6b 20 69 | 74 20 77 6f 75 6c 64 20 | think i|t would |
|00004690| 62 65 20 75 73 65 66 75 | 6c 20 66 6f 72 20 5c 20 |be usefu|l for \ |
|000046a0| 74 6f 20 6d 65 61 6e 0d | 09 09 20 6e 6f 74 20 74 |to mean.|.. not t|
|000046b0| 6f 20 74 72 61 6e 73 6c | 61 74 65 3b 20 62 75 74 |o transl|ate; but|
|000046c0| 20 69 66 20 77 65 20 64 | 6f 6e 27 74 20 74 72 61 | if we d|on't tra|
|000046d0| 6e 73 6c 61 74 65 20 69 | 74 0d 09 09 20 69 74 20 |nslate i|t... it |
|000046e0| 77 69 6c 6c 20 6e 65 76 | 65 72 20 6d 61 74 63 68 |will nev|er match|
|000046f0| 20 61 6e 79 74 68 69 6e | 67 2e 20 20 2a 2f 0d 09 | anythin|g. */..|
|00004700| 20 20 20 20 20 20 69 66 | 20 28 74 72 61 6e 73 6c | if| (transl|
|00004710| 61 74 65 29 20 63 20 3d | 20 74 72 61 6e 73 6c 61 |ate) c =| transla|
|00004720| 74 65 5b 63 5d 3b 0d 09 | 20 20 20 20 20 20 67 6f |te[c];..| go|
|00004730| 74 6f 20 6e 6f 72 6d 61 | 6c 5f 63 68 61 72 3b 0d |to norma|l_char;.|
|00004740| 09 20 20 20 20 7d 0d 09 | 20 20 62 72 65 61 6b 3b |. }..| break;|
|00004750| 0d 0d 09 64 65 66 61 75 | 6c 74 3a 0d 09 6e 6f 72 |...defau|lt:..nor|
|00004760| 6d 61 6c 5f 63 68 61 72 | 3a 0d 09 20 20 69 66 20 |mal_char|:.. if |
|00004770| 28 21 70 65 6e 64 69 6e | 67 5f 65 78 61 63 74 20 |(!pendin|g_exact |
|00004780| 7c 7c 20 70 65 6e 64 69 | 6e 67 5f 65 78 61 63 74 ||| pendi|ng_exact|
|00004790| 20 2b 20 2a 70 65 6e 64 | 69 6e 67 5f 65 78 61 63 | + *pend|ing_exac|
|000047a0| 74 20 2b 20 31 20 21 3d | 20 62 0d 09 20 20 20 20 |t + 1 !=| b.. |
|000047b0| 20 20 7c 7c 20 2a 70 65 | 6e 64 69 6e 67 5f 65 78 | || *pe|nding_ex|
|000047c0| 61 63 74 20 3d 3d 20 30 | 31 37 37 20 7c 7c 20 2a |act == 0|177 || *|
|000047d0| 70 20 3d 3d 20 27 2a 27 | 20 7c 7c 20 2a 70 20 3d |p == '*'| || *p =|
|000047e0| 3d 20 27 5e 27 0d 09 20 | 20 20 20 20 20 7c 7c 20 |= '^'.. | || |
|000047f0| 28 28 6f 62 73 63 75 72 | 65 5f 73 79 6e 74 61 78 |((obscur|e_syntax|
|00004800| 20 26 20 52 45 5f 42 4b | 5f 50 4c 55 53 5f 51 4d | & RE_BK|_PLUS_QM|
|00004810| 29 0d 09 09 20 20 3f 20 | 2a 70 20 3d 3d 20 27 5c |)... ? |*p == '\|
|00004820| 5c 27 20 26 26 20 28 70 | 5b 31 5d 20 3d 3d 20 27 |\' && (p|[1] == '|
|00004830| 2b 27 20 7c 7c 20 70 5b | 31 5d 20 3d 3d 20 27 3f |+' || p[|1] == '?|
|00004840| 27 29 0d 09 09 20 20 3a | 20 28 2a 70 20 3d 3d 20 |')... :| (*p == |
|00004850| 27 2b 27 20 7c 7c 20 2a | 70 20 3d 3d 20 27 3f 27 |'+' || *|p == '?'|
|00004860| 29 29 29 0d 09 20 20 20 | 20 7b 0d 09 20 20 20 20 |))).. | {.. |
|00004870| 20 20 6c 61 73 74 73 74 | 61 72 74 20 3d 20 62 3b | lastst|art = b;|
|00004880| 0d 09 20 20 20 20 20 20 | 50 41 54 50 55 53 48 20 |.. |PATPUSH |
|00004890| 28 65 78 61 63 74 6e 29 | 3b 0d 09 20 20 20 20 20 |(exactn)|;.. |
|000048a0| 20 70 65 6e 64 69 6e 67 | 5f 65 78 61 63 74 20 3d | pending|_exact =|
|000048b0| 20 62 3b 0d 09 20 20 20 | 20 20 20 50 41 54 50 55 | b;.. | PATPU|
|000048c0| 53 48 20 28 30 29 3b 0d | 09 20 20 20 20 7d 0d 09 |SH (0);.|. }..|
|000048d0| 20 20 50 41 54 50 55 53 | 48 20 28 63 29 3b 0d 09 | PATPUS|H (c);..|
|000048e0| 20 20 28 2a 70 65 6e 64 | 69 6e 67 5f 65 78 61 63 | (*pend|ing_exac|
|000048f0| 74 29 2b 2b 3b 0d 09 7d | 0d 20 20 20 20 7d 0d 0d |t)++;..}|. }..|
|00004900| 20 20 69 66 20 28 66 69 | 78 75 70 5f 6a 75 6d 70 | if (fi|xup_jump|
|00004910| 29 0d 20 20 20 20 73 74 | 6f 72 65 5f 6a 75 6d 70 |). st|ore_jump|
|00004920| 20 28 66 69 78 75 70 5f | 6a 75 6d 70 2c 20 6a 75 | (fixup_|jump, ju|
|00004930| 6d 70 2c 20 62 29 3b 0d | 0d 20 20 69 66 20 28 73 |mp, b);.|. if (s|
|00004940| 74 61 63 6b 70 20 21 3d | 20 73 74 61 63 6b 62 29 |tackp !=| stackb)|
|00004950| 20 67 6f 74 6f 20 75 6e | 6d 61 74 63 68 65 64 5f | goto un|matched_|
|00004960| 6f 70 65 6e 3b 0d 0d 20 | 20 62 75 66 70 2d 3e 75 |open;.. | bufp->u|
|00004970| 73 65 64 20 3d 20 62 20 | 2d 20 62 75 66 70 2d 3e |sed = b |- bufp->|
|00004980| 62 75 66 66 65 72 3b 0d | 20 20 72 65 74 75 72 6e |buffer;.| return|
|00004990| 20 30 3b 0d 0d 20 69 6e | 76 61 6c 69 64 5f 70 61 | 0;.. in|valid_pa|
|000049a0| 74 74 65 72 6e 3a 0d 20 | 20 72 65 74 75 72 6e 20 |ttern:. | return |
|000049b0| 22 49 6e 76 61 6c 69 64 | 20 72 65 67 75 6c 61 72 |"Invalid| regular|
|000049c0| 20 65 78 70 72 65 73 73 | 69 6f 6e 22 3b 0d 0d 20 | express|ion";.. |
|000049d0| 75 6e 6d 61 74 63 68 65 | 64 5f 6f 70 65 6e 3a 0d |unmatche|d_open:.|
|000049e0| 20 20 72 65 74 75 72 6e | 20 22 55 6e 6d 61 74 63 | return| "Unmatc|
|000049f0| 68 65 64 20 5c 5c 28 22 | 3b 0d 0d 20 75 6e 6d 61 |hed \\("|;.. unma|
|00004a00| 74 63 68 65 64 5f 63 6c | 6f 73 65 3a 0d 20 20 72 |tched_cl|ose:. r|
|00004a10| 65 74 75 72 6e 20 22 55 | 6e 6d 61 74 63 68 65 64 |eturn "U|nmatched|
|00004a20| 20 5c 5c 29 22 3b 0d 0d | 20 65 6e 64 5f 6f 66 5f | \\)";..| end_of_|
|00004a30| 70 61 74 74 65 72 6e 3a | 0d 20 20 72 65 74 75 72 |pattern:|. retur|
|00004a40| 6e 20 22 50 72 65 6d 61 | 74 75 72 65 20 65 6e 64 |n "Prema|ture end|
|00004a50| 20 6f 66 20 72 65 67 75 | 6c 61 72 20 65 78 70 72 | of regu|lar expr|
|00004a60| 65 73 73 69 6f 6e 22 3b | 0d 0d 20 6e 65 73 74 69 |ession";|.. nesti|
|00004a70| 6e 67 5f 74 6f 6f 5f 64 | 65 65 70 3a 0d 20 20 72 |ng_too_d|eep:. r|
|00004a80| 65 74 75 72 6e 20 22 4e | 65 73 74 69 6e 67 20 74 |eturn "N|esting t|
|00004a90| 6f 6f 20 64 65 65 70 22 | 3b 0d 0d 20 74 6f 6f 5f |oo deep"|;.. too_|
|00004aa0| 62 69 67 3a 0d 20 20 72 | 65 74 75 72 6e 20 22 52 |big:. r|eturn "R|
|00004ab0| 65 67 75 6c 61 72 20 65 | 78 70 72 65 73 73 69 6f |egular e|xpressio|
|00004ac0| 6e 20 74 6f 6f 20 62 69 | 67 22 3b 0d 0d 20 6d 65 |n too bi|g";.. me|
|00004ad0| 6d 6f 72 79 5f 65 78 68 | 61 75 73 74 65 64 3a 0d |mory_exh|austed:.|
|00004ae0| 20 20 72 65 74 75 72 6e | 20 22 4d 65 6d 6f 72 79 | return| "Memory|
|00004af0| 20 65 78 68 61 75 73 74 | 65 64 22 3b 0d 7d 0d 0d | exhaust|ed";.}..|
|00004b00| 2f 2a 20 53 74 6f 72 65 | 20 77 68 65 72 65 20 60 |/* Store| where `|
|00004b10| 66 72 6f 6d 27 20 70 6f | 69 6e 74 73 20 61 20 6a |from' po|ints a j|
|00004b20| 75 6d 70 20 6f 70 65 72 | 61 74 69 6f 6e 20 74 6f |ump oper|ation to|
|00004b30| 20 6a 75 6d 70 20 74 6f | 20 77 68 65 72 65 20 60 | jump to| where `|
|00004b40| 74 6f 27 20 70 6f 69 6e | 74 73 2e 0d 20 20 60 6f |to' poin|ts.. `o|
|00004b50| 70 63 6f 64 65 27 20 69 | 73 20 74 68 65 20 6f 70 |pcode' i|s the op|
|00004b60| 63 6f 64 65 20 74 6f 20 | 73 74 6f 72 65 2e 20 2a |code to |store. *|
|00004b70| 2f 0d 0d 73 74 61 74 69 | 63 20 73 68 6f 72 74 0d |/..stati|c short.|
|00004b80| 73 74 6f 72 65 5f 6a 75 | 6d 70 28 63 68 61 72 20 |store_ju|mp(char |
|00004b90| 2a 66 72 6f 6d 2c 63 68 | 61 72 20 6f 70 63 6f 64 |*from,ch|ar opcod|
|00004ba0| 65 2c 63 68 61 72 20 2a | 74 6f 29 0d 7b 0d 20 20 |e,char *|to).{. |
|00004bb0| 66 72 6f 6d 5b 30 5d 20 | 3d 20 6f 70 63 6f 64 65 |from[0] |= opcode|
|00004bc0| 3b 0d 20 20 66 72 6f 6d | 5b 31 5d 20 3d 20 28 74 |;. from|[1] = (t|
|00004bd0| 6f 20 2d 20 28 66 72 6f | 6d 20 2b 20 33 29 29 20 |o - (fro|m + 3)) |
|00004be0| 26 20 30 33 37 37 3b 0d | 20 20 66 72 6f 6d 5b 32 |& 0377;.| from[2|
|00004bf0| 5d 20 3d 20 28 74 6f 20 | 2d 20 28 66 72 6f 6d 20 |] = (to |- (from |
|00004c00| 2b 20 33 29 29 20 3e 3e | 20 38 3b 0d 7d 0d 0d 2f |+ 3)) >>| 8;.}../|
|00004c10| 2a 20 4f 70 65 6e 20 75 | 70 20 73 70 61 63 65 20 |* Open u|p space |
|00004c20| 61 74 20 63 68 61 72 20 | 46 52 4f 4d 2c 20 61 6e |at char |FROM, an|
|00004c30| 64 20 69 6e 73 65 72 74 | 20 74 68 65 72 65 20 61 |d insert| there a|
|00004c40| 20 6a 75 6d 70 20 74 6f | 20 54 4f 2e 0d 20 20 20 | jump to| TO.. |
|00004c50| 43 55 52 52 45 4e 54 5f | 45 4e 44 20 67 69 76 65 |CURRENT_|END give|
|00004c60| 73 20 74 65 20 65 6e 64 | 20 6f 66 20 74 68 65 20 |s te end| of the |
|00004c70| 73 74 6f 72 61 67 65 20 | 6e 6f 20 69 6e 20 75 73 |storage |no in us|
|00004c80| 65 2c 0d 20 20 20 73 6f | 20 77 65 20 6b 6e 6f 77 |e,. so| we know|
|00004c90| 20 68 6f 77 20 6d 75 63 | 68 20 64 61 74 61 20 74 | how muc|h data t|
|00004ca0| 6f 20 63 6f 70 79 20 75 | 70 2e 0d 20 20 20 4f 50 |o copy u|p.. OP|
|00004cb0| 20 69 73 20 74 68 65 20 | 6f 70 63 6f 64 65 20 6f | is the |opcode o|
|00004cc0| 66 20 74 68 65 20 6a 75 | 6d 70 20 74 6f 20 69 6e |f the ju|mp to in|
|00004cd0| 73 65 72 74 2e 0d 0d 20 | 20 20 49 66 20 79 6f 75 |sert... | If you|
|00004ce0| 20 63 61 6c 6c 20 74 68 | 69 73 20 66 75 6e 63 74 | call th|is funct|
|00004cf0| 69 6f 6e 2c 20 79 6f 75 | 20 6d 75 73 74 20 7a 65 |ion, you| must ze|
|00004d00| 72 6f 20 6f 75 74 20 70 | 65 6e 64 69 6e 67 5f 65 |ro out p|ending_e|
|00004d10| 78 61 63 74 2e 20 20 2a | 2f 0d 0d 73 74 61 74 69 |xact. *|/..stati|
|00004d20| 63 20 73 68 6f 72 74 0d | 69 6e 73 65 72 74 5f 6a |c short.|insert_j|
|00004d30| 75 6d 70 28 63 68 61 72 | 20 6f 70 2c 63 68 61 72 |ump(char| op,char|
|00004d40| 20 2a 66 72 6f 6d 2c 63 | 68 61 72 20 2a 74 6f 2c | *from,c|har *to,|
|00004d50| 63 68 61 72 20 2a 63 75 | 72 72 65 6e 74 5f 65 6e |char *cu|rrent_en|
|00004d60| 64 29 0d 7b 0d 20 20 72 | 65 67 69 73 74 65 72 20 |d).{. r|egister |
|00004d70| 63 68 61 72 20 2a 70 74 | 6f 20 3d 20 63 75 72 72 |char *pt|o = curr|
|00004d80| 65 6e 74 5f 65 6e 64 20 | 2b 20 33 3b 0d 20 20 72 |ent_end |+ 3;. r|
|00004d90| 65 67 69 73 74 65 72 20 | 63 68 61 72 20 2a 70 66 |egister |char *pf|
|00004da0| 72 6f 6d 20 3d 20 63 75 | 72 72 65 6e 74 5f 65 6e |rom = cu|rrent_en|
|00004db0| 64 3b 0d 20 20 77 68 69 | 6c 65 20 28 70 66 72 6f |d;. whi|le (pfro|
|00004dc0| 6d 20 21 3d 20 66 72 6f | 6d 29 0d 20 20 20 20 2a |m != fro|m). *|
|00004dd0| 2d 2d 70 74 6f 20 3d 20 | 2a 2d 2d 70 66 72 6f 6d |--pto = |*--pfrom|
|00004de0| 3b 0d 20 20 73 74 6f 72 | 65 5f 6a 75 6d 70 20 28 |;. stor|e_jump (|
|00004df0| 66 72 6f 6d 2c 20 6f 70 | 2c 20 74 6f 29 3b 0d 7d |from, op|, to);.}|
|00004e00| 0d 0d 2f 2a 20 47 69 76 | 65 6e 20 61 20 70 61 74 |../* Giv|en a pat|
|00004e10| 74 65 72 6e 2c 20 63 6f | 6d 70 75 74 65 20 61 20 |tern, co|mpute a |
|00004e20| 66 61 73 74 6d 61 70 20 | 66 72 6f 6d 20 69 74 2e |fastmap |from it.|
|00004e30| 0d 20 54 68 65 20 66 61 | 73 74 6d 61 70 20 72 65 |. The fa|stmap re|
|00004e40| 63 6f 72 64 73 20 77 68 | 69 63 68 20 6f 66 20 74 |cords wh|ich of t|
|00004e50| 68 65 20 28 31 20 3c 3c | 20 42 59 54 45 57 49 44 |he (1 <<| BYTEWID|
|00004e60| 54 48 29 20 70 6f 73 73 | 69 62 6c 65 20 63 68 61 |TH) poss|ible cha|
|00004e70| 72 61 63 74 65 72 73 0d | 20 63 61 6e 20 73 74 61 |racters.| can sta|
|00004e80| 72 74 20 61 20 73 74 72 | 69 6e 67 20 74 68 61 74 |rt a str|ing that|
|00004e90| 20 6d 61 74 63 68 65 73 | 20 74 68 65 20 70 61 74 | matches| the pat|
|00004ea0| 74 65 72 6e 2e 0d 20 54 | 68 69 73 20 66 61 73 74 |tern.. T|his fast|
|00004eb0| 6d 61 70 20 69 73 20 75 | 73 65 64 20 62 79 20 72 |map is u|sed by r|
|00004ec0| 65 5f 73 65 61 72 63 68 | 20 74 6f 20 73 6b 69 70 |e_search| to skip|
|00004ed0| 20 71 75 69 63 6b 6c 79 | 20 6f 76 65 72 20 74 6f | quickly| over to|
|00004ee0| 74 61 6c 6c 79 20 69 6d | 70 6c 61 75 73 69 62 6c |tally im|plausibl|
|00004ef0| 65 20 74 65 78 74 2e 0d | 0d 20 54 68 65 20 63 61 |e text..|. The ca|
|00004f00| 6c 6c 65 72 20 6d 75 73 | 74 20 73 75 70 70 6c 79 |ller mus|t supply|
|00004f10| 20 74 68 65 20 61 64 64 | 72 65 73 73 20 6f 66 20 | the add|ress of |
|00004f20| 61 20 28 31 20 3c 3c 20 | 42 59 54 45 57 49 44 54 |a (1 << |BYTEWIDT|
|00004f30| 48 29 2d 62 79 74 65 20 | 64 61 74 61 20 61 72 65 |H)-byte |data are|
|00004f40| 61 0d 20 61 73 20 62 75 | 66 70 2d 3e 66 61 73 74 |a. as bu|fp->fast|
|00004f50| 6d 61 70 2e 0d 20 54 68 | 65 20 6f 74 68 65 72 20 |map.. Th|e other |
|00004f60| 63 6f 6d 70 6f 6e 65 6e | 74 73 20 6f 66 20 62 75 |componen|ts of bu|
|00004f70| 66 70 20 64 65 73 63 72 | 69 62 65 20 74 68 65 20 |fp descr|ibe the |
|00004f80| 70 61 74 74 65 72 6e 20 | 74 6f 20 62 65 20 75 73 |pattern |to be us|
|00004f90| 65 64 2e 20 20 2a 2f 0d | 0d 76 6f 69 64 0d 72 65 |ed. */.|.void.re|
|00004fa0| 5f 63 6f 6d 70 69 6c 65 | 5f 66 61 73 74 6d 61 70 |_compile|_fastmap|
|00004fb0| 20 28 62 75 66 70 29 0d | 20 20 20 20 20 73 74 72 | (bufp).| str|
|00004fc0| 75 63 74 20 72 65 5f 70 | 61 74 74 65 72 6e 5f 62 |uct re_p|attern_b|
|00004fd0| 75 66 66 65 72 20 2a 62 | 75 66 70 3b 0d 7b 0d 20 |uffer *b|ufp;.{. |
|00004fe0| 20 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 20 2a | unsigne|d char *|
|00004ff0| 70 61 74 74 65 72 6e 20 | 3d 20 28 75 6e 73 69 67 |pattern |= (unsig|
|00005000| 6e 65 64 20 63 68 61 72 | 20 2a 29 20 62 75 66 70 |ned char| *) bufp|
|00005010| 2d 3e 62 75 66 66 65 72 | 3b 0d 20 20 73 68 6f 72 |->buffer|;. shor|
|00005020| 74 20 73 69 7a 65 20 3d | 20 62 75 66 70 2d 3e 75 |t size =| bufp->u|
|00005030| 73 65 64 3b 0d 20 20 72 | 65 67 69 73 74 65 72 20 |sed;. r|egister |
|00005040| 63 68 61 72 20 2a 66 61 | 73 74 6d 61 70 20 3d 20 |char *fa|stmap = |
|00005050| 62 75 66 70 2d 3e 66 61 | 73 74 6d 61 70 3b 0d 20 |bufp->fa|stmap;. |
|00005060| 20 72 65 67 69 73 74 65 | 72 20 75 6e 73 69 67 6e | registe|r unsign|
|00005070| 65 64 20 63 68 61 72 20 | 2a 70 20 3d 20 70 61 74 |ed char |*p = pat|
|00005080| 74 65 72 6e 3b 0d 20 20 | 72 65 67 69 73 74 65 72 |tern;. |register|
|00005090| 20 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 20 2a | unsigne|d char *|
|000050a0| 70 65 6e 64 20 3d 20 70 | 61 74 74 65 72 6e 20 2b |pend = p|attern +|
|000050b0| 20 73 69 7a 65 3b 0d 20 | 20 72 65 67 69 73 74 65 | size;. | registe|
|000050c0| 72 20 73 68 6f 72 74 20 | 6a 2c 20 6b 3b 0d 20 20 |r short |j, k;. |
|000050d0| 75 6e 73 69 67 6e 65 64 | 20 63 68 61 72 20 2a 74 |unsigned| char *t|
|000050e0| 72 61 6e 73 6c 61 74 65 | 20 3d 20 28 75 6e 73 69 |ranslate| = (unsi|
|000050f0| 67 6e 65 64 20 63 68 61 | 72 20 2a 29 20 62 75 66 |gned cha|r *) buf|
|00005100| 70 2d 3e 74 72 61 6e 73 | 6c 61 74 65 3b 0d 0d 20 |p->trans|late;.. |
|00005110| 20 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 20 2a | unsigne|d char *|
|00005120| 73 74 61 63 6b 62 5b 4e | 46 41 49 4c 55 52 45 53 |stackb[N|FAILURES|
|00005130| 5d 3b 0d 20 20 75 6e 73 | 69 67 6e 65 64 20 63 68 |];. uns|igned ch|
|00005140| 61 72 20 2a 2a 73 74 61 | 63 6b 70 20 3d 20 73 74 |ar **sta|ckp = st|
|00005150| 61 63 6b 62 3b 0d 0d 20 | 20 62 7a 65 72 6f 20 28 |ackb;.. | bzero (|
|00005160| 66 61 73 74 6d 61 70 2c | 20 28 31 20 3c 3c 20 42 |fastmap,| (1 << B|
|00005170| 59 54 45 57 49 44 54 48 | 29 29 3b 0d 20 20 62 75 |YTEWIDTH|));. bu|
|00005180| 66 70 2d 3e 66 61 73 74 | 6d 61 70 5f 61 63 63 75 |fp->fast|map_accu|
|00005190| 72 61 74 65 20 3d 20 31 | 3b 0d 20 20 62 75 66 70 |rate = 1|;. bufp|
|000051a0| 2d 3e 63 61 6e 5f 62 65 | 5f 6e 75 6c 6c 20 3d 20 |->can_be|_null = |
|000051b0| 30 3b 0d 20 20 20 20 20 | 20 0d 20 20 77 68 69 6c |0;. | . whil|
|000051c0| 65 20 28 70 29 0d 20 20 | 20 20 7b 0d 20 20 20 20 |e (p). | {. |
|000051d0| 20 20 69 66 20 28 70 20 | 3d 3d 20 70 65 6e 64 29 | if (p |== pend)|
|000051e0| 0d 09 7b 0d 09 20 20 62 | 75 66 70 2d 3e 63 61 6e |..{.. b|ufp->can|
|000051f0| 5f 62 65 5f 6e 75 6c 6c | 20 3d 20 31 3b 0d 09 20 |_be_null| = 1;.. |
|00005200| 20 62 72 65 61 6b 3b 0d | 09 7d 0d 23 69 66 64 65 | break;.|.}.#ifde|
|00005210| 66 20 53 57 49 54 43 48 | 5f 45 4e 55 4d 5f 42 55 |f SWITCH|_ENUM_BU|
|00005220| 47 0d 20 20 20 20 20 20 | 73 77 69 74 63 68 20 28 |G. |switch (|
|00005230| 28 73 68 6f 72 74 29 20 | 28 28 65 6e 75 6d 20 72 |(short) |((enum r|
|00005240| 65 67 65 78 70 63 6f 64 | 65 29 20 2a 70 2b 2b 29 |egexpcod|e) *p++)|
|00005250| 29 0d 23 65 6c 73 65 0d | 20 20 20 20 20 20 73 77 |).#else.| sw|
|00005260| 69 74 63 68 20 28 28 65 | 6e 75 6d 20 72 65 67 65 |itch ((e|num rege|
|00005270| 78 70 63 6f 64 65 29 20 | 2a 70 2b 2b 29 0d 23 65 |xpcode) |*p++).#e|
|00005280| 6e 64 69 66 0d 09 7b 0d | 09 63 61 73 65 20 65 78 |ndif..{.|.case ex|
|00005290| 61 63 74 6e 3a 0d 09 20 | 20 69 66 20 28 74 72 61 |actn:.. | if (tra|
|000052a0| 6e 73 6c 61 74 65 29 0d | 09 20 20 20 20 66 61 73 |nslate).|. fas|
|000052b0| 74 6d 61 70 5b 74 72 61 | 6e 73 6c 61 74 65 5b 70 |tmap[tra|nslate[p|
|000052c0| 5b 31 5d 5d 5d 20 3d 20 | 31 3b 0d 09 20 20 65 6c |[1]]] = |1;.. el|
|000052d0| 73 65 0d 09 20 20 20 20 | 66 61 73 74 6d 61 70 5b |se.. |fastmap[|
|000052e0| 70 5b 31 5d 5d 20 3d 20 | 31 3b 0d 09 20 20 62 72 |p[1]] = |1;.. br|
|000052f0| 65 61 6b 3b 0d 0d 20 20 | 20 20 20 20 20 20 63 61 |eak;.. | ca|
|00005300| 73 65 20 62 65 67 6c 69 | 6e 65 3a 0d 20 20 20 20 |se begli|ne:. |
|00005310| 20 20 20 20 63 61 73 65 | 20 62 65 66 6f 72 65 5f | case| before_|
|00005320| 64 6f 74 3a 0d 09 63 61 | 73 65 20 61 74 5f 64 6f |dot:..ca|se at_do|
|00005330| 74 3a 0d 09 63 61 73 65 | 20 61 66 74 65 72 5f 64 |t:..case| after_d|
|00005340| 6f 74 3a 0d 09 63 61 73 | 65 20 62 65 67 62 75 66 |ot:..cas|e begbuf|
|00005350| 3a 0d 09 63 61 73 65 20 | 65 6e 64 62 75 66 3a 0d |:..case |endbuf:.|
|00005360| 09 63 61 73 65 20 77 6f | 72 64 62 6f 75 6e 64 3a |.case wo|rdbound:|
|00005370| 0d 09 63 61 73 65 20 6e | 6f 74 77 6f 72 64 62 6f |..case n|otwordbo|
|00005380| 75 6e 64 3a 0d 09 63 61 | 73 65 20 77 6f 72 64 62 |und:..ca|se wordb|
|00005390| 65 67 3a 0d 09 63 61 73 | 65 20 77 6f 72 64 65 6e |eg:..cas|e worden|
|000053a0| 64 3a 0d 09 20 20 63 6f | 6e 74 69 6e 75 65 3b 0d |d:.. co|ntinue;.|
|000053b0| 0d 09 63 61 73 65 20 65 | 6e 64 6c 69 6e 65 3a 0d |..case e|ndline:.|
|000053c0| 09 20 20 69 66 20 28 74 | 72 61 6e 73 6c 61 74 65 |. if (t|ranslate|
|000053d0| 29 0d 09 20 20 20 20 66 | 61 73 74 6d 61 70 5b 74 |).. f|astmap[t|
|000053e0| 72 61 6e 73 6c 61 74 65 | 5b 43 52 5d 5d 20 3d 20 |ranslate|[CR]] = |
|000053f0| 31 3b 0d 09 20 20 65 6c | 73 65 0d 09 20 20 20 20 |1;.. el|se.. |
|00005400| 66 61 73 74 6d 61 70 5b | 43 52 5d 20 3d 20 31 3b |fastmap[|CR] = 1;|
|00005410| 0d 09 20 20 69 66 20 28 | 62 75 66 70 2d 3e 63 61 |.. if (|bufp->ca|
|00005420| 6e 5f 62 65 5f 6e 75 6c | 6c 20 21 3d 20 31 29 0d |n_be_nul|l != 1).|
|00005430| 09 20 20 20 20 62 75 66 | 70 2d 3e 63 61 6e 5f 62 |. buf|p->can_b|
|00005440| 65 5f 6e 75 6c 6c 20 3d | 20 32 3b 0d 09 20 20 62 |e_null =| 2;.. b|
|00005450| 72 65 61 6b 3b 0d 0d 09 | 63 61 73 65 20 66 69 6e |reak;...|case fin|
|00005460| 61 6c 69 7a 65 5f 6a 75 | 6d 70 3a 0d 09 63 61 73 |alize_ju|mp:..cas|
|00005470| 65 20 6d 61 79 62 65 5f | 66 69 6e 61 6c 69 7a 65 |e maybe_|finalize|
|00005480| 5f 6a 75 6d 70 3a 0d 09 | 63 61 73 65 20 6a 75 6d |_jump:..|case jum|
|00005490| 70 3a 0d 09 63 61 73 65 | 20 64 75 6d 6d 79 5f 66 |p:..case| dummy_f|
|000054a0| 61 69 6c 75 72 65 5f 6a | 75 6d 70 3a 0d 09 20 20 |ailure_j|ump:.. |
|000054b0| 62 75 66 70 2d 3e 63 61 | 6e 5f 62 65 5f 6e 75 6c |bufp->ca|n_be_nul|
|000054c0| 6c 20 3d 20 31 3b 0d 09 | 20 20 6a 20 3d 20 2a 70 |l = 1;..| j = *p|
|000054d0| 2b 2b 20 26 20 30 33 37 | 37 3b 0d 09 20 20 6a 20 |++ & 037|7;.. j |
|000054e0| 2b 3d 20 53 49 47 4e 5f | 45 58 54 45 4e 44 5f 43 |+= SIGN_|EXTEND_C|
|000054f0| 48 41 52 20 28 2a 28 63 | 68 61 72 20 2a 29 70 29 |HAR (*(c|har *)p)|
|00005500| 20 3c 3c 20 38 3b 0d 09 | 20 20 70 20 2b 3d 20 6a | << 8;..| p += j|
|00005510| 20 2b 20 31 3b 09 09 2f | 2a 20 54 68 65 20 31 20 | + 1;../|* The 1 |
|00005520| 63 6f 6d 70 65 6e 73 61 | 74 65 73 20 66 6f 72 20 |compensa|tes for |
|00005530| 6d 69 73 73 69 6e 67 20 | 2b 2b 20 61 62 6f 76 65 |missing |++ above|
|00005540| 20 2a 2f 0d 09 20 20 69 | 66 20 28 6a 20 3e 20 30 | */.. i|f (j > 0|
|00005550| 29 0d 09 20 20 20 20 63 | 6f 6e 74 69 6e 75 65 3b |).. c|ontinue;|
|00005560| 0d 09 20 20 2f 2a 20 4a | 75 6d 70 20 62 61 63 6b |.. /* J|ump back|
|00005570| 77 61 72 64 20 72 65 61 | 63 68 65 64 20 69 6d 70 |ward rea|ched imp|
|00005580| 6c 69 65 73 20 77 65 20 | 6a 75 73 74 20 77 65 6e |lies we |just wen|
|00005590| 74 20 74 68 72 6f 75 67 | 68 0d 09 20 20 20 20 20 |t throug|h.. |
|000055a0| 74 68 65 20 62 6f 64 79 | 20 6f 66 20 61 20 6c 6f |the body| of a lo|
|000055b0| 6f 70 20 61 6e 64 20 6d | 61 74 63 68 65 64 20 6e |op and m|atched n|
|000055c0| 6f 74 68 69 6e 67 2e 0d | 09 20 20 20 20 20 4f 70 |othing..|. Op|
|000055d0| 63 6f 64 65 20 6a 75 6d | 70 65 64 20 74 6f 20 73 |code jum|ped to s|
|000055e0| 68 6f 75 6c 64 20 62 65 | 20 61 6e 20 6f 6e 5f 66 |hould be| an on_f|
|000055f0| 61 69 6c 75 72 65 5f 6a | 75 6d 70 2e 0d 09 20 20 |ailure_j|ump... |
|00005600| 20 20 20 4a 75 73 74 20 | 74 72 65 61 74 20 69 74 | Just |treat it|
|00005610| 20 6c 69 6b 65 20 61 6e | 20 6f 72 64 69 6e 61 72 | like an| ordinar|
|00005620| 79 20 6a 75 6d 70 2e 0d | 09 20 20 20 20 20 46 6f |y jump..|. Fo|
|00005630| 72 20 61 20 2a 20 6c 6f | 6f 70 2c 20 69 74 20 68 |r a * lo|op, it h|
|00005640| 61 73 20 70 75 73 68 65 | 64 20 69 74 73 20 66 61 |as pushe|d its fa|
|00005650| 69 6c 75 72 65 20 70 6f | 69 6e 74 20 61 6c 72 65 |ilure po|int alre|
|00005660| 61 64 79 3b 0d 09 20 20 | 20 20 20 69 66 20 73 6f |ady;.. | if so|
|00005670| 2c 20 64 69 73 63 61 72 | 64 20 74 68 61 74 20 61 |, discar|d that a|
|00005680| 73 20 72 65 64 75 6e 64 | 61 6e 74 2e 20 20 2a 2f |s redund|ant. */|
|00005690| 0d 09 20 20 69 66 20 28 | 28 65 6e 75 6d 20 72 65 |.. if (|(enum re|
|000056a0| 67 65 78 70 63 6f 64 65 | 29 20 2a 70 20 21 3d 20 |gexpcode|) *p != |
|000056b0| 6f 6e 5f 66 61 69 6c 75 | 72 65 5f 6a 75 6d 70 29 |on_failu|re_jump)|
|000056c0| 0d 09 20 20 20 20 63 6f | 6e 74 69 6e 75 65 3b 0d |.. co|ntinue;.|
|000056d0| 09 20 20 70 2b 2b 3b 0d | 09 20 20 6a 20 3d 20 2a |. p++;.|. j = *|
|000056e0| 70 2b 2b 20 26 20 30 33 | 37 37 3b 0d 09 20 20 6a |p++ & 03|77;.. j|
|000056f0| 20 2b 3d 20 53 49 47 4e | 5f 45 58 54 45 4e 44 5f | += SIGN|_EXTEND_|
|00005700| 43 48 41 52 20 28 2a 28 | 63 68 61 72 20 2a 29 70 |CHAR (*(|char *)p|
|00005710| 29 20 3c 3c 20 38 3b 0d | 09 20 20 70 20 2b 3d 20 |) << 8;.|. p += |
|00005720| 6a 20 2b 20 31 3b 09 09 | 2f 2a 20 54 68 65 20 31 |j + 1;..|/* The 1|
|00005730| 20 63 6f 6d 70 65 6e 73 | 61 74 65 73 20 66 6f 72 | compens|ates for|
|00005740| 20 6d 69 73 73 69 6e 67 | 20 2b 2b 20 61 62 6f 76 | missing| ++ abov|
|00005750| 65 20 2a 2f 0d 09 20 20 | 69 66 20 28 73 74 61 63 |e */.. |if (stac|
|00005760| 6b 70 20 21 3d 20 73 74 | 61 63 6b 62 20 26 26 20 |kp != st|ackb && |
|00005770| 2a 73 74 61 63 6b 70 20 | 3d 3d 20 70 29 0d 09 20 |*stackp |== p).. |
|00005780| 20 20 20 73 74 61 63 6b | 70 2d 2d 3b 0d 09 20 20 | stack|p--;.. |
|00005790| 63 6f 6e 74 69 6e 75 65 | 3b 0d 09 20 20 0d 09 63 |continue|;.. ..c|
|000057a0| 61 73 65 20 6f 6e 5f 66 | 61 69 6c 75 72 65 5f 6a |ase on_f|ailure_j|
|000057b0| 75 6d 70 3a 0d 09 20 20 | 6a 20 3d 20 2a 70 2b 2b |ump:.. |j = *p++|
|000057c0| 20 26 20 30 33 37 37 3b | 0d 09 20 20 6a 20 2b 3d | & 0377;|.. j +=|
|000057d0| 20 53 49 47 4e 5f 45 58 | 54 45 4e 44 5f 43 48 41 | SIGN_EX|TEND_CHA|
|000057e0| 52 20 28 2a 28 63 68 61 | 72 20 2a 29 70 29 20 3c |R (*(cha|r *)p) <|
|000057f0| 3c 20 38 3b 0d 09 20 20 | 70 2b 2b 3b 0d 09 20 20 |< 8;.. |p++;.. |
|00005800| 2a 2b 2b 73 74 61 63 6b | 70 20 3d 20 70 20 2b 20 |*++stack|p = p + |
|00005810| 6a 3b 0d 09 20 20 63 6f | 6e 74 69 6e 75 65 3b 0d |j;.. co|ntinue;.|
|00005820| 0d 09 63 61 73 65 20 73 | 74 61 72 74 5f 6d 65 6d |..case s|tart_mem|
|00005830| 6f 72 79 3a 0d 09 63 61 | 73 65 20 73 74 6f 70 5f |ory:..ca|se stop_|
|00005840| 6d 65 6d 6f 72 79 3a 0d | 09 20 20 70 2b 2b 3b 0d |memory:.|. p++;.|
|00005850| 09 20 20 63 6f 6e 74 69 | 6e 75 65 3b 0d 0d 09 63 |. conti|nue;...c|
|00005860| 61 73 65 20 64 75 70 6c | 69 63 61 74 65 3a 0d 09 |ase dupl|icate:..|
|00005870| 20 20 62 75 66 70 2d 3e | 63 61 6e 5f 62 65 5f 6e | bufp->|can_be_n|
|00005880| 75 6c 6c 20 3d 20 31 3b | 0d 09 20 20 66 61 73 74 |ull = 1;|.. fast|
|00005890| 6d 61 70 5b 43 52 5d 20 | 3d 20 31 3b 0d 09 63 61 |map[CR] |= 1;..ca|
|000058a0| 73 65 20 61 6e 79 63 68 | 61 72 3a 0d 09 20 20 66 |se anych|ar:.. f|
|000058b0| 6f 72 20 28 6a 20 3d 20 | 30 3b 20 6a 20 3c 20 28 |or (j = |0; j < (|
|000058c0| 31 20 3c 3c 20 42 59 54 | 45 57 49 44 54 48 29 3b |1 << BYT|EWIDTH);|
|000058d0| 20 6a 2b 2b 29 0d 09 20 | 20 20 20 69 66 20 28 6a | j++).. | if (j|
|000058e0| 20 21 3d 20 43 52 29 0d | 09 20 20 20 20 20 20 66 | != CR).|. f|
|000058f0| 61 73 74 6d 61 70 5b 6a | 5d 20 3d 20 31 3b 0d 09 |astmap[j|] = 1;..|
|00005900| 20 20 69 66 20 28 62 75 | 66 70 2d 3e 63 61 6e 5f | if (bu|fp->can_|
|00005910| 62 65 5f 6e 75 6c 6c 29 | 0d 09 20 20 20 20 72 65 |be_null)|.. re|
|00005920| 74 75 72 6e 3b 0d 09 20 | 20 2f 2a 20 44 6f 6e 27 |turn;.. | /* Don'|
|00005930| 74 20 72 65 74 75 72 6e | 3b 20 63 68 65 63 6b 20 |t return|; check |
|00005940| 74 68 65 20 61 6c 74 65 | 72 6e 61 74 69 76 65 20 |the alte|rnative |
|00005950| 70 61 74 68 73 0d 09 20 | 20 20 20 20 73 6f 20 77 |paths.. | so w|
|00005960| 65 20 63 61 6e 20 73 65 | 74 20 63 61 6e 5f 62 65 |e can se|t can_be|
|00005970| 5f 6e 75 6c 6c 20 69 66 | 20 61 70 70 72 6f 70 72 |_null if| appropr|
|00005980| 69 61 74 65 2e 20 20 2a | 2f 0d 09 20 20 62 72 65 |iate. *|/.. bre|
|00005990| 61 6b 3b 0d 0d 09 63 61 | 73 65 20 77 6f 72 64 63 |ak;...ca|se wordc|
|000059a0| 68 61 72 3a 0d 09 20 20 | 66 6f 72 20 28 6a 20 3d |har:.. |for (j =|
|000059b0| 20 30 3b 20 6a 20 3c 20 | 28 31 20 3c 3c 20 42 59 | 0; j < |(1 << BY|
|000059c0| 54 45 57 49 44 54 48 29 | 3b 20 6a 2b 2b 29 0d 09 |TEWIDTH)|; j++)..|
|000059d0| 20 20 20 20 69 66 20 28 | 53 59 4e 54 41 58 20 28 | if (|SYNTAX (|
|000059e0| 6a 29 20 3d 3d 20 53 77 | 6f 72 64 29 0d 09 20 20 |j) == Sw|ord).. |
|000059f0| 20 20 20 20 66 61 73 74 | 6d 61 70 5b 6a 5d 20 3d | fast|map[j] =|
|00005a00| 20 31 3b 0d 09 20 20 62 | 72 65 61 6b 3b 0d 0d 09 | 1;.. b|reak;...|
|00005a10| 63 61 73 65 20 6e 6f 74 | 77 6f 72 64 63 68 61 72 |case not|wordchar|
|00005a20| 3a 0d 09 20 20 66 6f 72 | 20 28 6a 20 3d 20 30 3b |:.. for| (j = 0;|
|00005a30| 20 6a 20 3c 20 28 31 20 | 3c 3c 20 42 59 54 45 57 | j < (1 |<< BYTEW|
|00005a40| 49 44 54 48 29 3b 20 6a | 2b 2b 29 0d 09 20 20 20 |IDTH); j|++).. |
|00005a50| 20 69 66 20 28 53 59 4e | 54 41 58 20 28 6a 29 20 | if (SYN|TAX (j) |
|00005a60| 21 3d 20 53 77 6f 72 64 | 29 0d 09 20 20 20 20 20 |!= Sword|).. |
|00005a70| 20 66 61 73 74 6d 61 70 | 5b 6a 5d 20 3d 20 31 3b | fastmap|[j] = 1;|
|00005a80| 0d 09 20 20 62 72 65 61 | 6b 3b 0d 0d 23 69 66 64 |.. brea|k;..#ifd|
|00005a90| 65 66 20 65 6d 61 63 73 | 0d 09 63 61 73 65 20 73 |ef emacs|..case s|
|00005aa0| 79 6e 74 61 78 73 70 65 | 63 3a 0d 09 20 20 6b 20 |yntaxspe|c:.. k |
|00005ab0| 3d 20 2a 70 2b 2b 3b 0d | 09 20 20 66 6f 72 20 28 |= *p++;.|. for (|
|00005ac0| 6a 20 3d 20 30 3b 20 6a | 20 3c 20 28 31 20 3c 3c |j = 0; j| < (1 <<|
|00005ad0| 20 42 59 54 45 57 49 44 | 54 48 29 3b 20 6a 2b 2b | BYTEWID|TH); j++|
|00005ae0| 29 0d 09 20 20 20 20 69 | 66 20 28 53 59 4e 54 41 |).. i|f (SYNTA|
|00005af0| 58 20 28 6a 29 20 3d 3d | 20 28 65 6e 75 6d 20 73 |X (j) ==| (enum s|
|00005b00| 79 6e 74 61 78 63 6f 64 | 65 29 20 6b 29 0d 09 20 |yntaxcod|e) k).. |
|00005b10| 20 20 20 20 20 66 61 73 | 74 6d 61 70 5b 6a 5d 20 | fas|tmap[j] |
|00005b20| 3d 20 31 3b 0d 09 20 20 | 62 72 65 61 6b 3b 0d 0d |= 1;.. |break;..|
|00005b30| 09 63 61 73 65 20 6e 6f | 74 73 79 6e 74 61 78 73 |.case no|tsyntaxs|
|00005b40| 70 65 63 3a 0d 09 20 20 | 6b 20 3d 20 2a 70 2b 2b |pec:.. |k = *p++|
|00005b50| 3b 0d 09 20 20 66 6f 72 | 20 28 6a 20 3d 20 30 3b |;.. for| (j = 0;|
|00005b60| 20 6a 20 3c 20 28 31 20 | 3c 3c 20 42 59 54 45 57 | j < (1 |<< BYTEW|
|00005b70| 49 44 54 48 29 3b 20 6a | 2b 2b 29 0d 09 20 20 20 |IDTH); j|++).. |
|00005b80| 20 69 66 20 28 53 59 4e | 54 41 58 20 28 6a 29 20 | if (SYN|TAX (j) |
|00005b90| 21 3d 20 28 65 6e 75 6d | 20 73 79 6e 74 61 78 63 |!= (enum| syntaxc|
|00005ba0| 6f 64 65 29 20 6b 29 0d | 09 20 20 20 20 20 20 66 |ode) k).|. f|
|00005bb0| 61 73 74 6d 61 70 5b 6a | 5d 20 3d 20 31 3b 0d 09 |astmap[j|] = 1;..|
|00005bc0| 20 20 62 72 65 61 6b 3b | 0d 23 65 6e 64 69 66 20 | break;|.#endif |
|00005bd0| 2f 2a 20 65 6d 61 63 73 | 20 2a 2f 0d 0d 09 63 61 |/* emacs| */...ca|
|00005be0| 73 65 20 63 68 61 72 73 | 65 74 3a 0d 09 20 20 66 |se chars|et:.. f|
|00005bf0| 6f 72 20 28 6a 20 3d 20 | 2a 70 2b 2b 20 2a 20 42 |or (j = |*p++ * B|
|00005c00| 59 54 45 57 49 44 54 48 | 20 2d 20 31 3b 20 6a 20 |YTEWIDTH| - 1; j |
|00005c10| 3e 3d 20 30 3b 20 6a 2d | 2d 29 0d 09 20 20 20 20 |>= 0; j-|-).. |
|00005c20| 69 66 20 28 70 5b 6a 20 | 2f 20 42 59 54 45 57 49 |if (p[j |/ BYTEWI|
|00005c30| 44 54 48 5d 20 26 20 28 | 31 20 3c 3c 20 28 6a 20 |DTH] & (|1 << (j |
|00005c40| 25 20 42 59 54 45 57 49 | 44 54 48 29 29 29 0d 09 |% BYTEWI|DTH)))..|
|00005c50| 20 20 20 20 20 20 7b 0d | 09 09 69 66 20 28 74 72 | {.|..if (tr|
|00005c60| 61 6e 73 6c 61 74 65 29 | 0d 09 09 20 20 66 61 73 |anslate)|... fas|
|00005c70| 74 6d 61 70 5b 74 72 61 | 6e 73 6c 61 74 65 5b 6a |tmap[tra|nslate[j|
|00005c80| 5d 5d 20 3d 20 31 3b 0d | 09 09 65 6c 73 65 0d 09 |]] = 1;.|..else..|
|00005c90| 09 20 20 66 61 73 74 6d | 61 70 5b 6a 5d 20 3d 20 |. fastm|ap[j] = |
|00005ca0| 31 3b 0d 09 20 20 20 20 | 20 20 7d 0d 09 20 20 62 |1;.. | }.. b|
|00005cb0| 72 65 61 6b 3b 0d 0d 09 | 63 61 73 65 20 63 68 61 |reak;...|case cha|
|00005cc0| 72 73 65 74 5f 6e 6f 74 | 3a 0d 09 20 20 2f 2a 20 |rset_not|:.. /* |
|00005cd0| 43 68 61 72 73 20 62 65 | 79 6f 6e 64 20 65 6e 64 |Chars be|yond end|
|00005ce0| 20 6f 66 20 6d 61 70 20 | 6d 75 73 74 20 62 65 20 | of map |must be |
|00005cf0| 61 6c 6c 6f 77 65 64 20 | 2a 2f 0d 09 20 20 66 6f |allowed |*/.. fo|
|00005d00| 72 20 28 6a 20 3d 20 2a | 70 20 2a 20 42 59 54 45 |r (j = *|p * BYTE|
|00005d10| 57 49 44 54 48 3b 20 6a | 20 3c 20 28 31 20 3c 3c |WIDTH; j| < (1 <<|
|00005d20| 20 42 59 54 45 57 49 44 | 54 48 29 3b 20 6a 2b 2b | BYTEWID|TH); j++|
|00005d30| 29 0d 09 20 20 20 20 69 | 66 20 28 74 72 61 6e 73 |).. i|f (trans|
|00005d40| 6c 61 74 65 29 0d 09 20 | 20 20 20 20 20 66 61 73 |late).. | fas|
|00005d50| 74 6d 61 70 5b 74 72 61 | 6e 73 6c 61 74 65 5b 6a |tmap[tra|nslate[j|
|00005d60| 5d 5d 20 3d 20 31 3b 0d | 09 20 20 20 20 65 6c 73 |]] = 1;.|. els|
|00005d70| 65 0d 09 20 20 20 20 20 | 20 66 61 73 74 6d 61 70 |e.. | fastmap|
|00005d80| 5b 6a 5d 20 3d 20 31 3b | 0d 0d 09 20 20 66 6f 72 |[j] = 1;|... for|
|00005d90| 20 28 6a 20 3d 20 2a 70 | 2b 2b 20 2a 20 42 59 54 | (j = *p|++ * BYT|
|00005da0| 45 57 49 44 54 48 20 2d | 20 31 3b 20 6a 20 3e 3d |EWIDTH -| 1; j >=|
|00005db0| 20 30 3b 20 6a 2d 2d 29 | 0d 09 20 20 20 20 69 66 | 0; j--)|.. if|
|00005dc0| 20 28 21 28 70 5b 6a 20 | 2f 20 42 59 54 45 57 49 | (!(p[j |/ BYTEWI|
|00005dd0| 44 54 48 5d 20 26 20 28 | 31 20 3c 3c 20 28 6a 20 |DTH] & (|1 << (j |
|00005de0| 25 20 42 59 54 45 57 49 | 44 54 48 29 29 29 29 0d |% BYTEWI|DTH)))).|
|00005df0| 09 20 20 20 20 20 20 7b | 0d 09 09 69 66 20 28 74 |. {|...if (t|
|00005e00| 72 61 6e 73 6c 61 74 65 | 29 0d 09 09 20 20 66 61 |ranslate|)... fa|
|00005e10| 73 74 6d 61 70 5b 74 72 | 61 6e 73 6c 61 74 65 5b |stmap[tr|anslate[|
|00005e20| 6a 5d 5d 20 3d 20 31 3b | 0d 09 09 65 6c 73 65 0d |j]] = 1;|...else.|
|00005e30| 09 09 20 20 66 61 73 74 | 6d 61 70 5b 6a 5d 20 3d |.. fast|map[j] =|
|00005e40| 20 31 3b 0d 09 20 20 20 | 20 20 20 7d 0d 09 20 20 | 1;.. | }.. |
|00005e50| 62 72 65 61 6b 3b 0d 09 | 7d 0d 0d 20 20 20 20 20 |break;..|}.. |
|00005e60| 20 2f 2a 20 47 65 74 20 | 68 65 72 65 20 6d 65 61 | /* Get |here mea|
|00005e70| 6e 73 20 77 65 20 68 61 | 76 65 20 73 75 63 63 65 |ns we ha|ve succe|
|00005e80| 73 73 66 75 6c 6c 79 20 | 66 6f 75 6e 64 20 74 68 |ssfully |found th|
|00005e90| 65 20 70 6f 73 73 69 62 | 6c 65 20 73 74 61 72 74 |e possib|le start|
|00005ea0| 69 6e 67 20 63 68 61 72 | 61 63 74 65 72 73 0d 09 |ing char|acters..|
|00005eb0| 20 6f 66 20 6f 6e 65 20 | 70 61 74 68 20 6f 66 20 | of one |path of |
|00005ec0| 74 68 65 20 70 61 74 74 | 65 72 6e 2e 20 20 57 65 |the patt|ern. We|
|00005ed0| 20 6e 65 65 64 20 6e 6f | 74 20 66 6f 6c 6c 6f 77 | need no|t follow|
|00005ee0| 20 74 68 69 73 20 70 61 | 74 68 20 61 6e 79 20 66 | this pa|th any f|
|00005ef0| 61 72 74 68 65 72 2e 0d | 09 20 49 6e 73 74 65 61 |arther..|. Instea|
|00005f00| 64 2c 20 6c 6f 6f 6b 20 | 61 74 20 74 68 65 20 6e |d, look |at the n|
|00005f10| 65 78 74 20 61 6c 74 65 | 72 6e 61 74 69 76 65 20 |ext alte|rnative |
|00005f20| 72 65 6d 65 6d 62 65 72 | 65 64 20 69 6e 20 74 68 |remember|ed in th|
|00005f30| 65 20 73 74 61 63 6b 2e | 20 2a 2f 0d 20 20 20 20 |e stack.| */. |
|00005f40| 20 20 69 66 20 28 73 74 | 61 63 6b 70 20 21 3d 20 | if (st|ackp != |
|00005f50| 73 74 61 63 6b 62 29 0d | 09 70 20 3d 20 2a 73 74 |stackb).|.p = *st|
|00005f60| 61 63 6b 70 2d 2d 3b 0d | 20 20 20 20 20 20 65 6c |ackp--;.| el|
|00005f70| 73 65 0d 09 62 72 65 61 | 6b 3b 0d 20 20 20 20 7d |se..brea|k;. }|
|00005f80| 0d 7d 0d 0d 2f 2a 20 4c | 69 6b 65 20 72 65 5f 73 |.}../* L|ike re_s|
|00005f90| 65 61 72 63 68 5f 32 2c | 20 62 65 6c 6f 77 2c 20 |earch_2,| below, |
|00005fa0| 62 75 74 20 6f 6e 6c 79 | 20 6f 6e 65 20 73 74 72 |but only| one str|
|00005fb0| 69 6e 67 20 69 73 20 73 | 70 65 63 69 66 69 65 64 |ing is s|pecified|
|00005fc0| 2e 20 2a 2f 0d 0d 73 68 | 6f 72 74 0d 72 65 5f 73 |. */..sh|ort.re_s|
|00005fd0| 65 61 72 63 68 28 73 74 | 72 75 63 74 20 72 65 5f |earch(st|ruct re_|
|00005fe0| 70 61 74 74 65 72 6e 5f | 62 75 66 66 65 72 20 2a |pattern_|buffer *|
|00005ff0| 70 62 75 66 70 2c 63 68 | 61 72 20 2a 73 74 72 69 |pbufp,ch|ar *stri|
|00006000| 6e 67 2c 73 68 6f 72 74 | 20 73 69 7a 65 2c 73 68 |ng,short| size,sh|
|00006010| 6f 72 74 20 73 74 61 72 | 74 70 6f 73 2c 73 68 6f |ort star|tpos,sho|
|00006020| 72 74 20 72 61 6e 67 65 | 2c 73 74 72 75 63 74 20 |rt range|,struct |
|00006030| 72 65 5f 72 65 67 69 73 | 74 65 72 73 20 2a 72 65 |re_regis|ters *re|
|00006040| 67 73 29 0d 7b 0d 20 20 | 72 65 74 75 72 6e 20 72 |gs).{. |return r|
|00006050| 65 5f 73 65 61 72 63 68 | 5f 32 20 28 70 62 75 66 |e_search|_2 (pbuf|
|00006060| 70 2c 20 30 2c 20 30 2c | 20 73 74 72 69 6e 67 2c |p, 0, 0,| string,|
|00006070| 20 73 69 7a 65 2c 20 73 | 74 61 72 74 70 6f 73 2c | size, s|tartpos,|
|00006080| 20 72 61 6e 67 65 2c 20 | 72 65 67 73 2c 20 73 69 | range, |regs, si|
|00006090| 7a 65 29 3b 0d 7d 0d 0d | 2f 2a 20 4c 69 6b 65 20 |ze);.}..|/* Like |
|000060a0| 72 65 5f 6d 61 74 63 68 | 5f 32 20 62 75 74 20 74 |re_match|_2 but t|
|000060b0| 72 69 65 73 20 66 69 72 | 73 74 20 61 20 6d 61 74 |ries fir|st a mat|
|000060c0| 63 68 20 73 74 61 72 74 | 69 6e 67 20 61 74 20 69 |ch start|ing at i|
|000060d0| 6e 64 65 78 20 53 54 41 | 52 54 50 4f 53 2c 0d 20 |ndex STA|RTPOS,. |
|000060e0| 20 20 74 68 65 6e 20 61 | 74 20 53 54 41 52 54 50 | then a|t STARTP|
|000060f0| 4f 53 20 2b 20 31 2c 20 | 61 6e 64 20 73 6f 20 6f |OS + 1, |and so o|
|00006100| 6e 2e 0d 20 20 20 52 41 | 4e 47 45 20 69 73 20 74 |n.. RA|NGE is t|
|00006110| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 70 6c 61 |he numbe|r of pla|
|00006120| 63 65 73 20 74 6f 20 74 | 72 79 20 62 65 66 6f 72 |ces to t|ry befor|
|00006130| 65 20 67 69 76 69 6e 67 | 20 75 70 2e 0d 20 20 20 |e giving| up.. |
|00006140| 49 66 20 52 41 4e 47 45 | 20 69 73 20 6e 65 67 61 |If RANGE| is nega|
|00006150| 74 69 76 65 2c 20 74 68 | 65 20 73 74 61 72 74 69 |tive, th|e starti|
|00006160| 6e 67 20 70 6f 73 69 74 | 69 6f 6e 73 20 74 72 69 |ng posit|ions tri|
|00006170| 65 64 20 61 72 65 0d 20 | 20 20 20 53 54 41 52 54 |ed are. | START|
|00006180| 50 4f 53 2c 20 53 54 41 | 52 54 50 4f 53 20 2d 20 |POS, STA|RTPOS - |
|00006190| 31 2c 20 65 74 63 2e 0d | 20 20 20 49 74 20 69 73 |1, etc..| It is|
|000061a0| 20 75 70 20 74 6f 20 74 | 68 65 20 63 61 6c 6c 65 | up to t|he calle|
|000061b0| 72 20 74 6f 20 6d 61 6b | 65 20 73 75 72 65 20 74 |r to mak|e sure t|
|000061c0| 68 61 74 20 72 61 6e 67 | 65 20 69 73 20 6e 6f 74 |hat rang|e is not|
|000061d0| 20 73 6f 20 6c 61 72 67 | 65 0d 20 20 20 61 73 20 | so larg|e. as |
|000061e0| 74 6f 20 74 61 6b 65 20 | 74 68 65 20 73 74 61 72 |to take |the star|
|000061f0| 74 69 6e 67 20 70 6f 73 | 69 74 69 6f 6e 20 6f 75 |ting pos|ition ou|
|00006200| 74 73 69 64 65 20 6f 66 | 20 74 68 65 20 69 6e 70 |tside of| the inp|
|00006210| 75 74 20 73 74 72 69 6e | 67 73 2e 0d 0d 54 68 65 |ut strin|gs...The|
|00006220| 20 76 61 6c 75 65 20 72 | 65 74 75 72 6e 65 64 20 | value r|eturned |
|00006230| 69 73 20 74 68 65 20 70 | 6f 73 69 74 69 6f 6e 20 |is the p|osition |
|00006240| 61 74 20 77 68 69 63 68 | 20 74 68 65 20 6d 61 74 |at which| the mat|
|00006250| 63 68 20 77 61 73 20 66 | 6f 75 6e 64 2c 0d 20 6f |ch was f|ound,. o|
|00006260| 72 20 2d 31 20 69 66 20 | 6e 6f 20 6d 61 74 63 68 |r -1 if |no match|
|00006270| 20 77 61 73 20 66 6f 75 | 6e 64 2c 0d 20 6f 72 20 | was fou|nd,. or |
|00006280| 2d 32 20 69 66 20 65 72 | 72 6f 72 20 28 73 75 63 |-2 if er|ror (suc|
|00006290| 68 20 61 73 20 66 61 69 | 6c 75 72 65 20 73 74 61 |h as fai|lure sta|
|000062a0| 63 6b 20 6f 76 65 72 66 | 6c 6f 77 29 2e 20 20 2a |ck overf|low). *|
|000062b0| 2f 0d 0d 73 68 6f 72 74 | 0d 72 65 5f 73 65 61 72 |/..short|.re_sear|
|000062c0| 63 68 5f 32 28 73 74 72 | 75 63 74 20 72 65 5f 70 |ch_2(str|uct re_p|
|000062d0| 61 74 74 65 72 6e 5f 62 | 75 66 66 65 72 20 2a 70 |attern_b|uffer *p|
|000062e0| 62 75 66 70 2c 63 68 61 | 72 20 2a 73 74 72 69 6e |bufp,cha|r *strin|
|000062f0| 67 31 2c 73 68 6f 72 74 | 20 73 69 7a 65 31 2c 63 |g1,short| size1,c|
|00006300| 68 61 72 20 2a 73 74 72 | 69 6e 67 32 2c 73 68 6f |har *str|ing2,sho|
|00006310| 72 74 20 73 69 7a 65 32 | 2c 73 68 6f 72 74 20 73 |rt size2|,short s|
|00006320| 74 61 72 74 70 6f 73 2c | 73 68 6f 72 74 20 72 61 |tartpos,|short ra|
|00006330| 6e 67 65 2c 73 74 72 75 | 63 74 20 72 65 5f 72 65 |nge,stru|ct re_re|
|00006340| 67 69 73 74 65 72 73 20 | 2a 72 65 67 73 2c 73 68 |gisters |*regs,sh|
|00006350| 6f 72 74 20 6d 73 74 6f | 70 29 0d 7b 0d 20 20 72 |ort msto|p).{. r|
|00006360| 65 67 69 73 74 65 72 20 | 63 68 61 72 20 2a 66 61 |egister |char *fa|
|00006370| 73 74 6d 61 70 20 3d 20 | 70 62 75 66 70 2d 3e 66 |stmap = |pbufp->f|
|00006380| 61 73 74 6d 61 70 3b 0d | 20 20 72 65 67 69 73 74 |astmap;.| regist|
|00006390| 65 72 20 75 6e 73 69 67 | 6e 65 64 20 63 68 61 72 |er unsig|ned char|
|000063a0| 20 2a 74 72 61 6e 73 6c | 61 74 65 20 3d 20 28 75 | *transl|ate = (u|
|000063b0| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 20 2a 29 20 |nsigned |char *) |
|000063c0| 70 62 75 66 70 2d 3e 74 | 72 61 6e 73 6c 61 74 65 |pbufp->t|ranslate|
|000063d0| 3b 0d 20 20 73 68 6f 72 | 74 20 74 6f 74 61 6c 20 |;. shor|t total |
|000063e0| 3d 20 73 69 7a 65 31 20 | 2b 20 73 69 7a 65 32 3b |= size1 |+ size2;|
|000063f0| 0d 20 20 73 68 6f 72 74 | 20 76 61 6c 3b 0d 0d 20 |. short| val;.. |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.