summaryrefslogtreecommitdiff
path: root/include/disfluid.h
blob: 0f6649e4d2ed00abe270f354157e69411d068c31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#ifndef H_DISFLUID_INCLUDED
# define H_DISFLUID_INCLUDED

# include <stdlib.h>
# include <stdio.h>
# include <time.h>

# if defined _WIN32 && !defined __CYGWIN__
#  define DISFLUID_DLL_MADNESS 1
# else
#  define DISFLUID_DLL_MADNESS 0
# endif

# if BUILDING_LIBDISFLUID && HAVE_VISIBILITY
#  define DISFLUID_DLL_EXPORTED __attribute__((__visibility__("default")))
# elif BUILDING_LIBDISFLUID && DISFLUID_DLL_MADNESS
#  define DISFLUID_DLL_EXPORTED __declspec(dllexport)
# elif DISFLUID_DLL_MADNESS
#  define DISFLUID_DLL_EXPORTED __declspec(dllimport)
# else
#  define DISFLUID_DLL_EXPORTED
# endif

# define DISFLUID_API \
  DISFLUID_DLL_EXPORTED

# ifdef ATTRIBUTE_DEALLOC
#  define DISFLUID_DEALLOC_WITH ATTRIBUTE_DEALLOC
# else
#  define DISFLUID_DEALLOC_WITH(f, i)
# endif

# ifdef ATTRIBUTE_DEALLOC_FREE
#  define DISFLUID_DEALLOC_WITH_FREE ATTRIBUTE_DEALLOC_FREE
# else
#  define DISFLUID_DEALLOC_WITH_FREE
# endif

# ifdef ATTRIBUTE_CONST
#  define DISFLUID_CONST ATTRIBUTE_CONST
# else
#  define DISFLUID_CONST
# endif

# ifdef ATTRIBUTE_PURE
#  define DISFLUID_PURE ATTRIBUTE_PURE
# else
#  define DISFLUID_PURE
# endif

# ifdef NODISCARD
#  define DISFLUID_NODISCARD NODISCARD
# else
#  define DISFLUID_NODISCARD
# endif

# ifdef ATTRIBUTE_FD_ARG
#  define DISFLUID_FD_ARG ATTRIBUTE_FD_ARG
# else
#  define DISFLUID_FD_ARG()
# endif

# define DISFLUID_FD_ARG_1 \
  DISFLUID_FD_ARG (1)

# ifdef ATTRIBUTE_FD_ARG_READ
#  define DISFLUID_FD_ARG_READ ATTRIBUTE_FD_ARG_READ
# else
#  define DISFLUID_FD_ARG_READ(i)
# endif

# define DISFLUID_FD_ARG_READ_1 \
  DISFLUID_FD_ARG_READ (1)

# define DISFLUID_FD_ARG_READ_2 \
  DISFLUID_FD_ARG_READ (2)

# ifdef ATTRIBUTE_FD_ARG_WRITE
#  define DISFLUID_FD_ARG_WRITE ATTRIBUTE_FD_ARG_WRITE
# else
#  define DISFLUID_FD_ARG_WRITE(i)
# endif

# define DISFLUID_FD_ARG_WRITE_1 \
  DISFLUID_FD_ARG_WRITE (1)

# define DISFLUID_FD_ARG_WRITE_2 \
  DISFLUID_FD_ARG_WRITE (2)

# define DISFLUID_DEALLOC_AS_CACHE_ENTRY \
  DISFLUID_DEALLOC_WITH (disfluid_cache_entry_free, 1)

# define DISFLUID_DEALLOC_AS_CACHE \
  DISFLUID_DEALLOC_WITH (disfluid_cache_free, 1)

