diff --git a/common/generated/intel_acbp_v1.h b/common/generated/intel_acbp_v1.h index e142ef9..25413f9 100644 --- a/common/generated/intel_acbp_v1.h +++ b/common/generated/intel_acbp_v1.h @@ -31,7 +31,7 @@ public: IBB_SEGMENT_TYPE_NON_IBB = 1 }; - enum structure_ids_t { + enum structure_ids_t : uint64_t { STRUCTURE_IDS_PMDA = 6872283318001360735LL, STRUCTURE_IDS_PMSG = 6872289979495636831LL, STRUCTURE_IDS_ACBP = 6872299801917087583LL, diff --git a/common/generated/intel_acbp_v2.h b/common/generated/intel_acbp_v2.h index 59ce1c4..b3a25df 100644 --- a/common/generated/intel_acbp_v2.h +++ b/common/generated/intel_acbp_v2.h @@ -30,7 +30,7 @@ public: IBB_SEGMENT_TYPE_NON_IBB = 1 }; - enum structure_ids_t { + enum structure_ids_t : uint64_t { STRUCTURE_IDS_PMDA = 6872283318001360735LL, STRUCTURE_IDS_PMSG = 6872289979495636831LL, STRUCTURE_IDS_ACBP = 6872299801917087583LL, diff --git a/common/generated/intel_keym_v1.h b/common/generated/intel_keym_v1.h index adf8356..2ec5a3f 100644 --- a/common/generated/intel_keym_v1.h +++ b/common/generated/intel_keym_v1.h @@ -18,7 +18,7 @@ public: class signature_t; class key_signature_t; - enum structure_ids_t { + enum structure_ids_t : uint64_t { STRUCTURE_IDS_KEYM = 6872296602200661855LL }; diff --git a/common/generated/intel_keym_v2.h b/common/generated/intel_keym_v2.h index 062228f..40208b7 100644 --- a/common/generated/intel_keym_v2.h +++ b/common/generated/intel_keym_v2.h @@ -20,7 +20,7 @@ public: class public_key_t; class header_t; - enum structure_ids_t { + enum structure_ids_t : uint64_t { STRUCTURE_IDS_KEYM = 6872296602200661855LL }; diff --git a/kaitai_regenerate.sh b/kaitai_regenerate.sh index 8c91ba6..2b3a490 100755 --- a/kaitai_regenerate.sh +++ b/kaitai_regenerate.sh @@ -5,13 +5,17 @@ UTARGET=$(uname) # Determine platform if [ "$UTARGET" = "Darwin" ]; then export UPLATFORM="mac" + export UFIND="find -E" + export UFINDOPT="" + export USEDOPT="''" elif [ "$UTARGET" = "Linux" ]; then export UPLATFORM="linux_$(uname -m)" -elif [ "${UTARGET/MINGW32/}" != "$UTARGET" ]; then - export UPLATFORM="win32" + export UFIND="find" + export UFINDOPT="-regextype posix-extended" + export USEDOPT="" else - # Fallback to something... export UPLATFORM="$UTARGET" + echo "Please run this script on Linux or macOS" fi # Generate @@ -19,23 +23,28 @@ echo "Attempting to to generate parsers from Kaitai KSY files on ${UPLATFORM}... kaitai-struct-compiler --target cpp_stl --outdir common/generated common/ksy/* || exit 1 # Show generated files -find -E common/generated \ +${UFIND} common/generated ${UFINDOPT} \ -regex '.*\.(cpp|h)' \ -print || exit 1 # Replace global includes for kaitai with local ones (<> -> "") -find -E common/generated \ +${UFIND} common/generated ${UFINDOPT} \ -regex '.*\.(cpp|h)' \ - -exec sed -i '' '/^#include ]/\"/g' {} + || exit 1 + -exec sed -i ${USEDOPT} '/^#include ]/\"/g' {} + || exit 1 # Add .. to the include path for kaitai includes -find -E common/generated \ +${UFIND} common/generated ${UFINDOPT} \ -regex '.*\.(cpp|h)' \ - -exec sed -i '' '/^#include \"kaitai\//s/kaitai\//..\/kaitai\//g' {} + || exit 1 + -exec sed -i ${USEDOPT} '/^#include \"kaitai\//s/kaitai\//..\/kaitai\//g' {} + || exit 1 # Suppress "p__root - unused parameter" warning -find -E common/generated \ +${UFIND} common/generated ${UFINDOPT} \ -regex '.*\.(cpp)' \ - -exec sed -i '' '/^ m__root = this;/s/;/; (void)p__root;/g' {} + || exit 1 + -exec sed -i ${USEDOPT} '/^ m__root = this;/s/;/; (void)p__root;/g' {} + || exit 1 +# Add uint64_t to enum structure_ids_t +${UFIND} common/generated ${UFINDOPT} \ + -regex '.*\.(h)' \ + -exec sed -i ${USEDOPT} '/^ enum structure_ids_t {/s/{/: uint64_t {/g' {} + || exit 1 + exit 0