DECLARE FUNCTION code128(startcode AS INTEGER,tekstin AS STRING) AS STRING
FUNCTION code128(startcode AS INTEGER,tekstin AS STRING) AS STRING
DIM bcode(0 TO 106) AS STRING*11
DIM barlengte AS INTEGER
DIM barchar AS INTEGER
DIM weight AS INTEGER
DIM CHK AS INTEGER
DIM CHECKSUM AS INTEGER
DIM BITMAP AS STRING
DIM X AS INTEGER
BCode(0) = "11011001100"
BCode(1) = "11001101100"
BCode(2) = "11001100110"
BCode(3) = "10010011000"
BCode(4) = "10010001100"
BCode(5) = "10001001100"
BCode(6) = "10011001000"
BCode(7) = "10011000100"
BCode(8) = "10001100100"
BCode(9) = "11001001000"
BCode(10) = "11001000100"
BCode(11) = "11000100100"
BCode(12) = "10110011100"
BCode(13) = "10011011100"
BCode(14) = "10011001110"
BCode(15) = "10111001100"
BCode(16) = "10011101100"
BCode(17) = "10011100110"
BCode(18) = "11001110010"
BCode(19) = "11001011100"
BCode(20) = "11001001110"
BCode(21) = "11011100100"
BCode(22) = "11001110100"
BCode(23) = "11101101110"
BCode(24) = "11101001100"
BCode(25) = "11100101100"
BCode(26) = "11100100110"
BCode(27) = "11101100100"
BCode(28) = "11100110100"
BCode(29) = "11100110010"
BCode(30) = "11011011000"
BCode(31) = "11011000110"
BCode(32) = "11000110110"
BCode(33) = "10100011000"
BCode(34) = "10001011000"
BCode(35) = "10001000110"
BCode(36) = "10110001000"
BCode(37) = "10001101000"
BCode(38) = "10001100010"
BCode(39) = "11010001000"
BCode(40) = "11000101000"
BCode(41) = "11000100010"
BCode(42) = "10110111000"
BCode(43) = "10110001110"
BCode(44) = "10001101110"
BCode(45) = "10111011000"
BCode(46) = "10111000110"
BCode(47) = "10001110110"
BCode(48) = "11101110110"
BCode(49) = "11010001110"
BCode(50) = "11000101110"
BCode(51) = "11011101000"
BCode(52) = "11011100010"
BCode(53) = "11011101110"
BCode(54) = "11101011000"
BCode(55) = "11101000110"
BCode(56) = "11100010110"
BCode(57) = "11101101000"
BCode(58) = "11101100010"
BCode(59) = "11100011010"
BCode(60) = "11101111010"
BCode(61) = "11001000010"
BCode(62) = "11110001010"
BCode(63) = "10100110000"
BCode(64) = "10100001100"
BCode(65) = "10010110000"
BCode(66) = "10010000110"
BCode(67) = "10000101100"
BCode(68) = "10000100110"
BCode(69) = "10110010000"
BCode(70) = "10110000100"
BCode(71) = "10011010000"
BCode(72) = "10011000010"
BCode(73) = "10000110100"
BCode(74) = "10000110010"
BCode(75) = "11000010010"
BCode(76) = "11001010000"
BCode(77) = "11110111010"
BCode(78) = "11000010100"
BCode(79) = "10001111010"
BCode(80) = "10100111100"
BCode(81) = "10010111100"
BCode(82) = "10010011110"
BCode(83) = "10111100100"
BCode(84) = "10011110100"
BCode(85) = "10011110010"
BCode(86) = "11110100100"
BCode(87) = "11110010100"
BCode(88) = "11110010010"
BCode(89) = "11011011110"
BCode(90) = "11011110110"
BCode(91) = "11110110110"
BCode(92) = "10101111000"
BCode(93) = "10100011110"
BCode(94) = "10001011110"
BCode(95) = "10111101000"
BCode(96) = "10111100010"
BCode(97) = "11110101000"
BCode(98) = "11110100010"
BCode(99) = "10111011110"
BCode(100) = "10111101110"
BCode(101) = "11101011110"
BCode(102) = "11110101110"
BCode(103) = "11010000100"
BCode(104) = "11010010000"
BCode(105) = "11010011100"
BCode(106) = "11000111010"
barlengte=LEN(tekstin)
FOR x = 1 TO barlengte
barchar=ASC(MID$(tekstin,x,1))-32
weight=barchar*x
CHK=CHK + weight
NEXT x
CHK=CHK + startcode
CHECKSUM=CHK MOD 103
barlengte=LEN(tekstin)
FOR x = 1 TO barlengte
barchar=ASC(MID$(tekstin,x,1))-32
BITMAP=BITMAP+BCODE(BARCHAR)
NEXT x
code128= BCODE(STARTCODE)+BITMAP+BCODE(CHECKSUM)+BCODE(106)+"11"
END FUNCTION
|