From pa.dec.com!decwrl!uunet!sparky!kent Sun Aug 18 09:21:07 PDT 1991
Article: 2647 of comp.sources.misc
Newsgroups: comp.sources.misc
Path: pa.dec.com!decwrl!uunet!sparky!kent
From: Richard L. Goerwitz <goer@midway.uchicago.edu>
Subject:  v22i026:  bibleref - Word and passage retrievals from King James Bible, Patch01
Message-ID: <1991Aug17.184233.8825@sparky.IMD.Sterling.COM>
Followup-To: comp.sources.d
X-Md4-Signature: cb685b30e62adec0456b3c98e0ccf17c
Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield)
Organization: University of Chicago
Date: Sat, 17 Aug 1991 18:42:33 GMT
Approved: kent@sparky.imd.sterling.com
Lines: 753

Submitted-by: Richard L. Goerwitz <goer@midway.uchicago.edu>
Posting-number: Volume 22, Issue 26
Archive-name: bibleref/patch01
Environment: ICON, UNIX
Patch-To: bibleref: Volume 20, Issue 99-105

This is the only patch I will be posting for bibleref-1.0.  It essentially
creates a dead-end version.  2.0 is now available, and it creates a somewhat
smaller main data file.  Ftp it from cs.arizona.edu, directory icon/contrib.
The file is called bibleref.tar.Z, and includes a Huffman encoded KJV and
prebuilt data files.  Basically all you have to do is compile the main 
search program.  I'm not posting 2.0, simply because it takes so long to
install, and requires more familiarity with Icon than version 1.  By pre-
building the data and auxiliary files, and placing them - en masse - on
cs.arizona.edu, I'm minimizing the work needed to install bibleref.  If you
don't have internet access, and can't ftp the 2.0 version from cs.arizona.
edu, then this patch will remove a few bugs leftover in 1.0, leaving you
with a basic, functional version.

If anyone is feeling particularly adventurous, please let me know, and I
will mail 2.0 directly to you, without prebuilt data files.  I can do this
fairly automatically, so it's no problem.  Don't try building the whole
package, though, on a small (16 meg or less, < 5 MIPS) workstation.  It
just takes too long, and the indexing and collation process just uses up
too much memory.

-Richard

#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 08/13/1991 16:11 UTC by goer@sophist.uchicago.edu
# Source directory /u/richard/Bibleref/diffs
#
# existing files will NOT be overwritten unless -c is specified
# This format requires very little intelligence at unshar time.
# "if test", "echo", "true", and "sed" may be needed.
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#  24706 -r--r--r-- 1.0-1.1
#
# ============= 1.0-1.1 ==============
if test -f '1.0-1.1' -a X"$1" != X"-c"; then
	echo 'x - skipping 1.0-1.1 (File already exists)'
