124# include <tclap/CmdLine.h>
372# define INFIXPOS(p) ((p)->getCount())
373# define LEVEL(p) ((p)->get_level())
374# define X(p) ((p)->get_x())
375# define Y(p) ((p)->get_y())
376# define XOFFSET(p) ((p)->get_xoffset())
377# define YOFFSET(p) ((p)->get_yoffset())
378# define TRIANGLEH(p) ((p)->get_triangle_height())
379# define RECTANGLEH(p) ((p)->get_rectangle_height())
380# define EXTERNAL(p) ((p)->get_external_node())
381# define ISEXTERNAL(p) ((p)->is_external())
382# define ISTRIANGLE(p) ((p)->is_triangle())
383# define DSTRING(p) ((p)->get_distance_string())
384# define LDISTANCE(p) ((p)->get_line_distance_data())
385# define ISDISTANCE(p) ((p)->get_line_distance_data().str.empty())
386# define ISRECTANGLE(p) ((p)->is_rectangle())
387# define STRING(p) ((p)->get_key_string())
388# define AUX(p) ((p)->get_aux_string())
389# define SHADOW(p) ((p)->get_shadow())
390# define WITHOUT(p) ((p)->get_without_node())
391# define SCRATCH(p) ((p)->get_scratch())
392# define WITHARC(p) ((p)->get_with_arc())
393# define DASHLLINK(p) ((p)->get_dash_llink())
394# define DASHRLINK(p) ((p)->get_dash_rlink())
395# define TAGLIST(p) ((p)->get_tag_list())
396# define ARCLIST(p) ((p)->get_arc_list())
397# define THREADLIST(p) ((p)->get_thread_list())
398# define SUCC(p) ((p)->get_succ())
399# define PREV(p) ((p)->get_prev())
507# define TERMINATE(n) (save_parameters(), exit(n))
509# define DYNARRAY_APPEND(array, item) (array[array.size()] = item)
511using namespace Aleph;
574 PRINT_ERROR(
"Node position greater than number of nodes in KEY option");
646 PRINT_ERROR(
"Invalid orientation in DISTANCE option");
667 catch (
const std::out_of_range &) {
return END_FILE; }
904 while (
root !=
nullptr)
1066 PRINT_ERROR(
"Distance line on %d th node has a left branch",
1069 PRINT_ERROR(
"Distance line on %d th node has a right branch",
1093 X(p) =
hr + position *
w;
1095 Y(p) = level *
h +
vr;
1103 while (
RLINK(prev) !=
nullptr)
1113 while (
LLINK(succ) !=
nullptr)
1157 default:
PRINT_ERROR(
"Found an string in invalid mode (%ld)",
1188 default:
AH_ERROR(
"Found an integer in invalid mode (%ld)",
1282 PRINT_ERROR(
"Internal error: invalid token type (%ld)",
1287 catch (exception & e)
1352 const size_t & level)
1358 it.has_curr(); it.next())
1450 AH_ERROR(
"Sizes of traversals differ");
1461 AH_ERROR(
"Number of keys is different from tree size");
1471 AH_ERROR(
"Number of auxiliary keys is different from tree size");
1592 catch (exception & e)
1605 <<
"% This LaTeX picture is a binary tree automatically" <<
endl
1606 <<
"% generated by btreepic program" <<
endl
1608 <<
"% Copyright (C) 2007, 2006, 2005, 2004, 2003, 2002" <<
endl
1609 <<
"% UNIVERSITY of LOS ANDES (ULA)" <<
endl
1610 <<
"% Merida - REPUBLICAf1727 BOLIVARIANA DE VENEZUELA" <<
endl
1611 <<
"% Center of Studies in Microelectronics & Distributed Systems"
1612 <<
" (CEMISID)" <<
endl
1613 <<
"% ULA Computer Science Department" <<
endl
1615 <<
"% Leandro Leon - lrleon@ula.ve" <<
endl
1617 <<
"% You must use curves, epic and eepic latex packages" <<
endl
1618 <<
"% in your LaTeX application" <<
endl
1620 <<
"% curves Copyright by I.L. Maclaine-cross" <<
endl
1621 <<
"% epic Copyright by Sunil Podar" <<
endl
1622 <<
"% eepic Copyright by Conrad Kwok" <<
endl
1623 <<
"% LaTeX is a collection of TeX macros created by Leslie Lamport"
1625 <<
"% TeX was created by Donald Knuth" <<
endl
1627 <<
"% command line: " <<
endl
1633 <<
"% Creation date: " <<
ctime(&t) <<
endl
1637 output <<
"%%%%%%%%%%%%%%%% LATEX Header generated with -a option" <<
endl
1638 <<
"\\documentclass[11pt]{article}" <<
endl
1639 << (
landscape ?
"\\usepackage[landscape]{geometry}" :
"") <<
endl
1642 <<
"\\usepackage{epic}" <<
endl
1643 <<
"\\usepackage{eepic}" <<
endl
1644 <<
"\\usepackage{amssymb}" <<
endl
1646 <<
"\\begin{document}" <<
endl
1647 <<
"\\begin{center}" <<
endl;
1651 <<
"% Change resolution with -l option" <<
endl
1656 <<
"\\begin{picture}(" <<
h_size <<
"," <<
v_size <<
")"
1664 <<
"\\end{picture}" <<
endl;
1668 <<
"\\end{center}" <<
endl
1669 <<
"\\end{document}" <<
endl;
1677 long double x =
X(p);
1678 long double y =
Y(p);
1683 <<
"% Node at infix position " <<
INFIXPOS(p)
1684 <<
" with key " <<
STRING(p);
1689 <<
"% External node" <<
endl
1690 <<
"\\path(" << x -
hr <<
"," <<
YPIC(
y) <<
")("
1694 <<
"% Triangle" <<
endl
1695 <<
"\\path(" << x <<
"," <<
YPIC(
y) <<
")("
1698 << x <<
"," <<
YPIC(
y) <<
")";
1701 long double x1 =
X(p) -
hr;
1702 long double x2 =
X(p) +
hr;
1711 <<
"% Partial Rectangle" <<
endl
1712 <<
"\\path(" << x1 <<
"," <<
YPIC(
y1) <<
")("
1713 << x2 <<
"," <<
YPIC(
y1) <<
")("
1714 << x2 <<
"," <<
YPIC(y2) <<
")("
1715 << x1 <<
"," <<
YPIC(y2) <<
")("
1716 << x1 <<
"," <<
YPIC(
y1) <<
")";
1722 <<
"\\dashline{" <<
dash_len <<
"}("
1723 << x1 <<
"," <<
YPIC(
y1) <<
")("
1724 << x1 <<
"," <<
YPIC(y2) <<
")("
1725 << x2 <<
"," <<
YPIC(y2) <<
")("
1727 <<
"\\path(" << x1 <<
"," <<
YPIC(
y1) <<
")("
1728 << x2 <<
"," <<
YPIC(y2) <<
")" <<
endl
1729 <<
"\\path(" << x2 <<
"," <<
YPIC(
y1) <<
")("
1730 << x1 <<
"," <<
YPIC(y2) <<
")";
1738 <<
"% Rectangle" <<
endl
1739 <<
"\\path(" << x1 <<
"," <<
YPIC(
y1) <<
")("
1740 << x2 <<
"," <<
YPIC(
y1) <<
")("
1741 << x2 <<
"," <<
YPIC(y2) <<
")("
1742 << x1 <<
"," <<
YPIC(y2) <<
")("
1743 << x1 <<
"," <<
YPIC(
y1) <<
")";
1748 <<
"% Elippse" <<
endl
1749 <<
"\\put(" << x <<
"," <<
YPIC(
y) <<
")"
1750 << (
SHADOW(p) ?
"{\\ellipse*{" :
"{\\ellipse{") <<
hd
1751 <<
"}{" <<
vd <<
"}}";
1754 <<
"% Elippse" <<
endl
1755 <<
"\\put(" << x <<
"," <<
YPIC(
y) <<
"){\\ellipse*{" <<
hd
1756 <<
"}{" <<
vd <<
"}}";
1762 <<
"% Distance line";
1777 xd =
ldd.is_left() ? -(
w / 2 +
xof) : (
w / 2 +
xof);
1783 long double xl = x + xd;
1810 "String of line distance",
ldd.str);
1846 <<
"\\path(" << x -
hr <<
"," <<
YPIC(
y) <<
")("
1847 << x +
hr <<
"," <<
YPIC(
y) <<
")";
1853 "Auxiliar string= " +
AUX(p),
AUX(p));
1920 PRINT_ERROR(
"Internal error: unexpected tag option");
1931 <<
"% Scratching" <<
endl
1932 <<
"\\path(" << x -
dr <<
"," <<
YPIC(
y -
dr) <<
")"
1933 <<
"(" << x +
dr <<
"," <<
YPIC(
y +
dr) <<
")"
1934 <<
"\\path(" << x +
dr <<
"," <<
YPIC(
y -
dr) <<
")"
1935 <<
"(" << x -
dr <<
"," <<
YPIC(
y +
dr) <<
")";
1997 <<
"% Additional arc to infix node "
2009 long double lx =
X(
l);
2010 long double ly =
Y(
l);
2014 <<
"% Arc to left infix node " <<
INFIXPOS(
l)
2026 long double px =
X(prev);
2027 long double py =
Y(prev);
2031 <<
"% Thread to predecessor infix node " <<
INFIXPOS(prev)
2039 <<
px <<
"," <<
YPIC(
y +
h) <<
")("
2046 long double rx =
X(r);
2047 long double ry =
Y(r);
2051 <<
"% Arc to right infix node " <<
INFIXPOS(r)
2063 long double px =
X(succ);
2064 long double py =
Y(succ);
2068 <<
"% Thread to successor infix node " <<
INFIXPOS(succ)
2076 <<
px <<
"," <<
YPIC(
y +
h) <<
")("
2088 PRINT_ERROR(
"Number of split points is greater than total of nodes");
2094 PRINT_ERROR(
"Split position (%d) out of range", pos);
2098 const long double x =
X(src);
2104 <<
"% Split line at node " <<
INFIXPOS(src)
2106 <<
"\\dashline{" <<
dash_len <<
"}(" << x <<
","
2130 <<
"\\put(" << x -
dx <<
","
2140 "ALEPH drawer for binary trees\n"
2141 "Copyright (C) 2007 UNIVERSITY of LOS ANDES (ULA)\n"
2142 "Merida - REPUBLICA BOLIVARIANA DE VENEZUELA\n"
2143 "Center of Studies in Microelectronics & Distributed Systems (CEMISID)\n"
2144 "ULA Computer Science Department\n"
2145 "This is free software; There is NO warranty; not even for MERCHANTABILITY\n"
2146 "or FITNESS FOR A PARTICULAR PURPOSE\n"
2151 "ALEPH drawer for binary trees\n"
2152 "Copyright (C) 2007, 2006, 2005, 2004, 2003, 2002 University of Los Andes (ULA)\n"
2153 "Merida - REPUBLICA BOLIVARIANA DE VENEZUELA\n"
2154 "Center of Studies in Microelectronics & Distributed Systems (CEMISID)\n"
2155 "ULA Computer Science Department\n"
2156 "This is free software; There is NO warranty; not even for MERCHANTABILITY\n"
2157 "or FITNESS FOR A PARTICULAR PURPOSE\n"
2161 "Aleph drawer for binary trees. License & Copyright Note\n"
2162 "Copyright (C) 2007, 2006, 2005, 2004, 2003, 2002\n"
2163 "UNIVERSITY of LOS ANDES (ULA)\n"
2164 "Merida - VENEZUELA\n"
2165 "Center of Studies in Microelectronics & Distributed Systems (CEMISID)\n"
2166 "ULA Computer Science Department\n"
2167 "This is free software; There is NO warranty; not even for MERCHANTABILITY\n"
2168 "or FITNESS FOR A PARTICULAR PURPOSE\n"
2170 " PERMISSION TO USE, COPY, MODIFY AND DISTRIBUTE THIS SOFTWARE AND ITS \n"
2171 " DOCUMENTATION IS HEREBY GRANTED, PROVIDED THAT BOTH THE COPYRIGHT \n"
2172 " NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES OF THE \n"
2173 " SOFTWARE, DERIVATIVE WORKS OR MODIFIED VERSIONS, AND ANY PORTIONS \n"
2174 " THEREOF, AND THAT BOTH NOTICES APPEAR IN SUPPORTING DOCUMENTATION. \n"
2176 " This program is distributed in the hope that it will be useful,\n"
2177 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
2178 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n"
2180 " ULA requests users of this software to return to \n"
2181 " Proyecto Aleph - CEMISID Software\n"
2182 " Nucleo Universitario La Hechicera. Ed Ingenieria\n"
2183 " 3er piso, ala Este \n"
2184 " Universidad de Los Andes \n"
2185 " Merida 5101 - REPUBLICA BOLIVARIANA DE VENEZUELA \n"
2187 " or to lrleon@ula.ve \n"
2189 " any improvements or extensions that they make and grant Universidad \n"
2190 " de Los Andes (ULA) the full rights to redistribute these changes. \n"
2192 " This program was granted by: \n"
2193 " - Consejo de Desarrollo Cientifico, Humanistico, Tecnico de la ULA\n"
2201 <<
"Horizontal radius -x = " <<
hr <<
endl
2202 <<
"Vertical radius -y = " <<
vr <<
endl
2203 <<
"Horizontal diameter = " <<
hd <<
endl
2204 <<
"Vertical diameter = " <<
vd <<
endl
2205 <<
"Horizontal separation -w = " <<
w <<
endl
2206 <<
"Vertical separation -h = " <<
h <<
endl
2210 <<
"Horizontal offset for key -X = " <<
x_offset <<
endl
2228 TCLAP::ValueArg<double>
radiusArg(
"r",
"radius",
"fit radius for circles",
false, 0.0,
"double");
2229 TCLAP::ValueArg<double>
widthArg(
"w",
"width",
"horizontal separation",
false,
w,
"double");
2230 TCLAP::ValueArg<double>
heightArg(
"h",
"height",
"vertical separation",
false,
h,
"double");
2231 TCLAP::ValueArg<double>
hRadiusArg(
"x",
"h-radius",
"horizontal radius (ellipse)",
false,
hr,
"double");
2232 TCLAP::ValueArg<double>
vRadiusArg(
"y",
"v-radius",
"vertical radius (ellipse)",
false,
vr,
"double");
2233 TCLAP::ValueArg<double>
resolArg(
"l",
"resol",
"resolution in mm",
false,
resolution,
"double");
2234 TCLAP::SwitchArg
latexArg(
"a",
"latex",
"add latex header",
false);
2235 TCLAP::SwitchArg
landscapeArg(
"p",
"landscape",
"latex landscape mode",
false);
2236 TCLAP::SwitchArg
withKeyArg(
"k",
"with-key",
"printing keys",
false);
2237 TCLAP::SwitchArg
tinyKeysArg(
"K",
"tiny-keys",
"printing keys with tiny font",
false);
2238 TCLAP::SwitchArg
fitArg(
"t",
"fit",
"fit in rectangle",
false);
2239 TCLAP::ValueArg<double>
horizontalArg(
"z",
"horizontal",
"specify horizontal width for fitting",
false,
h_size,
2241 TCLAP::ValueArg<double>
verticalArg(
"u",
"vertical",
"specify vertical height for fitting",
false,
v_size,
2243 TCLAP::SwitchArg
minRadiusArg(
"n",
"min-radius",
"radious is minimum",
false);
2244 TCLAP::SwitchArg
withoutNodeArg(
"N",
"without-node",
"no draw node; only arcs",
false);
2245 TCLAP::ValueArg<double>
keyXOffsetArg(
"X",
"key-x-offset",
"horizontal offset for keys",
false,
x_offset,
2247 TCLAP::ValueArg<double>
keyYOffsetArg(
"Y",
"key-y-offset",
"vertical offset for keys",
false,
y_offset,
"double");
2248 TCLAP::ValueArg<double>
auxYOffsetArg(
"H",
"aux-y-offset",
"vertical offset for auxiliary string",
false,
2250 TCLAP::ValueArg<double>
auxXOffsetArg(
"W",
"aux-x-offset",
"horizontal offset for auxiliary string",
false,
2252 TCLAP::ValueArg<string>
inputFileArg(
"i",
"input-file",
"input file",
false,
"",
"string");
2253 TCLAP::ValueArg<string>
inputFileAliasArg(
"f",
"file",
"input file (alias)",
false,
"",
"string");
2254 TCLAP::ValueArg<string>
outputFileArg(
"o",
"output",
"output file",
false,
"",
"string");
2255 TCLAP::SwitchArg
licenseArg(
"C",
"license",
"print license",
false);
2256 TCLAP::ValueArg<double>
xPictureOffsetArg(
"O",
"x-picture-offset",
"horizontal global picture offset",
false,
2258 TCLAP::ValueArg<double>
yPictureOffsetArg(
"P",
"y-picture-offset",
"vertical global picture offset",
false,
2260 TCLAP::SwitchArg
printArg(
"R",
"print",
"print current parameters",
false);
2261 TCLAP::SwitchArg
verboseArg(
"v",
"verbose",
"verbose mode",
false);
2262 TCLAP::SwitchArg
unsilentArg(
"s",
"unsilent",
"unsilent mode - print tokens",
false);
2263 TCLAP::SwitchArg
versionArg(
"V",
"version",
"Print version information and then exit",
false);
2264 TCLAP::SwitchArg
blackFillArg(
"B",
"black-fill",
"Fill black ellipses",
false);
2265 TCLAP::SwitchArg
shadeFillArg(
"S",
"shade-fill",
"Fill shade ellipses",
false);
2266 TCLAP::SwitchArg
threadedArg(
"D",
"threaded",
"draw dotted threads instead nullptr pointers",
false);
2267 TCLAP::SwitchArg
threadedNoDashArg(
"T",
"threaded-no-dash",
"draw contiguous threads instead nullptr pointers",
2269 TCLAP::SwitchArg
externalNodesArg(
"e",
"external-nodes",
"draw external nodes",
false);
2272 TCLAP::SwitchArg
arrowsArg(
"A",
"arrows",
"draw arcs with arrows",
false);
2273 TCLAP::SwitchArg
verticalFlipArg(
"F",
"vertical-flip",
"Flip tree respect y axe",
false);
2274 TCLAP::SwitchArg
helpArg(
"",
"help",
"Print this help message",
false);
2320 cmd.getOutput()->usage(
cmd);
2419 catch (TCLAP::ArgException & e)
2421 cerr <<
"error: " << e.error() <<
" for arg " << e.argId() <<
endl;
#define AH_ERROR(format, args...)
Print an error message (always enabled).
Core header for the Aleph-w library.
WeightedDigraph::Node Node
DynArray< Thread_Data > target_thread_dynarray
void assign_pos_and_level(EepicNode< long > *p, const int level, const int position)
void thread_tree(EepicNode< long > *p)
const char * parameters_file_name
void assign_rectangle(EepicNode< long > *p, int, const int position)
void assign_tag(EepicNode< long > *p, int, const int position)
bool west_offset(EepicNode< long > *root)
Token_Type get_token(ifstream &input_stream)
Node * select(Node *root, const int &i)
void load_tag_option(ifstream &input_stream)
void file_to_dynarrays(const char *file_name)
DynArray< long > key_pos_dynarray
DynArray< long > shadow_dynarray
void assign_xoffset(EepicNode< long > *p, int, const int position)
bool south_offset(EepicNode< long > *root, const size_t &level)
void load_thread_option(ifstream &input_stream)
DynArray< long > pos_parrectangle_dynarray
void assign_distance(EepicNode< long > *p, int, const int position)
void assign_external_nodes(EepicNode< long > *p)
DynArray< long > pos_xoffset_dynarray
DynArray< long > tag_pos_dynarray
void load_parrectangle_option(ifstream &input_stream)
void adjust_size_by_tags(EepicNode< long > *root, const size_t &height)
void assign_key(EepicNode< long > *p, int, const int position)
void generate_split_lines(ofstream &output, EepicNode< long > *root)
DynArray< long > infix_dynarray
void assign_aux(EepicNode< long > *p, int, const int position)
void generate_epilogue(ofstream &output)
DynArray< long > without_node_dynarray
static constexpr char license_text[]
DynArray< long > pos_distance_dynarray
void assign_arcs(EepicNode< long > *root, EepicNode< long > *p)
void load_arc_option(ifstream &input_stream, const Token_Type &token_type)
long double x_picture_offset
DynArray< long double > xoffset_dynarray
void load_offset_option(ifstream &input_stream, DynArray< long > &positions, DynArray< long double > &offsets)
const char * argp_program_version
DynArray< Line_Distance_Data > distance_dynarray
DynArray< long double > height_parrectangle_dynarray
DynArray< string > key_print_dynarray
DynArray< Arc_Data > target_arc_dynarray
void assign_yoffset(EepicNode< long > *p, int, const int position)
void assign_triangle(EepicNode< long > *p, int, const int position)
DynArray< long double > height_rectangle_dynarray
void compute_picture_size(EepicNode< long > *p)
DynArray< long > pos_rectangle_dynarray
void assign_without_node(EepicNode< long > *p, int, const int position)
void load_split_option(ifstream &input_stream)
DynArray< long double > height_triangle_dynarray
void load_distance_option(ifstream &input_stream)
void assign_shadow(EepicNode< long > *p, int, const int position)
EepicNode< long > * build_tree()
DynArray< long > scratch_dynarray
DynArray< string > aux_print_dynarray
void reassign_key(EepicNode< long > *p, int, const int position)
DynArray< long > prefix_dynarray
DynArray< string > key_string_dynarray
void assign_without_arc(EepicNode< long > *p, int, const int position)
DynArray< long > without_arc_dynarray
void load_rectangle_option(ifstream &input_stream)
void assign_parrectangle(EepicNode< long > *p, int, const int position)
#define DYNARRAY_APPEND(array, item)
DynArray< long double > yoffset_dynarray
DynArray< long > pos_yoffset_dynarray
DynArray< long > pos_triangle_dynarray
void set_picture_size(EepicNode< long > *p)
DynArray< Tag_Data > tag_data_dynarray
void assign_scratch(EepicNode< long > *p, int, const int position)
long double y_picture_offset
void generate_prologue(ofstream &output)
void load_triangle_option(ifstream &input_stream)
bool north_offset(EepicNode< long > *p)
DynArray< long > source_arc_dynarray
DynArray< long > source_thread_dynarray
void load_triangleh_option(ifstream &input_stream)
int max_num_nodes_rectangle
void generate_tree(ofstream &output, EepicNode< long > *p)
DynArray< Split_Data > split_string_dynarray
void load_key_option(ifstream &input_stream)
DynArray< long > split_dynarray
bool east_offset(EepicNode< long > *root)
void cut(const size_t new_dim=0)
Cut the array to a new dimension; that is, it reduces the dimension of array and frees the remaining ...
size_t size() const noexcept
Return the current dimension of array.
Dynamic doubly linked list with O(1) size and bidirectional access.
size_t size() const noexcept
Count the number of elements of the list.
DynDlist< Tag_Data > tag_list
Line_Distance_Data & get_line_distance_data()
bool & get_external_node()
DynDlist< Thread_Desc > thread_list
long double & get_yoffset()
long double & get_xoffset()
string & get_key_string()
Line_Distance_Data line_distance_data
DynDlist< Arc_Desc > & get_arc_list()
long double triangle_height
long double rectangle_height
bool is_rectangle() const
bool & get_without_node()
string & get_aux_string()
DynDlist< Arc_Desc > arc_list
EepicNode< long > *& get_prev()
DynDlist< Tag_Data > & get_tag_list()
long double & get_triangle_height()
DynDlist< Thread_Desc > & get_thread_list()
long double & get_rectangle_height()
EepicNode< long > *& get_succ()
bool tiny_keys
Global flag to enable tiny font size for keys/labels.
__gmp_expr< T, __gmp_unary_expr< __gmp_expr< T, U >, __gmp_y1_function > > y1(const __gmp_expr< T, U > &expr)
__gmp_expr< T, __gmp_binary_expr< __gmp_expr< T, U >, unsigned long int, __gmp_root_function > > root(const __gmp_expr< T, U > &expr, unsigned long int l)
int preOrderRec(Node *root, void(*visitFct)(Node *, int, int))
Traverse recursively in preorder a binary tree.
DynDlist< Node * > compute_nodes_in_level(Node *root, const int &level)
Count the number of nodes in a specific tree level.
Node * find_min(Node *root) noexcept
Return the minimum key contained in a binary search tree.
constexpr Node *& RLINK(Node *p) noexcept
Return the right tree of p.
int inOrderRec(Node *root, void(*visitFct)(Node *, int, int))
Traverse recursively inorder a binary tree.
#define DECLARE_BINNODE(Name, height, Control_Data)
Specify tree node for a binary tree.
constexpr Node *& LLINK(Node *p) noexcept
Return a pointer to left subtree.
size_t computeHeightRec(Node *root) noexcept
Compute recursively the height of root
Node * find_max(Node *root) noexcept
Return the maximum key contained in a binary search tree.
Main namespace for Aleph-w library functions.
long search_max(T *a, const long l, const long r, const Compare &cmp=Compare())
Returns the maximum element of the array a between l and r.
void init_token_scanning()
Initialize token scanning by recording current position.
void close_token_scanning(const char *buffer, char *&start_addr, const char *end_addr)
Finalize token scanning by null-terminating and saving the token.
int read_char_from_stream(std::ifstream &input_stream)
Read a single character from an input stream with position tracking.
void print_parse_error_and_exit(const std::string &str)
Print a parse error message and terminate the program.
std::string token_instance
The most recently scanned token.
void put_char_in_buffer(char *&start_addr, const char *end_addr, int c)
Append a character to a buffer with bounds checking.
std::string command_line_to_string(int argc, char *argv[])
Convert command line arguments to a single string.
void skip_white_spaces(std::ifstream &input_stream)
Skip whitespace characters in the input stream.
constexpr size_t Buffer_Size
Default buffer size for token parsing.
std::string load_string(std::ifstream &input_stream)
Load a string from the input stream.
DynList< T > maps(const C &c, Op op)
Classic map operation.
long load_number(std::ifstream &input_stream)
Load an integer number from the input stream.
Comprehensive parsing utilities for text processing and compiler construction.
#define PRINT_ERROR(str, args...)
Macro for printing detailed parse errors.
EepicNode< long > * target_node
Tag_Data(const string &str, Tag_Option option)
EepicNode< long > * target_node
Utility functions for binary tree operations.
Basic binary tree node definitions.
Lazy and scalable dynamic array implementation.
Dynamic doubly linked list implementation.
Comprehensive sorting algorithms and search utilities for Aleph-w.
Tree picture generation utilities.
void intersection_ellipse_line(long double lx0, long double ly0, long double lx1, long double ly1, long double a, long double b, long double &dx, long double &dy)
const char *const font_wrapper
void put_string(std::ofstream &output, const long double &x, const long double &y, const std::string &comment, const std::string &str)
long double string_width(const std::string &str)
void draw_arc(std::ofstream &output, long double src_x, long double src_y, long double tgt_x, long double tgt_y, bool is_dashed, bool with_arrow, bool thick=true)
long double font_height()
long double YPIC(long double y)
long double center_string(const std::string &str, long double window_size)