Example #1
0
def snap_property_set(stream):
    position = stream.tell()
    x = stream.read(2)
    if x == "\\P":
        stream.seek(position)
        return property.do(stream)
    elif x == "\\N":
        stream.seek(position)
        return property.do_shortcut(stream, "N", "na")  # UCS Property: Name
    elif x == "\\G":
        stream.seek(position)
        return property.do_shortcut(stream, "G",
                                    "gc")  # UCS Property: General_Category
    elif x == "\\E":
        skip_whitespace(stream)
        if check(stream, "{") == False:
            error.log("Missing '{' after '\\E'.", stream)
        encoding_name = __snap_until(stream, "}").strip()
        result = codec_db.get_supported_unicode_character_set(encoding_name)
        if result is None:
            error.log("Error occured at this place.", stream)
        return result
    else:
        stream.seek(position)
        return None
Example #2
0
def __handle_codec(cl):
    codec_name = Setup.query_codec

    character_set = codec_db.get_supported_unicode_character_set(CodecAlias=codec_name)
    __display_set(character_set, cl)

    print
    print "Codec is designed for:"
    print repr(codec_db.get_supported_language_list(codec_name))[1:-1]
Example #3
0
def __handle_codec(cl):
    codec_name = Setup.query_encoding

    character_set = codec_db.get_supported_unicode_character_set(
        CodecAlias=codec_name)
    __display_set(character_set, cl)

    print
    print "Codec is designed for:"
    print repr(codec_db.get_supported_language_list(codec_name))[1:-1]
Example #4
0
def __handle_codec(cl):
    codec_name = cl.follow("", "--codec-info")
    supported_codec_list = codec_db.get_supported_codec_list(IncludeAliasesF=True)

    if codec_name == "":
        txt      = "Missing argument after '--codec-info'. Supported codecs are:\n\n"
        line_txt = ""
        for name in supported_codec_list:
            line_txt += name + ", "
            if len(line_txt) > 50: txt += line_txt + "\n"; line_txt = ""
        txt += line_txt
        txt = txt[:-2] + "."
        error_msg(txt)

    character_set = codec_db.get_supported_unicode_character_set(CodecAlias=codec_name)
    __display_set(character_set, cl)

    print
    print "Codec is designed for:"
    print repr(codec_db.get_supported_language_list(codec_name))[1:-1]
def snap_property_set(stream):
    position = stream.tell()
    x = stream.read(2)
    if   x == "\\P": 
        stream.seek(position)
        return property.do(stream)
    elif x == "\\N": 
        stream.seek(position)
        return property.do_shortcut(stream, "N", "na") # UCS Property: Name
    elif x == "\\G": 
        stream.seek(position)
        return property.do_shortcut(stream, "G", "gc") # UCS Property: General_Category
    elif x == "\\E": 
        skip_whitespace(stream)
        if check(stream, "{") == False:
            error_msg("Missing '{' after '\\E'.", stream)
        encoding_name = __snap_until(stream, "}").strip()
        return codec_db.get_supported_unicode_character_set(encoding_name, FH=stream)
    else:
        stream.seek(position)
        return None
Example #6
0
def __handle_codec(cl):
    codec_name = cl.follow("", "--codec-info")
    supported_codec_list = codec_db.get_supported_codec_list(
        IncludeAliasesF=True)

    if codec_name == "":
        txt = "Missing argument after '--codec-info'. Supported codecs are:\n\n"
        line_txt = ""
        for name in supported_codec_list:
            line_txt += name + ", "
            if len(line_txt) > 50:
                txt += line_txt + "\n"
                line_txt = ""
        txt += line_txt
        txt = txt[:-2] + "."
        error_msg(txt)

    character_set = codec_db.get_supported_unicode_character_set(
        CodecAlias=codec_name)
    __display_set(character_set, cl)

    print
    print "Codec is designed for:"
    print repr(codec_db.get_supported_language_list(codec_name))[1:-1]
Example #7
0
def __handle_codec_file(cl):
    file_name = cl.follow("", "--codec-file-info")
    character_set = codec_db.get_supported_unicode_character_set(FileName=file_name)
    __display_set(character_set, cl)
Example #8
0
def __handle_codec_file(cl):
    file_name = cl.follow("", "--codec-file-info")
    character_set = codec_db.get_supported_unicode_character_set(
        FileName=file_name)
    __display_set(character_set, cl)