]> sigrok.org Git - libsigrokdecode.git/blobdiff - sigrokdecode.h.in
Doxygen: Add @since markers to API functions.
[libsigrokdecode.git] / sigrokdecode.h.in
index 58fb056436406c11bdc3e5550be7463a8ab1acd7..7aac0bae8e6659f0fc4b9223039278a916172099 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrokdecode project.
  *
  * Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
  * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
 extern "C" {
 #endif
 
+/**
+ * @file
+ *
+ * The public libsigrokdecode header file to be used by frontends.
+ *
+ * This is the only file that libsigrokdecode users (frontends) are supposed
+ * to use and include. There are other header files which get installed with
+ * libsigrokdecode, but those are not meant to be used directly by frontends.
+ *
+ * The correct way to get/use the libsigrokdecode API functions is:
+ *
+ * @code{.c}
+ *   #include <sigrokdecode.h>
+ * @endcode
+ */
+
 /*
  * Package version macros (can be used for conditional compilation).
  */
 
 /** The libsigrokdecode package 'major' version number. */
-#define LIBSIGROKDECODE_MAJOR_VERSION @LIBSIGROKDECODE_MAJOR_VERSION@
+#define SRD_PACKAGE_VERSION_MAJOR @SRD_PACKAGE_VERSION_MAJOR@
 
 /** The libsigrokdecode package 'minor' version number. */
-#define LIBSIGROKDECODE_MINOR_VERSION @LIBSIGROKDECODE_MINOR_VERSION@
+#define SRD_PACKAGE_VERSION_MINOR @SRD_PACKAGE_VERSION_MINOR@
 
 /** The libsigrokdecode package 'micro' version number. */
-#define LIBSIGROKDECODE_MICRO_VERSION @LIBSIGROKDECODE_MICRO_VERSION@
+#define SRD_PACKAGE_VERSION_MICRO @SRD_PACKAGE_VERSION_MICRO@
 
 /** The libsigrokdecode package version ("major.minor.micro") as string. */
-#define LIBSIGROKDECODE_VERSION_STRING "@LIBSIGROKDECODE_VERSION@"
+#define SRD_PACKAGE_VERSION_STRING "@SRD_PACKAGE_VERSION@"
 
 /*
  * Library/libtool version macros (can be used for conditional compilation).
  */
 
 /** The libsigrokdecode libtool 'current' version number. */
-#define LIBSIGROKDECODE_LT_CURRENT @LIBSIGROKDECODE_LT_CURRENT@
+#define SRD_LIB_VERSION_CURRENT @SRD_LIB_VERSION_CURRENT@
 
 /** The libsigrokdecode libtool 'revision' version number. */
-#define LIBSIGROKDECODE_LT_REVISION @LIBSIGROKDECODE_LT_REVISION@
+#define SRD_LIB_VERSION_REVISION @SRD_LIB_VERSION_REVISION@
 
 /** The libsigrokdecode libtool 'age' version number. */
-#define LIBSIGROKDECODE_LT_AGE @LIBSIGROKDECODE_LT_AGE@
+#define SRD_LIB_VERSION_AGE @SRD_LIB_VERSION_AGE@
 
 /** The libsigrokdecode libtool version ("current:revision:age") as string. */
-#define LIBSIGROKDECODE_LT_VERSION_STRING "@LIBSIGROKDECODE_LT_VERSION@"
+#define SRD_LIB_VERSION_STRING "@SRD_LIB_VERSION@"
 
 /*
  * Status/error codes returned by libsigrokdecode functions.
@@ -99,20 +115,31 @@ extern "C" {
  * Use SRD_API to mark public API symbols, and SRD_PRIV for private symbols.
  *
  * Variables and functions marked 'static' are private already and don't
- * need SR_PRIV. However, functions which are not static (because they need
+ * need SRD_PRIV. However, functions which are not static (because they need
  * to be used in other libsigrokdecode-internal files) but are also not
  * meant to be part of the public libsigrokdecode API, must use SRD_PRIV.
  *
  * This uses the 'visibility' feature of gcc (requires gcc >= 4.0).
  *
+ * This feature is not available on MinGW/Windows, as it is a feature of
+ * ELF files and MinGW/Windows uses PE files.
+ *
  * Details: http://gcc.gnu.org/wiki/Visibility
  */
 
 /* Marks public libsigrokdecode API symbols. */
+#ifndef _WIN32
 #define SRD_API __attribute__((visibility("default")))
+#else
+#define SRD_API
+#endif
 
 /* Marks private, non-public libsigrokdecode symbols (not part of the API). */
+#ifndef _WIN32
 #define SRD_PRIV __attribute__((visibility("hidden")))
+#else
+#define SRD_PRIV
+#endif
 
 /*
  * When adding an output type, don't forget to...
@@ -128,7 +155,6 @@ enum {
 
 #define SRD_MAX_NUM_PROBES 64
 
-/* TODO: Documentation. */
 struct srd_decoder {
        /** The decoder ID. Must be non-NULL and unique for all decoders. */
        char *id;
@@ -136,7 +162,7 @@ struct srd_decoder {
        /** The (short) decoder name. Must be non-NULL. */
        char *name;
 
-       /** The (long) decoder name. May be NULL. */
+       /** The (long) decoder name. Must be non-NULL. */
        char *longname;
 
        /** A (short, one-line) description of the decoder. Must be non-NULL. */
@@ -160,6 +186,9 @@ struct srd_decoder {
         */
        GSList *annotations;
 
+       /** List of decoder options.  */
+       GSList *options;
+
        /** Python module. */
        PyObject *py_mod;
 
@@ -182,6 +211,12 @@ struct srd_probe {
        int order;
 };
 
+struct srd_decoder_option {
+       char *id;
+       char *desc;
+       GVariant *def;
+};
+
 struct srd_decoder_inst {
        struct srd_decoder *decoder;
        PyObject *py_inst;
@@ -239,31 +274,30 @@ typedef struct {
 
 SRD_API int srd_init(const char *path);
 SRD_API int srd_exit(void);
-SRD_API int srd_inst_options_set(struct srd_decoder_inst *di,
-                                GHashTable *options);
-SRD_API int srd_inst_probes_set(struct srd_decoder_inst *di,
-                               GHashTable *probes);
+SRD_API int srd_inst_option_set(struct srd_decoder_inst *di,
+               GHashTable *options);
+SRD_API int srd_inst_probe_set_all(struct srd_decoder_inst *di,
+               GHashTable *probes);
 SRD_API struct srd_decoder_inst *srd_inst_new(const char *id,
-                                             GHashTable *options);
+               GHashTable *options);
 SRD_API int srd_inst_stack(struct srd_decoder_inst *di_from,
-                          struct srd_decoder_inst *di_to);
+               struct srd_decoder_inst *di_to);
 SRD_API struct srd_decoder_inst *srd_inst_find_by_id(const char *inst_id);
-SRD_API int srd_session_start(int num_probes, int unitsize,
-                             uint64_t samplerate);
+SRD_API int srd_session_start(int num_probes, int unitsize, uint64_t samplerate);
 SRD_API int srd_session_send(uint64_t start_samplenum, const uint8_t *inbuf,
-                            uint64_t inbuflen);
-SRD_API int srd_register_callback(int output_type,
-                                 srd_pd_output_callback_t cb, void *cb_data);
+               uint64_t inbuflen);
+SRD_API int srd_pd_output_callback_add(int output_type,
+               srd_pd_output_callback_t cb, void *cb_data);
 
 /*--- decoder.c -------------------------------------------------------------*/
 
-SRD_API GSList *srd_decoder_list(void);
+SRD_API const GSList *srd_decoder_list(void);
 SRD_API struct srd_decoder *srd_decoder_get_by_id(const char *id);
 SRD_API int srd_decoder_load(const char *name);
 SRD_API int srd_decoder_unload(struct srd_decoder *dec);
 SRD_API int srd_decoder_load_all(void);
 SRD_API int srd_decoder_unload_all(void);
-SRD_API char *srd_decoder_doc(const struct srd_decoder *dec);
+SRD_API char *srd_decoder_doc_get(const struct srd_decoder *dec);
 
 /*--- log.c -----------------------------------------------------------------*/
 
@@ -277,6 +311,18 @@ SRD_API int srd_log_callback_set_default(void);
 SRD_API int srd_log_logdomain_set(const char *logdomain);
 SRD_API char *srd_log_logdomain_get(void);
 
+/*--- version.c -------------------------------------------------------------*/
+
+SRD_API int srd_package_version_major_get(void);
+SRD_API int srd_package_version_minor_get(void);
+SRD_API int srd_package_version_micro_get(void);
+SRD_API const char *srd_package_version_string_get(void);
+
+SRD_API int srd_lib_version_current_get(void);
+SRD_API int srd_lib_version_revision_get(void);
+SRD_API int srd_lib_version_age_get(void);
+SRD_API const char *srd_lib_version_string_get(void);
+
 #ifdef __cplusplus
 }
 #endif