diff options
Diffstat (limited to 'other/apidsl')
-rw-r--r-- | other/apidsl/README.md | 20 | ||||
-rw-r--r-- | other/apidsl/tox.in.h | 19 |
2 files changed, 26 insertions, 13 deletions
diff --git a/other/apidsl/README.md b/other/apidsl/README.md index 3ba44678..99694dca 100644 --- a/other/apidsl/README.md +++ b/other/apidsl/README.md | |||
@@ -18,14 +18,16 @@ If you want to do it quickly and you don't have time for anything other than cop | |||
18 | 18 | ||
19 | Command to run from ``toxcore`` directory (quick way, involves using curl): | 19 | Command to run from ``toxcore`` directory (quick way, involves using curl): |
20 | ```bash | 20 | ```bash |
21 | rm toxcore/tox.h && \ | 21 | # For tox.h: |
22 | ( curl -X POST --data-binary @- https://apidsl.herokuapp.com/apidsl < ./other/apidsl/tox.in.h > ./toxcore/tox.h ) && \ | 22 | curl -X POST --data-binary @- https://apidsl.herokuapp.com/apidsl \ |
23 | astyle --options=./other/astyle/astylerc ./toxcore/tox.h | 23 | < other/apidsl/tox.in.h \ |
24 | ``` | 24 | | astyle --options=other/astyle/astylerc \ |
25 | 25 | > toxcore/tox.h | |
26 | When formatting will be complete, you should see output like: | 26 | # For toxav.h: |
27 | ``` | 27 | curl -X POST --data-binary @- https://apidsl.herokuapp.com/apidsl \ |
28 | Formatted ./toxcore/tox.h | 28 | < other/apidsl/toxav.in.h \ |
29 | | astyle --options=other/astyle/astylerc \ | ||
30 | > toxav/toxav.h | ||
29 | ``` | 31 | ``` |
30 | 32 | ||
31 | You may want to make sure with ``git diff`` that changes made in ``tox.h`` reflect changes in ``tox.in.h``. | 33 | You may want to make sure with ``git diff`` that changes made in ``tox.h`` reflect changes in ``tox.in.h``. |
@@ -43,7 +45,7 @@ If you prefer to have more control over what is happening, there are steps below | |||
43 | 4. Use ``apidsl`` ``??`` | 45 | 4. Use ``apidsl`` ``??`` |
44 | 5. Parse generated ``tox.h`` with astyle, minimal command for it would be: | 46 | 5. Parse generated ``tox.h`` with astyle, minimal command for it would be: |
45 | ```bash | 47 | ```bash |
46 | astyle --options=./other/astyle/astylerc ./toxcore/tox.h | 48 | astyle --options=other/astyle/astylerc toxcore/tox.h |
47 | ``` | 49 | ``` |
48 | 50 | ||
49 | **Always pass output from ``apidsl`` through astyle.** | 51 | **Always pass output from ``apidsl`` through astyle.** |
diff --git a/other/apidsl/tox.in.h b/other/apidsl/tox.in.h index 577515b1..6e65ed1f 100644 --- a/other/apidsl/tox.in.h +++ b/other/apidsl/tox.in.h | |||
@@ -86,6 +86,19 @@ extern "C" { | |||
86 | * callback will result in no callback being registered for that event. Only | 86 | * callback will result in no callback being registered for that event. Only |
87 | * one callback per event can be registered, so if a client needs multiple | 87 | * one callback per event can be registered, so if a client needs multiple |
88 | * event listeners, it needs to implement the dispatch functionality itself. | 88 | * event listeners, it needs to implement the dispatch functionality itself. |
89 | * | ||
90 | * The last argument to a callback is the user data pointer. It is passed from | ||
91 | * ${tox.iterate} to each callback in sequence. | ||
92 | * | ||
93 | * The user data pointer is never stored or dereferenced by any library code, so | ||
94 | * can be any pointer, including NULL. Callbacks must all operate on the same | ||
95 | * object type. In the apidsl code (tox.in.h), this is denoted with `any`. The | ||
96 | * `any` in ${tox.iterate} must be the same `any` as in all callbacks. In C, | ||
97 | * lacking parametric polymorphism, this is a pointer to void. | ||
98 | * | ||
99 | * Old style callbacks that are registered together with a user data pointer | ||
100 | * receive that pointer as argument when they are called. They can each have | ||
101 | * their own user data pointer of their own type. | ||
89 | */ | 102 | */ |
90 | 103 | ||
91 | /** \subsection threading Threading implications | 104 | /** \subsection threading Threading implications |
@@ -713,7 +726,7 @@ inline namespace self { | |||
713 | * | 726 | * |
714 | * TODO: how long should a client wait before bootstrapping again? | 727 | * TODO: how long should a client wait before bootstrapping again? |
715 | */ | 728 | */ |
716 | event connection_status { | 729 | event connection_status const { |
717 | /** | 730 | /** |
718 | * @param connection_status Whether we are connected to the DHT. | 731 | * @param connection_status Whether we are connected to the DHT. |
719 | */ | 732 | */ |
@@ -734,7 +747,7 @@ const uint32_t iteration_interval(); | |||
734 | * The main loop that needs to be run in intervals of $iteration_interval() | 747 | * The main loop that needs to be run in intervals of $iteration_interval() |
735 | * milliseconds. | 748 | * milliseconds. |
736 | */ | 749 | */ |
737 | void iterate(); | 750 | void iterate(any user_data); |
738 | 751 | ||
739 | 752 | ||
740 | /******************************************************************************* | 753 | /******************************************************************************* |
@@ -858,7 +871,6 @@ inline namespace self { | |||
858 | * If this parameter is NULL, the function has no effect. | 871 | * If this parameter is NULL, the function has no effect. |
859 | */ | 872 | */ |
860 | get(); | 873 | get(); |
861 | |||
862 | } | 874 | } |
863 | 875 | ||
864 | 876 | ||
@@ -1058,7 +1070,6 @@ namespace friend { | |||
1058 | */ | 1070 | */ |
1059 | const bool exists(uint32_t friend_number); | 1071 | const bool exists(uint32_t friend_number); |
1060 | 1072 | ||
1061 | |||
1062 | } | 1073 | } |
1063 | 1074 | ||
1064 | inline namespace self { | 1075 | inline namespace self { |