home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man7 / salloc.7 < prev   
Encoding:
Text File  |  1975-06-26  |  4.2 KB  |  186 lines

  1. .th SALLOC VII 6/15/72
  2. .sh NAME
  3. salloc \*- string allocation and manipulation
  4. .sh SYNOPSIS
  5. .nf
  6. (get size in r0)
  7. .bd "jsr    pc,allocate"
  8. (header address in r1)
  9. .s3
  10. (get source header address in r0,
  11. destination header address in r1)
  12. .bd "jsr    pc,copy"
  13. .s3
  14. .bd "jsr    pc,wc"
  15. .s3
  16. (all following routines assume r1 contains header address)
  17. .s3
  18. .bd "jsr    pc,release"
  19. .s3
  20. (get character in r0)
  21. .bd "jsr    pc,putchar"
  22. .s3
  23. .bd "jsr    pc,lookchar"
  24. (character in r0)
  25. .s3
  26. .bd "jsr    pc,getchar"
  27. (character in r0)
  28. .s3
  29. (get character in r0)
  30. .bd "jsr    pc,alterchar"
  31. .s3
  32. (get position in r0)
  33. .bd "jsr    pc,seekchar"
  34. .s3
  35. .bd "jsr    pc,backspace"
  36. (character in r0)
  37. .s3
  38. (get word in r0)
  39. .bd "jsr    pc,putword"
  40. .s3
  41. .bd "jsr    pc,lookword"
  42. (word in r0)
  43. .s3
  44. .bd "jsr    pc,getword"
  45. (word in r0)
  46. .s3
  47. (get word in r0)
  48. .bd "jsr    pc,alterword"
  49. .s3
  50. .bd "jsr    pc,backword"
  51. (word in r0)
  52. .s3
  53. .bd "jsr    pc,length"
  54. (length in r0)
  55. .s3
  56. .bd "jsr    pc,position"
  57. (position in r0)
  58. .s3
  59. .bd "jsr    pc,rewind"
  60. .s3
  61. .bd "jsr    pc,create"
  62. .s3
  63. .bd "jsr    pc,fsfile"
  64. .s3
  65. .bd "jsr    pc,zero"
  66. .fi
  67. .sh DESCRIPTION
  68. This package is a complete set of routines
  69. for dealing with almost arbitrary
  70. length strings of words and bytes.
  71. It lives in
  72. .it /lib/libs.a.
  73. The strings are stored on a disk file, so the sum of
  74. their lengths can be considerably larger than
  75. the available core.
  76. A small buffer cache makes for reasonable speed.
  77. .s3
  78. For each string there is a header of four words, namely
  79. a write pointer, a read pointer and pointers to the beginning and end of
  80. the block containing the string.
  81. Initially the read and write pointers point to the beginning of the string.
  82. All routines that refer to a string require the header address in r1.
  83. Unless the string is destroyed by the call,
  84. upon return r1 will point to the same string, although
  85. the string may have grown to the extent that it had to be
  86. be moved.
  87. .s3
  88. .it Allocate
  89. obtains a string of the requested size and returns
  90. a pointer to its header in r1.
  91. .s3
  92. .it Release
  93. releases a string back to free storage.
  94. .s3
  95. .it Putchar
  96. and
  97. .it putword
  98. write a byte or word respectively into the string
  99. and advance the write pointer.
  100. .s3
  101. .it Lookchar
  102. and
  103. .it lookword
  104. read
  105. a byte or word respectively from the string but do not advance the read pointer.
  106. .s3
  107. .it Getchar
  108. and
  109. .it getword
  110. read a byte or word respectively from the string and advance the read pointer.
  111. .s3
  112. .it Alterchar
  113. and
  114. .it alterword
  115. write a byte or word respectively into the string where the read pointer
  116. is pointing and advance the read pointer.
  117. .s3
  118. .it Backspace
  119. and
  120. .it backword
  121. read the last byte or word written and decrement the write pointer.
  122. .s3
  123. All write operations will automatically get a larger block if the current block is exceeded.
  124. All read operations return with the error bit set if attempting to read beyond the write pointer.
  125. .s3
  126. .it Seekchar
  127. moves the read pointer to the offset specified in r0.
  128. .s3
  129. .it Length
  130. returns the current length of the string (beginning pointer to write pointer) in r0.
  131. .s3
  132. .it Position
  133. returns the current offset of the read pointer in r0.
  134. .s3
  135. .it Rewind
  136. moves the read pointer to the beginning of the string.
  137. .s3
  138. .it Create
  139. returns the read and write pointers to the beginning of the string.
  140. .s3
  141. .it Fsfile
  142. moves the read pointer to the current position of the write pointer.
  143. .s3
  144. .it Zero
  145. zeros the whole string and sets the write pointer to the beginning of the string.
  146. .s3
  147. .it Copy
  148. copies the string whose header pointer is in r0 to the string whose header pointer is in
  149. r1.
  150. Care should be taken in using the copy instruction since r1 will be changed if the contents of the source string
  151. is bigger than the destination string.
  152. .s3
  153. .it Wc
  154. forces the contents of the internal buffers and the header blocks to be written on disc.
  155. .s3
  156. An in-core version of this allocator exists in
  157. .it dc
  158. (I),
  159. and a permanent-file version exists in
  160. .it form
  161. and 
  162. .it fed
  163. (VI).
  164. .sh FILES
  165. .if t .ta 1i
  166. .if n .ta 13
  167. /lib/libs.a    library, accessed by
  168. .it "ld ... -ls"
  169. .br
  170. alloc.d    temporary file for string storage
  171. .sh "SEE ALSO"
  172. alloc (III)
  173. .sh DIAGNOSTICS
  174. `error in copy' \*- disk write error encountered in
  175. .it copy.
  176. .br
  177. `error in allocator' \*- routine called with bad header pointer.
  178. .br
  179. `cannot open output file' \*- temp file 
  180. .it alloc.d 
  181. cannot be created or opened.
  182. .br
  183. `out of space' \*- no sufficiently large block or no 
  184. header is available for a new or growing block.
  185. .sh BUGS
  186.