本文共 1462 字,大约阅读时间需要 4 分钟。
The was developed to configure Click routers, but nowadays you also can use it to write test cases for Click elements.
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;
转载地址:http://vdpvb.baihongyu.com/