Commit graph

23 commits

Author SHA1 Message Date
Felix Fietkau
fd5b522ce6 blobmsg-example: use blobmsg_get_string()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03 13:50:49 +02:00
Luka Perkov
b538c2b20e examples: fix build error
Patch fixes the following error:

error: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘void *’ [-Werror=format=]
   indent_printf(indent, "%s\n", blobmsg_data(data));

Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 13:48:30 +02:00
Felix Fietkau
8cee1e552a blobmsg_example: fix output
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03 12:56:40 +02:00
Luka Perkov
db8e7060e0 examples: use PRIu64 instead %lld when printing uint64_t values
Patch fixes build failure:

error: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘uint64_t’ [-Werror=format=]
   indent_printf(indent, "%lld\n", *(uint64_t *)data);

Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 12:53:13 +02:00
Luka Perkov
480b6c7da1 examples: add missing include
Patch fixes following build error:

error: implicit declaration of function ‘close’ [-Werror=implicit-function-declaration]
  close(cl->s.fd.fd);

Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 12:53:13 +02:00
Luka Perkov
fd3a33b7ed examples: fix linking with json-c
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 12:53:13 +02:00
Luka Perkov
b10cd1c0f6 examples: remove set but unused variable
Fixes build failure.

Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 12:53:13 +02:00
Xiongfei Guo
02ca593347 Support delete a fd event.
When you call the fd_add, it will return an object with `delete` method.
So you can delete that event if you want.

Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
Xiongfei Guo
79b56268b4 Added fd_add method for uloop lua binding.
Use uloop.fd_add like this:

    local socket = require "socket"

    udp = socket.udp()

    uloop.fd_add(
        udp, -- socket
        function( -- callback function
            ufd,    -- socket object when register the fd
            events  -- uloop events. eg. uloop.ULOOP_READ .
        )
            local words, msg_or_ip, port_or_nil = ufd:receivefrom()
            print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : '..words)
        end,
        uloop.ULOOP_READ -- event you want to listen
    )

The `examples/uloop-example.lua` show an example of this work.

Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
Felix Fietkau
460d94d6e8 blobmsg-example: fix length handling in dump_table() calls 2013-09-11 17:59:33 +02:00
Felix Fietkau
c4b79e4b54 runqueue: move completion handler from runqueue_process to runqueue_task to make it more generic
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:27:45 +02:00
Felix Fietkau
cb6c1718e7 runqueue: add a simple task queueing/completion tracking implementation
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:10:00 +02:00
Felix Fietkau
3ceb819690 ustream-example: fix container_of type errors
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:06:55 +02:00
Felix Fietkau
15ce776772 ustream-example: fix logic inversion 2012-10-23 18:00:20 +02:00
Felix Fietkau
e4027a6327 add a cmake file for the examples and add the binaries to .gitignore 2012-10-21 23:01:30 +02:00
Felix Fietkau
d3b3280055 ustream: add example code 2012-10-21 23:01:12 +02:00
Felix Fietkau
ae3bcf84e1 blobmsg-example: fix compile errors 2012-10-21 03:40:53 +02:00
Felix Fietkau
0a81131257 add an example script for the uloop lua binding 2012-09-27 13:47:46 +02:00
Felix Fietkau
b1ea9afd60 remove uhtbl-test.c, it is obsolete 2012-03-14 11:55:59 +01:00
Felix Fietkau
ff585b97c0 fix json list parsing 2011-01-30 01:13:32 +01:00
Felix Fietkau
5129bc9401 blobmsg: make arrays structually the same as tables - simplifies library user code 2011-01-29 18:00:40 +01:00
Felix Fietkau
461e986a80 remove #if 0'd debug code 2011-01-29 13:05:24 +01:00
Felix Fietkau
e82d74f898 Initial import 2010-10-13 21:29:08 +02:00