Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
C-datadec
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Duncan White
C-datadec
Commits
8ea91dcb
Commit
8ea91dcb
authored
Nov 27, 2014
by
Duncan White
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imported bugfixes from ~dcw/src/C/datadec/datadec-1.2 dir
parent
2c624798
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
44 deletions
+51
-44
INSTALL
INSTALL
+19
-26
Makefile
Makefile
+10
-9
README
README
+14
-7
debian/changelog
debian/changelog
+6
-0
parser.c
parser.c
+2
-2
No files found.
INSTALL
View file @
8ea91dcb
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):
4. check that datadec is now on your path, eg. rehash, which datadec
pkgadd -d datadec-1.0-1-sol8-sparc-dcw all
5. cd test; make; ./ctest
Building and Packaging Datadec on RPM-based Linux
------------------
-------------------------------
Notes on Packaging
------------------
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:
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.
1. Download the datadec-1.1.tgz file and save it in your RPM SOURCES directory.
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).
Makefile
View file @
8ea91dcb
...
...
@@ -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)
...
...
README
View file @
8ea91dcb
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..
debian/changelog
View file @
8ea91dcb
datadec (1.2) trusty; urgency=low
* added experimental free_TYPE() generation (-f option to datadec)
-- Duncan C. White <dcw@doc.ic.ac.uk> Thu, 14 Aug 2014 15:06:06 +0100
datadec (1.1-1) unstable; urgency=low
* Initial release, created by dh_make as a test
...
...
parser.c
View file @
8ea91dcb
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment