Harbour for beginners
Alexander Kresin2003 - 2016
Thanks to so-called "Extend system" you can connect the modules written in C, the prgmodule, written in Harbour, which makes it possible to use a large number of different tools programming in C API. Many of these modules are located in the Harbour/contrib, many are available from the manufacturer's site and Open source repositories as so called 3-rd party library. In fact, the significant part of functions, modules of the Harbour is written in C, and uses the same "Extend system".
Below is a list of what is included in the Harbour/contrib at the time of writing this article:
- gtalleg based on Allegro display (GT) driver
- gtqtc - screen (GT) driver, based on QT
- gtwvg - screen (GT) driver for Windows, I would said - advanced gtwvt, somewhere between the console and the GUI
- hbamf binding library AmFastperhaps someone familiar
- hbblat - based on Blat command-line utility to send mail to SMTP Protocol
- hbblink - a set of functions familiar to those who enjoyed the linker Blinker
- hbbz2 - support of a bzip compression, based on a BZip2 library.
- hbbz2io - I/O driver for BZIP2 compressed streams.
- hbcairo - a set of wrapper functions for Cairo. Cairo is a cross-platform library for creating 2D vector graphics, written in C. It is bound to Python, Perl, Java, C++, C#, work on Linux, the BSDs, OSX, Windows
- hbcomio - I/O driver for serial port streams
- hbcomm is a small library for COM-ports, is based on hb_com... functions of Harbour
- hbct - implementation of a Clipper Tools library - well known to all who wrote in Clipper.
- hbcups - small set of functions to Cups (printer default, the list of printers, print a file on the specified printer)
- hbcurl interface to a Curl library.
- hbexpat interface to a Expat library - free XMLparser
- hbfbird - library to access popular SQL DBMS Firebird
- hbfimage - a set of wrapper functions for graphics library FreeImage
- hbformat utility for formatting prg files
- hbfoxpro - small set of functions and headers for compatibility with Foxpro
- hbfship - a set of functions for compatibility with Flagship
- hbgd - a set of wrapper functions for graphics library GD
- hbgs - multiple functions for Ghostscript
- hbgt - a set of string functions
- hbgzio - I/O driver for GZIP compressed streams
- hbhpdf - interface to Libharu - library to create a pdffiles
- hbhttpd - http server written in Harbour
- hblzf - a set of wrapper functions for data compression library LZF
- hbmagic - a set of wrapper functions for Libmagic library (recognition of files)
- hbmemio - driver for file operations in RAM
- hbmisc - a set of different functions
- hbmlzo - a set of wrapper functions for data compression miniLZO library
- hbmxml - a set of wrapper functions for miniXML library
- hbmysql library to access popular SQL DBMS MySQL
- hbmzip - hbmzip - support of a zip compression, based on a Minizip library
- hbnetio - alternative implementation of input-output of RDD enabled RPCredirect execution of operations with the database on the server that includes client and server parts
- hbnf - realization of a known to all who wrote in Clipper, library Nanfor
- hbodbc - library to access data via ODBC
- hboslib - Small set of functions of oslib
- hbpgsql - library to access popular SQL DBMS postgreSQL
- hbpipeio - I/O driver for PIPE streams
- hbrun - utility hbrun, look here
- hbsms is a library for sending sms
- hbsqlit3 - a set of wrapper functions for SQLite library
- hbssl - interface to the OpenSSL API
- hbtcpio - I/O driver for TCP streams
- hbtest - Regression tests for the runtime library
- hbtinymt interface to the tinyMT - a generator of pseudorandom numbers
- hbtip - set of classes based on INETsubsystem that implements ftp, http, pop3 and other protocols
- hbtpathy - implementation of the popular library for serial ( COM ports Telepathy
- hbunix - small set of functions for Unixsystems
- hbwin - a set of functions for communication with the Windows API, including implementation of OLE
- hbxdiff - a set of wrapper functions for library libXDiff
- hbxpp - set function for compatibility with xBase++
- hbzebra - library Zebra ( barcodes )
- hbziparc - a functions set, which is intended for compressing/uncompressing files in zip format
- rddads - RDD for Advantage Database Server
- rddbm - BMDBF RDD
- rddsql - simple RDD for SQL DBMS
- sddfb - RDD for Firebird
- sddmy - RDD for MySQL
- sddoci - RDD for Oracle through OCILIB
- sddodbc - RDD for ODBC
- sddpg - RDD for postgreSQL
- sddsqlt3 - RDD for SQLite
- xhb - a set of functions and classes for compatibility with xHarbour
I want to note that not all of these modules are fully ready for use, some are on initial stage.
hbbz2
This library include a set of wrappers for a BZip2 library, it implements a text strings compression / uncompression.
To build programs with hbbz2 you should add bz2 and, of course, hbbz2 itself in your link script.
Functions list:
cCompressed := hb_bz2_Compress( cData, [nDstBufLen|@cBuffer], [@nResult], [nLevel] ) | Compresses a text string cData, using a compression levelnLevel (0 - 9, 6 by default). |
cUnCompressed := hb_bz2_UnCompress( cCompressed, [nDstBufLen|@cBuffer], [@nResul>] ) | Uncompresses a conpressed text string cCompressed. |
hbbz2io
This library implements an I/O driver for BZIP2 compressed streams, it may be used in File IO API functions ( hb_vf*() ) and in transfer RDDs, such as SDF and DELIM.
To build programs with hbbz2io you should add hbbz2, bz2 and, of course, hbbz2io itself in your link script. There must be a following line in a program:
REQUEST HB_BZ2IO
Now, if to write a prefix "bz:" or "bgz[0-9]:" (0 - 9 - demanded compression level) before a file name, bz2io driver will be used, for example:
REQUEST HB_GZIO, HB_BZ2IO FUNCTION GZip2Bz2( cFile ) RETURN hb_vfCopy( "gz:" + cFile + ".gz", "bz:" + cFile + ".bz2" )
hbgzio
This library implements an I/O driver for GZIP compressed streams, it may be used in File IO API functions ( hb_vf*() ) and in transfer RDDs, such as SDF and DELIM.
To build programs with hbgzio you should add hbzlib and, of course, hbgzio itself in your link script. There must be a following line in a program:
REQUEST HB_GZIO
Now, if to write a prefix "bz:" or "bgz[0-9]:" (0 - 9 - demanded compression level) before a file name, gzio driver will be used, for example:
REQUEST HB_GZIO USE test COPY TO gz:test.txt.gz DELIMITED WITH TABor
REQUEST HB_GZIO hb_vfCopy( "file.txt", "gz9:file.txt.gz" ) USE test APPEND FROM "gz:file.txt.gz" hb_vfErase( "file.txt.gz" )or
REQUEST HB_GZIO FUNCTION GZIP( cFile ) RETURN hb_vfCopy( cFile, "gz:" + cFile + ".gz" )
hbmemio
This library implements an I/O driver for files, stored in RAM, it may be used in RDDs and with File IO API functions ( hb_vf*() ).
To build programs with hbmemio you should add hbmemio library in your link script. There must be a following line in a program:
REQUEST HB_MEMIO
Now, if to write a prefix "mem:" before a file name, memio driver will be used, for example:
REQUEST HB_MEMIO LOCAL i dbCreate( "mem:test", { { "F1", "N", 9, 0 } }, , .T., "memarea" ) FOR i := 1 TO 1000 dbAppend() FIELD->F1 := hb_Random() * 1000000 NEXT INDEX ON FIELD->F1 TAG f1 dbEval( {|| QOut( FIELD->F1 ) } ) dbCloseArea() /* Copy files to a disk */ hb_vfCopyFile( "mem:test.dbf", "test1.dbf" ) hb_vfCopyFile( "mem:test.ntx", "test1.ntx" ) /* Free memory */ dbDrop( "mem:test" )
hbmzip
This library includes wrapper functions for MiniZip and some additional functions to provide a higher level API for zip files.
To build programs with hbmzip you should add following libraries in your link script: hbzlib, minizip, and, of course, hbmzip itself.
Most likely, it will be more convenient to use hbziparc library - an API of a more high level :), a superstructure over hbmzip.
hbziparc
This library, based on hbmzip, provides a set of functions for packing / unpacking in zip - format.
To build programs with hbziparc you should add following libraries in your link script: hbzlib, minizip, hbmzip, and, of course, hbziparc itself.
Functions list:
lCompress := hb_ZipFile( cFile, cFileToCompress | aFiles, [nLevel],
[bBlock], [lOverWrite], [cPassword], [lWithPath], [lWithDrive], [pFileProgress] ) | Creates a zip file,
returns .T. in case of success. cFile - a name of the zip file to create, cFileToCompress | aFiles - a name of a file to Compress, or an array containing files to compress, nLevel - compression level ranging from 0 (no compression) to 9 (best compression), bBlock - a code block, which is executed once for each compressed file каждого файла для сжатия, it receives cFile and nPos parameters,lOverWrite - toggles to overwrite the file if exists, cPassword - password to encrypt the files, lWithPath - toggle to store the path or not (.F. by default), lWithDrive - toggles to store the drive letter or not (.F. by default), pFileProgress - a codeblock for file progress visualisation, it is something like this: {|nPos,nTotal| GaugeUpdate( aGauge1, nPos / nTotal ) } . |
lCompress := hb_UnzipFile( cFile, [bBlock], [lWithPath], [cPassWord], cPath,
cFileToExtract | aFile, [pFileProgress] ) | Unzip a compressed file, returns .T. in case of success. cFile - a name of the zip file to unpack, bBlock - a code block, which is executed once for each extracted file каждого файла для сжатия, it receives cFile and nPos parameters,lWithPath - toggles to create directory if needed, cPassword - a password to use to extract files, cPath - a path to extract the files to - mandatory, cFileToExtract | aFiles - a file or array of files to extract - mandatory, pFileProgress - a codeblock for file progress visualisation. |
lDelete := hb_ZipDeleteFiles( cFile, cFiletoDelete | aFiles | nFilePos ) | Deletes files from a zip archive, returns .T. in case of success. cFile - a name of a zip archive, cFileToExtract | aFiles - a file to be removed or an array of files to be removed. |
hb_SetZipComment( cComment ) | Sets a comment for a zip archive, it should be called before any of the compression function. |
cComment := hb_GetZipComment( cFileName ) | Returns a comment, stored in a zip file. |
hb_SetBuffer( [nWriteBuffer], [nExtractBuffer], [nReadBuffer] ) | Sets the size of the internal buffers for write/extract/read operations. Default values are 65535 / 16384 / 32768 respectively. |
lCompress := hb_ZipFileByTDSpan( cFile, cFileToCompress | aFiles, nLevel,
bBlock, lOverWrite, cPassword, iSize, lWithPath, lWithDrive,
pFileProgress) | Creates a zip file, divided to few parts,
returns .T. in case of success. The parameters are the same as in hb_ZipFile() and, additionally:iSize - a size n bytes, 1457664 by default. |
lCompress := hb_ZipFileByPKSpan( cFile, cFileToCompress | aFiles, nLevel,
bBlock, lOverWrite, cPassword, lWithPath, lWithDrive, pFileProgress ) | Creates a zip file on removable media,
returns .T. in case of success. |
nReturnCode := hb_ZipTestPK( cFileName ) | Test pkSpanned zip files, return code is:114 Incorrect Disk 103 No Call back was set with hb_ZipTestPK() |
hb_SetDiskZip( bBlock ) | |
nFiles := hb_GetFileCount( cFileName ) | Returns a number of files in a zip archive, including directories. |
hb_GetFilesInZip( cFileName [, lVerbose] ) | Returns an array with an information about files in a zip archive. If lVerbose is not passed, or it is .F. , this is a one dimensional array with files names,
if it is .T. - a two dimensional array with the following info for every file:
{ cFileName, nSize, nMethod, nCompSize, nRatio, dDate, cTime, hb_NumToHex( nCRC, 8 ), nInternalAttr, lCrypted, cComment }
|
Harbour in "pure" provides a means to create console programs; to implement graphical user interface ( GUI ) it is necessary to use additional libraries. Below are listed the most used.
- Fivewin is certainly number 1. The oldest known from the times of Clipper, having a big user base, and most feature-rich commercial library. There are versions for different platforms, including mobile phone.
- HwGUI - my library, it presents here on the website. Compact, functional, a freely available, cross platform - there is a version based on Windows API and one, based on GTK for Unixsystems.
- Minigui - a freely available library, unlike the others, is based on the use of arrays, not classes, but with the help of a preprocessor implements OOP-like syntax, which differs from the OOP syntax accepted in Harbour. At the current time there are two Minigui versions:
- ooHG - yet another free GUI library, which has the same syntax as Minigui, but is based on OOP.
- Qt wrapper based on the QT framework, it can be used on all platforms where QT exists.
Your name:
Email address:
(not be shown publicly)
  |