Commit Graph

67 Commits

Author SHA1 Message Date
paulc 3aeb6687d5 Fixed a GCC 6 build error: C++11 requires a space between literal and string macro.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6084 acf43c95-373e-0410-b603-e72c3f656dc1
2016-01-20 10:23:35 +00:00
paulc d2f52af2f6 Added JS Array.lastIndexOf() method.
Fixed fromIndex behavior for indexOf() and lastIndexOf().
Added optional extra parameter to allow searching a field in an array of objects.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6050 acf43c95-373e-0410-b603-e72c3f656dc1
2015-10-01 15:15:09 +00:00
paulc f632f0b034 Added JS Object.keys() static method.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6039 acf43c95-373e-0410-b603-e72c3f656dc1
2015-09-16 17:33:28 +00:00
paulc 3a638df554 Fixed the JS Array unshift() to not crash when called with no arguments.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6025 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-31 08:06:14 +00:00
paulc 05ebe9d1f9 Added JsObject constructor that populates prototype from a context.
Added JsRegExp contructor from existing Regexp.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5873 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-22 11:02:44 +00:00
paulc a598cee5fc Added Javascript Array.isArray()
git-svn-id: http://yate.null.ro/svn/yate/trunk@5870 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-18 11:07:19 +00:00
paulc 9599d6dbb7 When evaluating naked JsObject fields wrap them in an ExpWrapper.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5867 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-11 16:24:15 +00:00
paulc cb382e02a2 Fixed assignment operation changed in Rev. 5856.
Report the ExpOperation types in Engine.print_r().


git-svn-id: http://yate.null.ro/svn/yate/trunk@5857 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-25 16:04:00 +00:00
oana 3047c9b55b Fix loss of boolean type information through assignment due to changes in commit 5854.
Do proper cloning on ExpOperation when resolving fields and do proper detection for number conversion on boolean values.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5856 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-25 14:09:32 +00:00
oana 7a41ecce69 Do proper number conversion for arithmetic operations.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5854 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-24 13:36:53 +00:00
oana e1285e0a68 Leave Javascript array data untouched if sorting fails. Slightly optimized the native sort procedure for Javascript array.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5835 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-19 15:01:29 +00:00
oana eadca3e467 Bug fix: check that we extract a valid pointer from the stack when running the compare function for Array.sort().
This avoids segmentation faults caused by a callback compare function for Array.sort() which doesn't return anything. Instead, signal a runtime error.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5833 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-16 10:40:56 +00:00
oana 06536919fe Added support for Javascript RegExp constructor from string.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5825 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-18 13:37:49 +00:00
paulc 410dd9a8c6 Fixed the type of the result of Array.indexOf(), must be number.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5812 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-01 13:25:17 +00:00
oana 63a85d3bf2 Fixed implementation of Array.splice() and Array.slice() functions.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5800 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 16:08:31 +00:00
paulc fca0d0f1d9 Fixed a memory leak in JS Array.concat(Array), wrapper object was not destroyed.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5798 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 10:35:29 +00:00
oana 3f359c0a11 Use new JsArray constructor in the implementation of Array methods.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5797 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 10:09:15 +00:00
oana 6d2de9dfc8 Bug fix: properly set prototype property on JS Array objects.
Added JsObject::setPrototype() in order to set an objects prototype from given context.
Added new JsArray constructor which set its own prototype. Replaced use of constructor which returned Array prototype with this contructor.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5796 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-13 13:10:56 +00:00
paulc b0b2021a27 Added proper constructor for JS Array object.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5789 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-26 12:25:53 +00:00
paulc 632070e047 Fixed implementation of JS Array concat() and reverse() methods.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5759 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-06 10:02:01 +00:00
paulc 5efdfb17dc Fixed JS Array.pop() and unshift()
git-svn-id: http://yate.null.ro/svn/yate/trunk@5758 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 17:22:09 +00:00
paulc 4f9ea57ca1 Fixed JS Array.shift(), was breaking non-string values.
Marked pop(), concat(), reverse(), unshift() in need of fixing.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5757 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 16:49:01 +00:00
paulc 37a72e4bc1 Added copyright notices to sources and scripts missing them.
Updated copyright notices for 2014.
Fixed end of lines in many files.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5755 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 11:42:17 +00:00
oana c8f18f9d15 Fixed compile warnings which appear when compiling with xdebug.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5642 acf43c95-373e-0410-b603-e72c3f656dc1
2013-09-09 15:26:27 +00:00
paulc 7c39b31458 Fixed warnings - mostly conversions - exposed by Visual C++ compiler.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5614 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 11:24:10 +00:00
paulc e81cbde58e More fixes related to 32 and 64 bit types usage in JS.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5613 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 10:18:23 +00:00
paulc 18ff43d395 Fixed 64 bit types usage in Javascript, was broken on 32 bit machines.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5612 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 09:49:52 +00:00
paulc c371a7037c Separated 32 and 64 bit constructors and assignments for String.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5611 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-06 15:42:44 +00:00
paulc cf5d0fd71a Changed license terms in each source file to reference an external file.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5609 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-06 13:38:10 +00:00
oana da23194709 Fix Array.pop() implementation in order to properly return objects.
Also, when building constant objects or array, set their name according to internal convention.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5585 acf43c95-373e-0410-b603-e72c3f656dc1
2013-07-17 11:02:25 +00:00
oana 8de63f495f Bug fix: don't allow enumeration of the length property in Array.
Properly handle assignments to the Array.length property: if set to a value smaller than the previous length value, destroy all objects found at indexes greater than length.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5584 acf43c95-373e-0410-b603-e72c3f656dc1
2013-07-16 13:47:17 +00:00
oana 008f6d5e67 Also update array length when assigning values through the array subscript operator.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5580 acf43c95-373e-0410-b603-e72c3f656dc1
2013-07-11 13:25:09 +00:00
marian ab173307a5 Removed not exisintg debug enabler variable from debug message.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5471 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-18 10:32:17 +00:00
paulc cbdaee13e9 Fixed a conversion on 32 bit platforms.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5470 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-17 15:55:24 +00:00
paulc 1cd5d7fccd Fixed the constructors and get... methods of Javascript Date object.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5469 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-17 15:42:40 +00:00
paulc 3b49b78ecb Added a shared static list of Atom strings and an YATOM macro.
This speeds up signifficantly the Yate RTTI on compilers that HAVE_BLOCK_RETURN.
Made the String comparison operator inline to shave off a few cycles.
Fast handle the comparison in identity case.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5449 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 13:19:14 +00:00
paulc 2f19c830c2 Store ExpOperations in JsObjects so the value type is preserved.
Automatically convert database results to numbers if possible.
Added faster method ExpOperation::typeOf()


