[e-cvs] cvs commit: e/src/jsrc/org/erights/e/ui/jed EAction.java

markm@eros.cs.jhu.edu markm@eros.cs.jhu.edu
Sun, 23 Sep 2001 06:46:16 -0400


markm       01/09/23 06:46:16

  Modified:    src/jsrc/org/erights/e/elang/syntax ELexer.java
               src/jsrc/org/erights/e/ui/jed EAction.java
  Log:
  more bug fixes

Revision  Changes    Path
1.54      +14 -5     e/src/jsrc/org/erights/e/elang/syntax/ELexer.java

Index: ELexer.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/syntax/ELexer.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- ELexer.java	2001/09/23 05:14:48	1.53
+++ ELexer.java	2001/09/23 10:46:16	1.54
@@ -388,6 +388,7 @@
         }
         return true;
     }
+
     /**
      *
      */
@@ -556,6 +557,10 @@
                     nextChar();
                     syntaxError("Token \"*->\" is reserved");
                     return null; //keep compiler happy
+                } else if (myChar == '/') {
+                    nextChar();
+                    syntaxError("'/*..*/' comments are reserved. " +
+                                "Use '#' or '//' on each line instead");
                 }
                 return new Token(endToken(), '*');
             } case '/': {
@@ -563,12 +568,16 @@
                 if (myChar == '=') {
                     nextChar();
                     return new Token(endToken(), EParser.OpAssAprxDiv);
-                } else if (myChar != '/') {
-                    return new Token(endToken(), '/');
+                } else if (myChar == '/') {
+                    // Skip comment to end of line
+                    skipLine();
+                    return new Token(endToken(), EParser.EOL);
+                } else if (myChar == '*') {
+                    nextChar();
+                    syntaxError("'/*..*/' comments are reserved. " +
+                                "Use '#' or '//' on each line instead");
                 }
-                // Skip comment to end of line
-                skipLine();
-                return new Token(endToken(), EParser.EOL);
+                return new Token(endToken(), '/');
             } case '#': {
                 // Skip comment to end of line (as in "//" case above).
                 skipLine();



1.9       +19 -47    e/src/jsrc/org/erights/e/ui/jed/EAction.java

Index: EAction.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/ui/jed/EAction.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- EAction.java	2001/09/07 18:11:42	1.8
+++ EAction.java	2001/09/23 10:46:16	1.9
@@ -25,6 +25,7 @@
 import org.erights.e.develop.format.StringHelper;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.prim.Runner;
+import org.erights.e.elib.prim.E;
 import org.erights.e.elib.tables.IntTable;
 
 import javax.swing.AbstractAction;
@@ -50,21 +51,8 @@
  * "Save &As" to set the Name ("Save As"), action Verb ("doSaveAs"), and
  * mnemonic ('A').
  * <p>
- * The actual action represented by an EAction is the sending of a message
- * (verb and arguments) to a recipient.  An EAction remembers the vat it was
- * created in.  When invoked (actionPerformed), it does the does this
- * eventual send in its creation vat.
- * <p>
- * The E-language programmer must use an EAction in order to "implement" an
- * {@link javax.swing.Action}, rather than implement Action directly, as
- * Action violates the {@link org.erights.e.elib.deflect.EventualDeflector}
- * rules -- it defines methods that have non-void return types.  EAction is
- * therefore an adaptor between the Swing world and the E world.  It should
- * be thought of as an object that lives in the Swing world (and hence uses
- * <code>synchronized</code> to be thread safe), but knows how to call-back
- * (or rather, send-back) into the E world. As part of the Swing world, it
- * also uses to conventional, but dirty and dangerous, practice of
- * synchronizing on 'this' rather than an encapsulated internal lock.
+ * The actual action represented by an EAction is the eventual sending of a
+ * message (verb and arguments) to a recipient.
  *
  * @author Mark S. Miller
  */
@@ -88,15 +76,6 @@
     }
 
     /**
-     * Since we don't do anything special, on revival this will be null,
-     * which will render it inoperative. <p>
-     *
-     * XXX As with Deflectors, it would be good to fix this so it revives
-     * properly.
-     */
-    private transient Runner myRunner;
-
-    /**
      * The recipient of the myVerb(myArgs...) message
      */
     private Object myRecip;
@@ -115,9 +94,7 @@
      * When created this way, it's useless until parameterized with the
      * property setting methods.
      */
-    public EAction() {
-        myRunner = Runner.currentRunner();
-    }
+    public EAction() {}
 
     /**
      * Creates an action with a name, verb, and mnemonic derived from desc,
@@ -200,7 +177,7 @@
      * For example, 'ea setDesc(foo, "Save &As")' will set the name to "Save
      * As", the mnemonic 'A', and the action to be invoked to 'foo <- doSaveAs()'.
      */
-    public synchronized void setDesc(Object recip, String desc) {
+    public void setDesc(Object recip, String desc) {
         setName(descToName(desc));
         setAction(recip, descToVerb(desc));
         int mnemonic = descToMnemonic(desc);
@@ -212,14 +189,10 @@
     /**
      * Invoked by Swing then the EAction's action should be invoked.  <p>
      *
-     * Does a sendOnly of 'recip <- verb(args...)' in the vat which created
-     * this EAction.
+     * Does a sendOnly of 'recip <- verb(args...)'
      */
-    public synchronized void actionPerformed(ActionEvent e) {
-        if (null == myRunner) {
-            throw new RuntimeException("EActions do not survive revival");
-        }
-        myRunner.sendAllOnly(myRecip, myVerb, myArgs);
+    public void actionPerformed(ActionEvent e) {
+        E.sendAllOnly(myRecip, myVerb, myArgs);
     }
 
     /**
@@ -240,7 +213,7 @@
     /**
      * Sets the action to 'recip <- verb(args...)'
      */
-    public synchronized void setAction(Object recip, String verb, Object[] args) {
+    public void setAction(Object recip, String verb, Object[] args) {
         myRecip = recip;
         myVerb = verb;
         myArgs = args;
@@ -249,14 +222,14 @@
     /**
      * Actually gets the AbstractAction's ACCELERATOR_KEY property.
      */
-    public synchronized KeyStroke getAccelerator() {
+    public KeyStroke getAccelerator() {
         return (KeyStroke)getValue(ACCELERATOR_KEY);
     }
 
     /**
      * Actually sets the AbstractAction's ACCELERATOR_KEY property.
      */
-    public synchronized void setAccelerator(KeyStroke newKey) {
+    public void setAccelerator(KeyStroke newKey) {
         putValue(ACCELERATOR_KEY, newKey);
     }
 
@@ -299,21 +272,21 @@
     /**
      * Actually gets the AbstractAction's NAME property.
      */
-    public synchronized String getName() {
+    public String getName() {
         return (String)getValue(NAME);
     }
 
     /**
      * Actually sets the AbstractAction's NAME property.
      */
-    public synchronized void setName(String newName) {
+    public void setName(String newName) {
         putValue(NAME, newName);
     }
 
     /**
      * Actually gets the AbstractAction's MNEMONIC_KEY property.
      */
-    public synchronized int getMnemonic() {
+    public int getMnemonic() {
         Object val = getValue(MNEMONIC_KEY);
         if (null == val) {
             return -1;
@@ -325,7 +298,7 @@
     /**
      * Actually sets the AbstractAction's MNEMONIC_KEY property.
      */
-    public synchronized void setMnemonic(int newMnemonic) {
+    public void setMnemonic(int newMnemonic) {
         if (-1 == newMnemonic) {
             putValue(MNEMONIC_KEY, null);
         } else {
@@ -336,22 +309,21 @@
     /**
      * Actually gets the AbstractAction's SHORT_DESCRIPTION property.
      */
-    public synchronized String getTip() {
+    public String getTip() {
         return (String)getValue(SHORT_DESCRIPTION);
     }
 
     /**
      * Actually sets the AbstractAction's SHORT_DESCRIPTION property.
      */
-    public synchronized void setTip(String newTip) {
+    public void setTip(String newTip) {
         putValue(SHORT_DESCRIPTION, newTip);
     }
 
     /**
-     * This method is purely for use from the E world, but it's synchronized
-     * since it accesses state that may be mutated by either world.
+     *
      */
-    public synchronized void printOn(TextWriter out) throws IOException {
+    public void printOn(TextWriter out) throws IOException {
         out.print("<- ", myVerb);
         Object[] keys = getKeys();
         if (null == keys) {