diff -ur --new-file barcode-0.94/.backupdate barcode-0.95/.backupdate
--- barcode-0.94/.backupdate Sun Oct 24 13:10:56 1999
+++ barcode-0.95/.backupdate Thu Jan 1 01:00:00 1970
@@ -1 +0,0 @@
-Sun Oct 24 13:10:56 MEST 1999
diff -ur --new-file barcode-0.94/ChangeLog barcode-0.95/ChangeLog
--- barcode-0.94/ChangeLog Sun Oct 24 12:50:37 1999
+++ barcode-0.95/ChangeLog Thu Feb 3 19:48:15 2000
@@ -1,3 +1,33 @@
+2000-02-03 Alessandro Rubini
+
+====> Version 0.95 released to ftp.prosa.it and ftp.gnu.org
+
+2000-01-26 Alessandro Rubini
+
+ * code128.c (Barcode_128_encode): new encoding: full-featured code128
+
+ * README: added reference to original ftp site
+
+2000-01-05 Alessandro Rubini
+
+ * main.c (get_page_geometry): avoid using snprintf(), missing in HP/UX
+
+ * code39.c (Barcode_39_verify): added missing parens (a syntax error,
+ but only apparent where islower() is not a macro). Thanks to
+ Alexandre Oliva for finding it out.
+
+2000-01-04 Alessandro Rubini
+
+ * doc/doc.barcode (The API): removed spurious "flags" argument
+ from description of Barcode_Encode_and_Print().
+ Thanks to Willy Wittesaele for noting the error.
+
+1999-12-24 Alessandro Rubini
+
+ * main.c (get_geometry): fixed the y margin (thanks to Steve Kunath)
+
+====> Version 0.94 released to ftp.prosa.it and ftp.gnu.org
+
1999-10-24 Alessandro Rubini
* INSTALL: added instructions to install on a Debian GNU/Linux system
diff -ur --new-file barcode-0.94/INSTALL barcode-0.95/INSTALL
--- barcode-0.94/INSTALL Sun Oct 24 12:50:21 1999
+++ barcode-0.95/INSTALL Thu Feb 3 19:49:47 2000
@@ -26,6 +26,6 @@
Then, just install using dpkg:
- dpkg -i ../barcode-0.94_*.deb
+ dpkg -i ../barcode-0.95_*.deb
(the "*" here will represent your architecture: "i386", "alpha", "sparc", ...)
diff -ur --new-file barcode-0.94/Makefile.in barcode-0.95/Makefile.in
--- barcode-0.94/Makefile.in Sun Oct 24 12:59:55 1999
+++ barcode-0.95/Makefile.in Thu Feb 3 20:43:30 2000
@@ -100,7 +100,15 @@
depend: .depend
tar:
- n=`basename \`/bin/pwd\``; cd ..; tar cvf - $$n | gzip > $$n.tar.gz
+ @if [ "x" = "x$(RELEASE)" ]; then \
+ n=`basename \`pwd\``; cd ..; tar cvf - $$n | gzip > $$n.tar.gz; \
+ echo 'you can set a numeric $$(RELEASE) to make a named tar'; \
+ else \
+ mkdir ../$(TARGET)-$(RELEASE) || exit 1; \
+ cp -a . ../$(TARGET)-$(RELEASE) && cd .. && \
+ tar --exclude '*/CVS*' \
+ -cvzf $(TARGET)-$(RELEASE).tar.gz $(TARGET)-$(RELEASE); \
+ fi
# print the version, as I usually forget to update it when distributing
printv:
diff -ur --new-file barcode-0.94/README barcode-0.95/README
--- barcode-0.94/README Sun Oct 24 12:52:11 1999
+++ barcode-0.95/README Wed Feb 2 16:51:30 2000
@@ -1,5 +1,7 @@
-This is GNU-barcode.
+This is GNU-barcode. The latest release can be downloaded from ftp.gnu.org
+and mirrors:
+ ftp://ftp.gnu.org/pub/gnu/barcode/
The package is meant to solve most needs in barcode creation with a
conventional printer. It can create printouts for the conventional
@@ -33,5 +35,10 @@
(mcm@glisco.it) for their help with this tool, as well as Jim Westveer
for introducing me to Debian packaging.
-/alessandro (rubini@prosa.it, rubini@gnu.org)
+There is a mailing list where development is coordinated, called
+barcode@prosa.it . To get subscribed you should
+ echo subscribe | mail barcode-request@prosa.it
+or anything equivalent.
+
+/alessandro (rubini@gnu.org)
diff -ur --new-file barcode-0.94/TODO barcode-0.95/TODO
--- barcode-0.94/TODO Sun Sep 26 14:50:46 1999
+++ barcode-0.95/TODO Wed Jan 26 22:06:21 2000
@@ -3,10 +3,6 @@
* verbose mode, printing position information to stderr
-* code 128 (a) support
-
- The code can represent ascii 0-96 (control chars, no lowercase)
-
* shrink the bars to account for ink spreading
Currently, small barcodes don't get rendered well. While
@@ -19,6 +15,7 @@
* document how a new encoding standard can be added
-* include the debian/ directory by Jim Westveer as soon as it is ready for prime time
+* add Barcode_String, which has been contributed
+* EAN128 (as agreed with Dani Pardo)
diff -ur --new-file barcode-0.94/barcode.h barcode-0.95/barcode.h
--- barcode-0.94/barcode.h Sun Oct 24 00:57:10 1999
+++ barcode-0.95/barcode.h Mon Jan 24 13:17:20 2000
@@ -1,7 +1,7 @@
/*
* barcode.h -- definitions for libbarcode
*
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
@@ -24,8 +24,8 @@
#include
-#define BARCODE_VERSION "0.94"
-#define BARCODE_VERSION_INT 9400
+#define BARCODE_VERSION "0.95"
+#define BARCODE_VERSION_INT 9500
/*
* The object
@@ -63,7 +63,7 @@
BARCODE_UPC, /* upc == 12-digit ean */
BARCODE_ISBN, /* isbn numbers (still EAN13) */
BARCODE_39, /* code 39 */
- BARCODE_128, /* code 128 (a,b) */
+ BARCODE_128, /* code 128 (a,b,c: autoselection) */
BARCODE_128C, /* code 128 (compact form for digits) */
BARCODE_128B, /* code 128, full printable ascii */
BARCODE_I25 /* interleaved 2 of 5 (only digits) */
diff -ur --new-file barcode-0.94/cmdline.c barcode-0.95/cmdline.c
--- barcode-0.94/cmdline.c Sun Sep 26 15:05:32 1999
+++ barcode-0.95/cmdline.c Mon Jan 24 13:17:20 2000
@@ -1,7 +1,7 @@
/*
* cmdline.c -- parse a command line using getopt, environment and defaults
*
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
diff -ur --new-file barcode-0.94/cmdline.h barcode-0.95/cmdline.h
--- barcode-0.94/cmdline.h Wed Jun 30 14:14:35 1999
+++ barcode-0.95/cmdline.h Mon Jan 24 13:17:19 2000
@@ -1,7 +1,7 @@
/*
* cmdline.h -- generic commandline editing (uses getopt, only short)
*
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
diff -ur --new-file barcode-0.94/code128.c barcode-0.95/code128.c
--- barcode-0.94/code128.c Wed Oct 13 08:35:29 1999
+++ barcode-0.95/code128.c Wed Jan 26 16:52:24 2000
@@ -1,7 +1,7 @@
/*
* code128.c -- encoding for code128 (A, B, C)
*
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
@@ -240,5 +240,259 @@
bc->partial = partial;
bc->textinfo = textinfo;
+ return 0;
+}
+
+/*
+ * generic (full-featured) code128 implementation: it selects between
+ * A, B, C according to the data being encoded. F1, F2, F3, F4 are expressed
+ * using ascii chars 0xc1, 0xc2, 0xc3, 0xc4 (0301, 0302, 0303, 0304).
+ * Char '\0' is expressed by 0x80 (0200).
+ */
+
+int Barcode_128_verify(unsigned char *text)
+{
+ if (!strlen(text))
+ return -1;
+ while (*text && (*text<=0x80 || (*text >= 0xc1 && *text <= 0xc4)))
+ text++;
+ if (*text)
+ return -1; /* unencodable character */
+ return 0; /* ok */
+}
+
+
+/*
+ * These functions are extracted from Barcode_128_encode for clarity.
+ * It deals with choosing the symbols used to represent the text
+ * and returns a dynamic array of integers, terminated by -1.
+ *
+ * The algorithm used in choosing the codes comes from App 2 of
+ * "El Codigo Estandar EAN/UCC 128", courtesy of AECOC, Spain.
+ * Thanks to Dani Pardo for getting permission and giving me a copy
+ * of the document
+ */
+
+#define NEED_CODE_A(c) ((c)<32 || (c)==0x80)
+#define NEED_CODE_B(c) ((c)>=96 && (c)<128)
+
+static int Barcode_a_or_b(unsigned char *text)
+{
+ for ( ; *text; text++) {
+ if (NEED_CODE_A(*text))
+ return 'A';
+ if (NEED_CODE_B(*text))
+ return 'B';
+ }
+ return 0; /* any */
+}
+
+static int Barcode_encode_as(int code, int value)
+{
+ /* code is either 'A' or 'B', and value must be valid */
+ if (value >= 0x20 && value <= 0x5F)
+ return value - 0x20; /* both codes */
+ if (value == 0x80) return 64; /* code A */
+ if (value < 0x20) return value+64; /* code A */
+ if (value >= 0x60) return value - 0x20; /* code B */
+ if (value == 0xC1) return FUNC_1;
+ if (value == 0xC2) return FUNC_2;
+ if (value == 0xC3) return FUNC_3;
+ if (value == 0xC4) { /* F4 */
+ if (code == 'A') return CODE_A;
+ return CODE_B;
+ }
+ /* can't happen */
+ return -1;
+}
+
+static int *Barcode_128_make_array(struct Barcode_Item *bc, int *lptr)
+{
+ int len, *codes;
+ unsigned char *s;
+ int i=0, j, code, checksum;
+
+ /* allocate twice the text length + 5, as this is the worst case */
+ len = 2 * strlen(bc->ascii) + 5;
+ codes = malloc(len * sizeof(int));
+ s = bc->ascii;
+
+ /* choose the starting code */
+ if (isdigit(s[0]) && isdigit(s[1]) && isdigit(s[2]) && isdigit(s[3])) {
+ code = 'C';
+ } else {
+ code = Barcode_a_or_b(s);
+ if (!code) code = 'B'; /* default */
+ }
+ codes[i++] = START_A + code - 'A';
+
+ for (s = bc->ascii; *s; /* increments are in the loop */) {
+ switch(code) {
+
+ case 'C':
+ if (s[0] == 0xC1) { /* F1 is valid */
+ codes[i++] = FUNC_1;
+ s++;
+ } else if (isdigit(s[0]) && isdigit(s[1])) {
+ /* encode two digits */
+ codes[i++] = (s[0]-'0') * 10 + s[1]-'0';
+ s += 2;
+ } else {
+ /* change code */
+ code = Barcode_a_or_b(s);
+ if (!code) code = 'B';
+ codes[i++] = (code == 'A') ? CODE_A : CODE_B;
+ }
+ break;
+
+ case 'B':
+ case 'A':
+ for (j=0; isdigit(s[j]); j++)
+ ;
+ if (j>=4) { /* if there are 4 or more digits, turn to C */
+ if (j&1) {
+ /* odd number: encode one first */
+ codes[i++] = *(s++) - ' ';
+ }
+ codes[i++] = CODE_C;
+ code = 'C';
+ } else if (code == 'A' && NEED_CODE_B(*s)) {
+ /* check whether we should use SHIFT or change code */
+ j = Barcode_a_or_b(s+1);
+ if (j == 'B') {
+ codes[i++] = CODE_B;
+ code = 'B';
+ } else {
+ codes[i++] = SHIFT;
+ codes[i++] = Barcode_encode_as('B', *s);
+ s++;
+ }
+ } else if (code == 'B' && NEED_CODE_A(*s)) {
+ /* check whether we should use SHIFT or change code */
+ j = Barcode_a_or_b(s+1);
+ if (j == 'A') {
+ codes[i++] = CODE_A;
+ code = 'A';
+ } else {
+ codes[i++] = SHIFT;
+ codes[i++] = Barcode_encode_as('A', *s);
+ s++;
+ }
+ } else {
+ codes[i++] = Barcode_encode_as(code, *s);
+ s++;
+ }
+ break;
+ }
+ }
+ /* add the checksum */
+ checksum = codes[0];
+ for (j=1; j len) {
+ fprintf(stderr, "impossible: length is > allocated len\n");
+ }
+ *lptr = i;
+ return codes;
+}
+
+/*
+ * Encoding is tricky, in that we cannot print the ascii
+ * representation in an easy way. Therefore, just skip non-printable
+ * chars and try to fit the rest somehow.
+ */
+int Barcode_128_encode(struct Barcode_Item *bc)
+{
+ static char *text;
+ static char *partial; /* dynamic */
+ static char *textinfo; /* dynamic */
+ char *textptr;
+ int *codes; /* dynamic */
+ int i, c, len;
+ double textpos, size, step;
+
+ if (bc->partial)
+ free(bc->partial);
+ if (bc->textinfo)
+ free(bc->textinfo);
+ bc->partial = bc->textinfo = NULL; /* safe */
+
+ if (!bc->encoding)
+ bc->encoding = strdup("code 128");
+
+ text = bc->ascii;
+ if (!text) {
+ bc->error = EINVAL;
+ return -1;
+ }
+
+ codes = Barcode_128_make_array(bc, &len);
+ if (!codes) return -1;
+
+ for (i=0; ierror = errno;
+ free(codes);
+ return -1;
+ }
+
+ /* the text information is at most "nnn.n:ff.f:c " * strlen +term */
+ textptr = textinfo = malloc(13*strlen(text) + 2);
+ if (!textinfo) {
+ bc->error = errno;
+ free(partial);
+ free(codes);
+ return -1;
+ }
+
+ /* up to now, it was almost the same code as other encodings */
+
+ strcpy(partial, "0"); /* the first space */
+ for (i=0; i 12.0) size = 12.0;
+
+ /* align the text to the left, using its natural size */
+ step = (int)(10 * (size/18.0 * SYMBOL_WID) + .5) / 10.0;
+ textpos = SYMBOL_WID;
+ fprintf(stderr, "size %g, step %g\n", size, step);
+
+ for (i=0; i 0xc0) c = ' '; /* F code */
+ sprintf(textptr, "%g:%g:%c ", textpos, size, c);
+ textptr += strlen(textptr);
+ textpos += step;
+ }
+ fprintf(stderr, "text %s\n", textinfo);
+
+ bc->partial = partial;
+ bc->textinfo = textinfo;
+ free(codes);
return 0;
}
diff -ur --new-file barcode-0.94/code39.c barcode-0.95/code39.c
--- barcode-0.94/code39.c Fri Aug 6 12:03:26 1999
+++ barcode-0.95/code39.c Mon Jan 24 13:17:18 2000
@@ -1,7 +1,7 @@
/*
* code39.c -- encoding for code39
*
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
@@ -68,8 +68,8 @@
if (!strlen(text))
return -1;
for (i=0; text[i]; i++) {
- if isupper(text[i]) upper++;
- if islower(text[i]) lower++;
+ if (isupper(text[i])) upper++;
+ if (islower(text[i])) lower++;
if (!strchr(alphabet,toupper(text[i])))
return -1;
}
diff -ur --new-file barcode-0.94/debian/changelog barcode-0.95/debian/changelog
--- barcode-0.94/debian/changelog Sun Oct 24 01:15:53 1999
+++ barcode-0.95/debian/changelog Thu Feb 3 21:17:39 2000
@@ -1,3 +1,9 @@
+barcode (0.95) unstable; urgency=low
+
+ * New upstream release
+
+ -- Alessandro Rubini Thu, 3 Feb 2000 21:16:59 +0200
+
barcode (0.94) unstable; urgency=low
* Initial Release.
diff -ur --new-file barcode-0.94/debian/files barcode-0.95/debian/files
--- barcode-0.94/debian/files Thu Jan 1 01:00:00 1970
+++ barcode-0.95/debian/files Thu Feb 3 20:18:08 2000
@@ -0,0 +1 @@
+barcode_0.95_i386.deb misc optional
diff -ur --new-file barcode-0.94/debian/substvars barcode-0.95/debian/substvars
--- barcode-0.94/debian/substvars Thu Jan 1 01:00:00 1970
+++ barcode-0.95/debian/substvars Fri Nov 26 10:45:15 1999
@@ -0,0 +1 @@
+shlibs:Depends=libc6, libpaperg (>= 1.0.3-4)
diff -ur --new-file barcode-0.94/doc/barcode.html barcode-0.95/doc/barcode.html
--- barcode-0.94/doc/barcode.html Sun Oct 24 12:28:02 1999
+++ barcode-0.95/doc/barcode.html Thu Feb 3 20:38:02 2000
@@ -1,15 +1,15 @@
+ from barcode.texinfo on 3 Febuary 2000 -->
Barcode
-barcode 0.94
+barcode 0.95
A library for drawing bar codes
-October 1999
-by Alessandro Rubini (rubini@{gnu.org,prosa.it})
+January 2000
+by Alessandro Rubini (rubini@gnu.org)
@@ -60,7 +60,7 @@
int flags; /* type of encoding and other flags */
char *ascii; /* malloced */
char *partial; /* malloced too */
- char *textinfo; /* information about text positioning */
+ char *textinfo; /* information about text placement */
char *encoding; /* code name, filled by encoding engine */
int width, height; /* output units */
int xoff, yoff; /* output units */
@@ -207,7 +207,7 @@
-The following flags are supported by version 0.94 of the
+The following flags are supported by version 0.95 of the
library:
@@ -228,6 +228,8 @@
BARCODE_128C
+BARCODE_128
+
BARCODE_39
BARCODE_I25
@@ -237,7 +239,8 @@
UPC-A with 2 or 5 digit addon), ISBN (with or without the
5-digit addon), CODE128-B (the whole set of printable
ASCII characters), CODE128-C (two digits encoded by each barcode
-symbol), CODE39 (alphanumeric) and "interleaved 2 of 5" (numeric).
+symbol), CODE128 (all ASCII values) CODE39 (alphanumeric)
+and "interleaved 2 of 5" (numeric).
See section Supported Encodings
BARCODE_ANY
@@ -338,7 +341,7 @@
The function is a shortcut to assign values to the data
structure.
-int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, double scalef, int flags);
+int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, int flags);
The function deals with the whole life of the barcode
object by calling the other functions; it uses all the specified
@@ -561,6 +564,32 @@
digit as a Code 128-A or 128-B symbol, but this tool doesn't
currently implement this option).
+code 128
+
+Automatic selection between alphabet A, B and C of the Code-128
+standard. This encoding can represent all ASCII symbols, from
+0 (NUL) to 127 (DEL), as well as four special symbols, named
+F1, F2, F3, F4. The set of symbols available in this encoding
+is not easily represented as input to the barcode library,
+so the following convention is used. In the input string,
+which is a C-language null-terminated string, the NUL char
+is represented by the value 128 (0x80, 0200) and the F1-F4 characters
+are represented by the values 193-196 (0xc1-0xc4, 0301-0304).
+The values have been chosen to ease their representation as
+escape sequences.
+
+Since the shell doesn't seem to interpret escape sequences on the
+command line, the "-b" option cannot be easily used to designate
+the strings to be encoded. As a workaround you can resort
+to the command echo, either within backticks or used
+separately to create a file that is then fed to the standard-input
+of barcode -- assuming your echo command processes escape
+sequences. The newline character is especially though to encode
+(but not impossible unless you use a csh variant.
+
+These problems only apply to the command-line tool; the use
+of library functions doesn't give any problem.
+
code 39
The code-39 standard can encode uppercase letters, digits, the
@@ -598,12 +627,13 @@
-Code128-A should be supported.
+EAN-128 is not (yet) supported. I plan to implement it pretty soon and
+then bless the package as version 1.0.
-This document was generated on 24 October 1999 using the
+This document was generated on 3 Febuary 2000 using the
texi2html
translator version 1.51.
diff -ur --new-file barcode-0.94/doc/barcode.info barcode-0.95/doc/barcode.info
--- barcode-0.94/doc/barcode.info Sun Oct 24 12:28:01 1999
+++ barcode-0.95/doc/barcode.info Thu Feb 3 20:38:02 2000
@@ -2,10 +2,10 @@
the input file barcode.texinfo.
This file is the User's Manual for the barcode library (version
-0.94).
+0.95).
- This file documents the 0.94 release of the barcode library and
-sample programs (October 1999).
+ This file documents the 0.95 release of the barcode library and
+sample programs (January 2000).
File: barcode.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
@@ -58,7 +58,7 @@
int flags; /* type of encoding and other flags */
char *ascii; /* malloced */
char *partial; /* malloced too */
- char *textinfo; /* information about text positioning */
+ char *textinfo; /* information about text placement */
char *encoding; /* code name, filled by encoding engine */
int width, height; /* output units */
int xoff, yoff; /* output units */
@@ -175,7 +175,7 @@
The Flags
*********
- The following flags are supported by version 0.94 of the library:
+ The following flags are supported by version 0.95 of the library:
`BARCODE_ENCODING_MASK'
The mask is used to extract the encoding-type identifier from the
@@ -186,14 +186,16 @@
`BARCODE_ISBN'
`BARCODE_128B'
`BARCODE_128C'
+`BARCODE_128'
`BARCODE_39'
`BARCODE_I25'
The currently supported encoding types: EAN (13 digits, 8 digits,
13 + 2 addon and 13 + 5 addon), UPC (UPC-A, UPC-E, UPC-A with 2 or
5 digit addon), ISBN (with or without the 5-digit addon),
CODE128-B (the whole set of printable ASCII characters), CODE128-C
- (two digits encoded by each barcode symbol), CODE39 (alphanumeric)
- and "interleaved 2 of 5" (numeric). *Note Supported Encodings::
+ (two digits encoded by each barcode symbol), CODE128 (all ASCII
+ values) CODE39 (alphanumeric) and "interleaved 2 of 5" (numeric).
+ *Note Supported Encodings::
`BARCODE_ANY'
This special encoding type (represented by a value of zero, so it
@@ -274,7 +276,7 @@
`int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, int xoff, int yoff, double scalef);'
The function is a shortcut to assign values to the data structure.
-`int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, double scalef, int flags);'
+`int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, int flags);'
The function deals with the whole life of the barcode object by
calling the other functions; it uses all the specified flags.
@@ -462,6 +464,31 @@
digit as a Code 128-A or 128-B symbol, but this tool doesn't
currently implement this option).
+CODE 128
+ Automatic selection between alphabet A, B and C of the Code-128
+ standard. This encoding can represent all ASCII symbols, from 0
+ (NUL) to 127 (DEL), as well as four special symbols, named F1, F2,
+ F3, F4. The set of symbols available in this encoding is not
+ easily represented as input to the barcode library, so the
+ following convention is used. In the input string, which is a
+ C-language null-terminated string, the NUL char is represented by
+ the value 128 (0x80, 0200) and the F1-F4 characters are
+ represented by the values 193-196 (0xc1-0xc4, 0301-0304). The
+ values have been chosen to ease their representation as escape
+ sequences.
+
+ Since the shell doesn't seem to interpret escape sequences on the
+ command line, the "-b" option cannot be easily used to designate
+ the strings to be encoded. As a workaround you can resort to the
+ command echo, either within backticks or used separately to create
+ a file that is then fed to the standard-input of barcode -
+ assuming your echo command processes escape sequences. The
+ newline character is especially though to encode (but not
+ impossible unless you use a csh variant.
+
+ These problems only apply to the command-line tool; the use of
+ library functions doesn't give any problem.
+
CODE 39
The code-39 standard can encode uppercase letters, digits, the
blank space, plus, minus, dot, star, dollar, slash, percent. Any
@@ -493,7 +520,8 @@
output with no surrounding white space (the problem is especially
relevant for EPS output).
- Code128-A should be supported.
+ EAN-128 is not (yet) supported. I plan to implement it pretty soon
+and then bless the package as version 1.0.
@@ -501,12 +529,12 @@
Node: Top279
Node: Overview490
Node: The Barcode Object1368
-Node: The Field List2751
-Node: Supported Flags6477
-Node: The API8986
-Node: The barcode Executable11687
-Node: The Command Line12140
-Node: Supported Encodings16727
-Node: Bugs and Pending Issues20598
+Node: The Field List2749
+Node: Supported Flags6475
+Node: The API9029
+Node: The barcode Executable11715
+Node: The Command Line12168
+Node: Supported Encodings16755
+Node: Bugs and Pending Issues21968
End Tag Table
diff -ur --new-file barcode-0.94/doc/barcode_toc.html barcode-0.95/doc/barcode_toc.html
--- barcode-0.94/doc/barcode_toc.html Sun Oct 24 12:28:02 1999
+++ barcode-0.95/doc/barcode_toc.html Thu Feb 3 20:38:02 2000
@@ -1,15 +1,15 @@
+ from barcode.texinfo on 3 Febuary 2000 -->
Barcode - Table of Contents
-barcode 0.94
+barcode 0.95
A library for drawing bar codes
-October 1999
-by Alessandro Rubini (rubini@{gnu.org,prosa.it})
+January 2000
+by Alessandro Rubini (rubini@gnu.org)
-This document was generated on 24 October 1999 using the
+This document was generated on 3 Febuary 2000 using the
texi2html
translator version 1.51.
diff -ur --new-file barcode-0.94/doc/barcodedoc.txt barcode-0.95/doc/barcodedoc.txt
--- barcode-0.94/doc/barcodedoc.txt Sun Oct 24 12:28:01 1999
+++ barcode-0.95/doc/barcodedoc.txt Thu Feb 3 20:38:02 2000
@@ -4,10 +4,10 @@
the input file barcode.texinfo.
This file is the User's Manual for the barcode library (version
-0.94).
+0.95).
- This file documents the 0.94 release of the barcode library and
-sample programs (October 1999).
+ This file documents the 0.95 release of the barcode library and
+sample programs (January 2000).
@@ -48,7 +48,7 @@
int flags; /* type of encoding and other flags */
char *ascii; /* malloced */
char *partial; /* malloced too */
- char *textinfo; /* information about text positioning */
+ char *textinfo; /* information about text placement */
char *encoding; /* code name, filled by encoding engine */
int width, height; /* output units */
int xoff, yoff; /* output units */
@@ -163,7 +163,7 @@
The Flags
*********
- The following flags are supported by version 0.94 of the library:
+ The following flags are supported by version 0.95 of the library:
`BARCODE_ENCODING_MASK'
The mask is used to extract the encoding-type identifier from the
@@ -174,14 +174,16 @@
`BARCODE_ISBN'
`BARCODE_128B'
`BARCODE_128C'
+`BARCODE_128'
`BARCODE_39'
`BARCODE_I25'
The currently supported encoding types: EAN (13 digits, 8 digits,
13 + 2 addon and 13 + 5 addon), UPC (UPC-A, UPC-E, UPC-A with 2 or
5 digit addon), ISBN (with or without the 5-digit addon),
CODE128-B (the whole set of printable ASCII characters), CODE128-C
- (two digits encoded by each barcode symbol), CODE39 (alphanumeric)
- and "interleaved 2 of 5" (numeric). *Note Supported Encodings::
+ (two digits encoded by each barcode symbol), CODE128 (all ASCII
+ values) CODE39 (alphanumeric) and "interleaved 2 of 5" (numeric).
+ *Note Supported Encodings::
`BARCODE_ANY'
This special encoding type (represented by a value of zero, so it
@@ -263,7 +265,7 @@
`int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, int xoff, int yoff, double scalef);'
The function is a shortcut to assign values to the data structure.
-`int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, double scalef, int flags);'
+`int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, int flags);'
The function deals with the whole life of the barcode object by
calling the other functions; it uses all the specified flags.
@@ -448,6 +450,31 @@
digit as a Code 128-A or 128-B symbol, but this tool doesn't
currently implement this option).
+CODE 128
+ Automatic selection between alphabet A, B and C of the Code-128
+ standard. This encoding can represent all ASCII symbols, from 0
+ (NUL) to 127 (DEL), as well as four special symbols, named F1, F2,
+ F3, F4. The set of symbols available in this encoding is not
+ easily represented as input to the barcode library, so the
+ following convention is used. In the input string, which is a
+ C-language null-terminated string, the NUL char is represented by
+ the value 128 (0x80, 0200) and the F1-F4 characters are
+ represented by the values 193-196 (0xc1-0xc4, 0301-0304). The
+ values have been chosen to ease their representation as escape
+ sequences.
+
+ Since the shell doesn't seem to interpret escape sequences on the
+ command line, the "-b" option cannot be easily used to designate
+ the strings to be encoded. As a workaround you can resort to the
+ command echo, either within backticks or used separately to create
+ a file that is then fed to the standard-input of barcode -
+ assuming your echo command processes escape sequences. The
+ newline character is especially though to encode (but not
+ impossible unless you use a csh variant.
+
+ These problems only apply to the command-line tool; the use of
+ library functions doesn't give any problem.
+
CODE 39
The code-39 standard can encode uppercase letters, digits, the
blank space, plus, minus, dot, star, dollar, slash, percent. Any
@@ -480,7 +507,8 @@
output with no surrounding white space (the problem is especially
relevant for EPS output).
- Code128-A should be supported.
+ EAN-128 is not (yet) supported. I plan to implement it pretty soon
+and then bless the package as version 1.0.
@@ -489,13 +517,13 @@
Tag Table:Node: Top279
Node: Overview490
Node: The Barcode Object1368
-Node: The Field List2751
-Node: Supported Flags6477
-Node: The API8986
-Node: The barcode Executable11687
-Node: The Command Line12140
-Node: Supported Encodings16727
-Node: Bugs and Pending Issues20598
+Node: The Field List2749
+Node: Supported Flags6475
+Node: The API9029
+Node: The barcode Executable11715
+Node: The Command Line12168
+Node: Supported Encodings16755
+Node: Bugs and Pending Issues21968
diff -ur --new-file barcode-0.94/doc/doc.barcode barcode-0.95/doc/doc.barcode
--- barcode-0.94/doc/doc.barcode Wed Oct 13 22:39:30 1999
+++ barcode-0.95/doc/doc.barcode Thu Feb 3 19:39:35 2000
@@ -31,8 +31,8 @@
@setchapternewpage off
-@set version 0.94
-@set update-month October 1999
+@set version 0.95
+@set update-month January 2000
@finalout
@@ -50,7 +50,7 @@
@subtitle A library for drawing bar codes
@subtitle @value{update-month}
-@author by Alessandro Rubini (@code{rubini@@@{gnu.org,prosa.it@}})
+@author by Alessandro Rubini (@code{rubini@@gnu.org})
@end titlepage
@setchapternewpage off
@@ -111,7 +111,7 @@
int flags; /* type of encoding and other flags */
char *ascii; /* malloced */
char *partial; /* malloced too */
- char *textinfo; /* information about text positioning */
+ char *textinfo; /* information about text placement */
char *encoding; /* code name, filled by encoding engine */
int width, height; /* output units */
int xoff, yoff; /* output units */
@@ -263,6 +263,7 @@
@itemx BARCODE_ISBN
@itemx BARCODE_128B
@itemx BARCODE_128C
+@itemx BARCODE_128
@itemx BARCODE_39
@itemx BARCODE_I25
@@ -271,7 +272,8 @@
UPC-A with 2 or 5 digit addon), ISBN (with or without the
5-digit addon), CODE128-B (the whole set of printable
ASCII characters), CODE128-C (two digits encoded by each barcode
- symbol), CODE39 (alphanumeric) and "interleaved 2 of 5" (numeric).
+ symbol), CODE128 (all ASCII values) CODE39 (alphanumeric)
+ and "interleaved 2 of 5" (numeric).
@xref{Supported Encodings}
@item BARCODE_ANY
@@ -345,7 +347,7 @@
%M .br
%M .BI "int Barcode_Position(struct Barcode_Item *" bc ", int " wid ", int " hei ", int " xoff ", int " yoff " , double " scalef ");"
%M .br
-%M .BI "int Barcode_Encode_and_Print(char *" text ", FILE *" f ", int " wid ", int " hei ", int " xoff ", int " yoff ", double " scalef ", int " flags ");"
+%M .BI "int Barcode_Encode_and_Print(char *" text ", FILE *" f ", int " wid ", int " hei ", int " xoff ", int " yoff ", int " flags ");"
%M .br
%M .BI "int Barcode_Version(char *" versionname ");"
%M
@@ -395,7 +397,7 @@
The function is a shortcut to assign values to the data
structure.
-@item int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, double scalef, int flags);
+@item int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, int flags);
The function deals with the whole life of the barcode
object by calling the other functions; it uses all the specified
flags.
@@ -625,6 +627,32 @@
digit as a Code 128-A or 128-B symbol, but this tool doesn't
currently implement this option).
+@item code 128
+
+ Automatic selection between alphabet A, B and C of the Code-128
+ standard. This encoding can represent all ASCII symbols, from
+ 0 (NUL) to 127 (DEL), as well as four special symbols, named
+ F1, F2, F3, F4. The set of symbols available in this encoding
+ is not easily represented as input to the @i{barcode} library,
+ so the following convention is used. In the input string,
+ which is a C-language null-terminated string, the NUL char
+ is represented by the value 128 (0x80, 0200) and the F1-F4 characters
+ are represented by the values 193-196 (0xc1-0xc4, 0301-0304).
+ The values have been chosen to ease their representation as
+ escape sequences.
+
+ Since the shell doesn't seem to interpret escape sequences on the
+ command line, the "-b" option cannot be easily used to designate
+ the strings to be encoded. As a workaround you can resort
+ to the command @t{echo}, either within backticks or used
+ separately to create a file that is then fed to the standard-input
+ of @i{barcode} -- assuming your @t{echo} command processes escape
+ sequences. The newline character is especially though to encode
+ (but not impossible unless you use a @t{csh} variant.
+
+ These problems only apply to the command-line tool; the use
+ of library functions doesn't give any problem.
+
@item code 39
The code-39 standard can encode uppercase letters, digits, the
@@ -660,13 +688,14 @@
output with no surrounding white space (the problem is especially
relevant for EPS output).
-Code128-A should be supported.
+EAN-128 is not (yet) supported. I plan to implement it pretty soon and
+then bless the package as version 1.0.
%M .SH "SEE ALSO"
%M \fBbarcode(3)\fP
%M
%M .SH AUTHORS
-%M Alessandro Rubini, Prosa s.r.l (maintainer)
+%M Alessandro Rubini (maintainer)
%M .PP
%M Michele Comitini, Glisco s.a.s. (several contributions)
%MANPAGE END
diff -ur --new-file barcode-0.94/ean.c barcode-0.95/ean.c
--- barcode-0.94/ean.c Sun Sep 26 12:49:07 1999
+++ barcode-0.95/ean.c Mon Jan 24 13:17:18 2000
@@ -1,7 +1,7 @@
/*
* ean.c -- encoding for ean, upc and isbn
*
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
diff -ur --new-file barcode-0.94/i25.c barcode-0.95/i25.c
--- barcode-0.94/i25.c Sun Sep 26 12:49:07 1999
+++ barcode-0.95/i25.c Mon Jan 24 13:17:18 2000
@@ -1,7 +1,7 @@
/*
* i25.c -- "interleaved 2 of 5"
*
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
diff -ur --new-file barcode-0.94/library.c barcode-0.95/library.c
--- barcode-0.94/library.c Thu Aug 5 20:26:46 1999
+++ barcode-0.95/library.c Mon Jan 24 13:17:17 2000
@@ -1,7 +1,7 @@
/*
* library.c -- external functions of libbarcode
*
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
@@ -80,6 +80,8 @@
extern int Barcode_128b_encode(struct Barcode_Item *bc);
extern int Barcode_128c_verify(unsigned char *text);
extern int Barcode_128c_encode(struct Barcode_Item *bc);
+extern int Barcode_128_verify(unsigned char *text);
+extern int Barcode_128_encode(struct Barcode_Item *bc);
extern int Barcode_i25_verify(unsigned char *text);
extern int Barcode_i25_encode(struct Barcode_Item *bc);
@@ -97,6 +99,7 @@
{BARCODE_128C, Barcode_128c_verify, Barcode_128c_encode},
{BARCODE_39, Barcode_39_verify, Barcode_39_encode},
{BARCODE_I25, Barcode_i25_verify, Barcode_i25_encode},
+ {BARCODE_128, Barcode_128_verify, Barcode_128_encode},
{0, NULL, NULL}
};
diff -ur --new-file barcode-0.94/main.c barcode-0.95/main.c
--- barcode-0.94/main.c Sun Sep 26 16:34:32 1999
+++ barcode-0.95/main.c Mon Jan 24 13:17:17 2000
@@ -2,7 +2,7 @@
* main.c - a commandline frontend for the barcode library
*
* Copyright (c) 1999 Michele Comitini (mcm@glisco.it)
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
@@ -60,6 +60,8 @@
{"code128c", BARCODE_128C},
{"128b", BARCODE_128B},
{"code128b", BARCODE_128B},
+ {"128", BARCODE_128},
+ {"code128", BARCODE_128},
{"i25", BARCODE_I25},
{"interleaved 2 of 5", BARCODE_I25},
{NULL, 0}
@@ -219,7 +221,7 @@
code_width = w * unit;
code_height = h * unit;
xmargin0 = x * unit;
- ymargin1 = y * unit;
+ ymargin0 = y * unit;
return 0;
}
@@ -314,9 +316,9 @@
page_wid = dpw * unit;
page_hei = dph * unit;
if (unit != 1.0) { /* rebuild the page name */
- page_name = malloc(16);
- if (page_name) snprintf(page_name, 16, "%dx%d\n",
- page_wid, page_hei);
+ page_name = malloc(32); /* big, to avoid snprintf, missing on HP */
+ if (page_name)
+ sprintf(page_name, "%dx%d\n", page_wid, page_hei);
}
return 0;
}
diff -ur --new-file barcode-0.94/ps.c barcode-0.95/ps.c
--- barcode-0.94/ps.c Sun Sep 26 12:59:33 1999
+++ barcode-0.95/ps.c Wed Jan 26 16:47:51 2000
@@ -1,7 +1,7 @@
/*
* ps.c -- printing the "partial" bar encoding
*
- * Copyright (c) 1999 Alessandro Rubini (rubini@prosa.it)
+ * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
*
* This program is free software; you can redistribute it and/or modify
@@ -61,7 +61,7 @@
int Barcode_ps_print(struct Barcode_Item *bc, FILE *f)
{
- int i, j, k, barlen;
+ int i, j, k, barlen, printable=1;
double f1, f2, fsav=0;
int mode = '-'; /* text below bars */
double scalef=1, xpos, x0, y0, yr;
@@ -148,8 +148,12 @@
}
/* Print some informative comments */
+ for (i=0; bc->ascii[i]; i++)
+ if (bc->ascii[i] < ' ')
+ printable = 0;
+
fprintf(f,"%% Printing barcode for \"%s\", scaled %5.2f",
- bc->ascii, scalef);
+ printable ? bc->ascii : "", scalef);
if (bc->encoding)
fprintf(f,", encoded using \"%s\"",bc->encoding);
fprintf(f, "\n");
@@ -218,17 +222,21 @@
}
fsav = f2; /* for next time */
- /* FIXME: a ')' can't be printed this way */
- fprintf(f, "%5.2f %5.2f moveto (%c) show\n",
+ fprintf(f, "%5.2f %5.2f moveto (",
bc->xoff + f1 * scalef + bc->margin,
mode == '-'
? (double)bc->yoff + bc->margin
- : (double)bc->yoff + bc->margin+bc->height - 8*scalef,
- c);
+ : (double)bc->yoff + bc->margin+bc->height - 8*scalef);
+ /* Both the backslash and the close parens are special */
+ if (c=='\\' || c==')')
+ fprintf(f, "\\%c) show\n", c);
+ else
+ fprintf(f, "%c) show\n", c);
}
}
- fprintf(f,"\n%% End barcode for \"%s\"\n\n", bc->ascii);
+ fprintf(f,"\n%% End barcode for \"%s\"\n\n",
+ printable ? bc->ascii : "");
if (!(bc->flags & BARCODE_OUT_NOHEADERS)) {
fprintf(f,"showpage\n");
diff -ur --new-file barcode-0.94/sample.c barcode-0.95/sample.c
--- barcode-0.94/sample.c Thu Aug 5 20:10:24 1999
+++ barcode-0.95/sample.c Mon Jan 24 13:17:14 2000
@@ -35,7 +35,7 @@
BARCODE_UPC | BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS);
/* A few code-39 ones */
- Barcode_Encode_and_Print("prosa srl",stdout, 0, 0, 40, 320,
+ Barcode_Encode_and_Print("silly code",stdout, 0, 0, 40, 320,
BARCODE_39 | BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS);
Barcode_Encode_and_Print("SAMPLE CODES",stdout, 100, 30, 400, 80,
BARCODE_39 | BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS);
diff -ur --new-file barcode-0.94/test/testbarcode barcode-0.95/test/testbarcode
--- barcode-0.94/test/testbarcode Sun Sep 26 16:34:00 1999
+++ barcode-0.95/test/testbarcode Thu Jan 1 01:00:00 1970
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-# horrible kludge!
-# this is not a complete test suite, just some checks
-
-ean13="012345678901"
-ean132="012345678901 12"
-ean135="012345678901 12345"
-ean8="0123456"
-upca="01234567890"
-upca2="01234567890 12"
-upca5="01234567890 12345"
-upce="012345"
-code39="code39"
-isbn="1-56592-292-1"
-isbn5="1-56592-292-1 90000"
-code128b="one-and,another"
-code128c="0011223"
-i25="12345"
-
-rm *ps
-
-../sample > 00all.ps
-
-ls .. | ../barcode -t 3x4+40+40 > 01table-no-unit.ps
-ls .. | ../barcode -u mm -t 3x4+10+10 > 02table-10mm.ps
-ls .. | ../barcode -u mm -t 3x4+10+20-40-80 > 03table-uncenter.ps
-ls .. | ../barcode -u in -t 3x4+1+2-3-4 > 04table-uncenter-in.ps
-ls .. | ../barcode -u in -t 2x2 -p 4x4 > 05table-small4in-page.ps
-ls .. | ../barcode -u in -t 2x2 -p a5 > 06table-a5-page.ps
-ls .. | ../barcode -u cm -t 2x2 -p 15x15 > 07table-small15cm-page.ps
-ls .. | ../barcode -u cm -t 2x2 -m 3x5 > 08table-bigmargin.ps
-echo $ean13 | ../barcode -u mm -g 40x30 -E > 09ean40mm-30mm.ps
-echo $isbn5 | ../barcode -u cm -g 6x5 -E > 10isbn6cmx5cm.ps
-echo $upca | ../barcode -E > 11upca.ps