git-svn-id: http://yate.null.ro/svn/yate/trunk@5444 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:54:30 +00:00
paulc b3c4c0c694 Added support for tracing Javascript execution in KCacheGrind format.
Fixed line counting for a possible keyword or identifier at end of line.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5439 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:46:21 +00:00
andrei 71bec128e8 Added methods:
Math.random([int min, int max]);
    Array.indexOf(Object obj [, int fromPos]);
    Array.sort([compareCallback])
    String.split(char c [,int maxResults]);
    String.startsWith(String match [, int fromPos]);
    String.endsWith(String match [, int fromPos]);
    String.toLower();
    String.toUpper();
    String.trim(); 
to JavaScript API.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5400 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-12 10:16:12 +00:00
andrei f06d62838b Added operator delete.
Bug Fix. Do not remove undefined variables from stack.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5397 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-12 09:48:29 +00:00
oana f7a0ef30ae FixedArray.join() and Array.pop() implementations. Replaced incorrect use of toString().
git-svn-id: http://yate.null.ro/svn/yate/trunk@5380 acf43c95-373e-0410-b603-e72c3f656dc1
2013-01-21 11:03:06 +00:00
paulc 84f8bacd59 Date.now() is a static function, not a member method.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5334 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-20 17:14:51 +00:00
paulc 1848fe201f Added support for calling object methods by variable.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5332 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-20 16:11:38 +00:00
paulc 81d8d5458c Fixed calling object member functions.
Fixed handling "this" in constructors.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5312 acf43c95-373e-0410-b603-e72c3f656dc1
2012-10-30 09:08:33 +00:00
paulc eaa99e2eef Improved scripting debugging.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5311 acf43c95-373e-0410-b603-e72c3f656dc1
2012-10-30 09:00:43 +00:00
paulc 8ca7c90e8a Fixed deep copying member functions of inline objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5157 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-27 14:44:05 +00:00
paulc e57c6dc740 Deep copy inline objects and arrays when placing them in a context.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5154 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-26 16:40:38 +00:00
paulc 5bbbe0ead9 Fixed the call context creation, was double wrapping the scope and this objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5152 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-26 13:31:30 +00:00
paulc 207552e4ea Fixed Array.push() method that was not copying objects correctly and not copying non-objects at all.
Added some more XDEBUG for iterators.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5149 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-25 15:41:47 +00:00
paulc 788ed299f7 Fixed parsing of { objects } as expressions.
Fixed parsing of "var" declarations.
Fixed indexing and fields of expressions.
Small improvement to speed up the simplification of large code.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5146 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-22 14:06:16 +00:00