Tor Andersson
e7ba87678f
Silence harmless GCC warnings.
2021-11-05 12:59:02 +01:00
Tor Andersson
4c7f6be433
Issue #139 : Parse integers with floats to support large numbers.
...
Add a js_strtol which parses integers with bases 2..36 using simple
double precision arithmetic with no overflow checks.
2021-03-25 14:43:07 +01:00
Tor Andersson
c9d05aabba
Bug 703675: RegExp.prototype should be a regular expression object.
2021-03-10 17:29:50 +01:00
Tor Andersson
ccf7fa6c10
Bug 703457: Fix typo in uriMark definition used by encodeURI(Component).
...
Silly copy & paste error.
2021-02-03 17:44:23 +01:00
Tor Andersson
ae54eaa652
Move js_Buffer to jsi.h and fix some potential leaks.
2017-07-05 13:31:12 +02:00
Tor Andersson
a2fcfd69fe
Define built-in functions with the full name.
...
Improves error messages and stack traces.
2016-04-28 12:57:22 +02:00
Tor Andersson
3e3c382a0c
Avoid using 'unsigned int'.
...
Mixing signed and unsigned ints is just a plain headache.
2016-04-27 16:26:00 +02:00
Tor Andersson
4484271999
Fix typo in parseInt: radix was limited to 2-32 but it should be 2-36.
2016-04-19 15:36:41 +02:00
Tor Andersson
17019d29e5
Rewrite parseInt to follow spec.
...
Return NaN for invalid radixes. Return -0 for parseInt('-0').
2015-09-14 12:00:07 +02:00
Tor Andersson
40dd4a252f
Add eval op-code to implement proper 'this' binding for eval code.
2015-01-08 15:55:57 +01:00
Tor Andersson
031513b25b
Add stack traces to error objects.
...
Revert 'add context and flag argument to js_newstate' commit.
The context argument just adds clutter. The flag which was intended
for JS_DEBUG and/or JS_STRICT shouldn't be necessary.
js_newcfunction and js_newcconstructor need an extra argument, the
name of the function to use in stack traces.
2014-12-03 01:18:21 +01:00
Tor Andersson
3fe6635426
Differentiate between "global code" and "eval code" scripts.
...
Add a separate js_loadeval for "eval code" scripts, and let
js_do/loadstring create "global code" scripts.
js_newscript called with the NULL scope is equivalent to 'eval code'.
js_newscript called with the J->GE scape is equivalent to 'global code'.
js_newfunction is created with the lexical scope, i.e. 'function code'.
2014-10-27 16:12:16 +01:00
Tor Andersson
93cc0584df
Add portable strtod implementation.
...
Ignore locale problems with strtod.
2014-09-01 16:56:38 +02:00
Tor Andersson
4223434896
Fix attributes of numeric constants.
2014-03-13 14:40:55 +01:00
Tor Andersson
d366e4b852
Don't pass argc to functions. Use js_gettop instead.
2014-03-12 16:40:48 +01:00
Tor Andersson
67b33c5a86
Handle malloc failure by throwing exceptions.
2014-02-28 14:24:13 +01:00
Tor Andersson
598de57d76
Fix ToNumber from strings and parseInt and parseFloat.
...
Follow the spec more strictly, and don't rely on strtod's grammar.
GNU libc strtod accepts 0x prefixes, INF, INFINITY and much more which
we don't want, so pre-filter the string we pass to strtod.
2014-02-27 13:49:22 +01:00
Tor Andersson
70b0d8b902
Change C functions to not have a return value.
...
They should always push a return value on the JS stack.
2014-02-25 00:56:33 +01:00
Tor Andersson
c7e9ab0b05
Fix signed/unsigned comparison warnings.
2014-02-24 23:55:58 +01:00
Tor Andersson
60bde0ada4
Improve jsV_stringtonumber.
...
Tolerate leading and trailing whitespace, and hexadecimals.
Return NAN if there is trailing garbage or errors.
2014-02-11 15:26:29 +01:00
Tor Andersson
8e938724ff
Clean up for one.c compilation.
2014-02-11 13:42:25 +01:00
Tor Andersson
f4bb807071
Fix eval() return value when no arguments are passed.
2014-02-11 11:24:30 +01:00
Tor Andersson
be3ed5250c
Some cleanups.
2014-02-10 23:51:34 +01:00
Tor Andersson
b8aa34d919
JSON skeleton.
2014-02-10 13:41:28 +01:00
Tor Andersson
46dec712a7
Simplify string-buffer function API.
2014-02-10 13:17:33 +01:00
Tor Andersson
d59d0e2721
Make argc/undefined checks more resilient.
2014-02-07 15:45:08 +01:00
Tor Andersson
bc6da35e59
Add decode/encode URI functions.
2014-02-06 18:19:07 +01:00
Tor Andersson
e65764ecf9
Rename DontDelete flag to DontConf.
2014-02-06 16:03:44 +01:00
Tor Andersson
8e10640e9e
Add RegExp class (with no actual regex implementation hooked up).
2014-01-28 17:19:09 +01:00
Tor Andersson
de3aa34aed
Add Date class.
...
Missing setXXX functions.
2014-01-28 00:43:32 +01:00
Tor Andersson
4595872bb3
Move non-standard 'gc' and 'print' global functions into main.c example.
2014-01-24 16:18:55 +01:00
Tor Andersson
195816c208
Set property attributes on built-in objects and respect DontEnum.
2014-01-23 17:53:22 +01:00
Tor Andersson
3a92e13e47
Rename files and move a few functions around.
2014-01-21 13:58:32 +01:00
Tor Andersson
6c8400d872
Fix CFunction calling conventions.
...
'this' is always argument 0 (even for constructors, where it is null).
argc is the number of real arguments (not counting the 'this' object).
for (i = 1; i <= argc; ++i)
js_toXXX(J, i);
2014-01-20 23:16:07 +01:00
Tor Andersson
b262cc3673
Rename many jsR functions to jsV.
...
Danger! jsV work on values internally without the stack.
Also rearrange how C-constructors are created.
2014-01-20 17:44:56 +01:00
Tor Andersson
40a12fba0d
Split header into js.h public and jsi.h private. Start cleaning up
...
private function prefixes.
2014-01-20 16:13:09 +01:00
Tor Andersson
8aa0627557
Add Error builtin objects and exception stack.
2014-01-20 00:13:47 +01:00
Tor Andersson
fea397f56b
Implement Math object.
2014-01-19 16:18:17 +01:00
Tor Andersson
32c0c6c410
Rename jsR_numbertostring to jsR_stringfromnumber.
...
Add js_tointeger, js_toint32, js_touint32.
2014-01-19 14:55:19 +01:00
Tor Andersson
1237388b8e
More builtins. Fix prototype chains for builtin classes and prototypes.
2014-01-19 01:50:41 +01:00
Tor Andersson
a592f61f36
Implement Number and Object classes.
...
Split built-in functions into one file per class.
2014-01-18 22:04:37 +01:00
Tor Andersson
702fb1eb4a
Rename functions that push new objects on the stack.
2014-01-18 01:15:10 +01:00
Tor Andersson
704d16409f
Collect garbage.
2014-01-18 00:02:04 +01:00
Tor Andersson
81b2bb9ca4
Add constructors called with 'new' keyword.
...
Support built-in constructors that create their own objects. They get
called without a this object, which they should create and push on the
stack.
2014-01-17 22:03:35 +01:00
Tor Andersson
e431170dae
Improve stackidx function to return "undefined" for out-of-bounds accesses.
2014-01-17 21:10:54 +01:00
Tor Andersson
0d595bd6cf
Define some global functions and values.
2014-01-17 21:09:53 +01:00
Tor Andersson
f487a7db10
Set prototype internal property when creating objects.
2014-01-17 19:41:41 +01:00