Browse Source

Add more protocols: 'STOMP' and 'GEMINI'. Add markdown table generator for docs

prototype
Alex Williams 10 months ago
parent
commit
2ab1d25d66
Signed by: aw GPG Key ID: 19EE4AAA361A7E2C
2 changed files with 82 additions and 17 deletions
  1. +28
    -0
      gentables.l
  2. +54
    -17
      protocols.l

+ 28
- 0
gentables.l View File

@ -0,0 +1,28 @@
#!/usr/bin/env pil
#
# Generate Markdown tables for documentation
(load "protocols.l")
(de gen-table (Lst)
(prinl "| Name | Decimal | Hex | UTF-8 | BOAWP Version |")
(prinl "| :---- | :----: | :----: | :----: | :----: |")
(mapcar '((S)
(prin "| " (cdr S) " | " (car S) " | 0x" (pad 2 (hex (car S))) " | ")
(print (char (car S)))
(prinl " | " 0 " |") )
Lst ) )
(mapcar '((N) (gen-table N) (prinl))
(list
*BOAWP_default_commands
*BOAWP_http_commands
*BOAWP_stomp_commands
*BOAWP_gemini_commands
*BOAWP_default_header_names
*BOAWP_http_header_names
*BOAWP_stomp_header_names
*BOAWP_gemini_header_names ) )
(bye)

+ 54
- 17
protocols.l View File

@ -1,24 +1,35 @@
### Protocols
(setq *BOAWP_commands
# BOAWP
### COMMANDS
(setq *BOAWP_default_commands
# BOAWP
'((10 . "NOOP") # \n
(33 . "ERROR") # !
(43 . "OK")
# HTTP
(97 . "GET")
(98 . "HEAD")
(99 . "POST")
(100 . "PUT")
(101 . "DELETE")
(102 . "CONNECT")
(103 . "OPTIONS")
(104 . "TRACE")
(105 . "PATCH")
(43 . "OK") # +
) )
(setq *BOAWP_header_names
# BOAWP
(setq *BOAWP_http_commands
# HTTP
(mapcar '((N S)
(cons N S) )
(range 97 105)
'("GET" "HEAD" "POST" "PUT" "DELETE" "CONNECT" "OPTIONS" "TRACE" "PATCH") ) )
(setq *BOAWP_stomp_commands
# STOMP
(mapcar '((N S)
(cons N S) )
(range 97 115)
'("CONNECT" "STOMP" "CONNECTED" "SEND" "SUBSCRIBE" "UNSUBSCRIBE" "ACK" "NACK"
"BEGIN" "COMMIT" "ABORT" "DISCONNECT" "MESSAGE" "RECEIPT" "ERROR" "AUTH" "PING" "CHALLENGE" "PONG") ) )
(setq *BOAWP_gemini_commands
# GEMINI
(list (cons 97 "GET")) )
### HEADER NAMES
(setq *BOAWP_default_header_names
# BOAWP
'((32 . "noop")
(65 . "protocol")
(66 . "max-headers")
@ -37,8 +48,11 @@
(79 . "server")
(80 . "timestamp")
(81 . "user-agent")
# HTTP
(82 . "accept-charset")
) )
(setq *BOAWP_http_header_names
# HTTP
'((82 . "accept-charset")
(83 . "accept-encoding")
(84 . "accept-language")
(85 . "accept-ranges")
@ -80,3 +94,26 @@
(117 . "via")
(118 . "www-authenticate")
) )
(setq *BOAWP_stomp_header_names
# STOMP
(append
(mapcar '((N S)
(cons N S) )
(range 82 90)
'("ack" "destination" "heart-beat" "id" "login" "message" "message-id" "passcode"
"receipt"))
(mapcar '((N S)
(cons N S) )
(range 48 52)
'("receipt-id" "session" "subscription" "transaction" "version") ) ) )
(setq *BOAWP_gemini_header_names
# GEMINI
(mapcar '((N S)
(cons N S) )
(range 82 86)
'("fragment" "lang" "path" "query" "status") ) )
(setq *BOAWP_commands (append *BOAWP_default_commands *BOAWP_http_commands))
(setq *BOAWP_header_names (append *BOAWP_default_header_names *BOAWP_http_header_names))

Loading…
Cancel
Save