YEBuiltin Class Reference

#include <YExpression.h>

Inheritance diagram for YEBuiltin:

YCode Rep

List of all members.

Public Member Functions

 YEBuiltin (declaration_t *decl, YBlockPtr parameterblock=0, constTypePtr type=0)
 YEBuiltin (bytecodeistream &str)
 ~YEBuiltin ()
virtual ykind kind () const
declaration_tdecl () 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_tm_decl
constFunctionTypePtr m_type
YBlockPtr m_parameterblock
ycodelist_tm_parameters


Constructor & Destructor Documentation

YEBuiltin::YEBuiltin ( declaration_t decl,
YBlockPtr  parameterblock = 0,
constTypePtr  type = 0 
)

YEBuiltin::YEBuiltin ( bytecodeistream str  ) 

YEBuiltin::~YEBuiltin (  ) 

References m_parameters, and ycodelist::next.


Member Function Documentation

constTypePtr YEBuiltin::attachParameter ( YCodePtr  code,
constTypePtr  type = Type::Unspec 
)

Attach parameter to external function call

Parameters:
code,: parameter code
type,: parameter type
Returns:
NULL if success, != NULL (expected type) if wrong parameter type Type::Unspec if bad code (NULL or isError) Type::Error if excessive parameter

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 
)

void YEBuiltin::closeParameters (  ) 

References m_parameterblock, and y2debug.

constTypePtr YEBuiltin::completeType (  )  const

References m_type.

declaration_t * YEBuiltin::decl (  )  const

References m_decl.

Referenced by attachSymVariable(), and finalize().

YCPValue YEBuiltin::evaluate ( bool  cse = false  )  [virtual]

Execute YCP code to get the resulting YCPValue. Every inherited class of YCode should reimplement this method.

Returns:
YCPValue after executing the code
Parameters:
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.

Returns:
the YCode kind

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.

Parameters:
str byte stream to store into
Returns:
byte stream for chaining writing bytecode (str)

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.

Returns:
ASCII string representation

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.

Parameters:
str string stream to store into
indend indentation level for pretty print
Returns:
string stream for chaining writing XML (str)

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).

Returns:
type of the value to be returned after calling evaluate

Reimplemented from YCode.

References Type::Error, m_decl, m_type, declaration::type, and y2debug.

Referenced by evaluate().


Member Data Documentation

YBlockPtr YEBuiltin::m_parameterblock [private]

constFunctionTypePtr YEBuiltin::m_type [private]


The documentation for this class was generated from the following files:

Generated on a sunny day for yast2-core by doxygen 1.5.9