Index: hid_remote/proto_parse.html =================================================================== --- hid_remote/proto_parse.html (revision 33320) +++ hid_remote/proto_parse.html (nonexistent) @@ -1,38 +0,0 @@ - - -Protocol parser state machine of the reference implementation: - -Legend: - -

Notes on the reference implementation

-The reference implementation builds a tree of nodes for the arguments. -Each node is either a list or a text. A node has a pointer to its parent, its -first child and its next sibling. While parsing list-of-lists, the parser -keeps a current node. A new node is either added as the last sibling of -the current node (new argument on a list) or as the first -child of the current node (first argument of a new list when the list is -open). -

-When a list is closed, the parent of the current node becomes the -new current node. -

-When parsing a new message, the current node is NULL until the argument list -is open; the new current node also becomes the argument tree root. -If the argument tree root is closed, a newline shall follow, because that's -how a message is terminated. -

-The binary string part of the state machine has 2 more internal -states: -

- - - Index: hid_remote/proto_parse.dot =================================================================== --- hid_remote/proto_parse.dot (revision 33320) +++ hid_remote/proto_parse.dot (nonexistent) @@ -1,84 +0,0 @@ -digraph parse_state_macine { - - -MSG [label="MSG:\nmessage lead-in\nor\nbetween\nmessages" shape=box style=filled fillcolor=yellow] -COMMENT [label="COMMENT:\nskipping comment" shape=box style=filled fillcolor=yellow] -CMD [label="CMD:\nparsing command name" shape=box style=filled fillcolor=yellow] -TSTR [label="TSTR:\nparsing test string" shape=box style=filled fillcolor=yellow] -BSTR [label="BSTR:\nparsing bin string" shape=box style=filled fillcolor=yellow] -LIST [label="LIST:\nin list" shape=box style=filled fillcolor=yellow] -ERROR [label="ERROR:\nbad input" shape=box style=filled fillcolor=red] - -######## MSG - -init [shape="diamond" style=filled fillcolor=yellow] -init -> MSG - -msg_append [label="store 1st\ncommand char"] - -MSG -> COMMENT [label="input==#" color=blue] -MSG -> MSG [label="input==\\r\\n\\t\nspace" color=blue] -MSG -> ERROR [label="input==binary"] -MSG -> msg_append [label="input==text"] -msg_append -> CMD - -######## COMMENT - -COMMENT -> MSG [label="input==\\n" color=blue] -COMMENT -> COMMENT [color=blue] - - -######## CMD -cmd_list_new [label="create new list\nmake it arg tree\nroot and current"] -cmd_list_new -> LIST -cmd_append [label="append a character\nto command name"] -cmd_append -> CMD [label="command name length\nis less than 16"] -cmd_append -> ERROR [label="command name length\nis more than 16"] -CMD -> cmd_list_new [label="input==({"] -CMD -> ERROR [label="input==binary"] -CMD -> cmd_append [label="input==text"] - -######## LIST -got_msg [label="message fully parsed\nexecute message" style=filled fillcolor=cyan] -got_msg -> MSG -pop [label="pop:\ncurrent_list = current_list->parent"] -pop -> got_msg [label="input=\\n\nand\ncurrent_list == NULL\n(arg root closed)"] -pop -> ERROR [label="input!=\\n\nand\ncurrent_list == NULL\n(unbalanced parenthesis)"] -pop -> LIST -push [label="push:\create new list\nappend it as current's sibling\nmake it current"] -push->LIST -new_str [label="create a new bin or text string\nnode and append it to\nthe current list"] -new_str -> tstr_append [label="current is generic list"] -new_str -> bstr_append [label="current is binary list"] - -LIST -> pop [label="input==)}"] -LIST -> push [label="input==({"] -LIST -> LIST [label="input==space\n(ignore)"] -LIST -> ERROR [label="input!=\\n and current == NULL\n(unbalanced parenthesis)"] -LIST -> new_str [label="input==text"] - -######## TSTR -str_fin [label="finish current string\n"] -str_fin -> LIST -str_fin_pop [label="finish current string\n"] -str_fin_pop -> pop -tstr_append [label="append to current string\n"] -tstr_append -> ERROR [label="string length > 16"] -tstr_append -> TSTR -TSTR -> str_fin [label="input==space"] -TSTR -> str_fin_pop [label="input==)}"] -TSTR -> ERROR [label="input==binary"] -TSTR -> tstr_append [label="input==text"] - -######## BSTR -read_base64 [label="store next digit\nof string length"] -read_base64 -> BSTR -bstr_append -> BSTR -BSTR -> read_base64 [label="before the ="] -BSTR -> bstr_append [label="after the ="] -BSTR -> str_fin_pop [label="last char of the string"] - -######## ERR -ERROR -> ERROR [label="can't recover"] - -} Index: hid_remote/proto_high.html =================================================================== --- hid_remote/proto_high.html (revision 33320) +++ hid_remote/proto_high.html (nonexistent) @@ -1,237 +0,0 @@ - - -

remote HID protocol, high level

- -

reference

- -

ver(protver)

-Sends the protocol version the server will speak. If the client doesn't -support that version, it should break the connection. -

-Arguments: -

- -

unit(abbrev)

-Sends the coordinate unit used in subsequent communication. This is not -necessarily the unit used for displaying values on the user interface, -but the unit used to interpret numeric coordinate values sent in commands. -

-Arguments: -

- -

ready()

-Informs the client that the server is ready to start the session. The -client needs to answer with a Ready() message before the server proceeds. -

-Arguments: none. - - -

brddim(w h)

-Announce board dimensions. Some layers may extend beyond the board. -

-Arguments: -

- -

inval(x1 x2 y1 y2)

-Invalidate a rectangular section of the screen; the client should redraw -this area. Clients implementing their own mechanism to keep track on -drawing are free to ignore these requests -

-Arguments: -

- -

inval()

-Same as inval(x1 x2 y1 y2) but invalidates the whole screen. -

-Arguments: none - -

newlg(name group_id flags)

-Create a new layer group. -

-Arguments: -

-

-Example: -

-newlg(topassembly 16777219 ((top) (assy) (virtual)))
-
-Creates the top assembly virtual layer with ID 16777219 with the name -of "topassembly" - -

newly(name layer_id group_id)

-Create a new layer within an existing layer group. -

-Arguments: -

-

-Example: -

-newly(soldergnd 3 11)
-
-Creates a layer 3 called "soldergnd" in group 11. - -

setlg(group_id is_empty purpose)

-Inform the client that the next set of drawing commands are for a specific -layer group. (Note: the reason for announcing groups and not layers: -all layers in that group are drawn at once; visibility -of layers within the same group are switched together.) -

-Arguments: -

- -

makeGC()

-Request the client to make a new graphical context. The client should -allocate a GC and return an integer ID using the MadeGC(ID) message. -The ID uniquely identifies the GC; it should be small positive integer -(between 0 and 31 for now). -

-Arguments: none - -

delGC(ID)

-Inform the client that a given GC is not needed anymore. The server -will not reference the GC again and the GC can be destroyed (but graphics -drawn on the screen should not be affected). The ID may be reused by the -client in a subsequent madeGC() message). -

