Files
five/hbrtl/rdd.go
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

124 lines
2.2 KiB
Go

// Copyright (c) 2026 Charles KWON OhJun (charleskwonohjun@gmail.com)
// All rights reserved.
// RDD-related RTL functions: EOF(), BOF(), Found(), RecNo(), RecCount(), Deleted().
// These read the current workarea state from Thread.WA.
package hbrtl
import (
"five/hbrt"
"five/hbrdd"
)
func rtlEOF(t *hbrt.Thread) {
t.Frame(0, 0)
defer t.EndProc()
if wa := getWA(t); wa != nil {
if area := wa.Current(); area != nil {
t.PushBool(area.EOF())
t.RetValue()
return
}
}
t.PushBool(true)
t.RetValue()
}
func rtlBOF(t *hbrt.Thread) {
t.Frame(0, 0)
defer t.EndProc()
if wa := getWA(t); wa != nil {
if area := wa.Current(); area != nil {
t.PushBool(area.BOF())
t.RetValue()
return
}
}
t.PushBool(true)
t.RetValue()
}
func rtlFound(t *hbrt.Thread) {
t.Frame(0, 0)
defer t.EndProc()
if wa := getWA(t); wa != nil {
if area := wa.Current(); area != nil {
t.PushBool(area.Found())
t.RetValue()
return
}
}
t.PushBool(false)
t.RetValue()
}
func rtlRecNo(t *hbrt.Thread) {
t.Frame(0, 0)
defer t.EndProc()
if wa := getWA(t); wa != nil {
if area := wa.Current(); area != nil {
t.RetInt(int64(area.RecNo()))
return
}
}
t.RetInt(0)
}
func rtlRecCount(t *hbrt.Thread) {
t.Frame(0, 0)
defer t.EndProc()
if wa := getWA(t); wa != nil {
if area := wa.Current(); area != nil {
rc, _ := area.RecCount()
t.RetInt(int64(rc))
return
}
}
t.RetInt(0)
}
func rtlDeleted(t *hbrt.Thread) {
t.Frame(0, 0)
defer t.EndProc()
if wa := getWA(t); wa != nil {
if area := wa.Current(); area != nil {
t.PushBool(area.Deleted())
t.RetValue()
return
}
}
t.PushBool(false)
t.RetValue()
}
func rtlFieldGet(t *hbrt.Thread) {
// FIELD->name is handled by gengo codegen, not this function.
// This is for FieldGet(n) function call.
t.Frame(1, 0)
defer t.EndProc()
n := int(t.Local(1).AsNumInt())
if wa := getWA(t); wa != nil {
if area := wa.Current(); area != nil {
val, err := area.GetValue(n - 1) // 1-based to 0-based
if err == nil {
t.PushValue(val)
t.RetValue()
return
}
}
}
t.PushNil()
t.RetValue()
}
func getWA(t *hbrt.Thread) *hbrdd.WorkAreaManager {
if t.WA == nil {
return nil
}
wa, ok := t.WA.(*hbrdd.WorkAreaManager)
if !ok {
return nil
}
return wa
}