rescode
Version:
Generate Codes (EAN13, QRCODE ..)
286 lines (285 loc) • 12 kB
JavaScript
var BWIPJS = require("../bwip.js");
// file: bwipp/symbol.js
//
// This code was automatically generated from:
// Barcode Writer in Pure PostScript - Version 2013-01-25
//
// Copyright (c) 2011-2013 Mark Warren
// Copyright (c) 2004-2013 Terry Burton
//
// See the LICENSE file in the bwip.js root directory
// for the extended copyright notice.
// BEGIN symbol
if (!BWIPJS.bwipp["renlinear"]) BWIPJS.load("bwipp/renlinear.js");
BWIPJS.bwipp["symbol"]=function() {
this.dict["renlinear"]=BWIPJS.bwipp["renlinear"];
function $f0(){
return -1;
}
function $f1(){
var t=this.stk[this.ptr-2]; this.stk[this.ptr-2]=this.stk[this.ptr-1]; this.stk[this.ptr-1]=t;
this.ptr--;
var t=this.stk[this.ptr-2]; this.stk[this.ptr-2]=this.stk[this.ptr-1]; this.stk[this.ptr-1]=t;
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
}
function $f2(){
this.stk[this.ptr++]=true;
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
}
function $f3(){
var a=/^\s*([^\s]+)(\s+.*)?$/.exec(this.stk[this.ptr-1]);
if (a) {
this.stk[this.ptr-1]=BWIPJS.psstring(a[2]===undefined?"":a[2]);
this.stk[this.ptr++]=BWIPJS.psstring(a[1]);
this.stk[this.ptr++]=true;
} else {
this.stk[this.ptr-1]=false;
}
this.stk[this.ptr++]=false;
if (this.stk[this.ptr-2] instanceof BWIPJS.psstring)
this.stk[this.ptr-2]=this.stk[this.ptr-2].toString()==this.stk[this.ptr-1];
else this.stk[this.ptr-2]=this.stk[this.ptr-2]==this.stk[this.ptr-1];
this.ptr--;
this.stk[this.ptr++]=$f0;
var t0=this.stk[--this.ptr];
if (this.stk[--this.ptr]) {
if (t0.call(this)==-1) return -1;
}
this.stk[this.ptr]=this.stk[this.ptr-1]; this.ptr++;
if (typeof(this.stk[this.ptr-1].length)!=="number") throw "length: invalid: " + BWIPJS.pstype(this.stk[this.ptr-1]);
this.stk[this.ptr-1]=this.stk[this.ptr-1].length;
this.stk[this.ptr-1]=BWIPJS.psstring(this.stk[this.ptr-1]);
var t=this.stk[this.ptr-2].toString();
this.stk[this.ptr-1].assign(0,t);
this.stk[this.ptr-2]=this.stk[this.ptr-1].subset(0,t.length);
this.ptr--;
this.stk[this.ptr++]=BWIPJS.psstring("=");
var h=this.stk[this.ptr-2];
var t=h.indexOf(this.stk[this.ptr-1]);
if (t==-1) {
this.stk[this.ptr-1]=false;
} else {
this.stk[this.ptr-2]=h.subset(t+this.stk[this.ptr-1].length);
this.stk[this.ptr-1]=h.subset(t,this.stk[this.ptr-1].length);
this.stk[this.ptr++]=h.subset(0,t);
this.stk[this.ptr++]=true;
}
this.stk[this.ptr++]=true;
if (this.stk[this.ptr-2] instanceof BWIPJS.psstring)
this.stk[this.ptr-2]=this.stk[this.ptr-2].toString()==this.stk[this.ptr-1];
else this.stk[this.ptr-2]=this.stk[this.ptr-2]==this.stk[this.ptr-1];
this.ptr--;
this.stk[this.ptr++]=$f1;
this.stk[this.ptr++]=$f2;
var t1=this.stk[--this.ptr];
var t2=this.stk[--this.ptr];
if (this.stk[--this.ptr]) {
if (t2.call(this)==-1) return -1;
} else {
if (t1.call(this)==-1) return -1;
}
}
function $f4(){
this.stk[this.ptr++]=1;
this.stk[this.ptr-1]={};
this.dict=this.stk[--this.ptr]; this.dstk.push(this.dict);
var t=this.dstk.get("options");
if (t===undefined) throw new Error("dict: options: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr++]=$f3;
var t3=this.stk[--this.ptr];
while (true) {
if (t3.call(this)==-1) break;
}
this.stk[this.ptr++]=this.dict;
this.dstk.pop(); this.dict=this.dstk[this.dstk.length-1];
this.stk[this.ptr++]="options"; //ident
var t=this.stk[this.ptr-2]; this.stk[this.ptr-2]=this.stk[this.ptr-1]; this.stk[this.ptr-1]=t;
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
}
function $f5(){
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
}
function $f6(){
this.stk[this.ptr++]="sbs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([2.25,2.25,2.25,11.25,2.25,11.25,2.25,2.25,2.25]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="bhs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([0.625,0.625,0.625,0.625,0.625]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="bbs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([0,0,0,0,0]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
}
function $f7(){
this.stk[this.ptr++]="sbs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([2.25,6.75,2.25,2.25,2.25,6.25,2.25,2.25,2.25,6.75,2.25]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="bhs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([0.625,0.625,0.625,0.625,0.625,0.625]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="bbs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([0,0,0,0,0,0]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
}
function $f8(){
this.stk[this.ptr++]="sbs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([2.25,2.25,2.25,6.75,2.25,6.75,2.25,6.75,2.25,2.25,2.25]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="bhs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([0.625,0.625,0.625,0.625,0.625,0.625]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="bbs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([0,0,0,0,0,0]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
}
function $f9(){
this.stk[this.ptr++]="sbs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([2.25,2.25,2.25,2.25,2.25,6.75,2.25,6.75,2.25,2.25,2.25,2.25,2.25]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="bhs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([0.625,0.625,0.625,0.625,0.625,0.625,0.625]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="bbs"; //ident
this.stk[this.ptr++]=BWIPJS.psarray([0,0,0,0,0,0,0]);
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
}
this.stk[this.ptr++]=20;
this.stk[this.ptr-1]={};
this.dict=this.stk[--this.ptr]; this.dstk.push(this.dict);
this.stk[this.ptr++]="options"; //ident
var t=this.stk[this.ptr-2]; this.stk[this.ptr-2]=this.stk[this.ptr-1]; this.stk[this.ptr-1]=t;
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="barcode"; //ident
var t=this.stk[this.ptr-2]; this.stk[this.ptr-2]=this.stk[this.ptr-1]; this.stk[this.ptr-1]=t;
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
this.stk[this.ptr++]="dontdraw"; //ident
this.stk[this.ptr++]=false;
this.dict[this.stk[this.ptr-2]]=this.stk[this.ptr-1]; this.ptr-=2;
var t=this.dstk.get("options");
if (t===undefined) throw new Error("dict: options: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr-1]=BWIPJS.pstype(this.stk[this.ptr-1]);
this.stk[this.ptr++]="stringtype"; //ident
if (this.stk[this.ptr-2] instanceof BWIPJS.psstring)
this.stk[this.ptr-2]=this.stk[this.ptr-2].toString()==this.stk[this.ptr-1];
else this.stk[this.ptr-2]=this.stk[this.ptr-2]==this.stk[this.ptr-1];
this.ptr--;
this.stk[this.ptr++]=$f4;
var t4=this.stk[--this.ptr];
if (this.stk[--this.ptr]) {
if (t4.call(this)==-1) return -1;
}
var t=this.dstk.get("options");
if (t===undefined) throw new Error("dict: options: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr++]=$f5;
var t7=this.stk[--this.ptr];
var t6=this.stk[--this.ptr];
for (t5 in t6) {
if (t6 instanceof BWIPJS.psstring || t6 instanceof BWIPJS.psarray) {
if (t5.charCodeAt(0) > 57) continue;
this.stk[this.ptr++]=t6.get(t5);
} else {
this.stk[this.ptr++]=t5;
this.stk[this.ptr++]=t6[t5];
}
if (t7.call(this)==-1) break;
}
var t=this.dstk.get("barcode");
if (t===undefined) throw new Error("dict: barcode: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr++]=BWIPJS.psstring("fima");
if (this.stk[this.ptr-2] instanceof BWIPJS.psstring)
this.stk[this.ptr-2]=this.stk[this.ptr-2].toString()==this.stk[this.ptr-1];
else this.stk[this.ptr-2]=this.stk[this.ptr-2]==this.stk[this.ptr-1];
this.ptr--;
this.stk[this.ptr++]=$f6;
var t8=this.stk[--this.ptr];
if (this.stk[--this.ptr]) {
if (t8.call(this)==-1) return -1;
}
var t=this.dstk.get("barcode");
if (t===undefined) throw new Error("dict: barcode: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr++]=BWIPJS.psstring("fimb");
if (this.stk[this.ptr-2] instanceof BWIPJS.psstring)
this.stk[this.ptr-2]=this.stk[this.ptr-2].toString()==this.stk[this.ptr-1];
else this.stk[this.ptr-2]=this.stk[this.ptr-2]==this.stk[this.ptr-1];
this.ptr--;
this.stk[this.ptr++]=$f7;
var t9=this.stk[--this.ptr];
if (this.stk[--this.ptr]) {
if (t9.call(this)==-1) return -1;
}
var t=this.dstk.get("barcode");
if (t===undefined) throw new Error("dict: barcode: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr++]=BWIPJS.psstring("fimc");
if (this.stk[this.ptr-2] instanceof BWIPJS.psstring)
this.stk[this.ptr-2]=this.stk[this.ptr-2].toString()==this.stk[this.ptr-1];
else this.stk[this.ptr-2]=this.stk[this.ptr-2]==this.stk[this.ptr-1];
this.ptr--;
this.stk[this.ptr++]=$f8;
var t10=this.stk[--this.ptr];
if (this.stk[--this.ptr]) {
if (t10.call(this)==-1) return -1;
}
var t=this.dstk.get("barcode");
if (t===undefined) throw new Error("dict: barcode: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr++]=BWIPJS.psstring("fimd");
if (this.stk[this.ptr-2] instanceof BWIPJS.psstring)
this.stk[this.ptr-2]=this.stk[this.ptr-2].toString()==this.stk[this.ptr-1];
else this.stk[this.ptr-2]=this.stk[this.ptr-2]==this.stk[this.ptr-1];
this.ptr--;
this.stk[this.ptr++]=$f9;
var t11=this.stk[--this.ptr];
if (this.stk[--this.ptr]) {
if (t11.call(this)==-1) return -1;
}
this.stk[this.ptr++]=Infinity;
this.stk[this.ptr++]="ren"; //ident
var t=this.dstk.get("renlinear");
if (t===undefined) throw new Error("//renlinear: undefined");
this.stk[this.ptr++]=t;
this.stk[this.ptr++]="sbs"; //ident
var t=this.dstk.get("sbs");
if (t===undefined) throw new Error("dict: sbs: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr++]="bhs"; //ident
var t=this.dstk.get("bhs");
if (t===undefined) throw new Error("dict: bhs: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr++]="bbs"; //ident
var t=this.dstk.get("bbs");
if (t===undefined) throw new Error("dict: bbs: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
this.stk[this.ptr++]="opt"; //ident
var t=this.dstk.get("options");
if (t===undefined) throw new Error("dict: options: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
var t = {};
for (var i = this.ptr-1; i >= 1 && this.stk[i] !== Infinity; i-=2) {
if (this.stk[i-1] === Infinity) throw "dict: malformed stack";
t[this.stk[i-1]]=this.stk[i];
}
if (i < 0 || this.stk[i]!==Infinity) throw "dict: underflow";
this.ptr = i;
this.stk[this.ptr++]=t;
var t=this.dstk.get("dontdraw");
if (t===undefined) throw new Error("dict: dontdraw: undefined");
if (t instanceof Function) t.call(this); else this.stk[this.ptr++]=t;
if (typeof(this.stk[this.ptr-1])=="boolean") this.stk[this.ptr-1]=!this.stk[this.ptr-1];
else this.stk[this.ptr-1]=~this.stk[this.ptr-1];
var t=this.dstk.get("renlinear");
if (t===undefined) throw new Error("//renlinear: undefined");
this.stk[this.ptr++]=t;
var t12=this.stk[--this.ptr];
if (this.stk[--this.ptr]) {
if (t12.call(this)==-1) return -1;
}
this.dstk.pop(); this.dict=this.dstk[this.dstk.length-1];
psstptr = this.ptr;
}
// END OF symbol