-Arguments: -

- -

clr(gci colorstring)

-Change the color subsequent drawing commands of a given GC will use. -

-Arguments: -

- -

cap(gci style)

-Set the line ending cap style. Note: the cap extends half-line-width beyond -the end coordinates, e.g. the end point of a line is the center of the round-cap -circle. -

-Arguments: -

- - -

linwid(gci width)

-Sets line width (pen tip diameter). -

-Arguments: -

- -

setxor(gci state)

-Sets whether to perform "xor-drawing" for subsequent drawing commands in -the selected GC. -

-Arguments: -

- - -

line(gci x1 y1 x2 y2)

-Draw a line using the current GC. The line inherits line width, color -and cap style from the GC. -

-Arguments: -

- -

rect(gci x1 y1 x2 y2 filled)

-Draw a rectangle. The rectangle inherits only color from the GC. -

-Arguments: -

- - -

fcirc(gci cx cy r)

-Draw a filled circle. The circle inherits only color from the GC. -

-Arguments: -

- -

poly(gci len ptlist)

-Draw a filled polygon. The polygon inherits only color from the GC. -

-Arguments: -

- -

umask(m)

-"use mask" m. The server uses this message to make an announcement before it -starts drawing certain things. -

-Arguments: -

- - - Index: hid_remote/proto_low.html =================================================================== --- hid_remote/proto_low.html (revision 33320) +++ hid_remote/proto_low.html (nonexistent) @@ -1,146 +0,0 @@ - - -

