private void writeFunctionDefinition(XmlWriter writer, FunctionDefinition func) {
		XmlAttributes attrs = new XmlAttributes();
		attrs.addAttribute("NAME", func.getName());
		attrs.addAttribute("NAMESPACE", func.getCategoryPath().getPath());
		writer.startElement("FUNCTION_DEF", attrs);

		writeRegularComment(writer, func.getDescription());

		DataType rt = func.getReturnType();
		if (rt != null && rt != DataType.DEFAULT) {
			attrs = new XmlAttributes();
			attrs.addAttribute("DATATYPE", rt.getDisplayName());
			attrs.addAttribute("DATATYPE_NAMESPACE", rt.getCategoryPath().getPath());
			attrs.addAttribute("SIZE", rt.getLength(), true);
			writer.startElement("RETURN_TYPE", attrs);
			writer.endElement("RETURN_TYPE");
		}

		ParameterDefinition[] vars = func.getArguments();
		for (int i = 0; i < vars.length; i++) {
			writerParameter(writer, vars[i], i);
		}

		writer.endElement("FUNCTION_DEF");
	}
Writes datatypes into XML using the specified XML writer.
@param writer the XML writer
@param monitor the task monitor
@throws CancelledException if the user cancels the write operation
Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/DataTypesXmlMgr.java