summaryrefslogtreecommitdiffstats
path: root/TOOLS/file2string.py
diff options
context:
space:
mode:
authorKovensky <diogomfranco@gmail.com>2012-11-07 11:49:44 -0300
committerwm4 <wm4@nowhere>2012-11-08 00:28:59 +0100
commitfae73079310eef9dce9737f2e37ff4b80c8830ee (patch)
tree4a9c7d9fbc398b237808283df39562e55077a225 /TOOLS/file2string.py
parent58f821e096392e27994102f6de6f8f76c63e38e1 (diff)
downloadmpv-fae73079310eef9dce9737f2e37ff4b80c8830ee.tar.bz2
mpv-fae73079310eef9dce9737f2e37ff4b80c8830ee.tar.xz
Port several python scripts to Perl
file2string.pl and vdpau_functions.pl are direct ports. matroska.py was reimplemented as the Parse::Matroska module in CPAN, and matroska.pl was made a client of Parse::Matroska. A copy of Parse::Matroska is included in TOOLS/lib, and matroska.pl looks there first when trying to load the module. osxbundle.py was not ported since I have no means to verify it. Python is always available on OSX though, so there is no harm in removing the check for it on configure.
Diffstat (limited to 'TOOLS/file2string.py')
-rwxr-xr-xTOOLS/file2string.py27
1 files changed, 0 insertions, 27 deletions
diff --git a/TOOLS/file2string.py b/TOOLS/file2string.py
deleted file mode 100755
index 6cdd1a72ae..0000000000
--- a/TOOLS/file2string.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-
-# Convert the contents of a file into a C string constant.
-# Note that the compiler will implicitly add an extra 0 byte at the end
-# of every string, so code using the string may need to remove that to get
-# the exact contents of the original file.
-
-import sys
-
-# Indexing a byte string yields int on Python 3.x, and a str on Python 2.x
-def pord(c):
- return ord(c) if type(c) == str else c
-
-def main(infile):
- conv = ['\\' + ("%03o" % c) for c in range(256)]
- safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" \
- "0123456789!#%&'()*+,-./:;<=>?[]^_{|}~ "
- for c in safe_chars:
- conv[ord(c)] = c
- for c, esc in ("\nn", "\tt", r"\\", '""'):
- conv[ord(c)] = '\\' + esc
- for line in infile:
- sys.stdout.write('"' + ''.join(conv[pord(c)] for c in line) + '"\n')
-
-with open(sys.argv[1], 'rb') as infile:
- sys.stdout.write("// Generated from %s\n\n" % sys.argv[1])
- main(infile)