remote HID protocol, low level

- -In this document bold words are tokens and italic words -are grammatic constructs. -

-The protocol is designed with the following goals in mind: -

- - -

Tokens

- -
token description -
( start a generic list -
) end a generic list -
{ start a binary list -
} end a binary list -
space element separator: space (ASCII dec 32) -
\n message separator: newline (ASCII dec 10) -
text-string short, alphanumeric string -
binary-string long and/or non-alnum string -
- -

Grammar

-The communication is a pair of asynchronous message stream. The message -format is: -
-text-string generic-list \n
-or
-text-string binary-list \n
-or
-# comment \n
-
-

-where text-string is a command and generic-list is a list and holds -the arguments of. The command name can not start with a hash mark ('#') and -can not be empty. The list is the argument tree of the command. -

-As a special exception, a line may start with a hash mark ('#') to indicate -a comment. Characters up to the first newline are ignored. -

-Optional: a tolerant parser also accepts empty lines and whitespace before -a message. -

-The language has two type of lists: generic and binary. -A generic list is wrapped in parenthesis () and its children are: -

-A binary-list is wrapped in braces {} and its children are: - -

-Any list can be empty. There's no whitespace after the opening token and -before the closing token, so the empty generic-list and the empty binary-list -are written as, respectively: -

-()
-{}
-
-Subsequent fields of a list has a single space in between, for -separation (this is an intentional redundancy for a binary-list). -

-Note: a generic-list can host text and binary children, but a -binary list can not host only binary children. This means if a node -of the parse tree is a binary list, the subtree will contain only binary nodes. -

-A text-string contains only English alphanumeric characters (A..Z, a..z, -0..9), underscores (_), plus and minus signs (+, -) periods (.) and -the hash mark ('#') and is at most 16 characters long. -

-A binary string encodes the length of the payload in base64 (A..Z, a..z, +, /), -has a '=' for separator then the payload in binary format. For example -

-F=hello
-
-means the 5 characters long string "hello". The maximum size of the base64 -encoded length field is 5, thus the longest binary data that can be -packed in a single field is 1 gigabyte. - -

Examples

- -

empty-argument messages

-
-hello()\n
-foo{}\n
-
- -

single-argument messages

-Text and binary alternative for the same content: -
-hello(world)\n
-hello{F=world}\n
-
- -

multi-argument messages

-Text and binary alternative for the same content: -
-print(hello world !)\n
-print{E=hello F=world B=!}\n
-
- -Note: using space between list items; don't space -before the first or after the last argument. Always emit one space between -any two list items. - -

lists in list

-Text and binary alternatives for the same content: -
-line((14.55 3.1) (44.2 0) 5)\n
-line({F=14.55 D=3.1} (44.2 0) 5)\n
-line((14.55 3.1) {E=44.2 B=0} 5)\n
-line({F=14.55 D=3.1} {E=44.2 B=0} 5)\n
-line{{F=14.55 D=3.1} {E=44.2 B=0} B=5}\n
-
-The subtree assumed in this fictional message is two x;y coordinate pairs -and a line width. In other words the arguments of line is a list (start -point), another list (end point) and a scalar (width). -

-Since all data comply to the text-string token format, -the first, simplest format is recommended. The other 4 lines demonstrate all -other valid variants. -

