🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: de.comp.sources.unix
1 messages
1 total messages Started by Frank Kaefer Thu, 06 Aug 1992 21:10
v01i009: Crefine - C language extension, Part01/06
#15
Author: Frank Kaefer
Date: Thu, 06 Aug 1992 21:10
1789 lines
61006 bytes
Submitted-by: prechelt@ira.uka.de (Lutz Prechelt)
Posting-number: Volume 1, Issue 9
Archive-name: crefine/part01

(From README for C-Refine Version 3.0):

C-Refine is a preprocessor for programs written in C or C++ or a similar
language. It introduces an additional language construct called 'refinement'
which allows further decomposition with symbolic names inside functions.
This makes programs much easier to read and modify and is very nice
for programming.

We also call these extended languages C-Refine (or C++-Refine, and so on).
The C-Refine preprocessor converts program written in C-Refine into plain C, 
and programs written in C++-Refine into normal C++, and programs 
written in Objective-C-Refine into normal Objective-C, and so on.
The preprocessor is much faster than a C compiler, so it will not
unbearably slow down the overall compilation process.

The installed system consists of a single executable file (crefine) and one
Unix Manualpage (crefine.1). An additional driver shell script (ccr) plus
Manualpage are also provided.
No further data files or libraries except the standard C library are needed.
Thus C-Refine is easily portable.
 
Please unpack the shar files IN NUMERIC ORDER, or otherwise you may have to 
'touch' the *.c files to get the makefile running.

The shar files contain a few lines that are longer than 80 characters.
Depending on the Usenet News software, these lines may each have been
split into two lines on the package's way to you. (You will probably
get some messages about changed filesizes when unpacking the shar
files then.)  If you get any compilation errors, it may be due to this
fact.  Reconnect the split line in this case and try again.

   Lutz 

Lutz Prechelt  (++49/721/608-4317, FAX: ++49/721/697760) | Whenever you 
Institut fuer Programmstrukturen und Datenorganisation   | complicate things,
Universitaet Karlsruhe;  D-7500 Karlsruhe 1;  Germany    | they get
prechelt@ira.uka.de  or  prechelt!ira.uka.de@relay.csnet | less simple.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 6)."
# Contents:  crefine crefine/INSTALL crefine/Makefile crefine/README
#   crefine/TO_DO crefine/ccr crefine/ccr.1 crefine/ccr.man
#   crefine/cr_decl.h crefine/cr_talk.c crefine/cr_talk.cr
#   crefine/cr_texts.h crefine/erato.c crefine/erato.cr
#   crefine/getargs.h crefine/patchlevel.h crefine/std.h
# Wrapped by fkk@stasys on Thu Aug  6 22:49:34 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test ! -d 'crefine' ; then
    echo shar: Creating directory \"'crefine'\"
    mkdir 'crefine'
fi
if test -f 'crefine/INSTALL' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/INSTALL'\"
else
echo shar: Extracting \"'crefine/INSTALL'\" \(321 characters\)
sed "s/^X//" >'crefine/INSTALL' <<'END_OF_FILE'
XTo install crefine just put the stripped executable file "crefine" into
Xa directory where executables reside (such as "/usr/local/bin" or
X"/tools/bin" under Unix) and put the Manualpage into a directory where
XManpages reside such as "/usr/local/man/man1" or "/tools/man/man1".
X
XThat's all.
X
XFor compilation, see README.
X
END_OF_FILE
if test 321 -ne `wc -c <'crefine/INSTALL'`; then
    echo shar: \"'crefine/INSTALL'\" unpacked with wrong size!
fi
# end of 'crefine/INSTALL'
fi
if test -f 'crefine/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/Makefile'\"
else
echo shar: Extracting \"'crefine/Makefile'\" \(3727 characters\)
sed "s/^X//" >'crefine/Makefile' <<'END_OF_FILE'
X#Makefile for C-Refine
X#Author: Lutz Prechelt, Karlsruhe, Germany
X#Date  : 09.07.92
X
X# Usage:
X# Perhaps change the macro CC below if you want to use a different compiler.
X# Then call
X#   make crefine
X# to get a version of crefine that is at first made from 
X# the unC-Refine'd sources of C-Refine.
X# With this version of C-Refine you can then bootstrap C-Refine by
X# 'touch'ing the .cr files and again executing
X#   make crefine
X# You should normally remove the -n0 option from CRFLAGS so to get only such
X# messages from your compiler that point to the .cr file instead of to 
X# the .c file
X#
X# Translation is done in two phases with separate rules:
X#   First from .cr to .c if the .cr file is newer,
X#   then from .c to .o
X# In the makefiles of bigger projects I usually prefer to hold all the
X# .c files in some tmp directory, so that they don't clobber your working
X# directory and to have a single rule going from .cr to .o
X# Be careful and keep a copy of 'crefine' when experimenting
X# with changes!
X#
X# Installation can be performed by
X#   make install
X# which copies the crefine binary, ccr shell script to the directory given
X# by the BINDESTDIR variable and copies the crefine.1 manpage to the 
X# directory given by the MANDESTDIR variable. Please check and perhaps
X# change these variables first.
X# 
X
X#-----constants
X
XCLD=	getargs.o  crefine.o  cr_talk.o  cr_getln.o
XCS=     getargs.c crefine.c cr_talk.c cr_getln.c
XHS=     getargs.h crefine.h cr_talk.h cr_getln.h std.h cr_texts.h
X
XCR=crefine
XCRFLAGS= -ac -s- -T8
XCC=cc
XCFLAGS=  -I"." -DNDEBUG=1 -Ddebug=0 -Dms_dos=0 -Ddeutsch=0 
XLDFLAGS= 
XBINDESTDIR=/usr/local/bin
XMANDESTDIR=/usr/man/man1
X
X
X#-----rules
X
X.SUFFIXES: .o .c .cr
X
X.cr.c:
X	$(CR) $(CRFLAGS) $*.cr
X
X.c.o:
X	$(CC) $(CFLAGS) -c $<
X
X#-----program
X
Xcrefine:  $(CLD)
X	$(CC) $(LDFLAGS) -o crefine $(CLD)
X
Xgetargs.o: getargs.h  std.h
X
Xcrefine.o: cr_decl.h getargs.h std.h
X
Xcr_talk.o: cr_decl.h  cr_texts.h  std.h
X
Xcr_getln.o: cr_decl.h std.h
X
X#-----documentation
X
Xcrefine.man: crefine.1
X	nroff -man crefine.1 | col -b >crefine.man
X
Xccr.man: ccr.1
X	nroff -man ccr.1 | col -b >ccr.man
X
X#-----cleanup
X
Xclean:
X	-rm -f core  *~  *.o  crefine
X
Xcompletely_clean:  clean
X	-rm -f *.c
X
X#-----installation
X
Xinstall:
X	-strip crefine
X	cp crefine ccr $(BINDESTDIR)
X	chmod a=rx $(BINDESTDIR)/crefine $(BINDESTDIR)/ccr
X	cp crefine.1 $(MANDESTDIR)
X	chmod a=r $(MANDESTDIR)/crefine.1
X	@echo "C-Refine installed successfully"
X
X#-----packaging for delivery
X
XTARFILE=crefine.3.0.tar
XZOOFILE=crefine.zoo
XFILES1=README MANIFEST INSTALL COPYING TO_DO Makefile ccr \
X std.h cr_decl.h cr_texts.h getargs.h patchlevel.h
XFILES_man=crefine.man crefine.1 ccr.man ccr.1
XFILES_cr=$(FILES_cr_1) $(FILES_cr_2)
XFILES_cr_1=crefine.cr
XFILES_cr_2=cr_getln.cr cr_talk.cr erato.cr getargs.cr
XFILES_c=$(FILES_c_1) $(FILES_c_2)
XFILES_c_1=crefine.c
XFILES_c_2=cr_getln.c cr_talk.c erato.c getargs.c
XALL_FILES=$(FILES1) $(FILES_man) $(FILES_cr) $(FILES_c)
X
Xrelease: shar $(TARFILE) $(ZOOFILE)
X
Xshar: $(ALL_FILES) MANIFEST
X	shar $(FILES1) >crefine.1.shar
X	shar $(FILES_man) >crefine.2.shar
X	shar $(FILES_cr_1) >crefine.3.shar
X	shar $(FILES_cr_2) >crefine.4.shar
X	shar $(FILES_c_1) >crefine.5.shar
X	shar $(FILES_c_2) >crefine.6.shar
X	@/bin/ls -l crefine.?.shar
X
Xtar: $(TARFILE)
X
Xzoo: $(ZOOFILE)
X
XMANIFEST: Makefile
X	/bin/ls $(ALL_FILES) >MANIFEST
X
Xc_files.stamp: $(FILES_c)
X	crefine -ac -s- -n0 -T8 $(FILES_cr)
X	touch c_files.stamp
X
X$(TARFILE): $(FILES1) $(FILES_man) $(FILES_cr) c_files.stamp
X	tar cf $(TARFILE) $(ALL_FILES)
X	@rm -f $(TARFILE).Z
X	compress -v $(TARFILE)
X	@/bin/ls -l $(TARFILE).Z
X
X$(ZOOFILE): $(FILES1) $(FILES_man) $(FILES_cr) c_files.stamp
X# actually, the C files should have LF -> CR LF filtering before they
X# are packed into a zoo file.
END_OF_FILE
if test 3727 -ne `wc -c <'crefine/Makefile'`; then
    echo shar: \"'crefine/Makefile'\" unpacked with wrong size!
