source: rtems/doc/tools/word-replace2 @ 2ba8875

4.104.114.84.95
Last change on this file since 2ba8875 was 2ba8875, checked in by Joel Sherrill <joel.sherrill@…>, on 04/26/00 at 18:02:26

Patch rtemsdoc-4.5.0-rc-0.diff from Ralf Corsepius <corsepiu@…>
which contains the bulk of converting the documentation tree to automake
and GNU conventions. Comments follow:

This is the automake port of rtemsdoc.

To apply:

cvs co rtemsdoc
cd rtemsdoc
sh cvs-rm.sh
patch -p0 < rtemsdoc-4.5.0-rc-0.diff
sh cvs-add.sh

[Attention: cvs-rm.sh and cvs-add.sh directly modify cvs]

Known bugs:
1) src2html is not supported (yet? - Is this supposed to work?)
2) all *.pdf images now are generated on-the-fly, but not yet deleted
during "make distclean"
3) All supplements, including the templated ones, get build and
installed.
4) Building outside of the source tree is completely untested and very
likely does not work.
5) Make [ps|pdf] are not (yet) supported, make [dvi|info] are supported
by automake's default texinfo rules.

Fixing 2, 3 and 5 is almost trivial and needs to be done.
4) is a matter of testing and tool-properties, for now it is simply
untested.

General issues:

  • gif vs jpg vs png. I would recommend to replace all images with pngs to avoid potential copyright issues (gif) or lack in quality (jpg, jpg is good for real world photographs, but extremely poor on artificial images, graphs).
  • pdf images do net get placed correctly in pdf-documents.
  • texinfo: We now use a local copy of texinfo-4.0's texinfo.tex in texinfo/texinfo.tex for generating infos. However pdftex's system-wide texinfo.tex and pdftexinfo.tex are used for generating *.dvi, *.ps, *.pdf.
  • .cvsignore files still missing.
  • I have renamed the supplements filename not to use c_<supplement>, because automake seems to have problems with it.

Notes:

  • Again, I recommend not to put any generated files into CVS. Here, this comprises some *texi, all *.pdf and many *.html pages. Ie. I recommend to run make maintainer-clean before checking in any files.
  • To get building started, this should be sufficient: ./bootstrap ./configure cd tools; make; cd .. make info
  • To make a public tarball: [cvs co ; ./bootstrap] ./configure cd tools; make; cd .. make info [make clean] make dist

=> This generates a rtems-<version>.tar.gz in the toplevel directory.
=> Building the tools only is required after a "cvs co", but not in a

distribution tarball.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1#!/usr/bin/perl
2#
3#  $Id$
4#
5
6eval "exec /usr/local/bin/perl -S $0 $*"
7    if $running_under_some_shell;
8
9require 'getopts.pl';
10&Getopts("p:vh");               # help, pattern file, verbose,
11
12if ($opt_h || ! $opt_p) {
13    print STDERR <<NO_MORE_HELP;
14word-replace
15
16   Replace *words* with patterns.   Pattern file specifies which patterns
17   to replace on each line.  All patterns are wrapped with perl \\b regexp
18   specifiers.
19
20Usage: $0       [-v] -p pattern-file files to replace
21
22    -v          -- possibly more verbose
23    -p file     -- pattern file
24    -h          -- help
25
26    anything else == this help message
27
28Pattern file looks like this:
29
30# Example:
31# ignores all lines with beginning with # or not exactly 2 fields
32_Dorky_Name  rtems_dorky_name           # comments, and blank lines are cool
33_Dorky_Name2 rtems_dorky_name2          # comments, and blank lines are cool
34NO_MORE_HELP
35    exit 0;
36}
37
38$verbose = $opt_v;
39$pattern_file = $opt_p;
40
41# make standard outputs unbuffered (so the '.'s come out ok)
42$oldfh = select(STDERR); $| = 1; select($oldfh);
43$oldfh = select(STDOUT); $| = 1; select($oldfh);
44
45# pull in the patterns
46open(PATTERNS, "<$pattern_file") ||
47    die "could not open $pattern_file: $!, crapped out at";
48
49
50
51foreach (<PATTERNS>)
52{
53    chop;
54    s/#.*//;
55    next if /^$/;
56    ($orig, $new, $junk, @rest) = split;
57    next if ( ! $orig || ! $new || $junk); # <2 or >2 patterns
58    die "pattern appears 2x: '$orig' in '$pattern_file'--" if defined($patterns{$orig});
59    $patterns{$orig} = $new;
60}
61close PATTERNS;
62# walk thru each line in each file
63
64$infile = '-' ;
65$outfile = '-' ;
66
67if ( $#ARGV > -1 )
68{
69  $infile = "@ARGV[0]" ;
70  shift @ARGV ;
71}
72
73if ( $#ARGV > -1 )
74{
75  $outfile = "@ARGV[0]" ;
76  shift @ARGV ;
77}
78
79print STDERR "$outfile\t";
80
81open (INFILE, "<$infile") ||
82        die "could not open input file $infile: $!";
83
84open (OUTFILE, ">$outfile") ||
85        die "could not open output file $outfile: $!";
86
87$line = join('',<INFILE>) ;
88
89  foreach $key (keys %patterns)
90  {
91    if ( $line =~ s/\b$key\b/$patterns{$key}/ge )
92    {
93      print STDERR "." ;
94    }
95  }
96
97print OUTFILE $line ;
98
99print STDERR "\n";
100close INFILE;
101close OUTFILE;
Note: See TracBrowser for help on using the repository browser.