Files
five/examples/dbfview.prg
Charles KWON OhJun 59568f3301 Five v0.9 — Harbour + Go fusion language
- Compiler: PP → Lexer → Parser → Analyzer → Gengo pipeline
- Parser: 232/236 (98%) Harbour compatibility, registry-based dispatch
- RTL: 351 Harbour-compatible functions
- RDD: DBF/NTX/CDX engines with Rushmore bitmap optimization
- Go Interop: IMPORT + pkg.Func() + obj:Method() with FastPath (15M calls/sec)
- HB_FUNC API: Full Harbour C API compatible Go bridge
- Concurrency: SPAWN/LAUNCH/GOROUTINE, <-, WATCH, PARALLEL FOR, ASYNC/AWAIT
- Extensions: Multi-return, DEFER, Slice, f-string, Nil-safe ?:, CONST
- Macro Compiler: Runtime AST parsing and evaluation
- Debugger: TUI debugger with source display, breakpoints, stepping
- FRB: Native + Pcode dual mode runtime binary
- Tests: 13 packages ALL PASS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 09:41:50 +09:00

67 lines
1.5 KiB
Plaintext

// Five DBF Viewer — browse database with TBrowse
// Usage: ./dbfview (opens dbf/customer.dbf)
// Keys: Up/Down/Left/Right PgUp/PgDn Home/End ESC=quit
// Copyright (c) 2026 Charles KWON OhJun (charleskwonohjun@gmail.com)
FUNCTION Main()
LOCAL oBrowse, oCol, nKey, i, nFields
CLS
SetCursor(0)
USE "dbf/customer"
nFields := FCount()
IF nFields = 0
? "Cannot open database"
Inkey(0)
RETURN NIL
ENDIF
// Title
@ 0, 0 SAY PadR("customer.dbf - " + AllTrim(Str(RecCount())) + " records, " + AllTrim(Str(nFields)) + " fields - ESC to quit", 80)
// Build browse
oBrowse := TBrowseDB(1, 0, 22, 79)
FOR i := 1 TO nFields
oCol := TBColumnNew(FieldName(i), FieldBlock(i))
oBrowse:addColumn(oCol)
NEXT
// Browse loop
DO WHILE .T.
oBrowse:forceStable()
// Status
@ 23, 0 SAY PadR("Rec:" + AllTrim(Str(RecNo())) + "/" + AllTrim(Str(RecCount())) + IIF(Eof()," EOF","") + IIF(Deleted()," DEL",""), 80)
nKey := Inkey(0)
DO CASE
CASE nKey = 5
oBrowse:up()
CASE nKey = 24
oBrowse:down()
CASE nKey = 19
oBrowse:left()
CASE nKey = 4
oBrowse:right()
CASE nKey = 18
oBrowse:pageUp()
CASE nKey = 3
oBrowse:pageDown()
CASE nKey = 1
oBrowse:goTop()
CASE nKey = 6
oBrowse:goBottom()
CASE nKey = 27
EXIT
ENDCASE
ENDDO
CLS
SetCursor(1)
USE
RETURN NIL