Exemplo n.º 1
0
Type *TypeReader::declareType(Module *module, json_t *json)
{
    Type *type = lmNew(NULL) Type;

    const char *stype = json_string_value(json_object_get(json, "type"));

    if (!strcmp(stype, "CLASS"))
    {
        type->attr.isClass = true;
    }
    else if (!strcmp(stype, "INTERFACE"))
    {
        type->attr.isInterface = true;
    }
    else if (!strcmp(stype, "STRUCT"))
    {
        type->attr.isStruct = true;
    }
    else if (!strcmp(stype, "DELEGATE"))
    {
        type->attr.isDelegate = true;
    }
    else if (!strcmp(stype, "ENUM"))
    {
        type->attr.isEnum = true;
    }
    else
    {
        assert(0); //, "Unknown type: %s", stype);
    }
    declareClass(type, json);

    return type;
}
/// Constructor. Declare algorithm properties.
AddFunctionValuesToTable::AddFunctionValuesToTable()
{
    declareClass( "Function", &FunctionFactory::instance(), Kernel::Property::Input );
    declareWorkspace("Workspace");
    declareString("XColumn");
    declareString("YColumn");
    declareString("Role","Y");
}
Exemplo n.º 3
0
/// Constructor. Declare algorithm properties.
Schrodinger1D::Schrodinger1D()
{
  declareDouble("Beta");
  declareClass("VPot",&FunctionFactory::instance());
  declareDouble("StartX");
  declareDouble("EndX");
  declareWorkspace("Eigenvalues");
  declareWorkspace("Eigenvectors");
  //declareWorkspace("Quadrature");
}
Exemplo n.º 4
0
/// Constructor. Declare algorithm properties.
MakeQuadrature::MakeQuadrature()
{
  declareWorkspace("Quadrature", Kernel::Property::Output);
  // Possible type values:
  // Custom 
  // Laguerre
  // Jacobi (includes Legendre)
  // Hermite
  declareString("Type","Custom");
  declareInt("N",10);
  declareBool("Normalize",true);
  declareDouble("StartX",-1.0);
  declareDouble("EndX",1.0);
  declareClass("Weight",&FunctionFactory::instance());
  //declareClass("XFun",&FunctionFactory::instance());
  declareWorkspace("ChebWorkspace", Kernel::Property::Output);
}
Exemplo n.º 5
0
void ScriptManager::registerDefaultBindings() {
	declareClass("ScriptManager");

	beginRegister();

	registerFunction("getLua", &ScriptManager::luaGetLua);

	beginRegisterClass("ScriptManager");
	registerFunction("PlayFile", &ScriptManager::luaPlayFile);
	registerFunction("SetGCInterval", &ScriptManager::luaSetGCInterval);
	registerFunction("RegisterSubst", &ScriptManager::luaRegisterSubst);
	registerFunction("UnregisterSubst", &ScriptManager::luaUnregisterSubst);
	registerFunction("RegisterHandler", &ScriptManager::luaRegisterHandler);
	endRegisterClass();

	endRegister();
}
Exemplo n.º 6
0
void LSLuaState::declareLuaTypes(const utArray<Type *>& types)
{
    for (UTsize i = 0; i < types.size(); i++)
    {
        declareClass(types[i]);
    }

    // validate/initialize native types
    for (UTsize i = 0; i < types.size(); i++)
    {
        Type *type = types.at(i);

        if (type->isNative() || type->hasStaticNativeMember())
        {
            NativeTypeBase *ntb = NativeInterface::getNativeType(type);

            if (!ntb)
            {
                LSError("Unable to get NativeTypeBase for type %s", type->getFullName().c_str());
            }

            if (type->isNativeManaged() != ntb->isManaged())
            {
                if (type->isNativeManaged())
                {
                    LSError("Managed mismatch for type %s, script declaration specifies native while native bindings are unmanaged", type->getFullName().c_str());
                }
                else
                {
                    LSError("Managed mismatch for type %s, script declaration specifies unmanaged while native bindings are managed", type->getFullName().c_str());
                }
            }

            ntb->validate(type);
            type->setCTypeName(ntb->getCTypeName());
        }
    }
}
Exemplo n.º 7
0
  void Compiler::declareTopLevel(gc<Expr> expr, Module* module)
  {
    DefExpr* def = expr->asDefExpr();
    if (def != NULL)
    {
      declareMultimethod(SignatureBuilder::build(*def));
      return;
    }

    DefClassExpr* defClass = expr->asDefClassExpr();
    if (defClass != NULL)
    {
      declareClass(*defClass, module);
      return;
    }

    VariableExpr* var = expr->asVariableExpr();
    if (var != NULL)
    {
      declareVariables(var->pattern(), module);
      return;
    }
  }