<commit_before>/*
   Filename: JSDraw.cpp
   Purpose:  Javascript bindings for Engine::Draw2D
 
   Part of Engine2D

   Copyright (C) 2014 Vbitz
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
     http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

#include "JSDraw.hpp"

#include "JSMathHelper.hpp"

#include "../vendor/soil/SOIL.h"

#include "Filesystem.hpp"
#include "Draw2D.hpp"

#include "ResourceManager.hpp"

#include "Application.hpp"

#include "Scripting.hpp"
#include "Util.hpp"
#include "Config.hpp"
#include "FontSheet.hpp"
#include "GL3Buffer.hpp"

namespace Engine {
    
	namespace JsDraw {
        
        static void ReadBufferWeakCallback(const v8::WeakCallbackData<v8::Object, float>& args) {
            
            size_t byte_length =
            args.GetValue()->Get(v8::String::NewFromUtf8(args.GetIsolate(), "byteLength"))->Int32Value();
            
            args.GetIsolate()->AdjustAmountOfExternalAllocatedMemory(-static_cast<intptr_t>(byte_length));
            
            delete[] args.GetParameter();
        }
        
        v8::Persistent<v8::FunctionTemplate> colorTemplate, vertexBuffer2DTemplate;
        
        Color4f Color4fFromObject(v8::Isolate* isolate, v8::Handle<v8::Object> obj) {
            Color4f col;
            col.r = obj->Get(v8::String::NewFromUtf8(isolate, "r"))->NumberValue();
            col.g = obj->Get(v8::String::NewFromUtf8(isolate, "g"))->NumberValue();
            col.b = obj->Get(v8::String::NewFromUtf8(isolate, "b"))->NumberValue();<commit_msg>Fixed an include issue in src/spec/JSDraw.cpp<commit_after>/*
   Filename: JSDraw.cpp
   Purpose:  Javascript bindings for Engine::Draw2D
 
   Part of Engine2D

   Copyright (C) 2014 Vbitz
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
     http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

#include "../JSDraw.hpp"

#include "../JSMathHelper.hpp"

#include "../vendor/soil/SOIL.h"

#include "../Filesystem.hpp"
#include "../Draw2D.hpp"

#include "../ResourceManager.hpp"

#include "../Application.hpp"

#include "../Scripting.hpp"
#include "../Util.hpp"
#include "../Config.hpp"
#include "../FontSheet.hpp"
#include "../GL3Buffer.hpp"

namespace Engine {
    
	namespace JsDraw {
        
        static void ReadBufferWeakCallback(const v8::WeakCallbackData<v8::Object, float>& args) {
            
            size_t byte_length =
            args.GetValue()->Get(v8::String::NewFromUtf8(args.GetIsolate(), "byteLength"))->Int32Value();
            
            args.GetIsolate()->AdjustAmountOfExternalAllocatedMemory(-static_cast<intptr_t>(byte_length));
            
            delete[] args.GetParameter();
        }
        
        v8::Persistent<v8::FunctionTemplate> colorTemplate, vertexBuffer2DTemplate;
        
        Color4f Color4fFromObject(v8::Isolate* isolate, v8::Handle<v8::Object> obj) {
            Color4f col;
            col.r = obj->Get(v8::String::NewFromUtf8(isolate, "r"))->NumberValue();
            col.g = obj->Get(v8::String::NewFromUtf8(isolate, "g"))->NumberValue();
            col.b = obj->Get(v8::String::NewFromUtf8(isolate, "b"))->NumberValue();
{'fraction_non_alphanumeric': 0.12372670807453416, 'fraction_numerical': 0.01639751552795031, 'mean_word_length': 3.091463414634146, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3784798', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1201, 'n_words': 310}