test/kwbench.c, etc.: Tidy up and publish the keyword benchmark I used.
[sod] / test / kwbench-back.c
1 /* -*-c-*-
2 *
3 * Keyword benchmark, backend
4 *
5 * (c) 2019 Straylight/Edgeware
6 */
7
8 /*----- Licensing notice --------------------------------------------------*
9 *
10 * This file is part of the Sensible Object Design, an object system for C.
11 *
12 * SOD is free software: you can redistribute it and/or modify it under
13 * the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * SOD is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with SOD. If not, write to the Free Software Foundation, Inc.,
24 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 */
26
27 #include <stdarg.h>
28
29 #include "keyword.h"
30 #include "kwbench.h"
31
32 void kwbench_trivial(struct myobject *obj, int x, int y, int z)
33 { obj->x = x; obj->y = y; obj->z = z; }
34
35 #define kwbench_KWSET(_) \
36 _(int, x, 0) \
37 _(int, y, 0) \
38 _(int, z, 0)
39 KWSET_STRUCT(kwbench);
40 static KWSET_PARSEFN(kwbench)
41 KWCALL void kwbench_keywords(struct myobject *obj, KWTAIL)
42 {
43 KWPARSE(kwbench);
44 obj->x = kw.x; obj->y = kw.y; obj->z = kw.z;
45 }
46
47 /*----- That's all, folks -------------------------------------------------*/