[comp.sys.amiga.tech] functions.h

jol@sei.cmu.edu (Jun Lee) (12/13/90)

Hi.

Can anyone tell me what is contained in <function.h?  I take it this is
a Aztec C thing and I was wondering what would be a comparable include
file on a Lattice 5.1.  

Thanks,
-- 
AMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIGAMIG
  J  @@		jol@sei.cmu.edu					    //	
  U  \/		(412) 268-7602		 	        	\\ //
  N  LEE  	SEI, Carnegie Mellon University	         	 \X/ 

jdp@caleb.UUCP (Jim Pritchett) (12/14/90)

In article <9871@fy.sei.cmu.edu> jol@sei.cmu.edu (Jun Lee) wrote:

> Can anyone tell me what is contained in <function.h?  I take it this is
> a Aztec C thing and I was wondering what would be a comparable include
> file on a Lattice 5.1.  

It contains the type definitions for the Amiga functions.  Using it properly
should eliminate many ptr->int type errors.  I don't know what Lattice
does for this.



--

                                                Jim Pritchett


UUCP:  texsun.central.sun.com!letni!rwsys!caleb!jdp
 or    letni.lonestar.org!dms3b1!caleb!jdp

markv@kuhub.cc.ukans.edu (12/15/90)

> It contains the type definitions for the Amiga functions.  Using it properly
> should eliminate many ptr->int type errors.  I don't know what Lattice
> does for this.

In Lattice the Amiga protos are in <proto/XXXX.h> where xxx is the
name of the library.  <proto/all.h> will include all libraries.  Note
that these files also have the #pragma's to generate in-line function
called.

>>Smart-ass remarks from Lattice users will be ignored.
>Agreed :^)

>Q#2:Did you guys even TRY compiling any 2.0-specific source? (Ok,maybe I won't
>ask that question.)

SAS 5.1 seems to compile what little 2.0 sources I've stuffed through
it, although I still suffer some minor problems with the 5.1 LMK
occasionally wanting a return to execute.  But overall, its pretty
stable :-).

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Gooderum                 /\     \ | /     H a p p y  
Academic Computing Services  / v\   -- * --         H o l i d a y s ! :-)
University of Kansas        /v  v\   / | \    ///
                           /__v___\   Only  ///  /|         __    _  
Bitnet:   MARKV@UKANVAX       ||     \\\  ///  /__| |\/| | | _   /_\  makes it
Internet: markv@kuhub.cc.ukans.edu     \/\/  /    | |  | | |__| /   \ possible
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

hclausen@adspdk.UUCP (Henrik Clausen) (12/15/90)

In article <1951.AA1951@caleb>, Jim Pritchett writes:

> 
> In article <9871@fy.sei.cmu.edu> jol@sei.cmu.edu (Jun Lee) wrote:
> 
> > Can anyone tell me what is contained in <function.h?  I take it this is
> > a Aztec C thing and I was wondering what would be a comparable include
> > file on a Lattice 5.1.  
> 
> It contains the type definitions for the Amiga functions.  Using it properly
> should eliminate many ptr->int type errors.  I don't know what Lattice
> does for this.

   The Prototype files that come with Lattice are the equivalent. This is
great for catching incorrect parameter passings and such. Using prototypes
for your own functions (compiler generated) is very neat, I set the
compiler up to warn me about functions without proto's, and catch quite a
few bugs at compile time rather than at link or execute time.

   Use the pragma include files as well, that's quite a reduction in code
size. Precompiled headers is almost a must for that many header files.

                                         -Henrik

______________________________________________________________________________
| Henrik Clausen, Graffiti Data | If the Doors of Perception where cleansed, |
| ...{pyramid|rutgers}!cbmvax!  | Man would see Reality as it is - Infinite. |
\______cbmehq!adspdk!hclausen___|_________________________________W. Blake___/

bombadil@diku.dk (Kristian Nielsen) (12/17/90)

jol@sei.cmu.edu (Jun Lee) writes:

