#include <YExpression.h>
Public Member Functions | |
YEBuiltin (declaration_t *decl, YBlockPtr parameterblock=0, constTypePtr type=0) | |
YEBuiltin (bytecodeistream &str) | |
~YEBuiltin () | |
virtual ykind | kind () const |
declaration_t * | decl () const |
constTypePtr | finalize (Logger *problem_logger) |
void | closeParameters () |
constTypePtr | attachParameter (YCodePtr code, constTypePtr type=Type::Unspec) |
constTypePtr | attachSymVariable (const char *name, constTypePtr type, unsigned int line, TableEntry *&tentry) |
string | toString () const |
YCPValue | evaluate (bool cse=false) |
std::ostream & | toStream (std::ostream &str) const |
std::ostream & | toXml (std::ostream &str, int indent) const |
constTypePtr | type () const |
constTypePtr | completeType () const |
YBlockPtr | parameterBlock () const |
Private Member Functions | |
REP_BODY (YEBuiltin) | |
Private Attributes | |
declaration_t * | m_decl |
constFunctionTypePtr | m_type |
YBlockPtr | m_parameterblock |
ycodelist_t * | m_parameters |
YEBuiltin::YEBuiltin | ( | declaration_t * | decl, | |
YBlockPtr | parameterblock = 0 , |
|||
constTypePtr | type = 0 | |||
) |
YEBuiltin::YEBuiltin | ( | bytecodeistream & | str | ) |
References m_decl, m_parameterblock, m_parameters, m_type, declaration::name, Bytecode::popNamespace(), Bytecode::pushNamespace(), Bytecode::readBool(), Bytecode::readCode(), StaticDeclaration::readDeclaration(), Bytecode::readType(), Bytecode::readYCodelist(), static_declarations, declaration::type, Type::Void, and y2debug.
YEBuiltin::~YEBuiltin | ( | ) |
References m_parameters, and ycodelist::next.
constTypePtr YEBuiltin::attachParameter | ( | YCodePtr | code, | |
constTypePtr | type = Type::Unspec | |||
) |
Attach parameter to external function call
code,: | parameter code | |
type,: | parameter type |
References ycodelist::code, m_parameters, m_type, ycodelist::next, Type::Unspec, and y2debug.
Referenced by attachSymVariable().
constTypePtr YEBuiltin::attachSymVariable | ( | const char * | name, | |
constTypePtr | type, | |||
unsigned int | line, | |||
TableEntry *& | tentry | |||
) |
References Type::Any, attachParameter(), SymbolEntry::c_variable, decl(), ee, Type::Error, ExecutionEnvironment::filename(), StaticDeclaration::findDeclaration(), ExecutionEnvironment::linenumber(), m_decl, m_parameterblock, m_type, declaration::name, static_declarations, Type::Symbol, y2debug, YCode::ycEntry, ycp2warning, and YCode::ycSymbol.
void YEBuiltin::closeParameters | ( | ) |
References m_parameterblock, and y2debug.
constTypePtr YEBuiltin::completeType | ( | ) | const |
References m_type.
declaration_t * YEBuiltin::decl | ( | ) | const |
YCPValue YEBuiltin::evaluate | ( | bool | cse = false |
) | [virtual] |
Execute YCP code to get the resulting YCPValue. Every inherited class of YCode should reimplement this method.
cse | should the evaluation be done for parse time evaluation (i.e. constant subexpression elimination) |
Reimplemented from YCode.
References YCPList::add(), ycodelist::code, StaticDeclaration::Decl2String(), DECL_CALL_HANDLER, DECL_NIL, DECL_NOEVAL, declaration::flags, YCPElement::isNull(), kind(), m_decl, m_parameterblock, m_parameters, declaration::name, declaration::name_space, ycodelist::next, declaration::ptr, toString(), YCode::toString(), declaration::type, type(), y2debug, YCode::ycEntry, and ycp2error.
constTypePtr YEBuiltin::finalize | ( | Logger * | problem_logger | ) |
'close' function, perform final parameter check if ok, return 0 if wrong signature (wrong parameter count, template mismatch) return expected signature if undefined, return Type::Error (wrong type was already reported in attachParameter())
'close' function, perform final parameter check if ok, return 0 if bad signature, return expected signature (i.e. if non-matching template) if undefined, return Type::Error (wrong type was already reported in attachParameter())
References ycodelist::code, decl(), StaticDeclaration::Decl2String(), DECL_FLEX, DECL_FORMATTED, Type::determineFlexType(), Logger::error(), Type::Error, StaticDeclaration::errorNoMatch(), StaticDeclaration::findDeclaration(), declaration::flags, m_decl, m_parameters, m_type, ycodelist::next, static_declarations, declaration::type, Logger::warning(), y2debug, YCode::ycLocale, and YCode::ycString.
virtual ykind YEBuiltin::kind | ( | ) | const [inline, virtual] |
Kind of this YCode. This method must be reimplemented in the inherited classes.
Implements YCode.
References YCode::yeBuiltin.
Referenced by evaluate().
YBlockPtr YEBuiltin::parameterBlock | ( | ) | const |
References m_parameterblock.
YEBuiltin::REP_BODY | ( | YEBuiltin | ) | [private] |
std::ostream & YEBuiltin::toStream | ( | std::ostream & | str | ) | const [virtual] |
Write YCP code to a byte stream (bytecode implementation). Every class inheriting from YCode must reimplement this method.
str | byte stream to store into |
Implements YCode.
References m_decl, m_parameterblock, m_parameters, m_type, Bytecode::popNamespace(), Bytecode::pushNamespace(), static_declarations, Bytecode::writeBool(), StaticDeclaration::writeDeclaration(), Bytecode::writeType(), and Bytecode::writeYCodelist().
string YEBuiltin::toString | ( | void | ) | const [virtual] |
Return ASCII represtation of this YCP code.
Reimplemented from YCode.
References ycodelist::code, StaticDeclaration::Decl2String(), m_decl, m_parameters, and ycodelist::next.
Referenced by evaluate().
std::ostream & YEBuiltin::toXml | ( | std::ostream & | str, | |
int | indent | |||
) | const [virtual] |
Write YCP code as XML representation. Every class inheriting from YCode must reimplement this method.
str | string stream to store into | |
indend | indentation level for pretty print |
Implements YCode.
References ycodelist::code, DECL_SYMBOL, declaration::flags, m_decl, m_parameterblock, m_parameters, declaration::name, ycodelist::next, Xmlcode::popNamespace(), Xmlcode::pushNamespace(), Xmlcode::writeYCodelist(), Xmlcode::xmlify(), and YCode::ycEntry.
constTypePtr YEBuiltin::type | ( | ) | const [virtual] |
Return type of this YCP code (interesting mostly for function calls).
Reimplemented from YCode.
References Type::Error, m_decl, m_type, declaration::type, and y2debug.
Referenced by evaluate().
declaration_t* YEBuiltin::m_decl [private] |
Referenced by attachSymVariable(), decl(), evaluate(), finalize(), toStream(), toString(), toXml(), type(), and YEBuiltin().
YBlockPtr YEBuiltin::m_parameterblock [private] |
Referenced by attachSymVariable(), closeParameters(), evaluate(), parameterBlock(), toStream(), toXml(), and YEBuiltin().
ycodelist_t* YEBuiltin::m_parameters [private] |
Referenced by attachParameter(), evaluate(), finalize(), toStream(), toString(), toXml(), YEBuiltin(), and ~YEBuiltin().
constFunctionTypePtr YEBuiltin::m_type [private] |
Referenced by attachParameter(), attachSymVariable(), completeType(), finalize(), toStream(), type(), and YEBuiltin().