home *** CD-ROM | disk | FTP | other *** search
- Copyright (C) 1990 MetaWare Incorporated. All Rights Reserved.
-
- High C Version 1.7
- Weitek ABACUS Support
- December 1990
-
- Table of Contents
- -----------------
-
- 1. Included Files
- 2. Compiling
- 3. Calling Convention
- 4. 386|DOS-Extender
- 5. Linking
- 6. stdio.h
- 7. Libraries
- 8. Library Name Space
- 9. Math Errors
- 10. Problems
-
-
- 1. Included Files
- ------------------
-
- fbench.c -- Benchmark example program.
- wstdio.h -- Modified to assume extern functions do not touch the 1167.
- weitek.doc -- This document.
- hcwp.lib -- Weitek transcendental library for Phar Lap.
- weitek.pro -- A sample profile for enabling pragma 1167 or pragma 3167.
- matherr.c -- Exception-handling function.
-
-
- 2. Compiling
- -------------
-
- To generate Weitek code, compile your program with driver command-line option
- -f3167 or -f1167. This will:
-
- * Turn on toggle 3167 or 1167, respectively.
- * Link with library HCWP.LIB.
- * Define the macro __1167 to be 1 (this macro is used
- for conditional preprocessing in stdio.h).
-
- If you do not use the driver, instead do the following:
-
- * Turn on toggle 3167 or 1167.
- * Link as described below.
- * Either:
- include wstdio.h (found in the Weitek subdirectory of your High C
- distribution) instead of stdio.h
- or:
- #define __1167 1 in your program and include stdio.h.
-
- Please read the Programmer's Guide chapter "Floating-Point Support" for
- additional information.
-
-
- 3. Calling Convention
- ----------------------
-
- Specify calling-convention attribute _NO_1167 to allow allocation of
- variables to ABACUS scratch registers rather than to nonvolatile registers.
- _NO_1167 informs the compiler that a function (and any functions that it
- calls) does not modify the ABACUS register set.
-
- If a math function such as sin calls no other functions, the compiler
- allocates variables to ABACUS scratch registers rather than to nonvolatile
- registers if possible, thereby avoiding the save/restore at entry to/exit
- from sin. However, if sin calls another function P, the worst is assumed:
- that P modifies the ABACUS scratch registers; and therefore variables are
- not so allocated. The result is that sin has to save and restore the
- nonvolatile registers.
-
- However, if you use _NO_1167 to indicate that P does not affect the ABACUS
- registers, the compiler can use ABACUS scratch registers. Or, if P is an
- error handler that never returns, the effect on sin is the same: it can
- assume the scratch registers are saved across the call to P.
-
- You can use this if a function calls a library error routine that reports
- or records an error, and either does not use the ABACUS or never returns.
- For instance, sqrt and asin both call fprintf. Informing the compiler that
- fprintf does not touch the ABACUS improves execution speed. For example,
- modifying stdio.h to surround the declaration of fprintf with the following
- lines achieves this effect:
-
- pragma Calling_convention(_DEFAULT_CALLING_CONVENTION | _NO_1167);
- ...
- pragma Calling_convention();
-
- See the Programmer's Guide chapter Interfacing to Other Languages for more
- information about calling conventions.
-
-
- 4. 386|DOS-Extender
- --------------------
-
- To use the compiler with Phar Lap's 386|DOS-Extender, be sure you have a
- version of 386|DOS-Extender that detects the 1167. The MetaWare Run-Time
- Libraries automatically intialize the chip. Phar Lap has implemented this
- since Version 1.1u (Fall 1987).
-
-
- 5. Linking
- -----------
-
- If you do not use the driver to invoke the compiler, you must link your High C
- programs with all of the following:
-
- - the Weitek-supplied run-time library (hcwp.lib)
- - the standard High C run-time emulator library (hce.lib)
- - the non-ANSI functions library (na.lib).
-
- For example:
-
- 386link fbench -lib hcwp hce na
-
-
- 6. stdio.h
- -----------
-
- Header file stdio.h contains code conditioned on #ifdef __1167. If you
- use driver command-line option -f3167 or -f1167, __1167 is automatically
- defined. If you do not use these options, you must provide a definition
- for __1167 A modified version of stdio.h called wstdio.h is included for
- this purpose in the Weitek subdirectory of the High C distribution. This
- header file contains:
-
- #define __1167 1
-
- and then:
-
- #include <stdio.h>
-
- You can use wstdio.h, or just define __1167 and then include stdio.h.
-
-
- 7. Libraries
- -------------
-
- The High C run-time math libraries for transcendentals are included in your
- High C distribution. If you use header file math.h, you should include these
- libraries in your link before the standard High C libraries. The libraries
- are provided for Phar Lap's environment.
-
- These transcendentals were supplied to MetaWare by Weitek under license. AS
- OF THIS WRITING, printf and scanf have not been modified to use the 1167; they
- are awaiting further work.
-
-
- 8. Library Name Space
- -----------------------------
-
- Weitek uses names in the transcendental library that are not in the ANSI C
- Standard. Do not use these names if you want to avoid the transcendental
- routines:
-
- _cabs asin fmod rcosh rsqrt_tb2
- _ccos atan log rcot rsqrt
- _cexp atan2 log10 rem rtan
- _clog carg_err pow rexp rtanh
- _csin ceil racos rfmod sin
- _csqrt cos rarg1_err rlog sinh
- _hypot cosh rarg1p_err rlog10 sqrt_tb
- _mwWTKCPR cot rarg2_err rrem sqrt_tb1
- acos cotan_ rarg2p_err rsin sqrt_tb2
- arg1_err dcotan_ rasin rsincosh_tb sqrt_tb3
- arg1p_err exp ratan rsinh sqrt
- arg2_err exp_tb ratan2 rsqrt_tb tan
- arg2p_err floor rcos rsqrt_tb1 tanh
- math_err_control
-
- The following functions should not be called directly; these are library
- functions that return a floating-point type:
-
- atof
- difftime
- strtod
-
- There is a way around this. In general, if you would ordinarily use a non-
- Weitek-supported library function F as follows:
-
- extern double F();
- ...
- double answer = F();
-
- instead, write:
-
- extern void F_();
- ...
- double answer;
- F_(&answer);
-
- where you compile separately, with the 3167/1167 toggles Off, the following
- code:
-
- extern double F();
- void F_(double *result) { *result = F(); }
-
-
- 9. Math Errors
- ---------------
-
- You can trap math errors in the Weitek library by modifying matherr.c; source
- is included. matherr.c is in the Weitek libraries; if you provide your own,
- you override the library version.
-
-
- 10. Problems
- ------------
-
- If you think you have discovered a Weitek support problem, send a problem
- report to MetaWare Customer Service. If possible, please send a test case
- that demonstrates the problem.
-
- All problem reports must include your serial number and specify which version
- of the compiler you are using. If your sample code exceeds 15 lines, please
- send it by diskette to the address below, or by E-mail to:
-
- uunet!acad!metaware!tech
- -or-
- Internet tech@metaware.com
- -or-
- INTERNET:tech@metaware.com
-
- MetaWare Customer Service can be reached at (408) 429-6111, 8:00 am to 4:30 pm
- Monday through Friday.
-
-
- MetaWare Incorporated
- 2161 Delaware Avenue
- Santa Cruz, CA 95060-5706
- (408)429-6382 FAX:(408)429-9273
-