1.1 --- a/sourcehook/generate/sourcehook.hxx Tue Sep 13 16:47:42 2005 +0000
1.2 +++ b/sourcehook/generate/sourcehook.hxx Tue Sep 13 16:47:42 2005 +0000
1.3 @@ -185,8 +185,8 @@
1.4 int thisptr_offs; //!< This pointer offset
1.5 };
1.6 void *ptr; //!< Pointer to the interface instance
1.7 - std::list<Hook> hooks_pre; //!< A list of pre-hooks
1.8 - std::list<Hook> hooks_post; //!< A list of post-hooks
1.9 + SourceHook::List<Hook> hooks_pre; //!< A list of pre-hooks
1.10 + SourceHook::List<Hook> hooks_post; //!< A list of post-hooks
1.11 bool operator ==(void *other) const
1.12 {
1.13 return ptr == other;
1.14 @@ -196,7 +196,7 @@
1.15 void *vfnptr; //!< Pointer to the function
1.16 void *orig_entry; //!< The original vtable entry
1.17
1.18 - typedef std::list<Iface> IfaceList;
1.19 + typedef SourceHook::List<Iface> IfaceList;
1.20 typedef IfaceList::iterator IfaceListIter;
1.21 IfaceList ifaces; //!< List of interface pointers
1.22
1.23 @@ -214,13 +214,13 @@
1.24
1.25 void *hookfunc_vfnptr; //!< Pointer to the hookfunc impl
1.26
1.27 - typedef std::list<VfnPtr> VfnPtrList;
1.28 + typedef SourceHook::List<VfnPtr> VfnPtrList;
1.29 typedef VfnPtrList::iterator VfnPtrListIter;
1.30 VfnPtrList vfnptrs; //!< List of hooked interfaces
1.31 };
1.32
1.33 - typedef std::vector<void*> OrigFuncs;
1.34 - typedef std::map<int, OrigFuncs> OrigVTables;
1.35 + typedef SourceHook::CVector<void*> OrigFuncs;
1.36 + typedef SourceHook::THash<int, OrigFuncs> OrigVTables;
1.37
1.38 template<class B> struct CallClass
1.39 {
1.40 @@ -467,7 +467,7 @@
1.41 void *ourvfnptr = reinterpret_cast<void*>( \
1.42 *reinterpret_cast<void***>(reinterpret_cast<char*>(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \
1.43 \
1.44 - HookManagerInfo::VfnPtrListIter vfptriter = std::find(ms_HI->vfnptrs.begin(), \
1.45 + HookManagerInfo::VfnPtrListIter vfptriter = ms_HI->find(ms_HI->vfnptrs.begin(), \
1.46 ms_HI->vfnptrs.end(), ourvfnptr); \
1.47 if (vfptriter == ms_HI->vfnptrs.end()) \
1.48 { \
1.49 @@ -476,7 +476,7 @@
1.50 } \
1.51 HookManagerInfo::VfnPtr &vfnptr = *vfptriter; \
1.52 /* 2) Find the iface */ \
1.53 - HookManagerInfo::VfnPtr::IfaceListIter ifiter = std::find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \
1.54 + HookManagerInfo::VfnPtr::IfaceListIter ifiter = ms_HI->find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \
1.55 if (ifiter == vfnptr.ifaces.end()) \
1.56 { \
1.57 /* The iface info was not found. Redirect the call to the original function. */ \
1.58 @@ -486,8 +486,8 @@
1.59 } \
1.60 HookManagerInfo::VfnPtr::Iface &ci = *ifiter; \
1.61 /* 2) Declare some vars and set it up */ \
1.62 - std::list<HookManagerInfo::VfnPtr::Iface::Hook> &prelist = ci.hooks_pre; \
1.63 - std::list<HookManagerInfo::VfnPtr::Iface::Hook> &postlist = ci.hooks_post; \
1.64 + SourceHook::List<HookManagerInfo::VfnPtr::Iface::Hook> &prelist = ci.hooks_pre; \
1.65 + SourceHook::List<HookManagerInfo::VfnPtr::Iface::Hook> &postlist = ci.hooks_post; \
1.66 rettype orig_ret; \
1.67 rettype override_ret; \
1.68 rettype plugin_ret; \
1.69 @@ -501,7 +501,7 @@
1.70
1.71 #define SH_CALL_HOOKS(post, params) \
1.72 prev_res = MRES_IGNORED; \
1.73 - for (std::list<HookManagerInfo::VfnPtr::Iface::Hook>::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \
1.74 + for (SourceHook::List<HookManagerInfo::VfnPtr::Iface::Hook>::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \
1.75 { \
1.76 if (hiter->paused) continue; \
1.77 cur_res = MRES_IGNORED; \
1.78 @@ -544,7 +544,7 @@
1.79 void *ourvfnptr = reinterpret_cast<void*>( \
1.80 *reinterpret_cast<void***>(reinterpret_cast<char*>(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \
1.81 \
1.82 - HookManagerInfo::VfnPtrListIter vfptriter = std::find(ms_HI->vfnptrs.begin(), \
1.83 + HookManagerInfo::VfnPtrListIter vfptriter = ms_HI->find(ms_HI->vfnptrs.begin(), \
1.84 ms_HI->vfnptrs.end(), ourvfnptr); \
1.85 if (vfptriter == ms_HI->vfnptrs.end()) \
1.86 { \
1.87 @@ -553,7 +553,7 @@
1.88 } \
1.89 HookManagerInfo::VfnPtr &vfnptr = *vfptriter; \
1.90 /* 2) Find the iface */ \
1.91 - HookManagerInfo::VfnPtr::IfaceListIter ifiter = std::find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \
1.92 + HookManagerInfo::VfnPtr::IfaceListIter ifiter = ms_HI->find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \
1.93 if (ifiter == vfnptr.ifaces.end()) \
1.94 { \
1.95 /* The iface info was not found. Redirect the call to the original function. */ \
1.96 @@ -564,8 +564,8 @@
1.97 } \
1.98 HookManagerInfo::VfnPtr::Iface &ci = *ifiter; \
1.99 /* 2) Declare some vars and set it up */ \
1.100 - std::list<HookManagerInfo::VfnPtr::Iface::Hook> &prelist = ci.hooks_pre; \
1.101 - std::list<HookManagerInfo::VfnPtr::Iface::Hook> &postlist = ci.hooks_post; \
1.102 + SourceHook::List<HookManagerInfo::VfnPtr::Iface::Hook> &prelist = ci.hooks_pre; \
1.103 + SourceHook::List<HookManagerInfo::VfnPtr::Iface::Hook> &postlist = ci.hooks_post; \
1.104 META_RES &cur_res = SH_GLOB_SHPTR->GetCurResRef(); \
1.105 META_RES &prev_res = SH_GLOB_SHPTR->GetPrevResRef(); \
1.106 META_RES &status = SH_GLOB_SHPTR->GetStatusRef(); \
1.107 @@ -575,7 +575,7 @@
1.108
1.109 #define SH_CALL_HOOKS_void(post, params) \
1.110 prev_res = MRES_IGNORED; \
1.111 - for (std::list<HookManagerInfo::VfnPtr::Iface::Hook>::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \
1.112 + for (SourceHook::List<HookManagerInfo::VfnPtr::Iface::Hook>::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \
1.113 { \
1.114 if (hiter->paused) continue; \
1.115 cur_res = MRES_IGNORED; \
1.116 @@ -686,8 +686,8 @@
1.117 using namespace ::SourceHook; \
1.118 MemFuncInfo mfi; \
1.119 GetFuncInfo(m_CC->ptr, m_MFP, mfi); \
1.120 - OrigVTables::const_iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \
1.121 - if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->second.size() || iter->second[mfi.vtblindex] == NULL) \
1.122 + OrigVTables::iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \
1.123 + if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->val.size() || iter->val[mfi.vtblindex] == NULL) \
1.124 return (m_CC->ptr->*m_MFP)call; \
1.125 \
1.126 /* It's hooked. Call the original function. */ \
1.127 @@ -696,7 +696,7 @@
1.128 RetType(EmptyClass::*mfpnew)prms; \
1.129 void *addr; \
1.130 } u; \
1.131 - u.addr = iter->second[mfi.vtblindex]; \
1.132 + u.addr = iter->val[mfi.vtblindex]; \
1.133 \
1.134 void *adjustedthisptr = reinterpret_cast<void*>(reinterpret_cast<char*>(m_CC->ptr) + mfi.thisptroffs); \
1.135 return (reinterpret_cast<EmptyClass*>(adjustedthisptr)->*u.mfpnew)call; \
1.136 @@ -709,8 +709,8 @@
1.137 using namespace ::SourceHook; \
1.138 MemFuncInfo mfi; \
1.139 GetFuncInfo(m_CC->ptr, m_MFP, mfi); \
1.140 - OrigVTables::const_iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \
1.141 - if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->second.size() || iter->second[mfi.vtblindex] == NULL) \
1.142 + OrigVTables::iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \
1.143 + if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->val.size() || iter->val[mfi.vtblindex] == NULL) \
1.144 return (m_CC->ptr->*m_MFP)call; \
1.145 \
1.146 /* It's hooked. Call the original function. */ \
1.147 @@ -723,7 +723,7 @@
1.148 intptr_t adjustor; \
1.149 } s; \
1.150 } u; \
1.151 - u.s.addr = iter->second[mfi.vtblindex]; \
1.152 + u.s.addr = iter->val[mfi.vtblindex]; \
1.153 u.s.adjustor = mfi.thisptroffs; \
1.154 \
1.155 return (reinterpret_cast<EmptyClass*>(m_CC->ptr)->*u.mfpnew)call; \