📄 isvarname.cpp
字号:
//
// MATLAB Compiler: 3.0
// Date: Wed Jul 14 12:15:03 2004
// Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
// "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
// "array_indexing:on" "-O" "optimize_conditionals:on" "-B" "sglcpp" "-p" "-W"
// "main" "-L" "Cpp" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
// "libmwsglm.mlib" "QQchabu.m"
//
#include "isvarname.hpp"
#include "iskeyword.hpp"
#include "libmatlbm.hpp"
static mwArray _mxarray0_ = mclInitializeDouble(1.0);
static mxChar _array2_[1] = { '_' };
static mwArray _mxarray1_ = mclInitializeString(1, _array2_);
static mxChar _array4_[1] = { '0' };
static mwArray _mxarray3_ = mclInitializeString(1, _array4_);
static mxChar _array6_[1] = { '9' };
static mwArray _mxarray5_ = mclInitializeString(1, _array6_);
void InitializeModule_isvarname() {
}
void TerminateModule_isvarname() {
}
static mwArray Misvarname(int nargout_, mwArray s);
_mexLocalFunctionTable _local_function_table_isvarname
= { 0, (mexFunctionTableEntry *)NULL };
//
// The function "isvarname" contains the normal interface for the "isvarname"
// M-function from file "e:\matlab6.5\toolbox\matlab\lang\isvarname.m" (lines
// 1-17). This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
mwArray isvarname(mwArray s) {
int nargout = 1;
mwArray t = mwArray::UNDEFINED;
t = Misvarname(nargout, s);
return t;
}
//
// The function "mlxIsvarname" contains the feval interface for the "isvarname"
// M-function from file "e:\matlab6.5\toolbox\matlab\lang\isvarname.m" (lines
// 1-17). The feval function calls the implementation version of isvarname
// through this function. This function processes any input arguments and
// passes them to the implementation version of the function, appearing above.
//
void mlxIsvarname(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
MW_BEGIN_MLX();
{
mwArray mprhs[1];
mwArray mplhs[1];
int i;
mclCppUndefineArrays(1, mplhs);
if (nlhs > 1) {
error(
mwVarargin(
mwArray(
"Run-time Error: File: isvarname Line: 1 Column: "
"1 The function \"isvarname\" was called with mor"
"e than the declared number of outputs (1).")));
}
if (nrhs > 1) {
error(
mwVarargin(
mwArray(
"Run-time Error: File: isvarname Line: 1 Column:"
" 1 The function \"isvarname\" was called with m"
"ore than the declared number of inputs (1).")));
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = mwArray(prhs[i], 0);
}
for (; i < 1; ++i) {
mprhs[i].MakeDIN();
}
mplhs[0] = Misvarname(nlhs, mprhs[0]);
plhs[0] = mplhs[0].FreezeData();
}
MW_END_MLX();
}
//
// The function "Misvarname" is the implementation version of the "isvarname"
// M-function from file "e:\matlab6.5\toolbox\matlab\lang\isvarname.m" (lines
// 1-17). It contains the actual compiled code for that M-function. It is a
// static function and must only be called from one of the interface functions,
// appearing below.
//
//
// function t = isvarname(s)
//
static mwArray Misvarname(int nargout_, mwArray s) {
mwLocalFunctionTable save_local_function_table_
= &_local_function_table_isvarname;
mwArray t = mwArray::UNDEFINED;
//
// %ISVARNAME True for valid variable name.
// % ISVARNAME(S) is true if S is a valid MATLAB variable name.
// % A valid variable name is a character string of letters, digits and
// % underscores, with length <= namelengthmax and the first character a letter.
// %
// % See also ISKEYWORD, NAMELENGTHMAX.
//
// % Copyright 1984-2002 The MathWorks, Inc.
// % $Revision: 1.7 $ $Date: 2002/04/26 03:56:46 $
//
// t = ischar(s) & size(s,1) == 1 & length(s) <= namelengthmax;
//
t
= ischar(mwVa(s, "s"))
& size(mwValueVarargout(), mwVa(s, "s"), _mxarray0_) == _mxarray0_
& mclLengthInt(mwVa(s, "s")) <= 63;
//
// if t
//
if (tobool(mwVv(t, "t"))) {
//
// t = isletter(s(1)) & all(isletter(s) | s == '_' | ('0' <= s & s <= '9'));
//
t
= isletter(mclIntArrayRef(mwVa(s, "s"), 1))
& all(
isletter(mwVa(s, "s")) | mwVa(s, "s") == _mxarray1_
| _mxarray3_ <= mwVa(s, "s") & mwVa(s, "s") <= _mxarray5_);
//
// t = t & ~iskeyword(s);
//
t = mwVv(t, "t") & ~ iskeyword(mwVa(s, "s"));
//
// end
//
}
mwValidateOutput(t, 1, nargout_, "t", "isvarname");
return t;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -