Unicon Programming

Unicon Programming

Well met,

Just started in on a new book, it’ll be free, but it won’t be ready for general redistribution for some months, lot’s of background to fill in first

Unicon Programming

Unicon is an extension of the Icon programming language, adding POSIX, 3D graphics, networking, class and package management and a host of other modern development features. Unicon is classed as a very high level language, especially for processing strings. Patterns and a string scanning engine are built into the language. Everything is a an expression, and goal-directed evaluation with generators means that many looping constructs are not required. Based on the Icon virtual machine, Unicon is very stable, the code base has been refined for over 40 years now.


Recommended for any programmer: http://unicon.sourceforge.net/

Have good, make well,
Brian

 

Open Object Rexx and GnuCOBOL

Well met,

I was going through the GnuCOBOL FAQ, looking to clear up any stale links, and the first one I bumped into was an entry from 2009, pointed to a now stale link on opencobol.org.  ooRexx integration.  Thinking I’d spend a few minutes to refresh the link, was not to go according to plan.  The code that embedded ooRexx version 3.5 was no longer functional with ooRexx release 4.  Release 4 added 64 bit support, and the early code did not account for this, so it was borked on 64bit hardware.  That change ended up being relatively trivial, but interest was piqued and then a round of enhancements began.

GnuCOBOL now supports full extending and embedding of Open Object Rexx.  COBOL programs can invoke Rexx scripting with one line of code, thanks to user defined functions, and Rexx can call into compiled COBOL thanks to RegisterFunction and RegisterCommand features of ooRexx.

 

The FAQ entry has expanded, code to allow

move function rexx(mode, script, host, args, buffer)

     to rexx-status

has been published, along with samples that demonstrate RexxRegisterFunctionExe, RexxRegisterFunctionDLL, RexxRegisterComandExe, and RexxRegisterCommandDLL.   Exe and DLL forms differ in that Exe is for internal entry points (code local to the application registering the entry) and DLL is for linking to external shared libraries, independent of the local application space.  These work both for Windows, and POSIX (GNU/Linux) systems, as well as supporting both 32bit and 64bit hardware.

 

GnuCOBOL can now easily call internal and external Rexx scripts (with a call to RexxStart, or using the provided function rexx() interface), and Rexx scripts can invoke GnuCOBOL subprograms, as well as sending commands to a “gnucobol” host environment.

 

The synergy creates a powerful pairing.  As part of the unit testing provided with the user function repository, a small Rexx interactive shell is also provided (4 lines of GnuCOBOL) to allow for exploring Rexx instructions, trying external scripts, and testing Rexx command handlers backed by GnuCOBOL subprograms, and binary invocation of GnuCOBOL code as Rexx functions.

 

Code listings, sample runs and technical documentation can be found at http://opencobol.add1tocobol.com/gnucobol/#can-gnucobol-interface-with-rexx and the current source archive is attached to a post at http://sourceforge.net/p/open-cobol/discussion/contrib/thread/203c5fbd/#2427

(We have plans to move the project space off of SourceForge and will start up a self-hosted Apache Allura installation, likely within the next month).  We’ll strive to ensure that no links go stale, and there are appropriate explicit and implicit redirects put in place.

prompt$ LD_LIBRARY_PATH=. rlwrap cobcrun gnucobol-rexx shell For testing in the shell:   call cobol arg1,arg2; say result   address gnucobol; with command; return rc   call cobout 1,2,3; return result           **   address extcob; command; return rc         **      ** If libtest-cobrexx.so is in search path    any Rexx instructions, default address is gnucobol   q to quit  GnuCOBOL ooRexx test shell: 2015-10-26/20:10:50.00-0400  ooRexx: parse pull name; say "Hello, " || name; return name Flunky Hello, Flunky  Status : +00000, +0000000000, +0000000000 Length : 6 Result :Flunky:

ooRexx: parse version v; return v

Status : +00000, +0000000000, +0000000000 Length : 38 Result :REXX-ooRexx_4.1.0(MT) 6.03 17 Aug 2014:

ooRexx: parse verion . level .; return l; 1 *-* parse verion . level .; REX0025E: Error 25: Invalid subkeyword found REX0296E: Error 25.12: PARSE must be followed by one of the keywords ARG, LINEIN, PULL, SOURCE, VALUE, VAR, or VERSION; found "VERION" Status : -00025, -0000000025, +0000000000 Length : 32768 Result ::

