00001 /* 00002 * fold.cpp - parts of a disassembler for u8usecode 00003 * 00004 * Copyright (C) 2002-2003 The Pentagram Team 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #include "pent_include.h" 00022 00023 #define FOLD 00024 00025 #include <vector> 00026 using std::vector; 00027 #include <string> 00028 using std::string; 00029 #include "IDataSource.h" 00030 00031 class Node; 00032 00033 Node *newNode(uint32 pos); 00034 00035 vector<bool> ismember; // tells if the 'intrinsic' call is a call to a member function or not 00036 bool print_disasm=false; 00037 00038 void initfolding(); 00039 00040 #include "Disasm.cpp" 00041 00042 #include "Folder.h" 00043 00044 #include "u8/ConvertUsecodeU8.h" 00045 #include "crusader/ConvertUsecodeCrusader.h" 00046 00047 00048 void initfolding() 00049 { 00050 // if we're crusader, we don't have to do any initialisation since 00051 // there's no known intrinsics 00052 //if(crusader) return; 00053 00054 const char * const *i=convert->intrinsics(); 00055 00056 while(*i!=0) 00057 { 00058 //std::cout << *i << std::endl; 00059 if(string(*i).find(":")==string::npos) // it's a global 00060 ismember.push_back(false); 00061 else // it's a member 00062 ismember.push_back(true); 00063 ++i; 00064 } 00065 }