------------------------------------------------------------------ */ decContextSetStatusFromString -- set status from a string + trap */ / context is the context structure to be updated */ string is a string exactly equal to one that might be returned */ by decContextStatusToString */ / The status bit corresponding to the string is set, and a tr
| 228 | /* returned. */ |
| 229 | /* ------------------------------------------------------------------ */ |
| 230 | decContext * decContextSetStatusFromString(decContext *context, |
| 231 | const char *string) { |
| 232 | if (strcmp(string, DEC_Condition_CS)==0) |
| 233 | return decContextSetStatus(context, DEC_Conversion_syntax); |
| 234 | if (strcmp(string, DEC_Condition_DZ)==0) |
| 235 | return decContextSetStatus(context, DEC_Division_by_zero); |
| 236 | if (strcmp(string, DEC_Condition_DI)==0) |
| 237 | return decContextSetStatus(context, DEC_Division_impossible); |
| 238 | if (strcmp(string, DEC_Condition_DU)==0) |
| 239 | return decContextSetStatus(context, DEC_Division_undefined); |
| 240 | if (strcmp(string, DEC_Condition_IE)==0) |
| 241 | return decContextSetStatus(context, DEC_Inexact); |
| 242 | if (strcmp(string, DEC_Condition_IS)==0) |
| 243 | return decContextSetStatus(context, DEC_Insufficient_storage); |
| 244 | if (strcmp(string, DEC_Condition_IC)==0) |
| 245 | return decContextSetStatus(context, DEC_Invalid_context); |
| 246 | if (strcmp(string, DEC_Condition_IO)==0) |
| 247 | return decContextSetStatus(context, DEC_Invalid_operation); |
| 248 | #if DECSUBSET |
| 249 | if (strcmp(string, DEC_Condition_LD)==0) |
| 250 | return decContextSetStatus(context, DEC_Lost_digits); |
| 251 | #endif |
| 252 | if (strcmp(string, DEC_Condition_OV)==0) |
| 253 | return decContextSetStatus(context, DEC_Overflow); |
| 254 | if (strcmp(string, DEC_Condition_PA)==0) |
| 255 | return decContextSetStatus(context, DEC_Clamped); |
| 256 | if (strcmp(string, DEC_Condition_RO)==0) |
| 257 | return decContextSetStatus(context, DEC_Rounded); |
| 258 | if (strcmp(string, DEC_Condition_SU)==0) |
| 259 | return decContextSetStatus(context, DEC_Subnormal); |
| 260 | if (strcmp(string, DEC_Condition_UN)==0) |
| 261 | return decContextSetStatus(context, DEC_Underflow); |
| 262 | if (strcmp(string, DEC_Condition_ZE)==0) |
| 263 | return context; |
| 264 | return NULL; // Multiple status, or unknown |
| 265 | } // decContextSetStatusFromString |
| 266 | |
| 267 | /* ------------------------------------------------------------------ */ |
| 268 | /* decContextSetStatusFromStringQuiet -- set status from a string */ |
nothing calls this directly
no test coverage detected