Skip to content

Commit

Permalink
Merge pull request #147 from RadWolfie/sig-format-update
Browse files Browse the repository at this point in the history
OOVPA Sig Format Update
  • Loading branch information
ergo720 authored Aug 12, 2021
2 parents 6708a77 + 6cce128 commit 76753ab
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/OOVPADatabase/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ ColumnLimit: '0'
Cpp11BracedListStyle: 'false'
IndentCaseLabels: 'true'
IndentWidth: '4'
MacroBlockBegin: ^OOVPA_XREF$|^OOVPA_NO_XREF$|^OOVPA_XREF_DETECT$|^OOVPA_NO_XREF_DETECT$|^OOVPA_XREF_EXTEND$
MacroBlockEnd: ^OOVPA_END$
MacroBlockBegin: ^OOVPA_XREF$|^OOVPA_NO_XREF$|^OOVPA_XREF_DETECT$|^OOVPA_NO_XREF_DETECT$|^OOVPA_XREF_EXTEND$|^OOVPA_SIG_HEADER_XREF$|^OOVPA_SIG_HEADER_NO_XREF$|^OOVPA_SIG_HEADER_XREF_DETECT$|^OOVPA_SIG_HEADER_NO_XREF_DETECT$|^OOVPA_SIG_HEADER_XREF_EXTEND$
MacroBlockEnd: ^OOVPA_END$|^OOVPA_SIG_MATCH$
MaxEmptyLinesToKeep: '2'
PointerAlignment: Left
SortIncludes: 'false'
Expand Down
41 changes: 31 additions & 10 deletions src/OOVPADatabase/OOVPA.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@
// * Optimized (Offset, Value)-Pair Array
// ******************************************************************
typedef struct _OOVPA {
// This OOVPA field, Count, indicates the number of
// {Offset, Value}-pairs present in the Lovp array,
// available after casting this OOVPA to LOOVPA.
// (This Count INCLUDES optional leading {Offset, XREF_*-enum}-
// pairs - see comment at XRefCount.)
unsigned char Count;

unsigned char Padding;

// This OOVPA field, XRefCount, contains the number of
// {Offset, XREF_*-enum}-pairs that come before all other
Expand All @@ -61,7 +57,14 @@ typedef struct _OOVPA {

unsigned char DetectSelect;

unsigned char Padding[3];
unsigned char Padding2[2];

// This OOVPA field, Count, indicates the number of
// {Offset, Value}-pairs present in the Lovp array,
// available after casting this OOVPA to LOOVPA.
// (This Count INCLUDES optional leading {Offset, XREF_*-enum}-
// pairs - see comment at XRefCount.)
unsigned char Count;

// Define LOVP here to reduce type definition complexity.
// (Otherwise, if defined in the template classes, that would mean
Expand Down Expand Up @@ -150,18 +153,36 @@ typedef struct _LOOVPA {
} LOOVPA;
#pragma warning(pop)

#define COUNTARGS_LOVP(...) (sizeof((LOVP[]){ __VA_ARGS__ }) / sizeof(LOVP))
// clang-format off
#define OOVPA_SIG_MATCH(...) MSVC_EXPAND(COUNTARGS_LOVP(__VA_ARGS__)), { __VA_ARGS__ } }
// clang-format on

#define OOVPA_SIG_HEADER_XREF_EXTEND(Name, Version, XRefSaveIndex, XRefCount, DetectSelect) \
LOOVPA Name##_##Version = { VARPADSET, XRefCount, XRefSaveIndex, DetectSelect, VARPADSET, VARPADSET,

#define OOVPA_XREF_EXTEND(Name, Version, Count, XRefSaveIndex, XRefCount, DetectSelect) \
LOOVPA Name##_##Version = { Count, XRefCount, XRefSaveIndex, DetectSelect, VARPADSET, VARPADSET, VARPADSET,
LOOVPA Name##_##Version = { VARPADSET, XRefCount, XRefSaveIndex, DetectSelect, VARPADSET, VARPADSET, Count,

#define OOVPA_SIG_HEADER_XREF_DETECT OOVPA_SIG_HEADER_XREF_EXTEND

#define OOVPA_XREF_DETECT OOVPA_XREF_EXTEND

#define OOVPA_XREF_DETECT(Name, Version, Count, XRefSaveIndex, XRefCount, DetectSelect) \
OOVPA_XREF_EXTEND(Name, Version, Count, XRefSaveIndex, XRefCount, DetectSelect)
#define OOVPA_SIG_HEADER_NO_XREF_DETECT(Name, Version, DetectSelect) \
OOVPA_SIG_HEADER_XREF_EXTEND(Name, Version, XRefNoSaveIndex, XRefZero, DetectSelect)

#define OOVPA_NO_XREF_DETECT(Name, Version, Count, DetectSelect) \
OOVPA_XREF_EXTEND(Name, Version, Count, XRefNoSaveIndex, XRefZero, DetectSelect)

#define OOVPA_SIG_HEADER_XREF(Name, Version, XRefSaveIndex, XRefCount) \
OOVPA_SIG_HEADER_XREF_EXTEND(Name, Version, XRefSaveIndex, XRefCount, DetectDefault)

#define OOVPA_XREF(Name, Version, Count, XRefSaveIndex, XRefCount) \
OOVPA_XREF_EXTEND(Name, Version, Count, XRefSaveIndex, XRefCount, DetectDefault)

#define OOVPA_SIG_HEADER_NO_XREF(Name, Version) \
OOVPA_SIG_HEADER_XREF_EXTEND(Name, Version, XRefNoSaveIndex, XRefZero, DetectDefault)

#define OOVPA_NO_XREF(Name, Version, Count) \
OOVPA_XREF_EXTEND(Name, Version, Count, XRefNoSaveIndex, XRefZero, DetectDefault)

Expand Down

0 comments on commit 76753ab

Please sign in to comment.