[49] | 1 | #ifndef _LISP_HPP_INCLUDED_ |
---|
| 2 | #define _LISP_HPP_INCLUDED_ |
---|
| 3 | |
---|
| 4 | #include <sys/types.h> |
---|
| 5 | #include <stdtool.h> |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | extern "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 | |
---|
| 33 | extern int current_space; |
---|
| 34 | extern void *enviroment; |
---|
| 35 | |
---|
| 36 | /* ------------------------- GLOBAL LISP VARS ------------------------- */ |
---|
| 37 | |
---|
| 38 | extern 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 | |
---|
| 49 | extern 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 | |
---|
| 59 | extern Cell *true_symbol; |
---|
| 60 | |
---|
| 61 | /* ------------------------- TRIGONOMETRY -------------------- */ |
---|
| 62 | |
---|
| 63 | #define FIXED_TRIG_SIZE 360 // 360 degrees stored in table |
---|
| 64 | extern long sin_table[FIXED_TRIG_SIZE]; // this should be filled in by external module |
---|
| 65 | #define TBS 1662 // atan table granularity |
---|
| 66 | extern unsigned short atan_table[TBS]; |
---|
| 67 | |
---|
| 68 | /* ------------------------- COMPATIBILITY -------------------- */ |
---|
| 69 | |
---|
| 70 | typedef 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 | |
---|
| 82 | void lisp_init (long a, long b); |
---|
| 83 | void lisp_uninit (void); |
---|
| 84 | char* lstring_value (void* x); |
---|
| 85 | long lnumber_value (void* x); |
---|
| 86 | char lcharacter_value (void* x); |
---|
| 87 | Cell* new_lisp_number (long x); |
---|
| 88 | Cell* new_lisp_character (unsigned short x); |
---|
| 89 | Cell* new_lisp_string (long x); |
---|
| 90 | Cell* new_lisp_pointer (void* x); |
---|
| 91 | Cell* new_cons_cell (void); |
---|
| 92 | Cell* lcar (void* x); |
---|
| 93 | Cell* lcdr (void* x); |
---|
| 94 | Cell* lprint (void* x); |
---|
| 95 | Cell* set_symbol_number (void* x, long y); |
---|
| 96 | Cell* set_symbol_value(void *symbol, void *value); |
---|
| 97 | Cell* symbol_value (void* x); |
---|
| 98 | Cell* make_find_symbol (char* name); |
---|
| 99 | Cell* find_symbol (char* name); |
---|
| 100 | Cell* symbol_function (void* symbol); |
---|
| 101 | void use_user_space(void *addr, long size); |
---|
| 102 | Cell* eval_function(void *sym, void *arg_list, void *env); |
---|
| 103 | void clear_tmp(); |
---|
| 104 | void resize_tmp (int size); |
---|
| 105 | Cell* eval (void* item, void* env); |
---|
| 106 | long list_length(void *i); |
---|
| 107 | Cell* nth (int num, void *list); |
---|
| 108 | Cell* compile (char*& str); |
---|
| 109 | int get_lprop_number (void* symbol, int number); |
---|
| 110 | Cell* assoc (void* vlists, void* vtarget); |
---|
| 111 | char* symbol_name (void* symbol); |
---|
| 112 | int item_type (void* cell); |
---|
| 113 | long lisp_cos(long x); |
---|
| 114 | long lisp_sin(long x); |
---|
| 115 | long lisp_atan2(long dy, long dx); |
---|
| 116 | void push_onto_list(Cell *object, Cell *&list); |
---|
| 117 | |
---|
| 118 | void* lpointer_value (void* x); |
---|
| 119 | long lfixed_point_value(void* x); |
---|
| 120 | void lisp_init_globals (); |
---|
| 121 | int lisp_init_lisp_fns (); |
---|
| 122 | void lisp_init_c_fns (); |
---|
| 123 | |
---|
| 124 | extern "C" void lbreak (const char* format, ...); |
---|
| 125 | |
---|
| 126 | #endif /* _LISP_HPP_INCLUDED_ */ |
---|