diff --git a/v4/cli.cpp b/v4/cli.cpp index 153e423..683e509 100644 --- a/v4/cli.cpp +++ b/v4/cli.cpp @@ -1,11 +1,8 @@ #include #include #include -#include "cli.h" -#include "cli_Context.h" -#include "memory.h" #include "memory_Context.h" -#include "shell.h" +#include "main.h" // Exit // diff --git a/v4/cli.h b/v4/cli.h deleted file mode 100644 index b789022..0000000 --- a/v4/cli.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "cli_Context.h" - -#ifndef cli_HEADER -#define cli_HEADER - -cli_Context cli_greetUser(cli_Context); -cli_Context cli_showHelp(cli_Context); - -#endif // cli_HEADER diff --git a/v4/cli_test.cpp b/v4/cli_test.cpp index 092c719..9ddcf50 100644 --- a/v4/cli_test.cpp +++ b/v4/cli_test.cpp @@ -1,11 +1,8 @@ #include #include #include -#include "cli.h" -#include "cli_Context.h" -#include "memory.h" #include "memory_Context.h" -#include "shell.h" +#include "main.h" std::string cli_test_exit_e( ) { diff --git a/v4/cli_test.h b/v4/cli_test.h deleted file mode 100644 index e4842d1..0000000 --- a/v4/cli_test.h +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#ifndef cli_test_HEADER -#define cli_test_HEADER - -std::string cli_test_greetUser(); -std::string cli_test_showHelp_h(); -std::string cli_test_showHelp_help(); - -#endif // cli_test_HEADER diff --git a/v4/cxx-headers b/v4/cxx-headers new file mode 100755 index 0000000..75726c7 --- /dev/null +++ b/v4/cxx-headers @@ -0,0 +1,24 @@ +#!/bin/bash + +DIR=$(cd "$(dirname "$0")" ; pwd -P) +TMP=/tmp/cxx-headers.tmp + +grep '^memory_Context ' memory.cpp > $TMP +grep '^std::string ' memory_test.cpp >> $TMP +#grep '^memory_Context ' cli.cpp >> $TMP + +IN=$TMP +OUT=$DIR/main.h + +echo ' +#include "memory_Context.h" + +#ifndef main_HEADER +#define main_HEADER +' > $OUT + +sed -Ef cxx-headers.sed <$IN >>$OUT + +echo ' +#endif // main_HEADER +' >> $OUT diff --git a/v4/cxx-headers.sed b/v4/cxx-headers.sed new file mode 100644 index 0000000..4a02b50 --- /dev/null +++ b/v4/cxx-headers.sed @@ -0,0 +1,15 @@ +# #} -> } +#s|#}|}| + +# # -> // +#s|#|//| + +# dict[X, Y] -> std::map +#s_dict\[(.*), (.*)\]_std::map<\1, \2>_ + +# def functionName(X) -> Y -> Y functionName(X) { +#s|def (.*) -> (.*):|\2 \1 {| + +s|memory_Context (.*)\(|memory_Context \1(memory_Context);| +s|std::string (.*)\(|std::string \1();| + diff --git a/v4/gen-C++ b/v4/gen-C++ index c26a212..f31100e 100755 --- a/v4/gen-C++ +++ b/v4/gen-C++ @@ -1,10 +1,8 @@ c++ -o test_memory_C++ -std=c++11 -I. \ - cli.cpp \ - cli_Context.cpp \ - cli_test.cpp \ memory.cpp \ memory_Context.cpp \ memory_test.cpp \ - shell.cpp \ - shell_Context.cpp \ main.cpp + +# cli.cpp \ +# cli_test.cpp \ diff --git a/v4/main.cpp b/v4/main.cpp index 16d7801..06462d4 100644 --- a/v4/main.cpp +++ b/v4/main.cpp @@ -1,32 +1,30 @@ #include #include #include -#include "cli_test.h" -#include "cli_Context.h" -#include "memory_test.h" +#include "main.h" #include "memory_Context.h" -#include "shell.h" int main() { std::cout - << memory_test_generateConstPlayfield() + << memory_test_detectMismatchedItems() << std::endl - << memory_test_selectItem_1x() + << memory_test_detectMismatchedItems_itemTwice() << std::endl - << memory_test_selectItem_2x() + << memory_test_detectVictory() << std::endl - << memory_test_selectItem_3x() + << memory_test_generateConstPlayfield() << std::endl - << memory_test_shouldDeselectMismatchedItems() + << memory_test_hideMatchingItems() << std::endl - << memory_test_shouldDeselectMismatchedItems_itemTwice() + << memory_test_selectItem_1x() << std::endl - << memory_test_shouldDetectVictory() + << memory_test_selectItem_2x() << std::endl - << memory_test_shouldHideMatchingItems() + << memory_test_selectItem_3x() << std::endl ; + /* std::cout << cli_test_greetUser() << std::endl @@ -51,4 +49,5 @@ int main() { } std::cout << c.output << std::endl; } + */ } diff --git a/v4/main.h b/v4/main.h new file mode 100644 index 0000000..104e3ad --- /dev/null +++ b/v4/main.h @@ -0,0 +1,22 @@ + +#include "memory_Context.h" + +#ifndef main_HEADER +#define main_HEADER + +memory_Context memory_detectMismatchedItems(memory_Context); +memory_Context memory_detectVictory(memory_Context); +memory_Context memory_generateConstPlayfield(memory_Context); +memory_Context memory_hideMatchingItems(memory_Context); +memory_Context memory_selectItem(memory_Context); +std::string memory_test_detectMismatchedItems(); +std::string memory_test_detectMismatchedItems_itemTwice(); +std::string memory_test_detectVictory(); +std::string memory_test_generateConstPlayfield(); +std::string memory_test_hideMatchingItems(); +std::string memory_test_selectItem_1x(); +std::string memory_test_selectItem_2x(); +std::string memory_test_selectItem_3x(); + +#endif // main_HEADER + diff --git a/v4/memory.cpp b/v4/memory.cpp index 52fd4b6..940bcc9 100644 --- a/v4/memory.cpp +++ b/v4/memory.cpp @@ -1,11 +1,8 @@ #include #include #include -#include "cli.h" -#include "cli_Context.h" -#include "memory.h" #include "memory_Context.h" -#include "shell.h" +#include "main.h" // Detect mismatched items // diff --git a/v4/memory_test.cpp b/v4/memory_test.cpp index 3f6513b..80c0979 100644 --- a/v4/memory_test.cpp +++ b/v4/memory_test.cpp @@ -1,11 +1,8 @@ #include #include #include -#include "cli.h" -#include "cli_Context.h" -#include "memory.h" #include "memory_Context.h" -#include "shell.h" +#include "main.h" diff --git a/v4/memory.h b/v4/sample.h similarity index 100% rename from v4/memory.h rename to v4/sample.h diff --git a/v4/tPythonC++/CPP.py b/v4/tPythonC++/CPP.py index 315274b..f9de6db 100644 --- a/v4/tPythonC++/CPP.py +++ b/v4/tPythonC++/CPP.py @@ -4,11 +4,8 @@ def includes(): return """#include #include #include -#include "cli.h" -#include "cli_Context.h" -#include "memory.h" #include "memory_Context.h" -#include "shell.h" +#include "main.h" """ def replaceAnd(s):