Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Clipper Tutorial: a Guide to Open Source Clipper(s)/Getting Started

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Ways to Get Started A simple graph showing the different ways one can use (x)Harbour, and how they correspond to BASIC interpreters and Java. As seen above, in practice, (x)Harbour permits a great versatility, as it (they) can be used in four different ways: by running hbrun or xbscript and executing instructions interactively (much like a BASIC direct mode or immediate mode, although it is more similar to the dBase dot prompt). The main limit of this approach is that it cannot run expressions longer than a single line (but it is possible to enter more instructions on a line separating them with semicolons). However, much of my tutorial is thought to be entered, tested and understood one line at a time. by calling hbrun or xbscript specifying a .prg file as a line argument to execute it (which is again like specifying a file to run when invoking a BASIC interpreter) by compiling the file to a bytecode using the /gh option of the Harbour compiler and then running the resulting .hrb bytecode file with hbrun (this is similar to Java's workflow when you call the compiler javac and then the Java interpreter on the bytecode file) by using the Harbour compiler, C compiler and linker to get an executable file (utilities are given to get all the steps done in a single command) by using the compiler through an IDE There are also commercial RADs, like Xailer (https://www.xailer.com/) or xHarbour Builder (https://www.xharbour.com/). Antonino Perricone wrote an extension for Visual Studio Code, which is well documented at https://github.com/APerricone/harbourCodeExtension/wiki, https://medium.com/harbour-magazine/visual-studio-code-for-harbour-e148f9c1861a, https://harbour.wiki/index.asp?page=PublicArticles&mode=show&id=190401174818&sig=6893630672. The main problem with the precompiled version of Visual Studio Code is that it's not under the MIT license. https://github.com/Petewg/harbour-core/wiki/Make-tools xMate IDE: https://github.com/Petewg/MgM/tree/master/comp/ide Packages providing syntax highlighting for various editors are available: for Sublime Text (https://www.sublimetext.com/) is available at https://github.com/asistex/Sublime-Text-harbour-Package, for SynWrite (http://www.uvviewsoft.com/synwrite/) at https://github.com/rafathefull/synwrite, for Atom Editor (https://atom.io/) at https://github.com/AtomLinter/linter-harbour, UltraEdit at http://forums.ultraedit.com/syntax-highlighting-wordfile-for-harbour-fivewin-t17880.html. I myself like Scintilla (https://www.scintilla.org/), a lightweight open source editor that supports the xBase syntax highlighting under the name Flagship - which is an implementation different from the open source ones we are considering but that does not make much difference and it's anyway highly configurable. Getting Started on Windows Using Harbour From a Windows Command Prompt Simply open a command prompt and move to the directory where you store your sources. Issue a PATH command pointing to the bin directory of your Harbour system (this is to avoid problems if you've got different compilers in your system). I also add the path of a text editor to use from the prompt, like this: D:\harbourcode>PATH c:\hb32\bin;D:\wscite Getting Started With hbIDE https://hbide.vouch.info/ To create a new project, select File > New > New Project Wizard (Prototype Only). We will name this project hbidetest, enter the path C:/hb32/projects/hbidetest.hbp and click Save and Close. Select File > Open Project in the menu bar. Right click the project hbidetest in the projects dock on the right and "Set as Current" project. Select File > New > Source and create a file hbidetest.prg with the following content: function MAIN * This is an example clear ?"Hello, the weather is fine today" ?"(this is a test of HbIDE)" wait && will show "Press any key to continue..." and prevent the console window to close immediately return Double click hbidetest in the projects dock so that the and click the Select Sources button near the Project Output text box, then select Save and close. It is a button not very well indicated - I think a button clearly stating "Add source file" would have been better. "Select Sources" Button Position in hbIDE Now after selecting Build > Build and Launch our program will show up. Getting Started on Linux In a Linux box the common path is downloading and compiling the source from GitHub: git clone https://github.com/harbour/core.git harbour-core cd harbour-core make && sudo make install We may then use an editor (geany is the new editor à la mode) and try out a simple program: function MAIN * This is an example clear ?"Hello, the weather is fine today" ?"(this is a test of Harbour on Linux)" return and compile with hbmk2: $ hbmk2 test.prg we might need to update the LD_LIBRARY_PATH environment variable: $ export LD_LIBRARY_PATH="$HOME/clipper/harbour/lib/linux/gcc:$LD_LIBRARY_PATH" before executing our test: $ ./test Replicating the 90s MS-DOS Workflow In the (late 80s-early) 90s there was a widely used programmer's editor, Brief. There are three options to use something like that today: Grief https://github.com/adamyg/grief (open source) CRiSP https://crisp.com/ (various pricing options: commercial licenses from $275.00/User Workstation, $450.00/User Network) Brief https://briefeditor.com/: Brief Basic (free), Brief Professional ($120) I came across a (IA-generated) review for this Wikibook claiming that it covers FlagShip (https://fship.com/). The very cheap Personal FlagShip licence is 270€, and the full-fledged FlagShip 8 Pro + FS2-Toolbox Pro Win-Linux Bundle requires 1950€. Our 90s MS-DOS (Clipper) programmer's experience come in multiple options: Grief+Harbour: 0$/0€ CRiSP Workstation (1 perpetual licence)+FlagShip 8 Pro + FS2-Toolbox Pro Win-Linux Bundle: $275+1950€ That's why this book does not descrive FlagShip. But I'm serously thinking about adding an appendix on Brief Basic and Grief.