8000 Do not update README.md and amalgamate_demo.cpp from amalgamate.sh · JavaScriptExpert/simdjson@352eb4c · GitHub
[go: up one dir, main page]

Skip to content

Commit 352eb4c

Browse files
committed
Do not update README.md and amalgamate_demo.cpp from amalgamate.sh
README.md and amalgamate_demo.cpp are always the same, there is no point to keep a copy and recreate them from amalgamate.sh
1 parent 75c75ac commit 352eb4c

File tree

2 files changed

+4
-56
lines changed

2 files changed

+4
-56
lines changed

singleheader/amalgamate.sh

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ mkdir -p $AMALGAMATE_OUTPUT_PATH
108108
AMAL_H="${AMALGAMATE_OUTPUT_PATH}/simdjson.h"
109109
AMAL_C="${AMALGAMATE_OUTPUT_PATH}/simdjson.cpp"
110110
DEMOCPP="${AMALGAMATE_OUTPUT_PATH}/amalgamate_demo.cpp"
111-
README="$AMALGAMATE_OUTPUT_PATH/README.md"
111+
README="${AMALGAMATE_OUTPUT_PATH}/README.md"
112112

113113
echo "Creating ${AMAL_H}..."
114114
echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_H}
@@ -127,59 +127,8 @@ echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_C}
127127
done
128128
} >> ${AMAL_C}
129129

130-
131-
echo "Creating ${DEMOCPP}..."
132-
echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${DEMOCPP}
133-
cat <<< '
134-
#include <iostream>
135-
#include "simdjson.h"
136-
#include "simdjson.cpp"
137-
int main(int argc, char *argv[]) {
138-
if(argc < 2) {
139-
std::cerr << "Please specify at least one file name. " << std::endl;
140-
return EXIT_FAILURE;
141-
}
142-
const char * filename = argv[1];
143-
simdjson::dom::parser parser;
144-
UNUSED simdjson::dom::element elem;
145-
auto error = parser.load(filename).get(elem); // do the parsing
146-
if (error) {
147-
std::cout << "parse failed" << std::endl;
148-
std::cout << "error code: " << error << std::endl;
149-
std::cout << error << std::endl;
150-
return EXIT_FAILURE;
151-
} else {
152-
std::cout << "parse valid" << std::endl;
153-
}
154-
if(argc == 2) {
155-
return EXIT_SUCCESS;
156-
}
157-
158-
// parse_many
159-
const char * filename2 = argv[2];
160-
simdjson::dom::document_stream stream;
161-
error = parser.load_many(filename2).get(stream);
162-
if (!error) {
163-
for (auto result : stream) {
164-
error = result.error();
165-
}
166-
}
167-
if (error) {
168-
std::cout << "parse_many failed" << std::endl;
169-
std::cout << "error code: " << error << std::endl;
170-
std::cout << error << std::endl;
171-
return EXIT_FAILURE;
172-
} else {
173-
std::cout << "parse_many valid" << std::endl;
174-
}
175-
return EXIT_SUCCESS;
176-
}
177-
' >> ${DEMOCPP}
178-
179-
CPPBIN=$(basename ${DEMOCPP} .cpp)
180-
181-
echo "Try :" > ${README}
182-
echo "c++ -O3 -std=c++17 -pthread -o ${CPPBIN} ${DEMOCPP##*/} && ./${CPPBIN##*/} ../jsonexamples/twitter.json ../jsonexamples/amazon_cellphones.ndjson" >> ${README}
130+
cp -u "${SCRIPTPATH}/amalgamate_demo.cpp" "${DEMOCPP}" 2>/dev/null
131+
cp -u "${SCRIPTPATH}/README.md" "${README}" 2>/dev/null
183132

184133
echo "Done with all files generation."
185134

singleheader/amalgamate_demo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* auto-generated on Tue Aug 4 13:10:22 PDT 2020. Do not edit! */
2-
31
#include <iostream>
42
#include "simdjson.h"
53
#include "simdjson.cpp"
4+
65
int main(int argc, char *argv[]) {
76
if(argc < 2) {
87
std::cerr << "Please specify at least one file name. " << std::endl;

0 commit comments

Comments
 (0)
0