port old codes of Dorothy::Platform