def main():
	util.chdir_top()

	tags = [(name, getEnumName(name, "Tag")) for name in sorted(List_HTML_Tags.split() + List_Other_Tags.split())]
	attrs = [(name, getEnumName(name, "Attr")) for name in sorted(List_HTML_Attrs.split() + List_Other_Attrs.split())]
	aligns = [(name, getEnumName(name, "Align")) for name in sorted(List_Align_Values.split())]
	cssProps = [(name, getEnumName(name, "Css")) for name in sorted(List_CSS_Props.split())]
	cssColors = [(name, "MKRGB(%s)" % value) for (name, value) in sorted(List_CSS_Colors)]

	enum_htmltag = createTypeEnum(tags, "HtmlTag", "Tag_NotFound")
	enum_htmlattr = createTypeEnum(attrs, "HtmlAttr", "Attr_NotFound")
	enum_alignattr = createTypeEnum(aligns, "AlignAttr", "Align_NotFound")
	enum_cssprop = createTypeEnum(cssProps, "CssProp", "Css_Unknown")

	code_defines = Template_Defines
	code_htmltag = createFastFinder(tags, "HtmlTag", "Tag_NotFound", True)
	code_htmlattr = createFastFinder(attrs, "HtmlAttr", "Attr_NotFound", True)
	code_selfclosing = createFastSelector(tags, List_Self_Closing_Tags.split(), "IsTagSelfClosing", "HtmlTag")
	code_inlinetag = createFastSelector(tags, List_Inline_Tags.split(), "IsInlineTag", "HtmlTag")
	code_alignattr = createFastFinder(aligns, "AlignAttr", "Align_NotFound", True)
	code_htmlentity = Template_Entities_Comment + "\n" + createFastFinder(List_HTML_Entities, "uint32_t", "(uint32_t)-1", False, "HtmlEntityRune")
	code_cssprop = createFastFinder(cssProps, "CssProp", "Css_Unknown", True)
	code_csscolor = createFastFinder(cssColors, "ARGB", "MKRGBA(0,0,0,0)", True, "CssColor")

	content = Template_Lookup_Header % locals()
	open("src/utils/HtmlParserLookup.h", "wb").write(content.replace("\n", "\r\n"))
	content = Template_Lookup_Code[:-1] % locals()
	open("src/utils/HtmlParserLookup.cpp", "wb").write(content.replace("\n", "\r\n"))
Example #2
0
def main():
    util.chdir_top()

    groups = {}
    for file in trans_gen.C_FILES_TO_PROCESS:
        groups.update(extract_accesskey_groups(file))

    translations = open(trans_download.lastDownloadFilePath(), "rb").read()
    translations = trans_download.parseTranslations(translations)

    detect_accesskey_clashes(groups, translations)
def main():
	util.chdir_top()

	groups = {}
	for file in trans_gen.C_FILES_TO_PROCESS:
		groups.update(extract_accesskey_groups(file))

	translations = open(trans_download.lastDownloadFilePath(), "rb").read()
	translations = trans_download.parseTranslations(translations)

	detect_accesskey_clashes(groups, translations)
Example #4
0
def main():
	util.chdir_top()

	# don't include/export doc_* functions, support for additional input/output formats and form support
	doc_exports = collectFunctions("source/fitz/document-all.c") + ["fz_get_annot_type"]
	more_formats = collectFunctions("source/fitz/svg-device.c") + collectFunctions("source/fitz/output-pcl.c") + collectFunctions("source/fitz/output-pwg.c")
	form_exports = collectFunctions("source/pdf/pdf-form.c") + collectFunctions("source/pdf/pdf-event.c") + collectFunctions("source/pdf/pdf-appearance.c") + ["pdf_access_submit_event", "pdf_init_ui_pointer_event"]
	misc_exports = collectFunctions("source/fitz/test-device.c") + ["fz_set_stderr", "fz_set_stdout", "fz_colorspace_name_process_colorants", "fz_getoptw", "fz_valgrind_pixmap", "fz_stderr", "track_usage"]
	sign_exports = ["pdf_crypt_buffer", "pdf_read_pfx", "pdf_sign_signature", "pdf_signer_designated_name", "pdf_free_designated_name"]

	fitz_exports = generateExports("include/mupdf/fitz", doc_exports + more_formats + misc_exports)
	mupdf_exports = generateExports("include/mupdf/pdf", form_exports + sign_exports + ["pdf_drop_designated_name", "pdf_print_xref", "pdf_recognize", "pdf_resolve_obj", "pdf_open_compressed_stream", "pdf_finish_edit"])

	list = LIBMUPDF_DEF % locals()
	open("platform/win32/libmupdf.def", "wb").write(list.replace("\n", "\r\n"))
