home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / hobby / tapemeas / tapemeas.EXE / string-constant < prev    next >
Encoding:
Text File  |  2000-07-07  |  842 b   |  36 lines

  1. \ string-constants
  2.  
  3. \ ----------
  4. \ String constant from Ron Doerfler's Expedition source
  5. needs file
  6. needs core-ext
  7.  
  8. \ Place is copied from toolkit so toolkit doesn't have to be included
  9. \ place a1 n1 as a counted string at a2
  10. : place1 ( a1 n1 a2 -- )
  11. 2dup 2>r char+ swap move 2r> c! ;
  12.  
  13. : null>end ( u c-addr -- )
  14. \ appends null -- must be allocated
  15. + char+ 0 swap c! ;
  16.  
  17. : sconstant ( buf-addr u <name> -- )
  18. \ limited to 255 characters. S" input
  19. \ buffer in file memo has limit of 80
  20. create dup here 2>r \ size & start
  21. here over 2 chars + allot \ allot RAM
  22. place1 \ buffer --> counted string
  23. 2r> null>end \ add null
  24. does> dup c@ swap char+ swap
  25. ( c-addr u ) ;
  26.  
  27. : s>zabs ( c-addr u -- &z-addr )
  28. \ Use only with string obtained
  29. \ from sconstant or svariable
  30. drop >abs ;
  31.  
  32. : s>abs ( c-addr len -- a-addr. len )
  33. >r >abs r> ;
  34.  
  35. \ -- end of sconstant
  36.