您的位置:首页 > 其它

Click Notes II - Click Script Language

2015-01-09 01:12 344 查看
The Click programming language was developed to configure Click
routers, but nowadays you also can use it to write test cases for Click elements.

Basic Syntax
Element Group
Compound Element
Script
Testie


Basic Syntax

The Click Script Language defines a configuration graph, which consists of connected elements. Each element has an element class specified by class name. Elements are connected through their input and output ports. Input and output ports are distinguished by
number, while elements are distinguished by name.

Click configuration strings are comma-separated lists of arguments delimited by parentheses. The fundamental syntax of Click Script Language is:
name :: class(config-string);    // declare element object

name1, name2, ..., nameN :: class(config); // declaration shorhand

name1[port1] -> [port2]name2;    // connect two elements

name1[port1] -> [port2a]name2[port2b] -> [port3]name3;    // piggyback connections

name1 -> name2 :: class(config-string) -> name3;  // declaring elements inside connections is allowed

name1 -> class(config-string) -> name3;  // anonymous element

require(requirement[, requirement …]);   // list config requirements


n1, n2 :: class -> n3;  // many-to-one connections


// many-to-many connections:

// A many-to-many connection matches output ports to input ports.

// There must be as many ports on the left as on the right.

// '=>' is the many-to-many connector.

c[0], c[1], c[2] => Paint(0), Paint(1), Paint(2) -> next;

c => Paint(0), Paint(1), Paint(2) -> next;

[/code]


- See more at:
http://www.bo-yang.net/2015/01/07/click-notes-click-language/#sthash.ayG2hR5q.dpuf
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: