pax_global_header00006660000000000000000000000064140510541250014507gustar00rootroot0000000000000052 comment=d2e2fbe205f49beb3b57fc46af43bf18e36ba9b5 pyhdf-0.10.3/000077500000000000000000000000001405105412500127025ustar00rootroot00000000000000pyhdf-0.10.3/.appveyor.yml000066400000000000000000000032771405105412500153610ustar00rootroot00000000000000# Based on https://packaging.python.org/guides/supporting-windows-using-appveyor/ # and https://github.com/Anaconda-Platform/anaconda-project/blob/master/appveyor.yml environment: matrix: # For Miniconda versions available on Appveyor, see # https://www.appveyor.com/docs/windows-images-software/#miniconda - MINICONDA: C:\Miniconda - MINICONDA: C:\Miniconda-x64 - MINICONDA: C:\Miniconda3 - MINICONDA: C:\Miniconda3-x64 install: # conda 4.5.11 seems to expect that this directory exists already - mkdir C:\Users\appveyor\.conda - call %MINICONDA%\Scripts\activate.bat # The safety checks are simply intended to ensure that there is enough disk space # and the user has the necessary permissions to make environment changes. In a CI # environment these are not necessary and slow things down noticeably on Windows. - conda config --set always_yes yes --set changeps1 no --set auto_update_conda no --set safety_checks disabled - conda install -q conda numpy hdf4 nose - conda info -a # We need wheel installed to build wheels - pip install wheel build: off test_script: # Put your test command here. - set LIBRARY_DIRS=%MINICONDA%\Library\bin;%MINICONDA%\Library\lib - set INCLUDE_DIRS=%MINICONDA%\Library\include - python setup.py nosetests -v - python examples\runall.py after_test: # This step builds your wheels. - python setup.py bdist_wheel artifacts: # bdist_wheel puts your built wheel in the dist directory - path: dist\* #on_success: # You can use this step to upload your artifacts to a public website. # See Appveyor's documentation for more details. Or you can simply # access your wheels from the Appveyor "artifacts" tab for your build. pyhdf-0.10.3/.github/000077500000000000000000000000001405105412500142425ustar00rootroot00000000000000pyhdf-0.10.3/.github/ISSUE_TEMPLATE000066400000000000000000000012441405105412500163510ustar00rootroot00000000000000 ### What version of pyhdf, HDF4, and Python are you using? pyhdf version: HDF4 C library version: Python version: ### What operating system are you using? ### What did you do? ### What did you expect to see? ### What did you see instead? pyhdf-0.10.3/.github/workflows/000077500000000000000000000000001405105412500162775ustar00rootroot00000000000000pyhdf-0.10.3/.github/workflows/package.yml000066400000000000000000000036011405105412500204150ustar00rootroot00000000000000name: package into static linked wheel on: push: tags: - 'v*' # jobs: package: name: package up into a nice wheel runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 name: Install Python with: python-version: '3.7' - name: Install cibuildwheel run: | python -m pip install cibuildwheel==1.9.0 - name: Build wheels for linux python versions run: | python -m cibuildwheel --output-dir dist env: CIBW_BUILD: '{cp,pp}3*-*' CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_BEFORE_ALL_LINUX: yum -y install epel-release hdf hdf-devel && ln -s /usr/lib64/hdf/lib* /usr/lib64/ CIBW_ARCHS_LINUX: 'x86_64' - name: purge old _linux_wheels run: | mkdir wheelhouse cp dist/*manylinux* wheelhouse/ - name: create source distribution archive for pypi run: | python -m pip install numpy python setup.py sdist -d wheelhouse - uses: actions/upload-artifact@v2 with: name: wheelhouse path: wheelhouse - name: Publish a Python distribution to Test PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_TEST_TOKEN }} repository_url: https://test.pypi.org/legacy/ packages_dir: wheelhouse/ verbose: true - name: Publish a Python distribution to PyPI if: github.event.base_ref == 'refs/heads/master' uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} packages_dir: wheelhouse/ pyhdf-0.10.3/.gitignore000066400000000000000000000001221405105412500146650ustar00rootroot00000000000000*.pyc build/ dist/ pyhdf.egg-info/ doc/_build/ pyhdf/_hdfext*.so examples/*/*.hdf pyhdf-0.10.3/.travis.yml000066400000000000000000000012771405105412500150220ustar00rootroot00000000000000language: python matrix: include: - os: linux python: "2.7" - os: linux python: "3.4" - os: linux python: "3.5" - os: linux python: "3.6" - os: osx language: generic env: PYHDF_PYTHON_VERSION="2.7" - os: osx language: generic env: PYHDF_PYTHON_VERSION="3.7" addons: apt: packages: - libhdf4-dev before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source ./.travis/install_osx_miniconda.bash; fi # command to run tests script: - python setup.py nosetests -v - python examples/runall.py notifications: email: recipients: - fshahriar@gmail.com on_success: never on_failure: change pyhdf-0.10.3/.travis/000077500000000000000000000000001405105412500142705ustar00rootroot00000000000000pyhdf-0.10.3/.travis/install_osx_miniconda.bash000077500000000000000000000013771405105412500215220ustar00rootroot00000000000000#!/bin/bash # We do this conditionally because it saves us some downloading if the # version is the same. if [[ "$PYHDF_PYTHON_VERSION" == "2.7" ]]; then curl https://repo.anaconda.com/miniconda/Miniconda2-latest-MacOSX-x86_64.sh > miniconda.sh; else curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh > miniconda.sh; fi bash miniconda.sh -b -p $HOME/miniconda export PATH="$HOME/miniconda/bin:$PATH" hash -r conda config --set always_yes yes --set changeps1 no conda update -q conda # Useful for debugging any issues with conda conda info -a conda create -q -n test-environment python=$PYHDF_PYTHON_VERSION numpy hdf4 nose source activate test-environment export LIBRARY_DIRS=$CONDA_PREFIX/lib export INCLUDE_DIRS=$CONDA_PREFIX/include pyhdf-0.10.3/AUTHORS000066400000000000000000000003551405105412500137550ustar00rootroot00000000000000Andre Gosselin @bmagill1250 @dmarth Fazlul Shahriar HDF-EOS Tools Informatoin Center H. Joe Lee Travis E. Oliphant pyhdf-0.10.3/LICENSE000066400000000000000000000022611405105412500137100ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2019 The pyhdf Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Built distributions of pyhdf also include: Libary | License - hdf | BSD-3 - jpeg | Custom BSD-like - zlib | zlib pyhdf-0.10.3/MANIFEST.in000066400000000000000000000002461405105412500144420ustar00rootroot00000000000000include README.md include LICENSE include AUTHORS include pyproject.toml include pyhdf/hdfext.i recursive-include examples * recursive-include doc * prune doc/_build pyhdf-0.10.3/Makefile000066400000000000000000000013061405105412500143420ustar00rootroot00000000000000PYTHON = python .PHONY: all all: build .PHONY: build build: make -C pyhdf build $(PYTHON) setup.py build .PHONY: install install: build $(PYTHON) setup.py install .PHONY: builddoc .ONESHELL: builddoc: export PYTHONPATH=$(shell pwd) $(PYTHON) setup.py build_ext --inplace make -C doc clean make -C doc html @echo @echo doc index is doc/_build/html/index.html .PHONY: clean clean: rm -rf build/ dist/ pyhdf.egg-info examples/*/*.hdf make -C pyhdf clean make -C doc clean .PHONY: dist dist: $(PYTHON) setup.py sdist @echo Upload to test site: @echo $(PYTHON) -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* @echo Upload to PyPI: @echo $(PYTHON) -m twine upload dist/* pyhdf-0.10.3/README.md000066400000000000000000000032621405105412500141640ustar00rootroot00000000000000[![Build Status](https://travis-ci.org/fhs/pyhdf.svg?branch=master)](https://travis-ci.org/fhs/pyhdf) [![Build status](https://ci.appveyor.com/api/projects/status/4a8pf8vo8nrjgxol/branch/master?svg=true)](https://ci.appveyor.com/project/fhs/pyhdf/branch/master) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/pyhdf/badges/version.svg)](https://anaconda.org/conda-forge/pyhdf) # pyhdf pyhdf is a python wrapper around the NCSA HDF version 4 library. The SD (Scientific Dataset), VS (Vdata) and V (Vgroup) API's are currently implemented. NetCDF files can also be read and modified. It supports both Python 2 and Python 3. *Note:* The sourceforge pyhdf [website](http://pysclint.sourceforge.net/pyhdf/) and [project](https://sourceforge.net/projects/pysclint/) are out-of-date. The original author of pyhdf have abandoned the project and it is currently maintained in [github](https://github.com/fhs/pyhdf). Version 0.9.x was called [python-hdf4](https://pypi.org/project/python-hdf4/) in PyPI because at that time we didn't have [access](https://github.com/pypa/warehouse/issues/5157) to the [pyhdf package](https://pypi.org/project/pyhdf/) in PyPI. For version 0.10.0 and onward, please install `pyhdf` instead of `python-hdf4`. ## Installation See [pyhdf installation instructions](http://fhs.github.io/pyhdf/install.html) or [doc/install.rst](doc/install.rst). ## Documentation See [pyhdf documentation](http://fhs.github.io/pyhdf/). Additional documentation on the HDF4 format can be found in the [HDF4 Support Page](https://portal.hdfgroup.org/display/HDF4/HDF4). ## Examples Example python programs using the pyhdf package can be found inside the [examples/](examples/) subdirectory. pyhdf-0.10.3/doc/000077500000000000000000000000001405105412500134475ustar00rootroot00000000000000pyhdf-0.10.3/doc/Makefile000066400000000000000000000151461405105412500151160ustar00rootroot00000000000000# 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) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where 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 " 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)" 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/pyhdf.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pyhdf.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/pyhdf" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pyhdf" @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." 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." pyhdf-0.10.3/doc/conf.py000066400000000000000000000177661405105412500147670ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # pyhdf documentation build configuration file, created by # sphinx-quickstart2 on Sun Jul 27 02:07:57 2014. # # 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 # 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.viewcode', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. 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'pyhdf' copyright = u'2019, pyhdf authors' # 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.10' # The full version, including alpha/beta/rc tags. release = '0.10.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #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 = ['_build'] # 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 # -- 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 = 'default' # 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 # " v 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 = False # 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 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 # Output file base name for HTML help builder. htmlhelp_basename = 'pyhdfdoc' # -- 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': '', } # 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 = [ ('index', 'pyhdf.tex', u'pyhdf Documentation', u'pyhdf authors', '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 = [ ('index', 'pyhdf', u'pyhdf Documentation', [u'pyhdf authors'], 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 = [ ('index', 'pyhdf', u'pyhdf Documentation', u'pyhdf authors', 'pyhdf', '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 pyhdf-0.10.3/doc/index.rst000066400000000000000000000014311405105412500153070ustar00rootroot00000000000000.. pyhdf documentation master file, created by sphinx-quickstart2 on Sun Jul 27 02:07:57 2014. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to pyhdf's documentation! ======================================= pyhdf is a python wrapper around the NCSA HDF version 4 library. The SD (Scientific Dataset), VS (Vdata) and V (Vgroup) API's are currently implemented. NetCDF files can also be read and modified. Development for this library happens in github: https://github.com/fhs/pyhdf/ Contents: .. toctree:: :maxdepth: 2 install.rst modules/HDF.rst modules/SD.rst modules/VS.rst modules/V.rst Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` pyhdf-0.10.3/doc/install.rst000066400000000000000000000162061405105412500156540ustar00rootroot00000000000000============ Installation ============ pyhdf supports installation on Python 2 and Python 3. Please open an issue here if you encounter any problems during installation: https://github.com/fhs/pyhdf/issues The recommended method of installing pyhdf is to use conda. See the `Conda user guide `_ on how to install conda and activate your conda environment. Once you're in the conda environment, install `pyhdf from conda-forge `_:: conda install -c conda-forge pyhdf If you don't want to use conda, the instructions below describes how you can compile pyhdf from source. Version 0.10.3 also includes static linked wheels for linux with cpython 3.6-3.9. If compatible, `pip install pyhdf` will include the neccessary libraries for you. If you don't want to use the built manylinux distribution, follow instructions below to build from source downloading from pypi with `pip install pyhdf --no-binary :all:`. Download the source ------------------- The source code of the latest release of pyhdf can be obtained from either of these two location: * PyPi / the cheeseshop: https://pypi.python.org/pypi/pyhdf * Github: https://github.com/fhs/pyhdf/releases Requirements ------------ The following packages are required to build and install pyhdf: - `Python `_: Python 2.6 or newer for Python 2, or Python 3.2 or newer for Python 3. - `NumPy `_ - `HDF4 libraries `_ (to use their HDF4 binaries, you will also need szip, available from the same page) - Compiler suite e.g. `GCC `_. On Windows, you need to use a `compatible Visual C++ compiler `_. - `zlib `_ - `libjpeg `_ On Debian and Debian-based Linux distributions (e.g. Ubuntu), you can install all the requirements for Python 3 using this command:: apt-get install build-essential python3-dev python3-numpy libhdf4-dev -y Installing from the source archive ---------------------------------- 1. Go to the pyhdf source directory. 2. If your HDF4 libraries or include files reside in directories that are not searched by default on your system, the installation script will complain about missing files. Add to the search path by exporting ``INCLUDE_DIRS`` and ``LIBRARY_DIRS``, e.g.:: export INCLUDE_DIRS=/usr/local/hdf-4.2r3/include export LIBRARY_DIRS=/usr/local/hdf-4.2r3/lib or on Windows something like (replace with actual location):: set INCLUDE_DIRS=C:\hdf4\include set LIBRARY_DIRS=C:\hdf4\lib;C:\hdf4\dll;C:\hdf4\jpeg6\lib;C:\hdf4\szip21\lib;C:\hdf4\zlib123\lib Note that jpeg, zlib, and (optionally) szip libraries must be found as well. If they are not in a standard place for the compiler, their location must be specified. On Mac OS X, ``/usr/local/lib`` and ``/usr/local/include`` may need to be specified if the libraries were installed there. You may need to install the devel versions of these packages to get the statically-linked libraries if your HDF binary is statically linked. If you are using the binary HDF4 library available from the HDF4 site, you must also have szlib installed. Then, you will also need to set ``SZIP``:: export SZIP=1 (or on Windows: set SZIP=1) If you do not wish to use szlib, you will need to compile HDF4 from source. If anything goes wrong, read the detailed notes below. Warning messages about implicit declarations of some functions may be produced. Those are due to SWIG, and may be safely ignored. 3. Install system-wide or locally:: # sudo python setup.py install $ python setup.py install --prefix=/usr/local (or prefix of choice) Or, you might prefer to make a package (msi, rpm, egg, etc.) and install the package:: $ python setup.py bdist_ To make sure everything works as expected, run the ``hdfstruct.py`` script (under ``examples/hdfstruct``) on one of your HDF4 files. The script should display the file structure. This is a handy tool to have around when you want to explore the contents of any HDF4 file. Further notes ------------- External libraries ~~~~~~~~~~~~~~~~~~ HDF4.2 no longer provides its own copies of the jpeg and z libraries. Those must be installed separately (on Linux, they should be part of any standard distribution). The sz library (versions 2.0 or higher) must be installed if the SZIP compression method is to be used with SDsetcompress(). HDF v4.2 must also then be compiled with SZIP support. The binaries available from NCSA are (at the time of this writing) compiled with SZIP support (including encoding). To use these binaries, you *must have SZIP installed*. The binaries Enthought has produced and which are available in EPD and for download from Sourceforge are compiled with SZIP support without encoding capability. Getting an SZIP enabled HDF library may require compiling the library from source with the "--with-szlib" configuration option. Note that you *must* install SZIP in a separate step. For more details, see the `HDF Group site `_. In case your HDF library was compiled with SZIP support and you abide by the szip licensing terms, set the environment variable ``SZIP`` to ``1``. If you get error messages related to the ``SDgetcompress()`` / ``SDsetcompress()`` functions, e.g. ``"undefined symbol: SDgetcompress"``, set the environment variable ``NO_COMPRESS`` to "1". This will transform ``SDgetcompress()`` and ``SDsetcompress()`` into no-ops, which will immediately raise an exception, and will not be resolved against the HDF library symbols. This may make it possible to work with an HDF library earlier than v4.2. Swig-generated interface files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Interface files ``hdfext.py`` and ``hdfext_wrap.c`` (located under the ``pyhdf`` subdirectory) have been generated using the SWIG tool. Those two files should be usable as is on most environments. It could happen however that, for reasons related to your environment, your C compiler does not accept the '.c' file and raises a compilation error. If so, the interface needs to be regenerated. To do so, install `SWIG `_, then run:: $ cd pyhdf $ swig -python hdfext.i SWIG should silently regenerate the two interface files, after which installation should proceed correctly. TRU64 note ~~~~~~~~~~ The HDF installation creates its libraries as archive (.a) files, not shareable (.so) ones. On TRU64, the linker by default first looks for shareable libraries in every directory, then in a second round for archive files. This means that if there is a libjpeg.so somewhere on the standard linker search paths, it will be found first, even if the HDF libjpeg.a file exists in the directory pointed by "library_dirs". To solve the problem, set the environment variable ``LINK_ARGS``:: export LINK_ARGS="-oldstyle_liblookup" This will tell the linker to look for .so then for .a files in each visited directory. pyhdf-0.10.3/doc/make.bat000066400000000000000000000150531405105412500150600ustar00rootroot00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ 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. 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. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over 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 goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) %SPHINXBUILD% 2> nul if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point echo.to the full path of the 'sphinx-build' executable. Alternatively you echo.may add the Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\pyhdf.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\pyhdf.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdf" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdfja" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf-ja cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) if "%1" == "xml" ( %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml if errorlevel 1 exit /b 1 echo. echo.Build finished. The XML files are in %BUILDDIR%/xml. goto end ) if "%1" == "pseudoxml" ( %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml if errorlevel 1 exit /b 1 echo. echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. goto end ) :end pyhdf-0.10.3/doc/modules/000077500000000000000000000000001405105412500151175ustar00rootroot00000000000000pyhdf-0.10.3/doc/modules/HDF.rst000066400000000000000000000000721405105412500162510ustar00rootroot00000000000000.. automodule:: pyhdf.HDF :members: :undoc-members: pyhdf-0.10.3/doc/modules/SD.rst000066400000000000000000000000711405105412500161550ustar00rootroot00000000000000.. automodule:: pyhdf.SD :members: :undoc-members: pyhdf-0.10.3/doc/modules/V.rst000066400000000000000000000000701405105412500160530ustar00rootroot00000000000000.. automodule:: pyhdf.V :members: :undoc-members: pyhdf-0.10.3/doc/modules/VS.rst000066400000000000000000000000711405105412500161770ustar00rootroot00000000000000.. automodule:: pyhdf.VS :members: :undoc-members: pyhdf-0.10.3/examples/000077500000000000000000000000001405105412500145205ustar00rootroot00000000000000pyhdf-0.10.3/examples/compress/000077500000000000000000000000001405105412500163535ustar00rootroot00000000000000pyhdf-0.10.3/examples/compress/README_compress.txt000066400000000000000000000002641405105412500217660ustar00rootroot00000000000000This example script creates a data array and stores it as an HDF file under several different compression formats. TODO: More outputs from the code displayed at the command line. pyhdf-0.10.3/examples/compress/test-compress.py000077500000000000000000000201761405105412500215460ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function # Generate test HDF files using different compression configurations, # and validate each resulting file to make sure its contents is OK. # Adapted from example: # "https://support.hdfgroup.org/doc_resource/SZIP/h4_examples/szip32.c". # A bigger dataset is defined to better show the size reduction achieved # by the SZIP compression. # Note that when applied to HDF4 SDS, the word "pixels" as used inside # the SZIP documentation should really be understood as a "data element", # eg a cell value inside a multidimensional array. # # On our systems, the program produced the following file sizes : # # $ ls -l *.hdf # -rw-r--r-- 1 root root 53389 Jun 29 14:20 SDS.COMP_DEFLATE.1.hdf # -rw-r--r-- 1 root root 56524 Jun 29 14:24 SDS.COMP_DEFLATE.2.hdf # -rw-r--r-- 1 root root 60069 Jun 29 14:24 SDS.COMP_DEFLATE.3.hdf # -rw-r--r-- 1 root root 59725 Jun 29 14:24 SDS.COMP_DEFLATE.4.hdf # -rw-r--r-- 1 root root 59884 Jun 29 14:24 SDS.COMP_DEFLATE.5.hdf # -rw-r--r-- 1 root root 58596 Jun 29 14:24 SDS.COMP_DEFLATE.6.hdf # -rw-r--r-- 1 root root 58450 Jun 29 14:24 SDS.COMP_DEFLATE.7.hdf # -rw-r--r-- 1 root root 58437 Jun 29 14:24 SDS.COMP_DEFLATE.8.hdf # -rw-r--r-- 1 root root 58446 Jun 29 14:24 SDS.COMP_DEFLATE.9.hdf # -rw-r--r-- 1 root root 102920 Jun 29 14:20 SDS.COMP_NONE.hdf # -rw-r--r-- 1 root root 103162 Jun 29 14:20 SDS.COMP_RLE.hdf # -rw-r--r-- 1 root root 60277 Jun 29 14:20 SDS.COMP_SKPHUFF.2.hdf # -rw-r--r-- 1 root root 52085 Jun 29 14:20 SDS.COMP_SKPHUFF.4.hdf # -rw-r--r-- 1 root root 52085 Jun 29 14:20 SDS.COMP_SKPHUFF.8.hdf # -rw-r--r-- 1 root root 71039 Jun 29 14:20 SDS.COMP_SZIP.EC.16.hdf # -rw-r--r-- 1 root root 79053 Jun 29 14:20 SDS.COMP_SZIP.EC.32.hdf # -rw-r--r-- 1 root root 66636 Jun 29 14:20 SDS.COMP_SZIP.EC.4.hdf # -rw-r--r-- 1 root root 66984 Jun 29 14:20 SDS.COMP_SZIP.EC.8.hdf # -rw-r--r-- 1 root root 39835 Jun 29 14:20 SDS.COMP_SZIP.NN.16.hdf # -rw-r--r-- 1 root root 44554 Jun 29 14:20 SDS.COMP_SZIP.NN.32.hdf # -rw-r--r-- 1 root root 38371 Jun 29 14:20 SDS.COMP_SZIP.NN.4.hdf # -rw-r--r-- 1 root root 38092 Jun 29 14:20 SDS.COMP_SZIP.NN.8.hdf # # For the chosen data set, the best results were attained using # SZIP compression with NN compression scheme and 8 pixels per block. # Mileage will vary with the data set used. import sys import os.path from pyhdf.SD import * import numpy # Array shape and data type. LENGTH = 250 WIDTH = 100 NUMPY_DATATYPE = numpy.int32 HDF_DATATYPE = SDC.INT32 def doCompress(compType, value=0, v2=0): """Create and validate an HDF file using a compression scheme specified by the parameters""" # Build a significant file name if compType == SDC.COMP_NONE: fileName = "SDS.COMP_NONE" elif compType == SDC.COMP_RLE: fileName = "SDS.COMP_RLE" elif compType == SDC.COMP_SKPHUFF: fileName = "SDS.COMP_SKPHUFF.%d" % value elif compType == SDC.COMP_DEFLATE: fileName = "SDS.COMP_DEFLATE.%d" % value elif compType == SDC.COMP_SZIP: fileName = "SDS.COMP_SZIP" if value == SDC.COMP_SZIP_NN: fileName += ".NN" elif value == SDC.COMP_SZIP_EC: fileName += ".EC" else: print("illegal value") sys.exit(1) fileName += ".%s" % v2 else: print("illegal compType") sys.exit(1) fileName += ".hdf" SDS_NAME = "Data" fill_value = 0 #LENGTH = 9 #WIDTH = 6 # #data = numpy.array( ((100,100,200,200,300,400), # (100,100,200,200,300,400), # (100,100,200,200,300,400), # (300,300, 0,400,300,400), # (300,300, 0,400,300,400), # (300,300, 0,400,300,400), # (0, 0,600,600,300,400), # (500,500,600,600,300,400), # (0, 0,600,600,300,400)), NUMPY_DATATYPE) # The above dataset is used in the original NCSA example. # It is too small to show a significant size reduction after # compression. The following is used for a more realistic example. data = numpy.zeros((LENGTH, WIDTH), NUMPY_DATATYPE) for i in range(LENGTH): for j in range(WIDTH): data[i,j] = (i+j)*(i-j) # Create HDF file, wiping it out it it already exists. sd_id = SD(fileName, SDC.WRITE | SDC.CREATE | SDC.TRUNC) # Create dataset. sds_id = sd_id.create(SDS_NAME, HDF_DATATYPE, (LENGTH, WIDTH)) # Fill dataset will fill value. sds_id.setfillvalue(0) # Apply compression. try: sds_id.setcompress(compType, # compression type value, v2) # args depend on compression type except HDF4Error as msg: print(("Error compressing the dataset with params: " "(%d,%d,%d) : %s" % (compType, value, v2, msg))) sds_id.endaccess() sd_id.end() os.remove(fileName) return # Load data in the dataset. sds_id[:] = data # Close dataset. sds_id.endaccess() # Close hdf file to flush compressed data. sd_id.end() # Verify compressed data. # ###################### # Reopen file and select first dataset. sd_id = SD(fileName, SDC.READ) sds_id = sd_id.select(0) # Obtain compression info. compInfo = sds_id.getcompress() compType = compInfo[0] print("file : %s" % fileName) print(" size = %d" % os.path.getsize(fileName)) if compType == SDC.COMP_NONE: print(" compType = COMP_NONE") elif compType == SDC.COMP_RLE: print(" compType = COMP_RLE") elif compType == SDC.COMP_SKPHUFF: print(" compType = COMP_SKPHUFF") print(" dataSize = %d" % compInfo[1]) elif compType == SDC.COMP_DEFLATE: print(" compType = COMP_DEFLATE (GZIP)") print(" level = %d" % compInfo[1]) elif compType == SDC.COMP_SZIP: print(" compType = COMP_SZIP") optionMask = compInfo[1] if optionMask & SDC.COMP_SZIP_NN: print(" encoding scheme = NN") elif optionMask & SDC.COMP_SZIP_EC: print(" encoding scheme = EC") else: print(" unknown encoding scheme") sys.exit(1) pixelsPerBlock, pixelsPerScanline, bitsPerPixel, pixels = compInfo[2:] print(" pixelsPerBlock = %d" % pixelsPerBlock) print(" pixelsPerScanline = %d" % pixelsPerScanline) print(" bitsPerPixel = %d" % bitsPerPixel) print(" pixels = %d" % pixels) else: print(" unknown compression type") sys.exit(1) # Read dataset contents. out_data = sds_id[:] # Compare with original data. num_errs = 0 for i in range(LENGTH): for j in range(WIDTH): if data[i,j] != out_data[i,j]: print("bad value at %d,%d expected: %d got: %d" \ % (i,j,data[i,j],out_data[i,j])) num_errs += 1 # Close dataset and hdf file. sds_id.endaccess() sd_id.end() if num_errs == 0: print(" file validated") else: print(" file invalid : %d errors" % num_errs) print("") # Try different compression configurations in turn. # All the following calls will fail with a "Cannot execute" exception if pyhdf # was installed with the NOCOMPRESS macro set. # No compression print("no compression") doCompress(SDC.COMP_NONE) # RLE compression print("run-length encoding") doCompress(SDC.COMP_RLE) # Skipping-Huffman compression. print("Skipping-Huffman encoding") for size in 2,4,8: doCompress(SDC.COMP_SKPHUFF, size) # size in bytes of the data elements # Gzip compression print("GZIP compression") for level in 1,2,3,4,5,6,7,8,9: doCompress(SDC.COMP_DEFLATE, level) # compression level, from 1 to 9 # SZIP compression # Those calls will fail with an "Encoder not available" exception if # pyhdf was installed with the NOSZIP macro set. print("SZIP compression") for scheme in SDC.COMP_SZIP_NN, SDC.COMP_SZIP_EC: for ppb in 4,8,16,32: doCompress(SDC.COMP_SZIP, scheme, ppb) # scheme, pixels per block pyhdf-0.10.3/examples/hdfstruct/000077500000000000000000000000001405105412500165265ustar00rootroot00000000000000pyhdf-0.10.3/examples/hdfstruct/README_hdfstruct.txt000066400000000000000000000002421405105412500223100ustar00rootroot00000000000000HDFSTRUCT This script accesses an HDF file and displays information about its contents. The file is specified at the command line. TODO: Better documentation pyhdf-0.10.3/examples/hdfstruct/hdfstruct.py000077500000000000000000000124661405105412500211220ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function import sys from pyhdf.SD import * # Dictionary used to convert from a numeric data type to its symbolic # representation typeTab = { SDC.CHAR: 'CHAR', SDC.CHAR8: 'CHAR8', SDC.UCHAR8: 'UCHAR8', SDC.INT8: 'INT8', SDC.UINT8: 'UINT8', SDC.INT16: 'INT16', SDC.UINT16: 'UINT16', SDC.INT32: 'INT32', SDC.UINT32: 'UINT32', SDC.FLOAT32: 'FLOAT32', SDC.FLOAT64: 'FLOAT64' } printf = sys.stdout.write def eol(n=1): printf("%s" % chr(10) * n) hdfFile = sys.argv[1] # Get first command line argument try: # Catch pyhdf.SD errors # Open HDF file named on the command line f = SD(hdfFile) # Get global attribute dictionary attr = f.attributes(full=1) # Get dataset dictionary dsets = f.datasets() # File name, number of attributes and number of variables. printf("FILE INFO"); eol() printf("-------------"); eol() printf("%-25s%s" % ("File:", hdfFile)); eol() printf("%-25s%d" % (" file attributes:", len(attr))); eol() printf("%-25s%d" % (" datasets:", len(dsets))); eol() eol(); # Global attribute table. if len(attr) > 0: printf("File attributes"); eol(2) printf(" name idx type len value"); eol() printf(" -------------------- --- ------- --- -----"); eol() # Get list of attribute names and sort them lexically attNames = sorted(attr.keys()) for name in attNames: t = attr[name] # t[0] is the attribute value # t[1] is the attribute index number # t[2] is the attribute type # t[3] is the attribute length printf(" %-20s %3d %-7s %3d %s" % (name, t[1], typeTab[t[2]], t[3], t[0])); eol() eol() # Dataset table if len(dsets) > 0: printf("Datasets (idx:index #, na:# attributes, cv:coord var)"); eol(2) printf(" name idx type na cv dimension(s)"); eol() printf(" -------------------- --- ------- -- -- ------------"); eol() # Get list of dataset names and sort them lexically dsNames = sorted(dsets.keys()) for name in dsNames: # Get dataset instance ds = f.select(name) # Retrieve the dictionary of dataset attributes so as # to display their number vAttr = ds.attributes() t = dsets[name] # t[0] is a tuple of dimension names # t[1] is a tuple of dimension lengths # t[2] is the dataset type # t[3] is the dataset index number printf(" %-20s %3d %-7s %2d %-2s " % (name, t[3], typeTab[t[2]], len(vAttr), ds.iscoordvar() and 'X' or '')) # Display dimension info. n = 0 for d in t[0]: printf("%s%s(%d)" % (n > 0 and ', ' or '', d, t[1][n])) n += 1 eol() eol() # Dataset info. printf("DATASET INFO"); eol() printf("-------------"); eol(2) for name in dsNames: # Access the dataset dsObj = f.select(name) # Get dataset attribute dictionary dsAttr = dsObj.attributes(full=1) if len(dsAttr) > 0: printf("%s attributes" % name); eol(2) printf(" name idx type len value"); eol() printf(" -------------------- --- ------- --- -----"); eol() # Get the list of attribute names and sort them alphabetically. attNames = sorted(dsAttr.keys()) for nm in attNames: t = dsAttr[nm] # t[0] is the attribute value # t[1] is the attribute index number # t[2] is the attribute type # t[3] is the attribute length printf(" %-20s %3d %-7s %3d %s" % (nm, t[1], typeTab[t[2]], t[3], t[0])); eol() eol() # Get dataset dimension dictionary dsDim = dsObj.dimensions(full=1) if len(dsDim) > 0: printf ("%s dimensions" % name); eol(2) printf(" name idx len unl type natt");eol() printf(" -------------------- --- ----- --- ------- ----");eol() # Get the list of dimension names and sort them alphabetically. dimNames = sorted(dsDim.keys()) for nm in dimNames: t = dsDim[nm] # t[0] is the dimension length # t[1] is the dimension index number # t[2] is 1 if the dimension is unlimited, 0 if not # t[3] is the the dimension scale type, 0 if no scale # t[4] is the number of attributes printf(" %-20s %3d %5d %s %-7s %4d" % (nm, t[1], t[0], t[2] and "X" or " ", t[3] and typeTab[t[3]] or "", t[4])); eol() eol() except HDF4Error as msg: print("HDF4Error", msg) pyhdf-0.10.3/examples/inventory/000077500000000000000000000000001405105412500165555ustar00rootroot00000000000000pyhdf-0.10.3/examples/inventory/README_inventory.txt000066400000000000000000000013161405105412500223710ustar00rootroot00000000000000INVENTORY These examples operate on a file called inventory.hdf. They do the following: inventory_1-1.py: Opens the file inventory.hdf (creating it if it doesn't exist), and adds a VData set of inventory items to it. inventory_1-2.py: Opens the file inventory.hdf (creating it if it doesn't exist) storing VData, updates the "status" attribute, and updates the data. inventory_1-3.py: Opens the file inventory.hdf (creating it if it doesn't exist) storing VData, updates the "status" attribute, and updates the data. inventory_1-4.py: Opens the file inventory.hdf (which must already exist) and displays some of its data. inventory_1-5.py: Similar functionality to inventory_1-5.py TODO: Better documentation pyhdf-0.10.3/examples/inventory/inventory_1-1.py000066400000000000000000000030611405105412500215420ustar00rootroot00000000000000from pyhdf.HDF import * from pyhdf.VS import * # Open HDF file and initialize the VS interface f = HDF('inventory.hdf', # Open file 'inventory.hdf' in write mode HC.WRITE|HC.CREATE) # creating it if it does not exist vs = f.vstart() # init vdata interface # Create vdata and define its structure vd = vs.create( # create a new vdata 'INVENTORY', # name of the vdata # fields of the vdata follow (('partid',HC.CHAR8, 5), # 5 char string ('description',HC.CHAR8, 10), # 10 char string field ('qty',HC.INT16, 1), # 1 16 bit int field ('wght',HC.FLOAT32, 1), # 1 32 bit float ('price',HC.FLOAT32,1) # 1 32 bit float )) # 5 fields allocated in the vdata # Set attributes on the vdata and its fields vd.field('wght').unit = 'lb' vd.field('price').unit = '$' # In order to be able to update a string attribute, it must # always be set to the same length. This sets 'status' to a 20 # char long, left-justified string, padded with spaces on the right. vd.status = "%-20s" % 'phase 1 done' # Store records vd.write(( # write 3 records ('Q1234', 'bolt',12, 0.01, 0.05), # record 1 ('B5432', 'brush', 10, 0.4, 4.25), # record 2 ('S7613', 'scissor', 2, 0.2, 3.75) # record 3 )) vd.detach() # "close" the vdata vs.end() # terminate the vdata interface f.close() # close the HDF file pyhdf-0.10.3/examples/inventory/inventory_1-2.py000066400000000000000000000017571405105412500215550ustar00rootroot00000000000000from pyhdf.HDF import * from pyhdf.VS import * f = HDF('inventory.hdf', # Open file 'inventory.hdf' HC.WRITE|HC.CREATE) # creating it if it does not exist vs = f.vstart() # init vdata interface vd = vs.attach('INVENTORY', 1) # attach vdata 'INVENTORY' in write mode # Update the `status' vdata attribute. The attribute length must not # change. We call the attribute info() method, which returns a list where # number of values (eg string length) is stored at index 2. # We then assign a left justified string of exactly that length. len = vd.attr('status').info()[2] vd.status = '%-*s' % (len, 'phase 2 done') vd[vd._nrecs:] = ( # append 2 records ('A4321', 'axe', 5, 1.5, 25), # first record ('C3214', 'cup', 100, 0.1, 3.25) # second record ) vd.detach() # "close" the vdata vs.end() # terminate the vdata interface f.close() # close the HDF file pyhdf-0.10.3/examples/inventory/inventory_1-3.py000066400000000000000000000021151405105412500215430ustar00rootroot00000000000000from pyhdf.HDF import * from pyhdf.VS import * f = HDF('inventory.hdf', # Open file 'inventory.hdf' in write mode HC.WRITE|HC.CREATE) # creating it if it does not exist vs = f.vstart() # init vdata interface vd = vs.attach('INVENTORY', 1) # attach vdata 'INVENTORY' in write mode # Update the `status' vdata attribute. The attribute length must not # change. We call the attribute info() method, which returns a list where # number of values (eg string length) is stored at index 2. # We then assign a left justified string of exactly that length. len = vd.attr('status').info()[2] vd.status = '%-*s' % (len, 'phase 3 done') # Update record at index 1 (second record) vd[1] = ('Z4367', 'surprise', 10, 3.1, 44.5) # Update record at index 4, and those after vd[4:] = ( ('QR231', 'toy', 12, 2.5, 45), ('R3389', 'robot', 3, 45, 2000), ('R3390', 'robot2', 8, 55, 2050) ) vd.detach() # "close" the vdata vs.end() # terminate the vdata interface f.close() # close the HDF file pyhdf-0.10.3/examples/inventory/inventory_1-4.py000066400000000000000000000030741405105412500215510ustar00rootroot00000000000000from __future__ import print_function from pyhdf.HDF import * from pyhdf.VS import * f = HDF('inventory.hdf') # open 'inventory.hdf' in read mode vs = f.vstart() # init vdata interface vd = vs.attach('INVENTORY') # attach vdata 'INVENTORY' in read mode # Display some vdata attributes print("status:", vd.status) print("vdata: ", vd._name) # predefined attribute: vdata name print("nrecs: ", vd._nrecs) # predefined attribute: num records # Display value of attribute 'unit' for all fields on which # this attribute is set print("units: ", end=' ') for fieldName in vd._fields: # loop over all field names try: # instantiate field and obtain value of attribute 'unit' v = vd.field(fieldName).unit print("%s: %s" % (fieldName, v), end=' ') except: # no 'unit' attribute: ignore pass print("") print("") # Display table header. header = "%-7s %-12s %3s %4s %8s" % tuple(vd._fields) print("-" * len(header)) print(header) print("-" * len(header)) # Loop over the vdata records, displaying each record as a table row. # Current record position is 0 after attaching the vdata. while True: try: rec = vd.read() # read next record # equivalent to: # rec = vd[vd.tell()] print("%-7s %-12s %3d %4.1f %8.2f" % tuple(rec[0])) except HDF4Error: # end of vdata reached break vd.detach() # "close" the vdata vs.end() # terminate the vdata interface f.close() # close the HDF file pyhdf-0.10.3/examples/inventory/inventory_1-5.py000066400000000000000000000024721405105412500215530ustar00rootroot00000000000000from __future__ import print_function from pyhdf.HDF import * from pyhdf.VS import * f = HDF('inventory.hdf') # open 'inventory.hdf' in read mode vs = f.vstart() # init vdata interface vd = vs.attach('INVENTORY') # attach vdata 'INVENTORY' in read mode # Display some vdata attributes print("status:", vd.status) print("vdata: ", vd._name) # predefined attribute: vdata name print("nrecs: ", vd._nrecs) # predefined attribute: num records # Display value of attribute 'unit' for all fields on which # this attribute is set print("units: ", end=' ') for fieldName in vd._fields: # loop over all field names try: # instantiate field and obtain value of attribute 'unit' v = vd.field(fieldName).unit print("%s: %s" % (fieldName, v), end=' ') except: # no 'unit' attribute: ignore pass print("") print("") # Display table header. header = "%-7s %-12s %3s %4s %8s" % tuple(vd._fields) print("-" * len(header)) print(header) print("-" * len(header)) # Read all records at once, and loop over the sequence. for rec in vd[:]: print("%-7s %-12s %3d %4.1f %8.2f" % tuple(rec)) vd.detach() # "close" the vdata vs.end() # terminate the vdata interface f.close() # close the HDF file pyhdf-0.10.3/examples/runall.py000066400000000000000000000041421405105412500163700ustar00rootroot00000000000000#!/usr/bin/env python """ This script runs all the examples in examples directory. It should be run from the top-level directory (containing setup.py). """ import glob import os import sys import subprocess try: from subprocess import DEVNULL # py3k except ImportError: DEVNULL = open(os.devnull, 'wb') class ExampleTester: failed = [] passed = 0 rootdir = os.getcwd() def __init__(self): subprocess.check_call([sys.executable, "setup.py", "build_ext", "--inplace"]) os.environ["PYTHONPATH"] = self.rootdir def run(self, d, cmd, **kwargs): """ Run command cmd in directory d. """ print("running %s in %s ..." % (cmd, d)) os.chdir(os.path.join(self.rootdir, d)) r = subprocess.call([sys.executable] + cmd, **kwargs) if r != 0: self.failed.append((d, cmd, r)) else: self.passed += 1 os.chdir(self.rootdir) return r def report(self): print(self.passed, "example(s) ran successfully") if len(self.failed) > 0: print("failed examples:") for ex in self.failed: print(" %s in %s failed with exit code %s" % (ex[1], ex[0], ex[2])) sys.exit(2) sys.exit(0) def main(): t = ExampleTester() t.run("examples/compress", ["test-compress.py"], stdout=DEVNULL) t.run("examples/vgroup", ["vgwrite.py"]) t.run("examples/vgroup", ["vgread.py", "inventory.hdf"], stdout=DEVNULL) t.run("examples/inventory", ["inventory_1-1.py"]) t.run("examples/inventory", ["inventory_1-2.py"]) t.run("examples/inventory", ["inventory_1-3.py"]) t.run("examples/inventory", ["inventory_1-4.py"], stdout=DEVNULL) t.run("examples/inventory", ["inventory_1-5.py"], stdout=DEVNULL) t.run("examples/txttohdf", ["txttohdf.py"]) # These HDF files were generated by above examples for g in sorted(glob.glob("examples/*/*.hdf")): hdffile = os.path.join("../..", g) t.run("examples/hdfstruct", ["hdfstruct.py", hdffile], stdout=DEVNULL) t.report() if __name__ == '__main__': main() pyhdf-0.10.3/examples/txttohdf/000077500000000000000000000000001405105412500163645ustar00rootroot00000000000000pyhdf-0.10.3/examples/txttohdf/README_txttohdf.txt000066400000000000000000000010761405105412500220120ustar00rootroot00000000000000This example demonstrates creation of an HDF file from data in text files. Specifically, the files temp.txt and depth.txt each store a table of scientific data (first line of text giving table's dimensions). The HDF file table.hdf is created (being deleted first if it already existed), filled with the information in temp.txt in the SD (Scientific Dataset) format, and closed. It is then reopened and the information in depth.txt is added (without overwriting temp.txt). TODO: Include more code which accesses, in table.hdf, the information in tempt.txt and depth.txt. pyhdf-0.10.3/examples/txttohdf/depth.txt000066400000000000000000000002241405105412500202270ustar00rootroot000000000000009 4 100 101 102 103 200 201 202 203 300 301 302 303 400 401 402 403 500 501 502 503 600 601 602 603 700 701 702 703 800 801 802 803 900 901 902 903 pyhdf-0.10.3/examples/txttohdf/temp.txt000066400000000000000000000002241405105412500200700ustar00rootroot000000000000009 4 100 101 102 103 200 201 202 203 300 301 302 303 400 401 402 403 500 501 502 503 600 601 602 603 700 701 702 703 800 801 802 803 900 901 902 903 pyhdf-0.10.3/examples/txttohdf/txttohdf.py000077500000000000000000000057771405105412500206250ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function from pyhdf.six.moves import map from numpy import * from pyhdf.SD import * import os def txtToHDF(txtFile, hdfFile, varName, attr): """Inputs: txtFile = name of .txt file (passed as string) hdfFile = name of .hdf file (passed as string) varName = name of dataset to be added (passed as string) attr = dataset attributes (passed as dictionary) txtFile indicates a dataset, and varName and attr give information about it. txtToHDF puts this information into an SD (Scientific Dataset) object and stores that object as in hdfFile, creating hdfFile if need be, otherwise updating it. """ try: # Catch pyhdf errors # Open HDF file in update mode, creating it if non existent. d = SD(hdfFile, SDC.WRITE|SDC.CREATE) # Open text file and get matrix dimensions on first line. txt = open(txtFile) ni, nj = list(map(int, txt.readline().split())) # Define HDF dataset of type SDC.FLOAT32 with those dimensions. v = d.create(varName, SDC.FLOAT32, (ni, nj)) # Assign attributes passed as argument inside dict `attr'. for attrName in list(attr.keys()): setattr(v, attrName, attr[attrName]) # Load variable with lines of data. Compute min and max # over the whole matrix. i = 0 while i < ni: elems = list(map(float, txt.readline().split())) v[i] = elems minE = min(elems) maxE = max(elems) if i: minVal = min(minVal, minE) maxVal = max(maxVal, maxE) else: minVal = minE maxVal = maxE i += 1 # Set variable min and max attributes. v.minVal = minVal v.maxVal = maxVal # Close dataset and file objects (not really necessary, # since closing is automatic when objects go out of scope. v.endaccess() d.end() txt.close() except HDF4Error as msg: print("HDF4Error:", msg) if __name__ == '__main__': hdfFile = 'table.hdf' try: # Delete if exists. os.remove(hdfFile) except: pass # Transfer contents of file 'temp.txt' to dataset 'temperature' # and assign the attributes 'title', 'units' and 'valid_range'. txtToHDF('temp.txt', hdfFile, 'temperature', {'title' : 'temperature matrix', 'units' : 'celsius', 'valid_range': (-2.8,27.0)}) print("Temperature data successfully written to HDF file") # Transfer contents of file 'depth.txt' to dataset 'depth' # and assign the same attributes as above. txtToHDF('depth.txt', hdfFile, 'depth', {'title' : 'depth matrix', 'units' : 'meters', 'valid_range': (0, 500.0)}) print("Depth data successfully written to HDF file") # TODO: open up hdfFile and access the information that # was in temp.txt and depth.txt pyhdf-0.10.3/examples/vgroup/000077500000000000000000000000001405105412500160425ustar00rootroot00000000000000pyhdf-0.10.3/examples/vgroup/README_vgroup.txt000066400000000000000000000001451405105412500211420ustar00rootroot00000000000000These two samples demonstrate reading and writing Vgroup-type hdf files. TODO: Better documentation pyhdf-0.10.3/examples/vgroup/vgread.py000066400000000000000000000042521405105412500176670ustar00rootroot00000000000000from __future__ import print_function from pyhdf.HDF import * from pyhdf.V import * from pyhdf.VS import * from pyhdf.SD import * import sys def describevg(refnum): # Describe the vgroup with the given refnum. # Open vgroup in read mode. vg = v.attach(refnum) print("----------------") print("name:", vg._name, "class:",vg._class, "tag,ref:",vg._tag, vg._refnum) # Show the number of members of each main object type. print("# members: ", vg._nmembers,\ "# datasets:", vg.nrefs(HC.DFTAG_NDG),\ "# vdatas: ", vg.nrefs(HC.DFTAG_VH),\ "# vgroups: ", vg.nrefs(HC.DFTAG_VG)) # Read the contents of the vgroup. members = vg.tagrefs() # Display info about each member. index = -1 for tag, ref in members: index += 1 print("member index", index) # Vdata tag if tag == HC.DFTAG_VH: vd = vs.attach(ref) nrecs, intmode, fields, size, name = vd.inquire() print(" vdata:",name, "tag,ref:",tag, ref) print(" fields:",fields) print(" nrecs:",nrecs) vd.detach() # SDS tag elif tag == HC.DFTAG_NDG: sds = sd.select(sd.reftoindex(ref)) name, rank, dims, type, nattrs = sds.info() print(" dataset:",name, "tag,ref:", tag, ref) print(" dims:",dims) print(" type:",type) sds.endaccess() # VS tag elif tag == HC.DFTAG_VG: vg0 = v.attach(ref) print(" vgroup:", vg0._name, "tag,ref:", tag, ref) vg0.detach() # Unhandled tag else: print("unhandled tag,ref",tag,ref) # Close vgroup vg.detach() # Open HDF file in readonly mode. filename = sys.argv[1] hdf = HDF(filename) # Initialize the SD, V and VS interfaces on the file. sd = SD(filename) vs = hdf.vstart() v = hdf.vgstart() # Scan all vgroups in the file. ref = -1 while True: try: ref = v.getid(ref) except HDF4Error as msg: # no more vgroup break describevg(ref) # Terminate V, VS and SD interfaces. v.end() vs.end() sd.end() # Close HDF file. hdf.close() pyhdf-0.10.3/examples/vgroup/vgwrite.py000066400000000000000000000040511405105412500201030ustar00rootroot00000000000000from pyhdf.HDF import * from pyhdf.V import * from pyhdf.VS import * from pyhdf.SD import * def vdatacreate(vs, name): # Create vdata and define its structure vd = vs.create(name, (('partid',HC.CHAR8, 5), # 5 char string ('description',HC.CHAR8, 10), # 10 char string field ('qty',HC.INT16, 1), # 1 16 bit int field ('wght',HC.FLOAT32, 1), # 1 32 bit float ('price',HC.FLOAT32,1) # 1 32 bit float )) # Store records vd.write((('Q1234', 'bolt',12, 0.01, 0.05), # record 1 ('B5432', 'brush', 10, 0.4, 4.25), # record 2 ('S7613', 'scissor', 2, 0.2, 3.75) # record 3 )) # "close" vdata vd.detach() def sdscreate(sd, name): # Create a simple 3x3 float array. sds = sd.create(name, SDC.FLOAT32, (3,3)) # Initialize array sds[:] = ((0,1,2),(3,4,5),(6,7,8)) # "close" dataset. sds.endaccess() # Create HDF file filename = 'inventory.hdf' hdf = HDF(filename, HC.WRITE|HC.CREATE) # Initialize the SD, V and VS interfaces on the file. sd = SD(filename, SDC.WRITE) # SD interface vs = hdf.vstart() # vdata interface v = hdf.vgstart() # vgroup interface # Create vdata named 'INVENTORY'. vdatacreate(vs, 'INVENTORY') # Create dataset named "ARR_3x3" sdscreate(sd, 'ARR_3x3') # Attach the vdata and the dataset. vd = vs.attach('INVENTORY') sds = sd.select('ARR_3x3') # Create vgroup named 'TOTAL'. vg = v.create('TOTAL') # Add vdata to the vgroup vg.insert(vd) # We could also have written this: # vgroup.add(vd._tag, vd._refnum) # or this: # vgroup.add(HC.DFTAG_VH, vd._refnum) # Add dataset to the vgroup vg.add(HC.DFTAG_NDG, sds.ref()) # Close vgroup, vdata and dataset. vg.detach() # vgroup vd.detach() # vdata sds.endaccess() # dataset # Terminate V, VS and SD interfaces. v.end() # V interface vs.end() # VS interface sd.end() # SD interface # Close HDF file. hdf.close() pyhdf-0.10.3/pyhdf/000077500000000000000000000000001405105412500140145ustar00rootroot00000000000000pyhdf-0.10.3/pyhdf/HC.py000066400000000000000000000036101405105412500146600ustar00rootroot00000000000000# $Id: HC.py,v 1.2 2005-07-14 01:36:41 gosselin_a Exp $ # $Log: not supported by cvs2svn $ # Revision 1.1 2004/08/02 15:36:04 gosselin # Initial revision # from . import hdfext as _C class HC(object): """The HC class holds constants defining opening modes and data types. File opening modes (flags ORed together) CREATE 4 create file if it does not exist READ 1 read-only mode TRUNC 256 truncate if it exists WRITE 2 read-write mode Data types CHAR 4 8-bit char CHAR8 4 8-bit char UCHAR 3 unsigned 8-bit integer (0 to 255) UCHAR8 3 unsigned 8-bit integer (0 to 255) INT8 20 signed 8-bit integer (-128 to 127) UINT8 21 unsigned 8-bit integer (0 to 255) INT16 23 signed 16-bit integer UINT16 23 unsigned 16-bit integer INT32 24 signed 32-bit integer UINT32 25 unsigned 32-bit integer FLOAT32 5 32-bit floating point FLOAT64 6 64-bit floating point Tags DFTAG_NDG 720 dataset DFTAG_VH 1962 vdata DFTAG_VG 1965 vgroup """ CREATE = _C.DFACC_CREATE READ = _C.DFACC_READ TRUNC = 0x100 # specific to pyhdf WRITE = _C.DFACC_WRITE CHAR = _C.DFNT_CHAR8 CHAR8 = _C.DFNT_CHAR8 UCHAR = _C.DFNT_UCHAR8 UCHAR8 = _C.DFNT_UCHAR8 INT8 = _C.DFNT_INT8 UINT8 = _C.DFNT_UINT8 INT16 = _C.DFNT_INT16 UINT16 = _C.DFNT_UINT16 INT32 = _C.DFNT_INT32 UINT32 = _C.DFNT_UINT32 FLOAT32 = _C.DFNT_FLOAT32 FLOAT64 = _C.DFNT_FLOAT64 FULL_INTERLACE = 0 NO_INTERLACE =1 # NOTE: # INT64 and UINT64 are not yet supported py pyhdf DFTAG_NDG = _C.DFTAG_NDG DFTAG_VH = _C.DFTAG_VH DFTAG_VG = _C.DFTAG_VG pyhdf-0.10.3/pyhdf/HDF.py000066400000000000000000000244371405105412500150010ustar00rootroot00000000000000# $Id: HDF.py,v 1.3 2005-07-14 01:36:41 gosselin_a Exp $ # $Log: not supported by cvs2svn $ # Revision 1.2 2004/08/02 15:36:04 gosselin # pyhdf-0.7-1 # # Revision 1.1 2004/08/02 15:22:59 gosselin # Initial revision # # Author: Andre Gosselin # Maurice-Lamontagne Institute # gosselina@dfo-mpo.gc.ca """ Basic API (:mod:`pyhdf.HDF`) ============================ A module of the pyhdf package implementing the basic API of the NCSA HDF4 library. Introduction ------------ The role of the HDF module is to provide support to other modules of the pyhdf package. It defines constants specifying file opening modes and various data types, methods for accessing files, plus a few utility functions to query library version and check if a file is an HDF one. It should be noted that, among the modules of the pyhdf package, SD is special in the sense that it is self-contained and does not need support from the HDF module. For example, SD provides its own file opening and closing methods, whereas VS uses methods of the HDF.HDF class for that. Functions and classes summary ----------------------------- The HDF module provides the following classes. HC The HC class holds constants defining opening modes and various data types. HDF The HDF class provides methods to open and close an HDF file, and return instances of the major HDF APIs (except SD). To instantiate an HDF class, call the HDF() constructor. methods: constructors: HDF() open an HDF file, creating the file if necessary, and return an HDF instance vstart() initialize the VS (Vdata) API over the HDF file and return a VS instance vgstart() initialize the V (Vgroup) interface over the HDF file and return a V instance. closing file close() close the HDF file inquiry getfileversion() return info about the version of the HDF file The HDF module also offers the following functions. inquiry getlibversion() return info about the version of the library ishdf() determine whether a file is an HDF file """ import os, sys, types from . import hdfext as _C from .six.moves import xrange from .HC import HC # NOTE: The vstart() and vgstart() modules need to access the # VS and V modules, resp. We could simply import those # two modules, but then they would always be loaded and this # may not be what the user wants. Instead of forcing the # systematic import, we import the package `pyhdf', # and access the needed constructors by writing # 'pyhdf.VS.VS()' and 'pyhdf.V.V()'. Until the VS or # V modules are imported, those statements will give an # error (undefined attribute). Once the user has imported # the modules, the error will disappear. import pyhdf from .error import HDF4Error, _checkErr # List of names we want to be imported by an "from pyhdf.HDF import *" # statement __all__ = ['HDF', 'HDF4Error', 'HC', 'getlibversion', 'ishdf'] def getlibversion(): """Get the library version info. Args: no argument Returns: 4-element tuple with the following components: -major version number (int) -minor version number (int) -complete library version number (int) -additional information (string) C library equivalent : Hgetlibversion """ status, major_v, minor_v, release, info = _C.Hgetlibversion() _checkErr('getlibversion', status, "cannot get lib version") return major_v, minor_v, release, info def ishdf(filename): """Determine whether a file is an HDF file. Args: filename name of the file to check Returns: 1 if the file is an HDF file, 0 otherwise C library equivalent : Hishdf """ return _C.Hishdf(filename) class HDF(object): """The HDF class encapsulates the basic HDF functions. Its main use is to open and close an HDF file, and return instances of the major HDF APIs (except for SD). To instantiate an HDF class, call the HDF() constructor. """ def __init__(self, path, mode=HC.READ, nblocks=0): """HDF constructor: open an HDF file, creating the file if necessary. Args: path name of the HDF file to open mode file opening mode; this mode is a set of binary flags which can be ored together HC.CREATE combined with HC.WRITE to create file if it does not exist HC.READ open file in read-only access (default) HC.TRUNC if combined with HC.WRITE, overwrite file if it already exists HC.WRITE open file in read-write mode; if file exists it is updated, unless HC.TRUNC is set, in which case it is erased and recreated; if file does not exist, an error is raised unless HC.CREATE is set, in which case the file is created Note an important difference in the way CREATE is handled by the HDF C library and the pyhdf package. In the C library, CREATE indicates that a new file should always be created, overwriting an existing one if any. For pyhdf, CREATE indicates a new file should be created only if it does not exist, and the overwriting of an already existing file must be explicitly asked for by setting the TRUNC flag. Those differences were introduced so as to harmonize the way files are opened in the pycdf and pyhdf packages. Also, this solves a limitation in the hdf (and netCDF) library, where there is no easy way to implement the frequent requirement that an existent file be opened in read-write mode, or created if it does not exist. nblocks number of data descriptor blocks in a block with which to create the file; the parameter is ignored if the file is not created; 0 asks to use the default Returns: an HDF instance C library equivalent : Hopen """ # Private attributes: # _id: file id (NOTE: not compatile with the SD file id) # See if file exists. exists = os.path.exists(path) if HC.WRITE & mode: if exists: if HC.TRUNC & mode: try: os.remove(path) except Exception as msg: raise HDF4Error(msg) mode = HC.CREATE else: mode = HC.WRITE else: if HC.CREATE & mode: mode = HC.CREATE else: raise HDF4Error("HDF: no such file") else: if exists: if mode & HC.READ: mode = HC.READ # clean mode else: raise HDF4Error("HDF: invalid mode") else: raise HDF4Error("HDF: no such file") id = _C.Hopen(path, mode, nblocks) _checkErr('HDF', id, "cannot open %s" % path) self._id = id def __del__(self): """Delete the instance, first calling the end() method if not already done. """ try: if self._id: self.close() except: pass def close(self): """Close the HDF file. Args: no argument Returns: None C library equivalent : Hclose """ _checkErr('close', _C.Hclose(self._id), "cannot close file") self._id = None def getfileversion(self): """Get file version info. Args: no argument Returns: 4-element tuple with the following components: -major version number (int) -minor version number (int) -complete library version number (int) -additional information (string) C library equivalent : Hgetlibversion """ status, major_v, minor_v, release, info = _C.Hgetfileversion(self._id) _checkErr('getfileversion', status, "cannot get file version") return major_v, minor_v, release, info def vstart(self): """Initialize the VS API over the file and return a VS instance. Args: no argument Returns: VS instance C library equivalent : Vstart (in fact: Vinitialize) """ # See note at top of file. return pyhdf.VS.VS(self) def vgstart(self): """Initialize the V API over the file and return a V instance. Args: no argument Returns: V instance C library equivalent : Vstart (in fact: Vinitialize) """ # See note at top of file. return pyhdf.V.V(self) ########################### # Support functions ########################### def _array_to_ret(buf, nValues): # Convert array 'buf' to a scalar or a list. if nValues == 1: ret = buf[0] else: ret = [] for i in xrange(nValues): ret.append(buf[i]) return ret def _array_to_str(buf, nValues): # Convert array of bytes 'buf' to a string. # Return empty string if there is no value. if nValues == 0: return "" # When there is just one value, _array_to_ret returns a scalar # over which we cannot iterate. if nValues == 1: chrs = [chr(buf[0])] else: chrs = [chr(b) for b in _array_to_ret(buf, nValues)] # Strip NULL at end if chrs[-1] == '\0': del chrs[-1] return ''.join(chrs) pyhdf-0.10.3/pyhdf/Makefile000066400000000000000000000003231405105412500154520ustar00rootroot00000000000000 .PHONY: build build: hdfext.py hdfext_wrap.c hdfext.py: hdfext.i swig -python hdfext.i hdfext_wrap.c: hdfext.py # Already generated by swig. Do nothing. .PHONY: clean clean: rm -rf __pycache__ *.so *.pyc pyhdf-0.10.3/pyhdf/SD.py000066400000000000000000003415701405105412500147060ustar00rootroot00000000000000# $Id: SD.py,v 1.10 2008-08-05 00:20:44 gosselin_a Exp $ # $Log: not supported by cvs2svn $ # Revision 1.9 2008/06/30 02:59:57 gosselin_a # Fixed definition of equivNumericTypes list. # # Revision 1.8 2008/06/30 02:41:44 gosselin_a # Preleminary check-in of changes leading to the 0.8 revision. # - switch to numpy, Numeric now unsupported # - better documentation of the compression features # - some bug fixes # # Revision 1.7 2005/07/14 01:36:41 gosselin_a # pyhdf-0.7-3 # Ported to HDF4.2r1. # Support for SZIP compression on SDS datasets. # All classes are now 'new-style' classes, deriving from 'object'. # Update documentation. # # Revision 1.6 2005/01/25 18:17:53 gosselin_a # Importer le symbole 'HDF4Error' a partir du module SD. # # Revision 1.5 2004/08/02 17:06:20 gosselin # pyhdf-0.7.2 # # Revision 1.4 2004/08/02 15:36:04 gosselin # pyhdf-0.7-1 # # Revision 1.3 2004/08/02 15:22:59 gosselin # pyhdf -0.6-1 # # Revision 1.2 2004/08/02 15:00:34 gosselin # pyhdf 0.5-2 # # Author: Andre Gosselin # Maurice Lamontagne Institute # Andre.Gosselin@dfo-mpo.gc.ca """ SD (scientific dataset) API (:mod:`pyhdf.SD`) ============================================= A module of the pyhdf package implementing the SD (scientific dataset) API of the NCSA HDF4 library. Introduction ------------ SD is one of the modules composing pyhdf, a python package implementing the NCSA HDF library and letting one manage HDF files from within a python program. Two versions of the HDF library currently exist, version 4 and version 5. pyhdf only implements version 4 of the library. Many different APIs are to be found inside the HDF4 specification. Currently, pyhdf implements just a few of those: the SD, VS and V APIs. Other APIs should be added in the future (GR, AN, etc). The SD module implements the SD API of the HDF4 library, supporting what are known as "scientific datasets". The HDF SD API has many similarities with the netCDF API, another popular API for dealing with scientific datasets. netCDF files can be in fact read and modified using the SD module (but cannot be created from scratch). SD module key features ---------------------- SD key features are as follows. - Almost every routine of the original SD API has been implemented inside pyhdf. Only a few have been ignored, most of them being of a rare use: - SDsetnbitdataset() - All chunking/tiling routines : SDgetchunkinfo(), SDreadchunk(), SDsetchunk(), SDsetchunkcache(), SDwritechunk() - SDsetblocksize() - SDisdimval_bwcomp(), SDsetdimval_comp() - It is quite straightforward to go from a C version to a python version of a program accessing the SD API, and to learn SD usage by referring to the C API documentation. - A few high-level python methods have been developed to ease programmers task. Of greatest interest are those allowing access to SD datasets through familiar python idioms. - Attributes can be read/written like ordinary python class attributes. - Datasets can be read/written like ordinary python lists using multidimensional indices and so-called "extended slice syntax", with strides allowed. See "High level attribute access" and "High level variable access" sections for details. - SD offers methods to retrieve a dictionary of the attributes, dimensions and variables defined on a dataset, and of the attributes set on a variable and a dimension. Querying a dataset is thus geatly simplified. - SD datasets are read/written through "numpy", a sophisticated python package for efficiently handling multi-dimensional arrays of numbers. numpy can nicely extend the SD functionality, eg. adding/subtracting arrays with the '+/-' operators. Accessing the SD module ----------------------- To access the SD API a python program can say one of: >>> import pyhdf.SD # must prefix names with "pyhdf.SD." >>> from pyhdf import SD # must prefix names with "SD." >>> from pyhdf.SD import * # names need no prefix This document assumes the last import style is used. numpy will also need to be imported: >>> from numpy import * Package components ------------------ pyhdf is a proper Python package, eg a collection of modules stored under a directory whose name is that of the package and which stores an __init__.py file. Following the normal installation procedure, this directory will be /site-packages/pyhdf', where stands for the python installation directory. For each HDF API exists a corresponding set of modules. The following modules are related to the SD API. _hdfext C extension module responsible for wrapping the HDF C-library for all python modules hdfext python module implementing some utility functions complementing the _hdfext extension module error defines the HDF4Error exception SD python module wrapping the SD API routines inside an OOP framework _hdfext and hdfext were generated using the SWIG preprocessor. SWIG is however *not* needed to run the package. Those two modules are meant to do their work in the background, and should never be called directly. Only 'pyhdf.SD' should be imported by the user program. Prerequisites ------------- The following software must be installed in order for pyhdf release 0.8 to work. HDF (v4) library, release 4.2r1 pyhdf does *not* include the HDF4 library, which must be installed separately. HDF is available at: "https://portal.hdfgroup.org/display/support/Download+HDF4". HDF4.2r1 in turn relies on the following packages : ======= ============== =========================================== libjpeg (jpeg library) release 6b libz (zlib library) release 1.1.4 or above libsz (SZIP library) release 2.0; this package is optional if pyhdf is installed with NOSZIP macro set ======= ============== =========================================== The SD module also needs: numpy python package SD variables are read/written using the array data type provided by the python NumPy package. Note that since version 0.8 of pyhdf, version 1.0.5 or above of NumPy is needed. numpy is available at: "http://www.numpy.org". Documentation ------------- pyhdf has been written so as to stick as closely as possible to the naming conventions and calling sequences documented inside the "HDF User s Guide" manual. Even if pyhdf gives an OOP twist to the C API, the manual can be easily used as a documentary source for pyhdf, once the class to which a function belongs has been identified, and of course once requirements imposed by the Python language have been taken into account. Consequently, this documentation will not attempt to provide an exhaustive coverage of the HDF SD API. For this, the user is referred to the above manual. The documentation of each pyhdf method will indicate the name of the equivalent routine inside the C API. This document (in both its text and html versions) has been completely produced using "pydoc", the Python documentation generator (which made its debut in the 2.1 Python release). pydoc can also be used as an on-line help tool. For example, to know everything about the SD.SDS class, say: >>> from pydoc import help >>> from pyhdf.SD import * >>> help(SDS) To be more specific and get help only for the get() method of the SDS class: >>> help(SDS.get) # or... >>> help(vinst.get) # if vinst is an SDS instance pydoc can also be called from the command line, as in:: % pydoc pyhdf.SD.SDS # doc for the whole SDS class % pydoc pyhdf.SD.SDS.get # doc for the SDS.get method Summary of differences between the pyhdf and C SD API ----------------------------------------------------- Most of the differences between the pyhdf and C SD API can be summarized as follows. - In the C API, every function returns an integer status code, and values computed by the function are returned through one or more pointers passed as arguments. - In pyhdf, error statuses are returned through the Python exception mechanism, and values are returned as the method result. When the C API specifies that multiple values are returned, pyhdf returns a tuple of values, which are ordered similarly to the pointers in the C function argument list. Error handling -------------- All errors that the C SD API reports with a SUCCESS/FAIL error code are reported by pyhdf using the Python exception mechanism. When the C library reports a FAIL status, pyhdf raises an HDF4Error exception (a subclass of Exception) with a descriptive message. Unfortunately, the C library is rarely informative about the cause of the error. pyhdf does its best to try to document the error, but most of the time cannot do more than saying "execution error". Attribute access: low and high level ------------------------------------ In the SD API, attributes can be of many types (integer, float, string, etc) and can be single or multi-valued. Attributes can be set either at the dataset, the variable or the dimension level. This can can be achieved in two ways. - By calling the get()/set() method of an attribute instance. In the following example, HDF file 'example.hdf' is created, and string attribute 'title' is attached to the file and given value 'example'. >>> from pyhdf.SD import * >>> d = SD('example.hdf',SDC.WRITE|SDC.CREATE) # create file >>> att = d.attr('title') # create attribute instance >>> att.set(SDC.CHAR, 'example') # set attribute type and value >>> print(att.get()) # get attribute value >>> - By handling the attribute like an ordinary Python class attribute. The above example can then be rewritten as follows: >>> from pyhdf.SD import * >>> d = SD('example.hdf',SDC.WRITE|SDC.CREATE) # create dataset >>> d.title = 'example' # set attribute type and value >>> print(d.title) # get attribute value >>> What has been said above applies as well to multi-valued attributes. >>> att = d.attr('values') # With an attribute instance >>> att.set(SDC.INT32, (1,2,3,4,5)) # Assign 5 ints as attribute value >>> att.get() # Get attribute values [1, 2, 3, 4, 5] >>> d.values = (1,2,3,4,5) # As a Python class attribute >>> d.values # Get attribute values [1, 2, 3, 4, 5] When the attribute is known by its name , standard functions 'setattr()' and 'getattr()' can be used to replace the dot notation. Above example becomes: >>> setattr(d, 'values', (1,2,3,4,5)) >>> getattr(d, 'values') [1, 2, 3, 4, 5] Handling a SD attribute like a Python class attribute is admittedly more natural, and also much simpler. Some control is however lost in doing so. - Attribute type cannot be specified. pyhdf automatically selects one of three types according to the value(s) assigned to the attribute: SDC.CHAR if value is a string, SDC.INT32 if all values are integral, SDC.DOUBLE if one value is a float. - Consequently, byte values cannot be assigned. - Attribute properties (length, type, index number) can only be queried through methods of an attribute instance. Variable access: low and high level ----------------------------------- Similarly to attributes, datasets can be read/written in two ways. The first way is through the get()/set() methods of a dataset instance. Those methods accept parameters to specify the starting indices, the count of values to read/write, and the strides along each dimension. For example, if 'v' is a 4x4 array: >>> v.get() # complete array >>> v.get(start=(0,0),count=(1,4)) # first row >>> v.get(start=(0,1),count=(2,2), # second and third columns of ... stride=(2,1)) # first and third row The second way is by indexing and slicing the variable like a Python sequence. pyhdf here follows most of the rules used to index and slice numpy arrays. Thus an HDF dataset can be seen almost as a numpy array, except that data is read from/written to a file instead of memory. Extended indexing let you access variable elements with the familiar [i,j,...] notation, with one index per dimension. For example, if 'm' is a rank 3 dataset, one could write: >>> m[0,3,5] = m[0,5,3] When indexing is used to select a dimension in a 'get' operation, this dimension is removed from the output array, thus reducing its rank by 1. A rank 0 array is converted to a scalar. Thus, for a 3x3x3 'm' dataset (rank 3) of integer type : >>> a = m[0] # a is a 3x3 array (rank 2) >>> a = m[0,0] # a is a 3 element array (rank 1) >>> a = m[0,0,0] # a is an integer (rank 0 array becomes a scalar) Had this rule not be followed, m[0,0,0] would have resulted in a single element array, which could complicate computations. Extended slice syntax allows slicing HDF datasets along each of its dimensions, with the specification of optional strides to step through dimensions at regular intervals. For each dimension, the slice syntax is: "i:j[:stride]", the stride being optional. As with ordinary slices, the starting and ending values of a slice can be omitted to refer to the first and last element, respectively, and the end value can be negative to indicate that the index is measured relative to the tail instead of the beginning. Omitted dimensions are assumed to be sliced from beginning to end. Thus: >>> m[0] # treated as 'm[0,:,:]'. Example above with get()/set() methods can thus be rewritten as follows: >>> v[:] # complete array >>> v[:1] # first row >>> v[::2,1:3] # second and third columns of first and third row Indexes and slices can be freely mixed, eg: >>> m[:2,3,1:3:2] Note that, countrary to indexing, a slice never reduces the rank of the output array, even if its length is 1. For example, given a 3x3x3 'm' dataset: >>> a = m[0] # indexing: a is a 3x3 array (rank 2) >>> a = m[0:1] # slicing: a is a 1x3x3 array (rank 3) As can easily be seen, extended slice syntax is much more elegant and compact, and offers a few possibilities not easy to achieve with the get()/sett() methods. Negative indices offer a nice example: >>> v[-2:] # last two rows >>> v[-3:-1] # second and third row >>> v[:,-1] # last column Reading/setting multivalued HDF attributes and variables -------------------------------------------------------- Multivalued HDF attributes are set using a python sequence (tuple or list). Reading such an attribute returns a python list. The easiest way to read/set an attribute is by handling it like a Python class attribute (see "High level attribute access"). For example: >>> d=SD('test.hdf',SDC.WRITE|SDC.CREATE) # create file >>> d.integers = (1,2,3,4) # define multivalued integer attr >>> d.integers # get the attribute value [1, 2, 3, 4] The easiest way to set multivalued HDF datasets is to assign to a subset of the dataset, using "[:]" to assign to the whole dataset (see "High level variable access"). The assigned value can be a python sequence, which can be multi-leveled when assigning to a multdimensional dataset. For example: >>> d=SD('test.hdf',SDC.WRITE|SDC.CREATE) # create file >>> v1=d.create('v1',SDC.INT32,3) # 3-elem vector >>> v1[:]=[1,2,3] # assign 3-elem python list >>> v2=d.create('d2',SDC.INT32,(3,3)) # create 3x3 variable # The list assigned to v2 is composed # of 3 lists, each representing a row of v2. >>> v2[:]=[[1,2,3],[11,12,13],[21,22,23]] The assigned value can also be a numpy array. Rewriting example above: >>> v1=array([1,2,3]) >>> v2=array([[1,2,3],[11,12,13],[21,22,23]]) Note how we use indexing expressions 'v1[:]' and 'v2[:]' when assigning using python sequences, and just the variable names when assigning numpy arrays. Reading an HDF dataset always returns a numpy array, except if indexing is used and produces a rank-0 array, in which case a scalar is returned. netCDF files ------------ Files written in the popular Unidata netCDF format can be read and updated using the HDF SD API. However, pyhdf cannot create netCDF formatted files from scratch. The python 'pycdf' package can be used for that. When accessing netCDF files through pyhdf, one should be aware of the following differences between the netCDF and the HDF SD libraries. - Differences in terminology can be confusing. What netCDF calls a 'dataset' is called a 'file' or 'SD interface' in HDF. What HDF calls a dataset is called a 'variable' in netCDF parlance. - In the netCDF API, dimensions are defined at the global (netCDF dataset) level. Thus, two netCDF variables defined over dimensions X and Y necessarily have the same rank and shape. - In the HDF SD API, dimensions are defined at the HDF dataset level, except when they are named. Dimensions with the same name are considered to be "shared" between all the file datasets. They must be of the same length, and they share all their scales and attributes. For example, setting an attribute on a shared dimension affects all datasets sharing that dimension. - When two or more netCDF variables are based on the unlimited dimension, they automatically grow in sync. If variables A and B use the unlimited dimension, adding "records" to A along its unlimited dimension implicitly adds records in B (which are left in an undefined state and filled with the fill_value when the file is refreshed). - In HDF, unlimited dimensions behave independently. If HDF datasets A and B are based on an unlimited dimension, adding records to A does not affect the number of records to B. This is true even if the unlimited dimensions bear the same name (they do not appear to be "shared" as is the case when the dimensions are fixed). Classes summary --------------- pyhdf wraps the SD API using different types of python classes:: SD HDF SD interface (almost synonymous with the subset of the HDF file holding all the SD datasets) SDS scientific dataset SDim dataset dimension SDAttr attribute (either at the file, dataset or dimension level) SDC constants (opening modes, data types, etc) In more detail:: SD The SD class implements the HDF SD interface as applied to a given file. This class encapsulates the "SD interface" identifier (referred to as "sd_id" in the C API documentation), and all the SD API top-level functions. To create an SD instance, call the SD() constructor. methods: constructors: SD() open an existing HDF file or create a new one, returning an SD instance attr() create an SDAttr (attribute) instance to access an existing file attribute or create a new one; "dot notation" can also be used to get and set an attribute create() create a new dataset, returning an SDS instance select() locate an existing dataset given its name or index number, returning an SDS instance file closing end() end access to the SD interface and close the HDF file inquiry attributes() return a dictionary describing every global attribute attached to the HDF file datasets() return a dictionary describing every dataset stored inside the file info() get the number of datasets stored in the file and the number of attributes attached to it nametoindex() get a dataset index number given the dataset name reftoindex() get a dataset index number given the dataset reference number misc setfillmode() set the fill mode for all the datasets in the file SDAttr The SDAttr class defines an attribute, either at the file (SD), dataset (SDS) or dimension (SDim) level. The class encapsulates the object to which the attribute is attached, and the attribute name. To create an SDAttr instance, obtain an instance for an SD (file), SDS (dataset) or dimension (SDim) object, and call its attr() method. NOTE. An attribute can also be read/written like a python class attribute, using the familiar dot notation. See "High level attribute access". methods: read/write value get() get the attribute value set() set the attribute value inquiry index() get the attribute index number info() get the attribute name, type and number of values SDC The SDC class holds constants defining file opening modes and data types. Constants are named after their C API counterparts. file opening modes: SDC.CREATE create file if non existent SDC.READ read-only mode SDC.TRUNC truncate file if already exists SDC.WRITE read-write mode data types: SDC.CHAR 8-bit character SDC.CHAR8 8-bit character SDC.UCHAR unsigned 8-bit integer SDC.UCHAR8 unsigned 8-bit integer SDC.INT8 signed 8-bit integer SDC.UINT8 unsigned 8-bit integer SDC.INT16 signed 16-bit integer SDC.UINT16 unsigned 16-bit intege SDC.INT32 signed 32-bit integer SDC.UINT32 unsigned 32-bit integer SDC.FLOAT32 32-bit floating point SDC.FLOAT64 64-bit floaring point dataset fill mode: SDC.FILL SDC.NOFILL dimension: SDC.UNLIMITED dimension can grow dynamically data compression: SDC.COMP_NONE SDC.COMP_RLE SDC.COMP_NBIT SDC.COMP_SKPHUFF SDC.COMP_DEFLATE SDC.COMP_SZIP SDC.COMP_SZIP_EC SDC.COMP_SZIP_NN SDC.COMP_SZIP_RAW SDS The SDS class implements an HDF scientific dataset (SDS) object. To create an SDS instance, call the create() or select() methods of an SD instance. methods: constructors attr() create an SDAttr (attribute) instance to access an existing dataset attribute or create a new one; "dot notation" can also be used to get and set an attribute dim() return an SDim (dimension) instance for a given dataset dimension, given the dimension index number dataset closing endaccess() terminate access to the dataset inquiry attributes() return a dictionary describing every attribute defined on the dataset checkempty() determine whether the dataset is empty dimensions() return a dictionary describing all the dataset dimensions info() get the dataset name, rank, dimension lengths, data type and number of attributes iscoordvar() determine whether the dataset is a coordinate variable (holds a dimension scale) isrecord() determine whether the dataset is appendable (the dataset dimension 0 is unlimited) ref() get the dataset reference number reading/writing data values get() read data from the dataset set() write data to the dataset A dataset can also be read/written using the familiar index and slice notation used to access python sequences. See "High level variable access". reading/writing standard attributes getcal() get the dataset calibration coefficients: scale_factor, scale_factor_err, add_offset, add_offset_err, calibrated_nt getdatastrs() get the dataset standard string attributes: long_name, units, format, coordsys getfillvalue() get the dataset fill value: _FillValue getrange() get the dataset min and max values: valid_range setcal() set the dataset calibration coefficients setdatastrs() set the dataset standard string attributes setfillvalue() set the dataset fill value setrange() set the dataset min and max values compression getcompress() get info about the dataset compression type and mode setcompress() set the dataset compression type and mode misc setexternalfile() store the dataset in an external file SDim The SDdim class implements a dimension object. To create an SDim instance, call the dim() method of an SDS (dataset) instance. Methods: constructors attr() create an SDAttr (attribute) instance to access an existing dimension attribute or create a new one; "dot notation" can also be used to get and set an attribute inquiry attributes() return a dictionary describing every attribute defined on the dimension info() get the dimension name, length, scale data type and number of attributes length() return the current dimension length reading/writing dimension data getscale() get the dimension scale values setname() set the dimension name setscale() set the dimension scale values reading/writing standard attributes getstrs() get the dimension standard string attributes: long_name, units, format setstrs() set the dimension standard string attributes Data types ---------- Data types come into play when first defining datasets and their attributes, and later when querying the definition of those objects. Data types are specified using the symbolic constants defined inside the SDC class of the SD module. - CHAR and CHAR8 (equivalent): an 8-bit character. - UCHAR, UCHAR8 and UINT8 (equivalent): unsigned 8-bit values (0 to 255) - INT8: signed 8-bit values (-128 to 127) - INT16: signed 16-bit values - UINT16: unsigned 16 bit values - INT32: signed 32 bit values - UINT32: unsigned 32 bit values - FLOAT32: 32 bit floating point values (C floats) - FLOAT64: 64 bit floating point values (C doubles) There is no explicit "string" type. To simulate a string, set the type to CHAR, and set the length to a value of 'n' > 1. This creates and "array of characters", close to a string (except that strings will always be of length 'n', right-padded with spaces if necessary). Programming models ------------------ Writing ^^^^^^^ The following code can be used as a model to create an SD dataset. It shows how to use the most important functionalities of the SD interface needed to initialize a dataset. A real program should of course add error handling:: # Import SD and numpy. from pyhdf.SD import * from numpy import * fileName = 'template.hdf' # Create HDF file. hdfFile = SD(fileName ,SDC.WRITE|SDC.CREATE) # Assign a few attributes at the file level hdfFile.author = 'It is me...' hdfFile.priority = 2 # Create a dataset named 'd1' to hold a 3x3 float array. d1 = hdfFile.create('d1', SDC.FLOAT32, (3,3)) # Set some attributes on 'd1' d1.description = 'Sample 3x3 float array' d1.units = 'celsius' # Name 'd1' dimensions and assign them attributes. dim1 = d1.dim(0) dim2 = d1.dim(1) dim1.setname('width') dim2.setname('height') dim1.units = 'm' dim2.units = 'cm' # Assign values to 'd1' d1[0] = (14.5, 12.8, 13.0) # row 1 d1[1:] = ((-1.3, 0.5, 4.8), # row 2 and (3.1, 0.0, 13.8)) # row 3 # Close dataset d1.endaccess() # Close file hdfFile.end() Reading ^^^^^^^ The following code, which reads the dataset created above, can also serve as a model for any program which needs to access an SD dataset:: # Import SD and numpy. from pyhdf.SD import * from numpy import * fileName = 'template.hdf' # Open file in read-only mode (default) hdfFile = SD(fileName) # Display attributes. print "file:", fileName print "author:", hdfFile.author print "priority:", hdfFile.priority # Open dataset 'd1' d1 = hdfFile.select('d1') # Display dataset attributes. print "dataset:", 'd1' print "description:",d1.description print "units:", d1.units # Display dimensions info. dim1 = d1.dim(0) dim2 = d1.dim(1) print "dimensions:" print "dim1: name=", dim1.info()[0], print "length=", dim1.length(), print "units=", dim1.units print "dim2: name=", dim2.info()[0], print "length=", dim2.length(), print "units=", dim2.units # Show dataset values print d1[:] # Close dataset d1.endaccess() # Close file hdfFile.end() Examples -------- Example-1 ^^^^^^^^^ The following simple example exercises some important pyhdf.SD methods. It shows how to create an HDF dataset, define attributes and dimensions, create variables, and assign their contents. Suppose we have a series of text files each defining a 2-dimensional real- valued matrix. First line holds the matrix dimensions, and following lines hold matrix values, one row per line. The following procedure will load into an HDF dataset the contents of any one of those text files. The procedure computes the matrix min and max values, storing them as dataset attributes. It also assigns to the variable the group of attributes passed as a dictionary by the calling program. Note how simple such an assignment becomes with pyhdf: the dictionary can contain any number of attributes, of different types, single or multi-valued. Doing the same in a conventional language would be a much more challenging task. Error checking is minimal, to keep example as simple as possible (admittedly a rather poor excuse ...):: from numpy import * from pyhdf.SD import * import os def txtToHDF(txtFile, hdfFile, varName, attr): try: # Catch pyhdf errors # Open HDF file in update mode, creating it if non existent. d = SD(hdfFile, SDC.WRITE|SDC.CREATE) # Open text file and get matrix dimensions on first line. txt = open(txtFile) ni, nj = map(int, txt.readline().split()) # Define an HDF dataset of 32-bit floating type (SDC.FLOAT32) # with those dimensions. v = d.create(varName, SDC.FLOAT32, (ni, nj)) # Assign attributes passed as argument inside dict 'attr'. for attrName in attr.keys(): setattr(v, attrName, attr[attrName]) # Load variable with lines of data. Compute min and max # over the whole matrix. i = 0 while i < ni: elems = map(float, txt.readline().split()) v[i] = elems # load row i minE = min(elems) maxE = max(elems) if i: minVal = min(minVal, minE) maxVal = max(maxVal, maxE) else: minVal = minE maxVal = maxE i += 1 # Set variable min and max attributes. v.minVal = minVal v.maxVal = maxVal # Close dataset and file objects (not really necessary, since # closing is automatic when objects go out of scope. v.endaccess() d.end() txt.close() except HDF4Error, msg: print "HDF4Error:", msg We could now call the procedure as follows:: hdfFile = 'table.hdf' try: # Delete if exists. os.remove(hdfFile) except: pass # Load contents of file 'temp.txt' into dataset 'temperature' # an assign the attributes 'title', 'units' and 'valid_range'. txtToHDF('temp.txt', hdfFile, 'temperature', {'title' : 'temperature matrix', 'units' : 'celsius', 'valid_range': (-2.8,27.0)}) # Load contents of file 'depth.txt' into dataset 'depth' # and assign the same attributes as above. txtToHDF('depth.txt', hdfFile, 'depth', {'title' : 'depth matrix', 'units' : 'meters', 'valid_range': (0, 500.0)}) Example 2 ^^^^^^^^^ This example shows a useful python program that will display the structure of the SD component of any HDF file whose name is given on the command line. After the HDF file is opened, high level inquiry methods are called to obtain dictionaries describing attributes, dimensions and datasets. The rest of the program mostly consists in nicely formatting the contents of those dictionaries:: import sys from pyhdf.SD import * from numpy import * # Dictionary used to convert from a numeric data type to its symbolic # representation typeTab = { SDC.CHAR: 'CHAR', SDC.CHAR8: 'CHAR8', SDC.UCHAR8: 'UCHAR8', SDC.INT8: 'INT8', SDC.UINT8: 'UINT8', SDC.INT16: 'INT16', SDC.UINT16: 'UINT16', SDC.INT32: 'INT32', SDC.UINT32: 'UINT32', SDC.FLOAT32: 'FLOAT32', SDC.FLOAT64: 'FLOAT64' } printf = sys.stdout.write def eol(n=1): printf("%s" % chr(10) * n) hdfFile = sys.argv[1] # Get first command line argument try: # Catch pyhdf.SD errors # Open HDF file named on the command line f = SD(hdfFile) # Get global attribute dictionary attr = f.attributes(full=1) # Get dataset dictionary dsets = f.datasets() # File name, number of attributes and number of variables. printf("FILE INFO"); eol() printf("-------------"); eol() printf("%-25s%s" % ("File:", hdfFile)); eol() printf("%-25s%d" % (" file attributes:", len(attr))); eol() printf("%-25s%d" % (" datasets:", len(dsets))); eol() eol(); # Global attribute table. if len(attr) > 0: printf("File attributes"); eol(2) printf(" name idx type len value"); eol() printf(" -------------------- --- ------- --- -----"); eol() # Get list of attribute names and sort them lexically attNames = attr.keys() attNames.sort() for name in attNames: t = attr[name] # t[0] is the attribute value # t[1] is the attribute index number # t[2] is the attribute type # t[3] is the attribute length printf(" %-20s %3d %-7s %3d %s" % (name, t[1], typeTab[t[2]], t[3], t[0])); eol() eol() # Dataset table if len(dsets) > 0: printf("Datasets (idx:index num, na:n attributes, cv:coord var)"); eol(2) printf(" name idx type na cv dimension(s)"); eol() printf(" -------------------- --- ------- -- -- ------------"); eol() # Get list of dataset names and sort them lexically dsNames = dsets.keys() dsNames.sort() for name in dsNames: # Get dataset instance ds = f.select(name) # Retrieve the dictionary of dataset attributes so as # to display their number vAttr = ds.attributes() t = dsets[name] # t[0] is a tuple of dimension names # t[1] is a tuple of dimension lengths # t[2] is the dataset type # t[3] is the dataset index number printf(" %-20s %3d %-7s %2d %-2s " % (name, t[3], typeTab[t[2]], len(vAttr), ds.iscoordvar() and 'X' or '')) # Display dimension info. n = 0 for d in t[0]: printf("%s%s(%d)" % (n > 0 and ', ' or '', d, t[1][n])) n += 1 eol() eol() # Dataset info. if len(dsNames) > 0: printf("DATASET INFO"); eol() printf("-------------"); eol(2) for name in dsNames: # Access the dataset dsObj = f.select(name) # Get dataset attribute dictionary dsAttr = dsObj.attributes(full=1) if len(dsAttr) > 0: printf("%s attributes" % name); eol(2) printf(" name idx type len value"); eol() printf(" -------------------- --- ------- --- -----"); eol() # Get the list of attribute names and sort them alphabetically. attNames = dsAttr.keys() attNames.sort() for nm in attNames: t = dsAttr[nm] # t[0] is the attribute value # t[1] is the attribute index number # t[2] is the attribute type # t[3] is the attribute length printf(" %-20s %3d %-7s %3d %s" % (nm, t[1], typeTab[t[2]], t[3], t[0])); eol() eol() # Get dataset dimension dictionary dsDim = dsObj.dimensions(full=1) if len(dsDim) > 0: printf ("%s dimensions" % name); eol(2) printf(" name idx len unl type natt");eol() printf(" -------------------- --- ----- --- ------- ----");eol() # Get the list of dimension names and sort them alphabetically. dimNames = dsDim.keys() dimNames.sort() for nm in dimNames: t = dsDim[nm] # t[0] is the dimension length # t[1] is the dimension index number # t[2] is 1 if the dimension is unlimited, 0 if not # t[3] is the the dimension scale type, 0 if no scale # t[4] is the number of attributes printf(" %-20s %3d %5d %s %-7s %4d" % (nm, t[1], t[0], t[2] and "X" or " ", t[3] and typeTab[t[3]] or "", t[4])); eol() eol() except HDF4Error, msg: print "HDF4Error", msg """ import os, sys, types from . import hdfext as _C from .six.moves import xrange from .error import _checkErr, HDF4Error # List of names we want to be imported by an "from pyhdf.SD import *" # statement __all__ = ['SD', 'SDAttr', 'SDC', 'SDS', 'SDim', 'HDF4Error'] try: import numpy as _toto del _toto except ImportError: raise HDF4Error("numpy package required but not installed") class SDC(object): """The SDC class holds constants defining opening modes and data types. file opening modes: ========== === =============================== SDC.CREATE 4 create file if non existent SDC.READ 1 read-only mode SDC.TRUNC 256 truncate file if already exists SDC.WRITE 2 read-write mode ========== === =============================== data types: =========== === =============================== SDC.CHAR 4 8-bit character SDC.CHAR8 4 8-bit character SDC.UCHAR 3 unsigned 8-bit integer SDC.UCHAR8 3 unsigned 8-bit integer SDC.INT8 20 signed 8-bit integer SDC.UINT8 21 unsigned 8-bit integer SDC.INT16 22 signed 16-bit integer SDC.UINT16 23 unsigned 16-bit intege SDC.INT32 24 signed 32-bit integer SDC.UINT32 25 unsigned 32-bit integer SDC.FLOAT32 5 32-bit floating point SDC.FLOAT64 6 64-bit floaring point =========== === =============================== dataset fill mode: =========== === SDC.FILL 0 SDC.NOFILL 256 =========== === dimension: ============= === =============================== SDC.UNLIMITED 0 dimension can grow dynamically ============= === =============================== data compression: ================= === SDC.COMP_NONE 0 SDC.COMP_RLE 1 SDC.COMP_NBIT 2 SDC.COMP_SKPHUFF 3 SDC.COMP_DEFLATE 4 SDC.COMP_SZIP 5 SDC.COMP_SZIP_EC 4 SDC.COMP_SZIP_NN 32 SDC.COMP_SZIP_RAW 128 ================= === """ CREATE = _C.DFACC_CREATE READ = _C.DFACC_READ TRUNC = 0x100 # specific to pyhdf WRITE = _C.DFACC_WRITE CHAR = _C.DFNT_CHAR8 CHAR8 = _C.DFNT_CHAR8 UCHAR = _C.DFNT_UCHAR8 UCHAR8 = _C.DFNT_UCHAR8 INT8 = _C.DFNT_INT8 UINT8 = _C.DFNT_UINT8 INT16 = _C.DFNT_INT16 UINT16 = _C.DFNT_UINT16 INT32 = _C.DFNT_INT32 UINT32 = _C.DFNT_UINT32 FLOAT32 = _C.DFNT_FLOAT32 FLOAT64 = _C.DFNT_FLOAT64 FILL = _C.SD_FILL NOFILL = _C.SD_NOFILL UNLIMITED = _C.SD_UNLIMITED COMP_NONE = _C.COMP_CODE_NONE COMP_RLE = _C.COMP_CODE_RLE COMP_NBIT = _C.COMP_CODE_NBIT COMP_SKPHUFF = _C.COMP_CODE_SKPHUFF COMP_DEFLATE = _C.COMP_CODE_DEFLATE COMP_SZIP = _C.COMP_CODE_SZIP COMP_SZIP_EC = 4 COMP_SZIP_NN = 32 COMP_SZIP_RAW = 128 # Types with an equivalent in the numpy package # NOTE: # CHAR8 and INT8 are handled similarly (signed byte -128,...,0,...127) # UCHAR8 and UINT8 are treated equivalently (unsigned byte: 0,1,...,255) # UINT16 and UINT32 are supported # INT64 and UINT64 are not yet supported py pyhdf equivNumericTypes = [FLOAT32, FLOAT64, INT8, UINT8, INT16, UINT16, INT32, UINT32, CHAR8, UCHAR8] class SDAttr(object): def __init__(self, obj, index_or_name): """Init an SDAttr instance. Should not be called directly by the user program. An SDAttr instance must be created through the attr() methods of the SD, SDS or SDim classes. """ # Args # obj object instance to which the attribute refers # (SD, SDS, SDDim) # index_or_name attribute index or name # # Class private attributes: # _obj object instance # _index attribute index or None # _name attribute name or None self._obj = obj # Name is given, may exist or not. if isinstance(index_or_name, type('')): self._name = index_or_name self._index = None # Index is given. Must exist. else: self._index = index_or_name status, self._name, data_type, n_values = \ _C.SDattrinfo(self._obj._id, self._index) _checkErr('set', status, 'illegal attribute index') def info(self): """Retrieve info about the attribute : name, data type and number of values. Args:: no argument Returns:: 3-element tuple holding: - attribute name - attribute data type (see constants SDC.xxx) - number of values in the attribute; for a string-valued attribute (data type SDC.CHAR8), the number of values corresponds to the string length C library equivalent : SDattrinfo """ if self._index is None: try: self._index = self._obj.findattr(self._name) except HDF4Error: raise HDF4Error("info: cannot convert name to index") status, self._name, data_type, n_values = \ _C.SDattrinfo(self._obj._id, self._index) _checkErr('info', status, 'illegal attribute index') return self._name, data_type, n_values def index(self): """Retrieve the attribute index number. Args:: no argument Returns:: attribute index number (starting at 0) C library equivalent : SDfindattr """ self._index = _C.SDfindattr(self._obj._id, self._name) _checkErr('find', self._index, 'illegal attribute name') return self._index def get(self): """Retrieve the attribute value. Args:: no argument Returns:: attribute value(s); a list is returned if the attribute is made up of more than one value, except in the case of a string-valued attribute (data type SDC.CHAR8) where the values are returned as a string C library equivalent : SDreadattr Attributes can also be read like ordinary python attributes, using the dot notation. See "High level attribute access". """ if self._index is None: try: self._index = self._obj.findattr(self._name) except HDF4Error: raise HDF4Error("get: cannot convert name to index") # Obtain attribute type and the number of values. status, self._name, data_type, n_values = \ _C.SDattrinfo(self._obj._id, self._index) _checkErr('read', status, 'illegal attribute index') # Get attribute value. convert = _array_to_ret if data_type == SDC.CHAR8: buf = _C.array_byte(n_values) convert = _array_to_str elif data_type in [SDC.UCHAR8, SDC.UINT8]: buf = _C.array_byte(n_values) elif data_type == SDC.INT8: buf = _C.array_int8(n_values) elif data_type == SDC.INT16: buf = _C.array_int16(n_values) elif data_type == SDC.UINT16: buf = _C.array_uint16(n_values) elif data_type == SDC.INT32: buf = _C.array_int32(n_values) elif data_type == SDC.UINT32: buf = _C.array_uint32(n_values) elif data_type == SDC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == SDC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("read: attribute index %d has an "\ "illegal or unupported type %d" % \ (self._index, data_type)) status = _C.SDreadattr(self._obj._id, self._index, buf) _checkErr('read', status, 'illegal attribute index') return convert(buf, n_values) def set(self, data_type, values): """Update/Create a new attribute and set its value(s). Args:: data_type : attribute data type (see constants SDC.xxx) values : attribute value(s); specify a list to create a multi-valued attribute; a string valued attribute can be created by setting 'data_type' to SDC.CHAR8 and 'values' to the corresponding string Returns:: None C library equivalent : SDsetattr Attributes can also be written like ordinary python attributes, using the dot notation. See "High level attribute access". """ try: n_values = len(values) except: n_values = 1 values = [values] if data_type == SDC.CHAR8: buf = _C.array_byte(n_values) # Allow values to be passed as a string. # Noop if a list is passed. values = list(values) for n in range(n_values): values[n] = ord(values[n]) elif data_type in [SDC.UCHAR8, SDC.UINT8]: buf = _C.array_byte(n_values) elif data_type == SDC.INT8: buf = _C.array_int8(n_values) elif data_type == SDC.INT16: buf = _C.array_int16(n_values) elif data_type == SDC.UINT16: buf = _C.array_uint16(n_values) elif data_type == SDC.INT32: buf = _C.array_int32(n_values) elif data_type == SDC.UINT32: buf = _C.array_uint32(n_values) elif data_type == SDC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == SDC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("set: illegal or unimplemented data_type") for n in range(n_values): buf[n] = values[n] status = _C.SDsetattr(self._obj._id, self._name, data_type, n_values, buf) _checkErr('set', status, 'illegal attribute') # Init index following attribute creation. self._index = _C.SDfindattr(self._obj._id, self._name) _checkErr('find', self._index, 'illegal attribute') class SD(object): """The SD class implements an HDF SD interface. To instantiate an SD class, call the SD() constructor. To set attributes on an SD instance, call the SD.attr() method to create an attribute instance, then call the methods of this instance. """ def __init__(self, path, mode=SDC.READ): """SD constructor. Initialize an SD interface on an HDF file, creating the file if necessary. Args:: path name of the HDF file on which to open the SD interface mode file opening mode; this mode is a set of binary flags which can be ored together SDC.CREATE combined with SDC.WRITE to create file if it does not exist SDC.READ open file in read-only access (default) SDC.TRUNC if combined with SDC.WRITE, overwrite file if it already exists SDC.WRITE open file in read-write mode; if file exists it is updated, unless SDC.TRUNC is set, in which case it is erased and recreated; if file does not exist, an error is raised unless SDC.CREATE is set, in which case the file is created Note an important difference in the way CREATE is handled by the C library and the pyhdf package. For the C library, CREATE indicates that a new file should always be created, overwriting an existing one if any. For pyhdf, CREATE indicates a new file should be created only if it does not exist, and the overwriting of an already existing file must be explicitly asked for by setting the TRUNC flag. Those differences were introduced so as to harmonize the way files are opened in the pycdf and pyhdf packages. Also, this solves a limitation in the hdf (and netCDF) library, where there is no easy way to implement the frequent requirement that an existent file be opened in read-write mode, or created if it does not exist. Returns:: an SD instance C library equivalent : SDstart """ # Private attributes: # _id: file id # Make sure _id is initialized in case __del__ is called # when the SD object goes out of scope after failing to # open file. Failure to do so may put python into an infinite loop # (thanks to Richard.Andrews@esands.com for reporting this bug). self._id = None # See if file exists. exists = os.path.exists(path) # We must have either WRITE or READ flag. if SDC.WRITE & mode: if exists: if SDC.TRUNC & mode: try: os.remove(path) except Exception as msg: raise HDF4Error(msg) mode = SDC.CREATE|SDC.WRITE else: mode = SDC.WRITE else: if SDC.CREATE & mode: mode |= SDC.WRITE else: raise HDF4Error("SD: no such file") elif SDC.READ & mode: if exists: mode = SDC.READ else: raise HDF4Error("SD: no such file") else: raise HDF4Error("SD: bad mode, READ or WRITE must be set") id = _C.SDstart(path, mode) _checkErr('SD', id, "cannot open %s" % path) self._id = id def __del__(self): """Delete the instance, first calling the end() method if not already done. """ try: if self._id: self.end() except: pass def __getattr__(self, name): # Get value(s) of SD attribute 'name'. return _getattr(self, name) def __setattr__(self, name, value): # Set value(s) of SD attribute 'name'. # A name starting with an underscore will be treated as # a standard python attribute, and as an HDF attribute # otherwise. _setattr(self, name, value, ['_id']) def end(self): """End access to the SD interface and close the HDF file. Args:: no argument Returns:: None The instance should not be used afterwards. The 'end()' method is implicitly called when the SD instance is deleted. C library equivalent : SDend """ status = _C.SDend(self._id) _checkErr('end', status, "cannot execute") self._id = None def info(self): """Retrieve information about the SD interface. Args:: no argument Returns:: 2-element tuple holding: number of datasets inside the file number of file attributes C library equivalent : SDfileinfo """ status, n_datasets, n_file_attrs = _C.SDfileinfo(self._id) _checkErr('info', status, "cannot execute") return n_datasets, n_file_attrs def nametoindex(self, sds_name): """Return the index number of a dataset given the dataset name. Args:: sds_name : dataset name Returns:: index number of the dataset C library equivalent : SDnametoindex """ sds_idx = _C.SDnametoindex(self._id, sds_name) _checkErr('nametoindex', sds_idx, 'non existent SDS') return sds_idx def reftoindex(self, sds_ref): """Returns the index number of a dataset given the dataset reference number. Args:: sds_ref : dataset reference number Returns:: dataset index number C library equivalent : SDreftoindex """ sds_idx = _C.SDreftoindex(self._id, sds_ref) _checkErr('reftoindex', sds_idx, 'illegal SDS ref number') return sds_idx def setfillmode(self, fill_mode): """Set the fill mode for all the datasets in the file. Args:: fill_mode : fill mode; one of : SDC.FILL write the fill value to all the datasets of the file by default SDC.NOFILL do not write fill values to all datasets of the file by default Returns:: previous fill mode value C library equivalent: SDsetfillmode """ if not fill_mode in [SDC.FILL, SDC.NOFILL]: raise HDF4Error("bad fill mode") old_mode = _C.SDsetfillmode(self._id, fill_mode) _checkErr('setfillmode', old_mode, 'cannot execute') return old_mode def create(self, name, data_type, dim_sizes): """Create a dataset. Args:: name dataset name data_type type of the data, set to one of the SDC.xxx constants; dim_sizes lengths of the dataset dimensions; a one- dimensional array is specified with an integer, an n-dimensional array with an n-element sequence of integers; the length of the first dimension can be set to SDC.UNLIMITED to create an unlimited dimension (a "record" variable). IMPORTANT: netCDF and HDF differ in the way the UNLIMITED dimension is handled. In netCDF, all variables of a dataset with an unlimited dimension grow in sync, eg adding a record to a variable will implicitly extend other record variables. In HDF, each record variable grows independently of each other. Returns:: SDS instance for the dataset C library equivalent : SDcreate """ # Validate args. if isinstance(dim_sizes, type(1)): # allow k instead of [k] # for a 1-dim arr dim_sizes = [dim_sizes] rank = len(dim_sizes) buf = _C.array_int32(rank) for n in range(rank): buf[n] = dim_sizes[n] id = _C.SDcreate(self._id, name, data_type, rank, buf) _checkErr('CREATE', id, "cannot execute") return SDS(self, id) def select(self, name_or_index): """Locate a dataset. Args:: name_or_index dataset name or index number Returns:: SDS instance for the dataset C library equivalent : SDselect """ if isinstance(name_or_index, type(1)): idx = name_or_index else: try: idx = self.nametoindex(name_or_index) except HDF4Error: raise HDF4Error("select: non-existent dataset") id = _C.SDselect(self._id, idx) _checkErr('select', id, "cannot execute") return SDS(self, id) def attr(self, name_or_index): """Create an SDAttr instance representing a global attribute (defined at the level of the SD interface). Args:: name_or_index attribute name or index number; if a name is given, the attribute may not exist; in that case, it will be created when the SDAttr instance set() method is called Returns:: SDAttr instance for the attribute. Call the methods of this class to query, read or set the attribute. C library equivalent : no equivalent """ return SDAttr(self, name_or_index) def attributes(self, full=0): """Return a dictionary describing every global attribute attached to the SD interface. Args:: full true to get complete info about each attribute false to report only each attribute value Returns:: Empty dictionary if no global attribute defined Otherwise, dictionary where each key is the name of a global attribute. If parameter 'full' is false, key value is the attribute value. If 'full' is true, key value is a tuple with the following elements: - attribute value - attribute index number - attribute type - attribute length C library equivalent : no equivalent """ # Get the number of global attributes. nsds, natts = self.info() # Inquire each attribute res = {} for n in range(natts): a = self.attr(n) name, aType, nVal = a.info() if full: res[name] = (a.get(), a.index(), aType, nVal) else: res[name] = a.get() return res def datasets(self): """Return a dictionary describing all the file datasets. Args:: no argument Returns:: Empty dictionary if no dataset is defined. Otherwise, dictionary whose keys are the file dataset names, and values are tuples describing the corresponding datasets. Each tuple holds the following elements in order: - tuple holding the names of the dimensions defining the dataset coordinate axes - tuple holding the dataset shape (dimension lengths); if a dimension is unlimited, the reported length corresponds to the dimension current length - dataset type - dataset index number C library equivalent : no equivalent """ # Get number of datasets nDs = self.info()[0] # Inquire each var res = {} for n in range(nDs): # Get dataset info. v = self.select(n) vName, vRank, vLen, vType, vAtt = v.info() if vRank < 2: # need a sequence vLen = [vLen] # Get dimension info. dimNames = [] dimLengths = [] for dimNum in range(vRank): d = v.dim(dimNum) dimNames.append(d.info()[0]) dimLengths.append(vLen[dimNum]) res[vName] = (tuple(dimNames), tuple(dimLengths), vType, n) return res class SDS(object): """The SDS class implements an HDF dataset object. To create an SDS instance, call the create() or select() methods of the SD class. To set attributes on an SDS instance, call the SDS.attr() method to create an attribute instance, then call the methods of this instance. Attributes can also be set using the "dot notation". """ def __init__(self, sd, id): """This constructor should not be called by the user program. Call the SD.create() and SD.select() methods instead. """ # Args # sd : SD instance # id : SDS identifier # Private attributes # _sd SD instance # _id SDS identifier self._sd = sd self._id = id def __del__(self): # Delete the instance, first calling the endaccess() method # if not already done. try: if self._id: self.endaccess() except: pass def __getattr__(self, name): # Get value(s) of SDS attribute 'name'. return _getattr(self, name) def __setattr__(self, name, value): # Set value(s) of SDS attribute 'name'. _setattr(self, name, value, ['_sd', '_id']) def __len__(self): # Needed for slices like "-2:" but why ? return 0 def __getitem__(self, elem): # This special method is used to index the SDS dataset # using the "extended slice syntax". The extended slice syntax # is a perfect match for the "start", "count" and "stride" # arguments to the SDreaddara() function, and is much more easy # to use. # Compute arguments to 'SDreaddata_0()'. start, count, stride = self.__buildStartCountStride(elem) # Get elements. return self.get(start, count, stride) def __setitem__(self, elem, data): # This special method is used to assign to the SDS dataset # using "extended slice syntax". The extended slice syntax # is a perfect match for the "start", "count" and "stride" # arguments to the SDwritedata() function, and is much more easy # to use. # Compute arguments to 'SDwritedata_0()'. start, count, stride = self.__buildStartCountStride(elem) # A sequence type is needed. Convert a single number to a list. if type(data) in [int, float]: data = [data] # Assign. self.set(data, start, count, stride) def endaccess(self): """Terminates access to the SDS. Args:: no argument Returns:: None. The SDS instance should not be used afterwards. The 'endaccess()' method is implicitly called when the SDS instance is deleted. C library equivalent : SDendaccess """ status = _C.SDendaccess(self._id) _checkErr('endaccess', status, "cannot execute") self._id = None # Invalidate identifier def dim(self, dim_index): """Get an SDim instance given a dimension index number. Args:: dim_index index number of the dimension (numbering starts at 0) C library equivalent : SDgetdimid """ id = _C.SDgetdimid(self._id, dim_index) _checkErr('dim', id, 'invalid SDS identifier or dimension index') return SDim(self, id, dim_index) def get(self, start=None, count=None, stride=None): """Read data from the dataset. Args:: start : indices where to start reading in the data array; default to 0 on all dimensions count : number of values to read along each dimension; default to the current length of all dimensions stride : sampling interval along each dimension; default to 1 on all dimensions For n-dimensional datasets, those 3 parameters are entered using lists. For one-dimensional datasets, integers can also be used. Note that, to read the whole dataset contents, one should simply call the method with no argument. Returns:: numpy array initialized with the data. C library equivalent : SDreaddata The dataset can also be read using the familiar indexing and slicing notation, like ordinary python sequences. See "High level variable access". """ # Obtain SDS info. try: sds_name, rank, dim_sizes, data_type, n_attrs = self.info() if isinstance(dim_sizes, type(1)): dim_sizes = [dim_sizes] except HDF4Error: raise HDF4Error('get : cannot execute') # Validate args. if start is None: start = [0] * rank elif isinstance(start, type(1)): start = [start] if count is None: count = dim_sizes if count[0] == 0: count[0] = 1 elif isinstance(count, type(1)): count = [count] if stride is None: stride = [1] * rank elif isinstance(stride, type(1)): stride = [stride] if len(start) != rank or len(count) != rank or len(stride) != rank: raise HDF4Error('get : start, stride or count ' \ 'do not match SDS rank') for n in range(rank): if start[n] < 0 or start[n] + \ (abs(count[n]) - 1) * stride[n] >= dim_sizes[n]: raise HDF4Error('get arguments violate ' \ 'the size (%d) of dimension %d' \ % (dim_sizes[n], n)) if not data_type in SDC.equivNumericTypes: raise HDF4Error('get cannot currently deal with '\ 'the SDS data type') return _C._SDreaddata_0(self._id, data_type, start, count, stride) def set(self, data, start=None, count=None, stride=None): """Write data to the dataset. Args:: data : array of data to write; can be given as a numpy array, or as Python sequence (whose elements can be imbricated sequences) start : indices where to start writing in the dataset; default to 0 on all dimensions count : number of values to write along each dimension; default to the current length of dataset dimensions stride : sampling interval along each dimension; default to 1 on all dimensions For n-dimensional datasets, those 3 parameters are entered using lists. For one-dimensional datasets, integers can also be used. Note that, to write the whole dataset at once, one has simply to call the method with the dataset values in parameter 'data', omitting all other parameters. Returns:: None. C library equivalent : SDwritedata The dataset can also be written using the familiar indexing and slicing notation, like ordinary python sequences. See "High level variable access". """ # Obtain SDS info. try: sds_name, rank, dim_sizes, data_type, n_attrs = self.info() if isinstance(dim_sizes, type(1)): dim_sizes = [dim_sizes] except HDF4Error: raise HDF4Error('set : cannot execute') # Validate args. if start is None: start = [0] * rank elif isinstance(start, type(1)): start = [start] if count is None: count = dim_sizes if count[0] == 0: count[0] = 1 elif isinstance(count, type(1)): count = [count] if stride is None: stride = [1] * rank elif isinstance(stride, type(1)): stride = [stride] if len(start) != rank or len(count) != rank or len(stride) != rank: raise HDF4Error('set : start, stride or count '\ 'do not match SDS rank') unlimited = self.isrecord() for n in range(rank): ok = 1 if start[n] < 0: ok = 0 elif n > 0 or not unlimited: if start[n] + (abs(count[n]) - 1) * stride[n] >= dim_sizes[n]: ok = 0 if not ok: raise HDF4Error('set arguments violate '\ 'the size (%d) of dimension %d' \ % (dim_sizes[n], n)) # ??? Check support for UINT16 if not data_type in SDC.equivNumericTypes: raise HDF4Error('set cannot currently deal '\ 'with the SDS data type') _C._SDwritedata_0(self._id, data_type, start, count, data, stride) def __buildStartCountStride(self, elem): # Create the 'start', 'count', 'slice' and 'stride' tuples that # will be passed to '_SDreaddata_0'/'_SDwritedata_0'. # start starting indices along each dimension # count count of values along each dimension; a value of -1 # indicates that and index, not a slice, was applied to # the dimension; in that case, the dimension should be # dropped from the output array. # stride strides along each dimension # Make sure the indexing expression does not exceed the variable # number of dimensions. dsName, nDims, shape, dsType, nAttr = self.info() if isinstance(elem, tuple): if len(elem) > nDims: raise HDF4Error("get", 0, "indexing expression exceeds variable " "number of dimensions") else: # Convert single index to sequence elem = [elem] if isinstance(shape, int): shape = [shape] start = [] count = [] stride = [] n = -1 unlimited = self.isrecord() for e in elem: n += 1 # See if the dimension is unlimited (always at index 0) unlim = n == 0 and unlimited # Simple index if isinstance(e, int): isslice = False if e < 0 : e += shape[n] # Respect standard python list behavior: it is illegal to # specify an out of bound index (except for the # unlimited dimension). if e < 0 or (not unlim and e >= shape[n]): raise IndexError("index out of range") beg = e end = e + 1 inc = 1 # Slice index. Respect Python syntax for slice upper bounds, # which are not included in the resulting slice. Also, if the # upper bound exceed the dimension size, truncate it. elif isinstance(e, slice): isslice = True # None or 0 means not specified if e.start: beg = e.start if beg < 0: beg += shape[n] else: beg = 0 # None of maxint means not specified if e.stop and e.stop != sys.maxsize: end = e.stop if end < 0: end += shape[n] else: end = shape[n] # None means not specified if e.step: inc = e.step else: inc = 1 # Bug else: raise ValueError("Bug: unexpected element type to __getitem__") # Clip end index (except if unlimited dimension) # and compute number of elements to get. if not unlim and end > shape[n]: end = shape[n] if isslice: cnt = (end - beg) // inc if cnt * inc < end - beg: cnt += 1 else: cnt = -1 start.append(beg) count.append(cnt) stride.append(inc) # Complete missing dimensions while n < nDims - 1: n += 1 start.append(0) count.append(shape[n]) stride.append(1) # Done return start, count, stride def info(self): """Retrieves information about the dataset. Args:: no argument Returns:: 5-element tuple holding: - dataset name - dataset rank (number of dimensions) - dataset shape, that is a list giving the length of each dataset dimension; if the first dimension is unlimited, then the first value of the list gives the current length of the unlimited dimension - data type (one of the SDC.xxx values) - number of attributes defined for the dataset C library equivalent : SDgetinfo """ buf = _C.array_int32(_C.H4_MAX_VAR_DIMS) status, sds_name, rank, data_type, n_attrs = \ _C.SDgetinfo(self._id, buf) _checkErr('info', status, "cannot execute") dim_sizes = _array_to_ret(buf, rank) return sds_name, rank, dim_sizes, data_type, n_attrs def checkempty(self): """Determine whether the dataset is empty. Args:: no argument Returns:: True(1) if dataset is empty, False(0) if not C library equivalent : SDcheckempty """ status, emptySDS = _C.SDcheckempty(self._id) _checkErr('checkempty', status, 'invalid SDS identifier') return emptySDS def ref(self): """Get the reference number of the dataset. Args:: no argument Returns:: dataset reference number C library equivalent : SDidtoref """ sds_ref = _C.SDidtoref(self._id) _checkErr('idtoref', sds_ref, 'illegal SDS identifier') return sds_ref def iscoordvar(self): """Determine whether the dataset is a coordinate variable (holds a dimension scale). A coordinate variable is created when a dimension is assigned a set of scale values. Args:: no argument Returns:: True(1) if the dataset represents a coordinate variable, False(0) if not C library equivalent : SDiscoordvar """ return _C.SDiscoordvar(self._id) # no error status here def isrecord(self): """Determines whether the dataset is appendable (contains an unlimited dimension). Note that if true, then the unlimited dimension is always dimension number 0. Args:: no argument Returns:: True(1) if the dataset is appendable, False(0) if not. C library equivalent : SDisrecord """ return _C.SDisrecord(self._id) # no error status here def getcal(self): """Retrieve the SDS calibration coefficients. Args:: no argument Returns:: 5-element tuple holding: - cal: calibration factor (attribute 'scale_factor') - cal_error : calibration factor error (attribute 'scale_factor_err') - offset: calibration offset (attribute 'add_offset') - offset_err : offset error (attribute 'add_offset_err') - data_type : type of the data resulting from applying the calibration formula to the dataset values (attribute 'calibrated_nt') An exception is raised if no calibration data are defined. Original dataset values 'orival' are converted to calibrated values 'calval' through the formula:: calval = cal * (orival - offset) The calibration coefficients are part of the so-called "standard" SDS attributes. The values inside the tuple returned by 'getcal' are those of the following attributes, in order:: scale_factor, scale_factor_err, add_offset, add_offset_err, calibrated_nt C library equivalent: SDgetcal() """ status, cal, cal_error, offset, offset_err, data_type = \ _C.SDgetcal(self._id) _checkErr('getcal', status, 'no calibration record') return cal, cal_error, offset, offset_err, data_type def getdatastrs(self): """Retrieve the dataset standard string attributes. Args:: no argument Returns:: 4-element tuple holding: - dataset label string (attribute 'long_name') - dataset unit (attribute 'units') - dataset output format (attribute 'format') - dataset coordinate system (attribute 'coordsys') The values returned by 'getdatastrs' are part of the so-called "standard" SDS attributes. Those 4 values correspond respectively to the following attributes:: long_name, units, format, coordsys . C library equivalent: SDgetdatastrs """ status, label, unit, format, coord_system = \ _C.SDgetdatastrs(self._id, 128) _checkErr('getdatastrs', status, 'cannot execute') return label, unit, format, coord_system def getfillvalue(self): """Retrieve the dataset fill value. Args:: no argument Returns:: dataset fill value (attribute '_FillValue') An exception is raised if the fill value is not set. The fill value is part of the so-called "standard" SDS attributes, and corresponds to the following attribute:: _FillValue C library equivalent: SDgetfillvalue """ # Obtain SDS data type. try: sds_name, rank, dim_sizes, data_type, n_attrs = \ self.info() except HDF4Error: raise HDF4Error('getfillvalue : invalid SDS identifier') n_values = 1 # Fill value stands for 1 value. convert = _array_to_ret if data_type == SDC.CHAR8: buf = _C.array_byte(n_values) convert = _array_to_str elif data_type in [SDC.UCHAR8, SDC.UINT8]: buf = _C.array_byte(n_values) elif data_type == SDC.INT8: buf = _C.array_int8(n_values) elif data_type == SDC.INT16: buf = _C.array_int16(n_values) elif data_type == SDC.UINT16: buf = _C.array_uint16(n_values) elif data_type == SDC.INT32: buf = _C.array_int32(n_values) elif data_type == SDC.UINT32: buf = _C.array_uint32(n_values) elif data_type == SDC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == SDC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("getfillvalue: SDS has an illegal type or " \ "unsupported type %d" % data_type) status = _C.SDgetfillvalue(self._id, buf) _checkErr('getfillvalue', status, 'fill value not set') return convert(buf, n_values) def getrange(self): """Retrieve the dataset min and max values. Args:: no argument Returns:: (min, max) tuple (attribute 'valid_range') Note that those are the values as stored by the 'setrange' method. 'getrange' does *NOT* compute the min and max from the current dataset contents. An exception is raised if the range is not set. The range returned by 'getrange' is part of the so-called "standard" SDS attributes. It corresponds to the following attribute:: valid_range C library equivalent: SDgetrange """ # Obtain SDS data type. try: sds_name, rank, dim_sizes, data_type, n_attrs = \ self.info() except HDF4Error: raise HDF4Error('getrange : invalid SDS identifier') n_values = 1 convert = _array_to_ret if data_type == SDC.CHAR8: buf1 = _C.array_byte(n_values) buf2 = _C.array_byte(n_values) convert = _array_to_str elif data_type in [SDC.UCHAR8, SDC.UINT8]: buf1 = _C.array_byte(n_values) buf2 = _C.array_byte(n_values) elif data_type == SDC.INT8: buf1 = _C.array_int8(n_values) buf2 = _C.array_int8(n_values) elif data_type == SDC.INT16: buf1 = _C.array_int16(n_values) buf2 = _C.array_int16(n_values) elif data_type == SDC.UINT16: buf1 = _C.array_uint16(n_values) buf2 = _C.array_uint16(n_values) elif data_type == SDC.INT32: buf1 = _C.array_int32(n_values) buf2 = _C.array_int32(n_values) elif data_type == SDC.UINT32: buf1 = _C.array_uint32(n_values) buf2 = _C.array_uint32(n_values) elif data_type == SDC.FLOAT32: buf1 = _C.array_float32(n_values) buf2 = _C.array_float32(n_values) elif data_type == SDC.FLOAT64: buf1 = _C.array_float64(n_values) buf2 = _C.array_float64(n_values) else: raise HDF4Error("getrange: SDS has an illegal or " \ "unsupported type %d" % data) # Note: The C routine returns the max in buf1 and the min # in buf2. We swap the values returned by the Python # interface, since it is more natural to return # min first, then max. status = _C.SDgetrange(self._id, buf1, buf2) _checkErr('getrange', status, 'range not set') return convert(buf2, n_values), convert(buf1, n_values) def setcal(self, cal, cal_error, offset, offset_err, data_type): """Set the dataset calibration coefficients. Args:: cal the calibraton factor (attribute 'scale_factor') cal_error calibration factor error (attribute 'scale_factor_err') offset offset value (attribute 'add_offset') offset_err offset error (attribute 'add_offset_err') data_type data type of the values resulting from applying the calibration formula to the dataset values (one of the SDC.xxx constants) (attribute 'calibrated_nt') Returns:: None See method 'getcal' for the definition of the calibration formula. Calibration coefficients are part of the so-called standard SDS attributes. Calling 'setcal' is equivalent to setting the following attributes, which correspond to the method parameters, in order:: scale_factor, scale_factor_err, add_offset, add_offset_err, calibrated_nt C library equivalent: SDsetcal """ status = _C.SDsetcal(self._id, cal, cal_error, offset, offset_err, data_type) _checkErr('setcal', status, 'cannot execute') def setdatastrs(self, label, unit, format, coord_sys): """Set the dataset standard string type attributes. Args:: label dataset label (attribute 'long_name') unit dataset unit (attribute 'units') format dataset format (attribute 'format') coord_sys dataset coordinate system (attribute 'coordsys') Returns:: None Those strings are part of the so-called standard SDS attributes. Calling 'setdatastrs' is equivalent to setting the following attributes, which correspond to the method parameters, in order:: long_name, units, format, coordsys C library equivalent: SDsetdatastrs """ status = _C.SDsetdatastrs(self._id, label, unit, format, coord_sys) _checkErr('setdatastrs', status, 'cannot execute') def setfillvalue(self, fill_val): """Set the dataset fill value. Args:: fill_val dataset fill value (attribute '_FillValue') Returns:: None The fill value is part of the so-called "standard" SDS attributes. Calling 'setfillvalue' is equivalent to setting the following attribute:: _FillValue C library equivalent: SDsetfillvalue """ # Obtain SDS data type. try: sds_name, rank, dim_sizes, data_type, n_attrs = self.info() except HDF4Error: raise HDF4Error('setfillvalue : cannot execute') n_values = 1 # Fill value stands for 1 value. if data_type == SDC.CHAR8: buf = _C.array_byte(n_values) elif data_type in [SDC.UCHAR8, SDC.UINT8]: buf = _C.array_byte(n_values) elif data_type == SDC.INT8: buf = _C.array_int8(n_values) elif data_type == SDC.INT16: buf = _C.array_int16(n_values) elif data_type == SDC.UINT16: buf = _C.array_uint16(n_values) elif data_type == SDC.INT32: buf = _C.array_int32(n_values) elif data_type == SDC.UINT32: buf = _C.array_uint32(n_values) elif data_type == SDC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == SDC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("setfillvalue: SDS has an illegal or " \ "unsupported type %d" % data_type) buf[0] = fill_val status = _C.SDsetfillvalue(self._id, buf) _checkErr('setfillvalue', status, 'cannot execute') def setrange(self, min, max): """Set the dataset min and max values. Args:: min dataset minimum value (attribute 'valid_range') max dataset maximum value (attribute 'valid_range') Returns:: None The data range is part of the so-called "standard" SDS attributes. Calling method 'setrange' is equivalent to setting the following attribute with a 2-element [min,max] array:: valid_range C library equivalent: SDsetrange """ # Obtain SDS data type. try: sds_name, rank, dim_sizes, data_type, n_attrs = self.info() except HDF4Error: raise HDF4Error('setrange : cannot execute') n_values = 1 if data_type == SDC.CHAR8: buf1 = _C.array_byte(n_values) buf2 = _C.array_byte(n_values) elif data_type in [SDC.UCHAR8, SDC.UINT8]: buf1 = _C.array_byte(n_values) buf2 = _C.array_byte(n_values) elif data_type == SDC.INT8: buf1 = _C.array_int8(n_values) buf2 = _C.array_int8(n_values) elif data_type == SDC.INT16: buf1 = _C.array_int16(n_values) buf2 = _C.array_int16(n_values) elif data_type == SDC.UINT16: buf1 = _C.array_uint16(n_values) buf2 = _C.array_uint16(n_values) elif data_type == SDC.INT32: buf1 = _C.array_int32(n_values) buf2 = _C.array_int32(n_values) elif data_type == SDC.UINT32: buf1 = _C.array_uint32(n_values) buf2 = _C.array_uint32(n_values) elif data_type == SDC.FLOAT32: buf1 = _C.array_float32(n_values) buf2 = _C.array_float32(n_values) elif data_type == SDC.FLOAT64: buf1 = _C.array_float64(n_values) buf2 = _C.array_float64(n_values) else: raise HDF4Error("SDsetrange: SDS has an illegal or " \ "unsupported type %d" % data_type) buf1[0] = max buf2[0] = min status = _C.SDsetrange(self._id, buf1, buf2) _checkErr('setrange', status, 'cannot execute') def getcompress(self): """Retrieves info about dataset compression type and mode. Args:: no argument Returns:: tuple holding: - compression type (one of the SDC.COMP_xxx constants) - optional values, depending on the compression type COMP_NONE 0 value no additional value COMP_SKPHUFF 1 value : skip size COMP_DEFLATE 1 value : gzip compression level (1 to 9) COMP_SZIP 5 values : options mask, pixels per block (2 to 32) pixels per scanline, bits per pixel (number of bits in the SDS datatype) pixels (number of elements in the SDS) Note: in the context of an SDS, the word "pixel" should really be understood as meaning "data element", eg a cell value inside a multidimensional grid. Test the options mask against constants SDC.COMP_SZIP_NN and SDC.COMP_SZIP_EC, eg : if optionMask & SDC.COMP_SZIP_EC: print "EC encoding scheme used" An exception is raised if dataset is not compressed. .. note:: Starting with v0.8, an exception is always raised if pyhdf was installed with the NOCOMPRESS macro set. C library equivalent: SDgetcompress """ status, comp_type, value, v2, v3, v4, v5 = _C._SDgetcompress(self._id) _checkErr('getcompress', status, 'no compression') if comp_type == SDC.COMP_NONE: return (comp_type,) elif comp_type == SDC.COMP_SZIP: return comp_type, value, v2, v3, v4, v5 else: return comp_type, value def setcompress(self, comp_type, value=0, v2=0): """Compresses the dataset using a specified compression method. Args:: comp_type compression type, identified by one of the SDC.COMP_xxx constants value,v2 auxiliary value(s) needed by some compression types SDC.COMP_SKPHUFF Skipping-Huffman; compression value=data size in bytes, v2 is ignored SDC.COMP_DEFLATE Gzip compression; value=deflate level (1 to 9), v2 is ignored SDC.COMP_SZIP Szip compression; value=encoding scheme (SDC.COMP_SZIP_EC or SDC.COMP_SZIP_NN), v2=pixels per block (2 to 32) Returns:: None .. note:: Starting with v0.8, an exception is always raised if pyhdf was installed with the NOCOMPRESS macro set. SDC.COMP_DEFLATE applies the GZIP compression to the dataset, and the value varies from 1 to 9, according to the level of compression desired. SDC.COMP_SZIP compresses the dataset using the SZIP algorithm. See the HDF User's Guide for details about the encoding scheme and the number of pixels per block. SZIP is new with HDF 4.2. 'setcompress' must be called before writing to the dataset. The dataset must be written all at once, unless it is appendable (has an unlimited dimension). Updating the dataset in not allowed. Refer to the HDF user's guide for more details on how to use data compression. C library equivalent: SDsetcompress """ status = _C._SDsetcompress(self._id, comp_type, value, v2) _checkErr('setcompress', status, 'cannot execute') def setexternalfile(self, filename, offset=0): """Store the dataset data in an external file. Args:: filename external file name offset offset in bytes where to start writing in the external file Returns:: None C library equivalent : SDsetexternalfile """ status = _C.SDsetexternalfile(self._id, filename, offset) _checkErr('setexternalfile', status, 'execution error') def attr(self, name_or_index): """Create an SDAttr instance representing an SDS (dataset) attribute. Args:: name_or_index attribute name or index number; if a name is given, the attribute may not exist Returns:: SDAttr instance for the attribute. Call the methods of this class to query, read or set the attribute. C library equivalent : no equivalent """ return SDAttr(self, name_or_index) def attributes(self, full=0): """Return a dictionary describing every attribute defined on the dataset. Args:: full true to get complete info about each attribute false to report only each attribute value Returns:: Empty dictionary if no attribute defined. Otherwise, dictionary where each key is the name of a dataset attribute. If parameter 'full' is false, key value is the attribute value. If 'full' is true, key value is a tuple with the following elements: - attribute value - attribute index number - attribute type - attribute length C library equivalent : no equivalent """ # Get the number of dataset attributes. natts = self.info()[4] # Inquire each attribute res = {} for n in range(natts): a = self.attr(n) name, aType, nVal = a.info() if full: res[name] = (a.get(), a.index(), aType, nVal) else: res[name] = a.get() return res def dimensions(self, full=0): """Return a dictionary describing every dataset dimension. Args:: full true to get complete info about each dimension false to report only each dimension length Returns:: Dictionary where each key is a dimension name. If no name has been given to the dimension, the key is set to 'fakeDimx' where 'x' is the dimension index number. If parameter 'full' is false, key value is the dimension length. If 'full' is true, key value is a 5-element tuple with the following elements: - dimension length; for an unlimited dimension, the reported length is the current dimension length - dimension index number - 1 if the dimension is unlimited, 0 otherwise - dimension scale type, or 0 if no scale is defined for the dimension - number of attributes defined on the dimension C library equivalent : no equivalent """ # Get the number of dimensions and their lengths. nDims, dimLen = self.info()[1:3] if isinstance(dimLen, int): # need a sequence dimLen = [dimLen] # Check if the dataset is appendable. unlim = self.isrecord() # Inquire each dimension res = {} for n in range(nDims): d = self.dim(n) # The length reported by info() is 0 for an unlimited dimension. # Rather use the lengths reported by SDS.info() name, k, scaleType, nAtt = d.info() length = dimLen[n] if full: res[name] = (length, n, unlim and n == 0, scaleType, nAtt) else: res[name] = length return res class SDim(object): """The SDim class implements a dimension object. There can be one dimension object for each dataset dimension. To create an SDim instance, call the dim() method of an SDS class instance. To set attributes on an SDim instance, call the SDim.attr() method to create an attribute instance, then call the methods of this instance. Attributes can also be set using the "dot notation". """ def __init__(self, sds, id, index): """Init an SDim instance. This method should not be called directly by the user program. To create an SDim instance, call the SDS.dim() method. """ # Args: # sds SDS instance # id dimension identifier # index index number of the dimension # SDim private attributes # _sds sds instance # _id dimension identifier # _index dimension index number self._sds = sds self._id = id self._index = index def __getattr__(self, name): # Get value(s) of SDim attribute 'name'. return _getattr(self, name) def __setattr__(self, name, value): # Set value(s) of SDim attribute 'name'. _setattr(self, name, value, ['_sds', '_id', '_index']) def info(self): """Return info about the dimension instance. Args:: no argument Returns:: 4-element tuple holding: - dimension name; 'fakeDimx' is returned if the dimension has not been named yet, where 'x' is the dimension index number - dimension length; 0 is returned if the dimension is unlimited; call the SDim.length() or SDS.info() methods to obtain the current dimension length - scale data type (one of the SDC.xxx constants); 0 is returned if no scale has been set on the dimension - number of attributes attached to the dimension C library equivalent : SDdiminfo """ status, dim_name, dim_size, data_type, n_attrs = \ _C.SDdiminfo(self._id) _checkErr('info', status, 'cannot execute') return dim_name, dim_size, data_type, n_attrs def length(self): """Return the dimension length. This method is useful to quickly retrieve the current length of an unlimited dimension. Args:: no argument Returns:: dimension length; if the dimension is unlimited, the returned value is the current dimension length C library equivalent : no equivalent """ return self._sds.info()[2][self._index] def setname(self, dim_name): """Set the dimension name. Args:: dim_name dimension name; setting 2 dimensions to the same name make the dimensions "shared"; in order to be shared, the dimensions must be defined similarly. Returns:: None C library equivalent : SDsetdimname """ status = _C.SDsetdimname(self._id, dim_name) _checkErr('setname', status, 'cannot execute') def getscale(self): """Obtain the scale values along a dimension. Args:: no argument Returns:: list with the scale values; the list length is equal to the dimension length; the element type is equal to the dimension data type, as set when the 'setdimscale()' method was called. C library equivalent : SDgetdimscale """ # Get dimension info. If data_type is 0, no scale have been set # on the dimension. status, dim_name, dim_size, data_type, n_attrs = _C.SDdiminfo(self._id) _checkErr('getscale', status, 'cannot execute') if data_type == 0: raise HDF4Error("no scale set on that dimension") # dim_size is 0 for an unlimited dimension. The actual length is # obtained through SDgetinfo. if dim_size == 0: dim_size = self._sds.info()[2][self._index] # Get scale values. if data_type in [SDC.UCHAR8, SDC.UINT8]: buf = _C.array_byte(dim_size) elif data_type == SDC.INT8: buf = _C.array_int8(dim_size) elif data_type == SDC.INT16: buf = _C.array_int16(dim_size) elif data_type == SDC.UINT16: buf = _C.array_uint16(dim_size) elif data_type == SDC.INT32: buf = _C.array_int32(dim_size) elif data_type == SDC.UINT32: buf = _C.array_uint32(dim_size) elif data_type == SDC.FLOAT32: buf = _C.array_float32(dim_size) elif data_type == SDC.FLOAT64: buf = _C.array_float64(dim_size) else: raise HDF4Error("getscale: dimension has an "\ "illegal or unsupported type %d" % data_type) status = _C.SDgetdimscale(self._id, buf) _checkErr('getscale', status, 'cannot execute') return _array_to_ret(buf, dim_size) def setscale(self, data_type, scale): """Initialize the scale values along the dimension. Args:: data_type data type code (one of the SDC.xxx constants) scale sequence holding the scale values; the number of values must match the current length of the dataset along that dimension C library equivalent : SDsetdimscale Setting a scale on a dimension generates what HDF calls a "coordinate variable". This is a rank 1 dataset similar to any other dataset, which is created to hold the scale values. The dataset name is identical to that of the dimension on which setscale() is called, and the data type passed in 'data_type' determines the type of the dataset. To distinguish between such a dataset and a "normal" dataset, call the iscoordvar() method of the dataset instance. """ try: n_values = len(scale) except: n_values = 1 # Validate args info = self._sds.info() if info[1] == 1: dim_size = info[2] else: dim_size = info[2][self._index] if n_values != dim_size: raise HDF4Error('number of scale values (%d) does not match ' \ 'dimension size (%d)' % (n_values, dim_size)) if data_type == SDC.CHAR8: buf = _C.array_byte(n_values) # Allow a string as the scale argument. # Becomes a noop if already a list. scale = list(scale) for n in range(n_values): scale[n] = ord(scale[n]) elif data_type in [SDC.UCHAR8, SDC.UINT8]: buf = _C.array_byte(n_values) elif data_type == SDC.INT8: buf = _C.array_int8(n_values) elif data_type == SDC.INT16: buf = _C.array_int16(n_values) elif data_type == SDC.UINT16: buf = _C.array_uint16(n_values) elif data_type == SDC.INT32: buf = _C.array_int32(n_values) elif data_type == SDC.UINT32: buf = _C.array_uint32(n_values) elif data_type == SDC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == SDC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("setscale: illegal or usupported data_type") if n_values == 1: buf[0] = scale else: for n in range(n_values): buf[n] = scale[n] status = _C.SDsetdimscale(self._id, n_values, data_type, buf) _checkErr('setscale', status, 'cannot execute') def getstrs(self): """Retrieve the dimension standard string attributes. Args:: no argument Returns:: 3-element tuple holding: -dimension label (attribute 'long_name') -dimension unit (attribute 'units') -dimension format (attribute 'format') An exception is raised if the standard attributes have not been set. C library equivalent: SDgetdimstrs """ status, label, unit, format = _C.SDgetdimstrs(self._id, 128) _checkErr('getstrs', status, 'cannot execute') return label, unit, format def setstrs(self, label, unit, format): """Set the dimension standard string attributes. Args:: label dimension label (attribute 'long_name') unit dimension unit (attribute 'units') format dimension format (attribute 'format') Returns:: None C library equivalent: SDsetdimstrs """ status = _C.SDsetdimstrs(self._id, label, unit, format) _checkErr('setstrs', status, 'cannot execute') def attr(self, name_or_index): """Create an SDAttr instance representing an SDim (dimension) attribute. Args:: name_or_index attribute name or index number; if a name is given, the attribute may not exist; in that case, the attribute is created when the instance set() method is called Returns:: SDAttr instance for the attribute. Call the methods of this class to query, read or set the attribute. C library equivalent : no equivalent """ return SDAttr(self, name_or_index) def attributes(self, full=0): """Return a dictionary describing every attribute defined on the dimension. Args:: full true to get complete info about each attribute false to report only each attribute value Returns:: Empty dictionary if no attribute defined. Otherwise, dictionary where each key is the name of a dimension attribute. If parameter 'full' is false, key value is the attribute value. If 'full' is true, key value is a tuple with the following elements: - attribute value - attribute index number - attribute type - attribute length C library equivalent : no equivalent """ # Get the number of dataset attributes. natts = self.info()[3] # Inquire each attribute res = {} for n in range(natts): a = self.attr(n) name, aType, nVal = a.info() if full: res[name] = (a.get(), a.index(), aType, nVal) else: res[name] = a.get() return res ########################### # Support functions ########################### def _getattr(obj, name): # Called by the __getattr__ method of the SD, SDS and SDim objects. # Python will call __getattr__ to see if the class wants to # define certain missing methods (__str__, __len__, etc). # Always fail if the name starts with two underscores. if name[:2] == '__': raise AttributeError # See if we deal with an SD attribute. a = SDAttr(obj, name) try: index = a.index() except HDF4Error: raise AttributeError("attribute not found") # Return attribute value(s). return a.get() def _setattr(obj, name, value, privAttr): # Called by the __setattr__ method of the SD, SDS and SDim objects. # Be careful with private attributes. #if name in privAttr: if name[0] == '_': obj.__dict__[name] = value return # Treat everything else as an HDF attribute. if type(value) not in [list, tuple]: value = [value] typeList = [] for v in value: t = type(v) # Prohibit mixing numeric types and strings. if t in [int, float] and \ not str in typeList: if t not in typeList: typeList.append(t) # Prohibit sequence of strings or a mix of numbers and string. elif t == str and not typeList: typeList.append(t) else: typeList = [] break if str in typeList: xtype = SDC.CHAR8 value = value[0] # double is "stronger" than int elif float in typeList: xtype = SDC.FLOAT64 elif int in typeList: xtype = SDC.INT32 else: raise HDF4Error("Illegal attribute value") # Assign value try: a = SDAttr(obj, name) a.set(xtype, value) except HDF4Error as msg: raise HDF4Error("cannot set attribute: %s" % msg) def _array_to_ret(buf, nValues): # Convert array 'buf' to a scalar or a list. if nValues == 1: ret = buf[0] else: ret = [] for i in xrange(nValues): ret.append(buf[i]) return ret def _array_to_str(buf, nValues): # Convert array of bytes 'buf' to a string. # Return empty string if there is no value. if nValues == 0: return "" # When there is just one value, _array_to_ret returns a scalar # over which we cannot iterate. if nValues == 1: chrs = [chr(buf[0])] else: chrs = [chr(b) for b in _array_to_ret(buf, nValues)] return ''.join(chrs) pyhdf-0.10.3/pyhdf/V.py000066400000000000000000001507271405105412500146070ustar00rootroot00000000000000# $Id: V.py,v 1.2 2005-07-14 01:36:41 gosselin_a Exp $ # $Log: not supported by cvs2svn $ # Revision 1.1 2004/08/02 15:36:04 gosselin # Initial revision # # Author: Andre Gosselin # Maurice-Lamontagne Institute # gosselina@dfo-mpo.gc.ca """ V (Vgroup) API (:mod:`pyhdf.V`) =============================== A module of the pyhdf package implementing the V (Vgroup) API of the NCSA HDF4 library. Introduction ------------ V is one of the modules composing pyhdf, a python package implementing the NCSA HDF library and letting one manage HDF files from within a python program. Two versions of the HDF library currently exist, version 4 and version 5. pyhdf only implements version 4 of the library. Many different APIs are to be found inside the HDF4 specification. Currently, pyhdf implements just a few of those: the SD, VS and V APIs. Other APIs should be added in the future (GR, AN, etc). The V API supports the definition of vgroups inside an HDF file. A vgroup can thought of as a collection of arbitrary "references" to other HDF objects defined in the same file. A vgroup may hold references to other vgroups. It is thus possible to organize HDF objects into some sort of a hierarchy, similar to files grouped into a directory tree under unix. This vgroup hierarchical nature partly explains the origin of the "HDF" name (Hierarchical Data Format). vgroups can help logically organize the contents of an HDF file, for example by grouping together all the datasets belonging to a given experiment, and subdividing those datasets according to the day of the experiment, etc. The V API provides functions to find and access an existing vgroup, create a new one, delete a vgroup, identify the members of a vgroup, add and remove members to and from a vgroup, and set and query attributes on a vgroup. The members of a vgroup are identified through their tags and reference numbers. Tags are constants identifying each main object type (dataset, vdata, vgroup). Reference numbers serve to distinguish among objects of the same type. To add an object to a vgroup, one must first initialize that object using the API proper to that object type (eg: SD for a dataset) so as to create a reference number for that object, and then pass this reference number and the type tag to the V API. When reading the contents of a vgroup, the V API returns the tags and reference numbers of the objects composing the vgroup. The user program must then call the proper API to process each object, based on tag of this object (eg: VS for a tag identifying a vdata object). Some limitations of the V API must be stressed. First, HDF imposes no integrity constraint whatsoever on the contents of a vgroup, nor does it help maintain such integrity. For example, a vgroup is not strictly hierarchical, because an object can belong to more than one vgroup. It would be easy to create vgroups showing cycles among their members. Also, a vgroup member is simply a reference to an HDF object. If this object is afterwards deleted for any reason, the vgroup membership will not be automatically updated. The vgroup will refer to a non-existent object and thus be left in an inconsistent state. Nothing prevents adding the same member more than once to a vgroup, and giving the same name to more than one vgroup. Finally, the HDF library seems to make heavy use of vgroups for its own internal needs, and creates vgroups "behind the scenes". This may make it difficult to pick up "user defined" vgroups when browsing an HDF file. Accessing the V module ----------------------- To access the V module a python program can say one of: >>> import pyhdf.V # must prefix names with "pyhdf.V." >>> from pyhdf import V # must prefix names with "V." >>> from pyhdf.V import * # names need no prefix This document assumes the last import style is used. V is not self-contained, and needs functionality provided by another pyhdf module, namely the HDF module. This module must thus be imported also: >>> from .HDF import * Package components ------------------ pyhdf is a proper Python package, eg a collection of modules stored under a directory whose name is that of the package and which stores an __init__.py file. Following the normal installation procedure, this directory will be /site-packages/pyhdf', where stands for the python installation directory. For each HDF API exists a corresponding set of modules. The following modules are related to the V API. _hdfext C extension module responsible for wrapping the HDF C library for all python modules hdfext python module implementing some utility functions complementing the _hdfext extension module error defines the HDF4Error exception HDF python module providing support to the V module V python module wrapping the V API routines inside an OOP framework _hdfext and hdfext were generated using the SWIG preprocessor. SWIG is however *not* needed to run the package. Those two modules are meant to do their work in the background, and should never be called directly. Only HDF and V should be imported by the user program. Prerequisites ------------- The following software must be installed in order for the V module to work. HDF (v4) library pyhdf does *not* include the HDF4 library, which must be installed separately. HDF is available at: "https://portal.hdfgroup.org/display/support/Download+HDF4". Numeric is also needed by the SD module. See the SD module documentation. Summary of differences between the pyhdf and C V API ----------------------------------------------------- Most of the differences between the pyhdf and C V API can be summarized as follows. -In the C API, every function returns an integer status code, and values computed by the function are returned through one or more pointers passed as arguments. -In pyhdf, error statuses are returned through the Python exception mechanism, and values are returned as the method result. When the C API specifies that multiple values are returned, pyhdf returns a sequence of values, which are ordered similarly to the pointers in the C function argument list. Error handling -------------- All errors reported by the C V API with a SUCCESS/FAIL error code are reported by pyhdf using the Python exception mechanism. When the C library reports a FAIL status, pyhdf raises an HDF4Error exception (a subclass of Exception) with a descriptive message. Unfortunately, the C library is rarely informative about the cause of the error. pyhdf does its best to try to document the error, but most of the time cannot do more than saying "execution error". V needs support from the HDF module ------------------------------------ The VS module is not self-contained (countrary to the SD module). It requires help from the HDF module, namely: - the HDF.HDF class to open and close the HDF file, and initialize the V interface - the HDF.HC class to provide different sorts of constants (opening modes, data types, etc). A program wanting to access HDF vgroups will almost always need to execute the following minimal set of calls: >>> from pyhdf.HDF import * >>> from pyhdf.V import * >>> hdfFile = HDF(name, HC.xxx)# open HDF file >>> v = hdfFile.vgstart() # initialize V interface on HDF file >>> ... # manipulate vgroups >>> v.end() # terminate V interface >>> hdfFile.close() # close HDF file Classes summary --------------- pyhdf wraps the V API using the following python classes:: V HDF V interface VG vgroup VGAttr vgroup attribute In more detail:: V The V class implements the V (Vgroup) interface applied to an HDF file. To instantiate a V class, call the vgstart() method of an HDF instance. methods: constructors attach() open an existing vgroup given its name or its reference number, or create a new vgroup, returning a VG instance for that vgroup create() create a new vgroup, returning a VG instance for that vgroup closing the interface end() close the V interface on the HDF file deleting a vgroup delete() delete the vgroup identified by its name or its reference number searching find() find a vgroup given its name, returning the vgroup reference number findclass() find a vgroup given its class name, returning the vgroup reference number getid() return the reference number of the vgroup following the one with the given reference number VG The VG class encapsulates the functionality of a vgroup. To instantiate a VG class, call the attach() or create() methods of a V class instance. constructors attr() return a VGAttr instance representing an attribute of the vgroup findattr() search the vgroup for a given attribute, returning a VGAttr instance for that attribute ending access to a vgroup detach() terminate access to the vgroup adding a member to a vgroup add() add to the vgroup the HDF object identified by its tag and reference number insert() insert a vdata or a vgroup in the vgroup, given the vdata or vgroup instance deleting a member from a vgroup delete() remove from the vgroup the HDF object identified by the given tag and reference number querying vgroup attrinfo() return info about all the vgroup attributes inqtagref() determine if the HDF object with the given tag and reference number belongs to the vgroup isvg() determine if the member with the given reference number is a vgroup object isvs() determine if the member with the given reference number is a vdata object nrefs() return the number of vgroup members with the given tag tagref() get the tag and reference number of a vgroup member, given the index number of that member tagrefs() get the tags and reference numbers of all the vgroup members VGAttr The VGAttr class provides methods to set and query vgroup attributes. To create an instance of this class, call the attr() method of a VG instance. Remember that vgroup attributes can also be set and queried by applying the standard python "dot notation" on a VG instance. get attribute value(s) get() obtain the attribute value(s) set attribute value(s) set() set the attribute to the given value(s) of the given type, first creating the attribute if necessary query attribute info info() retrieve attribute name, data type, order and size Attribute access: low and high level ------------------------------------ The V API allows setting attributes on vgroups. Attributes can be of many types (int, float, char) of different bit lengths (8, 16, 32, 64 bits), and can be single or multi-valued. Values of a multi-valued attribute must all be of the same type. Attributes can be set and queried in two different ways. First, given a VG instance (describing a vgroup object), the attr() method of that instance is called to create a VGAttr instance representing the wanted attribute (possibly non existent). The set() method of this VGAttr instance is then called to define the attribute value, creating it if it does not already exist. The get() method returns the current attribute value. Here is an example. >>> from pyhdf.HDF import * >>> from pyhdf.V import * >>> f = HDF('test.hdf', HC.WRITE) # Open file 'test.hdf' in write mode >>> v = f.vgstart() # init vgroup interface >>> vg = v.attach('vtest', 1) # attach vgroup 'vtest' in write mode >>> attr = vg.attr('version') # prepare to define the 'version' attribute # on the vdata >>> attr.set(HC.CHAR8,'1.0') # set attribute 'version' to string '1.0' >>> print(attr.get()) # get and print attribute value >>> attr = vg .attr('range') # prepare to define attribute 'range' >>> attr.set(HC.INT32,(-10, 15)) # set attribute 'range' to a pair of ints >>> print(attr.get()) # get and print attribute value >>> vg.detach() # "close" the vgroup >>> v.end() # terminate the vgroup interface >>> f.close() # close the HDF file The second way consists of setting/querying an attribute as if it were a normal python class attribute, using the usual dot notation. Above example then becomes: >>> from pyhdf.HDF import * >>> from pyhdf.V import * >>> f = HDF('test.hdf', HC.WRITE) # Open file 'test.hdf' in write mode >>> v = f.vgstart() # init vgroup interface >>> vg = v.attach('vtest', 1) # attach vdata 'vtest' in write mode >>> vg.version = '1.0' # create vdata attribute 'version', # setting it to string '1.0' >>> print(vg.version) # print attribute value >>> vg.range = (-10, 15) # create attribute 'range', setting # it to the pair of ints (-10, 15) >>> print(vg.range) # print attribute value >>> vg.detach() # "close" the vdata >>> v.end() # terminate the vdata interface >>> f.close() # close the HDF file Note how the dot notation greatly simplifies and clarifies the code. Some latitude is however lost by manipulating attributes in that way, because the pyhdf package, not the programmer, is then responsible of setting the attribute type. The attribute type is chosen to be one of: =========== ==================================== HC.CHAR8 if the attribute value is a string HC.INT32 if all attribute values are integers HC.FLOAT64 otherwise =========== ==================================== The first way of handling attribute values must be used if one wants to define an attribute of any other type (for ex. 8 or 16 bit integers, signed or unsigned). Also, only a VDAttr instance gives access to attribute info, through its info() method. However, accessing HDF attributes as if they were python attributes raises an important issue. There must exist a way to assign generic attributes to the python objects without requiring those attributes to be converted to HDF attributes. pyhdf uses the following rule: an attribute whose name starts with an underscore ('_') is either a "predefined" HDF attribute (see below) or a standard python attribute. Otherwise, the attribute is handled as an HDF attribute. Also, HDF attributes are not stored inside the object dictionary: the python dir() function will not list them. Attribute values can be updated, but it is illegal to try to change the value type, or the attribute order (number of values). This is important for attributes holding string values. An attribute initialized with an 'n' character string is simply a character attribute of order 'n' (eg a character array of length 'n'). If 'vg' is a vgroup and we initialize its 'a1' attribute as 'vg.a1 = "abcdef"', then a subsequent update attempt like 'vg.a1 = "12"' will fail, because we then try to change the order of the attribute (from 6 to 2). It is mandatory to keep the length of string attributes constant. Predefined attributes --------------------- The VG class supports predefined attributes to get (and occasionnaly set) attribute values easily using the usual python "dot notation", without having to call a class method. The names of predefined attributes all start with an underscore ('_'). In the following table, the RW column holds an X if the attribute is read/write. VG predefined attributes =========== === =========================== =================== name RW description C library routine =========== === =========================== =================== _class X class name Vgetclass/Vsetclass _name X vgroup name Vgetname/Vsetname _nattrs number of vgroup attributes Vnattrs _nmembers number of vgroup members Vntagrefs _refnum vgroup reference number VQueryref _tag vgroup tag VQuerytag _version vgroup version number Vgetversion =========== === =========================== =================== Programming models ------------------ Creating and initializing a vgroup ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The following program shows how to create and initialize a vgroup inside an HDF file. It can serve as a model for any program wanting to create a vgroup:: from pyhdf.HDF import * from pyhdf.V import * from pyhdf.VS import * from pyhdf.SD import * def vdatacreate(vs, name): # Create vdata and define its structure vd = vs.create(name, (('partid',HC.CHAR8, 5), # 5 char string ('description',HC.CHAR8, 10), # 10 char string field ('qty',HC.INT16, 1), # 1 16 bit int field ('wght',HC.FLOAT32, 1), # 1 32 bit float ('price',HC.FLOAT32,1) # 1 32 bit float )) # Store records vd.write((('Q1234', 'bolt',12, 0.01, 0.05), # record 1 ('B5432', 'brush', 10, 0.4, 4.25), # record 2 ('S7613', 'scissor', 2, 0.2, 3.75) # record 3 )) # "close" vdata vd.detach() def sdscreate(sd, name): # Create a simple 3x3 float array. sds = sd.create(name, SDC.FLOAT32, (3,3)) # Initialize array sds[:] = ((0,1,2),(3,4,5),(6,7,8)) # "close" dataset. sds.endaccess() # Create HDF file filename = 'inventory.hdf' hdf = HDF(filename, HC.WRITE|HC.CREATE) # Initialize the SD, V and VS interfaces on the file. sd = SD(filename, SDC.WRITE) # SD interface vs = hdf.vstart() # vdata interface v = hdf.vgstart() # vgroup interface # Create vdata named 'INVENTORY'. vdatacreate(vs, 'INVENTORY') # Create dataset named "ARR_3x3" sdscreate(sd, 'ARR_3x3') # Attach the vdata and the dataset. vd = vs.attach('INVENTORY') sds = sd.select('ARR_3x3') # Create vgroup named 'TOTAL'. vg = v.create('TOTAL') # Add vdata to the vgroup vg.insert(vd) # We could also have written this: # vgroup.add(vd._tag, vd._refnum) # or this: # vgroup.add(HC.DFTAG_VH, vd._refnum) # Add dataset to the vgroup vg.add(HC.DFTAG_NDG, sds.ref()) # Close vgroup, vdata and dataset. vg.detach() # vgroup vd.detach() # vdata sds.endaccess() # dataset # Terminate V, VS and SD interfaces. v.end() # V interface vs.end() # VS interface sd.end() # SD interface # Close HDF file. hdf.close() The program starts by defining two functions vdatacreate() and sdscreate(), which will serve to create the vdata and dataset objects we need. Those functions are not essential to the example. They simply help to make the example self-contained. Refer to the VS and SD module documentation for additional explanations about how these functions work. After opening the HDF file in write mode, the SD, V and VS interfaces are initialized on the file. Next vdatacreate() is called to create a new vdata named 'INVENTORY' on the VS instance, and sdscreate() to create a new dataset named 'ARR_3x3' on the SD instance. This is done so that we have a vdata and a dataset to play with. The vdata and the dataset are then attached ("opened"). The create() method of the V instance is then called to create a new vgroup named 'TOTAL'. The vgroup is then populated by calling its insert() method to add the vdata 'INVENTORY', and its add() method to add the 'ARR_3x3' dataset. Note that insert() is just a commodity method that simplifies adding a vdata or a vgroup to a vgroup, avoiding the need to pass an object tag and reference number. There is no such commodity method for adding a dataset to a vgroup. The dataset must be added by specifying its tag and reference number. Note that the tags to be used are defined inside the HDF module as constants of the HC class: DFTAG_NDG for a dataset, DFTAG_VG for a vgroup, DFTAG_VH for a vdata. The program ends by detaching ("closing") the HDF objects created above, terminating the three interfaces initialized, and closing the HDF file. Reading a vgroup ^^^^^^^^^^^^^^^^ The following program shows the contents of the vgroups contained inside any HDF file:: from pyhdf.HDF import * from pyhdf.V import * from pyhdf.VS import * from pyhdf.SD import * import sys def describevg(refnum): # Describe the vgroup with the given refnum. # Open vgroup in read mode. vg = v.attach(refnum) print "----------------" print "name:", vg._name, "class:",vg._class, "tag,ref:", print vg._tag, vg._refnum # Show the number of members of each main object type. print "members: ", vg._nmembers, print "datasets:", vg.nrefs(HC.DFTAG_NDG), print "vdatas: ", vg.nrefs(HC.DFTAG_VH), print "vgroups: ", vg.nrefs(HC.DFTAG_VG) # Read the contents of the vgroup. members = vg.tagrefs() # Display info about each member. index = -1 for tag, ref in members: index += 1 print "member index", index # Vdata tag if tag == HC.DFTAG_VH: vd = vs.attach(ref) nrecs, intmode, fields, size, name = vd.inquire() print " vdata:",name, "tag,ref:",tag, ref print " fields:",fields print " nrecs:",nrecs vd.detach() # SDS tag elif tag == HC.DFTAG_NDG: sds = sd.select(sd.reftoindex(ref)) name, rank, dims, type, nattrs = sds.info() print " dataset:",name, "tag,ref:", tag, ref print " dims:",dims print " type:",type sds.endaccess() # VS tag elif tag == HC.DFTAG_VG: vg0 = v.attach(ref) print " vgroup:", vg0._name, "tag,ref:", tag, ref vg0.detach() # Unhandled tag else: print "unhandled tag,ref",tag,ref # Close vgroup vg.detach() # Open HDF file in readonly mode. filename = sys.argv[1] hdf = HDF(filename) # Initialize the SD, V and VS interfaces on the file. sd = SD(filename) vs = hdf.vstart() v = hdf.vgstart() # Scan all vgroups in the file. ref = -1 while 1: try: ref = v.getid(ref) except HDF4Error,msg: # no more vgroup break describevg(ref) # Terminate V, VS and SD interfaces. v.end() vs.end() sd.end() # Close HDF file. hdf.close() The program starts by defining function describevg(), which is passed the reference number of the vgroup to display. The function assumes that the SD, VS and V interfaces have been previously initialized. The function starts by attaching ("opening") the vgroup, and displaying its name, class, tag and reference number. The number of members of the three most important object types is then displayed, by calling the nrefs() method with the predefined tags found inside the HDF.HC class. The tagrefs() method is then called to get a list of all the vgroup members, each member being identified by its tag and reference number. A 'for' statement is entered to loop over each element of this list. The tag is tested against the known values defined in the HDF.HC class: the outcome of this test indicates how to process the member object. A DFTAG_VH tag indicates we deal with a vdata. The vdata is attached, its inquire() method called to display info about it, and the vdata is detached. In the case of a DFTAG_NFG, we are facing a dataset. The dataset is selected, info is obtained by calling the dataset info() method, and the dataset is released. A DFTAG_VG indicates that the member is a vgroup. We attach it, print its name, tag and reference number, then detach the member vgroup. A warning is finally displayed if we hit upon a member of an unknown type. The function releases the vgroup just displayed and returns. The main program starts by opening in readonly mode the HDF file passed as argument on the command line. The SD, VS and V interfaces are initialized, and the corresponding class instances are stored inside 'sd', 'vs' and 'v' global variables, respectively, for the use of the describevg() function. A while loop is then entered to access each vgroup in the file. A reference number of -1 is passed on the first call to getid() to obtain the reference number of the first vgroup. getid() returns a new reference number on each subsequent call, and raises an exception when the last vgroup has been retrieved. This exception is caught to break out of the loop, otherwise describevg() is called to display the vgroup we have on hand. Once the loop is over, the interfaces initialized before are terminated, and the HDF file is closed. You will notice that this program will display vgroups other than those you have explicitly created. Those supplementary vgroups are created by the HDF library for its own internal needs. """ import os, sys, types from . import hdfext as _C from .six.moves import xrange from .HC import HC from .VS import VD from .error import HDF4Error, _checkErr # List of names we want to be imported by an "from pyhdf.V import *" # statement __all__ = ['V', 'VG', 'VGAttr'] class V(object): """The V class implements the V (Vgroup) interface applied to an HDF file. To instantiate a V class, call the vgstart() method of an HDF instance. """ def __init__(self, hinst): # Not to be called directly by the user. # A V object is instantiated using the vgstart() # method of an HDF instance. # Args: # hinst HDF instance # Returns: # A V instance # # C library equivalent : Vstart (rather: Vinitialize) # Private attributes: # _hdf_inst: HDF instance # Note: Vstart is just a macro; use 'Vinitialize' instead # Note also thet the same C function is used to initialize the # VS interface. status = _C.Vinitialize(hinst._id) _checkErr('V', status, "cannot initialize V interface") self._hdf_inst = hinst def __del__(self): """Delete the instance, first calling the end() method if not already done. """ try: if self._hdf_inst: self.end() except: pass def end(self): """Close the V interface. Args:: No argument Returns:: None C library equivalent : Vend """ # Note: Vend is just a macro; use 'Vfinish' instead # Note also the the same C function is used to end # the VS interface _checkErr('vend', _C.Vfinish(self._hdf_inst._id), "cannot terminate V interface") self._hdf_inst = None def attach(self, num_name, write=0): """Open an existing vgroup given its name or its reference number, or create a new vgroup, returning a VG instance for that vgroup. Args:: num_name reference number or name of the vgroup to open, or -1 to create a new vgroup; vcreate() can also be called to create and name a new vgroup write set to non-zero to open the vgroup in write mode and to 0 to open it in readonly mode (default) Returns:: VG instance for the vgroup An exception is raised if an attempt is made to open a non-existent vgroup. C library equivalent : Vattach """ if isinstance(num_name, bytes): num = self.find(num_name) else: num = num_name vg_id = _C.Vattach(self._hdf_inst._id, num, write and 'w' or 'r') _checkErr('vattach', vg_id, "cannot attach Vgroup") return VG(self, vg_id) def create(self, name): """Create a new vgroup, and assign it a name. Args:: name name to assign to the new vgroup Returns:: VG instance for the new vgroup A create(name) call is equivalent to an attach(-1, 1) call, followed by a call to the setname(name) method of the instance. C library equivalent : no equivalent """ vg = self.attach(-1, 1) vg._name = name return vg def find(self, name): """Find a vgroup given its name, returning its reference number if found. Args:: name name of the vgroup to find Returns:: vgroup reference number An exception is raised if the vgroup is not found. C library equivalent: Vfind """ refnum = _C.Vfind(self._hdf_inst._id, name) if not refnum: raise HDF4Error("vgroup not found") return refnum def findclass(self, name): """Find a vgroup given its class name, returning its reference number if found. Args:: name class name of the vgroup to find Returns:: vgroup reference number An exception is raised if the vgroup is not found. C library equivalent: Vfind """ refnum = _C.Vfindclass(self._hdf_inst._id, name) if not refnum: raise HDF4Error("vgroup not found") return refnum def delete(self, num_name): """Delete from the HDF file the vgroup identified by its reference number or its name. Args:: num_name either the reference number or the name of the vgroup to delete Returns:: None C library equivalent : Vdelete """ try: vg = self.attach(num_name, 1) except HDF4Error as msg: raise HDF4Error("delete: no such vgroup") # ATTENTION: The HDF documentation says that the vgroup_id # is passed to Vdelete(). This is wrong. # The vgroup reference number must instead be passed. refnum = vg._refnum vg.detach() _checkErr('delete', _C.Vdelete(self._hdf_inst._id, refnum), "error deleting vgroup") def getid(self, ref): """Obtain the reference number of the vgroup following the vgroup with the given reference number . Args:: ref reference number of the vgroup after which to search; set to -1 to start the search at the start of the HDF file Returns:: reference number of the vgroup past the one identified by 'ref' An exception is raised if the end of the vgroup is reached. C library equivalent : Vgetid """ num = _C.Vgetid(self._hdf_inst._id, ref) _checkErr('getid', num, "bad arguments or last vgroup reached") return num class VG(object): """The VG class encapsulates the functionality of a vgroup. To instantiate a VG class, call the attach() or create() methods of a V class instance.""" def __init__(self, vinst, id): # This constructor is not intended to be called directly # by the user program. The attach() method of an # V class instance should be called instead. # Arg: # vinst V instance from which the call is made # id vgroup identifier # Private attributes: # _v_inst V instance to which the vdata belongs # _id vgroup identifier self._v_inst = vinst self._id = id def __del__(self): """Delete the instance, first calling the detach() method if not already done. """ try: if self._id: self.detach() except: pass def __getattr__(self, name): """Some vgroup properties can be queried/set through the following attributes. Their names all start with an "_" to avoid clashes with user-defined attributes. Most are read-only. Only the _class and _name attributes can be modified. Name RO Description C library routine ----- -- ----------------- ----------------- _class class name Vgetclass/Vsetlass _name name Vgetname/Vsetname _nattrs X number of attributes Vnattrs _nmembers X number of vgroup members Vntagrefs _refnum X reference number VQueryref _tag X tag VQuerytag _version X version number Vgetversion """ # NOTE: python will call this method only if the attribute # is not found in the object dictionary. # Check for a user defined attribute first. att = self.attr(name) if att._index is not None: # Then the attribute exists return att.get() # Check for a predefined attribute if name == "_class": status, nm = _C.Vgetclass(self._id) _checkErr('_class', status, 'cannot get vgroup class') return nm elif name == "_name": status, nm = _C.Vgetname(self._id) _checkErr('_name', status, 'cannot get vgroup name') return nm elif name == "_nattrs": n = _C.Vnattrs(self._id) _checkErr('_nattrs', n, 'cannot get number of attributes') return n elif name == "_nmembers": n = _C.Vntagrefs(self._id) _checkErr('refnum', n, 'cannot get vgroup number of members') return n elif name == "_refnum": n = _C.VQueryref(self._id) _checkErr('refnum', n, 'cannot get vgroup reference number') return n elif name == "_tag": n = _C.VQuerytag(self._id) _checkErr('_tag', n, 'cannot get vgroup tag') return n elif name == "_version": n = _C.Vgetversion(self._id) _checkErr('_tag', n, 'cannot get vgroup version') return n else: raise AttributeError def __setattr__(self, name, value): # A name starting with an underscore will be treated as # a standard python attribute, and as an HDF attribute # otherwise. # Forbid assigning to readonly attributes if name in ["_nattrs", "_nmembers", "_refnum", "_tag", "_version"]: raise AttributeError("%s: read-only attribute" % name) # Read-write predefined attributes elif name == "_class": _checkErr(name, _C.Vsetclass(self._id, value), 'cannot set _class property') elif name == "_name": _checkErr(name, _C.Vsetname(self._id, value), 'cannot set _name property') # Try to set a user-defined attribute. else: _setattr(self, name, value) def insert(self, inst): """Insert a vdata or a vgroup in the vgroup. Args:: inst vdata or vgroup instance to add Returns:: index of the inserted vdata or vgroup (0 based) C library equivalent : Vinsert """ if isinstance(inst, VD): id = inst._id elif isinstance(inst, VG): id = inst._id else: raise HDF4Error("insrt: bad argument") index = _C.Vinsert(self._id, id) _checkErr('insert', index, "cannot insert in vgroup") return index def add(self, tag, ref): """Add to the vgroup an object identified by its tag and reference number. Args:: tag tag of the object to add ref reference number of the object to add Returns:: total number of objects in the vgroup after the addition C library equivalent : Vaddtagref """ n = _C.Vaddtagref(self._id, tag, ref) _checkErr('addtagref', n, 'invalid arguments') return n def delete(self, tag, ref): """Delete from the vgroup the member identified by its tag and reference number. Args:: tag tag of the member to delete ref reference number of the member to delete Returns:: None Only the link of the member with the vgroup is deleted. The member object is not deleted. C library equivalent : Vdeletatagref """ _checkErr('delete', _C.Vdeletetagref(self._id, tag, ref), "error deleting member") def detach(self): """Terminate access to the vgroup. Args:: no argument Returns:: None C library equivalent : Vdetach """ _checkErr('detach', _C.Vdetach(self._id), "cannot detach vgroup") self._id = None def tagref(self, index): """Get the tag and reference number of a vgroup member, given the index number of that member. Args:: index member index (0 based) Returns:: 2-element tuple: - member tag - member reference number C library equivalent : Vgettagref """ status, tag, ref = _C.Vgettagref(self._id, index) _checkErr('tagref', status, "illegal arguments") return tag, ref def tagrefs(self): """Get the tags and reference numbers of all the vgroup members. Args:: no argument Returns:: list of (tag,ref) tuples, one for each vgroup member C library equivalent : Vgettagrefs """ n = self._nmembers ret = [] if n: tags = _C.array_int32(n) refs = _C.array_int32(n) k = _C.Vgettagrefs(self._id, tags, refs, n) _checkErr('tagrefs', k, "error getting tags and refs") for m in xrange(k): ret.append((tags[m], refs[m])) return ret def inqtagref(self, tag, ref): """Determines if an object identified by its tag and reference number belongs to the vgroup. Args:: tag tag of the object to check ref reference number of the object to check Returns:: False (0) if the object does not belong to the vgroup, True (1) otherwise C library equivalent : Vinqtagref """ return _C.Vinqtagref(self._id, tag, ref) def nrefs(self, tag): """Determine the number of tags of a given type in a vgroup. Args:: tag tag type to look for in the vgroup Returns:: number of members identified by this tag type C library equivalent : Vnrefs """ n = _C.Vnrefs(self._id, tag) _checkErr('nrefs', n, "bad arguments") return n def isvg(self, ref): """Determines if the member of a vgoup is a vgroup. Args:: ref reference number of the member to check Returns:: False (0) if the member is not a vgroup True (1) otherwise C library equivalent : Visvg """ return _C.Visvg(self._id, ref) def isvs(self, ref): """Determines if the member of a vgoup is a vdata. Args:: ref reference number of the member to check Returns:: False (0) if the member is not a vdata, True (1) otherwise C library equivalent : Visvs """ return _C.Visvs(self._id, ref) def attr(self, name_index): """Create a VGAttr instance representing a vgroup attribute. Args:: name_index attribute name or attribute index number; if a name is given the attribute may not exist; in that case, it will be created when the VGAttr instance set() method is called Returns:: VGAttr instance for the attribute. Call the methods of this class to query, read or set the attribute. C library equivalent : no equivalent """ return VGAttr(self, name_index) def attrinfo(self): """Return info about all the vgroup attributes. Args:: no argument Returns:: dictionary describing each vgroup attribute; for each attribute, a (name,data) pair is added to the dictionary, where 'data' is a tuple holding: - attribute data type (one of HC.xxx constants) - attribute order - attribute value - attribute size in bytes C library equivalent : no equivalent """ dic = {} for n in range(self._nattrs): att = self.attr(n) name, type, order, size = att.info() dic[name] = (type, order, att.get(), size) return dic def findattr(self, name): """Search the vgroup for a given attribute. Args:: name attribute name Returns:: if found, VGAttr instance describing the attribute None otherwise C library equivalent : Vfindattr """ try: att = self.attr(name) if att._index is None: att = None except HDF4Error: att = None return att class VGAttr(object): """The VGAttr class encapsulates methods used to set and query attributes defined on a vgroup. To create an instance of this class, call the attr() method of a VG class. """ def __init__(self, obj, name_or_index): # This constructor should not be called directly by the user # program. The attr() method of a VG class must be called to # instantiate this class. # Args: # obj VG instance to which the attribute belongs # name_or_index name or index of the attribute; if a name is # given, an attribute with that name will be # searched, if not found, a new index number will # be generated # Private attributes: # _v_inst V instance # _index attribute index or None # _name attribute name or None self._v_inst = obj # Name is given. Attribute may exist or not. if isinstance(name_or_index, type('')): self._name = name_or_index self._index = _C.Vfindattr(self._v_inst._id, self._name) if self._index < 0: self._index = None # Index is given. Attribute must exist. else: self._index = name_or_index status, self._name, data_type, n_values, size = \ _C.Vattrinfo(self._v_inst._id, self._index) _checkErr('attr', status, 'non-existent attribute') def get(self): """Retrieve the attribute value. Args:: no argument Returns:: attribute value(s); a list is returned if the attribute is made up of more than one value, except in the case of a string-valued attribute (data type HC.CHAR8) where the values are returned as a string Note that a vgroup attribute can also be queried like a standard python class attribute by applying the usual "dot notation" to a VG instance. C library equivalent : Vgetattr """ # Make sure the attribute exists. if self._index is None: raise HDF4Error("non existent attribute") # Obtain attribute type and the number of values. status, aName, data_type, n_values, size = \ _C.Vattrinfo(self._v_inst._id, self._index) _checkErr('get', status, 'illegal parameters') # Get attribute value. convert = _array_to_ret if data_type == HC.CHAR8: buf = _C.array_byte(n_values) convert = _array_to_str elif data_type in [HC.UCHAR8, HC.UINT8]: buf = _C.array_byte(n_values) elif data_type == HC.INT8: buf = _C.array_int8(n_values) elif data_type == HC.INT16: buf = _C.array_int16(n_values) elif data_type == HC.UINT16: buf = _C.array_uint16(n_values) elif data_type == HC.INT32: buf = _C.array_int32(n_values) elif data_type == HC.UINT32: buf = _C.array_uint32(n_values) elif data_type == HC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == HC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("get: attribute index %d has an "\ "illegal or unupported type %d" % \ (self._index, data_type)) status = _C.Vgetattr(self._v_inst._id, self._index, buf) _checkErr('get', status, 'illegal attribute ') return convert(buf, n_values) def set(self, data_type, values): """Set the attribute value. Args:: data_type : attribute data type (see constants HC.xxx) values : attribute value(s); specify a list to create a multi-valued attribute; a string valued attribute can be created by setting 'data_type' to HC.CHAR8 and 'values' to the corresponding string If the attribute already exists, it will be updated. However, it is illegal to try to change its data type or its order (number of values). Returns:: None Note that a vgroup attribute can also be set like a standard python class attribute by applying the usual "dot notation" to a VG instance. C library equivalent : Vsetattr """ try: n_values = len(values) except: values = [values] n_values = 1 if data_type == HC.CHAR8: buf = _C.array_byte(n_values) # Allow values to be passed as a string. # Noop if a list is passed. values = list(values) for n in range(n_values): values[n] = ord(values[n]) elif data_type in [HC.UCHAR8, HC.UINT8]: buf = _C.array_byte(n_values) elif data_type == HC.INT8: # SWIG refuses negative values here. We found that if we # pass them as byte values, it will work. buf = _C.array_int8(n_values) values = list(values) for n in range(n_values): v = values[n] if v >= 0: v &= 0x7f else: v = abs(v) & 0x7f if v: v = 256 - v else: v = 128 # -128 in 2s complement values[n] = v elif data_type == HC.INT16: buf = _C.array_int16(n_values) elif data_type == HC.UINT16: buf = _C.array_uint16(n_values) elif data_type == HC.INT32: buf = _C.array_int32(n_values) elif data_type == HC.UINT32: buf = _C.array_uint32(n_values) elif data_type == HC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == HC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("set: illegal or unimplemented data_type") for n in range(n_values): buf[n] = values[n] status = _C.Vsetattr(self._v_inst._id, self._name, data_type, n_values, buf) _checkErr('set', status, 'cannot execute') # Update the attribute index self._index = _C.Vfindattr(self._v_inst._id, self._name) if self._index < 0: raise HDF4Error("set: error retrieving attribute index") def info(self): """Retrieve info about the attribute. Args:: no argument Returns:: 4-element tuple with the following components: -attribute name -attribute data type (one of HC.xxx constants) -attribute order (number of values) -attribute size in bytes C library equivalent : Vattrinfo """ # Make sure the attribute exists. if self._index is None: raise HDF4Error("non existent attribute") status, name, type, order, size = \ _C.Vattrinfo(self._v_inst._id, self._index) _checkErr('info', status, "execution error") return name, type, order, size ########################### # Support functions ########################### def _setattr(obj, name, value): # Called by the __setattr__ method of the VG object. # # obj instance on which the attribute is set # name attribute name # value attribute value # Treat a name starting with and underscore as that of a # standard python instance attribute. if name[0] == '_': obj.__dict__[name] = value return # Treat everything else as an HDF attribute. if type(value) not in [list, tuple]: value = [value] typeList = [] for v in value: t = type(v) # Prohibit mixing numeric types and strings. if t in [int, float] and \ not bytes in typeList: if t not in typeList: typeList.append(t) # Prohibit sequence of strings or a mix of numbers and string. elif t == bytes and not typeList: typeList.append(t) else: typeList = [] break if bytes in typeList: xtype = HC.CHAR8 value = value[0] # double is "stronger" than int elif float in typeList: xtype = HC.FLOAT64 elif int in typeList: xtype = HC.INT32 else: raise HDF4Error("Illegal attribute value") # Assign value try: a = obj.attr(name) a.set(xtype, value) except HDF4Error as msg: raise HDF4Error("cannot set attribute: %s" % msg) def _array_to_ret(buf, nValues): # Convert array 'buf' to a scalar or a list. if nValues == 1: ret = buf[0] else: ret = [] for i in xrange(nValues): ret.append(buf[i]) return ret def _array_to_str(buf, nValues): # Convert array of bytes 'buf' to a string. # Return empty string if there is no value. if nValues == 0: return "" # When there is just one value, _array_to_ret returns a scalar # over which we cannot iterate. if nValues == 1: chrs = [chr(buf[0])] else: chrs = [chr(b) for b in _array_to_ret(buf, nValues)] # Strip NULL at end if chrs[-1] == '\0': del chrs[-1] return ''.join(chrs) pyhdf-0.10.3/pyhdf/VS.py000066400000000000000000002727171405105412500147360ustar00rootroot00000000000000# $Id: VS.py,v 1.4 2005-07-14 01:36:41 gosselin_a Exp $ # $Log: not supported by cvs2svn $ # Revision 1.3 2004/08/02 17:06:20 gosselin # pyhdf-0.7.2 # # Revision 1.2 2004/08/02 15:36:04 gosselin # pyhdf-0.7-1 # # Author: Andre Gosselin # Maurice-Lamontagne Institute # gosselina@dfo-mpo.gc.ca """ VS (Vdata table) API (:mod:`pyhdf.VS`) ====================================== A module of the pyhdf package implementing the VS (Vdata table) API of the NCSA HDF4 library. Introduction ------------ VS is one of the modules composing pyhdf, a python package implementing the NCSA HDF library and letting one manage HDF files from within a python program. Two versions of the HDF library currently exist, version 4 and version 5. pyhdf only implements version 4 of the library. Many different APIs are to be found inside the HDF4 specification. Currently, pyhdf implements just a few of those: the SD, VS and V APIs. Other APIs should be added in the future (GR, AN, etc). VS allows the definition of structured data tables inside an HDF file. Those tables are designated as "vdatas" (the name has to do with data associated with the "vertices" of geometrical models, the storage of which the API was originally designed for). A vdata is composed of a fixed number of columns (also called fields), where a column can store a fixed number of data values, all of the same type. The number of values allowed inside a field is called the "order" of the field. A table is composed of a varying number of rows (also called records), a record representing the sequence of values stored in each field of the vdata. A vdata is associated with a descriptive name, and likewise each field of the vdata. A vdata can also be tagged with a "class" to further describe the vdata purpose. Records and fields are identified by a zero-based index. An arbitrary number of attributes of different types can be attached to a vdata as a whole, or to its individual fields. An attribute is a (name, value) pair, where "value" can be of many types, and be either single or multi-valued. The number of values stored in an attribute is called the "order" of the attribute. The following example illustrates a simple vdata that could be stored inside an HDF file. See section "Programming models" for an example program implementing this vdata. INVENTORY (experimental status) ====== =========== === ======== ======== partid description qty wght(lb) price($) ====== =========== === ======== ======== Q1234 bolt 12 0.01 0.05 B5432 brush 10 0.4 4.25 S7613 scissor 2 0.2 3.75 ====== =========== === ======== ======== The vdata is composed of 5 fields. 3 records are shown (of course, a vdata can store much more than that). "INVENTORY" would be the vdata name, and "partid", "description", etc, would be the field names. The data type varies between fields. "partid" and "description" would be of "multicharacter" type (aka "string"), "qty" would be a integer, and "wght" and "price" would be floats. The text in parentheses could be stored as attributes. A "status" attribute could be defined for the table as a whole, and given the value "experimental". Likewise, a "unit" attribute could be associated with fields "wght" and "price", and given the values "lb" and "$", resp. The VS API allows one to create, locate and open a vdata inside an HDF file, update and append records inside it, read records randomly or sequentially, and access and update the vdata and field attributes. Attributes can be read and written using the familiar python "dot notation", and records can be read and written by indexing and slicing the vdata as if it were a python sequence. VS module key features ---------------------- VS key features are as follows. - pyhdf implements almost every routine of the original VS API. Only a few have been ignored, most of them being of a rare use: - VSgetblocksize() / VSsetblocksize() - VSsetnumblocks() - VSlone - It is quite straightforward to go from a C version to a python version of a program accessing the VS API, and to learn VS usage by referring to the C API documentation. - A few high-level python methods have been developed to ease programmers task. Of greatest interest are the following: - Access to attributes through the familiar "dot notation". - Indexing and slicing a vdata to read and write its records, similarly to a python sequence. - Easy retrieval of info on a vdata and its fields. - Easy creation of vdatas. Accessing the VS module ----------------------- To access the VS module a python program can say one of: >>> import pyhdf.VS # must prefix names with "pyhdf.VS." >>> from pyhdf import VS # must prefix names with "VS." >>> from pyhdf.VS import * # names need no prefix This document assumes the last import style is used. VS is not self-contained, and needs functionality provided by another pyhdf module, namely the HDF module. This module must thus be imported also: >>> from .HDF import * Package components ------------------ pyhdf is a proper Python package, eg a collection of modules stored under a directory whose name is that of the package and which stores an __init__.py file. Following the normal installation procedure, this directory will be /site-packages/pyhdf', where stands for the python installation directory. For each HDF API exists a corresponding set of modules. The following modules are related to the VS API. _hdfext C extension module responsible for wrapping the HDF C library for all python modules hdfext python module implementing some utility functions complementing the _hdfext extension module error defines the HDF4Error exception HDF python module providing support to the VS module VS python module wrapping the VS API routines inside an OOP framework _hdfext and hdfext were generated using the SWIG preprocessor. SWIG is however *not* needed to run the package. Those two modules are meant to do their work in the background, and should never be called directly. Only HDF and VS should be imported by the user program. Prerequisites ------------- The following software must be installed in order for VS to work. HDF (v4) library pyhdf does *not* include the HDF4 library, which must be installed separately. HDF is available at: "https://portal.hdfgroup.org/display/support/Download+HDF4". Numeric is also needed by the SD module. See the SD module documentation. Documentation ------------- pyhdf has been written so as to stick as closely as possible to the naming conventions and calling sequences documented inside the "HDF User s Guide" manual. Even if pyhdf gives an OOP twist to the C API, the manual can be easily used as a documentary source for pyhdf, once the class to which a function belongs has been identified, and of course once requirements imposed by the Python language have been taken into account. Consequently, this documentation will not attempt to provide an exhaustive coverage of the HDF VS API. For this, the user is referred to the above manual. The documentation of each pyhdf method will indicate the name of the equivalent routine as it is found inside the C API. This document (in both its text and html versions) has been completely produced using "pydoc", the Python documentation generator (which made its debut in the 2.1 Python release). pydoc can also be used as an on-line help tool. For example, to know everything about the VS.VD class, say: >>> from pydoc import help >>> from pyhdf.VS import * >>> help(VD) To be more specific and get help only for the read() method of the VD class: >>> help(VD.read) pydoc can also be called from the command line, as in:: % pydoc pyhdf.VS.VD # doc for the whole VD class % pydoc pyhdf.VS.VD.read # doc for the VD.read method Summary of differences between the pyhdf and C VS API ----------------------------------------------------- Most of the differences between the pyhdf and C VS API can be summarized as follows. - In the C API, every function returns an integer status code, and values computed by the function are returned through one or more pointers passed as arguments. - In pyhdf, error statuses are returned through the Python exception mechanism, and values are returned as the method result. When the C API specifies that multiple values are returned, pyhdf returns a sequence of values, which are ordered similarly to the pointers in the C function argument list. Error handling -------------- All errors reported by the C VS API with a SUCCESS/FAIL error code are reported by pyhdf using the Python exception mechanism. When the C library reports a FAIL status, pyhdf raises an HDF4Error exception (a subclass of Exception) with a descriptive message. Unfortunately, the C library is rarely informative about the cause of the error. pyhdf does its best to try to document the error, but most of the time cannot do more than saying "execution error". VS needs support from the HDF module ------------------------------------ The VS module is not self-contained (countrary to the SD module). It requires help from the HDF module, namely: - the HDF.HDF class to open and close the HDF file, and initialize the VS interface - the HDF.HC class to provide different sorts of constants (opening modes, data types, etc). A program wanting to access HDF vdatas will almost always need to execute the following minimal set of calls: >>> from pyhdf.HDF import * >>> from pyhdf.VS import * >>> hdfFile = HDF(name, HC.xxx)# open HDF file >>> vs = hdfFile.vstart() # initialize VS interface on HDF file >>> ... # manipulate vdatas through "vs" >>> vs.end() # terminate VS interface >>> hdfFile.close() # close HDF file Classes summary --------------- pyhdf wraps the VS API using different python classes:: VS HDF VS interface VD vdata VDField vdata field VDattr attribute (either at the vdata or field level) In more detail:: VS The VS class implements the VS (Vdata) interface applied to an HDF file. This class encapsulates the hdf instance, and all the top-level functions of the VS API. To create a VS instance, call the vstart() method of an HDF instance. methods: constructors: attach() open an existing vdata given its name or reference number, or create a new one, returning a VD instance create() create a new vdata and define its structure, returning a VD instance creating and initializing a simple vdata storedata() create a single-field vdata and initialize its values closing the interface end() close the VS interface on the HDF file searching find() get a vdata reference number given its name next() get the reference number of the vdata following a given one inquiry vdatainfo() return info about all the vdatas in the HDF file VD The VD class describes a vdata. It encapsulates the VS instance to which the vdata belongs, and the vdata identifier. To instantiate a VD class, call the attach() or create() method of a VS class instance. methods: constructors attr() create a VDAttr instance representing a vdata attribute; "dot notation" can also be used to access a vdata attribute field() return a VDField instance representing a given field of the vdata closing vdata detach() end access to the vdata defining fields fdefine() define the name, type and order of a new field setfields() define the field names and field order for the read() and write() methods; also used to initialize the structure of a vdata previously created with the VS.attach() method reading and writing note: a vdata can be indexed and sliced like a python sequence read() return the values of a number of records starting at the current record position seek() reset the current record position seekend() seek past the last record tell() return the current record position write() write a number of records starting at the current record position inquiry attrinfo() return info about all the vdata attributes fexist() check if a vdata contains a given set of fields fieldinfo() return info about all the vdata fields findattr() locate an attribute, returning a VDAttr instance if found inquire() return info about the vdata sizeof() return the size in bytes of one or more fields VDField The VDField class represents a vdata field. It encapsulates the VD instance to which the field belongs, and the field index number. To instantiate a VDField, call the field() method of a VD class instance. methods: constructors: attr() return a VDAttr instance representing an attribute of the field; "dot notation" can also be used to get/set an attribute. inquiry attrinfo() return info about all the field attributes find() locate an attribute, returning a VDAttr instance if found VDAttr The VDAttr class encapsulates methods used to set and query attributes defined at the level either of the vdata or the vdata field. To create an instance of this class, call the attr() or findattr() methods of a VD instance (for vdata attributes), or call the attr() or find() methods of a VDField instance (for field attributes). methods: get / set get() get the attribute value set() set the attribute value info info() retrieve info about the attribute Data types ---------- Data types come into play when first defining vdata fields and attributes, and later when querying the definition of those fields and attributes. Data types are specified using the symbolic constants defined inside the HC class of the HDF module. - CHAR and CHAR8 (equivalent): an 8-bit character. - UCHAR, UCHAR8 and UINT8 (equivalent): unsigned 8-bit values (0 to 255) - INT8: signed 8-bit values (-128 to 127) - INT16: signed 16-bit values - UINT16: unsigned 16 bit values - INT32: signed 32 bit values - UINT32: unsigned 32 bit values - FLOAT32: 32 bit floating point values (C floats) - FLOAT64: 64 bit floating point values (C doubles) There is no explicit "string" type. To simulate a string, set the field or attribute type to CHAR, and set the field or attribute "order" to a value of 'n' > 1. This creates and "array of characters", close to a string (except that strings will always be of length 'n', right-padded with spaces if necessary). Attribute access: low and high level ------------------------------------ The VS API allow setting attributes on vdatas and vdata fields. Attributes can be of many types (int, float, char) of different bit lengths (8, 16, 32, 64 bits), and can be single or multi-valued. Values of a multi-valued attribute must all be of the same type. Attributes can be set and queried in two different ways. First, given a VD instance (describing a vdata object) or a VDField instance (describing a vdata field), the attr() method of that instance is called to create a VDAttr instance representing the wanted attribute (possibly non existent). The set() method of this VDAttr instance is then called to define the attribute value, creating it if it does not already exist. The get() method returns the current attribute value. Here is an example. >>> from pyhdf.HDF import * >>> from pyhdf.VS import * >>> f = HDF('test.hdf', HC.WRITE) # Open file 'test.hdf' in write mode >>> vs = f.vstart() # init vdata interface >>> vd = vs.attach('vtest', 1) # attach vdata 'vtest' in write mode >>> attr = vd.attr('version') # prepare to define the 'version' attribute # on the vdata >>> attr.set(HC.CHAR8,'1.0') # set attribute 'version' to string '1.0' >>> print(attr.get()) # get and print attribute value >>> fld = vd.field('fld1') # obtain a field instance for field 'fld1' >>> attr = fld.attr('range') # prepare to define attribute 'range' on # this field >>> attr.set(HC.INT32,(-10, 15)) # set attribute 'range' to a pair of ints >>> print(attr.get()) # get and print attribute value >>> vd.detach() # "close" the vdata >>> vs.end() # terminate the vdata interface >>> f.close() # close the HDF file The second way consists of setting/querying an attribute as if it were a normal python class attribute, using the usual dot notation. Above example then becomes: >>> from pyhdf.HDF import * >>> from pyhdf.VS import * >>> f = HDF('test.hdf', HC.WRITE) # Open file 'test.hdf' in write mode >>> vs = f.vstart() # init vdata interface >>> vd = vs.attach('vtest', 1) # attach vdata 'vtest' in write mode >>> vd.version = '1.0' # create vdata attribute 'version', # setting it to string '1.0' >>> print(vd.version) # print attribute value >>> fld = vd.field('fld1') # obtain a field instance for field 'fld1' >>> fld.range = (-10, 15) # create field attribute 'range', setting # it to the pair of ints (-10, 15) >>> print(fld.range) # print attribute value >>> vd.detach() # "close" the vdata >>> vs.end() # terminate the vdata interface >>> f.close() # close the HDF file Note how the dot notation greatly simplifies and clarifies the code. Some latitude is however lost by manipulating attributes in that way, because the pyhdf package, not the programmer, is then responsible of setting the attribute type. The attribute type is chosen to be one of: =========== ==================================== HC.CHAR8 if the attribute value is a string HC.INT32 if all attribute values are integers HC.FLOAT64 otherwise =========== ==================================== The first way of handling attribute values must be used if one wants to define an attribute of any other type (for ex. 8 or 16 bit integers, signed or unsigned). Also, only a VDAttr instance gives access to attribute info, through its info() method. However, accessing HDF attributes as if they were python attributes raises an important issue. There must exist a way to assign generic attributes to the python objects without requiring those attributes to be converted to HDF attributes. pyhdf uses the following rule: an attribute whose name starts with an underscore ('_') is either a "predefined" attribute (see below) or a standard python attribute. Otherwise, the attribute is handled as an HDF attribute. Also, HDF attributes are not stored inside the object dictionary: the python dir() function will not list them. Attribute values can be updated, but it is illegal to try to change the value type, or the attribute order (number of values). This is important for attributes holding string values. An attribute initialized with an 'n' character string is simply a character attribute of order 'n' (eg a character array of length 'n'). If 'vd' is a vdata and we initialize its 'a1' attribute as 'vd.a1 = "abcdef"', then a subsequent update attempt like 'vd.a1 = "12"' will fail, because we then try to change the order of the attribute (from 6 to 2). It is mandatory to keep the length of string attributes constant. Examples below show simple ways how this can be done. Predefined attributes --------------------- The VD and VDField classes support predefined attributes to get (and occasionnaly set) attribute values easily, without having to call a class method. The names of predefined attributes all start with an underscore ('_'). In the following tables, the RW column holds an X if the attribute is read/write. See the HDF User s guide for details about more "exotic" topics like "class", "faked vdata" and "tag". VD predefined attributes =========== == ========================== ============================= name RW description C library routine =========== == ========================== ============================= _class X class name VSgetclass/VSsetclass _fields list of field names VSgetfields _interlace X interlace mode VSgetinterlace/VSsetinterlace _isattr true if vdata is "faked" VSisattr by HDF to hold attributes _name X name of the vdata VSgetname/VSsetname _nattrs number of attributes VSfnattrs _nfields number of fields VFnfields _nrecs number of records VSelts _recsize record size (bytes) VSQueryvsize _refnum reference number VSQueryref _tag vdata tag VSQuerytag _tnattrs total number of vdata and VSnattrs field attributes =========== == ========================== ============================= VDField predefined attributes =========== == ========================== ============================= name RW description C library routine =========== == ========================== ============================= _esize external size (bytes) VFfieldesize _index index number VSfindex _isize internal size (bytes) VFfieldisize _name name VFfieldname _nattrs number of attributes VSfnattrs _order order (number of values) VFfieldorder _type field type (HC.xxx) VFfieldtype =========== == ========================== ============================= Record access: low and high level --------------------------------- vdata records can be read and written in two different ways. The first one consists of calling the basic I/O methods of the vdata: - seek() to set the current record position, if necessary; - read() to retrieve a given number of records from that position; - write() to write a given number of records starting at that position A second, higher level way, lets one see a vdata similarly to a python sequence, and access its contents using the familiar indexing and slicing notation in square brackets. Reading and writing a vdata as if it were a python sequence may often look simpler, and improve code legibility. Here are some examples of how a vdata 'vd' holding 3 fields could be read. >>> print(vd[0]) # print record 0 >>> print(vd[-1]) # print last record >>> print(vd[2:]) # print records 2 and those that follow >>> print(vd[:]) # print all records >>> print(vd[:,0]) # print field 0 of all records >>> print(vd[:3,:2]) # print first 2 fields of first 3 records As the above examples show, the usual python rules are obeyed regarding the interpretation of indexing and slicing values. Note that the vdata fields can be indexed and sliced, not only the records. The setfields() method can also be used to select a subset to the vdata fields (setfields() also let you reorder the fields). When the vdata is indexed (as opposed to being sliced), a single record is returned as a list of values. When the vdata is sliced, a list of records is always returned (thus a 2-level list), even if the slice contains only one record. A vdata can also be written similarly to a python sequence. When indexing the vdata (as opposed to slicing it), a single record must be assigned, and the record must be given as a sequence of values. It is legal to use as an index the current number of records in the vdata: the record is then appended to the vdata. When slicing the vdata, the records assigned to the slice must always be given as a list of records, even if only one record is assigned. Also, the number of records assigned must always match the width of the slice, except if the slice includes or goes past the last record of the vdata. In that case, the number of records assigned can exceed the width of the slice, and the extra records are appended to the vdata. So, to append records to vdata 'vd', simply assign records to the slice 'vd[vd._nrecs:]'. Note that, even if the 'field' dimension can be specified in the left-hand side expression, there is no real interest in doing so, since all fields must be specified when assigning a record to the vdata: it is an error to try to assign just a few of the fields. For example, given a vdata 'vd' holding 5 records, and lists 'reca', 'recb', etc, holding record values:: vd[0] = reca # updates record 0 vd[0,:] = reca # specifying fields is OK, but useless vd[0,1:] = reca[1:] # error: all fields must be assigned vd[1] = [recb, recc] # error: only one record allowed vd[5] = recc # append one record vd[1:3] = [reca,recb] # updates second and third record vd[1:4] = [reca, recb] # error: 3 records needed vd[5:] = [reca,recb] # appends 2 records to the vdata vd[4:] = [reca, recb] # updates last record, append one Programming models ------------------ Creating and initializing a new vdata ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The following code can serve as a model for the creation and initialization of a new vdata. It implements the INVENTORY example described in the "Introduction" section:: from pyhdf.HDF import * from pyhdf.VS import * # Open HDF file and initialize the VS interface f = HDF('inventory.hdf', # Open file 'inventory.hdf' in write mode HC.WRITE|HC.CREATE) # creating it if it does not exist vs = f.vstart() # init vdata interface # Create vdata and define its structure vd = vs.create( # create a new vdata 'INVENTORY', # name of the vdata # fields of the vdata follow (('partid',HC.CHAR8, 5), # 5 char string ('description',HC.CHAR8, 10), # 10 char string field ('qty',HC.INT16, 1), # 1 16 bit int field ('wght',HC.FLOAT32, 1), # 1 32 bit float ('price',HC.FLOAT32,1) # 1 32 bit float )) # 5 fields allocated in the vdata # Set attributes on the vdata and its fields vd.field('wght').unit = 'lb' vd.field('price').unit = '$' # In order to be able to update a string attribute, it must # always be set to the same length. This sets 'status' to a 20 # char long, left-justified string, padded with spaces on the right. vd.status = "%-20s" % 'phase 1 done' # Store records vd.write(( # write 3 records ('Q1234', 'bolt',12, 0.01, 0.05), # record 1 ('B5432', 'brush', 10, 0.4, 4.25), # record 2 ('S7613', 'scissor', 2, 0.2, 3.75) # record 3 )) vd.detach() # "close" the vdata vs.end() # terminate the vdata interface f.close() # close the HDF file Note that is mandatory to always write whole records to the vdata. Note also the comments about the initialization of the 'status' vdata attribute. We want to be able update this attribute (see following examples). However, the VS API prohibits changing an attribute type when updating its value. Since the length (order) of an attribute is part of its type, we make sure of setting the attribute to a length long enough to accommodate the longest possible string we migh want to assign to the attribute. Appending records to a vdata ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Appending records requires first seeking to the end of the vdata, to avoid overwriting existing records. The following code can serve as a model. The INVENTORY vdata created before is used:: from pyhdf.HDF import * from pyhdf.VS import * f = HDF('inventory.hdf', # Open 'inventory.hdf' in write mode HC.WRITE|HC.CREATE) # creating it if it does not exist vs = f.vstart() # init vdata interface vd = vs.attach('INVENTORY', 1) # attach 'INVENTORY' in write mode # Update the `status' vdata attribute. The attribute length must not # change. We call the attribute info() method, which returns a list # where number of values (eg string length) is stored at index 2. # We then assign a left justified string of exactly that length. len = vd.attr('status').info()[2] vd.status = '%-*s' % (len, 'phase 2 done') vd[vd._nrecs:] = ( # append 2 records ('A4321', 'axe', 5, 1.5, 25), # first record ('C3214', 'cup', 100, 0.1, 3.25) # second record ) vd.detach() # "close" the vdata vs.end() # terminate the vdata interface f.close() # close the HDF file Note how, when updating the value of the 'status' vdata attribute, we take care of assigning a value of the same length as that of the original value. Otherwise, the assignment would raise an exception. Records are written by assigning the vdata through a slicing expression, like a python sequence. By specifying the number of records as the start of the slice, the records are appended to the vdata. Updating records in a vdata ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Updating requires seeking to the record to update before writing the new records. New data will overwrite this record and all records that follow, until a new seek is performed or the vdata is closed. Note that record numbering starts at 0. The following code can serve as a model. The INVENTORY vdata created before is used:: from pyhdf.HDF import * from pyhdf.VS import * f = HDF('inventory.hdf', # Open 'inventory.hdf' in write mode HC.WRITE|HC.CREATE) # creating it if it does not exist vs = f.vstart() # init vdata interface vd = vs.attach('INVENTORY', 1) # attach 'INVENTORY' in write mode # Update the `status' vdata attribute. The attribute length must not # change. We call the attribute info() method, which returns a list # where number of values (eg string length) is stored at index 2. # We then assign a left justified string of exactly that length. len = vd.attr('status').info()[2] vd.status = '%-*s' % (len, 'phase 3 done') # Update record at index 1 (second record) vd[1] = ('Z4367', 'surprise', 10, 3.1, 44.5) # Update record at index 4, and all those that follow vd[4:] = ( ('QR231', 'toy', 12, 2.5, 45), ('R3389', 'robot', 3, 45, 2000) ) vd.detach() # "close" the vdata vs.end() # terminate the vdata interface f.close() # close the HDF file Reading a vdata ^^^^^^^^^^^^^^^ The following example shows how read the vdata attributes and sequentially maneuver through its records. Note how we use the exception mechanism to break out of the reading loop when we reach the end of the vdata:: from pyhdf.HDF import * from pyhdf.VS import * f = HDF('inventory.hdf') # open 'inventory.hdf' in read mode vs = f.vstart() # init vdata interface vd = vs.attach('INVENTORY') # attach 'INVENTORY' in read mode # Display some vdata attributes print "status:", vd.status print "vdata: ", vd._name # predefined attribute: vdata name print "nrecs: ", vd._nrecs # predefined attribute: num records # Display value of attribute 'unit' for all fields on which # this attribute is set print "units: ", for fieldName in vd._fields: # loop over all field names try: # instantiate field and obtain value of attribute 'unit' v = vd.field(fieldName).unit print "%s: %s" % (fieldName, v), except: # no 'unit' attribute: ignore pass print "" print "" # Display table header. header = "%-7s %-12s %3s %4s %8s" % tuple(vd._fields) print "-" * len(header) print header print "-" * len(header) # Loop over the vdata records, displaying each record as a table row. # Current record position is 0 after attaching the vdata. while 1: try: rec = vd.read() # read next record # equivalent to: # rec = vd[vd.tell()] print "%-7s %-12s %3d %4.1f %8.2f" % tuple(rec[0]) except HDF4Error: # end of vdata reached break vd.detach() # "close" the vdata vs.end() # terminate the vdata interface f.close() # close the HDF file In the previous example, the reading/displaying loop can be greatly simplified by rewriting it as follows:: from pyhdf.HDF import * from pyhdf.VS import * f = HDF('inventory.hdf') # open 'inventory.hdf' in read mode vs = f.vstart() # init vdata interface vd = vs.attach('INVENTORY') # attach 'INVENTORY' in read mode .... # Read all records at once, and loop over the sequence. for rec in vd[:]: print "%-7s %-12s %3d %4.1f %8.2f" % tuple(rec) vd.detach() # "close" the vdata ... The indexing expression 'vd[:]' returns the complete set of records, which can then be looped over using a 'for' statement. This style of loop is quite clean, and should look very familiar to python adepts. """ import os, sys, types from . import hdfext as _C from . import six from .six.moves import xrange from .HC import HC from .error import HDF4Error, _checkErr # List of names we want to be imported by an "from pyhdf.VS import *" # statement __all__ = ['VS', 'VD', 'VDField', 'VDAttr'] class VS(object): """The VS class implements the VS (Vdata) interface applied to an HDF file. To instantiate a VS class, call the vstart() method of an HDF instance. """ def __init__(self, hinst): # Not to be called directly by the user. # A VS object is instantiated using the vstart() # method of an HDF instance. # Args: # hinst HDF instance # Returns: # A VS instance # # C library equivalent : Vstart (rather: Vinitialize) # Private attributes: # _hdf_inst: HDF instance # Note: Vstart is just a macro; use 'Vinitialize' instead status = _C.Vinitialize(hinst._id) _checkErr('VS', status, "cannot initialize VS interface") self._hdf_inst = hinst def __del__(self): """Delete the instance, first calling the end() method if not already done. """ try: if self._hdf_inst: self.end() except: pass def end(self): """Close the VS interface. Args:: No argument Returns:: None C library equivalent : Vend """ # Note: Vend is just a macro; use 'Vfinish' instead _checkErr('end', _C.Vfinish(self._hdf_inst._id), "cannot terminate VS interface") self._hdf_inst = None vend = end # For backward compatibility def attach(self, num_name, write=0): """Locate an existing vdata or create a new vdata in the HDF file, returning a VD instance. Args:: num_name Name or reference number of the vdata. An existing vdata can be specified either through its reference number or its name. Use -1 to create a new vdata. Note that uniqueness is not imposed on vdatas names, whereas refnums are guaranteed to be unique. Thus knowledge of its reference number may be the only way to get at a wanted vdata. write Set to 0 to open the vdata in read-only mode, set to 1 to open it in write mode Returns:: VD instance representing the vdata C library equivalent : VSattach After creating a new vdata (num_name == -1), fields must be defined using method fdefine() of the VD instance, and those fields must be allocated to the vdata with method setfields(). Same results can be achieved, but more simply, by calling the create() method of the VS instance. """ mode = write and 'w' or 'r' if isinstance(num_name, str): num = self.find(num_name) else: num = num_name vd = _C.VSattach(self._hdf_inst._id, num, mode) if vd < 0: _checkErr('attach', vd, 'cannot attach vdata') return VD(self, vd) def create(self, name, fields): """Create a new vdata, setting its name and allocating its fields. Args:: name Name to assign to the vdata fields Sequence of field definitions. Each field definition is a sequence with the following elements in order: - field name - field type (one of HC.xxx constants) - field order (number of values) Fields are allocated to the vdata in the given order Returns:: VD instance representing the created vdata Calling the create() method is equivalent to the following calls: - vd = attach(-1,1), to create a new vdata and open it in write mode - vd._name = name, to set the vdata name - vd.fdefine(...), to define the name, type and order of each field - vd.setfields(...), to allocate fields to the vdata C library equivalent : no equivalent """ try: # Create new vdata (-1), open in write mode (1) vd = self.attach(-1, 1) # Set vdata name vd._name = name # Define fields allNames = [] for name, type, order in fields: vd.fdefine(name, type, order) allNames.append(name) # Allocate fields to the vdata vd.setfields(*allNames) return vd except HDF4Error as msg: raise HDF4Error("error creating vdata (%s)" % msg) def find(self, vName): """Get the reference number of a vdata given its name. The vdata can then be opened (attached) by passing this reference number to the attach() method. Args:: vName Name of the vdata for which the reference number is needed. vdatas names are not guaranteed to be unique. When more than one vdata bear the same name, find() will return the refnum of the first one founmd. Returns:: vdata reference number. 0 is returned if the vdata does not exist. C library equivalent : VSfind """ refNum = _C.VSfind(self._hdf_inst._id, vName) _checkErr("find", refNum, "cannot find vdata %s" % vName) return refNum def next(self, vRef): """Get the reference number of the vdata following a given vdata. Args:: vRef Reference number of the vdata preceding the one we require. Set to -1 to get the first vdata in the HDF file. Knowing its reference number, the vdata can then be opened (attached) by passing this reference number to the attach() method. Returns:: Reference number of the vdata following the one given by argument vref An exception is raised if no vdata follows the one given by vRef. C library equivalent : VSgetid """ num = _C.VSgetid(self._hdf_inst._id, vRef) _checkErr('next', num, 'cannot get next vdata') return num def vdatainfo(self, listAttr=0): """Return info about all the file vdatas. Args:: listAttr Set to 0 to ignore vdatas used to store attribute values, 1 to list them (see the VD._isattr readonly attribute) Returns:: List of vdata descriptions. Each vdata is described as a 9-element tuple, composed of the following: - vdata name - vdata class - vdata reference number - vdata number of records - vdata number of fields - vdata number of attributes - vdata record size in bytes - vdata tag number - vdata interlace mode C library equivalent : no equivalent """ lst = [] ref = -1 # start at beginning while True: try: nxtRef = self.next(ref) except HDF4Error: # no vdata left break # Attach the vdata and check for an "attribute" vdata. ref = nxtRef vdObj = self.attach(ref) if listAttr or not vdObj._isattr: # Append a list of vdata properties. lst.append((vdObj._name, vdObj._class, vdObj._refnum, vdObj._nrecs, vdObj._nfields, vdObj._nattrs, vdObj._recsize, vdObj._tag, vdObj._interlace)) vdObj.detach() return lst def storedata(self, fieldName, values, data_type, vName, vClass): """Create and initialize a single field vdata, returning the vdata reference number. Args:: fieldName Name of the single field in the vadata to create values Sequence of values to store in the field;. Each value can itself be a sequence, in which case the field will be multivalued (all second-level sequences must be of the same length) data_type Values type (one of HC.xxx constants). All values must be of the same type vName Name of the vdata to create vClass Vdata class (string) Returns:: vdata reference number C library equivalent : VHstoredata / VHstoredatam """ # See if the field is multi-valued. nrecs = len(values) if type(values[0]) in [list, tuple]: order = len(values[0]) # Replace input list with a flattened list. newValues = [] for el in values: for e in el: newValues.append(e) values = newValues else: order = 1 n_values = nrecs * order if data_type == HC.CHAR8: buf = _C.array_byte(n_values) # Allow values to be passed as a string. # Noop if a list is passed. values = list(values) for n in range(n_values): values[n] = ord(values[n]) elif data_type in [HC.UCHAR8, HC.UINT8]: buf = _C.array_byte(n_values) elif data_type == HC.INT8: # SWIG refuses negative values here. We found that if we # pass them as byte values, it will work. buf = _C.array_int8(n_values) values = list(values) for n in range(n_values): v = values[n] if v >= 0: v &= 0x7f else: v = abs(v) & 0x7f if v: v = 256 - v else: v = 128 # -128 in 2s complement values[n] = v elif data_type == HC.INT16: buf = _C.array_int16(n_values) elif data_type == HC.UINT16: buf = _C.array_uint16(n_values) elif data_type == HC.INT32: buf = _C.array_int32(n_values) elif data_type == HC.UINT32: buf = _C.array_uint32(n_values) elif data_type == HC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == HC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("storedata: illegal or unimplemented data_type") for n in range(n_values): buf[n] = values[n] if order == 1: vd = _C.VHstoredata(self._hdf_inst._id, fieldName, buf, nrecs, data_type, vName, vClass) else: vd = _C.VHstoredatam(self._hdf_inst._id, fieldName, buf, nrecs, data_type, vName, vClass, order) _checkErr('storedata', vd, 'cannot create vdata') return vd class VD(object): """The VD class encapsulates the functionality of a vdata. To instantiate a VD class, call the attach() or the create() method of a VS class instance.""" def __init__(self, vsinst, id): # This constructor is not intended to be called directly # by the user program. The attach() method of an # VS class instance should be called instead. # Arg: # vsinst VS instance from which the call is made # id vdata reference number # Private attributes: # _vs_inst VS instance to which the vdata belongs # _id vdata identifier # _offset current record offset # _setfields last arg to setfields() self._vs_inst = vsinst self._id = id self._offset = 0 self._setfields = None def __getattr__(self, name): """Some vdata properties can be queried/set through the following attributes. Their names all start with an "_" to avoid clashes with user-defined attributes. Most are read-only. Only the _class, _fields, _interlace and _name can be modified. _fields and _interlace can only be set once. Name RO Description C library routine ----- -- ----------------- ----------------- _class class name VSgetclass _fields X field names VSgetfields _interlace interlace mode VSgetinterlace _isattr X attribute vs real vdata VSisattr _name name VSgetname _nattrs X number of attributes VSfnattrs _nfields X number of fields VFnfields _nrecs X number of records VSelts _recsize X record size VSQueryvsize _refnum X reference number VSQueryref _tag X tag VSQuerytag _tnattrs X total number of attr. VSnattrs """ # Check for a user defined attribute first. att = self.attr(name) if att._index is not None: # Then the attribute exists return att.get() # Check for a predefined attribute elif name == "_class": status, nm = _C.VSgetclass(self._id) _checkErr('_class', status, 'cannot get vdata class') return nm elif name == "_fields": n, fields = _C.VSgetfields(self._id) _checkErr('_fields', n, "cannot get vdata field names") return fields.split(',') elif name == "_interlace": mode = _C.VSgetinterlace(self._id) _checkErr('_interlace', mode, "cannot get vdata interlace mode") return mode elif name == "_isattr": return _C.VSisattr(self._id) elif name == "_name": status, nm = _C.VSgetname(self._id) _checkErr('_name', status, 'cannot get vdata name') return nm elif name == "_nattrs": n = _C.VSfnattrs(self._id, -1) # -1: vdata attributes _checkErr("_nfields", n, "cannot retrieve number of attributes") return n elif name == "_nfields": n = _C.VFnfields(self._id) _checkErr("_nfields", n, "cannot retrieve number of fields") return n elif name == "_nrecs": n = _C.VSelts(self._id) _checkErr('_nrecs', n, 'cannot get vdata number of records') return n elif name == "_recsize": return self.inquire()[3] elif name == "_refnum": n = _C.VSQueryref(self._id) _checkErr('refnum', n, 'cannot get reference number') return n elif name == "_tag": n = _C.VSQuerytag(self._id) _checkErr('_tag', n, 'cannot get tag') return n elif name == "_tnattrs": n = _C.VSnattrs(self._id) _checkErr('_tnattrs', n, 'execution error') return n raise AttributeError def __setattr__(self, name, value): # A name starting with an underscore will be treated as # a standard python attribute, and as an HDF attribute # otherwise. # Forbid assigning to our predefined attributes if name in ["_fields", "_isattr", "_nattrs", "_nfields", "_nrecs", "_recsize", "_refnum", "_tag", "_tnattrs"]: raise AttributeError("%s: read-only attribute" % name) # Handle the 3 VS attributes: _class, _interlace # and _name. _interlace can only be set once. elif name == "_class": _checkErr(name, _C.VSsetclass(self._id, value), 'cannot set _class property') elif name == "_interlace": _checkErr(name, _C.VSsetinterlace(self._id, value), 'cannot set _interlace property') elif name == "_name": _checkErr(name, _C.VSsetname(self._id, value), 'cannot set _name property') # Try to set the attribute. else: _setattr(self, name, value) def __getitem__(self, elem): # This method is called when the vdata is read # like a Python sequence. # Parse the indexing expression. start, count = self.__buildStartCount(elem) # Reset current position if necessary. if self._offset != start[0]: self.seek(start[0]) # Get records. A negative count means that an index was used. recs = self.read(abs(count[0])) # See if all the fields must be returned. f0 = start[1] if f0 == 0 and count[1] == self._nfields: out = recs else: # Return only a subset of the vdata fields. out = [] f1 = f0 + count[1] for r in recs: out.append(r[f0:f1]) # If an index was used (not a slice), return the record as # a list, instead of returning it inside a 2-level list, if count[0] < 0: return out[0] return out def __setitem__(self, elem, data): # This method is called when the vdata is written # like a Python sequence. # # When indexing the vdata, 'data' must specify exactly # one record, which must be specified as a sequence. If the index is # equal to the current number of records, the record # is appended to the vdata. # # When slicing the vdata, 'data' must specify a list of records. # The number of records in the top level-list must match the width # of the slice, except if the slice extends past the end of the # vdata. In that case, extra records can be specified in the list, # which will be appended to the vdata. In other words, # to append records to vdata 'vd', assign records to # the slice 'vd[vd._nrecs:]'. # # For ex., given a vdata 'vd' holding 5 records, and lists # 'reca', 'recb', etc holding record values: # vd[0] = reca # updates record 0 # vd[1] = [recb, recc] # error: only one record allowed # vd[1:3] = [reca,recb] # updates second and third record # vd[1:4] = [reca, recb] # error: 3 records needed # vd[5:] = [reca,recb] # appends 2 records to the vdata # Check that arg is a list. if not type(data) in [tuple, list]: raise HDF4Error("record(s) must be specified as a list") start, count = self.__buildStartCount(elem, setitem=1) # Records cannot be partially written. if start[1] != 0 or count[1] != self._nfields: raise HDF4Error("each vdata field must be written") # If an index (as opposed to a slice) was applied to the # vdata, a single record must be passed. Since write() requires # a 2-level list, wrap this record inside a list. if count[0] < 0: if len(data) != self._nfields: raise HDF4Error("record does not specify all fields") data = [data] # A slice was used. The slice length must match the number of # records, except if the end of the slice equals the number # of records. Then, extra recors can be specified, which will # be appended to the vdata. else: if count[0] != len(data): if start[0] + count[0] != self._nrecs: raise HDF4Error("illegal number of records") # Reset current record position if necessary. if self._offset != start[0]: self.seek(start[0]) # Write records. recs = self.write(data) def __del__(self): """Delete the instance, first calling the detach() method if not already done. """ try: if self._id: self.detach() except: pass def detach(self): """Terminate access to the vdata. Args:: no argument Returns:: None C library equivalent : VSdetach """ _checkErr('detach', _C.VSdetach(self._id), "cannot detach vdata") self._id = None def fdefine(self, name, type, order): """Define a field. To initialize a newly created vdata with fields created with fdefine(), assign a tuple of field names to the _fields attribute or call the setfields() method. Args:: name field name type field data type (one of HC.xxx) order field order (number of values in the field) Returns:: None C library equivalent : VSfdefine """ _checkErr('fdefine', _C.VSfdefine(self._id, name, type, order), 'cannot define field') def setfields(self, *fldNames): """Define the name and order of the fields to access with the read() and write() methods. Args:: fldNames variable length argument specifying one or more vdata field names Returns:: None C library equivalent : VSsetfields setfields() indicates how to perform the matching between the vdata fields and the values passed to the write() method or returned by the read() method. For example, if the vdata contains fields 'a', 'b' and 'c' and a "setfields('c','a')" call is made, read() will thereafter return for each record the values of field 'c' and 'a', in that order. Field 'b' will be ignored. When writing to a vdata, setfields() has a second usage. It is used to initialize the structure of the vdata, that is, the name and order of the fields that it will contain. The fields must have been previously defined by calls to the fdefine() method. Following that first call, setfields() can be called again to change the order in which the record values will be passed to the write() method. However, since it is mandatory to write whole records, subsequent calls to setfields() must specify every field name: only the field order can be changed. """ _checkErr('setfields', _C.VSsetfields(self._id, ','.join(fldNames)), 'cannot execute') self._setfields = fldNames # remember for read/write routines def field(self, name_index): """Get a VDField instance representing a field of the vdata. Args:: name_index name or index number of the field Returns:: VDfield instance representing the field C library equivalent : no equivalent """ # Transform a name to an index number if isinstance(name_index, str): status, index = _C.VSfindex(self._id, name_index) _checkErr('field', status, "illegal field name: %s" % name_index) else: n = _C.VFnfields(self._id) _checkErr('field', n, 'cannot execute') index = name_index if index >= n: raise HDF4Error("field: illegal index number") return VDField(self, index) def seek(self, recIndex): """Seek to the beginning of the record identified by its record index. A succeeding read will load this record in memory. Args:: recIndex index of the record in the vdata; numbering starts at 0. Legal values range from 0 (start of vdata) to the current number of records (at end of vdata). Returns:: record index An exception is raised if an attempt is made to seek beyond the last record. The C API prohibits seeking past the next-to-last record, forcing one to read the last record to advance to the end of the vdata. The python API removes this limitation. Seeking to the end of the vdata can also be done by calling method ``seekend()``. C library equivalent : VSseek """ if recIndex > self._nrecs - 1: if recIndex == self._nrecs: return self.seekend() else: raise HDF4Error("attempt to seek past last record") n = _C.VSseek(self._id, recIndex) _checkErr('seek', n, 'cannot seek') self._offset = n return n def seekend(self): """Set the current record position past the last vdata record. Subsequent write() calls will append records to the vdata. Args:: no argument Returns:: index of the last record plus 1 C library equivalent : no equivalent """ try: # Seek to the next-to-last record position n = self.seek(self._nrecs - 1) # updates _offset # Read last record, ignoring values self.read(1) # updates _offset return self._nrecs except HDF4Error: raise HDF4Error("seekend: cannot execute") def tell(self): """Return current record position in the vdata. Args:: no argument Returns:: current record position; 0 is at start of vdata. C library equivalent : no equivalent """ return self._offset def read(self, nRec=1): """Retrieve the values of a number of records, starting at the current record position. The current record position is advanced by the number of records read. Current position is 0 after "opening" the vdata with the attach() method. Args:: nRec number of records to read Returns:: 2-level list. First level is a sequence of records, second level gives the sequence of values for each record. The values returned for each record are those of the fields specified in the last call to method setfields(), in that order. The complete vdata field set is returned if setfields() has not been called. An exception is raised if the current record position is already at the end of the vdata when read() is called. This exception can be caught as an "end of vdata" indication to exit a loop which scans each record of the vdata. Otherwise, the number of records to be read is lowered to the number of records remaining in the vdata, if that number is less than the number asked for by parameter 'nRec'. Setting 'nRec' to an arbitrarily large value can thus be used to retrieve the remaining records in the vdata. C library equivalent : VSread """ # Validate number of records to read vs the current offset. # Return "end of vdata" exception if already at end of vdata # otherwise "clip" the number of records if it exceeds the # number of remaining records in the vdata. n = self._nrecs if self._offset == n: raise HDF4Error("end of vdata reached") if self._offset + nRec > n: nRec = self._offset + nRec - n fields = self._setfields or self._fields nFields = len(fields) fieldList = ','.join(fields) _checkErr('read', _C.VSsetfields(self._id, fieldList), 'error defining fields to read') # Allocate a buffer to store the packed records. bufSize = self.sizeof(fields) * nRec bigBuf = _C.array_byte(bufSize) # Read records nRead = _C.VSread(self._id, bigBuf, nRec, 0) # 0: FULL_INTERLACE _checkErr('read', nRead, 'read error') self._offset += nRec # Allocate an array to store a pointer to the field buffer. fldArr = _C.new_array_voidp(1) # Initialize return value values = [] for numRec in range(nRead): v = [] for numFld in range(nFields): v.append(None) values.append(v) # Unpack each field in turn. for numFld in range(nFields): fld = self.field(fields[numFld]) data_type = fld._type order = fld._order n_values = order * nRead # Allocate a buffer to store the field values. if data_type in [HC.CHAR8, HC.UCHAR8, HC.UINT8]: buf = _C.array_byte(n_values) elif data_type == HC.INT8: buf = _C.array_int8(n_values) elif data_type == HC.INT16: buf = _C.array_int16(n_values) elif data_type == HC.UINT16: buf = _C.array_uint16(n_values) elif data_type == HC.INT32: buf = _C.array_int32(n_values) elif data_type == HC.UINT32: buf = _C.array_uint32(n_values) elif data_type == HC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == HC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("read: illegal or unupported type %d" % \ data_type) # Unpack the field values. _C.array_voidp_setitem(fldArr, 0, buf) _checkErr('read', _C.VSfpack(self._id, 1, fieldList, bigBuf, bufSize, nRead, fld._name, fldArr), "cannot execute") # Extract values from the field buffer. k = 0 for numRec in range(nRead): if order == 1: values[numRec][numFld] = buf[k] k += 1 else: # Handle strings specially if data_type == HC.CHAR8: s = '' for i in range(order): v = buf[k] if v != 0: s += chr(v) k += 1 values[numRec][numFld] = s # Return field values as a list else: values[numRec][numFld] = [] for i in range(order): values[numRec][numFld].append(buf[k]) k += 1 del buf return values def write(self, values): """Write records to the vdata. Writing starts at the current record position, which is advanced by the number of records written. Args:: values: 2-level sequence. First level is a sequence of records. A second level gives the sequence of record values. It is mandatory to always write whole records. Thus every record field must appear at the second level. The record values are ordered according the list of field names set in the last call to the setfields() method. The ordre of the complete vdata field set is used if setfields() has not been called. Returns:: number of records written To append to a vdata already holding 'n' records, it is necessary to first move the current record position to 'n-1' with a call to method seek(), then to call method read() for the side effect of advancing the current record position past this last record. Method seekend() does just that. C library equivalent : VSwrite """ nFields = self._nfields # Fields give the order the record values, as defined in the # last call to setfields() fields = self._setfields or self._fields # We must pack values using the effective field order in the vdata fieldList = ','.join(self._fields) # Validate the values argument. if nFields != len(fields): raise HDF4Error("write: must write whole records") if type(values) not in [list, tuple]: raise HDF4Error("write: values must be a sequence") nRec = len(values) for n in range(nRec): rec = values[n] if type(rec) not in [list, tuple]: raise HDF4Error("write: records must be given as sequences") # Make sure each record is complete. if len(rec) != nFields: raise HDF4Error("write: records must specify every field") # Allocate a buffer to store the packed records. bufSize = self._recsize * nRec bigBuf = _C.array_byte(bufSize) # Allocate an array to store a pointer to the field buffer. fldArr = _C.new_array_voidp(1) # Pack each field in turn. for numFld in range(nFields): fld = self.field(fields[numFld]) data_type = fld._type order = fld._order n_values = order * nRec # Allocate a buffer to store the field values. if data_type in [HC.CHAR8, HC.UCHAR8, HC.UINT8]: buf = _C.array_byte(n_values) elif data_type == HC.INT8: buf = _C.array_int8(n_values) elif data_type == HC.INT16: buf = _C.array_int16(n_values) elif data_type == HC.UINT16: buf = _C.array_uint16(n_values) elif data_type == HC.INT32: buf = _C.array_int32(n_values) elif data_type == HC.UINT32: buf = _C.array_uint32(n_values) elif data_type == HC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == HC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("write: illegal or unupported type %d" % \ data_type) # Load the field buffer with values. k = 0 for numRec in range(nRec): val = values[numRec][numFld] # Single-valued field if order == 1: buf[k] = val k += 1 # Multi-valued field else: # Handle strings specially. if data_type == HC.CHAR8: if not isinstance(val, str): raise HDF4Error("char fields must be set with strings") n = len(val) for i in range(order): buf[k] = i < n and ord(val[i]) or 0 k += 1 # Should validate field elements ... elif type(val) not in [list, tuple]: raise HDF4Error("multi-values fields must be given as sequences") else: for i in range(order): buf[k] = val[i] k += 1 # Store address of the field buffer in first position # of the field array. Pack the field values. _C.array_voidp_setitem(fldArr, 0, buf) # fldArr[0] = buf _checkErr('write', _C.VSfpack(self._id, 0, fieldList, bigBuf, bufSize, nRec, fld._name, fldArr), "cannot execute") del buf # Write the packed records. n = _C.VSwrite(self._id, bigBuf, nRec, 0) # 0: FULL_INTERLACE _checkErr('write', n, 'cannot execute') self._offset += nRec return n def inquire(self): """Retrieve info about the vdata. Args:: no argument Returns:: 5-element tuple with the following elements: -number of records in the vdata -interlace mode -list of vdata field names -size in bytes of the vdata record -name of the vdata C library equivalent : VSinquire """ status, nRecs, interlace, fldNames, size, vName = \ _C.VSinquire(self._id) _checkErr('inquire', status, "cannot query vdata info") return nRecs, interlace, fldNames.split(','), size, vName def fieldinfo(self): """Retrieve info about all vdata fields. Args:: no argument Returns:: list where each element describes a field of the vdata; each field is described by an 7-element tuple containing the following elements: - field name - field data type (one of HC.xxx constants) - field order - number of attributes attached to the field - field index number - field external size - field internal size C library equivalent : no equivalent """ lst = [] for n in range(self._nfields): fld = self.field(n) lst.append((fld._name, fld._type, fld._order, fld._nattrs, fld._index, fld._esize, fld._isize)) return lst def sizeof(self, fields): """Retrieve the size in bytes of the given fields. Args:: fields sequence of field names to query Returns:: total size of the fields in bytes C library equivalent : VSsizeof """ if type(fields) in [tuple, list]: str = ','.join(fields) else: str = fields n = _C.VSsizeof(self._id, str) _checkErr('sizeof', n, "cannot retrieve field sizes") return n def fexist(self, fields): """Check if a vdata contains a given set of fields. Args:: fields sequence of field names whose presence in the vdata must be checked Returns:: true (1) if the given fields are present false (0) otherwise C library equivalent : VSfexist """ if type(fields) in [tuple, list]: str = ','.join(fields) else: str = fields ret = _C.VSfexist(self._id, str) if ret < 0: return 0 else: return 1 def attr(self, name_or_index): """Create a VDAttr instance representing a vdata attribute. Args:: name_or_index attribute name or index number; if a name is given, the attribute may not exist; in that case, it will be created when the VSAttr instance set() method is called Returns:: VSAttr instance for the attribute. Call the methods of this class to query, read or set the attribute. C library equivalent : no equivalent """ return VDAttr(self, name_or_index, -1) # -1: vdata attribute def findattr(self, name): """Search the vdata for a given attribute. Args:: name attribute name Returns:: if found, VDAttr instance describing the attribute None otherwise C library equivalent : VSfindattr """ try: att = self.attr(name) if att._index is None: att = None except HDF4Error: att = None return att def attrinfo(self): """Return info about all the vdata attributes. Args:: no argument Returns:: dictionary describing each vdata attribute; for each attribute a (name,data) pair is added to the dictionary, where 'data' is a tuple holding: - attribute data type (one of HC.xxx constants) - attribute order - attribute value - attribute size in bytes C library equivalent : no equivalent """ dic = {} for n in range(self._nattrs): att = self.attr(n) name, type, order, size = att.info() dic[name] = (type, order, att.get(), size) return dic def __buildStartCount(self, elem, setitem=0): # Called by __getitem__() and __setitem__() methods # to parse the expression used inside square brackets to # index/slice a vdata. # If 'setitem' is set, the call comes from __setitem__() # We then allow the start value to be past the last record # so as to be able to append to the vdata. # # Return a 2-element tuple: # - tuple of the start indices along the vdata dimensions # - tuple of the count values along the vdata dimensions # a count of -1 indicates that an index, not a slice # was applied on the correcponding dimension. # Make sure the indexing expression does not exceed the # vdata number of dimensions (2). if isinstance(elem, tuple): if len(elem) > 2: raise HDF4Error("illegal indexing expression") else: # Convert single index to sequence elem = [elem] start = [] count = [] shape = [self._nrecs, self._nfields] n = -1 for e in elem: n += 1 # Simple index if isinstance(e, int): is_slice = False if e < 0: e += shape[n] if e < 0 or e >= shape[n]: if e == shape[n] and setitem: pass else: raise HDF4Error("index out of range") beg = e end = e + 1 # Slice index elif isinstance(e, slice): is_slice = True # None or 0 means not specified if e.start: beg = e.start if beg < 0: beg += shape[n] else: beg = 0 # None or maxint means not specified if e.stop and e.stop != sys.maxsize: end = e.stop if end < 0: end += shape[n] else: end = shape[n] # Bug else: raise ValueError("invalid indexing expression") # Clip end index and compute number of elements to get if end > shape[n]: end = shape[n] if beg > end: beg = end if is_slice: cnt = end - beg else: cnt = -1 start.append(beg) count.append(cnt) if n == 0: start.append(0) count.append(shape[1]) return start, count class VDField(object): """The VDField class represents a vdata field. To create a VDField instance, call the field() method of a VD class instance. """ def __init__(self, vdinst, fIndex): # This method should not be called directly by the user program. # To create a VDField instance, obtain a VD class instance and # call its field() method. # Args: # vdinst VD instance to which the field belongs # fIndex field index # # Private attributes: # _vd_inst VD instance to which the field belongs # _idx field index self._vd_inst = vdinst self._idx = fIndex def __getattr__(self, name): """Some field properties can be queried through the following read-only attributes. Their names all start with an "_" to avoid clashes with user-defined attributes. Name Description C library routine ----- ------------------- ----------------- _esize field external size VFfieldesize _index field index number VSfindex _isize field internal size VFfieldisize _name field name VFfieldname _nattrs number of attributes VSfnattrs _order field order VFfieldorder _type field type VFfieldtype """ # Check for a user defined attribute first. att = self.attr(name) if att._index is not None: # Then the attribute exists return att.get() # Check for a predefined attribute. elif name == "_esize": n = _C.VFfieldesize(self._vd_inst._id, self._idx) _checkErr('_esize', n, "execution error") return n elif name == "_index": return self._idx elif name == "_isize": n = _C.VFfieldisize(self._vd_inst._id, self._idx) _checkErr('_isize', n, "execution error") return n elif name == "_name": n = _C.VFfieldname(self._vd_inst._id, self._idx) _checkErr('_name', n, "execution error") return n elif name == "_nattrs": n = _C.VSfnattrs(self._vd_inst._id, self._idx) _checkErr('_nattrs', n, "execution error") return n elif name == "_order": n = _C.VFfieldorder(self._vd_inst._id, self._idx) _checkErr('_order', n, "execution error") return n elif name == "_type": type = _C.VFfieldtype(self._vd_inst._id, self._idx) _checkErr('_type', type, 'cannot retrieve field type') return type raise AttributeError def __setattr__(self, name, value): # Forbid assigning to our predefined attributes if name in ["_esize", "_index", "_isize", "_name", "_nattrs", "_order", "_type"]: raise AttributeError("%s: read-only attribute" % name) # Try to set the attribute. else: _setattr(self, name, value) def attr(self, name_or_index): """Create a VDAttr instance representing a field attribute. Args:: name_or_index attribute name or index number; if a name is specified, the attribute may not exist; in that case, it will be created when the VDAttr instance set() method is called; if an index number is specified, the attribute must exist Returns:: VSAttr instance for the attribute. Call the methods of this class to query, read or set the attribute. C library equivalent : no equivalent """ return VDAttr(self, name_or_index, self._idx) def find(self, name): """Search the field for a given attribute. Args:: name attribute name Returns:: if found, VDAttr instance describing the attribute None otherwise C library equivalent : VSfindattr """ try: att = self.attr(name) if att._index is None: att = None except HDF4Error: att = None return att def attrinfo(self): """Return info about all the field attributes. Args:: no argument Returns:: dictionary describing each vdata attribute; for each attribute a (name,data) pair is added to the dictionary, where 'data' is a tuple holding: - attribute data type (one of HC.xxx constants) - attribute order - attribute value - attribute size in bytes C library equivalent : no equivalent """ dic = {} for n in range(self._nattrs): att = self.attr(n) name, type, order, size = att.info() dic[name] = (type, order, att.get(), size) return dic class VDAttr(object): """The VDAttr class encapsulates methods used to set and query attributes defined at the level either of the vdata or of the vdata field. To create an instance of this class, call the attr() method of a VD (vdata) or VDField (vdata field) instance. """ def __init__(self, obj, name_or_index, fIndex): # This constructor should not be called directly by the user # program. The attr() method of a VD (vdata) or VDField # (vdata field) must be called to instantiate this class. # Args: # obj object instance (VD or VDField) to which the # attribute belongs # name_or_index name or index of the attribute; if a name is # given, an attribute with that name will be # searched, if not found, a new index number will # be generated # fIndex field index, or -1 if the attribute belongs # to the vdata # Private attributes: # _vd_inst VD instance # _vdf_inst VDField instance or None # _index attribute index or None # _name attribute name or None # _fIndex field index, or -1 obj is a VD instance if isinstance(obj, VD): self._vd_inst = obj self._vdf_instance = None self._fIndex = -1 else: self._vd_inst = obj._vd_inst self._vdf_inst = obj self._fIndex = fIndex # Name is given. Attribute may exist or not. if isinstance(name_or_index, type('')): self._name = name_or_index self._index = _C.VSfindattr(self._vd_inst._id, self._fIndex, self._name); if self._index < 0: self._index = None # Index is given. Attribute Must exist. else: self._index = name_or_index status, self._name, data_type, n_values, size = \ _C.VSattrinfo(self._vd_inst._id, self._fIndex, self._index) _checkErr('attr', status, 'non-existent attribute') def get(self): """Retrieve the attribute value. Args:: no argument Returns:: attribute value(s); a list is returned if the attribute is made up of more than one value, except in the case of a string-valued attribute (data type HC.CHAR8) where the values are returned as a string C library equivalent : VSgetattr """ # Make sure th attribute exists. if self._index is None: raise HDF4Error("non existent attribute") # Obtain attribute type and the number of values. status, aName, data_type, n_values, size = \ _C.VSattrinfo(self._vd_inst._id, self._fIndex, self._index) _checkErr('get', status, 'illegal parameters') # Get attribute value. convert = _array_to_ret if data_type == HC.CHAR8: buf = _C.array_byte(n_values) convert = _array_to_str elif data_type in [HC.UCHAR8, HC.UINT8]: buf = _C.array_byte(n_values) elif data_type == HC.INT8: buf = _C.array_int8(n_values) elif data_type == HC.INT16: buf = _C.array_int16(n_values) elif data_type == HC.UINT16: buf = _C.array_uint16(n_values) elif data_type == HC.INT32: buf = _C.array_int32(n_values) elif data_type == HC.UINT32: buf = _C.array_uint32(n_values) elif data_type == HC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == HC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("get: attribute index %d has an "\ "illegal or unupported type %d" % \ (self._index, data_type)) status = _C.VSgetattr(self._vd_inst._id, self._fIndex, self._index, buf) _checkErr('get', status, 'illegal attribute ') return convert(buf, n_values) def set(self, data_type, values): """Set the attribute value. Args:: data_type : attribute data type (see constants HC.xxx) values : attribute value(s); specify a list to create a multi-valued attribute; a string valued attribute can be created by setting 'data_type' to HC.CHAR8 and 'values' to the corresponding string If the attribute already exists, it will be updated. However, it is illegal to try to change its data type or its order (number of values). Returns:: None C library equivalent : VSsetattr """ try: n_values = len(values) except: values = [values] n_values = 1 if data_type == HC.CHAR8: buf = _C.array_byte(n_values) # Allow values to be passed as a string. # Noop if a list is passed. values = list(values) for n in range(n_values): if not isinstance(values[n], int): values[n] = ord(values[n]) elif data_type in [HC.UCHAR8, HC.UINT8]: buf = _C.array_byte(n_values) elif data_type == HC.INT8: # SWIG refuses negative values here. We found that if we # pass them as byte values, it will work. buf = _C.array_int8(n_values) values = list(values) for n in range(n_values): v = values[n] if v >= 0: v &= 0x7f else: v = abs(v) & 0x7f if v: v = 256 - v else: v = 128 # -128 in 2s complement values[n] = v elif data_type == HC.INT16: buf = _C.array_int16(n_values) elif data_type == HC.UINT16: buf = _C.array_uint16(n_values) elif data_type == HC.INT32: buf = _C.array_int32(n_values) elif data_type == HC.UINT32: buf = _C.array_uint32(n_values) elif data_type == HC.FLOAT32: buf = _C.array_float32(n_values) elif data_type == HC.FLOAT64: buf = _C.array_float64(n_values) else: raise HDF4Error("set: illegal or unimplemented data_type") for n in range(n_values): buf[n] = values[n] status = _C.VSsetattr(self._vd_inst._id, self._fIndex, self._name, data_type, n_values, buf) _checkErr('attr', status, 'cannot execute') # Update the attribute index self._index = _C.VSfindattr(self._vd_inst._id, self._fIndex, self._name); if self._index < 0: raise HDF4Error("set: error retrieving attribute index") def info(self): """Retrieve info about the attribute. Args:: no argument Returns:: 4-element tuple with the following components: -attribute name -attribute data type (one of HC.xxx constants) -attribute order (number of values) -attribute size in bytes C library equivalent : VSattrinfo """ # Make sure the attribute exists. if self._index is None: raise HDF4Error("non existent attribute") status, name, type, order, size = \ _C.VSattrinfo(self._vd_inst._id, self._fIndex, self._index) _checkErr('info', status, "execution error") return name, type, order, size ########################### # Support functions ########################### def _setattr(obj, name, value): # Called by the __setattr__ method of the VD and VDField objects. # # obj instance on which the attribute is set # name attribute name # value attribute value if isinstance(value, six.string_types): value = value.encode('utf8') # Treat a name starting with and underscore as that of a # standard python instance attribute. if name[0] == '_': obj.__dict__[name] = value return # Treat everything else as an HDF attribute. if type(value) not in [list, tuple]: value = [value] typeList = [] for v in value: t = type(v) # Prohibit mixing numeric types and strings. if t in [int, float] and \ not bytes in typeList: if t not in typeList: typeList.append(t) # Prohibit sequence of strings or a mix of numbers and string. elif t == bytes and not typeList: typeList.append(t) else: typeList = [] break if bytes in typeList: xtype = HC.CHAR8 value = value[0] # double is "stronger" than int elif float in typeList: xtype = HC.FLOAT64 elif int in typeList: xtype = HC.INT32 else: raise HDF4Error("Illegal attribute value") # Assign value try: a = obj.attr(name) a.set(xtype, value) except HDF4Error as msg: raise HDF4Error("cannot set attribute: %s" % msg) def _array_to_ret(buf, nValues): # Convert array 'buf' to a scalar or a list. if nValues == 1: ret = buf[0] else: ret = [] for i in xrange(nValues): ret.append(buf[i]) return ret def _array_to_str(buf, nValues): # Convert array of bytes 'buf' to a string. # Return empty string if there is no value. if nValues == 0: return "" # When there is just one value, _array_to_ret returns a scalar # over which we cannot iterate. if nValues == 1: chrs = [chr(buf[0])] else: chrs = [chr(b) for b in _array_to_ret(buf, nValues)] # Strip NULL at end if chrs[-1] == '\0': del chrs[-1] return ''.join(chrs) pyhdf-0.10.3/pyhdf/__init__.py000066400000000000000000000001071405105412500161230ustar00rootroot00000000000000# $Id: __init__.py,v 1.3 2004-08-02 15:22:59 gosselin Exp $ # $Log : $ pyhdf-0.10.3/pyhdf/error.py000066400000000000000000000011441405105412500155170ustar00rootroot00000000000000# $Id: error.py,v 1.1 2004-08-02 15:00:34 gosselin Exp $ # $Log: not supported by cvs2svn $ from . import hdfext as _C # ################# # Error processing # ################# class HDF4Error(Exception): """ An error from inside the HDF4 library. """ def _checkErr(procName, val, msg=""): if val is None or (not isinstance(val, str) and val < 0): #_C._HEprint(); errCode = _C.HEvalue(1) if errCode != 0: err = "%s (%d): %s" % (procName, errCode, _C.HEstring(errCode)) else: err = "%s : %s" % (procName, msg) raise HDF4Error(err) pyhdf-0.10.3/pyhdf/hdfext.i000066400000000000000000000703751405105412500154640ustar00rootroot00000000000000/* * $Id: hdfext.i,v 1.7 2008-06-30 02:41:44 gosselin_a Exp $ * $Log: not supported by cvs2svn $ * Revision 1.6 2005/07/14 01:36:41 gosselin_a * pyhdf-0.7-3 * Ported to HDF4.2r1. * Support for SZIP compression on SDS datasets. * All classes are now 'new-style' classes, deriving from 'object'. * Update documentation. * * Revision 1.5 2004/11/02 21:33:39 gosselin * *** empty log message *** * * Revision 1.3 2004/08/02 15:36:04 gosselin * pyhdf-0.7-1 * * Revision 1.2 2004/08/02 15:22:59 gosselin * pyhdf-0.6-1 * * Revision 1.1 2004/08/02 15:00:34 gosselin * Initial revision * */ %module hdfext %include "typemaps.i" %include "cstring.i" %include "carrays.i" /* ********************************************************************* */ /* HDF type info codes */ /* ******************* */ #define DFNT_NONE 0 /* indicates that number type not set */ #define DFNT_QUERY 0 /* use this code to find the current type */ #define DFNT_VERSION 1 /* current version of NT info */ #define DFNT_FLOAT32 5 #define DFNT_FLOAT 5 /* For backward compat; don't use */ #define DFNT_FLOAT64 6 #define DFNT_DOUBLE 6 /* For backward compat; don't use */ #define DFNT_FLOAT128 7 /* No current plans for support */ #define DFNT_INT8 20 #define DFNT_UINT8 21 #define DFNT_INT16 22 #define DFNT_UINT16 23 #define DFNT_INT32 24 #define DFNT_UINT32 25 #define DFNT_INT64 26 #define DFNT_UINT64 27 #define DFNT_INT128 28 /* No current plans for support */ #define DFNT_UINT128 30 /* No current plans for support */ #define DFNT_UCHAR8 3 /* 3 chosen for backward compatibility */ #define DFNT_UCHAR 3 /* uchar=uchar8 for backward compatibility */ #define DFNT_CHAR8 4 /* 4 chosen for backward compatibility */ #define DFNT_CHAR 4 /* uchar=uchar8 for backward compatibility */ #define DFNT_CHAR16 42 /* No current plans for support */ #define DFNT_UCHAR16 43 /* No current plans for support */ #define SD_UNLIMITED 0 #define SD_FILL 0 #define SD_NOFILL 256 #define CHAR_BUFFER_SIZE 4096 #define ATTRIB_BUFFER_SIZE 128 /* ********************************************************************* */ /* internal file access codes */ #define DFACC_READ 1 #define DFACC_WRITE 2 #define DFACC_CREATE 4 #define DFACC_ALL 7 #define DFACC_RDONLY 1 #define DFACC_RDWR 3 #define DFACC_CLOBBER 4 /* New file access codes (for Hstartaccess only, currently) */ #define DFACC_BUFFER 8 /* buffer the access to this AID */ #define DFACC_APPENDABLE 0x10 /* make this AID appendable */ #define DFACC_CURRENT 0x20 /* start looking for a tag/ref from the current */ /* location in the DD list (useful for continued */ /* searching ala findfirst/findnext) */ /* External Element File access mode */ /* #define DFACC_CREATE 4 is for creating new external element file */ #define DFACC_OLD 1 /* for accessing existing ext. element file */ /* Compression codes */ #define COMP_CODE_NONE 0 #define COMP_CODE_RLE 1 #define COMP_CODE_NBIT 2 #define COMP_CODE_SKPHUFF 3 #define COMP_CODE_DEFLATE 4 #define COMP_CODE_SZIP 5 /* Tags */ #define DFTAG_NDG 720 #define DFTAG_VH 1962 #define DFTAG_VG 1965 /* limits */ %constant int H4_MAX_VAR_DIMS = H4_MAX_VAR_DIMS; %array_class(unsigned char, array_byte); %array_class(signed char, array_int8); %array_class(short, array_int16); %array_class(unsigned short, array_uint16); %array_class(int, array_int32); %array_class(unsigned int, array_uint32); %array_class(float, array_float32); %array_class(double, array_float64); %array_functions(void *, array_voidp); typedef int int32; typedef int intn; typedef int uint32; typedef short int16; typedef unsigned char uint8; %{ #include "hdf.h" #include "mfhdf.h" %} /* *************** * Basic HDF API *************** */ /* * Opening and closing HDF file. */ extern int32 Hopen(const char *filename, intn access_mode, int num_dds_blocks); extern intn Hclose(int32 file_id); /* * Library version. */ %cstring_bounded_output(char *string, CHAR_BUFFER_SIZE); extern intn Hgetlibversion(uint32 *OUTPUT, /* major_v */ uint32 *OUTPUT, /* minor_v */ uint32 *OUTPUT, /* release */ char *string); extern intn Hgetfileversion(int32 file_id, uint32 *OUTPUT, /* major_v */ uint32 *OUTPUT, /* minor_v */ uint32 *OUTPUT, /* release */ char *string); %clear char *string; /* * Inquiry. */ extern intn Hishdf(const char *filename); /* *********** * Error API *********** */ %{ #include void _HEprint(void) { HEprint(stderr,0); } %} extern int32 HEvalue(int32 error_stack_offset); extern const char *HEstring(int32 error_code); extern void _HEprint(void); /* ******** * SD API ******** */ /* * Interface to numpy, which is used to read and write * SD array data. */ %init %{ /* Init numpy. Mandatory, otherwise the extension will bomb. */ import_array(); %} %{ #include "hdfi.h" /* declares int32, float32, etc */ #include "numpy/oldnumeric.h" #define DFNT_FLOAT32 5 #define DFNT_FLOAT 5 /* For backward compat; don't use */ #define DFNT_FLOAT64 6 #define DFNT_DOUBLE 6 /* For backward compat; don't use */ #define DFNT_FLOAT128 7 /* No current plans for support */ #define DFNT_INT8 20 #define DFNT_UINT8 21 #define DFNT_INT16 22 #define DFNT_UINT16 23 #define DFNT_INT32 24 #define DFNT_UINT32 25 #define DFNT_INT64 26 #define DFNT_UINT64 27 #define DFNT_UCHAR8 3 /* 3 chosen for backward compatibility */ #define DFNT_UCHAR 3 /* uchar=uchar8 for backward compatibility */ #define DFNT_CHAR8 4 /* 4 chosen for backward compatibility */ #define DFNT_CHAR 4 /* uchar=uchar8 for backward compatibility */ static int HDFtoNumericType(int hdf) { int num; switch (hdf) { case DFNT_FLOAT32: num = PyArray_FLOAT; break; case DFNT_FLOAT64: num = PyArray_DOUBLE; break; case DFNT_INT8 : num = PyArray_SBYTE; break; case DFNT_UINT8 : num = PyArray_UBYTE; break; case DFNT_INT16 : num = PyArray_SHORT; break; #ifndef NOUINT case DFNT_UINT16 : num = PyArray_USHORT; break; #endif case DFNT_INT32 : num = PyArray_INT; break; #ifndef NOUINT case DFNT_UINT32 : num = PyArray_UINT; break; #endif case DFNT_CHAR8 : num = PyArray_CHAR; break; case DFNT_UCHAR8 : num = PyArray_UBYTE; break; default: num = -1; break; } return num; } static PyObject * _SDreaddata_0(int32 sds_id, int32 data_type, PyObject *start, PyObject *edges, PyObject *stride) { /* * A value of -1 in 'edges' indicates that the dimension * is indexed, not sliced. This dimension should be removed from * the output array. */ PyArrayObject *array; PyObject *o; int n, rank, outRank, num_type, status; /* * Allocate those arrays on the stack for simplicity. * 80 dimensions should be more than enough! */ int startArr[80], strideArr[80], edgesArr[80]; npy_intp dims[80]; float f32; double f64; int i32; /* * Load arrays. Caller has guaranteeded that all 3 arrays have the * same dimensions. */ rank = PyObject_Length(start); outRank = 0; dims[0] = 0; for (n = 0; n < rank; n++) { o = PySequence_GetItem(start, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg start contains a non-integer"); return NULL; } startArr[n] = PyInt_AsLong(o); o = PySequence_GetItem(edges, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg edges contains a non-integer"); return NULL; } /* * Do as numpy when a dimension is indexed (indicated by * a count of -1). * This dimension is then dropped from the output array, * producing a subarray. For ex., if m is a 3x3 array, m[0] * is a 3 element vector holding the first row of `m'. * Variables `outRank' and `dims' store the resulting array * rank and dimension lengths, resp. */ edgesArr[n] = PyInt_AsLong(o); if (edgesArr[n] != -1) { dims[outRank++] = abs(edgesArr[n]); } else edgesArr[n] = 1; o = PySequence_GetItem(stride, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg stride contains a non-integer"); return NULL; } strideArr[n] = PyInt_AsLong(o); } /* * Create output numpy array. */ if ((num_type = HDFtoNumericType(data_type)) < 0) { PyErr_SetString(PyExc_ValueError, "data_type not compatible with numpy"); return NULL; } if ((array = (PyArrayObject *) PyArray_SimpleNew(outRank, dims, num_type)) == NULL) return NULL; /* * Load it from the SDS. */ status = SDreaddata(sds_id, startArr, strideArr, edgesArr, array -> data); if (status < 0) { PyErr_SetString(PyExc_ValueError, "SDreaddata failure"); Py_DECREF(array); /* Free array */ return NULL; } /* * Return array. * PyArray_Return() does not seem to work ok. * Deal ourselves with the 0 rank case. */ /* return PyArray_Return(array); */ if (outRank > 0) return (PyObject *) array; switch (num_type) { case PyArray_FLOAT: f32 = *(float *) array->data; o = PyFloat_FromDouble((double) f32); break; case PyArray_DOUBLE: f64 = *(double *) array->data; o = PyFloat_FromDouble(f64); break; case PyArray_CHAR: case PyArray_SBYTE: i32 = *(char *) array->data; o = PyInt_FromLong((long) i32); break; case PyArray_UBYTE: i32 = *(unsigned char *) array->data; o = PyInt_FromLong((long) i32); break; case PyArray_SHORT: i32 = *(short *) array->data; o = PyInt_FromLong((long) i32); break; case PyArray_INT: i32 = *(int *) array->data; o = PyInt_FromLong((long) i32); break; } Py_DECREF(array); /* Free array */ return o; } static PyObject * _SDwritedata_0(int32 sds_id, int32 data_type, PyObject *start, PyObject *edges, PyObject *data, PyObject *stride) { PyArrayObject *array; PyObject *o; int n, rank, num_type, status; /* * Allocate those arrays on the stack for simplicity. * 80 dimensions should be more than enough! */ int startArr[80], strideArr[80], edgesArr[80]; /* * Load arrays. Caller has guaranteeded that all 3 arrays have the * same dimensions. */ rank = PyObject_Length(start); for (n = 0; n < rank; n++) { o = PySequence_GetItem(start, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg start contains a non-integer"); return NULL; } startArr[n] = PyInt_AsLong(o); o = PySequence_GetItem(edges, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg edges contains a non-integer"); return NULL; } /* * A value of -1 indicates that an index, not a slice, was applied * to the dimension. This difference is significant only for a * `get' operation. So ignore it here. */ edgesArr[n] = abs(PyInt_AsLong(o)); o = PySequence_GetItem(stride, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg stride contains a non-integer"); return NULL; } strideArr[n] = PyInt_AsLong(o); } /* * Convert input to a contiguous numpy array (no penalty if * input already in this format). */ if ((num_type = HDFtoNumericType(data_type)) < 0) { PyErr_SetString(PyExc_ValueError, "data_type not compatible with numpy"); return NULL; } if ((array = (PyArrayObject *) PyArray_ContiguousFromObject(data, num_type, rank - 1, rank)) == NULL) return NULL; /* * Store in the SDS. */ status = SDwritedata(sds_id, startArr, strideArr, edgesArr, array -> data); Py_DECREF(array); /* Free array */ if (status < 0) { PyErr_SetString(PyExc_ValueError, "SDwritedata failure"); return NULL; } /* * Return None. */ Py_INCREF(Py_None); return Py_None; } %} /* * Following two routines are defined above, and interface to the * `SDreaddata()' and `SDwritedata()' hdf functions. */ extern PyObject * _SDreaddata_0(int32 sds_id, int32 data_type, PyObject *start, PyObject *edges, PyObject *stride); extern PyObject * _SDwritedata_0(int32 sds_id, int32 data_type, PyObject *start, PyObject *edges, PyObject *data, PyObject *stride); /* * Access */ extern int32 SDstart(const char *filename, int32 access_mode); extern int32 SDcreate(int32 sd_id, const char *sds_name, int32 data_type, int32 rank, const int32 *dim_sizes); extern int32 SDselect(int32 sd_id, int32 sds_index); extern int32 SDendaccess(int32 sds_id); extern int32 SDend(int32 sd_id); /* * General inquiry. */ extern int32 SDfileinfo(int32 sd_id, int32 *OUTPUT, int32 *OUTPUT); %cstring_bounded_output(char *sds_name, H4_MAX_NC_NAME); extern int32 SDgetinfo(int32 sds_id, char *sds_name, int32 *OUTPUT, void *buf, int32 *OUTPUT, int32 *OUTPUT); %clear char *sds_name; extern int32 SDcheckempty(int32 sds_id, int32 *OUTPUT); extern int32 SDidtoref(int32 sds_id); extern int32 SDiscoordvar(int32 sds_id); extern int32 SDisrecord(int32 sds_id); extern int32 SDnametoindex(int32 sd_id, const char *sds_name); extern int32 SDreftoindex(int32 sd_id, int32 sds_ref); /* * Dimensions */ %cstring_bounded_output(char *dim_name, CHAR_BUFFER_SIZE); extern int32 SDdiminfo(int32 dim_id, char *dim_name, int32 *OUTPUT, int32 *OUTPUT, int32 *OUTPUT); %clear char *dim_name; extern int32 SDgetdimid(int32 sds_id, int32 dim_index); extern int32 SDsetdimname(int32 dim_id, const char *dim_name); /* * Dimension scales */ extern int32 SDgetdimscale(int32 dim_id, void *buf); extern int32 SDsetdimscale(int32 dim_id, int32 n_values, int32 data_type, const void *buf); /* * User-defined attributes */ %cstring_bounded_output(char *attr_name, CHAR_BUFFER_SIZE); extern int32 SDattrinfo(int32 obj_id, int32 attr_index, char *attr_name, int32 *OUTPUT, int32 *OUTPUT); %clear char *attr_name; extern int32 SDfindattr(int32 obj_id, char *attr_name); extern int32 SDreadattr(int32 obj_id, int32 attr_index, void *buf); extern int32 SDsetattr(int32 obj_id, const char *attr_name, int32 data_type, int32 n_values, const void *values); /* * Predefined attributes */ extern int32 SDgetcal(int32 sds_id, double *OUTPUT, double *OUTPUT, double *OUTPUT, double *OUTPUT, int32 *OUTPUT); %cstring_bounded_output(char *label, ATTRIB_BUFFER_SIZE); %cstring_bounded_output(char *unit, ATTRIB_BUFFER_SIZE); %cstring_bounded_output(char *format, ATTRIB_BUFFER_SIZE); %cstring_bounded_output(char *coord_system, ATTRIB_BUFFER_SIZE); extern int32 SDgetdatastrs(int32 sds_id, char *label, char *unit, char *format, char *coord_system, int32 len); %clear char *label; %clear char *unit; %clear char *format; %clear char *coord_system; %cstring_bounded_output(char *label, ATTRIB_BUFFER_SIZE); %cstring_bounded_output(char *unit, ATTRIB_BUFFER_SIZE); %cstring_bounded_output(char *format, ATTRIB_BUFFER_SIZE); extern int32 SDgetdimstrs(int32 sds_id, char *label, char *unit, char *format, int32 len); %clear char *label; %clear char *unit; %clear char *format; extern int32 SDgetfillvalue(int32 sds_id, void *buf); extern int32 SDgetrange(int32 sds_id, void *buf1, void *buf2); extern int32 SDsetcal(int32 sds_id, double cal, double cal_error, double offset, double offset_err, int32 data_type); extern int32 SDsetdatastrs(int32 sds_id, const char *label, const char *unit, const char *format, const char *coord_system); extern int32 SDsetdimstrs(int32 sds_id, const char *label, const char *unit, const char *format); extern int32 SDsetfillmode(int32 sd_id, int32 fill_mode); extern int32 SDsetfillvalue(int32 sds_id, const void *fill_val); extern int32 SDsetrange(int32 sds_id, const void *max, const void *min); /* * Compression */ %{ #include "hcomp.h" static int32 _SDgetcompress(int32 sds_id, int32 *comp_type, int32 *value, int32 *v2, int32 *v3, int32 *v4, int32 *v5) { comp_info c_info; int32 status; #ifdef NOCOMPRESS status = -1; #else status = SDgetcompress(sds_id, comp_type, &c_info); switch (*comp_type) { case COMP_CODE_NONE: case COMP_CODE_RLE : break; case COMP_CODE_SKPHUFF: *value = c_info.skphuff.skp_size; break; case COMP_CODE_DEFLATE: *value = c_info.deflate.level; break; #ifndef NOSZIP case COMP_CODE_SZIP: *value = c_info.szip.options_mask; *v2 = c_info.szip.pixels_per_block; *v3 = c_info.szip.pixels_per_scanline; *v4 = c_info.szip.bits_per_pixel; *v5 = c_info.szip.pixels; break; #endif } #endif return status; } static int32 _SDsetcompress(int32 sds_id, int32 comp_type, int32 value, int32 v2) { comp_info c_info; int32 status; #ifdef NOCOMPRESS status = -1; #else switch (comp_type) { case COMP_CODE_NONE: case COMP_CODE_RLE : break; case COMP_CODE_SKPHUFF: c_info.skphuff.skp_size = value; break; case COMP_CODE_DEFLATE: c_info.deflate.level = value; break; #ifndef NOSZIP case COMP_CODE_SZIP: c_info.szip.options_mask = value; c_info.szip.pixels_per_block = v2; break; #endif } status = SDsetcompress(sds_id, comp_type, &c_info); #endif return status; } %} extern int32 _SDgetcompress(int32 sds_id, int32 *OUTPUT, int32 *OUTPUT, int32 *OUTPUT, int32 *OUTPUT, int32 *OUTPUT, int32 *OUTPUT); extern int32 _SDsetcompress(int32 sds_id, int32 comp_type, int32 value, int32 v2); /* * Misc */ extern int32 SDsetexternalfile(int32 sds_id, const char *filename, int32 offset); /* ******** * VS API ******** */ /* * Access / Create ***************** */ extern intn Vinitialize(int32 file_id); /* Vstart is a macro */ extern int32 VSattach(int32 file_id, int32 vdata_ref, const char * vdata_access_mode); extern int32 VSdetach(int32 vdata_id); extern intn Vfinish(int32 file_id); /* Vend is a macro */ /* * Creating one-field vdata. */ extern int32 VHstoredata(int32 file_id, const char *fieldname, void *buf, int32 n_records, int32 data_type, const char *vdata_name, const char *vdata_class); extern int32 VHstoredatam(int32 file_id, const char *fieldname, void *buf, int32 n_records, int32 data_type, const char *vdata_name, const char *vdata_class, int32 order); /* * Defining vdata structure. */ extern intn VSfdefine(int32 vdata_id, const char *fieldname, int32 data_type, int32 order); extern intn VSsetfields(int32 vdata_id, const char *fieldname_list); /* * Reading / writing vdata. */ int32 VSseek(int32 vdata_id, int32 record_index); int32 VSread(int32 vdata_id, void *databuf, int32 n_records, int32 interlace_mode); int32 VSwrite(int32 vdata_id, void *databuf, int32 n_records, int32 interlace_mode); intn VSfpack(int32 vdata_id, intn action, /* 0: PACK, 1: UNPACK */ const char *fields_in_buf, void *buf, intn buf_size, intn n_records, const char *fieldname_list, void **bufptrs); /* * Inquiry. */ extern int32 VSelts(int32 vdata_id); %cstring_bounded_output(char *vdata_class, CHAR_BUFFER_SIZE); extern intn VSgetclass(int32 vdata_id, char *vdata_class); %clear char *vdata_class; %cstring_bounded_output(char *fieldname_list, CHAR_BUFFER_SIZE); extern int32 VSgetfields(int32 vdata_id, char *fieldname_list); %clear char *fieldname_list; extern intn VSgetinterlace(int32 vdata_id); %cstring_bounded_output(char *vdata_name, CHAR_BUFFER_SIZE); extern intn VSgetname(int32 vdata_id, char *vdata_name); %clear char *vdata_name; extern intn VSsizeof(int32 vdata_id, const char *fieldname_list); %cstring_bounded_output(char *fieldname_list, CHAR_BUFFER_SIZE); %cstring_bounded_output(char *vdata_name, CHAR_BUFFER_SIZE); extern intn VSinquire(int32 vdata_id, int32 *OUTPUT, /* n_records */ int32 *OUTPUT, /* interlace_mode */ char *fieldname_list, int32 *OUTPUT, /* vdata_size */ char *vdata_name); %clear char *fieldname_list; %clear char *vdata_name; extern int32 VSQuerytag(int32 vdata_id); extern int32 VSQueryref(int32 vdata_id); extern intn VSfindex(int32 vdata_id, const char *field_name, int32 *OUTPUT); /* field_index */ extern intn VSisattr(int32 vdta_id); extern int32 VFnfields(int32 vdata_id); extern int32 VFfieldtype(int32 vdata_id, int32 field_index); extern const char *VFfieldname(int32 vdata_id, int32 field_index); extern int32 VFfieldesize(int32 vdata_id, int32 field_index); extern int32 VFfieldisize(int32 vdata_id, int32 field_index); extern int32 VFfieldorder(int32 vdata_id, int32 field_index); /* * Searching */ extern int32 VSfind(int32 file_id, const char *vdata_name); extern int32 VSgetid(int32 file_id, int32 vdata_ref); extern intn VSfexist(int32 vdata_id, const char *fieldname_list); /* * Attributes. */ extern int32 VSsetclass(int32 vdata_id, const char *vdata_class); extern int32 VSsetname(int32 vdata_id, const char *vdata_name); extern intn VSsetinterlace(int32 vdata_id, int32 interlace_mode); extern intn VSsetattr(int32 vdata_id, int32 field_index, const char *attr_name, int32 data_type, int32 n_values, const void *values); extern intn VSgetattr(int32 vdata_id, int32 field_index, intn attr_index, void *buf); extern int32 VSfnattrs(int32 vdata_id, int32 field_index); extern int32 VSnattrs(int32 vdata_id); %cstring_bounded_output(char *attr_name, CHAR_BUFFER_SIZE); extern intn VSattrinfo(int32 vdata_id, int32 field_index, intn attr_index, char *attr_name, int32 *OUTPUT, /* data_type */ int32 *OUTPUT, /* n_values */ int32 *OUTPUT); /* size */ %clear char *attr_name; extern intn VSfindattr(int32 vdata_id, int32 field_index, const char *attr_name); /********* * V API * *********/ /* * Access vgroup */ extern int32 Vattach(int32 file_id, int32 vgroup_ref, const char *vg_access_mode); extern int32 Vdetach(int32 vgroup_id); %cstring_bounded_output(char *name, CHAR_BUFFER_SIZE); extern int32 Vgetname(int32 vgroup_id, char *name); %clear char *name; extern int32 Vsetname(int32 vgroup_id, const char *vgroup_name); %cstring_bounded_output(char *name, CHAR_BUFFER_SIZE); extern int32 Vgetclass(int32 vgroup_id, char *name); %clear char *name; extern int32 Vsetclass(int32 vgroup_id, const char *vgroup_class); extern int32 Vfind(int32 file_id, const char *vgroup_name); extern int32 Vfindclass(int32 file_id, const char *vgroup_class); extern int32 Vinsert(int32 vgroup_id, int32 v_id); extern int32 Vaddtagref(int32 vgroup_id, int32 obj_tag, int32 obj_ref); extern int32 Vdeletetagref(int32 vgroup_id, int32 obj_tag, int32 obj_ref); extern int32 Vdelete(int32 file_id, int32 vgroup_id); extern int32 VQueryref(int32 vgroup_id); extern int32 VQuerytag(int32 vgroup_id); extern int32 Vntagrefs(int32 vgroup_id); extern int32 Vgettagref(int32 vgroup_id, int32 index, int32 *OUTPUT, /* obj_tag */ int32 *OUTPUT); /* obj_ref */ extern int32 Vgetversion(int32 vgroup_id); extern int32 Vgettagrefs(int32 vgroup_id, void *tag_attay, void *ref_array, int32 maxsize); extern int32 Vgetid(int32 file_id, int32 vgroup_ref); extern intn Vinqtagref(int32 vgroup_id, int32 tag, int32 ref); extern intn Visvg(int32 vgroup_id, int32 obj_ref); extern intn Visvs(int32 vgroup_id, int32 obj_ref); extern int32 Vnrefs(int32 vgroup_id, int32 tag_type); /* * Attributes */ extern intn Vfindattr(int32 vgroup_id, const char *attr_name); extern intn Vgetattr(int32 vdata_id, intn attr_index, void *buf); extern intn Vsetattr(int32 vgroup_id, const char *attr_name, int32 data_type, int32 n_values, const void *values); %cstring_bounded_output(char *attr_name, CHAR_BUFFER_SIZE); extern intn Vattrinfo(int32 vgroup_id, intn attr_index, char *attr_name, int32 *OUTPUT, /* data_type */ int32 *OUTPUT, /* n_values */ int32 *OUTPUT); /* size */ %clear char *attr_name; extern intn Vnattrs(int32 vgroup_id); pyhdf-0.10.3/pyhdf/hdfext.py000066400000000000000000000706551405105412500156650ustar00rootroot00000000000000# This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.12 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info >= (2, 7, 0): def swig_import_helper(): import importlib pkg = __name__.rpartition('.')[0] mname = '.'.join((pkg, '_hdfext')).lstrip('.') try: return importlib.import_module(mname) except ImportError: return importlib.import_module('_hdfext') _hdfext = swig_import_helper() del swig_import_helper elif _swig_python_version_info >= (2, 6, 0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_hdfext', [dirname(__file__)]) except ImportError: import _hdfext return _hdfext try: _mod = imp.load_module('_hdfext', fp, pathname, description) finally: if fp is not None: fp.close() return _mod _hdfext = swig_import_helper() del swig_import_helper else: import _hdfext del _swig_python_version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. try: import builtins as __builtin__ except ImportError: import __builtin__ def _swig_setattr_nondynamic(self, class_type, name, value, static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name, None) if method: return method(self, value) if (not static): if _newclass: object.__setattr__(self, name, value) else: self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self, class_type, name, value): return _swig_setattr_nondynamic(self, class_type, name, value, 0) def _swig_getattr(self, class_type, name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name, None) if method: return method(self) raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except __builtin__.Exception: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except __builtin__.Exception: class _object: pass _newclass = 0 DFNT_NONE = _hdfext.DFNT_NONE DFNT_QUERY = _hdfext.DFNT_QUERY DFNT_VERSION = _hdfext.DFNT_VERSION DFNT_FLOAT32 = _hdfext.DFNT_FLOAT32 DFNT_FLOAT = _hdfext.DFNT_FLOAT DFNT_FLOAT64 = _hdfext.DFNT_FLOAT64 DFNT_DOUBLE = _hdfext.DFNT_DOUBLE DFNT_FLOAT128 = _hdfext.DFNT_FLOAT128 DFNT_INT8 = _hdfext.DFNT_INT8 DFNT_UINT8 = _hdfext.DFNT_UINT8 DFNT_INT16 = _hdfext.DFNT_INT16 DFNT_UINT16 = _hdfext.DFNT_UINT16 DFNT_INT32 = _hdfext.DFNT_INT32 DFNT_UINT32 = _hdfext.DFNT_UINT32 DFNT_INT64 = _hdfext.DFNT_INT64 DFNT_UINT64 = _hdfext.DFNT_UINT64 DFNT_INT128 = _hdfext.DFNT_INT128 DFNT_UINT128 = _hdfext.DFNT_UINT128 DFNT_UCHAR8 = _hdfext.DFNT_UCHAR8 DFNT_UCHAR = _hdfext.DFNT_UCHAR DFNT_CHAR8 = _hdfext.DFNT_CHAR8 DFNT_CHAR = _hdfext.DFNT_CHAR DFNT_CHAR16 = _hdfext.DFNT_CHAR16 DFNT_UCHAR16 = _hdfext.DFNT_UCHAR16 SD_UNLIMITED = _hdfext.SD_UNLIMITED SD_FILL = _hdfext.SD_FILL SD_NOFILL = _hdfext.SD_NOFILL CHAR_BUFFER_SIZE = _hdfext.CHAR_BUFFER_SIZE ATTRIB_BUFFER_SIZE = _hdfext.ATTRIB_BUFFER_SIZE DFACC_READ = _hdfext.DFACC_READ DFACC_WRITE = _hdfext.DFACC_WRITE DFACC_CREATE = _hdfext.DFACC_CREATE DFACC_ALL = _hdfext.DFACC_ALL DFACC_RDONLY = _hdfext.DFACC_RDONLY DFACC_RDWR = _hdfext.DFACC_RDWR DFACC_CLOBBER = _hdfext.DFACC_CLOBBER DFACC_BUFFER = _hdfext.DFACC_BUFFER DFACC_APPENDABLE = _hdfext.DFACC_APPENDABLE DFACC_CURRENT = _hdfext.DFACC_CURRENT DFACC_OLD = _hdfext.DFACC_OLD COMP_CODE_NONE = _hdfext.COMP_CODE_NONE COMP_CODE_RLE = _hdfext.COMP_CODE_RLE COMP_CODE_NBIT = _hdfext.COMP_CODE_NBIT COMP_CODE_SKPHUFF = _hdfext.COMP_CODE_SKPHUFF COMP_CODE_DEFLATE = _hdfext.COMP_CODE_DEFLATE COMP_CODE_SZIP = _hdfext.COMP_CODE_SZIP DFTAG_NDG = _hdfext.DFTAG_NDG DFTAG_VH = _hdfext.DFTAG_VH DFTAG_VG = _hdfext.DFTAG_VG H4_MAX_VAR_DIMS = _hdfext.H4_MAX_VAR_DIMS class array_byte(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, array_byte, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, array_byte, name) __repr__ = _swig_repr def __init__(self, nelements): this = _hdfext.new_array_byte(nelements) try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _hdfext.delete_array_byte __del__ = lambda self: None def __getitem__(self, index): return _hdfext.array_byte___getitem__(self, index) def __setitem__(self, index, value): return _hdfext.array_byte___setitem__(self, index, value) def cast(self): return _hdfext.array_byte_cast(self) if _newclass: frompointer = staticmethod(_hdfext.array_byte_frompointer) else: frompointer = _hdfext.array_byte_frompointer array_byte_swigregister = _hdfext.array_byte_swigregister array_byte_swigregister(array_byte) def array_byte_frompointer(t): return _hdfext.array_byte_frompointer(t) array_byte_frompointer = _hdfext.array_byte_frompointer class array_int8(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, array_int8, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, array_int8, name) __repr__ = _swig_repr def __init__(self, nelements): this = _hdfext.new_array_int8(nelements) try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _hdfext.delete_array_int8 __del__ = lambda self: None def __getitem__(self, index): return _hdfext.array_int8___getitem__(self, index) def __setitem__(self, index, value): return _hdfext.array_int8___setitem__(self, index, value) def cast(self): return _hdfext.array_int8_cast(self) if _newclass: frompointer = staticmethod(_hdfext.array_int8_frompointer) else: frompointer = _hdfext.array_int8_frompointer array_int8_swigregister = _hdfext.array_int8_swigregister array_int8_swigregister(array_int8) def array_int8_frompointer(t): return _hdfext.array_int8_frompointer(t) array_int8_frompointer = _hdfext.array_int8_frompointer class array_int16(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, array_int16, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, array_int16, name) __repr__ = _swig_repr def __init__(self, nelements): this = _hdfext.new_array_int16(nelements) try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _hdfext.delete_array_int16 __del__ = lambda self: None def __getitem__(self, index): return _hdfext.array_int16___getitem__(self, index) def __setitem__(self, index, value): return _hdfext.array_int16___setitem__(self, index, value) def cast(self): return _hdfext.array_int16_cast(self) if _newclass: frompointer = staticmethod(_hdfext.array_int16_frompointer) else: frompointer = _hdfext.array_int16_frompointer array_int16_swigregister = _hdfext.array_int16_swigregister array_int16_swigregister(array_int16) def array_int16_frompointer(t): return _hdfext.array_int16_frompointer(t) array_int16_frompointer = _hdfext.array_int16_frompointer class array_uint16(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, array_uint16, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, array_uint16, name) __repr__ = _swig_repr def __init__(self, nelements): this = _hdfext.new_array_uint16(nelements) try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _hdfext.delete_array_uint16 __del__ = lambda self: None def __getitem__(self, index): return _hdfext.array_uint16___getitem__(self, index) def __setitem__(self, index, value): return _hdfext.array_uint16___setitem__(self, index, value) def cast(self): return _hdfext.array_uint16_cast(self) if _newclass: frompointer = staticmethod(_hdfext.array_uint16_frompointer) else: frompointer = _hdfext.array_uint16_frompointer array_uint16_swigregister = _hdfext.array_uint16_swigregister array_uint16_swigregister(array_uint16) def array_uint16_frompointer(t): return _hdfext.array_uint16_frompointer(t) array_uint16_frompointer = _hdfext.array_uint16_frompointer class array_int32(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, array_int32, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, array_int32, name) __repr__ = _swig_repr def __init__(self, nelements): this = _hdfext.new_array_int32(nelements) try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _hdfext.delete_array_int32 __del__ = lambda self: None def __getitem__(self, index): return _hdfext.array_int32___getitem__(self, index) def __setitem__(self, index, value): return _hdfext.array_int32___setitem__(self, index, value) def cast(self): return _hdfext.array_int32_cast(self) if _newclass: frompointer = staticmethod(_hdfext.array_int32_frompointer) else: frompointer = _hdfext.array_int32_frompointer array_int32_swigregister = _hdfext.array_int32_swigregister array_int32_swigregister(array_int32) def array_int32_frompointer(t): return _hdfext.array_int32_frompointer(t) array_int32_frompointer = _hdfext.array_int32_frompointer class array_uint32(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, array_uint32, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, array_uint32, name) __repr__ = _swig_repr def __init__(self, nelements): this = _hdfext.new_array_uint32(nelements) try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _hdfext.delete_array_uint32 __del__ = lambda self: None def __getitem__(self, index): return _hdfext.array_uint32___getitem__(self, index) def __setitem__(self, index, value): return _hdfext.array_uint32___setitem__(self, index, value) def cast(self): return _hdfext.array_uint32_cast(self) if _newclass: frompointer = staticmethod(_hdfext.array_uint32_frompointer) else: frompointer = _hdfext.array_uint32_frompointer array_uint32_swigregister = _hdfext.array_uint32_swigregister array_uint32_swigregister(array_uint32) def array_uint32_frompointer(t): return _hdfext.array_uint32_frompointer(t) array_uint32_frompointer = _hdfext.array_uint32_frompointer class array_float32(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, array_float32, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, array_float32, name) __repr__ = _swig_repr def __init__(self, nelements): this = _hdfext.new_array_float32(nelements) try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _hdfext.delete_array_float32 __del__ = lambda self: None def __getitem__(self, index): return _hdfext.array_float32___getitem__(self, index) def __setitem__(self, index, value): return _hdfext.array_float32___setitem__(self, index, value) def cast(self): return _hdfext.array_float32_cast(self) if _newclass: frompointer = staticmethod(_hdfext.array_float32_frompointer) else: frompointer = _hdfext.array_float32_frompointer array_float32_swigregister = _hdfext.array_float32_swigregister array_float32_swigregister(array_float32) def array_float32_frompointer(t): return _hdfext.array_float32_frompointer(t) array_float32_frompointer = _hdfext.array_float32_frompointer class array_float64(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, array_float64, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, array_float64, name) __repr__ = _swig_repr def __init__(self, nelements): this = _hdfext.new_array_float64(nelements) try: self.this.append(this) except __builtin__.Exception: self.this = this __swig_destroy__ = _hdfext.delete_array_float64 __del__ = lambda self: None def __getitem__(self, index): return _hdfext.array_float64___getitem__(self, index) def __setitem__(self, index, value): return _hdfext.array_float64___setitem__(self, index, value) def cast(self): return _hdfext.array_float64_cast(self) if _newclass: frompointer = staticmethod(_hdfext.array_float64_frompointer) else: frompointer = _hdfext.array_float64_frompointer array_float64_swigregister = _hdfext.array_float64_swigregister array_float64_swigregister(array_float64) def array_float64_frompointer(t): return _hdfext.array_float64_frompointer(t) array_float64_frompointer = _hdfext.array_float64_frompointer def new_array_voidp(nelements): return _hdfext.new_array_voidp(nelements) new_array_voidp = _hdfext.new_array_voidp def delete_array_voidp(ary): return _hdfext.delete_array_voidp(ary) delete_array_voidp = _hdfext.delete_array_voidp def array_voidp_getitem(ary, index): return _hdfext.array_voidp_getitem(ary, index) array_voidp_getitem = _hdfext.array_voidp_getitem def array_voidp_setitem(ary, index, value): return _hdfext.array_voidp_setitem(ary, index, value) array_voidp_setitem = _hdfext.array_voidp_setitem def Hopen(filename, access_mode, num_dds_blocks): return _hdfext.Hopen(filename, access_mode, num_dds_blocks) Hopen = _hdfext.Hopen def Hclose(file_id): return _hdfext.Hclose(file_id) Hclose = _hdfext.Hclose def Hgetlibversion(): return _hdfext.Hgetlibversion() Hgetlibversion = _hdfext.Hgetlibversion def Hgetfileversion(file_id): return _hdfext.Hgetfileversion(file_id) Hgetfileversion = _hdfext.Hgetfileversion def Hishdf(filename): return _hdfext.Hishdf(filename) Hishdf = _hdfext.Hishdf def HEvalue(error_stack_offset): return _hdfext.HEvalue(error_stack_offset) HEvalue = _hdfext.HEvalue def HEstring(error_code): return _hdfext.HEstring(error_code) HEstring = _hdfext.HEstring def _HEprint(): return _hdfext._HEprint() _HEprint = _hdfext._HEprint def _SDreaddata_0(sds_id, data_type, start, edges, stride): return _hdfext._SDreaddata_0(sds_id, data_type, start, edges, stride) _SDreaddata_0 = _hdfext._SDreaddata_0 def _SDwritedata_0(sds_id, data_type, start, edges, data, stride): return _hdfext._SDwritedata_0(sds_id, data_type, start, edges, data, stride) _SDwritedata_0 = _hdfext._SDwritedata_0 def SDstart(filename, access_mode): return _hdfext.SDstart(filename, access_mode) SDstart = _hdfext.SDstart def SDcreate(sd_id, sds_name, data_type, rank, dim_sizes): return _hdfext.SDcreate(sd_id, sds_name, data_type, rank, dim_sizes) SDcreate = _hdfext.SDcreate def SDselect(sd_id, sds_index): return _hdfext.SDselect(sd_id, sds_index) SDselect = _hdfext.SDselect def SDendaccess(sds_id): return _hdfext.SDendaccess(sds_id) SDendaccess = _hdfext.SDendaccess def SDend(sd_id): return _hdfext.SDend(sd_id) SDend = _hdfext.SDend def SDfileinfo(sd_id): return _hdfext.SDfileinfo(sd_id) SDfileinfo = _hdfext.SDfileinfo def SDgetinfo(sds_id, buf): return _hdfext.SDgetinfo(sds_id, buf) SDgetinfo = _hdfext.SDgetinfo def SDcheckempty(sds_id): return _hdfext.SDcheckempty(sds_id) SDcheckempty = _hdfext.SDcheckempty def SDidtoref(sds_id): return _hdfext.SDidtoref(sds_id) SDidtoref = _hdfext.SDidtoref def SDiscoordvar(sds_id): return _hdfext.SDiscoordvar(sds_id) SDiscoordvar = _hdfext.SDiscoordvar def SDisrecord(sds_id): return _hdfext.SDisrecord(sds_id) SDisrecord = _hdfext.SDisrecord def SDnametoindex(sd_id, sds_name): return _hdfext.SDnametoindex(sd_id, sds_name) SDnametoindex = _hdfext.SDnametoindex def SDreftoindex(sd_id, sds_ref): return _hdfext.SDreftoindex(sd_id, sds_ref) SDreftoindex = _hdfext.SDreftoindex def SDdiminfo(dim_id): return _hdfext.SDdiminfo(dim_id) SDdiminfo = _hdfext.SDdiminfo def SDgetdimid(sds_id, dim_index): return _hdfext.SDgetdimid(sds_id, dim_index) SDgetdimid = _hdfext.SDgetdimid def SDsetdimname(dim_id, dim_name): return _hdfext.SDsetdimname(dim_id, dim_name) SDsetdimname = _hdfext.SDsetdimname def SDgetdimscale(dim_id, buf): return _hdfext.SDgetdimscale(dim_id, buf) SDgetdimscale = _hdfext.SDgetdimscale def SDsetdimscale(dim_id, n_values, data_type, buf): return _hdfext.SDsetdimscale(dim_id, n_values, data_type, buf) SDsetdimscale = _hdfext.SDsetdimscale def SDattrinfo(obj_id, attr_index): return _hdfext.SDattrinfo(obj_id, attr_index) SDattrinfo = _hdfext.SDattrinfo def SDfindattr(obj_id, attr_name): return _hdfext.SDfindattr(obj_id, attr_name) SDfindattr = _hdfext.SDfindattr def SDreadattr(obj_id, attr_index, buf): return _hdfext.SDreadattr(obj_id, attr_index, buf) SDreadattr = _hdfext.SDreadattr def SDsetattr(obj_id, attr_name, data_type, n_values, values): return _hdfext.SDsetattr(obj_id, attr_name, data_type, n_values, values) SDsetattr = _hdfext.SDsetattr def SDgetcal(sds_id): return _hdfext.SDgetcal(sds_id) SDgetcal = _hdfext.SDgetcal def SDgetdatastrs(sds_id, len): return _hdfext.SDgetdatastrs(sds_id, len) SDgetdatastrs = _hdfext.SDgetdatastrs def SDgetdimstrs(sds_id, len): return _hdfext.SDgetdimstrs(sds_id, len) SDgetdimstrs = _hdfext.SDgetdimstrs def SDgetfillvalue(sds_id, buf): return _hdfext.SDgetfillvalue(sds_id, buf) SDgetfillvalue = _hdfext.SDgetfillvalue def SDgetrange(sds_id, buf1, buf2): return _hdfext.SDgetrange(sds_id, buf1, buf2) SDgetrange = _hdfext.SDgetrange def SDsetcal(sds_id, cal, cal_error, offset, offset_err, data_type): return _hdfext.SDsetcal(sds_id, cal, cal_error, offset, offset_err, data_type) SDsetcal = _hdfext.SDsetcal def SDsetdatastrs(sds_id, label, unit, format, coord_system): return _hdfext.SDsetdatastrs(sds_id, label, unit, format, coord_system) SDsetdatastrs = _hdfext.SDsetdatastrs def SDsetdimstrs(sds_id, label, unit, format): return _hdfext.SDsetdimstrs(sds_id, label, unit, format) SDsetdimstrs = _hdfext.SDsetdimstrs def SDsetfillmode(sd_id, fill_mode): return _hdfext.SDsetfillmode(sd_id, fill_mode) SDsetfillmode = _hdfext.SDsetfillmode def SDsetfillvalue(sds_id, fill_val): return _hdfext.SDsetfillvalue(sds_id, fill_val) SDsetfillvalue = _hdfext.SDsetfillvalue def SDsetrange(sds_id, max, min): return _hdfext.SDsetrange(sds_id, max, min) SDsetrange = _hdfext.SDsetrange def _SDgetcompress(sds_id): return _hdfext._SDgetcompress(sds_id) _SDgetcompress = _hdfext._SDgetcompress def _SDsetcompress(sds_id, comp_type, value, v2): return _hdfext._SDsetcompress(sds_id, comp_type, value, v2) _SDsetcompress = _hdfext._SDsetcompress def SDsetexternalfile(sds_id, filename, offset): return _hdfext.SDsetexternalfile(sds_id, filename, offset) SDsetexternalfile = _hdfext.SDsetexternalfile def Vinitialize(file_id): return _hdfext.Vinitialize(file_id) Vinitialize = _hdfext.Vinitialize def VSattach(file_id, vdata_ref, vdata_access_mode): return _hdfext.VSattach(file_id, vdata_ref, vdata_access_mode) VSattach = _hdfext.VSattach def VSdetach(vdata_id): return _hdfext.VSdetach(vdata_id) VSdetach = _hdfext.VSdetach def Vfinish(file_id): return _hdfext.Vfinish(file_id) Vfinish = _hdfext.Vfinish def VHstoredata(file_id, fieldname, buf, n_records, data_type, vdata_name, vdata_class): return _hdfext.VHstoredata(file_id, fieldname, buf, n_records, data_type, vdata_name, vdata_class) VHstoredata = _hdfext.VHstoredata def VHstoredatam(file_id, fieldname, buf, n_records, data_type, vdata_name, vdata_class, order): return _hdfext.VHstoredatam(file_id, fieldname, buf, n_records, data_type, vdata_name, vdata_class, order) VHstoredatam = _hdfext.VHstoredatam def VSfdefine(vdata_id, fieldname, data_type, order): return _hdfext.VSfdefine(vdata_id, fieldname, data_type, order) VSfdefine = _hdfext.VSfdefine def VSsetfields(vdata_id, fieldname_list): return _hdfext.VSsetfields(vdata_id, fieldname_list) VSsetfields = _hdfext.VSsetfields def VSseek(vdata_id, record_index): return _hdfext.VSseek(vdata_id, record_index) VSseek = _hdfext.VSseek def VSread(vdata_id, databuf, n_records, interlace_mode): return _hdfext.VSread(vdata_id, databuf, n_records, interlace_mode) VSread = _hdfext.VSread def VSwrite(vdata_id, databuf, n_records, interlace_mode): return _hdfext.VSwrite(vdata_id, databuf, n_records, interlace_mode) VSwrite = _hdfext.VSwrite def VSfpack(vdata_id, action, fields_in_buf, buf, buf_size, n_records, fieldname_list, bufptrs): return _hdfext.VSfpack(vdata_id, action, fields_in_buf, buf, buf_size, n_records, fieldname_list, bufptrs) VSfpack = _hdfext.VSfpack def VSelts(vdata_id): return _hdfext.VSelts(vdata_id) VSelts = _hdfext.VSelts def VSgetclass(vdata_id): return _hdfext.VSgetclass(vdata_id) VSgetclass = _hdfext.VSgetclass def VSgetfields(vdata_id): return _hdfext.VSgetfields(vdata_id) VSgetfields = _hdfext.VSgetfields def VSgetinterlace(vdata_id): return _hdfext.VSgetinterlace(vdata_id) VSgetinterlace = _hdfext.VSgetinterlace def VSgetname(vdata_id): return _hdfext.VSgetname(vdata_id) VSgetname = _hdfext.VSgetname def VSsizeof(vdata_id, fieldname_list): return _hdfext.VSsizeof(vdata_id, fieldname_list) VSsizeof = _hdfext.VSsizeof def VSinquire(vdata_id): return _hdfext.VSinquire(vdata_id) VSinquire = _hdfext.VSinquire def VSQuerytag(vdata_id): return _hdfext.VSQuerytag(vdata_id) VSQuerytag = _hdfext.VSQuerytag def VSQueryref(vdata_id): return _hdfext.VSQueryref(vdata_id) VSQueryref = _hdfext.VSQueryref def VSfindex(vdata_id, field_name): return _hdfext.VSfindex(vdata_id, field_name) VSfindex = _hdfext.VSfindex def VSisattr(vdta_id): return _hdfext.VSisattr(vdta_id) VSisattr = _hdfext.VSisattr def VFnfields(vdata_id): return _hdfext.VFnfields(vdata_id) VFnfields = _hdfext.VFnfields def VFfieldtype(vdata_id, field_index): return _hdfext.VFfieldtype(vdata_id, field_index) VFfieldtype = _hdfext.VFfieldtype def VFfieldname(vdata_id, field_index): return _hdfext.VFfieldname(vdata_id, field_index) VFfieldname = _hdfext.VFfieldname def VFfieldesize(vdata_id, field_index): return _hdfext.VFfieldesize(vdata_id, field_index) VFfieldesize = _hdfext.VFfieldesize def VFfieldisize(vdata_id, field_index): return _hdfext.VFfieldisize(vdata_id, field_index) VFfieldisize = _hdfext.VFfieldisize def VFfieldorder(vdata_id, field_index): return _hdfext.VFfieldorder(vdata_id, field_index) VFfieldorder = _hdfext.VFfieldorder def VSfind(file_id, vdata_name): return _hdfext.VSfind(file_id, vdata_name) VSfind = _hdfext.VSfind def VSgetid(file_id, vdata_ref): return _hdfext.VSgetid(file_id, vdata_ref) VSgetid = _hdfext.VSgetid def VSfexist(vdata_id, fieldname_list): return _hdfext.VSfexist(vdata_id, fieldname_list) VSfexist = _hdfext.VSfexist def VSsetclass(vdata_id, vdata_class): return _hdfext.VSsetclass(vdata_id, vdata_class) VSsetclass = _hdfext.VSsetclass def VSsetname(vdata_id, vdata_name): return _hdfext.VSsetname(vdata_id, vdata_name) VSsetname = _hdfext.VSsetname def VSsetinterlace(vdata_id, interlace_mode): return _hdfext.VSsetinterlace(vdata_id, interlace_mode) VSsetinterlace = _hdfext.VSsetinterlace def VSsetattr(vdata_id, field_index, attr_name, data_type, n_values, values): return _hdfext.VSsetattr(vdata_id, field_index, attr_name, data_type, n_values, values) VSsetattr = _hdfext.VSsetattr def VSgetattr(vdata_id, field_index, attr_index, buf): return _hdfext.VSgetattr(vdata_id, field_index, attr_index, buf) VSgetattr = _hdfext.VSgetattr def VSfnattrs(vdata_id, field_index): return _hdfext.VSfnattrs(vdata_id, field_index) VSfnattrs = _hdfext.VSfnattrs def VSnattrs(vdata_id): return _hdfext.VSnattrs(vdata_id) VSnattrs = _hdfext.VSnattrs def VSattrinfo(vdata_id, field_index, attr_index): return _hdfext.VSattrinfo(vdata_id, field_index, attr_index) VSattrinfo = _hdfext.VSattrinfo def VSfindattr(vdata_id, field_index, attr_name): return _hdfext.VSfindattr(vdata_id, field_index, attr_name) VSfindattr = _hdfext.VSfindattr def Vattach(file_id, vgroup_ref, vg_access_mode): return _hdfext.Vattach(file_id, vgroup_ref, vg_access_mode) Vattach = _hdfext.Vattach def Vdetach(vgroup_id): return _hdfext.Vdetach(vgroup_id) Vdetach = _hdfext.Vdetach def Vgetname(vgroup_id): return _hdfext.Vgetname(vgroup_id) Vgetname = _hdfext.Vgetname def Vsetname(vgroup_id, vgroup_name): return _hdfext.Vsetname(vgroup_id, vgroup_name) Vsetname = _hdfext.Vsetname def Vgetclass(vgroup_id): return _hdfext.Vgetclass(vgroup_id) Vgetclass = _hdfext.Vgetclass def Vsetclass(vgroup_id, vgroup_class): return _hdfext.Vsetclass(vgroup_id, vgroup_class) Vsetclass = _hdfext.Vsetclass def Vfind(file_id, vgroup_name): return _hdfext.Vfind(file_id, vgroup_name) Vfind = _hdfext.Vfind def Vfindclass(file_id, vgroup_class): return _hdfext.Vfindclass(file_id, vgroup_class) Vfindclass = _hdfext.Vfindclass def Vinsert(vgroup_id, v_id): return _hdfext.Vinsert(vgroup_id, v_id) Vinsert = _hdfext.Vinsert def Vaddtagref(vgroup_id, obj_tag, obj_ref): return _hdfext.Vaddtagref(vgroup_id, obj_tag, obj_ref) Vaddtagref = _hdfext.Vaddtagref def Vdeletetagref(vgroup_id, obj_tag, obj_ref): return _hdfext.Vdeletetagref(vgroup_id, obj_tag, obj_ref) Vdeletetagref = _hdfext.Vdeletetagref def Vdelete(file_id, vgroup_id): return _hdfext.Vdelete(file_id, vgroup_id) Vdelete = _hdfext.Vdelete def VQueryref(vgroup_id): return _hdfext.VQueryref(vgroup_id) VQueryref = _hdfext.VQueryref def VQuerytag(vgroup_id): return _hdfext.VQuerytag(vgroup_id) VQuerytag = _hdfext.VQuerytag def Vntagrefs(vgroup_id): return _hdfext.Vntagrefs(vgroup_id) Vntagrefs = _hdfext.Vntagrefs def Vgettagref(vgroup_id, index): return _hdfext.Vgettagref(vgroup_id, index) Vgettagref = _hdfext.Vgettagref def Vgetversion(vgroup_id): return _hdfext.Vgetversion(vgroup_id) Vgetversion = _hdfext.Vgetversion def Vgettagrefs(vgroup_id, tag_attay, ref_array, maxsize): return _hdfext.Vgettagrefs(vgroup_id, tag_attay, ref_array, maxsize) Vgettagrefs = _hdfext.Vgettagrefs def Vgetid(file_id, vgroup_ref): return _hdfext.Vgetid(file_id, vgroup_ref) Vgetid = _hdfext.Vgetid def Vinqtagref(vgroup_id, tag, ref): return _hdfext.Vinqtagref(vgroup_id, tag, ref) Vinqtagref = _hdfext.Vinqtagref def Visvg(vgroup_id, obj_ref): return _hdfext.Visvg(vgroup_id, obj_ref) Visvg = _hdfext.Visvg def Visvs(vgroup_id, obj_ref): return _hdfext.Visvs(vgroup_id, obj_ref) Visvs = _hdfext.Visvs def Vnrefs(vgroup_id, tag_type): return _hdfext.Vnrefs(vgroup_id, tag_type) Vnrefs = _hdfext.Vnrefs def Vfindattr(vgroup_id, attr_name): return _hdfext.Vfindattr(vgroup_id, attr_name) Vfindattr = _hdfext.Vfindattr def Vgetattr(vdata_id, attr_index, buf): return _hdfext.Vgetattr(vdata_id, attr_index, buf) Vgetattr = _hdfext.Vgetattr def Vsetattr(vgroup_id, attr_name, data_type, n_values, values): return _hdfext.Vsetattr(vgroup_id, attr_name, data_type, n_values, values) Vsetattr = _hdfext.Vsetattr def Vattrinfo(vgroup_id, attr_index): return _hdfext.Vattrinfo(vgroup_id, attr_index) Vattrinfo = _hdfext.Vattrinfo def Vnattrs(vgroup_id): return _hdfext.Vnattrs(vgroup_id) Vnattrs = _hdfext.Vnattrs # This file is compatible with both classic and new-style classes. pyhdf-0.10.3/pyhdf/hdfext_wrap.c000066400000000000000000012614411405105412500165040ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 3.0.12 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #ifndef SWIGPYTHON #define SWIGPYTHON #endif #define SWIG_PYTHON_DIRECTOR_NO_VTABLE /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if defined(__GNUC__) # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 #endif /* Intel's compiler complains if a variable which was never initialised is * cast to void, which is a common idiom which we use to indicate that we * are aware a variable isn't used. So we just silence that warning. * See: https://github.com/swig/swig/issues/192 for more discussion. */ #ifdef __INTEL_COMPILER # pragma warning disable 592 #endif #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) /* Use debug wrappers with the Python release dll */ # undef _DEBUG # include # define _DEBUG #else # include #endif /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast(r) (r) # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCmp(const char *nb, const char *tb) { int equiv = 1; const char* te = tb + strlen(tb); const char* ne = nb; while (equiv != 0 && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = SWIG_TypeNameComp(nb, ne, tb, te); if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { size_t l = 0; size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; const unsigned char *u = (unsigned char *) ptr; const unsigned char *eu = u + sz; for (; u != eu; ++u) { unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { unsigned char *u = (unsigned char *) ptr; const unsigned char *eu = u + sz; for (; u != eu; ++u) { char d = *(c++); unsigned char uu; if ((d >= '0') && (d <= '9')) uu = (unsigned char)((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = (unsigned char)((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (unsigned char)(d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (unsigned char)(d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyInt_FromSize_t(x) PyLong_FromSize_t(x) #define PyString_Check(name) PyBytes_Check(name) #define PyString_FromString(x) PyUnicode_FromString(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #define PyString_AsString(str) PyBytes_AsString(str) #define PyString_Size(str) PyBytes_Size(str) #define PyString_InternFromString(key) PyUnicode_InternFromString(key) #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN typedef inquiry lenfunc; typedef intargfunc ssizeargfunc; typedef intintargfunc ssizessizeargfunc; typedef intobjargproc ssizeobjargproc; typedef intintobjargproc ssizessizeobjargproc; typedef getreadbufferproc readbufferproc; typedef getwritebufferproc writebufferproc; typedef getsegcountproc segcountproc; typedef getcharbufferproc charbufferproc; static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) { long result = 0; PyObject *i = PyNumber_Int(x); if (i) { result = PyInt_AsLong(i); Py_DECREF(i); } return result; } #endif #if PY_VERSION_HEX < 0x02050000 #define PyInt_FromSize_t(x) PyInt_FromLong((long)x) #endif #if PY_VERSION_HEX < 0x02040000 #define Py_VISIT(op) \ do { \ if (op) { \ int vret = visit((op), arg); \ if (vret) \ return vret; \ } \ } while (0) #endif #if PY_VERSION_HEX < 0x02030000 typedef struct { PyTypeObject type; PyNumberMethods as_number; PyMappingMethods as_mapping; PySequenceMethods as_sequence; PyBufferProcs as_buffer; PyObject *name, *slots; } PyHeapTypeObject; #endif #if PY_VERSION_HEX < 0x02030000 typedef destructor freefunc; #endif #if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \ (PY_MAJOR_VERSION > 3)) # define SWIGPY_USE_CAPSULE # define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) #endif #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) #define Py_hash_t long #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ #if PY_VERSION_HEX >= 0x03000000 SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) { return PyInstanceMethod_New(func); } #else SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func)) { return NULL; } #endif #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #ifdef SWIGPYTHON_BUILTIN #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) #else #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) #endif #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata) #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ #if defined(SWIGPYTHON_BUILTIN) SWIGINTERN void SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { PyObject *s = PyString_InternFromString(key); PyList_Append(seq, s); Py_DECREF(s); } SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { #if PY_VERSION_HEX < 0x02030000 PyDict_SetItemString(d, (char *)name, obj); #else PyDict_SetItemString(d, name, obj); #endif Py_DECREF(obj); if (public_interface) SwigPyBuiltin_AddPublicSymbol(public_interface, name); } #else SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #if PY_VERSION_HEX < 0x02030000 PyDict_SetItemString(d, (char *)name, obj); #else PyDict_SetItemString(d, name, obj); #endif Py_DECREF(obj); } #endif /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN Py_ssize_t SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { if (min <= 1 && max >= 1) { Py_ssize_t i; objs[0] = args; for (i = 1; i < max; ++i) { objs[i] = 0; } return 2; } PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { Py_ssize_t i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) #ifdef __cplusplus extern "C" { #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; PyTypeObject *pytype; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; data->pytype = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData *data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; #ifdef SWIGPYTHON_BUILTIN PyObject *dict; #endif } SwigPyObject; #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME PyObject * SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; if (!sobj->dict) sobj->dict = PyDict_New(); Py_INCREF(sobj->dict); return sobj->dict; } #endif SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", (name ? name : "unknown"), (void *)v); if (v->next) { # ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); # else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); # endif # if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; # else PyString_ConcatAndDel(&repr,nrep); # endif } return repr; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); return res; } SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; assert(cd); assert(cd->pytype); return cd->pytype; } #else SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } #endif SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { #ifdef SWIGPYTHON_BUILTIN PyTypeObject *target_tp = SwigPyObject_type(); if (PyType_IsSubtype(op->ob_type, target_tp)) return 1; return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); #else return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; /* PyObject_CallFunction() has the potential to silently drop the active active exception. In cases of unnamed temporary variable or where we just finished iterating over a generator StopIteration will be active right now, and this needs to remain true upon return from SwigPyObject_dealloc. So save and restore. */ PyObject *val = NULL, *type = NULL, *tb = NULL; PyErr_Fetch(&val, &type, &tb); if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } if (!res) PyErr_WriteUnraisable(destroy); PyErr_Restore(val, type, tb); Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #elif (PY_VERSION_HEX < 0x02050000) if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #else if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"acquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ #elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ 0, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 0, /* tp_version_tag */ #endif #if PY_VERSION_HEX >= 0x03040000 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS 0, /* tp_allocs */ 0, /* tp_frees */ 0, /* tp_maxalloc */ #if PY_VERSION_HEX >= 0x02050000 0, /* tp_prev */ #endif 0 /* tp_next */ #endif }; swigpyobject_type = tmp; type_init = 1; #if PY_VERSION_HEX < 0x02020000 swigpyobject_type.ob_type = &PyType_Type; #else if (PyType_Ready(&swigpyobject_type) < 0) return NULL; #endif } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == SwigPyPacked_TypeOnce()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 0, /* tp_version_tag */ #endif #if PY_VERSION_HEX >= 0x03040000 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS 0, /* tp_allocs */ 0, /* tp_frees */ 0, /* tp_maxalloc */ #if PY_VERSION_HEX >= 0x02050000 0, /* tp_prev */ #endif 0 /* tp_next */ #endif }; swigpypacked_type = tmp; type_init = 1; #if PY_VERSION_HEX < 0x02020000 swigpypacked_type.ob_type = &PyType_Type; #else if (PyType_Ready(&swigpypacked_type) < 0) return NULL; #endif } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } static PyObject *swig_this = NULL; SWIGRUNTIME PyObject * SWIG_This(void) { if (swig_this == NULL) swig_this = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { PyObject *obj; if (SwigPyObject_Check(pyobj)) return (SwigPyObject *) pyobj; #ifdef SWIGPYTHON_BUILTIN (void)obj; # ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { pyobj = PyWeakref_GET_OBJECT(pyobj); if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } # endif return NULL; #else obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; #endif } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { int res; SwigPyObject *sobj; int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; if (!obj) return SWIG_ERROR; if (obj == Py_None && !implicit_conv) { if (ptr) *ptr = 0; return SWIG_OK; } res = SWIG_ERROR; sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } res = SWIG_OK; } else { if (implicit_conv) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } if (!SWIG_IsOK(res) && obj == Py_None) { if (ptr) *ptr = 0; if (PyErr_Occurred()) PyErr_Clear(); res = SWIG_OK; } } return res; } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); if (inst) { PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; } #else PyObject *dict = PyDict_New(); if (dict) { PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); } #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst = 0; PyObject *dict = PyDict_New(); if (dict) { PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); } return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { SwigPyClientData *clientdata; PyObject * robj; int own; if (!ptr) return SWIG_Py_Void(); clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; if (clientdata && clientdata->pytype) { SwigPyObject *newobj; if (flags & SWIG_BUILTIN_TP_INIT) { newobj = (SwigPyObject*) self; if (newobj->ptr) { PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); while (newobj->next) newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; #ifdef SWIGPYTHON_BUILTIN newobj->dict = 0; #endif } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); #ifdef SWIGPYTHON_BUILTIN newobj->dict = 0; #endif } if (newobj) { newobj->ptr = ptr; newobj->ty = type; newobj->own = own; newobj->next = 0; return (PyObject*) newobj; } return SWIG_Py_Void(); } assert(!(flags & SWIG_BUILTIN_TP_INIT)); robj = SwigPyObject_New(ptr, type, own); if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); Py_DECREF(robj); robj = inst; } return robj; } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else # ifdef SWIGPY_USE_CAPSULE type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); # else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); # endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void #ifdef SWIGPY_USE_CAPSULE SWIG_Python_DestroyModule(PyObject *obj) #else SWIG_Python_DestroyModule(void *vptr) #endif { #ifdef SWIGPY_USE_CAPSULE swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); #else swig_module_info *swig_module = (swig_module_info *) vptr; #endif swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); swig_this = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif #ifdef SWIGPY_USE_CAPSULE PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } #else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } #endif } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { #ifdef SWIGPY_USE_CAPSULE descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); #else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); #endif } else { swig_module_info *swig_module = SWIG_GetModule(0); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { #ifdef SWIGPY_USE_CAPSULE obj = PyCapsule_New((void*) descriptor, NULL, NULL); #else obj = PyCObject_FromVoidPtr(descriptor, NULL); #endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : ""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { PyTypeObject *tp = obj->ob_type; PyObject *descr; PyObject *encoded_name; descrsetfunc f; int res = -1; # ifdef Py_USING_UNICODE if (PyString_Check(name)) { name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); if (!name) return -1; } else if (!PyUnicode_Check(name)) # else if (!PyString_Check(name)) # endif { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); return -1; } else { Py_INCREF(name); } if (!tp->tp_dict) { if (PyType_Ready(tp) < 0) goto done; } descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) f = descr->ob_type->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; Py_INCREF(name); } else { encoded_name = PyUnicode_AsUTF8String(name); } PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); Py_DECREF(encoded_name); } else { res = f(descr, obj, value); } done: Py_DECREF(name); return res; } #endif #ifdef __cplusplus } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_array_byte swig_types[0] #define SWIGTYPE_p_array_float32 swig_types[1] #define SWIGTYPE_p_array_float64 swig_types[2] #define SWIGTYPE_p_array_int16 swig_types[3] #define SWIGTYPE_p_array_int32 swig_types[4] #define SWIGTYPE_p_array_int8 swig_types[5] #define SWIGTYPE_p_array_uint16 swig_types[6] #define SWIGTYPE_p_array_uint32 swig_types[7] #define SWIGTYPE_p_char swig_types[8] #define SWIGTYPE_p_double swig_types[9] #define SWIGTYPE_p_float swig_types[10] #define SWIGTYPE_p_int swig_types[11] #define SWIGTYPE_p_p_void swig_types[12] #define SWIGTYPE_p_short swig_types[13] #define SWIGTYPE_p_signed_char swig_types[14] #define SWIGTYPE_p_unsigned_char swig_types[15] #define SWIGTYPE_p_unsigned_int swig_types[16] #define SWIGTYPE_p_unsigned_short swig_types[17] #define SWIGTYPE_p_void swig_types[18] static swig_type_info *swig_types[20]; static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _hdfext.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__hdfext #else # define SWIG_init init_hdfext #endif #define SWIG_name "_hdfext" #define SWIGVERSION 0x030012 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) (void *)((const void *)(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) SWIGINTERNINLINE PyObject* SWIG_From_int (int value) { return PyInt_FromLong((long) value); } typedef unsigned char array_byte; SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; #if PY_VERSION_HEX < 0x03000000 } else if (PyInt_Check(obj)) { if (val) *val = (double) PyInt_AsLong(obj); return SWIG_OK; #endif } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) { #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(obj)) { long v = PyInt_AsLong(obj); if (v >= 0) { if (val) *val = v; return SWIG_OK; } else { return SWIG_OverflowError; } } else #endif if (PyLong_Check(obj)) { unsigned long v = PyLong_AsUnsignedLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); return SWIG_OverflowError; } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; unsigned long v = PyLong_AsUnsignedLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { if (val) *val = (unsigned long)(d); return res; } } } #endif return SWIG_TypeError; } #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif #if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE) # define SWIG_LONG_LONG_AVAILABLE #endif #ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN int SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val) { int res = SWIG_TypeError; if (PyLong_Check(obj)) { unsigned long long v = PyLong_AsUnsignedLongLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); res = SWIG_OverflowError; } } else { unsigned long v; res = SWIG_AsVal_unsigned_SS_long (obj,&v); if (SWIG_IsOK(res)) { if (val) *val = v; return res; } } #ifdef SWIG_PYTHON_CAST_MODE { const double mant_max = 1LL << DBL_MANT_DIG; double d; res = SWIG_AsVal_double (obj,&d); if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max)) return SWIG_OverflowError; if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) { if (val) *val = (unsigned long long)(d); return SWIG_AddCast(res); } res = SWIG_TypeError; } #endif return res; } #endif SWIGINTERNINLINE int SWIG_AsVal_size_t (PyObject * obj, size_t *val) { int res = SWIG_TypeError; #ifdef SWIG_LONG_LONG_AVAILABLE if (sizeof(size_t) <= sizeof(unsigned long)) { #endif unsigned long v; res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); if (SWIG_IsOK(res) && val) *val = (size_t)(v); #ifdef SWIG_LONG_LONG_AVAILABLE } else if (sizeof(size_t) <= sizeof(unsigned long long)) { unsigned long long v; res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0); if (SWIG_IsOK(res) && val) *val = (size_t)(v); } #endif return res; } SWIGINTERN array_byte *new_array_byte(size_t nelements){ return (unsigned char *)calloc(nelements, sizeof(unsigned char)); } SWIGINTERN void delete_array_byte(array_byte *self){ free((char*)self); } SWIGINTERN unsigned char array_byte___getitem__(array_byte *self,size_t index){ return self[index]; } #define SWIG_From_long PyInt_FromLong SWIGINTERNINLINE PyObject* SWIG_From_unsigned_SS_long (unsigned long value) { return (value > LONG_MAX) ? PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)(value)); } SWIGINTERNINLINE PyObject * SWIG_From_unsigned_SS_char (unsigned char value) { return SWIG_From_unsigned_SS_long (value); } SWIGINTERN int SWIG_AsVal_unsigned_SS_char (PyObject * obj, unsigned char *val) { unsigned long v; int res = SWIG_AsVal_unsigned_SS_long (obj, &v); if (SWIG_IsOK(res)) { if ((v > UCHAR_MAX)) { return SWIG_OverflowError; } else { if (val) *val = (unsigned char)(v); } } return res; } SWIGINTERN void array_byte___setitem__(array_byte *self,size_t index,unsigned char value){ self[index] = value; } SWIGINTERN unsigned char *array_byte_cast(array_byte *self){ return self; } SWIGINTERN array_byte *array_byte_frompointer(unsigned char *t){ return (array_byte *)(t); } typedef signed char array_int8; SWIGINTERN array_int8 *new_array_int8(size_t nelements){ return (signed char *)calloc(nelements, sizeof(signed char)); } SWIGINTERN void delete_array_int8(array_int8 *self){ free((char*)self); } SWIGINTERN signed char array_int8___getitem__(array_int8 *self,size_t index){ return self[index]; } SWIGINTERNINLINE PyObject * SWIG_From_signed_SS_char (signed char value) { return SWIG_From_long (value); } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else #endif if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); return SWIG_OverflowError; } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_signed_SS_char (PyObject * obj, signed char *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < SCHAR_MIN || v > SCHAR_MAX)) { return SWIG_OverflowError; } else { if (val) *val = (signed char)(v); } } return res; } SWIGINTERN void array_int8___setitem__(array_int8 *self,size_t index,signed char value){ self[index] = value; } SWIGINTERN signed char *array_int8_cast(array_int8 *self){ return self; } SWIGINTERN array_int8 *array_int8_frompointer(signed char *t){ return (array_int8 *)(t); } typedef short array_int16; SWIGINTERN array_int16 *new_array_int16(size_t nelements){ return (short *)calloc(nelements, sizeof(short)); } SWIGINTERN void delete_array_int16(array_int16 *self){ free((char*)self); } SWIGINTERN short array_int16___getitem__(array_int16 *self,size_t index){ return self[index]; } SWIGINTERNINLINE PyObject * SWIG_From_short (short value) { return SWIG_From_long (value); } SWIGINTERN int SWIG_AsVal_short (PyObject * obj, short *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < SHRT_MIN || v > SHRT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = (short)(v); } } return res; } SWIGINTERN void array_int16___setitem__(array_int16 *self,size_t index,short value){ self[index] = value; } SWIGINTERN short *array_int16_cast(array_int16 *self){ return self; } SWIGINTERN array_int16 *array_int16_frompointer(short *t){ return (array_int16 *)(t); } typedef unsigned short array_uint16; SWIGINTERN array_uint16 *new_array_uint16(size_t nelements){ return (unsigned short *)calloc(nelements, sizeof(unsigned short)); } SWIGINTERN void delete_array_uint16(array_uint16 *self){ free((char*)self); } SWIGINTERN unsigned short array_uint16___getitem__(array_uint16 *self,size_t index){ return self[index]; } SWIGINTERNINLINE PyObject * SWIG_From_unsigned_SS_short (unsigned short value) { return SWIG_From_unsigned_SS_long (value); } SWIGINTERN int SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val) { unsigned long v; int res = SWIG_AsVal_unsigned_SS_long (obj, &v); if (SWIG_IsOK(res)) { if ((v > USHRT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = (unsigned short)(v); } } return res; } SWIGINTERN void array_uint16___setitem__(array_uint16 *self,size_t index,unsigned short value){ self[index] = value; } SWIGINTERN unsigned short *array_uint16_cast(array_uint16 *self){ return self; } SWIGINTERN array_uint16 *array_uint16_frompointer(unsigned short *t){ return (array_uint16 *)(t); } typedef int array_int32; SWIGINTERN array_int32 *new_array_int32(size_t nelements){ return (int *)calloc(nelements, sizeof(int)); } SWIGINTERN void delete_array_int32(array_int32 *self){ free((char*)self); } SWIGINTERN int array_int32___getitem__(array_int32 *self,size_t index){ return self[index]; } SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = (int)(v); } } return res; } SWIGINTERN void array_int32___setitem__(array_int32 *self,size_t index,int value){ self[index] = value; } SWIGINTERN int *array_int32_cast(array_int32 *self){ return self; } SWIGINTERN array_int32 *array_int32_frompointer(int *t){ return (array_int32 *)(t); } typedef unsigned int array_uint32; SWIGINTERN array_uint32 *new_array_uint32(size_t nelements){ return (unsigned int *)calloc(nelements, sizeof(unsigned int)); } SWIGINTERN void delete_array_uint32(array_uint32 *self){ free((char*)self); } SWIGINTERN unsigned int array_uint32___getitem__(array_uint32 *self,size_t index){ return self[index]; } SWIGINTERNINLINE PyObject* SWIG_From_unsigned_SS_int (unsigned int value) { return PyInt_FromSize_t((size_t) value); } SWIGINTERN int SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val) { unsigned long v; int res = SWIG_AsVal_unsigned_SS_long (obj, &v); if (SWIG_IsOK(res)) { if ((v > UINT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = (unsigned int)(v); } } return res; } SWIGINTERN void array_uint32___setitem__(array_uint32 *self,size_t index,unsigned int value){ self[index] = value; } SWIGINTERN unsigned int *array_uint32_cast(array_uint32 *self){ return self; } SWIGINTERN array_uint32 *array_uint32_frompointer(unsigned int *t){ return (array_uint32 *)(t); } typedef float array_float32; SWIGINTERN array_float32 *new_array_float32(size_t nelements){ return (float *)calloc(nelements, sizeof(float)); } SWIGINTERN void delete_array_float32(array_float32 *self){ free((char*)self); } SWIGINTERN float array_float32___getitem__(array_float32 *self,size_t index){ return self[index]; } #define SWIG_From_double PyFloat_FromDouble SWIGINTERNINLINE PyObject * SWIG_From_float (float value) { return SWIG_From_double (value); } /* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */ #ifndef SWIG_isfinite /* isfinite() is a macro for C99 */ # if defined(isfinite) # define SWIG_isfinite(X) (isfinite(X)) # elif defined __cplusplus && __cplusplus >= 201103L /* Use a template so that this works whether isfinite() is std::isfinite() or * in the global namespace. The reality seems to vary between compiler * versions. * * Make sure namespace std exists to avoid compiler warnings. * * extern "C++" is required as this fragment can end up inside an extern "C" { } block */ namespace std { } extern "C++" template inline int SWIG_isfinite_func(T x) { using namespace std; return isfinite(x); } # define SWIG_isfinite(X) (SWIG_isfinite_func(X)) # elif defined(_MSC_VER) # define SWIG_isfinite(X) (_finite(X)) # elif defined(__sun) && defined(__SVR4) # include # define SWIG_isfinite(X) (finite(X)) # endif #endif /* Accept infinite as a valid float value unless we are unable to check if a value is finite */ #ifdef SWIG_isfinite # define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX) && SWIG_isfinite(X)) #else # define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX)) #endif SWIGINTERN int SWIG_AsVal_float (PyObject * obj, float *val) { double v; int res = SWIG_AsVal_double (obj, &v); if (SWIG_IsOK(res)) { if (SWIG_Float_Overflow_Check(v)) { return SWIG_OverflowError; } else { if (val) *val = (float)(v); } } return res; } SWIGINTERN void array_float32___setitem__(array_float32 *self,size_t index,float value){ self[index] = value; } SWIGINTERN float *array_float32_cast(array_float32 *self){ return self; } SWIGINTERN array_float32 *array_float32_frompointer(float *t){ return (array_float32 *)(t); } typedef double array_float64; SWIGINTERN array_float64 *new_array_float64(size_t nelements){ return (double *)calloc(nelements, sizeof(double)); } SWIGINTERN void delete_array_float64(array_float64 *self){ free((char*)self); } SWIGINTERN double array_float64___getitem__(array_float64 *self,size_t index){ return self[index]; } SWIGINTERN void array_float64___setitem__(array_float64 *self,size_t index,double value){ self[index] = value; } SWIGINTERN double *array_float64_cast(array_float64 *self){ return self; } SWIGINTERN array_float64 *array_float64_frompointer(double *t){ return (array_float64 *)(t); } static void * *new_array_voidp(size_t nelements) { return (void * *)calloc(nelements, sizeof(void *)); } static void delete_array_voidp(void * *ary) { free((char*)ary); } static void * array_voidp_getitem(void * *ary, size_t index) { return ary[index]; } static void array_voidp_setitem(void * *ary, size_t index, void * value) { ary[index] = value; } #include "hdf.h" #include "mfhdf.h" SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { #if PY_VERSION_HEX>=0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_Check(obj)) #else if (PyUnicode_Check(obj)) #endif #else if (PyString_Check(obj)) #endif { char *cstr; Py_ssize_t len; #if PY_VERSION_HEX>=0x03000000 #if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require a UTF-8 representation. TODO(bhy) More detailed explanation */ return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); if(alloc) *alloc = SWIG_NEWOBJ; #endif PyBytes_AsStringAndSize(obj, &cstr, &len); #else PyString_AsStringAndSize(obj, &cstr, &len); #endif if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner string representation. To warranty that, if you define SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string buffer is always returned. The default behavior is just to return the pointer value, so, be careful. */ #if defined(SWIG_PYTHON_SAFE_CSTRINGS) if (*alloc != SWIG_OLDOBJ) #else if (*alloc == SWIG_NEWOBJ) #endif { *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); *alloc = SWIG_NEWOBJ; } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { #if PY_VERSION_HEX>=0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) *cptr = PyBytes_AsString(obj); #else assert(0); /* Should never reach here with Unicode strings in Python 3 */ #endif #else *cptr = SWIG_Python_str_AsChar(obj); #endif } } if (psize) *psize = len + 1; #if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) Py_XDECREF(obj); #endif return SWIG_OK; } else { #if defined(SWIG_PYTHON_2_UNICODE) #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" #endif #if PY_VERSION_HEX<0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; if (!alloc && cptr) { return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) { if (cptr) { if (alloc) *alloc = SWIG_NEWOBJ; *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); } if (psize) *psize = len + 1; Py_XDECREF(obj); return SWIG_OK; } else { Py_XDECREF(obj); } } #endif #endif swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = (char *) vptr; if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } SWIGINTERNINLINE PyObject * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { if (carray) { if (size > INT_MAX) { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); return pchar_descriptor ? SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); } else { #if PY_VERSION_HEX >= 0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) return PyBytes_FromStringAndSize(carray, (Py_ssize_t)(size)); #else #if PY_VERSION_HEX >= 0x03010000 return PyUnicode_DecodeUTF8(carray, (Py_ssize_t)(size), "surrogateescape"); #else return PyUnicode_FromStringAndSize(carray, (Py_ssize_t)(size)); #endif #endif #else return PyString_FromStringAndSize(carray, (Py_ssize_t)(size)); #endif } } else { return SWIG_Py_Void(); } } SWIGINTERNINLINE PyObject * SWIG_FromCharPtr(const char *cptr) { return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); } #include void _HEprint(void) { HEprint(stderr,0); } #include "hdfi.h" /* declares int32, float32, etc */ #include "numpy/oldnumeric.h" #define DFNT_FLOAT32 5 #define DFNT_FLOAT 5 /* For backward compat; don't use */ #define DFNT_FLOAT64 6 #define DFNT_DOUBLE 6 /* For backward compat; don't use */ #define DFNT_FLOAT128 7 /* No current plans for support */ #define DFNT_INT8 20 #define DFNT_UINT8 21 #define DFNT_INT16 22 #define DFNT_UINT16 23 #define DFNT_INT32 24 #define DFNT_UINT32 25 #define DFNT_INT64 26 #define DFNT_UINT64 27 #define DFNT_UCHAR8 3 /* 3 chosen for backward compatibility */ #define DFNT_UCHAR 3 /* uchar=uchar8 for backward compatibility */ #define DFNT_CHAR8 4 /* 4 chosen for backward compatibility */ #define DFNT_CHAR 4 /* uchar=uchar8 for backward compatibility */ static int HDFtoNumericType(int hdf) { int num; switch (hdf) { case DFNT_FLOAT32: num = PyArray_FLOAT; break; case DFNT_FLOAT64: num = PyArray_DOUBLE; break; case DFNT_INT8 : num = PyArray_SBYTE; break; case DFNT_UINT8 : num = PyArray_UBYTE; break; case DFNT_INT16 : num = PyArray_SHORT; break; #ifndef NOUINT case DFNT_UINT16 : num = PyArray_USHORT; break; #endif case DFNT_INT32 : num = PyArray_INT; break; #ifndef NOUINT case DFNT_UINT32 : num = PyArray_UINT; break; #endif case DFNT_CHAR8 : num = PyArray_CHAR; break; case DFNT_UCHAR8 : num = PyArray_UBYTE; break; default: num = -1; break; } return num; } static PyObject * _SDreaddata_0(int32 sds_id, int32 data_type, PyObject *start, PyObject *edges, PyObject *stride) { /* * A value of -1 in 'edges' indicates that the dimension * is indexed, not sliced. This dimension should be removed from * the output array. */ PyArrayObject *array; PyObject *o; int n, rank, outRank, num_type, status; /* * Allocate those arrays on the stack for simplicity. * 80 dimensions should be more than enough! */ int startArr[80], strideArr[80], edgesArr[80]; npy_intp dims[80]; float f32; double f64; int i32; /* * Load arrays. Caller has guaranteeded that all 3 arrays have the * same dimensions. */ rank = PyObject_Length(start); outRank = 0; dims[0] = 0; for (n = 0; n < rank; n++) { o = PySequence_GetItem(start, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg start contains a non-integer"); return NULL; } startArr[n] = PyInt_AsLong(o); o = PySequence_GetItem(edges, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg edges contains a non-integer"); return NULL; } /* * Do as numpy when a dimension is indexed (indicated by * a count of -1). * This dimension is then dropped from the output array, * producing a subarray. For ex., if m is a 3x3 array, m[0] * is a 3 element vector holding the first row of `m'. * Variables `outRank' and `dims' store the resulting array * rank and dimension lengths, resp. */ edgesArr[n] = PyInt_AsLong(o); if (edgesArr[n] != -1) { dims[outRank++] = abs(edgesArr[n]); } else edgesArr[n] = 1; o = PySequence_GetItem(stride, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg stride contains a non-integer"); return NULL; } strideArr[n] = PyInt_AsLong(o); } /* * Create output numpy array. */ if ((num_type = HDFtoNumericType(data_type)) < 0) { PyErr_SetString(PyExc_ValueError, "data_type not compatible with numpy"); return NULL; } if ((array = (PyArrayObject *) PyArray_SimpleNew(outRank, dims, num_type)) == NULL) return NULL; /* * Load it from the SDS. */ status = SDreaddata(sds_id, startArr, strideArr, edgesArr, array -> data); if (status < 0) { PyErr_SetString(PyExc_ValueError, "SDreaddata failure"); Py_DECREF(array); /* Free array */ return NULL; } /* * Return array. * PyArray_Return() does not seem to work ok. * Deal ourselves with the 0 rank case. */ /* return PyArray_Return(array); */ if (outRank > 0) return (PyObject *) array; switch (num_type) { case PyArray_FLOAT: f32 = *(float *) array->data; o = PyFloat_FromDouble((double) f32); break; case PyArray_DOUBLE: f64 = *(double *) array->data; o = PyFloat_FromDouble(f64); break; case PyArray_CHAR: case PyArray_SBYTE: i32 = *(char *) array->data; o = PyInt_FromLong((long) i32); break; case PyArray_UBYTE: i32 = *(unsigned char *) array->data; o = PyInt_FromLong((long) i32); break; case PyArray_SHORT: i32 = *(short *) array->data; o = PyInt_FromLong((long) i32); break; case PyArray_INT: i32 = *(int *) array->data; o = PyInt_FromLong((long) i32); break; } Py_DECREF(array); /* Free array */ return o; } static PyObject * _SDwritedata_0(int32 sds_id, int32 data_type, PyObject *start, PyObject *edges, PyObject *data, PyObject *stride) { PyArrayObject *array; PyObject *o; int n, rank, num_type, status; /* * Allocate those arrays on the stack for simplicity. * 80 dimensions should be more than enough! */ int startArr[80], strideArr[80], edgesArr[80]; /* * Load arrays. Caller has guaranteeded that all 3 arrays have the * same dimensions. */ rank = PyObject_Length(start); for (n = 0; n < rank; n++) { o = PySequence_GetItem(start, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg start contains a non-integer"); return NULL; } startArr[n] = PyInt_AsLong(o); o = PySequence_GetItem(edges, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg edges contains a non-integer"); return NULL; } /* * A value of -1 indicates that an index, not a slice, was applied * to the dimension. This difference is significant only for a * `get' operation. So ignore it here. */ edgesArr[n] = abs(PyInt_AsLong(o)); o = PySequence_GetItem(stride, n); if (!PyInt_Check(o)) { PyErr_SetString(PyExc_ValueError, "arg stride contains a non-integer"); return NULL; } strideArr[n] = PyInt_AsLong(o); } /* * Convert input to a contiguous numpy array (no penalty if * input already in this format). */ if ((num_type = HDFtoNumericType(data_type)) < 0) { PyErr_SetString(PyExc_ValueError, "data_type not compatible with numpy"); return NULL; } if ((array = (PyArrayObject *) PyArray_ContiguousFromObject(data, num_type, rank - 1, rank)) == NULL) return NULL; /* * Store in the SDS. */ status = SDwritedata(sds_id, startArr, strideArr, edgesArr, array -> data); Py_DECREF(array); /* Free array */ if (status < 0) { PyErr_SetString(PyExc_ValueError, "SDwritedata failure"); return NULL; } /* * Return None. */ Py_INCREF(Py_None); return Py_None; } #include "hcomp.h" static int32 _SDgetcompress(int32 sds_id, int32 *comp_type, int32 *value, int32 *v2, int32 *v3, int32 *v4, int32 *v5) { comp_info c_info; int32 status; #ifdef NOCOMPRESS status = -1; #else status = SDgetcompress(sds_id, comp_type, &c_info); switch (*comp_type) { case COMP_CODE_NONE: case COMP_CODE_RLE : break; case COMP_CODE_SKPHUFF: *value = c_info.skphuff.skp_size; break; case COMP_CODE_DEFLATE: *value = c_info.deflate.level; break; #ifndef NOSZIP case COMP_CODE_SZIP: *value = c_info.szip.options_mask; *v2 = c_info.szip.pixels_per_block; *v3 = c_info.szip.pixels_per_scanline; *v4 = c_info.szip.bits_per_pixel; *v5 = c_info.szip.pixels; break; #endif } #endif return status; } static int32 _SDsetcompress(int32 sds_id, int32 comp_type, int32 value, int32 v2) { comp_info c_info; int32 status; #ifdef NOCOMPRESS status = -1; #else switch (comp_type) { case COMP_CODE_NONE: case COMP_CODE_RLE : break; case COMP_CODE_SKPHUFF: c_info.skphuff.skp_size = value; break; case COMP_CODE_DEFLATE: c_info.deflate.level = value; break; #ifndef NOSZIP case COMP_CODE_SZIP: c_info.szip.options_mask = value; c_info.szip.pixels_per_block = v2; break; #endif } status = SDsetcompress(sds_id, comp_type, &c_info); #endif return status; } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_new_array_byte(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; size_t arg1 ; size_t val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; array_byte *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_array_byte",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_size_t(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_array_byte" "', argument " "1"" of type '" "size_t""'"); } arg1 = (size_t)(val1); result = (array_byte *)new_array_byte(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_byte, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_array_byte(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_byte *arg1 = (array_byte *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_array_byte",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_byte, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_array_byte" "', argument " "1"" of type '" "array_byte *""'"); } arg1 = (array_byte *)(argp1); delete_array_byte(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_byte___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_byte *arg1 = (array_byte *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; unsigned char result; if (!PyArg_ParseTuple(args,(char *)"OO:array_byte___getitem__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_byte, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_byte___getitem__" "', argument " "1"" of type '" "array_byte *""'"); } arg1 = (array_byte *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_byte___getitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); result = (unsigned char)array_byte___getitem__(arg1,arg2); resultobj = SWIG_From_unsigned_SS_char((unsigned char)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_byte___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_byte *arg1 = (array_byte *) 0 ; size_t arg2 ; unsigned char arg3 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; unsigned char val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:array_byte___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_byte, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_byte___setitem__" "', argument " "1"" of type '" "array_byte *""'"); } arg1 = (array_byte *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_byte___setitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); ecode3 = SWIG_AsVal_unsigned_SS_char(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "array_byte___setitem__" "', argument " "3"" of type '" "unsigned char""'"); } arg3 = (unsigned char)(val3); array_byte___setitem__(arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_byte_cast(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_byte *arg1 = (array_byte *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; unsigned char *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_byte_cast",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_byte, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_byte_cast" "', argument " "1"" of type '" "array_byte *""'"); } arg1 = (array_byte *)(argp1); result = (unsigned char *)array_byte_cast(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_char, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_byte_frompointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; unsigned char *arg1 = (unsigned char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; array_byte *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_byte_frompointer",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_unsigned_char, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_byte_frompointer" "', argument " "1"" of type '" "unsigned char *""'"); } arg1 = (unsigned char *)(argp1); result = (array_byte *)array_byte_frompointer(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_byte, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *array_byte_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_array_byte, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_array_int8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; size_t arg1 ; size_t val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; array_int8 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_array_int8",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_size_t(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_array_int8" "', argument " "1"" of type '" "size_t""'"); } arg1 = (size_t)(val1); result = (array_int8 *)new_array_int8(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_int8, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_array_int8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int8 *arg1 = (array_int8 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_array_int8",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int8, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_array_int8" "', argument " "1"" of type '" "array_int8 *""'"); } arg1 = (array_int8 *)(argp1); delete_array_int8(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int8___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int8 *arg1 = (array_int8 *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; signed char result; if (!PyArg_ParseTuple(args,(char *)"OO:array_int8___getitem__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int8, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int8___getitem__" "', argument " "1"" of type '" "array_int8 *""'"); } arg1 = (array_int8 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_int8___getitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); result = (signed char)array_int8___getitem__(arg1,arg2); resultobj = SWIG_From_signed_SS_char((signed char)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int8___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int8 *arg1 = (array_int8 *) 0 ; size_t arg2 ; signed char arg3 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; signed char val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:array_int8___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int8, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int8___setitem__" "', argument " "1"" of type '" "array_int8 *""'"); } arg1 = (array_int8 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_int8___setitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); ecode3 = SWIG_AsVal_signed_SS_char(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "array_int8___setitem__" "', argument " "3"" of type '" "signed char""'"); } arg3 = (signed char)(val3); array_int8___setitem__(arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int8_cast(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int8 *arg1 = (array_int8 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; signed char *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_int8_cast",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int8, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int8_cast" "', argument " "1"" of type '" "array_int8 *""'"); } arg1 = (array_int8 *)(argp1); result = (signed char *)array_int8_cast(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_signed_char, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int8_frompointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; signed char *arg1 = (signed char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; array_int8 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_int8_frompointer",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_signed_char, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int8_frompointer" "', argument " "1"" of type '" "signed char *""'"); } arg1 = (signed char *)(argp1); result = (array_int8 *)array_int8_frompointer(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_int8, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *array_int8_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_array_int8, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_array_int16(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; size_t arg1 ; size_t val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; array_int16 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_array_int16",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_size_t(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_array_int16" "', argument " "1"" of type '" "size_t""'"); } arg1 = (size_t)(val1); result = (array_int16 *)new_array_int16(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_int16, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_array_int16(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int16 *arg1 = (array_int16 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_array_int16",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int16, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_array_int16" "', argument " "1"" of type '" "array_int16 *""'"); } arg1 = (array_int16 *)(argp1); delete_array_int16(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int16___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int16 *arg1 = (array_int16 *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; short result; if (!PyArg_ParseTuple(args,(char *)"OO:array_int16___getitem__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int16, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int16___getitem__" "', argument " "1"" of type '" "array_int16 *""'"); } arg1 = (array_int16 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_int16___getitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); result = (short)array_int16___getitem__(arg1,arg2); resultobj = SWIG_From_short((short)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int16___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int16 *arg1 = (array_int16 *) 0 ; size_t arg2 ; short arg3 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; short val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:array_int16___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int16, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int16___setitem__" "', argument " "1"" of type '" "array_int16 *""'"); } arg1 = (array_int16 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_int16___setitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); ecode3 = SWIG_AsVal_short(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "array_int16___setitem__" "', argument " "3"" of type '" "short""'"); } arg3 = (short)(val3); array_int16___setitem__(arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int16_cast(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int16 *arg1 = (array_int16 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; short *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_int16_cast",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int16, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int16_cast" "', argument " "1"" of type '" "array_int16 *""'"); } arg1 = (array_int16 *)(argp1); result = (short *)array_int16_cast(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_short, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int16_frompointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; short *arg1 = (short *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; array_int16 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_int16_frompointer",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_short, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int16_frompointer" "', argument " "1"" of type '" "short *""'"); } arg1 = (short *)(argp1); result = (array_int16 *)array_int16_frompointer(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_int16, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *array_int16_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_array_int16, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_array_uint16(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; size_t arg1 ; size_t val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; array_uint16 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_array_uint16",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_size_t(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_array_uint16" "', argument " "1"" of type '" "size_t""'"); } arg1 = (size_t)(val1); result = (array_uint16 *)new_array_uint16(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_uint16, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_array_uint16(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_uint16 *arg1 = (array_uint16 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_array_uint16",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_uint16, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_array_uint16" "', argument " "1"" of type '" "array_uint16 *""'"); } arg1 = (array_uint16 *)(argp1); delete_array_uint16(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_uint16___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_uint16 *arg1 = (array_uint16 *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; unsigned short result; if (!PyArg_ParseTuple(args,(char *)"OO:array_uint16___getitem__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_uint16, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_uint16___getitem__" "', argument " "1"" of type '" "array_uint16 *""'"); } arg1 = (array_uint16 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_uint16___getitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); result = (unsigned short)array_uint16___getitem__(arg1,arg2); resultobj = SWIG_From_unsigned_SS_short((unsigned short)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_uint16___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_uint16 *arg1 = (array_uint16 *) 0 ; size_t arg2 ; unsigned short arg3 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; unsigned short val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:array_uint16___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_uint16, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_uint16___setitem__" "', argument " "1"" of type '" "array_uint16 *""'"); } arg1 = (array_uint16 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_uint16___setitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); ecode3 = SWIG_AsVal_unsigned_SS_short(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "array_uint16___setitem__" "', argument " "3"" of type '" "unsigned short""'"); } arg3 = (unsigned short)(val3); array_uint16___setitem__(arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_uint16_cast(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_uint16 *arg1 = (array_uint16 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; unsigned short *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_uint16_cast",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_uint16, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_uint16_cast" "', argument " "1"" of type '" "array_uint16 *""'"); } arg1 = (array_uint16 *)(argp1); result = (unsigned short *)array_uint16_cast(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_short, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_uint16_frompointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; unsigned short *arg1 = (unsigned short *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; array_uint16 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_uint16_frompointer",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_unsigned_short, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_uint16_frompointer" "', argument " "1"" of type '" "unsigned short *""'"); } arg1 = (unsigned short *)(argp1); result = (array_uint16 *)array_uint16_frompointer(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_uint16, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *array_uint16_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_array_uint16, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_array_int32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; size_t arg1 ; size_t val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; array_int32 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_array_int32",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_size_t(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_array_int32" "', argument " "1"" of type '" "size_t""'"); } arg1 = (size_t)(val1); result = (array_int32 *)new_array_int32(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_int32, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_array_int32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int32 *arg1 = (array_int32 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_array_int32",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int32, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_array_int32" "', argument " "1"" of type '" "array_int32 *""'"); } arg1 = (array_int32 *)(argp1); delete_array_int32(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int32___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int32 *arg1 = (array_int32 *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:array_int32___getitem__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int32, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int32___getitem__" "', argument " "1"" of type '" "array_int32 *""'"); } arg1 = (array_int32 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_int32___getitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); result = (int)array_int32___getitem__(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int32___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int32 *arg1 = (array_int32 *) 0 ; size_t arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:array_int32___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int32, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int32___setitem__" "', argument " "1"" of type '" "array_int32 *""'"); } arg1 = (array_int32 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_int32___setitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "array_int32___setitem__" "', argument " "3"" of type '" "int""'"); } arg3 = (int)(val3); array_int32___setitem__(arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int32_cast(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_int32 *arg1 = (array_int32 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_int32_cast",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_int32, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int32_cast" "', argument " "1"" of type '" "array_int32 *""'"); } arg1 = (array_int32 *)(argp1); result = (int *)array_int32_cast(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_int32_frompointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int *arg1 = (int *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; array_int32 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_int32_frompointer",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_int32_frompointer" "', argument " "1"" of type '" "int *""'"); } arg1 = (int *)(argp1); result = (array_int32 *)array_int32_frompointer(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_int32, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *array_int32_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_array_int32, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_array_uint32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; size_t arg1 ; size_t val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; array_uint32 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_array_uint32",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_size_t(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_array_uint32" "', argument " "1"" of type '" "size_t""'"); } arg1 = (size_t)(val1); result = (array_uint32 *)new_array_uint32(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_uint32, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_array_uint32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_uint32 *arg1 = (array_uint32 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_array_uint32",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_uint32, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_array_uint32" "', argument " "1"" of type '" "array_uint32 *""'"); } arg1 = (array_uint32 *)(argp1); delete_array_uint32(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_uint32___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_uint32 *arg1 = (array_uint32 *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; unsigned int result; if (!PyArg_ParseTuple(args,(char *)"OO:array_uint32___getitem__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_uint32, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_uint32___getitem__" "', argument " "1"" of type '" "array_uint32 *""'"); } arg1 = (array_uint32 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_uint32___getitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); result = (unsigned int)array_uint32___getitem__(arg1,arg2); resultobj = SWIG_From_unsigned_SS_int((unsigned int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_uint32___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_uint32 *arg1 = (array_uint32 *) 0 ; size_t arg2 ; unsigned int arg3 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; unsigned int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:array_uint32___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_uint32, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_uint32___setitem__" "', argument " "1"" of type '" "array_uint32 *""'"); } arg1 = (array_uint32 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_uint32___setitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "array_uint32___setitem__" "', argument " "3"" of type '" "unsigned int""'"); } arg3 = (unsigned int)(val3); array_uint32___setitem__(arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_uint32_cast(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_uint32 *arg1 = (array_uint32 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; unsigned int *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_uint32_cast",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_uint32, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_uint32_cast" "', argument " "1"" of type '" "array_uint32 *""'"); } arg1 = (array_uint32 *)(argp1); result = (unsigned int *)array_uint32_cast(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_uint32_frompointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; unsigned int *arg1 = (unsigned int *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; array_uint32 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_uint32_frompointer",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_unsigned_int, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_uint32_frompointer" "', argument " "1"" of type '" "unsigned int *""'"); } arg1 = (unsigned int *)(argp1); result = (array_uint32 *)array_uint32_frompointer(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_uint32, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *array_uint32_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_array_uint32, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_array_float32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; size_t arg1 ; size_t val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; array_float32 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_array_float32",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_size_t(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_array_float32" "', argument " "1"" of type '" "size_t""'"); } arg1 = (size_t)(val1); result = (array_float32 *)new_array_float32(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_float32, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_array_float32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_float32 *arg1 = (array_float32 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_array_float32",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_float32, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_array_float32" "', argument " "1"" of type '" "array_float32 *""'"); } arg1 = (array_float32 *)(argp1); delete_array_float32(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_float32___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_float32 *arg1 = (array_float32 *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OO:array_float32___getitem__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_float32, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_float32___getitem__" "', argument " "1"" of type '" "array_float32 *""'"); } arg1 = (array_float32 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_float32___getitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); result = (float)array_float32___getitem__(arg1,arg2); resultobj = SWIG_From_float((float)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_float32___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_float32 *arg1 = (array_float32 *) 0 ; size_t arg2 ; float arg3 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; float val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:array_float32___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_float32, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_float32___setitem__" "', argument " "1"" of type '" "array_float32 *""'"); } arg1 = (array_float32 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_float32___setitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "array_float32___setitem__" "', argument " "3"" of type '" "float""'"); } arg3 = (float)(val3); array_float32___setitem__(arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_float32_cast(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_float32 *arg1 = (array_float32 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; float *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_float32_cast",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_float32, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_float32_cast" "', argument " "1"" of type '" "array_float32 *""'"); } arg1 = (array_float32 *)(argp1); result = (float *)array_float32_cast(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_float32_frompointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; float *arg1 = (float *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; array_float32 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_float32_frompointer",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_float32_frompointer" "', argument " "1"" of type '" "float *""'"); } arg1 = (float *)(argp1); result = (array_float32 *)array_float32_frompointer(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_float32, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *array_float32_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_array_float32, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_array_float64(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; size_t arg1 ; size_t val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; array_float64 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_array_float64",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_size_t(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_array_float64" "', argument " "1"" of type '" "size_t""'"); } arg1 = (size_t)(val1); result = (array_float64 *)new_array_float64(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_float64, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_array_float64(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_float64 *arg1 = (array_float64 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_array_float64",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_float64, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_array_float64" "', argument " "1"" of type '" "array_float64 *""'"); } arg1 = (array_float64 *)(argp1); delete_array_float64(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_float64___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_float64 *arg1 = (array_float64 *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OO:array_float64___getitem__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_float64, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_float64___getitem__" "', argument " "1"" of type '" "array_float64 *""'"); } arg1 = (array_float64 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_float64___getitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); result = (double)array_float64___getitem__(arg1,arg2); resultobj = SWIG_From_double((double)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_float64___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_float64 *arg1 = (array_float64 *) 0 ; size_t arg2 ; double arg3 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; double val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:array_float64___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_float64, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_float64___setitem__" "', argument " "1"" of type '" "array_float64 *""'"); } arg1 = (array_float64 *)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_float64___setitem__" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); ecode3 = SWIG_AsVal_double(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "array_float64___setitem__" "', argument " "3"" of type '" "double""'"); } arg3 = (double)(val3); array_float64___setitem__(arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_float64_cast(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; array_float64 *arg1 = (array_float64 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; double *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_float64_cast",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_array_float64, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_float64_cast" "', argument " "1"" of type '" "array_float64 *""'"); } arg1 = (array_float64 *)(argp1); result = (double *)array_float64_cast(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_float64_frompointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; double *arg1 = (double *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; array_float64 *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:array_float64_frompointer",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_double, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_float64_frompointer" "', argument " "1"" of type '" "double *""'"); } arg1 = (double *)(argp1); result = (array_float64 *)array_float64_frompointer(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_array_float64, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *array_float64_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_array_float64, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_array_voidp(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; size_t arg1 ; size_t val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; void **result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_array_voidp",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_size_t(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_array_voidp" "', argument " "1"" of type '" "size_t""'"); } arg1 = (size_t)(val1); result = (void **)new_array_voidp(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_void, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_array_voidp(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; void **arg1 = (void **) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_array_voidp",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_p_void, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_array_voidp" "', argument " "1"" of type '" "void **""'"); } arg1 = (void **)(argp1); delete_array_voidp(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_voidp_getitem(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; void **arg1 = (void **) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; void *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:array_voidp_getitem",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_p_void, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_voidp_getitem" "', argument " "1"" of type '" "void **""'"); } arg1 = (void **)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_voidp_getitem" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); result = (void *)array_voidp_getitem(arg1,arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_array_voidp_setitem(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; void **arg1 = (void **) 0 ; size_t arg2 ; void *arg3 = (void *) 0 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; int res3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:array_voidp_setitem",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_p_void, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "array_voidp_setitem" "', argument " "1"" of type '" "void **""'"); } arg1 = (void **)(argp1); ecode2 = SWIG_AsVal_size_t(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "array_voidp_setitem" "', argument " "2"" of type '" "size_t""'"); } arg2 = (size_t)(val2); res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "array_voidp_setitem" "', argument " "3"" of type '" "void *""'"); } array_voidp_setitem(arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Hopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; intn arg2 ; int arg3 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOO:Hopen",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Hopen" "', argument " "1"" of type '" "char const *""'"); } arg1 = (char *)(buf1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Hopen" "', argument " "2"" of type '" "intn""'"); } arg2 = (intn)(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Hopen" "', argument " "3"" of type '" "int""'"); } arg3 = (int)(val3); result = (int32)Hopen((char const *)arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return NULL; } SWIGINTERN PyObject *_wrap_Hclose(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"O:Hclose",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Hclose" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)Hclose(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Hgetlibversion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; uint32 *arg1 = (uint32 *) 0 ; uint32 *arg2 = (uint32 *) 0 ; uint32 *arg3 = (uint32 *) 0 ; char *arg4 = (char *) 0 ; uint32 temp1 ; int res1 = SWIG_TMPOBJ ; uint32 temp2 ; int res2 = SWIG_TMPOBJ ; uint32 temp3 ; int res3 = SWIG_TMPOBJ ; char temp4[4096+1] ; intn result; arg1 = &temp1; arg2 = &temp2; arg3 = &temp3; arg4 = (char *) temp4; if (!PyArg_ParseTuple(args,(char *)":Hgetlibversion")) SWIG_fail; result = (intn)Hgetlibversion(arg1,arg2,arg3,arg4); resultobj = SWIG_From_int((int)(result)); if (SWIG_IsTmpObj(res1)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg1))); } else { int new_flags = SWIG_IsNewObj(res1) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg1), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res2)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); } else { int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } arg4[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg4)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Hgetfileversion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; uint32 *arg2 = (uint32 *) 0 ; uint32 *arg3 = (uint32 *) 0 ; uint32 *arg4 = (uint32 *) 0 ; char *arg5 = (char *) 0 ; int val1 ; int ecode1 = 0 ; uint32 temp2 ; int res2 = SWIG_TMPOBJ ; uint32 temp3 ; int res3 = SWIG_TMPOBJ ; uint32 temp4 ; int res4 = SWIG_TMPOBJ ; char temp5[4096+1] ; PyObject * obj0 = 0 ; intn result; arg2 = &temp2; arg3 = &temp3; arg4 = &temp4; arg5 = (char *) temp5; if (!PyArg_ParseTuple(args,(char *)"O:Hgetfileversion",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Hgetfileversion" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)Hgetfileversion(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_From_int((int)(result)); if (SWIG_IsTmpObj(res2)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); } else { int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res4)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4))); } else { int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags)); } arg5[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg5)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Hishdf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; PyObject * obj0 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"O:Hishdf",&obj0)) SWIG_fail; res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Hishdf" "', argument " "1"" of type '" "char const *""'"); } arg1 = (char *)(buf1); result = (intn)Hishdf((char const *)arg1); resultobj = SWIG_From_int((int)(result)); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return NULL; } SWIGINTERN PyObject *_wrap_HEvalue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:HEvalue",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "HEvalue" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)HEvalue(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_HEstring(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; char *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:HEstring",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "HEstring" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (char *)HEstring(arg1); resultobj = SWIG_FromCharPtr((const char *)result); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap__HEprint(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; if (!PyArg_ParseTuple(args,(char *)":_HEprint")) SWIG_fail; _HEprint(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap__SDreaddata_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; PyObject *arg3 = (PyObject *) 0 ; PyObject *arg4 = (PyObject *) 0 ; PyObject *arg5 = (PyObject *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:_SDreaddata_0",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "_SDreaddata_0" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SDreaddata_0" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); arg3 = obj2; arg4 = obj3; arg5 = obj4; result = (PyObject *)_SDreaddata_0(arg1,arg2,arg3,arg4,arg5); resultobj = result; return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap__SDwritedata_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; PyObject *arg3 = (PyObject *) 0 ; PyObject *arg4 = (PyObject *) 0 ; PyObject *arg5 = (PyObject *) 0 ; PyObject *arg6 = (PyObject *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOOO:_SDwritedata_0",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "_SDwritedata_0" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SDwritedata_0" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); arg3 = obj2; arg4 = obj3; arg5 = obj4; arg6 = obj5; result = (PyObject *)_SDwritedata_0(arg1,arg2,arg3,arg4,arg5,arg6); resultobj = result; return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDstart(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; int32 arg2 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDstart",&obj0,&obj1)) SWIG_fail; res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SDstart" "', argument " "1"" of type '" "char const *""'"); } arg1 = (char *)(buf1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SDstart" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)SDstart((char const *)arg1,arg2); resultobj = SWIG_From_int((int)(result)); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return NULL; } SWIGINTERN PyObject *_wrap_SDcreate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int32 arg3 ; int32 arg4 ; int32 *arg5 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:SDcreate",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDcreate" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDcreate" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SDcreate" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SDcreate" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); res5 = SWIG_ConvertPtr(obj4, &argp5,SWIGTYPE_p_int, 0 | 0 ); if (!SWIG_IsOK(res5)) { SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "SDcreate" "', argument " "5"" of type '" "int32 const *""'"); } arg5 = (int32 *)(argp5); result = (int32)SDcreate(arg1,(char const *)arg2,arg3,arg4,(int const *)arg5); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_SDselect(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDselect",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDselect" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SDselect" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)SDselect(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDendaccess(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:SDendaccess",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDendaccess" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)SDendaccess(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:SDend",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDend" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)SDend(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDfileinfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 *arg2 = (int32 *) 0 ; int32 *arg3 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; int32 temp2 ; int res2 = SWIG_TMPOBJ ; int32 temp3 ; int res3 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; int32 result; arg2 = &temp2; arg3 = &temp3; if (!PyArg_ParseTuple(args,(char *)"O:SDfileinfo",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDfileinfo" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)SDfileinfo(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); if (SWIG_IsTmpObj(res2)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); } else { int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDgetinfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int32 *arg3 = (int32 *) 0 ; void *arg4 = (void *) 0 ; int32 *arg5 = (int32 *) 0 ; int32 *arg6 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; char temp2[H4_MAX_NC_NAME+1] ; int32 temp3 ; int res3 = SWIG_TMPOBJ ; int res4 ; int32 temp5 ; int res5 = SWIG_TMPOBJ ; int32 temp6 ; int res6 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; arg2 = (char *) temp2; arg3 = &temp3; arg5 = &temp5; arg6 = &temp6; if (!PyArg_ParseTuple(args,(char *)"OO:SDgetinfo",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDgetinfo" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res4 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg4), 0, 0); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SDgetinfo" "', argument " "4"" of type '" "void *""'"); } result = (int32)SDgetinfo(arg1,arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_From_int((int)(result)); arg2[H4_MAX_NC_NAME] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2)); if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res5)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg5))); } else { int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res6)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg6))); } else { int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDcheckempty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 *arg2 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; int32 temp2 ; int res2 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; int32 result; arg2 = &temp2; if (!PyArg_ParseTuple(args,(char *)"O:SDcheckempty",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDcheckempty" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)SDcheckempty(arg1,arg2); resultobj = SWIG_From_int((int)(result)); if (SWIG_IsTmpObj(res2)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); } else { int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDidtoref(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:SDidtoref",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDidtoref" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)SDidtoref(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDiscoordvar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:SDiscoordvar",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDiscoordvar" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)SDiscoordvar(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDisrecord(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:SDisrecord",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDisrecord" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)SDisrecord(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDnametoindex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDnametoindex",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDnametoindex" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDnametoindex" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (int32)SDnametoindex(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_SDreftoindex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDreftoindex",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDreftoindex" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SDreftoindex" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)SDreftoindex(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDdiminfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int32 *arg3 = (int32 *) 0 ; int32 *arg4 = (int32 *) 0 ; int32 *arg5 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; char temp2[4096+1] ; int32 temp3 ; int res3 = SWIG_TMPOBJ ; int32 temp4 ; int res4 = SWIG_TMPOBJ ; int32 temp5 ; int res5 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; int32 result; arg2 = (char *) temp2; arg3 = &temp3; arg4 = &temp4; arg5 = &temp5; if (!PyArg_ParseTuple(args,(char *)"O:SDdiminfo",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDdiminfo" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)SDdiminfo(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_From_int((int)(result)); arg2[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2)); if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res4)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4))); } else { int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res5)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg5))); } else { int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDgetdimid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDgetdimid",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDgetdimid" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SDgetdimid" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)SDgetdimid(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDsetdimname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDsetdimname",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetdimname" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDsetdimname" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (int32)SDsetdimname(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_SDgetdimscale(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; void *arg2 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDgetdimscale",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDgetdimscale" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDgetdimscale" "', argument " "2"" of type '" "void *""'"); } result = (int32)SDgetdimscale(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDsetdimscale(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int32 arg3 ; void *arg4 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; int res4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOO:SDsetdimscale",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetdimscale" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SDsetdimscale" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SDsetdimscale" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SDsetdimscale" "', argument " "4"" of type '" "void const *""'"); } result = (int32)SDsetdimscale(arg1,arg2,arg3,(void const *)arg4); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDattrinfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; char *arg3 = (char *) 0 ; int32 *arg4 = (int32 *) 0 ; int32 *arg5 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; char temp3[4096+1] ; int32 temp4 ; int res4 = SWIG_TMPOBJ ; int32 temp5 ; int res5 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; arg3 = (char *) temp3; arg4 = &temp4; arg5 = &temp5; if (!PyArg_ParseTuple(args,(char *)"OO:SDattrinfo",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDattrinfo" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SDattrinfo" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)SDattrinfo(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_From_int((int)(result)); arg3[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg3)); if (SWIG_IsTmpObj(res4)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4))); } else { int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res5)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg5))); } else { int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDfindattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDfindattr",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDfindattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDfindattr" "', argument " "2"" of type '" "char *""'"); } arg2 = (char *)(buf2); result = (int32)SDfindattr(arg1,arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_SDreadattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; void *arg3 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int res3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOO:SDreadattr",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDreadattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SDreadattr" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SDreadattr" "', argument " "3"" of type '" "void *""'"); } result = (int32)SDreadattr(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDsetattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int32 arg3 ; int32 arg4 ; void *arg5 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int res5 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:SDsetattr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDsetattr" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SDsetattr" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SDsetattr" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); res5 = SWIG_ConvertPtr(obj4,SWIG_as_voidptrptr(&arg5), 0, 0); if (!SWIG_IsOK(res5)) { SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "SDsetattr" "', argument " "5"" of type '" "void const *""'"); } result = (int32)SDsetattr(arg1,(char const *)arg2,arg3,arg4,(void const *)arg5); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_SDgetcal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; double *arg2 = (double *) 0 ; double *arg3 = (double *) 0 ; double *arg4 = (double *) 0 ; double *arg5 = (double *) 0 ; int32 *arg6 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; double temp2 ; int res2 = SWIG_TMPOBJ ; double temp3 ; int res3 = SWIG_TMPOBJ ; double temp4 ; int res4 = SWIG_TMPOBJ ; double temp5 ; int res5 = SWIG_TMPOBJ ; int32 temp6 ; int res6 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; int32 result; arg2 = &temp2; arg3 = &temp3; arg4 = &temp4; arg5 = &temp5; arg6 = &temp6; if (!PyArg_ParseTuple(args,(char *)"O:SDgetcal",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDgetcal" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)SDgetcal(arg1,arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_From_int((int)(result)); if (SWIG_IsTmpObj(res2)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_double((*arg2))); } else { int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_double, new_flags)); } if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_double((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_double, new_flags)); } if (SWIG_IsTmpObj(res4)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_double((*arg4))); } else { int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_double, new_flags)); } if (SWIG_IsTmpObj(res5)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_double((*arg5))); } else { int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags)); } if (SWIG_IsTmpObj(res6)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg6))); } else { int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDgetdatastrs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; char *arg5 = (char *) 0 ; int32 arg6 ; int val1 ; int ecode1 = 0 ; char temp2[128+1] ; char temp3[128+1] ; char temp4[128+1] ; char temp5[128+1] ; int val6 ; int ecode6 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; arg2 = (char *) temp2; arg3 = (char *) temp3; arg4 = (char *) temp4; arg5 = (char *) temp5; if (!PyArg_ParseTuple(args,(char *)"OO:SDgetdatastrs",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDgetdatastrs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode6 = SWIG_AsVal_int(obj1, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SDgetdatastrs" "', argument " "6"" of type '" "int32""'"); } arg6 = (int32)(val6); result = (int32)SDgetdatastrs(arg1,arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_From_int((int)(result)); arg2[128] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2)); arg3[128] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg3)); arg4[128] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg4)); arg5[128] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg5)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDgetdimstrs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; int32 arg5 ; int val1 ; int ecode1 = 0 ; char temp2[128+1] ; char temp3[128+1] ; char temp4[128+1] ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; arg2 = (char *) temp2; arg3 = (char *) temp3; arg4 = (char *) temp4; if (!PyArg_ParseTuple(args,(char *)"OO:SDgetdimstrs",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDgetdimstrs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode5 = SWIG_AsVal_int(obj1, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SDgetdimstrs" "', argument " "5"" of type '" "int32""'"); } arg5 = (int32)(val5); result = (int32)SDgetdimstrs(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_From_int((int)(result)); arg2[128] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2)); arg3[128] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg3)); arg4[128] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg4)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDgetfillvalue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; void *arg2 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDgetfillvalue",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDgetfillvalue" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDgetfillvalue" "', argument " "2"" of type '" "void *""'"); } result = (int32)SDgetfillvalue(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDgetrange(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; void *arg2 = (void *) 0 ; void *arg3 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; int res3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOO:SDgetrange",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDgetrange" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDgetrange" "', argument " "2"" of type '" "void *""'"); } res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SDgetrange" "', argument " "3"" of type '" "void *""'"); } result = (int32)SDgetrange(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDsetcal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; double arg2 ; double arg3 ; double arg4 ; double arg5 ; int32 arg6 ; int val1 ; int ecode1 = 0 ; double val2 ; int ecode2 = 0 ; double val3 ; int ecode3 = 0 ; double val4 ; int ecode4 = 0 ; double val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOOOO:SDsetcal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetcal" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_double(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SDsetcal" "', argument " "2"" of type '" "double""'"); } arg2 = (double)(val2); ecode3 = SWIG_AsVal_double(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SDsetcal" "', argument " "3"" of type '" "double""'"); } arg3 = (double)(val3); ecode4 = SWIG_AsVal_double(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SDsetcal" "', argument " "4"" of type '" "double""'"); } arg4 = (double)(val4); ecode5 = SWIG_AsVal_double(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SDsetcal" "', argument " "5"" of type '" "double""'"); } arg5 = (double)(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SDsetcal" "', argument " "6"" of type '" "int32""'"); } arg6 = (int32)(val6); result = (int32)SDsetcal(arg1,arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDsetdatastrs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; char *arg5 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; int res4 ; char *buf4 = 0 ; int alloc4 = 0 ; int res5 ; char *buf5 = 0 ; int alloc5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:SDsetdatastrs",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetdatastrs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDsetdatastrs" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SDsetdatastrs" "', argument " "3"" of type '" "char const *""'"); } arg3 = (char *)(buf3); res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SDsetdatastrs" "', argument " "4"" of type '" "char const *""'"); } arg4 = (char *)(buf4); res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5); if (!SWIG_IsOK(res5)) { SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "SDsetdatastrs" "', argument " "5"" of type '" "char const *""'"); } arg5 = (char *)(buf5); result = (int32)SDsetdatastrs(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); if (alloc5 == SWIG_NEWOBJ) free((char*)buf5); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); if (alloc5 == SWIG_NEWOBJ) free((char*)buf5); return NULL; } SWIGINTERN PyObject *_wrap_SDsetdimstrs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; int res4 ; char *buf4 = 0 ; int alloc4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOO:SDsetdimstrs",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetdimstrs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDsetdimstrs" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SDsetdimstrs" "', argument " "3"" of type '" "char const *""'"); } arg3 = (char *)(buf3); res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SDsetdimstrs" "', argument " "4"" of type '" "char const *""'"); } arg4 = (char *)(buf4); result = (int32)SDsetdimstrs(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); return NULL; } SWIGINTERN PyObject *_wrap_SDsetfillmode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDsetfillmode",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetfillmode" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SDsetfillmode" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)SDsetfillmode(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDsetfillvalue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; void *arg2 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:SDsetfillvalue",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetfillvalue" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDsetfillvalue" "', argument " "2"" of type '" "void const *""'"); } result = (int32)SDsetfillvalue(arg1,(void const *)arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDsetrange(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; void *arg2 = (void *) 0 ; void *arg3 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; int res3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOO:SDsetrange",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetrange" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDsetrange" "', argument " "2"" of type '" "void const *""'"); } res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SDsetrange" "', argument " "3"" of type '" "void const *""'"); } result = (int32)SDsetrange(arg1,(void const *)arg2,(void const *)arg3); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap__SDgetcompress(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 *arg2 = (int32 *) 0 ; int32 *arg3 = (int32 *) 0 ; int32 *arg4 = (int32 *) 0 ; int32 *arg5 = (int32 *) 0 ; int32 *arg6 = (int32 *) 0 ; int32 *arg7 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; int32 temp2 ; int res2 = SWIG_TMPOBJ ; int32 temp3 ; int res3 = SWIG_TMPOBJ ; int32 temp4 ; int res4 = SWIG_TMPOBJ ; int32 temp5 ; int res5 = SWIG_TMPOBJ ; int32 temp6 ; int res6 = SWIG_TMPOBJ ; int32 temp7 ; int res7 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; int32 result; arg2 = &temp2; arg3 = &temp3; arg4 = &temp4; arg5 = &temp5; arg6 = &temp6; arg7 = &temp7; if (!PyArg_ParseTuple(args,(char *)"O:_SDgetcompress",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "_SDgetcompress" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)_SDgetcompress(arg1,arg2,arg3,arg4,arg5,arg6,arg7); resultobj = SWIG_From_int((int)(result)); if (SWIG_IsTmpObj(res2)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); } else { int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res4)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4))); } else { int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res5)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg5))); } else { int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res6)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg6))); } else { int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res7)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg7))); } else { int new_flags = SWIG_IsNewObj(res7) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg7), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap__SDsetcompress(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int32 arg3 ; int32 arg4 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOO:_SDsetcompress",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "_SDsetcompress" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_SDsetcompress" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "_SDsetcompress" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_SDsetcompress" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); result = (int32)_SDsetcompress(arg1,arg2,arg3,arg4); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_SDsetexternalfile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int32 arg3 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOO:SDsetexternalfile",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SDsetexternalfile" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SDsetexternalfile" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SDsetexternalfile" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); result = (int32)SDsetexternalfile(arg1,(char const *)arg2,arg3); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_Vinitialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"O:Vinitialize",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vinitialize" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)Vinitialize(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSattach(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; char *arg3 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOO:VSattach",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSattach" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSattach" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VSattach" "', argument " "3"" of type '" "char const *""'"); } arg3 = (char *)(buf3); result = (int32)VSattach(arg1,arg2,(char const *)arg3); resultobj = SWIG_From_int((int)(result)); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); return resultobj; fail: if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); return NULL; } SWIGINTERN PyObject *_wrap_VSdetach(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:VSdetach",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSdetach" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)VSdetach(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vfinish(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"O:Vfinish",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vfinish" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)Vfinish(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VHstoredata(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; void *arg3 = (void *) 0 ; int32 arg4 ; int32 arg5 ; char *arg6 = (char *) 0 ; char *arg7 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int res3 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int res6 ; char *buf6 = 0 ; int alloc6 = 0 ; int res7 ; char *buf7 = 0 ; int alloc7 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:VHstoredata",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VHstoredata" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VHstoredata" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VHstoredata" "', argument " "3"" of type '" "void *""'"); } ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VHstoredata" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "VHstoredata" "', argument " "5"" of type '" "int32""'"); } arg5 = (int32)(val5); res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6); if (!SWIG_IsOK(res6)) { SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "VHstoredata" "', argument " "6"" of type '" "char const *""'"); } arg6 = (char *)(buf6); res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7); if (!SWIG_IsOK(res7)) { SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "VHstoredata" "', argument " "7"" of type '" "char const *""'"); } arg7 = (char *)(buf7); result = (int32)VHstoredata(arg1,(char const *)arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); if (alloc6 == SWIG_NEWOBJ) free((char*)buf6); if (alloc7 == SWIG_NEWOBJ) free((char*)buf7); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); if (alloc6 == SWIG_NEWOBJ) free((char*)buf6); if (alloc7 == SWIG_NEWOBJ) free((char*)buf7); return NULL; } SWIGINTERN PyObject *_wrap_VHstoredatam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; void *arg3 = (void *) 0 ; int32 arg4 ; int32 arg5 ; char *arg6 = (char *) 0 ; char *arg7 = (char *) 0 ; int32 arg8 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int res3 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int res6 ; char *buf6 = 0 ; int alloc6 = 0 ; int res7 ; char *buf7 = 0 ; int alloc7 = 0 ; int val8 ; int ecode8 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:VHstoredatam",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VHstoredatam" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VHstoredatam" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VHstoredatam" "', argument " "3"" of type '" "void *""'"); } ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VHstoredatam" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "VHstoredatam" "', argument " "5"" of type '" "int32""'"); } arg5 = (int32)(val5); res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6); if (!SWIG_IsOK(res6)) { SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "VHstoredatam" "', argument " "6"" of type '" "char const *""'"); } arg6 = (char *)(buf6); res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7); if (!SWIG_IsOK(res7)) { SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "VHstoredatam" "', argument " "7"" of type '" "char const *""'"); } arg7 = (char *)(buf7); ecode8 = SWIG_AsVal_int(obj7, &val8); if (!SWIG_IsOK(ecode8)) { SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "VHstoredatam" "', argument " "8"" of type '" "int32""'"); } arg8 = (int32)(val8); result = (int32)VHstoredatam(arg1,(char const *)arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7,arg8); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); if (alloc6 == SWIG_NEWOBJ) free((char*)buf6); if (alloc7 == SWIG_NEWOBJ) free((char*)buf7); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); if (alloc6 == SWIG_NEWOBJ) free((char*)buf6); if (alloc7 == SWIG_NEWOBJ) free((char*)buf7); return NULL; } SWIGINTERN PyObject *_wrap_VSfdefine(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int32 arg3 ; int32 arg4 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OOOO:VSfdefine",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSfdefine" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSfdefine" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VSfdefine" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VSfdefine" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); result = (intn)VSfdefine(arg1,(char const *)arg2,arg3,arg4); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_VSsetfields(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OO:VSsetfields",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSsetfields" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSsetfields" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (intn)VSsetfields(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_VSseek(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VSseek",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSseek" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSseek" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)VSseek(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSread(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; void *arg2 = (void *) 0 ; int32 arg3 ; int32 arg4 ; int val1 ; int ecode1 = 0 ; int res2 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOO:VSread",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSread" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSread" "', argument " "2"" of type '" "void *""'"); } ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VSread" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VSread" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); result = (int32)VSread(arg1,arg2,arg3,arg4); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSwrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; void *arg2 = (void *) 0 ; int32 arg3 ; int32 arg4 ; int val1 ; int ecode1 = 0 ; int res2 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOO:VSwrite",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSwrite" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSwrite" "', argument " "2"" of type '" "void *""'"); } ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VSwrite" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VSwrite" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); result = (int32)VSwrite(arg1,arg2,arg3,arg4); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSfpack(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; intn arg2 ; char *arg3 = (char *) 0 ; void *arg4 = (void *) 0 ; intn arg5 ; intn arg6 ; char *arg7 = (char *) 0 ; void **arg8 = (void **) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; int res4 ; int val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; int res7 ; char *buf7 = 0 ; int alloc7 = 0 ; void *argp8 = 0 ; int res8 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:VSfpack",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSfpack" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSfpack" "', argument " "2"" of type '" "intn""'"); } arg2 = (intn)(val2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VSfpack" "', argument " "3"" of type '" "char const *""'"); } arg3 = (char *)(buf3); res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VSfpack" "', argument " "4"" of type '" "void *""'"); } ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "VSfpack" "', argument " "5"" of type '" "intn""'"); } arg5 = (intn)(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "VSfpack" "', argument " "6"" of type '" "intn""'"); } arg6 = (intn)(val6); res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7); if (!SWIG_IsOK(res7)) { SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "VSfpack" "', argument " "7"" of type '" "char const *""'"); } arg7 = (char *)(buf7); res8 = SWIG_ConvertPtr(obj7, &argp8,SWIGTYPE_p_p_void, 0 | 0 ); if (!SWIG_IsOK(res8)) { SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "VSfpack" "', argument " "8"" of type '" "void **""'"); } arg8 = (void **)(argp8); result = (intn)VSfpack(arg1,arg2,(char const *)arg3,arg4,arg5,arg6,(char const *)arg7,arg8); resultobj = SWIG_From_int((int)(result)); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); if (alloc7 == SWIG_NEWOBJ) free((char*)buf7); return resultobj; fail: if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); if (alloc7 == SWIG_NEWOBJ) free((char*)buf7); return NULL; } SWIGINTERN PyObject *_wrap_VSelts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:VSelts",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSelts" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)VSelts(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSgetclass(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; char temp2[4096+1] ; PyObject * obj0 = 0 ; intn result; arg2 = (char *) temp2; if (!PyArg_ParseTuple(args,(char *)"O:VSgetclass",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSgetclass" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)VSgetclass(arg1,arg2); resultobj = SWIG_From_int((int)(result)); arg2[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSgetfields(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; char temp2[4096+1] ; PyObject * obj0 = 0 ; int32 result; arg2 = (char *) temp2; if (!PyArg_ParseTuple(args,(char *)"O:VSgetfields",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSgetfields" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)VSgetfields(arg1,arg2); resultobj = SWIG_From_int((int)(result)); arg2[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSgetinterlace(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"O:VSgetinterlace",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSgetinterlace" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)VSgetinterlace(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSgetname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; char temp2[4096+1] ; PyObject * obj0 = 0 ; intn result; arg2 = (char *) temp2; if (!PyArg_ParseTuple(args,(char *)"O:VSgetname",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSgetname" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)VSgetname(arg1,arg2); resultobj = SWIG_From_int((int)(result)); arg2[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSsizeof(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OO:VSsizeof",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSsizeof" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSsizeof" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (intn)VSsizeof(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_VSinquire(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 *arg2 = (int32 *) 0 ; int32 *arg3 = (int32 *) 0 ; char *arg4 = (char *) 0 ; int32 *arg5 = (int32 *) 0 ; char *arg6 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int32 temp2 ; int res2 = SWIG_TMPOBJ ; int32 temp3 ; int res3 = SWIG_TMPOBJ ; char temp4[4096+1] ; int32 temp5 ; int res5 = SWIG_TMPOBJ ; char temp6[4096+1] ; PyObject * obj0 = 0 ; intn result; arg2 = &temp2; arg3 = &temp3; arg4 = (char *) temp4; arg5 = &temp5; arg6 = (char *) temp6; if (!PyArg_ParseTuple(args,(char *)"O:VSinquire",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSinquire" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)VSinquire(arg1,arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_From_int((int)(result)); if (SWIG_IsTmpObj(res2)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); } else { int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } arg4[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg4)); if (SWIG_IsTmpObj(res5)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg5))); } else { int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags)); } arg6[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg6)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSQuerytag(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:VSQuerytag",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSQuerytag" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)VSQuerytag(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSQueryref(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:VSQueryref",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSQueryref" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)VSQueryref(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSfindex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int32 *arg3 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int32 temp3 ; int res3 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; intn result; arg3 = &temp3; if (!PyArg_ParseTuple(args,(char *)"OO:VSfindex",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSfindex" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSfindex" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (intn)VSfindex(arg1,(char const *)arg2,arg3); resultobj = SWIG_From_int((int)(result)); if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_VSisattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"O:VSisattr",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSisattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)VSisattr(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VFnfields(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:VFnfields",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VFnfields" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)VFnfields(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VFfieldtype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VFfieldtype",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VFfieldtype" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VFfieldtype" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)VFfieldtype(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VFfieldname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:VFfieldname",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VFfieldname" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VFfieldname" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (char *)VFfieldname(arg1,arg2); resultobj = SWIG_FromCharPtr((const char *)result); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VFfieldesize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VFfieldesize",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VFfieldesize" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VFfieldesize" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)VFfieldesize(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VFfieldisize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VFfieldisize",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VFfieldisize" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VFfieldisize" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)VFfieldisize(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VFfieldorder(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VFfieldorder",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VFfieldorder" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VFfieldorder" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)VFfieldorder(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSfind(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VSfind",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSfind" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSfind" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (int32)VSfind(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_VSgetid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VSgetid",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSgetid" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSgetid" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)VSgetid(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSfexist(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OO:VSfexist",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSfexist" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSfexist" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (intn)VSfexist(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_VSsetclass(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VSsetclass",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSsetclass" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSsetclass" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (int32)VSsetclass(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_VSsetname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VSsetname",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSsetname" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSsetname" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (int32)VSsetname(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_VSsetinterlace(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OO:VSsetinterlace",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSsetinterlace" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSsetinterlace" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (intn)VSsetinterlace(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSsetattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; char *arg3 = (char *) 0 ; int32 arg4 ; int32 arg5 ; void *arg6 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int res6 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OOOOOO:VSsetattr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSsetattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSsetattr" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VSsetattr" "', argument " "3"" of type '" "char const *""'"); } arg3 = (char *)(buf3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "VSsetattr" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "VSsetattr" "', argument " "5"" of type '" "int32""'"); } arg5 = (int32)(val5); res6 = SWIG_ConvertPtr(obj5,SWIG_as_voidptrptr(&arg6), 0, 0); if (!SWIG_IsOK(res6)) { SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "VSsetattr" "', argument " "6"" of type '" "void const *""'"); } result = (intn)VSsetattr(arg1,arg2,(char const *)arg3,arg4,arg5,(void const *)arg6); resultobj = SWIG_From_int((int)(result)); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); return resultobj; fail: if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); return NULL; } SWIGINTERN PyObject *_wrap_VSgetattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; intn arg3 ; void *arg4 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; int res4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OOOO:VSgetattr",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSgetattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSgetattr" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VSgetattr" "', argument " "3"" of type '" "intn""'"); } arg3 = (intn)(val3); res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VSgetattr" "', argument " "4"" of type '" "void *""'"); } result = (intn)VSgetattr(arg1,arg2,arg3,arg4); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSfnattrs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:VSfnattrs",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSfnattrs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSfnattrs" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)VSfnattrs(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSnattrs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:VSnattrs",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSnattrs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)VSnattrs(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSattrinfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; intn arg3 ; char *arg4 = (char *) 0 ; int32 *arg5 = (int32 *) 0 ; int32 *arg6 = (int32 *) 0 ; int32 *arg7 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; char temp4[4096+1] ; int32 temp5 ; int res5 = SWIG_TMPOBJ ; int32 temp6 ; int res6 = SWIG_TMPOBJ ; int32 temp7 ; int res7 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; intn result; arg4 = (char *) temp4; arg5 = &temp5; arg6 = &temp6; arg7 = &temp7; if (!PyArg_ParseTuple(args,(char *)"OOO:VSattrinfo",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSattrinfo" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSattrinfo" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VSattrinfo" "', argument " "3"" of type '" "intn""'"); } arg3 = (intn)(val3); result = (intn)VSattrinfo(arg1,arg2,arg3,arg4,arg5,arg6,arg7); resultobj = SWIG_From_int((int)(result)); arg4[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg4)); if (SWIG_IsTmpObj(res5)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg5))); } else { int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res6)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg6))); } else { int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res7)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg7))); } else { int new_flags = SWIG_IsNewObj(res7) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg7), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VSfindattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; char *arg3 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OOO:VSfindattr",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VSfindattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSfindattr" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VSfindattr" "', argument " "3"" of type '" "char const *""'"); } arg3 = (char *)(buf3); result = (intn)VSfindattr(arg1,arg2,(char const *)arg3); resultobj = SWIG_From_int((int)(result)); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); return resultobj; fail: if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); return NULL; } SWIGINTERN PyObject *_wrap_Vattach(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; char *arg3 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOO:Vattach",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vattach" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vattach" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Vattach" "', argument " "3"" of type '" "char const *""'"); } arg3 = (char *)(buf3); result = (int32)Vattach(arg1,arg2,(char const *)arg3); resultobj = SWIG_From_int((int)(result)); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); return resultobj; fail: if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); return NULL; } SWIGINTERN PyObject *_wrap_Vdetach(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:Vdetach",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vdetach" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)Vdetach(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vgetname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; char temp2[4096+1] ; PyObject * obj0 = 0 ; int32 result; arg2 = (char *) temp2; if (!PyArg_ParseTuple(args,(char *)"O:Vgetname",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vgetname" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)Vgetname(arg1,arg2); resultobj = SWIG_From_int((int)(result)); arg2[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vsetname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:Vsetname",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vsetname" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Vsetname" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (int32)Vsetname(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_Vgetclass(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; char temp2[4096+1] ; PyObject * obj0 = 0 ; int32 result; arg2 = (char *) temp2; if (!PyArg_ParseTuple(args,(char *)"O:Vgetclass",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vgetclass" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)Vgetclass(arg1,arg2); resultobj = SWIG_From_int((int)(result)); arg2[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vsetclass(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:Vsetclass",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vsetclass" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Vsetclass" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (int32)Vsetclass(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_Vfind(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:Vfind",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vfind" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Vfind" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (int32)Vfind(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_Vfindclass(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:Vfindclass",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vfindclass" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Vfindclass" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (int32)Vfindclass(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_Vinsert(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:Vinsert",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vinsert" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vinsert" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)Vinsert(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vaddtagref(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int32 arg3 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOO:Vaddtagref",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vaddtagref" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vaddtagref" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Vaddtagref" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); result = (int32)Vaddtagref(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vdeletetagref(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int32 arg3 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOO:Vdeletetagref",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vdeletetagref" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vdeletetagref" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Vdeletetagref" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); result = (int32)Vdeletetagref(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vdelete(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:Vdelete",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vdelete" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vdelete" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)Vdelete(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VQueryref(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:VQueryref",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VQueryref" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)VQueryref(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_VQuerytag(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:VQuerytag",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VQuerytag" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)VQuerytag(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vntagrefs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:Vntagrefs",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vntagrefs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)Vntagrefs(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vgettagref(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int32 *arg3 = (int32 *) 0 ; int32 *arg4 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int32 temp3 ; int res3 = SWIG_TMPOBJ ; int32 temp4 ; int res4 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; arg3 = &temp3; arg4 = &temp4; if (!PyArg_ParseTuple(args,(char *)"OO:Vgettagref",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vgettagref" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vgettagref" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)Vgettagref(arg1,arg2,arg3,arg4); resultobj = SWIG_From_int((int)(result)); if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res4)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4))); } else { int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vgetversion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"O:Vgetversion",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vgetversion" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (int32)Vgetversion(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vgettagrefs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; void *arg2 = (void *) 0 ; void *arg3 = (void *) 0 ; int32 arg4 ; int val1 ; int ecode1 = 0 ; int res2 ; int res3 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OOOO:Vgettagrefs",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vgettagrefs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Vgettagrefs" "', argument " "2"" of type '" "void *""'"); } res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Vgettagrefs" "', argument " "3"" of type '" "void *""'"); } ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Vgettagrefs" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); result = (int32)Vgettagrefs(arg1,arg2,arg3,arg4); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vgetid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:Vgetid",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vgetid" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vgetid" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)Vgetid(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vinqtagref(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int32 arg3 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OOO:Vinqtagref",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vinqtagref" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vinqtagref" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Vinqtagref" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); result = (intn)Vinqtagref(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Visvg(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OO:Visvg",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Visvg" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Visvg" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (intn)Visvg(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Visvs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OO:Visvs",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Visvs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Visvs" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (intn)Visvs(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vnrefs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int32 arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int32 result; if (!PyArg_ParseTuple(args,(char *)"OO:Vnrefs",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vnrefs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vnrefs" "', argument " "2"" of type '" "int32""'"); } arg2 = (int32)(val2); result = (int32)Vnrefs(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vfindattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OO:Vfindattr",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vfindattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Vfindattr" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); result = (intn)Vfindattr(arg1,(char const *)arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_Vgetattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; intn arg2 ; void *arg3 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int res3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OOO:Vgetattr",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vgetattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vgetattr" "', argument " "2"" of type '" "intn""'"); } arg2 = (intn)(val2); res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Vgetattr" "', argument " "3"" of type '" "void *""'"); } result = (intn)Vgetattr(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vsetattr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; char *arg2 = (char *) 0 ; int32 arg3 ; int32 arg4 ; void *arg5 = (void *) 0 ; int val1 ; int ecode1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int res5 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:Vsetattr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vsetattr" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Vsetattr" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Vsetattr" "', argument " "3"" of type '" "int32""'"); } arg3 = (int32)(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Vsetattr" "', argument " "4"" of type '" "int32""'"); } arg4 = (int32)(val4); res5 = SWIG_ConvertPtr(obj4,SWIG_as_voidptrptr(&arg5), 0, 0); if (!SWIG_IsOK(res5)) { SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Vsetattr" "', argument " "5"" of type '" "void const *""'"); } result = (intn)Vsetattr(arg1,(char const *)arg2,arg3,arg4,(void const *)arg5); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } SWIGINTERN PyObject *_wrap_Vattrinfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; intn arg2 ; char *arg3 = (char *) 0 ; int32 *arg4 = (int32 *) 0 ; int32 *arg5 = (int32 *) 0 ; int32 *arg6 = (int32 *) 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; char temp3[4096+1] ; int32 temp4 ; int res4 = SWIG_TMPOBJ ; int32 temp5 ; int res5 = SWIG_TMPOBJ ; int32 temp6 ; int res6 = SWIG_TMPOBJ ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; intn result; arg3 = (char *) temp3; arg4 = &temp4; arg5 = &temp5; arg6 = &temp6; if (!PyArg_ParseTuple(args,(char *)"OO:Vattrinfo",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vattrinfo" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Vattrinfo" "', argument " "2"" of type '" "intn""'"); } arg2 = (intn)(val2); result = (intn)Vattrinfo(arg1,arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_From_int((int)(result)); arg3[4096] = 0; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg3)); if (SWIG_IsTmpObj(res4)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4))); } else { int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res5)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg5))); } else { int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags)); } if (SWIG_IsTmpObj(res6)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg6))); } else { int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Vnattrs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int32 arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; intn result; if (!PyArg_ParseTuple(args,(char *)"O:Vnattrs",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vnattrs" "', argument " "1"" of type '" "int32""'"); } arg1 = (int32)(val1); result = (intn)Vnattrs(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"new_array_byte", _wrap_new_array_byte, METH_VARARGS, NULL}, { (char *)"delete_array_byte", _wrap_delete_array_byte, METH_VARARGS, NULL}, { (char *)"array_byte___getitem__", _wrap_array_byte___getitem__, METH_VARARGS, NULL}, { (char *)"array_byte___setitem__", _wrap_array_byte___setitem__, METH_VARARGS, NULL}, { (char *)"array_byte_cast", _wrap_array_byte_cast, METH_VARARGS, NULL}, { (char *)"array_byte_frompointer", _wrap_array_byte_frompointer, METH_VARARGS, NULL}, { (char *)"array_byte_swigregister", array_byte_swigregister, METH_VARARGS, NULL}, { (char *)"new_array_int8", _wrap_new_array_int8, METH_VARARGS, NULL}, { (char *)"delete_array_int8", _wrap_delete_array_int8, METH_VARARGS, NULL}, { (char *)"array_int8___getitem__", _wrap_array_int8___getitem__, METH_VARARGS, NULL}, { (char *)"array_int8___setitem__", _wrap_array_int8___setitem__, METH_VARARGS, NULL}, { (char *)"array_int8_cast", _wrap_array_int8_cast, METH_VARARGS, NULL}, { (char *)"array_int8_frompointer", _wrap_array_int8_frompointer, METH_VARARGS, NULL}, { (char *)"array_int8_swigregister", array_int8_swigregister, METH_VARARGS, NULL}, { (char *)"new_array_int16", _wrap_new_array_int16, METH_VARARGS, NULL}, { (char *)"delete_array_int16", _wrap_delete_array_int16, METH_VARARGS, NULL}, { (char *)"array_int16___getitem__", _wrap_array_int16___getitem__, METH_VARARGS, NULL}, { (char *)"array_int16___setitem__", _wrap_array_int16___setitem__, METH_VARARGS, NULL}, { (char *)"array_int16_cast", _wrap_array_int16_cast, METH_VARARGS, NULL}, { (char *)"array_int16_frompointer", _wrap_array_int16_frompointer, METH_VARARGS, NULL}, { (char *)"array_int16_swigregister", array_int16_swigregister, METH_VARARGS, NULL}, { (char *)"new_array_uint16", _wrap_new_array_uint16, METH_VARARGS, NULL}, { (char *)"delete_array_uint16", _wrap_delete_array_uint16, METH_VARARGS, NULL}, { (char *)"array_uint16___getitem__", _wrap_array_uint16___getitem__, METH_VARARGS, NULL}, { (char *)"array_uint16___setitem__", _wrap_array_uint16___setitem__, METH_VARARGS, NULL}, { (char *)"array_uint16_cast", _wrap_array_uint16_cast, METH_VARARGS, NULL}, { (char *)"array_uint16_frompointer", _wrap_array_uint16_frompointer, METH_VARARGS, NULL}, { (char *)"array_uint16_swigregister", array_uint16_swigregister, METH_VARARGS, NULL}, { (char *)"new_array_int32", _wrap_new_array_int32, METH_VARARGS, NULL}, { (char *)"delete_array_int32", _wrap_delete_array_int32, METH_VARARGS, NULL}, { (char *)"array_int32___getitem__", _wrap_array_int32___getitem__, METH_VARARGS, NULL}, { (char *)"array_int32___setitem__", _wrap_array_int32___setitem__, METH_VARARGS, NULL}, { (char *)"array_int32_cast", _wrap_array_int32_cast, METH_VARARGS, NULL}, { (char *)"array_int32_frompointer", _wrap_array_int32_frompointer, METH_VARARGS, NULL}, { (char *)"array_int32_swigregister", array_int32_swigregister, METH_VARARGS, NULL}, { (char *)"new_array_uint32", _wrap_new_array_uint32, METH_VARARGS, NULL}, { (char *)"delete_array_uint32", _wrap_delete_array_uint32, METH_VARARGS, NULL}, { (char *)"array_uint32___getitem__", _wrap_array_uint32___getitem__, METH_VARARGS, NULL}, { (char *)"array_uint32___setitem__", _wrap_array_uint32___setitem__, METH_VARARGS, NULL}, { (char *)"array_uint32_cast", _wrap_array_uint32_cast, METH_VARARGS, NULL}, { (char *)"array_uint32_frompointer", _wrap_array_uint32_frompointer, METH_VARARGS, NULL}, { (char *)"array_uint32_swigregister", array_uint32_swigregister, METH_VARARGS, NULL}, { (char *)"new_array_float32", _wrap_new_array_float32, METH_VARARGS, NULL}, { (char *)"delete_array_float32", _wrap_delete_array_float32, METH_VARARGS, NULL}, { (char *)"array_float32___getitem__", _wrap_array_float32___getitem__, METH_VARARGS, NULL}, { (char *)"array_float32___setitem__", _wrap_array_float32___setitem__, METH_VARARGS, NULL}, { (char *)"array_float32_cast", _wrap_array_float32_cast, METH_VARARGS, NULL}, { (char *)"array_float32_frompointer", _wrap_array_float32_frompointer, METH_VARARGS, NULL}, { (char *)"array_float32_swigregister", array_float32_swigregister, METH_VARARGS, NULL}, { (char *)"new_array_float64", _wrap_new_array_float64, METH_VARARGS, NULL}, { (char *)"delete_array_float64", _wrap_delete_array_float64, METH_VARARGS, NULL}, { (char *)"array_float64___getitem__", _wrap_array_float64___getitem__, METH_VARARGS, NULL}, { (char *)"array_float64___setitem__", _wrap_array_float64___setitem__, METH_VARARGS, NULL}, { (char *)"array_float64_cast", _wrap_array_float64_cast, METH_VARARGS, NULL}, { (char *)"array_float64_frompointer", _wrap_array_float64_frompointer, METH_VARARGS, NULL}, { (char *)"array_float64_swigregister", array_float64_swigregister, METH_VARARGS, NULL}, { (char *)"new_array_voidp", _wrap_new_array_voidp, METH_VARARGS, NULL}, { (char *)"delete_array_voidp", _wrap_delete_array_voidp, METH_VARARGS, NULL}, { (char *)"array_voidp_getitem", _wrap_array_voidp_getitem, METH_VARARGS, NULL}, { (char *)"array_voidp_setitem", _wrap_array_voidp_setitem, METH_VARARGS, NULL}, { (char *)"Hopen", _wrap_Hopen, METH_VARARGS, NULL}, { (char *)"Hclose", _wrap_Hclose, METH_VARARGS, NULL}, { (char *)"Hgetlibversion", _wrap_Hgetlibversion, METH_VARARGS, NULL}, { (char *)"Hgetfileversion", _wrap_Hgetfileversion, METH_VARARGS, NULL}, { (char *)"Hishdf", _wrap_Hishdf, METH_VARARGS, NULL}, { (char *)"HEvalue", _wrap_HEvalue, METH_VARARGS, NULL}, { (char *)"HEstring", _wrap_HEstring, METH_VARARGS, NULL}, { (char *)"_HEprint", _wrap__HEprint, METH_VARARGS, NULL}, { (char *)"_SDreaddata_0", _wrap__SDreaddata_0, METH_VARARGS, NULL}, { (char *)"_SDwritedata_0", _wrap__SDwritedata_0, METH_VARARGS, NULL}, { (char *)"SDstart", _wrap_SDstart, METH_VARARGS, NULL}, { (char *)"SDcreate", _wrap_SDcreate, METH_VARARGS, NULL}, { (char *)"SDselect", _wrap_SDselect, METH_VARARGS, NULL}, { (char *)"SDendaccess", _wrap_SDendaccess, METH_VARARGS, NULL}, { (char *)"SDend", _wrap_SDend, METH_VARARGS, NULL}, { (char *)"SDfileinfo", _wrap_SDfileinfo, METH_VARARGS, NULL}, { (char *)"SDgetinfo", _wrap_SDgetinfo, METH_VARARGS, NULL}, { (char *)"SDcheckempty", _wrap_SDcheckempty, METH_VARARGS, NULL}, { (char *)"SDidtoref", _wrap_SDidtoref, METH_VARARGS, NULL}, { (char *)"SDiscoordvar", _wrap_SDiscoordvar, METH_VARARGS, NULL}, { (char *)"SDisrecord", _wrap_SDisrecord, METH_VARARGS, NULL}, { (char *)"SDnametoindex", _wrap_SDnametoindex, METH_VARARGS, NULL}, { (char *)"SDreftoindex", _wrap_SDreftoindex, METH_VARARGS, NULL}, { (char *)"SDdiminfo", _wrap_SDdiminfo, METH_VARARGS, NULL}, { (char *)"SDgetdimid", _wrap_SDgetdimid, METH_VARARGS, NULL}, { (char *)"SDsetdimname", _wrap_SDsetdimname, METH_VARARGS, NULL}, { (char *)"SDgetdimscale", _wrap_SDgetdimscale, METH_VARARGS, NULL}, { (char *)"SDsetdimscale", _wrap_SDsetdimscale, METH_VARARGS, NULL}, { (char *)"SDattrinfo", _wrap_SDattrinfo, METH_VARARGS, NULL}, { (char *)"SDfindattr", _wrap_SDfindattr, METH_VARARGS, NULL}, { (char *)"SDreadattr", _wrap_SDreadattr, METH_VARARGS, NULL}, { (char *)"SDsetattr", _wrap_SDsetattr, METH_VARARGS, NULL}, { (char *)"SDgetcal", _wrap_SDgetcal, METH_VARARGS, NULL}, { (char *)"SDgetdatastrs", _wrap_SDgetdatastrs, METH_VARARGS, NULL}, { (char *)"SDgetdimstrs", _wrap_SDgetdimstrs, METH_VARARGS, NULL}, { (char *)"SDgetfillvalue", _wrap_SDgetfillvalue, METH_VARARGS, NULL}, { (char *)"SDgetrange", _wrap_SDgetrange, METH_VARARGS, NULL}, { (char *)"SDsetcal", _wrap_SDsetcal, METH_VARARGS, NULL}, { (char *)"SDsetdatastrs", _wrap_SDsetdatastrs, METH_VARARGS, NULL}, { (char *)"SDsetdimstrs", _wrap_SDsetdimstrs, METH_VARARGS, NULL}, { (char *)"SDsetfillmode", _wrap_SDsetfillmode, METH_VARARGS, NULL}, { (char *)"SDsetfillvalue", _wrap_SDsetfillvalue, METH_VARARGS, NULL}, { (char *)"SDsetrange", _wrap_SDsetrange, METH_VARARGS, NULL}, { (char *)"_SDgetcompress", _wrap__SDgetcompress, METH_VARARGS, NULL}, { (char *)"_SDsetcompress", _wrap__SDsetcompress, METH_VARARGS, NULL}, { (char *)"SDsetexternalfile", _wrap_SDsetexternalfile, METH_VARARGS, NULL}, { (char *)"Vinitialize", _wrap_Vinitialize, METH_VARARGS, NULL}, { (char *)"VSattach", _wrap_VSattach, METH_VARARGS, NULL}, { (char *)"VSdetach", _wrap_VSdetach, METH_VARARGS, NULL}, { (char *)"Vfinish", _wrap_Vfinish, METH_VARARGS, NULL}, { (char *)"VHstoredata", _wrap_VHstoredata, METH_VARARGS, NULL}, { (char *)"VHstoredatam", _wrap_VHstoredatam, METH_VARARGS, NULL}, { (char *)"VSfdefine", _wrap_VSfdefine, METH_VARARGS, NULL}, { (char *)"VSsetfields", _wrap_VSsetfields, METH_VARARGS, NULL}, { (char *)"VSseek", _wrap_VSseek, METH_VARARGS, NULL}, { (char *)"VSread", _wrap_VSread, METH_VARARGS, NULL}, { (char *)"VSwrite", _wrap_VSwrite, METH_VARARGS, NULL}, { (char *)"VSfpack", _wrap_VSfpack, METH_VARARGS, NULL}, { (char *)"VSelts", _wrap_VSelts, METH_VARARGS, NULL}, { (char *)"VSgetclass", _wrap_VSgetclass, METH_VARARGS, NULL}, { (char *)"VSgetfields", _wrap_VSgetfields, METH_VARARGS, NULL}, { (char *)"VSgetinterlace", _wrap_VSgetinterlace, METH_VARARGS, NULL}, { (char *)"VSgetname", _wrap_VSgetname, METH_VARARGS, NULL}, { (char *)"VSsizeof", _wrap_VSsizeof, METH_VARARGS, NULL}, { (char *)"VSinquire", _wrap_VSinquire, METH_VARARGS, NULL}, { (char *)"VSQuerytag", _wrap_VSQuerytag, METH_VARARGS, NULL}, { (char *)"VSQueryref", _wrap_VSQueryref, METH_VARARGS, NULL}, { (char *)"VSfindex", _wrap_VSfindex, METH_VARARGS, NULL}, { (char *)"VSisattr", _wrap_VSisattr, METH_VARARGS, NULL}, { (char *)"VFnfields", _wrap_VFnfields, METH_VARARGS, NULL}, { (char *)"VFfieldtype", _wrap_VFfieldtype, METH_VARARGS, NULL}, { (char *)"VFfieldname", _wrap_VFfieldname, METH_VARARGS, NULL}, { (char *)"VFfieldesize", _wrap_VFfieldesize, METH_VARARGS, NULL}, { (char *)"VFfieldisize", _wrap_VFfieldisize, METH_VARARGS, NULL}, { (char *)"VFfieldorder", _wrap_VFfieldorder, METH_VARARGS, NULL}, { (char *)"VSfind", _wrap_VSfind, METH_VARARGS, NULL}, { (char *)"VSgetid", _wrap_VSgetid, METH_VARARGS, NULL}, { (char *)"VSfexist", _wrap_VSfexist, METH_VARARGS, NULL}, { (char *)"VSsetclass", _wrap_VSsetclass, METH_VARARGS, NULL}, { (char *)"VSsetname", _wrap_VSsetname, METH_VARARGS, NULL}, { (char *)"VSsetinterlace", _wrap_VSsetinterlace, METH_VARARGS, NULL}, { (char *)"VSsetattr", _wrap_VSsetattr, METH_VARARGS, NULL}, { (char *)"VSgetattr", _wrap_VSgetattr, METH_VARARGS, NULL}, { (char *)"VSfnattrs", _wrap_VSfnattrs, METH_VARARGS, NULL}, { (char *)"VSnattrs", _wrap_VSnattrs, METH_VARARGS, NULL}, { (char *)"VSattrinfo", _wrap_VSattrinfo, METH_VARARGS, NULL}, { (char *)"VSfindattr", _wrap_VSfindattr, METH_VARARGS, NULL}, { (char *)"Vattach", _wrap_Vattach, METH_VARARGS, NULL}, { (char *)"Vdetach", _wrap_Vdetach, METH_VARARGS, NULL}, { (char *)"Vgetname", _wrap_Vgetname, METH_VARARGS, NULL}, { (char *)"Vsetname", _wrap_Vsetname, METH_VARARGS, NULL}, { (char *)"Vgetclass", _wrap_Vgetclass, METH_VARARGS, NULL}, { (char *)"Vsetclass", _wrap_Vsetclass, METH_VARARGS, NULL}, { (char *)"Vfind", _wrap_Vfind, METH_VARARGS, NULL}, { (char *)"Vfindclass", _wrap_Vfindclass, METH_VARARGS, NULL}, { (char *)"Vinsert", _wrap_Vinsert, METH_VARARGS, NULL}, { (char *)"Vaddtagref", _wrap_Vaddtagref, METH_VARARGS, NULL}, { (char *)"Vdeletetagref", _wrap_Vdeletetagref, METH_VARARGS, NULL}, { (char *)"Vdelete", _wrap_Vdelete, METH_VARARGS, NULL}, { (char *)"VQueryref", _wrap_VQueryref, METH_VARARGS, NULL}, { (char *)"VQuerytag", _wrap_VQuerytag, METH_VARARGS, NULL}, { (char *)"Vntagrefs", _wrap_Vntagrefs, METH_VARARGS, NULL}, { (char *)"Vgettagref", _wrap_Vgettagref, METH_VARARGS, NULL}, { (char *)"Vgetversion", _wrap_Vgetversion, METH_VARARGS, NULL}, { (char *)"Vgettagrefs", _wrap_Vgettagrefs, METH_VARARGS, NULL}, { (char *)"Vgetid", _wrap_Vgetid, METH_VARARGS, NULL}, { (char *)"Vinqtagref", _wrap_Vinqtagref, METH_VARARGS, NULL}, { (char *)"Visvg", _wrap_Visvg, METH_VARARGS, NULL}, { (char *)"Visvs", _wrap_Visvs, METH_VARARGS, NULL}, { (char *)"Vnrefs", _wrap_Vnrefs, METH_VARARGS, NULL}, { (char *)"Vfindattr", _wrap_Vfindattr, METH_VARARGS, NULL}, { (char *)"Vgetattr", _wrap_Vgetattr, METH_VARARGS, NULL}, { (char *)"Vsetattr", _wrap_Vsetattr, METH_VARARGS, NULL}, { (char *)"Vattrinfo", _wrap_Vattrinfo, METH_VARARGS, NULL}, { (char *)"Vnattrs", _wrap_Vnattrs, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static void *_p_array_uint32To_p_unsigned_int(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((unsigned int *) ((array_uint32 *) x)); } static void *_p_array_float32To_p_float(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((float *) ((array_float32 *) x)); } static void *_p_array_int16To_p_short(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((short *) ((array_int16 *) x)); } static void *_p_array_int32To_p_int(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((int *) ((array_int32 *) x)); } static void *_p_array_uint16To_p_unsigned_short(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((unsigned short *) ((array_uint16 *) x)); } static void *_p_array_int8To_p_signed_char(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((signed char *) ((array_int8 *) x)); } static void *_p_array_byteTo_p_unsigned_char(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((unsigned char *) ((array_byte *) x)); } static void *_p_array_float64To_p_double(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((double *) ((array_float64 *) x)); } static swig_type_info _swigt__p_array_byte = {"_p_array_byte", "array_byte *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_array_float32 = {"_p_array_float32", "array_float32 *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_array_float64 = {"_p_array_float64", "array_float64 *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_array_int16 = {"_p_array_int16", "array_int16 *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_array_int32 = {"_p_array_int32", "array_int32 *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_array_int8 = {"_p_array_int8", "array_int8 *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_array_uint16 = {"_p_array_uint16", "array_uint16 *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_array_uint32 = {"_p_array_uint32", "array_uint32 *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_int = {"_p_int", "int *|int32 *|uint32 *|intn *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_void = {"_p_p_void", "void **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_short = {"_p_short", "int16 *|short *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint8 *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_array_byte, &_swigt__p_array_float32, &_swigt__p_array_float64, &_swigt__p_array_int16, &_swigt__p_array_int32, &_swigt__p_array_int8, &_swigt__p_array_uint16, &_swigt__p_array_uint32, &_swigt__p_char, &_swigt__p_double, &_swigt__p_float, &_swigt__p_int, &_swigt__p_p_void, &_swigt__p_short, &_swigt__p_signed_char, &_swigt__p_unsigned_char, &_swigt__p_unsigned_int, &_swigt__p_unsigned_short, &_swigt__p_void, }; static swig_cast_info _swigc__p_array_byte[] = { {&_swigt__p_array_byte, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_array_float32[] = { {&_swigt__p_array_float32, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_array_float64[] = { {&_swigt__p_array_float64, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_array_int16[] = { {&_swigt__p_array_int16, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_array_int32[] = { {&_swigt__p_array_int32, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_array_int8[] = { {&_swigt__p_array_int8, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_array_uint16[] = { {&_swigt__p_array_uint16, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_array_uint32[] = { {&_swigt__p_array_uint32, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_double[] = { {&_swigt__p_array_float64, _p_array_float64To_p_double, 0, 0}, {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0}, {&_swigt__p_array_float32, _p_array_float32To_p_float, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0}, {&_swigt__p_array_int32, _p_array_int32To_p_int, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_void[] = { {&_swigt__p_p_void, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_short[] = { {&_swigt__p_array_int16, _p_array_int16To_p_short, 0, 0}, {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0}, {&_swigt__p_array_int8, _p_array_int8To_p_signed_char, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0}, {&_swigt__p_array_byte, _p_array_byteTo_p_unsigned_char, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_array_uint32, _p_array_uint32To_p_unsigned_int, 0, 0}, {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_array_uint16, _p_array_uint16To_p_unsigned_short, 0, 0}, {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_array_byte, _swigc__p_array_float32, _swigc__p_array_float64, _swigc__p_array_int16, _swigc__p_array_int32, _swigc__p_array_int8, _swigc__p_array_uint16, _swigc__p_array_uint32, _swigc__p_char, _swigc__p_double, _swigc__p_float, _swigc__p_int, _swigc__p_p_void, _swigc__p_short, _swigc__p_signed_char, _swigc__p_unsigned_char, _swigc__p_unsigned_int, _swigc__p_unsigned_short, _swigc__p_void, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned statically to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int init; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ iter=module_head; do { if (iter==&swig_module) { /* Our module is already in the list, so there's nothing more to do. */ return; } iter=iter->next; } while (iter!= module_head); /* otherwise we must add our module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpreters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"swigvarlink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor) swig_varlink_dealloc, /* tp_dealloc */ (printfunc) swig_varlink_print, /* tp_print */ (getattrfunc) swig_varlink_getattr, /* tp_getattr */ (setattrfunc) swig_varlink_setattr, /* tp_setattr */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 0, /* tp_version_tag */ #endif #if PY_VERSION_HEX >= 0x03040000 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS 0, /* tp_allocs */ 0, /* tp_frees */ 0, /* tp_maxalloc */ #if PY_VERSION_HEX >= 0x02050000 0, /* tp_prev */ #endif 0 /* tp_next */ #endif }; varlink_type = tmp; type_init = 1; #if PY_VERSION_HEX < 0x02020000 varlink_type.ob_type = &PyType_Type; #else if (PyType_Ready(&varlink_type) < 0) return NULL; #endif } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (!c) continue; c = strstr(c, "swig_ptr: "); if (c) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d, *md; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { # if PY_VERSION_HEX >= 0x03020000 PyModuleDef_HEAD_INIT, # else { PyObject_HEAD_INIT(NULL) NULL, /* m_init */ 0, /* m_index */ NULL, /* m_copy */ }, # endif (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { 0, 0, 0, 0, 0, 0, 0 }; static PyGetSetDef this_getset_def = { (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL }; static SwigPyGetSet thisown_getset_closure = { (PyCFunction) SwigPyObject_own, (PyCFunction) SwigPyObject_own }; static PyGetSetDef thisown_getset_def = { (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure }; PyTypeObject *builtin_pytype; int builtin_base_count; swig_type_info *builtin_basetype; PyObject *tuple; PyGetSetDescrObject *static_getset; PyTypeObject *metatype; PyTypeObject *swigpyobject; SwigPyClientData *cd; PyObject *public_interface, *public_symbol; PyObject *this_descr; PyObject *thisown_descr; PyObject *self = 0; int i; (void)builtin_pytype; (void)builtin_base_count; (void)builtin_basetype; (void)tuple; (void)static_getset; (void)self; /* Metaclass is used to implement static member variables */ metatype = SwigPyObjectType(); assert(metatype); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif md = d = PyModule_GetDict(m); (void)md; SWIG_InitializeModule(0); #ifdef SWIGPYTHON_BUILTIN swigpyobject = SwigPyObject_TypeOnce(); SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; if (!cd) { SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); # if PY_VERSION_HEX >= 0x03000000 return NULL; # else return; # endif } /* All objects have a 'this' attribute */ this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); public_symbol = 0; (void)public_symbol; PyDict_SetItemString(md, "__all__", public_interface); Py_DECREF(public_interface); for (i = 0; SwigMethods[i].ml_name != NULL; ++i) SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); for (i = 0; swig_const_table[i].name != 0; ++i) SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); #endif SWIG_InstallConstants(d,swig_const_table); SWIG_Python_SetConstant(d, "DFNT_NONE",SWIG_From_int((int)(0))); SWIG_Python_SetConstant(d, "DFNT_QUERY",SWIG_From_int((int)(0))); SWIG_Python_SetConstant(d, "DFNT_VERSION",SWIG_From_int((int)(1))); SWIG_Python_SetConstant(d, "DFNT_FLOAT32",SWIG_From_int((int)(5))); SWIG_Python_SetConstant(d, "DFNT_FLOAT",SWIG_From_int((int)(5))); SWIG_Python_SetConstant(d, "DFNT_FLOAT64",SWIG_From_int((int)(6))); SWIG_Python_SetConstant(d, "DFNT_DOUBLE",SWIG_From_int((int)(6))); SWIG_Python_SetConstant(d, "DFNT_FLOAT128",SWIG_From_int((int)(7))); SWIG_Python_SetConstant(d, "DFNT_INT8",SWIG_From_int((int)(20))); SWIG_Python_SetConstant(d, "DFNT_UINT8",SWIG_From_int((int)(21))); SWIG_Python_SetConstant(d, "DFNT_INT16",SWIG_From_int((int)(22))); SWIG_Python_SetConstant(d, "DFNT_UINT16",SWIG_From_int((int)(23))); SWIG_Python_SetConstant(d, "DFNT_INT32",SWIG_From_int((int)(24))); SWIG_Python_SetConstant(d, "DFNT_UINT32",SWIG_From_int((int)(25))); SWIG_Python_SetConstant(d, "DFNT_INT64",SWIG_From_int((int)(26))); SWIG_Python_SetConstant(d, "DFNT_UINT64",SWIG_From_int((int)(27))); SWIG_Python_SetConstant(d, "DFNT_INT128",SWIG_From_int((int)(28))); SWIG_Python_SetConstant(d, "DFNT_UINT128",SWIG_From_int((int)(30))); SWIG_Python_SetConstant(d, "DFNT_UCHAR8",SWIG_From_int((int)(3))); SWIG_Python_SetConstant(d, "DFNT_UCHAR",SWIG_From_int((int)(3))); SWIG_Python_SetConstant(d, "DFNT_CHAR8",SWIG_From_int((int)(4))); SWIG_Python_SetConstant(d, "DFNT_CHAR",SWIG_From_int((int)(4))); SWIG_Python_SetConstant(d, "DFNT_CHAR16",SWIG_From_int((int)(42))); SWIG_Python_SetConstant(d, "DFNT_UCHAR16",SWIG_From_int((int)(43))); SWIG_Python_SetConstant(d, "SD_UNLIMITED",SWIG_From_int((int)(0))); SWIG_Python_SetConstant(d, "SD_FILL",SWIG_From_int((int)(0))); SWIG_Python_SetConstant(d, "SD_NOFILL",SWIG_From_int((int)(256))); SWIG_Python_SetConstant(d, "CHAR_BUFFER_SIZE",SWIG_From_int((int)(4096))); SWIG_Python_SetConstant(d, "ATTRIB_BUFFER_SIZE",SWIG_From_int((int)(128))); SWIG_Python_SetConstant(d, "DFACC_READ",SWIG_From_int((int)(1))); SWIG_Python_SetConstant(d, "DFACC_WRITE",SWIG_From_int((int)(2))); SWIG_Python_SetConstant(d, "DFACC_CREATE",SWIG_From_int((int)(4))); SWIG_Python_SetConstant(d, "DFACC_ALL",SWIG_From_int((int)(7))); SWIG_Python_SetConstant(d, "DFACC_RDONLY",SWIG_From_int((int)(1))); SWIG_Python_SetConstant(d, "DFACC_RDWR",SWIG_From_int((int)(3))); SWIG_Python_SetConstant(d, "DFACC_CLOBBER",SWIG_From_int((int)(4))); SWIG_Python_SetConstant(d, "DFACC_BUFFER",SWIG_From_int((int)(8))); SWIG_Python_SetConstant(d, "DFACC_APPENDABLE",SWIG_From_int((int)(0x10))); SWIG_Python_SetConstant(d, "DFACC_CURRENT",SWIG_From_int((int)(0x20))); SWIG_Python_SetConstant(d, "DFACC_OLD",SWIG_From_int((int)(1))); SWIG_Python_SetConstant(d, "COMP_CODE_NONE",SWIG_From_int((int)(0))); SWIG_Python_SetConstant(d, "COMP_CODE_RLE",SWIG_From_int((int)(1))); SWIG_Python_SetConstant(d, "COMP_CODE_NBIT",SWIG_From_int((int)(2))); SWIG_Python_SetConstant(d, "COMP_CODE_SKPHUFF",SWIG_From_int((int)(3))); SWIG_Python_SetConstant(d, "COMP_CODE_DEFLATE",SWIG_From_int((int)(4))); SWIG_Python_SetConstant(d, "COMP_CODE_SZIP",SWIG_From_int((int)(5))); SWIG_Python_SetConstant(d, "DFTAG_NDG",SWIG_From_int((int)(720))); SWIG_Python_SetConstant(d, "DFTAG_VH",SWIG_From_int((int)(1962))); SWIG_Python_SetConstant(d, "DFTAG_VG",SWIG_From_int((int)(1965))); SWIG_Python_SetConstant(d, "H4_MAX_VAR_DIMS",SWIG_From_int((int)(H4_MAX_VAR_DIMS))); /* Init numpy. Mandatory, otherwise the extension will bomb. */ import_array(); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } pyhdf-0.10.3/pyhdf/six.py000066400000000000000000000301771405105412500152010ustar00rootroot00000000000000"""Utilities for writing code that runs on Python 2 and 3""" # Copyright (c) 2010-2013 Benjamin Peterson # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import operator import sys import types __author__ = "Benjamin Peterson " __version__ = "1.3.0" # True if we are running on Python 3. PY3 = sys.version_info[0] == 3 if PY3: string_types = str, integer_types = int, class_types = type, text_type = str binary_type = bytes MAXSIZE = sys.maxsize else: string_types = basestring, integer_types = (int, long) class_types = (type, types.ClassType) text_type = unicode binary_type = str if sys.platform.startswith("java"): # Jython always uses 32 bits. MAXSIZE = int((1 << 31) - 1) else: # It's possible to have sizeof(long) != sizeof(Py_ssize_t). class X(object): def __len__(self): return 1 << 31 try: len(X()) except OverflowError: # 32-bit MAXSIZE = int((1 << 31) - 1) else: # 64-bit MAXSIZE = int((1 << 63) - 1) del X def _add_doc(func, doc): """Add documentation to a function.""" func.__doc__ = doc def _import_module(name): """Import module, returning the module after the last dot.""" __import__(name) return sys.modules[name] class _LazyDescr(object): def __init__(self, name): self.name = name def __get__(self, obj, tp): result = self._resolve() setattr(obj, self.name, result) # This is a bit ugly, but it avoids running this again. delattr(tp, self.name) return result class MovedModule(_LazyDescr): def __init__(self, name, old, new=None): super(MovedModule, self).__init__(name) if PY3: if new is None: new = name self.mod = new else: self.mod = old def _resolve(self): return _import_module(self.mod) class MovedAttribute(_LazyDescr): def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): super(MovedAttribute, self).__init__(name) if PY3: if new_mod is None: new_mod = name self.mod = new_mod if new_attr is None: if old_attr is None: new_attr = name else: new_attr = old_attr self.attr = new_attr else: self.mod = old_mod if old_attr is None: old_attr = name self.attr = old_attr def _resolve(self): module = _import_module(self.mod) return getattr(module, self.attr) class _MovedItems(types.ModuleType): """Lazy loading of moved objects""" _moved_attributes = [ MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), MovedAttribute("map", "itertools", "builtins", "imap", "map"), MovedAttribute("reload_module", "__builtin__", "imp", "reload"), MovedAttribute("reduce", "__builtin__", "functools"), MovedAttribute("StringIO", "StringIO", "io"), MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), MovedModule("builtins", "__builtin__"), MovedModule("configparser", "ConfigParser"), MovedModule("copyreg", "copy_reg"), MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), MovedModule("http_cookies", "Cookie", "http.cookies"), MovedModule("html_entities", "htmlentitydefs", "html.entities"), MovedModule("html_parser", "HTMLParser", "html.parser"), MovedModule("http_client", "httplib", "http.client"), MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), MovedModule("cPickle", "cPickle", "pickle"), MovedModule("queue", "Queue"), MovedModule("reprlib", "repr"), MovedModule("socketserver", "SocketServer"), MovedModule("tkinter", "Tkinter"), MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), MovedModule("tkinter_tix", "Tix", "tkinter.tix"), MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), MovedModule("tkinter_colorchooser", "tkColorChooser", "tkinter.colorchooser"), MovedModule("tkinter_commondialog", "tkCommonDialog", "tkinter.commondialog"), MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), MovedModule("tkinter_font", "tkFont", "tkinter.font"), MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", "tkinter.simpledialog"), MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), MovedModule("winreg", "_winreg"), ] for attr in _moved_attributes: setattr(_MovedItems, attr.name, attr) del attr moves = sys.modules[__name__ + ".moves"] = _MovedItems("moves") def add_move(move): """Add an item to six.moves.""" setattr(_MovedItems, move.name, move) def remove_move(name): """Remove item from six.moves.""" try: delattr(_MovedItems, name) except AttributeError: try: del moves.__dict__[name] except KeyError: raise AttributeError("no such move, %r" % (name,)) if PY3: _meth_func = "__func__" _meth_self = "__self__" _func_closure = "__closure__" _func_code = "__code__" _func_defaults = "__defaults__" _func_globals = "__globals__" _iterkeys = "keys" _itervalues = "values" _iteritems = "items" _iterlists = "lists" else: _meth_func = "im_func" _meth_self = "im_self" _func_closure = "func_closure" _func_code = "func_code" _func_defaults = "func_defaults" _func_globals = "func_globals" _iterkeys = "iterkeys" _itervalues = "itervalues" _iteritems = "iteritems" _iterlists = "iterlists" try: advance_iterator = next except NameError: def advance_iterator(it): return it.next() next = advance_iterator try: callable = callable except NameError: def callable(obj): return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) if PY3: def get_unbound_function(unbound): return unbound Iterator = object else: def get_unbound_function(unbound): return unbound.im_func class Iterator(object): def next(self): return type(self).__next__(self) callable = callable _add_doc(get_unbound_function, """Get the function out of a possibly unbound function""") get_method_function = operator.attrgetter(_meth_func) get_method_self = operator.attrgetter(_meth_self) get_function_closure = operator.attrgetter(_func_closure) get_function_code = operator.attrgetter(_func_code) get_function_defaults = operator.attrgetter(_func_defaults) get_function_globals = operator.attrgetter(_func_globals) def iterkeys(d, **kw): """Return an iterator over the keys of a dictionary.""" return iter(getattr(d, _iterkeys)(**kw)) def itervalues(d, **kw): """Return an iterator over the values of a dictionary.""" return iter(getattr(d, _itervalues)(**kw)) def iteritems(d, **kw): """Return an iterator over the (key, value) pairs of a dictionary.""" return iter(getattr(d, _iteritems)(**kw)) def iterlists(d, **kw): """Return an iterator over the (key, [values]) pairs of a dictionary.""" return iter(getattr(d, _iterlists)(**kw)) if PY3: def b(s): return s.encode("latin-1") def u(s): return s if sys.version_info[1] <= 1: def int2byte(i): return bytes((i,)) else: # This is about 2x faster than the implementation above on 3.2+ int2byte = operator.methodcaller("to_bytes", 1, "big") import io StringIO = io.StringIO BytesIO = io.BytesIO else: def b(s): return s def u(s): return unicode(s, "unicode_escape") int2byte = chr import StringIO StringIO = BytesIO = StringIO.StringIO _add_doc(b, """Byte literal""") _add_doc(u, """Text literal""") if PY3: import builtins exec_ = getattr(builtins, "exec") def reraise(tp, value, tb=None): if value.__traceback__ is not tb: raise value.with_traceback(tb) raise value print_ = getattr(builtins, "print") del builtins else: def exec_(_code_, _globs_=None, _locs_=None): """Execute code in a namespace.""" if _globs_ is None: frame = sys._getframe(1) _globs_ = frame.f_globals if _locs_ is None: _locs_ = frame.f_locals del frame elif _locs_ is None: _locs_ = _globs_ exec("""exec _code_ in _globs_, _locs_""") exec_("""def reraise(tp, value, tb=None): raise tp, value, tb """) def print_(*args, **kwargs): """The new-style print function.""" fp = kwargs.pop("file", sys.stdout) if fp is None: return def write(data): if not isinstance(data, basestring): data = str(data) fp.write(data) want_unicode = False sep = kwargs.pop("sep", None) if sep is not None: if isinstance(sep, unicode): want_unicode = True elif not isinstance(sep, str): raise TypeError("sep must be None or a string") end = kwargs.pop("end", None) if end is not None: if isinstance(end, unicode): want_unicode = True elif not isinstance(end, str): raise TypeError("end must be None or a string") if kwargs: raise TypeError("invalid keyword arguments to print()") if not want_unicode: for arg in args: if isinstance(arg, unicode): want_unicode = True break if want_unicode: newline = unicode("\n") space = unicode(" ") else: newline = "\n" space = " " if sep is None: sep = space if end is None: end = newline for i, arg in enumerate(args): if i: write(sep) write(arg) write(end) _add_doc(reraise, """Reraise an exception.""") def with_metaclass(meta, base=object): """Create a base class with a metaclass.""" return meta("NewBase", (base,), {}) pyhdf-0.10.3/pyhdf/test_SD.py000066400000000000000000000031451405105412500157360ustar00rootroot00000000000000#!/usr/bin/env python import numpy as np import os import pyhdf.SD import shutil import tempfile from nose.tools import eq_ from numpy.testing import assert_array_equal from pyhdf.SD import SDC def test_long_varname(): sds_name = 'a'*255 temp = tempfile.mkdtemp(prefix='pyhdf_') try: path = os.path.join(temp, "test.hdf") # create a file with a long variable name sd = pyhdf.SD.SD(path, SDC.WRITE|SDC.CREATE|SDC.TRUNC) sds = sd.create(sds_name, SDC.FLOAT32, (3,)) sds[:] = range(10, 13) sds.endaccess() sd.end() # check we can read the variable name sd = pyhdf.SD.SD(path) sds = sd.select(sds_name) name, _, _, _, _ = sds.info() sds.endaccess() sd.end() eq_(sds_name, name) finally: shutil.rmtree(temp) def test_negative_int8(): temp = tempfile.mkdtemp(prefix='pyhdf_') try: path = os.path.join(temp, "test.hdf") sd = pyhdf.SD.SD(path, SDC.WRITE|SDC.CREATE|SDC.TRUNC) data = np.zeros(shape=(20,20), dtype=np.int8) sds = sd.create("testsds", SDC.INT8, data.shape) sds.setfillvalue(-1) eq_(sds.getfillvalue(), -1) sds.setrange(-50, -30) min, max = sds.getrange() eq_(min, -50) eq_(max, -30) attr = sds.attr("testattr") attr.set(SDC.INT8, -1) eq_(attr.get(), -1) dim = sds.dim(0) scale = [-1]*20 dim.setscale(SDC.INT8, scale) assert_array_equal(dim.getscale(), scale) sds[:,:] = -40 sd.end() finally: shutil.rmtree(temp) pyhdf-0.10.3/pyproject.toml000066400000000000000000000002231405105412500156130ustar00rootroot00000000000000[build-system] # Minimum requirements for the build system to execute. requires = [ # PEP 508 specifications. "numpy", "setuptools", "wheel" ] pyhdf-0.10.3/setup.cfg000066400000000000000000000003611405105412500145230ustar00rootroot00000000000000[bdist_rpm] group = Development/Python packager = Fazlul Shahriar release = 1 requires = HDF-4.2r1 numpy provides = pyhdf doc_files = pyhdf/doc/ [options] install_requires = numpy setup_requires = numpy pyhdf-0.10.3/setup.py000066400000000000000000000117401405105412500144170ustar00rootroot00000000000000#!/usr/bin/env python """pyhdf: Python interface to the NCSA HDF4 library. The pyhdf package wraps the functionality of the NCSA HDF version 4 library inside a Python OOP framework. The SD (scientific dataset), VS (Vdata) and V (Vgroup) APIs are currently implemented. SD datasets are read/written through numpy arrays. NetCDF files can also be read and modified with pyhdf. """ from __future__ import print_function DOCLINES = __doc__.split("\n") # Allows bdist_egg to work if you have setuptools installed. # This import must be before the numpy.distutils import of setup. # Otherwise, no harm. try: import setuptools except: pass from numpy.distutils.core import setup, Extension import sys import os import os.path as path import shlex CLASSIFIERS = """\ Development Status :: 5 - Production/Stable Intended Audience :: Science/Research Intended Audience :: Developers License :: OSI Approved Programming Language :: C Programming Language :: Python Programming Language :: Python :: 3 Topic :: Software Development Topic :: Scientific/Engineering Operating System :: Microsoft :: Windows Operating System :: POSIX Operating System :: Unix Operating System :: MacOS """ def _find_args(pat, env): val = os.environ.get(env, []) if val: val = val.split(os.pathsep) try: k = sys.argv.index(pat) val.extend(sys.argv[k+1].split(os.pathsep)) del sys.argv[k] del sys.argv[k] except ValueError: pass return val # A Debian based linux distribution might be using libhdf4 (contains netcdf # routines) or libhdf4-alt (does not contain netcdf routines). This function # tries to detect if the alt version should be used. def _use_hdf4alt(libdirs): if not sys.platform.startswith("linux"): return False libdirs.extend(os.environ.get("LD_LIBRARY_PATH", "").split(os.pathsep)) libdirs.append("/usr/lib") libdirs.append("/usr/local/lib") libdirs.append("/lib") for d in libdirs: if os.path.exists(os.path.join(d, "libdfalt.so")) and \ os.path.exists(os.path.join(d, "libmfhdfalt.so")): return True return False include_dirs = _find_args('-i', 'INCLUDE_DIRS') library_dirs = _find_args('-l', 'LIBRARY_DIRS') szip_installed = 'SZIP' in os.environ compress = 'NO_COMPRESS' not in os.environ extra_link_args = None if "LINK_ARGS" in os.environ: extra_link_args = shlex.split(os.environ["LINK_ARGS"]) msg = 'Cannot proceed without the HDF4 library. Please ' \ 'export INCLUDE_DIRS and LIBRARY_DIRS as explained' \ 'in the INSTALL file.' if sys.platform.startswith('linux'): # libhdf4 header files on most linux distributations # (e.g. Debian/Ubuntu, CentOS) are stored in /usr/include/hdf d = "/usr/include/hdf/" if not include_dirs and os.path.exists(d): include_dirs.append(d) for p in include_dirs + library_dirs: if not path.exists(p): print("\n******\n%s not found\n******\n\n" % p) raise RuntimeError(msg) if sys.platform == 'win32': # Find DLL path dll_path = '' for p in library_dirs: if path.exists(p + os.path.sep + "mfhdf.dll"): dll_path = p + os.path.sep break if dll_path == '': print("library_dirs =", library_dirs) raise RuntimeError("Cannot find required HDF4 DLLs -- check LIBRARY_DIRS") if sys.platform == 'win32': libraries = ["mfhdf", "hdf", "xdr" ] elif _use_hdf4alt(library_dirs): libraries = ["mfhdfalt", "dfalt"] else: libraries = ["mfhdf", "df"] if szip_installed: extra_compile_args = [] if sys.platform == 'win32': libraries += ["szlib"] else: libraries += ["sz"] else: extra_compile_args = ["-DNOSZIP"] if sys.platform == 'win32': libraries += ["libjpeg", "zlib", "ws2_32"] else: libraries += ["jpeg", "z"] if not compress: extra_compile_args += ["-DNOCOMPRESS"] _hdfext = Extension('pyhdf._hdfext', sources = ["pyhdf/hdfext_wrap.c"], include_dirs = include_dirs, extra_compile_args = extra_compile_args, library_dirs = library_dirs, extra_link_args=extra_link_args, libraries = libraries, ) if sys.platform == 'win32': data_files = [("pyhdf", [dll_path + x for x in ["mfhdf.dll", "hdf.dll"]])] else: data_files = [] setup(name = 'pyhdf', maintainer = 'pyhdf authors', author = 'Andre Gosselin et al.', description = DOCLINES[0], keywords = ['hdf4', 'netcdf', 'numpy', 'python', 'pyhdf'], license = 'MIT', long_description = "\n".join(DOCLINES[2:]), url = 'https://github.com/fhs/pyhdf', version = '0.10.3', packages = ['pyhdf'], ext_modules = [_hdfext], data_files = data_files, provides = ['pyhdf'], classifiers = [_f for _f in CLASSIFIERS.split('\n') if _f], platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], )