matvar.c

来自「阵列信号处理的工具箱」· C语言 代码 · 共 117 行

C
117
字号
/******************************************************************************% RECVAR, A package for new data types in Matlab 4. % RECVAR was written by Svante Bj鰎klund.% (c) FOA 1997. See the file rvright.m for copyright notice.    Compile with:      cmex matvar.c      Start        : 95/12/11 Svante Bj鰎klund(svabj).    Latest change: $Date: 1997/08/01 18:13:08 $ $Author: svabj $. ******************************************************************************/#define V4_COMPAT	// Matlab kompatible with version 4.#include <string.h>	/* strcmp(), strncpy(), memcpy() */#include <stdlib.h>	/* calloc(), free() */#include <limits.h>	/* INT_MAX, SHRT_MAX */#include "mex.h"	/* Functions to use in mex-programs. */#include "mat.h"	/* Functions to handle Matlab matrices, 			   including mxSetDispMode() */static const char *rcsid = "$Id: matvar.c,v 2.12 1997/08/01 18:13:08 svabj Exp $";/* #define DYNAMIC_RECORDS */	/* If storing pointers to the fields in the 				   Matlab matrix */enum Boolown { FALSK, SANN };	/* V錼 bool-datatyp */typedef enum Boolown 	BoolT;#if defined(unix) || defined(__WIN32__) typedef int		Int32T; typedef short		Int16T; #define INT16T_MAX	SHRT_MAX typedef unsigned int	UInt32T; #define UINT32T_MAX	UINT_MAX typedef unsigned short	UInt16T; typedef unsigned char	UInt8T; typedef float		Float32T; typedef double		Float64T; #define StringT	string #define FPT #elif defined(__WATCOMC__) typedef long		Int32T; typedef short		Int16T; #define INT16T_MAX	SHRT_MAX typedef unsigned long	UInt32T; #define UINT32T_MAX	ULONG_MAX typedef unsigned short	UInt16T; typedef unsigned char	UInt8T; typedef float		Float32T; typedef double		Float64T; #define StringT	string #define FPT _far#else typedef long		Int32T; typedef short		Int16T; #define INT16T_MAX	SHRT_MAX typedef unsigned long	UInt32T; #define UINT32T_MAX	ULONG_MAX typedef unsigned short	UInt16T; typedef unsigned char	UInt8T; typedef float		Float32T; typedef double		Float64T; #define StringT	string #define FPT _far#endiftypedef unsigned long int ULIntT;#if defined(unix) || defined(__WIN32__)  typedef double FloatMatlabT;#else  typedef double FloatMatlabT;#endiftypedef FloatMatlabT* 	FloatMatlabPT;void assertFunktion(int test, int rad, char* fil, const char* msg){  if (!test)  {    mexPrintf("Assert error on line %d in file %s : %s\n", rad, fil, msg);  }}#define ASSERT_ON#ifdef ASSERT_ON  #define assert(test, msg) assertFunktion(test, __LINE__, __FILE__, msg)#else  #define assert(test, msg) 	#endifconst char* accessFieldErrMsg = "Trying to access invalid FieldHeadT.";const char* accessNullErrMsg = "Trying to access with NULL pointer.";#define TEXT    1                       /* mat.type indicating text */#define MATRIX  0                       /* mat.type indicating matrix */typedef Matrix* 	MatrixPT;typedef MatrixPT*	MatrixPPT;const   sizeOfFM = sizeof(FloatMatlabT);typedef UInt32T  SizeFMT;		/* For sizes in multiples of					   sizeof(FloatMatlabT) *//*****************************************************************************// Declarations for storing Matlab matrices in the pr-block of a Matlab Matrix.  *****************************************************************************//*=========================================================================//=========================================================================*/#define RECVARVERSION 3		     /* Om struct RecordHeadT eller 					struct FieldHeadT 鋘dras ska denna					siffra 鰇as. Sedan m錽te man testa p

⌨️ 快捷键说明

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