# ifdef __cplusplus
extern "C"
{
# endif				/* __cplusplus */

  /**
   * disfluid_version:
   *
   * Returns: the version number.
   */
  DISFLUID_CONST DISFLUID_API extern const char *disfluid_version (void);

  /**
   * disfluid_is_nightly:
   *
   * Returns: (type boolean): whether disfluid is an unreleased snapshot.
   */
  DISFLUID_CONST DISFLUID_API extern int disfluid_is_nightly (void);

  /**
   * disfluid_whats_new:
   *
   * Returns: return the news.
   */
  DISFLUID_API extern const char *disfluid_whats_new (void);

  /**
   * disfluid_major_version:
   *
   * Returns: return the major version above which everything is
   * considered new.
   */
  DISFLUID_CONST DISFLUID_API extern const char
    *disfluid_major_version (void);

  /**
   * disfluid_website:
   *
   * Returns: the website for disfluid.
   */
  DISFLUID_API extern const char *disfluid_website (void);

  /**
   * disfluid_run_tests:
   * @n_tests: (out): the number of tests that have been run.
   * @n_errors: (out): the number of tests that failed.
   *
   * Run the unit tests.
   *
   * Returns: (transfer full): the tests output.
   */
  DISFLUID_API DISFLUID_DEALLOC_WITH_FREE char
    *disfluid_run_tests (size_t *n_tests, size_t *n_errors);

  /**
   * disfluid_count_authors:
   *
   * Returns: the number of authors.
   */
  DISFLUID_CONST DISFLUID_API extern size_t disfluid_count_authors (void);

  /**
   * disfluid_author_name:
   * @i: the author index.
   *
   * Returns: the name of author @i.
   */
  DISFLUID_API extern const char *disfluid_author_name (size_t i);

  /**
   * disfluid_author_email:
   * @i: the author index.
   *
   * Returns: (nullable): the optional email address of author @i.
   */
  DISFLUID_API extern const char *disfluid_author_email (size_t i);

  /**
   * disfluid_author_uri:
   * @i: the author index.
   *
   * Returns: (nullable): the optional web address of author @i.
   */
  DISFLUID_API extern const char *disfluid_author_uri (size_t i);

  /**
   * disfluid_author_is_developer:
   * @i: the author index.
   *
   * Returns: (type boolean): whether @i is a developer.
   */
  DISFLUID_CONST DISFLUID_API extern int
    disfluid_author_is_developer (size_t i);

  /**
   * disfluid_author_is_designer:
   * @i: the author index.
   *
   * Returns: (type boolean): whether @i is a designer.
   */
  DISFLUID_CONST DISFLUID_API extern int
    disfluid_author_is_designer (size_t i);

  /**
   * disfluid_author_is_artist:
   * @i: the author index.
   *
   * Returns: (type boolean): whether @i is a artist.
   */
  DISFLUID_CONST DISFLUID_API extern int disfluid_author_is_artist (size_t i);

  /**
   * disfluid_author_is_documenter:
   * @i: the author index.
   *
   * Returns: (type boolean): whether @i is a documenter.
   */
  DISFLUID_CONST DISFLUID_API extern int
    disfluid_author_is_documenter (size_t i);

  /**
   * disfluid_translation_credits:
   *
   * Returns: the credits for translations of your language.
   */
  DISFLUID_API extern const char *disfluid_translation_credits (void);

  /**
   * disfluid_copyright_statement:
   *
   * Returns: a copyright statement in your language.
   */
  DISFLUID_API DISFLUID_DEALLOC_WITH_FREE extern char
    *disfluid_copyright_statement (void);

  /**
   * disfluid_compute_cache_key:
   * @request_scheme: the URI scheme for the request, such as 'https'.
   * @request_header: the request header.
   * @response_header: the header of the response that resulted from
   * the request.
   * @key: (array length=max_key) (element-type char): the destination
   * cache key.
   *
   * Returns: 0 on success, or a negative error number.
   */
  DISFLUID_API extern int
    disfluid_compute_cache_key (const char *request_scheme,
				const char *request_header,
				const char *response_header,
				size_t max_key, char *key);

  /**
   * disfluid_hash_primary_cache_key:
   * @method: the request method, such as 'GET'.
   * @uri: the request URI.
   * @password: (nullable) (array length=password_length)
   * (element-type char): an optional password. If set, the hash
   * cannot be figured out without it.
   * @hash: (array length=max_hash) (element-type char): the
   * destination hash.
   *
   * Returns: 0 on success, or a negative error number.
   */
  DISFLUID_API extern int
    disfluid_hash_primary_cache_key (const char *method,
				     const char *uri,
				     const char *password,
				     size_t password_length,
				     size_t max_hash, char *hash);

  /**
   * disfluid_greet_world:
   *
   * Returns: a greeting in the user’s language.
   */
  DISFLUID_API const char *disfluid_greet_world (void);

  /**
   * disfluid_metaphor_name:
   *
   * Returns: a GNOME metaphor name for the application.
   */
  DISFLUID_API const char *disfluid_metaphor_name (void);

# ifdef __cplusplus
}
# endif				/* __cplusplus */

# include <disfluid/cache_entry.h>

#endif				/* not H_DISFLUID_INCLUDED */