1
/* mp4h -- A macro processor for HTML documents
2
Copyright 2000-2003, Denis Barbier
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2, or (at your option)
10
This program is a work based on GNU m4 version 1.4n. Below is the
13
/* GNU m4 -- A simple macro processor
14
Copyright (C) 1998 Free Software Foundation, Inc.
16
This program is free software; you can redistribute it and/or modify
17
it under the terms of the GNU General Public License as published by
18
the Free Software Foundation; either version 2, or (at your option)
21
This program is distributed in the hope that it will be useful,
22
but WITHOUT ANY WARRANTY; without even the implied warranty of
23
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
GNU General Public License for more details.
26
You should have received a copy of the GNU General Public License
27
along with this program; if not, write to the Free Software
28
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
37
#define mp4h_macro_table gettext_LTX_mp4h_macro_table
38
#define mp4h_init_module gettext_LTX_mp4h_init_module
39
#define mp4h_finish_module gettext_LTX_mp4h_finish_module
41
module_init_t mp4h_init_module; /* initialisation function */
42
module_finish_t mp4h_finish_module; /* cleanup function */
44
DECLARE(mp4m_intl_textdomain);
45
DECLARE(mp4m_intl_bindtextdomain);
46
DECLARE(mp4m_intl_bind_textdomain_codeset);
47
DECLARE(mp4m_intl_gettext);
51
/* The table of builtins defined by this module - just one */
53
builtin mp4h_macro_table[] =
55
/* name container expand function
58
{ "textdomain", FALSE, TRUE, mp4m_intl_textdomain },
59
{ "bindtextdomain", FALSE, TRUE, mp4m_intl_bindtextdomain },
60
{ "bind_textdomain_codeset",
61
FALSE, TRUE, mp4m_intl_bind_textdomain_codeset },
62
{ "gettext", TRUE, TRUE, mp4m_intl_gettext },
63
{ 0, FALSE, FALSE, 0 },
67
mp4h_init_module(struct obstack *obs)
72
mp4h_finish_module(void)
76
/* The functions for builtins can be static */
79
mp4m_intl_textdomain (MP4H_BUILTIN_ARGS)
83
domain = predefined_attribute ("domain", &argc, argv, FALSE);
86
MP4HERROR ((warning_status, 0,
87
_("Warning:%s:%d: In <%s>, required attribute `%s' is not specified"),
88
CURRENT_FILE_LINE, ARG (0), "domain"));
95
mp4m_intl_bindtextdomain (MP4H_BUILTIN_ARGS)
97
const char *domain, *path;
99
domain = predefined_attribute ("domain", &argc, argv, FALSE);
100
path = predefined_attribute ("path", &argc, argv, FALSE);
103
MP4HERROR ((warning_status, 0,
104
_("Warning:%s:%d: In <%s>, required attribute `%s' is not specified"),
105
CURRENT_FILE_LINE, ARG (0), "domain"));
110
MP4HERROR ((warning_status, 0,
111
_("Warning:%s:%d: In <%s>, required attribute `%s' is not specified"),
112
CURRENT_FILE_LINE, ARG (0), "path"));
115
bindtextdomain (domain, path);
119
mp4m_intl_bind_textdomain_codeset (MP4H_BUILTIN_ARGS)
121
const char *domain, *codeset;
123
domain = predefined_attribute ("domain", &argc, argv, FALSE);
124
codeset = predefined_attribute ("codeset", &argc, argv, FALSE);
127
MP4HERROR ((warning_status, 0,
128
_("Warning:%s:%d: In <%s>, required attribute `%s' is not specified"),
129
CURRENT_FILE_LINE, ARG (0), "domain"));
134
MP4HERROR ((warning_status, 0,
135
_("Warning:%s:%d: In <%s>, required attribute `%s' is not specified"),
136
CURRENT_FILE_LINE, ARG (0), "codeset"));
139
bind_textdomain_codeset (domain, codeset);
143
mp4m_intl_gettext (MP4H_BUILTIN_ARGS)
148
domain = predefined_attribute ("domain", &argc, argv, FALSE);
149
for (cp = ARGBODY; *cp != '\0'; cp++)
150
if (CHAR_SLASH == *cp)
154
msgstr = dgettext(domain, ARGBODY);
156
msgstr = gettext(ARGBODY);
157
obstack_grow (obs, msgstr, strlen (msgstr));