Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sex(3) — mips UMIPS RISC/os 5.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought



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



NAME
     gethostsex, swap_*() - get the byte sex of the host machine,
          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;
     long count;



MIPS Computer Systems   Printed 11/19/92                   Page 1





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



     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
     containing bitfields, the destsex is required in the



 Page 2                 Printed 11/19/92    MIPS Computer Systems





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



     anticipation 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 11/19/92                   Page 3



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