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

htlepage.cc

Go to the documentation of this file.
00001 /* 
00002  *      HT Editor
00003  *      htlepage.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 "htnewexe.h"
00022 #include "htle.h"
00023 #include "htlepage.h"
00024 #include "httag.h"
00025 #include "htstring.h"
00026 #include "formats.h"
00027 #include "snprintf.h"
00028 
00029 #include "lestruct.h"
00030 
00031 #include <stdlib.h>
00032 
00033 static ht_mask_ptable lepagemap[]=
00034 {
00035         {"page high",   STATICTAG_EDIT_WORD_LE("00000000")},
00036         {"page low",    STATICTAG_EDIT_BYTE("00000002")},
00037         {"flags",               STATICTAG_EDIT_BYTE("00000003")},
00038         {0, 0}
00039 };
00040 
00041 static ht_view *htlepagemaps_init(bounds *b, ht_streamfile *file, ht_format_group *group)
00042 {
00043         ht_le_shared_data *le_shared=(ht_le_shared_data *)group->get_shared_data();
00044 
00045         int h=le_shared->hdr_ofs;
00046         ht_uformat_viewer *v=new ht_uformat_viewer();
00047         v->init(b, DESC_LE_PAGEMAP, VC_EDIT | VC_SEARCH, file, group);
00048         
00049         ht_mask_sub *m=new ht_mask_sub();
00050         m->init(file, 0);
00051 
00052         char t[64];
00053         ht_snprintf(t, sizeof t, "* LE page maps at offset %08x", h+le_shared->hdr.pagemap);
00054         m->add_mask(t);
00055 
00056         v->insertsub(m);
00057 
00058 /* FIXME: */
00059         bool le_bigendian = false;
00060 
00061         for (dword i=0; i<le_shared->hdr.pagecnt; i++) {
00062                 m=new ht_mask_sub();
00063                 m->init(file, i);
00064                 
00065                 ht_snprintf(t, sizeof t, "--- page %d at %08x ---", i+1, le_shared->pagemap.offset[i]);
00066                 m->add_staticmask_ptable(lepagemap, h+le_shared->hdr.pagemap+i*4, le_bigendian);
00067                 ht_collapsable_sub *cs=new ht_collapsable_sub();
00068                 cs->init(file, m, 1, t, 1);
00069                 v->insertsub(cs);
00070         }
00071 
00072         le_shared->v_pagemaps=v;
00073         return v;
00074 }
00075 
00076 format_viewer_if htlepagemaps_if = {
00077         htlepagemaps_init,
00078         0
00079 };

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