* Copyright (c) 1991,1990 Carnegie Mellon University
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
* Carnegie Mellon requests users of this software to return to
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
* Author: David B. Golub, Carnegie Mellon University
#include <machine/db_machdep.h>
#include <ddb/db_access.h>
#include <ddb/db_command.h>
if (!db_value_of_name(db_tok_string
, valuep
)) {
db_error("Symbol not found\n");
*valuep
= (db_expr_t
)db_tok_number
;
*valuep
= (db_expr_t
)db_dot
;
*valuep
= (db_expr_t
)db_prev
;
*valuep
= (db_expr_t
) db_next
;
*valuep
= (db_expr_t
)db_last_addr
;
if (!db_get_variable(valuep
))
if (!db_expression(valuep
)) {
db_error("Syntax error\n");
db_error("Syntax error\n");
db_error("Syntax error\n");
db_error("Syntax error\n");
*valuep
= db_get_value((db_addr_t
)*valuep
, sizeof(int), FALSE
);
return (db_term(valuep
));
while (t
== tSTAR
|| t
== tSLASH
|| t
== tPCT
|| t
== tHASH
) {
db_error("Syntax error\n");
db_error("Divide by 0\n");
lhs
= ((lhs
+rhs
-1)/rhs
)*rhs
;
while (t
== tPLUS
|| t
== tMINUS
) {
if (!db_mult_expr(&rhs
)) {
db_error("Syntax error\n");
while (t
== tSHIFT_L
|| t
== tSHIFT_R
) {
if (!db_add_expr(&rhs
)) {
db_error("Syntax error\n");
db_error("Negative shift amount\n");
/* Shift right is unsigned */
lhs
= (unsigned) lhs
>> rhs
;
return (db_shift_expr(valuep
));