s += libxl_C_type_destroy(f.type, deref + f.name, False, "", deref)
    else:
        if ty.destructor_fn is not None:
            s += "%s(%s);\n" % (ty.destructor_fn, makeref + v)
            
    if s != "":
        s = indent + s
    return s.replace("\n", "\n%s" % indent).rstrip(indent)

if __name__ == '__main__':
    if len(sys.argv) < 4:
        print >>sys.stderr, "Usage: gentypes.py <idl> <header> <implementation>"
        sys.exit(1)

    idl = sys.argv[1]
    (_,types) = libxltypes.parse(idl)
                    
    header = sys.argv[2]
    print "outputting libxl type definitions to %s" % header

    f = open(header, "w")
    
    f.write("""#ifndef __LIBXL_TYPES_H
#define __LIBXL_TYPES_H

/*
 * DO NOT EDIT.
 *
 * This file is autogenerated by
 * "%s"
 */
Example #2
0
    s += "return libxl__enum_from_string(%s_string_table,\n" % ty.typename
    s += "                               %s, (int *)%s);\n" % (str, e)

    if s != "":
        s = indent + s
    return s.replace("\n", "\n%s" % indent).rstrip(indent)


if __name__ == '__main__':
    if len(sys.argv) != 5:
        print >> sys.stderr, "Usage: gentypes.py <idl> <header> <header-json> <implementation>"
        sys.exit(1)

    (_, idl, header, header_json, impl) = sys.argv

    (builtins, types) = libxltypes.parse(idl)

    print "outputting libxl type definitions to %s" % header

    f = open(header, "w")

    header_define = header.upper().replace('.', '_')
    f.write("""#ifndef %s
#define %s

/*
 * DO NOT EDIT.
 *
 * This file is autogenerated by
 * "%s"
 */
Example #3
0
    else:
        if ty.destructor_fn is not None:
            s += "%s(%s);\n" % (ty.destructor_fn, makeref + v)

    if s != "":
        s = indent + s
    return s.replace("\n", "\n%s" % indent).rstrip(indent)


if __name__ == '__main__':
    if len(sys.argv) < 4:
        print >> sys.stderr, "Usage: gentypes.py <idl> <header> <implementation>"
        sys.exit(1)

    idl = sys.argv[1]
    (_, types) = libxltypes.parse(idl)

    header = sys.argv[2]
    print "outputting libxl type definitions to %s" % header

    f = open(header, "w")

    f.write("""#ifndef __LIBXL_TYPES_H
#define __LIBXL_TYPES_H

/*
 * DO NOT EDIT.
 *
 * This file is autogenerated by
 * "%s"
 */