ooRexx: parse version . level .; return level Status : +00000, +0000000000, +0000000000 Length : 4 Result :6.03: ooRexx: return 21 * 2 Status : +00042, +0000000000, +0000000000 Length : 2 Result :42: ooRexx: address 'sh'; 'make clean' rm *.c *.i *.c.h *.c.l* gnucobol-rexx.so callrexx oorexxcall Status : +00000, +0000000000, +0000000000 Length : 0 Result :: ooRexx: address 'sh'; 'ls -l' total 7676 -rw-rw-r--. 1 btiffin btiffin 13341 Oct 22 16:01 callrexx.cob -rw-rw-r--. 1 btiffin btiffin 5128 Oct 22 05:32 callrexx.tar.gz -rwxr-xr-x. 1 btiffin btiffin 3775 Oct 21 22:03 example.rex -rwxrwxr-x. 1 btiffin btiffin 19588 Oct 22 21:05 expand-words -rw-rw-r--. 1 btiffin btiffin 4384 Oct 22 21:05 expand-words.cob -rwxrwxr-x. 1 btiffin btiffin 362 Oct 23 03:43 gnucobol.rex -rw-rw-r--. 1 btiffin btiffin 27559 Oct 24 00:26 gnucobol-rexx.cob -rw-rw-r--. 1 btiffin btiffin 780 Oct 24 00:03 gnucobol-rexx.cpy -rw-rw-r--. 1 btiffin btiffin 1388 Oct 23 19:13 gnucobol-rexx.org -rw-rw-r--. 1 btiffin btiffin 12443 Oct 24 00:26 gnucobol-rexx.tar.gz -rw-rw-r--. 1 btiffin btiffin 597 Oct 24 00:22 Makefile -rwxr-xr-x. 1 btiffin btiffin 5280 Oct 22 16:20 month.rex -rwxrwxr-x. 1 btiffin btiffin 123 Oct 21 22:35 mycmd.rex -rwxrwxr-x. 1 btiffin btiffin 107 Oct 21 02:14 MYCMD.REX -rw-rw-r--. 1 btiffin btiffin 6824 Oct 21 18:09 oorexxcall.cob -rw-rw-r--. 1 btiffin btiffin 6805 Oct 21 01:46 oorexx.txt -rw-------. 1 btiffin btiffin 7687367 Oct 23 23:59 rexxref-1.pdf drwxrwxr-x. 2 btiffin btiffin 4096 Oct 21 16:37 sample -rwxr-xr-x. 1 btiffin btiffin 3952 Oct 22 16:05 startrx2.rex -rwxr-xr-x. 1 btiffin btiffin 4099 Oct 22 16:00 startrx3.rex -rwxrwxr-x. 1 btiffin btiffin 38 Oct 21 01:07 version.rex Status : +00000, +0000000000, +0000000000 Length : 0 Result ::
ooRexx: call cobol 1,abc,3,4; return result Status : +00000, +0000000000, +0000000000 Length: 48 Result :Hello from GnuCOBOL, Rexx. 04 arguments received: ooRexx: call cobout 1,abc,3,4,5; return result Status : +00000, +0000000000, +0000000000 Length: 45 Result :05 arguments received. Second argument :ABC: ooRexx: address gnucobol; command string; return rc Status : +00000, +0000000000, +0000000000 Length: 49 Result :By your command. GnuCOBOL received 014 characters: ooRexx: address extcobol; command string; return rc 1 *-* command string; >>> "COMMAND STRING" +++ "RC(30)" Status : +00030, +0000000000, +0000000000 Length: 2 Result :30: ooRexx: address extcob; command string; return rc Status : +00000, +0000000000, +0000000000 Length: 67 Result :External command received 014 characters, first part:COMMAND STRING: ooRexx: q prompt$

Open Object Rexx and GnuCOBOL, a fine pair, and working well together.

 

Cheers, and have good, everyone
Brian

Enhancing ROBODoc for COBOL

Well met,

The upstream sources for ROBODoc, a powerful auto documentation generator, now supports a –cobol command line option.  This provides better parsing for both indexing and source highlighting of COBOL source codes.

