OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [java/] [lang/] [Win32Process.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
// Win32Process.java - Subclass of Process for Win32 systems.
2
 
3
/* Copyright (C) 2002, 2003  Free Software Foundation
4
 
5
   This file is part of libgcj.
6
 
7
This software is copyrighted work licensed under the terms of the
8
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9
details.  */
10
 
11
package java.lang;
12
 
13
import java.io.File;
14
import java.io.InputStream;
15
import java.io.OutputStream;
16
import java.io.IOException;
17
 
18
/**
19
 * @author Adam Megacz
20
 * @date Feb 24, 2002
21
 */
22
 
23
// This is entirely internal to our implementation.
24
 
25
// This file is copied to `ConcreteProcess.java' before compilation.
26
// Hence the class name apparently does not match the file name.
27
final class ConcreteProcess extends Process
28
{
29
  public native void destroy ();
30
 
31
  public int exitValue ()
32
  {
33
    if (! hasExited ())
34
      throw new IllegalThreadStateException ("Process has not exited");
35
 
36
    return exitCode;
37
  }
38
 
39
  public InputStream getErrorStream ()
40
  {
41
    return errorStream;
42
  }
43
 
44
  public InputStream getInputStream ()
45
  {
46
    return inputStream;
47
  }
48
 
49
  public OutputStream getOutputStream ()
50
  {
51
    return outputStream;
52
  }
53
 
54
  public native int waitFor () throws InterruptedException;
55
 
56
  public ConcreteProcess (String[] progarray,
57
                          String[] envp,
58
                          File dir)
59
    throws IOException
60
  {
61
    for (int i = 0; i < progarray.length; i++)
62
      {
63
        String s = progarray[i];
64
 
65
        if ( (s.indexOf (' ') >= 0) || (s.indexOf ('\t') >= 0))
66
          progarray[i] = "\"" + s + "\"";
67
      }
68
 
69
    startProcess (progarray, envp, dir);
70
  }
71
 
72
  // The standard streams (stdin, stdout and stderr, respectively)
73
  // of the child as seen by the parent process.
74
  private OutputStream outputStream;
75
  private InputStream inputStream;
76
  private InputStream errorStream;
77
 
78
  // Handle to the child process - cast to HANDLE before use.
79
  private int procHandle;
80
 
81
  // Exit code of the child if it has exited.
82
  private int exitCode;
83
 
84
  private native boolean hasExited ();
85
  private native void startProcess (String[] progarray,
86
           String[] envp,
87
           File dir)
88
    throws IOException;
89
  private native void cleanup ();
90
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.