data.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* data.h: Definitions for internal data handling
  2. Copyright (C) 2003 Sebastian Reichelt
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #ifndef DATA_H
  15. #define DATA_H
  16. #include "../generic.h"
  17. #include "../lists.h"
  18. #include "../filestat.h"
  19. #define MAX_SYM_LEN 255
  20. struct ARCHIVE;
  21. struct OBJECT_FILE;
  22. struct SYMBOL;
  23. struct SYMBOL_TABLE;
  24. // Complete Archive
  25. typedef struct ARCHIVE {
  26. struct {
  27. LIST_HEADER(struct OBJECT_FILE);
  28. } ObjectFiles; // Object files contained in the archive.
  29. FILE_STATS FileStats; // Statistics of the file.
  30. COUNT SymbolCount; // Number of symbols in the archive.
  31. // Export help
  32. SIZE ArFileSize; // Size of the entire archive.
  33. struct SYMBOL_TABLE *SymbolTable; // Symbol table information.
  34. } ARCHIVE;
  35. // Object File
  36. typedef struct OBJECT_FILE {
  37. LIST_ITEM_HEADER(struct OBJECT_FILE);
  38. ARCHIVE *Parent;
  39. I1 *Data; // Pointer to file contents (needs to be freed at the end).
  40. SIZE Size; // Size of file.
  41. struct {
  42. LIST_HEADER(struct SYMBOL);
  43. } Symbols; // Exported symbols.
  44. const char *FileName; // File name.
  45. FILE_STATS FileStats; // Statistics of the file.
  46. // Export help
  47. SIZE ArMemberSize; // Size of the archive member, including padding.
  48. OFFSET ArMemberOffset; // Offset of the member inside the archive file.
  49. } OBJECT_FILE;
  50. // Exported Symbol in an Object File
  51. typedef struct SYMBOL {
  52. LIST_ITEM_HEADER(struct SYMBOL);
  53. OBJECT_FILE *Parent;
  54. char Name[MAX_SYM_LEN+1]; // Symbol name.
  55. SIZE NameLength; // Length of the symbol name.
  56. } SYMBOL;
  57. // Archive Symbol Table in Internal Representation
  58. typedef struct SYMBOL_TABLE {
  59. ARCHIVE *Parent;
  60. SIZE Size; // Size of the symbol table when it is written to the archive.
  61. // Export help
  62. SIZE ArMemberSize; // Size of the archive member, including padding.
  63. OFFSET ArMemberOffset; // Offset of the member inside the archive file.
  64. // Symbol array
  65. COUNT SymbolCount; // Number of symbols.
  66. SYMBOL *Symbols VAR_ARRAY; // An array pointing to the symbols in this table.
  67. } SYMBOL_TABLE;
  68. #endif