Full Code of jonathf/matlab2cpp for AI

master b6e2cbaedb36 cached
151 files
627.2 KB
171.4k tokens
732 symbols
1 requests
Download .txt
Showing preview only (669K chars total). Download the full file or copy to clipboard to get everything.
Repository: jonathf/matlab2cpp
Branch: master
Commit: b6e2cbaedb36
Files: 151
Total size: 627.2 KB

Directory structure:
gitextract_dk9ut9qi/

├── .circleci/
│   └── config.yml
├── .coveragerc
├── .gitignore
├── LICENSE
├── PKG-INFO
├── README.rst
├── conftest.py
├── doc/
│   ├── previous_doc/
│   │   ├── Makefile
│   │   └── source/
│   │       ├── conf.py
│   │       ├── dev00_overview.rst
│   │       ├── dev01_qfuncs.rst
│   │       ├── dev02_tree.rst
│   │       ├── dev03_node.rst
│   │       ├── dev04_datatype.rst
│   │       ├── dev05_configure.rst
│   │       ├── dev06_collection.rst
│   │       ├── dev07_rules.rst
│   │       ├── dev08_supplement.rst
│   │       ├── dev09_testsuite.rst
│   │       ├── index.rst
│   │       ├── usr00_intro.rst
│   │       ├── usr01_interaction.rst
│   │       ├── usr02_datatype.rst
│   │       ├── usr03_rules.rst
│   │       └── usr04_node.rst
│   └── user_manual/
│       ├── Makefile
│       └── source/
│           ├── conf.py
│           ├── conf.py~
│           ├── dev00_overview.rst~
│           ├── index.rst
│           ├── index.rst~
│           ├── usr00_intro.rst~
│           ├── usr02_datatype.rst
│           ├── usr03_rules.rst
│           └── usr04_node.rst
├── requirements.txt
├── setup.cfg
├── setup.py
├── src/
│   └── matlab2cpp/
│       ├── __init__.py
│       ├── collection.py
│       ├── configure/
│       │   ├── __init__.py
│       │   ├── armadillo.py
│       │   ├── backends.py
│       │   ├── datatypes.py
│       │   ├── frontend.py
│       │   ├── funcs.py
│       │   └── reserved.py
│       ├── datatype.py
│       ├── frontend.py
│       ├── manual/
│       │   ├── __init__.py
│       │   ├── usr00_introduction.py
│       │   ├── usr01_interaction.py
│       │   ├── usr02_datatype.py
│       │   ├── usr03_rules.py
│       │   ├── usr04_node.py
│       │   └── usr05_installation.py
│       ├── matlab_types.py
│       ├── modify.py
│       ├── mwhos.py
│       ├── mwrapmat.py
│       ├── node/
│       │   ├── __init__.py
│       │   ├── backend.py
│       │   ├── frontend.py
│       │   ├── m2cpp.py
│       │   └── reference.py
│       ├── parser.py
│       ├── pyplot.py
│       ├── qfunctions.py
│       ├── rules/
│       │   ├── __init__.py
│       │   ├── _cell.py
│       │   ├── _char.py
│       │   ├── _code_block.py
│       │   ├── _cube.py
│       │   ├── _cx_cube.py
│       │   ├── _cx_double.py
│       │   ├── _cx_mat.py
│       │   ├── _cx_rowvec.py
│       │   ├── _cx_vec.py
│       │   ├── _double.py
│       │   ├── _expression.py
│       │   ├── _fcube.py
│       │   ├── _float.py
│       │   ├── _fmat.py
│       │   ├── _frowvec.py
│       │   ├── _func_lambda.py
│       │   ├── _func_return.py
│       │   ├── _func_returns.py
│       │   ├── _fvec.py
│       │   ├── _icube.py
│       │   ├── _imat.py
│       │   ├── _int.py
│       │   ├── _irowvec.py
│       │   ├── _ivec.py
│       │   ├── _mat.py
│       │   ├── _matrix.py
│       │   ├── _program.py
│       │   ├── _reserved.py
│       │   ├── _rowvec.py
│       │   ├── _size_t.py
│       │   ├── _string.py
│       │   ├── _struct.py
│       │   ├── _structs.py
│       │   ├── _ucube.py
│       │   ├── _umat.py
│       │   ├── _unknown.py
│       │   ├── _urowvec.py
│       │   ├── _uvec.py
│       │   ├── _uword.py
│       │   ├── _vec.py
│       │   ├── _verbatim.py
│       │   ├── armadillo.py
│       │   ├── assign.py
│       │   ├── cube.py
│       │   ├── function.py
│       │   ├── mat.py
│       │   ├── parallel.py
│       │   ├── rowvec.py
│       │   ├── variables.py
│       │   └── vec.py
│       ├── setpaths.py
│       ├── supplement/
│       │   ├── __init__.py
│       │   ├── functions.py
│       │   ├── includes.py
│       │   ├── structs.py
│       │   ├── suggests.py
│       │   └── verbatim.py
│       └── tree/
│           ├── __init__.py
│           ├── assign.py
│           ├── branches.py
│           ├── builder.py
│           ├── codeblock.py
│           ├── constants.py
│           ├── expression.py
│           ├── findend.py
│           ├── functions.py
│           ├── identify.py
│           ├── iterate.py
│           ├── misc.py
│           ├── suppliment.py
│           └── variables.py
└── test/
    ├── data/
    │   ├── function_reference.hpp
    │   ├── function_reference.m
    │   ├── function_reference_2.hpp
    │   ├── function_reference_2.m
    │   ├── fx_decon.cpp
    │   ├── fx_decon.m
    │   ├── fx_decon.m.py
    │   ├── simple_assignment.cpp
    │   └── simple_assignment.m
    ├── test_conversion.py
    └── test_simple_assignment.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .circleci/config.yml
================================================
version: 2
jobs:
    build:
        working_directory: ~/matlab2cpp
        docker:
            - image: circleci/python:2.7.14
        steps:
            - checkout
            - restore_cache:
                key: reqs-{{ checksum "requirements.txt" }}
            - run:
                name: "Install Python requirements"
                command: |
                    virtualenv venv
                    . venv/bin/activate
                    pip install -Ur requirements.txt
                    pip install -e .
            - save_cache:
                key: reqs-{{ checksum "requirements.txt" }}
                paths:
                    - venv
            - run:
                name: "Run tests"
                command: |
                    . venv/bin/activate
                    python setup.py test
            - run:
                name: "Coverage report"
                command: |
                    . venv/bin/activate
                    codecov


================================================
FILE: .coveragerc
================================================
[run]
branch = True
source = codecov

[report]
exclude_lines =
    coverage: ignore
    def __repr__
    raise NotImplementedError
    if __name__ == .__main__.:

