eval_expr.c (277177) | eval_expr.c (289677) |
---|---|
1/*- 2 * Copyright (c) 2015 Netflix Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28#include <sys/types.h> 29#include <stdio.h> 30#include <stdlib.h> 31#include <unistd.h> 32#include <string.h> 33#include <strings.h> 34#include <ctype.h> 35#include "eval_expr.h" | 1/*- 2 * Copyright (c) 2015 Netflix Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28#include <sys/types.h> 29#include <stdio.h> 30#include <stdlib.h> 31#include <unistd.h> 32#include <string.h> 33#include <strings.h> 34#include <ctype.h> 35#include "eval_expr.h" |
36__FBSDID("$FreeBSD: head/usr.sbin/pmcstudy/eval_expr.c 277177 2015-01-14 12:46:58Z rrs $"); | 36__FBSDID("$FreeBSD: head/usr.sbin/pmcstudy/eval_expr.c 289677 2015-10-21 05:37:09Z eadler $"); |
37 38static struct expression * 39alloc_and_hook_expr(struct expression **exp_p, struct expression **last_p) 40{ 41 struct expression *ex, *at; 42 43 ex = malloc(sizeof(struct expression)); 44 if (ex == NULL) { --- 394 unchanged lines hidden (view full) --- 439 * of the operators, then we validate that expression further. 440 * c) Validating that we have: 441 * val OP val <or> 442 * val OP ( <and> 443 * inside every paran you have a: 444 * val OP val <or> 445 * val OP ( <recursively> 446 * d) A final optional step (not implemented yet) would be | 37 38static struct expression * 39alloc_and_hook_expr(struct expression **exp_p, struct expression **last_p) 40{ 41 struct expression *ex, *at; 42 43 ex = malloc(sizeof(struct expression)); 44 if (ex == NULL) { --- 394 unchanged lines hidden (view full) --- 439 * of the operators, then we validate that expression further. 440 * c) Validating that we have: 441 * val OP val <or> 442 * val OP ( <and> 443 * inside every paran you have a: 444 * val OP val <or> 445 * val OP ( <recursively> 446 * d) A final optional step (not implemented yet) would be |
447 * to insert the mathimatical precedence paran's. For | 447 * to insert the mathematical precedence paran's. For |
448 * the start we will just do the left to right evaluation and 449 * then later we can add this guy to add paran's to make it 450 * mathimatically correct... i.e instead of 1 + 2 * 3 we 451 * would translate it into 1 + ( 2 * 3). 452 */ 453 open_par = close_par = 0; 454 siz = strlen(str); 455 /* No trailing newline please */ --- 262 unchanged lines hidden --- | 448 * the start we will just do the left to right evaluation and 449 * then later we can add this guy to add paran's to make it 450 * mathimatically correct... i.e instead of 1 + 2 * 3 we 451 * would translate it into 1 + ( 2 * 3). 452 */ 453 open_par = close_par = 0; 454 siz = strlen(str); 455 /* No trailing newline please */ --- 262 unchanged lines hidden --- |