# Installing Dada engine



## Despard (Aug 24, 2005)

I'm trying to run the dada engine (to generate random text based on rules) but I can't seem to get it to work. I've downloaded the source code, run ./configure, make and sudo make install. It's installed everything I need.

But when I try to run it - no output. I can make the pb program, which is the text generator, work fine if I include commands which don't involve the C preprocessor. The user interface, dada, contains the following code:

Code:


```
#!/bin/sh
# User interface/wrapper for the Dada Engine
# Author:    acb
# Commenced: 14-7-1995

PBDIR="/usr/local/bin"
DADAROOT="/usr/local/lib/dada"
CPP=""

#CPP="/lib/cpp"
#CPPARGS="-lang-c++"
FILES=""
#PB="`dirname $0`/pb"
#INCLUDE="-I`dirname $0`/include -I$DADAROOT/include"
PB="${PBDIR}/pb"
INCLUDE="-I${DADAROOT}/include"

while test $# -gt 0
do
  case $1 in
    -D*) CPPARGS="$1 $CPPARGS";;
    -o) PBARGS="$PBARGS $1 $2"; shift;;
    -p) PBARGS="$PBARGS $1";;
    -r) PBARGS="$PBARGS $1 $2"; shift;;
    -s) PBARGS="$PBARGS $1 $2"; shift;;
    -w) PBARGS="$PBARGS $1 $2"; shift;;
    *) CPPARGS="$CPPARGS $1";;
  esac
  shift
done

($CPP $INCLUDE $CPPARGS 2>/dev/null) | $PB $PBARGS
```

I'm sure there must be a problem with a path in there somewhere or something. I tried changing the empty "" in line 8 to "/usr/bin/cpp", the location of cpp, and I got some output then... but various scripts give runtime or other errors now!

Anyone got any ideas?


----------



## Despard (Aug 31, 2005)

Bump.

It'd be great if someone could give me a hand with this. Please?


----------



## spb (Sep 1, 2005)

I don't know about dada, but...

($CPP $INCLUDE $CPPARGS 2>/dev/null) | $PB $PBARGS

and 

$CPP =
$INCLUDE = -I$/usr/local/lib/dada/include
$CPPARGS = 
$PB = /usr/local/bin/pb
$PBARGS = depends on input flag (-o, -p, -r, -s, or -w) and command line args

Right away we see that it needs you to define CPP.  

I have no idea what you pass as PBARGS or CPPARGS?

Hmmm according to the data manual http://dev.null.org/dadaengine/manual-1.0/dada_toc.html you call this script with:

dada myscript.pb

Which says to me that in the most simple example you are trying to call 

/usr/bin/cpp -I$/usr/local/lib/dada/include myscript.pb  2>/dev/null | /usr/local/bin/pb

Sorry that I can't help more, but the dada manual isn't very helpful (for me).  Maybe you can download example *.pb files?


----------



## spb (Sep 1, 2005)

I just downloaded dada and there's a dozen example scripts in "dada-1.03/scripts/" and "dada-1.03/scripts/test/" 

There also is a man page for both dada and pb. 

Try one of these scripts and see if it works...


----------



## Despard (Sep 2, 2005)

PBARGS and CPPARGS are defined in the while loop of the dada user interface program, and come from the command line.

As I said, I changed line 8 to 

```
CPP="/usr/bin/cpp"
```
which produces output.

I've tried a couple of the scripts, and most of them work but there are some problems. I get these error messages for the following scripts:

dada-1.03/scripts/test/

codetest.pb: bus error
concattest.pb: undefined variable `c'
repeattest.pb: undefined variable `foo'

dada-1.03/scripts/

crackpot.pb: undefined variable `PLAIN_footnotes'
manifesto.pb: undefined variable `pointnum'
pomo.pb: bus error

I can't work out what's wrong.


----------



## spb (Sep 2, 2005)

The contents of concattest.pb is four lines

s: { res="\n" ; c=0 } a $res ;

a: a b | a c | b | c ;

b: $c { res=res+"foo" ; c=c+1 };

c: $c { res=res+"bar" ; c=c+1 };

Apparently there is something wrong with line 1 because c is undefined when you get to the lower lines, per your message.  

What does the manual say about the syntax?  Is there a typo on this line?


----------

