Application of sparse - using dmrC in Lua

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am pleased to report that I have a hello world coming out of C code,
JIT compiled via dmrC from inside Lua. Here is what the Lua script
looks like:

https://github.com/dibyendumajumdar/ravi/blob/master/ravi-tests/dmrc_test.lua

And here is another use of Sparse - this time extracting the symbols
into a Lua table.

local somecode = [[
extern int adder(int a, int b);

int adder(int a, int b)
{
return a+b;
}
]]

local symbols = dmrc.getsymbols(somecode)

table_print(symbols)

The output goes like this:

[1] => table
    (
       [1] => table
           (
              [startcol] => 17
              [endline] => 1
              [file] => buffer
              [type] => function
              [id] => 1
              [endcol] => 31
              [builtintype] => int
              [arguments] => table
                  (
                     [1] => table
                         (
                            [startcol] => 18
                            [endline] => 1
                            [file] => buffer
                            [ident] => a
                            [id] => 2
                            [endcol] => 23
                            [builtintype] => int
                            [startline] => 1
                            [alignment] => 4
                            [offset] => 0
                            [bitsize] => 32
                            [type] => node
                         )
                     [2] => table
                         (
                            [startcol] => 25
                            [endline] => 1
                            [file] => buffer
                            [ident] => b
                            [id] => 3
                            [endcol] => 30
                            [builtintype] => int
                            [startline] => 1
                            [alignment] => 4
                            [offset] => 0
                            [bitsize] => 32
                            [type] => node
                         )
                  )
              [alignment] => 4
              [offset] => 0
              [bitsize] => 32
              [startline] => 1
           )
       [startline] => 1
       [basetype] => 1
       [extern] => 1
       [toplevel] => 1
       [offset] => 0
       [bitsize] => 32
       [signed] => 1
       [endline] => 1
       [file] => buffer
       [ident] => adder
       [id] => 0
       [endcol] => 31
       [prototype] => 1
       [type] => node
       [startcol] => 12
       [addressable] => 1
       [alignment] => 4
    )

<truncated>
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux