mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 06:55:23 +02:00
reformat.
This commit is contained in:
parent
e38c670d27
commit
50fad5fe59
3 changed files with 114 additions and 89 deletions
|
@ -1,3 +1,23 @@
|
||||||
|
2002-10-16 Alain Magloire
|
||||||
|
|
||||||
|
Some of the native functions were throwing exceptions
|
||||||
|
particularly on the windows platform and it was not
|
||||||
|
clearly advertise. Eclipse uses a tool to externalize strings,
|
||||||
|
to prevent this, strings need a comment "//$NON-NLS-1$".
|
||||||
|
|
||||||
|
* utils/../utils/pty/PTYInputStream.java (close0):
|
||||||
|
Advertise that we can throw an IOException.
|
||||||
|
* utils/../utils/pty/PTYOutputStream.java (close): Put
|
||||||
|
the "$NON-NLS-1$" magic.
|
||||||
|
(write0): Advertise we can throw IOException.
|
||||||
|
(close0): Advertise we can throw IOException.
|
||||||
|
* utils/../utils/spawner/ProcessFactory.java: Reformat.
|
||||||
|
* utils/../utils/spawner/Spawner.java (Reaper):
|
||||||
|
The run method when calling exec0 did not catch the exception.
|
||||||
|
And the waitFor() should not be done on a pid == -1;
|
||||||
|
* utils/../utils/spawner/SpawnerInputStream.java: Reformat.
|
||||||
|
* utils/../utils/spawner/SpawnerOutputStream.java: Reformat.
|
||||||
|
|
||||||
2002-10-15 Alain Magloire
|
2002-10-15 Alain Magloire
|
||||||
|
|
||||||
By making the native methods package scope, the
|
By making the native methods package scope, the
|
||||||
|
@ -42,4 +62,4 @@
|
||||||
builder will build increamentaly build projects when they change.
|
builder will build increamentaly build projects when they change.
|
||||||
Handle "clean" target as special so the build state is cleared allowing
|
Handle "clean" target as special so the build state is cleared allowing
|
||||||
the next increamental build to come in as a full build.
|
the next increamental build to come in as a full build.
|
||||||
|
|
||||||
|
|
|
@ -9,69 +9,72 @@ import java.io.InputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
class SpawnerInputStream extends InputStream {
|
class SpawnerInputStream extends InputStream {
|
||||||
private int fd;
|
private int fd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fome a Unix valid file descriptor set a Reader.
|
* Fome a Unix valid file descriptor set a Reader.
|
||||||
* @param desc file descriptor.
|
* @param desc file descriptor.
|
||||||
*/
|
*/
|
||||||
public SpawnerInputStream (int fd) {
|
public SpawnerInputStream(int fd) {
|
||||||
this.fd = fd;
|
this.fd = fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of read for the InputStream.
|
* Implementation of read for the InputStream.
|
||||||
*
|
*
|
||||||
* @exception IOException on error.
|
* @exception IOException on error.
|
||||||
*/
|
*/
|
||||||
public int read () throws IOException {
|
public int read() throws IOException {
|
||||||
byte b[] = new byte[1];
|
byte b[] = new byte[1];
|
||||||
if(1 != read(b, 0, 1))
|
if (1 != read(b, 0, 1))
|
||||||
return -1;
|
return -1;
|
||||||
return (int)b[0];
|
return (int) b[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InputStream#read(byte[], int, int)
|
* @see InputStream#read(byte[], int, int)
|
||||||
*/
|
*/
|
||||||
public int read(byte[] buf, int off, int len) throws IOException {
|
public int read(byte[] buf, int off, int len) throws IOException {
|
||||||
if (buf == null) {
|
if (buf == null) {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
} else if ((off < 0) || (off > buf.length) || (len < 0) ||
|
} else if (
|
||||||
((off + len) > buf.length) || ((off + len) < 0)) {
|
(off < 0)
|
||||||
throw new IndexOutOfBoundsException();
|
|| (off > buf.length)
|
||||||
|
|| (len < 0)
|
||||||
|
|| ((off + len) > buf.length)
|
||||||
|
|| ((off + len) < 0)) {
|
||||||
|
throw new IndexOutOfBoundsException();
|
||||||
} else if (len == 0) {
|
} else if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
byte[] tmpBuf = new byte[len];
|
byte[] tmpBuf = new byte[len];
|
||||||
|
|
||||||
len = read0( fd, tmpBuf, len );
|
len = read0(fd, tmpBuf, len);
|
||||||
if( len <= 0 )
|
if (len <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
System.arraycopy(tmpBuf, 0, buf, off, len);
|
System.arraycopy(tmpBuf, 0, buf, off, len);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the Reader
|
||||||
|
* @exception IOException on error.
|
||||||
|
*/
|
||||||
|
public void close() throws IOException {
|
||||||
|
if (fd == -1)
|
||||||
|
return;
|
||||||
|
int status = close0(fd);
|
||||||
|
if (status == -1)
|
||||||
|
throw new IOException("close error");
|
||||||
|
fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
private native int read0(int fd, byte[] buf, int len) throws IOException;
|
||||||
* Close the Reader
|
private native int close0(int fd) throws IOException;
|
||||||
* @exception IOException on error.
|
|
||||||
*/
|
|
||||||
public void close () throws IOException {
|
|
||||||
if (fd == -1)
|
|
||||||
return;
|
|
||||||
int status = close0 (fd);
|
|
||||||
if (status == -1)
|
|
||||||
throw new IOException ("close error");
|
|
||||||
fd = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int read0 (int fd, byte[] buf, int len) throws IOException;
|
static {
|
||||||
native int close0 (int fd);
|
System.loadLibrary("spawner");
|
||||||
|
}
|
||||||
static {
|
|
||||||
System.loadLibrary ("spawner");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,64 +8,66 @@ package org.eclipse.cdt.utils.spawner;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class SpawnerOutputStream extends OutputStream
|
public class SpawnerOutputStream extends OutputStream {
|
||||||
{
|
private int fd;
|
||||||
private int fd;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fome a Unix valid file descriptor set a Reader.
|
* Fome a Unix valid file descriptor set a Reader.
|
||||||
* @param desc file descriptor.
|
* @param desc file descriptor.
|
||||||
*/
|
*/
|
||||||
public SpawnerOutputStream (int fd) {
|
public SpawnerOutputStream(int fd) {
|
||||||
this.fd = fd;
|
this.fd = fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see OutputStream#write(byte[], int, int)
|
* @see OutputStream#write(byte[], int, int)
|
||||||
*/
|
*/
|
||||||
public void write(byte[] b, int off, int len) throws IOException {
|
public void write(byte[] b, int off, int len) throws IOException {
|
||||||
if (b == null) {
|
if (b == null) {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
} else if ((off < 0) || (off > b.length) || (len < 0) ||
|
} else if (
|
||||||
((off + len) > b.length) || ((off + len) < 0)) {
|
(off < 0)
|
||||||
throw new IndexOutOfBoundsException();
|
|| (off > b.length)
|
||||||
|
|| (len < 0)
|
||||||
|
|| ((off + len) > b.length)
|
||||||
|
|| ((off + len) < 0)) {
|
||||||
|
throw new IndexOutOfBoundsException();
|
||||||
} else if (len == 0) {
|
} else if (len == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
byte[] tmpBuf = new byte[len];
|
byte[] tmpBuf = new byte[len];
|
||||||
System.arraycopy(b, off, tmpBuf, off, len);
|
System.arraycopy(b, off, tmpBuf, off, len);
|
||||||
write0(fd, tmpBuf, len);
|
write0(fd, tmpBuf, len);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Implementation of read for the InputStream.
|
* Implementation of read for the InputStream.
|
||||||
*
|
*
|
||||||
* @exception IOException on error.
|
* @exception IOException on error.
|
||||||
*/
|
*/
|
||||||
public void write (int b) throws IOException {
|
public void write(int b) throws IOException {
|
||||||
byte[] buf = new byte[1];
|
byte[] buf = new byte[1];
|
||||||
buf[0] = (byte)b;
|
buf[0] = (byte) b;
|
||||||
write(buf, 0, 1);
|
write(buf, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the Reader
|
* Close the Reader
|
||||||
* @exception IOException on error.
|
* @exception IOException on error.
|
||||||
*/
|
*/
|
||||||
public void close () throws IOException {
|
public void close() throws IOException {
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return;
|
return;
|
||||||
int status = close0 (fd);
|
int status = close0(fd);
|
||||||
if (status == -1)
|
if (status == -1)
|
||||||
throw new IOException ("close error");
|
throw new IOException("close error"); //$NON-NLS-1$
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int write0 (int fd, byte[] b, int len);
|
private native int write0(int fd, byte[] b, int len) throws IOException;
|
||||||
private native int close0 (int fd);
|
private native int close0(int fd);
|
||||||
|
|
||||||
static
|
static {
|
||||||
{
|
System.loadLibrary("spawner"); //$NON-NLS-1$
|
||||||
System.loadLibrary ("spawner");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue