############################################################################ # # Name: name2num.icn # # Title: convert English book name to an integer # # Author: Richard L. Goerwitz # # Version: 1.8 # ############################################################################ # # 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", "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", "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", "1esdras", "2esdras", "tobit", "judith", "additions to esther", "wisdom of solomon", "sirach prologue", "sirach", "baruch", "letter _ of jeremiah", "prayer of azariah", "susanna", "bel and the dragon", "prayer of manasseh", "1maccabees", "2maccabees", "3maccabees", "4maccabees", "1esdr", "2esdr", "tob", "jdt", "addesth", "wis", "sirp", "sir", "bar", "letjer", "prazar", "suz", "bel", "prman", "1macc", "2macc", "3macc", "4macc", "song of songs", "solomon", "song of solomon", "3ezra", "4ezra", "3esdras", "4esdras", "adesth", "ecclesiasticus", "ecclus", "epjer", "epistle of jeremiah", "s of 3 y", "s. of 3 y.", "manasseh"] abbrevtbl := table() tmp_names := copy(names) every i := (1 to 66) | (1 to 66) | 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| (67 to 84) | (67 to 84) | 22|22|22| 67|68|67|68|71|74|74|76|76|77|77|80 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