From 9e751bb8c0cdf771d34c839cb6591d892b8e62de Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 7 Mar 2017 01:41:48 -0800 Subject: 3761 --- html/092socket.mu.html | 97 +++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 48 deletions(-) (limited to 'html/092socket.mu.html') diff --git a/html/092socket.mu.html b/html/092socket.mu.html index 67ca0f17..04b81c38 100644 --- a/html/092socket.mu.html +++ b/html/092socket.mu.html @@ -15,15 +15,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color a { text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } -.muData { color: #ffff00; } -.muControl { color: #c0a020; } +.Conceal { color: #4e4e4e; } +.muScenario { color: #00af00; } .Special { color: #c00000; } .Delimiter { color: #800080; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .LineNr { color: #444444; } .muRecipe { color: #ff8700; } -.muScenario { color: #00af00; } +.muControl { color: #c0a020; } +.muData { color: #ffff00; } --> @@ -69,16 +70,16 @@ if ('onhashchange' in window) { 9 make-random-nondeterministic 10 port:num <- random-in-range 0/real-random-numbers, 8000, 8100 11 run [ - 12 socket:num <- $open-server-socket port - 13 assert socket, [ + 12 ¦ socket:num <- $open-server-socket port + 13 ¦ assert socket, [ 14 F - example-server-test: $open-server-socket failed] - 15 handler-routine:number <- start-running serve-one-request socket, example-handler + 15 ¦ handler-routine:number <- start-running serve-one-request socket, example-handler 16 ] 17 source:&:source:char <- start-reading-from-network 0/real-resources, [localhost/], port 18 response:text <- drain source 19 10:@:char/raw <- copy *response 20 memory-should-contain [ - 21 10:array:character <- [abc] + 21 ¦ 10:array:character <- [abc] 22 ] 23 socket <- $close-socket socket 24 ] @@ -95,17 +96,17 @@ if ('onhashchange' in window) { 35 scenario example-client-test [ 36 local-scope 37 assume-resources [ - 38 [example.com/] <- [ - 39 |abc| - 40 ] + 38 ¦ [example.com/] <- [ + 39 ¦ ¦ |abc| + 40 ¦ ] 41 ] 42 run [ - 43 source:&:source:char <- start-reading-from-network resources, [example.com/] + 43 ¦ source:&:source:char <- start-reading-from-network resources, [example.com/] 44 ] 45 contents:text <- drain source 46 10:@:char/raw <- copy *contents 47 memory-should-contain [ - 48 10:array:character <- [abc + 48 ¦ 10:array:character <- [abc 49 ] 50 ] 51 ] @@ -130,15 +131,15 @@ if ('onhashchange' in window) { 70 local-scope 71 load-ingredients 72 { - 73 port:num, port-found?:boolean <- next-ingredient - 74 break-if port-found? - 75 port <- copy 80/http-port + 73 ¦ port:num, port-found?:boolean <- next-ingredient + 74 ¦ break-if port-found? + 75 ¦ port <- copy 80/http-port 76 } 77 { - 78 break-unless resources - 79 # fake network - 80 contents <- start-reading-from-fake-resource resources, uri - 81 return + 78 ¦ break-unless resources + 79 ¦ # fake network + 80 ¦ contents <- start-reading-from-fake-resource resources, uri + 81 ¦ return 82 } 83 # real network 84 host:text, path:text <- split-at uri, 47/slash @@ -165,19 +166,19 @@ if ('onhashchange' in window) { 105 local-scope 106 load-ingredients 107 { -108 +next-attempt -109 c:char, found?:bool, eof?:bool, error:num <- $read-from-socket socket -110 break-if eof? -111 break-if error -112 { -113 break-unless found? -114 sink <- write sink, c -115 } -116 { -117 break-if found? -118 switch -119 } -120 loop +108 ¦ +next-attempt +109 ¦ c:char, found?:bool, eof?:bool, error:num <- $read-from-socket socket +110 ¦ break-if eof? +111 ¦ break-if error +112 ¦ { +113 ¦ ¦ break-unless found? +114 ¦ ¦ sink <- write sink, c +115 ¦ } +116 ¦ { +117 ¦ ¦ break-if found? +118 ¦ ¦ switch +119 ¦ } +120 ¦ loop 121 } 122 sink <- close sink 123 ] @@ -195,12 +196,12 @@ if ('onhashchange' in window) { 135 len:num <- length *s 136 i:num <- copy 0 137 { -138 done?:bool <- greater-or-equal i, len -139 break-if done? -140 c:char <- index *s, i -141 $write-to-socket socket, c -142 i <- add i, 1 -143 loop +138 ¦ done?:bool <- greater-or-equal i, len +139 ¦ break-if done? +140 ¦ c:char <- index *s, i +141 ¦ $write-to-socket socket, c +142 ¦ i <- add i, 1 +143 ¦ loop 144 } 145 ] 146 @@ -211,11 +212,11 @@ if ('onhashchange' in window) { 151 # empty text? return empty texts 152 len:num <- length *text 153 { -154 empty?:bool <- equal len, 0 -155 break-unless empty? -156 x:text <- new [] -157 y:text <- new [] -158 return +154 ¦ empty?:bool <- equal len, 0 +155 ¦ break-unless empty? +156 ¦ x:text <- new [] +157 ¦ y:text <- new [] +158 ¦ return 159 } 160 idx:num <- find-next text, delim, 0 161 x:text <- copy-range text, 0, idx @@ -226,13 +227,13 @@ if ('onhashchange' in window) { 166 local-scope 167 x:text <- new [a/b] 168 run [ -169 y:text, z:text <- split-at x, 47/slash -170 10:@:char/raw <- copy *y -171 20:@:char/raw <- copy *z +169 ¦ y:text, z:text <- split-at x, 47/slash +170 ¦ 10:@:char/raw <- copy *y +171 ¦ 20:@:char/raw <- copy *z 172 ] 173 memory-should-contain [ -174 10:array:character <- [a] -175 20:array:character <- [/b] +174 ¦ 10:array:character <- [a] +175 ¦ 20:array:character <- [/b] 176 ] 177 ] -- cgit 1.4.1-2-gfad0