home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / irit / drawfuns.arc / PROGRAM.H < prev    next >
Text File  |  1989-09-10  |  3KB  |  87 lines

  1. /*****************************************************************************
  2. *   definitions for program to draw a function given as Y = f(X) or          *
  3. * X = f(t), Y = f(t) .                                                       *
  4. *                                                                            *
  5. *   Written be :  Gershon Elber                          Ver 0.1, Mar. 1988  *
  6. *****************************************************************************/
  7.  
  8. #ifndef DRAW_FUNC_H
  9. #define DRAW_FUNC_H
  10.  
  11. #include "Expr2Trg.h"
  12.  
  13. #ifndef    NULL
  14. #define    NULL    0
  15. #endif
  16.  
  17. #ifndef    TRUE
  18. #define    TRUE    -1
  19. #define    FALSE    0
  20. #endif
  21.  
  22. #define ABS(y)        ((y) > 0 ? (y) : (-(y)))
  23. #define SQR(y)        ((y) * (y))
  24. #define SGN(x)        ((x) > 0 ? 1 : ((x) == 0 ? 0 : -1))
  25. #define MIN(x, y)    ((x) > (y) ? (y) : (x))
  26. #define MAX(x, y)    ((x) > (y) ? (x) : (y))
  27. #define BOUND(x, Min, Max) (MIN(MAX((x), (Min)), (Max)))
  28.  
  29. #define INFINITY    1e6
  30. #define EPSILON        1e-6
  31.  
  32. #define DEG2RAD(Deg)    ((Deg) * M_PI / 180.0)
  33. #define RAD2DEG(Rad)    ((Rad) * 180.0 / M_PI)
  34.  
  35. #define BSPACE    8
  36. #define TAB    9
  37. #define LF    10
  38. #define CR    13
  39. #define ESC    27
  40.  
  41. #define XY_FUNC_T    1           /* Input Kind is X = F(T) ,  Y = F(T) */
  42. #define Y_FUNC_X    2               /* Input Kind is Y = F(X) */
  43.  
  44. #define LINE_LEN    80                  /* Maximum line length */
  45. #define LINE_LEN_LONG 1024 /* Used to save derivatives (might be loonnngggg) */
  46. #define FILE_NAME_LEN    80
  47.  
  48. #define ERROR_COLOR    RED              /* Color of error messages */
  49. #define READ_COLOR    CYAN              /* Color from requesting input */
  50.  
  51. #define AXES_COLOR    BLUE
  52.  
  53. #define FUNC_COLOR    MAGENTA                /* Color of function */
  54. #define FUNC_DER1    RED            /* Color of first derivative */
  55. #define FUNC_DER2    GREEN               /* Color of second derivative */
  56. #define FUNC_DER3    YELLOW            /* Color of third derivative */
  57.  
  58. #define FUNC_POS_X    -0.6              /* Function as string position */
  59. #define FUNC_POS_Y    -0.1
  60. #define FUNC_DIF_Y    0.12             /* Difference between two lines */
  61.  
  62. #define MAIN_SCALE    1.9        /* Should be 2 but for the safety... */
  63.  
  64. extern int MouseExists,   /* Set according to autotest and config enforcment */
  65.        GraphDriver;                            /* " */
  66.  
  67. /* Global prototypes of DrawFunc.c module: */
  68. void RedrawScreen(ExprNode *PFuncX[], ExprNode *PFuncY[],
  69.     char SFuncX[][LINE_LEN_LONG], char SFuncY[][LINE_LEN_LONG],
  70.     double *Xmin, double *Xmax, double *Ymax,
  71.     double Tmin, double Tmax, int InputKind);
  72. void PrintMathError(void);
  73. void MyExit(int ExitCode);
  74.  
  75. /* Global prototypes of GetFunc.c module: */
  76. void DoGetFunc(ExprNode **PFuncX, ExprNode **PFuncY,
  77.     char SFuncX[][LINE_LEN_LONG], char SFuncY[][LINE_LEN_LONG],
  78.     int *InputKind,
  79.     double *Xmin, double *Xmax, double *Ymax, double *Tmin, double *Tmax);
  80. void GetLine(char *Header, char *s);
  81.  
  82. /* Global prototypes of SetScale.c module: */
  83. void DoSetScale(double *Xmin, double *Xmax, double *Ymax, int *NumOfSamples,
  84.     int *AutoScaleFlag, double *DomainMin, double *DomainMax);
  85.  
  86. #endif  DRAW_FUNC_H
  87.