home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / EFFO / pd6.lzh / LIB / TILE / enumerates.f83 < prev    next >
Text File  |  1989-12-21  |  2KB  |  63 lines

  1. \
  2. \  ENUMERATE VARIABLES
  3. \
  4. \  Copyright (c) 1989 by Mikael R.K. Patel
  5. \
  6. \  Computer Aided Design Laboratory (CADLAB)
  7. \  Department of Computer and Information Science
  8. \  Linkoping University
  9. \  S-581 83 LINKOPING
  10. \  SWEDEN
  11. \
  12. \  Email: mip@ida.liu.se
  13. \
  14. \  Started on: 30 June 1988
  15. \
  16. \  Last updated on: 24 November 1989
  17. \
  18. \  Dependencies:
  19. \       (forth) none
  20. \
  21. \  Description:
  22. \       Forth level definition of enumerate types and variables.
  23. \
  24. \  Copying:
  25. \       This program is free software; you can redistribute it and\or modify
  26. \       it under the terms of the GNU General Public License as published by
  27. \       the Free Software Foundation; either version 1, or (at your option)
  28. \       any later version.
  29. \
  30. \       This program is distributed in the hope that it will be useful,
  31. \       but WITHOUT ANY WARRANTY; without even the implied warranty of
  32. \       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  33. \       GNU General Public License for more details.
  34. \
  35. \       You should have received a copy of the GNU General Public License
  36. \       along with this program; see the file COPYING.  If not, write to
  37. \       the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  38.  
  39. .( Loading Enumeration definitions...) cr
  40.  
  41. vocabulary enumerates
  42.  
  43. enumerates definitions 
  44.  
  45. : enum.type ( -- id0)  
  46.   create 0                             ( Create symbol and start definition)
  47.   does> drop variable ;                        ( Create variable for enumerate type)
  48.  
  49. : enum.null ( id1 -- id2)
  50.   1+ ;                                 ( Advance to next identity)
  51.  
  52. : enum ( id1 -- id2)  
  53.   dup constant enum.null ;             ( Create an item and advance ident.)
  54.  
  55. : >enum ( value -- )
  56.   constant ;                           ( Create an item using value given)
  57.  
  58. : enum.end ( id3 -- )  
  59.   drop ;                               ( Drop identity value)
  60.  
  61. forth only
  62.  
  63.