else
echo 'x - extracting 1.0-1.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > '1.0-1.1' &&
X*** bibleref-1.0/Makefile.dist	Sun Jul 14 14:07:58 1991
X--- bibleref-new/Makefile.dist	Wed Jul 17 03:10:13 1991
X***************
X*** 25,31 ****
X  # Name of your icon compiler and compiler flags.
X  #
X  ICONC = /usr/icon/v8/bin/icont
X! IFLAGS = -Sc 200 -Sg 400 -Si 2000 -Sn 3000 -SF 30
X  
X  #
X  # Names of KJV files as packaged in the PC-SIG disk set (19 discs).
X--- 25,31 ----
X  # Name of your icon compiler and compiler flags.
X  #
X  ICONC = /usr/icon/v8/bin/icont
X! IFLAGS = -Sc 400 -Sg 400 -Si 2000 -Sn 3000 -SF 30
X  
X  #
X  # Names of KJV files as packaged in the PC-SIG disk set (19 discs).
X***************
X*** 51,56 ****
X--- 51,67 ----
X  # RAWFILES = ./kjv.Z
X  
X  #
X+ # If, instead of the KJV, you have a CCAT RSV text, you can concatenate
X+ # all the books for that text into one "kjv.rtv" file.  When done doing
X+ # this, go to the "non-modifiable" section of this makefile, and change
X+ # the line reading "CONVERTER = kjv2rtv" to "CONVERTER = rsv2rtv".  I
X+ # personally have never tried doing this, and have no idea whether it
X+ # will work.  The converter, rsv2rtv, though is included in this dis-
X+ # tribution on a test basis.  If anyone tries to use it, please let me
X+ # know (for better or worse).
X+ #
X+ 
X+ #
X  # If you've compressed your KJV file(s), use zcat; otherwise use cat.
X  #
X  CAT = cat
X***************
X*** 65,76 ****
X  
X  ###########################################################################
X  #
X! #  Don't change anything below this line.
X  #
X  
X  RTVFILE = kjv.rtv
X  
X  CONVERTER = kjv2rtv
X  CONVERTSRC = $(CONVERTER).icn convertr.icn name2num.icn complete.icn
X  
X  INDEXER = makeind
X--- 76,89 ----
X  
X  ###########################################################################
X  #
X! #  Don't change anything below this line unless you are absolutely and
X! #  positively sure you know what you are doing.
X  #
X  
X  RTVFILE = kjv.rtv
X  
X  CONVERTER = kjv2rtv
X+ # CONVERTER = rsv2rtv
X  CONVERTSRC = $(CONVERTER).icn convertr.icn name2num.icn complete.icn
X  
X  INDEXER = makeind
X*** bibleref-1.0/README	Sun Jul 14 14:07:58 1991
X--- bibleref-new/README	Wed Jul 17 03:10:14 1991
X***************
X*** 71,77 ****
X  your login ID and default group ID).  Finally, check to be certain
X  that the correct names are used for your raw King James Bible file(s),
X  and that the target CAT is set to either "cat" or "zcat," depending on
X! whether you have compressed the raw files or not.
X  	Assuming you've modified the Makefile correctly, you can then
X  simply type "make."  After this, you might as well go off and have
X  dinner or something.  Better yet, go to bed.  The entire reformatting,
X--- 71,83 ----
X  your login ID and default group ID).  Finally, check to be certain
X  that the correct names are used for your raw King James Bible file(s),
X  and that the target CAT is set to either "cat" or "zcat," depending on
X! whether you have compressed the raw files or not.  Note that you need
X! not use all the KJV files.  Christians, for instance, will frequently
X! want to comment out the Old Testament books, while Jews will normally
X! want to do the reverse.  Bibleref doesn't care how many, or what KJV
X! books, there are.  It doesn't really even care about the order (though
X! for human readers' sake it's advisable to put them in some coherent,
X! canonical order).
X  	Assuming you've modified the Makefile correctly, you can then
X  simply type "make."  After this, you might as well go off and have
X  dinner or something.  Better yet, go to bed.  The entire reformatting,
X***************
X*** 256,269 ****
X  these utilities are *not* geared solely for the KJV.  In fact, they
X  are set up so that they can be used with just about any text broken up
X  into hierarchically arranged divisions.  If, for instance, you don't
X! like Renaissance English, and have a more modern Bible translation
X! online, you can certainly use that instead.  All you'll need to do is
X! copy the kjv2rtv.icn file to, say, kjv2rsv.icn, edit it to reflect the
X! text you are using, run it on your text, and then index it as you
X! would have done for the King James text.  You can tell Bibleref to use
X! this text instead of the King James text either by modifying
X! bibleref.icn to point to the new file, or by giving it a filename
X! argument, a la "bibleref -f your.indexed.bible.text."
X  	If you need help integrating a new biblical text into the
X  retrieve package, drop me a line.  If I'm not busy, and the job looks
X  to be one I can help you out with, I'll be glad to do so.  If nothing
X--- 262,277 ----
X  these utilities are *not* geared solely for the KJV.  In fact, they
X  are set up so that they can be used with just about any text broken up
X  into hierarchically arranged divisions.  If, for instance, you don't
X! like Renaissance English, and have the more modern RSV translation
X! online, you can certainly use that instead.  Actually, those of you
X! who possess CCAT RSV texts could do me the great favor of playing
X! guinea pig.  Read the makefile, do what it says with the CONVERTB
X! target, then make.  If you have already indexed some other files, then
X! you should clobber them (a la "make clobber"), and start over again.
X! If you manage to index the RSV, please let me know.  I haven't got the
X! disk space here to do it.  The whole procedure with RSV texts is
X! wholly untested, and I fully expect it to blow up on anyone who tries
X! it :-) 1/2.
X  	If you need help integrating a new biblical text into the
X  retrieve package, drop me a line.  If I'm not busy, and the job looks
X  to be one I can help you out with, I'll be glad to do so.  If nothing
X***************
X*** 275,293 ****
X  tested, or 3) that are likely to change.  For instance, the "d"
X  command can take a number argument, which causes it to display the
X  list whose position in the global list of lists corresponds to that
X! number).  The "!" command can also pass its arguments to the shell
X! (/bin/sh, or the value of your SHELL environment variable).  Also, if
X! you type "f lord god" at the main prompt, and press return, you'll get
X! a list of verses containing the words "lord" and "god" (i.e. Bibleref
X! will, in other words, perform a verse-based, range 0 "and" on the
X! respective hit lists for these two words).  While I don't want to hide
X! the existence of these marginal features, I don't want to encourage
X! anyone to expect their presence in later versions, or to suggest that
X! they will work properly in the current one.  I'm particularly worried
X! about the "f lord god" example above, as it might lead people to think
X! that Bibleref has a concept of word order within verses.  In fact,
X! this is just an alternate way of performing a set intersection on the
X! hit lists for "lord" and "god."
X  
X  
X  --------
X--- 283,301 ----
X  tested, or 3) that are likely to change.  For instance, the "d"
X  command can take a number argument, which causes it to display the
X  list whose position in the global list of lists corresponds to that
X! number).  On the top level, the "!" command can also pass arguments to
X! a shell (/bin/sh, or the value of your SHELL environment variable).
X! Also, if you type "f lord god" at the main prompt, and press return,
X! you'll get a list of verses containing the words "lord" and "god"
X! (i.e. Bibleref will, in other words, perform a verse-based, range 0
X! "and" on the respective hit lists for these two words).  While I don't
X! want to hide the existence of these marginal features, I don't want to
X! encourage anyone to expect their presence in later versions, or to
X! suggest that they will work properly in the current one.  I'm
X! particularly worried about the "f lord god" example above, as it might
X! lead people to think that Bibleref has a concept of word order within
X! verses.  In fact, this is just an alternate way of performing a set
X! intersection on the hit lists for "lord" and "god."
X  
X  
X  --------
X*** bibleref-1.0/README.rtv	Sun Jul 14 14:07:58 1991
X--- bibleref-new/README.rtv	Wed Jul 17 03:10:15 1991
X***************
X*** 167,188 ****
X  the King James Version (KJV).  How might you invoke makeind to
X  accomplish this?  First you would need to determine the maximum field
X  value for your text.  In the case of the Christian English Bible, this
X! is 176.  The English Bible (including Apocrypha) contains 73 books.
X! The Protestant KJV contains 66.  The maximum number of chapters in any
X! book is 150 (Psalms).  The maximum number of verses in any one chapter
X! in any one book is 176 (Psalm 119).  176 would therefore be the
X! maximum value any field would have to contain.  You would pass this
X! information to makeind via the -m option.  The total number of fields
X! is three, naturally (book, chapter, and verse).  This value would be
X! passed using the -n option.  As noted above, in order to use relative
X! locations you would need to tell makeind what field to record max
X! values for.  In our hypothesized scenario, you would want makeind to
X! store the max value for the verse field for every chapter of every
X! book in the Bible.  The verse field (field #3), in other words, is
X! your "rollover" field, and would be passed to makeind using the -l
X! option.  Assuming "kjv" to be the name of your indexable biblical
X! text, this set of circumstances would imply the following invocation
X! for makeind:
X  
X  	makeind -f kjv -m 176 -n 3 -l 3
X  
X--- 167,188 ----
X  the King James Version (KJV).  How might you invoke makeind to
X  accomplish this?  First you would need to determine the maximum field
X  value for your text.  In the case of the Christian English Bible, this
X! is 176.  The English Bible (including Apocrypha) contains 84 books (at
X! least in the RSV).  The Protestant KJV contains 66.  The maximum
X! number of chapters in any book is 150 (Psalms).  The maximum number of
X! verses in any one chapter in any one book is 176 (Psalm 119).  176
X! would therefore be the maximum value any field would have to contain.
X! You would pass this information to makeind via the -m option.  The
X! total number of fields is three, naturally (book, chapter, and verse).
X! This value would be passed using the -n option.  As noted above, in
X! order to use relative locations you would need to tell makeind what
X! field to record max values for.  In our hypothesized scenario, you
X! would want makeind to store the max value for the verse field for
X! every chapter of every book in the Bible.  The verse field (field #3),
X! in other words, is your "rollover" field, and would be passed to
X! makeind using the -l option.  Assuming "kjv" to be the name of your
X! indexable biblical text, this set of circumstances would imply the
X! following invocation for makeind:
X  
X  	makeind -f kjv -m 176 -n 3 -l 3
X  
X*** bibleref-1.0/bibleref.src	Sun Jul 14 14:07:59 1991
X--- bibleref-new/bibleref.src	Wed Jul 17 03:09:52 1991
X***************
X*** 6,12 ****
X  #
X  #	Author:	 Richard L. Goerwitz
X  #
X! #	Version: 1.18
X  #
X  ############################################################################
X  #
X--- 6,12 ----
X  #
X  #	Author:	 Richard L. Goerwitz
X  #
X! #	Version: 1.19
X  #
X  ############################################################################
X  #
X***************
X*** 133,141 ****
X  	fail
X      }
X  
X!     msg := "\"Bibleref\" - a King James Bible browser _
X! 		   by Richard Goerwitz"
X!     short_message := "\"Bibleref,\" by Richard Goerwitz"
X  
X      clear()
X      status_line(msg, short_message, "c") &
X--- 133,140 ----
X  	fail
X      }
X  
X!     msg := "\"Bibleref\" - a Bible browser by Richard Goerwitz"
X!     short_message := "\"Bibleref,\" by RG"
X  
X      clear()
X      status_line(msg, short_message, "c") &
X***************
X*** 191,197 ****
X      #
X      local capname
X  
X!     every capname := ("li","co","ce","so") do {
X  	getval(capname) | {
X  	    quit("check_features",
X  		 "terminal lacks "||capname||" capability", 2)
X--- 190,196 ----
X      #
X      local capname
X  
X!     every capname := ("li","co","ce") do {
X  	getval(capname) | {
X  	    quit("check_features",
X  		 "terminal lacks "||capname||" capability", 2)
X*** bibleref-1.0/convertb.icn	Sun Jul 14 14:07:59 1991
X--- bibleref-new/convertb.icn	Wed Jul 17 03:09:53 1991
X***************
X*** 7,13 ****
X  #
X  #	Author:	 Richard L. Goerwitz
X  #
X! #	Version: 1.3
X  #
X  ############################################################################
X  #
X--- 7,13 ----
X  #
X  #	Author:	 Richard L. Goerwitz
X  #
X! #	Version: 1.4
X  #
X  ############################################################################
X  #
X***************
X*** 67,73 ****
X      local names, n
X      static num_table
X      initial {
X! 	names     := ["Gen", "Exod", "Lev", "Num", "Deut", "Josh",
X  		      "Judg", "Ruth", "1Sam", "2Sam", "1Kgs", "2Kgs",
X  		      "1Chr", "2Chr", "Ezra", "Neh", "Esth", "Job",
X  		      "Pss", "Prov", "Qoh", "Cant", "Isa", "Jer",
X--- 67,73 ----
X      local names, n
X      static num_table
X      initial {
X! 	names := [    "Gen", "Exod", "Lev", "Num", "Deut", "Josh",
X  		      "Judg", "Ruth", "1Sam", "2Sam", "1Kgs", "2Kgs",
X  		      "1Chr", "2Chr", "Ezra", "Neh", "Esth", "Job",
X  		      "Pss", "Prov", "Qoh", "Cant", "Isa", "Jer",
X***************
X*** 78,87 ****
X  		      "Eph", "Phil", "Col", "1Thess", "2Thess",
X  		      "1Tim", "2Tim", "Titus", "Phlm", "Heb", "Jas",
X  		      "1Pet", "2Pet", "1John", "2John", "3John",
X! 		      "Jude", "Rev", "Tob", "Jdt", "Wis", "Sir",
X! 		      "Bar", "1Macc", "2Macc"]
X          num_table :=  table()
X! 	every n := 1 to 73 do
X  	    insert(num_table, n, get(names))
X      }
X  
X--- 78,90 ----
X  		      "Eph", "Phil", "Col", "1Thess", "2Thess",
X  		      "1Tim", "2Tim", "Titus", "Phlm", "Heb", "Jas",
X  		      "1Pet", "2Pet", "1John", "2John", "3John",
X! 		      "Jude", "Rev", "1Esdr", "2Esdr", "Tob", "Jdt",
X! 		      "Addest", "Wis", "Sirp", "Sir", "Letjer",
X! 		      "Prazar", "Suz", "Bar", "Prman", "1Macc",
X! 		      "2Macc", "3Macc", "4Macc", "Ps 151"]
X! 
X          num_table :=  table()
X! 	every n := 1 to 84 do
X  	    insert(num_table, n, get(names))
X      }
X  
X*** bibleref-1.0/name2num.icn	Sun Jul 14 14:08:01 1991
X--- bibleref-new/name2num.icn	Wed Jul 17 03:09:53 1991
X***************
X*** 6,12 ****
X  #
X  #	Author:	 Richard L. Goerwitz
X  #
X! #	Version: 1.3
X  #
X  ############################################################################
X  #
X--- 6,12 ----
X  #
X  #	Author:	 Richard L. Goerwitz
X  #
X! #	Version: 1.5
X  #
X  ############################################################################
X  #
X***************
X*** 40,47 ****
X  		      "2thessalonians", "1timothy", "2timothy",
X  		      "titus", "philemon", "hebrews", "james",
X  		      "1peter", "2peter", "1john", "2john", "3john",
X! 		      "jude", "revelation", "tobit", "judith", "wisdom",
X! 		      "sirach", "baruch", "1maccabees", "2maccabees",
X  
X  		      "gen", "exod", "lev", "num", "deut", "josh",
X  		      "judg", "ruth", "1sam", "2sam", "1kgs", "2kgs",
X--- 40,46 ----
X  		      "2thessalonians", "1timothy", "2timothy",
X  		      "titus", "philemon", "hebrews", "james",
X  		      "1peter", "2peter", "1john", "2john", "3john",
X! 		      "jude", "revelation",
X  
X  		      "gen", "exod", "lev", "num", "deut", "josh",
X  		      "judg", "ruth", "1sam", "2sam", "1kgs", "2kgs",
X***************
X*** 54,61 ****
X  		      "eph", "phil", "col", "1thess", "2thess",
X  		      "1tim", "2tim", "titus", "phlm", "heb", "jas",
X  		      "1pet", "2pet", "1john", "2john", "3john",
X! 		      "jude", "rev", "tob", "jdt", "wis", "sir",
X! 		      "bar", "1macc", "2macc",
X  
X  		      "dt", "jdg", "jg", "rth", "sa1", "sa2", "ki1",
X  		      "ki2", "ch1", "ch2", "jl", "mt", "mk", "lk",
X--- 53,59 ----
X  		      "eph", "phil", "col", "1thess", "2thess",
X  		      "1tim", "2tim", "titus", "phlm", "heb", "jas",
X  		      "1pet", "2pet", "1john", "2john", "3john",
X! 		      "jude", "rev",
X  
X  		      "dt", "jdg", "jg", "rth", "sa1", "sa2", "ki1",
X  		      "ki2", "ch1", "ch2", "jl", "mt", "mk", "lk",
X***************
X*** 63,76 ****
X  		      "phm", "pe1", "pe2", "jo1", "jo2", "jo3", "1jn",
X  		      "2jn", "3jn",
X  
X! 		      "son", "solomon", "ecclesiasticus", "ecclus"]
X  
X          abbrevtbl := table()
X  	tmp_names := copy(names)
X! 	every i := (1 to 73) | (1 to 73) |
X  	    5|7|7|8|9|10|11|12|13|14|29|40|41|42|43|46|
X  	    47|52|53|54|55|57|60|61|62|63|64|62|63|64|
X! 	    22|22|70|70
X  	do {
X  	    insert(abbrevtbl, get(tmp_names), i)
X  	}
X--- 61,94 ----
X  		      "phm", "pe1", "pe2", "jo1", "jo2", "jo3", "1jn",
X  		      "2jn", "3jn",
X  
X! 		      "1esdras", "2esdras", "tobit", "judith",
X! 		      "additions to esther", "wisdom of solomon",
X! 		      "sirach prologue", "sirach", "letter of _
X! 		      jeremiah", "prayer of azariah", "susanna",
X! 		      "baruch", "prayer of manasseh", "1maccabees",
X! 		      "2maccabees", "3maccabees", "4maccabees",
X! 		      "ps151",
X! 
X! 		      "1esdr", "2esdr", "tob", "jdt", "addesth",
X! 		      "wis", "sirp", "sir", "letjer", "prazar", "suz",
X! 		      "bar", "prman", "1macc", "2macc", "3macc",
X! 		      "4macc", "151",
X! 
X! 		      "song of songs", "solomon", "song of solomon",
X! 
X! 		      "3ezra", "4ezra", "3esdras", "4esdras",
X! 		      "adesth", "prologue", "ecclesiasticus",
X! 		      "ecclus", "epjer", "epistle of jeremiah",
X! 		      "song of three", "song of 3", "s of 3 y",
X! 		      "manasseh", "pss151"]
X  
X          abbrevtbl := table()
X  	tmp_names := copy(names)
X! 	every i := (1 to 66) | (1 to 66) |
X  	    5|7|7|8|9|10|11|12|13|14|29|40|41|42|43|46|
X  	    47|52|53|54|55|57|60|61|62|63|64|62|63|64|
X! 	    (67 to 84) | (67 to 84) | 22|22|22|
X! 	    67|68|67|68|71|73|74|74|75|75|76|76|76|79|84
X  	do {
X  	    insert(abbrevtbl, get(tmp_names), i)
X  	}
X*** bibleref-1.0/passutil.icn	Sun Jul 14 14:08:01 1991
X--- bibleref-new/passutil.icn	Wed Jul 17 03:09:55 1991
X***************
X*** 1,6 ****
X  ############################################################################
X  #
X! #	Name:	 1.15
X  #
X  #	Title:	 utilities for displaying passages
X  #
X--- 1,6 ----
X  ############################################################################
X  #
X! #	Name:	 1.17
X  #
X  #	Title:	 utilities for displaying passages
X  #
X***************
X*** 70,77 ****
X  
X  	message("Locating text in main file...")
X          # Now check to see if the passage is present in the indexed text.
X! 	text := bitmap_2_text(bitmap, kjv_filename) | fail
X! 
X          # Rewrap passage to width characters per line; put them into a list.
X  	d_list := []
X  	every put(d_list, rewrap(text, width))
X--- 70,79 ----
X  
X  	message("Locating text in main file...")
X          # Now check to see if the passage is present in the indexed text.
X! 	text := bitmap_2_text(bitmap, kjv_filename) | {
X! 	    err_message("No such passage in " || kjv_filename || ".")
X! 	    fail
X! 	}
X          # Rewrap passage to width characters per line; put them into a list.
X  	d_list := []
X  	every put(d_list, rewrap(text, width))
X***************
X*** 224,230 ****
X  
X      next_bitmap := NextBitmap(lastone, kjv_filename) | {
X  	err_message(convertb(lastone, kjv_filename) || " has no successor.")
X! 	fail
X      }
X      return next_bitmap
X  
X--- 226,232 ----
X  
X      next_bitmap := NextBitmap(lastone, kjv_filename) | {
X  	err_message(convertb(lastone, kjv_filename) || " has no successor.")
X! 	return lastone
X      }
X      return next_bitmap
X  
X***************
X*** 239,245 ****
X  
X      prev_bitmap := PrevBitmap(lastone, kjv_filename) | {
X  	err_message(convertb(lastone, kjv_filename) || " has no predecessor.")
X! 	fail
X      }
X      return prev_bitmap
X  
X--- 241,247 ----
X  
X      prev_bitmap := PrevBitmap(lastone, kjv_filename) | {
X  	err_message(convertb(lastone, kjv_filename) || " has no predecessor.")
X! 	return lastone
X      }
X      return prev_bitmap
X  
X*** bibleref-1.0/ref2bmap.icn	Sun Jul 14 14:08:01 1991
X--- bibleref-new/ref2bmap.icn	Wed Jul 17 03:09:52 1991
X***************
X*** 62,69 ****
X      s ? {
X  
X  	# Find book name, convert it to an integer.
X! 	bookname ||:= tab(any('1234'));	tab(many(' '))
X! 	bookname ||:= tab(many(&letters)) | fail
X  	# Fail if the user gives us just a single letter...
X  	*bookname > 1 | fail
X  	# ...otherwise, convert book name into the correct value for
X--- 62,75 ----
X      s ? {
X  
X  	# Find book name, convert it to an integer.
X! 	bookname ||:= tab(any('1234')) | {
X! 	    (="first",  "1") |
X! 	    (="second", "2") |
X! 	    (="third",  "3") |
X! 	    (="fourth", "4")
X! 	}
X! 	tab(many(' '))
X! 	bookname ||:= trim(tab(many(&letters ++ ' '))) | fail
X  	# Fail if the user gives us just a single letter...
X  	*bookname > 1 | fail
X  	# ...otherwise, convert book name into the correct value for
X*** bibleref-1.0/rsv2rtv.icn	Wed Jul 17 02:07:18 1991
X--- bibleref-new/rsv2rtv.icn	Wed Jul 17 03:10:16 1991
X***************
X*** 0 ****
X--- 1,111 ----
X+ ############################################################################
X+ #
X+ #	Name:	 rsv2rtv.icn
X+ #
X+ #	Title:	 RSV -> retrieve format converter
X+ #
X+ #	Author:	 Richard L. Goerwitz
X+ #
X+ #	Version: 1.3
X+ #
X+ ############################################################################
X+ #
X+ #  Program for converting CCAT RSV biblical texts into retrieve
X+ #  format.  Reads standard input.  Writes reformatted text to standard
X+ #  output.  Assumes the specific TLG betacode format for the input
X+ #  file(s).  If you have an RSV text that has been "tampered" with,
X+ #  this program may not work correctly.  Note that this program will
X+ #  probably work for any betacode-based biblical text (though I can't
X+ #  imagine what good it would be for anything but the RSV).
X+ #
X+ ############################################################################
X+ #
X+ #  Links: complete.icn ./convertr.icn ./name2num.icn
X+ #
X+ ############################################################################
X+ 
X+ # link snapshot          # for debugging purposes
X+ 
X+ procedure main()
X+ 
X+     local line, verse, firstline
X+ 
X+     # Go to first tilde-initial line.
X+     match("~", firstline := !&input)
X+ 
X+     # While you can read lines from stdin...
X+     every line := firstline | !&input do {
X+ 
X+ 	# ...scan them for betacode level-marker lines (which begin
X+ 	# with a tilde).
X+ 	trim(line, '\x09\x0D ') ? {
X+ 
X+ 	    # Housekeeping.
X+ 	    tab(many('\t '))    # tab past whitespace (if present)
X+ 	    pos(0) & next	# skip past empty lines
X+ 
X+ 	    # If we have a betacode level marker line, then flush the
X+ 	    # verse buffer.
X+ 	    if ="~" then {
X+ 		tab(many(~&letters))
X+ 		write(trim(\verse))
X+ 		rtvcode := beta2rtv(tab(0)) |
X+ 		    stop("rsv2rtv:  Can't parse ", &subject, ".")
X+ 		write("::", \rtvcode)
X+ 		verse := ""
X+ 	    }
X+ 	    else verse ||:= tab(0) || " "
X+ 	}
X+     }
X+     write(trim(verse))
X+     exit(0)
X+ 
X+ end
X+ 
X+ 
X+ 
X+ procedure beta2rtv(s)
X+ 
X+     local offset, nextfield, nextoffset
X+     static location, fields, offsets
X+     initial {
X+ 	location := ["","","",0,0]
X+ 	fields   := "abcxy"
X+ 	offsets  := "12345"
X+     }
X+ 
X+     s ? {
X+ 	while offset := map(move(1), fields, offsets) do {
X+ #           # for debugging purposes
X+ #	    snapshot()
X+ 	    nextoffset := offset+1
X+ 	    nextfield  := fields[nextoffset] | &null
X+ 	    location[offset] := {
X+ 		if pos(0) then integer(location[offset])+1 | fail
X+ 		else {
X+ 		    case &subject[&pos] of {
X+ 			"\""      : 2(="\"", tab(find("\"")), ="\"")
X+ 			nextfield : integer(location[offset])+1
X+ 			default   : integer(tab(find(\nextfield) | 0))
X+ 		    }
X+ 		}
X+ 	    } | fail
X+ 
X+ 	    # If the current field is "y" and its value is "t" then
X+ 	    # snarf the next input line, and set this field to 0.
X+ 	    # The next input line contains a title (the "t").
X+ 	    if any('xyz',fields,offset) & location[offset] === "t" then {
X+ 		read(&input)
X+ 		location[offset] := 0
X+ 		return &null
X+ 	    }
X+ 	    every location[nextoffset to 5] := 1
X+ 	    every location[nextoffset to 3] := ""
X+ #	    snapshot()
X+ 	}
X+     }
X+ 
X+     pos(0) &
X+ 	return convertr(location[3] ||" "|| location[4] ||":"|| location[5])
X+ 
X+ end
X*** bibleref-1.0/version.icn	Sun Jul 14 14:08:02 1991
X--- bibleref-new/version.icn	Wed Jul 17 03:09:56 1991
X***************
X*** 6,12 ****
X  #
X  #	Author:	 Richard L. Goerwitz
X  #
X! #	Version: 1.1
X  #
X  ############################################################################
X  #
X--- 6,12 ----
X  #
X  #	Author:	 Richard L. Goerwitz
X  #
X! #	Version: 1.2
X  #
X  ############################################################################
X  #
X***************
X*** 15,19 ****
X  ############################################################################
X  
X  procedure _version()
X!     return "Bibleref, version 1.0, patchlevel 0"
X  end
X--- 15,19 ----
X  ############################################################################
X  
X  procedure _version()
X!     return "Bibleref, version 1.0, patchlevel 1"
X  end
SHAR_EOF
true || echo 'restore of 1.0-1.1 failed'
fi
exit 0
-- 

   -Richard L. Goerwitz              goer%sophist@uchicago.bitnet
   goer@sophist.uchicago.edu         rutgers!oddjob!gide!sophist!goer

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.


