From 68dc14f80c7ae202ababbd0372a04b137ea8b563 Mon Sep 17 00:00:00 2001 From: Zetok Zalbavar Date: Sat, 20 Jun 2015 01:22:46 +0100 Subject: Add real instruction on how to use APIDSL and astyle also add to "tox{,.in}.h" note that "tox.h" shouldn't be edited directly, pointing to "tox.in.h" --- other/apidsl/README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++------ other/apidsl/tox.in.h | 8 ++++++++ 2 files changed, 52 insertions(+), 6 deletions(-) (limited to 'other/apidsl') diff --git a/other/apidsl/README.md b/other/apidsl/README.md index 0b3e776d..c0f29ea4 100644 --- a/other/apidsl/README.md +++ b/other/apidsl/README.md @@ -1,11 +1,49 @@ -This folder contains the input file that can be used to generate the tox.h api -with: https://github.com/iphydf/apidsl +This folder contains the input file (``tox.in.h``) that has to be used to generate the ``tox.h`` api with: https://github.com/iphydf/apidsl -You can also use the following command if you can't install it: +# Minimal requirements +There are some minimal requirements to contribute to ``tox.h``: +* unix enrironment +* ``astyle`` ``>=2.03`` +* [``apidsl``](https://github.com/iphydf/apidsl) (you can use provided service with curl instead) + +## Quick way + +If you want to do it quickly and you don't have time for anything other than copypasting commands, you should have ``curl`` installed. + + +1. Make sure that you have ``curl`` and ``>=astyle-2.03`` installed +2. Modify [``tox.in.h``](/other/apidsl/tox.in.h) +3. Run command below ↓ + +Command to run from ``toxcore`` directory (quick way, involves using curl): +```bash +rm toxcore/tox.h && \ +( curl -X POST --data-binary @- https://criticism.herokuapp.com/apidsl < ./other/apidsl/tox.in.h > ./toxcore/tox.h ) && \ +astyle --options=./other/astyle/astylerc ./toxcore/tox.h +``` + +When formatting will be complete, you should see output like: ``` -curl -X POST --data-binary @- https://criticism.herokuapp.com/apidsl < tox.in.h > tox.h +Formatted ./toxcore/tox.h +``` + +You may want to make sure with ``git diff`` that changes made in ``tox.h`` reflect changes in ``tox.in.h``. + +And you're done. + + +## Manually + +If you prefer to have more control over what is happening, there are steps below: + +1. Install [``apidsl``](https://github.com/iphydf/apidsl) +2. Install ``astyle``, version 2.03 or later. +3. Modify [``tox.in.h``](/other/apidsl/tox.in.h) +4. Use ``apidsl`` ``??`` +5. Parse generated ``tox.h`` with astyle, minimal command for it would be: +```bash +astyle --options=./other/astyle/astylerc ./toxcore/tox.h ``` -Note that the output must be passed through astyle with the config in -other/astyle/astylerc to generate the exact same file. +**Always pass output from ``apidsl`` through astyle.** \ No newline at end of file diff --git a/other/apidsl/tox.in.h b/other/apidsl/tox.in.h index 30c78e44..189fc43d 100644 --- a/other/apidsl/tox.in.h +++ b/other/apidsl/tox.in.h @@ -34,6 +34,14 @@ extern "C" { #endif %} + +/***************************************************************************** + * `tox.h` SHOULD *NOT* BE EDITED MANUALLY – any changes should be made to * + * `tox.in.h`, located in `other/apidsl/`. For instructions on how to * + * generate `tox.h` from `tox.in.h` please refer to `other/apidsl/README.md` * + *****************************************************************************/ + + /** \page core Public core API for Tox clients. * * Every function that can fail takes a function-specific error code pointer -- cgit v1.2.3