master xplshn/aruu / shared / libtcutil / ar / archive.h
 1/* ar archive reading: symbol table and member extraction */
 2
 3#ifndef ARUU_TCUTIL_ARCHIVE_H
 4#define ARUU_TCUTIL_ARCHIVE_H
 5
 6#include <stdint.h>
 7#include <stdio.h>
 8
 9#include "../table.h"
10
11struct Vector;
12
13struct ArContent {
14  void    *obj;
15  size_t   size;
16  uint32_t file_offset;
17  char     name[16];
18};
19
20struct ArSymbol {
21  struct ArContent *content;
22};
23
24struct Archive {
25  FILE            *fp;
26  uint32_t         symbol_count;
27  struct ArSymbol *symbols;
28  struct Table     symbol_table;
29  struct Vector   *contents; /* <struct arcontent*> */
30};
31
32struct Archive *load_archive(const char *filename);
33void           *load_archive_content(
34    struct Archive *ar, struct ArSymbol *symbol, void *(*load)(FILE *, const char *, size_t)
35);
36
37#endif /* ARUU_TCUTIL_ARCHIVE_H */