home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / ME494-6.ZIP / SRC / FILECOMP.SRC < prev    next >
Encoding:
Text File  |  1990-05-10  |  22.6 KB  |  661 lines

  1. $macro filecomp;
  2. {*******************************MULTI-EDIT MACRO******************************
  3.  
  4. Last Revised:  02-02-90 08:52am
  5.  
  6. Macro Name:       Filecomp
  7.  
  8. Description:       Compares two files
  9.                                  If /t = 1 User will be prompted for both filenames and
  10.                                  direction of split.  Will support split in any direction.
  11.                    Compares line by line, checking for differences in text
  12.                                  along with differences in indent levels.  If any differences
  13.                                  are found they will be highlighted and the user will be prompted
  14.                                  whether to continue checking or not.  If they choose to get
  15.                                  out & stop comparing they can resume by choosing compare again.
  16.  
  17. Parameters:
  18.                                 /t= Compare Type
  19.                                  1 = Compare for First Time
  20.                                  2 = Compare again
  21.                                 If no parameters passed - Defaults to Compare for First Time
  22.  
  23.                                 /CS=
  24.                                  1 = Compare Case Sensitive
  25.                                  If no parameters passed - Defaults to Case Insensitive
  26.  
  27.                                 /COL=
  28.                                     Column to start from
  29.  
  30.                                 /LEN=
  31.                                     For use with col to compare a particular column
  32.                                     in a file
  33.  
  34.  
  35.                (C) Copyright 1989 by American Cybernetics, Inc.
  36. ******************************************************************************}
  37.  
  38.   def_int(line_no_file1,line_no_file2,old_window_no,diff_found,compare_type,
  39.                     reached_eof1,reached_eof2,message_type,error_message_type,pos_no,
  40.                     l_num,atleast_1diff,col_where_diff,x,col,win_count,found_err_file,
  41.                     quick_exit,lngth1,lngth2,d_type,lngth,lnum,save_x1,save_x2,
  42.                     save_win_x1,save_end_col,c_lngth);
  43.     def_str(temp_line1[2048],temp_line2[2048],temp1[2048],temp2[2048],gstr[20],temp[2048],sstr);
  44.  
  45.                                     refresh := false;
  46.     quick_exit := false;
  47.     old_window_no := window_id;
  48.   load_macro_file('window');
  49.     compare_type := parse_int('/t=',mparm_str);      {determine what type of compare}
  50.  
  51.  
  52.   if (compare_type = 1) or (compare_type = 0) then   {Compare for first time}
  53.       set_global_int('case_sensitive',(parse_int('/c=',mparm_str)));
  54.       set_global_int('start_col',(parse_int('/col=',mparm_str)));
  55.       set_global_int('compare_lngth',(parse_int('/len=',mparm_str)));
  56.  
  57.         gstr := '!SM!_';
  58.         create_global_str(gstr+'1','/m=filecomp');
  59.         create_global_str(gstr+'X1','     INTERACTIVELY ON SCREEN     ');
  60.         create_global_str(gstr+'2','/m=filecomp');
  61.         create_global_str(gstr+'X2','            TO A FILE ');
  62.         create_global_str(gstr+'3','/m=filecomp');
  63.         create_global_str(gstr+'X3','              BOTH');
  64.  
  65.         RUN_MACRO('USERIN^SUBMENU /gclr=1/#=3/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/G=' + gstr
  66.                                             + '/X=10/Y=5/L=RESULTS OF FILE COMPARE DISPLAYED/B=0');
  67.         if (return_int = -1) or (return_int = 0) then
  68.              quick_exit := true;
  69.              goto end_of_mac;
  70.         end;
  71.         set_global_int('display_type',return_int);
  72.  
  73.         kill_box;      {if you dont do a new screen you will reveal contents}
  74.         new_screen;    {of old screen you started out compare from}
  75.  
  76.         if (global_int('display_type') = 2) or (global_int('display_type') = 3) then
  77.                 {make sure an error file doesnt already exist if it does delete it}
  78.               found_err_file := false;
  79.                 if user_id = '' then
  80.                      sstr := caps(me_path + 'file.dif');
  81.                 else
  82.                      sstr := caps(me_path + user_id + 'file.dif');
  83.                 end;
  84.  
  85.                 if switch_file(sstr) then
  86.                         erase_window;
  87.                         found_err_file := true;
  88.                 end;
  89.  
  90.                 if not(found_err_file) then
  91.                      Create_Window;
  92.              end;
  93.  
  94.                window_attr := window_attr or $01;  {hide window}
  95.                 if user_id = '' then
  96.                     file_name := ME_PATH + 'FILE.DIF';
  97.                 else
  98.                     file_name := ME_PATH + USER_ID + 'FILE.DIF';
  99.                 end;
  100.                  set_global_int('err_file_window',window_id);
  101.                  message_type := 6;   {please stand by message}
  102.                  call write_errors;
  103.      end;
  104.  
  105.      old_window_no := window_id;
  106.      run_macro('makewin /L=1');                         {creates new window, loads the file, & runs setup for ext}
  107.      if caps(file_name) = '?NO-FILE?' then         {if they pressed esc assume they want to quit & exit}
  108.         delete_window;
  109.                 quick_exit := true;
  110.         goto end_of_mac;
  111.      end;
  112.      if error_level = 0 then                        {the file existed no trouble loading}
  113.        set_global_int('win_no_file1',window_id);
  114.        set_global_str('filename_1',file_name);
  115.        run_macro('splitwin');
  116.        if (global_int('s_direction') = 0) then    {the s_direction global is set}
  117.         quick_exit := true;                       {in window.src}
  118.               goto end_of_mac;
  119.              end;
  120.                 refresh := TRUE;
  121.                 redraw;
  122.                 refresh := FALSE;
  123.      else
  124.               quick_exit := true;
  125.               goto end_of_mac;
  126.          end;
  127.  
  128.          set_global_int('did_compare_once',1);
  129.        set_global_int('win_no_file2',window_id);
  130.          set_global_str('filename_2',file_name);
  131.  
  132.      line_no_file1 := 1;
  133.        line_no_file2 := 1;
  134.  
  135.  else
  136.     {They pressed compare again - check to see if they already compared once
  137.          make sure they are in the same windows & same filenames then compare
  138.          again - else display error messages}
  139.  
  140.     if (not(global_int('did_compare_once') = 1)) then
  141.          error_message_type := 1;
  142.          goto error_msg;                                                           {never compared files - use compare two files first}
  143.         else
  144.           if switch_win_id(global_int('win_no_file1')) then
  145.               if file_name <> global_str('filename_1') then
  146.               error_message_type := 2;
  147.               goto error_msg;
  148.              end;
  149.           else
  150.               error_message_type := 2;
  151.               goto error_msg;
  152.           end;
  153.           if switch_win_id(global_int('win_no_file2')) then
  154.            if file_name <> global_str('filename_2') then
  155.             error_message_type := 2;
  156.             goto error_msg;
  157.            end;
  158.           else
  159.              error_message_type := 2;
  160.              goto error_msg;
  161.       end;
  162.       end;
  163.  
  164.         set_global_int('start_col',(parse_int('/col=',mparm_str)));
  165.       set_global_int('compare_lngth',(parse_int('/len=',mparm_str)));
  166.  
  167.         {routine following will put lines in question at top of screen before checking
  168.         for purposes of screen clarity}
  169.  
  170.         refresh := true;                                                     {should be on already in sys but just in case}
  171.     switch_win_id(global_int('win_no_file1'));
  172.        line_no_file1 := c_line;                                           {get actual line no in file1}
  173.       while c_row > 1 do
  174.                 up;
  175.         end;
  176.         goto_line(line_no_file1);
  177.         redraw;
  178.  
  179.     switch_win_id(global_int('win_no_file2'));
  180.         line_no_file2 := c_line;                                           {get actual line no in file2}
  181.       while c_row > 1 do
  182.             up;
  183.         end;
  184.         goto_line(line_no_file2);
  185.         redraw;
  186.  
  187.                 {they are comparing again get find the err file and goto eof}
  188.  
  189.             if (global_int('display_type') = 2) or (global_int('display_type') = 3) then
  190.                 refresh := false;
  191.               if switch_win_id(global_int('err_file_window')) then
  192.                     if user_id = '' then
  193.                   if ((File_Name) = (ME_PATH + 'FILE.DIF')) then
  194.                      window_attr := window_attr or $01;  {hide window}
  195.                           message_type := 7;
  196.                         call write_errors;
  197.                         end;
  198.                   else
  199.                     if ((File_Name) = (ME_PATH + USER_ID + 'FILE.DIF')) then
  200.                     window_attr := window_attr or $01;  {hide window}
  201.                          message_type := 7;
  202.                        call write_errors;
  203.                         end;
  204.                 end;
  205.                 else error_message_type := 2;
  206.                          goto error_msg;
  207.                 end;
  208.             end;
  209.  end;
  210.  
  211.         put_box(18,11,61,14,1,w_t_color,'',true);
  212.         write('PLEASE STANDBY WHILE COMPARING FILES...',20,12,0,w_t_color);
  213.       delay(1000);
  214.         kill_box;
  215.  
  216.         if (global_int('display_type') = 2) then
  217.             working;      {add percent done here}
  218.         end;
  219.  
  220.        diff_found := false;
  221.          reached_eof1 := false;
  222.          reached_eof2 := false;
  223.          atleast_1diff := false;
  224.  
  225.  main_loop:
  226.       refresh := false;                                                               {turn refresh off while checking to improve performance}
  227.      while not(diff_found) do
  228.     if (window_id <> global_int('win_no_file1')) then
  229.      switch_win_id(global_int('win_no_file1'));
  230.         end;
  231.         goto_line(line_no_file1);
  232.         if (not (at_eof)) then
  233.          temp_line1 := get_line;
  234.      switch_win_id(global_int('win_no_file2'));
  235.          goto_line(line_no_file2);
  236.          if (not (at_eof)) then
  237.             temp_line2 := get_line;
  238.             call compare_lines;
  239.             else reached_eof2 := true;
  240.             goto reached_eof;
  241.          end;
  242.          else reached_eof1 := true;
  243.          goto reached_eof;
  244.         end;
  245.      ++line_no_file1;
  246.      ++line_no_file2;
  247.      end;  {while do}
  248. goto end_of_mac;
  249.  
  250. compare_lines:
  251.  
  252.  if (not(global_int('case_sensitive') = 1)) then
  253.         temp_line1 := caps(temp_line1);
  254.         temp_line2 := caps(temp_line2);
  255.     end;
  256.  
  257.     if global_int('start_col') > 0 then
  258.         if (global_int('compare_lngth') = 0) then    {if no length is specified compare to end of string}
  259.                 c_lngth := (length(temp_line1) - global_int('start_col'));
  260.             else
  261.                 c_lngth := global_int('compare_lngth');
  262.         end;
  263.       temp1 := temp_line1;  {save what it originally looks like before}
  264.       temp2 := temp_line2;  {manipulation so you can display it later}
  265.         temp_line1 := copy(temp_line1,global_int('start_col'),c_lngth);
  266.         temp_line2 := copy(temp_line2,global_int('start_col'),c_lngth);
  267.     end;
  268.  
  269.  if temp_line1 <> temp_line2 then
  270.     if (global_int('start_col') = 0) then
  271.         temp1 := temp_line1;
  272.         temp2 := temp_line2;
  273.     end;
  274.         {save_end_col used to line up both strings for easy comparison}
  275.   if length(temp1) >= length(temp2) then
  276.         save_end_col := length(temp1) + 2;     {+2 so it will be fully on screen}
  277.   else
  278.         save_end_col := length(temp2) + 2;
  279.   end;
  280.  
  281.     temp_line1 := remove_space(temp_line1);          {remove space only cuts it down to a}
  282.   temp_line2 := remove_space(temp_line2);          {minimum of one consecutive space   }
  283.  
  284.     if temp_line1 <> temp_line2 then
  285.      tabs_to_spaces(temp_line1);
  286.      tabs_to_spaces(temp_line2);
  287.  
  288.      while (xpos(' ',temp_line1,1) <> 0) do                  {following removes ALL spaces}
  289.        pos_no := xpos(' ',temp_line1,1);
  290.       temp_line1 := str_del(temp_line1,pos_no,1);
  291.      end;
  292.  
  293.      while (xpos(' ',temp_line2,1) <> 0) do
  294.       pos_no := xpos(' ',temp_line2,1);
  295.       temp_line2 := str_del(temp_line2,pos_no,1);
  296.      end;
  297.  
  298.      if temp_line1 <> temp_line2 then
  299.       diff_found := true;
  300.         message_type := 5;                                                        {still diff with spaces out}
  301.       goto display_msg;
  302.      else  diff_found := true;                                               {now the same only diff is spaces}
  303.      message_type := 4;
  304.      goto display_msg;
  305.     end;
  306.      else
  307.          diff_found := true;                                                       {now the same only diff is spaces}
  308.          message_type := 4;
  309.          goto display_msg;
  310.      end;
  311.     end;
  312.  ret;
  313.  
  314.  reached_eof:
  315.     if ((reached_eof2) and not(reached_eof1)) then
  316.      message_type := 1;
  317.      goto display_msg;
  318.   elsif reached_eof1 then                                                 {if your at eof 1 switch to window 2 & see if your at eof2 also}
  319.    switch_win_id(global_int('win_no_file2'));
  320.    goto_line(line_no_file2);
  321.    if at_eof then
  322.         reached_eof2 := true;
  323.      end;
  324.   end;
  325.  
  326.  if (reached_eof1 and reached_eof2) then
  327.   diff_found := true;
  328.     message_type := 2;
  329.     goto display_msg;
  330.  elsif (reached_eof1 and (not(reached_eof2))) then
  331.   diff_found := true;
  332.   message_type := 3;
  333.     goto display_msg;
  334.  end;
  335.  
  336.  display_msg:
  337.   if (global_int('display_type') = 1) or (global_int('display_type') = 3) then
  338.          refresh := true;
  339.     end;
  340.     switch_win_id(global_int('win_no_file1'));
  341.     if (message_type = 1) then
  342.      if (global_int('display_type') = 1) or (global_int('display_type') = 3) then
  343.        goto_line(line_no_file1);
  344.          col := (80 - (length(global_str('filename_2')))) / 2;
  345.          put_box(18,7,61,13,1,w_t_color,'',true);
  346.          write('THE END OF FILE WAS REACHED IN FILE: ',20,8,0,w_t_color);
  347.          write('═ ',col-5,9,0,w_t_color);
  348.          write(caps(global_str('filename_2')),col,9,0,w_t_color);
  349.          col := (80 - (length(global_str('filename_1')))) / 2;
  350.          write('PRESS ANY KEY TO GO TO NEXT LINE OF: ',20,10,0,w_t_color);
  351.          write('═ ',col-5,11,0,w_t_color);
  352.        write(caps(global_str('filename_1')),col,11,0,w_t_color);
  353.         read_key;
  354.         kill_box;
  355.         if (global_int('display_type') = 3) then
  356.           call write_errors;
  357.         end;
  358.      elsif (global_int('display_type') = 2) then
  359.         call write_errors;
  360.      end;
  361.     elsif (message_type = 2) then
  362.         if (global_int('display_type') = 1) or (global_int('display_type') = 3) then
  363.         if (atleast_1diff) then
  364.           switch_win_id(global_int('win_no_file1'));     {no diffs go back to window 1}
  365.           goto_line(line_no_file1);
  366.           put_box(26,9,56,13,1,w_t_color,'',true);
  367.           write('FILE COMPARISON COMPLETE',28,10,0,w_t_color);
  368.           write('    < PRESS ANY KEY >',28,11,0,w_t_color);
  369.          else
  370.           switch_win_id(global_int('win_no_file2'));
  371.           tof;
  372.           switch_win_id(global_int('win_no_file1'));
  373.           tof;
  374.           put_box(26,10,57,13,1,w_t_color,'',true);
  375.           write(' FILE COMPARISON COMPLETE ',28,10,0,w_t_color);
  376.           write('  NO DIFFERENCES FOUND ! ',28,11,0,w_t_color);
  377.           write(' < PRESS ANY KEY >',32,12,0,w_t_color);
  378.         end;
  379.         read_key;
  380.             kill_box;
  381.         if (global_int('display_type') = 3) then
  382.           call write_errors;
  383.         end;
  384.         elsif (global_int('display_type') = 2) then
  385.             call write_errors;
  386.         end;
  387.     elsif (message_type = 3) then
  388.         if (global_int('display_type') = 1) or (global_int('display_type') = 3) then
  389.            switch_win_id(global_int('win_no_file2')); {reached eof in 1 go to window 2}
  390.            goto_line(line_no_file2);
  391.              col := (80 - (length(global_str('filename_1')))) / 2;
  392.              put_box(18,7,61,13,1,w_t_color,'',true);
  393.              write('THE END OF FILE WAS REACHED IN FILE: ',20,8,0,w_t_color);
  394.              write('═ ',col-5,9,0,w_t_color);
  395.              write(caps(global_str('filename_1')),col,9,0,w_t_color);
  396.              col := (80 - (length(global_str('filename_2')))) / 2;
  397.              write('PRESS ANY KEY TO GO TO NEXT LINE OF: ',20,10,0,w_t_color);
  398.              write('═',col-5,11,0,w_t_color);
  399.            write(caps(global_str('filename_2')),col,11,0,w_t_color);
  400.            read_key;
  401.             kill_box;
  402.             if (global_int('display_type') = 3) then
  403.             call write_errors;
  404.             end;
  405.         elsif (global_int('display_type') = 2) then
  406.          call write_errors;
  407.         end;
  408.    elsif (message_type = 4) then
  409.             call diff_foundmsg;
  410.   elsif (message_type = 5) then
  411.             call diff_foundmsg;
  412. end;
  413. goto end_of_mac;
  414.  
  415. diff_foundmsg:
  416.         call find_col_pos;
  417.     if (global_int('display_type') = 1) or (global_int('display_type') = 3) then
  418.  
  419.             goto_col(save_end_col);
  420.             save_win_x1 := win_x2;
  421.             if col_where_diff > 1 then         {if they are different at col 1 dont add 1}
  422.                goto_col(col_where_diff - 1);   {- 1 to display last similar column}
  423.                save_x1 := wherex + 1;          {+ 1 before you highlight}
  424.                 else
  425.                     goto_col(col_where_diff);
  426.                     save_x1 := wherex;
  427.                 end;
  428.            switch_win_id(global_int('win_no_file2'));
  429.             goto_col(save_end_col);
  430.             if col_where_diff > 1 then         {if they are different at col 1 dont add 1}
  431.                goto_col(col_where_diff - 1);   {- 1 to display last similar column}
  432.                save_x2 := wherex + 1;          {+ 1 before you highlight}
  433.                 else
  434.                     goto_col(col_where_diff);
  435.                     save_x2 := wherex;
  436.                 end;
  437.             call highlight_difference;
  438.  
  439.             if (message_type = 4) then
  440.               run_macro('userin^verify /C=14/L=10/T= WOULD YOU LIKE TO CONTINUE COMPARING FILES?/S=2/BL= < AN INDENT OR SPACING DIFFERENCE WAS FOUND >');
  441.             elsif (message_type = 5) then
  442.            run_macro('userin^verify /C=14/L=10/T=WOULD YOU LIKE TO CONTINUE COMPARING FILES?/S=2/BL= < LINES ARE DIFFERENT > ');
  443.             end;
  444.  
  445.            if return_int then
  446.        if (global_int('display_type') = 3) then
  447.             call write_errors;
  448.              end;
  449.            diff_found := false;
  450.          line_no_file1 := line_no_file1 + 1;
  451.          line_no_file2 := line_no_file2 + 1;
  452.            atleast_1diff := true;
  453.          goto main_loop;
  454.         else
  455.        if  (global_int('display_type') = 3) then
  456.             call write_errors;
  457.              end;
  458.       goto end_of_mac;
  459.          end;
  460.         elsif (global_int('display_type') = 2) then
  461.               call write_errors;
  462.             diff_found := false;
  463.           line_no_file1 := line_no_file1 + 1;
  464.           line_no_file2 := line_no_file2 + 1;
  465.               atleast_1diff := true;
  466.           goto main_loop;
  467.       end;
  468. ret;
  469.  
  470. error_msg:
  471.  if error_message_type = 1 then
  472.     put_box(18,2,62,6,1,w_t_color,'',true);
  473.      write('YOU MUST RUN "COMPARE TWO FILES" FIRST!',20,3,0,w_t_color);
  474.     write('      <Press ANY key to continue>      ',20,4,0,w_t_color);
  475.     read_key;
  476.     kill_box;
  477.  
  478.  elsif error_message_type = 2 then
  479.     put_box(18,2,62,6,1,w_t_color,'',true);
  480.     write(' ERROR LOCATING FILES ',28,2,0,w_t_color);
  481.   write('YOU MUST RUN "COMPARE TWO FILES" FIRST!',20,3,0,w_t_color);
  482.     write('      <Press ANY key to continue>      ',20,4,0,w_t_color);
  483.     read_key;
  484.     kill_box;
  485.  end;
  486.  quick_exit := true;
  487. goto end_of_mac;
  488.  
  489. highlight_difference:
  490.      if (global_int('s_direction') = 1) or (global_int('s_direction') = 4) then  {RIGHT}{DOWN}
  491.             d_type := 1;
  492.             call write_hlight;
  493.             d_type := 2;
  494.             call write_hlight;
  495.      elsif (global_int('s_direction') = 2) or (global_int('s_direction') = 3) then {LEFT} {UP}
  496.             d_type := 2;
  497.             call write_hlight;
  498.             d_type := 1;
  499.             call write_hlight;
  500.      end;
  501.      ret;
  502.  
  503.   find_col_pos:
  504.     {find col position where difference was encountered}
  505.      if (global_int('start_col') > 0) then
  506.             x := global_int('start_col');
  507.      else
  508.      x := 1;
  509.      end;
  510.    while (str_char(temp1,x) = str_char(temp2,x)) do
  511. {     MAKE_MESSAGE('TEMP1 ' + str_char(temp1,x) + '***');READ_KEY;
  512.      MAKE_MESSAGE('TEMP2 ' + str_char(temp2,x) + '***');READ_KEY;}
  513.     ++x
  514.    end;
  515.    col_where_diff := x;
  516.  ret;
  517.  
  518. write_hlight:
  519.          if ((global_int('s_direction') = 1) or (global_int('s_direction') = 2)) then {RIGHT}
  520.                 lnum := 4;
  521.          elsif (global_int('s_direction') = 3) then  {UP}
  522.                 if d_type = 1 then
  523.                   lnum := 15;
  524.                 elsif d_type = 2 then
  525.                     lnum := 4;
  526.                 end;
  527.          elsif (global_int('s_direction') = 4) then  {DOWN}
  528.               if d_type = 1 then
  529.                    lnum := 4;
  530.                 elsif d_type = 2 then
  531.                      lnum := 15;
  532.                 end;
  533.          end;
  534.  
  535.           if (d_type = 1) then
  536.             temp := temp1;
  537.           elsif (d_type = 2) then
  538.             temp := temp2;
  539.          end;
  540. {         lngth := length(temp);}
  541.          lngth := save_end_col;  {make the lengths both equal to the longest str}
  542.  
  543.  
  544.        IF (global_int('compare_lngth') > 0) then    {if you passed a length}
  545.                       if ((global_int('s_direction') = 1) or (global_int('s_direction') = 2)
  546.                              AND (global_int('compare_lngth') > 39)) then
  547.                             lngth := 39;  {save guard for screen}
  548.                         else
  549.                   lngth := global_int('compare_lngth') - (col_where_diff - global_int('start_col'));
  550.                         end;
  551.      ELSE
  552.                        if (d_type = 1) then
  553.                          if (save_win_x1 - (save_x1)) <= (lngth - col_where_diff) then
  554.                                   lngth := (save_win_x1 - save_x1);
  555.                          else
  556.                                 lngth := (lngth - col_where_diff) + 1;
  557.                          end;
  558.                   elsif (d_type = 2) then
  559.                         if (global_int('s_direction') = 2) then
  560.                            lngth := lngth - 1;                 {when you split left -1 so}
  561.                         end;                                   {it doesn't run into border}
  562.                          if (win_x2 - (save_x2)) <= (lngth - col_where_diff) then
  563.                                lngth := (win_x2 - save_x2);
  564.                   else
  565.                        lngth := (lngth - col_where_diff) + 1;
  566.                   end;
  567.                     end;
  568.          END;
  569.  
  570.          IF (d_type = 1) then
  571.             draw_attr(save_x1,lnum,w_h_color,lngth);
  572.         ELSIF (d_type = 2)
  573.             then draw_attr(save_x2,lnum,w_h_color,lngth);
  574.          end;
  575. ret;
  576.  
  577.  write_errors:
  578.         refresh := false;
  579.          switch_win_id(global_int('err_file_window'));
  580.         if (message_type = 1) then
  581.        put_line('═════════════════════════════════════════════════════════════════');eol;cr;
  582.        put_line('THE END OF FILE WAS REACHED IN FILE: ');eol;cr;
  583.           put_line(caps(global_str('filename_2')));eol;cr;
  584.        put_line('═════════════════════════════════════════════════════════════════');eol;cr;
  585.         elsif (message_type = 2) then
  586.      put_line('FILE COMPARISON COMPLETE');eol;cr;
  587.          if not(atleast_1diff) then
  588.         put_line('  NO DIFFERENCES FOUND ! ');eol;cr;
  589.        put_line('═════════════════════════════════════════════════════════════════');eol;cr;
  590.          end;
  591.         elsif (message_type = 3) then
  592.         put_line('═════════════════════════════════════════════════════════════════');eol;cr;
  593.              put_line('THE END OF FILE WAS REACHED IN FILE: ');eol;cr;
  594.              put_line(caps(global_str('filename_1')));eol;cr;
  595.         put_line('═════════════════════════════════════════════════════════════════');eol;cr;
  596.     elsif (message_type = 4) then
  597.       put_line('╔═══════════════════════════════════════════════════════════════╗');eol;cr;
  598.       text('║   AN INDENT OR SPACING DIFFERENCE WAS FOUND AT COLUMN = '
  599.             + str(col_where_diff));goto_col(65);text('║');eol;cr;
  600.       put_line('╚═══════════════════════════════════════════════════════════════╝');eol;cr;
  601.           call display_err;
  602.     elsif (message_type = 5) then
  603.       put_line('╔═══════════════════════════════════════════════════════════════╗');eol;cr;
  604.           text('║               LINES ARE DIFFERENT AT COLUMN = '
  605.             + str(col_where_diff));goto_col(65);text('║');eol;cr;
  606.       put_line('╚═══════════════════════════════════════════════════════════════╝');eol;cr;
  607.             call display_err;
  608.    elsif (message_type = 6) then
  609.       put_line('╔═══════════════════════════════════════════════════════════════╗');eol;cr;
  610.       put_line('║                     FILE COMPARISON OUTPUT                    ║');eol;cr;
  611.       put_line('╚═══════════════════════════════════════════════════════════════╝');eol;cr;
  612.    elsif (message_type = 7) then
  613.             refresh := false;
  614.             eof;eol;cr;
  615.       put_line('╔═══════════════════════════════════════════════════════════════╗');eol;cr;
  616.             put_line('║                    FILE COMPARE RESTARTED                     ║');eol;cr;
  617.             col := (65 - ((length(global_str('filename_1'))) + 15)) / 2;
  618.       text('║ ');goto_col(col);text(global_str('filename_1') + ' ═ LINE NO: '
  619.                                                     + str(line_no_file1));goto_col(65);text('║');eol;cr;
  620.             col := (65 - ((length(global_str('filename_2'))) + 15)) / 2;
  621.       text('║ ');goto_col(col);text(global_str('filename_2') + ' ═ LINE NO: '
  622.                                                     + str(line_no_file2));goto_col(65);text('║');eol;cr;
  623.       put_line('╚═══════════════════════════════════════════════════════════════╝');eol;cr;
  624.      end;
  625.  ret;
  626.  
  627. display_err:
  628.       put_line(global_str('filename_1') +  '  ═ LINE NO: ' + (str(line_no_file1)));eol;cr;
  629.           put_line(temp1);eol;cr;
  630.       put_line(global_str('filename_2') + '  ═ LINE NO: ' + (str(line_no_file2)));eol;cr;
  631.           put_line(temp2);eol;cr;
  632. ret;
  633.  
  634. end_of_mac:
  635.  
  636. if not(quick_exit) then
  637.     {if they are just writing to a file you should leave them in
  638.      the error file window}
  639.  
  640.     if (global_int('display_type') = 2) or (global_int('display_type') = 3) then
  641.         switch_win_id(global_int('err_file_window'));
  642.         save_file;
  643.         tof;
  644.       Window_Attr := Window_Attr and $FE; {unhide the window}
  645.     end;
  646.  
  647.     if (not(global_int('display_type') = 2)) then
  648.         if (message_type = 1) then
  649.         switch_win_id(global_int('win_no_file1'));
  650.       else
  651.         switch_win_id(global_int('win_no_file2'));
  652.       end;
  653.     end;
  654.  
  655.     {if they are doing it interactively switch to tmp window save the file
  656.      delete the window & go back to the file window}
  657. end;
  658.  
  659. refresh := true;  {shouldnt have to but...}
  660. end_macro;
  661.