From 2c6a9b2265572b10004a82d4048d96cf05786267 Mon Sep 17 00:00:00 2001 From: yanjustino Date: Fri, 7 May 2021 15:48:14 -0300 Subject: [PATCH] 1) Fixing * Changing class scope visibility to sealed * Optimising embedded C4 resource 2) New Features * Adding SHOW_LEGEND() control * Adding LAYOUT_AS_SKETCH() control * Adding FLOW_VISUALIZATION: TOP_DOWN or LEFT_RIGHT 3) API changes * Removing obsolete SoftwareSystemType class and their dependencies --- .../Diagrams/ComponentDiagramBuilder.cs | 3 + .../Diagrams/ContainerDiagramBuilder.cs | 1 + src/C4Sharp/C4Sharp.csproj | 11 +- src/C4Sharp/Models/Component.cs | 2 +- src/C4Sharp/Models/Container.cs | 2 +- src/C4Sharp/Models/ContainerBoundary.cs | 2 +- src/C4Sharp/Models/DeploymentNode.cs | 2 +- src/C4Sharp/Models/Diagrams/Diagram.cs | 6 + src/C4Sharp/Models/Diagrams/DiagramLayout.cs | 8 + src/C4Sharp/Models/Person.cs | 2 +- .../Models/Plantuml/PlantumlDiagram.cs | 21 +- .../Models/Plantuml/PlantumlException.cs | 2 - .../Models/Plantuml/PlantumlStructure.cs | 3 +- src/C4Sharp/Models/SoftwareSystem.cs | 31 +- src/C4Sharp/Models/SoftwareSystemBoundary.cs | 2 +- src/C4Sharp/Models/SoftwareSystemType.cs | 14 - src/C4Sharp/bin/C4.puml | 448 +++++++++++++----- src/C4Sharp/bin/C4_Component.puml | 41 +- src/C4Sharp/bin/C4_Container.puml | 43 +- src/C4Sharp/bin/C4_Context.puml | 60 +-- src/C4Sharp/bin/C4_Deployment.puml | 90 ++-- src/C4Sharp/bin/C4_Dynamic.puml | 183 +++---- 22 files changed, 526 insertions(+), 451 deletions(-) create mode 100644 src/C4Sharp/Models/Diagrams/DiagramLayout.cs delete mode 100644 src/C4Sharp/Models/SoftwareSystemType.cs diff --git a/src/C4Sharp.Sample/Diagrams/ComponentDiagramBuilder.cs b/src/C4Sharp.Sample/Diagrams/ComponentDiagramBuilder.cs index 5a25cba..dc32aae 100644 --- a/src/C4Sharp.Sample/Diagrams/ComponentDiagramBuilder.cs +++ b/src/C4Sharp.Sample/Diagrams/ComponentDiagramBuilder.cs @@ -1,4 +1,5 @@ using C4Sharp.Models; +using C4Sharp.Models.Diagrams; using C4Sharp.Models.Diagrams.Core; using C4Sharp.Sample.Structures; @@ -15,6 +16,8 @@ public static ComponentDiagram Build() return new() { Title = "Internet Banking System API Application", + FlowVisualization = DiagramLayout.LeftRight, + LayoutAsSketch = true, Structures = new Structure[] { Spa, diff --git a/src/C4Sharp.Sample/Diagrams/ContainerDiagramBuilder.cs b/src/C4Sharp.Sample/Diagrams/ContainerDiagramBuilder.cs index 897fdbc..bc0c8bd 100644 --- a/src/C4Sharp.Sample/Diagrams/ContainerDiagramBuilder.cs +++ b/src/C4Sharp.Sample/Diagrams/ContainerDiagramBuilder.cs @@ -13,6 +13,7 @@ public static ContainerDiagram Build() { return new() { + ShowLegend = true, Title = "Container diagram for Internet Banking System", Structures = new Structure[] { diff --git a/src/C4Sharp/C4Sharp.csproj b/src/C4Sharp/C4Sharp.csproj index c9826a2..a2ca637 100644 --- a/src/C4Sharp/C4Sharp.csproj +++ b/src/C4Sharp/C4Sharp.csproj @@ -11,7 +11,7 @@ https://github.com/8T4/c4sharp git c4, diagrams - 1.1.5 + 2.0.0 https://github.com/8T4/c4sharp/blob/main/LICENSE true true @@ -31,12 +31,9 @@ - - - - - - + + + diff --git a/src/C4Sharp/Models/Component.cs b/src/C4Sharp/Models/Component.cs index 1908463..192c759 100644 --- a/src/C4Sharp/Models/Component.cs +++ b/src/C4Sharp/Models/Component.cs @@ -12,7 +12,7 @@ namespace C4Sharp.Models /// space. In the C4 model, components are not separately deployable units. /// /// - public class Component : Structure + public sealed class Component : Structure { public string Technology { get; } diff --git a/src/C4Sharp/Models/Container.cs b/src/C4Sharp/Models/Container.cs index d4b6056..4cc8280 100644 --- a/src/C4Sharp/Models/Container.cs +++ b/src/C4Sharp/Models/Container.cs @@ -15,7 +15,7 @@ namespace C4Sharp.Models /// /// /// - public class Container : Structure + public sealed class Container : Structure { private readonly Dictionary _instances = new Dictionary(); diff --git a/src/C4Sharp/Models/ContainerBoundary.cs b/src/C4Sharp/Models/ContainerBoundary.cs index 6f5cbc5..eddaedc 100644 --- a/src/C4Sharp/Models/ContainerBoundary.cs +++ b/src/C4Sharp/Models/ContainerBoundary.cs @@ -6,7 +6,7 @@ namespace C4Sharp.Models /// /// Container Boundary /// - public class ContainerBoundary: Structure + public sealed class ContainerBoundary: Structure { public IEnumerable Components { get; set; } public IEnumerable Relationships { get; set; } diff --git a/src/C4Sharp/Models/DeploymentNode.cs b/src/C4Sharp/Models/DeploymentNode.cs index fdf1bc9..f8f400b 100644 --- a/src/C4Sharp/Models/DeploymentNode.cs +++ b/src/C4Sharp/Models/DeploymentNode.cs @@ -9,7 +9,7 @@ namespace C4Sharp.Models /// server, Microsoft IIS), etc. Deployment nodes can be nested. /// /// - public class DeploymentNode : Structure + public sealed class DeploymentNode : Structure { public IEnumerable Nodes { get; set; } public Dictionary Properties { get; set; } diff --git a/src/C4Sharp/Models/Diagrams/Diagram.cs b/src/C4Sharp/Models/Diagrams/Diagram.cs index f26239e..b3ca9cc 100644 --- a/src/C4Sharp/Models/Diagrams/Diagram.cs +++ b/src/C4Sharp/Models/Diagrams/Diagram.cs @@ -11,7 +11,10 @@ public abstract class Diagram { internal string Name { get; } public bool LayoutWithLegend { get; set; } + public bool ShowLegend { get; set; } + public bool LayoutAsSketch { get; set; } public string Title { get; set; } + public DiagramLayout FlowVisualization { get; set; } public Structure[] Structures { get; set; } public Relationship[] Relationships { get; set; } @@ -22,6 +25,9 @@ public abstract class Diagram protected Diagram(string name) { LayoutWithLegend = true; + LayoutAsSketch = false; + ShowLegend = false; + FlowVisualization = DiagramLayout.TopDown; Name = name; } diff --git a/src/C4Sharp/Models/Diagrams/DiagramLayout.cs b/src/C4Sharp/Models/Diagrams/DiagramLayout.cs new file mode 100644 index 0000000..e32afd1 --- /dev/null +++ b/src/C4Sharp/Models/Diagrams/DiagramLayout.cs @@ -0,0 +1,8 @@ +namespace C4Sharp.Models.Diagrams +{ + public enum DiagramLayout + { + TopDown, + LeftRight + } +} \ No newline at end of file diff --git a/src/C4Sharp/Models/Person.cs b/src/C4Sharp/Models/Person.cs index 3929fad..043e531 100644 --- a/src/C4Sharp/Models/Person.cs +++ b/src/C4Sharp/Models/Person.cs @@ -6,7 +6,7 @@ namespace C4Sharp.Models /// A person represents one of the human users of your software system (e.g. actors, roles, personas, etc) /// /// - public class Person : Structure + public sealed class Person : Structure { /// /// Constructor diff --git a/src/C4Sharp/Models/Plantuml/PlantumlDiagram.cs b/src/C4Sharp/Models/Plantuml/PlantumlDiagram.cs index 1bb6e7f..3429713 100644 --- a/src/C4Sharp/Models/Plantuml/PlantumlDiagram.cs +++ b/src/C4Sharp/Models/Plantuml/PlantumlDiagram.cs @@ -23,7 +23,18 @@ public static string ToPumlString(this Diagram diagram) stream.AppendLine($"@startuml {diagram.Slug()}"); stream.AppendLine($"!include {path}"); stream.AppendLine(); - stream.AppendLine($"{(diagram.LayoutWithLegend ? "LAYOUT_WITH_LEGEND()" : "")}"); + + if (diagram.LayoutWithLegend && !diagram.ShowLegend) + { + stream.AppendLine("LAYOUT_WITH_LEGEND()"); + } + + if (diagram.LayoutAsSketch) + { + stream.AppendLine("LAYOUT_AS_SKETCH()"); + } + + stream.AppendLine($"{(diagram.FlowVisualization == DiagramLayout.TopDown ? "LAYOUT_TOP_DOWN()" : "LAYOUT_LEFT_RIGHT()")}"); stream.AppendLine(); foreach (var structure in diagram.Structures) @@ -38,7 +49,13 @@ public static string ToPumlString(this Diagram diagram) stream.AppendLine(relationship.ToPumlString()); } - stream.AppendLine($"@enduml"); + if (diagram.ShowLegend) + { + stream.AppendLine(); + stream.AppendLine("SHOW_LEGEND()"); + } + + stream.AppendLine("@enduml"); return stream.ToString(); } } diff --git a/src/C4Sharp/Models/Plantuml/PlantumlException.cs b/src/C4Sharp/Models/Plantuml/PlantumlException.cs index 6b59e61..cea6bc5 100644 --- a/src/C4Sharp/Models/Plantuml/PlantumlException.cs +++ b/src/C4Sharp/Models/Plantuml/PlantumlException.cs @@ -9,12 +9,10 @@ public class PlantumlException: Exception { public PlantumlException(string message):base(message) { - } public PlantumlException(string message, Exception innerException):base(message, innerException) { - } } } \ No newline at end of file diff --git a/src/C4Sharp/Models/Plantuml/PlantumlStructure.cs b/src/C4Sharp/Models/Plantuml/PlantumlStructure.cs index f6a7161..fb4431e 100644 --- a/src/C4Sharp/Models/Plantuml/PlantumlStructure.cs +++ b/src/C4Sharp/Models/Plantuml/PlantumlStructure.cs @@ -36,8 +36,7 @@ private static string ToPumlString(this Person person) private static string ToPumlString(this SoftwareSystem system) { - var isExternal = system.SoftwareSystemType == SoftwareSystemType.External || - system.Boundary == Boundary.External; + var isExternal = system.Boundary == Boundary.External; return isExternal ? $"System_Ext({system.Alias}, \"{system.Label}\", \"{system.Description}\")" diff --git a/src/C4Sharp/Models/SoftwareSystem.cs b/src/C4Sharp/Models/SoftwareSystem.cs index 3c736ba..ac387cb 100644 --- a/src/C4Sharp/Models/SoftwareSystem.cs +++ b/src/C4Sharp/Models/SoftwareSystem.cs @@ -10,22 +10,18 @@ namespace C4Sharp.Models /// a single software development team. /// /// - public class SoftwareSystem : Structure + public sealed class SoftwareSystem : Structure { - [Obsolete("Uses Boundary enumeration instead")] - public SoftwareSystemType SoftwareSystemType { get; } - /// /// Constructor /// /// Should be unique /// - public SoftwareSystem(string alias, string label) - : base(alias, label) + public SoftwareSystem(string alias, string label) + : base(alias, label, string.Empty, Boundary.Internal) { - SoftwareSystemType = SoftwareSystemType.Internal; - } - + } + /// /// Constructor /// @@ -33,25 +29,10 @@ public SoftwareSystem(string alias, string label) /// /// public SoftwareSystem(string alias, string label, string description) - : base(alias, label, description) + : base(alias, label, description, Boundary.Internal) { - SoftwareSystemType = SoftwareSystemType.Internal; } - /// - /// Constructor - /// - /// Should be unique - /// - /// - /// - [Obsolete("Uses Boundary enumeration instead")] - public SoftwareSystem(string alias, string label, string description, SoftwareSystemType softwareSystemType) - : base(alias, label, description) - { - SoftwareSystemType = softwareSystemType; - } - /// /// Constructor /// diff --git a/src/C4Sharp/Models/SoftwareSystemBoundary.cs b/src/C4Sharp/Models/SoftwareSystemBoundary.cs index 9de7756..6aa2d5e 100644 --- a/src/C4Sharp/Models/SoftwareSystemBoundary.cs +++ b/src/C4Sharp/Models/SoftwareSystemBoundary.cs @@ -5,7 +5,7 @@ namespace C4Sharp.Models /// /// Software System Boundary /// - public class SoftwareSystemBoundary: Structure + public sealed class SoftwareSystemBoundary: Structure { public IEnumerable Containers { get; set; } diff --git a/src/C4Sharp/Models/SoftwareSystemType.cs b/src/C4Sharp/Models/SoftwareSystemType.cs deleted file mode 100644 index 0863bf9..0000000 --- a/src/C4Sharp/Models/SoftwareSystemType.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace C4Sharp.Models -{ - /// - /// SoftwareSystem Type - /// - [Obsolete("Uses Boundary enumeration insted SoftwareSystemType")] - public enum SoftwareSystemType - { - Internal, - External - } -} \ No newline at end of file diff --git a/src/C4Sharp/bin/C4.puml b/src/C4Sharp/bin/C4.puml index 6744d75..51d9c34 100644 --- a/src/C4Sharp/bin/C4.puml +++ b/src/C4Sharp/bin/C4.puml @@ -8,11 +8,19 @@ !global $ARROW_COLOR = "#666666" !global $BOUNDARY_COLOR = "#444444" +!global $BOUNDARY_BG_COLOR = "#FFFFFF" !global $LEGEND_FONT_COLOR = "#FFFFFF" !global $LEGEND_TITLE_COLOR = "#000000" -!global $LEGEND_UNDEFINED_BK_COLOR = "#87AECA" -!global $LEGEND_UNDEFINED_FONT_COLOR = "#B7DEFA" +!global $LEGEND_UNDEFINED_BG_COLOR = "#D5CFEE" +!global $LEGEND_UNDEFINED_FONT_COLOR = "#8B77E4" + +!global $LEGEND_SHADOW_TEXT = "(shadow) " +!global $LEGEND_NO_SHADOW_TEXT = "(no shadow) " +!global $LEGEND_NO_FONT_BG_TEXT = "(no text, no back color) " +!global $LEGEND_NO_FONT_TEXT = "(no text color) " +!global $LEGEND_NO_BG_TEXT = "(no back color) " +!global $LEGEND_NO_LINE_TEXT = "(no line color) " ' Styling ' ################################## @@ -51,15 +59,19 @@ skinparam Arrow { ' Some boundary skinparam have to be set a package skinparams too (PlantUML uses internal packages) skinparam package { - StereotypeFontSize 0 + StereotypeFontSize 6 + StereotypeFontColor $BOUNDARY_BG_COLOR FontStyle plain + BackgroundColor $BOUNDARY_BG_COLOR } skinparam rectangle<> { Shadowing false - StereotypeFontSize 0 + StereotypeFontSize 6 + StereotypeFontColor $BOUNDARY_BG_COLOR FontColor $BOUNDARY_COLOR BorderColor $BOUNDARY_COLOR + BackgroundColor $BOUNDARY_BG_COLOR BorderStyle dashed } @@ -68,12 +80,33 @@ skinparam rectangle<> { !global $tagDefaultLegend = "" !global $tagCustomLegend = "" +' rel specific +!unquoted function $toStereos($tags) + !if (%strlen($tags) == 0) + !return '' + !endif + !$stereos = '' + !$brPos = %strpos($tags, "+") + !while ($brPos >= 0) + !$tag = %substr($tags, 0, $brPos) + !$stereos = $stereos + '<<' + $tag + '>>' +%set_variable_value("$" + $tag + "_LineLegend", %true()) + !$tags = %substr($tags, $brPos+1) + !$brPos = %strpos($tags, "+") + !endwhile + !if (%strlen($tags)>0) + !$stereos = $stereos + '<<' + $tags + '>>' +%set_variable_value("$" + $tags + "_LineLegend", %true()) + !endif + !return $stereos +!endfunction + !unquoted function $toStereos($elementType, $tags) !if (%strlen($tags) == 0) !$stereos = '<<' + $elementType + '>>' %set_variable_value("$" + $elementType + "Legend", %true()) !return $stereos - !endif + !endif !$stereos = '' !$brPos = %strpos($tags, "+") !while ($brPos >= 0) @@ -96,7 +129,9 @@ skinparam rectangle<> { !function $elementTagSkinparams($element, $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) !$elementSkin = "skinparam " + $element +"<<" + $tagStereo + ">> {" + %newline() !if ($fontColor!="") - !$elementSkin = $elementSkin + " StereotypeFontColor " + $fontColor + %newline() + !if ($tagStereo != "boundary") + !$elementSkin = $elementSkin + " StereotypeFontColor " + $fontColor + %newline() + !endif !$elementSkin = $elementSkin + " FontColor " + $fontColor + %newline() !endif !if ($bgColor!="") @@ -119,15 +154,41 @@ skinparam rectangle<> { !$tagSkin = $elementTagSkinparams("rectangle", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) !$tagSkin = $tagSkin + $elementTagSkinparams("database", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) !$tagSkin = $tagSkin + $elementTagSkinparams("queue", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) + !if ($tagStereo == "boundary" && $bgColor!="") + !$tagSkin = $tagSkin + "skinparam package<>StereotypeFontColor " + $bgColor + %newline() + !$tagSkin = $tagSkin + "skinparam rectangle<>StereotypeFontColor " + $bgColor + %newline() + !endif $tagSkin !endprocedure +' arrow colors cannot start with # (legend background has to start with #) +!function ColorNoHash($c) + !if (%substr($c, 0, 1) == "#") + !$c = %substr($c,1) + !endif + !return $c +!endfunction + +!unquoted procedure $defineRelSkinparams($tagStereo, $textColor, $lineColor) + !$elementSkin = "skinparam Arrow<<" + $tagStereo + ">> {" + %newline() + !$elementSkin = $elementSkin + " Color " + !if ($lineColor!="") + !$elementSkin = $elementSkin + ColorNoHash($lineColor) + !endif + !if ($textColor!="") + !$elementSkin = $elementSkin + ";text:" + ColorNoHash($textColor) + !endif + !$elementSkin = $elementSkin + %newline() + !$elementSkin = $elementSkin + "}" + %newline() +$elementSkin +!endprocedure + !function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) !$tagEntry = "|" !if ($bgColor!="") !$bg = $bgColor !else - !$bg = $LEGEND_UNDEFINED_BK_COLOR + !$bg = $LEGEND_UNDEFINED_BG_COLOR !endif ' named colors have to start with # too !if (%substr($bg, 0, 1) != "#") @@ -147,19 +208,19 @@ $tagSkin !endif !$tagEntry = $tagEntry + " " + $tagStereo + " " !if ($shadowing == "true") - !$tagEntry = $tagEntry + "(shadow) " + !$tagEntry = $tagEntry + $LEGEND_SHADOW_TEXT !endif !if ($shadowing == "false") - !$tagEntry = $tagEntry + "(no shadow) " + !$tagEntry = $tagEntry + $LEGEND_NO_SHADOW_TEXT !endif !if ($fontColor == "" && $bgColor == "") - !$tagEntry = $tagEntry + "(no font, no back color) " + !$tagEntry = $tagEntry + $LEGEND_NO_FONT_BG_TEXT !else !if ($fontColor == "") - !$tagEntry = $tagEntry + "(no font color) " + !$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT !endif !if ($bgColor == "") - !$tagEntry = $tagEntry + "(no back color) " + !$tagEntry = $tagEntry + $LEGEND_NO_BG_TEXT !endif !endif !$tagEntry = $tagEntry + " " @@ -167,10 +228,54 @@ $tagSkin !return $tagEntry !endfunction -!unquoted procedure $addTagToDynamicLegend($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="") - !$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) +!function $tagRelLegendEntry($tagStereo, $textColor, $lineColor) + !$tagEntry = "|" + ' ..white line + !if ($lineColor!="") + !$tagEntry = $tagEntry + " " + !else + !$tagEntry = $tagEntry + " " + !endif + !if ($textColor!="") + !$tagEntry = $tagEntry + "" + !else + !$tagEntry = $tagEntry + "" + !endif + !$tagEntry = $tagEntry + " " + $tagStereo + " " + !if ($textColor == "") + !$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT + !endif + !if ($lineColor == "") + !$tagEntry = $tagEntry + $LEGEND_NO_LINE_TEXT + !endif + !$tagEntry = $tagEntry + " " + !$tagEntry = $tagEntry + "|" + !return $tagEntry +!endfunction + +!unquoted procedure $addTagToLegend($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="") +'' if a combined element tag is defined (e.g. "v1.0&v1.1") then it is typically a merged color, +'' like a new $fontColor="#fdae61" therefore it should be added to the legend +'' and the & combined tags will be not removed +' !if (%strpos($tagStereo, "&")<0) + !$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) %set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry) - !$tagCustomLegend = $tagCustomLegend + $tagStereo + "\n" + !$tagCustomLegend = $tagCustomLegend + $tagStereo + "\n" +' !endif +!endprocedure + +!unquoted procedure $addRelTagToLegend($tagStereo, $textColor="", $lineColor="") +'' Arrows have a bug with stereotype/skinparams and cannot combine text colors of one stereotype +'' and the line color of another stereotype. Therefore the text color of one tag and the line color +'' of another tag have to be combined via a "workaround" tag ("v1.0&v1.1"). +'' This workaround tag could be theoretically removed in the legend but after that there would +'' be an inconsistency between the element tags and the rel tags and therefore +'' & combined workaround tags are not removed too (and in unlikely cases the color itself could be changed) +' !if (%strpos($tagStereo, "&")<0) + !$tagEntry = $tagRelLegendEntry($tagStereo, $textColor, $lineColor) +%set_variable_value("$" + $tagStereo + "_LineLegendEntry", $tagEntry) + !$tagCustomLegend = $tagCustomLegend + $tagStereo + "_Line\n" +' !endif !endprocedure !procedure $showActiveLegendEntries($allDefined) @@ -192,16 +297,36 @@ $tagSkin !endprocedure ' used by new defined tags -!unquoted procedure AddTagSupport($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="") +!unquoted procedure AddElementTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="") $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) -$addTagToDynamicLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) +$addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) !endprocedure -' used by existing elements like person, ... -!unquoted procedure UpdateSkinparamsAndLegendEntry($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="") -$defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) - !$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) -%set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry) +' used by new defined rel tags +!unquoted procedure AddRelTag($tagStereo, $textColor="", $lineColor="") +$defineRelSkinparams($tagStereo, $textColor, $lineColor) +$addRelTagToLegend($tagStereo, $textColor, $lineColor) +!endprocedure + +' update the style of existing elements like person, ... +!unquoted procedure UpdateElementStyle($elementName, $bgColor="", $fontColor="", $borderColor="", $shadowing="") +$defineSkinparams($elementName, $bgColor, $fontColor, $borderColor, $shadowing) + !$tagEntry = $tagLegendEntry($elementName, $bgColor, $fontColor, $borderColor, $shadowing) +%set_variable_value("$" + $elementName + "LegendEntry", $tagEntry) +!endprocedure + +/' @deprecated in favor of UpdateElementStyle '/ +!unquoted procedure UpdateSkinparamsAndLegendEntry($elementName, $bgColor="", $fontColor="", $borderColor="", $shadowing="") +UpdateElementStyle($elementName, $bgColor, $fontColor, $borderColor, $shadowing) +!endprocedure + +' update the style of default relation, it has to set both properties (combined statement not working) +!unquoted procedure UpdateRelStyle($textColor, $lineColor) + !$elementSkin = "skinparam Arrow {" + %newline() + !$elementSkin = $elementSkin + " Color " + $lineColor + %newline() + !$elementSkin = $elementSkin + " FontColor " + $textColor + %newline() + !$elementSkin = $elementSkin + "}" + %newline() +$elementSkin !endprocedure ' tags/stereotypes have to be delimited with \n @@ -209,6 +334,95 @@ $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) !$tagDefaultLegend = $tagStereoEntries !endprocedure +' Links +' ################################## + +!function $getLink($link) + !if ($link!="") + !return "[[" + $link + "]]" + !else + !return "" + !endif +!endfunction + +' Line breaks +' ################################## + +' PlantUML supports no DETERMINISTIC/automatic line breaks of "PlantUML line" (C4 Relashionships) +' therefore Rel...() implements an automatic line break based on spaces (like in all other objects). +' If a $type contains \n then these are used (and no automatic space based line breaks are done) +' $REL_TECHN_MAX_CHAR_WIDTH defines the automatic line break position +!global $REL_TECHN_MAX_CHAR_WIDTH = 35 +!global $REL_DESCR_MAX_CHAR_WIDTH = 32 + +!unquoted function $breakDescr($descr, $widthStr) +!$width = %intval($widthStr) +!$multiLine = "" +!if (%strpos($descr, "\n") >= 0) +!else + !while (%strlen($descr)>$width) + !$brPos = $width + !while ($brPos>0 && %substr($descr, $brPos, 1)!= ' ') + !$brPos = $brPos - 1 + !endwhile + + !if ($brPos < 1) + !$brPos = %strpos($descr, " ") + !else + !endif + + !if ($brPos > 0) + !$multiLine = $multiLine + %substr($descr, 0, $brPos) + "\n" + !$descr = %substr($descr, $brPos + 1) + !else + !$multiLine = $multiLine+ $descr + !$descr = "" + !endif + !endwhile +!endif +!if (%strlen($descr)>0) + !$multiLine = $multiLine + $descr +!endif +!return $multiLine +!endfunction + +' $breakTechn() supports //...//; $breakNode() in C4_Deployment supports no //....// +!unquoted function $breakTechn($techn, $widthStr) +!$width = %intval($widthStr) +!$multiLine = "" +!if (%strpos($techn, "\n") >= 0) + !while (%strpos($techn, "\n") >= 0) + !$brPos = %strpos($techn, "\n") + !$multiLine = $multiLine + %substr($techn, 0, $brPos) + '//\n//' + !$techn = %substr($techn, $brPos+2) + !endwhile +!else + !while (%strlen($techn)>$width) + !$brPos = $width + !while ($brPos>0 && %substr($techn, $brPos, 1)!= ' ') + !$brPos = $brPos - 1 + !endwhile + + !if ($brPos < 1) + !$brPos = %strpos($techn, " ") + !else + !endif + + !if ($brPos > 0) + !$multiLine = $multiLine + %substr($techn, 0, $brPos) + '//\n//' + !$techn = %substr($techn, $brPos + 1) + !else + !$multiLine = $multiLine+ $techn + !$techn = "" + !endif + !endwhile +!endif +!if (%strlen($techn)>0) + !$multiLine = $multiLine + $techn +!endif +!return $multiLine +!endfunction + ' Element properties ' ################################## @@ -295,7 +509,7 @@ left to right direction !endprocedure ' has to be last call in diagram -!unquoted procedure SHOW_DYNAMIC_LEGEND($hideStereotype="true") +!unquoted procedure SHOW_LEGEND($hideStereotype="true") !if ($hideStereotype=="true") hide stereotype !endif @@ -306,6 +520,11 @@ $showActiveLegendEntries($tagCustomLegend) endlegend !endprocedure +/' @deprecated in favor of SHOW_LEGEND '/ +!unquoted procedure SHOW_DYNAMIC_LEGEND($hideStereotype="true") +SHOW_LEGEND($hideStereotype) +!endprocedure + ' Boundaries ' ################################## @@ -318,13 +537,43 @@ endlegend !endif !endfunction -!unquoted procedure Boundary($alias, $label, $type="", $tags="") -rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias +!unquoted procedure Boundary($alias, $label, $type="", $tags="", $link="") +rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias $getLink($link) !endprocedure ' Relationship ' ################################## +!function $getRel($direction, $alias1, $alias2, $label, $techn, $descr, $sprite, $tags, $link) + !$rel = $alias1 + ' ' + $direction + ' ' + $alias2 + !if ($tags != "") + !$rel = $rel + ' ' + $toStereos($tags) + !endif + !$rel = $rel + ' : ' + !if ($sprite != "") + ' if it starts with & it's a OpenIconic, details see https://useiconic.com/open/ + !if (%substr($sprite, 0, 1) != "&") + !$rel = $rel + '<$'+$sprite+'> ' + !else + !$rel = $rel + '<'+$sprite+'> ' + !endif + !endif + !if ($link != "") + !$rel = $rel + '**[[' + $link + ' ' + $label + ']]**' + !else + !$rel = $rel + '**' + $label + '**' + !endif + !if ($techn != "") + ' line break is not deterministic, calculate it + !$rel = $rel + '\n//[' + $breakTechn($techn, $REL_TECHN_MAX_CHAR_WIDTH) + ']//' + !endif + !if ($descr != "") + ' line break is not deterministic, calculate it + !$rel = $rel + '\n\n' + $breakDescr($descr, $REL_DESCR_MAX_CHAR_WIDTH) + !endif + !return $rel +!endfunction + !unquoted procedure Rel_($alias1, $alias2, $label, $direction) $alias1 $direction $alias2 : **$label** !endprocedure @@ -332,143 +581,80 @@ $alias1 $direction $alias2 : **$label** $alias1 $direction $alias2 : **$label**\n//[$techn]// !endprocedure -!unquoted procedure Rel($from, $to, $label) -Rel_($from, $to, $label, "-->>") -!endprocedure -!unquoted procedure Rel($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "-->>") +!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure BiRel($from, $to, $label) -Rel_($from, $to, $label, "<<-->>") -!endprocedure -!unquoted procedure BiRel($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-->>") +!unquoted procedure BiRel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Back($from, $to, $label) -Rel_($from, $to, $label, "<<--") -!endprocedure -!unquoted procedure Rel_Back($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<--") +!unquoted procedure Rel_Back($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<--", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Neighbor($from, $to, $label) -Rel_($from, $to, $label, "->>") -!endprocedure -!unquoted procedure Rel_Neighbor($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "->>") +!unquoted procedure Rel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Back_Neighbor($from, $to, $label) -Rel_($from, $to, $label, "<<-") -!endprocedure -!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-") +!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_D($from, $to, $label) -Rel_($from, $to, $label, "-DOWN->>") -!endprocedure -!unquoted procedure Rel_D($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "-DOWN->>") +!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Down($from, $to, $label) -Rel_($from, $to, $label, "-DOWN->>") -!endprocedure -!unquoted procedure Rel_Down($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "-DOWN->>") +!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure BiRel_D($from, $to, $label) -Rel_($from, $to, $label, "<<-DOWN->>") -!endprocedure -!unquoted procedure BiRel_D($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-DOWN->>") -!endprocedure -!unquoted procedure BiRel_Down($from, $to, $label) -Rel_($from, $to, $label, "<<-DOWN->>") +!unquoted procedure BiRel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure BiRel_Down($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-DOWN->>") +!unquoted procedure BiRel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_U($from, $to, $label) -Rel_($from, $to, $label, "-UP->>") +!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_U($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "-UP->>") -!endprocedure -!unquoted procedure Rel_Up($from, $to, $label) -Rel_($from, $to, $label, "-UP->>") -!endprocedure -!unquoted procedure Rel_Up($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "-UP->>") +!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure BiRel_U($from, $to, $label) -Rel_($from, $to, $label, "<<-UP->>") -!endprocedure -!unquoted procedure BiRel_U($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-UP->>") -!endprocedure -!unquoted procedure BiRel_Up($from, $to, $label) -Rel_($from, $to, $label, "<<-UP->>") +!unquoted procedure BiRel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure BiRel_Up($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-UP->>") +!unquoted procedure BiRel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_L($from, $to, $label) -Rel_($from, $to, $label, "-LEFT->>") +!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_L($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "-LEFT->>") -!endprocedure -!unquoted procedure Rel_Left($from, $to, $label) -Rel_($from, $to, $label, "-LEFT->>") -!endprocedure -!unquoted procedure Rel_Left($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "-LEFT->>") +!unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure BiRel_L($from, $to, $label) -Rel_($from, $to, $label, "<<-LEFT->>") -!endprocedure -!unquoted procedure BiRel_L($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-LEFT->>") +!unquoted procedure BiRel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure BiRel_Left($from, $to, $label) -Rel_($from, $to, $label, "<<-LEFT->>") -!endprocedure -!unquoted procedure BiRel_Left($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-LEFT->>") +!unquoted procedure BiRel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_R($from, $to, $label) -Rel_($from, $to, $label, "-RIGHT->>") -!endprocedure -!unquoted procedure Rel_R($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "-RIGHT->>") -!endprocedure -!unquoted procedure Rel_Right($from, $to, $label) -Rel_($from, $to, $label, "-RIGHT->>") +!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Right($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "-RIGHT->>") +!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure BiRel_R($from, $to, $label) -Rel_($from, $to, $label, "<<-RIGHT->>") +!unquoted procedure BiRel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure BiRel_R($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-RIGHT->>") -!endprocedure -!unquoted procedure BiRel_Right($from, $to, $label) -Rel_($from, $to, $label, "<<-RIGHT->>") -!endprocedure -!unquoted procedure BiRel_Right($from, $to, $label, $techn) -Rel_($from, $to, $label, $techn, "<<-RIGHT->>") +!unquoted procedure BiRel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure ' Layout Helpers @@ -485,4 +671,4 @@ $from -[hidden]R- $to !endprocedure !unquoted procedure Lay_L($from, $to) $from -[hidden]L- $to -!endprocedure \ No newline at end of file +!endprocedure diff --git a/src/C4Sharp/bin/C4_Component.puml b/src/C4Sharp/bin/C4_Component.puml index e3fe294..5f660d4 100644 --- a/src/C4Sharp/bin/C4_Component.puml +++ b/src/C4Sharp/bin/C4_Component.puml @@ -1,10 +1,9 @@ ' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -' !if %variable_exists("RELATIVE_INCLUDE") -' !include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml -' !else -' !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml -' !endif - !include ./C4_Container.puml +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml +!else + !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml +!endif ' Scope: A single container. ' Primary elements: Components within the container in scope. @@ -24,8 +23,8 @@ ' Styling ' ################################## -UpdateSkinparamsAndLegendEntry("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COMPONENT_BORDER_COLOR) -UpdateSkinparamsAndLegendEntry("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $EXTERNAL_COMPONENT_BORDER_COLOR) +UpdateElementStyle("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COMPONENT_BORDER_COLOR) +UpdateElementStyle("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $EXTERNAL_COMPONENT_BORDER_COLOR) ' Layout ' ################################## @@ -65,26 +64,26 @@ endlegend !endif !endfunction -!unquoted procedure Component($alias, $label, $techn, $descr="", $sprite="", $tags="") -rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias +!unquoted procedure Component($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ComponentDb($alias, $label, $techn, $descr="", $sprite="", $tags="") -database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias +!unquoted procedure ComponentDb($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ComponentQueue($alias, $label, $techn, $descr="", $sprite="", $tags="") -queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias +!unquoted procedure ComponentQueue($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Component_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="") -rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias +!unquoted procedure Component_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ComponentDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="") -database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias +!unquoted procedure ComponentDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ComponentQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="") -queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias -!endprocedure \ No newline at end of file +!unquoted procedure ComponentQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) +!endprocedure diff --git a/src/C4Sharp/bin/C4_Container.puml b/src/C4Sharp/bin/C4_Container.puml index 7e2dfd1..3b72153 100644 --- a/src/C4Sharp/bin/C4_Container.puml +++ b/src/C4Sharp/bin/C4_Container.puml @@ -1,10 +1,9 @@ ' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -'!if %variable_exists("RELATIVE_INCLUDE") -' !include %get_variable_value("RELATIVE_INCLUDE")/C4_Context.puml -'!else -' !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml -'!endif -!include ./C4_Context.puml +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4_Context.puml +!else + !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml +!endif ' Scope: A single software system. ' Primary elements: Containers within the software system in scope. @@ -21,8 +20,8 @@ ' Styling ' ################################## -UpdateSkinparamsAndLegendEntry("container", $CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $CONTAINER_BORDER_COLOR) -UpdateSkinparamsAndLegendEntry("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR) +UpdateElementStyle("container", $CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $CONTAINER_BORDER_COLOR) +UpdateElementStyle("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR) ' Layout ' ################################## @@ -60,33 +59,33 @@ endlegend !endif !endfunction -!unquoted procedure Container($alias, $label, $techn, $descr="", $sprite="", $tags="") -rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias +!unquoted procedure Container($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ContainerDb($alias, $label, $techn, $descr="", $sprite="", $tags="") -database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias +!unquoted procedure ContainerDb($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ContainerQueue($alias, $label, $techn, $descr="", $sprite="", $tags="") -queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias +!unquoted procedure ContainerQueue($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Container_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="") -rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias +!unquoted procedure Container_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ContainerDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="") -database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias +!unquoted procedure ContainerDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ContainerQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="") -queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias +!unquoted procedure ContainerQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) !endprocedure ' Boundaries ' ################################## -!unquoted procedure Container_Boundary($alias, $label, $tags="") -Boundary($alias, $label, "Container", $tags) +!unquoted procedure Container_Boundary($alias, $label, $tags="", $link="") +Boundary($alias, $label, "Container", $tags, $link) !endprocedure diff --git a/src/C4Sharp/bin/C4_Context.puml b/src/C4Sharp/bin/C4_Context.puml index 22b6376..850f470 100644 --- a/src/C4Sharp/bin/C4_Context.puml +++ b/src/C4Sharp/bin/C4_Context.puml @@ -1,10 +1,9 @@ ' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -' !if %variable_exists("RELATIVE_INCLUDE") -' !include %get_variable_value("RELATIVE_INCLUDE")/puml -' !else -' !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/puml -' !endif -!include ./C4.puml +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4.puml +!else + !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml +!endif ' Scope: A single software system. ' Primary elements: The software system in scope. @@ -26,10 +25,10 @@ ' Styling ' ################################## -UpdateSkinparamsAndLegendEntry("person", $PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $PERSON_BORDER_COLOR) -UpdateSkinparamsAndLegendEntry("external_person", $EXTERNAL_PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_PERSON_BORDER_COLOR) -UpdateSkinparamsAndLegendEntry("system", $SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $SYSTEM_BORDER_COLOR) -UpdateSkinparamsAndLegendEntry("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_SYSTEM_BORDER_COLOR) +UpdateElementStyle("person", $PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $PERSON_BORDER_COLOR) +UpdateElementStyle("external_person", $EXTERNAL_PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_PERSON_BORDER_COLOR) +UpdateElementStyle("system", $SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $SYSTEM_BORDER_COLOR) +UpdateElementStyle("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_SYSTEM_BORDER_COLOR) ' Sprites @@ -203,44 +202,45 @@ endlegend !endif !endfunction -!unquoted procedure Person($alias, $label, $descr="", $sprite="", $tags="") -rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", $tags) as $alias +!unquoted procedure Person($alias, $label, $descr="", $sprite="", $tags="", $link="") +rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Person_Ext($alias, $label, $descr="", $sprite="", $tags="") -rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_person", $tags) as $alias +!unquoted procedure Person_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_person", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure System($alias, $label, $descr="", $sprite="", $tags="") -rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias +!unquoted procedure System($alias, $label, $descr="", $sprite="", $tags="", $link="") +rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure System_Ext($alias, $label, $descr="", $sprite="", $tags="") -rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias +!unquoted procedure System_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure SystemDb($alias, $label, $descr="", $sprite="", $tags="") -database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias +!unquoted procedure SystemDb($alias, $label, $descr="", $sprite="", $tags="", $link="") +database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure SystemQueue($alias, $label, $descr="", $sprite="", $tags="") -queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias +!unquoted procedure SystemQueue($alias, $label, $descr="", $sprite="", $tags="", $link="") +queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure SystemDb_Ext($alias, $label, $descr="", $sprite="", $tags="") -database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias +!unquoted procedure SystemDb_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure SystemQueue_Ext($alias, $label, $descr="", $sprite="", $tags="") -queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias +!unquoted procedure SystemQueue_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure ' Boundaries ' ################################## -!unquoted procedure Enterprise_Boundary($alias, $label, $tags="") -Boundary($alias, $label, "Enterprise", $tags) +!unquoted procedure Enterprise_Boundary($alias, $label, $tags="", $link="") +Boundary($alias, $label, "Enterprise", $tags, $link) !endprocedure -!unquoted procedure System_Boundary($alias, $label, $tags="") -Boundary($alias, $label, "System", $tags) + +!unquoted procedure System_Boundary($alias, $label, $tags="", $link="") +Boundary($alias, $label, "System", $tags, $link) !endprocedure diff --git a/src/C4Sharp/bin/C4_Deployment.puml b/src/C4Sharp/bin/C4_Deployment.puml index b858076..00ca6bd 100644 --- a/src/C4Sharp/bin/C4_Deployment.puml +++ b/src/C4Sharp/bin/C4_Deployment.puml @@ -1,10 +1,9 @@ ' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -' !if %variable_exists("RELATIVE_INCLUDE") -' !include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml -' !else -' !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml -' !endif -!include ./C4_Container.puml +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml +!else + !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml +!endif ' Colors ' ################################## @@ -17,8 +16,8 @@ ' ################################## ' orig was without background -'UpdateSkinparamsAndLegendEntry("node", $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR) -UpdateSkinparamsAndLegendEntry("node", $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR) +'UpdateElementStyle("node", $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR) +UpdateElementStyle("node", $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR) skinparam rectangle<> { FontStyle normal } @@ -26,23 +25,20 @@ skinparam rectangle<> { ' Layout ' ################################## -' comment if node should not be added to legend. No dynamic legend extension required +' comment if node should not be added to legend. No calculated legend extension required SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nnode") -' Special +' Line breaks ' ################################## ' PlantUML supports no automatic line breaks of "PlantUML containers" (C4 Deployment_Node is a "PlantUML container") -' therefore Deployment_Node() implements an automatic line break based on spaces (like in all other objects). -' If a $type contains \n then the these are used (and no automatic space based line breaks are done) +' therefore (Deployment_)Node() implements an automatic line break based on spaces (like in all other objects). +' If a $type contains \n then these are used (and no automatic space based line breaks are done) ' $NODE_TYPE_MAX_CHAR_WIDTH defines the automatic line break position !global $NODE_TYPE_MAX_CHAR_WIDTH = 35 !global $NODE_DESCR_MAX_CHAR_WIDTH=32 -' Elements -' ################################## - -!unquoted function $breakType($type, $widthStr) +!unquoted function $breakNode($type, $widthStr) !$width = %intval($widthStr) !$multiLine = "" !if (%strpos($type, "\n") >= 0) @@ -78,36 +74,8 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !return $multiLine !endfunction -!unquoted function $breakDescr($descr, $widthStr) -!$width = %intval($widthStr) -!$multiLine = "" -!if (%strpos($descr, "\n") >= 0) -!else - !while (%strlen($descr)>$width) - !$brPos = $width - !while ($brPos>0 && %substr($descr, $brPos, 1)!= ' ') - !$brPos = $brPos - 1 - !endwhile - - !if ($brPos < 1) - !$brPos = %strpos($descr, " ") - !else - !endif - - !if ($brPos > 0) - !$multiLine = $multiLine + %substr($descr, 0, $brPos) + "\n" - !$descr = %substr($descr, $brPos + 1) - !else - !$multiLine = $multiLine+ $descr - !$descr = "" - !endif - !endwhile -!endif -!if (%strlen($descr)>0) - !$multiLine = $multiLine + $descr -!endif -!return $multiLine -!endfunction +' Elements +' ################################## !function $getNode($label, $type, $descr, $sprite) !$nodeText = "" @@ -116,7 +84,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !endif !$nodeText = $nodeText + '==' + $label !if ($type != "") - !$nodeText = $nodeText + '\n[' + $breakType($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']' + !$nodeText = $nodeText + '\n[' + $breakNode($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']' !endif !if ($descr != "") !$nodeText = $nodeText + '\n\n' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH) @@ -131,7 +99,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !endif !$nodeText = $nodeText + '==' + $label !if ($type != "") - !$nodeText = $nodeText + '\l[' + $breakType($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']' + !$nodeText = $nodeText + '\l[' + $breakNode($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']' !endif !if ($descr != "") !$nodeText = $nodeText + '\l\l' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH) @@ -146,7 +114,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !endif !$nodeText = $nodeText + '==' + $label !if ($type != "") - !$nodeText = $nodeText + '\r[' + $breakType($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']' + !$nodeText = $nodeText + '\r[' + $breakNode($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']' !endif !if ($descr != "") !$nodeText = $nodeText + '\r\r' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH) @@ -154,26 +122,26 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !return $nodeText !endfunction -!unquoted procedure Deployment_Node($alias, $label, $type="", $descr="", $sprite="", $tags="") -rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias +!unquoted procedure Deployment_Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Deployment_Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="") -rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias +!unquoted procedure Deployment_Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Deployment_Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="") -rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias +!unquoted procedure Deployment_Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Node($alias, $label, $type="", $descr="", $sprite="", $tags="") -rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias +!unquoted procedure Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="") -rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias +!unquoted procedure Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="") -rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias +!unquoted procedure Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure diff --git a/src/C4Sharp/bin/C4_Dynamic.puml b/src/C4Sharp/bin/C4_Dynamic.puml index 68bbe92..a307e84 100644 --- a/src/C4Sharp/bin/C4_Dynamic.puml +++ b/src/C4Sharp/bin/C4_Dynamic.puml @@ -1,10 +1,9 @@ ' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally -' !if %variable_exists("RELATIVE_INCLUDE") -' !include %get_variable_value("RELATIVE_INCLUDE")/C4_Component.puml -' !else -' !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml -' !endif -!include ./C4_Component.puml +!if %variable_exists("RELATIVE_INCLUDE") + !include %get_variable_value("RELATIVE_INCLUDE")/C4_Component.puml +!else + !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml +!endif ' Scope: Interactions in an enterprise, software system or container. ' Primary and supporting elements: Depends on the diagram scope - @@ -59,161 +58,89 @@ ' Relationship ' ################################## -!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $direction="") +!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $direction) $alias1 $direction $alias2 : **$e_index: $label** !endprocedure -!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $techn, $direction="") +!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $techn, $direction) $alias1 $direction $alias2 : **$e_index: $label**\n//[$techn]// !endprocedure -!unquoted procedure Rel($from, $to, $label) -Rel_(Index(), $from, $to, $label, "-->>") +!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "-->>") -!endprocedure -!unquoted procedure RelIndex($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "-->>") -!endprocedure -!unquoted procedure RelIndex($e_index, $from, $to, $label, $tech) -Rel_($e_index, $from, $to, $label, $tech, "-->>") +!unquoted procedure RelIndex($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Back($from, $to, $label) -Rel_(Index(), $from, $to, $label, "<<--") -!endprocedure -!unquoted procedure Rel_Back($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "<<--") +!unquoted procedure Rel_Back($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<--", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_Back($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "<<--") -!endprocedure -!unquoted procedure RelIndex_Back($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "<<--") +!unquoted procedure RelIndex_Back($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<--", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Neighbor($from, $to, $label) -Rel_(Index(), $from, $to, $label, "->>") -!endprocedure -!unquoted procedure Rel_Neighbor($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "->>") -!endprocedure -!unquoted procedure RelIndex_Neighbor($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "->>") +!unquoted procedure Rel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_Neighbor($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "->>") +!unquoted procedure RelIndex_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Back_Neighbor($from, $to, $label) -Rel_(Index(), $from, $to, $label, "<<-") +!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "<<-") -!endprocedure -!unquoted procedure RelIndex_Back_Neighbor($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "<<-") -!endprocedure -!unquoted procedure RelIndex_Back_Neighbor($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "<<-") +!unquoted procedure RelIndex_Back_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<-", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_D($from, $to, $label) -Rel_(Index(), $from, $to, $label, "-DOWN->>") -!endprocedure -!unquoted procedure Rel_D($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "-DOWN->>") -!endprocedure -!unquoted procedure Rel_Down($from, $to, $label) -Rel_(Index(), $from, $to, $label, "-DOWN->>") -!endprocedure -!unquoted procedure Rel_Down($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "-DOWN->>") -!endprocedure -!unquoted procedure RelIndex_D($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "-DOWN->>") +!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_D($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "-DOWN->>") +!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_Down($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "-DOWN->>") +!unquoted procedure RelIndex_D($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_Down($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "-DOWN->>") +!unquoted procedure RelIndex_Down($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_U($from, $to, $label) -Rel_(Index(), $from, $to, $label, "-UP->>") +!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_U($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "-UP->>") +!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Up($from, $to, $label) -Rel_(Index(), $from, $to, $label, "-UP->>") +!unquoted procedure RelIndex_U($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Up($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "-UP->>") -!endprocedure -!unquoted procedure RelIndex_U($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "-UP->>") -!endprocedure -!unquoted procedure RelIndex_U($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "-UP->>") -!endprocedure -!unquoted procedure RelIndex_Up($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "-UP->>") -!endprocedure -!unquoted procedure RelIndex_Up($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "-UP->>") +!unquoted procedure RelIndex_Up($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_L($from, $to, $label) -Rel_(Index(), $from, $to, $label, "-LEFT->>") -!endprocedure -!unquoted procedure Rel_L($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "-LEFT->>") -!endprocedure -!unquoted procedure Rel_Left($from, $to, $label) -Rel_(Index(), $from, $to, $label, "-LEFT->>") +!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Left($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "-LEFT->>") +!unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_L($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "-LEFT->>") +!unquoted procedure RelIndex_L($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_L($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "-LEFT->>") -!endprocedure -!unquoted procedure RelIndex_Left($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "-LEFT->>") -!endprocedure -!unquoted procedure RelIndex_Left($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "-LEFT->>") +!unquoted procedure RelIndex_Left($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_R($from, $to, $label) -Rel_(Index(), $from, $to, $label, "-RIGHT->>") -!endprocedure -!unquoted procedure Rel_R($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "-RIGHT->>") -!endprocedure -!unquoted procedure Rel_Right($from, $to, $label) -Rel_(Index(), $from, $to, $label, "-RIGHT->>") -!endprocedure -!unquoted procedure Rel_Right($from, $to, $label, $techn) -Rel_(Index(), $from, $to, $label, $techn, "-RIGHT->>") -!endprocedure -!unquoted procedure RelIndex_R($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "-RIGHT->>") +!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_R($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "-RIGHT->>") +!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_Right($e_index, $from, $to, $label) -Rel_($e_index, $from, $to, $label, "-RIGHT->>") +!unquoted procedure RelIndex_R($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure RelIndex_Right($e_index, $from, $to, $label, $techn) -Rel_($e_index, $from, $to, $label, $techn, "-RIGHT->>") +!unquoted procedure RelIndex_Right($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure