Notes

Index Unicon

ABI

Application Binary Interface. A low level operating environment (chip and OS) specification detailing how call frames are expected to be handled when invoking subroutines; in terms of order of arguments and burden of cleanup being on caller or callee, to name a few of the issues involved.

C compiler tool chains eventually resolve to a platform specific binary form appropriate for the operating system and hardware. This ABI is what allows machine code to integrate assembler and other high level languages with an operating system. Unicon relies on a local C ABI when interfacing with the outside and inside world and for ensuring the virtual machine is correct for the local environment. Those details are all handled by the Unicon compiler and virtual machine implementation. Very few developers will ever have to worry about these details.


API

Application Program Interface. A specification detailing the routines, protocols and tools for building software applications. Developers can access a wide range of pre-existing application building blocks when using Unicon. Each API is different and (hopefully well) documented along with the library or framework that is was designed for. The API is the blueprint for building software from these components. The POSIX standard is one of the major API specifications available to a Unicon programmer on some operating systems, and the Microsoft Windows API is another.

Unicon itself, with the built in functions, form an API; to properly use Unicon functions the arguments must be of the right types, and be in the correct order. Sometimes a specific sequence of events is required to set up proper use and handle any values produced. All of these details make up an application program interface.

There is rarely a name given to any particular API, but the details are still required for proper use. Fortunately, Unicon is well documented and each large and small API is detailed for use by programmers, even though these details may not be explicitly labelled as an API.


ASCII

American Standard Code for Information Interchange. A character set encoding.

EBCDIC is another character encoding, mostly in use on mainframes.

Unicode is the newest and most encompassing character encoding.

Unicon is as of release 13, an ASCII programming language, Unicode support is on the Help Wanted list.


BaCon

The BASIC Converter. An amazing piece of software. Starts life as a shell script that converts the main BaCon source, written in BaCon, converting to C, and producing a BaCon native binary. A nicely complete, well documented BASIC system (and more than just BASIC being a BASIC/C hybrid), featuring an integrated Highlevel Universal GUI, full access to C libraries and copious examples. Generates DSO or native executable. The dynamic shared object modules can be loaded from Unicon, both as loadfunc and libffi functions. Direct C access with the USEC statement even allows for use of inline assembler from BaCon sources.

http://www.basic-converter.org/

Due to the C translation intermediates and the ease of DSO creation, almost all (if not all) BaCon functions and subroutines are accessible to the Unicon programmer with a simple libffi call. As with Unicon, there is an ever growing number of highly useful BaCon procedures available online. Perhaps not quite as organized as the IPL, the principal author of BaCon, Peter van Eerten keeps a handy index page on the BaCon website, http://www.basic-converter.org/#examples


BASIC

Beginners All purpose Symbolic Instruction Code. A programming language developed in 1964 by John Kemeny and Thomas Kurtz. BASIC evolved along with the use of personal computers to now having many hundreds of dialects and implementations. Originally a line numbered system with not much structure other than IF and GOTO, most dialects are now full fledged structured programming languages, that retain the ease of use paradigm.

For Unicon on Unix-like systems, the BaCon translator makes for easy BASIC integration with multilanguage solutions.


C

The C programming language was developed by the late Dennis Ritchie starting in 1969 while at Bell Labs, and became the re-implementation language of the Unix operating system.

C is also the base language for the reference implementation of Unicon, along with a custom variant, rtt, the runtime translator and rtl, the runtime language used when building Icon and Unicon.


comprehension

List comprehension is a term used to describe the syntactic construct of creating a list based on a generator expression, not a simple list of values.

Based on set comprehension and set-builder notation from mathematical set theory, distinct from other list operations such as map and filter.

For example:

S=\{\,2\cdot x\mid x \in \mathbb{N},\ 0>x<6\,\}

Is the set of all positive natural integer values less than 6, multiplied by 2.

In Unicon, the syntax would be something like

L := [: 2 * (1 to 5) :]

Creative Commons

Share alike licensing. https://creativecommons.org/licenses/by-nc/2.5/

The Creative Commons initiative has created a full suite of licensing terms for creative works. These licenses can be applied to images, software, text, or just about anything that can be covered by copyright. Authors are allowed wide leeway when deciding how a work can be shared.

Note

Being not a lawyer, the paragraph below is personal opinion and carries no authority, nor can it be treated as legal advice:

The by-nc version requires attribution of the original author and stipulates that redistribution rights are only given if there is no commercial aspect to the sharing, but derivative works are allowed.

See the link given above for the precise legal wordings and definitions. Even then, consult a lawyer if you require authoritative understanding of the issues at hand.


COBOL

The COmmon Business Oriented Language. An imperative programming language dating back to the very early 1960’s. Still in heavy use in financial, government and other enterprise scale business environments. COBOL programming comes part and parcel with most mainframe settings. GnuCOBOL is a freely available compiler for this industrial strength programming language.

As a programming language, COBOL is designed to solve practical business problems more than the computer science that influences almost all other environments. COBOL syntax is verbose, words are commonly used instead of symbols. This can be viewed as pro or a con, depending on who you ask, but it makes for highly readable source code.

Until fairly recently, there was no free compiler option, and due to the nature of big business, COBOL can be a very expensive field to work in. Or used to be. GnuCOBOL provides a free alternative, so it may help keep people on the technology. There are billions upon billions of lines of production COBOL source code in the field, and lowering year to year cost burdens associated with most COBOL runtime environments may breathe new life into an aging, yet critical, part of the computing landscape.

The latest Standard, COBOL 2014, is just starting to make the rounds among COBOL compiler vendors.


DSO

Dynamic Shared Object. This is a technical acronym that differentiates shared libraries from dynamic shared link libraries. Linkage to DSO files happens at runtime.


Expect

A pseudo terminal interface allowing hosted control of interactive console applications, by Don Libes. Expect is in the public domain, being developed by a Department of the U.S. government and therefore not subject to copyright.

https://en.wikipedia.org/wiki/Expect

Expect is an extension of the Tcl/Tk programming language, mentioned here for comparison with the Pseudo terminals API added to Unicon by Qutaiba Mahmoud, which is built on the pty interface introduced in BSD UNIX back in 1983. Pseudo terminal support is now part of many operating environments, including GNU/Linux and Windows. Unicon boasts a very easy to use, cross platform, pseudo terminal interface.


Farberisms

Sayings, with style.

From here on up, it's down hill all the way.

We can dig ourselves out of this hole.

We took our eyes off the wrong ball.

To name but a few of the quaint expressions made famous by David Farber. See farb.icn and farb2.icn in the IPL for a whole bunch of these quotables.


Forth

A stack and extensible threaded word programming language, by Chuck Moore.


GCC

The GNU Compiler Collection.

Use it to build Unicon.


GNU

GNU is Not Unix.

Use GNU, Linux, and free software.

It’s good for you, and your/my/our freedoms.


GnuCOBOL

A free software implementation of COBOL.

https://sourceforge.net/projects/open-cobol/

Due to some of the implementation details of GnuCOBOL, it is a transpiler, emitting intermediate C code, it can be integrated with Unicon executables, each gaining from the innate strengths of the other.

See unicob.cob for a working example.


Graphics Programming in Icon

The original Icon graphics programming book by Ralph Griswold, Clinton Jeffery, and Gregg M. Townsend, published by Peer-To-Peer Communications in 1998. It went out of print, and the rights reverted to the authors, who then placed it in the public domain. Many thanks to the authors and Peer-To-Peer.

Get a copy from https://www.cs.arizona.edu/icon/gb/index.htm

Still highly relevant for modern Unicon programming.


Help Wanted

The Unicon project maintains a Help Wanted section. Some items on the wish list require very high levels of technical skill and programming literacy, some just require a willingness to help out.

http://unicon.sourceforge.net/helpwanted.html

Check it out, and if you want to help, drop a note to the contact listed on the Unicon homepage.

http://unicon.sourceforge.net/


Icon

The Icon programming language, heavily leveraged by Unicon, awesome.

https://www.cs.arizona.edu/icon/


Icon version 9

Version 9 is the latest, and last Icon release version. Before his passing, Ralph Griswold let it be known that he wanted the feature set of Icon to be frozen; a completed work. And so it shall be. A testament to a great teacher, and a true Computer Scientist.

The University of Arizona Computer Science Department will make periodic updates, to fix any critical bugs (not many of those left to find, as Icon is a very mature, and meticulous code base), or to keep up with changes in C compilers, and operating systems; so the sources will always properly build.

Version 9.5.1 (at time of writing) can be found at

https://www.cs.arizona.edu/icon/current/


JSON

JavaScript Object Notation.


Locale

A system used in Internationalization and Localization. i18n/L10n.

Localization is a detail rich subset of modern programming.

See https://www.gnu.org/software/gettext/manual/html_node/index.html, the GNU gettext manual, for a full explanation of the issues involved with robust locale aware programming.

Note

Unicon, being an ASCII based system by design, cannot elegantly deal with Unicode or other multi-byte character encodings at this time. Special care and attention must be paid when dealing with non ASCII character sets in Unicon programs. Treat the data as binary buffers, and do not rely on any one to one correspondence between code points and bytes.

