public static OmfFileHeader scan(AbstractOmfRecordFactory factory, TaskMonitor monitor,
			boolean fastscan) throws IOException, OmfException {
		OmfRecord record = factory.readNextRecord();
		if (!(record instanceof OmfFileHeader)) {
			throw new OmfException("Object file does not start with proper header");
		}
		OmfFileHeader header = (OmfFileHeader) record;

		while (true) {
			record = factory.readNextRecord();

			if (monitor.isCancelled()) {
				break;
			}
			if (record instanceof OmfModuleEnd) {
				break;
			}

			if (record instanceof OmfCommentRecord comment) {
				switch (comment.getCommentClass()) {
					case OmfCommentRecord.COMMENT_CLASS_TRANSLATOR:
						header.translator = comment.getValue();
						break;
					case OmfCommentRecord.COMMENT_CLASS_LIBMOD:
						header.libModuleName = comment.getValue();
						break;
					case OmfCommentRecord.COMMENT_CLASS_WATCOM_SETTINGS:
						header.translator = "Watcom";
						break;
					case OmfCommentRecord.COMMENT_CLASS_MICROSOFT_SETTINGS:
						header.translator = "Microsoft";
						break;
				}
			}
			else if (record instanceof OmfSegmentHeader head) {
				header.format16bit = head.is16Bit();
				if (fastscan) {
					break;
				}
			}
		}
		return header;
	}
Scan the object file, for the main header and comment records. Other records are parsed but not saved
@param factory the {@link AbstractOmfRecordFactory}
@param monitor is checked for cancellation
@param fastscan is true if we only want to scan the header until first seghead,
@return the header record
@throws IOException for problems reading program data
@throws OmfException for malformed records
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/omf/OmfFileHeader.java