dotter

graphiz helpers
git clone git://deadbeef.fr/dotter.git
Log | Files | Refs | README | LICENSE

commit 6b448676a2b4ef1da4aa8cbb8a42ad7fcafe4b3c
parent dff9c6cf8ae0ae4107d1c4461d5f4c0c364fc4a7
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date:   Fri, 27 Nov 2020 16:42:43 +0100

new tool: watcher

Diffstat:
MREADME | 152+++++--------------------------------------------------------------------------
Auml.README | 147+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Awatcher | 16++++++++++++++++
3 files changed, 171 insertions(+), 144 deletions(-)

diff --git a/README b/README @@ -2,6 +2,8 @@ This project aims at providing a set of scripts to generate graphviz code for various uses. +Also includes a program which watch an input file and spawns +a viewer from the content named `watcher`. List of uses: @@ -17,151 +19,13 @@ Error checking. * awk (tested with mawk 1.3.3 under Debian Buster) * dot +* xdotool (for watcher) -== UML-like class diagram == +== Usage == -=== Usage exemple === +Most scripts will be described in their own REAME since +their usage can be quite "complex". -* uml-like: ./uml FILE | dot -Tpdf /tmp/FILE.pdf && mupdf /tmp/FILE.pdf +=== watcher === -=== syntax === - -Lines start with the directive's name. -One directive per line. -Arguments and directives are separated by spaces and tabs. -Unknown directives are ignored. -Excess arguments are ignored. - -List of directives: - -* private -* public -* protected -* package -* class -* fun -* virtual -* abstract -* var -* inherit -* associate -* aggreg -* compose -* depends -* friend -* package -* endpackage - -==== private ==== - -New elements will have the "private" visibility. -No immediate effect. -No argument. - -==== public ==== -New elements will have the "public" visibility. -No immediate effect. -No argument. - -==== protected ==== -New elements will have the "protected" visibility. -No immediate effect. -No argument. - -==== package ==== -New elements will have the "package" visibility. -No immediate effect. -No argument. - -==== class ==== -Starts a new class. -Arg 1: class name. - -==== fun ==== -Adds a method to the current class. -If previous change was not a method (optionaly virtual or -abstract), draw a separation line before starting. - -Arg 1: return type -Arg 2: function name -Arg 3 to N: (N - 2)th function parameter, type, attributes, - name, etc are separated by ":" instead of " ". - -==== virtual ==== -Adds a virtual method to the current class. -Otherwise identical to "fun". - -==== abstract ==== -Adds an abstract method to the current class. -Otherwise identical to "fun". - -==== var ==== -Adds a property to the current class. -If previous change was not a property, draw a separation -line before starting. - -Arg 1: property type -Arg 2: property name -Arg 3: optional initialisation value. - -==== inherit ==== -Defines an inheritance relation. -Closes the current class. - -Arg 1: sub-class -Arg 2: ancestor - -==== associate ==== -Defines an association relation. -Closes the current class. - -Arg 1: "owner" class -Arg 2: target class -Arg 3: relation name - -==== aggreg ==== -Defines an aggregation relation. -Closes the current class. - -Arg 1: "owner" class -Arg 2: target class -Arg 3: relation name - -==== compose ==== -Defines an composition relation. -Closes the current class. - -Arg 1: "owner" class -Arg 2: target class -Arg 3: relation name - -==== depends ==== -Defines a dependency relation. -Closes the current class. - -Arg 1: "owner" class -Arg 2: target class - -==== friend ==== -Defines a friendship relationt -Closes the current class. - -Arg 1: "owner" class -Arg 2: target class - -==== package ==== -Closes the current class. -Starts a new package. - -Arg 1: package name - -==== endpackage ==== -Closes the current class. -Closes the current package. - -==== splines ==== -Closes the current class. -Changes the edge style according to arg 1. - -Arg 1: new edge style. Some possible values: true, false, - polyline, ortho, line. See dot(1) for all accepted values. +./watcher SOURCE_FILE VIEWER SCRIPT diff --git a/uml.README b/uml.README @@ -0,0 +1,147 @@ +== UML-like class diagram == + +=== Usage exemple === + +* uml-like: ./uml FILE | dot -Tpdf /tmp/FILE.pdf && mupdf /tmp/FILE.pdf + +=== syntax === + +Lines start with the directive's name. +One directive per line. +Arguments and directives are separated by spaces and tabs. +Unknown directives are ignored. +Excess arguments are ignored. + +List of directives: + +* private +* public +* protected +* package +* class +* fun +* virtual +* abstract +* var +* inherit +* associate +* aggreg +* compose +* depends +* friend +* package +* endpackage + +==== private ==== + +New elements will have the "private" visibility. +No immediate effect. +No argument. + +==== public ==== +New elements will have the "public" visibility. +No immediate effect. +No argument. + +==== protected ==== +New elements will have the "protected" visibility. +No immediate effect. +No argument. + +==== package ==== +New elements will have the "package" visibility. +No immediate effect. +No argument. + +==== class ==== +Starts a new class. +Arg 1: class name. + +==== fun ==== +Adds a method to the current class. +If previous change was not a method (optionaly virtual or +abstract), draw a separation line before starting. + +Arg 1: return type +Arg 2: function name +Arg 3 to N: (N - 2)th function parameter, type, attributes, + name, etc are separated by ":" instead of " ". + +==== virtual ==== +Adds a virtual method to the current class. +Otherwise identical to "fun". + +==== abstract ==== +Adds an abstract method to the current class. +Otherwise identical to "fun". + +==== var ==== +Adds a property to the current class. +If previous change was not a property, draw a separation +line before starting. + +Arg 1: property type +Arg 2: property name +Arg 3: optional initialisation value. + +==== inherit ==== +Defines an inheritance relation. +Closes the current class. + +Arg 1: sub-class +Arg 2: ancestor + +==== associate ==== +Defines an association relation. +Closes the current class. + +Arg 1: "owner" class +Arg 2: target class +Arg 3: relation name + +==== aggreg ==== +Defines an aggregation relation. +Closes the current class. + +Arg 1: "owner" class +Arg 2: target class +Arg 3: relation name + +==== compose ==== +Defines an composition relation. +Closes the current class. + +Arg 1: "owner" class +Arg 2: target class +Arg 3: relation name + +==== depends ==== +Defines a dependency relation. +Closes the current class. + +Arg 1: "owner" class +Arg 2: target class + +==== friend ==== +Defines a friendship relationt +Closes the current class. + +Arg 1: "owner" class +Arg 2: target class + +==== package ==== +Closes the current class. +Starts a new package. + +Arg 1: package name + +==== endpackage ==== +Closes the current class. +Closes the current package. + +==== splines ==== +Closes the current class. +Changes the edge style according to arg 1. + +Arg 1: new edge style. Some possible values: true, false, + polyline, ortho, line. See dot(1) for all accepted values. diff --git a/watcher b/watcher @@ -0,0 +1,16 @@ +#!/bin/sh + +SOURCE="${1:?"SOURCE required as 1st arg"}" +VIEWER="${2:?"VIEWER required as 2nd arg"}" +SCRIPT="${3:?"SCRIPT required as 3rd arg"}" +TPID="" + +while true +do + FOCUS=$(xdotool getwindowfocus -f) + ./$SCRIPT "${SOURCE}" | dot -Tpdf | $VIEWER & + TPID=$! + xdotool sleep 0.1 windowfocus --sync $FOCUS + inotifywait "${SOURCE}" + kill $TPID +done