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
})
}
74 lines
3.2 KiB
PostScript
Executable File
74 lines
3.2 KiB
PostScript
Executable File
% Copyright (C) 1993, 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: gs_std_e.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
|
|
% Define the standard encoding vector.
|
|
/StandardEncoding
|
|
% \00x
|
|
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
% \04x
|
|
/space /exclam /quotedbl /numbersign
|
|
/dollar /percent /ampersand /quoteright
|
|
/parenleft /parenright /asterisk /plus
|
|
/comma /hyphen /period /slash
|
|
/zero /one /two /three
|
|
/four /five /six /seven
|
|
/eight /nine /colon /semicolon
|
|
/less /equal /greater /question
|
|
% \10x
|
|
/at /A /B /C /D /E /F /G
|
|
/H /I /J /K /L /M /N /O
|
|
/P /Q /R /S /T /U /V /W
|
|
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
|
|
% \14x
|
|
/quoteleft /a /b /c /d /e /f /g
|
|
/h /i /j /k /l /m /n /o
|
|
/p /q /r /s /t /u /v /w
|
|
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef
|
|
% \20x
|
|
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
% \24x
|
|
/.notdef /exclamdown /cent /sterling
|
|
/fraction /yen /florin /section
|
|
/currency /quotesingle /quotedblleft /guillemotleft
|
|
/guilsinglleft /guilsinglright /fi /fl
|
|
/.notdef /endash /dagger /daggerdbl
|
|
/periodcentered /.notdef /paragraph /bullet
|
|
/quotesinglbase /quotedblbase /quotedblright /guillemotright
|
|
/ellipsis /perthousand /.notdef /questiondown
|
|
% \30x
|
|
/.notdef /grave /acute /circumflex /tilde /macron /breve /dotaccent
|
|
/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
|
|
/emdash /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
|
|
% \34x
|
|
/.notdef /AE /.notdef /ordfeminine /.notdef /.notdef /.notdef /.notdef
|
|
/Lslash /Oslash /OE /ordmasculine /.notdef /.notdef /.notdef /.notdef
|
|
/.notdef /ae /.notdef /.notdef /.notdef /dotlessi /.notdef /.notdef
|
|
/lslash /oslash /oe /germandbls /.notdef /.notdef /.notdef /.notdef
|
|
% Make an array on large systems, a packed array on small ones.
|
|
256
|
|
vmstatus exch pop exch pop
|
|
100000 ge { array astore readonly } { packedarray } ifelse
|
|
def
|
|
0 StandardEncoding .registerencoding
|
|
/StandardEncoding StandardEncoding .defineencoding
|