Exemplo n.º 1
0
Arquivo: rpc.py Projeto: spirali/kaira
def write_client_init_function(builder):
    builder.line("void calib_init(int argc, char **argv)")
    builder.block_begin()
    builder.line("client.connect();")

    for net in builder.project.nets:
        declaration = library.get_library_function_declaration(net)
        builder.line("client.register_function({0}, {1}, &${2}_id);",
                     writer.const_string(net.name),
                     writer.const_string(declaration), net.name)
    builder.block_end()
Exemplo n.º 2
0
Arquivo: rpc.py Projeto: Kobzol/kaira
def write_client_init_function(builder):
    builder.line("void calib_init(int argc, char **argv)")
    builder.block_begin()
    builder.line("client.connect();")

    for net in builder.project.nets:
        declaration = library.get_library_function_declaration(net)
        builder.line("client.register_function({0}, {1}, &${2}_id);",
                writer.const_string(net.name),
                writer.const_string(declaration),
                net.name)
    builder.block_end()
Exemplo n.º 3
0
Arquivo: rpc.py Projeto: spirali/kaira
def write_server_main(builder):
    builder.line("int main(int argc, char **argv)")
    builder.block_begin()
    builder.line("calib_init(argc, argv);")
    builder.line("CaServer server;")

    for net in builder.project.nets:
        declaration = library.get_library_function_declaration(net)
        builder.line("server.register_function({0},{1},{2});",
                     writer.const_string(net.name),
                     writer.const_string(declaration), net.name)
    builder.line("server.run();")
    builder.line("return 0;")
    builder.block_end()
Exemplo n.º 4
0
Arquivo: rpc.py Projeto: Kobzol/kaira
def write_server_main(builder):
    builder.line("int main(int argc, char **argv)")
    builder.block_begin()
    builder.line("calib_init(argc, argv);")
    builder.line("CaServer server;")

    for net in builder.project.nets:
        declaration = library.get_library_function_declaration(net)
        builder.line("server.register_function({0},{1},{2});",
                  writer.const_string(net.name),
                  writer.const_string(declaration),
                  net.name)
    builder.line("server.run();")
    builder.line("return 0;")
    builder.block_end()
Exemplo n.º 5
0
Arquivo: rpc.py Projeto: DiPi22/kaira
def write_client_library_function(builder, net):
    builder.line("void {0}({1})",
                 net.name,
                 library.get_library_function_declaration(net))
    builder.block_begin()

    builder.line("ca::Packer $packer(ca::PACKER_DEFAULT_SIZE, CACLIENT_RESERVED_CALL_PREFIX);")

    for place in net.get_input_places():
        builder.line("ca::pack($packer, {0.interface_input});", place)

    builder.line("ca::Unpacker $unpacker = client.call(${0}_id, $packer);", net.name)

    for place in net.get_output_places():
        builder.line("ca::unpack($unpacker, {0.interface_output});", place)

    builder.block_end()
Exemplo n.º 6
0
def write_client_library_function(builder, net):
    builder.line("void {0}({1})", net.name,
                 library.get_library_function_declaration(net))
    builder.block_begin()

    builder.line(
        "ca::Packer $packer(ca::PACKER_DEFAULT_SIZE, CACLIENT_RESERVED_CALL_PREFIX);"
    )

    for place in net.get_input_places():
        builder.line("ca::pack($packer, {0.interface_input});", place)

    builder.line("ca::Unpacker $unpacker = client.call(${0}_id, $packer);",
                 net.name)

    for place in net.get_output_places():
        builder.line("ca::unpack($unpacker, {0.interface_output});", place)

    builder.block_end()