📄 general.h
字号:
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =// G E N E R A L P U R P O S E F U N C T I O N S// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =// > > > > C++ version 1.07 - 05/29/95 < < < <// Amir Said - amir@densis.fee.unicamp.br// University of Campinas (UNICAMP)// Campinas, SP 13081, Brazil// William A. Pearlman - pearlman@ecse.rpi.edu// Rensselaer Polytechnic Institute// Troy, NY 12180, USA// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Copyright (c) 1995 Amir Said & William A. Pearlman// This program is Copyright (c) by Amir Said & William A. Pearlman.// It may be freely redistributed in its entirety provided that this// copyright notice is not removed. It may not be sold for profit or// incorporated in commercial programs without the written permission// of the copyright holders. This program is provided as is, without any// express or implied warranty, without even the warranty of fitness// for a particular purpose.
/*
static const int NumbTap = 4;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline double Filter_L(const double * f, double * v)
{
return f[0] * v[0] +
f[1] * (v[1] + v[-1]) + f[2] * (v[2] + v[-2]) +
f[3] * (v[3] + v[-3]) + f[4] * (v[4] + v[-4]);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline double Filter_H(const double * f, double * v)
{
return f[0] * v[0] +
f[1] * (v[1] + v[-1]) + f[2] * (v[2] + v[-2]) +
f[3] * (v[3] + v[-3]);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void Reflection(double * h, double * t)
{
for (int i = 1; i <= NumbTap; i++) {
h[-i] = h[i]; t[i] = t[-i]; }
}
//------------------------------------------------------------------------
static const double T_LowPass[5] =
{ 8.526986790094022e-01, 3.774028556126537e-01, -1.106244044184226e-01, -2.384946501937986e-02, 3.782845550699535e-02 };
static const double T_HighPass[5] =
{ 7.884856164056651e-01, -4.180922732222124e-01, -4.068941760955867e-02, 6.453888262893856e-02, 0.0 };
static const double R_LowPass[5] =
{ 8.526986790094022e-01, 4.180922732222124e-01, -1.106244044184226e-01, -6.453888262893856e-02, 3.782845550699535e-02 };
static const double R_HighPass[5] =
{ 7.884856164056651e-01, -3.774028556126537e-01, -4.068941760955867e-02, 2.384946501937986e-02, 0.0 };
*/
// - - Control definition - - - - - - - - - - - - - - - - - - - - - - -#ifndef General_H#define General_H// - - Inclusion - - - - - - - - - - - - - - - - - - - - - - - - - - - -#include <math.h>#include <stdio.h>#include <stdlib.h>#undef abs// - - Type definitions - - - - - - - - - - - - - - - - - - - - - - - -#define boolean int#define true 1#define false 0typedef char Char_Line[80];typedef unsigned char byte;typedef unsigned long word;// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =// Macros// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =#define NEW_VECTOR(X,N,TYPE,MSG) Test_Pointer(X = new TYPE[N], MSG)#define CREATE_VECTOR(X,N,TYPE,MSG) TYPE * X = new TYPE[N];\ Test_Pointer(X, MSG)#define NEW_OBJECT(X,TYPE,MSG) Test_Pointer(X = new TYPE, MSG)#define CREATE_OBJECT(X,TYPE,MSG) TYPE * X = new TYPE;\ Test_Pointer(X, MSG)#define DELETE_VECTOR(X) delete [] X; X = NULL#define DELETE_OBJECT(X) delete X; X = NULL#define SWAP(X,Y,T) T = X; X = Y; Y = T// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =// Inline functions// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =inline int Min(int a, int b) { return (a < b ? a : b); }inline int Max(int a, int b) { return (a > b ? a : b); }inline long Round(double x) { return (x >= 0.0 ? long(x + 0.5) : long(x - 0.5)); }inline double Sqr(double x) { return x * x; }inline double dBW(double x) { return 4.34294481904 * log(x); }//10inline double dBW_inv(double x) { return exp(0.2302585093 * x); }// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =// Function prototypes// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =void Warning(char *);void Error(char *);void Test_Pointer(void * ptr, char * msg = NULL);void Pause(void);char * Input_Line(char * msg = NULL, char * res = NULL);int Input_Int(char *);double Input_double(char *);boolean Input_Answer(char *);FILE * Open_File(char * msg, char * mode);// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =// Definition of the class < Chronometer >// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =class Chronometer{ // . private data . . . . . . . . . . . . . . . . . . int stat; // chronometer status: 0 = off, 1 = on long mark, elp; // initial and elapsed time // . constructor . . . . . . . . . . . . . . . . . . public: Chronometer(void) { elp = stat = 0; } // . public functions . . . . . . . . . . . . . . . . void reset(void) { elp = stat = 0; } void start(char * s = NULL); void stop(void); double read(void); void display(char * s = NULL);}; // end definition of class < Chronometer >#endif// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =// end of file < General.H >
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -