dlidstrom / Duplo

Duplicates finder for various source code formats.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for gcc assembly

dlidstrom opened this issue · comments

Only in Duplo-S: ArgumentParser.o
Only in Duplo-S: ArgumentParser.s
Only in Duplo-S: duplo
diff -urp Duplo-master/Duplo.cpp Duplo-S/Duplo.cpp
--- Duplo-master/Duplo.cpp  2010-09-23 15:13:43.000000000 +0800
+++ Duplo-S/Duplo.cpp   2013-10-29 09:08:00.056444810 +0800
@@ -18,6 +18,7 @@

 #include <fstream>
 #include <time.h>
+#include <string.h>

 #include "SourceFile.h"
 #include "SourceLine.h"
Only in Duplo-S: Duplo.o
Only in Duplo-S: Duplo.s
Only in Duplo-S: files.txt
diff -urp Duplo-master/FileType.cpp Duplo-S/FileType.cpp
--- Duplo-master/FileType.cpp   2010-09-23 15:13:43.000000000 +0800
+++ Duplo-S/FileType.cpp    2013-10-29 09:29:16.924524640 +0800
@@ -7,6 +7,7 @@ static const std::string FileTypeExtn_CX
 static const std::string FileTypeExtn_H = "h";
 static const std::string FileTypeExtn_HPP = "hpp";
 static const std::string FileTypeExtn_Java = "java";
+static const std::string FileTypeExtn_S = "s";
 static const std::string FileTypeExtn_CS = "cs";
 static const std::string FileTypeExtn_VB = "vb";

@@ -51,6 +52,10 @@ FileType::FILETYPE FileType::GetFileType
     {
         return FILETYPE_JAVA;
     }
+    if (!FileExtn.compare(FileTypeExtn_S))
+    {
+        return FILETYPE_S;
+    }
     else if (!FileExtn.compare(FileTypeExtn_CS))
     {
         return FILETYPE_CS;
diff -urp Duplo-master/FileType.h Duplo-S/FileType.h
--- Duplo-master/FileType.h 2010-09-23 15:13:43.000000000 +0800
+++ Duplo-S/FileType.h  2013-10-29 09:14:44.484443676 +0800
@@ -16,6 +16,7 @@ public:
         FILETYPE_H,
         FILETYPE_HPP,
         FILETYPE_JAVA,
+        FILETYPE_S,
         FILETYPE_CS,
         FILETYPE_VB
     };
Only in Duplo-S: FileType.o
Only in Duplo-S: FileType.s
Only in Duplo-S: HashUtil.o
Only in Duplo-S: HashUtil.s
diff -urp Duplo-master/Makefile Duplo-S/Makefile
--- Duplo-master/Makefile   2010-09-23 15:13:43.000000000 +0800
+++ Duplo-S/Makefile    2013-10-29 09:05:57.292526981 +0800
@@ -2,7 +2,7 @@
 CC = g++

 # Flags
-CXXFLAGS = -O3
+CXXFLAGS = -Os -fno-rtti -fno-exceptions
 LDFLAGS =  ${CXXFLAGS}

 # Define what extensions we use
Only in Duplo-master: output.txt
Only in Duplo-S: out.txt
diff -urp Duplo-master/SourceFile.cpp Duplo-S/SourceFile.cpp
--- Duplo-master/SourceFile.cpp 2010-09-23 15:13:43.000000000 +0800
+++ Duplo-S/SourceFile.cpp  2013-10-29 15:21:30.708524135 +0800
@@ -67,6 +67,10 @@ SourceFile::SourceFile(const std::string
             tmp = line;
         }

+        if (FileType::FILETYPE_S    == m_FileType)
+            tmp.assign(line,0,line.find(";"));
+
+
        std::string cleaned;
        getCleanLine(tmp, cleaned);

@@ -100,6 +104,11 @@ void SourceFile::getCleanLine(const std:
                     return;
                 }
                 break;
+            case FileType::FILETYPE_S   :
+                if(i < lineSize-1 && line[i] == ';'){
+                    return;
+                }
+                break;
         }
         cleanedLine.push_back(line[i]);
     }
@@ -160,6 +169,14 @@ bool SourceFile::isSourceLine(const std:
              return std::string::npos == tmp.find(PreProc_VB.c_str(), 0, PreProc_VB.length());
           }
           break;
+
+       case FileType::FILETYPE_S   :
+          {
+              const std::string PreProc_S = "ret"; //we can't deduplicate ret AFAIK
+              return std::string::npos == tmp.find(PreProc_S.c_str(), 0, PreProc_S.length());
+         }
+          break;
+
        }
     }

Only in Duplo-S: SourceFile.o
Only in Duplo-S: SourceFile.s
Only in Duplo-S: SourceLine.o
Only in Duplo-S: SourceLine.s
Only in Duplo-S: StringUtil.o
Only in Duplo-S: StringUtil.s
Only in Duplo-S: TextFile.o
Only in Duplo-S: TextFile.s