And in the table, what is the difference between “varData” and “data”, “nextPtr” and “next”?
The 2nd column 'Name' is just the name of the field - it doesn't really mean anything other than being descriptive (and possibly the name of the variable)
And what does the “child” means, it is firstChild?
Some variable types have just a single child. See jsvHasSingleChild
In the function, jsvLock(pinName) uses jsvGetAddressOf(pinName), and jsvGetAddressOf(pinName) just return &jsVars[ref-1]. Does it mean all variable are stored in jsVar[JSVAR_CACHE_SIZE], including local variable and global variable, like Serial1?
Yes. jswrapper may 'make' the global variable if it doesn't already exist though.
I don’t understand that “if a is a name ” . What does “a name” mean?
see 'lvalue' on wikipedia - a Name in Espruino is one of those - a variable that is a pointer to another. For instance in a = 1, 1 is not a name (it cannot be written) but a is. However, after assignment a will point to the value 1.
What is the effect of the function indeed ?
It skips the name. In the case above, 'jsvSkipName(a)' would skip over 'a' and return 1.
And what is the relationship of JsExecIfo->root and jsVar[JSVAR_CACHE_SIZE]
JsExecIfo->root is basically the value of the 'global' variable. jsVar[JSVAR_CACHE_SIZE] holds all variables, including 'global'.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
And then...
You'd have to look further into the code - look at the comments here: https://github.com/espruino/Espruino/blob/master/src/jsutils.h#L254
The 2nd column 'Name' is just the name of the field - it doesn't really mean anything other than being descriptive (and possibly the name of the variable)
Some variable types have just a single child. See
jsvHasSingleChild
Yes. jswrapper may 'make' the global variable if it doesn't already exist though.
see 'lvalue' on wikipedia - a Name in Espruino is one of those - a variable that is a pointer to another. For instance in
a = 1
,1
is not a name (it cannot be written) buta
is. However, after assignmenta
will point to the value1
.It skips the name. In the case above, 'jsvSkipName(a)' would skip over 'a' and return 1.
JsExecIfo->root is basically the value of the 'global' variable. jsVar[JSVAR_CACHE_SIZE] holds all variables, including 'global'.