Path: utzoo!attcan!uunet!husc6!uwvax!dogie!uwmcsd1!leah!bingvaxu!sunybcs!jagota
From: jagota@sunybcs.uucp (Arun Jagota)
Newsgroups: comp.lang.lisp
Subject: Calling C functions from Franz Lisp
Message-ID: <12196@sunybcs.UUCP>
Date: 24 Jun 88 17:27:05 GMT
Sender: nobody@sunybcs.UUCP
Lines: 50


I've been able to call C functions from Franz Lisp but am having 
trouble creating Lisp lists in C and passing them back to Franz Lisp.

I'm running this on a Vax 11-785 running Unix 4.3 BSD.

My application can be thought of as a data base with an AI front end. 
The data base operations are implemented in C for speed and efficiency 
but I'd like to perform certain higher level operations on retrieved 
data in Franz Lisp and SNePS, a semantic network embedded in Franz Lisp.

Most of my C functions retrieve certain words from the data base,
create a list (in lisp format) to store them and pass them back to 
the lisp program that called the C function. 
I AM HAVING PROBLEMS IN PASSING BACK THE LIST I CREATE IN THE C
FUNCTION.

Lisp format in C that I use (As documented in the Franz Lisp manual).

struct lisplist 
  { struct lisplist *cdr;
    int 	     car;
   }

My C function then creates a list as follows.

struct lisplist *temp,*current;

-- Assume "word" is a new item to be inserted into list

-- char *word;

-- Adding "word" to the list as the first atom

temp = (struct lisplist *) malloc(sizeof(*temp));
temp->car = (int) word;
temp->cdr = current;
current = temp;


Any help will be DEEPLY APPRECIATED.

Thanks,

Arun Jagota

UUCP   : {cmc12,hao,harpo}!seismo!rochester!rocksvax!sunybcs!jagota
         ...{allegra,decvax,watmath}!sunybcs!jagota
CSNET  :  jagota@cs.buffalo.edu
BITNET :  jagota@sunybcs