From 7ba6ea05963850a58e0e83637bc16e54832de915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20H=C3=B6ner?= Date: Mon, 3 Jul 2017 04:16:38 +0200 Subject: [PATCH] Moved private headers to `src` directory --- .gitignore | 2 ++ CMakeLists.txt | 10 ++++++---- examples/FormatterHooks.c | 4 ---- include/Zydis/Decoder.h | 2 +- include/Zydis/{InstructionInfo.h => DecoderTypes.h} | 0 include/Zydis/Formatter.h | 2 +- .../MnemonicDefines.h} | 0 include/Zydis/Mnemonic.h | 2 +- include/Zydis/Utils.h | 2 +- include/Zydis/Zydis.h | 2 +- src/Decoder.c | 2 +- .../Internal => src/Generated}/InstructionClassMap.inc | 0 .../Generated}/InstructionDefinitions.inc | 0 .../Internal => src/Generated}/InstructionFilters.inc | 0 .../Internal => src/Generated}/MnemonicStrings.inc | 0 .../Internal => src/Generated}/OperandDefinitions.inc | 0 src/InstructionTable.c | 10 +++++----- {include/Zydis/Internal => src}/InstructionTable.h | 2 +- src/Mnemonic.c | 2 +- 19 files changed, 21 insertions(+), 21 deletions(-) rename include/Zydis/{InstructionInfo.h => DecoderTypes.h} (100%) rename include/Zydis/{Internal/MnemonicDefines.inc => Generated/MnemonicDefines.h} (100%) rename {include/Zydis/Internal => src/Generated}/InstructionClassMap.inc (100%) rename {include/Zydis/Internal => src/Generated}/InstructionDefinitions.inc (100%) rename {include/Zydis/Internal => src/Generated}/InstructionFilters.inc (100%) rename {include/Zydis/Internal => src/Generated}/MnemonicStrings.inc (100%) rename {include/Zydis/Internal => src/Generated}/OperandDefinitions.inc (100%) rename {include/Zydis/Internal => src}/InstructionTable.h (99%) diff --git a/.gitignore b/.gitignore index f599e63..0aa0fcf 100644 --- a/.gitignore +++ b/.gitignore @@ -80,3 +80,5 @@ CTestTestfile.cmake # MacOS .DS_Store +build* +.vs diff --git a/CMakeLists.txt b/CMakeLists.txt index 069b39c..9116845 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,9 @@ endif () add_library("Zydis") -target_include_directories("Zydis" PUBLIC "include/" ${PROJECT_BINARY_DIR}) +target_include_directories("Zydis" + PUBLIC "include" ${PROJECT_BINARY_DIR} + PRIVATE "src") target_compile_definitions("Zydis" PRIVATE "_CRT_SECURE_NO_WARNINGS" "ZYDIS_EXPORTS") generate_export_header("Zydis" BASE_NAME "ZYDIS" EXPORT_FILE_NAME "ZydisExportConfig.h") @@ -82,7 +84,7 @@ target_sources("Zydis" "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Decoder.h" "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Defines.h" "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Formatter.h" - "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/InstructionInfo.h" + "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/DecoderTypes.h" "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Mnemonic.h" "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Register.h" "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Status.h" @@ -90,7 +92,7 @@ target_sources("Zydis" "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Utils.h" "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Zydis.h" PRIVATE - "include/Zydis/Internal/InstructionTable.h" + "src/InstructionTable.h" "src/Decoder.c" "src/Formatter.c" "src/InstructionTable.c" @@ -125,7 +127,7 @@ if (ZYDIS_BUILD_EXAMPLES) "examples/FormatterHooks.c" "examples/FormatHelper.h") target_link_libraries("FormatterHooks" "Zydis") - set_target_properties ("FormatterHooks" PROPERTIES FOLDER "Examples/Formatter") + set_target_properties("FormatterHooks" PROPERTIES FOLDER "Examples/Formatter") target_compile_definitions("FormatterHooks" PRIVATE "_CRT_SECURE_NO_WARNINGS") endif () diff --git a/examples/FormatterHooks.c b/examples/FormatterHooks.c index 7c8e090..4f8803f 100644 --- a/examples/FormatterHooks.c +++ b/examples/FormatterHooks.c @@ -37,7 +37,6 @@ #include #include "FormatHelper.h" #include -#include /* ============================================================================================== */ /* Static data */ @@ -214,11 +213,8 @@ void disassembleBuffer(ZydisInstructionDecoder* decoder, uint8_t* data, size_t l /* Entry point */ /* ============================================================================================== */ -#include - int main() { - uint8_t data[] = { // cmpps xmm1, xmm4, 0x03 diff --git a/include/Zydis/Decoder.h b/include/Zydis/Decoder.h index ee42bbc..b2b6697 100644 --- a/include/Zydis/Decoder.h +++ b/include/Zydis/Decoder.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/Zydis/InstructionInfo.h b/include/Zydis/DecoderTypes.h similarity index 100% rename from include/Zydis/InstructionInfo.h rename to include/Zydis/DecoderTypes.h diff --git a/include/Zydis/Formatter.h b/include/Zydis/Formatter.h index eb51f24..98db0b6 100644 --- a/include/Zydis/Formatter.h +++ b/include/Zydis/Formatter.h @@ -29,7 +29,7 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/Zydis/Internal/MnemonicDefines.inc b/include/Zydis/Generated/MnemonicDefines.h similarity index 100% rename from include/Zydis/Internal/MnemonicDefines.inc rename to include/Zydis/Generated/MnemonicDefines.h diff --git a/include/Zydis/Mnemonic.h b/include/Zydis/Mnemonic.h index ca13031..1250efd 100644 --- a/include/Zydis/Mnemonic.h +++ b/include/Zydis/Mnemonic.h @@ -43,7 +43,7 @@ extern "C" { */ typedef uint16_t ZydisInstructionMnemonic; -#include +#include /* ============================================================================================== */ /* Exported functions */ diff --git a/include/Zydis/Utils.h b/include/Zydis/Utils.h index 2c0c461..4cd26b7 100644 --- a/include/Zydis/Utils.h +++ b/include/Zydis/Utils.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/Zydis/Zydis.h b/include/Zydis/Zydis.h index eb58531..79e522a 100644 --- a/include/Zydis/Zydis.h +++ b/include/Zydis/Zydis.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Decoder.c b/src/Decoder.c index 11daa3e..31e3bdb 100644 --- a/src/Decoder.c +++ b/src/Decoder.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include /* ============================================================================================== */ /* Internal enums and types */ diff --git a/include/Zydis/Internal/InstructionClassMap.inc b/src/Generated/InstructionClassMap.inc similarity index 100% rename from include/Zydis/Internal/InstructionClassMap.inc rename to src/Generated/InstructionClassMap.inc diff --git a/include/Zydis/Internal/InstructionDefinitions.inc b/src/Generated/InstructionDefinitions.inc similarity index 100% rename from include/Zydis/Internal/InstructionDefinitions.inc rename to src/Generated/InstructionDefinitions.inc diff --git a/include/Zydis/Internal/InstructionFilters.inc b/src/Generated/InstructionFilters.inc similarity index 100% rename from include/Zydis/Internal/InstructionFilters.inc rename to src/Generated/InstructionFilters.inc diff --git a/include/Zydis/Internal/MnemonicStrings.inc b/src/Generated/MnemonicStrings.inc similarity index 100% rename from include/Zydis/Internal/MnemonicStrings.inc rename to src/Generated/MnemonicStrings.inc diff --git a/include/Zydis/Internal/OperandDefinitions.inc b/src/Generated/OperandDefinitions.inc similarity index 100% rename from include/Zydis/Internal/OperandDefinitions.inc rename to src/Generated/OperandDefinitions.inc diff --git a/src/InstructionTable.c b/src/InstructionTable.c index 08090e8..438d0c9 100644 --- a/src/InstructionTable.c +++ b/src/InstructionTable.c @@ -25,7 +25,7 @@ ***************************************************************************************************/ #include -#include +#include /* ============================================================================================== */ /* Data tables */ @@ -286,7 +286,7 @@ extern const ZydisInstructionDefinitionMVEX instructionDefinitionsMVEX[]; /* Physical instruction encodings */ /* ---------------------------------------------------------------------------------------------- */ -#include +#include /* ---------------------------------------------------------------------------------------------- */ /* Instruction tree */ @@ -299,7 +299,7 @@ extern const ZydisInstructionDefinitionMVEX instructionDefinitionsMVEX[]; #define ZYDIS_DEFINITION(encoding, instrclass, id) \ { ZYDIS_NODETYPE_DEFINITION_MASK | instrclass, (encoding << 13) | id } -#include +#include #undef ZYDIS_INVALID #undef ZYDIS_FILTER @@ -309,7 +309,7 @@ extern const ZydisInstructionDefinitionMVEX instructionDefinitionsMVEX[]; /* Instruction definitions */ /* ---------------------------------------------------------------------------------------------- */ -#include +#include /* ---------------------------------------------------------------------------------------------- */ @@ -320,7 +320,7 @@ extern const ZydisInstructionDefinitionMVEX instructionDefinitionsMVEX[]; #define ZYDIS_OPERAND_DEFINITION(type, encoding, access) \ { type, encoding, access } -#include +#include #undef ZYDIS_OPERAND_DEFINITION diff --git a/include/Zydis/Internal/InstructionTable.h b/src/InstructionTable.h similarity index 99% rename from include/Zydis/Internal/InstructionTable.h rename to src/InstructionTable.h index e3715e1..2a54273 100644 --- a/include/Zydis/Internal/InstructionTable.h +++ b/src/InstructionTable.h @@ -29,7 +29,7 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/Mnemonic.c b/src/Mnemonic.c index 7a47982..62f391b 100644 --- a/src/Mnemonic.c +++ b/src/Mnemonic.c @@ -30,7 +30,7 @@ /* Mnemonic strings */ /* ============================================================================================== */ -#include +#include /* ============================================================================================== */ /* Exported functions */