mirror of
https://github.com/Xahau/xahaud.git
synced 2026-04-29 15:37:46 +00:00
* Hook API Refactor2: Amendment Guards (#621) * Hook API Refactor3: Consolidate the Hook API definitions from Enum.h and ApplyHook.h into a single file. (#622) * Hook API Refactoring / Unit Testing (#581) * Hook API Refactor2: Amendment Guards (#621) * Hook API Refactor3: Consolidate the Hook API definitions from Enum.h and ApplyHook.h into a single file. (#622) * Hook API Refactoring / Unit Testing (#581) * fix: update clang-format to v18 and fix include ordering - Update verify-generated-headers CI to use clang-format 18 (matching clang-format.yml) instead of stale v10 which can't parse .clang-format - Add .mise.toml for local clang-format 18 tooling - Fix include ordering in cherry-picked files per clang-format 18 * chore: update levelization results for HookAPI changes New loop: xrpl.hook <-> xrpld.app due to HookAPI.h including Transaction.h from xrpld.app. --------- Co-authored-by: tequ <git@tequ.dev>
55 lines
1.6 KiB
Bash
Executable File
55 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -eu
|
|
|
|
SCRIPT_DIR=$(dirname "$0")
|
|
SCRIPT_DIR=$(cd "$SCRIPT_DIR" && pwd)
|
|
|
|
APPLY_HOOK="$SCRIPT_DIR/../include/xrpl/hook/hook_api.macro"
|
|
|
|
{
|
|
echo '// For documentation please see: https://xrpl-hooks.readme.io/reference/'
|
|
echo '// Generated using generate_extern.sh'
|
|
echo '#include <stdint.h>'
|
|
echo '#ifndef HOOK_EXTERN'
|
|
echo
|
|
awk '
|
|
function trim(s) {
|
|
sub(/^[[:space:]]+/, "", s);
|
|
sub(/[[:space:]]+$/, "", s);
|
|
return s;
|
|
}
|
|
|
|
{
|
|
line = $0;
|
|
|
|
# Skip block comments
|
|
if (line ~ /\/\*/) {
|
|
next;
|
|
}
|
|
|
|
# Look for comment lines that start with // and contain function signature
|
|
if (line ~ /^[[:space:]]*\/\/[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]+[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]*\(/) {
|
|
# Remove leading // and trim
|
|
sub(/^[[:space:]]*\/\/[[:space:]]*/, "", line);
|
|
line = trim(line);
|
|
|
|
# Check if function name is "_g" to add attribute
|
|
if (line ~ /[[:space:]]+_g[[:space:]]*\(/) {
|
|
# Insert __attribute__((noduplicate)) before _g
|
|
sub(/[[:space:]]+_g/, " __attribute__((noduplicate)) _g", line);
|
|
}
|
|
|
|
# printf("\n");
|
|
|
|
printf("extern %s\n\n", line);
|
|
}
|
|
}
|
|
' "$APPLY_HOOK"
|
|
|
|
echo '#define HOOK_EXTERN'
|
|
echo '#endif // HOOK_EXTERN'
|
|
} | (
|
|
cd "$SCRIPT_DIR/.."
|
|
clang-format --style=file -
|
|
)
|