home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Newsgroup Content (archive/news)
| magic
| Supported |
100%
| dexvert
| SHell self-extracting ARchive (archive/shar)
| magic
| Supported |
100%
| dexvert
| Internet Message Format (text/imf)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| news or mail, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/329 Shell Archive Format
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| message/rfc822
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 53 75 62 6a 65 63 74 3a | 20 20 76 32 33 69 30 34 |Subject:| v23i04|
|00000010| 34 3a 20 20 46 6c 65 78 | 2c 20 61 20 66 61 73 74 |4: Flex|, a fast|
|00000020| 20 6c 65 78 20 72 65 70 | 6c 61 63 65 6d 65 6e 74 | lex rep|lacement|
|00000030| 2c 20 50 61 72 74 30 38 | 2f 31 30 0a 4e 65 77 73 |, Part08|/10.News|
|00000040| 67 72 6f 75 70 73 3a 20 | 63 6f 6d 70 2e 73 6f 75 |groups: |comp.sou|
|00000050| 72 63 65 73 2e 75 6e 69 | 78 0a 41 70 70 72 6f 76 |rces.uni|x.Approv|
|00000060| 65 64 3a 20 72 73 61 6c | 7a 40 75 75 6e 65 74 2e |ed: rsal|z@uunet.|
|00000070| 55 55 2e 4e 45 54 0a 58 | 2d 43 68 65 63 6b 73 75 |UU.NET.X|-Checksu|
|00000080| 6d 2d 53 6e 65 66 72 75 | 3a 20 63 61 36 36 63 63 |m-Snefru|: ca66cc|
|00000090| 64 34 20 65 32 33 61 30 | 66 37 31 20 33 33 30 33 |d4 e23a0|f71 3303|
|000000a0| 39 30 31 36 20 36 37 37 | 65 38 39 38 31 0a 0a 53 |9016 677|e8981..S|
|000000b0| 75 62 6d 69 74 74 65 64 | 2d 62 79 3a 20 56 65 72 |ubmitted|-by: Ver|
|000000c0| 6e 20 50 61 78 73 6f 6e | 20 3c 76 65 72 6e 40 63 |n Paxson| <vern@c|
|000000d0| 73 2e 63 6f 72 6e 65 6c | 6c 2e 65 64 75 3e 0a 50 |s.cornel|l.edu>.P|
|000000e0| 6f 73 74 69 6e 67 2d 6e | 75 6d 62 65 72 3a 20 56 |osting-n|umber: V|
|000000f0| 6f 6c 75 6d 65 20 32 33 | 2c 20 49 73 73 75 65 20 |olume 23|, Issue |
|00000100| 34 34 0a 41 72 63 68 69 | 76 65 2d 6e 61 6d 65 3a |44.Archi|ve-name:|
|00000110| 20 66 6c 65 78 32 2e 33 | 2f 70 61 72 74 30 38 0a | flex2.3|/part08.|
|00000120| 0a 23 21 20 2f 62 69 6e | 2f 73 68 0a 23 20 54 68 |.#! /bin|/sh.# Th|
|00000130| 69 73 20 69 73 20 61 20 | 73 68 65 6c 6c 20 61 72 |is is a |shell ar|
|00000140| 63 68 69 76 65 2e 20 20 | 52 65 6d 6f 76 65 20 61 |chive. |Remove a|
|00000150| 6e 79 74 68 69 6e 67 20 | 62 65 66 6f 72 65 20 74 |nything |before t|
|00000160| 68 69 73 20 6c 69 6e 65 | 2c 20 74 68 65 6e 20 66 |his line|, then f|
|00000170| 65 65 64 20 69 74 0a 23 | 20 69 6e 74 6f 20 61 20 |eed it.#| into a |
|00000180| 73 68 65 6c 6c 20 76 69 | 61 20 22 73 68 20 66 69 |shell vi|a "sh fi|
|00000190| 6c 65 22 20 6f 72 20 73 | 69 6d 69 6c 61 72 2e 20 |le" or s|imilar. |
|000001a0| 20 54 6f 20 6f 76 65 72 | 77 72 69 74 65 20 65 78 | To over|write ex|
|000001b0| 69 73 74 69 6e 67 20 66 | 69 6c 65 73 2c 0a 23 20 |isting f|iles,.# |
|000001c0| 74 79 70 65 20 22 73 68 | 20 66 69 6c 65 20 2d 63 |type "sh| file -c|
|000001d0| 22 2e 0a 23 20 54 68 65 | 20 74 6f 6f 6c 20 74 68 |"..# The| tool th|
|000001e0| 61 74 20 67 65 6e 65 72 | 61 74 65 64 20 74 68 69 |at gener|ated thi|
|000001f0| 73 20 61 70 70 65 61 72 | 65 64 20 69 6e 20 74 68 |s appear|ed in th|
|00000200| 65 20 63 6f 6d 70 2e 73 | 6f 75 72 63 65 73 2e 75 |e comp.s|ources.u|
|00000210| 6e 69 78 20 6e 65 77 73 | 67 72 6f 75 70 3b 0a 23 |nix news|group;.#|
|00000220| 20 73 65 6e 64 20 6d 61 | 69 6c 20 74 6f 20 63 6f | send ma|il to co|
|00000230| 6d 70 2d 73 6f 75 72 63 | 65 73 2d 75 6e 69 78 40 |mp-sourc|es-unix@|
|00000240| 75 75 6e 65 74 2e 75 75 | 2e 6e 65 74 20 69 66 20 |uunet.uu|.net if |
|00000250| 79 6f 75 20 77 61 6e 74 | 20 74 68 61 74 20 74 6f |you want| that to|
|00000260| 6f 6c 2e 0a 23 20 43 6f | 6e 74 65 6e 74 73 3a 20 |ol..# Co|ntents: |
|00000270| 20 66 6c 65 78 64 6f 63 | 2e 31 2e 30 32 20 6d 69 | flexdoc|.1.02 mi|
|00000280| 73 63 2e 63 20 6e 66 61 | 2e 63 0a 23 20 57 72 61 |sc.c nfa|.c.# Wra|
|00000290| 70 70 65 64 20 62 79 20 | 72 73 61 6c 7a 40 6c 69 |pped by |rsalz@li|
|000002a0| 74 63 68 69 2e 62 62 6e | 2e 63 6f 6d 20 6f 6e 20 |tchi.bbn|.com on |
|000002b0| 57 65 64 20 4f 63 74 20 | 31 30 20 31 33 3a 32 34 |Wed Oct |10 13:24|
|000002c0| 3a 30 34 20 31 39 39 30 | 0a 50 41 54 48 3d 2f 62 |:04 1990|.PATH=/b|
|000002d0| 69 6e 3a 2f 75 73 72 2f | 62 69 6e 3a 2f 75 73 72 |in:/usr/|bin:/usr|
|000002e0| 2f 75 63 62 20 3b 20 65 | 78 70 6f 72 74 20 50 41 |/ucb ; e|xport PA|
|000002f0| 54 48 0a 65 63 68 6f 20 | 49 66 20 74 68 69 73 20 |TH.echo |If this |
|00000300| 61 72 63 68 69 76 65 20 | 69 73 20 63 6f 6d 70 6c |archive |is compl|
|00000310| 65 74 65 2c 20 79 6f 75 | 20 77 69 6c 6c 20 73 65 |ete, you| will se|
|00000320| 65 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |e the fo|llowing |
|00000330| 6d 65 73 73 61 67 65 3a | 0a 65 63 68 6f 20 27 20 |message:|.echo ' |
|00000340| 20 20 20 20 20 20 20 20 | 20 22 73 68 61 72 3a 20 | | "shar: |
|00000350| 45 6e 64 20 6f 66 20 61 | 72 63 68 69 76 65 20 38 |End of a|rchive 8|
|00000360| 20 28 6f 66 20 31 30 29 | 2e 22 27 0a 69 66 20 74 | (of 10)|."'.if t|
|00000370| 65 73 74 20 2d 66 20 27 | 66 6c 65 78 64 6f 63 2e |est -f '|flexdoc.|
|00000380| 31 2e 30 32 27 20 2d 61 | 20 22 24 7b 31 7d 22 20 |1.02' -a| "${1}" |
|00000390| 21 3d 20 22 2d 63 22 20 | 3b 20 74 68 65 6e 20 0a |!= "-c" |; then .|
|000003a0| 20 20 65 63 68 6f 20 73 | 68 61 72 3a 20 57 69 6c | echo s|har: Wil|
|000003b0| 6c 20 6e 6f 74 20 63 6c | 6f 62 62 65 72 20 65 78 |l not cl|obber ex|
|000003c0| 69 73 74 69 6e 67 20 66 | 69 6c 65 20 5c 22 27 66 |isting f|ile \"'f|
|000003d0| 6c 65 78 64 6f 63 2e 31 | 2e 30 32 27 5c 22 0a 65 |lexdoc.1|.02'\".e|
|000003e0| 6c 73 65 0a 20 20 65 63 | 68 6f 20 73 68 61 72 3a |lse. ec|ho shar:|
|000003f0| 20 45 78 74 72 61 63 74 | 69 6e 67 20 5c 22 27 66 | Extract|ing \"'f|
|00000400| 6c 65 78 64 6f 63 2e 31 | 2e 30 32 27 5c 22 20 5c |lexdoc.1|.02'\" \|
|00000410| 28 31 35 35 31 34 20 63 | 68 61 72 61 63 74 65 72 |(15514 c|haracter|
|00000420| 73 5c 29 0a 20 20 73 65 | 64 20 22 73 2f 5e 58 2f |s\). se|d "s/^X/|
|00000430| 2f 22 20 3e 27 66 6c 65 | 78 64 6f 63 2e 31 2e 30 |/" >'fle|xdoc.1.0|
|00000440| 32 27 20 3c 3c 27 45 4e | 44 5f 4f 46 5f 46 49 4c |2' <<'EN|D_OF_FIL|
|00000450| 45 27 0a 58 41 6e 6f 74 | 68 65 72 20 61 72 65 61 |E'.XAnot|her area|
|00000460| 20 77 68 65 72 65 20 74 | 68 65 20 75 73 65 72 20 | where t|he user |
|00000470| 63 61 6e 20 69 6e 63 72 | 65 61 73 65 20 61 20 73 |can incr|ease a s|
|00000480| 63 61 6e 6e 65 72 27 73 | 20 70 65 72 66 6f 72 6d |canner's| perform|
|00000490| 61 6e 63 65 0a 58 28 61 | 6e 64 20 6f 6e 65 20 74 |ance.X(a|nd one t|
|000004a0| 68 61 74 27 73 20 65 61 | 73 69 65 72 20 74 6f 20 |hat's ea|sier to |
|000004b0| 69 6d 70 6c 65 6d 65 6e | 74 29 20 61 72 69 73 65 |implemen|t) arise|
|000004c0| 73 20 66 72 6f 6d 20 74 | 68 65 20 66 61 63 74 20 |s from t|he fact |
|000004d0| 74 68 61 74 0a 58 74 68 | 65 20 6c 6f 6e 67 65 72 |that.Xth|e longer|
|000004e0| 20 74 68 65 20 74 6f 6b | 65 6e 73 20 6d 61 74 63 | the tok|ens matc|
|000004f0| 68 65 64 2c 20 74 68 65 | 20 66 61 73 74 65 72 20 |hed, the| faster |
|00000500| 74 68 65 20 73 63 61 6e | 6e 65 72 20 77 69 6c 6c |the scan|ner will|
|00000510| 20 72 75 6e 2e 0a 58 54 | 68 69 73 20 69 73 20 62 | run..XT|his is b|
|00000520| 65 63 61 75 73 65 20 77 | 69 74 68 20 6c 6f 6e 67 |ecause w|ith long|
|00000530| 20 74 6f 6b 65 6e 73 20 | 74 68 65 20 70 72 6f 63 | tokens |the proc|
|00000540| 65 73 73 69 6e 67 20 6f | 66 20 6d 6f 73 74 20 69 |essing o|f most i|
|00000550| 6e 70 75 74 0a 58 63 68 | 61 72 61 63 74 65 72 73 |nput.Xch|aracters|
|00000560| 20 74 61 6b 65 73 20 70 | 6c 61 63 65 20 69 6e 20 | takes p|lace in |
|00000570| 74 68 65 20 28 73 68 6f | 72 74 29 20 69 6e 6e 65 |the (sho|rt) inne|
|00000580| 72 20 73 63 61 6e 6e 69 | 6e 67 20 6c 6f 6f 70 2c |r scanni|ng loop,|
|00000590| 20 61 6e 64 0a 58 64 6f | 65 73 20 6e 6f 74 20 6f | and.Xdo|es not o|
|000005a0| 66 74 65 6e 20 68 61 76 | 65 20 74 6f 20 67 6f 20 |ften hav|e to go |
|000005b0| 74 68 72 6f 75 67 68 20 | 74 68 65 20 61 64 64 69 |through |the addi|
|000005c0| 74 69 6f 6e 61 6c 20 77 | 6f 72 6b 20 6f 66 20 73 |tional w|ork of s|
|000005d0| 65 74 74 69 6e 67 20 75 | 70 0a 58 74 68 65 20 73 |etting u|p.Xthe s|
|000005e0| 63 61 6e 6e 69 6e 67 20 | 65 6e 76 69 72 6f 6e 6d |canning |environm|
|000005f0| 65 6e 74 20 28 65 2e 67 | 2e 2c 0a 58 2e 42 20 79 |ent (e.g|.,.X.B y|
|00000600| 79 74 65 78 74 29 0a 58 | 66 6f 72 20 74 68 65 20 |ytext).X|for the |
|00000610| 61 63 74 69 6f 6e 2e 20 | 20 52 65 63 61 6c 6c 20 |action. | Recall |
|00000620| 74 68 65 20 73 63 61 6e | 6e 65 72 20 66 6f 72 20 |the scan|ner for |
|00000630| 43 20 63 6f 6d 6d 65 6e | 74 73 3a 0a 58 2e 6e 66 |C commen|ts:.X.nf|
|00000640| 0a 58 0a 58 20 20 20 20 | 25 78 20 63 6f 6d 6d 65 |.X.X |%x comme|
|00000650| 6e 74 0a 58 20 20 20 20 | 25 25 0a 58 20 20 20 20 |nt.X |%%.X |
|00000660| 20 20 20 20 20 20 20 20 | 69 6e 74 20 6c 69 6e 65 | |int line|
|00000670| 5f 6e 75 6d 20 3d 20 31 | 3b 0a 58 0a 58 20 20 20 |_num = 1|;.X.X |
|00000680| 20 22 2f 2a 22 20 20 20 | 20 20 20 20 20 20 42 45 | "/*" | BE|
|00000690| 47 49 4e 28 63 6f 6d 6d | 65 6e 74 29 3b 0a 58 0a |GIN(comm|ent);.X.|
|000006a0| 58 20 20 20 20 3c 63 6f | 6d 6d 65 6e 74 3e 5b 5e |X <co|mment>[^|
|000006b0| 2a 5c 5c 6e 5d 2a 0a 58 | 20 20 20 20 3c 63 6f 6d |*\\n]*.X| <com|
|000006c0| 6d 65 6e 74 3e 22 2a 22 | 2b 5b 5e 2a 2f 5c 5c 6e |ment>"*"|+[^*/\\n|
|000006d0| 5d 2a 0a 58 20 20 20 20 | 3c 63 6f 6d 6d 65 6e 74 |]*.X |<comment|
|000006e0| 3e 5c 5c 6e 20 20 20 20 | 20 20 20 20 20 20 20 20 |>\\n | |
|000006f0| 20 2b 2b 6c 69 6e 65 5f | 6e 75 6d 3b 0a 58 20 20 | ++line_|num;.X |
|00000700| 20 20 3c 63 6f 6d 6d 65 | 6e 74 3e 22 2a 22 2b 22 | <comme|nt>"*"+"|
|00000710| 2f 22 20 20 20 20 20 20 | 20 20 42 45 47 49 4e 28 |/" | BEGIN(|
|00000720| 49 4e 49 54 49 41 4c 29 | 3b 0a 58 0a 58 2e 66 69 |INITIAL)|;.X.X.fi|
|00000730| 0a 58 54 68 69 73 20 63 | 6f 75 6c 64 20 62 65 20 |.XThis c|ould be |
|00000740| 73 70 65 64 20 75 70 20 | 62 79 20 77 72 69 74 69 |sped up |by writi|
|00000750| 6e 67 20 69 74 20 61 73 | 3a 0a 58 2e 6e 66 0a 58 |ng it as|:.X.nf.X|
|00000760| 0a 58 20 20 20 20 25 78 | 20 63 6f 6d 6d 65 6e 74 |.X %x| comment|
|00000770| 0a 58 20 20 20 20 25 25 | 0a 58 20 20 20 20 20 20 |.X %%|.X |
|00000780| 20 20 20 20 20 20 69 6e | 74 20 6c 69 6e 65 5f 6e | in|t line_n|
|00000790| 75 6d 20 3d 20 31 3b 0a | 58 0a 58 20 20 20 20 22 |um = 1;.|X.X "|
|000007a0| 2f 2a 22 20 20 20 20 20 | 20 20 20 20 42 45 47 49 |/*" | BEGI|
|000007b0| 4e 28 63 6f 6d 6d 65 6e | 74 29 3b 0a 58 0a 58 20 |N(commen|t);.X.X |
|000007c0| 20 20 20 3c 63 6f 6d 6d | 65 6e 74 3e 5b 5e 2a 5c | <comm|ent>[^*\|
|000007d0| 5c 6e 5d 2a 0a 58 20 20 | 20 20 3c 63 6f 6d 6d 65 |\n]*.X | <comme|
|000007e0| 6e 74 3e 5b 5e 2a 5c 5c | 6e 5d 2a 5c 5c 6e 20 20 |nt>[^*\\|n]*\\n |
|000007f0| 20 20 20 20 2b 2b 6c 69 | 6e 65 5f 6e 75 6d 3b 0a | ++li|ne_num;.|
|00000800| 58 20 20 20 20 3c 63 6f | 6d 6d 65 6e 74 3e 22 2a |X <co|mment>"*|
|00000810| 22 2b 5b 5e 2a 2f 5c 5c | 6e 5d 2a 0a 58 20 20 20 |"+[^*/\\|n]*.X |
|00000820| 20 3c 63 6f 6d 6d 65 6e | 74 3e 22 2a 22 2b 5b 5e | <commen|t>"*"+[^|
|00000830| 2a 2f 5c 5c 6e 5d 2a 5c | 5c 6e 20 2b 2b 6c 69 6e |*/\\n]*\|\n ++lin|
|00000840| 65 5f 6e 75 6d 3b 0a 58 | 20 20 20 20 3c 63 6f 6d |e_num;.X| <com|
|00000850| 6d 65 6e 74 3e 22 2a 22 | 2b 22 2f 22 20 20 20 20 |ment>"*"|+"/" |
|00000860| 20 20 20 20 42 45 47 49 | 4e 28 49 4e 49 54 49 41 | BEGI|N(INITIA|
|00000870| 4c 29 3b 0a 58 0a 58 2e | 66 69 0a 58 4e 6f 77 20 |L);.X.X.|fi.XNow |
|00000880| 69 6e 73 74 65 61 64 20 | 6f 66 20 65 61 63 68 20 |instead |of each |
|00000890| 6e 65 77 6c 69 6e 65 20 | 72 65 71 75 69 72 69 6e |newline |requirin|
|000008a0| 67 20 74 68 65 20 70 72 | 6f 63 65 73 73 69 6e 67 |g the pr|ocessing|
|000008b0| 20 6f 66 20 61 6e 6f 74 | 68 65 72 0a 58 61 63 74 | of anot|her.Xact|
|000008c0| 69 6f 6e 2c 20 72 65 63 | 6f 67 6e 69 7a 69 6e 67 |ion, rec|ognizing|
|000008d0| 20 74 68 65 20 6e 65 77 | 6c 69 6e 65 73 20 69 73 | the new|lines is|
|000008e0| 20 22 64 69 73 74 72 69 | 62 75 74 65 64 22 20 6f | "distri|buted" o|
|000008f0| 76 65 72 20 74 68 65 20 | 6f 74 68 65 72 20 72 75 |ver the |other ru|
|00000900| 6c 65 73 0a 58 74 6f 20 | 6b 65 65 70 20 74 68 65 |les.Xto |keep the|
|00000910| 20 6d 61 74 63 68 65 64 | 20 74 65 78 74 20 61 73 | matched| text as|
|00000920| 20 6c 6f 6e 67 20 61 73 | 20 70 6f 73 73 69 62 6c | long as| possibl|
|00000930| 65 2e 20 20 4e 6f 74 65 | 20 74 68 61 74 0a 58 2e |e. Note| that.X.|
|00000940| 49 20 61 64 64 69 6e 67 | 0a 58 72 75 6c 65 73 20 |I adding|.Xrules |
|00000950| 64 6f 65 73 0a 58 2e 49 | 20 6e 6f 74 0a 58 73 6c |does.X.I| not.Xsl|
|00000960| 6f 77 20 64 6f 77 6e 20 | 74 68 65 20 73 63 61 6e |ow down |the scan|
|00000970| 6e 65 72 21 20 20 54 68 | 65 20 73 70 65 65 64 20 |ner! Th|e speed |
|00000980| 6f 66 20 74 68 65 20 73 | 63 61 6e 6e 65 72 20 69 |of the s|canner i|
|00000990| 73 20 69 6e 64 65 70 65 | 6e 64 65 6e 74 0a 58 6f |s indepe|ndent.Xo|
|000009a0| 66 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |f the nu|mber of |
|000009b0| 72 75 6c 65 73 20 6f 72 | 20 28 6d 6f 64 75 6c 6f |rules or| (modulo|
|000009c0| 20 74 68 65 20 63 6f 6e | 73 69 64 65 72 61 74 69 | the con|siderati|
|000009d0| 6f 6e 73 20 67 69 76 65 | 6e 20 61 74 20 74 68 65 |ons give|n at the|
|000009e0| 0a 58 62 65 67 69 6e 6e | 69 6e 67 20 6f 66 20 74 |.Xbeginn|ing of t|
|000009f0| 68 69 73 20 73 65 63 74 | 69 6f 6e 29 20 68 6f 77 |his sect|ion) how|
|00000a00| 20 63 6f 6d 70 6c 69 63 | 61 74 65 64 20 74 68 65 | complic|ated the|
|00000a10| 20 72 75 6c 65 73 20 61 | 72 65 20 77 69 74 68 0a | rules a|re with.|
|00000a20| 58 72 65 67 61 72 64 20 | 74 6f 20 6f 70 65 72 61 |Xregard |to opera|
|00000a30| 74 6f 72 73 20 73 75 63 | 68 20 61 73 20 27 2a 27 |tors suc|h as '*'|
|00000a40| 20 61 6e 64 20 27 7c 27 | 2e 0a 58 2e 4c 50 0a 58 | and '|'|..X.LP.X|
|00000a50| 41 20 66 69 6e 61 6c 20 | 65 78 61 6d 70 6c 65 20 |A final |example |
|00000a60| 69 6e 20 73 70 65 65 64 | 69 6e 67 20 75 70 20 61 |in speed|ing up a|
|00000a70| 20 73 63 61 6e 6e 65 72 | 3a 20 73 75 70 70 6f 73 | scanner|: suppos|
|00000a80| 65 20 79 6f 75 20 77 61 | 6e 74 20 74 6f 20 73 63 |e you wa|nt to sc|
|00000a90| 61 6e 0a 58 74 68 72 6f | 75 67 68 20 61 20 66 69 |an.Xthro|ugh a fi|
|00000aa0| 6c 65 20 63 6f 6e 74 61 | 69 6e 69 6e 67 20 69 64 |le conta|ining id|
|00000ab0| 65 6e 74 69 66 69 65 72 | 73 20 61 6e 64 20 6b 65 |entifier|s and ke|
|00000ac0| 79 77 6f 72 64 73 2c 20 | 6f 6e 65 20 70 65 72 20 |ywords, |one per |
|00000ad0| 6c 69 6e 65 0a 58 61 6e | 64 20 77 69 74 68 20 6e |line.Xan|d with n|
|00000ae0| 6f 20 6f 74 68 65 72 20 | 65 78 74 72 61 6e 65 6f |o other |extraneo|
|00000af0| 75 73 20 63 68 61 72 61 | 63 74 65 72 73 2c 20 61 |us chara|cters, a|
|00000b00| 6e 64 20 72 65 63 6f 67 | 6e 69 7a 65 20 61 6c 6c |nd recog|nize all|
|00000b10| 20 74 68 65 0a 58 6b 65 | 79 77 6f 72 64 73 2e 20 | the.Xke|ywords. |
|00000b20| 20 41 20 6e 61 74 75 72 | 61 6c 20 66 69 72 73 74 | A natur|al first|
|00000b30| 20 61 70 70 72 6f 61 63 | 68 20 69 73 3a 0a 58 2e | approac|h is:.X.|
|00000b40| 6e 66 0a 58 0a 58 20 20 | 20 20 25 25 0a 58 20 20 |nf.X.X | %%.X |
|00000b50| 20 20 61 73 6d 20 20 20 | 20 20 20 7c 0a 58 20 20 | asm | |.X |
|00000b60| 20 20 61 75 74 6f 20 20 | 20 20 20 7c 0a 58 20 20 | auto | |.X |
|00000b70| 20 20 62 72 65 61 6b 20 | 20 20 20 7c 0a 58 20 20 | break | |.X |
|00000b80| 20 20 2e 2e 2e 20 65 74 | 63 20 2e 2e 2e 0a 58 20 | ... et|c ....X |
|00000b90| 20 20 20 76 6f 6c 61 74 | 69 6c 65 20 7c 0a 58 20 | volat|ile |.X |
|00000ba0| 20 20 20 77 68 69 6c 65 | 20 20 20 20 2f 2a 20 69 | while| /* i|
|00000bb0| 74 27 73 20 61 20 6b 65 | 79 77 6f 72 64 20 2a 2f |t's a ke|yword */|
|00000bc0| 0a 58 0a 58 20 20 20 20 | 2e 7c 5c 5c 6e 20 20 20 |.X.X |.|\\n |
|00000bd0| 20 20 2f 2a 20 69 74 27 | 73 20 6e 6f 74 20 61 20 | /* it'|s not a |
|00000be0| 6b 65 79 77 6f 72 64 20 | 2a 2f 0a 58 0a 58 2e 66 |keyword |*/.X.X.f|
|00000bf0| 69 0a 58 54 6f 20 65 6c | 69 6d 69 6e 61 74 65 20 |i.XTo el|iminate |
|00000c00| 74 68 65 20 62 61 63 6b | 2d 74 72 61 63 6b 69 6e |the back|-trackin|
|00000c10| 67 2c 20 69 6e 74 72 6f | 64 75 63 65 20 61 20 63 |g, intro|duce a c|
|00000c20| 61 74 63 68 2d 61 6c 6c | 20 72 75 6c 65 3a 0a 58 |atch-all| rule:.X|
|00000c30| 2e 6e 66 0a 58 0a 58 20 | 20 20 20 25 25 0a 58 20 |.nf.X.X | %%.X |
|00000c40| 20 20 20 61 73 6d 20 20 | 20 20 20 20 7c 0a 58 20 | asm | |.X |
|00000c50| 20 20 20 61 75 74 6f 20 | 20 20 20 20 7c 0a 58 20 | auto | |.X |
|00000c60| 20 20 20 62 72 65 61 6b | 20 20 20 20 7c 0a 58 20 | break| |.X |
|00000c70| 20 20 20 2e 2e 2e 20 65 | 74 63 20 2e 2e 2e 0a 58 | ... e|tc ....X|
|00000c80| 20 20 20 20 76 6f 6c 61 | 74 69 6c 65 20 7c 0a 58 | vola|tile |.X|
|00000c90| 20 20 20 20 77 68 69 6c | 65 20 20 20 20 2f 2a 20 | whil|e /* |
|00000ca0| 69 74 27 73 20 61 20 6b | 65 79 77 6f 72 64 20 2a |it's a k|eyword *|
|00000cb0| 2f 0a 58 0a 58 20 20 20 | 20 5b 61 2d 7a 5d 2b 20 |/.X.X | [a-z]+ |
|00000cc0| 20 20 7c 0a 58 20 20 20 | 20 2e 7c 5c 5c 6e 20 20 | |.X | .|\\n |
|00000cd0| 20 20 20 2f 2a 20 69 74 | 27 73 20 6e 6f 74 20 61 | /* it|'s not a|
|00000ce0| 20 6b 65 79 77 6f 72 64 | 20 2a 2f 0a 58 0a 58 2e | keyword| */.X.X.|
|00000cf0| 66 69 0a 58 4e 6f 77 2c | 20 69 66 20 69 74 27 73 |fi.XNow,| if it's|
|00000d00| 20 67 75 61 72 61 6e 74 | 65 65 64 20 74 68 61 74 | guarant|eed that|
|00000d10| 20 74 68 65 72 65 27 73 | 20 65 78 61 63 74 6c 79 | there's| exactly|
|00000d20| 20 6f 6e 65 20 77 6f 72 | 64 20 70 65 72 20 6c 69 | one wor|d per li|
|00000d30| 6e 65 2c 0a 58 74 68 65 | 6e 20 77 65 20 63 61 6e |ne,.Xthe|n we can|
|00000d40| 20 72 65 64 75 63 65 20 | 74 68 65 20 74 6f 74 61 | reduce |the tota|
|00000d50| 6c 20 6e 75 6d 62 65 72 | 20 6f 66 20 6d 61 74 63 |l number| of matc|
|00000d60| 68 65 73 20 62 79 20 61 | 20 68 61 6c 66 20 62 79 |hes by a| half by|
|00000d70| 0a 58 6d 65 72 67 69 6e | 67 20 69 6e 20 74 68 65 |.Xmergin|g in the|
|00000d80| 20 72 65 63 6f 67 6e 69 | 74 69 6f 6e 20 6f 66 20 | recogni|tion of |
|00000d90| 6e 65 77 6c 69 6e 65 73 | 20 77 69 74 68 20 74 68 |newlines| with th|
|00000da0| 61 74 20 6f 66 20 74 68 | 65 20 6f 74 68 65 72 0a |at of th|e other.|
|00000db0| 58 74 6f 6b 65 6e 73 3a | 0a 58 2e 6e 66 0a 58 0a |Xtokens:|.X.nf.X.|
|00000dc0| 58 20 20 20 20 25 25 0a | 58 20 20 20 20 61 73 6d |X %%.|X asm|
|00000dd0| 5c 5c 6e 20 20 20 20 7c | 0a 58 20 20 20 20 61 75 |\\n ||.X au|
|00000de0| 74 6f 5c 5c 6e 20 20 20 | 7c 0a 58 20 20 20 20 62 |to\\n ||.X b|
|00000df0| 72 65 61 6b 5c 5c 6e 20 | 20 7c 0a 58 20 20 20 20 |reak\\n | |.X |
|00000e00| 2e 2e 2e 20 65 74 63 20 | 2e 2e 2e 0a 58 20 20 20 |... etc |....X |
|00000e10| 20 76 6f 6c 61 74 69 6c | 65 5c 5c 6e 20 7c 0a 58 | volatil|e\\n |.X|
|00000e20| 20 20 20 20 77 68 69 6c | 65 5c 5c 6e 20 20 2f 2a | whil|e\\n /*|
|00000e30| 20 69 74 27 73 20 61 20 | 6b 65 79 77 6f 72 64 20 | it's a |keyword |
|00000e40| 2a 2f 0a 58 0a 58 20 20 | 20 20 5b 61 2d 7a 5d 2b |*/.X.X | [a-z]+|
|00000e50| 5c 5c 6e 20 7c 0a 58 20 | 20 20 20 2e 7c 5c 5c 6e |\\n |.X | .|\\n|
|00000e60| 20 20 20 20 20 2f 2a 20 | 69 74 27 73 20 6e 6f 74 | /* |it's not|
|00000e70| 20 61 20 6b 65 79 77 6f | 72 64 20 2a 2f 0a 58 0a | a keywo|rd */.X.|
|00000e80| 58 2e 66 69 0a 58 4f 6e | 65 20 68 61 73 20 74 6f |X.fi.XOn|e has to|
|00000e90| 20 62 65 20 63 61 72 65 | 66 75 6c 20 68 65 72 65 | be care|ful here|
|00000ea0| 2c 20 61 73 20 77 65 20 | 68 61 76 65 20 6e 6f 77 |, as we |have now|
|00000eb0| 20 72 65 69 6e 74 72 6f | 64 75 63 65 64 20 62 61 | reintro|duced ba|
|00000ec0| 63 6b 74 72 61 63 6b 69 | 6e 67 0a 58 69 6e 74 6f |cktracki|ng.Xinto|
|00000ed0| 20 74 68 65 20 73 63 61 | 6e 6e 65 72 2e 20 20 49 | the sca|nner. I|
|00000ee0| 6e 20 70 61 72 74 69 63 | 75 6c 61 72 2c 20 77 68 |n partic|ular, wh|
|00000ef0| 69 6c 65 0a 58 2e 49 20 | 77 65 0a 58 6b 6e 6f 77 |ile.X.I |we.Xknow|
|00000f00| 20 74 68 61 74 20 74 68 | 65 72 65 20 77 69 6c 6c | that th|ere will|
|00000f10| 20 6e 65 76 65 72 20 62 | 65 20 61 6e 79 20 63 68 | never b|e any ch|
|00000f20| 61 72 61 63 74 65 72 73 | 20 69 6e 20 74 68 65 20 |aracters| in the |
|00000f30| 69 6e 70 75 74 20 73 74 | 72 65 61 6d 0a 58 6f 74 |input st|ream.Xot|
|00000f40| 68 65 72 20 74 68 61 6e | 20 6c 65 74 74 65 72 73 |her than| letters|
|00000f50| 20 6f 72 20 6e 65 77 6c | 69 6e 65 73 2c 0a 58 2e | or newl|ines,.X.|
|00000f60| 49 20 66 6c 65 78 0a 58 | 63 61 6e 27 74 20 66 69 |I flex.X|can't fi|
|00000f70| 67 75 72 65 20 74 68 69 | 73 20 6f 75 74 2c 20 61 |gure thi|s out, a|
|00000f80| 6e 64 20 69 74 20 77 69 | 6c 6c 20 70 6c 61 6e 20 |nd it wi|ll plan |
|00000f90| 66 6f 72 20 70 6f 73 73 | 69 62 6c 79 20 6e 65 65 |for poss|ibly nee|
|00000fa0| 64 69 6e 67 20 62 61 63 | 6b 74 72 61 63 6b 69 6e |ding bac|ktrackin|
|00000fb0| 67 0a 58 77 68 65 6e 20 | 69 74 20 68 61 73 20 73 |g.Xwhen |it has s|
|00000fc0| 63 61 6e 6e 65 64 20 61 | 20 74 6f 6b 65 6e 20 6c |canned a| token l|
|00000fd0| 69 6b 65 20 22 61 75 74 | 6f 22 20 61 6e 64 20 74 |ike "aut|o" and t|
|00000fe0| 68 65 6e 20 74 68 65 20 | 6e 65 78 74 20 63 68 61 |hen the |next cha|
|00000ff0| 72 61 63 74 65 72 0a 58 | 69 73 20 73 6f 6d 65 74 |racter.X|is somet|
|00001000| 68 69 6e 67 20 6f 74 68 | 65 72 20 74 68 61 6e 20 |hing oth|er than |
|00001010| 61 20 6e 65 77 6c 69 6e | 65 20 6f 72 20 61 20 6c |a newlin|e or a l|
|00001020| 65 74 74 65 72 2e 20 20 | 50 72 65 76 69 6f 75 73 |etter. |Previous|
|00001030| 6c 79 20 69 74 20 77 6f | 75 6c 64 0a 58 74 68 65 |ly it wo|uld.Xthe|
|00001040| 6e 20 6a 75 73 74 20 6d | 61 74 63 68 20 74 68 65 |n just m|atch the|
|00001050| 20 22 61 75 74 6f 22 20 | 72 75 6c 65 20 61 6e 64 | "auto" |rule and|
|00001060| 20 62 65 20 64 6f 6e 65 | 2c 20 62 75 74 20 6e 6f | be done|, but no|
|00001070| 77 20 69 74 20 68 61 73 | 20 6e 6f 20 22 61 75 74 |w it has| no "aut|
|00001080| 6f 22 0a 58 72 75 6c 65 | 2c 20 6f 6e 6c 79 20 61 |o".Xrule|, only a|
|00001090| 20 22 61 75 74 6f 5c 5c | 6e 22 20 72 75 6c 65 2e | "auto\\|n" rule.|
|000010a0| 20 20 54 6f 20 65 6c 69 | 6d 69 6e 61 74 65 20 74 | To eli|minate t|
|000010b0| 68 65 20 70 6f 73 73 69 | 62 69 6c 69 74 79 20 6f |he possi|bility o|
|000010c0| 66 20 62 61 63 6b 74 72 | 61 63 6b 69 6e 67 2c 0a |f backtr|acking,.|
|000010d0| 58 77 65 20 63 6f 75 6c | 64 20 65 69 74 68 65 72 |Xwe coul|d either|
|000010e0| 20 64 75 70 6c 69 63 61 | 74 65 20 61 6c 6c 20 72 | duplica|te all r|
|000010f0| 75 6c 65 73 20 62 75 74 | 20 77 69 74 68 6f 75 74 |ules but| without|
|00001100| 20 66 69 6e 61 6c 20 6e | 65 77 6c 69 6e 65 73 2c | final n|ewlines,|
|00001110| 20 6f 72 2c 0a 58 73 69 | 6e 63 65 20 77 65 20 6e | or,.Xsi|nce we n|
|00001120| 65 76 65 72 20 65 78 70 | 65 63 74 20 74 6f 20 65 |ever exp|ect to e|
|00001130| 6e 63 6f 75 6e 74 65 72 | 20 73 75 63 68 20 61 6e |ncounter| such an|
|00001140| 20 69 6e 70 75 74 20 61 | 6e 64 20 74 68 65 72 65 | input a|nd there|
|00001150| 66 6f 72 65 20 64 6f 6e | 27 74 0a 58 68 6f 77 20 |fore don|'t.Xhow |
|00001160| 69 74 27 73 20 63 6c 61 | 73 73 69 66 69 65 64 2c |it's cla|ssified,|
|00001170| 20 77 65 20 63 61 6e 20 | 69 6e 74 72 6f 64 75 63 | we can |introduc|
|00001180| 65 20 6f 6e 65 20 6d 6f | 72 65 20 63 61 74 63 68 |e one mo|re catch|
|00001190| 2d 61 6c 6c 20 72 75 6c | 65 2c 20 74 68 69 73 0a |-all rul|e, this.|
|000011a0| 58 6f 6e 65 20 77 68 69 | 63 68 20 64 6f 65 73 6e |Xone whi|ch doesn|
|000011b0| 27 74 20 69 6e 63 6c 75 | 64 65 20 61 20 6e 65 77 |'t inclu|de a new|
|000011c0| 6c 69 6e 65 3a 0a 58 2e | 6e 66 0a 58 0a 58 20 20 |line:.X.|nf.X.X |
|000011d0| 20 20 25 25 0a 58 20 20 | 20 20 61 73 6d 5c 5c 6e | %%.X | asm\\n|
|000011e0| 20 20 20 20 7c 0a 58 20 | 20 20 20 61 75 74 6f 5c | |.X | auto\|
|000011f0| 5c 6e 20 20 20 7c 0a 58 | 20 20 20 20 62 72 65 61 |\n |.X| brea|
|00001200| 6b 5c 5c 6e 20 20 7c 0a | 58 20 20 20 20 2e 2e 2e |k\\n |.|X ...|
|00001210| 20 65 74 63 20 2e 2e 2e | 0a 58 20 20 20 20 76 6f | etc ...|.X vo|
|00001220| 6c 61 74 69 6c 65 5c 5c | 6e 20 7c 0a 58 20 20 20 |latile\\|n |.X |
|00001230| 20 77 68 69 6c 65 5c 5c | 6e 20 20 2f 2a 20 69 74 | while\\|n /* it|
|00001240| 27 73 20 61 20 6b 65 79 | 77 6f 72 64 20 2a 2f 0a |'s a key|word */.|
|00001250| 58 0a 58 20 20 20 20 5b | 61 2d 7a 5d 2b 5c 5c 6e |X.X [|a-z]+\\n|
|00001260| 20 7c 0a 58 20 20 20 20 | 5b 61 2d 7a 5d 2b 20 20 | |.X |[a-z]+ |
|00001270| 20 7c 0a 58 20 20 20 20 | 2e 7c 5c 5c 6e 20 20 20 | |.X |.|\\n |
|00001280| 20 20 2f 2a 20 69 74 27 | 73 20 6e 6f 74 20 61 20 | /* it'|s not a |
|00001290| 6b 65 79 77 6f 72 64 20 | 2a 2f 0a 58 0a 58 2e 66 |keyword |*/.X.X.f|
|000012a0| 69 0a 58 43 6f 6d 70 69 | 6c 65 64 20 77 69 74 68 |i.XCompi|led with|
|000012b0| 0a 58 2e 42 20 2d 43 66 | 2c 0a 58 74 68 69 73 20 |.X.B -Cf|,.Xthis |
|000012c0| 69 73 20 61 62 6f 75 74 | 20 61 73 20 66 61 73 74 |is about| as fast|
|000012d0| 20 61 73 20 6f 6e 65 20 | 63 61 6e 20 67 65 74 20 | as one |can get |
|000012e0| 61 0a 58 2e 49 20 66 6c | 65 78 20 0a 58 73 63 61 |a.X.I fl|ex .Xsca|
|000012f0| 6e 6e 65 72 20 74 6f 20 | 67 6f 20 66 6f 72 20 74 |nner to |go for t|
|00001300| 68 69 73 20 70 61 72 74 | 69 63 75 6c 61 72 20 70 |his part|icular p|
|00001310| 72 6f 62 6c 65 6d 2e 0a | 58 2e 4c 50 0a 58 41 20 |roblem..|X.LP.XA |
|00001320| 66 69 6e 61 6c 20 6e 6f | 74 65 3a 0a 58 2e 49 20 |final no|te:.X.I |
|00001330| 66 6c 65 78 0a 58 69 73 | 20 73 6c 6f 77 20 77 68 |flex.Xis| slow wh|
|00001340| 65 6e 20 6d 61 74 63 68 | 69 6e 67 20 4e 55 4c 27 |en match|ing NUL'|
|00001350| 73 2c 20 70 61 72 74 69 | 63 75 6c 61 72 6c 79 20 |s, parti|cularly |
|00001360| 77 68 65 6e 20 61 20 74 | 6f 6b 65 6e 20 63 6f 6e |when a t|oken con|
|00001370| 74 61 69 6e 73 0a 58 6d | 75 6c 74 69 70 6c 65 20 |tains.Xm|ultiple |
|00001380| 4e 55 4c 27 73 2e 0a 58 | 49 74 27 73 20 62 65 73 |NUL's..X|It's bes|
|00001390| 74 20 74 6f 20 77 72 69 | 74 65 20 72 75 6c 65 73 |t to wri|te rules|
|000013a0| 20 77 68 69 63 68 20 6d | 61 74 63 68 0a 58 2e 49 | which m|atch.X.I|
|000013b0| 20 73 68 6f 72 74 0a 58 | 61 6d 6f 75 6e 74 73 20 | short.X|amounts |
|000013c0| 6f 66 20 74 65 78 74 20 | 69 66 20 69 74 27 73 20 |of text |if it's |
|000013d0| 61 6e 74 69 63 69 70 61 | 74 65 64 20 74 68 61 74 |anticipa|ted that|
|000013e0| 20 74 68 65 20 74 65 78 | 74 20 77 69 6c 6c 20 6f | the tex|t will o|
|000013f0| 66 74 65 6e 20 69 6e 63 | 6c 75 64 65 20 4e 55 4c |ften inc|lude NUL|
|00001400| 27 73 2e 0a 58 2e 53 48 | 20 49 4e 43 4f 4d 50 41 |'s..X.SH| INCOMPA|
|00001410| 54 49 42 49 4c 49 54 49 | 45 53 20 57 49 54 48 20 |TIBILITI|ES WITH |
|00001420| 4c 45 58 20 41 4e 44 20 | 50 4f 53 49 58 0a 58 2e |LEX AND |POSIX.X.|
|00001430| 49 20 66 6c 65 78 0a 58 | 69 73 20 61 20 72 65 77 |I flex.X|is a rew|
|00001440| 72 69 74 65 20 6f 66 20 | 74 68 65 20 55 6e 69 78 |rite of |the Unix|
|00001450| 0a 58 2e 49 20 6c 65 78 | 0a 58 74 6f 6f 6c 20 28 |.X.I lex|.Xtool (|
|00001460| 74 68 65 20 74 77 6f 20 | 69 6d 70 6c 65 6d 65 6e |the two |implemen|
|00001470| 74 61 74 69 6f 6e 73 20 | 64 6f 20 6e 6f 74 20 73 |tations |do not s|
|00001480| 68 61 72 65 20 61 6e 79 | 20 63 6f 64 65 2c 20 74 |hare any| code, t|
|00001490| 68 6f 75 67 68 29 2c 0a | 58 77 69 74 68 20 73 6f |hough),.|Xwith so|
|000014a0| 6d 65 20 65 78 74 65 6e | 73 69 6f 6e 73 20 61 6e |me exten|sions an|
|000014b0| 64 20 69 6e 63 6f 6d 70 | 61 74 69 62 69 6c 69 74 |d incomp|atibilit|
|000014c0| 69 65 73 2c 20 62 6f 74 | 68 20 6f 66 20 77 68 69 |ies, bot|h of whi|
|000014d0| 63 68 0a 58 61 72 65 20 | 6f 66 20 63 6f 6e 63 65 |ch.Xare |of conce|
|000014e0| 72 6e 20 74 6f 20 74 68 | 6f 73 65 20 77 68 6f 20 |rn to th|ose who |
|000014f0| 77 69 73 68 20 74 6f 20 | 77 72 69 74 65 20 73 63 |wish to |write sc|
|00001500| 61 6e 6e 65 72 73 20 61 | 63 63 65 70 74 61 62 6c |anners a|cceptabl|
|00001510| 65 0a 58 74 6f 20 65 69 | 74 68 65 72 20 69 6d 70 |e.Xto ei|ther imp|
|00001520| 6c 65 6d 65 6e 74 61 74 | 69 6f 6e 2e 20 20 41 74 |lementat|ion. At|
|00001530| 20 70 72 65 73 65 6e 74 | 2c 20 74 68 65 20 50 4f | present|, the PO|
|00001540| 53 49 58 0a 58 2e 49 20 | 6c 65 78 0a 58 64 72 61 |SIX.X.I |lex.Xdra|
|00001550| 66 74 20 69 73 0a 58 76 | 65 72 79 20 63 6c 6f 73 |ft is.Xv|ery clos|
|00001560| 65 20 74 6f 20 74 68 65 | 20 6f 72 69 67 69 6e 61 |e to the| origina|
|00001570| 6c 0a 58 2e 49 20 6c 65 | 78 0a 58 69 6d 70 6c 65 |l.X.I le|x.Ximple|
|00001580| 6d 65 6e 74 61 74 69 6f | 6e 2c 20 73 6f 20 73 6f |mentatio|n, so so|
|00001590| 6d 65 20 6f 66 20 74 68 | 65 73 65 0a 58 69 6e 63 |me of th|ese.Xinc|
|000015a0| 6f 6d 70 61 74 69 62 69 | 6c 69 74 69 65 73 20 61 |ompatibi|lities a|
|000015b0| 72 65 20 61 6c 73 6f 20 | 69 6e 20 63 6f 6e 66 6c |re also |in confl|
|000015c0| 69 63 74 20 77 69 74 68 | 20 74 68 65 20 50 4f 53 |ict with| the POS|
|000015d0| 49 58 20 64 72 61 66 74 | 2e 20 20 42 75 74 0a 58 |IX draft|. But.X|
|000015e0| 74 68 65 20 69 6e 74 65 | 6e 74 20 69 73 20 74 68 |the inte|nt is th|
|000015f0| 61 74 20 65 78 63 65 70 | 74 20 61 73 20 6e 6f 74 |at excep|t as not|
|00001600| 65 64 20 62 65 6c 6f 77 | 2c 0a 58 2e 49 20 66 6c |ed below|,.X.I fl|
|00001610| 65 78 0a 58 61 73 20 69 | 74 20 70 72 65 73 65 6e |ex.Xas i|t presen|
|00001620| 74 6c 79 20 73 74 61 6e | 64 73 20 77 69 6c 6c 0a |tly stan|ds will.|
|00001630| 58 75 6c 74 69 6d 61 74 | 65 6c 79 20 62 65 20 50 |Xultimat|ely be P|
|00001640| 4f 53 49 58 20 63 6f 6e | 66 6f 72 6d 61 6e 74 20 |OSIX con|formant |
|00001650| 28 69 2e 65 2e 2c 20 74 | 68 61 74 20 74 68 6f 73 |(i.e., t|hat thos|
|00001660| 65 20 61 72 65 61 73 20 | 6f 66 20 63 6f 6e 66 6c |e areas |of confl|
|00001670| 69 63 74 20 77 69 74 68 | 0a 58 74 68 65 20 50 4f |ict with|.Xthe PO|
|00001680| 53 49 58 20 64 72 61 66 | 74 20 77 69 6c 6c 20 62 |SIX draf|t will b|
|00001690| 65 20 72 65 73 6f 6c 76 | 65 64 20 69 6e 0a 58 2e |e resolv|ed in.X.|
|000016a0| 49 20 66 6c 65 78 27 73 | 0a 58 66 61 76 6f 72 29 |I flex's|.Xfavor)|
|000016b0| 2e 20 20 50 6c 65 61 73 | 65 20 62 65 61 72 20 69 |. Pleas|e bear i|
|000016c0| 6e 0a 58 6d 69 6e 64 20 | 74 68 61 74 20 61 6c 6c |n.Xmind |that all|
|000016d0| 20 74 68 65 20 63 6f 6d | 6d 65 6e 74 73 20 77 68 | the com|ments wh|
|000016e0| 69 63 68 20 66 6f 6c 6c | 6f 77 20 61 72 65 20 77 |ich foll|ow are w|
|000016f0| 69 74 68 20 72 65 67 61 | 72 64 20 74 6f 20 74 68 |ith rega|rd to th|
|00001700| 65 20 50 4f 53 49 58 0a | 58 2e 49 20 64 72 61 66 |e POSIX.|X.I draf|
|00001710| 74 0a 58 73 74 61 6e 64 | 61 72 64 20 6f 66 20 53 |t.Xstand|ard of S|
|00001720| 75 6d 6d 65 72 20 31 39 | 38 39 2c 20 61 6e 64 20 |ummer 19|89, and |
|00001730| 6e 6f 74 20 74 68 65 20 | 66 69 6e 61 6c 20 64 6f |not the |final do|
|00001740| 63 75 6d 65 6e 74 20 28 | 6f 72 20 73 75 62 73 65 |cument (|or subse|
|00001750| 71 75 65 6e 74 0a 58 64 | 72 61 66 74 73 29 3b 20 |quent.Xd|rafts); |
|00001760| 74 68 65 79 20 61 72 65 | 20 69 6e 63 6c 75 64 65 |they are| include|
|00001770| 64 20 73 6f 0a 58 2e 49 | 20 66 6c 65 78 0a 58 75 |d so.X.I| flex.Xu|
|00001780| 73 65 72 73 20 63 61 6e | 20 62 65 20 61 77 61 72 |sers can| be awar|
|00001790| 65 20 6f 66 20 74 68 65 | 20 73 74 61 6e 64 61 72 |e of the| standar|
|000017a0| 64 69 7a 61 74 69 6f 6e | 20 69 73 73 75 65 73 20 |dization| issues |
|000017b0| 61 6e 64 20 74 68 6f 73 | 65 20 61 72 65 61 73 20 |and thos|e areas |
|000017c0| 77 68 65 72 65 0a 58 2e | 49 20 66 6c 65 78 0a 58 |where.X.|I flex.X|
|000017d0| 6d 61 79 20 69 6e 20 74 | 68 65 20 6e 65 61 72 20 |may in t|he near |
|000017e0| 66 75 74 75 72 65 20 75 | 6e 64 65 72 67 6f 20 63 |future u|ndergo c|
|000017f0| 68 61 6e 67 65 73 20 69 | 6e 63 6f 6d 70 61 74 69 |hanges i|ncompati|
|00001800| 62 6c 65 20 77 69 74 68 | 0a 58 69 74 73 20 63 75 |ble with|.Xits cu|
|00001810| 72 72 65 6e 74 20 64 65 | 66 69 6e 69 74 69 6f 6e |rrent de|finition|
|00001820| 2e 0a 58 2e 4c 50 0a 58 | 2e 49 20 66 6c 65 78 0a |..X.LP.X|.I flex.|
|00001830| 58 69 73 20 66 75 6c 6c | 79 20 63 6f 6d 70 61 74 |Xis full|y compat|
|00001840| 69 62 6c 65 20 77 69 74 | 68 0a 58 2e 49 20 6c 65 |ible wit|h.X.I le|
|00001850| 78 0a 58 77 69 74 68 20 | 74 68 65 20 66 6f 6c 6c |x.Xwith |the foll|
|00001860| 6f 77 69 6e 67 20 65 78 | 63 65 70 74 69 6f 6e 73 |owing ex|ceptions|
|00001870| 3a 0a 58 2e 49 50 20 2d | 0a 58 54 68 65 20 75 6e |:.X.IP -|.XThe un|
|00001880| 64 6f 63 75 6d 65 6e 74 | 65 64 0a 58 2e 49 20 6c |document|ed.X.I l|
|00001890| 65 78 0a 58 73 63 61 6e | 6e 65 72 20 69 6e 74 65 |ex.Xscan|ner inte|
|000018a0| 72 6e 61 6c 20 76 61 72 | 69 61 62 6c 65 0a 58 2e |rnal var|iable.X.|
|000018b0| 42 20 79 79 6c 69 6e 65 | 6e 6f 0a 58 69 73 20 6e |B yyline|no.Xis n|
|000018c0| 6f 74 20 73 75 70 70 6f | 72 74 65 64 2e 20 20 49 |ot suppo|rted. I|
|000018d0| 74 20 69 73 20 64 69 66 | 66 69 63 75 6c 74 20 74 |t is dif|ficult t|
|000018e0| 6f 20 73 75 70 70 6f 72 | 74 20 74 68 69 73 20 6f |o suppor|t this o|
|000018f0| 70 74 69 6f 6e 20 65 66 | 66 69 63 69 65 6e 74 6c |ption ef|ficientl|
|00001900| 79 2c 0a 58 73 69 6e 63 | 65 20 69 74 20 72 65 71 |y,.Xsinc|e it req|
|00001910| 75 69 72 65 73 20 65 78 | 61 6d 69 6e 69 6e 67 20 |uires ex|amining |
|00001920| 65 76 65 72 79 20 63 68 | 61 72 61 63 74 65 72 20 |every ch|aracter |
|00001930| 73 63 61 6e 6e 65 64 20 | 61 6e 64 20 72 65 65 78 |scanned |and reex|
|00001940| 61 6d 69 6e 69 6e 67 0a | 58 74 68 65 20 63 68 61 |amining.|Xthe cha|
|00001950| 72 61 63 74 65 72 73 20 | 77 68 65 6e 20 74 68 65 |racters |when the|
|00001960| 20 73 63 61 6e 6e 65 72 | 20 62 61 63 6b 73 20 75 | scanner| backs u|
|00001970| 70 2e 0a 58 54 68 69 6e | 67 73 20 67 65 74 20 6d |p..XThin|gs get m|
|00001980| 6f 72 65 20 63 6f 6d 70 | 6c 69 63 61 74 65 64 20 |ore comp|licated |
|00001990| 77 68 65 6e 20 74 68 65 | 20 65 6e 64 20 6f 66 20 |when the| end of |
|000019a0| 62 75 66 66 65 72 20 6f | 72 20 66 69 6c 65 20 69 |buffer o|r file i|
|000019b0| 73 20 72 65 61 63 68 65 | 64 20 6f 72 20 61 0a 58 |s reache|d or a.X|
|000019c0| 4e 55 4c 20 69 73 20 73 | 63 61 6e 6e 65 64 20 28 |NUL is s|canned (|
|000019d0| 73 69 6e 63 65 20 74 68 | 65 20 73 63 61 6e 20 6d |since th|e scan m|
|000019e0| 75 73 74 20 74 68 65 6e | 20 62 65 20 72 65 73 74 |ust then| be rest|
|000019f0| 61 72 74 65 64 20 77 69 | 74 68 20 74 68 65 20 70 |arted wi|th the p|
|00001a00| 72 6f 70 65 72 20 6c 69 | 6e 65 0a 58 6e 75 6d 62 |roper li|ne.Xnumb|
|00001a10| 65 72 20 63 6f 75 6e 74 | 29 2c 20 6f 72 20 74 68 |er count|), or th|
|00001a20| 65 20 75 73 65 72 20 75 | 73 65 73 20 74 68 65 20 |e user u|ses the |
|00001a30| 79 79 6c 65 73 73 28 29 | 2c 20 75 6e 70 75 74 28 |yyless()|, unput(|
|00001a40| 29 2c 20 6f 72 20 52 45 | 4a 45 43 54 20 61 63 74 |), or RE|JECT act|
|00001a50| 69 6f 6e 73 2c 0a 58 6f | 72 20 74 68 65 20 6d 75 |ions,.Xo|r the mu|
|00001a60| 6c 74 69 70 6c 65 20 69 | 6e 70 75 74 20 62 75 66 |ltiple i|nput buf|
|00001a70| 66 65 72 20 66 75 6e 63 | 74 69 6f 6e 73 2e 0a 58 |fer func|tions..X|
|00001a80| 2e 49 50 0a 58 54 68 65 | 20 66 69 78 20 69 73 20 |.IP.XThe| fix is |
|00001a90| 74 6f 20 61 64 64 20 72 | 75 6c 65 73 20 77 68 69 |to add r|ules whi|
|00001aa0| 63 68 2c 20 75 70 6f 6e | 20 73 65 65 69 6e 67 20 |ch, upon| seeing |
|00001ab0| 61 20 6e 65 77 6c 69 6e | 65 2c 20 69 6e 63 72 65 |a newlin|e, incre|
|00001ac0| 6d 65 6e 74 0a 58 79 79 | 6c 69 6e 65 6e 6f 2e 20 |ment.Xyy|lineno. |
|00001ad0| 20 54 68 69 73 20 69 73 | 20 75 73 75 61 6c 6c 79 | This is| usually|
|00001ae0| 20 61 6e 20 65 61 73 79 | 20 70 72 6f 63 65 73 73 | an easy| process|
|00001af0| 2c 20 74 68 6f 75 67 68 | 20 69 74 20 63 61 6e 20 |, though| it can |
|00001b00| 62 65 20 61 20 64 72 61 | 67 20 69 66 20 73 6f 6d |be a dra|g if som|
|00001b10| 65 0a 58 6f 66 20 74 68 | 65 20 70 61 74 74 65 72 |e.Xof th|e patter|
|00001b20| 6e 73 20 63 61 6e 20 6d | 61 74 63 68 20 6d 75 6c |ns can m|atch mul|
|00001b30| 74 69 70 6c 65 20 6e 65 | 77 6c 69 6e 65 73 20 61 |tiple ne|wlines a|
|00001b40| 6c 6f 6e 67 20 77 69 74 | 68 20 6f 74 68 65 72 20 |long wit|h other |
|00001b50| 63 68 61 72 61 63 74 65 | 72 73 2e 0a 58 2e 49 50 |characte|rs..X.IP|
|00001b60| 0a 58 79 79 6c 69 6e 65 | 6e 6f 20 69 73 20 6e 6f |.Xyyline|no is no|
|00001b70| 74 20 70 61 72 74 20 6f | 66 20 74 68 65 20 50 4f |t part o|f the PO|
|00001b80| 53 49 58 20 64 72 61 66 | 74 2e 0a 58 2e 49 50 20 |SIX draf|t..X.IP |
|00001b90| 2d 0a 58 54 68 65 0a 58 | 2e 42 20 69 6e 70 75 74 |-.XThe.X|.B input|
|00001ba0| 28 29 0a 58 72 6f 75 74 | 69 6e 65 20 69 73 20 6e |().Xrout|ine is n|
|00001bb0| 6f 74 20 72 65 64 65 66 | 69 6e 61 62 6c 65 2c 20 |ot redef|inable, |
|00001bc0| 74 68 6f 75 67 68 20 69 | 74 20 6d 61 79 20 62 65 |though i|t may be|
|00001bd0| 20 63 61 6c 6c 65 64 20 | 74 6f 20 72 65 61 64 20 | called |to read |
|00001be0| 63 68 61 72 61 63 74 65 | 72 73 0a 58 66 6f 6c 6c |characte|rs.Xfoll|
|00001bf0| 6f 77 69 6e 67 20 77 68 | 61 74 65 76 65 72 20 68 |owing wh|atever h|
|00001c00| 61 73 20 62 65 65 6e 20 | 6d 61 74 63 68 65 64 20 |as been |matched |
|00001c10| 62 79 20 61 20 72 75 6c | 65 2e 20 20 49 66 0a 58 |by a rul|e. If.X|
|00001c20| 2e 42 20 69 6e 70 75 74 | 28 29 0a 58 65 6e 63 6f |.B input|().Xenco|
|00001c30| 75 6e 74 65 72 73 20 61 | 6e 20 65 6e 64 2d 6f 66 |unters a|n end-of|
|00001c40| 2d 66 69 6c 65 20 74 68 | 65 20 6e 6f 72 6d 61 6c |-file th|e normal|
|00001c50| 0a 58 2e 42 20 79 79 77 | 72 61 70 28 29 0a 58 70 |.X.B yyw|rap().Xp|
|00001c60| 72 6f 63 65 73 73 69 6e | 67 20 69 73 20 64 6f 6e |rocessin|g is don|
|00001c70| 65 2e 20 20 41 20 60 60 | 72 65 61 6c 27 27 20 65 |e. A ``|real'' e|
|00001c80| 6e 64 2d 6f 66 2d 66 69 | 6c 65 20 69 73 20 72 65 |nd-of-fi|le is re|
|00001c90| 74 75 72 6e 65 64 20 62 | 79 0a 58 2e 42 20 69 6e |turned b|y.X.B in|
|00001ca0| 70 75 74 28 29 0a 58 61 | 73 0a 58 2e 49 20 45 4f |put().Xa|s.X.I EO|
|00001cb0| 46 2e 0a 58 2e 49 50 0a | 58 49 6e 70 75 74 20 69 |F..X.IP.|XInput i|
|00001cc0| 73 20 69 6e 73 74 65 61 | 64 20 63 6f 6e 74 72 6f |s instea|d contro|
|00001cd0| 6c 6c 65 64 20 62 79 20 | 72 65 64 65 66 69 6e 69 |lled by |redefini|
|00001ce0| 6e 67 20 74 68 65 0a 58 | 2e 42 20 59 59 5f 49 4e |ng the.X|.B YY_IN|
|00001cf0| 50 55 54 0a 58 6d 61 63 | 72 6f 2e 0a 58 2e 49 50 |PUT.Xmac|ro..X.IP|
|00001d00| 0a 58 54 68 65 0a 58 2e | 49 20 66 6c 65 78 0a 58 |.XThe.X.|I flex.X|
|00001d10| 72 65 73 74 72 69 63 74 | 69 6f 6e 20 74 68 61 74 |restrict|ion that|
|00001d20| 0a 58 2e 42 20 69 6e 70 | 75 74 28 29 0a 58 63 61 |.X.B inp|ut().Xca|
|00001d30| 6e 6e 6f 74 20 62 65 20 | 72 65 64 65 66 69 6e 65 |nnot be |redefine|
|00001d40| 64 20 69 73 20 69 6e 20 | 61 63 63 6f 72 64 61 6e |d is in |accordan|
|00001d50| 63 65 20 77 69 74 68 20 | 74 68 65 20 50 4f 53 49 |ce with |the POSI|
|00001d60| 58 20 64 72 61 66 74 2c | 20 62 75 74 0a 58 2e 42 |X draft,| but.X.B|
|00001d70| 20 59 59 5f 49 4e 50 55 | 54 0a 58 68 61 73 20 6e | YY_INPU|T.Xhas n|
|00001d80| 6f 74 20 79 65 74 20 62 | 65 65 6e 20 61 63 63 65 |ot yet b|een acce|
|00001d90| 70 74 65 64 20 69 6e 74 | 6f 20 74 68 65 20 64 72 |pted int|o the dr|
|00001da0| 61 66 74 20 28 61 6e 64 | 20 70 72 6f 62 61 62 6c |aft (and| probabl|
|00001db0| 79 20 77 6f 6e 27 74 3b | 20 69 74 20 6c 6f 6f 6b |y won't;| it look|
|00001dc0| 73 0a 58 6c 69 6b 65 20 | 74 68 65 20 64 72 61 66 |s.Xlike |the draf|
|00001dd0| 74 20 77 69 6c 6c 20 73 | 69 6d 70 6c 79 20 6e 6f |t will s|imply no|
|00001de0| 74 20 73 70 65 63 69 66 | 79 20 61 6e 79 20 77 61 |t specif|y any wa|
|00001df0| 79 20 6f 66 20 63 6f 6e | 74 72 6f 6c 6c 69 6e 67 |y of con|trolling|
|00001e00| 20 74 68 65 0a 58 73 63 | 61 6e 6e 65 72 27 73 20 | the.Xsc|anner's |
|00001e10| 69 6e 70 75 74 20 6f 74 | 68 65 72 20 74 68 61 6e |input ot|her than|
|00001e20| 20 62 79 20 6d 61 6b 69 | 6e 67 20 61 6e 20 69 6e | by maki|ng an in|
|00001e30| 69 74 69 61 6c 20 61 73 | 73 69 67 6e 6d 65 6e 74 |itial as|signment|
|00001e40| 20 74 6f 0a 58 2e 49 20 | 79 79 69 6e 29 2e 0a 58 | to.X.I |yyin)..X|
|00001e50| 2e 49 50 20 2d 0a 58 2e | 49 20 66 6c 65 78 0a 58 |.IP -.X.|I flex.X|
|00001e60| 73 63 61 6e 6e 65 72 73 | 20 64 6f 20 6e 6f 74 20 |scanners| do not |
|00001e70| 75 73 65 20 73 74 64 69 | 6f 20 66 6f 72 20 69 6e |use stdi|o for in|
|00001e80| 70 75 74 2e 20 20 42 65 | 63 61 75 73 65 20 6f 66 |put. Be|cause of|
|00001e90| 20 74 68 69 73 2c 20 77 | 68 65 6e 20 77 72 69 74 | this, w|hen writ|
|00001ea0| 69 6e 67 20 61 6e 0a 58 | 69 6e 74 65 72 61 63 74 |ing an.X|interact|
|00001eb0| 69 76 65 20 73 63 61 6e | 6e 65 72 20 6f 6e 65 20 |ive scan|ner one |
|00001ec0| 6d 75 73 74 20 65 78 70 | 6c 69 63 69 74 6c 79 20 |must exp|licitly |
|00001ed0| 63 61 6c 6c 20 66 66 6c | 75 73 68 28 29 20 6f 6e |call ffl|ush() on|
|00001ee0| 20 74 68 65 0a 58 73 74 | 72 65 61 6d 20 61 73 73 | the.Xst|ream ass|
|00001ef0| 6f 63 69 61 74 65 64 20 | 77 69 74 68 20 74 68 65 |ociated |with the|
|00001f00| 20 74 65 72 6d 69 6e 61 | 6c 20 61 66 74 65 72 20 | termina|l after |
|00001f10| 77 72 69 74 69 6e 67 20 | 6f 75 74 20 61 20 70 72 |writing |out a pr|
|00001f20| 6f 6d 70 74 2e 0a 58 57 | 69 74 68 0a 58 2e 49 20 |ompt..XW|ith.X.I |
|00001f30| 6c 65 78 0a 58 73 75 63 | 68 20 77 72 69 74 65 73 |lex.Xsuc|h writes|
|00001f40| 20 61 72 65 20 61 75 74 | 6f 6d 61 74 69 63 61 6c | are aut|omatical|
|00001f50| 6c 79 20 66 6c 75 73 68 | 65 64 20 73 69 6e 63 65 |ly flush|ed since|
|00001f60| 0a 58 2e 49 20 6c 65 78 | 0a 58 73 63 61 6e 6e 65 |.X.I lex|.Xscanne|
|00001f70| 72 73 20 75 73 65 0a 58 | 2e 42 20 67 65 74 63 68 |rs use.X|.B getch|
|00001f80| 61 72 28 29 0a 58 66 6f | 72 20 74 68 65 69 72 20 |ar().Xfo|r their |
|00001f90| 69 6e 70 75 74 2e 20 20 | 41 6c 73 6f 2c 20 77 68 |input. |Also, wh|
|00001fa0| 65 6e 20 77 72 69 74 69 | 6e 67 20 69 6e 74 65 72 |en writi|ng inter|
|00001fb0| 61 63 74 69 76 65 20 73 | 63 61 6e 6e 65 72 73 20 |active s|canners |
|00001fc0| 77 69 74 68 0a 58 2e 49 | 20 66 6c 65 78 2c 0a 58 |with.X.I| flex,.X|
|00001fd0| 74 68 65 0a 58 2e 42 20 | 2d 49 0a 58 66 6c 61 67 |the.X.B |-I.Xflag|
|00001fe0| 20 6d 75 73 74 20 62 65 | 20 75 73 65 64 2e 0a 58 | must be| used..X|
|00001ff0| 2e 49 50 20 2d 0a 58 2e | 49 20 66 6c 65 78 0a 58 |.IP -.X.|I flex.X|
|00002000| 73 63 61 6e 6e 65 72 73 | 20 61 72 65 20 6e 6f 74 |scanners| are not|
|00002010| 20 61 73 20 72 65 65 6e | 74 72 61 6e 74 20 61 73 | as reen|trant as|
|00002020| 0a 58 2e 49 20 6c 65 78 | 0a 58 73 63 61 6e 6e 65 |.X.I lex|.Xscanne|
|00002030| 72 73 2e 20 20 49 6e 20 | 70 61 72 74 69 63 75 6c |rs. In |particul|
|00002040| 61 72 2c 20 69 66 20 79 | 6f 75 20 68 61 76 65 20 |ar, if y|ou have |
|00002050| 61 6e 20 69 6e 74 65 72 | 61 63 74 69 76 65 20 73 |an inter|active s|
|00002060| 63 61 6e 6e 65 72 20 61 | 6e 64 0a 58 61 6e 20 69 |canner a|nd.Xan i|
|00002070| 6e 74 65 72 72 75 70 74 | 20 68 61 6e 64 6c 65 72 |nterrupt| handler|
|00002080| 20 77 68 69 63 68 20 6c | 6f 6e 67 2d 6a 75 6d 70 | which l|ong-jump|
|00002090| 73 20 6f 75 74 20 6f 66 | 20 74 68 65 20 73 63 61 |s out of| the sca|
|000020a0| 6e 6e 65 72 2c 20 61 6e | 64 0a 58 74 68 65 20 73 |nner, an|d.Xthe s|
|000020b0| 63 61 6e 6e 65 72 20 69 | 73 20 73 75 62 73 65 71 |canner i|s subseq|
|000020c0| 75 65 6e 74 6c 79 20 63 | 61 6c 6c 65 64 20 61 67 |uently c|alled ag|
|000020d0| 61 69 6e 2c 20 79 6f 75 | 20 6d 61 79 20 67 65 74 |ain, you| may get|
|000020e0| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 0a 58 | the fol|lowing.X|
|000020f0| 6d 65 73 73 61 67 65 3a | 0a 58 2e 6e 66 0a 58 0a |message:|.X.nf.X.|
|00002100| 58 20 20 20 20 66 61 74 | 61 6c 20 66 6c 65 78 20 |X fat|al flex |
|00002110| 73 63 61 6e 6e 65 72 20 | 69 6e 74 65 72 6e 61 6c |scanner |internal|
|00002120| 20 65 72 72 6f 72 2d 2d | 65 6e 64 20 6f 66 20 62 | error--|end of b|
|00002130| 75 66 66 65 72 20 6d 69 | 73 73 65 64 0a 58 0a 58 |uffer mi|ssed.X.X|
|00002140| 2e 66 69 0a 58 54 6f 20 | 72 65 65 6e 74 65 72 20 |.fi.XTo |reenter |
|00002150| 74 68 65 20 73 63 61 6e | 6e 65 72 2c 20 66 69 72 |the scan|ner, fir|
|00002160| 73 74 20 75 73 65 0a 58 | 2e 6e 66 0a 58 0a 58 20 |st use.X|.nf.X.X |
|00002170| 20 20 20 79 79 72 65 73 | 74 61 72 74 28 20 79 79 | yyres|tart( yy|
|00002180| 69 6e 20 29 3b 0a 58 0a | 58 2e 66 69 0a 58 2e 49 |in );.X.|X.fi.X.I|
|00002190| 50 20 2d 0a 58 2e 42 20 | 6f 75 74 70 75 74 28 29 |P -.X.B |output()|
|000021a0| 0a 58 69 73 20 6e 6f 74 | 20 73 75 70 70 6f 72 74 |.Xis not| support|
|000021b0| 65 64 2e 0a 58 4f 75 74 | 70 75 74 20 66 72 6f 6d |ed..XOut|put from|
|000021c0| 20 74 68 65 0a 58 2e 42 | 20 45 43 48 4f 0a 58 6d | the.X.B| ECHO.Xm|
|000021d0| 61 63 72 6f 20 69 73 20 | 64 6f 6e 65 20 74 6f 20 |acro is |done to |
|000021e0| 74 68 65 20 66 69 6c 65 | 2d 70 6f 69 6e 74 65 72 |the file|-pointer|
|000021f0| 0a 58 2e 49 20 79 79 6f | 75 74 0a 58 28 64 65 66 |.X.I yyo|ut.X(def|
|00002200| 61 75 6c 74 0a 58 2e 49 | 20 73 74 64 6f 75 74 29 |ault.X.I| stdout)|
|00002210| 2e 0a 58 2e 49 50 0a 58 | 54 68 65 20 50 4f 53 49 |..X.IP.X|The POSI|
|00002220| 58 20 64 72 61 66 74 20 | 6d 65 6e 74 69 6f 6e 73 |X draft |mentions|
|00002230| 20 74 68 61 74 20 61 6e | 0a 58 2e 42 20 6f 75 74 | that an|.X.B out|
|00002240| 70 75 74 28 29 0a 58 72 | 6f 75 74 69 6e 65 20 65 |put().Xr|outine e|
|00002250| 78 69 73 74 73 20 62 75 | 74 20 63 75 72 72 65 6e |xists bu|t curren|
|00002260| 74 6c 79 20 67 69 76 65 | 73 20 6e 6f 20 64 65 74 |tly give|s no det|
|00002270| 61 69 6c 73 20 61 73 20 | 74 6f 20 77 68 61 74 20 |ails as |to what |
|00002280| 69 74 20 64 6f 65 73 2e | 0a 58 2e 49 50 20 2d 0a |it does.|.X.IP -.|
|00002290| 58 2e 49 20 6c 65 78 0a | 58 64 6f 65 73 20 6e 6f |X.I lex.|Xdoes no|
|000022a0| 74 20 73 75 70 70 6f 72 | 74 20 65 78 63 6c 75 73 |t suppor|t exclus|
|000022b0| 69 76 65 20 73 74 61 72 | 74 20 63 6f 6e 64 69 74 |ive star|t condit|
|000022c0| 69 6f 6e 73 20 28 25 78 | 29 2c 20 74 68 6f 75 67 |ions (%x|), thoug|
|000022d0| 68 20 74 68 65 79 0a 58 | 61 72 65 20 69 6e 20 74 |h they.X|are in t|
|000022e0| 68 65 20 63 75 72 72 65 | 6e 74 20 50 4f 53 49 58 |he curre|nt POSIX|
|000022f0| 20 64 72 61 66 74 2e 0a | 58 2e 49 50 20 2d 0a 58 | draft..|X.IP -.X|
|00002300| 57 68 65 6e 20 64 65 66 | 69 6e 69 74 69 6f 6e 73 |When def|initions|
|00002310| 20 61 72 65 20 65 78 70 | 61 6e 64 65 64 2c 0a 58 | are exp|anded,.X|
|00002320| 2e 49 20 66 6c 65 78 0a | 58 65 6e 63 6c 6f 73 65 |.I flex.|Xenclose|
|00002330| 73 20 74 68 65 6d 20 69 | 6e 20 70 61 72 65 6e 74 |s them i|n parent|
|00002340| 68 65 73 65 73 2e 0a 58 | 57 69 74 68 20 6c 65 78 |heses..X|With lex|
|00002350| 2c 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 3a |, the fo|llowing:|
|00002360| 0a 58 2e 6e 66 0a 58 0a | 58 20 20 20 20 4e 41 4d |.X.nf.X.|X NAM|
|00002370| 45 20 20 20 20 5b 41 2d | 5a 5d 5b 41 2d 5a 30 2d |E [A-|Z][A-Z0-|
|00002380| 39 5d 2a 0a 58 20 20 20 | 20 25 25 0a 58 20 20 20 |9]*.X | %%.X |
|00002390| 20 66 6f 6f 7b 4e 41 4d | 45 7d 3f 20 20 20 20 20 | foo{NAM|E}? |
|000023a0| 20 70 72 69 6e 74 66 28 | 20 22 46 6f 75 6e 64 20 | printf(| "Found |
|000023b0| 69 74 5c 5c 6e 22 20 29 | 3b 0a 58 20 20 20 20 25 |it\\n" )|;.X %|
|000023c0| 25 0a 58 0a 58 2e 66 69 | 0a 58 77 69 6c 6c 20 6e |%.X.X.fi|.Xwill n|
|000023d0| 6f 74 20 6d 61 74 63 68 | 20 74 68 65 20 73 74 72 |ot match| the str|
|000023e0| 69 6e 67 20 22 66 6f 6f | 22 20 62 65 63 61 75 73 |ing "foo|" becaus|
|000023f0| 65 20 77 68 65 6e 20 74 | 68 65 20 6d 61 63 72 6f |e when t|he macro|
|00002400| 0a 58 69 73 20 65 78 70 | 61 6e 64 65 64 20 74 68 |.Xis exp|anded th|
|00002410| 65 20 72 75 6c 65 20 69 | 73 20 65 71 75 69 76 61 |e rule i|s equiva|
|00002420| 6c 65 6e 74 20 74 6f 20 | 22 66 6f 6f 5b 41 2d 5a |lent to |"foo[A-Z|
|00002430| 5d 5b 41 2d 5a 30 2d 39 | 5d 2a 3f 22 0a 58 61 6e |][A-Z0-9|]*?".Xan|
|00002440| 64 20 74 68 65 20 70 72 | 65 63 65 64 65 6e 63 65 |d the pr|ecedence|
|00002450| 20 69 73 20 73 75 63 68 | 20 74 68 61 74 20 74 68 | is such| that th|
|00002460| 65 20 27 3f 27 20 69 73 | 20 61 73 73 6f 63 69 61 |e '?' is| associa|
|00002470| 74 65 64 20 77 69 74 68 | 0a 58 22 5b 41 2d 5a 30 |ted with|.X"[A-Z0|
|00002480| 2d 39 5d 2a 22 2e 20 20 | 57 69 74 68 0a 58 2e 49 |-9]*". |With.X.I|
|00002490| 20 66 6c 65 78 2c 0a 58 | 74 68 65 20 72 75 6c 65 | flex,.X|the rule|
|000024a0| 20 77 69 6c 6c 20 62 65 | 20 65 78 70 61 6e 64 65 | will be| expande|
|000024b0| 64 20 74 6f 0a 58 22 66 | 6f 6f 28 5b 41 2d 5a 5d |d to.X"f|oo([A-Z]|
|000024c0| 5b 41 2d 5a 30 2d 39 5d | 2a 29 3f 22 20 61 6e 64 |[A-Z0-9]|*)?" and|
|000024d0| 20 73 6f 20 74 68 65 20 | 73 74 72 69 6e 67 20 22 | so the |string "|
|000024e0| 66 6f 6f 22 20 77 69 6c | 6c 20 6d 61 74 63 68 2e |foo" wil|l match.|
|000024f0| 0a 58 4e 6f 74 65 20 74 | 68 61 74 20 62 65 63 61 |.XNote t|hat beca|
|00002500| 75 73 65 20 6f 66 20 74 | 68 69 73 2c 20 74 68 65 |use of t|his, the|
|00002510| 0a 58 2e 42 20 5e 2c 20 | 24 2c 20 3c 73 3e 2c 20 |.X.B ^, |$, <s>, |
|00002520| 2f 2c 0a 58 61 6e 64 0a | 58 2e 42 20 3c 3c 45 4f |/,.Xand.|X.B <<EO|
|00002530| 46 3e 3e 0a 58 6f 70 65 | 72 61 74 6f 72 73 20 63 |F>>.Xope|rators c|
|00002540| 61 6e 6e 6f 74 20 62 65 | 20 75 73 65 64 20 69 6e |annot be| used in|
|00002550| 20 61 0a 58 2e 49 20 66 | 6c 65 78 0a 58 64 65 66 | a.X.I f|lex.Xdef|
|00002560| 69 6e 69 74 69 6f 6e 2e | 0a 58 2e 49 50 0a 58 54 |inition.|.X.IP.XT|
|00002570| 68 65 20 50 4f 53 49 58 | 20 64 72 61 66 74 20 69 |he POSIX| draft i|
|00002580| 6e 74 65 72 70 72 65 74 | 61 74 69 6f 6e 20 69 73 |nterpret|ation is|
|00002590| 20 74 68 65 20 73 61 6d | 65 20 61 73 0a 58 2e 49 | the sam|e as.X.I|
|000025a0| 20 66 6c 65 78 27 73 2e | 0a 58 2e 49 50 20 2d 0a | flex's.|.X.IP -.|
|000025b0| 58 54 6f 20 73 70 65 63 | 69 66 79 20 61 20 63 68 |XTo spec|ify a ch|
|000025c0| 61 72 61 63 74 65 72 20 | 63 6c 61 73 73 20 77 68 |aracter |class wh|
|000025d0| 69 63 68 20 6d 61 74 63 | 68 65 73 20 61 6e 79 74 |ich matc|hes anyt|
|000025e0| 68 69 6e 67 20 62 75 74 | 20 61 20 6c 65 66 74 20 |hing but| a left |
|000025f0| 62 72 61 63 6b 65 74 20 | 28 27 5d 27 29 2c 0a 58 |bracket |(']'),.X|
|00002600| 69 6e 0a 58 2e 49 20 6c | 65 78 0a 58 6f 6e 65 20 |in.X.I l|ex.Xone |
|00002610| 63 61 6e 20 75 73 65 20 | 22 5b 5e 5d 5d 22 20 62 |can use |"[^]]" b|
|00002620| 75 74 20 77 69 74 68 0a | 58 2e 49 20 66 6c 65 78 |ut with.|X.I flex|
|00002630| 0a 58 6f 6e 65 20 6d 75 | 73 74 20 75 73 65 20 22 |.Xone mu|st use "|
|00002640| 5b 5e 5c 5c 5d 5d 22 2e | 20 20 54 68 65 20 6c 61 |[^\\]]".| The la|
|00002650| 74 74 65 72 20 77 6f 72 | 6b 73 20 77 69 74 68 0a |tter wor|ks with.|
|00002660| 58 2e 49 20 6c 65 78 2c | 0a 58 74 6f 6f 2e 0a 58 |X.I lex,|.Xtoo..X|
|00002670| 2e 49 50 20 2d 0a 58 54 | 68 65 0a 58 2e 49 20 6c |.IP -.XT|he.X.I l|
|00002680| 65 78 0a 58 2e 42 20 25 | 72 0a 58 28 67 65 6e 65 |ex.X.B %|r.X(gene|
|00002690| 72 61 74 65 20 61 20 52 | 61 74 66 6f 72 20 73 63 |rate a R|atfor sc|
|000026a0| 61 6e 6e 65 72 29 20 6f | 70 74 69 6f 6e 20 69 73 |anner) o|ption is|
|000026b0| 20 6e 6f 74 20 73 75 70 | 70 6f 72 74 65 64 2e 20 | not sup|ported. |
|000026c0| 20 49 74 20 69 73 20 6e | 6f 74 20 70 61 72 74 0a | It is n|ot part.|
|000026d0| 58 6f 66 20 74 68 65 20 | 50 4f 53 49 58 20 64 72 |Xof the |POSIX dr|
|000026e0| 61 66 74 2e 0a 58 2e 49 | 50 20 2d 0a 58 49 66 20 |aft..X.I|P -.XIf |
|000026f0| 79 6f 75 20 61 72 65 20 | 70 72 6f 76 69 64 69 6e |you are |providin|
|00002700| 67 20 79 6f 75 72 20 6f | 77 6e 20 79 79 77 72 61 |g your o|wn yywra|
|00002710| 70 28 29 20 72 6f 75 74 | 69 6e 65 2c 20 79 6f 75 |p() rout|ine, you|
|00002720| 20 6d 75 73 74 20 69 6e | 63 6c 75 64 65 20 61 0a | must in|clude a.|
|00002730| 58 22 23 75 6e 64 65 66 | 20 79 79 77 72 61 70 22 |X"#undef| yywrap"|
|00002740| 20 69 6e 20 74 68 65 20 | 64 65 66 69 6e 69 74 69 | in the |definiti|
|00002750| 6f 6e 73 20 73 65 63 74 | 69 6f 6e 20 28 73 65 63 |ons sect|ion (sec|
|00002760| 74 69 6f 6e 20 31 29 2e | 20 20 4e 6f 74 65 20 74 |tion 1).| Note t|
|00002770| 68 61 74 0a 58 74 68 65 | 20 22 23 75 6e 64 65 66 |hat.Xthe| "#undef|
|00002780| 22 20 77 69 6c 6c 20 68 | 61 76 65 20 74 6f 20 62 |" will h|ave to b|
|00002790| 65 20 65 6e 63 6c 6f 73 | 65 64 20 69 6e 20 25 7b |e enclos|ed in %{|
|000027a0| 7d 27 73 2e 0a 58 2e 49 | 50 0a 58 54 68 65 20 50 |}'s..X.I|P.XThe P|
|000027b0| 4f 53 49 58 20 64 72 61 | 66 74 0a 58 73 70 65 63 |OSIX dra|ft.Xspec|
|000027c0| 69 66 69 65 73 20 74 68 | 61 74 20 79 79 77 72 61 |ifies th|at yywra|
|000027d0| 70 28 29 20 69 73 20 61 | 20 66 75 6e 63 74 69 6f |p() is a| functio|
|000027e0| 6e 20 61 6e 64 20 74 68 | 69 73 20 69 73 20 76 65 |n and th|is is ve|
|000027f0| 72 79 20 75 6e 6c 69 6b | 65 6c 79 20 74 6f 20 63 |ry unlik|ely to c|
|00002800| 68 61 6e 67 65 3b 20 73 | 6f 0a 58 2e 49 20 66 6c |hange; s|o.X.I fl|
|00002810| 65 78 20 75 73 65 72 73 | 20 61 72 65 20 77 61 72 |ex users| are war|
|00002820| 6e 65 64 0a 58 74 68 61 | 74 0a 58 2e 42 20 79 79 |ned.Xtha|t.X.B yy|
|00002830| 77 72 61 70 28 29 0a 58 | 69 73 20 6c 69 6b 65 6c |wrap().X|is likel|
|00002840| 79 20 74 6f 20 62 65 20 | 63 68 61 6e 67 65 64 20 |y to be |changed |
|00002850| 74 6f 20 61 20 66 75 6e | 63 74 69 6f 6e 20 69 6e |to a fun|ction in|
|00002860| 20 74 68 65 20 6e 65 61 | 72 20 66 75 74 75 72 65 | the nea|r future|
|00002870| 2e 0a 58 2e 49 50 20 2d | 0a 58 41 66 74 65 72 20 |..X.IP -|.XAfter |
|00002880| 61 20 63 61 6c 6c 20 74 | 6f 0a 58 2e 42 20 75 6e |a call t|o.X.B un|
|00002890| 70 75 74 28 29 2c 0a 58 | 2e 49 20 79 79 74 65 78 |put(),.X|.I yytex|
|000028a0| 74 0a 58 61 6e 64 0a 58 | 2e 49 20 79 79 6c 65 6e |t.Xand.X|.I yylen|
|000028b0| 67 0a 58 61 72 65 20 75 | 6e 64 65 66 69 6e 65 64 |g.Xare u|ndefined|
|000028c0| 20 75 6e 74 69 6c 20 74 | 68 65 20 6e 65 78 74 20 | until t|he next |
|000028d0| 74 6f 6b 65 6e 20 69 73 | 20 6d 61 74 63 68 65 64 |token is| matched|
|000028e0| 2e 20 20 54 68 69 73 20 | 69 73 20 6e 6f 74 20 74 |. This |is not t|
|000028f0| 68 65 20 63 61 73 65 20 | 77 69 74 68 0a 58 2e 49 |he case |with.X.I|
|00002900| 20 6c 65 78 0a 58 6f 72 | 20 74 68 65 20 70 72 65 | lex.Xor| the pre|
|00002910| 73 65 6e 74 20 50 4f 53 | 49 58 20 64 72 61 66 74 |sent POS|IX draft|
|00002920| 2e 0a 58 2e 49 50 20 2d | 0a 58 54 68 65 20 70 72 |..X.IP -|.XThe pr|
|00002930| 65 63 65 64 65 6e 63 65 | 20 6f 66 20 74 68 65 0a |ecedence| of the.|
|00002940| 58 2e 42 20 7b 7d 0a 58 | 28 6e 75 6d 65 72 69 63 |X.B {}.X|(numeric|
|00002950| 20 72 61 6e 67 65 29 20 | 6f 70 65 72 61 74 6f 72 | range) |operator|
|00002960| 20 69 73 20 64 69 66 66 | 65 72 65 6e 74 2e 0a 58 | is diff|erent..X|
|00002970| 2e 49 20 6c 65 78 0a 58 | 69 6e 74 65 72 70 72 65 |.I lex.X|interpre|
|00002980| 74 73 20 22 61 62 63 7b | 31 2c 33 7d 22 20 61 73 |ts "abc{|1,3}" as|
|00002990| 20 22 6d 61 74 63 68 20 | 6f 6e 65 2c 20 74 77 6f | "match |one, two|
|000029a0| 2c 20 6f 72 0a 58 74 68 | 72 65 65 20 6f 63 63 75 |, or.Xth|ree occu|
|000029b0| 72 72 65 6e 63 65 73 20 | 6f 66 20 27 61 62 63 27 |rrences |of 'abc'|
|000029c0| 22 2c 20 77 68 65 72 65 | 61 73 0a 58 2e 49 20 66 |", where|as.X.I f|
|000029d0| 6c 65 78 0a 58 69 6e 74 | 65 72 70 72 65 74 73 20 |lex.Xint|erprets |
|000029e0| 69 74 20 61 73 20 22 6d | 61 74 63 68 20 27 61 62 |it as "m|atch 'ab|
|000029f0| 27 0a 58 66 6f 6c 6c 6f | 77 65 64 20 62 79 20 6f |'.Xfollo|wed by o|
|00002a00| 6e 65 2c 20 74 77 6f 2c | 20 6f 72 20 74 68 72 65 |ne, two,| or thre|
|00002a10| 65 20 6f 63 63 75 72 72 | 65 6e 63 65 73 20 6f 66 |e occurr|ences of|
|00002a20| 20 27 63 27 22 2e 20 20 | 54 68 65 20 6c 61 74 74 | 'c'". |The latt|
|00002a30| 65 72 20 69 73 0a 58 69 | 6e 20 61 67 72 65 65 6d |er is.Xi|n agreem|
|00002a40| 65 6e 74 20 77 69 74 68 | 20 74 68 65 20 63 75 72 |ent with| the cur|
|00002a50| 72 65 6e 74 20 50 4f 53 | 49 58 20 64 72 61 66 74 |rent POS|IX draft|
|00002a60| 2e 0a 58 2e 49 50 20 2d | 0a 58 54 68 65 20 70 72 |..X.IP -|.XThe pr|
|00002a70| 65 63 65 64 65 6e 63 65 | 20 6f 66 20 74 68 65 0a |ecedence| of the.|
|00002a80| 58 2e 42 20 5e 0a 58 6f | 70 65 72 61 74 6f 72 20 |X.B ^.Xo|perator |
|00002a90| 69 73 20 64 69 66 66 65 | 72 65 6e 74 2e 0a 58 2e |is diffe|rent..X.|
|00002aa0| 49 20 6c 65 78 0a 58 69 | 6e 74 65 72 70 72 65 74 |I lex.Xi|nterpret|
|00002ab0| 73 20 22 5e 66 6f 6f 7c | 62 61 72 22 20 61 73 20 |s "^foo||bar" as |
|00002ac0| 22 6d 61 74 63 68 20 65 | 69 74 68 65 72 20 27 66 |"match e|ither 'f|
|00002ad0| 6f 6f 27 20 61 74 20 74 | 68 65 20 62 65 67 69 6e |oo' at t|he begin|
|00002ae0| 6e 69 6e 67 20 6f 66 20 | 61 20 6c 69 6e 65 2c 0a |ning of |a line,.|
|00002af0| 58 6f 72 20 27 62 61 72 | 27 20 61 6e 79 77 68 65 |Xor 'bar|' anywhe|
|00002b00| 72 65 22 2c 20 77 68 65 | 72 65 61 73 0a 58 2e 49 |re", whe|reas.X.I|
|00002b10| 20 66 6c 65 78 0a 58 69 | 6e 74 65 72 70 72 65 74 | flex.Xi|nterpret|
|00002b20| 73 20 69 74 20 61 73 20 | 22 6d 61 74 63 68 20 65 |s it as |"match e|
|00002b30| 69 74 68 65 72 20 27 66 | 6f 6f 27 20 6f 72 20 27 |ither 'f|oo' or '|
|00002b40| 62 61 72 27 20 69 66 20 | 74 68 65 79 20 63 6f 6d |bar' if |they com|
|00002b50| 65 20 61 74 20 74 68 65 | 20 62 65 67 69 6e 6e 69 |e at the| beginni|
|00002b60| 6e 67 0a 58 6f 66 20 61 | 20 6c 69 6e 65 22 2e 20 |ng.Xof a| line". |
|00002b70| 20 54 68 65 20 6c 61 74 | 74 65 72 20 69 73 20 69 | The lat|ter is i|
|00002b80| 6e 20 61 67 72 65 65 6d | 65 6e 74 20 77 69 74 68 |n agreem|ent with|
|00002b90| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 50 4f 53 | the cur|rent POS|
|00002ba0| 49 58 20 64 72 61 66 74 | 2e 0a 58 2e 49 50 20 2d |IX draft|..X.IP -|
|00002bb0| 0a 58 54 6f 20 72 65 66 | 65 72 20 74 6f 20 79 79 |.XTo ref|er to yy|
|00002bc0| 74 65 78 74 20 6f 75 74 | 73 69 64 65 20 6f 66 20 |text out|side of |
|00002bd0| 74 68 65 20 73 63 61 6e | 6e 65 72 20 73 6f 75 72 |the scan|ner sour|
|00002be0| 63 65 20 66 69 6c 65 2c | 0a 58 74 68 65 20 63 6f |ce file,|.Xthe co|
|00002bf0| 72 72 65 63 74 20 64 65 | 66 69 6e 69 74 69 6f 6e |rrect de|finition|
|00002c00| 20 77 69 74 68 0a 58 2e | 49 20 66 6c 65 78 0a 58 | with.X.|I flex.X|
|00002c10| 69 73 20 22 65 78 74 65 | 72 6e 20 63 68 61 72 20 |is "exte|rn char |
|00002c20| 2a 79 79 74 65 78 74 22 | 20 72 61 74 68 65 72 20 |*yytext"| rather |
|00002c30| 74 68 61 6e 20 22 65 78 | 74 65 72 6e 20 63 68 61 |than "ex|tern cha|
|00002c40| 72 20 79 79 74 65 78 74 | 5b 5d 22 2e 0a 58 54 68 |r yytext|[]"..XTh|
|00002c50| 69 73 20 69 73 20 63 6f | 6e 74 72 61 72 79 20 74 |is is co|ntrary t|
|00002c60| 6f 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 50 4f |o the cu|rrent PO|
|00002c70| 53 49 58 20 64 72 61 66 | 74 20 62 75 74 20 61 20 |SIX draf|t but a |
|00002c80| 70 6f 69 6e 74 20 6f 6e | 20 77 68 69 63 68 0a 58 |point on| which.X|
|00002c90| 2e 49 20 66 6c 65 78 0a | 58 77 69 6c 6c 20 6e 6f |.I flex.|Xwill no|
|00002ca0| 74 20 62 65 20 63 68 61 | 6e 67 69 6e 67 2c 20 61 |t be cha|nging, a|
|00002cb0| 73 20 74 68 65 20 61 72 | 72 61 79 20 72 65 70 72 |s the ar|ray repr|
|00002cc0| 65 73 65 6e 74 61 74 69 | 6f 6e 20 65 6e 74 61 69 |esentati|on entai|
|00002cd0| 6c 73 20 61 0a 58 73 65 | 72 69 6f 75 73 20 70 65 |ls a.Xse|rious pe|
|00002ce0| 72 66 6f 72 6d 61 6e 63 | 65 20 70 65 6e 61 6c 74 |rformanc|e penalt|
|00002cf0| 79 2e 20 20 49 74 20 69 | 73 20 68 6f 70 65 64 20 |y. It i|s hoped |
|00002d00| 74 68 61 74 20 74 68 65 | 20 50 4f 53 49 58 20 64 |that the| POSIX d|
|00002d10| 72 61 66 74 20 77 69 6c | 6c 0a 58 62 65 20 65 6d |raft wil|l.Xbe em|
|00002d20| 65 6e 64 65 64 20 74 6f | 20 73 75 70 70 6f 72 74 |ended to| support|
|00002d30| 20 74 68 65 0a 58 2e 49 | 20 66 6c 65 78 0a 58 76 | the.X.I| flex.Xv|
|00002d40| 61 72 69 65 74 79 20 6f | 66 20 64 65 63 6c 61 72 |ariety o|f declar|
|00002d50| 61 74 69 6f 6e 20 28 61 | 73 20 74 68 69 73 20 69 |ation (a|s this i|
|00002d60| 73 20 61 20 66 61 69 72 | 6c 79 20 70 61 69 6e 6c |s a fair|ly painl|
|00002d70| 65 73 73 20 63 68 61 6e | 67 65 20 74 6f 0a 58 72 |ess chan|ge to.Xr|
|00002d80| 65 71 75 69 72 65 20 6f | 66 0a 58 2e 49 20 6c 65 |equire o|f.X.I le|
|00002d90| 78 0a 58 75 73 65 72 73 | 29 2e 0a 58 2e 49 50 20 |x.Xusers|)..X.IP |
|00002da0| 2d 0a 58 2e 49 20 79 79 | 69 6e 0a 58 69 73 0a 58 |-.X.I yy|in.Xis.X|
|00002db0| 2e 49 20 69 6e 69 74 69 | 61 6c 69 7a 65 64 0a 58 |.I initi|alized.X|
|00002dc0| 62 79 0a 58 2e 49 20 6c | 65 78 0a 58 74 6f 20 62 |by.X.I l|ex.Xto b|
|00002dd0| 65 0a 58 2e 49 20 73 74 | 64 69 6e 3b 0a 58 2e 49 |e.X.I st|din;.X.I|
|00002de0| 20 66 6c 65 78 2c 0a 58 | 6f 6e 20 74 68 65 20 6f | flex,.X|on the o|
|00002df0| 74 68 65 72 20 68 61 6e | 64 2c 0a 58 69 6e 69 74 |ther han|d,.Xinit|
|00002e00| 69 61 6c 69 7a 65 73 0a | 58 2e 49 20 79 79 69 6e |ializes.|X.I yyin|
|00002e10| 0a 58 74 6f 20 4e 55 4c | 4c 0a 58 61 6e 64 20 74 |.Xto NUL|L.Xand t|
|00002e20| 68 65 6e 0a 58 2e 49 20 | 61 73 73 69 67 6e 73 0a |hen.X.I |assigns.|
|00002e30| 58 69 74 20 74 6f 0a 58 | 2e 49 20 73 74 64 69 6e |Xit to.X|.I stdin|
|00002e40| 0a 58 74 68 65 20 66 69 | 72 73 74 20 74 69 6d 65 |.Xthe fi|rst time|
|00002e50| 20 74 68 65 20 73 63 61 | 6e 6e 65 72 20 69 73 20 | the sca|nner is |
|00002e60| 63 61 6c 6c 65 64 2c 20 | 70 72 6f 76 69 64 69 6e |called, |providin|
|00002e70| 67 0a 58 2e 49 20 79 79 | 69 6e 0a 58 68 61 73 20 |g.X.I yy|in.Xhas |
|00002e80| 6e 6f 74 20 61 6c 72 65 | 61 64 79 20 62 65 65 6e |not alre|ady been|
|00002e90| 20 61 73 73 69 67 6e 65 | 64 20 74 6f 20 61 20 6e | assigne|d to a n|
|00002ea0| 6f 6e 2d 4e 55 4c 4c 20 | 76 61 6c 75 65 2e 20 20 |on-NULL |value. |
|00002eb0| 54 68 65 20 64 69 66 66 | 65 72 65 6e 63 65 20 69 |The diff|erence i|
|00002ec0| 73 0a 58 73 75 62 74 6c | 65 2c 20 62 75 74 20 74 |s.Xsubtl|e, but t|
|00002ed0| 68 65 20 6e 65 74 20 65 | 66 66 65 63 74 20 69 73 |he net e|ffect is|
|00002ee0| 20 74 68 61 74 20 77 69 | 74 68 0a 58 2e 49 20 66 | that wi|th.X.I f|
|00002ef0| 6c 65 78 0a 58 73 63 61 | 6e 6e 65 72 73 2c 0a 58 |lex.Xsca|nners,.X|
|00002f00| 2e 49 20 79 79 69 6e 0a | 58 64 6f 65 73 20 6e 6f |.I yyin.|Xdoes no|
|00002f10| 74 20 68 61 76 65 20 61 | 20 76 61 6c 69 64 20 76 |t have a| valid v|
|00002f20| 61 6c 75 65 20 75 6e 74 | 69 6c 20 74 68 65 20 73 |alue unt|il the s|
|00002f30| 63 61 6e 6e 65 72 20 68 | 61 73 20 62 65 65 6e 20 |canner h|as been |
|00002f40| 63 61 6c 6c 65 64 2e 0a | 58 2e 49 50 20 2d 0a 58 |called..|X.IP -.X|
|00002f50| 54 68 65 20 73 70 65 63 | 69 61 6c 20 74 61 62 6c |The spec|ial tabl|
|00002f60| 65 2d 73 69 7a 65 20 64 | 65 63 6c 61 72 61 74 69 |e-size d|eclarati|
|00002f70| 6f 6e 73 20 73 75 63 68 | 20 61 73 0a 58 2e 42 20 |ons such| as.X.B |
|00002f80| 25 61 0a 58 73 75 70 70 | 6f 72 74 65 64 20 62 79 |%a.Xsupp|orted by|
|00002f90| 0a 58 2e 49 20 6c 65 78 | 0a 58 61 72 65 20 6e 6f |.X.I lex|.Xare no|
|00002fa0| 74 20 72 65 71 75 69 72 | 65 64 20 62 79 0a 58 2e |t requir|ed by.X.|
|00002fb0| 49 20 66 6c 65 78 0a 58 | 73 63 61 6e 6e 65 72 73 |I flex.X|scanners|
|00002fc0| 3b 0a 58 2e 49 20 66 6c | 65 78 0a 58 69 67 6e 6f |;.X.I fl|ex.Xigno|
|00002fd0| 72 65 73 20 74 68 65 6d | 2e 0a 58 2e 49 50 20 2d |res them|..X.IP -|
|00002fe0| 0a 58 54 68 65 20 6e 61 | 6d 65 0a 58 2e 62 64 0a |.XThe na|me.X.bd.|
|00002ff0| 58 46 4c 45 58 5f 53 43 | 41 4e 4e 45 52 0a 58 69 |XFLEX_SC|ANNER.Xi|
|00003000| 73 20 23 64 65 66 69 6e | 65 27 64 20 73 6f 20 73 |s #defin|e'd so s|
|00003010| 63 61 6e 6e 65 72 73 20 | 6d 61 79 20 62 65 20 77 |canners |may be w|
|00003020| 72 69 74 74 65 6e 20 66 | 6f 72 20 75 73 65 20 77 |ritten f|or use w|
|00003030| 69 74 68 20 65 69 74 68 | 65 72 0a 58 2e 49 20 66 |ith eith|er.X.I f|
|00003040| 6c 65 78 0a 58 6f 72 0a | 58 2e 49 20 6c 65 78 2e |lex.Xor.|X.I lex.|
|00003050| 0a 58 2e 4c 50 0a 58 54 | 68 65 20 66 6f 6c 6c 6f |.X.LP.XT|he follo|
|00003060| 77 69 6e 67 0a 58 2e 49 | 20 66 6c 65 78 0a 58 66 |wing.X.I| flex.Xf|
|00003070| 65 61 74 75 72 65 73 20 | 61 72 65 20 6e 6f 74 20 |eatures |are not |
|00003080| 69 6e 63 6c 75 64 65 64 | 20 69 6e 0a 58 2e 49 20 |included| in.X.I |
|00003090| 6c 65 78 0a 58 6f 72 20 | 74 68 65 20 50 4f 53 49 |lex.Xor |the POSI|
|000030a0| 58 20 64 72 61 66 74 20 | 73 74 61 6e 64 61 72 64 |X draft |standard|
|000030b0| 3a 0a 58 2e 6e 66 0a 58 | 0a 58 20 20 20 20 79 79 |:.X.nf.X|.X yy|
|000030c0| 74 65 72 6d 69 6e 61 74 | 65 28 29 0a 58 20 20 20 |terminat|e().X |
|000030d0| 20 3c 3c 45 4f 46 3e 3e | 0a 58 20 20 20 20 59 59 | <<EOF>>|.X YY|
|000030e0| 5f 44 45 43 4c 0a 58 20 | 20 20 20 23 6c 69 6e 65 |_DECL.X | #line|
|000030f0| 20 64 69 72 65 63 74 69 | 76 65 73 0a 58 20 20 20 | directi|ves.X |
|00003100| 20 25 7b 7d 27 73 20 61 | 72 6f 75 6e 64 20 61 63 | %{}'s a|round ac|
|00003110| 74 69 6f 6e 73 0a 58 20 | 20 20 20 79 79 72 65 73 |tions.X | yyres|
|00003120| 74 61 72 74 28 29 0a 58 | 20 20 20 20 63 6f 6d 6d |tart().X| comm|
|00003130| 65 6e 74 73 20 62 65 67 | 69 6e 6e 69 6e 67 20 77 |ents beg|inning w|
|00003140| 69 74 68 20 27 23 27 20 | 28 64 65 70 72 65 63 61 |ith '#' |(depreca|
|00003150| 74 65 64 29 0a 58 20 20 | 20 20 6d 75 6c 74 69 70 |ted).X | multip|
|00003160| 6c 65 20 61 63 74 69 6f | 6e 73 20 6f 6e 20 61 20 |le actio|ns on a |
|00003170| 6c 69 6e 65 0a 58 0a 58 | 2e 66 69 0a 58 54 68 69 |line.X.X|.fi.XThi|
|00003180| 73 20 6c 61 73 74 20 66 | 65 61 74 75 72 65 20 72 |s last f|eature r|
|00003190| 65 66 65 72 73 20 74 6f | 20 74 68 65 20 66 61 63 |efers to| the fac|
|000031a0| 74 20 74 68 61 74 20 77 | 69 74 68 0a 58 2e 49 20 |t that w|ith.X.I |
|000031b0| 66 6c 65 78 0a 58 79 6f | 75 20 63 61 6e 20 70 75 |flex.Xyo|u can pu|
|000031c0| 74 20 6d 75 6c 74 69 70 | 6c 65 20 61 63 74 69 6f |t multip|le actio|
|000031d0| 6e 73 20 6f 6e 20 74 68 | 65 20 73 61 6d 65 20 6c |ns on th|e same l|
|000031e0| 69 6e 65 2c 20 73 65 70 | 61 72 61 74 65 64 20 77 |ine, sep|arated w|
|000031f0| 69 74 68 0a 58 73 65 6d | 69 2d 63 6f 6c 6f 6e 73 |ith.Xsem|i-colons|
|00003200| 2c 20 77 68 69 6c 65 20 | 77 69 74 68 0a 58 2e 49 |, while |with.X.I|
|00003210| 20 6c 65 78 2c 0a 58 74 | 68 65 20 66 6f 6c 6c 6f | lex,.Xt|he follo|
|00003220| 77 69 6e 67 0a 58 2e 6e | 66 0a 58 0a 58 20 20 20 |wing.X.n|f.X.X |
|00003230| 20 66 6f 6f 20 20 20 20 | 68 61 6e 64 6c 65 5f 66 | foo |handle_f|
|00003240| 6f 6f 28 29 3b 20 2b 2b | 6e 75 6d 5f 66 6f 6f 73 |oo(); ++|num_foos|
|00003250| 5f 73 65 65 6e 3b 0a 58 | 0a 58 2e 66 69 0a 58 69 |_seen;.X|.X.fi.Xi|
|00003260| 73 20 28 72 61 74 68 65 | 72 20 73 75 72 70 72 69 |s (rathe|r surpri|
|00003270| 73 69 6e 67 6c 79 29 20 | 74 72 75 6e 63 61 74 65 |singly) |truncate|
|00003280| 64 20 74 6f 0a 58 2e 6e | 66 0a 58 0a 58 20 20 20 |d to.X.n|f.X.X |
|00003290| 20 66 6f 6f 20 20 20 20 | 68 61 6e 64 6c 65 5f 66 | foo |handle_f|
|000032a0| 6f 6f 28 29 3b 0a 58 0a | 58 2e 66 69 0a 58 2e 49 |oo();.X.|X.fi.X.I|
|000032b0| 20 66 6c 65 78 0a 58 64 | 6f 65 73 20 6e 6f 74 20 | flex.Xd|oes not |
|000032c0| 74 72 75 6e 63 61 74 65 | 20 74 68 65 20 61 63 74 |truncate| the act|
|000032d0| 69 6f 6e 2e 20 20 41 63 | 74 69 6f 6e 73 20 74 68 |ion. Ac|tions th|
|000032e0| 61 74 20 61 72 65 20 6e | 6f 74 20 65 6e 63 6c 6f |at are n|ot enclo|
|000032f0| 73 65 64 20 69 6e 0a 58 | 62 72 61 63 65 73 20 61 |sed in.X|braces a|
|00003300| 72 65 20 73 69 6d 70 6c | 79 20 74 65 72 6d 69 6e |re simpl|y termin|
|00003310| 61 74 65 64 20 61 74 20 | 74 68 65 20 65 6e 64 20 |ated at |the end |
|00003320| 6f 66 20 74 68 65 20 6c | 69 6e 65 2e 0a 58 2e 53 |of the l|ine..X.S|
|00003330| 48 20 44 49 41 47 4e 4f | 53 54 49 43 53 0a 58 2e |H DIAGNO|STICS.X.|
|00003340| 49 20 72 65 6a 65 63 74 | 5f 75 73 65 64 5f 62 75 |I reject|_used_bu|
|00003350| 74 5f 6e 6f 74 5f 64 65 | 74 65 63 74 65 64 20 75 |t_not_de|tected u|
|00003360| 6e 64 65 66 69 6e 65 64 | 0a 58 6f 72 0a 58 2e 49 |ndefined|.Xor.X.I|
|00003370| 20 79 79 6d 6f 72 65 5f | 75 73 65 64 5f 62 75 74 | yymore_|used_but|
|00003380| 5f 6e 6f 74 5f 64 65 74 | 65 63 74 65 64 20 75 6e |_not_det|ected un|
|00003390| 64 65 66 69 6e 65 64 20 | 2d 0a 58 54 68 65 73 65 |defined |-.XThese|
|000033a0| 20 65 72 72 6f 72 73 20 | 63 61 6e 20 6f 63 63 75 | errors |can occu|
|000033b0| 72 20 61 74 20 63 6f 6d | 70 69 6c 65 20 74 69 6d |r at com|pile tim|
|000033c0| 65 2e 20 20 54 68 65 79 | 20 69 6e 64 69 63 61 74 |e. They| indicat|
|000033d0| 65 20 74 68 61 74 20 74 | 68 65 0a 58 73 63 61 6e |e that t|he.Xscan|
|000033e0| 6e 65 72 20 75 73 65 73 | 0a 58 2e 42 20 52 45 4a |ner uses|.X.B REJ|
|000033f0| 45 43 54 0a 58 6f 72 0a | 58 2e 42 20 79 79 6d 6f |ECT.Xor.|X.B yymo|
|00003400| 72 65 28 29 0a 58 62 75 | 74 20 74 68 61 74 0a 58 |re().Xbu|t that.X|
|00003410| 2e 49 20 66 6c 65 78 0a | 58 66 61 69 6c 65 64 20 |.I flex.|Xfailed |
|00003420| 74 6f 20 6e 6f 74 69 63 | 65 20 74 68 65 20 66 61 |to notic|e the fa|
|00003430| 63 74 2c 20 6d 65 61 6e | 69 6e 67 20 74 68 61 74 |ct, mean|ing that|
|00003440| 0a 58 2e 49 20 66 6c 65 | 78 0a 58 73 63 61 6e 6e |.X.I fle|x.Xscann|
|00003450| 65 64 20 74 68 65 20 66 | 69 72 73 74 20 74 77 6f |ed the f|irst two|
|00003460| 20 73 65 63 74 69 6f 6e | 73 20 6c 6f 6f 6b 69 6e | section|s lookin|
|00003470| 67 20 66 6f 72 20 6f 63 | 63 75 72 72 65 6e 63 65 |g for oc|currence|
|00003480| 73 20 6f 66 20 74 68 65 | 73 65 20 61 63 74 69 6f |s of the|se actio|
|00003490| 6e 73 0a 58 61 6e 64 20 | 66 61 69 6c 65 64 20 74 |ns.Xand |failed t|
|000034a0| 6f 20 66 69 6e 64 20 61 | 6e 79 2c 20 62 75 74 20 |o find a|ny, but |
|000034b0| 73 6f 6d 65 68 6f 77 20 | 79 6f 75 20 73 6e 75 63 |somehow |you snuc|
|000034c0| 6b 20 73 6f 6d 65 20 69 | 6e 20 28 76 69 61 20 61 |k some i|n (via a|
|000034d0| 20 23 69 6e 63 6c 75 64 | 65 0a 58 66 69 6c 65 2c | #includ|e.Xfile,|
|000034e0| 20 66 6f 72 20 65 78 61 | 6d 70 6c 65 29 2e 20 20 | for exa|mple). |
|000034f0| 4d 61 6b 65 20 61 6e 20 | 65 78 70 6c 69 63 69 74 |Make an |explicit|
|00003500| 20 72 65 66 65 72 65 6e | 63 65 20 74 6f 20 74 68 | referen|ce to th|
|00003510| 65 20 61 63 74 69 6f 6e | 20 69 6e 20 79 6f 75 72 |e action| in your|
|00003520| 0a 58 2e 49 20 66 6c 65 | 78 0a 58 69 6e 70 75 74 |.X.I fle|x.Xinput|
|00003530| 20 66 69 6c 65 2e 20 20 | 28 4e 6f 74 65 20 74 68 | file. |(Note th|
|00003540| 61 74 20 70 72 65 76 69 | 6f 75 73 6c 79 0a 58 2e |at previ|ously.X.|
|00003550| 49 20 66 6c 65 78 0a 58 | 73 75 70 70 6f 72 74 65 |I flex.X|supporte|
|00003560| 64 20 61 0a 58 2e 42 20 | 25 75 73 65 64 2f 25 75 |d a.X.B |%used/%u|
|00003570| 6e 75 73 65 64 0a 58 6d | 65 63 68 61 6e 69 73 6d |nused.Xm|echanism|
|00003580| 20 66 6f 72 20 64 65 61 | 6c 69 6e 67 20 77 69 74 | for dea|ling wit|
|00003590| 68 20 74 68 69 73 20 70 | 72 6f 62 6c 65 6d 3b 20 |h this p|roblem; |
|000035a0| 74 68 69 73 20 66 65 61 | 74 75 72 65 20 69 73 20 |this fea|ture is |
|000035b0| 73 74 69 6c 6c 20 73 75 | 70 70 6f 72 74 65 64 0a |still su|pported.|
|000035c0| 58 62 75 74 20 6e 6f 77 | 20 64 65 70 72 65 63 61 |Xbut now| depreca|
|000035d0| 74 65 64 2c 20 61 6e 64 | 20 77 69 6c 6c 20 67 6f |ted, and| will go|
|000035e0| 20 61 77 61 79 20 73 6f | 6f 6e 20 75 6e 6c 65 73 | away so|on unles|
|000035f0| 73 20 74 68 65 20 61 75 | 74 68 6f 72 20 68 65 61 |s the au|thor hea|
|00003600| 72 73 20 66 72 6f 6d 0a | 58 70 65 6f 70 6c 65 20 |rs from.|Xpeople |
|00003610| 77 68 6f 20 63 61 6e 20 | 61 72 67 75 65 20 63 6f |who can |argue co|
|00003620| 6d 70 65 6c 6c 69 6e 67 | 6c 79 20 74 68 61 74 20 |mpelling|ly that |
|00003630| 74 68 65 79 20 6e 65 65 | 64 20 69 74 2e 29 0a 58 |they nee|d it.).X|
|00003640| 2e 4c 50 0a 58 2e 49 20 | 66 6c 65 78 20 73 63 61 |.LP.X.I |flex sca|
|00003650| 6e 6e 65 72 20 6a 61 6d | 6d 65 64 20 2d 0a 58 61 |nner jam|med -.Xa|
|00003660| 20 73 63 61 6e 6e 65 72 | 20 63 6f 6d 70 69 6c 65 | scanner| compile|
|00003670| 64 20 77 69 74 68 0a 58 | 2e 42 20 2d 73 0a 58 68 |d with.X|.B -s.Xh|
|00003680| 61 73 20 65 6e 63 6f 75 | 6e 74 65 72 65 64 20 61 |as encou|ntered a|
|00003690| 6e 20 69 6e 70 75 74 20 | 73 74 72 69 6e 67 20 77 |n input |string w|
|000036a0| 68 69 63 68 20 77 61 73 | 6e 27 74 20 6d 61 74 63 |hich was|n't matc|
|000036b0| 68 65 64 20 62 79 0a 58 | 61 6e 79 20 6f 66 20 69 |hed by.X|any of i|
|000036c0| 74 73 20 72 75 6c 65 73 | 2e 0a 58 2e 4c 50 0a 58 |ts rules|..X.LP.X|
|000036d0| 2e 49 20 66 6c 65 78 20 | 69 6e 70 75 74 20 62 75 |.I flex |input bu|
|000036e0| 66 66 65 72 20 6f 76 65 | 72 66 6c 6f 77 65 64 20 |ffer ove|rflowed |
|000036f0| 2d 0a 58 61 20 73 63 61 | 6e 6e 65 72 20 72 75 6c |-.Xa sca|nner rul|
|00003700| 65 20 6d 61 74 63 68 65 | 64 20 61 20 73 74 72 69 |e matche|d a stri|
|00003710| 6e 67 20 6c 6f 6e 67 20 | 65 6e 6f 75 67 68 20 74 |ng long |enough t|
|00003720| 6f 20 6f 76 65 72 66 6c | 6f 77 20 74 68 65 0a 58 |o overfl|ow the.X|
|00003730| 73 63 61 6e 6e 65 72 27 | 73 20 69 6e 74 65 72 6e |scanner'|s intern|
|00003740| 61 6c 20 69 6e 70 75 74 | 20 62 75 66 66 65 72 20 |al input| buffer |
|00003750| 28 31 36 4b 20 62 79 74 | 65 73 20 62 79 20 64 65 |(16K byt|es by de|
|00003760| 66 61 75 6c 74 20 2d 20 | 63 6f 6e 74 72 6f 6c 6c |fault - |controll|
|00003770| 65 64 20 62 79 0a 58 2e | 42 20 59 59 5f 42 55 46 |ed by.X.|B YY_BUF|
|00003780| 5f 53 49 5a 45 0a 58 69 | 6e 20 22 66 6c 65 78 2e |_SIZE.Xi|n "flex.|
|00003790| 73 6b 65 6c 22 2e 20 20 | 4e 6f 74 65 20 74 68 61 |skel". |Note tha|
|000037a0| 74 20 74 6f 20 72 65 64 | 65 66 69 6e 65 20 74 68 |t to red|efine th|
|000037b0| 69 73 20 6d 61 63 72 6f | 2c 20 79 6f 75 20 6d 75 |is macro|, you mu|
|000037c0| 73 74 20 66 69 72 73 74 | 0a 58 2e 42 20 23 75 6e |st first|.X.B #un|
|000037d0| 64 65 66 69 6e 65 0a 58 | 69 74 29 2e 0a 58 2e 4c |define.X|it)..X.L|
|000037e0| 50 0a 58 2e 49 20 73 63 | 61 6e 6e 65 72 20 72 65 |P.X.I sc|anner re|
|000037f0| 71 75 69 72 65 73 20 2d | 38 20 66 6c 61 67 20 2d |quires -|8 flag -|
|00003800| 0a 58 59 6f 75 72 20 73 | 63 61 6e 6e 65 72 20 73 |.XYour s|canner s|
|00003810| 70 65 63 69 66 69 63 61 | 74 69 6f 6e 20 69 6e 63 |pecifica|tion inc|
|00003820| 6c 75 64 65 73 20 72 65 | 63 6f 67 6e 69 7a 69 6e |ludes re|cognizin|
|00003830| 67 20 38 2d 62 69 74 20 | 63 68 61 72 61 63 74 65 |g 8-bit |characte|
|00003840| 72 73 20 61 6e 64 0a 58 | 79 6f 75 20 64 69 64 20 |rs and.X|you did |
|00003850| 6e 6f 74 20 73 70 65 63 | 69 66 79 20 74 68 65 20 |not spec|ify the |
|00003860| 2d 38 20 66 6c 61 67 20 | 28 61 6e 64 20 79 6f 75 |-8 flag |(and you|
|00003870| 72 20 73 69 74 65 20 68 | 61 73 20 6e 6f 74 20 69 |r site h|as not i|
|00003880| 6e 73 74 61 6c 6c 65 64 | 20 66 6c 65 78 0a 58 77 |nstalled| flex.Xw|
|00003890| 69 74 68 20 2d 38 20 61 | 73 20 74 68 65 20 64 65 |ith -8 a|s the de|
|000038a0| 66 61 75 6c 74 29 2e 0a | 58 2e 4c 50 0a 58 2e 49 |fault)..|X.LP.X.I|
|000038b0| 0a 58 66 61 74 61 6c 20 | 66 6c 65 78 20 73 63 61 |.Xfatal |flex sca|
|000038c0| 6e 6e 65 72 20 69 6e 74 | 65 72 6e 61 6c 20 65 72 |nner int|ernal er|
|000038d0| 72 6f 72 2d 2d 65 6e 64 | 20 6f 66 20 62 75 66 66 |ror--end| of buff|
|000038e0| 65 72 20 6d 69 73 73 65 | 64 20 2d 0a 58 54 68 69 |er misse|d -.XThi|
|000038f0| 73 20 63 61 6e 20 6f 63 | 63 75 72 20 69 6e 20 61 |s can oc|cur in a|
|00003900| 6e 20 73 63 61 6e 6e 65 | 72 20 77 68 69 63 68 20 |n scanne|r which |
|00003910| 69 73 20 72 65 65 6e 74 | 65 72 65 64 20 61 66 74 |is reent|ered aft|
|00003920| 65 72 20 61 20 6c 6f 6e | 67 2d 6a 75 6d 70 0a 58 |er a lon|g-jump.X|
|00003930| 68 61 73 20 6a 75 6d 70 | 65 64 20 6f 75 74 20 28 |has jump|ed out (|
|00003940| 6f 72 20 6f 76 65 72 29 | 20 74 68 65 20 73 63 61 |or over)| the sca|
|00003950| 6e 6e 65 72 27 73 20 61 | 63 74 69 76 61 74 69 6f |nner's a|ctivatio|
|00003960| 6e 20 66 72 61 6d 65 2e | 20 20 42 65 66 6f 72 65 |n frame.| Before|
|00003970| 0a 58 72 65 65 6e 74 65 | 72 69 6e 67 20 74 68 65 |.Xreente|ring the|
|00003980| 20 73 63 61 6e 6e 65 72 | 2c 20 75 73 65 3a 0a 58 | scanner|, use:.X|
|00003990| 2e 6e 66 0a 58 0a 58 20 | 20 20 20 79 79 72 65 73 |.nf.X.X | yyres|
|000039a0| 74 61 72 74 28 20 79 79 | 69 6e 20 29 3b 0a 58 0a |tart( yy|in );.X.|
|000039b0| 58 2e 66 69 0a 58 2e 4c | 50 0a 58 2e 49 20 74 6f |X.fi.X.L|P.X.I to|
|000039c0| 6f 20 6d 61 6e 79 20 25 | 74 20 63 6c 61 73 73 65 |o many %|t classe|
|000039d0| 73 21 20 2d 0a 58 59 6f | 75 20 6d 61 6e 61 67 65 |s! -.XYo|u manage|
|000039e0| 64 20 74 6f 20 70 75 74 | 20 65 76 65 72 79 20 73 |d to put| every s|
|000039f0| 69 6e 67 6c 65 20 63 68 | 61 72 61 63 74 65 72 20 |ingle ch|aracter |
|00003a00| 69 6e 74 6f 20 69 74 73 | 20 6f 77 6e 20 25 74 20 |into its| own %t |
|00003a10| 63 6c 61 73 73 2e 0a 58 | 2e 49 20 66 6c 65 78 0a |class..X|.I flex.|
|00003a20| 58 72 65 71 75 69 72 65 | 73 20 74 68 61 74 20 61 |Xrequire|s that a|
|00003a30| 74 20 6c 65 61 73 74 20 | 6f 6e 65 20 6f 66 20 74 |t least |one of t|
|00003a40| 68 65 20 63 6c 61 73 73 | 65 73 20 73 68 61 72 65 |he class|es share|
|00003a50| 20 63 68 61 72 61 63 74 | 65 72 73 2e 0a 58 2e 53 | charact|ers..X.S|
|00003a60| 48 20 44 45 46 49 43 49 | 45 4e 43 49 45 53 20 2f |H DEFICI|ENCIES /|
|00003a70| 20 42 55 47 53 0a 58 53 | 65 65 20 66 6c 65 78 28 | BUGS.XS|ee flex(|
|00003a80| 31 29 2e 0a 58 2e 53 48 | 20 22 53 45 45 20 41 4c |1)..X.SH| "SEE AL|
|00003a90| 53 4f 22 0a 58 2e 4c 50 | 0a 58 66 6c 65 78 28 31 |SO".X.LP|.Xflex(1|
|00003aa0| 29 2c 20 6c 65 78 28 31 | 29 2c 20 79 61 63 63 28 |), lex(1|), yacc(|
|00003ab0| 31 29 2c 20 73 65 64 28 | 31 29 2c 20 61 77 6b 28 |1), sed(|1), awk(|
|00003ac0| 31 29 2e 0a 58 2e 4c 50 | 0a 58 4d 2e 20 45 2e 20 |1)..X.LP|.XM. E. |
|00003ad0| 4c 65 73 6b 20 61 6e 64 | 20 45 2e 20 53 63 68 6d |Lesk and| E. Schm|
|00003ae0| 69 64 74 2c 0a 58 2e 49 | 20 4c 45 58 20 2d 20 4c |idt,.X.I| LEX - L|
|00003af0| 65 78 69 63 61 6c 20 41 | 6e 61 6c 79 7a 65 72 20 |exical A|nalyzer |
|00003b00| 47 65 6e 65 72 61 74 6f | 72 0a 58 2e 53 48 20 41 |Generato|r.X.SH A|
|00003b10| 55 54 48 4f 52 0a 58 56 | 65 72 6e 20 50 61 78 73 |UTHOR.XV|ern Paxs|
|00003b20| 6f 6e 2c 20 77 69 74 68 | 20 74 68 65 20 68 65 6c |on, with| the hel|
|00003b30| 70 20 6f 66 20 6d 61 6e | 79 20 69 64 65 61 73 20 |p of man|y ideas |
|00003b40| 61 6e 64 20 6d 75 63 68 | 20 69 6e 73 70 69 72 61 |and much| inspira|
|00003b50| 74 69 6f 6e 20 66 72 6f | 6d 0a 58 56 61 6e 20 4a |tion fro|m.XVan J|
|00003b60| 61 63 6f 62 73 6f 6e 2e | 20 20 4f 72 69 67 69 6e |acobson.| Origin|
|00003b70| 61 6c 20 76 65 72 73 69 | 6f 6e 20 62 79 20 4a 65 |al versi|on by Je|
|00003b80| 66 20 50 6f 73 6b 61 6e | 7a 65 72 2e 20 20 54 68 |f Poskan|zer. Th|
|00003b90| 65 20 66 61 73 74 20 74 | 61 62 6c 65 0a 58 72 65 |e fast t|able.Xre|
|00003ba0| 70 72 65 73 65 6e 74 61 | 74 69 6f 6e 20 69 73 20 |presenta|tion is |
|00003bb0| 61 20 70 61 72 74 69 61 | 6c 20 69 6d 70 6c 65 6d |a partia|l implem|
|00003bc0| 65 6e 74 61 74 69 6f 6e | 20 6f 66 20 61 20 64 65 |entation| of a de|
|00003bd0| 73 69 67 6e 20 64 6f 6e | 65 20 62 79 20 56 61 6e |sign don|e by Van|
|00003be0| 0a 58 4a 61 63 6f 62 73 | 6f 6e 2e 20 20 54 68 65 |.XJacobs|on. The|
|00003bf0| 20 69 6d 70 6c 65 6d 65 | 6e 74 61 74 69 6f 6e 20 | impleme|ntation |
|00003c00| 77 61 73 20 64 6f 6e 65 | 20 62 79 20 4b 65 76 69 |was done| by Kevi|
|00003c10| 6e 20 47 6f 6e 67 20 61 | 6e 64 20 56 65 72 6e 20 |n Gong a|nd Vern |
|00003c20| 50 61 78 73 6f 6e 2e 0a | 58 2e 4c 50 0a 58 54 68 |Paxson..|X.LP.XTh|
|00003c30| 61 6e 6b 73 20 74 6f 20 | 74 68 65 20 6d 61 6e 79 |anks to |the many|
|00003c40| 0a 58 2e 49 20 66 6c 65 | 78 0a 58 62 65 74 61 2d |.X.I fle|x.Xbeta-|
|00003c50| 74 65 73 74 65 72 73 2c | 20 66 65 65 64 62 61 63 |testers,| feedbac|
|00003c60| 6b 65 72 73 2c 20 61 6e | 64 20 63 6f 6e 74 72 69 |kers, an|d contri|
|00003c70| 62 75 74 6f 72 73 2c 20 | 65 73 70 65 63 69 61 6c |butors, |especial|
|00003c80| 6c 79 20 43 61 73 65 79 | 0a 58 4c 65 65 64 6f 6d |ly Casey|.XLeedom|
|00003c90| 2c 20 62 65 6e 73 6f 6e | 40 6f 64 69 2e 63 6f 6d |, benson|@odi.com|
|00003ca0| 2c 20 4b 65 69 74 68 20 | 42 6f 73 74 69 63 2c 0a |, Keith |Bostic,.|
|00003cb0| 58 46 72 65 64 65 72 69 | 63 20 42 72 65 68 6d 2c |XFrederi|c Brehm,|
|00003cc0| 20 4e 69 63 6b 20 43 68 | 72 69 73 74 6f 70 68 65 | Nick Ch|ristophe|
|00003cd0| 72 2c 20 4a 61 73 6f 6e | 20 43 6f 75 67 68 6c 69 |r, Jason| Coughli|
|00003ce0| 6e 2c 0a 58 53 63 6f 74 | 74 20 44 61 76 69 64 20 |n,.XScot|t David |
|00003cf0| 44 61 6e 69 65 6c 73 2c | 20 4c 65 6f 20 45 73 6b |Daniels,| Leo Esk|
|00003d00| 69 6e 2c 0a 58 43 68 72 | 69 73 20 46 61 79 6c 6f |in,.XChr|is Faylo|
|00003d10| 72 2c 20 45 72 69 63 20 | 47 6f 6c 64 6d 61 6e 2c |r, Eric |Goldman,|
|00003d20| 20 45 72 69 63 0a 58 48 | 75 67 68 65 73 2c 20 4a | Eric.XH|ughes, J|
|00003d30| 65 66 66 72 65 79 20 52 | 2e 20 4a 6f 6e 65 73 2c |effrey R|. Jones,|
|00003d40| 20 4b 65 76 69 6e 20 42 | 2e 20 4b 65 6e 6e 79 2c | Kevin B|. Kenny,|
|00003d50| 20 52 6f 6e 61 6c 64 20 | 4c 61 6d 70 72 65 63 68 | Ronald |Lamprech|
|00003d60| 74 2c 0a 58 47 72 65 67 | 20 4c 65 65 2c 20 43 72 |t,.XGreg| Lee, Cr|
|00003d70| 61 69 67 20 4c 65 72 65 | 73 2c 20 4d 6f 68 61 6d |aig Lere|s, Moham|
|00003d80| 65 64 20 65 6c 20 4c 6f | 7a 79 2c 20 4a 69 6d 20 |ed el Lo|zy, Jim |
|00003d90| 4d 65 79 65 72 69 6e 67 | 2c 20 4d 61 72 63 20 4e |Meyering|, Marc N|
|00003da0| 6f 7a 65 6c 6c 2c 20 45 | 73 6d 6f 6e 64 20 50 69 |ozell, E|smond Pi|
|00003db0| 74 74 2c 0a 58 4a 65 66 | 20 50 6f 73 6b 61 6e 7a |tt,.XJef| Poskanz|
|00003dc0| 65 72 2c 20 4a 69 6d 20 | 52 6f 73 6b 69 6e 64 2c |er, Jim |Roskind,|
|00003dd0| 0a 58 44 61 76 65 20 54 | 61 6c 6c 6d 61 6e 2c 20 |.XDave T|allman, |
|00003de0| 46 72 61 6e 6b 20 57 68 | 61 6c 65 79 2c 20 4b 65 |Frank Wh|aley, Ke|
|00003df0| 6e 20 59 61 70 2c 20 61 | 6e 64 20 74 68 6f 73 65 |n Yap, a|nd those|
|00003e00| 20 77 68 6f 73 65 20 6e | 61 6d 65 73 0a 58 68 61 | whose n|ames.Xha|
|00003e10| 76 65 20 73 6c 69 70 70 | 65 64 20 6d 79 20 6d 61 |ve slipp|ed my ma|
|00003e20| 72 67 69 6e 61 6c 20 6d | 61 69 6c 2d 61 72 63 68 |rginal m|ail-arch|
|00003e30| 69 76 69 6e 67 20 73 6b | 69 6c 6c 73 20 62 75 74 |iving sk|ills but|
|00003e40| 20 77 68 6f 73 65 20 63 | 6f 6e 74 72 69 62 75 74 | whose c|ontribut|
|00003e50| 69 6f 6e 73 0a 58 61 72 | 65 20 61 70 70 72 65 63 |ions.Xar|e apprec|
|00003e60| 69 61 74 65 64 20 61 6c | 6c 20 74 68 65 20 73 61 |iated al|l the sa|
|00003e70| 6d 65 2e 0a 58 2e 4c 50 | 0a 58 54 68 61 6e 6b 73 |me..X.LP|.XThanks|
|00003e80| 20 74 6f 20 4b 65 69 74 | 68 20 42 6f 73 74 69 63 | to Keit|h Bostic|
|00003e90| 2c 20 4a 6f 68 6e 20 47 | 69 6c 6d 6f 72 65 2c 20 |, John G|ilmore, |
|00003ea0| 43 72 61 69 67 20 4c 65 | 72 65 73 2c 20 42 6f 62 |Craig Le|res, Bob|
|00003eb0| 0a 58 4d 75 6c 63 61 68 | 79 2c 20 52 69 63 68 20 |.XMulcah|y, Rich |
|00003ec0| 53 61 6c 7a 2c 20 61 6e | 64 20 52 69 63 68 61 72 |Salz, an|d Richar|
|00003ed0| 64 20 53 74 61 6c 6c 6d | 61 6e 20 66 6f 72 20 68 |d Stallm|an for h|
|00003ee0| 65 6c 70 20 77 69 74 68 | 20 76 61 72 69 6f 75 73 |elp with| various|
|00003ef0| 20 64 69 73 74 72 69 62 | 75 74 69 6f 6e 0a 58 68 | distrib|ution.Xh|
|00003f00| 65 61 64 61 63 68 65 73 | 2e 0a 58 2e 4c 50 0a 58 |eadaches|..X.LP.X|
|00003f10| 54 68 61 6e 6b 73 20 74 | 6f 20 45 73 6d 6f 6e 64 |Thanks t|o Esmond|
|00003f20| 20 50 69 74 74 20 61 6e | 64 20 45 61 72 6c 65 20 | Pitt an|d Earle |
|00003f30| 48 6f 72 74 6f 6e 20 66 | 6f 72 20 38 2d 62 69 74 |Horton f|or 8-bit|
|00003f40| 20 63 68 61 72 61 63 74 | 65 72 20 73 75 70 70 6f | charact|er suppo|
|00003f50| 72 74 3b 0a 58 74 6f 20 | 42 65 6e 73 6f 6e 20 4d |rt;.Xto |Benson M|
|00003f60| 61 72 67 75 6c 69 65 73 | 20 61 6e 64 20 46 72 65 |argulies| and Fre|
|00003f70| 64 0a 58 42 75 72 6b 65 | 20 66 6f 72 20 43 2b 2b |d.XBurke| for C++|
|00003f80| 20 73 75 70 70 6f 72 74 | 3b 20 74 6f 20 4f 76 65 | support|; to Ove|
|00003f90| 20 45 77 65 72 6c 69 64 | 20 66 6f 72 20 74 68 65 | Ewerlid| for the|
|00003fa0| 20 62 61 73 69 63 73 20 | 6f 66 20 73 75 70 70 6f | basics |of suppo|
|00003fb0| 72 74 20 66 6f 72 0a 58 | 4e 55 4c 27 73 3b 20 61 |rt for.X|NUL's; a|
|00003fc0| 6e 64 20 74 6f 20 45 72 | 69 63 20 48 75 67 68 65 |nd to Er|ic Hughe|
|00003fd0| 73 20 66 6f 72 20 74 68 | 65 20 62 61 73 69 63 73 |s for th|e basics|
|00003fe0| 20 6f 66 20 73 75 70 70 | 6f 72 74 20 66 6f 72 20 | of supp|ort for |
|00003ff0| 6d 75 6c 74 69 70 6c 65 | 20 62 75 66 66 65 72 73 |multiple| buffers|
|00004000| 2e 0a 58 2e 4c 50 0a 58 | 57 6f 72 6b 20 69 73 20 |..X.LP.X|Work is |
|00004010| 62 65 69 6e 67 20 64 6f | 6e 65 20 6f 6e 20 65 78 |being do|ne on ex|
|00004020| 74 65 6e 64 69 6e 67 0a | 58 2e 49 20 66 6c 65 78 |tending.|X.I flex|
|00004030| 0a 58 74 6f 20 67 65 6e | 65 72 61 74 65 20 73 63 |.Xto gen|erate sc|
|00004040| 61 6e 6e 65 72 73 20 69 | 6e 20 77 68 69 63 68 20 |anners i|n which |
|00004050| 74 68 65 0a 58 73 74 61 | 74 65 20 6d 61 63 68 69 |the.Xsta|te machi|
|00004060| 6e 65 20 69 73 20 64 69 | 72 65 63 74 6c 79 20 72 |ne is di|rectly r|
|00004070| 65 70 72 65 73 65 6e 74 | 65 64 20 69 6e 20 43 20 |epresent|ed in C |
|00004080| 63 6f 64 65 20 72 61 74 | 68 65 72 20 74 68 61 6e |code rat|her than|
|00004090| 20 74 61 62 6c 65 73 2e | 0a 58 54 68 65 73 65 20 | tables.|.XThese |
|000040a0| 73 63 61 6e 6e 65 72 73 | 20 6d 61 79 20 77 65 6c |scanners| may wel|
|000040b0| 6c 20 62 65 20 73 75 62 | 73 74 61 6e 74 69 61 6c |l be sub|stantial|
|000040c0| 6c 79 20 66 61 73 74 65 | 72 20 74 68 61 6e 20 74 |ly faste|r than t|
|000040d0| 68 6f 73 65 20 67 65 6e | 65 72 61 74 65 64 0a 58 |hose gen|erated.X|
|000040e0| 75 73 69 6e 67 20 2d 66 | 20 6f 72 20 2d 46 2e 20 |using -f| or -F. |
|000040f0| 20 49 66 20 79 6f 75 20 | 61 72 65 20 77 6f 72 6b | If you |are work|
|00004100| 69 6e 67 20 69 6e 20 74 | 68 69 73 20 61 72 65 61 |ing in t|his area|
|00004110| 20 61 6e 64 20 61 72 65 | 20 69 6e 74 65 72 65 73 | and are| interes|
|00004120| 74 65 64 0a 58 69 6e 20 | 63 6f 6d 70 61 72 69 6e |ted.Xin |comparin|
|00004130| 67 20 6e 6f 74 65 73 20 | 61 6e 64 20 73 65 65 69 |g notes |and seei|
|00004140| 6e 67 20 77 68 65 74 68 | 65 72 20 72 65 64 75 6e |ng wheth|er redun|
|00004150| 64 61 6e 74 20 77 6f 72 | 6b 20 63 61 6e 20 62 65 |dant wor|k can be|
|00004160| 20 61 76 6f 69 64 65 64 | 2c 0a 58 63 6f 6e 74 61 | avoided|,.Xconta|
|00004170| 63 74 20 4f 76 65 20 45 | 77 65 72 6c 69 64 20 28 |ct Ove E|werlid (|
|00004180| 65 77 65 72 6c 69 64 40 | 6d 69 7a 61 72 2e 44 6f |ewerlid@|mizar.Do|
|00004190| 43 53 2e 55 55 2e 53 45 | 29 2e 0a 58 2e 4c 50 0a |CS.UU.SE|)..X.LP.|
|000041a0| 58 54 68 69 73 20 77 6f | 72 6b 20 77 61 73 20 70 |XThis wo|rk was p|
|000041b0| 72 69 6d 61 72 69 6c 79 | 20 64 6f 6e 65 20 77 68 |rimarily| done wh|
|000041c0| 65 6e 20 49 20 77 61 73 | 20 61 74 20 74 68 65 20 |en I was| at the |
|000041d0| 52 65 61 6c 20 54 69 6d | 65 20 53 79 73 74 65 6d |Real Tim|e System|
|000041e0| 73 20 47 72 6f 75 70 0a | 58 61 74 20 74 68 65 20 |s Group.|Xat the |
|000041f0| 4c 61 77 72 65 6e 63 65 | 20 42 65 72 6b 65 6c 65 |Lawrence| Berkele|
|00004200| 79 20 4c 61 62 6f 72 61 | 74 6f 72 79 20 69 6e 20 |y Labora|tory in |
|00004210| 42 65 72 6b 65 6c 65 79 | 2c 20 43 41 2e 20 20 4d |Berkeley|, CA. M|
|00004220| 61 6e 79 20 74 68 61 6e | 6b 73 20 74 6f 20 61 6c |any than|ks to al|
|00004230| 6c 20 74 68 65 72 65 0a | 58 66 6f 72 20 74 68 65 |l there.|Xfor the|
|00004240| 20 73 75 70 70 6f 72 74 | 20 49 20 72 65 63 65 69 | support| I recei|
|00004250| 76 65 64 2e 0a 58 2e 4c | 50 0a 58 53 65 6e 64 20 |ved..X.L|P.XSend |
|00004260| 63 6f 6d 6d 65 6e 74 73 | 20 74 6f 3a 0a 58 2e 6e |comments| to:.X.n|
|00004270| 66 0a 58 0a 58 20 20 20 | 20 20 56 65 72 6e 20 50 |f.X.X | Vern P|
|00004280| 61 78 73 6f 6e 0a 58 20 | 20 20 20 20 43 6f 6d 70 |axson.X | Comp|
|00004290| 75 74 65 72 20 53 63 69 | 65 6e 63 65 20 44 65 70 |uter Sci|ence Dep|
|000042a0| 61 72 74 6d 65 6e 74 0a | 58 20 20 20 20 20 34 31 |artment.|X 41|
|000042b0| 32 36 20 55 70 73 6f 6e | 20 48 61 6c 6c 0a 58 20 |26 Upson| Hall.X |
|000042c0| 20 20 20 20 43 6f 72 6e | 65 6c 6c 20 55 6e 69 76 | Corn|ell Univ|
|000042d0| 65 72 73 69 74 79 0a 58 | 20 20 20 20 20 49 74 68 |ersity.X| Ith|
|000042e0| 61 63 61 2c 20 4e 59 20 | 31 34 38 35 33 2d 37 35 |aca, NY |14853-75|
|000042f0| 30 31 0a 58 0a 58 20 20 | 20 20 20 76 65 72 6e 40 |01.X.X | vern@|
|00004300| 63 73 2e 63 6f 72 6e 65 | 6c 6c 2e 65 64 75 0a 58 |cs.corne|ll.edu.X|
|00004310| 20 20 20 20 20 64 65 63 | 76 61 78 21 63 6f 72 6e | dec|vax!corn|
|00004320| 65 6c 6c 21 76 65 72 6e | 0a 58 0a 58 2e 66 69 0a |ell!vern|.X.X.fi.|
|00004330| 45 4e 44 5f 4f 46 5f 46 | 49 4c 45 0a 20 20 69 66 |END_OF_F|ILE. if|
|00004340| 20 74 65 73 74 20 31 35 | 35 31 34 20 2d 6e 65 20 | test 15|514 -ne |
|00004350| 60 77 63 20 2d 63 20 3c | 27 66 6c 65 78 64 6f 63 |`wc -c <|'flexdoc|
|00004360| 2e 31 2e 30 32 27 60 3b | 20 74 68 65 6e 0a 20 20 |.1.02'`;| then. |
|00004370| 20 20 65 63 68 6f 20 73 | 68 61 72 3a 20 5c 22 27 | echo s|har: \"'|
|00004380| 66 6c 65 78 64 6f 63 2e | 31 2e 30 32 27 5c 22 20 |flexdoc.|1.02'\" |
|00004390| 75 6e 70 61 63 6b 65 64 | 20 77 69 74 68 20 77 72 |unpacked| with wr|
|000043a0| 6f 6e 67 20 73 69 7a 65 | 21 0a 20 20 66 69 0a 20 |ong size|!. fi. |
|000043b0| 20 23 20 65 6e 64 20 6f | 66 20 27 66 6c 65 78 64 | # end o|f 'flexd|
|000043c0| 6f 63 2e 31 2e 30 32 27 | 0a 66 69 0a 69 66 20 74 |oc.1.02'|.fi.if t|
|000043d0| 65 73 74 20 2d 66 20 27 | 6d 69 73 63 2e 63 27 20 |est -f '|misc.c' |
|000043e0| 2d 61 20 22 24 7b 31 7d | 22 20 21 3d 20 22 2d 63 |-a "${1}|" != "-c|
|000043f0| 22 20 3b 20 74 68 65 6e | 20 0a 20 20 65 63 68 6f |" ; then| . echo|
|00004400| 20 73 68 61 72 3a 20 57 | 69 6c 6c 20 6e 6f 74 20 | shar: W|ill not |
|00004410| 63 6c 6f 62 62 65 72 20 | 65 78 69 73 74 69 6e 67 |clobber |existing|
|00004420| 20 66 69 6c 65 20 5c 22 | 27 6d 69 73 63 2e 63 27 | file \"|'misc.c'|
|00004430| 5c 22 0a 65 6c 73 65 0a | 20 20 65 63 68 6f 20 73 |\".else.| echo s|
|00004440| 68 61 72 3a 20 45 78 74 | 72 61 63 74 69 6e 67 20 |har: Ext|racting |
|00004450| 5c 22 27 6d 69 73 63 2e | 63 27 5c 22 20 5c 28 31 |\"'misc.|c'\" \(1|
|00004460| 34 39 31 32 20 63 68 61 | 72 61 63 74 65 72 73 5c |4912 cha|racters\|
|00004470| 29 0a 20 20 73 65 64 20 | 22 73 2f 5e 58 2f 2f 22 |). sed |"s/^X//"|
|00004480| 20 3e 27 6d 69 73 63 2e | 63 27 20 3c 3c 27 45 4e | >'misc.|c' <<'EN|
|00004490| 44 5f 4f 46 5f 46 49 4c | 45 27 0a 58 2f 2a 20 6d |D_OF_FIL|E'.X/* m|
|000044a0| 69 73 63 20 2d 20 6d 69 | 73 63 65 6c 6c 61 6e 65 |isc - mi|scellane|
|000044b0| 6f 75 73 20 66 6c 65 78 | 20 72 6f 75 74 69 6e 65 |ous flex| routine|
|000044c0| 73 20 2a 2f 0a 58 0a 58 | 2f 2a 2d 0a 58 20 2a 20 |s */.X.X|/*-.X * |
|000044d0| 43 6f 70 79 72 69 67 68 | 74 20 28 63 29 20 31 39 |Copyrigh|t (c) 19|
|000044e0| 39 30 20 54 68 65 20 52 | 65 67 65 6e 74 73 20 6f |90 The R|egents o|
|000044f0| 66 20 74 68 65 20 55 6e | 69 76 65 72 73 69 74 79 |f the Un|iversity|
|00004500| 20 6f 66 20 43 61 6c 69 | 66 6f 72 6e 69 61 2e 0a | of Cali|fornia..|
|00004510| 58 20 2a 20 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |X * All |rights r|
|00004520| 65 73 65 72 76 65 64 2e | 0a 58 20 2a 0a 58 20 2a |eserved.|.X *.X *|
|00004530| 20 54 68 69 73 20 63 6f | 64 65 20 69 73 20 64 65 | This co|de is de|
|00004540| 72 69 76 65 64 20 66 72 | 6f 6d 20 73 6f 66 74 77 |rived fr|om softw|
|00004550| 61 72 65 20 63 6f 6e 74 | 72 69 62 75 74 65 64 20 |are cont|ributed |
|00004560| 74 6f 20 42 65 72 6b 65 | 6c 65 79 20 62 79 0a 58 |to Berke|ley by.X|
|00004570| 20 2a 20 56 65 72 6e 20 | 50 61 78 73 6f 6e 2e 0a | * Vern |Paxson..|
|00004580| 58 20 2a 20 0a 58 20 2a | 20 54 68 65 20 55 6e 69 |X * .X *| The Uni|
|00004590| 74 65 64 20 53 74 61 74 | 65 73 20 47 6f 76 65 72 |ted Stat|es Gover|
|000045a0| 6e 6d 65 6e 74 20 68 61 | 73 20 72 69 67 68 74 73 |nment ha|s rights|
|000045b0| 20 69 6e 20 74 68 69 73 | 20 77 6f 72 6b 20 70 75 | in this| work pu|
|000045c0| 72 73 75 61 6e 74 0a 58 | 20 2a 20 74 6f 20 63 6f |rsuant.X| * to co|
|000045d0| 6e 74 72 61 63 74 20 6e | 6f 2e 20 44 45 2d 41 43 |ntract n|o. DE-AC|
|000045e0| 30 33 2d 37 36 53 46 30 | 30 30 39 38 20 62 65 74 |03-76SF0|0098 bet|
|000045f0| 77 65 65 6e 20 74 68 65 | 20 55 6e 69 74 65 64 20 |ween the| United |
|00004600| 53 74 61 74 65 73 0a 58 | 20 2a 20 44 65 70 61 72 |States.X| * Depar|
|00004610| 74 6d 65 6e 74 20 6f 66 | 20 45 6e 65 72 67 79 20 |tment of| Energy |
|00004620| 61 6e 64 20 74 68 65 20 | 55 6e 69 76 65 72 73 69 |and the |Universi|
|00004630| 74 79 20 6f 66 20 43 61 | 6c 69 66 6f 72 6e 69 61 |ty of Ca|lifornia|
|00004640| 2e 0a 58 20 2a 0a 58 20 | 2a 20 52 65 64 69 73 74 |..X *.X |* Redist|
|00004650| 72 69 62 75 74 69 6f 6e | 20 61 6e 64 20 75 73 65 |ribution| and use|
|00004660| 20 69 6e 20 73 6f 75 72 | 63 65 20 61 6e 64 20 62 | in sour|ce and b|
|00004670| 69 6e 61 72 79 20 66 6f | 72 6d 73 20 61 72 65 20 |inary fo|rms are |
|00004680| 70 65 72 6d 69 74 74 65 | 64 20 70 72 6f 76 69 64 |permitte|d provid|
|00004690| 65 64 0a 58 20 2a 20 74 | 68 61 74 3a 20 28 31 29 |ed.X * t|hat: (1)|
|000046a0| 20 73 6f 75 72 63 65 20 | 64 69 73 74 72 69 62 75 | source |distribu|
|000046b0| 74 69 6f 6e 73 20 72 65 | 74 61 69 6e 20 74 68 69 |tions re|tain thi|
|000046c0| 73 20 65 6e 74 69 72 65 | 20 63 6f 70 79 72 69 67 |s entire| copyrig|
|000046d0| 68 74 20 6e 6f 74 69 63 | 65 20 61 6e 64 0a 58 20 |ht notic|e and.X |
|000046e0| 2a 20 63 6f 6d 6d 65 6e | 74 2c 20 61 6e 64 20 28 |* commen|t, and (|
|000046f0| 32 29 20 64 69 73 74 72 | 69 62 75 74 69 6f 6e 73 |2) distr|ibutions|
|00004700| 20 69 6e 63 6c 75 64 69 | 6e 67 20 62 69 6e 61 72 | includi|ng binar|
|00004710| 69 65 73 20 64 69 73 70 | 6c 61 79 20 74 68 65 20 |ies disp|lay the |
|00004720| 66 6f 6c 6c 6f 77 69 6e | 67 0a 58 20 2a 20 61 63 |followin|g.X * ac|
|00004730| 6b 6e 6f 77 6c 65 64 67 | 65 6d 65 6e 74 3a 20 20 |knowledg|ement: |
|00004740| 60 60 54 68 69 73 20 70 | 72 6f 64 75 63 74 20 69 |``This p|roduct i|
|00004750| 6e 63 6c 75 64 65 73 20 | 73 6f 66 74 77 61 72 65 |ncludes |software|
|00004760| 20 64 65 76 65 6c 6f 70 | 65 64 20 62 79 20 74 68 | develop|ed by th|
|00004770| 65 0a 58 20 2a 20 55 6e | 69 76 65 72 73 69 74 79 |e.X * Un|iversity|
|00004780| 20 6f 66 20 43 61 6c 69 | 66 6f 72 6e 69 61 2c 20 | of Cali|fornia, |
|00004790| 42 65 72 6b 65 6c 65 79 | 20 61 6e 64 20 69 74 73 |Berkeley| and its|
|000047a0| 20 63 6f 6e 74 72 69 62 | 75 74 6f 72 73 27 27 20 | contrib|utors'' |
|000047b0| 69 6e 20 74 68 65 0a 58 | 20 2a 20 64 6f 63 75 6d |in the.X| * docum|
|000047c0| 65 6e 74 61 74 69 6f 6e | 20 6f 72 20 6f 74 68 65 |entation| or othe|
|000047d0| 72 20 6d 61 74 65 72 69 | 61 6c 73 20 70 72 6f 76 |r materi|als prov|
|000047e0| 69 64 65 64 20 77 69 74 | 68 20 74 68 65 20 64 69 |ided wit|h the di|
|000047f0| 73 74 72 69 62 75 74 69 | 6f 6e 20 61 6e 64 20 69 |stributi|on and i|
|00004800| 6e 0a 58 20 2a 20 61 6c | 6c 20 61 64 76 65 72 74 |n.X * al|l advert|
|00004810| 69 73 69 6e 67 20 6d 61 | 74 65 72 69 61 6c 73 20 |ising ma|terials |
|00004820| 6d 65 6e 74 69 6f 6e 69 | 6e 67 20 66 65 61 74 75 |mentioni|ng featu|
|00004830| 72 65 73 20 6f 72 20 75 | 73 65 20 6f 66 20 74 68 |res or u|se of th|
|00004840| 69 73 20 73 6f 66 74 77 | 61 72 65 2e 0a 58 20 2a |is softw|are..X *|
|00004850| 20 4e 65 69 74 68 65 72 | 20 74 68 65 20 6e 61 6d | Neither| the nam|
|00004860| 65 20 6f 66 20 74 68 65 | 20 55 6e 69 76 65 72 73 |e of the| Univers|
|00004870| 69 74 79 20 6e 6f 72 20 | 74 68 65 20 6e 61 6d 65 |ity nor |the name|
|00004880| 73 20 6f 66 20 69 74 73 | 20 63 6f 6e 74 72 69 62 |s of its| contrib|
|00004890| 75 74 6f 72 73 20 6d 61 | 79 0a 58 20 2a 20 62 65 |utors ma|y.X * be|
|000048a0| 20 75 73 65 64 20 74 6f | 20 65 6e 64 6f 72 73 65 | used to| endorse|
|000048b0| 20 6f 72 20 70 72 6f 6d | 6f 74 65 20 70 72 6f 64 | or prom|ote prod|
|000048c0| 75 63 74 73 20 64 65 72 | 69 76 65 64 20 66 72 6f |ucts der|ived fro|
|000048d0| 6d 20 74 68 69 73 20 73 | 6f 66 74 77 61 72 65 20 |m this s|oftware |
|000048e0| 77 69 74 68 6f 75 74 0a | 58 20 2a 20 73 70 65 63 |without.|X * spec|
|000048f0| 69 66 69 63 20 70 72 69 | 6f 72 20 77 72 69 74 74 |ific pri|or writt|
|00004900| 65 6e 20 70 65 72 6d 69 | 73 73 69 6f 6e 2e 0a 58 |en permi|ssion..X|
|00004910| 20 2a 20 54 48 49 53 20 | 53 4f 46 54 57 41 52 45 | * THIS |SOFTWARE|
|00004920| 20 49 53 20 50 52 4f 56 | 49 44 45 44 20 60 60 41 | IS PROV|IDED ``A|
|00004930| 53 20 49 53 27 27 20 41 | 4e 44 20 57 49 54 48 4f |S IS'' A|ND WITHO|
|00004940| 55 54 20 41 4e 59 20 45 | 58 50 52 45 53 53 20 4f |UT ANY E|XPRESS O|
|00004950| 52 20 49 4d 50 4c 49 45 | 44 0a 58 20 2a 20 57 41 |R IMPLIE|D.X * WA|
|00004960| 52 52 41 4e 54 49 45 53 | 2c 20 49 4e 43 4c 55 44 |RRANTIES|, INCLUD|
|00004970| 49 4e 47 2c 20 57 49 54 | 48 4f 55 54 20 4c 49 4d |ING, WIT|HOUT LIM|
|00004980| 49 54 41 54 49 4f 4e 2c | 20 54 48 45 20 49 4d 50 |ITATION,| THE IMP|
|00004990| 4c 49 45 44 20 57 41 52 | 52 41 4e 54 49 45 53 20 |LIED WAR|RANTIES |
|000049a0| 4f 46 0a 58 20 2a 20 4d | 45 52 43 48 41 4e 54 41 |OF.X * M|ERCHANTA|
|000049b0| 42 49 4c 49 54 59 20 41 | 4e 44 20 46 49 54 4e 45 |BILITY A|ND FITNE|
|000049c0| 53 53 20 46 4f 52 20 41 | 20 50 41 52 54 49 43 55 |SS FOR A| PARTICU|
|000049d0| 4c 41 52 20 50 55 52 50 | 4f 53 45 2e 0a 58 20 2a |LAR PURP|OSE..X *|
|000049e0| 2f 0a 58 0a 58 23 69 66 | 6e 64 65 66 20 6c 69 6e |/.X.X#if|ndef lin|
|000049f0| 74 0a 58 73 74 61 74 69 | 63 20 63 68 61 72 20 72 |t.Xstati|c char r|
|00004a00| 63 73 69 64 5b 5d 20 3d | 0a 58 20 20 20 20 22 40 |csid[] =|.X "@|
|00004a10| 28 23 29 20 24 48 65 61 | 64 65 72 3a 20 2f 75 73 |(#) $Hea|der: /us|
|00004a20| 72 2f 66 73 79 73 2f 6f | 64 69 6e 2f 61 2f 76 65 |r/fsys/o|din/a/ve|
|00004a30| 72 6e 2f 66 6c 65 78 2f | 52 43 53 2f 6d 69 73 63 |rn/flex/|RCS/misc|
|00004a40| 2e 63 2c 76 20 32 2e 39 | 20 39 30 2f 30 38 2f 31 |.c,v 2.9| 90/08/1|
|00004a50| 34 20 30 30 3a 31 30 3a | 32 34 20 76 65 72 6e 20 |4 00:10:|24 vern |
|00004a60| 45 78 70 20 24 20 28 4c | 42 4c 29 22 3b 0a 58 23 |Exp $ (L|BL)";.X#|
|00004a70| 65 6e 64 69 66 0a 58 0a | 58 23 69 6e 63 6c 75 64 |endif.X.|X#includ|
|00004a80| 65 20 3c 63 74 79 70 65 | 2e 68 3e 0a 58 23 69 6e |e <ctype|.h>.X#in|
|00004a90| 63 6c 75 64 65 20 22 66 | 6c 65 78 64 65 66 2e 68 |clude "f|lexdef.h|
|00004aa0| 22 0a 58 0a 58 0a 58 2f | 2a 20 41 4e 53 49 20 43 |".X.X.X/|* ANSI C|
|00004ab0| 20 64 6f 65 73 20 6e 6f | 74 20 67 75 61 72 61 6e | does no|t guaran|
|00004ac0| 74 65 65 20 74 68 61 74 | 20 69 73 61 73 63 69 69 |tee that| isascii|
|00004ad0| 28 29 20 69 73 20 64 65 | 66 69 6e 65 64 20 2a 2f |() is de|fined */|
|00004ae0| 0a 58 23 69 66 6e 64 65 | 66 20 69 73 61 73 63 69 |.X#ifnde|f isasci|
|00004af0| 69 0a 58 23 64 65 66 69 | 6e 65 20 69 73 61 73 63 |i.X#defi|ne isasc|
|00004b00| 69 69 28 63 29 20 28 28 | 63 29 20 3c 3d 20 30 31 |ii(c) ((|c) <= 01|
|00004b10| 37 37 29 0a 58 23 65 6e | 64 69 66 0a 58 0a 58 0a |77).X#en|dif.X.X.|
|00004b20| 58 0a 58 2f 2a 20 64 65 | 63 6c 61 72 65 20 66 75 |X.X/* de|clare fu|
|00004b30| 6e 63 74 69 6f 6e 73 20 | 74 68 61 74 20 68 61 76 |nctions |that hav|
|00004b40| 65 20 66 6f 72 77 61 72 | 64 20 72 65 66 65 72 65 |e forwar|d refere|
|00004b50| 6e 63 65 73 20 2a 2f 0a | 58 0a 58 76 6f 69 64 20 |nces */.|X.Xvoid |
|00004b60| 64 61 74 61 66 6c 75 73 | 68 20 50 52 4f 54 4f 28 |dataflus|h PROTO(|
|00004b70| 28 29 29 3b 0a 58 69 6e | 74 20 6f 74 6f 69 20 50 |());.Xin|t otoi P|
|00004b80| 52 4f 54 4f 28 28 43 68 | 61 72 20 5b 5d 29 29 3b |ROTO((Ch|ar []));|
|00004b90| 0a 58 0a 58 0a 58 2f 2a | 20 61 63 74 69 6f 6e 5f |.X.X.X/*| action_|
|00004ba0| 6f 75 74 20 2d 20 77 72 | 69 74 65 20 74 68 65 20 |out - wr|ite the |
|00004bb0| 61 63 74 69 6f 6e 73 20 | 66 72 6f 6d 20 74 68 65 |actions |from the|
|00004bc0| 20 74 65 6d 70 6f 72 61 | 72 79 20 66 69 6c 65 20 | tempora|ry file |
|00004bd0| 74 6f 20 6c 65 78 2e 79 | 79 2e 63 0a 58 20 2a 0a |to lex.y|y.c.X *.|
|00004be0| 58 20 2a 20 73 79 6e 6f | 70 73 69 73 0a 58 20 2a |X * syno|psis.X *|
|00004bf0| 20 20 20 20 20 61 63 74 | 69 6f 6e 5f 6f 75 74 28 | act|ion_out(|
|00004c00| 29 3b 0a 58 20 2a 0a 58 | 20 2a 20 20 20 20 20 43 |);.X *.X| * C|
|00004c10| 6f 70 69 65 73 20 74 68 | 65 20 61 63 74 69 6f 6e |opies th|e action|
|00004c20| 20 66 69 6c 65 20 75 70 | 20 74 6f 20 25 25 20 28 | file up| to %% (|
|00004c30| 6f 72 20 65 6e 64 2d 6f | 66 2d 66 69 6c 65 29 20 |or end-o|f-file) |
|00004c40| 74 6f 20 6c 65 78 2e 79 | 79 2e 63 0a 58 20 2a 2f |to lex.y|y.c.X */|
|00004c50| 0a 58 0a 58 76 6f 69 64 | 20 61 63 74 69 6f 6e 5f |.X.Xvoid| action_|
|00004c60| 6f 75 74 28 29 0a 58 0a | 58 20 20 20 20 7b 0a 58 |out().X.|X {.X|
|00004c70| 20 20 20 20 63 68 61 72 | 20 62 75 66 5b 4d 41 58 | char| buf[MAX|
|00004c80| 4c 49 4e 45 5d 3b 0a 58 | 0a 58 20 20 20 20 77 68 |LINE];.X|.X wh|
|00004c90| 69 6c 65 20 28 20 66 67 | 65 74 73 28 20 62 75 66 |ile ( fg|ets( buf|
|00004ca0| 2c 20 4d 41 58 4c 49 4e | 45 2c 20 74 65 6d 70 5f |, MAXLIN|E, temp_|
|00004cb0| 61 63 74 69 6f 6e 5f 66 | 69 6c 65 20 29 20 21 3d |action_f|ile ) !=|
|00004cc0| 20 4e 55 4c 4c 20 29 0a | 58 09 69 66 20 28 20 62 | NULL ).|X.if ( b|
|00004cd0| 75 66 5b 30 5d 20 3d 3d | 20 27 25 27 20 26 26 20 |uf[0] ==| '%' && |
|00004ce0| 62 75 66 5b 31 5d 20 3d | 3d 20 27 25 27 20 29 0a |buf[1] =|= '%' ).|
|00004cf0| 58 09 20 20 20 20 62 72 | 65 61 6b 3b 0a 58 09 65 |X. br|eak;.X.e|
|00004d00| 6c 73 65 0a 58 09 20 20 | 20 20 66 70 75 74 73 28 |lse.X. | fputs(|
|00004d10| 20 62 75 66 2c 20 73 74 | 64 6f 75 74 20 29 3b 0a | buf, st|dout );.|
|00004d20| 58 20 20 20 20 7d 0a 58 | 0a 58 0a 58 2f 2a 20 61 |X }.X|.X.X/* a|
|00004d30| 6c 6c 6f 63 61 74 65 5f | 61 72 72 61 79 20 2d 20 |llocate_|array - |
|00004d40| 61 6c 6c 6f 63 61 74 65 | 20 6d 65 6d 6f 72 79 20 |allocate| memory |
|00004d50| 66 6f 72 20 61 6e 20 69 | 6e 74 65 67 65 72 20 61 |for an i|nteger a|
|00004d60| 72 72 61 79 20 6f 66 20 | 74 68 65 20 67 69 76 65 |rray of |the give|
|00004d70| 6e 20 73 69 7a 65 20 2a | 2f 0a 58 0a 58 76 6f 69 |n size *|/.X.Xvoi|
|00004d80| 64 20 2a 61 6c 6c 6f 63 | 61 74 65 5f 61 72 72 61 |d *alloc|ate_arra|
|00004d90| 79 28 20 73 69 7a 65 2c | 20 65 6c 65 6d 65 6e 74 |y( size,| element|
|00004da0| 5f 73 69 7a 65 20 29 0a | 58 69 6e 74 20 73 69 7a |_size ).|Xint siz|
|00004db0| 65 2c 20 65 6c 65 6d 65 | 6e 74 5f 73 69 7a 65 3b |e, eleme|nt_size;|
|00004dc0| 0a 58 0a 58 20 20 20 20 | 7b 0a 58 20 20 20 20 72 |.X.X |{.X r|
|00004dd0| 65 67 69 73 74 65 72 20 | 76 6f 69 64 20 2a 6d 65 |egister |void *me|
|00004de0| 6d 3b 0a 58 0a 58 20 20 | 20 20 2f 2a 20 6f 6e 20 |m;.X.X | /* on |
|00004df0| 31 36 2d 62 69 74 20 69 | 6e 74 20 6d 61 63 68 69 |16-bit i|nt machi|
|00004e00| 6e 65 73 20 28 65 2e 67 | 2e 2c 20 38 30 32 38 36 |nes (e.g|., 80286|
|00004e10| 29 20 77 65 20 6d 69 67 | 68 74 20 62 65 20 74 72 |) we mig|ht be tr|
|00004e20| 79 69 6e 67 20 74 6f 0a | 58 20 20 20 20 20 2a 20 |ying to.|X * |
|00004e30| 61 6c 6c 6f 63 61 74 65 | 20 6d 6f 72 65 20 74 68 |allocate| more th|
|00004e40| 61 6e 20 61 20 73 69 67 | 6e 65 64 20 69 6e 74 20 |an a sig|ned int |
|00004e50| 63 61 6e 20 68 6f 6c 64 | 2c 20 61 6e 64 20 74 68 |can hold|, and th|
|00004e60| 61 74 20 77 6f 6e 27 74 | 0a 58 20 20 20 20 20 2a |at won't|.X *|
|00004e70| 20 77 6f 72 6b 2e 20 20 | 43 68 65 61 70 20 74 65 | work. |Cheap te|
|00004e80| 73 74 3a 0a 58 20 20 20 | 20 20 2a 2f 0a 58 20 20 |st:.X | */.X |
|00004e90| 20 20 69 66 20 28 20 65 | 6c 65 6d 65 6e 74 5f 73 | if ( e|lement_s|
|00004ea0| 69 7a 65 20 2a 20 73 69 | 7a 65 20 3c 3d 20 30 20 |ize * si|ze <= 0 |
|00004eb0| 29 0a 58 20 20 20 20 20 | 20 20 20 66 6c 65 78 66 |).X | flexf|
|00004ec0| 61 74 61 6c 28 20 22 72 | 65 71 75 65 73 74 20 66 |atal( "r|equest f|
|00004ed0| 6f 72 20 3c 20 31 20 62 | 79 74 65 20 69 6e 20 61 |or < 1 b|yte in a|
|00004ee0| 6c 6c 6f 63 61 74 65 5f | 61 72 72 61 79 28 29 22 |llocate_|array()"|
|00004ef0| 20 29 3b 0a 58 0a 58 20 | 20 20 20 6d 65 6d 20 3d | );.X.X | mem =|
|00004f00| 20 28 76 6f 69 64 20 2a | 29 20 6d 61 6c 6c 6f 63 | (void *|) malloc|
|00004f10| 28 20 28 75 6e 73 69 67 | 6e 65 64 29 20 28 65 6c |( (unsig|ned) (el|
|00004f20| 65 6d 65 6e 74 5f 73 69 | 7a 65 20 2a 20 73 69 7a |ement_si|ze * siz|
|00004f30| 65 29 20 29 3b 0a 58 0a | 58 20 20 20 20 69 66 20 |e) );.X.|X if |
|00004f40| 28 20 6d 65 6d 20 3d 3d | 20 4e 55 4c 4c 20 29 0a |( mem ==| NULL ).|
|00004f50| 58 09 66 6c 65 78 66 61 | 74 61 6c 28 20 22 6d 65 |X.flexfa|tal( "me|
|00004f60| 6d 6f 72 79 20 61 6c 6c | 6f 63 61 74 69 6f 6e 20 |mory all|ocation |
|00004f70| 66 61 69 6c 65 64 20 69 | 6e 20 61 6c 6c 6f 63 61 |failed i|n alloca|
|00004f80| 74 65 5f 61 72 72 61 79 | 28 29 22 20 29 3b 0a 58 |te_array|()" );.X|
|00004f90| 0a 58 20 20 20 20 72 65 | 74 75 72 6e 20 28 20 6d |.X re|turn ( m|
|00004fa0| 65 6d 20 29 3b 0a 58 20 | 20 20 20 7d 0a 58 0a 58 |em );.X | }.X.X|
|00004fb0| 0a 58 2f 2a 20 61 6c 6c | 5f 6c 6f 77 65 72 20 2d |.X/* all|_lower -|
|00004fc0| 20 74 72 75 65 20 69 66 | 20 61 20 73 74 72 69 6e | true if| a strin|
|00004fd0| 67 20 69 73 20 61 6c 6c | 20 6c 6f 77 65 72 2d 63 |g is all| lower-c|
|00004fe0| 61 73 65 0a 58 20 2a 0a | 58 20 2a 20 73 79 6e 6f |ase.X *.|X * syno|
|00004ff0| 70 73 69 73 3a 0a 58 20 | 2a 20 20 20 20 43 68 61 |psis:.X |* Cha|
|00005000| 72 20 2a 73 74 72 3b 0a | 58 20 2a 20 20 20 20 69 |r *str;.|X * i|
|00005010| 6e 74 20 61 6c 6c 5f 6c | 6f 77 65 72 28 29 3b 0a |nt all_l|ower();.|
|00005020| 58 20 2a 20 20 20 20 74 | 72 75 65 2f 66 61 6c 73 |X * t|rue/fals|
|00005030| 65 20 3d 20 61 6c 6c 5f | 6c 6f 77 65 72 28 20 73 |e = all_|lower( s|
|00005040| 74 72 20 29 3b 0a 58 20 | 2a 2f 0a 58 0a 58 69 6e |tr );.X |*/.X.Xin|
|00005050| 74 20 61 6c 6c 5f 6c 6f | 77 65 72 28 20 73 74 72 |t all_lo|wer( str|
|00005060| 20 29 0a 58 72 65 67 69 | 73 74 65 72 20 43 68 61 | ).Xregi|ster Cha|
|00005070| 72 20 2a 73 74 72 3b 0a | 58 0a 58 20 20 20 20 7b |r *str;.|X.X {|
|00005080| 0a 58 20 20 20 20 77 68 | 69 6c 65 20 28 20 2a 73 |.X wh|ile ( *s|
|00005090| 74 72 20 29 0a 58 09 7b | 0a 58 09 69 66 20 28 20 |tr ).X.{|.X.if ( |
|000050a0| 21 20 69 73 61 73 63 69 | 69 28 20 2a 73 74 72 20 |! isasci|i( *str |
|000050b0| 29 20 7c 7c 20 21 20 69 | 73 6c 6f 77 65 72 28 20 |) || ! i|slower( |
|000050c0| 2a 73 74 72 20 29 20 29 | 0a 58 09 20 20 20 20 72 |*str ) )|.X. r|
|000050d0| 65 74 75 72 6e 20 28 20 | 30 20 29 3b 0a 58 09 2b |eturn ( |0 );.X.+|
|000050e0| 2b 73 74 72 3b 0a 58 09 | 7d 0a 58 0a 58 20 20 20 |+str;.X.|}.X.X |
|000050f0| 20 72 65 74 75 72 6e 20 | 28 20 31 20 29 3b 0a 58 | return |( 1 );.X|
|00005100| 20 20 20 20 7d 0a 58 0a | 58 0a 58 2f 2a 20 61 6c | }.X.|X.X/* al|
|00005110| 6c 5f 75 70 70 65 72 20 | 2d 20 74 72 75 65 20 69 |l_upper |- true i|
|00005120| 66 20 61 20 73 74 72 69 | 6e 67 20 69 73 20 61 6c |f a stri|ng is al|
|00005130| 6c 20 75 70 70 65 72 2d | 63 61 73 65 0a 58 20 2a |l upper-|case.X *|
|00005140| 0a 58 20 2a 20 73 79 6e | 6f 70 73 69 73 3a 0a 58 |.X * syn|opsis:.X|
|00005150| 20 2a 20 20 20 20 43 68 | 61 72 20 2a 73 74 72 3b | * Ch|ar *str;|
|00005160| 0a 58 20 2a 20 20 20 20 | 69 6e 74 20 61 6c 6c 5f |.X * |int all_|
|00005170| 75 70 70 65 72 28 29 3b | 0a 58 20 2a 20 20 20 20 |upper();|.X * |
|00005180| 74 72 75 65 2f 66 61 6c | 73 65 20 3d 20 61 6c 6c |true/fal|se = all|
|00005190| 5f 75 70 70 65 72 28 20 | 73 74 72 20 29 3b 0a 58 |_upper( |str );.X|
|000051a0| 20 2a 2f 0a 58 0a 58 69 | 6e 74 20 61 6c 6c 5f 75 | */.X.Xi|nt all_u|
|000051b0| 70 70 65 72 28 20 73 74 | 72 20 29 0a 58 72 65 67 |pper( st|r ).Xreg|
|000051c0| 69 73 74 65 72 20 43 68 | 61 72 20 2a 73 74 72 3b |ister Ch|ar *str;|
|000051d0| 0a 58 0a 58 20 20 20 20 | 7b 0a 58 20 20 20 20 77 |.X.X |{.X w|
|000051e0| 68 69 6c 65 20 28 20 2a | 73 74 72 20 29 0a 58 09 |hile ( *|str ).X.|
|000051f0| 7b 0a 58 09 69 66 20 28 | 20 21 20 69 73 61 73 63 |{.X.if (| ! isasc|
|00005200| 69 69 28 20 2a 73 74 72 | 20 29 20 7c 7c 20 21 20 |ii( *str| ) || ! |
|00005210| 69 73 75 70 70 65 72 28 | 20 28 63 68 61 72 29 20 |isupper(| (char) |
|00005220| 2a 73 74 72 20 29 20 29 | 0a 58 09 20 20 20 20 72 |*str ) )|.X. r|
|00005230| 65 74 75 72 6e 20 28 20 | 30 20 29 3b 0a 58 09 2b |eturn ( |0 );.X.+|
|00005240| 2b 73 74 72 3b 0a 58 09 | 7d 0a 58 0a 58 20 20 20 |+str;.X.|}.X.X |
|00005250| 20 72 65 74 75 72 6e 20 | 28 20 31 20 29 3b 0a 58 | return |( 1 );.X|
|00005260| 20 20 20 20 7d 0a 58 0a | 58 0a 58 2f 2a 20 62 75 | }.X.|X.X/* bu|
|00005270| 62 62 6c 65 20 2d 20 62 | 75 62 62 6c 65 20 73 6f |bble - b|ubble so|
|00005280| 72 74 20 61 6e 20 69 6e | 74 65 67 65 72 20 61 72 |rt an in|teger ar|
|00005290| 72 61 79 20 69 6e 20 69 | 6e 63 72 65 61 73 69 6e |ray in i|ncreasin|
|000052a0| 67 20 6f 72 64 65 72 0a | 58 20 2a 0a 58 20 2a 20 |g order.|X *.X * |
|000052b0| 73 79 6e 6f 70 73 69 73 | 0a 58 20 2a 20 20 20 69 |synopsis|.X * i|
|000052c0| 6e 74 20 76 5b 6e 5d 2c | 20 6e 3b 0a 58 20 2a 20 |nt v[n],| n;.X * |
|000052d0| 20 20 62 75 62 62 6c 65 | 28 20 76 2c 20 6e 20 29 | bubble|( v, n )|
|000052e0| 3b 0a 58 20 2a 0a 58 20 | 2a 20 64 65 73 63 72 69 |;.X *.X |* descri|
|000052f0| 70 74 69 6f 6e 0a 58 20 | 2a 20 20 20 73 6f 72 74 |ption.X |* sort|
|00005300| 73 20 74 68 65 20 66 69 | 72 73 74 20 6e 20 65 6c |s the fi|rst n el|
|00005310| 65 6d 65 6e 74 73 20 6f | 66 20 61 72 72 61 79 20 |ements o|f array |
|00005320| 76 20 61 6e 64 20 72 65 | 70 6c 61 63 65 73 20 74 |v and re|places t|
|00005330| 68 65 6d 20 69 6e 0a 58 | 20 2a 20 20 20 69 6e 63 |hem in.X| * inc|
|00005340| 72 65 61 73 69 6e 67 20 | 6f 72 64 65 72 2e 0a 58 |reasing |order..X|
|00005350| 20 2a 0a 58 20 2a 20 70 | 61 73 73 65 64 0a 58 20 | *.X * p|assed.X |
|00005360| 2a 20 20 20 76 20 2d 20 | 74 68 65 20 61 72 72 61 |* v - |the arra|
|00005370| 79 20 74 6f 20 62 65 20 | 73 6f 72 74 65 64 0a 58 |y to be |sorted.X|
|00005380| 20 2a 20 20 20 6e 20 2d | 20 74 68 65 20 6e 75 6d | * n -| the num|
|00005390| 62 65 72 20 6f 66 20 65 | 6c 65 6d 65 6e 74 73 20 |ber of e|lements |
|000053a0| 6f 66 20 27 76 27 20 74 | 6f 20 62 65 20 73 6f 72 |of 'v' t|o be sor|
|000053b0| 74 65 64 20 2a 2f 0a 58 | 0a 58 76 6f 69 64 20 62 |ted */.X|.Xvoid b|
|000053c0| 75 62 62 6c 65 28 20 76 | 2c 20 6e 20 29 0a 58 69 |ubble( v|, n ).Xi|
|000053d0| 6e 74 20 76 5b 5d 2c 20 | 6e 3b 0a 58 0a 58 20 20 |nt v[], |n;.X.X |
|000053e0| 20 20 7b 0a 58 20 20 20 | 20 72 65 67 69 73 74 65 | {.X | registe|
|000053f0| 72 20 69 6e 74 20 69 2c | 20 6a 2c 20 6b 3b 0a 58 |r int i,| j, k;.X|
|00005400| 0a 58 20 20 20 20 66 6f | 72 20 28 20 69 20 3d 20 |.X fo|r ( i = |
|00005410| 6e 3b 20 69 20 3e 20 31 | 3b 20 2d 2d 69 20 29 0a |n; i > 1|; --i ).|
|00005420| 58 09 66 6f 72 20 28 20 | 6a 20 3d 20 31 3b 20 6a |X.for ( |j = 1; j|
|00005430| 20 3c 20 69 3b 20 2b 2b | 6a 20 29 0a 58 09 20 20 | < i; ++|j ).X. |
|00005440| 20 20 69 66 20 28 20 76 | 5b 6a 5d 20 3e 20 76 5b | if ( v|[j] > v[|
|00005450| 6a 20 2b 20 31 5d 20 29 | 09 2f 2a 20 63 6f 6d 70 |j + 1] )|./* comp|
|00005460| 61 72 65 20 2a 2f 0a 58 | 09 09 7b 0a 58 09 09 6b |are */.X|..{.X..k|
|00005470| 20 3d 20 76 5b 6a 5d 3b | 09 2f 2a 20 65 78 63 68 | = v[j];|./* exch|
|00005480| 61 6e 67 65 20 2a 2f 0a | 58 09 09 76 5b 6a 5d 20 |ange */.|X..v[j] |
|00005490| 3d 20 76 5b 6a 20 2b 20 | 31 5d 3b 0a 58 09 09 76 |= v[j + |1];.X..v|
|000054a0| 5b 6a 20 2b 20 31 5d 20 | 3d 20 6b 3b 0a 58 09 09 |[j + 1] |= k;.X..|
|000054b0| 7d 0a 58 20 20 20 20 7d | 0a 58 0a 58 0a 58 2f 2a |}.X }|.X.X.X/*|
|000054c0| 20 63 6c 6f 77 65 72 20 | 2d 20 72 65 70 6c 61 63 | clower |- replac|
|000054d0| 65 20 75 70 70 65 72 2d | 63 61 73 65 20 6c 65 74 |e upper-|case let|
|000054e0| 74 65 72 20 74 6f 20 6c | 6f 77 65 72 2d 63 61 73 |ter to l|ower-cas|
|000054f0| 65 0a 58 20 2a 0a 58 20 | 2a 20 73 79 6e 6f 70 73 |e.X *.X |* synops|
|00005500| 69 73 3a 0a 58 20 2a 20 | 20 20 20 43 68 61 72 20 |is:.X * | Char |
|00005510| 63 6c 6f 77 65 72 28 29 | 3b 0a 58 20 2a 20 20 20 |clower()|;.X * |
|00005520| 20 69 6e 74 20 63 3b 0a | 58 20 2a 20 20 20 20 63 | int c;.|X * c|
|00005530| 20 3d 20 63 6c 6f 77 65 | 72 28 20 63 20 29 3b 0a | = clowe|r( c );.|
|00005540| 58 20 2a 2f 0a 58 0a 58 | 43 68 61 72 20 63 6c 6f |X */.X.X|Char clo|
|00005550| 77 65 72 28 20 63 20 29 | 0a 58 72 65 67 69 73 74 |wer( c )|.Xregist|
|00005560| 65 72 20 69 6e 74 20 63 | 3b 0a 58 0a 58 20 20 20 |er int c|;.X.X |
|00005570| 20 7b 0a 58 20 20 20 20 | 72 65 74 75 72 6e 20 28 | {.X |return (|
|00005580| 20 28 69 73 61 73 63 69 | 69 28 20 63 20 29 20 26 | (isasci|i( c ) &|
|00005590| 26 20 69 73 75 70 70 65 | 72 28 20 63 20 29 29 20 |& isuppe|r( c )) |
|000055a0| 3f 20 74 6f 6c 6f 77 65 | 72 28 20 63 20 29 20 3a |? tolowe|r( c ) :|
|000055b0| 20 63 20 29 3b 0a 58 20 | 20 20 20 7d 0a 58 0a 58 | c );.X | }.X.X|
|000055c0| 0a 58 2f 2a 20 63 6f 70 | 79 5f 73 74 72 69 6e 67 |.X/* cop|y_string|
|000055d0| 20 2d 20 72 65 74 75 72 | 6e 73 20 61 20 64 79 6e | - retur|ns a dyn|
|000055e0| 61 6d 69 63 61 6c 6c 79 | 20 61 6c 6c 6f 63 61 74 |amically| allocat|
|000055f0| 65 64 20 63 6f 70 79 20 | 6f 66 20 61 20 73 74 72 |ed copy |of a str|
|00005600| 69 6e 67 0a 58 20 2a 0a | 58 20 2a 20 73 79 6e 6f |ing.X *.|X * syno|
|00005610| 70 73 69 73 0a 58 20 2a | 20 20 20 20 63 68 61 72 |psis.X *| char|
|00005620| 20 2a 73 74 72 2c 20 2a | 63 6f 70 79 2c 20 2a 63 | *str, *|copy, *c|
|00005630| 6f 70 79 5f 73 74 72 69 | 6e 67 28 29 3b 0a 58 20 |opy_stri|ng();.X |
|00005640| 2a 20 20 20 20 63 6f 70 | 79 20 3d 20 63 6f 70 79 |* cop|y = copy|
|00005650| 5f 73 74 72 69 6e 67 28 | 20 73 74 72 20 29 3b 0a |_string(| str );.|
|00005660| 58 20 2a 2f 0a 58 0a 58 | 63 68 61 72 20 2a 63 6f |X */.X.X|char *co|
|00005670| 70 79 5f 73 74 72 69 6e | 67 28 20 73 74 72 20 29 |py_strin|g( str )|
|00005680| 0a 58 72 65 67 69 73 74 | 65 72 20 63 68 61 72 20 |.Xregist|er char |
|00005690| 2a 73 74 72 3b 0a 58 0a | 58 20 20 20 20 7b 0a 58 |*str;.X.|X {.X|
|000056a0| 20 20 20 20 72 65 67 69 | 73 74 65 72 20 63 68 61 | regi|ster cha|
|000056b0| 72 20 2a 63 3b 0a 58 20 | 20 20 20 63 68 61 72 20 |r *c;.X | char |
|000056c0| 2a 63 6f 70 79 3b 0a 58 | 0a 58 20 20 20 20 2f 2a |*copy;.X|.X /*|
|000056d0| 20 66 69 6e 64 20 6c 65 | 6e 67 74 68 20 2a 2f 0a | find le|ngth */.|
|000056e0| 58 20 20 20 20 66 6f 72 | 20 28 20 63 20 3d 20 73 |X for| ( c = s|
|000056f0| 74 72 3b 20 2a 63 3b 20 | 2b 2b 63 20 29 0a 58 09 |tr; *c; |++c ).X.|
|00005700| 3b 0a 58 0a 58 20 20 20 | 20 63 6f 70 79 20 3d 20 |;.X.X | copy = |
|00005710| 6d 61 6c 6c 6f 63 28 20 | 28 75 6e 73 69 67 6e 65 |malloc( |(unsigne|
|00005720| 64 29 20 28 28 63 20 2d | 20 73 74 72 20 2b 20 31 |d) ((c -| str + 1|
|00005730| 29 20 2a 20 73 69 7a 65 | 6f 66 28 20 63 68 61 72 |) * size|of( char|
|00005740| 20 29 29 20 29 3b 0a 58 | 0a 58 20 20 20 20 69 66 | )) );.X|.X if|
|00005750| 20 28 20 63 6f 70 79 20 | 3d 3d 20 4e 55 4c 4c 20 | ( copy |== NULL |
|00005760| 29 0a 58 09 66 6c 65 78 | 66 61 74 61 6c 28 20 22 |).X.flex|fatal( "|
|00005770| 64 79 6e 61 6d 69 63 20 | 6d 65 6d 6f 72 79 20 66 |dynamic |memory f|
|00005780| 61 69 6c 75 72 65 20 69 | 6e 20 63 6f 70 79 5f 73 |ailure i|n copy_s|
|00005790| 74 72 69 6e 67 28 29 22 | 20 29 3b 0a 58 0a 58 20 |tring()"| );.X.X |
|000057a0| 20 20 20 66 6f 72 20 28 | 20 63 20 3d 20 63 6f 70 | for (| c = cop|
|000057b0| 79 3b 20 28 2a 63 2b 2b | 20 3d 20 2a 73 74 72 2b |y; (*c++| = *str+|
|000057c0| 2b 29 3b 20 29 0a 58 09 | 3b 0a 58 0a 58 20 20 20 |+); ).X.|;.X.X |
|000057d0| 20 72 65 74 75 72 6e 20 | 28 20 63 6f 70 79 20 29 | return |( copy )|
|000057e0| 3b 0a 58 20 20 20 20 7d | 0a 58 0a 58 0a 58 2f 2a |;.X }|.X.X.X/*|
|000057f0| 20 63 6f 70 79 5f 75 6e | 73 69 67 6e 65 64 5f 73 | copy_un|signed_s|
|00005800| 74 72 69 6e 67 20 2d 0a | 58 20 2a 20 20 20 20 72 |tring -.|X * r|
|00005810| 65 74 75 72 6e 73 20 61 | 20 64 79 6e 61 6d 69 63 |eturns a| dynamic|
|00005820| 61 6c 6c 79 20 61 6c 6c | 6f 63 61 74 65 64 20 63 |ally all|ocated c|
|00005830| 6f 70 79 20 6f 66 20 61 | 20 28 70 6f 74 65 6e 74 |opy of a| (potent|
|00005840| 69 61 6c 6c 79 29 20 75 | 6e 73 69 67 6e 65 64 20 |ially) u|nsigned |
|00005850| 73 74 72 69 6e 67 0a 58 | 20 2a 0a 58 20 2a 20 73 |string.X| *.X * s|
|00005860| 79 6e 6f 70 73 69 73 0a | 58 20 2a 20 20 20 20 43 |ynopsis.|X * C|
|00005870| 68 61 72 20 2a 73 74 72 | 2c 20 2a 63 6f 70 79 2c |har *str|, *copy,|
|00005880| 20 2a 63 6f 70 79 5f 75 | 6e 73 69 67 6e 65 64 5f | *copy_u|nsigned_|
|00005890| 73 74 72 69 6e 67 28 29 | 3b 0a 58 20 2a 20 20 20 |string()|;.X * |
|000058a0| 20 63 6f 70 79 20 3d 20 | 63 6f 70 79 5f 75 6e 73 | copy = |copy_uns|
|000058b0| 69 67 6e 65 64 5f 73 74 | 72 69 6e 67 28 20 73 74 |igned_st|ring( st|
|000058c0| 72 20 29 3b 0a 58 20 2a | 2f 0a 58 0a 58 43 68 61 |r );.X *|/.X.XCha|
|000058d0| 72 20 2a 63 6f 70 79 5f | 75 6e 73 69 67 6e 65 64 |r *copy_|unsigned|
|000058e0| 5f 73 74 72 69 6e 67 28 | 20 73 74 72 20 29 0a 58 |_string(| str ).X|
|000058f0| 72 65 67 69 73 74 65 72 | 20 43 68 61 72 20 2a 73 |register| Char *s|
|00005900| 74 72 3b 0a 58 0a 58 20 | 20 20 20 7b 0a 58 20 20 |tr;.X.X | {.X |
|00005910| 20 20 72 65 67 69 73 74 | 65 72 20 43 68 61 72 20 | regist|er Char |
|00005920| 2a 63 3b 0a 58 20 20 20 | 20 43 68 61 72 20 2a 63 |*c;.X | Char *c|
|00005930| 6f 70 79 3b 0a 58 0a 58 | 20 20 20 20 2f 2a 20 66 |opy;.X.X| /* f|
|00005940| 69 6e 64 20 6c 65 6e 67 | 74 68 20 2a 2f 0a 58 20 |ind leng|th */.X |
|00005950| 20 20 20 66 6f 72 20 28 | 20 63 20 3d 20 73 74 72 | for (| c = str|
|00005960| 3b 20 2a 63 3b 20 2b 2b | 63 20 29 0a 58 09 3b 0a |; *c; ++|c ).X.;.|
|00005970| 58 0a 58 20 20 20 20 63 | 6f 70 79 20 3d 20 28 43 |X.X c|opy = (C|
|00005980| 68 61 72 20 2a 29 20 6d | 61 6c 6c 6f 63 28 20 28 |har *) m|alloc( (|
|00005990| 75 6e 73 69 67 6e 65 64 | 29 20 28 28 63 20 2d 20 |unsigned|) ((c - |
|000059a0| 73 74 72 20 2b 20 31 29 | 20 2a 20 73 69 7a 65 6f |str + 1)| * sizeo|
|000059b0| 66 28 20 43 68 61 72 20 | 29 29 20 29 3b 0a 58 0a |f( Char |)) );.X.|
|000059c0| 58 20 20 20 20 69 66 20 | 28 20 63 6f 70 79 20 3d |X if |( copy =|
|000059d0| 3d 20 4e 55 4c 4c 20 29 | 0a 58 09 66 6c 65 78 66 |= NULL )|.X.flexf|
|000059e0| 61 74 61 6c 28 20 22 64 | 79 6e 61 6d 69 63 20 6d |atal( "d|ynamic m|
|000059f0| 65 6d 6f 72 79 20 66 61 | 69 6c 75 72 65 20 69 6e |emory fa|ilure in|
|00005a00| 20 63 6f 70 79 5f 75 6e | 73 69 67 6e 65 64 5f 73 | copy_un|signed_s|
|00005a10| 74 72 69 6e 67 28 29 22 | 20 29 3b 0a 58 0a 58 20 |tring()"| );.X.X |
|00005a20| 20 20 20 66 6f 72 20 28 | 20 63 20 3d 20 63 6f 70 | for (| c = cop|
|00005a30| 79 3b 20 28 2a 63 2b 2b | 20 3d 20 2a 73 74 72 2b |y; (*c++| = *str+|
|00005a40| 2b 29 3b 20 29 0a 58 09 | 3b 0a 58 0a 58 20 20 20 |+); ).X.|;.X.X |
|00005a50| 20 72 65 74 75 72 6e 20 | 28 20 63 6f 70 79 20 29 | return |( copy )|
|00005a60| 3b 0a 58 20 20 20 20 7d | 0a 58 0a 58 0a 58 2f 2a |;.X }|.X.X.X/*|
|00005a70| 20 63 73 68 65 6c 6c 20 | 2d 20 73 68 65 6c 6c 20 | cshell |- shell |
|00005a80| 73 6f 72 74 20 61 20 63 | 68 61 72 61 63 74 65 72 |sort a c|haracter|
|00005a90| 20 61 72 72 61 79 20 69 | 6e 20 69 6e 63 72 65 61 | array i|n increa|
|00005aa0| 73 69 6e 67 20 6f 72 64 | 65 72 0a 58 20 2a 0a 58 |sing ord|er.X *.X|
|00005ab0| 20 2a 20 73 79 6e 6f 70 | 73 69 73 0a 58 20 2a 0a | * synop|sis.X *.|
|00005ac0| 58 20 2a 20 20 20 43 68 | 61 72 20 76 5b 6e 5d 3b |X * Ch|ar v[n];|
|00005ad0| 0a 58 20 2a 20 20 20 69 | 6e 74 20 6e 2c 20 73 70 |.X * i|nt n, sp|
|00005ae0| 65 63 69 61 6c 5f 63 61 | 73 65 5f 30 3b 0a 58 20 |ecial_ca|se_0;.X |
|00005af0| 2a 20 20 20 63 73 68 65 | 6c 6c 28 20 76 2c 20 6e |* cshe|ll( v, n|
|00005b00| 2c 20 73 70 65 63 69 61 | 6c 5f 63 61 73 65 5f 30 |, specia|l_case_0|
|00005b10| 20 29 3b 0a 58 20 2a 0a | 58 20 2a 20 64 65 73 63 | );.X *.|X * desc|
|00005b20| 72 69 70 74 69 6f 6e 0a | 58 20 2a 20 20 20 64 6f |ription.|X * do|
|00005b30| 65 73 20 61 20 73 68 65 | 6c 6c 20 73 6f 72 74 20 |es a she|ll sort |
|00005b40| 6f 66 20 74 68 65 20 66 | 69 72 73 74 20 6e 20 65 |of the f|irst n e|
|00005b50| 6c 65 6d 65 6e 74 73 20 | 6f 66 20 61 72 72 61 79 |lements |of array|
|00005b60| 20 76 2e 0a 58 20 2a 20 | 20 20 49 66 20 73 70 65 | v..X * | If spe|
|00005b70| 63 69 61 6c 5f 63 61 73 | 65 5f 30 20 69 73 20 74 |cial_cas|e_0 is t|
|00005b80| 72 75 65 2c 20 74 68 65 | 6e 20 61 6e 79 20 65 6c |rue, the|n any el|
|00005b90| 65 6d 65 6e 74 20 65 71 | 75 61 6c 20 74 6f 20 30 |ement eq|ual to 0|
|00005ba0| 0a 58 20 2a 20 20 20 69 | 73 20 69 6e 73 74 65 61 |.X * i|s instea|
|00005bb0| 64 20 61 73 73 75 6d 65 | 64 20 74 6f 20 68 61 76 |d assume|d to hav|
|00005bc0| 65 20 69 6e 66 69 6e 69 | 74 65 20 77 65 69 67 68 |e infini|te weigh|
|00005bd0| 74 2e 0a 58 20 2a 0a 58 | 20 2a 20 70 61 73 73 65 |t..X *.X| * passe|
|00005be0| 64 0a 58 20 2a 20 20 20 | 76 20 2d 20 61 72 72 61 |d.X * |v - arra|
|00005bf0| 79 20 74 6f 20 62 65 20 | 73 6f 72 74 65 64 0a 58 |y to be |sorted.X|
|00005c00| 20 2a 20 20 20 6e 20 2d | 20 6e 75 6d 62 65 72 20 | * n -| number |
|00005c10| 6f 66 20 65 6c 65 6d 65 | 6e 74 73 20 6f 66 20 76 |of eleme|nts of v|
|00005c20| 20 74 6f 20 62 65 20 73 | 6f 72 74 65 64 0a 58 20 | to be s|orted.X |
|00005c30| 2a 2f 0a 58 0a 58 76 6f | 69 64 20 63 73 68 65 6c |*/.X.Xvo|id cshel|
|00005c40| 6c 28 20 76 2c 20 6e 2c | 20 73 70 65 63 69 61 6c |l( v, n,| special|
|00005c50| 5f 63 61 73 65 5f 30 20 | 29 0a 58 43 68 61 72 20 |_case_0 |).XChar |
|00005c60| 76 5b 5d 3b 0a 58 69 6e | 74 20 6e 2c 20 73 70 65 |v[];.Xin|t n, spe|
|00005c70| 63 69 61 6c 5f 63 61 73 | 65 5f 30 3b 0a 58 0a 58 |cial_cas|e_0;.X.X|
|00005c80| 20 20 20 20 7b 0a 58 20 | 20 20 20 69 6e 74 20 67 | {.X | int g|
|00005c90| 61 70 2c 20 69 2c 20 6a | 2c 20 6a 67 3b 0a 58 20 |ap, i, j|, jg;.X |
|00005ca0| 20 20 20 43 68 61 72 20 | 6b 3b 0a 58 0a 58 20 20 | Char |k;.X.X |
|00005cb0| 20 20 66 6f 72 20 28 20 | 67 61 70 20 3d 20 6e 20 | for ( |gap = n |
|00005cc0| 2f 20 32 3b 20 67 61 70 | 20 3e 20 30 3b 20 67 61 |/ 2; gap| > 0; ga|
|00005cd0| 70 20 3d 20 67 61 70 20 | 2f 20 32 20 29 0a 58 09 |p = gap |/ 2 ).X.|
|00005ce0| 66 6f 72 20 28 20 69 20 | 3d 20 67 61 70 3b 20 69 |for ( i |= gap; i|
|00005cf0| 20 3c 20 6e 3b 20 2b 2b | 69 20 29 0a 58 09 20 20 | < n; ++|i ).X. |
|00005d00| 20 20 66 6f 72 20 28 20 | 6a 20 3d 20 69 20 2d 20 | for ( |j = i - |
|00005d10| 67 61 70 3b 20 6a 20 3e | 3d 20 30 3b 20 6a 20 3d |gap; j >|= 0; j =|
|00005d20| 20 6a 20 2d 20 67 61 70 | 20 29 0a 58 09 09 7b 0a | j - gap| ).X..{.|
|00005d30| 58 09 09 6a 67 20 3d 20 | 6a 20 2b 20 67 61 70 3b |X..jg = |j + gap;|
|00005d40| 0a 58 0a 58 09 09 69 66 | 20 28 20 73 70 65 63 69 |.X.X..if| ( speci|
|00005d50| 61 6c 5f 63 61 73 65 5f | 30 20 29 0a 58 09 09 20 |al_case_|0 ).X.. |
|00005d60| 20 20 20 7b 0a 58 09 09 | 20 20 20 20 69 66 20 28 | {.X..| if (|
|00005d70| 20 76 5b 6a 67 5d 20 3d | 3d 20 30 20 29 0a 58 09 | v[jg] =|= 0 ).X.|
|00005d80| 09 09 62 72 65 61 6b 3b | 0a 58 0a 58 09 09 20 20 |..break;|.X.X.. |
|00005d90| 20 20 65 6c 73 65 20 69 | 66 20 28 20 76 5b 6a 5d | else i|f ( v[j]|
|00005da0| 20 21 3d 20 30 20 26 26 | 20 76 5b 6a 5d 20 3c 3d | != 0 &&| v[j] <=|
|00005db0| 20 76 5b 6a 67 5d 20 29 | 0a 58 09 09 09 62 72 65 | v[jg] )|.X...bre|
|00005dc0| 61 6b 3b 0a 58 09 09 20 | 20 20 20 7d 0a 58 0a 58 |ak;.X.. | }.X.X|
|00005dd0| 09 09 65 6c 73 65 20 69 | 66 20 28 20 76 5b 6a 5d |..else i|f ( v[j]|
|00005de0| 20 3c 3d 20 76 5b 6a 67 | 5d 20 29 0a 58 09 09 20 | <= v[jg|] ).X.. |
|00005df0| 20 20 20 62 72 65 61 6b | 3b 0a 58 0a 58 09 09 6b | break|;.X.X..k|
|00005e00| 20 3d 20 76 5b 6a 5d 3b | 0a 58 09 09 76 5b 6a 5d | = v[j];|.X..v[j]|
|00005e10| 20 3d 20 76 5b 6a 67 5d | 3b 0a 58 09 09 76 5b 6a | = v[jg]|;.X..v[j|
|00005e20| 67 5d 20 3d 20 6b 3b 0a | 58 09 09 7d 0a 58 20 20 |g] = k;.|X..}.X |
|00005e30| 20 20 7d 0a 58 0a 58 0a | 58 2f 2a 20 64 61 74 61 | }.X.X.|X/* data|
|00005e40| 65 6e 64 20 2d 20 66 69 | 6e 69 73 68 20 75 70 20 |end - fi|nish up |
|00005e50| 61 20 62 6c 6f 63 6b 20 | 6f 66 20 64 61 74 61 20 |a block |of data |
|00005e60| 64 65 63 6c 61 72 61 74 | 69 6f 6e 73 0a 58 20 2a |declarat|ions.X *|
|00005e70| 0a 58 20 2a 20 73 79 6e | 6f 70 73 69 73 0a 58 20 |.X * syn|opsis.X |
|00005e80| 2a 20 20 20 20 64 61 74 | 61 65 6e 64 28 29 3b 0a |* dat|aend();.|
|00005e90| 58 20 2a 2f 0a 58 0a 58 | 76 6f 69 64 20 64 61 74 |X */.X.X|void dat|
|00005ea0| 61 65 6e 64 28 29 0a 58 | 0a 58 20 20 20 20 7b 0a |aend().X|.X {.|
|00005eb0| 58 20 20 20 20 69 66 20 | 28 20 64 61 74 61 70 6f |X if |( datapo|
|00005ec0| 73 20 3e 20 30 20 29 0a | 58 09 64 61 74 61 66 6c |s > 0 ).|X.datafl|
|00005ed0| 75 73 68 28 29 3b 0a 58 | 0a 58 20 20 20 20 2f 2a |ush();.X|.X /*|
|00005ee0| 20 61 64 64 20 74 65 72 | 6d 69 6e 61 74 6f 72 20 | add ter|minator |
|00005ef0| 66 6f 72 20 69 6e 69 74 | 69 61 6c 69 7a 61 74 69 |for init|ializati|
|00005f00| 6f 6e 20 2a 2f 0a 58 20 | 20 20 20 70 75 74 73 28 |on */.X | puts(|
|00005f10| 20 22 20 20 20 20 7d 20 | 3b 5c 6e 22 20 29 3b 0a | " } |;\n" );.|
|00005f20| 58 0a 58 20 20 20 20 64 | 61 74 61 6c 69 6e 65 20 |X.X d|ataline |
|00005f30| 3d 20 30 3b 0a 58 20 20 | 20 20 64 61 74 61 70 6f |= 0;.X | datapo|
|00005f40| 73 20 3d 20 30 3b 0a 58 | 20 20 20 20 7d 0a 58 0a |s = 0;.X| }.X.|
|00005f50| 58 0a 58 0a 58 2f 2a 20 | 64 61 74 61 66 6c 75 73 |X.X.X/* |dataflus|
|00005f60| 68 20 2d 20 66 6c 75 73 | 68 20 67 65 6e 65 72 61 |h - flus|h genera|
|00005f70| 74 65 64 20 64 61 74 61 | 20 73 74 61 74 65 6d 65 |ted data| stateme|
|00005f80| 6e 74 73 0a 58 20 2a 0a | 58 20 2a 20 73 79 6e 6f |nts.X *.|X * syno|
|00005f90| 70 73 69 73 0a 58 20 2a | 20 20 20 20 64 61 74 61 |psis.X *| data|
|00005fa0| 66 6c 75 73 68 28 29 3b | 0a 58 20 2a 2f 0a 58 0a |flush();|.X */.X.|
|00005fb0| 58 76 6f 69 64 20 64 61 | 74 61 66 6c 75 73 68 28 |Xvoid da|taflush(|
|00005fc0| 29 0a 58 0a 58 20 20 20 | 20 7b 0a 58 20 20 20 20 |).X.X | {.X |
|00005fd0| 70 75 74 63 68 61 72 28 | 20 27 5c 6e 27 20 29 3b |putchar(| '\n' );|
|00005fe0| 0a 58 0a 58 20 20 20 20 | 69 66 20 28 20 2b 2b 64 |.X.X |if ( ++d|
|00005ff0| 61 74 61 6c 69 6e 65 20 | 3e 3d 20 4e 55 4d 44 41 |ataline |>= NUMDA|
|00006000| 54 41 4c 49 4e 45 53 20 | 29 0a 58 09 7b 0a 58 09 |TALINES |).X.{.X.|
|00006010| 2f 2a 20 70 75 74 20 6f | 75 74 20 61 20 62 6c 61 |/* put o|ut a bla|
|00006020| 6e 6b 20 6c 69 6e 65 20 | 73 6f 20 74 68 61 74 20 |nk line |so that |
|00006030| 74 68 65 20 74 61 62 6c | 65 20 69 73 20 67 72 6f |the tabl|e is gro|
|00006040| 75 70 65 64 20 69 6e 74 | 6f 0a 58 09 20 2a 20 6c |uped int|o.X. * l|
|00006050| 61 72 67 65 20 62 6c 6f | 63 6b 73 20 74 68 61 74 |arge blo|cks that|
|00006060| 20 65 6e 61 62 6c 65 20 | 74 68 65 20 75 73 65 72 | enable |the user|
|00006070| 20 74 6f 20 66 69 6e 64 | 20 65 6c 65 6d 65 6e 74 | to find| element|
|00006080| 73 20 65 61 73 69 6c 79 | 0a 58 09 20 2a 2f 0a 58 |s easily|.X. */.X|
|00006090| 09 70 75 74 63 68 61 72 | 28 20 27 5c 6e 27 20 29 |.putchar|( '\n' )|
|000060a0| 3b 0a 58 09 64 61 74 61 | 6c 69 6e 65 20 3d 20 30 |;.X.data|line = 0|
|000060b0| 3b 0a 58 09 7d 0a 58 0a | 58 20 20 20 20 2f 2a 20 |;.X.}.X.|X /* |
|000060c0| 72 65 73 65 74 20 74 68 | 65 20 6e 75 6d 62 65 72 |reset th|e number|
|000060d0| 20 6f 66 20 63 68 61 72 | 61 63 74 65 72 73 20 77 | of char|acters w|
|000060e0| 72 69 74 74 65 6e 20 6f | 6e 20 74 68 65 20 63 75 |ritten o|n the cu|
|000060f0| 72 72 65 6e 74 20 6c 69 | 6e 65 20 2a 2f 0a 58 20 |rrent li|ne */.X |
|00006100| 20 20 20 64 61 74 61 70 | 6f 73 20 3d 20 30 3b 0a | datap|os = 0;.|
|00006110| 58 20 20 20 20 7d 0a 58 | 0a 58 0a 58 2f 2a 20 66 |X }.X|.X.X/* f|
|00006120| 6c 65 78 65 72 72 6f 72 | 20 2d 20 72 65 70 6f 72 |lexerror| - repor|
|00006130| 74 20 61 6e 20 65 72 72 | 6f 72 20 6d 65 73 73 61 |t an err|or messa|
|00006140| 67 65 20 61 6e 64 20 74 | 65 72 6d 69 6e 61 74 65 |ge and t|erminate|
|00006150| 0a 58 20 2a 0a 58 20 2a | 20 73 79 6e 6f 70 73 69 |.X *.X *| synopsi|
|00006160| 73 0a 58 20 2a 20 20 20 | 20 63 68 61 72 20 6d 73 |s.X * | char ms|
|00006170| 67 5b 5d 3b 0a 58 20 2a | 20 20 20 20 66 6c 65 78 |g[];.X *| flex|
|00006180| 65 72 72 6f 72 28 20 6d | 73 67 20 29 3b 0a 58 20 |error( m|sg );.X |
|00006190| 2a 2f 0a 58 0a 58 76 6f | 69 64 20 66 6c 65 78 65 |*/.X.Xvo|id flexe|
|000061a0| 72 72 6f 72 28 20 6d 73 | 67 20 29 0a 58 63 68 61 |rror( ms|g ).Xcha|
|000061b0| 72 20 6d 73 67 5b 5d 3b | 0a 58 0a 58 20 20 20 20 |r msg[];|.X.X |
|000061c0| 7b 0a 58 20 20 20 20 66 | 70 72 69 6e 74 66 28 20 |{.X f|printf( |
|000061d0| 73 74 64 65 72 72 2c 20 | 22 25 73 3a 20 25 73 5c |stderr, |"%s: %s\|
|000061e0| 6e 22 2c 20 70 72 6f 67 | 72 61 6d 5f 6e 61 6d 65 |n", prog|ram_name|
|000061f0| 2c 20 6d 73 67 20 29 3b | 0a 58 0a 58 20 20 20 20 |, msg );|.X.X |
|00006200| 66 6c 65 78 65 6e 64 28 | 20 31 20 29 3b 0a 58 20 |flexend(| 1 );.X |
|00006210| 20 20 20 7d 0a 58 0a 58 | 0a 58 2f 2a 20 66 6c 65 | }.X.X|.X/* fle|
|00006220| 78 66 61 74 61 6c 20 2d | 20 72 65 70 6f 72 74 20 |xfatal -| report |
|00006230| 61 20 66 61 74 61 6c 20 | 65 72 72 6f 72 20 6d 65 |a fatal |error me|
|00006240| 73 73 61 67 65 20 61 6e | 64 20 74 65 72 6d 69 6e |ssage an|d termin|
|00006250| 61 74 65 0a 58 20 2a 0a | 58 20 2a 20 73 79 6e 6f |ate.X *.|X * syno|
|00006260| 70 73 69 73 0a 58 20 2a | 20 20 20 20 63 68 61 72 |psis.X *| char|
|00006270| 20 6d 73 67 5b 5d 3b 0a | 58 20 2a 20 20 20 20 66 | msg[];.|X * f|
|00006280| 6c 65 78 66 61 74 61 6c | 28 20 6d 73 67 20 29 3b |lexfatal|( msg );|
|00006290| 0a 58 20 2a 2f 0a 58 0a | 58 76 6f 69 64 20 66 6c |.X */.X.|Xvoid fl|
|000062a0| 65 78 66 61 74 61 6c 28 | 20 6d 73 67 20 29 0a 58 |exfatal(| msg ).X|
|000062b0| 63 68 61 72 20 6d 73 67 | 5b 5d 3b 0a 58 0a 58 20 |char msg|[];.X.X |
|000062c0| 20 20 20 7b 0a 58 20 20 | 20 20 66 70 72 69 6e 74 | {.X | fprint|
|000062d0| 66 28 20 73 74 64 65 72 | 72 2c 20 22 25 73 3a 20 |f( stder|r, "%s: |
|000062e0| 66 61 74 61 6c 20 69 6e | 74 65 72 6e 61 6c 20 65 |fatal in|ternal e|
|000062f0| 72 72 6f 72 2c 20 25 73 | 5c 6e 22 2c 20 70 72 6f |rror, %s|\n", pro|
|00006300| 67 72 61 6d 5f 6e 61 6d | 65 2c 20 6d 73 67 20 29 |gram_nam|e, msg )|
|00006310| 3b 0a 58 20 20 20 20 66 | 6c 65 78 65 6e 64 28 20 |;.X f|lexend( |
|00006320| 31 20 29 3b 0a 58 20 20 | 20 20 7d 0a 58 0a 58 0a |1 );.X | }.X.X.|
|00006330| 58 2f 2a 20 66 6c 65 78 | 5f 67 65 74 74 69 6d 65 |X/* flex|_gettime|
|00006340| 20 2d 20 72 65 74 75 72 | 6e 20 63 75 72 72 65 6e | - retur|n curren|
|00006350| 74 20 74 69 6d 65 0a 58 | 20 2a 0a 58 20 2a 20 73 |t time.X| *.X * s|
|00006360| 79 6e 6f 70 73 69 73 0a | 58 20 2a 20 20 20 20 63 |ynopsis.|X * c|
|00006370| 68 61 72 20 2a 66 6c 65 | 78 5f 67 65 74 74 69 6d |har *fle|x_gettim|
|00006380| 65 28 29 2c 20 2a 74 69 | 6d 65 5f 73 74 72 3b 0a |e(), *ti|me_str;.|
|00006390| 58 20 2a 20 20 20 20 74 | 69 6d 65 5f 73 74 72 20 |X * t|ime_str |
|000063a0| 3d 20 66 6c 65 78 5f 67 | 65 74 74 69 6d 65 28 29 |= flex_g|ettime()|
|000063b0| 3b 0a 58 20 2a 0a 58 20 | 2a 20 6e 6f 74 65 0a 58 |;.X *.X |* note.X|
|000063c0| 20 2a 20 20 20 20 74 68 | 65 20 72 6f 75 74 69 6e | * th|e routin|
|000063d0| 65 20 6e 61 6d 65 20 68 | 61 73 20 74 68 65 20 22 |e name h|as the "|
|000063e0| 66 6c 65 78 5f 22 20 70 | 72 65 66 69 78 20 62 65 |flex_" p|refix be|
|000063f0| 63 61 75 73 65 20 6f 66 | 20 6e 61 6d 65 20 63 6c |cause of| name cl|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.