home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 344_02 / vernmath.h < prev    next >
Text File  |  1990-05-20  |  3KB  |  82 lines

  1. /*
  2. HEADER:         ;
  3. TITLE:          Vern's Math Header;
  4. VERSION:        1.0;
  5.  
  6. DESCRIPTION:    header to include for using vern's math routines, these
  7.                 routines help in interpreting BASIC data files storing
  8.                 packed double, single and integer precision numbers.
  9.                 Also some rounding functions and a function to print
  10.                 at tabs.
  11.  
  12.                 PLEASE NOT: two macros in this header file give the
  13.                 BASIC integer precision cvd() and mki() functions.
  14.                 This packs and unpacks an integer in a string of
  15.                 2 chars in length
  16.  
  17. KEYWORDS:       double precision, single precision, BASIC data files
  18.                 print at tab,integer presicion,strings;
  19. SYSTEM:         Xenix 3.4b, MSDOS;
  20. FILENAME:       vmath.h;
  21. WARNINGS:       compile with -dNO_PROTOTYPE if your system does not
  22.                 support prototyping, with -dFOR_MSDOS if you are compiling
  23.                 for MSDOS with an ANSI standard compiler.
  24.                 Defaults assume compiling with prototypes for
  25.                 Xenix 3.4b on Altos 2086 computer.
  26.  
  27. SEE-ALSO:       ncvd.c, ncvs.c, vmkd.c, vmks.c, print_tab.c;
  28. AUTHORS:        Vern Martin, 449 W. Harrison, Alliance, Ohio 44601;
  29. COMPILERS:      ECOSOFT ECO-C88, XENIX 3.4B STANDARD COMPILER;
  30. */
  31.  
  32. #include <stdio.h>
  33.  
  34. #define MKD_LEN     8       /* length of double precision packed
  35.                             variable created by nmkd() */
  36. #define MKS_LEN     4       /* single presicion: nmks() */
  37. #define MKI_LEN     2       /* integer precision: mki() */
  38.  
  39. #ifdef FOR_MSDOS
  40. #   include <math.h>
  41. #   include <string.h>
  42. #   define MAIN_TYPE int
  43. #else
  44. #   define MAIN_TYPE void
  45. #endif
  46.  
  47. #ifndef NO_PROTOTYPE
  48.  
  49.     double nrnd54(double,int),rndnick(double),ncvd(char *),ncvs(char *);
  50.  
  51.     int instr(int,char *,char *);
  52.  
  53.     char *mid(char *,int,int),*right(char *,int),*vmkd(double),*vmks(double);
  54.  
  55. #   ifdef FOR_MSDOS
  56.     int print_tab(FILE *,int,int,...);
  57. #   else
  58.     int print_tab(),strlen(char *);
  59.     double  fmod(double, double),frexp(double, int *),pow(double, double);
  60. #   endif
  61.  
  62. #else
  63.  
  64.     double nrnd54(),rndnick(),ncvd(),ncvs();
  65.  
  66.     int instr(),print_tab();
  67.  
  68.     char *mid(),*right(),*vmkd(),*vmks();
  69.  
  70. #ifndef FOR_MSDOS
  71.     double fmod(),frexp(),pow();
  72.     int strlen();
  73. #endif
  74.  
  75. #endif
  76.  
  77. /* cvi() -- unpack single precision number (mbasic) */
  78. #define cvi(str)    ((int)((unsigned char) str[0]))
  79.  
  80. /* mki() -- pack single precision number */
  81. #define mki(to,number) { to[0] = (char) number; to[1] = (char) '\0'; }
  82.