Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

lisp.h File Reference

Definitions for Lisp objects in Xconq. More...

#include "parambox.h"
#include "keyword.def"

Include dependency graph for lisp.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Namespaces

namespace  Xconq

Classes

struct  a_cons
 Cons object. More...

struct  a_symbol
 Symbol object. More...

struct  a_pointer
 Pointer object. More...

struct  a_obj
 Lisp object. More...

struct  a_symentry
 Symbol table. More...

struct  a_strm
 Stream. More...


Defines

#define CONTEXTSIZE   129
 context buffer size.

#define DEF_KWD(name, CODE)   CODE,
#define match_keyword(ob, key)   (symbolp(ob) && strcmp(c_string(ob), keyword_name(key)) == 0)
 Match keyword.

#define for_all_list(lis, rest)   for (rest = (lis); rest != lispnil; rest = cdr(rest))
 Iterate list.

#define for_both_lists(lis1, lis2, rest1, rest2)
 Iterate through two lists.


Typedefs

typedef a_obj Obj
 Lisp object.

typedef a_symentry Symentry
 Symbol table.

typedef a_strm Strm
 Stream.


Enumerations

enum  lisptype {
  NIL, CONS, NUMBER, STRING,
  SYMBOL, UTYPE, MTYPE, TTYPE,
  ATYPE, POINTER, EOFOBJ
}
 Lisp object types. More...

enum  strmtype { stringstrm, filestrm }
 Stream type. More...

enum  keywords { LAST_KEYWORD }

Functions

void init_lisp (void)
Objread_form (FILE *fp, int *p1, int *p2)
Objread_form_from_string (char *str, int *p1, int *p2, char **endstr)
int length (Obj *list)
Objnew_string (char *str)
Objnew_number (int num)
Objnew_utype (int u)
Objnew_mtype (int r)
Objnew_ttype (int t)
Objnew_atype (int s)
Objnew_pointer (Obj *sym, char *ptr)
Objcons (Obj *x, Obj *y)
void type_warning (char *funname, Obj *x, char *errtype, Obj *subst)
Objcar (Obj *x)
Objcdr (Obj *x)
Objcadr (Obj *x)
Objcddr (Obj *x)
Objcaddr (Obj *x)
Objcdddr (Obj *x)
void set_cdr (Obj *x, Obj *v)
char * c_string (Obj *x)
int c_number (Obj *x)
Objintern_symbol (char *str)
Objsymbol_value (Obj *sym)
Objsetq (Obj *sym, Obj *x)
void makunbound (Obj *sym)
void flag_as_constant (Obj *sym)
int constantp (Obj *sym)
int numberp (Obj *x)
int stringp (Obj *x)
int symbolp (Obj *x)
int consp (Obj *x)
int utypep (Obj *x)
int mtypep (Obj *x)
int ttypep (Obj *x)
int atypep (Obj *x)
int pointerp (Obj *x)
int boundp (Obj *sym)
int numberishp (Obj *x)
int listp (Obj *x)
int equal (Obj *x, Obj *y)
int member (Obj *x, Obj *lis)
Objelt (Obj *lis, int n)
Objreverse (Obj *lis)
Objfind_at_key (Obj *lis, char *key)
Objreplace_at_key (Obj *lis, char *key, Obj *newval)
int is_quoted_lisp (Obj *x)
void fprint_num_or_dice (FILE *fp, int x, int valtype)
 Print dice spec or a straight integer.

void fprinttable (FILE *fp, int n)
void fprintlisp (FILE *fp, Obj *oobj)
void fprint_list (FILE *fp, Obj *obj)
void sprintlisp (char *buf, Obj *obj, int maxlen)
void sprint_list (char *buf, Obj *obj, int maxlen)
void dlisp (Obj *x)
void print_form_and_value (FILE *fp, Obj *form)
Objappend_two_lists (Obj *x1, Obj *x2)
Objappend_lists (Obj *lis)
Objremove_from_list (Obj *element, Obj *lis)
Objremove_list_from_list (Obj *rlist, Obj *slist)
void push_binding (Obj **lis, Obj *key, Obj *val)
void push_cdr_binding (Obj **lis, Obj *key, Obj *val)
void push_int_binding (Obj **lis, Obj *key, int val)
void push_key_binding (Obj **lis, int key, Obj *val)
void push_key_cdr_binding (Obj **lis, int key, Obj *val)
void push_key_int_binding (Obj **lis, int key, int val)
Objeval (Obj *x)
Objeval_symbol (Obj *x)
Objeval_list (Obj *x)
Objeval_boolean_expression (Obj *expr)
int eval_boolean_expression (Obj *expr, int(*fn)(Obj *), int dflt)
int eval_boolean_expression (Obj *expr, int(*fn)(Obj *, ParamBox *), int dflt, ParamBox *pbox)
Objeval_arithmetic_expression (Obj *expr)
Objeval_arithmetic_comparison_expression (Obj *expr)
Objchoose_from_weighted_list (Obj *lis, int *totalweightp, int flat)
int interpolate_in_list (int val, Obj *lis, int *rslt)
int interpolate_in_list_ext (int val, Obj *lis, int mindo, int minval, int minrslt, int maxdo, int maxval, int maxrslt, int *rslt)
char * escaped_symbol (char *str)
char * escaped_string (char *str)
char * safe_escaped_string (char *str, int len)
void interp_short_array (short *arr, Obj *lis, int n)
void interp_long_array (long *arr, Obj *lis, int n)
int eval_number (Obj *val, int *isnumber)
char * get_string (Obj *lis)
void init_warning (char *str,...)
void low_init_warning (char *str)
void init_error (char *str,...)
void low_init_error (char *str)
void run_warning (char *str,...)
void low_run_warning (char *str)
void run_error (char *str,...)
void low_run_error (char *str)
void announce_read_progress (void)
int keyword_code (char *str)
char * keyword_name (enum keywords k)
int lazy_bind (Obj *sym)
void init_predefined_symbols (void)
void syntax_error (Obj *x, char *msg)

