Support array subscription

Support to read from c array subscription and write to c array
subscription, in which c array is the result of ffi.new call.

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Fix undefined-struct bug

Set ctype to be defined before inserting into ctype array.
This patch is used to make 'ffi.new("struct a[1]")' parsed successfully.

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Add new part in ffi_test.kp

The new part is to test array subscription and struct reference.

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Support struct reference

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
List csymbols when using option "-b"

Debug utility for csymbols.

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Fix the bug when creating new c pointer

The size of space to be allocated for data that it points to is
calculated wrong before, because we don't figure out the correct type
of the data.

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Fix the bug on wrong offset in struct

The align of target member should be considered when calculating its
offset in struct.

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Refactor the way to parse c struct

Originally, when struct variable is used, the struct has to be defined
before. Or it comes to the error that cannot find struct csymbol.

Now, a fake struct csymbol is created at this time, and will be
complemented when its definition appears.

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Support union type

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Support array member in struct/union declaration

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Support unnamed member in record type

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
check for array out of bound index

Signed-off-by: Qingping Hou <qingping.hou@gmail.com>
Fix the bug that cannot parse multi-level struct declaration

Indicate which part in the stack is used for the members of
current struct declaration, instead of all the stack in all cases.

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Fix the bug that cannot handle undefined struct

1. Handle dump and load of undefined struct correctly.
2. Check undefine or not before the calcuation of struct size

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Fix the incorrect conversion from TSTRING to TCDATA

TSTRING should be converted to TCDATA of c pointer which points to
the start character of the string.
support upvalue(make access local variable more faster)

To use upvlaue, all variable should add 'local' prefix, otherwise
the variable will be parsed to global variable, which make indirectly
variable accessing.

(make variable to be local defaultly in future?)
update samples scripts to use upval

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
update test scripts to use upval

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>