@Override
	public boolean applyTo(Program program) {

		// save off the function signature
		//   get the body, comment, stack, return type
		Listing listing = program.getListing();
		DataTypeManager dtm = listing.getDataTypeManager();
		Function func = listing.getFunctionAt(entry);
		if (func == null) {
			return false;
		}
		FunctionSignature sig;
		try {
			sig = func.getSignature(true);
		}
		catch (IllegalArgumentException e) {
			if (func.getName().indexOf(FileSystem.SEPARATOR_CHAR) >= 0) {
				statusMsg = "Datatype names can not contain a '" + FileSystem.SEPARATOR_CHAR + "'";
			}
			else {
				statusMsg = e.getMessage();
			}
			return false;
		}
		FunctionDefinitionDataType functionDef = new FunctionDefinitionDataType(sig);
		DataType newType = dtm.resolve(functionDef, null);

		if (serviceProvider != null) {
			DataTypeManagerService service =
				serviceProvider.getService(DataTypeManagerService.class);
			if (service != null) {
				service.setDataTypeSelected(newType);
			}
		}
		return true;
	}
Constructs a new command for creating a function definition.
@param entry entry point address for the function whose signature is to 
be used to create the function defintion data type.
@param serviceProvider optional service provider (may be null).  If specified and the 
{@link DataTypeManagerService} is found, the newly created function definition
will be selected within the GUI.
Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateFunctionDefinitionCmd.java