Package: barcode
Version: 0.98-1
Followup-For: Bug #320908

I worked a bit at this and figured out what it was.  The codabar support dose
not include the T, N, *, and E characters.  The patch adds these characters.

Also, the old behavior was to assume that the barcode begins with A and ends
with B.  Most examples I've seen online seem to imply that T should be the
default end, so the patch changes the default ending from B to T.
--- barcode-0.98/codabar.c.old	2000-11-08 12:13:27.000000000 -0500
+++ barcode-0.98/codabar.c	2005-08-02 01:17:18.000000000 -0500
@@ -29,10 +29,11 @@
 
 /* this is ordered in decades to simplify encoding */
 static char alphabet[] = 
-   "0123456789" "-$:/.+ABCD";
+   "0123456789" "-$:/.+ABCDTN*E";
 
 #define CODE_A	16
 #define CODE_B	17
+#define CODE_T	20
 
 #define NARROW	12
 #define WIDE	14
@@ -42,7 +43,8 @@
 "1111133","1111331","1113113","3311111","1131131",
 "3111131","1311113","1311311","1331111","3113111",
 "1113311","1133111","3111313","3131113","3131311",
-"1131313","1133131","1313113","1113133","1113331" };
+"1131313","1133131","1313113","1113133","1113331",
+"1133131","1313113","1113133","1113331"};
 
 /*
  * Check that the text can be encoded. Returns 0 or -1.
@@ -167,13 +169,13 @@
     }
     if (!startpresent) {
 	if (usesum) {
-	    /* if no start character specified, B is used as a stop char */
-	    checksum += CODE_B;
+	    /* if no start character specified, T is used as a stop char */
+	    checksum += CODE_T;
 	    checksum = (checksum + 15) / 16 * 16 - checksum;
 	    add_one(ptr, checksum);
 	    ptr += strlen(ptr);
 	}
-	add_one(ptr, CODE_B);
+	add_one(ptr, CODE_T);
     }
     bc->partial = partial;
     bc->textinfo = textinfo;

Reply via email to