1// BEGIN LICENSE BLOCK
2// Version: CMPL 1.1
3//
4// The contents of this file are subject to the Cisco-style Mozilla Public
5// License Version 1.1 (the "License"); you may not use this file except
6// in compliance with the License.  You may obtain a copy of the License
7// at www.eclipse-clp.org/license.
8//
9// Software distributed under the License is distributed on an "AS IS"
10// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
11// the License for the specific language governing rights and limitations
12// under the License.
13//
14// The Original Code is  The ECLiPSe Constraint Logic Programming System.
15// The Initial Developer of the Original Code is  Cisco Systems, Inc.
16// Portions created by the Initial Developer are
17// Copyright (C) 2001 - 2006 Cisco Systems, Inc.  All Rights Reserved.
18//
19// Contributor(s): Josh Singer, Parc Technologies
20//
21// END LICENSE BLOCK
22
23//Title:        Java/ECLiPSe interface
24//Version:      $Id: Platform_x86_64_nt.java,v 1.1 2009/03/27 01:55:49 kish_shen Exp $
25//Author:       Josh Singer
26//Company:      Parc Technologies
27//Description:  Encapsulated Singleton for platform-dependent code (Windows NT).
28package com.parctechnologies.eclipse;
29
30import java.io.*;
31class Platform_x86_64_nt extends Platform
32{
33  private final String ECLIPSE_PLATFORM_NAME = "x86_64_nt";
34  public boolean supportsEmbeddedEclipse()
35  {
36    return(true);
37  }
38  public boolean supportsOutOfProcessEclipse()
39  {
40    return(true);
41  }
42
43  public String getEclipsePlatformName()
44  {
45    return(ECLIPSE_PLATFORM_NAME);
46  }
47
48  private final String SHARED_LIBRARY_EXTENSION = "dll";
49  public String getSharedLibraryExtension()
50  {
51    return(SHARED_LIBRARY_EXTENSION);
52  }
53
54  File getExecutableSubdirectory(File eclipseDirectory)
55  {
56    return(getLibrarySubdirectory(eclipseDirectory));
57  }
58
59  void loadEclipseSharedLibrary(File eclipseDirectory)
60    throws UnsatisfiedLinkError
61  {
62    Runtime runtime = Runtime.getRuntime();
63    String libPath =
64      (new File(getLibrarySubdirectory(eclipseDirectory),
65		"ec_java_load."+getSharedLibraryExtension())).toString();
66    try
67	{
68	    runtime.load(libPath);
69	}
70    catch(UnsatisfiedLinkError e)
71	{
72	    throw new UnsatisfiedLinkError("The shared library "+libPath+
73					   " could not be found.");
74	}
75
76    libPath = (new File(getLibrarySubdirectory(eclipseDirectory),
77			"ec_java."+getSharedLibraryExtension())).toString();
78    NativeEclipse.chdir(getLibrarySubdirectory(eclipseDirectory).toString());
79    try
80	{
81	    runtime.load(libPath);
82	}
83    catch(UnsatisfiedLinkError e)
84	{
85	    throw new UnsatisfiedLinkError("The shared library "+libPath+
86					   " could not be found.");
87	}
88    finally
89	{
90	    NativeEclipse.resetdir();
91	}
92  }
93
94}
95