home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / utils / bug / 2469 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  3.5 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!twinsun.COM!junio
  2. From: junio@twinsun.COM (Jun Hamano)
  3. Newsgroups: gnu.utils.bug
  4. Subject: autoheader (autoconf 1.3)
  5. Date: 25 Jan 1993 21:15:47 -0500
  6. Organization: GNUs Not Usenet
  7. Lines: 99
  8. Sender: daemon@cis.ohio-state.edu
  9. Approved: bug-gnu-utils@prep.ai.mit.edu
  10. Distribution: gnu
  11. Message-ID: <9301252158.AA21936@bo.twinsun.com>
  12.  
  13. This patch supersedes my previous patch sent in
  14. <9301251921.AA01130@tori.twinsun.com>.
  15.  
  16. Earlier, I reported that autoheader fails to parse m4 output
  17. because of incompatibility between traditional `sed' and GNU sed.
  18. Namely, for '/p1/,/p2/' construct, traditional sed sometimes
  19. doesn't consider it is the end of range if both patterns appear
  20. on the same line.
  21.  
  22. Another problem with autoheader was that at one place it feeds
  23. sed a single very long line, which was silently truncated.
  24.  
  25. In the following patch, the first hunk fixes the `/p1/,/p2/'
  26. problem, and the second fixes the truncated line problem.
  27.  
  28. -- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 --
  29. *** autoheader.sh    1993/01/25 19:06:06    1.1
  30. --- autoheader.sh    1993/01/25 21:57:49
  31. ***************
  32. *** 61,69 ****
  33.   
  34.   # We extract assignments of SYMS, FUNCS, and HEADERS from the modified
  35.   # autoconf processing of the input file.
  36.   eval "`echo \"$frob\" \
  37.          | m4 $MACROFILES - $infile \
  38. !        | sed -n '/^@@@/,/@@@$/s/^@*\([^@]*\)@*$/\1/p'`"
  39.   
  40.   # Make SYMS newline-separated rather than blank-separated.
  41.   syms="`for sym in $syms; do echo $sym; done`"
  42. --- 61,79 ----
  43.   
  44.   # We extract assignments of SYMS, FUNCS, and HEADERS from the modified
  45.   # autoconf processing of the input file.
  46. + # Traditional sed mishandles /p1/,/p2/ construct if both patterns
  47. + # appear on the same line (junio@twinsun.com).
  48.   eval "`echo \"$frob\" \
  49.          | m4 $MACROFILES - $infile \
  50. !        | sed -n -e '
  51. !         : again
  52. !         /^@@@.*@@@$/s/@@@\(.*\)@@@$/\1/p
  53. !         /^@@@/{
  54. !             s/^@@@//p
  55. !             n
  56. !             s/^/@@@/
  57. !             b again
  58. !         }'`"
  59.   
  60.   # Make SYMS newline-separated rather than blank-separated.
  61.   syms="`for sym in $syms; do echo $sym; done`"
  62. ***************
  63. *** 71,88 ****
  64.   test $# -eq 0 && exec > config.h.in
  65.   
  66.   echo "/* Generated automatically from $infile by autoheader.  DO NOT EDIT!  */"
  67. - echo ''
  68.   
  69. - # Turn newlines into @s, then double-@s back into newlines.
  70.   # This puts each paragraph on its own line, separated by @s.
  71.   if test -n "$syms"; then
  72. !   # Make sure blank lines are really blank so that @@ below wins.
  73. !   sed 's/^[     ]*$//' $TEMPLATES | tr \\012 @ | 
  74. !   sed -e 's/@@/
  75. ! /g' |
  76. !   # Select each paragraph that refers to a symbol we picked out above.
  77. !   fgrep "$syms" |
  78. !   sed '$!s/$/@/' | tr @ \\012
  79.   fi
  80.   
  81.   for func in $funcs; do
  82. --- 81,108 ----
  83.   test $# -eq 0 && exec > config.h.in
  84.   
  85.   echo "/* Generated automatically from $infile by autoheader.  DO NOT EDIT!  */"
  86.   
  87.   # This puts each paragraph on its own line, separated by @s.
  88.   if test -n "$syms"; then
  89. !    # Make sure the boundary of template files is also the boundary
  90. !    # of the paragraph.  Extra newlines don't hurt since they will
  91. !    # be removed.
  92. !    for t in $TEMPLATES; do cat $t; echo; echo; done |
  93. !    # The sed script is suboptimal because it has to take care of
  94. !    # some broken sed (e.g. AIX) that remove '\n' from the
  95. !    # pattern/hold space if the line is empty. (junio@twinsun.com).
  96. !    sed -n -e '
  97. !     /^[     ]*$/{
  98. !         x
  99. !         s/\n/@/g
  100. !         p
  101. !         s/.*/@/
  102. !         x
  103. !     }
  104. !     H' | sed -e 's/@@*/@/g' |
  105. !    # Select each paragraph that refers to a symbol we picked out above.
  106. !    fgrep "$syms" |
  107. !    tr @ \\012
  108.   fi
  109.   
  110.   for func in $funcs; do
  111.  
  112.