Example #1
0
bool NCompiler_JAVA::CompileFile(const char *input, const char *output, char *err_code)
{
    char cmd[1024];
    sprintf(cmd, compiler_format.c_str(), input, ERR_FILENAME);

    /** 建议用于编译的批处理文件 */
    if(MakeBat(cmd))
    {
        /** 通用编译 */
        if(!_CompileFile(err_code))
        {
            /** 若是系统错误 */
            return false;
        }
        else
        {
            /** 分析错误 */
            if(FileExists(output))
            {
                return true;
            }
            else
            {
                if(1 == strlen(err_code)) strcpy(err_code, "Unknown error.");
                return false;
            }            
        }
    }
    else return false;
}
Example #2
0
UpStatus UpExecuteFile(const char* sourcePath, const char* moduleName,
                       char writeToDisk, UpObject** outModule) {
    UpFunctionDef* def;
    UpClassDef* classDef;
    if (!_CompileFile(sourcePath, moduleName, writeToDisk, &def, &classDef)) {
        return UpFailure;
    }

    return _RunModule(def, outModule);
}
Example #3
0
UpStatus UpCompileModule(const char* moduleName, UpFunctionDef** outDef,
                         UpClassDef** outClassDef) {
    const char* modulePath = UpFindModulePath(moduleName);
    if (!modulePath) {
        UpSetError("Module '%s' not found", moduleName);
        return UpFailure;
    }

    if (_CompileFile(modulePath, moduleName, true, outDef, outClassDef)) {
        return UpSuccess;
    } else {
        return UpFailure;
    }
}
Example #4
0
UpStatus UpCompileFile(const char* sourcePath, const char* moduleName,
                       char writeToDisk, UpFunctionDef** outDef, UpClassDef** outClassDef) {
    return _CompileFile(sourcePath, moduleName, writeToDisk, outDef, outClassDef);
}