"Fossies" - the Fresh Open Source Software Archive

Member "SDL2_ttf-2.20.2/external/freetype/builds/mac/ascii2mpw.py" (25 May 2022, 1033 Bytes) of package /linux/misc/SDL2_ttf-2.20.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "ascii2mpw.py" see the Fossies "Dox" file reference documentation.

    1 #!/usr/bin/env python
    2 import sys
    3 import string
    4 
    5 if len( sys.argv ) == 1 :
    6   for asc_line in sys.stdin.readlines():
    7     mpw_line = string.replace(asc_line, "\\xA5", "\245")
    8     mpw_line = string.replace(mpw_line, "\\xB6", "\266")
    9     mpw_line = string.replace(mpw_line, "\\xC4", "\304")
   10     mpw_line = string.replace(mpw_line, "\\xC5", "\305")
   11     mpw_line = string.replace(mpw_line, "\\xFF", "\377")
   12     mpw_line = string.replace(mpw_line, "\n",   "\r")
   13     mpw_line = string.replace(mpw_line, "\\n",   "\n")
   14     sys.stdout.write(mpw_line)
   15 elif sys.argv[1] == "-r" :
   16   for mpw_line in sys.stdin.readlines():
   17     asc_line = string.replace(mpw_line, "\n",   "\\n")
   18     asc_line = string.replace(asc_line, "\r",   "\n")
   19     asc_line = string.replace(asc_line, "\245", "\\xA5")
   20     asc_line = string.replace(asc_line, "\266", "\\xB6")
   21     asc_line = string.replace(asc_line, "\304", "\\xC4")
   22     asc_line = string.replace(asc_line, "\305", "\\xC5")
   23     asc_line = string.replace(asc_line, "\377", "\\xFF")
   24     sys.stdout.write(asc_line)