gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] CVSROOT: /cvsroot/navidoc


From: Asko Soukka
Subject: [Gzz-commits] CVSROOT: /cvsroot/navidoc
Date: Mon, 28 Jul 2003 10:46:18 -0400

Module name:    navidoc
Branch:         rel-0-1
Changes by:     Asko Soukka <address@hidden>    03/07/28 10:46:17
Reply-to: address@hidden

CVSROOT:        /cvsroot/navidoc
Module name:    navidoc
Branch:         rel-0-1
Changes by:     Asko Soukka <address@hidden>    03/07/28 10:46:17

Modified files:
        doc            : syntax.rst 
        navidoc/mp     : __init__.py uml.py 

Log message:
        fixes

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/doc/syntax.rst.diff?only_with_tag=rel-0-1&tr1=1.12&tr2=1.12.2.1&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/mp/__init__.py.diff?only_with_tag=rel-0-1&tr1=1.42.2.1&tr2=1.42.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/mp/uml.py.diff?only_with_tag=rel-0-1&tr1=1.21.2.1&tr2=1.21.2.2&r1=text&r2=text

Patches:
Index: navidoc/doc/syntax.rst
diff -u /dev/null navidoc/doc/syntax.rst:1.12.2.1
--- /dev/null   Mon Jul 28 10:46:18 2003
+++ navidoc/doc/syntax.rst      Mon Jul 28 10:46:17 2003
@@ -0,0 +1,581 @@
+==========
+UML syntax
+==========
+
+Defining UML diagram begins like any directive definition in reStructuredText::
+
+  .. UML:: foobar
+
+After the definition follows an indented content. The content should
+contain definition part and usually also layout part.
+
+Definition
+==========
+
+There are several possibilities for definition of UML elements. The
+first variant is the most clearest, but the others allow explict
+definition of variables for elements. After the first definition the
+element is referred using its name, after the later definitions the
+element is referred using its variable.
+
+.. UML:: syntax-defining-1
+
+   class foo
+
+Syntax::
+
+   class foo
+
+.. UML:: syntax-defining-2
+
+   foo = class foo123
+
+Syntax::
+
+   foo = class foo123
+
+.. UML:: syntax-defining-3
+
+   class (foo) foo123
+
+Syntax::
+
+   class (foo) foo123
+
+Because of MetaPost elements' variable names cannot contain any
+numbers. Therefore, when e.g. a class name contains numbers one of the
+two later variants must be used to define legal variable for element.
+
+Layout
+======
+
+Layout part is distinguished from definition part using a line with
+three or more ``-``. The layout part is actually just MetaPost, but
+some helpful macros and attributes are provided to help placing
+elements. Also pure MetaPost is allowed.
+
+horizontally
+------------
+
+.. UML:: elements-layout-horizontally
+
+   class foo
+   class bar
+   ---
+   horizontally(50, horiz, foo, bar);
+
+Syntax::
+
+   class foo
+   class bar
+   ---
+   horizontally(50, horiz, foo, bar);
+
+The first parameter ("50") the for space between objects.
+The second parameter("horiz") is variable name for the layout's
+coordinate system.
+
+vertically
+----------
+
+.. UML:: elements-layout-vertically
+
+   class foo
+   class bar
+   ---
+   vertically(50, vert, foo, bar);
+
+Syntax::
+
+   class foo
+   class bar
+   ---
+   vertically(50, vert, foo, bar);
+
+Mixed use
+---------
+
+.. UML:: elements-layout-mixed
+
+   class foo
+   class bar
+   class foobar
+   ---
+   horizontally(50, horiz, foo, bar);
+   vertically(50, vert, horiz, foobar);
+
+Syntax::
+
+   class foo
+   class bar
+   class foobar
+   ---
+   horizontally(50, horiz, foo, bar);
+   vertically(50, vert, horiz, foobar);
+
+Elements
+========
+
+class
+-----
+
+.. UML:: elements-class
+
+   class foo
+
+   class bar "abstract"
+       fields
+               field1
+               field2
+               fieldn
+       methods
+               method1
+               method2
+               methodn
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+Syntax::
+
+   class foo
+
+   class bar "abstract"
+       fields
+               field1
+               field2
+               fieldn
+       methods
+               method1
+               method2
+               methodn
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+Note: a class' name may contain a stereotype like "abstract" within
+quotation marks.
+
+component
+---------
+
+.. UML:: elements-component
+
+   component foo
+
+Syntax::
+
+   component foo
+
+
+interface
+---------
+
+.. UML:: elements-interface
+
+   component foo
+       assoc foobarA
+       assoc foobarB
+   foobarA = interface bar1
+   foobarB = interface bar2
+   ---
+   horizontally(50, horiz, foobarA, foobarB);
+   vertically(25, vert, horiz, foo);
+
+Syntax::
+
+   component foo
+       assoc foobarA
+       assoc foobarB
+   foobarA = interface bar1
+   foobarB = interface bar2
+   ---
+   horizontally(50, horiz, foobarA, foobarB);
+   vertically(20, vert, horiz, foo);
+
+package
+-------
+
+.. UML:: elements-package
+
+   package foobar
+
+Syntax::
+
+   package foobar
+
+
+bigpackage
+----------
+
+.. UML:: elements-bigpackage
+
+   bigpackage foobar
+       class foo
+       class bar
+   ---
+   horizontally(50, horiz, foo, bar);
+
+Syntax::
+
+   bigpackage foobar
+       class foo
+       class bar
+   ---
+   horizontally(50, horiz, foo, bar);
+
+.. UML:: elements-bigpackage-explicit
+
+   bigpackage foobar
+   class foo
+   class bar
+   ---
+   foo.sw = (50,25);
+   horizontally(50, horiz, foo, bar);  
+   foobar.sw = (0, 0);
+   foobar.ne = (200,75);
+
+Syntax::
+
+   bigpackage foobar
+   class foo
+   class bar
+   ---
+   foo.sw = (50,25);
+   horizontally(50, horiz, foo, bar);  
+   foobar.sw = (0, 0);
+   foobar.ne = (200,75);
+
+Connections
+===========
+
+inherit
+-------
+
+.. UML:: elements-inherit
+
+   class foo
+       inherit bar
+   class bar
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+Syntax::
+
+   class foo
+       inherit bar
+   class bar
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+realize
+-------
+
+.. UML:: elements-realize
+
+   class foo
+       realize bar
+   class bar "abstract"
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+Syntax::
+
+   class foo
+       abstract bar
+   class bar "abstract"
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+dep
+---
+
+.. UML:: elements-dep
+
+   class foo
+       dep "create" bar
+   class bar
+   ---
+   horizontally(100, hor_c, foo, bar);
+
+Syntax::
+
+   class foo
+       dep "create" bar 
+   class bar
+   ---
+   horizontally(100, hor_c, foo, bar);
+
+Note: stereotype within quotation marks is obligatory.
+
+use
+---
+
+.. UML:: elements-use
+
+   class foo
+       use bar
+   class bar
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+Syntax::
+
+   class foo
+       use bar
+   class bar
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+assoc
+-----
+
+.. UML:: elements-assoc
+
+   class (fooA) foo1 
+       assoc barA
+   class (fooB) foo2
+       assoc multi(1) - multi(0..1) barB
+   class (fooC) foo3
+       assoc aggreg multi(0..1) - multi(*) role(part-of) barC
+   class (fooD) foo4
+       assoc compos multi(0..1) - multi(*) role(part-of) barD
+   class (barA) bar1
+   class (barB) bar2
+   class (barC) bar3
+   class (barD) bar4
+   ---
+   horizontally(150, hor_cA, fooA, barA);
+   horizontally(150, hor_cB, fooB, barB);
+   horizontally(150, hor_cC, fooC, barC);
+   horizontally(150, hor_cD, fooD, barD);
+   vertically(50, ver_c, fooA, fooB, fooC, fooD);
+
+Syntax::
+
+   class (fooA) foo1 
+       assoc barA
+   class (fooB) foo2
+       assoc multi(1) - multi(0..1) barB
+   class (fooC) foo3
+       assoc aggreg multi(0..1) - multi(*) role(part-of) barC
+   class (fooD) foo4
+       assoc compos multi(0..1) - multi(*) role(part-of) barD
+   class (barA) bar1
+   class (barB) bar2
+   class (barC) bar3
+   class (barD) bar4
+   ---
+   horizontally(150, hor_cA, fooA, barA);
+   horizontally(150, hor_cB, fooB, barB);
+   horizontally(150, hor_cC, fooC, barC);
+   horizontally(150, hor_cD, fooD, barD);
+   vertically(50, ver_c, fooA, fooB, fooC, fooD);
+
+naryassoc
+---------
+
+.. UML:: elements-nary
+
+   naryassoc nary
+   class (fooA) foo1 
+       assoc multi(1) - nary
+   class (barA) bar1
+       assoc multi(*) - nary
+   class (barB) bar2
+       assoc multi(*) - nary
+   ---
+   horizontally(150, hor_c, fooA, nary, barA);
+   vertically(50, ver_c, barA, barB);
+
+Syntax::
+
+   naryassoc nary
+   class (fooA) foo1 
+       assoc multi(1) - nary
+   class (barA) bar1
+       assoc multi(*) - nary
+   class (barB) bar2
+       assoc multi(*) - nary
+   ---
+   horizontally(150, hor_c, fooA, nary, barA);
+   vertically(50, ver_c, barA, barB);
+
+qual
+----
+
+.. UML:: elements-qual
+
+   class foo
+   qual q
+       fields
+               foobar
+       assoc multi(*) - multi(0..1) bar        
+   class bar
+   ---
+   horizontally(150, hor_c, foo, bar);
+   q.w = foo.e;
+
+Syntax::
+
+   class foo 
+   qual q
+       fields
+               foobar
+       assoc multi(*) - multi(0..1) bar        
+   class bar
+   ---
+   horizontally(150, hor_c, foo, bar);
+   q.w = foo.e;
+
+Note: unfortunately, qualifier must be attached manually (see the line ``q.w = 
foo.e;``).
+
+supply
+------
+
+.. UML:: elements-supply
+
+   class foo
+       supply bar
+   class bar
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+Syntax::
+
+   class foo
+       supply bar
+   class bar
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+seqobject
+---------
+
+.. UML:: elements-seqobject
+
+   seqobject foo
+   seqobject bar
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+Syntax::
+
+   seqobject foo
+   seqobject bar
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+sequence
+--------
+
+.. UML:: elements-sequence
+
+   seqobject foo
+   seqobject bar
+
+   sequence foobar
+       call foo
+               call bar "foobar"
+                       return
+               return
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+Syntax::
+
+   seqobject foo
+   seqobject bar
+
+   sequence foobar
+       call foo
+               call bar "foobar"
+                       return
+               return
+   ---
+   horizontally(50, hor_c, foo, bar);
+
+
+Linking
+=======
+
+regular
+-------
+
+.. UML:: syntax-linking
+
+   page (syntax) "Navidoc UML syntax"
+       link
+               syntax.gen.html
+
+Syntax::
+
+   page (syntax) "Navidoc UML syntax"
+       link
+               syntax.gen.html
+
+from module
+-----------
+
+Syntax::
+
+   page bar
+       link foobar
+               bar.html
+
+
+Note: available modules must be specified in config.
+
+from javadoc
+------------
+
+Syntax a)
+
+::
+
+   class org.foobar.foo
+       jlink
+
+Syntax b)
+
+::
+
+   class foo
+       jlink
+               org.foobar.foo
+
+Syntax c)
+
+::
+
+   jlinkpackage org.foobar
+   class foo
+       jlink
+
+Note: available javadocs must be specified in config.
+
+from doc++
+----------
+
+Syntax a)
+
+::
+
+   class foobar::foo
+       clink
+
+Syntax b)
+
+::
+
+   class foo
+       clink
+               foobar
+
+Syntax c)
+
+::
+
+   jlinkpackage foobar
+   class foo
+       clink
+
+Note: available doc++ documentations must be specified in config.
Index: navidoc/navidoc/mp/__init__.py
diff -u navidoc/navidoc/mp/__init__.py:1.42.2.1 
navidoc/navidoc/mp/__init__.py:1.42.2.2
--- navidoc/navidoc/mp/__init__.py:1.42.2.1     Mon Jun 30 11:30:15 2003
+++ navidoc/navidoc/mp/__init__.py      Mon Jul 28 10:46:17 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: __init__.py,v 1.42.2.1 2003/06/30 15:30:15 humppake Exp $
+# $Id: __init__.py,v 1.42.2.2 2003/07/28 14:46:17 humppake Exp $
 
 #
 # Written by Tuomas Lukka, Asko Soukka
