2 * This file is part of the libsigrok project.
4 * Copyright (C) 2013 Martin Ling <martin-sigrok@earth.li>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "libsigrok/libsigrok.h"
28 typedef void *gpointer;
30 typedef struct _GSList GSList;
38 void g_slist_free(GSList *list);
40 GVariant *g_variant_new_uint64(uint64_t value);
41 GVariant *g_variant_new_boolean(gboolean value);
42 GVariant *g_variant_new_double(double value);
43 GVariant *g_variant_new_string(char *value);
44 GVariant *g_variant_new_tuple(GVariant *children[], unsigned long n_children);
45 char *g_variant_get_type_string(GVariant *value);
46 uint64_t g_variant_get_uint64(GVariant *value);
47 gboolean g_variant_get_boolean(GVariant *value);
48 double g_variant_get_double(GVariant *value);
49 char *g_variant_get_string(GVariant *value, unsigned long *length);
50 GVariant *g_variant_get_child_value(GVariant *value, unsigned long index);
52 typedef guint (*GHashFunc)(gconstpointer key);
53 typedef gboolean (*GEqualFunc)(gconstpointer a, gconstpointer b);
54 typedef void (*GDestroyNotify)(gpointer data);
56 GHashTable *g_hash_table_new_full(GHashFunc hash_func, GEqualFunc key_equal_func,
57 GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func);
58 void g_hash_table_insert(GHashTable *hash_table, gpointer key, gpointer value);
59 void g_hash_table_destroy(GHashTable *hash_table);
61 %constant guint g_str_hash(gconstpointer v);
62 %constant gboolean g_str_equal(gconstpointer v1, gconstpointer v2);;
63 %constant void g_free(gpointer mem);
65 gchar *g_strdup(const char *str);
67 %include "libsigrok/libsigrok.h"
70 %ignore sr_config_info_name_get;
71 %include "libsigrok/proto.h"
72 %include "libsigrok/version.h"
74 %array_class(float, float_array);
75 %pointer_functions(GVariant *, gvariant_ptr_ptr);
76 %array_functions(GVariant *, gvariant_ptr_array);
77 %pointer_functions(struct sr_context *, sr_context_ptr_ptr);
78 %array_functions(struct sr_dev_driver *, sr_dev_driver_ptr_array);
79 %array_functions(struct sr_input_format *, sr_input_format_ptr_array);
80 %array_functions(struct sr_output_format *, sr_output_format_ptr_array);
81 %pointer_cast(gpointer, struct sr_dev_inst *, gpointer_to_sr_dev_inst_ptr);
82 %pointer_cast(void *, struct sr_datafeed_logic *, void_ptr_to_sr_datafeed_logic_ptr)
83 %pointer_cast(void *, struct sr_datafeed_analog *, void_ptr_to_sr_datafeed_analog_ptr)
84 %pointer_cast(void *, struct sr_probe *, void_ptr_to_sr_probe_ptr)
85 %pointer_cast(void *, struct sr_probe_group *, void_ptr_to_sr_probe_group_ptr)
87 %extend sr_input_format {
88 int call_format_match(const char *filename) {
89 return $self->format_match(filename);
92 int call_init(struct sr_input *in, const char *filename) {
93 return $self->init(in, filename);
96 int call_loadfile(struct sr_input *in, const char *filename) {
97 return $self->loadfile(in, filename);