//
// MATLAB Compiler: 2.2
// Date: Wed Mar 10 16:44:48 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" "-p" "-W" "main" "-L"
// "Cpp" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-B" "sglcpp" "-p" "-W"
// "main" "-L" "Cpp" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
// "libmwsglm.mlib" "hier_community.m" "Default.m" "Stop_Simulation.m"
// "Call_SaveLoad_Fig.m" "SaveLoad_Fig.m" "SaveLoad.m" "Load_Population_Data.m"
// "Save_Population_Data.m" "Start_hier_community.m" "MyInline.m" "My_Eval.m"
// "isnumber.m" "Find_Var.m" "Change_Number_of_Populations.m"
// "Switch_Populations.m" "Store_Parameters.m" 
//
#include "title.hpp"
#include "libmatlbm.hpp"
#include "libmmfile.hpp"

static mxChar _array1_[128] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 't', 'i', 't', 'l', 'e',
                                ' ', 'L', 'i', 'n', 'e', ':', ' ', '1', ' ',
                                'C', 'o', 'l', 'u', 'm', 'n', ':', ' ', '1',
                                ' ', 'T', 'h', 'e', ' ', 'f', 'u', 'n', 'c',
                                't', 'i', 'o', 'n', ' ', '"', 't', 'i', 't',
                                'l', 'e', '"', ' ', 'w', 'a', 's', ' ', 'c',
                                'a', 'l', 'l', 'e', 'd', ' ', 'w', 'i', 't',
                                'h', ' ', 'm', 'o', 'r', 'e', ' ', 't', 'h',
                                'a', 'n', ' ', 't', 'h', 'e', ' ', 'd', 'e',
                                'c', 'l', 'a', 'r', 'e', 'd', ' ', 'n', 'u',
                                'm', 'b', 'e', 'r', ' ', 'o', 'f', ' ', 'o',
                                'u', 't', 'p', 'u', 't', 's', ' ', '(', '1',
                                ')', '.' };
static mwArray _mxarray0_ = mclInitializeString(128, _array1_);
static mwArray _mxarray2_ = mclInitializeDouble(2.0);

static mxChar _array4_[35] = { 'I', 'n', 'c', 'o', 'r', 'r', 'e', 'c', 't',
                               ' ', 'n', 'u', 'm', 'b', 'e', 'r', ' ', 'o',
                               'f', ' ', 'i', 'n', 'p', 'u', 't', ' ', 'a',
                               'r', 'g', 'u', 'm', 'e', 'n', 't', 's' };
static mwArray _mxarray3_ = mclInitializeString(35, _array4_);

static mxChar _array6_[14] = { 'M', 'W', 'B', 'Y', 'P', 'A', 'S',
                               'S', '_', 't', 'i', 't', 'l', 'e' };
static mwArray _mxarray5_ = mclInitializeString(14, _array6_);

static mxChar _array8_[5] = { 't', 'i', 't', 'l', 'e' };
static mwArray _mxarray7_ = mclInitializeString(5, _array8_);

static mxChar _array10_[9] = { 'F', 'o', 'n', 't', 'A', 'n', 'g', 'l', 'e' };
static mwArray _mxarray9_ = mclInitializeString(9, _array10_);

static mxChar _array12_[8] = { 'F', 'o', 'n', 't', 'N', 'a', 'm', 'e' };
static mwArray _mxarray11_ = mclInitializeString(8, _array12_);

static mxChar _array14_[8] = { 'F', 'o', 'n', 't', 'S', 'i', 'z', 'e' };
static mwArray _mxarray13_ = mclInitializeString(8, _array14_);

static mxChar _array16_[10] = { 'F', 'o', 'n', 't', 'W',
                                'e', 'i', 'g', 'h', 't' };
static mwArray _mxarray15_ = mclInitializeString(10, _array16_);

static mxChar _array18_[8] = { 'R', 'o', 't', 'a', 't', 'i', 'o', 'n' };
static mwArray _mxarray17_ = mclInitializeString(8, _array18_);
static mwArray _mxarray19_ = mclInitializeDouble(0.0);

static mxChar _array21_[6] = { 's', 't', 'r', 'i', 'n', 'g' };
static mwArray _mxarray20_ = mclInitializeString(6, _array21_);

void InitializeModule_title() {
}

void TerminateModule_title() {
}

static mwArray Mtitle(int nargout_, mwArray string, mwArray varargin);

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

//
// The function "Ntitle" contains the nargout interface for the "title"
// M-function from file "C:\MATLAB6p1\toolbox\matlab\graph2d\title.m" (lines
// 1-42). This interface is only produced if the M-function uses the special
// variable "nargout". The nargout interface allows the number of requested
// outputs to be specified via the nargout argument, as opposed to the normal
// interface which dynamically calculates the number of outputs based on the
// number of non-NULL inputs it receives. This function processes any input
// arguments and passes them to the implementation version of the function,
// appearing above.
//
mwArray Ntitle(int nargout, mwArray string, mwVarargin varargin) {
    mwArray hh(mclGetUninitializedArray());
    hh = Mtitle(nargout, string, varargin.ToArray());
    return hh;
}

//
// The function "title" contains the normal interface for the "title"
// M-function from file "C:\MATLAB6p1\toolbox\matlab\graph2d\title.m" (lines
// 1-42). This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
mwArray title(mwArray string, mwVarargin varargin) {
    int nargout(1);
    mwArray hh(mclGetUninitializedArray());
    hh = Mtitle(nargout, string, varargin.ToArray());
    return hh;
}

