home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / libtool_463.lzh / LibTool / JimsExample / awlib_app.c < prev    next >
C/C++ Source or Header  |  1991-03-09  |  2KB  |  59 lines

  1. /****************************************************************************
  2.     This is an example application to test the C "simple.library". Make the
  3.     glue code with LibTool (-c option). (This can be made when the library is
  4.     made by using the LibTool option -cmho).
  5.  
  6. Manx 5.0d
  7.  
  8. cc -mcd -ff AWlib_App.c                        ;large code and data
  9. LibTool -cho glue.asm AWlib.fd        ;C function code, create header file
  10. as -cd glue.asm                            ;large code and data
  11. ln AWlib_App.o glue.o -lmfl -lcl        ;large, 32 bit lib
  12.  
  13. ****************************************************************************/
  14.  
  15. #include "exec/types.h"
  16. #include "math.h"
  17. #include "awlib.h"
  18.  
  19. ULONG  argcount;  /* Saves argc from main(). if argcount==0, then run from WB. */
  20.  
  21. VOID exit_program( error_words, error_code )    /* All exits through here. */
  22. char  error_words;
  23. ULONG error_code;
  24. {
  25.     if( argcount && error_words ) puts( error_words );
  26.     CloseAWBase();    /* This is always safe to call */
  27.     exit( error_code );
  28. }
  29.  
  30.  
  31. /************************ MAIN ROUTINE *****************************/
  32.  
  33. VOID main(argc, argv)
  34. LONG argc;
  35. char **argv;
  36. {
  37.     double result;
  38.  
  39.     argcount = argc;
  40.  
  41.     /* open AW.library */
  42.     if( !(OpenAWBase()) )
  43.         exit_program("Can't open AW library.\n", 10L);
  44.  
  45.     result = Mag( 10.0, 20.0 );
  46.     printf("Magnitude of 10 + j20 = %lf\n", result );
  47.  
  48.     result = Ang( 10.0, 20.0 );
  49.     printf("Angle of 10 + j20 = %lf\n", result );
  50.  
  51.     result = Real( 10.0, 60.0 );
  52.     printf("Real component of 10 at 60 degrees = %lf\n", result );
  53.  
  54.     result = Imaj( 10.0, 60.0 );
  55.     printf("Imaginary component of 10 at 60 degrees = %lf\n", result );
  56.  
  57.     exit_program(0L,0L);
  58. }
  59.