📄 one2all.cpp
字号:
{ "/Zi" , " @Z", 0 }, { "/Z7" , " @Z", 0 }, { "/O[0-9A-Za-z]*", " @O", 0 }, { "/D +\"{0,1}DEBUG=*[0-9]*\"{0,1}", " @D", 0 } }; re.SetRange("^# ADD .*CPP "); for (size_t i = 0; i < sizeof(ksOpt)/sizeof(ksOpt[0]); i++) { re.ReplaceRange(string(" +") + ksOpt[i].from, ksOpt[i].to, kDF, kDF, CRegexpUtil::eInside, (int)ksOpt[i].count); } // Configuration-dependent changes: replace hooks and more compiler // options where appropriate. const SReplacement ksOptDebug[] = { { "@c" , " /GZ /c" , 0 }, { "@O" , " /Od" , 1 }, { "@Z" , " /Z7" , 1 }, { "@D" , " /D \"DEBUG=1\"" , 1 }, { "(/W[^ ]*)", " $1 /Gm" , 1 }, { "@O" , "" , 0 }, { "@Z" , "" , 0 }, { "@D" , "" , 0 } }; const SReplacement ksOptRelease[] = { { "@c" , " /c" , 0 }, { "@O" , " /O2" , 1 }, { "@O" , "" , 0 }, { "@Z" , "" , 0 }, { "@D" , "" , 0 } }; const SReplacement* subst; size_t subst_size; if (config == eDebug) { re.SetRange("^# PROP "); re.ReplaceRange(" *Use_Debug_Libraries *0"," Use_Debug_Libraries 1"); re.SetRange("^# ADD .*LINK32 "); re.ReplaceRange(" */pdb:[^ ]*", kEmptyStr); re.ReplaceRange("/mach", "/pdb:none /debug /mach"); subst = &ksOptDebug[0]; subst_size = sizeof(ksOptDebug)/sizeof(subst[0]); } else { re.SetRange("^# PROP "); re.ReplaceRange(" *Use_Debug_Libraries *1"," Use_Debug_Libraries 0"); re.SetRange("^# ADD .*LINK32 "); re.ReplaceRange(" */pdbtype[^ ]*", kEmptyStr); subst = &ksOptRelease[0]; subst_size = sizeof(ksOptRelease)/sizeof(subst[0]); } re.SetRange("^# ADD .*CPP "); for (int i = 0; i < subst_size; i++) { re.ReplaceRange(string(" +") + subst[i].from, subst[i].to, kDF, kDF, CRegexpUtil::eInside, subst[i].count); } re.Replace("^(# ADD .*LINK32.*) */debug(.*)", "$1$2", kML); // Now replace the code generation switch. re.SetRange("^# ADD .*CPP "); ITERATE_SUFFIX(i) { re.ReplaceRange(string(" +") + kSuffixLib[i] + "[d]{0,1}", " @C"); } string lib_switch = kSuffixLib[suffix]; if (config == eDebug) { lib_switch += "d"; } string ksLib[][2] = { { "@C" , lib_switch }, { "/nologo" , "/nologo " + lib_switch }, { " CPP" , " CPP" + lib_switch } }; re.SetRange("^# ADD +CPP "); for (size_t i = 0; i < sizeof(ksLib)/sizeof(ksLib[0]); i++) { if ( re.ReplaceRange(ksLib[i][0], ksLib[i][1], kDF, kDF, CRegexpUtil::eInside, 1) ) { break; } } re.SetRange("^# ADD +BASE +CPP "); for (size_t i = 0; i < sizeof(ksLib)/sizeof(ksLib[0]); i++) { if ( re.ReplaceRange(ksLib[i][0], ksLib[i][1], kDF, kDF, CRegexpUtil::eInside, 1) ) { break; } } re.Replace("^(# ADD .*CPP +.*) *@C(.*)", "$1$2", kML); re.Replace("^(# ADD .*LINK32 +.*) */incremental:(yes|no)(.*)", "$1$3",kML); // Make sure that incremental linking is on // except for wxWindows DLLs in the release mode (very slow). string incr_link; if ( !re.Exists("^# ADD .*LINK32 .*/dll", kML) ) { incr_link = (config == eDebug) ? "yes" : "no"; } else if ( !gui.empty() && config == eRelease && wxdll_making ) { incr_link = "no"; } if ( !incr_link.empty() ) { re.Replace("^(# ADD .*LINK32 .*/nologo)(.*)", string("$1 /incremental:") + incr_link + "$2", kML); } // When requested, remove include/library paths, which refer to DIZZY. if ( m_IsDistribution ) { re.SetRange("^# ADD .*(CPP|RSC) "); re.ReplaceRange(" +/[Ii] +[\"]{0,1}\\\\\\\\[Dd][Ii][Zz][Zz][Yy]\\\\[^ ]*", kEmptyStr); re.SetRange("^# ADD .*LINK32 "); re.ReplaceRange(" +/libpath:[\"]{0,1}\\\\\\\\[Dd][Ii][Zz][Zz][Yy]\\\\[^ ]*", kEmptyStr); } // wxWindows-specific changes from now on. if ( gui == "wxwin" ) { // # Define __WXDEBUG__ for debug configs. string wxdebug; if ( config == eDebug ) { wxdebug = "/D \"__WXDEBUG__=1\""; } // wxWindows defines is to be added to compiler options. if ( !wxdebug.empty() || !wxdll.empty() ) { string wx = NStr::TruncateSpaces(wxdebug + " " + wxdll); string ksWx[][2] = { { "/Y" , wx + " /Y" }, { "/D" , wx + " /D" }, { "/c" , wx + " /Y" }, { " *$", "$0 "+ wx } }; // Insert it once in each line re.SetRange("^# ADD +CPP "); for (size_t i = 0; i < sizeof(ksWx)/sizeof(ksWx[0]); i++) { if ( re.ReplaceRange(ksWx[i][0], ksWx[i][1], kDF, kDF, CRegexpUtil::eInside, 1) ) { break; } } re.SetRange("^# ADD +BASE +CPP "); for (size_t i = 0; i < sizeof(ksWx)/sizeof(ksWx[0]); i++) { if ( re.ReplaceRange(ksWx[i][0], ksWx[i][1], kDF, kDF, CRegexpUtil::eInside, 1) ) { break; } } } // Enforce /subsystem:windows. re.SetRange("^# ADD .*LINK32 "); re.ReplaceRange("/subsystem:[A-Za-z]*", "@s"); string ksWxss[][2] = { { "@s" , "" }, { "/nologo", "/nologo " }, { " *$" , "$0 " } }; re.SetRange("^# ADD +LINK32 "); for (size_t i = 0; i < sizeof(ksWxss)/sizeof(ksWxss[0]); i++) { if ( re.ReplaceRange(ksWxss[i][0], ksWxss[i][1] + "/subsystem:windows", kDF, kDF, CRegexpUtil::eInside, 1) ) { break; } } re.SetRange("^# ADD .*LINK32 "); re.ReplaceRange(" *@s", kEmptyStr); // Take care of libraries: remove all wxWindows ones. string ksWxLib[][2] = { { "jpegd{0,1}[.]lib" , "" }, { "pngd{0,1}[.]lib" , "" }, { "tiffd{0,1}[.]lib" , "" }, { "zpmd{0,1}[.]lib" , "" }, { "zlibd{0,1}[.]lib" , "" }, { "wx[dl]{0,1}[.]lib", " @wx" } }; re.SetRange("^# ADD .*LINK32 .*wx[dl]{0,1}[.]lib"); for (size_t i = 0; i < sizeof(ksWxLib)/sizeof(ksWxLib[0]); i++) { re.ReplaceRange(" *" + ksWxLib[i][0], ksWxLib[i][1]); } // Insert them back but with correct names (which we use). // Note that in DLL mode only one (import) library has to be included. // The note above was true formely; now images libs are all static. re.SetRange("^# ADD .*LINK32 .*@wx "); re.ReplaceRange("@wx", "jpeg.lib png.lib tiff.lib zlib.lib wx.lib", kDF, kDF, CRegexpUtil::eInside, 1); re.ReplaceRange("@wx", kEmptyStr); } // FLTK specific changes from now on if ( gui == "fltk" ) { // Enforce /subsystem:windows. re.SetRange("^# ADD .*LINK32 "); re.ReplaceRange("/subsystem:[A-Za-z]*", "@s"); string ksWxss[][2] = { { "@s" , "" }, { "/nologo", "/nologo " }, { " *$" , "$0 " } }; re.SetRange("^# ADD LINK32 "); for (size_t i = 0; i < sizeof(ksWxss)/sizeof(ksWxss[0]); i++) { if ( re.ReplaceRange(ksWxss[i][0], ksWxss[i][1] + "/subsystem:windows", kDF, kDF, CRegexpUtil::eInside, 1) ) { break; } } re.SetRange("^# ADD .*LINK32 "); re.ReplaceRange(" *@s", kEmptyStr); // Take care of libraries: remove all FLTK ones re.SetRange("^# ADD .*LINK32 * fltk[a-z]*[.]lib"); re.ReplaceRange(" *fltk[a-z]*[.]lib", " @fltk"); // Insert them back but with correct names (which we use). // Note that in DLL mode only one (import) library has to be included. string lib = "fltkdll.lib"; if ( suffix != eDLL ) { lib = "fltkforms.lib fltkimages.lib fltkgl.lib " + lib; } re.SetRange("^# ADD .*LINK32 .*@fltk"); re.ReplaceRange("@fltk", "fltkdll.lib", kDF, kDF, CRegexpUtil::eInside, 1); re.ReplaceRange("@fltk", kEmptyStr); } // Get result; cfg_str = re; // Return name of configuration, which is created. if ( !gui.empty() ) { cfg += " (" + gui + ")"; } return cfg;} int CMainApplication::Run(void){ // Get and check arguments ParseArguments(); // Run conversion CDirEntry entry(m_Path); if ( entry.IsFile() ) { ProcessFile(m_Path); } else if ( entry.IsDir() ) { LOG_POST("Begin converting directory \"" << m_Path << "\"."); ProcessDir(m_Path); } else { ERR_POST(Fatal << "Path \"" + m_Path + "\" must exist."); } LOG_POST("Finished."); return 0;} ///////////////////////////////////////////////////////////////////////////////// Main//static CMainApplication theApp;int main(int argc, const char* argv[]){ // Execute main application function return theApp.AppMain(argc, argv, 0, eDS_Default, 0);}/* * =========================================================================== * $Log: one2all.cpp,v $ * Revision 1000.2 2004/06/01 19:42:05 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10 * * Revision 1.10 2004/05/17 21:08:36 gorelenk * Added include of PCH ncbi_pch.hpp * * Revision 1.9 2003/12/02 18:01:19 ivanov * Fixed message for the previous commit * * Revision 1.8 2003/12/02 17:59:13 ivanov * Remove ,bak file only if new one is created * * Revision 1.7 2003/11/28 16:53:23 ivanov * Keep modification time for conveted file * * Revision 1.6 2003/11/10 17:29:05 ivanov * Added option "-b" -- create backup files for projects (by default is off). * wxWindows: make sure that incremental linking is on except for DLLs * in the release mode (very slow). * * Revision 1.5 2003/11/10 14:59:51 ivanov * Fixed array size determination after previous fix. * Use caseless check for include/library paths, which refer to DIZZY. * * Revision 1.4 2003/11/07 17:14:56 ivanov * Use array of SReplacement instead of two-dim arrays * * Revision 1.3 2003/11/07 13:42:27 ivanov * Fixed lines wrapped at 79th columns. Get rid of compilation warnings on UNIX. * * Revision 1.2 2003/11/06 17:08:32 ivanov * Remove ".bak" file before renaming * * Revision 1.1 2003/11/06 16:17:58 ivanov * Initial revision. Based on one2all.sh script. * * =========================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -