跳轉至內容

Clipper 教程:開源 Clipper 指南/入門

來自華夏公益教科書,開放世界的開放書籍

A simple graph showing the different ways one can use (x)Harbour, and how they correspond to BASIC interpreters and Java.

如上所述,在實踐中,(x)Harbour 允許很大的靈活性,因為它 (它們) 可以以四種不同的方式使用

  1. 透過執行 hbrunxbscript 並互動式地執行指令(非常類似於 BASIC 的直接模式立即模式,儘管它更類似於 dBase 的點提示符)。這種方法的主要限制是它不能執行超過一行的表示式(但可以將多條指令輸入到一行中,用分號分隔)。但是,我的大部分教程都認為是逐行輸入、測試和理解的。
  2. 透過呼叫 hbrunxbscript 並指定一個 .prg 檔案作為行引數來執行它(這又類似於在呼叫 BASIC 直譯器時指定要執行的檔案)
  3. 透過使用 Harbour 編譯器將檔案編譯為位元組碼,使用 Harbour 編譯器的 /gh 選項,然後使用 hbrun 執行生成的.hrb 位元組碼檔案(這類似於 Java 的工作流程,當您呼叫編譯器 javac 然後在位元組碼檔案上呼叫 Java 直譯器時)
  4. 透過使用 Harbour 編譯器、C 編譯器和連結器來獲取可執行檔案(提供實用程式來在一行命令中完成所有步驟)
  5. 透過 IDE 使用編譯器

也有一些商業 RAD,比如Xailer (https://www.xailer.com/) 或xHarbour Builder (https://www.xharbour.com/).

Antonino Perricone 為 Visual Studio Code 寫了一個擴充套件,它在 https://github.com/APerricone/harbourCodeExtension/wikihttps://medium.com/harbour-magazine/visual-studio-code-for-harbour-e148f9c1861ahttps://harbour.wiki/index.asp?page=PublicArticles&mode=show&id=190401174818&sig=6893630672 有很好的文件。預編譯的 Visual Studio Code 的主要問題是它不受 MIT 許可證的保護。

https://github.com/Petewg/harbour-core/wiki/Make-tools

xMate IDE:https://github.com/Petewg/MgM/tree/master/comp/ide

提供各種編輯器語法高亮的包可以使用:Sublime Text (https://www.sublimetext.com/) 可在 https://github.com/asistex/Sublime-Text-harbour-Package 獲取,SynWrite (http://www.uvviewsoft.com/synwrite/) 可在 https://github.com/rafathefull/synwrite 獲取,Atom Editor (https://atom.io/) 可在 https://github.com/AtomLinter/linter-harbour 獲取,UltraEdit 可在 http://forums.ultraedit.com/syntax-highlighting-wordfile-for-harbour-fivewin-t17880.html 獲取。我自己喜歡 Scintilla (https://www.scintilla.org/),一個輕量級的開源編輯器,支援名為 Flagship 的 xBase 語法高亮 - 它是一種與我們正在考慮的開源實現不同的實現,但這並不重要,而且它本身高度可配置。

從 Windows 命令提示符使用 Harbour

[編輯 | 編輯原始碼]

只需開啟一個命令提示符並移動到您儲存原始碼的目錄。發出一個 PATH 命令指向您的 Harbour 系統的 bin 目錄(這樣可以避免您在系統中擁有不同的編譯器時出現問題)。我還會新增一個文字編輯器的路徑,以便從提示符中使用它,如下所示

D:\harbourcode>PATH c:\hb32\bin;D:\wscite

hbIDE 入門

[編輯 | 編輯原始碼]

https://hbide.vouch.info/

  1. 要建立一個新專案,選擇檔案 > 新建 > 新建專案嚮導(原型)。我們將把這個專案命名為hbidetest,輸入路徑 C:/hb32/projects/hbidetest.hbp 並單擊儲存並關閉
  2. 在選單欄中選擇檔案 > 開啟專案
  3. 右鍵單擊右側專案塢中的專案hbidetest 並 "設為當前" 專案。
  4. 選擇檔案 > 新建 > 並建立一個名為 hbidetest.prg 的檔案,其內容如下
     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
    
  5. 雙擊專案塢中的hbidetest,然後單擊專案輸出文字框旁邊的選擇源按鈕,然後選擇儲存並關閉。這是一個指示不明確的按鈕 - 我認為一個明確標明 “新增原始檔” 的按鈕會更好。 "選擇源" 按鈕在 hbIDE 中的位置
  6. 現在,在選擇構建 > 構建並啟動 後,我們的程式將會出現。
華夏公益教科書