@@ -360,7 +360,7 @@
         if self.target == '' and diagram and context:
             self.target = "javascript:setImg('"+diagram+"_img', 
'"+slashify(relative_path(config.working_directory, 
config.mp_directory))+diagram+context+config.midfix+".png', 
'#"+diagram+id_postfix+"_map')"
 
-        if not self.target.startswith('javascript'): diagram = '#'+diagram
+        if not self.target.startswith('javascript') and self.target.find('#') 
== -1: diagram = '#'+diagram
         else: diagram = ''
 
         return """<area href="%s%s" shape="rect" coords="%s" target="%s" 
title="%s" alt="%s" />""" \
Index: navidoc/navidoc/mp/uml.py
diff -u navidoc/navidoc/mp/uml.py:1.21.2.1 navidoc/navidoc/mp/uml.py:1.21.2.2
--- navidoc/navidoc/mp/uml.py:1.21.2.1  Mon Jun 30 11:30:15 2003
+++ navidoc/navidoc/mp/uml.py   Mon Jul 28 10:46:17 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: uml.py,v 1.21.2.1 2003/06/30 15:30:15 humppake Exp $
+# $Id: uml.py,v 1.21.2.2 2003/07/28 14:46:17 humppake Exp $
 
 #
 # Written by Tuomas Lukka, Asko Soukka
