[Meta-diff-devel] lv-diff GNUmakefile,NONE,1.1 lvdiff.sln,NONE,1.1 lvdiff.vcproj,NONE,1.1 lvdiff.cpp
Brought to you by:
undees
From: Sebastian S. <ey...@us...> - 2005-07-30 10:59:06
|
Update of /cvsroot/meta-diff/lv-diff In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1151/lv-diff Modified Files: lvdiff.cpp Added Files: GNUmakefile lvdiff.sln lvdiff.vcproj Log Message: Added support for MSVC and GCC. Index: lvdiff.cpp =================================================================== RCS file: /cvsroot/meta-diff/lv-diff/lvdiff.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lvdiff.cpp 7 Aug 2003 21:13:25 -0000 1.3 --- lvdiff.cpp 30 Jul 2005 10:58:55 -0000 1.4 *************** *** 24,49 **** #include <time.h> ! #ifdef __WIN32__ ! #include <io.h> ! #include <process.h> ! #include <windows.h> ! #else ! #include <unistd.h> ! #endif ! ! #ifdef __BORLANDC__ ! #pragma hdrstop ! #include <condefs.h> #endif ! using namespace std; ! #ifdef __WIN32__ ! #define DELIMITER "\\" #else ! #define DELIMITER "/" #endif ! #ifdef __WIN32__ #pragma argsused WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) --- 24,52 ---- #include <time.h> ! // Borland compilers define "__WIN32__" whereas Microsoft compilers define ! // "_WIN32" for Windows applications. ! #if defined(__WIN32__) || defined(_WIN32) ! #define LVDIFF_WIN32 #endif ! #ifdef LVDIFF_WIN32 ! #include <io.h> ! #include <process.h> ! #include <windows.h> ! #define PATH_DELIMITER "\\" ! #define LVDIFF_ERROR(msg) MessageBox(NULL,msg,"metadiff error",MB_OK|MB_ICONERROR); #else ! #include <unistd.h> ! ! #define PATH_DELIMITER "/" ! #define LVDIFF_ERROR(msg) cerr << msg << endl; #endif ! using namespace std; ! ! #ifdef __BORLANDC__ ! // Use the Windows entry point to get rid of the console window. Borland C++ ! // automagically defines "_argc" and "_argv". #pragma argsused WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) *************** *** 54,65 **** if (_argc < 3) { ! cerr << "Usage: lvdiff file1 file2" << endl; ! return 0; } ! //Load the path to lvdiff.vi and the path to LabVIEW ! //from the .lvdiff file. string inFileName = _argv[0]; ! unsigned int lastDelim = inFileName.rfind(DELIMITER); if (lastDelim != string::npos) inFileName = inFileName.substr(0, lastDelim + 1) + ".lvdiff"; --- 57,68 ---- if (_argc < 3) { ! LVDIFF_ERROR("Usage: lvdiff <file1> <file2>") ! return -1; } ! // Load the path to lvdiff.vi and the path to LabVIEW ! // from the .lvdiff file. string inFileName = _argv[0]; ! unsigned int lastDelim = (unsigned int)inFileName.rfind(PATH_DELIMITER); if (lastDelim != string::npos) inFileName = inFileName.substr(0, lastDelim + 1) + ".lvdiff"; *************** *** 77,81 **** continue; string line = lineBuf; ! unsigned int location = line.find('='); if (location == string::npos) continue; --- 80,84 ---- continue; string line = lineBuf; ! unsigned int location = (unsigned int)line.find('='); if (location == string::npos) continue; *************** *** 92,98 **** return 0; ! //Write the paths to the two files to lvdiff.ini, which ! //will be used inside LabVIEW. ! string outFileName = pathToLVDiff + DELIMITER + "lvdiff.ini"; ofstream outFile(outFileName.c_str()); if (!outFile) --- 95,101 ---- return 0; ! // Write the paths to the two files to lvdiff.ini, which ! // will be used inside LabVIEW. ! string outFileName = pathToLVDiff + PATH_DELIMITER + "lvdiff.ini"; ofstream outFile(outFileName.c_str()); if (!outFile) *************** *** 105,121 **** ! //Prepare to run lvdiff.vi inside LabVIEW. ! string parameter = pathToLVDiff + DELIMITER + "lvdiff.vi"; ! #ifdef __WIN32__ parameter = "\"" + parameter + "\""; ! string command = pathToLV + DELIMITER + "labview.exe"; #else ! string command = pathToLV + DELIMITER + "labview"; #endif ! //Don't wait for the LabVIEW process to exit; most users ! //continue working in LabVIEW after doing a diff. ! #ifdef __WIN32__ spawnlp(P_NOWAITO, command.c_str(), command.c_str(), parameter.c_str(), NULL); --- 108,124 ---- ! // Prepare to run lvdiff.vi inside LabVIEW. ! string parameter = pathToLVDiff + PATH_DELIMITER + "lvdiff.vi"; ! #ifdef LVDIFF_WIN32 parameter = "\"" + parameter + "\""; ! string command = pathToLV + PATH_DELIMITER + "labview.exe"; #else ! string command = pathToLV + PATH_DELIMITER + "labview"; #endif ! // Don't wait for the LabVIEW process to exit; most users ! // continue working in LabVIEW after doing a diff. ! #ifdef LVDIFF_WIN32 spawnlp(P_NOWAITO, command.c_str(), command.c_str(), parameter.c_str(), NULL); *************** *** 127,141 **** { execlp(command.c_str(), command.c_str(), parameter.c_str(), NULL); ! return 0; } #endif ! //Exit once we're sure LabVIEW has read and deleted the .ini ! //file, or after a minute has passed. time_t start = time(NULL); while (access(outFileName.c_str(), 0) == 0 && difftime(time(NULL), start) < 60.0) { ! #ifdef __WIN32__ Sleep(500); #else --- 130,144 ---- { execlp(command.c_str(), command.c_str(), parameter.c_str(), NULL); ! return 0; } #endif ! // Exit once we're sure LabVIEW has read and deleted the .ini ! // file, or after a minute has passed. time_t start = time(NULL); while (access(outFileName.c_str(), 0) == 0 && difftime(time(NULL), start) < 60.0) { ! #ifdef LVDIFF_WIN32 Sleep(500); #else --- NEW FILE: lvdiff.sln --- Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lvdiff", "lvdiff.vcproj", "{43E5FDFD-81AB-40F3-ABC3-BE618761B92C}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {43E5FDFD-81AB-40F3-ABC3-BE618761B92C}.Debug.ActiveCfg = Debug|Win32 {43E5FDFD-81AB-40F3-ABC3-BE618761B92C}.Debug.Build.0 = Debug|Win32 {43E5FDFD-81AB-40F3-ABC3-BE618761B92C}.Release.ActiveCfg = Release|Win32 {43E5FDFD-81AB-40F3-ABC3-BE618761B92C}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal --- NEW FILE: GNUmakefile --- CPP = g++ CPPFLAGS = -pipe -Os -fomit-frame-pointer -mwindows -mno-cygwin %.o: %.cpp $(CPP) $(CPPFLAGS) -c $< -o $@ lvdiff: lvdiff.o $(CPP) $(CPPFLAGS) $^ -o $@ strip -s $@.exe .PHONY: clean cleanall clean: -rm -f *.exe *.o cleanall: clean -rm -f *.suo *.ncb *.tds *.obj -rm -fr Debug/ Release/ --- NEW FILE: lvdiff.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="lvdiff" ProjectGUID="{43E5FDFD-81AB-40F3-ABC3-BE618761B92C}" RootNamespace="lvdiff" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="5" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="4"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/lvdiff.exe" LinkIncremental="2" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/lvdiff.pdb" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" RuntimeLibrary="4" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/lvdiff.exe" LinkIncremental="1" GenerateDebugInformation="TRUE" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" EntryPointSymbol="mainCRTStartup" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <File RelativePath=".\lvdiff.cpp"> </File> </Files> <Globals> </Globals> </VisualStudioProject> |