MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_unary

Function db_unary

freebsd/ddb/db_expr.c:112–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112static bool
113db_unary(db_expr_t *valuep)
114{
115 int t;
116
117 t = db_read_token();
118 if (t == tMINUS) {
119 if (!db_unary(valuep)) {
120 db_printf("Expression syntax error after '%c'\n", '-');
121 db_error(NULL);
122 /*NOTREACHED*/
123 }
124 *valuep = -*valuep;
125 return (true);
126 }
127 if (t == tEXCL) {
128 if(!db_unary(valuep)) {
129 db_printf("Expression syntax error after '%c'\n", '!');
130 db_error(NULL);
131 /* NOTREACHED */
132 }
133 *valuep = (!(*valuep));
134 return (true);
135 }
136 if (t == tBIT_NOT) {
137 if(!db_unary(valuep)) {
138 db_printf("Expression syntax error after '%c'\n", '~');
139 db_error(NULL);
140 /* NOTREACHED */
141 }
142 *valuep = (~(*valuep));
143 return (true);
144 }
145 if (t == tSTAR) {
146 /* indirection */
147 if (!db_unary(valuep)) {
148 db_printf("Expression syntax error after '%c'\n", '*');
149 db_error(NULL);
150 /*NOTREACHED*/
151 }
152 *valuep = db_get_value((db_addr_t)*valuep, sizeof(void *),
153 false);
154 return (true);
155 }
156 db_unread_token(t);
157 return (db_term(valuep));
158}
159
160static bool
161db_mult_expr(db_expr_t *valuep)

Callers 1

db_mult_exprFunction · 0.85

Calls 6

db_read_tokenFunction · 0.85
db_printfFunction · 0.85
db_errorFunction · 0.85
db_get_valueFunction · 0.85
db_unread_tokenFunction · 0.85
db_termFunction · 0.85

Tested by

no test coverage detected