Blame intl/po2test.awk

Packit 6c4009
# po2test.awk - Convert Uniforum style .po file to C code for testing.
Packit 6c4009
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
Packit 6c4009
#
Packit 6c4009
# This program is free software; you can redistribute it and/or modify
Packit 6c4009
# it under the terms of the GNU General Public License as published by
Packit 6c4009
# the Free Software Foundation; either version 2, or (at your option)
Packit 6c4009
# any later version.
Packit 6c4009
#
Packit 6c4009
# This program is distributed in the hope that it will be useful,
Packit 6c4009
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 6c4009
# GNU General Public License for more details.
Packit 6c4009
#
Packit 6c4009
# You should have received a copy of the GNU General Public License
Packit 6c4009
# along with this program; if not, see <http://www.gnu.org/licenses/>.
Packit 6c4009
#
Packit 6c4009
Packit 6c4009
# Output current message (in msg) as argument of the INPUT or OUTPUT macro,
Packit 6c4009
# depending on msgtype
Packit 6c4009
function output_message() {
Packit 6c4009
    # Ignore messages containing <PRI.*> markers which would have to be
Packit 6c4009
    # replaced by the correct format depending on the word size
Packit 6c4009
    if (msg && msg !~ /<PRI.*>/)
Packit 6c4009
	printf ("%s(%s)\n", msgtype == "msgid" ? "INPUT" : "OUTPUT", msg)
Packit 6c4009
    msg = 0
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
$1 ~ /msg(id|str)/ {
Packit 6c4009
    # Output collected message
Packit 6c4009
    output_message()
Packit 6c4009
    # Collect next message
Packit 6c4009
    msgtype = $1
Packit 6c4009
    sub(/^msg(id|str)[ \t]*/, "", $0)
Packit 6c4009
    msg = $0
Packit 6c4009
    next
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
/^".*"/ {
Packit 6c4009
    # Append to current message
Packit 6c4009
    msg = msg "\n" $0
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
END {
Packit 6c4009
    # Output last collected message
Packit 6c4009
    output_message()
Packit 6c4009
}