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

htneimp.cc

Go to the documentation of this file.
00001 /* 
00002  *      HT Editor
00003  *      htneimp.cc
00004  *
00005  *      Copyright (C) 1999-2002 Stefan Weyergraf (stefan@weyergraf.de)
00006  *
00007  *      This program is free software; you can redistribute it and/or modify
00008  *      it under the terms of the GNU General Public License version 2 as
00009  *      published by the Free Software Foundation.
00010  *
00011  *      This program is distributed in the hope that it will be useful,
00012  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *      GNU General Public License for more details.
00015  *
00016  *      You should have received a copy of the GNU General Public License
00017  *      along with this program; if not, write to the Free Software
00018  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #include "htatom.h"
00022 #include "htendian.h"
00023 #include "htne.h"
00024 #include "htneent.h"
00025 #include "httag.h"
00026 #include "formats.h"
00027 #include "snprintf.h"
00028 
00029 #include <stdlib.h>
00030 
00031 static ht_view *htneimports_init(bounds *b, ht_streamfile *file, ht_format_group *group)
00032 {
00033         ht_ne_shared_data *ne_shared = (ht_ne_shared_data *)group->get_shared_data();
00034 
00035         FILEOFS h = ne_shared->hdr_ofs;
00036         ht_uformat_viewer *v = new ht_uformat_viewer();
00037         v->init(b, DESC_NE_IMPORTS, VC_EDIT | VC_SEARCH, file, group);
00038         ht_mask_sub *m = new ht_mask_sub();
00039         m->init(file, 0);
00040 
00041         char line[256]; /* secure */
00042         ht_snprintf(line, sizeof line, "* NE imported names and module reference table at offset %08x / %08x", h+ne_shared->hdr.imptab, h+ne_shared->hdr.modtab);
00043         m->add_mask(line);
00044 
00045         for (UINT i=0; i<ne_shared->modnames_count; i++) {
00046                 ht_snprintf(line, sizeof line, "%0d: %s", i+1, ne_shared->modnames[i]);
00047                 m->add_mask(line);
00048         }
00049         v->insertsub(m);
00050 
00051         return v;
00052 }
00053 
00054 format_viewer_if htneimports_if = {
00055         htneimports_init,
00056         0
00057 };

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