示例#1
0
文件: wrappy.cpp 项目: islenv/wrappy
PythonObject callWithArgs(
    const std::string& name,
    const std::vector<PythonObject>& args,
    const std::vector<std::pair<std::string, PythonObject>>& kwargs)
{
    size_t cutoff;
    PythonObject module = loadModule(name, cutoff);
    PythonObject function;

    if (module) {
        function = loadFunction(module, name.substr(cutoff));
    } else {
        // No proper prefix was a valid module, but maybe it's a built-in
        function = loadBuiltin(name);
    }

    if (!function) {
        std::string error_message;
        if(cutoff != std::string::npos) {
            error_message = "Wrappy: Lookup of function " +
                name.substr(cutoff) + " in module " +
                name.substr(0,cutoff) + " failed.";
        } else {
            error_message = "Wrappy: Lookup of function " + name + "failed.";
        }

        throw WrappyError(error_message);
    }

    return callFunctionWithArgs(function, args, kwargs);
}
示例#2
0
/*
 * Initialize the ES.  Read builtin data into ES.
 */
esinit()
{
	FILE	*f;
	int ret;
#ifndef OLMSG
	static char	esiErr[] =	"Error reading /config/abbuiltin";
#endif

	printt0("esinit()\n");

	allocES();			/* alloc segment and set ES */

	if ((f = fopen(ESBUILTIN, "r")) == NULL || loadBuiltin(f)
					|| loadStrings(f) || loadErrors(f))
		error(ER(57,esiErr));
	fclose(f);
	printt0( "es init finished\n" );

}
示例#3
0
AP_BindingSet::AP_BindingSet(EV_EditMethodContainer * pemc)
	: XAP_BindingSet(pemc)
{
  loadBuiltin();
  UT_DEBUGMSG(("Created binding set %p \n",this));
}