Browse Source

small superficial clean-ups

v0.7.4-release
Ryan 16 years ago
parent
commit
6697cd0725
  1. 1
      src/http.h
  2. 9
      src/node.cc
  3. 18
      src/node.h

1
src/http.h

@ -44,7 +44,6 @@ public:
protected:
static v8::Handle<v8::Value> New (const v8::Arguments& args);
HTTPServer (v8::Handle<v8::Object> handle,
v8::Handle<v8::Function> protocol_class,
v8::Handle<v8::Object> options)

9
src/node.cc

@ -162,7 +162,8 @@ ExecuteString(v8::Handle<v8::String> source,
return scope.Close(result);
}
NODE_METHOD(node_exit)
v8::Handle<v8::Value>
node_exit (const v8::Arguments& args)
{
int r = 0;
if (args.Length() > 0)
@ -171,7 +172,8 @@ NODE_METHOD(node_exit)
return Undefined();
}
NODE_METHOD(compile)
v8::Handle<v8::Value>
compile (const v8::Arguments& args)
{
if (args.Length() < 2)
return Undefined();
@ -186,7 +188,8 @@ NODE_METHOD(compile)
return scope.Close(result);
}
NODE_METHOD(debug)
v8::Handle<v8::Value>
debug (const v8::Arguments& args)
{
if (args.Length() < 1)
return Undefined();

18
src/node.h

@ -7,20 +7,23 @@
namespace node {
#define NODE_SYMBOL(name) v8::String::NewSymbol(name)
#define NODE_METHOD(name) v8::Handle<v8::Value> name (const v8::Arguments& args)
#define NODE_SET_METHOD(obj, name, callback) \
obj->Set(NODE_SYMBOL(name), v8::FunctionTemplate::New(callback)->GetFunction())
#define NODE_UNWRAP(type, value) static_cast<type*>(node::ObjectWrap::Unwrap(value))
#define NODE_DEFINE_CONSTANT(target, constant) \
(target)->Set(v8::String::NewSymbol(#constant), v8::Integer::New(constant))
(target)->Set(v8::String::NewSymbol(#constant), \
v8::Integer::New(constant))
#define NODE_SET_METHOD(obj, name, callback) \
obj->Set(v8::String::NewSymbol(name), \
v8::FunctionTemplate::New(callback)->GetFunction())
#define NODE_SET_PROTOTYPE_METHOD(templ, name, callback) \
do { \
Local<Signature> __callback##_SIG = Signature::New(templ); \
Local<FunctionTemplate> __callback##_TEM = \
FunctionTemplate::New(callback, Handle<Value>() , __callback##_SIG ); \
templ->PrototypeTemplate()->Set(NODE_SYMBOL(name), __callback##_TEM); \
templ->PrototypeTemplate()->Set(v8::String::NewSymbol(name), \
__callback##_TEM); \
} while(0)
enum encoding {ASCII, UTF8, RAW};
@ -47,11 +50,12 @@ protected:
* all references are lost.
*/
void Attach();
/* Detach() marks an object as detached from the event loop. This is its
* default state. When an object with a "weak" reference changes from
* attached to detached state it will be freed. Be careful not to access
* the object after making this call as it might be gone!
* (A "weak reference" is v8 terminology for an object who only has a
* (A "weak reference" is v8 terminology for an object that only has a
* persistant handle.)
*/
void Detach();

Loading…
Cancel
Save