To avoid acme making spurious edits in future changes,
edited all text files to remove end-of-line spaces and tabs,
remove trailing blank lines, and add missing final newlines,
using this Go program.
package main
import (
"bytes"
"fmt"
"log"
"os"
"path/filepath"
"regexp"
"unicode/utf8"
)
var blank = []byte("\n\n")
func main() {
log.SetPrefix("fixspace: ")
log.SetFlags(0)
re := regexp.MustCompile(`(?m)[ \t]+$`)
filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
if err != nil {
log.Print(err)
return nil
}
if info.IsDir() {
return nil
}
old, err := os.ReadFile(path)
if err != nil {
return err
}
if !utf8.Valid(old) || bytes.ContainsAny(old, "\x00\r") {
return nil
}
// Remove trailing spaces at ends of lines.
new := re.ReplaceAll(old, nil)
// Remove trailing blank lines.
for len(new) > 0 && bytes.HasSuffix(new, blank) {
new = new[:len(new)-1]
}
if len(new) == 1 && new[0] == '\n' {
new = nil
}
// Add newline at end of line if needed.
if len(new) > 0 && new[len(new)-1] != '\n' {
new = append(new, '\n')
}
if !bytes.Equal(old, new) {
if err := os.WriteFile(path, new, 0666); err != nil {
log.Print(err)
return nil
}
fmt.Printf("%s\n", path)
}
return nil
})
}
101 lines
2.4 KiB
PostScript
Executable File
101 lines
2.4 KiB
PostScript
Executable File
%!
|
|
% Copyright (C) 1994 Aladdin Enterprises. All rights reserved.
|
|
%
|
|
% This software is provided AS-IS with no warranty, either express or
|
|
% implied.
|
|
%
|
|
% This software is distributed under license and may not be copied,
|
|
% modified or distributed except as expressly authorized under the terms
|
|
% of the license contained in the file LICENSE in this distribution.
|
|
%
|
|
% For more information about licensing, please refer to
|
|
% http://www.ghostscript.com/licensing/. For information on
|
|
% commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
|
% $Id: zeroline.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
|
|
% zeroline.ps
|
|
% Test file to determine how other PostScript implementations handle
|
|
% filling zero-width lines under a variety of conditions.
|
|
|
|
% Add a small "fan" of zero-width lines at different angles to the path.
|
|
/fan
|
|
{ currentpoint 100 0 rlineto
|
|
2 copy moveto 100 20 rlineto
|
|
2 copy moveto 100 100 rlineto
|
|
2 copy moveto 20 100 rlineto
|
|
moveto 0 100 rlineto
|
|
} def
|
|
|
|
% Append a rectangle to the current path.
|
|
/rectappend
|
|
{ 4 -2 roll moveto 1 index 0 rlineto 0 exch rlineto
|
|
neg 0 rlineto closepath
|
|
} def
|
|
% Fill a rectangle.
|
|
/rectfill
|
|
{ gsave newpath rectappend fill grestore
|
|
} def
|
|
% Stroke a rectangle.
|
|
/rectstroke
|
|
{ gsave newpath rectappend stroke grestore
|
|
} def
|
|
% Clip to a rectangle. Unlike the real rectclip,
|
|
% this clear the current path.
|
|
/rectclip
|
|
{ newpath rectappend clip newpath
|
|
} def
|
|
|
|
40 40 translate
|
|
|
|
% Display fans of different colors on different backgrounds.
|
|
gsave
|
|
0 setgray
|
|
0 0 120 120 rectstroke
|
|
10 10 moveto fan fill
|
|
140 0 translate
|
|
0 setgray
|
|
0 0 120 120 rectstroke
|
|
0.8 setgray
|
|
10 10 moveto fan fill
|
|
140 0 translate
|
|
0 setgray
|
|
0 0 120 120 rectfill
|
|
1 setgray
|
|
10 10 moveto fan fill
|
|
grestore
|
|
0 140 translate
|
|
|
|
% Display rectangles with two edges coincident.
|
|
gsave
|
|
newpath
|
|
0 setgray
|
|
0 0 40 40 rectappend
|
|
0 0 20 20 rectappend
|
|
eofill
|
|
60 0 translate
|
|
0 0 40 40 rectappend
|
|
40 0 -20 20 rectappend
|
|
fill
|
|
grestore
|
|
0 60 translate
|
|
|
|
% Display superimposed lines.
|
|
gsave
|
|
/super
|
|
{ currentpoint fan
|
|
2 copy moveto 20 0 rmoveto 50 0 rlineto
|
|
2 copy moveto 20 4 rmoveto 50 10 rlineto
|
|
2 copy moveto 20 20 rmoveto 50 50 rlineto
|
|
2 copy moveto 4 20 rmoveto 10 50 rlineto
|
|
moveto 0 20 rmoveto 0 50 rlineto
|
|
} def
|
|
0 setgray
|
|
0 0 moveto super fill
|
|
140 0 translate 0 0 moveto super eofill
|
|
grestore
|
|
0 140 translate
|
|
|
|
showpage
|