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

htsearch.cc File Reference

#include "htatom.h"
#include "cmds.h"
#include "htctrl.h"
#include "hthist.h"
#include "htiobox.h"
#include "htkeyb.h"
#include "htsearch.h"
#include "htstring.h"
#include "process.h"
#include "snprintf.h"
#include "evalx.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  ht_replace_method
struct  ht_search_method
union  search_pos

Defines

#define TEST_STR_TO_OFS_MAXSTRLEN   128
#define TEST_STR_TO_POS_MAXSTRLEN   128
#define EVALSTR_MAXSTRLEN   256
#define VREGEX_MAXSTRLEN   256
#define EXPR_MAXSTRLEN   256
#define SEARCH_BUF_SIZE   256*1024
#define REPLACE_COPY_BUF_SIZE   64*1024

Typedefs

typedef ht_search_request *(* create_request_func )(search_pos *ret_start, search_pos *ret_end, ht_view *form, ht_format_viewer *format, UINT search_class)
typedef Object *(* create_replace_context_func )(ht_streamfile *file, FILEOFS ofs, UINT len, ht_view *form, UINT *return_repllen)

Functions

bool test_str_to_ofs (FILEOFS *ofs, byte *str, UINT strlen, ht_format_viewer *format, char *desc)
bool test_str_to_pos (viewer_pos *pos, byte *str, UINT strlen, ht_format_viewer *format, char *desc)
ht_viewcreate_form_hexascii (bounds *b, HT_ATOM histid)
ht_search_requestcreate_request_hexascii (search_pos *start, search_pos *end, ht_view *f, ht_format_viewer *format, UINT search_class)
void create_desc_hexascii (char *buf, int buflen, ht_view *f)
ht_viewcreate_form_evalstr (bounds *b, HT_ATOM histid)
ht_search_requestcreate_request_evalstr (search_pos *start, search_pos *end, ht_view *f, ht_format_viewer *format, UINT search_class)
void create_desc_evalstr (char *buf, int buflen, ht_view *f)
ht_viewcreate_form_vregex (bounds *b, HT_ATOM histid)
ht_search_requestcreate_request_vregex (search_pos *start, search_pos *end, ht_view *f, ht_format_viewer *format, UINT search_class)
void create_desc_vregex (char *buf, int buflen, ht_view *f)
ht_viewcreate_form_expr (bounds *b, HT_ATOM histid)
ht_search_requestcreate_request_expr (search_pos *start, search_pos *end, ht_view *f, ht_format_viewer *format, UINT search_class)
void create_desc_expr (char *buf, int buflen, ht_view *f)
void bufdowncase (byte *buf, dword len)
Objectcreate_search_bin_context (ht_streamfile *file, FILEOFS ofs, UINT len, byte *pat, UINT patlen, UINT flags, UINT *return_ofs, bool *return_success)
bool search_bin_process (Object *context, ht_text *progress_indicator)
ht_viewcreate_form_replace_hexascii (bounds *b, HT_ATOM histid)
Objectcreate_replace_hexascii_context (ht_streamfile *file, FILEOFS ofs, UINT len, ht_view *form, UINT *return_repllen)
ht_search_requestsearch_dialog (ht_format_viewer *format, UINT searchmodes, viewer_pos *start, viewer_pos *end)
UINT replace_dialog (ht_format_viewer *format, UINT searchmodes, bool *cancelled)
Objectcreate_replace_bin_context (ht_streamfile *file, FILEOFS ofs, UINT len, byte *repl, UINT repllen, UINT *return_repllen)
bool replace_bin_process (Object *context, ht_text *progress_indicator)
ht_search_resultlinear_bin_search (ht_search_request *search, FILEOFS start, FILEOFS end, ht_streamfile *file, FILEOFS fofs, dword fsize)

Variables

UINT lastsearchmodeid = 0
UINT lastreplacemodeid = 0


Define Documentation

#define EVALSTR_MAXSTRLEN   256
 

Referenced by create_request_evalstr().

#define EXPR_MAXSTRLEN   256
 

Referenced by create_request_expr().

#define REPLACE_COPY_BUF_SIZE   64*1024
 

Definition at line 1194 of file htsearch.cc.

Referenced by create_replace_bin_context(), and replace_bin_process().

#define SEARCH_BUF_SIZE   256*1024
 

Definition at line 472 of file htsearch.cc.

Referenced by create_search_bin_context(), and search_bin_process().

#define TEST_STR_TO_OFS_MAXSTRLEN   128
 

Referenced by test_str_to_ofs().

#define TEST_STR_TO_POS_MAXSTRLEN   128
 

