home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / Watcher / build_maxmin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-02  |  583 b   |  29 lines

  1. /*
  2.    build_maxmin: build a max/min format for the parser.
  3.  
  4.    Kenneth Ingham
  5.  
  6.    Cpyright (C) 1988 The Univversity of New Mexico
  7. */
  8.  
  9. #include "defs.h"
  10. #include "y.tab.h"
  11.  
  12. struct change_fmt_st *
  13. build_maxmin(string, min, max)
  14. struct number *max, *min;
  15. char *string;
  16. {
  17.     struct change_fmt_st *p;
  18.  
  19.     p = allocate(struct change_fmt_st);
  20.     p->name = string;
  21.     p->fmt.fmt.max_min.max = max->type == INTEGER ?
  22.         (double)max->value.integer : max->value.real;
  23.     p->fmt.fmt.max_min.min = min->type == INTEGER ?
  24.         (double)min->value.integer : min->value.real;
  25.     p->fmt.type = MAX_MIN;
  26.  
  27.     return p;
  28. }
  29.