fi
# end of 'crefine/Makefile'
fi
if test -f 'crefine/README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/README'\"
else
echo shar: Extracting \"'crefine/README'\" \(3790 characters\)
sed "s/^X//" >'crefine/README' <<'END_OF_FILE'
X
X>>>>> This is README for C-Refine Version 3.0 <<<<<
X
XC-Refine is a preprocessor for programs written in C or C++ or a similar 
Xlanguage. It introduces an additional language construct called 'refinement'
Xwhich allows further decomposition with symbolic names inside functions.
XThis makes programs much easier to read and modify and is very comfortable
Xfor programming.
X
XWe also call these extended languages C-Refine (or C++-Refine, and so on).
XThe C-Refine preprocessor converts program written in C-Refine into plain C, 
Xand programs written in C++-Refine into normal C++, and programs 
Xwritten in Objective-C-Refine into normal Objective-C, and so on.
XThe preprocessor is much faster than a C compiler, so it will not
Xunbearably slow down the overall compilation process.
X
XThe installed system consists of a single executable file (crefine) and one
XUnix Manualpage (crefine.1). An additional driver shell script (ccr) plus
XManualpage are also provided.
XNo further data files or libraries except the standard C library are needed.
X
X------------------------------------------------------------------------------
X
XPortability:
X------------
XC-Refine is completely portable to all machines that have a standard 
XC library. 
XIt should readily compile at least on all ANSI-C machines, all
Xstandard BSD-Unix machines and standard System V machines.
X
XIf #include <strings.h> fails, change it to #include <string.h>
XIf #include <string.h>  fails, change it to #include <strings.h>
X
X------------------------------------------------------------------------------
X
XCompilation:
X------------
X
XUsually, no changes in the Makefile are required.
X
XTo generate C-Refine (which is bootstrapped, i.e. written in C-Refine)
Xyou must first compile the preprocessed version of the files.
X
XThis is done with the command
X  make crefine
Xwhich should compile from the *.c files.
XIf this doesn't work, please issue a 
X  touch *.c
Xand try again.
XThe *.c files have to be newer than the *.cr files or else make will try
Xto call crefine to transform *.cr files into *.c files, which of course
Xis not possible for you in the beginning, if you don't already have crefine.
X
XIf you have a working version of C-Refine you can bootstrap it via
X  make completely_clean crefine
X
XWhat you see then is no error: C-Refine works extremely fast; you will
Xhardly notice the time it takes for running crefine before the compiler is
Xstarted on each source file.
X
XThe Makefile is a bit simple-minded.
X
X------------------------------------------------------------------------------
X
XEnvironments where C-Refine already once worked:
X
XMachine            Operating System (and perhaps Compiler)
X-------            ---------------------------------------
XApollo DN3xxx      DOMAIN/OS SR10.3 BSD (ANSI C 6.8)
XApollo series 400  DOMAIN/OS SR10.3 BSD (ANSI C 6.8)
XAtari ST           OS-9/68000 V2.3
XAT/386             ISC Unix 3.2.2 (GNU C 1.39)
XAT/386             SCO Unix 3.2.2 (cc or GNU C 1.40 without optimization)
XAT&T 3B2           System V
XCommodore Amiga    AmigaOS 1.3 (DICE 2.06.33)
XConvex C2          Convex OS
XDECstation 3100    Ultrix 4.1
XDG Aviion 4620     System V r4.1
XNext 68040         NextStep 2.0
XOpus System PM-417 System V r3.2
XPC etc.            MS-DOS 3.2 (Microsoft C 5.0)
XPC etc.            OS/2 Vers. 1.3 (Microsoft C 6.0)
XPCS (type???)      some System V
XSequent Symmetry   DYNIX 3.1.4
XSun3               SUN-OS 3.5
XSun3,Sun4          SUN-OS 4.03
XSun3,Sun4          SUN-OS 4.1
XVAXstation 3250    Ultrix-32 V3.1
X
X------------------------------------------------------------------------------
X
XC-Refine was designed and implemented by 
X  Lutz Prechelt, Universitaet Karlsruhe, Germany
X  prechelt@ira.uka.de
X
XC-Refine is distributed under the GNU general public licence ("Copyleft").
XSee the file COPYING for details.
END_OF_FILE
if test 3790 -ne `wc -c <'crefine/README'`; then
    echo shar: \"'crefine/README'\" unpacked with wrong size!
