Browse Source

Refactor scheme-related functions into separate file

master
Wesley Kerfoot 5 years ago
parent
commit
ef9ed40239
  1. 21
      browser.c
  2. 4
      browser.h
  3. 29
      scheme_functions.h

21
browser.c

@ -5,6 +5,7 @@
#include <libguile/strings.h>
#include "browser.h"
#include "scheme_functions.h"
static void
load_modules(void) {
@ -64,20 +65,6 @@ qu_push(enum BrowserEvent msg_type,
return 1;
}
static SCM
scm_qu_push(SCM scm_msg_type,
SCM scm_message,
SCM scm_qu) {
enum BrowserEvent msg_type = scm_to_int(scm_msg_type);
char *data = scm_to_locale_string(scm_message);
GAsyncQueue *g_queue = scm_to_pointer(scm_qu);
qu_push(msg_type, data, g_queue);
return SCM_BOOL_T;
}
static int
conf_val(char * const key) {
/* Lookup a key value in a Scheme hash-table */
@ -95,12 +82,6 @@ conf_val(char * const key) {
}
}
static SCM
scm_ref(const char *var_name) {
/* Lookup and de-reference a Scheme value */
return scm_variable_ref(scm_c_lookup(var_name));
}
static WebKitWebView*
make_webview() {
WebKitSettings *settings = webkit_settings_new();

4
browser.h

@ -19,6 +19,8 @@ struct BrowserMessage {
static SCM scm_ref(const char *);
static int read_config_val(char * const);
static SCM qu_push(enum BrowserEvent, char *, GAsyncQueue *);
static int qu_push(enum BrowserEvent, char *, GAsyncQueue *);
static SCM scm_qu_push(SCM, SCM, SCM);

29
scheme_functions.h

@ -0,0 +1,29 @@
static SCM
scm_qu_pop(SCM scm_qu) {
GAsyncQueue *g_queue = scm_to_pointer(scm_qu);
struct BrowserMessage *msg = g_async_queue_timeout_pop(g_queue, 10);
}
static SCM
scm_qu_push(SCM scm_msg_type,
SCM scm_message,
SCM scm_qu) {
enum BrowserEvent msg_type = scm_to_int(scm_msg_type);
char *data = scm_to_locale_string(scm_message);
GAsyncQueue *g_queue = scm_to_pointer(scm_qu);
qu_push(msg_type, data, g_queue);
return SCM_BOOL_T;
}
static SCM
scm_ref(const char *var_name) {
/* Lookup and de-reference a Scheme value */
return scm_variable_ref(scm_c_lookup(var_name));
}
Loading…
Cancel
Save