- added RCS Id string to header file

- added makeinstall target to Makefile
- added man page
- added mkso.data file
This commit is contained in:
gdr 1997-09-21 21:51:03 +00:00
parent d671eaa752
commit 09da0614d3
4 changed files with 524 additions and 17 deletions

View File

@ -1,9 +1,12 @@
# Makefile for SANE glue code
# 1997 Soenke Behrens
#
# All paths assume a GNO/ME setup as described in Devin Reade's
# GNO/ME FAQ. For installation under ORCA/Shell, see the README
# file
# file.
#
.INCLUDE .IGNORE: ../../paths.mk
LIBDIR = 13
# Change INCDIR to 13/orcacdefs if you are using the "old-style"
@ -14,7 +17,9 @@ INCDIR = /usr/include
# You should not have to modify anything beyond this point
all: sanetest findfpe lsaneglue
LIB = lsaneglue
all: sanetest findfpe $(LIB)
sanetest: sanetest.o saneglue.o
$(RM) saneglue.root
@ -24,23 +29,36 @@ findfpe: findfpe.o findfpcp.o
$(RM) findfpcp.root
occ -o findfpe findfpe.o findfpcp.o
saneglue.o:: saneglue.mac
saneglue.mac: saneglue.asm saneglue.macro
macgen saneglue.asm saneglue.mac saneglue.mac saneglue.macro \
13:ainclude:m16.sane 13:orcainclude:m16.orca
findfpcp.o:: findfpcp.mac
13:ainclude:m16.sane 13:orcainclude:m16.orca
findfpcp.mac: findfpcp.asm
macgen findfpcp.asm findfpcp.mac findfpcp.mac \
13:orcainclude:m16.orca
13:orcainclude:m16.orca
lsaneglue: saneglue.o findfpcp.o
$(RM) lsaneglue
makelib lsaneglue +saneglue.o +findfpcp.o
copyfork lsaneglue.r lsaneglue
$(LIB): saneglue.o findfpcp.o
$(RM) $(LIB)
makelib $(LIB) +saneglue.o +findfpcp.o
copyfork $(LIB).r $(LIB)
install:
cp -f sane.h $(INCDIR)
cp -f lsaneglue $(LIBDIR)
cp -f $(LIB) $(LIBDIR)
MI_LIBDIR = $(RELEASE_DIR)/lib
MI_INCDIR = $(RELEASE_DIR)/usr/include
MI_MANDIR = $(RELEASE_DIR)/usr/man/man3
MI_INSTALL = $(RELEASE_DIR)/install
makeinstall: $(LIB) sane.h saneglue.3 mkso.data
$(INSTALL) -d $(MI_LIBDIR)
$(INSTALL) -d $(MI_INCDIR)
$(INSTALL) -d $(MI_MANDIR)
$(INSTALL) $(LIB) $(MI_LIBDIR)
$(INSTALL) sane.h $(MI_INCDIR)
$(INSTALL) saneglue.3 $(MI_MANDIR)
$(INSTALL) mkso.data $(MI_INSTALL)/mkso.lsaneglue
findfpcp.o:: findfpcp.mac
saneglue.o:: saneglue.mac

58
lib/lsaneglue/mkso.data Normal file
View File

