././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1731192754.0037427 portio-0.6.2/0000775000175000017500000000000014713763662013310 5ustar00fabriziofabrizio././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674262080.0 portio-0.6.2/MANIFEST.in0000644000175000017500000000016414362633100015024 0ustar00fabriziofabrizioinclude portio.c include toggle.py include *.rst include *.html include *.json include _static/* include _sources/* ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674262078.0 portio-0.6.2/Makefile0000644000175000017500000000434014362633076014742 0ustar00fabriziofabrizio# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d .build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html web pickle htmlhelp latex changes linkcheck help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " pickle to make pickle files (usable by e.g. sphinx-web)" @echo " htmlhelp to make HTML files and a HTML help project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " changes to make an overview over all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" clean: -rm -rf .build/* html: mkdir -p .build/html .build/doctrees $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) .build/html @echo @echo "Build finished. The HTML pages are in .build/html." pickle: mkdir -p .build/pickle .build/doctrees $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) .build/pickle @echo @echo "Build finished; now you can process the pickle files or run" @echo " sphinx-web .build/pickle" @echo "to start the sphinx-web server." web: pickle htmlhelp: mkdir -p .build/htmlhelp .build/doctrees $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) .build/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in .build/htmlhelp." latex: mkdir -p .build/latex .build/doctrees $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) .build/latex @echo @echo "Build finished; the LaTeX files are in .build/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." changes: mkdir -p .build/changes .build/doctrees $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) .build/changes @echo @echo "The overview file is in .build/changes." linkcheck: mkdir -p .build/linkcheck .build/doctrees $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) .build/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in .build/linkcheck/output.txt." ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1731192754.0037427 portio-0.6.2/PKG-INFO0000644000175000017500000002041414713763662014404 0ustar00fabriziofabrizioMetadata-Version: 2.1 Name: portio Version: 0.6.2 Summary: PortIO, python low level port I/O for Linux x86 Home-page: http://portio.inrim.it Author: Fabrizio Pollastri Author-email: Fabrizio Pollastri License: LGPL Project-URL: Documentation, https://github.com/fabriziop/portio#readme Project-URL: Issues, https://github.com/fabriziop/portio/issues Project-URL: Source, https://github.com/fabriziop/portio Platform: Linux Classifier: Development Status :: 4 - Beta Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=2.8 Description-Content-Type: text/x-rst ================================================ PortIO, python low level port I/O for Linux x86 ================================================ What is ======= PortIO is a Python wrapper for the port I/O macros like **outb, inb**, etc. provided by the C library on Linux x86 platforms. Both python 2 and 3 are supported. This module is useful when a general pourpose port I/O at the low level is needed. Programmers that want to perform I/O on the parallel port at an higher level, will be better satisfied by the `pyParallel `_ module. A similar module Ioport has inspired the writing of PortIO. .. now is broken `Ioport `_ PortIO is released under the `GNU General Public License `_. *At present, version 0.6.2, PortIO is in beta status. Any debugging aid is welcome.* For any question, suggestion, contribution contact the author `Fabrizio Pollastri` . The PortIO web site is hosted at http://portio.inrim.it/. Usage example ============= This sample program toggle on and off all the data lines of the parallel port lp0 with a 6 seconds period. Note the check for root privileges before the call to **ioperm** to acquire the proper I/O permissions for the involved ports. Download the sample program `toggle.py <./toggle.py>`_ Module reference ================ PortIO is a Python front end to the low level functions provided by the C library on Linux 386 platforms for the hardware input and output ports: **outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw, inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl**. Before doing port I/O, it is mandatory to acquire proper privileges by calling **ioperm** or **iopl**. Otherwise you will get a segmentation fault. **outb (data,port)** Output the byte **data** to the I/O address **port**. **outb_p (data,port)** The same as **outb**, but waits for I/O completion. **outw (data,port)** Output the 16 bit word **data** to the I/O address **port**. **outw_p (data,port)** The same as **outw**, but waits for I/O completion. **outl (data,port)** Output the 32 bit word **data** to the I/O address **port**. **outl_p (data,port)** The same as **outl**, but waits for I/O completion. **outsb (port,data,count)** Repeat **count** times the output of a byte to the I/O address **port**, reading it from buffer of bytes starting at **data** and with length **count**. **outsw (port,data,count)** Repeat **count** times the output of a 16 bit word to the I/O address **port**, reading it from buffer of 16 bit words starting at **data** and with length **count** x 2. **outsl (port,data,count)** Repeat **count** times the output of a 32 bit word to the I/O address **port**, reading it from buffer of 32 bit words starting at **data** and with length **count** x 4. **inb (port)** Input a byte from the I/O address **port** and return it as integer. **inb_p (port)** The same as **inb**, but waits for I/O completion. **inw (port)** Input a 16 bit word from the I/O address **port** and return it as integer. **inw_p (port)** The same as **inw**, but waits for I/O completion. **inl (port)** Input a 32 bit word from the I/O address **port** and return it as integer. **inl_p (port)** The same as **inl**, but waits for I/O completion. **insb (port,data,count)** Repeat **count** times the input of a byte from the I/O address **port** and write it to a buffer of bytes starting at **data** and with length **count** bytes. **insw (port,data,count)** Repeat **count** times the input of a 16 bit word from the I/O address **port** and write it to a buffer of 16 bit words starting at **data** and with length **count** x 2 bytes. **insl (port,data,count)** Repeat **count** times the input of a 32 bit word from the I/O address **port** and write it to a buffer of 32 bit words starting at **data** and with length **count** x 4 bytes. **ioperm (from,extent,enable)** Set port access permission starting from address **from** for **extent** bytes. If the **enable** is True, access is enabled, otherwise is disabled. On success, zero is returned. On error, the errno code is returned. The use of ioperm requires root privileges. Only the first 0x3ff I/O ports can be specified in this manner. To gain access to any I/O port in the whole (0x0000-0xffff) address range, use the iopl function. **iopl (level)** Set the I/O privilege level of the current process. When **level** is 3 access is granted to any I/O port. On success, zero is returned. On error, the errno code is returned. The use of iopl requires root privileges. Requirements ============ A **linux on an X86 architecture**. To run the code, **Python 2.6 or later** or **Python 3.0 or later** must already be installed. The latest release is recommended. Python is available from http://www.python.org/. Installation ============ With easy_install ----------------- 1. Open a shell. 2. Get root privileges and install the package. Command: :: easy_install portio From tarball ------------ Download PortIO tarball from http://portio.inrim.it/portio-0.6.2.tar.gz . The first step is to expand the ``.tgz`` archive in a temporary directory (**not** directly in Python's ``site-packages``). It contains a distutils setup file "setup.py". 1. Open a shell. 2. Unpack the tarball in a temporary directory (**not** directly in Python's ``site-packages``). Command: :: tar zxf portio-X.Y.Z.tar.gz X and Y are the major and minor version numbers of the tarball. 2. Go to the directory created by expanding the tarball. Command: :: cd portio-X.Y.Z 3. Get root privileges and install the package. Command: :: su (enter root password) python -m build If the python executable isn't on your path, you'll have to specify the complete path, such as /usr/local/bin/python. Changelog ========= **Portio 0.6.2 released 19-Oct-2024** * Remove absolute paths and cleanup build, contributed by James Hilliard **Portio 0.6.0 released 14-Jul-2024** * Use Py_buffer instead of C strings, contributed by Stephen Horvath * Add pyproject.toml file **Portio 0.5 released 25-Oct-2012** * Porting to python 3 also contributed by Stjepan Henc . **Portio 0.4 released 25-Aug-2009** * Fixed some argument type mismatch in I/O macros. * Upgraded PyArg_ParseTuple format strings with the new "unsigned" formats available from python 2.3 . So portio now requires python version => 2.3 . **Portio 0.3 released 21-May-2009** * Fixed missing documentation files. **Portio 0.2 released 11-Nov-2008** * Added return of status code for **ioperm** and **iopl**. * Fixed invalid argument type for **ioperm**. * Updated **toggle.py** example with **ioperm** error check. * Generated documentation with Sphinx. **Portio 0.1 released 23-Feb-2006** * First release. Credits ======= * Thanks to Stjepan Henc for his contribution to python 3 porting. ---- Copyright 2006-2024 by `Fabrizio Pollastri` .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/README.html0000664000175000017500000003317014713763623015134 0ustar00fabriziofabrizio PortIO, python low level port I/O for Linux x86 — PortIO 0.6.2 documentation

PortIO, python low level port I/O for Linux x86

What is

PortIO is a Python wrapper for the port I/O macros like outb, inb, etc. provided by the C library on Linux x86 platforms. Both python 2 and 3 are supported. This module is useful when a general pourpose port I/O at the low level is needed. Programmers that want to perform I/O on the parallel port at an higher level, will be better satisfied by the pyParallel module. A similar module Ioport has inspired the writing of PortIO.

PortIO is released under the GNU General Public License.

At present, version 0.6.2, PortIO is in beta status. Any debugging aid is welcome.

For any question, suggestion, contribution contact the author Fabrizio Pollastri <mxgbot_a_t_gmail.com>.

The PortIO web site is hosted at http://portio.inrim.it/.

Usage example

This sample program toggle on and off all the data lines of the parallel port lp0 with a 6 seconds period. Note the check for root privileges before the call to ioperm to acquire the proper I/O permissions for the involved ports.

Download the sample program toggle.py

Module reference

PortIO is a Python front end to the low level functions provided by the C library on Linux 386 platforms for the hardware input and output ports: outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw, inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl.

Before doing port I/O, it is mandatory to acquire proper privileges by calling ioperm or iopl. Otherwise you will get a segmentation fault.

outb (data,port)

Output the byte data to the I/O address port.

outb_p (data,port)

The same as outb, but waits for I/O completion.

outw (data,port)

Output the 16 bit word data to the I/O address port.

outw_p (data,port)

The same as outw, but waits for I/O completion.

outl (data,port)

Output the 32 bit word data to the I/O address port.

outl_p (data,port)

The same as outl, but waits for I/O completion.

outsb (port,data,count)

Repeat count times the output of a byte to the I/O address port, reading it from buffer of bytes starting at data and with length count.

outsw (port,data,count)

Repeat count times the output of a 16 bit word to the I/O address port, reading it from buffer of 16 bit words starting at data and with length count x 2.

outsl (port,data,count)

Repeat count times the output of a 32 bit word to the I/O address port, reading it from buffer of 32 bit words starting at data and with length count x 4.

inb (port)

Input a byte from the I/O address port and return it as integer.

inb_p (port)

The same as inb, but waits for I/O completion.

inw (port)

Input a 16 bit word from the I/O address port and return it as integer.

inw_p (port)

The same as inw, but waits for I/O completion.

inl (port)

Input a 32 bit word from the I/O address port and return it as integer.

inl_p (port)

The same as inl, but waits for I/O completion.

insb (port,data,count)

Repeat count times the input of a byte from the I/O address port and write it to a buffer of bytes starting at data and with length count bytes.

insw (port,data,count)

Repeat count times the input of a 16 bit word from the I/O address port and write it to a buffer of 16 bit words starting at data and with length count x 2 bytes.

insl (port,data,count)

Repeat count times the input of a 32 bit word from the I/O address port and write it to a buffer of 32 bit words starting at data and with length count x 4 bytes.

ioperm (from,extent,enable)

Set port access permission starting from address from for extent bytes. If the enable is True, access is enabled, otherwise is disabled. On success, zero is returned. On error, the errno code is returned. The use of ioperm requires root privileges.

Only the first 0x3ff I/O ports can be specified in this manner. To gain access to any I/O port in the whole (0x0000-0xffff) address range, use the iopl function.

iopl (level)

Set the I/O privilege level of the current process. When level is 3 access is granted to any I/O port. On success, zero is returned. On error, the errno code is returned. The use of iopl requires root privileges.

Requirements

A linux on an X86 architecture.

To run the code, Python 2.6 or later or Python 3.0 or later must already be installed. The latest release is recommended. Python is available from http://www.python.org/.

Installation

With easy_install

  1. Open a shell.

  2. Get root privileges and install the package. Command:

    easy_install portio
    

From tarball

Download PortIO tarball from http://portio.inrim.it/portio-0.6.2.tar.gz .

The first step is to expand the .tgz archive in a temporary directory (not directly in Python’s site-packages). It contains a distutils setup file “setup.py”.

  1. Open a shell.

  2. Unpack the tarball in a temporary directory (not directly in Python’s site-packages). Command:

    tar zxf portio-X.Y.Z.tar.gz
    

    X and Y are the major and minor version numbers of the tarball.

  1. Go to the directory created by expanding the tarball. Command:

    cd portio-X.Y.Z
    
  2. Get root privileges and install the package. Command:

    su
    (enter root password)
    python -m build
    

    If the python executable isn’t on your path, you’ll have to specify the complete path, such as /usr/local/bin/python.

Changelog

Portio 0.6.2 released 19-Oct-2024

  • Remove absolute paths and cleanup build, contributed by James Hilliard <james.hilliard1_a_t_gmail.com>

Portio 0.6.0 released 14-Jul-2024

  • Use Py_buffer instead of C strings, contributed by Stephen Horvath <me_a_t_stevetech.au>

  • Add pyproject.toml file

Portio 0.5 released 25-Oct-2012

  • Porting to python 3 also contributed by Stjepan Henc <sthenc_a_t_gmail.com>.

Portio 0.4 released 25-Aug-2009

  • Fixed some argument type mismatch in I/O macros.

  • Upgraded PyArg_ParseTuple format strings with the new “unsigned” formats available from python 2.3 . So portio now requires python version => 2.3 .

Portio 0.3 released 21-May-2009

  • Fixed missing documentation files.

Portio 0.2 released 11-Nov-2008

  • Added return of status code for ioperm and iopl.

  • Fixed invalid argument type for ioperm.

  • Updated toggle.py example with ioperm error check.

  • Generated documentation with Sphinx.

Portio 0.1 released 23-Feb-2006

  • First release.

Credits

  • Thanks to Stjepan Henc <sthenc_a_t_gmail.com> for his contribution to python 3 porting.


Copyright 2006-2024 by Fabrizio Pollastri <mxgbot_a_t_gmail.com>

././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192707.0 portio-0.6.2/README.rst0000644000175000017500000001640214713763603014773 0ustar00fabriziofabrizio ================================================ PortIO, python low level port I/O for Linux x86 ================================================ What is ======= PortIO is a Python wrapper for the port I/O macros like **outb, inb**, etc. provided by the C library on Linux x86 platforms. Both python 2 and 3 are supported. This module is useful when a general pourpose port I/O at the low level is needed. Programmers that want to perform I/O on the parallel port at an higher level, will be better satisfied by the `pyParallel `_ module. A similar module Ioport has inspired the writing of PortIO. .. now is broken `Ioport `_ PortIO is released under the `GNU General Public License `_. *At present, version 0.6.2, PortIO is in beta status. Any debugging aid is welcome.* For any question, suggestion, contribution contact the author `Fabrizio Pollastri` . The PortIO web site is hosted at http://portio.inrim.it/. Usage example ============= This sample program toggle on and off all the data lines of the parallel port lp0 with a 6 seconds period. Note the check for root privileges before the call to **ioperm** to acquire the proper I/O permissions for the involved ports. Download the sample program `toggle.py <./toggle.py>`_ Module reference ================ PortIO is a Python front end to the low level functions provided by the C library on Linux 386 platforms for the hardware input and output ports: **outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw, inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl**. Before doing port I/O, it is mandatory to acquire proper privileges by calling **ioperm** or **iopl**. Otherwise you will get a segmentation fault. **outb (data,port)** Output the byte **data** to the I/O address **port**. **outb_p (data,port)** The same as **outb**, but waits for I/O completion. **outw (data,port)** Output the 16 bit word **data** to the I/O address **port**. **outw_p (data,port)** The same as **outw**, but waits for I/O completion. **outl (data,port)** Output the 32 bit word **data** to the I/O address **port**. **outl_p (data,port)** The same as **outl**, but waits for I/O completion. **outsb (port,data,count)** Repeat **count** times the output of a byte to the I/O address **port**, reading it from buffer of bytes starting at **data** and with length **count**. **outsw (port,data,count)** Repeat **count** times the output of a 16 bit word to the I/O address **port**, reading it from buffer of 16 bit words starting at **data** and with length **count** x 2. **outsl (port,data,count)** Repeat **count** times the output of a 32 bit word to the I/O address **port**, reading it from buffer of 32 bit words starting at **data** and with length **count** x 4. **inb (port)** Input a byte from the I/O address **port** and return it as integer. **inb_p (port)** The same as **inb**, but waits for I/O completion. **inw (port)** Input a 16 bit word from the I/O address **port** and return it as integer. **inw_p (port)** The same as **inw**, but waits for I/O completion. **inl (port)** Input a 32 bit word from the I/O address **port** and return it as integer. **inl_p (port)** The same as **inl**, but waits for I/O completion. **insb (port,data,count)** Repeat **count** times the input of a byte from the I/O address **port** and write it to a buffer of bytes starting at **data** and with length **count** bytes. **insw (port,data,count)** Repeat **count** times the input of a 16 bit word from the I/O address **port** and write it to a buffer of 16 bit words starting at **data** and with length **count** x 2 bytes. **insl (port,data,count)** Repeat **count** times the input of a 32 bit word from the I/O address **port** and write it to a buffer of 32 bit words starting at **data** and with length **count** x 4 bytes. **ioperm (from,extent,enable)** Set port access permission starting from address **from** for **extent** bytes. If the **enable** is True, access is enabled, otherwise is disabled. On success, zero is returned. On error, the errno code is returned. The use of ioperm requires root privileges. Only the first 0x3ff I/O ports can be specified in this manner. To gain access to any I/O port in the whole (0x0000-0xffff) address range, use the iopl function. **iopl (level)** Set the I/O privilege level of the current process. When **level** is 3 access is granted to any I/O port. On success, zero is returned. On error, the errno code is returned. The use of iopl requires root privileges. Requirements ============ A **linux on an X86 architecture**. To run the code, **Python 2.6 or later** or **Python 3.0 or later** must already be installed. The latest release is recommended. Python is available from http://www.python.org/. Installation ============ With easy_install ----------------- 1. Open a shell. 2. Get root privileges and install the package. Command: :: easy_install portio From tarball ------------ Download PortIO tarball from http://portio.inrim.it/portio-0.6.2.tar.gz . The first step is to expand the ``.tgz`` archive in a temporary directory (**not** directly in Python's ``site-packages``). It contains a distutils setup file "setup.py". 1. Open a shell. 2. Unpack the tarball in a temporary directory (**not** directly in Python's ``site-packages``). Command: :: tar zxf portio-X.Y.Z.tar.gz X and Y are the major and minor version numbers of the tarball. 2. Go to the directory created by expanding the tarball. Command: :: cd portio-X.Y.Z 3. Get root privileges and install the package. Command: :: su (enter root password) python -m build If the python executable isn't on your path, you'll have to specify the complete path, such as /usr/local/bin/python. Changelog ========= **Portio 0.6.2 released 19-Oct-2024** * Remove absolute paths and cleanup build, contributed by James Hilliard **Portio 0.6.0 released 14-Jul-2024** * Use Py_buffer instead of C strings, contributed by Stephen Horvath * Add pyproject.toml file **Portio 0.5 released 25-Oct-2012** * Porting to python 3 also contributed by Stjepan Henc . **Portio 0.4 released 25-Aug-2009** * Fixed some argument type mismatch in I/O macros. * Upgraded PyArg_ParseTuple format strings with the new "unsigned" formats available from python 2.3 . So portio now requires python version => 2.3 . **Portio 0.3 released 21-May-2009** * Fixed missing documentation files. **Portio 0.2 released 11-Nov-2008** * Added return of status code for **ioperm** and **iopl**. * Fixed invalid argument type for **ioperm**. * Updated **toggle.py** example with **ioperm** error check. * Generated documentation with Sphinx. **Portio 0.1 released 23-Feb-2006** * First release. Credits ======= * Thanks to Stjepan Henc for his contribution to python 3 porting. ---- Copyright 2006-2024 by `Fabrizio Pollastri` .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1731192754.0007427 portio-0.6.2/_sources/0000775000175000017500000000000014713763662015132 5ustar00fabriziofabrizio././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192707.0 portio-0.6.2/_sources/README.rst.txt0000664000175000017500000001640214713763603017435 0ustar00fabriziofabrizio ================================================ PortIO, python low level port I/O for Linux x86 ================================================ What is ======= PortIO is a Python wrapper for the port I/O macros like **outb, inb**, etc. provided by the C library on Linux x86 platforms. Both python 2 and 3 are supported. This module is useful when a general pourpose port I/O at the low level is needed. Programmers that want to perform I/O on the parallel port at an higher level, will be better satisfied by the `pyParallel `_ module. A similar module Ioport has inspired the writing of PortIO. .. now is broken `Ioport `_ PortIO is released under the `GNU General Public License `_. *At present, version 0.6.2, PortIO is in beta status. Any debugging aid is welcome.* For any question, suggestion, contribution contact the author `Fabrizio Pollastri` . The PortIO web site is hosted at http://portio.inrim.it/. Usage example ============= This sample program toggle on and off all the data lines of the parallel port lp0 with a 6 seconds period. Note the check for root privileges before the call to **ioperm** to acquire the proper I/O permissions for the involved ports. Download the sample program `toggle.py <./toggle.py>`_ Module reference ================ PortIO is a Python front end to the low level functions provided by the C library on Linux 386 platforms for the hardware input and output ports: **outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw, inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl**. Before doing port I/O, it is mandatory to acquire proper privileges by calling **ioperm** or **iopl**. Otherwise you will get a segmentation fault. **outb (data,port)** Output the byte **data** to the I/O address **port**. **outb_p (data,port)** The same as **outb**, but waits for I/O completion. **outw (data,port)** Output the 16 bit word **data** to the I/O address **port**. **outw_p (data,port)** The same as **outw**, but waits for I/O completion. **outl (data,port)** Output the 32 bit word **data** to the I/O address **port**. **outl_p (data,port)** The same as **outl**, but waits for I/O completion. **outsb (port,data,count)** Repeat **count** times the output of a byte to the I/O address **port**, reading it from buffer of bytes starting at **data** and with length **count**. **outsw (port,data,count)** Repeat **count** times the output of a 16 bit word to the I/O address **port**, reading it from buffer of 16 bit words starting at **data** and with length **count** x 2. **outsl (port,data,count)** Repeat **count** times the output of a 32 bit word to the I/O address **port**, reading it from buffer of 32 bit words starting at **data** and with length **count** x 4. **inb (port)** Input a byte from the I/O address **port** and return it as integer. **inb_p (port)** The same as **inb**, but waits for I/O completion. **inw (port)** Input a 16 bit word from the I/O address **port** and return it as integer. **inw_p (port)** The same as **inw**, but waits for I/O completion. **inl (port)** Input a 32 bit word from the I/O address **port** and return it as integer. **inl_p (port)** The same as **inl**, but waits for I/O completion. **insb (port,data,count)** Repeat **count** times the input of a byte from the I/O address **port** and write it to a buffer of bytes starting at **data** and with length **count** bytes. **insw (port,data,count)** Repeat **count** times the input of a 16 bit word from the I/O address **port** and write it to a buffer of 16 bit words starting at **data** and with length **count** x 2 bytes. **insl (port,data,count)** Repeat **count** times the input of a 32 bit word from the I/O address **port** and write it to a buffer of 32 bit words starting at **data** and with length **count** x 4 bytes. **ioperm (from,extent,enable)** Set port access permission starting from address **from** for **extent** bytes. If the **enable** is True, access is enabled, otherwise is disabled. On success, zero is returned. On error, the errno code is returned. The use of ioperm requires root privileges. Only the first 0x3ff I/O ports can be specified in this manner. To gain access to any I/O port in the whole (0x0000-0xffff) address range, use the iopl function. **iopl (level)** Set the I/O privilege level of the current process. When **level** is 3 access is granted to any I/O port. On success, zero is returned. On error, the errno code is returned. The use of iopl requires root privileges. Requirements ============ A **linux on an X86 architecture**. To run the code, **Python 2.6 or later** or **Python 3.0 or later** must already be installed. The latest release is recommended. Python is available from http://www.python.org/. Installation ============ With easy_install ----------------- 1. Open a shell. 2. Get root privileges and install the package. Command: :: easy_install portio From tarball ------------ Download PortIO tarball from http://portio.inrim.it/portio-0.6.2.tar.gz . The first step is to expand the ``.tgz`` archive in a temporary directory (**not** directly in Python's ``site-packages``). It contains a distutils setup file "setup.py". 1. Open a shell. 2. Unpack the tarball in a temporary directory (**not** directly in Python's ``site-packages``). Command: :: tar zxf portio-X.Y.Z.tar.gz X and Y are the major and minor version numbers of the tarball. 2. Go to the directory created by expanding the tarball. Command: :: cd portio-X.Y.Z 3. Get root privileges and install the package. Command: :: su (enter root password) python -m build If the python executable isn't on your path, you'll have to specify the complete path, such as /usr/local/bin/python. Changelog ========= **Portio 0.6.2 released 19-Oct-2024** * Remove absolute paths and cleanup build, contributed by James Hilliard **Portio 0.6.0 released 14-Jul-2024** * Use Py_buffer instead of C strings, contributed by Stephen Horvath * Add pyproject.toml file **Portio 0.5 released 25-Oct-2012** * Porting to python 3 also contributed by Stjepan Henc . **Portio 0.4 released 25-Aug-2009** * Fixed some argument type mismatch in I/O macros. * Upgraded PyArg_ParseTuple format strings with the new "unsigned" formats available from python 2.3 . So portio now requires python version => 2.3 . **Portio 0.3 released 21-May-2009** * Fixed missing documentation files. **Portio 0.2 released 11-Nov-2008** * Added return of status code for **ioperm** and **iopl**. * Fixed invalid argument type for **ioperm**. * Updated **toggle.py** example with **ioperm** error check. * Generated documentation with Sphinx. **Portio 0.1 released 23-Feb-2006** * First release. Credits ======= * Thanks to Stjepan Henc for his contribution to python 3 porting. ---- Copyright 2006-2024 by `Fabrizio Pollastri` .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/_sources/index.rst.txt0000664000175000017500000001640214713763623017611 0ustar00fabriziofabrizio ================================================ PortIO, python low level port I/O for Linux x86 ================================================ What is ======= PortIO is a Python wrapper for the port I/O macros like **outb, inb**, etc. provided by the C library on Linux x86 platforms. Both python 2 and 3 are supported. This module is useful when a general pourpose port I/O at the low level is needed. Programmers that want to perform I/O on the parallel port at an higher level, will be better satisfied by the `pyParallel `_ module. A similar module Ioport has inspired the writing of PortIO. .. now is broken `Ioport `_ PortIO is released under the `GNU General Public License `_. *At present, version 0.6.2, PortIO is in beta status. Any debugging aid is welcome.* For any question, suggestion, contribution contact the author `Fabrizio Pollastri` . The PortIO web site is hosted at http://portio.inrim.it/. Usage example ============= This sample program toggle on and off all the data lines of the parallel port lp0 with a 6 seconds period. Note the check for root privileges before the call to **ioperm** to acquire the proper I/O permissions for the involved ports. Download the sample program `toggle.py <./toggle.py>`_ Module reference ================ PortIO is a Python front end to the low level functions provided by the C library on Linux 386 platforms for the hardware input and output ports: **outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw, inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl**. Before doing port I/O, it is mandatory to acquire proper privileges by calling **ioperm** or **iopl**. Otherwise you will get a segmentation fault. **outb (data,port)** Output the byte **data** to the I/O address **port**. **outb_p (data,port)** The same as **outb**, but waits for I/O completion. **outw (data,port)** Output the 16 bit word **data** to the I/O address **port**. **outw_p (data,port)** The same as **outw**, but waits for I/O completion. **outl (data,port)** Output the 32 bit word **data** to the I/O address **port**. **outl_p (data,port)** The same as **outl**, but waits for I/O completion. **outsb (port,data,count)** Repeat **count** times the output of a byte to the I/O address **port**, reading it from buffer of bytes starting at **data** and with length **count**. **outsw (port,data,count)** Repeat **count** times the output of a 16 bit word to the I/O address **port**, reading it from buffer of 16 bit words starting at **data** and with length **count** x 2. **outsl (port,data,count)** Repeat **count** times the output of a 32 bit word to the I/O address **port**, reading it from buffer of 32 bit words starting at **data** and with length **count** x 4. **inb (port)** Input a byte from the I/O address **port** and return it as integer. **inb_p (port)** The same as **inb**, but waits for I/O completion. **inw (port)** Input a 16 bit word from the I/O address **port** and return it as integer. **inw_p (port)** The same as **inw**, but waits for I/O completion. **inl (port)** Input a 32 bit word from the I/O address **port** and return it as integer. **inl_p (port)** The same as **inl**, but waits for I/O completion. **insb (port,data,count)** Repeat **count** times the input of a byte from the I/O address **port** and write it to a buffer of bytes starting at **data** and with length **count** bytes. **insw (port,data,count)** Repeat **count** times the input of a 16 bit word from the I/O address **port** and write it to a buffer of 16 bit words starting at **data** and with length **count** x 2 bytes. **insl (port,data,count)** Repeat **count** times the input of a 32 bit word from the I/O address **port** and write it to a buffer of 32 bit words starting at **data** and with length **count** x 4 bytes. **ioperm (from,extent,enable)** Set port access permission starting from address **from** for **extent** bytes. If the **enable** is True, access is enabled, otherwise is disabled. On success, zero is returned. On error, the errno code is returned. The use of ioperm requires root privileges. Only the first 0x3ff I/O ports can be specified in this manner. To gain access to any I/O port in the whole (0x0000-0xffff) address range, use the iopl function. **iopl (level)** Set the I/O privilege level of the current process. When **level** is 3 access is granted to any I/O port. On success, zero is returned. On error, the errno code is returned. The use of iopl requires root privileges. Requirements ============ A **linux on an X86 architecture**. To run the code, **Python 2.6 or later** or **Python 3.0 or later** must already be installed. The latest release is recommended. Python is available from http://www.python.org/. Installation ============ With easy_install ----------------- 1. Open a shell. 2. Get root privileges and install the package. Command: :: easy_install portio From tarball ------------ Download PortIO tarball from http://portio.inrim.it/portio-0.6.2.tar.gz . The first step is to expand the ``.tgz`` archive in a temporary directory (**not** directly in Python's ``site-packages``). It contains a distutils setup file "setup.py". 1. Open a shell. 2. Unpack the tarball in a temporary directory (**not** directly in Python's ``site-packages``). Command: :: tar zxf portio-X.Y.Z.tar.gz X and Y are the major and minor version numbers of the tarball. 2. Go to the directory created by expanding the tarball. Command: :: cd portio-X.Y.Z 3. Get root privileges and install the package. Command: :: su (enter root password) python -m build If the python executable isn't on your path, you'll have to specify the complete path, such as /usr/local/bin/python. Changelog ========= **Portio 0.6.2 released 19-Oct-2024** * Remove absolute paths and cleanup build, contributed by James Hilliard **Portio 0.6.0 released 14-Jul-2024** * Use Py_buffer instead of C strings, contributed by Stephen Horvath * Add pyproject.toml file **Portio 0.5 released 25-Oct-2012** * Porting to python 3 also contributed by Stjepan Henc . **Portio 0.4 released 25-Aug-2009** * Fixed some argument type mismatch in I/O macros. * Upgraded PyArg_ParseTuple format strings with the new "unsigned" formats available from python 2.3 . So portio now requires python version => 2.3 . **Portio 0.3 released 21-May-2009** * Fixed missing documentation files. **Portio 0.2 released 11-Nov-2008** * Added return of status code for **ioperm** and **iopl**. * Fixed invalid argument type for **ioperm**. * Updated **toggle.py** example with **ioperm** error check. * Generated documentation with Sphinx. **Portio 0.1 released 23-Feb-2006** * First release. Credits ======= * Thanks to Stjepan Henc for his contribution to python 3 porting. ---- Copyright 2006-2024 by `Fabrizio Pollastri` .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674262080.0 portio-0.6.2/_sources/toggle.py0000755000175000017500000000311114362633100016741 0ustar00fabriziofabrizio#!/usr/bin/python # .+ # # .context : PortIO # .title : Toggle parallel port lines # .kind : command shell # .author : Fabrizio Pollastri # .site : Torino - Italy # .creation : 13-Nov-2008 # .copyright : (c) 2008-2012 Fabrizio Pollastri # (c) 2012 Stjepan Henc python 3 porting. # .license : GNU General Public License (see below) # # This file is part of "PortIO, python low level I/O for Linux x86". # # PortIO is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # PortIO is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # .- import sys, time, os import portio # check for root privileges if os.getuid(): print('You need to be root! Exiting.') sys.exit() # acquire permission for I/O on lp0 status = portio.ioperm(0x378, 1, 1) if status: print('ioperm:',os.strerror(status)) sys.exit() # toggle forever the data lines of lp0 data = 0 while 1: lp0in = portio.inb(0x378) portio.outb(data,0x378) print('read %x from lp0, written %x to lp0' % (lp0in,data)) data = ~data & 0xff time.sleep(3) #### END ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1731192754.0027428 portio-0.6.2/_static/0000775000175000017500000000000014713763662014736 5ustar00fabriziofabrizio././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/_static/alabaster.css0000664000175000017500000002566114713763623017415 0ustar00fabriziofabrizio@import url("basic.css"); /* -- page layout ----------------------------------------------------------- */ body { font-family: Georgia, serif; font-size: 17px; background-color: #fff; color: #000; margin: 0; padding: 0; } div.document { width: 940px; margin: 30px auto 0 auto; } div.documentwrapper { float: left; width: 100%; } div.bodywrapper { margin: 0 0 0 220px; } div.sphinxsidebar { width: 220px; font-size: 14px; line-height: 1.5; } hr { border: 1px solid #B1B4B6; } div.body { background-color: #fff; color: #3E4349; padding: 0 30px 0 30px; } div.body > .section { text-align: left; } div.footer { width: 940px; margin: 20px auto 30px auto; font-size: 14px; color: #888; text-align: right; } div.footer a { color: #888; } p.caption { font-family: inherit; font-size: inherit; } div.relations { display: none; } div.sphinxsidebar a { color: #444; text-decoration: none; border-bottom: 1px dotted #999; } div.sphinxsidebar a:hover { border-bottom: 1px solid #999; } div.sphinxsidebarwrapper { padding: 18px 10px; } div.sphinxsidebarwrapper p.logo { padding: 0; margin: -10px 0 0 0px; text-align: center; } div.sphinxsidebarwrapper h1.logo { margin-top: -10px; text-align: center; margin-bottom: 5px; text-align: left; } div.sphinxsidebarwrapper h1.logo-name { margin-top: 0px; } div.sphinxsidebarwrapper p.blurb { margin-top: 0; font-style: normal; } div.sphinxsidebar h3, div.sphinxsidebar h4 { font-family: Georgia, serif; color: #444; font-size: 24px; font-weight: normal; margin: 0 0 5px 0; padding: 0; } div.sphinxsidebar h4 { font-size: 20px; } div.sphinxsidebar h3 a { color: #444; } div.sphinxsidebar p.logo a, div.sphinxsidebar h3 a, div.sphinxsidebar p.logo a:hover, div.sphinxsidebar h3 a:hover { border: none; } div.sphinxsidebar p { color: #555; margin: 10px 0; } div.sphinxsidebar ul { margin: 10px 0; padding: 0; color: #000; } div.sphinxsidebar ul li.toctree-l1 > a { font-size: 120%; } div.sphinxsidebar ul li.toctree-l2 > a { font-size: 110%; } div.sphinxsidebar input { border: 1px solid #CCC; font-family: Georgia, serif; font-size: 1em; } div.sphinxsidebar hr { border: none; height: 1px; color: #AAA; background: #AAA; text-align: left; margin-left: 0; width: 50%; } div.sphinxsidebar .badge { border-bottom: none; } div.sphinxsidebar .badge:hover { border-bottom: none; } /* To address an issue with donation coming after search */ div.sphinxsidebar h3.donation { margin-top: 10px; } /* -- body styles ----------------------------------------------------------- */ a { color: #004B6B; text-decoration: underline; } a:hover { color: #6D4100; text-decoration: underline; } div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { font-family: Georgia, serif; font-weight: normal; margin: 30px 0px 10px 0px; padding: 0; } div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } div.body h2 { font-size: 180%; } div.body h3 { font-size: 150%; } div.body h4 { font-size: 130%; } div.body h5 { font-size: 100%; } div.body h6 { font-size: 100%; } a.headerlink { color: #DDD; padding: 0 4px; text-decoration: none; } a.headerlink:hover { color: #444; background: #EAEAEA; } div.body p, div.body dd, div.body li { line-height: 1.4em; } div.admonition { margin: 20px 0px; padding: 10px 30px; background-color: #EEE; border: 1px solid #CCC; } div.admonition tt.xref, div.admonition code.xref, div.admonition a tt { background-color: #FBFBFB; border-bottom: 1px solid #fafafa; } div.admonition p.admonition-title { font-family: Georgia, serif; font-weight: normal; font-size: 24px; margin: 0 0 10px 0; padding: 0; line-height: 1; } div.admonition p.last { margin-bottom: 0; } div.highlight { background-color: #fff; } dt:target, .highlight { background: #FAF3E8; } div.warning { background-color: #FCC; border: 1px solid #FAA; } div.danger { background-color: #FCC; border: 1px solid #FAA; -moz-box-shadow: 2px 2px 4px #D52C2C; -webkit-box-shadow: 2px 2px 4px #D52C2C; box-shadow: 2px 2px 4px #D52C2C; } div.error { background-color: #FCC; border: 1px solid #FAA; -moz-box-shadow: 2px 2px 4px #D52C2C; -webkit-box-shadow: 2px 2px 4px #D52C2C; box-shadow: 2px 2px 4px #D52C2C; } div.caution { background-color: #FCC; border: 1px solid #FAA; } div.attention { background-color: #FCC; border: 1px solid #FAA; } div.important { background-color: #EEE; border: 1px solid #CCC; } div.note { background-color: #EEE; border: 1px solid #CCC; } div.tip { background-color: #EEE; border: 1px solid #CCC; } div.hint { background-color: #EEE; border: 1px solid #CCC; } div.seealso { background-color: #EEE; border: 1px solid #CCC; } div.topic { background-color: #EEE; } p.admonition-title { display: inline; } p.admonition-title:after { content: ":"; } pre, tt, code { font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.9em; } .hll { background-color: #FFC; margin: 0 -12px; padding: 0 12px; display: block; } img.screenshot { } tt.descname, tt.descclassname, code.descname, code.descclassname { font-size: 0.95em; } tt.descname, code.descname { padding-right: 0.08em; } img.screenshot { -moz-box-shadow: 2px 2px 4px #EEE; -webkit-box-shadow: 2px 2px 4px #EEE; box-shadow: 2px 2px 4px #EEE; } table.docutils { border: 1px solid #888; -moz-box-shadow: 2px 2px 4px #EEE; -webkit-box-shadow: 2px 2px 4px #EEE; box-shadow: 2px 2px 4px #EEE; } table.docutils td, table.docutils th { border: 1px solid #888; padding: 0.25em 0.7em; } table.field-list, table.footnote { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; } table.footnote { margin: 15px 0; width: 100%; border: 1px solid #EEE; background: #FDFDFD; font-size: 0.9em; } table.footnote + table.footnote { margin-top: -15px; border-top: none; } table.field-list th { padding: 0 0.8em 0 0; } table.field-list td { padding: 0; } table.field-list p { margin-bottom: 0.8em; } /* Cloned from * https://github.com/sphinx-doc/sphinx/commit/ef60dbfce09286b20b7385333d63a60321784e68 */ .field-name { -moz-hyphens: manual; -ms-hyphens: manual; -webkit-hyphens: manual; hyphens: manual; } table.footnote td.label { width: .1px; padding: 0.3em 0 0.3em 0.5em; } table.footnote td { padding: 0.3em 0.5em; } dl { margin: 0; padding: 0; } dl dd { margin-left: 30px; } blockquote { margin: 0 0 0 30px; padding: 0; } ul, ol { /* Matches the 30px from the narrow-screen "li > ul" selector below */ margin: 10px 0 10px 30px; padding: 0; } pre { background: #EEE; padding: 7px 30px; margin: 15px 0px; line-height: 1.3em; } div.viewcode-block:target { background: #ffd; } dl pre, blockquote pre, li pre { margin-left: 0; padding-left: 30px; } tt, code { background-color: #ecf0f3; color: #222; /* padding: 1px 2px; */ } tt.xref, code.xref, a tt { background-color: #FBFBFB; border-bottom: 1px solid #fff; } a.reference { text-decoration: none; border-bottom: 1px dotted #004B6B; } /* Don't put an underline on images */ a.image-reference, a.image-reference:hover { border-bottom: none; } a.reference:hover { border-bottom: 1px solid #6D4100; } a.footnote-reference { text-decoration: none; font-size: 0.7em; vertical-align: top; border-bottom: 1px dotted #004B6B; } a.footnote-reference:hover { border-bottom: 1px solid #6D4100; } a:hover tt, a:hover code { background: #EEE; } @media screen and (max-width: 870px) { div.sphinxsidebar { display: none; } div.document { width: 100%; } div.documentwrapper { margin-left: 0; margin-top: 0; margin-right: 0; margin-bottom: 0; } div.bodywrapper { margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; } ul { margin-left: 0; } li > ul { /* Matches the 30px from the "ul, ol" selector above */ margin-left: 30px; } .document { width: auto; } .footer { width: auto; } .bodywrapper { margin: 0; } .footer { width: auto; } .github { display: none; } } @media screen and (max-width: 875px) { body { margin: 0; padding: 20px 30px; } div.documentwrapper { float: none; background: #fff; } div.sphinxsidebar { display: block; float: none; width: 102.5%; margin: 50px -30px -20px -30px; padding: 10px 20px; background: #333; color: #FFF; } div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, div.sphinxsidebar h3 a { color: #fff; } div.sphinxsidebar a { color: #AAA; } div.sphinxsidebar p.logo { display: none; } div.document { width: 100%; margin: 0; } div.footer { display: none; } div.bodywrapper { margin: 0; } div.body { min-height: 0; padding: 0; } .rtd_doc_footer { display: none; } .document { width: auto; } .footer { width: auto; } .footer { width: auto; } .github { display: none; } } /* misc. */ .revsys-inline { display: none!important; } /* Make nested-list/multi-paragraph items look better in Releases changelog * pages. Without this, docutils' magical list fuckery causes inconsistent * formatting between different release sub-lists. */ div#changelog > div.section > ul > li > p:only-child { margin-bottom: 0; } /* Hide fugly table cell borders in ..bibliography:: directive output */ table.docutils.citation, table.docutils.citation td, table.docutils.citation th { border: none; /* Below needed in some edge cases; if not applied, bottom shadows appear */ -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; } /* relbar */ .related { line-height: 30px; width: 100%; font-size: 0.9rem; } .related.top { border-bottom: 1px solid #EEE; margin-bottom: 20px; } .related.bottom { border-top: 1px solid #EEE; } .related ul { padding: 0; margin: 0; list-style: none; } .related li { display: inline; } nav#rellinks { float: right; } nav#rellinks li+li:before { content: "|"; } nav#breadcrumbs li+li:before { content: "\00BB"; } /* Hide certain items when printing */ @media print { div.related { display: none; } }././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/_static/basic.css0000664000175000017500000003536614713763623016543 0ustar00fabriziofabrizio/* * basic.css * ~~~~~~~~~ * * Sphinx stylesheet -- basic theme. * * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /* -- main layout ----------------------------------------------------------- */ div.clearer { clear: both; } div.section::after { display: block; content: ''; clear: left; } /* -- relbar ---------------------------------------------------------------- */ div.related { width: 100%; font-size: 90%; } div.related h3 { display: none; } div.related ul { margin: 0; padding: 0 0 0 10px; list-style: none; } div.related li { display: inline; } div.related li.right { float: right; margin-right: 5px; } /* -- sidebar --------------------------------------------------------------- */ div.sphinxsidebarwrapper { padding: 10px 5px 0 10px; } div.sphinxsidebar { float: left; width: 230px; margin-left: -100%; font-size: 90%; word-wrap: break-word; overflow-wrap : break-word; } div.sphinxsidebar ul { list-style: none; } div.sphinxsidebar ul ul, div.sphinxsidebar ul.want-points { margin-left: 20px; list-style: square; } div.sphinxsidebar ul ul { margin-top: 0; margin-bottom: 0; } div.sphinxsidebar form { margin-top: 10px; } div.sphinxsidebar input { border: 1px solid #98dbcc; font-family: sans-serif; font-size: 1em; } div.sphinxsidebar #searchbox form.search { overflow: hidden; } div.sphinxsidebar #searchbox input[type="text"] { float: left; width: 80%; padding: 0.25em; box-sizing: border-box; } div.sphinxsidebar #searchbox input[type="submit"] { float: left; width: 20%; border-left: none; padding: 0.25em; box-sizing: border-box; } img { border: 0; max-width: 100%; } /* -- search page ----------------------------------------------------------- */ ul.search { margin: 10px 0 0 20px; padding: 0; } ul.search li { padding: 5px 0 5px 20px; background-image: url(file.png); background-repeat: no-repeat; background-position: 0 7px; } ul.search li a { font-weight: bold; } ul.search li p.context { color: #888; margin: 2px 0 0 30px; text-align: left; } ul.keywordmatches li.goodmatch a { font-weight: bold; } /* -- index page ------------------------------------------------------------ */ table.contentstable { width: 90%; margin-left: auto; margin-right: auto; } table.contentstable p.biglink { line-height: 150%; } a.biglink { font-size: 1.3em; } span.linkdescr { font-style: italic; padding-top: 5px; font-size: 90%; } /* -- general index --------------------------------------------------------- */ table.indextable { width: 100%; } table.indextable td { text-align: left; vertical-align: top; } table.indextable ul { margin-top: 0; margin-bottom: 0; list-style-type: none; } table.indextable > tbody > tr > td > ul { padding-left: 0em; } table.indextable tr.pcap { height: 10px; } table.indextable tr.cap { margin-top: 10px; background-color: #f2f2f2; } img.toggler { margin-right: 3px; margin-top: 3px; cursor: pointer; } div.modindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } div.genindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } /* -- domain module index --------------------------------------------------- */ table.modindextable td { padding: 2px; border-collapse: collapse; } /* -- general body styles --------------------------------------------------- */ div.body { min-width: 360px; max-width: 800px; } div.body p, div.body dd, div.body li, div.body blockquote { -moz-hyphens: auto; -ms-hyphens: auto; -webkit-hyphens: auto; hyphens: auto; } a.headerlink { visibility: hidden; } a:visited { color: #551A8B; } h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, dt:hover > a.headerlink, caption:hover > a.headerlink, p.caption:hover > a.headerlink, div.code-block-caption:hover > a.headerlink { visibility: visible; } div.body p.caption { text-align: inherit; } div.body td { text-align: left; } .first { margin-top: 0 !important; } p.rubric { margin-top: 30px; font-weight: bold; } img.align-left, figure.align-left, .figure.align-left, object.align-left { clear: left; float: left; margin-right: 1em; } img.align-right, figure.align-right, .figure.align-right, object.align-right { clear: right; float: right; margin-left: 1em; } img.align-center, figure.align-center, .figure.align-center, object.align-center { display: block; margin-left: auto; margin-right: auto; } img.align-default, figure.align-default, .figure.align-default { display: block; margin-left: auto; margin-right: auto; } .align-left { text-align: left; } .align-center { text-align: center; } .align-default { text-align: center; } .align-right { text-align: right; } /* -- sidebars -------------------------------------------------------------- */ div.sidebar, aside.sidebar { margin: 0 0 0.5em 1em; border: 1px solid #ddb; padding: 7px; background-color: #ffe; width: 40%; float: right; clear: right; overflow-x: auto; } p.sidebar-title { font-weight: bold; } nav.contents, aside.topic, div.admonition, div.topic, blockquote { clear: left; } /* -- topics ---------------------------------------------------------------- */ nav.contents, aside.topic, div.topic { border: 1px solid #ccc; padding: 7px; margin: 10px 0 10px 0; } p.topic-title { font-size: 1.1em; font-weight: bold; margin-top: 10px; } /* -- admonitions ----------------------------------------------------------- */ div.admonition { margin-top: 10px; margin-bottom: 10px; padding: 7px; } div.admonition dt { font-weight: bold; } p.admonition-title { margin: 0px 10px 5px 0px; font-weight: bold; } div.body p.centered { text-align: center; margin-top: 25px; } /* -- content of sidebars/topics/admonitions -------------------------------- */ div.sidebar > :last-child, aside.sidebar > :last-child, nav.contents > :last-child, aside.topic > :last-child, div.topic > :last-child, div.admonition > :last-child { margin-bottom: 0; } div.sidebar::after, aside.sidebar::after, nav.contents::after, aside.topic::after, div.topic::after, div.admonition::after, blockquote::after { display: block; content: ''; clear: both; } /* -- tables ---------------------------------------------------------------- */ table.docutils { margin-top: 10px; margin-bottom: 10px; border: 0; border-collapse: collapse; } table.align-center { margin-left: auto; margin-right: auto; } table.align-default { margin-left: auto; margin-right: auto; } table caption span.caption-number { font-style: italic; } table caption span.caption-text { } table.docutils td, table.docutils th { padding: 1px 8px 1px 5px; border-top: 0; border-left: 0; border-right: 0; border-bottom: 1px solid #aaa; } th { text-align: left; padding-right: 5px; } table.citation { border-left: solid 1px gray; margin-left: 1px; } table.citation td { border-bottom: none; } th > :first-child, td > :first-child { margin-top: 0px; } th > :last-child, td > :last-child { margin-bottom: 0px; } /* -- figures --------------------------------------------------------------- */ div.figure, figure { margin: 0.5em; padding: 0.5em; } div.figure p.caption, figcaption { padding: 0.3em; } div.figure p.caption span.caption-number, figcaption span.caption-number { font-style: italic; } div.figure p.caption span.caption-text, figcaption span.caption-text { } /* -- field list styles ----------------------------------------------------- */ table.field-list td, table.field-list th { border: 0 !important; } .field-list ul { margin: 0; padding-left: 1em; } .field-list p { margin: 0; } .field-name { -moz-hyphens: manual; -ms-hyphens: manual; -webkit-hyphens: manual; hyphens: manual; } /* -- hlist styles ---------------------------------------------------------- */ table.hlist { margin: 1em 0; } table.hlist td { vertical-align: top; } /* -- object description styles --------------------------------------------- */ .sig { font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; } .sig-name, code.descname { background-color: transparent; font-weight: bold; } .sig-name { font-size: 1.1em; } code.descname { font-size: 1.2em; } .sig-prename, code.descclassname { background-color: transparent; } .optional { font-size: 1.3em; } .sig-paren { font-size: larger; } .sig-param.n { font-style: italic; } /* C++ specific styling */ .sig-inline.c-texpr, .sig-inline.cpp-texpr { font-family: unset; } .sig.c .k, .sig.c .kt, .sig.cpp .k, .sig.cpp .kt { color: #0033B3; } .sig.c .m, .sig.cpp .m { color: #1750EB; } .sig.c .s, .sig.c .sc, .sig.cpp .s, .sig.cpp .sc { color: #067D17; } /* -- other body styles ----------------------------------------------------- */ ol.arabic { list-style: decimal; } ol.loweralpha { list-style: lower-alpha; } ol.upperalpha { list-style: upper-alpha; } ol.lowerroman { list-style: lower-roman; } ol.upperroman { list-style: upper-roman; } :not(li) > ol > li:first-child > :first-child, :not(li) > ul > li:first-child > :first-child { margin-top: 0px; } :not(li) > ol > li:last-child > :last-child, :not(li) > ul > li:last-child > :last-child { margin-bottom: 0px; } ol.simple ol p, ol.simple ul p, ul.simple ol p, ul.simple ul p { margin-top: 0; } ol.simple > li:not(:first-child) > p, ul.simple > li:not(:first-child) > p { margin-top: 0; } ol.simple p, ul.simple p { margin-bottom: 0; } aside.footnote > span, div.citation > span { float: left; } aside.footnote > span:last-of-type, div.citation > span:last-of-type { padding-right: 0.5em; } aside.footnote > p { margin-left: 2em; } div.citation > p { margin-left: 4em; } aside.footnote > p:last-of-type, div.citation > p:last-of-type { margin-bottom: 0em; } aside.footnote > p:last-of-type:after, div.citation > p:last-of-type:after { content: ""; clear: both; } dl.field-list { display: grid; grid-template-columns: fit-content(30%) auto; } dl.field-list > dt { font-weight: bold; word-break: break-word; padding-left: 0.5em; padding-right: 5px; } dl.field-list > dd { padding-left: 0.5em; margin-top: 0em; margin-left: 0em; margin-bottom: 0em; } dl { margin-bottom: 15px; } dd > :first-child { margin-top: 0px; } dd ul, dd table { margin-bottom: 10px; } dd { margin-top: 3px; margin-bottom: 10px; margin-left: 30px; } .sig dd { margin-top: 0px; margin-bottom: 0px; } .sig dl { margin-top: 0px; margin-bottom: 0px; } dl > dd:last-child, dl > dd:last-child > :last-child { margin-bottom: 0; } dt:target, span.highlighted { background-color: #fbe54e; } rect.highlighted { fill: #fbe54e; } dl.glossary dt { font-weight: bold; font-size: 1.1em; } .versionmodified { font-style: italic; } .system-message { background-color: #fda; padding: 5px; border: 3px solid red; } .footnote:target { background-color: #ffa; } .line-block { display: block; margin-top: 1em; margin-bottom: 1em; } .line-block .line-block { margin-top: 0; margin-bottom: 0; margin-left: 1.5em; } .guilabel, .menuselection { font-family: sans-serif; } .accelerator { text-decoration: underline; } .classifier { font-style: oblique; } .classifier:before { font-style: normal; margin: 0 0.5em; content: ":"; display: inline-block; } abbr, acronym { border-bottom: dotted 1px; cursor: help; } .translated { background-color: rgba(207, 255, 207, 0.2) } .untranslated { background-color: rgba(255, 207, 207, 0.2) } /* -- code displays --------------------------------------------------------- */ pre { overflow: auto; overflow-y: hidden; /* fixes display issues on Chrome browsers */ } pre, div[class*="highlight-"] { clear: both; } span.pre { -moz-hyphens: none; -ms-hyphens: none; -webkit-hyphens: none; hyphens: none; white-space: nowrap; } div[class*="highlight-"] { margin: 1em 0; } td.linenos pre { border: 0; background-color: transparent; color: #aaa; } table.highlighttable { display: block; } table.highlighttable tbody { display: block; } table.highlighttable tr { display: flex; } table.highlighttable td { margin: 0; padding: 0; } table.highlighttable td.linenos { padding-right: 0.5em; } table.highlighttable td.code { flex: 1; overflow: hidden; } .highlight .hll { display: block; } div.highlight pre, table.highlighttable pre { margin: 0; } div.code-block-caption + div { margin-top: 0; } div.code-block-caption { margin-top: 1em; padding: 2px 5px; font-size: small; } div.code-block-caption code { background-color: transparent; } table.highlighttable td.linenos, span.linenos, div.highlight span.gp { /* gp: Generic.Prompt */ user-select: none; -webkit-user-select: text; /* Safari fallback only */ -webkit-user-select: none; /* Chrome/Safari */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* IE10+ */ } div.code-block-caption span.caption-number { padding: 0.1em 0.3em; font-style: italic; } div.code-block-caption span.caption-text { } div.literal-block-wrapper { margin: 1em 0; } code.xref, a code { background-color: transparent; font-weight: bold; } h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { background-color: transparent; } .viewcode-link { float: right; } .viewcode-back { float: right; font-family: sans-serif; } div.viewcode-block:target { margin: -1px -10px; padding: 0 10px; } /* -- math display ---------------------------------------------------------- */ img.math { vertical-align: middle; } div.body div.math p { text-align: center; } span.eqno { float: right; } span.eqno a.headerlink { position: absolute; z-index: 1; } div.math:hover a.headerlink { visibility: visible; } /* -- printout stylesheet --------------------------------------------------- */ @media print { div.document, div.documentwrapper, div.bodywrapper { margin: 0 !important; width: 100%; } div.sphinxsidebar, div.related, div.footer, #top-link { display: none; } }././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1494874727.0 portio-0.6.2/_static/custom.css0000664000175000017500000000005213106375147016747 0ustar00fabriziofabrizio/* This file intentionally left blank. */ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1711055942.0 portio-0.6.2/_static/doctools.js0000664000175000017500000001057014577122106017113 0ustar00fabriziofabrizio/* * doctools.js * ~~~~~~~~~~~ * * Base JavaScript utilities for all Sphinx HTML documentation. * * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ "use strict"; const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ "TEXTAREA", "INPUT", "SELECT", "BUTTON", ]); const _ready = (callback) => { if (document.readyState !== "loading") { callback(); } else { document.addEventListener("DOMContentLoaded", callback); } }; /** * Small JavaScript module for the documentation. */ const Documentation = { init: () => { Documentation.initDomainIndexTable(); Documentation.initOnKeyListeners(); }, /** * i18n support */ TRANSLATIONS: {}, PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), LOCALE: "unknown", // gettext and ngettext don't access this so that the functions // can safely bound to a different name (_ = Documentation.gettext) gettext: (string) => { const translated = Documentation.TRANSLATIONS[string]; switch (typeof translated) { case "undefined": return string; // no translation case "string": return translated; // translation exists default: return translated[0]; // (singular, plural) translation tuple exists } }, ngettext: (singular, plural, n) => { const translated = Documentation.TRANSLATIONS[singular]; if (typeof translated !== "undefined") return translated[Documentation.PLURAL_EXPR(n)]; return n === 1 ? singular : plural; }, addTranslations: (catalog) => { Object.assign(Documentation.TRANSLATIONS, catalog.messages); Documentation.PLURAL_EXPR = new Function( "n", `return (${catalog.plural_expr})` ); Documentation.LOCALE = catalog.locale; }, /** * helper function to focus on search bar */ focusSearchBar: () => { document.querySelectorAll("input[name=q]")[0]?.focus(); }, /** * Initialise the domain index toggle buttons */ initDomainIndexTable: () => { const toggler = (el) => { const idNumber = el.id.substr(7); const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); if (el.src.substr(-9) === "minus.png") { el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; toggledRows.forEach((el) => (el.style.display = "none")); } else { el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; toggledRows.forEach((el) => (el.style.display = "")); } }; const togglerElements = document.querySelectorAll("img.toggler"); togglerElements.forEach((el) => el.addEventListener("click", (event) => toggler(event.currentTarget)) ); togglerElements.forEach((el) => (el.style.display = "")); if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); }, initOnKeyListeners: () => { // only install a listener if it is really needed if ( !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS ) return; document.addEventListener("keydown", (event) => { // bail for input elements if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; // bail with special keys if (event.altKey || event.ctrlKey || event.metaKey) return; if (!event.shiftKey) { switch (event.key) { case "ArrowLeft": if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; const prevLink = document.querySelector('link[rel="prev"]'); if (prevLink && prevLink.href) { window.location.href = prevLink.href; event.preventDefault(); } break; case "ArrowRight": if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; const nextLink = document.querySelector('link[rel="next"]'); if (nextLink && nextLink.href) { window.location.href = nextLink.href; event.preventDefault(); } break; } } // some keyboard layouts may need Shift to get / switch (event.key) { case "/": if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; Documentation.focusSearchBar(); event.preventDefault(); } }); }, }; // quick alias for translations const _ = Documentation.gettext; _ready(Documentation.init); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/_static/documentation_options.js0000664000175000017500000000051014713763623021711 0ustar00fabriziofabrizioconst DOCUMENTATION_OPTIONS = { VERSION: '0.6.2', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', FILE_SUFFIX: '.html', LINK_SUFFIX: '.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '.txt', NAVIGATION_WITH_KEYS: false, SHOW_SEARCH_SUMMARY: true, ENABLE_SEARCH_SHORTCUTS: true, };././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1711055942.0 portio-0.6.2/_static/file.png0000664000175000017500000000043614577122106016354 0ustar00fabriziofabrizioPNG  IHDRaIDATxR){l ۶f=@ :3~箄rX$AX-D ~ lj(P%8<<9:: PO&$ l~X&EW^4wQ}^ͣ i0/H/@F)Dzq+j[SU5h/oY G&Lfs|{3%U+S`AFIENDB`././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1623615940.0 portio-0.6.2/_static/forkme_right_darkblue_121621.png0000664000175000017500000001126314061464704022603 0ustar00fabriziofabrizioPNG  IHDRQOzIDATx왃,QEmcڶm?lχ=~K}:v$g+UBNq $|sFgr $nU4OSA+!1 Ǭ+( d?8Ϙ&!T) dgY^Ye/O/Qw8Y7bZ?A5oRc @!b @An6\DK[;UrhqeFɦ'4@fcRHp\b' K\5<6G='>! ʁXEO+* ֧`Y=n9F,䥱E#w [eT D Xk8B?4Ų 7Rzx_XB;XbB,cb^ \: ̐Us#k,ՂxNV$zQޜ|k$Ujm*BGãsdXHue([g", P )ci0a-Z!R\0M?K 7ʺ>꩐e5$ORK,xɋTyE hzvZ;E2H{V:lWw֢YjlSd,XcEj_`Hv,Wd ^,yhtbA_X$/7bfUnT K l O$$~`R}#`S}" ս*Vɡ: ")e9%f-3>ffff&1338bĒ')tXF}z˞UK̬YT(?k ǧ6#;zJ&7!7;eq΁*bfÞ'+zŬС1 kgß4¥Dh Ҭջ}OXU,XCkLޓ,5T>/5ZȖ /E?նL:#Q"ϜF5+8啕CGN**X@dVd|Pf,G9"VAukJ9D3.\~[Edh1[ŕ/2/%n`VxClWS=2M8K̲OAy`): n\G=T (ޝڼmʳ,k׾&TRX5';7w>+T`Mmhܸ!`aρɠ/\oGREXT J4j׾ .S8T`!DY `Y8 6O_gAc X2z+}PX!`fV (_=4S9!6+񧍭e%+T%B;TѳBn$#D[/4iB?W6C kI`4 J4W,^DB_W ]c YE2ԞBkz2f%1ͻC, (4eМ K>eJa-҉ptP>ȀƝEeNKE6ހ<#B6D`qa/ U`c=((9PVgK}M)L` P 'Wnf= qT[ JEwӃZ`KiLAF,jwpA 5}S$ݪDw7B*,N%+X LEUف4Ч:T`YwRd+ ,,5Jd Płe݉[w hkN, hW*xvs$AMA` 7ist2 X @io{wz*LA X;1dx+(\ZCRP%;qy;3k3t"i S*6cwbs*QRhB$`K٫v {b+%2qbjq'.#5p3n^t_k/yׂ![ nB;T`Yw;y2~E~;8T`YwbfX{X|=>nf-UwVAP%Z3!ۣ4 *kh]:[)oW?CpVh܉+Zo(Az+|ue5JѼ;T`݉dRo/GqTv6ʣ?jrl L5]Jf Płe܉-Q &cW9N7Z߮ˡ˺kVhjsQAJ{YFI0nmF]$npbw >A2cRXҬ.fR8T˺37XcgTCU0 c@ XJd63DH%:~ϡJ2+BYCҐk*T7u!e?{"߮Ya"+4`q pC_QgQ5)d=|Jbd2(Tu'f>^!˩%= cQ:g-ݞհމ%&|d =5dћ2~? *˸{]N%C ({RԌP CA)}V} % *˸3+ KnX (*5`=skk̢ˡZ r'.ʀ2Fl5)FvenO}37s"t+MA2GMuѯNgԧ=k"2A`^˺ԅoۭ_Tu'yKǎtZ3U7t4+x|8XP9X֝B٧NjBew*Wޭ;qh*~Ⱦ!MzxPBS1)I%O@Eg)k.p0 /Sиd^{.cVt)Ln +0 b։_.1 -9}7 VkRL} XvX?ubP(>@@GA@:1QP(/~bub@,NSrXfT~N|O|lƮ:qT~^/~b׉_'`ͬ'`ubP,NFA:10 var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 var s_v = "^(" + C + ")?" + v; // vowel in stem this.stemWord = function (w) { var stem; var suffix; var firstch; var origword = w; if (w.length < 3) return w; var re; var re2; var re3; var re4; firstch = w.substr(0,1); if (firstch == "y") w = firstch.toUpperCase() + w.substr(1); // Step 1a re = /^(.+?)(ss|i)es$/; re2 = /^(.+?)([^s])s$/; if (re.test(w)) w = w.replace(re,"$1$2"); else if (re2.test(w)) w = w.replace(re2,"$1$2"); // Step 1b re = /^(.+?)eed$/; re2 = /^(.+?)(ed|ing)$/; if (re.test(w)) { var fp = re.exec(w); re = new RegExp(mgr0); if (re.test(fp[1])) { re = /.$/; w = w.replace(re,""); } } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1]; re2 = new RegExp(s_v); if (re2.test(stem)) { w = stem; re2 = /(at|bl|iz)$/; re3 = new RegExp("([^aeiouylsz])\\1$"); re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re2.test(w)) w = w + "e"; else if (re3.test(w)) { re = /.$/; w = w.replace(re,""); } else if (re4.test(w)) w = w + "e"; } } // Step 1c re = /^(.+?)y$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(s_v); if (re.test(stem)) w = stem + "i"; } // Step 2 re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step2list[suffix]; } // Step 3 re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step3list[suffix]; } // Step 4 re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; re2 = /^(.+?)(s|t)(ion)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); if (re.test(stem)) w = stem; } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1] + fp[2]; re2 = new RegExp(mgr1); if (re2.test(stem)) w = stem; } // Step 5 re = /^(.+?)e$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); re2 = new RegExp(meq1); re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) w = stem; } re = /ll$/; re2 = new RegExp(mgr1); if (re.test(w) && re2.test(w)) { re = /.$/; w = w.replace(re,""); } // and turn initial Y back to y if (firstch == "y") w = firstch.toLowerCase() + w.substr(1); return w; } } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1711055942.0 portio-0.6.2/_static/minus.png0000664000175000017500000000013214577122106016561 0ustar00fabriziofabrizioPNG  IHDR (!IDATxc8 g>@;(!&]f2nNIENDB`././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1711055942.0 portio-0.6.2/_static/plus.png0000664000175000017500000000013214577122106016411 0ustar00fabriziofabrizioPNG  IHDR (!IDATxc8 g>@;([[U @l-!a@IENDB`././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/_static/pygments.css0000664000175000017500000001150114713763623017311 0ustar00fabriziofabriziopre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight { background: #eeffcc; } .highlight .c { color: #408090; font-style: italic } /* Comment */ .highlight .err { border: 1px solid #FF0000 } /* Error */ .highlight .k { color: #007020; font-weight: bold } /* Keyword */ .highlight .o { color: #666666 } /* Operator */ .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ .highlight .cp { color: #007020 } /* Comment.Preproc */ .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #A00000 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #FF0000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #00A000 } /* Generic.Inserted */ .highlight .go { color: #333333 } /* Generic.Output */ .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ .highlight .gt { color: #0044DD } /* Generic.Traceback */ .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #007020 } /* Keyword.Pseudo */ .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #902000 } /* Keyword.Type */ .highlight .m { color: #208050 } /* Literal.Number */ .highlight .s { color: #4070a0 } /* Literal.String */ .highlight .na { color: #4070a0 } /* Name.Attribute */ .highlight .nb { color: #007020 } /* Name.Builtin */ .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ .highlight .no { color: #60add5 } /* Name.Constant */ .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ .highlight .ne { color: #007020 } /* Name.Exception */ .highlight .nf { color: #06287e } /* Name.Function */ .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #bb60d5 } /* Name.Variable */ .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #208050 } /* Literal.Number.Bin */ .highlight .mf { color: #208050 } /* Literal.Number.Float */ .highlight .mh { color: #208050 } /* Literal.Number.Hex */ .highlight .mi { color: #208050 } /* Literal.Number.Integer */ .highlight .mo { color: #208050 } /* Literal.Number.Oct */ .highlight .sa { color: #4070a0 } /* Literal.String.Affix */ .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ .highlight .sc { color: #4070a0 } /* Literal.String.Char */ .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ .highlight .sx { color: #c65d09 } /* Literal.String.Other */ .highlight .sr { color: #235388 } /* Literal.String.Regex */ .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ .highlight .ss { color: #517918 } /* Literal.String.Symbol */ .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #06287e } /* Name.Function.Magic */ .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1711055942.0 portio-0.6.2/_static/searchtools.js0000664000175000017500000004476314577122106017626 0ustar00fabriziofabrizio/* * searchtools.js * ~~~~~~~~~~~~~~~~ * * Sphinx JavaScript utilities for the full-text search. * * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ "use strict"; /** * Simple result scoring code. */ if (typeof Scorer === "undefined") { var Scorer = { // Implement the following function to further tweak the score for each result // The function takes a result array [docname, title, anchor, descr, score, filename] // and returns the new score. /* score: result => { const [docname, title, anchor, descr, score, filename] = result return score }, */ // query matches the full name of an object objNameMatch: 11, // or matches in the last dotted part of the object name objPartialMatch: 6, // Additive scores depending on the priority of the object objPrio: { 0: 15, // used to be importantResults 1: 5, // used to be objectResults 2: -5, // used to be unimportantResults }, // Used when the priority is not in the mapping. objPrioDefault: 0, // query found in title title: 15, partialTitle: 7, // query found in terms term: 5, partialTerm: 2, }; } const _removeChildren = (element) => { while (element && element.lastChild) element.removeChild(element.lastChild); }; /** * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping */ const _escapeRegExp = (string) => string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string const _displayItem = (item, searchTerms, highlightTerms) => { const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; const contentRoot = document.documentElement.dataset.content_root ?? DOCUMENTATION_OPTIONS.URL_ROOT; const [docName, title, anchor, descr, score, _filename] = item; let listItem = document.createElement("li"); let requestUrl; let linkUrl; if (docBuilder === "dirhtml") { // dirhtml builder let dirname = docName + "/"; if (dirname.match(/\/index\/$/)) dirname = dirname.substring(0, dirname.length - 6); else if (dirname === "index/") dirname = ""; requestUrl = contentRoot + dirname; linkUrl = requestUrl; } else { // normal html builders requestUrl = contentRoot + docName + docFileSuffix; linkUrl = docName + docLinkSuffix; } let linkEl = listItem.appendChild(document.createElement("a")); linkEl.href = linkUrl + anchor; linkEl.dataset.score = score; linkEl.innerHTML = title; if (descr) { listItem.appendChild(document.createElement("span")).innerHTML = " (" + descr + ")"; // highlight search terms in the description if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); } else if (showSearchSummary) fetch(requestUrl) .then((responseData) => responseData.text()) .then((data) => { if (data) listItem.appendChild( Search.makeSearchSummary(data, searchTerms) ); // highlight search terms in the summary if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); }); Search.output.appendChild(listItem); }; const _finishSearch = (resultCount) => { Search.stopPulse(); Search.title.innerText = _("Search Results"); if (!resultCount) Search.status.innerText = Documentation.gettext( "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." ); else Search.status.innerText = _( `Search finished, found ${resultCount} page(s) matching the search query.` ); }; const _displayNextItem = ( results, resultCount, searchTerms, highlightTerms, ) => { // results left, load the summary and display it // this is intended to be dynamic (don't sub resultsCount) if (results.length) { _displayItem(results.pop(), searchTerms, highlightTerms); setTimeout( () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), 5 ); } // search finished, update title and status message else _finishSearch(resultCount); }; /** * Default splitQuery function. Can be overridden in ``sphinx.search`` with a * custom function per language. * * The regular expression works by splitting the string on consecutive characters * that are not Unicode letters, numbers, underscores, or emoji characters. * This is the same as ``\W+`` in Python, preserving the surrogate pair area. */ if (typeof splitQuery === "undefined") { var splitQuery = (query) => query .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) .filter(term => term) // remove remaining empty strings } /** * Search Module */ const Search = { _index: null, _queued_query: null, _pulse_status: -1, htmlToText: (htmlString) => { const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() }); const docContent = htmlElement.querySelector('[role="main"]'); if (docContent !== undefined) return docContent.textContent; console.warn( "Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template." ); return ""; }, init: () => { const query = new URLSearchParams(window.location.search).get("q"); document .querySelectorAll('input[name="q"]') .forEach((el) => (el.value = query)); if (query) Search.performSearch(query); }, loadIndex: (url) => (document.body.appendChild(document.createElement("script")).src = url), setIndex: (index) => { Search._index = index; if (Search._queued_query !== null) { const query = Search._queued_query; Search._queued_query = null; Search.query(query); } }, hasIndex: () => Search._index !== null, deferQuery: (query) => (Search._queued_query = query), stopPulse: () => (Search._pulse_status = -1), startPulse: () => { if (Search._pulse_status >= 0) return; const pulse = () => { Search._pulse_status = (Search._pulse_status + 1) % 4; Search.dots.innerText = ".".repeat(Search._pulse_status); if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); }; pulse(); }, /** * perform a search for something (or wait until index is loaded) */ performSearch: (query) => { // create the required interface elements const searchText = document.createElement("h2"); searchText.textContent = _("Searching"); const searchSummary = document.createElement("p"); searchSummary.classList.add("search-summary"); searchSummary.innerText = ""; const searchList = document.createElement("ul"); searchList.classList.add("search"); const out = document.getElementById("search-results"); Search.title = out.appendChild(searchText); Search.dots = Search.title.appendChild(document.createElement("span")); Search.status = out.appendChild(searchSummary); Search.output = out.appendChild(searchList); const searchProgress = document.getElementById("search-progress"); // Some themes don't use the search progress node if (searchProgress) { searchProgress.innerText = _("Preparing search..."); } Search.startPulse(); // index already loaded, the browser was quick! if (Search.hasIndex()) Search.query(query); else Search.deferQuery(query); }, /** * execute search (requires search index to be loaded) */ query: (query) => { const filenames = Search._index.filenames; const docNames = Search._index.docnames; const titles = Search._index.titles; const allTitles = Search._index.alltitles; const indexEntries = Search._index.indexentries; // stem the search terms and add them to the correct list const stemmer = new Stemmer(); const searchTerms = new Set(); const excludedTerms = new Set(); const highlightTerms = new Set(); const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); splitQuery(query.trim()).forEach((queryTerm) => { const queryTermLower = queryTerm.toLowerCase(); // maybe skip this "word" // stopwords array is from language_data.js if ( stopwords.indexOf(queryTermLower) !== -1 || queryTerm.match(/^\d+$/) ) return; // stem the word let word = stemmer.stemWord(queryTermLower); // select the correct list if (word[0] === "-") excludedTerms.add(word.substr(1)); else { searchTerms.add(word); highlightTerms.add(queryTermLower); } }); if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) } // console.debug("SEARCH: searching for:"); // console.info("required: ", [...searchTerms]); // console.info("excluded: ", [...excludedTerms]); // array of [docname, title, anchor, descr, score, filename] let results = []; _removeChildren(document.getElementById("search-progress")); const queryLower = query.toLowerCase(); for (const [title, foundTitles] of Object.entries(allTitles)) { if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) { for (const [file, id] of foundTitles) { let score = Math.round(100 * queryLower.length / title.length) results.push([ docNames[file], titles[file] !== title ? `${titles[file]} > ${title}` : title, id !== null ? "#" + id : "", null, score, filenames[file], ]); } } } // search for explicit entries in index directives for (const [entry, foundEntries] of Object.entries(indexEntries)) { if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { for (const [file, id] of foundEntries) { let score = Math.round(100 * queryLower.length / entry.length) results.push([ docNames[file], titles[file], id ? "#" + id : "", null, score, filenames[file], ]); } } } // lookup as object objectTerms.forEach((term) => results.push(...Search.performObjectSearch(term, objectTerms)) ); // lookup as search terms in fulltext results.push(...Search.performTermsSearch(searchTerms, excludedTerms)); // let the scorer override scores with a custom scoring function if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item))); // now sort the results by score (in opposite order of appearance, since the // display function below uses pop() to retrieve items) and then // alphabetically results.sort((a, b) => { const leftScore = a[4]; const rightScore = b[4]; if (leftScore === rightScore) { // same score: sort alphabetically const leftTitle = a[1].toLowerCase(); const rightTitle = b[1].toLowerCase(); if (leftTitle === rightTitle) return 0; return leftTitle > rightTitle ? -1 : 1; // inverted is intentional } return leftScore > rightScore ? 1 : -1; }); // remove duplicate search results // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept let seen = new Set(); results = results.reverse().reduce((acc, result) => { let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); if (!seen.has(resultStr)) { acc.push(result); seen.add(resultStr); } return acc; }, []); results = results.reverse(); // for debugging //Search.lastresults = results.slice(); // a copy // console.info("search results:", Search.lastresults); // print the results _displayNextItem(results, results.length, searchTerms, highlightTerms); }, /** * search for object names */ performObjectSearch: (object, objectTerms) => { const filenames = Search._index.filenames; const docNames = Search._index.docnames; const objects = Search._index.objects; const objNames = Search._index.objnames; const titles = Search._index.titles; const results = []; const objectSearchCallback = (prefix, match) => { const name = match[4] const fullname = (prefix ? prefix + "." : "") + name; const fullnameLower = fullname.toLowerCase(); if (fullnameLower.indexOf(object) < 0) return; let score = 0; const parts = fullnameLower.split("."); // check for different match types: exact matches of full name or // "last name" (i.e. last dotted part) if (fullnameLower === object || parts.slice(-1)[0] === object) score += Scorer.objNameMatch; else if (parts.slice(-1)[0].indexOf(object) > -1) score += Scorer.objPartialMatch; // matches in last name const objName = objNames[match[1]][2]; const title = titles[match[0]]; // If more than one term searched for, we require other words to be // found in the name/title/description const otherTerms = new Set(objectTerms); otherTerms.delete(object); if (otherTerms.size > 0) { const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); if ( [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) ) return; } let anchor = match[3]; if (anchor === "") anchor = fullname; else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; const descr = objName + _(", in ") + title; // add custom score for some objects according to scorer if (Scorer.objPrio.hasOwnProperty(match[2])) score += Scorer.objPrio[match[2]]; else score += Scorer.objPrioDefault; results.push([ docNames[match[0]], fullname, "#" + anchor, descr, score, filenames[match[0]], ]); }; Object.keys(objects).forEach((prefix) => { if (!(objects[prefix] instanceof Array)) { objects[prefix] = Object.entries(objects[prefix]).map(([name, match]) => [...match, name]); } objects[prefix].forEach((array) => objectSearchCallback(prefix, array) ); }); return results; }, /** * search for full-text terms in the index */ performTermsSearch: (searchTerms, excludedTerms) => { // prepare search const terms = Search._index.terms; const titleTerms = Search._index.titleterms; const filenames = Search._index.filenames; const docNames = Search._index.docnames; const titles = Search._index.titles; const scoreMap = new Map(); const fileMap = new Map(); // perform the search on the required terms searchTerms.forEach((word) => { const files = []; const arr = [ { files: terms[word], score: Scorer.term }, { files: titleTerms[word], score: Scorer.title }, ]; // add support for partial matches if (word.length > 2) { const escapedWord = _escapeRegExp(word); Object.keys(terms).forEach((term) => { if (term.match(escapedWord) && !terms[word]) arr.push({ files: terms[term], score: Scorer.partialTerm }); }); Object.keys(titleTerms).forEach((term) => { if (term.match(escapedWord) && !titleTerms[word]) arr.push({ files: titleTerms[word], score: Scorer.partialTitle }); }); } // no match but word was a required one if (arr.every((record) => record.files === undefined)) return; // found search word in contents arr.forEach((record) => { if (record.files === undefined) return; let recordFiles = record.files; if (recordFiles.length === undefined) recordFiles = [recordFiles]; files.push(...recordFiles); // set score for the word in each file recordFiles.forEach((file) => { if (!scoreMap.has(file)) scoreMap.set(file, {}); scoreMap.get(file)[word] = record.score; }); }); // create the mapping files.forEach((file) => { if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word); else fileMap.set(file, [word]); }); }); // now check if the files don't contain excluded terms const results = []; for (const [file, wordList] of fileMap) { // check if all requirements are matched // as search terms with length < 3 are discarded const filteredTermCount = [...searchTerms].filter( (term) => term.length > 2 ).length; if ( wordList.length !== searchTerms.size && wordList.length !== filteredTermCount ) continue; // ensure that none of the excluded terms is in the search result if ( [...excludedTerms].some( (term) => terms[term] === file || titleTerms[term] === file || (terms[term] || []).includes(file) || (titleTerms[term] || []).includes(file) ) ) break; // select one (max) score for the file. const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); // add result to the result list results.push([ docNames[file], titles[file], "", null, score, filenames[file], ]); } return results; }, /** * helper function to return a node containing the * search summary for a given text. keywords is a list * of stemmed words. */ makeSearchSummary: (htmlText, keywords) => { const text = Search.htmlToText(htmlText); if (text === "") return null; const textLower = text.toLowerCase(); const actualStartPosition = [...keywords] .map((k) => textLower.indexOf(k.toLowerCase())) .filter((i) => i > -1) .slice(-1)[0]; const startWithContext = Math.max(actualStartPosition - 120, 0); const top = startWithContext === 0 ? "" : "..."; const tail = startWithContext + 240 < text.length ? "..." : ""; let summary = document.createElement("p"); summary.classList.add("context"); summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; return summary; }, }; _ready(Search.init); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1711055942.0 portio-0.6.2/_static/sphinx_highlight.js0000664000175000017500000001200314577122106020616 0ustar00fabriziofabrizio/* Highlighting utilities for Sphinx HTML documentation. */ "use strict"; const SPHINX_HIGHLIGHT_ENABLED = true /** * highlight a given string on a node by wrapping it in * span elements with the given class name. */ const _highlight = (node, addItems, text, className) => { if (node.nodeType === Node.TEXT_NODE) { const val = node.nodeValue; const parent = node.parentNode; const pos = val.toLowerCase().indexOf(text); if ( pos >= 0 && !parent.classList.contains(className) && !parent.classList.contains("nohighlight") ) { let span; const closestNode = parent.closest("body, svg, foreignObject"); const isInSVG = closestNode && closestNode.matches("svg"); if (isInSVG) { span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); } else { span = document.createElement("span"); span.classList.add(className); } span.appendChild(document.createTextNode(val.substr(pos, text.length))); const rest = document.createTextNode(val.substr(pos + text.length)); parent.insertBefore( span, parent.insertBefore( rest, node.nextSibling ) ); node.nodeValue = val.substr(0, pos); /* There may be more occurrences of search term in this node. So call this * function recursively on the remaining fragment. */ _highlight(rest, addItems, text, className); if (isInSVG) { const rect = document.createElementNS( "http://www.w3.org/2000/svg", "rect" ); const bbox = parent.getBBox(); rect.x.baseVal.value = bbox.x; rect.y.baseVal.value = bbox.y; rect.width.baseVal.value = bbox.width; rect.height.baseVal.value = bbox.height; rect.setAttribute("class", className); addItems.push({ parent: parent, target: rect }); } } } else if (node.matches && !node.matches("button, select, textarea")) { node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); } }; const _highlightText = (thisNode, text, className) => { let addItems = []; _highlight(thisNode, addItems, text, className); addItems.forEach((obj) => obj.parent.insertAdjacentElement("beforebegin", obj.target) ); }; /** * Small JavaScript module for the documentation. */ const SphinxHighlight = { /** * highlight the search words provided in localstorage in the text */ highlightSearchWords: () => { if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight // get and clear terms from localstorage const url = new URL(window.location); const highlight = localStorage.getItem("sphinx_highlight_terms") || url.searchParams.get("highlight") || ""; localStorage.removeItem("sphinx_highlight_terms") url.searchParams.delete("highlight"); window.history.replaceState({}, "", url); // get individual terms from highlight string const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); if (terms.length === 0) return; // nothing to do // There should never be more than one element matching "div.body" const divBody = document.querySelectorAll("div.body"); const body = divBody.length ? divBody[0] : document.querySelector("body"); window.setTimeout(() => { terms.forEach((term) => _highlightText(body, term, "highlighted")); }, 10); const searchBox = document.getElementById("searchbox"); if (searchBox === null) return; searchBox.appendChild( document .createRange() .createContextualFragment( '" ) ); }, /** * helper function to hide the search marks again */ hideSearchWords: () => { document .querySelectorAll("#searchbox .highlight-link") .forEach((el) => el.remove()); document .querySelectorAll("span.highlighted") .forEach((el) => el.classList.remove("highlighted")); localStorage.removeItem("sphinx_highlight_terms") }, initEscapeListener: () => { // only install a listener if it is really needed if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; document.addEventListener("keydown", (event) => { // bail for input elements if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; // bail with special keys if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { SphinxHighlight.hideSearchWords(); event.preventDefault(); } }); }, }; _ready(() => { /* Do not call highlightSearchWords() when we are on the search page. * It will highlight words from the *previous* search query. */ if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); SphinxHighlight.initEscapeListener(); }); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729370671.0 portio-0.6.2/build_dist.sh0000775000175000017500000000251414705015057015760 0ustar00fabriziofabrizio#!/bin/sh # .+ # # .context : PortIO # .title : Build PortIO distibution # .kind : command shell # .author : Fabrizio Pollastri # .site : Torino - Italy # .creation : 13-Nov-2008 # .copyright : (c) 2009 Fabrizio Pollastri # .license : GNU General Public License (see below) # # This file is part of "PortIO, python low level I/O for Linux x86". # # PortIO is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # PortIO is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # .- # cleanup make clean rm -rf build rm -rf dist rm *.html rm -rf _static _sources rm -rf tmp # build html pages cp README.rst index.rst make html mv .build/html/* . # build python source distribution echo "building python distribution ... " cp -p toggle.py _sources python3 setup.py -q sdist mv dist/*.gz . echo "Done" #### END ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192169.0 portio-0.6.2/conf.py0000644000175000017500000001317714713762551014612 0ustar00fabriziofabrizio# -*- coding: utf-8 -*- # # PortIO documentation build configuration file, created by # sphinx-quickstart on Tue Nov 11 13:20:32 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable (module imports are okay, they're removed automatically). # # All configuration values have a default value; values that are commented out # serve to show the default value. import sys, os # If your extensions are in another directory, add it here. If the directory # is relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. #sys.path.append(os.path.abspath('some/directory')) # General configuration # --------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [] # Add any paths that contain templates here, relative to this directory. templates_path = ['.templates'] # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General substitutions. project = 'PortIO' copyright = '2006-2024, Fabrizio Pollastri' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. # # The short X.Y version. version = '0.6.2' # The full version, including alpha/beta/rc tags. release = '0.6.2' # 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 documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directories, that shouldn't be searched # for source files. #exclude_dirs = [] # 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' # Options for HTML output # ----------------------- # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. html_style = 'default.css' # 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 (within the static path) 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'] # 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_use_modindex = 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, the reST sources are included in the HTML build as _sources/. #html_copy_source = 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 = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'PortIOdoc' # Options for LaTeX output # ------------------------ # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). latex_documents = [ ('index', 'PortIO.tex', 'PortIO Documentation', 'Fabrizio Pollastri', '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 # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True # FP20241109: remove paragraph symbols at end of titles. html_permalinks = False ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/genindex.html0000664000175000017500000000450314713763623015776 0ustar00fabriziofabrizio Index — PortIO 0.6.2 documentation

Index

././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/index.html0000664000175000017500000003314514713763623015310 0ustar00fabriziofabrizio PortIO, python low level port I/O for Linux x86 — PortIO 0.6.2 documentation

PortIO, python low level port I/O for Linux x86

What is

PortIO is a Python wrapper for the port I/O macros like outb, inb, etc. provided by the C library on Linux x86 platforms. Both python 2 and 3 are supported. This module is useful when a general pourpose port I/O at the low level is needed. Programmers that want to perform I/O on the parallel port at an higher level, will be better satisfied by the pyParallel module. A similar module Ioport has inspired the writing of PortIO.

PortIO is released under the GNU General Public License.

At present, version 0.6.2, PortIO is in beta status. Any debugging aid is welcome.

For any question, suggestion, contribution contact the author Fabrizio Pollastri <mxgbot_a_t_gmail.com>.

The PortIO web site is hosted at http://portio.inrim.it/.

Usage example

This sample program toggle on and off all the data lines of the parallel port lp0 with a 6 seconds period. Note the check for root privileges before the call to ioperm to acquire the proper I/O permissions for the involved ports.

Download the sample program toggle.py

Module reference

PortIO is a Python front end to the low level functions provided by the C library on Linux 386 platforms for the hardware input and output ports: outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw, inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl.

Before doing port I/O, it is mandatory to acquire proper privileges by calling ioperm or iopl. Otherwise you will get a segmentation fault.

outb (data,port)

Output the byte data to the I/O address port.

outb_p (data,port)

The same as outb, but waits for I/O completion.

outw (data,port)

Output the 16 bit word data to the I/O address port.

outw_p (data,port)

The same as outw, but waits for I/O completion.

outl (data,port)

Output the 32 bit word data to the I/O address port.

outl_p (data,port)

The same as outl, but waits for I/O completion.

outsb (port,data,count)

Repeat count times the output of a byte to the I/O address port, reading it from buffer of bytes starting at data and with length count.

outsw (port,data,count)

Repeat count times the output of a 16 bit word to the I/O address port, reading it from buffer of 16 bit words starting at data and with length count x 2.

outsl (port,data,count)

Repeat count times the output of a 32 bit word to the I/O address port, reading it from buffer of 32 bit words starting at data and with length count x 4.

inb (port)

Input a byte from the I/O address port and return it as integer.

inb_p (port)

The same as inb, but waits for I/O completion.

inw (port)

Input a 16 bit word from the I/O address port and return it as integer.

inw_p (port)

The same as inw, but waits for I/O completion.

inl (port)

Input a 32 bit word from the I/O address port and return it as integer.

inl_p (port)

The same as inl, but waits for I/O completion.

insb (port,data,count)

Repeat count times the input of a byte from the I/O address port and write it to a buffer of bytes starting at data and with length count bytes.

insw (port,data,count)

Repeat count times the input of a 16 bit word from the I/O address port and write it to a buffer of 16 bit words starting at data and with length count x 2 bytes.

insl (port,data,count)

Repeat count times the input of a 32 bit word from the I/O address port and write it to a buffer of 32 bit words starting at data and with length count x 4 bytes.

ioperm (from,extent,enable)

Set port access permission starting from address from for extent bytes. If the enable is True, access is enabled, otherwise is disabled. On success, zero is returned. On error, the errno code is returned. The use of ioperm requires root privileges.

Only the first 0x3ff I/O ports can be specified in this manner. To gain access to any I/O port in the whole (0x0000-0xffff) address range, use the iopl function.

iopl (level)

Set the I/O privilege level of the current process. When level is 3 access is granted to any I/O port. On success, zero is returned. On error, the errno code is returned. The use of iopl requires root privileges.

Requirements

A linux on an X86 architecture.

To run the code, Python 2.6 or later or Python 3.0 or later must already be installed. The latest release is recommended. Python is available from http://www.python.org/.

Installation

With easy_install

  1. Open a shell.

  2. Get root privileges and install the package. Command:

    easy_install portio
    

From tarball

Download PortIO tarball from http://portio.inrim.it/portio-0.6.2.tar.gz .

The first step is to expand the .tgz archive in a temporary directory (not directly in Python’s site-packages). It contains a distutils setup file “setup.py”.

  1. Open a shell.

  2. Unpack the tarball in a temporary directory (not directly in Python’s site-packages). Command:

    tar zxf portio-X.Y.Z.tar.gz
    

    X and Y are the major and minor version numbers of the tarball.

  1. Go to the directory created by expanding the tarball. Command:

    cd portio-X.Y.Z
    
  2. Get root privileges and install the package. Command:

    su
    (enter root password)
    python -m build
    

    If the python executable isn’t on your path, you’ll have to specify the complete path, such as /usr/local/bin/python.

Changelog

Portio 0.6.2 released 19-Oct-2024

  • Remove absolute paths and cleanup build, contributed by James Hilliard <james.hilliard1_a_t_gmail.com>

Portio 0.6.0 released 14-Jul-2024

  • Use Py_buffer instead of C strings, contributed by Stephen Horvath <me_a_t_stevetech.au>

  • Add pyproject.toml file

Portio 0.5 released 25-Oct-2012

  • Porting to python 3 also contributed by Stjepan Henc <sthenc_a_t_gmail.com>.

Portio 0.4 released 25-Aug-2009

  • Fixed some argument type mismatch in I/O macros.

  • Upgraded PyArg_ParseTuple format strings with the new “unsigned” formats available from python 2.3 . So portio now requires python version => 2.3 .

Portio 0.3 released 21-May-2009

  • Fixed missing documentation files.

Portio 0.2 released 11-Nov-2008

  • Added return of status code for ioperm and iopl.

  • Fixed invalid argument type for ioperm.

  • Updated toggle.py example with ioperm error check.

  • Generated documentation with Sphinx.

Portio 0.1 released 23-Feb-2006

  • First release.

Credits

  • Thanks to Stjepan Henc <sthenc_a_t_gmail.com> for his contribution to python 3 porting.


Copyright 2006-2024 by Fabrizio Pollastri <mxgbot_a_t_gmail.com>

././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/index.rst0000644000175000017500000001640214713763623015147 0ustar00fabriziofabrizio ================================================ PortIO, python low level port I/O for Linux x86 ================================================ What is ======= PortIO is a Python wrapper for the port I/O macros like **outb, inb**, etc. provided by the C library on Linux x86 platforms. Both python 2 and 3 are supported. This module is useful when a general pourpose port I/O at the low level is needed. Programmers that want to perform I/O on the parallel port at an higher level, will be better satisfied by the `pyParallel `_ module. A similar module Ioport has inspired the writing of PortIO. .. now is broken `Ioport `_ PortIO is released under the `GNU General Public License `_. *At present, version 0.6.2, PortIO is in beta status. Any debugging aid is welcome.* For any question, suggestion, contribution contact the author `Fabrizio Pollastri` . The PortIO web site is hosted at http://portio.inrim.it/. Usage example ============= This sample program toggle on and off all the data lines of the parallel port lp0 with a 6 seconds period. Note the check for root privileges before the call to **ioperm** to acquire the proper I/O permissions for the involved ports. Download the sample program `toggle.py <./toggle.py>`_ Module reference ================ PortIO is a Python front end to the low level functions provided by the C library on Linux 386 platforms for the hardware input and output ports: **outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw, inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl**. Before doing port I/O, it is mandatory to acquire proper privileges by calling **ioperm** or **iopl**. Otherwise you will get a segmentation fault. **outb (data,port)** Output the byte **data** to the I/O address **port**. **outb_p (data,port)** The same as **outb**, but waits for I/O completion. **outw (data,port)** Output the 16 bit word **data** to the I/O address **port**. **outw_p (data,port)** The same as **outw**, but waits for I/O completion. **outl (data,port)** Output the 32 bit word **data** to the I/O address **port**. **outl_p (data,port)** The same as **outl**, but waits for I/O completion. **outsb (port,data,count)** Repeat **count** times the output of a byte to the I/O address **port**, reading it from buffer of bytes starting at **data** and with length **count**. **outsw (port,data,count)** Repeat **count** times the output of a 16 bit word to the I/O address **port**, reading it from buffer of 16 bit words starting at **data** and with length **count** x 2. **outsl (port,data,count)** Repeat **count** times the output of a 32 bit word to the I/O address **port**, reading it from buffer of 32 bit words starting at **data** and with length **count** x 4. **inb (port)** Input a byte from the I/O address **port** and return it as integer. **inb_p (port)** The same as **inb**, but waits for I/O completion. **inw (port)** Input a 16 bit word from the I/O address **port** and return it as integer. **inw_p (port)** The same as **inw**, but waits for I/O completion. **inl (port)** Input a 32 bit word from the I/O address **port** and return it as integer. **inl_p (port)** The same as **inl**, but waits for I/O completion. **insb (port,data,count)** Repeat **count** times the input of a byte from the I/O address **port** and write it to a buffer of bytes starting at **data** and with length **count** bytes. **insw (port,data,count)** Repeat **count** times the input of a 16 bit word from the I/O address **port** and write it to a buffer of 16 bit words starting at **data** and with length **count** x 2 bytes. **insl (port,data,count)** Repeat **count** times the input of a 32 bit word from the I/O address **port** and write it to a buffer of 32 bit words starting at **data** and with length **count** x 4 bytes. **ioperm (from,extent,enable)** Set port access permission starting from address **from** for **extent** bytes. If the **enable** is True, access is enabled, otherwise is disabled. On success, zero is returned. On error, the errno code is returned. The use of ioperm requires root privileges. Only the first 0x3ff I/O ports can be specified in this manner. To gain access to any I/O port in the whole (0x0000-0xffff) address range, use the iopl function. **iopl (level)** Set the I/O privilege level of the current process. When **level** is 3 access is granted to any I/O port. On success, zero is returned. On error, the errno code is returned. The use of iopl requires root privileges. Requirements ============ A **linux on an X86 architecture**. To run the code, **Python 2.6 or later** or **Python 3.0 or later** must already be installed. The latest release is recommended. Python is available from http://www.python.org/. Installation ============ With easy_install ----------------- 1. Open a shell. 2. Get root privileges and install the package. Command: :: easy_install portio From tarball ------------ Download PortIO tarball from http://portio.inrim.it/portio-0.6.2.tar.gz . The first step is to expand the ``.tgz`` archive in a temporary directory (**not** directly in Python's ``site-packages``). It contains a distutils setup file "setup.py". 1. Open a shell. 2. Unpack the tarball in a temporary directory (**not** directly in Python's ``site-packages``). Command: :: tar zxf portio-X.Y.Z.tar.gz X and Y are the major and minor version numbers of the tarball. 2. Go to the directory created by expanding the tarball. Command: :: cd portio-X.Y.Z 3. Get root privileges and install the package. Command: :: su (enter root password) python -m build If the python executable isn't on your path, you'll have to specify the complete path, such as /usr/local/bin/python. Changelog ========= **Portio 0.6.2 released 19-Oct-2024** * Remove absolute paths and cleanup build, contributed by James Hilliard **Portio 0.6.0 released 14-Jul-2024** * Use Py_buffer instead of C strings, contributed by Stephen Horvath * Add pyproject.toml file **Portio 0.5 released 25-Oct-2012** * Porting to python 3 also contributed by Stjepan Henc . **Portio 0.4 released 25-Aug-2009** * Fixed some argument type mismatch in I/O macros. * Upgraded PyArg_ParseTuple format strings with the new "unsigned" formats available from python 2.3 . So portio now requires python version => 2.3 . **Portio 0.3 released 21-May-2009** * Fixed missing documentation files. **Portio 0.2 released 11-Nov-2008** * Added return of status code for **ioperm** and **iopl**. * Fixed invalid argument type for **ioperm**. * Updated **toggle.py** example with **ioperm** error check. * Generated documentation with Sphinx. **Portio 0.1 released 23-Feb-2006** * First release. Credits ======= * Thanks to Stjepan Henc for his contribution to python 3 porting. ---- Copyright 2006-2024 by `Fabrizio Pollastri` .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1720693662.0 portio-0.6.2/portio.c0000664000175000017500000002664314643731636015001 0ustar00fabriziofabrizio/* .+ .identifier : $Id$ .context : portio python extension .title : distutils setup .kind : python source .author : Fabrizio Pollastri .site : Torino - Italy .creation : 16-Feb-2006 .copyright : (c) 2006-2012 Fabrizio Pollastri (c) 2012 Stjepan Henc python 3 porting. .license : GNU General Public License (see .copying below) .copying This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA .- */ #include "Python.h" #include static PyObject *pio_outb(PyObject *self,PyObject *args) { unsigned char data; unsigned short int port; if (!PyArg_ParseTuple(args,"BH",&data,&port)) return NULL; outb(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outw(PyObject *self,PyObject *args) { unsigned short int data; unsigned short int port; if (!PyArg_ParseTuple(args,"HH",&data,&port)) return NULL; outw(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outl(PyObject *self,PyObject *args) { unsigned int data; unsigned short int port; if (!PyArg_ParseTuple(args,"IH",&data,&port)) return NULL; outl(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outb_p(PyObject *self,PyObject *args) { unsigned char data; unsigned short int port; if (!PyArg_ParseTuple(args,"BH",&data,&port)) return NULL; outb_p(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outw_p(PyObject *self,PyObject *args) { unsigned short int data; unsigned short int port; if (!PyArg_ParseTuple(args,"HH",&data,&port)) return NULL; outw_p(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outl_p(PyObject *self,PyObject *args) { unsigned int data; unsigned short int port; if (!PyArg_ParseTuple(args,"IH",&data,&port)) return NULL; outl_p(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outsb(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; outsb(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outsw(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; outsw(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outsl(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; outsl(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_inb(PyObject *self,PyObject *args) { unsigned short int port; unsigned char data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inb(port); return Py_BuildValue("B",data); } static PyObject *pio_inw(PyObject *self,PyObject *args) { unsigned short int port; unsigned short int data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inw(port); return Py_BuildValue("H",data); } static PyObject *pio_inl(PyObject *self,PyObject *args) { unsigned short int port; unsigned int data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inl(port); return Py_BuildValue("I",data); } static PyObject *pio_inb_p(PyObject *self,PyObject *args) { unsigned short int port; unsigned char data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inb_p(port); return Py_BuildValue("B",data); } static PyObject *pio_inw_p(PyObject *self,PyObject *args) { unsigned short int port; unsigned short int data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inw_p(port); return Py_BuildValue("H",data); } static PyObject *pio_inl_p(PyObject *self,PyObject *args) { unsigned short int port; unsigned int data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inl_p(port); return Py_BuildValue("I",data); } static PyObject *pio_insb(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; insb(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_insw(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; insw(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_insl(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; insl(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_ioperm(PyObject *self,PyObject *args) { unsigned long int from; unsigned long int extent; int enable; int status; if (!PyArg_ParseTuple(args,"kki",&from,&extent,&enable)) return NULL; status = ioperm(from,extent,enable); if (status) status = errno; return Py_BuildValue("i",status); } static PyObject *pio_iopl(PyObject *self,PyObject *args) { int level; int status; if (!PyArg_ParseTuple(args,"i",&level)) return NULL; status = iopl(level); if (status) status = errno; return Py_BuildValue("i",status); } /* List of methods defined in the module */ static struct PyMethodDef methods[] = { {"outb",(PyCFunction)pio_outb,METH_VARARGS,NULL}, {"outw",(PyCFunction)pio_outw,METH_VARARGS,NULL}, {"outl",(PyCFunction)pio_outl,METH_VARARGS,NULL}, {"outb_p",(PyCFunction)pio_outb_p,METH_VARARGS,NULL}, {"outw_p",(PyCFunction)pio_outw_p,METH_VARARGS,NULL}, {"outl_p",(PyCFunction)pio_outl_p,METH_VARARGS,NULL}, {"outsb",(PyCFunction)pio_outsb,METH_VARARGS,NULL}, {"outsw",(PyCFunction)pio_outsw,METH_VARARGS,NULL}, {"outsl",(PyCFunction)pio_outsl,METH_VARARGS,NULL}, {"inb",(PyCFunction)pio_inb,METH_VARARGS,NULL}, {"inw",(PyCFunction)pio_inw,METH_VARARGS,NULL}, {"inl",(PyCFunction)pio_inl,METH_VARARGS,NULL}, {"inb_p",(PyCFunction)pio_inb_p,METH_VARARGS,NULL}, {"inw_p",(PyCFunction)pio_inw_p,METH_VARARGS,NULL}, {"inl_p",(PyCFunction)pio_inl_p,METH_VARARGS,NULL}, {"insb",(PyCFunction)pio_insb,METH_VARARGS,NULL}, {"insw",(PyCFunction)pio_insw,METH_VARARGS,NULL}, {"insl",(PyCFunction)pio_insl,METH_VARARGS,NULL}, {"ioperm",(PyCFunction)pio_ioperm,METH_VARARGS,NULL}, {"iopl",(PyCFunction)pio_iopl,METH_VARARGS,NULL}, {NULL, (PyCFunction)NULL, 0, NULL} }; /* module init function */ static char documentation[] =" PortIO, python low level port I/O for Linux x86\n\ \n\ PortIO is a Python front end to the low level functions provided by the\n\ C library on Linux 386 platforms for the hardware input and output ports:\n\ outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw,\n\ inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl.\n\ \n\ Before doing port I/O, it is mandatory to acquire proper privileges by\n\ calling ioperm or iopl. Otherwise you will get a segmentation fault.\n\ \n\ outb (data,port)\n\ Output the byte data to the I/O address port.\n\ \n\ outb_p (data,port)\n\ The same as outb, but waits for I/O completion.\n\ \n\ outw (data,port)\n\ Output the 16 bit word data to the I/O address port.\n\ \n\ outw_p (data,port)\n\ The same as outw, but waits for I/O completion.\n\ \n\ outl (data,port)\n\ Output the 32 bit word data to the I/O address port.\n\ \n\ outl_p (data,port)\n\ The same as outl, but waits for I/O completion.\n\ \n\ outsb (port,data,count)\n\ Repeat count times the output of a single byte to the I/O address port,\n\ reading it from buffer of bytes starting at data and with length\n\ count.\n\ \n\ outsw (port,data,count)\n\ Repeat count times the output of a single 16 bit word to the I/O address\n\ port, reading it from buffer of 16 bit words starting at data and\n\ with length count x 2.\n\ \n\ outsl (port,data,count)\n\ Repeat count times the output of a single 32 bit word to the I/O address\n\ port, reading it from buffer of 32 bit words starting at data and\n\ with length count x 4.\n\ \n\ inb (port)\n\ Input a byte from the I/O address port and return it as integer.\n\ \n\ inb_p (port)\n\ The same as inb, but waits for I/O completion.\n\ \n\ inw (port)\n\ Input a 16 bit word from the I/O address port and return it as integer.\n\ \n\ inw_p (port)\n\ The same as inw, but waits for I/O completion.\n\ \n\ inl (port)\n\ Input a 32 bit word from the I/O address port and return it as integer.\n\ \n\ inl_p (port)\n\ The same as inl, but waits for I/O completion.\n\ \n\ insb (port,data,count)\n\ Repeat count times the input of a single byte from the I/O address port\n\ and write it to a buffer of bytes starting at data and with length\n\ count bytes.\n\ \n\ insw (port,data,count)\n\ Repeat count times the input of a single 16 bit word from the I/O address\n\ port and write it to a buffer of 16 bit words starting at data\n\ and with length count x 2 bytes.\n\ \n\ insl (port,data,count)\n\ Repeat count times the input of a single 32 bit word from the I/O address\n\ port and write it to a buffer of 32 bit words starting at data\n\ and with length count x 4 bytes.\n\ \n\ ioperm (from,extent,enable)\n\ Set port access permission starting from address from for extent\n\ bytes. If the enable is True, access is enabled, otherwise is disabled.\n\ On success, zero is returned. On error, the errno code is returned.\n\ The use of ioperm requires root privileges.\n\ \n\ Only the first 0x3ff I/O ports can be specified in this manner. To gain\n\ access to any I/O port in the whole (0x0000-0xffff) address range, use\n\ the iopl function. \n\ \n\ iopl (level)\n\ Set the I/O privilege level of the current process. When level is 3\n\ access is granted to any I/O port.\n\ On success, zero is returned. On error, the errno code is returned.\n\ The use of iopl requires root privileges.\n\ \n\ "; /* module init for both python < 3.0 and >= 3.0 */ static PyObject *Error; #if PY_MAJOR_VERSION < 3 /* is python < 3.0 */ PyMODINIT_FUNC initportio(void) { PyObject *m; m = Py_InitModule3("portio", methods, documentation); if(m == NULL) return; /* add module specific exception */ Error = PyErr_NewException("portio.error", NULL, NULL); Py_INCREF(Error); PyModule_AddObject(m, "error", Error); } #else /* is python >= 3.0 */ static struct PyModuleDef portiomodule = { PyModuleDef_HEAD_INIT, "portio", documentation, -1, methods }; PyMODINIT_FUNC PyInit_portio(void) { PyObject *m; m = PyModule_Create(&portiomodule); if(m == NULL) return NULL; /* add module specific exception */ Error = PyErr_NewException("portio.error", NULL, NULL); Py_INCREF(Error); PyModule_AddObject(m, "error", Error); return m; } #endif /* end */ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1720693662.0 portio-0.6.2/portio.c.in0000664000175000017500000002010314643731636015367 0ustar00fabriziofabrizio/* .+ .identifier : $Id$ .context : portio python extension .title : distutils setup .kind : python source .author : Fabrizio Pollastri .site : Torino - Italy .creation : 16-Feb-2006 .copyright : (c) 2006-2012 Fabrizio Pollastri (c) 2012 Stjepan Henc python 3 porting. .license : GNU General Public License (see .copying below) .copying This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA .- */ #include "Python.h" #include static PyObject *pio_outb(PyObject *self,PyObject *args) { unsigned char data; unsigned short int port; if (!PyArg_ParseTuple(args,"BH",&data,&port)) return NULL; outb(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outw(PyObject *self,PyObject *args) { unsigned short int data; unsigned short int port; if (!PyArg_ParseTuple(args,"HH",&data,&port)) return NULL; outw(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outl(PyObject *self,PyObject *args) { unsigned int data; unsigned short int port; if (!PyArg_ParseTuple(args,"IH",&data,&port)) return NULL; outl(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outb_p(PyObject *self,PyObject *args) { unsigned char data; unsigned short int port; if (!PyArg_ParseTuple(args,"BH",&data,&port)) return NULL; outb_p(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outw_p(PyObject *self,PyObject *args) { unsigned short int data; unsigned short int port; if (!PyArg_ParseTuple(args,"HH",&data,&port)) return NULL; outw_p(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outl_p(PyObject *self,PyObject *args) { unsigned int data; unsigned short int port; if (!PyArg_ParseTuple(args,"IH",&data,&port)) return NULL; outl_p(data,port); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outsb(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; outsb(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outsw(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; outsw(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_outsl(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; outsl(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_inb(PyObject *self,PyObject *args) { unsigned short int port; unsigned char data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inb(port); return Py_BuildValue("B",data); } static PyObject *pio_inw(PyObject *self,PyObject *args) { unsigned short int port; unsigned short int data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inw(port); return Py_BuildValue("H",data); } static PyObject *pio_inl(PyObject *self,PyObject *args) { unsigned short int port; unsigned int data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inl(port); return Py_BuildValue("I",data); } static PyObject *pio_inb_p(PyObject *self,PyObject *args) { unsigned short int port; unsigned char data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inb_p(port); return Py_BuildValue("B",data); } static PyObject *pio_inw_p(PyObject *self,PyObject *args) { unsigned short int port; unsigned short int data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inw_p(port); return Py_BuildValue("H",data); } static PyObject *pio_inl_p(PyObject *self,PyObject *args) { unsigned short int port; unsigned int data; if (!PyArg_ParseTuple(args,"H",&port)) return NULL; data = inl_p(port); return Py_BuildValue("I",data); } static PyObject *pio_insb(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; insb(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_insw(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; insw(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_insl(PyObject *self,PyObject *args) { unsigned short int port; Py_buffer string; unsigned long int count; if (!PyArg_ParseTuple(args,"Hs*k",&port,&string,&count)) return NULL; insl(port,string.buf,count); Py_INCREF(Py_None); return Py_None; } static PyObject *pio_ioperm(PyObject *self,PyObject *args) { unsigned long int from; unsigned long int extent; int enable; int status; if (!PyArg_ParseTuple(args,"kki",&from,&extent,&enable)) return NULL; status = ioperm(from,extent,enable); if (status) status = errno; return Py_BuildValue("i",status); } static PyObject *pio_iopl(PyObject *self,PyObject *args) { int level; int status; if (!PyArg_ParseTuple(args,"i",&level)) return NULL; status = iopl(level); if (status) status = errno; return Py_BuildValue("i",status); } /* List of methods defined in the module */ static struct PyMethodDef methods[] = { {"outb",(PyCFunction)pio_outb,METH_VARARGS,NULL}, {"outw",(PyCFunction)pio_outw,METH_VARARGS,NULL}, {"outl",(PyCFunction)pio_outl,METH_VARARGS,NULL}, {"outb_p",(PyCFunction)pio_outb_p,METH_VARARGS,NULL}, {"outw_p",(PyCFunction)pio_outw_p,METH_VARARGS,NULL}, {"outl_p",(PyCFunction)pio_outl_p,METH_VARARGS,NULL}, {"outsb",(PyCFunction)pio_outsb,METH_VARARGS,NULL}, {"outsw",(PyCFunction)pio_outsw,METH_VARARGS,NULL}, {"outsl",(PyCFunction)pio_outsl,METH_VARARGS,NULL}, {"inb",(PyCFunction)pio_inb,METH_VARARGS,NULL}, {"inw",(PyCFunction)pio_inw,METH_VARARGS,NULL}, {"inl",(PyCFunction)pio_inl,METH_VARARGS,NULL}, {"inb_p",(PyCFunction)pio_inb_p,METH_VARARGS,NULL}, {"inw_p",(PyCFunction)pio_inw_p,METH_VARARGS,NULL}, {"inl_p",(PyCFunction)pio_inl_p,METH_VARARGS,NULL}, {"insb",(PyCFunction)pio_insb,METH_VARARGS,NULL}, {"insw",(PyCFunction)pio_insw,METH_VARARGS,NULL}, {"insl",(PyCFunction)pio_insl,METH_VARARGS,NULL}, {"ioperm",(PyCFunction)pio_ioperm,METH_VARARGS,NULL}, {"iopl",(PyCFunction)pio_iopl,METH_VARARGS,NULL}, {NULL, (PyCFunction)NULL, 0, NULL} }; /* module init function */ static char documentation[] ="%(DOCUMENTATION)s"; /* module init for both python < 3.0 and >= 3.0 */ static PyObject *Error; #if PY_MAJOR_VERSION < 3 /* is python < 3.0 */ PyMODINIT_FUNC initportio(void) { PyObject *m; m = Py_InitModule3("portio", methods, documentation); if(m == NULL) return; /* add module specific exception */ Error = PyErr_NewException("portio.error", NULL, NULL); Py_INCREF(Error); PyModule_AddObject(m, "error", Error); } #else /* is python >= 3.0 */ static struct PyModuleDef portiomodule = { PyModuleDef_HEAD_INIT, "portio", documentation, -1, methods }; PyMODINIT_FUNC PyInit_portio(void) { PyObject *m; m = PyModule_Create(&portiomodule); if(m == NULL) return NULL; /* add module specific exception */ Error = PyErr_NewException("portio.error", NULL, NULL); Py_INCREF(Error); PyModule_AddObject(m, "error", Error); return m; } #endif /* end */ ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1731192754.0037427 portio-0.6.2/portio.egg-info/0000775000175000017500000000000014713763662016316 5ustar00fabriziofabrizio././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192753.0 portio-0.6.2/portio.egg-info/PKG-INFO0000644000175000017500000002041414713763661017411 0ustar00fabriziofabrizioMetadata-Version: 2.1 Name: portio Version: 0.6.2 Summary: PortIO, python low level port I/O for Linux x86 Home-page: http://portio.inrim.it Author: Fabrizio Pollastri Author-email: Fabrizio Pollastri License: LGPL Project-URL: Documentation, https://github.com/fabriziop/portio#readme Project-URL: Issues, https://github.com/fabriziop/portio/issues Project-URL: Source, https://github.com/fabriziop/portio Platform: Linux Classifier: Development Status :: 4 - Beta Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=2.8 Description-Content-Type: text/x-rst ================================================ PortIO, python low level port I/O for Linux x86 ================================================ What is ======= PortIO is a Python wrapper for the port I/O macros like **outb, inb**, etc. provided by the C library on Linux x86 platforms. Both python 2 and 3 are supported. This module is useful when a general pourpose port I/O at the low level is needed. Programmers that want to perform I/O on the parallel port at an higher level, will be better satisfied by the `pyParallel `_ module. A similar module Ioport has inspired the writing of PortIO. .. now is broken `Ioport `_ PortIO is released under the `GNU General Public License `_. *At present, version 0.6.2, PortIO is in beta status. Any debugging aid is welcome.* For any question, suggestion, contribution contact the author `Fabrizio Pollastri` . The PortIO web site is hosted at http://portio.inrim.it/. Usage example ============= This sample program toggle on and off all the data lines of the parallel port lp0 with a 6 seconds period. Note the check for root privileges before the call to **ioperm** to acquire the proper I/O permissions for the involved ports. Download the sample program `toggle.py <./toggle.py>`_ Module reference ================ PortIO is a Python front end to the low level functions provided by the C library on Linux 386 platforms for the hardware input and output ports: **outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw, inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl**. Before doing port I/O, it is mandatory to acquire proper privileges by calling **ioperm** or **iopl**. Otherwise you will get a segmentation fault. **outb (data,port)** Output the byte **data** to the I/O address **port**. **outb_p (data,port)** The same as **outb**, but waits for I/O completion. **outw (data,port)** Output the 16 bit word **data** to the I/O address **port**. **outw_p (data,port)** The same as **outw**, but waits for I/O completion. **outl (data,port)** Output the 32 bit word **data** to the I/O address **port**. **outl_p (data,port)** The same as **outl**, but waits for I/O completion. **outsb (port,data,count)** Repeat **count** times the output of a byte to the I/O address **port**, reading it from buffer of bytes starting at **data** and with length **count**. **outsw (port,data,count)** Repeat **count** times the output of a 16 bit word to the I/O address **port**, reading it from buffer of 16 bit words starting at **data** and with length **count** x 2. **outsl (port,data,count)** Repeat **count** times the output of a 32 bit word to the I/O address **port**, reading it from buffer of 32 bit words starting at **data** and with length **count** x 4. **inb (port)** Input a byte from the I/O address **port** and return it as integer. **inb_p (port)** The same as **inb**, but waits for I/O completion. **inw (port)** Input a 16 bit word from the I/O address **port** and return it as integer. **inw_p (port)** The same as **inw**, but waits for I/O completion. **inl (port)** Input a 32 bit word from the I/O address **port** and return it as integer. **inl_p (port)** The same as **inl**, but waits for I/O completion. **insb (port,data,count)** Repeat **count** times the input of a byte from the I/O address **port** and write it to a buffer of bytes starting at **data** and with length **count** bytes. **insw (port,data,count)** Repeat **count** times the input of a 16 bit word from the I/O address **port** and write it to a buffer of 16 bit words starting at **data** and with length **count** x 2 bytes. **insl (port,data,count)** Repeat **count** times the input of a 32 bit word from the I/O address **port** and write it to a buffer of 32 bit words starting at **data** and with length **count** x 4 bytes. **ioperm (from,extent,enable)** Set port access permission starting from address **from** for **extent** bytes. If the **enable** is True, access is enabled, otherwise is disabled. On success, zero is returned. On error, the errno code is returned. The use of ioperm requires root privileges. Only the first 0x3ff I/O ports can be specified in this manner. To gain access to any I/O port in the whole (0x0000-0xffff) address range, use the iopl function. **iopl (level)** Set the I/O privilege level of the current process. When **level** is 3 access is granted to any I/O port. On success, zero is returned. On error, the errno code is returned. The use of iopl requires root privileges. Requirements ============ A **linux on an X86 architecture**. To run the code, **Python 2.6 or later** or **Python 3.0 or later** must already be installed. The latest release is recommended. Python is available from http://www.python.org/. Installation ============ With easy_install ----------------- 1. Open a shell. 2. Get root privileges and install the package. Command: :: easy_install portio From tarball ------------ Download PortIO tarball from http://portio.inrim.it/portio-0.6.2.tar.gz . The first step is to expand the ``.tgz`` archive in a temporary directory (**not** directly in Python's ``site-packages``). It contains a distutils setup file "setup.py". 1. Open a shell. 2. Unpack the tarball in a temporary directory (**not** directly in Python's ``site-packages``). Command: :: tar zxf portio-X.Y.Z.tar.gz X and Y are the major and minor version numbers of the tarball. 2. Go to the directory created by expanding the tarball. Command: :: cd portio-X.Y.Z 3. Get root privileges and install the package. Command: :: su (enter root password) python -m build If the python executable isn't on your path, you'll have to specify the complete path, such as /usr/local/bin/python. Changelog ========= **Portio 0.6.2 released 19-Oct-2024** * Remove absolute paths and cleanup build, contributed by James Hilliard **Portio 0.6.0 released 14-Jul-2024** * Use Py_buffer instead of C strings, contributed by Stephen Horvath * Add pyproject.toml file **Portio 0.5 released 25-Oct-2012** * Porting to python 3 also contributed by Stjepan Henc . **Portio 0.4 released 25-Aug-2009** * Fixed some argument type mismatch in I/O macros. * Upgraded PyArg_ParseTuple format strings with the new "unsigned" formats available from python 2.3 . So portio now requires python version => 2.3 . **Portio 0.3 released 21-May-2009** * Fixed missing documentation files. **Portio 0.2 released 11-Nov-2008** * Added return of status code for **ioperm** and **iopl**. * Fixed invalid argument type for **ioperm**. * Updated **toggle.py** example with **ioperm** error check. * Generated documentation with Sphinx. **Portio 0.1 released 23-Feb-2006** * First release. Credits ======= * Thanks to Stjepan Henc for his contribution to python 3 porting. ---- Copyright 2006-2024 by `Fabrizio Pollastri` .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192753.0 portio-0.6.2/portio.egg-info/SOURCES.txt0000664000175000017500000000121714713763661020202 0ustar00fabriziofabrizioMANIFEST.in Makefile README.html README.rst build_dist.sh conf.py genindex.html index.html index.rst portio.c portio.c.in pyproject.toml search.html setup.py toggle.py _sources/README.rst.txt _sources/index.rst.txt _sources/toggle.py _static/alabaster.css _static/basic.css _static/custom.css _static/doctools.js _static/documentation_options.js _static/file.png _static/forkme_right_darkblue_121621.png _static/language_data.js _static/minus.png _static/plus.png _static/pygments.css _static/searchtools.js _static/sphinx_highlight.js portio.egg-info/PKG-INFO portio.egg-info/SOURCES.txt portio.egg-info/dependency_links.txt portio.egg-info/top_level.txt././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192753.0 portio-0.6.2/portio.egg-info/dependency_links.txt0000664000175000017500000000000114713763661022363 0ustar00fabriziofabrizio ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192753.0 portio-0.6.2/portio.egg-info/top_level.txt0000664000175000017500000000002314713763661021042 0ustar00fabriziofabrizioconf portio toggle ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729370671.0 portio-0.6.2/pyproject.toml0000664000175000017500000000273014705015057016213 0ustar00fabriziofabrizio[build-system] requires = ["setuptools","setuptools_scm"] build-backend = "setuptools.build_meta" [project] name = "portio" dynamic = ["version","readme"] description = "PortIO, python low level port I/O for Linux x86" requires-python = ">=2.8" license = {text = "LGPL"} keywords = [] authors = [ { name = "Fabrizio Pollastri", email = "mxgbot@gmail.com" }, ] classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] dependencies = [] [project.urls] Documentation = "https://github.com/fabriziop/portio#readme" Issues = "https://github.com/fabriziop/portio/issues" Source = "https://github.com/fabriziop/portio" [tool.coverage.run] source_pkgs = ["portio"] branch = true parallel = true omit = [ "src/temporary/__about__.py", ] [tool.coverage.paths] portio = ["*/portio"] [tool.coverage.report] exclude_lines = [ "no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:", ] [tool.setuptools.dynamic] readme = {file = "README.rst"} [tool.setuptools] py-modules = ["conf","toggle"] [tool.setuptools_scm] git_describe_command = ["git","describe","--tags"] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1731192723.0 portio-0.6.2/search.html0000664000175000017500000000513014713763623015437 0ustar00fabriziofabrizio Search — PortIO 0.6.2 documentation

Search

Searching for multiple words only shows matches that contain all words.

././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1731192754.0037427 portio-0.6.2/setup.cfg0000664000175000017500000000004614713763662015131 0ustar00fabriziofabrizio[egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729371684.0 portio-0.6.2/setup.py0000775000175000017500000000670614705017044015021 0ustar00fabriziofabrizio#!/usr/bin/env python3 # .+ # # .context : portio python extension # .title : distutils setup # .kind : python source # .author : Fabrizio Pollastri # .site : Torino - Italy # .creation : 16-Feb-2006 # .copyright : (c) 2006-2024 Fabrizio Pollastri # (c) 2012 Stjepan Henc python 3 porting. # .license : GNU General Public License (see .copying below) # # .copying # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # .- from setuptools import setup, Extension import os import os.path import re import sys classifiers = """\ Development Status :: 4 - Beta Intended Audience :: Developers License :: OSI Approved :: GNU General Public License (GPL) Programming Language :: Python Programming Language :: Python :: 3 Topic :: System :: Hardware Topic :: Software Development :: Libraries :: Python Modules Operating System :: POSIX :: Linux """ # check for proper python version if sys.version < '3.0': print('\nportio 0.6.2 requires python >= 3.0 , found python', \ sys.version.split()[0], ', exiting...') sys.exit() readme = open('README.rst').read() # read in documentation file readme = readme.replace('**','') # remove restructuredtext markup # split documentation by text titles and put each title and its text body # into a dictionary: title is the key, text body is the value. readme_split = re.split('\n(.*?)\n====+?\n\n',readme) i = 3 readme_db = {} while i < len(readme_split): readme_db[readme_split[i]] = readme_split[i + 1] i += 2 main_title = readme_split[1] + '\n' # main title goes alone # if not present, generate portio.c source file. # Replace template tag "DOCUMENTATION" into C source with documentation # text read from README. Add backslash iand new line at end of each line # (C multiline string syntax). if not os.path.exists('portio.c'): doc = main_title + '\n' + readme_db["Module reference"] doc = doc.replace('\n','\\n\\\n') source = open('portio.c.in').read() source = source % {'DOCUMENTATION':doc} open('portio.c','w').write(source) # if not present, generate toggle.py source file extracting it from README if not os.path.exists('toggle.py'): source = readme_db["Usage example"] source = source.split('::')[1] print(source) module = Extension( 'portio', define_macros = [('MAJOR_VERSION', '0'),('MINOR_VERSION', '5')], libraries = [], sources = ['portio.c']) setup ( name = 'portio', author = 'Fabrizio Pollastri', author_email = 'mxgbot@gmail.com', url = 'http://portio.inrim.it', license = 'http://www.gnu.org/licenses/gpl.txt', platforms = ['Linux'], description = main_title, classifiers = [line for line in filter(None, classifiers.split("\n"))], long_description = readme_db["Module reference"], ext_modules = [module]) # cleanup try: os.remove('MANIFEST') except: pass #### END ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1674262080.0 portio-0.6.2/toggle.py0000755000175000017500000000311114362633100015117 0ustar00fabriziofabrizio#!/usr/bin/python # .+ # # .context : PortIO # .title : Toggle parallel port lines # .kind : command shell # .author : Fabrizio Pollastri # .site : Torino - Italy # .creation : 13-Nov-2008 # .copyright : (c) 2008-2012 Fabrizio Pollastri # (c) 2012 Stjepan Henc python 3 porting. # .license : GNU General Public License (see below) # # This file is part of "PortIO, python low level I/O for Linux x86". # # PortIO is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # PortIO is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # .- import sys, time, os import portio # check for root privileges if os.getuid(): print('You need to be root! Exiting.') sys.exit() # acquire permission for I/O on lp0 status = portio.ioperm(0x378, 1, 1) if status: print('ioperm:',os.strerror(status)) sys.exit() # toggle forever the data lines of lp0 data = 0 while 1: lp0in = portio.inb(0x378) portio.outb(data,0x378) print('read %x from lp0, written %x to lp0' % (lp0in,data)) data = ~data & 0xff time.sleep(3) #### END