aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/encoding/compression/lzw.js
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
commit1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch)
tree3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojox/encoding/compression/lzw.js
parent104d59099e048688c4dbac37d72137006e396558 (diff)
downloadsemanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz
semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.bz2
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/encoding/compression/lzw.js')
-rw-r--r--includes/js/dojox/encoding/compression/lzw.js91
1 files changed, 0 insertions, 91 deletions
diff --git a/includes/js/dojox/encoding/compression/lzw.js b/includes/js/dojox/encoding/compression/lzw.js
deleted file mode 100644
index 5e0cca7..0000000
--- a/includes/js/dojox/encoding/compression/lzw.js
+++ /dev/null
@@ -1,91 +0,0 @@
-if(!dojo._hasResource["dojox.encoding.compression.lzw"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.encoding.compression.lzw"] = true;
-dojo.provide("dojox.encoding.compression.lzw");
-dojo.require("dojox.encoding.bits");
-
-(function(){
- var _bits = function(x){
- var w = 1;
- for(var v = 2; x >= v; v <<= 1, ++w);
- return w;
- };
-
- dojox.encoding.compression.lzw.Encoder = function(n){
- this.size = n;
- this.init();
- };
-
- dojo.extend(dojox.encoding.compression.lzw.Encoder, {
- init: function(){
- this.dict = {};
- for(var i = 0; i < this.size; ++i){
- this.dict[String.fromCharCode(i)] = i;
- }
- this.width = _bits(this.code = this.size);
- this.p = "";
- },
- encode: function(value, stream){
- var c = String.fromCharCode(value), p = this.p + c, r = 0;
- // if already in the dictionary
- if(p in this.dict){
- this.p = p;
- return r;
- }
- stream.putBits(this.dict[this.p], this.width);
- // if we need to increase the code length
- if((this.code & (this.code + 1)) == 0){
- stream.putBits(this.code++, r = this.width++);
- }
- // add new string
- this.dict[p] = this.code++;
- this.p = c;
- return r + this.width;
- },
- flush: function(stream){
- if(this.p.length == 0){
- return 0;
- }
- stream.putBits(this.dict[this.p], this.width);
- this.p = "";
- return this.width;
- }
- });
-
- dojox.encoding.compression.lzw.Decoder = function(n){
- this.size = n;
- this.init();
- };
-
- dojo.extend(dojox.encoding.compression.lzw.Decoder, {
- init: function(){
- this.codes = new Array(this.size);
- for(var i = 0; i < this.size; ++i){
- this.codes[i] = String.fromCharCode(i);
- }
- this.width = _bits(this.size);
- this.p = -1;
- },
- decode: function(stream){
- var c = stream.getBits(this.width), v;
- if(c < this.codes.length){
- v = this.codes[c];
- if(this.p >= 0){
- this.codes.push(this.codes[this.p] + v.substr(0, 1));
- }
- }else{
- if((c & (c + 1)) == 0){
- this.codes.push("");
- ++this.width;
- return "";
- }
- var x = this.codes[this.p];
- v = x + x.substr(0, 1);
- this.codes.push(v);
- }
- this.p = c;
- return v;
- }
- });
-})();
-
-}