--- sml/trunk/src/cm/bootstrap/cmb-slave-stub.sml 1999/10/22 07:35:29 449 +++ sml/trunk/src/cm/bootstrap/cmb-slave-stub.sml 1999/10/25 08:33:25 452 @@ -1,6 +1,6 @@ (* * This is a stub providing "slave" functionality for CMB. - * (We use dynamic linking technology to avoid loading host-cmb.cm + * (We use dynamic linking technology to avoid loading target-compilers.cm * on the slave side unless it is really needed.) * * (C) 1999 Lucent Technologies, Bell Laboratories @@ -9,12 +9,29 @@ *) structure CMBSlave = struct local - val initialized = ref false + val lib = "target-compilers.cm" + val loaded = ref false + val table = + foldl StringMap.insert' StringMap.empty + [("alpha32-unix", "Alpha32UnixCMB.make"), + ("hppa-unix", "HppaUnixCMB.make"), + ("ppc-macos", "PPCMacOSCMB.make"), + ("ppc-unix", "PPCUnixCMB.make"), + ("sparc-unix", "SparcUnixCMB.make"), + ("x86-unix", "X86UnixCMB.make"), + ("x86-win32", "X86Win32CMB.make")] in - fun slave make s = - (if !initialized then () - else if make "host-cmb.cm" then initialized := true - else raise Fail "dynamic linkage for CMB slave failed"; - CMBSlaveHook.slave s) + (* "load" is supposed to be CM.autoload and "touch" should be + * (Compiler.Interact.useStream o TextIO.openString) *) + fun slave { load, touch } arch s = + case StringMap.find (table, arch) of + NONE => NONE + | SOME cmd => + (if !loaded then () + else if load lib then loaded := true + else raise Fail (concat ["dynamic linkage for CMB slave ", + arch, " failed"]); + touch cmd; + CMBSlaveHook.slave arch s) end end