mirror of
https://github.com/openharmony/third_party_gettext.git
synced 2026-07-01 10:25:03 -04:00
xgettext: Define alternate parser signature for the Ruby support.
* gettext-tools/src/xgettext.c (extract_from_stream_func): Renamed from extractor_func. (extract_from_file_func): New type. (struct extractor_ty): Rename field func to extract_from_stream. New field extract_from_file. (main): Consider both fields. (xgettext_find_file): New function. (extract_from_file): Add alternative code for when the other extraction function is defined. (language_to_extractor): In the table, rename field func to extract_from_stream, and add new field extract_from_file. * gettext-tools/src/x-*.h (SCANNERS_*): Update.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* xgettext AppData file backend.
|
||||
Copyright (C) 2002-2003, 2006, 2013, 2015, 2017-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2013, 2015, 2017-2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Philip Withnall <philip.withnall@collabora.co.uk>, 2015.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
#define EXTENSIONS_APPDATA
|
||||
|
||||
#define SCANNERS_APPDATA \
|
||||
{ "appdata", NULL, NULL, NULL, NULL },
|
||||
{ "appdata", NULL, NULL, NULL, NULL, NULL },
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext awk backend.
|
||||
Copyright (C) 2002-2003, 2006, 2014-2015, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2014-2015, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2002.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -33,7 +33,7 @@ extern "C" {
|
||||
{ "twjr", "awk" }, \
|
||||
|
||||
#define SCANNERS_AWK \
|
||||
{ "awk", extract_awk, \
|
||||
{ "awk", extract_awk, NULL, \
|
||||
&flag_table_awk, &formatstring_awk, NULL }, \
|
||||
|
||||
/* Scan an awk file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext C/C++/ObjectiveC backend.
|
||||
Copyright (C) 2001-2003, 2006, 2009, 2014-2015, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2003, 2006, 2009, 2014-2015, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -41,16 +41,16 @@ extern "C" {
|
||||
{ "m", "ObjectiveC" }, \
|
||||
|
||||
#define SCANNERS_C \
|
||||
{ "C", extract_c, \
|
||||
{ "C", extract_c, NULL, \
|
||||
&flag_table_c, \
|
||||
&formatstring_c, NULL }, \
|
||||
{ "C++", extract_cxx, \
|
||||
{ "C++", extract_cxx, NULL, \
|
||||
&flag_table_c, \
|
||||
&formatstring_c, NULL }, \
|
||||
{ "ObjectiveC", extract_objc, \
|
||||
{ "ObjectiveC", extract_objc, NULL, \
|
||||
&flag_table_objc, \
|
||||
&formatstring_c, &formatstring_objc }, \
|
||||
{ "GCC-source", extract_c, \
|
||||
{ "GCC-source", extract_c, NULL, \
|
||||
&flag_table_gcc_internal, \
|
||||
&formatstring_gcc_internal, &formatstring_gfc_internal }, \
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext C# backend.
|
||||
Copyright (C) 2003-2004, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2004, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "cs", "C#" }, \
|
||||
|
||||
#define SCANNERS_CSHARP \
|
||||
{ "C#", extract_csharp, \
|
||||
{ "C#", extract_csharp, NULL, \
|
||||
&flag_table_csharp, &formatstring_csharp, NULL }, \
|
||||
|
||||
extern void extract_csharp (FILE *fp, const char *real_filename,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Desktop Entry backend.
|
||||
Copyright (C) 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Daiki Ueno <ueno@gnu.org>, 2014.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "desktop", "Desktop" }, \
|
||||
|
||||
#define SCANNERS_DESKTOP \
|
||||
{ "Desktop", extract_desktop, NULL, NULL, NULL }, \
|
||||
{ "Desktop", extract_desktop, NULL, NULL, NULL, NULL }, \
|
||||
|
||||
/* Scan a Desktop Entry file and add its translatable strings to mdlp. */
|
||||
extern void extract_desktop (FILE *fp, const char *real_filename,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Emacs Lisp backend.
|
||||
Copyright (C) 2002-2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2002.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "el", "EmacsLisp" }, \
|
||||
|
||||
#define SCANNERS_ELISP \
|
||||
{ "EmacsLisp", extract_elisp, \
|
||||
{ "EmacsLisp", extract_elisp, NULL, \
|
||||
&flag_table_elisp, &formatstring_elisp, NULL }, \
|
||||
|
||||
/* Scan an Emacs Lisp file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext glade backend.
|
||||
Copyright (C) 2002-2003, 2006, 2013-2015, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2013-2015, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2002.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -36,7 +36,7 @@ extern "C" {
|
||||
{ "ui", NULL }, \
|
||||
|
||||
#define SCANNERS_GLADE \
|
||||
{ "glade", NULL, NULL, NULL, NULL }, \
|
||||
{ "glade", NULL, NULL, NULL, NULL, NULL }, \
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext GSettings schema file backend.
|
||||
Copyright (C) 2002-2003, 2006, 2013-2015, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2013-2015, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Daiki Ueno <ueno@gnu.org>, 2013.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -33,7 +33,7 @@ extern "C" {
|
||||
{ "gschema.xml", NULL }, \
|
||||
|
||||
#define SCANNERS_GSETTINGS \
|
||||
{ "gsettings", NULL, NULL, NULL, NULL }, \
|
||||
{ "gsettings", NULL, NULL, NULL, NULL, NULL }, \
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Java backend.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018-2020 Free Software Foundation, Inc.
|
||||
Written by Tommy Johansson <tommy.johansson@kanalen.org>, 2001.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "java", "Java" }, \
|
||||
|
||||
#define SCANNERS_JAVA \
|
||||
{ "Java", extract_java, \
|
||||
{ "Java", extract_java, NULL, \
|
||||
&flag_table_java, \
|
||||
&formatstring_java, &formatstring_java_printf }, \
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext JavaScript backend.
|
||||
Copyright (C) 2002-2003, 2006, 2010, 2013-2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2010, 2013-2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
This file was written by Andreas Stricker <andy@knitter.ch>, 2010.
|
||||
It's based on x-python from Bruno Haible.
|
||||
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
{ "js", "JavaScript" }, \
|
||||
|
||||
#define SCANNERS_JAVASCRIPT \
|
||||
{ "JavaScript", extract_javascript, \
|
||||
{ "JavaScript", extract_javascript, NULL, \
|
||||
&flag_table_javascript, &formatstring_javascript, NULL }, \
|
||||
|
||||
/* Scan a Python file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext librep backend.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "jl", "librep" }, \
|
||||
|
||||
#define SCANNERS_LIBREP \
|
||||
{ "librep", extract_librep, \
|
||||
{ "librep", extract_librep, NULL, \
|
||||
&flag_table_librep, &formatstring_librep, NULL }, \
|
||||
|
||||
/* Scan a librep file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Lisp backend.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "lisp", "Lisp" }, \
|
||||
|
||||
#define SCANNERS_LISP \
|
||||
{ "Lisp", extract_lisp, \
|
||||
{ "Lisp", extract_lisp, NULL, \
|
||||
&flag_table_lisp, &formatstring_lisp, NULL }, \
|
||||
|
||||
/* Scan a Lisp file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Lua backend.
|
||||
Copyright (C) 2011-2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2011-2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Ľubomír Remák <lubomirrk@lubomirr.eu>, 2011
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C"
|
||||
{ "lua", "Lua" }, \
|
||||
|
||||
#define SCANNERS_LUA \
|
||||
{ "Lua", extract_lua, \
|
||||
{ "Lua", extract_lua, NULL, \
|
||||
&flag_table_lua, &formatstring_lua, NULL }, \
|
||||
|
||||
/* Scan a Lua file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Perl backend.
|
||||
Copyright (C) 2002-2003, 2006, 2010, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2010, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Guido Flohr <guido@imperia.net>, 2002-2003
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -35,7 +35,7 @@ extern "C" {
|
||||
{ "cgi", "perl" }, \
|
||||
|
||||
#define SCANNERS_PERL \
|
||||
{ "perl", extract_perl, \
|
||||
{ "perl", extract_perl, NULL, \
|
||||
&flag_table_perl, &formatstring_perl, &formatstring_perl_brace }, \
|
||||
|
||||
/* Scan a Perl file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext PHP backend.
|
||||
Copyright (C) 2002-2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2002.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -33,7 +33,7 @@ extern "C" {
|
||||
{ "php4", "PHP" }, \
|
||||
|
||||
#define SCANNERS_PHP \
|
||||
{ "PHP", extract_php, \
|
||||
{ "PHP", extract_php, NULL, \
|
||||
&flag_table_php, &formatstring_php, NULL }, \
|
||||
|
||||
/* Scan a PHP file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext PO backend.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
{ "pot", "PO" }, \
|
||||
|
||||
#define SCANNERS_PO \
|
||||
{ "PO", extract_po, NULL, NULL, NULL }, \
|
||||
{ "PO", extract_po, NULL, NULL, NULL, NULL }, \
|
||||
|
||||
/* Scan a PO file and add its translatable strings to mdlp. */
|
||||
extern void extract_po (FILE *fp, const char *real_filename,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext JavaProperties backend.
|
||||
Copyright (C) 2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "properties", "JavaProperties" }, \
|
||||
|
||||
#define SCANNERS_PROPERTIES \
|
||||
{ "JavaProperties", extract_properties, NULL, NULL, NULL }, \
|
||||
{ "JavaProperties", extract_properties, NULL, NULL, NULL, NULL }, \
|
||||
|
||||
/* Scan a JavaProperties file and add its translatable strings to mdlp. */
|
||||
extern void extract_properties (FILE *fp, const char *real_filename,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Python backend.
|
||||
Copyright (C) 2002-2003, 2006, 2013-2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2013-2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2002.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "py", "Python" }, \
|
||||
|
||||
#define SCANNERS_PYTHON \
|
||||
{ "Python", extract_python, \
|
||||
{ "Python", extract_python, NULL, \
|
||||
&flag_table_python, &formatstring_python, &formatstring_python_brace }, \
|
||||
|
||||
/* Scan a Python file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext RST/RSJ backend.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -32,9 +32,9 @@ extern "C" {
|
||||
{ "rsj", "RSJ" }, \
|
||||
|
||||
#define SCANNERS_RST \
|
||||
{ "RST", extract_rst, \
|
||||
{ "RST", extract_rst, NULL, \
|
||||
NULL, &formatstring_pascal, NULL }, \
|
||||
{ "RSJ", extract_rsj, \
|
||||
{ "RSJ", extract_rsj, NULL, \
|
||||
NULL, &formatstring_pascal, NULL }, \
|
||||
|
||||
/* Scan an RST file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Scheme backend.
|
||||
Copyright (C) 2004, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2004, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2004.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "scm", "Scheme" }, \
|
||||
|
||||
#define SCANNERS_SCHEME \
|
||||
{ "Scheme", extract_scheme, \
|
||||
{ "Scheme", extract_scheme, NULL, \
|
||||
&flag_table_scheme, &formatstring_scheme, NULL }, \
|
||||
|
||||
/* Scan a Scheme file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext sh backend.
|
||||
Copyright (C) 2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
{ "bash", "Shell" }, \
|
||||
|
||||
#define SCANNERS_SH \
|
||||
{ "Shell", extract_sh, \
|
||||
{ "Shell", extract_sh, NULL, \
|
||||
&flag_table_sh, &formatstring_sh, NULL }, \
|
||||
|
||||
/* Scan a shell script file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Smalltalk backend.
|
||||
Copyright (C) 2002-2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2002.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "st", "Smalltalk" }, \
|
||||
|
||||
#define SCANNERS_SMALLTALK \
|
||||
{ "Smalltalk", extract_smalltalk, \
|
||||
{ "Smalltalk", extract_smalltalk, NULL, \
|
||||
NULL, &formatstring_smalltalk, NULL }, \
|
||||
|
||||
/* Scan a Smalltalk file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext NXStringTable backend.
|
||||
Copyright (C) 2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "strings", "NXStringTable" }, \
|
||||
|
||||
#define SCANNERS_STRINGTABLE \
|
||||
{ "NXStringTable", extract_stringtable, NULL, NULL, NULL }, \
|
||||
{ "NXStringTable", extract_stringtable, NULL, NULL, NULL, NULL }, \
|
||||
|
||||
/* Scan an NXStringTable file and add its translatable strings to mdlp. */
|
||||
extern void extract_stringtable (FILE *fp, const char *real_filename,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Tcl Lisp backend.
|
||||
Copyright (C) 2002-2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2002.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "tcl", "Tcl" }, \
|
||||
|
||||
#define SCANNERS_TCL \
|
||||
{ "Tcl", extract_tcl, \
|
||||
{ "Tcl", extract_tcl, NULL, \
|
||||
&flag_table_tcl, &formatstring_tcl, NULL }, \
|
||||
|
||||
/* Scan a Tcl file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext Vala backend.
|
||||
Copyright (C) 2002-2003, 2006, 2013-2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2013-2014, 2018, 2020 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
|
||||
@@ -30,7 +30,7 @@ extern "C" {
|
||||
{ "vala", "Vala" }, \
|
||||
|
||||
#define SCANNERS_VALA \
|
||||
{ "Vala", extract_vala, \
|
||||
{ "Vala", extract_vala, NULL, \
|
||||
&flag_table_vala, &formatstring_c, NULL }, \
|
||||
|
||||
/* Scan a Vala file and add its translatable strings to mdlp. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xgettext YCP backend.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2003, 2006, 2014, 2018, 2020 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
{ "ycp", "YCP" }, \
|
||||
|
||||
#define SCANNERS_YCP \
|
||||
{ "YCP", extract_ycp, \
|
||||
{ "YCP", extract_ycp, NULL, \
|
||||
&flag_table_ycp, &formatstring_ycp, NULL }, \
|
||||
|
||||
/* Scan an YCP file and add its translatable strings to mdlp. */
|
||||
|
||||
+106
-25
@@ -269,18 +269,26 @@ static const struct option long_options[] =
|
||||
};
|
||||
|
||||
|
||||
/* The extractors must all be functions returning void and taking three
|
||||
arguments designating the input stream and one message domain list argument
|
||||
in which to add the messages. */
|
||||
typedef void (*extractor_func) (FILE *fp, const char *real_filename,
|
||||
const char *logical_filename,
|
||||
flag_context_list_table_ty *flag_table,
|
||||
msgdomain_list_ty *mdlp);
|
||||
/* The extractors must all be functions returning void and taking as arguments
|
||||
- the file name or file stream,
|
||||
- the flag table,
|
||||
- a message domain list argument in which to add the messages.
|
||||
An extract_from_stream_func is preferred, because it supports extracting from
|
||||
stdin. */
|
||||
typedef void (*extract_from_stream_func) (FILE *fp, const char *real_filename,
|
||||
const char *logical_filename,
|
||||
flag_context_list_table_ty *flag_table,
|
||||
msgdomain_list_ty *mdlp);
|
||||
typedef void (*extract_from_file_func) (const char *real_filename,
|
||||
const char *logical_filename,
|
||||
flag_context_list_table_ty *flag_table,
|
||||
msgdomain_list_ty *mdlp);
|
||||
|
||||
typedef struct extractor_ty extractor_ty;
|
||||
struct extractor_ty
|
||||
{
|
||||
extractor_func func;
|
||||
extract_from_stream_func extract_from_stream;
|
||||
extract_from_file_func extract_from_file;
|
||||
flag_context_list_table_ty *flag_table;
|
||||
struct formatstring_parser *formatstring_parser1;
|
||||
struct formatstring_parser *formatstring_parser2;
|
||||
@@ -829,7 +837,7 @@ xgettext cannot work without keywords to look for"));
|
||||
|
||||
filename = file_list->item[i];
|
||||
|
||||
if (extractor.func)
|
||||
if (extractor.extract_from_stream || extractor.extract_from_file)
|
||||
this_file_extractor = extractor;
|
||||
else if (explicit_its_filename != NULL)
|
||||
{
|
||||
@@ -1692,6 +1700,65 @@ savable_comment_to_xgettext_comment (refcounted_string_list_ty *rslp)
|
||||
}
|
||||
|
||||
|
||||
/* xgettext_find_file and xgettext_open look up a file, taking into account
|
||||
the --directory options.
|
||||
xgettext_find_file merely returns the file name. This function is useful
|
||||
for parsers implemented as separate programs.
|
||||
xgettext_open returns the open file stream. This function is useful for
|
||||
built-in parsers. */
|
||||
|
||||
static void
|
||||
xgettext_find_file (const char *fn,
|
||||
char **logical_file_name_p, char **real_file_name_p)
|
||||
{
|
||||
char *new_name;
|
||||
char *logical_file_name;
|
||||
struct stat statbuf;
|
||||
|
||||
/* We cannot handle "-" here. "/dev/fd/0" is not portable, and it cannot
|
||||
be opened multiple times. */
|
||||
if (IS_RELATIVE_FILE_NAME (fn))
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = 0; ; ++j)
|
||||
{
|
||||
const char *dir = dir_list_nth (j);
|
||||
|
||||
if (dir == NULL)
|
||||
error (EXIT_FAILURE, ENOENT,
|
||||
_("error while opening \"%s\" for reading"), fn);
|
||||
|
||||
new_name = xconcatenated_filename (dir, fn, NULL);
|
||||
|
||||
if (stat (new_name, &statbuf) == 0)
|
||||
break;
|
||||
|
||||
if (errno != ENOENT)
|
||||
error (EXIT_FAILURE, errno,
|
||||
_("error while opening \"%s\" for reading"), new_name);
|
||||
free (new_name);
|
||||
}
|
||||
|
||||
/* Note that the NEW_NAME variable contains the actual file name
|
||||
and the logical file name is what is reported by xgettext. In
|
||||
this case NEW_NAME is set to the file which was found along the
|
||||
directory search path, and LOGICAL_FILE_NAME is is set to the
|
||||
file name which was searched for. */
|
||||
logical_file_name = xstrdup (fn);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_name = xstrdup (fn);
|
||||
if (stat (fn, &statbuf) != 0)
|
||||
error (EXIT_FAILURE, errno,
|
||||
_("error while opening \"%s\" for reading"), fn);
|
||||
logical_file_name = xstrdup (new_name);
|
||||
}
|
||||
|
||||
*logical_file_name_p = logical_file_name;
|
||||
*real_file_name_p = new_name;
|
||||
}
|
||||
|
||||
static FILE *
|
||||
xgettext_open (const char *fn,
|
||||
@@ -1767,25 +1834,37 @@ extract_from_file (const char *file_name, extractor_ty extractor,
|
||||
{
|
||||
char *logical_file_name;
|
||||
char *real_file_name;
|
||||
FILE *fp = xgettext_open (file_name, &logical_file_name, &real_file_name);
|
||||
|
||||
/* Set the default for the source file encoding. May be overridden by
|
||||
the extractor function. */
|
||||
xgettext_current_source_encoding =
|
||||
(xgettext_global_source_encoding != NULL ? xgettext_global_source_encoding :
|
||||
po_charset_ascii);
|
||||
#if HAVE_ICONV
|
||||
xgettext_current_source_iconv = xgettext_global_source_iconv;
|
||||
#endif
|
||||
|
||||
current_formatstring_parser1 = extractor.formatstring_parser1;
|
||||
current_formatstring_parser2 = extractor.formatstring_parser2;
|
||||
current_formatstring_parser3 = extractor.formatstring_parser3;
|
||||
extractor.func (fp, real_file_name, logical_file_name, extractor.flag_table,
|
||||
mdlp);
|
||||
|
||||
if (fp != stdin)
|
||||
fclose (fp);
|
||||
if (extractor.extract_from_stream)
|
||||
{
|
||||
FILE *fp = xgettext_open (file_name, &logical_file_name, &real_file_name);
|
||||
|
||||
/* Set the default for the source file encoding. May be overridden by
|
||||
the extractor function. */
|
||||
xgettext_current_source_encoding =
|
||||
(xgettext_global_source_encoding != NULL ? xgettext_global_source_encoding :
|
||||
po_charset_ascii);
|
||||
#if HAVE_ICONV
|
||||
xgettext_current_source_iconv = xgettext_global_source_iconv;
|
||||
#endif
|
||||
|
||||
extractor.extract_from_stream (fp, real_file_name, logical_file_name,
|
||||
extractor.flag_table, mdlp);
|
||||
|
||||
if (fp != stdin)
|
||||
fclose (fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
xgettext_find_file (file_name, &logical_file_name, &real_file_name);
|
||||
|
||||
extractor.extract_from_file (real_file_name, logical_file_name,
|
||||
extractor.flag_table, mdlp);
|
||||
}
|
||||
free (logical_file_name);
|
||||
free (real_file_name);
|
||||
}
|
||||
@@ -2020,7 +2099,8 @@ language_to_extractor (const char *name)
|
||||
struct table_ty
|
||||
{
|
||||
const char *name;
|
||||
extractor_func func;
|
||||
extract_from_stream_func extract_from_stream;
|
||||
extract_from_file_func extract_from_file;
|
||||
flag_context_list_table_ty *flag_table;
|
||||
struct formatstring_parser *formatstring_parser1;
|
||||
struct formatstring_parser *formatstring_parser2;
|
||||
@@ -2066,7 +2146,8 @@ language_to_extractor (const char *name)
|
||||
{
|
||||
extractor_ty result;
|
||||
|
||||
result.func = tp->func;
|
||||
result.extract_from_stream = tp->extract_from_stream;
|
||||
result.extract_from_file = tp->extract_from_file;
|
||||
result.flag_table = tp->flag_table;
|
||||
result.formatstring_parser1 = tp->formatstring_parser1;
|
||||
result.formatstring_parser2 = tp->formatstring_parser2;
|
||||
|
||||
Reference in New Issue
Block a user