343# define X(p) ((p)->get_key().x)
344# define Y(p) ((p)->get_key().y)
345# define PRE(p) ((p)->get_key().pre)
346# define MOD(p) ((p)->get_key().mod)
347# define SUMMOD(p) ((p)->get_key().sum_mod)
348# define STRING(p) ((p)->get_key().str)
349# define ISELLIPSE(p) ((p)->get_key().ellipse)
350# define ISRECTANGLE(p) ((p)->get_key().rectangle)
351# define XOFFSET(p) ((p)->get_key().xoffset)
352# define YOFFSET(p) ((p)->get_key().yoffset)
353# define XR(p) ((p)->get_key().xr)
354# define YR(p) ((p)->get_key().yr)
355# define XD(p) ((p)->get_key().xd)
356# define YD(p) ((p)->get_key().yd)
357# define POS(p) ((p)->get_key().position)
358# define MAXCHILDYR(p) ((p)->get_key().max_child_yr)
359# define YRGAP(p) ((p)->get_key().yr_gap)
360# define LEVEL(p) ((p)->get_key().level)
361# define CHILDNUMBER(p) ((p)->get_key().child_number)
362# define WIDTH(p) ((p)->get_key().xd)
363# define HEIGHT(p) ((p)->get_key().yd)
364# define SHADOW(p) ((p)->get_key().shadow)
365# define WITHOUTNODE(p) ((p)->get_key().without_node)
366# define WITHARC(p) ((p)->get_key().with_arc)
367# define DASHEDARC(p) ((p)->get_key().dashed_arc)
368# define ARCS(p) ((p)->get_key().arc_list)
369# define CONNEXIONS(p) ((p)->get_key().connexion_list)
370# define TAGS(p) ((p)->get_key().tag_list)
375 int deway_array[],
size_t deway_array_size)
382 char *start_addr = &deway_string[0];
394 if (c ==
'.' or isspace(c))
398 if (deway_index >= deway_array_size)
403 deway_array[deway_index++] = atoi(deway_string);
404 start_addr = &deway_string[0];
412 input_stream.unget();
416 if (deway_index >= deway_array_size)
420 deway_array[deway_index] = -1;
427 char * start_addr = buffer;
439 catch (
const std::out_of_range &)
454 while (c !=
'\n' and c != EOF);
463 while (isgraph(c)
and c !=
'%' and c != EOF);
469 input_stream.unget();
471 if (strcasecmp(buffer,
"ROOT") == 0)
474 if (strcasecmp(buffer,
"NODE") == 0)
477 if (strcasecmp(buffer,
"TAG") == 0)
480 if (strcasecmp(buffer,
"SHADOW") == 0)
483 if (strcasecmp(buffer,
"WITHOUT-NODE") == 0)
486 if (strcasecmp(buffer,
"WITHOUT-ARC") == 0)
489 if (strcasecmp(buffer,
"ARC") == 0)
492 if (strcasecmp(buffer,
"DASHED-ARC") == 0)
495 if (strcasecmp(buffer,
"HRADIO") == 0)
498 if (strcasecmp(buffer,
"VRADIO") == 0)
501 if (strcasecmp(buffer,
"XOFFSET") == 0)
504 if (strcasecmp(buffer,
"YOFFSET") == 0)
507 if (strcasecmp(buffer,
"N") == 0)
510 if (strcasecmp(buffer,
"S") == 0)
513 if (strcasecmp(buffer,
"E") == 0)
516 if (strcasecmp(buffer,
"L") == 0)
519 if (strcasecmp(buffer,
"R") == 0)
522 if (strcasecmp(buffer,
"W") == 0)
525 if (strcasecmp(buffer,
"NE") == 0)
528 if (strcasecmp(buffer,
"NW") == 0)
531 if (strcasecmp(buffer,
"SE") == 0)
534 if (strcasecmp(buffer,
"SW") == 0)
537 if (strcasecmp(buffer,
"ARC") == 0)
540 if (strcasecmp(buffer,
"DASHED-CONNEXION") == 0)
543 if (strcasecmp(buffer,
"ELLIPSE") == 0)
546 if (strcasecmp(buffer,
"RECTANGLE") == 0)
575 if (parent_node ==
nullptr)
606 last_root->insert_tree_to_right(new_tree);
616 parent_node->insert_rightmost_child(new_node);
675 if (tgt->get_parent() != src)
732 TAGS(p).append(tag_data);
744 if (tgt->get_parent() == src)
755 ARCS(src).append(arc_data);
772 ARCS(src).append(arc_data);
895 catch (exception & e)
922 p = p->get_left_sibling())
924 if (
LEVEL(p) == level)
960 p = p->get_right_sibling())
962 if (
LEVEL(p) == level)
1007 assert(p->get_left_sibling() !=
nullptr);
1008 assert(not p->is_leftmost());
1011 for (
EepicNode *left_sibling = p->get_left_sibling();
1012 left_sibling !=
nullptr;
1013 left_sibling = left_sibling->get_left_sibling())
1015 assert(p->get_parent() == left_sibling->get_parent());
1030 int level =
LEVEL(p) + 1;
1031 long double r_sum_mod;
1032 long double l_sum_mod;
1056 while (
l !=
nullptr and r !=
nullptr)
1059 const long double rx =
PRE(
r) + r_sum_mod;
1060 const long double lx =
PRE(
l) + l_sum_mod;
1062 const long double current_separation = lx - rx;
1064 if (
const long double min_separation =
tree_gap +
XR(
r) +
XR(
l); current_separation < min_separation)
1066 const long double compensation = min_separation - current_separation;
1067 PRE(p) += compensation;
1068 MOD(p) += compensation;
1096 if (p->is_leaf()
and p->is_leftmost())
1098 else if (p->is_leaf()
and p->is_root())
1105 EepicNode *left_sibling = p->get_left_sibling();
1115 EepicNode *left_child = p->get_left_child();
1116 EepicNode *right_child = p->get_right_child();
1118 if (p->is_leftmost() or p->is_root())
1120 PRE(p) = (
PRE(left_child) +
PRE(right_child)) / 2.0;
1127 MOD(p) =
PRE(p) - (
PRE(left_child) +
PRE(right_child)) / 2.0;
1136 if (not p->is_root())
1142 if (not p->is_leftmost()
and not p->is_root())
1167 long double parent_sum_mod;
1177 parent_sum_mod =
SUMMOD(pp);
1184 X(p) =
PRE(p) + parent_sum_mod;
1235 const long double increment =
1258 if (
root ==
nullptr)
1269 if (
root ==
nullptr)
1281 if (
root ==
nullptr)
1296 output <<
"start-prefix ";
1314 <<
"% This LaTeX picture is a tree automatically" << endl
1315 <<
"% generated by ntreepic program" << endl
1317 <<
"% Copyright (C) 2002, 2003, 2004, 2007" << endl
1318 <<
"% UNIVERSITY of LOS ANDES (ULA)" << endl
1319 <<
"% Merida - REPUBLICA BOLIVARIANA DE VENEZUELA" << endl
1320 <<
"% Center of Studies in Microelectronics & Distributed Systems"
1321 <<
" (CEMISID)" << endl
1322 <<
"% ULA Computer Science Department" << endl
1324 <<
"% Created by Leandro Leon - lrleon@ula.ve" << endl
1326 <<
"% This program uses the Sugiyama variation of Walker" << endl
1327 <<
"% algorithm for general trees drawing" << endl
1329 <<
"% You must use epic and eepic latex packages" << endl
1330 <<
"% in your LaTeX application" << endl
1332 <<
"% epic Copyright by Sunil Podar" << endl
1333 <<
"% eepic Copyright by Conrad Kwok" << endl
1334 <<
"% LaTeX is a collection of TeX macros created by Leslie Lamport"
1336 <<
"% TeX was created by Donald Knuth" << endl
1338 <<
"% command line: " << endl
1344 <<
"% Creation date: " << ctime(&t) << endl
1348 output <<
"\\documentclass[11pt]{article}" << endl
1350 <<
"\\usepackage{epic}" << endl
1351 <<
"\\usepackage{eepic}" << endl
1353 <<
"\\begin{document}" << endl
1354 <<
"\\begin{center}" << endl;
1357 <<
"\\setlength{\\unitlength}{" <<
resolution <<
"mm}" << endl
1358 <<
"\\filltype{" <<
fill_type <<
"}" << endl
1360 <<
"\\begin{picture}(" <<
h_size <<
"," <<
v_size <<
")"
1369 <<
"\\end{picture}" << endl;
1373 <<
"\\end{center}" << endl
1374 <<
"\\end{document}" << endl;
1417 const bool left =
false,
1418 const bool is_dashed =
true)
1420 const long double & px =
X(p);
1421 const long double & py =
Y(p);
1423 const long double & qx =
X(q);
1424 const long double & qy =
Y(q);
1426 long double srcx, srcy,
1453 if (fabsl(srcx - tgtx) <
hr)
1455 my = (srcy + tgty) / 2.0;
1461 mx = srcx -
xgap / 2.5;
1467 mx = srcx +
xgap / 2.5;
1470 else if (fabsl(srcy - tgty) <
vr)
1472 mx = (srcx + tgtx) / 2.0;
1475 my = srcy + (left ? -
ygap :
ygap) / 2.0;
1482 const long double xfourth = (tgtx - srcx) / 4.0;
1486 const long double yfourth = (srcy - tgty) / 4.0;
1490 mx = srcx + xfourth;
1491 my = tgty + 3.0 * yfourth;
1495 mx = srcx + 3.0 * xfourth;
1496 my = tgty + yfourth;
1499 assert(my <= srcy and my >= tgty);
1503 const long double yfourth = (tgty - srcy) / 4.0;
1507 mx = srcx + 3.0 * xfourth;
1508 my = srcy + 3.0 * yfourth;
1512 mx = srcx + xfourth;
1513 my = srcy + yfourth;
1516 assert(my >= srcy
and my <= tgty);
1519 assert(mx >= srcx
and mx <= tgtx);
1522 output <<
"\\linethickness{0.05mm}" << endl;
1525 output <<
"\\curvedashes[1mm]{1,1}" << endl;
1527 output <<
"\\curve(" << srcx <<
"," <<
YPIC(srcy) <<
","
1528 << mx <<
"," <<
YPIC(my) <<
","
1529 << tgtx <<
"," <<
YPIC(tgty) <<
")";
1540 <<
" inside a forest ";
1544 long double x =
X(p);
1545 long double y =
Y(p);
1550 <<
"% Node at level " << level <<
". It's the "
1551 << child_index <<
" child with key = " <<
STRING(p);
1558 output <<
"% Ellipse" << endl
1559 <<
"\\put(" << x <<
"," <<
YPIC(
y) <<
")"
1560 << (
SHADOW(p) ?
"{\\ellipse*{" :
"{\\ellipse{") <<
WIDTH(p)
1561 <<
"}{" <<
HEIGHT(p) <<
"}}";
1563 output <<
"% Rectangle" << endl
1564 <<
"\\path(" << x -
XR(p) <<
"," <<
YPIC(
y -
YR(p)) <<
")"
1565 <<
"(" << x +
XR(p) <<
"," <<
YPIC(
y -
YR(p)) <<
")"
1566 <<
"(" << x +
XR(p) <<
"," <<
YPIC(
y +
YR(p)) <<
")"
1567 <<
"(" << x -
XR(p) <<
"," <<
YPIC(
y +
YR(p)) <<
")"
1568 <<
"(" << x -
XR(p) <<
"," <<
YPIC(
y -
YR(p)) <<
")";
1576 if (not
TAGS(p).is_empty())
1588 tag_data = itor.get_curr();
1593 comment =
"North tag: ";
1598 comment =
"South tag: ";
1603 comment =
"East tag: ";
1608 comment =
"West tag: ";
1613 comment =
"Northeast tag: ";
1618 comment =
"Northwest tag: ";
1623 comment =
"Southeast tag: ";
1628 comment =
"Southwest tag: ";
1643 Arc_Data arc_data = itor.get_curr();
1647 long double src_dx, src_dy;
1654 long double tgt_dx, tgt_dy;
1668 <<
"% Additional arc to child with key " <<
1689 output <<
"\\curve(" << x - dx <<
"," <<
YPIC(
y + dy) <<
","
1690 << px + dx <<
"," <<
YPIC(
y +
h) <<
","
1691 << px + dx <<
"," <<
YPIC(py + dy) <<
")";
1699 for (
EepicNode *c = p->get_left_child(); c !=
nullptr;
1700 c = c->get_right_sibling())
1704 long double lx =
X(c);
1705 long double ly =
Y(c);
1706 long double src_dx, src_dy;
1713 long double tgt_dx, tgt_dy;
1727 <<
" with key " <<
STRING(c) << endl;
1741 long double lx =
X(c);
1742 long double ly =
Y(c);
1743 long double src_dx, src_dy;
1750 long double tgt_dx, tgt_dy;
1764 <<
" with key " <<
STRING(c) << endl;
1773 if (
EepicNode *rs = p->get_right_sibling(); rs !=
nullptr)
1775 long double rx =
X(rs);
1776 long double ry =
Y(rs);
1777 long double src_dx, src_dy;
1784 long double tgt_dx, tgt_dy;
1797 <<
"% link to right sibling " << child_index + 1
1798 <<
" with key " <<
STRING(rs) << endl;
1823 "ntreepic 1.7 - ALEPH drawer for general rooted trees\n"
1824 "Copyright (C) 2004, 2007 UNIVERSITY of LOS ANDES (ULA)\n"
1825 "Merida - REPUBLICA BOLIVARIANA DE VENEZUELA\n"
1826 "Center of Studies in Microelectronics & Distributed Systems (CEMISID)\n"
1827 "ULA Computer Science Department\n"
1828 "This is free software; There is NO warranty; not even for MERCHANTABILITY\n"
1829 "or FITNESS FOR A PARTICULAR PURPOSE\n"
1836static char doc[] =
"ntreepic -- Aleph drawer for general rooted trees";
1839static char arg_doc[] =
"-f input-file [-o output-file]\n";
1843 "ALEPH drawer for general rooted trees\n"
1844 "Copyright (C) 2004, 2007 University of Los Andes (ULA)\n"
1845 "Merida - REPUBLICA BOLIVARIANA DE VENEZUELA\n"
1846 "Center of Studies in Microelectronics & Distributed Systems (CEMISID)\n"
1847 "ULA Computer Science Department\n"
1848 "This is free software; There is NO warranty; not even for MERCHANTABILITY\n"
1849 "or FITNESS FOR A PARTICULAR PURPOSE\n"
1854 "ALEPH drawer for general rooted trees. License & Copyright Note\n"
1855 "Copyright (C) 2004, 2007\n"
1856 "UNIVERSITY of LOS ANDES (ULA)\n"
1857 "Merida - REPUBLICA BOLIVARIANA DE VENEZUELA\n"
1858 "Center of Studies in Microelectronics & Distributed Systems (CEMISID)\n"
1859 "ULA Computer Science Department\n"
1860 "This is free software; There is NO warranty; not even for MERCHANTABILITY\n"
1861 "or FITNESS FOR A PARTICULAR PURPOSE\n"
1863 " PERMISSION TO USE, COPY, MODIFY AND DISTRIBUTE THIS SOFTWARE AND ITS \n"
1864 " DOCUMENTATION IS HEREBY GRANTED, PROVIDED THAT BOTH THE COPYRIGHT \n"
1865 " NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES OF THE \n"
1866 " SOFTWARE, DERIVATIVE WORKS OR MODIFIED VERSIONS, AND ANY PORTIONS \n"
1867 " THEREOF, AND THAT BOTH NOTICES APPEAR IN SUPPORTING DOCUMENTATION. \n"
1869 " This program is distributed in the hope that it will be useful,\n"
1870 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
1871 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n"
1873 " ULA requests users of this software to return to \n"
1874 " Proyecto Aleph - CEMISID Software\n"
1875 " Nucleo Universitario La Hechicera. Ed Ingenieria\n"
1876 " 3er piso, ala Este \n"
1877 " Universidad de Los Andes \n"
1878 " Merida 5101 - REPUBLICA BOLIVARIANA DE VENEZUELA \n"
1880 " or to lrleon@ula.ve \n"
1882 " any improvements or extensions that they make and grant Universidad \n"
1883 " de Los Andes (ULA) the full rights to redistribute these changes. \n"
1885 " This program was granted by: \n"
1886 " - Consejo de Desarrollo Cientifico, Humanistico, Tecnico de la ULA\n"
1891 {
"radius",
'r',
"radius", OPTION_ARG_OPTIONAL,
"fit radius for circles", 0},
1892 {
"x-gap",
'w',
"sibling gap", OPTION_ARG_OPTIONAL,
"sibling separation", 0},
1893 {
"y-gap",
'h',
"children gap", OPTION_ARG_OPTIONAL,
"child separation", 0},
1894 {
"t-gap",
't',
"tree gap", OPTION_ARG_OPTIONAL,
"subtree separation", 0},
1896 "bin-tree",
'b',
"binary tree", OPTION_ARG_OPTIONAL,
1897 "generate binary tree", 0
1900 "h-radius",
'x',
"horizontal-radius", OPTION_ARG_OPTIONAL,
1901 "horizontal radius", 0
1904 "v-radius",
'y',
"vertical-radius", OPTION_ARG_OPTIONAL,
1905 "vertical radius", 0
1907 {
"resol",
'l',
"resolution", OPTION_ARG_OPTIONAL,
"resolution in mm", 0},
1908 {
"latex",
'a', 0, OPTION_ARG_OPTIONAL,
"add latex header", 0},
1909 {
"no-node",
'n', 0, OPTION_ARG_OPTIONAL,
"no draw nodes; only arcs", 0},
1911 "key-x-offset",
'X',
"offset", OPTION_ARG_OPTIONAL,
1912 "horizontal offset for keys", 0
1915 "key-y-offset",
'Y',
"offset", OPTION_ARG_OPTIONAL,
1916 "vertical offset for keys", 0
1918 {
"input-file",
'i',
"input-file", 0,
"input file", 0},
1919 {
"input-file",
'f',
"input-file", OPTION_ALIAS, 0, 0},
1920 {
"output",
'o',
"output-file", 0,
"output file", 0},
1921 {
"license",
'C', 0, OPTION_ARG_OPTIONAL,
"print license", 0},
1923 "x-picture-offset",
'O',
"horizontal-picture-offset",
1924 OPTION_ARG_OPTIONAL,
"horizontal global picture offset", 0
1927 "y-picture-offset",
'P',
"vertical-picture-offset",
1928 OPTION_ARG_OPTIONAL,
"vertical global picture offset", 0
1930 {
"print",
'R', 0, OPTION_ARG_OPTIONAL,
"print current parameters", 0},
1931 {
"verbose",
'v', 0, OPTION_ARG_OPTIONAL,
"verbose mode", 0},
1933 "version",
'V', 0, OPTION_ARG_OPTIONAL,
1934 "Print version information and then exit", 0
1936 {
"black-fill",
'B', 0, OPTION_ARG_OPTIONAL,
"Fill black ellipses", 0},
1937 {
"shade-fill",
'S', 0, OPTION_ARG_OPTIONAL,
"Fill shade ellipses", 0},
1938 {
"ellipses",
'e', 0, OPTION_ARG_OPTIONAL,
"draw ellipses as nodes", 0},
1939 {
"rectangles",
'q', 0, OPTION_ARG_OPTIONAL,
"draw rectangles as nodes", 0},
1941 "draw-list",
'L', 0, OPTION_ARG_OPTIONAL,
1942 "draw linked list representation", 0
1945 "draw-tree",
'T', 0, OPTION_ARG_OPTIONAL,
1946 "draw normal tree representation (or turn off linked list form)", 0
1949 "arrow-len",
'K',
"arrow lenght in points", OPTION_ARG_OPTIONAL,
1953 "arrow-width",
'I',
"arrow width in points", OPTION_ARG_OPTIONAL,
1956 {
"arrows",
'A', 0, OPTION_ARG_OPTIONAL,
"draw arcs with arrows", 0},
1957 {
"vertical-flip",
'F', 0, OPTION_ARG_OPTIONAL,
"Flip tree respect y axe", 0},
1962# define TERMINATE(n) (save_parameters(), exit(n))
1994 <<
"Global horizontal node radius -x = " <<
hr << endl
1995 <<
"Global vertical node radius -y = " <<
vr << endl
1996 <<
"Global horizontal node diameter = " <<
hd << endl
1997 <<
"Global Vertical node diameter = " <<
vd << endl
1998 <<
"Horizontal sibling separation -w = " <<
xgap << endl
1999 <<
"Vertical children separation -h = " <<
ygap << endl
2000 <<
"Subtree separation -t = " <<
tree_gap << endl
2001 <<
"Resolution in mm -l = " <<
resolution << endl
2002 <<
"Horizontal global offset for key -X = " <<
x_offset << endl
2003 <<
"Vertical global offset for key -Y = " <<
y_offset << endl
2009static error_t
parser_opt(
int key,
char *arg,
struct argp_state *)
2015 AH_ERROR(
"Waiting for radius in command line");
2016 hr =
vr = atof(arg);
2021 AH_ERROR(
"Waiting for sibling gap in command line");
2026 AH_ERROR(
"Waiting for sibling gap in command line");
2031 AH_ERROR(
"Waiting for tree gap in command line");
2036 AH_ERROR(
"Waiting for horizontal radius in command line");
2042 AH_ERROR(
"Waiting for vertical radius in command line");
2048 AH_ERROR(
"Waiting for resolution in command line");
2051 cout <<
"Warning: resolution too big" << endl;
2063 AH_ERROR(
"Waiting for horizontal offset in command line");
2068 AH_ERROR(
"Waiting for vertical offset in command line");
2073 AH_ERROR(
"Waiting for horizontal offset in command line");
2078 AH_ERROR(
"Waiting for vertical offset in command line");
2087 AH_ERROR(
"Waiting for input file name");
2093 AH_ERROR(
"Waiting for output file name");
2139 AH_ERROR(
"Waiting for arrow lenght in command line");
2145 AH_ERROR(
"Waiting for arrow width in command line");
2151 default:
return ARGP_ERR_UNKNOWN;
2164 "ntreepic -- General rooted tree visualizer (LaTeX/eepic output)\n"
2166 "Reads a textual general rooted tree description (.Tree file) and emits\n"
2167 "LaTeX code using eepic drawing primitives, suitable for inclusion in\n"
2168 "publication-quality documents. Supports n-ary trees, forests, and\n"
2169 "linked-list representations.\n"
2172 " ntreepic -f <input.Tree> [-o <output.eepic>] [options]\n"
2173 " ntreepic -i <input.Tree> [-o <output.eepic>] [options]\n"
2176 " -f, -i <file> Input .Tree file\n"
2179 " -o <file> Output file (default: input name + .eepic)\n"
2180 " -r <double> Node circle radius (sets horizontal and vertical)\n"
2181 " -x <double> Horizontal radius of node ellipse\n"
2182 " -y <double> Vertical radius of node ellipse\n"
2183 " -w <double> Horizontal gap between siblings\n"
2184 " -h <double> Vertical gap between levels\n"
2185 " -t <double> Gap between subtrees\n"
2186 " -l <double> Resolution in mm\n"
2187 " -a Wrap output in a full LaTeX header\n"
2188 " -e Draw nodes as ellipses (default)\n"
2189 " -q Draw nodes as rectangles\n"
2190 " -n Minimum-radius mode (no node bodies, arcs only)\n"
2191 " -b Emit textual start-prefix/start-key representation of binary tree (via generate_bin_tree())\n"
2192 " -L Draw linked-list representation (with arrows)\n"
2193 " -T Draw forest layout (no linked-list representation)\n"
2194 " -A Draw arcs with arrows\n"
2195 " -B Fill nodes with black\n"
2196 " -S Fill nodes with shade\n"
2197 " -F Flip tree along the y axis\n"
2198 " -X <double> Horizontal label offset\n"
2199 " -Y <double> Vertical label offset\n"
2200 " -O <double> Horizontal global picture offset\n"
2201 " -P <double> Vertical global picture offset\n"
2202 " -R Print current parameters and exit\n"
2203 " -V Print version and exit\n"
2204 " -C Print license and exit\n"
2207 " ntreepic -f mytree.Tree -o mytree.eepic -a -e\n"
2209 "Run 'ntreepic --help' for the complete list of options.\n";
2217 argp_parse(&
arg_defs, argc, argv, ARGP_IN_ORDER, 0,
nullptr);
2224 if (not input_stream)
2235 if (pos != string::npos)
Exception handling system with formatted messages for Aleph-w.
#define ah_overflow_error_if(C)
Throws std::overflow_error if condition holds.
#define ah_invalid_argument_if(C)
Throws std::invalid_argument if condition holds.
#define AH_ERROR(...)
Print an error message (always enabled).
bool has_curr() const noexcept
Return true if the iterator has current item.
Dynamic doubly linked list with O(1) size and bidirectional access.
Forward declaration used by CRTP helpers before the full node definition.
bool tiny_keys
Global flag to enable tiny font size for keys/labels.
__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)
void destroy_tree(Node *root)
Destroys (frees memory) the tree whose root is root.
void tree_postorder_traversal(Node *root, void(*visitFct)(Node *, int, int))
Postorder traversal of a tree.
void tree_preorder_traversal(Node *root, void(*visitFct)(Node *, int, int))
Preorder traversal of a tree.
Node * deway_search(Node *root, int path[], const size_t &size)
Returns a node of a forest given its Dewey number.
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.
and
Check uniqueness with explicit hash + equality functors.
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.
void print_parse_warning(const std::string &str)
Print a parse warning message.
long load_number(std::ifstream &input_stream)
Load an integer number from the input stream.
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
void parse_rectangle(ifstream &input_stream, EepicNode *root)
EepicNode * __advance_to_leftmost_in_level(EepicNode *root, const int level, long double &sum)
EepicNode * parse_deway_number(ifstream &input_stream, EepicNode *root)
void compute_coordinates_for_forest_and_set_picture_size(EepicNode *root)
bool draw_list_representation
const char * parameters_file_name
Token_Type get_token(ifstream &input_stream)
void generate_tree(ofstream &output, EepicNode *p, int level, int child_index)
void adjust_minimal_separation_with_letf_sibling(EepicNode *p)
void shift_tree_to_right(EepicNode *p, int, int)
void parse_xoffset(ifstream &input_stream, EepicNode *root)
void generate_forest(ofstream &output, EepicNode *root)
void precompute_x_for_node(EepicNode *p, const int level, const int child)
void parse_connexion(ifstream &input_stream, EepicNode *root)
static error_t parser_opt(int key, char *arg, struct argp_state *)
void precompute_x_coordinates_for_tree(EepicNode *root)
void generate_curve(ofstream &output, EepicNode *p, EepicNode *q, const bool left=false, const bool is_dashed=true)
EepicNode * parse_first_root_definition(ifstream &input_stream)
void parse_arc(ifstream &input_stream, EepicNode *root)
void parse_without_arc(ifstream &input_stream, EepicNode *root)
void generate_epilogue(ofstream &output)
void parse_shadow(ifstream &input_stream, EepicNode *root)
void generate_prefix_traversal(ofstream &output, EepicNode *root)
std::string input_file_name
void generate_infix_traversal(ofstream &output, EepicNode *root)
long double x_picture_offset
const char * argp_program_version
void parse_vradio(ifstream &input_stream, EepicNode *root)
Tree_Node< Tree_Data > EepicNode
EepicNode * read_input_and_build_tree(ifstream &input_stream)
void parse_ellipse(ifstream &input_stream, EepicNode *root)
bool generate_binary_tree
EepicNode * parse_key_node_and_allocate(ifstream &input_stream)
EepicNode * allocate_node(const string &str)
void parse_yoffset(ifstream &input_stream, EepicNode *root)
static const char license_text[]
std::string output_file_name
EepicNode * __advance_to_rightmost_in_level(EepicNode *root, const int level, long double &sum)
void parse_hradio(ifstream &input_stream, EepicNode *root)
EepicNode * advance_to_leftmost_in_level(EepicNode *root, const int level, long double &sum)
void parse_node_definition(ifstream &input_stream, EepicNode *root)
void parse_without_node(ifstream &input_stream, EepicNode *root)
const char * argp_program_bug_address
void compute_coordinates_for_tree(EepicNode *root)
void load_deway_number(ifstream &input_stream, int deway_array[], size_t deway_array_size)
static struct argp_option options[]
void parse_tag(ifstream &input_stream, EepicNode *root)
void generate_bin_tree(ofstream &output, EepicNode *root)
static const char * hello
void parse_dashed_arc(ifstream &input_stream, EepicNode *root)
void compute_definitive_coordinates_for_node(EepicNode *p, int, int)
long double y_picture_offset
void infix_tree(EepicNode *root)
void generate_prologue(ofstream &output)
EepicNode * advance_to_rightmost_in_level(EepicNode *root, const int level, long double &sum)
static struct argp arg_defs
void parse_root_definition(ifstream &input_stream, EepicNode *root)
Comprehensive parsing utilities for text processing and compiler construction.
Tag_Data(string str, const Tag_Option option)
DynDlist< Connexion_Data > connexion_list
DynDlist< Arc_Data > arc_list
DynDlist< Tag_Data > tag_list
Lazy and scalable dynamic array implementation.
Dynamic doubly linked list implementation.
General tree (n-ary tree) node.
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)
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)
void intersection_rectangle_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)
long double font_height()
long double YPIC(long double y)
long double center_string(const std::string &str, long double window_size)