7 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
8 * Copyright (C) 2013, MinGW.org Project
11 * Public declarations for predefined diagnostic messages.
14 * This is free software. Permission is granted to copy, modify and
15 * redistribute this software, under the provisions of the GNU General
16 * Public License, Version 3, (or, at your option, any later version),
17 * as published by the Free Software Foundation; see the file COPYING
18 * for licensing details.
20 * Note, in particular, that this software is provided "as is", in the
21 * hope that it may prove useful, but WITHOUT WARRANTY OF ANY KIND; not
22 * even an implied WARRANTY OF MERCHANTABILITY, nor of FITNESS FOR ANY
23 * PARTICULAR PURPOSE. Under no circumstances will the author, or the
24 * MinGW Project, accept liability for any damages, however caused,
25 * arising from the use of this software.
30 /* Ensure that we can identify extern "C" interfaces,
31 * when compiling C++ code...
34 /* ...defining the following in the C++ case...
36 # define EXTERN_C extern "C"
37 # define BEGIN_C_DECLS extern "C" {
38 # define END_C_DECLS }
40 /* ...whilst ensuring that they have no effect in C.
43 # define BEGIN_C_DECLS
47 /* Within the interface definition, and its implementation, we need
48 * a mechanism to represent the "void" data type, which will become
49 * invisible at point of use.
54 /* Generic macros for defining both the message catalogue interface,
55 * and its default (embedded code level) implementation.
57 #define DMHMSG( SET, MSG ) dmhmsg_##SET##_##MSG( DMH_VOID )
58 #define MSGDEF( DEF, TXT ) const char *DMHMSG( DEF )GETMSG( DEF, TXT )
60 /* The following macro provides a convenience mechanism for referring
61 * to any message implementation via its symbolic ID.
63 #define DMHTXT( DEF ) DMHMSG( DEF )
65 /* Discriminate between interface (header file) and implementation...
67 #if DMHMSGS_IMPLEMENTATION
68 /* We are compiling the implementation; we need to set up _GETMSG,
69 * so that it generates a function body for each message reference...
73 /* ...directing the request to catgets(), to possibly retrieve the
74 * message text from an external catalogue, when NLS is enabled...
76 # define GETMSG( SET, MSG, TXT ) { return catgets( MSGCAT, SET, MSG, TXT ); }
79 /* ...otherwise, simply returning the default (compiled in) text.
81 # define GETMSG( SET, MSG, TXT ) { return TXT; }
85 /* ...this isn't implementation: we adjust the definition of _GETMSG,
86 * so that MSGDEF compiles as a function prototype.
88 # define GETMSG( SET, MSG, TXT ) ;
91 /* Each of the message definitions must be compiled with an extern "C"
96 /* Each individual message requires a definition for its catgets() ID tuple,
97 * (which identifies both set ID and message ID, as a comma separated pair),
98 * and an invocation of MSGDEF, to define the interface and implementation;
99 * this may also be accompanied by a further symbolic name definition, to
100 * facilitate references to the text provided by the implementation.
102 #define MSG_SPECIFICATION_ERROR 1, 1
103 MSGDEF( MSG_SPECIFICATION_ERROR, "internal package specification error\n" )
104 #define PKGMSG_SPECIFICATION_ERROR DMHTXT( MSG_SPECIFICATION_ERROR )
108 /* At point of use, we need DMH_VOID to represent nothing.
113 #endif /* DMHMSGS_H: $RCSfile$: end of file */