@@ -365,50 +365,60 @@
         self.elements = []
        self.var = var or toks[0]
        self.name = toks[0]
-       self.do_contents(list)
+
+        self.link = None
+
+        for element in list:
+            try: # try to make contained element work on it's own
+                element = config.element_list.parse_element(element)
+                if len(config.element_list.extras) > 0 and \
+                       isinstance(config.element_list.extras[0], 
navidoc.link.Link):
+                    
config.element_list.list.append(config.element_list.extras.pop(0))
+                config.element_list.list.append(element)
+                if hasattr(element, 'var') and element.var:
+                    self.elements.append(element.var)
+            except IndexError, e: # didn't work, add it as contained (usually 
links)
+                config.element_list.add_contained_element(self, element)
 
         if self.link != None:
-            self.link.bbox = ('bboxmeasuredpic(%s)' % (self.var))
-    def handle_contained(self, element):
-        element = config.element_list.parse_element(element)
-        config.element_list.list.append(element)
-        if hasattr(element, 'var') and element.var:
-            self.elements.append(element.var)
+            self.link.bbox = ('bboxmeasuredpic(%s.titl)' % (self.var))
+
     def setup_code(self):
-        titlebox = """
-           addto %%.titl.pict doublepath 
(urcorner(%%.titl.pict)--lrcorner(%%.titl.pict)) withpen currentpen;
-           addto %%.titl.pict doublepath 
(ulcorner(%%.titl.pict)--llcorner(%%.titl.pict)) withpen currentpen;
-           addto %%.titl.pict doublepath 
(ulcorner(%%.titl.pict)--urcorner(%%.titl.pict)) withpen currentpen;
-            """
-       s = """
-           picture %%.titl.pict;
-           %%.titl.pict = classTitle("%name%");
-            setbounds %%.titl.pict to bbox %%.titl.pict;
-            """
-        if not self.elements: s = s + titlebox
-        s = s + """
-           unknownpicmeasurements(%%);
-           picmeasurements(%%.titl);
-           %%.titl.sw = %%.nw;
-           """
-        if self.elements: s = s + titlebox
-       return self.repl(s)
+        s = """
+        picture %%.titl.pict;
+        %%.titl.pict = classTitle("%name%");
+        setbounds %%.titl.pict to bbox %%.titl.pict;
+
+        addto %%.titl.pict doublepath 
(urcorner(%%.titl.pict)--lrcorner(%%.titl.pict)) withpen currentpen;
+       addto %%.titl.pict doublepath 
(ulcorner(%%.titl.pict)--llcorner(%%.titl.pict)) withpen currentpen;
+       addto %%.titl.pict doublepath 
(ulcorner(%%.titl.pict)--urcorner(%%.titl.pict)) withpen currentpen;
+
+        unknownpicmeasurements(%%);
+        picmeasurements(%%.titl);
+       %%.titl.sw = %%.nw;
+       """
+        return self.repl(s)
     def draw_code(self):
