Contributed works of Grigory Filatov
Download / Install
There are multiple news, discussion and mail groups about Clipper, Harbour and HMG. Surely, if you search, you will find more convenient to your needs. There are also a lot of individual web sites where you can obtain useful information on the subject.
Clipper is procedural and imperative Programming language created in 1985 by Nantucket Corporation and sold later to Computer Associates, the one commercialized that it like CA-Clipper. At first Clipper was created as Compiler for the managing system interpreter of data bases dBase III (in fact seasonal versions of Nantucket included a label indicated that it thus), but with time the product evolved and matured, becoming a compiled language more powerful than the original one, not only by its own implementations but also by the extensions developed by third parties in C, Assembly and Pascal, of which it was inheriting characteristic. This turned into the tool leader of development of applications of relational databases under operating system MSDOS, mainly programs of management, accounting and invoicing ( SAGE – SP, leader of the Spanish market, uses for Contaplus and FacturaPlus ), commercial agendas and programs of pricing (approximately 80% of the insurance agencies of Spain used it in the programs of their agents).
Unlike other x-Base languages, Clipper never counted on a way Interpreter, similar to the one of dBase . Its utilities for handling of Base of data, such as the one of creation of tables (DBF), they gave with the source code written in Clipper and including, the user could adapt them to his needs if he wanted. They also contributed to many routines written in C and Assembly to which the user could go, to extend and even to create libraries of pre-connects complete.
Clipper works in way pure Compiler generating an object code binary; the package also provided a connector (RTLINK or DLINK) that with the object module and the libraries of pre-connects generated ejecuble a module direct. This last one granted to the Clipper applications a speed to him that other managers of data bases did not own, and, like disadvantage, the necessity to recompilar and to connect again whenever some error in the source code was corrected ( Purification was slow).
It owns characteristics that were very attractive for their time and its surroundings of work (TWO), such as: own handling of Virtual memory ( ram in disc); handling of extended memory, the applications could overcome the barrier of 640Kb of ram imposed by MSDOS ; routines and libraries can be only loaded when they are necessary and they unload of ram when no longer they make lack (it connects and overlays dynamic); the amount of registries by tables only was limited the capacity of the disc; great robustness in the applications, particularly in the designed ones for client-servant (network LAN), etc.
Although it did not own practically calculation functions such as the trigonometrical ones, that other languages like FoxPro if they incorporated; the user them could easily elaborate in C and use them like any other function of own bookstore of the package, advantage that happened of which the Clipper compiler and many of their libraries were almost completely developed in C .
Its form, administration, storage and interchange of screens were simple, effective and quick; what good dynamism to the applications developed with Clipper granted.
The language in if he were powerful, counting with a great amount of sentences, functions, memory management and variables that allowed to the programmer very flexible and efficient developments; in reasonably fast form. Also the package included complete “manual in line navegable”, that ram was loaded in memory, to requirement of the programmer, and it was acceded by the single pressure of a pair of keys.
At his long time sea bream, it has been, probably, the language relational database manager of ” low and medium porte” more used in the world. Today many Clipper developers even exist (some grouped communities and with forums in Internet), that make applications, style Windows, even using their own graphical libraries written in C and Assembly .
The first versions denominate seasonal versions to make reference to a station of the year in their official names. All of them name like dBASE compilers . These were:
Clipper 5.0 supposes a qualitative jump of the language, although it begins bad. Given the increasing popularity (Summer 87 has been used until the year 2000 like development tool), it is decided to concentrate more in extending the language that in being improved compiler of dBase. They are implemented therefore pseudo-objects and other improvements… but the product sends with numerous bugs that make that the objective public dissuades itself and continues using the Summer87 version, much more stable. The 5,01 correct many of the problems, but it will not be until the 5,2 that take place upsets massive of the developers.
Versions 5 of Nantucket are:
The American multinational Computer Associates acquires Nantucket and it is sent to improve the product strengthening the inherited characteristics of C, in particular the data type code-block (literally code block, a hybrid between macros of dBase, the evaluation of chains of characters and the leaders of functions). Another one of the improvements coming from version 5.0 is the system “Replaceable Drivers” Database; (RDD or basic drivers replacable of data), that allows with a single sentence to change between different basic norms from data. The appearance of version 5.2, with a frenetic race of subversions (with improvements and correction of errors) until 5.2c, that marks the beginning of the massive migration of those who still remained in Summer’87. The version of used Clipper of history happens more therefore. Contrary, her successor, 5,3, in spite of implementing improvements, falls in a bulk error, when not considering the compatibility with at least the most popular libraries of Clipper (as much commercial as freeware), and to consume excessive resources of TWO.
Computer Associates decides to leave Clipper before the might of Microsoft Windows, and overturns part of the development of Clipper ( project Reels of Nantucket) to its new tool CA-Line of vision Objects, that appears at the same time as 5.3 almost Clipper but the abandonment of the syntax x-Base and not to provide a tool with adapted migration, together with the high price of the product (that in addition debia to compete with other products of the own house, one of them based on BASIC ), causes that the thickness of Clipper programmers chooses to remain in versions 5.3 with libraries of third parties like FiveWin, or migrate to tools x-Base like Visual FoxPro as market TWO is reduced.
22 of April of 2002 Computer Associates and GrafX Software announces that they have reached an agreement of licensing, marketing and development of two of its languages of development: CA-Clipper and CA-Line of vision Objects.
One of the main characteristics that helped the success of Clipper was the possibility of expanding the language with routines in C and ensablador. Several of them, as CodeBase or Apollo is RDDs. With the appearance of Windows several of them were developed to carry the Clipper applications to Windows. Most popular she is the FiveWin Spanish, employee in products leaders of accounting in Spain.
In addition, the use of linkers alternative allowed to improve the generated yield of the feasible one. The most acclaimed it was Blinker, that adds a extensor of with TWO protected mode (it is used with numerous languages and compilers). It added support to compile programs and libraries for Windows.
At present the Clipper language is actively being implemented and being extended by several projects and salesmen. Between the projects of free Software we can emphasize Paper clip, Harbor and XHarbour . Between the commercial compilers XBase++ and Visual FlagShip. And Other products like ” MEDIATOR” that they offer the possibility him of connecting itself to relational Database servers like MS-SQL, MySQL and Oracle.
XBase++ has been called the Clipper Compiler of 32 bits, being at the moment the leader in innovations and incorporations to the language. Or they have been sold more than 25,000 copies of the compiler and they use from solitary developers to great companies like Hewlett-Packard or the Government of Canada.
Several of those implementations are portable thanks to their development in C ( TWO, Windows, Linux (32 and 64 bits), Unix (32 and 64 bits), and Mac OS X ), supporting several extensions of the language; they count on several extensions of the language, and several Replaceable Drivers Database (RDD) that the most popular formats of tables support, like DBF, DBTNTX, DBFCDX ( FoxPro and Comix), MachSix (Apollo), SQL, and more. All these new implementations maintain the complete compatibility with the standard x-Base sintax , at the same time as and syntax oriented to the destiny like SQLExecute()offer Object-oriented programming .
At the moment there is a free version, the Harbor Project that it has like original objective to be 100% compatible one with version 5.2 (most popular of the versions of Clipper), also are addition new characteristic like support for SQL through SQLite. Harbor is available for multiple platforms, including not only MSDOS and Windows, but also to Linux, OS/2 and others. In the month of August of the 2008 the launching of version 1.0 announced officially.
In 2005, Newsgroup of Usenet regarding Clipper comp.clipper and comp.visual-objects follow assets.
Simple Hello world :
? ” Hello World! “
A simple mask of entrance of Base of data :
USE Customer SHARED NEW
clear screen @ 1, 0 SAY "CustNum" GET Customer->CustNum PICT "999999" VALID Customer->CustNum > 0 @ 3, 0 SAY "Contact" GET Customer->Contact VALID !empty(Customer->Contact) @ 4, 0 SAY "Address" GET Customer->Address READ
Note : This article Gathered from here.
Harbour is a modern computer programming language. It is a Clipper-compatible compiler which is cross-platform, running on many operating systems (DOS, Microsoft Windows, Linux, Unix variants, several BSD descendants, Mac OS X, MINIX 3, Windows CE, Pocket PC, Symbian, iPhone, QNX, VxWorks, OS/2/eComStation, BeOS/Haiku, AIX) using the same source code and databases.
Although it is a powerful general-purpose programming language, it was primarily used to create database/business programs. Harbour have been actively maintained looking for diversity keeping backward-compatible with Clipper style. It has undergone many changes and revisions and regain widely popularity amongst programmers in 1980s and 1990s
The open source Harbour license is similar to the GNU General Public License, with an exception supporting proprietary applications, so proprietary applications can be produced with Harbour and distributed..
|Paradigm(s)||multi-paradigm: imperative, functional,object-oriented, reflective|
|Designed by||Antonio Linares|
|Developer||Viktor Szakáts and community|
|Stable release||3.0.0 (17 July 2011)|
|Preview release||3.1.x available from SVN|
|Typing discipline||optionally duck, dynamic, safe, partially strong|
|Dialects||Clipper, Xbase ++, Flagship, FoxPro, xHarbour|
|Influenced by||dBase, Clipper|
|License||Open source GPL Compatible|
|Usual filename extensions||.prg, .ch, .hbs, .dbf|
The idea of a free software Clipper compiler has been floating around for a long time and the subject has often cropped up in discussion on comp.lang.clipper. Antonio Linares founded the Harbour project and the implementation was started.
Sailing the Clipper ship to a Harbour port. Clipper is a type of ship. Harbour is a synonym to port (where ship docks) Harbour is out port to the Clipper language.
On 2009 Harbour had a huge make over on its design promoted mainly by Viktor Szakáts and Przemyslaw Czerpak
Harbour extends the Clipper Replaceable Database Drivers (RDD) approach. It offers multiple RDDs such as DBF, DBFNTX, DBFCDX, DBFDBT and DBFFPT. In Harbour multiple RDDs can be used in a single application, and new logical RDDs can be defined from combination of other RDDs. The RDD architecture allows for inheritance, so that a given RDD may extend the functionality of other existing RDD(s). Third-party RDDs, like RDDSQL, RDDSIX, RMDBFCDX, Advantage Database Server, and Mediator exemplify some of the RDD architecture features. DBFNTX implementation has almost same functionality of DBFCDX and RDDSIX. NETIO and LetoDB provide remote access over TCP protocol Harbour also offers ODBC support by means of an OOP syntax, and ADO support by means of OLE. MySQL, PostgreSQL, SQLite, Firebird, Oracle are examples of databases which Harbour can connect.
xBase technologies often is confused with a RDBMS software. Although this is true, xBase is more than a simple database system as the same time xBase languages using purely DBF can not provide full concept of a real RDBMS
Unlike Java which is intended to be write once, run anywhere, Harbour aims to be write once, compile anywhere. As the same compiler is available for all of the above operating systems, there is no need for recoding to produce identical products for different platforms, except when operating system dependent features are used. Cross-compiling is supported with MinGW32. Under Microsoft Windows, Harbour is more stable but less well-documented than Clipper, but has multi-platform capability and is more transparent, customizable and can run from a USB flash drive.
Under Linux and Windows Mobile, Clipper source code can be compiled with Harbour with very little adaptation. Most software originally written to run on Xbase ++, Flagship, FoxPro, xHarbour and others dialects can be compiled with Harbor with some adaptation. As 2010 many efforts have been made to turn the transition from other xBase dialects easier.
Harbour can make use of multiple Graphic Terminal emulations, including console drivers, and Hybrid Console/GUIs, such as GTWvt, and GTWvg.
Harbour supports external GUIs, free (e.g. HWGui, MiniGUI and Qt) and commercial (e.g. FiveWin, Xailer). HBQt is a library provinding bindings to Qt. HBIDE application included in official distribution and SVN repository is a sample of HBQt potencial.
Harbour is 100% Clipper-compatible and supports many language syntax extensions including greatly extended run-time libraries such as OLE, Blat, OpenSSL, FreeImage,GD, TIP, Tpathy, PCRE, HbZip (zlib and bzip2), cURL, Cairo, its own implementation of CA-Tools and NanFor libraries and many others. Harbour has an active development community and extensive third party support.
Any xBase language provides a very productive way to build business and data intensive applications. Harbour is not an exception.
One of the most powerful features of xBase languages is the Macro Operator ‘&’. Harbour’s implementation of the Macro Operator allows for runtime compilation of any valid Harbour expression. Such a compiled expression may be used as a VALUE, i.e. the right side of an assignment (rvalue), but more interestingly, such a compiled expression may be used to resolve the left side (lvalue) of an assignment, i.e. PRIVATE, or PUBLIC variables, or a database FIELD.
Additionally, the Macro Operator may compile and execute function calls, complete assignments, or even list of arguments, and the result of the macro may be used to resolve any of the above contexts in the compiled application. In other words, any Harbour application may be extended and modified at runtime to compile and execute additional code on-demand.
Latest Macro compiler can compile any valid Harbour code including code to pre-process before compile.
&( ... )
The text value of the expression ‘…’ will be compiled, and the value resulting from the execution of the compiled code is the result.
is the short form for &( SomeId ).
is the short form of &( SomeId + “postfix” ).
Programming in an OOP style is a broader issue than a specific library or a specific interface, but OOP programming is something many Clipper programmers have come to expect. CA-Clipper 5.2 and especially 5.3 added a number of base classes, and a matching OOP syntax. Libraries such as Class(y), Fivewin, Clip4Win, and TopClass provide additional OOP functionality.
Harbour has OOP extensions with full support for classes including inheritance, based on Class(y) syntax. OOP syntax in Harbour is very similar to that of earlier Clipper class libraries so it should be possible to maintain legacy Clipper code with minimal changes.
Harbour as every xBase language is case insensitive and can optionally accept keywords written just by first four characters
Harbour has 6 scalar types : Nil, String, Date, Logical, Number, Pointer, and 4 complex types: Array, Object, CodeBlock, and Hash. A scalar holds a single value, such as a string, number, or reference to any other type. Arrays are ordered lists of scalars or complex types, indexed by number, starting at 1. Hashes, or associative arrays, are unordered collections of any type values indexed by their associated key, which may be of any scalar or complex type.
Literal (static) representation of scalar types:
Complex Types may also be represent as literal values:
Hashes may use any type including other Hashes as the Key for any element. Hashes and Arrays may contain any type as the Value of any member, including nesting arrays, and Hashes.
Codeblocks may have references to Variables of the Procedure/Function>method in which it was defined. Such Codeblocks may be returned as a value, or by means of an argument passed BY REFERENCE, in such case the Codeblock will “outlive” the routine in which it was defined, and any variables it references, will be a DETACHED variable.
Detached variables will maintain their value for as long as a Codeblock referencing them still exists. Such values will be shared with any other Codeblock which may have access to those same variables. If the Codeblock did not outlive its containing routine, and will be evaluated within the lifetime of the routine in which it is defined, changes to its Detached Variables(s) by means of its evaluation, will be reflected back at its parent routine.
Codeblocks can be evaluated any number of times, by means of the Eval( BlockExp ) function.
All types can be assigned to named variables. Named variable identifiers are 1 to 63 characters long, start with [A-Z|_] and further consist of the characters [A-Z|0–9|_] up to a maximum of 63 characters. Named variables are not case sensitive.
Variables have one of the following scopes:
LOCAL and STATIC are resolved at compile time, and thus are much faster than PRIVATE and PUBLIC variables which are dynamic entities accessed by means of a runtime Symbol table. For this same reason, LOCAL and STATIC variables are not exposed to the Macro compiler, and any macro code which attempts to reference them will generate a runtime error.
Due to the dynamic nature of PRIVATE and PUBLIC variables, they can be created and destroyed at runtime, can be accessed and modified by means of runtime macros, and can be accessed and modified by Codeblocks created on the fly.
[DO] WHILE ConditionExp ... [LOOP] [EXIT] END[DO] FOR Var := InitExp TO EndExp [STEP StepExp] ... [LOOP] [EXIT] NEXT FOR EACH Var IN CollectionExp ... [HB_EnumIndex()] [LOOP] [EXIT] NEXT
In the FOR statement, the assignment expression is evaluated prior to the first loop iteration. The TO expression is evaluated and compared against the value of the control variable, prior to each iteration, and the loop is terminated if it evaluates to a numeric value greater than the numeric value of the control variable. The optional STEP expression is evaluated after each iteration, prior to deciding whether to perform the next iteration.
In FOR EACH, the Var variable will have the value (scalar, or complex) of the respective element in the collection value. The collection expression, may be an Array (of any type or combinations of types), an Hash Table, or an Object type.
IF CondExp ... [ELSEIF] CondExp ... [ELSE] ... END[IF]
… represents 0 or more statement(s). The condition expression(s) has to evaluate to a LOGICAL value.
Harbour supports a SWITCH construct inspired by the C implementation of switch().
SWITCH SwitchExp CASE LiteralExp ... [EXIT] [CASE LiteralExp] ... [EXIT] [DEFAULT] ... END
BEGIN SEQUENCE ... [BREAK] [Break([Exp])] RECOVER [USING Var] ... END[SEQUENCE]
BEGIN SEQUENCE ... [BREAK] [Break()] END[SEQUENCE]
The BEGIN SEQUENCE structure allows for a well behaved abortion of any sequence, even when crossing nested procedures/functions. This means that a called procedure/function, may issue a BREAK statement, or a Break() expression, to force unfolding of any nested procedure/functions, all the way back to the first outer BEGIN SEQUENCE structure, either after its respective END statement, or a RECOVER clause if present. The Break statement may optionally pass any type of expression, which may be accepted by the RECOVER statement to allow further recovery handing.
Additionally the Harbour Error Object supports canDefault, canRetry and canSubstitute properties, which allows error handlers to perform some preparations, and then request a Retry Operation, a Resume, or return a Value to replace the expression triggering the error condition.
Alternatively TRY [CATCH] [FINALLY] statements are available on xHB library working like the SEQUENCE construct.
[STATIC] PROCEDURE SomeProcedureName [STATIC] PROCEDURE SomeProcedureName() [STATIC] PROCEDURE SomeProcedureName( Param1' [, ParamsN] ) INIT PROCEDURE SomeProcedureName EXIT PROCEDURE SomeProcedureName [STATIC] FUNCTION SomeProcedureName [STATIC] FUNCTION SomeProcedureName() [STATIC] FUNCTION SomeProcedureName( Param1' [, ParamsN] )
Procedures/Functions in Harbour can be specified with the keywords
FUNCTION. Naming rules are same as those for Variables (up to 63 characters non case sensitive). Both Procedures and Functions may be qualified by the scope qualifier STATIC to restrict their usage to the scope of the module where defined.
The INIT or EXIT optional qualifiers, will flag the procedure to be automatically invoked just before calling the application startup procedure, or just after quitting the application, respectively. Parameters passed to a procedure/function appear in the subroutine as local variables, and may accept any type, including references.
Changes to argument variables are not reflected in respective variables passed by the calling procedure/function/method unless explicitly passed BY REFERENCE using the@ prefix.
PROCEDURE have no return value, and if used in an Expression context will produce a NIL value.
FUNCTION may return any type by means of the RETURN statement, anywhere in the body of its definition.
An example procedure definition and a function call follows:
x := Cube( 2 ) FUNCTION Cube( n ) RETURN n ** 3
Sample code The typical “hello world” program would be:
? "Hello, world!"
QOut( "Hello, world!" )
Alert( "Hello, world!" )
Or, enclosed in an explicit procedure:
PROCEDURE Main() ? "Hello, world!" RETURN
#include "hbclass.ch" PROCEDURE Main() LOCAL oPerson := Person( "Dave" ) oPerson:Eyes := "Invalid" oPerson:Eyes := "Blue" Alert( oPerson:Describe() ) RETURN CLASS Person DATA Name INIT "" METHOD New() CONSTRUCTOR ACCESS Eyes INLINE ::pvtEyes ASSIGN Eyes( x ) INLINE IIF( ValType( x ) == 'C' .AND. ; x IN "Blue,Brown,Green", ::pvtEyes := x,; Alert( "Invalid value" ) ) // Sample of IN-LINE Method definition INLINE METHOD Describe() LOCAL cDescription IF Empty( ::Name ) cDescription := "I have no name yet." ELSE cDescription := "My name is: " + ::Name + ";" ENDIF IF ! Empty( ::Eyes ) cDescription += "my eyes' color is: " + ::Eyes ENDIF ENDMETHOD PRIVATE: DATA pvtEyes ENDCLASS // Sample of normal Method definition. METHOD New( cName ) CLASS Person ::Name := cName RETURN Self
All tools are multiplatform.
Today Habour development is leading by Viktor Szakáts with huge collaborations and leading many components of core and contribs by Przemysław Czerpak. HBIDE and some components, specially HBQt, are developed by Pritpal Bedi. Others members send minor changes to the Sourceforge SVN repository. As 2010 Harbour development is keeping vibrant activity
Although there is no way to measure popularity of Harbour or xBase, the TIOBE Programming Community Index As of June 2006 ranked Microsoft Visual FoxPro, a high profile dialect of xBase, on 12th position on programming languages popularity ranking. FoxPro/xBase ranked on 25th position As of August 2010. As of September 2010, the Clipper Usenet newsgroupscomp.lang.clipper is still active. As of August 2010 Harbour figured on 16th position on weekly downloads in compiler category and 132th position on global rank.
xHarbour is a fork of the earlier Harbour project. xHarbour takes a more aggressive approach to implementing new features in the language, while Harbour is more conservative in its approach, aiming first of all for an exact replication of Clipper behaviour and then implementing new features and extensions as a secondary consideration. It should also be noted that Harbour is supported on a wide variety of operating systems while xHarbour only really supports MS Windows and Linux 32-bit.
The Harbour developers have attempted to document all hidden behaviour in the Clipper language and test Harbour-compiled code alongside the same code compiled with Clipper to maintain compatibility.
The Harbour developers explicitly reject extensions to the language where those extensions would break Clipper compatibility. These rejections were soften recently since the new Harbour architecture allow extensions out of the core compiler.
A detailed comparison between extensions implemented in Harbour and xHarbour can be found in SVN repository of the project on SourceForge.
As of 2009–2010, Harbour has seen a huge increase in its adoption while xHarbour decline as can be seen on his mailing list
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Note : This post borrowed by curtesy of Vikipedia from here : http://en.wikipedia.org/wiki/Harbour_(software)