home *** CD-ROM | disk | FTP | other *** search
- ############################################################################
- #
- # Name: 1.1
- #
- # Title: jargon to gettext format converter
- #
- # Author: Richard L. Goerwitz
- #
- # Version: jarg2get.icn
- #
- ############################################################################
- #
- # Converts jargon.ascii (stdin) to a format suitable for use by gettext.
- # Writes to stdout. Jargon.ascii was posted recently (c. March 1, 1991)
- # to alt.sources.
- #
- ############################################################################
-
- procedure main()
-
- local line, KEY, key_set, no, yes, blank_count
-
- blank_count := 0
- key_set := set()
- no := &ucase || "-/"; yes := &lcase || " "
- # Isn't goal-directed evaluation nice?
- (match("= A =", !&input), "" == !&input)
-
- # Read stdin, looking for entries. Entries can be distinguished
- # a) by a preceding blank line, and b) by the presence of charac-
- # ters beginning immediately at the margin, and c) by the presence
- # of a colon plus a space on the line.
- while line := trim(read(), '\t \xFF\r') do {
-
- if "" == line then {
- if (blank_count +:= 1) > 2
- then exit(0)
- else write()
- }
- else {
- line ? {
- if match("Hacker Folklore"|"Appendix A: ")
- then exit(0)
- if blank_count > 0 &
- KEY :=
- trim(map(tab(any(&letters)) || tab(find(": ")),no,yes))
- then {
- if not member(key_set, KEY)
- then write("::", KEY)
- insert(key_set, KEY)
- }
- (="= ", tab(any(&ucase)), =" =", !&input) | write(line)
- }
- blank_count := 0
- }
- }
-
- stop("jarg2get: aborting (are you sure you have the correct file?)")
-
- end
-