home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / M / MacPerl 4.13 source.sit / Perl Source ƒ / Perl / usub / README < prev   
MacBinary  |  1993-10-23  |  5.6 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: README

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
10% dexvert Jesper Olsen Module (music/jesperOlsen) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sat Oct 23 01:21:55 1993, modified Sat Oct 23 01:21:55 1993, creator 'MPS ', type ASCII, 5093 bytes "README" , at 0x1465 428 bytes resource default (weak)
99% file data default
49% TrID Macintosh plain text (MacBinary) default
33% TrID TTComp archive compressed (bin-4K) default (weak)
16% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 06 52 45 41 44 4d 45 | 00 00 00 00 00 00 00 00 |..README|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 13 e5 00 | 00 01 ac a8 ee 6f f3 a8 |........|.....o..|
|00000060| ee 6f f3 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.o......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 1e 0d 00 00 |........|........|
|00000080| 54 68 69 73 20 64 69 72 | 65 63 74 6f 72 79 20 63 |This dir|ectory c|
|00000090| 6f 6e 74 61 69 6e 73 20 | 61 6e 20 65 78 61 6d 70 |ontains |an examp|
|000000a0| 6c 65 20 6f 66 20 68 6f | 77 20 79 6f 75 20 6d 69 |le of ho|w you mi|
|000000b0| 67 68 74 20 6c 69 6e 6b | 20 69 6e 20 43 20 73 75 |ght link| in C su|
|000000c0| 62 72 6f 75 74 69 6e 65 | 73 0d 77 69 74 68 20 70 |broutine|s.with p|
|000000d0| 65 72 6c 20 74 6f 20 6d | 61 6b 65 20 79 6f 75 72 |erl to m|ake your|
|000000e0| 20 6f 77 6e 20 73 70 65 | 63 69 61 6c 20 63 6f 70 | own spe|cial cop|
|000000f0| 79 20 6f 66 20 70 65 72 | 6c 2e 20 20 49 6e 20 74 |y of per|l. In t|
|00000100| 68 65 20 70 65 72 6c 20 | 64 69 73 74 72 69 62 75 |he perl |distribu|
|00000110| 74 69 6f 6e 0d 64 69 72 | 65 63 74 6f 72 79 2c 20 |tion.dir|ectory, |
|00000120| 74 68 65 72 65 20 77 69 | 6c 6c 20 62 65 20 28 61 |there wi|ll be (a|
|00000130| 66 74 65 72 20 6d 61 6b | 65 20 69 73 20 72 75 6e |fter mak|e is run|
|00000140| 29 20 61 20 66 69 6c 65 | 20 63 61 6c 6c 65 64 20 |) a file| called |
|00000150| 75 70 65 72 6c 2e 6f 2c | 20 77 68 69 63 68 0d 69 |uperl.o,| which.i|
|00000160| 73 20 61 6c 6c 20 6f 66 | 20 70 65 72 6c 20 65 78 |s all of| perl ex|
|00000170| 63 65 70 74 20 66 6f 72 | 20 61 20 73 69 6e 67 6c |cept for| a singl|
|00000180| 65 20 75 6e 64 65 66 69 | 6e 65 64 20 73 75 62 72 |e undefi|ned subr|
|00000190| 6f 75 74 69 6e 65 2c 20 | 6e 61 6d 65 64 20 75 73 |outine, |named us|
|000001a0| 65 72 69 6e 69 74 28 29 | 2e 0d 53 65 65 20 75 73 |erinit()|..See us|
|000001b0| 65 72 73 75 62 2e 63 2e | 0d 0d 54 68 65 20 73 6f |ersub.c.|..The so|
|000001c0| 6c 65 20 70 75 72 70 6f | 73 65 20 6f 66 20 74 68 |le purpo|se of th|
|000001d0| 65 20 75 73 65 72 69 6e | 69 74 28 29 20 72 6f 75 |e userin|it() rou|
|000001e0| 74 69 6e 65 20 69 73 20 | 74 6f 20 63 61 6c 6c 20 |tine is |to call |
|000001f0| 74 68 65 20 69 6e 69 74 | 69 61 6c 69 7a 61 74 69 |the init|ializati|
|00000200| 6f 6e 0d 72 6f 75 74 69 | 6e 65 73 20 66 6f 72 20 |on.routi|nes for |
|00000210| 61 6e 79 20 6d 6f 64 75 | 6c 65 73 20 74 68 61 74 |any modu|les that|
|00000220| 20 79 6f 75 20 77 61 6e | 74 20 74 6f 20 6c 69 6e | you wan|t to lin|
|00000230| 6b 20 69 6e 2e 20 20 49 | 6e 20 74 68 69 73 20 65 |k in. I|n this e|
|00000240| 78 61 6d 70 6c 65 2c 20 | 77 65 20 6a 75 73 74 0d |xample, |we just.|
|00000250| 63 61 6c 6c 20 69 6e 69 | 74 5f 63 75 72 73 65 73 |call ini|t_curses|
|00000260| 28 29 2c 20 77 68 69 63 | 68 20 73 65 74 73 20 75 |(), whic|h sets u|
|00000270| 70 20 74 6f 20 6c 69 6e | 6b 20 69 6e 20 74 68 65 |p to lin|k in the|
|00000280| 20 53 79 73 74 65 6d 20 | 56 20 63 75 72 73 65 73 | System |V curses|
|00000290| 20 72 6f 75 74 69 6e 65 | 73 2e 0d 59 6f 75 27 6c | routine|s..You'l|
|000002a0| 6c 20 66 69 6e 64 20 74 | 68 69 73 20 69 6e 20 74 |l find t|his in t|
|000002b0| 68 65 20 66 69 6c 65 20 | 63 75 72 73 65 73 2e 63 |he file |curses.c|
|000002c0| 2c 20 77 68 69 63 68 20 | 69 73 20 74 68 65 20 70 |, which |is the p|
|000002d0| 72 6f 63 65 73 73 65 64 | 20 6f 75 74 70 75 74 20 |rocessed| output |
|000002e0| 6f 66 0d 63 75 72 73 65 | 73 2e 6d 75 73 2e 20 20 |of.curse|s.mus. |
|000002f0| 28 54 6f 20 67 65 74 20 | 42 53 44 20 63 75 72 73 |(To get |BSD curs|
|00000300| 65 73 2c 20 72 65 70 6c | 61 63 65 20 63 75 72 73 |es, repl|ace curs|
|00000310| 65 73 2e 6d 75 73 20 77 | 69 74 68 20 62 73 64 63 |es.mus w|ith bsdc|
|00000320| 75 72 73 65 73 2e 6d 75 | 73 2e 29 0d 0d 54 68 65 |urses.mu|s.)..The|
|00000330| 20 6d 61 67 69 63 6e 61 | 6d 65 28 29 20 72 6f 75 | magicna|me() rou|
|00000340| 74 69 6e 65 20 61 64 64 | 73 20 76 61 72 69 61 62 |tine add|s variab|
|00000350| 6c 65 20 6e 61 6d 65 73 | 20 69 6e 74 6f 20 74 68 |le names| into th|
|00000360| 65 20 73 79 6d 62 6f 6c | 20 74 61 62 6c 65 2e 20 |e symbol| table. |
|00000370| 20 41 6c 6f 6e 67 0d 77 | 69 74 68 20 74 68 65 20 | Along.w|ith the |
|00000380| 6e 61 6d 65 20 6f 66 20 | 74 68 65 20 76 61 72 69 |name of |the vari|
|00000390| 61 62 6c 65 20 61 73 20 | 50 65 72 6c 20 6b 6e 6f |able as |Perl kno|
|000003a0| 77 73 20 69 74 2c 20 77 | 65 20 70 61 73 73 20 61 |ws it, w|e pass a|
|000003b0| 20 73 74 72 75 63 74 75 | 72 65 20 63 6f 6e 74 61 | structu|re conta|
|000003c0| 69 6e 69 6e 67 0d 61 6e | 20 69 6e 64 65 78 20 69 |ining.an| index i|
|000003d0| 64 65 6e 74 69 66 79 69 | 6e 67 20 74 68 65 20 76 |dentifyi|ng the v|
|000003e0| 61 72 69 61 62 6c 65 2c | 20 61 6e 64 20 74 68 65 |ariable,| and the|
|000003f0| 20 6e 61 6d 65 73 20 6f | 66 20 74 77 6f 20 43 20 | names o|f two C |
|00000400| 66 75 6e 63 74 69 6f 6e | 73 20 74 68 61 74 0d 6b |function|s that.k|
|00000410| 6e 6f 77 20 68 6f 77 20 | 74 6f 20 73 65 74 20 6f |now how |to set o|
|00000420| 72 20 65 76 61 6c 75 61 | 74 65 20 61 20 76 61 72 |r evalua|te a var|
|00000430| 69 61 62 6c 65 20 67 69 | 76 65 6e 20 74 68 65 20 |iable gi|ven the |
|00000440| 69 6e 64 65 78 20 6f 66 | 20 74 68 65 20 76 61 72 |index of| the var|
|00000450| 69 61 62 6c 65 2e 0d 4f | 75 72 20 65 78 61 6d 70 |iable..O|ur examp|
|00000460| 6c 65 20 75 73 65 73 20 | 61 20 6d 61 63 72 6f 20 |le uses |a macro |
|00000470| 74 6f 20 68 61 6e 64 6c | 65 20 74 68 69 73 20 63 |to handl|e this c|
|00000480| 6f 6e 76 65 6e 69 65 6e | 74 6c 79 2e 0d 0d 54 68 |onvenien|tly...Th|
|00000490| 65 20 69 6e 69 74 20 72 | 6f 75 74 69 6e 65 20 63 |e init r|outine c|
|000004a0| 61 6c 6c 73 20 6d 61 6b | 65 5f 75 73 75 62 28 29 |alls mak|e_usub()|
|000004b0| 20 74 6f 20 61 64 64 20 | 75 73 65 72 2d 64 65 66 | to add |user-def|
|000004c0| 69 6e 65 64 20 73 75 62 | 72 6f 75 74 69 6e 65 20 |ined sub|routine |
|000004d0| 6e 61 6d 65 73 0d 69 6e | 74 6f 20 74 68 65 20 73 |names.in|to the s|
|000004e0| 79 6d 62 6f 6c 20 74 61 | 62 6c 65 2e 20 20 54 68 |ymbol ta|ble. Th|
|000004f0| 65 20 61 72 67 75 6d 65 | 6e 74 73 20 61 72 65 0d |e argume|nts are.|
|00000500| 0d 09 6d 61 6b 65 5f 75 | 73 75 62 28 73 75 62 6e |..make_u|sub(subn|
|00000510| 61 6d 65 2c 20 73 75 62 | 69 6e 64 65 78 2c 20 73 |ame, sub|index, s|
|00000520| 75 62 66 75 6e 63 2c 20 | 66 69 6c 65 6e 61 6d 65 |ubfunc, |filename|
|00000530| 29 3b 0d 09 63 68 61 72 | 20 2a 73 75 62 6e 61 6d |);..char| *subnam|
|00000540| 65 3b 0d 09 69 6e 74 20 | 73 75 62 69 6e 64 65 78 |e;..int |subindex|
|00000550| 3b 0d 09 69 6e 74 20 73 | 75 62 66 75 6e 63 28 29 |;..int s|ubfunc()|
|00000560| 3b 0d 09 63 68 61 72 20 | 2a 66 69 6c 65 6e 61 6d |;..char |*filenam|
|00000570| 65 3b 0d 0d 54 68 65 20 | 73 75 62 6e 61 6d 65 20 |e;..The |subname |
|00000580| 69 73 20 74 68 65 20 6e | 61 6d 65 20 74 68 61 74 |is the n|ame that|
|00000590| 20 77 69 6c 6c 20 62 65 | 20 75 73 65 64 20 69 6e | will be| used in|
|000005a0| 20 74 68 65 20 50 65 72 | 6c 20 70 72 6f 67 72 61 | the Per|l progra|
|000005b0| 6d 2e 20 20 54 68 65 20 | 73 75 62 69 6e 64 65 78 |m. The |subindex|
|000005c0| 0d 77 69 6c 6c 20 62 65 | 20 70 61 73 73 65 64 20 |.will be| passed |
|000005d0| 74 6f 20 73 75 62 66 75 | 6e 63 28 29 20 77 68 65 |to subfu|nc() whe|
|000005e0| 6e 20 69 74 20 69 73 20 | 63 61 6c 6c 65 64 20 74 |n it is |called t|
|000005f0| 6f 20 74 65 6c 6c 20 69 | 74 20 77 68 69 63 68 20 |o tell i|t which |
|00000600| 43 20 66 75 6e 63 74 69 | 6f 6e 0d 69 73 20 64 65 |C functi|on.is de|
|00000610| 73 69 72 65 64 2e 20 20 | 73 75 62 66 75 6e 63 28 |sired. |subfunc(|
|00000620| 29 20 69 73 20 61 20 67 | 6c 75 65 20 72 6f 75 74 |) is a g|lue rout|
|00000630| 69 6e 65 20 74 68 61 74 | 20 74 72 61 6e 73 6c 61 |ine that| transla|
|00000640| 74 65 73 20 74 68 65 20 | 61 72 67 75 6d 65 6e 74 |tes the |argument|
|00000650| 73 0d 66 72 6f 6d 20 50 | 65 72 6c 20 69 6e 74 65 |s.from P|erl inte|
|00000660| 72 6e 61 6c 20 73 74 61 | 63 6b 20 66 6f 72 6d 20 |rnal sta|ck form |
|00000670| 74 6f 20 74 68 65 20 66 | 6f 72 6d 20 72 65 71 75 |to the f|orm requ|
|00000680| 69 72 65 64 20 62 79 20 | 74 68 65 20 72 6f 75 74 |ired by |the rout|
|00000690| 69 6e 65 20 69 6e 0d 71 | 75 65 73 74 69 6f 6e 2c |ine in.q|uestion,|
|000006a0| 20 63 61 6c 6c 73 20 74 | 68 65 20 64 65 73 69 72 | calls t|he desir|
|000006b0| 65 64 20 43 20 66 75 6e | 63 74 69 6f 6e 2c 20 61 |ed C fun|ction, a|
|000006c0| 6e 64 20 74 68 65 6e 20 | 74 72 61 6e 73 6c 61 74 |nd then |translat|
|000006d0| 65 73 20 61 6e 79 20 72 | 65 74 75 72 6e 0d 76 61 |es any r|eturn.va|
|000006e0| 6c 75 65 20 62 61 63 6b | 20 69 6e 74 6f 20 74 68 |lue back| into th|
|000006f0| 65 20 73 74 61 63 6b 20 | 66 6f 72 6d 61 74 2e 20 |e stack |format. |
|00000700| 20 54 68 65 20 67 6c 75 | 65 20 72 6f 75 74 69 6e | The glu|e routin|
|00000710| 65 20 75 73 65 64 20 62 | 79 20 63 75 72 73 65 73 |e used b|y curses|
|00000720| 20 6a 75 73 74 0d 68 61 | 73 20 61 20 6c 61 72 67 | just.ha|s a larg|
|00000730| 65 20 73 77 69 74 63 68 | 20 73 74 61 74 65 6d 65 |e switch| stateme|
|00000740| 6e 74 2c 20 65 61 63 68 | 20 62 72 61 6e 63 68 20 |nt, each| branch |
|00000750| 6f 66 20 77 68 69 63 68 | 20 64 6f 65 73 20 74 68 |of which| does th|
|00000760| 65 20 70 72 6f 63 65 73 | 73 69 6e 67 0d 66 6f 72 |e proces|sing.for|
|00000770| 20 61 20 70 61 72 74 69 | 63 75 6c 61 72 20 43 20 | a parti|cular C |
|00000780| 66 75 6e 63 74 69 6f 6e | 2e 20 20 54 68 65 20 73 |function|. The s|
|00000790| 75 62 69 6e 64 65 78 20 | 63 6f 75 6c 64 2c 20 68 |ubindex |could, h|
|000007a0| 6f 77 65 76 65 72 2c 20 | 62 65 20 75 73 65 64 20 |owever, |be used |
|000007b0| 74 6f 20 6c 6f 6f 6b 0d | 75 70 20 61 20 66 75 6e |to look.|up a fun|
|000007c0| 63 74 69 6f 6e 20 69 6e | 20 61 20 64 79 6e 61 6d |ction in| a dynam|
|000007d0| 69 63 61 6c 6c 79 20 6c | 69 6e 6b 65 64 20 6c 69 |ically l|inked li|
|000007e0| 62 72 61 72 79 2e 20 20 | 4e 6f 20 65 78 61 6d 70 |brary. |No examp|
|000007f0| 6c 65 20 6f 66 20 74 68 | 69 73 20 69 73 0d 70 72 |le of th|is is.pr|
|00000800| 6f 76 69 64 65 64 2e 0d | 0d 41 73 20 61 20 68 65 |ovided..|.As a he|
|00000810| 6c 70 20 69 6e 20 70 72 | 6f 64 75 63 69 6e 67 20 |lp in pr|oducing |
|00000820| 74 68 65 20 67 6c 75 65 | 20 72 6f 75 74 69 6e 65 |the glue| routine|
|00000830| 2c 20 61 20 70 72 65 70 | 72 6f 63 65 73 73 6f 72 |, a prep|rocessor|
|00000840| 20 63 61 6c 6c 65 64 20 | 22 6d 75 73 22 20 6c 65 | called |"mus" le|
|00000850| 74 73 0d 79 6f 75 20 73 | 70 65 63 69 66 79 20 61 |ts.you s|pecify a|
|00000860| 72 67 75 6d 65 6e 74 20 | 61 6e 64 20 72 65 74 75 |rgument |and retu|
|00000870| 72 6e 20 76 61 6c 75 65 | 20 74 79 70 65 73 20 69 |rn value| types i|
|00000880| 6e 20 61 20 74 61 62 75 | 6c 61 72 20 66 6f 72 6d |n a tabu|lar form|
|00000890| 61 74 2e 20 20 41 6e 20 | 65 6e 74 72 79 0d 73 75 |at. An |entry.su|
|000008a0| 63 68 20 61 73 3a 0d 0d | 20 20 20 20 43 41 53 45 |ch as:..| CASE|
|000008b0| 20 69 6e 74 20 77 61 64 | 64 73 74 72 0d 20 20 20 | int wad|dstr. |
|000008c0| 20 49 20 20 20 20 20 20 | 20 57 49 4e 44 4f 57 2a | I | WINDOW*|
|000008d0| 20 20 20 20 20 20 20 20 | 20 77 69 6e 0d 20 20 20 | | win. |
|000008e0| 20 49 20 20 20 20 20 20 | 20 63 68 61 72 2a 20 20 | I | char* |
|000008f0| 20 20 20 20 20 20 20 20 | 20 73 74 72 0d 20 20 20 | | str. |
|00000900| 20 45 4e 44 0d 0d 69 6e | 64 69 63 61 74 65 73 20 | END..in|dicates |
|00000910| 74 68 61 74 20 77 61 64 | 64 73 74 72 20 74 61 6b |that wad|dstr tak|
|00000920| 65 73 20 74 77 6f 20 69 | 6e 70 75 74 20 61 72 67 |es two i|nput arg|
|00000930| 75 6d 65 6e 74 73 2c 20 | 74 68 65 20 66 69 72 73 |uments, |the firs|
|00000940| 74 20 6f 66 20 77 68 69 | 63 68 20 69 73 20 61 0d |t of whi|ch is a.|
|00000950| 70 6f 69 6e 74 65 72 20 | 74 6f 20 61 20 77 69 6e |pointer |to a win|
|00000960| 64 6f 77 2c 20 61 6e 64 | 20 74 68 65 20 73 65 63 |dow, and| the sec|
|00000970| 6f 6e 64 20 6f 66 20 77 | 68 69 63 68 20 69 73 20 |ond of w|hich is |
|00000980| 61 6e 20 6f 72 64 69 6e | 61 72 79 20 43 20 73 74 |an ordin|ary C st|
|00000990| 72 69 6e 67 2e 20 20 49 | 74 0d 61 6c 73 6f 20 69 |ring. I|t.also i|
|000009a0| 6e 64 69 63 61 74 65 73 | 20 74 68 61 74 20 61 6e |ndicates| that an|
|000009b0| 20 69 6e 74 65 67 65 72 | 20 69 73 20 72 65 74 75 | integer| is retu|
|000009c0| 72 6e 65 64 2e 20 20 54 | 68 65 20 6d 75 73 20 70 |rned. T|he mus p|
|000009d0| 72 6f 67 72 61 6d 20 74 | 75 72 6e 73 20 74 68 69 |rogram t|urns thi|
|000009e0| 73 20 69 6e 74 6f 3a 0d | 0d 20 20 20 20 63 61 73 |s into:.|. cas|
|000009f0| 65 20 55 53 5f 77 61 64 | 64 73 74 72 3a 0d 20 20 |e US_wad|dstr:. |
|00000a00| 20 20 20 20 20 20 69 66 | 20 28 69 74 65 6d 73 20 | if| (items |
|00000a10| 21 3d 20 32 29 0d 20 20 | 20 20 20 20 20 20 20 20 |!= 2). | |
|00000a20| 20 20 66 61 74 61 6c 28 | 22 55 73 61 67 65 3a 20 | fatal(|"Usage: |
|00000a30| 26 77 61 64 64 73 74 72 | 28 24 77 69 6e 2c 20 24 |&waddstr|($win, $|
|00000a40| 73 74 72 29 22 29 3b 0d | 20 20 20 20 20 20 20 20 |str)");.| |
|00000a50| 65 6c 73 65 20 7b 0d 20 | 20 20 20 20 20 20 20 20 |else {. | |
|00000a60| 20 20 20 69 6e 74 20 72 | 65 74 76 61 6c 3b 0d 20 | int r|etval;. |
|00000a70| 20 20 20 20 20 20 20 20 | 20 20 20 57 49 4e 44 4f | | WINDO|
|00000a80| 57 2a 20 20 20 20 20 77 | 69 6e 20 3d 20 20 20 20 |W* w|in = |
|00000a90| 20 20 20 20 20 20 20 2a | 28 57 49 4e 44 4f 57 2a | *|(WINDOW*|
|00000aa0| 2a 29 20 20 20 20 20 73 | 74 72 5f 67 65 74 28 73 |*) s|tr_get(s|
|00000ab0| 74 5b 31 5d 29 3b 0d 20 | 20 20 20 20 20 20 20 20 |t[1]);. | |
|00000ac0| 20 20 20 63 68 61 72 2a | 20 20 20 20 20 20 20 73 | char*| s|
|00000ad0| 74 72 20 3d 20 20 20 20 | 20 20 20 20 20 20 20 28 |tr = | (|
|00000ae0| 63 68 61 72 2a 29 20 20 | 20 20 20 20 20 20 20 73 |char*) | s|
|00000af0| 74 72 5f 67 65 74 28 73 | 74 5b 32 5d 29 3b 0d 0d |tr_get(s|t[2]);..|
|00000b00| 20 20 20 20 20 20 20 20 | 20 20 20 20 72 65 74 76 | | retv|
|00000b10| 61 6c 20 3d 20 77 61 64 | 64 73 74 72 28 77 69 6e |al = wad|dstr(win|
|00000b20| 2c 20 73 74 72 29 3b 0d | 20 20 20 20 20 20 20 20 |, str);.| |
|00000b30| 20 20 20 20 73 74 72 5f | 6e 75 6d 73 65 74 28 73 | str_|numset(s|
|00000b40| 74 5b 30 5d 2c 20 28 64 | 6f 75 62 6c 65 29 20 72 |t[0], (d|ouble) r|
|00000b50| 65 74 76 61 6c 29 3b 0d | 20 20 20 20 20 20 20 20 |etval);.| |
|00000b60| 7d 0d 20 20 20 20 20 20 | 20 20 72 65 74 75 72 6e |}. | return|
|00000b70| 20 73 70 3b 0d 0d 49 74 | 27 73 20 61 6c 73 6f 20 | sp;..It|'s also |
|00000b80| 70 6f 73 73 69 62 6c 65 | 20 74 6f 20 68 61 76 65 |possible| to have|
|00000b90| 20 6f 75 74 70 75 74 20 | 70 61 72 61 6d 65 74 65 | output |paramete|
|00000ba0| 72 73 2c 20 69 6e 64 69 | 63 61 74 65 64 20 62 79 |rs, indi|cated by|
|00000bb0| 20 4f 2c 20 61 6e 64 20 | 69 6e 70 75 74 2f 6f 75 | O, and |input/ou|
|00000bc0| 70 75 74 0d 70 61 72 61 | 6d 65 74 65 72 73 20 69 |put.para|meters i|
|00000bd0| 6e 64 69 63 61 74 65 64 | 20 62 79 20 49 4f 2e 0d |ndicated| by IO..|
|00000be0| 0d 54 68 65 20 6d 75 73 | 20 70 72 6f 67 72 61 6d |.The mus| program|
|00000bf0| 20 69 73 6e 27 74 20 70 | 65 72 66 65 63 74 2e 20 | isn't p|erfect. |
|00000c00| 20 59 6f 75 27 6c 6c 20 | 6e 6f 74 65 20 74 68 61 | You'll |note tha|
|00000c10| 74 20 63 75 72 73 65 73 | 2e 6d 75 73 20 68 61 73 |t curses|.mus has|
|00000c20| 20 73 6f 6d 65 0d 63 61 | 73 65 73 20 77 68 69 63 | some.ca|ses whic|
|00000c30| 68 20 61 72 65 20 68 61 | 6e 64 20 63 6f 64 65 64 |h are ha|nd coded|
|00000c40| 2e 20 20 54 68 65 79 27 | 6c 6c 20 62 65 20 70 61 |. They'|ll be pa|
|00000c50| 73 73 65 64 20 73 74 72 | 61 69 67 68 74 20 74 68 |ssed str|aight th|
|00000c60| 72 6f 75 67 68 20 75 6e | 6d 6f 64 69 66 69 65 64 |rough un|modified|
|00000c70| 2e 0d 59 6f 75 20 63 61 | 6e 20 70 72 6f 64 75 63 |..You ca|n produc|
|00000c80| 65 20 73 69 6d 69 6c 61 | 72 20 63 61 73 65 73 20 |e simila|r cases |
|00000c90| 62 79 20 61 6e 61 6c 6f | 67 79 20 74 6f 20 77 68 |by analo|gy to wh|
|00000ca0| 61 74 27 73 20 69 6e 20 | 63 75 72 73 65 73 2e 63 |at's in |curses.c|
|00000cb0| 2c 20 61 73 20 77 65 6c | 6c 0d 61 73 20 73 69 6d |, as wel|l.as sim|
|00000cc0| 69 6c 61 72 20 72 6f 75 | 74 69 6e 65 73 20 69 6e |ilar rou|tines in|
|00000cd0| 20 74 68 65 20 64 6f 61 | 72 67 2e 63 2c 20 64 6f | the doa|rg.c, do|
|00000ce0| 6c 69 73 74 2e 63 20 61 | 6e 64 20 64 6f 69 6f 2e |list.c a|nd doio.|
|00000cf0| 63 20 72 6f 75 74 69 6e | 65 73 20 6f 66 20 50 65 |c routin|es of Pe|
|00000d00| 72 6c 2e 0d 54 68 65 20 | 6d 75 73 20 70 72 6f 67 |rl..The |mus prog|
|00000d10| 72 61 6d 20 69 73 20 6f | 6e 6c 79 20 69 6e 74 65 |ram is o|nly inte|
|00000d20| 6e 64 65 64 20 74 6f 20 | 67 65 74 20 79 6f 75 20 |nded to |get you |
|00000d30| 61 62 6f 75 74 20 39 30 | 25 20 74 68 65 72 65 2e |about 90|% there.|
|00000d40| 20 20 49 74 27 73 20 6e | 6f 74 20 63 6c 65 61 72 | It's n|ot clear|
|00000d50| 2c 0d 66 6f 72 20 69 6e | 73 74 61 6e 63 65 2c 20 |,.for in|stance, |
|00000d60| 68 6f 77 20 61 20 67 69 | 76 65 6e 20 73 74 72 75 |how a gi|ven stru|
|00000d70| 63 74 75 72 65 20 73 68 | 6f 75 6c 64 20 62 65 20 |cture sh|ould be |
|00000d80| 70 61 73 73 65 64 20 74 | 6f 20 50 65 72 6c 2e 20 |passed t|o Perl. |
|00000d90| 20 42 75 74 20 74 68 61 | 74 0d 73 68 6f 75 6c 64 | But tha|t.should|
|00000da0| 6e 27 74 20 62 6f 74 68 | 65 72 20 79 6f 75 2d 2d |n't both|er you--|
|00000db0| 69 66 20 79 6f 75 27 76 | 65 20 67 6f 74 74 65 6e |if you'v|e gotten|
|00000dc0| 20 74 68 69 73 20 66 61 | 72 2c 20 69 74 27 73 20 | this fa|r, it's |
|00000dd0| 61 6c 72 65 61 64 79 20 | 6f 62 76 69 6f 75 73 0d |already |obvious.|
|00000de0| 74 68 61 74 20 79 6f 75 | 20 61 72 65 20 74 6f 74 |that you| are tot|
|00000df0| 61 6c 6c 79 20 6d 61 64 | 2e 0d 0d 48 65 72 65 27 |ally mad|...Here'|
|00000e00| 73 20 61 6e 20 65 78 61 | 6d 70 6c 65 20 6f 66 20 |s an exa|mple of |
|00000e10| 68 6f 77 20 74 6f 20 72 | 65 74 75 72 6e 20 61 6e |how to r|eturn an|
|00000e20| 20 61 72 72 61 79 20 76 | 61 6c 75 65 3a 0d 0d 20 | array v|alue:.. |
|00000e30| 20 20 20 63 61 73 65 20 | 55 53 5f 61 70 70 6c 5f | case |US_appl_|
|00000e40| 65 72 72 6c 69 73 74 3a | 0d 09 69 66 20 28 21 77 |errlist:|..if (!w|
|00000e50| 61 6e 74 61 72 72 61 79 | 29 20 7b 0d 09 20 20 20 |antarray|) {.. |
|00000e60| 20 73 74 72 5f 6e 75 6d | 73 65 74 28 73 74 5b 30 | str_num|set(st[0|
|00000e70| 5d 2c 20 28 64 6f 75 62 | 6c 65 29 20 61 70 70 6c |], (doub|le) appl|
|00000e80| 5f 6e 65 72 72 29 3b 0d | 09 20 20 20 20 72 65 74 |_nerr);.|. ret|
|00000e90| 75 72 6e 20 73 70 3b 0d | 09 7d 0d 09 61 73 74 6f |urn sp;.|.}..asto|
|00000ea0| 72 65 28 73 74 61 63 6b | 2c 20 73 70 20 2b 20 61 |re(stack|, sp + a|
|00000eb0| 70 70 6c 5f 6e 65 72 72 | 2c 20 4e 75 6c 6c 73 74 |ppl_nerr|, Nullst|
|00000ec0| 72 29 3b 09 09 2f 2a 20 | 65 78 74 65 6e 64 20 73 |r);../* |extend s|
|00000ed0| 74 61 63 6b 20 2a 2f 0d | 09 73 74 20 3d 20 73 74 |tack */.|.st = st|
|00000ee0| 61 63 6b 2d 3e 61 72 79 | 5f 61 72 72 61 79 20 2b |ack->ary|_array +|
|00000ef0| 20 73 70 3b 09 09 09 2f | 2a 20 70 6f 73 73 69 62 | sp;.../|* possib|
|00000f00| 6c 79 20 72 65 61 6c 6c | 6f 63 65 64 20 2a 2f 0d |ly reall|oced */.|
|00000f10| 09 66 6f 72 20 28 69 20 | 3d 20 30 3b 20 69 20 3c |.for (i |= 0; i <|
|00000f20| 20 61 70 70 6c 5f 6e 65 | 72 72 3b 20 69 2b 2b 29 | appl_ne|rr; i++)|
|00000f30| 20 7b 0d 09 20 20 20 20 | 74 6d 70 73 20 3d 20 61 | {.. |tmps = a|
|00000f40| 70 70 6c 5f 65 72 72 6c | 69 73 74 5b 69 5d 3b 0d |ppl_errl|ist[i];.|
|00000f50| 09 20 20 20 20 73 74 5b | 69 5d 20 3d 20 73 74 72 |. st[|i] = str|
|00000f60| 5f 32 6d 6f 72 74 61 6c | 28 73 74 72 5f 6d 61 6b |_2mortal|(str_mak|
|00000f70| 65 28 74 6d 70 73 2c 73 | 74 72 6c 65 6e 28 74 6d |e(tmps,s|trlen(tm|
|00000f80| 70 73 29 29 29 3b 0d 09 | 7d 0d 09 72 65 74 75 72 |ps)));..|}..retur|
|00000f90| 6e 20 73 70 20 2b 20 61 | 70 70 6c 5f 6e 65 72 72 |n sp + a|ppl_nerr|
|00000fa0| 20 2d 20 31 3b 0d 0d 0d | 49 6e 20 61 64 64 69 74 | - 1;...|In addit|
|00000fb0| 69 6f 6e 2c 20 74 68 65 | 72 65 20 69 73 20 61 20 |ion, the|re is a |
|00000fc0| 70 72 6f 67 72 61 6d 2c | 20 6d 61 6e 32 6d 75 73 |program,| man2mus|
|00000fd0| 2c 20 74 68 61 74 20 77 | 69 6c 6c 20 73 63 61 6e |, that w|ill scan|
|00000fe0| 20 61 20 6d 61 6e 20 70 | 61 67 65 20 66 6f 72 0d | a man p|age for.|
|00000ff0| 66 75 6e 63 74 69 6f 6e | 20 70 72 6f 74 6f 74 79 |function| prototy|
|00001000| 70 65 73 20 61 6e 64 20 | 61 74 74 65 6d 70 74 20 |pes and |attempt |
|00001010| 74 6f 20 63 6f 6e 73 74 | 72 75 63 74 20 61 20 6d |to const|ruct a m|
|00001020| 75 73 20 43 41 53 45 20 | 65 6e 74 72 79 20 66 6f |us CASE |entry fo|
|00001030| 72 20 79 6f 75 2e 20 20 | 49 74 20 68 61 73 0d 74 |r you. |It has.t|
|00001040| 6f 20 67 75 65 73 73 20 | 61 62 6f 75 74 20 69 6e |o guess |about in|
|00001050| 70 75 74 2f 6f 75 74 70 | 75 74 20 70 61 72 61 6d |put/outp|ut param|
|00001060| 65 74 65 72 73 2c 20 73 | 6f 20 79 6f 75 27 6c 6c |eters, s|o you'll|
|00001070| 20 68 61 76 65 20 74 6f | 20 74 69 64 79 20 75 70 | have to| tidy up|
|00001080| 20 61 66 74 65 72 20 69 | 74 2e 0d 42 75 74 20 69 | after i|t..But i|
|00001090| 74 20 63 61 6e 20 73 61 | 76 65 20 79 6f 75 20 61 |t can sa|ve you a|
|000010a0| 20 6c 6f 74 20 6f 66 20 | 74 69 6d 65 20 69 66 20 | lot of |time if |
|000010b0| 74 68 65 20 6d 61 6e 20 | 70 61 67 65 73 20 66 6f |the man |pages fo|
|000010c0| 72 20 61 20 6c 69 62 72 | 61 72 79 20 61 72 65 0d |r a libr|ary are.|
|000010d0| 72 65 61 73 6f 6e 61 62 | 6c 79 20 77 65 6c 6c 20 |reasonab|ly well |
|000010e0| 66 6f 72 6d 65 64 2e 0d | 0d 49 66 20 79 6f 75 20 |formed..|.If you |
|000010f0| 68 61 70 70 65 6e 20 74 | 6f 20 68 61 76 65 20 63 |happen t|o have c|
|00001100| 75 72 73 65 73 20 6f 6e | 20 79 6f 75 72 20 6d 61 |urses on| your ma|
|00001110| 63 68 69 6e 65 2c 20 79 | 6f 75 20 6d 69 67 68 74 |chine, y|ou might|
|00001120| 20 74 72 79 20 63 6f 6d | 70 69 6c 69 6e 67 0d 61 | try com|piling.a|
|00001130| 20 63 6f 70 79 20 6f 66 | 20 63 75 72 73 65 70 65 | copy of| cursepe|
|00001140| 72 6c 2e 20 20 54 68 65 | 20 22 70 61 67 65 72 22 |rl. The| "pager"|
|00001150| 20 70 72 6f 67 72 61 6d | 20 69 6e 20 74 68 69 73 | program| in this|
|00001160| 20 64 69 72 65 63 74 6f | 72 79 20 69 73 20 61 20 | directo|ry is a |
|00001170| 72 75 64 69 6d 65 6e 74 | 61 72 79 0d 73 74 61 72 |rudiment|ary.star|
|00001180| 74 20 6f 6e 20 77 72 69 | 74 69 6e 67 20 61 20 70 |t on wri|ting a p|
|00001190| 61 67 65 72 2d 2d 64 6f | 6e 27 74 20 62 65 6c 69 |ager--do|n't beli|
|000011a0| 65 76 65 20 74 68 65 20 | 68 65 6c 70 20 6d 65 73 |eve the |help mes|
|000011b0| 73 61 67 65 2c 20 77 68 | 69 63 68 20 69 73 20 73 |sage, wh|ich is s|
|000011c0| 74 6f 6c 65 6e 0d 66 72 | 6f 6d 20 74 68 65 20 6c |tolen.fr|om the l|
|000011d0| 65 73 73 20 70 72 6f 67 | 72 61 6d 2e 0d 0d 55 73 |ess prog|ram...Us|
|000011e0| 65 72 2d 64 65 66 69 6e | 65 64 20 73 75 62 72 6f |er-defin|ed subro|
|000011f0| 75 74 69 6e 65 73 20 6d | 61 79 20 6e 6f 74 20 63 |utines m|ay not c|
|00001200| 75 72 72 65 6e 74 6c 79 | 20 62 65 20 63 61 6c 6c |urrently| be call|
|00001210| 65 64 20 61 73 20 61 20 | 73 69 67 6e 61 6c 20 68 |ed as a |signal h|
|00001220| 61 6e 64 6c 65 72 2c 0d | 74 68 6f 75 67 68 20 61 |andler,.|though a|
|00001230| 20 73 69 67 6e 61 6c 20 | 68 61 6e 64 6c 65 72 20 | signal |handler |
|00001240| 6d 61 79 20 69 74 73 65 | 6c 66 20 63 61 6c 6c 20 |may itse|lf call |
|00001250| 61 20 75 73 65 72 2d 64 | 65 66 69 6e 65 64 20 73 |a user-d|efined s|
|00001260| 75 62 72 6f 75 74 69 6e | 65 2e 0d 0d 54 68 65 72 |ubroutin|e...Ther|
|00001270| 65 20 61 72 65 20 6e 6f | 77 20 67 6c 75 65 20 72 |e are no|w glue r|
|00001280| 6f 75 74 69 6e 65 73 20 | 74 6f 20 63 61 6c 6c 20 |outines |to call |
|00001290| 62 61 63 6b 20 66 72 6f | 6d 20 43 20 69 6e 74 6f |back fro|m C into|
|000012a0| 20 50 65 72 6c 2e 20 20 | 49 6e 20 75 73 65 72 73 | Perl. |In users|
|000012b0| 75 62 2e 63 0d 69 6e 20 | 74 68 69 73 20 64 69 72 |ub.c.in |this dir|
|000012c0| 65 63 74 6f 72 79 2c 20 | 79 6f 75 27 6c 6c 20 66 |ectory, |you'll f|
|000012d0| 69 6e 64 20 63 61 6c 6c | 62 61 63 6b 28 29 20 61 |ind call|back() a|
|000012e0| 6e 64 20 63 61 6c 6c 76 | 28 29 2e 20 20 54 68 65 |nd callv|(). The|
|000012f0| 20 63 61 6c 6c 62 61 63 | 6b 28 29 0d 72 6f 75 74 | callbac|k().rout|
|00001300| 69 6e 65 20 70 72 65 73 | 75 6d 65 73 20 74 68 61 |ine pres|umes tha|
|00001310| 74 20 61 6e 79 20 61 72 | 67 75 6d 65 6e 74 73 20 |t any ar|guments |
|00001320| 74 6f 20 70 61 73 73 20 | 74 6f 20 74 68 65 20 50 |to pass |to the P|
|00001330| 65 72 6c 20 73 75 62 72 | 6f 75 74 69 6e 65 0d 68 |erl subr|outine.h|
|00001340| 61 76 65 20 61 6c 72 65 | 61 64 79 20 62 65 65 6e |ave alre|ady been|
|00001350| 20 70 75 73 68 65 64 20 | 6f 6e 74 6f 20 74 68 65 | pushed |onto the|
|00001360| 20 50 65 72 6c 20 73 74 | 61 63 6b 2e 20 20 54 68 | Perl st|ack. Th|
|00001370| 65 20 63 61 6c 6c 76 28 | 29 20 72 6f 75 74 69 6e |e callv(|) routin|
|00001380| 65 0d 69 73 20 61 20 77 | 72 61 70 70 65 72 20 74 |e.is a w|rapper t|
|00001390| 68 61 74 20 70 75 73 68 | 65 73 20 61 6e 20 61 72 |hat push|es an ar|
|000013a0| 67 76 2d 73 74 79 6c 65 | 20 61 72 72 61 79 20 6f |gv-style| array o|
|000013b0| 66 20 73 74 72 69 6e 67 | 73 20 6f 6e 74 6f 20 74 |f string|s onto t|
|000013c0| 68 65 0d 73 74 61 63 6b | 20 66 6f 72 20 79 6f 75 |he.stack| for you|
|000013d0| 2c 20 61 6e 64 20 74 68 | 65 6e 20 63 61 6c 6c 73 |, and th|en calls|
|000013e0| 20 63 61 6c 6c 62 61 63 | 6b 28 29 2e 20 20 42 65 | callbac|k(). Be|
|000013f0| 20 73 75 72 65 20 74 6f | 20 72 65 63 68 65 63 6b | sure to| recheck|
|00001400| 20 79 6f 75 72 0d 73 74 | 61 63 6b 20 70 6f 69 6e | your.st|ack poin|
|00001410| 74 65 72 20 61 66 74 65 | 72 20 72 65 74 75 72 6e |ter afte|r return|
|00001420| 69 6e 67 20 66 72 6f 6d | 20 74 68 65 73 65 20 72 |ing from| these r|
|00001430| 6f 75 74 69 6e 65 2c 20 | 73 69 6e 63 65 20 74 68 |outine, |since th|
|00001440| 65 20 50 65 72 6c 20 63 | 6f 64 65 0d 6d 61 79 20 |e Perl c|ode.may |
|00001450| 68 61 76 65 20 72 65 61 | 6c 6c 6f 63 61 74 65 64 |have rea|llocated|
|00001460| 20 69 74 2e 0d 00 00 00 | 00 00 00 00 00 00 00 00 | it.....|........|
|00001470| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001480| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00001490| ca 3d 5c 7a ea 47 d3 0f | 6d 0b 59 e0 3c db de 89 |.=\z.G..|m.Y.<...|
|000014a0| 45 8f 07 9c ac dd 3d 07 | a0 77 8f a1 15 fa 69 e3 |E.....=.|.w....i.|
|000014b0| 06 52 45 41 44 4d 45 da | 02 00 02 00 54 45 58 54 |.README.|....TEXT|
|000014c0| 4d 50 53 20 00 00 00 00 | 00 00 00 00 00 00 05 13 |MPS ....|........|
|000014d0| 02 00 54 45 58 54 4d 50 | 53 20 00 00 00 00 00 00 |..TEXTMP|S ......|
|000014e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014f0| 00 00 a8 ee 29 a4 00 00 | 13 e5 00 00 01 ac 1c d5 |....)...|........|
|00001500| 6e fe 71 c8 de 7e 71 4b | 1e f0 b5 f7 84 2e d6 ca |n.q..~qK|........|
|00001510| 67 95 08 00 00 42 00 00 | 90 00 09 00 06 00 00 00 |g....B..|........|
|00001520| 00 00 00 00 00 00 40 68 | 70 09 88 00 68 77 87 88 |......@h|p...hw..|
|00001530| a0 80 99 80 07 00 05 76 | 76 89 75 00 67 66 6a 65 |.......v|v.u.gfje|
|00001540| 66 8a a8 98 98 00 05 76 | 64 76 75 a8 66 55 60 45 |f......v|dvu.fU`E|
|00001550| 55 77 87 a7 07 00 0a a0 | 20 00 01 33 45 56 66 67 |Uw......| ..3EVfg|
|00001560| 77 88 98 99 00 00 00 07 | 00 00 00 00 00 00 00 00 |w.......|........|
|00001570| 00 99 0a 00 00 00 00 0a | 07 1a 32 34 44 55 75 68 |........|..24DUuh|
|00001580| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00001590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015a0| 00 00 00 00 00 00 00 06 | 00 03 00 78 00 18 01 dd |........|...x....|
|000015b0| 02 3d 00 78 00 18 01 dd | 02 3d a8 ee 29 a3 00 00 |.=.x....|.=..)...|
|000015c0| 0e dd 00 00 0e f2 00 00 | 00 00 01 00 00 00 00 1e |........|........|
|000015d0| 00 78 00 18 01 dd 02 3d | 00 78 00 18 01 dd 02 3d |.x.....=|.x.....=|
|000015e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015f0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 3c |.....n..|.n...>.<|
|00001600| 16 80 18 fa 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |........|.>..MPSR|
|00001610| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00001620| 03 f0 ff ff 00 00 00 4c | 00 3e 6d 88 00 00 00 00 |.......L|.>m.....|
|00001630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001660| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001670| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+