//
// The function "Vtitle" contains the void interface for the "title" M-function
// from file "C:\MATLAB6p1\toolbox\matlab\graph2d\title.m" (lines 1-42). The
// void interface is only produced if the M-function uses the special variable
// "nargout", and has at least one output. The void interface function
// specifies zero output arguments to the implementation version of the
// function, and in the event that the implementation version still returns an
// output (which, in MATLAB, would be assigned to the "ans" variable), it
// deallocates the output. This function processes any input arguments and
// passes them to the implementation version of the function, appearing above.
//
void Vtitle(mwArray string, mwVarargin varargin) {
    mwArray hh(mwArray::UNDEFINED);
    hh = Mtitle(0, string, varargin.ToArray());
}

//
// The function "mlxTitle" contains the feval interface for the "title"
// M-function from file "C:\MATLAB6p1\toolbox\matlab\graph2d\title.m" (lines
// 1-42). The feval function calls the implementation version of title through
// this function. This function processes any input arguments and passes them
// to the implementation version of the function, appearing above.
//
void mlxTitle(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    MW_BEGIN_MLX();
    {
        mwArray mprhs[2];
        mwArray mplhs[1];
        int i;
        mclCppUninitializeArrays(1, mplhs);
        if (nlhs > 1) {
            error(_mxarray0_);
        }
        for (i = 0; i < 1 && i < nrhs; ++i) {
            mprhs[i] = mwArray(prhs[i], 0);
        }
        for (; i < 1; ++i) {
            mprhs[i].MakeDIN();
        }
        mprhs[1] = mclCreateVararginCell(nrhs - 1, prhs + 1);
        mplhs[0] = Mtitle(nlhs, mprhs[0], mprhs[1]);
        plhs[0] = mplhs[0].FreezeData();
    }
    MW_END_MLX();
}

//
// The function "Mtitle" is the implementation version of the "title"
// M-function from file "C:\MATLAB6p1\toolbox\matlab\graph2d\title.m" (lines
// 1-42). 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 hh = title(string,varargin)
//
static mwArray Mtitle(int nargout_, mwArray string, mwArray varargin) {
    mwLocalFunctionTable save_local_function_table_
      (&_local_function_table_title);
    int nargin_(nargin(-2, mwVarargin(string, varargin)));
    mwArray hh(mclGetUninitializedArray());
    mwArray h(mclGetUninitializedArray());
    mwArray ax(mclGetUninitializedArray());
    mwArray ans(mclGetUninitializedArray());
    //
    // %TITLE  Graph title.
    // %   TITLE('text') adds text at the top of the current axis.
    // %
    // %   TITLE('text','Property1',PropertyValue1,'Property2',PropertyValue2,...)
    // %   sets the values of the specified properties of the title.
    // %
    // %   H = TITLE(...) returns the handle to the text object used as the title.
    // %
    // %   See also XLABEL, YLABEL, ZLABEL, TEXT.
    // 
    // %   Copyright 1984-2001 The MathWorks, Inc. 
    // %   $Revision: 5.13 $  $Date: 2001/04/15 12:00:42 $
    // 
    // if nargin > 1 & (nargin-1)/2-fix((nargin-1)/2),
    //
    mwArray a_(nargin_ > 1);
    if (tobool(a_)
        && tobool(
             a_
             & (nargin_ - 1) / _mxarray2_
               - mwVe(fix((nargin_ - 1) / _mxarray2_)))) {
        //
        // error('Incorrect number of input arguments')
        //
        error(_mxarray3_);
    } else {
    }
    //
    // end
    // 
    // ax = gca;
    //
    ax = gca(mwArray::DIN);
    //
    // 
    // %---Check for bypass option
    // if isappdata(ax,'MWBYPASS_title')       
    //
    if (tobool(mwVe(isappdata(mwVv(ax, "ax"), _mxarray5_)))) {
        //
        // h = mwbypass(ax,'MWBYPASS_title',string,varargin{:});
        //
        h
          = Ngraph2d_private_mwbypass(
              1,
              mwVv(ax, "ax"),
              _mxarray5_,
              mwVarargin(
                mwVa(string, "string"),
                mwVe(mwVsa(varargin, "varargin").cell(colon()))));
    //
    // 
    // %---Standard behavior      
    // else
    //
    } else {
        //
        // h = get(ax,'title');
        //
        h = Nget(1, mwVarargin(mwVv(ax, "ax"), _mxarray7_));
        //
        // 
        // %Over-ride text objects default font attributes with
        // %the Axes' default font attributes.
        // set(h, 'FontAngle',  get(ax, 'FontAngle'), ...
        //
        ans.EqAns(
          Nset(
            0,
            mwVarargin(
              mwVv(h, "h"),
              _mxarray9_,
              mwVe(Nget(1, mwVarargin(mwVv(ax, "ax"), _mxarray9_))),
              _mxarray11_,
              mwVe(Nget(1, mwVarargin(mwVv(ax, "ax"), _mxarray11_))),
              _mxarray13_,
              mwVe(Nget(1, mwVarargin(mwVv(ax, "ax"), _mxarray13_))),
              _mxarray15_,
              mwVe(Nget(1, mwVarargin(mwVv(ax, "ax"), _mxarray15_))),
              _mxarray17_,
              _mxarray19_,
              _mxarray20_,
              mwVa(string, "string"),
              mwVe(mwVsa(varargin, "varargin").cell(colon())))));
    //
    // 'FontName',   get(ax, 'FontName'), ...
    // 'FontSize',   get(ax, 'FontSize'), ...
    // 'FontWeight', get(ax, 'FontWeight'), ...
    // 'Rotation',   0, ...
    // 'string',     string, varargin{:});
    // end
    //
    }
    //
    // 
    // if nargout > 0
    //
    if (nargout_ > 0) {
        //
        // hh = h;
        //
        hh = mwVsv(h, "h");
    //
    // end
    //
    }
    mwValidateOutput(hh, 1, nargout_, "hh", "title");
    return hh;
}
