├── boot
├── .gitignore
├── support
│ ├── winboot.rc
│ ├── titanium.ico
│ └── common_controls.manifest
├── popup_dialog_win32.h
└── boot.h
├── site_scons
├── .gitignore
└── site_init.py
├── libkroll
├── .gitignore
├── binding
│ ├── klist.h
│ ├── read_event.h
│ ├── read_event.cpp
│ ├── void_ptr.h
│ ├── k_accessor_object.h
│ ├── k_accessor_list.h
│ ├── k_accessor_method.h
│ ├── global_object.h
│ ├── k_accessor_list.cpp
│ ├── profiled_global_object.h
│ ├── k_accessor_object.cpp
│ ├── k_accessor_method.cpp
│ ├── k_function_ptr_method.cpp
│ ├── global_object.cpp
│ ├── static_bound_method.cpp
│ ├── stream.h
│ ├── value_exception.h
│ ├── k_function_ptr_method.h
│ ├── stream.cpp
│ ├── binding.h
│ ├── profiled_global_object.cpp
│ ├── profiled_bound_list.cpp
│ ├── value_exception.cpp
│ ├── profiled_bound_method.h
│ ├── profiled_bound_method.cpp
│ ├── scope_method_delegate.h
│ ├── profiled_bound_list.h
│ ├── static_bound_object.cpp
│ ├── k_delegating_object.h
│ ├── profiled_bound_object.h
│ ├── arg_list.h
│ ├── k_event_object.h
│ ├── static_bound_method.h
│ ├── event.h
│ ├── klist.cpp
│ ├── k_delegating_object.cpp
│ ├── static_bound_list.h
│ ├── k_event_method.h
│ ├── static_bound_object.h
│ ├── kmethod.h
│ ├── kmethod.cpp
│ └── scope_method_delegate.cpp
├── api
│ ├── SConscript
│ ├── api_module.cpp
│ ├── environment_binding.h
│ ├── api_module.h
│ ├── dependency_binding.h
│ ├── component_binding.h
│ ├── environment_binding.cpp
│ ├── dependency_binding.cpp
│ └── application_binding.h
├── memory
│ ├── basictypes.h
│ └── README.md
├── win32
│ ├── win32.h
│ ├── event_window.h
│ ├── com_reference_counted.h
│ ├── string_util_win.h
│ └── port.h
├── net
│ ├── net.h
│ ├── proxy_config_linux.cpp
│ └── proxy_config.h
├── osx
│ ├── nslog_channel.mm
│ └── nslog_channel.h
├── thread_manager.h
├── javascript
│ ├── SConscript
│ ├── javascript_methods.h
│ ├── javascript_module_instance.h
│ ├── k_kjs_object.h
│ ├── k_kjs_list.h
│ ├── k_kjs_method.h
│ ├── kjs_util.h
│ ├── javascript_module.h
│ ├── javascript_module.cpp
│ └── javascript_module_instance.cpp
├── utils
│ ├── data_utils.cpp
│ ├── osx
│ │ ├── data_utils_osx.mm
│ │ ├── boot_utils_osx.mm
│ │ ├── osx_utils.h
│ │ └── osx_utils.mm
│ ├── data_utils.h
│ ├── linux
│ │ ├── data_utils_linux.cpp
│ │ ├── file_utils_linux.cpp
│ │ └── boot_utils_linux.cpp
│ ├── win32
│ │ ├── data_utils_win32.cpp
│ │ └── win32_utils.h
│ ├── posix
│ │ ├── posix_utils.h
│ │ └── posix_utils.cpp
│ ├── platform_utils.cpp
│ ├── environment_utils.h
│ ├── platform_utils.h
│ ├── utils.h
│ ├── kashmir
│ │ ├── devrandom.h
│ │ ├── noncopyable.h
│ │ ├── winundocrand.h
│ │ └── winrandom.h
│ ├── url_utils.h
│ └── poco
│ │ └── KDigestEngine.cpp
├── reference_counted.h
├── Interpreter.h
├── main_thread_job.h
├── ScriptController.h
├── module_provider.h
├── ScriptController.cpp
├── main_thread_job.cpp
└── kroll.h
├── .gitignore
├── tools
├── alloy
│ ├── Resources
│ │ └── index.html
│ ├── manifest
│ ├── tiapp.xml
│ └── modules
│ │ └── alloy
│ │ └── alloymodule.js
├── crlf.py
└── upload_thirdparty.py
├── modules
├── python
│ ├── python_interpreter.h
│ ├── python_api.h
│ ├── python_module_instance.h
│ ├── python_module_instance.cpp
│ ├── k_python_dict.h
│ ├── k_python_object.h
│ ├── k_python_method.h
│ ├── python_utils.h
│ ├── SConscript
│ ├── k_python_list.h
│ ├── k_python_tuple.h
│ ├── k_python_method.cpp
│ └── python_module.h
├── php
│ ├── php_api.h
│ ├── php_interpreter.h
│ ├── php_module_instance.cpp
│ ├── php_module_instance.h
│ ├── k_php_object.h
│ ├── k_php_function.h
│ ├── k_php_method.h
│ ├── k_php_list.h
│ ├── k_php_array_object.h
│ ├── SConscript
│ ├── php_utils.h
│ └── php_interpreter.cpp
├── SConscript
└── ruby
│ ├── ruby_interpreter.h
│ ├── ruby_module_instance.h
│ ├── ruby_module_instance.cpp
│ ├── ruby_utils.h
│ ├── k_ruby_object.h
│ ├── k_ruby_hash.h
│ ├── k_ruby_method.h
│ ├── SConscript
│ ├── k_ruby_list.h
│ ├── ruby_module.cpp
│ └── ruby_module.h
├── SConscript
├── SConstruct
└── SConscript.thirdparty
/boot/.gitignore:
--------------------------------------------------------------------------------
1 | *.obj
2 |
--------------------------------------------------------------------------------
/site_scons/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 |
--------------------------------------------------------------------------------
/libkroll/.gitignore:
--------------------------------------------------------------------------------
1 | *.dylib
2 | *.o
3 |
--------------------------------------------------------------------------------
/boot/support/winboot.rc:
--------------------------------------------------------------------------------
1 | IDI_ICON1 ICON "titanium.ico"
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .sconsign.dblite
2 | *.o
3 | *.os
4 | docs
5 | *.pyc
6 | thirdparty-*
7 | *.swp
8 | *.swo
9 |
--------------------------------------------------------------------------------
/boot/support/titanium.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appcelerator-archive/kroll/HEAD/boot/support/titanium.ico
--------------------------------------------------------------------------------
/libkroll/binding/klist.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appcelerator-archive/kroll/HEAD/libkroll/binding/klist.h
--------------------------------------------------------------------------------
/tools/alloy/Resources/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/site_scons/site_init.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os.path as path
3 |
4 | sys.path.append(path.join(path.abspath('.'), 'tools'))
5 | import kroll
6 |
--------------------------------------------------------------------------------
/libkroll/api/SConscript:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | from os import path
3 | Import('build env module')
4 |
5 | env.Append(CPPDEFINES=('KROLL_API_API_EXPORT', 1))
6 |
7 | build.add_thirdparty(env, 'poco')
8 | build.mark_build_target(env.SharedLibrary(
9 | path.join(module.dir, 'apimodule'), Glob('*.cpp')))
10 |
--------------------------------------------------------------------------------
/tools/alloy/manifest:
--------------------------------------------------------------------------------
1 | #appname:Alloy
2 | #version:1.0
3 | #appid:com.titaniumapp.alloy
4 | #publisher:Appcelerator
5 | #image:default_app_logo.png
6 | #url:http://titaniumapp.com
7 | #guid:be69fe4c-966b-483c-b57c-7ba4a34fbf10
8 | #desc:Alloy shell
9 | runtime:
10 | python:
11 | ruby:
12 | alloy:
13 | tiapp:
14 | #php:
15 |
--------------------------------------------------------------------------------
/tools/alloy/tiapp.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.titaniumapp.alloy
4 | Alloy
5 | 1.0
6 | Appcelerator
7 | titaniumapp.com
8 | 2009 by Appcelerator
9 |
10 |
--------------------------------------------------------------------------------
/libkroll/memory/basictypes.h:
--------------------------------------------------------------------------------
1 | // Excerpt from Chromium's base/memory/basictypes.h
2 | // Only what we need to compile the other files we extracted.
3 |
4 | // A macro to disallow the copy constructor and operator= functions
5 | // This should be used in the private: declarations for a class
6 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
7 | TypeName(const TypeName&); \
8 | void operator=(const TypeName&)
9 |
10 |
--------------------------------------------------------------------------------
/boot/support/common_controls.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/libkroll/win32/win32.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _KR_WIN32_H_
7 | #define _KR_WIN32_H_
8 | #include "event_window.h"
9 | #include "basictypes.h"
10 | #include "port.h"
11 | #include "string16.h"
12 | #include "string_util.h"
13 | #include "string_util_win.h"
14 | #include "com_reference_counted.h"
15 | #endif
16 |
17 |
--------------------------------------------------------------------------------
/libkroll/net/net.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _KR_NET_H_
7 | #define _KR_NET_H_
8 | #include
9 | #include
10 | #include
11 | namespace kroll
12 | {
13 | class Proxy;
14 | typedef SharedPtr SharedProxy;
15 | typedef SharedPtr SharedURI;
16 | }
17 | #include "proxy_config.h"
18 | #endif
19 |
20 |
--------------------------------------------------------------------------------
/libkroll/osx/nslog_channel.mm:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #include "../kroll.h"
8 |
9 | namespace kroll
10 | {
11 | NSLogChannel::NSLogChannel()
12 | : formatter("[%s] [%p] %t")
13 | {
14 | }
15 |
16 | void NSLogChannel::log(const Poco::Message& msg)
17 | {
18 | std::string text;
19 | formatter.format(msg, text);
20 | NSLog(@"%s", text.c_str());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/libkroll/thread_manager.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _KR_THREAD_MANAGER_H_
7 | #define _KR_THREAD_MANAGER_H_
8 |
9 | #ifdef OS_OSX
10 | #define START_KROLL_THREAD NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
11 | #define END_KROLL_THREAD [pool release];
12 | #else
13 | #define START_KROLL_THREAD
14 | #define END_KROLL_THREAD
15 | #endif
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/libkroll/binding/read_event.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _KR_READ_EVENT_H_
8 | #define _KR_READ_EVENT_H_
9 |
10 | namespace kroll
11 | {
12 | class KROLL_API ReadEvent : public Event
13 | {
14 | public:
15 | ReadEvent(AutoPtr target, BytesRef);
16 | void _GetData(const ValueList&, KValueRef result);
17 |
18 | protected:
19 | BytesRef data;
20 | };
21 | }
22 | #endif
23 |
--------------------------------------------------------------------------------
/modules/python/python_interpreter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef PYTHON_EVALUATOR_H_
7 | #define PYTHON_EVALUATOR_H_
8 |
9 | #include
10 |
11 | namespace kroll {
12 |
13 | class PythonInterpreter : public Interpreter {
14 | public:
15 | PythonInterpreter();
16 |
17 | virtual KValueRef EvaluateFile(const char* filepath, KObjectRef context);
18 | };
19 |
20 | } // namespace kroll
21 |
22 | #endif
--------------------------------------------------------------------------------
/libkroll/binding/read_event.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #include "../kroll.h"
8 | namespace kroll
9 | {
10 | ReadEvent::ReadEvent(AutoPtr target, BytesRef data) :
11 | Event(target, Event::READ),
12 | data(data)
13 | {
14 | this->SetMethod("getData", &ReadEvent::_GetData);
15 | }
16 |
17 | void ReadEvent::_GetData(const ValueList&, KValueRef result)
18 | {
19 | result->SetObject(this->data);
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/libkroll/javascript/SConscript:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | from os import path
3 | Import('build env module')
4 |
5 | env.Append(CPPDEFINES=('KROLL_JAVASCRIPT_API_EXPORT', 1))
6 |
7 | build.add_thirdparty(env, 'poco')
8 |
9 | build.add_thirdparty(env, 'webkit')
10 |
11 | if build.is_win32():
12 | env.Append(LIBS=[
13 | 'kernel32', 'shell32',
14 | 'user32', 'ole32',
15 | 'comctl32', 'shlwapi',
16 | 'oleaut32', 'icuuc',
17 | 'pthreadVC2', 'kroll'])
18 | env.Append(LINKFLAGS=['/LTCG', '/INCREMENTAL:NO'])
19 |
20 | build.mark_build_target(env.SharedLibrary(
21 | path.join(module.dir, 'javascriptmodule'), Glob('*.cpp')))
22 |
--------------------------------------------------------------------------------
/libkroll/api/api_module.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #include
7 | #include
8 | #include
9 | #include "api_module.h"
10 |
11 | namespace kroll
12 | {
13 | void APIModule::Initialize()
14 | {
15 | binding = new APIBinding(host);
16 | host->GetGlobalObject()->SetObject("API", binding);
17 | }
18 |
19 | void APIModule::Stop()
20 | {
21 | host->GetGlobalObject()->Set("API", Value::Undefined);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/libkroll/utils/data_utils.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #include "utils.h"
7 | #include "poco/KDigestEngine.h"
8 | #include "poco/KMD5Engine.h"
9 |
10 | using KPoco::DigestEngine;
11 | using KPoco::MD5Engine;
12 |
13 | namespace UTILS_NS
14 | {
15 | namespace DataUtils
16 | {
17 | std::string HexMD5(std::string data)
18 | {
19 | MD5Engine engine;
20 | engine.update(data);
21 | return DigestEngine::digestToHex(engine.digest());
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/modules/php/php_api.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _PHPAPI_H_
8 | #define _PHPAPI_H_
9 |
10 | #if defined(OS_OSX) || defined(OS_LINUX)
11 | #define EXPORT __attribute__((visibility("default")))
12 | #define KROLL_PHP_API EXPORT
13 | #elif defined(OS_WIN32)
14 | # ifdef KROLL_PHP_API_EXPORT
15 | # define KROLL_PHP_API __declspec(dllexport)
16 | # else
17 | # define KROLL_PHP_API __declspec(dllimport)
18 | # endif
19 | #endif
20 |
21 | #endif /* PHPAPI_H_ */
22 |
23 |
--------------------------------------------------------------------------------
/libkroll/utils/osx/data_utils_osx.mm:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #include "../utils.h"
8 | #include "../kashmir/uuid.h"
9 | #include "../kashmir/devrandom.h"
10 | #include
11 |
12 | namespace UTILS_NS
13 | {
14 | std::string DataUtils::GenerateUUID()
15 | {
16 | kashmir::uuid_t uuid;
17 | kashmir::system::DevRandom devrandom;
18 | std::ostringstream outStream;
19 | devrandom >> uuid;
20 | outStream << uuid;
21 | return outStream.str();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/libkroll/javascript/javascript_methods.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008-2010 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _JAVASCRIPT_METHODS_H_
8 | #define _JAVASCRIPT_METHODS_H_
9 |
10 | namespace kroll
11 | {
12 | namespace JavaScriptMethods
13 | {
14 |
15 | void Bind(KObjectRef global);
16 | KValueRef SetTimeout(const ValueList& args);
17 | KValueRef SetInterval(const ValueList& args);
18 | KValueRef ClearTimeout(const ValueList& args);
19 | KValueRef ClearInterval(const ValueList& args);
20 |
21 | }
22 | }
23 | #endif
24 |
--------------------------------------------------------------------------------
/libkroll/utils/data_utils.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _KR_DATA_UTILS_H_
7 | #define _KR_DATA_UTILS_H_
8 | #include
9 | namespace UTILS_NS
10 | {
11 | namespace DataUtils
12 | {
13 | /*
14 | * @returns the hexidecimal MD5 hash of a string
15 | */
16 | KROLL_API std::string HexMD5(std::string);
17 |
18 | /**
19 | * Generate a new UUID
20 | * @returns a new UUID as a string
21 | */
22 | KROLL_API std::string GenerateUUID();
23 | }
24 | }
25 | #endif
26 |
--------------------------------------------------------------------------------
/modules/python/python_api.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef PYTHONAPI_H_
8 | #define PYTHONAPI_H_
9 |
10 | #if defined(OS_OSX) || defined(OS_LINUX)
11 | #define EXPORT __attribute__((visibility("default")))
12 | #define KROLL_PYTHON_API EXPORT
13 | #elif defined(OS_WIN32)
14 | # ifdef KROLL_PYTHON_API_EXPORT
15 | # define KROLL_PYTHON_API __declspec(dllexport)
16 | # else
17 | # define KROLL_PYTHON_API __declspec(dllimport)
18 | # endif
19 | #endif
20 |
21 | #endif /* PYTHONAPI_H_ */
22 |
--------------------------------------------------------------------------------
/libkroll/utils/linux/data_utils_linux.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #include "../utils.h"
8 | #include "../kashmir/uuid.h"
9 | #include "../kashmir/devrandom.h"
10 | #include
11 |
12 | namespace UTILS_NS
13 | {
14 | namespace DataUtils
15 | {
16 | std::string GenerateUUID()
17 | {
18 | kashmir::uuid_t uuid;
19 | kashmir::system::DevRandom devrandom;
20 | std::ostringstream outStream;
21 | devrandom >> uuid;
22 | outStream << uuid;
23 | return outStream.str();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/libkroll/utils/win32/data_utils_win32.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #include "../utils.h"
8 | #include "../kashmir/uuid.h"
9 | #include "../kashmir/winrandom.h"
10 | #include
11 |
12 | namespace UTILS_NS
13 | {
14 | namespace DataUtils
15 | {
16 | std::string GenerateUUID()
17 | {
18 | kashmir::uuid_t uuid;
19 | kashmir::system::WinRandom devrandom;
20 | std::ostringstream outStream;
21 | devrandom >> uuid;
22 | outStream << uuid;
23 | return outStream.str();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/modules/php/php_interpreter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _PHP_INTERPRETER_H_
8 | #define _PHP_INTERPRETER_H_
9 |
10 | #include
11 |
12 | namespace kroll {
13 |
14 | class PHPInterpreter : public Interpreter {
15 | public:
16 | PHPInterpreter();
17 |
18 | KValueRef EvaluateFile(const char* filepath, KObjectRef context);
19 |
20 | private:
21 | std::string CreateContextName();
22 | void FillGet(Poco::URI& uri TSRMLS_DC);
23 | };
24 |
25 | } // namespace kroll
26 |
27 | #endif
--------------------------------------------------------------------------------
/modules/php/php_module_instance.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #include "php_module_instance.h"
7 |
8 | namespace kroll
9 | {
10 | PHPModuleInstance::PHPModuleInstance(Host* host, std::string path, std::string dir, std::string name) :
11 | Module(host, dir.c_str(), name.c_str(), "0.1"),
12 | path(path)
13 | {
14 | }
15 |
16 | PHPModuleInstance::~PHPModuleInstance()
17 | {
18 | }
19 |
20 | void PHPModuleInstance::Initialize ()
21 | {
22 | }
23 |
24 | void PHPModuleInstance::Destroy ()
25 | {
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/tools/crlf.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python
2 | "Replace CRLF with LF in argument files. Print names of changed files."
3 |
4 | import sys, os
5 |
6 | def main():
7 | for filename in sys.argv[1:]:
8 | if os.path.isdir(filename):
9 | print filename, "Directory!"
10 | continue
11 | data = open(filename, "rb").read()
12 | if '\0' in data:
13 | print filename, "Binary!"
14 | continue
15 | newdata = data.replace("\r\n", "\n")
16 | if newdata != data:
17 | print filename
18 | f = open(filename, "wb")
19 | f.write(newdata)
20 | f.close()
21 |
22 | if __name__ == '__main__':
23 | main()
24 |
--------------------------------------------------------------------------------
/libkroll/utils/posix/posix_utils.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009-2010 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _KR_POSIX_UTILS_H_
7 | #define _KR_POSIX_UTILS_H_
8 | #include
9 | namespace UTILS_NS
10 | {
11 | KROLL_API std::wstring UTF8ToWide(const std::string& in);
12 | KROLL_API std::wstring UTF8ToWide(const char* in);
13 | KROLL_API std::string WideToUTF8(const std::wstring& in);
14 | KROLL_API std::string WideToUTF8(const wchar_t* in);
15 | KROLL_API std::string UTF8ToSystem(const std::string& in);
16 | KROLL_API std::string UTF8ToSystem(const char* in);
17 | }
18 | #endif
19 |
--------------------------------------------------------------------------------
/modules/SConscript:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | from os import path
3 | from kroll import Module
4 | Import('build')
5 |
6 | def build_module_from_directory(dir):
7 | name = dir.lower().replace('.', '')
8 | module = Module(name, build.version, path.join(build.dir, 'modules', name))
9 | build.modules.append(module)
10 |
11 | env = build.env.Clone()
12 | env.Append(CPPDEFINES=[('MODULE_NAME', name), ('MODULE_VERSION', build.version)])
13 |
14 | SConscript(
15 | path.join(dir, 'SConscript'),
16 | variant_dir=path.join(build.dir, 'objs', 'modules', name),
17 | exports='build module env',
18 | duplicate=0)
19 |
20 | Export('build_module_from_directory')
21 | for dir in ['python', 'ruby', 'php']:
22 | build_module_from_directory(dir)
23 |
--------------------------------------------------------------------------------
/libkroll/binding/void_ptr.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _KR_VOID_PTR_OBJECT_H_
8 | #define _KR_VOID_PTR_OBJECT_H_
9 |
10 | #include "../kroll.h"
11 |
12 | namespace kroll
13 | {
14 | /**
15 | * An object that represents an arbitrary amount of binary data§
16 | */
17 | class KROLL_API VoidPtr : public StaticBoundObject
18 | {
19 | public:
20 | VoidPtr(void* pointer) :
21 | StaticBoundObject("VoidPtr"),
22 | pointer(pointer) {}
23 | void* GetPtr() { return pointer; }
24 |
25 | private:
26 | void* pointer;
27 | };
28 | }
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/libkroll/osx/nslog_channel.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _KROLL_OSX_NSLOG_CHANNEL_
8 | #define _KROLL_OSX_NSLOG_CHANNEL_
9 |
10 | #include
11 | #include
12 | #include "Poco/Mutex.h"
13 | //#include "Poco/UnWindows.h"
14 |
15 | namespace kroll
16 | {
17 | class NSLogChannel : public Poco::Channel
18 | {
19 | public:
20 | NSLogChannel();
21 | void log(const Poco::Message& msg);
22 |
23 | protected:
24 | ~NSLogChannel() {};
25 |
26 | private:
27 | Poco::PatternFormatter formatter;
28 | };
29 | }
30 | #endif
31 |
--------------------------------------------------------------------------------
/modules/ruby/ruby_interpreter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _RUBY_INTERPRETER_H_
8 | #define _RUBY_INTERPRETER_H_
9 |
10 | #include
11 |
12 | namespace kroll {
13 |
14 | class RubyInterpreter : public Interpreter {
15 | public:
16 | RubyInterpreter();
17 |
18 | KValueRef EvaluateFile(const char* filepath, KObjectRef context);
19 |
20 | private:
21 | std::string GetContextId(KObjectRef global);
22 | VALUE GetContext(KObjectRef global);
23 | void ContextToGlobal(VALUE ctx, KObjectRef o);
24 | };
25 |
26 | } // namespace kroll
27 |
28 | #endif
--------------------------------------------------------------------------------
/libkroll/api/environment_binding.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _ENVIRONMENT_BINDING_H_
7 | #define _ENVIRONMENT_BINDING_H_
8 |
9 | #include
10 |
11 | namespace kroll
12 | {
13 | class EnvironmentBinding : public KObject
14 | {
15 | public:
16 | EnvironmentBinding() : KObject("API.Environment") {}
17 |
18 | virtual KValueRef Get(const char *name);
19 | virtual SharedStringList GetPropertyNames();
20 | virtual void Set(const char *name, KValueRef value);
21 | virtual SharedString DisplayString(int levels=3);
22 | };
23 | }
24 |
25 | #endif
26 |
27 |
--------------------------------------------------------------------------------
/modules/php/php_module_instance.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _PHP_MODULE_INSTANCE_H_
7 | #define _PHP_MODULE_INSTANCE_H_
8 |
9 | #include "php_module.h"
10 |
11 | namespace kroll
12 | {
13 | class PHPModuleInstance : public Module
14 | {
15 | public:
16 | PHPModuleInstance(Host *host, std::string path, std::string dir, std::string name);
17 | void Initialize();
18 | void Destroy();
19 |
20 | protected:
21 | virtual ~PHPModuleInstance();
22 |
23 | private:
24 | std::string path;
25 | DISALLOW_EVIL_CONSTRUCTORS(PHPModuleInstance);
26 | };
27 | }
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/libkroll/api/api_module.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _API_PLUGIN_H
7 | #define _API_PLUGIN_H
8 |
9 | #include
10 | #include "api_binding.h"
11 |
12 | namespace kroll
13 | {
14 | class KROLL_API APIModule : public Module
15 | {
16 | public:
17 | APIModule(Host* host, const char* path) :
18 | Module(host, path, STRING(MODULE_NAME), STRING(MODULE_VERSION))
19 | {
20 |
21 | }
22 |
23 | ~APIModule()
24 | {
25 |
26 | }
27 |
28 | void Initialize();
29 | void Stop();
30 |
31 | protected:
32 | AutoPtr binding;
33 | };
34 | }
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/modules/ruby/ruby_module_instance.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _RUBY_MODULE_INSTANCE_H
7 | #define _RUBY_MODULE_INSTANCE_H
8 |
9 | #include "ruby_module.h"
10 |
11 | namespace kroll
12 | {
13 | class RubyModuleInstance : public Module
14 | {
15 | public:
16 | RubyModuleInstance(Host *host, std::string path, std::string dir, std::string name);
17 | protected:
18 | virtual ~RubyModuleInstance();
19 | public:
20 | void Initialize ();
21 | void Destroy ();
22 | private:
23 | std::string path;
24 | DISALLOW_EVIL_CONSTRUCTORS(RubyModuleInstance);
25 | };
26 | }
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/libkroll/binding/k_accessor_object.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008, 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _KR_ACCESSOR_BOUND_OBJECT_H_
8 | #define _KR_ACCESSOR_BOUND_OBJECT_H_
9 |
10 | namespace kroll
11 | {
12 | class KROLL_API KAccessorObject : public StaticBoundObject, public KAccessor
13 | {
14 | public:
15 | KAccessorObject(const char* name = "KAccessorObject");
16 | virtual void Set(const char* name, KValueRef value);
17 | virtual KValueRef Get(const char* name);
18 | virtual bool HasProperty(const char* name);
19 |
20 | private:
21 | DISALLOW_EVIL_CONSTRUCTORS(KAccessorObject);
22 | };
23 | }
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/libkroll/javascript/javascript_module_instance.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _JAVASCRIPT_MODULE_INSTANCE_H_
7 | #define _JAVASCRIPT_MODULE_INSTANCE_H_
8 |
9 | namespace kroll
10 | {
11 | class KROLL_API JavaScriptModuleInstance : public Module
12 | {
13 | public:
14 | JavaScriptModuleInstance(Host *host, std::string path,
15 | std::string dir, std::string name);
16 | void Initialize () {}
17 | void Stop();
18 | void Run();
19 | static void GarbageCollect();
20 |
21 | protected:
22 | std::string path;
23 | JSGlobalContextRef context;
24 | JSObjectRef global;
25 | };
26 | }
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/modules/python/python_module_instance.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _PYTHON_MODULE_INSTANCE_H
7 | #define _PYTHON_MODULE_INSTANCE_H
8 |
9 | #include "python_module.h"
10 |
11 | namespace kroll
12 | {
13 | class PythonModuleInstance : public Module
14 | {
15 | public:
16 | PythonModuleInstance(Host *host, std::string path, std::string dir, std::string name);
17 | protected:
18 | virtual ~PythonModuleInstance();
19 | public:
20 | void Initialize ();
21 | void Destroy ();
22 | private:
23 | std::string path;
24 | DISALLOW_EVIL_CONSTRUCTORS(PythonModuleInstance);
25 | };
26 | }
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/libkroll/memory/README.md:
--------------------------------------------------------------------------------
1 | Memory Management Helpers
2 | =========================
3 | A collection of memory management helper classes
4 | derived from Chromium base/memory.
5 |
6 | scoped_ptr
7 | ----------
8 | Scopers help you manage ownership of a pointer, helping you easily manage the
9 | a pointer within a scope, and automatically destroying the pointer at the
10 | end of a scope. There are two main classes you will use, which correspond
11 | to the operators new/delete and new[]/delete[].
12 |
13 | Should be used when ownership is linked to a single object or function.
14 |
15 | Example:
16 | ``` C++
17 | // Pointer is released once foo goes out of scope.
18 | scoped_ptr foo(new Foo("wee"));
19 | ```
20 |
21 | Credit
22 | ------
23 | Thanks to the Chromium project!
24 |
25 | http://www.chromium.org/
26 |
27 |
--------------------------------------------------------------------------------
/SConscript:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # --Common SConscripts--
3 | # Things below here will be shared between Kroll and
4 | # any parent builds (ie Titanium) -- so basically no
5 | # Kroll-specific stuff below here
6 | import os.path as path
7 | Import('build')
8 | Import('debug')
9 |
10 | SConscript('boot/SConscript', variant_dir=path.join(build.dir, 'objs', 'boot'), duplicate=0)
11 | SConscript('libkroll/SConscript', variant_dir=path.join(build.dir,'objs','libkroll'), duplicate=0)
12 |
13 | # Now that libkroll is built add it as a default for
14 | # all the following build steps. This means that things
15 | # that should not depend on libkroll should be built
16 | # before here.
17 | build.env.Append(LIBS=['khost'])
18 | build.env.Append(LIBPATH=[build.runtime_build_dir])
19 |
20 | SConscript('modules/SConscript')
21 |
--------------------------------------------------------------------------------
/modules/ruby/ruby_module_instance.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #include "ruby_module_instance.h"
7 |
8 | namespace kroll
9 | {
10 | // TODO: Implement real method metadata and lifecycle events for
11 | // scripting language-based modules
12 | RubyModuleInstance::RubyModuleInstance(Host* host, std::string path, std::string dir, std::string name) :
13 | Module(host, dir.c_str(), name.c_str(), "0.1"), path(path)
14 | {
15 | }
16 |
17 | RubyModuleInstance::~RubyModuleInstance()
18 | {
19 | }
20 |
21 | void RubyModuleInstance::Initialize ()
22 | {
23 | }
24 |
25 | void RubyModuleInstance::Destroy ()
26 | {
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/modules/python/python_module_instance.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #include "python_module_instance.h"
7 |
8 | namespace kroll
9 | {
10 | // TODO: Implement real method metadata and lifecycle events for
11 | // scripting language-based modules
12 | PythonModuleInstance::PythonModuleInstance(Host *host, std::string path, std::string dir, std::string name) :
13 | Module(host, dir.c_str(), name.c_str(), "0.1"),
14 | path(path)
15 | {
16 | }
17 |
18 | PythonModuleInstance::~PythonModuleInstance()
19 | {
20 | }
21 |
22 | void PythonModuleInstance::Initialize ()
23 | {
24 | }
25 |
26 | void PythonModuleInstance::Destroy ()
27 | {
28 | }
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/modules/python/k_python_dict.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _K_PYTHON_DICT_H_
8 | #define _K_PYTHON_DICT_H_
9 |
10 | #include "python_module.h"
11 |
12 | namespace kroll
13 | {
14 | class KPythonDict : public KObject
15 | {
16 | public:
17 | KPythonDict(PyObject *obj);
18 | virtual ~KPythonDict();
19 |
20 | virtual void Set(const char *name, KValueRef value);
21 | virtual KValueRef Get(const char *name);
22 | virtual bool Equals(KObjectRef);
23 | virtual SharedStringList GetPropertyNames();
24 |
25 | PyObject* ToPython();
26 |
27 | private:
28 | PyObject *object;
29 | DISALLOW_EVIL_CONSTRUCTORS(KPythonDict);
30 | };
31 | }
32 | #endif
33 |
34 |
--------------------------------------------------------------------------------
/libkroll/reference_counted.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _KR_REFERENCE_COUNTED_H_
7 | #define _KR_REFERENCE_COUNTED_H_
8 |
9 | namespace kroll
10 | {
11 | class KROLL_API ReferenceCounted
12 | {
13 | private:
14 | Poco::AtomicCounter count;
15 |
16 | public:
17 | ReferenceCounted() : count(1) { }
18 | virtual ~ReferenceCounted() { }
19 |
20 | virtual void duplicate()
21 | {
22 | ++count;
23 | }
24 |
25 | virtual void release()
26 | {
27 | int value = --count;
28 | if (value <= 0) {
29 | delete this;
30 | }
31 | }
32 |
33 | virtual int referenceCount() const
34 | {
35 | return count.value();
36 | }
37 | };
38 | }
39 | #endif
40 |
--------------------------------------------------------------------------------
/libkroll/binding/k_accessor_list.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008, 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _KR_ACCESSOR_BOUND_LIST_H_
8 | #define _KR_ACCESSOR_BOUND_LIST_H_
9 |
10 | namespace kroll
11 | {
12 | /**
13 | * The KAccessorList allows you to expose getters and setters as property access.
14 | * @see KAccessorObject
15 | */
16 | class KROLL_API KAccessorList : public StaticBoundList, public KAccessor
17 | {
18 | public:
19 | KAccessorList(const char* type = "KAccessorList");
20 | virtual void Set(const char* name, KValueRef value);
21 | virtual KValueRef Get(const char* name);
22 | virtual bool HasProperty(const char* name);
23 |
24 | private:
25 | DISALLOW_EVIL_CONSTRUCTORS(KAccessorList);
26 | };
27 | }
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/modules/php/k_php_object.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _K_PHP_OBJECT_H_
7 | #define _K_PHP_OBJECT_H_
8 |
9 | namespace kroll
10 | {
11 | class KPHPObject : public KObject
12 | {
13 | public:
14 | KPHPObject(zval* object);
15 | virtual ~KPHPObject();
16 |
17 | virtual void Set(const char *name, KValueRef value);
18 | virtual KValueRef Get(const char *name);
19 | virtual SharedStringList GetPropertyNames();
20 | virtual SharedString DisplayString(int);
21 | virtual bool Equals(KObjectRef);
22 | bool PropertyExists(const char* property TSRMLS_DC);
23 | bool MethodExists(const char* methodName TSRMLS_DC);
24 | zval* ToPHP();
25 |
26 | private:
27 | zval* object;
28 |
29 | };
30 | }
31 | #endif
32 |
--------------------------------------------------------------------------------
/libkroll/binding/k_accessor_method.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008, 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _KR_ACCESSOR_BOUND_METHOD_H_
8 | #define _KR_ACCESSOR_BOUND_METHOD_H_
9 |
10 | namespace kroll
11 | {
12 | /**
13 | * The KAccessorMethod allows you to expose getters and setters as property access.
14 | * @see KAccessorObject
15 | */
16 | class KROLL_API KAccessorMethod : public StaticBoundMethod, public KAccessor
17 | {
18 | public:
19 | KAccessorMethod(MethodCallback* callback, const char* type = "KAccessorMethod");
20 | virtual void Set(const char* name, KValueRef value);
21 | virtual KValueRef Get(const char* name);
22 | virtual bool HasProperty(const char* name);
23 |
24 | private:
25 | DISALLOW_EVIL_CONSTRUCTORS(KAccessorMethod);
26 | };
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libkroll/binding/global_object.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _KR_GLOBAL_OBJECT_H_
8 | #define _KR_GLOBAL_OBJECT_H_
9 |
10 | namespace kroll
11 | {
12 | class KROLL_API GlobalObject : public KEventObject
13 | {
14 | public:
15 | GlobalObject();
16 | ~GlobalObject();
17 | static void TurnOnProfiling();
18 |
19 | inline static AutoPtr GetInstance()
20 | {
21 | return GlobalObject::instance;
22 | }
23 |
24 | inline static void Initialize()
25 | {
26 | instance = new GlobalObject();
27 | }
28 |
29 | private:
30 | static AutoPtr instance;
31 |
32 | void GetVersion(const ValueList& args, KValueRef result);
33 | void GetPlatform(const ValueList& args, KValueRef result);
34 | };
35 | }
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/libkroll/binding/k_accessor_list.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2008, 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #include "../kroll.h"
8 | #include
9 | #include
10 |
11 | namespace kroll
12 | {
13 | KAccessorList::KAccessorList(const char* type)
14 | : StaticBoundList(type)
15 | {
16 | }
17 |
18 | bool KAccessorList::HasProperty(const char* name)
19 | {
20 | return StaticBoundList::HasProperty(name) || this->HasGetterFor(name);
21 | }
22 |
23 | void KAccessorList::Set(const char* name, KValueRef value)
24 | {
25 | if (!this->UseSetter(name, value, StaticBoundList::Get(name)))
26 | StaticBoundList::Set(name, value);
27 | }
28 |
29 | KValueRef KAccessorList::Get(const char* name)
30 | {
31 | return this->UseGetter(name, StaticBoundList::Get(name));
32 | }
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/libkroll/binding/profiled_global_object.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 |
7 | #ifndef _KR_PROFILED_GLOBAL_OBJECT_H_
8 | #define _KR_PROFILED_GLOBAL_OBJECT_H_
9 |
10 | namespace kroll
11 | {
12 | class KROLL_API ProfiledGlobalObject : public GlobalObject
13 | {
14 | public:
15 | ProfiledGlobalObject(KObjectRef delegate);
16 | virtual ~ProfiledGlobalObject();
17 |
18 | virtual void Set(const char *name, KValueRef value);
19 | virtual KValueRef Get(const char *name);
20 | virtual SharedStringList GetPropertyNames();
21 | virtual SharedString DisplayString(int levels=3);
22 | virtual bool Equals(KObjectRef other);
23 | bool HasProperty(const char* name);
24 |
25 | protected:
26 | AutoPtr profiledObject;
27 | };
28 | }
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/libkroll/Interpreter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2011 Appcelerator, Inc. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef Interpreter_h
18 | #define Interpreter_h
19 |
20 | namespace kroll {
21 |
22 | class Interpreter {
23 | public:
24 | virtual KValueRef EvaluateFile(const char* filepath, KObjectRef context) = 0;
25 | };
26 |
27 | } // namespace kroll
28 |
29 | #endif
--------------------------------------------------------------------------------
/libkroll/api/dependency_binding.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Appcelerator Kroll - licensed under the Apache Public License 2
3 | * see LICENSE in the root folder for details on the license.
4 | * Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
5 | */
6 | #ifndef _DEPENDENCY_BINDING_H_
7 | #define _DEPENDENCY_BINDING_H_
8 |
9 | #include
10 | #include