summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1998-09-20 17:49:35 +0000
committerjbj <devnull@localhost>1998-09-20 17:49:35 +0000
commit33e58c54f53e14e4f214153a40fa59f9b0ae07aa (patch)
tree4c844719ad902acb0d222063eef7981c5259dce4 /misc
parent0ba3a6c926b206f7bc48e6f3d9ae6ed3823dbdeb (diff)
downloadlibrpm-tizen-33e58c54f53e14e4f214153a40fa59f9b0ae07aa.tar.gz
librpm-tizen-33e58c54f53e14e4f214153a40fa59f9b0ae07aa.tar.bz2
librpm-tizen-33e58c54f53e14e4f214153a40fa59f9b0ae07aa.zip
Copies from gettext-0.10.35.
CVS patchset: 2331 CVS date: 1998/09/20 17:49:35
Diffstat (limited to 'misc')
-rw-r--r--misc/fstrcmp.h25
-rw-r--r--misc/libgettext.h182
-rw-r--r--misc/message.h129
-rw-r--r--misc/po-lex.h83
-rw-r--r--misc/str-list.h50
5 files changed, 469 insertions, 0 deletions
diff --git a/misc/fstrcmp.h b/misc/fstrcmp.h
new file mode 100644
index 000000000..04047171f
--- /dev/null
+++ b/misc/fstrcmp.h
@@ -0,0 +1,25 @@
+/* GNU gettext - internationalization aids
+ Copyright (C) 1995 Free Software Foundation, Inc.
+
+ This file was written by Peter Miller <pmiller@agso.gov.au>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _FSTRCMP_H
+#define _FSTRCMP_H
+
+double fstrcmp PARAMS ((const char *__s1, const char *__s2));
+
+#endif
diff --git a/misc/libgettext.h b/misc/libgettext.h
new file mode 100644
index 000000000..3a92960ae
--- /dev/null
+++ b/misc/libgettext.h
@@ -0,0 +1,182 @@
+/* Message catalogs for internationalization.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Because on some systems (e.g. Solaris) we sometimes have to include
+ the systems libintl.h as well as this file we have more complex
+ include protection above. But the systems header might perhaps also
+ define _LIBINTL_H and therefore we have to protect the definition here. */
+
+#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H
+#ifndef _LIBINTL_H
+# define _LIBINTL_H 1
+#endif
+#define _LIBGETTEXT_H 1
+
+/* We define an additional symbol to signal that we use the GNU
+ implementation of gettext. */
+#define __USE_GNU_GETTEXT 1
+
+#include <sys/types.h>
+
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* @@ end of prolog @@ */
+
+#ifndef PARAMS
+# if __STDC__ || defined __cplusplus
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif
+#endif
+
+#ifndef NULL
+# if !defined __cplusplus || defined __GNUC__
+# define NULL ((void *) 0)
+# else
+# define NULL (0)
+# endif
+#endif
+
+#if !HAVE_LC_MESSAGES
+/* This value determines the behaviour of the gettext() and dgettext()
+ function. But some system does not have this defined. Define it
+ to a default value. */
+# define LC_MESSAGES (-1)
+#endif
+
+
+/* Declarations for gettext-using-catgets interface. Derived from
+ Jim Meyering's libintl.h. */
+struct _msg_ent
+{
+ const char *_msg;
+ int _msg_number;
+};
+
+
+#if HAVE_CATGETS
+/* These two variables are defined in the automatically by po-to-tbl.sed
+ generated file `cat-id-tbl.c'. */
+extern const struct _msg_ent _msg_tbl[];
+extern int _msg_tbl_length;
+#endif
+
+
+/* For automatical extraction of messages sometimes no real
+ translation is needed. Instead the string itself is the result. */
+#define gettext_noop(Str) (Str)
+
+/* Look up MSGID in the current default message catalog for the current
+ LC_MESSAGES locale. If not found, returns MSGID itself (the default
+ text). */
+extern char *gettext PARAMS ((const char *__msgid));
+extern char *gettext__ PARAMS ((const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current
+ LC_MESSAGES locale. */
+extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
+extern char *dgettext__ PARAMS ((const char *__domainname,
+ const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+ locale. */
+extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
+ int __category));
+extern char *dcgettext__ PARAMS ((const char *__domainname,
+ const char *__msgid, int __category));
+
+
+/* Set the current default message catalog to DOMAINNAME.
+ If DOMAINNAME is null, return the current default.
+ If DOMAINNAME is "", reset to the default of "messages". */
+extern char *textdomain PARAMS ((const char *__domainname));
+extern char *textdomain__ PARAMS ((const char *__domainname));
+
+/* Specify that the DOMAINNAME message catalog will be found
+ in DIRNAME rather than in the system locale data base. */
+extern char *bindtextdomain PARAMS ((const char *__domainname,
+ const char *__dirname));
+extern char *bindtextdomain__ PARAMS ((const char *__domainname,
+ const char *__dirname));
+
+#if ENABLE_NLS
+
+/* Solaris 2.3 has the gettext function but dcgettext is missing.
+ So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4
+ has dcgettext. */
+# if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
+
+# define gettext(Msgid) \
+ dgettext (NULL, Msgid)
+
+# define dgettext(Domainname, Msgid) \
+ dcgettext (Domainname, Msgid, LC_MESSAGES)
+
+# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
+/* This global variable is defined in loadmsgcat.c. We need a sign,
+ whether a new catalog was loaded, which can be associated with all
+ translations. */
+extern int _nl_msg_cat_cntr;
+
+# define dcgettext(Domainname, Msgid, Category) \
+ (__extension__ \
+ ({ \
+ char *__result; \
+ if (__builtin_constant_p (Msgid)) \
+ { \
+ static char *__translation__; \
+ static int __catalog_counter__; \
+ if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
+ { \
+ __translation__ = \
+ dcgettext__ (Domainname, Msgid, Category); \
+ __catalog_counter__ = _nl_msg_cat_cntr; \
+ } \
+ __result = __translation__; \
+ } \
+ else \
+ __result = dcgettext__ (Domainname, Msgid, Category); \
+ __result; \
+ }))
+# endif
+# endif
+
+#else
+
+# define gettext(Msgid) (Msgid)
+# define dgettext(Domainname, Msgid) (Msgid)
+# define dcgettext(Domainname, Msgid, Category) (Msgid)
+# define textdomain(Domainname) ((char *) Domainname)
+# define bindtextdomain(Domainname, Dirname) ((char *) Dirname)
+
+#endif
+
+/* @@ begin of epilog @@ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/misc/message.h b/misc/message.h
new file mode 100644
index 000000000..149b8b388
--- /dev/null
+++ b/misc/message.h
@@ -0,0 +1,129 @@
+/* GNU gettext - internationalization aids
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+
+ This file was written by Peter Miller <millerp@canb.auug.org.au>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free SoftwareFoundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _MESSAGE_H
+#define _MESSAGE_H
+
+#include "po-lex.h"
+#include "str-list.h"
+
+/* According to Sun's Uniforum proposal the default message domain is
+ named `messages'. */
+#define MESSAGE_DOMAIN_DEFAULT "messages"
+
+
+/* Is current msgid a format string? */
+enum is_c_format
+{
+ undecided,
+ yes,
+ no,
+ possible,
+ impossible
+};
+
+typedef struct message_variant_ty message_variant_ty;
+struct message_variant_ty
+{
+ const char *domain;
+ lex_pos_ty pos;
+ const char *msgstr;
+};
+
+typedef struct message_ty message_ty;
+struct message_ty
+{
+ /* Plain comments (#) appearing before the message. */
+ string_list_ty *comment;
+
+ /* Extracted comments (#.) appearing before the message. */
+ string_list_ty *comment_dot;
+
+ /* File position comments (#:) appearing before the message, one for
+ each unique file position instance, sorted by file name and then
+ by line. */
+ size_t filepos_count;
+ lex_pos_ty *filepos;
+
+ /* Informations from special comments (e.g. generated by msgmerge). */
+ int is_fuzzy;
+ enum is_c_format is_c_format;
+
+ /* Do we want the string to be wrapped in the emitted PO file? */
+ enum is_c_format do_wrap;
+
+ /* The msgid string. */
+ const char *msgid;
+
+ /* The msgstr strings, one for each observed domain in the file. */
+ size_t variant_count;
+ message_variant_ty *variant;
+
+ /* Used for checking that messages have been used, in the msgcmp and
+ msgmerge programs. */
+ int used;
+
+ /* If set the message is obsolete and while writing out it should be
+ commented out. */
+ int obsolete;
+};
+
+message_ty *message_alloc PARAMS ((char *msgid));
+void message_free PARAMS ((message_ty *));
+
+message_variant_ty *message_variant_search PARAMS ((message_ty *mp,
+ const char *domain));
+void message_variant_append PARAMS ((message_ty *mp, const char *domain,
+ const char *msgstr,
+ const lex_pos_ty *pp));
+void message_comment_append PARAMS ((message_ty *, const char *));
+void message_comment_dot_append PARAMS ((message_ty *, const char *));
+message_ty *message_copy PARAMS ((message_ty *));
+message_ty *message_merge PARAMS ((message_ty *def, message_ty *ref));
+void message_comment_filepos PARAMS ((message_ty *, const char *, size_t));
+void message_print_style_indent PARAMS ((void));
+void message_print_style_uniforum PARAMS ((void));
+void message_print_style_escape PARAMS ((int));
+
+
+typedef struct message_list_ty message_list_ty;
+struct message_list_ty
+{
+ message_ty **item;
+ size_t nitems;
+ size_t nitems_max;
+};
+
+message_list_ty *message_list_alloc PARAMS ((void));
+void message_list_free PARAMS ((message_list_ty *));
+void message_list_append PARAMS ((message_list_ty *, message_ty *));
+void message_list_delete_nth PARAMS ((message_list_ty *, size_t));
+message_ty *message_list_search PARAMS ((message_list_ty *, const char *));
+message_ty *message_list_search_fuzzy PARAMS ((message_list_ty *,
+ const char *));
+void message_list_print PARAMS ((message_list_ty *, const char *, int, int));
+void message_list_sort_by_msgid PARAMS ((message_list_ty *));
+void message_list_sort_by_filepos PARAMS ((message_list_ty *));
+
+enum is_c_format parse_c_format_description_string PARAMS ((const char *s));
+enum is_c_format parse_c_width_description_string PARAMS ((const char *s));
+int possible_c_format_p PARAMS ((enum is_c_format));
+void message_page_width_set PARAMS ((size_t width));
+
+#endif /* message.h */
diff --git a/misc/po-lex.h b/misc/po-lex.h
new file mode 100644
index 000000000..fd95d9749
--- /dev/null
+++ b/misc/po-lex.h
@@ -0,0 +1,83 @@
+/* GNU gettext - internationalization aids
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+
+ This file was written by Peter Miller <millerp@canb.auug.org.au>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _PO_LEX_H
+#define _PO_LEX_H
+
+#include <sys/types.h>
+#include "error.h"
+
+typedef struct lex_pos_ty lex_pos_ty;
+struct lex_pos_ty
+{
+ char *file_name;
+ size_t line_number;
+};
+
+
+/* Global variables from po-lex.c. */
+extern lex_pos_ty gram_pos;
+extern size_t gram_max_allowed_errors;
+
+
+void lex_open PARAMS ((const char *__fname));
+void lex_close PARAMS ((void));
+int po_gram_lex PARAMS ((void));
+void po_lex_pass_comments PARAMS ((int __flag));
+void po_lex_pass_obsolete_entries PARAMS ((int __flag));
+
+
+/* GCC is smart enough to allow optimizations like this. */
+#if __STDC__ && defined __GNUC__ && __GNUC__ >= 2
+
+
+/* CAUTION: If you change this macro, you must also make identical
+ changes to the function of the same name in src/po-lex.c */
+
+# define po_gram_error(fmt, args...) \
+ do { \
+ error_at_line (0, 0, gram_pos.file_name, gram_pos.line_number, \
+ fmt, ## args); \
+ if (*fmt == '.') \
+ --error_message_count; \
+ else if (error_message_count >= gram_max_allowed_errors) \
+ error (1, 0, _("too many errors, aborting")); \
+ } while (0)
+
+
+/* CAUTION: If you change this macro, you must also make identical
+ changes to the function of the same name in src/po-lex.c */
+
+# define gram_error_at_line(pos, fmt, args...) \
+ do { \
+ error_at_line (0, 0, (pos)->file_name, (pos)->line_number, \
+ fmt, ## args); \
+ if (*fmt == '.') \
+ --error_message_count; \
+ else if (error_message_count >= gram_max_allowed_errors) \
+ error (1, 0, _("too many errors, aborting")); \
+ } while (0)
+#else
+void po_gram_error PARAMS ((const char *__fmt, ...));
+void gram_error_at_line PARAMS ((const lex_pos_ty *__pos, const char *__fmt,
+ ...));
+#endif
+
+
+#endif
diff --git a/misc/str-list.h b/misc/str-list.h
new file mode 100644
index 000000000..9e2b99817
--- /dev/null
+++ b/misc/str-list.h
@@ -0,0 +1,50 @@
+/* GNU gettext - internationalization aids
+ Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
+
+ This file was written by Peter Miller <millerp@canb.auug.org.au>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef SRC_STR_LIST_H
+#define SRC_STR_LIST_H 1
+
+#ifdef STC_HEADERS
+# define __need_size_t
+# define __need_NULL
+# include <stddef.h>
+#else
+# include <sys/types.h>
+# include <stdio.h>
+#endif
+
+/* Type describing list of strings implemented using a dynamic array. */
+typedef struct string_list_ty string_list_ty;
+struct string_list_ty
+{
+ const char **item;
+ size_t nitems;
+ size_t nitems_max;
+};
+
+
+string_list_ty *string_list_alloc PARAMS ((void));
+void string_list_append PARAMS ((string_list_ty *__slp, const char *__s));
+void string_list_append_unique PARAMS ((string_list_ty *__slp,
+ const char *__s));
+void string_list_free PARAMS ((string_list_ty *__slp));
+char *string_list_join PARAMS ((const string_list_ty *__slp));
+int string_list_member PARAMS ((const string_list_ty *__slp, const char *__s));
+
+#endif