Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sex(3) — sysv — mips UMIPS RISC/os 4.52

Media Vault

Software Library

Restoration Projects

Artifacts Sought






























































                         Printed 1/15/91                   Page 1





SEX(3-SysV)         RISC/os Reference Manual          SEX(3-SysV)



NAME
     gethostsex - get the byte sex of the host machine

     swap_*() - swap the sex of the specified structure

SYNOPSIS
     #include <sex.h>
     #include <filehdr.h>
     #include <aouthdr.h>
     #include <scnhdr.h>
     #include <sym.h>
     #include <symconst.h>
     #include <cmplrs/stsupport.h>
     #include <reloc.h>
     #include <ar.h>

     int gethostsex()

     long swapword(word)
     long word;

     short swaphalf(half)
     short half;

     void swapfilehdr(pfilehdr, destsex)
     FILHDR *pfilehdr;
     long destsex;

     void swapaouthdr(paouthdr, destsex)
     AOUTHDR *paouthdr;
     long destsex;

     void swapscnhdr(pscnhdr, destsex)
     SCNHDR *pscnhdr;
     long destsex;

     void swaphdr(phdr, destsex)
     pHDRR phdr;
     long destsex;

     void swapfd(pfd, count, destsex)
     pFDR pfd;
     long count;
     long destsex;

     void swapfi(pfi, count, destsex)
     pFIT pfi;
     long count;
     long destsex;

     void swapsym(psym, count, destsex)
     pSYMR psym;



MIPS Computer Systems    Printed 1/15/91                   Page 1





SEX(3-SysV)         RISC/os Reference Manual          SEX(3-SysV)



     long count;
     long destsex;

     void swapext(pext, count, destsex)
     pEXTR pext;
     long count;
     long destsex;

     void swappd(ppd, count, destsex)
     pPDR ppd;
     long count;
     long destsex;

     void swapdn(pdn, count, destsex)
     pRNDXR pdn;
     long count;
     long destsex;

     void swapopt(popt, count, destsex)
     pOPTR popt;
     long count;
     long destsex;

     void swapaux(paux, type, destsex)
     pAUXU paux;
     long type;
     long destsex;

     void swapreloc(preloc, count, destsex)
     struct reloc *preloc;
     long count;
     long destsex;

     void swapranlib(pranlib, count, destsex)
     struct ranlib *pranlib;
     long count;
     long destsex;

DESCRIPTION
     To use these routines, the library libmld.a must be loaded.

     Gethostsex returns one of two constants BIGENDIAN or
     LITTLEENDIAN for the sex of the host machine.  These con-
     stants are in sex.h.

     All swap_* routines that swap headers take a pointer to a
     header structure to change the byte's sex. The destsex argu-
     ment lets the swap routines decide whether to swap bitfields
     before or after swapping the words they occur in. If destsex
     equals the hostsex of the machine you are running on, the
     flip happens before the swap; otherwise, the flip happens
     after the swap.  Although not all routines swap structures



 Page 2                  Printed 1/15/91    MIPS Computer Systems





SEX(3-SysV)         RISC/os Reference Manual          SEX(3-SysV)



     containing bitfields, the destsex is required in the antici-
     pation of future need.

     The swap_aux routine takes a pointer to an aux entry and a
     type, which is a ST_AUX_* constant in cmplrs/stsupport.h.
     The constant specifies the type of the aux entry to change
     the sex of.  All other swap_* routines are passed a pointer
     to an array of structures and a count of structures to
     change the byte sex of.  The routines swap_word and
     swap_half are macros declared in sex.h. Only the include
     files necessary to describe the structures being swapped
     need be included.

AUTHOR
     Kevin Enderby








































MIPS Computer Systems    Printed 1/15/91                   Page 3



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