home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / DBRIEF.ZIP / SOURCE / DBRIEF.M < prev    next >
Encoding:
Text File  |  1991-03-21  |  22.2 KB  |  942 lines

  1. ;dBRIEF Engine - v3.10
  2. ;Copyright (c) 1991 - Global Technologies Corporation
  3. ;ALL RIGHTS RESERVED
  4. #include "dbrief.h"
  5. (macro dbrief
  6.     (
  7.         (message "%s Programmers Core Enabled." dbr_version)
  8.         (register_macro 1 "_switch_buffer")
  9.         (return 1)
  10.     )
  11. )
  12. ;***
  13. ;* main routine
  14. ;***
  15. (macro _init
  16.     (
  17.         (int        temp_int
  18.                     _prg_smart
  19.                     _obk_smart
  20.                     library_buffer
  21.                     library_window
  22.                     curr_indent_line
  23.                     curr_indent_col
  24.                     dbr_current_buffer
  25.                     dbr_current_window
  26.                     dbr_text_flag
  27.                     dbr_curr_line
  28.                     dbr_return_flag
  29.                     dbr_dialect
  30.                     dbr_default_dialect
  31.                     dbr_indent_level
  32.                     dbr_proc_indent
  33.                     dbr_auto_indent
  34.                     dbr_comment_tab
  35.                     dbr_comment_lines
  36.                     dbr_set_ext
  37.                     dbr_auto_header
  38.                     dbr_template
  39.                     dbr_graphics
  40.                     dbr_apx_file_id
  41.         )
  42.         (string  temp_str
  43.                     dbr_library
  44.                     apx_menu_event
  45.         )
  46.         (global  temp_int
  47.                     temp_str
  48.                     _prg_smart
  49.                     _obk_smart
  50.                     library_buffer
  51.                     library_window
  52.                     curr_indent_line
  53.                     curr_indent_col
  54.                     dbr_current_buffer
  55.                     dbr_current_window
  56.                     dbr_text_flag
  57.                     dbr_curr_line
  58.                     dbr_return_flag
  59.                     dbr_dialect
  60.                     dbr_default_dialect
  61.                     dbr_indent_level
  62.                     dbr_proc_indent
  63.                     dbr_auto_indent
  64.                     dbr_comment_tab
  65.                     dbr_comment_lines
  66.                     dbr_set_ext
  67.                     dbr_auto_header
  68.                     dbr_template
  69.                     dbr_graphics
  70.                     dbr_library
  71.                     dbr_apx_file_id
  72.                     apx_menu_event
  73.         )
  74.         ;*** Default Settings
  75.         (= dbr_auto_indent 1)            ;*** auto indent ON=1, OFF=0
  76.         (= dbr_auto_header 1)            ;*** auto header ON=1, OFF=0
  77.         (= dbr_set_ext 1)                    ;*** auto default extension ON=1, OFF=0
  78.         (= dbr_template 1)                ;*** template editing ON=1, OFF=0
  79.         (= dbr_dialect 12)                    ;*** dialect code
  80.         (= dbr_graphics 1)                ;*** graphics mode 1-Normal, 2-Double, 3-Combination, 4-Special
  81.         (= dbr_comment_tab 50)            ;*** comment tab column
  82.         (= dbr_library "/brief/library.src")  ;*** sourceview library
  83.         (= dbr_comment_lines 1)            ;*** conditional comment line numbers 1=ON, 0=OFF
  84.         (= dbr_proc_indent 1)            ;*** procedure/function indenting ON=1, OFF=0
  85.         (= dbr_default_dialect dbr_dialect)
  86.         (assign_to_key "<f10>" "function_f10")
  87.         (keyboard_push)
  88.         (assign_to_key "<Enter>" "_enter")
  89.         (assign_to_key "<Tab>" "slide_in")
  90.         (assign_to_key "<Shift-Tab>" "slide_out")
  91.         (assign_to_key "<Space>" "_prg_template")
  92.         (assign_to_key "<Ctrl-O>" "_implode_object_window")
  93.         (assign_to_key "<Ctrl-G>" "scan routines")
  94.         (assign_to_key "<Ctrl-H>" "head")
  95.         (assign_to_key "<Ctrl-F>" "_ctrl_f")
  96.         (assign_to_key "<Ctrl-V>" "vers")
  97.         (assign_to_key "<Ctrl-S>" "scan prev")
  98.         (assign_to_key "<Ctrl-X>" "nothing")
  99.         (assign_to_key "<Ctrl-f7>" "_same_line_comment")
  100.         (assign_to_key "<Ctrl-f8>" "sv")
  101.         (assign_to_key "<Ctrl-f9>" "_execute_option_one")
  102.         (assign_to_key "<Ctrl-f10>" "expa")
  103.         (assign_to_key "<Shift-f3>" "rein")
  104.         (assign_to_key "<Shift-f7>" "comm")
  105.         (assign_to_key "<Shift-f8>" "set")
  106.         (assign_to_key "<Alt-f3>" "disp stru")
  107.         (assign_to_key "<Alt-f4>" "print")
  108.         (assign_to_key "<Alt-=>" "_alt_equals_sign")
  109.         (assign_to_key "<Alt-y>" "tag")
  110.         (assign_to_key "<Alt-O>" "nothing")
  111.         (assign_to_key "<Alt-E>" "nothing")
  112.         (assign_to_key "<Alt-X>" "nothing")
  113.         (assign_to_key "<Alt-N>" "nothing")
  114.         (assign_to_key "<Alt-B>" "nothing")
  115.         (assign_to_key "<Alt-minus>" "nothing")
  116.         (assign_to_key "<Alt-Up>" "_alt_up")
  117.         (assign_to_key "<Ctrl-minus>" "nothing")
  118.         (assign_to_key "<Ctrl-A>" "nothing")
  119.         (assign_to_key "<Ctrl-E>" "nothing")
  120.         (= _obk_smart (inq_keyboard))
  121.         (keyboard_pop 1)
  122.         (keyboard_push)
  123.         (assign_to_key "<Enter>" "_enter")
  124.         (assign_to_key "<Tab>" "slide_in")
  125.         (assign_to_key "<Shift-Tab>" "slide_out")
  126.         (assign_to_key "<Space>" "_prg_template")
  127.         (assign_to_key "<Ctrl-A>" "apx")
  128.         (assign_to_key "<Ctrl-C>" "coor")
  129.         (assign_to_key "<Ctrl-E>" "_select_apx_program")
  130.         (assign_to_key "<Ctrl-O>" "_explode_object_window")
  131.         (assign_to_key "<Ctrl-G>" "scan routines")
  132.         (assign_to_key "<Ctrl-H>" "head")
  133.         (assign_to_key "<Ctrl-F>" "_ctrl_f")
  134.         (assign_to_key "<Ctrl-S>" "scan prev")
  135.         (assign_to_key "<Ctrl-V>" "vers")
  136.         (assign_to_key "<Shift-f1>" "assi")
  137.         (assign_to_key "<Shift-f2>" "dbhe")
  138.         (assign_to_key "<Shift-f3>" "rein")
  139.         (assign_to_key "<Shift-f4>" "pre")
  140.         (assign_to_key "<Shift-f7>" "comm")
  141.         (assign_to_key "<Shift-f8>" "set")
  142.         (assign_to_key "<Ctrl-f7>" "_same_line_comment")
  143.         (assign_to_key "<Ctrl-f8>" "sv")
  144.         (assign_to_key "<Ctrl-f9>" "_execute_option_one")
  145.         (assign_to_key "<Ctrl-f10>" "expa")
  146.         (assign_to_key "<Ctrl-Up>" "_display_procedure")
  147.         (assign_to_key "<Ctrl-Down>" "_list_uses")
  148.         (assign_to_key "<Alt-f3>" "disp stru")
  149.         (assign_to_key "<Alt-f4>" "print")
  150.         (assign_to_key "<Alt-f9>" "revi")
  151.         (assign_to_key "<Alt-=>" "_alt_equals_sign")
  152.         (assign_to_key "<Alt-y>" "tag")
  153.         (assign_to_key "<Alt-Up>" "_alt_up")
  154.         (= _prg_smart (inq_keyboard))
  155.         (keyboard_pop 1)
  156.         (set_msg_level 3)
  157.         (autoload "apx"            "apx"
  158.                                         "_select_apx_program"
  159.                                         "_open_apx_file"
  160.                                         "_create_apx_file"
  161.                                         "_display_apx_file"
  162.                                         "_apx_scan_menu"
  163.                                         "_scan_apx_programs_r"
  164.                                         "_scan_apx_programs_p"
  165.                                         "_scan_apx_programs_f"
  166.                                         "_scan_apx_programs_t"
  167.         )
  168.         (autoload "assist"        "assi"
  169.                                         "dbhe"
  170.                                         "inte"
  171.                                         "_execute_option_one"
  172.         )
  173.         (autoload "crossref"        "_find_constant"
  174.         )
  175.         (autoload "comment"        "comm"
  176.                                         "unco"
  177.                                         "_comment_block"
  178.                                         "_uncomment_block"
  179.                                         "_same_line_comment"
  180.                                         "_remove_same_line_comments"
  181.         )
  182.         (autoload "display"        "disp"
  183.                                         "_display_graphics_mode"
  184.                                         "_display_dialect"
  185.                                         "_status"
  186.                                         "_display_procedure"
  187.                                         "_seek_keyword"
  188.         )
  189.         (autoload "graphics"        "draw"
  190.                                         "nodr"
  191.                                         "_frame"
  192.                                         "_cursor"
  193.         )
  194.         (autoload "generate"        "_create_routine_from_block"
  195.                                         "stor"
  196.                                         "scat"
  197.                                         "gath"
  198.                                         "init"
  199.                                         "coor"
  200.                                         "_substitute_window_coordinates"
  201.                                         "_reverse_window_coordinates"
  202.         )
  203.         (autoload "header"        "head"
  204.                                         "revi"
  205.                                         "_pro_header"
  206.                                         "_procedure_header"
  207.         )
  208.         (autoload "indenter"        "rein"
  209.                                         "_prg_indent"
  210.                                  "_last_character"
  211.         )
  212.         (autoload "library"        "sv"
  213.                                         "libr"
  214.                                         "_process_library_call"
  215.                                         "_sv"
  216.         )
  217.         (autoload "macrolib"        "_date_time"
  218.                                         "_pad_right"
  219.                                         "_replicate"
  220.                                         "_display_popup_message"
  221.                                         "_pause_for_seconds"
  222.                                         "_menu_lines"
  223.                                         "_invalid_key"
  224.                                         "_get_directory"
  225.                                         "_number_lines"
  226.                                         "_number_bytes"
  227.                                         "_pick_menu"
  228.                                         "_parse_child"
  229.         )
  230.         (autoload "optimize"        "opti"
  231.                                         "_tab_support"
  232.         )
  233.         (autoload "object"        "_explode_object_window"
  234.                                         "_implode_object_window"
  235.         )
  236.         (autoload "preproc"        "pre"
  237.         )
  238.         (autoload "scanner"        "scan"
  239.                                         "tag"
  240.                                         "unta"
  241.                                         "_scan_source"
  242.                                         "repl"
  243.         )
  244.         (autoload "setcmds"        "setu"
  245.                                         "set"
  246.                                         "_switch_dialect"
  247.         )
  248.         (autoload "source"        "_print_source"
  249.         )
  250.         (autoload "template"        "expa"
  251.                                         "_prg_template"
  252.                                         "_evaluate_expansion_table"
  253.                                         "_parse_and_expand"
  254.                                         "_command_insert"
  255.                                         "_function_insert"
  256.         )
  257.         (autoload                    (_get_dialect_info dbr_dialect 2)
  258.                                         "_continuation_character"
  259.                                         "_comment_character"
  260.                                         "_write_enable"
  261.                                         "_beg_of_rout_scan"
  262.                                         "_beg_of_proc_scan"
  263.                                         "_beg_of_func_scan"
  264.                                         "_end_of_rout_syntax"
  265.                                         "_execute_command"
  266.                                         "_dialect_table"
  267.                                         "_backdenting_conditionals"
  268.                                         "_do_case_syntax"
  269.                                         "_do_while_syntax"
  270.                                         "_adjust_indent_level"
  271.                                         "_indent_shift"
  272.                                         "_command_table"
  273.                                         "_function_table"
  274.                                         "_set_table"
  275.                                         "_comment_conditionals"
  276.                                         "_uncomment_conditionals"
  277.                                         "memv"
  278.                                         "@"
  279.                                         "_complete_conditional"
  280.                                         "_cond_insert"
  281.                                         "_insert_graphics"
  282.                                         "_frame_component"
  283.                                         "_structure"
  284.                                         "_generate_fields"
  285.                                         "_structure_build"
  286.                                         "writ"
  287.         )
  288.         (set_msg_level 0)
  289.         (if dbr_apx_autoload
  290.             (
  291.                 (string  file_name)
  292.                 (int        file_match)
  293.                 (file_pattern "*.apx")
  294.                 (if (&& (find_file file_name)(! (inq_kbd_char)))
  295.                     (
  296.                         (message "Loading %s into memory..." (upper file_name))
  297.                         (_open_apx_file file_name)
  298.                         ;uncomment the next line if you want to start the apx menu upon loading brief
  299.                         ;(apx)
  300.                         (= file_match 1)
  301.                     )
  302.                 )
  303.                 (message "")
  304.                 (keyboard_flush)
  305.                 (if (! file_match)
  306.                     (_display_popup_message "No APX available!" (upper file_name) 1)
  307.                 )
  308.             )
  309.         )
  310.     )
  311. )
  312. ;***
  313. ;* replacement for F10, performs a lower case on first token and also parses to 4 characters
  314. ;***
  315. (macro function_f10
  316.     (
  317.         (string        _command_string
  318.                         _command_word
  319.                         _command_token
  320.                         _command_parameters
  321.         )
  322.         (if (get_parm 0 _command_string "Command+: ")
  323.             (
  324.                 (if (index _command_string " ")
  325.                     (
  326.                         (= _command_word (ltrim (trim (substr _command_string 1 (index _command_string " ")))))
  327.                         (= _command_token (lower (ltrim (trim (substr _command_string 1 (index _command_string " "))))))
  328.                         (= _command_parameters (ltrim (trim (substr _command_string (index _command_string " ")))))
  329.                     )
  330.                 ;else
  331.                     (
  332.                         (= _command_word (ltrim (trim _command_string)))
  333.                         (= _command_token (lower _command_word))
  334.                         (= _command_parameters "")
  335.                     )
  336.                 )
  337.                 (if (> (strlen _command_token) 4)
  338.                     (= _command_token (substr _command_token 1 4))
  339.                 )
  340.                 (switch (upper _command_token)
  341.                     "DEL"
  342.                         (if (&& (exist _command_parameters)(execute_macro (lower _command_string)))
  343.                             (message "%s has been deleted." (upper _command_parameters))
  344.                         ;else
  345.                             (
  346.                                 (beep)
  347.                                 (if (! (exist _command_parameters))
  348.                                     (error "%s doesn't exist!" (upper _command_parameters))
  349.                                 ;else
  350.                                     (error "Cannot delete %s!" (upper _command_parameters))
  351.                                 )
  352.                             )
  353.                         )
  354.                     "PRIN"
  355.                         (execute_macro "print")
  356.                     "VERS"
  357.                         (if (== (upper _command_string) "VERSION")
  358.                             (message "BRIEF v%d.%d - (c) 1990 by SDC Partners II, L.P." (/ (version) 100)(% (version) 100))
  359.                         ;else
  360.                             (execute_macro "vers")
  361.                         )
  362.                     "CD"
  363.                         (
  364.                             (if (strlen _command_parameters)
  365.                                 (execute_macro (lower _command_string))
  366.                             )
  367.                             (getwd NULL _command_string)
  368.                             (message "%s" _command_string)
  369.                         )
  370.                     "A:"  NULL
  371.                     "B:"  NULL
  372.                     "C:"  NULL
  373.                     "D:"  NULL
  374.                     "E:"  NULL
  375.                     "F:"
  376.                         (
  377.                             (execute_macro (+ "cd " _command_string))
  378.                             (getwd NULL _command_string)
  379.                             (message "%s" _command_string)
  380.                         )
  381.                     NULL
  382.                         (if (inq_macro _command_word)
  383.                             (execute_macro _command_string)
  384.                         ;else
  385.                             (if (inq_macro (lower _command_word))
  386.                                 (execute_macro (+ (+ (lower _command_word) " ") _command_parameters))
  387.                             ;else
  388.                                 (if (inq_macro _command_token)
  389.                                     (execute_macro (+ (+ _command_token " ") _command_parameters))
  390.                                 ;else
  391.                                     (execute_macro _command_string)
  392.                                 )
  393.                             )
  394.                         )
  395.                 )
  396.             )
  397.         )
  398.     )
  399. )
  400. ;***
  401. ;* Replacement for <enter>
  402. ;***
  403. (macro _enter
  404.     (
  405.         (if (== dbr_auto_indent 1)
  406.             (_prg_indent)
  407.         ;else
  408.             (self_insert)
  409.         )
  410.     )
  411. )
  412. ;***
  413. ;* load indenting keyboard for normal dBASE prg's
  414. ;***
  415. (macro _refresh_dialect
  416.     (
  417.         (int                forced_dialect
  418.         )
  419.         (get_parm 0 forced_dialect)
  420.         (if (!= dbr_dialect forced_dialect)
  421.             (_switch_dialect dbr_dialect forced_dialect 0)
  422.         )
  423.     )
  424. )
  425. (macro _switch_buffer
  426.     (
  427.         (if dbr_auto_switch_buffer
  428.             (
  429.                 (string            extension
  430.                 )
  431.                 (inq_names NULL extension NULL)
  432.                 (switch extension
  433.                     "prs"
  434.                         (_refresh_dialect 4)
  435.                     "pgm"
  436.                         (_refresh_dialect 7)
  437.                     "sc"
  438.                         (_refresh_dialect 9)
  439.                     "cmd"
  440.                         (_refresh_dialect 10)
  441.                     "sql"
  442.                         (_refresh_dialect 11)
  443.                     NULL
  444.                         (_refresh_dialect dbr_default_dialect)
  445.                 )
  446.             )
  447.         )
  448.     )
  449. )
  450. (macro .prg_smart_first
  451.     (
  452.         (extern            .prg
  453.                             default
  454.         )
  455.         (int                dialect_number
  456.                             apx_temp_buffer
  457.                             apx_temp_file
  458.         )
  459.         (string            full_name
  460.                             extension
  461.                             _support_type
  462.         )
  463.         (inq_names full_name extension NULL)
  464.         (if (&& (== (inq_message)(+ dbr_version " Programmers Core Enabled."))(== extension "obk"))
  465.             (
  466.                 (_display_popup_message "dBRIEF cannot edit a file with an OBK extension!" "" 1)
  467.                 (exit "y")
  468.             )
  469.         )
  470.         (if (&& (!= extension "")(index "PRG~PGM~CMD~SC ~PRE~PRS~TEM~TLB~FMT~SQL~COD~H  ~FH ~CH " (upper (_pad_right extension 3))))
  471.             (
  472.                 (if (inq_macro (+ "." extension))
  473.                     (execute_macro (+ "." extension))
  474.                 ;else
  475.                     (if (inq_macro ".prg")
  476.                         (.prg)
  477.                     ;else
  478.                         (default)
  479.                     )
  480.                 )
  481.                 (= dbr_indent_level (distance_to_tab))
  482.                 (if (< dbr_indent_level 1)
  483.                     (= dbr_indent_level dbr_indent_default)
  484.                 )
  485.                 (if dbr_auto_switch_buffer
  486.                     (_switch_buffer)
  487.                 )
  488.                 (message "%s Support Enabled [indent=%d]" (_get_dialect_info dbr_dialect 1) dbr_indent_level)
  489.                 (use_local_keyboard _prg_smart)
  490.                 (if (&& (! (exist full_name))(== dbr_auto_header 1))
  491.                     (_pro_header "proghead.cfg")
  492.                 )
  493.             )
  494.         ;else
  495.             (
  496.                 (= apx_temp_buffer (inq_buffer))
  497.                 (if (&& (== extension "")(== dbr_set_ext 1))
  498.                     (
  499.                         (if (index full_name ".")
  500.                             (= full_name (substr full_name 1 (- (index full_name ".") 1)))
  501.                         ;else
  502.                             (+= full_name ".")
  503.                         )
  504.                         (+= full_name (lower (_get_dialect_info dbr_dialect 3)))
  505.                         (set_msg_level 0)
  506.                         (edit_file full_name)
  507.                         (delete_buffer apx_temp_buffer)
  508.                     )
  509.                 ;else
  510.                     (if (== extension "apx")
  511.                         (
  512.                             (edit_file "~apx~.~")
  513.                             (= apx_temp_file (inq_buffer))
  514.                             (delete_buffer apx_temp_buffer)
  515.                             (if (exist full_name)
  516.                                 (_open_apx_file full_name)
  517.                             ;else
  518.                                 (if (== 0 (_create_apx_file (upper full_name)))
  519.                                     (exit "y")
  520.                                 )
  521.                             )
  522.                             (if (!= dbr_apx_file_id 0)
  523.                                 (if (== (_select_apx_program) 1)
  524.                                     (delete_buffer apx_temp_file)
  525.                                 )
  526.                             )
  527.                         )
  528.                     )
  529.                 )
  530.             )
  531.         )
  532.         (return "")
  533.     )
  534. )
  535. (macro .obk
  536.     (
  537.         (if (inq_macro ".prg")
  538.             (.prg)
  539.         ;else
  540.             (default)
  541.         )
  542.         (use_local_keyboard _obk_smart)
  543.     )
  544. )
  545. (macro vers
  546.     (_display_popup_message "%s - (c)1990 by Global Technologies" dbr_version 0)
  547. )
  548. ;***
  549. ;* replacement macros
  550. ;***
  551. (replacement edit_file
  552.     (
  553.         (int                file_match
  554.         )
  555.         (string            file_extension
  556.         )
  557.         (if (|| (== (inq_called) "")(== (inq_called) "_create_apx_program"))
  558.             (
  559.                 (string            file_name
  560.                                     file_path
  561.                                     prompt_str
  562.                 )
  563.                 (if (== dbr_set_ext 0)
  564.                     (sprintf prompt_str "File [No default]: ")
  565.                 ;else
  566.                     (sprintf prompt_str "File [%s-%s def]: " (_get_dialect_info dbr_dialect 1) (_get_dialect_info dbr_dialect 3))
  567.                 )
  568.                 (if (get_parm 0 file_name prompt_str)
  569.                     (if (index (upper file_name) ".APX")
  570.                         (if (exist file_name)
  571.                             (
  572.                                 (_open_apx_file file_name)
  573.                                 (apx)
  574.                             )
  575.                         ;else
  576.                             (if (_create_apx_file (upper file_name))
  577.                                 (apx)
  578.                             )
  579.                         )
  580.                     ;else
  581.                         (
  582.                             (if (|| (index file_name "..")(== (substr file_name 1 1) "\\"))
  583.                                 (= file_path (substr file_name 1 (rindex file_name "\\")))
  584.                             ;else
  585.                                 (if (index file_name ":\\")
  586.                                     (= file_path (substr file_name 1 (rindex file_name "\\")))
  587.                                 ;else
  588.                                     (= file_path (substr file_name 1 (rindex file_name ":")))
  589.                                 )
  590.                             )
  591.                             (if (|| (|| (index file_name ".")(== (_get_dialect_info dbr_dialect 3) "NONE")) (== dbr_set_ext 0))
  592.                                 (if (index file_name "*")
  593.                                     (
  594.                                         (file_pattern file_name)
  595.                                         (while (&& (find_file file_name)(! (inq_kbd_char)))
  596.                                             (
  597.                                                 (message "Loading %s into memory..." (upper (+ file_path file_name)))
  598.                                                 (edit_file (+ file_path file_name))
  599.                                                 (= file_match 1)
  600.                                             )
  601.                                         )
  602.                                         (message "")
  603.                                         (keyboard_flush)
  604.                                         (if (! file_match)
  605.                                             (_display_popup_message "No files found matching %s wildcard!" (upper file_name) 1)
  606.                                         )
  607.                                     )
  608.                                 ;else
  609.                                     (
  610.                                         (= file_extension (substr file_name (index file_name ".")))
  611.                                         (if (!= ".OBK" (upper file_extension))
  612.                                             (return (edit_file file_name))
  613.                                         ;else
  614.                                             (
  615.                                                 (_display_popup_message "dBRIEF cannot edit a file with an OBK extension!" "" 1)
  616.                                                 (return -1)
  617.                                             )
  618.                                         )
  619.                                     )
  620.                                 )
  621.                             ;else
  622.                                 (return (edit_file (+ (trim file_name) (+ "." (_get_dialect_info dbr_dialect 3)))))
  623.                             )
  624.                         )
  625.                     )
  626.                 )
  627.             )
  628.         ;else
  629.             (return (edit_file))
  630.         )
  631.     )
  632. )
  633. (replacement read_file
  634.     (
  635.         (if (== (inq_called) "")
  636.             (
  637.                 (string            file_name
  638.                 )
  639.                 (if (== dbr_set_ext 0)
  640.                     (sprintf temp_str "File [No default]: ")
  641.                 ;else
  642.                     (sprintf temp_str "File [%s default]: " (_get_dialect_info dbr_dialect 3))
  643.                 )
  644.                 (if (get_parm 0 file_name temp_str)
  645.                     (if (|| (|| (index file_name ".")(== (_get_dialect_info dbr_dialect 3) "NONE")) (== dbr_set_ext 0))
  646.                         (return (read_file file_name))
  647.                     ;else
  648.                         (return (read_file (+ (trim file_name) (+ "." (_get_dialect_info dbr_dialect 3)))))
  649.                     )
  650.                 )
  651.             )
  652.         ;else
  653.             (return (read_file))
  654.         )
  655.     )
  656. )
  657. (replacement print
  658.     (
  659.         (if (|| (== (inq_called) "")(== (inq_called) "assist"))
  660.             (
  661.                 (if (inq_marked)
  662.                     (return (print))
  663.                 ;else
  664.                     (
  665.                         (inq_names temp_str NULL NULL)
  666.                         (if (get_parm 0 temp_str "File name to print: " NULL temp_str)
  667.                             (
  668.                                 (if (index (upper temp_str) ".DBF")
  669.                                     (_structure NULL (substr temp_str 1 (- (index temp_str ".") 1)) "P")
  670.                                 ;else
  671.                                     (_print_source temp_str)
  672.                                 )
  673.                             )
  674.                         )
  675.                     )
  676.                 )
  677.             )
  678.         ;else
  679.             (return (print))
  680.         )
  681.     )
  682. )
  683. (macro _ctrl_f
  684.     (
  685.         (if (inq_marked)
  686.             (
  687.                 (if (== (inq_marked) 2)
  688.                     (_frame)
  689.                 ;else
  690.                     (writ)
  691.                 )
  692.             )
  693.         ;else
  694.             (insert "~frame~")
  695.         )
  696.     )
  697. )
  698. (macro _alt_equals_sign
  699.     (
  700.         (if (== (inq_marked) 2)
  701.             (_substitute_window_coordinates)
  702.         ;else
  703.             (if (== (_reverse_window_coordinates) 0)
  704.                 (_process_library_call)
  705.             )
  706.         )
  707.     )
  708. )
  709. (macro _case_insert
  710.     (
  711.         (string        insert_string
  712.         )
  713.         (int            reposition_cursor
  714.                         relational_move
  715.                         character_case
  716.         )
  717.         (get_parm 0 insert_string)
  718.         (get_parm 1 reposition_cursor)
  719.         (get_parm 2 relational_move)
  720.         (get_parm 3 character_case)
  721.         (if reposition_cursor
  722.             (move_abs curr_indent_line curr_indent_col)
  723.         )
  724.         (move_rel 0 (* -1 relational_move))
  725.         (delete_to_eol)
  726.         (if (|| (& (inq_kbd_flags) 0x43) character_case)
  727.             (insert insert_string)
  728.         ;else
  729.             (insert (lower insert_string))
  730.         )
  731.         (if reposition_cursor
  732.             (move_abs 0 curr_indent_col)
  733.         )
  734.     )
  735. )
  736. ;***
  737. ;* dialect manager macros
  738. ;***
  739. (macro _get_dialect_info
  740.     (
  741.         (int            dialect
  742.                         info_type
  743.         )
  744.         (get_parm 0 dialect)
  745.         (get_parm 1 info_type)
  746.         (switch info_type
  747.             1
  748.                 ;*** return the dialect name
  749.                 (switch dialect
  750.                     1
  751.                         (return "Clipper Summer '87")
  752.                     2
  753.                         (return "Force")
  754.                     3
  755.                         (return "dBASE III Plus")
  756.                     4
  757.                         (return "dBASE IV")
  758.                     5
  759.                         (return "FoxBASE+")
  760.                     6
  761.                         (return "FoxPro")
  762.                     7
  763.                         (return "Vulcan")
  764.                     8
  765.                         (return "dbXL/Quicksilver")
  766.                     9
  767.                         (return "Paradox")
  768.                     10
  769.                         (return "R:BASE")
  770.                     11
  771.                         (return "Oracle")
  772.                     12
  773.                         (return "Clipper 5.0")
  774.                     )
  775.             2
  776.                 ;*** return the dialect macro
  777.                 (switch dialect
  778.                     1        NULL
  779.                     12
  780.                         (return "clipper")
  781.                     2
  782.                         (return "force")
  783.                     3        NULL
  784.                     4
  785.                         (return "dbase")
  786.                     5        NULL
  787.                     6
  788.                         (return "foxpro")
  789.                     7
  790.                         (return "vulcan")
  791.                     8
  792.                         (return "dbxl")
  793.                     9
  794.                         (return "paradox")
  795.                     10
  796.                         (return "rbase")
  797.                     11
  798.                         (return "oracle")
  799.                     )
  800.             3
  801.                 ;*** return the dialect extension
  802.                 (switch dialect
  803.                     1  NULL
  804.                     2  NULL
  805.                     3  NULL
  806.                     4  NULL
  807.                     5  NULL
  808.                     6    NULL
  809.                     8  NULL
  810.                     12 NULL
  811.                     13
  812.                         (return dbr_def_file_ext)
  813.                     7
  814.                         (return "PGM")
  815.                     9
  816.                         (return "SC")
  817.                     10
  818.                         (return "CMD")
  819.                     11
  820.                         (return "SQL")
  821.                 )
  822.             4
  823.                 ;*** return the executable name
  824.                 (switch dialect
  825.                     1  NULL
  826.                     12
  827.                         (return "clipper ")
  828.                     2
  829.                         (return "force ")
  830.                     3
  831.                         (return "dbase ")
  832.                     4
  833.                         (return "dbase /t ")
  834.                     5
  835.                         (return "foxplus ")
  836.                     6
  837.                         (return "foxpro ")
  838.                     7
  839.                         (return "vulcan ")
  840.                     8
  841.                         (return "dbxl ")
  842.                     9
  843.                         (return "paradox ")
  844.                     10
  845.                         (return "rbase ")
  846.                     11
  847.                         (return "oracle")
  848.                 )
  849.             5
  850.                 ;*** return whether it's a compiler or interpreter
  851.                 (switch dialect
  852.                     1  NULL
  853.                     2  NULL
  854.                     12
  855.                         (return 1)
  856.                     3  NULL
  857.                     4  NULL
  858.                     5  NULL
  859.                     6  NULL
  860.                     7  NULL
  861.                     8  NULL
  862.                     9  NULL
  863.                     10 NULL
  864.                     11
  865.                         (return 0)
  866.                 )
  867.             6
  868.                 ;*** return whether there is display structure support
  869.                 (switch dialect
  870.                     1  NULL
  871.                     2  NULL
  872.                     3  NULL
  873.                     4  NULL
  874.                     5  NULL
  875.                     6  NULL
  876.                     8  NULL
  877.                     9  NULL
  878.                     12
  879.                         (return 1)
  880.                     7  NULL
  881.                     10 NULL
  882.                     11
  883.                         (return 0)
  884.                 )
  885.         )
  886.     )
  887. )
  888. (macro _list_uses
  889.     (
  890.         (int row1
  891.               col1
  892.               row2
  893.               col2
  894.         )
  895.         (string word)
  896.         (if (inq_marked row1 col1 row2 col2)
  897.             (
  898.                 (raise_anchor)
  899.                 (if (== row1 row2)
  900.                     (
  901.                         (move_rel 0 (- (- col1 col2) 1))
  902.                         (= word (read (+ (- col2 col1) 1)))
  903.                     )
  904.                 ;else
  905.                     (_display_popup_message "Invalid mark for scan operation!" "" 1)
  906.                 )
  907.             )
  908.         ;else
  909.             (
  910.                 (inq_position row1 col1)
  911.                 (search_fwd "[ \t\x0c\n]\\c[~ \t\x0c\n]" 1 1)
  912.                 (inq_position row2 col2)
  913.                 (move_abs row1 col1)
  914.                 (if (== row1 row2)
  915.                     (= word (trim (read (- col2 col1))))
  916.                 ;else
  917.                     (
  918.                         (end_of_line)
  919.                         (inq_position row2 col2)
  920.                         (move_abs row1 col1)
  921.                         (= word (trim (read (- col2 col1))))
  922.                     )
  923.                 )
  924.                 (move_abs row1 col1)
  925.             )
  926.         )
  927.         (if (strlen word)
  928.             (
  929.                 (int _temp_reg)
  930.                 (extern _reg_exp)
  931.                 (= _temp_reg _reg_exp)
  932.                 (= _reg_exp 0)
  933.                 (scan word)
  934.                 (= _reg_exp _temp_reg)
  935.             )
  936.         )
  937.     )
  938. )
  939. (macro _alt_up
  940.     (_find_constant)
  941. )
  942.