forked from zrax/pycdc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyc_code.cpp
53 lines (41 loc) · 1.75 KB
/
pyc_code.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "pyc_code.h"
#include "pyc_module.h"
#include "data.h"
void PycCode::load(PycData* stream, PycModule* mod)
{
if (mod->verCompare(1, 3) >= 0 && mod->verCompare(2, 3) < 0)
m_argCount = stream->get16();
else if (mod->verCompare(2, 3) >= 0)
m_argCount = stream->get32();
if (mod->majorVer() >= 3)
m_kwOnlyArgCount = stream->get32();
if (mod->verCompare(1, 3) >= 0 && mod->verCompare(2, 3) < 0)
m_numLocals = stream->get16();
else if (mod->verCompare(2, 3) >= 0)
m_numLocals = stream->get32();
if (mod->verCompare(1, 5) >= 0 && mod->verCompare(2, 3) < 0)
m_stackSize = stream->get16();
else if (mod->verCompare(2, 3) >= 0)
m_stackSize = stream->get32();
if (mod->verCompare(1, 3) >= 0 && mod->verCompare(2, 3) < 0)
m_flags = stream->get16();
else if (mod->verCompare(2, 3) >= 0)
m_flags = stream->get32();
m_code = LoadObject(stream, mod).cast<PycString>();
m_consts = LoadObject(stream, mod).cast<PycTuple>();
m_names = LoadObject(stream, mod).cast<PycTuple>();
if (mod->verCompare(1, 3) >= 0)
m_varNames = LoadObject(stream, mod).cast<PycTuple>();
if (mod->verCompare(2, 1) >= 0)
m_freeVars = LoadObject(stream, mod).cast<PycTuple>();
if (mod->verCompare(2, 1) >= 0)
m_cellVars = LoadObject(stream, mod).cast<PycTuple>();
m_fileName = LoadObject(stream, mod).cast<PycString>();
m_name = LoadObject(stream, mod).cast<PycString>();
if (mod->verCompare(1, 5) >= 0 && mod->verCompare(2, 3) < 0)
m_firstLine = stream->get16();
else if (mod->verCompare(2, 3) >= 0)
m_firstLine = stream->get32();
if (mod->verCompare(1, 5) >= 0)
m_lnTable = LoadObject(stream, mod).cast<PycString>();
}