Example #5
0
def main():
    util.chdir_top()

    tags = [
        (name, getEnumName(name, "Tag"))
        for name in sorted(List_HTML_Tags.split() + List_Other_Tags.split())
    ]
    attrs = [
        (name, getEnumName(name, "Attr"))
        for name in sorted(List_HTML_Attrs.split() + List_Other_Attrs.split())
    ]
    aligns = [(name, getEnumName(name, "Align"))
              for name in sorted(List_Align_Values.split())]
    cssProps = [(name, getEnumName(name, "Css"))
                for name in sorted(List_CSS_Props.split())]
    cssColors = [(name, "MKRGB(%s)" % value)
                 for (name, value) in sorted(List_CSS_Colors)]

    enum_htmltag = createTypeEnum(tags, "HtmlTag", "Tag_NotFound")
    enum_htmlattr = createTypeEnum(attrs, "HtmlAttr", "Attr_NotFound")
    enum_alignattr = createTypeEnum(aligns, "AlignAttr", "Align_NotFound")
    enum_cssprop = createTypeEnum(cssProps, "CssProp", "Css_Unknown")

    code_defines = Template_Defines
    code_htmltag = createFastFinder(tags, "HtmlTag", "Tag_NotFound", True)
    code_htmlattr = createFastFinder(attrs, "HtmlAttr", "Attr_NotFound", True)
    code_selfclosing = createFastSelector(tags, List_Self_Closing_Tags.split(),
                                          "IsTagSelfClosing", "HtmlTag")
    code_inlinetag = createFastSelector(tags, List_Inline_Tags.split(),
                                        "IsInlineTag", "HtmlTag")
    code_alignattr = createFastFinder(aligns, "AlignAttr", "Align_NotFound",
                                      True)
    code_htmlentity = Template_Entities_Comment + "\n" + createFastFinder(
        List_HTML_Entities, "uint32_t", "(uint32_t)-1", False,
        "HtmlEntityRune")
    code_cssprop = createFastFinder(cssProps, "CssProp", "Css_Unknown", True)
    code_csscolor = createFastFinder(cssColors, "ARGB", "MKRGBA(0,0,0,0)",
                                     True, "CssColor")

    content = Template_Lookup_Header % locals()
    open("src/utils/HtmlParserLookup.h",
         "wb").write(content.replace("\n", "\r\n"))
    content = Template_Lookup_Code[:-1] % locals()
    open("src/utils/HtmlParserLookup.cpp",
         "wb").write(content.replace("\n", "\r\n"))
def main():
	util.chdir_top()
	os.chdir("mupdf")

	# don't include/export doc_* functions, support for additional input/output formats and form support
	doc_exports = collectFunctions("source/fitz/document.c") + collectFunctions("source/fitz/document-all.c") + collectFunctions("source/fitz/document-no-run.c") + ["fz_get_annot_type"]
	more_formats = collectFunctions("source/fitz/svg-device.c") + collectFunctions("source/fitz/output-pcl.c") + collectFunctions("source/fitz/output-pwg.c")
	form_exports = collectFunctions("source/pdf/pdf-form.c") + collectFunctions("source/pdf/pdf-event.c") + collectFunctions("source/pdf/pdf-appearance.c") + collectFunctions("source/pdf/js/pdf-jsimp-cpp.c") + ["pdf_access_submit_event", "pdf_init_ui_pointer_event"]
	misc_exports = collectFunctions("source/fitz/stream-prog.c") + collectFunctions("source/fitz/test-device.c")
	sign_exports = ["pdf_crypt_buffer", "pdf_read_pfx", "pdf_sign_signature", "pdf_signer_designated_name", "pdf_free_designated_name"]

	fitz_exports = generateExports("include/mupdf/fitz", doc_exports + more_formats + misc_exports)
	mupdf_exports = generateExports("include/mupdf/pdf", form_exports + sign_exports + ["pdf_open_compressed_stream"])
	muxps_exports = generateExports("include/mupdf/xps.h", ["xps_parse_solid_color_brush", "xps_print_path"])
	unarr_exports = generateExports("../ext/unarr/unarr.h")

	list = LIBMUPDF_DEF % locals()
	open("../src/libmupdf.def", "wb").write(list.replace("\n", "\r\n"))
