Category : Printer Utilities
Archive   : BCTEXT.ZIP
Filename : BCTEXT.BAS

 
Output of file : BCTEXT.BAS contained in archive : BCTEXT.ZIP

PRINT " BCTEXT - v1.00"
' Universal 3 of 9 barcode program using all text characters
PRINT by; JAMES; R; BURKS; II; 6 / 24 / 1992
PRINT " ÝÞÞÝÛÞÞÞÝÝÞÞÝÛ ÝÝÝÛÞÝÝÝÛ ÝÛÞÞÞ ÛÞÞÝÝÛ ÝÝÞÞÝÛÞ"
PRINT
PRINT "Copyright (c) 1992 Delphis Data Systems"
'
'capture command line input
comlin$ = COMMAND$
'call sub to parse command line into TOCODE$ (the text to code 3 of 9)
' POSBC (the number of spaces to positon )
' PRTMOD$ (HP or IBM/EPSON FLAG )
GOSUB parse
'
'call barcode routine that produces BARCODE$
GOSUB barcodeit

'print barcode$ & ctlcodes
IF posbc = 0 THEN posbc = 1
LPRINT CHR$(13) + cpi10$
LPRINT compres$ + STRING$(posbc, 32); lpi8$ + barcode$
LPRINT STRING$(posbc, 32) + barcode$ + lpi6$

'print text that was barcoded under barcode
LPRINT STRING$(posbc, 32) + cpi10$ + bartext$

'end of programm
END



barcodeit:

'this routine creates a 3 dimentional look up table
' the table is 44x3 (if converted to a file this would be 44
' records of 3 fields each).
' Element 1 = the ASCII Character that the CODE represents
' Element 2 = THE 3 of 9 image using text BLOCK GRAPHICS
' bb=SOLID BLACK CHAR. Û
' ww=SOLID white CHAR.
' bw=First-half white Sec-half black char.Þ
' bw=First-half black Sec-half white char.Ý
' Element 3 = THE 3 of 9 image shifted 1/2 char left
' the first narrow black line is cut off and
' a narrow white line added to the end.

