Files
five/examples/rtl_test.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

54 lines
1.1 KiB
Plaintext

FUNCTION Main()
LOCAL aData, i, nPos
// Array operations
? "=== Array Test ==="
aData := {10, 30, 20, 50, 40}
? "Original:", Len(aData), "items"
AAdd(aData, 60)
? "After AAdd:", Len(aData), "items"
ASort(aData)
? "Sorted:"
FOR i := 1 TO Len(aData)
? " [" + Str(i) + "]", aData[i]
NEXT
nPos := AScan(aData, 30)
? "AScan(30) found at:", nPos
? "ATail:", ATail(aData)
// String operations
? ""
? "=== String Test ==="
? Upper("hello world")
? Lower("HELLO WORLD")
? AllTrim(" spaces ")
? Replicate("*", 10)
? PadR("Left", 15) + "|"
? PadL("Right", 15) + "|"
// Type checking
? ""
? "=== Type Test ==="
? "ValType(42):", ValType(42)
? "ValType('abc'):", ValType("abc")
? "ValType(.T.):", ValType(.T.)
? "ValType(NIL):", ValType(NIL)
? "ValType({}):", ValType({})
? "Empty(''):", Empty("")
? "Empty(0):", Empty(0)
? "Empty('x'):", Empty("x")
// Date
? ""
? "=== Date Test ==="
? "Time:", Time()
? "Seconds:", Seconds()
? ""
? "All tests passed!"
RETURN NIL