⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iptgetpref.cpp

📁 matlab的可执行程序
💻 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 "iptgetpref.hpp"
#include "images_private_iptprefs.hpp"
#include "images_private_iptregistry_mex_interface.hpp"
#include "libmatlbm.hpp"
#include "libmmfile.hpp"
static mwArray _mxarray0_ = mclInitializeDouble(0.0);
static mwArray _mxarray1_ = mclInitializeDouble(1.0);
static mwArray _mxarray2_ = mclInitializeCellVector(0, 0, (mxArray * *)NULL);
static mwArray _mxarray3_ = mclInitializeDoubleVector(0, 0, (double *)NULL);

static mxChar _array5_[5] = { 'e', 'x', 'a', 'c', 't' };
static mwArray _mxarray4_ = mclInitializeString(5, _array5_);
static mwArray _mxarray6_ = mclInitializeDouble(3.0);

static mxChar _array8_[4] = { 'c', 'h', 'a', 'r' };
static mwArray _mxarray7_ = mclInitializeString(4, _array8_);

static mxChar _array10_[33] = { 'P', 'r', 'e', 'f', 'e', 'r', 'e', 'n', 'c',
                                'e', ' ', 'n', 'a', 'm', 'e', ' ', 'm', 'u',
                                's', 't', ' ', 'b', 'e', ' ', 'a', ' ', 's',
                                't', 'r', 'i', 'n', 'g', '.' };
static mwArray _mxarray9_ = mclInitializeString(33, _array10_);

static mxChar _array12_[49] = { 'U', 'n', 'k', 'n', 'o', 'w', 'n', ' ', 'I',
                                'm', 'a', 'g', 'e', ' ', 'P', 'r', 'o', 'c',
                                'e', 's', 's', 'i', 'n', 'g', ' ', 'T', 'o',
                                'o', 'l', 'b', 'o', 'x', ' ', 'p', 'r', 'e',
                                'f', 'e', 'r', 'e', 'n', 'c', 'e', ' ', '"',
                                '%', 's', '"', '.' };
static mwArray _mxarray11_ = mclInitializeString(49, _array12_);

static mxChar _array14_[51] = { 'A', 'm', 'b', 'i', 'g', 'u', 'o', 'u', 's',
                                ' ', 'I', 'm', 'a', 'g', 'e', ' ', 'P', 'r',
                                'o', 'c', 'e', 's', 's', 'i', 'n', 'g', ' ',
                                'T', 'o', 'o', 'l', 'b', 'o', 'x', ' ', 'p',
                                'r', 'e', 'f', 'e', 'r', 'e', 'n', 'c', 'e',
                                ' ', '"', '%', 's', '"', '.' };
static mwArray _mxarray13_ = mclInitializeString(51, _array14_);

void InitializeModule_iptgetpref() {
}

void TerminateModule_iptgetpref() {
}

static mwArray Miptgetpref(int nargout_, mwArray prefName);

_mexLocalFunctionTable _local_function_table_iptgetpref
  = { 0, (mexFunctionTableEntry *)NULL };

//
// The function "iptgetpref" contains the normal interface for the "iptgetpref"
// M-function from file "e:\matlab6.5\toolbox\images\images\iptgetpref.m"
// (lines 1-84). This function processes any input arguments and passes them to
// the implementation version of the function, appearing above.
//
mwArray iptgetpref(mwArray prefName) {
    int nargout = 1;
    mwArray value = mwArray::UNDEFINED;
    value = Miptgetpref(nargout, prefName);
    return value;
}

