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
This commit is contained in:
Pavel P 2020-07-25 06:02:19 -04:00
parent 75c75ac00c
commit 352eb4cb6d
2 changed files with 4 additions and 56 deletions

View File

@ -108,7 +108,7 @@ mkdir -p $AMALGAMATE_OUTPUT_PATH
AMAL_H="${AMALGAMATE_OUTPUT_PATH}/simdjson.h"
AMAL_C="${AMALGAMATE_OUTPUT_PATH}/simdjson.cpp"
DEMOCPP="${AMALGAMATE_OUTPUT_PATH}/amalgamate_demo.cpp"
README="$AMALGAMATE_OUTPUT_PATH/README.md"
README="${AMALGAMATE_OUTPUT_PATH}/README.md"
echo "Creating ${AMAL_H}..."
echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_H}
@ -127,59 +127,8 @@ echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_C}
done
} >> ${AMAL_C}
echo "Creating ${DEMOCPP}..."
echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${DEMOCPP}
cat <<< '
#include <iostream>
#include "simdjson.h"
#include "simdjson.cpp"
int main(int argc, char *argv[]) {
if(argc < 2) {
std::cerr << "Please specify at least one file name. " << std::endl;
return EXIT_FAILURE;
}
const char * filename = argv[1];
simdjson::dom::parser parser;
UNUSED simdjson::dom::element elem;
auto error = parser.load(filename).get(elem); // do the parsing
if (error) {
std::cout << "parse failed" << std::endl;
std::cout << "error code: " << error << std::endl;
std::cout << error << std::endl;
return EXIT_FAILURE;
} else {
std::cout << "parse valid" << std::endl;
}
if(argc == 2) {
return EXIT_SUCCESS;
}
// parse_many
const char * filename2 = argv[2];
simdjson::dom::document_stream stream;
error = parser.load_many(filename2).get(stream);
if (!error) {
for (auto result : stream) {
error = result.error();
}
}
if (error) {
std::cout << "parse_many failed" << std::endl;
std::cout << "error code: " << error << std::endl;
std::cout << error << std::endl;
return EXIT_FAILURE;
} else {
std::cout << "parse_many valid" << std::endl;
}
return EXIT_SUCCESS;
}
' >> ${DEMOCPP}
CPPBIN=$(basename ${DEMOCPP} .cpp)
echo "Try :" > ${README}
echo "c++ -O3 -std=c++17 -pthread -o ${CPPBIN} ${DEMOCPP##*/} && ./${CPPBIN##*/} ../jsonexamples/twitter.json ../jsonexamples/amazon_cellphones.ndjson" >> ${README}
cp -u "${SCRIPTPATH}/amalgamate_demo.cpp" "${DEMOCPP}" 2>/dev/null
cp -u "${SCRIPTPATH}/README.md" "${README}" 2>/dev/null
echo "Done with all files generation."

View File

@ -1,8 +1,7 @@
/* auto-generated on Tue Aug 4 13:10:22 PDT 2020. Do not edit! */
#include <iostream>
#include "simdjson.h"
#include "simdjson.cpp"
int main(int argc, char *argv[]) {
if(argc < 2) {
std::cerr << "Please specify at least one file name. " << std::endl;