home *** CD-ROM | disk | FTP | other *** search
- * compare current and given files or all windows, stay at difference
- * locate lines, or nonblank words if SCROLLLOCK
- * comparison starts after current line (and column for words)
- B = SCROLLLOCK(); F = FILEID.1(); W = LSCREEN.3()'.'LSCREEN.4();
- do C = 1
- if B then do; 'set stream ON'; 'set wrap OFF'; end
- if MULTWINDOW() then
- do
- A. = 'sos tabcmdf'; A.C; if W = LSCREEN.3()'.'LSCREEN.4() then leave;
- end
- else if ARG() then
- do
- N = WORD( ARG(1) , C );
- if N = '' then do; A.0 = 'kedit' F '(nodefext'; A.0; leave; end
- 'kedit' N '(nodefext'; A.C = 'kedit' FILEID.1() '(nodefext';
- end
- else
- do
- A. = 'kedit'; A.C; if FILEID.1() = F then leave;
- end
- end
- C = C-1; D = 0; E = 0; W = WIDTH.1()-14;
- do forever
- G = 0;
- if SELECT.1() > DISPLAY.1() & E > C then
- do
- L = SUBSTR( CURLINE.3() , ZONE.1() , ZONE.2()-ZONE.1()+1 );
- do T = 1 to C
- A.T; 'extract /DISPLAY'; 'set display' DISPLAY.1+1; 'up';
- 'nomsg tfind 'SUBSTR( L , 1 , MIN( ZONE.2()-ZONE.1()+1 , W ) )'';
- if RC \= 0 then G = G+1; 'set display' DISPLAY.1 DISPLAY.2;
- end
- A.0; if G > 0 then leave;
- end
- else if E > 0 | D > 0 then
- leave;
- D = 0;
- if B then
- do forever
- 'clocate / /'; 'clocate ^/ /'; E = RC \= 0;
- L = WORD( SUBSTR( CURLINE.3() , COLUMN.1() ) , 1 );
- do T = 1 to C
- A.T; 'clocate / /'; 'clocate ^/ /';
- E = E + ( RC \= 0 | SELECT.1() > DISPLAY.1() );
- if WORD( SUBSTR( CURLINE.3() , COLUMN.1() ) , 1 ) \== L then D = D+1;
- end
- A.0;
- if E > 0 | D > 0 then
- do
- do T = 1 to C; A.T; 'cursor column'; end
- A.0; 'cursor column'; leave;
- end
- end
- else
- do forever
- 'next'; L = CURLINE.3();
- do T = 1 to C; A.T; 'next'; if CURLINE.3() \== L then D = D+1; end
- A.0;
- if FOCUSEOF() | SELECT.1() > DISPLAY.1() | D > 0 then
- do
- E = FOCUSEOF() | SELECT.1() > DISPLAY.1();
- do T = 1 to C;
- A.T; E = E + ( FOCUSEOF() | SELECT.1() > DISPLAY.1() );
- end
- A.0; leave;
- end
- end
- end
- if G > 0 then 'msg DIFFER' G 'range separator(s) missing';
- else if E > D then 'msg DIFFER end of' E 'file(s)/ranges(s)';
- else if D > 0 then 'msg DIFFER' D 'difference(s)';
- 'sos beep';
-