For reference: xBase is a family of programming systems, DBMS, originating from dBase (1980). They are united by a common programming language (of course, with variations inherent in a specific implementation) and tools for accessing relational databases of the DBF format built into this language. Actually, dBase began as a DBMS with a language designed for database maintenance. It is a procedural programming language, it belongs to the group of interpreted languages ​​and has many, if not all, of their generic features, such as, for example, dynamic typing.
Clipper, the immediate predecessor of Harbor, was created in 1985 with the goal of increasing dBase III performance. To do this, the source code of the program was converted at the compilation stage into a byte-code that was embedded in the executable file along with the virtual machine intended for the execution of this byte-code. Thus, Clipper produced a standalone exe file, which did not require an external interpreter to run and run, as in the case of dBase or FoxBase (another popular xBase product).
In the late 80s and early 90s, Clipper was very popular, it was one of the main programming tools for applications related to the use of databases, primarily accounting, management, banking. The language was upgraded from version to version, new subsystems were added. Among the latter, the Extend System and RDD should be especially noted. The Extend System (extension system) is designed to communicate with modules written in C — function calls, parameter passing, and return values. RDD - Replaceable Database Drivers (replaceable database drivers) is a technology that allows linking another standard special library to work with a different type of database, without changing a single line of code. This is how Clipper applications worked, for example, with Novell's Btrieve (if anyone remembers, there was such a client-server non-SQL DBMS).
')
XBase systems have always been perceived as intended primarily for working with databases and, possibly, with the increasing popularity of SQL, they began to go out of trend. And if everything was more or less well with Fox, Microsoft bought it and made a popular product Visual Foxpro based on it, which a few years ago (in 2006, according to Wikipedia), was in the 12th place on the
TIOBE list, Clipper's business was much worse. Computer Associates, which has owned it since the early 90s, has relied on other products. Clipper stayed away from the main road, the problems that were not resolved were not solved, and in 1997 Computer Associates announced the closure of its further development, leaving the programmers writing on it alone with the 16-bit programming system.
Many of those who thought about their future, migrated to other platforms, but those who believed that the advantages of Clipper, being realized in the modern programming environment, would be in demand even further, remained. Several such implementations were created (xBase ++, Clip, Harbor), one of which, the most successful for this day, I will give a speech - I ask you to forgive me for such a long, but, in my opinion, necessary introduction.
So, Harbor. The project started in 1999, the official site is
www.harbour-project.org . The current version is 3.0 (stable), 3.2 (development).
Like Clipper, Harbour translates the source code of the program into bytecode, but, unlike its predecessor, the Harbor compiler does not create object files, but
with files that need to be “fed” to the compiler. For example, this is the simplest function that displays a greeting on the console:
Function Hello ? "Hello" Return Nil
he broadcasts in (comments are mine):
Consider the byte code in more detail:
static const HB_BYTE pcode[] = { 36,2,0,
Your project may include source code on Harbor (
* .prg ), on C, special object files and libraries. Since the code can be embedded in the
prg file, it must be entered into
#pragma BEGINDUMP ...
#pragma ENDDUMP and, of course, it must comply with the EXTEND SYSTEM conventions (I mentioned it when I spoke about Clipper). Below is an example of such a symbiosis:
Function Main ? Sinus( 30 ), Sinus( 60 ) ? Return Nil #pragma BEGINDUMP #include <math.h> #include "hbapi.h" #include "hbapiitm.h" #define PI 3.14159265 // , HB_FUNC( SINUS ) { // hb_parnd( n ) - EXTEND SYSTEM, n- // double Harbour // hb_retnd( d ) - EXTEND SYSTEM, double d // Harbour hb_retnd( sin( hb_parnd( 1 ) * PI / 180 ) ); } #pragma ENDDUMP
It was not by chance that I paid so much attention to C in Harbor. Expanded (sorry for the involuntary tautology), compared with Clipper, Extend System and Item API, providing access from C code to Harbor's internal structures, its variables, arrays, objects, allows us to talk about the symbiosis of two languages, I consider this one of the most important features of Harbor . Due to this, the Harbor has already been “overgrown” with a large number of modules - shells for various products that have a C API and the list of such modules, both open source and commercial, is constantly growing (currently I am thinking about OpenCV). Of course, C is used in Harbor not only to create shells for finished products, but also for independent development - new RDD, GUI libraries, etc. Sometimes, in the context of some applications, I view Harbor as a shell for C code - to facilitate the implementation of the user interface , access to the database, etc.
Built-in access to the database, this generic feature of xBase, is another topic that you want to pay special attention to. It is, indeed, very convenient - to be able, without using external DBMS, with the help of only built-in language tools to produce all the necessary database manipulations - creation, modification, updating, editing, searching. In the case when the amount of information stored in the database is relatively small, using an external DBMS seems completely unnecessary, for such applications and MySQL looks like a monster (and some even put MS SQL on it) - xBase approach here looks like the most adequate solution. However, Harbor can also be used (and is used) quite successfully for large DBs.
I will cite a small piece of code that demonstrates typical data access constructs - for those who have not encountered xBase languages ​​before. Of course, the arsenal of tools for working with the database in Harbor is much richer than that used in these few lines.
Function Test Local aStru := { {"FAMILY","C",16,0}, {"IMYA","C",16,0}, {"OTCHES","C",16,0}, ; {"TELEFON","C",10,0} } // mytable dbCreate( "mytable", aStru ) // mytable USE mytable // INDEX ON FAMILY TAG FAMILY INDEX ON TELEFON TAG TELEFON // APPEND BLANK REPLACE FAMILY WITH "", IMYA WITH "", OTCHES WITH "", ; TELEFON WITH "9101682020" ... // , ordSetFocus( "TELEFON" ) IF dbSeek( "9101682020" ) // , REPLACE TELEFON WITH "9102875555" ENDIF ... Return Nil
Database access facilities are not limited to standard ones. There are RDDs written for client-server DBMSs, like DBF-based (commercial Advantage Database Server from Sybase and open source LetoDb), and SQL. There are modules that provide access through ODBC and ADO, there are modules for MySQL, PostgreSQL, SQLite, which use the C API of these DBMS.
Harbor has further developed all the features of Clipper, which made it a high-level language that is convenient to program — automatic allocation and freeing of memory, garbage collection, so-called raw arrays, the ability to compile and execute code fragments in run-time, in dynamics. Added full implementation of OOP. Preprocessor, retaining all the power of Clipper, expanded with some constructions taken from C. However, I will not list all the innovations here, but simply refer to the section of my site
Harbor for beginners .
Yes, I seem to have forgotten to say that Harbor is a cross-platform, open source system. It exists on 32-bit and 64-bit platforms, on Windows, Linux, Unix, Mac OS X, QNX, OS / 2, it seems, and on Android, and something else that I have not seen.
I would be glad if this article is of interest. In this case, it will be possible to consider some aspects in more detail.