From af687e2ba7cc7e095dcb51ac361d51363104a518 Mon Sep 17 00:00:00 2001 From: dsm <41967334+dsm@users.noreply.github.com> Date: Thu, 4 Jul 2024 10:42:54 +0300 Subject: [PATCH] windows specific macros generelized. --- qucs/components/spicedialog.cpp | 2 +- qucs/components/spicefile.cpp | 2 +- qucs/dialogs/aboutdialog.cpp | 8 ++++---- qucs/dialogs/simmessage.cpp | 20 ++++++++++---------- qucs/extsimkernels/xspice_cmbuilder.cpp | 4 ++-- qucs/main.cpp | 8 ++++---- qucs/octave_window.cpp | 4 ++-- qucs/qucs_actions.cpp | 8 ++++---- qucs/schematic_file.cpp | 2 +- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/qucs/components/spicedialog.cpp b/qucs/components/spicedialog.cpp index ecef14fb..f25240e3 100644 --- a/qucs/components/spicedialog.cpp +++ b/qucs/components/spicedialog.cpp @@ -359,7 +359,7 @@ bool SpiceDialog::loadSpiceNetList(const QString& s) qDebug() << "Run spice preprocessor (perl)"; bool piping = true; QString script; -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) QString interpreter = "tinyperl.exe"; #else QString interpreter = "perl"; diff --git a/qucs/components/spicefile.cpp b/qucs/components/spicefile.cpp index 19d24bf2..af2a61a9 100644 --- a/qucs/components/spicefile.cpp +++ b/qucs/components/spicefile.cpp @@ -264,7 +264,7 @@ bool SpiceFile::recreateSubNetlist(QString *SpiceFile, QString *FileName) if (preprocessor != "none") { bool piping = true; QStringList script; -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) QString interpreter = "tinyperl.exe"; #else QString interpreter = "perl"; diff --git a/qucs/dialogs/aboutdialog.cpp b/qucs/dialogs/aboutdialog.cpp index a1860c5e..aafc7790 100644 --- a/qucs/dialogs/aboutdialog.cpp +++ b/qucs/dialogs/aboutdialog.cpp @@ -225,19 +225,19 @@ void AboutDialog::setAuthorsText() { QString authorsText; authorsText = tr("Qucs-S project team:"); authorsText += ""; authorsText += tr("Based on Qucs project developed by:") + ""; authorsText += tr("Previous Developers") + ""; @@ -248,7 +248,7 @@ void AboutDialog::setAuthorsText() { void AboutDialog::setTrText() { QString trText; trText = tr("GUI translations :") + ""; diff --git a/qucs/dialogs/simmessage.cpp b/qucs/dialogs/simmessage.cpp index 6d036283..43d00714 100644 --- a/qucs/dialogs/simmessage.cpp +++ b/qucs/dialogs/simmessage.cpp @@ -47,7 +47,7 @@ #include "components/vhdlfile.h" #include "misc.h" -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) #define executableSuffix ".exe" #else #define executableSuffix "" @@ -324,7 +324,7 @@ void SimMessage::slotFinishSpiceNetlist(int status ) } // ------------------------------------------------------------------------ -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) #include static QString pathName(QString longpath) { const char * lpath = QDir::toNativeSeparators(longpath).toLatin1().data(); @@ -352,7 +352,7 @@ void SimMessage::startSimulator() QString SimTime; QStringList Arguments; QString SimPath = QDir::toNativeSeparators(QucsSettings.tempFilesDir.absolutePath()); -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) QString QucsDigiLib = "qucs_mkdigilib.bat"; QString QucsDigi = "qucs_run_hdl.bat"; QString QucsVeri = "qucs_run_verilog.bat"; @@ -380,7 +380,7 @@ void SimMessage::startSimulator() SimTime = Doc->SimTime; QString libs = Doc->Libraries.toLower(); /// \todo \bug error: unrecognized command line option '-Wl' -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) if(libs.isEmpty()) { libs = ""; } @@ -565,7 +565,7 @@ void SimMessage::startSimulator() << "-c"; } else { /// \todo \bug error: unrecognized command line option '-Wl' -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) Program = QDir::toNativeSeparators(pathName(QucsSettings.BinDir + QucsDigi)); Arguments << QDir::toNativeSeparators(QucsSettings.tempFilesDir.filePath("netlist.txt")) << DataSet @@ -598,7 +598,7 @@ void SimMessage::startSimulator() ProgressText = ""; -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) QString sep(";"); // path separator #else QString sep(":"); @@ -758,10 +758,10 @@ void SimMessage::slotSimEnded(int exitCode, QProcess::ExitStatus exitStatus ) int stat = exitCode; if ((exitStatus != QProcess::NormalExit) && -#ifdef _WIN32 -// due to a bug in Qt, negative error codes are erroneously interpreted -// as "program crashed", see https://bugreports.qt.io/browse/QTBUG-28735 -// When we will switch to Qt5(.1) this code can be removed... +#if defined(_WIN32) || defined(__MINGW32__) +/*! \todo: due to a bug in Qt, negative error codes are erroneously interpreted + as "program crashed", see https://bugreports.qt.io/browse/QTBUG-28735 + When we will switch to Qt5(.1) this code can be removed...*/ (uint)stat >= 0x80000000U && (uint)stat < 0xD0000000U && #endif !simKilled) { // as when killed by user exitStatus will be QProcess::CrashExit diff --git a/qucs/extsimkernels/xspice_cmbuilder.cpp b/qucs/extsimkernels/xspice_cmbuilder.cpp index 43eb895b..3a8cf40c 100644 --- a/qucs/extsimkernels/xspice_cmbuilder.cpp +++ b/qucs/extsimkernels/xspice_cmbuilder.cpp @@ -159,7 +159,7 @@ void XSPICE_CMbuilder::createCModelTree(QString &output) QFile mkfile(cmdir+"/Makefile"); if (mkfile.open(QIODevice::WriteOnly)) { QTextStream stream(&mkfile); -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) QString rules_file = QucsSettings.BinDir+"../share/" QUCS_NAME "/xspice_cmlib/cmlib.mingw32.rules.mk"; #else QString rules_file = QucsSettings.BinDir+"../share/" QUCS_NAME "/xspice_cmlib/cmlib.linux.rules.mk"; @@ -341,7 +341,7 @@ void XSPICE_CMbuilder::compileCMlib(QString &output) QProcess *make = new QProcess(); make->setProcessChannelMode(QProcess::MergedChannels); make->setWorkingDirectory(cmdir); -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) make->start("mingw32-make.exe",QStringList()); // For Unix #else make->start("make",QStringList()); // For Unix diff --git a/qucs/main.cpp b/qucs/main.cpp index c10382f3..945cf372 100644 --- a/qucs/main.cpp +++ b/qucs/main.cpp @@ -51,11 +51,11 @@ #include "extsimkernels/ngspice.h" #include "extsimkernels/xyce.h" -#ifdef _WIN32 +#if defined(_WIN32) ||defined(__MINGW32__) #include //for OutputDebugString #endif -#ifdef __MINGW32__ +#if defined(_WIN32) ||defined(__MINGW32__) #define executableSuffix ".exe" #else #define executableSuffix "" @@ -842,7 +842,7 @@ int main(int argc, char *argv[]) else { // default admsXml bindir same as Qucs QString admsExec; -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) admsExec = QDir::toNativeSeparators(QucsSettings.BinDir+"/"+"admsXml.exe"); #else admsExec = QDir::toNativeSeparators(QucsSettings.BinDir+"/"+"admsXml"); @@ -859,7 +859,7 @@ int main(int argc, char *argv[]) else { // default ASCO bindir same as Qucs QString ascoExec; -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) ascoExec = QDir::toNativeSeparators(QucsSettings.BinDir+"/"+"asco.exe"); #else ascoExec = QDir::toNativeSeparators(QucsSettings.BinDir+"/"+"asco"); diff --git a/qucs/octave_window.cpp b/qucs/octave_window.cpp index ddfaf164..10ad53f8 100644 --- a/qucs/octave_window.cpp +++ b/qucs/octave_window.cpp @@ -19,7 +19,7 @@ #include "misc.h" -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) #define executableSuffix ".exe" #else #define executableSuffix "" @@ -102,7 +102,7 @@ bool OctaveWindow::startOctave() connect(&octProcess, SIGNAL(readyReadStandardError()), SLOT(slotDisplayErr())); connect(&octProcess, SIGNAL(readyReadStandardOutput()), SLOT(slotDisplayMsg())); connect(&octProcess, SIGNAL(finished(int)), SLOT(slotOctaveEnded(int))); -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) QString sep(";"); // path separator #else QString sep(":"); diff --git a/qucs/qucs_actions.cpp b/qucs/qucs_actions.cpp index d1bc34c2..1d8fd4e4 100644 --- a/qucs/qucs_actions.cpp +++ b/qucs/qucs_actions.cpp @@ -742,7 +742,7 @@ void QucsApp::editFile(const QString& File) if (QucsSettings.Editor.toLower().contains("qucsedit")) { -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) prog = QUCS_NAME"edit.exe"; #elif __APPLE__ prog = "qucsedit.app/Contents/MacOS/qucsedit"; @@ -905,7 +905,7 @@ void QucsApp::launchTool(const QString& prog, const QString& progDesc, const QSt QString tooldir; if (qucs_tool) tooldir = QucsSettings.QucsatorDir; else tooldir = QucsSettings.BinDir; -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) QString cmd = QDir::toNativeSeparators("\""+tooldir + prog + ".exe\""); #elif __APPLE__ QString cmd = QDir::toNativeSeparators(tooldir + prog + ".app/Contents/MacOS/" + prog); @@ -1630,7 +1630,7 @@ void QucsApp::slotBuildModule() QString make; -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) make = "mingw32-make.exe"; // must be on the path! #else make = "make"; // must be on the path! @@ -1656,7 +1656,7 @@ void QucsApp::slotBuildModule() QString admsXml = QucsSettings.AdmsXmlBinDir.canonicalPath(); -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) admsXml = QDir::toNativeSeparators(admsXml+"/"+"admsXml.exe"); #else admsXml = QDir::toNativeSeparators(admsXml+"/"+"admsXml"); diff --git a/qucs/schematic_file.cpp b/qucs/schematic_file.cpp index a8d03dd8..416eac84 100644 --- a/qucs/schematic_file.cpp +++ b/qucs/schematic_file.cpp @@ -666,7 +666,7 @@ int Schematic::saveDocument() //pick admsXml from settings QString admsXml = QucsSettings.AdmsXmlBinDir.canonicalPath(); - #ifdef __MINGW32__ +#if defined(_WIN32) || defined(__MINGW32__) admsXml = QDir::toNativeSeparators(admsXml+"/"+"admsXml.exe"); #else admsXml = QDir::toNativeSeparators(admsXml+"/"+"admsXml");