home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / code / tcopuls_.sit / intlink.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-17  |  1001 b   |  60 lines  |  [TEXT/MPS ]

  1. /* -*- Emacs Mode: C++ -*- */
  2.  
  3. /*    intlink.c - IntLink Class - implementation
  4.  
  5.     Copyright (C) 1989, Integrity Software
  6.     Author: Isaac J. Salzman (salzman@rand.org)
  7.  
  8.     This software may be freely used/modified/distributed
  9.     as desired so long as this copyright notice remains
  10.     in tact.
  11. */
  12.  
  13. #ifndef lint
  14. static char *RcsId = "$Header: /tmp_mnt/amnt/lh/salzman/src/class/RCS/intlink.c,v 1.1 89/09/17 15:01:30 salzman Exp Locker: salzman $";
  15. #endif
  16.  
  17. /*
  18.  * $Log:    intlink.c,v $
  19.  * Revision 1.1  89/09/17  15:01:30  salzman
  20.  * Initial revision
  21.  * 
  22.  */
  23.  
  24. #include <stdio.h>
  25. #include <string.h>
  26. #include <ctype.h>
  27.  
  28. #include "intlink.h"
  29.  
  30. DEF_INIT(IntLink)(int i)
  31. {
  32.     ival = i;
  33.  
  34.     INIT_SUPER(Link,());
  35.     
  36.     RETURN_THIS;
  37. }
  38.  
  39. DEF_DEST(IntLink)(void)
  40. {
  41.     DESTROY_SUPER;
  42. }
  43.  
  44. void IntLink::showval(void)
  45. {
  46.     printf("integer = %d\n", ival);
  47. }
  48.  
  49. int IntLink::compare(char *item)
  50. {
  51.     int i;
  52.  
  53.     if (!isdigit (*item))
  54.         return -1;
  55.     
  56.     i = atoi(item);
  57.     
  58.     return (( i == ival) ? 0 : (( i < ival) ? -1 : 1));
  59. }
  60.