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
00090 YASM_LIB_DECL
00091 yasm_intnum *yasm_intnum_create_uint(unsigned long i);
00092
00097 YASM_LIB_DECL
00098 yasm_intnum *yasm_intnum_create_int(long i);
00099
00107 YASM_LIB_DECL
00108 yasm_intnum *yasm_intnum_create_leb128
00109 (const unsigned char *ptr, int sign, unsigned long *size);
00110
00118 YASM_LIB_DECL
00119 yasm_intnum *yasm_intnum_create_sized
00120 (unsigned char *ptr, int sign, size_t srcsize, int bigendian);
00121
00126 YASM_LIB_DECL
00127 yasm_intnum *yasm_intnum_copy(const yasm_intnum *intn);
00128
00132 YASM_LIB_DECL
00133 void yasm_intnum_destroy( yasm_intnum *intn);
00134
00143 YASM_LIB_DECL
00144 int yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand);
00145
00151 YASM_LIB_DECL
00152 int yasm_intnum_compare(const yasm_intnum *intn1, const yasm_intnum *intn2);
00153
00157 YASM_LIB_DECL
00158 void yasm_intnum_zero(yasm_intnum *intn);
00159
00164 YASM_LIB_DECL
00165 void yasm_intnum_set(yasm_intnum *intn, const yasm_intnum *val);
00166
00171 YASM_LIB_DECL
00172 void yasm_intnum_set_uint(yasm_intnum *intn, unsigned long val);
00173
00178 YASM_LIB_DECL
00179 void yasm_intnum_set_int(yasm_intnum *intn, long val);
00180
00185 YASM_LIB_DECL
00186 int yasm_intnum_is_zero(const yasm_intnum *acc);
00187
00192 YASM_LIB_DECL
00193 int yasm_intnum_is_pos1(const yasm_intnum *acc);
00194
00199 YASM_LIB_DECL
00200 int yasm_intnum_is_neg1(const yasm_intnum *acc);
00201
00206 YASM_LIB_DECL
00207 int yasm_intnum_sign(const yasm_intnum *acc);
00208
00216 YASM_LIB_DECL
00217 unsigned long yasm_intnum_get_uint(const yasm_intnum *intn);
00218
00226 YASM_LIB_DECL
00227 long yasm_intnum_get_int(const yasm_intnum *intn);
00228
00243 YASM_LIB_DECL
00244 void yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr,
00245 size_t destsize, size_t valsize, int shift,
00246 int bigendian, int warn);
00247
00258 YASM_LIB_DECL
00259 int yasm_intnum_check_size(const yasm_intnum *intn, size_t size,
00260 size_t rshift, int rangetype);
00261
00268 YASM_LIB_DECL
00269 int yasm_intnum_in_range(const yasm_intnum *intn, long low, long high);
00270
00277 YASM_LIB_DECL
00278 unsigned long yasm_intnum_get_leb128(const yasm_intnum *intn,
00279 unsigned char *ptr, int sign);
00280
00286 YASM_LIB_DECL
00287 unsigned long yasm_intnum_size_leb128(const yasm_intnum *intn, int sign);
00288
00294 YASM_LIB_DECL
00295 unsigned long yasm_get_sleb128(long v, unsigned char *ptr);
00296
00301 YASM_LIB_DECL
00302 unsigned long yasm_size_sleb128(long v);
00303
00309 YASM_LIB_DECL
00310 unsigned long yasm_get_uleb128(unsigned long v, unsigned char *ptr);
00311
00316 YASM_LIB_DECL
00317 unsigned long yasm_size_uleb128(unsigned long v);
00318
00325 YASM_LIB_DECL
00326 char *yasm_intnum_get_str(const yasm_intnum *intn);
00327
00332 YASM_LIB_DECL
00333 void yasm_intnum_print(const yasm_intnum *intn, FILE *f);
00334
00335 #endif