fi
# end of 'crefine/README'
fi
if test -f 'crefine/TO_DO' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/TO_DO'\"
else
echo shar: Extracting \"'crefine/TO_DO'\" \(1136 characters\)
sed "s/^X//" >'crefine/TO_DO' <<'END_OF_FILE'
X
X   ==========================
X    Things to do to C-Refine
X   ==========================
X
X-- Lutz Prechelt, 08.05.92
X   Improve ccr to allow direct option passing to crefine.
X   Be careful not to get dependent on which options the C compiler
X   recognizes.
X
X-- Lutz Prechelt, 08.05.92
X   Improve ccr to allow calling the preprocessor before running crefine.
X
X-- Lutz Prechelt, 08.05.92
X   Write a manpage for ccr.
X
X-- Lutz Prechelt, 08.05.92
X   Write an Emacs editing mode 'C-Refine mode', based on 'C mode'.
X
X-- Lutz Prechelt, 08.05.92
X   Extend the idea to other languages, e.g. Lisp, Scheme, Eiffel, Sather
X   It is difficult to do it as simple as C-Refine now is for a language
X   that does not have something equivalent to #line (except if the 
X   language is interpretive instead of compiled).
X
X-- Lutz Prechelt, 08.05.92
X   Use GNU-style option processing.
X
X-- Lutz Prechelt, 12.06.92
X   Write a concept paper, explaining more deeply how C-Refine works and
X   why and what it is good for.
X
X-- Lutz Prechelt, 12.06.92
X   Make all buffers fully dynamic (autoexpanding) to avoid the need
X   for the options selecting their size.
X
X
END_OF_FILE
if test 1136 -ne `wc -c <'crefine/TO_DO'`; then
    echo shar: \"'crefine/TO_DO'\" unpacked with wrong size!
fi
# end of 'crefine/TO_DO'
fi
if test -f 'crefine/ccr' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/ccr'\"
else
echo shar: Extracting \"'crefine/ccr'\" \(1757 characters\)
sed "s/^X//" >'crefine/ccr' <<'END_OF_FILE'
X#!/bin/sh 
X# Date: 92/05/07  Lutz Prechelt, Karlsruhe
X# Version: 1.0
X#
X# cc-like front-end to C-Refine.
X# Sends one or several files through crefine first, then through cc.
X# All options are passed on to cc, i.e. no options can be specified for 
X# crefine on the command line, but may be given in the environment variable
X# CREFINEOPTIONS.
X# If any error occurs during any crefine run, cc is not called.
X#
X# If you want to have an equivalent script for any other compiler or
X# C-type language, just make a copy and adapt the values of
X# $CC and $suffix accordingly, e.g.  CC=g++; suffix=".ccr"
X# Rename the script and change the usage message appropriately.
X#
X
Xif test $# -eq 0 ; then
X  echo "Usage:  ccr [cc-options] [file.c[r] | file.o]..."
X  exit 1
Xfi
X
X
XCC="cc"                # compiler executable program
XCREFINE=crefine        # C-Refine executable program
Xsuffix=".cr"           # Suffix of C-Refine source program file names
Xcrefineoptions=${CREFINEOPTIONS:-""}  # options to call $CREFINE with
X
Xcc_params=""
Xto_delete=""
Xerrors=0
X
X#----- scan parameters and execute crefine for every .cr file
Xwhile test $# -gt 0 ; do
X  full_name=$1
X  base_name=`basename $1 $suffix`
X  result_name=`basename $1 "r"`   #what comes out of crefine
X  if test $full_name = $base_name ; then
X    cc_params="$cc_params $full_name"
X  else
X    $CREFINE $crefineoptions $full_name
X    exit=$?
X    if test $exit -gt 0 ; then
X      errors=1
X    else
X      cc_params="$cc_params $result_name"
X      to_delete="$to_delete $result_name"
X    fi
X  fi
X  shift
Xdone
X
X#----- call $CC
Xif test $errors -eq 0 ; then
X  $CC $cc_params
X  errors=$?
Xfi
X
X#----- perhaps delete files generated by $CREFINE
Xrm $to_delete         # comment this out if you don't want it
X
X#----- exit
Xexit $errors
X
END_OF_FILE
if test 1757 -ne `wc -c <'crefine/ccr'`; then
    echo shar: \"'crefine/ccr'\" unpacked with wrong size!
fi
chmod +x 'crefine/ccr'
# end of 'crefine/ccr'
fi
if test -f 'crefine/ccr.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/ccr.1'\"
else
echo shar: Extracting \"'crefine/ccr.1'\" \(1886 characters\)
sed "s/^X//" >'crefine/ccr.1' <<'END_OF_FILE'
X.TH CCR 1 "12 June 1992"
X.SH NAME
Xccr \- front end to use C-Refine with cc
X.SH SYNOPSIS
X.B ccr
X[
X.B options
X]
X.I inputfile ...
X.SH DESCRIPTION
X.B ccr
Xis a shell script that will act very much like your cc does.
XThe only difference is that C-Refine files are processed by crefine first,
Xbefore they are handed to the cc compiler.
X
XThe way that ccr works is the following:
XIt looks at every argument you supply in order. If the argument is a
Xfilename ending in 'r', it is processed by crefine and the filename of
Xthe output file replace the original one. All other arguments are kept
Xas they are. The resulting argument string is then used for a call
Xto
X.B
Xcc.
XThis call will be suppressed, if any errors occured during one of the
Xcrefine runs.
X.SH OPTIONS
XAll options you supply are handed right through to cc.
XIf you want to supply options for crefine, set up the environment
Xvariable CREFINEOPTIONS as a string containing the options.
X.SH FILES
X.PD 0
X.TP 18
Xccr
Xthe ccr shell script
X.TP
Xmyfilename1.cr
XC\-with\-refinements input file.
X.TP
Xmyfilename1.c
Xgenerated C input file.
X.TP
Xmyfilename2.c
XC input file.
X.PD
X.SH ENVIRONMENT
X.PD 0
X.TP 18
XCREFINEOPTIONS
Xcontains the option string to be used for calls of crefine performed
Xby ccr.
X.PD
X.SH EXAMPLES
X.TP
Xccr -g -o firsttest firsttest.cr myfile.c myfile2.o
Xprocesses the input file firsttest.cr producing the output file
Xfirsttest.c using crefine, compiles firsttest.c and myfile.c with
Xoption -g and links both wigh myfile2.o producing firsttest using cc.
X.SH DIAGNOSTICS
XAll diagnostic messages stem from either crefine or cc.
X.SH SEE ALSO
Xcc(1), crefine(1)
X.SH BUGS
XIt is not possible to give options for crefine directly.
X.SH VERSION
XThis manpage is for ccr version 1.0 
X.SH AUTHOR
X.nf
XLutz Prechelt  (prechelt@ira.uka.de)
XInstitut fuer Programmstrukturen und Datenorganisation
XUniversitaet Karlsruhe
XD-7500 Karlsruhe
XGermany
X
X.fi
END_OF_FILE
if test 1886 -ne `wc -c <'crefine/ccr.1'`; then
    echo shar: \"'crefine/ccr.1'\" unpacked with wrong size!
