home *** CD-ROM | disk | FTP | other *** search
- ############################################################################
- #
- # Name: name2num.icn
- #
- # Title: convert English book name to an integer
- #
- # Author: Richard L. Goerwitz
- #
- # Version: 1.3
- #
- ############################################################################
- #
- # Used by ref_2_bitmap(), convertr(), etc.
- #
- ############################################################################
-
-
- procedure name2num(s)
-
- # Map English book names or abbreviations to numeric values.
-
- local n, b_name, tmp_names, i, nameset
- static names, abbrevtbl
- initial {
-
- names := ["genesis", "exodus", "leviticus", "numbers",
- "deuteronomy", "joshua", "judges", "ruth",
- "1samuel", "2samuel", "1kings", "2kings",
- "1chronicles", "2chronicles", "ezra",
- "nehemiah", "esther", "job", "psalms",
- "proverbs", "ecclesiastes", "canticles",
- "isaiah", "jeremiah", "lamentations", "ezekiel",
- "daniel", "hosea", "joel", "amos", "obadiah",
- "jonah", "micah", "nahum", "habakkuk",
- "zephaniah", "haggai", "zechariah", "malachi",
- "matthew", "mark", "luke", "john", "acts",
- "romans", "1corinthians", "2corinthians",
- "galations", "ephesians", "philippians",
- "colossians", "1thessalonians",
- "2thessalonians", "1timothy", "2timothy",
- "titus", "philemon", "hebrews", "james",
- "1peter", "2peter", "1john", "2john", "3john",
- "jude", "revelation", "tobit", "judith", "wisdom",
- "sirach", "baruch", "1maccabees", "2maccabees",
-
- "gen", "exod", "lev", "num", "deut", "josh",
- "judg", "ruth", "1sam", "2sam", "1kgs", "2kgs",
- "1chr", "2chr", "ezra", "neh", "esth", "job",
- "pss", "prov", "qoh", "cant", "isa", "jer",
- "lam", "ezek", "dan", "hos", "joel", "amos",
- "obad", "jonah", "mic", "nahum", "hab", "zeph",
- "hag", "zech", "mal", "mat", "mark", "luke",
- "john", "acts", "rom", "1cor", "2cor", "gal",
- "eph", "phil", "col", "1thess", "2thess",
- "1tim", "2tim", "titus", "phlm", "heb", "jas",
- "1pet", "2pet", "1john", "2john", "3john",
- "jude", "rev", "tob", "jdt", "wis", "sir",
- "bar", "1macc", "2macc",
-
- "dt", "jdg", "jg", "rth", "sa1", "sa2", "ki1",
- "ki2", "ch1", "ch2", "jl", "mt", "mk", "lk",
- "jn", "co1", "co2", "th1", "th2", "ti1", "ti2",
- "phm", "pe1", "pe2", "jo1", "jo2", "jo3", "1jn",
- "2jn", "3jn",
-
- "son", "solomon", "ecclesiasticus", "ecclus"]
-
- abbrevtbl := table()
- tmp_names := copy(names)
- every i := (1 to 73) | (1 to 73) |
- 5|7|7|8|9|10|11|12|13|14|29|40|41|42|43|46|
- 47|52|53|54|55|57|60|61|62|63|64|62|63|64|
- 22|22|70|70
- do {
- insert(abbrevtbl, get(tmp_names), i)
- }
- }
-
- nameset := set()
- every insert(nameset, complete(map(s), names))
- case *nameset of {
- 0 : fail
- 1 : return abbrevtbl[!nameset]
- default : suspend abbrevtbl[!sort(nameset)]
- }
-
- end
-