Browse Source

Improve appendix markdown

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
488aff085b
  1. 2
      benchmark/buffer_creation.js
  2. 2
      benchmark/string_creation.js
  3. 33
      doc/api.markdown
  4. 19
      src/node_buffer.cc
  5. 1
      src/node_buffer.h

2
benchmark/buffer_creation.js

@ -1,6 +1,6 @@
for (var i = 0; i < 9000000; i++) { for (var i = 0; i < 9e7; i++) {
b = new Buffer(10); b = new Buffer(10);
b[1] = 2 b[1] = 2
} }

2
benchmark/string_creation.js

@ -1,6 +1,6 @@
for (var i = 0; i < 9000000; i++) { for (var i = 0; i < 9e7; i++) {
s = '01234567890'; s = '01234567890';
s[1] = "a"; s[1] = "a";
} }

33
doc/api.markdown

@ -3289,41 +3289,40 @@ For the moment, that is all the documentation on addons. Please see
## Appendix - Third Party Modules ## Appendix - Third Party Modules
There are many third party modules for Node. At the time of writing, August There are many third party modules for Node. At the time of writing, August
2010, the master repository of modules is the wiki page at 2010, the master repository of modules is
http://github.com/ry/node/wiki/modules[the wiki page].
http://github.com/ry/node/wiki/modules
This appendix is intended as a SMALL guide to new-comers to help them This appendix is intended as a SMALL guide to new-comers to help them
quickly find what are considered to be quality modules. It is not intended quickly find what are considered to be quality modules. It is not intended
to be a complete list. There may be better more complete modules found to be a complete list. There may be better more complete modules found
elsewhere. elsewhere.
Package System: NPM http://github.com/isaacs/npm - Module Installer: [NPM](http://github.com/isaacs/npm)
HTML Parsing: HTML5 http://github.com/aredridel/html5 - HTTP Middleware: [Connect](http://github.com/senchalabs/connect)
HTTP Middleware: Connect http://github.com/senchalabs/connect - Web Framework: [Express](http://github.com/visionmedia/express)
Web Framework: Express http://github.com/visionmedia/express - Web Sockets: [Socket.IO](http://github.com/LearnBoost/Socket.IO-node)
Web Sockets: Socket.IO http://github.com/LearnBoost/Socket.IO-node - HTML Parsing: [HTML5](http://github.com/aredridel/html5)
mDNS/Zeroconf/Bonjour: mDNS http://github.com/agnat/node_mdns - [mDNS/Zeroconf/Bonjour](http://github.com/agnat/node_mdns)
RabbitMQ, AMQP: http://github.com/ry/node-amqp - [RabbitMQ, AMQP](http://github.com/ry/node-amqp)
MySQL: http://github.com/felixge/node-mysql - [mysql](http://github.com/felixge/node-mysql)
Serialization: http://github.com/pgriess/node-msgpack - Serialization: [msgpack](http://github.com/pgriess/node-msgpack)
Scraping: http://github.com/silentrob/Apricot - Scraping: [Apricot](http://github.com/silentrob/Apricot)
Debugger: ndb http://github.com/smtlaissezfaire/ndb is a CLI debugger - Debugger: [ndb](http://github.com/smtlaissezfaire/ndb) is a CLI debugger
Node-Inspector http://github.com/dannycoates/node-inspector is a web based [inspector](http://github.com/dannycoates/node-inspector) is a web based
tool. tool.
pcap binding: http://github.com/mranney/node_pcap - [pcap binding](http://github.com/mranney/node_pcap)
ncurses: http://github.com/mscdex/node-ncurses - [ncurses](http://github.com/mscdex/node-ncurses)
Patches to this list are welcome. Patches to this list are welcome.

19
src/node_buffer.cc

@ -701,6 +701,22 @@ Handle<Value> Buffer::ByteLength(const Arguments &args) {
} }
Handle<Value> Buffer::MakeFastBuffer(const Arguments &args) {
HandleScope scope;
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
Local<Object> fast_buffer = args[1]->ToObject();;
uint32_t offset = args[2]->Uint32Value();
uint32_t length = args[3]->Uint32Value();
fast_buffer->SetIndexedPropertiesToPixelData((uint8_t*)buffer->data() + offset,
length);
return Undefined();
}
void Buffer::Initialize(Handle<Object> target) { void Buffer::Initialize(Handle<Object> target) {
HandleScope scope; HandleScope scope;
@ -731,6 +747,9 @@ void Buffer::Initialize(Handle<Object> target) {
NODE_SET_METHOD(constructor_template->GetFunction(), NODE_SET_METHOD(constructor_template->GetFunction(),
"byteLength", "byteLength",
Buffer::ByteLength); Buffer::ByteLength);
NODE_SET_METHOD(constructor_template->GetFunction(),
"makeFastBuffer",
Buffer::MakeFastBuffer);
target->Set(String::NewSymbol("Buffer"), constructor_template->GetFunction()); target->Set(String::NewSymbol("Buffer"), constructor_template->GetFunction());
} }

1
src/node_buffer.h

@ -61,6 +61,7 @@ class Buffer : public ObjectWrap {
static v8::Handle<v8::Value> AsciiWrite(const v8::Arguments &args); static v8::Handle<v8::Value> AsciiWrite(const v8::Arguments &args);
static v8::Handle<v8::Value> Utf8Write(const v8::Arguments &args); static v8::Handle<v8::Value> Utf8Write(const v8::Arguments &args);
static v8::Handle<v8::Value> ByteLength(const v8::Arguments &args); static v8::Handle<v8::Value> ByteLength(const v8::Arguments &args);
static v8::Handle<v8::Value> MakeFastBuffer(const v8::Arguments &args);
static v8::Handle<v8::Value> Unpack(const v8::Arguments &args); static v8::Handle<v8::Value> Unpack(const v8::Arguments &args);
static v8::Handle<v8::Value> Copy(const v8::Arguments &args); static v8::Handle<v8::Value> Copy(const v8::Arguments &args);

Loading…
Cancel
Save