fi
# end of 'crefine/ccr.1'
fi
if test -f 'crefine/ccr.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/ccr.man'\"
else
echo shar: Extracting \"'crefine/ccr.man'\" \(2373 characters\)
sed "s/^X//" >'crefine/ccr.man' <<'END_OF_FILE'
X
X
X
XCCR(1)                   USER COMMANDS                     CCR(1)
X
X
X
XNAME
X     ccr - front end to use C-Refine with cc
X
XSYNOPSIS
X     ccr [ options ] inputfile ...
X
XDESCRIPTION
X     ccr is a shell script that will act very much like  your  cc
X     does.   The  only difference is that C-Refine files are pro-
X     cessed by crefine first, before they are handed  to  the  cc
X     compiler.
X
X     The way that ccr works is the following: It looks  at  every
X     argument  you supply in order. If the argument is a filename
X     ending in 'r', it is processed by crefine and  the  filename
X     of the output file replace the original one. All other argu-
X     ments are kept as they are. The resulting argument string is
X     then  used  for a call to cc.  This call will be suppressed,
X     if any errors occured during one of the crefine runs.
X
XOPTIONS
X     All options you supply are handed right through to  cc.   If
X     you  want to supply options for crefine, set up the environ-
X     ment variable CREFINEOPTIONS  as  a  string  containing  the
X     options.
X
XFILES
X     ccr               the ccr shell script
X     myfilename1.cr    C-with-refinements input file.
X     myfilename1.c     generated C input file.
X     myfilename2.c     C input file.
X
XENVIRONMENT
X     CREFINEOPTIONS    contains the option string to be used  for
X                       calls of crefine performed by ccr.
X
XEXAMPLES
X     ccr -g -o firsttest firsttest.cr myfile.c myfile2.o
X          processes the input  file  firsttest.cr  producing  the
X          output   file   firsttest.c   using  crefine,  compiles
X          firsttest.c and myfile.c with option -g and links  both
X          wigh myfile2.o producing firsttest using cc.
X
XDIAGNOSTICS
X     All diagnostic messages stem from either crefine or cc.
X
XSEE ALSO
X     cc(1), crefine(1)
X
XBUGS
X     It is not possible to give options for crefine directly.
X
X
X
X
XSun Release 4.1     Last change: 12 June 1992                   1
X
X
X
X
X
X
XCCR(1)                   USER COMMANDS                     CCR(1)
X
X
X
XVERSION
X     This manpage is for ccr version 1.0
X
XAUTHOR
X     Lutz Prechelt  (prechelt@ira.uka.de)
X     Institut fuer Programmstrukturen und Datenorganisation
X     Universitaet Karlsruhe
X     D-7500 Karlsruhe
X     Germany
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
XSun Release 4.1     Last change: 12 June 1992                   2
X
X
X
END_OF_FILE
if test 2373 -ne `wc -c <'crefine/ccr.man'`; then
    echo shar: \"'crefine/ccr.man'\" unpacked with wrong size!
fi
# end of 'crefine/ccr.man'
fi
if test -f 'crefine/cr_decl.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/cr_decl.h'\"
else
echo shar: Extracting \"'crefine/cr_decl.h'\" \(5988 characters\)
sed "s/^X//" >'crefine/cr_decl.h' <<'END_OF_FILE'
X/*************************************************************************
XProject : C-Refine Precompiler
XModule  : Declarations for global Functions, Types and Data
XAuthor  : Lutz Prechelt, Karlsruhe
XDate    : 12.06.92  Version 17
XCompiler: ANSI C
X**************************************************************************/
X/*
X    Copyright (C) 1988,89,90,91 by Lutz Prechelt, Karlsruhe
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X/*************************************************************************
X*********************** C - R e f i n e **********************************
X**************************************************************************/
X
X#include "std.h"
X
X#if BSD
X#include <strings.h>
X#else
X#include <string.h>
X#endif
X
X/***************** globale Typen und Konstanten **************************/
X
X#define normal_line    1        /* Types for LINE_INFO */
X#define empty_line     2    /* empty line */
X#define refcall_line   3    /* refinement call */
X#define refcallr_line  4    /* dito with "removed semicolon" */
X#define refdecl_line   5    /* refinement declaration */
X#define leave_line     6    /* leave construct */
X
X#define TAB       9       /* ASCII Tabulator has to be recognized */
X
X#if ms_dos
X#define std_refinementsymbol   175   /* IBM: Double arrow to the right */
X#else
X#define std_refinementsymbol    96   /* ASCII: back quote */
X#endif
X
X#if ms_dos
X#define STD_MAXLINELENGTH  500
X#define STD_MAXLINE        800    /* max. nr of lines per function */
X#define STD_MAXREF         100    /* max. nr of refinements per function */
X#define STD_S_SIZE       60000    /* wanted size of line buffer in bytes */
X#else
X#define STD_MAXLINELENGTH  500
X#define STD_MAXLINE       2500
X#define STD_MAXREF         200
X#define STD_S_SIZE      150000
X#endif
X#define STD_MAXERRORS       20
X#define STD_MAXWARNINGS     30
X
Xtypedef char *charp;   /* Needed: the SUN-OS Compiler is a fool */
X
Xtypedef struct { int type,      /* see #defines */
X                     indent,    /* indent+length = width of line */
X                     level,     /* Level at beginning of line */
X                     line_no,   /* line number in source file */
X                     length;    /* stored length in bytes */
X                 charp start;
X               } LINE_INFO;
X
Xtypedef struct { charp name;
X                 int  firstentry,     /* pointer into LINE_INFO array */
X                      calls,          /* nr of usages of this refinement */
X                      semicolons;     /* nr of statements in body */
X                 unsigned active:1,   /* we are just in it ? */
X                          leave_it:1; /* there is a 'leave' for it ? */
X               } REF_INFO;
X
Xtypedef LINE_INFO  *LINES;
X
Xtypedef REF_INFO   *REFS;
X
X/************************* External Functions ****************************/
X
X/***** crefine *****/
Xextern void copy_with_doubled_backslashes A((char *string, char *copy));
X/***** cr_getln *****/
Xextern void init_scanner A(());
Xextern void get_line A((FILE*, LINE_INFO*, int*));
X/***** cr_talk *****/
Xextern void cout A((int));
Xextern void error A((charp[], charp,  int));
Xextern void fatal_error A((charp[], charp, int));
Xextern void warning A((charp[], charp, int, int));
X
X/************************ globale Daten **********************************/
X
X
X/* Meldungstexte */
Xextern charp
X usagestring[],
X versionstring[],
X Tlistline[],
X Tnear[],
X Wempty_function[],
X Wlong_ref[],
X Wref_often_used[],
X Wref_unused[],
X Wref_empty[],
X Wcol0[],
X Wnesting[],
X Wmuch_indent[],
X Wlong_string[],
X Wlong_char[],
X Eopen[],
X Ereadinput[],
X Ewriteoutput[],
X Emissing_r[],
X Elevel0_ref[],
X Elines_in_func[],
X Ebytes_in_func[],
X Eref_not_decl[],
X Erecursive_ref[],
X Eunknown_leave[],
X Eunterminated[],
X Eleave_unpresent[],
X Eref_multi_decl[],
X Ememory[],
X Eeof_brace[],
X Eeof_comment[],
X Eeof_string[],
X Eeof_char[],
X Erefdecl_syntax[],
X Erefdecl_nested[],
X Emany_braces[],
X Erefname_missing[],
X Emany_errors[],
X Emany_warnings[];
X
X#ifdef DATA_HERE
X#define extern
X#endif
X/***** Control *****/
Xextern bool option_anyway,
X            option_comment,
X            option_indent,
X            option_ibmchars,
X            option_list,
X            option_cplusplus,
X            option_verbose,
X            option_small,
X            stop_processing;
X
Xextern int  refinementsymbol,
X            tabsize,
X            numbering_level,
X            feedback_interval,
X            msg_type,
X            warning_level,
X            maxerrors,
X            maxwarnings;
X
X/***** Buffer  *****/
Xextern charp  b,        /* Puffer fuer eine Zeile */
X              s,        /* Naechste freie Position im Zeilenspeicher */
X              s_root;   /* Beginn des Zeilenspeichers */
Xextern unsigned
X            maxline,
X            maxref,
X            b_size,   /* Groesse des Puffers fuer eine Zeile */
X            s_size;   /* Gesamtgroesse des Zeilenspeichers */
X
X/***** Status *****/
Xextern int  errors, warnings,   /* numbers of ...*/
X            line_no,            /* current (virtual) line number */
X            commanded_line_no;  /* line_no according to last line_cmd */
X
Xextern bool error_in_this_function;
Xextern char name_in[200],     /* filenames: input or virtual input */
X            modified_name_in[200],  /* (with doubled backslashes) */
X            name_out[200];          /* output */
X
X#ifdef DATA_HERE
X#undef extern
X#endif
END_OF_FILE
if test 5988 -ne `wc -c <'crefine/cr_decl.h'`; then
    echo shar: \"'crefine/cr_decl.h'\" unpacked with wrong size!