//
// The function "mlxIptgetpref" contains the feval interface for the
// "iptgetpref" M-function from file
// "e:\matlab6.5\toolbox\images\images\iptgetpref.m" (lines 1-84). The feval
// function calls the implementation version of iptgetpref through this
// function. This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
void mlxIptgetpref(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: iptgetpref Line: 1 Column:"
                  " 1 The function \"iptgetpref\" was called with m"
                  "ore than the declared number of outputs (1).")));
        }
        if (nrhs > 1) {
            error(
              mwVarargin(
                mwArray(
                  "Run-time Error: File: iptgetpref Line: 1 Column:"
                  " 1 The function \"iptgetpref\" 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] = Miptgetpref(nlhs, mprhs[0]);
        plhs[0] = mplhs[0].FreezeData();
    }
    MW_END_MLX();
}

//
// The function "Miptgetpref" is the implementation version of the "iptgetpref"
// M-function from file "e:\matlab6.5\toolbox\images\images\iptgetpref.m"
// (lines 1-84). 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 value = iptgetpref(prefName)
//
static mwArray Miptgetpref(int nargout_, mwArray prefName) {
    mwLocalFunctionTable save_local_function_table_
      = &_local_function_table_iptgetpref;
    int nargin_ = nargin(1, mwVarargin(prefName));
    mwArray value = mwArray::UNDEFINED;
    mwArray preference = mwArray::UNDEFINED;
    mwArray matchIdx = mwArray::UNDEFINED;
    mwArray lowerNames = mwArray::UNDEFINED;
    mwArray registryContainsPreference = mwArray::UNDEFINED;
    mwArray thisField = mwArray::UNDEFINED;
    mwArray k = mwArray::UNDEFINED;
    mwArray registryFieldNames = mwArray::UNDEFINED;
    mwArray registryStruct = mwArray::UNDEFINED;
    mwArray allNames = mwArray::UNDEFINED;
    mwArray factoryPrefs = mwArray::UNDEFINED;
    mwArray ans = mwArray::UNDEFINED;
    //
    // %IPTGETPREF Get Image Processing Toolbox preference.
    // %   PREFS = IPTGETPREF without an input argument returns a structure
    // %   containing all the Image Processing Toolbox preferences with their
    // %   current values.  Each field in the structure has the name of an Image
    // %   Processing Toolbox preference.  See IPTSETPREF for a list.
    // %
    // %   VALUE = IPTGETPREF(PREFNAME) returns the value of the Image
    // %   Processing Toolbox preference specified by the string PREFNAME.  See
    // %   IPTSETPREF for a complete list of valid preference names.  Preference
    // %   names are not case-sensitive and can be abbreviated.
    // %
    // %   Example
    // %   -------
    // %       value = iptgetpref('ImshowAxesVisible')
    // %
    // %   See also IMSHOW, IPTSETPREF.
    // 
    // %   Copyright 1993-2003 The MathWorks, Inc.  
    // %   $Revision: 1.15 $  $Date: 2003/03/24 15:27:32 $
    // 
    // error(nargchk(0,1,nargin));
    //
    error(mwVarargin(nargchk(_mxarray0_, _mxarray1_, nargin_)));
    //
    // 
    // % Get IPT factory preference settings.
    // factoryPrefs = iptprefs;
    //
    factoryPrefs = images_private_iptprefs();
    //
    // allNames = factoryPrefs(:,1);
    //
    allNames
      = mclArrayRef(mwVv(factoryPrefs, "factoryPrefs"), colon(), _mxarray1_);
    //
    // 
    // % What is currently stored in the IPT registry?
    // registryStruct = iptregistry;
    //
    registryStruct
      = Nimages_private_iptregistry(0, mwValueVarargout(), mwVarargin());
    //
    // if (isempty(registryStruct))
    //
    if (tobool(isempty(mwVv(registryStruct, "registryStruct")))) {
        //
        // registryFieldNames = {};
        //
        registryFieldNames = _mxarray2_;
    //
    // else
    //
    } else {
        //
        // registryFieldNames = fieldnames(registryStruct);
        //
        registryFieldNames = fieldnames(mwVv(registryStruct, "registryStruct"));
    //
    // end
    //
    }
    //
    // 
    // if (nargin == 0)
    //
    if (nargin_ == 0) {
        //
        // % Display all current preference settings.
        // value = [];
        //
        value = _mxarray3_;
        //
        // for k = 1:length(allNames)
        //
        {
            int v_ = mclForIntStart(1);
            int e_ = mclLengthInt(mwVv(allNames, "allNames"));
            if (v_ > e_) {
                k = _mxarray3_;
            } else {
                //
                // thisField = allNames{k};
                // registryContainsPreference = length(strmatch(thisField, ...
                // registryFieldNames, 'exact')) > 0;
                // if (registryContainsPreference)
                // value = setfield(value, thisField, ...
                // getfield(registryStruct, thisField));
                // else
                // % Use default value
                // value = setfield(value, thisField, factoryPrefs{k,3}{1});
                // end
                // end
                //
                for (; ; ) {
                    thisField = mwVv(allNames, "allNames").cell(v_);
                    registryContainsPreference
                      = mclLengthInt(
                          strmatch(
                            mwVv(thisField, "thisField"),
                            mwVv(registryFieldNames, "registryFieldNames"),
                            _mxarray4_))
                        > 0;
                    if (tobool(
                          mwVv(
                            registryContainsPreference,
                            "registryContainsPreference"))) {
                        value
                          = setfield(
                              mwVv(value, "value"),
                              mwVarargin(
                                mwVv(thisField, "thisField"),
                                getfield(
                                  mwVv(registryStruct, "registryStruct"),
                                  mwVarargin(mwVv(thisField, "thisField")))));
                    } else {
                        value
                          = setfield(
                              mwVv(value, "value"),
                              mwVarargin(
                                mwVv(thisField, "thisField"),
                                mwVv(factoryPrefs, "factoryPrefs").cell(
                                  v_, _mxarray6_).cell(
                                  _mxarray1_)));
                    }
                    if (v_ == e_) {
                        break;
                    }
                    ++v_;
                }
                k = v_;
            }
        }
    //
    // 
    // else
    //
    } else {
        //
        // % Return specified setting.
        // if (~isa(prefName, 'char'))
        //
        if (mclNotBool(isa(mwVa(prefName, "prefName"), _mxarray7_))) {
            //
            // error('Preference name must be a string.');
            //
            error(mwVarargin(_mxarray9_));
        //
        // end
        //
        }
        //
        // 
        // % Convert factory preference names to lower case.
        // lowerNames = cell(size(allNames));
        //
        lowerNames
          = cell(
              mwVarargin(
                size(mwValueVarargout(), mwVv(allNames, "allNames"))));
        //
        // for k = 1:length(lowerNames)
        //
        {
            int v_ = mclForIntStart(1);
            int e_ = mclLengthInt(mwVv(lowerNames, "lowerNames"));
            if (v_ > e_) {
                k = _mxarray3_;
            } else {
                //
                // lowerNames{k} = lower(allNames{k});
                // end
                //
                for (; ; ) {
                    lowerNames.cell(v_)
                    = feval(
                        mwValueVarargout(),
                        mlxLower,
                        mwVarargin(mwVv(allNames, "allNames").cell(v_)));
                    if (v_ == e_) {
                        break;
                    }
                    ++v_;
                }
                k = v_;
            }
        }
        //
        // 
        // matchIdx = strmatch(lower(prefName), lowerNames);
        //
        matchIdx
          = strmatch(
              lower(mwVa(prefName, "prefName")),
              mwVv(lowerNames, "lowerNames"));
        //
        // if (isempty(matchIdx))
        //
        if (tobool(isempty(mwVv(matchIdx, "matchIdx")))) {
            //
            // error(sprintf(['Unknown Image Processing ' ...
            //
            error(
              mwVarargin(
                sprintf(_mxarray11_, mwVarargin(mwVa(prefName, "prefName")))));
        //
        // 'Toolbox preference "%s".'], prefName));
        // elseif (length(matchIdx) > 1)
        //
        } else if (mclLengthInt(mwVv(matchIdx, "matchIdx")) > 1) {
            //
            // error(sprintf(['Ambiguous Image Processing ' ...
            //
            error(
              mwVarargin(
                sprintf(_mxarray13_, mwVarargin(mwVa(prefName, "prefName")))));
        //
        // 'Toolbox preference "%s".'], prefName));
        // else
        //
        } else {
            //
            // preference = allNames{matchIdx};
            //
            preference
              = mwVv(allNames, "allNames").cell(mwVv(matchIdx, "matchIdx"));
        //
        // end
        //
        }
        //
        // 
        // registryContainsPreference = length(strmatch(preference, ...
        //
        registryContainsPreference
          = mclLengthInt(
              strmatch(
                mwVv(preference, "preference"),
                mwVv(registryFieldNames, "registryFieldNames"),
                _mxarray4_))
            > 0;
        //
        // registryFieldNames, 'exact')) > 0;
        // if (registryContainsPreference)
        //
        if (tobool(
              mwVv(registryContainsPreference, "registryContainsPreference"))) {
            //
            // value = getfield(registryStruct, preference);
            //
            value
              = getfield(
                  mwVv(registryStruct, "registryStruct"),
                  mwVarargin(mwVv(preference, "preference")));
        //
        // else
        //
        } else {
            //
            // value = factoryPrefs{matchIdx, 3}{1};
            //
            value
              = mwVv(factoryPrefs, "factoryPrefs").cell(
                  mwVv(matchIdx, "matchIdx"), _mxarray6_).cell(
                  _mxarray1_);
        //
        // end
        //
        }
    //
    // end
    //
    }
    mwValidateOutput(value, 1, nargout_, "value", "iptgetpref");
    return value;
    //
    // 
    //
}

⌨️ 快捷键说明

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