@@ -84,8 +84,6 @@ def _arg(nbytes, signed, dvi, _):
84
84
85
85
def _arg_slen (dvi , delta ):
86
86
"""
87
- Signed, length *delta*
88
-
89
87
Read *delta* bytes, returning None if *delta* is zero, and the bytes
90
88
interpreted as a signed integer otherwise.
91
89
"""
@@ -96,26 +94,20 @@ def _arg_slen(dvi, delta):
96
94
97
95
def _arg_slen1 (dvi , delta ):
98
96
"""
99
- Signed, length *delta*+1
100
-
101
97
Read *delta*+1 bytes, returning the bytes interpreted as signed.
102
98
"""
103
- return dvi ._arg (delta + 1 , True )
99
+ return dvi ._arg (delta + 1 , True )
104
100
105
101
106
102
def _arg_ulen1 (dvi , delta ):
107
103
"""
108
- Unsigned length *delta*+1
109
-
110
104
Read *delta*+1 bytes, returning the bytes interpreted as unsigned.
111
105
"""
112
- return dvi ._arg (delta + 1 , False )
106
+ return dvi ._arg (delta + 1 , False )
113
107
114
108
115
109
def _arg_olen1 (dvi , delta ):
116
110
"""
117
- Optionally signed, length *delta*+1
118
-
119
111
Read *delta*+1 bytes, returning the bytes interpreted as
120
112
unsigned integer for 0<=*delta*<3 and signed if *delta*==3.
121
113
"""
@@ -139,30 +131,30 @@ def _dispatch(table, min, max=None, state=None, args=('raw',)):
139
131
matches *state* if not None, reads arguments from the file according
140
132
to *args*.
141
133
142
- *table*
143
- the dispatch table to be filled in
144
-
145
- *min*
146
- minimum opcode for calling this function
147
-
148
- *max*
149
- maximum opcode for calling this function, None if only *min* is allowed
150
-
151
- * state*
152
- state of the Dvi object in which these opcodes are allowed
153
-
154
- * args*
155
- sequence of argument specifications:
156
-
157
- `` 'raw'`` : opcode minus minimum
158
- `` 'u1'`` : read one unsigned byte
159
- `` 'u4'`` : read four bytes, treat as an unsigned number
160
- `` 's4'`` : read four bytes, treat as a signed number
161
- `` 'slen'`` : read (opcode - minimum) bytes, treat as signed
162
- `` 'slen1'`` : read (opcode - minimum + 1) bytes, treat as signed
163
- `` 'ulen1'`` : read (opcode - minimum + 1) bytes, treat as unsigned
164
- `` 'olen1'`` : read (opcode - minimum + 1) bytes, treat as unsigned
165
- if under four bytes, signed if four bytes
134
+ Parameters
135
+ ----------
136
+ table : dict[int, callable]
137
+ The dispatch table to be filled in.
138
+
139
+ min, max : int
140
+ Range of opcodes that calls the registered function; *max* defaults to
141
+ *min*.
142
+
143
+ state : _dvistate, optional
144
+ State of the Dvi object in which these opcodes are allowed.
145
+
146
+ args : list[str], default: ['raw']
147
+ Sequence of argument specifications:
148
+
149
+ - 'raw': opcode minus minimum
150
+ - 'u1': read one unsigned byte
151
+ - 'u4': read four bytes, treat as an unsigned number
152
+ - 's4': read four bytes, treat as a signed number
153
+ - 'slen': read (opcode - minimum) bytes, treat as signed
154
+ - 'slen1': read (opcode - minimum + 1) bytes, treat as signed
155
+ - 'ulen1': read (opcode - minimum + 1) bytes, treat as unsigned
156
+ - 'olen1': read (opcode - minimum + 1) bytes, treat as unsigned
157
+ if under four bytes, signed if four bytes
166
158
"""
167
159
def decorate (method ):
168
160
get_args = [_arg_mapping [x ] for x in args ]
@@ -185,6 +177,7 @@ def wrapper(self, byte):
185
177
class Dvi :
186
178
"""
187
179
A reader for a dvi ("device-independent") file, as produced by TeX.
180
+
188
181
The current implementation can only iterate through pages in order,
189
182
and does not even attempt to verify the postamble.
190
183
@@ -956,8 +949,9 @@ def _parse_and_cache_line(self, line):
956
949
957
950
def _parse_enc (path ):
958
951
r"""
959
- Parses a \*.enc file referenced from a psfonts.map style file.
960
- The format this class understands is a very limited subset of PostScript.
952
+ Parse a \*.enc file referenced from a psfonts.map style file.
953
+
954
+ The format supported by this function is a tiny subset of PostScript.
961
955
962
956
Parameters
963
957
----------
0 commit comments