diff --git a/INSTALL b/INSTALL index f1d76e63f2c7dcfe644bdee971b4964da8718373..8a1209ff56f7a33310bbbaf2dfcdd256f20f365d 100644 --- a/INSTALL +++ b/INSTALL @@ -1,42 +1,35 @@ -Building on Solaris or Other Unices ------------------------------------ +Building on Unices +------------------ -1. Extract the datadec-1.1.tgz file, creating a datadec-1.0 directory +1. Extract the datadec-1.2.tgz file, creating a datadec-1.2 directory 2. Compile datadec: - cd datadec-1.1 + cd datadec-1.2 make -3. EITHER - -a. Install it (run this as root) into /usr/local/bin and /usr/man/man1: +3. Install it (run this as root) into /usr/local/bin and /usr/share/man/man1: make install -b. or, package datadec up and install it via adding the package: - - cd PKG/Solaris - make - - then install the package (as root): - - pkgadd -d datadec-1.0-1-sol8-sparc-dcw all +4. check that datadec is now on your path, eg. rehash, which datadec +5. cd test; make; ./ctest -Building and Packaging Datadec on RPM-based Linux -------------------------------------------------- -Either download http://csgsoft.doc.ic.ac.uk/datadec/datadec-1.0-1.i386.rpm -and install it (rpm -i) from there, or do a source build: +Notes on Packaging +------------------ -1. Download the datadec-1.1.tgz file and save it in your RPM SOURCES directory. +An alternative to (3) is to package datadec up and install it via installing +the package. There are many different packaging systems: over the years, we +have packaged datadec for Solaris, Redhat Linux and Debian/Ubuntu Linux, but +only the Debian/Ubuntu packaging is up to date. -2. Download the package spec file datadec.spec: - -3. Build the package using the spec file: +- For Debian/Ubuntu/Debian-derived distros, the tarball includes the debian + subdirectory, this should work, invoke "dpkg-buildpackage -tc -rfakeroot" + as usual (on a machine with the debian packaging tools installed). +- Also in this directory is a (nontested) RPM .spec file, which may serve as + a basis for you to build an RPM, via rpm -bb datadec.spec - -4. Now you can install the datadec-1.1-1.is386.rpm that you just built, - using rpm -i.. + (but it almost certainly won't work out of the box). diff --git a/Makefile b/Makefile index f4e71b9a54223d4995972db611d6467766a47a6a..c0f435039f938095d73d6eb844f020022d333725 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ -CC = gcc -#CC = cc -DEST = $(PREFIX)/usr -BINDIR = $(DEST)/bin -MANDIR = $(DEST)/man/man1 -CFLAGS = -g -UDEBUGGING -Wall +CC = gcc +#CC = cc +DEST = $(PREFIX)/usr +BINDIR = $(DEST)/bin +MANDIR = $(DEST)/man/man1 +CFLAGS = -g -UDEBUGGING -Wall LDLIBS = -EXECS = datadec +EXECS = datadec -datadec_srcs = datadec.c parser.c lexer.c struct.c decs.c optimize.c -datadec_objs = datadec.o parser.o lexer.o struct.o decs.o optimize.o +datadec_srcs = datadec.c parser.c lexer.c struct.c decs.c optimize.c +datadec_objs = datadec.o parser.o lexer.o struct.o decs.o optimize.o all: $(EXECS) @@ -19,6 +19,7 @@ install: $(EXECS) clean: /bin/rm -f *.o a.out core $(EXECS) + cd test; make clean datadec: $(datadec_objs) $(CC) -g -o datadec $(datadec_objs) diff --git a/README b/README index 8168eb86bd97fe4a47736471fc4ad33ea12ca19b..ddc209c78e0af440c3077d1fa55a59494a5487e1 100644 --- a/README +++ b/README @@ -1,10 +1,15 @@ -Datadec takes recursive data types modelled on those found in functional -languages (Hope, Miranda, Haskell etc) and generates ANSI C code to -implement them. +Datadec takes inductive (or recursive) data types modelled on those found in +functional languages (Hope, Miranda, Haskell etc) and generates ANSI C code +to implement them. Duncan C. White, dcw@doc.ic.ac.uk 19th March 2002 +New! experimental free functions (run datadec with new -f option) + + Duncan C. White, d.white@imperial.ac.uk + 28th May 2014 + An Example of Datadec in Action ------------------------------- @@ -24,11 +29,11 @@ idtree = leaf( string id, illist l ) What does this mean? The first rule declares that an intlist can take two basic "shapes" - -it is either empty, nil, or of the form cons(int,intlist). -nil and cons() are called constructors, and define different +it is either empty, aka nil, or of the form cons(int,intlist). +nil() and cons() are called constructors, and define different "shapes" that objects of the type can take. However, because the second argument of a cons() constructor is itself -an intlist, this type is said to be recursively defined. +an intlist, this type is said to be recursively or inductively defined. Functional programmers will recognise nil or cons() as the standard way of defining a list, so more intuitively, intlist is simply a list of integers! @@ -42,6 +47,9 @@ module which implements all the data types, a constructor function for each constructor, deconstructor functions to help you to take objects apart again and printing functions to help you with debugging. +(Plus, new May 2014: a tree-walking free function if you invoke datadec +with the new -f option). + Building and Packaging datadec ------------------------------ @@ -56,4 +64,3 @@ input file which declares some recursive data types (lists and trees), and ctest.c is the test harness that uses them. cd into test and run make to turn cdata.in into cx.h and cx.c, and to compile cx.c and ctest.c and link them.. - diff --git a/debian/changelog b/debian/changelog index a3ad8e0935a0ef0cd8180ba05fcc311f00e17e4c..1ffaff15dd6e53ea5121498b081741ab32d107fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +datadec (1.2) trusty; urgency=low + + * added experimental free_TYPE() generation (-f option to datadec) + + -- Duncan C. White Thu, 14 Aug 2014 15:06:06 +0100 + datadec (1.1-1) unstable; urgency=low * Initial release, created by dh_make as a test diff --git a/parser.c b/parser.c index 2f01757530624209e4a0d2ab01fe9fcc7e426ff5..0cef290e826a28acc2f609725b94d0b7bf5409a9 100644 --- a/parser.c +++ b/parser.c @@ -91,7 +91,7 @@ BOOL parse_data( char *exports, char *globals, char *begin, declnlist *dp ) MUSTBE( tTYPE, "TYPE/EXPORT/GLOBAL/BEGIN expected" ); MUSTBE( tOPENCURLY, "{ expected" ); if( ! parse_declns( dp ) ) return FALSE; - MUSTBE( tCLOSECURLY, "{ expected" ); + MUSTBE( tCLOSECURLY, "} expected" ); MUSTBE( tEOF, "Spurious characters found beyond EOF" ); return TRUE; @@ -204,7 +204,7 @@ static BOOL parse_shape( char **tagname, paramlist *pl, printlist *print ) { if( ! parse_params( pl ) ) return FALSE; - MUSTBE( tCLOSEBR, "')' expected" ); + MUSTBE( tCLOSEBR, "',' or ')' expected" ); } else { ungettok(); diff --git a/test/Makefile b/test/Makefile index 0ab9fdd9d867407b155af43fe55f62a7f2b19259..c706b63eb8126a0a27c75c5ae35dbf3fc8a1da15 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,7 +1,7 @@ DEST = $(TOOLDIR) LIBDIR = $(DEST)/lib/$(ARCH) INCDIR = $(DEST)/include -CFLAGS = -I. -I$(INCDIR) -g -UDEBUGGING -Wall +CFLAGS = -I. -I$(INCDIR) -g -UDEBUGGING -Wall LDLIBS = -L$(LIBDIR) -lmem TESTEXECS = ctest AUTOCRAP = ctest.o cx.[och]