fi
# end of 'crefine/cr_decl.h'
fi
if test -f 'crefine/cr_talk.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/cr_talk.c'\"
else
echo shar: Extracting \"'crefine/cr_talk.c'\" \(3381 characters\)
sed "s/^X//" >'crefine/cr_talk.c' <<'END_OF_FILE'
X
X/*************************************************************************
XProject : C-Refine Precompiler
XModule  : Output functions for messages
XAuthor  : Lutz Prechelt, Karlsruhe
XDate    : 08.05.92  Version 17
XCompiler: C, C-Refine
X**************************************************************************/
X/*
X    Copyright (C) 1988,89,90,91 by Lutz Prechelt, Karlsruhe
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X/************************************************************************
X*********************** C - R e f i n e *********************************
X*************************************************************************/
X
X#include <stdio.h>
X
X#include "cr_decl.h"   /* global Functions, Types and Data */
X#include "cr_texts.h"  /* message texts */
X
Xstatic void error_message A((charp[], charp[], charp, int));
X
X/************************* cout *******************************************/
X
Xextern void cout (i)
X  int i;
X{
X  /* Writes number i on stderr (which is assumed to be a screen)
X     with length five and positions the cursor back to the starting
X     position with five backspaces.
X     This is not very fast, but that doesn't matter.
X  */
X  fprintf (stderr, "%5d\b\b\b\b\b", i);
X}
X
X/************************ error *******************************************/
X
Xstatic void error_message (type, message, object, line)
X  charp type[], message[];
X  charp object;
X  int   line;
X{
X  fprintf (stdout, "\"%s\", line %d, %s: %s\n", name_in,
X           line, type[msg_type], message[msg_type]);
X  if (object != NULL) {
X    char *nl = strchr (object, '\n');
X    if (nl != NULL)     /* remove newline from object */
X      *nl = 0;
X   fprintf (stdout, "    %s \"%s\"\n", Tnear[msg_type], object);
X   if (nl != NULL)
X     *nl = '\n';
X  }
X}
X
X
Xextern void error (message, object, line)
X  charp message[];
X  charp object;
X  int   line;
X{
X  error_message (Terror, message, object, line);
X  if (++errors > maxerrors)
X     fatal_error (Emany_errors, "(-----ManteldesSchweigens-----)", line);
X  error_in_this_function = true;
X}
X
X/************************ fatal_error *************************************/
X
Xextern void fatal_error (message, object, line)
X  charp message[];
X  charp object;
X  int   line;
X{
X  error_message (Tfatal_error, message, object, line);
X  stop_processing = true;
X  errors++;
X}
X
X/************************ warning *****************************************/
X
Xextern void warning (message, object, line, level)
X  charp message[];
X  charp object;
X  int   line, level;
X{
X  if (!error_in_this_function && level <= warning_level) {
X     /* don't be too verbose */
X     error_message (Twarning, message, object, line);
X     if (++warnings > maxwarnings)
X        fatal_error (Emany_warnings, NULL, line);
X  }
X}
X
END_OF_FILE
if test 3381 -ne `wc -c <'crefine/cr_talk.c'`; then
    echo shar: \"'crefine/cr_talk.c'\" unpacked with wrong size!
fi
# end of 'crefine/cr_talk.c'
fi
if test -f 'crefine/cr_talk.cr' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/cr_talk.cr'\"
else
echo shar: Extracting \"'crefine/cr_talk.cr'\" \(3380 characters\)
sed "s/^X//" >'crefine/cr_talk.cr' <<'END_OF_FILE'
X/*************************************************************************
XProject : C-Refine Precompiler
XModule  : Output functions for messages
XAuthor  : Lutz Prechelt, Karlsruhe
XDate    : 08.05.92  Version 17
XCompiler: C, C-Refine
X**************************************************************************/
X/*
X    Copyright (C) 1988,89,90,91 by Lutz Prechelt, Karlsruhe
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X/************************************************************************
X*********************** C - R e f i n e *********************************
X*************************************************************************/
X
X#include <stdio.h>
X
X#include "cr_decl.h"   /* global Functions, Types and Data */
X#include "cr_texts.h"  /* message texts */
X
Xstatic void error_message A((charp[], charp[], charp, int));
X
X/************************* cout *******************************************/
X
Xextern void cout (i)
X  int i;
X{
X  /* Writes number i on stderr (which is assumed to be a screen)
X     with length five and positions the cursor back to the starting
X     position with five backspaces.
X     This is not very fast, but that doesn't matter.
X  */
X  fprintf (stderr, "%5d\b\b\b\b\b", i);
X}
X
X/************************ error *******************************************/
X
Xstatic void error_message (type, message, object, line)
X  charp type[], message[];
X  charp object;
X  int   line;
X{
X  fprintf (stdout, "\"%s\", line %d, %s: %s\n", name_in,
X           line, type[msg_type], message[msg_type]);
X  if (object != NULL) {
X    char *nl = strchr (object, '\n');
X    if (nl != NULL)     /* remove newline from object */
X      *nl = 0;
X   fprintf (stdout, "    %s \"%s\"\n", Tnear[msg_type], object);
X   if (nl != NULL)
X     *nl = '\n';
X  }
X}
X
X
Xextern void error (message, object, line)
X  charp message[];
X  charp object;
X  int   line;
X{
X  error_message (Terror, message, object, line);
X  if (++errors > maxerrors)
X     fatal_error (Emany_errors, "(-----ManteldesSchweigens-----)", line);
X  error_in_this_function = true;
X}
X
X/************************ fatal_error *************************************/
X
Xextern void fatal_error (message, object, line)
X  charp message[];
X  charp object;
X  int   line;
X{
X  error_message (Tfatal_error, message, object, line);
X  stop_processing = true;
X  errors++;
X}
X
X/************************ warning *****************************************/
X
Xextern void warning (message, object, line, level)
X  charp message[];
X  charp object;
X  int   line, level;
X{
X  if (!error_in_this_function && level <= warning_level) {
X     /* don't be too verbose */
X     error_message (Twarning, message, object, line);
X     if (++warnings > maxwarnings)
X        fatal_error (Emany_warnings, NULL, line);
X  }
X}
X
END_OF_FILE
if test 3380 -ne `wc -c <'crefine/cr_talk.cr'`; then
    echo shar: \"'crefine/cr_talk.cr'\" unpacked with wrong size!
