PrintTree.inc - library containing PRINTTREE function capable of presenting lists in human readable format.
PrintTree.inc
#Int4 KB sample — AS IS, not official docs, no support. Test before use.
DEFUN("_PRINTTREE", ("LIST", "T"),
LOCALS(("I", "R", "J"),
FOR(
I=1;R="";J=INDEXES(LIST),
I<=COUNT(J),
I+=1,
R &= "{T}\t{J[i]} => " &
IF(count(LIST[J[i]])>0, _PRINTTREE(LIST[J[i]], "{T}\t"), LIST[J[i]]) &
"\n"
);
"[\n{R}{T}]"
)
);
DEFUN("PRINTTREE", "LIST", _PRINTTREE(LIST, ""));
# # TEST CODE - run to test
# X=CREGEX("a([^b]+)", "abaeadedeasdebdaedbaedbefriaufefudebdahed", "G");
# PRINTTREE(X)
#=============================================================================
# SUPPLEMENTARY SAMPLE — NOT OFFICIAL DOCUMENTATION
#=============================================================================
# Provided AS IS to active customers via the Int4 Knowledge Base.
# No warranty, no SLA, no support coverage. Test in a non-production
# environment before use. You are responsible for any consequences of
# running or modifying this code.
#=============================================================================