Linux SPARSE checker discussions
 help / color / mirror / Atom feed
* Application of sparse - using dmrC in Lua
@ 2017-06-17 16:59 Dibyendu Majumdar
  2017-06-17 19:15 ` Luc Van Oostenryck
  0 siblings, 1 reply; 2+ messages in thread
From: Dibyendu Majumdar @ 2017-06-17 16:59 UTC (permalink / raw)
  To: Linux-Sparse

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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Application of sparse - using dmrC in Lua
  2017-06-17 16:59 Application of sparse - using dmrC in Lua Dibyendu Majumdar
@ 2017-06-17 19:15 ` Luc Van Oostenryck
  0 siblings, 0 replies; 2+ messages in thread
From: Luc Van Oostenryck @ 2017-06-17 19:15 UTC (permalink / raw)
  To: Dibyendu Majumdar; +Cc: Linux-Sparse

On Sat, Jun 17, 2017 at 05:59:05PM +0100, Dibyendu Majumdar wrote:
> Hi,
> 
> I am pleased to report that I have a hello world coming out of C code,
> JIT compiled via dmrC from inside Lua.

Congrats!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-17 19:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-17 16:59 Application of sparse - using dmrC in Lua Dibyendu Majumdar
2017-06-17 19:15 ` Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox