Github User Fetcher 1.0.0
C Application with Server and GUI
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <sys/time.h>
#include <poll.h>
#include "duktape.h"
Go to the source code of this file.
Data Structures | |
struct | ev_timer |
Macros | |
#define | MAX_TIMERS 4096 /* this is quite excessive for embedded use, but good for testing */ |
#define | MIN_DELAY 1.0 |
#define | MIN_WAIT 1.0 |
#define | MAX_WAIT 60000.0 |
#define | MAX_EXPIRYS 10 |
#define | MAX_FDS 256 |
Functions | |
static double | get_now (void) |
static ev_timer * | find_nearest_timer (void) |
static void | bubble_last_timer (void) |
static void | expire_timers (duk_context *ctx) |
static void | compact_poll_list (void) |
int | eventloop_run (duk_context *ctx) |
static int | create_timer (duk_context *ctx) |
static int | delete_timer (duk_context *ctx) |
static int | listen_fd (duk_context *ctx) |
static int | request_exit (duk_context *ctx) |
void | eventloop_register (duk_context *ctx) |
Variables | |
static ev_timer | timer_list [MAX_TIMERS] |
static ev_timer | timer_expiring |
static int | timer_count |
static int64_t | timer_next_id = 1 |
static struct pollfd | poll_list [MAX_FDS] |
static int | poll_count = 0 |
static int | exit_requested = 0 |
static duk_function_list_entry | eventloop_funcs [] |
#define MAX_EXPIRYS 10 |
Definition at line 22 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by expire_timers().
#define MAX_FDS 256 |
Definition at line 24 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by eventloop_register(), and listen_fd().
#define MAX_TIMERS 4096 /* this is quite excessive for embedded use, but good for testing */ |
Definition at line 18 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by create_timer(), eventloop_register(), and expire_timers().
#define MAX_WAIT 60000.0 |
Definition at line 21 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by eventloop_run().
#define MIN_DELAY 1.0 |
Definition at line 19 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by create_timer().
#define MIN_WAIT 1.0 |
Definition at line 20 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by eventloop_run().
|
static |
Definition at line 81 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References ev_timer::target, timer_count, and timer_list.
Referenced by create_timer(), and expire_timers().
|
static |
Definition at line 217 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References poll_count, and poll_list.
Referenced by eventloop_run().
|
static |
Definition at line 397 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References bubble_last_timer(), ev_timer::delay, duk_dup(), DUK_ERR_RANGE_ERROR, duk_error, duk_get_prop_string(), duk_push_global_stash(), duk_push_number(), duk_put_prop(), duk_require_boolean(), duk_require_number(), get_now(), ev_timer::id, MAX_TIMERS, MIN_DELAY, ev_timer::oneshot, ev_timer::removed, ev_timer::target, timer_count, timer_list, and timer_next_id.
|
static |
Definition at line 457 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References duk_del_prop(), duk_get_prop_string(), duk_push_boolean(), duk_push_global_stash(), duk_push_number(), duk_push_true(), duk_require_number(), ev_timer::id, ev_timer::removed, timer_count, timer_expiring, and timer_list.
void eventloop_register | ( | duk_context * | ctx | ) |
Definition at line 601 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References duk_pop(), duk_push_global_object(), duk_push_global_stash(), duk_push_object(), duk_put_function_list(), duk_put_prop_string(), eventloop_funcs, MAX_FDS, MAX_TIMERS, poll_list, timer_expiring, and timer_list.
int eventloop_run | ( | duk_context * | ctx | ) |
Definition at line 257 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References compact_poll_list(), duk_dup(), duk_get_prop_string(), duk_get_top_index(), duk_pcall_method(), duk_pop(), duk_pop_n(), duk_push_global_object(), duk_push_int(), duk_to_string(), exit_requested, expire_timers(), find_nearest_timer(), get_now(), MAX_WAIT, MIN_WAIT, poll_count, poll_list, and ev_timer::target.
|
static |
Definition at line 104 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References bubble_last_timer(), duk_del_prop(), DUK_ERR_RANGE_ERROR, duk_error, duk_get_prop(), duk_get_prop_string(), duk_pcall(), duk_pop(), duk_pop_2(), duk_push_global_stash(), duk_push_number(), duk_to_string(), exit_requested, get_now(), MAX_EXPIRYS, MAX_TIMERS, ev_timer::removed, ev_timer::target, timer_count, timer_expiring, and timer_list.
Referenced by eventloop_run().
|
static |
Definition at line 70 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References NULL, timer_count, and timer_list.
Referenced by eventloop_run().
|
static |
Definition at line 58 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References NULL.
Referenced by create_timer(), eventloop_run(), and expire_timers().
|
static |
Definition at line 538 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References DUK_ERR_ERROR, duk_error, duk_require_int(), MAX_FDS, poll_count, and poll_list.
|
static |
Definition at line 587 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
References exit_requested.
|
static |
Definition at line 593 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by eventloop_register().
|
static |
Definition at line 55 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by eventloop_run(), expire_timers(), and request_exit().
|
static |
Definition at line 52 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by compact_poll_list(), eventloop_run(), and listen_fd().
|
static |
Definition at line 51 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by compact_poll_list(), eventloop_register(), eventloop_run(), and listen_fd().
|
static |
Definition at line 47 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by bubble_last_timer(), create_timer(), delete_timer(), expire_timers(), and find_nearest_timer().
|
static |
Definition at line 46 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by delete_timer(), eventloop_register(), and expire_timers().
|
static |
Definition at line 45 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by bubble_last_timer(), create_timer(), delete_timer(), eventloop_register(), expire_timers(), and find_nearest_timer().
|
static |
Definition at line 48 of file duktape-1.5.2/examples/eventloop/c_eventloop.c.
Referenced by create_timer().