1 21 22 package org.armedbear.lisp; 23 24 import java.net.InetAddress ; 25 26 public final class SiteName extends Lisp 27 { 28 private static LispObject getHostName() 29 { 30 String hostName = null; 31 try { 32 InetAddress addr = InetAddress.getLocalHost(); 33 if (addr != null) 34 hostName = addr.getHostName(); 35 } 36 catch (Throwable t) {} 37 return hostName != null ? new SimpleString(hostName) : NIL; 38 } 39 40 private static final Primitive0 MACHINE_INSTANCE = 41 new Primitive0("machine-instance") 42 { 43 public LispObject execute() 44 { 45 return getHostName(); 46 } 47 }; 48 49 private static final Primitive0 LONG_SITE_NAME = 50 new Primitive0("long-site-name") 51 { 52 public LispObject execute() 53 { 54 return getHostName(); 55 } 56 }; 57 58 private static final Primitive0 SHORT_SITE_NAME = 59 new Primitive0("short-site-name") 60 { 61 public LispObject execute() 62 { 63 return getHostName(); 64 } 65 }; 66 } 67 | Popular Tags |