Referenced by test_str_to_pos().

#define VREGEX_MAXSTRLEN   256
 

Referenced by create_request_vregex().


Typedef Documentation

typedef Object*(* create_replace_context_func)(ht_streamfile *file, FILEOFS ofs, UINT len, ht_view *form, UINT *return_repllen)
 

Definition at line 47 of file htsearch.cc.

typedef ht_search_request*(* create_request_func)(search_pos *ret_start, search_pos *ret_end, ht_view *form, ht_format_viewer *format, UINT search_class)
 

Definition at line 45 of file htsearch.cc.


Function Documentation

void bufdowncase byte *  buf,
dword  len
 

Definition at line 465 of file htsearch.cc.

References buf, dword, and len.

Referenced by create_search_bin_context(), and search_bin_process().

void create_desc_evalstr char *  buf,
int  buflen,
ht_view f
 

Definition at line 217 of file htsearch.cc.

References buf, ht_view::databuf_get(), ht_evalstr_search_form_data::end, escape_special(), ht_io_exception, NULL, ht_evalstr_search_form_data::options, ht_evalstr_search_form_data::start, and ht_evalstr_search_form_data::str.

void create_desc_expr char *  buf,
int  buflen,
ht_view f
 

Definition at line 411 of file htsearch.cc.

References buf, ht_view::databuf_get(), ht_vregex_search_form_data::end, escape_special(), ht_io_exception, NULL, ht_vregex_search_form_data::options, ht_vregex_search_form_data::start, and ht_vregex_search_form_data::str.

void create_desc_hexascii char *  buf,
int  buflen,
ht_view f
 

Definition at line 139 of file htsearch.cc.

References buf, ht_view::databuf_get(), ht_hexascii_search_form_data::end, escape_special(), ht_io_exception, NULL, ht_hexascii_search_form_data::options, ht_hexascii_search_form_data::start, and ht_hexascii_search_form_data::str.

void create_desc_vregex char *  buf,
int  buflen,
ht_view f
 

Definition at line 304 of file htsearch.cc.

References buf, ht_view::databuf_get(), ht_vregex_search_form_data::end, escape_special(), ht_io_exception, NULL, ht_vregex_search_form_data::options, ht_vregex_search_form_data::start, and ht_vregex_search_form_data::str.

ht_view* create_form_evalstr bounds *  b,
HT_ATOM  histid
 

Definition at line 172 of file htsearch.cc.

References find_atom(), HT_ATOM, and ht_evalstr_search_form::init().

ht_view* create_form_expr bounds *  b,
HT_ATOM  histid
 

Definition at line 379 of file htsearch.cc.

References find_atom(), HT_ATOM, and ht_expr_search_form::init().

ht_view* create_form_hexascii bounds *  b,
HT_ATOM  histid
 

Definition at line 110 of file htsearch.cc.

References find_atom(), HT_ATOM, and ht_hexascii_search_form::init().

ht_view* create_form_replace_hexascii bounds *  b,
HT_ATOM  histid
 

Definition at line 880 of file htsearch.cc.

References find_atom(), HT_ATOM, and ht_replace_hexascii_search_form::init().

ht_view* create_form_vregex bounds *  b,
HT_ATOM  histid
 

Definition at line 272 of file htsearch.cc.

References find_atom(), HT_ATOM, and ht_vregex_search_form::init().

Object* create_replace_bin_context ht_streamfile file,
FILEOFS  ofs,
UINT  len,
byte *  repl,
UINT  repllen,
UINT return_repllen
 

Definition at line 1195 of file htsearch.cc.

References ht_replace_bin_context::buf, byte, ht_replace_bin_context::file, file, FILEOFS, ht_replace_bin_context::len, len, malloc(), ht_replace_bin_context::o, ht_replace_bin_context::ofs, ht_replace_bin_context::repl, REPLACE_COPY_BUF_SIZE, ht_replace_bin_context::repllen, ht_replace_bin_context::return_repllen, UINT, and ht_replace_bin_context::z.

Referenced by create_replace_hexascii_context().

Object* create_replace_hexascii_context ht_streamfile file,
FILEOFS  ofs,
UINT  len,
ht_view form,
UINT return_repllen
 

Definition at line 887 of file htsearch.cc.

References create_replace_bin_context(), ht_view::databuf_get(), file, FILEOFS, len, ht_replace_hexascii_search_form_data::str, and UINT.

ht_search_request* create_request_evalstr search_pos start,
search_pos end,
ht_view f,
ht_format_viewer format,
UINT  search_class
 

Definition at line 179 of file htsearch.cc.

