File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ test: jsoncheck numberparsingcheck stringparsingcheck
6262 @echo " It looks like the code is good!"
6363 @tput sgr0
6464
65+ amalgamate :
66+ ./amalgamation.sh
6567
6668$(SAJSON_INCLUDE ) :
6769 git submodule update --init --recursive
Original file line number Diff line number Diff line change @@ -88,6 +88,13 @@ if( ! pj.isValid() ) {
8888}
8989```
9090
91+ ## Usage: easy single-header version
92+
93+ See the "singleheader" repository for a single header version. See the included
94+ file "amalgamation_demo.cpp" for usage. This requires no specific build system: just
95+ copy the files in your project.
96+
97+
9198
9299## Usage (old-school Makefile on platforms like Linux or macOS)
93100
Original file line number Diff line number Diff line change @@ -12,7 +12,14 @@ AMAL_H="simdjson.h"
1212AMAL_C=" simdjson.cpp"
1313
1414# order does not matter
15- ALLCFILES=$( ( [ -d $SCRIPTPATH /.git ] && ( type git > /dev/null 2>&1 ) && ( git ls-files $SCRIPTPATH /src/* .c $SCRIPTPATH /src/** /* c ) ) || ( find $SCRIPTPATH /src -name ' *.c' ) )
15+ ALLCFILES="
16+ $SCRIPTPATH /src/jsonioutil.cpp
17+ $SCRIPTPATH /src/jsonminifier.cpp
18+ $SCRIPTPATH /src/jsonparser.cpp
19+ $SCRIPTPATH /src/stage1_find_marks.cpp
20+ $SCRIPTPATH /src/stage2_flatten.cpp
21+ $SCRIPTPATH /src/stage34_unified.cpp
22+ "
1623
1724# order matters
1825ALLCHEADERS="
@@ -112,7 +119,14 @@ echo "Giving final instructions:"
112119CPPBIN=${DEMOCPP%% .* }
113120
114121echo " Try :"
115- echo " c++ -march=native -O3 -std=c++11 -o ${CPPBIN} ${DEMOCPP} && ./${CPPBIN} "
122+ echo " c++ -march=native -O3 -std=c++11 -o ${CPPBIN} ${DEMOCPP} && ./${CPPBIN} jsonexamples/twitter.json "
123+
124+ SINGLEHDR=$SCRIPTPATH /singleheader
125+ echo " Copying files to $SCRIPTPATH /singleheader "
126+ mkdir -p $SINGLEHDR
127+ echo " c++ -march=native -O3 -std=c++11 -o ${CPPBIN} ${DEMOCPP} && ./${CPPBIN} ../jsonexamples/twitter.json " > $SINGLEHDR /README.md
128+ cp ${AMAL_C} ${AMAL_H} ${DEMOCPP} $SINGLEHDR
129+ ls $SINGLEHDR
116130
117131lowercase (){
118132 echo " $1 " | tr ' A-Z' ' a-z'
Original file line number Diff line number Diff line change 1+ c++ -march=native -O3 -std=c++11 -o amalgamation_demo amalgamation_demo.cpp && ./amalgamation_demo ../jsonexamples/twitter.json
Original file line number Diff line number Diff line change 1+ /* auto-generated on Sun 30 Dec 2018 21:47:24 EST. Do not edit! */
2+
3+ #include < iostream>
4+ #include " simdjson.h"
5+ #include " simdjson.cpp"
6+ int main (int argc, char *argv[]) {
7+ const char * filename = argv[1 ];
8+ std::string_view p = get_corpus (filename);
9+ ParsedJson pj = build_parsed_json (p); // do the parsing
10+ if ( ! pj.isValid () ) {
11+ std::cout << " not valid" << std::endl;
12+ } else {
13+ std::cout << " valid" << std::endl;
14+ }
15+ return EXIT_SUCCESS;
16+ }
17+
You can’t perform that action at this time.
0 commit comments