#] #] ********************* #] loaddefs link d_Qndfs 'diff_Howell.ndf' - diff that crawls along text ignoring newlines #] and reports only parts of text that differ # www.BillHowell.ca 24Jan2021 initial # document compare in LibreOffice wasn't good, Microsoft Word may be better? # view this file in a text editor, with [constant width font, tab = 3 spaces], no line-wrap # for this file OY!! : path_backupDatedTo_dir (link d_PROJECTS 'Forms/0_form - QNial programs.ndf') (link d_PROJECTS 'Forms/z_Archive/') # Single file : path_backupDatedTo_dir (link d_Qndfs 'diff_Howell.ndf') (link d_Qndfs 'z_Archive/') # 24Jan2021 - I installed Diffuse on my LMDE sysstem f_diffHowell := 'diff_Howell.ndf' ; loaddefs_start f_diffHowell ; #**************************** # List of operators, generated with : # $ cat "$d_Qndfs""diff_Howell.ndf" | grep "^#]" | sed 's/^#\]/ /' # ********************* loaddefs link d_Qndfs 'diff_Howell.ndf' - diff that crawls along text ignoring newlines and reports only parts of text that differ diff_Howell IS OP path1 path2 - diff that crawls along text ignoring newlines and reports only parts of text that differ. Re-arranged text requires more than this! #*********** # Setup (kind of like header info) # loaddefs link d_Qndfs '???' ; #***************************** # loaddefs link d_Qndfs 'diff_Howell.ndf' IF flag_debug THEN write 'loading diff_Howell' ; ENDIF ; #] diff_Howell IS OP path1 path2 - diff that crawls along text ignoring newlines #] and reports only parts of text that differ. Re-arranged text requires more than this! IF flag_break THEN BREAK ; ENDIF ; diff_Howell IS OP path1 path2 { LOCAL finn1 finn2 flag_continue i i_common j j_common line1 line2 select1 select2 wordList1 wordList2 ; % ; % verify that paths are allowable ; IF (NOT AND (EACH path_exists ("r path1) ("w path2))) THEN EACH write '?diff_Howell error, file unknown, one of : ' path1 path2 '' ; ELSE % [backup, open, read] datafiles and set up ; finn1 finn2 := path1 path2 EACHLEFT open "r ; wordList1 wordList2 := null null ; i j := 0 0 ; WHILE (NOT OR (EACH isfault (line1 := readfile finn1) (line2 := readfile finn1))) DO wordList1 wordList2 := wordList1 wordList2 EACHBOTH link (line1 line2 EACHLEFT str_splitTo_words chrSet) ; FOR i WITH (i + (tell (gage shape wordList1))) DO FOR j WITH (j + (tell (gage shape wordList2))) DO IF (= wordList1 wordList2) THEN i_common := i_common link i ; j_common := j_common link j ; ENDIF ; ENDFOR ; ENDFOR ; ENDWHILE ; % drop the common terms ; select1 := (gage shape wordList1) reshape l ; select1 := select1#(i_common) EACHLEFT = o ; select2 := (gage shape wordList2) reshape l ; select2 := select2#(i_common) EACHLEFT = o ; wordList1 wordList2 := select1 select1 EACHBOTH sublist wordList1 wordList2 ; EACH write wordList1 wordList2 ; EACH close finn1 finn2 ; ENDIF ; } # loaddefs_ended f_diffHowell ; # enddoc