home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / wp / asciim.zip / ASCII.M next >
Text File  |  1989-07-06  |  4KB  |  185 lines

  1. ;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  2. ;;
  3. ;;                      ASCII table for brief
  4. ;;
  5. ;;        This macro is used to display an ASCII table in Brief.  
  6. ;;    
  7. ;;  Add this macro to your initials macro and initialize it to use <Ctrl-a>
  8. ;;
  9. ;;       ascii.m     source code, this file
  10. ;;       ascii.cm    compiled macro
  11. ;;       ascii.tab   actual ascii table ; read only
  12. ;;
  13. ;;    ENTER inserts the character under cursor to the edit buffer and
  14. ;;    ESC just displays its data on the status line.
  15. ;;
  16. ;;    Roy Rumaner
  17. ;;    Rumaner Consulting
  18. ;;    6158 Knollway Drive
  19. ;;    Willowbrook, IL 60514
  20. ;;    (312) 654-2723
  21. ;;
  22. ;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  23.  
  24. (macro id_char
  25.     (
  26.         (string in_char)
  27.         (int ascii)
  28.         (= in_char (read 1))
  29.         (= ascii (atoi in_char 0))
  30.         (if (< ascii 0)
  31.           (= ascii (+ ascii 256))
  32.         )
  33.         (message "Character is %c : Decimal # %d : Hex is %X " ascii ascii ascii)
  34.     )
  35. )
  36. (macro mup
  37.    (
  38.       (up)
  39.       (up)
  40.       (id_char)
  41.    )
  42. )
  43. (macro mdun
  44.    (
  45.       (int line)
  46.       (inq_position line)
  47.       (if (<= line 23)
  48.          (
  49.             (down)
  50.             (down)
  51.             (id_char)
  52.          )
  53.       )
  54.    )
  55. )
  56. (macro mnxtw
  57.    (
  58.       (int line col)
  59.       (inq_position line col)
  60.       (if (< col 63)
  61.          (
  62.             (next_char)
  63.             (next_char)
  64.          )
  65.       ;else
  66.          ;(if (< line 15)
  67.          (if (< line 25)
  68.             (
  69.                (beginning_of_line)
  70.                (down)
  71.                (down)
  72.             )
  73.          )
  74.       )
  75.       (id_char)
  76.    )                        
  77. )
  78. (macro mprvw
  79.    (
  80.       (int line col)
  81.       (inq_position line col)
  82.       (if (&& (== col 1) (> line 1))
  83.          (
  84.             (end_of_line)
  85.             (prev_char)
  86.             (up)
  87.             (up)
  88.          )
  89.       ;else
  90.          (
  91.             (prev_char)
  92.             (prev_char)
  93.          )
  94.       )
  95.       (id_char)
  96.    )
  97. )
  98. (macro mhome
  99.    (
  100.       (top_of_buffer)
  101.       (id_char)
  102.    )
  103. )
  104. (macro mend
  105.    (
  106.       (end_of_buffer)
  107.       (prev_char)
  108.       (id_char)
  109.    )
  110. )
  111. (macro mergchar
  112.    (
  113.       (int domerge)
  114.       (string mergchr)
  115.       (global domerge mergchr)
  116.       (= domerge 1)
  117.       (= mergchr (read 1))
  118.       (exit)
  119.    )
  120. )
  121. (macro ascii
  122.     (
  123.         (int under_buf over_buf begin end no_table)
  124.         (string bpath table_path bpath_part)
  125.       (= domerge 0)
  126.         (= bpath (inq_environment "BPATH"))
  127.         (= no_table 0)
  128.         (= table_path "ascii.tab")
  129.         (while (&& (! (exist table_path)) (! no_table))
  130.             (
  131.                 (if (!= 0 (= end (index bpath "\;")))
  132.                     (                
  133.                         (= begin 1)
  134.                         (= bpath_part (substr bpath begin (- end 1)))
  135.                         (= table_path (+ bpath_part "\\ascii.tab"))
  136.                         (= bpath (substr bpath (+ end 1)))
  137.                     )
  138.                 ; else
  139.                     (
  140.                         (= table_path (+ bpath "\\ascii.tab"))
  141.                         (if (! (exist table_path))
  142.                             (
  143.                                 (error "ASCII table not found.")
  144.                                 (= no_table 1)
  145.                             )
  146.                         )
  147.                     )
  148.                 )
  149.             )
  150.         )
  151.         (if (! no_table)
  152.             (
  153.                 (= under_buf (inq_buffer))
  154.                 (= over_buf (create_buffer "ASCII TABLE" table_path 0))
  155.                 (create_window 8 18 72 1 " Use  or , [Esc] Ends, [┘] Inserts char. - R. Rumaner ")
  156.                 (attach_buffer over_buf)
  157.                 (set_buffer over_buf)
  158.                 (refresh)
  159.                 (keyboard_push)
  160.                 (assign_to_key "#27" "exit")
  161.                 (assign_to_key "%#45" "exit")
  162.                  (assign_to_key "%#72" "mup")
  163.                 (assign_to_key "%#77" "mnxtw")
  164.                 (assign_to_key "%#80" "mdun")
  165.                 (assign_to_key "%#75" "mprvw")
  166.            (assign_to_key "#29696" "mnxtw")
  167.                 (assign_to_key "#29440" "mprvw")
  168.            (assign_to_key "#18176" "mhome")
  169.              (assign_to_key "#20224" "mend")
  170.            (assign_to_key "#7181" "mergchar")
  171.            (id_char)
  172.                 (process)
  173.                  (keyboard_pop)
  174.                 (delete_window)
  175.                 (delete_buffer over_buf)
  176.                 (set_buffer under_buf)
  177.                 (attach_buffer under_buf)
  178.             (if (== domerge 1)
  179.                   (insert mergchr)
  180.             )
  181.             )
  182.         )
  183.      )
  184. )
  185.