1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
4 # Copyright 2006-2008 Floréal Morandat <morandat@lirmm.fr>
6 # This file is free software, which comes along with NIT. This software is
7 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
10 # is kept unaltered, and a notification of the changes is added.
11 # You are allowed to redistribute it and sell it, alone or is a part of
14 # Exposes methods for debugging ropes when needed.
18 intrude import core
::text
::ropes
21 # Writes self as a dot file on the hard drive
22 private fun internal_to_dot
: String is abstract
25 return "digraph g \{\n" + internal_to_dot + "\}\n"
30 redef fun internal_to_dot
: String
32 var s
= "n{object_id} [label = {length}];\n"
33 s
+= "n{object_id} -> n{left.object_id} [label = \"left\
"];\n"
34 s
+= left
.internal_to_dot
35 s
+= "n{object_id} -> n{right.object_id} [label = \"right\
"];\n"
36 s
+= right
.internal_to_dot
41 redef class RopeBuffer
42 redef fun internal_to_dot
: String
44 var s
= "n{object_id} [label = {length}];\n"
45 s
+= "n{object_id} -> n{str.object_id} [label = \"str\
"];\n"
46 s
+= str
.internal_to_dot
47 s
+= "n{object_id} -> n{ns.object_id} [label = \"ns\
"];\n"
48 s
+= "n{ns.object_id}[label = \"Items\
", content=\"{ns}\
"];\n"
53 redef class FlatString
54 redef fun internal_to_dot
: String
56 return "n{object_id} [label=\"FlatString\\nlength
= {length}\\nbyte_length
= {byte_length}\\nfirst_byte
= {first_byte}\\nlast_byte
= {last_byte}\\nText
= {self.escape_to_dot}\
"];\n"
60 redef class FlatBuffer
61 redef fun internal_to_dot
: String
63 return "n{object_id} [label=\"FlatBuffer\\nbyte_length
= {byte_length}\\nlength
= {length}\\ncapacity
= {capacity}\\nText
= {escape_to_dot}\
"];\n"