forked from ajrcarey/pdfium-render
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alastair Carey
committed
Aug 25, 2024
1 parent
3dab114
commit 4708272
Showing
57 changed files
with
23,388 additions
and
606 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
get_api_listing() { | ||
# $1 contains the term to search for | ||
|
||
grep -E -r -i "${1}\S+\(" include/pdfium_future/*.h | ||
} | ||
|
||
check_api_coverage() { | ||
# $1 contains the list of candidate functions to check | ||
# $2 contains the function prefix to search for | ||
|
||
prefix="(${2}.+)\(" | ||
|
||
while IFS= read -r line ; do | ||
fn="" | ||
|
||
if [[ $line != *"// "* ]] ; then | ||
IFS=" " read -r -a tokens <<< $line | ||
|
||
for token in ${tokens[@]} ; do | ||
if [[ $token =~ $prefix ]] ; then | ||
fn=${BASH_REMATCH[1]} | ||
fi | ||
done | ||
|
||
if [[ $fn != "" ]] ; then | ||
# echo "Checking bindings contains $fn" | ||
|
||
if [[ $(grep "fn $fn(" src/bindings.rs | wc -l) == 0 ]]; then | ||
echo "$fn missing from bindings" | ||
|
||
let "missing_count++" | ||
fi | ||
|
||
let "api_count++" | ||
fi | ||
fi | ||
done <<< "$1" | ||
} | ||
|
||
api_count=0 | ||
missing_count=0 | ||
|
||
fpdf_candidates=$(get_api_listing "FPDF") | ||
check_api_coverage "$fpdf_candidates" "FPDF" | ||
|
||
form_candidates=$(get_api_listing "FORM_Get") | ||
check_api_coverage "$form_candidates" "FORM_" | ||
|
||
echo "$api_count total functions in Pdfium API, $missing_count missing from bindings" | ||
|
||
exit $missing_count # Any non-zero value indicates failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# $1 contains the pdfium_* API feature to check | ||
|
||
cp examples/Cargo.toml examples/Cargo.bak | ||
|
||
features='"image", "pdfium_use_skia", "pdfium_enable_xfa", "pdfium_enable_v8", "'$1'"' | ||
crate_path='"../"' | ||
sed "s|pdfium-render = .*|pdfium-render = { path = ${crate_path}, default-features = false, features = [${features}] }|g" examples/Cargo.bak > examples/Cargo.toml | ||
|
||
wasm-pack build examples/ --target no-modules | ||
result=$? | ||
|
||
rm examples/Cargo.toml | ||
mv examples/Cargo.bak examples/Cargo.toml | ||
|
||
exit $result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.