Feedback Search Top Backward Forward

Under the Scope

Written by Brad Scharf



Welcome to 'Under The Scope'. This column is a regular feature of EDM/2 that looks at utilities that can be useful to OS/2 programmers. While targeted towards beginning programmers, I hope it will be of interest to all developers, regardless of ability. Each month I'll try to review at least one programmer's tool and will periodically discuss a utility over several issues, as has been the case lately with Guidelines. As always, if you have any comments or suggestions regarding the column or products you would like to see reviewed, don't hesitate to email me.

This Month

With the current popularity of the World Web Web, there are probably a lot of developers out there hoping to cash in by building a better mouse trap. My own experience with some of the news groups has left me with the distinct impression that many OS/2 users are dissatisfied with IBM's WebExplorer so I have decided to review the WebExplorer Toolkit from IBM for those of you who, even if you have no interest in mouse traps, might be interested in building a better browser. I won't bother you with programming examples. Nor will I describe the data types and functions that are specific to this toolkit, the reason being that if you don't plan to download the package you don't need the info, and if you do plan to download it you'll have the information in more detail than I can provide. This is not how I'll treat all, or even many, of the products I plan to review but since the toolkit is small and free, I think it's OK in this case to simply provide an idea of its uses and limitations, rather than going into great detail. It will be a short article.

Also this month, I will continue the Guidelines saga. This month's Guidelines article will focus on JOT, the proprietary language used by Guidelines. For the most part this will be light reading (relatively speaking, that is) and is intended to illustrate the language, not how to program. Programming is still to come.


Hmmm... a Web Server Without a Network? Has he lost his mind?. Wanna-be web developers read on. Network gurus are invited to provide suggestions for improving on the following method.

While not a development tool per-se, I must make a mention of IBM's Internet Connection Server 4.0. To justify this, let me explain that I wanted to run a Web server at home so that I could test CGI scripts without having to log on to my $ervice provider to compile, test and debug them (and that's the connection to development). The problem is that I have only one computer, not to mention a network and associated hardware. To make matters worse, I don't know TCP/IP from a hole in the ground.

Anyhow, I was having problems getting the server to run. I couldn't get it to connect to a port, and when I could I was unable to connect to the server with WebEx. The news groups were of very little help (one response in three weeks), so I tried something really bizarre - I read the online documentation the came with the Internet Connection. It was almost useless. Almost.

I say almost, and not completely, because I found a reference to a program called IFCONFIG (Warp Connect or TCP/IP users may find TCPCFG to be its equivalent, but I'm not certain). While this reference didn't tell me much, there was a mention of a switch for local connections (lo) so I played around with it a bit and it eventually worked. Here's what I did...

Having configured the server to use port 8080...

  • Type the following from an OS/2 command line "IFCONFIG lo"
  • Then, also from the command line, run HTTPD (the server)

This resulted in the server starting up and connecting to port 8080, as was intended, and using a network address of I have since placed the IFCONFIG and HTTPD commands into a simple batch file and created a program object for it so I can run it from Launchpad.

Another obscure mention somewhere in the docs told me that I could force the browser to connect to a specific port by appending :pppp (where pppp is the port number) to the URL so...

I started the browser with the URL "". Lo-and-behold, I was logged on to a server (on my machine) without a network! I used in the URL because that was the example number given in the sparse documentation, but other 32-bit address numbers seem to work as well, as do ports other than 8080. Using port 8080, however, allows me to use the server on my machine with one browser without interfering with another browser using a remote server.

While this should work with any server, I mentioned IBM's Internet Connection Server 4.0 because of the ease of installation and configuration. Installation is via a PM based installation utility and configuration can all be done through your browser, with links to the various items to be configured etc. (Just the thing for us wannabe's.) Since I wanted a server only to test CGI scripts, this one is ideal. It allows me to concentrate on developing CGI programs without first having to learn all about web servers. Obviously, I can't ignore the server altogether, but when I do need to concern myself with it, I see a much easier time configuring this one (compared to command-line based servers) since all configuration items are categorized and described. The web pages included with the server contain links to all configuration and documentation items. It's still possible to edit HTTPD.CNF manually, but it isn't nessesary. In addition, documentation is comprehensive and provided in both the HTML and INF formats.

If any of you are in the same situation as I was, and lack the networking know-how as I do, I hope you find the above information to be of use.

The server is available (no charge, no support) from IBM. The URL is "'. This will take you directly to the download page where you can decide if you want the secure or basic version of the server. It seems to be a popular site during peak hours so you may want to turn off graphics. Actually, if the network is busy and transfer speeds are slower you might want to retrieve the server package at another time. It's a 5 MB zip file.

Things To Watch For

The OS/2 Pascal Compiler shootout should begin soon. There will be a grand total of two compilers featured in round 1: Virtual Pascal/2 and Speed Pascal/2. The compiler reviews will span two, or possibly three issues. With a little luck I'll be able to add another compiler or two to the list. I had hoped to begin the review of Pascal compilers in the July issue, but as I have yet to receive any, it may be delayed for an issue or two. Whatever happens, July's issue will also feature a review of GpfRexx from Apical Software, Inc.

