diff --git a/src/file.cc b/src/file.cc index b8380d7248..dc9c4a83b9 100644 --- a/src/file.cc +++ b/src/file.cc @@ -1,4 +1,5 @@ #include "node.h" +#include "file.h" #include #include @@ -75,7 +76,7 @@ CallTopCallback (Handle handle, const int argc, Handle argv[]) TryCatch try_catch; callback->Call(handle, argc, argv); if(try_catch.HasCaught()) { - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); return; } } @@ -106,7 +107,7 @@ FileSystem::Rename (const Arguments& args) String::Utf8Value path(args[0]->ToString()); String::Utf8Value new_path(args[1]->ToString()); - node_eio_warmup(); + node::eio_warmup(); eio_req *req = eio_rename(*path, *new_path, EIO_PRI_DEFAULT, AfterRename, NULL); return Undefined(); @@ -133,7 +134,7 @@ FileSystem::Stat (const Arguments& args) String::Utf8Value path(args[0]->ToString()); - node_eio_warmup(); + node::eio_warmup(); eio_req *req = eio_stat(*path, EIO_PRI_DEFAULT, AfterStat, NULL); return Undefined(); @@ -263,7 +264,7 @@ File::Close (const Arguments& args) int fd = file->GetFD(); - node_eio_warmup(); + node::eio_warmup(); eio_req *req = eio_close (fd, EIO_PRI_DEFAULT, File::AfterClose, file); return Undefined(); @@ -324,7 +325,7 @@ File::Open (const Arguments& args) } // TODO how should the mode be set? - node_eio_warmup(); + node::eio_warmup(); eio_req *req = eio_open (*path, flags, 0666, EIO_PRI_DEFAULT, File::AfterOpen, file); return Undefined(); @@ -392,7 +393,7 @@ File::Write (const Arguments& args) int fd = file->GetFD(); - node_eio_warmup(); + node::eio_warmup(); eio_req *req = eio_write(fd, buf, length, pos, EIO_PRI_DEFAULT, File::AfterWrite, file); return Undefined(); @@ -433,7 +434,7 @@ File::Read (const Arguments& args) int fd = file->GetFD(); // NOTE: NULL pointer tells eio to allocate it itself - node_eio_warmup(); + node::eio_warmup(); eio_req *req = eio_read(fd, NULL, length, pos, EIO_PRI_DEFAULT, File::AfterRead, file); assert(req); @@ -485,7 +486,7 @@ File::New(const Arguments& args) } void -NodeInit_file (Handle target) +node::Init_file (Handle target) { if (!fs.IsEmpty()) return; diff --git a/src/file.h b/src/file.h index 75fddb7871..5fe372bb7d 100644 --- a/src/file.h +++ b/src/file.h @@ -3,6 +3,9 @@ #include -void NodeInit_file (v8::Handle target); +namespace node { -#endif +void Init_file (v8::Handle target); + +} // namespace node +#endif // node_file_h diff --git a/src/http.cc b/src/http.cc index 101b185c5e..a162fa05ff 100644 --- a/src/http.cc +++ b/src/http.cc @@ -260,7 +260,7 @@ on_headers_complete (ebb_request *req) Handle r = request->connection.js_onrequest->Call(Context::GetCurrent()->Global(), argc, argv); if(try_catch.HasCaught()) - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); } static void @@ -373,7 +373,7 @@ HttpRequest::MakeBodyCallback (const char *base, size_t length) Handle result = onbody->Call(js_object, argc, argv); if(try_catch.HasCaught()) - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); } Local @@ -651,7 +651,7 @@ newHTTPHttpServer (const Arguments& args) } void -NodeInit_http (Handle target) +node::Init_http (Handle target) { HandleScope scope; diff --git a/src/http.h b/src/http.h index 83367ab4f6..69e5f09f6c 100644 --- a/src/http.h +++ b/src/http.h @@ -3,6 +3,9 @@ #include -void NodeInit_http (v8::Handle target); +namespace node { +void Init_http (v8::Handle target); + +} // namespace node #endif diff --git a/src/net.cc b/src/net.cc index 5f83f34f1d..6afff74189 100644 --- a/src/net.cc +++ b/src/net.cc @@ -307,7 +307,7 @@ Socket::ConnectTCP (const Arguments& args) * In the future I will move to a system using adns or udns: * http://lists.schmorp.de/pipermail/libev/2009q1/000632.html */ - node_eio_warmup(); + node::eio_warmup(); eio_req *req = eio_custom (Socket::Resolve, EIO_PRI_DEFAULT, Socket::AfterResolve, socket); return Undefined(); @@ -365,7 +365,7 @@ Socket::AfterResolve (eio_req *req) onconnect->Call(socket->handle_, argc, argv); if(try_catch.HasCaught()) - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); return 0; } @@ -488,7 +488,7 @@ Socket::OnConnect (oi_socket *s) Handle r = on_connect->Call(socket->handle_, argc, argv); if(try_catch.HasCaught()) - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); } void @@ -527,7 +527,7 @@ Socket::OnRead (oi_socket *s, const void *buf, size_t count) Handle r = onread->Call(socket->handle_, argc, argv); if(try_catch.HasCaught()) - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); } void @@ -548,7 +548,7 @@ Socket::OnClose (oi_socket *s) Handle r = onclose->Call(socket->handle_, 0, NULL); if(try_catch.HasCaught()) - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); delete socket; } @@ -568,7 +568,7 @@ Socket::OnDrain (oi_socket *s) Handle r = ondrain->Call(socket->handle_, 0, NULL); if(try_catch.HasCaught()) - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); } @@ -587,7 +587,7 @@ Socket::OnError (oi_socket *s, oi_error e) Handle r = onerror->Call(socket->handle_, 0, NULL); if(try_catch.HasCaught()) - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); } void @@ -605,11 +605,11 @@ Socket::OnTimeout (oi_socket *s) Handle r = ontimeout->Call(socket->handle_, 0, NULL); if(try_catch.HasCaught()) - node_fatal_exception(try_catch); + node::fatal_exception(try_catch); } void -NodeInit_net (Handle target) +node::Init_net (Handle target) { HandleScope scope; diff --git a/src/net.h b/src/net.h index 347a3ebceb..9e6662f9b4 100644 --- a/src/net.h +++ b/src/net.h @@ -3,6 +3,9 @@ #include -void NodeInit_net (v8::Handle target); +namespace node { +void Init_net (v8::Handle target); + +} // namespace node #endif diff --git a/src/node.cc b/src/node.cc index 002dc71d2d..a77748928e 100644 --- a/src/node.cc +++ b/src/node.cc @@ -75,13 +75,13 @@ ExecuteString(v8::Handle source, Handle