Frans keeps the current ROBODoc on GitHub at https://github.com/gumpu/ROBODoc

Allows for even more literate programming with COBOL, with the bonus of nice documentation.

Details on customizations are documented at http://sourceforge.net/p/open-cobol/discussion/cobol/thread/4286b1e5

Have good.

Cheers, Brian

 

 

 

 

 

 

 

 

GNU Cobol, MathGL, charts and graphs

Well met,

Alexey Balakin has developed a pretty nice library for scientific graphic plots. MathGL.  Alexey has done a wonderful job exposing the C bindings to the C++ internals, and that opens the door to linking COBOL data to a scientific graph engine.

Explorations, starting with

MathGL sine curve

and leading up to

GNU Cobol and MathGL

documented at http://sourceforge.net/p/open-cobol/discussion/cobol/thread/946a76a3/ (with links to larger images)

MathGL could come in handy for visualizing COBOL data.  To start there is a COBOL function, mathgl-script.

Pass in some image details, a dataset describing x,y,z vectors, and MathGL script, to produce some nice visuals.

Cheers,
Brian

GNU Cobol, GTK 3+, HTML5 and browsing GUIs

Well met,

I’ve been tinkering with a COBOL framework, based on ideas inspired by the Fossil SCM project.  A single binary that handles command line, CGI, webserver, help system, testing facilities, and on and on for a version control system with tickets, wiki and features galore.

Very well designed, fossil.  Inspiring.  So, cobweb.cob was started.  About 300 lines of GNU Cobol source code and there was a prototype for CLI, (Fast)CGI, a GUI and a text driven plugin architecture using the dynamic link capabilities built into the COBOL CALL verb.  Pretty sweet.  No where near Fossil, but promising.

The reference plugins are jokes, the joke server.  ./cobweb pirates displays a joke about pirates.

http://localhost/cgi-bin/cobweb/pirates  displays the same joke, in CGI, for the browser.

And tacked on for demonstration, was ./cobweb visual for putting up a GTK graphical interface, just to see if it would fit in.  It does, quite nicely.  A google query about X11 in the browser led to a reference to Broadway, GDK Broadway and GTK 3+.  cobweb was built with pkg-config –libs gtk+-2.0, a simple bump to gtk+-3.0 and now there is support for the GDK Broadway backend.

GTK graphical events and pixels are routed through a small server to a websocket with pixel and event management transformed to HTML5.  A web browser interface for GTK 3+ desktop applications.  For free.

GDK_BACKEND

By simply setting GDK_BACKEND=broadway, any GTK 3+ application will redirect through a websocket (with an associated multicast server, broadwayd for accessing more than one GTK application at a time, again, in the browser).

In one window,

broadwayd :1

Listening on /run/user/1000/broadway1.socket

starts a server listening for X11 DISPLAY :1 events.

BROADWAY_DISPLAY=:1 GDK_BACKEND=broadway ./cobweb visual

and the graphic display is routed through a websocket to the browser; stdio still on the desktop for logging or other uses.

Point the browser to http://localhost:8080 and click around the GUI auto transformed to websockets and HTML5.

A GTK calendar sample in Seamonkey

and on the launcher terminal

BROADWAY_DISPLAY=:1 GDK_BACKEND=broadway ./cobweb visual 
In the year 2014 somebody clicked 2014/04/01
In
the year 2014 somebody clicked 2014/04/08

Pretty neat.  Cool, free.  No code change for the graphical desktop application or the web app.  Just a simple environment setting and smart other people.

More details and source files, at http://sourceforge.net/p/open-cobol/discussion/cobol/thread/b8979335 and

http://sourceforge.net/p/open-cobol/discussion/cobol/thread/c7e60d1b

Cheers,

Brian

Oh, the joke,

 

What’s a pirate’s favourite letter?

AARRrrr, you’d think it’d be R, or Aye, but they loves the C.

GNU Cobol on vivaldi.net

Well met,

The move to vivaldi.net from My Opera is going silky smooth it seems.  Old blogs all nicely imported.

 

Many thanks to the blog-import team.

I’ll likely continue waving pom poms on behalf of the GNU Cobol project in this space.

 

If you haven’t seen it.  http://sourceforge.net/projects/open-cobol/

 

FAQ/How-To at http://opencobol.add1tocobol.com/gnucobol/

Cheers,

Brian