What I remember , going all the way back to NS 101, the convention was forward most mast was the "foremast" and the after, the main or mizzen mast. But, sometimes, it was the after mast.
Some of which is modified based on the "mass" of the mast, too.
The forward mast, which is the larger mast, on USS Texas is identified as the foremast. The after mast is identified as the mainmast, despite a lesser stature. In Texas' case, that may harken back to her beginnings when she had two identical cage masts.
Macks originally came about as a way to reduce top hamper (and thus preserve metacentric height) by reducing the number of things poking up way above the CG (radars, antennae, TACAN, IFF gear, etc., all have significant wind resistence, too).
Later, since macks are skinned, they became part of hte "stealth" signature of the ship (even as the length of needed exhaust runs decreased (gas turbines do not need long exhaust trunks to run; and they generate little soot to be directed overboard.
If I remember right, 4 & 5 masted barks and barquentines are Fore, Main, Mizzen, Four, (Five). Staysail schooners often just numbered the masts, from fore to aft.