fi
# end of 'crefine/cr_talk.cr'
fi
if test -f 'crefine/cr_texts.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/cr_texts.h'\"
else
echo shar: Extracting \"'crefine/cr_texts.h'\" \(10945 characters\)
sed "s/^X//" >'crefine/cr_texts.h' <<'END_OF_FILE'
X/*************************************************************************
XProject : C-Refine Precompiler
XModule  : Message texts
XAuthor  : Lutz Prechelt, Karlsruhe
XDate    : 12.06.92  Version 17
XCompiler: ANSI C
X**************************************************************************/
X/*
X    Copyright (C) 1988,89,90,91 by Lutz Prechelt, Karlsruhe
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
Xcharp
X  usagestring      [] = {
X   "[option | eingabedatei]...",
X   "[options | inputfile]...",
X   "[option | eingabedatei]...",
X   "[options | inputfile]..."
X                        },
X  versionstring    [] = {
X   "Version 3.0   Juni '92",
X   "Version 3.0   June '92",
X   "Version 3.0   Juniieh '92",
X   "Version three-dot-ooh  June '92"
X                        },
X  Terror           [] = {
X   "Fehler",
X   "error",
X   "Faehler",
X   "erorr"
X                        },
X  Twarning         [] = {
X   "Warnung",
X   "warning",
X   "Warnung",
X   "warning"
X                        },
X  Tfatal_error     [] = {
X   "Fataler Fehler",
X   "fatal error",
X   "fatal, fatal",
X   "!@#$^&*(;*^"
X                        },
X  Tlistline        [] = {
X   "   /* %s  (Ebene %d) */",
X   "   /* %s  (Level %d) */",
X   "   /* %s  (Ebene %d) */",
X   "   /* %s  (Level %d) */"
X                        },
X  Tnear            [] = {
X   "bei",
X   "near",
X   "bei",
X   "near"
X                        },
X  Wempty_function  [] = {
X   "Leere Funktion (aber mit Refinements)",
X   "function is empty (but has refinements)",
X   "Viel Gelaber und nix dahinter",
X   "You are refining NOTHING"
X                        },
X  Wlong_ref        [] = {
X   "Sehr langes Refinement",
X   "very long refinement",
X   "Ist das Refinement nicht a bisserl arg lang ?",
X   "veeeryyy looong reeefiiineeemeeent"
X                        },
X  Wref_often_used  [] = {
X   "Refinement ueber 5 mal benutzt",
X   "refinement used more than 5 times",
X   "hektisches ich-bin-ueberall-Refinement",
X   "Superman-refinement (is almost everywhere at the same time)"
X                        },
X  Wref_unused      [] = {
X   "Refinement wird nicht benutzt",
X   "refinement unused",
X   "ein Refinement steht im Walde....",
X   "I feel sohoho looooooonely, nobody wants me!"
X   
X                        },
X  Wref_empty       [] = {
X   "Leeres Refinement",
X   "refinement is empty",
X   "Was will uns dieses Refinement sagen ?",
X   "the set of statements in this refinement is the empty set"
X                        },
X  Wcol0            [] = {
X   "Unerwartete Zeichen in Spalte 0",
X   "unexpected character in column 0",
X   "Was tobt denn da in Spalte 0 rum ?",
X   "Hmm ?  Such stuff in column 0 ?  Awkward!",
X                        },
X  Wnesting         [] = {
X   "Sehr tiefe Blockverschachtelung",
X   "deep block-nesting",
X   "SCHEISS STIL.  Verschachtele doch nicht so tief",
X   "You damn brain-dead C programmer: THOU SHALT NOT NEST DEEP !"
X   
X                        },
X  Wmuch_indent     [] = {
X   "Einrueckung evtl. nicht mehr darstellbar",
X   "perhaps indentation will be reduced",
X   "Das koennte ueber meinen (rechten) Horizont gehen",
X   "Uff, maybe I won't be able to indent that right-wing stuff as you want."
X   
X                        },
X  Wlong_string     [] = {
X   "Langer Stringdenoter hier zu Ende",
X   "end of long string denoter here",
X   "Laaaaaanger Stringdenoter hoert hier auf (na endlich)",
X   "I really thought this string denoter would never end..."
X                        },
X  Wlong_char       [] = {
X   "Langer Character-Denoter hier zu Ende",
X   "end of long character denoter here",
X   "Laaaaanger Character-Denoter hoert hier auf",
X   "The thing ending here is quite long for a single character..."
X                        },
X  Eopen            [] = {
X   "\nKann Datei \"%s\" nicht oeffnen\n",
X   "\nerror opening \"%s\"\n",
X   "\nNa wo isse denn, die Datei \"%s\" ?\n",
X   "\nAm I blind? Where is \"%s\"\n"
X                        },
X  Ereadinput       [] = {
X   "Kann Eingabedatei nicht lesen",
X   "can't read inputfile",
X   "akutes Eingabedateileseunvermoegen",
X   "Sudden analphabetism: can't read inputfile"
X                        },
X  Ewriteoutput     [] = {
X   "Kann Ausgabedatei nicht beschreiben",
X   "can't write outputfile",
X   "akute Ausgabedateischreiblaehmung",
X   "Sudden dyslexia: can't write outputfile",
X                        },
X  Emissing_r       [] = {
X   "Eingabedatei %s mit unerlaubtem Namen (kein 'r' am Ende) wird ignoriert\n",
X   "inputfile %s with illegal name (no trailing 'r') is ignored\n",
X   "Wie soll ich denn ein r von %s entfernen, wenn gar keins da ist ?\n",
X   "How shall I drop a trailing 'r' from '%s', if there is none ??? Haeh?\n"
X                         },
X  Elevel0_ref      [] = {
X   "Refinements ausserhalb einer Funktion gibts nicht",
X   "refinements illegal outside functions",
X   "Ein Refinement ?  Hier draussen in der Wueste ?",
X   "Once upon a time, a little refinement stood alone in the functionless desert"
X                        },
X  Elines_in_func   [] = {
X   "Funktion hat zuviele Zeilen",
X   "too many lines in function",
X   "Soooo viele Zeilen in einer Funktion haelt ja kein Computer aus",
X   "Can't stand thaaat many lines in a single function"
X                        },
X  Ebytes_in_func   [] = {
X   "Funktion zu lang (in Bytes)",
X   "too many bytes in function",
X   "Tolle Funktion.  Aber, in Bytes betrachtet, entschieden zu gross.",
X   "Can't stand thaaat many bytes in a single function"
X                        },
X  Eref_not_decl    [] = {
X   "Refinement nicht deklariert",
X   "undeclared refinement",
X   "Wer oder was soll das sein ?",
X   "Hmm. I swear I don't know about this refinement"
X                        },
X  Erecursive_ref   [] = {
X   "Rekursiver Refinementaufruf",
X   "recursive call to refinement",
X#define _rum_und_rum   "und rum und rum und rum und rum und rum und rum\
X und rum und rum (rekursives Refinement)",
X   _rum_und_rum
X   "recursive call to recursive call to recursive call to rec.... to refinement"
X                        },
X  Eunknown_leave   [] = {
X   "zu verlassendes Refinement unbekannt",
X   "refinement to leave is unknown",
X   "WAS soll da verlassen werden ???",
X   "WHAT do you want to leave ???"
X                        },
X  Eunterminated    [] = {
X   "Schliessendes Anfuehrungszeichen fehlt",
X   "Closing double quotes missing",
X   "Huch, schon zu Ende ?  Wo sind die anderen Quotes ?",
X   "(in a begging voice:) Please, give closing quotes for a poor string"
X                        },
X  Eleave_unpresent [] = {
X#define _unpresent "Wir sind nicht in diesem Refinement, also kann es\
X auch nicht verlassen werden",
X   _unpresent
X   "you are not within this refinement, thus it's impossible to leave it",
X#define _wenn_du   "Wenn Du denkst zu sein, wo ich denke (und du\
X schreibst), dass du zu sein denkst, denkst du falsch.",
X   _wenn_du
X  "You are not where you think you are. Thus you cannot leave from there."
X                        },
X  Eref_multi_decl  [] = {
X   "Refinement mehrfach deklariert",
X   "refinement declared more than once",
X   "Langweilig!  Das Refinement gibts doch laengst",
X   "Bah! Old stuff! I've long before known this refinement already",
X                        },
X  Ememory          [] = {
X   "\n***** Speichermangel *****\n",
X   "\n***** not enough memory *****\n",
X   "\n  Des Bissele Speische is mi abe zu wenisch !\n",
X   "\n***** memory claustrophobia *****\n",
X                        },
X  Eeof_brace       [] = {
X   "Dateiende bei offener geschweifter Klammer",
X   "EOF within block",
X   "In der U-Bahn geboren, oder was ?   Mach erst mal alle Bloecke zu.",
X   "Born in an underground train, or what ?  Close your blocks, please",
X                        },
X  Eeof_comment     [] = {
X   "Dateiende im Kommentar",
X   "EOF in comment",
X#define _so_toll   "So toll sind Deine Kommentare nun auch nicht, dass\
X sie bis ans Dateiende gehen sollten",
X   _so_toll
X   "I do not think you should continue this comment all the rest of your life."
X                        },
X  Eeof_string      [] = {
X   "Dateiende im Stringdenoter",
X   "EOF in string denoter",
X   "Hoerst Du immer mitten im Satz auf ?  Da ist noch ein String offen",
X   "Oops! End of file, but no closing quotes for this string ?"
X                        },
X  Eeof_char        [] = {
X   "Dateiende im Character-Denoter",
X   "EOF in character denoter",
X   "EOF in Character-Denoter.  Demnaechst halbieren sie noch die Bits....",
X   "EOF in character denoter. It won't be long until they half the bits",
X                        },
X  Erefdecl_syntax  [] = {
X   "falsche Syntax fuer Refinementdeklaration",
X   "illegal syntax for refinement declaration",
X   "Es begann wie eine Refinementdeklaration. Aber dann.....",
X   "First it looked like a refinement declaration, but then..."
X                        },
X  Erefdecl_nested  [] = {
X   "Mehr als ein Block offen bei Refinementdeklaration",
X   "refinement declaration in nested block",
X#define _du_bist "Du bist an dieser Stelle viel zu tief in dein Programm\
X verstrickt, um ein Refinement zu deklarieren",
X   _du_bist
X#define _unblock "A block in a block blocks refinement declarations.\
X Unblock the blocked refinement declarations by closing a block first"
X  _unblock
X                        },
X  Emany_braces     [] = {
X   "Zuviel schliessende Blockklammern",
X   "too many closing braces",
X#define _aufmachen   "Wenn Du jetzt noch eine Blockklammer aufmachst,\
X dann sind gar keine mehr offen",
X   _aufmachen
X   "If you open one more block now, none will be open at all..."
X                        },
X  Erefname_missing [] = {
X   "Refinementsymbol ohne Refinementname",
X   "refinement symbol found without refinement name",
X   "Das Refinementsymbol fuehlt sich einsam so ganz ohne Name",
X   "This refinement symbol will fell rather alone without a refinement name"
X                        },
X  Emany_errors     [] = {
X   "Zu viele Fehler. Uebersetzung wird abgebrochen.",
X   "too many errors,  compilation stopped",
X   "Fiel zufiele Feeler",
X   "I will now stop this horrorful compilation"
X                        },
X  Emany_warnings   [] = {
X   "Zu viele Warnungen. Uebersetzung wird abgebrochen",
X   "too many warnings, compilation stopped",
X   "(So viele Warnungen sind mir nicht geheuer)",
X   "Summing up, things look really a bit doubtful in this file."
X                        };
X
X
END_OF_FILE
if test 10945 -ne `wc -c <'crefine/cr_texts.h'`; then
    echo shar: \"'crefine/cr_texts.h'\" unpacked with wrong size!
