Lutz Prechelt's software page

Last updated 1996-03-13

On this page you find some software that I made or maintain. For each package there is a short description and one or several links for download.

There are the following entries:


C-Refine is a preprocessor that introduces an additional language construct (the "refinement") into C or Objective C or C++ or Java or similar languages. C-Refine itself is written in C and is readily portable to most platforms. Essentially, refinements are parameterless macros with the following properties: The use of C-Refine is transparent to compilers and debuggers (at least for C and C++, in Java transparency is possible only if the compiler supports the #line directive).

Why are refinements a good idea?
During programming they allow to defer thinking, that is, to work top-down within a procedure or method. In my personal experience, the result is easier programming and often more nicely structured software.
More importantly, during program reading refinements allow for much quicker understanding of the program logic, because the software is prestructured to clearly show both the structure and purpose of its programming logic.

Here is a trivial example of a program written using C-Refine, so you can get the idea.

Here is the C-Refine source code distribution.

Resampling Statistics

Resampling Statistics are an alternative approach to statistical computation. Classical statistics uses formulae and tables for computing results and requires a deep understanding of the preconditions required for the application of a particular formula in order to avoid false results.
In contrast, with resampling statistics one writes a simple simulation program that mimics the statistical process one wants to investigate and directly computes the The advantages of resampling statistics are The disadvantage is a much larger investment of computing time. However, with modern computers even a thorough resampling simulation rarely runs longer than a few minutes -- usually only seconds.

To learn more about resampling, visit the University of Maryland's Resampling Project.

Christian Sy and myself have designed and written a Java package "resample" for one-dimensional resampling statistics. Here is the core of a Java program for computing the distribution of differences of the arithmetic means of two data samples s1 and s2. This computation would replace the t-test of classical statistics, but does not require a normality assumption for the data samples.

Here you find a distribution called resample 1.0 containing source files, class files, a number of example programs, and HTML documentation. The package was thoroughly tested and should be robust enough for practical use.

If you don't want to download rightaway you can also delve into the documentation or into the source code first or have a look at the example programs.


rename is a Perl script for renaming groups of files according to the same renaming pattern. Here is the usage message:
   Usage: rename from_pattern to_pattern filename...

      Renames all of the files matching the from_pattern by replacing
      the from_pattern with the to_pattern in their names.
      Other files' names are unchanged. Filenames must not contain '!'
      The patterns are Perl regular expressions and are used in a single
        s/from/to/ command (so the \\1 syntax can be used).
      rename '.c' '.cr' *
          renames all files with names ending in '.c' to have ending '.cr'
      rename '^tryit([1-9]).([cp])*' 'dunnit\\1.\\2' *
          renames all files with names tryit.c or tryit.p
          to have first namepart 'dunnit' and same digit and suffix.
      (and, of course, there are always many other ways to say the same)

Here is the rename source code.


histogram is a Perl script that uses the jgraph package for producing nice histograms in Postscript format from data files. Here is the usage message:
histogram [options] type [typeargs] postscriptfile
  uses jgraph 8.0 ( for producing nice histograms in PostScript
  options are:
   -col n            use data from n-th column per line only (first col is 0)
   -width inch       width of x-axis on output in inches (default: 2.4)
   -height inch      height of y-axis on output in inches (default: 1.8)
   -ymax n           highest value on y-axis (default: automatic)
   -sum              show total number of data points as well
   -quantiles        show 25/50/75 percentiles as well ('bins*' types only)
   -jgraph           output raw jgraph commands (default: output postscript)
  type is one of:
   all               one bar for each distinct value
   these val...      one bar for each value given, other values are ignored
   theseO val...     ditto, plus an additional bar `other' at right
   bins n min max    n equidistant bars, first starting at min, last 
                       ending at max
   bins min max      integer histogram: one bar per integer from min to max
                       (actually min-0.5 to max+0.5, each bar 1 wide)
   binsL [n] min max   ditto, plus an additional bar `< min' at left
   binsH [n] min max   ditto, plus an additional bar `> max' at right
   binsLH [n] min max  binsL and binsH combined
  non-numeric data is ignored for the 'bins*' types, otherwise all data
  is handled as strings.
  Lines are always split into words at whitespace, comma, and semicolon.
Here is the histogram source code.


Sock is a very simple (and therefore rather efficient) infrastructure for remote execution: The `sexec' demon is started on one machine and starts a Bourne shell for executing commands. Each call of the `scall' client transfers a command as is to sexec, which gives it to its shell and transports all output back to the client. Interaction is one-way, i.e., scall commands must run and terminate without further user intervention.

Sock is written in C, using the socket operations of Unix systems. It should be portable to all systems that support BSD sockets and the Bourne shell (/bin/sh). Here is the source code distribution sock 1.1.


cgrep is a portable Perl script with functionality similar to the Unix grep utility (i.e. searching for text strings in files). The special feature of cgrep is its ability to display a context around each line with a match, i.e., one or several lines before and after the matching line. A particularly interesting variant of this ability is the paragraph context: The context ends at any empty line, so that at most the current paragraph will be displayed. This is a very useful functionality for many purposes.

Here is the cgrep Perl source code.

Back to Lutz Prechelt's homepage.