Lines Matching refs:write
499 include.write("#if %s\n" % cond)
500 export.write("#if %s\n" % cond)
501 output.write("#if %s\n" % cond)
503 include.write("PyObject * ")
504 include.write("libxml_%s(PyObject *self, PyObject *args);\n" % (name))
506 export.write(" { (char *)\"%s\", libxml_%s, METH_VARARGS, NULL },\n" %
512 include.write("#endif\n")
513 export.write("#endif\n")
514 output.write("#endif\n")
519 include.write("#endif\n")
520 export.write("#endif\n")
521 output.write("#endif\n")
524 output.write("PyObject *\n")
525 output.write("libxml_%s(PyObject *self ATTRIBUTE_UNUSED," % (name))
526 output.write(" PyObject *args")
528 output.write(" ATTRIBUTE_UNUSED")
529 output.write(") {\n")
531 output.write(" PyObject *py_retval;\n")
533 output.write(c_return)
535 output.write(c_args)
537 output.write("\n if (!PyArg_ParseTuple(args, (char *)\"%s\"%s))\n" %
539 output.write(" return(NULL);\n")
541 output.write(c_convert)
543 output.write(c_call)
544 output.write(ret_convert)
545 output.write("}\n\n")
547 include.write("#endif /* %s */\n" % cond)
548 export.write("#endif /* %s */\n" % cond)
549 output.write("#endif /* %s */\n" % cond)
595 include.write("/* Generated */\n\n")
597 export.write("/* Generated */\n\n")
599 wrapper.write("/* Generated */\n\n")
600 wrapper.write("#include <Python.h>\n")
601 wrapper.write("#include <libxml/xmlversion.h>\n")
602 wrapper.write("#include <libxml/tree.h>\n")
603 wrapper.write("#include <libxml/xmlschemastypes.h>\n")
604 wrapper.write("#include \"libxml_wrap.h\"\n")
605 wrapper.write("#include \"libxml2-py.h\"\n\n")
849 output.write(indent)
850 output.write('"""')
861 output.write(str)
862 output.write('\n ')
863 output.write(indent)
864 output.write(val)
865 output.write(' """\n')
958 txt.write(" Generated Classes for libxml2-python\n\n")
960 txt.write("#\n# Global functions of the module\n#\n\n")
968 classes.write("#\n# Functions from module %s\n#\n\n" % file)
969 txt.write("\n# functions from module %s\n" % file)
971 classes.write("def %s(" % func)
972 txt.write("%s()\n" % func)
976 classes.write(", ")
977 classes.write("%s" % arg[0])
979 classes.write("):\n")
984 classes.write(" if %s is None: %s__o = None\n" %
986 classes.write(" else: %s__o = %s%s\n" %
989 classes.write(" ret = ")
991 classes.write(" ")
992 classes.write("libxml2mod.%s(" % name)
996 classes.write(", ")
997 classes.write("%s" % arg[0])
999 classes.write("__o")
1001 classes.write(")\n")
1008 classes.write(" if ret is None:return None\n")
1010 classes.write(
1014 classes.write(
1018 classes.write(
1022 classes.write(
1025 classes.write(" return ")
1026 classes.write(classes_type[ret[0]][1] % ("ret"))
1027 classes.write("\n")
1029 classes.write(" return ret\n")
1030 classes.write("\n")
1032 txt.write("\n\n#\n# Set of classes of the module\n#\n\n")
1038 txt.write("\n\nClass %s(%s)\n" % (classname,
1040 classes.write("class %s(%s):\n" % (classname,
1042 classes.write(" def __init__(self, _obj=None):\n")
1045 classes.write(" if type(_obj).__name__ != ")
1046 classes.write("'PyCObject':\n")
1047 classes.write(" raise TypeError, ")
1048 classes.write("'%s needs a PyCObject argument'\n" % \
1053 classes.write(" self.%s = None\n" % ref[1])
1054 classes.write(" self._o = _obj\n")
1055 classes.write(" %s.__init__(self, _obj=_obj)\n\n" % (
1059 classes.write(" def __repr__(self):\n")
1061 classes.write(" return \"%s\" %% (self.name, long(pos_id (self)))\n\n" % (
1064 txt.write("Class %s()\n" % (classname))
1065 classes.write("class %s:\n" % (classname))
1066 classes.write(" def __init__(self, _obj=None):\n")
1070 classes.write(" self.%s = None\n" % ref[1])
1071 classes.write(" if _obj != None:self._o = _obj;return\n")
1072 classes.write(" self._o = None\n\n")
1075 classes.write(" def __del__(self):\n")
1076 classes.write(" if self._o != None:\n")
1077 classes.write(" libxml2mod.%s(self._o)\n" %
1079 classes.write(" self._o = None\n\n")
1094 classes.write(" # accessors for %s\n" % (classname))
1095 txt.write(" # accessors\n")
1097 classes.write(" #\n")
1098 classes.write(" # %s functions from module %s\n" % (
1100 txt.write("\n # functions from module %s\n" % file)
1101 classes.write(" #\n\n")
1103 classes.write(" def %s(self" % func)
1104 txt.write(" %s()\n" % func)
1108 classes.write(", %s" % arg[0])
1110 classes.write("):\n")
1116 classes.write(" if %s is None: %s__o = None\n" %
1118 classes.write(" else: %s__o = %s%s\n" %
1122 classes.write(" ret = ")
1124 classes.write(" ")
1125 classes.write("libxml2mod.%s(" % name)
1129 classes.write(", ")
1131 classes.write("%s" % arg[0])
1133 classes.write("__o")
1135 classes.write("self")
1137 classes.write(classes_type[arg[1]][0])
1139 classes.write(")\n")
1146 classes.write(
1149 classes.write(
1153 classes.write(
1157 classes.write(
1161 classes.write(
1168 classes.write(" __tmp = ")
1169 classes.write(classes_type[ret[0]][1] % ("ret"))
1170 classes.write("\n")
1182 classes.write(" __tmp.%s = self\n" %
1187 classes.write(" return __tmp\n")
1193 classes.write(
1196 classes.write(
1200 classes.write(
1204 classes.write(
1208 classes.write(
1211 classes.write(" return ")
1212 classes.write(converter_type[ret[0]] % ("ret"))
1213 classes.write("\n")
1215 classes.write(" return ret\n")
1216 classes.write("\n")
1222 classes.write("# %s\n" % type)
1226 classes.write("%s = %s\n" % (name,value))
1227 classes.write("\n")