home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / forth / 3082 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  2.1 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!gatech!pitt!willett!ForthNet
  2. From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie)
  3. Newsgroups: comp.lang.forth
  4. Subject: Data types
  5. Message-ID: <4041.UUL1.3#5129@willett.pgh.pa.us>
  6. Date: 4 Sep 92 11:20:52 GMT
  7. Organization: EIEI-U
  8. Lines: 40
  9.  
  10. Category 10,  Topic 29
  11. Message 17        Fri Sep 04, 1992
  12. B.DUNN5 [Brian]              at 02:19 EDT
  13.  
  14.   I would like to make a portable structure/array package.  In order to hide
  15. the names of the fields of a structure, a structure definition would declare a
  16. vocabulary and place the field names inside that. Instances of that structure
  17. would have to activate that vocabulary at compile time, and pointers could be
  18. type cast by explicitly naming that vocabulary in the source code to cause the
  19. field names to become visible.
  20.  
  21. If a structure is a field inside another structure, the source could be:
  22.   ( ... define some fields ... )
  23.   name1  structure:  name2   \ name1 is previous struct, name2 is fieldname
  24.   ( ... define more fields ... )
  25.  
  26. When the structure NAME1 was previously defined, its final size was stored
  27. somewhere in the data area for NAME1.  On a typical Forth-83 system this might
  28. be just after the threads and voc-link in the vocabulary which is called
  29. NAME1.  Thus, NAME1 would be an immediate vocabulary with one extra cell of
  30. information in its data area.
  31.  
  32. At compile time, NAME1 would cause the vocabulary associated with its
  33. structure to become active.  STRUCTURE: would have to look at the context
  34. vocabulary and compute from that the location where NAME1 stored its final
  35. length, so that STRUCTURE: knows how large the field NAME2 must be.
  36.  
  37. With ANS-Forth:
  38.  
  39. 1) Is there a portable way to create the functionality where NAME1 activates a
  40. wordlist and also has a known location to store its length?
  41.  
  42. 2) Can other words take the top wordlist and compute (portably) where the
  43. length is stored?
  44.  
  45. -----
  46. This message came from GEnie via willett.  You *cannot* reply to the author
  47. using e-mail.  Please post a follow-up article, or use any instructions
  48. the author may have included (USMail addresses, telephone #, etc.).
  49. Report problems to: dwp@willett.pgh.pa.us
  50.