>Hi.

>Can anyone tell me what is contained in <function.h?  I take it this is
>a Aztec C thing and I was wondering what would be a comparable include
>file on a Lattice 5.1.  

The Lattice/SAS equivalent is <proto/all.h>. It contains function
definitions with type checking as provided in ANSI-C, and also saves you
some typecasts. A typical example of a source line from this include file
would be

   void *OpenLibrary(char *,ULONG);

or something similar. This tells the compiler that Openlibrary takes a
string and an unsigned long integer as arguments, and returns a generic
pointer (ie. struct IntuitionBase *, struct GfxBase * etc.). This way, it is
not nessesary to do an explicit typecast, as in IntuitionBase = (struct
IntuitionBase *)OpenLibrary(...). Also, should one forget the library
version number, as in GfxBase = OpenLibrary("graphics.library"), the
compiler will give you a warning (saves you some bug hunting!).
  As an added bonus, the Lattice include (I dunno about Aztec) also has
(optional) #pragma - definitions, enabling the compiler to make more
efficient system calls than is possible using the stubs in amiga.library.
BTW, at least with Lattice, you needn't include the definitions for ALL the
system calls, you can restrict you program to only include the parts of the
system that you are using, by specifying, for example 

   #include <proto/intuition.h>

Of course, if you don't mind about compile times, it is more comfortable
just to include the entire set.

	Kristian

-- 
==========================================================================
Kristian Nielsen                          |      ///   Only the AMIGA
Student at DIKU, University of Copenhagen |     ///
(Department of Computer Science)          | \\\///     makes it possible!

martin@IRO.UMontreal.CA (Daniel Martin) (01/01/91)

In article <1990Dec17.144036.4219@diku.dk> bombadil@diku.dk (Kristian Nielsen) writes:
>jol@sei.cmu.edu (Jun Lee) writes:
>>Hi.
>>Can anyone tell me what is contained in <function.h?  I take it this is
>>a Aztec C thing and I was wondering what would be a comparable include
>>file on a Lattice 5.1.  
>
>The Lattice/SAS equivalent is <proto/all.h>. It contains function
>definitions with type checking as provided in ANSI-C, and also saves you
>some typecasts.
...
>  As an added bonus, the Lattice include (I dunno about Aztec) also has
>(optional) #pragma - definitions, enabling the compiler to make more
>efficient system calls than is possible using the stubs in amiga.library.

   <functions.h> is a general include file defining globals and return
values of functions for the Aztec Compiler.  With the 2.0 includes, the
functions.h contains among other things the clib/all_protos.h  and
pragma/all_lib.h wich are equivalent to Lattice proto/all.h and pragma
definitions.


>BTW, at least with Lattice, you needn't include the definitions for ALL the
>system calls, you can restrict you program to only include the parts of the
>system that you are using, by specifying, for example 
>   #include <proto/intuition.h>

   You can restrict includes with all versions (3.6 and up) of MANX Aztec C.
I wonder wich C compiler woudn't allow restrictions.

>Of course, if you don't mind about compile times, it is more comfortable
>just to include the entire set.

   Or you just make a big precompiled header file, put it in ram, and use
it when compiling.  Mines 300k, and the compile times are reasonnably fast
(EASILY under 30 sec. to compile AND link a 1000 lines source code, and
around 3.5 sec. to compile AND link an "Hello World" program, on a 
A3000/25MHz/10Meg RAM.).

>Kristian Nielsen
   Daniel.

Disclaimer: I'm only a satisfied user of MANX Aztec C compiler since 87.
            Now if only I could put my hand on a good C++...

--
    // Daniel Martin                            Universite de Montreal   \\
   //  MediaLab, ca vous regarde!               C.P. 6128, Succursale A,  \\
\\//   Mail: martin@IRO.UMontreal.CA            Montreal (Quebec), CANADA, \\//
 \/    Tel.: (514) 343-6111 poste 3494          H3C 3J7                     \/