home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / clarion / brfcla2.zip / ABC.M next >
Text File  |  1989-06-07  |  4KB  |  193 lines

  1. ;;*   Sample initials macro source file
  2. ;;*   To find additions for CLARION support, search for comments that begin
  3. ;;*   with ;;*
  4.  
  5. ;**    _init macro.
  6. ;**    Do not change this macro (always overwritten by Setup).
  7. (macro _init
  8.     (
  9.         (extern    autosave                ;**    External macro declarations
  10.                     toggle_re
  11.         )
  12.         (color 1 7 10 11 12 0x80)    ;**    Set the screen colors
  13.         (search_case 1)                ;**    Case insensitive search
  14.         (autosave)                        ;**    Automatic file save when idle
  15.     )
  16. )
  17.  
  18. ;**    Initials macro.
  19. ;**    Use this macro for additional customization.
  20. (macro ABC
  21.     (
  22.       (assign_to_key "<Backspace>" "bbkspace")
  23.       (assign_to_key "<Keypad-8>" "NewKeyPad 8")
  24.       (assign_to_key "<Keypad-4>" "NewKeyPad 4")
  25.       (assign_to_key "<Keypad-2>" "NewKeyPad 2")
  26.       (assign_to_key "<Keypad-6>" "NewKeyPad 6")
  27.       (assign_to_key "<Keypad-1>" "NewKeyPad 1")
  28.       (assign_to_key "<Keypad-7>" "NewKeyPad 7")
  29.       (int keyboardFlag)
  30.       (global keyboardFlag)
  31.       (autoload "extsrch" "search_fwd" "search_back" "search_again")
  32.  
  33.       ;;* Add this line to load CLARION language support
  34.       (autoload "ccompile" "compile_it" "cc")
  35.       ;;* Macro Uppercases statements/inserts parens
  36.       (autoload "up_paren" "up_paren")
  37.  
  38.         (return)
  39.     )
  40. )
  41.  
  42.  
  43. ;**    File Extension Macros, etc.
  44. ;**    Macros marked "Overwritable" may be overwritten by SETUP.
  45.  
  46. (macro NewKeyPad
  47.    (
  48.       (int whatKey)                             ;** The number pressed
  49.       (string whatKeyString)                    ;** The number inserted
  50.       (get_parm 0 whatKey)                      ;** Get the parameter passed
  51.       (sprintf whatKeyString "%d" whatKey)      ;** Turn whatKey into a string
  52.       (= keyboardFlag (inq_kbd_flags))          ;** Check the status of the keyboard
  53.       (if (> (& 0x20 keyboardFlag) 0)           ;** Is the Num Lock on
  54.          (insert whatKeyString)                 ;** If so insert a number
  55.       ;else
  56.          (
  57.             (if (|| (> (& 0x1 keyboardFlag) 0) (> (& 0x2 keyboardFlag) 0))  ;** Are one of the shift keys pressed
  58.                (
  59.                   (switch whatKey                  ;** act on what key was pressed
  60.                      8
  61.                         (change_window 0)          ;** up one window
  62.                      4
  63.                         (change_window 3)          ;** right one window
  64.                      2
  65.                         (change_window 2)          ;** down one window
  66.                      6
  67.                         (change_window 1)          ;** left one window
  68.                      1
  69.                         (insert whatKeyString)     ;** put in a one
  70.                      7
  71.                         (insert whatKeyString)     ;** put in a seven
  72.                   )
  73.                )
  74.             )
  75.          )
  76.  
  77.       )
  78.    )
  79. );** end of macro NewKeyPad
  80.  
  81.  
  82.  
  83. ;**    Overwritable by Setup
  84. (macro default
  85.     (
  86.         (tabs 4 6 8 10)
  87.     )
  88. )
  89.  
  90. ;**    Overwritable by Setup
  91. (macro .h
  92.     (
  93.         (tabs 4 7)
  94.     )
  95. )
  96.  
  97. ;**    Overwritable by Setup
  98. (macro .m
  99.     (
  100.         (tabs 4 7)
  101.     )
  102. )
  103.  
  104. ;**    Overwritable by Setup
  105. (macro .bas
  106.     (
  107.         (tabs 2 4 6 8 10 12)
  108.     )
  109. )
  110.  
  111. ;**    Overwritable by Setup
  112. (macro .bas_next_error
  113.     (returns (search_fwd "^[ \\t\\n]+\\c[~ \\t\\n]" 1 1))
  114. )
  115.  
  116. ;**    Overwritable by Setup
  117. (macro .bas_prev_error
  118.     (returns (search_back "^[ \\t\\n]+\\c[~ \\t\\n]" 1 1))
  119. )
  120.  
  121. ;**    Overwritable by Setup
  122. (macro .bas_error_info
  123.     (
  124.         (string    error_text)
  125.  
  126.         (int        error_buf
  127.                     source_buf
  128.                     line_found
  129.         )
  130.         (save_position)
  131.         (search_back "< [0-9A-F][0-9A-F][0-9A-F][0-9A-F] [~^]@>" 1 1)
  132.         (= error_text (substr (ltrim (substr (read) 17)) 1 80))
  133.  
  134.         (if (== error_text "")
  135.             (= error_text "*")
  136.         )
  137.         (= error_buf (inq_buffer))
  138.         (get_parm 4 source_buf)
  139.         (set_buffer source_buf)
  140.  
  141.         (if (! (search_fwd error_text 0 1))
  142.             (search_back error_text 0 1)
  143.         )
  144.         (inq_position line_found)
  145.         (set_buffer error_buf)
  146.         (restore_position)
  147.  
  148.         (put_parm 1 line_found)
  149.         (put_parm 3 (trim (read)))
  150.         (put_parm 2 0)
  151.         (returns 2)
  152.     )
  153. )
  154.  
  155. ;**    Overwritable by Setup
  156. (macro .bat
  157.     (
  158.         (tabs 4 8 10 12)
  159.     )
  160. )
  161.  
  162. ;**    Overwritable by Setup
  163. (macro .c
  164.     (
  165.         (tabs 4 7)
  166.     )
  167. )
  168.  
  169. ;**    Overwritable by Setup
  170. (macro .txt
  171.     (
  172.         (tabs 2 4 6 8 10)
  173.     )
  174. )
  175.  
  176. ;**    Overwritable by Setup
  177. (macro .doc
  178.     (
  179.         (tabs 4 6 8 10)
  180.     )
  181. )
  182.  
  183. ;**    Overwritable by Setup
  184. (macro .asm
  185.     (
  186.         (tabs 9 17)
  187.     )
  188. )
  189.  
  190. ;;* Include macros to provide support for Clarion Compiler and error detection
  191.  
  192. #include "clainitl.inc"
  193.