diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-07 20:11:47 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-07 20:11:47 -0700 |
commit | a7c59e3e330e83af666e70d3c8f4455ca5aebbb7 (patch) | |
tree | 041b9050fb091c4baaa601ab860ff6f0535fc9bf | |
parent | 8f48273355dce35d83aa8dd715844add7df1351d (diff) | |
download | mu-a7c59e3e330e83af666e70d3c8f4455ca5aebbb7.tar.gz |
3476
-rw-r--r-- | 091socket.cc | 16 | ||||
-rw-r--r-- | 092socket.mu | 2 | ||||
-rw-r--r-- | server-socket.mu | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/091socket.cc b/091socket.cc index 3ee272f4..b5afa26c 100644 --- a/091socket.cc +++ b/091socket.cc @@ -14,31 +14,31 @@ struct socket_t { }; :(before "End Primitive Recipe Declarations") -_SOCKET, +_OPEN_SERVER_SOCKET, :(before "End Primitive Recipe Numbers") -put(Recipe_ordinal, "$socket", _SOCKET); +put(Recipe_ordinal, "$open-server-socket", _OPEN_SERVER_SOCKET); :(before "End Primitive Recipe Checks") -case _SOCKET: { +case _OPEN_SERVER_SOCKET: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'$socket' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'$open-server-socket' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { - raise << maybe(get(Recipe, r).name) << "first ingredient of '$socket' should be a number, but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end(); + 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(); break; } if (SIZE(inst.products) != 1) { - raise << maybe(get(Recipe, r).name) << "'$socket' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'$open-server-socket' requires exactly one product, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.products.at(0))) { - raise << maybe(get(Recipe, r).name) << "first product of '$socket' should be a number (file handle), but got '" << to_string(inst.products.at(0)) << "'\n" << end(); + 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(); break; } break; } :(before "End Primitive Recipe Implementations") -case _SOCKET: { +case _OPEN_SERVER_SOCKET: { int port = ingredients.at(0).at(0); socket_t* server = server_socket(port); products.resize(1); diff --git a/092socket.mu b/092socket.mu index ab16779c..22d8a342 100644 --- a/092socket.mu +++ b/092socket.mu @@ -63,7 +63,7 @@ def start-writing-socket network:&:local-network, port:num -> sink:&:sink:char, source:&:source:char, sink:&:sink:char <- new-channel 30 { break-if network - socket:num <- $socket port + socket:num <- $open-server-socket port session:num <- $accept socket # TODO Create channel implementation of write-to-socket. return sink, 0/routine-id diff --git a/server-socket.mu b/server-socket.mu index 989bdb47..71db3e40 100644 --- a/server-socket.mu +++ b/server-socket.mu @@ -6,7 +6,7 @@ # code to make up for my lack of insight into Linux's socket internals. def main [ local-scope - socket:num <- $socket 8080/port + socket:num <- $open-server-socket 8080/port $print [Mu socket creation returned ], socket, 10/newline return-unless socket session:num <- $accept socket |