CLARION (PROGRAMMING LANGUAGE)


'Clarion' is a 4GL programming language and Integrated Development Environment from SoftVelocity used to program database applications. It is compatible with ISAM, SQL and ADO data access methods, reads and writes several flat file desktop database formats including ASCII, CSV, DOS (Binary), FoxPro, Clipper, dBase, or all SQL RDBMS databases via ODBC, MS SQL Server, Sybase SQLAnywhere and Oracle through the use of accelerated native database drivers, and XML, Clarion can be used to output to HTML, XML, plaintext, and PDF, among others. As of the time of writing (2006), Clarion is on version 6.3.
Database access is simple to implement, and list box formatting can be handled with easy to use WYSIWYG (What you see is what you get) formatting windows.
One of the Clarion Development Environment's strong points is its use of "templates" which are used in conjunction with a code generator (named ''AppGen'') to produce much of the repetitive, time consuming code that is typically required when producing an application. An "embeditor" shows the developer the code that will be generated and embed points where the developer can enter their own hand-code in the context of the template generated code.
Templates are open for developers to modify to suit their needs increasing the flexibility of what can be done in Clarion. Also a number of companies including SoftVelocity produce and sell additional templates to supplement what is included with the Clarion product.
Development is underway at SoftVelocity of templates that generate Microsoft .NET code from Clarion applications, which will enable Clarion developers to provide .NET code to clients who need their projects to be developed in Microsoft technology.

Contents
History
Properties
Drawbacks
Code sample (Clarion for Windows)
Hello World
See also
External links

History


