#ifndef _PYC_CODE_H #define _PYC_CODE_H #include "sequence.h" #include "string.h" class PycCode : public PycObject { public: PycCode(int type = TYPE_CODE) : PycObject(type), m_argCount(0), m_kwOnlyArgCount(0), m_numLocals(0), m_stackSize(0), m_flags(0), m_firstLine(0) { } bool isType(int type) const { return (type == TYPE_CODE) || (type == TYPE_CODE2) || PycObject::isType(type); } void load(class PycData* stream, class PycModule* mod); int argCount() const { return m_argCount; } int kwOnlyArgCount() const { return m_kwOnlyArgCount; } int numLocals() const { return m_numLocals; } int stackSize() const { return m_stackSize; } int flags() const { return m_flags; } PycRef code() const { return m_code; } PycRef consts() const { return m_consts; } PycRef names() const { return m_names; } PycRef varNames() const { return m_varNames; } PycRef freeVars() const { return m_freeVars; } PycRef cellVars() const { return m_cellVars; } PycRef fileName() const { return m_fileName; } PycRef name() const { return m_name; } int firstLine() const { return m_firstLine; } PycRef lnTable() const { return m_lnTable; } PycRef getConst(int idx) const { return m_consts->get(idx); } PycRef getName(int idx) const { return m_names->get(idx).cast(); } PycRef getVarName(int idx) const { return m_varNames->get(idx).cast(); } PycRef getCellVar(int idx) const { return (idx > m_cellVars->size()) ? m_freeVars->get(idx - m_cellVars->size()) : m_cellVars->get(idx); } private: int m_argCount, m_kwOnlyArgCount, m_numLocals, m_stackSize, m_flags; PycRef m_code; PycRef m_consts; PycRef m_names; PycRef m_varNames; PycRef m_freeVars; PycRef m_cellVars; PycRef m_fileName; PycRef m_name; int m_firstLine; PycRef m_lnTable; }; #endif