-It is important to note that there are constraints (derived from -the grammar) on choosing which list items can be encoded in binary: -

-Thus if the 3rd argument, (width in this example), must be encoded as a -binary-string, it will turn it's parent, line's argument list -binary too, which in turn enforces all arguments to be binary. Index: hid_remote/proto_parse.svg =================================================================== --- hid_remote/proto_parse.svg (revision 33320) +++ hid_remote/proto_parse.svg (nonexistent) @@ -1,597 +0,0 @@ - - - - - - -parse_state_macine - - -MSG - -MSG: -message lead-in -or -between -messages - - -lbl2 - -input==# - - -MSG->lbl2 - - - -lbl3 - -input==\r\n\t -space - - -MSG->lbl3 - - - -lbl4 - -input==binary - - -MSG->lbl4 - - - -lbl5 - -input==text - - -MSG->lbl5 - - - -COMMENT - -COMMENT: -skipping comment - - -COMMENT->COMMENT - - - - -lbl7 - -input==\n - - -COMMENT->lbl7 - - - -CMD - -CMD: -parsing command name - - -lbl12 - -input==({ - - -CMD->lbl12 - - - -lbl13 - -input==binary - - -CMD->lbl13 - - - -lbl14 - -input==text - - -CMD->lbl14 - - - -TSTR - -TSTR: -parsing test string - - -lbl30 - -input==space - - -TSTR->lbl30 - - - -lbl31 - -input==)} - - -TSTR->lbl31 - - - -lbl32 - -input==binary - - -TSTR->lbl32 - - - -lbl33 - -input==text - - -TSTR->lbl33 - - - -BSTR - -BSTR: -parsing bin string - - -lbl36 - -before the = - - -BSTR->lbl36 - - - -lbl37 - -after the = - - -BSTR->lbl37 - - - -lbl38 - -last char of the string - - -BSTR->lbl38 - - - -LIST - -LIST: -in list - - -lbl21 - -input==)} - - -LIST->lbl21 - - - -lbl22 - -input==({ - - -LIST->lbl22 - - - -lbl23 - -input==space -(ignore) - - -LIST->lbl23 - - - -lbl24 - -input!=\n and current == NULL -(unbalanced parenthesis) - - -LIST->lbl24 - - - -lbl25 - -input==text - - -LIST->lbl25 - - - -ERROR - -ERROR: -bad input - - -lbl39 - -can't recover - - -ERROR->lbl39 - - - -init - -init - - -init->MSG - - - - -msg_append - -store 1st -command char - - -msg_append->CMD - - - - -lbl2->COMMENT - - - - -lbl3->MSG - - - - -lbl4->ERROR - - - - -lbl5->msg_append - - - - -lbl7->MSG - - - - -cmd_list_new - -create new list -make it arg tree -root and current - - -cmd_list_new->LIST - - - - -cmd_append - -append a character -to command name - - -lbl10 - -command name length -is less than 16 - - -cmd_append->lbl10 - - - -lbl11 - -command name length -is more than 16 - - -cmd_append->lbl11 - - - -lbl10->CMD - - - - -lbl11->ERROR - - - - -lbl12->cmd_list_new - - - - -lbl13->ERROR - - - - -lbl14->cmd_append - - - - -got_msg - -message fully parsed -execute message - - -got_msg->MSG - - - - -pop - -pop: -current_list = current_list->parent - - -pop->LIST - - - - -lbl16 - -input=\n -and -current_list == NULL -(arg root closed) - - -pop->lbl16 - - - -lbl17 - -input!=\n -and -current_list == NULL -(unbalanced parenthesis) - - -pop->lbl17 - - - -lbl16->got_msg - - - - -lbl17->ERROR - - - - -push - -push:create new list -append it as current's sibling -make it current - - -push->LIST - - - - -new_str - -create a new bin or text string -node and append it to -the current list - - -lbl19 - -current is generic list - - -new_str->lbl19 - - - -lbl20 - -current is binary list - - -new_str->lbl20 - - - -tstr_append - -append to current string - - -lbl19->tstr_append - - - - -tstr_append->TSTR - - - - -lbl28 - -string length > 16 - - -tstr_append->lbl28 - - - -bstr_append - -bstr_append - - -lbl20->bstr_append - - - - -bstr_append->BSTR - - - - -lbl21->pop - - - - -lbl22->push - - - - -lbl23->LIST - - - - -lbl24->ERROR - - - - -lbl25->new_str - - - - -str_fin - -finish current string - - -str_fin->LIST - - - - -str_fin_pop - -finish current string - - -str_fin_pop->pop - - - - -lbl28->ERROR - - - - -lbl30->str_fin - - - - -lbl31->str_fin_pop - - - - -lbl32->ERROR - - - - -lbl33->tstr_append - - - - -read_base64 - -store next digit -of string length - - -read_base64->BSTR - - - - -lbl36->read_base64 - - - - -lbl37->bstr_append - - - - -lbl38->str_fin_pop - - - - -lbl39->ERROR - - - - - Index: hid_remote/Makefile =================================================================== --- hid_remote/Makefile (revision 33320) +++ hid_remote/Makefile (nonexistent) @@ -1,9 +0,0 @@ -proto_parse.svg: proto_parse.dot fixlab.sh - ./fixlab.sh < proto_parse.dot > .proto_parse.dot - dot -Tsvg .proto_parse.dot > proto_parse.svg - - -proto_parse.png: proto_parse.dot fixlab.sh - ./fixlab.sh < proto_parse.dot > .proto_parse.dot - dot -Tpng .proto_parse.dot > proto_parse.png - Index: hid_remote/fixlab.sh =================================================================== --- hid_remote/fixlab.sh (revision 33320) +++ hid_remote/fixlab.sh (nonexistent) @@ -1,43 +0,0 @@ -#!/bin/sh -awk ' -($2 == "->") { - - if (NF > 3) { - attr=$0 - if (!(attr ~ "[[]")) - attr = attr "[]" - } - else - attr = "[]" - - tmp = "lbl" (++lbl) - if (attr ~ "label") - extra_label="" - else - extra_label="label=\"\"" - - tmp_attr = attr - attr1=attr - attr2=attr - - if (extra_label == "") - sub("^[^[]*[[]", "[style=filled fillcolor=\"#fefefe\" shape=plaintext ", tmp_attr) - else { -# tmp_attr = "[fixedsize=true width=0 shape=plaintext " extra_label "]" - print $0 - next - } - - sub("^[^[]*[[]", "[", attr1) - sub("^[^[]*[[]", "[", attr2) - sub("label=\".*\"", "", attr1) - sub("label=\".*\"", "", attr2) - sub("[[]", "[arrowhead=none ", attr1) - - print tmp, tmp_attr - print $1, "->", tmp, attr1 - print tmp, "->", $3, attr2 - next -} -{ print $0 } -' \ No newline at end of file Property changes on: hid_remote/fixlab.sh ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: Makefile =================================================================== --- Makefile (revision 33320) +++ Makefile (revision 33321) @@ -4,10 +4,9 @@ all: install_all: - $(SCCBOX) mkdir -p $(DEVDIR)/alien_formats $(DEVDIR)/ddrc $(DEVDIR)/hid_remote $(DEVDIR)/mods3 + $(SCCBOX) mkdir -p $(DEVDIR)/alien_formats $(DEVDIR)/ddrc $(DEVDIR)/mods3 $(SCCBOX) $(HOW) alien_formats/*.txt $(DEVDIR)/alien_formats/ $(SCCBOX) $(HOW) ddrc/*.txt $(DEVDIR)/ddrc/ - $(SCCBOX) $(HOW) hid_remote/*.html hid_remote/*.svg $(DEVDIR)/hid_remote/ $(SCCBOX) $(HOW) mods3/*.html mods3/*.png $(DEVDIR)/mods3/ install: