def main():
    util2.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() + List_SMX_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", "-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():
	util2.chdir_top()

	structDef = BuildStruct(GlobalPrefs)
	structMetadata = BuildMetaData(GlobalPrefs)

	content = SettingsStructs_Header % locals()
	open("src/SettingsStructs.h", "wb").write(content.replace("\n", "\r\n").replace("\t", "    "))

	content = AssembleDefaults(GlobalPrefs,
		"You can use this file to modify experimental and expert settings not changeable " +
		"through the UI instead of modifying SumatraPDF-settings.txt directly. Just copy " +
		"this file alongside SumatraPDF-settings.txt and change the values below. " +
		"They will overwrite the corresponding settings in SumatraPDF-settings.txt at every startup.")
	content = "# Warning: This file only works for builds compiled with ENABLE_SUMATRAPDF_USER_INI !\n\n" + content
	open("docs/SumatraPDF-user.ini", "wb").write(content.replace("\n", "\r\n").encode("utf-8-sig"))

	beforeUseDefaultState = True
	for field in FileSettings:
		if field.name == "UseDefaultState":
			beforeUseDefaultState = False
		elif beforeUseDefaultState:
			assert field.name not in rememberedDisplayState, "%s shouldn't be serialized when UseDefaultState is true" % field.name
		else:
			assert field.name in rememberedDisplayState or field.internal, "%s won't be serialized when UseDefaultState is true" % field.name
Esempio n. 3
0
def main():
    util2.chdir_top()

    structDef = BuildStruct(GlobalPrefs)
    structMetadata = BuildMetaData(GlobalPrefs)

    content = SettingsStructs_Header % locals()
    open("src/SettingsStructs.h",
         "wb").write(content.replace("\n", "\r\n").replace("\t", "    "))

    content = AssembleDefaults(
        GlobalPrefs,
        "You can use this file to modify experimental and expert settings not changeable "
        +
        "through the UI instead of modifying SumatraPDF-settings.txt directly. Just copy "
        +
        "this file alongside SumatraPDF-settings.txt and change the values below. "
        +
        "They will overwrite the corresponding settings in SumatraPDF-settings.txt at every startup."
    )
    content = "# Warning: This file only works for builds compiled with ENABLE_SUMATRAPDF_USER_INI !\n\n" + content
    open("docs/SumatraPDF-user.ini",
         "wb").write(content.replace("\n", "\r\n").encode("utf-8-sig"))

    beforeUseDefaultState = True
    for field in FileSettings:
        if field.name == "UseDefaultState":
            beforeUseDefaultState = False
        elif beforeUseDefaultState:
            assert field.name not in rememberedDisplayState, "%s shouldn't be serialized when UseDefaultState is true" % field.name
        else:
            assert field.name in rememberedDisplayState or field.internal, "%s won't be serialized when UseDefaultState is true" % field.name
def main():
    util2.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") + [
        "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/stream-prog.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"])

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

    # don't include/export doc_* functions, mucbz.h and muimage.h functions and svg and pwg functions
    doc_exports = collectFunctions("fitz/doc_document.c") + collectFunctions(
        "fitz/doc_interactive.c")
    more_formats = collectFunctions("fitz/dev_svg.c") + collectFunctions(
        "fitz/res_pwg.c")
    ignore_exports = doc_exports + more_formats + [
        "fz_init_ui_pointer_event", "fz_access_submit_event"
    ]

    fitz_exports = generateExports("fitz/fitz.h",
                                   ignore_exports) + "\n\n" + generateExports(
                                       "fitz/fitz-internal.h", ignore_exports)
    mupdf_exports = generateExports("pdf/mupdf.h") + "\n\n" + generateExports(
        "pdf/mupdf-internal.h",
        ["pdf_crypt_buffer", "pdf_open_compressed_stream"])
    muxps_exports = generateExports("xps/muxps.h") + "\n\n" + generateExports(
        "xps/muxps-internal.h",
        ["xps_parse_solid_color_brush", "xps_print_path"])

    list = LIBMUPDF_DEF % locals()
    open("../src/libmupdf.def", "wb").write(list.replace("\n", "\r\n"))
def main():
	util2.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():
    util2.chdir_top()

    vcproj = open(VC2008_PROJ, "rb").read().replace("\r\n", "\n")
    fileNodes = parseNodes(getFilesNode(vcproj))
    addedPaths = findAddedFiles(extractPaths(fileNodes))
    vcprojNew = updateProj(vcproj, fileNodes, addedPaths)

    if vcprojNew != vcproj:
        open(VC2008_PROJ, "wb").write(vcprojNew.replace("\n", "\r\n"))
Esempio n. 8
0
def main():
	util2.chdir_top()
	
	vcproj = open(VC2008_PROJ, "rb").read().replace("\r\n", "\n")
	fileNodes = parseNodes(getFilesNode(vcproj))
	addedPaths = findAddedFiles(extractPaths(fileNodes))
	vcprojNew = updateProj(vcproj, fileNodes, addedPaths)
	
	if vcprojNew != vcproj:
		open(VC2008_PROJ, "wb").write(vcprojNew.replace("\n", "\r\n"))
Esempio n. 9
0
def main():
	util2.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)
Esempio n. 10
0
def main():
    util2.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)
Esempio n. 11
0
def main():
	util2.chdir_top()
	os.chdir("mupdf")
	
	fitz_exports = generateExports("fitz/fitz.h", ["fz_init_ui_pointer_event", "fz_access_submit_event"]) + "\n\n" + generateExports("fitz/fitz-internal.h", ["fz_assert_lock_held", "fz_assert_lock_not_held", "fz_lock_debug_lock", "fz_lock_debug_unlock", "fz_purge_glyph_cache"])
	mupdf_exports = generateExports("pdf/mupdf.h") + "\n\n" + generateExports("pdf/mupdf-internal.h", ["pdf_crypt_buffer", "pdf_open_compressed_stream"])
	muxps_exports = generateExports("xps/muxps.h") + "\n\n" + generateExports("xps/muxps-internal.h", ["xps_parse_solid_color_brush", "xps_print_path"])
	mucbz_exports = generateExports("cbz/mucbz.h")

	list = LIBMUPDF_DEF % locals()
	open("../src/libmupdf.def", "wb").write(list.replace("\n", "\r\n"))
Esempio n. 12
0
def main():
    util2.chdir_top()

    files = build_files(g_filters, pj(top_dir(), "vs"))

    vcxproj_part = gen_vcxproj_part(files)
    file_path = os.path.join("vs", "sumatrapdf-vc2013.vcxproj")
    replace_item_group(file_path, file_path, vcxproj_part)

    filters_part = gen_vcxproj_filters_part(g_filters, files)
    file_path = os.path.join("vs", "sumatrapdf-vc2013.vcxproj.filters")
    replace_item_group(file_path, file_path, filters_part)
Esempio n. 13
0
def main():
    util2.chdir_top()

    files = build_files(g_filters, pj(top_dir(), "vs"))

    vcxproj_part = gen_vcxproj_part(files)
    file_path = os.path.join("vs", "sumatrapdf-vc2013.vcxproj")
    replace_item_group(file_path, file_path, vcxproj_part)

    filters_part = gen_vcxproj_filters_part(g_filters, files)
    file_path = os.path.join("vs", "sumatrapdf-vc2013.vcxproj.filters")
    replace_item_group(file_path, file_path, filters_part)
Esempio n. 14
0
def main():
	util2.chdir_top()

	appStructDef = BuildStruct(GlobalPrefs)
	appStructMetadata = BuildMetaData(GlobalPrefs)
	userStructDef = BuildStruct(UserPrefs)
	userStructMetadata = BuildMetaData(UserPrefs)

	content = AppPrefs3_Header % locals()
	open("tools/serini_test/AppPrefs3.h", "wb").write(content.replace("\n", "\r\n").replace("\t", "    "))
	
	content = AssembleDefaults(UserPrefs)
	open("tools/serini_test/SumatraPDF-user.ini", "wb").write(content.replace("\n", "\r\n"))
