home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / ME494-6.ZIP / MEUTIL3.SRC < prev    next >
Encoding:
Text File  |  1990-06-04  |  54.1 KB  |  1,642 lines

  1. $MACRO_FILE MEUTIL3;
  2. {******************************************************************************
  3.                                                     MULTI-EDIT MACRO FILE MEUTIL3
  4.  
  5. MEMENUS                    - The main menu system
  6. FILEMENU                - The file menu
  7. WINDMENU                - The window operations menu
  8. BLCKMENU                - The block operations menu
  9. CPMENU                    - The cut and paste buffer operations menu
  10. SRCHMENU                - Search menu
  11. CASEMENU                - The change case menu
  12. SORTMENU                - The text sort menu
  13. TEXTMENU                - The text menu
  14. CURSRMENU                - The cursor menu
  15. USERSETTABS            - Prompts the user for a new fixed tab spacing.
  16. LAYMENU                    - The layout menu
  17. MACMENU                    - The macro menu
  18. LOADMACRO                - Prompts for a macro file to load
  19. LISTMACS                - Creates a list of macros
  20. LISTGLOB                - Creates a list of global variables
  21. MISCMENU                - The "other" menu
  22. USER                        - The user menu
  23. PRINTSTR                - Sends a string to the printer
  24. PRINT_FILE_BLOCK- Sends a file or marked block to the printer
  25. OPEN_CLOSE_FILE    - Opens or closes a file or device
  26. PRINT                        - The Printing menu
  27. PRINT_CODE_MENU    - The printer code selection menu
  28. NOTINC                    - Presents an "Option not included" message
  29.  
  30.                              (C) Copyright 1989 by American Cybernetics, Inc.
  31. ******************************************************************************}
  32.  
  33. $MACRO MEMENUS;
  34. {*******************************MULTI-EDIT MACRO******************************
  35.  
  36. Name: MEMENUS
  37.  
  38. Description:  The main menu.
  39.  
  40.                              (C) Copyright 1989 by American Cybernetics, Inc.
  41. ******************************************************************************}
  42.     def_int( jx,y, count );
  43.     set_global_int('MENU_LEVEL', 0);
  44.     push_labels;
  45.     jx := 1;
  46.     y := menu_bar_row;
  47.     IF y = 0 THEN
  48.         y := 2;
  49.          jx := 0;
  50.     END;
  51.     Create_Global_Str('0ISTR_1','/H=FL/M=FileMenu');
  52.     Create_Global_Str('X0ISTR_1','File');
  53.     Create_Global_Str('0ISTR_2','/H=WN/M=WindMenu');
  54.     Create_Global_Str('X0ISTR_2','Window');
  55.     Create_Global_Str('0ISTR_3','/H=BL/M=BlckMenu');
  56.     Create_Global_Str('X0ISTR_3','Block');
  57.     Create_Global_Str('0ISTR_4','/H=CURSMENU/M=CursrMenu');
  58.     Create_Global_Str('X0ISTR_4','Cursor');
  59.     Create_Global_Str('0ISTR_5','/H=SR/M=SrchMenu');
  60.     Create_Global_Str('X0ISTR_5','Search');
  61.     Create_Global_Str('0ISTR_6','/H=TEXTMENU/M=TextMenu');
  62.     Create_Global_Str('X0ISTR_6','Text');
  63.     Create_Global_Str('0ISTR_7','/H=LAYOUT/M=LayMenu');
  64.     Create_Global_Str('X0ISTR_7','Layout');
  65.     Create_Global_Str('0ISTR_8','/H=PR/M=Print');
  66.     Create_Global_Str('X0ISTR_8','Print');
  67.     Create_Global_Str('0ISTR_9','/H=MC/M=MacMenu');
  68.     Create_Global_Str('X0ISTR_9','Macro');
  69.     Create_Global_Str('0ISTR_10','/H=IN/S=2/M=Setup');
  70.     Create_Global_Str('X0ISTR_10','Install');
  71.     Create_Global_Str('0ISTR_11','/H=OTHER/M=MiscMenu');
  72.     Create_Global_Str('X0ISTR_11','Other');
  73.     Create_Global_Str('0ISTR_12','/H=QUIT/S=2/M=Exit');
  74.     Create_Global_Str('X0ISTR_12','Quit');
  75.     count := 12;
  76.  
  77.     RM('USERIN^TOPMENU /M=X0ISTR_/G=0ISTR_/#=' + str(count) + '/X=1/Y=' + str(y) +
  78.                         '/S=' + global_str('0ISTR_0')+ '/L=MAIN/B=' + str(jx));
  79.  
  80.     jx := 0;
  81.     while jx < 11 do
  82.         ++ jx;
  83.         set_global_str('0ISTR_' + str(jx), '');
  84.         set_global_str('X0ISTR_' + str(jx), '');
  85.     end;
  86.     update_status_line;
  87.     draw_menu_bar;
  88.     set_global_int('MENU_LEVEL', 0);
  89.     pop_labels;
  90. END_MACRO;
  91.  
  92. $MACRO FILEMENU;
  93. {*******************************MULTI-EDIT MACRO******************************
  94.  
  95. Name: FILEMENU
  96.  
  97. Description:  The file menu.
  98.  
  99.                              (C) Copyright 1989 by American Cybernetics, Inc.
  100. ******************************************************************************}
  101.     def_str( gstr[20] );
  102.  
  103.     gstr := '!FM!_';
  104.     Create_Global_Str(gstr+'1','/M=meutil1^LOADFILE /E=1');
  105.   Create_Global_Str(gstr+'X1','Edit new file...                 ^' + global_str('!FM_KEY1'));
  106.     Create_Global_Str(gstr+'2','/M=meutil1^LOADFILE');
  107.   Create_Global_Str(gstr+'X2','Load file into current window... ^' + global_str('!FM_KEY2'));
  108.     Create_Global_Str(gstr+'3','/M=meutil1^SAVEFILE /NP=1');
  109.   Create_Global_Str(gstr+'X3','Save file in current window      ^' + global_str('!FM_KEY3'));
  110.     Create_Global_Str(gstr+'4','/M=meutil1^SAVEFILE');
  111.   Create_Global_Str(gstr+'X4','save file As...                  ^' + global_str('!FM_KEY4'));
  112.     Create_Global_Str(gstr+'5','/M=meutil1^FILESTAT');
  113.   Create_Global_Str(gstr+'X5','Information about current file...^' + global_str('!FM_KEY5'));
  114.     Create_Global_Str(gstr+'6','');
  115.     Create_Global_Str(gstr+'X6','|254');
  116.     Create_Global_Str(gstr+'7','/M=meutil1^SPLICE');
  117.   Create_Global_Str(gstr+'X7','Merge file from disk...          ^' + global_str('!FM_KEY7'));
  118.     Create_Global_Str(gstr+'8','/M=meutil1^SAVEBLCK');
  119.     IF block_stat <> 0 THEN
  120.       Create_Global_Str(gstr+'X8','save Block to disk...            ^' + global_str('!FM_KEY8'));
  121.     ELSE
  122.       Create_Global_Str(gstr+'X8','(save Block to disk...           ^' + global_str('!FM_KEY8') + ')|254');
  123.     END;
  124.     Create_Global_Str(gstr+'9','');
  125.     Create_Global_Str(gstr+'X9','|254');
  126.     Create_Global_Str(gstr+'10','/S=2/M=DIRSHELL');
  127.   Create_Global_Str(gstr+'X10','DOS directory shell              ^' + global_str('!FM_KEY10'));
  128.   Create_Global_Str(gstr+'11','/S=2/M=Exit');
  129.   Create_Global_Str(gstr+'X11','eXit Multi-Edit                  ^' + global_str('!FM_KEY11'));
  130. do_xmenu:
  131.     RM('USERIN^SUBMENU /H=FL/GCLR=1/#=11/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=FILE/G=' + gstr + MParm_Str);
  132.  
  133. END_MACRO;
  134.  
  135. $MACRO WINDMENU;
  136. {*******************************MULTI-EDIT MACRO******************************
  137.  
  138. Name: WINDMENU
  139.  
  140. Description:  The window menu.
  141.  
  142.                              (C) Copyright 1989 by American Cybernetics, Inc.
  143. ******************************************************************************}
  144.     def_str( gstr[20] );
  145.     gstr := '!WNM!_';
  146.     Create_Global_Str(gstr+'1','/S=2/M=WINDOW^WINOP /T=0');
  147.   Create_Global_Str(gstr+'X1','Open        ^' + global_str('!WM_KEY1'));
  148.     Create_Global_Str(gstr+'2','/M=WINDOW^WINOP /T=1');
  149.   Create_Global_Str(gstr+'X2','Close       ^' + global_str('!WM_KEY2'));
  150.  
  151. { {IF you want the old WINDOW MENU Create AND Delete then comment out
  152.    the previous 4 lines and uncomment these lines }
  153.   Create_Global_Str(gstr+'1','/S=2/M=WINDOW^WINOP /T=0');
  154.   Create_Global_Str(gstr+'X1','Create      ^' + global_str('!WM_KEY1'));
  155.     Create_Global_Str(gstr+'2','/M=WINDOW^WINOP /T=1');
  156.   Create_Global_Str(gstr+'X2','Delete      ^' + global_str('!WM_KEY2'));
  157. }
  158.   Create_Global_Str(gstr+'3','/S=2/M=WINDOW^WINOP /T=4');
  159.   Create_Global_Str(gstr+'X3','Split       ^' + global_str('!WM_KEY3'));
  160.   Create_Global_Str(gstr+'4','/S=2/M=WINDOW^WINOP /T=3');
  161.   Create_Global_Str(gstr+'X4','List...     ^' + global_str('!WM_KEY4'));
  162.   Create_Global_Str(gstr+'5','');
  163.   Create_Global_Str(gstr+'X5','|254');
  164.   Create_Global_Str(gstr+'6','/S=2/M=WINDOW^NEXTWIN');
  165.   Create_Global_Str(gstr+'X6','Next        ^' + global_str('!WM_KEY6'));
  166.   Create_Global_Str(gstr+'7','/S=2/M=WINDOW^LASTWIN');
  167.   Create_Global_Str(gstr+'X7','Previous    ^' + global_str('!WM_KEY7'));
  168.   Create_Global_Str(gstr+'8','/S=2/M=WINDOW^ADJACENT_WIN');
  169.  
  170.     RM('WINDOW^SCREEN_SHARE');
  171.     IF (Return_Int) THEN
  172.    Create_Global_Str(gstr+'X8','Adjacent    ^' + global_str('!WM_KEY8'));
  173.     ELSE
  174.    Create_Global_Str(gstr+'X8','(Adjacent    ^' + global_str('!WM_KEY8') + ')|254');
  175.     end;
  176.  
  177.     Create_Global_Str(gstr+'9','');
  178.   Create_Global_Str(gstr+'X9','|254');
  179.   Create_Global_Str(gstr+'10','/S=2/M=WINDOW^WINOP /T=2');
  180.   Create_Global_Str(gstr+'X10','Hide        ^' + global_str('!WM_KEY10'));
  181.   Create_Global_Str(gstr+'11','/S=2/M=WINDOW^WINOP /T=5');
  182.   Create_Global_Str(gstr+'X11','Modify size ^' + global_str('!WM_KEY11'));
  183.   Create_Global_Str(gstr+'12','/S=2/M=WINDOW^WINOP /T=8');
  184.   Create_Global_Str(gstr+'X12','Zoom        ^' + global_str('!WM_KEY12'));
  185.   Create_Global_Str(gstr+'13','');
  186.   Create_Global_Str(gstr+'X13','|254');
  187.   Create_Global_Str(gstr+'14','/M=WINDOW^WINOP /T=6');
  188.   Create_Global_Str(gstr+'X14','linK...     ^' + global_str('!WM_KEY14'));
  189.   Create_Global_Str(gstr+'15','/S=2/M=WINDOW^WINOP /T=7');
  190.     IF (link_stat > 0) THEN
  191.       Create_Global_Str(gstr+'X15','Unlink      ^' + global_str('!WM_KEY15'));
  192.      ELSE
  193.       Create_Global_Str(gstr+'X15','(Unlink     ^' + global_str('!WM_KEY15') + ')|254');
  194.   END;
  195. do_xmenu:
  196.   RM('USERIN^SUBMENU /H=WN/GCLR=1/#=15/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=WINDOW/G=' + gstr + MParm_Str);
  197. END_MACRO;
  198.  
  199.  
  200. $MACRO BLCKMENU;
  201. {*******************************MULTI-EDIT MACRO******************************
  202.  
  203. Name: BLCKMENU
  204.  
  205. Description:  The block menu.
  206.  
  207.                              (C) Copyright 1989 by American Cybernetics, Inc.
  208. ******************************************************************************}
  209.     def_str( gstr[20], bsstr1[1], bsstr2[2] );
  210.     def_int( count );
  211.     gstr := '!BLM!_';
  212.     IF block_stat = 0 THEN
  213.         bsstr1 := '(';
  214.         bsstr2 := ')|254';
  215.     END;
  216.     Create_Global_Str(gstr+'1','/S=2/M=meutil2^BlockOp /BT=0');
  217.   Create_Global_Str(gstr+'X1',bsstr1 + 'Copy block           ^' + global_str('!BM_KEY1') + bsstr2);
  218.     Create_Global_Str(gstr+'2','/S=2/M=meutil2^BlockOp /BT=1');
  219.   Create_Global_Str(gstr+'X2',bsstr1 + 'Move block           ^' + global_str('!BM_KEY2') + bsstr2);
  220.     Create_Global_Str(gstr+'3','/S=2/M=meutil2^BlockOp /BT=2');
  221.   Create_Global_Str(gstr+'X3',bsstr1 + 'Delete block         ^' + global_str('!BM_KEY3') + bsstr2);
  222.     Create_Global_Str(gstr+'4','');
  223.     Create_Global_Str(gstr+'X4','|254');
  224.     Create_Global_Str(gstr+'5','/M=CPmenu /Y=' + str(parse_int('/Y=', mparm_str) + 6));
  225.   Create_Global_Str(gstr+'X5','cut and Paste...     ^' + global_str('!BM_KEY5'));
  226.     Create_Global_Str(gstr+'6','/M=meutil1^SAVEBLCK');
  227.   Create_Global_Str(gstr+'X6',bsstr1 + 'save Block to disk...^' + global_str('!FM_KEY8') + bsstr2);
  228. {
  229.   Create_Global_Str(gstr+'X6',bsstr1 + 'save Block to disk...^' + global_str('!BM_KEY6') + bsstr2);
  230. }
  231.     Create_Global_Str(gstr+'7','/S=2/M=meutil2^indblk');
  232.   Create_Global_Str(gstr+'X7',bsstr1 + 'Indent line block    ^' + global_str('!BM_KEY7') + bsstr2);
  233.     Create_Global_Str(gstr+'8','/S=2/M=meutil2^undblk');
  234.   Create_Global_Str(gstr+'X8',bsstr1 + 'Undent line block    ^' + global_str('!BM_KEY8') + bsstr2);
  235.     Create_Global_Str(gstr+'9','');
  236.     Create_Global_Str(gstr+'X9','|254');
  237.     Create_Global_Str(gstr+'10','/S=2/M=meutil2^BlockOp /BT=3');
  238.   Create_Global_Str(gstr+'X10','Window copy...       ^' + global_str('!BM_KEY10'));
  239.     Create_Global_Str(gstr+'11','/S=2/M=meutil2^BlockOp /BT=4');
  240.   Create_Global_Str(gstr+'X11','window moVe...       ^' + global_str('!BM_KEY11'));
  241.     Create_Global_Str(gstr+'12','');
  242.     Create_Global_Str(gstr+'X12','|254');
  243.     Create_Global_Str(gstr+'13','/M=meutil2^blckmath');
  244.   Create_Global_Str(gstr+'X13',bsstr1 + 'mAth operation...    ^' + global_str('!BM_KEY13') + bsstr2);
  245.     Create_Global_Str(gstr+'14','');
  246.     Create_Global_Str(gstr+'X14','|254');
  247.  
  248.  
  249. do_xmenu:
  250.     IF Marking THEN
  251.         Create_Global_Str(gstr+'15','/S=2/M=meutil2^markblck');
  252.     Create_Global_Str(gstr+'X15','End block            ^' + global_str('!BM_KEY15'));
  253.         count := 15;
  254.     else
  255.         Create_Global_Str(gstr+'15','/S=2/M=meutil2^MarkBlck');
  256.     Create_Global_Str(gstr+'X15','mark Lines of text   ^' + global_str('!BM_KEY15'));
  257.         Create_Global_Str(gstr+'16','/S=2/M=meutil2^MColBlck');
  258.     Create_Global_Str(gstr+'X16','mark cOlumns of text ^' + global_str('!BM_KEY16'));
  259.         Create_Global_Str(gstr+'17','/S=2/M=meutil2^MStrBlck');
  260.     Create_Global_Str(gstr+'X17','mark Stream of text  ^' + global_str('!BM_KEY17'));
  261.         count := 17;
  262.     end;
  263.     if block_stat <> 0 then
  264.         ++count;
  265.         Create_Global_Str(gstr+str(count),'/S=2/M=meutil2^blockoff');
  266.     Create_Global_Str(gstr+'X'+str(count),'turn marking oFf     ^' + global_str('!BM_KEY18'));
  267.     end;
  268.     RM('USERIN^SUBMENU /H=BL/GCLR=1/#='+str(count)+'/S=' +global_str(gstr+'0') +'/M=' + gstr + 'X' + '/L=BLOCK/G=' + gstr + MParm_Str);
  269. END_MACRO;
  270.  
  271. $MACRO CPMENU TRANS;
  272. {*******************************MULTI-EDIT MACRO******************************
  273.  
  274. Name: CPMENU
  275.  
  276. Description:  The cut and paste menu.
  277.  
  278.                              (C) Copyright 1989 by American Cybernetics, Inc.
  279. ******************************************************************************}
  280.     def_str( gstr[20], bsstr1[1], bsstr2[2] );
  281.     IF block_stat = 0 THEN
  282.         bsstr1 := '(';
  283.         bsstr2 := ')|254';
  284.     END;
  285.     gstr := '!CPM!_';
  286.     Create_Global_Str(gstr+'1','/S=2/M=meutil2^Cut');
  287.   Create_Global_Str(gstr+'X1',bsstr1 + 'copy to Buffer           ^' + global_str('!CPM_KEY1') + bsstr2);
  288.     Create_Global_Str(gstr+'2','/S=2/M=meutil2^Cut /M');
  289.   Create_Global_Str(gstr+'X2',bsstr1 + 'cut To buffer            ^' + global_str('!CPM_KEY2') + bsstr2);
  290.     Create_Global_Str(gstr+'3','/S=2/M=meutil2^Cut /A');
  291.   Create_Global_Str(gstr+'X3',bsstr1 + 'Append to buffer         ^' + global_str('!CPM_KEY3') + bsstr2);
  292.     Create_Global_Str(gstr+'4','/S=2/M=meutil2^Cut /A /M');
  293.   Create_Global_Str(gstr+'X4',bsstr1 + 'cut and aPpend to buffer ^' + global_str('!CPM_KEY4') + bsstr2);
  294.     Create_Global_Str(gstr+'5','/S=2/M=meutil2^Paste');
  295.   Create_Global_Str(gstr+'X5','copy From buffer         ^' + global_str('!CPM_KEY5'));
  296.     RM('USERIN^SUBMENU /H=CUTPASTE/A=1/GCLR=1/#=5/S=' +global_str(gstr+'0') +'/M=' + gstr + 'X' + '/L=CUT AND PASTE/G=' + gstr + MParm_Str);
  297.     if return_int > 0 then
  298.         return_int := 100;
  299.     end;
  300. END_MACRO;
  301.  
  302. $MACRO SRCHMENU;
  303. {*******************************MULTI-EDIT MACRO******************************
  304.  
  305. Name: SRCHMENU
  306.  
  307. Description:  The search menu.
  308.  
  309.                              (C) Copyright 1989 by American Cybernetics, Inc.
  310. ******************************************************************************}
  311.     def_str( gstr[20] );
  312.     gstr := '!SRM!_';
  313.     Create_Global_Str(gstr+'1','/M=MEUTIL2^SEARCH');
  314.   Create_Global_Str(gstr+'X1','Search for text...            ^' + global_str('!SRM_KEY1'));
  315.     Create_Global_Str(gstr+'2','/M=MEUTIL2^S_REPL');
  316.   Create_Global_Str(gstr+'X2','search and Replace...         ^' + global_str('!SRM_KEY2'));
  317.     Create_Global_Str(gstr+'3','/M=MEUTIL2^REPSRCH');
  318.   Create_Global_Str(gstr+'X3','repeat Previous search        ^' + global_str('!SRM_KEY3'));
  319.     Create_Global_Str(gstr+'4','');
  320.     Create_Global_Str(gstr+'X4','|254');
  321.     Create_Global_Str(gstr+'5','/M=MEUTIL2^FS');
  322.   Create_Global_Str(gstr+'X5','multiple File search...       ^' + global_str('!SRM_KEY5'));
  323.     Create_Global_Str(gstr+'6','/M=MEUTIL2^FS /N');
  324.   Create_Global_Str(gstr+'X6','List files from last search...^' + global_str('!SRM_KEY6'));
  325. do_xmenu:
  326.     RM('USERIN^SUBMENU /H=SR/GCLR=1/#=6/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=SEARCH/G=' + gstr + MParm_Str);
  327. END_MACRO;
  328.  
  329. $MACRO CASEMENU TRANS;
  330. {*******************************MULTI-EDIT MACRO******************************
  331.  
  332. Name: CASEMENU
  333.  
  334. Description:  The change case menu.
  335.  
  336. Parameters:
  337.                             /U=
  338.                                     0 = Lower case mode
  339.                                     1 = Upper case mode
  340.  
  341.                              (C) Copyright 1989 by American Cybernetics, Inc.
  342. ******************************************************************************}
  343.     def_str( gstr[20], label_str[40], ustr[4] );
  344.  
  345.     gstr := Str(global_int('MENU_LEVEL')) + 'MSTR_';
  346.     if parse_int('/U=', mparm_str) then
  347.         ustr := '/U=1';
  348.         label_str := 'UPPER CASE';
  349.     else
  350.         ustr := '/U=0';
  351.         label_str := 'LOWER CASE';
  352.     end;
  353.  
  354.     Create_Global_Str(gstr+'1','/S=2/N=Line/M=TEXT^CHNGCASE /T=0' + ustr);
  355.     Create_Global_Str(gstr+'2','/S=2/N=Word/M=TEXT^CHNGCASE /T=1' + ustr);
  356.     Create_Global_Str(gstr+'3','/S=2/N=Block/M=TEXT^CHNGCASE /T=2' + ustr);
  357.     RM('USERIN^SUBMENU /H=CNGCASE/GCLR=1/#=3/S=' +global_str(gstr+'0') +'/L=' + label_str + '/G=' + gstr + MParm_Str);
  358.  
  359. END_MACRO;
  360.  
  361. $MACRO SORTMENU TRANS;
  362. {*******************************MULTI-EDIT MACRO******************************
  363.  
  364. Name: SORTMENU
  365.  
  366. Description:  The text sorting menu.
  367.  
  368. Parameters:
  369.                             /X=        The upper left column coordinate
  370.                             /Y=        The upper left row coordinate
  371.                             /BC=    Amount of boxes to kill upon exit.
  372.  
  373. Global Variables:
  374.                             Global_Str('SORTPARMS') stores the following:
  375.                                 /C= The starting column of sort key
  376.                                 /L= Number of character in sort key
  377.                                 /B The sort marked block flag
  378.                                 /CASE Ignore case flag
  379.                                 /D Descending order flag
  380.  
  381.  
  382.                              (C) Copyright 1989 by American Cybernetics, Inc.
  383. ******************************************************************************}
  384.     def_str( gstr[80], ustr[4] );
  385.     def_int( sort_col, sort_length, sort_mode, sort_case, sort_order );
  386.     def_int( x1, y1 );
  387.  
  388.     x1 := parse_int('/X=', mparm_str);
  389.     y1 := parse_int('/Y=', mparm_str);
  390.     gstr := Global_Str('SORTPARMS');
  391.     sort_col := Parse_Int('/C=', gstr);
  392.     sort_length := Parse_Int('/L=', gstr);
  393.     sort_mode := (xpos('/B', gstr, 1) <> 0);
  394.     sort_case := (xpos('/CASE',gstr,1) <> 0);
  395.     sort_order := (xpos('/D', gstr, 1) = 0);
  396.  
  397.   Set_Global_Str('IPARM_1','/T=>>>>/C=1/L=1/TP=6/W=10');
  398.   Set_Global_Str('ISTR_1','START SORT');
  399.     Set_Global_Int('IINT_2',sort_col);
  400.     Set_Global_Str('IPARM_2','/T=Starting column of sort key................./TP=1/C=1/W=4/L=2');
  401.     Set_Global_Int('IINT_3',sort_length);
  402.     Set_Global_Str('IPARM_3','/T=Number of characters in sort key (0 = all)../TP=1/C=1/W=4/L=3');
  403.     Set_Global_Int('IINT_4',sort_mode);
  404.     Set_Global_Str('ISTR_4','/T=YES/F=NO');
  405.     Set_Global_Str('IPARM_4','/T=Sort Marked Block Only....................../C=1/W=3/L=4/TP=5');
  406.     Set_Global_Int('IINT_5',sort_case);
  407.     Set_Global_Str('ISTR_5','/T=YES/F=NO');
  408.     Set_Global_Str('IPARM_5','/T=Ignore Case................................./C=1/W=3/L=5/TP=5');
  409.     Set_Global_Int('IINT_6',sort_order);
  410.     Set_Global_Str('ISTR_6','/T=ASCENDING/F=DESCENDING');
  411.     Set_Global_Str('IPARM_6','/T=Sort order................................../C=1/W=10/L=6/TP=5');
  412.  
  413.     RM('UserIn^Data_In /H=SORTTEXT/S=1/A=3/#=6/X=10/T=TEXT SORT/Y=' + str(y1));
  414.  
  415.     sort_order := global_int('IINT_6');
  416.     sort_case := global_int('IINT_5');
  417.     sort_mode := global_int('IINT_4');
  418.     sort_length := global_int('IINT_3');
  419.     sort_col := global_int('IINT_2');
  420.     gstr := '/C=' + str(sort_col) + '/L=' + str(sort_length);
  421.     if (sort_case) then
  422.         gstr := gstr + '/CASE';
  423.     end;
  424.     if sort_mode then
  425.         gstr := gstr + '/B';
  426.     end;
  427.     if sort_order = 0 then
  428.         gstr := gstr + '/D';
  429.     end;
  430.     set_global_str('SORTPARMS', gstr);
  431.     if return_int then
  432.         X1 := parse_int('/BC=', mparm_str);
  433.         while box_count > x1 do
  434.             kill_box;
  435.         end;
  436.         RM('TEXT^TEXTSORT ' + gstr);
  437.         return_int := 1;
  438.     end;
  439.  
  440. END_MACRO;
  441.  
  442. $MACRO TEXTMENU;
  443. {*******************************MULTI-EDIT MACRO******************************
  444.  
  445. Name: TEXTMENU
  446.  
  447. Description:  The text menu.
  448.  
  449.                              (C) Copyright 1989 by American Cybernetics, Inc.
  450. ******************************************************************************}
  451.     def_str( gstr[20] );
  452.     gstr := '!TXM!_';
  453.     Create_Global_Str(gstr+'1','/S=2/M=TEXT^UNDO');
  454.   Create_Global_Str(gstr+'X1','Undo                  ^' + global_str('!TXM_KEY1'));
  455.     Create_Global_Str(gstr+'2','/S=2/M=TEXT^UNDO /R');
  456.   Create_Global_Str(gstr+'X2','Redo                  ^' + global_str('!TXM_KEY2'));
  457.     Create_Global_Str(gstr+'3','');
  458.     Create_Global_Str(gstr+'X3','|254');
  459.     Create_Global_Str(gstr+'4','/S=1/M=SORTMENU');
  460.   Create_Global_Str(gstr+'X4','Sort text...          ^' + global_str('!TXM_KEY4'));
  461.   Create_Global_Str(gstr+'5','/M=CASEMENU /U=1');
  462.   Create_Global_Str(gstr+'X5','upper Case...         ^' + global_str('!TXM_KEY5'));
  463.     Create_Global_Str(gstr+'6','/M=CASEMENU /U=0');
  464.   Create_Global_Str(gstr+'X6','Lower case...         ^' + global_str('!TXM_KEY6'));
  465.     Create_Global_Str(gstr+'7','/S=2/M=TEXT^CENTER');
  466.   Create_Global_Str(gstr+'X7','cenTer line           ^' + global_str('!TXM_KEY7'));
  467.     Create_Global_Str(gstr+'8','/S=2/M=DATETIME');
  468.   Create_Global_Str(gstr+'X8','Time/date stamp       ^' + global_str('!TXM_KEY8'));
  469.     Create_Global_Str(gstr+'9','/S=2/M=TEXT^RULER');
  470.   Create_Global_Str(gstr+'X9','rulEr                 ^' + global_str('!TXM_KEY9'));
  471.     Create_Global_Str(gstr+'10','');
  472.     Create_Global_Str(gstr+'X10' ,'|254');
  473.     Create_Global_Str(gstr+'11','/S=2/M=TEXT^REFORMAT');
  474.   Create_Global_Str(gstr+'X11' ,'re-Format paragraph   ^' + global_str('!TXM_KEY11'));
  475.     Create_Global_Str(gstr+'12','/S=2/M=TEXT^JUSTIFY');
  476.   Create_Global_Str(gstr+'X12' ,'Justify paragraph     ^' + global_str('!TXM_KEY12'));
  477.     Create_Global_Str(gstr+'13','/S=2/M=TEXT^UNJUSTIF');
  478.   Create_Global_Str(gstr+'X13' ,'uN-justify paragraph  ^' + global_str('!TXM_KEY13'));
  479.     Create_Global_Str(gstr+'14','');
  480.     Create_Global_Str(gstr+'X14' ,'|254');
  481.     Create_Global_Str(gstr+'15','/S=2/M=MEUTIL1^REPEAT');
  482.   Create_Global_Str(gstr+'X15' ,'rePeat command n times^' + global_str('!TXM_KEY15'));
  483. do_xmenu:
  484.     RM('USERIN^SUBMENU /H=TEXTMENU/GCLR=1/#=15/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=TEXT/G=' + gstr + MParm_Str);
  485. END_MACRO;
  486.  
  487. $MACRO CURSRMENU;
  488. {*******************************MULTI-EDIT MACRO******************************
  489.  
  490. Name: CURSMENU
  491.  
  492. Description:  The cursor menu.
  493.  
  494.                              (C) Copyright 1989 by American Cybernetics, Inc.
  495. ******************************************************************************}
  496.     def_str( gstr[20] );
  497.     gstr := '!CRSM!_';
  498.     Create_Global_Str(gstr+'1','/S=2/M=TEXT^MARKPOS');
  499.   Create_Global_Str(gstr+'X1' ,'Push position onto marker stack^' + global_str('!CRSM_KEY1'));
  500.     Create_Global_Str(gstr+'2','/S=2/M=TEXT^GOTOMARK');
  501.   Create_Global_Str(gstr+'X2' ,'Get position from marker stack ^' + global_str('!CRSM_KEY2'));
  502.     Create_Global_Str(gstr+'3','');
  503.     Create_Global_Str(gstr+'X3' ,'|254');
  504.     Create_Global_Str(gstr+'4','/M=TEXT^SET_MARK');
  505.   Create_Global_Str(gstr+'X4' ,'Set random access mark...      ^' + global_str('!CRSM_KEY4'));
  506.     Create_Global_Str(gstr+'5','/M=TEXT^GET_MARK');
  507.   Create_Global_Str(gstr+'X5' ,'Retrieve random access mark... ^' + global_str('!CRSM_KEY5'));
  508.     Create_Global_Str(gstr+'6','');
  509.     Create_Global_Str(gstr+'X6' ,'|254');
  510.     Create_Global_Str(gstr+'7','/M=GOTOLINE');
  511.   Create_Global_Str(gstr+'X7' ,'goto Line number...            ^' + global_str('!CRSM_KEY7'));
  512. do_xmenu:
  513.     RM('USERIN^SUBMENU /H=CURSMENU/GCLR=1/#=7/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=CURSOR POSITION/G=' + gstr + MParm_Str);
  514. END_MACRO;
  515.  
  516. $MACRO USERSETTABS TRANS;
  517. {*******************************MULTI-EDIT MACRO******************************
  518.  
  519. Name: UserSetTabs
  520.  
  521. Description: Prompts the user for a new fixed tab spacing.
  522.  
  523. Parameters:
  524.                          /X=    X coordinate for the prompt box
  525.                          /Y=    Y coordinate for the prompt box
  526.  
  527.                              (C) Copyright 1989 by American Cybernetics, Inc.
  528. ******************************************************************************}
  529.  
  530.     RETURN_INT := XPOS( '|16', format_line, 1 ) - 1;
  531.     IF (Return_Int < 1) THEN
  532.         Return_Int := 1;
  533.     END;
  534.  
  535.     RM('USERIN^QUERYBOX /N=1/T=TAB SPACING/H=CHNGTABS/P=Input the tab spacing(1-99):/W=2/MIN=1/MAX=99' +
  536.             '/C=' + parse_str('/X=', mparm_str) + '/L=' + parse_str('/Y=', mparm_str));
  537.     IF return_str <> 'FALSE' THEN
  538.         RM('SETTABS /TS=' + str( return_int ) );
  539.     END;
  540.     RETURN_INT := 0;
  541. END_MACRO;
  542.  
  543.  
  544. $MACRO LAYMENU;
  545. {*******************************MULTI-EDIT MACRO******************************
  546.  
  547. Name: LAYMENU
  548.  
  549. Description:  The layout menu.
  550.  
  551. Parameters:
  552.                          /X=    X coordinate for the prompt box
  553.                          /Y=    Y coordinate for the prompt box
  554.  
  555.                              (C) Copyright 1989 by American Cybernetics, Inc.
  556. ******************************************************************************}
  557.     def_str( gstr[20], bstr[10] );
  558.     gstr := '!LAYOUT!';
  559.  
  560.     Def_Int(J1,Tx,Ty,J2,J3);
  561.     Def_Str(Tstr1);
  562.  
  563.   refresh := false;
  564.     tx := parse_int('/X=', mparm_str);
  565.     ty := parse_int('/Y=', mparm_str);
  566.     bstr := '';
  567.     j1 := 1;
  568.  
  569. Doc_Menu2:
  570.  {Create_Global_Str(gstr + '1','/H=EDITMODE');}
  571.     Create_Global_Str(gstr + 'X1','Edit mode    ^' +    Copy('    TextDocument',(Doc_Mode * 8) + 1,8));
  572.  {Create_Global_Str(gstr + '2','/H=WORDWRAP');}
  573.     Create_Global_Str(gstr + 'X2','Wordwrap          ^' + Copy('OffOn ',(Wrap_Stat * 3) + 1,3));
  574.     {Create_Global_Str(gstr + '3','/H=INDSTYL');}
  575.     Create_Global_Str(gstr + 'X3','Indent-style... ^' +
  576.                                                          Copy('  Off AutoSmart',(Indent_Style * 5) + 1,5));
  577.     {Create_Global_Str(gstr + '4','/H=RTMARG');}
  578.     Create_Global_Str(gstr + 'X4','right Margin...  ^' + Str(Right_Margin));
  579.     {Create_Global_Str(gstr + '5','/H=REFORMAT');}
  580.     Create_Global_Str(gstr + 'X5','Reformat');
  581.     {Create_Global_Str(gstr + '6','/H=JUSTIFY');}
  582.     Create_Global_Str(gstr + 'X6','Justify');
  583.     {Create_Global_Str(gstr + '7','/H=UNJUST');}
  584.     Create_Global_Str(gstr + 'X7','Unjustify');
  585.     {Create_Global_Str(gstr + '8','/H=EDFMTLIN');}
  586.     Create_Global_Str(gstr + 'X8','edit-Formatline...');
  587.     {Create_Global_Str(gstr + '9','/H=SVFORMATLIN');}
  588.     Create_Global_Str(gstr + 'X9','Save-formatline   ^' +
  589.                                                                              Copy(' NoYes',(Format_Stat * 3) + 1,3));
  590.     {Create_Global_Str(gstr + '10','/H=PRNFORM^FMTCODES');}
  591.     Create_Global_Str(gstr + 'X10','format-Codes...            ^'+ global_str('!LM_KEY10'));
  592.     Create_Global_Str(gstr + '11','/S=2');
  593.     Create_Global_Str(gstr + 'X11','Print-formatter            ');
  594.     Create_Global_Str(gstr + '12','/S=2');
  595.     Create_Global_Str(gstr + 'X12','Auto-setup');
  596.  {Create_Global_Str(gstr + '13','/H=DSPTABS');}
  597.     Create_Global_Str(gstr + 'X13','Display tabs...   ^' + Copy('Off On  ',(display_tabs * 4) + 1,4));
  598.     Create_Global_Str(gstr + '14','/M=UserSetTabs');
  599.     Create_Global_Str(gstr + 'X14','change fixed Tab spacing...');
  600.     RM('USERIN^SUBMENU /H=LAYOUT/GCLR=1/#=14/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=LAYOUT/G=' + gstr + bstr + MParm_Str);
  601.     bstr := '/B=1/BO=1';
  602.     J1 := return_int;
  603.  
  604.     IF J1 = 1 THEN
  605.         Doc_Mode := NOT(Doc_Mode);
  606.         GOTO Doc_Menu2;
  607.   elsIF J1 = 5 THEN
  608.     call clear_box;
  609.         RM( 'TEXT^reformat' );
  610.         GOTO Menu_Exit;
  611.   elsIF J1 = 2 THEN
  612.         Wrap_Stat := NOT(Wrap_Stat);
  613.         GOTO Doc_Menu2;
  614.   elsIF J1 = 3 THEN
  615.     RM('USERIN^XMENU /B=1/L=INDENT STYLE/X=' + str(tx + 4) + '/Y=' + str(ty+4) + '/S=' + str(indent_style + 1) +
  616.                  '/M=Off(LAYOUT)Auto()Smart()');
  617.         j2 := return_int;
  618.         IF j2 > 0 THEN
  619.             Indent_Style := J2 - 1;
  620.             J2 := C_Col;
  621.             Goto_Col(1);
  622.             Set_Indent_Level;
  623.             Goto_Col(J2);
  624.         END;
  625.         Goto Doc_Menu2;
  626.   elsIF J1 = 4 THEN
  627.         Return_Int := Right_Margin;
  628.         RM('userin^QUERYBOX /MIN=1/MAX=2048/N=1/H=RTMARG/C=' + Str(Tx + 6) + '/L=' +
  629.                             Str(Ty + 2) +    '/W=4/T=RIGHT MARGIN');
  630.         IF (Return_Str = 'TRUE') THEN
  631.             Tstr1 := Format_Line;
  632.             J3 := Pos('R',Format_Line);
  633.             If J3 = 0 THEN
  634.                 J3 := Pos('r',Format_Line);
  635.             END;
  636.             If J3 <> 0 THEN
  637.                 Format_Line := Str_Del(Format_Line,J3,1);
  638.                 Format_Line := Str_Ins(' ',Format_Line,J3);
  639.             END;
  640.             Format_Line := Str_Del(Format_Line,Return_Int,1);
  641.             Format_Line := Str_Ins('R',Format_Line,Return_Int);
  642.  
  643.             Right_Margin := Return_Int;
  644.         END;
  645.         GOTO Doc_Menu2;
  646.   elsIF J1 = 6 THEN
  647.     call clear_box;
  648.         RM( 'TEXT^JUSTIFY' );
  649.   elsIF J1 = 7 THEN
  650.     call clear_box;
  651.         RM( 'TEXT^UNJUSTIF' );
  652.   elsIF J1 = 8 THEN
  653.     call clear_box;
  654.         Refresh := True;
  655.         Redraw;
  656.         RM( 'meutil1^EdFormat' );
  657.   elsIF J1 = 9 THEN
  658.         Format_Stat := Not(Format_Stat);
  659.         file_changed := true;
  660.         Goto Doc_Menu2;
  661.   elsIF J1 = 10 THEN
  662.     call clear_box;
  663.         RM( 'document^FCMD' );
  664.   elsIF J1 = 11 THEN
  665.     call clear_box;
  666.         RM( 'document^FPRINT' );
  667.   elsIF J1 = 12 THEN
  668.     call clear_box;
  669.         RM( 'EXTSETUP' );
  670.         return_int := 100;
  671.   elsIF J1 = 13 THEN
  672.         Display_Tabs := Not(Display_Tabs);
  673.         redraw;
  674.         Goto Doc_Menu2;
  675.     END;
  676.   goto menu_exit;
  677.  
  678. clear_box:
  679.   while box_count > 0 DO
  680.     kill_box;
  681.   end;
  682.   ret;
  683.  
  684. menu_exit:
  685.  
  686. END_MACRO;
  687.  
  688. $MACRO MACMENU;
  689. {*******************************MULTI-EDIT MACRO******************************
  690.  
  691. Name: MACMENU
  692.  
  693. Description:  The macro menu.
  694.  
  695.                              (C) Copyright 1989 by American Cybernetics, Inc.
  696. ******************************************************************************}
  697.     def_str( gstr[20] );
  698.  
  699.     gstr := '!MCM!_';
  700.     Create_Global_Str(gstr + '1','/M=meutil1^RUNMAC');
  701.   Create_Global_Str(gstr + 'X1','Run a macro...      ^' + global_str('!MCM_KEY1'));
  702.     Create_Global_Str(gstr + '2','/M=LOADMACRO');
  703.   Create_Global_Str(gstr + 'X2','Load a macro file...^' + global_str('!MCM_KEY2'));
  704.     Create_Global_Str(gstr + '3','/M=MEDEBUG^DEBUG');
  705.   Create_Global_Str(gstr + 'X3','Debug a macro...    ^' + global_str('!MCM_KEY3'));
  706.     Create_Global_Str(gstr+'4','');
  707.     Create_Global_Str(gstr+'X4' ,'|254');
  708.     Create_Global_Str(gstr + '5','/M=LISTMACS');
  709.   Create_Global_Str(gstr + 'X5','list All macros     ^' + global_str('!MCM_KEY5'));
  710.     Create_Global_Str(gstr + '6','/M=LISTGLOB');
  711.   Create_Global_Str(gstr + 'X6','list all Globals    ^' + global_str('!MCM_KEY6'));
  712.     Create_Global_Str(gstr+'7','');
  713.     Create_Global_Str(gstr+'X7' ,'|254');
  714.     Create_Global_Str(gstr + '8','/S=2/M=KEYMAC^KEYMAC_LIST');
  715.   Create_Global_Str(gstr + 'X8','Keystroke macros... ^' + global_str('!MCM_KEY8'));
  716.     RM('USERIN^SUBMENU /H=MC/GCLR=1/#=8/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=MACRO/G=' + gstr + MParm_Str);
  717. END_MACRO;
  718.  
  719. $MACRO LOADMACRO TRANS;
  720. {*******************************MULTI-EDIT MACRO******************************
  721.  
  722. Name: LOADMACRO
  723.  
  724. Description:  Prompts for a macro to load.
  725.  
  726. Parameters:
  727.                             /X= The upper left column coordinate
  728.                             /Y= The upper left row coordinate
  729.                             /BC= Number of boxes to kill upon exit
  730.  
  731.                              (C) Copyright 1989 by American Cybernetics, Inc.
  732. ******************************************************************************}
  733.         def_int(jx);
  734.  
  735.         Return_Str := '';
  736.         RM('userin^USERSTR /HISTORY=MACRO_HISTORY/H=MC/X=' +
  737.                 parse_str('/X=', mparm_str) +
  738.                 '/Y=' + parse_str('/Y=',mparm_str) +
  739.                 '/B=1/W=39/ML=80/BL=Macro file to load');
  740.         IF (Return_Int) THEN
  741.             Load_Macro_File(Return_Str);
  742.             if error_level <> 0 then
  743.                 RM('MEERROR');
  744.                 return_int := 0;
  745.             else
  746.                 jx := parse_int('/BC=', mparm_str);
  747.                 while box_count > jx do
  748.                     kill_box;
  749.                 end;
  750.                 make_message('Macro file "' + return_str + '" loaded.');
  751.                 return_int := 100;
  752.             end;
  753.         END;
  754. END_MACRO;
  755.  
  756. $MACRO LISTMACS TRANS;
  757. {*******************************MULTI-EDIT MACRO******************************
  758.  
  759. Name: LISTMACS
  760.  
  761. Description:  Builds a list of macros currently in memory.
  762.  
  763. Parameters:
  764.                             /X= The upper left column coordinate
  765.                             /Y= The upper left row coordinate
  766.  
  767.                              (C) Copyright 1989 by American Cybernetics, Inc.
  768. ******************************************************************************}
  769.     Def_Str( TStr, mstr );
  770.     Def_Int( str_count, x, y, jx );
  771.     x := parse_int( '/X=', mparm_str );
  772.     y := parse_int( '/Y=', mparm_str );
  773.  
  774.     working;
  775.     mstr := '';
  776.     str_count := 0;
  777.     TStr :=  First_Macro;
  778. Loop:
  779.     IF TStr <> '' THEN
  780.         if svl(mstr) > 200 then
  781.             ++str_count;
  782.             create_global_str('@@' + str(str_count),mstr);
  783.             mstr := '';
  784.         end;
  785.         mstr := mstr + tstr + '(XX)';
  786.         TStr := Next_Macro;
  787.         Goto Loop;
  788.     END;
  789.     if svl(mstr) > 0 then
  790.         ++str_count;
  791.         create_global_str('@@' + str(str_count),mstr);
  792.     end;
  793.     RM('USERIN^DVMENU /P=@@/X=' + str(x) + '/Y=' + str(y) +
  794.             '/T=LOADED MACROS/H=MC/B=1/K=1/I=%/#=' + str(str_count));
  795.     jx := 0;
  796.     while jx < str_count do
  797.         ++jx;
  798.         set_global_str('@@' + str(jx), '');
  799.     end;
  800.     Return_Int := 0;
  801.  
  802. END_MACRO;
  803.  
  804. $MACRO LISTGLOB TRANS;
  805. {*******************************MULTI-EDIT MACRO******************************
  806.  
  807. Name: LISTGLOB
  808.  
  809. Description:  Builds a list of globals currently in memory.
  810.  
  811. Parameters:
  812.                             /X= The upper left column coordinate
  813.                             /Y= The upper left row coordinate
  814.  
  815.                              (C) Copyright 1989 by American Cybernetics, Inc.
  816. ******************************************************************************}
  817.     Def_Str( astr[20], TStr[40] );
  818.     Def_Int( x, y, attr, jx, twindow, tr, tbc );
  819.     x := parse_int( '/X=', mparm_str );
  820.     y := parse_int( '/Y=', mparm_str );
  821.     tbc := box_count;
  822.     tr := refresh;
  823.     refresh := false;
  824.     working;
  825.     twindow := window_id;
  826.     switch_window( window_count );
  827.     create_window;
  828.     aStr :=  First_Global( attr );
  829. Loop:
  830.     IF aStr <> '' THEN
  831.         tstr := astr + copy('                     ', 1, 21 - svl(astr) );
  832.         if attr = 0 then
  833.             tstr := tstr + 'STRING' ;
  834.         else
  835.             tstr := tstr + 'INTEGER' ;
  836.         end;
  837.         if key1 = 27 then
  838.             goto exit;
  839.         end;
  840.         put_line( tstr );
  841.         down;
  842.         aStr := Next_Global( attr );
  843.         Goto Loop;
  844.     END;
  845.     tof;
  846. again:
  847.     call clear_boxs;
  848.     RM('USERIN^DVMENU /WW=35/P=@@/X=' + str(x - 10) + '/Y=' + str(y) + '/WIN=' + str(cur_window) +
  849.             '/T=GLOBAL VARIABLES/H=MC/B=1/K=0/I=%/SN=' + str(c_line));
  850.     IF return_int > 0 THEN
  851.         tstr := shorten_str( copy(return_str,1,20));
  852.         IF copy( return_str, 22, 1) = 'S' THEN
  853.             return_str := global_str( tstr );
  854.             rm('USERIN^QUERYBOX /T=GLOBAL_STR(''' + tstr + ''')/W=70/ML=2048');
  855.             IF return_int THEN
  856.                 set_global_str( tstr, return_str );
  857.             END;
  858.         ELSE
  859.             return_int := GLOBAL_INT( tstr );
  860.             rm('USERIN^QUERYBOX /T=GLOBAL_INT(''' + tstr + ''')/W=20/N=1');
  861.             IF return_str = 'TRUE' THEN
  862.                 set_global_int( tstr, return_int );
  863.             END;
  864.         END;
  865.         Goto again;
  866.     END;
  867.     goto exit;
  868.  
  869. clear_boxs:
  870.     while box_count > tbc do
  871.         kill_box;
  872.     END;
  873.     ret;
  874.  
  875. exit:
  876.     call clear_boxs;
  877.     refresh := false;
  878.     delete_window;
  879.     switch_win_id( twindow );
  880.     Return_Int := 0;
  881.     refresh := tr;
  882. END_MACRO;
  883.  
  884. $MACRO MISCMENU;
  885. {*******************************MULTI-EDIT MACRO******************************
  886.  
  887. Name: MISCMENU
  888.  
  889. Description:  The "OTHER" menu.
  890.  
  891.                              (C) Copyright 1989 by American Cybernetics, Inc.
  892. ******************************************************************************}
  893.     def_str( gstr[20] );
  894.     gstr := '!MIM!_';
  895.     Create_Global_Str(gstr+'1','/S=2/M=USER');
  896.   Create_Global_Str(gstr+'X1','User menu                  ^' + global_str('!MIM_KEY1'));
  897.     Create_Global_Str(gstr+'2','/S=2/M=SETUP');
  898.   Create_Global_Str(gstr+'X2','Installation and setup     ^' + global_str('!MIM_KEY2'));
  899.     Create_Global_Str(gstr+'3','');
  900.     Create_Global_Str(gstr+'X3' ,'|254');
  901.     Create_Global_Str(gstr+'4','/S=2/M=language^compile');
  902.   Create_Global_Str(gstr+'X4','Execute compiler or program^' + global_str('!MIM_KEY4'));
  903.     Create_Global_Str(gstr+'5','/S=2/M=language^cmperror');
  904.   Create_Global_Str(gstr+'X5','find neXt compiler error   ^' + global_str('!MIM_KEY5'));
  905.     Create_Global_Str(gstr+'6','/S=2/M=language^template');
  906.   Create_Global_Str(gstr+'X6','build Template             ^' + global_str('!MIM_KEY6'));
  907.     Create_Global_Str(gstr+'7','/S=2/M=language^match');
  908.   Create_Global_Str(gstr+'X7','Match language structure   ^' + global_str('!MIM_KEY7'));
  909.     Create_Global_Str(gstr+'8','');
  910.     Create_Global_Str(gstr+'X8' ,'|254');
  911.     Create_Global_Str(gstr+'9','/S=2/M=calc');
  912.   Create_Global_Str(gstr+'X9','Calculator                 ^' + global_str('!MIM_KEY9'));
  913.     Create_Global_Str(gstr+'10','/S=2/M=support^ascii');
  914.   Create_Global_Str(gstr+'X10','Ascii table                ^' + global_str('!MIM_KEY10'));
  915.     Create_Global_Str(gstr+'11','/S=2/M=support^condense');
  916.   Create_Global_Str(gstr+'X11','coNdense display           ^' + global_str('!MIM_KEY11'));
  917.     Create_Global_Str(gstr+'12','/S=2/M=meutil1^shelldos');
  918.   Create_Global_Str(gstr+'X12','shell to DOS               ^' + global_str('!MIM_KEY12'));
  919.     Create_Global_Str(gstr+'13','/S=2/M=support^linedraw');
  920.   Create_Global_Str(gstr+'X13','Linedraw                   ^' + global_str('!MIM_KEY13'));
  921.     Create_Global_Str(gstr+'14','');
  922.     Create_Global_Str(gstr+'X14' ,'|254');
  923.     Create_Global_Str(gstr+'15','/S=2/M=mecom^com');
  924.   Create_Global_Str(gstr+'X15','teRminal                   ^' + global_str('!MIM_KEY15'));
  925.     Create_Global_Str(gstr+'16','/M=spell^spell');
  926.   Create_Global_Str(gstr+'X16','Spell check...             ^' + global_str('!MIM_KEY16'));
  927. do_xmenu:
  928.     RM('USERIN^SUBMENU /H=OTHER/GCLR=1/#=16/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=OTHER/G=' + gstr + MParm_Str);
  929. END_MACRO;
  930.  
  931.  
  932. $MACRO USER TRANS;
  933. {*******************************MULTI-EDIT MACRO******************************
  934.  
  935. Name: USER
  936.  
  937. Description:  This macro generates a menu of programs and macros that
  938.     the user may select, add to, delete or modify.
  939.  
  940.                              (C) Copyright 1989 by American Cybernetics, Inc.
  941. ******************************************************************************}
  942.  
  943.     def_int( ct, rs, sm, cmd, jx, old_sr, smem );
  944.     def_str( hf[40] );
  945.     refresh := false;
  946.     RM('USERIN^DB /F=MECONFIG.DB/NOALHPA=1/2TOP=1/DPT=USER.DB/LT=User Menu/LO=2/H=USER/GLO=@USER@');
  947.     IF return_int = 1 THEN
  948.         return_str := parse_str('CMD=', global_str('@USER@'));
  949.         RM( 'XlateCmdLine /F=' + file_name);
  950.         ct := parse_int( 'TYPE=', global_str( '@USER@'));
  951.         IF ct < 2 THEN
  952.             RM( return_str );
  953.         ELSIF ct = 2 THEN
  954.             old_sr := status_row;
  955.             status_row := 0;
  956.             smem := (parse_int('SWAP_MEM=', global_str('@USER@') ) * 1024) / 16;
  957.             sm := parse_int('SWAP=', global_str('@USER@'));
  958.             IF sm > 4 THEN
  959.                 sm := 0;
  960.             END;
  961.             rs := parse_int('REST=', global_str('@USER@')) < 2;
  962.             cmd := parse_int('USECMD=', global_str('@USER@')) < 2;
  963.  
  964.             RM( 'MEUTIL1^EXEC /SWAP=' + str(sm) + '/MEM=' + str(smem) +
  965.                         '/CMD=' + str(cmd) + '/SCREEN=' + str(rs) );
  966.             status_row := old_sr;
  967.             New_Screen;
  968.         ELSIF ct = 3 THEN
  969.             jx := XPOS('^', return_str, 1);
  970.             IF jx = 0 THEN
  971.                 jx := length(return_str);
  972.             END;
  973.             hf := copy( return_str, 1, jx - 1);
  974.             return_str := copy( return_str, jx + 1, 254 );
  975.             update_status_line;
  976.             RM('MEHELP /F=' + hf + '/LK=' + return_str );
  977.         ELSIF ct = 4 THEN
  978.             IF switch_file( caps(return_str) ) THEN
  979.                 make_message( truncate_path(return_str) + ' already loaded.');
  980.             ELSE
  981.                 RM('LDFILES /LC=1');
  982.             END;
  983.         END;
  984.     END;
  985. END_MACRO;
  986.  
  987. $MACRO PRINTSTR TRANS;
  988. {*******************************MULTI-EDIT MACRO******************************
  989.  
  990. Name: PRINTSTR
  991.  
  992. Description:  Sends a string of text to a file or device such as the printer.
  993.  
  994. Parameters:
  995.                             /H= File handle.  Since file handle 0 (Stdin) is perfectly legal,
  996.                                     You MUST include /H=0 if you wish to use Stdin.  If /H= is
  997.                                     not a part of the parameter string, Error_Level will be set.
  998.                                     It is the calling macro's responsibility to be sure the file
  999.                                     or device is open.
  1000.                             /S=
  1001.                                     0 = Normal print
  1002.                                     1 = Check device status before printing
  1003.  
  1004.     Returns:
  1005.                             Will set ERROR_LEVEL if there is an error, however, it is the
  1006.                             calling macro's responsibility to process the error.
  1007.  
  1008.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1009. ******************************************************************************}
  1010.     Def_Str(Temp_Str[2048]);
  1011.     Def_Int(Handle,Byte_Count,Error);
  1012.  
  1013.     IF (XPos('/H=',MParm_Str,1) = 0) THEN
  1014.         Error_Level := 3006;
  1015.         Goto EXIT;
  1016.     END;
  1017.  
  1018.     Handle := Parse_Int('/H=',MParm_Str);
  1019.  
  1020. {Check ready status of file or device}
  1021.     IF (Parse_Int('/S=',MParm_Str)) THEN
  1022.         R_AX := $4407;
  1023.         R_BX := Handle;
  1024.         Intr($21);
  1025.         IF ((R_AX and $00FF) <> $FF) THEN
  1026.             Goto DEVICE_NOT_READY;
  1027.         END;
  1028. {Change character device to "raw" mode.}
  1029.         R_AX := $4400;
  1030.         R_BX := Handle;
  1031.         Intr($21);
  1032.         IF ((R_Flags and $01) = 0) THEN
  1033.             R_DX := (R_DX or $20) and $FF;
  1034.             R_AX := $4401;
  1035.             R_BX := Handle;
  1036.             Intr($21);
  1037.         END;
  1038.     END;
  1039.  
  1040. {Write string to file or device}
  1041.     Error := S_Write_Bytes(Return_Str,Handle,Byte_Count);
  1042.     IF (Error) THEN
  1043.         Error_Level := Error + 3000;
  1044.     ELSE
  1045.         IF (Byte_Count < Length(Return_Str)) THEN
  1046.             Error_Level := 3241;
  1047.         END;
  1048.     END;
  1049.     Goto EXIT;
  1050.  
  1051. DEVICE_NOT_READY:
  1052.     Error_Level := 2002;
  1053.  
  1054. EXIT:
  1055.  
  1056. END_MACRO;
  1057.  
  1058. $MACRO PRINT_FILE_BLOCK TRANS;
  1059. {*******************************MULTI-EDIT MACRO******************************
  1060.  
  1061. Name: PRINT_FILE_BLOCK
  1062.  
  1063. Description:  Sends the current file or currently marked block to the printer.
  1064.  
  1065. Parameters:
  1066.                             /B= If 1, print block else print whole file
  1067.                             /X= The upper left column coordinate
  1068.                             /Y= The upper left row coordinate
  1069.                             /H= Handle of the printer device or file.
  1070.                             /C= Number of copies to print.  Defaults to 1.
  1071.                             /LN= Print line numbers to the left of each line.
  1072.  
  1073.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1074. ******************************************************************************}
  1075.         def_int(ul_col,ul_row,jx,Handle,Copy_Count,Line_Count,
  1076.                         Line_Numbers,Block);
  1077.         def_str(temp_string, margin_str[80], sstr[10] );
  1078.  
  1079.         Copy_Count := Parse_Int('/C=',MParm_Str);
  1080.         Line_Numbers := Parse_Int('/LN=',MParm_Str);
  1081.         Handle := Parse_Int('/H=',MParm_Str);
  1082.         Block := Parse_Int('/B=',MParm_Str);
  1083.  
  1084.         refresh := false;
  1085.         sstr := ' /S=1';
  1086.         jx := 1;
  1087.         margin_str := '';
  1088.         while jx < print_margin do
  1089.             margin_str := margin_str + ' ';
  1090.             ++jx;
  1091.         end;
  1092.  
  1093.         ul_col := parse_int('/X=', mparm_str);
  1094.         if ul_col = 0 then
  1095.             ul_col := 10;
  1096.         end;
  1097.         ul_row := parse_int('/Y=', mparm_str);
  1098.         if ul_row = 0 then
  1099.             ul_row := 6;
  1100.         end;
  1101.  
  1102.         Temp_String := 'PRINTING';
  1103.         IF (Block) THEN
  1104.             If (Block_Stat = 0) THEN
  1105.                 beep;
  1106.                 goto NO_BLOCK;
  1107.             END;
  1108.             Temp_String := Temp_String +' BLOCK';
  1109.             block_end;
  1110.         END;
  1111.  
  1112.         Put_Box(UL_COL,UL_ROW,UL_COL + 26,UL_ROW + 3,0,m_b_color,Temp_String,True );
  1113.         Write('Press <ESC> to abort.',Ul_Col + 1,Ul_Row + 1,0,m_s_Color);
  1114.         Mark_Pos;
  1115.  
  1116. PRINT_AGAIN:
  1117.         IF (Block) THEN
  1118.             GOTO_LINE( BLOCK_LINE1 );
  1119.         ELSE
  1120.             Tof;
  1121.         END;
  1122.         Line_Count := 0;
  1123. PRINT_LINE:
  1124.         ++Line_Count;
  1125.         IF CHECK_KEY THEN
  1126.             IF KEY1 = 27 THEN
  1127.                 Goto EXIT;
  1128.             END;
  1129.         END;
  1130.         Temp_String := Get_Line;
  1131.         Tabs_To_Spaces(Temp_String);
  1132.         IF (Block) THEN
  1133. {Special processing for column and stream block modes}
  1134.             If (BLOCK_STAT = 2) Then
  1135.                 Temp_String := Copy(Temp_String,BLOCK_COL1,(BLOCK_COL2 - BLOCK_COL1) + 1);
  1136.             End;
  1137.             If (BLOCK_STAT = 3) Then
  1138.                 IF (C_LINE = BLOCK_LINE1) THEN
  1139.                     Temp_String := Copy(Temp_String,BLOCK_COL1,255);
  1140.                 END;
  1141.                 IF (C_LINE = BLOCK_LINE2) THEN
  1142.                     IF (C_LINE = BLOCK_LINE1) THEN
  1143.                         Temp_String := Copy(Temp_String,1,(BLOCK_COL2 - BLOCK_COL1) + 1);
  1144.                     ELSE
  1145.                         Temp_String := Copy(Temp_String,1,BLOCK_COL2);
  1146.                     END;
  1147.                 END;
  1148.             End;
  1149.         END;
  1150. {Strip out HARD_CR if present}
  1151.         IF (Hard_Cr <> '|0') THEN
  1152. STRIP_HARD_CR:
  1153.             Jx := XPos(Hard_Cr,Temp_String,1);
  1154.             IF (Jx) THEN
  1155.                 Temp_String := Str_Del(Temp_String,Jx,1);
  1156.                 Goto STRIP_HARD_CR;
  1157.             END;
  1158.         END;
  1159.  
  1160.         IF (Line_Numbers) THEN
  1161.             Return_Str := Margin_Str + Copy(Str(Line_Count) + '        ',1,8) +
  1162.                                         Temp_String + Line_Terminator;
  1163.         ELSE
  1164.             Return_Str := margin_str + temp_string + Line_Terminator;
  1165.         END;
  1166.         Call PRINT_STRING;
  1167.         sstr := ' ';
  1168.         DOWN;
  1169.         IF (Block) THEN
  1170.             IF (C_LINE <= BLOCK_LINE2) THEN
  1171.                 Goto PRINT_LINE;
  1172.             END;
  1173.         ELSE
  1174.             IF (Not(At_Eof)) THEN
  1175.                 Goto PRINT_LINE;
  1176.             END;
  1177.         END;
  1178.  
  1179.         --Copy_Count;
  1180.         IF (Copy_Count > 0) THEN
  1181.             Return_Str := '|13|12';
  1182.             Call PRINT_STRING;
  1183.             Goto PRINT_AGAIN;
  1184.         END;
  1185.         Goto EXIT;
  1186.  
  1187. PRINT_STRING:
  1188.     RM('PRINTSTR' + sstr + '/H=' + Str(Handle));
  1189.     sstr := ' ';
  1190.     IF (Error_Level) THEN
  1191.         Beep;
  1192.         RM('MEERROR^ERRMSG');
  1193.         RM('USERIN^VERIFY /T=Abort printing?/H=PR' + '/BL=ERROR: ' +
  1194.             Caps(Return_Str) + '/C=' + Str(Ul_Col + 2) + '/L=' + Str(Ul_Row + 1));
  1195.         IF (Return_Int = 0) THEN
  1196.             Delay(1000);
  1197.             Goto PRINT_STRING;
  1198.         END;
  1199.         Goto EXIT;
  1200.     END;
  1201.     RET;
  1202.  
  1203. EXIT:
  1204.         Kill_Box;
  1205.         Goto_Mark;
  1206. NO_BLOCK:
  1207.         return_int := 0;
  1208. END_MACRO;
  1209.  
  1210. $MACRO OPEN_CLOSE_FILE TRANS;
  1211. {*******************************MULTI-EDIT MACRO******************************
  1212.  
  1213. Name: OPEN_CLOSE_FILE
  1214.  
  1215. Description:  Opens or closes a file or device.
  1216.  
  1217. Parameters:
  1218.                             /M= Mode    If 1, create new file, if 2 open existing file, if 0,
  1219.                                     close the file.
  1220.                             /FN= File name.  Required if M > 0.
  1221.  
  1222. Returns:
  1223.                             Error_Level > 0 if an error occurred.
  1224.  
  1225.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1226. ******************************************************************************}
  1227.     Def_Int(Open_Mode,Error,Handle);
  1228.     Def_Str(F_Name[80]);
  1229.  
  1230.     Return_Int := 0;
  1231.     Open_Mode := Parse_Int('/M=',MParm_Str);
  1232.     F_Name := Parse_Str('/FN=',MParm_Str);
  1233.     Handle := 0;
  1234.     IF (Open_Mode = 1) THEN
  1235. {Create the file}
  1236.         Error := S_Create_File(F_Name,Handle);
  1237.     ELSIF (Open_Mode = 2) THEN
  1238.         Error := S_Open_File(F_Name,1,Handle);
  1239.     ELSE
  1240.         Error := S_Close_File(Parse_Int('/H=',MParm_Str));
  1241.     END;
  1242.  
  1243.     IF (Error) THEN
  1244.         Error_Level := 3000 + Error;
  1245.     ELSE
  1246.         Return_Int := Handle;
  1247.         Error_Level := 0;
  1248.     END;
  1249.  
  1250. END_MACRO;
  1251.  
  1252. $MACRO PRINT;
  1253. {******************************************************************************
  1254.                                                                 MULTI-EDIT MACRO
  1255.  
  1256.  
  1257. Name:        PRINT
  1258.  
  1259. Description:  This is the print menu.  This provides printing of files and
  1260.     parts of files, and printer control.
  1261.  
  1262. Parameters:
  1263.                             /X= The upper left column coordinate
  1264.                             /Y= The upper left row coordinate
  1265.  
  1266.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1267. ******************************************************************************}
  1268.  
  1269.     Def_Int(Jx,Jy,UL_COL,UL_ROW,T_Line,T_Col,Temp_Integer,Exit_Result,Handle,
  1270.                     error,Copy_Count,Line_Numbers);
  1271.  
  1272.     Def_Str(Control_Codes,Control_Code,Temp_String,Printer_Type[40],
  1273.                     T_Word_Delimits[40], gstr[20], bstr[10],printer_device[40]);
  1274.  
  1275.     T_Word_Delimits := Word_Delimits;
  1276.     Handle := 0;
  1277.     Word_Delimits := '/';
  1278.     gstr := Str(global_int('MENU_LEVEL')) + 'PRNMEN_';
  1279.     bstr := '';
  1280.     REFRESH := FALSE;
  1281.     Exit_Result := 0;
  1282.     Messages := False;
  1283.     Copy_Count := 1;
  1284.     Line_Numbers := 0;
  1285.     ul_col := parse_int('/X=', mparm_str);
  1286.     if ul_col = 0 then
  1287.         ul_col := 10;
  1288.     end;
  1289.     ul_row := parse_int('/Y=', mparm_str);
  1290.     if ul_row = 0 then
  1291.         ul_row := 6;
  1292.     end;
  1293.  
  1294.  
  1295.     Printer_Type := Parse_Str('PT=',Global_Str('PRINTER_TYPE'));
  1296.     If (Printer_Type = '') Then
  1297.         Temp_Integer := 4;
  1298.     Else
  1299.         Temp_Integer := 1;
  1300.     End;
  1301.     printer_device := Global_Str('PRINTER_DEVICE');
  1302.     IF (Printer_device = '') THEN
  1303.         Printer_Device := 'PRN';
  1304.         Set_Global_Str('PRINTER_DEVICE',Printer_device);
  1305.     END;
  1306.  
  1307.     Jx := 1;
  1308.  
  1309.  
  1310. SET_CODES:
  1311.     Printer_Type := Parse_Str('PT=',Global_Str('PRINTER_TYPE'));
  1312. CODES_SET:
  1313.  
  1314. PRINT_MENU:
  1315.  {Create_Global_Str(gstr+'1','/H=PR');}
  1316.     Create_Global_Str(gstr+'X1','print current File             ');
  1317.  {Create_Global_Str(gstr+'2','');}
  1318.     Create_Global_Str(gstr+'X2','print marked Block');
  1319.     {Create_Global_Str(gstr+'3','');}
  1320.     Create_Global_Str(gstr+'X3' ,'|254');
  1321.     {Create_Global_Str(gstr+'4','');}
  1322.     Create_Global_Str(gstr+'X4','printer Setup...');
  1323.     {Create_Global_Str(gstr+'5','');}
  1324.     Create_Global_Str(gstr+'X5','printer Type...^' + printer_type);
  1325.     {Create_Global_Str(gstr+'6','');}
  1326.     Create_Global_Str(gstr+'X6','printer Device/file...^' + printer_device);
  1327.     {Create_Global_Str(gstr+'7','');}
  1328.     Create_Global_Str(gstr+'X7' ,'|254');
  1329.     {Create_Global_Str(gstr+'8','');}
  1330.     Create_Global_Str(gstr+'X8','Copies to print...^' + Str(Copy_Count));
  1331.     {Create_Global_Str(gstr+'9','');}
  1332.     Create_Global_Str(gstr+'X9','Line numbering ^' + Copy('OffOn',(Line_Numbers * 3) + 1,3));
  1333.     {Create_Global_Str(gstr+'10','');}
  1334.     Create_Global_Str(gstr+'X10','print Margin...^' + Str(Print_Margin));
  1335.     {Create_Global_Str(gstr+'11','');}
  1336.     Create_Global_Str(gstr+'X11','eject Page');
  1337.     RM('USERIN^SUBMENU /H=PR/GCLR=1/#=11/M=' + GSTR + 'X/S=' +global_str(gstr+'0') +'/L=PRINT/G=' + gstr + bstr + MParm_Str);
  1338.     bstr := '/B=1/BO=1';
  1339.     temp_integer := return_int;
  1340.  
  1341.     IF Temp_Integer <= 0 THEN
  1342.         exit_result := temp_integer;
  1343.         Goto END_OF_MAC;
  1344.     END;
  1345.  
  1346.     IF ((Temp_Integer = 1) or (Temp_Integer = 2) or (Temp_Integer = 10)) THEN
  1347.         IF (Handle = 0) THEN
  1348.             Call OPEN_PRINTER_DEVICE;
  1349.             IF (Error) THEN
  1350.                 Goto PRINT_MENU;
  1351.             END;
  1352.         END;
  1353.     END;
  1354.  
  1355.     IF (Temp_Integer = 1) THEN
  1356.         RM('PRINT_FILE_BLOCK /C=' + str(Copy_Count) + '/H=' + Str(Handle) + '/LN='
  1357.             + Str(Line_Numbers));
  1358.         RM('OPEN_CLOSE_FILE /H=' + Str(Handle));
  1359.         Handle := 0;
  1360.     END;
  1361.  
  1362.     IF (Temp_Integer = 2) THEN
  1363.         RM('PRINT_FILE_BLOCK /B=1/C=' + str(Copy_Count) + '/H=' + Str(Handle) + '/LN='
  1364.             + Str(Line_Numbers));
  1365.     END;
  1366.  
  1367.     IF (Temp_Integer = 6) THEN {Printer Device}
  1368.         RM('USERIN^DB /PRE=PRN/F=MECONFIG.DB/DPT=PRN_DEV.DB/LO=1/U=1/LT=PRINTER DEVICE//FILE/H=PR/X=' + str(ul_col + 1) +
  1369.                                         '/Y=' + str( ul_row + 10));
  1370.         IF (Return_Int) THEN
  1371. {If they change the printer type, we need to save this in install.}
  1372.             IF (Return_Str <> Printer_Device) THEN
  1373.                 Set_Global_Int('SETUP_CHANGED',Global_Int('SETUP_CHANGED') or $01);
  1374.             END;
  1375.             Printer_Device := Return_Str;
  1376.             Set_Global_Str('PRINTER_DEVICE',Printer_device);
  1377.             IF (Handle) THEN
  1378.                 RM('OPEN_CLOSE_FILE /H=' + Str(Handle));
  1379.                 Handle := 0;
  1380.             END;
  1381.         END;
  1382.         Goto PRINT_MENU;
  1383.     END;
  1384.  
  1385.     IF (Temp_Integer = 4) THEN {Printer setup}
  1386.         If (Printer_Type = '') Then
  1387. {Choice is invalid if no printer type is defined}
  1388.             Call WRONG;
  1389.             Goto PRINT_MENU;
  1390.         End;
  1391.         Call SETUP_MENU;
  1392.         Goto PRINT_MENU;
  1393.     END;
  1394.  
  1395.     IF (Temp_Integer = 8) THEN {Number of copies to print}
  1396.         Return_Int := Copy_Count;
  1397.         RM('userin^QUERYBOX /MIN=0/MAX=999/N=1/P=         /H=PR/C=' +
  1398.                             Str(Ul_Col + 2) + '/L='
  1399.                             + Str(Ul_Row + 9) + '/W=3/T=NUMBER OF COPIES');
  1400.         IF (Return_Str = 'TRUE') THEN
  1401.             Copy_Count := Return_Int;
  1402.         End;
  1403.         Goto PRINT_MENU;
  1404.     END;
  1405.  
  1406.     IF (Temp_Integer = 9) THEN {Line Numbering}
  1407.         Line_Numbers := Not(Line_Numbers);
  1408.         Goto PRINT_MENU;
  1409.     END;
  1410.  
  1411.     IF (Temp_Integer = 10) THEN {Print margin}
  1412.         Return_Int := Print_Margin;
  1413.         RM('userin^QUERYBOX /MIN=0/MAX=133/N=1/P=         /H=PR/C=' +
  1414.                             Str(Ul_Col + 2) + '/L='
  1415.                             + Str(Ul_Row + 10) + '/W=3/T=PRINT MARGIN');
  1416.         IF (Return_Str = 'TRUE') THEN
  1417.             Print_Margin := Return_Int;
  1418.         End;
  1419.         Goto PRINT_MENU;
  1420.     END;
  1421.  
  1422.     If (Temp_Integer = 5) Then {Select printer type}
  1423.         RM( 'setup^Prttype ' + '/X=' + Str(Ul_Col + 1) + '/Y=' + Str(Ul_Row + 6));
  1424.         Goto SET_CODES;
  1425.     End;
  1426.  
  1427.     If (Temp_Integer = 11) THEN
  1428.         Call EJECT_PAGE;
  1429.     END;
  1430.  
  1431.     Goto PRINT_MENU;
  1432.  
  1433. EJECT_PAGE:
  1434.     IF (Handle = 0) THEN
  1435.         Call OPEN_PRINTER_DEVICE;
  1436.         IF (Error) THEN
  1437.             Ret;
  1438.         END;
  1439.     END;
  1440. {Move to end of existing file.  This is intended for files only, but it
  1441. seems to generate a benign error code 6.  Unless the error turns out to cause
  1442. a problem, I don't see any need to check to see if the handle is a file or a
  1443. device}
  1444.     Error := S_Move_File_Ptr(handle,2,0);
  1445.  
  1446.     Return_Str := '|12';
  1447.     RM('PRINTSTR /S=1/H=' + Str(Handle));
  1448.     IF (Error_Level) THEN
  1449.         RM('Meerror');
  1450.     END;
  1451.     RET;
  1452.  
  1453. OPEN_PRINTER_DEVICE:
  1454.     Error := 0;
  1455. {Open the printer device/file.  Try to open an existing file first.}
  1456.     RM('OPEN_CLOSE_FILE /M=2/FN=' + Global_Str('PRINTER_DEVICE'));
  1457.     IF (Error_Level) THEN
  1458. {If it doesn't exist, create.}
  1459.         IF (Error_Level = 3002) THEN
  1460.             RM('OPEN_CLOSE_FILE /M=1/FN=' + Global_Str('PRINTER_DEVICE'));
  1461.             IF (Error_Level = 0) THEN
  1462.                 Goto OPEN_OK;
  1463.             END;
  1464.         END;
  1465.         RM('MEERROR');
  1466.         Error := 1;
  1467.         Ret;
  1468.     END;
  1469. OPEN_OK:
  1470.     Handle := Return_Int;
  1471.     Ret;
  1472.  
  1473. WRONG:
  1474.     Beep;
  1475.     Put_Box( UL_COL, UL_ROW + 3, UL_COL + 29 ,UL_ROW + 6,
  1476.                      0,Error_Color,'ERROR',True );
  1477.     Write('Select printer type first!',Ul_Col + 1,Ul_Row + 4,0,Error_Color);
  1478.     Write('Press any key to continue',Ul_Col + 2,Ul_Row + 5,0,Error_Color);
  1479.     Read_Key;
  1480.     Kill_Box;
  1481.     Temp_Integer := 7;
  1482.     RET;
  1483.  
  1484. SETUP_MENU:
  1485.     RM('PRINT_CODE_MENU /C=1/X=' + str(ul_col + 1) + '/Y=' + str( ul_row + 5));
  1486.     IF (Return_Int = -1) THEN
  1487.         RET;
  1488.     END;
  1489.     IF (Parse_Str('/C=',Return_Str) <> '') THEN
  1490.         IF (Handle = 0) THEN
  1491.             Call OPEN_PRINTER_DEVICE;
  1492.             IF (Error) THEN
  1493.                 Ret;
  1494.             END;
  1495.         END;
  1496.  
  1497.         Return_Str := Parse_Str('/C=',Return_Str);
  1498.         RM('PRINTSTR /S=1/H=' + Str(Handle));
  1499.         IF (Error_Level) THEN
  1500.             RM('Meerror');
  1501.         END;
  1502.     ELSE
  1503.         Error_Level := 2010;
  1504.         RM('MEERROR /EM=PRINTER CODE FOR: ' + Parse_Str('/N=',Return_Str) + ' NOT FOUND');
  1505.     END;
  1506.     RET;
  1507.  
  1508.     END_OF_MAC:
  1509.     IF (Handle) THEN
  1510.         RM('OPEN_CLOSE_FILE /H=' + Str(Handle));
  1511.     END;
  1512.  
  1513.     if error_level <> 0 then
  1514.         RM('MEERROR');
  1515.     end;
  1516.     Word_Delimits := T_Word_Delimits;
  1517.     Return_Int := Exit_Result;
  1518.     Messages := True;
  1519. END_MACRO;
  1520.  
  1521. $MACRO PRINT_CODE_MENU TRANS;
  1522. {*******************************MULTI-EDIT MACRO******************************
  1523.  
  1524. Name: PRINT_CODE_MENU
  1525.  
  1526. Description:  Provides a menu of printer codes from the currently selected
  1527.                             printer type.
  1528.  
  1529. Parameters:
  1530.                              /F=1 will only display printer code names that have print
  1531.                              formatter codes associated with them.
  1532.                              /C=1 will only display printer code names that have printer
  1533.                              escape sequences associated with them.
  1534.  
  1535. Returns:
  1536.     Return_Str:
  1537.                              /N=    The name of the selected code
  1538.                              /F=  The print format code
  1539.                              /C=  The printer escape sequence for that code
  1540.  
  1541.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1542. ******************************************************************************}
  1543.     Def_Int(Counter,Format_Only,Code_Only,Choice);
  1544.     Def_Str(TStr[2048],SStr[90],Code_Name[20] );
  1545.  
  1546.     Format_Only := Parse_Int('/F=',MParm_Str);
  1547.     Code_Only := Parse_Int('/C=',MParm_Str);
  1548.     Tstr := Global_str('PRINTER_TYPE');
  1549.     Return_Str := '';
  1550.     SStr := '';
  1551.     Counter := 0;
  1552.     Choice := 0;
  1553.     WHILE (Counter < 18) DO
  1554.         ++Counter;
  1555.         Code_Name := Parse_Str('N' + Str(Counter) + '=',TSTR);
  1556.         IF (Code_Name <> '') THEN
  1557.             IF (Format_Only) THEN
  1558.                 IF (Parse_Str('F' + Str(Counter) + '=',Tstr) = '') THEN
  1559.                     Goto SKIP_IT;
  1560.                 END;
  1561.             END;
  1562.             IF (Code_Only) THEN
  1563.                 IF (Parse_Str('C' + Str(Counter) + '=',TSTr) = '') THEN
  1564.                     Goto SKIP_IT;
  1565.                 END;
  1566.             END;
  1567.             ++Choice;
  1568.             Set_Global_Str('XFCS_' + Str(Choice),Code_Name);
  1569.             Set_Global_Str('FCS_' + Str(Choice),'/S=2');
  1570.             SStr := SStr + '/' + Str(Choice) + '=' + Str(Counter);
  1571.         END;
  1572. SKIP_IT:
  1573.     END;
  1574.  
  1575.         IF (Choice) THEN
  1576.             RM('SUBMENU /H=PR/A=1/GCLR=1/G=FCS_/M=XFCS_/L=SELECT A PRINTER CODE' +
  1577.                     '/#=' + str(choice) + '/BC=' + str(box_count) + MParm_Str);
  1578.  
  1579.             IF (Return_Int > 0) THEN
  1580. {Now, parse out the corresponding printer code}
  1581.                 Code_Name := Parse_Str('/' + Str(Return_Int) + '=',sstr);
  1582.                 Return_Str :=
  1583.                     '/N=' + Parse_Str('N' + Code_Name + '=',Tstr) +
  1584.                     '/F=' + Parse_Str('F' + Code_Name + '=',Tstr) +
  1585.                     '/C=' + Parse_Str('C' + Code_Name + '=',Tstr);
  1586.             END;
  1587.         END;
  1588.  
  1589. EXIT:
  1590. END_MACRO;
  1591.  
  1592. $MACRO NOTINC TRANS;
  1593. {*******************************MULTI-EDIT MACRO******************************
  1594.  
  1595. Name: NOTINC
  1596.  
  1597. Description:  Puts up the message that a module is not included.
  1598.  
  1599. Parameters:
  1600.                             /X= The upper left column coordinate
  1601.                             /Y= The upper left row coordinate
  1602.                             /T= The name of the option
  1603.                             /H= The help index string, if help is to be enabled
  1604.  
  1605.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1606. ******************************************************************************}
  1607.  
  1608.     def_int(x,y);
  1609.     X := parse_int('/X=', mparm_str);
  1610.     Y := parse_int('/Y=', mparm_str);
  1611.     if x = 0 then
  1612.         x := 12;
  1613.     end;
  1614.     if y = 0 then
  1615.         y := 8;
  1616.     end;
  1617.     If (x + 55) > screen_width then
  1618.         x := screen_width - 55;
  1619.     end;
  1620.     If (y + 9) > (screen_length - 1) then
  1621.         y := screen_length - 10;
  1622.     end;
  1623.     put_box(x,y,x + 55,y + 9,0,error_color, caps(parse_str('/T=',mparm_str)) + ' OPTION NOT INCLUDED',true);
  1624.     write('Please contact American Cybernetics for information',x+1,y+2,0,error_color);
  1625.     write('and availablity of this option.',x+1,y+3,0,error_color);
  1626.     write('Call (602) 968-1945.',x+1,y+5,0,error_color);
  1627.     if parse_str('/H=',mparm_str) <> '' then
  1628.         write('<F1> for more info, any other key to continue...',x+1,y+7,0,error_color);
  1629.     else
  1630.     write('Press any key to continue...',x+1,y+7,0,error_color);
  1631.     end;
  1632.     RM('MEERROR^Beeps /C=2');
  1633. again:
  1634.     read_key;
  1635.     if (key1 = 0) and (key2 = 59) then
  1636.         help( parse_str('/H=',mparm_str));
  1637.         goto again;
  1638.     end;
  1639.     kill_box;
  1640.     return_int := 100;
  1641. END_MACRO;
  1642.