home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
3
/
3001
/
jarg2get.icn
< prev
next >
Wrap
Text File
|
1991-03-06
|
2KB
|
61 lines
############################################################################
#
# 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 := 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 |
match("Hacker Folklore", line)
then exit(0)
maybe := 1; write()
}
else {
line ? {
if \maybe &
KEY :=
trim(map(tab(any(&letters)) || tab(find(": ")),no,yes))
then {
if not member(key_set, KEY)
then write("::", KEY)
insert(key_set, KEY)
}
write(line)
}
maybe := &null
blank_count := 0
}
}
stop("jarg2get: aborting (are you sure you have the correct file?)")
end