|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.matthias_burbach.util.Diff
Diff - A Text file difference utility. Copyright 1987, 1989 by Donald C. Lindsay, School of Computer Science, Carnegie Mellon University. Copyright 1982 by Symbionics.
Use without fee is permitted when not for direct commercial advantage, and when credit to the source is given. Other uses require specific permission.
Converted from C to Java by Ian F. Darwin, ian@darwinsys.com, January, 1997. Copyright 1997, Ian F. Darwin.
Adapted to specific personal needs by Matthias Burbach
Usage: Diff oldfile newfile
This program assumes that "oldfile" and "newfile" are text files. The program writes to stdout a description of the changes which would transform "oldfile" into "newfile".
The printout is in the form of commands, each followed by a block of text. The text is delimited by the commands, which are:
Change Log
----------
1Jan97 Ian F. Darwin: first working rewrite in Java, based entirely on
D.C.Lindsay's reasonable C version.
Changed comments from /***************** to /**, shortened, added
whitespace, used tabs more, etc.
6jul89 D.C.Lindsay, CMU: fixed portability bug. Thanks, Gregg Wonderly.
Just changed "char ch" to "int ch".
Also added comment about way to improve code.
10jun89 D.C.Lindsay, CMU: posted version created.
Copyright notice changed to ACM style, and Dept. is now School.
ACM article referenced in docn.
26sep87 D.C.Lindsay, CMU: publication version created.
Condensed all 1982/83 change log entries.
Removed all command line options, and supporting code. This
simplified the input code (no case reduction etc). It also
simplified the symbol table, which was capable of remembering
offsets into files (instead of strings), and trusting (!) hash
values to be unique.
Removed dynamic allocation of arrays: now fixed static arrays.
Removed speed optimizations in symtab package.
Removed string compression/decompression code.
Recoded to Unix standards from old Lattice/MSDOS standards.
(This affected only the #include's and the IO.)
Some renaming of variables, and rewording of comments.
1982/83 D.C.Lindsay, Symbionics: created.
Nested Class Summary | |
(package private) class |
Diff.FileInfo
This is the info kept per file. |
Field Summary | |
(package private) boolean |
anyprinted
|
(package private) int[] |
blocklen
blocklen is the info about found blocks. |
static int |
change
|
static int |
delete
|
static int |
idle
|
static int |
insert
|
static int |
movenew
|
static int |
moveold
|
(package private) Diff.FileInfo |
newinfo
Keeps track of information about file1 and file2 |
(package private) Diff.FileInfo |
oldinfo
Keeps track of information about file1 and file2 |
(package private) int |
printnewline
|
(package private) int |
printoldline
|
(package private) int |
printstatus
|
(package private) java.io.PrintWriter |
printWriter
|
static int |
same
|
(package private) int |
UNREAL
block len > any possible real block len |
Constructor Summary | |
Diff()
Construct a Diff object. |
|
Diff(java.io.PrintWriter printWriter)
|
Method Summary | |
void |
doDiff(java.lang.String oldFile,
java.lang.String newFile)
Do one file comparison. |
(package private) void |
inputscan(Diff.FileInfo pinfo)
inputscan Reads the file specified by pinfo.file. --------- Places the lines of that file in the symbol table. |
static void |
main(java.lang.String[] argstrings)
main - entry point when used standalone. |
(package private) void |
newconsume()
|
(package private) void |
oldconsume()
oldconsume Part of printout. |
void |
println(java.lang.String s)
Convenience wrapper for println |
(package private) void |
printout()
printout - Prints summary to stdout. |
(package private) void |
scanafter()
|
(package private) void |
scanbefore()
scanbefore As scanafter, except scans towards file fronts. |
(package private) void |
scanblocks()
scanblocks - Finds the beginnings and lengths of blocks of matches. |
(package private) void |
scanunique()
|
(package private) void |
showchange()
showchange Part of printout. |
(package private) void |
showdelete()
showdelete Part of printout. |
(package private) void |
showinsert()
|
(package private) void |
showmove()
showmove Part of printout. |
(package private) void |
showsame()
showsame Part of printout. |
(package private) void |
skipnew()
skipnew Part of printout. |
(package private) void |
skipold()
skipold Part of printout. |
(package private) void |
storeline(java.lang.String linebuffer,
Diff.FileInfo pinfo)
storeline Places line into symbol table. --------- Expects pinfo.maxLine initted: increments. |
(package private) void |
transform()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
final int UNREAL
Diff.FileInfo oldinfo
Diff.FileInfo newinfo
int[] blocklen
java.io.PrintWriter printWriter
public static final int idle
public static final int delete
public static final int insert
public static final int movenew
public static final int moveold
public static final int same
public static final int change
int printstatus
boolean anyprinted
int printoldline
int printnewline
Constructor Detail |
public Diff()
public Diff(java.io.PrintWriter printWriter)
Method Detail |
public static void main(java.lang.String[] argstrings)
public void doDiff(java.lang.String oldFile, java.lang.String newFile) throws java.lang.Exception
java.lang.Exception
void inputscan(Diff.FileInfo pinfo) throws java.lang.Exception
java.lang.Exception
void storeline(java.lang.String linebuffer, Diff.FileInfo pinfo) throws java.lang.Exception
java.lang.Exception
void transform()
void scanunique()
void scanafter()
void scanbefore()
void scanblocks()
void printout() throws java.lang.Exception
java.lang.Exception
void newconsume()
void oldconsume()
void showdelete()
void showinsert()
void showchange()
void skipold()
void skipnew()
void showsame() throws java.lang.Exception
java.lang.Exception
void showmove()
public void println(java.lang.String s)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |