Debian Codegraph @

pypy/module/struct/moduledef.py

raw symbols SCIP
1
2 """
3 Mixed-module definition for the struct module.
4 Note that there is also a pure Python implementation in pypy/lib/struct.py;
5 the present mixed-module version of struct takes precedence if it is enabled.
6 """
7
8 from pypy.interpreter.mixedmodule import MixedModule
9
10
11 class Module(MixedModule):
12 """\
13 Functions to convert between Python values and C structs.
14 Python strings are used to hold the data representing the C struct
15 and also as format strings to describe the layout of data in the C struct.
16
17 The optional first format char indicates byte order, size and alignment:
18 @: native order, size & alignment (default)
19 =: native order, std. size & alignment
20 <: little-endian, std. size & alignment
21 >: big-endian, std. size & alignment
22 !: same as >
23
24 The remaining chars indicate types of args and must match exactly;
25 these can be preceded by a decimal repeat count:
26 x: pad byte (no data);
27 c:char;
28 b:signed byte;
29 B:unsigned byte;
30 h:short;
31 H:unsigned short;
32 i:int;
33 I:unsigned int;
34 l:long;
35 L:unsigned long;
36 q:long long;
37 Q:unsigned long long
38 f:float;
39 d:double.
40 Special cases (preceding decimal count indicates length):
41 s:string (array of char); p: pascal string (with count byte).
42 Special case (only available in native format):
43 P:an integer type that is wide enough to hold a pointer.
44 Whitespace between formats is ignored.
45
46 The variable struct.error is an exception raised on errors."""
47
48 applevel_name = "_struct"
49
50 interpleveldefs = {
51 'error': 'interp_struct.get_error(space)',
52
53 'calcsize': 'interp_struct.calcsize',
54 'pack': 'interp_struct.pack',
55 'pack_into': 'interp_struct.pack_into',
56 'unpack': 'interp_struct.unpack',
57 'unpack_from': 'interp_struct.unpack_from',
58 'iter_unpack': 'interp_struct.iter_unpack',
59
60 'Struct': 'interp_struct.W_Struct',
61 '_clearcache': 'interp_struct.clearcache',
62 }
63
64 appleveldefs = {
65 }