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
| SHell self-extracting ARchive (archive/shar)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| 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)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 73 6f 75 72 63 65 73 | 2e 75 6e 69 78 0a 46 72 |.sources|.unix.Fr|
|00000020| 6f 6d 3a 20 64 62 65 6c | 6c 40 70 64 61 63 74 2e |om: dbel|l@pdact.|
|00000030| 70 64 2e 6e 65 63 69 73 | 61 2e 6f 7a 2e 61 75 20 |pd.necis|a.oz.au |
|00000040| 28 44 61 76 69 64 20 49 | 2e 20 42 65 6c 6c 29 0a |(David I|. Bell).|
|00000050| 53 75 62 6a 65 63 74 3a | 20 76 32 36 69 30 32 39 |Subject:| v26i029|
|00000060| 3a 20 43 41 4c 43 20 2d | 20 41 6e 20 61 72 62 69 |: CALC -| An arbi|
|00000070| 74 72 61 72 79 20 70 72 | 65 63 69 73 69 6f 6e 20 |trary pr|ecision |
|00000080| 43 2d 6c 69 6b 65 20 63 | 61 6c 63 75 6c 61 74 6f |C-like c|alculato|
|00000090| 72 2c 20 50 61 72 74 30 | 33 2f 32 31 0a 53 65 6e |r, Part0|3/21.Sen|
|000000a0| 64 65 72 3a 20 75 6e 69 | 78 2d 73 6f 75 72 63 65 |der: uni|x-source|
|000000b0| 73 2d 6d 6f 64 65 72 61 | 74 6f 72 40 70 61 2e 64 |s-modera|tor@pa.d|
|000000c0| 65 63 2e 63 6f 6d 0a 41 | 70 70 72 6f 76 65 64 3a |ec.com.A|pproved:|
|000000d0| 20 76 69 78 69 65 40 70 | 61 2e 64 65 63 2e 63 6f | vixie@p|a.dec.co|
|000000e0| 6d 0a 0a 53 75 62 6d 69 | 74 74 65 64 2d 42 79 3a |m..Submi|tted-By:|
|000000f0| 20 64 62 65 6c 6c 40 70 | 64 61 63 74 2e 70 64 2e | dbell@p|dact.pd.|
|00000100| 6e 65 63 69 73 61 2e 6f | 7a 2e 61 75 20 28 44 61 |necisa.o|z.au (Da|
|00000110| 76 69 64 20 49 2e 20 42 | 65 6c 6c 29 0a 50 6f 73 |vid I. B|ell).Pos|
|00000120| 74 69 6e 67 2d 4e 75 6d | 62 65 72 3a 20 56 6f 6c |ting-Num|ber: Vol|
|00000130| 75 6d 65 20 32 36 2c 20 | 49 73 73 75 65 20 32 39 |ume 26, |Issue 29|
|00000140| 0a 41 72 63 68 69 76 65 | 2d 4e 61 6d 65 3a 20 63 |.Archive|-Name: c|
|00000150| 61 6c 63 2f 70 61 72 74 | 30 33 0a 0a 23 21 20 2f |alc/part|03..#! /|
|00000160| 62 69 6e 2f 73 68 0a 23 | 20 54 68 69 73 20 69 73 |bin/sh.#| This is|
|00000170| 20 61 20 73 68 65 6c 6c | 20 61 72 63 68 69 76 65 | a shell| archive|
|00000180| 2e 20 20 52 65 6d 6f 76 | 65 20 61 6e 79 74 68 69 |. Remov|e anythi|
|00000190| 6e 67 20 62 65 66 6f 72 | 65 20 74 68 69 73 20 6c |ng befor|e this l|
|000001a0| 69 6e 65 2c 20 74 68 65 | 6e 20 75 6e 70 61 63 6b |ine, the|n unpack|
|000001b0| 0a 23 20 69 74 20 62 79 | 20 73 61 76 69 6e 67 20 |.# it by| saving |
|000001c0| 69 74 20 69 6e 74 6f 20 | 61 20 66 69 6c 65 20 61 |it into |a file a|
|000001d0| 6e 64 20 74 79 70 69 6e | 67 20 22 73 68 20 66 69 |nd typin|g "sh fi|
|000001e0| 6c 65 22 2e 20 20 54 6f | 20 6f 76 65 72 77 72 69 |le". To| overwri|
|000001f0| 74 65 20 65 78 69 73 74 | 69 6e 67 0a 23 20 66 69 |te exist|ing.# fi|
|00000200| 6c 65 73 2c 20 74 79 70 | 65 20 22 73 68 20 66 69 |les, typ|e "sh fi|
|00000210| 6c 65 20 2d 63 22 2e 20 | 20 59 6f 75 20 63 61 6e |le -c". | You can|
|00000220| 20 61 6c 73 6f 20 66 65 | 65 64 20 74 68 69 73 20 | also fe|ed this |
|00000230| 61 73 20 73 74 61 6e 64 | 61 72 64 20 69 6e 70 75 |as stand|ard inpu|
|00000240| 74 20 76 69 61 0a 23 20 | 75 6e 73 68 61 72 2c 20 |t via.# |unshar, |
|00000250| 6f 72 20 62 79 20 74 79 | 70 69 6e 67 20 22 73 68 |or by ty|ping "sh|
|00000260| 20 3c 66 69 6c 65 22 2c | 20 65 2e 67 2e 2e 20 20 | <file",| e.g.. |
|00000270| 49 66 20 74 68 69 73 20 | 61 72 63 68 69 76 65 20 |If this |archive |
|00000280| 69 73 20 63 6f 6d 70 6c | 65 74 65 2c 20 79 6f 75 |is compl|ete, you|
|00000290| 0a 23 20 77 69 6c 6c 20 | 73 65 65 20 74 68 65 20 |.# will |see the |
|000002a0| 66 6f 6c 6c 6f 77 69 6e | 67 20 6d 65 73 73 61 67 |followin|g messag|
|000002b0| 65 20 61 74 20 74 68 65 | 20 65 6e 64 3a 0a 23 09 |e at the| end:.#.|
|000002c0| 09 22 45 6e 64 20 6f 66 | 20 61 72 63 68 69 76 65 |."End of| archive|
|000002d0| 20 33 20 28 6f 66 20 32 | 31 29 2e 22 0a 23 20 43 | 3 (of 2|1).".# C|
|000002e0| 6f 6e 74 65 6e 74 73 3a | 20 20 63 61 6c 63 2e 31 |ontents:| calc.1|
|000002f0| 20 63 6f 6e 66 69 67 2e | 63 20 68 65 6c 70 2f 6f | config.|c help/o|
|00000300| 62 6a 20 6c 69 62 2f 65 | 6c 6c 69 70 2e 63 61 6c |bj lib/e|llip.cal|
|00000310| 20 6c 69 62 2f 73 75 72 | 64 2e 63 61 6c 0a 23 20 | lib/sur|d.cal.# |
|00000320| 20 20 6f 70 63 6f 64 65 | 73 2e 68 20 73 74 72 69 | opcode|s.h stri|
|00000330| 6e 67 2e 63 20 74 6f 6b | 65 6e 2e 68 0a 23 20 57 |ng.c tok|en.h.# W|
|00000340| 72 61 70 70 65 64 20 62 | 79 20 64 62 65 6c 6c 40 |rapped b|y dbell@|
|00000350| 65 6c 6d 20 6f 6e 20 54 | 75 65 20 46 65 62 20 32 |elm on T|ue Feb 2|
|00000360| 35 20 31 35 3a 32 30 3a | 35 36 20 31 39 39 32 0a |5 15:20:|56 1992.|
|00000370| 50 41 54 48 3d 2f 62 69 | 6e 3a 2f 75 73 72 2f 62 |PATH=/bi|n:/usr/b|
|00000380| 69 6e 3a 2f 75 73 72 2f | 75 63 62 20 3b 20 65 78 |in:/usr/|ucb ; ex|
|00000390| 70 6f 72 74 20 50 41 54 | 48 0a 69 66 20 74 65 73 |port PAT|H.if tes|
|000003a0| 74 20 2d 66 20 27 63 61 | 6c 63 2e 31 27 20 2d 61 |t -f 'ca|lc.1' -a|
|000003b0| 20 22 24 7b 31 7d 22 20 | 21 3d 20 22 2d 63 22 20 | "${1}" |!= "-c" |
|000003c0| 3b 20 74 68 65 6e 20 0a | 20 20 65 63 68 6f 20 73 |; then .| echo s|
|000003d0| 68 61 72 3a 20 57 69 6c | 6c 20 6e 6f 74 20 63 6c |har: Wil|l not cl|
|000003e0| 6f 62 62 65 72 20 65 78 | 69 73 74 69 6e 67 20 66 |obber ex|isting f|
|000003f0| 69 6c 65 20 5c 22 27 63 | 61 6c 63 2e 31 27 5c 22 |ile \"'c|alc.1'\"|
|00000400| 0a 65 6c 73 65 0a 65 63 | 68 6f 20 73 68 61 72 3a |.else.ec|ho shar:|
|00000410| 20 45 78 74 72 61 63 74 | 69 6e 67 20 5c 22 27 63 | Extract|ing \"'c|
|00000420| 61 6c 63 2e 31 27 5c 22 | 20 5c 28 36 34 39 34 20 |alc.1'\"| \(6494 |
|00000430| 63 68 61 72 61 63 74 65 | 72 73 5c 29 0a 73 65 64 |characte|rs\).sed|
|00000440| 20 22 73 2f 5e 58 2f 2f | 22 20 3e 27 63 61 6c 63 | "s/^X//|" >'calc|
|00000450| 2e 31 27 20 3c 3c 27 45 | 4e 44 5f 4f 46 5f 46 49 |.1' <<'E|ND_OF_FI|
|00000460| 4c 45 27 0a 58 2e 5c 22 | 0a 58 2e 5c 22 20 43 6f |LE'.X.\"|.X.\" Co|
|00000470| 70 79 72 69 67 68 74 20 | 28 63 29 20 31 39 39 32 |pyright |(c) 1992|
|00000480| 20 44 61 76 69 64 20 49 | 2e 20 42 65 6c 6c 20 61 | David I|. Bell a|
|00000490| 6e 64 20 4c 61 6e 64 6f | 6e 20 43 75 72 74 20 4e |nd Lando|n Curt N|
|000004a0| 6f 6c 6c 0a 58 2e 5c 22 | 20 50 65 72 6d 69 73 73 |oll.X.\"| Permiss|
|000004b0| 69 6f 6e 20 69 73 20 67 | 72 61 6e 74 65 64 20 74 |ion is g|ranted t|
|000004c0| 6f 20 75 73 65 2c 20 64 | 69 73 74 72 69 62 75 74 |o use, d|istribut|
|000004d0| 65 2c 20 6f 72 20 6d 6f | 64 69 66 79 20 74 68 69 |e, or mo|dify thi|
|000004e0| 73 20 73 6f 75 72 63 65 | 2c 0a 58 2e 5c 22 20 70 |s source|,.X.\" p|
|000004f0| 72 6f 76 69 64 65 64 20 | 74 68 61 74 20 74 68 69 |rovided |that thi|
|00000500| 73 20 63 6f 70 79 72 69 | 67 68 74 20 6e 6f 74 69 |s copyri|ght noti|
|00000510| 63 65 20 72 65 6d 61 69 | 6e 73 20 69 6e 74 61 63 |ce remai|ns intac|
|00000520| 74 2e 0a 58 2e 5c 22 0a | 58 2e 5c 22 20 63 61 6c |t..X.\".|X.\" cal|
|00000530| 63 75 6c 61 74 6f 72 20 | 62 79 20 44 61 76 69 64 |culator |by David|
|00000540| 20 49 2e 20 42 65 6c 6c | 0a 58 2e 5c 22 20 6d 61 | I. Bell|.X.\" ma|
|00000550| 6e 20 70 61 67 65 20 62 | 79 20 4c 61 6e 64 6f 6e |n page b|y Landon|
|00000560| 20 4e 6f 6c 6c 0a 58 2e | 54 48 20 63 61 6c 63 20 | Noll.X.|TH calc |
|00000570| 31 20 22 5e 2e 2e 5e 22 | 20 22 32 32 6a 75 6e 39 |1 "^..^"| "22jun9|
|00000580| 31 22 0a 58 2e 53 48 20 | 4e 41 4d 45 0a 58 5c 66 |1".X.SH |NAME.X\f|
|00000590| 34 63 61 6c 63 5c 66 31 | 20 5c 2d 20 61 72 62 69 |4calc\f1| \- arbi|
|000005a0| 74 72 61 72 79 20 70 72 | 65 63 69 73 69 6f 6e 20 |trary pr|ecision |
|000005b0| 63 61 6c 63 75 6c 61 74 | 6f 72 0a 58 2e 53 48 20 |calculat|or.X.SH |
|000005c0| 53 59 4e 4f 50 53 49 53 | 0a 58 5c 66 34 63 61 6c |SYNOPSIS|.X\f4cal|
|000005d0| 63 5c 66 50 0a 58 5b 0a | 58 5c 66 34 5c 2d 68 5c |c\fP.X[.|X\f4\-h\|
|000005e0| 66 50 0a 58 5d 20 5b 0a | 58 5c 66 34 5c 2d 71 5c |fP.X] [.|X\f4\-q\|
|000005f0| 66 50 0a 58 5d 20 5b 0a | 58 2e 49 20 63 61 6c 63 |fP.X] [.|X.I calc|
|00000600| 5f 63 6d 64 0a 58 5c 26 | 2e 5c 7c 2e 5c 7c 2e 0a |_cmd.X\&|.\|.\|..|
|00000610| 58 5d 0a 58 2e 53 48 20 | 44 45 53 43 52 49 50 54 |X].X.SH |DESCRIPT|
|00000620| 49 4f 4e 0a 58 5c 26 0a | 58 2e 62 72 0a 58 43 41 |ION.X\&.|X.br.XCA|
|00000630| 4c 43 20 43 4f 4d 4d 41 | 4e 44 20 4c 49 4e 45 0a |LC COMMA|ND LINE.|
|00000640| 58 2e 50 50 0a 58 2e 54 | 50 0a 58 5c 66 34 20 5c |X.PP.X.T|P.X\f4 \|
|00000650| 2d 68 5c 66 31 0a 58 50 | 72 69 6e 74 20 61 20 68 |-h\f1.XP|rint a h|
|00000660| 65 6c 70 20 6d 65 73 73 | 61 67 65 2e 0a 58 54 68 |elp mess|age..XTh|
|00000670| 69 73 20 6f 70 74 69 6f | 6e 20 69 6d 70 6c 69 65 |is optio|n implie|
|00000680| 73 20 5c 66 34 20 5c 2d | 71 5c 66 31 2e 0a 58 54 |s \f4 \-|q\f1..XT|
|00000690| 68 69 73 20 69 73 20 65 | 71 75 69 76 61 6c 65 6e |his is e|quivalen|
|000006a0| 74 20 74 6f 20 74 68 65 | 20 63 61 6c 63 20 63 6f |t to the| calc co|
|000006b0| 6d 6d 61 6e 64 20 5c 66 | 34 68 65 6c 70 20 68 65 |mmand \f|4help he|
|000006c0| 6c 70 5c 66 50 2e 0a 58 | 2e 54 50 0a 58 5c 66 34 |lp\fP..X|.TP.X\f4|
|000006d0| 20 5c 2d 71 5c 66 31 0a | 58 44 69 73 61 62 6c 65 | \-q\f1.|XDisable|
|000006e0| 20 74 68 65 20 75 73 65 | 20 6f 66 20 74 68 65 20 | the use| of the |
|000006f0| 5c 66 34 24 43 41 4c 43 | 52 43 5c 66 31 20 73 74 |\f4$CALC|RC\f1 st|
|00000700| 61 72 74 75 70 20 6c 69 | 62 72 61 72 79 20 73 63 |artup li|brary sc|
|00000710| 72 69 70 74 73 2e 0a 58 | 2e 50 50 0a 58 57 69 74 |ripts..X|.PP.XWit|
|00000720| 68 6f 75 74 20 5c 66 34 | 63 61 6c 63 5f 63 6d 64 |hout \f4|calc_cmd|
|00000730| 5c 66 50 73 2c 20 5c 66 | 34 63 61 6c 63 5c 66 50 |\fPs, \f|4calc\fP|
|00000740| 20 6f 70 65 72 61 74 65 | 73 20 69 6e 74 65 72 61 | operate|s intera|
|00000750| 63 74 69 76 65 6c 79 2e | 0a 58 49 66 20 6f 6e 65 |ctively.|.XIf one|
|00000760| 20 6f 72 20 6d 6f 72 65 | 20 5c 66 34 63 61 6c 63 | or more| \f4calc|
|00000770| 5f 63 6d 64 5c 66 50 73 | 20 61 72 65 20 67 69 76 |_cmd\fPs| are giv|
|00000780| 65 6e 20 6f 6e 20 74 68 | 65 20 63 6f 6d 6d 61 6e |en on th|e comman|
|00000790| 64 20 6c 69 6e 65 2c 0a | 58 5c 66 34 63 61 6c 63 |d line,.|X\f4calc|
|000007a0| 5c 66 50 20 77 69 6c 6c | 20 65 78 65 63 75 74 65 |\fP will| execute|
|000007b0| 20 74 68 65 6d 20 61 6e | 64 20 65 78 69 74 2e 0a | them an|d exit..|
|000007c0| 58 2e 50 50 0a 58 4e 6f | 72 6d 61 6c 6c 79 20 6f |X.PP.XNo|rmally o|
|000007d0| 6e 20 73 74 61 72 74 75 | 70 2c 20 5c 66 34 63 61 |n startu|p, \f4ca|
|000007e0| 6c 63 5c 66 50 20 61 74 | 74 65 6d 70 74 73 20 74 |lc\fP at|tempts t|
|000007f0| 6f 20 65 78 65 63 75 74 | 65 20 61 20 63 6f 6c 6c |o execut|e a coll|
|00000800| 65 63 74 69 6f 6e 20 0a | 58 6f 66 20 6c 69 62 72 |ection .|Xof libr|
|00000810| 61 72 79 20 73 63 72 69 | 70 74 73 2e 0a 58 54 68 |ary scri|pts..XTh|
|00000820| 65 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 20 76 61 |e enviro|nment va|
|00000830| 72 69 61 62 6c 65 20 5c | 66 34 24 43 41 4c 43 52 |riable \|f4$CALCR|
|00000840| 43 5c 66 31 20 28 69 66 | 20 6e 6f 6e 2d 65 78 69 |C\f1 (if| non-exi|
|00000850| 73 74 65 6e 74 20 74 68 | 65 6e 0a 58 61 20 63 6f |stent th|en.Xa co|
|00000860| 6d 70 69 6c 65 64 20 69 | 6e 20 76 61 6c 75 65 29 |mpiled i|n value)|
|00000870| 20 63 6f 6e 74 61 69 6e | 73 20 61 20 5c 66 34 3a | contain|s a \f4:|
|00000880| 5c 66 50 20 73 65 70 61 | 72 61 74 65 64 20 6c 69 |\fP sepa|rated li|
|00000890| 73 74 20 6f 66 0a 58 73 | 74 61 72 74 75 70 20 6c |st of.Xs|tartup l|
|000008a0| 69 62 72 61 72 79 20 73 | 63 72 69 70 74 73 2e 0a |ibrary s|cripts..|
|000008b0| 58 4e 6f 20 65 72 72 6f | 72 20 63 6f 6e 64 69 74 |XNo erro|r condit|
|000008c0| 69 6f 6e 73 20 61 72 65 | 20 70 72 6f 64 75 63 65 |ions are| produce|
|000008d0| 64 20 69 66 20 74 68 65 | 73 65 20 73 74 61 72 74 |d if the|se start|
|000008e0| 75 70 20 6c 69 62 72 61 | 72 79 20 73 63 72 69 70 |up libra|ry scrip|
|000008f0| 74 73 0a 58 61 72 65 20 | 6e 6f 74 20 66 6f 75 6e |ts.Xare |not foun|
|00000900| 64 2e 0a 58 2e 50 50 0a | 58 46 69 6c 65 6e 61 6d |d..X.PP.|XFilenam|
|00000910| 65 73 20 61 72 65 20 73 | 75 62 6a 65 63 74 20 74 |es are s|ubject t|
|00000920| 6f 20 60 60 7e 27 27 20 | 65 78 70 61 6e 73 69 6f |o ``~'' |expansio|
|00000930| 6e 20 28 73 65 65 20 62 | 65 6c 6f 77 29 2e 0a 58 |n (see b|elow)..X|
|00000940| 54 68 65 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 20 |The envi|ronment |
|00000950| 76 61 72 69 61 62 6c 65 | 20 5c 66 34 24 43 41 4c |variable| \f4$CAL|
|00000960| 43 50 41 54 48 5c 66 50 | 20 28 69 66 20 6e 6f 6e |CPATH\fP| (if non|
|00000970| 2d 65 78 69 73 74 65 6e | 74 20 74 68 65 6e 0a 58 |-existen|t then.X|
|00000980| 61 20 63 6f 6d 70 69 6c | 65 64 20 69 6e 20 76 61 |a compil|ed in va|
|00000990| 6c 75 65 29 20 63 6f 6e | 74 61 69 6e 73 20 61 20 |lue) con|tains a |
|000009a0| 5c 66 34 3a 5c 66 50 20 | 73 65 70 61 72 61 74 65 |\f4:\fP |separate|
|000009b0| 64 20 6c 69 73 74 20 6f | 66 20 73 65 61 72 63 68 |d list o|f search|
|000009c0| 0a 58 64 69 72 65 63 74 | 6f 72 69 65 73 2e 0a 58 |.Xdirect|ories..X|
|000009d0| 49 66 20 61 20 66 69 6c | 65 20 64 6f 65 73 20 6e |If a fil|e does n|
|000009e0| 6f 74 20 62 65 67 69 6e | 20 77 69 74 68 20 5c 66 |ot begin| with \f|
|000009f0| 34 2f 5c 66 50 2c 20 5c | 66 34 7e 5c 66 50 20 6f |4/\fP, \|f4~\fP o|
|00000a00| 72 20 5c 66 34 2e 2f 5c | 66 50 2c 0a 58 74 68 65 |r \f4./\|fP,.Xthe|
|00000a10| 6e 20 69 74 20 69 73 20 | 73 65 61 72 63 68 65 64 |n it is |searched|
|00000a20| 20 66 6f 72 20 75 6e 64 | 65 72 20 65 61 63 68 20 | for und|er each |
|00000a30| 64 69 72 65 63 74 6f 72 | 79 20 6c 69 73 74 65 64 |director|y listed|
|00000a40| 20 69 6e 20 74 68 65 20 | 5c 66 34 24 43 41 4c 43 | in the |\f4$CALC|
|00000a50| 50 41 54 48 5c 66 50 2e | 0a 58 49 74 20 69 73 20 |PATH\fP.|.XIt is |
|00000a60| 61 6e 20 65 72 72 6f 72 | 20 69 66 20 6e 6f 20 73 |an error| if no s|
|00000a70| 75 63 68 20 72 65 61 64 | 61 62 6c 65 20 66 69 6c |uch read|able fil|
|00000a80| 65 20 69 73 20 66 6f 75 | 6e 64 2e 0a 58 2e 50 50 |e is fou|nd..X.PP|
|00000a90| 0a 58 46 6f 72 20 6d 6f | 72 65 20 69 6e 66 6f 72 |.XFor mo|re infor|
|00000aa0| 6d 61 74 69 6f 6e 20 75 | 73 65 20 74 68 65 20 66 |mation u|se the f|
|00000ab0| 6f 6c 6c 6f 77 69 6e 67 | 20 63 61 6c 63 20 63 6f |ollowing| calc co|
|00000ac0| 6d 6d 61 6e 64 73 3a 0a | 58 2e 50 50 0a 58 2e 69 |mmands:.|X.PP.X.i|
|00000ad0| 6e 20 31 2e 30 69 0a 58 | 68 65 6c 70 20 75 73 61 |n 1.0i.X|help usa|
|00000ae0| 67 65 0a 58 2e 62 72 0a | 58 68 65 6c 70 20 68 65 |ge.X.br.|Xhelp he|
|00000af0| 6c 70 0a 58 2e 62 72 0a | 58 68 65 6c 70 20 65 6e |lp.X.br.|Xhelp en|
|00000b00| 76 69 72 6f 6e 6d 65 6e | 74 0a 58 2e 69 6e 20 2d |vironmen|t.X.in -|
|00000b10| 31 2e 30 69 0a 58 2e 50 | 50 0a 58 4f 56 45 52 56 |1.0i.X.P|P.XOVERV|
|00000b20| 49 45 57 0a 58 2e 50 50 | 0a 58 5c 66 34 43 61 6c |IEW.X.PP|.X\f4Cal|
|00000b30| 63 5c 66 50 20 69 73 20 | 61 72 62 69 74 72 61 72 |c\fP is |arbitrar|
|00000b40| 79 20 70 72 65 63 69 73 | 69 6f 6e 20 61 72 69 74 |y precis|ion arit|
|00000b50| 68 6d 65 74 69 63 20 73 | 79 73 74 65 6d 20 74 68 |hmetic s|ystem th|
|00000b60| 61 74 20 75 73 65 73 20 | 0a 58 61 20 43 2d 6c 69 |at uses |.Xa C-li|
|00000b70| 6b 65 20 6c 61 6e 67 75 | 61 67 65 2e 0a 58 5c 66 |ke langu|age..X\f|
|00000b80| 34 43 61 6c 63 5c 66 50 | 20 69 73 20 75 73 65 66 |4Calc\fP| is usef|
|00000b90| 75 6c 20 61 73 20 61 20 | 63 61 6c 63 75 6c 61 74 |ul as a |calculat|
|00000ba0| 6f 72 2c 20 61 6e 20 61 | 6c 67 6f 72 69 74 68 6d |or, an a|lgorithm|
|00000bb0| 20 70 72 6f 74 6f 74 79 | 70 65 64 0a 58 61 6e 64 | prototy|ped.Xand|
|00000bc0| 20 61 73 20 61 20 6d 61 | 74 68 65 6d 61 74 69 63 | as a ma|thematic|
|00000bd0| 61 6c 20 72 65 73 65 61 | 72 63 68 20 74 6f 6f 6c |al resea|rch tool|
|00000be0| 2e 0a 58 4d 6f 72 65 20 | 69 6d 70 6f 72 74 61 6e |..XMore |importan|
|00000bf0| 74 6c 79 2c 20 5c 66 34 | 63 61 6c 63 5c 66 50 20 |tly, \f4|calc\fP |
|00000c00| 70 72 6f 76 69 64 65 73 | 20 6f 6e 65 20 77 69 74 |provides| one wit|
|00000c10| 68 20 61 20 6d 61 63 68 | 69 6e 65 0a 58 69 6e 64 |h a mach|ine.Xind|
|00000c20| 65 70 65 6e 64 65 6e 74 | 20 6d 65 61 6e 73 20 6f |ependent| means o|
|00000c30| 66 20 63 6f 6d 70 75 74 | 61 74 69 6f 6e 2e 0a 58 |f comput|ation..X|
|00000c40| 2e 50 50 0a 58 41 20 72 | 69 63 68 20 73 65 74 20 |.PP.XA r|ich set |
|00000c50| 6f 66 20 62 75 69 6c 74 | 69 6e 20 66 75 6e 63 74 |of built|in funct|
|00000c60| 69 6f 6e 73 20 69 73 20 | 70 72 6f 76 69 64 65 64 |ions is |provided|
|00000c70| 2e 0a 58 41 20 6e 75 6d | 62 65 72 20 6f 66 20 6c |..XA num|ber of l|
|00000c80| 69 62 72 61 72 79 20 73 | 63 72 69 70 74 73 20 61 |ibrary s|cripts a|
|00000c90| 72 65 20 61 6c 73 6f 20 | 70 72 6f 76 69 64 65 64 |re also |provided|
|00000ca0| 20 62 65 63 61 75 73 65 | 20 74 68 65 79 20 61 72 | because| they ar|
|00000cb0| 65 0a 58 75 73 65 66 75 | 6c 20 61 6e 64 20 74 6f |e.Xusefu|l and to|
|00000cc0| 20 73 65 72 76 65 20 61 | 73 20 65 78 61 6d 70 6c | serve a|s exampl|
|00000cd0| 65 73 20 6f 66 20 74 68 | 65 20 5c 66 34 63 61 6c |es of th|e \f4cal|
|00000ce0| 63 5c 66 50 20 6c 61 6e | 67 75 61 67 65 2e 0a 58 |c\fP lan|guage..X|
|00000cf0| 2e 50 50 0a 58 4f 6e 65 | 20 6d 61 79 20 66 75 72 |.PP.XOne| may fur|
|00000d00| 74 68 65 72 20 65 78 74 | 65 6e 64 20 5c 66 34 63 |ther ext|end \f4c|
|00000d10| 61 6c 63 5c 66 50 20 70 | 65 72 6d 69 74 73 20 66 |alc\fP p|ermits f|
|00000d20| 75 72 74 68 65 72 20 74 | 68 72 75 20 74 6f 0a 58 |urther t|hru to.X|
|00000d30| 75 73 65 20 6f 66 20 63 | 61 6c 63 20 6c 69 62 72 |use of c|alc libr|
|00000d40| 61 72 79 20 73 63 72 69 | 70 74 73 2e 0a 58 57 72 |ary scri|pts..XWr|
|00000d50| 69 74 74 65 6e 20 69 6e | 20 74 68 65 20 73 61 6d |itten in| the sam|
|00000d60| 65 20 43 2d 6c 69 6b 65 | 20 6c 61 6e 67 75 61 67 |e C-like| languag|
|00000d70| 65 2c 20 6c 69 62 72 61 | 72 79 20 73 63 72 69 70 |e, libra|ry scrip|
|00000d80| 74 73 20 6d 61 79 20 62 | 65 0a 58 72 65 61 64 20 |ts may b|e.Xread |
|00000d90| 69 6e 20 61 6e 64 20 65 | 78 65 63 75 74 65 64 20 |in and e|xecuted |
|00000da0| 64 75 72 69 6e 67 20 61 | 20 5c 66 34 63 61 6c 63 |during a| \f4calc|
|00000db0| 5c 66 50 20 73 65 73 73 | 69 6f 6e 2e 0a 58 2e 50 |\fP sess|ion..X.P|
|00000dc0| 50 0a 58 49 6e 74 65 72 | 6e 61 6c 6c 79 20 63 61 |P.XInter|nally ca|
|00000dd0| 6c 63 20 72 65 70 72 65 | 73 65 6e 74 73 20 6e 75 |lc repre|sents nu|
|00000de0| 6d 65 72 69 63 20 76 61 | 6c 75 65 73 20 61 73 20 |meric va|lues as |
|00000df0| 66 72 61 63 74 69 6f 6e | 73 20 72 65 64 75 63 65 |fraction|s reduce|
|00000e00| 64 20 74 6f 20 74 68 65 | 69 72 0a 58 6c 6f 77 65 |d to the|ir.Xlowe|
|00000e10| 73 74 20 74 65 72 6d 73 | 2e 0a 58 54 68 65 20 6e |st terms|..XThe n|
|00000e20| 75 6d 65 72 61 74 6f 72 | 73 20 61 6e 64 20 64 65 |umerator|s and de|
|00000e30| 6e 6f 6d 69 6e 61 74 6f | 72 73 20 6f 66 20 74 68 |nominato|rs of th|
|00000e40| 65 73 65 20 66 61 63 74 | 69 6f 6e 73 20 6d 61 79 |ese fact|ions may|
|00000e50| 20 67 72 6f 77 20 74 6f | 0a 58 61 72 62 69 74 72 | grow to|.Xarbitr|
|00000e60| 61 72 69 6c 79 20 6c 61 | 72 67 65 20 76 61 6c 75 |arily la|rge valu|
|00000e70| 65 73 2e 0a 58 4e 75 6d | 65 72 69 63 20 76 61 6c |es..XNum|eric val|
|00000e80| 75 65 73 20 72 65 61 64 | 20 69 6e 20 61 72 65 20 |ues read| in are |
|00000e90| 61 75 74 6f 6d 61 74 69 | 63 61 6c 6c 79 20 63 6f |automati|cally co|
|00000ea0| 6e 76 65 72 74 65 64 20 | 69 6e 74 6f 20 72 61 74 |nverted |into rat|
|00000eb0| 69 6f 6e 61 6c 73 2e 0a | 58 54 68 65 20 75 73 65 |ionals..|XThe use|
|00000ec0| 72 20 6e 65 65 64 20 6e | 6f 74 20 62 65 20 61 77 |r need n|ot be aw|
|00000ed0| 61 72 65 20 6f 66 20 74 | 68 69 73 20 69 6e 74 65 |are of t|his inte|
|00000ee0| 72 6e 61 6c 20 72 65 70 | 72 65 73 65 6e 74 61 74 |rnal rep|resentat|
|00000ef0| 69 6f 6e 2e 0a 58 2e 50 | 50 0a 58 46 6f 72 20 6d |ion..X.P|P.XFor m|
|00000f00| 6f 72 65 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |ore info|rmation |
|00000f10| 75 73 65 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |use the |followin|
|00000f20| 67 20 63 61 6c 63 20 63 | 6f 6d 6d 61 6e 64 73 3a |g calc c|ommands:|
|00000f30| 0a 58 2e 50 50 0a 58 2e | 69 6e 20 31 2e 30 69 0a |.X.PP.X.|in 1.0i.|
|00000f40| 58 68 65 6c 70 20 69 6e | 74 72 6f 0a 58 2e 62 72 |Xhelp in|tro.X.br|
|00000f50| 0a 58 68 65 6c 70 20 62 | 75 69 6c 74 69 6e 0a 58 |.Xhelp b|uiltin.X|
|00000f60| 2e 62 72 0a 58 68 65 6c | 70 20 73 74 64 6c 69 62 |.br.Xhel|p stdlib|
|00000f70| 0a 58 2e 62 72 0a 58 68 | 65 6c 70 20 64 65 66 69 |.X.br.Xh|elp defi|
|00000f80| 6e 65 0a 58 2e 62 72 0a | 58 73 68 6f 77 20 62 75 |ne.X.br.|Xshow bu|
|00000f90| 69 6c 74 69 6e 73 0a 58 | 2e 62 72 0a 58 73 68 6f |iltins.X|.br.Xsho|
|00000fa0| 77 20 66 75 6e 63 74 69 | 6f 6e 73 0a 58 2e 69 6e |w functi|ons.X.in|
|00000fb0| 20 2d 31 2e 30 69 0a 58 | 2e 50 50 0a 58 44 41 54 | -1.0i.X|.PP.XDAT|
|00000fc0| 41 20 54 59 50 45 53 0a | 58 2e 50 50 0a 58 46 75 |A TYPES.|X.PP.XFu|
|00000fd0| 6e 64 61 6d 65 6e 74 61 | 6c 20 62 75 69 6c 74 69 |ndamenta|l builti|
|00000fe0| 6e 20 64 61 74 61 20 74 | 79 70 65 73 20 69 6e 63 |n data t|ypes inc|
|00000ff0| 6c 75 64 65 20 69 6e 74 | 65 67 65 72 73 2c 20 72 |lude int|egers, r|
|00001000| 65 61 6c 20 6e 75 6d 62 | 65 72 73 2c 20 0a 58 72 |eal numb|ers, .Xr|
|00001010| 61 74 69 6f 6e 61 6c 20 | 6e 75 6d 62 65 72 73 2c |ational |numbers,|
|00001020| 20 63 6f 6d 70 6c 65 78 | 20 6e 75 6d 62 65 72 73 | complex| numbers|
|00001030| 20 61 6e 64 20 73 74 72 | 69 6e 67 73 2e 0a 58 2e | and str|ings..X.|
|00001040| 50 50 0a 58 42 79 20 75 | 73 65 20 6f 66 20 61 6e |PP.XBy u|se of an|
|00001050| 20 6f 62 6a 65 63 74 2c | 20 6f 6e 65 20 6d 61 79 | object,| one may|
|00001060| 20 64 65 66 69 6e 65 20 | 61 6e 20 61 72 62 69 74 | define |an arbit|
|00001070| 72 61 72 69 6c 79 20 63 | 6f 6d 70 6c 65 78 0a 58 |rarily c|omplex.X|
|00001080| 64 61 74 61 20 74 79 70 | 65 73 2e 0a 58 4f 6e 65 |data typ|es..XOne|
|00001090| 20 6d 61 79 20 64 65 66 | 69 6e 65 20 68 6f 77 20 | may def|ine how |
|000010a0| 73 75 63 68 20 6f 62 6a | 65 63 74 73 20 62 65 68 |such obj|ects beh|
|000010b0| 61 76 65 20 61 20 77 69 | 64 65 20 72 61 6e 67 65 |ave a wi|de range|
|000010c0| 20 6f 66 0a 58 6f 70 65 | 72 61 74 69 6f 6e 73 20 | of.Xope|rations |
|000010d0| 73 75 63 68 20 61 73 20 | 61 64 64 69 74 69 6f 6e |such as |addition|
|000010e0| 2c 20 73 75 62 74 72 61 | 63 74 69 6f 6e 2c 0a 58 |, subtra|ction,.X|
|000010f0| 6d 75 6c 74 69 70 6c 69 | 63 61 74 69 6f 6e 2c 20 |multipli|cation, |
|00001100| 64 69 76 69 73 69 6f 6e | 2c 20 6e 65 67 61 74 69 |division|, negati|
|00001110| 6f 6e 2c 20 73 71 75 61 | 72 69 6e 67 2c 20 6d 6f |on, squa|ring, mo|
|00001120| 64 75 6c 75 73 2c 0a 58 | 72 6f 75 6e 64 69 6e 67 |dulus,.X|rounding|
|00001130| 2c 20 65 78 70 6f 6e 65 | 6e 74 69 61 74 69 6f 6e |, expone|ntiation|
|00001140| 2c 20 65 71 75 61 6c 69 | 74 79 2c 20 63 6f 6d 70 |, equali|ty, comp|
|00001150| 61 72 69 73 6f 6e 2c 20 | 70 72 69 6e 74 69 6e 67 |arison, |printing|
|00001160| 0a 58 61 6e 64 20 73 6f | 20 6f 6e 2e 0a 58 2e 50 |.Xand so| on..X.P|
|00001170| 50 0a 58 46 6f 72 20 6d | 6f 72 65 20 69 6e 66 6f |P.XFor m|ore info|
|00001180| 72 6d 61 74 69 6f 6e 20 | 75 73 65 20 74 68 65 20 |rmation |use the |
|00001190| 66 6f 6c 6c 6f 77 69 6e | 67 20 63 61 6c 63 20 63 |followin|g calc c|
|000011a0| 6f 6d 6d 61 6e 64 73 3a | 0a 58 2e 50 50 0a 58 2e |ommands:|.X.PP.X.|
|000011b0| 69 6e 20 31 2e 30 69 0a | 58 68 65 6c 70 20 74 79 |in 1.0i.|Xhelp ty|
|000011c0| 70 65 73 0a 58 2e 62 72 | 0a 58 68 65 6c 70 20 6f |pes.X.br|.Xhelp o|
|000011d0| 62 6a 0a 58 2e 62 72 0a | 58 73 68 6f 77 20 6f 62 |bj.X.br.|Xshow ob|
|000011e0| 6a 66 75 6e 63 73 0a 58 | 2e 69 6e 20 2d 31 2e 30 |jfuncs.X|.in -1.0|
|000011f0| 69 0a 58 2e 50 50 0a 58 | 56 41 52 49 41 42 4c 45 |i.X.PP.X|VARIABLE|
|00001200| 53 0a 58 2e 50 50 0a 58 | 56 61 72 69 61 62 6c 65 |S.X.PP.X|Variable|
|00001210| 73 20 69 6e 20 5c 66 34 | 63 61 6c 63 5c 66 50 20 |s in \f4|calc\fP |
|00001220| 61 72 65 20 74 79 70 65 | 6c 65 73 73 2e 0a 58 49 |are type|less..XI|
|00001230| 6e 20 6f 74 68 65 72 20 | 77 6f 72 64 73 2c 20 74 |n other |words, t|
|00001240| 68 65 20 66 75 6e 64 61 | 6d 65 6e 74 61 6c 20 74 |he funda|mental t|
|00001250| 79 70 65 20 6f 66 20 61 | 20 76 61 72 69 61 62 6c |ype of a| variabl|
|00001260| 65 20 69 73 20 64 65 74 | 65 72 6d 69 6e 65 64 20 |e is det|ermined |
|00001270| 62 79 20 69 74 73 20 63 | 6f 6e 74 65 6e 74 2e 0a |by its c|ontent..|
|00001280| 58 42 65 66 6f 72 65 20 | 76 61 72 69 61 62 6c 65 |XBefore |variable|
|00001290| 20 69 73 20 61 73 73 69 | 67 6e 65 64 20 61 20 76 | is assi|gned a v|
|000012a0| 61 6c 75 65 20 69 73 20 | 6f 66 20 74 79 70 65 20 |alue is |of type |
|000012b0| 60 60 6e 75 6c 6c 27 27 | 2e 0a 58 2e 50 50 0a 58 |``null''|..X.PP.X|
|000012c0| 54 68 65 20 73 63 6f 70 | 65 20 6f 66 20 61 20 76 |The scop|e of a v|
|000012d0| 61 72 69 61 62 6c 65 20 | 6d 61 79 20 62 65 20 67 |ariable |may be g|
|000012e0| 6c 6f 62 61 6c 2c 20 6f | 72 20 6f 6e 6c 79 20 61 |lobal, o|r only a|
|000012f0| 20 6c 6f 63 61 6c 20 74 | 6f 20 61 20 70 72 6f 63 | local t|o a proc|
|00001300| 65 64 75 72 65 2e 0a 58 | 56 61 6c 75 65 73 20 6d |edure..X|Values m|
|00001310| 61 79 20 62 65 20 67 72 | 6f 75 70 65 64 20 74 6f |ay be gr|ouped to|
|00001320| 67 65 74 68 65 72 20 69 | 6e 20 61 20 6d 61 74 72 |gether i|n a matr|
|00001330| 69 78 2c 20 6f 72 20 69 | 6e 74 6f 20 61 0a 58 61 |ix, or i|nto a.Xa|
|00001340| 20 6c 69 73 74 20 74 68 | 61 74 20 70 65 72 6d 69 | list th|at permi|
|00001350| 74 73 20 73 74 61 63 6b | 20 61 6e 64 20 71 75 65 |ts stack| and que|
|00001360| 75 65 20 73 74 79 6c 65 | 20 6f 70 65 72 61 74 69 |ue style| operati|
|00001370| 6f 6e 73 2e 0a 58 2e 50 | 50 0a 58 46 6f 72 20 6d |ons..X.P|P.XFor m|
|00001380| 6f 72 65 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |ore info|rmation |
|00001390| 75 73 65 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |use the |followin|
|000013a0| 67 20 63 61 6c 63 20 63 | 6f 6d 6d 61 6e 64 73 3a |g calc c|ommands:|
|000013b0| 0a 58 2e 50 50 0a 58 2e | 69 6e 20 31 2e 30 69 0a |.X.PP.X.|in 1.0i.|
|000013c0| 58 68 65 6c 70 20 76 61 | 72 69 61 62 6c 65 0a 58 |Xhelp va|riable.X|
|000013d0| 2e 62 72 0a 58 68 65 6c | 70 20 6d 61 74 0a 58 2e |.br.Xhel|p mat.X.|
|000013e0| 62 72 0a 58 68 65 6c 70 | 20 6c 69 73 74 0a 58 2e |br.Xhelp| list.X.|
|000013f0| 62 72 0a 58 73 68 6f 77 | 20 67 6c 6f 62 61 6c 73 |br.Xshow| globals|
|00001400| 0a 58 2e 69 6e 20 2d 31 | 2e 30 69 0a 58 2e 50 50 |.X.in -1|.0i.X.PP|
|00001410| 0a 58 49 4e 50 55 54 2f | 4f 55 54 50 55 54 0a 58 |.XINPUT/|OUTPUT.X|
|00001420| 2e 50 50 0a 58 41 20 6c | 65 61 64 69 6e 67 20 60 |.PP.XA l|eading `|
|00001430| 60 30 78 27 27 20 69 6d | 70 6c 69 65 73 20 61 20 |`0x'' im|plies a |
|00001440| 68 65 78 61 64 65 63 69 | 6d 61 6c 20 76 61 6c 75 |hexadeci|mal valu|
|00001450| 65 2c 0a 58 61 20 6c 65 | 61 64 69 6e 67 20 60 60 |e,.Xa le|ading ``|
|00001460| 30 62 27 27 20 69 6d 70 | 6c 69 65 73 20 61 20 62 |0b'' imp|lies a b|
|00001470| 69 6e 61 72 79 20 76 61 | 6c 75 65 2c 0a 58 61 6e |inary va|lue,.Xan|
|00001480| 64 20 61 20 60 60 30 27 | 27 20 66 6f 6c 6c 6f 77 |d a ``0'|' follow|
|00001490| 65 64 20 62 79 20 61 20 | 64 69 67 69 74 20 69 6d |ed by a |digit im|
|000014a0| 70 6c 69 65 73 20 61 6e | 20 6f 63 74 61 6c 20 76 |plies an| octal v|
|000014b0| 61 6c 75 65 2e 0a 58 43 | 6f 6d 70 6c 65 78 20 6e |alue..XC|omplex n|
|000014c0| 75 6d 62 65 72 73 20 61 | 72 65 20 69 6e 64 69 63 |umbers a|re indic|
|000014d0| 61 74 65 64 20 62 79 20 | 61 20 74 72 61 69 6c 69 |ated by |a traili|
|000014e0| 6e 67 20 60 60 69 27 27 | 20 73 75 63 68 20 61 73 |ng ``i''| such as|
|000014f0| 20 69 6e 20 60 60 33 2b | 34 69 27 27 2e 0a 58 53 | in ``3+|4i''..XS|
|00001500| 74 72 69 6e 67 73 20 6d | 61 79 20 62 65 20 64 65 |trings m|ay be de|
|00001510| 6c 69 6d 69 74 65 64 20 | 62 79 20 65 69 74 68 65 |limited |by eithe|
|00001520| 72 20 61 20 70 61 69 72 | 20 6f 66 20 73 69 6e 67 |r a pair| of sing|
|00001530| 6c 65 20 6f 72 20 64 6f | 75 62 6c 65 20 71 75 6f |le or do|uble quo|
|00001540| 74 65 73 2e 0a 58 42 79 | 20 64 65 66 61 75 6c 74 |tes..XBy| default|
|00001550| 2c 20 5c 66 34 63 61 6c | 63 5c 66 50 20 70 72 69 |, \f4cal|c\fP pri|
|00001560| 6e 74 73 20 76 61 6c 75 | 65 73 20 61 73 20 69 66 |nts valu|es as if|
|00001570| 20 74 68 65 79 20 77 65 | 72 65 20 66 6c 6f 61 74 | they we|re float|
|00001580| 69 6e 67 20 70 6f 69 6e | 74 20 6e 75 6d 62 65 72 |ing poin|t number|
|00001590| 73 2e 0a 58 4f 6e 65 20 | 6d 61 79 20 63 68 61 6e |s..XOne |may chan|
|000015a0| 67 65 20 74 68 65 20 64 | 65 66 61 75 6c 74 20 74 |ge the d|efault t|
|000015b0| 6f 20 70 72 69 6e 74 20 | 76 61 6c 75 65 73 20 69 |o print |values i|
|000015c0| 6e 20 61 20 6e 75 6d 62 | 65 72 20 6f 66 20 6d 6f |n a numb|er of mo|
|000015d0| 64 65 73 0a 58 69 6e 63 | 6c 75 64 69 6e 67 20 66 |des.Xinc|luding f|
|000015e0| 72 61 63 74 69 6f 6e 73 | 2c 20 69 6e 74 65 67 65 |ractions|, intege|
|000015f0| 72 73 20 61 6e 64 20 65 | 78 70 6f 6e 65 6e 74 69 |rs and e|xponenti|
|00001600| 61 6c 73 2e 0a 58 2e 50 | 50 0a 58 41 20 6e 75 6d |als..X.P|P.XA num|
|00001610| 62 65 72 20 6f 66 20 73 | 74 64 69 6f 2d 6c 69 6b |ber of s|tdio-lik|
|00001620| 65 20 66 69 6c 65 20 49 | 2f 4f 20 6f 70 65 72 61 |e file I|/O opera|
|00001630| 74 69 6f 6e 73 20 61 72 | 65 20 70 72 6f 76 69 64 |tions ar|e provid|
|00001640| 65 64 2e 0a 58 4f 6e 65 | 20 6d 61 79 20 6f 70 65 |ed..XOne| may ope|
|00001650| 6e 2c 20 72 65 61 64 2c | 20 77 72 69 74 65 2c 20 |n, read,| write, |
|00001660| 73 65 65 6b 20 61 6e 64 | 20 63 6c 6f 73 65 20 66 |seek and| close f|
|00001670| 69 6c 65 73 2e 0a 58 46 | 69 6c 65 6e 61 6d 65 73 |iles..XF|ilenames|
|00001680| 20 61 72 65 20 73 75 62 | 6a 65 63 74 20 74 6f 20 | are sub|ject to |
|00001690| 60 60 5c 7e 27 27 20 65 | 78 70 61 6e 73 69 6f 6e |``\~'' e|xpansion|
|000016a0| 20 74 6f 20 68 6f 6d 65 | 20 64 69 72 65 63 74 6f | to home| directo|
|000016b0| 72 69 65 73 0a 58 69 6e | 20 61 20 77 61 79 20 73 |ries.Xin| a way s|
|000016c0| 69 6d 69 6c 61 72 20 74 | 6f 20 74 68 61 74 20 6f |imilar t|o that o|
|000016d0| 66 20 74 68 65 20 4b 6f | 72 6e 20 6f 72 20 43 2d |f the Ko|rn or C-|
|000016e0| 53 68 65 6c 6c 2e 0a 58 | 2e 50 50 0a 58 46 6f 72 |Shell..X|.PP.XFor|
|000016f0| 20 65 78 61 6d 70 6c 65 | 3a 0a 58 2e 50 50 0a 58 | example|:.X.PP.X|
|00001700| 2e 69 6e 20 31 2e 30 69 | 0a 58 7e 2f 2e 63 61 6c |.in 1.0i|.X~/.cal|
|00001710| 63 72 63 0a 58 2e 62 72 | 0a 58 7e 63 68 6f 6e 67 |crc.X.br|.X~chong|
|00001720| 6f 2f 6c 69 62 2f 66 66 | 74 5f 6d 75 6c 74 69 70 |o/lib/ff|t_multip|
|00001730| 6c 79 2e 63 61 6c 0a 58 | 2e 69 6e 20 2d 31 2e 30 |ly.cal.X|.in -1.0|
|00001740| 69 0a 58 2e 50 50 0a 58 | 46 6f 72 20 6d 6f 72 65 |i.X.PP.X|For more|
|00001750| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 75 73 65 | informa|tion use|
|00001760| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 63 | the fol|lowing c|
|00001770| 61 6c 63 20 63 6f 6d 6d | 61 6e 64 3a 0a 58 2e 50 |alc comm|and:.X.P|
|00001780| 50 0a 58 2e 69 6e 20 31 | 2e 30 69 0a 58 68 65 6c |P.X.in 1|.0i.Xhel|
|00001790| 70 20 66 69 6c 65 0a 58 | 2e 69 6e 20 2d 31 2e 30 |p file.X|.in -1.0|
|000017a0| 69 0a 58 2e 50 50 0a 58 | 43 41 4c 43 20 4c 41 4e |i.X.PP.X|CALC LAN|
|000017b0| 47 55 41 47 45 0a 58 2e | 50 50 0a 58 54 68 65 20 |GUAGE.X.|PP.XThe |
|000017c0| 5c 66 34 63 61 6c 63 5c | 66 50 20 6c 61 6e 67 75 |\f4calc\|fP langu|
|000017d0| 61 67 65 20 69 73 20 61 | 20 43 2d 6c 69 6b 65 20 |age is a| C-like |
|000017e0| 6c 61 6e 67 75 61 67 65 | 2e 0a 58 54 68 65 20 6c |language|..XThe l|
|000017f0| 61 6e 67 75 61 67 65 20 | 69 6e 63 6c 75 64 65 73 |anguage |includes|
|00001800| 20 63 6f 6d 6d 61 6e 64 | 73 20 73 75 63 68 20 61 | command|s such a|
|00001810| 73 20 76 61 72 69 61 62 | 6c 65 20 64 65 63 6c 61 |s variab|le decla|
|00001820| 72 61 74 69 6f 6e 73 2c | 20 0a 58 65 78 70 72 65 |rations,| .Xexpre|
|00001830| 73 73 69 6f 6e 73 2c 20 | 74 65 73 74 73 2c 20 6c |ssions, |tests, l|
|00001840| 61 62 65 6c 73 2c 20 6c | 6f 6f 70 73 2c 20 66 69 |abels, l|oops, fi|
|00001850| 6c 65 20 6f 70 65 72 61 | 74 69 6f 6e 73 2c 20 66 |le opera|tions, f|
|00001860| 75 6e 63 74 69 6f 6e 20 | 63 61 6c 6c 73 2e 0a 58 |unction |calls..X|
|00001870| 54 68 65 73 65 20 63 6f | 6d 6d 61 6e 64 73 20 61 |These co|mmands a|
|00001880| 72 65 20 76 65 72 79 20 | 73 69 6d 69 6c 61 72 20 |re very |similar |
|00001890| 74 6f 20 74 68 65 69 72 | 20 63 6f 75 6e 74 65 72 |to their| counter|
|000018a0| 70 61 72 74 73 20 69 6e | 20 43 2e 0a 58 2e 50 50 |parts in| C..X.PP|
|000018b0| 0a 58 54 68 65 20 6c 61 | 6e 67 75 61 67 65 20 61 |.XThe la|nguage a|
|000018c0| 6c 73 6f 20 69 6e 63 6c | 75 64 65 20 61 20 6e 75 |lso incl|ude a nu|
|000018d0| 6d 62 65 72 20 6f 66 20 | 63 6f 6d 6d 61 6e 64 73 |mber of |commands|
|000018e0| 20 70 61 72 74 69 63 75 | 6c 61 72 0a 58 74 6f 20 | particu|lar.Xto |
|000018f0| 5c 66 34 63 61 6c 63 5c | 66 50 20 69 74 73 65 6c |\f4calc\|fP itsel|
|00001900| 66 2e 0a 58 54 68 65 73 | 65 20 69 6e 63 6c 75 64 |f..XThes|e includ|
|00001910| 65 20 63 6f 6d 6d 61 6e | 64 73 20 73 75 63 68 20 |e comman|ds such |
|00001920| 61 73 20 66 75 6e 63 74 | 69 6f 6e 20 64 65 66 69 |as funct|ion defi|
|00001930| 6e 69 74 69 6f 6e 2c 20 | 68 65 6c 70 2c 20 0a 58 |nition, |help, .X|
|00001940| 72 65 61 64 69 6e 67 20 | 69 6e 20 6c 69 62 72 61 |reading |in libra|
|00001950| 72 79 20 73 63 72 69 70 | 74 73 2c 20 64 75 6d 70 |ry scrip|ts, dump|
|00001960| 20 66 69 6c 65 73 20 74 | 6f 20 61 20 66 69 6c 65 | files t|o a file|
|00001970| 2c 20 65 72 72 6f 72 20 | 6e 6f 74 69 66 69 63 61 |, error |notifica|
|00001980| 74 69 6f 6e 2c 20 0a 58 | 63 6f 6e 66 69 67 75 72 |tion, .X|configur|
|00001990| 61 74 69 6f 6e 20 63 6f | 6e 74 72 6f 6c 20 61 6e |ation co|ntrol an|
|000019a0| 64 20 73 74 61 74 75 73 | 2e 0a 58 2e 50 50 0a 58 |d status|..X.PP.X|
|000019b0| 46 6f 72 20 6d 6f 72 65 | 20 69 6e 66 6f 72 6d 61 |For more| informa|
|000019c0| 74 69 6f 6e 20 75 73 65 | 20 74 68 65 20 66 6f 6c |tion use| the fol|
|000019d0| 6c 6f 77 69 6e 67 20 63 | 61 6c 63 20 63 6f 6d 6d |lowing c|alc comm|
|000019e0| 61 6e 64 3a 0a 58 2e 50 | 50 0a 58 2e 69 6e 20 31 |and:.X.P|P.X.in 1|
|000019f0| 2e 30 69 0a 58 68 65 6c | 70 20 63 6f 6d 6d 61 6e |.0i.Xhel|p comman|
|00001a00| 64 0a 58 2e 62 72 0a 58 | 68 65 6c 70 20 73 74 61 |d.X.br.X|help sta|
|00001a10| 74 65 6d 65 6e 74 0a 58 | 2e 62 72 0a 58 68 65 6c |tement.X|.br.Xhel|
|00001a20| 70 20 65 78 70 72 65 73 | 73 69 6f 6e 0a 58 2e 62 |p expres|sion.X.b|
|00001a30| 72 0a 58 68 65 6c 70 20 | 6f 70 65 72 61 74 6f 72 |r.Xhelp |operator|
|00001a40| 0a 58 2e 62 72 0a 58 68 | 65 6c 70 20 63 6f 6e 66 |.X.br.Xh|elp conf|
|00001a50| 69 67 0a 58 2e 69 6e 20 | 2d 31 2e 30 69 0a 58 2e |ig.X.in |-1.0i.X.|
|00001a60| 50 50 0a 58 2e 53 48 20 | 46 49 4c 45 53 0a 58 2e |PP.X.SH |FILES.X.|
|00001a70| 50 44 20 30 0a 58 2e 54 | 50 20 32 30 0a 58 24 7b |PD 0.X.T|P 20.X${|
|00001a80| 4c 49 42 44 49 52 7d 0a | 58 6c 69 62 72 61 72 79 |LIBDIR}.|Xlibrary|
|00001a90| 20 73 63 72 69 70 74 73 | 20 73 68 69 70 70 65 64 | scripts| shipped|
|00001aa0| 20 77 69 74 68 20 63 61 | 6c 63 0a 58 2e 62 72 0a | with ca|lc.X.br.|
|00001ab0| 58 2e 73 70 0a 58 2e 54 | 50 20 32 30 0a 58 24 7b |X.sp.X.T|P 20.X${|
|00001ac0| 4c 49 42 44 49 52 7d 2f | 68 65 6c 70 0a 58 68 65 |LIBDIR}/|help.Xhe|
|00001ad0| 6c 70 20 66 69 6c 65 73 | 0a 58 2e 62 72 0a 58 2e |lp files|.X.br.X.|
|00001ae0| 73 70 0a 58 54 79 70 69 | 63 61 6c 6c 79 20 24 7b |sp.XTypi|cally ${|
|00001af0| 4c 49 42 44 49 52 7d 20 | 69 73 20 2f 75 73 72 2f |LIBDIR} |is /usr/|
|00001b00| 6c 6f 63 61 6c 2f 6c 69 | 62 2f 63 61 6c 63 0a 58 |local/li|b/calc.X|
|00001b10| 2e 73 70 0a 58 2e 53 48 | 20 43 52 45 44 49 54 0a |.sp.X.SH| CREDIT.|
|00001b20| 58 57 72 69 74 74 65 6e | 20 62 79 20 44 61 76 69 |XWritten| by Davi|
|00001b30| 64 20 49 2e 20 42 65 6c | 6c 2e 0a 58 2e 73 70 0a |d I. Bel|l..X.sp.|
|00001b40| 58 54 68 61 6e 6b 73 20 | 66 6f 72 20 73 75 67 67 |XThanks |for sugg|
|00001b50| 65 73 74 69 6f 6e 73 20 | 61 6e 64 20 65 6e 63 6f |estions |and enco|
|00001b60| 75 72 61 67 65 6d 65 6e | 74 20 66 72 6f 6d 20 50 |uragemen|t from P|
|00001b70| 65 74 65 72 20 4d 69 6c | 6c 65 72 2c 0a 58 4e 65 |eter Mil|ler,.XNe|
|00001b80| 69 6c 20 4a 75 73 74 75 | 73 73 6f 6e 2c 20 61 6e |il Justu|sson, an|
|00001b90| 64 20 4c 61 6e 64 6f 6e | 20 4e 6f 6c 6c 2e 0a 58 |d Landon| Noll..X|
|00001ba0| 2e 73 70 0a 58 50 6f 72 | 74 69 6f 6e 73 20 6f 66 |.sp.XPor|tions of|
|00001bb0| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 20 61 72 | this pr|ogram ar|
|00001bc0| 65 20 64 65 72 69 76 65 | 64 20 66 72 6f 6d 20 61 |e derive|d from a|
|00001bd0| 6e 20 65 61 72 6c 69 65 | 72 20 73 65 74 20 6f 66 |n earlie|r set of|
|00001be0| 0a 58 70 75 62 6c 69 63 | 20 64 6f 6d 61 69 6e 20 |.Xpublic| domain |
|00001bf0| 61 72 62 69 74 72 61 72 | 69 6c 79 20 70 72 65 63 |arbitrar|ily prec|
|00001c00| 69 73 69 6f 6e 20 72 6f | 75 74 69 6e 65 73 20 77 |ision ro|utines w|
|00001c10| 68 69 63 68 20 77 61 73 | 20 70 6f 73 74 65 64 0a |hich was| posted.|
|00001c20| 58 74 6f 20 74 68 65 20 | 6e 65 74 20 61 72 6f 75 |Xto the |net arou|
|00001c30| 6e 64 20 31 39 38 34 2e | 20 20 42 79 20 6e 6f 77 |nd 1984.| By now|
|00001c40| 2c 20 74 68 65 72 65 20 | 69 73 20 61 6c 6d 6f 73 |, there |is almos|
|00001c50| 74 20 6e 6f 20 72 65 63 | 6f 67 6e 69 7a 61 62 6c |t no rec|ognizabl|
|00001c60| 65 20 0a 58 63 6f 64 65 | 20 6c 65 66 74 20 66 72 |e .Xcode| left fr|
|00001c70| 6f 6d 20 74 68 61 74 20 | 6f 72 69 67 69 6e 61 6c |om that |original|
|00001c80| 20 73 6f 75 72 63 65 2e | 0a 58 2e 73 70 0a 58 4d | source.|.X.sp.XM|
|00001c90| 6f 73 74 20 6f 66 20 74 | 68 69 73 20 73 6f 75 72 |ost of t|his sour|
|00001ca0| 63 65 20 61 6e 64 20 62 | 69 6e 61 72 79 20 69 73 |ce and b|inary is|
|00001cb0| 3a 0a 58 2e 73 70 0a 58 | 2e 50 50 0a 58 2e 69 6e |:.X.sp.X|.PP.X.in|
|00001cc0| 20 31 2e 30 69 0a 58 43 | 6f 70 79 72 69 67 68 74 | 1.0i.XC|opyright|
|00001cd0| 20 28 63 29 20 31 39 39 | 32 20 44 61 76 69 64 20 | (c) 199|2 David |
|00001ce0| 49 2e 20 42 65 6c 6c 0a | 58 2e 73 70 0a 58 2e 69 |I. Bell.|X.sp.X.i|
|00001cf0| 6e 20 2d 31 2e 30 69 0a | 58 2e 50 50 0a 58 53 6f |n -1.0i.|X.PP.XSo|
|00001d00| 6d 65 20 66 69 6c 65 73 | 20 61 72 65 20 61 20 63 |me files| are a c|
|00001d10| 6f 70 79 72 69 67 68 74 | 65 64 20 44 61 76 69 64 |opyright|ed David|
|00001d20| 20 49 2e 20 42 65 6c 6c | 20 61 6e 64 20 4c 61 6e | I. Bell| and Lan|
|00001d30| 64 6f 6e 20 4e 6f 6c 6c | 2e 0a 58 2e 73 70 0a 58 |don Noll|..X.sp.X|
|00001d40| 50 65 72 6d 69 73 73 69 | 6f 6e 20 69 73 20 67 72 |Permissi|on is gr|
|00001d50| 61 6e 74 65 64 20 74 6f | 20 75 73 65 2c 20 64 69 |anted to| use, di|
|00001d60| 73 74 72 69 62 75 74 65 | 2c 20 6f 72 20 6d 6f 64 |stribute|, or mod|
|00001d70| 69 66 79 20 74 68 69 73 | 20 73 6f 75 72 63 65 2c |ify this| source,|
|00001d80| 0a 58 70 72 6f 76 69 64 | 65 64 20 74 68 61 74 20 |.Xprovid|ed that |
|00001d90| 74 68 69 73 20 63 6f 70 | 79 72 69 67 68 74 20 6e |this cop|yright n|
|00001da0| 6f 74 69 63 65 20 72 65 | 6d 61 69 6e 73 20 69 6e |otice re|mains in|
|00001db0| 74 61 63 74 2e 0a 58 2e | 73 70 0a 58 53 65 6e 64 |tact..X.|sp.XSend|
|00001dc0| 20 63 61 6c 63 20 63 6f | 6d 6d 65 6e 74 73 2c 20 | calc co|mments, |
|00001dd0| 73 75 67 67 65 73 74 69 | 6f 6e 73 2c 20 62 75 67 |suggesti|ons, bug|
|00001de0| 20 66 69 78 65 73 2c 20 | 65 6e 68 61 6e 63 65 6d | fixes, |enhancem|
|00001df0| 65 6e 74 73 0a 58 61 6e | 64 20 69 6e 74 65 72 65 |ents.Xan|d intere|
|00001e00| 73 74 69 6e 67 20 63 61 | 6c 63 20 73 63 72 69 70 |sting ca|lc scrip|
|00001e10| 74 73 20 74 68 61 74 20 | 79 6f 75 20 77 6f 75 6c |ts that |you woul|
|00001e20| 64 20 6c 69 6b 65 20 79 | 6f 75 20 73 65 65 20 69 |d like y|ou see i|
|00001e30| 6e 63 6c 75 64 65 64 20 | 0a 58 69 6e 20 66 75 74 |ncluded |.Xin fut|
|00001e40| 75 72 65 20 64 69 73 74 | 72 69 62 75 74 69 6f 6e |ure dist|ribution|
|00001e50| 73 20 74 6f 3a 0a 58 2e | 73 70 0a 58 2e 50 50 0a |s to:.X.|sp.X.PP.|
|00001e60| 58 2e 69 6e 20 31 2e 30 | 69 0a 58 64 62 65 6c 6c |X.in 1.0|i.Xdbell|
|00001e70| 40 70 64 61 63 74 2e 70 | 64 2e 6e 65 63 69 73 61 |@pdact.p|d.necisa|
|00001e80| 2e 6f 7a 2e 61 75 5c 20 | 5c 20 61 6e 64 5c 20 5c |.oz.au\ |\ and\ \|
|00001e90| 20 63 68 6f 6e 67 6f 40 | 74 6f 61 64 2e 63 6f 6d | chongo@|toad.com|
|00001ea0| 0a 58 2e 73 70 0a 58 2e | 69 6e 20 2d 31 2e 30 69 |.X.sp.X.|in -1.0i|
|00001eb0| 0a 58 2e 50 50 0a 58 2e | 73 70 0a 58 45 6e 6a 6f |.X.PP.X.|sp.XEnjo|
|00001ec0| 79 21 0a 45 4e 44 5f 4f | 46 5f 46 49 4c 45 0a 69 |y!.END_O|F_FILE.i|
|00001ed0| 66 20 74 65 73 74 20 36 | 34 39 34 20 2d 6e 65 20 |f test 6|494 -ne |
|00001ee0| 60 77 63 20 2d 63 20 3c | 27 63 61 6c 63 2e 31 27 |`wc -c <|'calc.1'|
|00001ef0| 60 3b 20 74 68 65 6e 0a | 20 20 20 20 65 63 68 6f |`; then.| echo|
|00001f00| 20 73 68 61 72 3a 20 5c | 22 27 63 61 6c 63 2e 31 | shar: \|"'calc.1|
|00001f10| 27 5c 22 20 75 6e 70 61 | 63 6b 65 64 20 77 69 74 |'\" unpa|cked wit|
|00001f20| 68 20 77 72 6f 6e 67 20 | 73 69 7a 65 21 0a 66 69 |h wrong |size!.fi|
|00001f30| 0a 23 20 65 6e 64 20 6f | 66 20 27 63 61 6c 63 2e |.# end o|f 'calc.|
|00001f40| 31 27 0a 66 69 0a 69 66 | 20 74 65 73 74 20 2d 66 |1'.fi.if| test -f|
|00001f50| 20 27 63 6f 6e 66 69 67 | 2e 63 27 20 2d 61 20 22 | 'config|.c' -a "|
|00001f60| 24 7b 31 7d 22 20 21 3d | 20 22 2d 63 22 20 3b 20 |${1}" !=| "-c" ; |
|00001f70| 74 68 65 6e 20 0a 20 20 | 65 63 68 6f 20 73 68 61 |then . |echo sha|
|00001f80| 72 3a 20 57 69 6c 6c 20 | 6e 6f 74 20 63 6c 6f 62 |r: Will |not clob|
|00001f90| 62 65 72 20 65 78 69 73 | 74 69 6e 67 20 66 69 6c |ber exis|ting fil|
|00001fa0| 65 20 5c 22 27 63 6f 6e | 66 69 67 2e 63 27 5c 22 |e \"'con|fig.c'\"|
|00001fb0| 0a 65 6c 73 65 0a 65 63 | 68 6f 20 73 68 61 72 3a |.else.ec|ho shar:|
|00001fc0| 20 45 78 74 72 61 63 74 | 69 6e 67 20 5c 22 27 63 | Extract|ing \"'c|
|00001fd0| 6f 6e 66 69 67 2e 63 27 | 5c 22 20 5c 28 35 38 31 |onfig.c'|\" \(581|
|00001fe0| 31 20 63 68 61 72 61 63 | 74 65 72 73 5c 29 0a 73 |1 charac|ters\).s|
|00001ff0| 65 64 20 22 73 2f 5e 58 | 2f 2f 22 20 3e 27 63 6f |ed "s/^X|//" >'co|
|00002000| 6e 66 69 67 2e 63 27 20 | 3c 3c 27 45 4e 44 5f 4f |nfig.c' |<<'END_O|
|00002010| 46 5f 46 49 4c 45 27 0a | 58 2f 2a 0a 58 20 2a 20 |F_FILE'.|X/*.X * |
|00002020| 43 6f 70 79 72 69 67 68 | 74 20 28 63 29 20 31 39 |Copyrigh|t (c) 19|
|00002030| 39 32 20 44 61 76 69 64 | 20 49 2e 20 42 65 6c 6c |92 David| I. Bell|
|00002040| 0a 58 20 2a 20 50 65 72 | 6d 69 73 73 69 6f 6e 20 |.X * Per|mission |
|00002050| 69 73 20 67 72 61 6e 74 | 65 64 20 74 6f 20 75 73 |is grant|ed to us|
|00002060| 65 2c 20 64 69 73 74 72 | 69 62 75 74 65 2c 20 6f |e, distr|ibute, o|
|00002070| 72 20 6d 6f 64 69 66 79 | 20 74 68 69 73 20 73 6f |r modify| this so|
|00002080| 75 72 63 65 2c 0a 58 20 | 2a 20 70 72 6f 76 69 64 |urce,.X |* provid|
|00002090| 65 64 20 74 68 61 74 20 | 74 68 69 73 20 63 6f 70 |ed that |this cop|
|000020a0| 79 72 69 67 68 74 20 6e | 6f 74 69 63 65 20 72 65 |yright n|otice re|
|000020b0| 6d 61 69 6e 73 20 69 6e | 74 61 63 74 2e 0a 58 20 |mains in|tact..X |
|000020c0| 2a 0a 58 20 2a 20 43 6f | 6e 66 69 67 75 72 61 74 |*.X * Co|nfigurat|
|000020d0| 69 6f 6e 20 72 6f 75 74 | 69 6e 65 73 2e 0a 58 20 |ion rout|ines..X |
|000020e0| 2a 2f 0a 58 0a 58 23 69 | 6e 63 6c 75 64 65 20 22 |*/.X.X#i|nclude "|
|000020f0| 63 61 6c 63 2e 68 22 0a | 58 0a 58 0a 58 2f 2a 0a |calc.h".|X.X.X/*.|
|00002100| 58 20 2a 20 43 6f 6e 66 | 69 67 75 72 61 74 69 6f |X * Conf|iguratio|
|00002110| 6e 20 70 61 72 61 6d 65 | 74 65 72 20 6e 61 6d 65 |n parame|ter name|
|00002120| 20 61 6e 64 20 74 79 70 | 65 2e 0a 58 20 2a 2f 0a | and typ|e..X */.|
|00002130| 58 74 79 70 65 64 65 66 | 20 73 74 72 75 63 74 20 |Xtypedef| struct |
|00002140| 7b 0a 58 09 63 68 61 72 | 20 2a 6e 61 6d 65 3b 09 |{.X.char| *name;.|
|00002150| 2f 2a 20 6e 61 6d 65 20 | 6f 66 20 63 6f 6e 66 69 |/* name |of confi|
|00002160| 67 75 72 61 74 69 6f 6e | 20 73 74 72 69 6e 67 20 |guration| string |
|00002170| 2a 2f 0a 58 09 69 6e 74 | 20 74 79 70 65 3b 09 2f |*/.X.int| type;./|
|00002180| 2a 20 74 79 70 65 20 66 | 6f 72 20 63 6f 6e 66 69 |* type f|or confi|
|00002190| 67 75 72 61 74 69 6f 6e | 20 2a 2f 0a 58 7d 20 43 |guration| */.X} C|
|000021a0| 4f 4e 46 49 47 3b 0a 58 | 0a 58 0a 58 2f 2a 0a 58 |ONFIG;.X|.X.X/*.X|
|000021b0| 20 2a 20 54 61 62 6c 65 | 20 6f 66 20 63 6f 6e 66 | * Table| of conf|
|000021c0| 69 67 75 72 61 74 69 6f | 6e 20 74 79 70 65 73 20 |iguratio|n types |
|000021d0| 74 68 61 74 20 63 61 6e | 20 62 65 20 73 65 74 20 |that can| be set |
|000021e0| 6f 72 20 72 65 61 64 2e | 0a 58 20 2a 2f 0a 58 73 |or read.|.X */.Xs|
|000021f0| 74 61 74 69 63 20 43 4f | 4e 46 49 47 20 63 6f 6e |tatic CO|NFIG con|
|00002200| 66 69 67 73 5b 5d 20 3d | 20 7b 0a 58 09 22 74 72 |figs[] =| {.X."tr|
|00002210| 61 63 65 22 2c 09 43 4f | 4e 46 49 47 5f 54 52 41 |ace",.CO|NFIG_TRA|
|00002220| 43 45 2c 0a 58 09 22 64 | 69 73 70 6c 61 79 22 2c |CE,.X."d|isplay",|
|00002230| 09 43 4f 4e 46 49 47 5f | 44 49 53 50 4c 41 59 2c |.CONFIG_|DISPLAY,|
|00002240| 0a 58 09 22 65 70 73 69 | 6c 6f 6e 22 2c 09 43 4f |.X."epsi|lon",.CO|
|00002250| 4e 46 49 47 5f 45 50 53 | 49 4c 4f 4e 2c 0a 58 09 |NFIG_EPS|ILON,.X.|
|00002260| 22 6d 6f 64 65 22 2c 09 | 09 43 4f 4e 46 49 47 5f |"mode",.|.CONFIG_|
|00002270| 4d 4f 44 45 2c 0a 58 09 | 22 6d 61 78 70 72 69 6e |MODE,.X.|"maxprin|
|00002280| 74 22 2c 09 43 4f 4e 46 | 49 47 5f 4d 41 58 50 52 |t",.CONF|IG_MAXPR|
|00002290| 49 4e 54 2c 0a 58 09 22 | 6d 75 6c 32 22 2c 09 09 |INT,.X."|mul2",..|
|000022a0| 43 4f 4e 46 49 47 5f 4d | 55 4c 32 2c 0a 58 09 22 |CONFIG_M|UL2,.X."|
|000022b0| 73 71 32 22 2c 09 09 43 | 4f 4e 46 49 47 5f 53 51 |sq2",..C|ONFIG_SQ|
|000022c0| 32 2c 0a 58 09 22 70 6f | 77 32 22 2c 09 09 43 4f |2,.X."po|w2",..CO|
|000022d0| 4e 46 49 47 5f 50 4f 57 | 32 2c 0a 58 09 22 72 65 |NFIG_POW|2,.X."re|
|000022e0| 64 63 32 22 2c 09 43 4f | 4e 46 49 47 5f 52 45 44 |dc2",.CO|NFIG_RED|
|000022f0| 43 32 2c 0a 58 09 4e 55 | 4c 4c 2c 09 09 30 0a 58 |C2,.X.NU|LL,..0.X|
|00002300| 7d 3b 0a 58 0a 58 0a 58 | 2f 2a 0a 58 20 2a 20 50 |};.X.X.X|/*.X * P|
|00002310| 6f 73 73 69 62 6c 65 20 | 6f 75 74 70 75 74 20 6d |ossible |output m|
|00002320| 6f 64 65 73 2e 0a 58 20 | 2a 2f 0a 58 73 74 61 74 |odes..X |*/.Xstat|
|00002330| 69 63 20 43 4f 4e 46 49 | 47 20 6d 6f 64 65 73 5b |ic CONFI|G modes[|
|00002340| 5d 20 3d 20 7b 0a 58 09 | 22 66 72 61 63 22 2c 09 |] = {.X.|"frac",.|
|00002350| 09 4d 4f 44 45 5f 46 52 | 41 43 2c 0a 58 09 22 64 |.MODE_FR|AC,.X."d|
|00002360| 65 63 69 6d 61 6c 22 2c | 09 4d 4f 44 45 5f 46 52 |ecimal",|.MODE_FR|
|00002370| 41 43 2c 0a 58 09 22 64 | 65 63 22 2c 09 09 4d 4f |AC,.X."d|ec",..MO|
|00002380| 44 45 5f 46 52 41 43 2c | 0a 58 09 22 69 6e 74 22 |DE_FRAC,|.X."int"|
|00002390| 2c 09 09 4d 4f 44 45 5f | 49 4e 54 2c 0a 58 09 22 |,..MODE_|INT,.X."|
|000023a0| 72 65 61 6c 22 2c 09 09 | 4d 4f 44 45 5f 52 45 41 |real",..|MODE_REA|
|000023b0| 4c 2c 0a 58 09 22 65 78 | 70 22 2c 09 09 4d 4f 44 |L,.X."ex|p",..MOD|
|000023c0| 45 5f 45 58 50 2c 0a 58 | 09 22 68 65 78 61 64 65 |E_EXP,.X|."hexade|
|000023d0| 63 69 6d 61 6c 22 2c 09 | 4d 4f 44 45 5f 48 45 58 |cimal",.|MODE_HEX|
|000023e0| 2c 0a 58 09 22 68 65 78 | 22 2c 09 09 4d 4f 44 45 |,.X."hex|",..MODE|
|000023f0| 5f 48 45 58 2c 0a 58 09 | 22 6f 63 74 61 6c 22 2c |_HEX,.X.|"octal",|
|00002400| 09 4d 4f 44 45 5f 4f 43 | 54 41 4c 2c 0a 58 09 22 |.MODE_OC|TAL,.X."|
|00002410| 6f 63 74 22 2c 09 09 4d | 4f 44 45 5f 4f 43 54 41 |oct",..M|ODE_OCTA|
|00002420| 4c 2c 0a 58 09 22 62 69 | 6e 61 72 79 22 2c 09 4d |L,.X."bi|nary",.M|
|00002430| 4f 44 45 5f 42 49 4e 41 | 52 59 2c 0a 58 09 22 62 |ODE_BINA|RY,.X."b|
|00002440| 69 6e 22 2c 09 09 4d 4f | 44 45 5f 42 49 4e 41 52 |in",..MO|DE_BINAR|
|00002450| 59 2c 0a 58 09 4e 55 4c | 4c 2c 09 09 30 0a 58 7d |Y,.X.NUL|L,..0.X}|
|00002460| 3b 0a 58 0a 58 0a 58 2f | 2a 0a 58 20 2a 20 47 69 |;.X.X.X/|*.X * Gi|
|00002470| 76 65 6e 20 61 20 73 74 | 72 69 6e 67 20 76 61 6c |ven a st|ring val|
|00002480| 75 65 20 77 68 69 63 68 | 20 72 65 70 72 65 73 65 |ue which| represe|
|00002490| 6e 74 73 20 61 20 63 6f | 6e 66 69 67 75 72 61 74 |nts a co|nfigurat|
|000024a0| 69 6f 6e 20 6e 61 6d 65 | 2c 20 72 65 74 75 72 6e |ion name|, return|
|000024b0| 0a 58 20 2a 20 74 68 65 | 20 63 6f 6e 66 69 67 75 |.X * the| configu|
|000024c0| 72 61 74 69 6f 6e 20 74 | 79 70 65 20 66 6f 72 20 |ration t|ype for |
|000024d0| 74 68 61 74 20 73 74 72 | 69 6e 67 2e 20 20 52 65 |that str|ing. Re|
|000024e0| 74 75 72 6e 73 20 6e 65 | 67 61 74 69 76 65 20 74 |turns ne|gative t|
|000024f0| 79 70 65 20 69 66 0a 58 | 20 2a 20 74 68 65 20 73 |ype if.X| * the s|
|00002500| 74 72 69 6e 67 20 69 73 | 20 75 6e 6b 6e 6f 77 6e |tring is| unknown|
|00002510| 2e 0a 58 20 2a 2f 0a 58 | 63 6f 6e 66 69 67 74 79 |..X */.X|configty|
|00002520| 70 65 28 6e 61 6d 65 29 | 0a 58 09 63 68 61 72 20 |pe(name)|.X.char |
|00002530| 2a 6e 61 6d 65 3b 09 09 | 2f 2a 20 63 6f 6e 66 69 |*name;..|/* confi|
|00002540| 67 75 72 61 74 69 6f 6e | 20 6e 61 6d 65 20 2a 2f |guration| name */|
|00002550| 0a 58 7b 0a 58 09 43 4f | 4e 46 49 47 20 2a 63 70 |.X{.X.CO|NFIG *cp|
|00002560| 3b 09 09 2f 2a 20 63 75 | 72 72 65 6e 74 20 63 6f |;../* cu|rrent co|
|00002570| 6e 66 69 67 20 70 6f 69 | 6e 74 65 72 20 2a 2f 0a |nfig poi|nter */.|
|00002580| 58 0a 58 09 66 6f 72 20 | 28 63 70 20 3d 20 63 6f |X.X.for |(cp = co|
|00002590| 6e 66 69 67 73 3b 20 63 | 70 2d 3e 6e 61 6d 65 3b |nfigs; c|p->name;|
|000025a0| 20 63 70 2b 2b 29 20 7b | 0a 58 09 09 69 66 20 28 | cp++) {|.X..if (|
|000025b0| 73 74 72 63 6d 70 28 63 | 70 2d 3e 6e 61 6d 65 2c |strcmp(c|p->name,|
|000025c0| 20 6e 61 6d 65 29 20 3d | 3d 20 30 29 0a 58 09 09 | name) =|= 0).X..|
|000025d0| 09 72 65 74 75 72 6e 20 | 63 70 2d 3e 74 79 70 65 |.return |cp->type|
|000025e0| 3b 0a 58 09 7d 0a 58 09 | 72 65 74 75 72 6e 20 2d |;.X.}.X.|return -|
|000025f0| 31 3b 0a 58 7d 0a 58 0a | 58 0a 58 2f 2a 0a 58 20 |1;.X}.X.|X.X/*.X |
|00002600| 2a 20 47 69 76 65 6e 20 | 74 68 65 20 6e 61 6d 65 |* Given |the name|
|00002610| 20 6f 66 20 61 20 6d 6f | 64 65 2c 20 63 6f 6e 76 | of a mo|de, conv|
|00002620| 65 72 74 20 69 74 20 74 | 6f 20 74 68 65 20 69 6e |ert it t|o the in|
|00002630| 74 65 72 6e 61 6c 20 66 | 6f 72 6d 61 74 2e 0a 58 |ternal f|ormat..X|
|00002640| 20 2a 20 52 65 74 75 72 | 6e 73 20 2d 31 20 69 66 | * Retur|ns -1 if|
|00002650| 20 74 68 65 20 73 74 72 | 69 6e 67 20 69 73 20 75 | the str|ing is u|
|00002660| 6e 6b 6e 6f 77 6e 2e 0a | 58 20 2a 2f 0a 58 73 74 |nknown..|X */.Xst|
|00002670| 61 74 69 63 0a 58 6d 6f | 64 65 74 79 70 65 28 6e |atic.Xmo|detype(n|
|00002680| 61 6d 65 29 0a 58 09 63 | 68 61 72 20 2a 6e 61 6d |ame).X.c|har *nam|
|00002690| 65 3b 09 09 2f 2a 20 6d | 6f 64 65 20 6e 61 6d 65 |e;../* m|ode name|
|000026a0| 20 2a 2f 0a 58 7b 0a 58 | 09 43 4f 4e 46 49 47 20 | */.X{.X|.CONFIG |
|000026b0| 2a 63 70 3b 09 09 2f 2a | 20 63 75 72 72 65 6e 74 |*cp;../*| current|
|000026c0| 20 63 6f 6e 66 69 67 20 | 70 6f 69 6e 74 65 72 20 | config |pointer |
|000026d0| 2a 2f 0a 58 0a 58 09 66 | 6f 72 20 28 63 70 20 3d |*/.X.X.f|or (cp =|
|000026e0| 20 6d 6f 64 65 73 3b 20 | 63 70 2d 3e 6e 61 6d 65 | modes; |cp->name|
|000026f0| 3b 20 63 70 2b 2b 29 20 | 7b 0a 58 09 09 69 66 20 |; cp++) |{.X..if |
|00002700| 28 73 74 72 63 6d 70 28 | 63 70 2d 3e 6e 61 6d 65 |(strcmp(|cp->name|
|00002710| 2c 20 6e 61 6d 65 29 20 | 3d 3d 20 30 29 0a 58 09 |, name) |== 0).X.|
|00002720| 09 09 72 65 74 75 72 6e | 20 63 70 2d 3e 74 79 70 |..return| cp->typ|
|00002730| 65 3b 0a 58 09 7d 0a 58 | 09 72 65 74 75 72 6e 20 |e;.X.}.X|.return |
|00002740| 2d 31 3b 0a 58 7d 0a 58 | 0a 58 0a 58 2f 2a 0a 58 |-1;.X}.X|.X.X/*.X|
|00002750| 20 2a 20 47 69 76 65 6e | 20 74 68 65 20 6d 6f 64 | * Given| the mod|
|00002760| 65 20 74 79 70 65 2c 20 | 63 6f 6e 76 65 72 74 20 |e type, |convert |
|00002770| 69 74 20 74 6f 20 61 20 | 73 74 72 69 6e 67 20 72 |it to a |string r|
|00002780| 65 70 72 65 73 65 6e 74 | 69 6e 67 20 74 68 61 74 |epresent|ing that|
|00002790| 20 6d 6f 64 65 2e 0a 58 | 20 2a 20 57 68 65 72 65 | mode..X| * Where|
|000027a0| 20 74 68 65 72 65 20 61 | 72 65 20 6d 75 6c 74 69 | there a|re multi|
|000027b0| 70 6c 65 20 73 74 72 69 | 6e 67 73 20 72 65 70 72 |ple stri|ngs repr|
|000027c0| 65 73 65 6e 74 69 6e 67 | 20 74 68 65 20 73 61 6d |esenting| the sam|
|000027d0| 65 20 6d 6f 64 65 2c 20 | 74 68 65 20 66 69 72 73 |e mode, |the firs|
|000027e0| 74 0a 58 20 2a 20 6f 6e | 65 20 69 6e 20 74 68 65 |t.X * on|e in the|
|000027f0| 20 74 61 62 6c 65 20 69 | 73 20 75 73 65 64 2e 20 | table i|s used. |
|00002800| 20 52 65 74 75 72 6e 73 | 20 4e 55 4c 4c 20 69 66 | Returns| NULL if|
|00002810| 20 74 68 65 20 6e 6f 64 | 65 20 74 79 70 65 20 69 | the nod|e type i|
|00002820| 73 20 75 6e 6b 6e 6f 77 | 6e 2e 0a 58 20 2a 20 54 |s unknow|n..X * T|
|00002830| 68 65 20 72 65 74 75 72 | 6e 65 64 20 73 74 72 69 |he retur|ned stri|
|00002840| 6e 67 20 63 61 6e 6e 6f | 74 20 62 65 20 6d 6f 64 |ng canno|t be mod|
|00002850| 69 66 69 65 64 2e 0a 58 | 20 2a 2f 0a 58 73 74 61 |ified..X| */.Xsta|
|00002860| 74 69 63 20 63 68 61 72 | 20 2a 0a 58 6d 6f 64 65 |tic char| *.Xmode|
|00002870| 6e 61 6d 65 28 74 79 70 | 65 29 0a 58 7b 0a 58 09 |name(typ|e).X{.X.|
|00002880| 43 4f 4e 46 49 47 20 2a | 63 70 3b 09 09 2f 2a 20 |CONFIG *|cp;../* |
|00002890| 63 75 72 72 65 6e 74 20 | 63 6f 6e 66 69 67 20 70 |current |config p|
|000028a0| 6f 69 6e 74 65 72 20 2a | 2f 0a 58 0a 58 09 66 6f |ointer *|/.X.X.fo|
|000028b0| 72 20 28 63 70 20 3d 20 | 6d 6f 64 65 73 3b 20 63 |r (cp = |modes; c|
|000028c0| 70 2d 3e 6e 61 6d 65 3b | 20 63 70 2b 2b 29 20 7b |p->name;| cp++) {|
|000028d0| 0a 58 09 09 69 66 20 28 | 74 79 70 65 20 3d 3d 20 |.X..if (|type == |
|000028e0| 63 70 2d 3e 74 79 70 65 | 29 0a 58 09 09 09 72 65 |cp->type|).X...re|
|000028f0| 74 75 72 6e 20 63 70 2d | 3e 6e 61 6d 65 3b 0a 58 |turn cp-|>name;.X|
|00002900| 09 7d 0a 58 09 72 65 74 | 75 72 6e 20 4e 55 4c 4c |.}.X.ret|urn NULL|
|00002910| 3b 0a 58 7d 0a 58 0a 58 | 0a 58 2f 2a 0a 58 20 2a |;.X}.X.X|.X/*.X *|
|00002920| 20 53 65 74 20 74 68 65 | 20 73 70 65 63 69 66 69 | Set the| specifi|
|00002930| 65 64 20 63 6f 6e 66 69 | 67 75 72 61 74 69 6f 6e |ed confi|guration|
|00002940| 20 74 79 70 65 20 74 6f | 20 74 68 65 20 73 70 65 | type to| the spe|
|00002950| 63 69 66 69 65 64 20 76 | 61 6c 75 65 2e 0a 58 20 |cified v|alue..X |
|00002960| 2a 20 41 6e 20 65 72 72 | 6f 72 20 69 73 20 67 65 |* An err|or is ge|
|00002970| 6e 65 72 61 74 65 64 20 | 69 66 20 74 68 65 20 74 |nerated |if the t|
|00002980| 79 70 65 20 6e 75 6d 62 | 65 72 20 6f 72 20 76 61 |ype numb|er or va|
|00002990| 6c 75 65 20 69 73 20 69 | 6c 6c 65 67 61 6c 2e 0a |lue is i|llegal..|
|000029a0| 58 20 2a 2f 0a 58 76 6f | 69 64 0a 58 73 65 74 63 |X */.Xvo|id.Xsetc|
|000029b0| 6f 6e 66 69 67 28 74 79 | 70 65 2c 20 76 70 29 0a |onfig(ty|pe, vp).|
|000029c0| 58 09 56 41 4c 55 45 20 | 2a 76 70 3b 0a 58 7b 0a |X.VALUE |*vp;.X{.|
|000029d0| 58 09 4e 55 4d 42 45 52 | 20 2a 71 3b 0a 58 09 6c |X.NUMBER| *q;.X.l|
|000029e0| 6f 6e 67 20 74 65 6d 70 | 3b 0a 58 0a 58 09 73 77 |ong temp|;.X.X.sw|
|000029f0| 69 74 63 68 20 28 74 79 | 70 65 29 20 7b 0a 58 09 |itch (ty|pe) {.X.|
|00002a00| 09 63 61 73 65 20 43 4f | 4e 46 49 47 5f 54 52 41 |.case CO|NFIG_TRA|
|00002a10| 43 45 3a 0a 58 09 09 09 | 69 66 20 28 76 70 2d 3e |CE:.X...|if (vp->|
|00002a20| 76 5f 74 79 70 65 20 21 | 3d 20 56 5f 4e 55 4d 29 |v_type !|= V_NUM)|
|00002a30| 0a 58 09 09 09 09 65 72 | 72 6f 72 28 22 4e 6f 6e |.X....er|ror("Non|
|00002a40| 2d 6e 75 6d 65 72 69 63 | 20 66 6f 72 20 74 72 61 |-numeric| for tra|
|00002a50| 63 65 22 29 3b 0a 58 09 | 09 09 71 20 3d 20 76 70 |ce");.X.|..q = vp|
|00002a60| 2d 3e 76 5f 6e 75 6d 3b | 0a 58 09 09 09 74 65 6d |->v_num;|.X...tem|
|00002a70| 70 20 3d 20 71 74 6f 69 | 28 71 29 3b 0a 58 09 09 |p = qtoi|(q);.X..|
|00002a80| 09 69 66 20 28 71 69 73 | 66 72 61 63 28 71 29 20 |.if (qis|frac(q) |
|00002a90| 7c 7c 20 21 69 73 74 69 | 6e 79 28 71 2d 3e 6e 75 ||| !isti|ny(q->nu|
|00002aa0| 6d 29 20 7c 7c 0a 58 09 | 09 09 09 28 28 75 6e 73 |m) ||.X.|...((uns|
|00002ab0| 69 67 6e 65 64 20 6c 6f | 6e 67 29 20 74 65 6d 70 |igned lo|ng) temp|
|00002ac0| 20 3e 20 54 52 41 43 45 | 5f 4d 41 58 29 29 0a 58 | > TRACE|_MAX)).X|
|00002ad0| 09 09 09 09 09 65 72 72 | 6f 72 28 22 42 61 64 20 |.....err|or("Bad |
|00002ae0| 74 72 61 63 65 20 76 61 | 6c 75 65 22 29 3b 0a 58 |trace va|lue");.X|
|00002af0| 09 09 09 74 72 61 63 65 | 66 6c 61 67 73 20 3d 20 |...trace|flags = |
|00002b00| 28 46 4c 41 47 29 74 65 | 6d 70 3b 0a 58 09 09 09 |(FLAG)te|mp;.X...|
|00002b10| 62 72 65 61 6b 3b 0a 58 | 0a 58 09 09 63 61 73 65 |break;.X|.X..case|
|00002b20| 20 43 4f 4e 46 49 47 5f | 44 49 53 50 4c 41 59 3a | CONFIG_|DISPLAY:|
|00002b30| 0a 58 09 09 09 69 66 20 | 28 76 70 2d 3e 76 5f 74 |.X...if |(vp->v_t|
|00002b40| 79 70 65 20 21 3d 20 56 | 5f 4e 55 4d 29 0a 58 09 |ype != V|_NUM).X.|
|00002b50| 09 09 09 65 72 72 6f 72 | 28 22 4e 6f 6e 2d 6e 75 |...error|("Non-nu|
|00002b60| 6d 65 72 69 63 20 66 6f | 72 20 64 69 73 70 6c 61 |meric fo|r displa|
|00002b70| 79 22 29 3b 0a 58 09 09 | 09 71 20 3d 20 76 70 2d |y");.X..|.q = vp-|
|00002b80| 3e 76 5f 6e 75 6d 3b 0a | 58 09 09 09 74 65 6d 70 |>v_num;.|X...temp|
|00002b90| 20 3d 20 71 74 6f 69 28 | 71 29 3b 0a 58 09 09 09 | = qtoi(|q);.X...|
|00002ba0| 69 66 20 28 71 69 73 66 | 72 61 63 28 71 29 20 7c |if (qisf|rac(q) ||
|00002bb0| 7c 20 71 69 73 6e 65 67 | 28 71 29 20 7c 7c 20 21 || qisneg|(q) || !|
|00002bc0| 69 73 74 69 6e 79 28 71 | 2d 3e 6e 75 6d 29 29 0a |istiny(q|->num)).|
|00002bd0| 58 09 09 09 09 74 65 6d | 70 20 3d 20 2d 31 3b 0a |X....tem|p = -1;.|
|00002be0| 58 09 09 09 73 65 74 64 | 69 67 69 74 73 28 74 65 |X...setd|igits(te|
|00002bf0| 6d 70 29 3b 0a 58 09 09 | 09 62 72 65 61 6b 3b 0a |mp);.X..|.break;.|
|00002c00| 58 0a 58 09 09 63 61 73 | 65 20 43 4f 4e 46 49 47 |X.X..cas|e CONFIG|
|00002c10| 5f 4d 4f 44 45 3a 0a 58 | 09 09 09 69 66 20 28 76 |_MODE:.X|...if (v|
|00002c20| 70 2d 3e 76 5f 74 79 70 | 65 20 21 3d 20 56 5f 53 |p->v_typ|e != V_S|
|00002c30| 54 52 29 0a 58 09 09 09 | 09 65 72 72 6f 72 28 22 |TR).X...|.error("|
|00002c40| 4e 6f 6e 2d 73 74 72 69 | 6e 67 20 66 6f 72 20 6d |Non-stri|ng for m|
|00002c50| 6f 64 65 22 29 3b 0a 58 | 09 09 09 74 65 6d 70 20 |ode");.X|...temp |
|00002c60| 3d 20 6d 6f 64 65 74 79 | 70 65 28 76 70 2d 3e 76 |= modety|pe(vp->v|
|00002c70| 5f 73 74 72 29 3b 0a 58 | 09 09 09 69 66 20 28 74 |_str);.X|...if (t|
|00002c80| 65 6d 70 20 3c 20 30 29 | 0a 58 09 09 09 09 65 72 |emp < 0)|.X....er|
|00002c90| 72 6f 72 28 22 55 6e 6b | 6e 6f 77 6e 20 6d 6f 64 |ror("Unk|nown mod|
|00002ca0| 65 20 5c 22 25 73 5c 22 | 22 2c 20 76 70 2d 3e 76 |e \"%s\"|", vp->v|
|00002cb0| 5f 73 74 72 29 3b 0a 58 | 09 09 09 73 65 74 6d 6f |_str);.X|...setmo|
|00002cc0| 64 65 28 28 69 6e 74 29 | 20 74 65 6d 70 29 3b 0a |de((int)| temp);.|
|00002cd0| 58 09 09 09 62 72 65 61 | 6b 3b 0a 58 0a 58 09 09 |X...brea|k;.X.X..|
|00002ce0| 63 61 73 65 20 43 4f 4e | 46 49 47 5f 45 50 53 49 |case CON|FIG_EPSI|
|00002cf0| 4c 4f 4e 3a 0a 58 09 09 | 09 69 66 20 28 76 70 2d |LON:.X..|.if (vp-|
|00002d00| 3e 76 5f 74 79 70 65 20 | 21 3d 20 56 5f 4e 55 4d |>v_type |!= V_NUM|
|00002d10| 29 0a 58 09 09 09 09 65 | 72 72 6f 72 28 22 4e 6f |).X....e|rror("No|
|00002d20| 6e 2d 6e 75 6d 65 72 69 | 63 20 66 6f 72 20 65 70 |n-numeri|c for ep|
|00002d30| 73 69 6c 6f 6e 22 29 3b | 0a 58 09 09 09 73 65 74 |silon");|.X...set|
|00002d40| 65 70 73 69 6c 6f 6e 28 | 76 70 2d 3e 76 5f 6e 75 |epsilon(|vp->v_nu|
|00002d50| 6d 29 3b 0a 58 09 09 09 | 62 72 65 61 6b 3b 0a 58 |m);.X...|break;.X|
|00002d60| 0a 58 09 09 63 61 73 65 | 20 43 4f 4e 46 49 47 5f |.X..case| CONFIG_|
|00002d70| 4d 41 58 50 52 49 4e 54 | 3a 0a 58 09 09 09 69 66 |MAXPRINT|:.X...if|
|00002d80| 20 28 76 70 2d 3e 76 5f | 74 79 70 65 20 21 3d 20 | (vp->v_|type != |
|00002d90| 56 5f 4e 55 4d 29 0a 58 | 09 09 09 09 65 72 72 6f |V_NUM).X|....erro|
|00002da0| 72 28 22 4e 6f 6e 2d 6e | 75 6d 65 72 69 63 20 66 |r("Non-n|umeric f|
|00002db0| 6f 72 20 6d 61 78 70 72 | 69 6e 74 22 29 3b 0a 58 |or maxpr|int");.X|
|00002dc0| 09 09 09 71 20 3d 20 76 | 70 2d 3e 76 5f 6e 75 6d |...q = v|p->v_num|
|00002dd0| 3b 0a 58 09 09 09 74 65 | 6d 70 20 3d 20 71 74 6f |;.X...te|mp = qto|
|00002de0| 69 28 71 29 3b 0a 58 09 | 09 09 69 66 20 28 71 69 |i(q);.X.|..if (qi|
|00002df0| 73 66 72 61 63 28 71 29 | 20 7c 7c 20 71 69 73 6e |sfrac(q)| || qisn|
|00002e00| 65 67 28 71 29 20 7c 7c | 20 21 69 73 74 69 6e 79 |eg(q) ||| !istiny|
|00002e10| 28 71 2d 3e 6e 75 6d 29 | 29 0a 58 09 09 09 09 74 |(q->num)|).X....t|
|00002e20| 65 6d 70 20 3d 20 2d 31 | 3b 0a 58 09 09 09 69 66 |emp = -1|;.X...if|
|00002e30| 20 28 74 65 6d 70 20 3c | 20 30 29 0a 58 09 09 09 | (temp <| 0).X...|
|00002e40| 09 65 72 72 6f 72 28 22 | 4d 61 78 70 72 69 6e 74 |.error("|Maxprint|
|00002e50| 20 76 61 6c 75 65 20 69 | 73 20 6f 75 74 20 6f 66 | value i|s out of|
|00002e60| 20 72 61 6e 67 65 22 29 | 3b 0a 58 09 09 09 6d 61 | range")|;.X...ma|
|00002e70| 78 70 72 69 6e 74 20 3d | 20 74 65 6d 70 3b 0a 58 |xprint =| temp;.X|
|00002e80| 09 09 09 62 72 65 61 6b | 3b 0a 58 0a 58 09 09 63 |...break|;.X.X..c|
|00002e90| 61 73 65 20 43 4f 4e 46 | 49 47 5f 4d 55 4c 32 3a |ase CONF|IG_MUL2:|
|00002ea0| 0a 58 09 09 09 69 66 20 | 28 76 70 2d 3e 76 5f 74 |.X...if |(vp->v_t|
|00002eb0| 79 70 65 20 21 3d 20 56 | 5f 4e 55 4d 29 0a 58 09 |ype != V|_NUM).X.|
|00002ec0| 09 09 09 65 72 72 6f 72 | 28 22 4e 6f 6e 2d 6e 75 |...error|("Non-nu|
|00002ed0| 6d 65 72 69 63 20 66 6f | 72 20 6d 75 6c 32 22 29 |meric fo|r mul2")|
|00002ee0| 3b 0a 58 09 09 09 71 20 | 3d 20 76 70 2d 3e 76 5f |;.X...q |= vp->v_|
|00002ef0| 6e 75 6d 3b 0a 58 09 09 | 09 74 65 6d 70 20 3d 20 |num;.X..|.temp = |
|00002f00| 71 74 6f 69 28 71 29 3b | 0a 58 09 09 09 69 66 20 |qtoi(q);|.X...if |
|00002f10| 28 71 69 73 66 72 61 63 | 28 71 29 20 7c 7c 20 71 |(qisfrac|(q) || q|
|00002f20| 69 73 6e 65 67 28 71 29 | 29 0a 58 09 09 09 09 74 |isneg(q)|).X....t|
|00002f30| 65 6d 70 20 3d 20 2d 31 | 3b 0a 58 09 09 09 69 66 |emp = -1|;.X...if|
|00002f40| 20 28 74 65 6d 70 20 3d | 3d 20 30 29 0a 58 09 09 | (temp =|= 0).X..|
|00002f50| 09 09 74 65 6d 70 20 3d | 20 4d 55 4c 5f 41 4c 47 |..temp =| MUL_ALG|
|00002f60| 32 3b 0a 58 09 09 09 69 | 66 20 28 74 65 6d 70 20 |2;.X...i|f (temp |
|00002f70| 3c 20 32 29 0a 58 09 09 | 09 09 65 72 72 6f 72 28 |< 2).X..|..error(|
|00002f80| 22 49 6c 6c 65 67 61 6c | 20 6d 75 6c 32 20 76 61 |"Illegal| mul2 va|
|00002f90| 6c 75 65 22 29 3b 0a 58 | 09 09 09 5f 6d 75 6c 32 |lue");.X|..._mul2|
|00002fa0| 5f 20 3d 20 74 65 6d 70 | 3b 0a 58 09 09 09 62 72 |_ = temp|;.X...br|
|00002fb0| 65 61 6b 3b 0a 58 0a 58 | 09 09 63 61 73 65 20 43 |eak;.X.X|..case C|
|00002fc0| 4f 4e 46 49 47 5f 53 51 | 32 3a 0a 58 09 09 09 69 |ONFIG_SQ|2:.X...i|
|00002fd0| 66 20 28 76 70 2d 3e 76 | 5f 74 79 70 65 20 21 3d |f (vp->v|_type !=|
|00002fe0| 20 56 5f 4e 55 4d 29 0a | 58 09 09 09 09 65 72 72 | V_NUM).|X....err|
|00002ff0| 6f 72 28 22 4e 6f 6e 2d | 6e 75 6d 65 72 69 63 20 |or("Non-|numeric |
|00003000| 66 6f 72 20 73 71 32 22 | 29 3b 0a 58 09 09 09 71 |for sq2"|);.X...q|
|00003010| 20 3d 20 76 70 2d 3e 76 | 5f 6e 75 6d 3b 0a 58 09 | = vp->v|_num;.X.|
|00003020| 09 09 74 65 6d 70 20 3d | 20 71 74 6f 69 28 71 29 |..temp =| qtoi(q)|
|00003030| 3b 0a 58 09 09 09 69 66 | 20 28 71 69 73 66 72 61 |;.X...if| (qisfra|
|00003040| 63 28 71 29 20 7c 7c 20 | 71 69 73 6e 65 67 28 71 |c(q) || |qisneg(q|
|00003050| 29 29 0a 58 09 09 09 09 | 74 65 6d 70 20 3d 20 2d |)).X....|temp = -|
|00003060| 31 3b 0a 58 09 09 09 69 | 66 20 28 74 65 6d 70 20 |1;.X...i|f (temp |
|00003070| 3d 3d 20 30 29 0a 58 09 | 09 09 09 74 65 6d 70 20 |== 0).X.|...temp |
|00003080| 3d 20 53 51 5f 41 4c 47 | 32 3b 0a 58 09 09 09 69 |= SQ_ALG|2;.X...i|
|00003090| 66 20 28 74 65 6d 70 20 | 3c 20 32 29 0a 58 09 09 |f (temp |< 2).X..|
|000030a0| 09 09 65 72 72 6f 72 28 | 22 49 6c 6c 65 67 61 6c |..error(|"Illegal|
|000030b0| 20 73 71 32 20 76 61 6c | 75 65 22 29 3b 0a 58 09 | sq2 val|ue");.X.|
|000030c0| 09 09 5f 73 71 32 5f 20 | 3d 20 74 65 6d 70 3b 0a |.._sq2_ |= temp;.|
|000030d0| 58 09 09 09 62 72 65 61 | 6b 3b 0a 58 0a 58 09 09 |X...brea|k;.X.X..|
|000030e0| 63 61 73 65 20 43 4f 4e | 46 49 47 5f 50 4f 57 32 |case CON|FIG_POW2|
|000030f0| 3a 0a 58 09 09 09 69 66 | 20 28 76 70 2d 3e 76 5f |:.X...if| (vp->v_|
|00003100| 74 79 70 65 20 21 3d 20 | 56 5f 4e 55 4d 29 0a 58 |type != |V_NUM).X|
|00003110| 09 09 09 09 65 72 72 6f | 72 28 22 4e 6f 6e 2d 6e |....erro|r("Non-n|
|00003120| 75 6d 65 72 69 63 20 66 | 6f 72 20 70 6f 77 32 22 |umeric f|or pow2"|
|00003130| 29 3b 0a 58 09 09 09 71 | 20 3d 20 76 70 2d 3e 76 |);.X...q| = vp->v|
|00003140| 5f 6e 75 6d 3b 0a 58 09 | 09 09 74 65 6d 70 20 3d |_num;.X.|..temp =|
|00003150| 20 71 74 6f 69 28 71 29 | 3b 0a 58 09 09 09 69 66 | qtoi(q)|;.X...if|
|00003160| 20 28 71 69 73 66 72 61 | 63 28 71 29 20 7c 7c 20 | (qisfra|c(q) || |
|00003170| 71 69 73 6e 65 67 28 71 | 29 29 0a 58 09 09 09 09 |qisneg(q|)).X....|
|00003180| 74 65 6d 70 20 3d 20 2d | 31 3b 0a 58 09 09 09 69 |temp = -|1;.X...i|
|00003190| 66 20 28 74 65 6d 70 20 | 3d 3d 20 30 29 0a 58 09 |f (temp |== 0).X.|
|000031a0| 09 09 09 74 65 6d 70 20 | 3d 20 50 4f 57 5f 41 4c |...temp |= POW_AL|
|000031b0| 47 32 3b 0a 58 09 09 09 | 69 66 20 28 74 65 6d 70 |G2;.X...|if (temp|
|000031c0| 20 3c 20 31 29 0a 58 09 | 09 09 09 65 72 72 6f 72 | < 1).X.|...error|
|000031d0| 28 22 49 6c 6c 65 67 61 | 6c 20 70 6f 77 32 20 76 |("Illega|l pow2 v|
|000031e0| 61 6c 75 65 22 29 3b 0a | 58 09 09 09 5f 70 6f 77 |alue");.|X..._pow|
|000031f0| 32 5f 20 3d 20 74 65 6d | 70 3b 0a 58 09 09 09 62 |2_ = tem|p;.X...b|
|00003200| 72 65 61 6b 3b 0a 58 0a | 58 09 09 63 61 73 65 20 |reak;.X.|X..case |
|00003210| 43 4f 4e 46 49 47 5f 52 | 45 44 43 32 3a 0a 58 09 |CONFIG_R|EDC2:.X.|
|00003220| 09 09 69 66 20 28 76 70 | 2d 3e 76 5f 74 79 70 65 |..if (vp|->v_type|
|00003230| 20 21 3d 20 56 5f 4e 55 | 4d 29 0a 58 09 09 09 09 | != V_NU|M).X....|
|00003240| 65 72 72 6f 72 28 22 4e | 6f 6e 2d 6e 75 6d 65 72 |error("N|on-numer|
|00003250| 69 63 20 66 6f 72 20 72 | 65 64 63 32 22 29 3b 0a |ic for r|edc2");.|
|00003260| 58 09 09 09 71 20 3d 20 | 76 70 2d 3e 76 5f 6e 75 |X...q = |vp->v_nu|
|00003270| 6d 3b 0a 58 09 09 09 74 | 65 6d 70 20 3d 20 71 74 |m;.X...t|emp = qt|
|00003280| 6f 69 28 71 29 3b 0a 58 | 09 09 09 69 66 20 28 71 |oi(q);.X|...if (q|
|00003290| 69 73 66 72 61 63 28 71 | 29 20 7c 7c 20 71 69 73 |isfrac(q|) || qis|
|000032a0| 6e 65 67 28 71 29 29 0a | 58 09 09 09 09 74 65 6d |neg(q)).|X....tem|
|000032b0| 70 20 3d 20 2d 31 3b 0a | 58 09 09 09 69 66 20 28 |p = -1;.|X...if (|
|000032c0| 74 65 6d 70 20 3d 3d 20 | 30 29 0a 58 09 09 09 09 |temp == |0).X....|
|000032d0| 74 65 6d 70 20 3d 20 52 | 45 44 43 5f 41 4c 47 32 |temp = R|EDC_ALG2|
|000032e0| 3b 0a 58 09 09 09 69 66 | 20 28 74 65 6d 70 20 3c |;.X...if| (temp <|
|000032f0| 20 31 29 0a 58 09 09 09 | 09 65 72 72 6f 72 28 22 | 1).X...|.error("|
|00003300| 49 6c 6c 65 67 61 6c 20 | 72 65 64 63 32 20 76 61 |Illegal |redc2 va|
|00003310| 6c 75 65 22 29 3b 0a 58 | 09 09 09 5f 72 65 64 63 |lue");.X|..._redc|
|00003320| 32 5f 20 3d 20 74 65 6d | 70 3b 0a 58 09 09 09 62 |2_ = tem|p;.X...b|
|00003330| 72 65 61 6b 3b 0a 58 0a | 58 09 09 64 65 66 61 75 |reak;.X.|X..defau|
|00003340| 6c 74 3a 0a 58 09 09 09 | 65 72 72 6f 72 28 22 53 |lt:.X...|error("S|
|00003350| 65 74 74 69 6e 67 20 69 | 6c 6c 65 67 61 6c 20 63 |etting i|llegal c|
|00003360| 6f 6e 66 69 67 20 70 61 | 72 61 6d 65 74 65 72 22 |onfig pa|rameter"|
|00003370| 29 3b 0a 58 09 7d 0a 58 | 7d 0a 58 0a 58 0a 58 2f |);.X.}.X|}.X.X.X/|
|00003380| 2a 0a 58 20 2a 20 47 65 | 74 20 74 68 65 20 63 75 |*.X * Ge|t the cu|
|00003390| 72 72 65 6e 74 20 76 61 | 6c 75 65 20 6f 66 20 74 |rrent va|lue of t|
|000033a0| 68 65 20 73 70 65 63 69 | 66 69 65 64 20 63 6f 6e |he speci|fied con|
|000033b0| 66 69 67 75 72 61 74 69 | 6f 6e 20 74 79 70 65 2e |figurati|on type.|
|000033c0| 0a 58 20 2a 20 41 6e 20 | 65 72 72 6f 72 20 69 73 |.X * An |error is|
|000033d0| 20 67 65 6e 65 72 61 74 | 65 64 20 69 66 20 74 68 | generat|ed if th|
|000033e0| 65 20 74 79 70 65 20 6e | 75 6d 62 65 72 20 69 73 |e type n|umber is|
|000033f0| 20 69 6c 6c 65 67 61 6c | 2e 0a 58 20 2a 2f 0a 58 | illegal|..X */.X|
|00003400| 76 6f 69 64 0a 58 67 65 | 74 63 6f 6e 66 69 67 28 |void.Xge|tconfig(|
|00003410| 74 79 70 65 2c 20 76 70 | 29 0a 58 09 56 41 4c 55 |type, vp|).X.VALU|
|00003420| 45 20 2a 76 70 3b 0a 58 | 7b 0a 58 09 73 77 69 74 |E *vp;.X|{.X.swit|
|00003430| 63 68 20 28 74 79 70 65 | 29 20 7b 0a 58 09 09 63 |ch (type|) {.X..c|
|00003440| 61 73 65 20 43 4f 4e 46 | 49 47 5f 54 52 41 43 45 |ase CONF|IG_TRACE|
|00003450| 3a 0a 58 09 09 09 76 70 | 2d 3e 76 5f 74 79 70 65 |:.X...vp|->v_type|
|00003460| 20 3d 20 56 5f 4e 55 4d | 3b 0a 58 09 09 09 76 70 | = V_NUM|;.X...vp|
|00003470| 2d 3e 76 5f 6e 75 6d 20 | 3d 20 69 74 6f 71 28 28 |->v_num |= itoq((|
|00003480| 6c 6f 6e 67 29 20 74 72 | 61 63 65 66 6c 61 67 73 |long) tr|aceflags|
|00003490| 29 3b 0a 58 09 09 09 62 | 72 65 61 6b 3b 0a 58 0a |);.X...b|reak;.X.|
|000034a0| 58 09 09 63 61 73 65 20 | 43 4f 4e 46 49 47 5f 44 |X..case |CONFIG_D|
|000034b0| 49 53 50 4c 41 59 3a 0a | 58 09 09 09 76 70 2d 3e |ISPLAY:.|X...vp->|
|000034c0| 76 5f 74 79 70 65 20 3d | 20 56 5f 4e 55 4d 3b 0a |v_type =| V_NUM;.|
|000034d0| 58 09 09 09 76 70 2d 3e | 76 5f 6e 75 6d 20 3d 20 |X...vp->|v_num = |
|000034e0| 69 74 6f 71 28 5f 6f 75 | 74 64 69 67 69 74 73 5f |itoq(_ou|tdigits_|
|000034f0| 29 3b 0a 58 09 09 09 62 | 72 65 61 6b 3b 0a 58 0a |);.X...b|reak;.X.|
|00003500| 58 09 09 63 61 73 65 20 | 43 4f 4e 46 49 47 5f 4d |X..case |CONFIG_M|
|00003510| 4f 44 45 3a 0a 58 09 09 | 09 76 70 2d 3e 76 5f 74 |ODE:.X..|.vp->v_t|
|00003520| 79 70 65 20 3d 20 56 5f | 53 54 52 3b 0a 58 09 09 |ype = V_|STR;.X..|
|00003530| 09 76 70 2d 3e 76 5f 73 | 75 62 74 79 70 65 20 3d |.vp->v_s|ubtype =|
|00003540| 20 56 5f 53 54 52 4c 49 | 54 45 52 41 4c 3b 0a 58 | V_STRLI|TERAL;.X|
|00003550| 09 09 09 76 70 2d 3e 76 | 5f 73 74 72 20 3d 20 6d |...vp->v|_str = m|
|00003560| 6f 64 65 6e 61 6d 65 28 | 5f 6f 75 74 6d 6f 64 65 |odename(|_outmode|
|00003570| 5f 29 3b 0a 58 09 09 09 | 62 72 65 61 6b 3b 0a 58 |_);.X...|break;.X|
|00003580| 0a 58 09 09 63 61 73 65 | 20 43 4f 4e 46 49 47 5f |.X..case| CONFIG_|
|00003590| 45 50 53 49 4c 4f 4e 3a | 0a 58 09 09 09 76 70 2d |EPSILON:|.X...vp-|
|000035a0| 3e 76 5f 74 79 70 65 20 | 3d 20 56 5f 4e 55 4d 3b |>v_type |= V_NUM;|
|000035b0| 0a 58 09 09 09 76 70 2d | 3e 76 5f 6e 75 6d 20 3d |.X...vp-|>v_num =|
|000035c0| 20 71 6c 69 6e 6b 28 5f | 65 70 73 69 6c 6f 6e 5f | qlink(_|epsilon_|
|000035d0| 29 3b 0a 58 09 09 09 62 | 72 65 61 6b 3b 0a 58 0a |);.X...b|reak;.X.|
|000035e0| 58 09 09 63 61 73 65 20 | 43 4f 4e 46 49 47 5f 4d |X..case |CONFIG_M|
|000035f0| 41 58 50 52 49 4e 54 3a | 0a 58 09 09 09 76 70 2d |AXPRINT:|.X...vp-|
|00003600| 3e 76 5f 74 79 70 65 20 | 3d 20 56 5f 4e 55 4d 3b |>v_type |= V_NUM;|
|00003610| 0a 58 09 09 09 76 70 2d | 3e 76 5f 6e 75 6d 20 3d |.X...vp-|>v_num =|
|00003620| 20 69 74 6f 71 28 6d 61 | 78 70 72 69 6e 74 29 3b | itoq(ma|xprint);|
|00003630| 0a 58 09 09 09 62 72 65 | 61 6b 3b 0a 58 0a 58 09 |.X...bre|ak;.X.X.|
|00003640| 09 63 61 73 65 20 43 4f | 4e 46 49 47 5f 4d 55 4c |.case CO|NFIG_MUL|
|00003650| 32 3a 0a 58 09 09 09 76 | 70 2d 3e 76 5f 74 79 70 |2:.X...v|p->v_typ|
|00003660| 65 20 3d 20 56 5f 4e 55 | 4d 3b 0a 58 09 09 09 76 |e = V_NU|M;.X...v|
|00003670| 70 2d 3e 76 5f 6e 75 6d | 20 3d 20 69 74 6f 71 28 |p->v_num| = itoq(|
|00003680| 5f 6d 75 6c 32 5f 29 3b | 0a 58 09 09 09 62 72 65 |_mul2_);|.X...bre|
|00003690| 61 6b 3b 0a 58 0a 58 09 | 09 63 61 73 65 20 43 4f |ak;.X.X.|.case CO|
|000036a0| 4e 46 49 47 5f 53 51 32 | 3a 0a 58 09 09 09 76 70 |NFIG_SQ2|:.X...vp|
|000036b0| 2d 3e 76 5f 74 79 70 65 | 20 3d 20 56 5f 4e 55 4d |->v_type| = V_NUM|
|000036c0| 3b 0a 58 09 09 09 76 70 | 2d 3e 76 5f 6e 75 6d 20 |;.X...vp|->v_num |
|000036d0| 3d 20 69 74 6f 71 28 5f | 73 71 32 5f 29 3b 0a 58 |= itoq(_|sq2_);.X|
|000036e0| 09 09 09 62 72 65 61 6b | 3b 0a 58 0a 58 09 09 63 |...break|;.X.X..c|
|000036f0| 61 73 65 20 43 4f 4e 46 | 49 47 5f 50 4f 57 32 3a |ase CONF|IG_POW2:|
|00003700| 0a 58 09 09 09 76 70 2d | 3e 76 5f 74 79 70 65 20 |.X...vp-|>v_type |
|00003710| 3d 20 56 5f 4e 55 4d 3b | 0a 58 09 09 09 76 70 2d |= V_NUM;|.X...vp-|
|00003720| 3e 76 5f 6e 75 6d 20 3d | 20 69 74 6f 71 28 5f 70 |>v_num =| itoq(_p|
|00003730| 6f 77 32 5f 29 3b 0a 58 | 09 09 09 62 72 65 61 6b |ow2_);.X|...break|
|00003740| 3b 0a 58 0a 58 09 09 63 | 61 73 65 20 43 4f 4e 46 |;.X.X..c|ase CONF|
|00003750| 49 47 5f 52 45 44 43 32 | 3a 0a 58 09 09 09 76 70 |IG_REDC2|:.X...vp|
|00003760| 2d 3e 76 5f 74 79 70 65 | 20 3d 20 56 5f 4e 55 4d |->v_type| = V_NUM|
|00003770| 3b 0a 58 09 09 09 76 70 | 2d 3e 76 5f 6e 75 6d 20 |;.X...vp|->v_num |
|00003780| 3d 20 69 74 6f 71 28 5f | 72 65 64 63 32 5f 29 3b |= itoq(_|redc2_);|
|00003790| 0a 58 09 09 09 62 72 65 | 61 6b 3b 0a 58 0a 58 09 |.X...bre|ak;.X.X.|
|000037a0| 09 64 65 66 61 75 6c 74 | 3a 0a 58 09 09 09 65 72 |.default|:.X...er|
|000037b0| 72 6f 72 28 22 47 65 74 | 74 69 6e 67 20 69 6c 6c |ror("Get|ting ill|
|000037c0| 65 67 61 6c 20 63 6f 6e | 66 69 67 20 70 61 72 61 |egal con|fig para|
|000037d0| 6d 65 74 65 72 22 29 3b | 0a 58 09 7d 0a 58 7d 0a |meter");|.X.}.X}.|
|000037e0| 58 0a 58 2f 2a 20 45 4e | 44 20 43 4f 44 45 20 2a |X.X/* EN|D CODE *|
|000037f0| 2f 0a 45 4e 44 5f 4f 46 | 5f 46 49 4c 45 0a 69 66 |/.END_OF|_FILE.if|
|00003800| 20 74 65 73 74 20 35 38 | 31 31 20 2d 6e 65 20 60 | test 58|11 -ne `|
|00003810| 77 63 20 2d 63 20 3c 27 | 63 6f 6e 66 69 67 2e 63 |wc -c <'|config.c|
|00003820| 27 60 3b 20 74 68 65 6e | 0a 20 20 20 20 65 63 68 |'`; then|. ech|
|00003830| 6f 20 73 68 61 72 3a 20 | 5c 22 27 63 6f 6e 66 69 |o shar: |\"'confi|
|00003840| 67 2e 63 27 5c 22 20 75 | 6e 70 61 63 6b 65 64 20 |g.c'\" u|npacked |
|00003850| 77 69 74 68 20 77 72 6f | 6e 67 20 73 69 7a 65 21 |with wro|ng size!|
|00003860| 0a 66 69 0a 23 20 65 6e | 64 20 6f 66 20 27 63 6f |.fi.# en|d of 'co|
|00003870| 6e 66 69 67 2e 63 27 0a | 66 69 0a 69 66 20 74 65 |nfig.c'.|fi.if te|
|00003880| 73 74 20 2d 66 20 27 68 | 65 6c 70 2f 6f 62 6a 27 |st -f 'h|elp/obj'|
|00003890| 20 2d 61 20 22 24 7b 31 | 7d 22 20 21 3d 20 22 2d | -a "${1|}" != "-|
|000038a0| 63 22 20 3b 20 74 68 65 | 6e 20 0a 20 20 65 63 68 |c" ; the|n . ech|
|000038b0| 6f 20 73 68 61 72 3a 20 | 57 69 6c 6c 20 6e 6f 74 |o shar: |Will not|
|000038c0| 20 63 6c 6f 62 62 65 72 | 20 65 78 69 73 74 69 6e | clobber| existin|
|000038d0| 67 20 66 69 6c 65 20 5c | 22 27 68 65 6c 70 2f 6f |g file \|"'help/o|
|000038e0| 62 6a 27 5c 22 0a 65 6c | 73 65 0a 65 63 68 6f 20 |bj'\".el|se.echo |
|000038f0| 73 68 61 72 3a 20 45 78 | 74 72 61 63 74 69 6e 67 |shar: Ex|tracting|
|00003900| 20 5c 22 27 68 65 6c 70 | 2f 6f 62 6a 27 5c 22 20 | \"'help|/obj'\" |
|00003910| 5c 28 36 36 38 32 20 63 | 68 61 72 61 63 74 65 72 |\(6682 c|haracter|
|00003920| 73 5c 29 0a 73 65 64 20 | 22 73 2f 5e 58 2f 2f 22 |s\).sed |"s/^X//"|
|00003930| 20 3e 27 68 65 6c 70 2f | 6f 62 6a 27 20 3c 3c 27 | >'help/|obj' <<'|
|00003940| 45 4e 44 5f 4f 46 5f 46 | 49 4c 45 27 0a 58 55 73 |END_OF_F|ILE'.XUs|
|00003950| 69 6e 67 20 6f 62 6a 65 | 63 74 73 0a 58 0a 58 09 |ing obje|cts.X.X.|
|00003960| 4f 62 6a 65 63 74 73 20 | 61 72 65 20 75 73 65 72 |Objects |are user|
|00003970| 2d 64 65 66 69 6e 65 64 | 20 74 79 70 65 73 20 77 |-defined| types w|
|00003980| 68 69 63 68 20 61 72 65 | 20 61 73 73 6f 63 69 61 |hich are| associa|
|00003990| 74 65 64 20 77 69 74 68 | 20 75 73 65 72 2d 0a 58 |ted with| user-.X|
|000039a0| 09 64 65 66 69 6e 65 64 | 20 66 75 6e 63 74 69 6f |.defined| functio|
|000039b0| 6e 73 20 74 6f 20 6d 61 | 6e 69 70 75 6c 61 74 65 |ns to ma|nipulate|
|000039c0| 20 74 68 65 6d 2e 20 20 | 4f 62 6a 65 63 74 20 74 | them. |Object t|
|000039d0| 79 70 65 73 20 61 72 65 | 20 64 65 66 69 6e 65 64 |ypes are| defined|
|000039e0| 0a 58 09 73 69 6d 69 6c | 61 72 6c 79 20 74 6f 20 |.X.simil|arly to |
|000039f0| 73 74 72 75 63 74 75 72 | 65 73 20 69 6e 20 43 2c |structur|es in C,|
|00003a00| 20 61 6e 64 20 63 6f 6e | 73 69 73 74 20 6f 66 20 | and con|sist of |
|00003a10| 6f 6e 65 20 6f 72 20 6d | 6f 72 65 20 65 6c 65 6d |one or m|ore elem|
|00003a20| 65 6e 74 73 2e 0a 58 09 | 54 68 65 20 61 64 76 61 |ents..X.|The adva|
|00003a30| 6e 74 61 67 65 20 6f 66 | 20 61 6e 20 6f 62 6a 65 |ntage of| an obje|
|00003a40| 63 74 20 69 73 20 74 68 | 61 74 20 74 68 65 20 75 |ct is th|at the u|
|00003a50| 73 65 72 2d 64 65 66 69 | 6e 65 64 20 72 6f 75 74 |ser-defi|ned rout|
|00003a60| 69 6e 65 73 20 61 72 65 | 0a 58 09 61 75 74 6f 6d |ines are|.X.autom|
|00003a70| 61 74 69 63 61 6c 6c 79 | 20 63 61 6c 6c 65 64 20 |atically| called |
|00003a80| 62 79 20 74 68 65 20 63 | 61 6c 63 75 6c 61 74 6f |by the c|alculato|
|00003a90| 72 20 66 6f 72 20 76 61 | 72 69 6f 75 73 20 6f 70 |r for va|rious op|
|00003aa0| 65 72 61 74 69 6f 6e 73 | 2c 0a 58 09 73 75 63 68 |erations|,.X.such|
|00003ab0| 20 61 73 20 61 64 64 69 | 74 69 6f 6e 2c 20 6d 75 | as addi|tion, mu|
|00003ac0| 6c 74 69 70 6c 69 63 61 | 74 69 6f 6e 2c 20 61 6e |ltiplica|tion, an|
|00003ad0| 64 20 70 72 69 6e 74 69 | 6e 67 2e 20 20 54 68 75 |d printi|ng. Thu|
|00003ae0| 73 20 74 68 65 79 20 63 | 61 6e 20 62 65 0a 58 09 |s they c|an be.X.|
|00003af0| 6d 61 6e 69 70 75 6c 61 | 74 65 64 20 62 79 20 74 |manipula|ted by t|
|00003b00| 68 65 20 75 73 65 72 20 | 61 73 20 69 66 20 74 68 |he user |as if th|
|00003b10| 65 79 20 77 65 72 65 20 | 6a 75 73 74 20 61 6e 6f |ey were |just ano|
|00003b20| 74 68 65 72 20 6b 69 6e | 64 20 6f 66 20 6e 75 6d |ther kin|d of num|
|00003b30| 62 65 72 2e 0a 58 0a 58 | 09 41 6e 20 65 78 61 6d |ber..X.X|.An exam|
|00003b40| 70 6c 65 20 6f 62 6a 65 | 63 74 20 74 79 70 65 20 |ple obje|ct type |
|00003b50| 69 73 20 22 73 75 72 64 | 22 2c 20 77 68 69 63 68 |is "surd|", which|
|00003b60| 20 72 65 70 72 65 73 65 | 6e 74 73 20 6e 75 6d 62 | represe|nts numb|
|00003b70| 65 72 73 20 6f 66 20 74 | 68 65 20 66 6f 72 6d 0a |ers of t|he form.|
|00003b80| 58 0a 58 09 09 61 20 2b | 20 62 2a 73 71 72 74 28 |X.X..a +| b*sqrt(|
|00003b90| 44 29 2c 0a 58 0a 58 09 | 77 68 65 72 65 20 44 20 |D),.X.X.|where D |
|00003ba0| 69 73 20 61 20 66 69 78 | 65 64 20 69 6e 74 65 67 |is a fix|ed integ|
|00003bb0| 65 72 2c 20 61 6e 64 20 | 27 61 27 20 61 6e 64 20 |er, and |'a' and |
|00003bc0| 27 62 27 20 61 72 65 20 | 61 72 62 69 74 72 61 72 |'b' are |arbitrar|
|00003bd0| 79 20 72 61 74 69 6f 6e | 61 6c 0a 58 09 6e 75 6d |y ration|al.X.num|
|00003be0| 62 65 72 73 2e 20 20 41 | 64 64 69 74 69 6f 6e 2c |bers. A|ddition,|
|00003bf0| 20 73 75 62 74 72 61 63 | 74 69 6f 6e 2c 20 6d 75 | subtrac|tion, mu|
|00003c00| 6c 74 69 70 6c 69 63 61 | 74 69 6f 6e 2c 20 61 6e |ltiplica|tion, an|
|00003c10| 64 20 64 69 76 69 73 69 | 6f 6e 20 63 61 6e 20 62 |d divisi|on can b|
|00003c20| 65 0a 58 09 70 65 72 66 | 6f 72 6d 65 64 20 6f 6e |e.X.perf|ormed on|
|00003c30| 20 73 75 63 68 20 6e 75 | 6d 62 65 72 73 2c 20 61 | such nu|mbers, a|
|00003c40| 6e 64 20 74 68 65 20 72 | 65 73 75 6c 74 20 63 61 |nd the r|esult ca|
|00003c50| 6e 20 62 65 20 70 75 74 | 20 75 6e 61 6d 62 69 67 |n be put| unambig|
|00003c60| 75 6f 75 73 6c 79 0a 58 | 09 69 6e 74 6f 20 74 68 |uously.X|.into th|
|00003c70| 65 20 73 61 6d 65 20 66 | 6f 72 6d 2e 20 20 28 43 |e same f|orm. (C|
|00003c80| 6f 6d 70 6c 65 78 20 6e | 75 6d 62 65 72 73 20 61 |omplex n|umbers a|
|00003c90| 72 65 20 61 6e 20 65 78 | 61 6d 70 6c 65 20 6f 66 |re an ex|ample of|
|00003ca0| 20 73 75 72 64 73 2c 20 | 77 68 65 72 65 0a 58 09 | surds, |where.X.|
|00003cb0| 44 20 69 73 20 2d 31 2e | 29 0a 58 0a 58 09 54 68 |D is -1.|).X.X.Th|
|00003cc0| 65 20 22 6f 62 6a 22 20 | 73 74 61 74 65 6d 65 6e |e "obj" |statemen|
|00003cd0| 74 20 64 65 66 69 6e 65 | 73 20 65 69 74 68 65 72 |t define|s either|
|00003ce0| 20 61 6e 20 6f 62 6a 65 | 63 74 20 74 79 70 65 20 | an obje|ct type |
|00003cf0| 6f 72 20 61 6e 20 61 63 | 74 75 61 6c 0a 58 09 76 |or an ac|tual.X.v|
|00003d00| 61 72 69 61 62 6c 65 20 | 6f 66 20 74 68 61 74 20 |ariable |of that |
|00003d10| 74 79 70 65 2e 20 20 57 | 68 65 6e 20 64 65 66 69 |type. W|hen defi|
|00003d20| 6e 69 6e 67 20 74 68 65 | 20 6f 62 6a 65 63 74 20 |ning the| object |
|00003d30| 74 79 70 65 2c 20 74 68 | 65 20 6e 61 6d 65 73 20 |type, th|e names |
|00003d40| 6f 66 0a 58 09 69 74 73 | 20 65 6c 65 6d 65 6e 74 |of.X.its| element|
|00003d50| 73 20 61 72 65 20 73 70 | 65 63 69 66 69 65 64 20 |s are sp|ecified |
|00003d60| 69 6e 73 69 64 65 20 6f | 66 20 61 20 70 61 69 72 |inside o|f a pair|
|00003d70| 20 6f 66 20 62 72 61 63 | 65 73 2e 20 20 54 6f 20 | of brac|es. To |
|00003d80| 64 65 66 69 6e 65 0a 58 | 09 74 68 65 20 73 75 72 |define.X|.the sur|
|00003d90| 64 20 6f 62 6a 65 63 74 | 20 74 79 70 65 2c 20 74 |d object| type, t|
|00003da0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 63 6f 75 |he follo|wing cou|
|00003db0| 6c 64 20 62 65 20 75 73 | 65 64 3a 0a 58 0a 58 09 |ld be us|ed:.X.X.|
|00003dc0| 09 6f 62 6a 20 73 75 72 | 64 20 7b 61 2c 20 62 7d |.obj sur|d {a, b}|
|00003dd0| 3b 0a 58 0a 58 09 48 65 | 72 65 20 61 20 61 6e 64 |;.X.X.He|re a and|
|00003de0| 20 62 20 61 72 65 20 74 | 68 65 20 65 6c 65 6d 65 | b are t|he eleme|
|00003df0| 6e 74 20 6e 61 6d 65 73 | 20 66 6f 72 20 74 68 65 |nt names| for the|
|00003e00| 20 74 77 6f 20 63 6f 6d | 70 6f 6e 65 6e 74 73 20 | two com|ponents |
|00003e10| 6f 66 20 74 68 65 0a 58 | 09 73 75 72 64 20 6f 62 |of the.X|.surd ob|
|00003e20| 6a 65 63 74 2e 0a 58 0a | 58 09 57 68 65 6e 20 61 |ject..X.|X.When a|
|00003e30| 6e 20 6f 62 6a 65 63 74 | 20 69 73 20 63 72 65 61 |n object| is crea|
|00003e40| 74 65 64 2c 20 74 68 65 | 20 65 6c 65 6d 65 6e 74 |ted, the| element|
|00003e50| 73 20 61 72 65 20 61 6c | 6c 20 64 65 66 69 6e 65 |s are al|l define|
|00003e60| 64 20 77 69 74 68 20 6e | 75 6c 6c 0a 58 09 76 61 |d with n|ull.X.va|
|00003e70| 6c 75 65 73 2e 20 20 41 | 20 75 73 65 72 2d 64 65 |lues. A| user-de|
|00003e80| 66 69 6e 65 64 20 72 6f | 75 74 69 6e 65 20 73 68 |fined ro|utine sh|
|00003e90| 6f 75 6c 64 20 62 65 20 | 70 72 6f 76 69 64 65 64 |ould be |provided|
|00003ea0| 20 77 68 69 63 68 20 77 | 69 6c 6c 20 70 6c 61 63 | which w|ill plac|
|00003eb0| 65 0a 58 09 75 73 65 66 | 75 6c 20 76 61 6c 75 65 |e.X.usef|ul value|
|00003ec0| 73 20 69 6e 20 74 68 65 | 20 65 6c 65 6d 65 6e 74 |s in the| element|
|00003ed0| 73 2e 20 20 46 6f 72 20 | 65 78 61 6d 70 6c 65 2c |s. For |example,|
|00003ee0| 20 66 6f 72 20 61 6e 20 | 6f 62 6a 65 63 74 20 6f | for an |object o|
|00003ef0| 66 20 74 79 70 65 0a 58 | 09 27 73 75 72 64 27 2c |f type.X|.'surd',|
|00003f00| 20 61 20 66 75 6e 63 74 | 69 6f 6e 20 63 61 6c 6c | a funct|ion call|
|00003f10| 65 64 20 27 73 75 72 64 | 27 20 63 61 6e 20 62 65 |ed 'surd|' can be|
|00003f20| 20 64 65 66 69 6e 65 64 | 20 74 6f 20 73 65 74 20 | defined| to set |
|00003f30| 74 68 65 20 74 77 6f 0a | 58 09 63 6f 6d 70 6f 6e |the two.|X.compon|
|00003f40| 65 6e 74 73 20 61 73 20 | 66 6f 6c 6c 6f 77 73 3a |ents as |follows:|
|00003f50| 0a 58 09 0a 58 09 09 64 | 65 66 69 6e 65 20 73 75 |.X..X..d|efine su|
|00003f60| 72 64 28 61 2c 20 62 29 | 0a 58 09 09 7b 0a 58 09 |rd(a, b)|.X..{.X.|
|00003f70| 09 09 6c 6f 63 61 6c 20 | 78 3b 0a 58 0a 58 09 09 |..local |x;.X.X..|
|00003f80| 09 6f 62 6a 20 73 75 72 | 64 20 78 3b 0a 58 09 09 |.obj sur|d x;.X..|
|00003f90| 09 78 2e 61 20 3d 20 61 | 3b 0a 58 09 09 09 78 2e |.x.a = a|;.X...x.|
|00003fa0| 62 20 3d 20 62 3b 0a 58 | 09 09 09 72 65 74 75 72 |b = b;.X|...retur|
|00003fb0| 6e 20 78 3b 0a 58 09 09 | 7d 0a 58 0a 58 09 57 68 |n x;.X..|}.X.X.Wh|
|00003fc0| 65 6e 20 61 6e 20 6f 70 | 65 72 61 74 69 6f 6e 20 |en an op|eration |
|00003fd0| 69 73 20 61 74 74 65 6d | 70 74 65 64 20 66 6f 72 |is attem|pted for|
|00003fe0| 20 61 6e 20 6f 62 6a 65 | 63 74 2c 20 75 73 65 72 | an obje|ct, user|
|00003ff0| 20 66 75 6e 63 74 69 6f | 6e 73 20 77 69 74 68 0a | functio|ns with.|
|00004000| 58 09 70 61 72 74 69 63 | 75 6c 61 72 20 6e 61 6d |X.partic|ular nam|
|00004010| 65 73 20 61 72 65 20 61 | 75 74 6f 6d 61 74 69 63 |es are a|utomatic|
|00004020| 61 6c 6c 79 20 63 61 6c | 6c 65 64 20 74 6f 20 70 |ally cal|led to p|
|00004030| 65 72 66 6f 72 6d 20 74 | 68 65 20 6f 70 65 72 61 |erform t|he opera|
|00004040| 74 69 6f 6e 2e 0a 58 09 | 54 68 65 73 65 20 6e 61 |tion..X.|These na|
|00004050| 6d 65 73 20 61 72 65 20 | 63 72 65 61 74 65 64 20 |mes are |created |
|00004060| 62 79 20 63 6f 6e 63 61 | 74 65 6e 61 74 69 6e 67 |by conca|tenating|
|00004070| 20 74 68 65 20 6f 62 6a | 65 63 74 20 74 79 70 65 | the obj|ect type|
|00004080| 20 6e 61 6d 65 20 61 6e | 64 0a 58 09 74 68 65 20 | name an|d.X.the |
|00004090| 6f 70 65 72 61 74 69 6f | 6e 20 6e 61 6d 65 20 74 |operatio|n name t|
|000040a0| 6f 67 65 74 68 65 72 20 | 77 69 74 68 20 61 6e 20 |ogether |with an |
|000040b0| 75 6e 64 65 72 73 63 6f | 72 65 2e 20 20 46 6f 72 |undersco|re. For|
|000040c0| 20 65 78 61 6d 70 6c 65 | 2c 20 77 68 65 6e 0a 58 | example|, when.X|
|000040d0| 09 6d 75 6c 74 69 70 6c | 79 69 6e 67 20 74 77 6f |.multipl|ying two|
|000040e0| 20 6f 62 6a 65 63 74 73 | 20 6f 66 20 74 79 70 65 | objects| of type|
|000040f0| 20 73 75 72 64 2c 20 74 | 68 65 20 66 75 6e 63 74 | surd, t|he funct|
|00004100| 69 6f 6e 20 22 73 75 72 | 64 5f 6d 75 6c 22 20 69 |ion "sur|d_mul" i|
|00004110| 73 0a 58 09 63 61 6c 6c | 65 64 2e 0a 58 0a 58 09 |s.X.call|ed..X.X.|
|00004120| 54 68 65 20 75 73 65 72 | 20 66 75 6e 63 74 69 6f |The user| functio|
|00004130| 6e 20 69 73 20 63 61 6c | 6c 65 64 20 77 69 74 68 |n is cal|led with|
|00004140| 20 74 68 65 20 6e 65 63 | 65 73 73 61 72 79 20 61 | the nec|essary a|
|00004150| 72 67 75 6d 65 6e 74 73 | 20 66 6f 72 20 74 68 61 |rguments| for tha|
|00004160| 74 0a 58 09 6f 70 65 72 | 61 74 69 6f 6e 2e 20 20 |t.X.oper|ation. |
|00004170| 46 6f 72 20 65 78 61 6d | 70 6c 65 2c 20 66 6f 72 |For exam|ple, for|
|00004180| 20 22 73 75 72 64 5f 6d | 75 6c 22 2c 20 74 68 65 | "surd_m|ul", the|
|00004190| 72 65 20 61 72 65 20 74 | 77 6f 20 61 72 67 75 6d |re are t|wo argum|
|000041a0| 65 6e 74 73 2c 0a 58 09 | 77 68 69 63 68 20 61 72 |ents,.X.|which ar|
|000041b0| 65 20 74 68 65 20 74 77 | 6f 20 6e 75 6d 62 65 72 |e the tw|o number|
|000041c0| 73 2e 20 20 54 68 65 20 | 6f 72 64 65 72 20 6f 66 |s. The |order of|
|000041d0| 20 74 68 65 20 61 72 67 | 75 6d 65 6e 74 73 20 69 | the arg|uments i|
|000041e0| 73 20 61 6c 77 61 79 73 | 0a 58 09 74 68 65 20 6f |s always|.X.the o|
|000041f0| 72 64 65 72 20 6f 66 20 | 74 68 65 20 62 69 6e 61 |rder of |the bina|
|00004200| 72 79 20 6f 70 65 72 61 | 6e 64 73 2e 20 20 49 66 |ry opera|nds. If|
|00004210| 20 6f 6e 6c 79 20 6f 6e | 65 20 6f 66 20 74 68 65 | only on|e of the|
|00004220| 20 6f 70 65 72 61 6e 64 | 73 20 74 6f 0a 58 09 61 | operand|s to.X.a|
|00004230| 20 62 69 6e 61 72 79 20 | 6f 70 65 72 61 74 6f 72 | binary |operator|
|00004240| 20 69 73 20 61 6e 20 6f | 62 6a 65 63 74 2c 20 74 | is an o|bject, t|
|00004250| 68 65 6e 20 74 68 65 20 | 75 73 65 72 20 66 75 6e |hen the |user fun|
|00004260| 63 74 69 6f 6e 20 66 6f | 72 20 74 68 61 74 0a 58 |ction fo|r that.X|
|00004270| 09 6f 62 6a 65 63 74 20 | 74 79 70 65 20 69 73 20 |.object |type is |
|00004280| 73 74 69 6c 6c 20 63 61 | 6c 6c 65 64 2e 20 20 49 |still ca|lled. I|
|00004290| 66 20 74 68 65 20 74 77 | 6f 20 6f 70 65 72 61 6e |f the tw|o operan|
|000042a0| 64 73 20 61 72 65 20 6f | 66 20 64 69 66 66 65 72 |ds are o|f differ|
|000042b0| 65 6e 74 0a 58 09 6f 62 | 6a 65 63 74 20 74 79 70 |ent.X.ob|ject typ|
|000042c0| 65 73 2c 20 74 68 65 6e | 20 74 68 65 20 75 73 65 |es, then| the use|
|000042d0| 72 20 66 75 6e 63 74 69 | 6f 6e 20 74 68 61 74 20 |r functi|on that |
|000042e0| 69 73 20 63 61 6c 6c 65 | 64 20 69 73 20 74 68 65 |is calle|d is the|
|000042f0| 20 6f 6e 65 20 66 6f 72 | 0a 58 09 74 68 65 20 66 | one for|.X.the f|
|00004300| 69 72 73 74 20 6f 70 65 | 72 61 6e 64 2e 0a 58 0a |irst ope|rand..X.|
|00004310| 58 09 54 68 65 20 61 62 | 6f 76 65 20 72 75 6c 65 |X.The ab|ove rule|
|00004320| 73 20 6d 65 61 6e 20 74 | 68 61 74 20 66 6f 72 20 |s mean t|hat for |
|00004330| 66 75 6c 6c 20 67 65 6e | 65 72 61 6c 69 74 79 2c |full gen|erality,|
|00004340| 20 75 73 65 72 20 66 75 | 6e 63 74 69 6f 6e 73 0a | user fu|nctions.|
|00004350| 58 09 73 68 6f 75 6c 64 | 20 64 65 74 65 63 74 20 |X.should| detect |
|00004360| 74 68 61 74 20 6f 6e 65 | 20 6f 66 20 74 68 65 69 |that one| of thei|
|00004370| 72 20 61 72 67 75 6d 65 | 6e 74 73 20 69 73 20 6e |r argume|nts is n|
|00004380| 6f 74 20 6f 66 20 69 74 | 73 20 6f 77 6e 20 6f 62 |ot of it|s own ob|
|00004390| 6a 65 63 74 0a 58 09 74 | 79 70 65 20 62 79 20 75 |ject.X.t|ype by u|
|000043a0| 73 69 6e 67 20 74 68 65 | 20 27 69 73 74 79 70 65 |sing the| 'istype|
|000043b0| 27 20 66 75 6e 63 74 69 | 6f 6e 2c 20 61 6e 64 20 |' functi|on, and |
|000043c0| 74 68 65 6e 20 68 61 6e | 64 6c 65 20 74 68 65 73 |then han|dle thes|
|000043d0| 65 20 63 61 73 65 73 0a | 58 09 73 70 65 63 69 61 |e cases.|X.specia|
|000043e0| 6c 6c 79 2e 20 20 49 6e | 20 74 68 69 73 20 77 61 |lly. In| this wa|
|000043f0| 79 2c 20 75 73 65 72 73 | 20 63 61 6e 20 6d 69 78 |y, users| can mix|
|00004400| 20 6e 6f 72 6d 61 6c 20 | 6e 75 6d 62 65 72 73 20 | normal |numbers |
|00004410| 77 69 74 68 20 6f 62 6a | 65 63 74 0a 58 09 74 79 |with obj|ect.X.ty|
|00004420| 70 65 73 2e 20 20 28 46 | 75 6e 63 74 69 6f 6e 73 |pes. (F|unctions|
|00004430| 20 77 68 69 63 68 20 6f | 6e 6c 79 20 68 61 76 65 | which o|nly have|
|00004440| 20 6f 6e 65 20 6f 70 65 | 72 61 6e 64 20 64 6f 6e | one ope|rand don|
|00004450| 27 74 20 68 61 76 65 20 | 74 6f 20 77 6f 72 72 79 |'t have |to worry|
|00004460| 0a 58 09 61 62 6f 75 74 | 20 74 68 69 73 2e 29 20 |.X.about| this.) |
|00004470| 20 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 65 | The fol|lowing e|
|00004480| 78 61 6d 70 6c 65 20 6f | 66 20 22 73 75 72 64 5f |xample o|f "surd_|
|00004490| 6d 75 6c 22 20 64 65 6d | 6f 6e 73 74 72 61 74 65 |mul" dem|onstrate|
|000044a0| 73 20 68 6f 77 0a 58 09 | 74 6f 20 68 61 6e 64 6c |s how.X.|to handl|
|000044b0| 65 20 72 65 67 75 6c 61 | 72 20 6e 75 6d 62 65 72 |e regula|r number|
|000044c0| 73 20 77 68 65 6e 20 75 | 73 65 64 20 74 6f 67 65 |s when u|sed toge|
|000044d0| 74 68 65 72 20 77 69 74 | 68 20 73 75 72 64 73 3a |ther wit|h surds:|
|000044e0| 0a 58 0a 58 09 09 64 65 | 66 69 6e 65 20 73 75 72 |.X.X..de|fine sur|
|000044f0| 64 5f 6d 75 6c 28 61 2c | 20 62 29 0a 58 09 09 7b |d_mul(a,| b).X..{|
|00004500| 0a 58 09 09 09 6c 6f 63 | 61 6c 20 78 3b 0a 58 0a |.X...loc|al x;.X.|
|00004510| 58 09 09 09 6f 62 6a 20 | 73 75 72 64 20 78 3b 0a |X...obj |surd x;.|
|00004520| 58 09 09 09 69 66 20 28 | 21 69 73 74 79 70 65 28 |X...if (|!istype(|
|00004530| 61 2c 20 78 29 29 20 7b | 09 0a 58 09 09 09 09 2f |a, x)) {|..X..../|
|00004540| 2a 20 61 20 6e 6f 74 20 | 6f 66 20 74 79 70 65 20 |* a not |of type |
|00004550| 73 75 72 64 20 2a 2f 0a | 58 09 09 09 09 78 2e 61 |surd */.|X....x.a|
|00004560| 20 3d 20 62 2e 61 20 2a | 20 61 3b 0a 58 09 09 09 | = b.a *| a;.X...|
|00004570| 09 78 2e 62 20 3d 20 62 | 2e 62 20 2a 20 61 3b 0a |.x.b = b|.b * a;.|
|00004580| 58 09 09 09 7d 20 65 6c | 73 65 20 69 66 20 28 21 |X...} el|se if (!|
|00004590| 69 73 74 79 70 65 28 62 | 2c 20 78 29 29 20 7b 0a |istype(b|, x)) {.|
|000045a0| 58 09 09 09 09 2f 2a 20 | 62 20 6e 6f 74 20 6f 66 |X..../* |b not of|
|000045b0| 20 74 79 70 65 20 73 75 | 72 64 20 2a 2f 0a 58 09 | type su|rd */.X.|
|000045c0| 09 09 09 78 2e 61 20 3d | 20 61 2e 61 20 2a 20 62 |...x.a =| a.a * b|
|000045d0| 3b 0a 58 09 09 09 09 78 | 2e 62 20 3d 20 61 2e 62 |;.X....x|.b = a.b|
|000045e0| 20 2a 20 62 3b 0a 58 09 | 09 09 7d 20 65 6c 73 65 | * b;.X.|..} else|
|000045f0| 20 7b 09 09 09 0a 58 09 | 09 09 09 2f 2a 20 62 6f | {....X.|.../* bo|
|00004600| 74 68 20 61 72 65 20 73 | 75 72 64 73 20 2a 2f 0a |th are s|urds */.|
|00004610| 58 09 09 09 09 78 2e 61 | 20 3d 20 61 2e 61 20 2a |X....x.a| = a.a *|
|00004620| 20 62 2e 61 20 2b 20 44 | 20 2a 20 61 2e 62 20 2a | b.a + D| * a.b *|
|00004630| 20 62 2e 62 3b 0a 58 09 | 09 09 09 78 2e 62 20 3d | b.b;.X.|...x.b =|
|00004640| 20 61 2e 61 20 2a 20 62 | 2e 62 20 2b 20 61 2e 62 | a.a * b|.b + a.b|
|00004650| 20 2a 20 62 2e 61 3b 0a | 58 09 09 09 7d 0a 58 09 | * b.a;.|X...}.X.|
|00004660| 09 09 69 66 20 28 78 2e | 62 20 3d 3d 20 30 29 0a |..if (x.|b == 0).|
|00004670| 58 09 09 09 09 72 65 74 | 75 72 6e 20 78 2e 61 3b |X....ret|urn x.a;|
|00004680| 09 2f 2a 20 6e 6f 72 6d | 61 6c 20 6e 75 6d 62 65 |./* norm|al numbe|
|00004690| 72 20 2a 2f 0a 58 09 09 | 09 72 65 74 75 72 6e 20 |r */.X..|.return |
|000046a0| 78 3b 09 09 2f 2a 20 72 | 65 74 75 72 6e 20 73 75 |x;../* r|eturn su|
|000046b0| 72 64 20 2a 2f 0a 58 09 | 09 7d 0a 58 0a 58 09 49 |rd */.X.|.}.X.X.I|
|000046c0| 6e 20 6f 72 64 65 72 20 | 74 6f 20 70 72 69 6e 74 |n order |to print|
|000046d0| 20 74 68 65 20 76 61 6c | 75 65 20 6f 66 20 61 6e | the val|ue of an|
|000046e0| 20 6f 62 6a 65 63 74 20 | 6e 69 63 65 6c 79 2c 20 | object |nicely, |
|000046f0| 61 20 75 73 65 72 20 64 | 65 66 69 6e 65 64 0a 58 |a user d|efined.X|
|00004700| 09 72 6f 75 74 69 6e 65 | 20 63 61 6e 20 62 65 20 |.routine| can be |
|00004710| 70 72 6f 76 69 64 65 64 | 2e 20 20 46 6f 72 20 73 |provided|. For s|
|00004720| 6d 61 6c 6c 20 61 6d 6f | 75 6e 74 73 20 6f 66 20 |mall amo|unts of |
|00004730| 6f 75 74 70 75 74 2c 20 | 74 68 65 20 70 72 69 6e |output, |the prin|
|00004740| 74 0a 58 09 72 6f 75 74 | 69 6e 65 20 73 68 6f 75 |t.X.rout|ine shou|
|00004750| 6c 64 20 6e 6f 74 20 70 | 72 69 6e 74 20 61 20 6e |ld not p|rint a n|
|00004760| 65 77 6c 69 6e 65 2e 20 | 20 41 6c 73 6f 2c 20 69 |ewline. | Also, i|
|00004770| 74 20 69 73 20 6d 6f 73 | 74 20 63 6f 6e 76 65 6e |t is mos|t conven|
|00004780| 69 65 6e 74 0a 58 09 69 | 66 20 74 68 65 20 70 72 |ient.X.i|f the pr|
|00004790| 69 6e 74 65 64 20 6f 62 | 6a 65 63 74 20 6c 6f 6f |inted ob|ject loo|
|000047a0| 6b 73 20 6c 69 6b 65 20 | 74 68 65 20 63 61 6c 6c |ks like |the call|
|000047b0| 20 74 6f 20 74 68 65 20 | 63 72 65 61 74 69 6f 6e | to the |creation|
|000047c0| 20 72 6f 75 74 69 6e 65 | 2e 0a 58 09 46 6f 72 20 | routine|..X.For |
|000047d0| 6f 75 74 70 75 74 20 74 | 6f 20 62 65 20 63 6f 72 |output t|o be cor|
|000047e0| 72 65 63 74 6c 79 20 63 | 6f 6c 6c 65 63 74 65 64 |rectly c|ollected|
|000047f0| 20 77 69 74 68 69 6e 20 | 6e 65 73 74 65 64 20 6f | within |nested o|
|00004800| 75 74 70 75 74 20 63 61 | 6c 6c 73 2c 0a 58 09 6f |utput ca|lls,.X.o|
|00004810| 75 74 70 75 74 20 73 68 | 6f 75 6c 64 20 6f 6e 6c |utput sh|ould onl|
|00004820| 79 20 67 6f 20 74 6f 20 | 73 74 64 6f 75 74 2e 20 |y go to |stdout. |
|00004830| 20 54 68 69 73 20 6d 65 | 61 6e 73 20 75 73 65 20 | This me|ans use |
|00004840| 74 68 65 20 27 70 72 69 | 6e 74 27 0a 58 09 73 74 |the 'pri|nt'.X.st|
|00004850| 61 74 65 6d 65 6e 74 2c | 20 74 68 65 20 27 70 72 |atement,| the 'pr|
|00004860| 69 6e 74 66 27 20 66 75 | 6e 63 74 69 6f 6e 2c 20 |intf' fu|nction, |
|00004870| 6f 72 20 74 68 65 20 27 | 66 70 72 69 6e 74 66 27 |or the '|fprintf'|
|00004880| 20 66 75 6e 63 74 69 6f | 6e 20 77 69 74 68 0a 58 | functio|n with.X|
|00004890| 09 27 66 69 6c 65 73 28 | 31 29 27 20 61 73 20 74 |.'files(|1)' as t|
|000048a0| 68 65 20 6f 75 74 70 75 | 74 20 66 69 6c 65 2e 20 |he outpu|t file. |
|000048b0| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 20 66 6f | For exa|mple, fo|
|000048c0| 72 20 74 68 65 20 22 73 | 75 72 64 22 20 6f 62 6a |r the "s|urd" obj|
|000048d0| 65 63 74 3a 0a 58 0a 58 | 09 09 64 65 66 69 6e 65 |ect:.X.X|..define|
|000048e0| 20 73 75 72 64 5f 70 72 | 69 6e 74 28 61 29 0a 58 | surd_pr|int(a).X|
|000048f0| 09 09 7b 0a 58 09 09 09 | 70 72 69 6e 74 20 22 73 |..{.X...|print "s|
|00004900| 75 72 64 28 22 20 3a 20 | 61 2e 61 20 3a 20 22 2c |urd(" : |a.a : ",|
|00004910| 22 20 3a 20 61 2e 62 20 | 3a 20 22 29 22 20 3a 20 |" : a.b |: ")" : |
|00004920| 3b 0a 58 09 09 7d 0a 58 | 0a 58 09 49 74 20 69 73 |;.X..}.X|.X.It is|
|00004930| 20 6e 6f 74 20 6e 65 63 | 65 73 73 61 72 79 20 74 | not nec|essary t|
|00004940| 6f 20 70 72 6f 76 69 64 | 65 20 72 6f 75 74 69 6e |o provid|e routin|
|00004950| 65 73 20 66 6f 72 20 61 | 6c 6c 20 70 6f 73 73 69 |es for a|ll possi|
|00004960| 62 6c 65 20 6f 70 65 72 | 61 74 69 6f 6e 73 0a 58 |ble oper|ations.X|
|00004970| 09 66 6f 72 20 61 6e 20 | 6f 62 6a 65 63 74 2c 20 |.for an |object, |
|00004980| 69 66 20 74 68 6f 73 65 | 20 6f 70 65 72 61 74 69 |if those| operati|
|00004990| 6f 6e 73 20 63 61 6e 20 | 62 65 20 64 65 66 61 75 |ons can |be defau|
|000049a0| 6c 74 65 64 20 6f 72 20 | 64 6f 20 6e 6f 74 20 6d |lted or |do not m|
|000049b0| 61 6b 65 0a 58 09 73 65 | 6e 73 65 20 66 6f 72 20 |ake.X.se|nse for |
|000049c0| 74 68 65 20 6f 62 6a 65 | 63 74 2e 20 20 54 68 65 |the obje|ct. The|
|000049d0| 20 63 61 6c 63 75 6c 61 | 74 6f 72 20 77 69 6c 6c | calcula|tor will|
|000049e0| 20 61 74 74 65 6d 70 74 | 20 6d 65 61 6e 69 6e 67 | attempt| meaning|
|000049f0| 66 75 6c 0a 58 09 64 65 | 66 61 75 6c 74 73 20 66 |ful.X.de|faults f|
|00004a00| 6f 72 20 6d 61 6e 79 20 | 6f 70 65 72 61 74 69 6f |or many |operatio|
|00004a10| 6e 73 20 69 66 20 74 68 | 65 79 20 61 72 65 20 6e |ns if th|ey are n|
|00004a20| 6f 74 20 64 65 66 69 6e | 65 64 2e 20 20 46 6f 72 |ot defin|ed. For|
|00004a30| 20 65 78 61 6d 70 6c 65 | 2c 0a 58 09 69 66 20 27 | example|,.X.if '|
|00004a40| 73 75 72 64 5f 73 71 75 | 61 72 65 27 20 69 73 20 |surd_squ|are' is |
|00004a50| 6e 6f 74 20 64 65 66 69 | 6e 65 64 20 74 6f 20 73 |not defi|ned to s|
|00004a60| 71 75 61 72 65 20 61 20 | 6e 75 6d 62 65 72 2c 20 |quare a |number, |
|00004a70| 74 68 65 6e 20 27 73 75 | 72 64 5f 6d 75 6c 27 0a |then 'su|rd_mul'.|
|00004a80| 58 09 77 69 6c 6c 20 62 | 65 20 63 61 6c 6c 65 64 |X.will b|e called|
|00004a90| 20 74 6f 20 70 65 72 66 | 6f 72 6d 20 74 68 65 20 | to perf|orm the |
|00004aa0| 73 71 75 61 72 69 6e 67 | 2e 20 20 57 68 65 6e 20 |squaring|. When |
|00004ab0| 61 20 64 65 66 61 75 6c | 74 20 69 73 20 6e 6f 74 |a defaul|t is not|
|00004ac0| 0a 58 09 70 6f 73 73 69 | 62 6c 65 2c 20 74 68 65 |.X.possi|ble, the|
|00004ad0| 6e 20 61 6e 20 65 72 72 | 6f 72 20 77 69 6c 6c 20 |n an err|or will |
|00004ae0| 62 65 20 67 65 6e 65 72 | 61 74 65 64 2e 0a 58 0a |be gener|ated..X.|
|00004af0| 58 09 50 6c 65 61 73 65 | 20 6e 6f 74 65 3a 20 41 |X.Please| note: A|
|00004b00| 72 67 75 6d 65 6e 74 73 | 20 74 6f 20 6f 62 6a 65 |rguments| to obje|
|00004b10| 63 74 20 66 75 6e 63 74 | 69 6f 6e 73 20 61 72 65 |ct funct|ions are|
|00004b20| 20 61 6c 77 61 79 73 20 | 70 61 73 73 65 64 20 62 | always |passed b|
|00004b30| 79 0a 58 09 72 65 66 65 | 72 65 6e 63 65 20 28 61 |y.X.refe|rence (a|
|00004b40| 73 20 69 66 20 61 6e 20 | 27 26 27 20 77 61 73 20 |s if an |'&' was |
|00004b50| 73 70 65 63 69 66 69 65 | 64 20 66 6f 72 20 65 61 |specifie|d for ea|
|00004b60| 63 68 20 76 61 72 69 61 | 62 6c 65 20 69 6e 20 74 |ch varia|ble in t|
|00004b70| 68 65 20 63 61 6c 6c 29 | 2e 0a 58 09 54 68 65 72 |he call)|..X.Ther|
|00004b80| 65 66 6f 72 65 2c 20 74 | 68 65 20 66 75 6e 63 74 |efore, t|he funct|
|00004b90| 69 6f 6e 20 73 68 6f 75 | 6c 64 20 6e 6f 74 20 6d |ion shou|ld not m|
|00004ba0| 6f 64 69 66 79 20 74 68 | 65 20 70 61 72 61 6d 65 |odify th|e parame|
|00004bb0| 74 65 72 73 2c 20 62 75 | 74 20 73 68 6f 75 6c 64 |ters, bu|t should|
|00004bc0| 0a 58 09 63 6f 70 79 20 | 74 68 65 6d 20 69 6e 74 |.X.copy |them int|
|00004bd0| 6f 20 6c 6f 63 61 6c 20 | 76 61 72 69 61 62 6c 65 |o local |variable|
|00004be0| 73 20 62 65 66 6f 72 65 | 20 6d 6f 64 69 66 79 69 |s before| modifyi|
|00004bf0| 6e 67 20 74 68 65 6d 2e | 20 20 54 68 69 73 20 69 |ng them.| This i|
|00004c00| 73 20 64 6f 6e 65 0a 58 | 09 69 6e 20 6f 72 64 65 |s done.X|.in orde|
|00004c10| 72 20 74 6f 20 6d 61 6b | 65 20 6f 62 6a 65 63 74 |r to mak|e object|
|00004c20| 20 63 61 6c 6c 73 20 71 | 75 69 63 6b 65 72 20 69 | calls q|uicker i|
|00004c30| 6e 20 67 65 6e 65 72 61 | 6c 2e 0a 58 0a 58 09 54 |n genera|l..X.X.T|
|00004c40| 68 65 20 64 6f 75 62 6c | 65 2d 62 72 61 63 6b 65 |he doubl|e-bracke|
|00004c50| 74 20 6f 70 65 72 61 74 | 6f 72 20 63 61 6e 20 62 |t operat|or can b|
|00004c60| 65 20 75 73 65 64 20 74 | 6f 20 72 65 66 65 72 65 |e used t|o refere|
|00004c70| 6e 63 65 20 74 68 65 20 | 65 6c 65 6d 65 6e 74 73 |nce the |elements|
|00004c80| 0a 58 09 6f 66 20 61 6e | 79 20 6f 62 6a 65 63 74 |.X.of an|y object|
|00004c90| 20 69 6e 20 61 20 67 65 | 6e 65 72 69 63 20 6d 61 | in a ge|neric ma|
|00004ca0| 6e 6e 65 72 2e 20 20 57 | 68 65 6e 20 74 68 69 73 |nner. W|hen this|
|00004cb0| 20 69 73 20 64 6f 6e 65 | 2c 20 69 6e 64 65 78 20 | is done|, index |
|00004cc0| 30 0a 58 09 63 6f 72 72 | 65 73 70 6f 6e 64 73 20 |0.X.corr|esponds |
|00004cd0| 74 6f 20 74 68 65 20 66 | 69 72 73 74 20 65 6c 65 |to the f|irst ele|
|00004ce0| 6d 65 6e 74 20 6e 61 6d | 65 2c 20 69 6e 64 65 78 |ment nam|e, index|
|00004cf0| 20 31 20 74 6f 20 74 68 | 65 20 73 65 63 6f 6e 64 | 1 to th|e second|
|00004d00| 20 6e 61 6d 65 2c 0a 58 | 09 61 6e 64 20 73 6f 20 | name,.X|.and so |
|00004d10| 6f 6e 2e 20 20 54 68 65 | 20 27 73 69 7a 65 27 20 |on. The| 'size' |
|00004d20| 66 75 6e 63 74 69 6f 6e | 20 77 69 6c 6c 20 72 65 |function| will re|
|00004d30| 74 75 72 6e 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |turn the| number |
|00004d40| 6f 66 20 65 6c 65 6d 65 | 6e 74 73 0a 58 09 69 6e |of eleme|nts.X.in|
|00004d50| 20 61 6e 20 6f 62 6a 65 | 63 74 2e 0a 58 0a 58 09 | an obje|ct..X.X.|
|00004d60| 54 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 69 73 |The foll|owing is|
|00004d70| 20 61 20 6c 69 73 74 20 | 6f 66 20 74 68 65 20 6f | a list |of the o|
|00004d80| 70 65 72 61 74 69 6f 6e | 73 20 70 6f 73 73 69 62 |peration|s possib|
|00004d90| 6c 65 20 66 6f 72 20 6f | 62 6a 65 63 74 73 2e 0a |le for o|bjects..|
|00004da0| 58 09 54 68 65 20 27 78 | 78 27 20 69 6e 20 65 61 |X.The 'x|x' in ea|
|00004db0| 63 68 20 66 75 6e 63 74 | 69 6f 6e 20 6e 61 6d 65 |ch funct|ion name|
|00004dc0| 20 69 73 20 72 65 70 6c | 61 63 65 64 20 77 69 74 | is repl|aced wit|
|00004dd0| 68 20 74 68 65 20 61 63 | 74 75 61 6c 20 6f 62 6a |h the ac|tual obj|
|00004de0| 65 63 74 0a 58 09 74 79 | 70 65 20 6e 61 6d 65 2e |ect.X.ty|pe name.|
|00004df0| 20 20 54 68 69 73 20 74 | 61 62 6c 65 20 69 73 20 | This t|able is |
|00004e00| 64 69 73 70 6c 61 79 65 | 64 20 62 79 20 74 68 65 |displaye|d by the|
|00004e10| 20 27 73 68 6f 77 20 6f | 62 6a 66 75 6e 63 73 27 | 'show o|bjfuncs'|
|00004e20| 20 63 6f 6d 6d 61 6e 64 | 2e 0a 58 0a 58 09 09 4e | command|..X.X..N|
|00004e30| 61 6d 65 09 41 72 67 73 | 09 43 6f 6d 6d 65 6e 74 |ame.Args|.Comment|
|00004e40| 73 0a 58 0a 58 09 09 78 | 78 5f 70 72 69 6e 74 20 |s.X.X..x|x_print |
|00004e50| 20 20 20 31 09 70 72 69 | 6e 74 20 76 61 6c 75 65 | 1.pri|nt value|
|00004e60| 2c 20 64 65 66 61 75 6c | 74 20 70 72 69 6e 74 73 |, defaul|t prints|
|00004e70| 20 65 6c 65 6d 65 6e 74 | 73 0a 58 09 09 78 78 5f | element|s.X..xx_|
|00004e80| 6f 6e 65 20 20 20 20 20 | 20 31 09 6d 75 6c 74 69 |one | 1.multi|
|00004e90| 70 6c 69 63 61 74 69 76 | 65 20 69 64 65 6e 74 69 |plicativ|e identi|
|00004ea0| 74 79 2c 20 64 65 66 61 | 75 6c 74 20 69 73 20 31 |ty, defa|ult is 1|
|00004eb0| 0a 58 09 09 78 78 5f 74 | 65 73 74 20 20 20 20 20 |.X..xx_t|est |
|00004ec0| 31 09 6c 6f 67 69 63 61 | 6c 20 74 65 73 74 20 28 |1.logica|l test (|
|00004ed0| 66 61 6c 73 65 2c 74 72 | 75 65 20 3d 3e 20 30 2c |false,tr|ue => 0,|
|00004ee0| 31 29 2c 20 0a 58 09 09 | 09 09 20 20 20 20 64 65 |1), .X..|.. de|
|00004ef0| 66 61 75 6c 74 20 74 65 | 73 74 73 20 65 6c 65 6d |fault te|sts elem|
|00004f00| 65 6e 74 73 0a 58 09 09 | 78 78 5f 61 64 64 20 20 |ents.X..|xx_add |
|00004f10| 20 20 20 20 32 09 0a 58 | 09 09 78 78 5f 73 75 62 | 2..X|..xx_sub|
|00004f20| 20 20 20 20 20 20 32 09 | 73 75 62 74 72 61 63 74 | 2.|subtract|
|00004f30| 69 6f 6e 2c 20 64 65 66 | 61 75 6c 74 20 61 64 64 |ion, def|ault add|
|00004f40| 73 20 6e 65 67 61 74 69 | 76 65 0a 58 09 09 78 78 |s negati|ve.X..xx|
|00004f50| 5f 6e 65 67 20 20 20 20 | 20 20 31 09 6e 65 67 61 |_neg | 1.nega|
|00004f60| 74 69 76 65 0a 58 09 09 | 78 78 5f 6d 75 6c 20 20 |tive.X..|xx_mul |
|00004f70| 20 20 20 20 32 09 0a 58 | 09 09 78 78 5f 64 69 76 | 2..X|..xx_div|
|00004f80| 20 20 20 20 20 20 32 09 | 6e 6f 6e 2d 69 6e 74 65 | 2.|non-inte|
|00004f90| 67 72 61 6c 20 64 69 76 | 69 73 69 6f 6e 2c 20 64 |gral div|ision, d|
|00004fa0| 65 66 61 75 6c 74 20 6d | 75 6c 74 69 70 6c 69 65 |efault m|ultiplie|
|00004fb0| 73 20 0a 58 09 09 09 09 | 20 20 20 20 62 79 20 69 |s .X....| by i|
|00004fc0| 6e 76 65 72 73 65 0a 58 | 09 09 78 78 5f 69 6e 76 |nverse.X|..xx_inv|
|00004fd0| 20 20 20 20 20 20 31 09 | 6d 75 6c 74 69 70 6c 69 | 1.|multipli|
|00004fe0| 63 61 74 69 76 65 20 69 | 6e 76 65 72 73 65 0a 58 |cative i|nverse.X|
|00004ff0| 09 09 78 78 5f 61 62 73 | 20 20 20 20 20 20 32 09 |..xx_abs| 2.|
|00005000| 61 62 73 6f 6c 75 74 65 | 20 76 61 6c 75 65 20 77 |absolute| value w|
|00005010| 69 74 68 69 6e 20 67 69 | 76 65 6e 20 65 72 72 6f |ithin gi|ven erro|
|00005020| 72 0a 58 09 09 78 78 5f | 6e 6f 72 6d 20 20 20 20 |r.X..xx_|norm |
|00005030| 20 31 09 73 71 75 61 72 | 65 20 6f 66 20 61 62 73 | 1.squar|e of abs|
|00005040| 6f 6c 75 74 65 20 76 61 | 6c 75 65 0a 58 09 09 78 |olute va|lue.X..x|
|00005050| 78 5f 63 6f 6e 6a 20 20 | 20 20 20 31 09 63 6f 6e |x_conj | 1.con|
|00005060| 6a 75 67 61 74 65 0a 58 | 09 09 78 78 5f 70 6f 77 |jugate.X|..xx_pow|
|00005070| 20 20 20 20 20 20 32 09 | 69 6e 74 65 67 65 72 20 | 2.|integer |
|00005080| 70 6f 77 65 72 2c 20 64 | 65 66 61 75 6c 74 20 64 |power, d|efault d|
|00005090| 6f 65 73 20 6d 75 6c 74 | 69 70 6c 79 2c 20 0a 58 |oes mult|iply, .X|
|000050a0| 09 09 09 09 20 20 20 20 | 73 71 75 61 72 65 2c 20 |.... |square, |
|000050b0| 69 6e 76 65 72 73 65 0a | 58 09 09 78 78 5f 73 67 |inverse.|X..xx_sg|
|000050c0| 6e 20 20 20 20 20 20 31 | 09 73 69 67 6e 20 6f 66 |n 1|.sign of|
|000050d0| 20 76 61 6c 75 65 20 28 | 2d 31 2c 20 30 2c 20 31 | value (|-1, 0, 1|
|000050e0| 29 0a 58 09 09 78 78 5f | 63 6d 70 20 20 20 20 20 |).X..xx_|cmp |
|000050f0| 20 32 09 65 71 75 61 6c | 69 74 79 20 28 65 71 75 | 2.equal|ity (equ|
|00005100| 61 6c 2c 6e 6f 6e 2d 65 | 71 75 61 6c 20 3d 3e 20 |al,non-e|qual => |
|00005110| 30 2c 31 29 2c 20 0a 58 | 09 09 09 09 20 20 20 20 |0,1), .X|.... |
|00005120| 64 65 66 61 75 6c 74 20 | 74 65 73 74 73 20 65 6c |default |tests el|
|00005130| 65 6d 65 6e 74 73 0a 58 | 09 09 78 78 5f 72 65 6c |ements.X|..xx_rel|
|00005140| 20 20 20 20 20 20 32 09 | 69 6e 65 71 75 61 6c 69 | 2.|inequali|
|00005150| 74 79 20 28 6c 65 73 73 | 2c 65 71 75 61 6c 2c 67 |ty (less|,equal,g|
|00005160| 72 65 61 74 65 72 20 3d | 3e 20 2d 31 2c 30 2c 31 |reater =|> -1,0,1|
|00005170| 29 0a 58 09 09 78 78 5f | 71 75 6f 20 20 20 20 20 |).X..xx_|quo |
|00005180| 20 32 09 69 6e 74 65 67 | 65 72 20 71 75 6f 74 69 | 2.integ|er quoti|
|00005190| 65 6e 74 0a 58 09 09 78 | 78 5f 6d 6f 64 20 20 20 |ent.X..x|x_mod |
|000051a0| 20 20 20 32 09 72 65 6d | 61 69 6e 64 65 72 20 6f | 2.rem|ainder o|
|000051b0| 66 20 64 69 76 69 73 69 | 6f 6e 0a 58 09 09 78 78 |f divisi|on.X..xx|
|000051c0| 5f 69 6e 74 20 20 20 20 | 20 20 31 09 69 6e 74 65 |_int | 1.inte|
|000051d0| 67 65 72 20 70 61 72 74 | 0a 58 09 09 78 78 5f 66 |ger part|.X..xx_f|
|000051e0| 72 61 63 20 20 20 20 20 | 31 09 66 72 61 63 74 69 |rac |1.fracti|
|000051f0| 6f 6e 61 6c 20 70 61 72 | 74 0a 58 09 09 78 78 5f |onal par|t.X..xx_|
|00005200| 69 6e 63 20 20 20 20 20 | 20 31 09 69 6e 63 72 65 |inc | 1.incre|
|00005210| 6d 65 6e 74 2c 20 64 65 | 66 61 75 6c 74 20 61 64 |ment, de|fault ad|
|00005220| 64 73 20 31 0a 58 09 09 | 78 78 5f 64 65 63 20 20 |ds 1.X..|xx_dec |
|00005230| 20 20 20 20 31 09 64 65 | 63 72 65 6d 65 6e 74 2c | 1.de|crement,|
|00005240| 20 64 65 66 61 75 6c 74 | 20 73 75 62 74 72 61 63 | default| subtrac|
|00005250| 74 73 20 31 0a 58 09 09 | 78 78 5f 73 71 75 61 72 |ts 1.X..|xx_squar|
|00005260| 65 20 20 20 31 09 64 65 | 66 61 75 6c 74 20 6d 75 |e 1.de|fault mu|
|00005270| 6c 74 69 70 6c 69 65 73 | 20 62 79 20 69 74 73 65 |ltiplies| by itse|
|00005280| 6c 66 0a 58 09 09 78 78 | 5f 73 63 61 6c 65 20 20 |lf.X..xx|_scale |
|00005290| 20 20 32 09 6d 75 6c 74 | 69 70 6c 79 20 62 79 20 | 2.mult|iply by |
|000052a0| 70 6f 77 65 72 20 6f 66 | 20 32 0a 58 09 09 78 78 |power of| 2.X..xx|
|000052b0| 5f 73 68 69 66 74 20 20 | 20 20 32 09 73 68 69 66 |_shift | 2.shif|
|000052c0| 74 20 6c 65 66 74 20 62 | 79 20 6e 20 62 69 74 73 |t left b|y n bits|
|000052d0| 20 28 72 69 67 68 74 20 | 69 66 20 6e 65 67 61 74 | (right |if negat|
|000052e0| 69 76 65 29 0a 58 09 09 | 78 78 5f 72 6f 75 6e 64 |ive).X..|xx_round|
|000052f0| 20 20 20 20 32 09 72 6f | 75 6e 64 20 74 6f 20 67 | 2.ro|und to g|
|00005300| 69 76 65 6e 20 6e 75 6d | 62 65 72 20 6f 66 20 64 |iven num|ber of d|
|00005310| 65 63 69 6d 61 6c 20 70 | 6c 61 63 65 73 0a 58 09 |ecimal p|laces.X.|
|00005320| 09 78 78 5f 62 72 6f 75 | 6e 64 20 20 20 32 09 72 |.xx_brou|nd 2.r|
|00005330| 6f 75 6e 64 20 74 6f 20 | 67 69 76 65 6e 20 6e 75 |ound to |given nu|
|00005340| 6d 62 65 72 20 6f 66 20 | 62 69 6e 61 72 79 20 70 |mber of |binary p|
|00005350| 6c 61 63 65 73 0a 58 09 | 09 78 78 5f 72 6f 6f 74 |laces.X.|.xx_root|
|00005360| 20 20 20 20 20 33 09 72 | 6f 6f 74 20 6f 66 20 76 | 3.r|oot of v|
|00005370| 61 6c 75 65 20 77 69 74 | 68 69 6e 20 67 69 76 65 |alue wit|hin give|
|00005380| 6e 20 65 72 72 6f 72 0a | 58 09 09 78 78 5f 73 71 |n error.|X..xx_sq|
|00005390| 72 74 20 20 20 20 20 32 | 09 73 71 75 61 72 65 20 |rt 2|.square |
|000053a0| 72 6f 6f 74 20 77 69 74 | 68 69 6e 20 67 69 76 65 |root wit|hin give|
|000053b0| 6e 20 65 72 72 6f 72 0a | 58 0a 58 0a 58 09 41 6c |n error.|X.X.X.Al|
|000053c0| 73 6f 20 73 65 65 20 74 | 68 65 20 6c 69 62 72 61 |so see t|he libra|
|000053d0| 72 79 20 66 69 6c 65 73 | 3a 0a 58 0a 58 09 09 64 |ry files|:.X.X..d|
|000053e0| 6d 73 2e 63 61 6c 0a 58 | 09 09 6d 6f 64 2e 63 61 |ms.cal.X|..mod.ca|
|000053f0| 6c 0a 58 09 09 70 6f 6c | 79 2e 63 61 6c 0a 58 09 |l.X..pol|y.cal.X.|
|00005400| 09 71 75 61 74 2e 63 61 | 6c 0a 58 09 09 73 75 72 |.quat.ca|l.X..sur|
|00005410| 64 2e 63 61 6c 0a 45 4e | 44 5f 4f 46 5f 46 49 4c |d.cal.EN|D_OF_FIL|
|00005420| 45 0a 69 66 20 74 65 73 | 74 20 36 36 38 32 20 2d |E.if tes|t 6682 -|
|00005430| 6e 65 20 60 77 63 20 2d | 63 20 3c 27 68 65 6c 70 |ne `wc -|c <'help|
|00005440| 2f 6f 62 6a 27 60 3b 20 | 74 68 65 6e 0a 20 20 20 |/obj'`; |then. |
|00005450| 20 65 63 68 6f 20 73 68 | 61 72 3a 20 5c 22 27 68 | echo sh|ar: \"'h|
|00005460| 65 6c 70 2f 6f 62 6a 27 | 5c 22 20 75 6e 70 61 63 |elp/obj'|\" unpac|
|00005470| 6b 65 64 20 77 69 74 68 | 20 77 72 6f 6e 67 20 73 |ked with| wrong s|
|00005480| 69 7a 65 21 0a 66 69 0a | 23 20 65 6e 64 20 6f 66 |ize!.fi.|# end of|
|00005490| 20 27 68 65 6c 70 2f 6f | 62 6a 27 0a 66 69 0a 69 | 'help/o|bj'.fi.i|
|000054a0| 66 20 74 65 73 74 20 2d | 66 20 27 6c 69 62 2f 65 |f test -|f 'lib/e|
|000054b0| 6c 6c 69 70 2e 63 61 6c | 27 20 2d 61 20 22 24 7b |llip.cal|' -a "${|
|000054c0| 31 7d 22 20 21 3d 20 22 | 2d 63 22 20 3b 20 74 68 |1}" != "|-c" ; th|
|000054d0| 65 6e 20 0a 20 20 65 63 | 68 6f 20 73 68 61 72 3a |en . ec|ho shar:|
|000054e0| 20 57 69 6c 6c 20 6e 6f | 74 20 63 6c 6f 62 62 65 | Will no|t clobbe|
|000054f0| 72 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |r existi|ng file |
|00005500| 5c 22 27 6c 69 62 2f 65 | 6c 6c 69 70 2e 63 61 6c |\"'lib/e|llip.cal|
|00005510| 27 5c 22 0a 65 6c 73 65 | 0a 65 63 68 6f 20 73 68 |'\".else|.echo sh|
|00005520| 61 72 3a 20 45 78 74 72 | 61 63 74 69 6e 67 20 5c |ar: Extr|acting \|
|00005530| 22 27 6c 69 62 2f 65 6c | 6c 69 70 2e 63 61 6c 27 |"'lib/el|lip.cal'|
|00005540| 5c 22 20 5c 28 35 30 32 | 37 20 63 68 61 72 61 63 |\" \(502|7 charac|
|00005550| 74 65 72 73 5c 29 0a 73 | 65 64 20 22 73 2f 5e 58 |ters\).s|ed "s/^X|
|00005560| 2f 2f 22 20 3e 27 6c 69 | 62 2f 65 6c 6c 69 70 2e |//" >'li|b/ellip.|
|00005570| 63 61 6c 27 20 3c 3c 27 | 45 4e 44 5f 4f 46 5f 46 |cal' <<'|END_OF_F|
|00005580| 49 4c 45 27 0a 58 2f 2a | 0a 58 20 2a 20 43 6f 70 |ILE'.X/*|.X * Cop|
|00005590| 79 72 69 67 68 74 20 28 | 63 29 20 31 39 39 32 20 |yright (|c) 1992 |
|000055a0| 44 61 76 69 64 20 49 2e | 20 42 65 6c 6c 0a 58 20 |David I.| Bell.X |
|000055b0| 2a 20 50 65 72 6d 69 73 | 73 69 6f 6e 20 69 73 20 |* Permis|sion is |
|000055c0| 67 72 61 6e 74 65 64 20 | 74 6f 20 75 73 65 2c 20 |granted |to use, |
|000055d0| 64 69 73 74 72 69 62 75 | 74 65 2c 20 6f 72 20 6d |distribu|te, or m|
|000055e0| 6f 64 69 66 79 20 74 68 | 69 73 20 73 6f 75 72 63 |odify th|is sourc|
|000055f0| 65 2c 0a 58 20 2a 20 70 | 72 6f 76 69 64 65 64 20 |e,.X * p|rovided |
|00005600| 74 68 61 74 20 74 68 69 | 73 20 63 6f 70 79 72 69 |that thi|s copyri|
|00005610| 67 68 74 20 6e 6f 74 69 | 63 65 20 72 65 6d 61 69 |ght noti|ce remai|
|00005620| 6e 73 20 69 6e 74 61 63 | 74 2e 0a 58 20 2a 0a 58 |ns intac|t..X *.X|
|00005630| 20 2a 20 41 74 74 65 6d | 70 74 20 74 6f 20 66 61 | * Attem|pt to fa|
|00005640| 63 74 6f 72 20 6e 75 6d | 62 65 72 73 20 75 73 69 |ctor num|bers usi|
|00005650| 6e 67 20 65 6c 6c 69 70 | 74 69 63 20 66 75 6e 63 |ng ellip|tic func|
|00005660| 74 69 6f 6e 73 2e 0a 58 | 20 2a 20 09 79 5e 32 20 |tions..X| * .y^2 |
|00005670| 3d 20 78 5e 33 20 2b 20 | 61 2a 78 20 2b 20 62 20 |= x^3 + |a*x + b |
|00005680| 20 20 28 6d 6f 64 20 4e | 29 2e 0a 58 20 2a 0a 58 | (mod N|)..X *.X|
|00005690| 20 2a 20 4d 61 6e 79 20 | 70 6f 69 6e 74 73 20 28 | * Many |points (|
|000056a0| 78 2c 79 29 20 28 6d 6f | 64 20 4e 29 20 61 72 65 |x,y) (mo|d N) are|
|000056b0| 20 66 6f 75 6e 64 20 74 | 68 61 74 20 73 6f 6c 76 | found t|hat solv|
|000056c0| 65 20 74 68 65 20 61 62 | 6f 76 65 20 65 71 75 61 |e the ab|ove equa|
|000056d0| 74 69 6f 6e 2c 0a 58 20 | 2a 20 73 74 61 72 74 69 |tion,.X |* starti|
|000056e0| 6e 67 20 66 72 6f 6d 20 | 61 20 74 72 69 76 69 61 |ng from |a trivia|
|000056f0| 6c 20 73 6f 6c 75 74 69 | 6f 6e 20 61 6e 64 20 27 |l soluti|on and '|
|00005700| 6d 75 6c 74 69 70 6c 79 | 69 6e 67 27 20 74 68 61 |multiply|ing' tha|
|00005710| 74 20 70 6f 69 6e 74 20 | 74 6f 67 65 74 68 65 72 |t point |together|
|00005720| 0a 58 20 2a 20 74 6f 20 | 67 65 6e 65 72 61 74 65 |.X * to |generate|
|00005730| 20 68 69 67 68 20 70 6f | 77 65 72 73 20 6f 66 20 | high po|wers of |
|00005740| 74 68 65 20 70 6f 69 6e | 74 2c 20 6c 6f 6f 6b 69 |the poin|t, looki|
|00005750| 6e 67 20 66 6f 72 20 73 | 75 63 68 20 61 20 70 6f |ng for s|uch a po|
|00005760| 69 6e 74 20 77 68 6f 73 | 65 0a 58 20 2a 20 6f 72 |int whos|e.X * or|
|00005770| 64 65 72 20 63 6f 6e 74 | 61 69 6e 73 20 61 20 63 |der cont|ains a c|
|00005780| 6f 6d 6d 6f 6e 20 66 61 | 63 74 6f 72 20 77 69 74 |ommon fa|ctor wit|
|00005790| 68 20 4e 2e 20 20 54 68 | 65 20 6f 72 64 65 72 20 |h N. Th|e order |
|000057a0| 6f 66 20 74 68 65 20 67 | 72 6f 75 70 20 6f 66 20 |of the g|roup of |
|000057b0| 70 6f 69 6e 74 73 0a 58 | 20 2a 20 76 61 72 69 65 |points.X| * varie|
|000057c0| 73 20 61 6c 6d 6f 73 74 | 20 72 61 6e 64 6f 6d 6c |s almost| randoml|
|000057d0| 79 20 77 69 74 68 69 6e | 20 61 20 63 65 72 74 61 |y within| a certa|
|000057e0| 69 6e 20 69 6e 74 65 72 | 76 61 6c 20 66 6f 72 20 |in inter|val for |
|000057f0| 65 61 63 68 20 63 68 6f | 69 63 65 20 6f 66 20 61 |each cho|ice of a|
|00005800| 0a 58 20 2a 20 61 6e 64 | 20 62 2c 20 61 6e 64 20 |.X * and| b, and |
|00005810| 74 68 75 73 20 65 61 63 | 68 20 63 68 6f 69 63 65 |thus eac|h choice|
|00005820| 20 70 72 6f 76 69 64 65 | 73 20 61 6e 20 69 6e 64 | provide|s an ind|
|00005830| 65 70 65 6e 64 65 6e 74 | 20 6f 70 70 6f 72 74 75 |ependent| opportu|
|00005840| 6e 69 74 79 20 74 6f 0a | 58 20 2a 20 66 61 63 74 |nity to.|X * fact|
|00005850| 6f 72 20 4e 2e 20 20 54 | 6f 20 67 65 6e 65 72 61 |or N. T|o genera|
|00005860| 74 65 20 61 20 74 72 69 | 76 69 61 6c 20 73 6f 6c |te a tri|vial sol|
|00005870| 75 74 69 6f 6e 2c 20 61 | 20 69 73 20 63 68 6f 73 |ution, a| is chos|
|00005880| 65 6e 20 61 6e 64 20 74 | 68 65 6e 20 62 20 69 73 |en and t|hen b is|
|00005890| 0a 58 20 2a 20 73 65 6c | 65 63 74 65 64 20 73 6f |.X * sel|ected so|
|000058a0| 20 74 68 61 74 20 28 31 | 2c 31 29 20 69 73 20 61 | that (1|,1) is a|
|000058b0| 20 73 6f 6c 75 74 69 6f | 6e 2e 20 20 54 68 65 20 | solutio|n. The |
|000058c0| 6d 75 6c 74 69 70 6c 69 | 63 61 74 69 6f 6e 20 69 |multipli|cation i|
|000058d0| 73 20 64 6f 6e 65 20 75 | 73 69 6e 67 0a 58 20 2a |s done u|sing.X *|
|000058e0| 20 74 68 65 20 62 61 73 | 69 63 20 66 61 63 74 20 | the bas|ic fact |
|000058f0| 74 68 61 74 20 74 68 65 | 20 65 71 75 61 74 69 6f |that the| equatio|
|00005900| 6e 20 69 73 20 61 20 63 | 75 62 69 63 2c 20 61 6e |n is a c|ubic, an|
|00005910| 64 20 73 6f 20 69 66 20 | 61 20 6c 69 6e 65 20 68 |d so if |a line h|
|00005920| 69 74 73 20 74 68 65 0a | 58 20 2a 20 63 75 72 76 |its the.|X * curv|
|00005930| 65 20 69 6e 20 74 77 6f | 20 72 61 74 69 6f 6e 61 |e in two| rationa|
|00005940| 6c 20 70 6f 69 6e 74 73 | 2c 20 74 68 65 6e 20 74 |l points|, then t|
|00005950| 68 65 20 74 68 69 72 64 | 20 69 6e 74 65 72 73 65 |he third| interse|
|00005960| 63 74 69 6f 6e 20 70 6f | 69 6e 74 20 6d 75 73 74 |ction po|int must|
|00005970| 0a 58 20 2a 20 61 6c 73 | 6f 20 62 65 20 72 61 74 |.X * als|o be rat|
|00005980| 69 6f 6e 61 6c 2e 20 20 | 54 68 75 73 20 62 79 20 |ional. |Thus by |
|00005990| 64 72 61 77 69 6e 67 20 | 6c 69 6e 65 73 20 62 65 |drawing |lines be|
|000059a0| 74 77 65 65 6e 20 6b 6e | 6f 77 6e 20 72 61 74 69 |tween kn|own rati|
|000059b0| 6f 6e 61 6c 20 70 6f 69 | 6e 74 73 0a 58 20 2a 20 |onal poi|nts.X * |
|000059c0| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 72 61 |the numb|er of ra|
|000059d0| 74 69 6f 6e 61 6c 20 73 | 6f 6c 75 74 69 6f 6e 73 |tional s|olutions|
|000059e0| 20 63 61 6e 20 62 65 20 | 6d 61 64 65 20 76 65 72 | can be |made ver|
|000059f0| 79 20 6c 61 72 67 65 2e | 20 20 57 68 65 6e 20 6d |y large.| When m|
|00005a00| 6f 64 75 6c 61 72 0a 58 | 20 2a 20 61 72 69 74 68 |odular.X| * arith|
|00005a10| 6d 65 74 69 63 20 69 73 | 20 75 73 65 64 2c 20 73 |metic is| used, s|
|00005a20| 6f 6c 76 69 6e 67 20 66 | 6f 72 20 74 68 65 20 74 |olving f|or the t|
|00005a30| 68 69 72 64 20 70 6f 69 | 6e 74 20 72 65 71 75 69 |hird poi|nt requi|
|00005a40| 72 65 73 20 74 68 65 20 | 74 61 6b 69 6e 67 20 6f |res the |taking o|
|00005a50| 66 20 61 0a 58 20 2a 20 | 6d 6f 64 75 6c 61 72 20 |f a.X * |modular |
|00005a60| 69 6e 76 65 72 73 65 20 | 28 69 6e 73 74 65 61 64 |inverse |(instead|
|00005a70| 20 6f 66 20 64 69 76 69 | 73 69 6f 6e 29 2c 20 61 | of divi|sion), a|
|00005a80| 6e 64 20 69 66 20 74 68 | 69 73 20 66 61 69 6c 73 |nd if th|is fails|
|00005a90| 2c 20 74 68 65 6e 20 74 | 68 65 20 47 43 44 0a 58 |, then t|he GCD.X|
|00005aa0| 20 2a 20 6f 66 20 74 68 | 65 20 66 61 69 6c 69 6e | * of th|e failin|
|00005ab0| 67 20 76 61 6c 75 65 20 | 61 6e 64 20 4e 20 70 72 |g value |and N pr|
|00005ac0| 6f 76 69 64 65 73 20 61 | 20 66 61 63 74 6f 72 20 |ovides a| factor |
|00005ad0| 6f 66 20 4e 2e 20 20 54 | 68 69 73 20 64 65 73 63 |of N. T|his desc|
|00005ae0| 72 69 70 74 69 6f 6e 20 | 69 73 0a 58 20 2a 20 6f |ription |is.X * o|
|00005af0| 6e 6c 79 20 61 6e 20 61 | 70 70 72 6f 78 69 6d 61 |nly an a|pproxima|
|00005b00| 74 69 6f 6e 2c 20 72 65 | 61 64 20 22 41 20 43 6f |tion, re|ad "A Co|
|00005b10| 75 72 73 65 20 69 6e 20 | 4e 75 6d 62 65 72 20 54 |urse in |Number T|
|00005b20| 68 65 6f 72 79 20 61 6e | 64 20 43 72 79 70 74 6f |heory an|d Crypto|
|00005b30| 67 72 61 70 68 79 22 0a | 58 20 2a 20 62 79 20 4e |graphy".|X * by N|
|00005b40| 65 61 6c 20 4b 6f 62 6c | 69 74 7a 20 66 6f 72 20 |eal Kobl|itz for |
|00005b50| 61 20 67 6f 6f 64 20 65 | 78 70 6c 61 6e 61 74 69 |a good e|xplanati|
|00005b60| 6f 6e 2e 0a 58 20 2a 0a | 58 20 2a 20 66 61 63 74 |on..X *.|X * fact|
|00005b70| 6f 72 28 69 4e 2c 20 69 | 61 2c 20 42 2c 20 66 6f |or(iN, i|a, B, fo|
|00005b80| 72 63 65 29 0a 58 20 2a | 09 69 4e 20 69 73 20 74 |rce).X *|.iN is t|
|00005b90| 68 65 20 6e 75 6d 62 65 | 72 20 74 6f 20 62 65 20 |he numbe|r to be |
|00005ba0| 66 61 63 74 6f 72 65 64 | 2e 0a 58 20 2a 09 69 61 |factored|..X *.ia|
|00005bb0| 20 69 73 20 74 68 65 20 | 69 6e 69 74 69 61 6c 20 | is the |initial |
|00005bc0| 76 61 6c 75 65 20 6f 66 | 20 61 20 69 6e 20 74 68 |value of| a in th|
|00005bd0| 65 20 65 71 75 61 74 69 | 6f 6e 2c 20 61 6e 64 20 |e equati|on, and |
|00005be0| 65 61 63 68 20 73 75 63 | 63 65 73 73 69 76 65 0a |each suc|cessive.|
|00005bf0| 58 20 2a 09 76 61 6c 75 | 65 20 6f 66 20 61 20 69 |X *.valu|e of a i|
|00005c00| 73 20 61 6e 20 69 6e 64 | 65 70 65 6e 64 65 6e 74 |s an ind|ependent|
|00005c10| 20 61 74 74 65 6d 70 74 | 20 61 74 20 66 61 63 74 | attempt| at fact|
|00005c20| 6f 72 69 6e 67 20 28 64 | 65 66 61 75 6c 74 20 31 |oring (d|efault 1|
|00005c30| 29 2e 0a 58 20 2a 09 42 | 20 69 73 20 74 68 65 20 |)..X *.B| is the |
|00005c40| 6c 69 6d 69 74 20 6f 66 | 20 74 68 65 20 70 72 69 |limit of| the pri|
|00005c50| 6d 65 73 20 74 68 61 74 | 20 6d 61 6b 65 20 75 70 |mes that| make up|
|00005c60| 20 74 68 65 20 68 69 67 | 68 20 70 6f 77 65 72 20 | the hig|h power |
|00005c70| 74 68 61 74 20 74 68 65 | 0a 58 20 2a 09 70 6f 69 |that the|.X *.poi|
|00005c80| 6e 74 20 69 73 20 72 61 | 69 73 65 64 20 74 6f 20 |nt is ra|ised to |
|00005c90| 66 6f 72 20 65 61 63 68 | 20 66 61 63 74 6f 72 69 |for each| factori|
|00005ca0| 6e 67 20 61 74 74 65 6d | 70 74 20 28 64 65 66 61 |ng attem|pt (defa|
|00005cb0| 75 6c 74 20 31 30 30 29 | 2e 0a 58 20 2a 09 66 6f |ult 100)|..X *.fo|
|00005cc0| 72 63 65 20 69 73 20 61 | 20 66 6c 61 67 20 74 6f |rce is a| flag to|
|00005cd0| 20 61 74 74 65 6d 70 74 | 20 74 6f 20 66 61 63 74 | attempt| to fact|
|00005ce0| 6f 72 20 6e 75 6d 62 65 | 72 73 20 65 76 65 6e 20 |or numbe|rs even |
|00005cf0| 69 66 20 74 68 65 79 20 | 61 72 65 0a 58 20 2a 09 |if they |are.X *.|
|00005d00| 74 68 6f 75 67 68 74 20 | 74 6f 20 61 6c 72 65 61 |thought |to alrea|
|00005d10| 64 79 20 62 65 20 70 72 | 69 6d 65 20 28 64 65 66 |dy be pr|ime (def|
|00005d20| 61 75 6c 74 20 46 41 4c | 53 45 29 2e 0a 58 20 2a |ault FAL|SE)..X *|
|00005d30| 0a 58 20 2a 20 4d 61 6b | 69 6e 67 20 42 20 6c 61 |.X * Mak|ing B la|
|00005d40| 72 67 65 72 20 6d 61 6b | 65 73 20 74 68 65 20 70 |rger mak|es the p|
|00005d50| 6f 77 65 72 20 74 68 65 | 20 70 6f 69 6e 74 20 62 |ower the| point b|
|00005d60| 65 69 6e 67 20 72 61 69 | 73 65 64 20 74 6f 20 63 |eing rai|sed to c|
|00005d70| 6f 6e 74 61 69 6e 20 6d | 6f 72 65 0a 58 20 2a 20 |ontain m|ore.X * |
|00005d80| 70 72 69 6d 65 20 66 61 | 63 74 6f 72 73 2c 20 74 |prime fa|ctors, t|
|00005d90| 68 75 73 20 69 6e 63 72 | 65 61 73 69 6e 67 20 74 |hus incr|easing t|
|00005da0| 68 65 20 63 68 61 6e 63 | 65 20 74 68 61 74 20 74 |he chanc|e that t|
|00005db0| 68 65 20 6f 72 64 65 72 | 20 6f 66 20 74 68 65 20 |he order| of the |
|00005dc0| 70 6f 69 6e 74 0a 58 20 | 2a 20 77 69 6c 6c 20 62 |point.X |* will b|
|00005dd0| 65 20 6d 61 64 65 20 75 | 70 20 6f 66 20 74 68 6f |e made u|p of tho|
|00005de0| 73 65 20 66 61 63 74 6f | 72 73 2e 20 20 54 68 65 |se facto|rs. The|
|00005df0| 20 68 69 67 68 65 72 20 | 42 20 69 73 20 74 68 65 | higher |B is the|
|00005e00| 6e 2c 20 74 68 65 20 67 | 72 65 61 74 65 72 0a 58 |n, the g|reater.X|
|00005e10| 20 2a 20 74 68 65 20 63 | 68 61 6e 63 65 20 74 68 | * the c|hance th|
|00005e20| 61 74 20 61 6e 79 20 69 | 6e 64 69 76 69 64 75 61 |at any i|ndividua|
|00005e30| 6c 20 61 74 74 65 6d 70 | 74 20 77 69 6c 6c 20 66 |l attemp|t will f|
|00005e40| 69 6e 64 20 61 20 66 61 | 63 74 6f 72 2e 20 20 48 |ind a fa|ctor. H|
|00005e50| 6f 77 65 76 65 72 2c 0a | 58 20 2a 20 61 20 68 69 |owever,.|X * a hi|
|00005e60| 67 68 65 72 20 42 20 61 | 6c 73 6f 20 73 6c 6f 77 |gher B a|lso slow|
|00005e70| 73 20 64 6f 77 6e 20 74 | 68 65 20 6e 75 6d 62 65 |s down t|he numbe|
|00005e80| 72 20 6f 66 20 69 6e 64 | 65 70 65 6e 64 65 6e 74 |r of ind|ependent|
|00005e90| 20 66 75 6e 63 74 69 6f | 6e 73 20 62 65 69 6e 67 | functio|ns being|
|00005ea0| 0a 58 20 2a 20 65 78 61 | 6d 69 6e 65 64 2e 20 20 |.X * exa|mined. |
|00005eb0| 54 68 65 20 6f 72 64 65 | 72 20 6f 66 20 74 68 65 |The orde|r of the|
|00005ec0| 20 70 6f 69 6e 74 20 66 | 6f 72 20 61 6e 79 20 70 | point f|or any p|
|00005ed0| 61 72 74 69 63 75 6c 61 | 72 20 66 75 6e 63 74 69 |articula|r functi|
|00005ee0| 6f 6e 20 6d 69 67 68 74 | 0a 58 20 2a 20 63 6f 6e |on might|.X * con|
|00005ef0| 74 61 69 6e 20 61 20 6c | 61 72 67 65 20 70 72 69 |tain a l|arge pri|
|00005f00| 6d 65 20 61 6e 64 20 73 | 6f 20 77 6f 6e 27 74 20 |me and s|o won't |
|00005f10| 73 75 63 63 65 65 64 20 | 65 76 65 6e 20 66 6f 72 |succeed |even for|
|00005f20| 20 61 20 72 65 61 6c 6c | 79 20 6c 61 72 67 65 20 | a reall|y large |
|00005f30| 42 2c 0a 58 20 2a 20 77 | 68 65 72 65 61 73 20 74 |B,.X * w|hereas t|
|00005f40| 68 65 20 6e 65 78 74 20 | 66 75 6e 63 74 69 6f 6e |he next |function|
|00005f50| 20 6d 69 67 68 74 20 68 | 61 76 65 20 61 6e 20 6f | might h|ave an o|
|00005f60| 72 64 65 72 20 77 68 69 | 63 68 20 69 73 20 71 75 |rder whi|ch is qu|
|00005f70| 69 63 6b 6c 79 20 66 6f | 75 6e 64 2e 0a 58 20 2a |ickly fo|und..X *|
|00005f80| 20 53 6f 20 79 6f 75 20 | 77 61 6e 74 20 74 6f 20 | So you |want to |
|00005f90| 74 72 61 64 65 20 6f 66 | 66 20 74 68 65 20 64 65 |trade of|f the de|
|00005fa0| 70 74 68 20 6f 66 20 61 | 20 70 61 72 74 69 63 75 |pth of a| particu|
|00005fb0| 6c 61 72 20 73 65 61 72 | 63 68 20 77 69 74 68 20 |lar sear|ch with |
|00005fc0| 74 68 65 0a 58 20 2a 20 | 6e 75 6d 62 65 72 20 6f |the.X * |number o|
|00005fd0| 66 20 73 65 61 72 63 68 | 65 73 20 6d 61 64 65 2e |f search|es made.|
|00005fe0| 20 20 46 6f 72 20 65 78 | 61 6d 70 6c 65 2c 20 66 | For ex|ample, f|
|00005ff0| 6f 72 20 66 61 63 74 6f | 72 69 6e 67 20 33 30 20 |or facto|ring 30 |
|00006000| 64 69 67 69 74 73 2c 20 | 49 20 6d 61 6b 65 0a 58 |digits, |I make.X|
|00006010| 20 2a 20 42 20 62 65 20 | 61 62 6f 75 74 20 31 30 | * B be |about 10|
|00006020| 30 30 20 28 70 72 6f 62 | 61 62 6c 79 20 73 74 69 |00 (prob|ably sti|
|00006030| 6c 6c 20 74 6f 6f 20 73 | 6d 61 6c 6c 29 2e 0a 58 |ll too s|mall)..X|
|00006040| 20 2a 0a 58 20 2a 20 49 | 66 20 79 6f 75 20 68 61 | *.X * I|f you ha|
|00006050| 76 65 20 6c 6f 74 73 20 | 6f 66 20 6d 61 63 68 69 |ve lots |of machi|
|00006060| 6e 65 73 20 61 76 61 69 | 6c 61 62 6c 65 2c 20 74 |nes avai|lable, t|
|00006070| 68 65 6e 20 79 6f 75 20 | 63 61 6e 20 72 75 6e 20 |hen you |can run |
|00006080| 70 61 72 61 6c 6c 65 6c | 0a 58 20 2a 20 66 61 63 |parallel|.X * fac|
|00006090| 74 6f 72 69 6e 67 20 61 | 74 74 65 6d 70 74 73 20 |toring a|ttempts |
|000060a0| 66 6f 72 20 74 68 65 20 | 73 61 6d 65 20 6e 75 6d |for the |same num|
|000060b0| 62 65 72 20 62 79 20 67 | 69 76 69 6e 67 20 64 69 |ber by g|iving di|
|000060c0| 66 66 65 72 65 6e 74 20 | 73 74 61 72 74 69 6e 67 |fferent |starting|
|000060d0| 0a 58 20 2a 20 76 61 6c | 75 65 73 20 6f 66 20 69 |.X * val|ues of i|
|000060e0| 61 20 66 6f 72 20 65 61 | 63 68 20 6d 61 63 68 69 |a for ea|ch machi|
|000060f0| 6e 65 20 28 65 2e 67 2e | 20 31 30 30 30 2c 20 32 |ne (e.g.| 1000, 2|
|00006100| 30 30 30 2c 20 33 30 30 | 30 29 2e 0a 58 20 2a 0a |000, 300|0)..X *.|
|00006110| 58 20 2a 20 54 68 65 20 | 6f 75 74 70 75 74 20 61 |X * The |output a|
|00006120| 73 20 74 68 65 20 66 75 | 6e 63 74 69 6f 6e 20 69 |s the fu|nction i|
|00006130| 73 20 72 75 6e 6e 69 6e | 67 20 69 73 20 28 6f 63 |s runnin|g is (oc|
|00006140| 63 61 73 69 6f 6e 61 6c | 6c 79 29 20 74 68 65 20 |casional|ly) the |
|00006150| 76 61 6c 75 65 20 6f 66 | 20 61 0a 58 20 2a 20 77 |value of| a.X * w|
|00006160| 68 65 6e 20 61 20 6e 65 | 77 20 66 75 6e 63 74 69 |hen a ne|w functi|
|00006170| 6f 6e 20 69 73 20 73 74 | 61 72 74 65 64 2c 20 74 |on is st|arted, t|
|00006180| 68 65 20 70 72 69 6d 65 | 20 74 68 61 74 20 69 73 |he prime| that is|
|00006190| 20 62 65 69 6e 67 20 69 | 6e 63 6c 75 64 65 64 20 | being i|ncluded |
|000061a0| 69 6e 20 74 68 65 0a 58 | 20 2a 20 68 69 67 68 20 |in the.X| * high |
|000061b0| 70 6f 77 65 72 20 62 65 | 69 6e 67 20 63 61 6c 63 |power be|ing calc|
|000061c0| 75 6c 61 74 65 64 2c 20 | 61 6e 64 20 74 68 65 20 |ulated, |and the |
|000061d0| 63 75 72 72 65 6e 74 20 | 70 6f 69 6e 74 20 77 68 |current |point wh|
|000061e0| 69 63 68 20 69 73 20 74 | 68 65 20 72 65 73 75 6c |ich is t|he resul|
|000061f0| 74 0a 58 20 2a 20 6f 66 | 20 74 68 65 20 70 6f 77 |t.X * of| the pow|
|00006200| 65 72 73 20 73 6f 20 66 | 61 72 2e 0a 58 20 2a 0a |ers so f|ar..X *.|
|00006210| 58 20 2a 20 49 66 20 61 | 20 66 61 63 74 6f 72 20 |X * If a| factor |
|00006220| 69 73 20 66 6f 75 6e 64 | 2c 20 69 74 20 69 73 20 |is found|, it is |
|00006230| 72 65 74 75 72 6e 65 64 | 20 61 6e 64 20 69 73 20 |returned| and is |
|00006240| 61 6c 73 6f 20 73 61 76 | 65 64 20 69 6e 20 74 68 |also sav|ed in th|
|00006250| 65 20 67 6c 6f 62 61 6c | 0a 58 20 2a 20 76 61 72 |e global|.X * var|
|00006260| 69 61 62 6c 65 20 66 2e | 20 20 54 68 65 20 6e 75 |iable f.| The nu|
|00006270| 6d 62 65 72 20 62 65 69 | 6e 67 20 66 61 63 74 6f |mber bei|ng facto|
|00006280| 72 65 64 20 69 73 20 61 | 6c 73 6f 20 73 61 76 65 |red is a|lso save|
|00006290| 64 20 69 6e 20 74 68 65 | 20 67 6c 6f 62 61 6c 0a |d in the| global.|
|000062a0| 58 20 2a 20 76 61 72 69 | 61 62 6c 65 20 4e 2e 0a |X * vari|able N..|
|000062b0| 58 20 2a 2f 0a 58 0a 58 | 6f 62 6a 20 70 6f 69 6e |X */.X.X|obj poin|
|000062c0| 74 20 7b 78 2c 20 79 7d | 3b 0a 58 67 6c 6f 62 61 |t {x, y}|;.Xgloba|
|000062d0| 6c 09 4e 3b 09 09 2f 2a | 20 6e 75 6d 62 65 72 20 |l.N;../*| number |
|000062e0| 74 6f 20 66 61 63 74 6f | 72 20 2a 2f 0a 58 67 6c |to facto|r */.Xgl|
|000062f0| 6f 62 61 6c 09 61 3b 09 | 09 2f 2a 20 66 69 72 73 |obal.a;.|./* firs|
|00006300| 74 20 63 6f 65 66 66 69 | 63 69 65 6e 74 20 2a 2f |t coeffi|cient */|
|00006310| 0a 58 67 6c 6f 62 61 6c | 09 62 3b 09 09 2f 2a 20 |.Xglobal|.b;../* |
|00006320| 73 65 63 6f 6e 64 20 63 | 6f 65 66 66 69 63 69 65 |second c|oefficie|
|00006330| 6e 74 20 2a 2f 0a 58 67 | 6c 6f 62 61 6c 09 66 3b |nt */.Xg|lobal.f;|
|00006340| 09 09 2f 2a 20 66 6f 75 | 6e 64 20 66 61 63 74 6f |../* fou|nd facto|
|00006350| 72 20 2a 2f 0a 58 0a 58 | 0a 58 64 65 66 69 6e 65 |r */.X.X|.Xdefine|
|00006360| 20 66 61 63 74 6f 72 28 | 69 4e 2c 20 69 61 2c 20 | factor(|iN, ia, |
|00006370| 42 2c 20 66 6f 72 63 65 | 29 0a 58 7b 0a 58 09 6c |B, force|).X{.X.l|
|00006380| 6f 63 61 6c 09 43 2c 20 | 78 2c 20 70 3b 0a 58 0a |ocal.C, |x, p;.X.|
|00006390| 58 09 69 66 20 28 21 66 | 6f 72 63 65 20 26 26 20 |X.if (!f|orce && |
|000063a0| 70 74 65 73 74 28 69 4e | 2c 20 35 30 29 29 0a 58 |ptest(iN|, 50)).X|
|000063b0| 09 09 72 65 74 75 72 6e | 20 31 3b 0a 58 09 69 66 |..return| 1;.X.if|
|000063c0| 20 28 69 73 6e 75 6c 6c | 28 42 29 29 0a 58 09 09 | (isnull|(B)).X..|
|000063d0| 42 20 3d 20 31 30 30 3b | 0a 58 09 69 66 20 28 69 |B = 100;|.X.if (i|
|000063e0| 73 6e 75 6c 6c 28 69 61 | 29 29 0a 58 09 09 69 61 |snull(ia|)).X..ia|
|000063f0| 20 3d 20 31 3b 0a 58 09 | 6f 62 6a 20 70 6f 69 6e | = 1;.X.|obj poin|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.