Browse Source

Cleaning up CMakeLists (not using tests)

NNY.
Steve Thielemann 4 years ago
parent
commit
c7fb273e23
2 changed files with 15 additions and 81 deletions
  1. 12 25
      CMakeLists.txt
  2. 3 56
      doorman.cpp

+ 12 - 25
CMakeLists.txt

@@ -59,35 +59,21 @@ include(CTest)
 add_subdirectory(googletest)
 
 ### TESTS
-add_executable(test-lastseen test-lastseen.cpp lastseen.cpp)
-add_dependencies(test-lastseen gtest)
-target_link_libraries(test-lastseen gtest_main)
+# add_executable(test-lastseen test-lastseen.cpp lastseen.cpp)
+# add_dependencies(test-lastseen gtest)
+# target_link_libraries(test-lastseen gtest_main)
 
-enable_testing()
-add_test(NAME test-lastseen
-  COMMAND test-lastseen)
+# enable_testing()
+# add_test(NAME test-lastseen
+#   COMMAND test-lastseen)
 
-add_executable(test-utils test-utils.cpp utils.cpp)
-add_dependencies(test-utils gtest)
-target_link_libraries(test-utils gtest_main)
+# add_executable(test-utils test-utils.cpp utils.cpp)
+# add_dependencies(test-utils gtest)
+# target_link_libraries(test-utils gtest_main)
 
-add_test(NAME test-utils
-  COMMAND test-utils)
+# add_test(NAME test-utils
+#   COMMAND test-utils)
 
-add_executable(test-render test-render.cpp render.cpp terminal.cpp utils.cpp)
-add_dependencies(test-render gtest)
-target_link_libraries(test-render gtest_main)
-target_link_libraries(test-render zf_log)
-
-
-# add_test(NAME test-mangle COMMAND test-mangle)
-
-# add_executable(test-terminal test-terminal.cpp terminal.cpp utils.cpp)
-# add_dependencies(test-terminal gtest)
-# target_link_libraries(test-terminal gtest_main)
-# target_link_libraries(test-terminal zf_log)
-
-add_test(NAME test-terminal COMMAND test-terminal)
 
 add_subdirectory(zf_log)
 
@@ -107,6 +93,7 @@ add_subdirectory(zf_log)
 
 
 # add_executable(doorman doorman.cpp lastseen.cpp terminal.cpp render.cpp utils.cpp images.h wordplay.cpp charman.cpp logs_utils.cpp)
+
 add_executable(doorman doorman.cpp terminal.cpp utils.cpp logs_utils.cpp)
 target_link_libraries(doorman util)
 target_link_libraries(doorman zf_log)

+ 3 - 56
doorman.cpp

@@ -521,46 +521,7 @@ void terminal_output(TRANSLATE xlate, std::string &buffer) {
       }
     }
 
-    /*
-          // \xe2 found:
-          int c = 0;
-
-          // BUG:  If we replace the very last character, it looks like a
-       unichoad
-          // character.  It would be nice if we knew it was a translated
-       character
-          // and ignore it.
-          while (replace(buffer, "\xe2\x94\x80", "\xc4")) {
-            c++;
-          }
-          while (replace(buffer, "\xe2\x94\x98", "\xd9")) {
-            c++;
-          }
-          while (replace(buffer, "\xe2\x94\x90", "\xbf")) {
-            c++;
-          }
-          while (replace(buffer, "\xe2\x94\x8c", "\xda")) {
-            c++;
-          }
-          while (replace(buffer, "\xe2\x94\x82", "\xb3")) {
-            c++;
-          }
-          while (replace(buffer, "\xe2\x94\xa4", "\xb4")) {
-            c++;
-          }
-          while (replace(buffer, "\xe2\x94\x9c", "\xc3")) {
-            c++;
-          }
-          while (replace(buffer, "\xe2\x94\x94", "\xc0")) {
-            c++;
-          }
-
-    if (buffer.find('\xe2') != std::string::npos) {
-      ZF_LOGE_MEM(buffer.data(), buffer.size(), "Buffer still contains \xe2:");
-    };
-  }
-    */
-
+    // Convert bright to bold.
     while (replace(buffer, "\x1b[90m", "\x1b[1;30m")) {
     };
     while (replace(buffer, "\x1b[91m", "\x1b[1;31m")) {
@@ -578,6 +539,8 @@ void terminal_output(TRANSLATE xlate, std::string &buffer) {
     while (replace(buffer, "\x1b[97m", "\x1b[1;37m")) {
     };
 
+    // Search for DCS mode, and translate the line characters.
+
     for (auto iter = buffer.begin(); iter != buffer.end(); ++iter) {
       char c = *iter;
       Terminal::termchar tc = term.putchar(c);
@@ -649,22 +612,6 @@ void terminal_output(TRANSLATE xlate, std::string &buffer) {
     buffer.clear();
     buffer.insert(0, saved);
     saved.clear();
-
-    /*
-    char input[2048];
-    char cp437[2048];
-
-    // is ansi codes iconv safe?  let's find out! TIAS!
-
-    strcpy(input, buffer.c_str());
-    converter.convert(input, cp437, sizeof(cp437));
-
-    ZF_LOGV_MEM(cp437, strlen(cp437), "IConv Buffer:");
-
-    write(STDOUT_FILENO, cp437, strlen(cp437));
-    */
-
-    // buffer.clear();
   };
 }