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.

Leave a Reply

Your email address will not be published. Required fields are marked *