Variables

Objlispnil
 Lisp nil object pointer.

Objlispeof
 Lisp end-of-file.


Detailed Description

Definitions for Lisp objects in Xconq.

Lisp objects in Xconq are pretty basic, since they are used only for game definition and (usually) not the core computations.


Define Documentation

#define CONTEXTSIZE   129
 

context buffer size.

#define DEF_KWD name,
CODE   )     CODE,
 

#define for_all_list lis,
rest   )     for (rest = (lis); rest != lispnil; rest = cdr(rest))
 

Iterate list.

for header for iterating through lisp lists.

Parameters:
lis is the list iteration variable.
rest is the cdr part of the list (remainder, rest).

#define for_both_lists lis1,
lis2,
rest1,
rest2   ) 
 

Value:

for (rest1 = (lis1), rest2 = (lis2);  \
        rest1 != lispnil && rest2 != lispnil;  \
        rest1 = cdr(rest1), rest2 = cdr(rest2))
Iterate through two lists.

for header to interate through two lisp lists in parallel.

Parameters:
lis1 is the first list iteration variable.
lis2 is the second list iteration variable.
rest1 is the rest of the first list (cdr).
rest2 is the rest of the second list (cdr).

#define match_keyword ob,
key   )     (symbolp(ob) && strcmp(c_string(ob), keyword_name(key)) == 0)
 

Match keyword.

Attempt to match symbol name with keyword.

Parameters:
ob is lisp object.
key is keywords.
Returns:
  • true if matches;
  • false otherwise.


Typedef Documentation

typedef struct a_obj Obj
 

Lisp object.

The basic Lisp object. This should be small.

typedef struct a_strm Strm
 

Stream.

A stream is just a union of string pointer and file pointer.

typedef struct a_symentry Symentry
 

Symbol table.

The symbol table is the way to map names into symbols.


Enumeration Type Documentation

enum keywords
 

Keywords. Enum of all the random keywords.

Enumeration values:
LAST_KEYWORD  end of keywords

enum lisptype
 

Lisp object types.

The different types of Lisp |Object.

Enumeration values:
NIL  NULL object.
CONS  CONS object.
NUMBER  number object.
STRING  string object.
SYMBOL  symbol object.
UTYPE  Unit type. ???
MTYPE  Material type. ???
TTYPE  Terrain type. ???
ATYPE  Advance type. ???
POINTER  pointer object.
EOFOBJ  end-of_file object. ???

enum strmtype
 

Stream type.

Type of the stream.

Enumeration values:
stringstrm  string pointer
filestrm  file pointer


Function Documentation

void announce_read_progress void   ) 
 

Obj* append_lists Obj lis  ) 
 

Obj* append_two_lists Obj x1,
Obj x2
 

int atypep Obj x  ) 
 

int boundp Obj sym  ) 
 

int c_number Obj x  ) 
 

char* c_string Obj x  ) 
 

Obj* caddr Obj x  ) 
 

Obj* cadr Obj x  ) 
 

Obj* car Obj x  ) 
 

Obj* cdddr Obj x  ) 
 

Obj* cddr Obj x  ) 
 

Obj* cdr Obj x  ) 
 

Obj* choose_from_weighted_list Obj lis,
int *  totalweightp,
int  flat
 

Obj* cons Obj x,
Obj y
 

int consp Obj x  ) 
 

int constantp Obj sym  ) 
 

void dlisp Obj x  ) 
 

Obj* elt Obj lis,
int  n
 

