2000-05-28 13:40:48 +00:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* */
|
|
|
|
|
/* objdata.h */
|
|
|
|
|
/* */
|
|
|
|
|
/* Handling object file data for the ar65 archiver */
|
|
|
|
|
/* */
|
|
|
|
|
/* */
|
|
|
|
|
/* */
|
2003-05-25 17:57:50 +00:00
|
|
|
|
/* (C) 1998-2003 Ullrich von Bassewitz */
|
|
|
|
|
/* R<>merstrasse 52 */
|
|
|
|
|
/* D-70794 Filderstadt */
|
|
|
|
|
/* EMail: uz@cc65.org */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
/* */
|
|
|
|
|
/* */
|
|
|
|
|
/* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
|
/* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
|
/* arising from the use of this software. */
|
|
|
|
|
/* */
|
|
|
|
|
/* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
|
/* including commercial applications, and to alter it and redistribute it */
|
|
|
|
|
/* freely, subject to the following restrictions: */
|
|
|
|
|
/* */
|
|
|
|
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
|
/* claim that you wrote the original software. If you use this software */
|
|
|
|
|
/* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
|
/* appreciated but is not required. */
|
|
|
|
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
|
/* be misrepresented as being the original software. */
|
|
|
|
|
/* 3. This notice may not be removed or altered from any source */
|
|
|
|
|
/* distribution. */
|
|
|
|
|
/* */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef OBJDATA_H
|
|
|
|
|
#define OBJDATA_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Data */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Values for the Flags field */
|
|
|
|
|
#define OBJ_HAVEDATA 0x0001 /* The object data is in the tmp file */
|
|
|
|
|
#define OBJ_MARKED 0x0002 /* Generic marker bit */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Internal structure holding object file data */
|
2003-05-25 17:57:50 +00:00
|
|
|
|
typedef struct ObjData ObjData;
|
|
|
|
|
struct ObjData {
|
|
|
|
|
ObjData* Next; /* Linked list of all objects */
|
|
|
|
|
char* Name; /* Module name */
|
|
|
|
|
unsigned Index; /* Module index */
|
|
|
|
|
unsigned Flags;
|
2000-05-28 13:40:48 +00:00
|
|
|
|
unsigned long MTime; /* Modifiation time of object file */
|
|
|
|
|
unsigned long Start; /* Start offset of data in library */
|
|
|
|
|
unsigned long Size; /* Size of data in library */
|
2003-05-25 17:57:50 +00:00
|
|
|
|
unsigned StringCount; /* Number of strings */
|
|
|
|
|
char** Strings; /* Strings from the object file */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
unsigned long ImportSize; /* Size of imports */
|
2003-05-25 17:57:50 +00:00
|
|
|
|
void* Imports; /* Imports as raw data */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
unsigned long ExportSize; /* Size of exports */
|
2003-05-25 17:57:50 +00:00
|
|
|
|
void* Exports; /* Exports as raw data */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Object data list management */
|
|
|
|
|
extern unsigned ObjCount; /* Count of files in the list */
|
|
|
|
|
extern ObjData* ObjRoot; /* List of object files */
|
|
|
|
|
extern ObjData* ObjLast; /* Last entry in list */
|
|
|
|
|
extern ObjData** ObjPool; /* Object files as array */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Code */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ObjData* NewObjData (void);
|
|
|
|
|
/* Allocate a new structure on the heap, insert it into the list, return it */
|
|
|
|
|
|
|
|
|
|
void FreeObjData (ObjData* O);
|
|
|
|
|
/* Free a complete struct */
|
|
|
|
|
|
|
|
|
|
ObjData* FindObjData (const char* Module);
|
|
|
|
|
/* Search for the module with the given name and return it. Return NULL if the
|
|
|
|
|
* module is not in the list.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void DelObjData (const char* Module);
|
|
|
|
|
/* Delete the object module from the list */
|
|
|
|
|
|
|
|
|
|
void MakeObjPool (void);
|
|
|
|
|
/* Allocate memory, index the entries and make the ObjPool valid */
|
|
|
|
|
|
|
|
|
|
const char* GetObjName (unsigned Index);
|
|
|
|
|
/* Get the name of a module by index */
|
|
|
|
|
|
2003-05-25 17:57:50 +00:00
|
|
|
|
const char* GetObjString (const ObjData* O, unsigned Index);
|
|
|
|
|
/* Get a string from the string pool of an object file */
|
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* End of objdata.h */
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|