Commit | Line | Data |
---|---|---|
9e91c8e7 MW |
1 | /* -*-c-*- |
2 | * | |
3 | * Keyword-argument support functions requiring a hosted implementation | |
4 | * | |
5 | * (c) 2015 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 | |
13 | * it under the terms of the GNU Library General Public License as | |
14 | * published by the Free Software Foundation; either version 2 of the | |
15 | * License, or (at your option) any later version. | |
16 | * | |
17 | * SOD is distributed in the hope that it will be useful, | |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | * GNU Library General Public License for more details. | |
21 | * | |
22 | * You should have received a copy of the GNU Library General Public | |
23 | * License along with SOD; if not, write to the Free | |
24 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, | |
25 | * MA 02111-1307, USA. | |
26 | */ | |
27 | ||
28 | /*----- Header files ------------------------------------------------------*/ | |
29 | ||
30 | #include <stdio.h> | |
31 | #include <stdlib.h> | |
32 | ||
33 | /*----- Main code ---------------------------------------------------------*/ | |
34 | ||
35 | /* --- @kw_defunknown@ --- * | |
36 | * | |
37 | * Arguments: @const char *set@ = keyword set name | |
38 | * @const char *kw@ = the offending keyword name | |
39 | * | |
40 | * Returns: Doesn't. | |
41 | * | |
42 | * Use: This is the default @kw_unkhook@ hook function. | |
43 | * | |
44 | * In a hosted implementation, this function reports an internal | |
45 | * error to stderr about the unknown keyword and calls @abort@. | |
46 | * It is an implementation responsibility for freestanding | |
47 | * implementations wanting to use this keyword argument | |
48 | * mechanism. | |
49 | */ | |
50 | ||
51 | void kw_defunknown(const char *set, const char *kw) | |
52 | { | |
53 | fprintf(stderr, "INTERNAL ERROR: unknown `%s' keyword argument `%s'\n", | |
54 | set, kw); | |
55 | abort(); | |
56 | } | |
57 | ||
58 | /* --- @kw__hookfailed@ --- * | |
59 | * | |
60 | * Arguments: --- | |
61 | * | |
62 | * Returns: Doesn't. | |
63 | * | |
64 | * Use: Called by @kw_unknown@ if the @kw_unkhook@ hook function | |
65 | * returns. | |
66 | * | |
67 | * User code is not expected to call this function. It exists | |
68 | * as an implementation respensibility for freestanding | |
69 | * implementations wanting to use this keyword argument | |
70 | * mechanism. | |
71 | */ | |
72 | ||
73 | void kw__hookfailed(void) | |
74 | { | |
75 | fprintf(stderr, "INTERNAL ERROR: `kw_unkhook' hook function returned\n"); | |
76 | abort(); | |
77 | } | |
78 | ||
79 | /*----- That's all, folks -------------------------------------------------*/ |