diff options
Diffstat (limited to 'CPP/7zip/Common/RegisterArc.h')
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/Common/RegisterArc.h | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/CPP/7zip/Common/RegisterArc.h b/CPP/7zip/Common/RegisterArc.h index bc2a034f..edc3abdd 100755..100644 --- a/CPP/7zip/Common/RegisterArc.h +++ b/CPP/7zip/Common/RegisterArc.h @@ -5,23 +5,28 @@ #include "../Archive/IArchive.h" -typedef IInArchive * (*CreateInArchiveP)(); -typedef IOutArchive * (*CreateOutArchiveP)(); - struct CArcInfo { - const wchar_t *Name; - const wchar_t *Ext; - const wchar_t *AddExt; + const char *Name; + const char *Ext; + const char *AddExt; + Byte ClassId; - Byte Signature[16]; - int SignatureSize; - bool KeepName; - CreateInArchiveP CreateInArchive; - CreateOutArchiveP CreateOutArchive; + + Byte SignatureSize; + Byte Signature[20]; + UInt16 SignatureOffset; + + UInt16 Flags; + + Func_CreateInArchive CreateInArchive; + Func_CreateOutArchive CreateOutArchive; + Func_IsArc IsArc; + + bool IsMultiSignature() const { return (Flags & NArcInfoFlags::kMultiSignature) != 0; } }; -void RegisterArc(const CArcInfo *arcInfo); +void RegisterArc(const CArcInfo *arcInfo) throw(); #define REGISTER_ARC_NAME(x) CRegister ## x @@ -29,4 +34,22 @@ void RegisterArc(const CArcInfo *arcInfo); REGISTER_ARC_NAME(x)() { RegisterArc(&g_ArcInfo); }}; \ static REGISTER_ARC_NAME(x) g_RegisterArc; +#define REGISTER_ARC_DEC_SIG(x) struct REGISTER_ARC_NAME(x) { \ + REGISTER_ARC_NAME(x)() { g_ArcInfo.Signature[0]--; RegisterArc(&g_ArcInfo); }}; \ + static REGISTER_ARC_NAME(x) g_RegisterArc; + + +#define IMP_CreateArcIn_2(c) \ + static IInArchive *CreateArc() { return new c; } + +#define IMP_CreateArcIn IMP_CreateArcIn_2(CHandler) + +#ifdef EXTRACT_ONLY + #define IMP_CreateArcOut + #define REF_CreateArc_Pair CreateArc, NULL +#else + #define IMP_CreateArcOut static IOutArchive *CreateArcOut() { return new CHandler; } + #define REF_CreateArc_Pair CreateArc, CreateArcOut +#endif + #endif |