Lines Matching refs:np

141 #define numeric(np)	((np)->type&T_NUM)  argument
185 static int getnode(State_t* state, Node_t *np) in getnode() argument
207 np->num = (ep = strpbrk(cp, ep)) ? (ep - cp + 1) : 0; in getnode()
208 np->type = T_NUM; in getnode()
217 np->num = strlen(cp); in getnode()
218 np->type = T_NUM; in getnode()
225 if (!(np->str = *state->arglist++)) in getnode()
227 np->type = T_STR; in getnode()
260 np->type = T_STR; in getnode()
261 np->str = sp; in getnode()
268 tok = expr_or(state, np); in getnode()
274 np->type = T_STR; in getnode()
275 np->str = cp; in getnode()
278 np->num = strtol(np->str,&ep,10); in getnode()
280 np->type |= T_NUM; in getnode()
294 static int expr_cond(State_t* state, Node_t *np) in expr_cond() argument
296 register int tok = getnode(state, np); in expr_cond()
306 if (np->type&T_STR) in expr_cond()
307 cp = np->str; in expr_cond()
309 sfsprintf(cp=state->buf,sizeof(state->buf),"%d",np->num); in expr_cond()
310 np->num = 0; in expr_cond()
311 np->type = T_NUM; in expr_cond()
318 np->type = T_STR; in expr_cond()
321 np->str = cp + match[1].rm_so; in expr_cond()
322 np->str[match[1].rm_eo - match[1].rm_so] = 0; in expr_cond()
323 np->num = strtol(np->str,&cp,10); in expr_cond()
324 if (cp!=np->str && *cp==0) in expr_cond()
325 np->type |= T_NUM; in expr_cond()
328 np->str = ""; in expr_cond()
331 np->num = match[0].rm_eo - match[0].rm_so; in expr_cond()
337 np->str = ""; in expr_cond()
338 np->type = T_STR; in expr_cond()
345 static int expr_mult(State_t* state, Node_t *np) in expr_mult() argument
347 register int tok = expr_cond(state, np); in expr_mult()
354 if (!numeric(np) || !numeric(&rp)) in expr_mult()
361 np->num *= rp.num; in expr_mult()
364 np->num /= rp.num; in expr_mult()
367 np->num %= rp.num; in expr_mult()
369 np->type = T_NUM; in expr_mult()
374 static int expr_add(State_t* state, Node_t *np) in expr_add() argument
376 register int tok = expr_mult(state, np); in expr_add()
383 if (!numeric(np) || !numeric(&rp)) in expr_add()
386 np->num -= rp.num; in expr_add()
388 np->num += rp.num; in expr_add()
389 np->type = T_NUM; in expr_add()
394 static int expr_cmp(State_t* state, Node_t *np) in expr_cmp() argument
396 register int tok = expr_add(state, np); in expr_cmp()
405 if (numeric(&rp) && numeric(np)) in expr_cmp()
409 if (np->type&T_STR) in expr_cmp()
410 left = np->str; in expr_cmp()
412 sfsprintf(left=buff1,sizeof(buff1),"%d",np->num); in expr_cmp()
421 np->num = streq(left,right); in expr_cmp()
424 np->num = (strcoll(left,right)>0); in expr_cmp()
427 np->num = (strcoll(left,right)<0); in expr_cmp()
430 np->num = (strcoll(left,right)>=0); in expr_cmp()
433 np->num = (strcoll(left,right)<=0); in expr_cmp()
436 np->num = !streq(left,right); in expr_cmp()
439 np->num = (np->num==rp.num); in expr_cmp()
442 np->num = (np->num>rp.num); in expr_cmp()
445 np->num = (np->num<rp.num); in expr_cmp()
448 np->num = (np->num>=rp.num); in expr_cmp()
451 np->num = (np->num<=rp.num); in expr_cmp()
454 np->num = (np->num!=rp.num); in expr_cmp()
457 np->type = T_NUM; in expr_cmp()
462 static int expr_and(State_t* state, Node_t *np) in expr_and() argument
464 register int tok = expr_cmp(state, np); in expr_and()
471 np->num = 0; in expr_and()
472 np->type=T_NUM; in expr_and()
478 static int expr_or(State_t* state, Node_t *np) in expr_or() argument
480 register int tok = expr_and(state, np); in expr_or()
485 if ((numeric(np) && np->num==0) || *np->str==0) in expr_or()
486 *np = rp; in expr_or()