Delete obsolete java applet for running strace
This commit is contained in:
parent
f457b971a7
commit
d6bed07aae
Binary file not shown.
@ -1,67 +0,0 @@
|
||||
import java.awt.*;
|
||||
|
||||
class BorderPanel extends Panel
|
||||
{
|
||||
int border = 5; // size of border
|
||||
Color col1 = Util.light_edge;
|
||||
Color col2 = Util.dark_edge;
|
||||
Color body;
|
||||
|
||||
BorderPanel()
|
||||
{
|
||||
}
|
||||
|
||||
BorderPanel(int w)
|
||||
{
|
||||
border = w;
|
||||
}
|
||||
|
||||
BorderPanel(int w, Color cb)
|
||||
{
|
||||
border = w;
|
||||
body = cb;
|
||||
}
|
||||
|
||||
BorderPanel(int w, Color c1, Color c2)
|
||||
{
|
||||
border = w;
|
||||
col1 = c1; col2 = c2;
|
||||
}
|
||||
|
||||
BorderPanel(int w, Color c1, Color c2, Color cb)
|
||||
{
|
||||
border = w;
|
||||
col1 = c1; col2 = c2; body = cb;
|
||||
}
|
||||
|
||||
BorderPanel(Color c1, Color c2)
|
||||
{
|
||||
col1 = c1; col2 = c2;
|
||||
}
|
||||
|
||||
public Insets insets()
|
||||
{
|
||||
return new Insets(border+2, border+2, border+2, border+2);
|
||||
}
|
||||
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
if (body != null) {
|
||||
g.setColor(body);
|
||||
g.fillRect(0, 0, size().width, size().height);
|
||||
}
|
||||
super.paint(g);
|
||||
int w = size().width-1, h = size().height-1;
|
||||
g.setColor(col1);
|
||||
for(int i=0; i<border; i++) {
|
||||
g.drawLine(i,i,w-i,i);
|
||||
g.drawLine(i,i,i,h-i);
|
||||
}
|
||||
g.setColor(col2);
|
||||
for(int i=0; i<border; i++) {
|
||||
g.drawLine(w-i,h-i, w-i,i);
|
||||
g.drawLine(w-i,h-i, i,h-i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -1,264 +0,0 @@
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
|
||||
public class CbButton extends Canvas
|
||||
{
|
||||
public static final int LEFT = 0;
|
||||
public static final int RIGHT = 1;
|
||||
public static final int ABOVE = 2;
|
||||
public static final int BELOW = 3;
|
||||
|
||||
Image image;
|
||||
String string;
|
||||
CbButtonCallback callback;
|
||||
int imode;
|
||||
int iwidth, iheight, pwidth, pheight, twidth, theight;
|
||||
boolean inside, indent;
|
||||
|
||||
CbButtonGroup group;
|
||||
boolean selected;
|
||||
|
||||
Color lc1 = Util.light_edge, lc2 = Util.body, lc3 = Util.dark_edge;
|
||||
Color hc1 = Util.light_edge_hi, hc2 = Util.body_hi, hc3 = Util.dark_edge_hi;
|
||||
|
||||
public CbButton(Image i, CbButtonCallback cb)
|
||||
{
|
||||
this(i, null, LEFT, cb);
|
||||
}
|
||||
|
||||
public CbButton(String s, CbButtonCallback cb)
|
||||
{
|
||||
this(null, s, LEFT, cb);
|
||||
}
|
||||
|
||||
public CbButton(Image i, String s, int im, CbButtonCallback cb)
|
||||
{
|
||||
image = i;
|
||||
string = s;
|
||||
imode = im;
|
||||
callback = cb;
|
||||
if (image != null) {
|
||||
iwidth = Util.getWidth(image);
|
||||
iheight = Util.getHeight(image);
|
||||
}
|
||||
if (string != null) {
|
||||
twidth = Util.fnm.stringWidth(string);
|
||||
theight = Util.fnm.getHeight();
|
||||
}
|
||||
if (image != null && string != null) {
|
||||
switch(imode) {
|
||||
case LEFT:
|
||||
case RIGHT:
|
||||
pwidth = iwidth + twidth + 6;
|
||||
pheight = Math.max(iheight , theight) + 4;
|
||||
break;
|
||||
case ABOVE:
|
||||
case BELOW:
|
||||
pwidth = Math.max(iwidth, twidth) + 4;
|
||||
pheight = iheight + theight + 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (image != null) {
|
||||
pwidth = iwidth + 4;
|
||||
pheight = iheight + 4;
|
||||
}
|
||||
else if (string != null) {
|
||||
pwidth = twidth + 8;
|
||||
pheight = theight + 8;
|
||||
}
|
||||
}
|
||||
|
||||
/**Make this button part of a mutual-exclusion group. Only one such
|
||||
* button can be indented at a time
|
||||
*/
|
||||
public void setGroup(CbButtonGroup g)
|
||||
{
|
||||
group = g;
|
||||
group.add(this);
|
||||
}
|
||||
|
||||
/**Make this button the selected one in it's group
|
||||
*/
|
||||
public void select()
|
||||
{
|
||||
if (group != null)
|
||||
group.select(this);
|
||||
}
|
||||
|
||||
/**Display the given string
|
||||
*/
|
||||
public void setText(String s)
|
||||
{
|
||||
string = s;
|
||||
image = null;
|
||||
twidth = Util.fnm.stringWidth(string);
|
||||
theight = Util.fnm.getHeight();
|
||||
repaint();
|
||||
}
|
||||
|
||||
/**Display the given image
|
||||
*/
|
||||
public void setImage(Image i)
|
||||
{
|
||||
string = null;
|
||||
image = i;
|
||||
iwidth = Util.getWidth(image);
|
||||
iheight = Util.getHeight(image);
|
||||
repaint();
|
||||
}
|
||||
|
||||
/**Display the given image and text, with the given alignment mode
|
||||
*/
|
||||
public void setImageText(Image i, String s, int m)
|
||||
{
|
||||
image = i;
|
||||
string = s;
|
||||
imode = m;
|
||||
twidth = Util.fnm.stringWidth(string);
|
||||
theight = Util.fnm.getHeight();
|
||||
iwidth = Util.getWidth(image);
|
||||
iheight = Util.getHeight(image);
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
Color c1 = inside ? hc1 : lc1,
|
||||
c2 = inside ? hc2 : lc2,
|
||||
c3 = inside ? hc3 : lc3;
|
||||
int w = size().width, h = size().height;
|
||||
Color hi = indent||selected ? c3 : c1,
|
||||
lo = indent||selected ? c1 : c3;
|
||||
g.setColor(c2);
|
||||
g.fillRect(0, 0, w-1, h-1);
|
||||
g.setColor(hi);
|
||||
g.drawLine(0, 0, w-2, 0);
|
||||
g.drawLine(0, 0, 0, h-2);
|
||||
g.setColor(lo);
|
||||
g.drawLine(w-1, h-1, w-1, 1);
|
||||
g.drawLine(w-1, h-1, 1, h-1);
|
||||
if (inside) {
|
||||
/* g.setColor(hi);
|
||||
g.drawLine(1, 1, w-3, 1);
|
||||
g.drawLine(1, 1, 1, h-3); */
|
||||
g.setColor(lo);
|
||||
g.drawLine(w-2, h-2, w-2, 2);
|
||||
g.drawLine(w-2, h-2, 2, h-2);
|
||||
}
|
||||
|
||||
g.setColor(c3);
|
||||
g.setFont(Util.f);
|
||||
if (image != null && string != null) {
|
||||
if (imode == LEFT) {
|
||||
Dimension is = imgSize(w-twidth-6, h-4);
|
||||
g.drawImage(image, (w - is.width - twidth - 2)/2,
|
||||
(h-is.height)/2, is.width, is.height, this);
|
||||
g.drawString(string,
|
||||
(w - is.width - twidth - 2)/2 +is.width +2,
|
||||
(h + theight - Util.fnm.getDescent())/2);
|
||||
}
|
||||
else if (imode == RIGHT) {
|
||||
}
|
||||
else if (imode == ABOVE) {
|
||||
//Dimension is = imgSize(w-4, h-theight-6);
|
||||
g.drawImage(image, (w - iwidth)/2,
|
||||
(h - iheight - theight - 2)/2,
|
||||
iwidth, iheight, this);
|
||||
g.drawString(string, (w - twidth)/2, iheight+Util.fnm.getHeight()+2);
|
||||
}
|
||||
else if (imode == BELOW) {
|
||||
}
|
||||
}
|
||||
else if (image != null) {
|
||||
Dimension is = imgSize(w-4, h-4);
|
||||
g.drawImage(image, (w - is.width)/2, (h-is.height)/2,
|
||||
is.width, is.height, this);
|
||||
}
|
||||
else if (string != null) {
|
||||
g.drawString(string, (w - twidth)/2,
|
||||
(h+theight-Util.fnm.getDescent())/2);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(Graphics g) { paint(g); }
|
||||
|
||||
public boolean mouseEnter(Event e, int x, int y)
|
||||
{
|
||||
inside = true;
|
||||
repaint();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mouseExit(Event e, int x, int y)
|
||||
{
|
||||
inside = false;
|
||||
repaint();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mouseDown(Event e, int x, int y)
|
||||
{
|
||||
indent = true;
|
||||
repaint();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mouseUp(Event e, int x, int y)
|
||||
{
|
||||
if (x >= 0 && y >= 0 && x < size().width && y < size().height) {
|
||||
if (callback != null)
|
||||
callback.click(this);
|
||||
select();
|
||||
}
|
||||
indent = false;
|
||||
repaint();
|
||||
return true;
|
||||
}
|
||||
|
||||
public Dimension preferredSize()
|
||||
{
|
||||
return new Dimension(pwidth, pheight);
|
||||
}
|
||||
|
||||
public Dimension minimumSize()
|
||||
{
|
||||
return preferredSize();
|
||||
}
|
||||
|
||||
private Dimension imgSize(int mw, int mh)
|
||||
{
|
||||
float ws = (float)mw/(float)iwidth,
|
||||
hs = (float)mh/(float)iheight;
|
||||
float s = ws < hs ? ws : hs;
|
||||
if (s > 1) s = 1;
|
||||
return new Dimension((int)(iwidth*s), (int)(iheight*s));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface CbButtonCallback
|
||||
{
|
||||
void click(CbButton b);
|
||||
}
|
||||
|
||||
|
||||
class CbButtonGroup
|
||||
{
|
||||
Vector buttons = new Vector();
|
||||
|
||||
void add(CbButton b)
|
||||
{
|
||||
buttons.addElement(b);
|
||||
}
|
||||
|
||||
void select(CbButton b)
|
||||
{
|
||||
for(int i=0; i<buttons.size(); i++) {
|
||||
CbButton but = (CbButton)buttons.elementAt(i);
|
||||
but.selected = (b == but);
|
||||
but.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,345 +0,0 @@
|
||||
// CbScrollbar.java
|
||||
// A drop-in replacement for the AWT scrollbar class, with callbacks
|
||||
// and a nicer look. This scrollbar is typically used to display some
|
||||
// fraction of a list of items, with values ranging from min to max.
|
||||
// The lvisible parameter determines how many of the list are lvisible
|
||||
// at any one time. The value of the scrollbar ranges from min to
|
||||
// max-lvisible+1 (the highest position in the list to start displaying)
|
||||
import java.awt.*;
|
||||
|
||||
public class CbScrollbar extends Panel
|
||||
{
|
||||
static final int VERTICAL = 0;
|
||||
static final int HORIZONTAL = 1;
|
||||
CbScrollbarCallback callback; // who to call back to
|
||||
boolean inside, indent;
|
||||
int orient; // horizontal or vertical?
|
||||
int value; // position
|
||||
int lvisible; // the number of lines lvisible
|
||||
int num; // total number of lines
|
||||
int lineinc = 1; // how much the arrow buttons move by
|
||||
Color lc1 = Util.light_edge, lc2 = Util.body, lc3 = Util.dark_edge;
|
||||
Color hc1 = Util.light_edge_hi, hc2 = Util.body_hi, hc3 = Util.dark_edge_hi;
|
||||
Color bc = Util.dark_bg;
|
||||
int y1, y2, x1, x2, drag;
|
||||
|
||||
CbScrollbarArrow arrow1, arrow2;
|
||||
|
||||
CbScrollbar(int o, CbScrollbarCallback cb)
|
||||
{
|
||||
this(o, 0, 1, 1, cb);
|
||||
}
|
||||
|
||||
/**Create a new scrollbar
|
||||
*/
|
||||
CbScrollbar(int o, int v, int vis, int n, CbScrollbarCallback cb)
|
||||
{
|
||||
setValues(v, vis, n);
|
||||
orient = o;
|
||||
callback = cb;
|
||||
setLayout(null);
|
||||
if (orient == VERTICAL) {
|
||||
add(arrow1 = new CbScrollbarArrow(this, 0));
|
||||
add(arrow2 = new CbScrollbarArrow(this, 1));
|
||||
}
|
||||
else {
|
||||
add(arrow1 = new CbScrollbarArrow(this, 2));
|
||||
add(arrow2 = new CbScrollbarArrow(this, 3));
|
||||
}
|
||||
}
|
||||
|
||||
/**Set the current scrollbar parameters
|
||||
* @param v Current position
|
||||
* @param vis Number of lines lvisible
|
||||
* @param n Total number of lines
|
||||
*/
|
||||
public void setValues(int v, int vis, int n)
|
||||
{
|
||||
value = v;
|
||||
lvisible = vis;
|
||||
num = n;
|
||||
if (lvisible > num) lvisible = num;
|
||||
checkValue();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public int getValue() { return value; }
|
||||
|
||||
public void setValue(int v)
|
||||
{
|
||||
value = v;
|
||||
checkValue();
|
||||
repaint();
|
||||
}
|
||||
|
||||
private void checkValue()
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
else if (value > num-lvisible) value = num-lvisible;
|
||||
}
|
||||
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
if (num == 0) return;
|
||||
int w = size().width, h = size().height;
|
||||
boolean ins = inside && !(arrow1.inside || arrow2.inside);
|
||||
Color c1 = ins ? hc1 : lc1, c2 = ins ? hc2 : lc2,
|
||||
c3 = ins ? hc3 : lc3;
|
||||
g.setColor(bc);
|
||||
g.fillRect(0, 0, w, h);
|
||||
g.setColor(c3);
|
||||
g.drawLine(0, 0, w-1, 0); g.drawLine(0, 0, 0, h-1);
|
||||
g.setColor(c1);
|
||||
g.drawLine(w-1, h-1, w-1, 0); g.drawLine(w-1, h-1, 0, h-1);
|
||||
|
||||
if (orient == VERTICAL) {
|
||||
int va = h-w*2;
|
||||
y1 = w+va*value/num;
|
||||
y2 = w+va*(value+lvisible)/num-1;
|
||||
g.setColor(c2);
|
||||
g.fillRect(1, y1, w-2, y2-y1);
|
||||
g.setColor(indent ? c3 : c1);
|
||||
g.drawLine(1, y1, w-2, y1);
|
||||
g.drawLine(1, y1, 1, y2-1);
|
||||
g.setColor(indent ? c1 : c3);
|
||||
g.drawLine(w-2, y2-1, w-2, y1);
|
||||
g.drawLine(w-2, y2-1, 1, y2-1);
|
||||
if (ins) {
|
||||
g.drawLine(w-3, y2-2, w-3, y1+1);
|
||||
g.drawLine(w-3, y2-2, 2, y2-2);
|
||||
}
|
||||
}
|
||||
else if (orient == HORIZONTAL) {
|
||||
int va = w-h*2;
|
||||
x1 = h+va*value/num;
|
||||
x2 = h+va*(value+lvisible)/num-1;
|
||||
g.setColor(c2);
|
||||
g.fillRect(x1, 1, x2-x1, h-2);
|
||||
g.setColor(indent ? c3 : c1);
|
||||
g.drawLine(x1, 1, x1, h-2);
|
||||
g.drawLine(x1, 1, x2-1, 1);
|
||||
g.setColor(indent ? c1 : c3);
|
||||
g.drawLine(x2-1, h-2, x1, h-2);
|
||||
g.drawLine(x2-1, h-2, x2-1, 1);
|
||||
if (ins) {
|
||||
g.drawLine(x2-2, h-3, x1+1, h-3);
|
||||
g.drawLine(x2-2, h-3, x2-2, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**Called by arrows to move the slider
|
||||
*/
|
||||
void arrowClick(int d)
|
||||
{
|
||||
int oldvalue = value;
|
||||
value += d;
|
||||
checkValue();
|
||||
if (value != oldvalue) {
|
||||
callback.moved(this, value);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void reshape(int nx, int ny, int nw, int nh)
|
||||
{
|
||||
super.reshape(nx, ny, nw, nh);
|
||||
if (orient == VERTICAL) {
|
||||
arrow1.reshape(1, 1, nw-2, nw-1);
|
||||
arrow2.reshape(1, nh-nw-1, nw-2, nw-1);
|
||||
}
|
||||
else {
|
||||
arrow1.reshape(1, 1, nh-1, nh-2);
|
||||
arrow2.reshape(nw-nh-1, 1, nh-1, nh-2);
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
public Dimension preferredSize()
|
||||
{
|
||||
return orient==VERTICAL ? new Dimension(16, 100)
|
||||
: new Dimension(100, 16);
|
||||
}
|
||||
|
||||
public Dimension minimumSize()
|
||||
{
|
||||
return preferredSize();
|
||||
}
|
||||
|
||||
public boolean mouseDown(Event e, int mx, int my)
|
||||
{
|
||||
if (orient == VERTICAL) {
|
||||
// move up/down one page, or start dragging
|
||||
if (my < y1) arrowClick(-lvisible);
|
||||
else if (my > y2) arrowClick(lvisible);
|
||||
else {
|
||||
indent = true;
|
||||
drag = my-y1;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// move left/right one page, or start dragging
|
||||
if (mx < x1) arrowClick(-lvisible);
|
||||
else if (mx > x2) arrowClick(lvisible);
|
||||
else {
|
||||
indent = true;
|
||||
drag = mx-x1;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mouseDrag(Event e, int mx, int my)
|
||||
{
|
||||
if (indent) {
|
||||
int w = size().width, h = size().height;
|
||||
int oldvalue = value;
|
||||
if (orient == VERTICAL) {
|
||||
int va = h-w*2, ny = my-drag-w;
|
||||
value = ny*num/va;
|
||||
}
|
||||
else {
|
||||
int va = w-h*2, nx = mx-drag-h;
|
||||
value = nx*num/va;
|
||||
}
|
||||
checkValue();
|
||||
if (value != oldvalue) {
|
||||
callback.moving(this, value);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
return indent;
|
||||
}
|
||||
|
||||
public boolean mouseUp(Event e, int mx, int my)
|
||||
{
|
||||
if (indent) {
|
||||
indent = false;
|
||||
repaint();
|
||||
callback.moved(this, value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
public boolean mouseEnter(Event e, int mx, int my)
|
||||
{
|
||||
inside = true;
|
||||
repaint();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mouseExit(Event e, int mx, int my)
|
||||
{
|
||||
inside = false;
|
||||
repaint();
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
class CbScrollbarArrow extends Canvas implements Runnable
|
||||
{
|
||||
int mode;
|
||||
CbScrollbar scrollbar;
|
||||
boolean inside, indent;
|
||||
Thread th;
|
||||
|
||||
CbScrollbarArrow(CbScrollbar p, int m)
|
||||
{
|
||||
scrollbar = p;
|
||||
mode = m;
|
||||
}
|
||||
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
int w = size().width, h = size().height;
|
||||
Color c1 = inside ? scrollbar.hc1 : scrollbar.lc1,
|
||||
c2 = inside ? scrollbar.hc2 : scrollbar.lc2,
|
||||
c3 = inside ? scrollbar.hc3 : scrollbar.lc3;
|
||||
g.setColor(scrollbar.bc);
|
||||
g.fillRect(0, 0, w, h);
|
||||
int xp[] = new int[3], yp[] = new int[3];
|
||||
// blank, dark, light
|
||||
if (mode == 0) {
|
||||
// up arrow
|
||||
xp[0] = w/2; xp[1] = w-1; xp[2] = 0;
|
||||
yp[0] = 0; yp[1] = h-1; yp[2] = h-1;
|
||||
}
|
||||
else if (mode == 1) {
|
||||
// down arrow
|
||||
xp[0] = 0; xp[1] = w/2; xp[2] = w-1;
|
||||
yp[0] = 0; yp[1] = h-1; yp[2] = 0;
|
||||
}
|
||||
else if (mode == 2) {
|
||||
// left arrow
|
||||
xp[0] = 0; xp[1] = w-1; xp[2] = w-1;
|
||||
yp[0] = h/2; yp[1] = h-1; yp[2] = 0;
|
||||
}
|
||||
else if (mode == 3) {
|
||||
// right arrow
|
||||
xp[0] = 0; xp[1] = w-1; xp[2] = 0;
|
||||
yp[0] = 0; yp[1] = h/2; yp[2] = h-1;
|
||||
}
|
||||
g.setColor(c2);
|
||||
g.fillPolygon(xp, yp, 3);
|
||||
g.setColor(indent ? c1 : c3);
|
||||
g.drawLine(xp[1], yp[1], xp[2], yp[2]);
|
||||
g.setColor(indent ? c3 : c1);
|
||||
g.drawLine(xp[0], yp[0], xp[2], yp[2]);
|
||||
}
|
||||
|
||||
public boolean mouseDown(Event e, int mx, int my)
|
||||
{
|
||||
indent = true;
|
||||
repaint();
|
||||
(th = new Thread(this)).start();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mouseUp(Event e, int mx, int my)
|
||||
{
|
||||
indent = false;
|
||||
repaint();
|
||||
if (th != null) th.stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**Thread for doing repeated scrolling
|
||||
*/
|
||||
public void run()
|
||||
{
|
||||
int stime = 500;
|
||||
while(true) {
|
||||
scrollbar.arrowClick(mode%2 == 0 ? -1 : 1);
|
||||
try { Thread.sleep(stime); } catch(Exception e) { }
|
||||
stime = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CbScrollbarCallback
|
||||
// Methods for reporting the movement of the scrollbar to another object
|
||||
interface CbScrollbarCallback
|
||||
{
|
||||
/**Called when the scrollbar stops moving. This happens when an
|
||||
* arrow is clicked, the scrollbar is moved by a page, or the user
|
||||
* lets go of the scrollbar after dragging it.
|
||||
* @param sb The scrollar that has been moved
|
||||
* @param v The new value
|
||||
*/
|
||||
void moved(CbScrollbar sb, int v);
|
||||
|
||||
/**Called upon every pixel movement of the scrollbar when it is
|
||||
* being dragged, but NOT when moved() is called.
|
||||
* @param sb The scrollar that has been moved
|
||||
* @param v The new value
|
||||
*/
|
||||
void moving(CbScrollbar sb, int v);
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,81 +0,0 @@
|
||||
// LineInputStream
|
||||
// A stream with some useful stdio-like methods. Can be used either for
|
||||
// inheriting those methods into your own input stream, or for adding them
|
||||
// to some input stream.
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
|
||||
public class LineInputStream
|
||||
{
|
||||
InputStream in;
|
||||
|
||||
LineInputStream(InputStream i)
|
||||
{ in = i; }
|
||||
LineInputStream()
|
||||
{ }
|
||||
|
||||
public int read() throws IOException
|
||||
{ return in.read(); }
|
||||
public int read(byte b[]) throws IOException
|
||||
{ return in.read(b); }
|
||||
public int read(byte b[], int o, int l) throws IOException
|
||||
{ return in.read(b, o, l); }
|
||||
public long skip(long n) throws IOException
|
||||
{ return in.skip(n); }
|
||||
public int available() throws IOException
|
||||
{ return in.available(); }
|
||||
public void close() throws IOException
|
||||
{ in.close(); }
|
||||
public synchronized void mark(int readlimit)
|
||||
{ in.mark(readlimit); }
|
||||
public synchronized void reset() throws IOException
|
||||
{ in.reset(); }
|
||||
public boolean markSupported()
|
||||
{ return in.markSupported(); }
|
||||
|
||||
// gets
|
||||
// Read a line and return it (minus the \n)
|
||||
String gets() throws IOException, EOFException
|
||||
{
|
||||
StringBuffer buf = new StringBuffer();
|
||||
int b;
|
||||
while((b = read()) != '\n') {
|
||||
if (b == -1) throw new EOFException();
|
||||
buf.append((char)b);
|
||||
}
|
||||
if (buf.length() != 0 && buf.charAt(buf.length()-1) == '\r')
|
||||
buf.setLength(buf.length()-1); // lose \r
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
// getw
|
||||
// Read a single word, surrounded by whitespace
|
||||
String getw() throws IOException, EOFException
|
||||
{
|
||||
StringBuffer buf = new StringBuffer();
|
||||
// skip spaces
|
||||
int b;
|
||||
do {
|
||||
if ((b = read()) == -1) throw new EOFException();
|
||||
} while(Character.isSpace((char)b));
|
||||
// add characters
|
||||
do {
|
||||
buf.append((char)b);
|
||||
if ((b = read()) == -1) throw new EOFException();
|
||||
} while(!Character.isSpace((char)b));
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
// readdata
|
||||
// Fill the given array completely, even if read() only reads
|
||||
// some max number of bytes at a time.
|
||||
public int readdata(byte b[]) throws IOException, EOFException
|
||||
{
|
||||
int p = 0;
|
||||
while(p < b.length)
|
||||
p += read(b, p, b.length-p);
|
||||
return b.length;
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
Tracer.class: Tracer.java
|
||||
javac -target 1.1 -classpath . *.java
|
Binary file not shown.
@ -1,589 +0,0 @@
|
||||
// MultiColumn
|
||||
// A List box that supports multiple columns.
|
||||
import java.awt.*;
|
||||
import java.util.Vector;
|
||||
|
||||
public class MultiColumn extends BorderPanel implements CbScrollbarCallback
|
||||
{
|
||||
MultiColumnCallback callback; // what to call back to
|
||||
String title[]; // column titles
|
||||
boolean adjustable = true;
|
||||
boolean drawlines = true;
|
||||
Color colors[][] = null;
|
||||
boolean enabled = true;
|
||||
boolean multiselect = false;
|
||||
int cpos[]; // column x positions
|
||||
float cwidth[]; // proportional column widths
|
||||
Vector list[]; // columns of the list
|
||||
CbScrollbar sb; // scrollbar at the right side
|
||||
int width, height; // size, minus the scrollbar
|
||||
Insets in; // used space around the border
|
||||
int sbwidth; // width of the scrollbar
|
||||
int th; // height of title bar
|
||||
Image bim; // backing image
|
||||
Graphics bg; // backing graphics
|
||||
Font font = new Font("timesRoman", Font.PLAIN, 12);
|
||||
FontMetrics fnm; // drawing font size
|
||||
int coldrag = -1; // column being resized
|
||||
int sel = -1; // selected row
|
||||
int sels[] = new int[0]; // all selected rows
|
||||
int top = 0; // first row displayed
|
||||
long last; // last mouse click time
|
||||
int rowh = 16; // row height
|
||||
Event last_event; // last event that triggered callback
|
||||
int sortcol; // Column currently being sorted
|
||||
int sortdir; // Sort direction (0=none, 1=up, 2=down)
|
||||
|
||||
// Create a new list with the given column titles
|
||||
MultiColumn(String t[])
|
||||
{
|
||||
super(3, Util.dark_edge_hi, Util.body_hi);
|
||||
title = new String[t.length];
|
||||
for(int i=0; i<t.length; i++)
|
||||
title[i] = t[i];
|
||||
list = new Vector[t.length];
|
||||
for(int i=0; i<t.length; i++)
|
||||
list[i] = new Vector();
|
||||
cwidth = new float[t.length];
|
||||
for(int i=0; i<t.length; i++)
|
||||
cwidth[i] = 1.0f/t.length;
|
||||
cpos = new int[t.length+1];
|
||||
setLayout(null);
|
||||
sb = new CbScrollbar(CbScrollbar.VERTICAL, this);
|
||||
add(sb);
|
||||
}
|
||||
|
||||
// Create a new list that calls back to the given object on
|
||||
// single or double clicks.
|
||||
MultiColumn(String t[], MultiColumnCallback c)
|
||||
{
|
||||
this(t);
|
||||
callback = c;
|
||||
}
|
||||
|
||||
// addItem
|
||||
// Add a row to the list
|
||||
void addItem(Object item[])
|
||||
{
|
||||
for(int i=0; i<title.length; i++)
|
||||
list[i].addElement(item[i]);
|
||||
repaint();
|
||||
compscroll();
|
||||
}
|
||||
|
||||
// addItems
|
||||
// Add several rows to the list
|
||||
void addItems(Object item[][])
|
||||
{
|
||||
for(int i=0; i<item.length; i++)
|
||||
for(int j=0; j<title.length; j++)
|
||||
list[j].addElement(item[i][j]);
|
||||
repaint();
|
||||
compscroll();
|
||||
}
|
||||
|
||||
// modifyItem
|
||||
// Changes one row of the table
|
||||
void modifyItem(Object item[], int row)
|
||||
{
|
||||
for(int i=0; i<title.length; i++)
|
||||
list[i].setElementAt(item[i], row);
|
||||
repaint();
|
||||
compscroll();
|
||||
}
|
||||
|
||||
// getItem
|
||||
// Returns the contents of a given row
|
||||
Object []getItem(int n)
|
||||
{
|
||||
Object r[] = new Object[title.length];
|
||||
for(int i=0; i<title.length; i++)
|
||||
r[i] = list[i].elementAt(n);
|
||||
return r;
|
||||
}
|
||||
|
||||
// selected
|
||||
// Return the most recently selected row
|
||||
int selected()
|
||||
{
|
||||
return sel;
|
||||
}
|
||||
|
||||
// select
|
||||
// Select some row
|
||||
void select(int s)
|
||||
{
|
||||
sel = s;
|
||||
sels = new int[1];
|
||||
sels[0] = s;
|
||||
repaint();
|
||||
}
|
||||
|
||||
// select
|
||||
// Select multiple rows
|
||||
void select(int s[])
|
||||
{
|
||||
if (s.length == 0) {
|
||||
sel = -1;
|
||||
sels = new int[0];
|
||||
}
|
||||
else {
|
||||
sel = s[0];
|
||||
sels = s;
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
// allSelected
|
||||
// Returns all the selected rows
|
||||
int[] allSelected()
|
||||
{
|
||||
return sels;
|
||||
}
|
||||
|
||||
// scrollto
|
||||
// Scroll to make some row visible
|
||||
void scrollto(int s)
|
||||
{
|
||||
int r = rows();
|
||||
if (s < top || s >= top+r) {
|
||||
top = s-1;
|
||||
if (top > list[0].size() - r)
|
||||
top = list[0].size() - r;
|
||||
sb.setValue(top);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
// deleteItem
|
||||
// Remove one row from the list
|
||||
void deleteItem(int n)
|
||||
{
|
||||
for(int i=0; i<title.length; i++)
|
||||
list[i].removeElementAt(n);
|
||||
if (n == sel) {
|
||||
// De-select deleted file
|
||||
sel = -1;
|
||||
}
|
||||
for(int i=0; i<sels.length; i++) {
|
||||
if (sels[i] == n) {
|
||||
// Remove from selection list
|
||||
int nsels[] = new int[sels.length-1];
|
||||
if (nsels.length > 0) {
|
||||
System.arraycopy(sels, 0, nsels, 0, i);
|
||||
System.arraycopy(sels, i+1, nsels, i,
|
||||
nsels.length-i);
|
||||
sel = nsels[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
repaint();
|
||||
compscroll();
|
||||
}
|
||||
|
||||
// clear
|
||||
// Remove everything from the list
|
||||
void clear()
|
||||
{
|
||||
for(int i=0; i<title.length; i++)
|
||||
list[i].removeAllElements();
|
||||
sel = -1;
|
||||
sels = new int[0];
|
||||
top = 0;
|
||||
repaint();
|
||||
sb.setValues(0, 1, 0);
|
||||
}
|
||||
|
||||
// setWidths
|
||||
// Set the proportional widths of each column
|
||||
void setWidths(float w[])
|
||||
{
|
||||
for(int i=0; i<title.length; i++)
|
||||
cwidth[i] = w[i];
|
||||
respace();
|
||||
repaint();
|
||||
}
|
||||
|
||||
/**Turns on or off the user's ability to adjust column widths
|
||||
* @param a Can adjust or not?
|
||||
*/
|
||||
void setAdjustable(boolean a)
|
||||
{
|
||||
adjustable = a;
|
||||
}
|
||||
|
||||
/**Turns on or off the drawing of column lines
|
||||
* @param d Draw lines or not?
|
||||
*/
|
||||
void setDrawLines(boolean d)
|
||||
{
|
||||
drawlines = d;
|
||||
}
|
||||
|
||||
/**Sets the array of colors used to draw text items.
|
||||
* @param c The color array (in row/column order), or null to
|
||||
* use the default
|
||||
*/
|
||||
void setColors(Color c[][])
|
||||
{
|
||||
colors = c;
|
||||
repaint();
|
||||
}
|
||||
|
||||
// Turns on or off multi-row selection with ctrl and shift
|
||||
void setMultiSelect(boolean m)
|
||||
{
|
||||
multiselect = m;
|
||||
}
|
||||
|
||||
// Enables the entire list
|
||||
public void enable()
|
||||
{
|
||||
enabled = true;
|
||||
sb.enable();
|
||||
repaint();
|
||||
}
|
||||
|
||||
// Disables the entire list
|
||||
public void disable()
|
||||
{
|
||||
enabled = false;
|
||||
sb.disable();
|
||||
repaint();
|
||||
}
|
||||
|
||||
// Sets or turns off the sort indication arrow for a column
|
||||
// Direction 0 = None, 1 = Up arrow, 2 = Down arrow
|
||||
public void sortingArrow(int col, int dir)
|
||||
{
|
||||
sortcol = col;
|
||||
sortdir = dir;
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void setFont(Font f)
|
||||
{
|
||||
font = f;
|
||||
bim = null;
|
||||
repaint();
|
||||
}
|
||||
|
||||
// Returns the total number of rows
|
||||
public int count()
|
||||
{
|
||||
return list[0].size();
|
||||
}
|
||||
|
||||
// reshape
|
||||
// Called when this component gets resized
|
||||
public void reshape(int nx, int ny, int nw, int nh)
|
||||
{
|
||||
if (nw != width+sbwidth || nh != height) {
|
||||
in = insets();
|
||||
sbwidth = sb.minimumSize().width;
|
||||
width = nw-sbwidth - (in.left + in.right);
|
||||
height = nh - (in.top + in.bottom);
|
||||
sb.reshape(width+in.left, in.top, sbwidth, height);
|
||||
respace();
|
||||
|
||||
// Force creation of a new backing image and re-painting
|
||||
bim = null;
|
||||
repaint();
|
||||
compscroll();
|
||||
}
|
||||
super.reshape(nx, ny, nw, nh);
|
||||
}
|
||||
|
||||
// respace
|
||||
// Compute pixel column widths from proportional widths
|
||||
void respace()
|
||||
{
|
||||
cpos[0] = 0;
|
||||
for(int i=0; i<title.length; i++)
|
||||
cpos[i+1] = cpos[i] + (int)(width*cwidth[i]);
|
||||
}
|
||||
|
||||
// paint
|
||||
// Blit the backing image to the front
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
super.paint(g);
|
||||
if (bim == null) {
|
||||
// This is the first rendering
|
||||
bim = createImage(width, height);
|
||||
bg = bim.getGraphics();
|
||||
bg.setFont(font);
|
||||
fnm = bg.getFontMetrics();
|
||||
th = fnm.getHeight() + 4;
|
||||
render();
|
||||
compscroll();
|
||||
}
|
||||
g.drawImage(bim, in.left, in.top, this);
|
||||
}
|
||||
|
||||
// update
|
||||
// Called sometime after repaint()
|
||||
public void update(Graphics g)
|
||||
{
|
||||
if (fnm != null) {
|
||||
render();
|
||||
paint(g);
|
||||
}
|
||||
}
|
||||
|
||||
// render
|
||||
// Re-draw the list into the backing image
|
||||
void render()
|
||||
{
|
||||
int fh = fnm.getHeight(), // useful font metrics
|
||||
fd = fnm.getDescent(),
|
||||
fa = fnm.getAscent();
|
||||
int bot = Math.min(top+rows()-1, list[0].size()-1);
|
||||
|
||||
// Clear title section and list
|
||||
bg.setColor(Util.body);
|
||||
bg.fillRect(0, 0, width, th);
|
||||
bg.setColor(Util.light_bg);
|
||||
bg.fillRect(0, th, width, height-th);
|
||||
Color lighterGray = Util.body_hi;
|
||||
|
||||
if (enabled) {
|
||||
// Mark the selected rows
|
||||
for(int i=0; i<sels.length; i++) {
|
||||
if (sels[i] >= top && sels[i] <= bot) {
|
||||
bg.setColor(sels[i] == sel ? Util.body
|
||||
: lighterGray);
|
||||
bg.fillRect(0, th+(sels[i]-top)*rowh,
|
||||
width, rowh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw each column
|
||||
for(int i=0; i<title.length; i++) {
|
||||
int x = cpos[i], w = cpos[i+1]-x-1;
|
||||
|
||||
// Column title
|
||||
bg.setColor(Util.light_edge);
|
||||
bg.drawLine(x, 0, x+w, 0);
|
||||
bg.drawLine(x, 1, x+w-1, 1);
|
||||
bg.drawLine(x, 0, x, th-1);
|
||||
bg.drawLine(x+1, 0, x+1, th-2);
|
||||
bg.setColor(Util.dark_edge);
|
||||
bg.drawLine(x, th-1, x+w, th-1);
|
||||
bg.drawLine(x, th-2, x+w-1, th-2);
|
||||
bg.drawLine(x+w, th-1, x+w, 0);
|
||||
bg.drawLine(x+w-1, th-1, x+w-1, 1);
|
||||
int tw = fnm.stringWidth(title[i]);
|
||||
if (tw < w-6)
|
||||
bg.drawString(title[i], x+(w-tw)/2, th-fd-2);
|
||||
|
||||
// Sorting arrow
|
||||
int as = th-8;
|
||||
if (sortcol == i && sortdir == 1) {
|
||||
bg.setColor(Util.light_edge);
|
||||
bg.drawLine(x+4, th-5, x+4+as, th-5);
|
||||
bg.drawLine(x+4+as, th-5, x+4+as/2, th-5-as);
|
||||
bg.setColor(Util.dark_edge);
|
||||
bg.drawLine(x+4+as/2, th-5-as, x+4, th-5);
|
||||
}
|
||||
else if (sortcol == i && sortdir == 2) {
|
||||
bg.setColor(Util.light_edge);
|
||||
bg.drawLine(x+4+as/2, th-5, x+4+as, th-5-as);
|
||||
bg.setColor(Util.dark_edge);
|
||||
bg.drawLine(x+4, th-5-as, x+4+as, th-5-as);
|
||||
bg.drawLine(x+4, th-5-as, x+4+as/2, th-5);
|
||||
}
|
||||
|
||||
// Column items
|
||||
if (drawlines) {
|
||||
bg.setColor(Util.body);
|
||||
bg.drawLine(x+w-1, th, x+w-1, height);
|
||||
bg.setColor(Util.dark_edge);
|
||||
bg.drawLine(x+w, th, x+w, height);
|
||||
}
|
||||
for(int j=top; j<=bot; j++) {
|
||||
Object o = list[i].elementAt(j);
|
||||
if (o instanceof String) {
|
||||
// Render string in column
|
||||
String s = (String)o;
|
||||
while(fnm.stringWidth(s) > w-3)
|
||||
s = s.substring(0, s.length()-1);
|
||||
if (!enabled)
|
||||
bg.setColor(Util.body);
|
||||
else if (colors != null)
|
||||
bg.setColor(colors[j][i]);
|
||||
bg.drawString(s, x+1, th+(j+1-top)*rowh-fd);
|
||||
}
|
||||
else if (o instanceof Image) {
|
||||
// Render image in column
|
||||
Image im = (Image)o;
|
||||
bg.drawImage(im, x+1, th+(j-top)*rowh, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// mouseDown
|
||||
// Select a list item or a column to drag
|
||||
public boolean mouseDown(Event e, int x, int y)
|
||||
{
|
||||
if (!enabled) {
|
||||
return true;
|
||||
}
|
||||
x -= in.left;
|
||||
y -= in.top;
|
||||
coldrag = -1;
|
||||
if (y < th) {
|
||||
// Click in title bar
|
||||
for(int i=0; i<title.length; i++) {
|
||||
if (adjustable && i > 0 && Math.abs(cpos[i] - x) < 3) {
|
||||
// clicked on a column separator
|
||||
coldrag = i;
|
||||
}
|
||||
else if (x >= cpos[i] && x < cpos[i+1]) {
|
||||
// clicked in a title
|
||||
callback.headingClicked(this, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Item chosen from list
|
||||
int row = (y-th)/rowh + top;
|
||||
if (row < list[0].size()) {
|
||||
// Double-click?
|
||||
boolean dclick = false;
|
||||
if (e.when-last < 1000 && sel == row)
|
||||
dclick = true;
|
||||
else
|
||||
last = e.when;
|
||||
|
||||
if (e.shiftDown() && multiselect && sel != -1) {
|
||||
// Select all from last selection to this one
|
||||
int zero = sels[0];
|
||||
if (zero < row) {
|
||||
sels = new int[row-zero+1];
|
||||
for(int i=zero; i<=row; i++)
|
||||
sels[i-zero] = i;
|
||||
}
|
||||
else {
|
||||
sels = new int[zero-row+1];
|
||||
for(int i=zero; i>=row; i--)
|
||||
sels[zero-i] = i;
|
||||
}
|
||||
}
|
||||
else if (e.controlDown() && multiselect) {
|
||||
// Add this one to selection
|
||||
int nsels[] = new int[sels.length + 1];
|
||||
System.arraycopy(sels, 0, nsels, 0,sels.length);
|
||||
nsels[sels.length] = row;
|
||||
sels = nsels;
|
||||
}
|
||||
else {
|
||||
// Select one row only, and de-select others
|
||||
sels = new int[1];
|
||||
sels[0] = row;
|
||||
}
|
||||
sel = row;
|
||||
repaint();
|
||||
last_event = e;
|
||||
if (callback != null) {
|
||||
// Callback the right function
|
||||
if (dclick) callback.doubleClick(this, row);
|
||||
else callback.singleClick(this, row);
|
||||
}
|
||||
else {
|
||||
// Send an event
|
||||
getParent().postEvent(
|
||||
new Event(this,
|
||||
Event.ACTION_EVENT,
|
||||
dclick?"Double":"Single"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// mouseDrag
|
||||
// If a column is selected, change it's width
|
||||
public boolean mouseDrag(Event e, int x, int y)
|
||||
{
|
||||
if (!enabled) {
|
||||
return true;
|
||||
}
|
||||
x -= in.left;
|
||||
y -= in.top;
|
||||
if (coldrag != -1) {
|
||||
if (x > cpos[coldrag-1]+3 && x < cpos[coldrag+1]-3) {
|
||||
cpos[coldrag] = x;
|
||||
cwidth[coldrag-1] = (cpos[coldrag]-cpos[coldrag-1]) /
|
||||
(float)width;
|
||||
cwidth[coldrag] = (cpos[coldrag+1]-cpos[coldrag]) /
|
||||
(float)width;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void moved(CbScrollbar s, int v)
|
||||
{
|
||||
moving(s, v);
|
||||
}
|
||||
|
||||
public void moving(CbScrollbar s, int v)
|
||||
{
|
||||
top = sb.getValue();
|
||||
compscroll();
|
||||
repaint();
|
||||
}
|
||||
|
||||
// compscroll
|
||||
// Re-compute the size of the scrollbar
|
||||
private void compscroll()
|
||||
{
|
||||
if (fnm == null)
|
||||
return; // not visible
|
||||
int r = rows();
|
||||
int c = list[0].size() - r;
|
||||
sb.setValues(top, r==0?1:r, list[0].size());
|
||||
}
|
||||
|
||||
// rows
|
||||
// Returns the number of rows visible in the list
|
||||
private int rows()
|
||||
{
|
||||
return Math.min(height/rowh - 1, list[0].size());
|
||||
}
|
||||
|
||||
public Dimension minimumSize()
|
||||
{
|
||||
return new Dimension(400, 100);
|
||||
}
|
||||
|
||||
public Dimension preferredSize()
|
||||
{
|
||||
return minimumSize();
|
||||
}
|
||||
}
|
||||
|
||||
// MultiColumnCallback
|
||||
// Objects implementing this interface can be passed to the MultiColumn
|
||||
// class, to have their singleClick() and doubleClick() functions called in
|
||||
// response to single or double click in the list.
|
||||
interface MultiColumnCallback
|
||||
{
|
||||
// singleClick
|
||||
// Called on a single click on a list item
|
||||
void singleClick(MultiColumn list, int num);
|
||||
|
||||
// doubleClick
|
||||
// Called upon double-clicking on a list item
|
||||
void doubleClick(MultiColumn list, int num);
|
||||
|
||||
// headingClicked
|
||||
// Called when a column heading is clicked on
|
||||
void headingClicked(MultiColumn list, int col);
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,103 +0,0 @@
|
||||
import java.util.Vector;
|
||||
|
||||
// StringSplitter
|
||||
// A stringsplitter object splits a string into a number of substrings,
|
||||
// each separated by one separator character. Separator characters can be
|
||||
// included in the string by escaping them with a \
|
||||
public class StringSplitter
|
||||
{
|
||||
Vector parts = new Vector();
|
||||
int pos = 0;
|
||||
|
||||
StringSplitter(String str, char sep)
|
||||
{
|
||||
this(str, sep, true);
|
||||
}
|
||||
|
||||
StringSplitter(String str, char sep, boolean escape)
|
||||
{
|
||||
StringBuffer current;
|
||||
|
||||
parts.addElement(current = new StringBuffer());
|
||||
for(int i=0; i<str.length(); i++) {
|
||||
char c = str.charAt(i);
|
||||
if (c == '\\' && i != str.length()-1 && escape)
|
||||
current.append(str.charAt(++i));
|
||||
else if (c == sep)
|
||||
parts.addElement(current = new StringBuffer());
|
||||
else
|
||||
current.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
// countTokens
|
||||
// The number of tokens left in the string
|
||||
int countTokens()
|
||||
{
|
||||
return parts.size() - pos;
|
||||
}
|
||||
|
||||
// hasMoreTokens
|
||||
// Can we call nextToken?
|
||||
boolean hasMoreTokens()
|
||||
{
|
||||
return pos < parts.size();
|
||||
}
|
||||
|
||||
// nextToken
|
||||
// Returns the string value of the next token
|
||||
String nextToken()
|
||||
{
|
||||
if (pos < parts.size())
|
||||
return ((StringBuffer)parts.elementAt(pos++)).toString();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
// gettokens
|
||||
// Returns a vector of strings split from the given input string
|
||||
Vector gettokens()
|
||||
{
|
||||
return parts;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// StringJoiner
|
||||
// The complement of StringSplitter. Takes a number of substrings and adds
|
||||
// them to a string, separated by some character. If the separator character
|
||||
// appears in one of the substrings, escape it with a \
|
||||
class StringJoiner
|
||||
{
|
||||
char sep;
|
||||
StringBuffer str = new StringBuffer();
|
||||
int count = 0;
|
||||
|
||||
// Create a new StringJoiner using the given separator
|
||||
StringJoiner(char s)
|
||||
{
|
||||
sep = s;
|
||||
}
|
||||
|
||||
// add
|
||||
// Add one string, and a separator
|
||||
void add(String s)
|
||||
{
|
||||
if (count != 0)
|
||||
str.append(sep);
|
||||
for(int i=0; i<s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == sep || c == '\\') str.append('\\');
|
||||
str.append(c);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
// toString
|
||||
// Get the resulting string
|
||||
public String toString()
|
||||
{
|
||||
return str.toString();
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
139
proc/Tracer.java
139
proc/Tracer.java
@ -1,139 +0,0 @@
|
||||
import java.awt.*;
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.applet.*;
|
||||
|
||||
public class Tracer extends Applet implements Runnable,CbButtonCallback
|
||||
{
|
||||
MultiColumn log;
|
||||
StringBuffer logbuffer = new StringBuffer();
|
||||
LineInputStream is;
|
||||
Thread th;
|
||||
CbButton pause, button;
|
||||
boolean paused = false;
|
||||
int MAX_ROWS = 1000;
|
||||
Vector buffer = new Vector();
|
||||
|
||||
public void init()
|
||||
{
|
||||
// Create the UI
|
||||
setLayout(new BorderLayout());
|
||||
String cols[] = { "Time", "System Call", "Parameters", "Return" };
|
||||
add("Center", log = new MultiColumn(cols));
|
||||
float widths[] = { .1f, .15f, .65f, .1f };
|
||||
log.setWidths(widths);
|
||||
Util.setFont(new Font("TimesRoman", Font.PLAIN, 12));
|
||||
Panel bot = new Panel();
|
||||
bot.setBackground(Color.white);
|
||||
bot.setForeground(Color.white);
|
||||
bot.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
||||
bot.add(pause = new CbButton(" Pause ", this));
|
||||
add("South", bot);
|
||||
}
|
||||
|
||||
public void start()
|
||||
{
|
||||
// Start download thread
|
||||
log.clear();
|
||||
th = new Thread(this);
|
||||
th.start();
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
// Stop download
|
||||
try {
|
||||
String killurl = getParameter("killurl");
|
||||
if (killurl != null) {
|
||||
// Call this CGI at stop time
|
||||
try {
|
||||
URL u = new URL(getDocumentBase(), killurl);
|
||||
URLConnection uc = u.openConnection();
|
||||
String session = getParameter("session");
|
||||
if (session != null)
|
||||
uc.setRequestProperty("Cookie", session);
|
||||
uc.getInputStream().close();
|
||||
}
|
||||
catch(Exception e2) { }
|
||||
}
|
||||
if (is != null) is.close();
|
||||
if (th != null) th.stop();
|
||||
}
|
||||
catch(Exception e) {
|
||||
// ignore it
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
URL u = new URL(getDocumentBase(), getParameter("url"));
|
||||
URLConnection uc = u.openConnection();
|
||||
String session = getParameter("session");
|
||||
if (session != null)
|
||||
uc.setRequestProperty("Cookie", session);
|
||||
is = new LineInputStream(uc.getInputStream());
|
||||
while(true) {
|
||||
StringSplitter tok =
|
||||
new StringSplitter(is.gets(), '\t', false);
|
||||
if (tok.countTokens() == 4) {
|
||||
Object row[] = { tok.nextToken(),
|
||||
tok.nextToken(),
|
||||
tok.nextToken(),
|
||||
tok.nextToken() };
|
||||
if (paused) {
|
||||
// Store in temp buffer
|
||||
buffer.addElement(row);
|
||||
if (buffer.size() > MAX_ROWS) {
|
||||
buffer.removeElementAt(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Add immediately
|
||||
log.addItem(row);
|
||||
cleanup();
|
||||
log.scrollto(log.count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(EOFException e) {
|
||||
// end of file ..
|
||||
}
|
||||
catch(IOException e) {
|
||||
// shouldn't happen!
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
while(log.count() > MAX_ROWS) {
|
||||
log.deleteItem(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void click(CbButton b) {
|
||||
if (b == pause) {
|
||||
if (paused) {
|
||||
// Resume display, and add missed stuff
|
||||
pause.setText(" Pause ");
|
||||
for(int i=0; i<buffer.size(); i++) {
|
||||
Object row[] =
|
||||
(Object[])buffer.elementAt(i);
|
||||
log.addItem(row);
|
||||
}
|
||||
cleanup();
|
||||
log.scrollto(log.count()-1);
|
||||
buffer.removeAllElements();
|
||||
} else {
|
||||
// Stop display
|
||||
pause.setText("Resume");
|
||||
}
|
||||
paused = !paused;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
proc/Util.class
BIN
proc/Util.class
Binary file not shown.
148
proc/Util.java
148
proc/Util.java
@ -1,148 +0,0 @@
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
|
||||
class Util
|
||||
{
|
||||
static Frame fr;
|
||||
static Graphics g;
|
||||
static Font f;
|
||||
static FontMetrics fnm;
|
||||
static Toolkit tk;
|
||||
|
||||
static Color light_edge = Color.white;
|
||||
static Color dark_edge = Color.black;
|
||||
static Color body = Color.lightGray;
|
||||
static Color body_hi = new Color(210, 210, 210);
|
||||
static Color light_edge_hi = Color.white;
|
||||
static Color dark_edge_hi = Color.darkGray;
|
||||
static Color dark_bg = new Color(150, 150, 150);
|
||||
static Color text = Color.black;
|
||||
static Color light_bg = Color.white;
|
||||
|
||||
static
|
||||
{
|
||||
fr = new Frame();
|
||||
fr.addNotify();
|
||||
g = fr.getGraphics();
|
||||
setFont(new Font("TimesRoman", Font.PLAIN, 8));
|
||||
tk = Toolkit.getDefaultToolkit();
|
||||
}
|
||||
|
||||
static boolean waitForImage(Image i)
|
||||
{
|
||||
MediaTracker mt = new MediaTracker(fr);
|
||||
mt.addImage(i, 0);
|
||||
try { mt.waitForAll(); } catch(Exception e) { return false; }
|
||||
return !mt.isErrorAny();
|
||||
}
|
||||
|
||||
static boolean waitForImage(Image i, int w, int h)
|
||||
{
|
||||
MediaTracker mt = new MediaTracker(fr);
|
||||
mt.addImage(i, w, h, 0);
|
||||
try { mt.waitForAll(); } catch(Exception e) { return false; }
|
||||
return !mt.isErrorAny();
|
||||
}
|
||||
|
||||
static int getWidth(Image i)
|
||||
{
|
||||
waitForImage(i);
|
||||
return i.getWidth(fr);
|
||||
}
|
||||
|
||||
static int getHeight(Image i)
|
||||
{
|
||||
waitForImage(i);
|
||||
return i.getHeight(fr);
|
||||
}
|
||||
|
||||
static Image createImage(int w, int h)
|
||||
{
|
||||
return fr.createImage(w, h);
|
||||
}
|
||||
|
||||
static Image createImage(ImageProducer p)
|
||||
{
|
||||
return fr.createImage(p);
|
||||
}
|
||||
|
||||
static Object createObject(String name)
|
||||
{
|
||||
try {
|
||||
Class c = Class.forName(name);
|
||||
return c.newInstance();
|
||||
}
|
||||
catch(Exception e) {
|
||||
System.err.println("Failed to create object "+name+" : "+
|
||||
e.getClass().getName());
|
||||
System.exit(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**Create a new instance of some object
|
||||
*/
|
||||
static Object createObject(Object o)
|
||||
{
|
||||
try { return o.getClass().newInstance(); }
|
||||
catch(Exception e) {
|
||||
System.err.println("Failed to reproduce object "+o+" : "+
|
||||
e.getClass().getName());
|
||||
System.exit(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
static void dottedRect(Graphics g, int x1, int y1,
|
||||
int x2, int y2, int s)
|
||||
{
|
||||
int i, s2 = s*2, t;
|
||||
if (x2 < x1) { t = x1; x1 = x2; x2 = t; }
|
||||
if (y2 < y1) { t = y1; y1 = y2; y2 = t; }
|
||||
for(i=x1; i<=x2; i+=s2)
|
||||
g.drawLine(i, y1, i+s > x2 ? x2 : i+s, y1);
|
||||
for(i=y1; i<=y2; i+=s2)
|
||||
g.drawLine(x2, i, x2, i+s > y2 ? y2 : i+s);
|
||||
for(i=x2; i>=x1; i-=s2)
|
||||
g.drawLine(i, y2, i-s < x1 ? x1 : i-s, y2);
|
||||
for(i=y2; i>=y1; i-=s2)
|
||||
g.drawLine(x1, i, x1, i-s < y1 ? y1 : i-s);
|
||||
}
|
||||
|
||||
static void recursiveLayout(Container c)
|
||||
{
|
||||
c.layout();
|
||||
for(int i=0; i<c.countComponents(); i++) {
|
||||
Component cc = c.getComponent(i);
|
||||
if (cc instanceof Container)
|
||||
recursiveLayout((Container)cc);
|
||||
}
|
||||
}
|
||||
|
||||
static void recursiveBackground(Component c, Color b)
|
||||
{
|
||||
if (c instanceof TextField || c instanceof Choice ||
|
||||
c instanceof TextArea)
|
||||
return; // leave these alone
|
||||
c.setBackground(b);
|
||||
if (c instanceof Container) {
|
||||
Container cn = (Container)c;
|
||||
for(int i=0; i<cn.countComponents(); i++)
|
||||
recursiveBackground(cn.getComponent(i), b);
|
||||
}
|
||||
}
|
||||
|
||||
static void recursiveBody(Component c)
|
||||
{
|
||||
recursiveBackground(c, Util.body);
|
||||
}
|
||||
|
||||
static void setFont(Font nf)
|
||||
{
|
||||
f = nf;
|
||||
g.setFont(f);
|
||||
fnm = g.getFontMetrics();
|
||||
}
|
||||
}
|
||||
|
@ -2,5 +2,4 @@ default_mode=last
|
||||
ps_style=linux
|
||||
base_ppid=1
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ ps_style=sysv
|
||||
default_mode=last
|
||||
base_ppid=1
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ default_mode=last
|
||||
ps_style=freebsd
|
||||
base_ppid=0
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ ps_style=hpux
|
||||
default_mode=last
|
||||
base_ppid=0
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ default_mode=last
|
||||
ps_style=sysv
|
||||
base_ppid=1
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ default_mode=tree
|
||||
ps_style=macos
|
||||
base_ppid=1
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ default_mode=last
|
||||
ps_style=freebsd
|
||||
base_ppid=0
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ default_mode=last
|
||||
ps_style=openbsd
|
||||
base_ppid=0
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ ps_style=sysv
|
||||
default_mode=last
|
||||
base_ppid=1
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ default_mode=last
|
||||
ps_style=osf
|
||||
base_ppid=1
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ ps_style=sysv
|
||||
default_mode=last
|
||||
base_ppid=1
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ ps_style=sysv
|
||||
default_mode=last
|
||||
base_ppid=1
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -2,5 +2,4 @@ default_mode=last
|
||||
ps_style=windows
|
||||
base_ppid=1
|
||||
cut_length=80
|
||||
trace_java=0
|
||||
hide_self=1
|
||||
|
@ -1,7 +1,6 @@
|
||||
line1=Configurable options,11
|
||||
default_mode=Default process list style,4,last-Last chosen,tree-Process tree,user-Order by user,size-Order by size,cpu-Order by CPU,search-Search form,run-Run form
|
||||
cut_length=Characters to truncate commands to,3,Unlimited
|
||||
trace_java=Show system call trace using,1,1-Java applet,0-Text
|
||||
hide_self=Hide Webmin processes from list?,1,1-Yes,0-No
|
||||
line2=System configuration,11
|
||||
ps_style=PS command output style,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,7 +1,6 @@
|
||||
line1=Opcions configurables,11
|
||||
default_mode=Estil de la llista de processos per defecte,4,last-Darrer triat,tree-Arbre de processos,user-Ordenada per usuaris,size-Ordenada per mida,cpu-Ordenada per CPU,search-Formulari de recerca,run-Formulari d'execució
|
||||
cut_length=Trunca les ordres al nombre de caràcters,3,Il·limitat
|
||||
trace_java=Mostra el rastreig de les crides del sistema utilitzant,1,1-Applet Java,0-Text
|
||||
hide_self=Amaga els processos de Webmin de la llista,1,1-Sí,0-No
|
||||
line2=Configuració del sistema,11
|
||||
ps_style=Estil de la sortida de l'ordre PS,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Možnosti konfigurace,11
|
||||
default_mode=Výchozí styl seznamu procesů,4,last-Poslední změna,tree-Strom peocesů,user-Pořadí podle uživatele,size-Pořadí podle velikosti,cpu-Pořadí v CPU,search-Vyhledávací formulář,run-Spouštěcí formulář
|
||||
cut_length=Znaky usekávající příkazy na,3,Neomezeno
|
||||
trace_java=Zobrazit trasování systémových volání využívající,1,1-Java applet,0-Text
|
||||
line2=Konfigurace systému,11
|
||||
ps_style=Styl výstupu PS příkazu,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Konfigurierbare Optionen,11
|
||||
default_mode=Standard Prozess-Listen Stil,4,last-Zuletzt gewählter,tree-Prozess-Baum,user-Sortiert nach Benutzer,size-Sortiert nach Größe,cpu-Sortiert nach CPU,search-Such-Formular,run-Ausführen-Formular
|
||||
cut_length=Zeichenanzahl in Befehlen kürzen auf,3,Unbegrenzt
|
||||
trace_java=Zeige Call-Trace-System als,1,1-Java-Applet,0-Text
|
||||
line2=Systemkonfiguration,11
|
||||
ps_style=PS-Befehl Ausgabe-Stil,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,5 +1,4 @@
|
||||
default_mode=روش فهرست پردازش پيش گزيده,4,last-آخرين انتخاب,tree-درخت پردازش,user-مرتبسازي براساس کاربر,size-مرتبسازي براساس اندازه,cpu-مرتبسازي براساس CPU,search-برگه جستجو,run-برگه اجرا
|
||||
cut_length=تعداد حرف تقسيم کردن فرمانات,3,نامحدود
|
||||
trace_java=نمايش رديابي فراخواني سيستم با استفاده از,1,1-برنامک جاوا,0-متن
|
||||
line2=پيکربندي سيستم,11
|
||||
ps_style=روش برونداد فرمان PS,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Konfigurálható beállítások,11
|
||||
default_mode=Alapértelmezett processz listázási stílus,4,last-Legutóbbi,tree-Processz-fa,user-Felhasználó szerint,size-Méret szerint,cpu-CPU-kihasználtság szerint,search-Keresés,run-Futtatás
|
||||
cut_length=A parancs levágásának hossza,3,Végtelen
|
||||
trace_java=Rendszer hívási nyomozás megmutatása,1,1-Java applettel,0-Szövegesen
|
||||
line2=Rendszer beállítások,11
|
||||
ps_style=PS parancs kimenetének stílusa,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Opzioni configurabili,11
|
||||
default_mode=Stile predefinito dell'elenco dei processi:,4,last-L'ultimo scelto,tree-Albero dei processi,user-Ordina per utente,size-Ordina per dimensione,cpu-Ordina per CPU,search-Modulo di ricerca,run-Modulo di avvio
|
||||
cut_length=Numero di caratteri da visualizzare per i comandi:,3,Illimitato
|
||||
trace_java=Visualizza le chiamate di sistema per il tracciamento come:,1,1-Applet Java,0-Testo
|
||||
line2=Configurazioni di sistema,11
|
||||
ps_style=Stile dell'output dei comandi PS:,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=設定可能なオプション,11
|
||||
default_mode=デフォルトのプロセス表示スタイル,4,last-最後に選んだ表示スタイル,tree-プロセスツリー,user-ユーザ順,size-メモリサイズ順,cpu-CPU消費順,search-検索,run-実行
|
||||
cut_length=切り詰める文字数,3,無制限
|
||||
trace_java=システムコールの出力にJava appletを使うか,1,1-Java applet,0-テキスト
|
||||
line2=システム設定,11
|
||||
ps_style=PS コマンドの出力形式,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Configureerbare opties,11
|
||||
default_mode=Standaard proces lijst stijl,4,last-Laatst gekozen,tree-Proces tree,user-Gebruikers volgorden,size-Volgorden in grote,cpu-Volgorde van CPU,search-Zoek formulier,run-Uitvoer formulier
|
||||
cut_length=Karakters om opdrachten te bekorten,3,Ongelimiteerd
|
||||
trace_java=Laat systeem opgevraagde opsporingen zien in,1,1-Java applet,0-Tekst
|
||||
line2=Systeem configuratie,11
|
||||
ps_style=PS opdracht output stijl,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Konfigurerbare innstillinger,11
|
||||
default_mode=Standard listestil for prosessliste,,4,last-Sist valgte,tree-Prosess-tre,user-Sorter etter bruker,size-Sorter etter størrelse,cpu-Sorter etter CPU,search-Søkeskjema,run-Kjøre-skjema
|
||||
cut_length=Antall tegn kommandoer skal forkortes til,3,Ubegrenset
|
||||
trace_java=Vis sporing av systemkall vha.,1,1-Java applet,0-Tekst
|
||||
line2=System konfigurasjon,11
|
||||
ps_style=Utdata-stil for PS kommando,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Opcje konfiguracyjne,11
|
||||
default_mode=Domyślny sposób wyświetlania procesów,4,last-Ostatnio wybrany,tree-Drzewo procesów,user-Porządek wg użytkownika,size-Porządek wg rozmiaru,cpu-Porządek wg CPU,search-Formularz szukania,run-Formularz uruchomienia
|
||||
cut_length=Ilość znaków polecenia,3,Nielimitowane
|
||||
trace_java=Wyświetlaj śledzenie procesów używając,1,1-Aplet Java,0-Tekst
|
||||
line2=Opcje systemowe,11
|
||||
ps_style=Styl wyjścia polecenia PS,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Opções configuráveis,11
|
||||
default_mode=Estilo de lista de processo padrão,4,last-Último escolhido,tree-Árvore de processos,user-Ordenar por usuário,size-Ordenar por tamanho,cpu-Ordenar por CPU,search-Formato de busca,run-Formato de execução
|
||||
cut_length=Caracteres aos quais truncar comandos,3,Ilimitado
|
||||
trace_java=Exibir
|
||||
line2=Configuração do sistema,11
|
||||
ps_style=Estilo da saída do comando PS,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Настраиваемые параметры,11
|
||||
default_mode=Способ вывода списка процессов по умолчанию,4,last-Последний выбранный,tree-Дерево процессов,user-Упорядочивать по именам пользователей,size-Упорядочивать по размеру,cpu-Упорядочивать по CPU,search-Страница поиска,run-Страница выполнения
|
||||
cut_length=Максимальная длина команд,3,Не ограничена
|
||||
trace_java=Показывать трассировку системных вызовов используя,1,1-Java-апплет,0-Текст
|
||||
line2=Системные параметры,11
|
||||
ps_style=Стиль вывода команды PS,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS,openbsd-OpenBSD
|
||||
|
@ -1,6 +1,5 @@
|
||||
line1=Yapılandırılabilir seçenekler,11
|
||||
default_mode=Öntanımlı işlem listeleme stili,4,son-Son seçilen,ağaç-İşlem ağacı,kullanıcı-Kullanıcıya göre ,boyut-Boyuta göre,işlemci-İşlemci kullanımına göre,arama-Arama formu,çalıştır-Çalıştırma formu
|
||||
cut_length=Komutlarda gösterilecek maksimum karakter sayısı,3,Limitsiz
|
||||
trace_java=Sistem çağrısı takibini şu şekilde göster,1,1-Java applet,0-Metin
|
||||
line2=Sistem yapılandırması,11
|
||||
ps_style=PS komutu çıktısı biçimi,1,sysv-SYSV,linux-Linux,hpux-HPUX,freebsd-FreeBSD,macos-MacOS
|
||||
|
@ -1,32 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
|
||||
require './proc-lib.pl';
|
||||
&ReadParse();
|
||||
if ($in{'id'}) {
|
||||
$idfile = "$module_config_directory/$in{'id'}.tail";
|
||||
open(IDFILE, ">$idfile");
|
||||
print IDFILE $$,"\n";
|
||||
close(IDFILE);
|
||||
$SIG{'HUP'} = \&hup_handler;
|
||||
}
|
||||
$| = 1;
|
||||
print "Content-type: text/plain\n\n";
|
||||
$trace = &open_process_trace($in{'pid'},
|
||||
$in{'syscalls'} ? [ split(/\s+/, $in{'syscalls'}) ]
|
||||
: undef);
|
||||
while($action = &read_process_trace($trace)) {
|
||||
local $tm = strftime("%H:%M:%S", localtime($action->{'time'}));
|
||||
print join("\t", $tm, $action->{'call'},
|
||||
join(", ", @{$action->{'args'}}),
|
||||
$action->{'rv'}),"\n";
|
||||
}
|
||||
&close_process_trace($trace);
|
||||
unlink($idfile) if ($idfile);
|
||||
|
||||
sub hup_handler
|
||||
{
|
||||
&close_process_trace($trace);
|
||||
unlink($idfile);
|
||||
exit;
|
||||
}
|
||||
|
@ -3,12 +3,8 @@
|
||||
|
||||
require './proc-lib.pl';
|
||||
&ReadParse();
|
||||
if ($config{'trace_java'}) {
|
||||
&ui_print_header(undef, $text{'trace_title'}, "", "trace");
|
||||
}
|
||||
else {
|
||||
&ui_print_unbuffered_header(undef, $text{'trace_title'}, "", "trace");
|
||||
}
|
||||
&ui_print_unbuffered_header(undef, $text{'trace_title'}, "", "trace");
|
||||
|
||||
%pinfo = &process_info($in{'pid'});
|
||||
&can_edit_process($pinfo{'user'}) || &error($text{'edit_ecannot'});
|
||||
if (!%pinfo) {
|
||||
@ -27,47 +23,28 @@ $syscalls = &ui_form_start("trace.cgi", "post")."\n".
|
||||
&ui_submit($text{'trace_change'})."\n".
|
||||
&ui_form_end()."\n";
|
||||
|
||||
if ($config{'trace_java'}) {
|
||||
# Output Java applet to show trace
|
||||
print "<b>",&text('trace_doing', "<tt>$pinfo{'args'}</tt>"),"</b><br>\n";
|
||||
print $syscalls;
|
||||
print "<applet code=Tracer width=800 height=300>\n";
|
||||
&seed_random();
|
||||
$id = int(rand()*1000000000);
|
||||
print "<param name=url value='tail.cgi?pid=$in{'pid'}&id=$id&syscalls=",
|
||||
$in{'all'} ? "" : &urlize($in{'syscalls'}),"'>\n";
|
||||
print "<param name=killurl value='killtail.cgi?id=$id'>\n";
|
||||
if ($main::session_id) {
|
||||
print "<param name=session value=\"sid=$main::session_id\">\n";
|
||||
}
|
||||
print "$text{'trace_sorry'}<p>\n";
|
||||
print "</applet>\n";
|
||||
@syscalls = $in{'all'} ? ( ) : split(/\s+/, $in{'syscalls'});
|
||||
$trace = &open_process_trace($in{'pid'},
|
||||
\@syscalls);
|
||||
$fmt = "%-8.8s %-11.11s %-80.80s %-10.10s";
|
||||
print "<b>",&text('trace_start', "<tt>$pinfo{'args'}</tt>"),"</b><br>\n";
|
||||
print $syscalls;
|
||||
print "<pre>";
|
||||
printf "$fmt\n", "Time", "System Call", "Parameters", "Return";
|
||||
printf "$fmt\n", ("-"x8), ("-"x11), ("-"x80), ("-"x10);
|
||||
while($action = &read_process_trace($trace)) {
|
||||
local $tm = strftime("%H:%M:%S", localtime($action->{'time'}));
|
||||
printf "$fmt\n", $tm, $action->{'call'},
|
||||
join(", ", @{$action->{'args'}}),
|
||||
$action->{'rv'};
|
||||
}
|
||||
print "</pre>";
|
||||
&close_process_trace($trace);
|
||||
if (!kill(0, $in{'pid'})) {
|
||||
print "<b>$text{'trace_done'}</b><br>\n";
|
||||
}
|
||||
else {
|
||||
# Just display here as text
|
||||
@syscalls = $in{'all'} ? ( ) : split(/\s+/, $in{'syscalls'});
|
||||
$trace = &open_process_trace($in{'pid'},
|
||||
\@syscalls);
|
||||
$fmt = "%-8.8s %-11.11s %-80.80s %-10.10s";
|
||||
print "<b>",&text('trace_start', "<tt>$pinfo{'args'}</tt>"),"</b><br>\n";
|
||||
print $syscalls;
|
||||
print "<pre>";
|
||||
printf "$fmt\n", "Time", "System Call", "Parameters", "Return";
|
||||
printf "$fmt\n", ("-"x8), ("-"x11), ("-"x80), ("-"x10);
|
||||
while($action = &read_process_trace($trace)) {
|
||||
local $tm = strftime("%H:%M:%S", localtime($action->{'time'}));
|
||||
printf "$fmt\n", $tm, $action->{'call'},
|
||||
join(", ", @{$action->{'args'}}),
|
||||
$action->{'rv'};
|
||||
}
|
||||
print "</pre>";
|
||||
&close_process_trace($trace);
|
||||
if (!kill(0, $in{'pid'})) {
|
||||
print "<b>$text{'trace_done'}</b><br>\n";
|
||||
}
|
||||
else {
|
||||
print "<b>$text{'trace_failed'}</b><br>\n";
|
||||
}
|
||||
print "<b>$text{'trace_failed'}</b><br>\n";
|
||||
}
|
||||
|
||||
&ui_print_footer("edit_proc.cgi?$in{'pid'}", $text{'edit_return'},
|
||||
|
Loading…
x
Reference in New Issue
Block a user