📄 salloc.7
字号:
.th SALLOC VII 6/15/72.sh NAMEsalloc \*- string allocation and manipulation.sh SYNOPSIS.nf(get size in r0).bd "jsr pc,allocate"(header address in r1).s3(get source header address in r0,destination header address in r1).bd "jsr pc,copy".s3.bd "jsr pc,wc".s3(all following routines assume r1 contains header address).s3.bd "jsr pc,release".s3(get character in r0).bd "jsr pc,putchar".s3.bd "jsr pc,lookchar"(character in r0).s3.bd "jsr pc,getchar"(character in r0).s3(get character in r0).bd "jsr pc,alterchar".s3(get position in r0).bd "jsr pc,seekchar".s3.bd "jsr pc,backspace"(character in r0).s3(get word in r0).bd "jsr pc,putword".s3.bd "jsr pc,lookword"(word in r0).s3.bd "jsr pc,getword"(word in r0).s3(get word in r0).bd "jsr pc,alterword".s3.bd "jsr pc,backword"(word in r0).s3.bd "jsr pc,length"(length in r0).s3.bd "jsr pc,position"(position in r0).s3.bd "jsr pc,rewind".s3.bd "jsr pc,create".s3.bd "jsr pc,fsfile".s3.bd "jsr pc,zero".fi.sh DESCRIPTIONThis package is a complete set of routinesfor dealing with almost arbitrarylength strings of words and bytes.It lives in.it /lib/libs.a.The strings are stored on a disk file, so the sum oftheir lengths can be considerably larger thanthe available core.A small buffer cache makes for reasonable speed..s3For each string there is a header of four words, namelya write pointer, a read pointer and pointers to the beginning and end ofthe block containing the string.Initially the read and write pointers point to the beginning of the string.All routines that refer to a string require the header address in r1.Unless the string is destroyed by the call,upon return r1 will point to the same string, althoughthe string may have grown to the extent that it had to bebe moved..s3.it Allocateobtains a string of the requested size and returnsa pointer to its header in r1..s3.it Releasereleases a string back to free storage..s3.it Putcharand.it putwordwrite a byte or word respectively into the stringand advance the write pointer..s3.it Lookcharand.it lookwordreada byte or word respectively from the string but do not advance the read pointer..s3.it Getcharand.it getwordread a byte or word respectively from the string and advance the read pointer..s3.it Altercharand.it alterwordwrite a byte or word respectively into the string where the read pointeris pointing and advance the read pointer..s3.it Backspaceand.it backwordread the last byte or word written and decrement the write pointer..s3All write operations will automatically get a larger block if the current block is exceeded.All read operations return with the error bit set if attempting to read beyond the write pointer..s3.it Seekcharmoves the read pointer to the offset specified in r0..s3.it Lengthreturns the current length of the string (beginning pointer to write pointer) in r0..s3.it Positionreturns the current offset of the read pointer in r0..s3.it Rewindmoves the read pointer to the beginning of the string..s3.it Createreturns the read and write pointers to the beginning of the string..s3.it Fsfilemoves the read pointer to the current position of the write pointer..s3.it Zerozeros the whole string and sets the write pointer to the beginning of the string..s3.it Copycopies the string whose header pointer is in r0 to the string whose header pointer is inr1.Care should be taken in using the copy instruction since r1 will be changed if the contents of the source stringis bigger than the destination string..s3.it Wcforces the contents of the internal buffers and the header blocks to be written on disc..s3An in-core version of this allocator exists in.it dc(I),and a permanent-file version exists in.it formand .it fed(VI)..sh FILES.if t .ta 1i.if n .ta 13/lib/libs.a library, accessed by.it "ld ... -ls".bralloc.d temporary file for string storage.sh "SEE ALSO"alloc (III).sh DIAGNOSTICS`error in copy' \*- disk write error encountered in.it copy..br`error in allocator' \*- routine called with bad header pointer..br`cannot open output file' \*- temp file .it alloc.d cannot be created or opened..br`out of space' \*- no sufficiently large block or no header is available for a new or growing block..sh BUGS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -