public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Eliminate RawDataManaged from termios. Date: Wed, 14 May 2008 20:52:00 -0000 [thread overview] Message-ID: <20080514205209.9656.qmail@sourceware.org> (raw) The branch, master has been updated via ebcacc0987578fb83182763d10ef74828c933d83 (commit) from be931329a57113f8d9668e47a7019b8c45b87cfd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit ebcacc0987578fb83182763d10ef74828c933d83 Author: Andrew Cagney <cagney@redhat.com> Date: Wed May 14 16:18:39 2008 -0400 Eliminate RawDataManaged from termios. frysk-sys/frysk/sys/termios/ChangeLog 2008-05-14 Andrew Cagney <cagney@redhat.com> * Termios.java (termios): Change type to "long"; pass value to methods. * Action.java: Update. * Control.java: Update. * Input.java: Update. * Local.java: Update. * Mode.java: Update. * Output.java: Update. * Special.java: Update. * Speed.java: Update. * cni/Output.cxx: Ditto. * cni/Speed.cxx: Update. * cni/Local.cxx: Ditto. * cni/Input.cxx: Update. * cni/Special.cxx: Update. * cni/Control.cxx: Update. * cni/Termios.cxx: Ditto. ----------------------------------------------------------------------- Summary of changes: frysk-sys/frysk/sys/termios/Action.java | 2 +- frysk-sys/frysk/sys/termios/ChangeLog | 20 ++++++ frysk-sys/frysk/sys/termios/Control.java | 19 ++---- frysk-sys/frysk/sys/termios/Input.java | 14 +--- frysk-sys/frysk/sys/termios/Local.java | 16 ++--- frysk-sys/frysk/sys/termios/Mode.java | 32 +++------ frysk-sys/frysk/sys/termios/Output.java | 17 ++--- frysk-sys/frysk/sys/termios/Special.java | 32 ++++----- frysk-sys/frysk/sys/termios/Speed.java | 31 +++----- frysk-sys/frysk/sys/termios/Termios.java | 98 ++++++++++++++++----------- frysk-sys/frysk/sys/termios/cni/Control.cxx | 24 +++---- frysk-sys/frysk/sys/termios/cni/Input.cxx | 23 +++---- frysk-sys/frysk/sys/termios/cni/Local.cxx | 19 ++--- frysk-sys/frysk/sys/termios/cni/Output.cxx | 19 ++--- frysk-sys/frysk/sys/termios/cni/Special.cxx | 16 ++--- frysk-sys/frysk/sys/termios/cni/Speed.cxx | 28 +++----- frysk-sys/frysk/sys/termios/cni/Termios.cxx | 61 +++++++---------- 17 files changed, 211 insertions(+), 260 deletions(-) First 500 lines of diff: diff --git a/frysk-sys/frysk/sys/termios/Action.java b/frysk-sys/frysk/sys/termios/Action.java index 0b1f64f..874e034 100644 --- a/frysk-sys/frysk/sys/termios/Action.java +++ b/frysk-sys/frysk/sys/termios/Action.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by diff --git a/frysk-sys/frysk/sys/termios/ChangeLog b/frysk-sys/frysk/sys/termios/ChangeLog index 88c76f5..ad99061 100644 --- a/frysk-sys/frysk/sys/termios/ChangeLog +++ b/frysk-sys/frysk/sys/termios/ChangeLog @@ -1,3 +1,23 @@ +2008-05-14 Andrew Cagney <cagney@redhat.com> + + * Termios.java (termios): Change type to "long"; pass value to + methods. + * Action.java: Update. + * Control.java: Update. + * Input.java: Update. + * Local.java: Update. + * Mode.java: Update. + * Output.java: Update. + * Special.java: Update. + * Speed.java: Update. + * cni/Output.cxx: Ditto. + * cni/Speed.cxx: Update. + * cni/Local.cxx: Ditto. + * cni/Input.cxx: Update. + * cni/Special.cxx: Update. + * cni/Control.cxx: Update. + * cni/Termios.cxx: Ditto. + 2008-05-07 Andrew Cagney <cagney@redhat.com> * jni/Control.cxx: Include jni.hxx. diff --git a/frysk-sys/frysk/sys/termios/Control.java b/frysk-sys/frysk/sys/termios/Control.java index cf96522..663a344 100644 --- a/frysk-sys/frysk/sys/termios/Control.java +++ b/frysk-sys/frysk/sys/termios/Control.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -42,18 +42,11 @@ package frysk.sys.termios; /** * Input modes. */ -public class Control - extends Mode -{ -// private Control (String s) -// { -// super (s); -// } - native Termios set (Termios termios, boolean on); - native boolean get (Termios termios); - public static Control[] getModes () - { - return (Control[]) (getStaticMembers (Control.class) +public class Control extends Mode { + native void set(long termios, boolean on); + native boolean get(long termios); + public static Control[] getModes() { + return (Control[]) (getStaticMembers(Control.class) .toArray (new Control[0])); } } diff --git a/frysk-sys/frysk/sys/termios/Input.java b/frysk-sys/frysk/sys/termios/Input.java index 2e841d3..e2ada47 100644 --- a/frysk-sys/frysk/sys/termios/Input.java +++ b/frysk-sys/frysk/sys/termios/Input.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -43,15 +43,9 @@ package frysk.sys.termios; * Input modes. */ -public final class Input - extends Mode -{ -// private Input (String on) -// { -// super (on); -// } - native Termios set (Termios termios, boolean on); - native boolean get (Termios termios); +public final class Input extends Mode { + native void set(long termios, boolean on); + native boolean get(long termios); public static Input[] getModes () { return (Input[]) (getStaticMembers (Input.class) diff --git a/frysk-sys/frysk/sys/termios/Local.java b/frysk-sys/frysk/sys/termios/Local.java index dc2d910..5193d2f 100644 --- a/frysk-sys/frysk/sys/termios/Local.java +++ b/frysk-sys/frysk/sys/termios/Local.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -43,17 +43,13 @@ package frysk.sys.termios; * Local modes. */ -public final class Local - extends Mode -{ - private Local (String s) - { +public final class Local extends Mode { + private Local(String s) { super (s); } - native Termios set (Termios termios, boolean on); - native boolean get (Termios termios); - public static Local[] getModes () - { + native void set(long termios, boolean on); + native boolean get(long termios); + public static Local[] getModes() { return (Local[]) (getStaticMembers (Local.class) .toArray (new Local[0])); } diff --git a/frysk-sys/frysk/sys/termios/Mode.java b/frysk-sys/frysk/sys/termios/Mode.java index dc1df92..194de4c 100644 --- a/frysk-sys/frysk/sys/termios/Mode.java +++ b/frysk-sys/frysk/sys/termios/Mode.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -48,36 +48,30 @@ import java.util.Iterator; /** * Termios modes. */ -abstract class Mode -{ - protected Mode () - { +abstract class Mode { + protected Mode() { throw new RuntimeException ("should not be creating an empty mode"); } protected final String on; - protected Mode (String on) - { + protected Mode(String on) { this.on = on; } - public String toString () - { + public String toString() { return on; } - public String toString (Termios termios) - { - if (get (termios)) + public String toString(Termios termios) { + if (termios.get(this)) return on; else return "-" + on; } - abstract Termios set (Termios termios, boolean on); - abstract boolean get (Termios termios); + abstract void set(long termios, boolean on); + abstract boolean get(long termios); /** * Return a linked list of the objects static Fields. */ - static final List getStaticFields (Class c) - { + static final List getStaticFields(Class c) { List staticFields = new LinkedList (); Field[] fields = c.getFields (); for (int i = 0; i < fields.length; i++) { @@ -92,8 +86,7 @@ abstract class Mode /** * Return a linked list of the classes static members. */ - static final List getStaticMembers (Class c) - { + static final List getStaticMembers(Class c) { List members = new LinkedList (); try { for (Iterator i = getStaticFields (c).iterator (); @@ -102,8 +95,7 @@ abstract class Mode Object o = field.get (null); members.add (o); } - } - catch (java.lang.IllegalAccessException e) { + } catch (java.lang.IllegalAccessException e) { throw new RuntimeException (e); } return members; diff --git a/frysk-sys/frysk/sys/termios/Output.java b/frysk-sys/frysk/sys/termios/Output.java index 4908619..b0bb645 100644 --- a/frysk-sys/frysk/sys/termios/Output.java +++ b/frysk-sys/frysk/sys/termios/Output.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -42,17 +42,10 @@ package frysk.sys.termios; /** * Output modes. */ -public final class Output - extends Mode -{ -// private Output (String on) -// { -// super (on); -// } - native Termios set (Termios termios, boolean on); - native boolean get (Termios termios); - public static Output[] getModes () - { +public final class Output extends Mode { + native void set(long termios, boolean on); + native boolean get(long termios); + public static Output[] getModes() { return (Output[]) (getStaticMembers (Output.class) .toArray (new Output[0])); } diff --git a/frysk-sys/frysk/sys/termios/Special.java b/frysk-sys/frysk/sys/termios/Special.java index 3927fcc..9222426 100644 --- a/frysk-sys/frysk/sys/termios/Special.java +++ b/frysk-sys/frysk/sys/termios/Special.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -43,31 +43,25 @@ package frysk.sys.termios; * Special characters and values. */ -public abstract class Special -{ +public abstract class Special { protected final String prefix; - private Special (String prefix) - { + private Special(String prefix) { this.prefix = prefix; } - public String toString () - { + public String toString() { return prefix; } - public abstract String toString (Termios termios); - native Termios set (Termios termios, char val); - native char get (Termios termios); - public static Special[] getSpecials () - { + public abstract String toString(Termios termios); + native void set(long termios, char val); + native char get(long termios); + public static Special[] getSpecials() { return (Special[]) (Mode.getStaticMembers (Special.class) .toArray (new Special[0])); } public static final Special NON_CANONICAL_READ_MINIMUM - = new Special ("min") - { - public String toString (Termios termios) - { - return prefix + " = " + (int) get (termios); - } - }; + = new Special("min") { + public String toString(Termios termios) { + return prefix + " = " + (int) termios.get(this); + } + }; } diff --git a/frysk-sys/frysk/sys/termios/Speed.java b/frysk-sys/frysk/sys/termios/Speed.java index 66eea18..e0ac0f7 100644 --- a/frysk-sys/frysk/sys/termios/Speed.java +++ b/frysk-sys/frysk/sys/termios/Speed.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -45,37 +45,30 @@ import java.util.List; /** * Manipulates a terminal bound to FileDescriptor. */ -public class Speed - implements Comparable -{ +public class Speed implements Comparable { final int b; - private Speed (int b) - { + private Speed(int b) { this.b = b; } - public String toString () - { + public String toString() { return "" + b; } - public boolean equals (Object o) - { + public boolean equals(Object o) { return (o instanceof Speed) && ((Speed)o).b == b; } - public int compareTo (Object rhs) - { + public int compareTo(Object rhs) { return this.b - ((Speed)rhs).b; } public static final Speed BAUD_0 = new Speed (0); public static final Speed BAUD_9600 = new Speed (9600); public static final Speed BAUD_38400 = new Speed (38400); - static public final Speed[] getSpeeds () - { - List speeds = Mode.getStaticMembers (Speed.class); + static public final Speed[] getSpeeds() { + List speeds = Mode.getStaticMembers(Speed.class); Collections.sort (speeds); - return (Speed[]) speeds.toArray (new Speed[0]); + return (Speed[]) speeds.toArray(new Speed[0]); } - native Termios set (Termios termios); - static native Speed getInput (Termios termios); - static native Speed getOutput (Termios termios); + native void set(long termios); + static native Speed getInput(long termios); + static native Speed getOutput(long termios); } diff --git a/frysk-sys/frysk/sys/termios/Termios.java b/frysk-sys/frysk/sys/termios/Termios.java index 47072c7..af3898f 100644 --- a/frysk-sys/frysk/sys/termios/Termios.java +++ b/frysk-sys/frysk/sys/termios/Termios.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -39,106 +39,122 @@ package frysk.sys.termios; -import gnu.gcj.RawDataManaged; import frysk.sys.FileDescriptor; /** * Manipulates a terminal bound to FileDescriptor. */ -public final class Termios -{ - private native RawDataManaged malloc(); - final RawDataManaged termios = malloc (); // package readable. +public final class Termios { + private native long malloc(); + private native void free(long termios); + private long termios = malloc(); + protected void finalize() { + if (termios != 0) { + free(termios); + termios = 0; + } + } - public Termios () - { + public Termios() { } - public Termios (FileDescriptor fd) - { - this (); - get (fd); + public Termios(FileDescriptor fd) { + this(); + get(fd); } /** * Refresh this Termios with the terminal settings from FD. */ - public native Termios get (FileDescriptor fd); + public Termios get(FileDescriptor fd) { + get(termios, fd.getFd()); + return this; + } + private static native void get(long termios, int fd); /** * Set FD's terminal settings. */ - public native Termios set (FileDescriptor fd, Action action); + public Termios set(FileDescriptor fd, Action action) { + set(termios, fd.getFd(), action); + return this; + } + private static native void set(long termios, int fd, Action action); /** * Set FD's terminal settings. */ - public Termios set (FileDescriptor fd) - { - return set (fd, Action.NOW); + public Termios set(FileDescriptor fd) { + return set(fd, Action.NOW); } /** * Enable or disable a mode. */ - public Termios set (Mode mode, boolean on) - { - return mode.set (this, on); + public Termios set(Mode mode, boolean on) { + mode.set(termios, on); + return this; } /** * Get a mode. */ - public boolean get (Mode mode) - { - return mode.get (this); + public boolean get(Mode mode) { + return mode.get(termios); } /** * Set the speed of input and output in baud. */ - public Termios set (Speed speed) - { - return speed.set (this); + public Termios set(Speed speed) { + speed.set(termios); + return this; } /** * Get the input speed in baud. */ - public Speed getInputSpeed () - { - return Speed.getInput (this); + public Speed getInputSpeed() { + return Speed.getInput(termios); } /** * Get the output speed in baud. */ - public Speed getOutputSpeed () - { - return Speed.getOutput (this); + public Speed getOutputSpeed() { + return Speed.getOutput(termios); } /** hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-05-14 20:52 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080514205209.9656.qmail@sourceware.org \ --to=cagney@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).