예제 #1
0
파일: mkapi.py 프로젝트: mrkn/zproject
def show_zproto_model(fp, klass, decls, comments, macros):
    print("""
<!---
    This api model is generated by mkapi.py
    please review the result carefully and especially don't forget
    to add fresh="1" to all methods allocating new functions
-->
<class name = "%s" >

""" % (klass, ), file=fp)

    klass_l = len(klass) + 1
    include = os.path.join("include", klass + ".h")

    for macro_decl in macros:
        print("""    <constant name = "%s" value = %s >%s</constant>""" % (
            macro_decl.name[klass_l:].lower(),
            s_xml_quoteattr(macro_decl.value),
            macro_decl.comment),
            file=fp)

    for decl_dict in (d for d in decls if os.path.normpath(d["coord"].file) == include):

        if decl_dict["type"] == "enum":
            s_show_zproto_enum(fp, klass_l, decl_dict)
            continue

        if decl_dict["name"].endswith("_test"):
            continue

        s_show_zproto_mc(fp, klass, decl_dict, comments)

    print("</class>", file=fp)
예제 #2
0
def show_zproto_model(fp, klass, decls, comments, macros):
    print("""
<!--
    This model defines a public API for binding.
-->
<class name = "%s" >

    <include filename = "../license.xml" />
    """ % (klass, ),
          file=fp)

    klass_l = len(klass) + 1
    include = os.path.join("include", klass + ".h")

    for macro_decl in macros:
        print("""    <constant name = "%s" value = %s >%s</constant>\n""" %
              (macro_decl.name[klass_l:].lower(),
               s_xml_quoteattr(macro_decl.value), macro_decl.comment),
              file=fp)

    for decl_dict in (d for d in decls if d["coord"].file == include):

        if decl_dict["type"] == "enum":
            s_show_zproto_enum(fp, klass_l, decl_dict)
            continue

        if decl_dict["name"] == klass + "_new":
            print("""
    <!-- Constructor is optional; default one has no arguments -->
    <constructor>
        Create a new %s""" % (klass, ),
                  file=fp)
            s_show_zproto_model_arguments(fp, decl_dict)
            print("""    </constructor>""", file=fp)
            continue

        if decl_dict["name"] == klass + "_destroy":
            print("""
    <!-- Destructor is optional; default one follows standard style -->
    <destructor />\n""",
                  file=fp)
            continue

        s_show_zproto_mc(fp, klass_l, decl_dict, comments)

    print("</class>", file=fp)
예제 #3
0
파일: mkapi.py 프로젝트: vyskocilm/mkapi
def show_zproto_model(fp, klass, decls, comments, macros):
    print("""
<!--
    This model defines a public API for binding.
-->
<class name = "%s" >

    <include filename = "../license.xml" />
    """ % (klass, ), file=fp)

    klass_l = len(klass) + 1
    include = os.path.join("include", klass + ".h")

    for macro_decl in macros:
        print("""    <constant name = "%s" value = %s >%s</constant>\n""" % (
            macro_decl.name[klass_l:].lower(),
            s_xml_quoteattr(macro_decl.value),
            macro_decl.comment),
            file=fp)


    for decl_dict in (d for d in decls if d["coord"].file == include):

        if decl_dict["type"] == "enum":
            s_show_zproto_enum(fp, klass_l, decl_dict)
            continue

        if decl_dict["name"] == klass + "_new":
            print("""
    <!-- Constructor is optional; default one has no arguments -->
    <constructor>
        Create a new %s""" % (klass, ), file=fp)
            s_show_zproto_model_arguments(fp, decl_dict)
            print("""    </constructor>""", file=fp)
            continue

        if decl_dict["name"] == klass + "_destroy":
            print("""
    <!-- Destructor is optional; default one follows standard style -->
    <destructor />\n""", file=fp)
            continue

        s_show_zproto_mc(fp, klass_l, decl_dict, comments)

    print("</class>", file=fp)