Merge pull request #740 from pps83/master-amalgamate

Make amalgamated functionally equivalent to src/simdjson.cpp
This commit is contained in:
John Keiser 2020-04-26 08:17:49 -07:00 committed by GitHub
commit 8c74e88f16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 11 deletions

View File

@ -46,7 +46,7 @@ function doinclude()
if [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then if [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then
found_includes+=("$file") found_includes+=("$file")
dofile $AMALGAMATE_INCLUDE_PATH $file dofile $AMALGAMATE_INCLUDE_PATH $file
fi; fi
elif [ -f $AMALGAMATE_SOURCE_PATH/$file ]; then elif [ -f $AMALGAMATE_SOURCE_PATH/$file ]; then
# generic includes are included multiple times # generic includes are included multiple times
if [[ "${file}" == *'generic/'*'.h' ]]; then if [[ "${file}" == *'generic/'*'.h' ]]; then
@ -73,10 +73,15 @@ function dofile()
do do
if [[ "${line}" == '#include "'*'"'* ]]; then if [[ "${line}" == '#include "'*'"'* ]]; then
file=$(echo $line| cut -d'"' -f 2) file=$(echo $line| cut -d'"' -f 2)
# include all from simdjson.cpp except simdjson.h
if [ "${file}" == "simdjson.h" ] && [ "${2}" == "simdjson.cpp" ]; then
echo "$line"
continue
fi
if [[ "${file}" == '../'* ]]; then if [[ "${file}" == '../'* ]]; then
file=$(echo $file| cut -d'/' -f 2-) file=$(echo $file| cut -d'/' -f 2-)
fi; fi
# we explicitly include simdjson headers, one time each (unless they are generic, in which case multiple times is fine) # we explicitly include simdjson headers, one time each (unless they are generic, in which case multiple times is fine)
doinclude $file $line doinclude $file $line
@ -108,15 +113,6 @@ echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_H}
echo "Creating ${AMAL_C}..." echo "Creating ${AMAL_C}..."
echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_C} echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_C}
{ {
echo "#include \"simdjson.h\""
echo ""
echo "/* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */"
echo "#ifdef DMALLOC"
echo "#include \"dmalloc.h\""
echo "#endif"
echo ""
for file in ${ALLCFILES}; do for file in ${ALLCFILES}; do
dofile $AMALGAMATE_SOURCE_PATH $file dofile $AMALGAMATE_SOURCE_PATH $file
done done

View File

@ -1,4 +1,10 @@
#include "simdjson.h" #include "simdjson.h"
/* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */
#ifdef DMALLOC
#include "dmalloc.h"
#endif
#include "error.cpp" #include "error.cpp"
#include "implementation.cpp" #include "implementation.cpp"
#include "stage1_find_marks.cpp" #include "stage1_find_marks.cpp"