📄 common.h
字号:
/********************************************************************************* common.h: an include file containing general type definitions, macros,** and inline functions used in the other modules.**** Copyright (C) 1995 by Dani Lischinski **** This program is free software; you can redistribute it and/or modify** it under the terms of the GNU General Public License as published by** the Free Software Foundation; either version 2 of the License, or** (at your option) any later version.**** This program is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the** GNU General Public License for more details.**** You should have received a copy of the GNU General Public License** along with this program; if not, write to the Free Software** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.********************************************************************************/#ifndef COMMON_H#define COMMON_H#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endif#ifndef ON#define ON 1#define OFF 0#endif#define NIL(type) ((type*)0)#ifndef MAX#define MAX(a, b) ((a) >= (b) ? (a) : (b))#define MIN(a, b) ((a) <= (b) ? (a) : (b))#endif#ifndef ABS#define ABS(a) ((a) >= 0 ? (a) : -(a))#endif#define SGN(a) ((a) > 0 ? 1 : ((a) < 0 ? -1 : 0))#define forever for(;;)typedef int Boolean;typedef int Switch;typedef float Sreal;typedef double Lreal;typedef char * charPtr;inline int max(int a, int b){ return (a >= b) ? a : b;}inline int min(int a, int b){ return (a < b) ? a : b;}inline int max(int a, int b, int c){ return (a >= b) ? (a >= c ? a : c) : (b >= c ? b : c);}inline int min(int a, int b, int c){ return (a < b) ? (a < c ? a : c) : (b < c ? b : c);}inline float max(float a, float b){ return (a >= b) ? a : b;}inline float min(float a, float b){ return (a < b) ? a : b;}inline float max(float a, float b, float c){ return (a >= b) ? (a >= c ? a : c) : (b >= c ? b : c);}inline float min(float a, float b, float c){ return (a < b) ? (a < c ? a : c) : (b < c ? b : c);}inline double max(double a, double b){ return (a >= b) ? a : b;}inline double min(double a, double b){ return (a < b) ? a : b;}inline double max(double a, double b, double c){ return (a >= b) ? (a >= c ? a : c) : (b >= c ? b : c);}inline double min(double a, double b, double c){ return (a < b) ? (a < c ? a : c) : (b < c ? b : c);}inline int imin(double a, double b, double c){ return (a < b) ? (a < c ? 0 : 2) : (b < c ? 1 : 2);}#include <stdlib.h>#include <stream.h>#include <assert.h>#ifdef NDEBUG# define Assert(e) (void(0))# define Warning(msg) (void(0))# define Error(msg) (void(0))#else# define Assert(e) assert(e)# define Warning(msg) \ (cerr << "Warning: " << msg \ << ", file " << __FILE__ \ << ", line " << __LINE__ << "\n")# define Error(msg) \ ((cerr << "Error: " << msg \ << ", file " << __FILE__ \ << ", line " << __LINE__ << "\n"), exit(1))#endif#define Abort(msg) \ ((cerr << "Fatal Error: " << msg \ << ", file " << __FILE__ \ << ", line " << __LINE__ << "\n"), abort()) #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -