Well met,

Just spent a few minutes, and it was just a few minutes, building Unicon on SourceForge using the freely offered developer web services. Revision 4616, pulled fresh from svn, configured and built inside a SourceForge developer shell.

Worked out great. First sample of Unicon CGI is up at

<HTML><HEAD><title> An HTML Form Example </title></HEAD>
 From Programming with Unicon
 Copyright (C) 1999-2015 Clinton Jeffery, Shamim Mohamed,
     Jafar Al Gharaibeh, Ray Pereda, and Robert Parlett
<h1> A <tt>cgi.icn</tt> Demonstration</h1>
<form method="GET" action="/cgi-bin/simple.cgi">
    1. Name: <input type="text" name="name" size=25> <p>
    2. Age: <input type="text" name="age" size=3> &nbsp;Years <p>
    3. Quest:
        <input type="checkbox" name="fame">Fame</input>
        <input type="checkbox" name="fortune">Fortune</input>
        <input type="checkbox" name="grail">Grail</input><p>
    4. Favorite Color:
        <select name="color">
            <option selected>Don't Know (Aaagh!)
        <textarea rows=5 cols=60 name="comments"></textarea><p>
    <input type="submit" value="Submit Data">
    <input type="reset" value="Reset Form">


That form has a Submit action that invokes a small server side Unicon CGI program. The code was taken from the Programming with Unicon book and modified slightly to make it safer for hosting on a public facing web site.

# simple-cgi.icn
# tectonics:
#    unicon -B simple-cgi.icn
#    mv simple ../cgi-bin/simple.cgi
link cgi
procedure cgimain()
    # set defaults for both CGI and AJAX usage
    if /cgi["name"] | cgi["name"] === "" then cgi["name"] := "Guest"
    if /cgi["age"] | cgi["age"] === "" then cgi["age"] := "no"
    if /cgi["comments"] then cgi["comments"] := ""
    if /cgi["word"] then cgi["word"] := "" 

    # remove any potentially dangerous characters
    cgi["name"] := map(cgi["name"], "<>&%", "....")
    cgi["age"] := map(cgi["age"], "<>&%", "....")
    cgi["comments"] := map(cgi["comments"], "<>&%", "....")
    cgi["word"] := map(cgi["word"], "<>&%", "....")

    # output for the web
    cgiEcho("Hello, ", cgi["name"], "!")
    cgiEcho("Are you really ", cgi["age"], " years old?")
    cgiEcho("You seek: ", cgi["fame"]==="on" & "fame")
    cgiEcho("You seek: ", cgi["fortune"]==="on" & "fortune")
    cgiEcho("You seek: ", cgi["grail"]==="on" & "grail")
    cgiEcho("Your favorite color is: ", cgi["color"])
    cgiEcho("Your comments: ", cgi["comments"])
    cgiEcho("Your AJAX word: ", cgi["word"])
    cgiEcho("<a href=\"/demos/\">Home</a> / " || 
        "<a href=\"/demos/simple-form.html\">Back to HTML form</a> / " || 
        "<a href=\"/demos/simple-ajax.html\">Back to AJAX form</a>")


That trial code simply echos the form data, after ruthlessly sanitizing any data to avoid any potential cross site scripting efforts. The code was compiled, on SourceForge with unicon -B simple.icn and then the resulting executable was moved into the cgi-bin directory as simple.cgi

All tests so far have come up golden.

As a very satisfied Unicon customer, the good folk that provide and maintain SourceForge services deserve a round of applause.

Recent news


Jafar Al-Gharaibeh posted up a little loadfunc sample for accessing interval timers with setitimer.

Resizing windows

A bug with window resizing is being discussed on the mailing list. If things progress as they normally do, this will be fixed shortly. The code under discussion works fine here, an X11 build on Xubuntu, and this seems to be an issue only with certain configurations of Unicon.

Procedural or Object oriented

Unicon, being a multi-paradigm programming environment, offers a lot of flexibility when it comes to making design and implementation choices. I asked for some opinions on the Discussion forum on whether Procedural/Imperative or Object oriented development is preferred by the language designers for small Unicon programs.

Both Clinton Jeffery and Jafar Al-Gharaibeh opined that it depends on the developer and the problem being faced, there is no preferred style. This is good news in terms of letting programmers attack problems from the most comfortable position, and is a sign that no single paradigm is given more weight during language development. Unicon programmers are free to make choices without worrying about decisions being wrong in any way. Both paradigms are a good choice.

By the nature of Unicon, the styles can easily be mixed, so that becomes yet another valid choice available for developers.


The UP docs now include a seed work example of calling libsoldout by way of loadfunc. The soldout engine ships with example (production ready) output renderers. The soldout.icn sample parses extended Markdown from a Unicon string, and produces HTML, returned as a string from the loaded wrapper function. See libsoldout markdown for code listings and some explanations.

More information about libsoldout, by Natacha Porté, can be found at

Have good, make well.

Previous: Invited   Next: Unicon FFI