From a30ac92b0c52ff85bff409ec0278bd42087bc4c3 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 9 Dec 2009 07:44:44 +0100 Subject: [PATCH] Remove accidentally committed files. --- src/node_binary.cc | 71 ---------------------------------------------- src/node_binary.h | 56 ------------------------------------ 2 files changed, 127 deletions(-) delete mode 100644 src/node_binary.cc delete mode 100644 src/node_binary.h diff --git a/src/node_binary.cc b/src/node_binary.cc deleted file mode 100644 index 16fbd53996..0000000000 --- a/src/node_binary.cc +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2009, Ryan Dahl . All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -#include - -namespace node { - -using namespace v8; - -static v8::Persistent byte_string_template; - -// V8 contstructor -static Handle New(const Arguments& args) { - HandleScope scope; - - // somehow create the c object. - byte_string *bs = malloc(sizeof(byte_string) + length); - - - bs->handle = v8::Persistent::New(args.This()); - bs->handle->SetInternalField(0, v8::External::New(bs)); - - return args.This(); -} - - -byte_string* byte_string_new(size_t length) -{ - byte_string_template->GetFunction()->NewInstance(); - - // unwrap handle - - return bs; -} - - - -void byte_string_init(v8::Local target) { - HandleScope scope; - - Local t = FunctionTemplate::New(New); - - byte_string_template = Persistent::New(t); - byte_string_template->InstanceTemplate()->SetInternalFieldCount(1); - // Set class name for debugging output - byte_string_template->SetClassName(String::NewSymbol("Binary")); - - NODE_SET_PROTOTYPE_METHOD(byte_string_template, "toString", ToString); - - target->Set(String::NewSymbol("Binary"), - byte_string_template->GetFunction()); -} - -} // namespace node diff --git a/src/node_binary.h b/src/node_binary.h deleted file mode 100644 index ce8268b87b..0000000000 --- a/src/node_binary.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2009, Ryan Dahl . All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -#ifndef NODE_BYTE_STRING_H_ -#define NODE_BYTE_STRING_H_ - -#include - -namespace node { - -void byte_string_init(v8::Local target); - -/* Byte string is an immutable chunk of data that can be created from C++ - * (byte_string_new()) or from Javascript (new ByteString(string, encoding)). It - * provides a means of passing data through javascript, usually from one C++ - * object (like a TCP socket) to another C++ object (like an HTTP parser). - * - * Byte strings are always destructed by the V8 GC. Do not store references - * to byte_string pointers, only create them and pass them into javascript, - * or receive them as arguments out of javascript. - */ - -typedef struct { - v8::Persistent handle; - size_t length; - char bytes[1]; -} byte_string; - -byte_string* byte_string_new(size_t length); - -byte_string* byte_string_unwrap(v8::Handle handle) { - assert(!handle.IsEmpty()); - assert(handle->InternalFieldCount() > 0); - return static_cast(v8::Handle::Cast( - handle->GetInternalField(0))->Value()); -} - -} // namespace node -#endif // NODE_BYTE_STRING_H_