00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef LOOPSCRIPT_H_INCLUDED
00020 #define LOOPSCRIPT_H_INCLUDED
00021
00022
00023 #define LS_TOKEN_AND '&'
00024 #define LS_TOKEN_OR '+'
00025 #define LS_TOKEN_NOT '!'
00026 #define LS_TOKEN_EQUAL '='
00027 #define LS_TOKEN_GREATER '>'
00028 #define LS_TOKEN_LESS '<'
00029 #define LS_TOKEN_GEQUAL ']'
00030 #define LS_TOKEN_LEQUAL '['
00031
00032 #define LS_TOKEN_INT '%'
00033
00034 #define LS_TOKEN_TRUE 1
00035 #define LS_TOKEN_FALSE 0
00036 #define LS_TOKEN_NPCNUM '#'
00037 #define LS_TOKEN_STATUS '?'
00038 #define LS_TOKEN_Q '*'
00039 #define LS_TOKEN_FAMILY ':'
00040 #define LS_TOKEN_SHAPE '@'
00041 #define LS_TOKEN_FRAME '`'
00042
00043 #define LS_TOKEN_END '$'
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #define LOOPSCRIPT(name,tokens) const uint8 name[] = { tokens, LS_TOKEN_END }
00077
00078 #define LS_CONSTANT(val) ((val)&0xFF), ((val>>8)&0xFF)
00079 #define LS_INT(val) LS_TOKEN_INT, LS_CONSTANT(val)
00080
00081 #define LS_OP(left, op, right) left, right, op
00082
00083 #define LS_NOT(left) left, LS_TOKEN_NOT
00084 #define LS_AND(left,right) left, right, LS_TOKEN_AND
00085 #define LS_OR(left,right) left, right, LS_TOKEN_OR
00086
00087 #define LS_EQUAL(left,right) left, right, LS_TOKEN_EQUAL
00088 #define LS_LEQUAL(left,right) left, right, LS_TOKEN_LEQUAL
00089 #define LS_GEQUAL(left,right) left, right, LS_TOKEN_GEQUAL
00090 #define LS_LESS(left,right) left, right, LS_TOKEN_LESS
00091 #define LS_GREATER(left,right) left, right, LS_TOKEN_GREATER
00092
00093 #define LS_FAMILY_EQUAL(val) LS_EQUAL(LS_TOKEN_FAMILY,LS_INT(val))
00094 #define LS_NPCNUM_EQUAL(val) LS_EQUAL(LS_TOKEN_NPCNUM,LS_INT(val))
00095 #define LS_STATUS_EQUAL(val) LS_EQUAL(LS_TOKEN_STATUS,LS_INT(val))
00096 #define LS_Q_EQUAL(val) LS_EQUAL(LS_TOKEN_Q,LS_INT(val))
00097
00098 #define LS_SHAPE_EQUAL(val) LS_EQUAL(LS_TOKEN_SHAPE,LS_INT(val))
00099 #define LS_SHAPE_EQUAL1(a) LS_TOKEN_SHAPE+1, LS_CONSTANT(a)
00100 #define LS_SHAPE_EQUAL2(a,b) LS_TOKEN_SHAPE+2, LS_CONSTANT(a), LS_CONSTANT(b)
00101 #define LS_SHAPE_EQUAL3(a,b,c) LS_TOKEN_SHAPE+3, LS_CONSTANT(a), LS_CONSTANT(b), LS_CONSTANT(c)
00102 #define LS_SHAPE_EQUAL4(a,b,c,d) LS_TOKEN_SHAPE+4, LS_CONSTANT(a), LS_CONSTANT(b), LS_CONSTANT(c), LS_CONSTANT(d)
00103
00104 #define LS_FRAME_EQUAL(val) LS_EQUAL(LS_TOKEN_FRAME,LS_INT(val))
00105 #define LS_FRAME_EQUAL1(a) LS_TOKEN_FRAME+1, LS_CONSTANT(a)
00106 #define LS_FRAME_EQUAL2(a,b) LS_TOKEN_FRAME+2, LS_CONSTANT(a), LS_CONSTANT(b)
00107 #define LS_FRAME_EQUAL3(a,b,c) LS_TOKEN_FRAME+3, LS_CONSTANT(a), LS_CONSTANT(b), LS_CONSTANT(c)
00108 #define LS_FRAME_EQUAL4(a,b,c,d) LS_TOKEN_FRAME+4, LS_CONSTANT(a), LS_CONSTANT(b), LS_CONSTANT(c), LS_CONSTANT(d)
00109
00110 #endif