mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Update, rename and clean up various scripts
Rename contrib/tools/chkfmt to contrib/tools/chkfmt.sh; refactor: * Increase the max line length for contrib/**/*.[ch] from 96 to 100. * Set the max line length for ci_*.sh to 100. * Use `basename $0` instead of the hard-coded script name. * Update comments. Remove contrib/tools/reindent. For automated code formatting, including indentation, we need a robust solution. Add an empty line after the hashbang line in all scripts. Remove the "last changed" version info from comment headers. (The version control system maintains this information automatically.)
This commit is contained in:
parent
689e06516b
commit
f6036c0aeb
@ -1,12 +1,10 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
# Make a set of test PNG files, MAKEPNG is the name of the makepng executable
|
||||
# built from contrib/libtests/makepng.c
|
||||
|
||||
# Copyright (c) 2015 John Cunningham Bowler
|
||||
|
||||
# Last changed in libpng 1.6.20 [December 3, 2015]
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
@ -1,14 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# chkfmt
|
||||
# chkfmt.sh
|
||||
#
|
||||
# COPYRIGHT: Written by John Cunningham Bowler, 2010.
|
||||
# COPYRIGHT:
|
||||
# Written by John Cunningham Bowler, 2010.
|
||||
# Revised by Cosmin Truta, 2022.
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
# related or neighboring rights to this work. The author published this work
|
||||
# from the United States.
|
||||
#
|
||||
# Check the format of the source files in the current directory - checks for a
|
||||
# line length of 80 characters max and no tab characters.
|
||||
# Check the format of the source files in the current directory:
|
||||
#
|
||||
# * The lines should not exceed a predefined maximum length.
|
||||
# * Tab characters should appear only where necessary (e.g. in makefiles).
|
||||
#
|
||||
# Optionally arguments are files or directories to check.
|
||||
#
|
||||
@ -16,6 +20,9 @@
|
||||
# -e: spawn an editor for each file that needs a change ($EDITOR must be
|
||||
# defined). When using -e the script MUST be run from an interactive
|
||||
# command line.
|
||||
|
||||
script_name=`basename "$0"`
|
||||
|
||||
verbose=
|
||||
edit=
|
||||
vers=
|
||||
@ -32,14 +39,14 @@ test "$1" = "-e" && {
|
||||
# Copy the standard streams for the editor
|
||||
exec 3>&0 4>&1 5>&2
|
||||
else
|
||||
echo "chkfmt -e: EDITOR must be defined" >&2
|
||||
echo "$script_name -e: EDITOR must be defined" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to edit a single file - if the file isn't changed ask the user
|
||||
# whether or not to continue. This stuff only works if the script is run from
|
||||
# the command line (otherwise, don't specify -e or you will be sorry).
|
||||
# whether or not to continue. This stuff only works if the script is run
|
||||
# from the command line (otherwise, don't specify -e or you will be sorry).
|
||||
doed(){
|
||||
cp "$file" "$file".orig
|
||||
"$EDITOR" "$file" 0>&3 1>&4 2>&5 3>&- 4>&- 5>&- || exit 1
|
||||
@ -53,19 +60,22 @@ doed(){
|
||||
return 0
|
||||
}
|
||||
|
||||
# In beta versions the version string which appears in files can be a little
|
||||
# long and cause spuriously overlong lines. To avoid this substitute the version
|
||||
# string with a 'standard' version a.b.cc before checking for long lines.
|
||||
# In beta versions, the version string which appears in files can be a little
|
||||
# long and cause spuriously overlong lines. To avoid this, substitute the
|
||||
# version string with a placeholder string "a.b.cc" before checking for long
|
||||
# lines.
|
||||
# (Starting from libpng version 1.6.36, we switched to a conventional Git
|
||||
# workflow, and we are no longer publishing beta versions.)
|
||||
if test -r png.h
|
||||
then
|
||||
vers="`sed -n -e \
|
||||
's/^#define PNG_LIBPNG_VER_STRING .\([0-9]\.[0-9]\.[0-9][0-9a-z]*\).$/\1/p' \
|
||||
png.h`"
|
||||
echo "chkfmt: checking version $vers"
|
||||
echo "$script_name: checking version $vers"
|
||||
fi
|
||||
if test -z "$vers"
|
||||
then
|
||||
echo "chkfmt: png.h not found, ignoring version number" >&2
|
||||
echo "$script_name: png.h not found, ignoring version number" >&2
|
||||
fi
|
||||
|
||||
test -n "$1" || set -- .
|
||||
@ -89,13 +99,16 @@ find "$@" \( -type d \( -name '.git' -o -name '.libs' -o -name 'projects' \) \
|
||||
check_tabs=
|
||||
line_length=100;;
|
||||
*.awk)
|
||||
# Includes literal tabs
|
||||
# Allow literal tabs.
|
||||
check_tabs=
|
||||
# The following is arbitrary
|
||||
# Mainframe line printer, anyone?
|
||||
line_length=132;;
|
||||
*/ci_*.sh)
|
||||
check_tabs=yes
|
||||
line_length=100;;
|
||||
*contrib/*/*.[ch])
|
||||
check_tabs=yes
|
||||
line_length=96;;
|
||||
line_length=100;;
|
||||
*)
|
||||
check_tabs=yes
|
||||
line_length=80;;
|
@ -1,13 +1,11 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
# intgamma.sh
|
||||
#
|
||||
# Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
#
|
||||
# COPYRIGHT: Written by John Cunningham Bowler, 2013.
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
# related or neighboring rights to this work. The author published this work
|
||||
# from the United States.
|
||||
#
|
||||
# Shell script to generate png.c 8-bit and 16-bit log tables (see the code in
|
||||
# png.c for details).
|
||||
@ -17,10 +15,10 @@
|
||||
# (0..255) value and a similar table for the exponent calculation.
|
||||
#
|
||||
# "bc" must be on the path when the script is executed, and the math library
|
||||
# (-lm) must be available
|
||||
#
|
||||
# function to print out a list of numbers as integers; the function truncates
|
||||
# the integers which must be one-per-line
|
||||
# (-lm) must be available.
|
||||
|
||||
# Function to print out a list of numbers as integers; the function truncates
|
||||
# the integers which must be one-per-line.
|
||||
function print(){
|
||||
awk 'BEGIN{
|
||||
str = ""
|
||||
|
@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# reindent a libpng C source
|
||||
|
||||
# COPYRIGHT: Written by Glenn Randers-Pehrson, 2016.
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
|
||||
# Usage:
|
||||
# reindent inputtabsize outputtabsize inputcontinuestring outputcontinuestring
|
||||
#
|
||||
# Assumes that continued lines begin with indentation plus one space, and
|
||||
# that continued comments begin with indentation plus " *".
|
||||
#
|
||||
# eg, to change libpng coding style from 3-space indentation with 4-space
|
||||
# continuations to 4-space indentation with 2-space continuations:
|
||||
#
|
||||
# reindent 3 4 "\t " " " < example.c > example.c_4_2
|
||||
# and to restore the file back to libpng coding style
|
||||
# reindent 4 3 " " " " < example.c_4_2 > example.c_3_4
|
||||
|
||||
unexpand --first-only --t $1 | \
|
||||
sed -e "/^ *$3[^\*]/{s/$3/$4/}" | \
|
||||
expand -t $2
|
@ -1,4 +1,5 @@
|
||||
#!/bin/awk -f
|
||||
|
||||
# Check a list of symbols against the master definition
|
||||
# (official) list. Arguments:
|
||||
#
|
||||
|
@ -1,8 +1,7 @@
|
||||
#!/bin/awk -f
|
||||
|
||||
# scripts/dfn.awk - process a .dfn file
|
||||
#
|
||||
# last changed in libpng version 1.5.19 - August 21, 2014
|
||||
#
|
||||
# Copyright (c) 2013-2014 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
|
@ -1,8 +1,7 @@
|
||||
#!/bin/awk -f
|
||||
|
||||
# scripts/options.awk - library build configuration control
|
||||
#
|
||||
# last changed in libpng version 1.6.11 - June 5, 2014
|
||||
#
|
||||
# Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
|
Loading…
x
Reference in New Issue
Block a user