FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Utilities / Utilidades Antigravity as bugs solver and tech support
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Antigravity as bugs solver and tech support
Posted: Sun Mar 01, 2026 11:01 AM

Really impressive this last one! :wink: :!: :idea:

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Antigravity as bugs solver and tech support
Posted: Sun Mar 01, 2026 11:14 AM

Aplicando el SKILL.md de deepwiki al repo de Harbour:

Harbour β€” DeepWiki Analysis

📑 Navigation

  • Overview
  • Project Introduction
  • Version & Status
  • Subsystem Map
  • Technology Stack
  • Getting Started
    • Installation
    • Building from Source
    • Hello World Tutorial
    • Platform Matrix
  • Core Architecture
    • Compiler Pipeline
    • Virtual Machine (HVM)
    • Runtime Library (RTL)
    • Preprocessor (PP)
    • Class System (OOP)
    • Event / Callback Model
  • Data Access Layer
    • Replaceable Database Driver (RDD)
    • DBF Format & Index Engines
    • SQL Database Connectors
    • USRRDD β€” User-Defined RDDs
  • Terminal & UI Subsystem
    • GT Architecture
    • Platform Terminal Drivers
    • TBrowse Data Grid
    • GET System
  • Networking & I/O
    • Socket API
    • Inet Layer
    • cURL Integration
    • HTTP Server (hbhttpd)
    • NetIO Remote I/O
  • Cryptography & Encoding
    • Hash Functions (MD5, SHA-1, SHA-2)
    • Blowfish & ARC4
    • Base64, Hex, zLib
    • SSL/TLS (via hbssl)
  • LLVM Backend (Experimental)
    • Architecture
    • JIT Compilation
    • Optimization Passes
  • Contrib Ecosystem
    • Database Connectors
    • Image & PDF Libraries
    • Compression & Archiving
    • Compatibility Layers (xhb, hbct, hbxpp)
  • Build & Platform Support
    • hbmk2 Build Tool
    • Makefile Infrastructure
    • Cross-Compilation
    • Compiler & Platform Targets
  • Testing & Quality
    • Test Suite
    • Debugger
    • Code Metrics

  • ---

    Overview

    📄 Relevant source files

    README.md β€” Project description, build instructions, platform matrix
    include/hbver.h#L56-59 β€” Version numbers and status
    include/hbverbld.h β€” Build-time revision and compiler info
    LICENSE.txt β€” GNU GPL license with Harbour linking exception

    Harbour is a free, open-source, multi-platform, multi-threading, object-oriented programming language and compiler, backward compatible with CA-Clipper/xBase. It compiles .prg source code through a C intermediate representation into native executables, and ships a full runtime, a virtual machine, a rich standard library, a replaceable database driver architecture, and a large ecosystem of contributed packages. For build and deployment details see Getting Started. For internal class design see Core Architecture.

    What Is Harbour?

    Harbour was created as a modern, portable successor to CA-Clipper 5.x. It preserves the original xBase/Clipper language semantics β€” commands like USE, REPLACE, @ SAY/GET, code blocks, and the RDD abstraction layer β€” while adding OOP, multi-threading, Unicode, JSON support, sockets, cryptography, and bindings to dozens of modern libraries. The project version is defined in include/hbver.h#L56-59:

    #define HB_VER_MAJOR    3
    #define HB_VER_MINOR    2
    #define HB_VER_RELEASE  0
    #define HB_VER_STATUS   "dev"

    The current build revision, recorded in include/hbverbld.h, is 2405310955 corresponding to commit b2c61aa44a.

    Subsystem Map

    </s>
    graph TD
        APP["Application Code (.prg)"] --&gt; PP["Preprocessor (PP)"]
        PP --&gt; COMP["Compiler"]
        COMP --&gt; GENC["C Code Generator (genc.c)"]
        COMP --&gt; GENCC["C++ Code Generator (gencc.c)"]
        COMP --&gt; GENHRB["HRB Portable Generator (genhrb.c)"]
        COMP --&gt; GENLLVM["LLVM IR Generator (genllvm.c)"]
        GENC --&gt; CC["C/C++ Compiler"]
        GENCC --&gt; CC
        GENLLVM --&gt; LLVM["LLVM Backend"]
        CC --&gt; OBJ[".obj Files"]
        OBJ --&gt; LINK["Linker"]
        LINK --&gt; EXE["Native Executable"]
    
    <i>    </i>EXE --&gt; VM["Virtual Machine (HVM)"]
    <i>    </i>VM --&gt; RTL["Runtime Library"]
    <i>    </i>VM --&gt; RDD["RDD β€” Database Drivers"]
    <i>    </i>VM --&gt; GT["GT β€” Terminal Drivers"]
    <i>    </i>VM --&gt; CONTRIB["Contrib Packages"]
    
    <i>    </i>RTL --&gt; CRYPTO["Crypto (MD5, SHA, AES)"]
    <i>    </i>RTL --&gt; NET["Sockets / Inet"]
    <i>    </i>RTL --&gt; FS["File System API"]
    <i>    </i>RTL --&gt; JSON["JSON / Serialization"]
    <i>    </i>RTL --&gt; ZLIB["zLib Compression"]
    
    <i>    </i>RDD --&gt; DBF["DBF Engine"]
    <i>    </i>RDD --&gt; CDX["CDX / NTX / NSX Indexes"]
    <i>    </i>RDD --&gt; SQL["SQL Drivers"]
    
    <i>    </i>CONTRIB --&gt; MYSQL["hbmysql"]
    <i>    </i>CONTRIB --&gt; PGSQL["hbpgsql"]
    <i>    </i>CONTRIB --&gt; SQLITE["hbsqlit3"]
    <i>    </i>CONTRIB --&gt; CURL["hbcurl"]
    <i>    </i>CONTRIB --&gt; SSL["hbssl"]
    <i>    </i>CONTRIB --&gt; HTTPD["hbhttpd"]
    <e>

    Technology Stack

    </s>
    pie title Source File Distribution (src/ directory)
        "C Source (.c)" : 214
        "Harbour Source (.prg)" : 112
        "Headers (.h/.ch)" : 131
        "Yacc Grammar (.y/.yyc)" : 3
        "Makefiles" : 20
    <e>

    Quantitative Metrics

    MetricValue
    Harbour version3.2.0-dev
    Total source files (src/)330+
    Header files (include/)148
    Contrib packages (contrib/)69+
    Test files (tests/)295
    Largest source filesrc/vm/hvm.c β€” 375 KB
    Core compiler files28
    VM source files49
    RTL source files287
    RDD source files42+
    Supported host platforms18 (Windows, Linux, macOS, BSD, DOS, OS/2, AIX, …)
    C compiler targets30+ (GCC, Clang, MSVC, BCC, MinGW, Watcom, …)
    Config files (config/)117
    LicenseGNU GPL v2+ with linking exception

    ---

    Getting Started

    📄 Relevant source files

    README.md#L146-340 β€” Build instructions per platform
    Makefile β€” Top-level GNU Make entry point
    utils/hbmk2/ β€” Harbour's own build tool (29 files)
    tests/ β€” 295 test programs
    go.bat, go64.bat β€” Quick-build batch files for Windows

    For platform-specific build prerequisites and optional component configuration see Build & Platform Support. For architecture explanation see Core Architecture.

    Prerequisites

    Building Harbour requires a supported ANSI C compiler and GNU Make 3.81+. On Windows, a copy of win-make.exe is included. On *nix, the system make or gmake is used.

    Building on Windows

    > win-make [install]

    Building on Linux / macOS / BSD

    $ make [install]

    Hello World

    Code (harbour): Select all Collapse
    FUNCTION Main()
       ? "Hello, world!"
    RETURN NIL

    Compile and run:

    $ hbmk2 hello.prg
    $ ./hello

    Build Pipeline

    </s>
    flowchart LR
        A[".prg Source"] --&gt; B["Harbour Preprocessor (PP)"]
        B --&gt; C["Harbour Compiler"]
        C --&gt; D[".c Generated Code"]
        D --&gt; E["C/C++ Compiler (gcc/msvc/bcc/clang)"]
        F[".c Native Sources"] --&gt; E
        G[".ch/.h Headers"] --&gt; C
        G --&gt; E
        E --&gt; H[".obj Object Files"]
        H --&gt; I["Linker / Librarian"]
        I --&gt; J[".exe / .lib / .dll"]
    <e>

    Platform Matrix (excerpt)

    HostTargetCompilerCPU
    Windowswinmingw, mingw64, msvc, msvc64, bcc, clang, watcomx86, x86-64
    Windowswcemingwarm, msvcarm, poccarmARM, x86
    Windowsdosdjgpp, watcomx86
    Linuxlinuxgcc, clang, icc, sunpro, open64x86, x86-64, ARM
    Linuxwinmingw, mingw64 (cross)x86, x86-64
    macOSdarwinclang, gcc, iccx86, x86-64
    BSDbsdgcc, clangx86, x86-64
    Androidandroidgcc, gccarmx86, ARM

    ---

    Core Architecture

    📄 Relevant source files

    src/compiler/ β€” 28 files: compiler front-end, code generators
    src/vm/ β€” 49 files: virtual machine, class system, GC, threading
    src/pp/ β€” 6 files: preprocessor
    src/rtl/ β€” 287 files: runtime library
    include/hbcomp.h, include/hbcompdf.h β€” Compiler data structures
    include/hbvm.h, include/hbvmpub.h β€” VM public API
    include/hbclass.ch β€” OOP class definition macros

    Harbour's architecture is layered: application .prg code is preprocessed, compiled to pcode or C, then executed on a stack-based virtual machine linked with a comprehensive runtime library. For the database subsystem see Data Access Layer. For terminal output see Terminal & UI Subsystem.

    Architecture Layers

    </s>
    graph TD
        A["Application Layer (.prg code)"] --&gt; B["Harbour Language / DSL Layer"]
        B --&gt; C["OOP Class System (classes.c, tclass.prg)"]
        C --&gt; D["Virtual Machine β€” HVM (hvm.c, 375KB)"]
        D --&gt; E["Runtime Library β€” RTL (287 files)"]
        E --&gt; F["C API / OS Abstraction"]
        F --&gt; G["Operating System / Hardware"]
    
    <i>    </i>D --&gt; H["Garbage Collector (garbage.c)"]
    <i>    </i>D --&gt; I["Threading (thread.c)"]
    <i>    </i>D --&gt; J["Memory Manager (fm.c, dlmalloc.c)"]
    <i>    </i>D --&gt; K["Dynamic Symbol Table (dynsym.c)"]
    <e>

    Compiler Pipeline

    The Harbour compiler (src/compiler/) transforms .prg source into one of several output formats:

    ComponentFileSizeDescription
    Grammarharbour.y123 KBYacc/Bison grammar β€” full xBase language definition
    Parser outputharbour.yyc364 KBPre-generated parser C code
    Main compilerhbmain.c154 KBCore compilation logic
    C code generatorgenc.c80 KBEmits portable C source with pcode tables
    C++ code generatorgencc.c64 KBEmits real C/C++ function calls (direct translation)
    HRB generatorgenhrb.c6 KBEmits portable .hrb bytecode files
    LLVM generatorgenllvm.c3 KBExperimental LLVM IR output path
    Optimizerhbopt.c63 KBPcode-level optimization passes
    Dead code eliminatorhbdead.c26 KBRemoves unreachable code
    </s>
    flowchart TD
        SRC[".prg Source"] --&gt; PP["Preprocessor (ppcore.c)"]
        PP --&gt; PARSE["Parser (harbour.y β†’ harbour.yyc)"]
        PARSE --&gt; PCODE["Pcode IR"]
        PCODE --&gt; OPT["Optimizer (hbopt.c)"]
        OPT --&gt; DEAD["Dead Code Elimination (hbdead.c)"]
        DEAD --&gt; GENC["genc.c β†’ .c output"]
        DEAD --&gt; GENCC["gencc.c β†’ .c output (direct)"]
        DEAD --&gt; GENHRB["genhrb.c β†’ .hrb bytecode"]
        DEAD --&gt; GENLLVM["genllvm.c β†’ LLVM IR"]
    <e>

    Virtual Machine (HVM)

    The Harbour Virtual Machine (src/vm/hvm.c, 375 KB) is a register/stack-based interpreter that executes pcode. It manages:

    • Eval stack (estack.c) β€” per-thread stack frames for function calls, local variables, and return values
    • Class system (classes.c, 186 KB) β€” full OOP with single inheritance, method dispatch, scoping
    • Garbage collector (garbage.c) β€” mark-and-sweep GC for complex types (arrays, objects, hashes, code blocks)
    • Memory manager (fm.c + dlmalloc.c) β€” custom allocator with debug support
    • Threading (thread.c, 75 KB) β€” multi-thread VM with per-thread stacks
    • Dynamic symbols (dynsym.c) β€” runtime symbol table for late binding
    • Code blocks (codebloc.c) β€” first-class closures
    • Macro compiler (macro.c, 61 KB) β€” compile and evaluate expressions at runtime
    • Item API (itemapi.c, 85 KB) β€” type system: NIL, logical, numeric, date, string, array, hash, block, pointer, symbol

    Class System (OOP)

    Harbour supports a full OOP system defined via the CLASS ... ENDCLASS syntax (macros in include/hbclass.ch). The runtime implementation lives in src/vm/classes.c (186 KB) with additional support in src/rtl/tclass.prg.

    </s>
    classDiagram
        class HBObject {
            +ClassName()
            +ClassH()
        }
        class TScalar {
            +Type info
        }
        class TBrowse {
            +nTop, nLeft, nBottom, nRight
            +GoTop(), GoBottom()
            +AddColumn()
            +Stabilize()
        }
        class TGet {
            +buffer, cargo
            +Assign(), Display()
            +SetFocus(), KillFocus()
        }
        class TPersistent {
            +SaveToText()
            +LoadFromText()
        }
        HBObject &lt;|-- TScalar
        HBObject &lt;|-- TBrowse
        HBObject &lt;|-- TGet
        HBObject &lt;|-- TPersistent
    <e>

    Event / Callback Model

    Harbour uses a code-block-based callback model. Events are dispatched through bAction, bWhen, and similar code blocks stored in control objects.

    </s>
    sequenceDiagram
        participant User
        participant MainLoop as "Main Event Loop"
        participant VM as "HVM"
        participant Block as "Code Block"
        participant GET as "TGet / TBrowse"
    
    <i>    </i>User-&gt;&gt;MainLoop: Key press / Mouse event
    <i>    </i>MainLoop-&gt;&gt;VM: Inkey() β†’ dispatch
    <i>    </i>VM-&gt;&gt;GET: Evaluate bAction / bWhen
    <i>    </i>GET-&gt;&gt;Block: hb_itemDo(bAction)
    <i>    </i>Block--&gt;&gt;GET: Return value
    <i>    </i>GET--&gt;&gt;VM: Refresh/Update
    <i>    </i>VM--&gt;&gt;MainLoop: Continue loop
    <i>    </i>MainLoop--&gt;&gt;User: Screen update
    <e>

    ---

    Data Access Layer

    📄 Relevant source files

    src/rdd/ β€” 42+ files: RDD core, DBF engine, index drivers
    src/rdd/dbf1.c β€” 221 KB: Main DBF implementation
    src/rdd/workarea.c β€” 79 KB: Work area management
    src/rdd/dbcmd.c β€” 73 KB: Database commands (USE, SKIP, SEEK…)
    src/rdd/dbfcdx/, dbfntx/, dbfnsx/, dbffpt/ β€” Index/memo sub-drivers
    src/rdd/usrrdd/ β€” User-defined RDD framework
    include/hbapirdd.h β€” 57 KB: RDD API definitions

    Harbour's data access uses the Replaceable Database Driver (RDD) architecture inherited from Clipper. This abstraction layer allows different storage backends to be used transparently. For SQL connectivity see Contrib Ecosystem. For the terminal-based TBrowse data display see Terminal & UI Subsystem.

    RDD Architecture

    </s>
    graph TD
        APP["Application (USE, SKIP, SEEK…)"] --&gt; RDDAPI["RDD API Layer (dbcmd.c, wafunc.c)"]
        RDDAPI --&gt; WA["Work Area Manager (workarea.c)"]
        WA --&gt; DBF["DBFNTX / DBFCDX / DBFNSX"]
        WA --&gt; SDF["SDF Driver (sdf1.c)"]
        WA --&gt; DELIM["Delimited Driver (delim1.c)"]
        WA --&gt; USRRDD["User RDD (usrrdd.c)"]
        WA --&gt; SQLRDD["SQL RDD (rddsql/)"]
    
    <i>    </i>DBF --&gt; DBF1["DBF Core Engine (dbf1.c, 221KB)"]
    <i>    </i>DBF --&gt; NTX["NTX Index (dbfntx/)"]
    <i>    </i>DBF --&gt; CDX["CDX Compound Index (dbfcdx/)"]
    <i>    </i>DBF --&gt; NSX["NSX Index (dbfnsx/)"]
    <i>    </i>DBF --&gt; FPT["FPT Memo (dbffpt/)"]
    <e>

    Supported Database Backends

    DriverTypeSource LocationDescription
    DBFNTXNativesrc/rdd/dbfntx/DBF + NTX single-key indexes
    DBFCDXNativesrc/rdd/dbfcdx/DBF + CDX compound indexes (FoxPro compatible)
    DBFNSXNativesrc/rdd/dbfnsx/DBF + NSX indexes
    DBFFPTNativesrc/rdd/dbffpt/FPT memo fields
    SDFNativesrc/rdd/sdf1.cSystem Data Format (fixed-width text)
    DELIMNativesrc/rdd/delim1.cCSV/Delimited text files
    USRRDDFrameworksrc/rdd/usrrdd/Framework for user-defined RDDs in .prg
    ADSContribcontrib/rddads/Advantage Database Server client
    MySQLContribcontrib/sddmy/MySQL via SDD
    PostgreSQLContribcontrib/sddpg/PostgreSQL via SDD
    SQLite3Contribcontrib/sddsqlt3/SQLite3 via SDD
    ODBCContribcontrib/sddodbc/Generic ODBC via SDD
    FirebirdContribcontrib/sddfb/Firebird via SDD
    OracleContribcontrib/sddoci/Oracle OCI via SDD

    USRRDD β€” User Defined RDDs

    The src/rdd/usrrdd/rdds/ directory contains several example user-defined RDDs written in Harbour:

    • arrayrdd.prg β€” In-memory array-based database
    • logrdd.prg β€” Logging/auditing wrapper RDD
    • vfpcdx.prg β€” Visual FoxPro CDX compatibility
    • hscdx.prg, rlcdx.prg, smtcdx.prg, dbtcdx.prg, fptcdx.prg β€” Specialized CDX variants

    ---

    Terminal & UI Subsystem

    📄 Relevant source files

    src/rtl/hbgtcore.c β€” 126 KB: GT core abstraction
    src/rtl/gtapi.c β€” 32 KB: GT API functions
    src/rtl/gtwin/, gtstd/, gtcrs/, gtsln/, gtxwc/, gttrm/ β€” Platform drivers
    src/rtl/tbrowse.prg β€” 83 KB: TBrowse data grid
    src/rtl/tget.prg β€” 53 KB: TGet input system
    contrib/gtwvg/ β€” 72 files: Win32 GUI terminal
    contrib/gtwvw/ β€” 35 files: Win32 GUI terminal (variant)

    The GT (General Terminal) subsystem is Harbour's terminal abstraction layer. It provides a unified API for screen output, keyboard input, and mouse handling across all platforms. For database browsing see Data Access Layer.

    GT Architecture

    </s>
    graph TD
        APP["Application (@ SAY, ?, QOut)"] --&gt; GTAPI["GT API (gtapi.c)"]
        GTAPI --&gt; GTCORE["GT Core (hbgtcore.c, 126KB)"]
        GTCORE --&gt; GTSTD["gtstd β€” Standard I/O"]
        GTCORE --&gt; GTWIN["gtwin β€” Windows Console"]
        GTCORE --&gt; GTCRS["gtcrs β€” ncurses (*nix)"]
        GTCORE --&gt; GTSLN["gtsln β€” S-Lang (*nix)"]
        GTCORE --&gt; GTXWC["gtxwc β€” X11 (*nix GUI)"]
        GTCORE --&gt; GTTRM["gttrm β€” Terminal (*nix)"]
        GTCORE --&gt; GTWVT["gtwvt β€” Windows VT"]
        GTCORE --&gt; GTCGI["gtcgi β€” CGI output"]
        GTCORE --&gt; GTWVG["gtwvg β€” Win32 GUI (contrib)"]
        GTCORE --&gt; GTWVW["gtwvw β€” Win32 GUI (contrib)"]
        GTCORE --&gt; GTQTC["gtqtc β€” Qt (contrib)"]
        GTCORE --&gt; GTALLEG["gtalleg β€” Allegro (contrib)"]
    <e>

    GT Driver Matrix

    DriverPlatformSourceType
    gtstdAllsrc/rtl/gtstd/Standard I/O (default)
    gtwinWindowssrc/rtl/gtwin/Win32 Console API
    gtwvtWindowssrc/rtl/gtwvt/Virtual Terminal
    gtcrs*nixsrc/rtl/gtcrs/ncurses
    gtsln*nixsrc/rtl/gtsln/S-Lang
    gtxwc*nixsrc/rtl/gtxwc/X11 window
    gttrm*nixsrc/rtl/gttrm/Terminal
    gtcgiAllsrc/rtl/gtcgi/CGI output
    gtdosDOSsrc/rtl/gtdos/DOS console
    gtos2OS/2src/rtl/gtos2/OS/2 console
    gtpcaAllsrc/rtl/gtpca/PC ANSI
    gtwvgWindowscontrib/gtwvg/Win32 GUI (72 files)
    gtwvwWindowscontrib/gtwvw/Win32 GUI variant
    gtqtcMulticontrib/gtqtc/Qt-based
    gtallegMulticontrib/gtalleg/Allegro-based

    ---

    Networking & I/O

    📄 Relevant source files

    src/rtl/hbsocket.c β€” 118 KB: Low-level socket API
    src/rtl/hbsockhb.c β€” 43 KB: Harbour-level socket wrappers
    src/rtl/hbinet.c β€” 39 KB: Internet socket abstraction
    src/rtl/hbcom.c β€” 116 KB: Serial/COM port API
    contrib/hbcurl/ β€” cURL bindings
    contrib/hbhttpd/ β€” HTTP server (24 files)
    contrib/hbnetio/ β€” Network I/O (21 files)
    contrib/hbtip/ β€” Internet protocols (45 files: SMTP, POP3, FTP, HTTP)

    Harbour provides several layers of networking support, from raw socket programming to high-level protocol libraries.

    Network Stack

    </s>
    graph TD
        APP["Application"] --&gt; TIP["hbtip β€” SMTP, POP3, FTP, HTTP"]
        APP --&gt; HTTPD["hbhttpd β€” HTTP Server"]
        APP --&gt; NETIO["hbnetio β€” Remote File I/O"]
        APP --&gt; CURL["hbcurl β€” libcurl bindings"]
    
    <i>    </i>TIP --&gt; INET["hbinet (hbinet.c)"]
    <i>    </i>HTTPD --&gt; SOCK["hbsocket (hbsocket.c)"]
    <i>    </i>NETIO --&gt; SOCK
    <i>    </i>INET --&gt; SOCK
    <i>    </i>CURL --&gt; LIBCURL["libcurl (external)"]
    
    <i>    </i>SOCK --&gt; OS["OS Socket API (Winsock / BSD)"]
    
    <i>    </i>APP --&gt; COM["hbcom β€” Serial Ports (hbcom.c)"]
    <i>    </i>COM --&gt; OSCOM["OS Serial API"]
    <e>

    ---

    Cryptography & Encoding

    📄 Relevant source files

    src/rtl/hbmd5.c β€” MD5 hash
    src/rtl/hbsha1.c, hbsha1hm.c β€” SHA-1 + HMAC
    src/rtl/hbsha2.c, hbsha2hm.c β€” SHA-256/384/512 + HMAC
    src/rtl/hbbfish.c β€” Blowfish cipher
    src/rtl/arc4.c β€” ARC4/RC4 stream cipher
    src/rtl/base64c.c, base64d.c β€” Base64 encode/decode
    src/rtl/hbcrc.c β€” CRC32 checksum
    src/rtl/hbadler.c β€” Adler-32
    src/rtl/hbzlib.c β€” zLib compression
    contrib/hbssl/ β€” OpenSSL bindings (37 files)

    The RTL includes built-in implementations of common hash functions and ciphers, all in pure C. For SSL/TLS support, the hbssl contrib wraps OpenSSL.


    ---

    LLVM Backend (Experimental)

    📄 Relevant source files

    src/llvm/llvm_backend.c β€” 230 lines: Context management, optimization passes, bitcode emission
    src/llvm/llvm_codegen.c β€” Code generation from pcode to LLVM IR
    src/llvm/llvm_jit.c β€” JIT compilation support
    src/llvm/llvm_optimize.c β€” Module-level optimization pipeline
    src/llvm/llvm_translate.c β€” 13 KB: Pcode-to-LLVM-IR opcode translation
    src/llvm/hbllvm.h β€” LLVM context data structures
    src/llvm/hbllvm_opcodes.h β€” Pcode opcode mapping for LLVM
    src/compiler/genllvm.c β€” Compiler-side LLVM output entry point

    An experimental LLVM backend adds the ability to compile Harbour pcode to LLVM IR for native code generation with advanced optimizations. The HB_LLVM_AVAILABLE preprocessor flag enables or disables this subsystem at compile time.

    LLVM Architecture

    </s>
    flowchart LR
        PCODE["Harbour Pcode"] --&gt; TRANS["llvm_translate.c β€” Opcode Translation"]
        TRANS --&gt; IR["LLVM IR (Module)"]
        IR --&gt; OPT["llvm_optimize.c β€” Optimization Passes"]
        OPT --&gt; JIT["llvm_jit.c β€” JIT Compilation"]
        OPT --&gt; BC["llvm_backend.c β€” Bitcode Emission (.bc)"]
        JIT --&gt; NATIVE["Native Machine Code (in-memory)"]
        BC --&gt; LLC["LLVM toolchain (opt/llc)"]
        LLC --&gt; NATIVE2["Native Object File"]
    <e>

    Optimization Levels

    The LLVM backend supports four optimization levels (llvm_backend.c#L91-134):

    LevelPasses
    O0None
    O1InstructionCombining, Reassociate, GVN, CFGSimplification
    O2O1 + FunctionInlining, GlobalOptimizer, PromoteMemoryToRegister
    O3AggressiveDCE, DeadStoreElim, Inlining, GVN, LICM, SCCP, ScalarRepl, TailCallElim

    ---

    Contrib Ecosystem

    📄 Relevant source files

    contrib/ β€” 69+ packages with 1962+ total files
    contrib/make.hb β€” 25 KB: Contrib build orchestrator

    Harbour ships a rich ecosystem of contributed packages:

    Package Categories

    Database Connectors

    PackageFilesDescription
    hbmysql46MySQL client library
    hbpgsql16PostgreSQL client library
    hbsqlit316SQLite3 embedded database
    hbodbc12ODBC abstraction layer
    hbfbird11Firebird/Interbase client
    rddads16Advantage Database Server RDD
    rddsql8SQL RDD bridge framework
    sddmy / sddpg / sddsqlt3 / sddodbc / sddfb / sddoci36SQL Data Drivers

    Internet & Networking

    PackageFilesDescription
    hbcurl9libcurl bindings
    hbssl37OpenSSL bindings
    hbhttpd24HTTP server
    hbnetio21Network I/O subsystem
    hbtip45Internet protocols (SMTP, POP3, FTP, HTTP)
    hbsms7SMS support
    hbblat15Email via Blat (Windows)

    Image, PDF & Graphics

    PackageFilesDescription
    hbhpdf123libHaru PDF generation
    hbfimage8FreeImage bindings
    hbgd24GD graphics library
    hbcairo23Cairo 2D graphics
    hbzebra22Barcode generation

    Compression & Archiving

    PackageFilesDescription
    hbbz221bzip2 compression
    hblzf19LZF compression
    hbmlzo15miniLZO compression
    hbmzip21Minizip (ZIP archives)
    hbziparc8ZIP archive management

    Compatibility Layers

    PackageFilesDescription
    xhb139xHarbour compatibility layer
    hbct239CA-Tools (CT3) library compatibility
    hbxpp38Xbase++ compatibility
    hbnf341Nanforum library (largest contrib)
    hbfoxpro10Visual FoxPro compatibility functions

    Other Notable Packages

    PackageDescription
    hbwinWindows API bindings (104 files)
    hbformatSource code formatter
    hbrunHarbour script runner
    hbtestTest framework
    hbcommSerial communication
    hbdocDocumentation generator
    hbexpatXML processing via Expat
    hbmxmlMiniXML processing
    hbxdiffDiff/patch functionality
    hbtinymtMersenne Twister PRNG
    hbmagicFile type detection (libmagic)
    hbgsGhostscript integration
    hbcupsCUPS printing (*nix)

    ---

    Build & Platform Support

    📄 Relevant source files

    config/ β€” 117 configuration files for compilers/platforms
    utils/hbmk2/ β€” 29 files: Harbour's own build tool
    Makefile β€” Top-level build entry
    go.bat, go64.bat, go32h.bat, go64h.bat β€” Quick-build scripts
    build_llvm.bat, build_llvm.sh β€” LLVM backend builds
    debian/ β€” Debian packaging (8 files)
    package/ β€” Distribution packaging scripts (27 files)

    For the platform matrix and compiler targets see Getting Started.

    hbmk2 β€” The Harbour Build Tool

    hbmk2 is Harbour's integrated build management tool (29 files in utils/hbmk2/). It handles:

    • Automatic C compiler detection and configuration
    • .hbp project files, .hbc component configs, .hbm macros
    • Cross-compilation support
    • Dependency resolution for contrib packages
    • Debug/release builds, static/shared linking

    Cross-Compilation Matrix

    </s>
    graph LR
        WIN["Windows Host"] --&gt; W_WIN["β†’ Windows (native)"]
        WIN --&gt; W_WCE["β†’ Windows CE (cross)"]
        WIN --&gt; W_DOS["β†’ MS-DOS (cross)"]
        WIN --&gt; W_OS2["β†’ OS/2 (cross)"]
        WIN --&gt; W_LINUX["β†’ Linux (cross)"]
        WIN --&gt; W_ANDROID["β†’ Android (cross)"]
        WIN --&gt; W_VXWORKS["β†’ VxWorks (cross)"]
    
    <i>    </i>LINUX["Linux Host"] --&gt; L_LINUX["β†’ Linux (native)"]
    <i>    </i>LINUX --&gt; L_WIN["β†’ Windows (cross)"]
    <i>    </i>LINUX --&gt; L_WCE["β†’ Windows CE (cross)"]
    <i>    </i>LINUX --&gt; L_DOS["β†’ MS-DOS (cross)"]
    <i>    </i>LINUX --&gt; L_ANDROID["β†’ Android (cross)"]
    
    <i>    </i>DARWIN["macOS Host"] --&gt; D_DARWIN["β†’ macOS (native)"]
    <i>    </i>DARWIN --&gt; D_WIN["β†’ Windows (cross)"]
    <i>    </i>DARWIN --&gt; D_ANDROID["β†’ Android (cross)"]
    <e>

    ---

    Testing & Quality

    📄 Relevant source files

    tests/ β€” 295 test programs
    utils/hbtest/ β€” 22 files: Regression test framework
    contrib/hbtest/ β€” 7 files: Contrib test support
    src/debug/ β€” 16 files: Built-in interactive debugger
    .travis.yml β€” CI configuration

    Test Suite

    Harbour includes 295 test files covering core language features, RTL functions, database operations, and contrib packages. The test runner is invokable via:

    > cd tests
    > hbmk2 hello.prg

    Debugging

    Harbour ships a full interactive debugger (src/debug/, 16 files) supporting:

    • Breakpoints and step execution
    • Variable inspection (local, private, public, static)
    • Call stack browsing
    • Watch expressions
    • Work area inspection

    Launch with: hbmk2 myapp -b -run, then press Alt+D.

    Code Quality Observations

    🟢 Strengths

    • Mature, comprehensive codebase β€” 25+ years of development
    • Extreme portability β€” 18 platforms, 30+ compiler configurations
    • Clean layered architecture β€” clear separation between compiler, VM, RTL, RDD
    • Rich RDD abstraction β€” transparently swappable database backends
    • Extensible GT system β€” pluggable terminal drivers
    • Extensive contrib ecosystem β€” 69+ packages covering databases, networking, crypto, graphics
    • Backward compatibility β€” faithful Clipper 5.x compatibility maintained
    • Built-in debugger β€” interactive debugging included
    • OOP support β€” full class system with inheritance and encapsulation

    🟡 Areas of Note

    • Very large files β€” hvm.c (375 KB), dbf1.c (221 KB), classes.c (186 KB) could benefit from modularization
    • LLVM backend β€” experimental, with stub/fallback implementations
    • Limited CI β€” Travis CI config exists but may be inactive
    • Documentation β€” primarily in README and source comments; no generated API docs

    Design Patterns Identified

    </s>
    classDiagram
        class StrategyPattern {
            +RDD Interface
            +Swappable DBF/CDX/NTX/SQL backends
        }
        class AbstractFactory {
            +GT Driver Factory
            +Pluggable terminal backends
        }
        class Observer {
            +Code Block callbacks
            +bAction/bWhen event model
        }
        class Composite {
            +TBrowse columns
            +Menu system hierarchy
        }
        class TemplateMethod {
            +USRRDD framework
            +Override specific RDD methods
        }
        StrategyPattern --&gt; AbstractFactory : "both use\npluggable backends"
    <e>

    ---

    Window / Object Lifecycle

    </s>
    stateDiagram-v2
        [*] --&gt; Created : New() / CreateContext()
        Created --&gt; Initialized : Init()
        Initialized --&gt; Active : Activate() / Display()
        Active --&gt; Refreshing : Refresh()
        Refreshing --&gt; Active
        Active --&gt; Suspended : KillFocus()
        Suspended --&gt; Active : SetFocus()
        Active --&gt; Destroyed : End() / Destroy()
        Destroyed --&gt; [*]
    <e>

    ---

    Generated by Deep Code Analysis Skill β€” DeepWiki Style β€” 2026-03-01

    regards, saludos

    Antonio Linares
    www.fivetechsoft.com
    Posts: 44158
    Joined: Thu Oct 06, 2005 05:47 PM
    Re: Antigravity as bugs solver and tech support
    Posted: Sun Mar 01, 2026 01:51 PM
    regards, saludos

    Antonio Linares
    www.fivetechsoft.com
    Posts: 6983
    Joined: Fri Oct 07, 2005 07:07 PM
    Re: Antigravity as bugs solver and tech support
    Posted: Sun Mar 01, 2026 04:41 PM

    Dear Antonio,
    I just had Claude generate a skill.md file using your template as inspirationβ€”really interesting stuff!

    What especially caught my attention was the feedback:

    "This would be a useful open-source package: a 'Harbour DBF Microservice'β€”an HTTP/JSON interface for any DBF database, featuring record locking, audit logging, and optimistic resource locking. Nothing like this exists yet."

    A standout feature is the DBF-Lock: fully generic (using DATABASE + RES_KEY as free strings), it works for any DBF resource in any project.

    Best regards,
    Otto

    Continue the discussion