fi
# end of 'crefine/cr_texts.h'
fi
if test -f 'crefine/erato.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/erato.c'\"
else
echo shar: Extracting \"'crefine/erato.c'\" \(2259 characters\)
sed "s/^X//" >'crefine/erato.c' <<'END_OF_FILE'
X
X/*************************************************************************
XModule  : C-Refine example program
XAuthor  : Lutz Prechelt, Karlsruhe
XDate    : 23.01.91
X**************************************************************************
X/*
X    Copyright (C) 1988,90 by Lutz Prechelt, Karlsruhe
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X#define MAX        10000
X#define PRIME      0
X#define NON_PRIME  1
X
Xstatic int sieve[MAX+1];
X
Xint main ()
X{
X  {   /* initialize  (Level 1) */
X  int current;
X  for (current = 2; current <= MAX; current++)
X    sieve[current] = PRIME;
X  }
X  {   /* do_sieve  (Level 1) */
X  int current_prime = 1;
X  for (;;) {
X    {   /* find_next_bigger_prime  (Level 2) */
X    int current_candidate = current_prime + 1;
X    while (sieve[current_candidate] == NON_PRIME)
X      if (current_candidate == MAX)
X    goto do_sieve_1;
X        /* leave two refinements at once */
X      else
X        current_candidate++;
X    /* now current_candidate is a prime (or we leave `sieve) */
X    current_prime = current_candidate;
X    }
X    /* perhaps STOP here */
X    {   /* delete_all_multiples_of_current_prime  (Level 2) */
X    int current = (
X    2 * current_prime);
X    while (current <= MAX) {
X      sieve[current] = NON_PRIME;
X      current += current_prime;
X    }
X    }
X  }
Xdo_sieve_1: ;
X  }
X  {   /* make_output  (Level 1) */
X  int current;  /* different from 'current' above */
X  printf ("The primes between 2 and %d are\n", MAX);
X  for (current = 2; current <= MAX; current++)
X    if ((
X    sieve[current] == PRIME)
X    )
X      printf ("%5d ", current);
X  }
X  return (0);
X} /* end of main() */
END_OF_FILE
if test 2259 -ne `wc -c <'crefine/erato.c'`; then
    echo shar: \"'crefine/erato.c'\" unpacked with wrong size!
