1 /* 2 * Copyright (C) 2000-2005 Chris Ross and various contributors 3 * Copyright (C) 1999-2000 Chris Ross 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * 9 * o Redistributions of source code must retain the above copyright notice, this 10 * list of conditions and the following disclaimer. 11 * o Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * o Neither the name of the ferite software nor the names of its contributors may 15 * be used to endorse or promote products derived from this software without 16 * specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef __FERITE_OPS__ 32 #define __FERITE_OPS__ 33 34 #define FERITE_MANY_OP( opname ) FERITE_API FeriteVariable *ferite_op_##opname (FeriteScript *script, FeriteVariable **vars, int count ) 35 #define FERITE_BINARY_OP( opname ) FERITE_API FeriteVariable *ferite_op_##opname (FeriteScript *script, FeriteVariable *a, FeriteVariable *b) 36 #define FERITE_UNARY_OP( opname ) FERITE_API FeriteVariable *ferite_op_##opname (FeriteScript *script, FeriteVariable *a) 37 #define FERITE_OP_CALL( opname ) (void *)ferite_op_##opname 38 39 FERITE_API FeriteVariable *ferite_new_object( FeriteScript *script, FeriteClass *nclass, FeriteVariable **plist ); 40 FERITE_API FeriteVariable *ferite_build_object( FeriteScript *script, FeriteClass *nclass); 41 42 FERITE_UNARY_OP( not_op ); 43 FERITE_UNARY_OP( left_incr ); 44 FERITE_UNARY_OP( right_incr ); 45 FERITE_UNARY_OP( left_decr ); 46 FERITE_UNARY_OP( right_decr ); 47 FERITE_UNARY_OP( positive_var ); 48 FERITE_UNARY_OP( negative_var ); 49 FERITE_UNARY_OP( eval ); 50 FERITE_UNARY_OP( include ); 51 52 FERITE_BINARY_OP( add ); 53 FERITE_BINARY_OP( minus ); 54 FERITE_BINARY_OP( mult ); 55 FERITE_BINARY_OP( divide ); 56 FERITE_BINARY_OP( modulus ); 57 FERITE_BINARY_OP( assign ); 58 FERITE_BINARY_OP( add_assign ); 59 FERITE_BINARY_OP( minus_assign ); 60 FERITE_BINARY_OP( mult_assign ); 61 FERITE_BINARY_OP( divide_assign ); 62 FERITE_BINARY_OP( binary_or ); 63 FERITE_BINARY_OP( binary_and ); 64 FERITE_BINARY_OP( binary_xor ); 65 FERITE_BINARY_OP( logical_or ); 66 FERITE_BINARY_OP( logical_and ); 67 68 FERITE_BINARY_OP( equals ); 69 FERITE_BINARY_OP( case ); 70 FERITE_BINARY_OP( notequals ); 71 FERITE_BINARY_OP( less_than ); 72 FERITE_BINARY_OP( less_than_equals ); 73 FERITE_BINARY_OP( greater_than ); 74 FERITE_BINARY_OP( greater_than_equals ); 75 76 FERITE_BINARY_OP( array_index ); 77 FERITE_MANY_OP( array_slice ); 78 FERITE_UNARY_OP( array_clear ); 79 80 FERITE_BINARY_OP( left_shift ); 81 FERITE_BINARY_OP( right_shift ); 82 FERITE_BINARY_OP( left_shift_assign ); 83 FERITE_BINARY_OP( right_shift_assign ); 84 FERITE_BINARY_OP( binary_and_assign ); 85 FERITE_BINARY_OP( binary_or_assign ); 86 FERITE_BINARY_OP( binary_xor_assign ); 87 88 FERITE_BINARY_OP( isa ); 89 FERITE_BINARY_OP( instanceof ); 90 91 #define FERITE_OPCODE_not_op 0 92 #define FERITE_OPCODE_left_incr 1 93 #define FERITE_OPCODE_right_incr 2 94 #define FERITE_OPCODE_left_decr 3 95 #define FERITE_OPCODE_right_decr 4 96 #define FERITE_OPCODE_positive_var 5 97 #define FERITE_OPCODE_negative_var 6 98 #define FERITE_OPCODE_eval 7 99 #define FERITE_OPCODE_include 8 100 #define FERITE_OPCODE_add 9 101 #define FERITE_OPCODE_minus 10 102 #define FERITE_OPCODE_mult 11 103 #define FERITE_OPCODE_divide 12 104 #define FERITE_OPCODE_modulus 13 105 #define FERITE_OPCODE_assign 14 106 #define FERITE_OPCODE_add_assign 15 107 #define FERITE_OPCODE_minus_assign 16 108 #define FERITE_OPCODE_mult_assign 17 109 #define FERITE_OPCODE_divide_assign 18 110 #define FERITE_OPCODE_binary_or 19 111 #define FERITE_OPCODE_binary_and 20 112 #define FERITE_OPCODE_binary_xor 21 113 #define FERITE_OPCODE_logical_or 22 114 #define FERITE_OPCODE_logical_and 23 115 #define FERITE_OPCODE_equals 24 116 #define FERITE_OPCODE_case 25 117 #define FERITE_OPCODE_notequals 26 118 #define FERITE_OPCODE_less_than 27 119 #define FERITE_OPCODE_less_than_equals 28 120 #define FERITE_OPCODE_greater_than 29 121 #define FERITE_OPCODE_greater_than_equals 30 122 #define FERITE_OPCODE_array_index 31 123 #define FERITE_OPCODE_array_slice 32 124 #define FERITE_OPCODE_left_shift 33 125 #define FERITE_OPCODE_right_shift 34 126 #define FERITE_OPCODE_left_shift_assign 35 127 #define FERITE_OPCODE_right_shift_assign 36 128 #define FERITE_OPCODE_binary_and_assign 37 129 #define FERITE_OPCODE_binary_or_assign 38 130 #define FERITE_OPCODE_binary_xor_assign 39 131 #define FERITE_OPCODE_isa 40 132 #define FERITE_OPCODE_instanceof 41 133 #define FERITE_OPCODE_array_clear 42 134 135 #endif /* __FERITE_OPS__ */ 136