Example #1
0
void
ImageModule::load()
{
    USING_MU_FUNCTION_SYMBOLS

    MuLangContext* c = (MuLangContext*)globalModule()->context();

    addSymbols( new ImageType(c),  
                new PixelsType(c),

                new Function(c, "resize", resize, None,
                             Return, "image.image",
                             Parameters,
                             new Param(c, "img", "image.image"),
                             new Param(c, "newWidth", "int"),
                             new Param(c, "newHeight", "int"),
                             End),

		EndArguments );

}
Example #2
0
Module fixModule(str nme) {
	Module m;
	m = getModule(nme);
	if (m) return m;
	return globalModule(nme);
}
Example #3
0
void
StreamType::load()
{
    USING_MU_FUNCTION_SYMBOLS;

    Symbol *s = scope();
    MuLangContext* context = (MuLangContext*)globalModule()->context();
    Context* c = context;

    String tname = fullyQualifiedName();
    String rname = tname + "&";

    const char* tn = tname.c_str();
    const char* rn = rname.c_str();
		  
    s->addSymbols( new ReferenceType(c, "stream&", this), 

		   new Function(c, "stream", BaseFunctions::dereference, Cast,
				Return, tn,
				Args, rn, End),

		   EndArguments);

    globalScope()->addSymbols(

		   new Function(c, "print", StreamType::print, None,
				Return, "void", 
				Args, tn, End),

		   new Function(c, "=", BaseFunctions::assign, AsOp,
				Return, rn, 
				Args, rn, tn, End),

                   new Function(c, "!", StreamType::eval, None,
                                Return, "bool",
                                Args, tn, End),

                   new Function(c, "bool", StreamType::toBool, None,
                                Return, "bool",
                                Args, tn, End),

                   EndArguments);

    addSymbols( 

               new SymbolicConstant(c, "GoodBit", "int", Value(int(ios::goodbit))),
                new SymbolicConstant(c, "BadBit", "int", Value(int(ios::badbit))),
                new SymbolicConstant(c, "FailBit", "int", Value(int(ios::failbit))),
                new SymbolicConstant(c, "EofBit", "int", Value(int(ios::eofbit))),

                new SymbolicConstant(c, "Beginning", "int", Value(int(ios::beg))),
                new SymbolicConstant(c, "Current", "int", Value(int(ios::cur))),
                new SymbolicConstant(c, "End", "int", Value(int(ios::end))),

                new SymbolicConstant(c, "Append", "int", Value(int(ios::app))),
                new SymbolicConstant(c, "AtEnd", "int", Value(int(ios::ate))),
                new SymbolicConstant(c, "Binary", "int", Value(int(ios::binary))),
                new SymbolicConstant(c, "In", "int", Value(int(ios::in))),
                new SymbolicConstant(c, "Out", "int", Value(int(ios::out))),
                new SymbolicConstant(c, "Truncate", "int", Value(int(ios::trunc))),

                new Function(c, "bad", StreamType::bad, None,
                             Return, "bool",
                             Args, tn, End),

                new Function(c, "eof", StreamType::eof, None,
                             Return, "bool",
                             Args, tn, End),

                new Function(c, "fail", StreamType::fail, None,
                             Return, "bool",
                             Args, tn, End),

                new Function(c, "good", StreamType::good, None,
                             Return, "bool",
                             Args, tn, End),

                new Function(c, "clear", StreamType::clear, None,
                             Return, "void",
                             Args, tn, End),

                new Function(c, "clear", StreamType::clear, None,
                             Return, "void",
                             Args, tn, "int", End),

                new Function(c, "rdstate", StreamType::rdstate, None,
                             Return, "int",
                             Args, tn, End),

                new Function(c, "setstate", StreamType::setstate, None,
                             Return, "void",
                             Args, tn, "int", End),

		EndArguments );

}