Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Commit

Permalink
Applied various patches on ACE Build process, and Enabled brace-match…
Browse files Browse the repository at this point in the history
…ing by Chris Ball
  • Loading branch information
karteek committed Jan 7, 2010
1 parent a296bd1 commit b721a20
Show file tree
Hide file tree
Showing 26 changed files with 248 additions and 229 deletions.
12 changes: 6 additions & 6 deletions etherpad/src/etherpad/collab/ace/contentcollector.js
@@ -1,22 +1,22 @@
// DO NOT EDIT THIS FILE, edit infrastructure/ace/www/contentcollector.js
import("etherpad.collab.ace.easysync2.Changeset")

/**
* Copyright 2009 Google Inc.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// DO NOT EDIT THIS FILE, edit infrastructure/ace/www/contentcollector.js
import("etherpad.collab.ace.easysync2.Changeset")

var _MAX_LIST_LEVEL = 8;

function sanitizeUnicode(s) {
Expand Down
10 changes: 5 additions & 5 deletions etherpad/src/etherpad/collab/ace/domline.js
@@ -1,21 +1,21 @@
// DO NOT EDIT THIS FILE, edit infrastructure/ace/www/domline.js

/**
* Copyright 2009 Google Inc.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// DO NOT EDIT THIS FILE, edit infrastructure/ace/www/domline.js

var domline = {};
domline.noop = function() {};
domline.identity = function(x) { return x; };
Expand Down
74 changes: 37 additions & 37 deletions etherpad/src/etherpad/collab/ace/easysync1.js
@@ -1,21 +1,21 @@
// DO NOT EDIT THIS FILE, edit infrastructure/ace/www/easy_sync.js

/**
* Copyright 2009 Google Inc.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// DO NOT EDIT THIS FILE, edit infrastructure/ace/www/easy_sync.js

function Changeset(arg) {

var array;
Expand All @@ -38,7 +38,7 @@ function Changeset(arg) {
else array = arg;

array.isChangeset = true;

// OOP style: attach generic methods to array object, hold no state in environment

//function error(msg) { top.console.error(msg); top.console.trace(); }
Expand All @@ -51,7 +51,7 @@ function Changeset(arg) {
return this.length == 6 && this[1] == this[2] && this[3] == 0 &&
this[4] == this[1] && this[5] == "";
}

array.eachStrip = function(func, thisObj) {
// inside "func", the method receiver will be "this" by default,
// or you can pass an object.
Expand All @@ -66,7 +66,7 @@ function Changeset(arg) {
array.numStrips = function() { return (this.length-3)/3; };
array.oldLen = function() { return this[1]; };
array.newLen = function() { return this[2]; };

array.checkRep = function() {
assert(this[0] == Changeset.MAGIC, "bad magic");
assert(this[1] >= 0, "bad old text length");
Expand Down Expand Up @@ -97,7 +97,7 @@ function Changeset(arg) {
});
assert(newLen == actualNewLen, "calculated new text length doesn't match");
}

array.applyToText = function(text) {
assert(text.length == this.oldLen(), "mismatched apply: "+text.length+" / "+this.oldLen());
var buf = [];
Expand Down Expand Up @@ -139,7 +139,7 @@ function Changeset(arg) {
C.authors = [_getNumInserted(C), author || ''];
return C;
}

array.builder = function() {
// normal pattern is Changeset(oldLength).builder().appendOldText(...). ...
// builder methods mutate this!
Expand All @@ -166,7 +166,7 @@ function Changeset(arg) {
C.authors.push(str.length, a);
}
}

return self;
},
appendOldText: function(startIndex, numTaken) {
Expand All @@ -193,7 +193,7 @@ function Changeset(arg) {
array.authorSlicer = function(outputBuilder) {
return _makeAuthorSlicer(this, outputBuilder);
}

function _makeAuthorSlicer(changesetOrAuthorsIn, builderOut) {
// "builderOut" only needs to support appendNewText
var authors; // considered immutable
Expand All @@ -203,13 +203,13 @@ function Changeset(arg) {
else {
authors = changesetOrAuthorsIn;
}

// OOP style: state in environment
var authorPtr = 0;
var charIndex = 0;
var charWithinAuthor = 0; // 0 <= charWithinAuthor <= authors[authorPtr]; max value iff atEnd
var atEnd = false;
function curAuthor() { return authors[authorPtr+1]; }
function curAuthor() { return authors[authorPtr+1]; }
function curAuthorWidth() { return authors[authorPtr]; }
function assertNotAtEnd() { assert(! atEnd, "_authorSlicer: can't move past end"); }
function forwardInAuthor(numChars) {
Expand All @@ -225,7 +225,7 @@ function Changeset(arg) {
atEnd = true;
}
}

var self;
return self = {
skipChars: function(n) {
Expand Down Expand Up @@ -278,11 +278,11 @@ function Changeset(arg) {
}
};
}

function _makeSlicer(C, output) {
// C: Changeset, output: builder from _makeBuilder
// C is considered immutable, won't change or be changed

// OOP style: state in environment
var charIndex = 0; // 0 <= charIndex <= C.newLen(); maximum value iff atEnd
var stripIndex = 0; // 0 <= stripIndex <= C.numStrips(); maximum value iff atEnd
Expand All @@ -293,7 +293,7 @@ function Changeset(arg) {
if (C.authors) {
authorSlicer = _makeAuthorSlicer(C.authors, output);
}

var ptr = 3;
function curStartIndex() { return C[ptr]; }
function curNumTaken() { return C[ptr+1]; }
Expand Down Expand Up @@ -327,7 +327,7 @@ function Changeset(arg) {
if (e < s) return 0;
return e-s;
}

var self;
return self = {
skipChars: function (n) {
Expand All @@ -344,15 +344,15 @@ function Changeset(arg) {
if (authorSlicer)
authorSlicer.skipChars(curNumNewCharsInRange(charWithinStrip,
charWithinStrip + leftInStrip));

leftToSkip -= leftInStrip;
nextStrip();
}
else {
if (authorSlicer)
authorSlicer.skipChars(curNumNewCharsInRange(charWithinStrip,
charWithinStrip + leftToSkip));

forwardInStrip(leftToSkip);
leftToSkip = 0;
}
Expand All @@ -379,9 +379,9 @@ function Changeset(arg) {
charWithinStrip < curStripWidth()) {
// at least one char to take from current strip's newText
var leftInNewText = (curStripWidth() - charWithinStrip);
assert(leftInNewText > 0, "_slicer: should have leftInNewText > 0");
assert(leftInNewText > 0, "_slicer: should have leftInNewText > 0");
var toTake = min(leftInNewText, leftToTake);
assert(toTake > 0, "_slicer: should have toTake > 0");
assert(toTake > 0, "_slicer: should have toTake > 0");
var newText = curNewText().substr(charWithinStrip - curNumTaken(), toTake);
if (authorSlicer) {
authorSlicer.takeChars(newText.length, newText);
Expand All @@ -407,7 +407,7 @@ function Changeset(arg) {
array.slicer = function(outputBuilder) {
return _makeSlicer(this, outputBuilder);
}

array.compose = function(next) {
assert(next.oldLen() == this.newLen(), "mismatched composition");

Expand All @@ -418,7 +418,7 @@ function Changeset(arg) {
if (next.authors) {
authorSlicer = _makeAuthorSlicer(next.authors, builder);
}

next.eachStrip(function(s, t, n) {
slicer.skipTo(s);
slicer.takeChars(t);
Expand All @@ -436,7 +436,7 @@ function Changeset(arg) {
array.traverser = function() {
return _makeTraverser(this);
}

function _makeTraverser(C) {
var s = C[3], t = C[4], n = C[5];
var nextIndex = 6;
Expand All @@ -446,7 +446,7 @@ function Changeset(arg) {
if (C.authors) {
authorSlicer = _makeAuthorSlicer(C.authors, null);
}

function advanceIfPossible() {
if (t == 0 && n == "" && nextIndex < C.length) {
s = C[nextIndex];
Expand Down Expand Up @@ -561,7 +561,7 @@ function Changeset(arg) {
}
return builder.toChangeset();
}

array.encodeToString = function(asBinary) {
var stringDataArray = [];
var numsArray = [];
Expand All @@ -585,7 +585,7 @@ function Changeset(arg) {
return "\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4);
});
}

array.applyToAttributedText = Changeset.applyToAttributedText;

function splicesFromChanges(c) {
Expand Down Expand Up @@ -616,11 +616,11 @@ function Changeset(arg) {
}
return splices;
}

array.toSplices = function() {
return splicesFromChanges(this);
}

array.characterRangeFollowThis = function(selStartChar, selEndChar, insertionsAfter) {
var changeset = this;
// represent the selection as a changeset that replaces the selection with some finite string.
Expand Down Expand Up @@ -650,7 +650,7 @@ function Changeset(arg) {
}
return [selStartChar, selEndChar];
}

return array;
}

Expand All @@ -660,7 +660,7 @@ Changeset.makeSplice = function(oldLength, spliceStart, numRemoved, stringInsert
spliceStart = (spliceStart || 0);
numRemoved = (numRemoved || 0);
stringInserted = String(stringInserted || "");

var builder = Changeset(oldLength).builder();
builder.appendOldText(0, spliceStart);
builder.appendNewText(stringInserted);
Expand Down Expand Up @@ -688,7 +688,7 @@ Changeset.decodeFromString = function(str) {
return String.fromCharCode(Number("0x"+seq.substring(2)));
});
}

var numData, stringData;
var binary = false;
var typ = str.charAt(0);
Expand Down Expand Up @@ -765,7 +765,7 @@ Changeset.numberArrayFromString = function(str, startIndex) {
}
else {
// legacy format
n = (((n & 0x1fff) << 16) | str.charCodeAt(strIndex++));
n = (((n & 0x1fff) << 16) | str.charCodeAt(strIndex++));
}
}
return n;
Expand Down Expand Up @@ -805,7 +805,7 @@ Changeset.numberArrayFromString = function(str, startIndex) {
}
return 0;
}

// emptyObj may be a StorableObject
Changeset.initAttributedText = function(emptyObj, initialString, initialAuthor) {
var obj = emptyObj;
Expand Down Expand Up @@ -894,7 +894,7 @@ Changeset.numberArrayFromString = function(str, startIndex) {
// call func(author, authorNum)
for(var a in atObj.authorMap) {
if (func(atObj.authorMap[a], Number(a))) break;
}
}
};
Changeset.getAttributedTextAuthorByNum = function(atObj, n) {
return atObj.authorMap[n];
Expand Down
12 changes: 6 additions & 6 deletions etherpad/src/etherpad/collab/ace/easysync2.js
@@ -1,22 +1,22 @@
// DO NOT EDIT THIS FILE, edit infrastructure/ace/www/easysync2.js
jimport("com.etherpad.Easysync2Support");

/**
* Copyright 2009 Google Inc.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// DO NOT EDIT THIS FILE, edit infrastructure/ace/www/easysync2.js
jimport("com.etherpad.Easysync2Support");

//var _opt = (this.Easysync2Support || null);
var _opt = null; // disable optimization for now

Expand Down

0 comments on commit b721a20

Please sign in to comment.