misc/libfreetype/builds/mac/ascii2mpw.py
author koda
Mon, 25 Apr 2011 01:46:54 +0200
changeset 5172 88f2e05288ba
permissions -rwxr-xr-x
aaand let's add freetype as well while we are at it other smaller changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
#!/usr/bin/env python
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
import sys
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
import string
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
if len( sys.argv ) == 1 :
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
  for asc_line in sys.stdin.readlines():
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
    mpw_line = string.replace(asc_line, "\\xA5", "\245")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
    mpw_line = string.replace(mpw_line, "\\xB6", "\266")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
    mpw_line = string.replace(mpw_line, "\\xC4", "\304")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
    mpw_line = string.replace(mpw_line, "\\xC5", "\305")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
    mpw_line = string.replace(mpw_line, "\\xFF", "\377")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
    mpw_line = string.replace(mpw_line, "\n",   "\r")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
    mpw_line = string.replace(mpw_line, "\\n",   "\n")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
    sys.stdout.write(mpw_line)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
elif sys.argv[1] == "-r" :
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
  for mpw_line in sys.stdin.readlines():
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
    asc_line = string.replace(mpw_line, "\n",   "\\n")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
    asc_line = string.replace(asc_line, "\r",   "\n")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
    asc_line = string.replace(asc_line, "\245", "\\xA5")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
    asc_line = string.replace(asc_line, "\266", "\\xB6")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
    asc_line = string.replace(asc_line, "\304", "\\xC4")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
    asc_line = string.replace(asc_line, "\305", "\\xC5")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
    asc_line = string.replace(asc_line, "\377", "\\xFF")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
    sys.stdout.write(asc_line)