source: abuse/trunk/src/include/lisp2.hpp @ 2

Last change on this file since 2 was 2, checked in by Sam Hocevar, 14 years ago
  • imported original 0.7.0 tarball
File size: 3.7 KB
Line 
1#ifndef _LISP_HPP_INCLUDED_
2#define _LISP_HPP_INCLUDED_
3
4#include        <sys/types.h>
5#include        <stdtool.h>
6
7
8
9
10extern "C"
11{
12#include        "li_modul.h"
13#include        "li_proto.h"
14}
15
16/* ------------------------- COMPATIBILITY ------------------------- */
17
18#define L_SYMBOL                LI_tSYMBOL
19#define L_STRING                LI_tSTRING
20#define L_CONS_CELL             LI_tCONS
21#define L_NUMBER                LI_tLONG
22#define L_CHARACTER             LI_tLONG
23#define L_POINTER               LI_tUSER
24#define L_FIXED_POINT   LI_tFIXEDPOINT
25
26#define PERM_SPACE      0
27#define TEMP_SPACE      0
28#define cons_cell       Cell
29#define lisp_symbol     Cell
30
31/* ------------------------- GLOBAL VARS ------------------------- */
32
33extern int current_space;
34extern void *enviroment;
35
36/* ------------------------- GLOBAL LISP VARS ------------------------- */
37
38extern Cell *l_difficulty,*l_easy,*l_hard,*l_medium,*l_main_menu,
39            *l_logo,*l_state_art,*l_abilities,*l_state_sfx,
40                        *l_song_list,*l_filename,*l_sfx_directory,*l_max_hp,
41                        *l_default_font,*l_morph,*l_max_power,*l_default_abilities,
42                        *l_default_ai_function,*l_tile_files,*l_empty_cache,*l_range,
43                        *l_joy_file,*l_hurt_all,*l_death_handler,*l_title_screen,
44                        *l_console_font,*l_fields,*l_dist,*l_pushx,*l_pushy,
45                        *l_object,*l_tile;
46
47/* variables for the status bar */
48
49extern Cell *l_statbar_ammo_x,*l_statbar_ammo_y,
50            *l_statbar_ammo_w,*l_statbar_ammo_h,
51                        *l_statbar_ammo_bg_color,
52
53                        *l_statbar_health_x,*l_statbar_health_y,
54                        *l_statbar_health_w,*l_statbar_health_h,
55                        *l_statbar_health_bg_color,
56
57                        *l_statbar_logo_x,*l_statbar_logo_y;
58
59extern Cell *true_symbol;
60
61/* ------------------------- TRIGONOMETRY -------------------- */
62
63#define FIXED_TRIG_SIZE 360               // 360 degrees stored in table
64extern long sin_table[FIXED_TRIG_SIZE];   // this should be filled in by external module
65#define TBS 1662                          // atan table granularity
66extern unsigned short atan_table[TBS];
67
68/* ------------------------- COMPATIBILITY -------------------- */
69
70typedef Cell    lisp_symbol;
71#undef CAR
72#undef CDR
73#undef SCAR
74#undef SCDR
75#define SCAR(x)                 (((Cell*)x)->type == LI_tCONS ? ((Cell*)x)->v.cons.car : Nil)
76#define SCDR(x)                 (((Cell*)x)->type == LI_tCONS ? ((Cell*)x)->v.cons.cdr : Nil)
77#define CAR(x)                  (((Cell*)x)->v.cons.car)
78#define CDR(x)                  (((Cell*)x)->v.cons.cdr)
79
80/* ------------------------- FUNCTION PROTOTYPES ------------------------- */
81
82void lisp_init (long a, long b);
83void lisp_uninit (void);
84char* lstring_value (void* x);
85long lnumber_value (void* x);
86char lcharacter_value (void* x);
87Cell* new_lisp_number (long x);
88Cell* new_lisp_character (unsigned short x);
89Cell* new_lisp_string (long x);
90Cell* new_lisp_pointer (void* x);
91Cell* new_cons_cell (void);
92Cell* lcar (void* x);
93Cell* lcdr (void* x);
94Cell* lprint (void* x);
95Cell* set_symbol_number (void* x, long y);
96Cell* set_symbol_value(void *symbol, void *value);
97Cell* symbol_value (void* x);
98Cell* make_find_symbol (char* name);
99Cell* find_symbol (char* name);
100Cell* symbol_function (void* symbol);
101void use_user_space(void *addr, long size);
102Cell* eval_function(void *sym, void *arg_list, void *env);
103void clear_tmp();
104void resize_tmp (int size);
105Cell* eval (void* item, void* env);
106long list_length(void *i);
107Cell* nth (int num, void *list);
108Cell* compile (char*& str);
109int get_lprop_number (void* symbol, int number);
110Cell* assoc (void* vlists, void* vtarget);
111char* symbol_name (void* symbol);
112int item_type (void* cell);
113long lisp_cos(long x);
114long lisp_sin(long x);
115long lisp_atan2(long dy, long dx);
116void push_onto_list(Cell *object, Cell *&list);
117
118void* lpointer_value (void* x);
119long lfixed_point_value(void* x);
120void lisp_init_globals ();
121int lisp_init_lisp_fns ();
122void lisp_init_c_fns ();
123
124extern "C" void lbreak (const char* format, ...);
125
126#endif /* _LISP_HPP_INCLUDED_ */
Note: See TracBrowser for help on using the repository browser.