home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OL.LZH / PROCS.LZH / STATEMAP.ICN < prev    next >
Text File  |  1991-09-05  |  3KB  |  108 lines

  1. ############################################################################
  2. #
  3. #    Name:    statemap.icn
  4. #
  5. #    Title:    Two-way table of state names and postal abbreviations
  6. #
  7. #    Author:    Ralph E. Griswold
  8. #
  9. #    Date:    September 2, 1991
  10. #
  11. ############################################################################
  12. #
  13. #    This procedure Produces a "two-way" table to map state names (in
  14. #  the postal sense) to their postal appreviations and vice-versa.
  15. #
  16. #    The list is done in two parts with auxiliary procedures so that this
  17. # procedure can be used with the default constant-table size for the
  18. # translator and linker.
  19. #
  20. ############################################################################
  21.  
  22. procedure statemap()
  23.    local state_list, state_map
  24.  
  25.    state_map := table()
  26.  
  27.    every state_list := __list1() | __list2() do
  28.       every i := 1 to *state_list - 1 by 2 do {
  29.          insert(state_map, state_list[i], state_list[i + 1])
  30.          insert(state_map, state_list[i + 1], state_list[i])
  31.          }
  32.  
  33.    return state_map
  34.  
  35. end
  36.  
  37. procedure __list1()
  38.  
  39.    return [
  40.       "AK", "Alaska",
  41.       "AL", "Alabama",
  42.       "AR", "Arkansas",
  43.       "AS", "American Samoa",
  44.       "AZ", "Arizona",
  45.       "CA", "California",
  46.       "CO", "Colorado",
  47.       "CT", "Connecticut",
  48.       "DC", "District of Columbia",
  49.       "DE", "Delaware",
  50.       "FL", "Florida",
  51.       "FM", "Federated States of Micronesia",
  52.       "GA", "Georgia",
  53.       "GU", "Guam",
  54.       "HI", "Hawaii",
  55.       "IA", "Iowa",
  56.       "ID", "Idaho",
  57.       "IL", "Illinois",
  58.       "IN", "Indiana",
  59.       "KS", "Kansas",
  60.       "KY", "Kentucky",
  61.       "LA", "Louisiana",
  62.       "MA", "Massachusetts",
  63.       "MD", "Maryland",
  64.       "ME", "Maine",
  65.       "MH", "Marshall Islands",
  66.       "MI", "Michigan",
  67.       "MN", "Minnesota"
  68.        ]
  69.  
  70. end
  71.  
  72. procedure __list2()
  73.  
  74.    return [
  75.       "MO", "Missouri",
  76.       "MP", "Northern Mariana Islands",
  77.       "MS", "Mississippi",
  78.       "MT", "Montana",
  79.       "NC", "North Carolina",
  80.       "ND", "North Dakota",
  81.       "NE", "Nebraska",
  82.       "NH", "New Hampshire",
  83.       "NJ", "New Jersey",
  84.       "NM", "New Mexico",
  85.       "NV", "Nevada",
  86.       "NY", "New York",
  87.       "OH", "Ohio",
  88.       "OK", "Oklahoma",
  89.       "OR", "Oregon",
  90.       "PA", "Pennsylvania",
  91.       "PR", "Puerto Rico",
  92.       "PW", "Palau",
  93.       "RI", "Rhode Island",
  94.       "SC", "South Carolina",
  95.       "SD", "South Dakota",
  96.       "TN", "Tennessee",
  97.       "TX", "Texas",
  98.       "UT", "Utah",
  99.       "VA", "Virginia",
  100.       "VT", "Vermont",
  101.       "WA", "Washington",
  102.       "WI", "Wisconsin",
  103.       "WV", "West Virginia",
  104.       "WY", "Wyoming"
  105.       ]
  106.  
  107. end
  108.