db_expr.c (12473) | db_expr.c (12515) |
---|---|
1/* 2 * Mach Operating System 3 * Copyright (c) 1991,1990 Carnegie Mellon University 4 * All Rights Reserved. 5 * 6 * Permission to use, copy, modify and distribute this software and its 7 * documentation is hereby granted, provided that both the copyright 8 * notice and this permission notice appear in all copies of the --- 9 unchanged lines hidden (view full) --- 18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 19 * School of Computer Science 20 * Carnegie Mellon University 21 * Pittsburgh PA 15213-3890 22 * 23 * any improvements or extensions that they make and grant Carnegie the 24 * rights to redistribute these changes. 25 * | 1/* 2 * Mach Operating System 3 * Copyright (c) 1991,1990 Carnegie Mellon University 4 * All Rights Reserved. 5 * 6 * Permission to use, copy, modify and distribute this software and its 7 * documentation is hereby granted, provided that both the copyright 8 * notice and this permission notice appear in all copies of the --- 9 unchanged lines hidden (view full) --- 18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 19 * School of Computer Science 20 * Carnegie Mellon University 21 * Pittsburgh PA 15213-3890 22 * 23 * any improvements or extensions that they make and grant Carnegie the 24 * rights to redistribute these changes. 25 * |
26 * $Id: db_expr.c,v 1.5 1995/05/30 07:56:56 rgrimes Exp $ | 26 * $Id: db_expr.c,v 1.6 1995/11/24 14:13:34 bde Exp $ |
27 */ 28 29/* 30 * Author: David B. Golub, Carnegie Mellon University 31 * Date: 7/90 32 */ 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/proc.h> 36#include <ddb/ddb.h> 37#include <ddb/db_lex.h> 38#include <ddb/db_access.h> 39#include <ddb/db_command.h> 40 | 27 */ 28 29/* 30 * Author: David B. Golub, Carnegie Mellon University 31 * Date: 7/90 32 */ 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/proc.h> 36#include <ddb/ddb.h> 37#include <ddb/db_lex.h> 38#include <ddb/db_access.h> 39#include <ddb/db_command.h> 40 |
41extern boolean_t db_add_expr __P((db_expr_t *valuep)); 42extern boolean_t db_mult_expr __P((db_expr_t *valuep)); 43extern boolean_t db_shift_expr __P((db_expr_t *valuep)); 44extern boolean_t db_term __P((db_expr_t *valuep)); 45extern boolean_t db_unary __P((db_expr_t *valuep)); | 41static boolean_t db_add_expr __P((db_expr_t *valuep)); 42static boolean_t db_mult_expr __P((db_expr_t *valuep)); 43static boolean_t db_shift_expr __P((db_expr_t *valuep)); 44static boolean_t db_term __P((db_expr_t *valuep)); 45static boolean_t db_unary __P((db_expr_t *valuep)); |
46 | 46 |
47boolean_t | 47static boolean_t |
48db_term(valuep) 49 db_expr_t *valuep; 50{ 51 int t; 52 53 t = db_read_token(); 54 if (t == tIDENT) { 55 if (!db_value_of_name(db_tok_string, valuep)) { --- 38 unchanged lines hidden (view full) --- 94 /*NOTREACHED*/ 95 } 96 return (TRUE); 97 } 98 db_unread_token(t); 99 return (FALSE); 100} 101 | 48db_term(valuep) 49 db_expr_t *valuep; 50{ 51 int t; 52 53 t = db_read_token(); 54 if (t == tIDENT) { 55 if (!db_value_of_name(db_tok_string, valuep)) { --- 38 unchanged lines hidden (view full) --- 94 /*NOTREACHED*/ 95 } 96 return (TRUE); 97 } 98 db_unread_token(t); 99 return (FALSE); 100} 101 |
102boolean_t | 102static boolean_t |
103db_unary(valuep) 104 db_expr_t *valuep; 105{ 106 int t; 107 108 t = db_read_token(); 109 if (t == tMINUS) { 110 if (!db_unary(valuep)) { --- 11 unchanged lines hidden (view full) --- 122 } 123 *valuep = db_get_value((db_addr_t)*valuep, sizeof(int), FALSE); 124 return (TRUE); 125 } 126 db_unread_token(t); 127 return (db_term(valuep)); 128} 129 | 103db_unary(valuep) 104 db_expr_t *valuep; 105{ 106 int t; 107 108 t = db_read_token(); 109 if (t == tMINUS) { 110 if (!db_unary(valuep)) { --- 11 unchanged lines hidden (view full) --- 122 } 123 *valuep = db_get_value((db_addr_t)*valuep, sizeof(int), FALSE); 124 return (TRUE); 125 } 126 db_unread_token(t); 127 return (db_term(valuep)); 128} 129 |
130boolean_t | 130static boolean_t |
131db_mult_expr(valuep) 132 db_expr_t *valuep; 133{ 134 db_expr_t lhs, rhs; 135 int t; 136 137 if (!db_unary(&lhs)) 138 return (FALSE); --- 20 unchanged lines hidden (view full) --- 159 } 160 t = db_read_token(); 161 } 162 db_unread_token(t); 163 *valuep = lhs; 164 return (TRUE); 165} 166 | 131db_mult_expr(valuep) 132 db_expr_t *valuep; 133{ 134 db_expr_t lhs, rhs; 135 int t; 136 137 if (!db_unary(&lhs)) 138 return (FALSE); --- 20 unchanged lines hidden (view full) --- 159 } 160 t = db_read_token(); 161 } 162 db_unread_token(t); 163 *valuep = lhs; 164 return (TRUE); 165} 166 |
167boolean_t | 167static boolean_t |
168db_add_expr(valuep) 169 db_expr_t *valuep; 170{ 171 db_expr_t lhs, rhs; 172 int t; 173 174 if (!db_mult_expr(&lhs)) 175 return (FALSE); --- 10 unchanged lines hidden (view full) --- 186 lhs -= rhs; 187 t = db_read_token(); 188 } 189 db_unread_token(t); 190 *valuep = lhs; 191 return (TRUE); 192} 193 | 168db_add_expr(valuep) 169 db_expr_t *valuep; 170{ 171 db_expr_t lhs, rhs; 172 int t; 173 174 if (!db_mult_expr(&lhs)) 175 return (FALSE); --- 10 unchanged lines hidden (view full) --- 186 lhs -= rhs; 187 t = db_read_token(); 188 } 189 db_unread_token(t); 190 *valuep = lhs; 191 return (TRUE); 192} 193 |
194boolean_t | 194static boolean_t |
195db_shift_expr(valuep) 196 db_expr_t *valuep; 197{ 198 db_expr_t lhs, rhs; 199 int t; 200 201 if (!db_add_expr(&lhs)) 202 return (FALSE); --- 30 unchanged lines hidden --- | 195db_shift_expr(valuep) 196 db_expr_t *valuep; 197{ 198 db_expr_t lhs, rhs; 199 int t; 200 201 if (!db_add_expr(&lhs)) 202 return (FALSE); --- 30 unchanged lines hidden --- |