[comp.sys.mac] LSC math libraries

wewallace@watcgl.waterloo.edu (Bill Wallace) (08/04/88)

I've been playing around with LSC 3.0 specifically with the math
libraries.  Could someone tell me if everyone received math libraries that
contain none of the routines declared in math.h, only the same routines
but with an underscore prepended?  I recompiled with math881.c and things
work find but whats up?

Also if THINK is listening then here are some suggestions for the next
version:
  1) allow #defines to be set up as options the way unix cc -D macro=text
     works (only in a mac-like framework)
  2) allow both proto.h and math.h to be included.  This currently gives
errors for some reason.
  3) have the global searching done on ANY files, not only on those in the
current project.
  4) have a small default project so a single source file can be compiled
without having to make a project especially for it.
  5) allow an explicit search path for header files.  I have some large
     projects that are included in a number of other projects and it would
     be convenient to allow the header files for them to be kept with the
     project rather than where it can be currently found by the search
     strategy
  6) If unusual #defines are used then make them start with and underscore
     or somehow differentiate them.  I've found things like ABS to be a
     #define in some things and it interferes when porting large projects
     from unix or PC's.  (And yes, I LIKE PCs and MS-DOS)


Standard disclaimers apply.

singer@endor.harvard.edu (Rich Siegel) (08/05/88)

In article <5415@watcgl.waterloo.edu> wewallace@watcgl.waterloo.edu (Bill Wallace) writes:
>I've been playing around with LSC 3.0 specifically with the math
>libraries.  Could someone tell me if everyone received math libraries that
>contain none of the routines declared in math.h, only the same routines
>but with an underscore prepended?  I recompiled with math881.c and things
>work find but whats up?

	You should not add the actual library sources to your project; instead
you should change the _ERRORCHECK_ #define in the library's "config.h" file
(you did read the library notes, right?)), recompile the library, and then
do a Use Disk in your own project to load up the changes.

	It works like this:

	the functions beginning with an underscore ( _exp(), for example)
do not do any error checking. If _ERRORCHECK_ is undefined in the math
library's config.h file, then <math.h> defines the "real" functions
( exp() in this example) as macros that call the corresponding underscore
functions. This means that if there's not error checking, the calls
in Math881 go directly to the FPCP.

	If _ERRORCHECK_ is true (the default case in "Math"and "MathHybrid")
the function calls are error-checking wrappers that perform domain checking
on the arguments where appropriate, and before they return, call range
checking on the results, and if necessary, sets "errno".

By default, there's no error checking in "Math881", and error checking
is turned on in "Math" and "MathHybrid".

>Also if THINK is listening then here are some suggestions for the next
>version:
>  2) allow both proto.h and math.h to be included.  This currently gives
>errors for some reason.

	The math library routines are already protoyped in <math.h>; the
prototypes were not removed from <proto.h>, however. In the future, <proto.h>
will go away, and the prototypes for alibrary routines will be in that 
library's header file.

>  4) have a small default project so a single source file can be compiled
>without having to make a project especially for it.

	You can easily do this yourself - I have a project called "scratch",
and I use it whenever I want to run a quickie test program, or build a
one-file library.

>  5) allow an explicit search path for header files.  I have some large
>     projects that are included in a number of other projects and it would
>     be convenient to allow the header files for them to be kept with the
>     project rather than where it can be currently found by the search
>     strategy

	There's no way to specify a search path, but you can specify 
include files by absolute path name, for example:
	
#include "MyDisk:SubDir1:SubDir2:ProjDir:Header.h"

		--Rich




Rich Siegel
Quality Assurance Technician
THINK Technologies Division, Symantec Corp.
Internet: singer@endor.harvard.edu
UUCP: ..harvard!endor!singer
Phone: (617) 275-4800 x305