* @date 2003
* @author Mathias Heil
* @version $Id$
- * @summary
+ * @brief
*
* Values are stored in a format depending upon chosen arithmetic
* module. Default uses strcalc and fltcalc.
#include <assert.h> /* assertions */
#include <stdlib.h> /* atoi() */
-#ifdef HAVE_STRING_H
-# include <string.h> /* nice things for strings */
-#endif
+#include <string.h>
#ifdef HAVE_STRINGS_H
#include <strings.h> /* strings.h also includes bsd only function strcasecmp */
#endif
case irms_internal_boolean:
/* match [tT][rR][uU][eE]|[fF][aA][lL][sS][eE] */
- if (strcasecmp(str, "true"))
- return tarval_b_true;
- else if (strcasecmp(str, "false"))
+ if (!strcasecmp(str, "true"))
return tarval_b_true;
+ else if (!strcasecmp(str, "false"))
+ return tarval_b_false;
else
/* XXX This is C semantics */
return atoi(str) ? tarval_b_true : tarval_b_false;
return get_tarval(fc_get_buffer(), fc_get_buffer_length(), mode);
case irms_reference:
- /* same as integer modes */
+ if (!strcasecmp(str, "null"))
+ return get_tarval_null(mode);
+ /* FALLTHROUGH */
case irms_int_number:
sc_val_from_str(str, len, NULL, mode);
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), mode);
switch (get_mode_sort(tv->mode)) {
case irms_reference:
if (tv == tv->mode->null) return snprintf(buf, len, "NULL");
- /* fall through */
+ /* FALLTHROUGH */
case irms_int_number:
switch (mode_info->mode_output) {
str = sc_print(tv->value, get_mode_size_bits(tv->mode), SC_OCT, 0);
break;
- case TVO_HEX:
case TVO_NATIVE:
+ prefix = "0x";
+ case TVO_HEX:
default:
str = sc_print(tv->value, get_mode_size_bits(tv->mode), SC_HEX, 0);
break;
}
/* Enable/Disable floating point constant folding. */
-int tarval_enable_fp_ops(int enable) {
- int old = !no_float;
-
+void tarval_enable_fp_ops(int enable) {
no_float = !enable;
- return old;
+}
+
+int tarval_fp_ops_enabled(void) {
+ return !no_float;
}
/**