This is ofile.h in view mode; [Download] [Up]
/* ofile.h */
#import <ar.h>
#import <mach-o/loader.h>
#import "stuff/bytesex.h"
#import "stuff/bool.h"
#import "stuff/arch.h"
enum ofile_type {
OFILE_UNKNOWN,
OFILE_FAT,
OFILE_ARCHIVE,
OFILE_Mach_O
};
/*
* The structure used by ofile_*() routines for object files.
*/
struct ofile {
char *file_name; /* pointer to name malloc'ed by ofile_map */
char *file_addr; /* pointer to vm_allocate'ed memory */
unsigned long file_size; /* size of vm_allocate'ed memory */
enum ofile_type file_type; /* type of the file */
struct fat_header *fat_header; /* If a fat file these are filled in and */
struct fat_arch *fat_archs; /* if needed converted to host byte sex */
/* If this is a fat file then these are valid and filled in */
unsigned long narch; /* the current architecture */
enum ofile_type arch_type; /* the type of file for this arch. */
struct arch_flag arch_flag; /* the arch_flag for this arch, the name */
/* field is pointing at space malloc'ed */
/* by ofile_map. */
/* If this structure is currently referencing an archive member or an object
file that is an archive member these are valid and filled in. */
unsigned long member_offset; /* logical offset to the member starting */
char *member_addr; /* pointer to the member contents */
unsigned long member_size; /* actual size of the member (not rounded)*/
struct ar_hdr *member_ar_hdr; /* pointer to the ar_hdr for this member */
enum ofile_type member_type; /* the type of file for this member */
cpu_type_t archive_cputype; /* if the archive contains objects then */
cpu_subtype_t /* these two fields reflect the object */
archive_cpusubtype; /* at are in the archive. */
/* If this structure is currently referencing an object file these are
valid and filled in. The mach_header and load commands have been
converted to the host byte sex if needed */
char *object_addr; /* the address of the object file */
unsigned long object_size; /* the size of the object file */
enum byte_sex object_byte_sex; /* the byte sex of the object file */
struct mach_header *mh; /* the mach_header of the object file */
struct load_command /* the start of the load commands */
*load_commands;
};
extern void ofile_process(
char *name,
struct arch_flag *arch_flags,
unsigned long narch_flags,
enum bool all_archs,
enum bool process_non_objects,
void (*processor)(struct ofile *ofile, char *arch_name, void *cookie),
void *cookie);
extern enum bool ofile_map(
const char *file_name,
const struct arch_flag *arch_flag, /* can be NULL */
const char *object_name, /* can be NULL */
struct ofile *ofile,
enum bool archives_with_fat_objects);
extern void ofile_unmap(
struct ofile *ofile);
extern enum bool ofile_first_arch(
struct ofile *ofile);
extern enum bool ofile_next_arch(
struct ofile *ofile);
enum bool ofile_first_member(
struct ofile *ofile);
enum bool ofile_next_member(
struct ofile *ofile);
extern enum bool ofile_specific_member(
const char *object_name,
struct ofile *ofile);
extern void ofile_print(
struct ofile *ofile);
extern unsigned long size_ar_name(
const struct ar_hdr *ar_hdr);
extern long ofile_get_word(
unsigned long addr,
unsigned long *word,
void *get_word_data /* struct ofile *ofile */);
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.