Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ arch(3) — NeXTSTEP 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

ARCH(3)  —  UNIX Programmer’s Manual

NAME

NXGetAllArchInfos, NXGetLocalArchInfo, NXGetArchInfoFromName, NXGetArchInfoFromCpuType, NXFindBestFatArch, NXCombineCpuSubtypes − get architecture information

SYNOPSIS

#include <mach-o/arch.h>
extern const NXArchInfo ∗NXGetAllArchInfos(void);
extern const NXArchInfo ∗NXGetLocalArchInfo(void);
extern const NXArchInfo ∗NXGetArchInfoFromName(const char ∗name);
extern const NXArchInfo ∗NXGetArchInfoFromCpuType(cpu_type_t cputype,
cpu_subtype_t cpusubtype);
extern struct fat_arch ∗NXFindBestFatArch(cpu_type_t cputype,
cpu_subtype_t cpusubtype,
struct fat_arch ∗fat_archs,
unsigned long nfat_archs);
extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype,
cpu_subtype_t cpusubtype1,
cpu_subtype_t cpusubtype2);

DESCRIPTION

These functions are intended for use in programs that have to deal with fat files or programs that can target multiple architectures.  Typically a program will use a command line argument that starts with −arch name where this specifies an architecture.  These functions and data structures provided some help for processing architecture flags and then processing the contents of a fat file. 

The structure NXArchInfo defined in <mach-o/arch.h> is defined as follows:

typedef struct {
const char ∗name;
cpu_type_t cputype;
cpu_subtype_t cpusubtype;
enum NXByteOrder byteorder;
const char ∗description;
} NXArchInfo;

It is used to hold the name of the architecture and the corresponding cputype and cpusubtype together with its byte order and a brief description string. 

The currently known architectures are:

NameCPU TypeCPU SubtypeDescription
hppaCPU_TYPE_HPPACPU_SUBTYPE_HPPA_ALLHP-PA
i386CPU_TYPE_I386CPU_SUBTYPE_I386_ALLIntel 80x86
i860CPU_TYPE_I860CPU_SUBTYPE_I860_ALLIntel 860
m68kCPU_TYPE_MC680x0CPU_SUBTYPE_MC680x0_ALLMotorola 68K
m88kCPU_TYPE_MC88000CPU_SUBTYPE_MC88000_ALLMotorola 88K
m98kCPU_TYPE_MC98000CPU_SUBTYPE_MC98000_ALLPower PC
mipsCPU_TYPE_MIPSCPU_SUBTYPE_MIPS_ALLMIPS
sparcCPU_TYPE_SPARCCPU_SUBTYPE_SUN4_ALLSPARC
vaxCPU_TYPE_VAXCPU_SUBTYPE_VAX_ALLDEC VAX i486CPU_TYPE_I386CPU_SUBTYPE_486Intel 486
i486SXCPU_TYPE_I386CPU_SUBTYPE_486SXIntel 486SX
i586CPU_TYPE_I386CPU_SUBTYPE_586Intel 586
i586SXCPU_TYPE_I386CPU_SUBTYPE_586SXIntel 586SX
m68030CPU_TYPE_MC680x0CPU_SUBTYPE_MC68030_ONLYMotorola 68030
m68040CPU_TYPE_MC680x0CPU_SUBTYPE_MC68040Motorola 68040

The first set of entries are used for the architecture family and the second set are used for a specific architecture when more than one specific architecture is supported in a family of architectures. 

NXGetAllArchInfos() returns a pointer to an array of all known NXArchInfo structures.  The last NXArchInfo is marked by a NULL name. 

NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL if none is known. 

NXGetArchInfoFromName() and NXGetArchInfoFromCpuType() return the NXArchInfo from the architecture’s name or cputype/cpusubtype combination.  A cpusubtype of CPU_SUBTYPE_MULTIPLE can be used to request the most general NXArchInfo known for the given cputype.  NULL is returned if no matching NXArchInfo can be found. 

NXFindBestFatArch() is passed a cputype and cpusubtype and a set of fat_arch structs and selects the best one that matches (if any) and returns a pointer to that fat_arch struct (or NULL).  The fat_arch structs must be in the host byte order and correct such that the fat_archs really points to enough memory for nfat_arch structs.  It is possible that this routine could fail if new cputypes or cpusubtypes are added and an old version of this routine is used.  But if there is an exact match between the cputype and cpusubtype and one of the fat_arch structs this routine will always succeed. 

NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two different cpusubtypes for the specified cputype.  If the two cpusubtypes can’t be combined (the specific subtypes are mutually exclusive) −1 is returned indicating it is an error to combine them.  This can also fail and return −1 if new cputypes or cpusubtypes are added and an old version of this routine is used.  But if the cpusubtypes are the same they can always be combined and this routine will return the cpusubtype pass in.

NeXT Computer, Inc.  —  February 4, 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026