d
This commit is contained in:
5
v3/cpp.includes
Normal file
5
v3/cpp.includes
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "memory.h"
|
||||
#include "memory_Context.h"
|
||||
@@ -1,3 +1,4 @@
|
||||
OPT_HEADER/OPT_INCLUDES: 'None'/'None'
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
OPT_HEADER/OPT_INCLUDES: 'None'/'None'
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -5,13 +5,21 @@ from process import *
|
||||
|
||||
DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||
|
||||
# Demand file as input
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: /path/to/translate PYTHON_FILE")
|
||||
print("Usage: /path/to/translate [OPTIONS] PYTHON_FILE")
|
||||
sys.exit(1)
|
||||
|
||||
FILE_IN = sys.argv[1]
|
||||
FILE_IN = sys.argv[-1]
|
||||
|
||||
# Parse options
|
||||
# TODO Use options
|
||||
OPT_HEADER = "--header" in sys.argv
|
||||
OPT_INCLUDES = None
|
||||
OPT_PREFIX_INCLUDES = "--includes="
|
||||
for arg in sys.argv:
|
||||
if arg.startswith(OPT_PREFIX_INCLUDES):
|
||||
OPT_INCLUDES = arg[len(OPT_PREFIX_INCLUDES):]
|
||||
|
||||
# Translate file.
|
||||
out = process(FILE_IN)
|
||||
out = process(FILE_IN, OPT_HEADER, OPT_INCLUDES)
|
||||
print(out)
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
DIR=$(cd "$(dirname "$0")" ; pwd -P)
|
||||
TR=$DIR/tPythonC++/translate
|
||||
|
||||
$TR $DIR/memory.py > $DIR/memory.cpp
|
||||
$TR $DIR/memory_test.py > $DIR/memory_test.cpp
|
||||
$TR --header $DIR/memory.py #> $DIR/memory.cpp
|
||||
$TR --includes=/path/to/file $DIR/memory_test.py #> $DIR/memory_test.cpp
|
||||
|
||||
Reference in New Issue
Block a user