home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / BIPL.ZIP / PROCS.ZIP / ADJUNCTS.ICN next >
Encoding:
Text File  |  1993-01-27  |  1.5 KB  |  81 lines

  1. ############################################################################
  2. #
  3. #    File:     adjuncts.icn
  4. #
  5. #    Subject:  Procedures for gettext and idxtext support
  6. #
  7. #    Author:   Richard L. Goerwitz
  8. #
  9. #    Date:     July 9, 1991
  10. #
  11. ###########################################################################
  12. #
  13. #    Version:  1.3
  14. #
  15. ###########################################################################
  16. #  
  17. #  Pretty mundane stuff.  Basename(), Pathname(), Strip(), and a utility
  18. #  for creating index filenames.
  19. #
  20. ############################################################################
  21. #
  22. #  See also: gettext.icn, idxtext,icn
  23. #
  24. ############################################################################
  25.  
  26.  
  27. global _slash, _baselen
  28.  
  29. procedure Basename(s)
  30.  
  31.     # global _slash
  32.     s ? {
  33.     while tab(find(_slash)+1)
  34.     return tab(0)
  35.     }
  36.  
  37. end
  38.  
  39.  
  40. procedure Pathname(s)
  41.  
  42.     local s2
  43.     # global _slash
  44.  
  45.     s2 := ""
  46.     s ? {
  47.     while s2 ||:= tab(find(_slash)+1)
  48.     return s2
  49.     }
  50.  
  51. end
  52.  
  53.  
  54. procedure getidxname(FNAME)
  55.  
  56.     #
  57.     # Discard path component.  Cut basename down to a small enough
  58.     # size that the OS will be able to handle addition of the ex-
  59.     # tension ".IDX"
  60.     #
  61.  
  62.     # global _slash, _baselen
  63.     return right(Strip(Basename(FNAME,_slash),'.'), _baselen, "x") || ".IDX"
  64.  
  65. end
  66.  
  67.  
  68. procedure Strip(s,c)
  69.  
  70.     local s2
  71.  
  72.     s2 := ""
  73.     s ? {
  74.     while s2 ||:= tab(upto(c))
  75.     do tab(many(c))
  76.     s2 ||:= tab(0)
  77.     }
  78.     return s2
  79.  
  80. end
  81.