Merge changes Icaf1ef7f,I979c222a,I9e05ee0b,I798a4707,I7732f3ec

* changes:
  Add options to PrologMain to emulate usage in Gerrit
  Cleanup formatting of PrologMain
  Correct usage for cafeteria java_binary()
  Remove version from PrologMain header
  Add missing fake_pom_deploy.xml required by buck build deploy
diff --git a/src/lang/Trail.java b/src/lang/Trail.java
index a782781..e354650 100644
--- a/src/lang/Trail.java
+++ b/src/lang/Trail.java
@@ -1,4 +1,5 @@
 package com.googlecode.prolog_cafe.lang;
+
 /**
  * Trail stack.<br>
  * The class <code>Trail</code> represents a trail stack.<br>
@@ -10,76 +11,80 @@
  * @version 1.0
  */
 public final class Trail {
-    /** An array of <code>Undoable</code> entries. */
-    private Undoable[] buffer;
+  /** An array of <code>Undoable</code> entries. */
+  private Undoable[] buffer;
 
-    /** the top index of this <code>Trail</code>. */
-    private int top;
+  /** the top index of this <code>Trail</code>. */
+  private int top;
 
-    /** Current timestamp of the top of {@link ChoicePointStack}. */
-    long timeStamp;
+  /** Current timestamp of the top of {@link ChoicePointStack}. */
+  long timeStamp;
 
-    /** Constructs a new trail stack. */
-    public Trail() {
-	this(20000);
+  /** Constructs a new trail stack. */
+  public Trail() {
+    this(100);
+  }
+
+  /** Constructs a new trail stack with the given size. */
+  public Trail(int n) {
+    buffer = new Undoable[n];
+    top = -1;
+  }
+
+  /** Discards all entries. */
+  public void init() {
+    deleteAll();
+  }
+
+  /** Pushes an entry to this <code>Trail</code>. */
+  public void push(Undoable t) {
+    if (++top >= buffer.length) {
+      int len = buffer.length;
+      Undoable[] new_buffer = new Undoable[2 * len];
+      System.arraycopy(buffer, 0, new_buffer, 0, len);
+      buffer = new_buffer;
     }
+    buffer[top] = t;
+  }
 
-    /** Constructs a new trail stack with the given size. */
-    public Trail(int n) {
-	buffer = new Undoable[n];
-	top = -1;
+  /** Pops an entry from this <code>Trail</code>. */
+  public Undoable pop() {
+    Undoable t = buffer[top];
+    buffer[top--] = null;
+    return t;
+  }
+
+  /** Discards all entries. */
+  protected void deleteAll() {
+    while (!empty()) {
+      buffer[top--] = null;
     }
+  }
 
-    /** Discards all entries. */
-    public void init() { deleteAll(); }
+  /** Tests if this stack has no entry. */
+  public boolean empty() {
+    return top == -1;
+  }
 
-    /** Pushs an entry to this <code>Trail</code>. */
-    public void push(Undoable t) {
-	try {
-	    buffer[++top] = t;
-	} catch (ArrayIndexOutOfBoundsException e) {
-	    int len = buffer.length;
-	    Undoable[] new_buffer = new Undoable[len+20000];
-		System.arraycopy(buffer, 0, new_buffer, 0, len);
-	    buffer = new_buffer;
-	    buffer[top] = t;
-	}
+  /** Current allocation of the trail storage array.  */
+  public int max() {
+    return buffer.length;
+  }
+
+  /** Returns the value of <code>top</code>.
+   * @see #top
+   */
+  public int top() {
+    return top;
+  }
+
+  /** Unwinds all entries after the value of <code>i</code>. */
+  public void unwind(int i) {
+    Undoable t;
+    while (top > i) {
+      t = pop();
+      t.undo();
     }
-
-    /** Pops an entry from this <code>Trail</code>. */
-    public Undoable pop() {
-	Undoable t = buffer[top];
-	buffer[top--] = null;
-	return t;
-    }
-
-    /** Discards all entries. */
-    protected void deleteAll() {
-	while (! empty()) {
-	    buffer[top--] = null;
-	}	
-    }
-
-    /** Tests if this stack has no entry. */
-    public boolean empty() {
-	return top == -1;
-    }
-
-    /** Current allocation of the trail storage array.  */
-    public int max() { return buffer.length; }
-
-    /** Returns the value of <code>top</code>. 
-     * @see #top
-     */
-    public int top() { return top; }
-
-    /** Unwinds all entries after the value of <code>i</code>. */
-    public void unwind(int i) {
-	Undoable t;
-	while (top > i) {
-	    t = pop();
-	    t.undo();
-	}
-    }
+  }
 }