home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / tar-1.11.8-src.tgz / tar.out / fsf / tar / intl / po-to-tbl.sed < prev    next >
Text File  |  1996-09-28  |  2KB  |  91 lines

  1. # po-to-tbl.sed - Convert Uniforum style .po file to lookup table for catgets
  2. # Copyright (C) 1995 Free Software Foundation, Inc.
  3. # Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
  4. #
  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)
  8. # any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18. #
  19. #
  20. 1 {
  21.   i\
  22. /* Automatically generated by po-to-tbl from @PACKAGE NAME@.po.  */\
  23. \
  24. #if HAVE_CONFIG_H\
  25. # include <config.h>\
  26. #endif\
  27. \
  28. #include "libgettext.h"\
  29. \
  30. const struct _msg_ent _msg_tbl[] = {
  31.   h
  32.   s/.*/0/
  33.   x
  34. }
  35. #
  36. # Write msgstr entries to C array form.
  37. #
  38. /^msgid/ {
  39.   s/msgid[     ]*/  {/
  40. # This jump is necessary, yes :).
  41.   tc
  42.   :c
  43.   s/\\$/\\/
  44.   ta
  45.   bb
  46.   :a
  47.   n
  48.   s/\\$/\\/
  49.   ta
  50.   :b
  51.   x
  52. # The following nice solution is by
  53. # Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
  54.   td
  55. # Increment a decimal number in pattern space.
  56. # First hide trailing `9' digits.
  57.   :d
  58.   s/9\(_*\)$/_\1/
  59.   td
  60. # Assure at least one digit is available.
  61.   s/^\(_*\)$/0\1/
  62. # Increment the last digit.
  63.   s/8\(_*\)$/9\1/
  64.   s/7\(_*\)$/8\1/
  65.   s/6\(_*\)$/7\1/
  66.   s/5\(_*\)$/6\1/
  67.   s/4\(_*\)$/5\1/
  68.   s/3\(_*\)$/4\1/
  69.   s/2\(_*\)$/3\1/
  70.   s/1\(_*\)$/2\1/
  71.   s/0\(_*\)$/1\1/
  72. # Convert the hidden `9' digits to `0's.
  73.   s/_/0/g
  74.   x
  75.   G
  76.   s/\(.*\)\n0*\(.*\)/\1, \2},/
  77.   s/\(.*\)"$/\1/
  78.   p
  79. }
  80. #
  81. # Last line
  82. #
  83. $ {
  84.   i\
  85. };\
  86.  
  87.   g
  88.   s/0*\(.*\)/int _msg_tbl_length = \1;/p
  89. }
  90. d
  91.