JILError JCLGenerateBindings(JILState* pVM, const JILChar* pPath) { JILError err = JCL_No_Error; JILLong clas; JCLState* _this; JCLClass* pClass; if( (_this = pVM->vmpCompiler) == NULL ) return JIL_ERR_No_Compiler; JCLVerbosePrint(_this, "Generating C++ binding code...\n"); // iterate over all classes for( clas = 0; clas < NumClasses(_this); clas++ ) { pClass = GetClass(_this, clas); if( pClass->miFamily == tf_class && (pClass->miModifier & kModeNativeBinding) ) { err = JCLCreateBindingCode(_this, pClass, pPath); if (err) goto exit; } } exit: FlushErrorsAndWarnings(_this); return err; }
int FeaturesTable::RemoveSampleWithID(std::vector<size_t>& ids) { if(removed) { return -1; } double* removeDist = new double[NumClasses()]; GetClassDistribution(removeDist,NULL,ids); for(size_t k=0;k<ValidClassDistribution.size();++k) { ValidClassDistribution[k] -= size_t(removeDist[k]); } double cumsum = 0; for(size_t k=0;k<ValidCumSamplesPerClass.size();++k) { ValidCumSamplesPerClass[k] -= size_t(cumsum); cumsum += removeDist[k]; } delete [] removeDist; for(std::vector<size_t>::iterator v=ids.begin(),v_e=ids.end();v!=v_e;++v) { ValidDataIDXToLine.erase(ValidDataIDXToLine[*v]); } size_t cnt = 0; std::map<size_t,size_t> NewIDXMap; for(std::map<size_t,size_t>::iterator v=ValidDataIDXToLine.begin(),v_e=ValidDataIDXToLine.end();v!=v_e;++v) { NewIDXMap.insert(std::make_pair<size_t,size_t>(cnt++,v->second)); } ValidDataIDXToLine.clear(); ValidDataIDXToLine = NewIDXMap; removed = true; return 0; }
JILError JCLExportTypeInfo(JILState* pVM, const JILChar* pFilename) { JILError err = JCL_No_Error; #if !JIL_NO_FPRINTF && JIL_USE_LOCAL_FILESYS JILLong clas; JCLState* _this; JCLClass* pClass; JCLString* workstr = NULL; FILE* pFile = NULL; if( (_this = pVM->vmpCompiler) == NULL ) return JIL_ERR_No_Compiler; JCLVerbosePrint(_this, "Exporting type definitions to XML...\n"); workstr = NEW(JCLString); // iterate over all classes for( clas = 0; clas < NumClasses(_this); clas++ ) { pClass = GetClass(_this, clas); if( pClass->miFamily == tf_class || pClass->miFamily == tf_interface || pClass->miFamily == tf_thread || pClass->miFamily == tf_delegate ) { pClass->ToXml(pClass, _this, workstr); } } // write file pFile = fopen(pFilename, "wt"); if( pFile ) { fprintf(pFile, "<xml>\n"); fputs(JCLGetString(workstr), pFile); fprintf(pFile, "</xml>\n"); fclose(pFile); } FlushErrorsAndWarnings(_this); DELETE(workstr); #endif return err; }
JILError JCLGenerateDocs(JILState* pVM, const JILChar* pPath, const JILChar* pParams) { #if JIL_USE_HTML_CODEGEN && !JIL_NO_FPRINTF && JIL_USE_LOCAL_FILESYS JILError err = JCL_No_Error; JILLong clas; JILLong startClass; JILLong endClass; JCLState* _this; JCLClass* pClass; JILTable* pTable = NULL; if( (_this = pVM->vmpCompiler) == NULL ) return JIL_ERR_No_Compiler; JCLVerbosePrint(_this, "Generating HTML documentation for "); switch (pVM->vmDocGenMode) { case JIL_GenDocs_User: startClass = kNumPredefTypes; endClass = NumClasses(_this); JCLVerbosePrint(_this, "user classes...\n"); break; case JIL_GenDocs_BuiltIn: startClass = type_global; endClass = kNumPredefTypes; JCLVerbosePrint(_this, "built-in classes...\n"); break; case JIL_GenDocs_All: startClass = type_global; endClass = NumClasses(_this); JCLVerbosePrint(_this, "all classes...\n"); break; } pTable = JILTable_NewNativeManaged(pVM, JCLStringDestructor); // analyze classes for( clas = startClass; clas < endClass; clas++ ) { pClass = GetClass(_this, clas); err = JCLAnalyzeClass(_this, pClass, pTable); if (err) goto exit; } // analyze optional parameters err = JCLAnalyzeParameters(_this, pParams, pTable); if (err) goto exit; // document all classes for( clas = startClass; clas < endClass; clas++ ) { pClass = GetClass(_this, clas); err = JCLCreateClassDoc(_this, pClass, pTable, pPath); if (err) goto exit; } // create class index file err = JCLCreateClassIndex(_this, pTable, pPath, startClass, endClass); if (err) goto exit; exit: JILTable_Delete(pTable); FlushErrorsAndWarnings(_this); return err; #else return JCL_ERR_Feature_Not_Available; #endif }