Permalink
Browse files

Merge pull request #2 from indutny/fix-arguments-to-values

cio: Arguments => Value* []
  • Loading branch information...
2 parents 68e9395 + 41d7a25 commit df85d1a1bc68d2dc5b640a49399c338157303ae6 @creationix creationix committed Mar 22, 2012
Showing with 41 additions and 41 deletions.
  1. +1 −1 deps/candor
  2. +4 −4 src/cio.cc
  3. +8 −8 src/cio_string.cc
  4. +5 −5 src/lhttp_parser.cc
  5. +1 −1 src/luv.cc
  6. +1 −1 src/luv_handle.cc
  7. +8 −8 src/luv_stream.cc
  8. +7 −7 src/luv_tcp.cc
  9. +6 −6 src/luv_timer.cc
View
@@ -111,7 +111,7 @@ static void printValue(FILE* fd, Value* value, bool shallow) {
}
}
-static Value* Print(uint32_t argc, Arguments& argv) {
+static Value* Print(uint32_t argc, Value* argv[]) {
// Print all arguments as strings with spaces and a newline.
for (uint32_t i = 0; i < argc; i++) {
String* string = argv[i]->ToString();
@@ -124,7 +124,7 @@ static Value* Print(uint32_t argc, Arguments& argv) {
return Nil::New();
}
-static Value* PrettyPrint(uint32_t argc, Arguments& argv) {
+static Value* PrettyPrint(uint32_t argc, Value* argv[]) {
// Print all arguments as strings with spaces and a newline.
for (uint32_t i = 0; i < argc; i++) {
printValue(stdout, argv[i], false);
@@ -136,7 +136,7 @@ static Value* PrettyPrint(uint32_t argc, Arguments& argv) {
return Nil::New();
}
-static Value* Exit(uint32_t argc, Arguments& argv) {
+static Value* Exit(uint32_t argc, Value* argv[]) {
int status = 0;
if (argc) {
status = argv[0]->ToNumber()->IntegralValue();
@@ -145,7 +145,7 @@ static Value* Exit(uint32_t argc, Arguments& argv) {
return Nil::New();
}
-static Value* LoadBuiltin(uint32_t argc, Arguments& argv) {
+static Value* LoadBuiltin(uint32_t argc, Value* argv[]) {
assert(argc == 1);
const char* name = argv[0]->As<String>()->Value();
if (0 == strcmp(name, "string")) return cio_string_module();
View
@@ -6,63 +6,63 @@
using namespace candor;
-static Value* readUInt8(uint32_t argc, Arguments& argv) {
+static Value* readUInt8(uint32_t argc, Value* argv[]) {
assert(argc == 2 && argv[0]->Is<String>() && argv[1]->Is<Number>());
String* str = argv[0]->ToString();
unsigned int offset = argv[1]->ToNumber()->IntegralValue();
assert(offset >=0 && offset < str->Length());
return Number::NewIntegral(*(uint8_t*)((uint8_t*)str->Value() + offset));
}
-static Value* readInt8(uint32_t argc, Arguments& argv) {
+static Value* readInt8(uint32_t argc, Value* argv[]) {
assert(argc == 2 && argv[0]->Is<String>() && argv[1]->Is<Number>());
String* str = argv[0]->ToString();
unsigned int offset = argv[1]->ToNumber()->IntegralValue();
assert(offset >=0 && offset < str->Length());
return Number::NewIntegral(*(int8_t*)((uint8_t*)str->Value() + offset));
}
-static Value* readUInt16(uint32_t argc, Arguments& argv) {
+static Value* readUInt16(uint32_t argc, Value* argv[]) {
assert(argc == 2 && argv[0]->Is<String>() && argv[1]->Is<Number>());
String* str = argv[0]->ToString();
unsigned int offset = argv[1]->ToNumber()->IntegralValue();
assert(offset >=0 && offset + 1 < str->Length());
return Number::NewIntegral(*(uint16_t*)((uint8_t*)str->Value() + offset));
}
-static Value* readInt16(uint32_t argc, Arguments& argv) {
+static Value* readInt16(uint32_t argc, Value* argv[]) {
assert(argc == 2 && argv[0]->Is<String>() && argv[1]->Is<Number>());
String* str = argv[0]->ToString();
unsigned int offset = argv[1]->ToNumber()->IntegralValue();
assert(offset >=0 && offset + 1 < str->Length());
return Number::NewIntegral(*(int16_t*)((uint8_t*)str->Value() + offset));
}
-static Value* readUInt32(uint32_t argc, Arguments& argv) {
+static Value* readUInt32(uint32_t argc, Value* argv[]) {
assert(argc == 2 && argv[0]->Is<String>() && argv[1]->Is<Number>());
String* str = argv[0]->ToString();
unsigned int offset = argv[1]->ToNumber()->IntegralValue();
assert(offset >=0 && offset + 3 < str->Length());
return Number::NewIntegral(*(uint32_t*)((uint8_t*)str->Value() + offset));
}
-static Value* readInt32(uint32_t argc, Arguments& argv) {
+static Value* readInt32(uint32_t argc, Value* argv[]) {
assert(argc == 2 && argv[0]->Is<String>() && argv[1]->Is<Number>());
String* str = argv[0]->ToString();
unsigned int offset = argv[1]->ToNumber()->IntegralValue();
assert(offset >=0 && offset + 3 < str->Length());
return Number::NewIntegral(*(int32_t*)((uint8_t*)str->Value() + offset));
}
-static Value* readUInt64(uint32_t argc, Arguments& argv) {
+static Value* readUInt64(uint32_t argc, Value* argv[]) {
assert(argc == 2 && argv[0]->Is<String>() && argv[1]->Is<Number>());
String* str = argv[0]->ToString();
unsigned int offset = argv[1]->ToNumber()->IntegralValue();
assert(offset >=0 && offset + 7 < str->Length());
return Number::NewIntegral(*(uint64_t*)((uint8_t*)str->Value() + offset));
}
-static Value* readInt64(uint32_t argc, Arguments& argv) {
+static Value* readInt64(uint32_t argc, Value* argv[]) {
assert(argc == 2 && argv[0]->Is<String>() && argv[1]->Is<Number>());
String* str = argv[0]->ToString();
unsigned int offset = argv[1]->ToNumber()->IntegralValue();
View
@@ -54,7 +54,7 @@ static int lhttp_on_message_complete(http_parser* parser) {
return emit(parser, "onMessageComplete");
}
-static Value* lhttp_create(uint32_t argc, Arguments& argv) {
+static Value* lhttp_create(uint32_t argc, Value* argv[]) {
assert(argc == 0);
Object* obj = Object::New();
CData* cdata = CData::New(sizeof(http_parser));
@@ -64,7 +64,7 @@ static Value* lhttp_create(uint32_t argc, Arguments& argv) {
return obj;
}
-static Value* lhttp_init(uint32_t argc, Arguments& argv) {
+static Value* lhttp_init(uint32_t argc, Value* argv[]) {
assert(argc >= 2 && argc <= 3);
Object* obj = argv[0]->As<Object>();
http_parser* parser = (http_parser*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -90,7 +90,7 @@ static Value* lhttp_init(uint32_t argc, Arguments& argv) {
return Nil::New();
}
-static Value* lhttp_execute(uint32_t argc, Arguments& argv) {
+static Value* lhttp_execute(uint32_t argc, Value* argv[]) {
assert(argc == 2);
Object* obj = argv[0]->As<Object>();
http_parser* parser = (http_parser*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -101,7 +101,7 @@ static Value* lhttp_execute(uint32_t argc, Arguments& argv) {
return Number::NewIntegral(nparsed);
}
-static Value* lhttp_pause(uint32_t argc, Arguments& argv) {
+static Value* lhttp_pause(uint32_t argc, Value* argv[]) {
assert(argc == 2);
Object* obj = argv[0]->As<Object>();
http_parser* parser = (http_parser*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -110,7 +110,7 @@ static Value* lhttp_pause(uint32_t argc, Arguments& argv) {
return Nil::New();
}
-static Value* lhttp_parse_url(uint32_t argc, Arguments& argv) {
+static Value* lhttp_parse_url(uint32_t argc, Value* argv[]) {
assert(argc >= 1 && argv[0]->Is<String>());
String* str = argv[0]->ToString();
size_t buflen = str->Length();
View
@@ -7,7 +7,7 @@
using namespace candor;
-static Value* luv_last_error(uint32_t argc, Arguments& argv) {
+static Value* luv_last_error(uint32_t argc, Value* argv[]) {
assert(argc == 0);
Object* error = Object::New();
uv_err_t err = uv_last_error(uv_default_loop());
View
@@ -15,7 +15,7 @@ static void luv_on_close(uv_handle_t* handle) {
}
}
-static Value* luv_close(uint32_t argc, Arguments& argv) {
+static Value* luv_close(uint32_t argc, Value* argv[]) {
assert(argc >= 1 && argc <= 2);
Object* obj = argv[0]->As<Object>();
uv_handle_t* handle = (uv_handle_t*)obj->Get("cdata")->As<CData>()->GetContents();
View
@@ -19,7 +19,7 @@ static void luv_on_shutdown(uv_shutdown_t* req, int status) {
delete req;
}
-static Value* luv_shutdown(uint32_t argc, Arguments& argv) {
+static Value* luv_shutdown(uint32_t argc, Value* argv[]) {
assert(argc >= 1 && argc <= 2);
Object* obj = argv[0]->As<Object>();
uv_stream_t* handle = (uv_stream_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -42,7 +42,7 @@ static void luv_on_connection(uv_stream_t* server, int status) {
}
}
-static Value* luv_listen(uint32_t argc, Arguments& argv) {
+static Value* luv_listen(uint32_t argc, Value* argv[]) {
assert(argc >= 2 && argc <= 3);
Object* obj = argv[0]->As<Object>();
uv_stream_t* handle = (uv_stream_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -54,7 +54,7 @@ static Value* luv_listen(uint32_t argc, Arguments& argv) {
return Number::NewIntegral(status);
}
-static Value* luv_accept(uint32_t argc, Arguments& argv) {
+static Value* luv_accept(uint32_t argc, Value* argv[]) {
assert(argc == 2);
Object* obj = argv[0]->As<Object>();
uv_stream_t* handle = (uv_stream_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -87,7 +87,7 @@ static void luv_on_read(uv_stream_t* stream, ssize_t nread, uv_buf_t buf) {
delete buf.base;
}
-static Value* luv_read_start(uint32_t argc, Arguments& argv) {
+static Value* luv_read_start(uint32_t argc, Value* argv[]) {
assert(argc >= 1 && argc <= 2);
Object* obj = argv[0]->As<Object>();
uv_stream_t* handle = (uv_stream_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -98,7 +98,7 @@ static Value* luv_read_start(uint32_t argc, Arguments& argv) {
return Number::NewIntegral(status);
}
-static Value* luv_read_stop(uint32_t argc, Arguments& argv) {
+static Value* luv_read_stop(uint32_t argc, Value* argv[]) {
assert(argc == 1);
Object* obj = argv[0]->As<Object>();
uv_stream_t* handle = (uv_stream_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -118,7 +118,7 @@ static void luv_on_write(uv_write_t* req, int status) {
// }
}
-static Value* luv_write(uint32_t argc, Arguments& argv) {
+static Value* luv_write(uint32_t argc, Value* argv[]) {
assert(argc >= 2 && argc <= 3);
Object* obj = argv[0]->As<Object>();
uv_stream_t* handle = (uv_stream_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -138,7 +138,7 @@ static Value* luv_write(uint32_t argc, Arguments& argv) {
return Number::NewIntegral(status);
}
-static Value* luv_is_readable(uint32_t argc, Arguments& argv) {
+static Value* luv_is_readable(uint32_t argc, Value* argv[]) {
assert(argc == 1);
Object* obj = argv[0]->As<Object>();
uv_stream_t* handle = (uv_stream_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -147,7 +147,7 @@ static Value* luv_is_readable(uint32_t argc, Arguments& argv) {
Boolean::False();
}
-static Value* luv_is_writable(uint32_t argc, Arguments& argv) {
+static Value* luv_is_writable(uint32_t argc, Value* argv[]) {
assert(argc == 1);
Object* obj = argv[0]->As<Object>();
uv_stream_t* handle = (uv_stream_t*)obj->Get("cdata")->As<CData>()->GetContents();
View
@@ -24,7 +24,7 @@ using namespace candor;
using namespace candor;
-static Value* luv_create_tcp(uint32_t argc, Arguments& argv) {
+static Value* luv_create_tcp(uint32_t argc, Value* argv[]) {
assert(argc == 0);
Object* obj = uv_tcp_prototype()->Clone();
CData* cdata = CData::New(sizeof(uv_tcp_t));
@@ -35,7 +35,7 @@ static Value* luv_create_tcp(uint32_t argc, Arguments& argv) {
return obj;
}
-static Value* luv_tcp_nodelay(uint32_t argc, Arguments& argv) {
+static Value* luv_tcp_nodelay(uint32_t argc, Value* argv[]) {
assert(argc == 2);
Object* obj = argv[0]->As<Object>();
uv_tcp_t* handle = (uv_tcp_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -44,7 +44,7 @@ static Value* luv_tcp_nodelay(uint32_t argc, Arguments& argv) {
return Number::NewIntegral(status);
}
-static Value* luv_tcp_keepalive(uint32_t argc, Arguments& argv) {
+static Value* luv_tcp_keepalive(uint32_t argc, Value* argv[]) {
assert(argc == 3);
Object* obj = argv[0]->As<Object>();
uv_tcp_t* handle = (uv_tcp_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -54,7 +54,7 @@ static Value* luv_tcp_keepalive(uint32_t argc, Arguments& argv) {
return Number::NewIntegral(status);
}
-static Value* luv_tcp_bind(uint32_t argc, Arguments& argv) {
+static Value* luv_tcp_bind(uint32_t argc, Value* argv[]) {
assert(argc == 3);
Object* obj = argv[0]->As<Object>();
uv_tcp_t* handle = (uv_tcp_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -64,7 +64,7 @@ static Value* luv_tcp_bind(uint32_t argc, Arguments& argv) {
return Number::NewIntegral(status);
}
-static Value* luv_tcp_getsockname(uint32_t argc, Arguments& argv) {
+static Value* luv_tcp_getsockname(uint32_t argc, Value* argv[]) {
assert(argc == 1);
Object* obj = argv[0]->As<Object>();
uv_tcp_t* handle = (uv_tcp_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -91,7 +91,7 @@ static Value* luv_tcp_getsockname(uint32_t argc, Arguments& argv) {
return result;
}
-static Value* luv_tcp_getpeername(uint32_t argc, Arguments& argv) {
+static Value* luv_tcp_getpeername(uint32_t argc, Value* argv[]) {
assert(argc == 1);
Object* obj = argv[0]->As<Object>();
uv_tcp_t* handle = (uv_tcp_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -129,7 +129,7 @@ static void luv_on_connect(uv_connect_t* req, int status) {
delete req;
}
-static Value* luv_tcp_connect(uint32_t argc, Arguments& argv) {
+static Value* luv_tcp_connect(uint32_t argc, Value* argv[]) {
assert(argc >= 3 && argc <= 4);
Object* obj = argv[0]->As<Object>();
uv_tcp_t* handle = (uv_tcp_t*)obj->Get("cdata")->As<CData>()->GetContents();
View
@@ -8,7 +8,7 @@
using namespace candor;
-static Value* luv_create_timer(uint32_t argc, Arguments& argv) {
+static Value* luv_create_timer(uint32_t argc, Value* argv[]) {
assert(argc == 0);
Object* obj = uv_timer_prototype()->Clone();
CData* cdata = CData::New(sizeof(uv_timer_t));
@@ -29,7 +29,7 @@ static void luv_on_timer(uv_timer_t* handle, int status) {
}
}
-static Value* luv_timer_start(uint32_t argc, Arguments& argv) {
+static Value* luv_timer_start(uint32_t argc, Value* argv[]) {
assert(argc >= 3 && argc <= 4);
Object* obj = argv[0]->As<Object>();
uv_timer_t* handle = (uv_timer_t*)obj->Get("cdata")->As<CData>()->GetContents();
@@ -42,31 +42,31 @@ static Value* luv_timer_start(uint32_t argc, Arguments& argv) {
return Number::NewIntegral(status);
}
-static Value* luv_timer_stop(uint32_t argc, Arguments& argv) {
+static Value* luv_timer_stop(uint32_t argc, Value* argv[]) {
assert(argc == 1);
Object* obj = argv[0]->As<Object>();
uv_timer_t* handle = (uv_timer_t*)obj->Get("cdata")->As<CData>()->GetContents();
int status = uv_timer_stop(handle);
return Number::NewIntegral(status);
}
-static Value* luv_timer_again(uint32_t argc, Arguments& argv) {
+static Value* luv_timer_again(uint32_t argc, Value* argv[]) {
assert(argc == 1);
Object* obj = argv[0]->As<Object>();
uv_timer_t* handle = (uv_timer_t*)obj->Get("cdata")->As<CData>()->GetContents();
int status = uv_timer_again(handle);
return Number::NewIntegral(status);
}
-static Value* luv_timer_get_repeat(uint32_t argc, Arguments& argv) {
+static Value* luv_timer_get_repeat(uint32_t argc, Value* argv[]) {
assert(argc == 1);
Object* obj = argv[0]->As<Object>();
uv_timer_t* handle = (uv_timer_t*)obj->Get("cdata")->As<CData>()->GetContents();
int64_t repeat = uv_timer_get_repeat(handle);
return Number::NewIntegral(repeat);
}
-static Value* luv_timer_set_repeat(uint32_t argc, Arguments& argv) {
+static Value* luv_timer_set_repeat(uint32_t argc, Value* argv[]) {
assert(argc == 2);
Object* obj = argv[0]->As<Object>();
uv_timer_t* handle = (uv_timer_t*)obj->Get("cdata")->As<CData>()->GetContents();

0 comments on commit df85d1a

Please sign in to comment.