misc/libfreetype/builds/mac/ascii2mpw.py
author sheepluva
Thu, 03 May 2012 14:21:53 +0200
changeset 7017 19a434fc91fc
parent 5172 88f2e05288ba
permissions -rw-r--r--
visually indicate when map preview generation is in progress.
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)