Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

tools.h File Reference

#include <stdlib.h>
#include <string.h>
#include "global.h"
#include "htdata.h"

Go to the source code of this file.

Defines

#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
#define UNALIGNED_MOVE(a, b)   (a) = (b)
#define UNALIGNED_MOVE_CONST(a, b, type)   (a) = (b)
#define OUT_OF_MEMORY_FAIL   0
#define OUT_OF_MEMORY_IGNORE   1
#define OUT_OF_MEMORY_RETRY   2

Functions

dword delinearize (dword d)
int compare_keys_int_delinear (Object *key_a, Object *key_b)
int compare_keys_uint_delinear (Object *key_a, Object *key_b)
int * random_permutation (int max)
double calc_entropy (byte *buf, int size)
int calc_entropy2 (byte *buf, int size)
int out_of_memory (int size)
void * smalloc (size_t size)
void * smalloc0 (size_t size)

Variables

int(* out_of_memory_func )(int size)


Define Documentation

#define MAX a,
 )     ((a) > (b) ? (a) : (b))
 

Definition at line 34 of file tools.h.

#define MIN a,
 )     ((a) < (b) ? (a) : (b))
 

Definition at line 33 of file tools.h.

#define OUT_OF_MEMORY_FAIL   0
 

Definition at line 54 of file tools.h.

Referenced by app_out_of_memory_proc(), and out_of_memory().

#define OUT_OF_MEMORY_IGNORE   1
 

Definition at line 55 of file tools.h.

Referenced by smalloc(), and smalloc0().

#define OUT_OF_MEMORY_RETRY   2
 

Definition at line 56 of file tools.h.

Referenced by app_out_of_memory_proc(), smalloc(), and smalloc0().

#define UNALIGNED_MOVE a,
 )     (a) = (b)
 

Definition at line 40 of file tools.h.

Referenced by Alphadis::decode(), AddressX86_1616::getFromArray(), AddressX86_1632::getFromArray(), AddressX86Flat32::getFromArray(), AddressFlat64::getFromArray(), AddressFlat32::getFromArray(), AddressX86_1616::putIntoArray(), AddressX86_1632::putIntoArray(), AddressX86Flat32::putIntoArray(), AddressFlat64::putIntoArray(), AddressFlat32::putIntoArray(), tag_get_color(), tag_get_desc_id(), tag_get_id(), tag_get_offset(), tag_make_color(), tag_make_desc_byte(), tag_make_desc_dword(), tag_make_desc_qword(), tag_make_desc_word(), tag_make_edit_bit(), tag_make_edit_byte(), tag_make_edit_char(), tag_make_edit_dword(), tag_make_edit_qword(), tag_make_edit_selvis(), tag_make_edit_time(), tag_make_edit_word(), tag_make_flags(), tag_make_ref_len(), and tag_set_offset().

#define UNALIGNED_MOVE_CONST a,
b,
type   )     (a) = (b)
 

Definition at line 41 of file tools.h.

Referenced by tag_make_default_color().


Function Documentation

double calc_entropy byte *  buf,
int  size
 

Definition at line 75 of file tools.cc.

References buf, LN2, and size.

Referenced by ht_linear_func_entropy2().

int calc_entropy2 byte *  buf,
int  size
 

Definition at line 99 of file tools.cc.

References buf, byte, and size.

Referenced by ht_hex_viewer::handlemsg(), and ht_linear_func_entropy().

int compare_keys_int_delinear Object key_a,
Object key_b
 

Definition at line 34 of file tools.cc.

References delinearize(), and value.

int compare_keys_uint_delinear Object key_a,
Object key_b
 

Definition at line 42 of file tools.cc.

References delinearize(), UINT, and value.

dword delinearize dword  d  ) 
 

Definition at line 29 of file tools.cc.

References dword.

Referenced by compare_keys_file_delinear(), compare_keys_info_pos_delinear(), compare_keys_int_delinear(), compare_keys_uint_delinear(), AddressX86_1616::compareDelinear(), AddressX86_1632::compareDelinear(), AddressX86Flat32::compareDelinear(), AddressFlat64::compareDelinear(), and AddressFlat32::compareDelinear().

int out_of_memory int  size  ) 
 

Definition at line 148 of file tools.cc.

References OUT_OF_MEMORY_FAIL.

Referenced by done_app().

int* random_permutation int  max  ) 
 

Definition at line 50 of file tools.cc.

References NULL, and smalloc().

Referenced by XBEAnalyser::beginAnalysis(), PEAnalyser::beginAnalysis(), NEAnalyser::beginAnalysis(), MachoAnalyser::beginAnalysis(), and ElfAnalyser::initInsertSymbols().

void* smalloc size_t  size  ) 
 

Definition at line 157 of file tools.cc.

References malloc(), NULL, out_of_memory_func, OUT_OF_MEMORY_IGNORE, OUT_OF_MEMORY_RETRY, and size.

Referenced by ht_compressed_stream::flush_compressed(), ht_compressed_stream::flush_uncompressed(), ht_object_stream_txt::getBinary(), ht_object_stream_bin::getBinary(), ht_object_stream_txt::getString(), ht_app::handlemsg(), ht_aviewer::handlemsg(), ht_strdup(), ht_strndup(), AnalyInfoline::init(), SymbolBox::init(), ht_compressed_stream::init(), ht_object_stream_txt::putString(), SymbolBox::quickfindCompletition(), quote_string(), and random_permutation().

void* smalloc0 size_t  size  ) 
 

Definition at line 172 of file tools.cc.

References malloc(), NULL, out_of_memory_func, OUT_OF_MEMORY_IGNORE, OUT_OF_MEMORY_RETRY, and size.

Referenced by Analyser::newLocation(), and Analyser::newSymbol().


Variable Documentation

int(* out_of_memory_func)(int size)
 

Definition at line 57 of file tools.h.

Referenced by done_app(), init_app(), smalloc(), and smalloc0().


Generated on Fri May 7 21:15:52 2004 by doxygen 1.3.5