コード例 #1
0
ファイル: generator_as.py プロジェクト: gamebytes/microtome
AS3_MUTABLE_TYPENAMES = {
    s.TomeType: "microtome.MutableTome",
}

PRIMITIVE_PROPNAMES = {
    s.BoolType: "microtome.prop.BoolProp",
    s.IntType: "microtome.prop.IntProp",
    s.FloatType: "microtome.prop.NumberProp"
}

OBJECT_PROPNAME = "microtome.prop.ObjectProp"

LIBRARY_FILENAME = "MicrotomeTypes.as"
TOME_TEMPLATE_NAME = "Tome.as"
MUTABLE_TOME_TEMPLATE_NAME = "MutableTome.as"
TEMPLATES_DIR = util.abspath("templates/as")

# stuff we always import
BASE_CLASS_IMPORTS = set(["microtome.prop.Prop", "microtome.prop.PropSpec"])
BASE_INTERFACE_IMPORTS = set()
# stuff we never import (packageless typenames: Boolean, int, etc)
DISCARD_IMPORTS = set([name for name in AS3_TYPENAMES.values() if util.get_namespace(name) == ""])


def comment_prefix():
    return "//"

def generate_library(lib):
    '''Returns a list of (filename, filecontents) tuples representing the generated files to
    be written to disk'''
コード例 #2
0
ファイル: generator_objc.py プロジェクト: roguenet/microtome
    s.PageRefType: "MTPageRef",
    s.TomeType: "MTMutableTome"
}

PRIMITIVE_PROPNAMES = {
    s.BoolType: "MTBoolProp",
    s.IntType: "MTIntProp",
    s.FloatType: "MTFloatProp"
}

OBJECT_PROPNAME = "MTObjectProp"

LIBRARY_HEADER = "MicrotomePages.h"
LIBRARY_CLASS = "MicrotomePages.m"

TEMPLATES_DIR = util.abspath("templates/objc")

# stuff we always import
BASE_IMPORTS = set(["microtome"])
# stuff we don't need to import/forward-declare (built-in types)
DISCARD_IMPORTS = set([name for name in OBJC_TYPENAMES.values() if not name.startswith("MT")])


def comment_prefix():
    return "//"

def generate_library(lib):
    '''Returns a list of (filename, filecontents) tuples representing the generated files to
    be written to disk'''

    # "escape" param disables html-escaping