DECLARE FUNCTION code93(tekst AS STRING) AS STRING
FUNCTION code93(tekst AS STRING) AS STRING
DIM bcode(0 TO 90) AS STRING*9
DIM barlengte AS INTEGER
DIM barchar AS INTEGER
DIM weight AS INTEGER
DIM CHK1 AS INTEGER
DIM CHK2 AS INTEGER
DIM BITMAP AS STRING
DIM X AS INTEGER
BCODE(32) ="111010010"
BCODE(33) =""
BCODE(34) =""
BCODE(35) =""
BCODE(36) ="111001010"
BCODE(37) ="110101110"
BCODE(38) =""
BCODE(39) =""
BCODE(40) =""
BCODE(41) =""
BCODE(42) ="101011110"
BCODE(43) ="101110110"
BCODE(44) =""
BCODE(45) ="100101110"
BCODE(46) ="111010100"
BCODE(47) ="101101110"
BCODE(48) ="100010100"
BCODE(49) ="101001000"
BCODE(50) ="101000100"
BCODE(51) ="101000010"
BCODE(52) ="100101000"
BCODE(53) ="100100100"
BCODE(54) ="100100010"
BCODE(55) ="101010000"
BCODE(56) ="100010010"
BCODE(57) ="100001010"
BCODE(58) =""
BCODE(59) =""
BCODE(60) =""
BCODE(61) =""
BCODE(62) =""
BCODE(63) =""
BCODE(64) =""
BCODE(65) ="110101000"
BCODE(66) ="110100100"
BCODE(67) ="110100010"
BCODE(68) ="110010100"
BCODE(69) ="110010010"
BCODE(70) ="110001010"
BCODE(71) ="101101000"
BCODE(72) ="101100100"
BCODE(73) ="101100010"
BCODE(74) ="100110100"
BCODE(75) ="100011010"
BCODE(76) ="101011000"
BCODE(77) ="101001100"
BCODE(78) ="101000110"
BCODE(79) ="100101100"
BCODE(80) ="100010110"
BCODE(81) ="110110100"
BCODE(82) ="110110010"
BCODE(83) ="110101100"
BCODE(84) ="110100110"
BCODE(85) ="110010110"
BCODE(86) ="110011010"
BCODE(87) ="101101100"
BCODE(88) ="101100110"
BCODE(89) ="100110110"
BCODE(90) ="100111010"
barlengte=LEN(tekst)
FOR x = 1 TO barlengte
barchar=ASC(MID$(tekst,BARLENGTE,1))
SELECT CASE barchar
CASE 65 TO 90
barchar=barchar-55
CASE 48 TO 57
barchar=barchar-48
CASE 47
barchar=barchar-7
CASE 45 TO 46
barchar=barchar-9
CASE 43
barchar=barchar-2
CASE 37
barchar=barchar+5
CASE 36
barchar=barchar+3
CASE 32
barchar=barchar+6
END SELECT
weight=barchar*x
CHK1=CHK1 + weight
BARLENGTE=BARLENGTE-1
NEXT x
CHK1=CHK1 MOD 47
SELECT CASE chk1
CASE 10 TO 35
chk1=chk1+55
CASE 0 TO 9
chk1=chk1+48
CASE 40
chk1=chk1+7
CASE 36 TO 37
chk1=chk1+9
CASE 41
chk1=chk1+2
CASE 42
chk1=chk1-5
CASE 39
chk1=chk1-3
CASE 38
chk1=chk1-6
END SELECT
TEKST=TEKST +CHR$(CHK1)
barlengte=LEN(tekst)
FOR x = 1 TO barlengte
barchar=ASC(MID$(tekst,BARLENGTE,1))
SELECT CASE barchar
CASE 65 TO 90
barchar=barchar-55
CASE 48 TO 57
barchar=barchar-48
CASE 47
barchar=barchar-7
CASE 45 TO 46
barchar=barchar-9
CASE 43
barchar=barchar-2
CASE 37
barchar=barchar+5
CASE 36
barchar=barchar+3
CASE 32
barchar=barchar+6
END SELECT
weight=barchar*x
CHK2=CHK2 + weight
BARLENGTE=BARLENGTE-1
NEXT x
CHK2=CHK2 MOD 47
SELECT CASE chk2
CASE 10 TO 35
chk2=chk2+55
CASE 0 TO 9
chk2=chk2+48
CASE 40
chk2=chk2+7
CASE 36 TO 37
chk2=chk2+9
CASE 41
chk2=chk1+2
CASE 42
chk2=chk2-5
CASE 39
chk2=chk2-3
CASE 38
chk2=chk2-6
END SELECT
TEKST = "*" + tekst + CHR$(CHK2) + "*"
PRINT TEKST
barlengte=LEN(tekst)
FOR x = 1 TO barlengte
barchar=ASC(MID$(tekst,x,1))
BITMAP=BITMAP+BCODE(BARCHAR)
NEXT x
code93= BITMAP + "1"
END FUNCTION
|