int equal Obj x,
Obj y
 

char* escaped_string char *  str  ) 
 

char* escaped_symbol char *  str  ) 
 

Obj* eval Obj x  ) 
 

Obj* eval_arithmetic_comparison_expression Obj expr  ) 
 

Obj* eval_arithmetic_expression Obj expr  ) 
 

int eval_boolean_expression Obj expr,
int(*  fn)(Obj *, ParamBox *),
int  dflt,
ParamBox pbox
 

int eval_boolean_expression Obj expr,
int(*  fn)(Obj *),
int  dflt
 

Obj* eval_boolean_expression Obj expr  ) 
 

Obj* eval_list Obj x  ) 
 

int eval_number Obj val,
int *  isnumber
 

Obj* eval_symbol Obj x  ) 
 

Obj* find_at_key Obj lis,
char *  key
 

void flag_as_constant Obj sym  ) 
 

void fprint_list FILE *  fp,
Obj obj
 

void fprint_num_or_dice FILE *  fp,
int  x,
int  valtype
 

Print dice spec or a straight integer.

void fprintlisp FILE *  fp,
Obj oobj
 

void fprinttable FILE *  fp,
int  n
 

char* get_string Obj lis  ) 
 

void init_error char *  str,
... 
 

void init_lisp void   ) 
 

void init_predefined_symbols void   ) 
 

void init_warning char *  str,
... 
 

Obj* intern_symbol char *  str  ) 
 

void interp_long_array long *  arr,
Obj lis,
int  n
 

void interp_short_array short *  arr,
Obj lis,
int  n
 

int interpolate_in_list int  val,
Obj lis,
int *  rslt
 

int interpolate_in_list_ext int  val,
Obj lis,
int  mindo,
int  minval,
int  minrslt,
int  maxdo,
int  maxval,
int  maxrslt,
int *  rslt
 

int is_quoted_lisp Obj x  ) 
 

int keyword_code char *  str  ) 
 

char* keyword_name enum keywords  k  ) 
 

int lazy_bind Obj sym  ) 
 

int length Obj list  ) 
 

int listp Obj x  ) 
 

void low_init_error char *  str  ) 
 

void low_init_warning char *  str  ) 
 

void low_run_error char *  str  ) 
 

void low_run_warning char *  str  ) 
 

void makunbound Obj sym  ) 
 

int member Obj x,
Obj lis
 

int mtypep Obj x  ) 
 

Obj* new_atype int  s  ) 
 

Obj* new_mtype int  r  ) 
 

Obj* new_number int  num  ) 
 

Obj* new_pointer Obj sym,
char *  ptr
 

Obj* new_string char *  str  ) 
 

Obj* new_ttype int  t  ) 
 

Obj* new_utype int  u  ) 
 

int numberishp Obj x  ) 
 

int numberp Obj x  ) 
 

int pointerp Obj x  ) 
 

void print_form_and_value FILE *  fp,
Obj form
 

void push_binding Obj **  lis,
Obj key,
Obj val
 

void push_cdr_binding Obj **  lis,
Obj key,
Obj val
 

void push_int_binding Obj **  lis,
Obj key,
int  val
 

void push_key_binding Obj **  lis,
int  key,
Obj val
 

void push_key_cdr_binding Obj **  lis,
int  key,
Obj val
 

void push_key_int_binding Obj **  lis,
int  key,
int  val
 

Obj* read_form FILE *  fp,
int *  p1,
int *  p2
 

Obj* read_form_from_string char *  str,
int *  p1,
int *  p2,
char **  endstr
 

Obj* remove_from_list Obj element,
Obj lis
 

Obj* remove_list_from_list Obj rlist,
Obj slist
 

Obj* replace_at_key Obj lis,
char *  key,
Obj newval
 

Obj* reverse Obj lis  ) 
 

void run_error char *  str,
... 
 

void run_warning char *  str,
... 
 

char* safe_escaped_string char *  str,
int  len
 

void set_cdr Obj x,
Obj v
 

Obj* setq Obj sym,
Obj x
 

void sprint_list char *  buf,
Obj obj,
int  maxlen
 

void sprintlisp char *  buf,
Obj obj,
int  maxlen
 

int stringp Obj x  ) 
 

Obj* symbol_value Obj sym  ) 
 

int symbolp Obj x  ) 
 

void syntax_error Obj x,
char *  msg
 

int ttypep Obj x  ) 
 

void type_warning char *  funname,
Obj x,
char *  errtype,
Obj subst
 

int utypep Obj x  ) 
 


Variable Documentation

Obj* lispeof
 

Lisp end-of-file.

Obj* lispnil
 

Lisp nil object pointer.


Generated on Sat Sep 17 10:29:18 2005 for XconqKernel by doxygen 1.3.6