/* les de'clarations de types Lisp en C */
typedef int LL←FIX;
typedef int LL←FLOAT;
/*
Comme C ne connai↑t pas les types polymorphes, il faut se rabbatre
sur la de'claration suivante pour les objets Lisp.
typedef union {
struct LL←SYMBOL *ll←symbol;
struct LL←CONS *ll←cons;
struct LL←STRING *ll←string;
struct LL←VECTOR *ll←vector;
LL←FIX ll←fix;
LL←FLOAT ll←float;
} LL←OBJECT;
C n'autorise he'las pas le passage d'une union comme argument de fonctions
(me↑me si cette union a pour taille un pointeur!).
On en arrive donc a` l'horreur suivante\ :
*/
typedef char *LL←OBJECT;
struct LL←SYMBOL {
LL←OBJECT ll←cval;
LL←OBJECT ll←plist;
LL←OBJECT ll←fval;
LL←OBJECT ll←alink;
LL←OBJECT ll←pkgc;
LL←OBJECT ll←oval;
char ll←ftype;
char ll←ptype;
short ll←pad;
LL←OBJECT ll←pname;
};
struct LL←CONS {
LL←OBJECT ll←car;
LL←OBJECT ll←cdr;
};
/*
C n'autorise pas les structures de taille variable.
Le champ ll←strfil contient le premier caracte`re de la chai↑ne
Lisp. Les autres caracte`res sont conse'cutifs a` celui-ci dans
la me'moire.
Exemple\ : impression d'une chai↑ne Lisp
voir(s) struct LL←STRING *s; {
write(1, &((s->ll←strobj)->ll←strfil), (s->ll←strobj)->strsize);
}
*/
struct LL←STRING {
struct {
struct LL←STRING *ll←strarr;
int ll←strsiz;
char ll←strfil;
} *ll←strobj;
LL←OBJECT ll←strtyp;
};
/*
Me↑me remarque pour le champ ll←vecfil que pour le champ ll←strfil
*/
struct LL←VECTOR {
struct{
struct LL←VECTOR *ll←vecarr;
int ll←vecsiz;
LL←OBJECT ll←vecfil;
} *ll←vecobj;
LL←OBJECT ll←vectyp;
};
/* Les types symbolique des arguments */
#define LLT←T 0 /* Objet quelconque */
#define LLT←FIX 1 /* Entier */
#define LLT←FLOAT 2 /* Flottant */
#define LLT←STRING 3 /* Chaine de caracteres */
#define LLT←VECTOR 4 /* Vecteur */
/* Les fonctions permettant l'interface C ---> Lisp */
/* struct LL←SYMBOL *getsym (pname) char *pname; */
struct LL←SYMBOL *getsym();
/* void pusharg (ll←type, value) int ll←type; any value; */
void pusharg();
/* LL←OBJECT lispcall (ll←type, narg, symbol)
int ll←type, narg; struct LL←SYMBOL *symbol; */
LL←OBJECT lispcall();