home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Games / flying-6.11 / stdinc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-30  |  5.1 KB  |  202 lines

  1. #ifndef _stdinc_h
  2. #define _stdinc_h
  3.  
  4. #define    USE_EXTERNAL_STANDARD_INCLUDES
  5. #define    _USE_OWN_STANDARD_INCLUDES
  6.  
  7.  
  8. #ifdef USE_EXTERNAL_STANDARD_INCLUDES
  9. // ===========================================================================
  10. //
  11. // The main include-files are included here and therfore in every other file.
  12. //
  13. // ===========================================================================
  14. #include <stdlib.h>
  15. #include <stdio.h>
  16. #include <math.h>
  17. #ifndef M_PI_2
  18. #  define M_PI_2  (M_PI/2.0)
  19. #endif
  20. #ifndef __TURBOC__
  21. #    include <X11/Xos.h>
  22. #else
  23. #    include <string.h>
  24. #    include <time.h>
  25. #endif
  26. #include <ctype.h>
  27.  
  28. #endif
  29.  
  30.  
  31. #ifdef USE_OWN_STANDARD_INCLUDES
  32. // ===========================================================================
  33. //
  34. // just for information, the library functions and their usage is
  35. // stated below. Actually it was meant to use these lines instead of
  36. // the actual includes on very slow machines, but this is very
  37. // unportable, therefor it is not advised to use this switch
  38. //
  39. // ===========================================================================
  40.  
  41. #    ifndef  _TIME_T
  42. #        define _TIME_T
  43.         typedef long time_t;
  44. #    endif
  45. #    ifndef _SIZE_T
  46. #        define _SIZE_T
  47.         typedef unsigned int size_t;
  48. #    endif
  49.  
  50. # ifndef _STRUCT_TIMEVAL
  51. #  define _STRUCT_TIMEVAL
  52.    /* Structure returned by gettimeofday(2) system call and others */
  53.      struct timeval {
  54.       unsigned long    tv_sec;        /* seconds */
  55.       long        tv_usec;    /* and microseconds */
  56.      };
  57. # endif /* _STRUCT_TIMEVAL */
  58.  
  59.    struct timezone {
  60.     int    tz_minuteswest;    /* minutes west of Greenwich */
  61.     int    tz_dsttime;    /* type of dst correction */
  62.    };
  63.  
  64. extern "C" {
  65.  
  66. // -----------
  67. // from math.h
  68. // -----------
  69. // acos        : vec3.C
  70. // atan        : vec2.C vec3.C
  71. // cos         : vec2.C vec3.C
  72. // fabs        : hockey.C keeper.C matrix.C
  73. // sin         : vec2.C vec3.C
  74. // sqrt        : vec2.h vec3.h vector.h
  75. // fmod        : real.C
  76.     double acos(double x);
  77.     double atan(double x);
  78.     double cos(double x);
  79.     double fabs(double x);
  80.     double sin(double x);
  81.     double sqrt(double x);
  82.     double fmod(double x, double y);
  83. #  define M_PI_2  1.57079632679489661923
  84.  
  85. // -------------
  86. // from stdlib.h
  87. // -------------
  88. // atof        : global.C main.C
  89. // atoi        : main.C
  90. // exit        : [ball.C] main.C xgraph.C xmover.C xpball.C
  91. // rand        : ball.C main.C xgraph.C
  92. // srand       : main.C
  93.     double atof(const char *str);
  94.     int atoi(const char *str);
  95.     void exit(int status);
  96.     int rand(void);
  97.     void srand(unsigned int seed);
  98.  
  99. // -----------
  100. // from time.h
  101. // -----------
  102. // difftime    : logfile.C
  103. // gettimeofday: xgraph.C
  104. // time        : logfile.C
  105.     double difftime(time_t time1, time_t time0);
  106.     int gettimeofday(
  107.         struct timeval *tp,
  108.         struct timezone *tzp
  109.     );
  110.     time_t time(time_t *tloc);
  111.  
  112. // ------------
  113. // from stdio.h
  114. // ------------
  115. // fclose      : global.C rgb.C
  116. // fflush      : xmover.C
  117. // fgets       : global.C logfile.C rgb.C
  118. // fopen       : global.C logfile.C rgb.C
  119. // fprintf     : graph.C matrix.C rgb.C vector.C xpball.C
  120. // fread       : xmover.C
  121. // fwrite      : xmover.C
  122. // printf      : arcs.C ball.C [carrom.C] [curling.C] [dynobj.C] game.C
  123. //               global.C goal.C [graph.C] [hockey.C] main.C matrix.C object.C
  124. //               [pball.C] pcon.C pocket.C vector.C wall.C xmover.C
  125. // putchar     : matrix.C vector.C
  126. // rename      : logfile.C
  127. // sprintf     : [game.C] global.C main.C pball.C
  128. // sscanf      : rgb.C
  129.    typedef struct {
  130.     int         __cnt;
  131.     unsigned char    *__ptr;
  132.     unsigned char    *__base;
  133.     unsigned short     __flag;
  134.     unsigned char      __fileL;        /* low byte of file desc */
  135.     unsigned char      __fileH;        /* high byte of file desc */
  136.    } FILE;
  137.     extern FILE __iob[];
  138. #  define   stdout   (&__iob[1])
  139. #  define   stderr   (&__iob[2])
  140.  
  141.     int fclose(FILE *stream);
  142.     int fflush(FILE *stream);
  143.     char *fgets(char *s, int n, FILE *stream);
  144.     FILE *fopen(const char *pathname, const char *type);
  145.     int fprintf(FILE *stream, const char *format, /* [arg,] */ ...);
  146.     size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
  147.     size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
  148.     int printf(const char *format, /* [arg,] */ ...);
  149.     int putchar(int c);
  150.     int rename(const char *source, const char *target);
  151.     int sprintf(char *s, const char *format, /* [arg,] */ ...);
  152.     int sscanf(const char *s, const char *format, /* [pointer,] */ ...);
  153.  
  154.  
  155. // ------------
  156. // from ctype.h
  157. // ------------
  158. // isspace     : global.C
  159. // isupper     : xgraph.C
  160. // tolower     : xgraph.C
  161.     int isspace(int c);
  162.     int isupper(int c);
  163.     int tolower(int c);
  164.  
  165.  
  166.  
  167. // -------------
  168. // from string.h
  169. // -------------
  170. // memset      : xmover.C
  171. // strcmp      : [global.C] graph.C logfile.C main.C rgb.C
  172. // strlen      : global.C logfile.C rgb.C xgraph.C
  173. // strncmp     : rgb.C
  174. // strstr      : global.C
  175.     void *memset(void *s, int c, size_t n);
  176.     int strcmp(const char *s1, const char *s2);
  177.     size_t strlen(const char *s);
  178.     int strncmp(const char *s1, const char *s2, size_t n);
  179.     char *strstr(const char *s1, const char *s2);
  180.  
  181. // ------------
  182. // from errno.h
  183. // ------------
  184. // perror      : logfile.C
  185. //
  186. // local included
  187.  
  188. // -------------
  189. // from stdarg.h
  190. // -------------
  191. // va_end      : matrix.C vector.C
  192. // va_start    : matrix.C vector.C
  193. //
  194. // local included
  195.  
  196. };
  197.  
  198. #endif
  199.  
  200.  
  201. #endif
  202.