private void writeTypeDef(TypeDef typeDef, TaskMonitor monitor)
			throws IOException, CancelledException {
		String typedefName = typeDef.getDisplayName();
		DataType dataType = typeDef.getDataType();
		String dataTypeName = dataType.getDisplayName();
		if (isIntegral(typedefName, dataTypeName)) {
			return;
		}

		DataType baseType = typeDef.getBaseDataType();
		try {
			if (baseType instanceof Composite || baseType instanceof Enum) {
				// auto-typedef generated with composite and enum
				if (typedefName.equals(baseType.getName())) {
					resolvedTypeMap.remove(typedefName);
					return;
				}
			}
			// TODO: A comment explaining the special 'P' case would be helpful!!  Smells like fish.
			else if (baseType instanceof Pointer && typedefName.startsWith("P")) {
				DataType dt = ((Pointer) baseType).getDataType();
				if (dt instanceof TypeDef) {
					dt = ((TypeDef) dt).getBaseDataType();
				}
				if (dt instanceof Composite && dt.getName().equals(typedefName.substring(1))) {
					// auto-pointer-typedef generated with composite
					resolvedTypeMap.remove(typedefName);
					return;
				}
			}
		}
		finally {
			write(dataType, monitor);
		}

		if (baseType instanceof Array && getBaseArrayTypedefType(baseType) instanceof Composite) {
			writeDeferredDeclarations(monitor);
		}

		String typedefString = getTypeDeclaration(typedefName, dataType, -1, true, monitor);

		writer.write("typedef " + typedefString + ";");
		writer.write(EOL);
		writer.write(EOL);
	}
Typedef Format: typedef <TYPE_DEF_NAME> <BASE_TYPE_NAME>
@throws CancelledException if the action is cancelled by the user
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/DataTypeWriter.java