-        s = ''
         if self.elements:
             elements_sw_x = 'xpart ' + '.sw, xpart '.join(self.elements) + 
'.sw'
             elements_sw_y = 'ypart ' + '.sw, ypart '.join(self.elements) + 
'.sw'
             elements_ne_x = 'xpart ' + '.ne, xpart '.join(self.elements) + 
'.ne'
             elements_ne_y = 'ypart ' + '.ne, ypart '.join(self.elements) + 
'.ne'
-            
-            s = """
-            %%.sw = (min("""+elements_sw_x+"""), min("""+elements_sw_y+""")) - 
(10,10);
-            %%.ne = (max("""+elements_ne_x+"""), max("""+elements_ne_y+""")) + 
(10,10);
-            """
-        s = s + """
-            draw bboxmeasuredpic(%%);
-            drawmeasuredpic(%%.titl);
+        
+        s = ''
+        if self.elements:
+            s += """
+        %%.sw = (min("""+elements_sw_x+"""), min("""+elements_sw_y+""")) - 
(10,10);
+        %%.ne = (max("""+elements_ne_x+"""), max("""+elements_ne_y+""")) + 
(10,10);
+
             """
+        s += """
+        picmeasurements(%%.titl);
+        %%.titl.sw = %%.nw;
+
+        draw bboxmeasuredpic(%%);
+        drawmeasuredpic(%%.titl);
+        """
        return self.repl(s)
 
 class mpqual(navidoc.mp.MetapostElement):




reply via email to

[Prev in Thread] Current Thread [Next in Thread]