|
|
1.1 root 1: .pa 1
2: .he 'SALLOC (III)'6/15/72'SALLOC (III)'
3: .ti 0
4: .nf
5: NAME salloc -- string manipulation routines
6: .fi
7: .sp
8: .ti 0
9: .nf
10: SYNOPSIS (get size in r0)
11: .br
12: jsr pc,allocate
13: .sp
14: (get source pointer in r0,
15: destination pointer in r1)
16: jsr pc,copy
17: .sp
18: jsr pc,wc
19: .sp
20: (all following instructions assume r1 contains pointer)
21:
22: jsr pc,release
23:
24: (get character in r0)
25: jsr pc,putchar
26: .sp
27: jsr pc,lookchar
28: (character in r0)
29:
30: jsr pc,getchar
31: (character in r0)
32:
33: (get character in r0)
34: jsr pc,alterchar
35:
36: (get position in r0)
37: jsr pc,seekchar
38:
39: jsr pc,backspace
40: (character in r0)
41:
42: (get word in r0)
43: jsr pc,putword
44:
45: jsr pc,lookword
46: (word in r0)
47:
48: jsr pc,getword
49: (word in r0)
50:
51: (get word in r0)
52: jsr pc,alterword
53:
54: jsr pc,backword
55: (word in r0)
56:
57: jsr pc,length
58: (length in r0)
59:
60: jsr pc,position
61: (position in r0)
62:
63: jsr pc,rewind
64:
65: jsr pc,create
66:
67: jsr pc,fsfile
68:
69: jsr pc,zero
70:
71: .fi
72: .ti 0
73: DESCRIPTION This package is a complete set of routines
74: for dealing with almost arbitrary
75: length strings of words and bytes.
76: The strings are stored on a disk file, so the sum of
77: their lengths can be considerably larger than
78: the available core.
79:
80: For each string there is a header of four words, namely
81: a write pointer, a read pointer and pointers to the beginning and end of
82: the block containing the string.
83: Initially the read and write pointers point to the beginning of the string.
84: All routines that refer to a string require the header address in r1.
85: Unless the string is destroyed by the call,
86: upon return r1 will point to the same string, although
87: the string may have grown to the extent that it had to be
88: be moved.
89:
90: .ul
91: allocate
92: obtains a string of the requested size and returns
93: a pointer to its header in r1.
94: .sp
95: release_______ releases a string back to free storage.
96: .sp
97: putchar_______ and putword_______ write a byte or word respectively into the string
98: and advance the write pointer.
99:
100: .ul
101: lookchar
102: and
103: .ul
104: lookword
105: read
106: a byte or word respectively from the string but do not advance the read pointer.
107:
108: getchar_______ and getword_______ read a byte or word respectively from the string and advance the read pointer.
109:
110: alterchar_________ and alterword_________ write a byte or word respectively into the string where the read pointer
111: is pointing and advance the read pointer.
112:
113: backspace_________ and backword________ read the last byte or word written and decrement the write pointer.
114:
115: All write operations will automatically get a larger block if the current block is exceeded.
116: All read operations return with the error bit set if attempting to read beyond the write pointer.
117: .sp
118: seekchar________ moves the read pointer to the offset specified in r0.
119:
120: length______ returns the current length of the string (beginning pointer to write pointer) in r0.
121:
122: position________ returns the current offset of the read pointer in r0.
123:
124: rewind______ moves the read pointer to the beginning of the string.
125:
126: create______ returns the read and write pointers to the beginning of the string.
127:
128: fsfile______ moves the read pointer to the current position of the write pointer.
129:
130: zero____ zeros the whole string and sets the write pointer to the beginning of the string.
131:
132: copy____ copies the string whose header pointer is in r0 to the string whose header pointer is in
133: r1.
134: Care should be taken in using the copy instruction since r1 will be changed if the contents of the source string
135: is bigger than the destination string.
136:
137: wc__ forces the contents of the internal buffers and the header blocks to be written on disc.
138: .sp
139: .ti 0
140: FILES The allocator is in
141: /lib/libs.a;
142: the -s__ option to ld__ will link edit
143: references to the allocator.
144:
145: alloc.d is the temporary file used to contain
146: the strings.
147:
148: .ti 0
149: SEE ALSO --
150: .sp
151: .ti 0
152: DIAGNOSTICS "error in copy" if a disk write error occurs during the execution of the copy instruction.
153: "error in allocator" if any routine is called with a bad header pointer.
154: "Cannot open output file" if file alloc.d cannot be created or opened.
155: "Out of space" if there's no available block of the requested size or no headers available for a new block.
156: .sp
157: .fi
158: .in16
159: .ti 0
160: BUGS --
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.