[56] | 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 | #include "config.h" |
---|
| 11 | |
---|
[2] | 12 | char *mac_replace[]={"(if $cond (progn $list) nil)" |
---|
| 13 | "(if-1progn $cond $list)", |
---|
| 14 | |
---|
| 15 | "(if $cond (progn $list1) (progn $list2))" |
---|
| 16 | "(if-12progn $list1 $list2)", |
---|
| 17 | |
---|
| 18 | "(if $cond nil (progn $list))" |
---|
| 19 | "(if-2progn $cond $list)", |
---|
| 20 | |
---|
| 21 | "(if (not $cond) $x $y)" |
---|
| 22 | "(if $cond $y $x)", |
---|
| 23 | |
---|
| 24 | "(with_object $x (progn $y))" |
---|
| 25 | "(with_object $x $y)", |
---|
| 26 | |
---|
| 27 | "(with_object (get_object 0) $x)" |
---|
| 28 | "(with_obj0 $x)", |
---|
| 29 | |
---|
| 30 | "(eq 0 $x)" |
---|
| 31 | "(eq0 $x)", |
---|
| 32 | |
---|
| 33 | "(eq $x 0)" |
---|
| 34 | "(eq0 $x)", |
---|
| 35 | |
---|
| 36 | "(not (eq0 $x))" |
---|
| 37 | "(noteq0 $x)", |
---|
| 38 | |
---|
| 39 | NULL |
---|
| 40 | }; |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | void **find_rules, |
---|
| 44 | **replace_rules; |
---|
| 45 | |
---|
| 46 | int trules; // total rules |
---|
| 47 | |
---|
| 48 | void mac_replace_init() |
---|
| 49 | { |
---|
| 50 | char **s=mac_replace; |
---|
| 51 | int trules=0; |
---|
| 52 | while (*s) { trules++; s++; } // count how many rules we have |
---|
| 53 | find_rules=(void **)jmalloc(sizeof(void *)*trules,"mac find rules"); |
---|
| 54 | replace_rules=(void **)jmalloc(sizeof(void *)*trules,"mac replace rules"); |
---|
| 55 | |
---|
| 56 | s=mac_replace; |
---|
| 57 | int i; |
---|
| 58 | for (int i=0;i<trules;i++,s++) |
---|
| 59 | { |
---|
| 60 | char *cs=*s; |
---|
| 61 | find_rules[i]=compile(cs); |
---|
| 62 | l_ptr_stack.push(&find_rules[i]); |
---|
| 63 | |
---|
| 64 | replace_rules[i]=compile(cs); |
---|
| 65 | l_ptr_stack.push(&replace_rules[i]); |
---|
| 66 | } |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | class mac_binding |
---|
| 71 | { |
---|
| 72 | public : |
---|
| 73 | void *var; |
---|
| 74 | void *value; |
---|
| 75 | mac_binding *next; |
---|
| 76 | mac_binding(void *Var, void *Value, mac_binding *Next) |
---|
| 77 | { |
---|
| 78 | var=Var; |
---|
| 79 | value=Value; |
---|
| 80 | next=Next; |
---|
| 81 | } |
---|
| 82 | } ; |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | mac_binding *match_rule(void *x, void *rule) |
---|
| 86 | { |
---|
| 87 | if (item_type(x)==L_CONS_CELL |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | void apply_rules(void *x) |
---|
| 91 | { |
---|
| 92 | |
---|
| 93 | } |
---|