ftp.nice.ch/Attic/openStep/developer/bundles/GDBbundle.1.0.s.tgz#/GDBbundle-1.0.s/debug/gdb/gdb/next/bytesex.h

This is bytesex.h in view mode; [Download] [Up]

/* bytesex.h */
#import <mach-o/fat.h>
#import <mach-o/loader.h>
#import <mach/m68k/thread_status.h>
#if 0
#import <mach/m88k/thread_status.h>
#import <mach/i860/thread_status.h>
#endif
#import <mach/i386/thread_status.h>
#import <mach-o/nlist.h>
#import <mach-o/reloc.h>
#import <bsd/ranlib.h>
#import "bool.h"

enum byte_sex {
    UNKNOWN_BYTE_SEX,
    BIG_ENDIAN_BYTE_SEX,
    LITTLE_ENDIAN_BYTE_SEX
};

#define SWAP_SHORT(a) ( ((a & 0xff) << 8) | ((unsigned short)(a) >> 8) )

#define SWAP_LONG(a) ( ((a) << 24) | \
		      (((a) << 8) & 0x00ff0000) | \
		      (((a) >> 8) & 0x0000ff00) | \
	((unsigned long)(a) >> 24) )

extern float SWAP_FLOAT(
    float f);

extern double SWAP_DOUBLE(
    double d);

extern enum byte_sex get_host_byte_sex(
    void);

extern void swap_fat_header(
    struct fat_header *fat_header,
    enum byte_sex target_sex);

extern void swap_fat_arch(
    struct fat_arch *fat_archs,
    unsigned long nfat_arch,
    enum byte_sex target_sex);

extern void swap_mach_header(
    struct mach_header *mh,
    enum byte_sex target_sex);

extern void swap_load_command(
    struct load_command *lc,
    enum byte_sex target_sex);

extern void swap_segment_command(
    struct segment_command *sg,
    enum byte_sex target_sex);

extern void swap_section(
    struct section *s,
    unsigned long nsects,
    enum byte_sex target_sex);

extern void swap_symtab_command(
    struct symtab_command *st,
    enum byte_sex target_sex);

extern void swap_symseg_command(
    struct symseg_command *ss,
    enum byte_sex target_sex);

extern void swap_fvmlib_command(
    struct fvmlib_command *fl,
    enum byte_sex target_sex);

extern void swap_fvmfile_command(
    struct fvmfile_command *ff,
    enum byte_sex target_byte_sex);

extern void swap_thread_command(
    struct thread_command *ut,
    enum byte_sex target_sex);

extern void swap_m68k_thread_state_regs(
    struct m68k_thread_state_regs *cpu,
    enum byte_sex target_sex);

extern void swap_m68k_thread_state_68882(
    struct m68k_thread_state_68882 *fpu,
    enum byte_sex target_sex);

extern void swap_m68k_thread_state_user_reg(
    struct m68k_thread_state_user_reg *user_reg,
    enum byte_sex target_sex);

#if 0
extern void swap_m88k_thread_state_grf_t(
    m88k_thread_state_grf_t *cpu,
    enum byte_sex target_sex);

extern void swap_m88k_thread_state_xrf_t(
    m88k_thread_state_xrf_t *fpu,
    enum byte_sex target_byte_sex);

extern void swap_m88k_thread_state_user_t(
    m88k_thread_state_user_t *user,
    enum byte_sex target_byte_sex);

extern void swap_m88110_thread_state_impl_t(
    m88110_thread_state_impl_t *spu,
    enum byte_sex target_byte_sex);

extern void swap_i860_thread_state_regs(
    struct i860_thread_state_regs *cpu,
    enum byte_sex target_sex);
#endif

extern void swap_i386_thread_state(
    i386_thread_state_t *cpu,
    enum byte_sex target_sex);

extern void swap_ident_command(
    struct ident_command *id,
    enum byte_sex target_sex);

extern void swap_nlist(
    struct nlist *symbols,
    unsigned long nsymbols,
    enum byte_sex target_sex);

extern void swap_ranlib(
    struct ranlib *ranlibs,
    unsigned long nranlibs,
    enum byte_sex target_sex);

extern void swap_relocation_info(
    struct relocation_info *relocs,
    unsigned long nrelocs,
    enum byte_sex target_byte_sex);

/*
 * swap_object_headers() swaps the object file headers from the host byte sex
 * into the non-host byte sex.  It returns TRUE if it can and did swap the
 * headers else returns FALSE and does not touch the headers and prints an error
 * using the error() routine.
 */
extern enum bool swap_object_headers(
    struct mach_header *mh,
    struct load_command *load_commands);

/*
 * get_toc_byte_sex() guesses the byte sex of the table of contents of the
 * library mapped in at the address, addr, of size, size based on the first
 * object file's bytesex.  If it can't figure it out, because the library has
 * no object file members or is malformed it will return UNKNOWN_BYTE_SEX.
 */
extern enum byte_sex get_toc_byte_sex(
    char *addr,
    unsigned long size);

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.