Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sex(3x) — 4D1 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     SEX(3X)                                                   SEX(3X)



     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;



     Page 1                                        (last mod. 8/20/87)





     SEX(3X)                                                   SEX(3X)



          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
          constants 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
          argument 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



     Page 2                                        (last mod. 8/20/87)





     SEX(3X)                                                   SEX(3X)



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

     ORIGIN
          MIPS Computer Systems





































     Page 3                                        (last mod. 8/20/87)



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