' this is neccessary to generate the narrow white inter character gap
' required for 3 of 9 coding.
' a WB (Þ) character is added after all element 2 codes (except the
' stop character), and this forms the first black bar of the next
' character (which will be an element 3 code). The element 3 code has
' an extra narrow white bar on the end which is the inter character gap
' between the next character (back to element 2 codes).
' this alternating pattern is then repeted for the whole code sequence
' with ODD position characters receiving an addional WB added to them
'
' ie: ÝÞÞÝÛÞÞÞÝÝÞÞÝÛ ÝÝÝÛÞÝÝÝÛ ÝÛÞÞÞ ÛÞÞÝÝÛ ÝÝÞÞÝÛÞ
' * B U R K S *
' table element 2 3 2 3 2 3 2
'  = wb (Þ) character inserted for gap
'
'
'
'
'
'
'
'if the table has already been initialized do not re-initializeit
IF bb$ = CHR$(219) AND ww$ = CHR$(32) THEN GOTO noinitbc
'
'
' initlize table
bb$ = CHR$(219): ww$ = CHR$(32): bw$ = CHR$(221): WB$ = CHR$(222)
DIM bc$(45, 3)
bc$(1, 1) = "1": bc$(1, 2) = bb$ + WB$ + ww$ + bw$ + bw$ + bb$
bc$(1, 3) = bw$ + bw$ + WB$ + WB$ + WB$ + bw$
bc$(2, 1) = "2": bc$(2, 2) = bw$ + bb$ + ww$ + bw$ + bw$ + bb$
bc$(2, 3) = WB$ + bw$ + WB$ + WB$ + WB$ + bw$
bc$(3, 1) = "3": bc$(3, 2) = bb$ + WB$ + bw$ + WB$ + WB$ + WB$
bc$(3, 3) = bw$ + bb$ + ww$ + bw$ + bw$ + bw$
bc$(4, 1) = "4": bc$(4, 2) = bw$ + bw$ + WB$ + bw$ + bw$ + bb$
bc$(4, 3) = WB$ + ww$ + bb$ + WB$ + WB$ + bw$
bc$(5, 1) = "5": bc$(5, 2) = bb$ + WB$ + ww$ + bb$ + WB$ + WB$
bc$(5, 3) = bw$ + bw$ + WB$ + bw$ + bw$ + bw$
bc$(6, 1) = "6": bc$(6, 2) = bw$ + bb$ + ww$ + bb$ + WB$ + WB$
bc$(6, 3) = WB$ + bw$ + WB$ + bw$ + bw$ + bw$
bc$(7, 1) = "7": bc$(7, 2) = bw$ + bw$ + WB$ + WB$ + bw$ + bb$
bc$(7, 3) = WB$ + ww$ + bw$ + bb$ + WB$ + bw$
bc$(8, 1) = "8": bc$(8, 2) = bb$ + WB$ + ww$ + bw$ + bb$ + WB$
bc$(8, 3) = bw$ + bw$ + WB$ + WB$ + bw$ + bw$
bc$(9, 1) = "9": bc$(9, 2) = bw$ + bb$ + ww$ + bw$ + bb$ + WB$
bc$(9, 3) = WB$ + bw$ + WB$ + WB$ + bw$ + bw$
bc$(10, 1) = "0": bc$(10, 2) = bw$ + bw$ + WB$ + bw$ + bb$ + WB$
bc$(10, 3) = WB$ + ww$ + bb$ + WB$ + bw$ + bw$
bc$(11, 1) = "A": bc$(11, 2) = bb$ + WB$ + WB$ + ww$ + bw$ + bb$
bc$(11, 3) = bw$ + bw$ + bw$ + WB$ + WB$ + bw$
bc$(12, 1) = "B": bc$(12, 2) = bw$ + bb$ + WB$ + ww$ + bw$ + bb$
bc$(12, 3) = WB$ + bw$ + bw$ + WB$ + WB$ + bw$
bc$(13, 1) = "C": bc$(13, 2) = bb$ + WB$ + bw$ + bw$ + WB$ + WB$
bc$(13, 3) = bw$ + bb$ + WB$ + ww$ + bw$ + bw$
bc$(14, 1) = "D": bc$(14, 2) = bw$ + bw$ + bb$ + ww$ + bw$ + bb$
bc$(14, 3) = WB$ + WB$ + bw$ + WB$ + WB$ + bw$
bc$(15, 1) = "E": bc$(15, 2) = bb$ + WB$ + WB$ + bw$ + WB$ + WB$
bc$(15, 3) = bw$ + bw$ + bb$ + ww$ + bw$ + bw$
bc$(16, 1) = "F": bc$(16, 2) = bw$ + bb$ + WB$ + bw$ + WB$ + WB$
bc$(16, 3) = WB$ + bw$ + bb$ + ww$ + bw$ + bw$
bc$(17, 1) = "G": bc$(17, 2) = bw$ + bw$ + bw$ + ww$ + bw$ + bb$
bc$(17, 3) = WB$ + WB$ + ww$ + WB$ + WB$ + bw$
bc$(18, 1) = "H": bc$(18, 2) = bb$ + WB$ + WB$ + ww$ + bb$ + WB$
bc$(18, 3) = bw$ + bw$ + bw$ + WB$ + bw$ + bw$
bc$(19, 1) = "I": bc$(19, 2) = bw$ + bb$ + WB$ + ww$ + bb$ + WB$
bc$(19, 3) = WB$ + bw$ + bw$ + WB$ + bw$ + bw$
bc$(20, 1) = "J": bc$(20, 2) = bw$ + bw$ + bb$ + ww$ + bb$ + WB$
bc$(20, 3) = WB$ + WB$ + bw$ + WB$ + bw$ + bw$
bc$(21, 1) = "K": bc$(21, 2) = bb$ + WB$ + WB$ + WB$ + ww$ + bb$
bc$(21, 3) = bw$ + bw$ + bw$ + bw$ + WB$ + bw$
bc$(22, 1) = "L": bc$(22, 2) = bw$ + bb$ + WB$ + WB$ + ww$ + bb$
bc$(22, 3) = WB$ + bw$ + bw$ + bw$ + WB$ + bw$
bc$(23, 1) = "M": bc$(23, 2) = bb$ + WB$ + WB$ + bw$ + bw$ + WB$
bc$(23, 3) = bw$ + bw$ + bb$ + WB$ + ww$ + bw$
bc$(24, 1) = "N": bc$(24, 2) = bw$ + bw$ + bw$ + WB$ + ww$ + bb$
bc$(24, 3) = WB$ + WB$ + ww$ + bw$ + WB$ + bw$
bc$(25, 1) = "O": bc$(25, 2) = bb$ + WB$ + bb$ + bw$ + bw$ + WB$
bc$(25, 3) = bw$ + bb$ + bb$ + WB$ + ww$ + bw$
bc$(26, 1) = "P": bc$(26, 2) = bw$ + bb$ + bb$ + bw$ + bw$ + WB$
bc$(26, 3) = WB$ + bb$ + bb$ + WB$ + ww$ + bw$
bc$(27, 1) = "Q": bc$(27, 2) = bw$ + bw$ + bw$ + bb$ + ww$ + bb$
bc$(27, 3) = WB$ + WB$ + WB$ + bw$ + WB$ + bw$
bc$(28, 1) = "R": bc$(28, 2) = bb$ + WB$ + WB$ + WB$ + bw$ + WB$
bc$(28, 3) = bw$ + bw$ + bw$ + bb$ + ww$ + bw$
bc$(29, 1) = "S": bc$(29, 2) = bw$ + bb$ + WB$ + WB$ + bw$ + WB$
bc$(29, 3) = WB$ + bw$ + bw$ + bb$ + ww$ + bw$
bc$(30, 1) = "T": bc$(30, 2) = bw$ + bw$ + bb$ + WB$ + bw$ + WB$
bc$(30, 3) = WB$ + WB$ + bw$ + bb$ + ww$ + bw$
bc$(31, 1) = "U": bc$(31, 2) = bb$ + ww$ + bw$ + bw$ + bw$ + bb$
bc$(31, 3) = bw$ + WB$ + WB$ + WB$ + WB$ + bw$
bc$(32, 1) = "V": bc$(32, 2) = bw$ + WB$ + WB$ + bw$ + bw$ + bb$
bc$(32, 3) = ww$ + bw$ + bb$ + WB$ + WB$ + bw$
bc$(33, 1) = "W": bc$(33, 2) = bb$ + ww$ + bb$ + WB$ + WB$ + WB$
bc$(33, 3) = bw$ + WB$ + bw$ + bw$ + bw$ + bw$
bc$(34, 1) = "X": bc$(34, 2) = bw$ + WB$ + WB$ + bw$ + bw$ + bb$
bc$(34, 3) = ww$ + bw$ + bb$ + WB$ + WB$ + bw$
bc$(35, 1) = "Y": bc$(35, 2) = bb$ + ww$ + bw$ + bb$ + WB$ + WB$
bc$(35, 3) = bw$ + WB$ + WB$ + bw$ + bw$ + bw$
bc$(36, 1) = "Z": bc$(36, 2) = bw$ + WB$ + bw$ + bb$ + WB$ + WB$
bc$(36, 3) = ww$ + bw$ + WB$ + bw$ + bw$ + bw$
bc$(37, 1) = "-": bc$(37, 2) = bw$ + WB$ + WB$ + WB$ + bw$ + bb$
bc$(37, 3) = ww$ + bw$ + bw$ + bb$ + WB$ + bw$
bc$(38, 1) = ".": bc$(38, 2) = bb$ + ww$ + bw$ + bw$ + bb$ + WB$
bc$(38, 3) = bw$ + WB$ + WB$ + WB$ + bw$ + bw$
bc$(39, 1) = " ": bc$(39, 2) = bw$ + WB$ + bw$ + bw$ + bb$ + WB$
bc$(39, 3) = ww$ + bb$ + WB$ + WB$ + bw$ + bw$
bc$(40, 1) = "*": bc$(40, 2) = bw$ + WB$ + WB$ + bw$ + bb$ + WB$
bc$(40, 3) = ww$ + bw$ + bb$ + WB$ + bw$ + bw$
bc$(41, 1) = "$": bc$(41, 2) = bw$ + WB$ + ww$ + bw$ + WB$ + WB$
bc$(41, 3) = ww$ + bw$ + WB$ + ww$ + bw$ + bw$
bc$(42, 1) = "/": bc$(42, 2) = bw$ + WB$ + ww$ + bw$ + bw$ + WB$
bc$(42, 3) = ww$ + bw$ + WB$ + WB$ + ww$ + bw$
bc$(43, 1) = "+": bc$(43, 2) = bw$ + WB$ + WB$ + ww$ + bw$ + WB$
bc$(43, 3) = ww$ + bw$ + bw$ + WB$ + ww$ + bw$
bc$(44, 1) = "%": bc$(44, 2) = bw$ + bw$ + WB$ + ww$ + bw$ + WB$
bc$(44, 3) = WB$ + ww$ + bw$ + WB$ + ww$ + bw$
noinitbc:
'
'
'
barcode$ = ""
'
' add start and stop characters to text to barcode
bartext$ = "*" + tocode$ + "*"
'
'
' For each character get the barcode equiv.
Lp = LEN(bartext$)
FOR x = 1 TO Lp
'
' look up source character from table
FOR y = 1 TO 44
IF MID$(bartext$, x, 1) = bc$(y, 1) THEN GOSUB addbc
NEXT y
'
' if character is in an odd position and, not the stop character,
' add a interrecord gap
IF x <> Lp AND x / 2 <> INT(x / 2) THEN barcode$ = barcode$ + WB$
NEXT x
RETURN


