⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l3_port.h

📁 此为破解装载器一书中的源代码,在看雪论坛下载的,
💻 H
字号:
#ifndef _INCLUDED_L3_PORT_H#define _INCLUDED_L3_PORT_H// *L3 Libraries portability issues* Copyright (C) Krzysztof Bosak, 1999-10-02...2001-02-13.// All rights reserved.// kbosak@box43.pl// http://www.kbosak.prv.pl/////////////////////////////////////////////////////////////////////////////#include <stdio.h>#define PLATFORM_HAS_FILESYSTEM/////////////////////////////////////////////////////////////////////////////#ifdef _MSC_VER	#define inline __forceinline // Nice trick with Visual C++#endif/////////////////////////////////////////////////////////////////////////////// When there are no assertions:#ifdef UNDER_CE	#if UNDER_CE==300  // no assert.h header, but assert macro is defined sometimes inside STL, we define it here explicitly		#define assert(exp) if(!(exp)) {fprintf(stderr, "Internal problem in file %s at line %d\n", __FILE__, __LINE__);exit(1);}	#else		#include <assert.h>	#endif#else	#include <assert.h>#endif/////////////////////////////////////////////////////////////////////////////#ifdef UNDER_CE	#include "l3_miniiostream.h" // Replacement for iostream.h and fstream.h#else		#ifdef _MSC_VER		#if (_MSC_VER >= 1310) // Visual C++ .NET (7.1)			#include <iostream>			using namespace std;// OpenWatcom 1.2 hates this line.		#else			#include <iostream.h>		#endif	#else		#include <iostream.h>	#endif		#ifdef PLATFORM_HAS_FILESYSTEM		#ifdef _MSC_VER			#if (_MSC_VER >= 1310) // Visual C++ .NET (7.1)				#include <fstream>				using namespace std;// OpenWatcom 1.2 hates this line.			#else				#include <fstream.h>			#endif		#else			#include <fstream.h>		#endif	#endif // PLATFORM_HAS_FILESYSTEM#endif/////////////////////////////////////////////////////////////////////////////// KAI KCC v. 4.0-d1 and Bloodshed Dev-C++// (MINGW gcc 3.2, DJGPP gcc 3.23, Metrowerks CodeWarrior 8.0 (IDEv5))// compilers offer no separate flag ios::nocreate// (but MS Visual C++ needs this flag explicitly// while the ISO standard tells us nothing about this case!):/*__KAI_IOS__MINGW__MWERKS____DJGPP*/#ifdef _MSC_VER	#if (_MSC_VER >= 1310) // Visual C++ .NET (7.1)		#define nocreate in	#endif#else	#define nocreate in#endif/////////////////////////////////////////////////////////////////////////////// DEC CXX v. 6.1 compiler hasn't ios::binary nor ios::bin:#ifdef __DECCXX	#define binary out#endif/////////////////////////////////////////////////////////////////////////////// When explicit keyword is not supported://#define explicit/////////////////////////////////////////////////////////////////////////////// When bool type is not present://typedef char bool; const bool true=1, false=0;//////////////////////////////////////////////////////////////////////////////*// When there are no C++ casts:template <class target>class c_style_emulated_cast{private:	const target _data;public:	template <class source>	inline explicit c_style_emulated_cast(source data): _data((target)data)	{	}	inline operator target() const	{		return _data;	}private:	c_style_emulated_cast& operator=(const c_style_emulated_cast&);// Forbidden.};#define static_cast c_style_emulated_cast#define const_cast c_style_emulated_cast#define reinterpret_cast c_style_emulated_cast//#define dynamic_cast c_style_emulated_cast*///////////////////////////////////////////////////////////////////////////////*// Replacement of safe arrays by STL std::vector<>:// Less safety, slower and much larger executable.#define _INCLUDED_L3_ARRAY_H#include <assert.h>#include <string.h>#include <limits.h>#include <stddef.h>//#include <valarray> // Broken with eMbedded Visual 4.0.#include <vector>template <class type>class autoarray: public std::vector<type>{public:	inline autoarray()	{	}	inline explicit autoarray(int len)		: std::vector<type>(len)	{	}	inline void setsize(int len)	{		resize(0);		reserve(len);		resize(len);	}	inline void fill(const type& value)	{		const int imax=size();		for(int i=0; i<imax; i++)			operator[](i)=value;	}};template <class type>class basearray: public std::vector<type>{public:	inline basearray()	{	}	inline explicit basearray(int len)		: std::vector<type>(len)	{	}	inline basearray(const type arr[], int len)		: std::vector<type>(len)	{		for(int i=0; i<len; i++)		{			operator[](i)=arr[i];		}	}	inline void erase()	{		type empty;		memset(&empty, 0, sizeof(type));		for(int i=0; i<size(); i++)		{			operator[](i)=empty;		}	}	inline void trim()	{	}	void reverse()	{		const int sb2=size()>>1;		for(int i1=0, i2=size()-1; i1<sb2; i1++, i2--)		{			const type temp=operator[](i1);			operator[](i1)=operator[](i2);			operator[](i2)=temp;		}	}	inline void setsize(int len)	{		resize(0);		reserve(len);		resize(len);	}	inline void fill(const type& value)	{		const int imax=size();		for(int i=0; i<imax; i++)			operator[](i)=value;	}};#define basearray_s basearray/////////////////////////////////////////////////////////////////////////////// Replacement of safe string by STL std::string:#define _INCLUDED_L3_STR_H#include <string>typedef std::string TextString;*//////////////////////////////////////////////////////////////////////////////#endif // _INCLUDED_L3_PORT_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -