diff --git a/hbrtl/register.go b/hbrtl/register.go index daace7f..3ae1dfa 100644 --- a/hbrtl/register.go +++ b/hbrtl/register.go @@ -322,16 +322,30 @@ func RegisterRTL(vm *hbrt.VM) { // Type checking (HB_IS*) hbrt.Sym("HB_ISARRAY", hbrt.FsPublic, HbIsArray), + // Classic Clipper/Harbour aliases — `common.ch` #translate rules + // map these to HB_IS*. Registering the short names as direct + // symbols bypasses the PP altogether and makes them work even + // when code doesn't include common.ch. + hbrt.Sym("ISARRAY", hbrt.FsPublic, HbIsArray), hbrt.Sym("HB_ISBLOCK", hbrt.FsPublic, HbIsBlock), + hbrt.Sym("ISBLOCK", hbrt.FsPublic, HbIsBlock), hbrt.Sym("HB_ISCHAR", hbrt.FsPublic, HbIsChar), hbrt.Sym("HB_ISSTRING", hbrt.FsPublic, HbIsString), + hbrt.Sym("ISCHARACTER", hbrt.FsPublic, HbIsString), + hbrt.Sym("ISMEMO", hbrt.FsPublic, HbIsString), // memo ≈ string for Five hbrt.Sym("HB_ISDATE", hbrt.FsPublic, HbIsDate), + hbrt.Sym("ISDATE", hbrt.FsPublic, HbIsDate), hbrt.Sym("HB_ISDATETIME", hbrt.FsPublic, HbIsDateTime), hbrt.Sym("HB_ISLOGICAL", hbrt.FsPublic, HbIsLogical), + hbrt.Sym("ISLOGICAL", hbrt.FsPublic, HbIsLogical), hbrt.Sym("HB_ISNUMERIC", hbrt.FsPublic, HbIsNumeric), + hbrt.Sym("ISNUMBER", hbrt.FsPublic, HbIsNumeric), + hbrt.Sym("ISNUMERIC", hbrt.FsPublic, HbIsNumeric), hbrt.Sym("HB_ISOBJECT", hbrt.FsPublic, HbIsObject), + hbrt.Sym("ISOBJECT", hbrt.FsPublic, HbIsObject), hbrt.Sym("HB_ISHASH", hbrt.FsPublic, HbIsHash), hbrt.Sym("HB_ISNIL", hbrt.FsPublic, HbIsNil), + hbrt.Sym("ISNIL", hbrt.FsPublic, HbIsNil), hbrt.Sym("HB_ISPOINTER", hbrt.FsPublic, HbIsPointer), // OS/Environment diff --git a/include/common.ch b/include/common.ch new file mode 100644 index 0000000..22a2d61 --- /dev/null +++ b/include/common.ch @@ -0,0 +1,26 @@ +/* + * common.ch — Five compatibility shim for Harbour's common.ch + * + * Harbour ships #translate-based aliases for ISNIL / ISARRAY / + * ISNUMBER / ISCHARACTER / ISLOGICAL / ISDATE / ISBLOCK / ISMEMO / + * ISOBJECT. Five registers those as direct RTL symbols in + * hbrtl/register.go (each points at the same Go function as its + * HB_IS* twin), so they work without any preprocessor translation + * and without this include. + * + * This header stays as a stub so `#include "common.ch"` in ported + * Harbour code doesn't error. The DEFAULT / UPDATE #xcommand forms + * from Harbour's common.ch are not yet supported — use explicit + * `IF xVar == NIL ; xVar := default ; ENDIF` until the preprocessor's + * #xcommand marker handling is extended. + */ + +#ifndef HB_COMMON_CH_ +#define HB_COMMON_CH_ + +#define TRUE .T. +#define FALSE .F. +#define YES .T. +#define NO .F. + +#endif