Esempio n. 15
0
def main():
	util2.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") + ["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") + ["pdf_access_submit_event", "pdf_init_ui_pointer_event"]
	
	fitz_exports = generateExports("include/mupdf/fitz", doc_exports + more_formats)
	mupdf_exports = generateExports("include/mupdf/pdf", form_exports + ["pdf_crypt_buffer", "pdf_open_compressed_stream"])
	muxps_exports = generateExports("include/mupdf/xps.h", ["xps_parse_solid_color_brush", "xps_print_path"])
	
	list = LIBMUPDF_DEF % locals()
	open("../src/libmupdf.def", "wb").write(list.replace("\n", "\r\n"))
Esempio n. 16
0
def main():
	util2.chdir_top()
	os.chdir("mupdf")
	
	# don't include/export doc_* functions, mucbz.h and muimage.h functions and svg and pwg functions
	doc_exports = collectFunctions("fitz/doc_document.c") + collectFunctions("fitz/doc_interactive.c")
	more_formats = collectFunctions("fitz/dev_svg.c") + collectFunctions("fitz/res_pwg.c")
	ignore_exports = doc_exports + more_formats + ["fz_init_ui_pointer_event", "fz_access_submit_event"]
	
	fitz_exports = generateExports("fitz/fitz.h", ignore_exports) + "\n\n" + generateExports("fitz/fitz-internal.h", ignore_exports)
	mupdf_exports = generateExports("pdf/mupdf.h") + "\n\n" + generateExports("pdf/mupdf-internal.h", ["pdf_crypt_buffer", "pdf_open_compressed_stream"])
	muxps_exports = generateExports("xps/muxps.h") + "\n\n" + generateExports("xps/muxps-internal.h", ["xps_parse_solid_color_brush", "xps_print_path"])
	
	list = LIBMUPDF_DEF % locals()
	open("../src/libmupdf.def", "wb").write(list.replace("\n", "\r\n"))
Esempio n. 17
0
def main():
	util2.chdir_top()

	structDef = BuildStruct(GlobalPrefs)
	structMetadata = BuildMetaData(GlobalPrefs)

	content = SettingsStructs_Header % locals()
	open("src/SettingsStructs.h", "wb").write(content.replace("\n", "\r\n").replace("\t", "    "))

	content = AssembleDefaults(GlobalPrefs,
		"You can use this file to modify experimental and expert settings not changeable " +
		"through the UI instead of modifying SumatraPDF-settings.txt directly. Just copy " +
		"this file alongside SumatraPDF-settings.txt and change the values below. " +
		"They will overwrite the corresponding settings in SumatraPDF-settings.txt at every startup.")
	content = "# Warning: This file only works for builds compiled with ENABLE_SUMATRAPDF_USER_INI !\n\n" + content
	open("docs/SumatraPDF-user.ini", "wb").write(content.replace("\n", "\r\n").encode("utf-8-sig"))
Esempio n. 18
0
def main():
	util2.chdir_top()

	structDef = BuildStruct(GlobalPrefs)
	structMetadata = BuildMetaData(GlobalPrefs)

	content = SettingsStructs_Header % locals()
	open("src/SettingsStructs.h", "wb").write(content.replace("\n", "\r\n").replace("\t", "    "))

	# content = AssembleDefaultsSqt(UserPrefs,
	content = AssembleDefaults(UserPrefs,
		"You can use this file to modify settings not changeable through the UI " +
		"instead of modifying SumatraPDF.dat directly. Just copy this file alongside " +
		"SumatraPDF.dat and change the values below. They will overwrite the corresponding " +
		"settings in SumatraPDF.dat at every startup.")
	content = "# Caution: All settings below are still subject to change!\n\n" + content
	open("docs/SumatraPDF-user.ini", "wb").write(content.replace("\n", "\r\n").encode("utf-8-sig"))
Esempio n. 19
0
def main():
	util2.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():
	util2.chdir_top()

	structDef = BuildStruct(GlobalPrefs)
	structMetadata = BuildMetaData(GlobalPrefs)

	content = SettingsStructs_Header % locals()
	open("src/SettingsStructs.h", "wb").write(content.replace("\n", "\r\n").replace("\t", "    "))

	content = GenerateSettingsHtml()
	open("docs/settings.html", "wb").write(content.replace("\n", "\r\n"))

	beforeUseDefaultState = True
	for field in FileSettings:
		if field.name == "UseDefaultState":
			beforeUseDefaultState = False
		elif beforeUseDefaultState:
			assert field.name not in rememberedDisplayState, "%s shouldn't be serialized when UseDefaultState is true" % field.name
		else:
			assert field.name in rememberedDisplayState or field.internal, "%s won't be serialized when UseDefaultState is true" % field.name
Esempio n. 21
0
def main():
	util2.chdir_top()

	structDef = BuildStruct(GlobalPrefs)
	structMetadata = BuildMetaData(GlobalPrefs)

	content = SettingsStructs_Header % locals()
	open("src/SettingsStructs.h", "wb").write(content.replace("\n", "\r\n").replace("\t", "    "))

	content = GenerateSettingsHtml()
	open("docs/settings.html", "wb").write(content.replace("\n", "\r\n"))

	beforeUseDefaultState = True
	for field in FileSettings:
		if field.name == "UseDefaultState":
			beforeUseDefaultState = False
		elif beforeUseDefaultState:
			assert field.name not in rememberedDisplayState, "%s shouldn't be serialized when UseDefaultState is true" % field.name
		else:
			assert field.name in rememberedDisplayState or field.internal, "%s won't be serialized when UseDefaultState is true" % field.name
Esempio n. 22
0
    file_name = "langs.html"
    p = os.path.join("scripts", file_name)
    open(p, "w").write(s)
    if blog_dir():
        p = os.path.join(blog_dir(), file_name)
        open(p, "w").write(s)


def gen_html():
    prefs = gen_settingsstructs.GlobalPrefs
    inside = gen_struct(prefs)
    s = html_tmpl.replace("%INSIDE%", inside)
    file_name = "settings" + g_version + ".html"
    p = os.path.join("scripts", file_name)
    open(p, "w").write(s)
    if blog_dir():
        p = os.path.join(blog_dir(), file_name)
        open(p, "w").write(s)
        # also save the latest version as settings.html so that there is a
        # permament version we can link from from docs that is independent of
        # program version number
        p = os.path.join(blog_dir(), "settings.html")
        open(p, "w").write(s)


if __name__ == "__main__":
    util2.chdir_top()
    gen_langs_html()
    gen_html()
    gen_settingsstructs.main()
def main():
	util2.chdir_top()
	injectDependencyList(flattenDependencyList(createDependencyList()))
def main():
	util2.chdir_top()
	injectDependencyList(flattenDependencyList(createDependencyList()))
    file_name = "langs.html"
    p = os.path.join("scripts", file_name)
    open(p, "w").write(s)
    if blog_dir() is not None:
        p = os.path.join(blog_dir(), file_name)
        open(p, "w").write(s)

def gen_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))
    file_name = "settings" + g_version + ".html"
    p = os.path.join("scripts", file_name)
    open(p, "w").write(s)
    if blog_dir() is not None:
        p = os.path.join(blog_dir(), file_name)
        open(p, "w").write(s)
        # also save the latest version as settings.html so that there is a
        # permament version we can link from from docs that is independent of
        # program version number
        p = os.path.join(blog_dir(), "settings.html")
        open(p, "w").write(s)

if __name__ == "__main__":
    util2.chdir_top()
    gen_langs_html()
    gen_html()
    gen_settingsstructs.main()