mutable colour

A colour created with NewColor. Supports changing existing pixel colours on the display hardware. Not supported by all builds of Unicon. Mutable colours are encoded in Unicon as a negative number entry in the colour map.


PHP

Currently a recursive backronym, PHP: Hypertext Preprocessor. Originally it was Personal Home Page, a utility layer developed by Ramus Lerdorf in 1994 to assist in the creation of websites. Much has changed since Ramus started the project, and PHP is now one of the most widely used programming languages in existence.

Unicon can compete with, and integrates nicely with PHP when developing web applications. A Technical Report written by Clinton Jeffery includes information on using Unicon for CGI and interoperating with PHP.

http://unicon.org/utr/utr4.html

See https://secure.php.net/ for more information.


POSIX

Portable Operating System Interface. An IEEE standard for maintaining compatibility between operating systems. An acronym suggested by Richard Stallman of GNU.

https://en.wikipedia.org/wiki/POSIX


REXX

Restructured Extended Executor, an interpreted programming language developed in the late 1970s by Mike Cowlishaw while at IBM.

Unicon can integrate REXX programming using either the ooRexx or Regina implementations. See REXX for a working example that allows use of both the C and C++ API.

SAY "Your name please? "
PARSE PULL name
SAY "Well met, ", name

math = "say 6 * 7"
INTERPRET math

Standard documented in ANSI X3.274–1996 “Information Technology – Programming Language REXX


Richard Stallman

rms originated the Free Software movement. He founded the Free Software Foundation, launched the GNU project, and developed GCC and GNU Emacs, (along with many other software systems).

https://en.wikipedia.org/wiki/Richard_Stallman


SEXI

String EXtraction Interpreter, a name originally used for SNOBOL.


serif

In typography, serifs are the line extenders attached to the end of a line in a letter or symbol.


SNOBOL

An early string and pattern manipulation programming language, circa 1963, designed and originally implemented by Ralph Griswold and others. Still in use.

StriNg Oriented symBOlic Language.

See SNOBOL4 for a few examples, and a small Unicon program that runs and captures output from SNOBOL4 programs, as implemented by the SNOBOL in C project homed at https://sourceforge.net/projects/snobol4/

The links to SNOBOL run deep in Unicon. See Patterns for one major example of the influence.

SNOBOL, a precursor to Icon, hence Unicon is a label and branch heavy programming language.

Label   Statement body                  :Goto

That’s SNOBOL in a nutshell, three fields. A label, a statement and a jump.

Labels can be pretty much any name, except END, the end of program text marker. When there is no label, statements can’t start in column 1, and are usually indented to column 8 or 9.

Statements actually have three parts, Subject Pattern = Replacement. There can be Subject only (which can be function calls, primitives and expressions), Subject = Replacement assignments, Subject Pattern pattern matching, or all three components for replacement of matched patterns within the subject.

This seed of an idea grew to be Unicon string scanning, within a much more structured syntax.

The goto can be unconditional :(label), jump on success :S(label), jump on failure :F(label) or separate branches for both :S(label) F(label). Target labels could also be computed, and referenced in variables :($VAR).

More fully, source lines can be

LABEL   SUBJECT PATTERN = REPLACEMENT   :S(success-label) F(fail-label)

There are quite a few reserved words, in tune with computer programming of the era. PUNCH was a reserved word that meant write data to a punch card. INPUT was for reading from a paper based console keyboard (or card reader in the early early days), and OUTPUT wrote to the console printer. At the time, machines were mostly upper case. These device names could be redirected to and from files as time went on and 50 pound display screens became a thing and disk drives were invented (costing a mere $10,000 per megabyte (or more) in an era when top tier programmers made less than that in a year).

* Hello, SNOBOL style, circa 1964 (before Hello, world was a thing)
        OUTPUT = "HELLO, WORLD"
END
* Prompt, on paper, read from keyboard, echoed on paper, loop
PROMPT  OUTPUT = "NAME PLEASE? "
        NAME = INPUT                           :F(END)
        OUTPUT = "HELLO " NAME                 :(PROMPT)
END

Within the winds of fate, SNOBOL eventually evolved into structured Unicon. Hooray, fate.


Tcl/Tk

A scripting language invented by John Ousterhout, designed for inclusion inside other applications to provide a Tool Command Language. The goal was to alleviate the need for building custom scripting engines in these applications. Initial releases of Tcl were quite successful, and use expanded beyond an embedded scripting engine to become a full fledged development platform. Tcl also includes a graphical user interface layer, Tk, ToolKit.

