- Notifications
You must be signed in to change notification settings - Fork7
dontcallmedom/spiff
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
(⚠ outdated copy from original tarball)INSTALLATION1) Change makefile settings to reflectATT vs. BSD softwaretermio vs. termcapMGR vs. no MGR(MGR is a BELLCORE produced window manager that is also available free to the public.)2) Then, just say "make".If you want to "make install", you should firstchange definition of INSDIR in the makefile3) to test the software sayspiff Sample.1 Sample.2spiff should find 4 differences andyou should see the words "added", "deleted", "changed",and "altered" as well as four number in stand-out mode.spiff Sample.1 Sample.2 | catshould produce the same output, only the differencesshould be underlined However, on many terminals the underliningdoes not appear. So try the commandspiff Sample.1 Sample.2 | cat -vor whatever the equivalent to cat -v is on your system.A more complicated test set is found in Sample.3 and Sample.4These files show how to use embedded commands to do thingslike change the commenting convention and tolerances on thefly. Be sure to run the command with the -s option to spiff:spiff -s "command spiffword" Sample.3 Sample.4These files by no means provide an exhaustive test ofspiff's features. But they should give you some idea if thingsare working right.This code (or it's closely related cousins) has been run onVaxen running 4.3BSD, a CCI Power 6, some XENIX machines, and someother machines running System V derivatives as well as(thanks to eugene@ames.arpa) Cray, Amdahl and Convex machines.4) Share and enjoy.AUTHOR'S ADDRESSPlease send complaints, comments, praise, bug reports, etc toDan NachbarBell Communications Research (also known as BELLCORE)445 South St. Room 2B-389Morristown, NJ 07960nachbar@bellcore.comorbellcore!nachbaror(201) 829-4392 (praise only, please)OVERVIEW OF OPERATIONEach of two input files is read and stored in core.Then it is parsed into a series of tokens (literal strings andfloating point numbers, white space is ignored).The token sequences are stored in core as well.After both files have been parsed, a differencing algorithm is applied tothe token sequences. The differencing algorithmproduces an edit script, which is then passed to an output routine.SIZE LIMITS AND OTHER DEFAULTSfile implementing limitnamedefault valuemaximum number of lineslines.h_L_MAXLINES10000per filemaximum number of tokenstoken.hK_MAXTOKENS50000per filemaximum line lengthmisc.hZ_LINELEN 1024maximum word lengthmisc.hZ_WORDLEN 20 (length of misc buffers for things like literal delimiters. NOT length of tokens which can be virtually any length)default absolute tolerancetol.h_T_ADEF "1e-10" default relative tolerancetol.h_T_RDEF "1e-10" maximum number of commandscommand.h_C_CMDMAX 100 in effect at one timemaximum number of commentingcomment.hW_COMMAX 20 conventions that can be in effect at one time (not including commenting conventions that are restricted to beginning of line)maximum number of commentingcomment.hW_BOLMAX 20 conventions that are restricted to beginning of line that are in effect at one timemaximum number of literalcomment.hW_LITMAX 20 string conventions that can be in effect at one timemaximum number of tolerancestol.h_T_TOLMAX 10 that can be in effect at one timeDIFFERENCES BETWEEN THE CURRENT VERSION AND THE ENCLOSED PAPERThe files paper.ms and paper.out contain the nroff -ms input andoutput respectively of a paper on spiff that was given the Summer '88USENIX conference in San Francisco. Since that time many changeshave been made to the code. Many flags have changed and some havehad their meanings reversed, see the enclosed man page for the currentusage. Also, there is no longer control over thegranularity of object used when applying the differencing algorithm.The current version of spiff always applies the differencingin terms of individual tokens. The -t flag controls how the edit scriptis printed. This arrangement more closely reflects the original intentof having multiple differencing granularities. PERFORMANCESpiff is big and slow. It is big because all the storage isin core. It is a straightforward but boring task to move the temporarystorage into a file. Someone who cares is invited to take on the job.Spiff is slow because whenever a choice had to be made betweenspeed of operation and ease of coding, speed of operation almost always lost.As the program matures it will almost certainly get smaller and faster.Obvious performance enhancements have been avoided in order to make theprogram available as soon as possible.COPYRIGHTOur lawyers advise the following: Copyright (c) 1988 Bellcore All Rights Reserved Permission is granted to copy or use this program, EXCEPT that it may not be sold for profit, the copyright notice must be reproduced on copies, and credit should be given to Bellcore where it is due. BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.Given that all of the above seems to be very reasonable, there should be noreason for anyone to not play by the rules.NAMING CONVENTIONS USED IN THE CODEAll symbols (functions, data declarations, macros) are named as follows:L_foo-- for names exported to other modulesand possibly used inside the module as well._L_foo-- for names used by more than one routinewithin a modulefoo-- for names used inside a single routine.Each module uses a different value for "L" -- module files letter used implementsspiff.cYtop level routinesmisc.[ch]Zvarious routines used throughoutstrings.[ch]Sroutines for handling stringsedit.hElist of changes found and printedtol.[ch]Ttolerances for real numberstoken.[ch]Kstorage for objectsfloat.[ch]Fmanipulation of floatsfloatrep.[ch]Rrepresentation of floatsline.[ch]Lstorage for input linesparse.[ch]Pparse for input filescommand.[ch]Cstorage and recognition of commandscomment.[ch]Wcomment list maintenancecompare.[ch]Xcomparisons of a single tokenexact.[ch]Qexact match differencing algorithmmiller.[ch]Gmiller/myers differencing algorithmoutput.[ch]Oprint listing of differencesflagdefs.hUdefine flag bits that are used inseveral of the other modules.These #defines could have beenincluded in misc.c, but were separatedout because of their explicitcommunication function.visual.[ch]Vscreen oriented display for MGRwindow manager, also containsdummy routines for people who don'thave MGR I haven't cleaned up visual.c yet. It probably doesn't even compilein this version anyway. But since most people don't have mgr, thisisn't urgent.NON-OBVIOUS DATA STRUCTURESThe Floating Point RepresentationFloating point numbers are stored in a struct R_flstrThe fractional part is often called the mantissa.The structure consists ofa flag for the sign of the factional partthe exponent in binary a character string containing the fractional partThe structure could be converted to a float viaatof(strcat(".",mantissa)) * (10^exponent)To be properly formed, the mantissa string must:start with a digit between 1 and 9 (i.e. no leading zeros)except for the zero, in which case the mantissa is exactly "0"for the special case of zero, the exponent is always 0, and thesign is always positive. (i.e. no negative 0)In other words, (except for the value 0)the mantissa is a fractional number rangingbetween 0.1 (inclusive) and 1.0 (exclusive).The exponent is interpreted as a power of 10.Lines there are three sets of lines:implemented in line.c and line.hreal_lines -- the lines as they come from the filecontent_lines -- a subset of reallines that excluding embedded commandsimplemented in token.c and token.h token_lines -- a subset of content_lines consisting of those lines thathave tokens that begin on them (literals can go on formore than one line)i.e. content_lines excluding comments and blank lines.THE STATE OF THE CODEThings that should be addedvisual mode should handle tabs and wrapped lineshandling huge files in chunks when in using the ordinal matchalgorithm. right now you have to parse and then diff thewhole thing before you get any output. often, you run out of memory.Things that would be nice to addoutput should optionally be expressed in real line numbers(i.e. including command lines)at present, all storage is in core. there shouldbe a compile time decision to allow temporary storagein files rather than core. that way the user could decide how to handle thespeed/space tradeoffa front end that looked like diff should be added so thatone could drop spiff into existing shell scriptsthe parser converts floats into their internal form even whenit isn't necessary.in the miller/myer code, the code should check for matchingend sequences. it currently looks matching beginningsequences.Minor programming improvements (programming botches)some of the #defines should really be enumerated typesall the routines in strings.c that alter the data at the end ofa pointer but return void should just return the correctdata. the current arrangement is a historical artifactof the days when these routines returned a status code.but then the code was never examined,so i made them void . . .comments should be added to the miller/myer codein visual mode, ask for font by name rather than numberAbout
A diff tool that highlights changes at the token (rather than line) level
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Contributors3
Uh oh!
There was an error while loading.Please reload this page.