References bin2str(), byte, ht_view::databuf_get(), ht_evalstr_search_form_data::end, eval(), EVALSTR_MAXSTRLEN, get_eval_error(), ht_io_exception, eval_str::len, NULL, search_pos::offset, ht_evalstr_search_form_data::options, scalar_context_str(), scalar_destroy(), ht_evalstr_search_form_data::start, ht_evalstr_search_form_data::str, test_str_to_ofs(), UINT, and eval_str::value.

ht_search_request* create_request_expr search_pos start,
search_pos end,
ht_view f,
ht_format_viewer format,
UINT  search_class
 

Definition at line 386 of file htsearch.cc.

References bin2str(), ht_view::databuf_get(), ht_expr_search_form_data::end, EXPR_MAXSTRLEN, ht_io_exception, NULL, search_pos::offset, ht_expr_search_form_data::start, ht_expr_search_form_data::str, test_str_to_ofs(), and UINT.

ht_search_request* create_request_hexascii search_pos start,
search_pos end,
ht_view f,
ht_format_viewer format,
UINT  search_class
 

Definition at line 117 of file htsearch.cc.

References create_request_hexascii(), ht_view::databuf_get(), ht_hexascii_search_form_data::end, ht_io_exception, NULL, search_pos::offset, ht_hexascii_search_form_data::options, ht_hexascii_search_form_data::start, ht_hexascii_search_form_data::str, test_str_to_ofs(), and UINT.

Referenced by create_request_hexascii().

ht_search_request* create_request_vregex search_pos start,
search_pos end,
ht_view f,
ht_format_viewer format,
UINT  search_class
 

Definition at line 279 of file htsearch.cc.

References bin2str(), ht_view::databuf_get(), ht_vregex_search_form_data::end, ht_io_exception, NULL, ht_vregex_search_form_data::options, search_pos::pos, SF_REGEX_CASEINSENSITIVE, ht_vregex_search_form_data::start, ht_vregex_search_form_data::str, test_str_to_pos(), UINT, and VREGEX_MAXSTRLEN.

Object* create_search_bin_context ht_streamfile file,
FILEOFS  ofs,
UINT  len,
byte *  pat,
UINT  patlen,
UINT  flags,
UINT return_ofs,
bool *  return_success
 

Definition at line 480 of file htsearch.cc.

References ht_search_bin_context::buf, bufdowncase(), ht_search_bin_context::bufptr, byte, ht_search_bin_context::c, ht_search_bin_context::file, file, ht_search_bin_context::file_end, FILEOFS, ht_search_bin_context::flags, ht_search_bin_context::len, len, malloc(), NULL, ht_search_bin_context::o, ht_search_bin_context::ofs, ht_search_bin_context::pat, ht_search_bin_context::patlen, ht_search_bin_context::return_ofs, ht_search_bin_context::return_success, SEARCH_BUF_SIZE, SFBIN_CASEINSENSITIVE, and UINT.

Referenced by linear_bin_search().

ht_search_result* linear_bin_search ht_search_request search,
FILEOFS  start,
FILEOFS  end,
ht_streamfile file,
FILEOFS  fofs,
dword  fsize
 

Definition at line 1506 of file htsearch.cc.

References create_search_bin_context(), ht_fxbin_search_request::data, ht_fxbin_search_request::data_size, execute_process(), file, FILEOFS, ht_search_request::flags, NULL, ht_physical_search_result::offset, search_bin_process(), SFBIN_CASEINSENSITIVE, and ht_physical_search_result::size.

Referenced by ht_analy_sub::search(), ht_linear_sub::search(), and ht_text_viewer::search().

bool replace_bin_process Object context,
ht_text progress_indicator
 

Definition at line 1216 of file htsearch.cc.

References ht_replace_bin_context::buf, ht_streamfile::extend(), ht_replace_bin_context::file, ht_streamfile::get_size(), ht_io_exception, ht_replace_bin_context::len, ht_replace_bin_context::o, ht_replace_bin_context::ofs, ht_stream::read(), ht_replace_bin_context::repl, REPLACE_COPY_BUF_SIZE, ht_replace_bin_context::repllen, ht_replace_bin_context::return_repllen, ht_streamfile::seek(), ht_text::settext(), size, ht_streamfile::truncate(), UINT, ht_stream::write(), and ht_replace_bin_context::z.

UINT replace_dialog ht_format_viewer format,
UINT  searchmodes,
bool *  cancelled
 

Definition at line 1046 of file htsearch.cc.

