/* @(#)Copyright (c), 1987, 1993 StatSci, Inc.  All rights reserved. */

#ifndef _S_NEXT_MACH_H_
#define _S_NEXT_MACH_H_

#include <sccs.h>
SCCS_ID_C(0041,@(#)next_mach.h 3.2 last edit 3/5/93 StatSci)

#define S_NEXT_CMD_TYPE_N 8
#define S_NEXT_MACH_INFO struct S_NEXT_MACH_INFO_T
S_NEXT_MACH_INFO {
	FILE *f;
	struct mach_header header;
	unsigned long ncmds[S_NEXT_CMD_TYPE_N];
	   /* Each element of cmd is an array of load commands for a
	      given load command type.  These arrays are allocated when
	      opening the mach file with S_next_mach_open().  These must be
	      freed when we free the info for the mach file, of course. */
	void *cmd[S_NEXT_CMD_TYPE_N];
};

#define S_NEXT_MACH_INFO_SEG struct S_NEXT_MACH_INFO_SEG_T
S_NEXT_MACH_INFO_SEG {
	struct segment_command seg;
	struct section *sec;
};

#ifndef S_NEXT_MACH_H_STORE
extern
#endif
int S_next_mach_errno;

/* These codes must match strings in S_next_mach_errno_s array. */
#define S_NEXT_MACH_NOERR 0
#define S_NEXT_MACH_MEM 1
#define S_NEXT_MACH_OPEN 2
#define S_NEXT_MACH_READ 3
#define S_NEXT_MACH_SEEK 4
#define S_NEXT_MACH_MAGIC 5
#define S_NEXT_MACH_CONS_SEG 6
#define S_NEXT_MACH_CONS_SYM 7
#define S_NEXT_MACH_CLOSE 8

#ifndef S_NEXT_MACH_H_STORE
extern
#endif
char *S_next_mach_errno_s[]
#ifdef S_NEXT_MACH_H_STORE
= {
	"no error",
	"out of memory",
	"can't open file",
	"can't read file",
	"can't seek in file",
	"magic number is not Mach magic number",
	"internal consistency error re segments",
	"internal consistency error re symbol table",
	"can't close file",
}
#endif
;

S_NEXT_MACH_INFO *S_next_mach_open();
char *S_next_mach_perror_str();

int S_next_mach_r_symnstr();
int S_next_mach_r_seg();
int S_next_mach_r_sec();
int S_next_mach_r_reloc();

#endif /* not _S_NEXT_MACH_H_ */
