diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-09 19:51:18 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-09 19:51:18 +0800 |
commit | c6e5f421e2738b6005f6c3da6700b1343214f7e5 (patch) | |
tree | f4c45010fac52e4c30610ddd4640fb5b36a602a8 /icclient | |
parent | a0e54cb948c9862936e16eedd2a2015be05408c8 (diff) |
Add support for Emscripten
Diffstat (limited to 'icclient')
-rw-r--r-- | icclient/admin.h | 2 | ||||
-rw-r--r-- | icclient/client.h | 15 | ||||
-rw-r--r-- | icclient/member.h | 6 | ||||
-rw-r--r-- | icclient/typedefs.h | 11 |
4 files changed, 18 insertions, 16 deletions
diff --git a/icclient/admin.h b/icclient/admin.h index 1ba73c7..36ec0d6 100644 --- a/icclient/admin.h +++ b/icclient/admin.h @@ -15,7 +15,7 @@ extern "C" { struct icclient_admin *icclient_admin_login(const char *username, const char *password, const char *successpage, const char *nextpage, const char *failpage, - size_t (*handler)(void *, size_t, size_t, void *)); + icclient_handler handler); void icclient_admin_newitem(const char *description, const char *comment, const char *price, const char *image_path); void icclient_admin_logout(struct icclient_admin *admin); diff --git a/icclient/client.h b/icclient/client.h index 02e0bfa..00f9445 100644 --- a/icclient/client.h +++ b/icclient/client.h @@ -22,17 +22,14 @@ extern "C" { * \param handler A pointer to a cURL write function callback. * \param catalogptr A pointer to pointer to the catalog to store the data. */ - void icclient_results(const char *prod_group, - size_t (*handler)(void *, size_t, size_t, void *), - struct icclient_catalog **catalogptr); + void icclient_results(const char *prod_group, icclient_handler handler, struct icclient_catalog **catalogptr); /*! * \brief For fetching data about all active products. * \param handler A pointer to a cURL write function callback. * \param catalogptr A pointer to pointer to the catalog to store the data. */ - void icclient_allproducts(size_t (*handler)(void *, size_t, size_t, void *), - struct icclient_catalog **catalogptr); + void icclient_allproducts(icclient_handler handler, struct icclient_catalog **catalogptr); /*! * \brief For fetching data about a specific product. @@ -40,13 +37,9 @@ extern "C" { * \param handler A pointer to a cURL write function callback. * \param productptr A pointer to pointer to the product to store the data. */ - void icclient_flypage(const char *sku, - size_t (*handler)(void *, size_t, size_t, void *), - struct icclient_product **productptr); + void icclient_flypage(const char *sku, icclient_handler handler, struct icclient_product **productptr); - void icclient_page(const char *path, - size_t (*handler)(void *, size_t, size_t, void *), - void **dataptr); + void icclient_page(const char *path, icclient_handler handler, void **dataptr); void icclient_cleanup(); #ifdef __cplusplus diff --git a/icclient/member.h b/icclient/member.h index 0f4ac22..1c0943a 100644 --- a/icclient/member.h +++ b/icclient/member.h @@ -62,12 +62,10 @@ extern "C" { struct icclient_member *icclient_member_newaccount(const char *username, const char *password, const char *verify, const char *successpage, - const char *nextpage, const char *failpage, - size_t (*handler)(void *, size_t, size_t, void *)); + const char *nextpage, const char *failpage, icclient_handler handler); struct icclient_member *icclient_member_login(const char *username, const char *password, const char *successpage, - const char *nextpage, const char *failpage, - size_t (*handler)(void *, size_t, size_t, void *)); + const char *nextpage, const char *failpage, icclient_handler handler); void icclient_member_account(const char *fname, const char *lname, const char *address1, const char *address2, const char *city, const char *state, const char *zip, const char *email, diff --git a/icclient/typedefs.h b/icclient/typedefs.h new file mode 100644 index 0000000..1b2f176 --- /dev/null +++ b/icclient/typedefs.h @@ -0,0 +1,11 @@ +#ifndef ICCLIENT_TYPEDEFS_H +#define ICCLIENT_TYPEDEFS_H + +#ifdef __EMSCRIPTEN__ +#include <emscripten/fetch.h> +typedef void (*icclient_handler)(emscripten_fetch_t *); +#else +typedef size_t (*icclient_handler)(void *, size_t, size_t, void *); +#endif + +#endif |