Also coming up will be reviews of a couple of programmers editors. I'll take a look at Visual SLickedit, Preditor/2, Rimstar, EPM, Emacs and Boxer/2. The editor reviews should begin in the August issue of EDM/2 but this is heavily dependent on the postal system being able to deliver at least a couple between now and then.

IBM's WebExplorer Toolkit

The WebExplorer Toolkit, free from IBM, consists of not one, but two files (or three, depending on how you count them)! There is a zip file containing a header file and import library (file #1 by my count) and a separate API documentation file (#2). Using your browser to connect to "", you will find a link to the toolkit itself (a 9 KB zip file) and another link for the (66 KB) API documentation. The API documentation is an HTML file however, so when you link to it you'll be forced to view it online as well, but once it's loaded just drag it to your desktop and you're done.

Note: the above URL also contains a link to the ICS Web Server download page mentioned in the introduction to this months column.

Since this toolkit is a give-away, support from IBM is supposedly non-existent, but the documentation is pretty good, with lots of code snippets. All data structures and functions are explained quite well and there is nothing here that differs from regular PM programming. Everything is illustrated using C, so those of you who haven't jumped on the OOP bandwagon won't be left out in the cold. With the exception of the supplied .H and .LIB files, no other special tools are required (assuming you are already equipped to program for OS/2's PM).

I should mention that I have not attempted to use every function or structure in the library. As a result I cannot say whether it's bullet proof or not, but I can tell you that if everything works as it should you will be able to duplicate virtually every feature of IBM WebExplorer using this library, and with some work (how I hate that word) you may even be able to improve on some of that particular browsers functionality. Even if your plans don't include trying to improve on WebExplorer, the WebEx toolkit may have other interesting uses, such as for building an internal viewer for an HTML editor or a customized, low-overhead interface for viewing online documents within your organization etc. One drawback is that WEBXWIN.DLL is still required. As a result your improvements over Webex will probably be limited to the interface. Unless IBM gives away the source for the DLLs, it's unlikely that using this toolkit will provide the means to drastically improve on WebExplorers performance or limitations.

Maybe we ought to look at a few specifics.

Those of you who have gotten beyond the "Hello World" level of PM programming have probably already come to one conclusion regarding web browsers - the view window is not a standard window (duh) and isn't included in the OS/2 Toolkit. Nor do any of the toolkit or compiler sample programs provide any indication of how one might build a viewer from scratch. One of the biggest advantages to using the WebEx Toolkit then, is that the programmer can now utilise this control without having to re-invent the wheel. by simply using WC_WXVIEW for the window class in the WinCreateWindow() function.

In all, there are 16 viewer-specific data types, 3 message and 33 functions defined in the toolkit. Rather than regurgitating the API documentation, I'll just give a brief description of what the library and header file consist of.

Data Structures

Structures are defined to hold values for document and image cacheing, the number of image-loading threads, font size, default display colours, email and other network addresses, mime types and the associated viewers, mouse and thread data, as well as some print data.


The messages types defined in the toolkit relate to mouse movements, print results, loading and load status and button clicks.


The majority of the toolkit consists of functions, which are categorized as functions that perform actions, functions related to documents, position and configuration query functions, functions to set configuration options and a few miscellaneous functions.

That's about it. There isn't much more I can write about it without simply copying the API documentation. Download it. Play with it. Build a browser. Perhaps even build one that allows multiple quick-lists, or incorporates pop-up menus from the view window to allow savng the displayed page or graphics to disk. Or set image-loading threads on-the-fly. Maybe automatic reloading of the current document if the graphics mode is changed. Create an HTML editor with a small built-in browser. Despite the toolkits limitations (being dependent on WEBXWIN.DLL) there are still a multitude of uses, so why not do something with it?


For programmers with an interest in web browsers, the toolkit will allow the creation of a browser from scratch (almost), but its greatest use probably lies in building a browser with an enhanced interface or additional configuration options (as alternatives to command line switches).

Unfortunately the toolkit relies on the presence of WEBXWIN.DLL, thus limiting the potential for building an improved browser. However, it is very small, costs nothing and may be worth having for interests sake alone.

Guidelines, The Language (JOT)

If you've been following the Guidelines articles, you'll know that it uses a proprietary language, JOT. JOT is a fairly simple language to learn, yet allows the programmer to accomplish almost everything that can be done with other high-level languages such as C.

Since this month's article is going to focus on JOT, it will cover the more elementary aspects of the language. Actual use of the language will occur in a future article when Guidelines is used to develop a complete PM application.

If you've taken a close look at the data types defined in the PM toolkit, you know that ultimately all data types are of type char, int, float, double or void and that other types are based on these (this actually applies to C in general and not just PM programming). Except for type void, these data types may also be modified by preceding them with modifiers such as long, short, signed, unsigned to name a few. When programming for PM in C there is no end to data types, but as it turns out most are simple types that are typedef'd to provide a more useful meaning to the type being used in a given situation. JOT simplifies this considerably, as there are far fewer data types defined. Likewise, there are far fewer functions as well. Unlike the situation with data types, however, the reduced number of functions results in limited capabilities from the programmers point of view and will require at some point, that the programmer either use C and standard PM functions or be satisfied with producing an application with limited use. However, since most custom programming jobs that we do are probably business-specific (accounting, inventory, database access etc) it's quite likely that JOT will suffice for the vast majority of your programming tasks.

JOT is intended to be used for interaction with GUI's. The programmer will design the interface using the Guidelines screen editor, and add JOT (or C) code to act on window events. When created, each window will have a general code module generated for it and JOT code will then be added to modify these code modules to get the desired behavior of the application. The general code module will most often be a function definition containing no code other than the function name, argument list, return type and an end statement. Code modules may also be created manually, outside of the GUI design process, to custom-design functions that might be called from one or more JOT code modules. Once the design is complete and the code modules have been modified, Guidelines will generate the files required (CPP, RC, MAK, DEF etc) by your compiler to generate the executable file. Note that when I say "window", I'm refering to any control, whether it be a frame window, button or MLE etc.

'Nuff said. Let's have a look at the components of JOT.

As with any language, understanding JOT requires a knowledge of its identifiers, keywords, statements, operators and so on. Let's begin by looking at some of the elements of JOT.

Elements of JOT

Comments in JOT begin with a ";" and are terminated at the end of the line on which they begin. Anything after the semi- colon is considered as being part of the comment. An exception is when the ";" is embedded in a string, in which case it is treated as part of the string and not as a comment.

Character Set consists of upper and lower case letters of the english alphabet (a..z, A..Z), numbers 0 to 9 and punctuation characters "( ) [ ] , . / ; " < > * _ - + = \" (not including the quotes). Any other characters may only be used in comments, character constants and strings.

Identifiers are sequences of letters and digits which must begin with a letter. They are not case sensitive, may be up to 32 characters in length and may consist of letters, digits and "_". Many identifiers are reserved as keywords and may not be used. Likewise, many C/C++ keywords are also reserved and may not be used as identifiers. I'll leave it to the reader to consult the documentation for a complete list.

Constants come in two flavours: literals and predefined. Literal constants include integer, real and string constants which may be defined by the programmer. Predefined constants include such things as color constants, presentation parameter constants, beep constants, message constants and some miscellaneous constants (such as Null, Pi, True etc.) to name a few.

Operators available in JOT include the usual arithmetic operators, such as */+-=<> etc., "( )" for grouping expressions or function parameters, [] for matrix elements, mod (modulus) and a few logical operators (and, not, or). Unfortunately, some of the neat C operators, such as "+=" and "-=" are not recognized unless included in C code.

Declarations and Definitions serve the same purpose as their C counterparts. The declaration establishes names and characteristics of functions and data, while the definition allocates storage for data or provides the body of functions (almost straight from the documentation).

Data Types used by JOT include:

CHAR and STRING : equivalent to char in C.
Floating Point
SREAL, REAL, LREAL: equivalent to float, double and long double respectively.
SHORT and LONG : equivalent to short and long in C.
same use as for C.
a C++ class used for arbitrary-precision numbers.
a JOT-specific type allowing access to an application window's methods, properties and events.
is used when defining external functions and indicates that the function will accept any structure as a parameter.
used for bitmaps and icon resources.
used to refer to application message boxes.
refers to a JOT code (action) module. Similar to a C++ function pointer.
contains information about a thread that the application has created.

In addition, the programmer can create new data types by use of the "struct" keyword. Structures are defined in the format:

struct structure_name

Structures are not enclosed in "{ }", lines are not terminated with ";" and the structure definition must end with an "end" statement.

Functions are defined in the following format:

type function(parameter list)

Where functions in JOT differ from C, is that they are not enclosed by { }, statements do not end with a ";" and they must terminate with the keyword "end". Variable scope is the same as C. Functions need not be declared by the programmer, as that is handled automatically by JOT, and function parameters may be passed by value or by reference.

Due to the large number of built-in functions, it would be impossible to cover all of them in one issue. I'm not even going to try. Know, however, that there are a lot of them and when I look at programming in JOT I'll illustrate quite a few of them.

Statements in JOT include most of the things you would expect, such as the famous "if endif" pair, "switch" and loop control stuff like "while", "for" etc., plus others. One you probably haven't come across though, is the "C:" statement. This statement must precede any C code that is present in the code module. The only difference between using C in a JOT code module vs. a C language file, is that the C code must be contained on one line. All other C programming rules apply.

Though I didn't cover it in this article, code may also be created in DLLs. This will be illustrated in an upcoming article on programming in JOT.

Overall, JOT doesn't differ a great deal from other high- level languages. The ability to define new functions, new data types from old, pass function parameters by reference or value and, if needed, fall back on C within the same code module, ensures that the programmer will be able to perform just about anything (programming related).

I've been finding that it's a very easy language to learn, and if I had to compare it to any other language in terms of difficulty, it would be BASIC. Like it or not, BASIC is one of the easiest programming languages around and JOT is not much more difficult. I think you'll agree when you see how an application is built from start-to-finish. Next time.

[It looks as if EDM/2 may have lost this column as of this installment. Ed]