https://en.wikipedia.org/wiki/Tcl

A Tcl version of the Summing integers integer summation comparison is included in the Performance chapter of this docset.


Tectonics

The expression tectonics used through this document is based on the following (fairly archaic) definition.

"Tectonics" gcide
"The Collaborative International Dictionary of English v.0.48"
Tectonics \Tec*ton"ics\, n.
1. The science, or the art, by which implements, vessels,
dwellings, or other edifices, are constructed, both
agreeably to the end for which they are designed, and in
conformity with artistic sentiments and ideas.
[1913 Webster]

Found from a lookup using the dict:// protocol and the bank of open servers.

The term is used here as nerd slang, for describing the code building process.

The inference is that building code with Unicon is a very agreeable mix of art and science. With overtones of the geological term, and being rock solid.


uniclass

uniclass.dir and uniclass.pag are two external database files which make up uniclass, used with the class and package system of Unicon. These files form a DBM database file, entirely managed by the Unicon compile and link system, much like ucode. Being a DBM dataset, the entries are simply treated as a persistent table. Use key after open("uniclass", "dr") to see the keys which can then be used as table indexes to see the data.

# use "dr" for read only, don't muck with this database
uc := open("uniclass", "dr")
every k := key(uc) do write(k, ": ", uc[k])
close(uc)

Unix epoch

When Unix(tm) was first in development, the engineers needed a time reference. They picked January 1st, 1970. Many computer clocks have been counting up seconds based on that epoch ever since.


VAX

A midrange computer, by Digital Electronics Corporation.


VimL

The de facto naming convention of the Vim script language. Bram never really published a name for the internal language used for Vim scripting. Someone eventually coined VimL as a name for the language, and it has spread to unofficial common use; with the side benefit of helping find relevant internet search results.


VMS

Virtual Memory System, by Digital Electronics Corporation.

Version 9 of Icon (with graphics) is known to work with OpenVMS.


VOIP

Voice Over IP, or more fully, Voice Over Internet Protocol. A telephony feature optionally supported by Unicon. Accessed with open mode v.

See http://www2.cs.uidaho.edu/~jeffery/unicon/reports/zsharif-voip.pdf for details.


y2k

The Year 2000 problem, an issue caused by using 2 digit years in computer systems developed in the 20th century, ill prepared to rollover from the 1900s to the 2000s. The Year 2038 problem may end up being worse.

Year 2038 problem

Is a pending, possible problem, when epoch based signed 32 bit counters of seconds roll into the sign bit and turn hugely negative. The epoch was arbitrarily set to January 1st, 1970 during the early days of UNIX design and development. Internal computer clocks have been counting seconds since then. The counter field is (or was) a signed 32 bit field, and the 31 bits of count will rollover into the sign field at 03:14:07 UTC on 19 January 2038. The computer will then think it is 8:45 pm, December 13th, 1901. How most low level systems will react to that will require case by case study.

New systems (as of about 2012), use an internal 64 bit counter, enough seconds to exceed the theoretical life span of the Universe, but embedded and older systems with a 32 bit clock, will encounter unpredictable issues. Well, these are computer programs. Rarely “unpredictable”. But without explicit study of each and every occurrence of clock field use, the overall system outcomes may as well be viewed as unpredictable. The number of possible faults, and the effect of clock counter rollover will need analysis to determine the overall system impact.

An event similar to epoch rollover may have already occurred. The Deep Impact mission satellite stopped responding, 2^32 1/10ths of a second past its internal epoch of January 1st, 2000, on August 11th, 2013 at 00:38:49. Engineers at NASA believe that the system went into a perpetual reboot state, when the internal clock counter (counting 10 times per second) rolled. That meant commands could no longer be received by the satellite, or acted on. Corrections could not be uploaded due to the perpetual reboot. Without thruster control the spacecraft is in an unknown orientation, antennas possibly pointed in the wrong direction, and solar panels not in a position to recharge batteries. Attempts to correct the problem and contact the spacecraft were officially abandoned on September 20th, 2013.

Unicon epoch rollover risk is nearly zero

Very old copies of Icon might be at risk of the epoch bug, which is more dependant on the operating system than the actual Icon runtime.

Unicon, being in active development, will almost certainly be based on 64 bit clocks by the time 2038 rolls around. Unicon developers will not generally need to worry about the epoch rollover bug.

Or to put it another way. If, long if, Unicon is running on a system that is susceptible to epoch counter sign rollover, it won’t be Unicon that takes the system down or causes problems. There will be far too many other possible component failures to see that forest from those trees.


Index | Previous: RosettaCode | Next: ChangeLog