Single-header version.
This commit is contained in:
parent
2280ec573e
commit
3803c84452
2
Makefile
2
Makefile
|
@ -62,6 +62,8 @@ test: jsoncheck numberparsingcheck stringparsingcheck
|
||||||
@echo "It looks like the code is good!"
|
@echo "It looks like the code is good!"
|
||||||
@tput sgr0
|
@tput sgr0
|
||||||
|
|
||||||
|
amalgamate:
|
||||||
|
./amalgamation.sh
|
||||||
|
|
||||||
$(SAJSON_INCLUDE):
|
$(SAJSON_INCLUDE):
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
|
@ -88,6 +88,13 @@ if( ! pj.isValid() ) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Usage: easy single-header version
|
||||||
|
|
||||||
|
See the "singleheader" repository for a single header version. See the included
|
||||||
|
file "amalgamation_demo.cpp" for usage. This requires no specific build system: just
|
||||||
|
copy the files in your project.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Usage (old-school Makefile on platforms like Linux or macOS)
|
## Usage (old-school Makefile on platforms like Linux or macOS)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,14 @@ AMAL_H="simdjson.h"
|
||||||
AMAL_C="simdjson.cpp"
|
AMAL_C="simdjson.cpp"
|
||||||
|
|
||||||
# order does not matter
|
# order does not matter
|
||||||
ALLCFILES=$( ( [ -d $SCRIPTPATH/.git ] && ( type git >/dev/null 2>&1 ) && ( git ls-files $SCRIPTPATH/src/*.c $SCRIPTPATH/src/**/*c ) ) || ( find $SCRIPTPATH/src -name '*.c' ) )
|
ALLCFILES="
|
||||||
|
$SCRIPTPATH/src/jsonioutil.cpp
|
||||||
|
$SCRIPTPATH/src/jsonminifier.cpp
|
||||||
|
$SCRIPTPATH/src/jsonparser.cpp
|
||||||
|
$SCRIPTPATH/src/stage1_find_marks.cpp
|
||||||
|
$SCRIPTPATH/src/stage2_flatten.cpp
|
||||||
|
$SCRIPTPATH/src/stage34_unified.cpp
|
||||||
|
"
|
||||||
|
|
||||||
# order matters
|
# order matters
|
||||||
ALLCHEADERS="
|
ALLCHEADERS="
|
||||||
|
@ -112,7 +119,14 @@ echo "Giving final instructions:"
|
||||||
CPPBIN=${DEMOCPP%%.*}
|
CPPBIN=${DEMOCPP%%.*}
|
||||||
|
|
||||||
echo "Try :"
|
echo "Try :"
|
||||||
echo "c++ -march=native -O3 -std=c++11 -o ${CPPBIN} ${DEMOCPP} && ./${CPPBIN} "
|
echo "c++ -march=native -O3 -std=c++11 -o ${CPPBIN} ${DEMOCPP} && ./${CPPBIN} jsonexamples/twitter.json "
|
||||||
|
|
||||||
|
SINGLEHDR=$SCRIPTPATH/singleheader
|
||||||
|
echo "Copying files to $SCRIPTPATH/singleheader "
|
||||||
|
mkdir -p $SINGLEHDR
|
||||||
|
echo "c++ -march=native -O3 -std=c++11 -o ${CPPBIN} ${DEMOCPP} && ./${CPPBIN} ../jsonexamples/twitter.json " > $SINGLEHDR/README.md
|
||||||
|
cp ${AMAL_C} ${AMAL_H} ${DEMOCPP} $SINGLEHDR
|
||||||
|
ls $SINGLEHDR
|
||||||
|
|
||||||
lowercase(){
|
lowercase(){
|
||||||
echo "$1" | tr 'A-Z' 'a-z'
|
echo "$1" | tr 'A-Z' 'a-z'
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
c++ -march=native -O3 -std=c++11 -o amalgamation_demo amalgamation_demo.cpp && ./amalgamation_demo ../jsonexamples/twitter.json
|
|
@ -0,0 +1,17 @@
|
||||||
|
/* auto-generated on Sun 30 Dec 2018 21:47:24 EST. Do not edit! */
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "simdjson.h"
|
||||||
|
#include "simdjson.cpp"
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
const char * filename = argv[1];
|
||||||
|
std::string_view p = get_corpus(filename);
|
||||||
|
ParsedJson pj = build_parsed_json(p); // do the parsing
|
||||||
|
if( ! pj.isValid() ) {
|
||||||
|
std::cout << "not valid" << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << "valid" << std::endl;
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue