.. _features: ======== Features ======== .. meta:: :description: Unicon features :keywords: unicon, features .. Modified: 2018-10-23/05:37-0400 btiffin .. Copyright 2016 Brian Tiffin .. This file is part of the Unicon Programming document .. GPL 3.0+ :ref:`license` .. image:: images/unicon.png :align: center .. only:: html :ref:`genindex` :floatright:`Unicon` .. index:: features Unicon features =============== Unicon is a feature rich environment. This chapter deals with some of the more *miscellaneous* components included in Unicon that are not detailed in other sections. .. index:: keyboard .. _keyboard: Keyboard functions .................. Unicon supports keyboard scanning outside normal standard IO operation support. This allows for pending key tests, unbuffered input (no Enter key required) and other niceties. :c:func:`kbhit` checks if there is a keyboard character waiting to be read. :c:func:`getch` reads a key (and will wait if needed) without echo to screen. :c:func:`getche` reads a key (and will wait if needed) with echo to screen. .. literalinclude:: examples/keyboarding.icn :language: unicon :start-after: ##+ .. only:: html .. rst-class:: rightalign :download:`examples/keyboarding.icn` Sample run: .. command-output:: unicon -s keyboarding.icn -x :cwd: examples -------- .. index:: pty, pseudo terminals .. _pseudo terminal: Pseudo terminals ................ Qutaiba Mahmoud added support for pseudo terminals in Unicon when attaining his Master's Degree in Computer Science, outlined in a report hosted along with the Unicon Technical Reports, at http://www2.cs.uidaho.edu/~jeffery/unicon/reports/mahmoud.pdf Basically, a file stream is opened with mode :unicon:`"prw"`, which gives a Unicon master terminal program asynchronous read and write access to another interactive process. This feature is similar to the capabilities provided in the famous `Expect` `Tcl/Tk` extension by Don Libes. .. todo:: add pty sample -------- .. index:: libz, compression .. _libz: libz compression ................ Compression can be used in Unicon file operations, and is also supported in the compiler for compressed `icode` generation, if ``libz`` is available during Unicon build. :command:`unicon -Z program.icn` will produce a compressed ``icode`` file. It will be automatically uncompressed at runtime, *assuming support is included in the current VM when invoked*. Programmers can also use this feature with the :unicon:`"z"` mode modifier of the `open` function. Compressed data is not line oriented, so use `reads` and `writes`. .. literalinclude:: examples/gzio.icn :language: unicon :start-after: ##+ .. only:: html .. rst-class:: rightalign :download:`examples/gzio.icn` Sample run: .. command-output:: unicon -s gzio.icn -x :cwd: examples .. only:: html .. -------- :ref:`genindex` | Previous: :doc:`threading` | Next: :doc:`documentation` |