addbc:
'determine if element 2 or element 3 string is to be used
'
IF x / 2 <> INT(x / 2) THEN barcode$ = barcode$ + bc$(y, 2)
IF x / 2 = INT(x / 2) THEN barcode$ = barcode$ + bc$(y, 3)
RETURN

parse:
'
' format command line input into variables.
'
posbc = 0
qmflag = 0
FOR cllen = 1 TO LEN(comlin$)
IF MID$(comlin$, cllen, 1) = CHR$(34) THEN qmflag = qmflag + 1
IF qmflag = 1 AND MID$(comlin$, cllen, 1) <> CHR$(34) THEN tocode$ = tocode$ + MID$(comlin$, cllen, 1)
IF MID$(comlin$, cllen, 1) = "/" THEN op$ = MID$(comlin$, cllen + 1, 2): GOSUB chkop1: op$ = "": op = 0

NEXT cllen

IF qmflag < 2 THEN GOTO helplst
IF LEN(prtmod$) > 2 THEN prtmod$ = MID$(prtmod$, 1, 2)
IF prtmod$ = "HP" OR prtmod$ = "hp" THEN
compres$ = CHR$(27) + "(s30H"
cpi10$ = CHR$(27) + "(10U" + CHR$(27) + "(s10H"
lpi8$ = CHR$(27) + "&l8D"
lpi6$ = CHR$(27) + "&l6D"
ELSE
compres$ = CHR$(27) + CHR$(15)
cpi10$ = CHR$(18)
lpi8$ = CHR$(27) + "0"
lpi6$ = CHR$(27) + "2"
END IF
RETURN

chkop1:
IF op$ <> "HP" AND op$ <> "hp" AND posbc = 0 THEN posbc = VAL(op$)
IF op$ = "hp" OR op$ = "HP" THEN prtmod$ = "HP"
RETURN

helplst:
PRINT
PRINT " USAGE = BCTEXT "; CHR$(34); "text to be coded"; CHR$(34); " [/HP] [/n]"
PRINT
PRINT " text to be coded - must be enclosed in "; CHR$(34)
PRINT " /HP - parm is optional, it sets the spaceing ctl codes for a hp laserjet"
PRINT " default is for IBM/EPSON MODE, EPSON must be using GRAHPICS 1"
PRINT " or GRAPHICS 2 character set."
PRINT " /n - parm indicates the number of characters to the right to position BC"
END