The first release of the Clarion language was a DOS product called Clarion 1.0 and was first released in April of 1986. Clarion was created by Bruce Barrington, the founder of healthcare HBO and Company (now McKesson), and a small team of developers. Barrington's goal was to create a language that would be compact and expressive, and would maximize the use of the memory-mapped screen of the IBM PC by creating a screen designer. Version 1 produced pseudocode; the initial release included a screen designer, an interpreter, an editor, and a debugger. Initially it supported databases composed of DAT files, Clarion’s proprietary, and quite flexible, ISAM file format. Bruce Barrington formed Barrington Systems and released version 1.0.
Clarion 1.0 required the use of a dongle, at a time when industry sentiment was turning against dongles, which was offset by the ability to create royalty-free applications. However the dongle was removed with the release of 1.1.
Version 2.0, released in May 1988, was known as Clarion Professional Developer, or CPD, and included a component called Designer, which incorporated a data dictionary. CPD generated Clarion code based on the contents of that dictionary and a template called a "model file." Because the model file was a text file, it could be modified (in limited ways) to create custom code. The model file was implemented with the "browse and form" paradigm, where data is initially displayed to the user in list box, and updating is done via a form called via buttons associated with the list. Designer created all the essential of the CRUD (create, read, update, delete) code, and developers could enhance functionality by inserting code at specified points in the generated code, or by hand-coding new procedures. Clarion Professional Developer also introduced Language Extension Modules (LEMs), that could extend the Clarion language using modules compiled in other languages that were built to the LEM format. Clarion Software and many third-party tool developers created LEMs for all purposes, including an extension for connecting to other databases such as dBase, Clipper and Paradox.
Clarion Professional Developer then became, among others, a popular database management environment.
CPD 2.x was a database solution with everything required for screens, reports, databases and help files. A version of Clarion 2.x for end-users, Clarion Personal Developer, was also released just for the business user creating his own personal applications. Around the same time period, Clarion released Clarion Report Writer. This was created as both a stand-alone product for end-users of Clarion Personal Developer and users of programs
written by developers with CPD, and as a built-in program bundled with Clarion Professional Developer version 2.1.
In 1991 Barrington licensed compiler technology from a small company called Jensen & Partners International (JPI).
JPI was founded in 1987 by Niels Jensen, who had earlier (1979 or 1981) been one of the founders of Borland. Philippe Kahn was the marketing personel who built Borland around the $99 Turbo Pascal compiler. Niels and his team were working on a new compiler technology at Borland when Philippe Kahn decided to buy Wizard C, and call it Turbo C. Niels and several other developers left Borland and started JPI, where they continued to work on their compiler technology, christened TopSpeed, which they bought from Borland for $1.7 million. All the TopSpeed compilers, including Pascal, C, C++ and Modula 2, created compatible binary code, so you could mix and match languages within a single application (a capability .NET would make mainstream a few decades later).
Clarion Database Developer 3.0 (CDD) was soon released. It was a revolutionary product adding many features and technology that could create programs with a “Windows like” CUA (Common User Access) user interface. Much of the CDD changes fit well into the Windows programming paradigm and laid the ground work for the future Clarion for Windows product.
The CDD IDE was completely new and based on the JPI IDE. It included many professional programmer quality tools: editor, project system, compiler, linker, visual debugger. Gone was the p-code of CPD. The JPI compiler for the Clarion language produced true machine code EXEs, LIBs and DLLs. Binaries could be compiled for Protected Mode allowing DOS programs to use extended memory breaking the 640KB barrier.
The Clarion 3.0 language was enhanced in many ways, e.g: new data types (CSTRING, PSTRING, DATE, TIME, USHORT, ULONG), file driver system (e.g. Btrieve, Clarion, Dbase, FoxPro, Paradox), queues (tables) were enhanced, screen processing was enhanced for CUA. Code generation by Models was replaced by “templates” that had more features and were extensible. This allowed generation of much more robust and complex code.
With all this new power came complexity. Many existing users found the transition to CDD difficult. CPD was simple and easy to use which attracted many non-programmers that could build programs by answering questions. CDD was more suited to professional programmers. Programs could still be developed as easily, but the size and vast features of the IDE made it appear complex.
The first 5 patch releases of CDD were buggy to the point of being unusable, which caused so many users to abandon the product that it was nearly a complete disaster for the company. Clarion kept working on CDD and by version 3.007 it was usable.
Version 3.1 named Clarion for DOS (CFD) was released in 1995. This proved much more stable, but by this time there was little interest in DOS development tools. A significant feature was the TopSpeed file driver, an ISAM file format allowing all indexes and multiple data files to be contained in one disk file.
During this time the relationship between Clarion Software and JPI grew closer, and on April 30, 1992, Clarion merged with JPI to form an entity which would eventually be called TopSpeed Corporation.
The employees at the TopSpeed Development Centre in London went to work on CDD and ironed out many of the bugs. And they went to work on the first release of Clarion for Windows, more commonly known as CW 1.0 (although later releases would drop the "for Windows" part of the name).
Clarion for Windows version 2 added object orientation to the language, including inheritance and interfaces. TopSpeed elected to skip the dreaded version number three (the official explanation was that CW 1.5 "should have been CW 2.0," so CW 2.0 "should have been CW 3.0", so let’s just call the next one version 4). Clarion 4 (no longer “Clarion for Windows”) also came with a new template set and class library called “ABC”. The original template set generated procedural code, which was becoming increasingly complex. The ABC template set generated far less code, and leveraged the class library, which contained most of the actual logic for windows, browses, forms, etc.
Clarion’s current release is 6.3. The IDE is still mainly a 16-bit tool. This 16-bit history produced some problems using current Windows technologies (ActiveX, OCX, COM, DOC, ...) however note that the series 6.x of Clarion produces native win32 executables (32-bit exes and/or dlls). Previous versions produced both 16-bit and 32-bit executables, the 16-bit support was dropped from the end-user product with version 6.0 of Clarion.
The next major releases of Clarion will be Clarion 7 (which is promised to have a 32-bit IDE) and Clarion.NET. Both products will share a new .NET-based IDE, which incorporates significant parts of a licensed version of the SharpDevelop environment.

Properties


The programming language is somewhat like a mix of Basic, Pascal, and Cobol. It avoids requirements like Pascal's requirement that every code block is contained in a begin-end block. Like Cobol, Clarion separates data declarations from code. The language was designed to make writing business database applications simple.
Clarion is somewhat unique from many mainstream languages in having data file access, window and report structures, and printing commands built into the language. This allows much more flexibility compared to using a report geenrator.

Drawbacks


