![]() if they line up later then show the line from ROU2 now or if it has arguments and is (reasonable guess) less than 8 characters, pad out to 9 spaces, could fail if default values for arguments include spaces or braces or if it's a tag with no arguments, pad it out to 9 spaces if first character is a " " make it 9 spaces S Line=$G(ROU(I)) need the $G because some old systems have missing lines of code! Don't ask me. don't need to do anything - already the right way round Just in case you passed in arrays by reference and are expecting the left and right hand routines to come back to you. Convert routine into lines less than 80 characters long I Left'=Right,$I(Diffs) S Diffs(MI)="" lines where something is different Happens when ^ROUTINE has a missing line in the middle! Getting the odd occurence where a pair of lines shows up next to each other claiming to be different when they are not Obvsiously, not doing this if you passed in a pair of arrays Then lines broken into 78 character chunks so that the compare can be done side by side on a 160 wide screen but don't change the order of the lines, expand the arrays instead so that the similar lines match up Find all the lines of code in the minor routine that are identical to master and align them to the master Use the larger routine as the master routine ![]() Decide which of the two routines has more lines (left or right) start of line is spaced out to 9 spaces (allows an 8 char tag), longer tags left alone Get 2 routines and normalise each line of code into 2 arrays so that N HalfWidth,I,L,Left,R,Right,MASTER,MINOR,MI,RA,RB,R1,R2 Look for InverseOn and InverseOff as they are the variables used for highlighting differences Don't like the screen handling? You change it. Written to run on a putty terminal so screen handling is a bit noddy To compare across namespaces populate N1 and N2 with a valid namespace I Master="" Q:$Q "99No routine supplied" Q Pass in "24 9999" if you are going to use the arrays and pass them to something else that looks after formatting Pass in "24 80" if you like, it will work. ScreenLength and width can be passed in if your terminal doesn't go to 160 columns. The lines of code that are the same will be lined up Make Routine1 and Routine2 variables and pass by reference to get back the 2 routines as arrays Call it like $$^ZRDIFF(Routine1,Routine2,Namespace1,Namespace2,0,0.Diffs) to get it to return a non-zero number indicating there's a difference To compare classes use #class(%).GetTextAsArray(,ClassName.Array) and do your own thing. ![]() ![]() Alternatively, pass in a pair of arrays to compare in Master and Minor but ensure top node is populated with something. Pass in 1st routine (arg1 is Master) to compare against itself (in another namespace) or against 2nd routine (arg2 is Minor) Knocked up to run a quick diff on an old Caché version 5 system where my nice diff program won't work ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |