| 1 |
#ifndef _42TinyJS_config_h__ |
| 2 |
#define _42TinyJS_config_h__ |
| 3 |
|
| 4 |
/* |
| 5 |
* 42TinyJS |
| 6 |
* |
| 7 |
* A fork of TinyJS with the goal to makes a more JavaScript/ECMA compliant engine |
| 8 |
* |
| 9 |
* Authored By Armin Diedering <armin@diedering.de> |
| 10 |
* |
| 11 |
* Copyright (C) 2010-2013 ardisoft |
| 12 |
* |
| 13 |
* |
| 14 |
* Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 15 |
* this software and associated documentation files (the "Software"), to deal in |
| 16 |
* the Software without restriction, including without limitation the rights to |
| 17 |
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 18 |
* of the Software, and to permit persons to whom the Software is furnished to do |
| 19 |
* so, subject to the following conditions: |
| 20 |
|
| 21 |
* The above copyright notice and this permission notice shall be included in all |
| 22 |
* copies or substantial portions of the Software. |
| 23 |
|
| 24 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 25 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 26 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 27 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 28 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 29 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 30 |
* SOFTWARE. |
| 31 |
*/ |
| 32 |
|
| 33 |
////////////////////////////////////////////////////////////////////////// |
| 34 |
|
| 35 |
/* POOL-ALLOCATOR |
| 36 |
* ============== |
| 37 |
* To speed-up new & delete 42TinyJS adds an object-pool |
| 38 |
* The pool is activated by default. |
| 39 |
* To deactivate this stuff define NO_POOL_ALLOCATOR |
| 40 |
*/ |
| 41 |
//#define NO_POOL_ALLOCATOR |
| 42 |
|
| 43 |
/* |
| 44 |
* for debugging-stuff you can define DEBUG_POOL_ALLOCATOR |
| 45 |
* if a memory-leak detected the allocator usage is printed to stderr |
| 46 |
*/ |
| 47 |
//#define DEBUG_POOL_ALLOCATOR |
| 48 |
/* |
| 49 |
* with define LOG_POOL_ALLOCATOR_MEMORY_USAGE |
| 50 |
* the allocator usage is always printed to stderr |
| 51 |
*/ |
| 52 |
//#define LOG_POOL_ALLOCATOR_MEMORY_USAGE |
| 53 |
|
| 54 |
// NOTE: _DEBUG or LOG_POOL_ALLOCATOR_MEMORY_USAGE implies DEBUG_POOL_ALLOCATOR |
| 55 |
|
| 56 |
////////////////////////////////////////////////////////////////////////// |
| 57 |
|
| 58 |
/* REGEXP-SUPPORT |
| 59 |
* ============== |
| 60 |
* The RegExp-support needs boost-regex or TR1-regex |
| 61 |
* To deactivate this stuff define NO_REGEXP |
| 62 |
*/ |
| 63 |
//#define NO_REGEXP |
| 64 |
|
| 65 |
/* if NO_REGEXP not defined <regex> is included and std::regex is used |
| 66 |
* you can define HAVE_BOOST_REGEX and <boost/regex.hpp> is included and boost::regex is used |
| 67 |
*/ |
| 68 |
#define HAVE_BOOST_REGEX |
| 69 |
|
| 70 |
/* or you can define HAVE_TR1_REGEX and <tr1/regex> is included and std::tr1::regex is used |
| 71 |
*/ |
| 72 |
//#define HAVE_TR1_REGEX |
| 73 |
|
| 74 |
|
| 75 |
////////////////////////////////////////////////////////////////////////// |
| 76 |
|
| 77 |
/* LET-STUFF |
| 78 |
* ========= |
| 79 |
* Redeclaration of LET-vars is not allowed in block-scopes. |
| 80 |
* But in the root- and functions-scopes it is currently allowed |
| 81 |
* In future ECMAScript versions this will be also in root-and functions-scopes forbidden |
| 82 |
* To enable the future behavior define PREVENT_REDECLARATION_IN_FUNCTION_SCOPES |
| 83 |
*/ |
| 84 |
//#define PREVENT_REDECLARATION_IN_FUNCTION_SCOPES |
| 85 |
|
| 86 |
|
| 87 |
////////////////////////////////////////////////////////////////////////// |
| 88 |
|
| 89 |
/* MULTI-THREADING |
| 90 |
* =============== |
| 91 |
* 42TinyJS is basically thread-save. |
| 92 |
* You can run different or the same JS-code simultaneously in different instances of class TinyJS. |
| 93 |
* The threading-stuff is currently only needed by the pool-allocator |
| 94 |
* to deactivate threading define NO_THREADING |
| 95 |
* NOTE: if NO_POOL_ALLOCATOR not defined you can not run JS-code simultaneously |
| 96 |
* NO_POOL_ALLOCATOR implies NO_THREADING |
| 97 |
*/ |
| 98 |
|
| 99 |
//#define NO_THREADING |
| 100 |
|
| 101 |
/* on Windows the windows-threading-API is used by default. |
| 102 |
* on non-Windows (WIN32 is not defined) it is tried to use the POSIX pthread-API |
| 103 |
* to force the pthread-API define HAVE_PTHREAD (windows needs in this case |
| 104 |
* a pthread-lib e.g http://http://sourceware.org/pthreads-win32/) |
| 105 |
*/ |
| 106 |
//#define HAVE_PTHREAD |
| 107 |
|
| 108 |
/* you can implement your own custom thread-implementation. |
| 109 |
* to prevent the using of the win- or pthread-API define HAVE_CUSTOM_THREADING_IMPL |
| 110 |
*/ |
| 111 |
//#define HAVE_CUSTOM_THREADING_IMPL |
| 112 |
|
| 113 |
//////////////////////////////////////////////// |
| 114 |
// DO NOT MAKE CHANGES OF THE FOLLOWING STUFF // |
| 115 |
//////////////////////////////////////////////// |
| 116 |
|
| 117 |
#if defined(NO_POOL_ALLOCATOR) && !defined(NO_THREADING) |
| 118 |
# define NO_THREADING |
| 119 |
#endif |
| 120 |
|
| 121 |
#if !defined(NO_POOL_ALLOCATOR) && defined(NO_THREADING) |
| 122 |
#pragma message("\n***********************************************************************\n\ |
| 123 |
* You have defined NO_THREADING and not defined NO_POOL_ALLOCATOR\n\ |
| 124 |
* NOTE: you can not run JS-code simultaneously in different threads\n\ |
| 125 |
***********************************************************************\n") |
| 126 |
#endif |
| 127 |
|
| 128 |
|
| 129 |
#endif // _42TinyJS_config_h__ |