Index: trunk/doc/design/10_forge.html =================================================================== --- trunk/doc/design/10_forge.html (revision 8154) +++ trunk/doc/design/10_forge.html (revision 8155) @@ -2,7 +2,7 @@

10. cschem - forge

-

{imp10:0} +

{des10:0} The purpose of the forge plugin is to provide an easy to implement yet generic way for describing attribute transformations in attributes (e.g. in a library symbol) during compilation. @@ -9,13 +9,13 @@

10.1. Unconditinal forge

-

{imp10:1} +

{des10:1} The forge plugin works from the array attribute forge, which is taken as an ordered list of atomic steps to execute on attributes. For portability of data, the forge plugin needs to implement exactly the operations described below. -

{imp10:2} +

{des10:2} Each entry of the array is one operation. An operation is split into tokens separated by the separator character, which is a non-alphanumeric character following the operator (first token). For example sub,^dip,DIP,footprint is a valid @@ -22,17 +22,17 @@ operation that uses regexp to replace leading "dip" to DIP in the footprint attribute. Since sub is followed by a comma, the token separator is comma. -

{imp10:3} +

{des10:3} Operations work with the current values of attributes at the time of plugin execution during compilation of the abstract model. If destination attribute doesn't exist, it is created. -

{imp10:4} +

{des10:4} If referenced source attribute of an operation does not exist, the operation is silently skipped.

-
{imp10:5} Operation summary +
{des10:5} Operation summary
operations and arguments in-place array? short description
sub,pat,str,attr yes map substitutes one match of regex pattern pat with str in attr
gsub,pat,str,attr yes map substitutes all matches of regex pattern pat with str in attr @@ -46,11 +46,11 @@
prepend,dstattr,srcattr no darr prepends the value of the source attribute srcattr to the value of the destination attribute dstattr
-

{imp10:6} +

{des10:6} In-place operations modify existing attributes in place. They are no-op for non-existing attributes. -

{imp10:7} +

{des10:7} If addressed attribute of the operation is an array, the operation will behave according to the "array?" column:

10.1. Conditinal forge

-

{imp10:8} +

{des10:8} Attributes whose key start with forge-if/ are used for conditional execution of forge. The remainder of the attribute key is an arbitrary identifier, for example forge-if/dnp is commonly used for setting a DNP (do-not-populate) attribute depending on the current view and/or stances. -

{imp10:9} The attribute is an array; the first entry contains +

{des10:9} The attribute is an array; the first entry contains the condition; the rest of the entries contain the same forge operations as the unconditional forge attribute. However, the operations are performed only if the expression in the first entry evaluates to true. -

{imp10:10} The condition is an expression in the usual infix form. +

{des10:10} The condition is an expression in the usual infix form. There are three data types supported:

-

{imp10:11} The following binary operators are defined for strings (where each +

{des10:11} The following binary operators are defined for strings (where each oparand is a string literal or a constant):