initial commit
Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
47
libs/wxWidgets-3.3.1/misc/scripts/bin2c.py
Executable file
47
libs/wxWidgets-3.3.1/misc/scripts/bin2c.py
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# This is a slightly generalized version of png2c.py and is based on it.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import array
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("""Usage: bin2c binary_file...
|
||||
|
||||
Output input files data as C arrays to standard output.""")
|
||||
sys.exit(1)
|
||||
|
||||
r = re.compile("^([a-zA-Z._][a-zA-Z._0-9]*)[.]([a-zA-Z_0-9]+)$")
|
||||
for path in sys.argv[1:]:
|
||||
filename = os.path.basename(path).replace('-','_')
|
||||
m = r.match(filename)
|
||||
|
||||
# Allow only filenames that make sense as C variable names
|
||||
if not(m):
|
||||
print("Skipped file (unsuitable filename): " + filename)
|
||||
continue
|
||||
|
||||
# Read file as character array
|
||||
bytes = array.array('B', open(path, "rb").read())
|
||||
count = len(bytes)
|
||||
|
||||
# Create the C header
|
||||
text = "/* %s - %d bytes */\n" \
|
||||
"static const unsigned char %s_%s_data[] = {\n" % (
|
||||
filename, count, m.group(1), m.group(2))
|
||||
|
||||
i = 0
|
||||
for byte in bytes:
|
||||
if i % 16 == 0:
|
||||
text += "\n "
|
||||
i += 1
|
||||
text += " 0x%02x" % byte
|
||||
if i != count:
|
||||
text += ","
|
||||
|
||||
text += "\n};"
|
||||
|
||||
print(text)
|
||||
15
libs/wxWidgets-3.3.1/misc/scripts/check_allheaders.sh
Executable file
15
libs/wxWidgets-3.3.1/misc/scripts/check_allheaders.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname "$0")/../..
|
||||
|
||||
rc=0
|
||||
|
||||
for h in include/wx/*.h ; do
|
||||
header=wx/$(basename "$h")
|
||||
if ! grep -q "$header" tests/allheaders.h ; then
|
||||
echo "ERROR - <$header> not present in tests/allheaders.h"
|
||||
rc=$((rc+1))
|
||||
fi
|
||||
done
|
||||
|
||||
exit $rc
|
||||
82
libs/wxWidgets-3.3.1/misc/scripts/check_mixed_eol.sh
Executable file
82
libs/wxWidgets-3.3.1/misc/scripts/check_mixed_eol.sh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname "$0")/../..
|
||||
|
||||
find . \( \
|
||||
-path './.git' -prune -o \
|
||||
-path './3rdparty' -prune -o \
|
||||
-path './src/expat' -prune -o \
|
||||
-path './src/jpeg' -prune -o \
|
||||
-path './src/png' -prune -o \
|
||||
-path './src/tiff' -prune -o \
|
||||
-path './src/zlib' -prune \) \
|
||||
-o -type f -print0 |
|
||||
(
|
||||
while IFS= read -r -d '' file; do
|
||||
|
||||
# skip binary files
|
||||
case "$file" in
|
||||
*.ani | *.bmp | *.chm | *.cur | *.dia | *.gif | *.gz | *.hlp | *.icns | *.ico | *.jpg | *.mo | *.mpg | *.pcx | *.pdf | *.png | *.pnm | *.pyc | *.tga | *.tif | *.ttf | *.wav | *.webp | *.zip )
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
# get used EOL
|
||||
read dos unix mac <<< $(dos2unix --info=dum "$file" | awk '{print $1, $2, $3}')
|
||||
if [[ "$dos" -eq 0 ]] && [[ "$unix" -eq 0 ]]; then
|
||||
:
|
||||
elif [[ "$dos" -eq 0 ]] && [[ "$mac" -eq 0 ]]; then
|
||||
:
|
||||
elif [[ "$unix" -eq 0 ]] && [[ "$mac" -eq 0 ]]; then
|
||||
:
|
||||
else
|
||||
echo "ERROR - mixed EOL: $file"
|
||||
rc=$((rc+1))
|
||||
continue
|
||||
fi
|
||||
|
||||
# empty file
|
||||
if [[ "$dos" -eq 0 ]] && [[ "$unix" -eq 0 ]] && [[ "$mac" -eq 0 ]]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
# determine expected EOL
|
||||
warn_expected_eol_unknown=0
|
||||
case "$file" in
|
||||
*.applescript | *.apspec | *.bkgen | *.bkl | *.c | *.C | *.cmake | *.cpp | *.css | *.cxx | *.guess | *.h | *.htm | *.html | *.iface | *.in | *.js | *.json | *.log | *.lua | *.m4 | *.mm | *.manifest | *.md | *.mk | *.mms | *.opt | *.patch | *.pbxproj | *.pl | *.plist | *.po | *.py | *.sh | *.sub | *.svg | *.tex | *.txt | *.TXT | *.unx | *.vms | *.xcconfig | *.xcscheme | *.xcworkspacedata | *.xbm | *.xml | *.xpm | *.xrc | *.yml )
|
||||
expected_eoltype=unix
|
||||
;;
|
||||
*.bat | *.bcc | *.gcc | *.iss | *.props | *.rc | *.sln | *.vc | *.vcproj | *.vcxproj | *.vcxproj.filters )
|
||||
expected_eoltype=dos
|
||||
;;
|
||||
* )
|
||||
# warn_expected_eol_unknown=1
|
||||
expected_eoltype=
|
||||
;;
|
||||
esac
|
||||
|
||||
# check for filename without extension
|
||||
if [[ "$expected_eoltype" = "" ]]; then
|
||||
fullfile=$(basename -- "$file")
|
||||
if [[ "${fullfile:1}" != *"."* ]]; then
|
||||
warn_expected_eol_unknown=0
|
||||
expected_eoltype=unix
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$warn_expected_eol_unknown" -eq 1 ]]; then
|
||||
echo "WARNING - no expected EOL specified: $file"
|
||||
fi
|
||||
|
||||
# check if expected EOL matches used EOL
|
||||
if [[ "$expected_eoltype" = "unix" ]] && [[ "$unix" -eq 0 ]]; then
|
||||
echo "ERROR - wrong EOL, expected unix: $file"
|
||||
rc=$((rc+1))
|
||||
elif [[ "$expected_eoltype" = "dos" ]] && [[ "$dos" -eq 0 ]]; then
|
||||
echo "ERROR - wrong EOL, expected dos: $file"
|
||||
rc=$((rc+1))
|
||||
fi
|
||||
|
||||
done
|
||||
exit $rc
|
||||
)
|
||||
90
libs/wxWidgets-3.3.1/misc/scripts/check_unused_headers
Executable file
90
libs/wxWidgets-3.3.1/misc/scripts/check_unused_headers
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Name: check_unused_headers
|
||||
# Purpose: checks all wxWidgets headers looking for headers not referenced anywhere
|
||||
# Usage: run with --verbose for verbose output
|
||||
# Copyright: (c) 2007 Francesco Montorsi
|
||||
# Licence: wxWindows licence
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
if [[ "$1" = "-v" || "$1" = "--verbose" ]]; then
|
||||
verbose=yes
|
||||
else
|
||||
verbose=no
|
||||
fi
|
||||
|
||||
|
||||
me=$(basename $0)
|
||||
path=${0%%/$me} # path from which the script has been launched
|
||||
current=$(pwd)
|
||||
|
||||
# the path where this script resides:
|
||||
scriptPath=$current/$path
|
||||
|
||||
# other interesting wx paths
|
||||
headerPath="$scriptPath/../../include"
|
||||
srcPath="$scriptPath/../../src"
|
||||
|
||||
# get list of wx source and header filenames
|
||||
# NOTE: these list won't contain the .svn backup copies of the real sources/headers
|
||||
# NOTE2: we keep the size of these lists small avoiding to include the prefixes
|
||||
# like e.g. ../../include so to not incurr in OS limits when passing
|
||||
# them as arguments of commands
|
||||
cd $headerPath
|
||||
headerList=`find wx -name "*.h"`
|
||||
cd $srcPath
|
||||
srcList=`find . -name "*.cpp"`
|
||||
|
||||
|
||||
unusedHeaders=0
|
||||
|
||||
function checkIfHeaderIsUsed
|
||||
{
|
||||
local headerToCheck="$1"
|
||||
local found=no
|
||||
|
||||
if [[ $verbose = yes ]]; then
|
||||
echo -n "checking if header: $headerToCheck is used... "
|
||||
fi
|
||||
|
||||
# find the first occurrence of this header in wx sources and headers:
|
||||
cd $headerPath
|
||||
grep -m 1 "$headerToCheck" $headerList >/dev/null 2>&1
|
||||
if [[ $? = 0 ]]; then found=yes; fi
|
||||
|
||||
cd $srcPath
|
||||
grep -m 1 "$headerToCheck" $srcList >/dev/null 2>&1
|
||||
if [[ $? = 0 ]]; then found=yes; fi
|
||||
|
||||
if [[ $found = no ]]; then
|
||||
|
||||
if [[ $verbose = yes ]]; then
|
||||
echo "no, it's not!"
|
||||
fi
|
||||
|
||||
# this header is not used anywhere...
|
||||
echo "WARNING: unused header $headerToCheck"
|
||||
((( unusedHeaders++ )))
|
||||
else
|
||||
if [[ $verbose = yes ]]; then
|
||||
echo "yes, it is"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
echo " This script will look for unused wxWidgets headers"
|
||||
echo " Note that some headers maybe not referenced by wxWidgets sources/headers but still"
|
||||
echo " be useful for user applications; others instead are simply old and forgotten."
|
||||
echo
|
||||
|
||||
for header in $headerList; do
|
||||
checkIfHeaderIsUsed $header
|
||||
done
|
||||
|
||||
if [[ $unusedHeaders -gt 0 ]]; then
|
||||
echo " => WARNING: found $unusedHeaders unused headers!"
|
||||
else
|
||||
echo " => All headers are referenced in either wxWidgets sources or in other headers"
|
||||
fi
|
||||
2
libs/wxWidgets-3.3.1/misc/scripts/clean_patch
Executable file
2
libs/wxWidgets-3.3.1/misc/scripts/clean_patch
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
filterdiff -x '*/*.vcproj' -x '*/*.vcxproj*' -x a/autoconf_inc.m4 -x a/configure -x '*/makefile.*' -x '*/Makefile.in' -x a/setup.h.in -x '*/setup.h' "$@"
|
||||
38
libs/wxWidgets-3.3.1/misc/scripts/ctags.ignore
Normal file
38
libs/wxWidgets-3.3.1/misc/scripts/ctags.ignore
Normal file
@@ -0,0 +1,38 @@
|
||||
WXUNUSED+
|
||||
WXDLLEXPORT
|
||||
WXDLLIMPEXP_AUI
|
||||
WXDLLIMPEXP_DATA_AUI+
|
||||
WXDLLIMPEXP_FWD_AUI
|
||||
WXDLLIMPEXP_BASE
|
||||
WXDLLIMPEXP_DATA_BASE+
|
||||
WXDLLIMPEXP_FWD_BASE
|
||||
WXDLLIMPEXP_CORE
|
||||
WXDLLIMPEXP_DATA_CORE+
|
||||
WXDLLIMPEXP_FWD_CORE
|
||||
WXDLLIMPEXP_NET
|
||||
WXDLLIMPEXP_MEDIA
|
||||
WXDLLIMPEXP_DATA_MEDIA+
|
||||
WXDLLIMPEXP_FWD_MEDIA
|
||||
WXDLLIMPEXP_DATA_NET+
|
||||
WXDLLIMPEXP_FWD_NET
|
||||
WXDLLIMPEXP_HTML
|
||||
WXDLLIMPEXP_DATA_HTML+
|
||||
WXDLLIMPEXP_FWD_HTML
|
||||
WXDLLIMPEXP_GL
|
||||
WXDLLIMPEXP_DATA_GL+
|
||||
WXDLLIMPEXP_FWD_GL
|
||||
WXDLLIMPEXP_QA
|
||||
WXDLLIMPEXP_DATA_QA+
|
||||
WXDLLIMPEXP_FWD_QA
|
||||
WXDLLIMPEXP_XML
|
||||
WXDLLIMPEXP_DATA_XML+
|
||||
WXDLLIMPEXP_FWD_XML
|
||||
WXDLLIMPEXP_XRC
|
||||
WXDLLIMPEXP_DATA_XRC+
|
||||
WXDLLIMPEXP_FWD_XRC
|
||||
WXDLLIMPEXP_PROPGRID
|
||||
WXDLLIMPEXP_DATA_PROPGRID+
|
||||
WXDLLIMPEXP_FWD_PROPGRID
|
||||
WXDLLIMPEXP_RICHTEXT
|
||||
WXDLLIMPEXP_DATA_RICHTEXT+
|
||||
WXDLLIMPEXP_FWD_RICHTEXT
|
||||
58
libs/wxWidgets-3.3.1/misc/scripts/inc_release
Executable file
58
libs/wxWidgets-3.3.1/misc/scripts/inc_release
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
##############################################################################
|
||||
# Name: misc/scripts/inc_release
|
||||
# Purpose: increments the release version number in all files mentioned in
|
||||
# docs/contributing/about-version-numbers.md
|
||||
# Created: 2007-01-07
|
||||
# Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
# Licence: wxWindows licence
|
||||
##############################################################################
|
||||
|
||||
. `dirname $0`/run_sed_common.sh
|
||||
|
||||
# the primary source of information is wx/version.h
|
||||
ver_string=`grep '#define wxVERSION_STRING ' include/wx/version.h | sed 's/^.*"wxWidgets \(.*\)")/\1/'`
|
||||
ver_major=`echo $ver_string | sed 's/\([0-9]\{1,\}\)\..*/\1/'`
|
||||
ver_minor=`echo $ver_string | sed 's/.*\.\([0-9]\{1,\}\)\..*/\1/'`
|
||||
ver_release=`echo $ver_string | sed 's/.*\.\([0-9]\{1,\}\)$/\1/'`
|
||||
|
||||
msg "Original version is $ver_major.$ver_minor.$ver_release"
|
||||
|
||||
ver_release_new=$(($ver_release + 1))
|
||||
ver_string_new=$ver_major.$ver_minor.$ver_release_new
|
||||
|
||||
msg "Updating version to $ver_string_new"
|
||||
|
||||
ver_for_sed="$ver_major\.$ver_minor\.$ver_release"
|
||||
|
||||
run_sed configure.ac \
|
||||
"/^AC_INIT/s/$ver_for_sed/$ver_string_new/" \
|
||||
"s/^wx_release_number=$ver_release/wx_release_number=$ver_release_new/" \
|
||||
"s/^wx_subrelease_number=.*$/wx_subrelease_number=0/"
|
||||
|
||||
run_sed build/osx/wxvers.xcconfig \
|
||||
"/DYLIB_.* = /s/$ver_for_sed/$ver_string_new/"
|
||||
|
||||
run_sed docs/readme.txt \
|
||||
"/wxWidgets /s/$ver_for_sed/$ver_string_new/" \
|
||||
"/\//s/$ver_for_sed/$ver_string_new/" \
|
||||
"/naming: while/s/$ver_for_sed/$ver_string_new/"
|
||||
|
||||
run_sed docs/doxygen/Doxyfile \
|
||||
"/^PROJECT_NUMBER/s/$ver_for_sed/$ver_string_new/"
|
||||
|
||||
run_sed include/wx/version.h \
|
||||
"s/^\(#define wxRELEASE_NUMBER *\) $ver_release$/\1 $ver_release_new/" \
|
||||
"s/^\(#define wxSUBRELEASE_NUMBER *\) [0-9]\{1,\}$/\1 0/" \
|
||||
"/^#define wxVERSION_STRING/s/$ver_for_sed/$ver_string_new/"
|
||||
|
||||
run_sed samples/minimal/Info_cocoa.plist \
|
||||
"/<string>/s/$ver_for_sed/$ver_string_new/"
|
||||
|
||||
run_sed build/msw/wx_setup.props \
|
||||
"/<wxVersionString>/s/\($ver_major$ver_minor\)$ver_release/\1$ver_release_new/"
|
||||
|
||||
run_sed build/tools/msvs/getversion.bat \
|
||||
"/wxRELEASE_NUMBER=/s/$ver_release/$ver_release_new/"
|
||||
|
||||
msg "Don't forget to change the C:R:A triplet in build/bakefiles/version.bkl now!"
|
||||
29
libs/wxWidgets-3.3.1/misc/scripts/inc_year
Executable file
29
libs/wxWidgets-3.3.1/misc/scripts/inc_year
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
##############################################################################
|
||||
# Name: misc/scripts/inc_year
|
||||
# Purpose: increments the year in various copyright notices
|
||||
# Created: 2019-04-21
|
||||
# Copyright: (c) 2019 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
# Licence: wxWindows licence
|
||||
##############################################################################
|
||||
|
||||
. `dirname $0`/run_sed_common.sh
|
||||
|
||||
new_year=`date +%Y`
|
||||
old_year=`expr $new_year - 1`
|
||||
|
||||
echo "Updating dates to use $new_year instead of $old_year:"
|
||||
|
||||
# Update copyright to extend to the new year.
|
||||
for f in docs/doxygen/mainpages/copyright.h docs/doxygen/regen.sh \
|
||||
interface/wx/aboutdlg.h interface/wx/generic/aboutdlgg.h \
|
||||
samples/dialogs/dialogs.cpp \
|
||||
src/common/utilscmn.cpp src/msw/version.rc \
|
||||
; do
|
||||
run_sed $f "s/1992-$old_year/1992-$new_year/"
|
||||
done
|
||||
|
||||
# And Mac files are much newer than that.
|
||||
run_sed CMakeLists.txt "s/2002-$old_year/2002-$new_year/"
|
||||
run_sed build/bakefiles/mac_bundles.bkl "s/2002-$old_year/2002-$new_year/"
|
||||
run_sed samples/minimal/Info_cocoa.plist "s/2005-$old_year/2005-$new_year/"
|
||||
4
libs/wxWidgets-3.3.1/misc/scripts/makegtktags
Executable file
4
libs/wxWidgets-3.3.1/misc/scripts/makegtktags
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. `dirname $0`/makeunixtags.sh
|
||||
|
||||
create_tags gtk
|
||||
1
libs/wxWidgets-3.3.1/misc/scripts/makemswtags.bat
Executable file
1
libs/wxWidgets-3.3.1/misc/scripts/makemswtags.bat
Executable file
@@ -0,0 +1 @@
|
||||
@ctags.exe --totals --language-force=c++ --c++-types=+p -I ./misc/scripts/ctags.ignore --exclude=src/android --exclude=src/dfb --exclude=src/gtk --exclude=src/osx --exclude=src/qt --exclude=src/univ --exclude=src/unix--exclude=src/x11 --exclude=include/wx/android --exclude=include/wx/dfb --exclude=include/wx/gtk --exclude=include/wx/osx --exclude=include/wx/qt --exclude=include/wx/univ --exclude=include/wx/unix --exclude=include/wx/x11 --recursive include src
|
||||
14
libs/wxWidgets-3.3.1/misc/scripts/makeosxtags.sh
Executable file
14
libs/wxWidgets-3.3.1/misc/scripts/makeosxtags.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
. `dirname $0`/makeunixtags.sh
|
||||
create_tags osx
|
||||
|
||||
ctags --totals --c++-kinds=+px --language-force=c++ \
|
||||
-a \
|
||||
-I @misc/scripts/ctags.ignore \
|
||||
include/wx/osx/core/*.h \
|
||||
include/wx/osx/core/private/*.h \
|
||||
include/wx/osx/private/*.h \
|
||||
include/wx/osx/cocoa/*.h \
|
||||
include/wx/osx/cocoa/private/*.h \
|
||||
src/osx/core/*.cpp \
|
||||
src/osx/cocoa/*.mm
|
||||
4
libs/wxWidgets-3.3.1/misc/scripts/makeqttags
Executable file
4
libs/wxWidgets-3.3.1/misc/scripts/makeqttags
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. `dirname $0`/makeunixtags.sh
|
||||
|
||||
create_tags qt
|
||||
1
libs/wxWidgets-3.3.1/misc/scripts/makeunivtags.bat
Executable file
1
libs/wxWidgets-3.3.1/misc/scripts/makeunivtags.bat
Executable file
@@ -0,0 +1 @@
|
||||
@ctags.exe -o wxuniv.tags --totals --language-force=c++ --c++-types=+p -I @misc/scripts/ctags.ignore include/wx/univ/*.h src/univ/*.cpp src/univ/themes/*.cpp
|
||||
43
libs/wxWidgets-3.3.1/misc/scripts/makeunixtags.sh
Executable file
43
libs/wxWidgets-3.3.1/misc/scripts/makeunixtags.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
##############################################################################
|
||||
# Name: misc/scripts/makeunixtags.sh
|
||||
# Purpose: create tags file for a wxWidgets port under a Unix system
|
||||
# Created: 2007-05-05
|
||||
# Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
# Licence: wxWindows licence
|
||||
##############################################################################
|
||||
|
||||
# this function should be called with a single parameter containing addition
|
||||
# port-specific directories to scan
|
||||
create_tags()
|
||||
{
|
||||
ctags --totals --c++-kinds=+px --language-force=c++ \
|
||||
--exclude=include/wx/vms_x_fix.h \
|
||||
-I @misc/scripts/ctags.ignore \
|
||||
include/wx/*.h \
|
||||
include/wx/private/*.h \
|
||||
include/wx/aui/*.h \
|
||||
include/wx/generic/*.h \
|
||||
include/wx/generic/private/*.h \
|
||||
include/wx/$1/*.h \
|
||||
include/wx/$1/private/*.h \
|
||||
include/wx/html/*.h \
|
||||
include/wx/propgrid/*.h \
|
||||
include/wx/protocol/*.h \
|
||||
include/wx/ribbon/*.h \
|
||||
include/wx/richtext/*.h \
|
||||
include/wx/xml/*.h \
|
||||
include/wx/xrc/*.h \
|
||||
include/wx/unix/*.h \
|
||||
include/wx/unix/private/*.h \
|
||||
src/aui/*.cpp \
|
||||
src/common/*.cpp \
|
||||
src/generic/*.cpp \
|
||||
src/$1/*.cpp \
|
||||
src/html/*.cpp \
|
||||
src/propgrid/*.cpp \
|
||||
src/ribbon/*.cpp \
|
||||
src/richtext/*.cpp \
|
||||
src/unix/*.cpp \
|
||||
src/xml/*.cpp \
|
||||
src/xrc/*.cpp
|
||||
}
|
||||
97
libs/wxWidgets-3.3.1/misc/scripts/png2c.py
Executable file
97
libs/wxWidgets-3.3.1/misc/scripts/png2c.py
Executable file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# This script is a slightly modified version of the original found at
|
||||
#
|
||||
# https://wiki.wxwidgets.org/Embedding_PNG_Images-Bin2c_In_Python
|
||||
#
|
||||
# without any copyright attribution so it is assumed it can be used under
|
||||
# wxWindows licence as the rest of the wiki material.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import array
|
||||
|
||||
USAGE = """Usage: png2c [-s] [file...]
|
||||
Output input PNG files as C arrays to standard output. Used to embed PNG images
|
||||
in C code (like XPM but with full alpha channel support).
|
||||
|
||||
-s embed the image size in the image names in generated code."""
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print(USAGE)
|
||||
sys.exit(1)
|
||||
|
||||
r = re.compile("^([a-zA-Z._][a-zA-Z._0-9]*)[.][pP][nN][gG]$")
|
||||
|
||||
# Automatically replace some symbols in the filenames.
|
||||
sanitize = str.maketrans('-@', '__')
|
||||
|
||||
with_size = 0
|
||||
size_suffix = ''
|
||||
for path in sys.argv[1:]:
|
||||
if path == '-s':
|
||||
with_size = 1
|
||||
continue
|
||||
|
||||
filename = os.path.basename(path).translate(sanitize)
|
||||
m = r.match(filename)
|
||||
|
||||
# Allow only filenames that make sense as C variable names
|
||||
if not(m):
|
||||
print("Skipped file (unsuitable filename): " + filename, file=sys.stderr)
|
||||
continue
|
||||
|
||||
# Read PNG file as character array
|
||||
bytes = array.array('B', open(path, "rb").read())
|
||||
count = len(bytes)
|
||||
|
||||
# Check that it's actually a PNG to avoid problems when loading it
|
||||
# later.
|
||||
#
|
||||
# Each PNG file starts with a 8 byte signature that should be followed
|
||||
# by IHDR chunk which is always 13 bytes in length so the first 16
|
||||
# bytes are fixed (or at least we expect them to be).
|
||||
if bytes[0:16].tobytes() != b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR':
|
||||
print('"%s" doesn\'t seem to be a valid PNG file.' % filename)
|
||||
continue
|
||||
|
||||
# Try to naively get its size if necessary
|
||||
if with_size:
|
||||
def getInt(start):
|
||||
""" Convert 4 bytes in network byte order to an integer. """
|
||||
return 16777216*bytes[start] + \
|
||||
65536*bytes[start+1] + \
|
||||
256*bytes[start+2] + \
|
||||
bytes[start+3];
|
||||
|
||||
size_suffix = "_%dx%d" % (getInt(16), getInt(20))
|
||||
|
||||
# Create the C header
|
||||
text = "/* %s - %d bytes */\n" \
|
||||
"static const unsigned char %s%s_png[] = {\n" % (
|
||||
filename, count, m.group(1), size_suffix)
|
||||
|
||||
# Iterate the characters, we want
|
||||
# lines like:
|
||||
# 0x01, 0x02, .... (8 values per line maximum)
|
||||
i = 0
|
||||
count = len(bytes)
|
||||
for byte in bytes:
|
||||
# Every new line starts with two whitespaces
|
||||
if (i % 8) == 0:
|
||||
text += " "
|
||||
# Then the hex data (up to 8 values per line)
|
||||
text += "0x%02x" % (byte)
|
||||
# Separate all but the last values
|
||||
if (i % 8) == 7:
|
||||
text += ',\n'
|
||||
elif (i + 1) < count:
|
||||
text += ", "
|
||||
i += 1
|
||||
|
||||
# Now conclude the C source
|
||||
text += "};"
|
||||
|
||||
print(text)
|
||||
55
libs/wxWidgets-3.3.1/misc/scripts/run_sed_common.sh
Normal file
55
libs/wxWidgets-3.3.1/misc/scripts/run_sed_common.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
##############################################################################
|
||||
# Name: misc/scripts/run_sed_common.sh
|
||||
# Purpose: Common helpers for scripts using sed for automatic updates
|
||||
# Created: 2019-04-21 (extracted from misc/scripts/inc_release)
|
||||
# Copyright: (c) 2007,2019 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
# Licence: wxWindows licence
|
||||
##############################################################################
|
||||
|
||||
error() {
|
||||
echo "$progname: $*" >&2
|
||||
}
|
||||
|
||||
msg() {
|
||||
echo "$progname: $*"
|
||||
}
|
||||
|
||||
msgn() {
|
||||
echo -n "$progname: $*"
|
||||
}
|
||||
|
||||
msgc() {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
run_sed() {
|
||||
filename=$1
|
||||
shift
|
||||
cmd=
|
||||
while [ $# -gt 0 ]; do
|
||||
cmd="$cmd-e \"$1\" "
|
||||
shift
|
||||
done
|
||||
|
||||
msgn " processing $filename ... "
|
||||
eval "sed $cmd $filename" > $filename.$$
|
||||
if cmp -s $filename $filename.$$; then
|
||||
rm $filename.$$
|
||||
msgc "unchanged"
|
||||
else
|
||||
chmod --reference=$filename $filename.$$
|
||||
mv $filename.$$ $filename
|
||||
msgc "done"
|
||||
fi
|
||||
}
|
||||
|
||||
progname=`basename $0`
|
||||
|
||||
# we must be run from wx directory
|
||||
if [ ! -f wxwin.m4 ]; then
|
||||
error "must be ran from root wx directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# exit on any error
|
||||
set -e
|
||||
149
libs/wxWidgets-3.3.1/misc/scripts/set_install_name
Executable file
149
libs/wxWidgets-3.3.1/misc/scripts/set_install_name
Executable file
@@ -0,0 +1,149 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Name: set_install_name
|
||||
# Purpose: set install_name for wx shared libraries under Mac OS X
|
||||
# Usage: run with --help option to see the instructions
|
||||
# Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
# Licence: wxWindows licence
|
||||
################################################################################
|
||||
|
||||
quiet=0
|
||||
verbose=0
|
||||
libdir=
|
||||
tool_prefix=
|
||||
install_path=
|
||||
cmd=
|
||||
|
||||
Usage()
|
||||
{
|
||||
name=`basename $0`
|
||||
cat 1>&2 <<EOF
|
||||
Usage: $name [OPTIONS] [--prefix=PFX] [--libdir=DIR] [install_path]
|
||||
|
||||
Change the install name of all wxWidgets libraries in the directory DIR (or
|
||||
current directory if libdir option is not specified) to correspond to the given
|
||||
install_path (defaults to the libraries directory if not specified).
|
||||
|
||||
If prefix option is given, its value is prefixed to the tool names used. E.g.
|
||||
to use this script when cross-building, use "--prefix=powerpc-apple-darwin8-".
|
||||
|
||||
-n, --dry-run Don't really do anything, just print the commands
|
||||
-q, --quiet Don't display any non error messages
|
||||
-v, --verbose Just show the commands being executed, don't run them
|
||||
-h, --help Show this help screen and exit
|
||||
|
||||
Examples:
|
||||
* do "$name --libdir=MyApp.app/Contents/Frameworks @executable_path/../Frameworks"
|
||||
when distributing wxWidgets shared libraries with application MyApp
|
||||
* run "$name" without parameters in the directory containing wxWidgets libraries
|
||||
to use them without installing
|
||||
EOF
|
||||
exit 2
|
||||
}
|
||||
|
||||
Message()
|
||||
{
|
||||
if [ $quiet != 1 ]; then
|
||||
echo "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
VerboseMessage()
|
||||
{
|
||||
if [ $verbose = 1 ]; then
|
||||
Message "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
Error()
|
||||
{
|
||||
echo "$*" 1>&2
|
||||
}
|
||||
|
||||
GiveUsageErrorAndExit()
|
||||
{
|
||||
Error "$@"
|
||||
Usage
|
||||
}
|
||||
|
||||
ChangeInstallNames()
|
||||
{
|
||||
# only change the libs themselves, not symlinks to them
|
||||
all_libs=`find "$libdir" -type f -name libwx_\*.dylib`
|
||||
if [ -z "$all_libs" ]; then
|
||||
Error "No wx libraries found in \"$libdir\"."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VerboseMessage "Processing $all_libs\n"
|
||||
|
||||
for lib in $all_libs; do
|
||||
libname=`basename $lib`
|
||||
oldname=`${tool_prefix}otool -D $lib | tail -1`
|
||||
Message "Updating install name of and references to $libname:"
|
||||
for lib2 in $all_libs; do
|
||||
VerboseMessage " updating $lib2"
|
||||
eval "$cmd ${tool_prefix}install_name_tool -change "$oldname" $install_path/$libname $lib2"
|
||||
done
|
||||
VerboseMessage " updating $libname id"
|
||||
eval "$cmd ${tool_prefix}install_name_tool -id $install_path/$libname $lib"
|
||||
done
|
||||
}
|
||||
|
||||
while [ $# -ge 1 ]; do
|
||||
case "$1" in
|
||||
--help|-h)
|
||||
Usage
|
||||
;;
|
||||
|
||||
--dry-run|-n)
|
||||
cmd="echo"
|
||||
;;
|
||||
|
||||
--quiet|-q)
|
||||
quiet=1
|
||||
;;
|
||||
|
||||
--verbose|-v)
|
||||
verbose=1
|
||||
;;
|
||||
|
||||
--libdir=*)
|
||||
if [ -n "$libdir" ]; then
|
||||
GiveUsageErrorAndExit "Multiple --libdir options not allowed."
|
||||
fi
|
||||
libdir=`echo $1 | cut -c10-`
|
||||
;;
|
||||
|
||||
--prefix=*)
|
||||
if [ -n "$tool_prefix" ]; then
|
||||
GiveUsageErrorAndExit "At most one --prefix option can be given."
|
||||
fi
|
||||
tool_prefix=`echo $1 | cut -c10-`
|
||||
;;
|
||||
|
||||
-*)
|
||||
GiveUsageErrorAndExit "Unknown option \"$1\"."
|
||||
;;
|
||||
|
||||
*)
|
||||
if [ -n "$install_path" ]; then
|
||||
GiveUsageErrorAndExit "Too many parameters."
|
||||
fi
|
||||
install_path=$1
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z $libdir ]; then
|
||||
libdir=`pwd`
|
||||
fi
|
||||
|
||||
if [ -z $install_path ]; then
|
||||
install_path=$libdir
|
||||
fi
|
||||
|
||||
ChangeInstallNames
|
||||
|
||||
exit 0
|
||||
2
libs/wxWidgets-3.3.1/misc/scripts/show_dll_exports
Executable file
2
libs/wxWidgets-3.3.1/misc/scripts/show_dll_exports
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
dumpbin.exe /exports $1 | sed -nre 's/^ +[0-9]+ +[0-9A-F]+ [0-9A-F]{8} (.*)$/\1/p' | sort
|
||||
32
libs/wxWidgets-3.3.1/misc/scripts/spellcheck
Executable file
32
libs/wxWidgets-3.3.1/misc/scripts/spellcheck
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
CODESPELL=${CODESPELL-codespell}
|
||||
|
||||
# Make sure we run codespell from the top wx directory.
|
||||
cd `dirname "$0"`/../..
|
||||
|
||||
if ! command -v $CODESPELL > /dev/null; then
|
||||
echo "ERROR: codespell not available." >&2
|
||||
exit 127
|
||||
fi
|
||||
|
||||
$CODESPELL \
|
||||
-I misc/suppressions/codespell-words \
|
||||
-x misc/suppressions/codespell-lines \
|
||||
-S 'build/cmake/modules/cotire.cmake,docs/changes*.txt,*.png,*.ico,*.bmp,*.cur,docs/doxygen/images,docs/doxygen/mainpages/copyright.h,docs/doxygen/doxygen-awesome-css,include/wx/private/lang_*.h' \
|
||||
README.md docs include interface
|
||||
|
||||
rc=$?
|
||||
|
||||
if [ $rc != 0 ]; then
|
||||
cat <<EOF
|
||||
|
||||
=================================== ERROR ===================================
|
||||
Spell check failed, please correct the spelling mistakes at the locations
|
||||
listed above. If any of the reported mistakes are false positives, please add
|
||||
the lines provoking them to misc/suppressions/codespell-lines file or, if
|
||||
there are many occurrences of the same word, add this word to codespell-words
|
||||
file in the same directory.
|
||||
EOF
|
||||
>& 2
|
||||
exit $rc
|
||||
fi
|
||||
Reference in New Issue
Block a user