1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #ifndef ARCHIVES_H
- #define ARCHIVES_H
- #include <metalang99.h>
- #ifdef TAR_H
- # define FROM_TAR ML99_TRUE()
- #else
- # define FROM_TAR ML99_FALSE()
- #endif
- #include "archive.h"
- #include "archives/7z.h"
- #include "archives/xz.h"
- #include "archives/zip.h"
- #include "archives/rar.h"
- #include "archives/tar.h"
- #include "archives/lz4.h"
- #include "archives/lzo.h"
- #include "archives/zst.h"
- #include "archives/lzma.h"
- #include "archives/gzip.h"
- #include "archives/bzip2.h"
- #define LIST(X) ML99_list(ML99_untuple(v(X)))
- #define NEW_ARITY 1
- #define NEW_IMPL(NAME) v(DYN(NAME, Archive, &(NAME){ 0 }))
- #define ALL_OR_TAR(NOT_TAR, TAR) \
- ML99_IF(FROM_TAR, LIST(TAR), ML99_listAppend(LIST(NOT_TAR), LIST(TAR)))
- /* building with tcc fails if array size not explicitly specified */
- #define NEW(ALL_NAME, TAR_NAME, NOT_TAR, TAR) \
- ML99_IF(FROM_TAR, TAR_NAME, ALL_NAME) \
- [ML99_EVAL(ML99_listLen(ALL_OR_TAR(NOT_TAR, TAR)))] = { \
- ML99_LIST_EVAL_COMMA_SEP( \
- ML99_listMap(v(NEW), ALL_OR_TAR(NOT_TAR, TAR))) \
- }
- #define ARCHIVES (Tar /* tar should be first */, Zip, Rar, SevenZip)
- #define TAR (GZip, BZip2, XZ, LZMA, LZ4, LZO, ZST)
- ML99_GCC_PRAGMA("GCC diagnostic push")
- /* ignore: initializer element is not constant */
- ML99_GCC_PRAGMA("GCC diagnostic ignored \"-Wpedantic\"")
- static Archive NEW(archives, tar_compressors, ARCHIVES, TAR);
- ML99_GCC_PRAGMA("GCC diagnostic pop")
- #endif /* ARCHIVES_H */
|