Currently there is a lack of a 32 bit development environment that allows design time expression of OCXs or other COM components. The 16 bit development environment does not allow the developer to work on more than one application at a time and restricts certain functionality through the use of system modal windows. This limitation can be worked around under Windows NT by running the IDE in a separate memory space and changing the IDE setup to Multiuser developer. This allows multiple copies of the IDE to be running with different apps opens. Only one 32 bit build session (compile/link) can be running.
There are also limitations to the number of controls that can be populated in the IDE window or report formatter due to constraints imposed by memory pool size relative to 16 bit architecture. The 32 bit compiler can handle much larger structures. Along with the lack of being able to generate .Net, and being only capable of generating Win32 applications. However some of these drawbacks are due to be addressed in updated versions.

Code sample (Clarion for Windows)


Absmax PROCEDURE(LONG[,] a,
★ LONG OutMaxX,
★ LONG OutMaxY),LONG
! The absolute greatest element of the matrix is returned to caller as are its positions
! Call by address is done with the
★ similar to C
x LONG,AUTO ! Loop variable
y LONG,AUTO ! Loop variable
m LONG(0) ! Maximum return value
CODE
OutMaxX = 1
OutMaxY = 1
LOOP x = 1 TO MAXIMUM(a[],1) BY 1
LOOP y = 1 TO MAXIMUM(a[],2) BY 1
IF ABS(a[x, y]) > m
m = ABS(a[x, y])
OutMaxX = x
OutMaxY = y
END
END
END
RETURN m

Hello World


The simplest way to achieve this is with the built in message function that is similar to the windows MsgBox().
PROGRAM
CODE
MESSAGE('Hello World!','Clarion')
RETURN
Here is another, requiring only a minimum of code. This example opens a window in the program and use ACCEPT to handle the events.
PROGRAM
Window WINDOW('Clarion'),AT(,,124,72),GRAY
STRING('Hello World'),AT(21,26),USE(?String1)
BUTTON('Close'),AT(76,53,45,14),USE(?Button1),STD(STD:Close)
END
Code
Open(Window)
Accept
End
RETURN
A more real world example uses a Clarion structure to declare a window and the Clarion Accept loop to process events from that window.
PROGRAM ! Declares this is a main program procedure
MAP ! Determines which procedures will be called
HelloProcedure ! This is a procedure
HelloFunction,STRING ! This is a function, that returns a string
ArgumentFunction( LONG pArg ),STRING ! This is a function that receives an argument
END
CODE
HelloProcedure ! Executes the procedure
MESSAGE( HelloFunction() ) ! Executes the function, as an argument to the MESSAGE
MESSAGE( ArgumentFunction( 4 ) ) ! The MESSAGE is an internal function, a message dialog
RETURN ! Explicitly ends the program
HelloFunction PROCEDURE ! The compiler spots the difference, based on the MAP
CODE
RETURN 'Hello, world!' ! This is how one returns a value
ArgumentFunction PROCEDURE( LONG pArg )
CODE
RETURN pArg
★ 2 ! Clarion does automatic type conversion
HelloProcedure PROCEDURE
Window WINDOW('Clarion for Windows'),AT(,,222,116), |
FONT('Tahoma',8,,FONT:regular),ICON('Hey.ICO'),SYSTEM,GRAY
STRING('Hello World!'),AT(91,22),USE(?String1)
BUTTON('Close'),AT(92,78,37,14),USE(?CloseBtn)
END
CODE ! Marks the beginning of executable code
OPEN( Window ) ! Opens the Window structure
ACCEPT ! Main keyboard/mouse reading loop
CASE EVENT() ! Any event was raised?
OF EVENT:Accepted ! Was it a control being accepted?
CASE FIELD() ! If so, which control generated the event?
OF ?CloseBtn ! the Close button generated that
BREAK ! We just need to break the accept loop
END ! End the control test branch
END ! End the event test branch
END ! End of the accept loop
! In Clarion, when a procedure leaves, it automatically closes
! any opened windows, but we're closing it by hand here, for the
! sake of the example
CLOSE(Window)
! In Clarion, there's implicit RETURN when a procedure reaches the end
! but we're returning by hand here, for the sake of the example
RETURN

See also


Modula-2

External links



SoftVelocity

This article provided by Wikipedia. To edit the contents of this article, click here for original source.

psst.. try this: add to faves