- /****h* tools/strcalc
- *
- * NAME
- * strcalc -- calculations using strings
- * Provides basic mathematical operations on values represented as strings
- *
- * AUTHORS
- * Matthias Heil
+/*
+ * Project: libFIRM
+ * File name: ir/tv/strcalc.h
+ * Purpose: Provides basic mathematical operations on values represented as strings.
+ * Author: Mathias Heil
+ * Modified by:
+ * Created:
+ * CVS-ID: $Id$
+ * Copyright: (c) 2003 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
+
+/**
+ * @file strcalc.h
*
- * DESCRIPTION
- * The module uses a string to represent values, and provides operations
- * to perform calculations with these values.
- * Results are stored in an internal buffer, so you have to make a copy
- * of them if you need to store the result.
+ * The module uses a string to represent values, and provides operations
+ * to perform calculations with these values.
+ * Results are stored in an internal buffer, so you have to make a copy
+ * of them if you need to store the result.
*
- ******/
+ */
#ifndef _STRCALC_H_
#define _STRCALC_H_
* Possible operations on integer values.
*/
typedef enum {
- SC_ADD = 0, /**< Addition */
- SC_SUB, /**< Substraction */
- SC_NEG, /**< Unary Minus */
- SC_MUL, /**< Multiplication */
- SC_DIV, /**< Integer Division (with rounding toward zero ?) */
- SC_MOD, /**< Devision Remainder */
- SC_SHL, /**< Left Shift */
- SC_SHR, /**< Logical (unsigned) Right Shift */
- SC_SHRS, /**< Arithmetic (signed) Right Shift */
- SC_ROT, /**< Rotation (both directions) */
- SC_AND, /**< Bitwise And */
- SC_OR, /**< Bitwise Or */
- SC_NOT, /**< Bitwise Not */
- SC_XOR, /**< Bitwise Exclusive Or */
+ SC_ADD = 0, /**< Addition */
+ SC_SUB, /**< Substraction */
+ SC_NEG, /**< Unary Minus */
+ SC_MUL, /**< Multiplication */
+ SC_DIV, /**< Integer Division (with rounding toward zero ?) */
+ SC_MOD, /**< Devision Remainder */
+ SC_SHL, /**< Left Shift */
+ SC_SHR, /**< Logical (unsigned) Right Shift */
+ SC_SHRS, /**< Arithmetic (signed) Right Shift */
+ SC_ROT, /**< Rotation (both directions) */
+ SC_AND, /**< Bitwise And */
+ SC_OR, /**< Bitwise Or */
+ SC_NOT, /**< Bitwise Not */
+ SC_XOR /**< Bitwise Exclusive Or */
} sc_op_t;
/**
* The output mode for ntger values.
*/
enum base_t {
- SC_hex, /**< hexadecimal output with small letters */
- SC_HEX, /**< hexadecimal output with BIG letters */
- SC_DEC, /**< decimal output */
- SC_OCT, /**< octal output */
- SC_BIN /**< binary output */
+ SC_hex, /**< hexadecimal output with small letters */
+ SC_HEX, /**< hexadecimal output with BIG letters */
+ SC_DEC, /**< decimal output */
+ SC_OCT, /**< octal output */
+ SC_BIN /**< binary output */
};
/*
/**
* Converts a tarval into a string.
*
- * @param val1 the value pointer
- * @param bits number of valid bits in this value
- * @param base output base
+ * @param val1 the value pointer
+ * @param bits number of valid bits in this value
+ * @param base output base
*/
const char *sc_print(const void *val1, unsigned bits, enum base_t base);
* for calculations. The reason for being multiples of 8 eludes me
*/
void init_strcalc(int precision_in_bytes);
+void finish_strcalc(void);
int sc_get_precision(void);
#endif /* _STRCALC_H_ */