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
})
}
104 lines
3.0 KiB
PostScript
Executable File
104 lines
3.0 KiB
PostScript
Executable File
% Copyright (C) 1999, 2000 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_trap.ps,v 1.6 2002/06/02 12:03:28 mpsuzuki Exp $
|
|
% PostScript LanguageLevel 3 in-RIP trapping support.
|
|
|
|
ll3dict begin
|
|
|
|
% We need LanguageLevel 2 or higher in order to have setuserparams and
|
|
% defineresource.
|
|
languagelevel dup 2 .max .setlanguagelevel
|
|
|
|
% ------ Trapping ------ %
|
|
|
|
% The PostScript-level trapping parameters are maintained in userdict,
|
|
% and explicitly reinstalled upon restore.
|
|
|
|
/Trapping mark
|
|
|
|
/settrapparams dup { % <paramdict> settrapparams -
|
|
/.trapparams .uservar dup length dict .copydict
|
|
dup 2 index {
|
|
% Stack: paramdict olddict olddict key value
|
|
2 index 2 index known { put dup } { pop pop } ifelse
|
|
} forall pop
|
|
dup .settrapparams % Let the operator check parameter validity.
|
|
.userdict /.trapparams 3 -1 roll put pop
|
|
} bind .makeoperator
|
|
|
|
/.copyparams { % <obj> .copyparams <obj'>
|
|
dup type /dicttype eq {
|
|
dup length dict .copydict
|
|
dup {
|
|
.copyparams 3 copy put pop pop
|
|
} forall
|
|
} {
|
|
dup type /arraytype eq {
|
|
[ exch { .copyparams } forall ]
|
|
} if
|
|
} ifelse
|
|
} odef
|
|
|
|
/currenttrapparams dup { % - currenttrapparams <paramdict>
|
|
/.trapparams .uservar .copyparams
|
|
} bind .makeoperator
|
|
|
|
/settrapzone dup { % - settrapzone -
|
|
% ****** DUMMY ******
|
|
newpath
|
|
} bind .makeoperator
|
|
|
|
% Define initial (dummy) trapping parameters.
|
|
% These values are mostly complete guesses.
|
|
userdict /.trapparams mark
|
|
/BlackColorLimit 1.0
|
|
/BlackDensityLimit 1.0
|
|
/BlackWidth 1.0
|
|
/ColorantZoneDetails 0 dict
|
|
/Enabled true
|
|
/HalftoneName null
|
|
/ImageInternalTrapping false
|
|
/ImagemaskTrapping true
|
|
/ImageResolution 1
|
|
/ImageToObjectTrapping true
|
|
/ImageTrapPlacement /Center
|
|
/SlidingTrapLimit 1.0
|
|
/StepLimit 1.0
|
|
/TrapColorScaling 0.0
|
|
/TrapSetName null
|
|
/TrapWidth 1.0
|
|
.dicttomark readonly put
|
|
|
|
.dicttomark /ProcSet defineresource pop
|
|
|
|
% Define the InkParams and TrapParams resource categories.
|
|
{ /InkParams /TrapParams } {
|
|
/Generic /Category findresource dup maxlength 3 add dict .copydict begin
|
|
/InstanceType /dicttype def
|
|
currentdict end /Category defineresource pop
|
|
} forall
|
|
|
|
% Define the TrappingType resource category.
|
|
/Generic /Category findresource dup maxlength 3 add dict .copydict begin
|
|
/InstanceType /integertype def
|
|
/TrappingType currentdict end /Category defineresource pop
|
|
|
|
{1001} { dup /TrappingType defineresource pop } forall
|
|
|
|
.setlanguagelevel
|
|
|
|
end % ll3dict
|