home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pytexdoc / ext / lib / libr / swi / tex
LaTeX Document  |  1996-08-18  |  5.3 KB

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: tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 42 75 69 6c 74 2d 69 |\section|{Built-i|
|00000010| 6e 20 4d 6f 64 75 6c 65 | 20 5c 73 65 63 74 63 6f |n Module| \sectco|
|00000020| 64 65 7b 73 77 69 7d 7d | 0a 0a 5c 62 69 6d 6f 64 |de{swi}}|..\bimod|
|00000030| 69 6e 64 65 78 7b 73 77 | 69 7d 0a 0a 54 68 69 73 |index{sw|i}..This|
|00000040| 20 6d 6f 64 75 6c 65 20 | 70 72 6f 76 69 64 65 73 | module |provides|
|00000050| 20 61 63 63 65 73 73 20 | 74 6f 20 74 68 65 20 52 | access |to the R|
|00000060| 69 73 63 4f 53 20 53 57 | 49 20 69 6e 74 65 72 66 |iscOS SW|I interf|
|00000070| 61 63 65 2e 20 49 74 20 | 70 72 6f 76 69 64 65 73 |ace. It |provides|
|00000080| 0a 61 20 66 75 6e 63 74 | 69 6f 6e 20 5c 63 6f 64 |.a funct|ion \cod|
|00000090| 65 7b 73 77 69 7d 20 74 | 68 61 74 20 70 75 74 73 |e{swi} t|hat puts|
|000000a0| 20 73 75 69 74 61 62 6c | 65 20 76 61 6c 75 65 73 | suitabl|e values|
|000000b0| 20 69 6e 20 74 68 65 20 | 61 72 6d 20 72 65 67 69 | in the |arm regi|
|000000c0| 73 74 65 72 73 2c 0a 63 | 61 6c 6c 73 20 74 68 65 |sters,.c|alls the|
|000000d0| 20 53 57 49 20 61 6e 64 | 20 65 78 74 72 61 63 74 | SWI and| extract|
|000000e0| 73 20 76 61 6c 75 65 73 | 20 66 72 6f 6d 20 72 65 |s values| from re|
|000000f0| 67 69 73 74 65 72 73 2e | 0a 0a 41 73 20 6d 61 6e |gisters.|..As man|
|00000100| 79 20 53 57 49 73 20 6d | 61 6e 69 70 75 6c 61 74 |y SWIs m|anipulat|
|00000110| 65 20 62 6c 6f 63 6b 73 | 20 6f 66 20 6d 65 6d 6f |e blocks| of memo|
|00000120| 72 79 20 61 20 6e 65 77 | 20 6f 62 6a 65 63 74 20 |ry a new| object |
|00000130| 74 79 70 65 20 69 73 20 | 70 72 6f 76 69 64 65 64 |type is |provided|
|00000140| 0a 66 6f 72 20 68 61 6e | 64 6c 69 6e 67 20 62 6c |.for han|dling bl|
|00000150| 6f 63 6b 73 20 6f 66 20 | 6d 65 6d 6f 72 79 20 61 |ocks of |memory a|
|00000160| 6e 64 20 69 6e 73 65 72 | 74 69 6e 67 20 61 6e 64 |nd inser|ting and|
|00000170| 20 65 78 74 72 61 63 74 | 69 6e 67 20 76 61 6c 75 | extract|ing valu|
|00000180| 65 73 20 66 72 6f 6d 20 | 74 68 65 6d 2e 0a 0a 45 |es from |them...E|
|00000190| 72 72 6f 72 73 20 61 72 | 65 20 72 65 70 6f 72 74 |rrors ar|e report|
|000001a0| 65 64 20 61 73 20 65 78 | 63 65 70 74 69 6f 6e 73 |ed as ex|ceptions|
|000001b0| 3b 20 74 68 65 20 75 73 | 75 61 6c 20 65 78 63 65 |; the us|ual exce|
|000001c0| 70 74 69 6f 6e 73 20 61 | 72 65 20 67 69 76 65 6e |ptions a|re given|
|000001d0| 0a 66 6f 72 20 74 79 70 | 65 2c 20 69 6e 64 65 78 |.for typ|e, index|
|000001e0| 20 61 6e 64 20 76 61 6c | 75 65 20 65 72 72 6f 72 | and val|ue error|
|000001f0| 73 2c 20 77 68 69 6c 65 | 20 65 72 72 6f 72 73 20 |s, while| errors |
|00000200| 72 65 70 6f 72 74 65 64 | 20 62 79 20 58 20 76 65 |reported| by X ve|
|00000210| 72 73 69 6f 6e 73 20 6f | 66 20 74 68 65 0a 20 73 |rsions o|f the. s|
|00000220| 79 73 74 65 6d 20 63 61 | 6c 6c 73 20 72 61 69 73 |ystem ca|lls rais|
|00000230| 65 0a 5c 63 6f 64 65 7b | 73 77 69 2e 65 72 72 6f |e.\code{|swi.erro|
|00000240| 72 7d 2c 20 64 65 73 63 | 72 69 62 65 64 20 62 65 |r}, desc|ribed be|
|00000250| 6c 6f 77 2e 0a 0a 4d 6f | 64 75 6c 65 20 5c 63 6f |low...Mo|dule \co|
|00000260| 64 65 7b 73 77 69 7d 20 | 64 65 66 69 6e 65 73 20 |de{swi} |defines |
|00000270| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 64 61 |the foll|owing da|
|00000280| 74 61 20 69 74 65 6d 3a | 0a 0a 5c 72 65 6e 65 77 |ta item:|..\renew|
|00000290| 63 6f 6d 6d 61 6e 64 7b | 5c 69 6e 64 65 78 73 75 |command{|\indexsu|
|000002a0| 62 69 74 65 6d 7d 7b 28 | 65 78 63 65 70 74 69 6f |bitem}{(|exceptio|
|000002b0| 6e 20 69 6e 20 6d 6f 64 | 75 6c 65 20 73 77 69 29 |n in mod|ule swi)|
|000002c0| 7d 0a 5c 62 65 67 69 6e | 7b 65 78 63 64 65 73 63 |}.\begin|{excdesc|
|000002d0| 7d 7b 65 72 72 6f 72 7d | 0a 54 68 69 73 20 65 78 |}{error}|.This ex|
|000002e0| 63 65 70 74 69 6f 6e 20 | 69 73 20 72 61 69 73 65 |ception |is raise|
|000002f0| 64 20 77 68 65 6e 20 61 | 6e 20 52 69 73 63 4f 53 |d when a|n RiscOS|
|00000300| 20 58 20 53 57 49 20 72 | 65 74 75 72 6e 73 20 61 | X SWI r|eturns a|
|00000310| 0a 52 69 73 63 4f 53 2d | 72 65 6c 61 74 65 64 20 |.RiscOS-|related |
|00000320| 65 72 72 6f 72 20 28 65 | 2e 67 2e 2c 20 6e 6f 74 |error (e|.g., not|
|00000330| 20 66 6f 72 20 69 6c 6c | 65 67 61 6c 20 61 72 67 | for ill|egal arg|
|00000340| 75 6d 65 6e 74 20 74 79 | 70 65 73 29 2e 20 20 49 |ument ty|pes). I|
|00000350| 74 73 0a 73 74 72 69 6e | 67 20 76 61 6c 75 65 20 |ts.strin|g value |
|00000360| 69 73 20 5c 63 6f 64 65 | 7b 27 73 77 69 2e 65 72 |is \code|{'swi.er|
|00000370| 72 6f 72 27 7d 2e 20 20 | 54 68 65 20 61 63 63 6f |ror'}. |The acco|
|00000380| 6d 70 61 6e 79 69 6e 67 | 20 76 61 6c 75 65 20 69 |mpanying| value i|
|00000390| 73 20 61 0a 73 74 72 69 | 6e 67 20 72 65 74 75 72 |s a.stri|ng retur|
|000003a0| 6e 65 64 20 62 79 20 74 | 68 65 20 53 57 49 2e 0a |ned by t|he SWI..|
|000003b0| 5c 65 6e 64 7b 65 78 63 | 64 65 73 63 7d 0a 0a 49 |\end{exc|desc}..I|
|000003c0| 74 20 64 65 66 69 6e 65 | 73 20 74 68 65 20 66 6f |t define|s the fo|
|000003d0| 6c 6c 6f 77 69 6e 67 20 | 66 75 6e 63 74 69 6f 6e |llowing |function|
|000003e0| 73 3a 0a 0a 5c 72 65 6e | 65 77 63 6f 6d 6d 61 6e |s:..\ren|ewcomman|
|000003f0| 64 7b 5c 69 6e 64 65 78 | 73 75 62 69 74 65 6d 7d |d{\index|subitem}|
|00000400| 7b 28 69 6e 20 6d 6f 64 | 75 6c 65 20 73 77 69 29 |{(in mod|ule swi)|
|00000410| 7d 0a 5c 62 65 67 69 6e | 7b 66 75 6e 63 64 65 73 |}.\begin|{funcdes|
|00000420| 63 7d 7b 73 77 69 7d 7b | 6e 61 6d 65 2c 64 65 73 |c}{swi}{|name,des|
|00000430| 63 72 69 70 74 6f 72 2c | 2e 2e 2e 7d 0a 43 61 6c |criptor,|...}.Cal|
|00000440| 6c 73 20 74 68 65 20 73 | 77 69 20 67 69 76 65 6e |ls the s|wi given|
|00000450| 20 62 79 20 5c 76 61 72 | 7b 6e 61 6d 65 7d 20 77 | by \var|{name} w|
|00000460| 69 74 68 20 72 65 67 69 | 73 74 65 72 73 20 67 69 |ith regi|sters gi|
|00000470| 76 65 6e 20 62 79 20 5c | 76 61 72 7b 64 65 73 63 |ven by \|var{desc|
|00000480| 72 69 70 74 6f 72 7d 2e | 0a 5c 76 61 72 7b 6e 61 |riptor}.|.\var{na|
|00000490| 6d 65 7d 20 63 61 6e 20 | 65 69 74 68 65 72 20 62 |me} can |either b|
|000004a0| 65 20 61 6e 20 69 6e 74 | 65 67 65 72 20 53 57 49 |e an int|eger SWI|
|000004b0| 20 6e 75 6d 62 65 72 2c | 20 6f 72 20 61 20 73 74 | number,| or a st|
|000004c0| 72 69 6e 67 20 53 57 49 | 20 6e 61 6d 65 2e 20 0a |ring SWI| name. .|
|000004d0| 53 57 49 20 6e 61 6d 65 | 73 20 61 72 65 20 63 61 |SWI name|s are ca|
|000004e0| 73 65 20 64 65 70 65 6e | 64 65 6e 74 2e 20 54 6f |se depen|dent. To|
|000004f0| 20 63 61 6c 6c 20 74 68 | 65 20 58 20 76 65 72 73 | call th|e X vers|
|00000500| 69 6f 6e 20 6f 66 20 74 | 68 65 20 53 57 49 20 79 |ion of t|he SWI y|
|00000510| 6f 75 20 73 68 6f 75 6c | 64 0a 73 65 74 20 74 68 |ou shoul|d.set th|
|00000520| 65 20 58 20 62 69 74 20 | 69 6e 20 74 68 65 20 6e |e X bit |in the n|
|00000530| 75 6d 62 65 72 2c 20 6f | 72 20 70 72 65 63 65 65 |umber, o|r precee|
|00000540| 64 20 74 68 65 20 6e 61 | 6d 65 20 77 69 74 68 20 |d the na|me with |
|00000550| 58 2e 0a 0a 5c 76 61 72 | 7b 64 65 73 63 72 69 70 |X...\var|{descrip|
|00000560| 74 6f 72 7d 20 69 73 20 | 61 20 73 74 72 69 6e 67 |tor} is |a string|
|00000570| 20 74 68 61 74 20 64 65 | 74 65 72 6d 69 6e 65 73 | that de|termines|
|00000580| 20 74 68 65 20 72 65 67 | 69 73 74 65 72 73 20 74 | the reg|isters t|
|00000590| 6f 20 62 65 20 70 61 73 | 73 65 64 20 0a 61 6e 64 |o be pas|sed .and|
|000005a0| 20 72 65 74 75 72 6e 65 | 64 2e 20 56 61 6c 75 65 | returne|d. Value|
|000005b0| 73 20 74 6f 20 70 61 73 | 73 20 61 72 65 20 74 61 |s to pas|s are ta|
|000005c0| 6b 65 6e 20 73 65 71 75 | 65 6e 74 69 61 6c 6c 79 |ken sequ|entially|
|000005d0| 20 66 72 6f 6d 20 74 68 | 65 20 72 65 6d 61 69 6e | from th|e remain|
|000005e0| 69 6e 67 0a 61 72 67 75 | 6d 65 6e 74 73 2c 20 74 |ing.argu|ments, t|
|000005f0| 68 65 79 20 61 72 65 20 | 61 73 73 69 67 6e 65 64 |hey are |assigned|
|00000600| 20 74 6f 20 72 65 67 69 | 73 74 65 72 73 20 73 74 | to regi|sters st|
|00000610| 61 72 74 69 6e 67 20 66 | 72 6f 6d 20 72 30 2e 20 |arting f|rom r0. |
|00000620| 43 68 61 72 61 63 74 65 | 72 73 20 0a 6f 66 20 5c |Characte|rs .of \|
|00000630| 76 61 72 7b 64 65 73 63 | 72 69 70 74 6f 72 7d 20 |var{desc|riptor} |
|00000640| 69 6e 64 69 63 61 74 65 | 20 68 6f 77 20 74 6f 20 |indicate| how to |
|00000650| 70 61 73 73 20 76 61 6c | 75 65 73 2e 0a 0a 5c 62 |pass val|ues...\b|
|00000660| 65 67 69 6e 7b 74 61 62 | 6c 65 69 69 69 7d 7b 7c |egin{tab|leiii}{||
|00000670| 63 7c 6c 7c 63 7c 7d 7b | 73 61 6d 70 7d 7b 43 68 |c|l|c|}{|samp}{Ch|
|00000680| 61 72 61 63 74 65 72 7d | 7b 4d 65 61 6e 69 6e 67 |aracter}|{Meaning|
|00000690| 7d 7b 41 72 67 75 6d 65 | 6e 74 20 54 79 70 65 7d |}{Argume|nt Type}|
|000006a0| 0a 20 20 5c 6c 69 6e 65 | 69 69 69 7b 69 7d 7b 70 |. \line|iii{i}{p|
|000006b0| 61 73 73 20 61 6e 20 69 | 6e 74 65 67 65 72 7d 7b |ass an i|nteger}{|
|000006c0| 69 6e 74 7d 0a 20 20 5c | 6c 69 6e 65 69 69 69 7b |int}. \|lineiii{|
|000006d0| 73 7d 7b 70 61 73 73 20 | 61 20 70 6f 69 6e 74 65 |s}{pass |a pointe|
|000006e0| 72 20 74 6f 20 61 20 73 | 74 72 69 6e 67 7d 7b 73 |r to a s|tring}{s|
|000006f0| 74 72 69 6e 67 7d 0a 20 | 20 5c 6c 69 6e 65 69 69 |tring}. | \lineii|
|00000700| 69 7b 62 7d 7b 70 61 73 | 73 20 61 20 70 6f 69 6e |i{b}{pas|s a poin|
|00000710| 74 65 72 20 74 6f 20 74 | 68 65 20 73 74 61 72 74 |ter to t|he start|
|00000720| 20 6f 66 20 61 20 62 6c | 6f 63 6b 7d 7b 62 6c 6f | of a bl|ock}{blo|
|00000730| 63 6b 7d 0a 20 20 5c 6c | 69 6e 65 69 69 69 7b 65 |ck}. \l|ineiii{e|
|00000740| 7d 7b 70 61 73 73 20 61 | 20 70 6f 69 6e 74 65 72 |}{pass a| pointer|
|00000750| 20 61 66 74 65 72 20 74 | 68 65 20 65 6e 64 20 6f | after t|he end o|
|00000760| 66 20 61 20 62 6c 6f 63 | 6b 7d 7b 62 6c 6f 63 6b |f a bloc|k}{block|
|00000770| 7d 0a 20 20 5c 6c 69 6e | 65 69 69 69 7b 30 2d 39 |}. \lin|eiii{0-9|
|00000780| 7d 7b 69 6e 73 65 72 74 | 20 30 2d 39 20 69 6e 20 |}{insert| 0-9 in |
|00000790| 74 68 65 20 72 65 67 69 | 73 74 65 72 7d 7b 2d 7d |the regi|ster}{-}|
|000007a0| 0a 20 20 5c 6c 69 6e 65 | 69 69 69 7b 2d 7d 7b 69 |. \line|iii{-}{i|
|000007b0| 6e 73 65 72 74 20 24 2d | 31 24 20 69 6e 20 74 68 |nsert $-|1$ in th|
|000007c0| 65 20 72 65 67 69 73 74 | 65 72 7d 7b 2d 7d 0a 20 |e regist|er}{-}. |
|000007d0| 20 5c 6c 69 6e 65 69 69 | 69 7b 2e 7d 7b 73 6b 69 | \lineii|i{.}{ski|
|000007e0| 70 20 61 20 72 65 67 69 | 73 74 65 72 7d 7b 2d 7d |p a regi|ster}{-}|
|000007f0| 0a 5c 65 6e 64 7b 74 61 | 62 6c 65 69 69 69 7d 0a |.\end{ta|bleiii}.|
|00000800| 0a 4e 6f 74 65 3a 20 53 | 74 72 69 6e 67 73 20 61 |.Note: S|trings a|
|00000810| 72 65 20 72 65 61 64 2d | 2d 6f 6e 6c 79 2e 20 49 |re read-|-only. I|
|00000820| 66 20 79 6f 75 20 77 61 | 6e 74 20 74 6f 20 61 6c |f you wa|nt to al|
|00000830| 74 65 72 20 61 20 62 75 | 66 66 65 72 20 70 61 73 |ter a bu|ffer pas|
|00000840| 73 65 64 20 74 6f 20 61 | 20 53 57 49 20 79 6f 75 |sed to a| SWI you|
|00000850| 0a 20 6d 75 73 74 20 75 | 73 65 20 61 20 62 6c 6f |. must u|se a blo|
|00000860| 63 6b 2e 0a 0a 49 66 20 | 74 68 65 20 64 65 73 63 |ck...If |the desc|
|00000870| 72 69 70 74 6f 72 20 63 | 6f 6e 74 61 69 6e 73 20 |riptor c|ontains |
|00000880| 61 20 73 65 6d 69 2d 2d | 63 6f 6c 6f 6e 2c 20 63 |a semi--|colon, c|
|00000890| 68 61 72 61 63 74 65 72 | 73 20 61 66 74 65 72 20 |haracter|s after |
|000008a0| 74 68 69 73 20 72 65 66 | 65 72 0a 74 6f 20 76 61 |this ref|er.to va|
|000008b0| 6c 75 65 73 20 72 65 74 | 75 72 6e 65 64 20 62 79 |lues ret|urned by|
|000008c0| 20 72 65 67 69 73 74 65 | 72 73 2e 20 41 20 73 69 | registe|rs. A si|
|000008d0| 6e 67 6c 65 20 76 61 6c | 75 65 20 69 73 20 72 65 |ngle val|ue is re|
|000008e0| 74 75 72 6e 65 64 20 61 | 73 20 61 6e 0a 6f 62 6a |turned a|s an.obj|
|000008f0| 65 63 74 2e 20 53 65 76 | 65 72 61 6c 20 76 61 6c |ect. Sev|eral val|
|00000900| 75 65 73 20 61 72 65 20 | 72 65 74 75 72 6e 65 64 |ues are |returned|
|00000910| 20 61 73 20 61 20 74 75 | 70 6c 65 2e 0a 0a 5c 62 | as a tu|ple...\b|
|00000920| 65 67 69 6e 7b 74 61 62 | 6c 65 69 69 69 7d 7b 7c |egin{tab|leiii}{||
|00000930| 63 7c 6c 7c 63 7c 7d 7b | 73 61 6d 70 7d 7b 43 68 |c|l|c|}{|samp}{Ch|
|00000940| 61 72 61 63 74 65 72 7d | 7b 4d 65 61 6e 69 6e 67 |aracter}|{Meaning|
|00000950| 7d 7b 4f 75 74 70 75 74 | 20 54 79 70 65 7d 0a 20 |}{Output| Type}. |
|00000960| 20 5c 6c 69 6e 65 69 69 | 69 7b 69 7d 7b 72 65 74 | \lineii|i{i}{ret|
|00000970| 75 72 6e 20 61 6e 20 69 | 6e 74 65 67 65 72 7d 7b |urn an i|nteger}{|
|00000980| 69 6e 74 7d 0a 20 20 5c | 6c 69 6e 65 69 69 69 7b |int}. \|lineiii{|
|00000990| 73 7d 7b 72 65 74 75 72 | 6e 20 61 20 73 74 72 69 |s}{retur|n a stri|
|000009a0| 6e 67 7d 7b 73 74 72 69 | 6e 67 7d 0a 20 20 5c 6c |ng}{stri|ng}. \l|
|000009b0| 69 6e 65 69 69 69 7b 2a | 7d 7b 72 65 74 75 72 6e |ineiii{*|}{return|
|000009c0| 20 74 68 65 20 63 61 72 | 72 79 20 66 6c 61 67 7d | the car|ry flag}|
|000009d0| 7b 69 6e 74 7d 0a 20 20 | 5c 6c 69 6e 65 69 69 69 |{int}. |\lineiii|
|000009e0| 7b 2e 7d 7b 73 6b 69 70 | 20 61 20 72 65 67 69 73 |{.}{skip| a regis|
|000009f0| 74 65 72 7d 7b 2d 7d 0a | 5c 65 6e 64 7b 74 61 62 |ter}{-}.|\end{tab|
|00000a00| 6c 65 69 69 69 7d 0a 0a | 45 78 61 6d 70 6c 65 3a |leiii}..|Example:|
|00000a10| 20 77 69 6d 70 5f 69 6e | 69 74 69 61 6c 69 73 65 | wimp_in|itialise|
|00000a20| 0a 0a 5c 62 63 6f 64 65 | 5c 62 65 67 69 6e 7b 76 |..\bcode|\begin{v|
|00000a30| 65 72 62 61 74 69 6d 7d | 0a 3e 3e 3e 20 66 72 6f |erbatim}|.>>> fro|
|00000a40| 6d 20 73 77 69 20 69 6d | 70 6f 72 74 20 2a 0a 3e |m swi im|port *.>|
|00000a50| 3e 3e 20 6d 73 67 73 3d | 62 6c 6f 63 6b 28 32 2c |>> msgs=|block(2,|
|00000a60| 5b 30 78 36 30 30 63 30 | 2c 30 5d 29 0a 3e 3e 3e |[0x600c0|,0]).>>>|
|00000a70| 20 70 6e 61 6d 65 3d 22 | 6d 79 70 72 6f 67 22 0a | pname="|myprog".|
|00000a80| 3e 3e 3e 20 77 69 6d 70 | 76 65 72 2c 74 61 73 6b |>>> wimp|ver,task|
|00000a90| 68 61 6e 64 3d 73 77 69 | 28 30 78 36 30 30 63 30 |hand=swi|(0x600c0|
|00000aa0| 2c 22 69 69 73 62 3b 69 | 69 22 2c 33 31 30 2c 30 |,"iisb;i|i",310,0|
|00000ab0| 78 34 62 35 33 34 31 35 | 34 2c 70 6e 61 6d 65 2c |x4b53415|4,pname,|
|00000ac0| 6d 73 67 73 29 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |msgs).\e|nd{verba|
|00000ad0| 74 69 6d 7d 5c 65 63 6f | 64 65 0a 0a 5c 65 6e 64 |tim}\eco|de..\end|
|00000ae0| 7b 66 75 6e 63 64 65 73 | 63 7d 0a 0a 5c 62 65 67 |{funcdes|c}..\beg|
|00000af0| 69 6e 7b 66 75 6e 63 64 | 65 73 63 7d 7b 62 6c 6f |in{funcd|esc}{blo|
|00000b00| 63 6b 7d 7b 73 69 7a 65 | 20 5c 6f 70 74 69 6f 6e |ck}{size| \option|
|00000b10| 61 6c 7b 5c 2c 20 69 6e | 69 74 69 61 6c 69 7a 65 |al{\, in|itialize|
|00000b20| 72 7d 7d 0a 52 65 74 75 | 72 6e 73 20 61 20 6e 65 |r}}.Retu|rns a ne|
|00000b30| 77 20 62 6c 6f 63 6b 20 | 6f 66 20 5c 76 61 72 7b |w block |of \var{|
|00000b40| 73 69 7a 65 7d 20 77 6f | 72 64 73 2e 20 54 68 65 |size} wo|rds. The|
|00000b50| 20 69 6e 69 74 69 61 6c | 69 7a 65 72 20 6d 75 73 | initial|izer mus|
|00000b60| 74 20 62 65 20 61 20 73 | 74 72 69 6e 67 0a 6f 72 |t be a s|tring.or|
|00000b70| 20 61 20 6c 69 73 74 20 | 6f 66 20 69 6e 74 65 67 | a list |of integ|
|00000b80| 65 72 73 2e 20 54 68 65 | 20 69 6e 69 74 69 61 6c |ers. The| initial|
|00000b90| 69 7a 65 72 20 69 73 20 | 74 72 75 6e 63 61 74 65 |izer is |truncate|
|00000ba0| 64 20 74 6f 20 66 69 74 | 20 74 68 65 20 62 6c 6f |d to fit| the blo|
|00000bb0| 63 6b 2e 0a 49 66 20 69 | 74 20 69 73 20 74 6f 6f |ck..If i|t is too|
|00000bc0| 20 73 68 6f 72 74 20 69 | 74 20 69 73 20 70 61 64 | short i|t is pad|
|00000bd0| 64 65 64 20 77 69 74 68 | 20 7a 65 72 6f 73 2e 20 |ded with| zeros. |
|00000be0| 49 66 20 74 68 65 72 65 | 20 69 73 20 6e 6f 20 69 |If there| is no i|
|00000bf0| 6e 69 74 69 61 6c 69 7a | 65 72 0a 74 68 65 20 63 |nitializ|er.the c|
|00000c00| 6f 6e 74 65 6e 74 20 6f | 66 20 74 68 65 20 62 6c |ontent o|f the bl|
|00000c10| 6f 63 6b 20 69 73 20 75 | 6e 64 65 66 69 6e 65 64 |ock is u|ndefined|
|00000c20| 2e 0a 5c 65 6e 64 7b 66 | 75 6e 63 64 65 73 63 7d |..\end{f|uncdesc}|
|00000c30| 0a 0a 54 68 65 20 6d 65 | 6d 6f 72 79 20 6f 66 20 |..The me|mory of |
|00000c40| 61 20 62 6c 6f 63 6b 20 | 69 73 20 67 75 61 72 61 |a block |is guara|
|00000c50| 6e 74 65 65 64 20 6e 6f | 74 20 74 6f 20 6d 6f 76 |nteed no|t to mov|
|00000c60| 65 20 75 6e 6c 65 73 73 | 20 74 68 65 20 62 6c 6f |e unless| the blo|
|00000c70| 63 6b 20 69 73 20 64 65 | 6c 65 74 65 64 0a 6f 72 |ck is de|leted.or|
|00000c80| 20 72 65 73 69 7a 65 64 | 2e 0a 0a 42 6c 6f 63 6b | resized|...Block|
|00000c90| 73 20 73 75 70 70 6f 72 | 74 20 69 6e 64 65 78 20 |s suppor|t index |
|00000ca0| 61 6e 64 20 73 6c 69 63 | 65 20 6f 70 65 72 61 74 |and slic|e operat|
|00000cb0| 69 6f 6e 73 20 61 73 20 | 66 6f 72 20 6c 69 73 74 |ions as |for list|
|00000cc0| 73 20 6f 66 20 69 6e 74 | 65 67 65 72 73 2c 20 65 |s of int|egers, e|
|00000cd0| 78 63 65 70 74 0a 74 68 | 61 74 20 74 68 65 20 62 |xcept.th|at the b|
|00000ce0| 6c 6f 63 6b 20 63 61 6e | 6e 6f 74 20 63 68 61 6e |lock can|not chan|
|00000cf0| 67 65 20 73 69 7a 65 2c | 20 73 6f 20 61 73 73 69 |ge size,| so assi|
|00000d00| 67 6e 6d 65 6e 74 73 20 | 61 72 65 20 74 72 75 6e |gnments |are trun|
|00000d10| 63 61 74 65 64 20 6f 72 | 20 70 61 64 64 65 64 0a |cated or| padded.|
|00000d20| 61 73 20 66 6f 72 20 69 | 6e 69 74 69 61 6c 69 7a |as for i|nitializ|
|00000d30| 61 74 69 6f 6e 2e 20 53 | 6c 69 63 65 73 20 62 65 |ation. S|lices be|
|00000d40| 79 6f 6e 64 20 74 68 65 | 20 65 6e 64 20 6f 66 20 |yond the| end of |
|00000d50| 74 68 65 20 62 6c 6f 63 | 6b 20 67 69 76 65 20 69 |the bloc|k give i|
|00000d60| 6e 64 65 78 20 65 72 72 | 6f 72 73 2e 0a 0a 5c 62 |ndex err|ors...\b|
|00000d70| 65 67 69 6e 7b 66 75 6e | 63 64 65 73 63 7d 7b 72 |egin{fun|cdesc}{r|
|00000d80| 65 67 69 73 74 65 72 7d | 7b 73 69 7a 65 2c 61 64 |egister}|{size,ad|
|00000d90| 64 72 65 73 73 7d 0a 52 | 65 67 69 73 74 65 72 73 |dress}.R|egisters|
|00000da0| 20 61 20 70 72 65 78 69 | 73 74 69 6e 67 20 6d 65 | a prexi|sting me|
|00000db0| 6d 6f 72 79 20 62 6c 6f | 63 6b 20 6f 66 20 5c 76 |mory blo|ck of \v|
|00000dc0| 61 72 7b 73 69 7a 65 7d | 20 77 6f 72 64 73 20 61 |ar{size}| words a|
|00000dd0| 73 20 61 20 62 6c 6f 63 | 6b 2e 0a 52 65 74 75 72 |s a bloc|k..Retur|
|00000de0| 6e 73 20 61 20 6e 65 77 | 20 62 6c 6f 63 6b 2e 20 |ns a new| block. |
|00000df0| 54 68 65 20 6d 65 6d 6f | 72 79 20 73 75 70 70 6c |The memo|ry suppl|
|00000e00| 69 65 64 20 77 69 6c 6c | 20 6e 6f 74 20 62 65 20 |ied will| not be |
|00000e10| 66 72 65 65 64 20 77 68 | 65 6e 20 74 68 65 20 62 |freed wh|en the b|
|00000e20| 6c 6f 63 6b 0a 69 73 20 | 64 65 6c 65 74 65 64 2c |lock.is |deleted,|
|00000e30| 20 6f 72 20 6d 6f 76 65 | 64 20 77 68 65 6e 20 69 | or move|d when i|
|00000e40| 74 20 69 73 20 72 65 73 | 69 7a 65 64 2e 0a 5c 65 |t is res|ized..\e|
|00000e50| 6e 64 7b 66 75 6e 63 64 | 65 73 63 7d 0a 0a 42 6c |nd{funcd|esc}..Bl|
|00000e60| 6f 63 6b 20 69 74 65 6d | 73 20 73 75 70 70 6f 72 |ock item|s suppor|
|00000e70| 74 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |t the fo|llowing |
|00000e80| 64 61 74 61 20 69 74 65 | 6d 73 20 61 6e 64 20 6d |data ite|ms and m|
|00000e90| 65 74 68 6f 64 73 2e 0a | 0a 5c 62 65 67 69 6e 7b |ethods..|.\begin{|
|00000ea0| 64 61 74 61 64 65 73 63 | 7d 7b 6c 65 6e 67 74 68 |datadesc|}{length|
|00000eb0| 7d 0a 54 68 65 20 6c 65 | 6e 67 74 68 20 6f 66 20 |}.The le|ngth of |
|00000ec0| 74 68 65 20 62 6c 6f 63 | 6b 20 69 6e 20 62 79 74 |the bloc|k in byt|
|00000ed0| 65 73 2e 20 45 71 75 61 | 6c 20 74 6f 20 5c 63 6f |es. Equa|l to \co|
|00000ee0| 64 65 7b 34 2a 6c 65 6e | 28 5c 76 61 72 7b 62 6c |de{4*len|(\var{bl|
|00000ef0| 6f 63 6b 7d 29 7d 2e 0a | 5c 65 6e 64 7b 64 61 74 |ock})}..|\end{dat|
|00000f00| 61 64 65 73 63 7d 0a 0a | 5c 62 65 67 69 6e 7b 64 |adesc}..|\begin{d|
|00000f10| 61 74 61 64 65 73 63 7d | 7b 73 74 61 72 74 7d 0a |atadesc}|{start}.|
|00000f20| 54 68 65 20 73 74 61 72 | 74 20 61 64 64 72 65 73 |The star|t addres|
|00000f30| 73 20 6f 66 20 74 68 65 | 20 6d 65 6d 6f 72 79 20 |s of the| memory |
|00000f40| 62 6c 6f 63 6b 2e 0a 5c | 65 6e 64 7b 64 61 74 61 |block..\|end{data|
|00000f50| 64 65 73 63 7d 0a 0a 5c | 62 65 67 69 6e 7b 64 61 |desc}..\|begin{da|
|00000f60| 74 61 64 65 73 63 7d 7b | 65 6e 64 7d 0a 54 68 65 |tadesc}{|end}.The|
|00000f70| 20 61 64 64 72 65 73 73 | 20 61 66 74 65 72 20 74 | address| after t|
|00000f80| 68 65 20 65 6e 64 20 6f | 66 20 74 68 65 20 6d 65 |he end o|f the me|
|00000f90| 6d 6f 72 79 20 62 6c 6f | 63 6b 2e 0a 5c 65 6e 64 |mory blo|ck..\end|
|00000fa0| 7b 64 61 74 61 64 65 73 | 63 7d 0a 0a 5c 62 65 67 |{datades|c}..\beg|
|00000fb0| 69 6e 7b 66 75 6e 63 64 | 65 73 63 7d 7b 70 61 64 |in{funcd|esc}{pad|
|00000fc0| 73 74 72 69 6e 67 7d 7b | 73 74 72 69 6e 67 2c 70 |string}{|string,p|
|00000fd0| 61 64 63 68 61 72 20 5c | 6f 70 74 69 6f 6e 61 6c |adchar \|optional|
|00000fe0| 7b 5c 2c 78 2c 79 7d 7d | 0a 54 68 65 20 73 74 72 |{\,x,y}}|.The str|
|00000ff0| 69 6e 67 20 69 73 20 63 | 6f 70 69 65 64 20 69 6e |ing is c|opied in|
|00001000| 74 6f 20 74 68 65 20 62 | 6c 6f 63 6b 20 62 65 74 |to the b|lock bet|
|00001010| 77 65 65 6e 20 62 79 74 | 65 73 20 5c 63 6f 64 65 |ween byt|es \code|
|00001020| 7b 78 7d 20 20 61 6e 64 | 20 5c 63 6f 64 65 7b 79 |{x} and| \code{y|
|00001030| 2d 31 7d 2e 0a 54 68 65 | 20 73 74 72 69 6e 67 20 |-1}..The| string |
|00001040| 69 73 20 74 72 75 6e 63 | 61 74 65 64 20 6f 72 20 |is trunc|ated or |
|00001050| 70 61 64 64 65 64 20 77 | 69 74 68 20 5c 76 61 72 |padded w|ith \var|
|00001060| 7b 70 61 64 63 68 61 72 | 7d 20 61 73 20 72 65 71 |{padchar|} as req|
|00001070| 75 69 72 65 64 2e 0a 5c | 76 61 72 7b 78 7d 20 61 |uired..\|var{x} a|
|00001080| 6e 64 20 5c 76 61 72 7b | 79 7d 20 64 65 66 61 75 |nd \var{|y} defau|
|00001090| 6c 74 20 74 6f 20 30 20 | 61 6e 64 20 5c 63 6f 64 |lt to 0 |and \cod|
|000010a0| 65 7b 62 6c 6f 63 6b 2e | 6c 65 6e 67 74 68 7d 2e |e{block.|length}.|
|000010b0| 0a 5c 65 6e 64 7b 66 75 | 6e 63 64 65 73 63 7d 0a |.\end{fu|ncdesc}.|
|000010c0| 0a 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|000010d0| 7d 7b 74 6f 73 74 72 69 | 6e 67 7d 7b 5c 6f 70 74 |}{tostri|ng}{\opt|
|000010e0| 69 6f 6e 61 6c 7b 78 2c | 79 7d 7d 0a 54 68 65 20 |ional{x,|y}}.The |
|000010f0| 62 79 74 65 73 20 62 65 | 74 77 65 65 6e 20 5c 63 |bytes be|tween \c|
|00001100| 6f 64 65 7b 78 7d 20 20 | 61 6e 64 20 5c 63 6f 64 |ode{x} |and \cod|
|00001110| 65 7b 79 2d 31 7d 20 61 | 72 65 20 72 65 74 75 72 |e{y-1} a|re retur|
|00001120| 6e 65 64 20 61 73 20 61 | 20 73 74 72 69 6e 67 2e |ned as a| string.|
|00001130| 0a 5c 76 61 72 7b 78 7d | 20 61 6e 64 20 5c 76 61 |.\var{x}| and \va|
|00001140| 72 7b 79 7d 20 64 65 66 | 61 75 6c 74 20 74 6f 20 |r{y} def|ault to |
|00001150| 30 20 61 6e 64 20 5c 63 | 6f 64 65 7b 62 6c 6f 63 |0 and \c|ode{bloc|
|00001160| 6b 2e 6c 65 6e 67 74 68 | 7d 2e 0a 5c 65 6e 64 7b |k.length|}..\end{|
|00001170| 66 75 6e 63 64 65 73 63 | 7d 0a 0a 5c 62 65 67 69 |funcdesc|}..\begi|
|00001180| 6e 7b 66 75 6e 63 64 65 | 73 63 7d 7b 6e 75 6c 6c |n{funcde|sc}{null|
|00001190| 73 74 72 69 6e 67 7d 7b | 5c 6f 70 74 69 6f 6e 61 |string}{|\optiona|
|000011a0| 6c 7b 78 2c 79 7d 7d 0a | 54 68 65 20 62 79 74 65 |l{x,y}}.|The byte|
|000011b0| 73 20 62 65 74 77 65 65 | 6e 20 5c 63 6f 64 65 7b |s betwee|n \code{|
|000011c0| 78 7d 20 20 61 6e 64 20 | 5c 63 6f 64 65 7b 79 2d |x} and |\code{y-|
|000011d0| 31 7d 20 61 72 65 20 72 | 65 74 75 72 6e 65 64 20 |1} are r|eturned |
|000011e0| 61 73 20 61 20 73 74 72 | 69 6e 67 2c 20 74 68 65 |as a str|ing, the|
|000011f0| 0a 73 74 72 69 6e 67 20 | 69 73 20 74 65 72 6d 69 |.string |is termi|
|00001200| 6e 61 74 65 64 20 62 65 | 66 6f 72 65 20 74 68 65 |nated be|fore the|
|00001210| 20 66 69 72 73 74 20 6e | 75 6c 6c 20 63 68 61 72 | first n|ull char|
|00001220| 61 63 74 65 72 20 69 66 | 20 61 6e 79 2e 0a 5c 76 |acter if| any..\v|
|00001230| 61 72 7b 78 7d 20 61 6e | 64 20 5c 76 61 72 7b 79 |ar{x} an|d \var{y|
|00001240| 7d 20 64 65 66 61 75 6c | 74 20 74 6f 20 30 20 61 |} defaul|t to 0 a|
|00001250| 6e 64 20 5c 63 6f 64 65 | 7b 62 6c 6f 63 6b 2e 6c |nd \code|{block.l|
|00001260| 65 6e 67 74 68 7d 2e 0a | 5c 65 6e 64 7b 66 75 6e |ength}..|\end{fun|
|00001270| 63 64 65 73 63 7d 0a 0a | 5c 62 65 67 69 6e 7b 66 |cdesc}..|\begin{f|
|00001280| 75 6e 63 64 65 73 63 7d | 7b 63 74 72 6c 73 74 72 |uncdesc}|{ctrlstr|
|00001290| 69 6e 67 7d 7b 5c 6f 70 | 74 69 6f 6e 61 6c 7b 78 |ing}{\op|tional{x|
|000012a0| 2c 79 7d 7d 0a 54 68 65 | 20 62 79 74 65 73 20 62 |,y}}.The| bytes b|
|000012b0| 65 74 77 65 65 6e 20 5c | 63 6f 64 65 7b 78 7d 20 |etween \|code{x} |
|000012c0| 20 61 6e 64 20 5c 63 6f | 64 65 7b 79 2d 31 7d 20 | and \co|de{y-1} |
|000012d0| 61 72 65 20 72 65 74 75 | 72 6e 65 64 20 61 73 20 |are retu|rned as |
|000012e0| 61 20 73 74 72 69 6e 67 | 2c 20 74 68 65 0a 73 74 |a string|, the.st|
|000012f0| 72 69 6e 67 20 69 73 20 | 74 65 72 6d 69 6e 61 74 |ring is |terminat|
|00001300| 65 64 20 62 65 66 6f 72 | 65 20 74 68 65 20 66 69 |ed befor|e the fi|
|00001310| 72 73 74 20 63 6f 6e 74 | 72 6f 6c 20 63 68 61 72 |rst cont|rol char|
|00001320| 61 63 74 65 72 20 69 66 | 20 61 6e 79 2e 0a 5c 76 |acter if| any..\v|
|00001330| 61 72 7b 78 7d 20 61 6e | 64 20 5c 76 61 72 7b 79 |ar{x} an|d \var{y|
|00001340| 7d 20 64 65 66 61 75 6c | 74 20 74 6f 20 30 20 61 |} defaul|t to 0 a|
|00001350| 6e 64 20 5c 63 6f 64 65 | 7b 62 6c 6f 63 6b 2e 6c |nd \code|{block.l|
|00001360| 65 6e 67 74 68 7d 2e 0a | 5c 65 6e 64 7b 66 75 6e |ength}..|\end{fun|
|00001370| 63 64 65 73 63 7d 0a 0a | 5c 62 65 67 69 6e 7b 66 |cdesc}..|\begin{f|
|00001380| 75 6e 63 64 65 73 63 7d | 7b 62 69 74 73 65 74 7d |uncdesc}|{bitset}|
|00001390| 7b 69 2c 78 2c 79 7d 0a | 5c 63 6f 64 65 7b 62 2e |{i,x,y}.|\code{b.|
|000013a0| 62 69 74 73 65 74 28 78 | 2c 79 29 7d 20 69 73 20 |bitset(x|,y)} is |
|000013b0| 65 71 75 69 76 61 6c 65 | 6e 74 20 74 6f 20 5c 76 |equivale|nt to \v|
|000013c0| 65 72 62 7c 62 5b 69 5d | 3d 28 62 5b 69 5d 26 79 |erb|b[i]|=(b[i]&y|
|000013d0| 29 5e 78 7c 2e 0a 5c 65 | 6e 64 7b 66 75 6e 63 64 |)^x|..\e|nd{funcd|
|000013e0| 65 73 63 7d 0a 0a 5c 62 | 65 67 69 6e 7b 66 75 6e |esc}..\b|egin{fun|
|000013f0| 63 64 65 73 63 7d 7b 72 | 65 73 69 7a 65 7d 7b 73 |cdesc}{r|esize}{s|
|00001400| 69 7a 65 7d 0a 43 68 61 | 6e 67 65 73 20 74 68 65 |ize}.Cha|nges the|
|00001410| 20 73 69 7a 65 20 6f 66 | 20 74 68 65 20 62 6c 6f | size of| the blo|
|00001420| 63 6b 2e 20 54 68 65 20 | 6e 65 77 20 73 69 7a 65 |ck. The |new size|
|00001430| 20 69 73 20 69 6e 20 77 | 6f 72 64 73 2e 20 49 66 | is in w|ords. If|
|00001440| 20 74 68 65 20 62 6c 6f | 63 6b 20 77 61 73 0a 63 | the blo|ck was.c|
|00001450| 72 65 61 74 65 64 20 75 | 73 69 6e 67 20 5c 63 6f |reated u|sing \co|
|00001460| 64 65 7b 72 65 67 69 73 | 74 65 72 7d 20 74 68 69 |de{regis|ter} thi|
|00001470| 73 20 6a 75 73 74 20 63 | 68 61 6e 67 65 73 20 74 |s just c|hanges t|
|00001480| 68 65 20 72 65 63 6f 72 | 64 65 64 20 65 6e 64 20 |he recor|ded end |
|00001490| 6f 66 20 74 68 65 0a 62 | 6c 6f 63 6b 2e 20 4f 74 |of the.b|lock. Ot|
|000014a0| 68 65 72 77 69 73 65 20 | 74 68 65 20 62 6c 6f 63 |herwise |the bloc|
|000014b0| 6b 20 6d 61 79 20 6d 6f | 76 65 2c 20 61 6e 64 20 |k may mo|ve, and |
|000014c0| 74 68 65 20 64 61 74 61 | 20 69 6e 20 74 68 65 20 |the data| in the |
|000014d0| 62 6c 6f 63 6b 20 69 73 | 0a 74 72 75 6e 63 61 74 |block is|.truncat|
|000014e0| 65 64 20 6f 72 20 7a 65 | 72 6f 20 70 61 64 64 65 |ed or ze|ro padde|
|000014f0| 64 20 61 73 20 6e 65 63 | 63 65 73 61 72 79 2e 0a |d as nec|cesary..|
|00001500| 5c 65 6e 64 7b 66 75 6e | 63 64 65 73 63 7d 0a 0a |\end{fun|cdesc}..|
+--------+-------------------------+-------------------------+--------+--------+