Apple OF looks at the partition types (which are strings), and uses the first one that is "Apple_Boot", "Apple_HFS", or "DOS_FAT_", if you do not give a partition number (or partition # 0).
Do you have a source for your algorithm above?
You can use "see" (in the "mac-files" package) :-)
Segher