/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: f_whex.c,v 1.2 1997/09/25 17:22:51 ae59 Exp $ */
/*
$Log: f_whex.c,v $
 * Revision 1.2  1997/09/25  17:22:51  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:22:38  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : f_whex.c                              */
/*                                                              */
/*      Entry           : void f_whex(desc,r,mode)              */
/*                        f_text *desc;                         */
/*                        a_real r;                             */
/*                        a_char mode;                          */
/*                                                              */
/*      Arguments       : desc   - device descriptor            */
/*                        r      - real value                   */
/*                        mode   - read mode                    */
/*                                 'x' = hexadecimal (small)    */
/*                                 'X' = hexadecimal (capital)  */
/*                                                              */
/*      Description     : write real value in special format    */
/*                                                              */
/*      Date            : 1991-09-10                            */
/*      1991-09-10 : reverse output order if INTEL              */
/*      1991-02-14 : use of f_bhex()                            */
/*      1991-02-01 : f_putc() used instead of f_putc()          */
/*      1991-01-29 : code reduced using b_text() / mask removed */
/*      1990-11-15 : E_TPUSH+E_TPOPP                            */
/*      1990-09-13 : (int) on right-hand side of c =            */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
local void f_whex(f_text *desc,a_real r,a_char mode)
#else
local void f_whex(desc,r,mode)

f_text *desc;
a_real r;
a_char mode;
#endif
        {
        size_t i;
        a_char *p;

        E_TPUSH("f_whex")

        if (b_text(desc,FALSE))
           {
           if (mode!='x' && mode!='X')
              e_trap(I_O_ERROR,4,E_TMSG,51,E_TCHR,&mode);
           else
              {
#if INTEL
              p = ((a_char *)&r)+(sizeof(r)-1);
              for (i=0;i<sizeof(r);i++) f_bhex(desc,*p--,mode);
#else
              p = (a_char *)&r;
              for (i=0;i<sizeof(r);i++) f_bhex(desc,*p++,mode);
#endif
              }
           }

        E_TPOPP("f_whex")
        return;
        }
