#ifndef FPAUX_EXT_H
#define FPAUX_EXT_H 1609624798
/* generated 2021-0102-1659 Make-H.pl fpaux-ext.c */

#include <pfe/pfe-base.h>

/**
 * -- IEEE Floating-Point word set, Part II (EXPERIMENTAL)
 *
 * Copyright (C) 2005, 2009, 2010, 2020, 2021 David N. Williams
 *
 * @see LGPL 
 * @author David N. Williams              (modified by $Author: dnw $)
 * @version %Revision: 0.6.2%
 *   (modified $Date: 2021-01-02 16:57:00 $)
 *
 * @description
 *   This experimental pfe loadable module was formerly part of
 *   ieeefp-ext.c, which implemented much of the proposed IEEE-FP
 *   Floating-Point word set, and is now split into two parts.
 *   
 *   Part I deals with words that operate on the floating-point stack,
 *   and has been merged into floating-ext.c.
 *   
 *   This module, Part II, implements words that deal with fpu
 *   control/status register access and bindings to C99 functions for
 *   floating-point environment, exceptions, and rounding modes.
 *   
 *   It does not automatically load floating-ext.c, because it is
 *   intended to work with any fp stack implemented for C99 compatible
 *   floating-point data types:  float, double, extended double, and
 *   __float128 (libquadmath).
 *   
 *   This module is intended to be POSIX compliant.  It is known to work
 *   on 32-bit Mac OS X ppc/intel Leopard and GNU/Linux systems, and
 *   64-bit macOS Big Sur and Linux Mint 19 systems.
 */

#ifdef __cplusplus
extern "C" {
#endif




extern P4_CODE (p4_plus_inf);

extern P4_CODE (p4_minus_inf);

extern P4_CODE (p4_plus_nan);

extern P4_CODE (p4_minus_nan);

/** FEGETENV  ( fenvp --  )
 * Store current floating-point environment at fenvp.
 */
extern P4_CODE (p4_fegetenv);

/** FESETENV  ( fenvp -- )
 * Set the floating-point environment to that pointed to by
 * fenvp.
 */
extern P4_CODE (p4_fesetenv);

/** FEHOLDEXCEPT  ( -- fenvp )
 * Leave the current floating-point environment pointer for
 * later restoration, and install an environment that turns off
 * floating-point exceptions.
 */
extern P4_CODE (p4_feholdexcept);

/** FEUPDATEENV  ( fenvp -- )
 * Set the floating-point environment to that pointed to by
 * fenvp, and raise the exceptions that were up just before the
 * call.
 */
extern P4_CODE (p4_feupdateenv);

/** GET-FFLAGS  ( excepts -- flags )
 * The flags output is the bitwise OR of the fp exception
 * constants corresponding to those flags that are both on in
 * the current fp state and present in excepts.
 */
extern P4_CODE (p4_get_fflags);

/** SET-FFLAGS  ( excepts -- )
 * Turn on the fp exception status flags corresponding to the fp
 * exceptions present in excepts.
 */
extern P4_CODE (p4_set_fflags);

/** CLEAR-FFLAGS ( excepts -- )
 * Clear the fp exception status flags corresponding to the fp
 * exceptions present in excepts.
 */
extern P4_CODE (p4_clear_fflags);

/** GET-FROUND  ( -- round )
 * Leave the current rounding mode value.
 */
extern P4_CODE (p4_get_fround);

/** SET-FROUND  ( round --  )
 * Set the current rounding mode to round.
 */
extern P4_CODE (p4_set_fround);

/** FPSCR@  ( -- u )
 * Leave the ppc 32-bit fp status and control register. 
 */
extern P4_CODE (p4_fpscr_fetch);

/** FPSCR!  ( u -- )
 * Store u in the ppc 32-bit fp status and control register.
 */
extern P4_CODE (p4_fpscr_store);

/** (FENABLE)   ( excepts -- )
 ** (FDISABLE)  ( excepts -- )
 * These words are a low level ppc version of FENABLE and
 * FDISABLE.  Turn on, respectively, off those enabling bits in
 * the ppc FPSCR register that are on in excepts, and leave the
 * rest alone.  Note that excepts is an OR of FE_xxx masks.
 */
extern P4_CODE (p4_paren_fenable);

extern P4_CODE (p4_paren_fdisable);

extern P4_CODE (p4_x87cr_fetch);

extern P4_CODE (p4_x87cr_store);

extern P4_CODE (p4_x87sr_fetch);

extern P4_CODE (p4_mxcsr_fetch);

extern P4_CODE (p4_mxcsr_store);

/** (FENABLE)   ( excepts -- )
 ** (FDISABLE)  ( excepts -- )
 * These words are a low level intel version of FENABLE and
 * FDISABLE.  Turn on, respectively, off those enabling bits in
 * the intel fpu registers that are on in excepts, and leave the
 * rest alone.  Note that excepts is an OR of FE_xxx masks.
 */
extern P4_CODE (p4_paren_fenable);

extern P4_CODE (p4_paren_fdisable);

/** FENABLED  ( -- excepts )
 * Leave the excepts corresponds to the fp exceptions currently
 * enabled for alternate handling.
 */
extern P4_CODE (p4_fenabled);

/** FEENABLEEXCEPT  ( excepts -- excepts.old )
 * Enable the exceptions in excepts for alternate handling, and
 * leave the previously enabled exceptions as excepts.old
 */
extern P4_CODE (p4_feenableexcept);

/** FENABLE  ( excepts -- )
 * Enable the fp exceptions in excepts for alternate handling,
 * after first clearing all fp exception status flags.
 */
extern P4_CODE (p4_fenable);

/** FEDISABLEEXCEPT  ( excepts -- excepts.old )
 * Disable the exceptions in excepts for alternate handling, and
 * leave the previously enabled exceptions as excepts.old.
 */
extern P4_CODE (p4_fedisableexcept);

/** FDISABLE  ( excepts -- )
 * Disable the fp exceptions in excepts for alternate handling,
 * after first clearing all fp exception status flags.
 */
extern P4_CODE (p4_fdisable);

/** SET-FHANDLER  ( xt -- )
 * Set the fp exception handler to use xt when enabled.  If
 * alternate handling is enabled and an fp exception occurs, xt
 * will be executed with the appropriate ANS Forth fp throw code
 * topmost on the data stack, possibly followed by other
 * implementation-defined data.  An ambiguous condition exists
 * if execution does not end by peforming THROW on the throw
 * code.  The default is the xt of THROW, which is initialized
 * by INSTALL-FHANDLING.
 */
extern P4_CODE (p4_set_fhandler);

/** GET-FHANDLER  ( -- xt )
 * Return the current xt, which will be used if alternate fp
 * exception handling is enabled.
 */
extern P4_CODE (p4_get_fhandler);

/** INSTALL-FHANDLING  ( -- )
 * Establish the alternate fp exception handler, and initialize
 * the xt it executes to that of THROW.  Thereafter the handler
 * will fire on a floating-point exception, if alternate fp
 * handling is enabled.  This word is executed when the ieeefp
 * extensions word set is loaded.  It may also be executed by an
 * application, which may be necessary on some systems after an
 * ABORT, to reestablish the handler.
 */
extern P4_CODE (p4_install_fhandling);

#ifdef __cplusplus
} /* extern "C" */
#endif


#endif