def main():
    util.chdir_top()
    os.chdir("mupdf")

    # don't include/export doc_* functions, support for additional input/output formats and form support
    doc_exports = collectFunctions(
        "source/fitz/document.c") + collectFunctions(
            "source/fitz/document-all.c") + collectFunctions(
                "source/fitz/document-no-run.c") + ["fz_get_annot_type"]
    more_formats = collectFunctions(
        "source/fitz/svg-device.c") + collectFunctions(
            "source/fitz/output-pcl.c") + collectFunctions(
                "source/fitz/output-pwg.c")
    form_exports = collectFunctions(
        "source/pdf/pdf-form.c") + collectFunctions(
            "source/pdf/pdf-event.c") + collectFunctions(
                "source/pdf/pdf-appearance.c") + collectFunctions(
                    "source/pdf/js/pdf-jsimp-cpp.c") + [
                        "pdf_access_submit_event", "pdf_init_ui_pointer_event"
                    ]
    misc_exports = collectFunctions(
        "source/fitz/stream-prog.c") + collectFunctions(
            "source/fitz/test-device.c")
    sign_exports = [
        "pdf_crypt_buffer", "pdf_read_pfx", "pdf_sign_signature",
        "pdf_signer_designated_name", "pdf_free_designated_name"
    ]

    fitz_exports = generateExports("include/mupdf/fitz",
                                   doc_exports + more_formats + misc_exports)
    mupdf_exports = generateExports(
        "include/mupdf/pdf",
        form_exports + sign_exports + ["pdf_open_compressed_stream"])
    muxps_exports = generateExports(
        "include/mupdf/xps.h",
        ["xps_parse_solid_color_brush", "xps_print_path"])
    unarr_exports = generateExports("../ext/unarr/unarr.h")

    list = LIBMUPDF_DEF % locals()
    open("../src/libmupdf.def", "wb").write(list.replace("\n", "\r\n"))
            result += ["\t" * level + (node[0] + " [" if node[0] else "[")]
            result += Serialize(node[1], level + 1)
            result += ["\t" * level + "]"]
        elif type(node[1]) in [str, unicode]:
            result += ["\t" * level + node[0] + " = " + node[1]]
        else:
            assert False, "value must be Node/list or string"

    if level > 0:
        return result
        # encode the result as UTF-8
    return ("\n".join(result) + "\n").encode("utf-8-sig")


if __name__ == "__main__":
    util.chdir_top()

    data = " Key : Value \nNode\n[\n[ Node ]\nKey=Value2".encode("utf-8-sig")
    root = Parse(data)
    assert root.GetValue("key") == "Value"
    assert root.GetChild("node")
    assert root.GetChild("node", 1).GetValue("key") == "Value2"
    data = Serialize(root)
    assert Serialize(Parse(data)) == data

    path = os.path.join("obj-dbg", "SumatraPDF-settings.txt")
    if os.path.exists(path):
        data = open(path).read()
        root = Parse(data)
        # modification example: filter out all states for missing files
        root.GetChild("FileStates").data = [
Example #9
0
    inside = "\n".join(lines)
    s = langs_html_tmpl.replace("%INSIDE%", inside)
    s = s.replace("%VER%", str(g_version))
    s = s.replace("settings.html", settings_file_name())
    p = os.path.join(settings_dir(), langs_file_name())
    open(p, "w").write(s)
    if blog_dir() is not None:
        p = os.path.join(blog_dir(), langs_file_name())
        open(p, "w").write(s)


def gen_settings_html():
    prefs = gen_settingsstructs.GlobalPrefs
    inside = gen_struct(prefs)
    s = html_tmpl.replace("%INSIDE%", inside)
    print("g_version: '%s'\n" % g_version)
    s = s.replace("%VER%", str(g_version))
    s = s.replace("langs.html", langs_file_name())
    p = os.path.join(settings_dir(), settings_file_name())
    open(p, "w").write(s)
    if blog_dir() is not None:
        p = os.path.join(blog_dir(), settings_file_name())
        open(p, "w").write(s)


if __name__ == "__main__":
    util.chdir_top()
    gen_langs_html()
    gen_settings_html()
    gen_settingsstructs.gen()