| 1 | %## -*-c-*- |
| 2 | %## |
| 3 | %## Skeleton source file for tables of crypto classes |
| 4 | %# |
| 5 | /* -*-c-*- GENERATED from gthingtab.c.in |
| 6 | * |
| 7 | * @{what}tab.c |
| 8 | */ |
| 9 | |
| 10 | #include <string.h> |
| 11 | |
| 12 | #include "@what.h" |
| 13 | |
| 14 | %repeat |
| 15 | #include "@{thing:left}.h" |
| 16 | %end |
| 17 | |
| 18 | const @cls *const @{what}tab[] = { |
| 19 | %repeat |
| 20 | &@{thing:right:c}, |
| 21 | %end |
| 22 | 0 |
| 23 | }; |
| 24 | |
| 25 | const @cls *@{what}_byname(const char *p) |
| 26 | { |
| 27 | const @cls *const *c; |
| 28 | |
| 29 | for (c = @{what}tab; *c; c++) |
| 30 | if (strcmp(p, (*c)->name) == 0) return (*c); |
| 31 | return (0); |
| 32 | } |