@ -0,0 +1,58 @@
# 0
# 1 This file is used by mkso(8) for building the man page .so links.
# 2
# 3 $Id: mkso.data,v 1.1 1997/09/21 21:51:02 gdr Exp $
# 4
man3/saneglue.3 man3/findfpcp.3
man3/saneglue.3 man3/s_annuity.3
man3/saneglue.3 man3/s_atan.3
man3/saneglue.3 man3/s_classcomp.3
man3/saneglue.3 man3/s_classdouble.3
man3/saneglue.3 man3/s_classextended.3
man3/saneglue.3 man3/s_classfloat.3
man3/saneglue.3 man3/s_compound.3
man3/saneglue.3 man3/s_copysign.3
man3/saneglue.3 man3/s_cos.3
man3/saneglue.3 man3/s_dec2num.3
man3/saneglue.3 man3/s_dec2str.3
man3/saneglue.3 man3/s_exp.3
man3/saneglue.3 man3/s_exp1.3
man3/saneglue.3 man3/s_exp2.3
man3/saneglue.3 man3/s_fabs.3
man3/saneglue.3 man3/s_fneg.3
man3/saneglue.3 man3/s_getenvironment.3
man3/saneglue.3 man3/s_gethaltvector.3
man3/saneglue.3 man3/s_getprecision.3
man3/saneglue.3 man3/s_getround.3
man3/saneglue.3 man3/s_inf.3
man3/saneglue.3 man3/s_ipower.3
man3/saneglue.3 man3/s_log.3
man3/saneglue.3 man3/s_log1.3
man3/saneglue.3 man3/s_log2.3
man3/saneglue.3 man3/s_logb.3
man3/saneglue.3 man3/s_nan.3
man3/saneglue.3 man3/s_nextdouble.3
man3/saneglue.3 man3/s_nextextended.3
man3/saneglue.3 man3/s_nextfloat.3
man3/saneglue.3 man3/s_num2dec.3
man3/saneglue.3 man3/s_pi.3
man3/saneglue.3 man3/s_power.3
man3/saneglue.3 man3/s_procentry.3
man3/saneglue.3 man3/s_procexit.3
man3/saneglue.3 man3/s_randomx.3
man3/saneglue.3 man3/s_relation.3
man3/saneglue.3 man3/s_rint.3
man3/saneglue.3 man3/s_scalb.3
man3/saneglue.3 man3/s_setenvironment.3
man3/saneglue.3 man3/s_setexception.3
man3/saneglue.3 man3/s_sethalt.3
man3/saneglue.3 man3/s_sethaltvector.3
man3/saneglue.3 man3/s_setprecision.3
man3/saneglue.3 man3/s_setround.3
man3/saneglue.3 man3/s_signnum\fB
man3/saneglue.3 man3/s_sin.3
man3/saneglue.3 man3/s_sqrt.3
man3/saneglue.3 man3/s_str2dec.3
man3/saneglue.3 man3/s_tan.3
man3/saneglue.3 man3/s_testexception.3
man3/saneglue.3 man3/s_testhalt.3

View File

@ -1,12 +1,13 @@
/*
* File: SANE.h
*
* Declarations, macros and prototypes for
* the SANE glue functions in library
* lsaneglue.
* Declarations, macros and prototypes for the SANE glue functions
* in library lsaneglue.
*
* Written in 1997 by Soenke Behrens.
* This code is hereby placed into the Public Domain.
*
* $Id: sane.h,v 1.2 1997/09/21 21:51:02 gdr Exp $
*/
#ifndef __SANE__

430
lib/lsaneglue/saneglue.3 Normal file
View File

