Little JOBS and Big JOBS
Using Delphi 2.0 to control J 3.02 automation server OBjects

John D. Baker
J96 User Conference


OLE automation is a Windows operating system service that allows one application to automate or control the exposed objects of another application. OLE automation makes it possible for one application to efficiently use the facilities of others. This talk will show how Delphi 2.0 applications can use J's EXE and DLL automation servers.

Delphi 2.0 is a 32 bit Object Pascal client/server oriented visual programming environment that has attracted a large and loyal following. Many factors have contributed to Delphi's success. I would single out the following:

Delphi has many strengths but array processing is not one of them. Object Pascal has fixed the outrageous limitations imposed on arrays by early versions
of Pascal. For example in Object Pascal:

Be still my beating heart!

What is Delphi still missing?

J programmers could go on beating up on Delphi arrays but that's not the way to
win friends and influence people. Besides, J has its own limitations and weaknesses.

The glory of OLE automation is that it offers programmers an easy way to combine the strengths of different programming tools.

Together, Delphi and J, can easily do things that would require mountains of code in either one

Example JOBS
(J automation OBjectS)

There are many ways to use J automation servers from Delphi but most applications will be:

A Little JOB is a J automation server that contains few, if any, J words. A little JOB is basically a super array calculator. This is the way most Delphi programmers will use J.

A Big JOB is an automation server loaded with a large J system. J programmers can use Delphi to give their big JOBS a polished state-of-the-art Windows interface.

The remainder of this presentation will demonstrate examples of little and big JOBS.

Little JOB #1: Prime Factors

In this example I will program, from scratch, a simple Delphi/OLE/J application that computes the prime factors of the first 1000 integers and displays the results in a Delphi grid.

Little JOB #2: Sunrise and Sunset Times

This example will demonstrate the automation of a nontrivial, but easily understood, J array algorithm that computes the time of sunrise and sunset for any point on Earth.

Little JOB #3: Storing J Words In Delphi Databases

I will demonstrate a Delphi application that controls a J workspace. By clicking on a few controls entire J workspaces can be saved in Delphi
tables. A few more clicks will suffice to generate J scripts, on the fly, from database entries.

A Big JOB: Running a J macro-processor from Delphi

If time permits I will show how Delphi can control the execution of a large J application.

Finally: Caveats, Limitations and Gotcha's

New technologies are born with congenital defects. OLE automation, as it is currently supported by Delphi and J, has a few rough edges.