From: Uwe Hermann Date: Tue, 8 Feb 2011 20:22:10 +0000 (+0100) Subject: Add sr_ prefix for datastore API functions. X-Git-Tag: libsigrok-0.1.0~338 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c49111295f0b2e50044923897d99ca84f65b75db;p=libsigrok.git Add sr_ prefix for datastore API functions. --- diff --git a/datastore.c b/datastore.c index 31dc770e..c7ace06f 100644 --- a/datastore.c +++ b/datastore.c @@ -23,9 +23,9 @@ #include #include -static gpointer new_chunk(struct datastore **ds); +static gpointer new_chunk(struct sr_datastore **ds); -int datastore_new(int unitsize, struct datastore **ds) +int sr_datastore_new(int unitsize, struct sr_datastore **ds) { if (!ds) return SR_ERR; @@ -33,7 +33,7 @@ int datastore_new(int unitsize, struct datastore **ds) if (unitsize <= 0) return SR_ERR; /* TODO: Different error? */ - if (!(*ds = g_malloc(sizeof(struct datastore)))) + if (!(*ds = g_malloc(sizeof(struct sr_datastore)))) return SR_ERR_MALLOC; (*ds)->ds_unitsize = unitsize; @@ -43,7 +43,7 @@ int datastore_new(int unitsize, struct datastore **ds) return SR_OK; } -int datastore_destroy(struct datastore *ds) +int sr_datastore_destroy(struct sr_datastore *ds) { GSList *chunk; @@ -58,8 +58,8 @@ int datastore_destroy(struct datastore *ds) return SR_OK; } -void datastore_put(struct datastore *ds, void *data, unsigned int length, - int in_unitsize, int *probelist) +void sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length, + int in_unitsize, int *probelist) { unsigned int stored; int capacity, size, num_chunks, chunk_bytes_free, chunk_offset; @@ -100,7 +100,7 @@ void datastore_put(struct datastore *ds, void *data, unsigned int length, ds->num_units += stored / ds->ds_unitsize; } -static gpointer new_chunk(struct datastore **ds) +static gpointer new_chunk(struct sr_datastore **ds) { gpointer chunk; diff --git a/session_file.c b/session_file.c index 48a2747d..0092e718 100644 --- a/session_file.c +++ b/session_file.c @@ -142,7 +142,7 @@ int sr_session_save(char *filename) FILE *meta; struct sr_device *device; struct sr_probe *probe; - struct datastore *ds; + struct sr_datastore *ds; struct zip *zipfile; struct zip_source *versrc, *metasrc, *logicsrc; int bufcnt, devcnt, tmpfile, ret, error, probecnt; diff --git a/sigrok-proto.h b/sigrok-proto.h index d13a3ac2..e41dd9f4 100644 --- a/sigrok-proto.h +++ b/sigrok-proto.h @@ -27,10 +27,10 @@ void sr_exit(void); /*--- datastore.c -----------------------------------------------------------*/ -int datastore_new(int unitsize, struct datastore **ds); -int datastore_destroy(struct datastore *ds); -void datastore_put(struct datastore *ds, void *data, unsigned int length, - int in_unitsize, int *probelist); +int sr_datastore_new(int unitsize, struct sr_datastore **ds); +int sr_datastore_destroy(struct sr_datastore *ds); +void sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length, + int in_unitsize, int *probelist); /*--- device.c --------------------------------------------------------------*/ @@ -38,8 +38,8 @@ void sr_device_scan(void); int sr_device_plugin_init(struct sr_device_plugin *plugin); void sr_device_close_all(void); GSList *sr_device_list(void); -struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index, - int num_probes); +struct sr_device *sr_device_new(struct sr_device_plugin *plugin, + int plugin_index, int num_probes); void sr_device_clear(struct sr_device *device); void sr_device_destroy(struct sr_device *dev); @@ -49,7 +49,8 @@ struct sr_probe *probe_find(struct sr_device *device, int probenum); void sr_device_probe_name(struct sr_device *device, int probenum, char *name); void sr_device_trigger_clear(struct sr_device *device); -void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger); +void sr_device_trigger_set(struct sr_device *device, int probenum, + char *trigger); gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap); /*--- filter.c --------------------------------------------------------------*/ @@ -116,7 +117,8 @@ int sr_session_start(void); void sr_session_run(void); void sr_session_halt(void); void sr_session_stop(void); -void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet); +void sr_session_bus(struct sr_device *device, + struct sr_datafeed_packet *packet); void make_metadata(char *filename); int sr_session_save(char *filename); void sr_session_source_add(int fd, int events, int timeout, @@ -135,7 +137,8 @@ struct sr_output_format **sr_output_list(void); char *sr_samplerate_string(uint64_t samplerate); char *sr_period_string(uint64_t frequency); -char **sr_parse_triggerstring(struct sr_device *device, const char *triggerstring); +char **sr_parse_triggerstring(struct sr_device *device, + const char *triggerstring); uint64_t sr_parse_sizestring(const char *sizestring); uint64_t sr_parse_timestring(const char *timestring); diff --git a/sigrok.h b/sigrok.h index 7d19725f..414890df 100644 --- a/sigrok.h +++ b/sigrok.h @@ -175,7 +175,7 @@ struct analyzer { /* Size of a chunk in units */ #define DATASTORE_CHUNKSIZE 512000 -struct datastore { +struct sr_datastore { /* Size in bytes of the number of units stored in this datastore */ int ds_unitsize; unsigned int num_units; /* TODO: uint64_t */ @@ -196,7 +196,7 @@ struct sr_device { /* List of struct sr_probe* */ GSList *probes; /* Data acquired by this device, if any */ - struct datastore *datastore; + struct sr_datastore *datastore; }; enum {