@ -0,0 +1,430 @@
.\"
.\" $Id: saneglue.3,v 1.1 1997/09/21 21:51:03 gdr Exp $
.\"
.TH SANEGLUE 3 "21 September 1997" GNO "Library Routines"
.SH NAME
.BR findfpcp ,
.BR s_num2dec ,
.BR s_dec2num ,
.BR s_str2dec ,
.BR s_dec2str ,
.BR s_fabs ,
.BR s_fneg ,
.BR s_sqrt ,
.BR s_rint ,
.BR s_scalb ,
.BR s_logb ,
.BR s_copysign ,
.BR s_nextfloat ,
.BR s_nextdouble ,
.BR s_nextextended ,
.BR s_log2 ,
.BR s_log ,
.BR s_log1 ,
.BR s_exp2 ,
.BR s_exp ,
.BR s_exp1 ,
.BR s_power ,
.BR s_ipower ,
.BR s_compound ,
.BR s_annuity ,
.BR s_tan ,
.BR s_sin ,
.BR s_cos ,
.BR s_atan ,
.BR s_randomx ,
.BR s_classfloat ,
.BR s_classdouble ,
.BR s_classcomp ,
.BR s_classextended ,
.BR s_signnum ,
.BR s_setexception ,
.BR s_testexception ,
.BR s_sethalt ,
.BR s_testhalt ,
.BR s_setround ,
.BR s_getround ,
.BR s_setprecision ,
.BR s_getprecision ,
.BR s_setenvironment ,
.BR s_getenvironment ,
.BR s_procentry ,
.BR s_procexit ,
.BR s_gethaltvector ,
.BR s_sethaltvector ,
.BR s_relation ,
.BR s_nan ,
.BR s_inf ,
.BR s_pi
\- ORCA/C interface to SANE (the Standard Apple Numerics Environment)
.SH SYNOPSIS
#include <sane.h>
.sp 1
int \fBfindfpcp\fR(void);
.br
void \fBs_num2dec\fR(DecForm *\fIf\fR, extended \fIx\fR, Decimal *\fId\fR);
.br
extended \fBs_dec2num\fR(Decimal *\fId\fR);
.br
void \fBs_str2dec(char *\fIs\fR, short *\fIix\fR, Decimal *\fId\fR, short *\fIvp\fR);
.br
void \fBs_dec2str\fR(DecForm *\fIf\fR, Decimal *\fId\fR, char *\fIs\fR);
.br
extended \fBs_fabs\fR(extended \fIx\fR);
.br
extended \fBs_fneg\fR(extended \fIx\fR);
.br
extended \fBs_remainder\fR(extended \fIx\fR, extended \fIy\fR, short *\fIquo\fR);
.br
extended \fBs_sqrt\fR(extended \fIx\fR);
.br
extended \fBs_rint\fR(extended \fIx\fR);
.br
extended \fBs_scalb\fR(short \fIn\fR, extended \fIx\fR);
.br
extended \fBs_logb\fR(extended \fIx\fR);
.br
extended \fBs_copysign\fR(extended \fIx\fR, extended \fIy\fR);
.br
extended \fBs_nextfloat\fR(extended \fIx\fR, extended \fIy\fR);
.br
extended \fBs_nextdouble\fR(extended \fIx\fR, extended \fIy\fR);
.br
extended \fBs_nextextended\fR(extended \fIx\fR, extended \fIy\fR);
.br
extended \fBs_log2\fR(extended \fIx\fR);
.br
extended \fBs_log\fR(extended \fIx\fR);
.br
extended \fBs_log1\fR(extended \fIx\fR);
.br
extended \fBs_exp2\fR(extended \fIx\fR);
.br
extended \fBs_exp\fR(extended \fIx\fR);
.br
extended \fBs_exp1\fR(extended \fIx\fR);
.br
extended \fBs_power\fR(extended \fIx\fR, extended \fIy\fR);
.br
extended \fBs_ipower\fR(extended \fIx\fR, short \fIi\fR);
.br
extended \fBs_compound\fR(extended \fIr\fR, extended \fIn\fR);
.br
extended \fBs_annuity\fR(extended \fIr\fR, extended \fIn\fR);
.br
extended \fBs_tan\fR(extended \fIx\fR);
.br
extended \fBs_sin\fR(extended \fIx\fR);
.br
extended \fBs_cos\fR(extended \fIx\fR);
.br
extended \fBs_atan\fR(extended \fIx\fR);
.br
extended \fBs_randomx\fR(extended *\fIx\fR);
.br
numclass \fBs_classfloat\fR(extended \fIx\fR);
.br
numclass \fBs_classdouble\fR(extended \fIx\fR);
.br
numclass \fBs_classcomp\fR(extended \fIx\fR);
.br
numclass \fBs_classextended\fR(extended \fIx\fR);
.br
int \fBs_signnum\fR(extended \fIx\fR);
.br
void \fBs_setexception\fR(exception \fIe\fR, long \fIb\fR);
.br
long \fBs_testexception\fR(exception \fIe\fR);
.br
void \fBs_sethalt\fR(exception \fIe\fR, long \fIb\fR);
.br
long \fBs_testhalt\fR(exception \fIe\fR);
.br
void \fBs_setround\fR(rounddir \fIr\fR);
.br
rounddir \fBs_getround\fR(void);
.br
void \fBs_setprecision\fR(roundpre \fIp\fR);
.br
roundpre \fBs_getprecision\fR(void);
.br
void \fBs_setenvironment\fR(environment \fIe\fR);
.br
void \fBs_getenvironment\fR(environment *\fIe\fR);
.br
void \fBs_procentry\fR(environment *\fIe\fR);
.br
void \fBs_procexit\fR(environment \fIe\fR);
.br
haltvector \fBs_gethaltvector\fR(void);
.br
void \fBs_sethaltvector\fR(haltvector \fIv\fR);
.br
relop \fBs_relation\fR(extended \fIx\fR, extended \fIy\fR);
.br
extended \fBs_nan\fR(unsigned char \fIc\fR);
.br
extended \fBs_inf\fR(void);
.br
extended \fBs_pi\fR(void);
.SH DESCRIPTION
The
.BR lsaneglue
library contains code to let you call SANE functions directly from ORCA/C.
To avoid namespace conflicts with
.IR <math.h> ,
it was necessary to change
.IR <sane.h> .
Thus, all SANE functions are now prefixed with
.BR s_ .
(For example,
.BR annuity
became
.BR s_annuity ,
and
.BR sin
became
.BR s_sin .)
This lets you choose easily between the SANE and ISO/C implementations of
the same function.
.LP
Below is a brief overview of the functions in
.BR lsaneglue .
This overview does not replace, however, proper documentation. To fully
understand SANE, you will need the
.IR "Apple Numerics Manual".
SANE is also introduced in the
.IR "Apple IIgs Toolbox Reference" ,
Volume 2", Chapter 18.
.LP
It is important that the file
.IR <sane.h>
is used as the reference for constants used for
rounding direction, rounding precision, number classes, ordering relations,
formatting styles, NaN codes, and for settine and testing exceptions,
.LP
In the following list, page numbers refer to the
.IR "Apple Numerics Manual" .
.IP \fBfindfpcp\fR
This function is specific to the
.BR lsaneglue
library; it is not part of SANE proper and is not documented elsewhere.
.sp 1
.BR findfpcp
will find an FPE (Innovative Systems' Floating Point Engine)
or NC (Number Cruncher) card and return the slot number in which it resides.
If a card is not found, it will return
.BR -1 .
.sp 1
You can use the output of this function as the argument for the ORCA/C
.BR setfpeslot (3)
routine, which is used when having ORCA/C create code for the FPE/NC
directly (through the directive
.BR "#pragma float 1 1" ).
.IP \fBs_num2dec\fR
Converts extended number
.IR x
to a SANE decimal record,
.IR I .
(pp 28)
.IP \fBs_dec2num\fR
Converts SANE decimal record
.IR f
to an extended number. (pp 28f)
.IP \fBs_str2dec\fR
Converts string
.IR s
to a SANE decimal record,
.IR d .
(pp 30f)
.IP \fBs_dec2str\fR
Convert a SANE decimal record
.IR d
to a string.
(pp 31ff)
.IP \fBs_fabs\fR
Returns the absolute value of
.IR x .
(pp 49)
.IP \fBs_fneg\fR
Reverses the sign of
.IR x .
(pp 49)
.IP \fBs_remainder\fR
Returns the remainder
.IR "x / y" .
(pp 46f)
.IP \fBs_sqrt\fR
Returns the square root of
.IR x .
(pp 46)
.IP \fBs_rint\fR
Round
.IR x
to integer in current rounding direction. (pp 47)
.IP \fBs_scalb\fR
Returns (\fIx\fR times 2^\fIn\fR). (pp 50)
.IP \fBs_logb\fR
Computes binary exponent of normalized
.IR x .
(pp 50)
.IP \fBs_copysign\fR
Returns
.IR y
with sign of
.IR x .
(pp 49)
.IP \fBs_nextfloat\fR
Returns next float number after
.IR x
in direction of
.IR y .
(pp 50)
.IP \fBs_nextdouble\fR
Returns next double number after
.IR x
in direction of
.IR y .
(pp 50)
.IP \fBs_nextextended\fR
Returns next extended number after
.IR x
in direction of
.IR y .
(pp 50)
.IP \fBs_log2\fR
Returns the base-2 logarithm of
.IR x .
(pp 62)
.IP \fBs_log\fR
Returns base-e (natural) logarithm of
.IR x .
(pp 62)
.IP \fBs_log1\fR
Returns base-e (natural) logarithm of (\fIx\fR+1). (pp 62)
.IP \fBs_exp2\fR
Returns base-2 exponantial of \fIx\fR (2^\fIx\fR). (pp 63f)
.IP \fBs_exp\fR
Returns base-e (natural) exponantial of \fIx\fR (\fIx\fR^e). (pp 63f)
.IP \fBs_exp1\fR
Returns base-e (natural) exponantial of \fIx\fR minus 1 (\fIx\fR^e - 1).
(pp 63f)
.IP \fBs_power\fR
Returns
.IR x ^ y .
(pp 63f)
.IP \fBs_ipower\fR
Returns
.IR x ^ i .
(pp 63f)
.IP \fBs_compound\fR
Compute compound (1+\fIr\fR)^\fIn\fR. (pp 64f)
.IP \fBs_annuity\fR
Compute annuity (1-(1+\fIr\fR)^\fIn\fR)/\fIr\fR. (pp 65)
.IP \fBs_tan\fR
Returns tangent of
.IR x .
(pp 67f)
.IP \fBs_sin\fR
Returns sine of
.IR x .
(pp 67)
.IP \fBs_cos\fR
Returns cosine of
.IR x .
(pp 67)
.IP \fBs_atan\fR
Returns arctangent of
.IR x .
(pp 67f)
.IP \fBs_randomx\fR
Returns a pseudorandom integer value with seed
.IR x .
(pp 67)
.IP \fBs_classfloat\fR
Returns classification of float
.IR x .
(pp 44)
.IP \fBs_classdouble\fR
Returns classification of double
.IR x .
(pp 44)
.IP \fBs_classcomp\fR
Returns classification of comp
.IR x .
(pp 44)
.IP \fBs_classextended\fR
Returns classification of extended
.IR x .
(pp 44)
.IP \fBs_signnum\fR
Returns sign of
.IR x ;
zero if positive, 1 if negative. (pp 44)
.IP \fBs_setexception\fR
Clear or set SANE exceptions. (pp 54ff)
.IP \fBs_testexception\fR
Check whether SANE exception is currently set. (pp 54ff)
.IP \fBs_sethalt\fR
Clear or set SANE exception halts. (pp 54ff)
.IP \fBs_testhalt\fR
Check whether SANE exception halt is currently set. (pp 54ff)
.IP \fBs_setround\fR
Set SANE rounding direction. (pp 52f)
.IP \fBs_getround\fR
Get SANE rounding direction. (pp 52f)
.IP \fBs_setprecision\fR
Set SANE rounding precision. (pp 53)
.IP \fBs_getprecision\fR
Get SANE rounding precision. (pp 53)
.IP \fBs_setenvironment\fR
Set SANE environment word. (pp 57)
.IP \fBs_getenvironment\fR
Get SANE environment word. (pp 57)
.IP \fBs_procentry\fR
Save SANE environment word, then default it. (pp 57)
.IP \fBs_procexit\fR
Restore SANE environment word, then signal exceptions. (pp 57)
.IP \fBs_gethaltvector\fR
Get SANE halt vector. (pp 54)
.IP \fBs_sethaltvector\fR
Set SANE halt vector. (pp 54)
.IP \fBs_relation\fR
Returns relation of
.IR x
to
.IR y .
(pp 49)
.IP \fBs_nan\fR
Returns
.BR NaN
of type
.IR c .
.IP \fBs_inf\fR
Returns +\fBINF\fR (Infinity).
.IP \fBs_pi\fR
Returns
.BR pi
(3.141592653589793238512808959).
.SH "SANE TOOLKIT ERRORS"
The fclass functions should return the sign of the passed number
in n-bit and Y. They do not report the sign at all, though, which
has to be considered a bug.
.BR s_signnum
has been rewritten to not rely on fclassx any more.
.SH LEGALITIES
This library and the accompanying source code are hereby placed
into the Public Domain. There is no warranty, express or implied,
on the performance of the library or source code. The author is not
liable for any damage that may occur as a direct or indirect result
of using the library or source code.
.SH AUTHOR
Soenke Behrens <sbehrens@bigfoot.com>
.br
September 1997
.SH SEE ALSO
Apple Computers, Inc, \fIApple Numerics Manual\fR.
Addison-Wesley, 2nd Edition. 1988. ISBN 0-201-17738-2.
.sp 1
Apple Comuters, Inc, \fIApple IIgs Toolbox Reference, Volume 2\fR.
Addison-Wesley. 1988. ISBN 0-201-17747-1. (Chapter 18.)