References align_center, app, btmask_all, btmask_cancel, btmask_no, btmask_yes, button_all, button_cancel, button_no, button_yes, cmd_vstate_restore, ht_search_method::create_desc, ht_search_method::create_form, ht_replace_method::create_form, ht_replace_method::create_replace_context, ht_search_method::create_request, ht_replace_dialog::done(), errorbox, execute_process(), FILEOFS, find_atom(), ht_format_viewer::get_current_offset(), ht_format_viewer::get_file(), ht_replace_dialog::get_replace_modeform(), ht_replace_dialog::get_replace_modeid(), ht_search_dialog::get_search_modeform(), ht_search_dialog::get_search_modeid(), ht_view::getbounds(), ht_search_method::histid, ht_replace_method::histid, ht_replace_dialog::init(), insert_history_entry(), ht_replace_dialog::insert_replace_mode(), ht_search_dialog::insert_search_mode(), lastreplacemodeid, lastsearchmodeid, msg_filesize_changed, msgbox(), ht_search_method::name, ht_replace_method::name, NULL, search_pos::offset, ht_physical_search_result::offset, ht_format_viewer::psearch(), ht_replace_dialog::replace_mode_xgroup, ht_replace_method::replace_process, ht_dialog::run(), SC_PHYSICAL, screen, ht_search_method::search_class, ht_search_method::search_mode_mask, ht_search_dialog::search_mode_xgroup, ht_replace_dialog::select_replace_mode(), ht_search_dialog::select_search_mode(), ht_view::sendmsg(), ht_format_viewer::show_search_result(), genericdrawbuf::size, ht_physical_search_result::size, UINT, and ht_format_viewer::vstate_save().

Referenced by ht_uformat_viewer::handlemsg().

bool search_bin_process Object context,
ht_text progress_indicator
 

Definition at line 512 of file htsearch.cc.

References ht_search_bin_context::buf, bufdowncase(), ht_search_bin_context::bufptr, ht_search_bin_context::c, ht_search_bin_context::file, ht_search_bin_context::file_end, ht_search_bin_context::flags, ht_snprintf(), ht_search_bin_context::len, ht_search_bin_context::o, ht_search_bin_context::ofs, ht_search_bin_context::pat, ht_search_bin_context::patlen, ht_stream::read(), ht_search_bin_context::return_ofs, ht_search_bin_context::return_success, SEARCH_BUF_SIZE, ht_streamfile::seek(), ht_text::settext(), and SFBIN_CASEINSENSITIVE.

Referenced by linear_bin_search().

ht_search_request* search_dialog ht_format_viewer format,
UINT  searchmodes,
viewer_pos start,
viewer_pos end
 

Definition at line 955 of file htsearch.cc.

References ht_search_method::create_desc, ht_search_method::create_form, ht_search_method::create_request, ht_search_dialog::done(), errorbox, find_atom(), ht_search_dialog::get_search_modeform(), ht_search_dialog::get_search_modeid(), ht_view::getbounds(), ht_search_method::histid, ht_io_exception, ht_search_dialog::init(), insert_history_entry(), ht_search_dialog::insert_search_mode(), lastsearchmodeid, ht_search_method::name, NULL, search_pos::offset, ht_format_viewer::offset_to_pos(), search_pos::pos, ht_format_viewer::pos_to_offset(), ht_dialog::run(), SC_PHYSICAL, SC_VISUAL, screen, ht_search_method::search_class, ht_search_method::search_mode_mask, ht_search_dialog::search_mode_xgroup, ht_search_dialog::select_search_mode(), genericdrawbuf::size, and UINT.

Referenced by ht_uformat_viewer::handlemsg().

bool test_str_to_ofs FILEOFS ofs,
byte *  str,
UINT  strlen,
ht_format_viewer format,
char *  desc
 

Definition at line 70 of file htsearch.cc.

References bin2str(), FILEOFS, ht_io_exception, ht_format_viewer::string_to_offset(), TEST_STR_TO_OFS_MAXSTRLEN, and UINT.

Referenced by create_request_evalstr(), create_request_expr(), and create_request_hexascii().

bool test_str_to_pos viewer_pos pos,
byte *  str,
UINT  strlen,
ht_format_viewer format,
char *  desc
 

Definition at line 88 of file htsearch.cc.

References bin2str(), ht_io_exception, ht_format_viewer::string_to_pos(), TEST_STR_TO_POS_MAXSTRLEN, and UINT.

Referenced by create_request_vregex().


Variable Documentation

UINT lastreplacemodeid = 0
 

Definition at line 43 of file htsearch.cc.

Referenced by replace_dialog().

UINT lastsearchmodeid = 0
 

Definition at line 42 of file htsearch.cc.

Referenced by replace_dialog(), and search_dialog().


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