Content deleted Content added
Citation bot (talk | contribs) Add: website. | Use this bot. Report bugs. | Suggested by Whoop whoop pull up | #UCB_webform 732/3580 |
Jerryobject (talk | contribs) →Database support: WP:LINKs: update-standardizes, needless-WP:PIPEs > WP:NOPIPEs, adds. MOS:FIRSTABBReviations clarify, define before parenthetic WP:ABBRs. Small WP:COPYEDITs WP:EoS: WP:TERSE, clarify. |
||
(25 intermediate revisions by 17 users not shown) | |||
Line 1:
{{
{{
{{
{{
}}
{{Use dmy dates|date=June 2014}}
{{Infobox programming language
| name
| logo
| logo caption
| screenshot =
| paradigm = [[Multi-paradigm programming language|multi-paradigm]]: [[Imperative programming|imperative]], [[Functional programming|functional]], [[Object-oriented programming|object-oriented]], [[Reflective programming|reflective]]▼
| screenshot caption =
| year = {{Start date and age|1999}}▼
▲| paradigm
| designer = Antonio Linares▼
| family = [[xBase]]
| developer = Viktor Szakáts and community▼
| latest_release_date = {{Start date and age|df=yes|2011|07|17}}▼
| latest_preview_version = [https://sourceforge.net/projects/harbour-project/files/binaries-windows/nightly/ 3.2.0dev]▼
| latest release version = 3.0.0
| typing = Optionally [[duck typing|duck]], [[dynamic typing|dynamic]], [[type safety|safe]], partially [[strong typing|strong]]▼
| implementations =▼
▲|
| dialects = Clipper, Xbase++, FlagShip, FoxPro, xHarbour▼
▲| typing
| influenced = [[xHarbour]]▼
| operating system = [[Cross-platform software|Cross-platform]]
| license
| website
|
| wikibooks
| influenced by = [[dBase]], [[Clipper (programming language)|Clipper]]
}}
'''Harbour''' is a computer [[programming language]],
Harbour code
==
The idea of a free software Clipper compiler had been
In 2009, Harbour was substantially redesigned, mainly by Viktor Szakáts and Przemyslaw Czerpak.
==Database support==
Harbour extends the Clipper Replaceable Database Drivers (RDD) approach. It offers multiple RDDs such as [[
Harbour also offers [[ODBC]] support by means of an [[
▲Harbour extends the Clipper Replaceable Database Drivers (RDD) approach. It offers multiple RDDs such as [[DBASE|DBF]], DBFNTX, DBFCDX, DBFDBT and DBFFPT. In Harbour multiple RDDs can be used in a single application, and new logical RDDs can be defined by combining 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<ref>{{cite web|url=https://sourceforge.net/projects/letodb |title=LetoDB |publisher=Sourceforge.net |access-date=2013-12-09}}</ref> provide remote access over [[Transmission Control Protocol|TCP]] protocol.
[[xBase]] technologies
▲Harbour also offers [[ODBC]] support by means of an [[Object-oriented programming|OOP]] syntax, and [[ActiveX Data Objects|ADO]] support by means of [[OLE Automation|OLE]]. [[MySQL]], [[PostgreSQL]], [[SQLite]], [[Firebird (database server)|Firebird]], [[Oracle (database)|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.
==Programming philosophy==
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 of 2010 many efforts have been made to
Harbour can use the following C compilers, among others:
Line 57 ⟶ 56:
[[MinGW]],
[[Clang]],
[[Intel C++ Compiler
[[Microsoft Visual C++]] (6.0+),
[[Borland C++]],
[[Watcom C]],
[[Sun Studio (software)|Sun Studio]].
Harbour can make use of multiple
Harbour supports external
Harbour is 100% Clipper-compatible<ref>{{cite web|url=https://harbour.github.io/ |title=Official Harbour page |publisher=The Harbour Project |access-date=2013-12-09}}</ref> and supports many language syntax extensions including greatly extended run-time libraries such as [[OLE Automation|OLE]],
Any [[xBase]] language provides a very productive way to build business and data intensive applications. Harbour is not an exception.
===Macro
One of the most powerful features of xBase languages is the [[Macro (computer science)|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)
▲One of the most powerful features of xBase languages is the [[Macro (computer science)|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 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
The latest Macro compiler can compile any valid Harbour code including code to
Syntax:
Line 94 ⟶ 92:
is the short form of &( SomeId + "postfix" ).
===Object
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 [https://web.archive.org/web/20010501165630/http://appsolutions.com/Classy/ Class(y)],
▲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 [https://web.archive.org/web/20010501165630/http://appsolutions.com/Classy/ 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.
Line 106 ⟶ 103:
===Built-in data types===
Harbour has six scalar types
Literal (static) representation of scalar types:
Line 116 ⟶ 113:
Complex Types may also be represent as literal values:
* Array: <syntaxhighlight lang=
* [[CodeBlock]]: <syntaxhighlight lang=
* Hash: <syntaxhighlight lang=
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 {{
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 {{
===Variables===
All types can be assigned to named variables. Named variable identifiers are 1 to 63 ASCII characters long, start with <code>[A-Z|_]</code> and further consist of the characters <code>[A-Z|0–9|_]</code> up to a maximum of 63 characters. Named variables are not case sensitive.
'''Variables have one of the following scopes:'''
* {{
* {{
* {{
* {{
{{
Due to the dynamic nature of {{
=== Control structures ===
The basic control structures include all of the standard [[dBase]], and [[Clipper (programming language)|Clipper]] control structures as well as additional ones inspired by the [[C (programming language)|C]] or [[Java (programming language)|Java]] programming languages:
Line 164 ⟶ 161:
NEXT
* The ''...'' is a sequence of one
* The ''Var'':__enumIndex() may be optionally used to retrieve the current iteration index (1 based).
* The ''LOOP'' statement restarts the current iteration of the enclosing loop structure, and if the enclosing loop is a ''FOR'' or ''FOR EACH'' loop, it increases the iterator, moving to the next iteration of the loop.
Line 172 ⟶ 169:
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
====IF statements====
Line 221 ⟶ 218:
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
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 (computer science)|Value]] to replace the expression triggering the error condition.
Line 227 ⟶ 224:
Alternatively TRY [CATCH] [FINALLY] statements are available on ''xhb'' library working like the SEQUENCE construct.
===Procedures
[STATIC] PROCEDURE ''SomeProcedureName''
[STATIC] PROCEDURE ''SomeProcedureName''()
Line 239 ⟶ 236:
[STATIC] FUNCTION ''SomeProcedureName''( ''Param1'' [, ''ParamsN''] )
[[Subroutine|Procedures]]
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. [[Parameter (computer science)|Parameter]]s passed to a procedure/function appear in the subroutine as local variables, and may accept any type, including references.
Line 245 ⟶ 242:
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
FUNCTION may return any type by means of the RETURN statement, anywhere in the body of its definition.
Line 251 ⟶ 248:
An example procedure definition and a function call follows:
<syntaxhighlight lang="
x := Cube( 2 )
Line 259 ⟶ 256:
===Sample code===
The typical "[["Hello, World!" program|hello world]]" program would be:
<syntaxhighlight lang="
? "Hello, world!"
</syntaxhighlight>
Or:
<syntaxhighlight lang="
QOut( "Hello, world!" )
</syntaxhighlight>
Or:
<syntaxhighlight lang="
Alert( "Hello, world!" )
</syntaxhighlight>
Or, enclosed in an explicit procedure:
<syntaxhighlight lang="
PROCEDURE Main()
Line 346 ⟶ 343:
* hbrun – Shell interpreter for Harbour. Macro compiling allows to run any valid Harbour code as it's being compiled
* hbformat – Formats source code written on Harbour or another dialect according to defined rules
* hbpp – Pre-processor, a powerful tool which avoids typical problems found on C language
* hbi18n – Tools to localizing text on applications
* hbdoc – Creates documentation for Harbour
All tools are
==Development==
[[File:HBIDE Editor.png|thumb|400px|HBIDE look.]]
Today Harbour development is led by Viktor Szakáts in collaboration with Przemysław Czerpak who also contributes many components of the core language and supplementary components. HBIDE and some other components, especially HBQt, are developed by Pritpal Bedi. Other members of the development community send changes to the [[GitHub]] source repository.<ref>{{cite web|url=https://github.com/harbour |title=harbour 路 GitHub |publisher=Github.com |access-date=2013-12-09}}</ref>
As of 2015 Harbour development is active and vibrant.
==xHarbour comparison==
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.
Line 366 ⟶ 364:
==GUI libraries and tools==
*
*
*
*
*
*
*
==
* [[Visual FoxPro]]
* [[Visual Objects]]
* [[XBase
* [[PWCT]] free open source visual programming language support Harbour through [[PWCT#Visual
==References==
{{Reflist}}
==
* {{
* [https://harbour.github.io/the-oasis/ The Oasis] Clipper, FoxPro and Xbase++ community repository
* [http://hbide.vouch.info/ HBIDE]
Line 391 ⟶ 388:
* [https://groups.google.com/group/harbour-users/ Harbour Users Mailing List]
* [http://www.kresin.ru/en/harbour.html Extensive Harbour documentation, libraries, tools site]
*
{{xBase}}
Line 412 ⟶ 409:
[[Category:Free software programmed in C]]
[[Category:Multi-paradigm programming languages]]
[[Category:Table-oriented programming]]
<!-- Hidden categories below -->
[[Category:Articles with example code]]
|