HPlogo HP-UX Reference Volume 3 of 5 > m

model(4)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

model — HP-UX machine identification

SYNOPSIS

#include <model.h>

DESCRIPTION

There are certain inevitable distinctions between HP-UX implementations due to hardware differences. Where such distinctions exist, conditional compilation or other definitions can be used to isolate the differences. Flags and typedefs to resolve these distinctions are collected in the <model.h> header file which contains constants identifying various HP-UX implementations.

For example, header file model.h contains the following constants whose values are defined in <sys/magic.h>:

#define HP_S_500 HP9000_ID #define HP_S_200 HP98x6_ID #define HP_S_300 CPU_HP_MC68020 #define HP_S_800 CPU_PA_RISC1_0 #define HP_S_700 CPU_PA_RISC1_1

Other such constants are added as appropriate when HP-UX extends to other machines in subsequent releases.

In addition, model.h has a statement defining the preprocessor constant MYSYS to represent the specific implementation for which compilation is desired. MYSYS is always equal to one of the constants above.

Conditional compilation can be used to adapt a single file for execution on more than one HP-UX implementation if the file contains implementation- or architecture-dependent features. For example, the code segment:

#if MYSYS==HP_S_400 <statements> #endif

causes statements following the if statement to be compiled only if the system processor is an HP 9000 Series 400 machine.

model.h also contains typedefs for several predefined types to enhance portability of certain types of code and files.

int8, u_int8

Signed and unsigned 8-bit integers.

int16, u_int16

Signed and unsigned 16-bit integers.

int32, u_int32

Signed and unsigned 32-bit integers.

machptr, u_machptr

Signed and unsigned integers large enough to hold a pointer.

Certain C preprocessor conditional compilation variables are defined to aid in implementation-dependent code. See cpp(1).

SEE ALSO

cc(1), cpp(1), magic(4).

© Hewlett-Packard Development Company, L.P.