bool DefFile::Write() { stream = new std::fstream(fileName.c_str(), std::ios::out); //if (stream != NULL) { WriteName(); WriteLibrary(); WriteExports(); WriteImports(); WriteDescription(); WriteStacksize(); WriteHeapsize(); WriteCode(); WriteData(); WriteSections(); delete stream; } return true; }
void DotsWriter::MakeImportFile(const Defs::ns_list & list) { boost::filesystem::path path = m_fileDirectory; path/=".."; boost::filesystem::path txtPath = path; txtPath/=Defs::TXT_DEPEND_FILE; boost::filesystem::path cppPath = path; cppPath/=Defs::CPP_DEPEND_FILE; FILE* cppStream = fopen(cppPath.string().c_str(), "w"); FILE* txtStream = fopen(txtPath.string().c_str(), "r"); if (txtStream == NULL) { std::wcout << "Failed to open file: " << path.string().c_str() << std::endl; return; } const char * const loadDll = "@LoadDll"; const int buff_size = 128; char line[128]; // find @ while( fgets( line, buff_size, txtStream ) != NULL) { if (strncmp(loadDll, line, strlen(loadDll)) == 0) { WriteImports(cppStream, list, " LoadDll(\"dots_generated-", "-cpp\");\n"); } else { fwrite(line, sizeof( char ), strlen(line), cppStream); } } fclose(txtStream); fclose(cppStream); }