d
This commit is contained in:
@@ -1,11 +1,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "cli.h"
|
|
||||||
#include "cli_Context.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "memory_Context.h"
|
#include "memory_Context.h"
|
||||||
#include "shell.h"
|
#include "main.h"
|
||||||
|
|
||||||
// Exit
|
// Exit
|
||||||
//
|
//
|
||||||
|
|||||||
9
v4/cli.h
9
v4/cli.h
@@ -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
|
|
||||||
@@ -1,11 +1,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "cli.h"
|
|
||||||
#include "cli_Context.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "memory_Context.h"
|
#include "memory_Context.h"
|
||||||
#include "shell.h"
|
#include "main.h"
|
||||||
|
|
||||||
std::string cli_test_exit_e(
|
std::string cli_test_exit_e(
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
#include <string>
|
|
||||||
|
|
||||||
#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
|
|
||||||
24
v4/cxx-headers
Executable file
24
v4/cxx-headers
Executable file
@@ -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
|
||||||
15
v4/cxx-headers.sed
Normal file
15
v4/cxx-headers.sed
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# #} -> }
|
||||||
|
#s|#}|}|
|
||||||
|
|
||||||
|
# # -> //
|
||||||
|
#s|#|//|
|
||||||
|
|
||||||
|
# dict[X, Y] -> std::map<X, Y>
|
||||||
|
#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();|
|
||||||
|
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
c++ -o test_memory_C++ -std=c++11 -I. \
|
c++ -o test_memory_C++ -std=c++11 -I. \
|
||||||
cli.cpp \
|
|
||||||
cli_Context.cpp \
|
|
||||||
cli_test.cpp \
|
|
||||||
memory.cpp \
|
memory.cpp \
|
||||||
memory_Context.cpp \
|
memory_Context.cpp \
|
||||||
memory_test.cpp \
|
memory_test.cpp \
|
||||||
shell.cpp \
|
|
||||||
shell_Context.cpp \
|
|
||||||
main.cpp
|
main.cpp
|
||||||
|
|
||||||
|
# cli.cpp \
|
||||||
|
# cli_test.cpp \
|
||||||
|
|||||||
23
v4/main.cpp
23
v4/main.cpp
@@ -1,32 +1,30 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "cli_test.h"
|
#include "main.h"
|
||||||
#include "cli_Context.h"
|
|
||||||
#include "memory_test.h"
|
|
||||||
#include "memory_Context.h"
|
#include "memory_Context.h"
|
||||||
#include "shell.h"
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::cout
|
std::cout
|
||||||
|
<< memory_test_detectMismatchedItems()
|
||||||
|
<< std::endl
|
||||||
|
<< memory_test_detectMismatchedItems_itemTwice()
|
||||||
|
<< std::endl
|
||||||
|
<< memory_test_detectVictory()
|
||||||
|
<< std::endl
|
||||||
<< memory_test_generateConstPlayfield()
|
<< memory_test_generateConstPlayfield()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
|
<< memory_test_hideMatchingItems()
|
||||||
|
<< std::endl
|
||||||
<< memory_test_selectItem_1x()
|
<< memory_test_selectItem_1x()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< memory_test_selectItem_2x()
|
<< memory_test_selectItem_2x()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< memory_test_selectItem_3x()
|
<< memory_test_selectItem_3x()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< memory_test_shouldDeselectMismatchedItems()
|
|
||||||
<< std::endl
|
|
||||||
<< memory_test_shouldDeselectMismatchedItems_itemTwice()
|
|
||||||
<< std::endl
|
|
||||||
<< memory_test_shouldDetectVictory()
|
|
||||||
<< std::endl
|
|
||||||
<< memory_test_shouldHideMatchingItems()
|
|
||||||
<< std::endl
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/*
|
||||||
std::cout
|
std::cout
|
||||||
<< cli_test_greetUser()
|
<< cli_test_greetUser()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
@@ -51,4 +49,5 @@ int main() {
|
|||||||
}
|
}
|
||||||
std::cout << c.output << std::endl;
|
std::cout << c.output << std::endl;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
22
v4/main.h
Normal file
22
v4/main.h
Normal file
@@ -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
|
||||||
|
|
||||||
@@ -1,11 +1,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "cli.h"
|
|
||||||
#include "cli_Context.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "memory_Context.h"
|
#include "memory_Context.h"
|
||||||
#include "shell.h"
|
#include "main.h"
|
||||||
|
|
||||||
// Detect mismatched items
|
// Detect mismatched items
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "cli.h"
|
|
||||||
#include "cli_Context.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "memory_Context.h"
|
#include "memory_Context.h"
|
||||||
#include "shell.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,8 @@ def includes():
|
|||||||
return """#include <map>
|
return """#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "cli.h"
|
|
||||||
#include "cli_Context.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "memory_Context.h"
|
#include "memory_Context.h"
|
||||||
#include "shell.h"
|
#include "main.h"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def replaceAnd(s):
|
def replaceAnd(s):
|
||||||
|
|||||||
Reference in New Issue
Block a user