ignore_errors = True
precision = 2
skip_covered = True
omit =
    doc/*
    test/*
    setup.py


================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/


================================================
FILE: LICENSE
================================================
Copyright (c) 2015, jonathf
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

* Neither the name of matlab2cpp nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.



================================================
FILE: PKG-INFO
================================================
Metadata-Version: 1.0
Name: matlab2cpp
Version: 0.2
Summary: A semi-automatic tool for converting Matlab to C++
Home-page: http://www.github.org/jonathf/matlab2cpp
Author: Jonathan Feinberg
Author-email: jonathan@feinberg.no
License: BSD
Description: UNKNOWN
Platform: Mac, Linux and Windows


================================================
FILE: README.rst
================================================
.. attention::

    Matlab2cpp er currently unmaintained. As a mainteiner this project ended up
    on the short end of the stick of what I unfortunatly have time for.

    Anyone who want to make changes to it, might do so. I am very open to
    a change in overship.

    I am sorry for the inconvinience.

    Jonathan

==========
Matlab2Cpp
==========

``matlab2cpp`` is a semi-automatic tool for converting code from Matlab to C++.

After installing, the ``matlab2cpp`` command line executable ``m2cpp`` will be
available in path that can be used to convert Matlab code.

Note that it is not meant as a complete tool for creating runnable C++ code.
For example, the `eval`-function can not be supported because there is no
general way to implement it in C++. Instead the program is a support tool,
which aims at speed up the conversion process as much as possible for a user
that needs to convert Matlab programs by hand anyway. The software does this by
converting the basic structures of the Matlab-program (functions, branches,
loops, etc.), adds variable declarations, and for some simple code, do
a complete translation. And any problem the program encounters during
conversion will be written in a log-file. From there manual conversions can be
done by hand.

Currently, the code will not convert the large library collection of functions
that Matlab currently possesses. However, there is no reason for the code not
to support these features in time. The extension library is easy to extend.

Installation
------------
Installation by running the ``pip`` command::

    pip install matlab2cpp

The source-to-source parser do not have any requirements beyond having Python
installed. However, the generated output does have a few requirements to be
compilable. They are as follows.

``C++11``
    Code produces follows the ``C++11`` standard.
``armadillo``
    Armadillo is a linear algebra library for the C++ language. The Armadillo
    library can be found at `http://arma.sourceforge.net`_. Some functionality
    in Armadillo rely on a math library like LAPACK, BLAS, OpenBLAS or MKL.
    When installing Armadillo, it will look for installed math libraries.

    If Armadillo is installed, the library can be linked with the link flag
    ``-l armadillo``. Armadillo can also be linked directly, see the ``FAQ`` at
    the Armadillo webpage for more information.

    I believe MKL is the fastest math library and it can be downloaded for free
    at `https://software.intel.com/en-us/articles/free-mkl`_.
``TBB``
    By inserting pragmas in the code, for loops can be marked by the user. The
    program can then either insert ``OpenMP`` or ``TBB`` code to parallelize
    the for loop. To compile ``TBB`` code, the ``TBB`` library has to be
    installed. See :ref:`parallel_flags` for more details.

An illustrating Example
-----------------------

Assuming Linux installation and `m2cpp` is available in path. Code works
analogous in Mac and Windows.

Consider a file `example.m` with the following content::

    function y=f(x)
        y = x+4
    end
    function g()
        x = [1,2,3]
        f(x)
    end

Run conversion on the file: ::

    $ m2cpp example.m

This will create two files: ``example.m.hpp`` and ``example.m.py``.

In ``example.m.hpp``, the translated C++ code is placed. It looks as follows::

    #include <armadillo>
    using namespace arma ;

    TYPE f(TYPE x)
    {
      TYPE y ;
      y = x+4 ;
      return y ;
    }

    void g()
    {
      TYPE x ;
      x = [1, 2, 3] ;
      f(x) ;
    }

Matlab doesn't declare variables explicitly, so m2cpp is unable to complete
the translation.  To create a full conversion, the variables must be declared.
Declarations can be done in the file ``example.m.py``. After the first run, it
will look as follows::

    # Supplement file
    #
    # Valid inputs:
    #
    # uint    int     float   double cx_double
    # uvec    ivec    fvec    vec    cx_vec
    # urowvec irowvec frowvec rowvec cx_rowvec
    # umat    imat    fmat    mat    cx_mat
    # ucube   icube   fcube   cube   cx_cube
    #
    # char    string  struct  structs func_lambda

    functions = {
      "f" : {
        "y" : "",
        "x" : "",
      },
      "g" : {
        "x" : "",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

In addition to defining includes at the bottom, it is possible to declare
variables manually by inserting type names into the respective empty strings.
However, some times it is possible to guess some of the variable types from
context.  To let the software try to guess variable types, run conversion with
the ``-s`` flag::

    $ m2cpp example.m -s

The file ``example.m.py`` will then automatically be populated with data types
from context::

    # ...

    functions = {
      "f" : {
        "y" : "irowvec",
        "x" : "irowvec",
      },
      "g" : {
        "x" : "irowvec",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

It will not always be successful and some of the types might in some cases be
wrong. It is therefore also possible to adjust these values manually at any
time.

Having run the conversion with the variables converted, creates a new output
for ``example.m.hpp``::

    #include <armadillo>
    using namespace arma ;

    irowvec f(irowvec x)
    {
      irowvec y ;
      y = x+4 ;
      return y ;
    }

    void g()
    {
      irowvec x ;
      int _x [] = [1, 2, 3] ;
      x = irowvec(_x, 3, false) ;
      f(x) ;
    }

This is valid and runnable C++ code. For such a small example, no manual
adjustments were necessary.


================================================
FILE: conftest.py
================================================
"""Global configuration."""
import os
import inspect
import shutil

import pytest
import matlab2cpp
from matlab2cpp import collection


@pytest.fixture(scope="session")
def workspace_folder(tmpdir_factory):
    """Create a temporary folder to perform tests from."""
    return str(tmpdir_factory.mktemp("workspace"))


@pytest.fixture(scope="function", autouse=True)
def workspace(workspace_folder, doctest_namespace):
    """Fill temporary folder for each test."""
    # move data to workspace:
    source = os.path.join(os.path.dirname(inspect.stack()[0][1]), "test", "data")
    if os.path.isdir(workspace_folder):
        shutil.rmtree(workspace_folder)
    shutil.copytree(source, workspace_folder)

    # add content to doctest namespace:
    doctest_namespace["workspace"] = workspace_folder
    doctest_namespace["matlab2cpp"] = matlab2cpp
    doctest_namespace["collection"] = collection

    # change to workspace:
    curdir = os.path.abspath(os.path.curdir)
    os.chdir(workspace_folder)

    yield workspace_folder

    # clean up:
    os.chdir(curdir)
    shutil.rmtree(workspace_folder)


================================================
FILE: doc/previous_doc/Makefile
================================================
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS    =
SPHINXBUILD   = sphinx-build
PAPER         =
BUILDDIR      = build

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif

# Internal variables.
PAPEROPT_a4     = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext

help:
	@echo "Please use \`make <target>' where <target> is one of"
	@echo "  html       to make standalone HTML files"
	@echo "  dirhtml    to make HTML files named index.html in directories"
	@echo "  singlehtml to make a single large HTML file"
	@echo "  pickle     to make pickle files"
	@echo "  json       to make JSON files"
	@echo "  htmlhelp   to make HTML files and a HTML help project"
	@echo "  qthelp     to make HTML files and a qthelp project"
	@echo "  applehelp  to make an Apple Help Book"
	@echo "  devhelp    to make HTML files and a Devhelp project"
	@echo "  epub       to make an epub"
	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
	@echo "  text       to make text files"
	@echo "  man        to make manual pages"
	@echo "  texinfo    to make Texinfo files"
	@echo "  info       to make Texinfo files and run them through makeinfo"
	@echo "  gettext    to make PO message catalogs"
	@echo "  changes    to make an overview of all changed/added/deprecated items"
	@echo "  xml        to make Docutils-native XML files"
	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
	@echo "  linkcheck  to check all external links for integrity"
	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
	@echo "  coverage   to run coverage check of the documentation (if enabled)"

clean:
	rm -rf $(BUILDDIR)/*

html:
	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
	@echo
	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

dirhtml:
	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
	@echo
	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

singlehtml:
	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
	@echo
	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

pickle:
	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
	@echo
	@echo "Build finished; now you can process the pickle files."

json:
	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
	@echo
	@echo "Build finished; now you can process the JSON files."

htmlhelp:
	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
	@echo
	@echo "Build finished; now you can run HTML Help Workshop with the" \
	      ".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
	@echo
	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/matlab2cpp.qhcp"
	@echo "To view the help file:"
	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/matlab2cpp.qhc"

applehelp:
	$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
	@echo
	@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
	@echo "N.B. You won't be able to view it unless you put it in" \
	      "~/Library/Documentation/Help or install it in your application" \
	      "bundle."

devhelp:
	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
	@echo
	@echo "Build finished."
	@echo "To view the help file:"
	@echo "# mkdir -p $$HOME/.local/share/devhelp/matlab2cpp"
	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/matlab2cpp"
	@echo "# devhelp"

epub:
	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
	@echo
	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

latex:
	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
	@echo
	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
	@echo "Run \`make' in that directory to run these through (pdf)latex" \
	      "(use \`make latexpdf' here to do that automatically)."

latexpdf:
	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
	@echo "Running LaTeX files through pdflatex..."
	$(MAKE) -C $(BUILDDIR)/latex all-pdf
	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

latexpdfja:
	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
	@echo "Running LaTeX files through platex and dvipdfmx..."
	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

text:
	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
	@echo
	@echo "Build finished. The text files are in $(BUILDDIR)/text."

man:
	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
	@echo
	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

texinfo:
	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
	@echo
	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
	@echo "Run \`make' in that directory to run these through makeinfo" \
	      "(use \`make info' here to do that automatically)."

info:
	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
	@echo "Running Texinfo files through makeinfo..."
	make -C $(BUILDDIR)/texinfo info
	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."

gettext:
	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
	@echo
	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."

changes:
	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
	@echo
	@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
	@echo
	@echo "Link check complete; look for any errors in the above output " \
	      "or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
	@echo "Testing of doctests in the sources finished, look at the " \
	      "results in $(BUILDDIR)/doctest/output.txt."

coverage:
	$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
	@echo "Testing of coverage in the sources finished, look at the " \
	      "results in $(BUILDDIR)/coverage/python.txt."

xml:
	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
	@echo
	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."

pseudoxml:
	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
	@echo
	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."


================================================
FILE: doc/previous_doc/source/conf.py
================================================
# -*- coding: utf-8 -*-
#
# matlab2cpp documentation build configuration file, created by
# sphinx-quickstart on Mon Jun  8 10:41:13 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shlex

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../..'))

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.

extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon",
    "sphinxcontrib.autoprogram", "sphinxarg.ext"]

napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = False
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'matlab2cpp'
copyright = u'2015, Jonathan Feinberg'
author = u'Jonathan Feinberg'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.5'
# The full version, including alpha/beta/rc tags.
release = '0.5'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []

# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = 'classic'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
#html_use_index = True

# If true, the index is split into individual pages for each letter.
html_split_index = True

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
#   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
#   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
#html_search_language = 'en'

# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}

# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'matlab2cppdoc'

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',

# Latex figure (float) alignment
#'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).
latex_documents = [
  (master_doc, 'matlab2cpp.tex', u'matlab2cpp Documentation',
   u'Jonathan Feinberg', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'matlab2cpp', u'matlab2cpp Documentation',
     [author], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
  (master_doc, 'matlab2cpp', u'matlab2cpp Documentation',
   author, 'matlab2cpp', 'One line description of project.',
   'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False


================================================
FILE: doc/previous_doc/source/dev00_overview.rst
================================================
.. _dev00:

Module overview
===============

.. automodule:: matlab2cpp




================================================
FILE: doc/previous_doc/source/dev01_qfuncs.rst
================================================
.. _dev01:

Quick translation functions
---------------------------

.. automodule:: matlab2cpp.qfunctions

.. autofunction:: matlab2cpp.build
.. autofunction:: matlab2cpp.qcpp
.. autofunction:: matlab2cpp.qhpp
.. autofunction:: matlab2cpp.qpy
.. autofunction:: matlab2cpp.qlog
.. autofunction:: matlab2cpp.qscript
.. autofunction:: matlab2cpp.qtree


================================================
FILE: doc/previous_doc/source/dev02_tree.rst
================================================
.. _dev02:

The tree constructor
====================

.. automodule:: matlab2cpp.tree

The Builder class
-----------------
.. autoclass:: matlab2cpp.Builder
    :members:
    :special-members:

Assignment constructors
-----------------------
.. automodule:: matlab2cpp.tree.assign
    :members:

Loop and branch constructors
----------------------------
.. automodule:: matlab2cpp.tree.branches
    :members:

Code block constructor
----------------------
.. automodule:: matlab2cpp.tree.codeblock
    :members:

Expression constructor
----------------------
.. automodule:: matlab2cpp.tree.expression
    :members:

Function constructors
---------------------
.. automodule:: matlab2cpp.tree.functions
    :members:

Miscelenious constructors
-------------------------
.. automodule:: matlab2cpp.tree.misc
    :members:

Variable constructors
---------------------
.. automodule:: matlab2cpp.tree.variables
    :members:

Find-end functions
------------------
.. automodule:: matlab2cpp.tree.findend
    :members:

Iterators
---------
.. automodule:: matlab2cpp.tree.iterate
    :members:

Identify structures
-------------------
.. automodule:: matlab2cpp.tree.identify
    :members:

Matlab constants
----------------
.. automodule:: matlab2cpp.tree.constants
    :members:


================================================
FILE: doc/previous_doc/source/dev03_node.rst
================================================
.. _dev03:

Node representation
===================
.. automodule:: matlab2cpp.node

The Node class
--------------
.. autoclass:: matlab2cpp.Node
   :members: 

Node backend
------------
.. automodule:: matlab2cpp.node.backend

Quick references
----------------
.. automodule:: matlab2cpp.node.reference


================================================
FILE: doc/previous_doc/source/dev04_datatype.rst
================================================
.. _dev04:
Datatypes
=========

.. automodule:: matlab2cpp.datatype



================================================
FILE: doc/previous_doc/source/dev05_configure.rst
================================================
.. _dev05:

Auto-configure datatype
=======================
.. automodule:: matlab2cpp.configure


================================================
FILE: doc/previous_doc/source/dev06_collection.rst
================================================
.. _dev06:

Collection
==========
.. automodule:: matlab2cpp.collection

.. autoclass:: matlab2cpp.collection.All
.. autoclass:: matlab2cpp.collection.Assign
.. autoclass:: matlab2cpp.collection.Assigns
.. autoclass:: matlab2cpp.collection.Band
.. autoclass:: matlab2cpp.collection.Bcomment
.. autoclass:: matlab2cpp.collection.Block
.. autoclass:: matlab2cpp.collection.Bor
.. autoclass:: matlab2cpp.collection.Branch
.. autoclass:: matlab2cpp.collection.Break
.. autoclass:: matlab2cpp.collection.Case
.. autoclass:: matlab2cpp.collection.Catch
.. autoclass:: matlab2cpp.collection.Cell
.. autoclass:: matlab2cpp.collection.Cget
.. autoclass:: matlab2cpp.collection.Colon
.. autoclass:: matlab2cpp.collection.Counter
.. autoclass:: matlab2cpp.collection.Cset
.. autoclass:: matlab2cpp.collection.Ctranspose
.. autoclass:: matlab2cpp.collection.Cvar
.. autoclass:: matlab2cpp.collection.Declares
.. autoclass:: matlab2cpp.collection.Ecomment
.. autoclass:: matlab2cpp.collection.Elementdivision
.. autoclass:: matlab2cpp.collection.Elexp
.. autoclass:: matlab2cpp.collection.Elif
.. autoclass:: matlab2cpp.collection.Elmul
.. autoclass:: matlab2cpp.collection.Else
.. autoclass:: matlab2cpp.collection.End
.. autoclass:: matlab2cpp.collection.Eq
.. autoclass:: matlab2cpp.collection.Error
.. autoclass:: matlab2cpp.collection.Exp
.. autoclass:: matlab2cpp.collection.Expr
.. autoclass:: matlab2cpp.collection.Fget
.. autoclass:: matlab2cpp.collection.Float
.. autoclass:: matlab2cpp.collection.For
.. autoclass:: matlab2cpp.collection.Fset
.. autoclass:: matlab2cpp.collection.Func
.. autoclass:: matlab2cpp.collection.Funcs
.. autoclass:: matlab2cpp.collection.Fvar
.. autoclass:: matlab2cpp.collection.Ge
.. autoclass:: matlab2cpp.collection.Get
.. autoclass:: matlab2cpp.collection.Gt
.. autoclass:: matlab2cpp.collection.Header
.. autoclass:: matlab2cpp.collection.Headers
.. autoclass:: matlab2cpp.collection.If
.. autoclass:: matlab2cpp.collection.Imag
.. autoclass:: matlab2cpp.collection.Include
.. autoclass:: matlab2cpp.collection.Includes
.. autoclass:: matlab2cpp.collection.Inline
.. autoclass:: matlab2cpp.collection.Inlines
.. autoclass:: matlab2cpp.collection.Int
.. autoclass:: matlab2cpp.collection.Lambda
.. autoclass:: matlab2cpp.collection.Land
.. autoclass:: matlab2cpp.collection.Lcomment
.. autoclass:: matlab2cpp.collection.Le
.. autoclass:: matlab2cpp.collection.Leftelementdivision
.. autoclass:: matlab2cpp.collection.Leftmatrixdivision
.. autoclass:: matlab2cpp.collection.Log
.. autoclass:: matlab2cpp.collection.Lor
.. autoclass:: matlab2cpp.collection.Lt
.. autoclass:: matlab2cpp.collection.Main
.. autoclass:: matlab2cpp.collection.Matrix
.. autoclass:: matlab2cpp.collection.Matrixdivision
.. autoclass:: matlab2cpp.collection.Minus
.. autoclass:: matlab2cpp.collection.Mul
.. autoclass:: matlab2cpp.collection.Ne
.. autoclass:: matlab2cpp.collection.Neg
.. autoclass:: matlab2cpp.collection.Nget
.. autoclass:: matlab2cpp.collection.Not
.. autoclass:: matlab2cpp.collection.Nset
.. autoclass:: matlab2cpp.collection.Opr
.. autoclass:: matlab2cpp.collection.Otherwise
.. autoclass:: matlab2cpp.collection.Params
.. autoclass:: matlab2cpp.collection.Paren
.. autoclass:: matlab2cpp.collection.Plus
.. autoclass:: matlab2cpp.collection.Program
.. autoclass:: matlab2cpp.collection.Project
.. autoclass:: matlab2cpp.collection.Resize
.. autoclass:: matlab2cpp.collection.Return
.. autoclass:: matlab2cpp.collection.Returns
.. autoclass:: matlab2cpp.collection.Set
.. autoclass:: matlab2cpp.collection.Sget
.. autoclass:: matlab2cpp.collection.Sset
.. autoclass:: matlab2cpp.collection.Statement
.. autoclass:: matlab2cpp.collection.String
.. autoclass:: matlab2cpp.collection.Struct
.. autoclass:: matlab2cpp.collection.Structs
.. autoclass:: matlab2cpp.collection.Switch
.. autoclass:: matlab2cpp.collection.Transpose
.. autoclass:: matlab2cpp.collection.Try
.. autoclass:: matlab2cpp.collection.Tryblock
.. autoclass:: matlab2cpp.collection.Var
.. autoclass:: matlab2cpp.collection.Vector
.. autoclass:: matlab2cpp.collection.Warning
.. autoclass:: matlab2cpp.collection.While


================================================
FILE: doc/previous_doc/source/dev07_rules.rst
================================================
.. _dev07:

Translation rules
=================

.. automodule:: matlab2cpp.rules

Datatype driven rules
---------------------

.. automodule:: matlab2cpp.rules._cell
.. automodule:: matlab2cpp.rules._char
.. automodule:: matlab2cpp.rules._cube
.. automodule:: matlab2cpp.rules._cx_cube
.. automodule:: matlab2cpp.rules._cx_double
.. automodule:: matlab2cpp.rules._cx_mat
.. automodule:: matlab2cpp.rules._cx_rowvec
.. automodule:: matlab2cpp.rules._cx_vec
.. automodule:: matlab2cpp.rules._double
.. automodule:: matlab2cpp.rules._fcube
.. automodule:: matlab2cpp.rules._float
.. automodule:: matlab2cpp.rules._fmat
.. automodule:: matlab2cpp.rules._frowvec
.. automodule:: matlab2cpp.rules._fvec
.. automodule:: matlab2cpp.rules._icube
.. automodule:: matlab2cpp.rules._imat
.. automodule:: matlab2cpp.rules._int
.. automodule:: matlab2cpp.rules._irowvec
.. automodule:: matlab2cpp.rules._ivec
.. automodule:: matlab2cpp.rules._mat
.. automodule:: matlab2cpp.rules._rowvec
.. automodule:: matlab2cpp.rules._string
.. automodule:: matlab2cpp.rules._struct
.. automodule:: matlab2cpp.rules._structs
.. automodule:: matlab2cpp.rules._ucube
.. automodule:: matlab2cpp.rules._umat
.. automodule:: matlab2cpp.rules._urowvec
.. automodule:: matlab2cpp.rules._uvec
.. automodule:: matlab2cpp.rules._uword
.. automodule:: matlab2cpp.rules._vec

Other rules
-----------

.. automodule:: matlab2cpp.rules._code_block
.. automodule:: matlab2cpp.rules._expression
.. automodule:: matlab2cpp.rules._func_lambda
.. automodule:: matlab2cpp.rules._func_return
.. automodule:: matlab2cpp.rules._func_returns
.. automodule:: matlab2cpp.rules._matrix
.. automodule:: matlab2cpp.rules._program
.. automodule:: matlab2cpp.rules._reserved
.. automodule:: matlab2cpp.rules._unknown
.. automodule:: matlab2cpp.rules._verbatim


================================================
FILE: doc/previous_doc/source/dev08_supplement.rst
================================================
.. _dev08:

Datatype scope
==============
.. automodule:: matlab2cpp.supplement

Input/Output classes
--------------------
.. autoclass:: matlab2cpp.supplement.Ftypes
.. autoclass:: matlab2cpp.supplement.Stypes
.. autoclass:: matlab2cpp.supplement.Itypes
.. autoclass:: matlab2cpp.supplement.Vtypes

Stringify supplement file
-------------------------
.. autofunction:: matlab2cpp.supplement.str_variables


================================================
FILE: doc/previous_doc/source/dev09_testsuite.rst
================================================
.. _dev09:

Testsuite
=========
.. automodule:: matlab2cpp.testsuite


================================================
FILE: doc/previous_doc/source/index.rst
================================================
Matlab2cpp Manual
=================

===========
User Manual
===========

.. toctree::
    :maxdepth: 3

    usr00_intro
    usr01_interaction
    usr02_datatype
    usr03_rules
    usr04_node

================
Developer Manual
================

.. toctree::
    :maxdepth: 3

    dev00_overview
    dev01_qfuncs
    dev02_tree
    dev03_node
    dev04_datatype
    dev05_configure
    dev06_collection
    dev07_rules
    dev08_supplement
    dev09_testsuite


================================================
FILE: doc/previous_doc/source/usr00_intro.rst
================================================
.. _usr00:

Introduction
============
.. include:: ../../README.md


================================================
FILE: doc/previous_doc/source/usr01_interaction.rst
================================================
.. automodule:: matlab2cpp.manual.usr01_interaction


================================================
FILE: doc/previous_doc/source/usr02_datatype.rst
================================================
.. automodule:: matlab2cpp.manual.usr02_datatype


================================================
FILE: doc/previous_doc/source/usr03_rules.rst
================================================
.. automodule:: matlab2cpp.manual.usr03_rules


================================================
FILE: doc/previous_doc/source/usr04_node.rst
================================================
.. automodule:: matlab2cpp.manual.usr04_node


================================================
FILE: doc/user_manual/Makefile
================================================
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS    =
SPHINXBUILD   = sphinx-build
PAPER         =
BUILDDIR      = build

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif

# Internal variables.
PAPEROPT_a4     = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext

help:
	@echo "Please use \`make <target>' where <target> is one of"
	@echo "  html       to make standalone HTML files"
	@echo "  dirhtml    to make HTML files named index.html in directories"
	@echo "  singlehtml to make a single large HTML file"
	@echo "  pickle     to make pickle files"
	@echo "  json       to make JSON files"
	@echo "  htmlhelp   to make HTML files and a HTML help project"
	@echo "  qthelp     to make HTML files and a qthelp project"
	@echo "  applehelp  to make an Apple Help Book"
	@echo "  devhelp    to make HTML files and a Devhelp project"
	@echo "  epub       to make an epub"
	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
	@echo "  text       to make text files"
	@echo "  man        to make manual pages"
	@echo "  texinfo    to make Texinfo files"
	@echo "  info       to make Texinfo files and run them through makeinfo"
	@echo "  gettext    to make PO message catalogs"
	@echo "  changes    to make an overview of all changed/added/deprecated items"
	@echo "  xml        to make Docutils-native XML files"
	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
	@echo "  linkcheck  to check all external links for integrity"
	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
	@echo "  coverage   to run coverage check of the documentation (if enabled)"

clean:
	rm -rf $(BUILDDIR)/*

html:
	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
	@echo
	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

dirhtml:
	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
	@echo
	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

singlehtml:
	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
	@echo
	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

pickle:
	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
	@echo
	@echo "Build finished; now you can process the pickle files."

json:
	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
	@echo
	@echo "Build finished; now you can process the JSON files."

htmlhelp:
	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
	@echo
	@echo "Build finished; now you can run HTML Help Workshop with the" \
	      ".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
	@echo
	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/matlab2cpp.qhcp"
	@echo "To view the help file:"
	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/matlab2cpp.qhc"

applehelp:
	$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
	@echo
	@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
	@echo "N.B. You won't be able to view it unless you put it in" \
	      "~/Library/Documentation/Help or install it in your application" \
	      "bundle."

devhelp:
	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
	@echo
	@echo "Build finished."
	@echo "To view the help file:"
	@echo "# mkdir -p $$HOME/.local/share/devhelp/matlab2cpp"
	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/matlab2cpp"
	@echo "# devhelp"

epub:
	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
	@echo
	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

latex:
	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
	@echo
	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
	@echo "Run \`make' in that directory to run these through (pdf)latex" \
	      "(use \`make latexpdf' here to do that automatically)."

latexpdf:
	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
	@echo "Running LaTeX files through pdflatex..."
	$(MAKE) -C $(BUILDDIR)/latex all-pdf
	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

latexpdfja:
	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
	@echo "Running LaTeX files through platex and dvipdfmx..."
	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

text:
	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
	@echo
	@echo "Build finished. The text files are in $(BUILDDIR)/text."

man:
	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
	@echo
	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

texinfo:
	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
	@echo
	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
	@echo "Run \`make' in that directory to run these through makeinfo" \
	      "(use \`make info' here to do that automatically)."

info:
	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
	@echo "Running Texinfo files through makeinfo..."
	make -C $(BUILDDIR)/texinfo info
	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."

gettext:
	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
	@echo
	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."

changes:
	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
	@echo
	@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
	@echo
	@echo "Link check complete; look for any errors in the above output " \
	      "or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
	@echo "Testing of doctests in the sources finished, look at the " \
	      "results in $(BUILDDIR)/doctest/output.txt."

coverage:
	$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
	@echo "Testing of coverage in the sources finished, look at the " \
	      "results in $(BUILDDIR)/coverage/python.txt."

xml:
	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
	@echo
	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."

pseudoxml:
	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
	@echo
	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."


================================================
FILE: doc/user_manual/source/conf.py
================================================
# -*- coding: utf-8 -*-
#
# matlab2cpp documentation build configuration file, created by
# sphinx-quickstart on Mon Jun  8 10:41:13 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shlex

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../../..'))

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.

extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon",
    "sphinxcontrib.autoprogram", "sphinxarg.ext"]

napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = False
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'matlab2cpp'
copyright = u'2015, Jonathan Feinberg'
author = u'Jonathan Feinberg'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.5'
# The full version, including alpha/beta/rc tags.
release = '0.5'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []

# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = 'classic'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
#html_use_index = True

# If true, the index is split into individual pages for each letter.
html_split_index = True

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
#   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
#   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
#html_search_language = 'en'

# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}

# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'matlab2cppdoc'

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',

# Latex figure (float) alignment
#'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).
latex_documents = [
  (master_doc, 'matlab2cpp.tex', u'matlab2cpp User Documentation',
   u'Jonathan Feinberg', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'matlab2cpp', u'matlab2cpp Documentation',
     [author], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
  (master_doc, 'matlab2cpp', u'matlab2cpp Documentation',
   author, 'matlab2cpp', 'One line description of project.',
   'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False


================================================
FILE: doc/user_manual/source/conf.py~
================================================
# -*- coding: utf-8 -*-
#
# matlab2cpp documentation build configuration file, created by
# sphinx-quickstart on Mon Jun  8 10:41:13 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shlex

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../../..'))

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.

extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon",
    "sphinxcontrib.autoprogram", "sphinxarg.ext"]

napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = False
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'matlab2cpp'
copyright = u'2015, Jonathan Feinberg'
author = u'Jonathan Feinberg'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.5'
# The full version, including alpha/beta/rc tags.
release = '0.5'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []

# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = 'classic'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
#html_use_index = True

# If true, the index is split into individual pages for each letter.
html_split_index = True

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
#   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
#   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
#html_search_language = 'en'

# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}

# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'matlab2cppdoc'

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',

# Latex figure (float) alignment
#'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).
latex_documents = [
  (master_doc, 'matlab2cpp.tex', u'matlab2cpp Documentation',
   u'Jonathan Feinberg', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'matlab2cpp', u'matlab2cpp Documentation',
     [author], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
  (master_doc, 'matlab2cpp', u'matlab2cpp Documentation',
   author, 'matlab2cpp', 'One line description of project.',
   'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False


================================================
FILE: doc/user_manual/source/dev00_overview.rst~
================================================
.. _dev00:

Module overview
===============

.. automodule:: matlab2cpp




================================================
FILE: doc/user_manual/source/index.rst
================================================
Matlab2cpp User Manual
=================

===========
User Manual
===========

.. toctree::
    :maxdepth: 3

    intro
    installation
    interaction
    usr02_datatype
    usr03_rules
    usr04_node




================================================
FILE: doc/user_manual/source/index.rst~
================================================
Matlab2cpp User Manual
=================

===========
User Manual
===========

.. toctree::
    :maxdepth: 3

    usr00_intro
    usr01_interaction
    usr02_datatype
    usr03_rules
    usr04_node




================================================
FILE: doc/user_manual/source/usr00_intro.rst~
================================================
.. _usr00:

Introduction
************
..
	.. include:: ../../../README.md

.. automodule:: matlab2cpp.manual.usr00_introduction


================================================
FILE: doc/user_manual/source/usr02_datatype.rst
================================================
..
    .. automodule:: matlab2cpp.manual.usr02_datatype

.. _usr02:

Configuring translation
=======================

One of the translation challenges is how each variable type is determined. In
C++ all variables have to be explicitly declared, while in Matlab they are
declared implicitly at creation.  When translating between the two languages,
there are many variables where the data types are unknown and impossible for
the Matlab2cpp software to translate.  How to translate the behavior of an
integer is vastly different from an float matrix.

To differentiate between types, each node have an attribute
:py:attr:`~matlab2cpp.Node.type` which represents the node datatype.
Datatypes can be roughly split into two groups: **numerical** and
**non-numerical** types.  The numerical types are as follows:

+---------------+--------------+---------+---------+--------+-----------+
|               | unsigned int | integer | float   | double | complex   |
+===============+==============+=========+=========+========+===========+
| `scalar`      | uword        | int     | float   | double | cx_double |
+---------------+--------------+---------+---------+--------+-----------+
| `vector`      | uvec         | ivec    | fvec    | vec    | cx_vec    |
+---------------+--------------+---------+---------+--------+-----------+
| `row\-vector` | urowvec      | irowvec | frowvec | rowvec | cx_rowvec |
+---------------+--------------+---------+---------+--------+-----------+
| `matrix`      | umat         | imat    | fmat    | mat    | cx_mat    |
+---------------+--------------+---------+---------+--------+-----------+
| `cube`        | ucube        | icube   | fcube   | cube   | cx_cube   |
+---------------+--------------+---------+---------+--------+-----------+

Values along the horizontal axis represents the amount of memory reserved per
element, and the along the vertical axis represents the various number of
dimensions.  The names are equivalent to the ones in the Armadillo package.

The non-numerical types are as follows:

+----------------------------------+------------------------+
| Name                             | Description            |
+==================================+========================+
| `char`                           | Single text character  |
+----------------------------------+------------------------+
| `string`                         | Text string            |
+----------------------------------+------------------------+
| :ref:`struct <struct>`           | Struct container       |
+----------------------------------+------------------------+
| :ref:`structs <structs>`         | Struct array container |
+----------------------------------+------------------------+
| :ref:`func_lambda <func_lambda>` | Anonymous function     |
+----------------------------------+------------------------+

Function scope
--------------

If not specified otherwise, the program will not assign datatype types to any
of variables. The user could in theory navigate the node tree and assign the
variables one by one using the node attributes to navigate. (See section
:ref:`usr04` for details.) However that would be very cumbersome. Instead the
datatypes are define collectively inside their scope. In the case of variables
in functions, the scope variables are the variables declaration
:py:class:`~matlab2cpp.Declares` and function parameters
:py:class:`~matlab2cpp.Params`. To reach the variable that serves as
a scope-wide type, the node attribute :py:attr:`~matlab2cpp.Node.declare` can
be used.

Manually interacting with the variable scope is simpler then iterating through
the full tree, but can in many cases still be cumbersome. To simplefy
interaction with datatype scopes, each program has an suppliment attribute
:py:attr:`~matlab2cpp.Node.ftypes`. The attribute is a nested dictionary where
the outer shell represents the function name the variables are defined. The
inner shell is the variables where keys are variable names and values are
types. It can be used to quickly retrievieng and inserting datatypes.
For example::

    >>> tree = mc.build("function f(a)")
    >>> print tree.ftypes
    {'f': {'a': ''}}
    >>> tree.ftypes = {"f": {"a": "int"}}
    >>> print mc.qscript(tree)
    void f(int a)
    {
      // Empty block
    }

.. _func_lambda:

Anonymous functions
-------------------

In addition to normal function, Matlab have support for anonymous function
through the name prefix ``@``.  For example::

    >>> print mc.qscript("function f(); g = @(x) x^2; g(4)")
    void f()
    {
      std::function<double(int)> g ;
      g = [] (int x) {pow(x, 2) ; } ;
      g(4) ;
    }

The translator creates an ``C++11`` lambda function with equivalent
functionality.  To achieve this, the translator creates an extra function in
the node-tree.  The name of the function is the same as assigned variable with
a ``_``-prefix (and a number postfix, if name is taken).  The information about
this function dictate the behaviour of the output The supplement file have the
following form::

    >>> print mc.qpy("function f(); g = @(x) x^2; g(4)")
    functions = {
      "_g" : {
              "x" : "int",
      },
      "f" : {
        "g" : "func_lambda",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

The function `g` is a variable inside `f`'s function scope.  It has the datatype
`func_lambda` to indicate that it should be handled as a function.  The
associated function scope `_g` contains the variables inside the definition of
the anonymous function.


.. _struct:

Data structure
--------------

Data structures in Matlab can be constructed explicitly through the
``struct``-function.  However, they can also be constructed implicitly by
direct assignment.  For example will ``a.b=4`` create a ``struct`` with name
``a`` that has one field ``b``.  When translating such a snippet, it creates
a C++-struct, such that::

    >>> print mc.qhpp("function f(); a.b = 4.", suggest=True)
    #ifndef F_M_HPP
    #define F_M_HPP
    <BLANKLINE>
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    struct _A
    {
      double b ;
    } ;
    <BLANKLINE>
    void f()
    {
      _A a ;
      a.b = 4. ;
    }
    #endif

In the suppliment file, the local variable `a` will be assigned as a `struct`.
In addition, since the struct has content, the suppliment file creates a new
section for structs.  It will have the following form::

    >>> print mc.qpy("function f(); a.b = 4.", suggest=True)
    functions = {
      "f" : {
        "a" : "struct",
      },
    }
    structs = {
      "a" : {
        "b" : "double",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

Quick retrieving and inserting struct variables can be done through the
:py:attr:`~matlab2cpp.Node.stypes` attribute::

    >>> tree = mc.build("a.b = 4")
    >>> tree.ftypes = {"f": {"a": "struct"}}
    >>> tree.stypes = {"a": {"b": "double"}}
    >>> print mc.qcpp(tree)
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    struct _A
    {
      double b ;
    } ;
    <BLANKLINE>
    int main(int argc, char** argv)
    {
      _A a ;
      a.b = 4 ;
      return 0 ;
    }

.. _structs:

Struct tables
-------------

Given that the data structure is indexed, e.g. ``a(1).b``, it forms a struct
table.  Very similar to regular :ref:`structs <struct>`, which only has one
value per element.  There are a couple of differences in the translation.
First, the struct is declared as an array:

    >>> print mc.qhpp("function f(); a(1).b = 4.", suggest=True)
    #ifndef F_M_HPP
    #define F_M_HPP
    <BLANKLINE>
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    struct _A
    {
      double b ;
    } ;
    <BLANKLINE>
    void f()
    {
      _A a[100] ;
      a[0].b = 4. ;
    }
    #endif

The translation assigned reserves 100 pointers for the content of ``a``.
Obviously, there are situations where this isn't enough (or too much), and the
number should be increased. So second, to adjust this number, the suppliment
file specifies the number of elements in the integer ``_size``:

    >>> print mc.qpy("function f(); a(1).b = 4.", suggest=True)
    functions = {
      "f" : {
        "a" : "structs",
      },
    }
    structs = {
      "a" : {
        "_size" : 100,
            "b" : "double",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

.. _usr02_suggestion_engine:

Suggestion engine
-----------------

The examples so far, when the functions :py:func:`~matlab2cpp.qcpp`,
:py:func:`~matlab2cpp.qhpp` and :py:func:`~matlab2cpp.qpy` are used, the
argument ``suggest=True`` have been used, and all variable types have been
filled in. Consider the following program where this is not the case::

    >>> print mc.qhpp("function c=f(); a = 4; b = 4.; c = a+b", suggest=False)
    #ifndef F_M_HPP
    #define F_M_HPP
    <BLANKLINE>
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    TYPE f()
    {
      TYPE a, b, c ;
      a = 4 ;
      b = 4. ;
      c = a+b ;
      return c ;
    }
    #endif

Since all variables are unknown, the program decides to fill in the dummy
variable ``TYPE`` for each unknown variable. Any time variables are unknown,
``TYPE`` is used. The supplement file created by `m2cpp` or
:py:func:`~matlab2cpp.qpy` reflects all these unknown variables as follows::

    >>> print mc.qpy("function c=f(); a = 4; b = 4.; c = a+b", suggest=False)
    functions = {
      "f" : {
        "a" : "", # int
        "b" : "", # double
        "c" : "",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

By flipping the boolean to ``True``, all the variables get assigned datatypes::

    >>> print mc.qpy("function c=f(); a = 4; b = 4.; c = a+b", suggest=True)
    functions = {
      "f" : {
        "a" : "int",
        "b" : "double",
        "c" : "double",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

The resulting program will have the following complete form:

    >>> print mc.qhpp(
    ...     "function c=f(); a = 4; b = 4.; c = a+b", suggest=True)
    #ifndef F_M_HPP
    #define F_M_HPP
    <BLANKLINE>
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    double f()
    {
      double b, c ;
      int a ;
      a = 4 ;
      b = 4. ;
      c = a+b ;
      return c ;
    }
    #endif

Note here though that the variable ``c`` didn't have a suggestion. The
suggestion is an interactive process such that ``a`` and ``b`` both must be
known beforehand.  The variable ``a`` and ``b`` get assigned the datatypes
``int`` and ``double`` because of the direct assignment of variable.  After
this, the process starts over and tries to find other variables that suggestion
could fill out for.  In the case of the ``c`` variable, the assignment on the
right were and addition between ``int`` and ``double``.  To not loose
precision, it then chooses to keep `double`, which is passed on to the ``c``
variable.  In practice the suggestions can potentially fill in all datatypes
automatically in large programs, and often quite intelligently. For example,
variables get suggested across function call scope::

    >>> print mc.qscript('function y=f(x); y=x; function g(); z=f(4)')
    int f(int x)
    {
      int y ;
      y = x ;
      return y ;
    }
    <BLANKLINE>
    void g()
    {
      int z ;
      z = f(4) ;
    }

And accross multiple files::

    >>> builder = mc.Builder()
    >>> builder.load("f.m", "function y=f(x); y=x")
    >>> builder.load("g.m", "function g(); z=f(4)")
    >>> builder.configure(suggest=True)
    >>> tree_f, tree_g = builder[:]
    >>> print mc.qscript(tree_f)
    int f(int x)
    {
      int y ;
      y = x ;
      return y ;
    }
    >>> print mc.qscript(tree_g)
    void g()
    {
      int z ;
      z = f(4) ;
    }

Verbatim translations
---------------------

In some cases, the translation can not be performed. For example, the Matlab
function ``eval`` can not be properly translated. Matlab is interpreted, and
can easily take a string from local name space, and feed it to the interpreter.
In C++ however, the code must be pre-compiled. Not knowing what the string
input is before runtime, makes this difficult. So instead it makes more sense
to make some custom translation by hand.

Since ``matlab2cpp`` produces C++ files, it is possible to edit them after
creation. However, if changes are made to the Matlab-file at a later point, the
custom edits have to be added manually again. To resolve this, ``matlab2cpp``
supports verbatim translations through the suppliment file ``.py`` and through
the node attribute :py:attr:`~matlab2cpp.Node.vtypes`.
:py:attr:`~matlab2cpp.node.vtype` is a dictionary where the keys are string
found in the orginal code, and the values are string of the replacement.

Performing a verbatim replacement has to be done before the node tree is
constructed. Assigning :py:attr:`~matlab2cpp.Node.vtypes` doesn't work very
well. Instead the replacement dictionary can be bassed as argument to
:py:func:`~matlab2cpp.build`::

    >>> tree = mc.build('''a=1
    ... b=2
    ... c=3''', vtypes = {"b": "_replaced_text_"})
    >>> print mc.qscript(tree)
    a = 1 ;
    // b=2
    _replaced_text_
    c = 3 ;

Note that when a match is found, the whole line is replaced. No also how the
source code is retained a comment above the verbatim translation. The
verbatim key can only match a single line, however the replacement might span
multiple lines. For example::

    >>> replace_code = '''one line
    ... two line
    ... three line'''
    >>> tree = mc.build('''a=1
    ... b=2
    ... c=3''', vtypes={"b": replace_code})
    >>> print mc.qscript(tree)
    a = 1 ;
    // b=2
    one line
    two line
    three line
    c = 3 ;

Verbatims can also be utilized by modifying the .py file. Consider the Matlab script::

    a = 1 ;
    b = 2 ;
    c = 3 ;

Using the m2cpp script to translate the Matlab script produces a C++ file and a .py file. By adding code to the .py file, verbatim translation can be added. This is done by using the keyword verbatims and setting it to a python dictionary. Similar to vtype, keys are strings found in the original code, and the values are string of the replacement::

    functions = {
    "main" : {
    "a" : "int",
    "b" : "int",
    "c" : "int",
    },
    }
    includes = [
    '#include <armadillo>',
    'using namespace arma ;',
    ]
    verbatims = {"b = 2 ;" : '''one line
    two line
    tree line'''
    }

In the generated C++ file the second assignment is replaced with the verbatim translation::

    int main(int argc, char** argv)
    {
      int a, c ;
      a = 1 ;
      // b = 2 ;
      one line
      two line
      tree line
      c = 3 ;
      return 0 ;
    }

   


================================================
FILE: doc/user_manual/source/usr03_rules.rst
================================================
.. automodule:: matlab2cpp.manual.usr03_rules


================================================
FILE: doc/user_manual/source/usr04_node.rst
================================================
.. automodule:: matlab2cpp.manual.usr04_node


================================================
FILE: requirements.txt
================================================
pytest==3.2.2
pytest-runner==2.12.1
pytest-cov==2.5.1
codecov==2.0.16


================================================
FILE: setup.cfg
================================================
[aliases]
test = pytest

[tool:pytest]
norecursedirs = test/data
testpaths = src/matlab2cpp test
addopts = --doctest-modules --cov=./src

[metadata]
description-file = README.md


================================================
FILE: setup.py
================================================
"""Main installer."""
from setuptools import setup, find_packages

setup(
    name="matlab2cpp",
    version="2.0.1",
    packages=find_packages("src"),
    package_dir={"": "src"},
    entry_points={"console_scripts": ["m2cpp = matlab2cpp:m2cpp"]},
    url='http://github.com/jonathf/matlab2cpp',
    license='BSD',
    author="Jonathan Feinberg",
    author_email="jonathan@feinberg.no",
    description="Matlab to C++ transpiler",
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Console',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Natural Language :: English',
        'Programming Language :: Python',
        'Topic :: Software Development :: Compilers',
    ],
    tests_require=["pytest", "pytest-runner"],
)


================================================
FILE: src/matlab2cpp/__init__.py
================================================
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""

The toolbox is sorted into the following modules:

+----------------------------------+----------------------------------------+
| Module                           | Description                            |
+==================================+========================================+
| :py:mod:`~matlab2cpp.qfunctions` | Functions for performing simple        |
|                                  | translations                           |
+----------------------------------+----------------------------------------+
| :py:class:`~matlab2cpp.Builder`  | Constructing a tree from Matlab code   |
+----------------------------------+----------------------------------------+
| :py:class:`~matlab2cpp.Node`     | Components in the tree representation  |
|                                  | of the code                            |
+----------------------------------+----------------------------------------+
| :py:mod:`~matlab2cpp.collection` | The collcetion of various node         |
+----------------------------------+----------------------------------------+
| :py:mod:`~matlab2cpp.configure`  | Rutine for setting datatypes and       |
|                                  | backends of the various nodes          |
+----------------------------------+----------------------------------------+
| :py:mod:`~matlab2cpp.rules`      | Translation rules                      |
+----------------------------------+----------------------------------------+
| :py:mod:`~matlab2cpp.supplement` | Functions for inserting and extraction |
|                                  | datatypes                              |
+----------------------------------+----------------------------------------+
| :py:mod:`~matlab2cpp.testsuite`  | Suite for testing software             |
+----------------------------------+----------------------------------------+


The simplest way to use the library is to use the quick translation functions.
They are available through the `matlab2cpp.qfunctions` module and mirrors the
functionality offered by the `m2cpp` function.
"""
try:
    import argcomplete
except ImportError:
    argcomplete = None

from .parser import create_parser
from .qfunctions import *

__version__ = "2.0"


def m2cpp(args=None):
    """
    Execute main parser.

    Args:
        args (Optional[List[str]]):
            Argument to be parsed. If omitted, use ``sys.args``.
    """
    parser = create_parser()
    if argcomplete is not None:
        argcomplete.autocomplete(parser)

    args = parser.parse_args(args)

    from matlab2cpp.frontend import execute_parser
    execute_parser(args)


================================================
FILE: src/matlab2cpp/collection.py
================================================
# encoding: utf-8
r"""
A full summary of all nodes.

+---------------------+--------------------+----------------+------------------------------+
| Name                | Children           | Example        | Description                  |
+=====================+====================+================+==============================+
| All                 |                    | `:`            | Colon operator w/o range     |
+---------------------+--------------------+----------------+------------------------------+
| Assign              | `Expr Expr`        | `a=b`          | Assignment one var           |
+---------------------+--------------------+----------------+------------------------------+
| Assigns             | `Expr Expr+`       | `[a,b]=c`      | Assignment multi vars        |
+---------------------+--------------------+----------------+------------------------------+
| Band                | `Expr Expr+`       | `a&b`          | Binary AND operator          |
+---------------------+--------------------+----------------+------------------------------+
| Bcomment            |                    | `%{ . %}`      | Block comment                |
+---------------------+--------------------+----------------+------------------------------+
| Block               | `Line*`            | `a`            | Code block                   |
+---------------------+--------------------+----------------+------------------------------+
| Bor                 | `Expr Expr+`       | `a|b`          | Binary OR operator           |
+---------------------+--------------------+----------------+------------------------------+
| Branch              | `If Ifse* Else?`   | `if a; end`    | If chain container           |
+---------------------+--------------------+----------------+------------------------------+
| Break               |                    | `break`        | Break statement              |
+---------------------+--------------------+----------------+------------------------------+
| Case                | `Var Block`        | `case a`       | Case part of Switch          |
+---------------------+--------------------+----------------+------------------------------+
| Catch               | `Block`            | `catch a`      | Catch part of Tryblock       |
+---------------------+--------------------+----------------+------------------------------+
| Cell                | `Expr*`            | `{a}`          | Cell array                   |
+---------------------+--------------------+----------------+------------------------------+
| Cget                | `Expr+`            | `a{b}(c)`      | Cell retrival                |
+---------------------+--------------------+----------------+------------------------------+
| Colon               | `Expr Expr Expr?`  | `a:b`          | Colon operator w range       |
+---------------------+--------------------+----------------+------------------------------+
| Counter             |                    |                | Struct array size            |
+---------------------+--------------------+----------------+------------------------------+
| Cset                | `Expr+`            | `a{b}(c)=d`    | Cell array assignment        |
+---------------------+--------------------+----------------+------------------------------+
| Ctranspose          | `Expr`             | `a'`           | Complex transform            |
+---------------------+--------------------+----------------+------------------------------+
| Cvar                | `Expr+`            | `a{b}`         | Cell variable                |
+---------------------+--------------------+----------------+------------------------------+
| Declares            | `Var*`             |                | Declared variable list       |
+---------------------+--------------------+----------------+------------------------------+
| Ecomment            |                    | `a%b`          | End-of-line comment          |
+---------------------+--------------------+----------------+------------------------------+
| Elementdivision     | `Expr Expr+`       | `a./b`         | Sclars division              |
+---------------------+--------------------+----------------+------------------------------+
| Elexp               | `Expr Expr+`       | `a.^b`         | Element-wise exponent        |
+---------------------+--------------------+----------------+------------------------------+
| Elif                | `Expr Block`       | `elseif a`     | Else-if part of Branch       |
+---------------------+--------------------+----------------+------------------------------+
| Elmul               | `Expr Expr+`       | `a.*b`         | Element-wise multiplication  |
+---------------------+--------------------+----------------+------------------------------+
| Else                | `Block`            | `else`         | Else part of Branch          |
+---------------------+--------------------+----------------+------------------------------+
| End                 |                    | `end`          | End-expression               |
+---------------------+--------------------+----------------+------------------------------+
| Eq                  | `Expr Expr`        | `a==b`         | Equallity sign               |
+---------------------+--------------------+----------------+------------------------------+
| Error               |                    |                | Error node                   |
+---------------------+--------------------+----------------+------------------------------+
| Exp                 | `Expr Expr+`       | `a^b`          | Exponential operator         |
+---------------------+--------------------+----------------+------------------------------+
| Fget                | `Expr*`            | `a.b(c)`       | Fieldarray retrival          |
+---------------------+--------------------+----------------+------------------------------+
| Float               |                    | `4.`           | Float-point number           |
+---------------------+--------------------+----------------+------------------------------+
| For                 | `Var Expr Block`   | `for a=b;end`  | For-loop container           |
+---------------------+--------------------+----------------+------------------------------+
| Fset                | `Expr Expr+`       | `a.b(c)=d`     | Fieldname assignment         |
+---------------------+--------------------+----------------+------------------------------+
| Func                | `Declares Returns` | `function f()` | Function container           |
|                     | `Params Block`     | `end`          |                              |
+---------------------+--------------------+----------------+------------------------------+
| Funcs               | `[Main Func+]`     |                | Root of all functions        |
+---------------------+--------------------+----------------+------------------------------+
| Fvar                |                    | `a.b`          | Fieldname variable           |
+---------------------+--------------------+----------------+------------------------------+
| Ge                  | `Expr Expr`        | `a>=b`         | Greater-or-equal operator    |
+---------------------+--------------------+----------------+------------------------------+
| Get                 | `Expr*`            | `a(b)`         | Function or retrival         |
+---------------------+--------------------+----------------+------------------------------+
| Gt                  | `Expr Expr`        | `a>b`          | Greater operator             |
+---------------------+--------------------+----------------+------------------------------+
| Header              |                    |                | File header element          |
+---------------------+--------------------+----------------+------------------------------+
| Headers             |                    |                | Collection header lines      |
+---------------------+--------------------+----------------+------------------------------+
| If                  | `Expr Block`       | `if a`         | If part of Branch            |
+---------------------+--------------------+----------------+------------------------------+
| Imag                |                    | `i`            | Imaginary unit               |
+---------------------+--------------------+----------------+------------------------------+
| Include             |                    |                | Include statement            |
+---------------------+--------------------+----------------+------------------------------+
| Includes            |                    |                | Collection of includes       |
+---------------------+--------------------+----------------+------------------------------+
| Int                 |                    | `1`            | Integer value                |
+---------------------+--------------------+----------------+------------------------------+
| Lambda              |                    | `f=@()1`       | Lambda function expression   |
+---------------------+--------------------+----------------+------------------------------+
| Land                | `Expr Expr+`       | `a&&b`         | Logical AND operator         |
+---------------------+--------------------+----------------+------------------------------+
| Lcomment            |                    | `%a`           | Line-comment                 |
+---------------------+--------------------+----------------+------------------------------+
| Le                  | `Expr Expr`        | `a<=b`         | Less-or-equal operator       |
+---------------------+--------------------+----------------+------------------------------+
| Leftelementdivision | `Expr Expr+`       | `a.\b`         | Left sclar division          |
+---------------------+--------------------+----------------+------------------------------+
| Leftmatrixdivision  | `Expr Expr+`       | `a\b`          | Left matrix division         |
+---------------------+--------------------+----------------+------------------------------+
| Log                 | `[Error Warning]+` |                | Collection of Errors         |
+---------------------+--------------------+----------------+------------------------------+
| Lor                 | `Expr Expr`        | `a||b`         | Logical OR operator          |
+---------------------+--------------------+----------------+------------------------------+
| Lt                  | `Expr Expr`        | `a<b`          | Less-then operator           |
+---------------------+--------------------+----------------+------------------------------+
| Main                | `Declares Returns` | `function f()` | Container for                |
|                     | `Params Block`     | `end`          | main function                |
+---------------------+--------------------+----------------+------------------------------+
| Matrix              | `Vector*`          | `[a]`          | Matrix container             |
+---------------------+--------------------+----------------+------------------------------+
| Matrixdivision      | `Expr Expr+`       | `a/b`          | Matrix division              |
+---------------------+--------------------+----------------+------------------------------+
| Minus               | `Expr Expr+`       | `a-b`          | Minus operator               |
+---------------------+--------------------+----------------+------------------------------+
| Mul                 | `Expr Expr+`       | `a*b`          | Multiplication operator      |
+---------------------+--------------------+----------------+------------------------------+
| Ne                  | `Expr Expr`        | `a~=b`         | Not-equal operator           |
+---------------------+--------------------+----------------+------------------------------+
| Neg                 | `Expr`             | `-a`           | Unary negative sign          |
+---------------------+--------------------+----------------+------------------------------+
| Nget                | `Expr`             | `a.(b)`        | Namefield retrival           |
+---------------------+--------------------+----------------+------------------------------+
| Not                 | `Expr`             | `~a`           | Not operator                 |
+---------------------+--------------------+----------------+------------------------------+
| Nset                | `Expr`             | `a.(b)=c`      | Namefield assignment         |
+---------------------+--------------------+----------------+------------------------------+
| Otherwise           | `Block`            | `otherwise`    | Otherwise part of Switch     |
+---------------------+--------------------+----------------+------------------------------+
| Params              | `Var*`             |                | Function parameter container |
+---------------------+--------------------+----------------+------------------------------+
| Parfor              | `Var Expr Block`   | `parfor a=b;end`| Parallel for-loop container |
+---------------------+--------------------+----------------+------------------------------+
| Plus                | `Expr Expr+`       | `a+b`          | Addition operator            |
+---------------------+--------------------+----------------+------------------------------+
| Pragma_for          |                    | `%%PARFOR str` | For-loop pragma              |
+---------------------+--------------------+----------------+------------------------------+
| Program             | `Includes Funcs`   |                | Program root                 |
|                     | `Inlines Structs`  |                |                              |
|                     | `Headers Log`      |                |                              |
+---------------------+--------------------+----------------+------------------------------+
| Project             | `Program+`         |                | Root of all programs         |
+---------------------+--------------------+----------------+------------------------------+
| Return              |                    | `return`       | Return statement             |
+---------------------+--------------------+----------------+------------------------------+
| Returns             | `Var*`             |                | Return value collection      |
+---------------------+--------------------+----------------+------------------------------+
| Set                 | `Expr*`            | `a(b)=c`       | Array value assignment       |
+---------------------+--------------------+----------------+------------------------------+
| Sget                | `Expr+`            | `a.b(c)`       | Submodule function/retrival  |
+---------------------+--------------------+----------------+------------------------------+
| Sset                | `Expr+`            | `a.b(c)=d`     | Submodule assignment         |
+---------------------+--------------------+----------------+------------------------------+
| Statement           | `Expr`             | `a`            | Stand alone statement        |
+---------------------+--------------------+----------------+------------------------------+
| String              |                    | `'a'`          | String representation        |
+---------------------+--------------------+----------------+------------------------------+
| Struct              |                    |                | Struct container             |
+---------------------+--------------------+----------------+------------------------------+
| Structs             |                    |                | Container for structs        |
+---------------------+--------------------+----------------+------------------------------+
| Switch              | `Var Case+ Other`  | `case a; end`  | Container for Switch branch  |
+---------------------+--------------------+----------------+------------------------------+
| Transpose           | `Expr`             | `a'`           | Transpose operator           |
+---------------------+--------------------+----------------+------------------------------+
| Try                 | `Block`            | `try`          | Try part of Tryblock         |
+---------------------+--------------------+----------------+------------------------------+
| Tryblock            | `Try Catch`        | `try; end`     | Container for try-blocks     |
+---------------------+--------------------+----------------+------------------------------+
| Var                 |                    | `a`            | Variable                     |
+---------------------+--------------------+----------------+------------------------------+
| Vector              | `Expr*`            | `[a]`          | Row-vector part of Matrix    |
+---------------------+--------------------+----------------+------------------------------+
| Warning             |                    |                | Element in Log               |
+---------------------+--------------------+----------------+------------------------------+
| While               | `Expr Block`       | `while a;end`  | While-loop container         |
+---------------------+--------------------+----------------+------------------------------+
"""

from .node import Node

__all__ = [
    "All", "Assign", "Assigns", "Band", "Bcomment", "Block", "Bor", "Branch",
    "Break", "Case", "Catch", "Cell", "Cget", "Colon",
    "Counter", "Cset", "Ctranspose", "Cvar", 
    "Declares", "Ecomment",
    "Elementdivision", "Elexp", "Elif", "Elmul", "Else", "End", "Eq", "Error",
    "Exp", "Expr", "Fget", "Float", "Parfor", "Pragma_for", "For", "Fset", "Func", "Funcs", "Fvar", "Ge",
    "Get", "Gt", "Header", "Headers", "If", "Imag", "Include", "Includes", "Inline",
    "Inlines", "Int", "Lambda", "Land", "Lcomment", "Le", "Leftelementdivision",
    "Leftmatrixdivision", "Log", "Lor", "Lt", "Main", "Matrix", "Matrixdivision",
    "Minus", "Mul", "Ne", "Neg", "Nget", "Not", "Nset", "Opr", "Otherwise",
    "Params", "Paren", "Plus", "Program", "Project", "Resize", "Return", "Returns",
    "Set", "Sget", "Sset", "Statement", "String", "Struct", "Structs", "Switch",
    "Transpose", "Try", "Tryblock", "Var", "Vector", "Warning", "While"
]

class Project(Node):
    def __init__(self, name="", cur=0, line=0, code="", **kws):
        """
Root of the node tree. Every other node should inherant from this one.

This node should not recieve `parent` argument node during construction.

Children:
    `Program+`

All keyword arguments are passed to `matlab2cpp.Node.__init__`.
    """
        assert "parent" not in kws
        self.parent = self
        self._program = self
        Node.__init__(self, self, name=name, cur=cur,
                line=line, code=code, **kws)

class Program(Node):
    def __init__(self, parent, name, **kws):
        """
Represents one stand-alone script or program. Each child represents the various
aspects of script/program.

Children:
    `Includes Funcs Inlines Structs Headers Log`

All keyword arguments are passed to `matlab2cpp.Node.__init__`.
    """
        self._program = self
        Node.__init__(self, parent, name=name, **kws)

class Includes(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)

class Funcs(Node):
    def __init__(self, parent, line=1, **kws):
        Node.__init__(self, parent, line=line, **kws)

class Inlines(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)

class Structs(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)

class Headers(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)

class Log(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)

class Header(Node):
    def __init__(self, parent, name, **kws):
        Node.__init__(self, parent, name=name, **kws)

class Main(Node):
    def __init__(self, parent, name="main", **kws):
        Node.__init__(self, parent, name=name, **kws)

class Error(Node):
    def __init__(self, parent, name, value, **kws):
        Node.__init__(self, parent, name, value=value, **kws)
        self.prop["cls"] = name[10:]
class Warning(Node):
    def __init__(self, parent, name, value, **kws):
        Node.__init__(self, parent, name, value=value, **kws)
        self.prop["cls"] = name[10:]

class Counter(Node):
    def __init__(self, parent, name, value, **kws):
        Node.__init__(self, parent, name,
                value=value, **kws)

class Inline(Node):
    def __init__(self, parent, name, **kws):
        Node.__init__(self, parent, name, **kws)

class Include(Includes):
    def __init__(self, parent, name, **kws):
        Node.__init__(self, parent, name=name, **kws)

class Struct(Structs):          pass

class Func(Node):           pass
class Returns(Node):        pass
class Params(Node):         pass
class Declares(Node):       pass

class Block(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)
class Parfor(Block):        pass
class For(Block):           pass
class While(Block):         pass
class Switch(Block):        pass
class Case(Block):          pass
class Otherwise(Block):     pass
class Branch(Block):        pass
class If(Block):            pass
class Elif(Block):          pass
class Else(Block):          pass
class Tryblock(Block):      pass
class Try(Block):           pass
class Catch(Block):         pass
class Statement(Block):     pass

class Assign(Node):         pass
class Assigns(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)

class Expr(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)
class Opr(Expr):            pass
class Exp(Opr):             pass
class Elexp(Opr):           pass
class Mul(Opr):             pass
class Minus(Opr):           pass
class Elmul(Opr):           pass
class Matrixdivision(Opr):      pass
class Elementdivision(Opr):     pass
class Leftmatrixdivision(Opr):  pass
class Leftelementdivision(Opr): pass
class Plus(Opr):            pass
class Colon(Opr):           pass
class Gt(Opr):              pass
class Ge(Opr):              pass
class Lt(Opr):              pass
class Le(Opr):              pass
class Ne(Opr):              pass
class Eq(Opr):              pass
class Band(Opr):            pass
class Bor(Opr):             pass
class Land(Opr):            pass
class Lor(Opr):             pass

class Matrix(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)
class Vector(Matrix):       pass

class Cell(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)

class Paren(Expr):          pass
class Neg(Expr):            pass
class Not(Expr):            pass
class Ctranspose(Expr):     pass
class Transpose(Expr):      pass
class All(Expr):            pass
class End(Expr):            pass
class Break(Expr):          pass
class Return(Expr):         pass

class Int(Node):
    def __init__(self, parent, value, **kws):
        Node.__init__(self, parent, value=value, **kws)

class Float(Node):
    def __init__(self, parent, value, **kws):
        if value[0] == ".": value = "0" + value
        Node.__init__(self, parent, value=value, **kws)

class Imag(Node):
    def __init__(self, parent, value, **kws):
        Node.__init__(self, parent, value=value, **kws)

class String(Node):
    def __init__(self, parent, value, **kws):
        value = value.replace("%", "__percent__")
        Node.__init__(self, parent, value=value, **kws)

class Lambda(Node):
    def __init__(self, parent, name="", **kws):
        Node.__init__(self, parent, name=name, **kws)

class Pragma_for(Node):
    def __init__(self, parent, value, **kws):
        Node.__init__(self, parent, value=value, **kws)

class Lcomment(Node):
    def __init__(self, parent, value, **kws):
        value = value.replace("%", "__percent__")
        Node.__init__(self, parent, value=value, **kws)

class Bcomment(Node):
    def __init__(self, parent, value, **kws):
        value = value.replace("%", "__percent__")
        Node.__init__(self, parent, value=value, **kws)

class Ecomment(Node):
    def __init__(self, parent, value, **kws):
        value = value.replace("%", "__percent__")
        Node.__init__(self, parent, value=value, **kws)

class Var(Node):
    def __init__(self, parent, name, **kws):
        Node.__init__(self, parent, name=name, **kws)
class Get(Var):         pass
class Set(Var):         pass

class Fvar(Node):
    def __init__(self, parent, name, value, **kws):
        Node.__init__(self, parent, name=name, value=value, **kws)

class Cvar(Node):
    def __init__(self, parent, name, **kws):
        Node.__init__(self, parent, name, **kws)

class Cget(Node):
    def __init__(self, parent, name, **kws):
        Node.__init__(self, parent, name=name, **kws)

class Fget(Node):
    def __init__(self, parent, name, value, **kws):
        Node.__init__(self, parent, name=name, value=value, **kws)

class Sget(Node):
    def __init__(self, parent, name, value, **kws):
        Node.__init__(self, parent, name=name, value=value, **kws)

class Nget(Node):
    def __init__(self, parent, name, **kws):
        Node.__init__(self, parent, name=name, **kws)

class Cset(Node):
    def __init__(self, parent, name, **kws):
        Node.__init__(self, parent, name=name, **kws)

class Fset(Node):
    def __init__(self, parent, name, value, **kws):
        Node.__init__(self, parent, name=name, value=value, **kws)

class Sset(Node):
    def __init__(self, parent, name, value, **kws):
        Node.__init__(self, parent, name=name, value=value, **kws)

class Nset(Node):
    def __init__(self, parent, name, **kws):
        Node.__init__(self, parent, name=name, **kws)

class Resize(Node):
    def __init__(self, parent, **kws):
        Node.__init__(self, parent, **kws)

class Verbatim(Node):
    def __init__(self, parent, name, value, **kws):
        Node.__init__(self, parent, name=name, value=value, **kws)


================================================
FILE: src/matlab2cpp/configure/__init__.py
================================================
from .frontend import configure, loop
from . import datatypes, backends, reserved


================================================
FILE: src/matlab2cpp/configure/armadillo.py
================================================
from ..rules import armadillo as arma


def vec(node):
    if len(node) != 1:

        if not len(node):
            return

        elif len(node) == 2 and node[1].cls == "Int" and node[1].value == "1":
            pass

        else:
            return


    arg, dim = arma.configure_arg(node[0], 0)

    if dim == 0:
        node.dim = 0

def rowvec(node):
    if len(node) != 1:

        if not len(node):
            return

        elif len(node) == 2 and node[0].cls == "Int" and node[0].value == "1":
            node_ = node[1]

        else:
            return
    else:
        node_ = node[0]


    arg, dim = arma.configure_arg(node_, 0)

    if dim == 0:
        node.dim = 0

def mat(node):
    # Single argument
    if len(node) == 1:

        arg, dim = arma.configure_arg(node[0], 0)

        # scalar begets scalar
        if dim == 0:
            node.dim = 0

    # Double argument
    elif len(node) == 2:

        arg0, dim0 = arma.configure_arg(node[0], 0)
        arg1, dim1 = arma.configure_arg(node[1], 1)

        # unknown input
        if -1 in (dim0, dim1):
            return

        # Configure dimensions
        if dim0:
            if dim1:
                node.dim = 3#matrix
            else:
                node.dim = 1#colvec
        else:
            if dim1:
                node.dim = 2#rowvec
            else:
                node.dim = 0#scalar

def cube(node):
    # Single argument
    if len(node) == 1:

        arg, dim = arma.configure_arg(node[0], 0)

        # scalar input
        if dim == 0:
            node.dim = 0

    # Double argument
    elif len(node) == 2:

        arg0, dim0 = arma.configure_arg(node[0], 0)
        arg1, dim1 = arma.configure_arg(node[1], 1)

        # unkonwn input
        if -1 in (dim0, dim1):
            return

        # Configure dimensions
        if dim0:
            if dim1:
                node.dim = 3
            else:
                node.dim = 1
        else:
            if dim1:
                node.dim = 2
            else:
                node.dim = 0

    # Triple argument
    elif len(node) == 3:

        arg0, dim0 = arma.configure_arg(node[0], 0)
        arg1, dim1 = arma.configure_arg(node[1], 1)
        arg2, dim2 = arma.configure_arg(node[2], 2)

        # unknown arguments
        if -1 in (dim0, dim1, dim2):
            return

        # Configure dimensions
        if dim0:
            if dim1:
                if dim2:
                    node.dim = 4#cube
                else:
                    node.dim = 3#matrix
            else:
                if dim2:
                    node.dim = 3#matrix
                else:
                    node.dim = 1#colvec

        else:
            if dim1:
                if dim2:
                    node.dim = 3#matrix
                else:
                    node.dim = 1#colvec
            else:
                if dim2:
                    node.dim = 1#colvec
                else:
                    node.dim = 0#scalar


================================================
FILE: src/matlab2cpp/configure/backends.py
================================================
Project = "program"
Program = "program"
Includes = "program"
Funcs = "program"
Inlines = "program"
Structs = "program"
Struct = "program"
Headers = "program"
Log = "program"
Header = "program"
Main = "func_return"
Error = "program"
Warning = "program"
Counter = "structs"
Inline = "program"
Include = "program"
Block = "code_block"
Parfor = "code_block"
For = "code_block"
While = "code_block"
Switch = "code_block"
Case = "code_block"
Otherwise = "code_block"
Branch = "code_block"
If = "code_block"
Elif = "code_block"
Else = "code_block"
Tryblock = "code_block"
Try = "code_block"
Catch = "code_block"
Statement = "code_block"
def Assigns(node):
    backend = node[-1].backend
    if backend in ("func_returns",):
        node.backend = backend
    elif backend != "unknown":
        node.backend = "code_block"
Expr = "expression"
Exp = "expression"
Elexp = "expression"
Mul = "expression"
Minus = "expression"
Elmul = "expression"
Matrixdivision = "expression"
Elementdivision = "expression"
Leftmatrixdivision = "expression"
Leftelementdivision = "expression"
Plus = "expression"
Colon = "expression"
Gt = "expression"
Ge = "expression"
Lt = "expression"
Le = "expression"
Ne = "expression"
Eq = "expression"
Band = "expression"
Bor = "expression"
Land = "expression"
Lor = "expression"
Paren = "expression"
Neg = "expression"
Not = "expression"
Ctranspose = "expression"
Transpose = "expression"
All = "expression"
End = "expression"
Break = "expression"
Return = "expression"
def Matrix(node):
    # matrix surround struct converts it to array
    if len(node) == 1 and len(node[0]) == 1:
        elem = node[0][0]
        if elem.backend != "unknown":
            node.backend = elem.backend

        if elem.backend != "unknown" and elem.backend not in ("struct", "structs"):
            node.backend = "matrix"
    else:
        node.backend = "matrix"

Vector = "matrix"
Cell = "cell"
Int = "int"
Float = "double"
Imag = "cx_double"
String = "string"
Lambda = "func_lambda"
Pragma_for = "code_block"
Tbb_for = "code_block"
Lcomment = "code_block"
Bcomment = "code_block"
Ecomment = "code_block"
def Fvar(node):
    """
Example:
    >>> print(matlab2cpp.qtree("a.b = 4.4; c = [a.b]", core=True, suggest=True)) #doctest: +NORMALIZE_WHITESPACE
    1   1Block      code_block   TYPE    
    1   1| Assign     double       double  
    1   1| | Fvar       struct       double  a
    1   7| | Float      double       double  
    1  12| Assign     struct       double  
    1  12| | Var        double       double  c
    1  16| | Matrix     struct       double  
    1  17| | | Vector     matrix       double  
    1  17| | | | Fvar       struct       double  a
    """
    declare = node.func[0][node.name]
    if declare.backend in ("struct", "structs"):
        node.backend = declare.backend

Cvar = "cell"
Cget = "cell"
Fget = "structs"
Sget = "structs"
Nget = "struct"
Cset = "cell"
Fset = "structs"
Sset = "structs"
Nset = "struct"
Resize = "cube_common"
Verbatim = "verbatim"

def Var(node):
    if node.type != "TYPE":
        node.backend = node.type
def Get(node):
    if node.type != "TYPE":
        node.backend = node.type
def Set(node):
    if node.type != "TYPE":
        node.backend = node.type

def Func(node):
    returns = node[1]
    if node.name[:1] == "_":
        node.backend = "func_lambda"
    elif len(returns) == 1:
        node.backend = "func_return"
    else:
        node.backend = "func_returns"
def Returns(node):
    if node.parent.name[:1] == "_":
        node.backend = "func_lambda"
    elif len(node) == 1 or node.parent.cls == "Main":
        node.backend = "func_return"
    else:
        node.backend = "func_returns"
def Params(node):
    returns = node.parent[1]
    if node.parent.name[:1] == "_":
        node.backend = "func_lambda"
    elif len(returns) == 1 or node.parent.cls == "Main":
        node.backend = "func_return"
    else:
        node.backend = "func_returns"
def Declares(node):
    returns = node.parent[1]
    if node.parent.name[:1] == "_":
        node.backend = "func_lambda"
    elif len(returns) == 1 or node.parent.cls == "Main":
        node.backend = "func_return"
    else:
        node.backend = "func_returns"

def Assign(node):
    node.backend = node[-1].backend


if __name__ == "__main__":
    import doctest
    doctest.testmod()


================================================
FILE: src/matlab2cpp/configure/datatypes.py
================================================

from .funcs import funcs
from . import armadillo, backends, frontend

Counter = "structs"

def Var(node):
    """
Example:
    >>> print(matlab2cpp.qcpp("a.b = 4; c = a"))
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    struct _A
    {
      int b ;
    } ;
    <BLANKLINE>
    int main(int argc, char** argv)
    {
      _A a, c ;
      a.b = 4 ;
      c = a ;
      return 0 ;
    }
    """

    if funcs(node):
        return

    if node.parent.cls == "Assign" and node.parent[0] is node:
        #assign b = [a.val], a is a structs, suggest vec -> dim=1
        if node.parent[1].cls == "Matrix" and \
          node.parent[1].backend == "structs" and len(node.parent[1][0]) == 1:
            node.declare.suggest = (1, node.parent[1].mem)
        #assign b = a, where a is a struct/structs.
        #This code sets b backend and type to a's backend and type
        elif node.parent[1].cls in ("Var",)\
                and node.parent[1].backend in ("struct", "structs"):

            backend = node.parent[1].backend

            node.parent[1].declare
            if hasattr(node.parent[1], "_declare"):

                node.declare.type = backend
                node.declare.backend = backend
                node.declare._declare = node.parent[1]._declare
                node._declare = node.parent[1]._declare
                node.backend = backend

        else:
            node.declare.suggest = node.parent[1].type
    
    if node.declare.type != "TYPE":
        node.type = node.declare.type


def Get(node):

    if funcs(node):
        return

    #in backends.py backend is set to datatype. If a is rowvec,
    #i want a(2) to have backend rowvec and and datatype double
    #This code sets backend to rowvec, and below datatype is set
    #Thus backend is set before datatype is changed to double
    #backends.Get(node)
    
    #vec
    if node.declare.dim == 1:
        backends.Get(node)
        armadillo.vec(node)
        return

    #rowvec
    if node.declare.dim == 2:
        backends.Get(node)
        armadillo.rowvec(node)
        return

    #mat
    if node.declare.dim == 3:
        backends.Get(node)
        armadillo.mat(node)
        return

    #cube
    if node.declare.dim == 4:
        backends.Get(node)
        armadillo.cube(node)
        return
    
    if node.parent.cls == "Assign" and node.parent[0] is node:
        node.declare.suggest = node.parent[1].type

    if node.declare.type != "TYPE":
        node.type = node.declare.type

def Set(node):

    #in backends.py backend is set to datatype. If a is rowvec,
    #i want a(2) to have backend rowvec and and datatype double
    #This code sets backend to rowvec, and below datatype is set
    #Thus backend is set before datatype is changed to double
    #backends.Get(node)
    
    #vec
    if node.declare.dim == 1:
        backends.Get(node)
        armadillo.vec(node)
        return

    #rowvec
    if node.declare.dim == 2:
        backends.Get(node)
        armadillo.rowvec(node)
        return

    #mat
    if node.declare.dim == 3:
        backends.Get(node)
        armadillo.mat(node)
        return

    #cube
    if node.declare.dim == 4:
        backends.Get(node)
        armadillo.cube(node)
        return
    
    if node.parent.cls == "Assign":
        node.declare.suggest = node.parent[1].type

    if node.declare.type != "TYPE":
        node.type = node.declare.type
        
    
def Fvar(node):

    if node.parent.cls == "Assign" and node.parent[0] is node:
        node.declare.suggest = node.parent[1].type

    if node.declare.type != "TYPE":
        node.type = node.declare.type

def Fset(node):

    if node.parent.cls == "Assign":
        node.declare.suggest = node.parent[1].type

    if node.declare.type != "TYPE":
        node.type = node.declare.type

def Sset(node):

    if node.parent.cls == "Assign":
        node.declare.suggest = node.parent[1].type

    if node.declare.type != "TYPE":
        node.type = node.declare.type


def Assign(node):
    if node[1].type == "TYPE":
        return
    node.type = node[1].type
    # node[0].declare.suggest = node[1].type


def Vector(node):

    # default to common denominator
    node.type = [n.type for n in node]

    # dimensionality in vector
    dims = {n.dim for n in node}

    # non-numerical elements in vector isn't addresed
    if None in dims or [n for n in node if not n.num]:

        # keep it simple of single elements
        if len(node) == 1:
            node.type = node[0].type
        return

    # single element in vector
    if len(node) == 1:

        if dims == {0}:
            # holder value to determine if vector is in decomposed state
            node.value = "scalarsonly"
        else:
            node.value = ""

        node.dim = list(dims)[0]
        return

    # only colvecs
    elif dims == {1}:
        node.dim = 1
        nodes = [str(n) for n in node]

    # Decomposed row
    if dims == {0}:
        node.value = "scalarsonly"
        node.dim = 2

    # only rowvecs
    elif dims == {2}:
        node.dim = 2

    # mix of scalars and rowvecs
    elif dims == {0, 2}:
        node.dim = 2

    # mix of matrices and colvecs
    elif dims in ({3}, {1, 3}):
        node.dim = 3

def Matrix(node):

    node.type = [n.type for n in node]

    dims = {n.dim for n in node}

    # single vector with no content
    if len(node) == 1 and len(node[0]) == 0:
        node.num = False
        return

    # everything on scalarsonly form
    elif all([n.value for n in node]):
        node.value = "scalarsonly"

        # set dimensions
        ax0, ax1 = len(node), len(node[0])
        if ax0 > 1:
            if ax1 > 1:
                node.dim = 3#matrix
            else:
                node.dim = 1#rowvec
        else:
            if ax1 > 1:
                node.dim = 2#colvec
            else:
                node.dim = 0#scalar

    elif dims in ({0,1}, {1}):

        # configure dimensions
        if len(node[0])>1:
            node.dim = 3#matrix
        else:
            node.dim = 1#colvec

    # mix of rowvecs and matrices
    elif dims in ({2}, {3}, {2,3}):

        # configure dimensiosn
        if dims == {2} and len(node)==1:
            node.dim = 2#rowvec
        else:
            node.dim = 3#matrix



def Transpose(node):

    node.type = node[0].type
    if node[0].num:
        if node[0].dim == 1:
            node.dim = 2
            return
        elif node[0].dim == 2:
            node.dim = 1
            return

Ctranspose = Transpose

def For(node):
    node[0].suggest = "int"
    #node[0].suggest = "uword"
    #index = node.parent.children.index(node)
    #tbb = node.parent.children[index - 1].cls

    #if tbb == "Tbb_for":
    #    node[0].type = "uword"

def Neg(node):
    node.type = node[0].type
    if node[0].mem == 0:
        node.mem = 1


def opr(node):
    node.type = [n.type for n in node]

Plus = opr
def Minus(node):
    opr(node)
    if node.mem == 0:
        node.mem = 1

def Mul(node):
    opr(node)
    if "TYPE" in (n.type for n in node):
        return
    mem = max([n.mem for n in node])
    if node[0].dim == 2 and node[1].dim == 1:
        node.type = (0, mem)
    elif node.dim == 1 and node[1].dim == 2:
        node.type = (3, mem)

Elmul = opr
Paren = opr
def Exp(node):
    opr(node)

    if node.num and node.mem < 2:
        node.mem = 3

def Elexp(node):
    node.type = [n.type for n in node]

End = "int"
Int = "int"
Float = "double"
String = "string"
Imag = "cx_double"
def division(node):
    opr(node)
    if node.num and node.mem < 2:
        node.mem = 3
Matrixdivision = division
Elementdivision =  division
Leftmatrixdivision = division
Leftelementdivition = division

All = "uvec"

def Colon(node):
    # context: array argument (must always be uvec)
    if node.group.cls in ("Get", "Cget", "Nget", "Fget", "Sget",
                "Set", "Cset", "Nset", "Fset", "Sset") and \
                node.parent.backend not in ("func_return", "func_returns", "reserved", "func_lambda"):
        node.type = "uvec"

    else:

        # context: matrix concatination
        if node.group.cls in ("Matrix",) and node.group.num:
            node.type = "rowvec"

        # context: pass to function
        elif node.parent.cls in ("Get", "Cget", "Nget", "Fget", "Sget",
                "Set", "Cset", "Nset", "Fset", "Sset"):
            node.type = "rowvec"

        # context: assignment
        elif node.group.cls in ("Assign",) and node.group[0].num:
            node.type = "rowvec"

        else:
            node.type = "rowvec"

def Lambda(node):

    # lambda function are created as full functions, but referenced to be
    # written inline
    lfunc = node.program[1][node.name]
    ldeclares, lreturns, lparams, lblock = lfunc
    lnames = lparams.names + ldeclares.names
    expr = lblock[0][1]

    # location for where lambda is created
    func = node.func
    declares, returns, params, block = func

    # Lambda creates a local scope
    # e.g. in expressions like '@(x) x*y'
    # 'x' is in one scope and 'y' is in another.
    # This little hack iterates the expression of the function in
    # search for vars/calls etc. like 'y' and declares them with
    # the right types.
    nodes = [expr]
    for node_ in nodes:
        nodes.extend(node_[:])

        # a variable
        if node_.cls in ["Var", "Cvar", "Fvar",
                "Get", "Cget", "Fget", "Nget"]:
            name = node_.name

            # not in lambda scope
            if name not in lnames:

                # defined as a parameter in function
                if name in params.names:
                    type = params[params.names.index(name)].type
                    node_.type = type
                    node_.declare.type = type

                # declared in function
                elif name in declares.names:
                    type = declares[declares.names.index(name)].type
                    node_.type = type
                    node_.declare.type = type

    frontend.configure(lfunc)
    # declare list in lambda function
    if ldeclares["_retval"].type != "TYPE":
        declares[node.name[1:]].type = "func_lambda"
        node.parent.type = "func_lambda"
        node.parent[0].type = "func_lambda"
    node.type = "func_lambda"


def Assigns(node):
    if node[-1].type != "TYPE":
        node.type = node[-1].type


if __name__ == "__main__":
    import doctest
    doctest.testmod()


================================================
FILE: src/matlab2cpp/configure/frontend.py
================================================


def configure(root, suggest=True, **kws):
    """
configure backend

See also:
    :py:func:`matlab2cpp.Builder.configure <Builder.configure>`
    """
    from .. import tree

    if isinstance(root, tree.Builder):
        root = root.project

    loop(root, suggest)
    loop(root, suggest)

def loop(root, suggest):
    from . import datatypes, backends, reserved

    nodes = root.flatten(False, True, True)

    while True:

        # loop and configure
        for node in nodes:

            # reserved stuff
            if node.cls + "_" + node.name in reserved.__dict__:
                rule = reserved.__dict__[node.cls+"_"+node.name]
                if isinstance(rule, str):
                    node.type = rule
                else:
                    rule(node)

            # Datatype stuff
            if node.prop["type"] != "TYPE":
                pass

            elif node.cls in datatypes.__dict__:
                datatype = datatypes.__dict__[node.cls]
                if isinstance(datatype, str):
                    node.type = datatype
                else:
                    datatype(node)

            # Backend stuff
            if node.backend != "unknown":
                pass

            elif node.cls in backends.__dict__:
                backend = backends.__dict__[node.cls]
                if isinstance(backend, str):
                    node.backend = backend
                else:
                    backend(node)

        # determine if done
        if suggest:

            complete = True

            for program in root.project:
                
                suggests = program.suggest
                program.stypes = suggests
                program.ftypes = suggests
                complete = complete and not any([any(v) for v in suggests.values()])

            if complete:
                break

        else:
            break

    # delete log, if any (create on translate)
    for program in root.project:
        program[-1].children = []


================================================
FILE: src/matlab2cpp/configure/funcs.py
================================================
import os

def funcs(node):

    func = None

    # lambda scope
    if "_" + node.name in node.program[1]:
        func = node.program[1]["_" + node.name]

    # local scope
    elif node in node.program[1]:
        func = node.program[1][node]

    # external file in same folder
    else:

        for program in node.project:

            # don't use the file your in as external library
            if program is node.program:
                continue

            if os.path.basename(program.name) == node.name+".m":
                func = program[1][0]
                break
        else:
            return False

    node.backend = func.backend

    if node.backend == "func_return":

        node.backend = func.backend
        node.declare.type = func[1][0].type
        params = func[2]

        for i in range(len(node)):
            try:
                params[i].suggest = node[i].type
                node[i].suggest = params[i].type
            except:
                pass

    elif node.backend == "func_returns":
        node.backend = func.backend
        params = func[2]

        for j in range(len(params)):
            try:
                params[j].suggest = node[j].type
                node[j].suggest = params[j].type
            except:
                pass

        if node.parent.cls == "Assigns":
            # node.parent.backend = "func_returns"

            returns = func[1]
            # Got out_of_bounds error, len(returns) where longer than LHS,
            # so i changed for range to min LHS vars and returns from function
            for j in range(min(len(node.parent), len(returns))):
                returns[j].suggest = node.parent[j].type
                node.parent[j].suggest = returns[j].type

    elif node.backend == "func_lambda":

        ret = func[1][0]
        node.suggest = ret.type
        ret.suggest = node.type
        if node.type != "TYPE":
            node.declare.type = "func_lambda"

        params = func[2]
        for i in range(len(node)):
            params[i].suggest = node[i].type

    return True



================================================
FILE: src/matlab2cpp/configure/reserved.py
================================================
Var_false = "int"
Var_true = "int"
Var_pi = "double"
Get_linspace = "rowvec"

def Get_exp(node):
    node.type = node[0].type

def Get_log(node):
    node.type = node[0].type

def Get_log2(node):
    node.type = node[0].type

def Get_log10(node):
    node.type = node[0].type

def Get_power(node):
    node.type = node[0].type

def Get_floor(node):
    node.type = node[0].type

def Get_ceil(node):
    node.type = node[0].type

def Get_fix(node):
    node.type = node[0].type

def Get_round(node):
    if len(node) == 1:
        #int, float, double, uword
        if node[0].dim == 0 and node[0].mem != 4:
            node.type = "double"
        #arma types
        elif node[0].dim != 0:
            node.type = node[0].type

def Get_cos(node):
    node.type = node[0].type

def Get_acos(node):
    node.type = node[0].type

def Get_cosh(node):
    node.type = node[0].type

def Get_acosh(node):
    node.type = node[0].type

def Get_sin(node):
    node.type = node[0].type

def Get_asin(node):
    node.type = node[0].type

def Get_sinh(node):
    node.type = node[0].type

def Get_asinh(node):
    node.type = node[0].type

def Get_sqrt(node):
    #if len(node) > 0 ...
    if len(node) and node[0].cls == "Neg":
        node.type = "cx_double"
    elif len(node):
        node.type = node[0].type

def Get_mod(node):
    node.type = node[0].type

def Get_abs(node):
    if node[0].type in ("cx_double", "cx_mat"):
        node.type = "mat"
    else:
        node.type = node[0].type

def Get_tic(node):
    node.type = "double"

def Assign_tic(node):
    node[0].declare.type = "double"
    node[0].type = "double"

def Get_toc(node):
    node.type = "double"

def Assign_toc(node):
    node[0].declare.type = "double"
    node[0].type = "double"

def Get_any(node):
    if not node[0].num:
        return

    node.type = node[0].type

    # colvec or rowvec
    if node.dim in (1,2):
        node.dim = 0

    # matrix
    elif node.dim == 3:

        # axis input decides by second input
        if len(node) == 2:

            if  node[1].cls == "Int":
                val = node[1].value
                if val == "1":
                    node.dim = 2
                elif val == "2":
                    node.dim = 1

            # problem if arg not explicit
            else:
                node.num = False

    # cube
    else:
        node.dim = 3

Get_all = Get_any

Get_isequal = "int"

def Get_size(node):

    # unknown input
    if node[0].type == "TYPE" or node.parent.cls == "Assigns":
        return

    var = str(node[0])

    # multiple args
    if len(node) > 1:
        
        # determine ax from second arg
        node.type = "uword"

    # colvec or rowvec
    elif node[0].dim in (1,2):
        """
        if node.parent.backend == "reserved" and\
          node.parent.name in ("min", "max"):
            node.type = "uword"
            return
        if len(node) == 1:
            node.type = "urowvec"
            return
        node.type = "uword"
        """
        
        node.type = "urowvec"

        if node.parent.backend == "reserved" and\
          node.parent.name in ("min", "max"):
            node.type = "uword"
            return
        if len(node) == 1:
            node.type = "urowvec"
            return

        if node.parent.cls == "Get":
            return

        # inline calls moved to own line
        if node.parent.cls not in ("Statement", "Assign"):
            return

        node.parent.backend = "reserved"
        node.parent.name = "size"
        
    # matrix (returns two values)
    elif node[0].dim == 3:
        node.type = "urowvec"

        if node.parent.backend == "reserved" and\
          node.parent.name in ("min", "max"):
            node.type = "uword"
            return

        if node.parent.cls == "Get":
            return

        # inline calls moved to own line
        if node.parent.cls not in ("Statement", "Assign"):
            return

        node.parent.backend = "reserved"
        node.parent.name = "size"

    # cube (return three values)
    elif node[0].dim == 4:
        node.type = "urowvec"

        if node.parent.cls == "Get":
            return

        # inline calls moved to own line
        if node.parent.cls not in ("Statement", "Assign"):
            return

        node.parent.backend = "reserved"
        node.parent.name = "size"

def Assigns_size(node):

    # suggest some types for matrix
    if len(node)==3:
        node[0].suggest = "int"
        node[1].suggest = "int"

    # suggest some types for cube
    if len(node)==4:

        node[0].suggest = "int"
        node[1].suggest = "int"
        node[2].suggest = "int"

def Get_length(node):
    node.type = "uword"

def Get_min(node):

    # everything scalar
    if not all([n.num for n in node]) or  all([(n.dim < 1) for n in node]):
        if any([n.mem == 4 for n in node]):
            node.type = "cx_mat"
        return

    node.type = node[0].type

    # single arg
    if len(node) == 1:

        # determine node dimensions
        if node.dim == 2:
            node.dim = 0
        else:
            node.dim = node.dim-1

    # three args
    if len(node) == 3:
        if node[2].dim == 0:

            # assues third arg is int and sets axis
            val = node[2].value
            if val == "1":
                node.dim = 2
            elif val == "2":
                node.dim = 1
            else:
                node.num = False
            
def Assigns_min(node):
    assert len(node) == 3

    var = node[2][0]

    # non-numerical assignment
    if not var.num:
        pass
    else:
        node[0].suggest = (0, var.mem)
        node[1].suggest = "int"

Get_max = Get_min

def Assigns_max(node):
    assert len(node) == 3

    # right hand side of assignment
    var = node[-1]

    # non-numerical input
    if not var.num:
        pass
    else:
        node[0].suggest = (0, var.mem)
        node[1].suggest = "int"

def Get_fliplr(node):
    if len(node) > 0:
        node.type = node[0].type

def Get_flipud(node):
    if len(node) > 0:
        node.type = node[0].type

def Get_eye(node):
    #set eye type to cx_mat if LHS is complex type
    if node.group.cls == "Assign" and node.group[0].mem == 4:
        node.type = "cx_mat"
    else:
        node.type = "mat"
    
def Get_diag(node):
    if len(node) > 0:
        if node[0].dim == 3:
            node.type = (1, node[0].mem)
        elif node[0].dim in (1, 2):
            node.type = (3, node[0].mem)

def Get_tril(node):
    if node[0].mem:
        node.type = (3, node[0].mem)

def Get_triu(node):
    if node[0].mem:
        node.type = (3, node[0].mem)
        
Var_eye = Get_eye

def Get_trace(node):
    node.type = node[0].type

def Get_transpose(node):
    """Simple transpose
    """

    # colvec -> rowvec 
    if node[0].dim == 1:
        node.type = (2, node[0].mem)

    # rowvec -> colvec
    elif node[0].dim == 2:
        node.type = (1, node[0].mem)

    else:
        node.type = node[0].type
    
def Get_ctranspose(node):
    """Complex transpose
    """

    # colvec -> rowvec 
    if node[0].dim == 1:
        node.type = (2, node[0].mem)

    # rowvec -> colvec
    elif node[0].dim == 2:
        node.type = (1, node[0].mem)

    else:
        node.type = node[0].type

def Get_zeros(node):

    node.type = "uword"
    dim, mem = node.suggest_datatype()
    
    # set memory type
    if not (mem is None):
        node.mem = mem
    else:
        node.mem = 3

    #if node.group.cls == "Matrix" and node.group.group.cls == "Assign" and len(node.group.group) == 2:
    #    if node.group.group[0].mem == 4:
    #        node.mem = 4

    # reset to uword if arg of array-node
    if node.group.cls in ("Get", "Cget", "Fget", "Nget", "Sget", "Set", "Cset",
            "Fset", "Nset", "Sset") and node.group.num:
        node.mem = 0
        if len(node) == 2 and node[0].cls == "Int" and node[0].value == "1":
            node.dim = 1
            return
    
    # one argument
    if len(node) == 1:
        
        # arg input is vector
        if node[0].num and node[0].dim in (1,2):
            pass

        else:

            # use suggestions or defualts
            if dim in (1,2,3):
                node.dim = dim
            else:
                node.dim = 3 # default

    # double argument creates colvec/rowvec/matrix depending on context
    elif len(node) == 2:

        # use matrix, if suggested
        if dim == 3:
            node.dim = 3

        # use colvec if first index is '1'
        elif node[0].cls == "Int" and node[0].value == "1":
            node.dim = 2

        # use rowvec if second index is '1'
        elif node[1].cls == "Int" and node[1].value == "1":
            node.dim = 1

        # default to matrix
        else:
            node.dim = 3

    # triple arg create cube
    elif len(node) == 3:
        node.dim = 4

Get_ones = Get_zeros

Var_rand = "vec"

def Get_rand(node):

    # Get type from left hand side of assignment
    if node.group.cls == "Assign":
        if node.group[0].type != "TYPE":
            node.type = node.group[0].type
            return

    # one arg
    if len(node) == 1:
        node.type = "vec"

    # two args
    elif len(node) == 2:
        node.type = "mat"

    # three args -> cube
    elif len(node) == 3:
        node.type = "cube"

def Get_reshape(node):
    if node[0].mem:
        node.type = (3, node[0].mem)

def Get_nextpow2(node):
    node.type = "int"
    
def Get_fft(node):

    node.type = node[0].type
    if node.type != 'TYPE':
        node.mem = 4
    #if node.mem == 4:
    #    node.mem = 4
    #elif node.mem == 3:
    #    node.mem = 4

def Get_ifft(node):

    #assert(node[0].mem == 4)
    node.type = node[0].type
    if node.type != 'TYPE':
        node.mem = 4

    #if node.mem == 4:
    #    node.mem = 3
    #elif node.mem == 3:
    #    node.mem = 3

    # unknown input
    #if not node.num:
    #    pass
    #else:
    #    node.mem = 4


def Get_interp1(node):
    if len(node):
        node.type = node[0].type

def Get_sum(node):

    arg = node[0]

    # unknown input
    if not arg.num or arg.dim == 0:
        return

    node.type = arg.type

    # determine output dimensions
    if arg.dim == 2:
        dim = 0
    elif arg.dim == 3:
        # sum along an axis
        if len(node) == 2 and node[1].cls == "Int" and node[1].value == "2":
            dim = 1
        else:
            dim = 2
    else:
        if arg.dim == 3:
            dim = 2
        elif arg.dim == 2:
            arg.dim == 0
        else:
            dim = arg.dim-1
    node.dim = dim

def Get_cumsum(node):
    node.type = node[0].type

def Get_conj(node):
    node.type = node[0].type

def Get_real(node):
    if node[0].dim:
        node.type = (node[0].dim, 3)
    #arg = node[0]
    #
    # output always real
    #if arg.mem:
    #    node.type = (3, arg.mem)

def Get_convmtx(node):
    node.type = node[0].type

def Get_conv2(node):
    node.type = [node[0].type, node[1].type]

def Get_logspace(node):
    node.type = "rowvec"

def Get_find(node):
    node.type = "uvec"

Get_tic = "string"

Get_toc = "string"


================================================
FILE: src/matlab2cpp/datatype.py
================================================
"""
The follwing constructor classes exists here:

+------------------------------------------+---------------------------------------+
| Class                                    | Description                           |
+==========================================+=======================================+
| :py:class:`~matlab2cpp.datatype.Type`    | Frontend for the datatype string      |
+------------------------------------------+---------------------------------------+
| :py:class:`~matlab2cpp.datatype.Dim`     | Reference to the number of dimensions |
+------------------------------------------+---------------------------------------+
| :py:class:`~matlab2cpp.datatype.Mem`     | Reference to the memory type          |
+------------------------------------------+---------------------------------------+
| :py:class:`~matlab2cpp.datatype.Num`     | Numerical value indicator             |
+------------------------------------------+---------------------------------------+
| :py:class:`~matlab2cpp.datatype.Suggest` | Frontend for suggested datatype       |
+------------------------------------------+---------------------------------------+
"""
from . import supplement


dim0 = {"int", "float", "uword", "double", "cx_double", "size_t"}
dim1 = {"ivec", "fvec", "uvec", "vec", "cx_vec"}
dim2 = {"irowvec", "frowvec", "urowvec", "rowvec", "cx_rowvec"}
dim3 = {"imat", "fmat", "umat", "mat", "cx_mat"}
dim4 = {"icube", "fcube", "ucube", "cube", "cx_cube"}

dims = [dim0, dim1, dim2, dim3, dim4]

mem0 = {"uword", "uvec", "urowvec", "umat", "ucube"}
mem1 = {"int", "ivec", "irowvec", "imat", "icube"}
mem2 = {"float", "fvec", "frowvec", "fmat", "fcube"}
mem3 = {"double", "vec", "rowvec", "mat", "cube"}
mem4 = {"cx_double", "cx_vec", "cx_rowvec", "cx_mat", "cx_cube"}

mems = [mem0, mem1, mem2, mem3, mem4]

others = {"char", "string", "TYPE", "func_lambda", "struct", "structs", "cell",
        "wall_clock", "SPlot"}


def common_loose(vals):
    """Common denominator among several names.
Loose enforcment"""

    if not isinstance(vals, (tuple, list)) or \
            isinstance(vals[0], int):
        vals = [vals]
    vals = list(vals)

    for i in range(len(vals)):
        if isinstance(vals[i], str):
            continue
        if isinstance(vals[i][0], int):
            vals[i] = get_name(*vals[i])

    vals = set(vals)

    if len(vals) == 1:
        return vals.pop()

    vals.discard("TYPE")

    if len(vals) == 1:
        return vals.pop()

    for other in others:
        vals.discard(other)

    if len(vals) == 0:
        return "TYPE"
    elif len(vals) == 1:
        return vals.pop()

    dims_ = map(get_dim, vals)
    if dims_:
        dim = max(*dims_)
    else:
        return "TYPE"
    if dim == 2 and 1 in dims_:
        dim = 3

    types = map(get_mem, vals)
    type = max(*types)

    val = get_name(dim, type)
    return val


def common_strict(vals):
    """Common denominator among several names.
Strict enforcment"""

    if not isinstance(vals, (tuple, list)) \
            or isinstance(vals[0], int):
        vals = [vals]

    vals = list(vals)

    for i in range(len(vals)):
        if isinstance(vals[i], str):
            continue
        if isinstance(vals[i][0], int):
            vals[i] = get_name(*vals[i])

    vals = set(vals)

    if len(vals) == 1:
        return vals.pop()

    for other in others:
        if other in vals:
            return "TYPE"

    dims_ = map(get_dim, vals)
    dim = max(*dims_)
    if dim == 2 and 1 in dims_:
        return "TYPE"

    types = map(get_mem, vals)
    type = max(*types)

    val = get_name(dim, type)
    return val

def pointer_split(name):
    p = name.count("*")
    if not p:
        return 0, name
    return p, name[:-p]


def get_dim(val):

    while val[-1] == "*":
        val = val[:-1]

    if val in dim0:     dim = 0
    elif val in dim1:   dim = 1
    elif val in dim2:   dim = 2
    elif val in dim3:   dim = 3
    elif val in dim4:   dim = 4
    elif val in others: dim = None
    else:
        raise ValueError("Datatype '%s' not recognized" % val)
    return dim


def get_mem(val):

    while val[-1] == "*":
        val = val[:-1]

    if val in mem0:    mem = 0
    elif val in mem1:  mem = 1
    elif val in mem2:  mem = 2
    elif val in mem3:  mem = 3
    elif val in mem4:  mem = 4
    elif val in others: mem = None
    else:
        raise ValueError("Datatype '%s' not recognized" % val)

    return mem

def get_num(val):

    while val[-1] == "*":
        val = val[:-1]

    if val in others:   num = False
    else:               num = True

    return num


def get_name(dim, mem):
    return dims[dim].intersection(mems[mem]).pop()


def get_type(instance):

    if instance.prop["type"] == "TYPE":
        instance = instance.declare
    return instance.prop["type"]

class Dim(object):
    """
The `node.dim` is a help variable for handling numerical datatype.
It represents the number of dimension a numerical object represents:

+-------+--------------+
| *dim* | Description  |
+=======+==============+
| 0     | scalar       |
+-------+--------------+
| 1     | (col-)vector |
+-------+--------------+
| 2     | row-vector   |
+-------+--------------+
| 3     | matrix       |
+-------+--------------+
| 4     | cube         |
+-------+--------------+
| None  | Other        |
+-------+--------------+

The variable can be both read and set in real time:

    >>> node = collection.Var(None, "name")
    >>> node.type="float"
    >>> print(node.dim)
    0
    >>> node.dim = 3
    >>> print(node.type)
    fmat
    """

    def __get__(self, instance, owner):
        if instance is None:
            return self
        return get_dim(get_type(instance))

    def __set__(self, instance, value):
        mem = get_mem(get_type(instance))
        instance.prop["type"] = get_name(value, mem)


class Mem(object):
    """
The `node.mem` is a help variable for handling numerical datatype.
It represents the internal basic datatype represented in memory:

+-------+-------------+
| *mem* | Description |
+=======+=============+
| 0     | unsiged int |
+-------+-------------+
| 1     | integer     |
+-------+-------------+
| 2     | float       |
+-------+-------------+
| 3     | double      |
+-------+-------------+
| 4     | complex     |
+-------+-------------+
| None  | Other       |
+-------+-------------+

The variable can be both read and set in real time:

    >>> node = collection.Var(None, "name")
    >>> node.type="float"
    >>> print(node.mem)
    2
    >>> node.mem = 3
    >>> print(node.type)
    double
    """

    def __get__(self, instance, owner):
        if instance is None:
            return self
        return get_mem(get_type(instance))

    def __set__(self, instance, value):
        dim = get_dim(get_type(instance))
        instance.prop["type"] = get_name(dim, value)


class Num(object):
    """
The `node.num` is a help variable for handling numerical datatype.  It is
a boolean values which is true given that the datatype is of numerical type.
    """

    def __get__(self, instance, owner):
        if instance is None:
            return self
        return get_num(get_type(instance))

    def __set__(self, instance, value):
        if not value:
            instance.prop["type"] = "TYPE"
        else:
            raise AttributeError("num can not be set True consistently")


class Type(object):
    """
Datatypes can be roughly split into two groups: **numerical** and
**non-numerical** types.  The numerical types are as follows:

+-------------+--------------+-----------+-----------+----------+-------------+
|             | unsigned int | int       | float     | double   | complex     |
+=============+==============+===========+===========+==========+=============+
| scalar      | *uword*      | *int*     | *float*   | *double* | *cx_double* |
+-------------+--------------+-----------+-----------+----------+-------------+
| vector      | *uvec*       | *ivec*    | *fvec*    | *vec*    | *cx_vec*    |
+-------------+--------------+-----------+-----------+----------+-------------+
| row\-vector | *urowvec*    | *irowvec* | *frowvec* | *rowvec* | *cx_rowvec* |
+-------------+--------------+-----------+-----------+----------+-------------+
| matrix      | *umat*       | *imat*    | *fmat*    | *mat*    | *cx_mat*    |
+-------------+--------------+-----------+-----------+----------+-------------+
| cube        | *ucube*      | *icube*   | *fcube*   | *cube*   | *cx_cube*   |
+-------------+--------------+-----------+-----------+----------+-------------+

Values along the horizontal axis represents the amount of memory reserved per
element, and the along the vertical axis represents the various number of
dimensions.  The names are equivalent to the ones in the Armadillo package.

The non-numerical types are as follows:

+---------------+------------------------+
| Name          | Description            |
+===============+========================+
| *char*        | Single text character  |
+---------------+------------------------+
| *string*      | Text string            |
+---------------+------------------------+
| *struct*      | Struct container       |
+---------------+------------------------+
| *structs*     | Struct array container |
+---------------+------------------------+
| *func_lambda* | Anonymous function     |
+---------------+------------------------+

The node datatype can be referenced by any node through `node.type` and can be
inserted as placeholder through `%(type)s`.
    """

    def __get__(self, instance, owner):
        if instance is None:
            return self
        return get_type(instance)

    def __set__(self, instance, value):
        value = value or "TYPE"
        if isinstance(value, str):
            p, value = pointer_split(value)
            instance.pointer = p
        else:
            value = common_strict(value)
        instance.prop["type"] = value


class Suggest(object):
    """Same as Type, but for suggested value.
    """

    def __set__(self, instance, value):
        if value == "TYPE":
            return
        instance.declare.prop["suggest"] = value
    def __get__(self, instance, owner):
        return supplement.suggests.get(instance)

if __name__ == "__main__":
    import doctest
    doctest.testmod()


================================================
FILE: src/matlab2cpp/frontend.py
================================================
"""Execute main parser."""
import time
from datetime import datetime as date
import os
from os.path import sep
import imp

from . import supplement, tree, qfunctions, modify, setpaths
from .__init__ import __version__


def execute_parser(args):
    """
Initiate the interpretation and conversion process.

Args:
    args (ArgumentParser): arguments parsed through m2cpp
    """

    builder = tree.builder.Builder(
        disp=args.disp,
        comments=args.comments,
        original=args.original,
        enable_omp=args.enable_omp,
        enable_tbb=args.enable_tbb,
        reference=args.reference,
    )

    paths_from_file = []
    #read setpath.m file and return string list of paths
    if args.paths_file:
        if os.path.isfile(args.paths_file):
            paths_from_file = setpaths.multiple_folder_paths(args.paths_file)
        else:
            raise IOError("File '" + args.paths_file + "' not found")

    #pathOne = os.path.dirname(os.path.abspath(args.filename))

    if os.path.isfile(args.filename):

        paths = [os.path.abspath(os.path.dirname(args.filename))]
        paths += paths_from_file

        if args.disp:
            print("building tree...")

        filenames = [os.path.abspath(args.filename)]

        stack = []
        while filenames:

            filename = filenames.pop(0)
            assert os.path.isfile(filename)

            if filename in stack:
                continue

            if args.disp:
                print("loading", filename)

            stack.append(filename)

            f = open(filename, "rU")
            code = f.read()
            f.close()

            #code = re.sub('%#', '##', code)

            #Here you have to change filename to current folder for .py files
            #local_name = pathOne + sep + os.path.basename(filename)
            local_name = os.getcwd() + sep + os.path.basename(filename)

            if os.path.isfile(local_name + ".py") and not args.reset:

                try:
                    cfg = imp.load_source("cfg", local_name + ".py")

                except:
                    raise ImportError("""Supplement file:
    %s.py
    is formated incorrectly. Change the format or convert with '-r' option to create
    a new file.""" % local_name)

                if "verbatims" in cfg.__dict__ and cfg.verbatims:
                    verbatims = cfg.verbatims
                    code = supplement.verbatim.set(verbatims, code)

                builder.load(filename, code)
                program = builder[-1]

                if "functions" in cfg.__dict__:

                    funcs = program.ftypes

                    for name in funcs.keys():
                        if name in cfg.functions:
                            for key in cfg.functions[name].keys():
                                funcs[name][key] = cfg.functions[name][key]

                    program.ftypes = funcs

                if "structs" in cfg.__dict__:

                    structs = program.stypes

                    for name in structs.keys():
                        if name in cfg.structs:
                            for key in cfg.structs[name].keys():
                                structs[name][key] = cfg.structs[name][key]

                    program.stypes = structs

                if "includes" in cfg.__dict__:

                    includes = program.itypes

                    for key in cfg.includes:
                        if key not in includes:
                            includes.append(key)

                    includes = [i for i in includes if supplement.includes.write_to_includes(i)]

                    program.itypes = includes

            else:
                builder.load(filename, code)
                program = builder[-1]

            # add unknown variables to stack if they exists as files
            unknowns = builder.get_unknowns(filename)

            for i in range(len(unknowns)-1, -1, -1):
                #print(i)
                for path in paths:
                    #print(path)
                    if os.path.isfile(path + sep + unknowns[i] + ".m"):
                        unknowns[i] = unknowns[i] + ".m"
                    if os.path.isfile(path + sep + unknowns[i]):
                        program.include(path + sep + unknowns[i])
                        #filenames.append(path + sep + unknowns.pop(i))
                        filenames.append(path + sep + unknowns[i])


    else:
        builder.load("unnamed", args.filename)
        program = builder[-1]

    #--- work in progress ---
    #Run this mlabwrap code
    #Have this in a try-except block
    #import mwrapmat
    #wrapmat = mwrapmat.Wrapmat()
    #wrapmat.eval_code(builder)
    #------------------------

    #--- work in progress ---
    #Get data types from matlab
    if args.matlab_suggest:
        from . import matlab_types
        builder = matlab_types.mtypes(builder, args)
    #------------------------

    if args.disp:
        print("configure tree")

    builder.configure(suggest=(2*args.suggest or args.matlab_suggest))

    #--- work in progress ---
    #Modify the Abstract Syntax Tree (AST)
    builder.project = modify.preorder_transform_AST(
        builder.project, args.nargin,
        suggest=(2*args.suggest or args.matlab_suggest),
    )
    #------------------------

    if args.disp:
        print(builder.project.summary())
        print("generate translation")

    builder.project.translate(args)

    #post order modify project
    builder.project = modify.postorder_transform_AST(builder.project)

    t = time.time()
    stamp = date.fromtimestamp(t).strftime('%Y-%m-%d %H:%M:%S')

    for program in builder.project:

        #name = program.name
        #if os.path.isfile(args.filename):
        #    name = pathOne + sep + os.path.basename(name)
            #print(name)
        name = os.getcwd() + sep + os.path.basename(program.name)
        #print(name)

        cpp = qfunctions.qcpp(program)
        hpp = qfunctions.qhpp(program)
        py = qfunctions.qpy(program, prefix=True)
        log = qfunctions.qlog(program)

        if args.disp:
            print("Writing files...")

        if args.reset:
            for ext in [".cpp", ".hpp", ".log", ".py"]:
                if os.path.isfile(name+ext):
                    os.remove(name+ext)

        if cpp:
            cpp = """// Automatically translated using m2cpp %s on %s

%s""" % (__version__, stamp, cpp)
            f = open(name+".cpp", "w")
            f.write(cpp)
            f.close()

        if hpp:
            hpp = """// Automatically translated using m2cpp %s on %s

%s""" % (__version__, stamp, hpp)
            f = open(name+".hpp", "w")
            f.write(hpp)
            f.close()

        if log:
            log = "Automatically translated using m2cpp %s on %s\n\n%s"\
                    % (__version__, stamp, log)
            f = open(name+".log", "w")
            f.write(log)
            f.close()

        if py:
            py = """# Automatically translated using m2cpp %s on %s
#
%s""" % (__version__, stamp, py)
            f = open(name+".py", "w")
            f.write(py)
            f.close()

        if os.path.isfile(name+".pyc"):
            os.remove(name+".pyc")


    program = builder[0]

    if args.tree_full:
        print(program.summary(args))

    elif args.tree:
        if program[1][0].cls == "Main":
            print(program[1][0][3].summary(args))
        else:
            print(program[1].summary(args))

    elif args.line:
        nodes = program[1].flatten(False, False, False)
        for node_ in nodes:
            if node_.line == args.line and node_.cls != "Block":
                print(node_.str.replace("__percent__", "%"))
                break
    else:
        print(program[1].str.replace("__percent__", "%"))


================================================
FILE: src/matlab2cpp/manual/__init__.py
================================================
"""
Source files for the manual.

Placed here so that doctest might pick up on them.
"""

#import usr00_introduction
from . import usr01_interaction, usr02_datatype, usr03_rules, usr04_node


================================================
FILE: src/matlab2cpp/manual/usr00_introduction.py
================================================
"""
.. _usr00:

Matlab2cpp is a semi-automatic tool for converting code from Matlab to C++. matlab2cpp is written in Python and is a Python module. Installing the Matlab2cpp module, makes the module available in Python as a module and can be loaded with "import matlab2cpp". In addition to the module, the script "m2cpp is copied to a folder on the system so that it can be executed by typing "m2cpp" in the terminal (Windows: cmd, cygwin). The "m2cpp" is a small script to handle the input arguments which are then used by the functionality in the module Matlab2cpp.

Note that Matlab2cpp/m2cpp is not meant as a complete tool for creating runnable C++ code.
For example, the `eval`-function can not be supported because there is no
general way to implement it in C++.  Instead the program is aimed as a support
tool, which aims at speed up the conversion process as much as possible for
a user that needs to convert Matlab programs by hand anyway. The software does
this by converting the basic structures of the Matlab-program (functions,
branches, loops, etc.), adds variable declarations, and for some simple code, do
a complete translation. From there manual conversions can be
done by hand.

Matlab2cpp generate C++ code that relies on the linear algebra library Armadillo (http://arma.sourceforge.net/). So while Armadillo isn't required to generate the C++ code, Armadillo is required to compile the program.  Armadillo's API is quite similar to Matlab and cover some of Matlab's functionaliy. Matlab2cpp aims to correctly translate Matlab to the corresponding C++ Armadillo code. Currently, the code will not convert the large library collection of functions
that Matlab currently possesses. However, there is no reason for the code not
to support more of these features in time.

"""


================================================
FILE: src/matlab2cpp/manual/usr01_interaction.py
================================================
"""
.. _usr01:

User interaction
================

The simplest way to interact with the `Matlab2cpp`-toolbox is to use the
`m2cpp` frontend.  The script automatically creates files with various
extensions containing translations and/or meta-information.

.. autoprogram:: m2cpp:parser
    :prog: m2cpp

For the user, the flags -o, -c, -s, -S, -r, -p -omp, -tbb are the useful flags.
The flags -t, -T  are good for debugging because they print the structure of the 
Abstract Syntax Tree (AST). The -d flag gives useful
information on the parsing of the Matlab code and insight in how the AST is built.

Suggest flags, -s, -S
---------------------

Read the section :ref:`usr02_suggestion_engine` first.
When using m2cpp the corresponding suggest is set with the flag -s. The suggest
engine works well for simple cases. For more complex cases, not all the variables
get a type suggestion and the suggested type could be wrong. 

The other suggest flag -S get the datatypes by running the (Matlab) code with Matlab.
Information of the datatypes are written to files which can be extracted by the code 
translator. For this flag to work, in addition to having Matlab installed, the Matlab 
Engine API for Python has to be installed
(see: `Install MATLAB Engine API for Python <http://se.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html>`_).
Matlab has to be able to run the code to extract the datatypes. So if the code
require datafiles or special Matlab modules (e.g. numerical modules),
these have to be available for this option to work. The Matlab suggest option is not 100%,
but still quite good at suggesting datatypes. A downside with the using Matlab to suggest
datatypes, is that Matlab takes some time to start up and then run the (Matlab) code.

Multiple directories, -p paths_file
-----------------------------------

In Matlab the script and function files have to be in the same folder for the function files to be found. To call a function script located in a different folder, the folder has to be added to path. This can be done with `addpath` or `path`. In a separate file from the Matlab main and function scripts, a separate script can be written to set the path to different folders::

    Dir='/path_to_folder/SeismicLab/codes/';
    path(path, strcat(Dir,'bp_filter/'));
    path(path, strcat(Dir,'decon'));
    path(path, strcat(Dir,'dephasing'));
    path(path, strcat(Dir,'fx'));
    ...

The flag option `-p paths_file` can be set to parse such a file. Then Matlab as well as m2cpp can find function scripts that are located in other directories.
    
.. _parallel_flags:

Parallel flags, -omp, -tbb
--------------------------

The program m2cpp can do parallelization of simple for loops (so called embarrasingly parallel).
To let the program know which loops the user wants to parallelize, use the pragma `%#PARFOR`
before the loop (similar to the way its done in OpenMP). The flags -omp and -tbb can then
be used to chose if OpenMP code or TBB code will be inserted to parallelize the code. Matlab's
`parfor` doesn't require the pragma `%#PARFOR` to parallelize. If neither -omp nor -tbb flag is
used, no OpenMP or TBB code is inserted and we will get a sequential for loop.
When compiling,  try link flags `-fopenmp` for OpenMP and `-ltbb` for TBB. OpenMP is usually available
for the compiler out of the box. TBB needs to be installed (see: https://www.threadingbuildingblocks.org/).
The TBB code makes use of lambda functions which is a C++ feature. C++11 is probably not set as
standard for the compiler, i.e., in the GNU compiler g++, the flag
`-std=c++11` is required to make use of C++11 features.

Quick translation functions
---------------------------

Even though `m2cpp` is sufficient for performing all code translation, many
of the examples in this manual are done through a python interface, since some
of the python functionality also will be discussed.  Given that `Matlab2cpp`
is properly installed on your system, the python library is available in
Python's path. The module is assumed imported as::

    >>> import matlab2cpp

Quick functions collection of frontend tools for performing code translation.
Each of the function :py:func:`~matlab2cpp.qcpp`, :py:func:`~matlab2cpp.qhpp`,
:py:func:`~matlab2cpp.qpy` and :py:func:`~matlab2cpp.qlog` are directly related
to the functionality of the :program:`m2cpp` script. The name indicate the
file extension that the script will create.  In addition there are the three
functions :py:func:`~matlab2cpp.qtree` and :py:func:`~matlab2cpp.qscript`. The
former represents a summary of the created node tree. The latter is a simple
translation tool that is more of a one-to-one translation.

For an overview of the various quick-functions, see :ref:`dev01`.

Plotting functionality
----------------------

Plotting functionality is available through a wrapper, which calls Python's matplotlib.
If a Matlab code with plotting calls is translated, the file `SPlot.h` is generated.
The C++ file that is generated also `#include` this file. To compile the generated code,
the Python have to be included. The code in `SPlot.h` makes of C++11 features, so compiler
options for C++11 may be needed as well. With the GNU compiler g++, I can compile
the generated code with:
`g++ my_cpp_file.cpp -o runfile -I /usr/include/python2.7/ -lpython2.7 -larmadillo -std=c++11`

Additional flags could be -O3 (optimization) -ltbb (in case of TBB parallelization)
"""


================================================
FILE: src/matlab2cpp/manual/usr02_datatype.py
================================================
"""
.. _usr02:

Configuring translation
=======================

One of the translation challenges is how each variable type is determined. In
C++ all variables have to be explicitly declared, while in Matlab they are
declared implicitly at creation.  When translating between the two languages,
there are many variables where the data types are unknown and impossible for
the Matlab2cpp software to translate.  How to translate the behavior of an
integer is vastly different from an float matrix.

To differentiate between types, each node have an attribute
:py:attr:`~matlab2cpp.Node.type` which represents the node datatype.
Datatypes can be roughly split into two groups: **numerical** and
**non-numerical** types.  The numerical types are as follows:

+---------------+--------------+---------+---------+--------+-----------+
|               | unsigned int | integer | float   | double | complex   |
+===============+==============+=========+=========+========+===========+
| `scalar`      | uword        | int     | float   | double | cx_double |
+---------------+--------------+---------+---------+--------+-----------+
| `vector`      | uvec         | ivec    | fvec    | vec    | cx_vec    |
+---------------+--------------+---------+---------+--------+-----------+
| `row\-vector` | urowvec      | irowvec | frowvec | rowvec | cx_rowvec |
+---------------+--------------+---------+---------+--------+-----------+
| `matrix`      | umat         | imat    | fmat    | mat    | cx_mat    |
+---------------+--------------+---------+---------+--------+-----------+
| `cube`        | ucube        | icube   | fcube   | cube   | cx_cube   |
+---------------+--------------+---------+---------+--------+-----------+

Values along the horizontal axis represents the amount of memory reserved per
element, and the along the vertical axis represents the various number of
dimensions.  The names are equivalent to the ones in the Armadillo package.

The non-numerical types are as follows:

+----------------------------------+------------------------+
| Name                             | Description            |
+==================================+========================+
| `char`                           | Single text character  |
+----------------------------------+------------------------+
| `string`                         | Text string            |
+----------------------------------+------------------------+
| :ref:`struct <struct>`           | Struct container       |
+----------------------------------+------------------------+
| :ref:`structs <structs>`         | Struct array container |
+----------------------------------+------------------------+
| :ref:`func_lambda <func_lambda>` | Anonymous function     |
+----------------------------------+------------------------+

Function scope
--------------

If not specified otherwise, the program will not assign datatype types to any
of variables. The user could in theory navigate the node tree and assign the
variables one by one using the node attributes to navigate. (See section
:ref:`usr04` for details.) However that would be very cumbersome. Instead the
datatypes are define collectively inside their scope. In the case of variables
in functions, the scope variables are the variables declaration
:py:class:`~matlab2cpp.Declares` and function parameters
:py:class:`~matlab2cpp.Params`. To reach the variable that serves as
a scope-wide type, the node attribute :py:attr:`~matlab2cpp.Node.declare` can
be used.

Manually interacting with the variable scope is simpler then iterating through
the full tree, but can in many cases still be cumbersome. To simplefy
interaction with datatype scopes, each program has an suppliment attribute
:py:attr:`~matlab2cpp.Node.ftypes`. The attribute is a nested dictionary where
the outer shell represents the function name the variables are defined. The
inner shell is the variables where keys are variable names and values are
types. It can be used to quickly retrievieng and inserting datatypes.
For example::

    >>> tree = matlab2cpp.build("function f(a)")
    >>> print(tree.ftypes)
    {'f': {'a': ''}}
    >>> tree.ftypes = {"f": {"a": "int"}}
    >>> print(matlab2cpp.qscript(tree))
    void f(int a)
    {
      // Empty block
    }

.. _func_lambda:

Anonymous functions
-------------------

In addition to normal function, Matlab have support for anonymous function
through the name prefix ``@``.  For example::

    >>> print(matlab2cpp.qscript("function f(); g = @(x) x^2; g(4)"))
    void f()
    {
      std::function<double(int)> g ;
      g = [] (int x) {pow(x, 2) ; } ;
      g(4) ;
    }

The translator creates an ``C++11`` lambda function with equivalent
functionality.  To achieve this, the translator creates an extra function in
the node-tree.  The name of the function is the same as assigned variable with
a ``_``-prefix (and a number postfix, if name is taken).  The information about
this function dictate the behaviour of the output The supplement file have the
following form::

    >>> print(matlab2cpp.qpy("function f(); g = @(x) x^2; g(4)"))
    functions = {
      "_g" : {
              "x" : "int",
      },
      "f" : {
        "g" : "func_lambda",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

The function `g` is a variable inside `f`'s function scope.  It has the datatype
`func_lambda` to indicate that it should be handled as a function.  The
associated function scope `_g` contains the variables inside the definition of
the anonymous function.


.. _struct:

Data structure
--------------

Data structures in Matlab can be constructed explicitly through the
``struct``-function.  However, they can also be constructed implicitly by
direct assignment.  For example will ``a.b=4`` create a ``struct`` with name
``a`` that has one field ``b``.  When translating such a snippet, it creates
a C++-struct, such that::

    >>> print(matlab2cpp.qhpp("function f(); a.b = 4.", suggest=True))
    #ifndef F_M_HPP
    #define F_M_HPP
    <BLANKLINE>
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    struct _A
    {
      double b ;
    } ;
    <BLANKLINE>
    void f()
    {
      _A a ;
      a.b = 4. ;
    }
    #endif

In the suppliment file, the local variable `a` will be assigned as a `struct`.
In addition, since the struct has content, the suppliment file creates a new
section for structs.  It will have the following form::

    >>> print(matlab2cpp.qpy("function f(); a.b = 4.", suggest=True))
    functions = {
      "f" : {
        "a" : "struct",
      },
    }
    structs = {
      "a" : {
        "b" : "double",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

Quick retrieving and inserting struct variables can be done through the
:py:attr:`~matlab2cpp.Node.stypes` attribute::

    >>> tree = matlab2cpp.build("a.b = 4")
    >>> tree.ftypes = {"f": {"a": "struct"}}
    >>> tree.stypes = {"a": {"b": "double"}}
    >>> print(matlab2cpp.qcpp(tree))
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    struct _A
    {
      double b ;
    } ;
    <BLANKLINE>
    int main(int argc, char** argv)
    {
      _A a ;
      a.b = 4 ;
      return 0 ;
    }

.. _structs:

Struct tables
-------------

Given that the data structure is indexed, e.g. ``a(1).b``, it forms a struct
table.  Very similar to regular :ref:`structs <struct>`, which only has one
value per element.  There are a couple of differences in the translation.
First, the struct is declared as an array:

    >>> print(matlab2cpp.qhpp("function f(); a(1).b = 4.", suggest=True))
    #ifndef F_M_HPP
    #define F_M_HPP
    <BLANKLINE>
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    struct _A
    {
      double b ;
    } ;
    <BLANKLINE>
    void f()
    {
      _A a[100] ;
      a[0].b = 4. ;
    }
    #endif

The translation assigned reserves 100 pointers for the content of ``a``.
Obviously, there are situations where this isn't enough (or too much), and the
number should be increased. So second, to adjust this number, the suppliment
file specifies the number of elements in the integer ``_size``:

    >>> print(matlab2cpp.qpy("function f(); a(1).b = 4.", suggest=True))
    functions = {
      "f" : {
        "a" : "structs",
      },
    }
    structs = {
      "a" : {
        "_size" : 100,
            "b" : "double",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

.. _usr02_suggestion_engine:

Suggestion engine
-----------------

The examples so far, when the functions :py:func:`~matlab2cpp.qcpp`,
:py:func:`~matlab2cpp.qhpp` and :py:func:`~matlab2cpp.qpy` are used, the
argument ``suggest=True`` have been used, and all variable types have been
filled in. Consider the following program where this is not the case::

    >>> print(matlab2cpp.qhpp("function c=f(); a = 4; b = 4.; c = a+b", suggest=False))
    #ifndef F_M_HPP
    #define F_M_HPP
    <BLANKLINE>
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    TYPE f()
    {
      TYPE a, b, c ;
      a = 4 ;
      b = 4. ;
      c = a+b ;
      return c ;
    }
    #endif

Since all variables are unknown, the program decides to fill in the dummy
variable ``TYPE`` for each unknown variable. Any time variables are unknown,
``TYPE`` is used. The supplement file created by `m2cpp` or
:py:func:`~matlab2cpp.qpy` reflects all these unknown variables as follows::

    >>> print(matlab2cpp.qpy("function c=f(); a = 4; b = 4.; c = a+b", suggest=False))
    functions = {
      "f" : {
        "a" : "", # int
        "b" : "", # double
        "c" : "",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

By flipping the boolean to ``True``, all the variables get assigned datatypes::

    >>> print(matlab2cpp.qpy("function c=f(); a = 4; b = 4.; c = a+b", suggest=True))
    functions = {
      "f" : {
        "a" : "int",
        "b" : "double",
        "c" : "double",
      },
    }
    includes = [
      '#include <armadillo>',
      'using namespace arma ;',
    ]

The resulting program will have the following complete form:

    >>> print(matlab2cpp.qhpp(
    ...     "function c=f(); a = 4; b = 4.; c = a+b", suggest=True))
    #ifndef F_M_HPP
    #define F_M_HPP
    <BLANKLINE>
    #include <armadillo>
    using namespace arma ;
    <BLANKLINE>
    double f()
    {
      double b, c ;
      int a ;
      a = 4 ;
      b = 4. ;
      c = a+b ;
      return c ;
    }
    #endif

Note here though that the variable ``c`` didn't have a suggestion. The
suggestion is an interactive process such that ``a`` and ``b`` both must be
known beforehand.  The variable ``a`` and ``b`` get assigned the datatypes
``int`` and ``double`` because of the direct assignment of variable.  After
this, the process starts over and tries to find other variables that suggestion
could fill out for.  In the case of the ``c`` variable, the assignment on the
right were and addition between ``int`` and ``double``.  To not loose
precision, it then chooses to keep `double`, which is passed on to the ``c``
variable.  In practice the suggestions can potentially fill in all datatypes
automatically in large programs, and often quite intelligently. For example,
variables get suggested across function call scope::

    >>> print(matlab2cpp.qscript('function y=f(x); y=x; function g(); z=f(4)'))
    int f(int x)
    {
      int y ;
      y = x ;
      return y ;
    }
    <BLANKLINE>
    void g()
    {
      int z ;
      z = f(4) ;
    }

And accross multiple files::

    >>> from matlab2cpp.tree import Builder
    >>> builder = Builder()
    >>> builder.load("f.m", "function y=f(x); y=x")
    >>> builder.load("g.m", "function g(); z=f(4)")
    >>> builder.configure(suggest=True)
    >>> tree_f, tree_g = builder[:]
    >>> print(matlab2cpp.qscript(tree_f))
    int f(int x)
    {
      int y ;
      y = x ;
      return y ;
    }
    >>> print(matlab2cpp.qscript(tree_g))
    void g()
    {
      int z ;
      z = f(4) ;
    }

Verbatim translations
---------------------

In some cases, the translation can not be performed. For example, the Matlab
function ``eval`` can not be properly translated. Matlab is interpreted, and
can easily take a string from local name space, and feed it to the interpreter.
In C++ however, the code must be pre-compiled. Not knowing what the string
input is before runtime, makes this difficult. So instead it makes more sense
to make some custom translation by hand.

Since ``matlab2cpp`` produces C++ files, it is possible to edit them after
creation. However, if changes are made to the Matlab-file at a later point, the
custom edits have to be added manually again. To resolve this, ``matlab2cpp``
supports verbatim translations through the suppliment file ``.py`` and through
the node attribute :py:attr:`~matlab2cpp.Node.vtypes`.
:py:attr:`~matlab2cpp.node.vtype` is a dictionary where the keys are string
found in the orginal code, and the values are string of the replacement.

Performing a verbatim replacement has to be done before the node tree is
constructed. Assigning :py:attr:`~matlab2cpp.Node.vtypes` doesn't work very
well. Instead the replacement dictionary can be bassed as argument to
:py:func:`~matlab2cpp.build`::

    >>> tree = matlab2cpp.build('''a=1
    ... b=2
    ... c=3''', vtypes = {"b": "_replaced_text_"})
    >>> print(matlab2cpp.qscript(tree))
    a = 1 ;
    // b=2
    _replaced_text_
    c = 3 ;

Note that when a match is found, the whole line is replaced. No also how the
source code is retained a comment above the verbatim translation. The
verbatim key can only match a single line, however the replacement might span
multiple lines. For example::

    >>> replace_code = '''one line
    ... two line
    ... three line'''
    >>> tree = matlab2cpp.build('''a=1
    ... b=2
    ... c=3''', vtypes={"b": replace_code})

    >>> print(matlab2cpp.qscript(tree))
    a = 1 ;
    // b=2
    one line
    two line
    three line
    c = 3 ;

Verbatims can also be utilized by modifying the .py file. Consider the Matlab script::

    a = 1 ;
    b = 2 ;
    c = 3 ;

Using the m2cpp script to translate the Matlab script produces a C++ file and a .py file. By adding code to the .py file, verbatim translation can be added. This is done by using the keyword verbatims and setting it to a python dictionary. Similar to vtype, keys are strings found in the original code, and the values are string of the replacement::

    functions = {
    "main" : {
    "a" : "int",
    "b" : "int",
    "c" : "int",
    },
    }
    includes = [
    '#include <armadillo>',
    'using namespace arma ;',
    ]
    verbatims = {"b = 2 ;" : '''one line
    two line
    tree line'''
    }

In the generated C++ file the second assignment is replaced with the verbatim translation::

    int main(int argc, char** argv)
    {
      int a, c ;
      a = 1 ;
      // b = 2 ;
      one line
      two line
      tree line
      c = 3 ;
      return 0 ;
    }
"""


================================================
FILE: src/matlab2cpp/manual/usr03_rules.py
================================================
"""
.. _usr03:

Translation rules
=================

In Matlab2cpp, the simplest form for translation is a simple string saved to
a variable.  For example::

    >>> Int = "6"

The name :py:class:`~matlab2cpp.collection.Int` (with capital letter)
represents the node the rule is applicable for integers. The right hand side
when it is a string, will be used as the translation every time
:py:class:`~matlab2cpp.collection.Int` occurs.  To illustrate this, consider
the following simple example, where we pass a snippet to the
:py:func:`~matlab2cpp.qscript` function::

    >>> print(matlab2cpp.qscript("5"))
    5 ;

To implement the new rule we (globally) insert the rule for all instances of
:py:class:`~matlab2cpp.collection.Int` as follows::

    >>> print(matlab2cpp.qscript("5", Int=Int))
    6 ;

Obviously, this type of translation is not very useful except for a very few
exceptions. First of all, each :py:class:`~matlab2cpp.collection.Int` (and
obviously many other nodes) contain a value. To represent this value, the
translation rule uses string interpolation. This can be implemented as
follows::

    >>> Int = "|%(value)s|"
    >>> print(matlab2cpp.qscript("5", Int=Int))
    |5| ;

There are also other attributes than `value`. For example variables,
represented through the node `Var` have a name, which refer to it's scope
defined name.  For example::

    >>> Var = "__%(name)s__"
    >>> print(matlab2cpp.qscript("a = 4", Var=Var))
    __a__ = 4 ;

Since all the code is structured as a node tree, many of the nodes have node
children. The translation is performed leaf-to-root, implying that at the time
of translation of any node, all of it's children are already translated and
available in interpolation. The children are indexed by number, counting from
0. Consider the simple example of a simple addition::

    >>> print(matlab2cpp.qtree("2+3", core=True)) # doctest: +NORMALIZE_WHITESPACE
     1  1Block      code_block   TYPE
     1  1| Statement  code_block   TYPE
     1  1| | Plus       expression   int
     1  1| | | Int        int          int
     1  3| | | Int        int          int
    >>> print(matlab2cpp.qscript("2+3"))
    2+3 ;

The node tree (at it's core) consists of
a :py:class:`~matlab2cpp.collection.Block`.
That code :py:class:`~matlab2cpp.collection.Block` contains
one :py:class:`~matlab2cpp.collection.Statement`. The
:py:class:`~matlab2cpp.collection.Statement` contains the
:py:class:`~matlab2cpp.collection.Pluss` operator, which contains the two
:py:class:`~matlab2cpp.collection.Int`. Each :py:class:`~matlab2cpp.Node` in
the tree represents one token to be translated.

From the perspective of the addition :py:class:`~matlab2cpp.collection.Plus`,
the two node children of class :py:class:`~matlab2cpp.collection.Int` are
available in translation respectivly as index 0 and 1. In interpolation we can
do as follows::

    >>> Plus = "%(1)s+%(0)s"
    >>> print(matlab2cpp.qscript("2+3", Plus=Plus))
    3+2 ;

One obvious problem with this approach is that the number of children of a node
might not be fixed. For example the `Plus` in "2+3" has two children while
"1+2+3" has three. To address nodes with variable number of node children,
alternative representation can be used. Instead of defining a string, a tuple
of three string can be used. They represents prefix, infix and postfix between
each node child. For example::

    >>> Plus = "", "+", ""

It implies that there should be a "+" between each children listed, and nothing
at the ends. In practice we get::

    >>> print(matlab2cpp.qscript("2+3", Plus=Plus))
    2+3 ;
    >>> print(matlab2cpp.qscript("1+2+3", Plus=Plus))
    1+2+3 ;


And this is the extent of how the system uses string values. However, in
practice, they are not used much. Instead of strings and tuples functions are
used. They are defined with the same name the string/tuple. This function
should always take a single argument of type :py:class:`~matlab2cpp.Node` which
represents the current node in the node tree. The function should return either
a :py:class:`~matlab2cpp.str` or :py:class:`~matlab2cpp.tuple` as described
above. For example, without addressing how one can use `node`, the following is
equivalent::

    >>> Plus = "", "+ ", ""
    >>> print(matlab2cpp.qscript("2+3", Plus=Plus))
    2+ 3 ;
    >>> def Plus(node):
    ...     return "", " +", ""
    ...
    >>> print(matlab2cpp.qscript("2+3", Plus=Plus))
    2 +3 ;

One application of the ``node`` argument is to use it to configure datatypes.
As discussed in the previous section :ref:`usr02`, the node attribute
:py:attr:`~matlab2cpp.Node.type` contains information about datatype.
For example::

    >>> def Var(node):
    ...     if node.name == "x": node.type = "vec"
    ...     if node.name == "y": node.type = "rowvec"
    ...     return node.name
    >>> print(matlab2cpp.qscript("function f(x,y)", Var=Var))
    void f(vec x, rowvec y)
    {
      // Empty block
    }

For more details on the behavior of the :py:mod:`~matlab2cpp.node` argument, 
see section on node :ref:`usr04`. For an extensive list of the various nodes
available, see developer manual :ref:`dev06`.


Rule context
------------

In the basic translation rule described above, each node type have one
universal rule. However, depending on context, various nodes should be
addressed differently. For example the snippet `sum(x)` lend itself naturally
to have a rule that targets the name `sum` which is part of the Matlab standard
library. Its translation should is as follows::

    >>> print(matlab2cpp.qscript("sum(x)"))
    arma::sum(x) ;
    
However, if there is a line `sum = [1,2,3]` earlier in the code, then the
translation for `sum(x)` become very different. `sum` is now an array, and the
translation adapts::

    >>> print(matlab2cpp.qscript("sum=[1,2,3]; sum(x)"))
    sword _sum [] = {1, 2, 3} ;
    sum = irowvec(_sum, 3, false) ;
    sum(x-1) ;

To address this in the same node will quickly become very convoluted. So
instead, the rules are split into various backends. This simplifies things for
each rule that have multiple interpretations, but also ensures that code isn't
to bloated.  For an overview of the various backend, see the developer manual
:ref:`dev07`.

Reserved rules
--------------

The example above with `sum(x)` is handled by two rules. In the second
iteration, it is a :py:mod:`~matlab2cpp.datatype` of type `irowvec` and is
therefore processed in the corresponding rule for `irowvec`. However, in the
former case, `sum` is a function from the Matlab standard library. In principle
there is only one rule for all function calls like this. However, since the
standard library is large, the rules are segmented into rules for each name. 

In the rule :py:mod:`rules._reserved <matlab2cpp.rules._reserved>`, each
function in the standard library (which matlab2cpp supports) is listed in the
variable `rules.reserved`. The context for reserved function manifest itself
into the rules for function calls :py:class:`~matlab2cpp.collection.Get`,
variables :py:class:`~matlab2cpp.collection.Var` and in some cases,
multivariate assignment :py:class:`~matlab2cpp.collection.Assigns`. As
described above, the rules should then have these names respectively. However
to indicate the name, the rules also includes node names as suffix. For
example, the function call for `sum` is handled in the rule
:py:func:`~matlab2cpp.rules._reserved.Get_sum`.

In practice this allows us to create specific rules for any node with names,
which includes variables, function calls, functions, to name the obvious.
For example, if we want to change the summation function from armadillo to the
`accumulation` from `numeric` module, it would be implemented as follows::

    >>> Get_sum = "std::accumulate(", ", ", ")"
    >>> print(matlab2cpp.qscript("sum(x)", Get_sum=Get_sum))
    std::accumulate(x) ;

This rules is specific for all function calls with name `sum` and wount be
applied for other functions::

    >>> Get_sum = "std::accumulate(", ", ", ")"
    >>> print(matlab2cpp.qscript("min(x)", Get_sum=Get_sum))
    min(x) ;

There are many rules to translation rule backends in matlab2cpp. This is mainly
because each datatype have a corresponding backend.
"""


================================================
FILE: src/matlab2cpp/manual/usr04_node.py
================================================
"""
.. _usr04:

Behind the frontends
====================

Common for all the various frontends in :py:mod:`~matlab2cpp.qfunctions` are
two classes: :py:class:`~matlab2cpp.Builder` and :py:class:`~matlab2cpp.Node`.
The former scans Matlab code and constructs a node tree consiting of instances
of the latter.

The Builder class
-----------------

Iterating through Matlab code always starts with constructing
a :py:class:`~matlab2cpp.Builder`::

    >>> from matlab2cpp.tree import Builder
    >>> builder = Builder()

This is an empty shell without any content. To give it content, we supply it
with code::

    >>> builder.load("file1.m", "a = 4")

The function saves the code locally as `builder.code` and initiate the
`create_program` method with index 0. The various `create_*` methods are then
called and used to populate the node tree. The code is considered static,
instead the index, which refer to the position in the code is increased to move
forward in the code. The various constructors uses the support modules in the
:py:mod:`~matlab2cpp.qtree` to build a full toke tree.  The result is as
follows::

    >>> print(builder) # doctest: +NORMALIZE_WHITESPACE
         Project    unknown      TYPE
  
Download .txt
gitextract_dk9ut9qi/

├── .circleci/
│   └── config.yml
├── .coveragerc
├── .gitignore
├── LICENSE
├── PKG-INFO
├── README.rst
├── conftest.py
├── doc/
│   ├── previous_doc/
│   │   ├── Makefile
│   │   └── source/
│   │       ├── conf.py
│   │       ├── dev00_overview.rst
│   │       ├── dev01_qfuncs.rst
│   │       ├── dev02_tree.rst
│   │       ├── dev03_node.rst
│   │       ├── dev04_datatype.rst
│   │       ├── dev05_configure.rst
│   │       ├── dev06_collection.rst
│   │       ├── dev07_rules.rst
│   │       ├── dev08_supplement.rst
│   │       ├── dev09_testsuite.rst
│   │       ├── index.rst
│   │       ├── usr00_intro.rst
│   │       ├── usr01_interaction.rst
│   │       ├── usr02_datatype.rst
│   │       ├── usr03_rules.rst
│   │       └── usr04_node.rst
│   └── user_manual/
│       ├── Makefile
│       └── source/
│           ├── conf.py
│           ├── conf.py~
│           ├── dev00_overview.rst~
│           ├── index.rst
│           ├── index.rst~
│           ├── usr00_intro.rst~
│           ├── usr02_datatype.rst
│           ├── usr03_rules.rst
│           └── usr04_node.rst
├── requirements.txt
├── setup.cfg
├── setup.py
├── src/
│   └── matlab2cpp/
│       ├── __init__.py
│       ├── collection.py
│       ├── configure/
│       │   ├── __init__.py
│       │   ├── armadillo.py
│       │   ├── backends.py
│       │   ├── datatypes.py
│       │   ├── frontend.py
│       │   ├── funcs.py
│       │   └── reserved.py
│       ├── datatype.py
│       ├── frontend.py
│       ├── manual/
│       │   ├── __init__.py
│       │   ├── usr00_introduction.py
│       │   ├── usr01_interaction.py
│       │   ├── usr02_datatype.py
│       │   ├── usr03_rules.py
│       │   ├── usr04_node.py
│       │   └── usr05_installation.py
│       ├── matlab_types.py
│       ├── modify.py
│       ├── mwhos.py
│       ├── mwrapmat.py
│       ├── node/
│       │   ├── __init__.py
│       │   ├── backend.py
│       │   ├── frontend.py
│       │   ├── m2cpp.py
│       │   └── reference.py
│       ├── parser.py
│       ├── pyplot.py
│       ├── qfunctions.py
│       ├── rules/
│       │   ├── __init__.py
│       │   ├── _cell.py
│       │   ├── _char.py
│       │   ├── _code_block.py
│       │   ├── _cube.py
│       │   ├── _cx_cube.py
│       │   ├── _cx_double.py
│       │   ├── _cx_mat.py
│       │   ├── _cx_rowvec.py
│       │   ├── _cx_vec.py
│       │   ├── _double.py
│       │   ├── _expression.py
│       │   ├── _fcube.py
│       │   ├── _float.py
│       │   ├── _fmat.py
│       │   ├── _frowvec.py
│       │   ├── _func_lambda.py
│       │   ├── _func_return.py
│       │   ├── _func_returns.py
│       │   ├── _fvec.py
│       │   ├── _icube.py
│       │   ├── _imat.py
│       │   ├── _int.py
│       │   ├── _irowvec.py
│       │   ├── _ivec.py
│       │   ├── _mat.py
│       │   ├── _matrix.py
│       │   ├── _program.py
│       │   ├── _reserved.py
│       │   ├── _rowvec.py
│       │   ├── _size_t.py
│       │   ├── _string.py
│       │   ├── _struct.py
│       │   ├── _structs.py
│       │   ├── _ucube.py
│       │   ├── _umat.py
│       │   ├── _unknown.py
│       │   ├── _urowvec.py
│       │   ├── _uvec.py
│       │   ├── _uword.py
│       │   ├── _vec.py
│       │   ├── _verbatim.py
│       │   ├── armadillo.py
│       │   ├── assign.py
│       │   ├── cube.py
│       │   ├── function.py
│       │   ├── mat.py
│       │   ├── parallel.py
│       │   ├── rowvec.py
│       │   ├── variables.py
│       │   └── vec.py
│       ├── setpaths.py
│       ├── supplement/
│       │   ├── __init__.py
│       │   ├── functions.py
│       │   ├── includes.py
│       │   ├── structs.py
│       │   ├── suggests.py
│       │   └── verbatim.py
│       └── tree/
│           ├── __init__.py
│           ├── assign.py
│           ├── branches.py
│           ├── builder.py
│           ├── codeblock.py
│           ├── constants.py
│           ├── expression.py
│           ├── findend.py
│           ├── functions.py
│           ├── identify.py
│           ├── iterate.py
│           ├── misc.py
│           ├── suppliment.py
│           └── variables.py
└── test/
    ├── data/
    │   ├── function_reference.hpp
    │   ├── function_reference.m
    │   ├── function_reference_2.hpp
    │   ├── function_reference_2.m
    │   ├── fx_decon.cpp
    │   ├── fx_decon.m
    │   ├── fx_decon.m.py
    │   ├── simple_assignment.cpp
    │   └── simple_assignment.m
    ├── test_conversion.py
    └── test_simple_assignment.py
Download .txt
SYMBOL INDEX (732 symbols across 66 files)

FILE: conftest.py
  function workspace_folder (line 12) | def workspace_folder(tmpdir_factory):
  function workspace (line 18) | def workspace(workspace_folder, doctest_namespace):

FILE: src/matlab2cpp/__init__.py
  function m2cpp (line 47) | def m2cpp(args=None):

FILE: src/matlab2cpp/collection.py
  class Project (line 210) | class Project(Node):
    method __init__ (line 211) | def __init__(self, name="", cur=0, line=0, code="", **kws):
  class Program (line 228) | class Program(Node):
    method __init__ (line 229) | def __init__(self, parent, name, **kws):
  class Includes (line 242) | class Includes(Node):
    method __init__ (line 243) | def __init__(self, parent, **kws):
  class Funcs (line 246) | class Funcs(Node):
    method __init__ (line 247) | def __init__(self, parent, line=1, **kws):
  class Inlines (line 250) | class Inlines(Node):
    method __init__ (line 251) | def __init__(self, parent, **kws):
  class Structs (line 254) | class Structs(Node):
    method __init__ (line 255) | def __init__(self, parent, **kws):
  class Headers (line 258) | class Headers(Node):
    method __init__ (line 259) | def __init__(self, parent, **kws):
  class Log (line 262) | class Log(Node):
    method __init__ (line 263) | def __init__(self, parent, **kws):
  class Header (line 266) | class Header(Node):
    method __init__ (line 267) | def __init__(self, parent, name, **kws):
  class Main (line 270) | class Main(Node):
    method __init__ (line 271) | def __init__(self, parent, name="main", **kws):
  class Error (line 274) | class Error(Node):
    method __init__ (line 275) | def __init__(self, parent, name, value, **kws):
  class Warning (line 278) | class Warning(Node):
    method __init__ (line 279) | def __init__(self, parent, name, value, **kws):
  class Counter (line 283) | class Counter(Node):
    method __init__ (line 284) | def __init__(self, parent, name, value, **kws):
  class Inline (line 288) | class Inline(Node):
    method __init__ (line 289) | def __init__(self, parent, name, **kws):
  class Include (line 292) | class Include(Includes):
    method __init__ (line 293) | def __init__(self, parent, name, **kws):
  class Struct (line 296) | class Struct(Structs):          pass
  class Func (line 298) | class Func(Node):           pass
  class Returns (line 299) | class Returns(Node):        pass
  class Params (line 300) | class Params(Node):         pass
  class Declares (line 301) | class Declares(Node):       pass
  class Block (line 303) | class Block(Node):
    method __init__ (line 304) | def __init__(self, parent, **kws):
  class Parfor (line 306) | class Parfor(Block):        pass
  class For (line 307) | class For(Block):           pass
  class While (line 308) | class While(Block):         pass
  class Switch (line 309) | class Switch(Block):        pass
  class Case (line 310) | class Case(Block):          pass
  class Otherwise (line 311) | class Otherwise(Block):     pass
  class Branch (line 312) | class Branch(Block):        pass
  class If (line 313) | class If(Block):            pass
  class Elif (line 314) | class Elif(Block):          pass
  class Else (line 315) | class Else(Block):          pass
  class Tryblock (line 316) | class Tryblock(Block):      pass
  class Try (line 317) | class Try(Block):           pass
  class Catch (line 318) | class Catch(Block):         pass
  class Statement (line 319) | class Statement(Block):     pass
  class Assign (line 321) | class Assign(Node):         pass
  class Assigns (line 322) | class Assigns(Node):
    method __init__ (line 323) | def __init__(self, parent, **kws):
  class Expr (line 326) | class Expr(Node):
    method __init__ (line 327) | def __init__(self, parent, **kws):
  class Opr (line 329) | class Opr(Expr):            pass
  class Exp (line 330) | class Exp(Opr):             pass
  class Elexp (line 331) | class Elexp(Opr):           pass
  class Mul (line 332) | class Mul(Opr):             pass
  class Minus (line 333) | class Minus(Opr):           pass
  class Elmul (line 334) | class Elmul(Opr):           pass
  class Matrixdivision (line 335) | class Matrixdivision(Opr):      pass
  class Elementdivision (line 336) | class Elementdivision(Opr):     pass
  class Leftmatrixdivision (line 337) | class Leftmatrixdivision(Opr):  pass
  class Leftelementdivision (line 338) | class Leftelementdivision(Opr): pass
  class Plus (line 339) | class Plus(Opr):            pass
  class Colon (line 340) | class Colon(Opr):           pass
  class Gt (line 341) | class Gt(Opr):              pass
  class Ge (line 342) | class Ge(Opr):              pass
  class Lt (line 343) | class Lt(Opr):              pass
  class Le (line 344) | class Le(Opr):              pass
  class Ne (line 345) | class Ne(Opr):              pass
  class Eq (line 346) | class Eq(Opr):              pass
  class Band (line 347) | class Band(Opr):            pass
  class Bor (line 348) | class Bor(Opr):             pass
  class Land (line 349) | class Land(Opr):            pass
  class Lor (line 350) | class Lor(Opr):             pass
  class Matrix (line 352) | class Matrix(Node):
    method __init__ (line 353) | def __init__(self, parent, **kws):
  class Vector (line 355) | class Vector(Matrix):       pass
  class Cell (line 357) | class Cell(Node):
    method __init__ (line 358) | def __init__(self, parent, **kws):
  class Paren (line 361) | class Paren(Expr):          pass
  class Neg (line 362) | class Neg(Expr):            pass
  class Not (line 363) | class Not(Expr):            pass
  class Ctranspose (line 364) | class Ctranspose(Expr):     pass
  class Transpose (line 365) | class Transpose(Expr):      pass
  class All (line 366) | class All(Expr):            pass
  class End (line 367) | class End(Expr):            pass
  class Break (line 368) | class Break(Expr):          pass
  class Return (line 369) | class Return(Expr):         pass
  class Int (line 371) | class Int(Node):
    method __init__ (line 372) | def __init__(self, parent, value, **kws):
  class Float (line 375) | class Float(Node):
    method __init__ (line 376) | def __init__(self, parent, value, **kws):
  class Imag (line 380) | class Imag(Node):
    method __init__ (line 381) | def __init__(self, parent, value, **kws):
  class String (line 384) | class String(Node):
    method __init__ (line 385) | def __init__(self, parent, value, **kws):
  class Lambda (line 389) | class Lambda(Node):
    method __init__ (line 390) | def __init__(self, parent, name="", **kws):
  class Pragma_for (line 393) | class Pragma_for(Node):
    method __init__ (line 394) | def __init__(self, parent, value, **kws):
  class Lcomment (line 397) | class Lcomment(Node):
    method __init__ (line 398) | def __init__(self, parent, value, **kws):
  class Bcomment (line 402) | class Bcomment(Node):
    method __init__ (line 403) | def __init__(self, parent, value, **kws):
  class Ecomment (line 407) | class Ecomment(Node):
    method __init__ (line 408) | def __init__(self, parent, value, **kws):
  class Var (line 412) | class Var(Node):
    method __init__ (line 413) | def __init__(self, parent, name, **kws):
  class Get (line 415) | class Get(Var):         pass
  class Set (line 416) | class Set(Var):         pass
  class Fvar (line 418) | class Fvar(Node):
    method __init__ (line 419) | def __init__(self, parent, name, value, **kws):
  class Cvar (line 422) | class Cvar(Node):
    method __init__ (line 423) | def __init__(self, parent, name, **kws):
  class Cget (line 426) | class Cget(Node):
    method __init__ (line 427) | def __init__(self, parent, name, **kws):
  class Fget (line 430) | class Fget(Node):
    method __init__ (line 431) | def __init__(self, parent, name, value, **kws):
  class Sget (line 434) | class Sget(Node):
    method __init__ (line 435) | def __init__(self, parent, name, value, **kws):
  class Nget (line 438) | class Nget(Node):
    method __init__ (line 439) | def __init__(self, parent, name, **kws):
  class Cset (line 442) | class Cset(Node):
    method __init__ (line 443) | def __init__(self, parent, name, **kws):
  class Fset (line 446) | class Fset(Node):
    method __init__ (line 447) | def __init__(self, parent, name, value, **kws):
  class Sset (line 450) | class Sset(Node):
    method __init__ (line 451) | def __init__(self, parent, name, value, **kws):
  class Nset (line 454) | class Nset(Node):
    method __init__ (line 455) | def __init__(self, parent, name, **kws):
  class Resize (line 458) | class Resize(Node):
    method __init__ (line 459) | def __init__(self, parent, **kws):
  class Verbatim (line 462) | class Verbatim(Node):
    method __init__ (line 463) | def __init__(self, parent, name, value, **kws):

FILE: src/matlab2cpp/configure/armadillo.py
  function vec (line 4) | def vec(node):
  function rowvec (line 22) | def rowvec(node):
  function mat (line 42) | def mat(node):
  function cube (line 74) | def cube(node):

FILE: src/matlab2cpp/configure/backends.py
  function Assigns (line 32) | def Assigns(node):
  function Matrix (line 69) | def Matrix(node):
  function Fvar (line 93) | def Fvar(node):
  function Var (line 123) | def Var(node):
  function Get (line 126) | def Get(node):
  function Set (line 129) | def Set(node):
  function Func (line 133) | def Func(node):
  function Returns (line 141) | def Returns(node):
  function Params (line 148) | def Params(node):
  function Declares (line 156) | def Declares(node):
  function Assign (line 165) | def Assign(node):

FILE: src/matlab2cpp/configure/datatypes.py
  function Var (line 7) | def Var(node):
  function Get (line 59) | def Get(node):
  function Set (line 100) | def Set(node):
  function Fvar (line 139) | def Fvar(node):
  function Fset (line 147) | def Fset(node):
  function Sset (line 155) | def Sset(node):
  function Assign (line 164) | def Assign(node):
  function Vector (line 171) | def Vector(node):
  function Matrix (line 221) | def Matrix(node):
  function Transpose (line 268) | def Transpose(node):
  function For (line 281) | def For(node):
  function Neg (line 290) | def Neg(node):
  function opr (line 296) | def opr(node):
  function Minus (line 300) | def Minus(node):
  function Mul (line 305) | def Mul(node):
  function Exp (line 317) | def Exp(node):
  function Elexp (line 323) | def Elexp(node):
  function division (line 331) | def division(node):
  function Colon (line 342) | def Colon(node):
  function Lambda (line 367) | def Lambda(node):
  function Assigns (line 419) | def Assigns(node):

FILE: src/matlab2cpp/configure/frontend.py
  function configure (line 3) | def configure(root, suggest=True, **kws):
  function loop (line 18) | def loop(root, suggest):

FILE: src/matlab2cpp/configure/funcs.py
  function funcs (line 3) | def funcs(node):

FILE: src/matlab2cpp/configure/reserved.py
  function Get_exp (line 6) | def Get_exp(node):
  function Get_log (line 9) | def Get_log(node):
  function Get_log2 (line 12) | def Get_log2(node):
  function Get_log10 (line 15) | def Get_log10(node):
  function Get_power (line 18) | def Get_power(node):
  function Get_floor (line 21) | def Get_floor(node):
  function Get_ceil (line 24) | def Get_ceil(node):
  function Get_fix (line 27) | def Get_fix(node):
  function Get_round (line 30) | def Get_round(node):
  function Get_cos (line 39) | def Get_cos(node):
  function Get_acos (line 42) | def Get_acos(node):
  function Get_cosh (line 45) | def Get_cosh(node):
  function Get_acosh (line 48) | def Get_acosh(node):
  function Get_sin (line 51) | def Get_sin(node):
  function Get_asin (line 54) | def Get_asin(node):
  function Get_sinh (line 57) | def Get_sinh(node):
  function Get_asinh (line 60) | def Get_asinh(node):
  function Get_sqrt (line 63) | def Get_sqrt(node):
  function Get_mod (line 70) | def Get_mod(node):
  function Get_abs (line 73) | def Get_abs(node):
  function Get_tic (line 79) | def Get_tic(node):
  function Assign_tic (line 82) | def Assign_tic(node):
  function Get_toc (line 86) | def Get_toc(node):
  function Assign_toc (line 89) | def Assign_toc(node):
  function Get_any (line 93) | def Get_any(node):
  function Get_size (line 128) | def Get_size(node):
  function Assigns_size (line 208) | def Assigns_size(node):
  function Get_length (line 222) | def Get_length(node):
  function Get_min (line 225) | def Get_min(node):
  function Assigns_min (line 257) | def Assigns_min(node):
  function Assigns_max (line 271) | def Assigns_max(node):
  function Get_fliplr (line 284) | def Get_fliplr(node):
  function Get_flipud (line 288) | def Get_flipud(node):
  function Get_eye (line 292) | def Get_eye(node):
  function Get_diag (line 299) | def Get_diag(node):
  function Get_tril (line 306) | def Get_tril(node):
  function Get_triu (line 310) | def Get_triu(node):
  function Get_trace (line 316) | def Get_trace(node):
  function Get_transpose (line 319) | def Get_transpose(node):
  function Get_ctranspose (line 334) | def Get_ctranspose(node):
  function Get_zeros (line 349) | def Get_zeros(node):
  function Get_rand (line 414) | def Get_rand(node):
  function Get_reshape (line 434) | def Get_reshape(node):
  function Get_nextpow2 (line 438) | def Get_nextpow2(node):
  function Get_fft (line 441) | def Get_fft(node):
  function Get_ifft (line 451) | def Get_ifft(node):
  function Get_interp1 (line 470) | def Get_interp1(node):
  function Get_sum (line 474) | def Get_sum(node):
  function Get_cumsum (line 502) | def Get_cumsum(node):
  function Get_conj (line 505) | def Get_conj(node):
  function Get_real (line 508) | def Get_real(node):
  function Get_convmtx (line 517) | def Get_convmtx(node):
  function Get_conv2 (line 520) | def Get_conv2(node):
  function Get_logspace (line 523) | def Get_logspace(node):
  function Get_find (line 526) | def Get_find(node):

FILE: src/matlab2cpp/datatype.py
  function common_loose (line 41) | def common_loose(vals):
  function common_strict (line 89) | def common_strict(vals):
  function pointer_split (line 125) | def pointer_split(name):
  function get_dim (line 132) | def get_dim(val):
  function get_mem (line 148) | def get_mem(val):
  function get_num (line 164) | def get_num(val):
  function get_name (line 175) | def get_name(dim, mem):
  function get_type (line 179) | def get_type(instance):
  class Dim (line 185) | class Dim(object):
    method __get__ (line 217) | def __get__(self, instance, owner):
    method __set__ (line 222) | def __set__(self, instance, value):
  class Mem (line 227) | class Mem(object):
    method __get__ (line 259) | def __get__(self, instance, owner):
    method __set__ (line 264) | def __set__(self, instance, value):
  class Num (line 269) | class Num(object):
    method __get__ (line 275) | def __get__(self, instance, owner):
    method __set__ (line 280) | def __set__(self, instance, value):
  class Type (line 287) | class Type(object):
    method __get__ (line 330) | def __get__(self, instance, owner):
    method __set__ (line 335) | def __set__(self, instance, value):
  class Suggest (line 345) | class Suggest(object):
    method __set__ (line 349) | def __set__(self, instance, value):
    method __get__ (line 353) | def __get__(self, instance, owner):

FILE: src/matlab2cpp/frontend.py
  function execute_parser (line 12) | def execute_parser(args):

FILE: src/matlab2cpp/matlab_types.py
  function lstripped (line 9) | def lstripped(s):
  function mtypes (line 18) | def mtypes(builder, args):
  function extract_ftypes (line 140) | def extract_ftypes(program, funcs_types, file_path):
  function datatype_string (line 210) | def datatype_string(cols):
  function detect_string (line 264) | def detect_string(code, k):
  function function_code (line 289) | def function_code(program, code):

FILE: src/matlab2cpp/modify.py
  function preorder_transform_AST (line 4) | def preorder_transform_AST(node, nargin = False, suggest = False):
  function postorder_transform_AST (line 36) | def postorder_transform_AST(node):
  function change_to_complex (line 49) | def change_to_complex(project):
  function complex_mul (line 103) | def complex_mul(nodes):
  function remove_close_clear_clc (line 119) | def remove_close_clear_clc(nodes):
  function modify_find (line 128) | def modify_find(nodes):
  function modify_define_first (line 142) | def modify_define_first(project):
  function modify_arma_last (line 158) | def modify_arma_last(project):
  function remove_nargin (line 174) | def remove_nargin(project):
  function add_parameters (line 207) | def add_parameters(project):

FILE: src/matlab2cpp/mwrapmat.py
  class Wrapmat (line 6) | class Wrapmat:
    method __init__ (line 8) | def __init__(self):
    method __del__ (line 15) | def __del__(self):
    method eval_code (line 18) | def eval_code(self, builder):
    method _evaluate (line 47) | def _evaluate(self, code_block):

FILE: src/matlab2cpp/node/backend.py
  function flatten (line 12) | def flatten(node, ordered=False, reverse=False, inverse=False):
  function summary (line 58) | def summary(node, opt):
  function auxillary (line 131) | def auxillary(node, type, convert):
  function resize (line 225) | def resize(node):
  function error (line 258) | def error(node, msg, onlyw=False):
  function create_declare (line 307) | def create_declare(node):
  function suggest_datatype (line 373) | def suggest_datatype(node):
  function translate (line 467) | def translate(node, opt=None):
  function translate_one (line 507) | def translate_one(node, opt):
  function include (line 633) | def include(node, name, **kws):
  function wall_clock (line 733) | def wall_clock(node):
  function plotting (line 750) | def plotting(node):

FILE: src/matlab2cpp/node/frontend.py
  class Node (line 9) | class Node(object):
    method __init__ (line 132) | def __init__(self, parent=None, name="", value="", pointer=0,
    method summary (line 162) | def summary(self, args=None):
    method translate (line 175) | def translate(self, opt=None, only=False):
    method properties (line 193) | def properties(self):
    method auxiliary (line 262) | def auxiliary(self, type=None, convert=False):
    method resize (line 310) | def resize(self):
    method include (line 321) | def include(self, name, **kws):
    method warning (line 345) | def warning(self, msg):
    method error (line 357) | def error(self, msg):
    method create_declare (line 373) | def create_declare(self):
    method suggest_datatype (line 385) | def suggest_datatype(self):
    method wall_clock (line 394) | def wall_clock(self):
    method __getitem__ (line 402) | def __getitem__(self, index):
    method __contains__ (line 452) | def __contains__(self, i):
    method __setitem__ (line 461) | def __setitem__(self, key, val):
    method __len__ (line 464) | def __len__(self):
    method __str__ (line 467) | def __str__(self):
    method __add__ (line 470) | def __add__(self, val):
    method __radd__ (line 473) | def __radd__(self, val):
    method __iter__ (line 476) | def __iter__(self):
    method append (line 479) | def append(self, node):
    method pop (line 482) | def pop(self, index):
    method flatten (line 485) | def flatten(self, ordered=False, reverse=False, inverse=False):
    method plotting (line 521) | def plotting(self):

FILE: src/matlab2cpp/node/reference.py
  class Property_reference (line 21) | class Property_reference(object):
    method __init__ (line 24) | def __init__(self, name, default=None):
    method __get__ (line 27) | def __get__(self, instance, owner):
    method __set__ (line 30) | def __set__(self, instance, value):
  class Recursive_property_reference (line 33) | class Recursive_property_reference(object):
    method __init__ (line 36) | def __init__(self, name):
    method __get__ (line 39) | def __get__(self, instance, owner):
    method __set__ (line 52) | def __set__(self, instance, value):
  class File_reference (line 55) | class File_reference(object):
    method __get__ (line 56) | def __get__(self, instance, owner):
  class Line_reference (line 69) | class Line_reference(object):
    method __get__ (line 71) | def __get__(self, instance, owner):
  class Group_reference (line 95) | class Group_reference(object):
    method __get__ (line 97) | def __get__(self, instance, owner):
  class Func_reference (line 112) | class Func_reference(object):
    method __get__ (line 114) | def __get__(self, instance, owner):
  class Program_reference (line 127) | class Program_reference(object):
    method __get__ (line 128) | def __get__(self, instance, owner):
  class Project_reference (line 141) | class Project_reference(object):
    method __get__ (line 142) | def __get__(self, instance, owner):
  class Names (line 156) | class Names(object):
    method __get__ (line 157) | def __get__(self, instance, owner):
  class Declare_reference (line 161) | class Declare_reference(object):
    method __get__ (line 163) | def __get__(self, instance, owner):

FILE: src/matlab2cpp/parser.py
  function matlab_file_completer (line 20) | def matlab_file_completer(prefix, **kws):
  function create_parser (line 25) | def create_parser():

FILE: src/matlab2cpp/qfunctions.py
  function build (line 28) | def build(
  function qcpp (line 99) | def qcpp(code, suggest=True, **kws):
  function qhpp (line 196) | def qhpp(code, suggest=False):
  function qpy (line 315) | def qpy(code, suggest=True, prefix=False):
  function qlog (line 393) | def qlog(code, suggest=False, **kws):
  function qtree (line 450) | def qtree(code, suggest=False, core=False):
  function qscript (line 544) | def qscript(code, suggest=True, ftypes={}, **kws):

FILE: src/matlab2cpp/rules/_cell.py
  function Cell (line 3) | def Cell(node):
  function Assign (line 11) | def Assign(node):

FILE: src/matlab2cpp/rules/_code_block.py
  function Statement (line 13) | def Statement(node):
  function While (line 44) | def While(node):
  function Branch (line 72) | def Branch(node):
  function If (line 109) | def If(node):
  function Elif (line 146) | def Elif(node):
  function Else (line 190) | def Else(node):
  function Switch (line 232) | def Switch(node):
  function Case (line 273) | def Case(node):
  function Otherwise (line 324) | def Otherwise(node):
  function Tryblock (line 354) | def Tryblock(node):
  function Try (line 387) | def Try(node):
  function Catch (line 404) | def Catch(node):
  function Block (line 431) | def Block(node):
  function Assigns (line 467) | def Assigns(node):
  function Parfor (line 509) | def Parfor(node):
  function For (line 604) | def For(node):
  function Pragma_for (line 705) | def Pragma_for(node):
  function Bcomment (line 711) | def Bcomment(node):
  function Lcomment (line 731) | def Lcomment(node):
  function Ecomment (line 751) | def Ecomment(node):

FILE: src/matlab2cpp/rules/_expression.py
  function Paren (line 4) | def Paren(node):
  function End (line 14) | def End(node):
  function Return (line 57) | def Return(node):
  function Mul (line 95) | def Mul(node):
  function Elmul (line 198) | def Elmul(node):
  function Plus (line 227) | def Plus(node):
  function Minus (line 254) | def Minus(node):
  function Elementdivision (line 278) | def Elementdivision(node):
  function Leftelementdivision (line 329) | def Leftelementdivision(node):
  function Matrixdivision (line 365) | def Matrixdivision(node):
  function Leftmatrixdivision (line 461) | def Leftmatrixdivision(node):
  function Exp (line 557) | def Exp(node):
  function Elexp (line 567) | def Elexp(node):
  function All (line 587) | def All(node):
  function Transpose (line 613) | def Transpose(node):
  function Ctranspose (line 642) | def Ctranspose(node):
  function Colon (line 666) | def Colon(node):

FILE: src/matlab2cpp/rules/_func_lambda.py
  function Get (line 10) | def Get(node):
  function Lambda (line 27) | def Lambda(node):
  function Params (line 72) | def Params(node):
  function Declares (line 84) | def Declares(node):

FILE: src/matlab2cpp/rules/_func_return.py
  function Var (line 32) | def Var(node):
  function Params (line 61) | def Params(node):
  function Declares (line 97) | def Declares(node):
  function Func (line 165) | def Func(node):
  function Main (line 212) | def Main(node):

FILE: src/matlab2cpp/rules/_func_returns.py
  function Func (line 10) | def Func(node):
  function Var (line 50) | def Var(node):
  function Assign (line 73) | def Assign(node):
  function Assigns (line 79) | def Assigns(node):
  function Returns (line 117) | def Returns(node):
  function Params (line 139) | def Params(node):
  function Declares (line 172) | def Declares(node):

FILE: src/matlab2cpp/rules/_matrix.py
  function Vector (line 17) | def Vector(node):
  function Matrix (line 54) | def Matrix(node):
  function Assign (line 151) | def Assign(node):
  function Cell (line 237) | def Cell(node):

FILE: src/matlab2cpp/rules/_program.py
  function add_indenting (line 7) | def add_indenting(text):
  function number_fix (line 34) | def number_fix(text):
  function strip (line 60) | def strip(text):
  function Project (line 79) | def Project(node):
  function Program (line 82) | def Program(node):
  function Includes (line 86) | def Includes(node):
  function Headers (line 89) | def Headers(node):
  function Header (line 93) | def Header(node):
  function Funcs (line 142) | def Funcs(node):
  function Inlines (line 151) | def Inlines(node):
  function Inline (line 171) | def Inline(node):
  function Log (line 176) | def Log(node):
  function Error (line 180) | def Error(node):
  function Warning (line 186) | def Warning(node):
  function Struct (line 192) | def Struct(node):

FILE: src/matlab2cpp/rules/_reserved.py
  function Var (line 39) | def Var(node):
  function Get_NaN (line 51) | def Get_NaN(node):
  function conv_to (line 54) | def conv_to(str, type):
  function Assign_elemwise_ (line 57) | def Assign_elemwise_(node):
  function Get_exp (line 74) | def Get_exp(node):
  function Get_log (line 83) | def Get_log(node):
  function Get_log2 (line 91) | def Get_log2(node):
  function Get_log10 (line 100) | def Get_log10(node) :
  function Get_power (line 107) | def Get_power(node):
  function Get_floor (line 114) | def Get_floor(node):
  function Get_ceil (line 127) | def Get_ceil(node):
  function Get_round (line 136) | def Get_round(node):
  function Get_fix (line 162) | def Get_fix(node):
  function Assign_fix (line 174) | def Assign_fix(node):
  function Get_cos (line 177) | def Get_cos(node):
  function Get_acos (line 184) | def Get_acos(node):
  function Get_cosh (line 191) | def Get_cosh(node):
  function Get_acosh (line 198) | def Get_acosh(node):
  function Get_sin (line 206) | def Get_sin(node):
  function Get_asin (line 213) | def Get_asin(node):
  function Get_sinh (line 220) | def Get_sinh(node):
  function Get_asinh (line 227) | def Get_asinh(node):
  function Get_mod (line 240) | def Get_mod(node):
  function Get_abs (line 246) | def Get_abs(node):
  function Get_sqrt (line 256) | def Get_sqrt(node):
  function Get_and (line 263) | def Get_and(node):
  function Get_or (line 266) | def Get_or(node):
  function Get_not (line 270) | def Get_not(node):
  function Get_any (line 276) | def Get_any(node):
  function Get_all (line 286) | def Get_all(node):
  function Get_isequal (line 298) | def Get_isequal(node):
  function Var_return (line 301) | def Var_return(node):
  function Get_size (line 309) | def Get_size(node):
  function Assign_size (line 384) | def Assign_size(node):
  function Assigns_size (line 392) | def Assigns_size(node):
  function Get_chol (line 429) | def Get_chol(node):
  function Assign_chol (line 433) | def Assign_chol(node):
  function Assigns_chol (line 442) | def Assigns_chol(node):
  function Get_unique (line 460) | def Get_unique(node):
  function Assign_unique (line 464) | def Assign_unique(node):
  function Assigns_unique (line 469) | def Assigns_unique(node):
  function Get_sortrows (line 474) | def Get_sortrows(node):
  function Get_intersect (line 479) | def Get_intersect(node):
  function Assign_intersect (line 484) | def Assign_intersect(node):
  function Assigns_intersect (line 494) | def Assigns_intersect(node):
  function Get_length (line 499) | def Get_length(node):
  function Get_isempty (line 507) | def Get_isempty(node):
  function Get_min (line 511) | def Get_min(node):
  function Assigns_min (line 561) | def Assigns_min(node):
  function Get_max (line 579) | def Get_max(node):
  function Assigns_max (line 630) | def Assigns_max(node):
  function Get_eye (line 652) | def Get_eye(node):
  function Get_trace (line 670) | def Get_trace(node):
  function Get_transpose (line 673) | def Get_transpose(node):
  function Get_ctranspose (line 679) | def Get_ctranspose(node):
  function Get_fliplr (line 685) | def Get_fliplr(node):
  function Get_flipud (line 688) | def Get_flipud(node):
  function Get_ones (line 692) | def Get_ones(node):
  function Get_zeros (line 740) | def Get_zeros(node):
  function Get_qr (line 791) | def Get_qr(node):
  function Assign_qr (line 794) | def Assign_qr(node):
  function Assigns_qr (line 797) | def Assigns_qr(node):
  function Var_rand (line 800) | def Var_rand(node):
  function Get_rand (line 804) | def Get_rand(node):
  function Var_clear (line 807) | def Var_clear(node):
  function Get_clear (line 815) | def Get_clear(node):
  function Var_close (line 818) | def Var_close(node):
  function Get_close (line 821) | def Get_close(node):
  function Var_clc (line 824) | def Var_clc(node):
  function Get_clc (line 827) | def Get_clc(node):
  function Var_clf (line 830) | def Var_clf(node):
  function Get_clf (line 833) | def Get_clf(node):
  function Var_more (line 836) | def Var_more(node):
  function Get_more (line 839) | def Get_more(node):
  function Var_format (line 842) | def Var_format(node):
  function Get_format (line 845) | def Get_format(node):
  function Get__conv_to (line 848) | def Get__conv_to(node):
  function Get__reshape (line 851) | def Get__reshape(node):
  function Get_reshape (line 854) | def Get_reshape(node):
  function Get_nextpow2 (line 857) | def Get_nextpow2(node):
  function Assign_fft (line 862) | def Assign_fft(node):
  function Assign_ifft (line 869) | def Assign_ifft(node):
  function Get_fft (line 872) | def Get_fft(node):
  function Get_ifft (line 900) | def Get_ifft(node):
  function Get_fft2 (line 937) | def Get_fft2(node):
  function Get_ifft2 (line 944) | def Get_ifft2(node):
  function Assign_fft2 (line 951) | def Assign_fft2(node):
  function Assign_ifft2 (line 954) | def Assign_ifft2(node):
  function Get_hankel (line 958) | def Get_hankel(node):
  function Get_interp1 (line 962) | def Get_interp1(node):
  function Assign_interp1 (line 976) | def Assign_interp1(node):
  function Get_linspace (line 979) | def Get_linspace(node):
  function Get_sum (line 983) | def Get_sum(node):
  function Get_cumsum (line 1031) | def Get_cumsum(node):
  function Get_conj (line 1039) | def Get_conj(node):
  function Get_imag (line 1049) | def Get_imag(node):
  function Get_real (line 1052) | def Get_real(node):
  function Var_tic (line 1056) | def Var_tic(node):
  function Get_tic (line 1059) | def Get_tic(node):
  function Assign_tic (line 1064) | def Assign_tic(node):
  function Var_toc (line 1069) | def Var_toc(node):
  function Get_toc (line 1072) | def Get_toc(node):
  function Get_diag (line 1083) | def Get_diag(node):
  function Get_tril (line 1088) | def Get_tril(node):
  function Get_triu (line 1091) | def Get_triu(node):
  function Var_disp (line 1094) | def Var_disp(node):
  function Get_disp (line 1097) | def Get_disp(node):
  function Get_fprintf (line 1110) | def Get_fprintf(node):
  function Get_error (line 1118) | def Get_error(node):
  function Get_convmtx (line 1123) | def Get_convmtx(node):
  function Get_conv2 (line 1127) | def Get_conv2(node):
  function Get_figure (line 1133) | def Get_figure(node):
  function Var_hold (line 1137) | def Var_hold(node):
  function Get_hold (line 1140) | def Get_hold(node):
  function Var_load (line 1157) | def Var_load(node):
  function Get_load (line 1160) | def Get_load(node):
  function Var_clf (line 1172) | def Var_clf(node):
  function Get_clf (line 1175) | def Get_clf(node):
  function Var_cla (line 1179) | def Var_cla(node):
  function Get_cla (line 1182) | def Get_cla(node):
  function Get_show (line 1186) | def Get_show(node):
  function Get_xlabel (line 1190) | def Get_xlabel(node):
  function Get_ylabel (line 1194) | def Get_ylabel(node):
  function Get_title (line 1198) | def Get_title(node):
  function Get_plot (line 1202) | def Get_plot(node):
  function Get_imshow (line 1263) | def Get_imshow(node):
  function Get_imagesc (line 1267) | def Get_imagesc(node):
  function Get_wigb (line 1271) | def Get_wigb(node):
  function Var_colorbar (line 1275) | def Var_colorbar(node):
  function Get_colorbar (line 1278) | def Get_colorbar(node):
  function Get_xlim (line 1282) | def Get_xlim(node):
  function Get_ylim (line 1316) | def Get_ylim(node):
  function Get_caxis (line 1349) | def Get_caxis(node):
  function Get_axis (line 1381) | def Get_axis(node):
  function Var_grid (line 1417) | def Var_grid(node):
  function Get_grid (line 1420) | def Get_grid(node):
  function Get_subplot (line 1437) | def Get_subplot(node):
  function Get_colormap (line 1441) | def Get_colormap(node):
  function Get__splot (line 1453) | def Get__splot(node):
  function Get_logspace (line 1456) | def Get_logspace(node):
  function Get_find (line 1465) | def Get_find(node):

FILE: src/matlab2cpp/rules/_string.py
  function String (line 6) | def String(node):

FILE: src/matlab2cpp/rules/_struct.py
  function Matrix (line 9) | def Matrix(node):

FILE: src/matlab2cpp/rules/_structs.py
  function Counter (line 7) | def Counter(node):
  function Fget (line 13) | def Fget(node):
  function Fset (line 16) | def Fset(node):
  function Matrix (line 19) | def Matrix(node):

FILE: src/matlab2cpp/rules/_unknown.py
  function Assigns (line 7) | def Assigns(node):
  function Matrix (line 13) | def Matrix(node):
  function Get (line 16) | def Get(node):
  function Set (line 44) | def Set(node):

FILE: src/matlab2cpp/rules/armadillo.py
  function configure_arg (line 7) | def configure_arg(node, index):
  function scalar_assign (line 115) | def scalar_assign(node):
  function include (line 166) | def include(node):

FILE: src/matlab2cpp/rules/assign.py
  function Assign (line 4) | def Assign(node):

FILE: src/matlab2cpp/rules/cube.py
  function Get (line 4) | def Get(node):
  function Set (line 98) | def Set(node):
  function Resize (line 190) | def Resize(node):

FILE: src/matlab2cpp/rules/function.py
  function type_string (line 3) | def type_string(node):

FILE: src/matlab2cpp/rules/mat.py
  function Get (line 3) | def Get(node):
  function Set (line 110) | def Set(node):

FILE: src/matlab2cpp/rules/parallel.py
  function variable_lists (line 2) | def variable_lists(node):
  function omp (line 64) | def omp(node, start, stop, step):
  function tbb (line 80) | def tbb(node, start, stop, step):

FILE: src/matlab2cpp/rules/rowvec.py
  function Get (line 3) | def Get(node):
  function Set (line 53) | def Set(node):

FILE: src/matlab2cpp/rules/variables.py
  function Var (line 2) | def Var(node):
  function Fvar (line 7) | def Fvar(node):
  function Cvar (line 17) | def Cvar(node):
  function Set (line 28) | def Set(node):
  function Cset (line 35) | def Cset(node):
  function Sset (line 53) | def Sset(node):
  function Nset (line 59) | def Nset(node):
  function Get (line 62) | def Get(node):
  function Cget (line 65) | def Cget(node):
  function Fget (line 83) | def Fget(node):
  function Sget (line 89) | def Sget(node):
  function Nget (line 92) | def Nget(node):

FILE: src/matlab2cpp/rules/vec.py
  function Get (line 4) | def Get(node):
  function Set (line 60) | def Set(node):

FILE: src/matlab2cpp/setpaths.py
  function multiple_folder_paths (line 4) | def multiple_folder_paths(setpath_file):

FILE: src/matlab2cpp/supplement/__init__.py
  function str_variables (line 26) | def str_variables(types_f={}, types_s={}, types_i=[],

FILE: src/matlab2cpp/supplement/functions.py
  function set (line 4) | def set(node, types):
  function get (line 32) | def get(node):
  class Ftypes (line 59) | class Ftypes(object):
    method __get__ (line 61) | def __get__(self, instance, owner):
    method __set__ (line 63) | def __set__(self, instance, value):

FILE: src/matlab2cpp/supplement/includes.py
  function set (line 6) | def set(node, types):
  function get (line 18) | def get(node):
  function write_to_includes (line 29) | def write_to_includes(include_string):
  class Itypes (line 38) | class Itypes(object):
    method __get__ (line 40) | def __get__(self, instance, owner):
    method __set__ (line 43) | def __set__(self, instance, value):

FILE: src/matlab2cpp/supplement/structs.py
  function set (line 5) | def set(node, types):
  function get (line 34) | def get(node):
  class Stypes (line 56) | class Stypes(object):
    method __get__ (line 58) | def __get__(self, instance, owner):
    method __set__ (line 61) | def __set__(self, instance, value):

FILE: src/matlab2cpp/supplement/suggests.py
  function get (line 1) | def get(node):
  class Sstypes (line 47) | class Sstypes(object):
    method __get__ (line 49) | def __get__(self, instance, owner):
    method __set__ (line 52) | def __set__(self, instance, value):

FILE: src/matlab2cpp/supplement/verbatim.py
  function set (line 4) | def set(D, code):
  function get (line 23) | def get(node):
  class Vtypes (line 34) | class Vtypes(object):
    method __get__ (line 36) | def __get__(self, instance, owner):

FILE: src/matlab2cpp/tree/assign.py
  function multi (line 18) | def multi(self, parent, cur, eq_loc):
  function single (line 96) | def single(self, parent, cur, eq_loc):

FILE: src/matlab2cpp/tree/branches.py
  function trybranch (line 24) | def trybranch(self, parent, cur):
  function switch (line 111) | def switch(self, parent, cur):
  function whileloop (line 240) | def whileloop(self, parent, cur):
  function parforloop (line 315) | def parforloop(self, parent, cur):
  function forloop (line 369) | def forloop(self, parent, cur):
  function ifbranch (line 470) | def ifbranch(self, parent, start):

FILE: src/matlab2cpp/tree/builder.py
  class Builder (line 5) | class Builder(object):
    method __init__ (line 52) | def __init__(self, disp=False, comments=True, original=False, enable_o...
    method __getitem__ (line 76) | def __getitem__(self, index):
    method __str__ (line 97) | def __str__(self):
    method load (line 117) | def load(self, name, code):
    method get_unknowns (line 201) | def get_unknowns(self, index=-1):
    method configure (line 222) | def configure(self, suggest=True, **kws):
    method translate (line 296) | def translate(self):
    method syntaxerror (line 312) | def syntaxerror(self, cur, text):
    method create_program (line 351) | def create_program(self, name):
    method create_function (line 378) | def create_function(self, parent, cur):
    method create_main (line 404) | def create_main(self, parent, cur):
    method create_lambda_assign (line 430) | def create_lambda_assign(self, parent, cur, eq_loc):
    method create_lambda_func (line 455) | def create_lambda_func(self, parent, cur):
    method create_codeblock (line 489) | def create_codeblock(self, parent, cur):
    method create_assigns (line 523) | def create_assigns(self, parent, cur, eq_loc):
    method create_assign (line 548) | def create_assign(self, parent, cur, eq_loc):
    method create_parfor (line 572) | def create_parfor(self, parent, cur):
    method create_for (line 593) | def create_for(self, parent, cur):
    method create_if (line 618) | def create_if(self, parent, cur):
    method create_while (line 654) | def create_while(self, parent, cur):
    method create_switch (line 678) | def create_switch(self, parent, cur):
    method create_try (line 712) | def create_try(self, parent, cur):
    method create_cell (line 738) | def create_cell(self, parent, cur):
    method create_pragma_parfor (line 759) | def create_pragma_parfor(self, parent, cur):
    method create_comment (line 764) | def create_comment(self, parent, cur):
    method create_verbatim (line 786) | def create_verbatim(self, parent, cur):
    method create_string (line 809) | def create_string(self, parent, cur):
    method create_list (line 830) | def create_list(self, parent, cur):
    method create_matrix (line 851) | def create_matrix(self, parent, cur):
    method create_number (line 877) | def create_number(self, parent, cur):
    method create_reserved (line 898) | def create_reserved(self, parent, cur):
    method create_variable (line 927) | def create_variable(self, parent, cur):
    method create_assign_variable (line 948) | def create_assign_variable(self, parent, cur, end=None):
    method create_expression (line 971) | def create_expression(self, parent, cur, end=None):

FILE: src/matlab2cpp/tree/codeblock.py
  function codeblock (line 8) | def codeblock(self, parent, start):

FILE: src/matlab2cpp/tree/expression.py
  function create (line 33) | def create(self, node, start, end=None, start_opr=None):

FILE: src/matlab2cpp/tree/findend.py
  function expression (line 33) | def expression(self, start):
  function expression_space (line 96) | def expression_space(self, start):
  function matrix (line 169) | def matrix(self, start):
  function string (line 228) | def string(self, start):
  function pragma_for (line 252) | def pragma_for(self,start):
  function tbb_for (line 261) | def tbb_for(self, start):
  function comment (line 269) | def comment(self, start):
  function verbatim (line 300) | def verbatim(self, start):
  function dots (line 317) | def dots(self, start):
  function paren (line 339) | def paren(self, start):
  function cell (line 378) | def cell(self, start):

FILE: src/matlab2cpp/tree/functions.py
  function program (line 25) | def program(self, name):
  function function (line 110) | def function(self, parent, cur):
  function main (line 327) | def main(self, parent, cur):
  function lambda_assign (line 381) | def lambda_assign(self, node, cur, eq_loc):
  function lambda_func (line 469) | def lambda_func(self, node, cur):

FILE: src/matlab2cpp/tree/identify.py
  function space_delimiter (line 20) | def space_delimiter(self, start):
  function string (line 63) | def string(self, k):
  function space_delimited (line 96) | def space_delimited(self, start):

FILE: src/matlab2cpp/tree/iterate.py
  function comma_list (line 18) | def comma_list(self, start):
  function space_list (line 82) | def space_list(self, start):

FILE: src/matlab2cpp/tree/misc.py
  function number (line 7) | def number(self, node, start):
  function string (line 135) | def string(self, parent, cur):
  function list (line 180) | def list(self, parent, cur):
  function pragma_for (line 236) | def pragma_for(self, parent, cur):
  function comment (line 256) | def comment(self, parent, cur):
  function verbatim (line 316) | def verbatim(self, parent, cur):
  function matrix (line 345) | def matrix(self, node, cur):
  function cell (line 445) | def cell(self, node, cur):
  function reserved (line 510) | def reserved(self, node, start):

FILE: src/matlab2cpp/tree/suppliment.py
  class Fbuilder (line 2) | class Fbuilder(object):
    method __get__ (line 4) | def __get__(self, instance, owner):
    method __set__ (line 9) | def __set__(self, instance, value):
  class Ibuilder (line 14) | class Ibuilder(object):
    method __get__ (line 16) | def __get__(self, instance, owner):
    method __set__ (line 21) | def __set__(self, instance, value):
  class Sbuilder (line 26) | class Sbuilder(object):
    method __get__ (line 28) | def __get__(self, instance, owner):
    method __set__ (line 33) | def __set__(self, instance, value):
  class Vbuilder (line 38) | class Vbuilder(object):
    method __get__ (line 40) | def __get__(self, instance, owner):
    method __set__ (line 45) | def __set__(self, instance, value):

FILE: src/matlab2cpp/tree/variables.py
  function assign (line 9) | def assign(self, parent, cur, end=None):
  function variable (line 258) | def variable(self, parent, cur):
  function cell_arg (line 501) | def cell_arg(self, cset, cur):

FILE: test/data/function_reference.hpp
  function irowvec (line 10) | irowvec f(irowvec x)
  function g (line 17) | void g()

FILE: test/data/function_reference_2.hpp
  function f (line 10) | void f(irowvec a, ivec b, irowvec& y, ivec& z)
  function g (line 16) | void g()

FILE: test/data/fx_decon.cpp
  function mat (line 12) | mat fx_decon(mat DATA, double dt, int lf, double mu, double flow, int fh...
  function ar_modeling (line 56) | void ar_modeling(cx_vec x, int lf, double mu, cx_vec& yf, cx_vec& yb)

FILE: test/data/simple_assignment.cpp
  function main (line 4) | int main(int argc, char** argv)

FILE: test/test_conversion.py
  function test_fx_decon (line 5) | def test_fx_decon():

FILE: test/test_simple_assignment.py
  function cpp_filename (line 10) | def cpp_filename(request):
  function test_cpp_executables (line 14) | def test_cpp_executables(cpp_filename):
  function hpp_filename (line 31) | def hpp_filename(request):
  function test_hpp_executables (line 35) | def test_hpp_executables(hpp_filename):
Condensed preview — 151 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (687K chars).
[
  {
    "path": ".circleci/config.yml",
    "chars": 970,
    "preview": "version: 2\njobs:\n    build:\n        working_directory: ~/matlab2cpp\n        docker:\n            - image: circleci/python"
  },
  {
    "path": ".coveragerc",
    "chars": 259,
    "preview": "[run]\nbranch = True\nsource = codecov\n\n[report]\nexclude_lines =\n    coverage: ignore\n    def __repr__\n    raise NotImplem"
  },
  {
    "path": ".gitignore",
    "chars": 675,
    "preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\n"
  },
  {
    "path": "LICENSE",
    "chars": 1476,
    "preview": "Copyright (c) 2015, jonathf\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmod"
  },
  {
    "path": "PKG-INFO",
    "chars": 292,
    "preview": "Metadata-Version: 1.0\nName: matlab2cpp\nVersion: 0.2\nSummary: A semi-automatic tool for converting Matlab to C++\nHome-pag"
  },
  {
    "path": "README.rst",
    "chars": 5669,
    "preview": ".. attention::\n\n    Matlab2cpp er currently unmaintained. As a mainteiner this project ended up\n    on the short end of "
  },
  {
    "path": "conftest.py",
    "chars": 1103,
    "preview": "\"\"\"Global configuration.\"\"\"\nimport os\nimport inspect\nimport shutil\n\nimport pytest\nimport matlab2cpp\nfrom matlab2cpp impo"
  },
  {
    "path": "doc/previous_doc/Makefile",
    "chars": 7434,
    "preview": "# Makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line.\nSPHINXOPTS    =\nSPHINXBUILD "
  },
  {
    "path": "doc/previous_doc/source/conf.py",
    "chars": 9653,
    "preview": "# -*- coding: utf-8 -*-\n#\n# matlab2cpp documentation build configuration file, created by\n# sphinx-quickstart on Mon Jun"
  },
  {
    "path": "doc/previous_doc/source/dev00_overview.rst",
    "chars": 74,
    "preview": ".. _dev00:\n\nModule overview\n===============\n\n.. automodule:: matlab2cpp\n\n\n"
  },
  {
    "path": "doc/previous_doc/source/dev01_qfuncs.rst",
    "chars": 350,
    "preview": ".. _dev01:\n\nQuick translation functions\n---------------------------\n\n.. automodule:: matlab2cpp.qfunctions\n\n.. autofunct"
  },
  {
    "path": "doc/previous_doc/source/dev02_tree.rst",
    "chars": 1278,
    "preview": ".. _dev02:\n\nThe tree constructor\n====================\n\n.. automodule:: matlab2cpp.tree\n\nThe Builder class\n--------------"
  },
  {
    "path": "doc/previous_doc/source/dev03_node.rst",
    "chars": 304,
    "preview": ".. _dev03:\n\nNode representation\n===================\n.. automodule:: matlab2cpp.node\n\nThe Node class\n--------------\n.. au"
  },
  {
    "path": "doc/previous_doc/source/dev04_datatype.rst",
    "chars": 69,
    "preview": ".. _dev04:\nDatatypes\n=========\n\n.. automodule:: matlab2cpp.datatype\n\n"
  },
  {
    "path": "doc/previous_doc/source/dev05_configure.rst",
    "chars": 97,
    "preview": ".. _dev05:\n\nAuto-configure datatype\n=======================\n.. automodule:: matlab2cpp.configure\n"
  },
  {
    "path": "doc/previous_doc/source/dev06_collection.rst",
    "chars": 4112,
    "preview": ".. _dev06:\n\nCollection\n==========\n.. automodule:: matlab2cpp.collection\n\n.. autoclass:: matlab2cpp.collection.All\n.. aut"
  },
  {
    "path": "doc/previous_doc/source/dev07_rules.rst",
    "chars": 1803,
    "preview": ".. _dev07:\n\nTranslation rules\n=================\n\n.. automodule:: matlab2cpp.rules\n\nDatatype driven rules\n---------------"
  },
  {
    "path": "doc/previous_doc/source/dev08_supplement.rst",
    "chars": 406,
    "preview": ".. _dev08:\n\nDatatype scope\n==============\n.. automodule:: matlab2cpp.supplement\n\nInput/Output classes\n------------------"
  },
  {
    "path": "doc/previous_doc/source/dev09_testsuite.rst",
    "chars": 69,
    "preview": ".. _dev09:\n\nTestsuite\n=========\n.. automodule:: matlab2cpp.testsuite\n"
  },
  {
    "path": "doc/previous_doc/source/index.rst",
    "chars": 460,
    "preview": "Matlab2cpp Manual\n=================\n\n===========\nUser Manual\n===========\n\n.. toctree::\n    :maxdepth: 3\n\n    usr00_intro"
  },
  {
    "path": "doc/previous_doc/source/usr00_intro.rst",
    "chars": 67,
    "preview": ".. _usr00:\n\nIntroduction\n============\n.. include:: ../../README.md\n"
  },
  {
    "path": "doc/previous_doc/source/usr01_interaction.rst",
    "chars": 52,
    "preview": ".. automodule:: matlab2cpp.manual.usr01_interaction\n"
  },
  {
    "path": "doc/previous_doc/source/usr02_datatype.rst",
    "chars": 49,
    "preview": ".. automodule:: matlab2cpp.manual.usr02_datatype\n"
  },
  {
    "path": "doc/previous_doc/source/usr03_rules.rst",
    "chars": 46,
    "preview": ".. automodule:: matlab2cpp.manual.usr03_rules\n"
  },
  {
    "path": "doc/previous_doc/source/usr04_node.rst",
    "chars": 45,
    "preview": ".. automodule:: matlab2cpp.manual.usr04_node\n"
  },
  {
    "path": "doc/user_manual/Makefile",
    "chars": 7434,
    "preview": "# Makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line.\nSPHINXOPTS    =\nSPHINXBUILD "
  },
  {
    "path": "doc/user_manual/source/conf.py",
    "chars": 9661,
    "preview": "# -*- coding: utf-8 -*-\n#\n# matlab2cpp documentation build configuration file, created by\n# sphinx-quickstart on Mon Jun"
  },
  {
    "path": "doc/user_manual/source/conf.py~",
    "chars": 9656,
    "preview": "# -*- coding: utf-8 -*-\n#\n# matlab2cpp documentation build configuration file, created by\n# sphinx-quickstart on Mon Jun"
  },
  {
    "path": "doc/user_manual/source/dev00_overview.rst~",
    "chars": 74,
    "preview": ".. _dev00:\n\nModule overview\n===============\n\n.. automodule:: matlab2cpp\n\n\n"
  },
  {
    "path": "doc/user_manual/source/index.rst",
    "chars": 205,
    "preview": "Matlab2cpp User Manual\n=================\n\n===========\nUser Manual\n===========\n\n.. toctree::\n    :maxdepth: 3\n\n    intro\n"
  },
  {
    "path": "doc/user_manual/source/index.rst~",
    "chars": 200,
    "preview": "Matlab2cpp User Manual\n=================\n\n===========\nUser Manual\n===========\n\n.. toctree::\n    :maxdepth: 3\n\n    usr00_"
  },
  {
    "path": "doc/user_manual/source/usr00_intro.rst~",
    "chars": 128,
    "preview": ".. _usr00:\n\nIntroduction\n************\n..\n\t.. include:: ../../../README.md\n\n.. automodule:: matlab2cpp.manual.usr00_intro"
  },
  {
    "path": "doc/user_manual/source/usr02_datatype.rst",
    "chars": 14947,
    "preview": "..\n    .. automodule:: matlab2cpp.manual.usr02_datatype\n\n.. _usr02:\n\nConfiguring translation\n=======================\n\nOn"
  },
  {
    "path": "doc/user_manual/source/usr03_rules.rst",
    "chars": 46,
    "preview": ".. automodule:: matlab2cpp.manual.usr03_rules\n"
  },
  {
    "path": "doc/user_manual/source/usr04_node.rst",
    "chars": 45,
    "preview": ".. automodule:: matlab2cpp.manual.usr04_node\n"
  },
  {
    "path": "requirements.txt",
    "chars": 70,
    "preview": "pytest==3.2.2\npytest-runner==2.12.1\npytest-cov==2.5.1\ncodecov==2.0.16\n"
  },
  {
    "path": "setup.cfg",
    "chars": 178,
    "preview": "[aliases]\ntest = pytest\n\n[tool:pytest]\nnorecursedirs = test/data\ntestpaths = src/matlab2cpp test\naddopts = --doctest-mod"
  },
  {
    "path": "setup.py",
    "chars": 858,
    "preview": "\"\"\"Main installer.\"\"\"\nfrom setuptools import setup, find_packages\n\nsetup(\n    name=\"matlab2cpp\",\n    version=\"2.0.1\",\n  "
  },
  {
    "path": "src/matlab2cpp/__init__.py",
    "chars": 2651,
    "preview": "#!/usr/bin/env python\n# PYTHON_ARGCOMPLETE_OK\n\"\"\"\n\nThe toolbox is sorted into the following modules:\n\n+-----------------"
  },
  {
    "path": "src/matlab2cpp/collection.py",
    "chars": 26110,
    "preview": "# encoding: utf-8\nr\"\"\"\nA full summary of all nodes.\n\n+---------------------+--------------------+----------------+------"
  },
  {
    "path": "src/matlab2cpp/configure/__init__.py",
    "chars": 82,
    "preview": "from .frontend import configure, loop\nfrom . import datatypes, backends, reserved\n"
  },
  {
    "path": "src/matlab2cpp/configure/armadillo.py",
    "chars": 3000,
    "preview": "from ..rules import armadillo as arma\n\n\ndef vec(node):\n    if len(node) != 1:\n\n        if not len(node):\n            ret"
  },
  {
    "path": "src/matlab2cpp/configure/backends.py",
    "chars": 4319,
    "preview": "Project = \"program\"\nProgram = \"program\"\nIncludes = \"program\"\nFuncs = \"program\"\nInlines = \"program\"\nStructs = \"program\"\nS"
  },
  {
    "path": "src/matlab2cpp/configure/datatypes.py",
    "chars": 10473,
    "preview": "\nfrom .funcs import funcs\nfrom . import armadillo, backends, frontend\n\nCounter = \"structs\"\n\ndef Var(node):\n    \"\"\"\nExamp"
  },
  {
    "path": "src/matlab2cpp/configure/frontend.py",
    "chars": 2007,
    "preview": "\n\ndef configure(root, suggest=True, **kws):\n    \"\"\"\nconfigure backend\n\nSee also:\n    :py:func:`matlab2cpp.Builder.config"
  },
  {
    "path": "src/matlab2cpp/configure/funcs.py",
    "chars": 2078,
    "preview": "import os\n\ndef funcs(node):\n\n    func = None\n\n    # lambda scope\n    if \"_\" + node.name in node.program[1]:\n        func"
  },
  {
    "path": "src/matlab2cpp/configure/reserved.py",
    "chars": 11156,
    "preview": "Var_false = \"int\"\nVar_true = \"int\"\nVar_pi = \"double\"\nGet_linspace = \"rowvec\"\n\ndef Get_exp(node):\n    node.type = node[0]"
  },
  {
    "path": "src/matlab2cpp/datatype.py",
    "chars": 10324,
    "preview": "\"\"\"\nThe follwing constructor classes exists here:\n\n+------------------------------------------+-------------------------"
  },
  {
    "path": "src/matlab2cpp/frontend.py",
    "chars": 7831,
    "preview": "\"\"\"Execute main parser.\"\"\"\nimport time\nfrom datetime import datetime as date\nimport os\nfrom os.path import sep\nimport im"
  },
  {
    "path": "src/matlab2cpp/manual/__init__.py",
    "chars": 190,
    "preview": "\"\"\"\nSource files for the manual.\n\nPlaced here so that doctest might pick up on them.\n\"\"\"\n\n#import usr00_introduction\nfro"
  },
  {
    "path": "src/matlab2cpp/manual/usr00_introduction.py",
    "chars": 1795,
    "preview": "\"\"\"\n.. _usr00:\n\nMatlab2cpp is a semi-automatic tool for converting code from Matlab to C++. matlab2cpp is written in Pyt"
  },
  {
    "path": "src/matlab2cpp/manual/usr01_interaction.py",
    "chars": 5473,
    "preview": "\"\"\"\n.. _usr01:\n\nUser interaction\n================\n\nThe simplest way to interact with the `Matlab2cpp`-toolbox is to use "
  },
  {
    "path": "src/matlab2cpp/manual/usr02_datatype.py",
    "chars": 15121,
    "preview": "\"\"\"\n.. _usr02:\n\nConfiguring translation\n=======================\n\nOne of the translation challenges is how each variable "
  },
  {
    "path": "src/matlab2cpp/manual/usr03_rules.py",
    "chars": 8234,
    "preview": "\"\"\"\n.. _usr03:\n\nTranslation rules\n=================\n\nIn Matlab2cpp, the simplest form for translation is a simple string"
  },
  {
    "path": "src/matlab2cpp/manual/usr04_node.py",
    "chars": 9301,
    "preview": "\"\"\"\n.. _usr04:\n\nBehind the frontends\n====================\n\nCommon for all the various frontends in :py:mod:`~matlab2cpp."
  },
  {
    "path": "src/matlab2cpp/manual/usr05_installation.py",
    "chars": 5464,
    "preview": "r\"\"\"\n.. usr05:\n\nInstallation\n============\n\nRequirements:\n\n* Python 2.7.3\n* Armadillo (Not required for running, but gene"
  },
  {
    "path": "src/matlab2cpp/matlab_types.py",
    "chars": 13024,
    "preview": "import os\nimport shutil #copy files from current dir to m2cpp_temp\n#import re\nimport matlab2cpp.mwhos\nfrom matlab2cpp.da"
  },
  {
    "path": "src/matlab2cpp/modify.py",
    "chars": 9689,
    "preview": "import matlab2cpp\nimport matlab2cpp.node as nmodule\n\ndef preorder_transform_AST(node, nargin = False, suggest = False):\n"
  },
  {
    "path": "src/matlab2cpp/mwhos.py",
    "chars": 2807,
    "preview": "code=r\"\"\"function whos_f()\n    %Static variables\n    %persistent l %cellFile counter\n    %persistent m %cellFunc counter"
  },
  {
    "path": "src/matlab2cpp/mwrapmat.py",
    "chars": 4840,
    "preview": "try:\n    import mlabraw\nexcept:\n    pass\n\nclass Wrapmat:\n    #run matlab code with mlabraw\n    def __init__(self):\n     "
  },
  {
    "path": "src/matlab2cpp/node/__init__.py",
    "chars": 170,
    "preview": "\"\"\"\nThe module contains the following submodules.\n\"\"\"\nfrom .frontend import Node\n\n__all__ = [\"Node\"]\n\nif __name__ == \"__"
  },
  {
    "path": "src/matlab2cpp/node/backend.py",
    "chars": 20846,
    "preview": "import logging\nimport re\nimport os\nfrom os.path import sep\n\nimport matlab2cpp\nfrom . import m2cpp\nimport matlab2cpp.pypl"
  },
  {
    "path": "src/matlab2cpp/node/frontend.py",
    "chars": 17921,
    "preview": "from . import (\n    reference as ref,\n    backend,\n)\n\nfrom .. import datatype as dt, supplement as sup\n\n\nclass Node(obje"
  },
  {
    "path": "src/matlab2cpp/node/m2cpp.py",
    "chars": 11141,
    "preview": "code = r\"\"\"#ifndef MCONVERT_H\n#define MCONVERT_H\n\n#include <armadillo>\nusing namespace arma;\n\nnamespace m2cpp {\n\n    tem"
  },
  {
    "path": "src/matlab2cpp/node/reference.py",
    "chars": 5353,
    "preview": "\"\"\"\nEach node has a set of attributes that allows for quick access to properties and\nother node of interest.  For exampl"
  },
  {
    "path": "src/matlab2cpp/parser.py",
    "chars": 4744,
    "preview": "\"\"\"Create parser for m2cpp.\"\"\"\nimport argparse\nfrom textwrap import dedent\nimport glob\nimport matlab2cpp\n\n\nHELP_DESCRIPT"
  },
  {
    "path": "src/matlab2cpp/pyplot.py",
    "chars": 21507,
    "preview": "code = r\"\"\"\n/*\n * SPlot.h\n *\n *  Created on: 19. aug. 2010\n *      Author: nordmoen\n */\n\n#ifndef SPLOT_H_\n#define SPLOT_"
  },
  {
    "path": "src/matlab2cpp/qfunctions.py",
    "chars": 17891,
    "preview": "\n\"\"\"\nFor simplest use of the module, these function works as an alternative frontend\nto the ``mconvert`` script.\n\n+-----"
  },
  {
    "path": "src/matlab2cpp/rules/__init__.py",
    "chars": 7184,
    "preview": "\"\"\"\n.. _rules:\n\nDatatype driven rules have the same name as datatypes reference in\n:py:mod:`~matlab2cpp.datatype`. They "
  },
  {
    "path": "src/matlab2cpp/rules/_cell.py",
    "chars": 495,
    "preview": "from .variables import *\n\ndef Cell(node):\n\n    # cells must stand on own line\n    if node.parent.cls not in (\"Assign\", \""
  },
  {
    "path": "src/matlab2cpp/rules/_char.py",
    "chars": 53,
    "preview": "from .assign import Assign\nfrom .variables import *\n\n"
  },
  {
    "path": "src/matlab2cpp/rules/_code_block.py",
    "chars": 13230,
    "preview": "\"\"\"\nThis module contains all the codeblock related nodes.\nEach node can then here be nested on top of each other.\nThey a"
  },
  {
    "path": "src/matlab2cpp/rules/_cube.py",
    "chars": 118,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .cube import Get, Set, Resize\n\nDeclare = \"cube = %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_cx_cube.py",
    "chars": 121,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .cube import Get, Set, Resize\n\nDeclare = \"cx_cube = %(name)s ;\""
  },
  {
    "path": "src/matlab2cpp/rules/_cx_double.py",
    "chars": 119,
    "preview": "from .assign import Assign\nfrom .variables import *\n\nDeclare = \"cx_double %(name)s ;\"\nImag = \"cx_double(0, %(value)s)\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_cx_mat.py",
    "chars": 109,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .mat import Get, Set\n\nDeclare = \"cx_mat %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_cx_rowvec.py",
    "chars": 115,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .rowvec import Get, Set\n\nDeclare = \"cx_rowvec %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_cx_vec.py",
    "chars": 109,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .vec import Get, Set\n\nDeclare = \"cx_vec %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_double.py",
    "chars": 103,
    "preview": "from .assign import Assign\nfrom .variables import *\n\nDeclare = \"double %(name)s ;\"\nFloat = \"%(value)s\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_expression.py",
    "chars": 20248,
    "preview": "import matlab2cpp\nfrom .assign import Assign\n\ndef Paren(node):\n    \"\"\"Parenthesis surounding expression.\n\nExamples:\n    "
  },
  {
    "path": "src/matlab2cpp/rules/_fcube.py",
    "chars": 119,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .cube import Get, Set, Resize\n\nDeclare = \"fcube = %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_float.py",
    "chars": 102,
    "preview": "from .assign import Assign\nfrom .variables import *\n\nDeclare = \"float %(name)s ;\"\nFloat = \"%(value)s\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_fmat.py",
    "chars": 107,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .mat import Get, Set\n\nDeclare = \"fmat %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_frowvec.py",
    "chars": 114,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .rowvec import Get, Set\n\nDeclare = \"frowvec %(name)s ;\"\n\n"
  },
  {
    "path": "src/matlab2cpp/rules/_func_lambda.py",
    "chars": 2124,
    "preview": "\"\"\"\nAnonymous/Lambda Functions\n\"\"\"\n\nimport matlab2cpp\n\nfrom .function import type_string\nfrom .assign import Assign\n\ndef"
  },
  {
    "path": "src/matlab2cpp/rules/_func_return.py",
    "chars": 5136,
    "preview": "\"\"\"\nFunctions with single return\n\nNodes\n-----\nFunc : Function definition\n    Contains: Declares, Returns, Params, Block\n"
  },
  {
    "path": "src/matlab2cpp/rules/_func_returns.py",
    "chars": 5063,
    "preview": "\"\"\"\nFunctions with multiple returns\n\"\"\"\n\nimport matlab2cpp\nfrom .function import type_string\nfrom .variables import Get\n"
  },
  {
    "path": "src/matlab2cpp/rules/_fvec.py",
    "chars": 107,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .vec import Get, Set\n\nDeclare = \"fvec %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_icube.py",
    "chars": 119,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .cube import Get, Set, Resize\n\nDeclare = \"icube = %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_imat.py",
    "chars": 107,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .mat import Get, Set\n\nDeclare = \"imat %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_int.py",
    "chars": 100,
    "preview": "from .assign import Assign\nfrom .variables import *\n\n# Declare = \"int %(name)s ;\"\nInt = \"%(value)s\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_irowvec.py",
    "chars": 113,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .rowvec import Get, Set\n\nDeclare = \"irowvec %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_ivec.py",
    "chars": 107,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .vec import Get, Set\n\nDeclare = \"ivec %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_mat.py",
    "chars": 106,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .mat import Get, Set\n\nDeclare = \"mat %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_matrix.py",
    "chars": 7161,
    "preview": "\"\"\"\nMatrix declaration rules\n\nNodes\n-----\nMatrix : Matrix container\n    Example: \"[x;y]\"\n    Contains: Vector, ...\n\nVect"
  },
  {
    "path": "src/matlab2cpp/rules/_program.py",
    "chars": 5257,
    "preview": "import re\n\nimport matlab2cpp\nfrom . import armadillo as arma\nfrom .function import type_string\n\ndef add_indenting(text):"
  },
  {
    "path": "src/matlab2cpp/rules/_reserved.py",
    "chars": 38389,
    "preview": "\"\"\"\nReserved translation rules\n\nSee :py:attr:`rules.reserved <matlab2cpp.rules.reserved>` for a collection of\nset of the"
  },
  {
    "path": "src/matlab2cpp/rules/_rowvec.py",
    "chars": 112,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .rowvec import Get, Set\n\nDeclare = \"rowvec %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_size_t.py",
    "chars": 74,
    "preview": "from .assign import Assign\nfrom .variables import *\n\nSize_t = \"%(value)s\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_string.py",
    "chars": 245,
    "preview": "from .assign import Assign\nfrom .variables import *\n\nDeclare = \"string %(name)s ;\"\n\ndef String(node):\n    if node.name o"
  },
  {
    "path": "src/matlab2cpp/rules/_struct.py",
    "chars": 200,
    "preview": "from .assign import Assign\nfrom .variables import *\n\n#def Fvar(node): #defined in variables.py\n#    return \"%(name)s.%(v"
  },
  {
    "path": "src/matlab2cpp/rules/_structs.py",
    "chars": 1397,
    "preview": "#from assign import Assign\nfrom .variables import *\nimport matlab2cpp\n\nDeclare = \"struct %(name)s\"\n\ndef Counter(node):\n "
  },
  {
    "path": "src/matlab2cpp/rules/_ucube.py",
    "chars": 119,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .cube import Get, Set, Resize\n\nDeclare = \"ucube = %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_umat.py",
    "chars": 107,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .mat import Get, Set\n\nDeclare = \"umat %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_unknown.py",
    "chars": 2245,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom . import armadillo as arma\n\nDeclare = \"TYPE %(name)s ;\"\n\ndef As"
  },
  {
    "path": "src/matlab2cpp/rules/_urowvec.py",
    "chars": 113,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .rowvec import Get, Set\n\nDeclare = \"urowvec %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_uvec.py",
    "chars": 107,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .vec import Get, Set\n\nDeclare = \"uvec %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_uword.py",
    "chars": 82,
    "preview": "from .assign import Assign\nfrom .variables import *\n\nDeclare = \"uword %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_vec.py",
    "chars": 106,
    "preview": "from .assign import Assign\nfrom .variables import *\nfrom .vec import Get, Set\n\nDeclare = \"vec %(name)s ;\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/_verbatim.py",
    "chars": 36,
    "preview": "Verbatim = \"// %(name)s\\n%(value)s\"\n"
  },
  {
    "path": "src/matlab2cpp/rules/armadillo.py",
    "chars": 4629,
    "preview": "\"\"\"\nfiller for Armadillo\n\"\"\"\n\nimport matlab2cpp\n\ndef configure_arg(node, index):\n    \"\"\"\nConfigure an argument of an vec"
  },
  {
    "path": "src/matlab2cpp/rules/assign.py",
    "chars": 2973,
    "preview": "import matlab2cpp\nfrom . import armadillo as arma\n\ndef Assign(node):\n    \"\"\"\nAssignment (General case)\n\nArgs:\n    node ("
  },
  {
    "path": "src/matlab2cpp/rules/cube.py",
    "chars": 4942,
    "preview": "from .variables import *\nfrom . import armadillo as arma\n\ndef Get(node):\n\n    # number of argument not legal for cube\n  "
  },
  {
    "path": "src/matlab2cpp/rules/function.py",
    "chars": 2250,
    "preview": "import matlab2cpp\n\ndef type_string(node):\n    \"\"\"\nDetermine string represnentation of type.\n\nOutside scalars and armadil"
  },
  {
    "path": "src/matlab2cpp/rules/mat.py",
    "chars": 5640,
    "preview": "from . import armadillo as arma\n\ndef Get(node):\n    \"\"\"\n    Statement\n        Get (a)\n\n    a()\n\n    Assign\n        Var ("
  },
  {
    "path": "src/matlab2cpp/rules/parallel.py",
    "chars": 4721,
    "preview": "\ndef variable_lists(node):\n    nodes = node.flatten(ordered=False, reverse=False, inverse=False)\n\n    #store some variab"
  },
  {
    "path": "src/matlab2cpp/rules/rowvec.py",
    "chars": 2070,
    "preview": "from . import armadillo as arma\n\ndef Get(node):\n\n    if len(node) != 1:\n\n        if not len(node):\n            node.erro"
  },
  {
    "path": "src/matlab2cpp/rules/variables.py",
    "chars": 3862,
    "preview": "#import matlab2cpp\ndef Var(node):\n    if node.type == \"TYPE\":\n        node.error(\"unknown data type\")\n    return \"%(name"
  },
  {
    "path": "src/matlab2cpp/rules/vec.py",
    "chars": 2188,
    "preview": "from .variables import *\nfrom . import armadillo as arma\n\ndef Get(node):\n\n    if len(node) != 1:\n\n        if not len(nod"
  },
  {
    "path": "src/matlab2cpp/setpaths.py",
    "chars": 1751,
    "preview": "import os\nfrom . import tree\n\ndef multiple_folder_paths(setpath_file):\n    builder = tree.builder.Builder()\n\n    folder_"
  },
  {
    "path": "src/matlab2cpp/supplement/__init__.py",
    "chars": 4241,
    "preview": "\"\"\"\n\"\"\"\n\nPREFIX = \"\"\"# encoding: utf-8\n#\n# Supplement file\n#\n# Valid inputs:\n#\n# uword   int     float   double cx_doubl"
  },
  {
    "path": "src/matlab2cpp/supplement/functions.py",
    "chars": 1535,
    "preview": "\"\"\"\n\"\"\"\n\ndef set(node, types):\n\n    funcs = node.program[1]    \n\n    # Functions\n    for name in types.keys():\n\n        "
  },
  {
    "path": "src/matlab2cpp/supplement/includes.py",
    "chars": 886,
    "preview": "\"\"\"\n\"\"\"\nimport matlab2cpp\n\n\ndef set(node, types):\n\n    includes = node.program[0]\n\n    # Includes\n    for key in types:\n"
  },
  {
    "path": "src/matlab2cpp/supplement/structs.py",
    "chars": 1277,
    "preview": "\"\"\"\n\"\"\"\n\n\ndef set(node, types):\n    from .. import collection\n\n    structs = node.program[3]\n\n    # Structs\n    for name"
  },
  {
    "path": "src/matlab2cpp/supplement/suggests.py",
    "chars": 1171,
    "preview": "def get(node):\n\n    funcs = node.program[1]\n    structs = node.program[3]\n\n    suggest = {}\n\n    for func in funcs:\n\n   "
  },
  {
    "path": "src/matlab2cpp/supplement/verbatim.py",
    "chars": 738,
    "preview": "import re\nset_ = set\n\ndef set(D, code):\n\n    for key, value in D.items():\n\n        findterm = r'.*' + re.escape(key) + r"
  },
  {
    "path": "src/matlab2cpp/tree/__init__.py",
    "chars": 3778,
    "preview": "\"\"\"\nParsing of Matlab code is solely done through the\n:py:class:`~matlab2cpp.Builder` class. It contains three main use "
  },
  {
    "path": "src/matlab2cpp/tree/assign.py",
    "chars": 5328,
    "preview": "\"\"\"\nSupport functions for identifying assignments.\n\n+-------------------------------------------+-----------------------"
  },
  {
    "path": "src/matlab2cpp/tree/branches.py",
    "chars": 18062,
    "preview": "\"\"\"\nIterpretors related to branches, loops and try.\n\n+------------------------------------------------+-----------------"
  },
  {
    "path": "src/matlab2cpp/tree/builder.py",
    "chars": 24788,
    "preview": "from __future__ import print_function\nfrom .. import collection, rules, configure\n\n\nclass Builder(object):\n    \"\"\"\nConve"
  },
  {
    "path": "src/matlab2cpp/tree/codeblock.py",
    "chars": 7019,
    "preview": "\"\"\"The main codeblock loop\"\"\"\nfrom __future__ import print_function\n\nimport matlab2cpp\n\nfrom . import findend, constants"
  },
  {
    "path": "src/matlab2cpp/tree/constants.py",
    "chars": 1226,
    "preview": "\"\"\"\nMatlab consists of various legal start and end characters depending on context.\nThis module is a small collection of"
  },
  {
    "path": "src/matlab2cpp/tree/expression.py",
    "chars": 8885,
    "preview": "\"\"\"\nExpression interpretor\n\"\"\"\nfrom __future__ import print_function\nfrom .. import collection\n\n\nRECIVER_OPERATORS = {\n "
  },
  {
    "path": "src/matlab2cpp/tree/findend.py",
    "chars": 10363,
    "preview": "\"\"\"\nLook-ahead routines to find end character.\n\n+------------------------------------------------------+----------------"
  },
  {
    "path": "src/matlab2cpp/tree/functions.py",
    "chars": 18342,
    "preview": "\"\"\"\nFunctions, programs and meta-nodes\n\n+----------------------------------------------------+-------------------------+"
  },
  {
    "path": "src/matlab2cpp/tree/identify.py",
    "chars": 4555,
    "preview": "\"\"\"\nRutines for identifying code structure.\n\n+------------------------------------------------------+-------------------"
  },
  {
    "path": "src/matlab2cpp/tree/iterate.py",
    "chars": 3346,
    "preview": "\"\"\"\nRutines for iterating lists\n\n+------------------------------------------------+----------------------+\n| Functions  "
  },
  {
    "path": "src/matlab2cpp/tree/misc.py",
    "chars": 20175,
    "preview": "\"\"\"Interpretors that didn't fit other places\"\"\"\nfrom __future__ import print_function\nfrom .. import collection\nfrom . i"
  },
  {
    "path": "src/matlab2cpp/tree/suppliment.py",
    "chars": 1315,
    "preview": "\nclass Fbuilder(object):\n    \"Same as Ftypes, but placed in builder\"\n    def __get__(self, instance, owner):\n        out"
  },
  {
    "path": "src/matlab2cpp/tree/variables.py",
    "chars": 15418,
    "preview": "\"\"\"\nVariable interpretor\n\"\"\"\nfrom __future__ import print_function\nfrom . import constants, findend\nfrom .. import colle"
  },
  {
    "path": "test/data/function_reference.hpp",
    "chars": 286,
    "preview": "#ifndef F_M_HPP\n#define F_M_HPP\n\n#include <armadillo>\nusing namespace arma ;\n\nirowvec f(irowvec x) ;\nvoid g() ;\n\nirowvec"
  },
  {
    "path": "test/data/function_reference.m",
    "chars": 78,
    "preview": "function y=f(x)\n    y = x+2\nend\nfunction g()\n    x = [1,2,3]\n    y = f(x)\nend\n"
  },
  {
    "path": "test/data/function_reference_2.hpp",
    "chars": 397,
    "preview": "#ifndef F_M_HPP\n#define F_M_HPP\n\n#include <armadillo>\nusing namespace arma ;\n\nvoid f(irowvec a, ivec b, irowvec& y, ivec"
  },
  {
    "path": "test/data/function_reference_2.m",
    "chars": 118,
    "preview": "function [y,z]=f(a,b)\n    y = a+2\n    z = b-3\nend\nfunction g()\n    a = [1,2,3]\n    b = [4;5;6]\n    [y,z] = f(a,b)\nend\n"
  },
  {
    "path": "test/data/fx_decon.cpp",
    "chars": 2634,
    "preview": "#ifndef FX_DECON_M_HPP\n#define FX_DECON_M_HPP\n\n#include <armadillo>\n#include \"mconvert.h\"\n#include <cmath>\nusing namespa"
  },
  {
    "path": "test/data/fx_decon.m",
    "chars": 1364,
    "preview": "function [DATA_f] = fx_decon(DATA,dt,lf,mu,flow,fhigh);\n [nt,ntraces] = size(DATA);\n nf = 2^nextpow2(nt);\n DATA_FX_f = z"
  },
  {
    "path": "test/data/fx_decon.m.py",
    "chars": 1003,
    "preview": "functions = {\n  \"ar_modeling\" : {\n       \"B\" : \"cx_mat\",\n       \"C\" : \"cx_vec\",\n       \"M\" : \"cx_mat\",\n       \"R\" : \"cx_"
  },
  {
    "path": "test/data/simple_assignment.cpp",
    "chars": 301,
    "preview": "#include <armadillo>\nusing namespace arma ;\n\nint main(int argc, char** argv)\n{\n  double b ;\n  int a ;\n  irowvec d ;\n  iv"
  },
  {
    "path": "test/data/simple_assignment.m",
    "chars": 43,
    "preview": "a = 1\nb = 2.\nc = '3'\nd = [4, 5]\ne = [6; 7]\n"
  },
  {
    "path": "test/test_conversion.py",
    "chars": 389,
    "preview": "\"\"\"Test fx_decon script.\"\"\"\nimport os\n\n\ndef test_fx_decon():\n    \"\"\"Test fx_decon script.\"\"\"\n    os.system(\"m2cpp fx_dec"
  },
  {
    "path": "test/test_simple_assignment.py",
    "chars": 1018,
    "preview": "\"\"\"Test simple assignment.\"\"\"\nimport pytest\n\nfrom matlab2cpp import qcpp, qhpp\n\n\n@pytest.fixture(params=[\n    \"simple_as"
  }
]

About this extraction

This page contains the full source code of the jonathf/matlab2cpp GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 151 files (627.2 KB), approximately 171.4k tokens, and a symbol index with 732 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!