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