00001
00034 #ifndef YASM_INTNUM_H
00035 #define YASM_INTNUM_H
00036
00037 #ifndef YASM_LIB_DECL
00038 #define YASM_LIB_DECL
00039 #endif
00040
00042 YASM_LIB_DECL
00043 void yasm_intnum_initialize(void);
00044
00046 YASM_LIB_DECL
00047 void yasm_intnum_cleanup(void);
00048
00053 YASM_LIB_DECL
00054 yasm_intnum *yasm_intnum_create_dec(char *str);
00055
00060 YASM_LIB_DECL
00061 yasm_intnum *yasm_intnum_create_bin(char *str);
00062
00067 YASM_LIB_DECL
00068 yasm_intnum *yasm_intnum_create_oct(char *str);
00069
00074 YASM_LIB_DECL
00075 yasm_intnum *yasm_intnum_create_hex(char *str);
00076
00083 YASM_LIB_DECL
00084 yasm_intnum *yasm_intnum_create_charconst_nasm(const char *str);
00085
00092 YASM_LIB_DECL
00093 yasm_intnum *yasm_intnum_create_charconst_tasm(const char *str);
00094
00099 YASM_LIB_DECL
00100 yasm_intnum *yasm_intnum_create_uint(unsigned long i);
00101
00106 YASM_LIB_DECL
00107 yasm_intnum *yasm_intnum_create_int(long i);
00108
00116 YASM_LIB_DECL
00117 yasm_intnum *yasm_intnum_create_leb128
00118 (const unsigned char *ptr, int sign, unsigned long *size);
00119
00127 YASM_LIB_DECL
00128 yasm_intnum *yasm_intnum_create_sized
00129 (unsigned char *ptr, int sign, size_t srcsize, int bigendian);
00130
00135 YASM_LIB_DECL
00136 yasm_intnum *yasm_intnum_copy(const yasm_intnum *intn);
00137
00141 YASM_LIB_DECL
00142 void yasm_intnum_destroy( yasm_intnum *intn);
00143
00152 YASM_LIB_DECL
00153 int yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand);
00154
00160 YASM_LIB_DECL
00161 int yasm_intnum_compare(const yasm_intnum *intn1, const yasm_intnum *intn2);
00162
00166 YASM_LIB_DECL
00167 void yasm_intnum_zero(yasm_intnum *intn);
00168
00173 YASM_LIB_DECL
00174 void yasm_intnum_set(yasm_intnum *intn, const yasm_intnum *val);
00175
00180 YASM_LIB_DECL
00181 void yasm_intnum_set_uint(yasm_intnum *intn, unsigned long val);
00182
00187 YASM_LIB_DECL
00188 void yasm_intnum_set_int(yasm_intnum *intn, long val);
00189
00194 YASM_LIB_DECL
00195 int yasm_intnum_is_zero(const yasm_intnum *acc);
00196
00201 YASM_LIB_DECL
00202 int yasm_intnum_is_pos1(const yasm_intnum *acc);
00203
00208 YASM_LIB_DECL
00209 int yasm_intnum_is_neg1(const yasm_intnum *acc);
00210
00215 YASM_LIB_DECL
00216 int yasm_intnum_sign(const yasm_intnum *acc);
00217
00225 YASM_LIB_DECL
00226 unsigned long yasm_intnum_get_uint(const yasm_intnum *intn);
00227
00235 YASM_LIB_DECL
00236 long yasm_intnum_get_int(const yasm_intnum *intn);
00237
00252 YASM_LIB_DECL
00253 void yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr,
00254 size_t destsize, size_t valsize, int shift,
00255 int bigendian, int warn);
00256
00267 YASM_LIB_DECL
00268 int yasm_intnum_check_size(const yasm_intnum *intn, size_t size,
00269 size_t rshift, int rangetype);
00270
00277 YASM_LIB_DECL
00278 int yasm_intnum_in_range(const yasm_intnum *intn, long low, long high);
00279
00286 YASM_LIB_DECL
00287 unsigned long yasm_intnum_get_leb128(const yasm_intnum *intn,
00288 unsigned char *ptr, int sign);
00289
00295 YASM_LIB_DECL
00296 unsigned long yasm_intnum_size_leb128(const yasm_intnum *intn, int sign);
00297
00303 YASM_LIB_DECL
00304 unsigned long yasm_get_sleb128(long v, unsigned char *ptr);
00305
00310 YASM_LIB_DECL
00311 unsigned long yasm_size_sleb128(long v);
00312
00318 YASM_LIB_DECL
00319 unsigned long yasm_get_uleb128(unsigned long v, unsigned char *ptr);
00320
00325 YASM_LIB_DECL
00326 unsigned long yasm_size_uleb128(unsigned long v);
00327
00334 YASM_LIB_DECL
00335 char *yasm_intnum_get_str(const yasm_intnum *intn);
00336
00341 YASM_LIB_DECL
00342 void yasm_intnum_print(const yasm_intnum *intn, FILE *f);
00343
00344 #endif