fi
# end of 'crefine/erato.c'
fi
if test -f 'crefine/erato.cr' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/erato.cr'\"
else
echo shar: Extracting \"'crefine/erato.cr'\" \(2305 characters\)
sed "s/^X//" >'crefine/erato.cr' <<'END_OF_FILE'
X/*************************************************************************
XModule  : C-Refine example program
XAuthor  : Lutz Prechelt, Karlsruhe
XDate    : 23.01.91
X**************************************************************************
X/*
X    Copyright (C) 1988,90 by Lutz Prechelt, Karlsruhe
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X#define MAX        10000
X#define PRIME      0
X#define NON_PRIME  1
X
Xstatic int sieve[MAX+1];
X
Xint main ()
X{
X  `initialize;
X  `do sieve;
X  `make output;
X  return (0);
X  
X`initialize:
X  int current;
X  for (current = 2; current <= MAX; current++)
X    sieve[current] = PRIME;
X    
X`do sieve:
X  int current_prime = 1;
X  for (;;) {
X    `find next bigger prime;  /* perhaps STOP here */
X    `delete all multiples of current_prime;
X  }
X
X`find next bigger prime:
X  int current_candidate = current_prime + 1;
X  while (sieve[current_candidate] == NON_PRIME)
X    if (current_candidate == MAX)
X      leave `do sieve;    /* leave two refinements at once */
X    else
X      current_candidate++;
X  /* now current_candidate is a prime (or we leave `sieve) */
X  current_prime = current_candidate;
X  
X`delete all multiples of current_prime:
X  int current = `first multiple of current_prime;
X  while (current <= MAX) {
X    sieve[current] = NON_PRIME;
X    current += current_prime;
X  }
X  
X`first multiple of current_prime:
X  2 * current_prime
X
X`make output:
X  int current;  /* different from 'current' above */
X  printf ("The primes between 2 and %d are\n", MAX);
X  for (current = 2; current <= MAX; current++)
X    if (`current is prime)
X      printf ("%5d ", current);
X
X`current is prime:
X  sieve[current] == PRIME
X
X} /* end of main() */
END_OF_FILE
if test 2305 -ne `wc -c <'crefine/erato.cr'`; then
    echo shar: \"'crefine/erato.cr'\" unpacked with wrong size!
fi
# end of 'crefine/erato.cr'
fi
if test -f 'crefine/getargs.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/getargs.h'\"
else
echo shar: Extracting \"'crefine/getargs.h'\" \(2035 characters\)
sed "s/^X//" >'crefine/getargs.h' <<'END_OF_FILE'
X/*************************************************************************
XModule  : getargs -- command line option processor
XAuthor  : Lutz Prechelt, Karlsruhe
XDate    : 15.11.91  Version 3
X**************************************************************************/
X/*
X    Copyright (C) 1988,91 by Lutz Prechelt, Karlsruhe
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X/************************************************************************
X*********************** g e t a r g s ***********************************
X*************************************************************************/
X
X#define INTEGER   0
X#define BOOLEAN   1
X#define CHARACTER 2
X#define STRING    3
X
Xtypedef struct {
X	char arg;
X	char type;
X	int  *variable;
X	char *errmsg;
X	} ARG;
X
X#define ARGTABSIZE(a) (sizeof (a) / sizeof (ARG))
X
Xextern int  getargs A((int *argc, char ***argvp, ARG argtab[], int argtabsize));
Xextern void print_usage A((char *progname, char *usage,
X                           ARG tabp[], int argtabsize));
X
X#if 0
X
XExample or template:
X
X/* Definition global (Initialization of Array) ! */
X
Xstatic ARG argtab[] = {
X  {'x', TYPE,   &var_x,      "function of option x" },
X  .
X  .
X};
X
X/* Call : */
X
X  if (getargs (&argc, &argv, argtab, ARGTABSIZE (argtab)) || argc != 3)
X     print_usage (argv[0], "[options] inputfile outputfile [options]",
X                  argtab, ARGTABSIZE (argtab));
X
X#endif
X
END_OF_FILE
if test 2035 -ne `wc -c <'crefine/getargs.h'`; then
    echo shar: \"'crefine/getargs.h'\" unpacked with wrong size!
fi
# end of 'crefine/getargs.h'
fi
if test -f 'crefine/patchlevel.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/patchlevel.h'\"
else
echo shar: Extracting \"'crefine/patchlevel.h'\" \(139 characters\)
sed "s/^X//" >'crefine/patchlevel.h' <<'END_OF_FILE'
X/* This file is not really used. Please look into cr_texts.h */
X
X#define version  "C-Refine Version 3.0"
X#define patchlevel "Patchlevel 1"
END_OF_FILE
if test 139 -ne `wc -c <'crefine/patchlevel.h'`; then
    echo shar: \"'crefine/patchlevel.h'\" unpacked with wrong size!
fi
# end of 'crefine/patchlevel.h'
fi
if test -f 'crefine/std.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'crefine/std.h'\"
else
echo shar: Extracting \"'crefine/std.h'\" \(2016 characters\)
sed "s/^X//" >'crefine/std.h' <<'END_OF_FILE'
X/*************************************************************************
XModule  : Header file: mothers little helpers --- bool, assert, prototype args 
XAuthor  : Lutz Prechelt, Karlsruhe
XDate    : 08.05.92
XCompiler: ANSI C, K&R C
X**************************************************************************
X/*
X    Copyright (C) 1988 by Lutz Prechelt, Karlsruhe
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X#ifndef stdh_
X#define stdh_
X
X#if __STDC__
X#define A(a) a
X#else
X#define A(a) ()
X#endif
X
Xtypedef int  bool;   /* or 'enum' but some debuggers don't like that */
X#define true    1
X#define false   0
X
X#ifndef NDEBUG
X
X#define _assert_str "\nOOPS !!  Assertion failed: file \"%s\", line %d\
X  (CR to continue)"
Xstatic char _assert_string[] = _assert_str;
X#define _avoid_str "\nOOPS !!  %d happened in file \"%s\", line %d\
X  (CR to continue)"
Xstatic char _avoid_string[]  = _avoid_str;
X
X#define assert(e)  \
X	 (!(e)  ? ( \
X	             fprintf(stderr, _assert_string,  __FILE__, __LINE__), \
X	             fgetc (stdin) \
X             ) \
X                : 1 \
X	)
X
X#define avoid(e,u)  \
X        ((e)!=(u) ? ( \
X                    fprintf(stderr, _avoid_string, (e), __FILE__, __LINE__), \
X                    fgetc (stdin) \
X                    ) \
X                  : 1 \
X        )
X
X#else
X
X#define assert(e)    1
X#define avoid(e,u)   1
X
X#endif /* NDEBUG */
X
X
X#endif
END_OF_FILE
if test 2016 -ne `wc -c <'crefine/std.h'`; then
    echo shar: \"'crefine/std.h'\" unpacked with wrong size!
fi
# end of 'crefine/std.h'
fi
echo shar: End of archive 1 \(of 6\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 6 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Frank Kaefer # fkk@stasys.sta.sub.org # Starnberg, Germany
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads