home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
You can browse this item here: node7_ct.html
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
90%
| dexvert
| Hypertext Markup Language File (text/html)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| HTML document text
| default (weak)
| |
99%
| file
| LaTeX document text
| default
| |
98%
| file
| exported SGML document text
| default
| |
97%
| file
| exported SGML document, ASCII text
| default
| |
80%
| TrID
| HyperText Markup Language with DOCTYPE
| default
| |
19%
| TrID
| HyperText Markup Language
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| gt2
| HTML (Hyper Text Markup Language) Datei
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| text/html
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 3c 21 44 4f 43 54 59 50 | 45 20 48 54 4d 4c 20 50 |<!DOCTYP|E HTML P|
|00000010| 55 42 4c 49 43 20 22 2d | 2f 2f 57 33 43 2f 2f 44 |UBLIC "-|//W3C//D|
|00000020| 54 44 20 48 54 4d 4c 20 | 33 2e 32 20 46 69 6e 61 |TD HTML |3.2 Fina|
|00000030| 6c 2f 2f 65 6e 22 3e 0a | 0a 3c 21 2d 2d 43 6f 6e |l//en">.|.<!--Con|
|00000040| 76 65 72 74 65 64 20 77 | 69 74 68 20 4c 61 54 65 |verted w|ith LaTe|
|00000050| 58 32 48 54 4d 4c 20 32 | 30 32 32 20 28 52 65 6c |X2HTML 2|022 (Rel|
|00000060| 65 61 73 65 64 20 4a 61 | 6e 75 61 72 79 20 31 2c |eased Ja|nuary 1,|
|00000070| 20 32 30 32 32 29 20 2d | 2d 3e 0a 3c 48 54 4d 4c | 2022) -|->.<HTML|
|00000080| 20 6c 61 6e 67 3d 22 65 | 6e 22 3e 0a 3c 48 45 41 | lang="e|n">.<HEA|
|00000090| 44 3e 0a 3c 54 49 54 4c | 45 3e 43 6f 6e 74 65 6e |D>.<TITL|E>Conten|
|000000a0| 74 73 20 6f 66 20 50 61 | 73 73 69 6e 67 20 61 72 |ts of Pa|ssing ar|
|000000b0| 67 75 6d 65 6e 74 73 20 | 74 6f 20 61 20 70 72 69 |guments |to a pri|
|000000c0| 6d 69 74 69 76 65 3c 2f | 54 49 54 4c 45 3e 0a 0a |mitive</|TITLE>..|
|000000d0| 3c 4d 45 54 41 20 48 54 | 54 50 2d 45 51 55 49 56 |<META HT|TP-EQUIV|
|000000e0| 3d 22 43 6f 6e 74 65 6e | 74 2d 54 79 70 65 22 20 |="Conten|t-Type" |
|000000f0| 43 4f 4e 54 45 4e 54 3d | 22 74 65 78 74 2f 68 74 |CONTENT=|"text/ht|
|00000100| 6d 6c 3b 20 63 68 61 72 | 73 65 74 3d 75 74 66 2d |ml; char|set=utf-|
|00000110| 38 22 3e 0a 3c 4d 45 54 | 41 20 4e 41 4d 45 3d 22 |8">.<MET|A NAME="|
|00000120| 76 69 65 77 70 6f 72 74 | 22 20 43 4f 4e 54 45 4e |viewport|" CONTEN|
|00000130| 54 3d 22 77 69 64 74 68 | 3d 64 65 76 69 63 65 2d |T="width|=device-|
|00000140| 77 69 64 74 68 2c 20 69 | 6e 69 74 69 61 6c 2d 73 |width, i|nitial-s|
|00000150| 63 61 6c 65 3d 31 2e 30 | 22 3e 0a 3c 4d 45 54 41 |cale=1.0|">.<META|
|00000160| 20 4e 41 4d 45 3d 22 47 | 65 6e 65 72 61 74 6f 72 | NAME="G|enerator|
|00000170| 22 20 43 4f 4e 54 45 4e | 54 3d 22 4c 61 54 65 58 |" CONTEN|T="LaTeX|
|00000180| 32 48 54 4d 4c 20 76 32 | 30 32 32 22 3e 0a 0a 3c |2HTML v2|022">..<|
|00000190| 4c 49 4e 4b 20 52 45 4c | 3d 22 53 54 59 4c 45 53 |LINK REL|="STYLES|
|000001a0| 48 45 45 54 22 20 48 52 | 45 46 3d 22 45 78 74 65 |HEET" HR|EF="Exte|
|000001b0| 6e 64 69 6e 67 2e 63 73 | 73 22 3e 0a 0a 3c 4c 49 |nding.cs|s">..<LI|
|000001c0| 4e 4b 20 52 45 4c 3d 22 | 6e 65 78 74 22 20 48 52 |NK REL="|next" HR|
|000001d0| 45 46 3d 22 6e 6f 64 65 | 38 5f 6d 6e 2e 68 74 6d |EF="node|8_mn.htm|
|000001e0| 6c 22 3e 0a 3c 4c 49 4e | 4b 20 52 45 4c 3d 22 70 |l">.<LIN|K REL="p|
|000001f0| 72 65 76 69 6f 75 73 22 | 20 48 52 45 46 3d 22 6e |revious"| HREF="n|
|00000200| 6f 64 65 34 5f 6d 6e 2e | 68 74 6d 6c 22 3e 0a 3c |ode4_mn.|html">.<|
|00000210| 4c 49 4e 4b 20 52 45 4c | 3d 22 75 70 22 20 48 52 |LINK REL|="up" HR|
|00000220| 45 46 3d 22 6e 6f 64 65 | 33 5f 6d 6e 2e 68 74 6d |EF="node|3_mn.htm|
|00000230| 6c 22 3e 0a 3c 4c 49 4e | 4b 20 52 45 4c 3d 22 6e |l">.<LIN|K REL="n|
|00000240| 65 78 74 22 20 48 52 45 | 46 3d 22 6e 6f 64 65 38 |ext" HRE|F="node8|
|00000250| 5f 6d 6e 2e 68 74 6d 6c | 22 3e 0a 3c 2f 48 45 41 |_mn.html|">.</HEA|
|00000260| 44 3e 0a 20 0a 3c 42 4f | 44 59 20 62 67 63 6f 6c |D>. .<BO|DY bgcol|
|00000270| 6f 72 3d 22 23 66 66 66 | 66 66 66 22 20 74 65 78 |or="#fff|fff" tex|
|00000280| 74 3d 22 23 30 30 30 30 | 30 30 22 20 6c 69 6e 6b |t="#0000|00" link|
|00000290| 3d 22 23 39 39 34 34 45 | 45 22 20 76 6c 69 6e 6b |="#9944E|E" vlink|
|000002a0| 3d 22 23 30 30 30 30 66 | 66 22 20 61 6c 69 6e 6b |="#0000f|f" alink|
|000002b0| 3d 22 23 30 30 66 66 30 | 30 22 3e 0a 0a 3c 48 32 |="#00ff0|0">..<H2|
|000002c0| 3e 3c 41 20 49 44 3d 22 | 53 45 43 54 49 4f 4e 30 |><A ID="|SECTION0|
|000002d0| 30 30 33 32 30 30 30 30 | 30 30 30 30 30 30 30 30 |00320000|00000000|
|000002e0| 30 30 30 22 3e 0a 50 61 | 73 73 69 6e 67 20 61 72 |000">.Pa|ssing ar|
|000002f0| 67 75 6d 65 6e 74 73 20 | 74 6f 20 61 20 70 72 69 |guments |to a pri|
|00000300| 6d 69 74 69 76 65 3c 2f | 41 3e 0a 3c 2f 48 32 3e |mitive</|A>.</H2>|
|00000310| 0a 0a 3c 50 3e 0a 54 68 | 69 73 20 73 65 63 74 69 |..<P>.Th|is secti|
|00000320| 6f 6e 20 73 68 6f 77 73 | 20 68 6f 77 20 74 6f 20 |on shows| how to |
|00000330| 70 61 73 73 20 61 72 67 | 75 6d 65 6e 74 73 20 74 |pass arg|uments t|
|00000340| 6f 20 61 20 6e 65 77 20 | 70 72 69 6d 69 74 69 76 |o a new |primitiv|
|00000350| 65 20 77 72 69 74 74 65 | 6e 20 69 6e 0a 43 2e 20 |e writte|n in.C. |
|00000360| 54 6f 20 69 6c 6c 75 73 | 74 72 61 74 65 20 6f 75 |To illus|trate ou|
|00000370| 72 20 70 75 72 70 6f 73 | 65 2c 20 77 65 20 77 69 |r purpos|e, we wi|
|00000380| 6c 6c 20 72 65 77 72 69 | 74 65 20 74 68 65 20 70 |ll rewri|te the p|
|00000390| 72 69 6d 69 74 69 76 65 | 20 3c 54 54 3e 70 6f 73 |rimitive| <TT>pos|
|000003a0| 69 78 2d 63 74 69 6d 65 | 3c 2f 54 54 3e 20 74 6f |ix-ctime|</TT> to|
|000003b0| 20 62 65 20 63 6f 6e 66 | 6f 72 6d 20 74 6f 20 50 | be conf|orm to P|
|000003c0| 4f 53 49 58 2e 31 20 28 | 74 68 69 73 20 66 75 6e |OSIX.1 (|this fun|
|000003d0| 63 74 69 6f 6e 20 73 68 | 6f 75 6c 64 20 74 61 6b |ction sh|ould tak|
|000003e0| 65 20 61 6e 0a 69 6e 74 | 65 67 65 72 2c 20 61 20 |e an.int|eger, a |
|000003f0| 63 6f 75 6e 74 20 6f 66 | 20 73 65 63 6f 6e 64 73 |count of| seconds|
|00000400| 2c 20 61 6e 64 20 73 68 | 6f 75 6c 64 20 72 65 74 |, and sh|ould ret|
|00000410| 75 72 6e 20 63 6f 72 72 | 65 73 70 6f 6e 64 69 6e |urn corr|espondin|
|00000420| 67 20 64 61 74 65 20 61 | 73 20 61 0a 73 74 72 69 |g date a|s a.stri|
|00000430| 6e 67 29 2e 20 41 20 73 | 65 63 6f 6e 64 20 77 72 |ng). A s|econd wr|
|00000440| 69 74 69 6e 67 20 6f 66 | 20 70 72 65 76 69 6f 75 |iting of| previou|
|00000450| 73 20 66 75 6e 63 74 69 | 6f 6e 20 63 6f 75 6c 64 |s functi|on could|
|00000460| 20 62 65 3a 0a 0a 3c 50 | 3e 0a 3c 42 52 3e 0a 3c | be:..<P|>.<BR>.<|
|00000470| 49 4d 47 0a 20 20 53 54 | 59 4c 45 3d 22 22 20 53 |IMG. ST|YLE="" S|
|00000480| 52 43 3d 22 69 6d 67 37 | 2e 70 6e 67 22 0a 20 41 |RC="img7|.png". A|
|00000490| 4c 54 3d 22 5c 62 65 67 | 69 6e 7b 43 6f 64 65 7d |LT="\beg|in{Code}|
|000004a0| 0a 5c 62 65 67 69 6e 7b | 6c 69 73 74 69 6e 67 7d |.\begin{|listing}|
|000004b0| 5b 32 30 30 5d 7b 32 7d | 0a 73 74 61 74 69 63 20 |[200]{2}|.static |
|000004c0| 50 52 49 4d 49 54 49 56 | 45 20 70 6f 73 69 78 5f |PRIMITIV|E posix_|
|000004d0| 63 74 69 6d 65 28 53 43 | 4d 20 73 65 63 6f 6e 64 |ctime(SC|M second|
|000004e0| 73 29 0a 7b 2e 2e 2e 0a | 2e 2e 2e 63 6f 6e 64 73 |s).{....|...conds|
|000004f0| 29 3b 0a 72 65 74 75 72 | 6e 20 53 54 6b 5f 6d 61 |);.retur|n STk_ma|
|00000500| 6b 65 73 74 72 69 6e 67 | 28 63 74 69 6d 65 28 28 |kestring|(ctime((|
|00000510| 74 69 6d 65 5f 74 20 2a | 29 26 61 6d 70 3b 73 65 |time_t *|)&se|
|00000520| 63 29 29 3b 0a 7d 0a 5c | 65 6e 64 7b 6c 69 73 74 |c));.}.\|end{list|
|00000530| 69 6e 67 7d 5c 65 6e 64 | 7b 43 6f 64 65 7d 22 3e |ing}\end|{Code}">|
|00000540| 0a 3c 42 52 3e 0a 0a 3c | 50 3e 0a 54 68 69 73 20 |.<BR>..<|P>.This |
|00000550| 66 75 6e 63 74 69 6f 6e | 20 68 61 73 20 6f 6e 65 |function| has one|
|00000560| 20 70 61 72 61 6d 65 74 | 65 72 20 73 69 6e 63 65 | paramet|er since|
|00000570| 20 53 63 68 65 6d 65 20 | 70 72 69 6d 69 74 69 76 | Scheme |primitiv|
|00000580| 65 20 61 72 69 74 79 20 | 69 73 20 6f 6e 65 2e 20 |e arity |is one. |
|00000590| 54 68 65 0a 43 20 70 72 | 69 6d 69 74 69 76 65 73 |The.C pr|imitives|
|000005a0| 20 70 61 72 61 6d 65 74 | 65 72 73 20 61 72 65 20 | paramet|ers are |
|000005b0| 61 6c 77 61 79 73 20 53 | 43 4d 20 6f 62 6a 65 63 |always S|CM objec|
|000005c0| 74 73 2e 20 41 6e 20 6f | 62 6a 65 63 74 20 6f 66 |ts. An o|bject of|
|000005d0| 20 74 68 69 73 20 74 79 | 70 65 20 69 73 0a 61 20 | this ty|pe is.a |
|000005e0| 70 6f 69 6e 74 65 72 20 | 74 6f 20 61 20 73 74 72 |pointer |to a str|
|000005f0| 75 63 74 20 6f 62 6a 3a | 20 74 68 65 20 74 79 70 |uct obj:| the typ|
|00000600| 65 20 77 68 69 63 68 20 | 70 65 72 6d 69 74 73 20 |e which |permits |
|00000610| 74 6f 20 72 65 70 72 65 | 73 65 6e 74 20 61 6c 6c |to repre|sent all|
|00000620| 20 74 68 65 0a 53 63 68 | 65 6d 65 20 6f 62 6a 65 | the.Sch|eme obje|
|00000630| 63 74 73 2e 20 20 54 68 | 65 20 3c 54 54 3e 53 43 |cts. Th|e <TT>SC|
|00000640| 4d 3c 2f 54 54 3e 20 61 | 6e 64 20 3c 54 54 3e 73 |M</TT> a|nd <TT>s|
|00000650| 74 72 75 63 74 26 6e 62 | 73 70 3b 6f 62 6a 3c 2f |truct&nb|sp;obj</|
|00000660| 54 54 3e 20 74 79 70 65 | 73 20 64 65 66 69 6e 69 |TT> type|s defini|
|00000670| 74 69 6f 6e 73 20 63 61 | 6e 0a 62 65 20 66 6f 75 |tions ca|n.be fou|
|00000680| 6e 64 20 69 6e 20 74 68 | 65 20 53 72 63 2f 73 74 |nd in th|e Src/st|
|00000690| 6b 2e 68 20 68 65 61 64 | 65 72 20 66 69 6c 65 2e |k.h head|er file.|
|000006a0| 20 0a 0a 3c 50 3e 0a 54 | 68 65 20 66 69 72 73 74 | ..<P>.T|he first|
|000006b0| 20 6a 6f 62 20 6f 66 20 | 74 68 69 73 20 66 75 6e | job of |this fun|
|000006c0| 63 74 69 6f 6e 20 63 6f | 6e 73 69 73 74 73 20 74 |ction co|nsists t|
|000006d0| 6f 20 63 6f 6e 76 65 72 | 74 20 74 68 65 20 53 63 |o conver|t the Sc|
|000006e0| 68 65 6d 65 0a 70 61 72 | 61 6d 65 74 65 72 20 28 |heme.par|ameter (|
|000006f0| 3c 54 54 3e 73 65 63 6f | 6e 64 73 3c 2f 54 54 3e |<TT>seco|nds</TT>|
|00000700| 29 20 74 6f 20 61 20 43 | 20 69 6e 74 65 67 65 72 |) to a C| integer|
|00000710| 20 3c 54 54 3e 6c 6f 6e | 67 20 69 6e 74 3c 2f 54 | <TT>lon|g int</T|
|00000720| 54 3e 2e 20 54 68 69 73 | 20 69 73 20 64 6f 6e 65 |T>. This| is done|
|00000730| 20 77 69 74 68 20 74 68 | 65 0a 66 75 6e 63 74 69 | with th|e.functi|
|00000740| 6f 6e 20 53 54 6b 5f 69 | 6e 74 65 67 65 72 5f 76 |on STk_i|nteger_v|
|00000750| 61 6c 75 65 5f 6e 6f 5f | 6f 76 65 72 66 6c 6f 77 |alue_no_|overflow|
|00000760| 77 68 69 63 68 20 74 61 | 6b 65 73 20 61 20 3c 54 |which ta|kes a <T|
|00000770| 54 3e 53 43 4d 3c 2f 54 | 54 3e 0a 61 6e 64 20 72 |T>SCM</T|T>.and r|
|00000780| 65 74 75 72 6e 73 20 61 | 20 3c 54 54 3e 6c 6f 6e |eturns a| <TT>lon|
|00000790| 67 20 69 6e 74 3c 2f 54 | 54 3e 2e 20 54 68 69 73 |g int</T|T>. This|
|000007a0| 20 66 75 6e 63 74 69 6f | 6e 73 20 72 65 74 75 72 | functio|ns retur|
|000007b0| 6e 73 20 3c 54 54 3e 4c | 4f 4e 47 5f 4d 49 4e 3c |ns <TT>L|ONG_MIN<|
|000007c0| 2f 54 54 3e 20 69 66 0a | 74 68 65 20 61 72 67 75 |/TT> if.|the argu|
|000007d0| 6d 65 6e 74 20 69 73 20 | 6e 6f 74 20 61 20 61 6e |ment is |not a an|
|000007e0| 20 69 6e 74 65 67 65 72 | 20 6e 75 6d 62 65 72 20 | integer| number |
|000007f0| 28 6f 72 20 61 20 6e 75 | 6d 62 65 72 20 77 68 69 |(or a nu|mber whi|
|00000800| 63 68 20 64 6f 6e 27 74 | 20 66 69 74 20 69 6e 20 |ch don't| fit in |
|00000810| 74 68 65 20 43 0a 72 65 | 70 72 65 73 65 6e 74 61 |the C.re|presenta|
|00000820| 74 69 6f 6e 20 6f 66 20 | 61 20 43 20 3c 54 54 3e |tion of |a C <TT>|
|00000830| 6c 6f 6e 67 20 69 6e 74 | 3c 2f 54 54 3e 29 2e 20 |long int|</TT>). |
|00000840| 4f 6e 63 65 20 74 68 69 | 73 20 63 6f 6e 76 65 72 |Once thi|s conver|
|00000850| 73 69 6f 6e 20 69 73 20 | 64 6f 6e 65 2c 0a 74 68 |sion is |done,.th|
|00000860| 65 20 72 65 73 74 20 6f | 66 20 74 68 65 20 6a 6f |e rest o|f the jo|
|00000870| 62 20 69 73 20 73 69 6d | 69 6c 61 72 20 74 6f 20 |b is sim|ilar to |
|00000880| 74 68 65 20 63 6f 64 65 | 20 70 72 65 73 65 6e 74 |the code| present|
|00000890| 65 64 20 61 62 6f 76 65 | 2e 0a 0a 3c 50 3e 0a 54 |ed above|...<P>.T|
|000008a0| 6f 20 61 64 64 20 74 68 | 69 73 20 70 72 69 6d 69 |o add th|is primi|
|000008b0| 74 69 76 65 20 74 6f 20 | 74 68 65 20 67 6c 6f 62 |tive to |the glob|
|000008c0| 61 6c 20 53 63 68 65 6d | 65 20 65 6e 76 69 72 6f |al Schem|e enviro|
|000008d0| 6e 6d 65 6e 74 2c 20 77 | 65 20 68 61 76 65 20 74 |nment, w|e have t|
|000008e0| 6f 0a 63 68 61 6e 67 65 | 20 74 68 65 20 70 72 65 |o.change| the pre|
|000008f0| 76 69 6f 75 73 20 3c 54 | 54 3e 53 54 6b 5f 61 64 |vious <T|T>STk_ad|
|00000900| 64 5f 6e 65 77 5f 70 72 | 69 6d 69 74 69 76 65 3c |d_new_pr|imitive<|
|00000910| 2f 54 54 3e 20 66 6f 72 | 20 74 68 69 73 20 70 72 |/TT> for| this pr|
|00000920| 69 6d 69 74 69 76 65 20 | 62 79 3a 0a 0a 3c 50 3e |imitive |by:..<P>|
|00000930| 0a 3c 42 52 3e 0a 3c 49 | 4d 47 0a 20 20 53 54 59 |.<BR>.<I|MG. STY|
|00000940| 4c 45 3d 22 22 20 53 52 | 43 3d 22 69 6d 67 38 2e |LE="" SR|C="img8.|
|00000950| 70 6e 67 22 0a 20 41 4c | 54 3d 22 5c 62 65 67 69 |png". AL|T="\begi|
|00000960| 6e 7b 43 6f 64 65 7d 0a | 5c 62 65 67 69 6e 7b 6c |n{Code}.|\begin{l|
|00000970| 69 73 74 69 6e 67 7d 5b | 32 30 30 5d 7b 32 7d 0a |isting}[|200]{2}.|
|00000980| 53 54 6b 5f 61 64 64 5f | 6e 65 77 5f 70 72 69 6d |STk_add_|new_prim|
|00000990| 69 74 69 76 65 28 27 27 | 70 6f 73 69 78 2d 63 74 |itive(''|posix-ct|
|000009a0| 69 6d 65 27 27 2c 20 74 | 63 5f 73 75 62 72 5f 31 |ime'', t|c_subr_1|
|000009b0| 2c 20 70 6f 73 69 78 5f | 63 74 69 6d 65 29 3b 0a |, posix_|ctime);.|
|000009c0| 5c 65 6e 64 7b 6c 69 73 | 74 69 6e 67 7d 5c 65 6e |\end{lis|ting}\en|
|000009d0| 64 7b 43 6f 64 65 7d 22 | 3e 0a 3c 42 52 3e 0a 0a |d{Code}"|>.<BR>..|
|000009e0| 3c 50 3e 0a 69 6e 20 74 | 68 65 20 69 6e 69 74 20 |<P>.in t|he init |
|000009f0| 73 65 63 74 69 6f 6e 2e | 20 54 68 69 73 20 63 61 |section.| This ca|
|00000a00| 6c 6c 20 73 74 61 74 65 | 73 20 74 68 61 74 20 74 |ll state|s that t|
|00000a10| 68 65 20 74 79 70 65 20 | 6f 66 20 74 68 69 73 20 |he type |of this |
|00000a20| 70 72 69 6d 69 74 69 76 | 65 0a 69 73 20 66 69 78 |primitiv|e.is fix|
|00000a30| 65 64 20 74 6f 20 61 20 | 74 63 5f 73 75 62 72 5f |ed to a |tc_subr_|
|00000a40| 31 20 28 61 20 61 72 69 | 74 79 2d 31 20 70 72 69 |1 (a ari|ty-1 pri|
|00000a50| 6d 69 74 69 76 65 29 2e | 0a 0a 3c 50 3e 0a 48 6f |mitive).|..<P>.Ho|
|00000a60| 77 65 76 65 72 2c 20 74 | 68 69 73 20 66 75 6e 63 |wever, t|his func|
|00000a70| 74 69 6f 6e 20 69 73 20 | 6e 6f 74 20 74 6f 6f 20 |tion is |not too |
|00000a80| 73 61 74 69 73 66 79 69 | 6e 67 2c 20 65 76 65 6e |satisfyi|ng, even|
|00000a90| 20 69 66 20 63 6c 6f 73 | 65 20 74 6f 20 74 68 65 | if clos|e to the|
|00000aa0| 0a 50 4f 53 49 58 20 64 | 65 66 69 6e 69 74 69 6f |.POSIX d|efinitio|
|00000ab0| 6e 3a 20 69 74 20 6f 62 | 6c 69 67 65 73 20 74 6f |n: it ob|liges to|
|00000ac0| 20 70 61 73 73 20 61 20 | 70 61 72 61 6d 65 74 65 | pass a |paramete|
|00000ad0| 72 20 77 68 69 63 68 20 | 77 69 6c 6c 20 62 65 0a |r which |will be.|
|00000ae0| 70 72 6f 62 61 62 6c 79 | 20 6d 6f 73 74 20 6f 66 |probably| most of|
|00000af0| 20 74 68 65 20 74 69 6d | 65 20 74 68 65 20 72 65 | the tim|e the re|
|00000b00| 73 75 6c 74 20 6f 66 20 | 74 68 65 20 70 72 69 6d |sult of |the prim|
|00000b10| 69 74 69 76 65 20 3c 54 | 54 3e 70 6f 73 69 78 2d |itive <T|T>posix-|
|00000b20| 74 69 6d 65 3c 2f 54 54 | 3e 20 28 69 2e 65 2e 20 |time</TT|> (i.e. |
|00000b30| 74 68 65 20 6d 6f 73 74 | 20 66 72 65 71 75 65 6e |the most| frequen|
|00000b40| 74 20 75 73 61 67 65 20 | 6f 66 20 74 68 69 73 20 |t usage |of this |
|00000b50| 66 75 6e 63 74 69 6f 6e | 20 77 69 6c 6c 20 62 65 |function| will be|
|00000b60| 0a 0a 3c 50 3e 0a 3c 42 | 52 3e 0a 3c 49 4d 47 0a |..<P>.<B|R>.<IMG.|
|00000b70| 20 20 53 54 59 4c 45 3d | 22 22 20 53 52 43 3d 22 | STYLE=|"" SRC="|
|00000b80| 69 6d 67 39 2e 70 6e 67 | 22 0a 20 41 4c 54 3d 22 |img9.png|". ALT="|
|00000b90| 5c 62 65 67 69 6e 7b 43 | 6f 64 65 7d 0a 5c 62 65 |\begin{C|ode}.\be|
|00000ba0| 67 69 6e 7b 6c 69 73 74 | 69 6e 67 7d 5b 32 30 30 |gin{list|ing}[200|
|00000bb0| 5d 7b 32 7d 0a 28 70 6f | 73 69 78 2d 63 74 69 6d |]{2}.(po|six-ctim|
|00000bc0| 65 20 28 70 6f 73 69 78 | 2d 74 69 6d 65 29 29 0a |e (posix|-time)).|
|00000bd0| 5c 65 6e 64 7b 6c 69 73 | 74 69 6e 67 7d 5c 65 6e |\end{lis|ting}\en|
|00000be0| 64 7b 43 6f 64 65 7d 22 | 3e 0a 3c 42 52 3e 0a 0a |d{Code}"|>.<BR>..|
|00000bf0| 3c 50 3e 0a 77 68 69 63 | 68 20 69 73 20 6e 6f 74 |<P>.whic|h is not|
|00000c00| 20 76 65 72 79 20 65 6c | 65 67 61 6e 74 29 2e 20 | very el|egant). |
|00000c10| 41 20 62 65 74 74 65 72 | 20 61 70 70 72 6f 61 63 |A better| approac|
|00000c20| 68 20 63 6f 6e 73 69 73 | 74 73 20 74 6f 20 61 6c |h consis|ts to al|
|00000c30| 6c 6f 77 20 74 68 69 73 | 0a 70 72 69 6d 69 74 69 |low this|.primiti|
|00000c40| 76 65 20 74 6f 20 68 61 | 76 65 20 61 20 6f 70 74 |ve to ha|ve a opt|
|00000c50| 69 6f 6e 61 6c 20 70 61 | 72 61 6d 65 74 65 72 2e |ional pa|rameter.|
|00000c60| 20 54 68 69 73 20 70 65 | 72 6d 69 74 73 20 74 6f | This pe|rmits to|
|00000c70| 20 62 65 20 61 74 20 74 | 68 65 0a 73 61 6d 65 20 | be at t|he.same |
|00000c80| 74 69 6d 65 20 63 6f 6e | 66 6f 72 6d 20 74 6f 20 |time con|form to |
|00000c90| 74 68 65 20 50 4f 53 49 | 58 20 63 6f 6e 76 65 6e |the POSI|X conven|
|00000ca0| 74 69 6f 6e 20 61 6e 64 | 20 63 6c 6f 73 65 20 74 |tion and| close t|
|00000cb0| 6f 20 53 63 68 65 6d 65 | 20 68 61 62 69 74 73 2e |o Scheme| habits.|
|00000cc0| 20 0a 54 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 | .The fo|llowing |
|00000cd0| 76 65 72 73 69 6f 6e 20 | 69 6d 70 6c 65 6d 65 6e |version |implemen|
|00000ce0| 74 73 20 74 68 65 20 3c | 54 54 3e 70 6f 73 69 78 |ts the <|TT>posix|
|00000cf0| 2d 63 74 69 6d 65 3c 2f | 54 54 3e 20 77 69 74 68 |-ctime</|TT> with|
|00000d00| 20 61 20 6f 70 74 69 6f | 6e 61 6c 0a 70 61 72 61 | a optio|nal.para|
|00000d10| 6d 65 74 65 72 3a 0a 3c | 42 52 3e 0a 3c 49 4d 47 |meter:.<|BR>.<IMG|
|00000d20| 0a 20 20 53 54 59 4c 45 | 3d 22 22 20 53 52 43 3d |. STYLE|="" SRC=|
|00000d30| 22 69 6d 67 31 30 2e 70 | 6e 67 22 0a 20 41 4c 54 |"img10.p|ng". ALT|
|00000d40| 3d 22 5c 62 65 67 69 6e | 7b 43 6f 64 65 7d 0a 5c |="\begin|{Code}.\|
|00000d50| 62 65 67 69 6e 7b 6c 69 | 73 74 69 6e 67 7d 5b 32 |begin{li|sting}[2|
|00000d60| 30 30 5d 7b 32 7d 0a 73 | 74 61 74 69 63 20 50 52 |00]{2}.s|tatic PR|
|00000d70| 49 4d 49 54 49 56 45 20 | 70 6f 73 69 78 5f 63 74 |IMITIVE |posix_ct|
|00000d80| 69 6d 65 28 53 43 4d 20 | 73 65 63 6f 6e 64 73 29 |ime(SCM |seconds)|
|00000d90| 0a 7b 2e 2e 2e 0a 2e 2e | 2e 6f 6e 64 73 29 3b 0a |.{......|.onds);.|
|00000da0| 72 65 74 75 72 6e 20 53 | 54 6b 5f 6d 61 6b 65 73 |return S|Tk_makes|
|00000db0| 74 72 69 6e 67 28 63 74 | 69 6d 65 28 28 74 69 6d |tring(ct|ime((tim|
|00000dc0| 65 5f 74 20 2a 29 20 26 | 61 6d 70 3b 73 65 63 29 |e_t *) &|amp;sec)|
|00000dd0| 29 3b 0a 7d 0a 5c 65 6e | 64 7b 6c 69 73 74 69 6e |);.}.\en|d{listin|
|00000de0| 67 7d 5c 65 6e 64 7b 43 | 6f 64 65 7d 22 3e 0a 3c |g}\end{C|ode}">.<|
|00000df0| 42 52 3e 0a 0a 3c 50 3e | 0a 49 66 20 74 68 65 20 |BR>..<P>|.If the |
|00000e00| 53 63 68 65 6d 65 20 3c | 54 54 3e 70 6f 73 69 78 |Scheme <|TT>posix|
|00000e10| 2d 63 74 69 6d 65 3c 2f | 54 54 3e 20 70 72 69 6d |-ctime</|TT> prim|
|00000e20| 69 74 69 76 65 20 69 73 | 20 63 61 6c 6c 65 64 20 |itive is| called |
|00000e30| 77 69 74 68 20 6f 6e 65 | 20 70 61 72 61 6d 65 74 |with one| paramet|
|00000e40| 65 72 2c 20 69 74 0a 77 | 69 6c 6c 20 62 65 20 70 |er, it.w|ill be p|
|00000e50| 61 73 73 65 64 20 74 6f | 20 74 68 65 20 43 20 66 |assed to| the C f|
|00000e60| 75 6e 63 74 69 6f 6e 20 | 69 6e 20 74 68 65 20 3c |unction |in the <|
|00000e70| 54 54 3e 73 65 63 6f 6e | 64 73 3c 2f 54 54 3e 20 |TT>secon|ds</TT> |
|00000e80| 70 61 72 61 6d 65 74 65 | 72 2e 20 49 66 20 3c 54 |paramete|r. If <T|
|00000e90| 54 3e 70 6f 73 69 78 2d | 63 74 69 6d 65 3c 2f 54 |T>posix-|ctime</T|
|00000ea0| 54 3e 20 69 73 20 63 61 | 6c 6c 65 64 20 77 69 74 |T> is ca|lled wit|
|00000eb0| 68 6f 75 74 20 70 61 72 | 61 6d 65 74 65 72 2c 20 |hout par|ameter, |
|00000ec0| 3c 54 54 3e 73 65 63 6f | 6e 64 73 3c 2f 54 54 3e |<TT>seco|nds</TT>|
|00000ed0| 20 69 73 20 73 65 74 20 | 74 6f 20 74 68 65 20 73 | is set |to the s|
|00000ee0| 70 65 63 69 61 6c 0a 76 | 61 6c 75 65 20 55 4e 42 |pecial.v|alue UNB|
|00000ef0| 4f 55 4e 44 2e 20 53 6f | 2c 20 74 68 65 20 66 69 |OUND. So|, the fi|
|00000f00| 72 73 74 20 74 65 73 74 | 20 69 6e 20 74 68 69 73 |rst test| in this|
|00000f10| 20 66 75 6e 63 74 69 6f | 6e 20 63 6f 6e 73 69 73 | functio|n consis|
|00000f20| 74 73 20 74 6f 20 73 65 | 74 20 61 0a 63 6f 72 72 |ts to se|t a.corr|
|00000f30| 65 63 74 20 76 61 6c 75 | 65 20 74 6f 20 74 68 65 |ect valu|e to the|
|00000f40| 20 76 61 72 69 61 62 6c | 65 20 3c 54 54 3e 73 65 | variabl|e <TT>se|
|00000f50| 63 3c 2f 54 54 3e 3b 20 | 74 68 69 73 20 76 61 6c |c</TT>; |this val|
|00000f60| 75 65 20 69 73 20 65 69 | 74 68 65 72 20 74 68 65 |ue is ei|ther the|
|00000f70| 20 63 75 72 72 65 6e 74 | 0a 74 69 6d 65 2c 20 65 | current|.time, e|
|00000f80| 69 74 68 65 72 20 74 68 | 65 20 67 69 76 65 6e 20 |ither th|e given |
|00000f90| 69 6e 74 65 67 65 72 2c | 20 64 65 70 65 6e 64 69 |integer,| dependi|
|00000fa0| 6e 67 20 6f 66 20 74 68 | 65 20 6e 75 6d 62 65 72 |ng of th|e number|
|00000fb0| 20 6f 66 20 70 61 72 61 | 6d 65 74 65 72 73 0a 67 | of para|meters.g|
|00000fc0| 69 76 65 6e 20 74 6f 20 | 3c 54 54 3e 70 6f 73 69 |iven to |<TT>posi|
|00000fd0| 78 2d 63 74 69 6d 65 3c | 2f 54 54 3e 2e 0a 0a 3c |x-ctime<|/TT>...<|
|00000fe0| 50 3e 0a 4f 66 20 63 6f | 75 72 73 65 2c 20 74 68 |P>.Of co|urse, th|
|00000ff0| 65 20 74 79 70 65 20 6f | 66 20 74 68 69 73 20 6e |e type o|f this n|
|00001000| 65 77 20 70 72 69 6d 69 | 74 69 76 65 20 6d 75 73 |ew primi|tive mus|
|00001010| 74 20 62 65 20 63 68 61 | 6e 67 65 64 20 74 6f 20 |t be cha|nged to |
|00001020| 61 6c 6c 6f 77 20 30 20 | 6f 72 20 31 0a 70 61 72 |allow 0 |or 1.par|
|00001030| 61 6d 65 74 65 72 2e 20 | 54 68 69 73 20 69 73 20 |ameter. |This is |
|00001040| 64 6f 6e 65 20 62 79 20 | 63 68 61 6e 67 69 6e 67 |done by |changing|
|00001050| 20 74 68 65 20 3c 54 54 | 3e 74 63 5f 73 75 62 72 | the <TT|>tc_subr|
|00001060| 5f 30 3c 2f 54 54 3e 20 | 69 6e 20 74 68 65 20 70 |_0</TT> |in the p|
|00001070| 72 65 76 69 6f 75 73 20 | 0a 3c 54 54 3e 53 54 6b |revious |.<TT>STk|
|00001080| 5f 61 64 64 5f 6e 65 77 | 5f 70 72 69 6d 69 74 69 |_add_new|_primiti|
|00001090| 76 65 3c 2f 54 54 3e 20 | 62 79 20 74 63 5f 73 75 |ve</TT> |by tc_su|
|000010a0| 62 72 5f 30 5f 6f 72 5f | 31 2e 0a 0a 3c 50 3e 0a |br_0_or_|1...<P>.|
|000010b0| 54 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 74 79 |The foll|owing ty|
|000010c0| 70 65 73 20 61 72 65 20 | 61 76 61 69 6c 61 62 6c |pes are |availabl|
|000010d0| 65 20 66 6f 72 20 43 20 | 70 72 69 6d 69 74 69 76 |e for C |primitiv|
|000010e0| 65 73 3a 0a 0a 3c 55 4c | 3e 0a 3c 4c 49 3e 74 63 |es:..<UL|>.<LI>tc|
|000010f0| 5f 73 75 62 72 5f 30 20 | 66 6f 72 20 61 72 69 74 |_subr_0 |for arit|
|00001100| 79 2d 30 20 70 72 69 6d | 69 74 69 76 65 73 0a 3c |y-0 prim|itives.<|
|00001110| 2f 4c 49 3e 0a 3c 4c 49 | 3e 74 63 5f 73 75 62 72 |/LI>.<LI|>tc_subr|
|00001120| 5f 31 20 66 6f 72 20 61 | 72 69 74 79 2d 31 20 70 |_1 for a|rity-1 p|
|00001130| 72 69 6d 69 74 69 76 65 | 73 0a 3c 2f 4c 49 3e 0a |rimitive|s.</LI>.|
|00001140| 3c 4c 49 3e 74 63 5f 73 | 75 62 72 5f 32 20 66 6f |<LI>tc_s|ubr_2 fo|
|00001150| 72 20 61 72 69 74 79 2d | 32 20 70 72 69 6d 69 74 |r arity-|2 primit|
|00001160| 69 76 65 73 0a 3c 2f 4c | 49 3e 0a 3c 4c 49 3e 74 |ives.</L|I>.<LI>t|
|00001170| 63 5f 73 75 62 72 5f 33 | 20 66 6f 72 20 61 72 69 |c_subr_3| for ari|
|00001180| 74 79 2d 33 20 70 72 69 | 6d 69 74 69 76 65 73 0a |ty-3 pri|mitives.|
|00001190| 3c 2f 4c 49 3e 0a 3c 4c | 49 3e 74 63 5f 73 75 62 |</LI>.<L|I>tc_sub|
|000011a0| 72 5f 30 5f 6f 72 5f 31 | 20 66 6f 72 20 70 72 69 |r_0_or_1| for pri|
|000011b0| 6d 69 74 69 76 65 73 20 | 0a 20 20 20 20 20 20 77 |mitives |. w|
|000011c0| 68 69 63 68 20 68 61 76 | 65 20 30 20 6f 72 20 31 |hich hav|e 0 or 1|
|000011d0| 20 70 61 72 61 6d 65 74 | 65 72 0a 20 20 20 20 20 | paramet|er. |
|000011e0| 20 28 65 2e 67 2e 26 6e | 62 73 70 3b 3c 54 54 3e | (e.g.&n|bsp;<TT>|
|000011f0| 72 65 61 64 3c 2f 54 54 | 3e 29 2e 20 4f 6e 20 74 |read</TT|>). On t|
|00001200| 68 65 20 43 20 73 69 64 | 65 20 79 6f 75 20 68 61 |he C sid|e you ha|
|00001210| 76 65 20 74 6f 20 64 65 | 63 6c 61 72 65 20 61 20 |ve to de|clare a |
|00001220| 66 75 6e 63 74 69 6f 6e | 0a 20 20 20 20 20 20 77 |function|. w|
|00001230| 68 69 63 68 20 74 61 6b | 65 73 20 6f 6e 65 20 3c |hich tak|es one <|
|00001240| 54 54 3e 53 43 4d 3c 2f | 54 54 3e 20 61 72 67 75 |TT>SCM</|TT> argu|
|00001250| 6d 65 6e 74 2e 20 54 68 | 69 73 20 61 72 67 75 6d |ment. Th|is argum|
|00001260| 65 6e 74 20 69 73 20 73 | 65 74 20 74 6f 20 74 68 |ent is s|et to th|
|00001270| 65 0a 20 20 20 20 20 20 | 28 65 76 61 6c 75 61 74 |e. |(evaluat|
|00001280| 65 64 29 20 70 61 72 61 | 6d 65 74 65 72 20 69 66 |ed) para|meter if|
|00001290| 20 70 72 65 73 65 6e 74 | 2c 20 74 6f 20 3c 54 54 | present|, to <TT|
|000012a0| 3e 55 4e 42 4f 55 4e 44 | 3c 2f 54 54 3e 20 6f 74 |>UNBOUND|</TT> ot|
|000012b0| 68 65 72 77 69 73 65 2e | 0a 3c 2f 4c 49 3e 0a 3c |herwise.|.</LI>.<|
|000012c0| 4c 49 3e 74 63 5f 73 75 | 62 72 5f 31 5f 6f 72 5f |LI>tc_su|br_1_or_|
|000012d0| 32 20 66 6f 72 20 0a 20 | 20 20 20 20 20 70 72 69 |2 for . | pri|
|000012e0| 6d 69 74 69 76 65 73 20 | 77 68 69 63 68 20 68 61 |mitives |which ha|
|000012f0| 76 65 20 31 20 6f 72 20 | 32 20 70 61 72 61 6d 65 |ve 1 or |2 parame|
|00001300| 74 65 72 73 0a 20 20 20 | 20 20 20 28 65 2e 67 2e |ters. | (e.g.|
|00001310| 26 6e 62 73 70 3b 3c 54 | 54 3e 77 72 69 74 65 3c | <T|T>write<|
|00001320| 2f 54 54 3e 29 2e 20 48 | 65 72 65 20 79 6f 75 20 |/TT>). H|ere you |
|00001330| 68 61 76 65 20 74 6f 20 | 64 65 63 6c 61 72 65 20 |have to |declare |
|00001340| 61 20 43 20 66 75 6e 63 | 74 69 6f 6e 20 77 69 74 |a C func|tion wit|
|00001350| 68 0a 20 20 20 20 20 20 | 74 77 6f 20 3c 54 54 3e |h. |two <TT>|
|00001360| 53 43 4d 3c 2f 54 54 3e | 20 70 61 72 61 6d 65 74 |SCM</TT>| paramet|
|00001370| 65 72 73 2e 20 54 68 65 | 20 66 69 72 73 74 20 6f |ers. The| first o|
|00001380| 6e 65 20 77 69 6c 6c 20 | 63 6f 6e 74 61 69 6e 20 |ne will |contain |
|00001390| 74 68 65 20 66 69 72 73 | 74 20 53 63 68 65 6d 65 |the firs|t Scheme|
|000013a0| 20 0a 20 20 20 20 20 20 | 61 72 67 75 6d 65 6e 74 | . |argument|
|000013b0| 20 61 6e 64 20 74 68 65 | 20 73 65 63 6f 6e 64 20 | and the| second |
|000013c0| 77 69 6c 6c 20 63 6f 6e | 74 61 69 6e 20 74 68 65 |will con|tain the|
|000013d0| 20 73 65 63 6f 6e 64 20 | 61 72 67 75 6d 65 6e 74 | second |argument|
|000013e0| 20 76 61 6c 75 65 0a 20 | 20 20 20 20 20 6f 72 20 | value. | or |
|000013f0| 3c 54 54 3e 55 4e 42 4f | 55 4e 44 3c 2f 54 54 3e |<TT>UNBO|UND</TT>|
|00001400| 20 69 66 20 6f 6d 69 74 | 74 65 64 2e 0a 3c 2f 4c | if omit|ted..</L|
|00001410| 49 3e 0a 3c 4c 49 3e 74 | 63 5f 73 75 62 72 5f 32 |I>.<LI>t|c_subr_2|
|00001420| 5f 6f 72 5f 33 20 66 6f | 72 20 0a 20 20 20 20 20 |_or_3 fo|r . |
|00001430| 20 70 72 69 6d 69 74 69 | 76 65 73 20 77 68 69 63 | primiti|ves whic|
|00001440| 68 20 68 61 76 65 20 32 | 20 6f 72 20 33 20 70 61 |h have 2| or 3 pa|
|00001450| 72 61 6d 65 74 65 72 73 | 0a 20 20 20 20 20 20 28 |rameters|. (|
|00001460| 74 68 65 72 65 27 73 20 | 6e 6f 20 70 72 69 6d 69 |there's |no primi|
|00001470| 74 69 76 65 20 6f 66 20 | 74 68 69 73 20 74 79 70 |tive of |this typ|
|00001480| 65 20 69 6e 20 63 6f 72 | 65 20 69 6e 74 65 72 70 |e in cor|e interp|
|00001490| 72 65 74 65 72 29 2e 0a | 20 20 20 20 20 20 4f 66 |reter)..| Of|
|000014a0| 20 63 6f 75 72 73 65 2c | 20 79 6f 75 27 6c 6c 20 | course,| you'll |
|000014b0| 68 61 76 65 20 74 6f 20 | 64 65 63 6c 61 72 65 20 |have to |declare |
|000014c0| 61 20 43 20 66 75 6e 63 | 74 69 6f 6e 20 77 69 74 |a C func|tion wit|
|000014d0| 68 20 74 68 72 65 65 20 | 3c 54 54 3e 53 43 4d 3c |h three |<TT>SCM<|
|000014e0| 2f 54 54 3e 0a 20 20 20 | 20 20 20 70 61 72 61 6d |/TT>. | param|
|000014f0| 65 74 65 72 73 2e 20 41 | 70 61 72 74 20 74 68 61 |eters. A|part tha|
|00001500| 74 2c 20 63 6f 6e 76 65 | 6e 74 69 6f 6e 73 20 61 |t, conve|ntions a|
|00001510| 72 65 20 74 68 65 20 73 | 61 6d 65 20 68 61 73 20 |re the s|ame has |
|00001520| 62 65 66 6f 72 65 2e 0a | 3c 2f 4c 49 3e 0a 3c 4c |before..|</LI>.<L|
|00001530| 49 3e 74 63 5f 6c 73 75 | 62 72 20 66 6f 72 20 70 |I>tc_lsu|br for p|
|00001540| 72 69 6d 69 74 69 76 65 | 73 20 77 68 69 63 68 20 |rimitive|s which |
|00001550| 68 61 76 65 20 61 20 76 | 61 72 69 61 62 6c 65 20 |have a v|ariable |
|00001560| 6e 75 6d 62 65 72 20 6f | 66 0a 20 20 20 20 20 20 |number o|f. |
|00001570| 61 72 67 75 6d 65 6e 74 | 73 2e 20 41 63 74 75 61 |argument|s. Actua|
|00001580| 6c 73 20 61 72 67 75 6d | 65 6e 74 73 20 61 72 65 |ls argum|ents are|
|00001590| 20 63 6f 6c 6c 65 63 74 | 65 64 20 69 6e 20 61 20 | collect|ed in a |
|000015a0| 6c 69 73 74 20 77 68 69 | 63 68 20 69 73 20 67 69 |list whi|ch is gi|
|000015b0| 76 65 6e 20 61 73 20 74 | 68 65 0a 20 20 20 20 20 |ven as t|he. |
|000015c0| 20 66 69 72 73 74 20 61 | 72 67 75 6d 65 6e 74 20 | first a|rgument |
|000015d0| 6f 66 20 74 68 65 20 43 | 20 70 72 69 6d 69 74 69 |of the C| primiti|
|000015e0| 76 65 2e 20 54 68 65 20 | 73 65 63 6f 6e 64 20 61 |ve. The |second a|
|000015f0| 72 67 75 6d 65 6e 74 20 | 6f 66 20 74 68 65 20 43 |rgument |of the C|
|00001600| 20 66 75 6e 63 74 69 6f | 6e 0a 20 20 20 20 20 20 | functio|n. |
|00001610| 69 73 20 61 6e 20 69 6e | 74 65 67 65 72 20 63 6f |is an in|teger co|
|00001620| 75 6e 74 69 6e 67 20 74 | 68 65 20 61 63 74 75 61 |unting t|he actua|
|00001630| 6c 20 6e 75 6d 62 65 72 | 20 6f 66 20 61 72 67 75 |l number| of argu|
|00001640| 6d 65 6e 74 73 20 67 69 | 76 65 6e 20 74 6f 20 74 |ments gi|ven to t|
|00001650| 68 65 0a 20 20 20 20 20 | 20 70 72 69 6d 69 74 69 |he. | primiti|
|00001660| 76 65 2e 20 48 65 6e 63 | 65 2c 20 74 68 65 20 73 |ve. Henc|e, the s|
|00001670| 69 67 6e 61 74 75 72 65 | 20 6f 66 20 74 68 65 20 |ignature| of the |
|00001680| 43 20 66 75 6e 63 74 69 | 6f 6e 20 77 68 69 63 68 |C functi|on which|
|00001690| 20 69 6d 70 6c 65 6d 65 | 6e 74 20 61 20 3c 54 54 | impleme|nt a <TT|
|000016a0| 3e 20 20 20 20 20 20 74 | 63 5f 6c 73 75 62 72 3c |> t|c_lsubr<|
|000016b0| 2f 54 54 3e 20 6d 75 73 | 74 20 62 65 3c 50 52 45 |/TT> mus|t be<PRE|
|000016c0| 3e 0a 50 52 49 4d 49 54 | 49 56 45 20 66 75 6e 63 |>.PRIMIT|IVE func|
|000016d0| 74 69 6f 6e 28 53 43 4d | 20 61 72 67 6c 69 73 74 |tion(SCM| arglist|
|000016e0| 2c 20 69 6e 74 20 61 72 | 67 63 6f 75 6e 74 29 3b |, int ar|gcount);|
|000016f0| 0a 3c 2f 50 52 45 3e 0a | 20 20 20 20 20 20 4e 6f |.</PRE>.| No|
|00001700| 74 65 20 74 68 61 74 20 | 61 6c 6c 20 74 68 65 20 |te that |all the |
|00001710| 53 63 68 65 6d 65 20 61 | 72 67 75 6d 65 6e 74 73 |Scheme a|rguments|
|00001720| 20 61 72 65 20 65 76 61 | 6c 75 61 74 65 64 20 64 | are eva|luated d|
|00001730| 75 72 69 6e 67 20 74 68 | 65 0a 20 20 20 20 20 20 |uring th|e. |
|00001740| 63 6f 6e 73 74 72 75 63 | 74 69 6f 6e 20 6f 66 20 |construc|tion of |
|00001750| 74 68 65 20 6c 69 73 74 | 20 77 68 69 63 68 20 69 |the list| which i|
|00001760| 73 20 70 61 73 73 65 64 | 20 74 6f 20 74 68 65 20 |s passed| to the |
|00001770| 43 20 66 75 6e 63 74 69 | 6f 6e 2e 0a 3c 2f 4c 49 |C functi|on..</LI|
|00001780| 3e 0a 3c 4c 49 3e 74 63 | 5f 66 73 75 62 72 20 69 |>.<LI>tc|_fsubr i|
|00001790| 73 20 73 69 6d 69 6c 61 | 72 20 74 6f 20 3c 54 54 |s simila|r to <TT|
|000017a0| 3e 74 63 5f 6c 73 75 62 | 72 3c 2f 54 54 3e 20 65 |>tc_lsub|r</TT> e|
|000017b0| 78 63 65 70 74 20 74 68 | 61 74 0a 20 20 20 20 20 |xcept th|at. |
|000017c0| 20 61 72 67 75 6d 65 6e | 74 73 20 61 72 65 20 6e | argumen|ts are n|
|000017d0| 6f 74 20 65 76 61 6c 75 | 61 74 65 64 2e 20 4f 6e |ot evalu|ated. On|
|000017e0| 20 74 68 65 20 43 20 73 | 69 64 65 2c 20 79 6f 75 | the C s|ide, you|
|000017f0| 20 68 61 76 65 20 74 6f | 20 64 65 63 6c 61 72 65 | have to| declare|
|00001800| 20 61 20 66 75 6e 63 74 | 69 6f 6e 0a 20 20 20 20 | a funct|ion. |
|00001810| 20 20 77 69 74 68 20 74 | 68 72 65 65 20 3c 54 54 | with t|hree <TT|
|00001820| 3e 53 43 4d 3c 2f 54 54 | 3e 20 70 61 72 61 6d 65 |>SCM</TT|> parame|
|00001830| 74 65 72 73 3a 20 74 68 | 65 20 6c 69 73 74 20 6f |ters: th|e list o|
|00001840| 66 20 28 6e 6f 6e 20 65 | 76 61 6c 75 61 74 65 64 |f (non e|valuated|
|00001850| 29 20 61 72 67 75 6d 65 | 6e 74 73 2c 0a 20 20 20 |) argume|nts,. |
|00001860| 20 20 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 65 | the c|urrent e|
|00001870| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 61 6e 64 20 74 |nvironme|nt and t|
|00001880| 68 65 20 6c 65 6e 67 74 | 68 20 6f 66 20 74 68 65 |he lengt|h of the|
|00001890| 20 61 72 67 75 6d 65 6e | 74 73 20 6c 69 73 74 2e | argumen|ts list.|
|000018a0| 20 54 68 65 0a 20 20 20 | 20 20 20 73 69 67 6e 61 | The. | signa|
|000018b0| 74 75 72 65 20 6f 66 20 | 74 68 65 20 43 20 66 75 |ture of |the C fu|
|000018c0| 6e 63 74 69 6f 6e 20 77 | 68 69 63 68 20 69 6d 70 |nction w|hich imp|
|000018d0| 6c 65 6d 65 6e 74 20 61 | 20 3c 54 54 3e 74 63 5f |lement a| <TT>tc_|
|000018e0| 66 73 75 62 72 3c 2f 54 | 54 3e 20 6d 75 73 74 20 |fsubr</T|T> must |
|000018f0| 62 65 3c 50 52 45 3e 0a | 50 52 49 4d 49 54 49 56 |be<PRE>.|PRIMITIV|
|00001900| 45 20 66 75 6e 63 74 69 | 6f 6e 28 53 43 4d 20 61 |E functi|on(SCM a|
|00001910| 72 67 6c 69 73 74 2c 20 | 53 43 4d 20 65 6e 76 2c |rglist, |SCM env,|
|00001920| 20 69 6e 74 20 61 72 67 | 63 6f 75 6e 74 29 3b 0a | int arg|count);.|
|00001930| 3c 2f 50 52 45 3e 0a 20 | 20 20 20 20 20 53 65 65 |</PRE>. | See|
|00001940| 20 3c 41 20 48 52 45 46 | 3d 22 23 65 76 61 6c 75 | <A HREF|="#evalu|
|00001950| 61 74 69 6e 67 2d 61 72 | 67 73 22 20 54 41 52 47 |ating-ar|gs" TARG|
|00001960| 45 54 3d 22 5f 74 6f 70 | 22 3e 3c 49 4d 47 20 20 |ET="_top|"><IMG |
|00001970| 41 4c 54 3d 22 5b 2a 5d | 22 20 53 52 43 3d 22 63 |ALT="[*]|" SRC="c|
|00001980| 72 6f 73 73 72 65 66 2e | 70 6e 67 22 3e 3c 2f 41 |rossref.|png"></A|
|00001990| 3e 20 6d 6f 72 65 20 64 | 65 74 61 69 6c 73 20 61 |> more d|etails a|
|000019a0| 62 6f 75 74 20 3c 54 54 | 3e 74 63 5f 66 73 75 62 |bout <TT|>tc_fsub|
|000019b0| 72 3c 2f 54 54 3e 2e 0a | 0a 3c 50 3e 0a 3c 2f 4c |r</TT>..|.<P>.</L|
|000019c0| 49 3e 0a 3c 4c 49 3e 3c | 54 54 3e 74 63 5f 74 6b |I>.<LI><|TT>tc_tk|
|000019d0| 63 6f 6d 6d 61 6e 64 3c | 2f 54 54 3e 20 66 6f 72 |command<|/TT> for|
|000019e0| 20 70 72 69 6d 69 74 69 | 76 65 73 20 77 68 69 63 | primiti|ves whic|
|000019f0| 68 20 66 6f 6c 6c 6f 77 | 20 20 74 68 65 20 54 63 |h follow| the Tc|
|00001a00| 6c 0a 20 20 20 20 20 20 | 63 6f 6d 6d 61 6e 64 20 |l. |command |
|00001a10| 61 72 67 75 6d 65 6e 74 | 20 70 61 73 73 69 6e 67 |argument| passing|
|00001a20| 20 73 74 79 6c 65 20 28 | 69 2e 65 2e 26 6e 62 73 | style (|i.e.&nbs|
|00001a30| 70 3b 3c 45 4d 3e 26 23 | 32 32 34 3b 20 6c 61 3c |p;<EM>&#|224; la<|
|00001a40| 2f 45 4d 3e 20 3c 54 54 | 3e 61 72 67 63 2f 61 72 |/EM> <TT|>argc/ar|
|00001a50| 67 76 3c 2f 54 54 3e 29 | 2e 20 54 68 69 73 0a 20 |gv</TT>)|. This. |
|00001a60| 20 20 20 20 20 69 73 20 | 74 68 69 73 20 6b 69 6e | is |this kin|
|00001a70| 64 20 6f 66 20 70 72 6f | 63 65 64 75 72 65 20 74 |d of pro|cedure t|
|00001a80| 68 61 74 20 77 69 6c 6c | 20 62 65 20 75 73 65 64 |hat will| be used|
|00001a90| 20 66 6f 72 20 74 6f 20 | 61 64 64 20 6e 65 77 20 | for to |add new |
|00001aa0| 77 69 64 67 65 74 73 20 | 69 6e 20 74 68 65 0a 20 |widgets |in the. |
|00001ab0| 20 20 20 20 20 20 69 6e | 74 65 72 70 72 65 74 65 | in|terprete|
|00001ac0| 72 2e 20 53 65 65 20 3c | 41 20 48 52 45 46 3d 22 |r. See <|A HREF="|
|00001ad0| 23 6e 65 77 2d 77 69 64 | 67 65 74 22 20 54 41 52 |#new-wid|get" TAR|
|00001ae0| 47 45 54 3d 22 5f 74 6f | 70 22 3e 3c 49 4d 47 20 |GET="_to|p"><IMG |
|00001af0| 20 41 4c 54 3d 22 5b 2a | 5d 22 20 53 52 43 3d 22 | ALT="[*|]" SRC="|
|00001b00| 63 72 6f 73 73 72 65 66 | 2e 70 6e 67 22 3e 3c 2f |crossref|.png"></|
|00001b10| 41 3e 20 61 6e 64 20 5b | 23 21 6f 75 73 74 65 72 |A> and [|#!ouster|
|00001b20| 2d 62 6f 6f 6b 21 23 5d | 20 66 6f 72 20 6d 6f 72 |-book!#]| for mor|
|00001b30| 65 0a 20 20 20 20 20 20 | 64 65 74 61 69 6c 73 2e |e. |details.|
|00001b40| 0a 3c 2f 4c 49 3e 0a 3c | 2f 55 4c 3e 0a 0a 3c 50 |.</LI>.<|/UL>..<P|
|00001b50| 3e 0a 54 6f 20 69 6c 6c | 75 73 74 72 61 74 65 20 |>.To ill|ustrate |
|00001b60| 68 6f 77 20 74 6f 20 77 | 72 69 74 65 20 61 20 3c |how to w|rite a <|
|00001b70| 54 54 3e 74 63 5f 6c 73 | 75 62 72 3c 2f 54 54 3e |TT>tc_ls|ubr</TT>|
|00001b80| 20 70 72 69 6d 69 74 69 | 76 65 2c 20 6c 65 74 27 | primiti|ve, let'|
|00001b90| 73 20 68 61 76 65 20 61 | 20 6c 6f 6f 6b 20 61 74 |s have a| look at|
|00001ba0| 20 74 68 65 0a 63 6f 64 | 65 2c 20 67 69 76 65 6e | the.cod|e, given|
|00001bb0| 20 62 65 6c 6f 77 2c 20 | 6f 66 20 74 68 65 20 66 | below, |of the f|
|00001bc0| 75 6e 63 74 69 6f 6e 20 | 77 68 69 63 68 20 69 6d |unction |which im|
|00001bd0| 70 6c 65 6d 65 6e 74 20 | 74 68 65 20 53 63 68 65 |plement |the Sche|
|00001be0| 6d 65 20 70 72 69 6d 69 | 74 69 76 65 20 3c 54 54 |me primi|tive <TT|
|00001bf0| 3e 76 65 63 74 6f 72 3c | 2f 54 54 3e 3a 0a 3c 42 |>vector<|/TT>:.<B|
|00001c00| 4c 4f 43 4b 51 55 4f 54 | 45 3e 0a 3c 2f 42 4c 4f |LOCKQUOT|E>.</BLO|
|00001c10| 43 4b 51 55 4f 54 45 3e | 3c 50 52 45 3e 0a 50 52 |CKQUOTE>|<PRE>.PR|
|00001c20| 49 4d 49 54 49 56 45 20 | 53 54 6b 5f 76 65 63 74 |IMITIVE |STk_vect|
|00001c30| 6f 72 28 53 43 4d 20 61 | 72 67 6c 69 73 74 2c 20 |or(SCM a|rglist, |
|00001c40| 69 6e 74 20 61 72 67 63 | 6f 75 6e 74 29 0a 7b 0a |int argc|ount).{.|
|00001c50| 20 20 69 6e 74 20 6a 3b | 0a 20 20 53 43 4d 20 7a | int j;|. SCM z|
|00001c60| 20 3d 20 53 54 6b 5f 6d | 61 6b 65 76 65 63 74 28 | = STk_m|akevect(|
|00001c70| 61 72 67 63 6f 75 6e 74 | 2c 20 4e 55 4c 4c 29 3b |argcount|, NULL);|
|00001c80| 0a 20 20 0a 20 20 66 6f | 72 20 28 6a 20 3d 20 30 |. . fo|r (j = 0|
|00001c90| 3b 20 6a 20 26 6c 74 3b | 20 61 72 67 63 6f 75 6e |; j <| argcoun|
|00001ca0| 74 3b 20 6a 2b 2b 2c 20 | 61 72 67 6c 69 73 74 3d |t; j++, |arglist=|
|00001cb0| 43 44 52 28 61 72 67 6c | 69 73 74 29 29 20 7b 0a |CDR(argl|ist)) {.|
|00001cc0| 20 20 20 20 56 45 43 54 | 28 7a 29 5b 6a 5d 20 3d | VECT|(z)[j] =|
|00001cd0| 20 43 41 52 28 61 72 67 | 6c 69 73 74 29 3b 0a 20 | CAR(arg|list);. |
|00001ce0| 20 7d 0a 20 20 72 65 74 | 75 72 6e 20 7a 3b 0a 7d | }. ret|urn z;.}|
|00001cf0| 0a 3c 2f 50 52 45 3e 3c | 42 4c 4f 43 4b 51 55 4f |.</PRE><|BLOCKQUO|
|00001d00| 54 45 3e 0a 3c 2f 42 4c | 4f 43 4b 51 55 4f 54 45 |TE>.</BL|OCKQUOTE|
|00001d10| 3e 0a 0a 3c 50 3e 0a 54 | 68 69 73 20 66 75 6e 63 |>..<P>.T|his func|
|00001d20| 74 69 6f 6e 20 72 65 63 | 65 69 76 65 73 20 74 68 |tion rec|eives th|
|00001d30| 65 20 76 61 6c 75 65 73 | 20 70 61 73 73 65 64 20 |e values| passed |
|00001d40| 74 6f 20 74 68 65 20 3c | 54 54 3e 76 65 63 74 6f |to the <|TT>vecto|
|00001d50| 72 3c 2f 54 54 3e 20 70 | 72 69 6d 69 74 69 76 65 |r</TT> p|rimitive|
|00001d60| 73 20 69 6e 20 74 68 65 | 0a 6c 69 73 74 20 61 72 |s in the|.list ar|
|00001d70| 67 6c 69 73 74 20 28 74 | 68 65 20 6c 65 6e 67 74 |glist (t|he lengt|
|00001d80| 68 20 6f 66 20 74 68 69 | 73 20 6c 69 73 74 20 69 |h of thi|s list i|
|00001d90| 73 20 73 74 6f 72 65 64 | 20 69 6e 20 3c 54 54 3e |s stored| in <TT>|
|00001da0| 61 72 67 63 6f 75 6e 74 | 3c 2f 54 54 3e 29 2e 20 |argcount|</TT>). |
|00001db0| 54 68 69 73 0a 66 75 6e | 63 74 69 6f 6e 20 75 73 |This.fun|ction us|
|00001dc0| 65 73 20 53 54 6b 5f 6d | 61 6b 65 76 65 63 74 20 |es STk_m|akevect |
|00001dd0| 77 68 69 63 68 20 72 65 | 74 75 72 6e 73 20 61 20 |which re|turns a |
|00001de0| 53 63 68 65 6d 65 20 76 | 65 63 74 6f 72 2e 20 49 |Scheme v|ector. I|
|00001df0| 74 73 20 66 69 72 73 74 | 0a 61 72 67 75 6d 65 6e |ts first|.argumen|
|00001e00| 74 20 69 73 20 74 68 65 | 20 6c 65 6e 67 74 68 20 |t is the| length |
|00001e10| 6f 66 20 74 68 65 20 76 | 65 63 74 6f 72 20 61 6e |of the v|ector an|
|00001e20| 64 20 69 74 73 20 73 65 | 63 6f 6e 64 20 61 72 67 |d its se|cond arg|
|00001e30| 75 6d 65 6e 74 20 69 73 | 20 74 68 65 20 69 6e 69 |ument is| the ini|
|00001e40| 74 69 61 6c 0a 76 61 6c | 75 65 20 6f 66 20 74 68 |tial.val|ue of th|
|00001e50| 65 20 76 65 63 74 6f 72 | 27 73 20 65 6c 65 6d 65 |e vector|'s eleme|
|00001e60| 6e 74 73 2e 20 20 4e 65 | 78 74 20 73 65 63 74 69 |nts. Ne|xt secti|
|00001e70| 6f 6e 20 77 69 6c 6c 20 | 73 68 6f 77 20 68 6f 77 |on will |show how|
|00001e80| 20 74 6f 20 69 6d 70 6c | 65 6d 65 6e 74 20 61 0a | to impl|ement a.|
|00001e90| 70 72 69 6d 69 74 69 76 | 65 20 77 68 69 63 68 20 |primitiv|e which |
|00001ea0| 65 76 61 6c 75 61 74 65 | 73 20 69 74 73 65 6c 66 |evaluate|s itself|
|00001eb0| 20 69 74 73 20 70 61 72 | 61 6d 65 74 65 72 73 20 | its par|ameters |
|00001ec0| 28 69 2e 65 2e 20 61 20 | 3c 54 54 3e 74 63 5f 66 |(i.e. a |<TT>tc_f|
|00001ed0| 73 75 62 72 3c 2f 54 54 | 3e 0a 70 72 69 6d 69 74 |subr</TT|>.primit|
|00001ee0| 69 76 65 2e 0a 0a 3c 50 | 3e 0a 0a 3c 48 52 3e 0a |ive...<P|>..<HR>.|
|00001ef0| 0a 3c 2f 42 4f 44 59 3e | 0a 3c 2f 48 54 4d 4c 3e |.</BODY>|.</HTML>|
|00001f00| 0a | |. | |
+--------+-------------------------+-------------------------+--------+--------+