From fd7d8138a4ff5515f9b79c584a98d5c26d8ddb8a Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 2 Mar 2017 05:48:01 -0800 Subject: 3750 --- html/091socket.cc.html | 62 +++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'html/091socket.cc.html') diff --git a/html/091socket.cc.html b/html/091socket.cc.html index 555af1c4..f503d40c 100644 --- a/html/091socket.cc.html +++ b/html/091socket.cc.html @@ -77,23 +77,23 @@ if ('onhashchange' in window) { 17 :(before "End Primitive Recipe Checks") 18 case _OPEN_CLIENT_SOCKET: { 19 if (SIZE(inst.ingredients) != 2) { - 20 raise << maybe(get(Recipe, r).name) << "'$open-client-socket' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); + 20 raise << maybe(get(Recipe, r).name) << "'$open-client-socket' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); 21 break; 22 } 23 if (!is_mu_text(inst.ingredients.at(0))) { - 24 raise << maybe(get(Recipe, r).name) << "first ingredient of '$open-client-socket' should be text (the hostname), but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); + 24 raise << maybe(get(Recipe, r).name) << "first ingredient of '$open-client-socket' should be text (the hostname), but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); 25 break; 26 } 27 if (!is_mu_number(inst.ingredients.at(1))) { - 28 raise << maybe(get(Recipe, r).name) << "second ingredient of '$open-client-socket' should be a number (the port of the hostname to connect to), but got '" << to_string(inst.ingredients.at(1)) << "'\n" << end(); + 28 raise << maybe(get(Recipe, r).name) << "second ingredient of '$open-client-socket' should be a number (the port of the hostname to connect to), but got '" << to_string(inst.ingredients.at(1)) << "'\n" << end(); 29 break; 30 } 31 if (SIZE(inst.products) != 1) { - 32 raise << maybe(get(Recipe, r).name) << "'$open-client-socket' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); + 32 raise << maybe(get(Recipe, r).name) << "'$open-client-socket' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); 33 break; 34 } 35 if (!is_mu_number(inst.products.at(0))) { - 36 raise << maybe(get(Recipe, r).name) << "first product of '$open-client-socket' should be a number (socket handle), but got '" << to_string(inst.products.at(0)) << "'\n" << end(); + 36 raise << maybe(get(Recipe, r).name) << "first product of '$open-client-socket' should be a number (socket handle), but got '" << to_string(inst.products.at(0)) << "'\n" << end(); 37 break; 38 } 39 break; @@ -118,7 +118,7 @@ if ('onhashchange' in window) { 58 socket_t* result = new socket_t; 59 result->fd = socket(AF_INET, SOCK_STREAM, 0); 60 if (result->fd < 0) { - 61 raise << "Failed to create socket.\n" << end(); + 61 raise << "Failed to create socket.\n" << end(); 62 return result; 63 } 64 result->addr.sin_family = AF_INET; @@ -128,7 +128,7 @@ if ('onhashchange' in window) { 68 if (connect(result->fd, reinterpret_cast<sockaddr*>(&result->addr), sizeof(result->addr)) < 0) { 69 close(result->fd); 70 result->fd = -1; - 71 raise << "Failed to connect to " << host << ':' << port << '\n' << end(); + 71 raise << "Failed to connect to " << host << ':' << port << '\n' << end(); 72 } 73 return result; 74 } @@ -140,19 +140,19 @@ if ('onhashchange' in window) { 80 :(before "End Primitive Recipe Checks") 81 case _OPEN_SERVER_SOCKET: { 82 if (SIZE(inst.ingredients) != 1) { - 83 raise << maybe(get(Recipe, r).name) << "'$open-server-socket' requires exactly one ingredient (the port to listen for requests on), but got '" << inst.original_string << "'\n" << end(); + 83 raise << maybe(get(Recipe, r).name) << "'$open-server-socket' requires exactly one ingredient (the port to listen for requests on), but got '" << inst.original_string << "'\n" << end(); 84 break; 85 } 86 if (!is_mu_number(inst.ingredients.at(0))) { - 87 raise << maybe(get(Recipe, r).name) << "first ingredient of '$open-server-socket' should be a number, but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); + 87 raise << maybe(get(Recipe, r).name) << "first ingredient of '$open-server-socket' should be a number, but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); 88 break; 89 } 90 if (SIZE(inst.products) != 1) { - 91 raise << maybe(get(Recipe, r).name) << "'$open-server-socket' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); + 91 raise << maybe(get(Recipe, r).name) << "'$open-server-socket' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); 92 break; 93 } 94 if (!is_mu_number(inst.products.at(0))) { - 95 raise << maybe(get(Recipe, r).name) << "first product of '$open-server-socket' should be a number (file handle), but got '" << to_string(inst.products.at(0)) << "'\n" << end(); + 95 raise << maybe(get(Recipe, r).name) << "first product of '$open-server-socket' should be a number (file handle), but got '" << to_string(inst.products.at(0)) << "'\n" << end(); 96 break; 97 } 98 break; @@ -176,7 +176,7 @@ if ('onhashchange' in window) { 116 socket_t* result = new socket_t; 117 result->fd = socket(AF_INET, SOCK_STREAM, 0); 118 if (result->fd < 0) { -119 raise << "Failed to create server socket.\n" << end(); +119 raise << "Failed to create server socket.\n" << end(); 120 return result; 121 } 122 int dummy = 0; @@ -190,7 +190,7 @@ if ('onhashchange' in window) { 130 else { 131 close(result->fd); 132 result->fd = -1; -133 raise << "Failed to bind result socket to port " << port << ". Something's already using that port.\n" << end(); +133 raise << "Failed to bind result socket to port " << port << ". Something's already using that port.\n" << end(); 134 } 135 return result; 136 } @@ -202,19 +202,19 @@ if ('onhashchange' in window) { 142 :(before "End Primitive Recipe Checks") 143 case _ACCEPT: { 144 if (SIZE(inst.ingredients) != 1) { -145 raise << maybe(get(Recipe, r).name) << "'$accept' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); +145 raise << maybe(get(Recipe, r).name) << "'$accept' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); 146 break; 147 } 148 if (!is_mu_number(inst.ingredients.at(0))) { -149 raise << maybe(get(Recipe, r).name) << "first ingredient of '$accept' should be a number, but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); +149 raise << maybe(get(Recipe, r).name) << "first ingredient of '$accept' should be a number, but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); 150 break; 151 } 152 if (SIZE(inst.products) != 1) { -153 raise << maybe(get(Recipe, r).name) << "'$accept' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); +153 raise << maybe(get(Recipe, r).name) << "'$accept' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); 154 break; 155 } 156 if (!is_mu_number(inst.products.at(0))) { -157 raise << maybe(get(Recipe, r).name) << "first product of '$accept' should be a number (file handle), but got '" << to_string(inst.products.at(0)) << "'\n" << end(); +157 raise << maybe(get(Recipe, r).name) << "first product of '$accept' should be a number (file handle), but got '" << to_string(inst.products.at(0)) << "'\n" << end(); 158 break; 159 } 160 break; @@ -251,32 +251,32 @@ if ('onhashchange' in window) { 191 :(before "End Primitive Recipe Checks") 192 case _READ_FROM_SOCKET: { 193 if (SIZE(inst.ingredients) != 1) { -194 raise << maybe(get(Recipe, r).name) << "'$read-from-socket' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); +194 raise << maybe(get(Recipe, r).name) << "'$read-from-socket' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); 195 break; 196 } 197 if (!is_mu_number(inst.ingredients.at(0))) { -198 raise << maybe(get(Recipe, r).name) << "first ingredient of '$read-from-socket' should be a number (socket), but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); +198 raise << maybe(get(Recipe, r).name) << "first ingredient of '$read-from-socket' should be a number (socket), but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); 199 break; 200 } 201 int nprod = SIZE(inst.products); 202 if (nprod == 0 || nprod > 4) { -203 raise << maybe(get(Recipe, r).name) << "'$read-from-socket' requires 1-4 products, but got '" << inst.original_string << "'\n" << end(); +203 raise << maybe(get(Recipe, r).name) << "'$read-from-socket' requires 1-4 products, but got '" << inst.original_string << "'\n" << end(); 204 break; 205 } 206 if (!is_mu_character(inst.products.at(0))) { -207 raise << maybe(get(Recipe, r).name) << "first product of '$read-from-socket' should be a character, but got '" << to_string(inst.products.at(0)) << "'\n" << end(); +207 raise << maybe(get(Recipe, r).name) << "first product of '$read-from-socket' should be a character, but got '" << to_string(inst.products.at(0)) << "'\n" << end(); 208 break; 209 } 210 if (nprod > 1 && !is_mu_boolean(inst.products.at(1))) { -211 raise << maybe(get(Recipe, r).name) << "second product of '$read-from-socket' should be a boolean (data received?), but got '" << to_string(inst.products.at(1)) << "'\n" << end(); +211 raise << maybe(get(Recipe, r).name) << "second product of '$read-from-socket' should be a boolean (data received?), but got '" << to_string(inst.products.at(1)) << "'\n" << end(); 212 break; 213 } 214 if (nprod > 2 && !is_mu_boolean(inst.products.at(2))) { -215 raise << maybe(get(Recipe, r).name) << "third product of '$read-from-socket' should be a boolean (eof?), but got '" << to_string(inst.products.at(2)) << "'\n" << end(); +215 raise << maybe(get(Recipe, r).name) << "third product of '$read-from-socket' should be a boolean (eof?), but got '" << to_string(inst.products.at(2)) << "'\n" << end(); 216 break; 217 } 218 if (nprod > 3 && !is_mu_number(inst.products.at(3))) { -219 raise << maybe(get(Recipe, r).name) << "fourth product of '$read-from-socket' should be a number (error code), but got '" << to_string(inst.products.at(3)) << "'\n" << end(); +219 raise << maybe(get(Recipe, r).name) << "fourth product of '$read-from-socket' should be a number (error code), but got '" << to_string(inst.products.at(3)) << "'\n" << end(); 220 break; 221 } 222 break; @@ -312,7 +312,7 @@ if ('onhashchange' in window) { 252 } 253 else if (poll_result < 0) { 254 int error_code = errno; -255 raise << maybe(current_recipe_name()) << "error in $read-from-socket\n" << end(); +255 raise << maybe(current_recipe_name()) << "error in $read-from-socket\n" << end(); 256 products.at(0).push_back(/*no data*/0); 257 products.at(1).push_back(/*found*/false); 258 products.at(2).push_back(/*eof*/false); @@ -344,7 +344,7 @@ if ('onhashchange' in window) { 284 :(before "End Primitive Recipe Checks") 285 case _WRITE_TO_SOCKET: { 286 if (SIZE(inst.ingredients) != 2) { -287 raise << maybe(get(Recipe, r).name) << "'$write-to-socket' requires exactly two ingredient, but got '" << inst.original_string << "'\n" << end(); +287 raise << maybe(get(Recipe, r).name) << "'$write-to-socket' requires exactly two ingredient, but got '" << inst.original_string << "'\n" << end(); 288 break; 289 } 290 break; @@ -357,7 +357,7 @@ if ('onhashchange' in window) { 297 long long int y = static_cast<long long int>(ingredients.at(1).at(0)); 298 char c = static_cast<char>(y); 299 if (write(socket->fd, &c, 1) != 1) { -300 raise << maybe(current_recipe_name()) << "failed to write to socket\n" << end(); +300 raise << maybe(current_recipe_name()) << "failed to write to socket\n" << end(); 301 exit(0); 302 } 303 products.resize(1); @@ -372,19 +372,19 @@ if ('onhashchange' in window) { 312 :(before "End Primitive Recipe Checks") 313 case _CLOSE_SOCKET: { 314 if (SIZE(inst.ingredients) != 1) { -315 raise << maybe(get(Recipe, r).name) << "'$close-socket' requires exactly two ingredient, but got '" << inst.original_string << "'\n" << end(); +315 raise << maybe(get(Recipe, r).name) << "'$close-socket' requires exactly two ingredient, but got '" << inst.original_string << "'\n" << end(); 316 break; 317 } 318 if (!is_mu_number(inst.ingredients.at(0))) { -319 raise << maybe(get(Recipe, r).name) << "first ingredient of '$close-socket' should be a number, but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); +319 raise << maybe(get(Recipe, r).name) << "first ingredient of '$close-socket' should be a number, but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); 320 break; 321 } 322 if (SIZE(inst.products) != 1) { -323 raise << maybe(get(Recipe, r).name) << "'$close-socket' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); +323 raise << maybe(get(Recipe, r).name) << "'$close-socket' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); 324 break; 325 } 326 if (inst.products.at(0).name != inst.ingredients.at(0).name) { -327 raise << maybe(get(Recipe, r).name) << "product of '$close-socket' must be first ingredient '" << inst.ingredients.at(0).original_string << "', but got '" << inst.products.at(0).original_string << "'\n" << end(); +327 raise << maybe(get(Recipe, r).name) << "product of '$close-socket' must be first ingredient '" << inst.ingredients.at(0).original_string << "', but got '" << inst.products.at(0).original_string << "'\n" << end(); 328 break; 329 } 330 break; -- cgit 1.4.1-2-gfad0