home *** CD-ROM | disk | FTP | other *** search
- ############################################################################
- #
- # File: adjuncts.icn
- #
- # Subject: Procedures for gettext and idxtext support
- #
- # Author: Richard L. Goerwitz
- #
- # Date: July 9, 1991
- #
- ###########################################################################
- #
- # Version: 1.3
- #
- ###########################################################################
- #
- # Pretty mundane stuff. Basename(), Pathname(), Strip(), and a utility
- # for creating index filenames.
- #
- ############################################################################
- #
- # See also: gettext.icn, idxtext,icn
- #
- ############################################################################
-
-
- global _slash, _baselen
-
- procedure Basename(s)
-
- # global _slash
- s ? {
- while tab(find(_slash)+1)
- return tab(0)
- }
-
- end
-
-
- procedure Pathname(s)
-
- local s2
- # global _slash
-
- s2 := ""
- s ? {
- while s2 ||:= tab(find(_slash)+1)
- return s2
- }
-
- end
-
-
- procedure getidxname(FNAME)
-
- #
- # Discard path component. Cut basename down to a small enough
- # size that the OS will be able to handle addition of the ex-
- # tension ".IDX"
- #
-
- # global _slash, _baselen
- return right(Strip(Basename(FNAME,_slash),'.'), _baselen, "x") || ".IDX"
-
- end
-
-
- procedure Strip(s,c)
-
- local s2
-
- s2 := ""
- s ? {
- while s2 ||:= tab(upto(c))
- do tab(many(c))
- s2 ||:= tab(0)
- }
- return s2
-
- end
-