Lines Matching refs:expr
75 ExprDef *expr = malloc(size); in ExprCreate() local
76 if (!expr) in ExprCreate()
79 expr->common.type = STMT_EXPR; in ExprCreate()
80 expr->common.next = NULL; in ExprCreate()
81 expr->expr.op = op; in ExprCreate()
82 expr->expr.value_type = type; in ExprCreate()
84 return expr; in ExprCreate()
95 EXPR_CREATE(ExprString, expr, EXPR_VALUE, EXPR_TYPE_STRING); in ExprCreateString()
96 expr->string.str = str; in ExprCreateString()
97 return expr; in ExprCreateString()
103 EXPR_CREATE(ExprInteger, expr, EXPR_VALUE, EXPR_TYPE_INT); in ExprCreateInteger()
104 expr->integer.ival = ival; in ExprCreateInteger()
105 return expr; in ExprCreateInteger()
111 EXPR_CREATE(ExprBoolean, expr, EXPR_VALUE, EXPR_TYPE_BOOLEAN); in ExprCreateBoolean()
112 expr->boolean.set = set; in ExprCreateBoolean()
113 return expr; in ExprCreateBoolean()
119 EXPR_CREATE(ExprKeyName, expr, EXPR_VALUE, EXPR_TYPE_KEYNAME); in ExprCreateKeyName()
120 expr->key_name.key_name = key_name; in ExprCreateKeyName()
121 return expr; in ExprCreateKeyName()
127 EXPR_CREATE(ExprIdent, expr, EXPR_IDENT, EXPR_TYPE_UNKNOWN); in ExprCreateIdent()
128 expr->ident.ident = ident; in ExprCreateIdent()
129 return expr; in ExprCreateIdent()
136 EXPR_CREATE(ExprUnary, expr, op, type); in ExprCreateUnary()
137 expr->unary.child = child; in ExprCreateUnary()
138 return expr; in ExprCreateUnary()
144 EXPR_CREATE(ExprBinary, expr, op, EXPR_TYPE_UNKNOWN); in ExprCreateBinary()
146 if (op == EXPR_ASSIGN || left->expr.value_type == EXPR_TYPE_UNKNOWN) in ExprCreateBinary()
147 expr->expr.value_type = right->expr.value_type; in ExprCreateBinary()
148 else if (left->expr.value_type == right->expr.value_type || in ExprCreateBinary()
149 right->expr.value_type == EXPR_TYPE_UNKNOWN) in ExprCreateBinary()
150 expr->expr.value_type = left->expr.value_type; in ExprCreateBinary()
151 expr->binary.left = left; in ExprCreateBinary()
152 expr->binary.right = right; in ExprCreateBinary()
154 return expr; in ExprCreateBinary()
160 EXPR_CREATE(ExprFieldRef, expr, EXPR_FIELD_REF, EXPR_TYPE_UNKNOWN); in ExprCreateFieldRef()
161 expr->field_ref.element = element; in ExprCreateFieldRef()
162 expr->field_ref.field = field; in ExprCreateFieldRef()
163 return expr; in ExprCreateFieldRef()
169 EXPR_CREATE(ExprArrayRef, expr, EXPR_ARRAY_REF, EXPR_TYPE_UNKNOWN); in ExprCreateArrayRef()
170 expr->array_ref.element = element; in ExprCreateArrayRef()
171 expr->array_ref.field = field; in ExprCreateArrayRef()
172 expr->array_ref.entry = entry; in ExprCreateArrayRef()
173 return expr; in ExprCreateArrayRef()
179 EXPR_CREATE(ExprAction, expr, EXPR_ACTION_DECL, EXPR_TYPE_UNKNOWN); in ExprCreateAction()
180 expr->action.name = name; in ExprCreateAction()
181 expr->action.args = args; in ExprCreateAction()
182 return expr; in ExprCreateAction()
188 EXPR_CREATE(ExprKeysymList, expr, EXPR_KEYSYM_LIST, EXPR_TYPE_SYMBOLS); in ExprCreateKeysymList()
190 darray_init(expr->keysym_list.syms); in ExprCreateKeysymList()
191 darray_init(expr->keysym_list.symsMapIndex); in ExprCreateKeysymList()
192 darray_init(expr->keysym_list.symsNumEntries); in ExprCreateKeysymList()
194 darray_append(expr->keysym_list.syms, sym); in ExprCreateKeysymList()
195 darray_append(expr->keysym_list.symsMapIndex, 0); in ExprCreateKeysymList()
196 darray_append(expr->keysym_list.symsNumEntries, 1); in ExprCreateKeysymList()
198 return expr; in ExprCreateKeysymList()
202 ExprCreateMultiKeysymList(ExprDef *expr) in ExprCreateMultiKeysymList() argument
204 unsigned nLevels = darray_size(expr->keysym_list.symsMapIndex); in ExprCreateMultiKeysymList()
206 darray_resize(expr->keysym_list.symsMapIndex, 1); in ExprCreateMultiKeysymList()
207 darray_resize(expr->keysym_list.symsNumEntries, 1); in ExprCreateMultiKeysymList()
208 darray_item(expr->keysym_list.symsMapIndex, 0) = 0; in ExprCreateMultiKeysymList()
209 darray_item(expr->keysym_list.symsNumEntries, 0) = nLevels; in ExprCreateMultiKeysymList()
211 return expr; in ExprCreateMultiKeysymList()
215 ExprAppendKeysymList(ExprDef *expr, xkb_keysym_t sym) in ExprAppendKeysymList() argument
217 unsigned nSyms = darray_size(expr->keysym_list.syms); in ExprAppendKeysymList()
219 darray_append(expr->keysym_list.symsMapIndex, nSyms); in ExprAppendKeysymList()
220 darray_append(expr->keysym_list.symsNumEntries, 1); in ExprAppendKeysymList()
221 darray_append(expr->keysym_list.syms, sym); in ExprAppendKeysymList()
223 return expr; in ExprAppendKeysymList()
227 ExprAppendMultiKeysymList(ExprDef *expr, ExprDef *append) in ExprAppendMultiKeysymList() argument
230 unsigned nSyms = darray_size(expr->keysym_list.syms); in ExprAppendMultiKeysymList()
233 darray_append(expr->keysym_list.symsMapIndex, nSyms); in ExprAppendMultiKeysymList()
234 darray_append(expr->keysym_list.symsNumEntries, numEntries); in ExprAppendMultiKeysymList()
236 darray_append_items(expr->keysym_list.syms, syms, numEntries); in ExprAppendMultiKeysymList()
240 return expr; in ExprAppendMultiKeysymList()
570 FreeExpr(ExprDef *expr) in FreeExpr() argument
572 if (!expr) in FreeExpr()
575 switch (expr->expr.op) { in FreeExpr()
581 FreeStmt((ParseCommon *) expr->unary.child); in FreeExpr()
589 FreeStmt((ParseCommon *) expr->binary.left); in FreeExpr()
590 FreeStmt((ParseCommon *) expr->binary.right); in FreeExpr()
594 FreeStmt((ParseCommon *) expr->action.args); in FreeExpr()
598 FreeStmt((ParseCommon *) expr->array_ref.entry); in FreeExpr()
602 darray_free(expr->keysym_list.syms); in FreeExpr()
603 darray_free(expr->keysym_list.symsMapIndex); in FreeExpr()
604 darray_free(expr->keysym_list.symsNumEntries); in FreeExpr()