📄 ansicpp.h
字号:
#ifndef ANSICPP_H#define ANSICPP_H// (c) Petr Mikulik (mikulik@sci.muni.cz) - 1994--1996// Freeware version. It is distributed without any warranty.#if defined(__EMX__) #define __OS2 #define __os2 #define __OS2__#endif#if !defined(__os2) && (defined(__os2__) || defined(__OS2__)) #define __os2#endif#if defined(__DECCXX) && !defined(__STDC__) #define __STDC__ // it is not defined on VMS, I'm wondering why...#endif#if defined(__MSDOS__) || defined(__OS2__) #define Petr "Petr Mikul\xA1k"#else #define Petr "Petr Mikulik"#endif#if defined(__MSDOS__) || defined(__OS2__) // you can stop the calculation by the ESC key on PC #define HIT_ESC_RETURN if (kbhit()&&(getch()==0x1B)) return;#else // do not define it elsewhere #define HIT_ESC_RETURN#endif// #define unsigned char byte#define word int#define TAB '\t'// Some macros for tracing (note: see <checks.h> in BC)#define OK cout << "LINE "<<__LINE__<<" is OK.\n" COUT_FLUSH;#define PMTRACE(x) cerr<<"TRACing "<<__FILE__<<", "<<__LINE__<<": "<<x<<endl;#define PMWARN(x) cerr<<"WARNing "<<__FILE__<<", "<<__LINE__<<": "<<x<<endl;#define PMCannotBeHere(text) cerr <<"Cannot be here! "<<__FILE__<<": "<<__LINE__<<" --- "<<text<<endl;void NotMemory ();void CannotBeHere ();void CannotBeHereExit ( int code=99 );extern int ansicpp_argc;extern char **ansicpp_argv; // access to the command line parameters // Usage: ansicpp_argc=argc; ansicpp_argv=argv; // just after int main ( int argc, char *argv[] ) #if defined(__TURBOC__) || defined(__WATCOMC__) // returns Path/Name of the executable file #define ExecName(Name,Sajz_t) strcpy(Name,ansicpp_argv[0])#endif#define ExecDir(Dir,Sajz_t,Slash) \ ExecName(Dir,Sajz_t); PathOfFileName(Dir,Dir,Slash);// returns directory where the exe file has been launched from#ifdef __GNUC__ // sure for gcc/emx #define ios_bin ios::bin#else #ifdef __BORLANDC__ // sure for Borland #define ios_bin ios::binary #else // and what about other compilers? Let us see... #define ios_bin ios::binary #endif#endif#if defined(__TURBOC__) && !defined(__STDC__) #define COUT_FLUSH #define CERR_FLUSH #define Protected protected #ifdef __OS2__ #define popen _popen #define pclose _pclose #define far // this became obsolete, DOS is dead: #define huge #endif #define WATCOM_RETURN0#else// You do not use Borland C++, use the rest of this file#if defined(__WATCOMC__) #define popen _popen #define pclose _pclose#endif#define COUT_FLUSH << flush#define CERR_FLUSH << flush#ifdef __GNUC__ // not implemented till 2.7.2 #define Protected public#else #define Protected protected#endif#ifdef __WATCOMC__ // Watcom C needs sth to be return even the exit(int) is called at the end // of a function, like int sum ( int a ) { exit(1); WATCOM_RETURN0 } #define WATCOM_RETURN0 return 0;#else #define WATCOM_RETURN0#endif#if 0/* Not needed anymore, use fileno(FILE*) instead// C to C++ conversion: handles name#if defined(__EMX__) #define Handle handle#elif defined(__BORLANDC__) #define Handle fd#else // Unix: either below, or open /dev/fdn, where n is handle number // The next is valid at least for gcc on SGI #define Handle _file#endif*/#endif#include <math.h>#include <float.h>#define far#define huge// maybe in ANSI C++ and certainly in DEC C++ compiler on VMS VAXstation#ifndef M_E#define M_E 2.71828182845904523536#endif#ifndef M_LOG2E#define M_LOG2E 1.44269504088896340736#endif#ifndef M_LOG10E#define M_LOG10E 0.434294481903251827651#endif#ifndef M_LN2#define M_LN2 0.693147180559945309417#endif#ifndef M_LN10#define M_LN10 2.30258509299404568402#endif#ifndef M_PI#define M_PI 3.14159265358979323846#endif#ifndef M_PI_2#define M_PI_2 1.57079632679489661923#endif#ifndef M_PI_4#define M_PI_4 0.785398163397448309616#endif#ifndef M_1_PI#define M_1_PI 0.318309886183790671538#endif#ifndef M_2_PI#define M_2_PI 0.636619772367581343076#endif#ifndef M_1_SQRTPI#define M_1_SQRTPI 0.564189583547756286948#endif#ifndef M_2_SQRTPI#define M_2_SQRTPI 1.12837916709551257390#endif#ifndef M_SQRT2#define M_SQRT2 1.41421356237309504880#endif#ifndef M_SQRT_2#define M_SQRT_2 0.707106781186547524401#endif#if !defined(__WATCOMC__) && !defined(__EMX__) // undefined by ANSI compilers. Surely: GCC 2.7.2/Linux; probably VMS char *strupr( char *s ); char *strlwr( char *s );#endif#if (defined(__GNUC__) && defined(__MSDOS__)) #include <conio.h> // these are in <pc.h> file (DJGPP) or <conio.h> // #define getch getkey // #define getche getkey#elif defined(__EMX__) #include <conio.h> // #define getch() _read_kbd (0, 1, 0) // #define getche() _read_kbd (1, 1, 0) #define kbhit() (_read_kbd (0,0,0)!=-1) // from <stdlib.h>#else int getch ( void ); int getche ( void ); int kbhit ( void );#endif#if defined(__EMX__) #define ExecName(Name,Sajz_t) _execname(Name,Sajz_t)#else #define ExecName(Name,Sajz_t) strcpy(Name,ansicpp_argv[0])#endif#if defined(__unix) || defined(__VMS) #define stricmp strcasecmp # at least Linux with gcc 2.7.2, and DEC CXX#endif#endif // option for the rest of this file#endif// eof ansicpp.h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -