Михаил Капелько 7 months ago
parent
commit
ad7efc5f19
13 changed files with 80 additions and 56 deletions
  1. +1
    -4
      v4/cli.cpp
  2. +0
    -9
      v4/cli.h
  3. +1
    -4
      v4/cli_test.cpp
  4. +0
    -10
      v4/cli_test.h
  5. +24
    -0
      v4/cxx-headers
  6. +15
    -0
      v4/cxx-headers.sed
  7. +3
    -5
      v4/gen-C++
  8. +11
    -12
      v4/main.cpp
  9. +22
    -0
      v4/main.h
  10. +1
    -4
      v4/memory.cpp
  11. +1
    -4
      v4/memory_test.cpp
  12. +0
    -0
      v4/sample.h
  13. +1
    -4
      v4/tPythonC++/CPP.py

+ 1
- 4
v4/cli.cpp View File

@@ -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
// //


+ 0
- 9
v4/cli.h View File

@@ -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
- 4
v4/cli_test.cpp View File

@@ -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(
) { ) {


+ 0
- 10
v4/cli_test.h View File

@@ -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
- 0
v4/cxx-headers View 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
- 0
v4/cxx-headers.sed View 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();|


+ 3
- 5
v4/gen-C++ View File

@@ -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 \

+ 11
- 12
v4/main.cpp View File

@@ -1,32 +1,30 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
#include "cli_test.h"
#include "cli_Context.h"
#include "memory_test.h"
#include "main.h"
#include "memory_Context.h" #include "memory_Context.h"
#include "shell.h"


int main() { int main() {
std::cout std::cout
<< memory_test_generateConstPlayfield()
<< memory_test_detectMismatchedItems()
<< std::endl << std::endl
<< memory_test_selectItem_1x()
<< memory_test_detectMismatchedItems_itemTwice()
<< std::endl << std::endl
<< memory_test_selectItem_2x()
<< memory_test_detectVictory()
<< std::endl << std::endl
<< memory_test_selectItem_3x()
<< memory_test_generateConstPlayfield()
<< std::endl << std::endl
<< memory_test_shouldDeselectMismatchedItems()
<< memory_test_hideMatchingItems()
<< std::endl << std::endl
<< memory_test_shouldDeselectMismatchedItems_itemTwice()
<< memory_test_selectItem_1x()
<< std::endl << std::endl
<< memory_test_shouldDetectVictory()
<< memory_test_selectItem_2x()
<< std::endl << std::endl
<< memory_test_shouldHideMatchingItems()
<< memory_test_selectItem_3x()
<< std::endl << 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
- 0
v4/main.h View 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
- 4
v4/memory.cpp View File

@@ -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
- 4
v4/memory_test.cpp View File

@@ -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"








v4/memory.h → v4/sample.h View File


+ 1
- 4
v4/tPythonC++/CPP.py View File

@@ -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):


Loading…
Cancel
Save