From: Jim Evins Date: Tue, 18 Jun 2002 01:41:52 +0000 (+0000) Subject: Checking in gnu-barcode-0.98 X-Git-Tag: glabels-2_3_0~859 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=492ca6b93e3360e64288df1efdd1383990a77c78;p=glabels Checking in gnu-barcode-0.98 git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@19 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels1/barcode-0.98/COPYING b/glabels1/barcode-0.98/COPYING new file mode 100644 index 00000000..a43ea212 --- /dev/null +++ b/glabels1/barcode-0.98/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/glabels1/barcode-0.98/ChangeLog b/glabels1/barcode-0.98/ChangeLog new file mode 100644 index 00000000..024706de --- /dev/null +++ b/glabels1/barcode-0.98/ChangeLog @@ -0,0 +1,460 @@ +2002-03-01 Alessandro Rubini + + * library.c (Barcode_Encode): handle bitsets separately, like + in Barcode_Print (otherwise, you might loose NO_CHECKSUM). + + * debian/changelog: moved to 0.98 (but should fix all debian/ stuff) + + * contrib/barcode-for-delphi.tar.gz: new, contributed by Michael Geddes + + * contrib/barcode-for-delphi.tar.gz.README: short info for file above + + * main.c (main): allow "-g" to set size of code in a table as well + -- suggested and initiallt implemented by Joachim Reichelt. + (main): fixed missing "Page: 1 1" in postscript for tables + (main): for tables don't use Encode_and_Print, use a local + unrolled version, so the default margin can be removed and + we avoid problems with negative xoff in the output phase + (first column may be offset, as noted by Karl Magnus Kolstoe) + + * doc/doc.barcode: documented change above. + + * README: removed refernces to systemy.it, I'm no more there + Added link to FreeBSD ports tree and GLabels + Organized as sections with titles + + * contrib/barcode-SVG.tar.gz: new contribution, by David J. Humphreys + + * contrib/barcode-SVG.tar.gz.README: short description of file above + + * contrib/grab-0.0.4.tar.gz: new program, by Tuukka Toivonen. + + * contrib/grab-0.0.4.tar.gz.README: short description of file above + +2002-03-01 Boszormenyi Zoltan + + * barcode.spec: new file + +2002-02-27 Alessandro Rubini + + * bookland/bookland.py: updated to version 0.92 by Judah Milgram + +2001-11-13 Alessandro Rubini + + * README: Added a pointer to the Windows port. + +2001-11-09 Cloyce D. Spradling + + * code128.c (Barcode_128b_verify): prototype fix (unsigned char). + + * ps.c (Barcode_ps_print): the comment for ascii codes must only + be printed if ascii is being printed (benign bug). + +2001-11-06 Christoph Pross + + * pcl.c (Barcode_pcl_print): bugfix: bars were misplaced + +2001-10-16 Nathan D. Holmes + + ====> Version 0.97 released to ftp.systemy.it and ftp.gnu.org + + * code93.c: new file (I modified something as well - Alessandro) + + * doc/doc.barcode (Supported Encodings): added docs for code93 + + * main.c: added code93 names + + * Makefile.in (LIBOBJECTS): added code93.o + + * library.c: added code93 entry points + +2001-10-16 Alessandro Rubini + + * doc/manpager: added (trivial) support for @itemize, added copyright + + * sample.c (main): accept -P to create PCL output + + * doc/doc.barcode (PCL Output): added the section, using text + provided by Andrea Scopece and turning it into texinfo. + Removed also a few extra newlines that made bad man pages + +2001-10-16 Andrea Scopece + + * barcode.h: added BARCODE_OUT_PCL and BARCODE_OUT_PCL_III + + * library.c (Barcode_Print): use BARCODE_OUT_PCL to select pcl_print() + + * Makefile.in (LIBOBJECTS): added pcl.o + + * pcl.c: new file, with PCL output support + +2001-10-16 Alessandro Rubini + + * doc/doc.barcode (Supported Encodings): added documentation for + EAN and UPC with checksum, as coded by mr. Böszörményi (below) + +2001-10-16 Boszormenyi Zoltan + + * ean.c: + + I found that barcode-0.96 does not correctly encodes UPC-E. + This was mainly because in upc_e_to_a() the switch() branches + all ended without "break;". + + Printing UPC-E did not print the leading encoding number and + the trailing UPC-A checksum. Now it does. + + Accept EAN-13 and EAN-8 with and without the checksum. + So always treat 7 and 12 digit sequences as valid EAN codes + and accept 8 and 13 digit sequences as valid EAN codes when + the last digit is the same as the calculated one. + + Accept UPC-A as above (11 or 12 digit sequences.) + + Accepts UPC-E as: + 6 digit sequence: the middle part of the code (leading '0' assumed) + 7 digit sequence: the middle part and either a leading '0' or '1', + or a trailing UPC-A checksum. In that case, leading '0' assumed. + 8 digit sequence: a leading '0' or '1', middle part, checksum + + UPC-A, UPC-E, EAN-13, and EAN-8 may all include + an additional barcode to the right of the main barcode. + + As a 7 or a 12 digit sequence may be ambiguous, please remember + that EAN is checked before UPC if you specified BARCODE_ANY. + +2001-08-20 Alessandro Rubini + + * sample.c (main): added upc-e and ean-8 samples + +2001-08-11 Boszormenyi Zoltan + + * ps.c (Barcode_ps_print): don't output "showpage" in EPS mode + +2001-08-11 Alessandro Rubini + + * README: Changed host names, added barcode-commit list. + +2000-11-29 Alessandro Rubini + + * doc/doc.barcode (The Field List): 1pt == 0.352mm, not 0.0352 + (thanks to Stephen Irven for reporting) + +2000-11-09 Alessandro Rubini + + ====> Version 0.96 released to ftp.systemy.it and ftp.gnu.org + + * doc/Makefile.in ($(TARGET).html): fixed bug introduced on Sep 08 + + * doc/doc.barcode (top): correctly deal with "makeinfo --html" + +2000-11-08 Alessandro Rubini + + * README: new network pointers added + + * codabar.c (Barcode_cbr_encode): don't print ascii text for the + checksum. + + * doc/doc.barcode (The Intermediate Representaion): new section + Documented the new encodings by Leonid. + Promoted two sections to chapters + Added Leonid in the AUTHORS section of the manpage. + + * Makefile.in: don't remove docs in distclean, as the distribution + now includes the docs + +2000-11-07 Alessandro Rubini + + * Makefile.in (clean): don't remove docs, do that only in distclean + + * doc/Makefile.in: a new life for the former Makefile (to build + with both gmake and pmake with features added on 2000-09-08) + + * configure.in: use $MAKE in checking for gmake if set + (to allow testing with BSD make) + Check if makeinfo can manage html, used for doc/Makefile.in + +2000-11-07 Leonid A. Broukhis + + * code128.c (Barcode_encode_as): fixed a bug that prevented F + symbols to be correctly encoded. + + * plessey.c: new file, for Plessey encoding. + + * msi.c: new file, for MSI encoding. + + * codabar.c: new file, for CodaBar encoding. + + * code128.c (Barcode_128raw_encode): new encoding + (Barcode_128raw_verify): checker for new encoding + + * barcode.h, library.c, main.c: added code128raw, codabar, + MSI and Plessey + +2000-11-07 Hans Schou + + * contrib/barcodeps-0.1.tgz: new file, sent to Alessandro on Oct 7 + +2000-10-10 Alessandro Rubini + + * doc/manpager: use gsub instead of gensub, even though it may + leas to problems with some input. This achieves compatibility + with the original awk, so gawk is not needed any more + +2000-10-02 Alessandro Rubini + + * ps.c (Barcode_ps_print): add a backslash in front of '(' too. + Suggested by H Y . + (Barcode_ps_print): use ps arrays to get compact (and prettier) + PostScript output. Suggested by Hans Schou . + + * main.c (get_geometry): accept "+offset+offset" to keep default size. + Suggested by Godmar Back . + +2000-09-16 Alessandro Rubini + + * ps.c (Barcode_ps_print): use "half text height" instead of + "two text heights" as minimum bar height. Suggested by + Oliver Vecernik . + +2000-09-14 Alessandro Rubini + + * barcode.h: added the standard ``extern "C"'' stuff for C++ + (bug reported by Dany Pardo ) + +2000-09-08 Andrea Ferraris + + * doc/Makefile: added support for pdf and html via makeinfo + + * doc/doc.barcode: added a missing trailing dot in an xref + +2000-08-28 Alessandro Rubini + + * i25.c (Barcode_i25_encode): fixed checksum calculation + (thanks to Hans Schou for reporting) + +2000-05-19 Alessandro Rubini + + ====> Version 0.95.1 released to ftp.prosa.it + + * code128.c (Barcode_128_make_array): use code C if encoding 2 digits + +2000-05-08 Alessandro Rubini + + * cmdline.c (commandline_errormsg): removed "?:" gcc extension + + * configure.in: added checks for unistd.h and strcasecmp, as + windows doesn't have them (thanks Marten Karl) + +2000-04-21 Alessandro Rubini + + * doc/Makefile: modified to build with both gmake and pmake + + * Makefile: modified to build with both gmake and pmake + +2000-04-20 Alessandro Rubini + + * Makefile.in (.depend): removed gmake-specific features. + Thanks to Jukka A. Ukkonen for reporting. + + * configure.in: detect gmake and avoid its features if not there + + * ps.c (Barcode_ps_print): fix: codes with (relatively) short bars + were enlarged in height instead of reduced in width (also + the enlarging was wrong). Thanks to Rob Seace for reporting. + +2000-04-09 Alessandro Rubini + + * code128.c (Barcode_128_encode): removed extra messages to stderr, + forgot in the code when I finished code128 support + + * doc/doc.barcode: bugfix: in the description of geometry, the unit + of measure is configurable + +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 + + * debian/*: edited information for proper Debian support + + * debian/rules (binary-arch): new file, from "deb-make" + + * Makefile.in (install): added "-m 0644" to install non-executables + + * code128.c (Barcode_128b_encode): fixed checksum calculation. + +====> Version 0.93 released to ftp.prosa.it and ftp.gnu.org + +1999-09-26 Alessandro Rubini + + * doc/doc.barcode: fixed the rendering of complex options (-g and -t) + Removed extra "table of contents" heading in the ps output + Changed attribution on cover page + + * main.c (get_table and others): be more specific in error msgs + (get_page_geometry): numeric specification is according to "-u" + (get_table): accept unsymmetric margin specification + (option_table): added "-u" to accept "cm", "mm", "in", "pt" + (get_page_geometry): bugfix: numeric spec was always consideder mm + + * cmdline.c (commandline): don't always print help + + * Makefile.in ($(INFO)): added missing dependency: distributed docs + formats were out of date with distributed doc source. + +1999-09-13 Alessandro Rubini + + * main.c (main): print tables: y used xmargin (Tim Withers,Jon Bakken) + +1999-09-06 Alessandro Rubini + + * Makefile.in: prevent -Wall when compiling getopt. + + * i25.c, ean.c, ps.c: switched to unsigned char, to prevent warnings + on newer gcc's (thanks Al Piszcz) + +====> Version 0.92 released to ftp.prosa.it and ftp.gnu.org + +1999-08-31 Alessandro Rubini + + * i25.c: the right guard was thinner than other bars + + * doc/doc.barcode: spelling and manpage fixes (thanks Joachim Schaaf) + +====> Version 0.91.4 released to ftp.prosa.it + +1999-08-23 Thad Floryan + + * main.c (strerror): replacement strerror selected by autoconf + +1999-08-06 Alessandro Rubini + + * changed all "ENODATA" in "EINVAL", as some system miss ENODATA + + * Makefile.in (all): removed ".depend" from all, as it needs gcc + + * i25.c (Barcode_i25_encode): fixed wrong free() in an unlinely path + + * ean.c (Barcode_ean_encode): don't use sprintf's result, as some + systems return a char pointer instead of the number of chars. + + * configure.in: new file, as autoconf support is being added + +====> Version 0.91.3 released to ftp.prosa.it + +1999-08-05 Alessandro Rubini + + * code128.c (Barcode_128c_encode): fixed malloc of textinfo (was short) + + * i25.c (Barcode_i25_encode): new encoding: interleaved 2 of 5 + + * ean.c (Barcode_ean_encode): enlarged static "text", to fit add-5 + + * code128.c (Barcode_128b_encode): new encoding: 128-B + +====> Version 0.91.2 released to ftp.prosa.it + +1999-08-04 Alessandro Rubini + + * bookland/bookland.py: upgraded to version 0.06 (Judas Milgram) + + * ean.c (Barcode_ean_encode): fixed layout of 1st/last digit in UPC-A + + * code128.c (Barcode_128c_encode): fixed checksum calculation + +====> Version 0.91.1 released to ftp.prosa.it + +1999-07-09 Alessandro Rubini + + * sample.c (main): due changes to show code128-C + + * code128.c (Barcode_128c_encode): implemented code 128-C + + * ps.c (Barcode_ps_print): Accept float position and font size + + * code39.c (Barcode_39_encode): reduced font (looked too big) + +====> Version 0.91 released to both ftp.prosa.it and ftp.gnu.org + +1999-07-08 Alessandro Rubini + + * ps.c (Barcode_ps_print): shrink all the bars by 0.15 points + (Barcode_ps_print): Use Helvetica as font, not Courier-Bold + (Barcode_ps_print): remember previous font to make shorter ps output + +1999-07-07 Alessandro Rubini + + * bookland/bookland.py: new enntry, by Judah Milgram. + + * ean.c (Barcode_isbn_verify): fixed bug with "-X" codes (thanks Judah) + +====> Version 0.90.3 released to ftp.prosa.it/pub/software + +1999-07-07 Alessandro Rubini + + * doc/doc.barcode: fixed the "BUGS" section (remove fixed stuff) + + * ean.c (Barcode_ean_encode): added '+' markers in partial and textinfo + + * ps.c (Barcode_ps_print): added support for text over bars ('+' mode) + +====> Version 0.90.2, internal checkpoint + +1999-07-06 Alessandro Rubini + + * Makefile: dirty autodetect of libpaper + + * main.c (get_page_geometry): parse a cmdline argument (mcm@glisco.it) + (main): added "--version" + (main): added diagnostic message for unencodable strings + +====> Version 0.90.1 released to ftp.prosa.it/pub/software + +1999-07-03 Alessandro Rubini + + * barcode.h: removed BARCODE_OUT_PG_* as only the library doesn't + need to hack with the page size. + + * ean.c (Barcode_ean_encode): supplemental 2 and 5 encodings (no text) + + * library.c: use unsigned char all over the place, to prevent warnings + +1999-07-01 Alessandro Rubini + + * ean.c: added EAN-8 and UPC-E support + + * Updated the address of the FSF in any source file + + * README: new file. + +====> Version 0.90 is the first public release. No Changelog up to now. diff --git a/glabels1/barcode-0.98/INSTALL b/glabels1/barcode-0.98/INSTALL new file mode 100644 index 00000000..5a6cb878 --- /dev/null +++ b/glabels1/barcode-0.98/INSTALL @@ -0,0 +1,31 @@ + +Installing on generic Unix systems +---------------------------------- + +The package includes both a library and a standalone program. +To install everything try + + ./configure && make && make install + +To uninstall, try + + make uninstall + +You may have problems compiling the package on non-GNUish systems, +because the tool currently uses both gmake and gawk features, and I have +no access to non-gnu systems. If your operating system isn't able to +compile barcode and you are willing to help porting, feel free to call me. + + +Installing on Debian/GNU systems +-------------------------------- + +The suggested installation here includes creation of a Debian package: + + debian/rules binary + +Then, just install using dpkg: + + dpkg -i ../barcode-0.98_*.deb + +(the "*" here will represent your architecture: "i386", "alpha", "sparc", ...) diff --git a/glabels1/barcode-0.98/Makefile.in b/glabels1/barcode-0.98/Makefile.in new file mode 100644 index 00000000..848aa265 --- /dev/null +++ b/glabels1/barcode-0.98/Makefile.in @@ -0,0 +1,141 @@ +# +# This Makefile should run fine with both pmake and gmake +# + +CC = @CC@ +CFLAGS = @CFLAGS@ @DEFS@ @NO_GETOPT@ @NO_LIBPAPER@ @NO_STRERROR@ +RANLIB = @RANLIB@ + +INSTALL = @INSTALL@ + +LDFLAGS = -L. -l$(TARGET) @LIBPAPER@ + +prefix = @prefix@ +BINDIR = $(prefix)/bin +LIBDIR = $(prefix)/lib +INCDIR = $(prefix)/include +MAN1DIR = $(prefix)/man/man1 +MAN3DIR = $(prefix)/man/man3 +INFODIR = $(prefix)/info + +# getopt may be installed or not, if not take our copy +GETOPT_O = @GETOPT_O@ + +TARGET = barcode +LIBRARY = lib$(TARGET).a +MAN1 = $(TARGET).1 +MAN3 = $(TARGET).3 +INFO = doc/$(TARGET).info +HEADER = $(TARGET).h + +LIBOBJECTS = library.o ean.o code128.o code39.o code93.o i25.o \ + msi.o plessey.o codabar.o \ + ps.o pcl.o +EXEOBJECTS = main.o cmdline.o $(GETOPT_O) +ALLSOURCES = $(LIBOBJECTS:.o=.c) $(EXEOBJECT:.o=.c) + + +#Hmm... "RM" is undefined in pmake +RM = rm + +all: $(TARGET) $(LIBRARY) $(MAN1) $(MAN3) $(INFO) sample + +$(TARGET): $(LIBRARY) $(EXEOBJECTS) + $(CC) $(CFLAGS) $(EXEOBJECTS) $(LDFLAGS) -o $(TARGET) + +sample: sample.o $(LIBRARY) + $(CC) $(CFLAGS) sample.o $(LDFLAGS) -o $@ + +# Avoid the standard CFLAGS, to avoid -Wall and -DNO_GETOPT +compat/getopt.o: compat/getopt.c + $(CC) -O -c compat/getopt.c -o $@ + +$(LIBRARY): $(LIBOBJECTS) + $(AR) r $(LIBRARY) $(LIBOBJECTS) + $(RANLIB) $(LIBRARY) + +$(MAN1) $(MAN3): doc/doc.$(TARGET) + awk -f doc/manpager doc/doc.$(TARGET) + + +# Unfortunately, pmake has no "-C". Also, "pmake -n" doesn't follow the cd. +$(INFO): doc/doc.$(TARGET) + cd doc && $(MAKE) + +install: + $(INSTALL) -d $(BINDIR) $(INCDIR) $(LIBDIR) $(MAN1DIR) \ + $(MAN3DIR) $(INFODIR) + $(INSTALL) -c $(TARGET) $(BINDIR) + $(INSTALL) -c -m 0644 $(HEADER) $(INCDIR) + $(INSTALL) -c -m 0644 $(LIBRARY) $(LIBDIR) + $(INSTALL) -c -m 0644 $(MAN1) $(MAN1DIR) + $(INSTALL) -c -m 0644 $(MAN3) $(MAN3DIR) + $(INSTALL) -c -m 0644 $(INFO) $(INFODIR) + +uninstall: + $(RM) -f $(BINDIR)/$(TARGET) + $(RM) -f $(INCDIR)/$(HEADER) + $(RM) -f $(LIBDIR)/$(LIBRARY) + $(RM) -f $(MAN1DIR)/$(MAN1) + $(RM) -f $(MAN3DIR)/$(MAN3) + $(RM) -f $(INDODIR)/$(INFO) + +#Make clean keeps the compiled documents +clean: + $(RM) -f *.o */*.o *~ */*~ $(TARGET) $(LIBRARY) + $(RM) -f $(MAN1) $(MAN3) core sample + cd doc && $(MAKE) terse + $(RM) -f .depend + +distclean: clean + if [ -f build ]; then debian/rules clean; fi + # remove the configure stuff as well + $(RM) -f Makefile config.h config.log config.status config.cache \ + doc/Makefile + +cleanest: clean + cd doc && $(MAKE) clean + +Makefile: Makefile.in configure + ./configure + +configure: configure.in + autoconf + +.depend: $(ALLSOURCES) + $(CC) $(CFLAGS) -MM $(ALLSOURCES) > $@ + +depend: .depend + +tar: + @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 \ + if [ -d ../$(TARGET)-$(RELEASE) ]; then \ + rm -rf ../$(TARGET)-$(RELEASE); \ + fi; \ + 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: + @grep -n VERSION $(HEADER) /dev/null + @grep -n set.version doc/doc.$(TARGET) /dev/null + @grep -n dpkg.-i INSTALL /dev/null + +# and this is how I make the distribution +distrib: $(INFO) distclean tar printv + + +.PHONY: all install uninstall mostlyclean clean disclean depend \ + tar printv distrib + +# Only if make is gmake, have a rule to conditionally include .depend +@GMAKEDEPEND0@ +@GMAKEDEPEND1@ +@GMAKEDEPEND2@ + diff --git a/glabels1/barcode-0.98/README b/glabels1/barcode-0.98/README new file mode 100644 index 00000000..d3ae2a7f --- /dev/null +++ b/glabels1/barcode-0.98/README @@ -0,0 +1,93 @@ + +NETWORK LINKS +============= + +This is GNU-barcode. The latest release can be downloaded from ftp.gnu.org +and mirrors: + ftp://ftp.gnu.org/pub/gnu/barcode/ + +It is also available from my own ftp/http server + ftp://ar.linux.it/pub/barcode/ + http://ar.linux.it/pub/barcode/ (same as above). + +The current source tree is available by anonymous CVS. See + http://ar.linux.it/software/#cvs + +Plesae note that ar.linux.it/pub/barcode also includes CVS snapshots, +semi-atumatically taken when I commit stuff to CVS. Note that CVS +snapshots include "CVS/" directories, so you can then "cvs update" for +further updates. + +The documentation is online at: + http://ar.linux.it/software/barcode + +The MS-Windows port is maintained at: + http://gnuwin32.sourceforge.net/packages/barcode.htm + +It as also been included in the FreeBSD ports tree in the "graphics" section. +This means /usr/ports/graphics/barcode. It's thus available from: + http://www.freebsd.org/ports/graphics.html + +GLabels, at http://snaught.com/glabels/, uses barcode internally, too. + +DESCRIPTION +=========== + +The package is meant to solve most needs in barcode creation with a +conventional printer. It can create printouts for the conventional +product tagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, as well +as a few other formats. Ouput is generated as either Postscript or +Encapsulated Postscript (other back-ends may be added if needed). + +The package is released as both a library and a command-line frontend, +so that you can include barcode-generation into your application. The +program is released in the hope that is proves useful but without any +warranty, according to the GPL Licence (see ./COPYING). + +If you're specifically interested in making an ISBN (Bookland EAN) +symbol, you might try to get "bookland.py" by Judah Milgram +(http://www.cgpp.com/bookland/, whose version 0.92 is also included in +the directory "bookland" within this package, for your convenience). +While my main target is flexibility his main target is strict +adherence to the standards. Bookland is free software like the barcode +library and will probabily have its role in the GNU project. +Bookland.py is a self-documenting program, you'll enjoy browsing its +source code. + +Other contributed patches and/or software are available in the +contrib/ directory. + +Please take the "no-warranty" disclaimer seriously: even though I +spent reasonable efforts to make sure the output is useable in +production you should verify it suits your needs as a faulty bar can +cost you a bundle, and you'll be on your own. It's up to you to verify +that the symbol is valid (and, obviously, I'd like to know about any +problem you encounter). [This paragraph copied verbatim from bookland.py] + + +ACKNOWLEDGMENTS +=============== + +I would like to thank both Judah Milgram and Michele Comitini +(mcm@glisco.it) for their help with this tool, as well as Jim Westveer +for introducing me to Debian packaging. Several encodings have been +implemented by Leonid A. Broukhis (leob@mailcom.com). + + +MAILING LISTS +============= + +There is a mailing list where development is coordinated, called +barcode@lists.linux.it . To get subscribed you should + echo subscribe | mail barcode-request@lists.linux.it +or anything equivalent. + +To receive notification of CVS commit messages, please subscribe to +barcode-commit@ar.linux.it, by issuing: + echo subscribe | mail barcode-commit-request@ar.linux.it + +(if you guess, "ar" or "arcana" is my own server, while lists.linux.it +is the mail server of the italian association of gnu/linux users). + +/alessandro (rubini@gnu.org) + diff --git a/glabels1/barcode-0.98/TODO b/glabels1/barcode-0.98/TODO new file mode 100644 index 00000000..c91c79cf --- /dev/null +++ b/glabels1/barcode-0.98/TODO @@ -0,0 +1,23 @@ + + Possible enhancements that I'd like to add + +* verbose mode, printing position information to stderr + +* document how a new encoding standard can be added + +* add Barcode_String, which has been contributed + +* EAN128 (as agreed with Dani Pardo) + +* Postnet and associated encoding-specific bar definitions + +* Use texinfo 4 with images + +* shrink the bars to account for ink spreading + + Currently, small barcodes don't get rendered well. While + version 0.91 and later subtracts 0.15 points from the size of + the bars (I found that this makes good results for small + bars), a smart alghorithm to shrink the bars is needed to get + lighter prints at small sizes without loosing readability. + diff --git a/glabels1/barcode-0.98/barcode.h b/glabels1/barcode-0.98/barcode.h new file mode 100644 index 00000000..6b9bdf4e --- /dev/null +++ b/glabels1/barcode-0.98/barcode.h @@ -0,0 +1,119 @@ +/* + * barcode.h -- definitions for libbarcode + * + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _BARCODE_H_ +#define _BARCODE_H_ + +#include + +#define BARCODE_VERSION "0.98" +#define BARCODE_VERSION_INT 9800 + +/* + * The object + */ +struct Barcode_Item { + int flags; /* type of encoding and decoding */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text positioning */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ +}; + +/* + * The flags field + */ +#define BARCODE_DEFAULT_FLAGS 0x00000000 + +#define BARCODE_ENCODING_MASK 0x000000ff /* 256 possibilites... */ +#define BARCODE_NO_ASCII 0x00000100 /* avoid text in output */ +#define BARCODE_NO_CHECKSUM 0x00000200 /* avoid checksum in output */ + +#define BARCODE_OUTPUT_MASK 0x000ff000 /* 256 output types */ +#define BARCODE_OUT_EPS 0x00001000 +#define BARCODE_OUT_PS 0x00002000 +#define BARCODE_OUT_PCL 0x00004000 /* by Andrea Scopece */ +/* PCL_III 0x00008000 */ +#define BARCODE_OUT_PCL_III 0x0000C000 +#define BARCODE_OUT_NOHEADERS 0x00100000 /* no header nor footer */ + +enum { + BARCODE_ANY = 0, /* choose best-fit */ + BARCODE_EAN, + BARCODE_UPC, /* upc == 12-digit ean */ + BARCODE_ISBN, /* isbn numbers (still EAN13) */ + BARCODE_39, /* code 39 */ + 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) */ + BARCODE_128RAW, /* Raw code 128 (by Leonid A. Broukhis) */ + BARCODE_CBR, /* Codabar (by Leonid A. Broukhis) */ + BARCODE_MSI, /* MSI (by Leonid A. Broukhis) */ + BARCODE_PLS, /* Plessey (by Leonid A. Broukhis) */ + BARCODE_93 /* code 93 (by Nathan D. Holmes) */ +}; + +#define BARCODE_DEFAULT_MARGIN 10 + +#ifdef __cplusplus +extern "C" { +#endif +/* + * Create and destroy barcode structures + */ +extern struct Barcode_Item *Barcode_Create(char *text); +extern int Barcode_Delete(struct Barcode_Item *bc); + +/* + * Encode and print + */ +extern int Barcode_Encode(struct Barcode_Item *bc, int flags); +extern int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags); + +/* + * Choose the position + */ +extern int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, + int xoff, int yoff, double scalef); + +/* + * Do it all in one step + */ +extern int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags); + + +/* + * Return current version (integer and string) + */ +extern int Barcode_Version(char *versionname); + +#ifdef __cplusplus +} +#endif + +#endif /* _BARCODE_H_ */ diff --git a/glabels1/barcode-0.98/barcode.spec b/glabels1/barcode-0.98/barcode.spec new file mode 100644 index 00000000..eccb6026 --- /dev/null +++ b/glabels1/barcode-0.98/barcode.spec @@ -0,0 +1,84 @@ +%define name barcode +%define ver 0.98 +%define rel 1 +%define prefix /usr +%define sysconfdir /etc + +Summary: GNU barcode +Name: %name +Version: %ver +Release: %rel +Copyright: GPL +Group: Applications/Productivity +Source: ftp://ar.linux.it/pub/barcode/%name-%{ver}.tar.gz +BuildRoot: /var/tmp/%name-%{ver}-root +URL: http://gnu.systemy.it/software/barcode +Prefix: %prefix + +%description +This is GNU-barcode. +The package is meant to solve most needs in barcode creation with a +conventional printer. It can create printouts for the conventional +product tagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, as well +as a few other formats. Ouput is generated as either Postscript or +Encapsulated Postscript (other back-ends may be added if needed). + +%package devel +Summary: GNU barcode files for development +Group: Development/Libraries + +%description devel +This is GNU-barcode. +The package is meant to solve most needs in barcode creation with a +conventional printer. It can create printouts for the conventional +product tagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, as well +as a few other formats. Ouput is generated as either Postscript or +Encapsulated Postscript (other back-ends may be added if needed). + +This package contain the C header, the static library and man page +for development. + +%prep +%setup + +%ifarch alpha + ARCH_FLAGS="--host=alpha-redhat-linux" +%endif + +export -n LANG LINGUAS LC_ALL +if [ ! -f configure ]; then + CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh $ARCH_FLAGS --prefix=%{prefix} --sysconfdir=%{sysconfdir} +else + CFLAGS="$RPM_OPT_FLAGS" ./configure $ARCH_FLAGS --prefix=%{prefix} --sysconfdir=%{sysconfdir} +fi + +%build +export -n LANG LINGUAS LC_ALL + +if [ "$SMP" != "" ]; then + (make "MAKE=make -k -j $SMP"; exit 0) + make +else + make +fi + +%install +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT +make prefix=$RPM_BUILD_ROOT%{prefix} sysconfdir=$RPM_BUILD_ROOT%{sysconfdir} install + +%clean +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) + +%doc COPYING ChangeLog INSTALL README TODO doc/*.html doc/*.pdf doc/*.ps + +%attr(0755,root,root) %{prefix}/bin/barcode +%attr(0644,root,root) %{prefix}/info/barcode.info* +%attr(0644,root,root) %{prefix}/man/man1/barcode.1* + +%files devel +%attr(0644,root,root) %{prefix}/include/barcode.h +%attr(0644,root,root) %{prefix}/lib/libbarcode.a +%attr(0644,root,root) %{prefix}/man/man3/barcode.3* diff --git a/glabels1/barcode-0.98/bookland/bookland.py b/glabels1/barcode-0.98/bookland/bookland.py new file mode 100644 index 00000000..373587cb --- /dev/null +++ b/glabels1/barcode-0.98/bookland/bookland.py @@ -0,0 +1,884 @@ +#!/usr/local/bin/python + +MYNAME="bookland.py" +MYVERSION="0.92" +COPYRIGHT="(C) 1999-2001 J. Milgram" +DATE = "Jan. 2002" +MAINTAINER = "bookland-bugs@cgpp.com" + +# Copyright (C) 1999,2000 Judah Milgram +# +# bookland.py - generate Bookland EAN symbol for ISBN encoding +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +# +# ============================================================================== +# +# usage: bookland.py [ISBN] [price-code] > output.eps +# +# ISBN - the ISBN, with or without check digit, with or without hyphens. +# default: 1-56592-197-6 ("Programming Python"). If the check digit +# is provided on the command line, it is verified. If not, it is +# calculated. It's up to you to get the hyphenation right - it's +# important, and something the program can't calculate for you. +# +# price - the five digit add-on code. Usually used to indicate the price, +# in which case the first digit indicates the currency (4=$CAN, +# 5=$US, etc.). The remaining digits indicate the price, with +# decimal point assumed to be between the digit 3 and 4. +# For example: $US 6.95 = 50695, $CAN 35.00 = 43500. Instead of a +# price code, a 5 digit add-on ranging from 90000-98999 can be +# used for internal purposes. BISG recommends just using 90000 if +# you don't want to specify a price. Add-ons ranging from 99000 to +# 99999 have been reserved for special use. +# +# An Encapsulated Postscript file (eps) is sent to standard out. This may in turn +# be converted to other formats using the pbmplus package. You may have trouble +# getting the OCRB to map correctly. If you already have the font, you can look in +# the Fontmap file to see what your system calls it, and edit the fontnames accordingly +# (see below). If you don't have it, you might find it on your DOS system. You +# need a .pfa/.pfb (Type 1) or .ttf (TrueType). Your Postscript interpreter might +# or might not be able to deal with TrueType. In any event, in an emergency, you +# might get away with Helvetica. Note that as of 1990 BISG no longer requires the +# ISBN to be printed in OCR-A. +# +# Take the "no-warranty" disclaimer seriously. Going to print with a faulty bar +# can cost you a bundle, and you'll be on your own. It's up to you to verify that +# the symbol is valid. If you need "corporate accountability", try the Book +# Industry Study Group at (212) 929-1393 or the US ISBN Agency at (908) 665-6770 +# and ask for a list of commercial vendors. Outside the US, don't know. +# +# Feedback welcome. If you discover a case where the program generates a faulty +# symbol, I definitely want to hear about it - write me at milgram@cgpp.com or +# P.O. Box 8376, Langley Park, MD 20787, USA +# +# INSTALLATION: +# +# If you have a Python interpreter on your system, you're done. Just put this file +# somewhere in your path and give it execute permission. If you haven't installed +# Python, see http://www.python.org. It has been ported to Macs, DOS, and MS-Windows. +# +# ABOUT THE BOOKLAND EAN +# +# The most difficult part of this project was finding the documents that define +# the Bookland EAN. There appears to be no single, authoritative source that +# provides all the information required. Some good sources: +# +# [1] "Machine-Readable Coding Guidelines for the U.S. Book Industry", Book +# Industry Study Group, New York, Jan., 1992. (212) 929-1393 +# [2] "UPC Symbol Specification Manual", Uniform Code Council Inc., +# Dayton, Ohio, January 1986 (May 1995 Reprint). (937) 435-3870; I found it +# at http://www.uc-council.org/d36-t.htm +# [3] "EAN Identification for Retail/Trade Items", EAN International. I found it +# in Feb. 1999 at http://www.ean.be/html/Numbering.html +# [4] "Hyphenation Instructions", web page at: +# http://www.isbn.org/standards/home/isbn/international/hyphenation-instructions.asp +# +# The starting point of the exercise is the ISBN, assigned by the national ISBN +# Agency. This is a 10 digit number, the last being a check digit. The ISBN is +# converted to a 13 digit EAN number. The first three digits of the EAN-13 indicate +# the country or region. A prefix of 978 has been assigned to books, regardless +# of country of origin (hence, "Bookland") [3]. The remaining ten digits are the +# first 9 digits of the ISBN followed by the EAN-13 check digit. +# +# It seems the EAN-13 check digit can be calculated using the same algorithm as the +# UPC Version A number. Note that the EAN-13 check digit is always between 0 and 9, +# compare with ISBN check digit which can range to 10 ("X"). See Reference [2], +# Section 2 and Appendix G for details of creation of the EAN-13 symbol. Table 2 of +# Appendix G provides a good comparison of the UPC-A and EAN-13 symbols. +# +# The 5 digit add-on (here called, "UPC5") is defined in Ref. [2] Appendix D. +# The ">" to the right of the five digit code serves to enforce the "quiet zone" to +# the right of the bar pattern. Can't remember where I read that. It's probably +# optional. According to [1], in the UK, three horizontal bars appear over price +# add-ons. Haven't implemented that here. The UPC5 encoding is based on UPC-A and +# UPC-E. +# +# According to [2], Section 3, the EAN-13 numbers and 5-digit add-ons are supposed +# to be printed in OCR-B. The ISBN itself is printed above the EAN-13 symbol. At +# one time it was to be printed in OCR-A, but as of 1990 this requirement has been +# dropped [1], and I assume this means you can use any font you like. +# +# SEE ALSO: +# +# "TinyHelp 5 - Making ISBN Barcodes", D. Byram-Wigfield. Another approach to making +# the ISBN barcode symbol. I saw it at +# http://www.cappella.demon.co.uk/index.html/ +# but haven't tried it. +# +# "XBarcode" - nice open-source X-Windows program for generating all sorts of bar codes. +# It does much more than this program, but didn't seem to do the UPC +# 5-digit add-on or do the ISBN->EAN13 calculation (as of v. 2.11). Might +# have made more sense to add this capability, but I needed a Python project. +# In any event, their license forbids distribution in modified form! +# +# HYPHENATION +# +# bookland.py includes automatic hyphenation for ISBN's in group 0 and 1 +# (English-language). This is based on my reading of Ref [4]. If in doubt, +# users can use the "-y" option to force the program to accept the hyphenation +# as input. For other ISBN groups and for ISMN's, no hyphenation is performed +# other than to ensure a hyphen is placed after the group identifier and before +# the check digit. +# +# ABOUT THE ISMN: +# +# See the ISMN Users' Manual, 3rd Edition, 1998, ISBN 3-88053-070-X, published by +# the International ISMN Agency, Staatsbibliothek Preussischer Kulturbesitz, Berlin. +# I found my copy at http://www.ismn.spk-berlin.de/download/ISMNmanual.pdf +# +# An ISMN is just like an ISBN, except: +# - first character is an "M" +# - the "M" counts as a "3" for computing the ISMN check digit (last digit) +# - the checksum weights are 3,1,3,1,3,1,3,1,3, sum to be divisible by "10". This +# means the last character is always a numerical digit, never an "X". +# - the EAN number is "979" plus the *entire* ten character ISMN, except the +# "M" is replaced by "0". Note this means the ISMN checksum is identical to the +# corresponding EAN-13 checksum (excercise left to the reader). +# +# When bookland.py detects an "M" in the first position of the ISBN, it interprets +# it as an ISMN and proceeds accordingly. The 5-digit price code symbol is suppressed. +# +# BAR WIDTH REDUCTIONS +# +# Starting Version 0.92, the widths of the individual bars can be reduced using the +# "-r" option (units are inches). This is to compensate for bleed during printing. +# I don't know when it's a good idea to actually use this; in any event consult with +# your printer first. If not input, it defaults to zero (no reduction). +# +# ABOUT PYTHON +# +# See http://www.python.org +# +# TO DO: +# +# - Generalize to more bar codes, starting with UPC-A and UPC-E. "Plain" EAN13 is +# already built in, could add command line argument to generate that instead of +# Bookland. +# - Make font sizes and placement easier to configure - not sure I have it right. +# Does human-readable 5-digit code take wider font spacing? +# - Clean up bounding box stuff. +# - Bells and whistles. +# - GUI? +# +# HISTORY: +# +# 1/2002 - v 0.92 add ISMN support (thanks to Lars-Henrik Nysten for this suggestion) +# re-wrote bar generation to preclude possibility of white hairlines +# between adjacent black modules. Thanks to Tero Lindfors for +# reporting this bug. +# new -o option to write eps to file rather than stdout +# new -x option for "check only" (verifies check digit) +# new -r option for bar width reduction (compensate for print bleed) +# new -s option to scale module (bar) height (Lars-Henrik Nysten again) +# can suppress UPC-5 price code by entering empty string. (thanks to +# Jacques Du Pasquier for this suggestion) +# re-wrote ISBN/ISMN sanity checks +# lowercase alphas ("x" for ISBN and "m" for ISMN) now ok on input +# fix "long" command line options. +# 10/2001 - v 0.91 add -z option for quiet zone ">" +# add -f option for fonts +# re-write command line parsing to use getopt +# 1/2000 - v 0.09 eliminate use of eval +# 9/99 - v 0.08 accomodate different versions of OCRB by fitting +# all strings to prescribed width. Thanks to Toby Gadd +# for reporting this problem and Peter Deutsch for +# help finding the fix. +# 7/99 -v0.05-0.07 improve error handling. +# 3/27/99 - v0.04 add "--help" and "--version". +# 3/13/99 - v0.03, do a showpage at end (it's allowed) +# fixed checksum calculations for certain cases +# 2/7/99 - v0.02, fixed LH parity pattern for EAN13. It's not the check digit! +# 2/7/99 - initial release +# ================================================================================ + +# +# barCodeSymbol - the whole printed symbol, including bar code(s) and product code(s). +# UPC, UPCA, UPC5, EAN13 - the number itself, with check digit, string representation, +# and barcode bits +# + +import re # we should get rid of regsub and regex in favor of re + # hope there's no conflict. +import string +import sys +import regsub +from regex_syntax import * +import regex +regex.set_syntax(RE_SYNTAX_AWK) +from types import * + +BooklandError = "Something wrong" + + +A="A";B="B";C="C";O="O";E="E" +UPCABITS = [{O:"0001101",E:"1110010"}, + {O:"0011001",E:"1100110"}, + {O:"0010011",E:"1101100"}, + {O:"0111101",E:"1000010"}, + {O:"0100011",E:"1011100"}, + {O:"0110001",E:"1001110"}, + {O:"0101111",E:"1010000"}, + {O:"0111011",E:"1000100"}, + {O:"0110111",E:"1001000"}, + {O:"0001011",E:"1110100"}] +UPCAPARITY = [ "OOOOOOEEEEEE" ] * 10 +UPCEBITS = [{O:"0001101",E:"0100111"}, + {O:"0011001",E:"0110011"}, + {O:"0010011",E:"0011011"}, + {O:"0111101",E:"0100001"}, + {O:"0100011",E:"0011101"}, + {O:"0110001",E:"0111001"}, + {O:"0101111",E:"0000101"}, + {O:"0111011",E:"0010001"}, + {O:"0110111",E:"0001001"}, + {O:"0001011",E:"0010111"}] +# what about UPCEPARITY? Don't need for isbn. +UPC5BITS = UPCEBITS +UPC5PARITY = ["EEOOO","EOEOO","EOOEO","EOOOE","OEEOO", + "OOEEO","OOOEE","OEOEO","OEOOE","OOEOE"] +EAN13BITS = [{A:"0001101", B:"0100111", C:"1110010"}, + {A:"0011001", B:"0110011", C:"1100110"}, + {A:"0010011", B:"0011011", C:"1101100"}, + {A:"0111101", B:"0100001", C:"1000010"}, + {A:"0100011", B:"0011101", C:"1011100"}, + {A:"0110001", B:"0111001", C:"1001110"}, + {A:"0101111", B:"0000101", C:"1010000"}, + {A:"0111011", B:"0010001", C:"1000100"}, + {A:"0110111", B:"0001001", C:"1001000"}, + {A:"0001011", B:"0010111", C:"1110100"}] +EAN13PARITY = map(lambda x: x+"CCCCCC", + ["AAAAAA","AABABB","AABBAB","AABBBA","ABAABB", + "ABBAAB","ABBBAA","ABABAB","ABABBA","ABBABA"]) + +PSFORMAT = "%.6f" +# Default fonts. +# Fonts might have a different name on your system. +# Edit if required. +ISBNFONT = "OCRB" # Doesn't have to be OCR-B +EAN13FONT = "OCRB" +UPC5FONT = "OCRB" + +class psfile: + + def __init__(self): + self.x0 = 100; self.y0 = 100 + self.lines=[] + self.bb=[self.x0,self.y0,self.x0,self.y0] + + def orbb(self,arg): + self.bb[0] = min(self.bb[0],self.x0+arg[0]) + self.bb[1] = min(self.bb[1],self.y0+arg[1]) + self.bb[2] = max(self.bb[2],self.x0+arg[2]) + self.bb[3] = max(self.bb[3],self.y0+arg[3]) + + def translate(self,dx,dy): + self.x0 = self.x0 + dx + self.y0 = self.y0 + dy + return "%d %d translate 0 0 moveto" % (dx,dy) + + def out(self,file=None): + if file: + outfid=open(file,"w") + else: + outfid=sys.stdout + for line in self.lines: + outfid.write("%s\n"%line) + outfid.close() + + def do(self,arg): + self.lines = self.lines + arg + + def setbb(self): + for i in range(len(self.lines)): + if self.lines[i]=="%%BoundingBox: TBD": + self.lines[i]= "%%BoundingBox:" + \ + " %d"%self.bb[0] + \ + " %d"%self.bb[1] + \ + " %d"%self.bb[2] + \ + " %d"%self.bb[3] + return + + def header(self,title,comments,ean13font,isbnfont,upc5font): + for i in range(len(comments)): + comments[i] = regsub.gsub("^","% ",comments[i]) + # There's a more elegant way to do the bounding box line: + return [ "%!PS-Adobe-2.0 EPSF-1.2", + "%%Creator: " + MYNAME + " " + MYVERSION + " " + DATE, + "%%Title: " + title, + "%%BoundingBox: TBD", + "%%EndComments" ] +\ + comments + \ + [ "\n% These font names might be different on your system:", + "/ean13font { /" + ean13font + " findfont 10 scalefont setfont } def", + "/isbnfont { /" + isbnfont + " findfont 8 scalefont setfont } def", + "/upc5font { /" + upc5font +" findfont 14 scalefont setfont } def\n", + "/nextModule { moduleWidth 0 rmoveto } def", + "% The following shenanigans is to deal with different implementations", + "% of same font having different char sizes and spacing.", + "% function fitstring:", + "% usage: width string font fitstring", + "% set font, scaled so that string exactly fits desired width", + "% leave string on stack", + "/fitstring { dup findfont 1 scalefont setfont % w s f", + "3 1 roll % f w s", + "dup stringwidth pop % f w s sw", + "3 2 roll exch div % f s x", + "3 2 roll findfont exch scalefont setfont", + "} def", + "/barHeight { 72 } def", + "/nextModule { moduleWidth 0 rmoveto } def", + "/topcentershow {dup stringwidth pop neg 2 div -9 rmoveto show} def", + "/toprightshow {dup stringwidth pop neg -9 rmoveto show} def", + "/bottomcentershow {dup stringwidth pop neg 2 div 0 rmoveto show} def", + "/bottomrightshow {dup stringwidth pop neg 0 rmoveto show} def", + "/W { moduleWidth mul 0 rmoveto } def", + "/B { dup moduleWidth mul 2 div 0 rmoveto", + "dup moduleWidth mul barWidthReduction sub setlinewidth", + "0 barHeight rlineto 0 barHeight neg rmoveto", + "currentpoint stroke moveto", + "moduleWidth mul 2 div 0 rmoveto } def", + "/L { dup moduleWidth mul 2 div 0 rmoveto", + "dup moduleWidth mul barWidthReduction sub setlinewidth", + "0 -5 rmoveto 0 5 rlineto", + "0 barHeight rlineto 0 barHeight neg rmoveto", + "currentpoint stroke moveto", + "moduleWidth mul 2 div 0 rmoveto } def", + self.x0,self.y0,"translate", + "0 0 moveto" ] + + def trailer(self): + return ["stroke","% showpage supposedly OK in EPS", + "showpage","\n% Good luck!"] + + +class UPC: + + # Includes UPC-A, UPC-E, EAN-13 (sorry), UPC-5 et al. + + def __init__(self,arg): + # arg is a string, either: + # - product code including checksum + # - same, with hyphens (hyphens not verified) + # - same, but with last digit (checksum) dropped, possibly leaving a + # trailing hyphen. + # If checksum is included, it will be verified. + # N.B. "integer" representation is still a string! Just has no hyphens. + + self.s=arg + self.verifyChars(self.s) + self.n = regsub.gsub("-","",self.s) # create "integer" representation + self.x = self.checkDigit(self.n) # always calculate check digit + if len(self.n) == self.ndigits: + self.verifyCheckDigit() # if check digit given, verify it + elif len(self.n) == self.ndigits-1: + self.tackonCheckDigit() # tack on check digit + else: + raise BooklandError, "UPC: wrong number of digits in \"" + self.s + "\"" + + def setbits(self,arg): # UPC (all) + self.bits="" + parityPattern=self.parityPattern() + bitchar=self.bitchar() + for p in range(len(arg)): + digit=int(arg[p]) + # maybe better to define parityPattern with a leading blank? + parity=parityPattern[p] + bit=bitchar[digit][parity] + self.bits=self.bits + bit + + def verifyChars(self,s): # UPC (all) + # Trailing hyphen allowed. + nevergood = "--|^-|[^0-9-]" + ierr=regex.search(nevergood,s) + if ierr != -1: + raise BooklandError, \ + "UPCA: in %s: illegal characters beginning with: %s" % (s,s[ierr]) + + def verifyCheckDigit(self): # UPC (all) + # first verify correct number of digits. + soll=self.checkDigit(self.n) + ist=self.s[-1:] + if ist != soll: + raise BooklandError, "For %s checksum %s is wrong, should be %s" % \ + (self.s,ist,soll) + + def xstring(self,p): # UPC (all) + return "%d" % p + + def tackonCheckDigit(self): + self.n = self.n + self.x # UPC (all) + self.s = self.s + self.x + +class UPCA(UPC): + + def __init__(self,arg): + UPC.__init__(self,arg) + self.setbits(self.n[1:]) # skip first digit + + def parityPattern(self): + return UPCAPARITY[int(self.x)] + def bitchar(self): + return UPCABITS + + def checkDigit(self,arg): # UPCA/EAN13 + weight=[1,3]*6; magic=10; sum = 0 + for i in range(12): # checksum based on first 12 digits. + sum = sum + int(arg[i]) * weight[i] + z = ( magic - (sum % magic) ) % magic + if z < 0 or z >= magic: + raise BooklandError, "UPC checkDigit: something wrong." + return self.xstring(z) + + +class ISBN: + # Includes ISMN, if the plan falls together. + def __init__(self,arg): + self.ndigits=10 # Includes check digit! + self.s=string.upper(arg) + self.n=re.sub("[ -]","",self.s) # "integer" representation + # In ISMN, I allow spaces in place of hyphens. See ISMN User's manual. + if re.match("^M( |-)?\d(( |-)?\d){7,7}(-| )?\d?$",self.s): + # ISMN + self.name="ISMN" + self.n=re.sub("^M","3",self.n) + self.weight=[3,1,3,1,3,1,3,1,3] + self.magic=10 + elif re.match("^\d-?\d(-?\d){7,7}-?(\d|X)?$",self.s): + # ISBN + self.name="ISBN" + self.weight=[10,9,8,7,6,5,4,3,2] + self.magic=11 + else: + raise BooklandError, "%s invalid (hyphenation, characters, or length)" % self.s + self.x = self.checkDigit() + if len(self.n) == self.ndigits: + self.verifyCheckDigit() # if check digit given, verify it + elif len(self.n) == self.ndigits-1: + self.tackonCheckDigit() # tack on check digit + else: + raise BooklandError, "%s failed. Please report as bug" % self.s + + + def checkDigit(self): # ISBN and ISMN; UPCA/EAN13 similar but for weights etc. + # now that we're checking regex's in init, we don't have to check the + # argument at all. (used to check length and bad characters) + sum = 0 + for i in range(9): # checksum based on first nine digits. + sum = sum + int(self.n[i]) * self.weight[i] + z = ( self.magic - (sum % self.magic) ) % self.magic + if z < 0 or z >= self.magic: + raise BooklandError, \ + "%s: checksum %d is wrong - please report as bug" % (self.s,z) + return self.xstring(z) + + def xstring(self,p): + if p == 10: + return "X" + else: + return "%d" % p + + def tackonCheckDigit(self): + if self.s[-1:] == "-": + # Already have a trailing hyphen + self.s = self.s + self.x + else: + self.s = self.s + "-" + self.x + + def verifyCheckDigit(self): # UPC A; EAN13 + # first verify correct number of digits. + soll=self.x + ist=self.s[-1:] + if ist != soll: raise BooklandError, \ + "For %s checksum %s is wrong, should be %s\n" % (self.s,ist,soll) + +class Bar: + # a run of adjacent modules of identical value. + def __init__(self,val): + self.val=val + if not self.val in "L01": + raise BooklandError, "bar bit: %s, pls report as a bug" % self.val + self.width=1 + if self.val=="1": + self.color="Black" + elif self.val=="0": + self.color="White" + elif self.val=="L": + self.color="Long Black" + def __cmp__(self,other): + if self.val==other or (self.val=="L" and other=="1"): + return 0 + else: + return 1 + def inc(self): + self.width=self.width+1 + def pslines(self): + if self.val=="L": + rval = [ "%d L " % self.width ] + elif self.val=="1": + rval = [ "%d B " % self.width ] + else: + rval = [ "%d W " % self.width ] + return rval + def __repr__(self): + return "%s bar of width %d" % (self.color,self.width) + +class barCodeSymbol: + + def __init__(self): + self.patternWidth = len(self.bits)*self.moduleWidth + # Anything else? + + def bitsComment(self): + return [ "%% Bits:\n%% %s" % self.bits ] + + def psbars(self): + # new version, try to prevent all hairlines between adjacent modules. + bars = [] + bar=Bar(self.bits[0]) + for bit in self.bits[1:]: + if bit==bar: + bar.inc() + else: + bars.append(bar) + bar=Bar(bit) + bars.append(bar) + rval = ["0 0 moveto"] + for bar in bars: + rval = rval + bar.pslines() + rval = rval + [ "stroke" ] + return rval + + def psbarsold(self): + psbits=regsub.gsub("1","I ",self.bits) + psbits=regsub.gsub("0","O ",psbits) + psbits=regsub.gsub("L","L ",psbits) + linewidth=50 + p=0; j=linewidth; m=len(psbits); psbarlines=[]; blanks="^ | $" + while p <= m: + j = min(linewidth,m-p) + psbarlines = psbarlines + [ regsub.gsub(blanks,"",psbits[p:p+j]) ] + p=p+linewidth + return [ "0 0 moveto" ] + psbarlines + [ "stroke" ] + + def psSetBarHeight(self): + return [ "/barHeight { " + PSFORMAT % self.moduleHeight + " 72 mul } def" ] + + def psSetBarWidthReduction(self): + return [ "/barWidthReduction { " + \ + PSFORMAT % self.barWidthReduction + " 72 mul } def" ] + + def psSetModuleWidth(self): + rval = [ "/moduleWidth { " + PSFORMAT % self.moduleWidth + " 72 mul } def" ] + return rval + + def psBottomRightText(self,text,font): + # this is specifically for the upc5 price code. + # this is all starting to get messy. + return [ PSFORMAT % self.patternWidth + " 72 mul dup 2 div", + PSFORMAT % self.moduleHeight + " 72 mul 2 add moveto", + "(" + text + ") /" + font + " fitstring bottomcentershow" ] + + def psTopCenterText(self,text,font): + # the text at the top center of the bar pattern (i.e. the ISBN) + return [ PSFORMAT % self.patternWidth + " 72 mul dup 2 div", + PSFORMAT % self.moduleHeight + " 72 mul 3 add moveto", + " (" + text + ") /" + font + " fitstring bottomcentershow" ] + + def psFittedText(self,width,text,font): + return [ PSFORMAT % width + " (" + text + ") " + font + " fitstring" ] + + # This is optional; serves to enforce quiet zone to right of UPC 5 add-on + def psGreaterThan(self,font): + return [ PSFORMAT % self.patternWidth + " 72 mul", + PSFORMAT % self.moduleHeight + " 72 mul 2 add moveto", + "/%s (>) show" % font ] + +class EAN13Symbol(barCodeSymbol): + + def __init__(self,arg,font=EAN13FONT,heightMultiplier=1,barWidthReduction=0): + # arg is a string with the EAN product code + self.barWidthReduction=barWidthReduction + self.ean13 = EAN13(arg) + self.moduleWidth = 0.0130 + specModuleHeight = 1.00 + self.moduleHeight = 1.00 * heightMultiplier + self.bits = self.ean13.bits + barCodeSymbol.__init__(self) + self.font=font + + def bb(self): + return [ -12, -10, self.patternWidth*72+10, self.moduleHeight*72+12 ] + + def pslines(self): + return self.bitsComment() + \ + self.psSetModuleWidth() + \ + self.psSetBarWidthReduction() + \ + self.psSetBarHeight() + \ + self.psbars() + \ + self.psLRDigitLines() + + def psLRDigitLines(self): + # 24 = 3+6*7/2 + # 70 = 3+6*7+4+6*7/2 "4" so we center on the "L" bars (the rightmost of + # the center guard bars is an "O". + # "5" in check digit is the five-module spacing recommended by [2], section 3. + return [ "% We do the left digits first and leave the font scaled", + "% as is for the 9-digit and the right-digits.", + "% EAN13 Left Digits:", + "moduleWidth 24 mul 0 moveto", + "moduleWidth 40 mul (" + self.ean13.leftDigits + ") ", + "/" + self.font + " fitstring topcentershow", + "\n% EAN13 human-readable number", + "% The \"9\" digit (only when encoding ISBN's and ISMN's, I think):", + "-5 0 moveto (" + self.ean13.n[0] + ") toprightshow", + "% EAN13 Right Digits:", + "moduleWidth 70 mul 0 moveto", + "moduleWidth 40 mul (" + self.ean13.rightDigits + ") topcentershow" ] + +class EAN13(UPCA): + + def __init__(self,arg): + self.ndigits=13 # Includes check digit! + UPCA.__init__(self,arg) + leftBits = self.bits[0:42] + rightBits = self.bits[42:] + leftGuard="L0L" + rightGuard="L0L" + center="0L0L0" + self.bits = leftGuard + leftBits + center + rightBits + rightGuard + self.leftDigits = self.n[1:7] + self.rightDigits = self.n[7:13] + + def parityPattern(self): + # N.B. parity pattern based on leftmost digit, the UCC Spec calls this + # the "13th" digit. It's not the check digit! + return EAN13PARITY[int(self.n[0])] + def bitchar(self): + return EAN13BITS + +class UPC5Symbol(barCodeSymbol): + + def __init__(self,arg,heightMultiplier=1,barWidthReduction=0): + # arg is a string with the 5 digit add-on. + self.barWidthReduction=barWidthReduction + self.upc5 = UPC5(arg) + self.moduleWidth = 0.0130 + specModuleHeight = 0.852 + self.moduleHeight = 0.852 * heightMultiplier + self.bits = self.upc5.bits + barCodeSymbol.__init__(self) + + def pslines(self): + return self.bitsComment() + \ + self.psSetModuleWidth() + \ + self.psSetBarHeight() + \ + self.psbars() + + def bb(self): + # Note quiet zone is there even if we don't print the ">". + return [ 0, 0, self.patternWidth*72+10, self.moduleHeight*72+10 ] + +UPC5Error = "Something wrong with 5-digit price code add-on." +class UPC5(UPC): + + def __init__(self,arg): + self.ndigits=5 # Includes check digit! + p=re.search("[^0-9]",arg) + if p: + badchar=arg[p.start()] + raise UPC5Error, "\"%s\" is wrong. The character \"%s\" is not allowed. Price code add-on should contain %d digits and nothing else. Or leave blank to suppress the UPC-5 code." % (arg,badchar,self.ndigits) + elif len(arg) != self.ndigits: + raise UPC5Error, \ + "\"%s\" is wrong. Price code add-on should have exactly %d digits." % (arg,self.ndigits) + UPC.__init__(self,arg) + self.setbits(self.n) + leftGuard="1011" + # no right guard for UPC 5-digit add-on + # Have to insert pesky delineators: + delineator = "01" + self.bits = leftGuard + \ + self.bits[0:7] + delineator + \ + self.bits[7:14] + delineator + \ + self.bits[14:21] + delineator + \ + self.bits[21:28] + delineator + \ + self.bits[28:35] + + def checkDigit(self,arg): # UPC5 + weight=[3,9,3,9,3]; sum = 0 + for i in range(5): + sum = sum + int(arg[i]) * weight[i] + return self.xstring(sum % 10) + + def verifyCheckDigit(self): # UPC2/5 checksum not in number + return + + def parityPattern(self): + return UPC5PARITY[int(self.x)] + def bitchar(self): + return UPC5BITS + +class bookland(barCodeSymbol): + + def __init__(self,isbn,price="",*rest): + + + # Some defaults: + ean13font=EAN13FONT + isbnfont=ISBNFONT + upc5font = UPC5FONT + zone=None + heightMultiplier=1.0 + commandLine="" + barWidthReduction=0 + + # Maybe different fonts: + if len(rest)>0: + font=rest[0] + if font: + ean13font=font + isbnfont=font + upc5font=font + if len(rest)>1: + zone=rest[1] + if len(rest)>2: + heightMultiplier=float(rest[2]) + if len(rest) > 3: + commandLine=rest[3] + if len(rest) > 4: + barWidthReduction=float(rest[4]) + + # Initial setup: + + self.ps = psfile() + self.isbn = ISBN(isbn) + + # Header, EAN13 bars, EAN13 number, and ISBN: + + if self.isbn.name=="ISMN": + self.ean13Symbol = EAN13Symbol("9790"+self.isbn.n[1:9],ean13font,heightMultiplier,barWidthReduction) + elif self.isbn.name=="ISBN": + self.ean13Symbol = EAN13Symbol("978"+self.isbn.n[:9],ean13font,heightMultiplier,barWidthReduction) + else: + raise BooklandError, "Internal error doing %s, please report as bug" % isbn + + self.ps.orbb(self.ean13Symbol.bb()) + comments = ["", + " This is free software and comes with NO WARRANTY WHATSOVER", + " Think twice before going to press with this bar code!", + "", + "Command line: %s" % commandLine, + "" ] + self.ps.lines = self.ps.header(self.isbn.s,comments,ean13font,isbnfont,upc5font) + \ + [ "ean13font" ] + \ + self.ean13Symbol.pslines() +\ + [ "isbnfont" ] + \ + self.ean13Symbol.psTopCenterText("%s %s" % (self.isbn.name,self.isbn.s),isbnfont) + + # 5-digit add-on: (optional for ISBN only) + BLANK=re.compile("^ *$") + if self.isbn.name=="ISBN" and not BLANK.match(price): + # 105 = 95 + 10; 10 = separation (min is 9) + translate=[ self.ps.translate( self.ean13Symbol.moduleWidth * 72 * 105, 0 ) ] + self.upc5Symbol = UPC5Symbol(price,heightMultiplier,barWidthReduction) + self.ps.orbb(self.upc5Symbol.bb()) + self.ps.lines = self.ps.lines + \ + translate + \ + self.upc5Symbol.pslines() + \ + [ "upc5font" ] +\ + self.upc5Symbol.psBottomRightText(price,upc5font) + if zone: self.ps.lines=self.ps.lines + self.upc5Symbol.psGreaterThan(upc5font) + else: + self.ps.lines.append("%% Skipping UPC-5 price code symbol per request") + + self.ps.lines=self.ps.lines + self.ps.trailer() + + # Can now set bounding box. + + self.ps.setbb() + +# Here we go ... + +if __name__ == '__main__': + + def printUsage(): + print "Usage: bookland [-h|--help] [-v|--version] [-x|--check] [-f|--font=] [-s|--height=] [-r|--reduction=] [-o|outfile=] [-z|--quietzone] [| ]" + print "Report bugs to " + MAINTAINER + + def printVersion(): + sys.stderr.write("%s version %s %s.\n" % (MYNAME,MYVERSION,COPYRIGHT)) + sys.stderr.write("Bugs to %s\n" % MAINTAINER) + sys.stderr.write("This is free software and comes with NO WARRANTY\n") + + import getopt + try: + opts,args = getopt.getopt(sys.argv[1:], + "xr:s:uvf:hzo:", + ["reduction=","outfile=","height=","noupc", + "check","version","help","font=","quietzone"]) + except: + printUsage() + sys.exit(0) + + # some initial defaults: + isbn = "1-56592-197-6" # Mark Lutz, "Programming Python", + # O'Reilly, Sebastopol CA, 1996 + price = "90000" + font=None + zone=None + checkonly=None + outfile=None + heightMultiplier=1 + commandLine = string.join(sys.argv) + barWidthReduction = 0 + + # parse command line: + for opt,val in opts: + if opt in ("-v","--version"): + printVersion() + sys.exit(0) + elif opt in ("-h","--help"): + printUsage() + sys.exit(0) + elif opt in ("-f","--font"): + font=val + elif opt in ("-z","--quietzone"): + zone=1 + elif opt in ("-x","--check"): + checkonly=1 + elif opt in ("-s","--height"): + heightMultiplier = float(val) + elif opt in ("-r","--reduction"): + barWidthReduction = val + elif opt in ("-o","--outfile"): + outfile=val + if len(args)==1: + isbn=args[0] + elif len(args)==2: + isbn=args[0] + price=args[1] + + # Do stuff. + + printVersion() + try: + b = bookland(isbn,price,font,zone,heightMultiplier, + commandLine,barWidthReduction) + if not checkonly: b.ps.out(outfile) + if outfile: + sys.stderr.write("Output written to %s\n" % outfile) + except BooklandError, message: + sys.stderr.write(BooklandError + ": " + message + "\n") + sys.exit(1) diff --git a/glabels1/barcode-0.98/cmdline.c b/glabels1/barcode-0.98/cmdline.c new file mode 100644 index 00000000..a69a825b --- /dev/null +++ b/glabels1/barcode-0.98/cmdline.c @@ -0,0 +1,177 @@ +/* + * cmdline.c -- parse a command line using getopt, environment and defaults + * + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Changes: + * Michele Comitini (mcm@glisco.it): better handling of numeric type args. + */ + +#include +#include +#include + +#ifdef NO_GETOPT + /* use replacement */ + #include "compat/getopt.h" +#else + #include +#endif + +#include "cmdline.h" + +/* In case of error, print help string and return error (-1) */ +int commandline_errormsg(FILE *f, struct commandline *args, + char *prgname, char *messagehead) +{ + char *buffer; + char *buffer2; + int len; + struct commandline *ptr; + + if (!messagehead) { + fprintf(f,"%s: Error in cmdline\nPossible options:\n",prgname); + } else { + fprintf(f,"%s: %s",prgname,messagehead); + } + + for (ptr = args; ptr->option; ptr++) { + if (ptr->descrip) { + len = strlen(ptr->descrip); + len += ptr->default_v ? strlen(ptr->default_v) : 6; + len += ptr->env ? strlen(ptr->env) : 6; + buffer2 = malloc(len+3); /* 3 to be safe :) */ + len += 32; + if (buffer2) { + buffer = malloc(len); + if (buffer) { + sprintf(buffer2, ptr->descrip, + ptr->default_v ? ptr->default_v : "(none)", + ptr->env ? ptr->env : "(none)"); + sprintf(buffer, " -%c %s %s", ptr->option, + ptr->type ? "" : " ", buffer2); + fprintf(f, "%s\n",buffer); + free(buffer); + } + free(buffer2); + } + } + } + return -1; +} + +/* + * Associate formats to type. + */ +struct type_fmt { + enum option_type type; + char *fmt; +}; +static struct type_fmt formats[] = { + {CMDLINE_I, "%i%s"}, /* the trailing "%s" is used for error check */ + {CMDLINE_D, "%d%s"}, + {CMDLINE_X, "%x%s"}, + {CMDLINE_O, "%o%s"}, + {CMDLINE_F, "%lf%s"}, + {CMDLINE_P, "%p%s"}, + {0, NULL} /* If we get here, it's CMDLINE_S: no sscanf buf strcpy() */ +}; + + +/* Parse one argument (default or provided) */ +static int commandline_oneopt(struct commandline *ptr, char *value) +{ + struct type_fmt *tptr; + char *trash = value ? strdup(value) : NULL; + + /* convert it, if needed */ + if ((ptr->type != CMDLINE_NONE) && ptr->result) { + for (tptr = formats; tptr->type; tptr++) + if (tptr->type == ptr->type) + break; + if (!tptr->type) /* not found: it is a string */ + *(char **)(ptr->result) = value; + else + if (sscanf(value, tptr->fmt, ptr->result, trash)!=1) { + free(trash); + return -1; + } + } + if (trash) + free(trash); + + if ((ptr->type == CMDLINE_NONE) && ptr->result) /* no type, just count */ + (*(int *)(ptr->result))++; + + /* call the function, if needed */ + if (ptr->fun) { + if (ptr->type) { + if (ptr->result) return ptr->fun(ptr->result); /* converted */ + return ptr->fun(value); /* type, but not converted */ + } + return ptr->fun(NULL); /* no type: just call it */ + } + return 0; +} + +/* The main function */ +int commandline(struct commandline *args, int argc, char **argv, + char *errorhead) +{ + struct commandline *ptr; + char *getopt_desc = (char *)calloc(512, 1); + int desc_offset = 0; + int opt, retval; + char *value; + + /* Build getopt string and process defaults values */ + for (ptr = args; ptr->option; ptr++) { + getopt_desc[desc_offset++] = ptr->option; + if (ptr->type) getopt_desc[desc_offset++] = ':'; + + value = NULL; + if (ptr->env) + value = getenv(ptr->env); + if (!value) + value = ptr->default_v; + if (value && (retval = commandline_oneopt(ptr, value))) { + /* + * if the function returns a specific (not -1) value, it already + * printed its message, so avoid the generic help + */ + if (retval == -1) + commandline_errormsg(stderr, args, argv[0], errorhead); + return retval; + } + } + + /* Run getopt and process material */ + while ((opt = getopt(argc, argv, getopt_desc)) != -1) { + for (ptr = args; ptr->option; ptr++) + if (opt == ptr->option) + break; + if (!ptr->option) /* unknown option */ + return commandline_errormsg(stderr, args, argv[0], errorhead); + if ( (retval = commandline_oneopt(ptr, optarg)) ) { /* wrong arg */ + if (retval == -1) + commandline_errormsg(stderr, args, argv[0], errorhead); + return retval; + } + } + return 0; +} diff --git a/glabels1/barcode-0.98/cmdline.h b/glabels1/barcode-0.98/cmdline.h new file mode 100644 index 00000000..69319915 --- /dev/null +++ b/glabels1/barcode-0.98/cmdline.h @@ -0,0 +1,58 @@ +/* + * cmdline.h -- generic commandline editing (uses getopt, only short) + * + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/* + * The options may have different arguments of different type + */ +enum option_type { + CMDLINE_NONE=0, /* no argument after option */ + CMDLINE_I, /* integer (any base) */ + CMDLINE_D, /* decimal integer */ + CMDLINE_X, /* hex integer */ + CMDLINE_O, /* octal integer */ + CMDLINE_S, /* string */ + CMDLINE_F, /* double float */ + CMDLINE_P, /* pointer */ +}; + + +struct commandline { + int option; /* Single byte: option id */ + int type; /* Type of argument, used in sscanf */ + void *result; /* Store data here, if non null */ + int (*fun)(void *); /* Call if defined: arg is "result" or input string */ + char *env; /* Where to get runtime defaults, may be NULL */ + char *default_v; /* The compile-time default, may be NULL */ + char *descrip; /* For err msg. May have %s's for default and env */ +}; + +/* returns: 0 or -1. "optarg" is global (see getopt) */ +extern int commandline(struct commandline *args, + int argc, char **argv, char *errorhead); + +/* prints an error message based on "args" */ +extern int commandline_errormsg(FILE *f, struct commandline *args, + char *prgname, char *messagehead); + + + + diff --git a/glabels1/barcode-0.98/codabar.c b/glabels1/barcode-0.98/codabar.c new file mode 100644 index 00000000..7065b9ea --- /dev/null +++ b/glabels1/barcode-0.98/codabar.c @@ -0,0 +1,182 @@ +/* + * codabar.c -- encoding for Codabar + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789" "-$:/.+ABCD"; + +#define CODE_A 16 +#define CODE_B 17 + +#define NARROW 12 +#define WIDE 14 + +/* Patterns */ +static char *patterns[] = { +"1111133","1111331","1113113","3311111","1131131", +"3111131","1311113","1311311","1331111","3113111", +"1113311","1133111","3111313","3131113","3131311", +"1131313","1133131","1313113","1113133","1113331" }; + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it. + * If the first character is a letter (A to D), the last one must be too; + * no other character should be a letter. + */ +int Barcode_cbr_verify(unsigned char *text) +{ + int i, lower=0, upper=0; + int startpresent = 0; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + char * pos; + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + pos = strchr(alphabet,toupper(text[i])); + if (!pos) + return -1; + if (i == 0 && pos - alphabet >= CODE_A) + startpresent = 1; + else if (pos - alphabet >= CODE_A && + (!startpresent || i != strlen(text) - 1)) + return -1; + } + if (lower && upper) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr,"1%s", /* separator */ patterns[code]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_cbr_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + int i, code, textpos, usesum, checksum = 0, startpresent; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("codabar"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 8 * (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 3) * 8 + 2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * (strlen + check) +term */ + textinfo = malloc(10*(strlen(text) + 1) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + ptr = partial; + textptr = textinfo; + textpos = 0; + usesum = bc->flags & BARCODE_NO_CHECKSUM ? 0 : 1; + /* if no start character specified, A is used as a start character */ + if (!isalpha(text[0])) { + add_one(ptr, CODE_A); + ptr += strlen(ptr); + textpos = WIDE; + checksum = CODE_A; + startpresent = 0; + } else { + startpresent = 1; + } + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + textpos += code < 12 ? NARROW : WIDE; + textptr += strlen(textptr); + ptr += strlen(ptr); + checksum += code; + if (startpresent && usesum && i == strlen(text) - 2) { + /* stuff a check symbol before the stop */ + c = strchr(alphabet, toupper(text[i+1])); + if (!c) /* impossible */ + continue; + code = c - alphabet; + checksum += code; + + /* Complement to a multiple of 16 */ + checksum = (checksum + 15) / 16 * 16 - checksum; + add_one(ptr, checksum); + ptr += strlen(ptr); + } + } + if (!startpresent) { + if (usesum) { + /* if no start character specified, B is used as a stop char */ + checksum += CODE_B; + checksum = (checksum + 15) / 16 * 16 - checksum; + add_one(ptr, checksum); + ptr += strlen(ptr); + } + add_one(ptr, CODE_B); + } + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels1/barcode-0.98/code128.c b/glabels1/barcode-0.98/code128.c new file mode 100644 index 00000000..cebba54c --- /dev/null +++ b/glabels1/barcode-0.98/code128.c @@ -0,0 +1,607 @@ +/* + * code128.c -- encoding for code128 (A, B, C) + * + * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +static char *codeset[] = { + "212222", "222122", "222221", "121223", "121322", /* 0 - 4 */ + "131222", "122213", "122312", "132212", "221213", + "221312", "231212", "112232", "122132", "122231", /* 10 - 14 */ + "113222", "123122", "123221", "223211", "221132", + "221231", "213212", "223112", "312131", "311222", /* 20 - 24 */ + "321122", "321221", "312212", "322112", "322211", + "212123", "212321", "232121", "111323", "131123", /* 30 - 34 */ + "131321", "112313", "132113", "132311", "211313", + "231113", "231311", "112133", "112331", "132131", /* 40 - 44 */ + "113123", "113321", "133121", "313121", "211331", + "231131", "213113", "213311", "213131", "311123", /* 50 - 54 */ + "311321", "331121", "312113", "312311", "332111", + "314111", "221411", "431111", "111224", "111422", /* 60 - 64 */ + "121124", "121421", "141122", "141221", "112214", + "112412", "122114", "122411", "142112", "142211", /* 70 - 74 */ + "241211", "221114", "413111", "241112", "134111", + "111242", "121142", "121241", "114212", "124112", /* 80 - 84 */ + "124211", "411212", "421112", "421211", "212141", + "214121", "412121", "111143", "111341", "131141", /* 90 - 94 */ + "114113", "114311", "411113", "411311", "113141", + "114131", "311141", "411131", "b1a4a2", "b1a2a4", /* 100 - 104 */ + "b1a2c2", "b3c1a1b" +}; + +#define START_A 103 +#define START_B 104 +#define START_C 105 +#define STOP 106 +#define SHIFT 98 /* only A and B */ +#define CODE_A 101 /* only B and C */ +#define CODE_B 100 /* only A and C */ +#define CODE_C 99 /* only A and B */ +#define FUNC_1 102 /* all of them */ +#define FUNC_2 97 /* only A and B */ +#define FUNC_3 96 /* only A and B */ +/* FUNC_4 is CODE_A when in A and CODE_B when in B */ + +#define SYMBOL_WID 11 /* all of them are 11-bar wide */ + +/* + * code 128-b includes all printable ascii chars + */ + +int Barcode_128b_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + while (*text && *text>=32 && !(*text&0x80)) + text++; + if (*text) + return -1; /* a non-ascii char */ + return 0; /* ok */ +} + +int Barcode_128b_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, code, textpos, checksum = 0; + + 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-B"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 6* (head + text + check + tail) + final + term. */ + partial = malloc( (strlen(text) + 4) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + /* up to now, it was the same code as other encodings */ + + strcpy(partial, "0"); /* the first space */ + strcat(partial, codeset[START_B]); + checksum += START_B; /* the start char is counted in the checksum */ + textptr = textinfo; + textpos = SYMBOL_WID; + + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = text[i]-32; + strcat(partial, codeset[code]); + checksum += code * (i+1); /* first * 1 + second * 2 + third * 3... */ + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + +/* + * code 128-c is only digits, but two per symbol + */ + +int Barcode_128c_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + /* must be an even number of digits */ + if (strlen(text)%2) + return -1; + /* and must be all digits */ + for (; *text; text++) + if (!isdigit(*text)) + return -1; + return 0; +} + +int Barcode_128c_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, code, textpos, checksum = 0; + + 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-C"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 6* (head + text + check + tail) + final + term. */ + partial = malloc( (strlen(text) + 3) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn.5:fff:c " * strlen +term */ + textinfo = malloc(12*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, "0"); /* the first space */ + strcat(partial, codeset[START_C]); + checksum += START_C; /* the start char is counted in the checksum */ + textptr = textinfo; + textpos = SYMBOL_WID; + + for (i=0; text[i]; i+=2) { + if (!isdigit(text[i]) || !isdigit(text[i+1])) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = (text[i]-'0') * 10 + text[i+1]-'0'; + strcat(partial, codeset[code]); + checksum += code * (i/2+1); /* first * 1 + second * 2 + third * 3... */ + + /* print as "%s", because we have ".5" positions */ + sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, text[i], + textpos + (double)SYMBOL_WID/2, text[i+1]); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + 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 (text[0] == '\0') + 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 */ +} + +/* code is either 'A' or 'B', and value must be valid */ +static int Barcode_encode_as(int code, int value) +{ + + /* first check the special chars */ + 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; + } + + /* then check ascii values */ + 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 */ + /* 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 (s[2]=='\0' && isdigit(s[0]) && isdigit(s[1])) { + code = 'C'; + } else 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; + + /* the partial code is 6*codelen + ini + term (+margin) */ + partial = malloc( 6 * len + 4); + if (!partial) { + bc->error = 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; + + for (i=0; i 0xc0) c = ' '; /* F code */ + sprintf(textptr, "%g:%g:%c ", textpos, size, c); + textptr += strlen(textptr); + textpos += step; + } + + bc->partial = partial; + bc->textinfo = textinfo; + free(codes); + return 0; +} + +/* + * A raw 128 code is given as a sequence of space separated numbers + * from 0 to 105, starting from the start code to be (Leonid) + */ + +int Barcode_128raw_verify(unsigned char *text) +{ + int n; + unsigned val; + + if (!strlen(text)) + return -1; + while (*text) { + if (sscanf(text, "%u%n", &val, &n) < 1) + return -1; + if (val > 105) + return -1; + text += n; + } + return 0; +} + +int Barcode_128raw_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, n, count, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("128raw"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* + * length of partial code is unknown in advance, but it is + * at most 6* (1+text/2 + check + tail) + final + terminator + */ + partial = malloc( (3+ strlen(text)/2) * 6 + 2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn.5:fff:c " * 1+strlen/2 +term */ + textinfo = malloc(12 * (1+strlen(text)/2) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, "0"); /* the first space */ + textptr = textinfo; + textpos = 0; + + for (i=0, count = 0; i < strlen(text); count++) { + if (sscanf(text + i, "%u%n", &code, &n) < 1) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + strcat(partial, codeset[code]); + + /* + * since the start code is part of the "raw" input, it is + * counted in the checksum by itself + */ + if (!count) checksum += code; /* the start code */ + else checksum += code * count; /* first * 1 + second * 2 ... */ + + /* + * print as "%s", because we have ".5" positions + * also, use a size of 9 like codeC above, as each symbol is + * represented by two chars + */ + sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, + code >= 100 ? 'A' : code/10 + '0', + textpos + (double)SYMBOL_WID/2, code%10 + '0'); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + i += n; + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + diff --git a/glabels1/barcode-0.98/code39.c b/glabels1/barcode-0.98/code39.c new file mode 100644 index 00000000..3308c950 --- /dev/null +++ b/glabels1/barcode-0.98/code39.c @@ -0,0 +1,173 @@ +/* + * code39.c -- encoding for code39 + * + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "1234567890" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. *" "$/+%"; + +/* the checksum alphabet has a different order */ +static char checkbet[] = + "0123456789" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. $" "/+%"; + +/* The first 40 symbols repeat this bar pattern */ +static char *bars[] = { + "31113","13113","33111","11313","31311", + "13311","11133","31131","13131","11331"}; + +/* The first 4 decades use these space patterns */ +static char *spaces[] = {"1311","1131","1113","3111"}; + +/* the last four symbols are special */ +static char *specialbars[] = { + "11111","11111","11111","11111"}; + +static char *specialspaces[] = { + "3331","3313","3133","1333"}; + +static char *fillers[]= { + "0a3a1c1c1a", + "1a3a1c1c1a" +}; + + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it + */ +int Barcode_39_verify(unsigned char *text) +{ + int i, lower=0, upper=0; + + if (text[0] == '\0') + return -1; + for (i=0; text[i]; i++) { + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + if (!strchr(alphabet,toupper(text[i]))) + return -1; + } + if (lower && upper) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + char *b, *s; + + if (code < 40) { + b = bars[code%10]; + s = spaces[code/10]; + } else { + b = specialbars[code-40]; + s = specialspaces[code-40]; + } + sprintf(ptr,"1%c%c%c%c%c%c%c%c%c", /* separator */ + b[0], s[0], b[1], s[1], b[2], s[2], + b[3], s[3], b[4]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_39_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + int i, code, textpos, checksum = 0; + + 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 39"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 10* (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 3) * 10 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = 22; + + for (i=0; text[i]; i++) { + c = strchr(alphabet, toupper(text[i])); + if (!c) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + c = strchr(checkbet,*c); + if (c) /* the '*' is not there */ + checksum += (c-checkbet); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + + textpos += 16; /* width of each code */ + textptr += strlen(textptr); + ptr += strlen(ptr); + } + /* Add the checksum */ + if ( (bc->flags & BARCODE_NO_CHECKSUM)==0 ) { + code = (strchr(alphabet, checkbet[checksum % 43]) - alphabet); + add_one(ptr, code); + } + strcat(ptr, fillers[1]); /* end */ + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels1/barcode-0.98/code93.c b/glabels1/barcode-0.98/code93.c new file mode 100644 index 00000000..73f8cee3 --- /dev/null +++ b/glabels1/barcode-0.98/code93.c @@ -0,0 +1,213 @@ +/* + * code39.c -- encoding for code39 + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2001 Nathan D. Holmes / FedEx Services (ndholmes@fedex.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; + +static char *codeset[] = { + "131112", "111213", "111312", "111411", "121113", /* 0 - 4 */ + "121212", "121311", "111114", "131211", "141111", /* 5 - 9 */ + "211113", "211212", "211311", "221112", "221211", /* A - E */ + "231111", "112113", "112212", "112311", "122112", /* F - J */ + "132111", "111123", "111222", "111321", "121122", /* K - O */ + "131121", "212112", "212211", "211122", "211221", /* P - T */ + "221121", "222111", "112122", "112221", "122121", /* U - Y */ + "123111", "121131", "311112", "311211", "321111", /* Z - $ */ + "112131", "113121", "211131", "121221", "312111", /* / - (%) */ + "311121", "122211", "111141" /* (/) - (terminator) */ +}; + + +/* 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111 */ +/* 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222 */ +/* 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 */ +static char shiftset[] = + "%$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%% /// ///// / /%%%%%% %%%%%%++++++++++++++++++++++++++%%%%%"; +static char shiftset2[] = + "UABCDEFGHIJKLMNOPQRSTUVWXYZABCDE ABC FGHIJ L ZFGHIJV KLMNOWABCDEFGHIJLKMNOPQRSTUVWXYZPQRST"; + +#define START_STOP 47 +#define EXTEND_DOLLAR 43 +#define EXTEND_PERCENT 44 +#define EXTEND_SLASH 45 +#define EXTEND_PLUS 46 + +/* + * Check that the text can be encoded. Returns 0 or -1. + * All of ASCII-7 is accepted. + */ +int Barcode_93_verify(unsigned char *text) +{ + int i; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + + /* Test if beyond the range of 7-bit ASCII */ + if ((int)text[i] > 127) + return -1; + } + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_93_encode(struct Barcode_Item *bc) +{ + static unsigned char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *textptr; + int *checksum_str; + int i, code, textpos, checksum_len=0; + int c_checksum = 0; + int k_checksum = 0; + + 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 93"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + + /* the partial code is 6 * (head + 2* text + 2* check + tail) + margin + term. */ + partial = malloc( (strlen(text) *2 + 4) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + checksum_str = (int *)malloc( (strlen(text) + 3) * 2 * sizeof(int)); + if (!checksum_str) { + free(partial); + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(checksum_str); + return -1; + } + + textptr = textinfo; + textpos = 22; + strcpy(partial, "0"); + strcat(partial, codeset[START_STOP]); + + for (i=0; iflags & BARCODE_NO_CHECKSUM)==0 ) + { + for(i=1; i<=checksum_len; i++) + { + c_checksum += i * (int)checksum_str[checksum_len - i]; + k_checksum += (i+1) * (int)checksum_str[checksum_len - i]; + } + + c_checksum = c_checksum % 47; + k_checksum += c_checksum; + k_checksum = k_checksum % 47; + + strcat(partial, codeset[c_checksum]); + strcat(partial, codeset[k_checksum]); + + } + strcat(partial, codeset[START_STOP]); /* end */ + + /* Encodes final 1-unit width bar to turn the start character into a stop char */ + strcat(partial, "1"); + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels1/barcode-0.98/compat/getopt.c b/glabels1/barcode-0.98/compat/getopt.c new file mode 100644 index 00000000..91f00b55 --- /dev/null +++ b/glabels1/barcode-0.98/compat/getopt.c @@ -0,0 +1,831 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in . + Ditto for AIX 3.2 and . */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +#include +#endif + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include +#if defined (_LIBC) || defined (HAVE_UNISTD_H) +#include +#endif +#endif /* GNU C library. */ + +#ifdef VMS +#include +#if HAVE_STRING_H - 0 +#include +#endif +#endif + +#ifdef WIN32 +/* It's not Unix, really. See? Capital letters. */ +#include +#define getpid() GetCurrentProcessId() +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +#ifdef HAVE_LIBINTL_H +# include +# define _(msgid) gettext (msgid) +#else +# define _(msgid) (msgid) +#endif +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* XXX 1003.2 says this must be 1 before any call. */ +int optind = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include +#define my_index strchr +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +#if !defined (__STDC__) || !__STDC__ +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +#endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +static const char *nonoption_flags; +static int nonoption_flags_len; + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined (__STDC__) && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined (__STDC__) && __STDC__ +static const char *_getopt_initialize (const char *); +#endif +static const char * +_getopt_initialize (optstring) + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind = 1; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + + if (posixly_correct == NULL) + { + /* Bash 2.0 puts a special variable in the environment for each + command it runs, specifying which ARGV elements are the results of + file name wildcard expansion and therefore should not be + considered as options. */ + char var[100]; + sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ()); + nonoption_flags = getenv (var); + if (nonoption_flags == NULL) + nonoption_flags_len = 0; + else + nonoption_flags_len = strlen (nonoption_flags); + } + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns `EOF'. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0) + { + optstring = _getopt_initialize (optstring); + optind = 1; /* Don't scan ARGV[0], the program name. */ + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. */ +#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && nonoption_flags[optind] == '1')) + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return EOF; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return EOF; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + +#ifdef lint /* Suppress `used before initialized' warning. */ + indfound = 0; +#endif + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if (nameend - nextchar == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == EOF) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/glabels1/barcode-0.98/compat/getopt.h b/glabels1/barcode-0.98/compat/getopt.h new file mode 100644 index 00000000..952f4830 --- /dev/null +++ b/glabels1/barcode-0.98/compat/getopt.h @@ -0,0 +1,129 @@ +/* Declarations for getopt. + Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/glabels1/barcode-0.98/configure b/glabels1/barcode-0.98/configure new file mode 100755 index 00000000..aebdc4d5 --- /dev/null +++ b/glabels1/barcode-0.98/configure @@ -0,0 +1,1626 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=barcode.h + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:527: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:556: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:604: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:638: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:643: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:667: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:697: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:753: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +if test x$GCC = xyes; then + CFLAGS="$CFLAGS -Wall" +fi + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:809: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +ac_safe=`echo "getopt.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for getopt.h""... $ac_c" 1>&6 +echo "configure:871: checking for getopt.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +NO_GETOPT=-DNO_GETOPT;GETOPT_O=compat/getopt.o +fi + +ac_safe=`echo "paper.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for paper.h""... $ac_c" 1>&6 +echo "configure:905: checking for paper.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:915: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBPAPER=-lpaper +else + echo "$ac_t""no" 1>&6 +NO_LIBPAPER=-DNO_LIBPAPER +fi + +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:941: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for strerror""... $ac_c" 1>&6 +echo "configure:979: checking for strerror" >&5 +if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_strerror) || defined (__stub___strerror) +choke me +#else +strerror(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_strerror=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_strerror=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'strerror`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +NO_STRERROR=-DNO_STRERROR +fi + +for ac_func in strcasecmp +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1030: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking "for gmake"""... $ac_c" 1>&6 +echo "configure:1084: checking "for gmake"" >&5 +GMAKE=no +${MAKE=make} --version 2> /dev/null | grep GNU > /dev/null && GMAKE=yes +echo "$ac_t""$GMAKE" 1>&6 +if test "$GMAKE" = "yes"; then + GMAKEDEPEND0='ifeq (.depend,$(wildcard .depend))' + GMAKEDEPEND1='include .depend' + GMAKEDEPEND2='endif' +fi + +echo $ac_n "checking "if makeinfo can output html"""... $ac_c" 1>&6 +echo "configure:1095: checking "if makeinfo can output html"" >&5 +MAKEINFOHTML=no +${MAKEINFO=makeinfo} --help | grep .--html > /dev/null && MAKEINFOHTML=yes +echo "$ac_t""$MAKEINFOHTML" 1>&6 +if test "$MAKEINFOHTML" = "yes"; then + REMOVEHTMLTAGS="cat" + INFOTOHTML="$MAKEINFO --html" +else + REMOVEHTMLTAGS="sed 's/ifnottex/ifinfo/; s/ifnotinfo/iftex/'" + INFOTOHTML="perl texi2html -monolithic" +fi + + + + + + + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@RANLIB@%$RANLIB%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CPP@%$CPP%g +s%@GETOPT_O@%$GETOPT_O%g +s%@NO_GETOPT@%$NO_GETOPT%g +s%@NO_LIBPAPER@%$NO_LIBPAPER%g +s%@LIBPAPER@%$LIBPAPER%g +s%@NO_STRERROR@%$NO_STRERROR%g +s%@GMAKEDEPEND0@%$GMAKEDEPEND0%g +s%@GMAKEDEPEND1@%$GMAKEDEPEND1%g +s%@GMAKEDEPEND2@%$GMAKEDEPEND2%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "doc/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@MAKEINFO@%$MAKEINFO%g +s%@REMOVEHTMLTAGS@%$REMOVEHTMLTAGS%g +s%@INFOTOHTML@%$INFOTOHTML%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + diff --git a/glabels1/barcode-0.98/configure.in b/glabels1/barcode-0.98/configure.in new file mode 100644 index 00000000..07120b48 --- /dev/null +++ b/glabels1/barcode-0.98/configure.in @@ -0,0 +1,65 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(barcode.h) +AC_PREREQ(2.12) + +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_INSTALL + +dnl Add "-Wall" if this is gcc +if test x$GCC = xyes; then + CFLAGS="$CFLAGS -Wall" +fi + + +dnl Check for getopt and libpaper. If getopt is missing, use our version +AC_CHECK_HEADER(getopt.h, ,NO_GETOPT=-DNO_GETOPT;GETOPT_O=compat/getopt.o) +AC_CHECK_HEADER(paper.h, LIBPAPER=-lpaper, NO_LIBPAPER=-DNO_LIBPAPER) +AC_CHECK_HEADERS(unistd.h) + +AC_CHECK_FUNC(strerror, , NO_STRERROR=-DNO_STRERROR) +AC_CHECK_FUNCS(strcasecmp) + +dnl Check if this is gmake, but allow ovverriding using $MAKE +AC_MSG_CHECKING("for gmake") +GMAKE=no +${MAKE=make} --version 2> /dev/null | grep GNU > /dev/null && GMAKE=yes +AC_MSG_RESULT($GMAKE) +if test "$GMAKE" = "yes"; then + GMAKEDEPEND0='ifeq (.depend,$(wildcard .depend))' + GMAKEDEPEND1='include .depend' + GMAKEDEPEND2='endif' +fi + +dnl Check if we use makeinfo or the local texi2html tool +AC_MSG_CHECKING("if makeinfo can output html") +MAKEINFOHTML=no +${MAKEINFO=makeinfo} --help | grep .--html > /dev/null && MAKEINFOHTML=yes +AC_MSG_RESULT($MAKEINFOHTML) +if test "$MAKEINFOHTML" = "yes"; then + REMOVEHTMLTAGS="cat" + INFOTOHTML="$MAKEINFO --html" +else + REMOVEHTMLTAGS="sed 's/ifnottex/ifinfo/; s/ifnotinfo/iftex/'" + INFOTOHTML="perl texi2html -monolithic" +fi + + +AC_SUBST(GETOPT_O) +AC_SUBST(NO_GETOPT) +AC_SUBST(NO_LIBPAPER) +AC_SUBST(LIBPAPER) +AC_SUBST(NO_STRERROR) +AC_SUBST(GMAKEDEPEND0) +AC_SUBST(GMAKEDEPEND1) +AC_SUBST(GMAKEDEPEND2) + +AC_OUTPUT(Makefile) + +AC_SUBST(MAKEINFO) +AC_SUBST(REMOVEHTMLTAGS) +AC_SUBST(INFOTOHTML) + +AC_OUTPUT(doc/Makefile) + diff --git a/glabels1/barcode-0.98/contrib/barcode-SVG.tar.gz b/glabels1/barcode-0.98/contrib/barcode-SVG.tar.gz new file mode 100644 index 00000000..69df9562 Binary files /dev/null and b/glabels1/barcode-0.98/contrib/barcode-SVG.tar.gz differ diff --git a/glabels1/barcode-0.98/contrib/barcode-SVG.tar.gz.README b/glabels1/barcode-0.98/contrib/barcode-SVG.tar.gz.README new file mode 100644 index 00000000..1608ebaf --- /dev/null +++ b/glabels1/barcode-0.98/contrib/barcode-SVG.tar.gz.README @@ -0,0 +1,24 @@ + +[readme written by GNU-barcode maintainer] + +This is a stripped version of what you can find at: + http://www.onefour.net/barcode/SVG/barcode097-SVG.tar.gz + +It's by David J. Humphreys, it's GPL code and the original tarball +(as per the previous URL) contains: + +-rwxr--r-- david/david 243 2002-01-02 04:18:00 Makefile +-rwxr--r-- david/david 1284 2002-01-08 00:26:42 main.c +-rwxr--r-- david/david 37796 2002-01-02 04:33:00 screen1.png +-rwxr--r-- david/david 5503 2002-01-08 00:30:00 svg.c +-rwxr--r-- david/david 2499 2002-01-02 03:37:00 test1.svg +-rwxr--r-- david/david 2499 2002-01-02 03:44:00 test2.svg +-rwxr--r-- david/david 2499 2002-01-02 03:49:00 test3.svg +-rwxr--r-- david/david 34185 2002-01-02 04:41:00 test4.png +-rwxr--r-- david/david 1834 2002-01-02 04:19:00 test4.svg +-rwxr--r-- david/david 92713 2002-01-02 04:36:00 transformation.png +-rwxr--r-- david/david 586 2002-01-02 04:11:00 transformation.svg + +Here I only included Makefile, main.c, svg.c, after converting +newlines to unix-style and changing permissions. + diff --git a/glabels1/barcode-0.98/contrib/barcode-for-delphi.tar.gz b/glabels1/barcode-0.98/contrib/barcode-for-delphi.tar.gz new file mode 100644 index 00000000..cbc8e676 Binary files /dev/null and b/glabels1/barcode-0.98/contrib/barcode-for-delphi.tar.gz differ diff --git a/glabels1/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README b/glabels1/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README new file mode 100644 index 00000000..36d216d7 --- /dev/null +++ b/glabels1/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README @@ -0,0 +1,10 @@ + +The barcode-for-delphi tarball includes a version of this package +ported to run under Delphi. Please note that you can't distribute the +executable because of the GPL (i.e., disitributing it would be +copyright violation, because the executable is a derived work of GNU +barcode, whose authors don't allow distributing under non-GPL terms. + +I still think it may be useful to some users. + +The code has been contributed by Michael Geddes . diff --git a/glabels1/barcode-0.98/contrib/barcodeps-0.1.tgz b/glabels1/barcode-0.98/contrib/barcodeps-0.1.tgz new file mode 100644 index 00000000..1dadb1c6 Binary files /dev/null and b/glabels1/barcode-0.98/contrib/barcodeps-0.1.tgz differ diff --git a/glabels1/barcode-0.98/contrib/barcodeps-0.1.tgz.README b/glabels1/barcode-0.98/contrib/barcodeps-0.1.tgz.README new file mode 100644 index 00000000..b0364f6e --- /dev/null +++ b/glabels1/barcode-0.98/contrib/barcodeps-0.1.tgz.README @@ -0,0 +1,25 @@ + + ***** barcodeps 0.1 ***** + 2000-10-07 + +Barcodes generated in PostScript +by Hans Schou http://www.schou.dk + +PostScript is a programming language. It has all the control structures +needed for creating barcodes on the fly. With this example it is not +needed to have another programming language than PostScript as the +barcodes are generated within the PostScript printer. + +This contribution gives some examples of how to generate Interleave 2 of 5 +barcodes. Edit the bottom of i25.ps with a new number and send it to +a PostScript printer to see an example. + +Usage, in PostScript: +To draw a Interleave 2 of 5 use the following command in i25.ps + (123456789) BarCodeI25 + +This method is very usefull used together with other scripts +or programming language as it is only necessary to copy some +files to the printer. No program execution is needed. + + diff --git a/glabels1/barcode-0.98/contrib/grab-0.0.4.tar.gz b/glabels1/barcode-0.98/contrib/grab-0.0.4.tar.gz new file mode 100644 index 00000000..91fa9e6a Binary files /dev/null and b/glabels1/barcode-0.98/contrib/grab-0.0.4.tar.gz differ diff --git a/glabels1/barcode-0.98/contrib/grab-0.0.4.tar.gz.README b/glabels1/barcode-0.98/contrib/grab-0.0.4.tar.gz.README new file mode 100644 index 00000000..4a048075 --- /dev/null +++ b/glabels1/barcode-0.98/contrib/grab-0.0.4.tar.gz.README @@ -0,0 +1,13 @@ + +The purpose of this program is to read a (scanned) image containing a +barcode. The image is then interpreted and the barcode is decoded. +The decoded string is outputted to stdout. + +Currently, only Code-128 is supported. + +The program is GPL'd and it's the work of Tuukka Toivonen. + +The home page for this and other programs by Tuukka is + http://www.ee.oulu.fi/~tuukkat/releases.html +while a bare ls-like listing of all packages is at + http://www.ee.oulu.fi/~tuukkat/rel/ diff --git a/glabels1/barcode-0.98/debian/README.debian b/glabels1/barcode-0.98/debian/README.debian new file mode 100644 index 00000000..7223023a --- /dev/null +++ b/glabels1/barcode-0.98/debian/README.debian @@ -0,0 +1,9 @@ +The Debian Package barcode +---------------------------- + +This Debian package is integrated in the upstream release of GNU +barcode, maintained by Alessandro Rubini (rubini@gnu.org, +rubini@prosa.it). Since I have no extended experience with Debian +packages, I'm willing to accept any fixes that seem fit, as well as a +real Debian maintainer for the Debian package. + diff --git a/glabels1/barcode-0.98/debian/changelog b/glabels1/barcode-0.98/debian/changelog new file mode 100644 index 00000000..b43e686f --- /dev/null +++ b/glabels1/barcode-0.98/debian/changelog @@ -0,0 +1,27 @@ +barcode (0.98) unstable; urgency=low + + * New upstream release + + -- Alessandro Rubini Fri, 1 Mar 2002 23:04:14 +0100 + +barcode (0.96) unstable; urgency=low + + * New upstream release + + -- Alessandro Rubini Wed, 8 Nov 2000 18:29:18 +0200 + +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. + + -- Alessandro Rubini Sun, 24 Oct 1999 01:10:23 +0200 + +Local variables: +mode: debian-changelog +End: diff --git a/glabels1/barcode-0.98/debian/control b/glabels1/barcode-0.98/debian/control new file mode 100644 index 00000000..aacbfd49 --- /dev/null +++ b/glabels1/barcode-0.98/debian/control @@ -0,0 +1,14 @@ +Source: barcode +Section: misc +Priority: optional +Maintainer: Alessandro Rubini +Standards-Version: 2.5.0 + +Package: barcode +Architecture: any +Depends: ${shlibs:Depends} +Description: Creates barcodes in .ps format + GNU barcode can create printouts for the conventional + product packagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, code 39 + code 128 (b and c), and interleaved 2 of 5 . Ouput is generated as + either Postscript or Encapsulated Postscript. diff --git a/glabels1/barcode-0.98/debian/copyright b/glabels1/barcode-0.98/debian/copyright new file mode 100644 index 00000000..c193af2c --- /dev/null +++ b/glabels1/barcode-0.98/debian/copyright @@ -0,0 +1,8 @@ +This package was written by Alessandro Rubini rubini@gnu.org on Sun, 24 Oct 1999 01:10:23 +0200. + +The pristine source can be downloaded from ftp://ftp.gnu.org/pub/barcode +and GNU mirrors. Latest and greatest version (also beta) are immediately +uploaded to ftp://ftp.prosa.it/pub/software. + +Copyright: GPL (see /usr/doc/copyright/GPL) + diff --git a/glabels1/barcode-0.98/debian/dirs b/glabels1/barcode-0.98/debian/dirs new file mode 100644 index 00000000..6822e402 --- /dev/null +++ b/glabels1/barcode-0.98/debian/dirs @@ -0,0 +1,3 @@ +usr/bin +usr/include +usr/info diff --git a/glabels1/barcode-0.98/debian/info b/glabels1/barcode-0.98/debian/info new file mode 100644 index 00000000..18336bfb --- /dev/null +++ b/glabels1/barcode-0.98/debian/info @@ -0,0 +1,15 @@ +# This is a configuration files for installing a .info menu +# The Description to be placed into the directory +DESCR="Barcode library and frontend" + +# The section this info file should be placed in (Regexp) followed by +# the new section name to be created if the Regexp does not match +# (Optional. If not given the .info will be appended to the directory) +SECTION_MATCH="[cC]ommands" +SECTION_NAME="General Commands" + +# The file referred to from the Info directory +FILE=barcode.info + +# Optional. The files to be copied to /usr/info +FILES=doc/*.info diff --git a/glabels1/barcode-0.98/debian/rules b/glabels1/barcode-0.98/debian/rules new file mode 100755 index 00000000..c48c5a1c --- /dev/null +++ b/glabels1/barcode-0.98/debian/rules @@ -0,0 +1,50 @@ +#!/usr/bin/make -f +# Made with the aid of debmake, by Christoph Lameter, +# based on the sample debian/rules file for GNU hello by Ian Jackson. + +package=barcode + +build: + $(checkdir) + ./configure --prefix=/usr + $(MAKE) CFLAGS="-O2 -g -Wall" + touch build + +clean: + $(checkdir) + -rm -f build + -$(MAKE) distclean + -rm -f `find . -name "*~"` + -rm -rf debian/tmp debian/files* core debian/substvars + +binary-indep: checkroot build + $(checkdir) +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +binary-arch: checkroot build + $(checkdir) + -rm -rf debian/tmp + install -d debian/tmp + cd debian/tmp && install -d `cat ../dirs` + $(MAKE) install prefix=`pwd`/debian/tmp/usr +# Must have debmake installed for this to work. Otherwise please copy +# /usr/bin/debstd into the debian directory and change debstd to debian/debstd + debstd ChangeLog README TODO INSTALL + dpkg-gencontrol + chown -R root.root debian/tmp + chmod -R go=rX debian/tmp + dpkg --build debian/tmp .. + +define checkdir + test -f debian/rules +endef + +binary: binary-indep binary-arch + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: binary binary-arch binary-indep clean checkroot diff --git a/glabels1/barcode-0.98/doc/Makefile.in b/glabels1/barcode-0.98/doc/Makefile.in new file mode 100644 index 00000000..dae8f6b6 --- /dev/null +++ b/glabels1/barcode-0.98/doc/Makefile.in @@ -0,0 +1,135 @@ +# +# Makefile (now .in) for the documentation directory +# +# Copyright 1994,2000 rubini@gnu.org (Alessandro Rubini) +# +################# +# +# BE CAREFUL in editing: +# due to the large number of index files, and my use of a non standard +# info input file, any file $(TARGET).* is removed by "make clean" +# +# I chose to use a prefix for the input file ("doc.$(TARGET)"), to ease +# makeing clean and applying my own rules. +# +################################################################### +# +# First of all, retrieve features of makeinfo, to know if we can do images +# and --html. Also, allow MAKEINFO to be specified on the commandline to +# allow me testing with various versions. + +# NOTE: it looks like semi-old versions can do images too, so CANDOIMAGES +# is not (yet?) used + + +MAKEINFO = @MAKEINFO@ +# According to whether this makeinfo can output html, autoconf define these +REMOVEHTMLTAGS = @REMOVEHTMLTAGS@ +INFOTOHTML = @INFOTOHTML@ + +############################################## + + +TARGET = barcode +ALL = $(TARGET).ps $(TARGET).info $(TARGET)doc.txt $(TARGET).html \ + $(TARGET).pdf + +all: $(ALL) terse + +info: $(TARGET).info + +$(TARGET)doc.txt: mktxt + +mpage: all + mv $(TARGET).ps $(TARGET)1.ps + mpage -2A $(TARGET)1.ps > $(TARGET)2.ps && rm $(TARGET)1.ps + +terse: + # preserve the pdf copy + -mv -f $(TARGET).pdf PDF 2> /dev/null && \ + rm -f *~ *.dvi *.log *.aux \ + $(TARGET).*.bak $(TARGET).??? $(TARGET).texinfo && \ + mv PDF $(TARGET).pdf; + + # preserve the ps copy + -mv $(TARGET).ps PS; + -rm -f $(TARGET).??; + -mv PS $(TARGET).ps; + +clean: terse + rm -f $(ALL) $(TARGET)_toc.html + + +#################################################### + +# These rules used to be expressed as "%.texinfo: doc.%" etc. However, this +# is gmake-specific, so I turned every % to $(TARGET), thus loosing generality +# but gaining portability. I also had to drop "$^": it worked with gmake +# and not pmake, while "$<" worked with pmake and not gmake. +# with gmake and not pmake. +# ARub 2000-04-21 + +$(TARGET).texinfo: doc.$(TARGET) + @rm -f $@ 2> /dev/null + sed -f ./infofilter doc.$(TARGET) | $(REMOVEHTMLTAGS) > $@ + chmod 400 $@ + + +# This rule is somewhat a rewrite of texi2dvi. I like make more than sh :-) +# This had to be rewritten too, as "$*" is different in gmake and pmake + +$(TARGET).dvi: $(TARGET).texinfo + +# create a spurious index file to please silly sh (bash will work anyway) + touch $(TARGET).oo + +# get the index list + if test "x`ls $(TARGET).?? $(TARGET).aux`" != "x"; then \ + for i in `ls $(TARGET).?? $(TARGET).aux`; do \ + cp $$i $$i~; \ + done; \ + fi + tex $(TARGET).texinfo + +#check the file list, the file and if needed run TeX again + old="`ls $(TARGET).??~ $(TARGET).aux~ | sed 's/~//g'`"; \ + new="`ls $(TARGET).?? $(TARGET).aux`"; \ + need="n"; \ + if test "$$old" != "$$new"; then need="y"; \ + else \ + for i in `ls $(TARGET).?? $(TARGET).aux`; do \ + cmp -s $$i $$i~; if test $$? -ne 0; then need="y" break; fi; \ + done; \ + fi; \ + if test "$$need" = "y"; then \ + texindex $(TARGET).?? && tex $(TARGET).texinfo; \ + fi + + +$(TARGET).ps: $(TARGET).dvi + dvips -f $(TARGET).dvi > $@ + +$(TARGET).pdf: $(TARGET).ps + ps2pdf $(TARGET).ps > $@ + +$(TARGET).lj: $(TARGET).dvi + dvilj -e- $(TARGET).dvi > $@ + +$(TARGET).info: $(TARGET).texinfo + makeinfo $(TARGET).texinfo -o $@ + +$(TARGET).html: $(TARGET).texinfo + $(INFOTOHTML) -o $@ $< + +#$(TARGET).man: doc.$(TARGET) +# manpages are created by the toplevel Makefile + +$(TARGET)doc.txt: $(TARGET).info + awk -f ./mktxt $(TARGET).info > $@ + + + + + + + diff --git a/glabels1/barcode-0.98/doc/README b/glabels1/barcode-0.98/doc/README new file mode 100644 index 00000000..5af5490f --- /dev/null +++ b/glabels1/barcode-0.98/doc/README @@ -0,0 +1,5 @@ + +The input file is "doc.barcode". I preprocess this file to +build both a "barcode.texinfo" file and manual pages. + +The intermediat diff --git a/glabels1/barcode-0.98/doc/barcode.info b/glabels1/barcode-0.98/doc/barcode.info new file mode 100644 index 00000000..693ca798 --- /dev/null +++ b/glabels1/barcode-0.98/doc/barcode.info @@ -0,0 +1,747 @@ +This is barcode.info, produced by makeinfo version 4.0 from +barcode.texinfo. + + This file is the User's Manual for the barcode library (version +0.98). + + +File: barcode.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) + +Barcode tools +************* + + This file documents version 0.98 of the barcode library and sample +programs (March 2002). + +* Menu: + +* Overview:: +* The Barcode Object:: +* Supported Flags:: +* The API:: +* The barcode Executable:: +* Supported Encodings:: +* PCL Output:: +* Bugs and Pending Issues:: + + +File: barcode.info, Node: Overview, Next: The Barcode Object, Prev: Top, Up: Top + +Overview +******** + + The "barcode" package is mainly a C library for creating bar-code +output files. It also includes a command line front-end and (in a +foreseeable future) a graphic frontend. + + The package is designed as a library because we think the main use +for barcode-generation tools is inside more featured applications. The +library addresses bar code printing as two distinct problems: creation +of bar information and actual conversion to an output format. To this +aim we use an intermediate representation for bar codes, which is +currently documented in the `ps.c' source file (not in this document). + + Note that the library and the accompanying material is released +according to the GPL license, not the LGPL one. A copy of the GPL is +included in the distribution tarball. + + +File: barcode.info, Node: The Barcode Object, Next: Supported Flags, Prev: Overview, Up: Top + +The Underlying Data Structure +***************************** + + Every barcode-related function acts on a data structure defined in +the `barcode.h' header, which must be included by any C source file +that uses the library. The header is installed by make install. + + The definition of the data structure is included here for reference: + + struct Barcode_Item { + int flags; /* type of encoding and other flags */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text placement */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ + }; + + The exact meaning of each field and the various flags implemented are +described in the following sections. + + Even though you won't usually need to act on the contents of this +structure, some of the functions in the library receive arguments that +are directly related to one or more of these fields. + +* Menu: + +* The Field List:: +* The Intermediate Representation:: + + +File: barcode.info, Node: The Field List, Next: The Intermediate Representation, Prev: The Barcode Object, Up: The Barcode Object + +The Fields +========== + +`int flags;' + The flags are, as you may suspect, meant to specify the exact + behaviour of the library. They are often passed as an argument to + barcode functions and are discussed in the next section. + +`char *ascii;' +`char *partial;' +`char *textinfo;' +`char *encoding;' + These fields are internally managed by the library, and you are + not expected to touch them if you use the provided API. All of + them are allocated with malloc. + +`int width;' +`int height;' + They specify the width and height of the active barcode region + (i.e., excluding the white margin), in the units used to create + output data (for postscript they are points, 1/72th of an inch, + 0.352 mm). The fields can be either assigned to in the structure + or via Barcode_Position(), at your choice. If either value or + both are left to their default value of zero, the output engine + will assign default values according to the specified scaling + factor. If the specified width is bigger than needed (according to + the scaling factor), the output barcode will be centered in its + requested region. If either the width of the height are too small + for the specified scale factor, the output bar code will expand + symmetrically around the requested region. + +`int xoff;' +`int yoff;' + The fields specify offset from the coordinate origin of the output + engine (for postscript, position 0,0 is the lower left corner of + the page). The fields can be either assigned to in the structure + or via Barcode_Position(), at your choice. The offset specifies + where the white margin begins, not where the first bar will be + printed. To print real ink to the specified position you should + set margin to 0. + +`int margin;' + The white margin that will be left around the printed area of the + bar code. The same margin is applied to all sides of the printed + area. The default value for the margin is defined in `barcode.h' + as BARCODE_DEFAULT_MARGIN (10). + +`double scalef;' + The enlarge or shrink value for the bar code over its default + dimension. The width and scalef fields interact deeply in the + creation of the output, and a complete description of the issues + appears later in this section. + +`int error;' + The field is used when a barcode function fails to host an + errno-like integer value. + +Use of the width and scalef fields. +----------------------------------- + + A width unit is the width of the thinnest bar and/or space in the +chosen code; it defaults to 1 point if the output is postscript or +encapsulated postscript. + + Either or both the code width and the scale factor can be left +unspecified (i.e., zero). The library deals with defaults in the +following way: + +Both unspecified + If both the width and the scale factor are unspecified, the scale + factor will default to 1.0 and the width is calculated according + to the actual width of the bar code being printed. + +Width unspecified + If the width is not specified, it is calculated according to the + values of scalef. + +Scale factor unspecified + If the scale factor is not specified, it will be chosen so that + the generated bar code exactly fits the specified width. + +Both specified + The code will be printed inside the specified region according to + the specified scale factor. It will be aligned to the left. If, + however, the chosen width is too small for the specific bar code + and scaling factor, then the code will extend symmetrically to the + left and to the right of the chosen region. + + +File: barcode.info, Node: The Intermediate Representation, Prev: The Field List, Up: The Barcode Object + +The Intermediate Representation +=============================== + + The encoding functions print their output into the partial and +texinfo fields of the barcode data structure. Those fields, together +with position information, are then used to generate actual output. +This is an informal description of the intermediate format. + + The first char in partial tells how much extra space to add to the +left of the bars. For EAN-13, it is used to leave space to print the +first digit, other codes may have '0' for no-extra-space-needed. + + The next characters are alternating bars and spaces, as multiples of +the base dimension which is 1 unless the code is rescaled. Rescaling is +calculated as the ratio from the requested width and the calculated +width. Digits represent bar/space dimensions. Lower-case letters +represent those bars that should extend lower than the others: 'a' is +equivalent to '1', 'b' is '2' and so on up to 'i' which is equivalent to +'9'. Other letters will be used for encoding-specific meanings, as soon +as I implement them. + + The textinfo string is made up of fields %lf:%lf:%c separated by +blank space. The first integer is the x position of the character, the +second is the font size (before rescaling) and the char item is the +character to be printed. + + Both the partial and textinfo strings may include "-" or "+" as +special characters (in textinfo the char should be a stand-alone word). +They state where the text should be printed: below the bars ("-", +default) or above the bars. This is used, for example, to print the +add-5 and add-2 codes to the right of UPC or EAN codes (the add-5 +extension is mostly used in ISBN codes). + + +File: barcode.info, Node: Supported Flags, Next: The API, Prev: The Barcode Object, Up: Top + +The Flags +********* + + The following flags are supported by version 0.98 of the library: + +`BARCODE_ENCODING_MASK' + The mask is used to extract the encoding-type identifier from the + flags field. + +`BARCODE_EAN' +`BARCODE_UPC' +`BARCODE_ISBN' +`BARCODE_128B' +`BARCODE_128C' +`BARCODE_128' +`BARCODE_128RAW' +`BARCODE_39' +`BARCODE_I25' +`BARCODE_CBR' +`BARCODE_MSI' +`BARCODE_PLS' +`BARCODE_93' + The currently supported encoding types: EAN (13 digits, 8 digits, + 13 + 2 add-on and 13 + 5 add-on), UPC (UPC-A, UPC-E, UPC-A with 2 + or 5 digit add-on), ISBN (with or without the 5-digit add-on), + CODE128-B (the whole set of printable ASCII characters), CODE128-C + (two digits encoded by each barcode symbol), CODE128 (all ASCII + values), a "raw-input" pseudo-code that generates CODE128 output, + CODE39 (alphanumeric), "interleaved 2 of 5" (numeric), Codabar + (numeric plus a few symbols), MSI (numeric) and Plessey (hex + digits). *Note Supported Encodings::. + +`BARCODE_ANY' + This special encoding type (represented by a value of zero, so it + will be the default) tells the encoding procedure to look for the + first encoding type that can deal with a textual string. + Therefore, a 11-digit code will be printed as UPC (as well as + 6-digit, 11+2 and 11+5), a 12-digit (or 7-digit, or 12+2 or 12+5) + as EAN13, an ISBN code (with or without hyphens, with or without + add-5) will be encoded in its EAN13 representation, an even number + of digits is encoded using CODE128C and a generic string is + encoded using CODE128B. Since code-39 offers a much larger + representation for the same text string, code128-b is preferred + over code39 for alphanumeric strings. + +`BARCODE_NO_ASCII' + Instructs the engine not to print the ascii string on output. By + default the bar code is accompanied with an ascii version of the + text it encodes. + +`BARCODE_NO_CHECKSUM' + Instructs the engine not to add the checksum character to the + output. Not all the encoding types can drop the checksum; those + where the checksum is mandatory (like EAN and UPC) just ignore the + flag. + +`BARCODE_OUTPUT_MASK' + The mask is used to extract the output-type identifier from the + flags field. + +`BARCODE_OUT_PS' +`BARCODE_OUT_EPS' +`BARCODE_OUT_PCL' +`BARCODE_OUT_PCL_III' + The currently supported encoding types: full-page postscript and + encapsulated postscript; PCL (print command language, for HP + printers) and PCL-III (same as PCL, but uses a font not available + on older printers). + +`BARCODE_OUT_NOHEADERS' + The flag instructs the printing engine not to print the header and + footer part of the file. This makes sense for the postscript + engine but might not make sense for other engines; such other + engines will silently ignore the flag just like the PCL back-end + does. + + +File: barcode.info, Node: The API, Next: The barcode Executable, Prev: Supported Flags, Up: Top + +Functions Exported by the Library +********************************* + + The functions included in the barcode library are declared in the +header file barcode.h. They perform the following tasks: + +`struct Barcode_Item *Barcode_Create(char *text);' + The function creates a new barcode object to deal with a specified + text string. It returns NULL in case of failure and a pointer to + a barcode data structure in case of success. + +`int Barcode_Delete(struct Barcode_Item *bc);' + Destroy a barcode object. Always returns 0 (success) + +`int Barcode_Encode(struct Barcode_Item *bc, int flags);' + Encode the text included in the bc object. Valid flags are the + encoding type (other flags are ignored) and BARCODE_NO_CHECKSUM + (other flags are silently ignored); if the flag argument is zero, + bc->flags will apply. The function returns 0 on success and -1 in + case of error. After successful termination the data structure + will host the description of the bar code and its textual + representation, after a failure the error field will include the + reason of the failure. + +`int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags);' + Print the bar code described by bc to the specified file. Valid + flags are the output type, BARCODE_NO_ASCII and + BARCODE_OUT_NOHEADERS, other flags are ignored. If any of these + flags is zero, it will be inherited from bc->flags which therefore + takes precedence. The function returns 0 on success and -1 in case + of error (with bc->error set accordingly). In case of success, the + bar code is printed to the specified file, which won't be closed + after use. + +`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, int flags);' + The function deals with the whole life of the barcode object by + calling the other functions; it uses all the specified flags. + +`int Barcode_Version(char *versionname);' + Returns the current version as an integer number of the form major + * 10000 + minor * 100 + release. Therefore, version 1.03.5 will be + returned as 10305 and version 0.53 as 5300. If the argument is + non-null, it will be used to return the version number as a + string. Note that the same information is available from two + preprocessor macros: BARCODE_VERSION (the string) and + BARCODE_VERSION_INT (the integer number). + + +File: barcode.info, Node: The barcode Executable, Next: Supported Encodings, Prev: The API, Up: Top + +The barcode frontend program +**************************** + + The barcode program is a front-end to access some features of the +library from the command line. It is able to read user supplied +strings from the command line or a data file (standard input by default) +and encode all of them. + +* Menu: + +* The Command Line:: + + +File: barcode.info, Node: The Command Line, Prev: The barcode Executable, Up: The barcode Executable + +The Command Line +================ + + barcode accepts the following options: + +`--help or -h' + Print a usage summary and exit. + +`-i filename' + Identify a file where strings to be encoded are read from. If + missing (and if -b is not used) it defaults to standard input. + Each data line of the input file will be used to create one + barcode output. + +`-o filename' + Output file. It defaults to standard output. + +`-b string' + Specify a single "barcode" string to be encoded. The option can + be used multiple times in order to encode multiple strings (this + will result in multi-page postscript output or a table of barcodes + if -t is specified). The strings must match the encoding chosen; + if it doesn't match the program will print a warning to stderr and + generate "blank" output (although not zero-length). Please note + that a string including spaces or other special characters must be + properly quoted. + +`-e encoding' + encoding is the name of the chosen encoding format being used. It + defaults to the value of the environment variable BARCODE_ENCODING + or to auto detection if the environment is also unset. + +`-g geometry' + The geometry argument is of the form "[ x ] [+ + + ]" (with no intervening spaces). Unspecified + margin values will result in no margin; unspecified size results + in default size. The specified values represent print points by + default, and can be inches, millimeters or other units according + to the -u option or the BARCODE_UNIT environment variable. The + argument is used to place the printout code on the page. Note that + an additional white margin of 10 points is added to the printout. + If the option is unspecified, BARCODE_GEOMETRY is looked up in the + environment, if missing a default size and no margin (but the + default 10 points) are used. + +`-t table-geometry' + Used to print several barcodes to a single page, this option is + meant to be used to print stickers. The argument is of the form + " x [+ + [- + [- ]]]" (with no intervening spaces); if + missing, the top and right margin will default to be the same as + the bottom and left margin. The margins are specified in print + points or in the chosen unit (see -u below). If the option is not + specified, BARCODE_TABLE is looked up in the environment, + otherwise no table is printed and each barcode will get its own + page. The size (but not the position) of a barcode item within a + table can also be selected using -g (see "geometry" above), + without struggling with external and internal margins. I still + think management of geometries in a table is suboptimal, but I + can't make it better without introducing incompatibilities. + +`-m margin(s)' + Specifies an internal margin for each sticker in the table. The + argument is of the form "," and the margin is + applied symmetrically to the sticker. If unspecified, the + environment variable BARCODE_MARGIN is used or a default internal + margin of 10 points is used. + +`-n' + "Numeric" output: don't print the ASCII form of the code, only the + bars. + +`-c' + No checksum character (for encodings that allow it, like code 39, + other codes, like UPC or EAN, ignore this option). + +`-E' + Encapsulated postscript (default is normal postscript). When the + output is generated as EPS only one barcode is encoded. + +`-P' + PCL output. Please note that the Y direction goes from top to + bottom for PCL, and the origin for an image is the top-left corner + instead of the bottom-left + +`-p pagesize' + Specify a non-default page size. The page size can be specified in + millimeters, inches or plain numbers (for example: "210x297mm", + "8.5x11in", "595x842"). A page specification as numbers will be + interpreted according to the current unit specification (see -u + below). If libpaper is available, you can also specify the page + size with its name, like "A3" or "letter" (libpaper is a standard + component of Debian GNU/Linux, but may be missing elsewhere). The + default page size is your system-wide default if libpaper is + there, A4 otherwise. + +`-u unit' + Choose the unit used in size specifications. Accepted values are + "mm", "cm", "in" and "pt". By default, the program will check + BARCODE_UNIT in the environment, and assume points otherwise (this + behaviour is compatible with 0.92 and previous versions. If -u + appears more than once, each instance will modified the behaviour + for the arguments at its right, as the command line is processes + left to right. The program internally works with points, and any + size is approximated to the nearest multiple of one point. The -u + option affect -g (geometry), -t (table) and -p (page size). + + +File: barcode.info, Node: Supported Encodings, Next: PCL Output, Prev: The barcode Executable, Up: Top + +Supported Encodings +******************* + + The program encodes text strings passed either on the command line +(with -b) or retrieved from standard input. The text representation is +interpreted according to the following rules. When auto-detection of +the encoding is enabled (i.e, no explicit encoding type is specified), +the encoding types are scanned to find one that can digest the text +string. The following list of supported types is sorted in the same +order the library uses when auto-detecting a suitable encoding for a +string. + +EAN + The EAN frontend is similar to UPC; it accepts strings of digits, + 12 or 7 characters long. Strings of 13 or 8 characters are + accepted if the provided checksum digit is correct. I expect most + users to feed input without a checksum, though. The add-2 and + add-5 extension are accepted for both the EAN-13 and the EAN-8 + encodings. The following are example of valid input strings: + "123456789012" (EAN-13), "1234567890128" (EAN-13 wih checksum), + "1234567" (EAN-8), "12345670 12345" (EAN-8 with checksum and + add-5), "123456789012 12" (EAN-13 with add-2), "123456789012 + 12345" (EAN-13 with add-5). + +UPC + The UPC frontend accepts only strings made up of digits (and, if a + supplemental encoding is used, a blank to separate it). It + accepts strings of 11 or 12 digits (UPC-A) and 6 or 7 or 8 digits + (UPC-E). + + The 12th digit of UPC-A is the checksum and is added by the + library if not specified in the input; if it is specified, it must + be the right checksum or the code is rejected as invalid. For + UPC-E, 6 digit are considered to be the middle part of the code, a + leading 0 is assumed and the checksum is added; 7 digits are + either considered the initial part (leading digit 0 or 1, checksum + missing) or the final part (checksum specified, leading 0 + assumed); 8 digits are considered to be the complete code, with + leading 0 or 1 and checksum. For both UPC-A and UPC-E, a trailing + string of 2 digits or 5 digits is accepted as well. Therefore, the + following are examples of valid strings that can be encoded as UPC: + "01234567890" (UPC-A) "012345678905" (UPC-A with checksum), + "012345" (UPC-E), "01234567890 12" (UPC-A, add-2) and "01234567890 + 12345" (UPC-A, add-5), "0123456 12" (UPC-E, add-2). Please note + that when setting BARCODE_ANY to auto-detect the encoding to be + used, 12-digit strings and 7-digit strings will always be + identified as EAN. This because I expect most user to provide + input without a checksum. If you need to specify UPC-with-checksum + as input you must explicitly set BARCODE_UPC as a flag or use -e + upc on the command line. + +ISBN + ISBN numbers are encoded as EAN-13 symbols, with an optional add-5 + trailer. The ISBN frontend of the library accepts real ISBN + numbers and deals with any hyphen and, if present, the ISBN + checksum character before encoding data. Valid representations for + ISBN strings are for example: "1-56592-292-1", "3-89721-122-X" and + "3-89721-122-X 06900". + +CODE 128-B + This encoding can represent all of the printing ASCII characters, + from the space (32) to DEL (127). The checksum digit is mandatory + in this encoding. + +CODE 128-C + The "C" variation of Code-128 uses Code-128 symbols to represent + two digits at a time (Code-128 is made up of 104 symbols whose + interpretation is controlled by the start symbol being used). Code + 128-C is thus the most compact way to represent any even number of + digits. The encoder refuses to deal with an odd number of digits + because the caller is expected to provide proper padding to an + even number of digits. (Since Code-128 includes control symbols to + switch charset, it is theoretically possible to represent the odd + digit as a Code 128-A or 128-B symbol, but this tool doesn't + currently implement this option). + +CODE 128 RAW + Code-128 output represented symbol-by-symbol in the input string. + To override part of the problems outlined below in specifying + code128 symbols, this pseudo-encoding allows the used to specify a + list of code128 symbols separated by spaces. Each symbol is + represented by a number in the range 0-105. The list should + include the leading character.The checksum and the stop character + are automatically added by the library. Most likely this + pseudo-encoding will be used with BARCODE_NO_ASCII and some + external program to supply the printed text. + +CODE 39 + The code-39 standard can encode uppercase letters, digits, the + blank space, plus, minus, dot, star, dollar, slash, percent. Any + string that is only composed of such characters is accepted by the + code-39 encoder. To avoid loosing information, the encoder refuses + to encode mixed-case strings (a lowercase string is nonetheless + accepted as a shortcut, but is encoded as uppercase). + +INTERLEAVED 2 OF 5 + This encoding can only represent an even number of digits (odd + digits are represented by bars, and even digits by the + interleaving spaces). The name stresses the fact that two of the + five items (bars or spaces) allocated to each symbol are wide, + while the rest are narrow. The checksum digit is optional (can be + disabled via BARCODE_NO_CHECKSUM). Since the number of digits, + including the checksum, must be even, a leading zero is inserted + in the string being encoded if needed (this is specifically stated + in the specs I have access to). + +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 back-ticks 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. In needed, you can use + the "code 128 raw" pseudo-encoding to represent code128 symbols by + their numerical value. This encoding is used late in the + auto-selection mechanism because (almost) any input string can be + represented using code128. + +CODABAR + Codabar can encode the ten digits and a few special symbols + (minus, plus, dollar, colon, bar, dot). The characters "A", "B", + "C" and "D" are used to represent four different start/stop + characters. The input string to the barcode library can include + the start and stop characters or not include them (in which case + "A" is used as start and "B" as stop). Start and stop characters + in the input string can be either all lowercase or all uppercase + and are always printed as uppercase. + +PLESSEY + Plessey barcodes can encode all the hexadecimal digits. Alphabetic + digits in the input string must either be all lowercase or all + uppercase. The output text is always uppercase. + +MSI + MSI can only encode the decimal digits. While the standard + specifies either one or two check digits, the current + implementation in this library only generates one check digit. + +CODE 93 + The code-93 standard can natively encode 48 different characters, + including uppercase letters, digits, the blank space, plus, minus, + dot, star, dollar, slash, percent, as well as five special + characters: a start/stop delimiter and four "shift characters" + used for extended encoding. Using this "extended encoding" + method, any standard 7-bit ASCII character can be encoded, but it + takes up two symbol lengths in barcode if the character is not + natively supported (one of the 48). The encoder here fully + implements the code 93 encoding standard. Any characters natively + supported (A-Z, 0-9, ".+-/$&%") will be encoded as such - for any + other characters (such as lower case letters, brackets, + parentheses, etc.), the encoder will revert to extended encoding. + As a note, the option to exclude the checksum will eliminate the + two modulo-47 checksums (called C and K) from the barcode, but this + probably will make it unreadable by 99% of all scanning systems. + These checksums are specified to be used at the firmware level, + and their absence will be interpreted as an invalid barcode. + + +File: barcode.info, Node: PCL Output, Next: Bugs and Pending Issues, Prev: Supported Encodings, Up: Top + +PCL Output +********** + + While the default output is Postscript (possibly EPS), and Postscript +can be post-processed to almost anything, it is sometimes desirable to +create output directly usable by the specific printer at hand. PCL is +currently supported as an output format for this reason. Please note +that the Y coordinate for PCL goes from top to bottom, while for +Postscript it goes from bottom to top. Consistently, while in +Postscript you specify the bottom-left corner as origin, for PCL you +specify the top-left corner. + + Barcode output for PCL Printers (HP LaserJet and compatibles), was +developed using PCL5 Reference manuals from HP. that really refers to +these printers: + * LaserJet III, III P, III D, III Si, + + * LaserJet 4 family + + * LaserJet 5 family + + * LaserJet 6 family + + * Color LaserJet + + * DeskJet 1200 and 1600. + + + However, barcode printing uses a very small subset of PCL, probably +also LaserJet II should print it without problem, but the resulting +text may be horrible. + + The only real difference from one printer to another really depends +on which font are available in the printer, used in printing the label +associated to the bars (if requested). + + Earlier LaserJet supports only bitmaps fonts, so these are not +"scalable". (Ljet II ?), Also these fonts, when available, have a +specified direction, and not all of them are available in both Portrait +and Landscape mode. + + From LaserJet 4 series, (except 4L/5L that are entry-level printers), +Arial scalable font should be available, so it's the "default font" +used by this program. + + LaserJet III series printers (and 4L, 5L), don't feature "Arial" as a +resident font, so you should use BARCODE_OUT_PCL_III instead of +BARCODE_OUT_PCL., and font the font used will be "Univers" instead of +"Arial". + + Results on compatible printers, may depend on consistency of PCL5 +compatibility, in doubt, try BARCODE_OUT_PCL_III + + PJL commands are not used here, as it's not very compatible. + + Tested Printers: + * Hp LaserJet 4050 + + * Hp LaserJet 2100 + + * Epson N-1200 emul PCL + + * Toshiba DP2570 (copier) + PCL option + + * Epson EPL-7100 emul. HP LaserJet II: bars print fine but text is + bad. + + +File: barcode.info, Node: Bugs and Pending Issues, Prev: PCL Output, Up: Top + +Bugs and Pending Issues. +************************ + + The current management of borders/margins is far from optimal. The +"default" margin applied by the library interferes with the external +representation, but I feel it is mandatory to avoid creating barcode +output with no surrounding white space (the problem is especially +relevant for EPS output). + + EAN-128 is not (yet) supported. I plan to implement it pretty soon +and then bless the package as version 1.0. + + + +Tag Table: +Node: Top153 +Node: Overview525 +Node: The Barcode Object1403 +Node: The Field List2820 +Node: The Intermediate Representation6585 +Node: Supported Flags8358 +Node: The API11342 +Node: The barcode Executable14028 +Node: The Command Line14457 +Node: Supported Encodings19556 +Node: PCL Output28996 +Node: Bugs and Pending Issues31315 + +End Tag Table diff --git a/glabels1/barcode-0.98/doc/barcode.pdf b/glabels1/barcode-0.98/doc/barcode.pdf new file mode 100644 index 00000000..d7f66cbb Binary files /dev/null and b/glabels1/barcode-0.98/doc/barcode.pdf differ diff --git a/glabels1/barcode-0.98/doc/barcode.ps b/glabels1/barcode-0.98/doc/barcode.ps new file mode 100644 index 00000000..6e2db98c --- /dev/null +++ b/glabels1/barcode-0.98/doc/barcode.ps @@ -0,0 +1,2378 @@ +%!PS-Adobe-2.0 +%%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software +%%Title: barcode.dvi +%%Pages: 12 +%%PageOrder: Ascend +%%BoundingBox: 0 0 596 842 +%%EndComments +%DVIPSWebPage: (www.radicaleye.com) +%DVIPSCommandLine: dvips -f barcode.dvi +%DVIPSParameters: dpi=600, compressed +%DVIPSSource: TeX output 2002.03.01:2356 +%%BeginProcSet: texc.pro +%! +/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S +N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 +mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 +0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ +landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize +mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ +matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round +exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ +statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] +N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin +/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array +/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 +array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N +df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A +definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get +}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} +B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr +1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3 +1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx +0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx +sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{ +rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp +gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B +/chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{ +/cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{ +A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy +get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse} +ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp +fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17 +{2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add +chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{ +1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop} +forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn +/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put +}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ +bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A +mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ +SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ +userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X +1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 +index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N +/p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ +/Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) +(LaserWriter 16/600)]{A length product length le{A length product exch 0 +exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse +end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask +grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} +imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round +exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto +fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p +delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} +B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ +p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S +rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end + +%%EndProcSet +TeXDict begin 39158280 55380996 1000 600 600 (barcode.dvi) +@start +%DVIPSBitmapFont: Fa cmbxti10 14.4 8 +/Fa 8 115 df<13FCEA03FF000F13804813C05AA25AA2B5FCA31480A214006C5A6C5A6C +5AEA0FE0121271912B>46 D97 DI<923807FF80037F13F00203B512FC02 +0F80023F8091B500031380499038F8007F010701E0EBFFC049EB800149495A49485B495A +49485B5A485BA248491580180048496D5A486F5A93C8FC485BA35A91CAFCA3B5FC5BA45B +A65B17036C6CED0780170FEF3FC0003F167F6DEC01FF001F4B13806C6C021F13006C6DEB +7FFC6C9039F00FFFF86C90B612E06C5E013F4AC7FC010F14F0010049C8FC323773B540> +II<923807FF8092B512E0020714F8021F80027F80903A01FFFE03FF49D9F000 +13804901C0EB7FC0495B013F90C7123F495A495A5C5A485B4849147F18804816FF4A4913 +00485DEE0FFE4849EB7FFC923807FFF891B612E0485E94C7FC16F04BC8FCB5CAFC5BA45B +A7007F1603EF0780170F003FEE3FC0177F6C6CEC01FF4C13806C6C021F13006C01C0EB7F +FC6C9039F00FFFF86C90B612E06C6C5D6D4AC7FC010714F09026007FFEC8FC323773B540 +>I<923807FFC0037F13FC0203B6FC020F15C0023F8191B5000313F8499039F8007FFC01 +0701E0133F4901806D7E4990C76C7E49481680495A4948804818C0485BA2485BA248494A +13E05AA2485BA24D13C05A91C8FCA25FB517805BA25F19005B6017FF605E60495E5E6C6C +4A5B604C5B003F4B90C7FC6D4A5A001F4B5A6C6C4A5A6CD980035B6CD9F01F13C06C90B6 +5A6C4BC8FC013F14F0010F14C0010001F8C9FC3B3773B547>111 +D114 +D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fb cmsy10 10.95 1 +/Fb 1 16 df15 +D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fc cmb10 10.95 10 +/Fc 10 115 df97 D<13FFB5FCA512077EAF4AB4FC020F13E0 +023F13F891B57E9138FE07FFDAF8011380DAE00013C05C4AEB7FE017F0A3EE3FF8A317FC +AC17F8A3EE7FF0A217E06E13FF17C06E481380DAF80313009138FE0FFE9039FC7FFFFC49 +6C13F0496C13C0C7D803FEC7FC2E407FBE33>II<16FF92B5FCA5150781AFEB01FF011F +13E3017F13FB90B7FC4813C148EB003F48487F48487F001F805B123FA2485AA312FFAC12 +7FA36C7EA3001F5C6C6C5B00074A13806D4913FC2603FF83B5FCC690B6FC6D13F7011F13 +C7903A03FE07FC002E407DBE33>I<49B47E010F13F0013F7F90B512FE48EBC3FF480100 +13804848EB7FC04848133F001F15E05B003FEC1FF0A2485A150F16F8A212FFA290B6FCA4 +01F0C8FCA5127FA37F003F15F8A26C6C1301000F15F06D13036C6CEB07E06C9038800FC0 +6C9038F07F806C6CB512006D5B010F13F8010013C0252B7EA92A>I103 +D105 D<01FFEB7FE0B53801FFF802077F4A7F91381FC3FFDA3E03 +13800007137C6CEB780102F014C014E0A214C0A31480B3A4B5D8FE1F13FFA530297EA833 +>110 D<49B47E010F13F0013F13FC90B6FC48018113803A03FE007FC04848EB3FE0000F +15F049131F001F15F8A24848EB0FFCA2007F15FEA400FF15FFAB007F15FEA3003F15FC6D +131F001F15F8A26C6CEB3FF0000715E06C6CEB7FC03A01FF81FF806C90B51200013F13FC +010F13F001011380282B7EA92D>I<3901FE07F800FFEB0FFE91383FFF804A13C0EC7C7F +9138F8FFE03807FFF06C5B5CA2ED7FC09138803F80ED1F0092C7FCA291C8FCB3A3B6FCA5 +23297FA827>114 D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fd cmbxti10 17.28 7 +/Fd 7 115 df97 +DII<963803FFC0061FB512E06060A47214C0F000 +1F61A21B80A261A21B00A296B5FCA262A260A262A260A262A260A262A260A2DCFFE05C03 +0F13FC037FEBFF1F4AB6129F020792B55A4AEBE07F023FEB000F4A487F4948486D5C4913 +F04981495B49496D91C7FC495B5B92C8FC90B55E485B5F485B4860A248495CA248605C5F +5A4A5EA2485EA24A5EA2B55DA24A5EA25FA291C85CA24DEC3F801A7F19005B94B513FFA2 +4E1400A24C5C007F614C13FC4C1403003F4B5D6D4A14076C4B5D6C6D49140F4BB55C6CD9 +C007013F495A6C9026F03FFEEBFE3FC690B5D8F81FB55A6DDAF0075C011FDAC00349C7FC +010749C75B9026007FF0EC1FF04B6571E355>II<93381FFF804BB512F8031F14FF +037F15C04AB77E0207D9FC0313F8021FD9E0007F4A0180EB3FFEDAFFFEC76C7E49491680 +49496E13C0495B49496E13E0495B494916F05B90B5C87E1AF8485B485F5C5A5C5AA2485B +605A5CA2485FA24A17F0A2B55EA24A17E0A2601AC091C9FC95B51280A21A005F615F495F +4D5B127F6D4B5B616C4C5B4D5B6C6D4A90C7FC4D5A6C6D495B6C4B5B6C6D010F13E06C01 +F8013F5B6CD9FE01B5C8FC013FB612FC6D15F0010715C0010002FCC9FC020F13C0454271 +C055>111 D114 D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fe cmbxti10 13.15 11 +/Fe 11 120 df97 D99 D<943801FF800403B512C05E1980A282EE000F1900A25FA260A2173FA260 +A2177FA260A217FFA260A25EEDFFC1020701F15B023F13FD91B7FC4913E00107D9003F5B +49487F49487F495A49486D5B495A485D5C4894C7FC5A4A5B5A91C75B5A163FA248485DA2 +167F127F495DA216FF12FF495DA25D181E49EDE03FA24B5C187E17C0A2007F5F5D4B1380 +003F4AEB81F85D6C6C49EB83F06C6C48B55B2707FE0FFC13CF6CB539F07FFFC06C4A6C5B +6C6CD9800F90C7FC903A0FFC0003FC3A4D75CB41>III104 D<15F8EC03FC4A7E4A7EA25CA35DA25D6E +5AEC03E091C8FCAEEB07F8EB1FFEEB7FFF90B57E3901FC7FC0D803F07FEA07E0D80FC07F +A2381F80FFA2485A5B007E5CA25B00FE5C485A007C5C12005B92C7FCA25B5C133F5CA213 +7F5CA213FFECF00F48EC1F8014E0153F48150014C05D48147E14805D14816CEB01F84A5A +4A5A6CEB1FC06CEBFF806D90C7FC6D5AEB07F0214E78CC27>I108 D<913801FFC0021F13F8027F13FE91B6FC4901001380D903FCEB3F +C0D907F0130F010FEC3FE04948137F4A13FF133FA2017F4913C0A26F138017006E137E02 +FC90C7FCECFFC015FE6F7E16E06D80826D807F6D80010180EB003F1403EC003FD803C013 +0FD80FE01303EA3FF0486C7FA200FF5DA34B5A5B49495A495C49130F6CC7485AD83FC0EB +7FC03A1FF803FF806CB548C7FC6C14F8000114E026001FFEC8FC2B3377B135>115 +DI119 +D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Ff cmbx12 13.14 13 +/Ff 13 117 df<923807FFE092B512FC020714FF021F81027F9038007FC0902601FFF0EB +0FE04901C0497E4990C7487ED90FFC147F011F824A14FF495AA2137F5CA2715A715A715A +EF078094C8FCA7EF07FCB9FCA526007FF0C7123F171FB3B3A2003FB5D8E00FB512F8A53D +4D7ECC44>12 D46 D85 D97 +D100 +DII104 D108 D<903A7FC001FFC0B5010F13F8033F7F4B13FFDBFE07 +7F9138C1F00300039026C3E0017F6CD9C78080ECCF0014DE02DC6D7F14FC5CA25CA35CB3 +AAB6D8C07FEBFFE0A53B327BB144>110 D<913807FF80027F13F80103B6FC010F15C090 +261FFE017F903A7FF0003FF849486D7E480180EB07FE4890C76C7E4817804980000F17C0 +48486E13E0A2003F17F0A249157F007F17F8A400FF17FCAB007F17F8A46C6CEDFFF0A200 +1F17E0A26C6C4A13C0A26C6C4A13806C6D4913006C5E6C01E0EB1FFC6D6C495A903A3FFE +01FFF0010FB612C0010392C7FCD9007F13F80207138036347DB23D>I<903907FF807001 +7FEBF1F048B6FC1207380FFC01391FE0003F4848130F491307127F90C71203A2481401A2 +7FA27F01F090C7FC13FCEBFFC06C13FEECFFE06C14FC6C806CECFF806C15C06C15E06C15 +F06C7E011F14F8010114FCEB000FEC007FED1FFE0078140F00F8140715037E1501A27E16 +FC7E15036D14F86D13076D14F001F8EB1FE001FFEBFFC04890B51280486C1400D8F81F13 +FCD8E00313C027347CB230>115 D<14F8A51301A41303A21307A2130FA2131F133F137F +13FF1203000F90B512F0B7FCA426007FF8C7FCB3A7167CAA013F14F880A290391FFE01F0 +010F1303903907FF87E06DEBFFC06D14806D6C1300EC0FFC26467EC430>I +E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fg cmti10 10.95 35 +/Fg 35 122 df<933807FF80043F13E09338FE00F8DB01F0133EDB07E0130E4B48131F4C +137F031F14FF4BC7FCA218FE157E1878180015FE5DA31401A25DA414030103B712F0A218 +E0903A0003F000070207140F4B14C0A3171F020F15805DA2173F1800141F5D5F177EA214 +3F92C712FE5FA34A1301027EECF81CA3160302FEECF03C4A1538A21878187013014A0101 +13F018E0933800F1C0EF7F804948EC1F0094C7FCA35C1307A2001E5B127F130F00FF5BA2 +49CAFC12FEEAF81EEA703CEA7878EA1FF0EA07C0385383BF33>12 +DI40 +D<14031580A2EC01C0EC00E0A21570A215781538153CA3151EA4151FA2150FA7151FA915 +3FA2153EA3157EA2157CA215FCA215F8A21401A215F0A2140315E0A2140715C0A2EC0F80 +A2141F15005C143EA25CA25CA2495A5C1303495A5C130F49C7FC131E5B137C5B5B485A48 +5A485A48C8FC121E5A12705A5A205A7FC325>I<387FFFFEA3B5FCA21705799521>45 +D<120FEA3FC0127FA212FFA31380EA7F00123C0A0A77891C>I<15031507150F151F151E +153E157EEC01FEEC03FC1407141FEB01FF90380FFBF8EB1FC3EB0E07130015F0A2140FA2 +15E0A2141FA215C0A2143FA21580A2147FA21500A25CA25CA21301A25CA21303A25CA213 +07A25CA2130FA25CA2131FA25CEB7FE0B612F0A215E0203D77BC2E>49 +D<15FE913803FFC091380F01F091383C00F84A137C4A7F4948133F49487F4A148049C7FC +5BEB0E0C011E15C0EB1C0EEB3C06133813781370020E133FD9F00C148013E0141C021813 +7F00011600EBC0384A13FEEC600102E05B3A00E3C003F89039FF0007F0013C495A90C748 +5A5E037FC7FC15FC4A5A4A5AEC0FC04AC8FC147E14F8EB03E0495A011FC9FC133E491418 +01F0143C48481438485A1678485A48C85A120E001E4A5AD83FE0130301FF495A397C3FF0 +1FD8780FB55AD8700391C7FCD8F0015B486C6C5A6E5AEC07C02A3F79BC2E>I<157F9138 +01FFE0913807C0F091381F007C023C133C4A133E4A131F1301495A5C1307A2495AA2163F +011F143EA2167E6E137C16F8ECE00102F013F09138F803E09138FC07C090390FFE0F00EC +FFBE6D13F86D5B7F6D7F8101037F90380F9FFFD91F0F1380D97C0713C0497E48486C13E0 +3903E0007F4848133F4848131F001F140F90C7FC003E1407A2127E127CA200FC15C05AA2 +ED0F80A2ED1F00153E007C143C157C007E5C6CEB03F0391F8007C0390FE03F802607FFFE +C7FC000113F838003FC0283F78BC2E>56 D<49B712C018F818FE903B0003FC0001FF9438 +007F804BEC3FC0A2F01FE014074B15F0180FA2140F5D181FA2021F16E05D183F19C0023F +ED7F804B14FF19004D5A027F4A5A92C7EA07F0EF1FE0EF7F804AD903FEC7FC92B512F017 +FE4AC7EA3F800101ED1FE04A6E7E17078401036F7E5CA30107825CA3010F5E4A1407A260 +011F150F5C4D5A60013F153F4A4A5A4D5A017F4A90C7FC4C5A91C7EA0FF849EC3FF0B812 +C094C8FC16F83C3E7BBD40>66 D<49B77E18F018FC903B0003FE0003FEEF00FF4BEC7F80 +F03FC00207151F19E05DA2020F16F0A25DA2141FF03FE05DA2023F16C0187F4B1580A202 +7FEDFF00604B495A4D5A02FF4A5A4D5A92C7EA3FC04CB4C7FC4990B512FC17E04ACAFCA2 +1303A25CA21307A25CA2130FA25CA2131FA25CA2133FA25CA2137FA25C497EB67EA33C3E +7BBD3E>80 D<92390FF001C0ED7FFE4AB5EA0380913907F80FC791390FC003EF91391F80 +01FF4AC71300027E805C495A4948143EA2495AA2010F153C5CA3011F1538A38094C7FC80 +A214FC6DB4FC15F015FE6DEBFFC06D14F06D14FC6D80143F020F7F020180EC001F150303 +007F167F163FA2161FA212075A5F120EA2001E153F94C7FCA2163E003E157E167C003F15 +FC4B5A486C5C4B5A6D495AD87DE0EB1F80D8F8F849C8FC017F13FE39F03FFFF8D8E00F13 +E048C690C9FC32427ABF33>83 D<277FFFFE01B500FC90B512E0B5FCA200039026800007 +90C7380FFC006C90C701FCEC07F049725A04035EA26350C7FCA20407150EA2040F5D1A3C +041F153862163B6216734F5A6D14E303014B5A6C15C303034BC8FC1683DB0703140E191E +030E151C61031C7F61ED380161157003F04A5A15E002014B5A15C0DA03804AC9FC60DA07 +00140E60140E605C029C5D14B8D97FF85D5C715A5C4A5DA24A92CAFC5F91C7FC705A137E +5F137C5F137801705D53406EBD5B>87 D<147E49B47E903907C1C38090391F80EFC09038 +3F00FF017E137F4914804848133F485AA248481400120F5B001F5C157E485AA215FE007F +5C90C7FCA21401485C5AA21403EDF0385AA21407EDE078020F1370127C021F13F0007E01 +3F13E0003E137FECF3E1261F01E313C03A0F8781E3803A03FF00FF00D800FC133E252977 +A72E>97 DIIII<167C4BB4FC923807C78092380F83C0ED1F87161FED3F3FA2157EA21780EE0E004BC7 +FCA414015DA414035DA30103B512F8A390260007E0C7FCA3140F5DA5141F5DA4143F92C8 +FCA45C147EA414FE5CA413015CA4495AA4495AA4495A121E127F5C12FF49C9FCA2EAFE1E +EAF83C1270EA7878EA3FE0EA0F802A5383BF1C>III<1478EB01FCA21303A314F8EB00E01400AD137C48B4 +FC38038F80EA0707000E13C0121E121CEA3C0F1238A2EA781F00701380A2EAF03F140012 +005B137E13FE5BA212015BA212035B1438120713E0000F1378EBC070A214F0EB80E0A2EB +81C01383148038078700EA03FEEA00F8163E79BC1C>I108 DIII<90 +3903E001F890390FF807FE903A1E7C1E0F80903A1C3E3C07C0013C137801389038E003E0 +EB783F017001C013F0ED80019038F07F0001E015F8147E1603000113FEA2C75AA2010114 +0717F05CA20103140F17E05CA20107EC1FC0A24A1480163F010F15005E167E5E131F4B5A +6E485A4B5A90393FB80F80DA9C1FC7FCEC0FFCEC03E049C9FCA2137EA213FEA25BA21201 +A25BA21203A2387FFFE0B5FCA22D3A80A72E>I114 DI< +EB01C0EB03F01307A25CA2130FA25CA2131FA25CA2133FA291C7FCA2007FB51280B6FC15 +00D8007EC7FC13FEA25BA21201A25BA21203A25BA21207A25BA2120FA25BA2121F141C13 +80A2003F133C1438EB0078147014F05C495AEA1F03495A6C48C7FCEA07FCEA01F0193A78 +B81E>I<137C48B4141C26038F80137EEA0707000E7F001E15FE121CD83C0F5C12381501 +EA781F007001805BA2D8F03F1303140000005D5B017E1307A201FE5C5B150F1201495CA2 +151F0003EDC1C0491481A2153F1683EE0380A2ED7F07000102FF13005C01F8EBDF0F0000 +9038079F0E90397C0F0F1C90391FFC07F8903907F001F02A2979A731>I<017CEB01C048 +B4EB07F038038F80EA0707000E01C013F8121E001C1403EA3C0F0038EC01F0A2D8781F13 +0000705BA2EAF03F91C712E012005B017E130116C013FE5B1503000115805BA2ED070012 +03495B150EA25DA25D1578000114706D5B0000495A6D485AD97E0FC7FCEB1FFEEB03F025 +2979A72A>I<017C167048B491387001FC3A038F8001F8EA0707000E01C015FE001E1403 +001CEDF000EA3C0F0038177C1507D8781F4A133C00701380A2D8F03F130F020049133812 +005B017E011F14784C137013FE5B033F14F0000192C712E05BA2170100034A14C049137E +17031880A2EF070015FE170E00010101141E01F86D131C0000D9039F5BD9FC076D5A903A +3E0F07C1E0903A1FFC03FFC0902703F0007FC7FC372979A73C>I<903903F001F890390F +FC07FE90393C1E0E0F9026780F1C138001F0EBB83FD801E013F89039C007F07FEA038000 +0714E0D9000F140048151C000E4AC7FCA2001E131FA2C75BA2143F92C8FCA35C147EA314 +FE4A131CA30101143C001E1538003F491378D87F811470018314F000FF5D9039077801C0 +39FE0F7C033A7C0E3C078027783C1E1EC7FC391FF80FFC3907E003F029297CA72A>I<13 +7C48B4143826038F8013FCEA0707000E7F001E1401001C15F8EA3C0F12381503D8781F14 +F000701380A2D8F03F1307020013E012005B017E130F16C013FE5B151F1201491480A215 +3F000315005BA25D157EA315FE5D00011301EBF8030000130790387C1FF8EB3FF9EB07E1 +EB00035DA21407000E5CEA3F80007F495AA24A5AD8FF0090C7FC143E007C137E00705B38 +7801F0383803E0381E0FC06CB4C8FCEA03F8263B79A72C>I E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fh cmsl10 10.95 33 +/Fh 33 122 df<007FB5FCA2B512FEA418067C961E>45 D<157015F014011407143F9038 +03FFE0137FEBFFCFEBF80F1300141F15C0A5143F1580A5147F1500A55C5CA513015CA513 +035CA513075CA5130F5CA3131F497EB612F8A31D3D78BC2D>49 DII<01061403D90780131F90390FF801FE91B512FC16F816F016E0168049EB +FE0015F890381C7FC091C8FCA3133C1338A513781370A2EC1FE0ECFFF8903873E03E9038 +FF001F01FCEB0F804914C049EB07E04914F049130390C7FC16F8A61507A21206EA3F8048 +7EA2150F00FF15F0A24914E090C7121F00FC15C000F0143F00701580ED7F0012786C14FE +4A5A6C495A390F800FE03907E03FC06CB5C7FCC613FCEB1FE0283F7ABC2D>53 +D56 DI<17E016011603831607A2160FA2161F83163FA2167F167716F7EEE7FCED +01E316C3150316831507EE03FEED0F01150E151E151C153C03387FED7800157015F05D4A +4880177F4A5AA24AC7FCA2020E81173F5C021FB6FC5CA20270C7EA3FE0171F5CA2495AA2 +494881170F49C8FCA2130EA24982013C1507A2137CD801FE4B7E2607FF80EC3FFEB500F0 +0107B512FC19F85E3E417DC044>65 D<013FB7FC18E018FC903B007FE00007FE6E489038 +01FF809438007FC05DF03FE0F01FF0A3027F16F892C8FCA54A16F04A153F19E0187F19C0 +F0FF8001014B13004A4A5A4D5AEF1FF04D5ADC03FFC7FC49B612F8EFFF8002F8C7EA3FE0 +EF0FF0EF07FC717E010715014A81711380A319C0130F5CA5011F4B13805C19005F601707 +013F4B5A4A4A5A4D5A4D5A017F913801FF8001FF020F90C7FCB812FC17F094C8FC3D3E7D +BD40>II<013FB812F8A39026007F +F0C7127F6E48140F18034B14011800A31978147F4B1570A502FF143892C7FCA319001778 +4915704A14F016011603160F91B6FC495DA29138FC001F16071603160101075D5CA21970 +19F019E0010F4A5A4A90C7120119C0A218031980011F16075CF00F00A260181E013F163E +4A157E4D5A1703017F150F01FFEDFFF8B9FCA2603D3E7DBD3E>69 +D<011FB512FC5BA29039003FF8006E5AA25DA5143F5DA5147F5DA514FF92C7FCA55B5CA5 +13035CA513075CA5130F5CA5131F5CA3133F497E007FB512F0A2B6FC263E7EBD21>73 +D<90263FFFF0933807FFFE5013FC629026007FF8EFFC00023F4D5AA2023BEF77F0A2DA39 +FC16E7A2F101CF0279EE038FDA70FE5FF1070FA2190E1A1FDAF07F151C02E06019381970 +6F7EF1E03F130102C0DB01C05BA26F6CEB0380A2953807007F0103160E4A6C6C93C7FC60 +A2606201076D6C5B02005F60A26F6C485A94380380015B010EDB07005BA2923801FC0EA2 +4D1303131E011C6D6C485C5FA25F1907013CEC7FC0013860013C5D137C01FE6EC7120F26 +07FF80013E4A7EB500FC031FB512F8043C5E4A131C573E7DBD53>77 +D<90263FFFE0023FB5FC6F16FEA29026003FF8020313C0021F030013004A6C157C023B16 +3C6F15381439810238167802787FDA707F157082153F82031F15F002F07FDAE00F5D8215 +078203031401010180DAC0015D82811780047F1303010315C04A013F5C17E0161F17F004 +0F1307010715F891C7000791C7FC17FC160317FE04015B4915FF010E6E130E188E177F18 +CEEF3FDE011E16FE011C6F5AA2170FA21707133C01386F5A133C017C150113FE2607FF80 +1400B512FC18705C483E7DBD44>I<013FB612FEEFFFE018F8903B007FF0000FFC6E48EB +01FF7113804BEC7FC0183F19E0F01FF0A2147F5D19F8A402FFED3FF092C8FCA219E0A2F0 +7FC05B4AEDFF8019004D5A4D5AEF0FF80103ED3FE04A903801FF8091B648C7FC17F002FC +CAFCA213075CA5130F5CA5131F5CA5133F5CA3137F497EB612E0A25D3D3E7DBD3E>80 +D<9239FF8003800207EBF007021F9038FC0F0091387F00FE02FCEB1F1FD903F0EB07BF49 +486DB4FC49487F4A6D5A49C8FC49157E133E137E173E49153CA57F1738A26D92C7FC8080 +80EB7FFEECFFE06D13FEEDFFC06D14F06D14FC010380010080143F020380DA003F7F1503 +1500707E163F161FA2160F121CA31607160F003C5EA35F003E151F94C7FC007E5D007F15 +3E6D5C16FC01E0495AD87DF0495AD8FCFCEB0FC03AF87F803F8027F01FFFFEC8FCD8E007 +13F839C0007FC031427BBF33>83 D85 D97 DIIIII<1478EB01FE130314FF +A25B14FE130314FCEB00F01400ACEB03F8EA01FF14F0A2EA001F130FA314E0A5131F14C0 +A5133F1480A5137F1400A55B5BA4EA03FF007F13F0A2B5FC183E7DBD1A>105 +D<143FEB1FFF5BA213017FA214FEA5130114FCA5130314F8A5130714F0A5130F14E0A513 +1F14C0A5133F1480A5137F1400A55B5BA4EA03FF007F13F8A2B5FC183F7DBE1A>108 +D<903907F007F8D803FFEB1FFF9139E0781FC09138E1E00F3B001FE38007E090380FE700 +02EE14F014FC14D814F85CA24A130F131F4A14E0A4161F133F4A14C0A4163F137F91C713 +80A4167F5B491500A300015D486C491380B5D8F87F13FCA32E287DA733>110 +DI<903907F01F80D803FFEB7FE09138E1E1F09138E387F83900 +1FE707EB0FE614EE02FC13F002D813E09138F801804AC7FCA25C131FA25CA4133F5CA513 +7F91C8FCA55B5BA31201487EB512FEA325287EA724>114 D<9138FF81C0010713E39038 +1F807F90397C003F8049131F4848130F5B00031407A248481400A27FA27F6D90C7FCEBFF +8014FC6C13FF6C14C015F06C6C7F011F7F13079038007FFE1403140100381300157EA212 +3C153E157E007C147CA2007E147815F8007F495A4A5A486C485A26F9E01FC7FC38E0FFFC +38C01FE0222A7DA824>II118 DI<90B539E007FFF05E18E0902707FE000313006D48EB01 +FC705A5F01014A5A5F16036E5C0100140794C7FC160E805E805E1678ED8070023F13F05E +ED81C015C191381FC38015C793C8FC15EF15EEEC0FFCA25DA26E5AA25DA26E5A5DA24AC9 +FC5C140E141E141C5C121C003F5B5A485B495A130300FE5B4848CAFCEA701EEA783CEA3F +F0EA0FC0343A80A630>121 D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fi cmbx12 17.28 43 +/Fi 43 122 df46 D<16F04B7E1507151F153FEC01FF1407 +147F010FB5FCB7FCA41487EBF007C7FCB3B3B3B3007FB91280A6395E74DD51>49 +D<913801FFF8021FEBFFC091B612F8010315FF010F16C0013F8290267FFC0114F89027FF +E0003F7F4890C7000F7F48486E7FD807F86E148048486E14C048486E14E048486F13F001 +FC17F8486C816D17FC6E80B56C16FE8380A219FFA283A36C5BA26C5B6C90C8FCD807FC5D +EA01F0CA14FEA34D13FCA219F85F19F04D13E0A294B512C019804C14004C5B604C5B4C5B +604C13804C90C7FC4C5A4C5A4B13F05F4B13804B90C8FC4B5AED1FF84B5A4B5A4B48143F +4A5B4A48C8FC4A5A4A48157E4A5A4A5AEC7F8092C9FC02FE16FE495A495A4948ED01FCD9 +0FC0150749B8FC5B5B90B9FC5A4818F85A5A5A5A5ABAFCA219F0A4405E78DD51>I<92B5 +FC020F14F8023F14FF49B712C04916F0010FD9C01F13FC90271FFC00077FD93FE001017F +49486D8049C86C7F484883486C6F7F14C0486D826E806E82487FA4805CA36C5E4A5E6C5B +6C5B6C495E011FC85A90C95CA294B55A614C91C7FC604C5B4C5B4C5B4C5B047F13809226 +0FFFFEC8FC020FB512F817E094C9FC17F817FF91C7003F13E0040713F8040113FE707F71 +7F7113E085717FA2717F85A285831A80A31AC0EA03FCEA0FFF487F487F487FA2B57EA31A +80A34D14005C7E4A5E5F6C495E49C8485BD81FF85F000F5ED807FE92B55A6C6C6C491480 +6C01F0010791C7FC6C9026FF803F5B6D90B65A011F16F0010716C001014BC8FCD9001F14 +F0020149C9FC426079DD51>II<01C0EE01C0D801F8160F01FF167F02F0EC07FFDAFF8090B5FC92B712 +8019006060606060606095C7FC17FC5F17E0178004FCC8FC16E09026FC3FFCC9FC91CBFC +ADED3FFE0203B512F0020F14FE023F6E7E91B712E001FDD9E00F7F9027FFFE00037F02F8 +01007F02E06EB4FC02806E138091C8FC496F13C04917E07113F0EA00F090C914F8A219FC +83A219FEA419FFA3EA03F0EA0FFC487E487E487FA2B57EA319FEA35C4D13FC6C90C8FC5B +4917F8EA3FF001804B13F06D17E0001F5E6C6C17C06D4B1380D807FC92B512006C6C4A5B +6C6C6C01075B6C01E0011F5BD97FFE90B55A6DB712C0010F93C7FC6D15FC010115F0D900 +3F1480020301F0C8FC406078DD51>III<92383FFF800203B512FC021FECFF80027F +15E049B712F849D9F0077F010F90C76C7ED91FFCEC1FFFD93FF06E7F494802037F494882 +717F484980854890C9127FA24884183FA25A80A380806E157F6E5E14FE6E7E6F4A5A6C14 +F003FC495B03FF495B6C1580DCE0075B6CDBF80F90C7FC9338FE1FFE6C9238FF7FF84D5A +6D16C06D5E6D4BC8FC6D6F7E6D16E00101826D16FC023F814A8149B87E01078349839026 +3FFE3F8190267FFC0F819026FFF003814849C6FC48496D804849131F4890C70007801601 +48486E1580003F163F49150F007F7014C0491501717E8400FF835B8484A384A21A80A27F +007F1900607F003F606D160F001F606D4C5A6C6D153F6C6D4B5A6C01F04B5A6C01FC0203 +5B6C01FF021F5B6D9027F001FFFEC7FC6D90B65A010F16F001035E010093C8FC020F14F8 +DA007F90C9FC426079DD51>I66 D<4DB5ED03C0057F02F01407 +0407B600FE140F047FDBFFC0131F4BB800F0133F030F05FC137F033F9127F8007FFE13FF +92B6C73807FF814A02F0020113C3020702C09138007FE74A91C9001FB5FC023F01FC1607 +4A01F08291B54882490280824991CB7E49498449498449498449865D49498490B5FC484A +84A2484A84A24891CD127FA25A4A1A3F5AA348491A1FA44899C7FCA25CA3B5FCB07EA380 +A27EA2F50FC0A26C7FA37E6E1A1F6C1D80A26C801D3F6C6E1A00A26C6E616D1BFE6D7F6F +4E5A7F6D6D4E5A6D6D4E5A6D6D4E5A6D6E171F6D02E04D5A6E6DEFFF806E01FC4C90C7FC +020F01FFEE07FE6E02C0ED1FF8020102F8ED7FF06E02FF913803FFE0033F02F8013F1380 +030F91B648C8FC030117F86F6C16E004071680DC007F02F8C9FC050191CAFC626677E375 +>IIII73 D76 D<94381FFFE00407B67E043F15F04BB712FE030F +EEFFC0033FD9FC0014F092B500C0010F13FC020349C7000113FF4A01F86E6C7F021F496F +13E04A01C0030F7F4A496F7F91B5C96C7F0103497013FF494970804B834949717F498749 +49717F49874B8390B586484A717FA24891CB6C7FA2481D804A84481DC0A348497214E0A3 +481DF0A34A85481DF8A5B51CFCB06C1DF8A36E96B5FCA36C1DF0A46C6D4E14E0A36C1DC0 +6E606C1D80A26C6E4D1400A26C6E4D5BA26C6E4D5BA26D6D4D5B6D636D6D4D5B6F94B5FC +6D636D6D4C5C6D6D4C91C7FC6D6E4B5B6D02E0031F5B023F6D4B13F06E01FC92B55A6E01 +FF02035C020302C0010F91C8FC020002FC90B512FC033F90B712F0030F17C0030394C9FC +DB007F15F804071580DC001F01E0CAFC666677E379>79 DI83 D<001FBEFCA64849C79126E0000F +148002E0180091C8171F498601F81A0349864986A2491B7FA2491B3F007F1DC090C9181F +A4007E1C0FA600FE1DE0481C07A5CA95C7FCB3B3B3A3021FBAFCA663617AE070>II<913803FFFE027FEBFF +F00103B612FE010F6F7E4916E090273FFE001F7FD97FE001077FD9FFF801017F486D6D7F +717E486D6E7F85717FA2717FA36C496E7FA26C5B6D5AEB1FC090C9FCA74BB6FC157F0207 +B7FC147F49B61207010F14C0013FEBFE004913F048B512C04891C7FC485B4813F85A5C48 +5B5A5CA2B55AA45FA25F806C5E806C047D7F6EEB01F96C6DD903F1EBFF806C01FED90FE1 +14FF6C9027FFC07FC01580000191B5487E6C6C4B7E011F02FC130F010302F001011400D9 +001F90CBFC49437CC14E>97 D<903807FF80B6FCA6C6FC7F7FB3A8EFFFF8040FEBFF8004 +7F14F00381B612FC038715FF038F010014C0DBBFF0011F7FDBFFC001077F93C76C7F4B02 +007F03F8824B6F7E4B6F13804B17C0851BE0A27313F0A21BF8A37313FCA41BFEAE1BFCA4 +4F13F8A31BF0A24F13E0A24F13C06F17804F1300816F4B5A6F4A5B4AB402075B4A6C6C49 +5B9126F83FE0013F13C09127F00FFC03B55A4A6CB648C7FCDAC00115F84A6C15E091C700 +1F91C8FC90C8000313E04F657BE35A>I<92380FFFF04AB67E020F15F0023F15FC91B77E +01039039FE001FFF4901F8010113804901E0010713C04901804913E0017F90C7FC49484A +13F0A2485B485B5A5C5A7113E0485B7113C048701380943800FE0095C7FC485BA4B5FCAE +7EA280A27EA2806C18FCA26C6D150119F87E6C6D15036EED07F06C18E06C6D150F6D6DEC +1FC06D01E0EC7F806D6DECFF00010701FCEB03FE6D9039FFC03FFC010091B512F0023F5D +020F1580020102FCC7FCDA000F13C03E437BC148>II<92380FFFC04AB512FC020FECFF8002 +3F15E091B712F80103D9FE037F499039F0007FFF011F01C0011F7F49496D7F4990C76C7F +49486E7F48498048844A804884485B727E5A5C48717EA35A5C721380A2B5FCA391B9FCA4 +1A0002C0CBFCA67EA380A27EA27E6E160FF11F806C183F6C7FF17F006C7F6C6D16FE6C17 +016D6C4B5A6D6D4A5A6D01E04A5A6D6DEC3FE0010301FC49B45A6D9026FFC01F90C7FC6D +6C90B55A021F15F8020715E0020092C8FC030713F041437CC14A>III<903807FF80B6FCA6C6FC7F7FB3A8EF1FFF94B512F0040714FC041F14FF4C8193267F +E07F7F922781FE001F7FDB83F86D7FDB87F07FDB8FC0814C7F039FC78015BE03BC8003FC +825DA25DA25DA45DB3B2B7D8F007B71280A651647BE35A>II<903807FF80B6FCA6C6FC7F7FB3B3B3B3 +ADB712E0A623647BE32C>108 D<902607FF80D91FFFEEFFF8B691B500F00207EBFF8004 +0702FC023F14E0041F02FF91B612F84C6F488193267FE07F6D4801037F922781FE001F90 +27E00FF0007FC6DA83F86D9026F01FC06D7F6DD987F06D4A487F6DD98FC0DBF87EC7804C +6D027C80039FC76E488203BEEEFDF003BC6E4A8003FC04FF834B5FA24B5FA24B94C8FCA4 +4B5EB3B2B7D8F007B7D8803FB612FCA67E417BC087>I<902607FF80EB1FFFB691B512F0 +040714FC041F14FF4C8193267FE07F7F922781FE001F7FC6DA83F86D7F6DD987F07F6DD9 +8FC0814C7F039FC78015BE03BC8003FC825DA25DA25DA45DB3B2B7D8F007B71280A65141 +7BC05A>I<923807FFE092B6FC020715E0021F15F8027F15FE494848C66C6C7E010701F0 +010F13E04901C001037F49496D7F4990C87F49486F7E49486F7E48496F13804819C04A81 +4819E048496F13F0A24819F8A348496F13FCA34819FEA4B518FFAD6C19FEA46C6D4B13FC +A36C19F8A26C6D4B13F0A26C19E06C6D4B13C0A26C6D4B13806C6D4B13006D6C4B5A6D6D +495B6D6D495B010701F0010F13E06D01FE017F5B010090B7C7FC023F15FC020715E00200 +92C8FC030713E048437CC151>I<902607FF80EBFFF8B6010FEBFF80047F14F00381B612 +FC038715FF038F010114C09227BFF0003F7FC6DAFFC0010F7F6D91C76C7F6D496E7F03F8 +6E7F4B6E7F4B17804B6F13C0A27313E0A27313F0A21BF885A21BFCA3851BFEAE4F13FCA4 +1BF861A21BF0611BE0611BC06F92B512801B006F5C6F4A5B6F4A5B03FF4A5B70495B04E0 +017F13C09226CFFC03B55A03C7B648C7FC03C115F803C015E0041F91C8FC040313E093CB +FCB3A3B712F0A64F5D7BC05A>I114 +D<913A3FFF8007800107B5EAF81F011FECFE7F017F91B5FC48B8FC48EBE0014890C7121F +D80FFC1407D81FF0801600485A007F167F49153FA212FF171FA27F7F7F6D92C7FC13FF14 +E014FF6C14F8EDFFC06C15FC16FF6C16C06C16F06C826C826C826C82013F1680010F16C0 +1303D9007F15E0020315F0EC001F1500041F13F81607007C150100FC81177F6C163FA217 +1F7EA26D16F0A27F173F6D16E06D157F6D16C001FEEDFF806D0203130002C0EB0FFE02FC +EB7FFC01DFB65A010F5DD8FE0315C026F8007F49C7FC48010F13E035437BC140>II<902607FFC0ED3F +FEB60207B5FCA6C6EE00076D826D82B3B3A260A360A2607F60183E6D6D147E4E7F6D6D49 +48806D6DD907F0ECFF806D01FFEB3FE06D91B55A6E1500021F5C020314F8DA003F018002 +F0C7FC51427BC05A>III<007FB600C0017FB512F8A6 +D8001F01F8C70007EBF0006D040190C7FC6D6D5D6D6D4A5A6D6D4A5A70495A6D4C5A6E7F +6E6D495A6E6D495A7049C8FC6E4A5A6E6D485A6E6D485A6E13FFEF8FF06EEC9FE06FEBFF +C06F5C6F91C9FC5F6F5B816F7F6F7F8481707F8493B57E4B805D4B80DB0FF37FDB1FE17F +04C080153F4B486C7F4B486C7F4A486D7F4A486D7F4A5A4B6D7F020F6E7F4A486D7F4A48 +6D804A5A4AC86C7F49486F7F4A6F7F0107707FEB3FFFB600F049B7FCA650407EBF55>I< +B700C00103B512FCA6D8003F01C0C8381FFE006FED07F0A26D6D5E190F6D6D5E191F6D6D +5E193F6D95C7FC6F5D6D177E6F15FEA26D6E495AA26E6D5C18036E6D5C18076E5E70130F +6E5E70131FA26E6D495AA26E6D91C8FC606E6D137E18FE6E5D17816F5C17C3A26FEBE7F0 +A26FEBF7E017FF6F5CA26F5CA26F91C9FCA36F5BA26F5BA2705AA2705AA2705AA35FA25F +163F94CAFC5E167E16FED807E05CD81FF81301487E486C495AA2B5495AA24B5A5E151F4B +5A6C4849CBFC15FEEBFC01393FF807FC391FF03FF06CB55A6C5C6C91CCFCC613FCEB1FE0 +4E5D7DBF55>I E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fj cmtt10 10.95 76 +/Fj 76 126 df<00101304007C131F00FEEB3F80A26C137FA248133FB2007E1400007C7F +003C131E00101304191C75B830>34 D37 D<141E147F14FF5BEB03FEEB07FCEB0FF0EB1FE0EB3FC0 +EB7F80EBFF00485A5B12035B485A120F5BA2485AA2123F5BA2127F90C7FCA412FEAD127F +A47F123FA27F121FA26C7EA27F12076C7E7F12017F6C7EEB7F80EB3FC0EB1FE0EB0FF0EB +07FCEB03FEEB01FF7F147F141E184771BE30>40 D<127812FE7E7F6C7E6C7EEA0FF06C7E +6C7E6C7E6C7EEB7F80133F14C0131FEB0FE014F01307A2EB03F8A214FC1301A214FE1300 +A4147FAD14FEA4130114FCA2130314F8A2EB07F0A2130F14E0EB1FC0133F1480137FEBFF +00485A485A485A485AEA3FE0485A485A90C7FC5A1278184778BE30>I<14E0497E497EA6 +0038EC0380007EEC0FC0D8FF83EB3FE001C3137F9038F3F9FF267FFBFB13C06CB6128000 +0FECFE00000314F86C5C6C6C13C0011F90C7FC017F13C048B512F04880000F14FE003FEC +FF80267FFBFB13C026FFF3F913E09038C3F87F0183133FD87E03EB0FC00038EC03800000 +91C7FCA66D5A6D5A23277AAE30>I<143EA2147FAF007FB7FCA2B81280A36C1600A2C76C +C8FCAF143EA229297DAF30>II<007FB612F0A2B712F8A36C15F0A225077B9E30>I<120FEA3FC0EA7FE0A2EAFFF0A4EA +7FE0A2EA3FC0EA0F000C0C6E8B30>I<16F01501ED03F8A21507A2ED0FF0A2ED1FE0A2ED +3FC0A2ED7F80A2EDFF00A24A5AA25D1403A24A5AA24A5AA24A5AA24A5AA24A5AA24AC7FC +A2495AA25C1303A2495AA2495AA2495AA2495AA2495AA249C8FCA2485AA25B1203A2485A +A2485AA2485AA2485AA2485AA248C9FCA25AA2127CA225477BBE30>I<14FE903807FFC0 +497F013F13F8497F90B57E48EB83FF4848C6138049137F4848EB3FC04848EB1FE049130F +001F15F0491307A24848EB03F8A290C712014815FCA400FEEC00FEAD6C14016C15FCA36D +1303003F15F8A26D1307001F15F0A26D130F6C6CEB1FE0A26C6CEB3FC06C6CEB7F806D13 +FF2601FF8313006CEBFFFE6D5B6D5B010F13E06D5BD900FEC7FC273A7CB830>IIIII<000FB612804815C05AA316800180C8FCAEEB +83FF019F13C090B512F015FC8181D9FE0313809039F0007FC049133F0180EB1FE06CC712 +0F000E15F0C81207A216F81503A31218127EA2B4FC150716F048140F6C15E06C141F6DEB +3FC06D137F3A3FE001FF80261FFC0F13006CB55A6C5C6C5C6C14E06C6C1380D90FFCC7FC +25397BB730>II<127CB712FC16FEA416FC48C7EA0FF816F0ED1FE0007CEC3FC0 +C8EA7F80EDFF00A24A5A4A5A5D14075D140F5D4A5AA24A5AA24AC7FCA25C5C13015CA213 +035CA213075CA4495AA6131F5CA96D5A6DC8FC273A7CB830>I<49B4FC011F13F0017F13 +FC90B57E0003ECFF804815C048010113E03A1FF8003FF049131FD83FC0EB07F8A24848EB +03FC90C71201A56D1303003F15F86D13076C6CEB0FF06C6CEB1FE0D807FCEB7FC03A03FF +83FF806C90B512006C6C13FC011F13F0497F90B512FE48802607FE0013C0D80FF8EB3FE0 +D81FE0EB0FF04848EB07F8491303007F15FC90C712014815FE481400A66C14016C15FC6D +1303003F15F86D1307D81FF0EB1FF06D133F3A0FFF01FFE06C90B512C06C1580C6ECFE00 +6D5B011F13F0010190C7FC273A7CB830>I<49B4FC010F13E0013F13F890B57E48804880 +48010113803A0FFC007FC0D81FF0EB3FE04848131F49EB0FF048481307A290C7EA03F85A +4815FC1501A416FEA37E7E6D1303A26C6C13076C6C130F6D133FD80FFC13FF6CB6FC7E6C +14FE6C14F9013FEBE1FC010F138190380060011400ED03F8A2150716F0150F000F15E048 +6C131F486CEB3FC0157FEDFF804A1300EC07FE391FF01FFC90B55A6C5C6C5C6C1480C649 +C7FCEB3FF0273A7CB830>I<120FEA3FC0EA7FE0A2EAFFF0A4EA7FE0A2EA3FC0EA0F00C7 +FCAF120FEA3FC0EA7FE0A2EAFFF0A4EA7FE0A2EA3FC0EA0F000C276EA630>II<16F01503ED07F8151F157FEDFFF014034A13C0021F138091383F +FE00ECFFF8495B010713C0495BD93FFEC7FC495A3801FFF0485B000F13804890C8FCEA7F +FC5BEAFFE05B7FEA7FF87FEA1FFF6C7F000313E06C7F38007FFC6D7E90380FFF806D7F01 +0113F06D7FEC3FFE91381FFF80020713C06E13F01400ED7FF8151F1507ED03F01500252F +7BB230>I<1278127EB4FC13C07FEA7FF813FEEA1FFF6C13C000037F6C13F86C6C7EEB1F +FF6D7F010313E06D7F9038007FFC6E7E91380FFF806E13C0020113F080ED3FF8151F153F +EDFFF05C020713C04A138091383FFE004A5A903801FFF0495B010F13804990C7FCEB7FFC +48485A4813E0000F5B4890C8FCEA7FFE13F8EAFFE05B90C9FC127E1278252F7BB230>62 +D64 +D<147F4A7EA2497FA4497F14F7A401077F14E3A3010F7FA314C1A2011F7FA490383F80FE +A590387F007FA4498049133F90B6FCA34881A39038FC001F00038149130FA40007814913 +07A2D87FFFEB7FFFB56CB51280A46C496C130029397DB830>I<007FB512F0B612FE6F7E +82826C813A03F8001FF815076F7E1501A26F7EA615015EA24B5A1507ED1FF0ED7FE090B6 +5A5E4BC7FC6F7E16E0829039F8000FF8ED03FC6F7E1500167FA3EE3F80A6167F1700A25E +4B5A1503ED1FFC007FB6FCB75A5E16C05E6C02FCC7FC29387EB730>I<91387F803C9039 +03FFF03E49EBFC7E011F13FE49EBFFFE5B9038FFE07F48EB801F3903FE000F484813075B +48481303A2484813015B123F491300A2127F90C8FC167C16005A5AAC7E7EA2167C6D14FE +123FA27F121F6D13016C6C14FCA26C6CEB03F86D13076C6CEB0FF03901FF801F6C9038E0 +7FE06DB512C06D14806D1400010713FC6D13F09038007FC0273A7CB830>I<003FB512E0 +4814FCB67E6F7E6C816C813A03F8007FF0ED1FF8150F6F7E6F7E15016F7EA2EE7F80A216 +3F17C0161FA4EE0FE0AC161F17C0A3163F1780A2167F17005E4B5A15034B5A150F4B5AED +7FF0003FB65A485DB75A93C7FC6C14FC6C14E02B387FB730>I<007FB7FCB81280A47ED8 +03F8C7123FA8EE1F0093C7FCA4157C15FEA490B5FCA6EBF800A4157C92C8FCA5EE07C0EE +0FE0A9007FB7FCB8FCA46C16C02B387EB730>I<003FB712804816C0B8FCA27E7ED801FC +C7121FA8EE0F8093C7FCA5153E157FA490B6FCA69038FC007FA4153E92C8FCAE383FFFF8 +487FB5FCA27E6C5B2A387EB730>I<02FF13F00103EBC0F8010F13F1013F13FD4913FF90 +B6FC4813C1EC007F4848133F4848131F49130F485A491307121F5B123F491303A2127F90 +C7FC6F5A92C8FC5A5AA892B5FC4A14805CA26C7F6C6D1400ED03F8A27F003F1407A27F12 +1F6D130F120F7F6C6C131FA2D803FE133F6C6C137FECC1FF6C90B5FC7F6D13FB010F13F3 +0103EBC1F0010090C8FC293A7DB830>I<3B3FFF800FFFE0486D4813F0B56C4813F8A26C +496C13F06C496C13E0D803F8C7EAFE00B290B6FCA601F8C7FCB3A23B3FFF800FFFE0486D +4813F0B56C4813F8A26C496C13F06C496C13E02D387FB730>I<007FB6FCB71280A46C15 +00260007F0C7FCB3B3A8007FB6FCB71280A46C1500213879B730>I75 +D<383FFFF8487FB57EA26C5B6C5BD801FCC9FCB3B0EE0F80EE1FC0A9003FB7FC5AB8FCA2 +7E6C16802A387EB730>III<90383FFFE048B512FC000714FF4815804815C04815E0EB +F80001E0133FD87F80EB0FF0A290C71207A44815F8481403B3A96C1407A26C15F0A36D13 +0FA26D131F6C6CEB3FE001F813FF90B6FC6C15C06C15806C1500000114FCD8003F13E025 +3A7BB830>I<007FB512F0B612FE6F7E16E0826C813903F8003FED0FFCED03FE15016F7E +A2821780163FA6167F17005EA24B5A1503ED0FFCED3FF890B6FC5E5E16804BC7FC15F001 +F8C9FCB0387FFFC0B57EA46C5B29387EB730>I<003FB57E4814F0B612FC15FF6C816C81 +2603F8017F9138003FF0151F6F7E15071503821501A515035E1507150F4B5A153F4AB45A +90B65A5E93C7FC5D8182D9F8007FED3FE0151F150F821507A817F8EEF1FCA53A3FFF8003 +FB4801C0EBFFF8B56C7E17F06C496C13E06C49EB7FC0C9EA1F002E397FB730>82 +D<90390FF803C0D97FFF13E048B512C74814F74814FF5A381FF80F383FE001497E484813 +7F90C7123F5A48141FA2150FA37EED07C06C91C7FC7F7FEA3FF0EA1FFEEBFFF06C13FF6C +14E0000114F86C80011F13FF01031480D9003F13C014019138007FE0151FED0FF0A2ED07 +F8A2007C140312FEA56C140716F07F6DEB0FE06D131F01F8EB3FC001FF13FF91B5128016 +0000FD5CD8FC7F13F8D8F81F5BD878011380253A7BB830>I<003FB712C04816E0B8FCA4 +3AFE003F800FA8007CED07C0C791C7FCB3B1011FB5FC4980A46D91C7FC2B387EB730>I< +3B7FFFC007FFFCB56C4813FEA46C496C13FCD803F8C7EA3F80B3B16D147F00011600A36C +6C14FE6D13016D5CEC800390393FE00FF890391FF83FF06DB55A6D5C6D5C6D91C7FC9038 +007FFCEC1FF02F3980B730>III<3A3FFF01FFF84801837F02C77FA202835B6C01015B3A01FC007F806D91C7FC00 +005C6D5BEB7F01EC81FCEB3F8314C3011F5B14E7010F5B14FF6D5BA26D5BA26D5BA26D90 +C8FCA4497FA2497FA2815B81EB0FE781EB1FC381EB3F8181EB7F0081497F49800001143F +49800003141F49800007140FD87FFEEB7FFFB590B5128080A25C6C486D130029387DB730 +>II<007FB612F0A2B712F8A36C15F0A225077B7D30>95 D97 DII<913801FFE0 +4A7F5CA28080EC0007AAEB03FE90381FFF874913E790B6FC5A5A481303380FFC00D81FF0 +133F49131F485A150F4848130790C7FCA25AA25AA87E6C140FA27F003F141F6D133F6C7E +6D137F390FF801FF2607FE07EBFFC06CB712E06C16F06C14F76D01C713E0011F010313C0 +D907FCC8FC2C397DB730>I<49B4FC010713E0011F13F8017F7F90B57E48804801811380 +3A07FC007FC04848133FD81FE0EB1FE0150F484814F0491307127F90C7FCED03F85A5AB7 +FCA516F048C9FC7E7EA27F003FEC01F06DEB03F86C7E6C7E6D1307D807FEEB1FF03A03FF +C07FE06C90B5FC6C15C0013F14806DEBFE00010713F8010013C0252A7CA830>IIII<14E0EB03F8A2497EA36D5AA2EB00E091C8FCA9381FFFF8487F5AA27E7EEA0001B3 +A9003FB612C04815E0B7FCA27E6C15C023397AB830>I +107 D<387FFFF8B57EA47EEA0001B3B3A8007FB612F0B712F8A46C15F025387BB730>I< +02FC137E3B7FC3FF01FF80D8FFEF01877F90B500CF7F15DF92B57E6C010F13872607FE07 +EB03F801FC13FE9039F803FC01A201F013F8A301E013F0B3A23C7FFE0FFF07FF80B54801 +8F13C0A46C486C01071380322881A730>II<49B4FC +010F13E0013F13F8497F90B57E0003ECFF8014013A07FC007FC04848EB3FE0D81FE0EB0F +F0A24848EB07F8491303007F15FC90C71201A300FEEC00FEA86C14016C15FCA26D130300 +3F15F86D13076D130F6C6CEB1FF06C6CEB3FE06D137F3A07FF01FFC06C90B512806C1500 +6C6C13FC6D5B010F13E0010190C7FC272A7CA830>II<49B413F8010FEBC1FC013F13F14913FD48B6FC5A481381390F +FC007F49131F4848130F491307485A491303127F90C7FC15015A5AA77E7E15037FA26C6C +1307150F6C6C131F6C6C133F01FC137F3907FF01FF6C90B5FC6C14FD6C14F9013F13F101 +0F13C1903803FE0190C7FCAD92B512F84A14FCA46E14F82E3C7DA730>II< +90381FFC1E48B5129F000714FF5A5A5A387FF007EB800100FEC7FC4880A46C143E007F91 +C7FC13E06CB4FC6C13FC6CEBFF806C14E0000114F86C6C7F01037F9038000FFF02001380 +007C147F00FEEC1FC0A2150F7EA27F151F6DEB3F806D137F9039FC03FF0090B6FC5D5D00 +FC14F0D8F83F13C026780FFEC7FC222A79A830>III<3B3FFFC07F +FF80486DB512C0B515E0A26C16C06C496C13803B01F80003F000A26D130700005DA26D13 +0F017E5CA2017F131F6D5CA2EC803F011F91C7FCA26E5A010F137EA2ECE0FE01075BA214 +F101035BA3903801FBF0A314FF6D5BA36E5A6E5A2B277EA630>I<3B3FFFC01FFFE0486D +4813F0B515F8A26C16F06C496C13E0D807E0C7EA3F00A26D5C0003157EA56D14FE00015D +EC0F80EC1FC0EC3FE0A33A00FC7FF1F8A2147DA2ECFDF9017C5C14F8A3017E13FBA29039 +3FF07FE0A3ECE03FA2011F5C90390F800F802D277FA630>I<3A3FFF81FFFC4801C37FB5 +80A26C5D6C01815BC648C66CC7FC137FEC80FE90383F81FC90381FC3F8EB0FE3ECE7F06D +B45A6D5B7F6D5B92C8FC147E147F5C497F81903803F7E0EB07E790380FE3F0ECC1F89038 +1F81FC90383F80FE90387F007E017E137F01FE6D7E48486D7E267FFF80B5FCB500C11480 +14E3A214C16C0180140029277DA630>I<3B3FFFC07FFF80486DB512C0B515E0A26C16C0 +6C496C13803B01FC0003F000A2000014076D5C137E150F017F5C7F151FD91F805BA214C0 +010F49C7FCA214E00107137EA2EB03F0157C15FCEB01F85DA2EB00F9ECFDF0147D147FA2 +6E5AA36E5AA35DA2143F92C8FCA25C147EA2000F13FE486C5AEA3FC1EBC3F81387EB8FF0 +EBFFE06C5B5C6C90C9FC6C5AEA01F02B3C7EA630>I<001FB612FC4815FE5AA316FC90C7 +EA0FF8ED1FF0ED3FE0ED7FC0EDFF80003E491300C7485A4A5A4A5A4A5A4A5A4A5A4A5A49 +90C7FC495A495A495A495A495A495A4948133E4890C7127F485A485A485A485A485A48B7 +FCB8FCA46C15FE28277DA630>II125 D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fk cmbx12 14.4 49 +/Fk 49 122 df<151E153E157E15FCEC01F8EC07F0EC0FE0EC1FC01580143FEC7F0014FE +1301495A5C1307495AA2495A133F5C137FA2495AA24890C7FCA25A5BA21207A2485AA312 +1F5BA3123FA25BA3127FA55B12FFB3A3127F7FA5123FA37FA2121FA37F120FA36C7EA212 +03A27F7EA26C7FA26D7EA2133F80131F6D7EA26D7E1303806D7E1300147FEC3F80141F15 +C0EC0FE0EC07F0EC01F8EC00FC157E153E151E1F7973D934>40 D<127012F8127C127E7E +EA1FC06C7E6C7E12037F6C7E6C7E7F6D7E133F806D7EA26D7E80130780A26D7EA26D7EA2 +15807FA215C0A2EC7FE0A315F0143FA315F8A2141FA315FCA5140F15FEB3A315FC141FA5 +15F8A3143FA215F0A3147F15E0A3ECFFC0A21580A25B1500A2495AA2495AA25C130F5C49 +5AA2495A5C137F49C7FC5B485A485A5B1207485A485A48C8FC127E127C5A12701F7979D9 +34>I46 +D<913803FFC0023F13FC91B6FC010315C0010F018113F0903A1FFC003FF849486D7E4948 +6D7E49486D7E48496D138048496D13C0A24817E04890C813F0A34817F8A24817FC49157F +A3007F17FEA600FF17FFB3A5007F17FEA6003F17FCA26D15FFA26C17F8A36C17F0A26C6D +4913E0A26C6D4913C06C17806E5B6C6D4913006D6C495AD91FFCEB3FF8903A0FFF81FFF0 +6D90B55A01011580D9003F01FCC7FC020313C0384F7BCD43>48 D<157815FC1403140714 +1F14FF130F0007B5FCB6FCA2147F13F0EAF800C7FCB3B3B3A6007FB712FEA52F4E76CD43 +>II<91380FFFC091B512FC0107ECFF80011F15E090 +263FF8077F9026FF800113FC4848C76C7ED803F86E7E491680D807FC8048B416C080486D +15E0A4805CA36C17C06C5B6C90C75AD801FC1680C9FC4C13005FA24C5A4B5B4B5B4B13C0 +4B5BDBFFFEC7FC91B512F816E016FCEEFF80DA000713E0030113F89238007FFE707E7013 +807013C018E07013F0A218F8A27013FCA218FEA2EA03E0EA0FF8487E487E487EB57EA318 +FCA25E18F891C7FC6C17F0495C6C4816E001F04A13C06C484A1380D80FF84A13006CB44A +5A6CD9F0075BC690B612F06D5D011F1580010302FCC7FCD9001F1380374F7ACD43>I<17 +7C17FEA2160116031607160FA2161F163F167FA216FF5D5DA25D5DED1FBFED3F3F153E15 +7C15FCEC01F815F0EC03E01407EC0FC01580EC1F005C147E147C5C1301495A495A5C495A +131F49C7FC133E5B13FC485A5B485A1207485A485A90C8FC123E127E5ABA12C0A5C96C48 +C7FCAF020FB712C0A53A4F7CCE43>III<121F7F7F +EBFF8091B81280A45A1900606060A2606060485F0180C86CC7FC007EC95A4C5A007C4B5A +5F4C5A160F4C5A484B5A4C5A94C8FC16FEC812014B5A5E4B5A150F4B5AA24B5AA24B5A15 +FFA24A90C9FCA25C5D1407A2140FA25D141FA2143FA4147F5DA314FFA55BAC6D5BA2EC3F +C06E5A395279D043>I<913807FFC0027F13FC0103B67E010F15E090261FFC0113F8903A +3FE0003FFCD97F80EB0FFE49C76C7E48488048486E1380000717C04980120F18E0177FA2 +121F7FA27F7F6E14FF02E015C014F802FE4913806C7FDBC00313009238F007FE6C02F85B +9238FE1FF86C9138FFBFF06CEDFFE017806C4BC7FC6D806D81010F15E06D81010115FC01 +0781011F81491680EBFFE748018115C048D9007F14E04848011F14F048487F4848130303 +0014F8484880161F4848020713FC1601824848157F173FA2171FA2170FA218F8A27F007F +17F06D151FA26C6CED3FE0001F17C06D157F6C6CEDFF806C6C6C010313006C01E0EB0FFE +6C01FCEBFFFC6C6CB612F06D5D010F1580010102FCC7FCD9000F13C0364F7ACD43>I<91 +380FFF8091B512F8010314FE010F6E7E4901037F90267FF8007F4948EB3FF048496D7E48 +4980486F7E484980824817805A91C714C05A7013E0A218F0B5FCA318F8A618FCA46C5DA3 +7EA25E6C7F6C5DA26C5D6C7F6C6D137B6C6D13F390387FF803011FB512E36D14C3010302 +8313F89039007FFE03EC00401500A218F05EA3D801F816E0487E486C16C0487E486D4913 +80A218005E5F4C5A91C7FC6C484A5A494A5A49495B6C48495BD803FC010F5B9027FF807F +FEC7FC6C90B55A6C6C14F06D14C0010F49C8FC010013F0364F7ACD43>I<171F4D7E4D7E +A24D7EA34C7FA24C7FA34C7FA34C7FA24C7FA34C8083047F80167E8304FE804C7E030181 +16F8830303814C7E03078116E083030F814C7E031F81168083033F8293C77E4B82157E84 +03FE824B800201835D840203834B800207835D844AB87EA24A83A3DA3F80C88092C97E4A +84A2027E8202FE844A82010185A24A820103854A82010785A24A82010F855C011F717FEB +FFFCB600F8020FB712E0A55B547BD366>65 DI<932601FFFCEC01C0047FD9FFC013030307B600F81307033F03FE131F +92B8EA803F0203DAE003EBC07F020F01FCC7383FF0FF023F01E0EC0FF94A01800203B5FC +494848C9FC4901F8824949824949824949824949824990CA7E494883A2484983485B1B7F +485B481A3FA24849181FA3485B1B0FA25AA298C7FC5CA2B5FCAE7EA280A2F307C07EA36C +7FA21B0F6C6D1980A26C1A1F6C7F1C006C6D606C6D187EA26D6C606D6D4C5A6D6D16036D +6D4C5A6D6D4C5A6D01FC4C5A6D6DEE7F806D6C6C6C4BC7FC6E01E0EC07FE020F01FEEC1F +F80203903AFFE001FFF0020091B612C0033F93C8FC030715FCDB007F14E0040101FCC9FC +525479D261>I +III73 D76 +D<93380FFFC00303B6FC031F15E092B712FC0203D9FC0013FF020F01C0010F13C0023F90 +C7000313F0DA7FFC02007F494848ED7FFE4901E0ED1FFF49496F7F49496F7F4990C96C7F +49854948707F4948707FA24849717E48864A83481B804A83481BC0A2481BE04A83A2481B +F0A348497113F8A5B51AFCAF6C1BF86E5FA46C1BF0A26E5F6C1BE0A36C6D4D13C0A26C6D +4D1380A26C1B006C6D4D5A6E5E6C626D6C4C5B6D6D4B5B6D6D4B5B6D6D4B5B6D6D4B5B6D +6D4B90C7FC6D6D4B5A6D01FF02035B023F01E0011F13F0020F01FC90B512C0020390B7C8 +FC020016FC031F15E0030392C9FCDB001F13E0565479D265>79 DI82 D<91260FFF80130791B500F85B010702FF5B011FEDC0 +3F49EDF07F9026FFFC006D5A4801E0EB0FFD4801800101B5FC4848C87E48488149150F00 +1F824981123F4981007F82A28412FF84A27FA26D82A27F7F6D93C7FC14C06C13F014FF15 +F86CECFF8016FC6CEDFFC017F06C16FC6C16FF6C17C06C836C836D826D82010F82130301 +0082021F16801400030F15C0ED007F040714E01600173F050F13F08383A200788200F882 +A3187FA27EA219E07EA26CEFFFC0A27F6D4B13806D17006D5D01FC4B5A01FF4B5A02C04A +5A02F8EC7FF0903B1FFFC003FFE0486C90B65AD8FC0393C7FC48C66C14FC48010F14F048 +D9007F90C8FC3C5479D24B>I<003FBC1280A59126C0003F9038C0007F49C71607D87FF8 +060113C001E08449197F49193F90C8171FA2007E1A0FA3007C1A07A500FC1BE0481A03A6 +C994C7FCB3B3AC91B912F0A553517BD05E>II97 DI<913801FFF8021FEB +FF8091B612F0010315FC010F9038C00FFE903A1FFE0001FFD97FFC491380D9FFF05B4817 +C048495B5C5A485BA2486F138091C7FC486F1300705A4892C8FC5BA312FFAD127F7FA27E +A2EF03E06C7F17076C6D15C07E6E140F6CEE1F806C6DEC3F006C6D147ED97FFE5C6D6CEB +03F8010F9038E01FF0010390B55A01001580023F49C7FC020113E033387CB63C>I<4DB4 +7E0407B5FCA5EE001F1707B3A4913801FFE0021F13FC91B6FC010315C7010F9038E03FE7 +4990380007F7D97FFC0101B5FC49487F4849143F484980485B83485B5A91C8FC5AA3485A +A412FFAC127FA36C7EA37EA26C7F5F6C6D5C7E6C6D5C6C6D49B5FC6D6C4914E0D93FFED9 +0FEFEBFF80903A0FFFC07FCF6D90B5128F0101ECFE0FD9003F13F8020301C049C7FC4154 +7CD24B>I<913803FFC0023F13FC49B6FC010715C04901817F903A3FFC007FF849486D7E +49486D7E4849130F48496D7E48178048497F18C0488191C7FC4817E0A248815B18F0A212 +FFA490B8FCA318E049CAFCA6127FA27F7EA218E06CEE01F06E14037E6C6DEC07E0A26C6D +EC0FC06C6D141F6C6DEC3F806D6CECFF00D91FFEEB03FE903A0FFFC03FF8010390B55A01 +0015C0021F49C7FC020113F034387CB63D>IIII<137F497E000313E0487FA2487FA76C5BA2 +6C5BC613806DC7FC90C8FCADEB3FF0B5FCA512017EB3B3A6B612E0A51B547BD325>I108 DII<913801FFE0021F13FE91B612C0010315F0010F9038807F +FC903A1FFC000FFED97FF86D6C7E49486D7F48496D7F48496D7F4A147F48834890C86C7E +A24883A248486F7EA3007F1880A400FF18C0AC007F1880A3003F18006D5DA26C5FA26C5F +6E147F6C5F6C6D4A5A6C6D495B6C6D495B6D6C495BD93FFE011F90C7FC903A0FFF807FFC +6D90B55A010015C0023F91C8FC020113E03A387CB643>I<903A3FF001FFE0B5010F13FE +033FEBFFC092B612F002F301017F913AF7F8007FFE0003D9FFE0EB1FFFC602806D7F92C7 +6C7F4A824A6E7F4A6E7FA2717FA285187F85A4721380AC1A0060A36118FFA2615F616E4A +5BA26E4A5B6E4A5B6F495B6F4990C7FC03F0EBFFFC9126FBFE075B02F8B612E06F148003 +1F01FCC8FC030313C092CBFCB1B612F8A5414D7BB54B>I<90397FE003FEB590380FFF80 +033F13E04B13F09238FE1FF89139E1F83FFC0003D9E3E013FEC6ECC07FECE78014EF1500 +14EE02FEEB3FFC5CEE1FF8EE0FF04A90C7FCA55CB3AAB612FCA52F367CB537>114 +D<903903FFF00F013FEBFE1F90B7FC120348EB003FD80FF81307D81FE0130148487F4980 +127F90C87EA24881A27FA27F01F091C7FC13FCEBFFC06C13FF15F86C14FF16C06C15F06C +816C816C81C681013F1580010F15C01300020714E0EC003F030713F015010078EC007F00 +F8153F161F7E160FA27E17E07E6D141F17C07F6DEC3F8001F8EC7F0001FEEB01FE9039FF +C00FFC6DB55AD8FC1F14E0D8F807148048C601F8C7FC2C387CB635>I<143EA6147EA414 +FEA21301A313031307A2130F131F133F13FF5A000F90B6FCB8FCA426003FFEC8FCB3A9EE +07C0AB011FEC0F8080A26DEC1F0015806DEBC03E6DEBF0FC6DEBFFF86D6C5B021F5B0203 +13802A4D7ECB34>IIII<007FB500 +F090387FFFFEA5C66C48C7000F90C7FC6D6CEC07F86D6D5C6D6D495A6D4B5A6F495A6D6D +91C8FC6D6D137E6D6D5B91387FFE014C5A6E6C485A6EEB8FE06EEBCFC06EEBFF806E91C9 +FCA26E5B6E5B6F7E6F7EA26F7F834B7F4B7F92B5FCDA01FD7F03F87F4A486C7E4A486C7E +020F7FDA1FC0804A486C7F4A486C7F02FE6D7F4A6D7F495A49486D7F01076F7E49486E7E +49486E7FEBFFF0B500FE49B612C0A542357EB447>II +E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fl cmr10 10.95 83 +/Fl 83 124 df<4AB4EB0FE0021F9038E03FFC913A7F00F8FC1ED901FC90383FF03FD907 +F090397FE07F80494801FF13FF4948485BD93F805C137F0200ED7F00EF003E01FE6D91C7 +FC82ADB97EA3C648C76CC8FCB3AE486C4A7E007FD9FC3FEBFF80A339407FBF35>11 +D<4AB4FC021F13C091387F01F0903901FC0078D907F0131C4948133E494813FF49485A13 +7F1400A213FE6F5A163893C7FCAA167FB8FCA33900FE00018182B3AC486CECFF80007FD9 +FC3F13FEA32F407FBF33>I<4AB47E021F13F791387F00FFEB01F8903807F001EB0FE0EB +1FC0EB3F80137F14008101FE80AEB8FCA3C648C77EB3AE486CECFF80007FD9FC3F13FEA3 +2F407FBF33>I<001E130F397F803FC000FF137F01C013E0A201E013F0A3007F133F391E +600F3000001300A401E01370491360A3000114E04913C00003130101001380481303000E +EB070048130E0018130C0038131C003013181C1C7DBE2D>34 D<14E0A4EB07FC90383FFF +8090B512E03901F8E3F03903E0E0FCD807C0133CD80F807FD81F007F003E80003C158000 +7C140316C00078141F00F8143F157FA47EED3F806CEC0E0092C7FC127F138013C0EA3FF0 +13FEEA1FFF6C13FC6C13FF6C14C06C806C6C13F8011F7F130301007FECE7FF14E102E013 +80157F153FED1FC0A2003E140F127FD8FF801307A5130000FC158000F0140F1270007815 +005D6C141E153E6C5C6C5C3907C0E1F03903F8EFE0C6B51280D93FFEC7FCEB0FF8EB00E0 +A422497BC32D>36 D<013F4C7ED9FFC04B7E2601E0E015072607C070150F48486C4B5A02 +3E4BC7FC48486C5D48D90FC0EB01FE003ED90EF0EB07FCDA0F3F133E007E903A070FFFF8 +F8007C0200EBC1F0EE000300FC6D6C495A604D5A171F95C8FC173E177E177C5F16015F00 +7C4948485A1607007E5E003E49495A020E131F003F93C9FC6C49133E260F803C137E0238 +137C6C6C485B3901E0E0016CB448485AD93F0049133F90C74848EBFFC0030F903801E0E0 +93398007C0704B4848487E4B153C033E90381F001C4B497F03FC133E4B150F4A48017E7F +0203147C5D4A4801FCEB0380140F5D4AC7FC5C143E5C14FC5C495A13034948027CEB0700 +5C4948147E011F033E5B91C8140E013E153F017E6F5B017C92380F803C4917380001706C +5A49923801E0E0496FB45A6C48043FC7FC41497BC34C>II<121EEA7F8012FF13C0 +A213E0A3127FEA1E601200A413E013C0A312011380120313005A120E5A1218123812300B +1C79BE19>I<1430147014E0EB01C0EB03801307EB0F00131E133E133C5B13F85B12015B +1203A2485AA2120F5BA2121F90C7FCA25AA3123E127EA6127C12FCB2127C127EA6123E12 +3FA37EA27F120FA27F1207A26C7EA212017F12007F13787F133E131E7FEB07801303EB01 +C0EB00E014701430145A77C323>I<12C07E12707E7E121E7E6C7E7F12036C7E7F12007F +1378137CA27FA2133F7FA21480130FA214C0A3130714E0A6130314F0B214E01307A614C0 +130FA31480A2131F1400A25B133EA25BA2137813F85B12015B485A12075B48C7FC121E12 +1C5A5A5A5A145A7BC323>II<121EEA7F8012FF13C0A213E0A3127FEA1E601200A413E013 +C0A312011380120313005A120E5A1218123812300B1C798919>44 +DI<121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A0A798919>IIIIII<150E151E153EA2157EA215FE1401A21403EC077E140614 +0E141CA214381470A214E0EB01C0A2EB0380EB0700A2130E5BA25B5BA25B5B1201485A90 +C7FC5A120E120C121C5AA25A5AB8FCA3C8EAFE00AC4A7E49B6FCA3283E7EBD2D>I<0006 +1403D80780131F01F813FE90B5FC5D5D5D15C092C7FC14FCEB3FE090C9FCACEB01FE9038 +0FFF8090383E03E090387001F8496C7E49137E497F90C713800006141FC813C0A216E015 +0FA316F0A3120C127F7F12FFA416E090C7121F12FC007015C012780038EC3F80123C6CEC +7F00001F14FE6C6C485A6C6C485A3903F80FE0C6B55A013F90C7FCEB07F8243F7CBC2D> +II<1238123C123F90B612FCA316F8 +5A16F016E00078C712010070EC03C0ED078016005D48141E151C153C5DC8127015F04A5A +5D14034A5A92C7FC5C141EA25CA2147C147814F8A213015C1303A31307A3130F5CA2131F +A6133FAA6D5A0107C8FC26407BBD2D>III<121EEA7F80A2 +EAFFC0A4EA7F80A2EA1E00C7FCB3121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A2779A619 +>I<121EEA7F80A2EAFFC0A4EA7F80A2EA1E00C7FCB3121E127FEAFF80A213C0A4127F12 +1E1200A412011380A3120313005A1206120E120C121C5A1230A20A3979A619>I63 +D<15074B7EA34B7EA34B7EA34B7EA34B7E15E7A2913801C7FC15C3A291380381FEA34AC6 +7EA3020E6D7EA34A6D7EA34A6D7EA34A6D7EA34A6D7EA349486D7E91B6FCA24981913880 +0001A249C87EA24982010E157FA2011E82011C153FA2013C820138151FA2017882170F13 +FC00034C7ED80FFF4B7EB500F0010FB512F8A33D417DC044>65 DIIIIIIII<011FB512FCA3D9000713006E5A1401B3B3A6123FEA7F80EAFFC0A44A5A1380 +D87F005B007C130700385C003C495A6C495A6C495A2603E07EC7FC3800FFF8EB3FC02640 +7CBD2F>IIIIIII82 DI<003FB91280A3903AF0007FE001018090393FC0003F48C7ED1FC0007E +1707127C00781703A300701701A548EF00E0A5C81600B3B14B7E4B7E0107B612FEA33B3D +7DBC42>IIII +89 D<003FB712F8A391C7EA1FF013F801E0EC3FE00180EC7FC090C8FC003EEDFF80A200 +3C4A1300007C4A5A12784B5A4B5AA200704A5AA24B5A4B5AA2C8485A4A90C7FCA24A5A4A +5AA24A5AA24A5A4A5AA24A5A4A5AA24990C8FCA2495A4948141CA2495A495AA2495A495A +173C495AA24890C8FC485A1778485A484815F8A24848140116034848140F4848143FED01 +FFB8FCA32E3E7BBD38>II<486C13 +C00003130101001380481303000EEB070048130E0018130C0038131C0030131800701338 +00601330A300E01370481360A400CFEB678039FFC07FE001E013F0A3007F133FA2003F13 +1F01C013E0390F0007801C1C73BE2D>II96 DII<49B4FC010F13E090383F00F8017C131E48 +48131F4848137F0007ECFF80485A5B121FA24848EB7F00151C007F91C7FCA290C9FC5AAB +6C7EA3003FEC01C07F001F140316806C6C13076C6C14000003140E6C6C131E6C6C137890 +383F01F090380FFFC0D901FEC7FC222A7DA828>IIII<167C9039 +03F801FF903A1FFF078F8090397E0FDE1F9038F803F83803F001A23B07E000FC0600000F +6EC7FC49137E001F147FA8000F147E6D13FE00075C6C6C485AA23901F803E03903FE0FC0 +26071FFFC8FCEB03F80006CAFC120EA3120FA27F7F6CB512E015FE6C6E7E6C15E06C8100 +03813A0FC0001FFC48C7EA01FE003E140048157E825A82A46C5D007C153E007E157E6C5D +6C6C495A6C6C495AD803F0EB0FC0D800FE017FC7FC90383FFFFC010313C0293D7EA82D> +III<1478EB01FEA2EB03FFA4EB01FEA2EB00781400AC147FEB7F +FFA313017F147FB3B3A5123E127F38FF807E14FEA214FCEB81F8EA7F01387C03F0381E07 +C0380FFF803801FC00185185BD1C>III<2701F801FE14FF00FF902707FFC00313E0913B1E07E00F03F0913B7803F03C +01F80007903BE001F87000FC2603F9C06D487F000101805C01FBD900FF147F91C75B13FF +4992C7FCA2495CB3A6486C496CECFF80B5D8F87FD9FC3F13FEA347287DA74C>I<3901F8 +01FE00FF903807FFC091381E07E091387803F000079038E001F82603F9C07F0001138001 +FB6D7E91C7FC13FF5BA25BB3A6486C497EB5D8F87F13FCA32E287DA733>I<14FF010713 +E090381F81F890387E007E01F8131F4848EB0F804848EB07C04848EB03E0000F15F04848 +EB01F8A2003F15FCA248C812FEA44815FFA96C15FEA36C6CEB01FCA3001F15F86C6CEB03 +F0A26C6CEB07E06C6CEB0FC06C6CEB1F80D8007EEB7E0090383F81FC90380FFFF0010090 +C7FC282A7EA82D>I<3901FC03FC00FF90381FFF8091387C0FE09039FDE003F03A07FFC0 +01FC6C496C7E6C90C7127F49EC3F805BEE1FC017E0A2EE0FF0A3EE07F8AAEE0FF0A4EE1F +E0A2EE3FC06D1580EE7F007F6E13FE9138C001F89039FDE007F09039FC780FC0DA3FFFC7 +FCEC07F891C9FCAD487EB512F8A32D3A7EA733>I<02FF131C0107EBC03C90381F80F090 +397F00387C01FC131CD803F8130E4848EB0FFC150748481303121F485A1501485AA448C7 +FCAA6C7EA36C7EA2001F14036C7E15076C6C130F6C7E6C6C133DD8007E137990383F81F1 +90380FFFC1903801FE0190C7FCAD4B7E92B512F8A32D3A7DA730>I<3901F807E000FFEB +1FF8EC787CECE1FE3807F9C100031381EA01FB1401EC00FC01FF1330491300A35BB3A548 +7EB512FEA31F287EA724>I<90383FC0603901FFF8E03807C03F381F000F003E1307003C +1303127C0078130112F81400A27E7E7E6D1300EA7FF8EBFFC06C13F86C13FE6C7F6C1480 +000114C0D8003F13E0010313F0EB001FEC0FF800E01303A214017E1400A27E15F07E1401 +6C14E06CEB03C0903880078039F3E01F0038E0FFFC38C01FE01D2A7DA824>I<131CA613 +3CA4137CA213FCA2120112031207001FB512C0B6FCA2D801FCC7FCB3A215E0A912009038 +FE01C0A2EB7F03013F138090381F8700EB07FEEB01F81B397EB723>IIIIII<001FB61280A2EBE0000180140049485A001E495A121C +4A5A003C495A141F00385C4A5A147F5D4AC7FCC6485AA2495A495A130F5C495A90393FC0 +0380A2EB7F80EBFF005A5B484813071207491400485A48485BA248485B4848137F00FF49 +5A90B6FCA221277EA628>II E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fm cmbx12 20.736 11 +/Fm 11 115 df<137F3801FFC0000713F0487F487F487F487FA2B61280A96C1400A26C5B +6C5B6C5B6C5B000113C06C6CC7FC1919729836>46 D48 D<93B57E031F14FC92B7 +7E020316F0020F16FC023F16FF4A8349B5D8800314E04901F8C7003F7F4901C0020F7F49 +90C800037FD91FFC6F7F49486F6C7E137F4A7013804948827313C05A4A821BE05AA28548 +7FA38080806E5E8003C017C08103F85D03FE17806F6C5C6C6F160004F05C04FC4A5A6C6F +5D706C13FFDDE0015B6CDCF8035BDDFC0F13C06DDBFF1F5B6D93B5C7FC19FC6D17F06D5F +6D17806D17E06D836D6C16FC6E16FF020F836E17E06E83020F83023F8391B97E49840107 +01F0178049D9C07F16C0013FD9801F16E049EB00074948010116F048497F4849023F15F8 +4849140F4A6E15FC48160148496E6C14FE4A151F488391C9120348050014FF193F498385 +00FF84854983A28586A3861BFEA27FA2007F1AFC7F1A7F1BF86C7FF2FFF06C7F6E4C13E0 +6C6D4C13C06C6D5E6E4C13806C6D4C13006C6D6CED7FFE6C02E04A485A013F01FC020F13 +F06D9026FFC001B55A010791B712806D95C7FC010017FC021F16F002071680DA007F02FC +C8FC030191C9FC507378F061>56 D<93B5FC031F14F092B612FE02076F7E021F16E04A16 +F891B87E49DAF00713FF0107DA0001804901FC6D6C7F49496E7F49496E7F49496E7F90B5 +486E7F484A8048854891C86C7FA2487114805C481AC0A2487213E0A2484918F0A31BF8A2 +B5FCA27313FCA51BFEA71BFF61A27EA396B6FC7EA2806C5FA27E606C7F607E6C6E5C6CEF +1FBF6D6DEC3F3F6D6D147F6D6D14FE6D6DEB01FC6D01FE130701019039FFC01FF86D91B5 +00F014FE023F15C06E15800203ECFE00DA007F13F8030713C092C9FC4F13FCA41BF8A31B +F0D91FF093B5FCEB7FFC496C18E0487F486E17C06048801B804E1400A26260624E5B4B5C +626C91C8485B4A4B5B4A92B55A6C01F04A91C7FC02804A5B6C01E0020F5B6D6C023F13F0 +02FE91B55A90273FFFE00F5C6D90B7C8FC010716FC6D16F0010016C0023F92C9FC020714 +F09126007FFECAFC507378F061>I<92383FFFF80207B612E0027F15FC49B87E010717E0 +011F83499026F0007F13FC4948C7000F7F90B502036D7E486E6D806F6D80727F486E6E7F +8486727FA28684A26C5C72806C5C6D90C8FC6D5AEB0FF8EB03E090CAFCA70507B6FC041F +B7FC0303B8FC157F0203B9FC021FECFE0391B612800103ECF800010F14C04991C7FC017F +13FC90B512F04814C0485C4891C8FC485B5A485B5C5A5CA2B5FC5CA360A36E5DA26C5F6E +5D187E6C6D846E4A48806C6D4A4814FC6C6ED90FF0ECFFFC6C02E090263FE07F14FE0001 +9139FC03FFC06C91B6487E013F4B487E010F4B1307010303F01301D9003F0280D9003F13 +FC020101F8CBFC57507ACE5E>97 D<903801FFFCB6FCA8C67E131F7FB3ADF0FFFC050FEB +FFE0057F14FE0403B77E040F16E0043F16F84CD9007F13FE9226FDFFF001077F92B500C0 +01018094C86C13E004FC6F7F4C6F7F04E06F7F4C6F7F5E747F93C915804B7014C0A27414 +E0A21DF087A21DF8A31DFC87A41DFEAF1DFCA4631DF8A31DF098B5FC1DE0A25014C0A26F +1980501400705D705F704B5B505B704B5B04FC4B5BDBE7FE92B55A9226C3FF8001035C03 +8101E0011F49C7FC9226807FFC90B55A4B6CB712F04A010F16C04A010393C8FC4A010015 +F84A023F14C090C9000301F0C9FC5F797AF76C>I<93383FFFF00307B612C0033F15F84A +B712FE0207707E021F17E0027F8391B526FC001F7F010302C001037F4991C7487F49495C +495B4901F04A7F5B90B55A485CA2485C4891C8FCA248715B5C48715B725B4A6F5B489438 +007FC0071FC7FC96C8FC5AA25CA3B5FCAF7E80A47E80A27E806CF11F80F23FC06C6E167F +A26C6EEEFF80816C606C6E17006D6D4B5A6D6D15076D6D4B5A6D6D6C4A5A6D02E0EC7FF0 +6D02F849485A01009126FF801F5B6E91B6C7FC021F5E020716F8020116E06E6C15800307 +02FCC8FCDB003F13804A507ACE56>I<97380FFFE00607B6FCA8F00003190086B3AD9338 +3FFF800307B512F8033F14FF4AB712C0020716F0021F16FC027F9039FE007FFE91B500F0 +EB0FFF01030280010190B5FC4949C87E49498149498149498149498190B548814884484A +8192CAFC5AA2485BA25A5C5AA35A5CA4B5FCAF7EA4807EA37EA2807EA26C7F616C6E5D6C +606C80616D6D5D6D6D5D6D6D92B67E6D6D4A15FC010301FF0207EDFFFE6D02C0EB3FFE6D +6C9039FC01FFF86E90B65A020F16C002031600DA007F14FC030F14E09226007FFEC749C7 +FC5F797AF76C>I<93387FFF80030FB512FC037FECFF804AB712E0020716F8021F16FE02 +7FD9F8077F49B5D8C000804991C7003F13E04901FC020F7F49496E7F49498049496E7F49 +496E7F90B55A48727E92C914804884485B1BC048841BE0485BA27313F05AA25C5AA21BF8 +85A2B5FCA391BAFCA41BF002F8CCFCA67EA3807EA47E806CF103F0F207F86C7F1A0F6C6E +17F06C191F6F17E06C6E163F6D6DEE7FC06D6D16FF6D6D4B13806D6D4B13006D6D6CEC0F +FE6D02E0EC3FFC6D02F8ECFFF86D9126FFC00F5B023F91B65A020F178002034CC7FC0200 +16F8031F15E0030392C8FCDB000F13E04D507BCE58>I<93381FFFE00303B6FC031F15E0 +92B712FC020316FF020F17C0023FD9FC0014F091B500C0010F13FC4991C700037F4901FC +02007F010F496F13C049496F7F49496F7F4B8149496F7F90B5C96C7F4886A24849707F48 +1B80A248497014C0A2481BE0A348497113F0A3481BF8A5B51AFCAE6C1BF8A46C1BF06E94 +B5FCA36C1BE0A26C6D4C14C0A26C1B806E5E6C1B006C6E4B5BA26C6E4B5B6D6D4B5B6D6D +4B5B6D6D4B5B6D6D92B55A6D01FF02035C6D02C0010F91C7FC010002FC90B512FC6E90B7 +5A021F17E00207178002014CC8FCDA003F15F0030392C9FCDB001F13E056507BCE61> +111 D<902601FFF8EB07FEB691383FFFC094B512F00403804C14FE4C8093261FFC3F1380 +93263FE07F13C0DC7F80B5FCC66C5D011FDAFE0114E06DEBF9FC16F815FB16F016E015FF +16C07114C05E72138095381FFE0093C76C5AF001E095C8FCA25DA65DB3B3A2B812F8A843 +4E7ACD4F>114 D E +%EndDVIPSBitmapFont +end +%%EndProlog +%%BeginSetup +%%Feature: *Resolution 600dpi +TeXDict begin +%%PaperSize: A4 + +%%EndSetup +%%Page: 1 1 +1 0 bop 94 1385 a Fm(barco)5 b(de)65 b(0.98)p 94 1451 +3780 34 v 2617 1548 a Fl(A)31 b(library)d(for)i(dra)m(wing)f(bar)h(co)s +(des)3409 1656 y(Marc)m(h)h(2002)94 5367 y Fk(b)l(y)45 +b(Alessandro)h(Rubini)f(\()p Fj(rubini@gnu.org)p Fk(\))p +94 5446 3780 17 v eop +%%Page: 1 2 +1 1 bop 94 -116 a Fl(Chapter)30 b(2:)41 b(The)30 b(Underlying)e(Data)k +(Structure)2012 b(1)94 365 y Fi(Barco)t(de)54 b(to)t(ols)219 +549 y Fl(This)29 b(\014le)g(do)s(cumen)m(ts)h(v)m(ersion)g(0.98)i(of)e +(the)h(barco)s(de)f(library)e(and)i(sample)f(programs)h(\(Marc)m(h)i +(2002\).)94 815 y Fi(1)81 b(Ov)l(erview)219 999 y Fl(The)26 +b Fh(barco)s(de)32 b Fl(pac)m(k)-5 b(age)29 b(is)d(mainly)f(a)i(C)f +(library)f(for)h(creating)i(bar-co)s(de)f(output)f(\014les.)39 +b(It)27 b(also)f(includes)94 1099 y(a)31 b(command)f(line)f(fron)m +(t-end)h(and)g(\(in)f(a)i(foreseeable)g(future\))f(a)h(graphic)e(fron)m +(tend.)219 1215 y(The)k(pac)m(k)-5 b(age)35 b(is)d(designed)g(as)i(a)f +(library)e(b)s(ecause)i(w)m(e)h(think)e(the)h(main)g(use)f(for)h(barco) +s(de-generation)94 1315 y(to)s(ols)23 b(is)f(inside)f(more)i(featured)g +(applications.)37 b(The)22 b(library)f(addresses)h(bar)h(co)s(de)g +(prin)m(ting)e(as)i(t)m(w)m(o)i(distinct)94 1415 y(problems:)43 +b(creation)33 b(of)f(bar)g(information)e(and)i(actual)h(con)m(v)m +(ersion)f(to)h(an)f(output)g(format.)47 b(T)-8 b(o)32 +b(this)g(aim)94 1514 y(w)m(e)25 b(use)f(an)g(in)m(termediate)g +(represen)m(tation)g(for)g(bar)f(co)s(des,)j(whic)m(h)d(is)g(curren)m +(tly)g(do)s(cumen)m(ted)h(in)e(the)j(`)p Fj(ps.c)p Fl(')94 +1614 y(source)31 b(\014le)e(\(not)i(in)f(this)f(do)s(cumen)m(t\).)219 +1730 y(Note)24 b(that)e(the)h(library)d(and)h(the)i(accompan)m(ying)g +(material)e(is)h(released)g(according)g(to)h(the)f(GPL)h(license,)94 +1830 y(not)31 b(the)g(LGPL)f(one.)41 b(A)30 b(cop)m(y)h(of)g(the)g(GPL) +f(is)f(included)f(in)h(the)i(distribution)26 b(tarball.)94 +2096 y Fi(2)81 b(The)53 b(Underlying)h(Data)g(Structure)219 +2280 y Fl(Ev)m(ery)33 b(barco)s(de-related)g(function)f(acts)i(on)f(a)h +(data)f(structure)g(de\014ned)f(in)g(the)h(`)p Fj(barcode.h)p +Fl(')e(header,)94 2380 y(whic)m(h)j(m)m(ust)h(b)s(e)f(included)e(b)m(y) +j(an)m(y)g(C)g(source)g(\014le)f(that)h(uses)g(the)g(library)-8 +b(.)52 b(The)35 b(header)f(is)g(installed)f(b)m(y)94 +2480 y Fj(make)47 b(install)p Fl(.)219 2596 y(The)30 +b(de\014nition)e(of)i(the)h(data)g(structure)f(is)f(included)f(here)i +(for)g(reference:)334 2717 y Fj(struct)47 b(Barcode_Item)d({)525 +2820 y(int)j(flags;)428 b(/*)47 b(type)g(of)g(encoding)f(and)h(other)f +(flags)g(*/)525 2924 y(char)h(*ascii;)332 b(/*)47 b(malloced)f(*/)525 +3028 y(char)h(*partial;)236 b(/*)47 b(malloced)f(too)h(*/)525 +3132 y(char)g(*textinfo;)188 b(/*)47 b(information)e(about)h(text)h +(placement)e(*/)525 3236 y(char)i(*encoding;)188 b(/*)47 +b(code)g(name,)f(filled)g(by)i(encoding)d(engine)h(*/)525 +3339 y(int)h(width,)f(height;)g(/*)h(output)f(units)h(*/)525 +3443 y(int)g(xoff,)g(yoff;)189 b(/*)47 b(output)f(units)h(*/)525 +3547 y(int)g(margin;)380 b(/*)47 b(output)f(units)h(*/)525 +3651 y(double)f(scalef;)237 b(/*)47 b(requested)f(scaling)f(for)i +(barcode)f(*/)525 3754 y(int)h(error;)428 b(/*)47 b(an)h(errno-like)d +(value,)h(in)h(case)f(of)i(failure)d(*/)334 3858 y(};)219 +3975 y Fl(The)e(exact)i(meaning)e(of)g(eac)m(h)i(\014eld)d(and)h(the)g +(v)-5 b(arious)43 b(\015ags)g(implemen)m(ted)f(are)i(describ)s(ed)e(in) +g(the)94 4074 y(follo)m(wing)29 b(sections.)219 4191 +y(Ev)m(en)38 b(though)f(y)m(ou)h(w)m(on't)g(usually)d(need)i(to)h(act)h +(on)e(the)h(con)m(ten)m(ts)h(of)f(this)e(structure,)j(some)f(of)g(the) +94 4290 y(functions)25 b(in)f(the)i(library)d(receiv)m(e)k(argumen)m +(ts)e(that)i(are)f(directly)e(related)i(to)g(one)g(or)g(more)f(of)h +(these)g(\014elds.)94 4524 y Fk(2.1)69 b(The)44 b(Fields)94 +4715 y Fj(int)30 b(flags;)574 4815 y Fl(The)42 b(\015ags)g(are,)j(as)d +(y)m(ou)g(ma)m(y)g(susp)s(ect,)j(mean)m(t)d(to)h(sp)s(ecify)d(the)i +(exact)h(b)s(eha)m(viour)e(of)h(the)574 4914 y(library)-8 +b(.)37 b(They)22 b(are)h(often)h(passed)e(as)h(an)g(argumen)m(t)g(to)h +Fg(b)-5 b(ar)g(c)g(o)g(de)32 b Fl(functions)21 b(and)i(are)g(discussed) +574 5014 y(in)30 b(the)g(next)h(section.)94 5147 y Fj(char)f(*ascii;)94 +5247 y(char)g(*partial;)94 5347 y(char)g(*textinfo;)94 +5446 y(char)g(*encoding;)574 5546 y Fl(These)41 b(\014elds)f(are)h(in)m +(ternally)e(managed)i(b)m(y)g(the)h(library)-8 b(,)41 +b(and)g(y)m(ou)g(are)h(not)f(exp)s(ected)g(to)574 5645 +y(touc)m(h)31 b(them)g(if)e(y)m(ou)i(use)f(the)h(pro)m(vided)d(API.)j +(All)e(of)h(them)h(are)g(allo)s(cated)f(with)f Fg(mal)5 +b(lo)-5 b(c)p Fl(.)p eop +%%Page: 2 3 +2 2 bop 94 -116 a Fl(Chapter)30 b(2:)41 b(The)30 b(Underlying)e(Data)k +(Structure)2012 b(2)94 365 y Fj(int)30 b(width;)94 465 +y(int)g(height;)574 565 y Fl(They)i(sp)s(ecify)e(the)i(width)d(and)i +(heigh)m(t)h(of)g(the)f Fg(active)39 b Fl(barco)s(de)31 +b(region)g(\(i.e.,)i(excluding)d(the)574 664 y(white)21 +b(margin\),)i(in)d(the)i(units)e(used)h(to)h(create)i(output)d(data)h +(\(for)g(p)s(ostscript)e(they)i(are)g(p)s(oin)m(ts,)574 +764 y(1/72th)33 b(of)d(an)g(inc)m(h,)g(0.352)j(mm\).)40 +b(The)30 b(\014elds)f(can)i(b)s(e)f(either)g(assigned)f(to)j(in)d(the)h +(structure)574 863 y(or)37 b(via)e Fg(Bar)-5 b(c)g(o)g(de)p +1161 863 28 4 v 36 w(Position\(\))p Fl(,)39 b(at)e(y)m(our)f(c)m +(hoice.)59 b(If)35 b(either)h(v)-5 b(alue)35 b(or)h(b)s(oth)g(are)g +(left)g(to)h(their)574 963 y(default)c(v)-5 b(alue)33 +b(of)g(zero,)i(the)e(output)g(engine)g(will)d(assign)j(default)f(v)-5 +b(alues)33 b(according)g(to)h(the)574 1063 y(sp)s(eci\014ed)g(scaling)f +(factor.)55 b(If)35 b(the)g(sp)s(eci\014ed)e(width)g(is)h(bigger)g +(than)h(needed)f(\(according)h(to)574 1162 y(the)g(scaling)f(factor\),) +j(the)d(output)g(barco)s(de)h(will)c(b)s(e)j(cen)m(tered)i(in)d(its)h +(requested)g(region.)52 b(If)574 1262 y(either)27 b(the)h(width)d(of)i +(the)h(heigh)m(t)f(are)h(to)s(o)g(small)d(for)i(the)h(sp)s(eci\014ed)d +(scale)j(factor,)h(the)e(output)574 1362 y(bar)j(co)s(de)h(will)d +(expand)h(symmetrically)g(around)g(the)i(requested)f(region.)94 +1513 y Fj(int)g(xoff;)94 1612 y(int)g(yoff;)574 1738 +y Fl(The)53 b(\014elds)f(sp)s(ecify)g(o\013set)j(from)e(the)g(co)s +(ordinate)h(origin)e(of)h(the)h(output)f(engine)g(\(for)574 +1838 y(p)s(ostscript,)46 b(p)s(osition)c(0,0)i(is)f(the)g(lo)m(w)m(er)h +(left)f(corner)h(of)f(the)h(page\).)81 b(The)43 b(\014elds)f(can)i(b)s +(e)574 1937 y(either)36 b(assigned)e(to)j(in)d(the)i(structure)f(or)g +(via)g Fg(Bar)-5 b(c)g(o)g(de)p 2572 1937 V 36 w(Position\(\))p +Fl(,)39 b(at)d(y)m(our)f(c)m(hoice.)57 b(The)574 2037 +y(o\013set)24 b(sp)s(eci\014es)d(where)h(the)g(white)g(margin)f(b)s +(egins,)h(not)h(where)f(the)g(\014rst)g(bar)g(will)d(b)s(e)j(prin)m +(ted.)574 2136 y(T)-8 b(o)31 b(prin)m(t)e(real)h(ink)f(to)j(the)e(sp)s +(eci\014ed)f(p)s(osition)f(y)m(ou)j(should)d(set)j Fg(mar)-5 +b(gin)39 b Fl(to)31 b(0.)94 2288 y Fj(int)f(margin;)574 +2387 y Fl(The)36 b(white)g(margin)f(that)j(will)33 b(b)s(e)j(left)g +(around)g(the)h(prin)m(ted)e(area)i(of)g(the)f(bar)g(co)s(de.)59 +b(The)574 2487 y(same)37 b(margin)e(is)g(applied)f(to)j(all)e(sides)g +(of)h(the)g(prin)m(ted)f(area.)59 b(The)35 b(default)g(v)-5 +b(alue)36 b(for)g(the)574 2587 y(margin)30 b(is)f(de\014ned)g(in)g(`)p +Fj(barcode.h)p Fl(')g(as)h Fj(BARCODE_DEFAULT_MARGIN)25 +b Fl(\(10\).)94 2738 y Fj(double)k(scalef;)574 2837 y +Fl(The)j(enlarge)f(or)h(shrink)d(v)-5 b(alue)31 b(for)g(the)h(bar)f(co) +s(de)h(o)m(v)m(er)h(its)e(default)g(dimension.)42 b(The)31 +b Fg(width)574 2937 y Fl(and)j Fg(sc)-5 b(alef)54 b Fl(\014elds)33 +b(in)m(teract)h(deeply)f(in)g(the)h(creation)h(of)f(the)g(output,)h +(and)f(a)g(complete)h(de-)574 3037 y(scription)29 b(of)i(the)f(issues)f +(app)s(ears)h(later)g(in)f(this)g(section.)94 3188 y +Fj(int)h(error;)574 3288 y Fl(The)g(\014eld)f(is)h(used)f(when)h(a)g +Fg(b)-5 b(ar)g(c)g(o)g(de)40 b Fl(function)29 b(fails)g(to)i(host)g(an) +f Fj(errno)p Fl(-lik)m(e)f(in)m(teger)h(v)-5 b(alue.)94 +3515 y Ff(Use)42 b(of)f(the)g Fe(width)50 b Ff(and)41 +b Fe(sc)-6 b(alef)64 b Ff(\014elds.)219 3700 y Fl(A)29 +b(width)f(unit)f(is)h(the)i(width)d(of)i(the)h(thinnest)d(bar)i(and/or) +g(space)h(in)d(the)j(c)m(hosen)f(co)s(de;)h(it)f(defaults)f(to)94 +3800 y(1)j(p)s(oin)m(t)f(if)f(the)i(output)e(is)h(p)s(ostscript)f(or)h +(encapsulated)g(p)s(ostscript.)219 3926 y(Either)j(or)h(b)s(oth)g(the)g +(co)s(de)h(width)d(and)i(the)g(scale)h(factor)g(can)g(b)s(e)e(left)h +(unsp)s(eci\014ed)e(\(i.e.,)k(zero\).)53 b(The)94 4026 +y(library)28 b(deals)i(with)f(defaults)h(in)f(the)h(follo)m(wing)f(w)m +(a)m(y:)94 4178 y Fg(Both)34 b(unsp)-5 b(e)g(ci\014e)g(d)574 +4277 y Fl(If)26 b(b)s(oth)f(the)h(width)e(and)h(the)h(scale)g(factor)g +(are)g(unsp)s(eci\014ed,)f(the)h(scale)g(factor)g(will)d(default)i(to) +574 4377 y(1.0)31 b(and)e(the)h(width)e(is)g(calculated)i(according)f +(to)i(the)e(actual)h(width)e(of)i(the)g(bar)f(co)s(de)g(b)s(eing)574 +4477 y(prin)m(ted.)94 4628 y Fg(Width)34 b(unsp)-5 b(e)g(ci\014e)g(d) +574 4728 y Fl(If)30 b(the)h(width)e(is)g(not)i(sp)s(eci\014ed,)d(it)i +(is)g(calculated)g(according)g(to)i(the)e(v)-5 b(alues)30 +b(of)g Fg(sc)-5 b(alef)p Fl(.)94 4879 y Fg(Sc)g(ale)34 +b(factor)f(unsp)-5 b(e)g(ci\014e)g(d)574 4978 y Fl(If)32 +b(the)h(scale)f(factor)i(is)d(not)i(sp)s(eci\014ed,)e(it)h(will)d(b)s +(e)j(c)m(hosen)h(so)f(that)h(the)g(generated)g(bar)f(co)s(de)574 +5078 y(exactly)g(\014ts)e(the)g(sp)s(eci\014ed)f(width.)94 +5229 y Fg(Both)34 b(sp)-5 b(e)g(ci\014e)g(d)574 5329 +y Fl(The)31 b(co)s(de)g(will)d(b)s(e)i(prin)m(ted)g(inside)e(the)j(sp)s +(eci\014ed)f(region)g(according)h(to)g(the)g(sp)s(eci\014ed)f(scale)574 +5429 y(factor.)48 b(It)33 b(will)d(b)s(e)h(aligned)h(to)h(the)f(left.) +47 b(If,)33 b(ho)m(w)m(ev)m(er,)h(the)f(c)m(hosen)g(width)e(is)g(to)s +(o)i(small)e(for)574 5528 y(the)f(sp)s(eci\014c)e(bar)h(co)s(de)h(and)e +(scaling)h(factor,)h(then)f(the)h(co)s(de)g(will)c(extend)k +(symmetrically)d(to)574 5628 y(the)k(left)f(and)g(to)h(the)g(righ)m(t)f +(of)g(the)h(c)m(hosen)g(region.)p eop +%%Page: 3 4 +3 3 bop 94 -116 a Fl(Chapter)30 b(3:)41 b(The)30 b(Flags)2872 +b(3)94 365 y Fk(2.2)69 b(The)44 b(In)l(termediate)j(Represen)l(tation) +219 565 y Fl(The)23 b(enco)s(ding)g(functions)f(prin)m(t)g(their)g +(output)h(in)m(to)h(the)g Fj(partial)d Fl(and)i Fj(texinfo)f +Fl(\014elds)g(of)h(the)h(barco)s(de)94 664 y(data)g(structure.)37 +b(Those)23 b(\014elds,)g(together)h(with)d(p)s(osition)g(information,)h +(are)h(then)f(used)g(to)i(generate)g(actual)94 764 y(output.)41 +b(This)28 b(is)i(an)g(informal)e(description)h(of)h(the)h(in)m +(termediate)f(format.)219 905 y(The)38 b(\014rst)g(c)m(har)h(in)f +Fj(partial)f Fl(tells)g(ho)m(w)i(m)m(uc)m(h)g(extra)g(space)h(to)f(add) +f(to)i(the)f(left)f(of)h(the)g(bars.)65 b(F)-8 b(or)94 +1005 y(EAN-13,)33 b(it)d(is)f(used)h(to)h(lea)m(v)m(e)h(space)f(to)g +(prin)m(t)e(the)i(\014rst)f(digit,)f(other)i(co)s(des)f(ma)m(y)h(ha)m +(v)m(e)h('0')f(for)g(no-extra-)94 1104 y(space-needed.)219 +1245 y(The)23 b(next)h(c)m(haracters)i(are)e(alternating)f(bars)g(and)h +(spaces,)h(as)g(m)m(ultiples)c(of)j(the)g(base)g(dimension)d(whic)m(h) +94 1345 y(is)35 b(1)g(unless)f(the)i(co)s(de)f(is)f(rescaled.)56 +b(Rescaling)34 b(is)h(calculated)g(as)g(the)h(ratio)f(from)g(the)h +(requested)f(width)94 1445 y(and)e(the)h(calculated)f(width.)48 +b(Digits)33 b(represen)m(t)g(bar/space)h(dimensions.)47 +b(Lo)m(w)m(er-case)35 b(letters)f(represen)m(t)94 1544 +y(those)d(bars)f(that)h(should)e(extend)i(lo)m(w)m(er)f(than)h(the)f +(others:)41 b('a')32 b(is)d(equiv)-5 b(alen)m(t)30 b(to)h('1',)h('b')f +(is)e('2')i(and)f(so)h(on)94 1644 y(up)e(to)h('i')g(whic)m(h)e(is)g +(equiv)-5 b(alen)m(t)29 b(to)i('9'.)41 b(Other)29 b(letters)h(will)d(b) +s(e)i(used)g(for)g(enco)s(ding-sp)s(eci\014c)f(meanings,)h(as)94 +1743 y(so)s(on)i(as)f(I)g(implemen)m(t)f(them.)219 1885 +y(The)35 b Fj(textinfo)e Fl(string)h(is)h(made)g(up)f(of)i(\014elds)e +Fj(\045lf:\045lf:\045c)e Fl(separated)k(b)m(y)g(blank)e(space.)56 +b(The)35 b(\014rst)94 1984 y(in)m(teger)f(is)e(the)h(x)g(p)s(osition)e +(of)i(the)h(c)m(haracter,)h(the)e(second)g(is)f(the)i(fon)m(t)f(size)g +(\(b)s(efore)g(rescaling\))f(and)h(the)94 2084 y(c)m(har)e(item)f(is)g +(the)g(c)m(haracter)i(to)f(b)s(e)f(prin)m(ted.)219 2225 +y(Both)39 b(the)g Fj(partial)d Fl(and)i Fj(textinfo)f +Fl(strings)g(ma)m(y)i(include)d(\\)p Fj(-)p Fl(")j(or)g(\\)p +Fj(+)p Fl(")g(as)g(sp)s(ecial)e(c)m(haracters)j(\(in)94 +2325 y Fj(textinfo)25 b Fl(the)j(c)m(har)f(should)e(b)s(e)i(a)g +(stand-alone)g(w)m(ord\).)40 b(They)26 b(state)j(where)d(the)i(text)g +(should)d(b)s(e)h(prin)m(ted:)94 2424 y(b)s(elo)m(w)34 +b(the)g(bars)f(\(\\)p Fj(-)p Fl(",)j(default\))e(or)g(ab)s(o)m(v)m(e)h +(the)f(bars.)51 b(This)32 b(is)h(used,)i(for)e(example,)i(to)g(prin)m +(t)e(the)h(add-5)94 2524 y(and)27 b(add-2)g(co)s(des)g(to)h(the)f(righ) +m(t)f(of)i(UPC)e(or)h(EAN)g(co)s(des)g(\(the)h(add-5)f(extension)g(is)f +(mostly)g(used)g(in)g(ISBN)94 2623 y(co)s(des\).)94 2939 +y Fi(3)81 b(The)53 b(Flags)219 3213 y Fl(The)30 b(follo)m(wing)f +(\015ags)h(are)h(supp)s(orted)e(b)m(y)h(v)m(ersion)g(0.98)i(of)e(the)h +(library:)94 3387 y Fj(BARCODE_ENCODING_MASK)574 3487 +y Fl(The)f(mask)h(is)e(used)h(to)h(extract)h(the)e(enco)s(ding-t)m(yp)s +(e)g(iden)m(ti\014er)f(from)h(the)g Fg(\015ags)39 b Fl(\014eld.)94 +3653 y Fj(BARCODE_EAN)94 3753 y(BARCODE_UPC)94 3852 y(BARCODE_ISBN)94 +3952 y(BARCODE_128B)94 4051 y(BARCODE_128C)94 4151 y(BARCODE_128)94 +4251 y(BARCODE_128RAW)94 4350 y(BARCODE_39)94 4450 y(BARCODE_I25)94 +4550 y(BARCODE_CBR)94 4649 y(BARCODE_MSI)94 4749 y(BARCODE_PLS)94 +4848 y(BARCODE_93)574 4948 y Fl(The)d(curren)m(tly)f(supp)s(orted)g +(enco)s(ding)g(t)m(yp)s(es:)52 b(EAN)36 b(\(13)i(digits,)e(8)h(digits,) +f(13)h Fj(+)f Fl(2)g(add-on)574 5048 y(and)26 b(13)i +Fj(+)e Fl(5)h(add-on\),)g(UPC)f(\(UPC-A,)i(UPC-E,)e(UPC-A)h(with)e(2)i +(or)f(5)h(digit)f(add-on\),)h(ISBN)574 5147 y(\(with)e(or)f(without)g +(the)i(5-digit)e(add-on\),)i(CODE128-B)h(\(the)e(whole)g(set)g(of)g +(prin)m(table)e(ASCI)s(I)574 5247 y(c)m(haracters\),)36 +b(CODE128-C)d(\(t)m(w)m(o)i(digits)c(enco)s(ded)h(b)m(y)h(eac)m(h)h +(barco)s(de)e(sym)m(b)s(ol\),)h(CODE128)574 5347 y(\(all)41 +b(ASCI)s(I)f(v)-5 b(alues\),)44 b(a)e(\\ra)m(w-input")f(pseudo-co)s(de) +h(that)g(generates)h(CODE128)f(output,)574 5446 y(CODE39)32 +b(\(alphan)m(umeric\),)e Fj(")p Fl(in)m(terlea)m(v)m(ed)i(2)f(of)h(5)p +Fj(")f Fl(\(n)m(umeric\),)g(Co)s(dabar)f(\(n)m(umeric)g(plus)g(a)574 +5546 y(few)36 b(sym)m(b)s(ols\),)g(MSI)f(\(n)m(umeric\))g(and)g +(Plessey)g(\(hex)g(digits\).)55 b(See)36 b(Chapter)f(6)h([Supp)s(orted) +574 5645 y(Enco)s(dings],)30 b(page)h(7.)p eop +%%Page: 4 5 +4 4 bop 94 -116 a Fl(Chapter)30 b(4:)41 b(F)-8 b(unctions)30 +b(Exp)s(orted)g(b)m(y)g(the)h(Library)1871 b(4)94 365 +y Fj(BARCODE_ANY)574 465 y Fl(This)27 b(sp)s(ecial)g(enco)s(ding)g(t)m +(yp)s(e)h(\(represen)m(ted)h(b)m(y)f(a)h(v)-5 b(alue)27 +b(of)i(zero,)h(so)e(it)g(will)d(b)s(e)j(the)g(default\))574 +565 y(tells)33 b(the)g(enco)s(ding)f(pro)s(cedure)g(to)h(lo)s(ok)g(for) +g(the)g(\014rst)f(enco)s(ding)g(t)m(yp)s(e)i(that)f(can)h(deal)e(with) +574 664 y(a)44 b(textual)f(string.)77 b(Therefore,)46 +b(a)d(11-digit)f(co)s(de)h(will)e(b)s(e)h(prin)m(ted)f(as)i(UPC)g(\(as) +g(w)m(ell)f(as)574 764 y(6-digit,)48 b(11)p Fj(+)p Fl(2)e(and)e(11)p +Fj(+)p Fl(5\),)49 b(a)c(12-digit)g(\(or)g(7-digit,)i(or)e(12)p +Fj(+)p Fl(2)h(or)e(12)p Fj(+)p Fl(5\))i(as)f(EAN13,)k(an)574 +863 y(ISBN)39 b(co)s(de)f(\(with)g(or)g(without)f(h)m(yphens,)i(with)e +(or)i(without)e(add-5\))i(will)d(b)s(e)h(enco)s(ded)h(in)574 +963 y(its)e(EAN13)i(represen)m(tation,)g(an)e(ev)m(en)h(n)m(um)m(b)s +(er)e(of)i(digits)e(is)g(enco)s(ded)h(using)f(CODE128C)574 +1063 y(and)45 b(a)h(generic)f(string)f(is)h(enco)s(ded)g(using)f +(CODE128B.)j(Since)d(co)s(de-39)j(o\013ers)e(a)h(m)m(uc)m(h)574 +1162 y(larger)38 b(represen)m(tation)f(for)h(the)f(same)h(text)h +(string,)f(co)s(de128-b)h(is)e(preferred)f(o)m(v)m(er)j(co)s(de39)574 +1262 y(for)31 b(alphan)m(umeric)d(strings.)94 1411 y +Fj(BARCODE_NO_ASCII)574 1510 y Fl(Instructs)f(the)h(engine)e(not)i(to)g +(prin)m(t)e(the)i(ascii)e(string)h(on)g(output.)39 b(By)28 +b(default)e(the)i(bar)f(co)s(de)574 1610 y(is)j(accompanied)g(with)f +(an)i(ascii)e(v)m(ersion)h(of)h(the)f(text)i(it)d(enco)s(des.)94 +1759 y Fj(BARCODE_NO_CHECKSUM)574 1858 y Fl(Instructs)j(the)h(engine)f +(not)h(to)g(add)f(the)h(c)m(hec)m(ksum)g(c)m(haracter)h(to)f(the)g +(output.)47 b(Not)33 b(all)f(the)574 1958 y(enco)s(ding)23 +b(t)m(yp)s(es)g(can)h(drop)f(the)h(c)m(hec)m(ksum;)i(those)e(where)f +(the)h(c)m(hec)m(ksum)g(is)f(mandatory)g(\(lik)m(e)574 +2058 y(EAN)31 b(and)f(UPC\))g(just)g(ignore)g(the)h(\015ag.)94 +2206 y Fj(BARCODE_OUTPUT_MASK)574 2306 y Fl(The)f(mask)h(is)e(used)h +(to)h(extract)h(the)e(output-t)m(yp)s(e)h(iden)m(ti\014er)d(from)i(the) +h Fg(\015ags)38 b Fl(\014eld.)94 2455 y Fj(BARCODE_OUT_PS)94 +2554 y(BARCODE_OUT_EPS)94 2654 y(BARCODE_OUT_PCL)94 2753 +y(BARCODE_OUT_PCL_III)574 2853 y Fl(The)48 b(curren)m(tly)f(supp)s +(orted)f(enco)s(ding)g(t)m(yp)s(es:)76 b(full-page)47 +b(p)s(ostscript)f(and)h(encapsulated)574 2953 y(p)s(ostscript;)h(PCL)41 +b(\(prin)m(t)g(command)i(language,)j(for)c(HP)g(prin)m(ters\))f(and)h +(PCL-I)s(I)s(I)e(\(same)574 3052 y(as)31 b(PCL,)f(but)g(uses)g(a)g(fon) +m(t)h(not)g(a)m(v)-5 b(ailable)30 b(on)g(older)f(prin)m(ters\).)94 +3201 y Fj(BARCODE_OUT_NOHEADERS)574 3301 y Fl(The)f(\015ag)h(instructs) +d(the)j(prin)m(ting)d(engine)h(not)i(to)f(prin)m(t)f(the)h(header)g +(and)g(fo)s(oter)h(part)e(of)i(the)574 3400 y(\014le.)40 +b(This)29 b(mak)m(es)i(sense)f(for)f(the)i(p)s(ostscript)d(engine)i +(but)f(migh)m(t)h(not)h(mak)m(e)g(sense)f(for)g(other)574 +3500 y(engines;)k(suc)m(h)f(other)h(engines)e(will)e(silen)m(tly)i +(ignore)g(the)i(\015ag)f(just)g(lik)m(e)f(the)h(PCL)f(bac)m(k-end)574 +3600 y(do)s(es.)94 3881 y Fi(4)81 b(F)-13 b(unctions)52 +b(Exp)t(orted)h(b)l(y)g(the)g(Library)219 4103 y Fl(The)41 +b(functions)f(included)f(in)h(the)i(barco)s(de)f(library)e(are)j +(declared)f(in)g(the)g(header)h(\014le)e Fj(barcode.h)p +Fl(.)94 4203 y(They)30 b(p)s(erform)f(the)i(follo)m(wing)e(tasks:)94 +4352 y Fj(struct)g(Barcode_Item)e(*Barcode_Create\(char)e(*text\);)574 +4451 y Fl(The)35 b(function)e(creates)j(a)f(new)g(barco)s(de)f(ob)5 +b(ject)36 b(to)f(deal)g(with)e(a)i(sp)s(eci\014ed)e(text)j(string.)53 +b(It)574 4551 y(returns)27 b(NULL)h(in)e(case)j(of)f(failure)e(and)i(a) +g(p)s(oin)m(ter)f(to)h(a)h(barco)s(de)e(data)i(structure)e(in)g(case)i +(of)574 4651 y(success.)94 4799 y Fj(int)h(Barcode_Delete\(struct)25 +b(Barcode_Item)i(*bc\);)574 4899 y Fl(Destro)m(y)32 b(a)f(barco)s(de)f +(ob)5 b(ject.)42 b(Alw)m(a)m(ys)31 b(returns)e(0)h(\(success\))94 +5048 y Fj(int)g(Barcode_Encode\(struct)25 b(Barcode_Item)i(*bc,)i(int)g +(flags\);)574 5147 y Fl(Enco)s(de)h(the)h(text)g(included)d(in)h(the)h +Fg(b)-5 b(c)35 b Fl(ob)5 b(ject.)42 b(V)-8 b(alid)29 +b(\015ags)i(are)f(the)h(enco)s(ding)e(t)m(yp)s(e)h(\(other)574 +5247 y(\015ags)45 b(are)f(ignored\))g(and)g(BAR)m(CODE)p +1994 5247 28 4 v 33 w(NO)p 2166 5247 V 33 w(CHECKSUM)f(\(other)i +(\015ags)f(are)h(silen)m(tly)d(ig-)574 5347 y(nored\);)35 +b(if)e(the)g(\015ag)h(argumen)m(t)g(is)e(zero,)j Fj(bc->flags)c +Fl(will)g(apply)-8 b(.)49 b(The)32 b(function)g(returns)h(0)574 +5446 y(on)h(success)g(and)f(-1)i(in)d(case)j(of)f(error.)51 +b(After)34 b(successful)e(termination)h(the)h(data)g(structure)574 +5546 y(will)21 b(host)i(the)h(description)d(of)j(the)f(bar)g(co)s(de)g +(and)g(its)g(textual)g(represen)m(tation,)i(after)f(a)g(failure)574 +5645 y(the)31 b Fj(error)e Fl(\014eld)g(will)f(include)g(the)i(reason)h +(of)f(the)h(failure.)p eop +%%Page: 5 6 +5 5 bop 94 -116 a Fl(Chapter)30 b(5:)41 b(The)30 b Fg(b)-5 +b(ar)g(c)g(o)g(de)40 b Fl(fron)m(tend)30 b(program)2063 +b(5)94 365 y Fj(int)30 b(Barcode_Print\(struct)25 b(Barcode_Item)i +(*bc,)i(FILE)g(*f,)h(int)f(flags\);)574 465 y Fl(Prin)m(t)39 +b(the)g(bar)g(co)s(de)g(describ)s(ed)e(b)m(y)i Fj(bc)g +Fl(to)h(the)f(sp)s(eci\014ed)f(\014le.)66 b(V)-8 b(alid)38 +b(\015ags)h(are)h(the)f(out-)574 565 y(put)25 b(t)m(yp)s(e,)h +Fj(BARCODE_NO_ASCII)21 b Fl(and)j Fj(BARCODE_OUT_NOHEADERS)p +Fl(,)d(other)k(\015ags)g(are)h(ignored.)574 664 y(If)39 +b(an)m(y)h(of)f(these)h(\015ags)g(is)e(zero,)43 b(it)c(will)d(b)s(e)j +(inherited)e(from)i Fj(bc->flags)d Fl(whic)m(h)i(therefore)574 +764 y(tak)m(es)f(precedence.)57 b(The)35 b(function)g(returns)f(0)i(on) +f(success)h(and)f(-1)h(in)e(case)j(of)f(error)f(\(with)574 +863 y Fj(bc->error)28 b Fl(set)j(accordingly\).)40 b(In)29 +b(case)j(of)e(success,)h(the)f(bar)g(co)s(de)g(is)f(prin)m(ted)g(to)i +(the)f(sp)s(ec-)574 963 y(i\014ed)f(\014le,)h(whic)m(h)f(w)m(on't)i(b)s +(e)f(closed)g(after)h(use.)94 1115 y Fj(int)f(Barcode_Position\(struct) +24 b(Barcode_Item)j(*bc,)i(int)h(wid,)f(int)g(hei,)h(int)f(xoff,)g(int) +h(yoff,)94 1215 y(double)f(scalef\);)574 1315 y Fl(The)h(function)f(is) +h(a)h(shortcut)f(to)h(assign)f(v)-5 b(alues)29 b(to)j(the)e(data)h +(structure.)94 1467 y Fj(int)f(Barcode_Encode_and_Print)o(\(cha)o(r)24 +b(*text,)29 b(FILE)g(*f,)h(int)f(wid,)g(int)h(hei,)f(int)h(xoff,)f(int) +94 1567 y(yoff,)g(int)h(flags\);)574 1666 y Fl(The)38 +b(function)e(deals)h(with)g(the)h(whole)f(life)f(of)i(the)g(barco)s(de) +g(ob)5 b(ject)39 b(b)m(y)e(calling)g(the)h(other)574 +1766 y(functions;)30 b(it)g(uses)g(all)f(the)h(sp)s(eci\014ed)f +(\015ags.)94 1918 y Fj(int)h(Barcode_Version\(char)25 +b(*versionname\);)574 2018 y Fl(Returns)g(the)g(curren)m(t)f(v)m +(ersion)h(as)g(an)g(in)m(teger)g(n)m(um)m(b)s(er)f(of)h(the)g(form)f +(ma)5 b(jor)25 b(*)h(10000)h Fj(+)d Fl(minor)574 2118 +y(*)k(100)h Fj(+)e Fl(release.)40 b(Therefore,)28 b(v)m(ersion)f +(1.03.5)i(will)c(b)s(e)i(returned)f(as)h(10305)j(and)d(v)m(ersion)f +(0.53)574 2217 y(as)i(5300.)41 b(If)27 b(the)h(argumen)m(t)f(is)f +(non-n)m(ull,)g(it)h(will)e(b)s(e)h(used)h(to)h(return)e(the)h(v)m +(ersion)g(n)m(um)m(b)s(er)f(as)574 2317 y(a)h(string.)39 +b(Note)28 b(that)f(the)f(same)h(information)e(is)h(a)m(v)-5 +b(ailable)26 b(from)g(t)m(w)m(o)i(prepro)s(cessor)d(macros:)574 +2416 y Fj(BARCODE_VERSION)i Fl(\(the)k(string\))e(and)h +Fj(BARCODE_VERSION_INT)25 b Fl(\(the)31 b(in)m(teger)g(n)m(um)m(b)s +(er\).)94 2705 y Fi(5)81 b(The)53 b Fd(b)-8 b(ar)g(c)g(o)g(de)65 +b Fi(fron)l(tend)51 b(program)219 2938 y Fl(The)26 b +Fc(barco)s(de)g Fl(program)g(is)f(a)h(fron)m(t-end)g(to)h(access)h +(some)e(features)h(of)f(the)g(library)e(from)i(the)g(command)94 +3037 y(line.)63 b(It)38 b(is)g(able)f(to)i(read)f(user)g(supplied)d +(strings)i(from)h(the)g(command)g(line)e(or)j(a)f(data)h(\014le)e +(\(standard)94 3137 y(input)29 b(b)m(y)h(default\))g(and)g(enco)s(de)g +(all)g(of)g(them.)94 3401 y Fk(5.1)69 b(The)44 b(Command)h(Line)219 +3587 y Fc(barco)s(de)30 b Fl(accepts)i(the)e(follo)m(wing)f(options:)94 +3741 y Fj(--help)g(or)h(-h)574 3840 y Fl(Prin)m(t)g(a)h(usage)g +(summary)e(and)h(exit.)94 3993 y Fj(-i)g(filename)574 +4092 y Fl(Iden)m(tify)35 b(a)h(\014le)f(where)g(strings)f(to)j(b)s(e)e +(enco)s(ded)g(are)h(read)f(from.)56 b(If)36 b(missing)d(\(and)i(if)g +Fj(-b)g Fl(is)574 4192 y(not)29 b(used\))f(it)g(defaults)f(to)i +(standard)e(input.)38 b(Eac)m(h)29 b(data)g(line)e(of)h(the)h(input)d +(\014le)i(will)d(b)s(e)j(used)574 4292 y(to)k(create)g(one)e(barco)s +(de)g(output.)94 4444 y Fj(-o)g(filename)574 4544 y Fl(Output)g +(\014le.)40 b(It)30 b(defaults)f(to)j(standard)d(output.)94 +4696 y Fj(-b)h(string)66 b Fl(Sp)s(ecify)32 b(a)j(single)d(\\barco)s +(de")i(string)f(to)h(b)s(e)g(enco)s(ded.)50 b(The)33 +b(option)g(can)h(b)s(e)f(used)g(m)m(ultiple)574 4796 +y(times)j(in)e(order)h(to)h(enco)s(de)g(m)m(ultiple)d(strings)i(\(this) +f(will)f(result)i(in)f(m)m(ulti-page)h(p)s(ostscript)574 +4895 y(output)22 b(or)g(a)g(table)g(of)g(barco)s(des)g(if)f +Fj(-t)g Fl(is)g(sp)s(eci\014ed\).)37 b(The)21 b(strings)g(m)m(ust)h +(matc)m(h)h(the)f(enco)s(ding)574 4995 y(c)m(hosen;)29 +b(if)c(it)g(do)s(esn't)h(matc)m(h)h(the)f(program)g(will)d(prin)m(t)i +(a)h(w)m(arning)f(to)i Fj(stderr)d Fl(and)h(generate)574 +5095 y(\\blank")44 b(output)g(\(although)h(not)f(zero-length\).)84 +b(Please)44 b(note)h(that)g(a)g(string)e(including)574 +5194 y(spaces)31 b(or)g(other)f(sp)s(ecial)f(c)m(haracters)j(m)m(ust)e +(b)s(e)g(prop)s(erly)e(quoted.)94 5347 y Fj(-e)i(encoding)574 +5446 y Fc(enco)s(ding)j Fl(is)e(the)i(name)f(of)h(the)g(c)m(hosen)g +(enco)s(ding)e(format)i(b)s(eing)e(used.)46 b(It)32 b(defaults)g(to)h +(the)574 5546 y(v)-5 b(alue)41 b(of)f(the)h(en)m(vironmen)m(t)g(v)-5 +b(ariable)39 b Fj(BARCODE_ENCODING)d Fl(or)41 b(to)g(auto)h(detection)f +(if)f(the)574 5645 y(en)m(vironmen)m(t)30 b(is)g(also)g(unset.)p +eop +%%Page: 6 7 +6 6 bop 94 -116 a Fl(Chapter)30 b(6:)41 b(Supp)s(orted)29 +b(Enco)s(dings)2417 b(6)94 365 y Fj(-g)30 b(geometry)574 +465 y Fl(The)e(geometry)g(argumen)m(t)g(is)f(of)h(the)f(form)g(\\[)p +Fj(<)p Fg(width)p Fj(>)i(x)f(<)p Fg(height)p Fj(>)p Fl(])f([)p +Fj(+)h(<)p Fg(xmar)-5 b(gin)p Fj(>)28 b(+)f(<)p Fg(ymar-)574 +565 y(gin)p Fj(>)p Fl(]")42 b(\(with)f(no)h(in)m(terv)m(ening)f +(spaces\).)75 b(Unsp)s(eci\014ed)40 b(margin)h(v)-5 b(alues)41 +b(will)e(result)i(in)f(no)574 664 y(margin;)31 b(unsp)s(eci\014ed)d +(size)j(results)e(in)h(default)g(size.)42 b(The)30 b(sp)s(eci\014ed)f +(v)-5 b(alues)30 b(represen)m(t)h(prin)m(t)574 764 y(p)s(oin)m(ts)e(b)m +(y)g(default,)g(and)g(can)g(b)s(e)g(inc)m(hes,)g(millimeters)e(or)i +(other)h(units)e(according)h(to)h(the)g Fj(-u)574 863 +y Fl(option)j(or)h(the)g Fj(BARCODE_UNIT)c Fl(en)m(vironmen)m(t)j(v)-5 +b(ariable.)49 b(The)33 b(argumen)m(t)h(is)e(used)h(to)h(place)574 +963 y(the)g(prin)m(tout)f(co)s(de)h(on)f(the)h(page.)51 +b(Note)35 b(that)f(an)f(additional)f(white)g(margin)h(of)h(10)g(p)s +(oin)m(ts)574 1063 y(is)e(added)f(to)i(the)g(prin)m(tout.)45 +b(If)31 b(the)i(option)f(is)f(unsp)s(eci\014ed,)f Fj(BARCODE_GEOMETRY)e +Fl(is)j(lo)s(ok)m(ed)574 1162 y(up)h(in)f(the)h(en)m(vironmen)m(t,)h +(if)e(missing)f(a)j(default)f(size)g(and)g(no)g(margin)f(\(but)h(the)h +(default)e(10)574 1262 y(p)s(oin)m(ts\))f(are)h(used.)94 +1409 y Fj(-t)f(table-geometry)574 1508 y Fl(Used)j(to)g(prin)m(t)e(sev) +m(eral)i(barco)s(des)f(to)i(a)f(single)e(page,)j(this)d(option)h(is)g +(mean)m(t)h(to)h(b)s(e)d(used)h(to)574 1608 y(prin)m(t)e(stic)m(k)m +(ers.)43 b(The)30 b(argumen)m(t)h(is)f(of)h(the)g(form)g(\\)p +Fj(<)p Fg(c)-5 b(olumns)p Fj(>)32 b(x)e(<)p Fg(lines)p +Fj(>)h Fl([)p Fj(+)g(<)p Fg(leftmar)-5 b(gin)p Fj(>)31 +b(+)574 1707 y(<)p Fg(b)-5 b(ottommar)g(gin)p Fj(>)39 +b Fl([)p Fj(-)d(<)p Fg(rightmar)-5 b(gin)p Fj(>)38 b +Fl([)p Fj(-)e(<)p Fg(topmar)-5 b(gin)p Fj(>)p Fl(]]]")39 +b(\(with)c(no)h(in)m(terv)m(ening)f(spaces\);)574 1807 +y(if)42 b(missing,)i(the)f(top)g(and)f(righ)m(t)g(margin)g(will)e +(default)i(to)i(b)s(e)e(the)h(same)g(as)g(the)g(b)s(ottom)574 +1907 y(and)c(left)g(margin.)66 b(The)38 b(margins)g(are)i(sp)s +(eci\014ed)d(in)h(prin)m(t)g(p)s(oin)m(ts)g(or)h(in)e(the)j(c)m(hosen)f +(unit)574 2006 y(\(see)f Fj(-u)d Fl(b)s(elo)m(w\).)59 +b(If)35 b(the)i(option)f(is)f(not)i(sp)s(eci\014ed,)f +Fj(BARCODE_TABLE)d Fl(is)i(lo)s(ok)m(ed)h(up)g(in)f(the)574 +2106 y(en)m(vironmen)m(t,)d(otherwise)f(no)h(table)f(is)g(prin)m(ted)f +(and)h(eac)m(h)i(barco)s(de)f(will)c(get)33 b(its)e(o)m(wn)h(page.)574 +2206 y(The)27 b(size)g(\(but)f(not)h(the)g(p)s(osition\))e(of)j(a)f +(barco)s(de)f(item)h(within)d(a)k(table)e(can)h(also)g(b)s(e)f +(selected)574 2305 y(using)43 b Fj(-g)g Fl(\(see)i Fj(")p +Fl(geometry)p Fj(")g Fl(ab)s(o)m(v)m(e\),)k(without)43 +b(struggling)f(with)h(external)h(and)f(in)m(ternal)574 +2405 y(margins.)71 b(I)40 b(still)e(think)h(managemen)m(t)j(of)f +(geometries)g(in)f(a)h(table)f(is)g(sub)s(optimal,)g(but)g(I)574 +2504 y(can't)32 b(mak)m(e)f(it)f(b)s(etter)h(without)e(in)m(tro)s +(ducing)f(incompatibilities.)94 2651 y Fj(-m)i(margin\(s\))574 +2751 y Fl(Sp)s(eci\014es)21 b(an)g(in)m(ternal)g(margin)g(for)g(eac)m +(h)i(stic)m(k)m(er)g(in)d(the)i(table.)38 b(The)21 b(argumen)m(t)i(is)d +(of)i(the)g(form)574 2850 y(\\)p Fj(<)p Fg(xmar)-5 b(gin)p +Fj(>,<)p Fg(ymar)g(gin)p Fj(>)p Fl(")35 b(and)c(the)g(margin)g(is)g +(applied)e(symmetrically)h(to)i(the)g(stic)m(k)m(er.)45 +b(If)574 2950 y(unsp)s(eci\014ed,)28 b(the)h(en)m(vironmen)m(t)g(v)-5 +b(ariable)28 b Fj(BARCODE_MARGIN)e Fl(is)i(used)h(or)g(a)h(default)e +(in)m(ternal)574 3050 y(margin)i(of)g(10)i(p)s(oin)m(ts)d(is)g(used.)94 +3196 y Fj(-n)384 b Fl(\\Numeric")31 b(output:)40 b(don't)31 +b(prin)m(t)e(the)h(ASCI)s(I)f(form)h(of)g(the)h(co)s(de,)g(only)e(the)i +(bars.)94 3343 y Fj(-c)384 b Fl(No)35 b(c)m(hec)m(ksum)f(c)m(haracter)h +(\(for)f(enco)s(dings)e(that)j(allo)m(w)e(it,)h(lik)m(e)f(co)s(de)h +(39,)h(other)f(co)s(des,)h(lik)m(e)574 3442 y(UPC)c(or)f(EAN,)h(ignore) +f(this)f(option\).)94 3589 y Fj(-E)384 b Fl(Encapsulated)32 +b(p)s(ostscript)f(\(default)h(is)g(normal)f(p)s(ostscript\).)47 +b(When)32 b(the)h(output)f(is)f(gener-)574 3689 y(ated)h(as)e(EPS)g +(only)f(one)i(barco)s(de)f(is)f(enco)s(ded.)94 3835 y +Fj(-P)384 b Fl(PCL)35 b(output.)56 b(Please)36 b(note)g(that)g(the)f(Y) +h(direction)e(go)s(es)i(from)f(top)h(to)g(b)s(ottom)g(for)f(PCL,)574 +3935 y(and)30 b(the)h(origin)e(for)h(an)g(image)h(is)e(the)i(top-left)f +(corner)h(instead)e(of)i(the)f(b)s(ottom-left)94 4081 +y Fj(-p)g(pagesize)574 4181 y Fl(Sp)s(ecify)44 b(a)h(non-default)f +(page)i(size.)85 b(The)45 b(page)h(size)f(can)g(b)s(e)f(sp)s(eci\014ed) +g(in)g(millimeters,)574 4281 y(inc)m(hes)34 b(or)g(plain)e(n)m(um)m(b)s +(ers)g(\(for)i(example:)48 b Fj("210x297mm")p Fl(,)32 +b Fj("8.5x11in")p Fl(,)g Fj("595x842")p Fl(\).)50 b(A)574 +4380 y(page)27 b(sp)s(eci\014cation)d(as)i(n)m(um)m(b)s(ers)e(will)f(b) +s(e)i(in)m(terpreted)g(according)g(to)i(the)f(curren)m(t)f(unit)f(sp)s +(ec-)574 4480 y(i\014cation)33 b(\(see)h Fj(-u)e Fl(b)s(elo)m(w\).)49 +b(If)33 b(libpap)s(er)d(is)i(a)m(v)-5 b(ailable,)33 b(y)m(ou)h(can)f +(also)g(sp)s(ecify)f(the)h(page)h(size)574 4580 y(with)40 +b(its)g(name,)k(lik)m(e)d Fj("A3")e Fl(or)i Fj("letter")e +Fl(\(libpap)s(er)f(is)i(a)h(standard)g(comp)s(onen)m(t)g(of)g(De-)574 +4679 y(bian)d(GNU/Lin)m(ux,)k(but)d(ma)m(y)h(b)s(e)e(missing)f +(elsewhere\).)68 b(The)39 b(default)f(page)i(size)g(is)e(y)m(our)574 +4779 y(system-wide)30 b(default)g(if)f(libpap)s(er)e(is)j(there,)h(A4)g +(otherwise.)94 4925 y Fj(-u)f(unit)162 b Fl(Cho)s(ose)32 +b(the)f(unit)f(used)g(in)g(size)i(sp)s(eci\014cations.)42 +b(Accepted)32 b(v)-5 b(alues)31 b(are)g(\\mm",)i(\\cm",)f(\\in")574 +5025 y(and)37 b(\\pt".)61 b(By)37 b(default,)h(the)f(program)f(will)f +(c)m(hec)m(k)j Fj(BARCODE_UNIT)33 b Fl(in)j(the)h(en)m(vironmen)m(t,) +574 5125 y(and)c(assume)g(p)s(oin)m(ts)g(otherwise)f(\(this)h(b)s(eha)m +(viour)f(is)g(compatible)h(with)f(0.92)j(and)d(previous)574 +5224 y(v)m(ersions.)50 b(If)33 b Fj(-u)g Fl(app)s(ears)g(more)g(than)g +(once,)j(eac)m(h)e(instance)f(will)e(mo)s(di\014ed)h(the)h(b)s(eha)m +(viour)574 5324 y(for)h(the)g(argumen)m(ts)g(at)g(its)f(righ)m(t,)i(as) +f(the)g(command)f(line)f(is)h(pro)s(cesses)g(left)h(to)g(righ)m(t.)50 +b(The)574 5424 y(program)32 b(in)m(ternally)f(w)m(orks)h(with)f(p)s +(oin)m(ts,)h(and)f(an)m(y)i(size)f(is)f(appro)m(ximated)h(to)h(the)f +(nearest)574 5523 y(m)m(ultiple)c(of)j(one)f(p)s(oin)m(t.)40 +b(The)30 b Fj(-u)f Fl(option)h(a\013ect)i Fj(-g)e Fl(\(geometry\),)i +Fj(-t)e Fl(\(table\))h(and)e Fj(-p)h Fl(\(page)574 5623 +y(size\).)p eop +%%Page: 7 8 +7 7 bop 94 -116 a Fl(Chapter)30 b(6:)41 b(Supp)s(orted)29 +b(Enco)s(dings)2417 b(7)94 365 y Fi(6)81 b(Supp)t(orted)51 +b(Enco)t(dings)219 558 y Fl(The)31 b(program)h(enco)s(des)g(text)g +(strings)f(passed)g(either)g(on)h(the)g(command)g(line)e(\(with)g(-b\)) +i(or)g(retriev)m(ed)94 658 y(from)38 b(standard)f(input.)61 +b(The)37 b(text)i(represen)m(tation)f(is)f(in)m(terpreted)g(according)g +(to)i(the)f(follo)m(wing)e(rules.)94 758 y(When)42 b(auto-detection)g +(of)g(the)f(enco)s(ding)f(is)h(enabled)f(\(i.e,)k(no)e(explicit)d(enco) +s(ding)h(t)m(yp)s(e)i(is)e(sp)s(eci\014ed\),)94 857 y(the)c(enco)s +(ding)e(t)m(yp)s(es)h(are)h(scanned)f(to)h(\014nd)d(one)j(that)g(can)f +(digest)g(the)g(text)i(string.)54 b(The)35 b(follo)m(wing)e(list)94 +957 y(of)h(supp)s(orted)e(t)m(yp)s(es)h(is)g(sorted)g(in)g(the)g(same)h +(order)f(the)h(library)d(uses)i(when)f(auto-detecting)k(a)d(suitable)94 +1056 y(enco)s(ding)d(for)g(a)h(string.)94 1193 y Fh(EAN)282 +b Fl(The)36 b(EAN)h(fron)m(tend)f(is)g(similar)d(to)38 +b(UPC;)e(it)g(accepts)i(strings)d(of)i(digits,)g(12)g(or)g(7)f(c)m +(harac-)574 1293 y(ters)c(long.)41 b(Strings)30 b(of)h(13)g(or)g(8)g(c) +m(haracters)i(are)e(accepted)h(if)e(the)h(pro)m(vided)f(c)m(hec)m(ksum) +h(digit)574 1393 y(is)40 b(correct.)73 b(I)40 b(exp)s(ect)i(most)f +(users)e(to)j(feed)e(input)f(without)h(a)h(c)m(hec)m(ksum,)j(though.)71 +b(The)574 1492 y(add-2)36 b(and)g(add-5)g(extension)f(are)h(accepted)i +(for)d(b)s(oth)g(the)i(EAN-13)g(and)e(the)h(EAN-8)h(en-)574 +1592 y(co)s(dings.)42 b(The)30 b(follo)m(wing)f(are)j(example)e(of)h(v) +-5 b(alid)29 b(input)g(strings:)41 b(\\)p Fj(123456789012)p +Fl(")28 b(\(EAN-)574 1692 y(13\),)43 b(\\)p Fj(1234567890128)p +Fl(")37 b(\(EAN-13)k(wih)c(c)m(hec)m(ksum\),)43 b(\\)p +Fj(1234567)p Fl(")38 b(\(EAN-8\),)44 b(\\)p Fj(12345670)574 +1791 y(12345)p Fl(")23 b(\(EAN-8)h(with)e(c)m(hec)m(ksum)h(and)g +(add-5\),)i(\\)p Fj(123456789012)45 b(12)p Fl(")23 b(\(EAN-13)i(with)c +(add-)574 1891 y(2\),)32 b(\\)p Fj(123456789012)45 b(12345)p +Fl(")29 b(\(EAN-13)j(with)d(add-5\).)94 2028 y Fh(UPC)284 +b Fl(The)35 b(UPC)g(fron)m(tend)g(accepts)i(only)d(strings)g(made)i(up) +e(of)h(digits)f(\(and,)j(if)d(a)i(supplemen)m(tal)574 +2127 y(enco)s(ding)27 b(is)g(used,)g(a)h(blank)f(to)h(separate)g(it\).) +40 b(It)28 b(accepts)h(strings)d(of)i(11)g(or)g(12)g(digits)f(\(UPC-) +574 2227 y(A\))k(and)f(6)h(or)f(7)h(or)f(8)h(digits)e(\(UPC-E\).)574 +2345 y(The)c(12th)h(digit)e(of)h(UPC-A)g(is)f(the)h(c)m(hec)m(ksum)h +(and)e(is)g(added)h(b)m(y)g(the)g(library)d(if)i(not)i(sp)s(eci\014ed) +574 2445 y(in)k(the)h(input;)e(if)h(it)h(is)f(sp)s(eci\014ed,)f(it)h(m) +m(ust)h(b)s(e)f(the)h(righ)m(t)g(c)m(hec)m(ksum)g(or)g(the)g(co)s(de)g +(is)f(rejected)574 2545 y(as)38 b(in)m(v)-5 b(alid.)59 +b(F)-8 b(or)38 b(UPC-E,)f(6)h(digit)e(are)i(considered)e(to)i(b)s(e)e +(the)i(middle)d(part)i(of)g(the)g(co)s(de,)574 2644 y(a)i(leading)d(0)i +(is)f(assumed)g(and)g(the)h(c)m(hec)m(ksum)g(is)f(added;)k(7)d(digits)e +(are)i(either)f(considered)574 2744 y(the)30 b(initial)d(part)i +(\(leading)g(digit)f(0)i(or)g(1,)g(c)m(hec)m(ksum)g(missing\))e(or)i +(the)f(\014nal)g(part)g(\(c)m(hec)m(ksum)574 2844 y(sp)s(eci\014ed,)f +(leading)g(0)i(assumed\);)g(8)f(digits)f(are)i(considered)e(to)i(b)s(e) +e(the)i(complete)f(co)s(de,)h(with)574 2943 y(leading)k(0)i(or)f(1)g +(and)g(c)m(hec)m(ksum.)55 b(F)-8 b(or)36 b(b)s(oth)f(UPC-A)g(and)f +(UPC-E,)i(a)f(trailing)e(string)h(of)i(2)574 3043 y(digits)30 +b(or)h(5)g(digits)e(is)h(accepted)i(as)f(w)m(ell.)40 +b(Therefore,)31 b(the)g(follo)m(wing)e(are)i(examples)g(of)g(v)-5 +b(alid)574 3142 y(strings)41 b(that)h(can)f(b)s(e)g(enco)s(ded)g(as)h +(UPC:)f(\\)p Fj(01234567890)p Fl(")e(\(UPC-A\))j(\\)p +Fj(012345678905)p Fl(")574 3242 y(\(UPC-A)33 b(with)d(c)m(hec)m +(ksum\),)k(\\)p Fj(012345)p Fl(")d(\(UPC-E\),)i(\\)p +Fj(01234567890)45 b(12)p Fl(")32 b(\(UPC-A,)g(add-2\))574 +3342 y(and)21 b(\\)p Fj(01234567890)45 b(12345)p Fl(")20 +b(\(UPC-A,)i(add-5\),)h(\\)p Fj(0123456)47 b(12)p Fl(")20 +b(\(UPC-E,)i(add-2\).)38 b(Please)574 3441 y(note)24 +b(that)f(when)f(setting)h Fj(BARCODE_ANY)c Fl(to)24 b(auto-detect)h +(the)e(enco)s(ding)f(to)h(b)s(e)f(used,)i(12-digit)574 +3541 y(strings)32 b(and)h(7-digit)f(strings)g(will)e(alw)m(a)m(ys)k(b)s +(e)e(iden)m(ti\014ed)f(as)i(EAN.)h(This)d(b)s(ecause)i(I)f(exp)s(ect) +574 3641 y(most)h(user)f(to)h(pro)m(vide)f(input)e(without)i(a)g(c)m +(hec)m(ksum.)48 b(If)32 b(y)m(ou)h(need)f(to)h(sp)s(ecify)e(UPC-with-) +574 3740 y(c)m(hec)m(ksum)h(as)g(input)d(y)m(ou)i(m)m(ust)g(explicitly) +e(set)j Fj(BARCODE_UPC)c Fl(as)j(a)g(\015ag)h(or)f(use)g +Fj(-e)47 b(upc)30 b Fl(on)574 3840 y(the)h(command)f(line.)94 +3977 y Fh(ISBN)264 b Fl(ISBN)26 b(n)m(um)m(b)s(ers)e(are)i(enco)s(ded)f +(as)h(EAN-13)g(sym)m(b)s(ols,)g(with)e(an)h(optional)g(add-5)g +(trailer.)38 b(The)574 4076 y(ISBN)27 b(fron)m(tend)f(of)h(the)g +(library)e(accepts)j(real)e(ISBN)h(n)m(um)m(b)s(ers)e(and)h(deals)h +(with)e(an)m(y)i(h)m(yphen)574 4176 y(and,)h(if)f(presen)m(t,)h(the)g +(ISBN)f(c)m(hec)m(ksum)i(c)m(haracter)g(b)s(efore)e(enco)s(ding)f +(data.)41 b(V)-8 b(alid)26 b(represen-)574 4276 y(tations)j(for)e(ISBN) +h(strings)e(are)j(for)e(example:)40 b(\\)p Fj(1-56592-292-1)p +Fl(",)25 b(\\)p Fj(3-89721-122-X)p Fl(")h(and)574 4375 +y(\\)p Fj(3-89721-122-X)45 b(06900)p Fl(".)94 4512 y +Fh(co)s(de)31 b(128-B)574 4612 y Fl(This)37 b(enco)s(ding)g(can)h +(represen)m(t)g(all)f(of)h(the)h(prin)m(ting)c(ASCI)s(I)i(c)m +(haracters,)42 b(from)37 b(the)h(space)574 4711 y(\(32\))32 +b(to)g(DEL)e(\(127\).)43 b(The)30 b(c)m(hec)m(ksum)h(digit)e(is)g +(mandatory)i(in)e(this)g(enco)s(ding.)94 4848 y Fh(co)s(de)i(128-C)574 +4948 y Fl(The)h(\\C")g(v)-5 b(ariation)31 b(of)h(Co)s(de-128)h(uses)e +(Co)s(de-128)i(sym)m(b)s(ols)d(to)j(represen)m(t)f(t)m(w)m(o)h(digits)d +(at)j(a)574 5048 y(time)28 b(\(Co)s(de-128)g(is)f(made)g(up)f(of)i(104) +g(sym)m(b)s(ols)e(whose)i(in)m(terpretation)e(is)h(con)m(trolled)g(b)m +(y)g(the)574 5147 y(start)35 b(sym)m(b)s(ol)e(b)s(eing)g(used\).)52 +b(Co)s(de)34 b(128-C)h(is)e(th)m(us)h(the)h(most)f(compact)i(w)m(a)m(y) +f(to)g(represen)m(t)574 5247 y(an)m(y)41 b(ev)m(en)h(n)m(um)m(b)s(er)d +(of)i(digits.)70 b(The)40 b(enco)s(der)g(refuses)g(to)h(deal)f(with)g +(an)g(o)s(dd)g(n)m(um)m(b)s(er)f(of)574 5347 y(digits)24 +b(b)s(ecause)h(the)g(caller)f(is)g(exp)s(ected)h(to)h(pro)m(vide)e +(prop)s(er)f(padding)g(to)j(an)f(ev)m(en)g(n)m(um)m(b)s(er)f(of)574 +5446 y(digits.)38 b(\(Since)23 b(Co)s(de-128)i(includes)d(con)m(trol)j +(sym)m(b)s(ols)d(to)j(switc)m(h)f(c)m(harset,)j(it)c(is)g +(theoretically)574 5546 y(p)s(ossible)29 b(to)j(represen)m(t)f(the)h(o) +s(dd)e(digit)g(as)h(a)g(Co)s(de)g(128-A)i(or)e(128-B)i(sym)m(b)s(ol,)e +(but)f(this)g(to)s(ol)574 5645 y(do)s(esn't)h(curren)m(tly)e(implemen)m +(t)g(this)g(option\).)p eop +%%Page: 8 9 +8 8 bop 94 -116 a Fl(Chapter)30 b(6:)41 b(Supp)s(orted)29 +b(Enco)s(dings)2417 b(8)94 365 y Fh(co)s(de)31 b(128)h(ra)m(w)574 +465 y Fl(Co)s(de-128)24 b(output)d(represen)m(ted)h(sym)m(b)s(ol-b)m +(y-sym)m(b)s(ol)e(in)h(the)h(input)f(string.)36 b(T)-8 +b(o)23 b(o)m(v)m(erride)f(part)574 565 y(of)27 b(the)g(problems)d +(outlined)h(b)s(elo)m(w)g(in)g(sp)s(ecifying)f(co)s(de128)k(sym)m(b)s +(ols,)e(this)f(pseudo-enco)s(ding)574 664 y(allo)m(ws)42 +b(the)h(used)f(to)h(sp)s(ecify)e(a)i(list)e(of)i(co)s(de128)h(sym)m(b)s +(ols)d(separated)i(b)m(y)g(spaces.)77 b(Eac)m(h)574 764 +y(sym)m(b)s(ol)31 b(is)g(represen)m(ted)h(b)m(y)g(a)g(n)m(um)m(b)s(er)f +(in)g(the)h(range)g(0-105.)48 b(The)31 b(list)g(should)f(include)g(the) +574 863 y(leading)e(c)m(haracter.The)i(c)m(hec)m(ksum)g(and)e(the)h +(stop)g(c)m(haracter)h(are)f(automatically)g(added)f(b)m(y)574 +963 y(the)k(library)-8 b(.)42 b(Most)33 b(lik)m(ely)d(this)g +(pseudo-enco)s(ding)g(will)f(b)s(e)i(used)f(with)g Fj(BARCODE_NO_ASCII) +574 1063 y Fl(and)g(some)h(external)f(program)g(to)i(supply)27 +b(the)k(prin)m(ted)e(text.)94 1245 y Fh(co)s(de)37 b(39)180 +b Fl(The)36 b(co)s(de-39)h(standard)f(can)g(enco)s(de)g(upp)s(ercase)g +(letters,)i(digits,)e(the)g(blank)f(space,)k(plus,)574 +1345 y(min)m(us,)d(dot,)i(star,)f(dollar,)f(slash,)g(p)s(ercen)m(t.)57 +b(An)m(y)36 b(string)f(that)h(is)f(only)g(comp)s(osed)g(of)h(suc)m(h) +574 1445 y(c)m(haracters)j(is)e(accepted)h(b)m(y)g(the)f(co)s(de-39)i +(enco)s(der.)61 b(T)-8 b(o)38 b(a)m(v)m(oid)g(lo)s(osing)e +(information,)i(the)574 1544 y(enco)s(der)c(refuses)g(to)h(enco)s(de)f +(mixed-case)g(strings)f(\(a)i(lo)m(w)m(ercase)g(string)e(is)g +(nonetheless)h(ac-)574 1644 y(cepted)d(as)g(a)g(shortcut,)f(but)g(is)f +(enco)s(ded)h(as)h(upp)s(ercase\).)94 1826 y Fh(in)m(terlea)m(v)m(ed)g +(2)g(of)g(5)574 1926 y Fl(This)36 b(enco)s(ding)g(can)i(only)e +(represen)m(t)h(an)g(ev)m(en)h(n)m(um)m(b)s(er)e(of)h(digits)f(\(o)s +(dd)h(digits)f(are)h(repre-)574 2026 y(sen)m(ted)c(b)m(y)g(bars,)f(and) +g(ev)m(en)h(digits)e(b)m(y)i(the)f(in)m(terlea)m(ving)g(spaces\).)48 +b(The)32 b(name)g(stresses)h(the)574 2125 y(fact)i(that)g(t)m(w)m(o)g +(of)f(the)g(\014v)m(e)g(items)f(\(bars)h(or)f(spaces\))i(allo)s(cated)f +(to)g(eac)m(h)h(sym)m(b)s(ol)e(are)h(wide,)574 2225 y(while)41 +b(the)i(rest)g(are)g(narro)m(w.)78 b(The)42 b(c)m(hec)m(ksum)h(digit)f +(is)g(optional)f(\(can)j(b)s(e)e(disabled)e(via)574 2325 +y Fj(BARCODE_NO_CHECKSUM)p Fl(\).)f(Since)31 b(the)h(n)m(um)m(b)s(er)e +(of)h(digits,)g(including)d(the)j(c)m(hec)m(ksum,)i(m)m(ust)574 +2424 y(b)s(e)40 b(ev)m(en,)k(a)c(leading)f(zero)i(is)e(inserted)g(in)g +(the)i(string)e(b)s(eing)g(enco)s(ded)g(if)h(needed)f(\(this)h(is)574 +2524 y(sp)s(eci\014cally)29 b(stated)i(in)e(the)h(sp)s(ecs)g(I)g(ha)m +(v)m(e)i(access)g(to\).)94 2707 y Fh(co)s(de)f(128)136 +b Fl(Automatic)31 b(selection)g(b)s(et)m(w)m(een)g(alphab)s(et)f(A,)h +(B)g(and)f(C)h(of)g(the)g(Co)s(de-128)h(standard.)41 +b(This)574 2806 y(enco)s(ding)31 b(can)i(represen)m(t)f(all)f(ASCI)s(I) +f(sym)m(b)s(ols,)i(from)f(0)h(\(NUL\))h(to)g(127)g(\(DEL\),)g(as)g(w)m +(ell)e(as)574 2906 y(four)36 b(sp)s(ecial)e(sym)m(b)s(ols,)i(named)f +(F1,)j(F2,)g(F3,)g(F4.)58 b(The)35 b(set)h(of)g(sym)m(b)s(ols)f(a)m(v) +-5 b(ailable)35 b(in)f(this)574 3005 y(enco)s(ding)g(is)f(not)i(easily) +e(represen)m(ted)i(as)f(input)e(to)k(the)e Fg(b)-5 b(ar)g(c)g(o)g(de)44 +b Fl(library)-8 b(,)33 b(so)i(the)f(follo)m(wing)574 +3105 y(con)m(v)m(en)m(tion)24 b(is)e(used.)38 b(In)22 +b(the)g(input)f(string,)j(whic)m(h)d(is)h(a)h(C-language)g(n)m +(ull-terminated)e(string,)574 3205 y(the)26 b(NUL)g(c)m(har)f(is)g +(represen)m(ted)g(b)m(y)h(the)f(v)-5 b(alue)25 b(128)i(\(0x80,)h +(0200\))g(and)d(the)g(F1-F4)i(c)m(haracters)574 3304 +y(are)f(represen)m(ted)g(b)m(y)f(the)h(v)-5 b(alues)25 +b(193-196)k(\(0xc1-0xc4,)h(0301-0304\).)43 b(The)25 b(v)-5 +b(alues)25 b(ha)m(v)m(e)i(b)s(een)574 3404 y(c)m(hosen)k(to)h(ease)f +(their)e(represen)m(tation)i(as)f(escap)s(e)h(sequences.)574 +3545 y(Since)39 b(the)h(shell)d(do)s(esn't)j(seem)f(to)i(in)m(terpret)d +(escap)s(e)i(sequences)g(on)f(the)h(command)f(line,)574 +3645 y(the)e Fj(")p Fl(-b)p Fj(")e Fl(option)g(cannot)h(b)s(e)f(easily) +g(used)g(to)i(designate)f(the)g(strings)f(to)h(b)s(e)f(enco)s(ded.)57 +b(As)574 3744 y(a)44 b(w)m(ork)-5 b(around)42 b(y)m(ou)i(can)f(resort)h +(to)f(the)h(command)f Fj(echo)p Fl(,)i(either)e(within)d(bac)m(k-tic)m +(ks)45 b(or)574 3844 y(used)34 b(separately)g(to)g(create)i(a)e(\014le) +f(that)i(is)e(then)g(fed)h(to)h(the)f(standard-input)d(of)j +Fg(b)-5 b(ar)g(c)g(o)g(de)44 b Fl({)574 3944 y(assuming)34 +b(y)m(our)h Fj(echo)f Fl(command)h(pro)s(cesses)g(escap)s(e)h +(sequences.)56 b(The)34 b(newline)f(c)m(haracter)574 +4043 y(is)d(esp)s(ecially)f(though)h(to)h(enco)s(de)f(\(but)g(not)h +(imp)s(ossible)c(unless)h(y)m(ou)j(use)f(a)h Fj(csh)e +Fl(v)-5 b(arian)m(t.)574 4184 y(These)35 b(problems)f(only)g(apply)g +(to)i(the)f(command-line)f(to)s(ol;)j(the)f(use)e(of)i(library)c +(functions)574 4284 y(do)s(esn't)44 b(giv)m(e)f(an)m(y)h(problem.)78 +b(In)42 b(needed,)47 b(y)m(ou)c(can)h(use)f(the)h(\\)p +Fg(c)-5 b(o)g(de)46 b(128)f(r)-5 b(aw)10 b Fl(")45 b(pseudo-)574 +4384 y(enco)s(ding)33 b(to)h(represen)m(t)g(co)s(de128)h(sym)m(b)s(ols) +d(b)m(y)h(their)g(n)m(umerical)f(v)-5 b(alue.)50 b(This)31 +b(enco)s(ding)i(is)574 4483 y(used)28 b(late)h(in)e(the)h +(auto-selection)i(mec)m(hanism)d(b)s(ecause)h(\(almost\))i(an)m(y)e +(input)f(string)g(can)i(b)s(e)574 4583 y(represen)m(ted)i(using)e(co)s +(de128.)94 4765 y Fh(Co)s(dabar)138 b Fl(Co)s(dabar)33 +b(can)h(enco)s(de)g(the)g(ten)f(digits)g(and)g(a)h(few)f(sp)s(ecial)f +(sym)m(b)s(ols)g(\(min)m(us,)i(plus,)e(dollar,)574 4865 +y(colon,)k(bar,)g(dot\).)54 b(The)34 b(c)m(haracters)i(\\)p +Fj(A)p Fl(",)h(\\)p Fj(B)p Fl(",)f(\\)p Fj(C)p Fl(")f(and)g(\\)p +Fj(D)p Fl(")g(are)g(used)f(to)h(represen)m(t)g(four)574 +4965 y(di\013eren)m(t)30 b(start/stop)i(c)m(haracters.)42 +b(The)30 b(input)e(string)i(to)h(the)f(barco)s(de)h(library)d(can)i +(include)574 5064 y(the)d(start)g(and)f(stop)h(c)m(haracters)h(or)e +(not)h(include)d(them)j(\(in)e(whic)m(h)h(case)h(\\)p +Fj(A)p Fl(")g(is)f(used)g(as)g(start)574 5164 y(and)38 +b(\\)p Fj(B)p Fl(")g(as)g(stop\).)64 b(Start)38 b(and)f(stop)h(c)m +(haracters)h(in)e(the)h(input)e(string)g(can)j(b)s(e)e(either)g(all)574 +5264 y(lo)m(w)m(ercase)32 b(or)f(all)e(upp)s(ercase)g(and)h(are)h(alw)m +(a)m(ys)g(prin)m(ted)e(as)h(upp)s(ercase.)94 5446 y Fh(Plessey)192 +b Fl(Plessey)39 b(barco)s(des)f(can)h(enco)s(de)g(all)f(the)h +(hexadecimal)f(digits.)64 b(Alphab)s(etic)37 b(digits)g(in)h(the)574 +5546 y(input)25 b(string)g(m)m(ust)h(either)g(b)s(e)f(all)g(lo)m(w)m +(ercase)j(or)e(all)f(upp)s(ercase.)38 b(The)26 b(output)g(text)h(is)e +(alw)m(a)m(ys)574 5645 y(upp)s(ercase.)p eop +%%Page: 9 10 +9 9 bop 94 -116 a Fl(Chapter)30 b(7:)41 b(PCL)30 b(Output)2761 +b(9)94 365 y Fh(MSI)313 b Fl(MSI)39 b(can)g(only)e(enco)s(de)i(the)g +(decimal)e(digits.)64 b(While)38 b(the)h(standard)e(sp)s(eci\014es)h +(either)g(one)574 465 y(or)e(t)m(w)m(o)h(c)m(hec)m(k)g(digits,)e(the)h +(curren)m(t)f(implemen)m(tation)f(in)g(this)g(library)f(only)i +(generates)i(one)574 565 y(c)m(hec)m(k)32 b(digit.)94 +701 y Fh(co)s(de)f(93)180 b Fl(The)30 b(co)s(de-93)h(standard)f(can)g +(nativ)m(ely)g(enco)s(de)g(48)h(di\013eren)m(t)e(c)m(haracters,)j +(including)27 b(upp)s(er-)574 801 y(case)39 b(letters,)h(digits,)e(the) +g(blank)e(space,)k(plus,)e(min)m(us,)g(dot,)h(star,)h(dollar,)e(slash,) +h(p)s(ercen)m(t,)574 901 y(as)31 b(w)m(ell)f(as)g(\014v)m(e)h(sp)s +(ecial)e(c)m(haracters:)43 b(a)30 b(start/stop)i(delimiter)c(and)i +(four)g Fj(")p Fl(shift)f(c)m(haracters)p Fj(")574 1000 +y Fl(used)f(for)f(extended)h(enco)s(ding.)39 b(Using)27 +b(this)g Fj(")p Fl(extended)g(enco)s(ding)p Fj(")g Fl(metho)s(d,)h(an)m +(y)g(standard)574 1100 y(7-bit)34 b(ASCI)s(I)e(c)m(haracter)k(can)e(b)s +(e)f(enco)s(ded,)i(but)e(it)h(tak)m(es)h(up)e(t)m(w)m(o)i(sym)m(b)s(ol) +d(lengths)i(in)e(bar-)574 1200 y(co)s(de)k(if)f(the)g(c)m(haracter)j +(is)c(not)i(nativ)m(ely)f(supp)s(orted)f(\(one)i(of)g(the)f(48\).)58 +b(The)35 b(enco)s(der)g(here)574 1299 y(fully)24 b(implemen)m(ts)g(the) +i(co)s(de)g(93)g(enco)s(ding)f(standard.)38 b(An)m(y)26 +b(c)m(haracters)h(nativ)m(ely)e(supp)s(orted)574 1399 +y(\(A-Z,)35 b(0-9,)h Fj(")p Fl(.)p Fj(+)p Fl(-/$&\045)p +Fj(")p Fl(\))e(will)d(b)s(e)j(enco)s(ded)f(as)h(suc)m(h)g(-)g(for)f(an) +m(y)h(other)h(c)m(haracters)g(\(suc)m(h)f(as)574 1498 +y(lo)m(w)m(er)h(case)g(letters,)g(brac)m(k)m(ets,)h(paren)m(theses,)g +(etc.\),)h(the)d(enco)s(der)f(will)f(rev)m(ert)i(to)h(extended)574 +1598 y(enco)s(ding.)68 b(As)40 b(a)g(note,)j(the)d(option)f(to)h +(exclude)f(the)h(c)m(hec)m(ksum)g(will)d(eliminate)i(the)h(t)m(w)m(o) +574 1698 y(mo)s(dulo-47)f(c)m(hec)m(ksums)g(\(called)g(C)f(and)g(K\))h +(from)f(the)h(barco)s(de,)i(but)d(this)g(probably)f(will)574 +1797 y(mak)m(e)c(it)e(unreadable)e(b)m(y)i(99\045)h(of)g(all)e +(scanning)g(systems.)43 b(These)31 b(c)m(hec)m(ksums)h(are)g(sp)s +(eci\014ed)574 1897 y(to)f(b)s(e)e(used)g(at)i(the)f(\014rm)m(w)m(are)f +(lev)m(el,)h(and)f(their)g(absence)h(will)d(b)s(e)j(in)m(terpreted)f +(as)h(an)f(in)m(v)-5 b(alid)574 1997 y(barco)s(de.)94 +2266 y Fi(7)81 b(PCL)53 b(Output)219 2459 y Fl(While)28 +b(the)h(default)g(output)f(is)g(P)m(ostscript)i(\(p)s(ossibly)c(EPS\),) +j(and)g(P)m(ostscript)g(can)g(b)s(e)f(p)s(ost-pro)s(cessed)94 +2558 y(to)40 b(almost)e(an)m(ything,)i(it)e(is)f(sometimes)i(desirable) +d(to)j(create)h(output)e(directly)f(usable)g(b)m(y)i(the)f(sp)s +(eci\014c)94 2658 y(prin)m(ter)33 b(at)h(hand.)50 b(PCL)33 +b(is)g(curren)m(tly)f(supp)s(orted)g(as)i(an)g(output)f(format)h(for)g +(this)e(reason.)51 b(Please)34 b(note)94 2758 y(that)25 +b(the)f(Y)g(co)s(ordinate)g(for)f(PCL)h(go)s(es)g(from)f(top)i(to)f(b)s +(ottom,)i(while)c(for)h(P)m(ostscript)h(it)g(go)s(es)g(from)g(b)s +(ottom)94 2857 y(to)35 b(top.)51 b(Consisten)m(tly)-8 +b(,)34 b(while)d(in)i(P)m(ostscript)g(y)m(ou)h(sp)s(ecify)f(the)g(b)s +(ottom-left)i(corner)e(as)h(origin,)f(for)h(PCL)94 2957 +y(y)m(ou)d(sp)s(ecify)e(the)i(top-left)f(corner.)219 +3075 y(Barco)s(de)c(output)e(for)h(PCL)f(Prin)m(ters)g(\(HP)h(LaserJet) +g(and)g(compatibles\),)g(w)m(as)h(dev)m(elop)s(ed)e(using)f(PCL5)94 +3175 y(Reference)32 b(man)m(uals)d(from)h(HP)-8 b(.)31 +b(that)g(really)e(refers)h(to)h(these)g(prin)m(ters:)169 +3293 y Fb(\017)60 b Fl(LaserJet)31 b(I)s(I)s(I,)f(I)s(I)s(I)e(P)-8 +b(,)31 b(I)s(I)s(I)e(D,)i(I)s(I)s(I)e(Si,)169 3411 y +Fb(\017)60 b Fl(LaserJet)31 b(4)g(family)169 3529 y Fb(\017)60 +b Fl(LaserJet)31 b(5)g(family)169 3648 y Fb(\017)60 b +Fl(LaserJet)31 b(6)g(family)169 3766 y Fb(\017)60 b Fl(Color)30 +b(LaserJet)169 3884 y Fb(\017)60 b Fl(DeskJet)32 b(1200)g(and)e(1600.) +219 4021 y(Ho)m(w)m(ev)m(er,)g(barco)s(de)e(prin)m(ting)d(uses)i(a)h(v) +m(ery)g(small)e(subset)h(of)g(PCL,)g(probably)f(also)h(LaserJet)h(I)s +(I)f(should)94 4121 y(prin)m(t)i(it)h(without)g(problem,)f(but)g(the)i +(resulting)e(text)i(ma)m(y)g(b)s(e)f(horrible.)219 4239 +y(The)22 b(only)g(real)h(di\013erence)f(from)h(one)g(prin)m(ter)e(to)j +(another)f(really)f(dep)s(ends)f(on)h(whic)m(h)g(fon)m(t)h(are)h(a)m(v) +-5 b(ailable)94 4338 y(in)30 b(the)g(prin)m(ter,)f(used)h(in)f(prin)m +(ting)f(the)j(lab)s(el)d(asso)s(ciated)j(to)g(the)g(bars)f(\(if)f +(requested\).)219 4457 y(Earlier)j(LaserJet)j(supp)s(orts)d(only)h +(bitmaps)f(fon)m(ts,)k(so)e(these)g(are)h(not)f Fj(")p +Fl(scalable)p Fj(")p Fl(.)50 b(\(Ljet)35 b(I)s(I)e(?\),)i(Also)94 +4556 y(these)c(fon)m(ts,)f(when)f(a)m(v)-5 b(ailable,)29 +b(ha)m(v)m(e)i(a)f(sp)s(eci\014ed)e(direction,)h(and)g(not)h(all)f(of)g +(them)h(are)g(a)m(v)-5 b(ailable)29 b(in)g(b)s(oth)94 +4656 y(P)m(ortrait)i(and)f(Landscap)s(e)g(mo)s(de.)219 +4774 y(F)-8 b(rom)23 b(LaserJet)g(4)f(series,)i(\(except)g(4L/5L)f +(that)g(are)g(en)m(try-lev)m(el)f(prin)m(ters\),)h(Arial)e(scalable)h +(fon)m(t)h(should)94 4874 y(b)s(e)30 b(a)m(v)-5 b(ailable,)30 +b(so)h(it's)f(the)g Fj(")p Fl(default)g(fon)m(t)p Fj(")g +Fl(used)g(b)m(y)g(this)f(program.)219 4992 y(LaserJet)41 +b(I)s(I)s(I)d(series)i(prin)m(ters)e(\(and)i(4L,)g(5L\),)h(don't)f +(feature)h Fj(")p Fl(Arial)p Fj(")d Fl(as)i(a)h(residen)m(t)e(fon)m(t,) +k(so)e(y)m(ou)94 5092 y(should)27 b(use)i Fj(BARCODE_OUT_PCL_III)23 +b Fl(instead)28 b(of)h Fj(BARCODE_OUT_PCL.)p Fl(,)c(and)j(fon)m(t)h +(the)g(fon)m(t)h(used)d(will)g(b)s(e)94 5191 y Fj(")p +Fl(Univ)m(ers)p Fj(")j Fl(instead)f(of)i Fj(")p Fl(Arial)p +Fj(")p Fl(.)219 5309 y(Results)26 b(on)i(compatible)e(prin)m(ters,)h +(ma)m(y)h(dep)s(end)d(on)i(consistency)g(of)h(PCL5)f(compatibilit)m(y) +-8 b(,)26 b(in)g(doubt,)94 5409 y(try)31 b(BAR)m(CODE)p +713 5409 28 4 v 33 w(OUT)p 951 5409 V 32 w(PCL)p 1168 +5409 V 32 w(I)s(I)s(I)219 5527 y(PJL)f(commands)g(are)g(not)h(used)f +(here,)g(as)h(it's)f(not)g(v)m(ery)h(compatible.)219 +5645 y(T)-8 b(ested)31 b(Prin)m(ters:)p eop +%%Page: 10 11 +10 10 bop 94 -116 a Fl(Chapter)30 b(8:)41 b(Bugs)31 b(and)f(P)m(ending) +f(Issues.)2211 b(10)169 365 y Fb(\017)60 b Fl(Hp)30 b(LaserJet)h(4050) +169 490 y Fb(\017)60 b Fl(Hp)30 b(LaserJet)h(2100)169 +614 y Fb(\017)60 b Fl(Epson)30 b(N-1200)j(em)m(ul)c(PCL)169 +739 y Fb(\017)60 b Fl(T)-8 b(oshiba)30 b(DP2570)i(\(copier\))f +Fj(+)f Fl(PCL)g(option)169 863 y Fb(\017)60 b Fl(Epson)30 +b(EPL-7100)i(em)m(ul.)40 b(HP)30 b(LaserJet)h(I)s(I:)f(bars)g(prin)m(t) +f(\014ne)g(but)h(text)i(is)d(bad.)94 1146 y Fi(8)81 b(Bugs)52 +b(and)i(P)l(ending)f(Issues.)219 1370 y Fl(The)42 b(curren)m(t)g +(managemen)m(t)h(of)g(b)s(orders/margins)d(is)h(far)h(from)g(optimal.) +75 b(The)42 b(\\default")g(margin)94 1469 y(applied)d(b)m(y)h(the)h +(library)d(in)m(terferes)i(with)f(the)i(external)g(represen)m(tation,)i +(but)d(I)g(feel)g(it)g(is)g(mandatory)94 1569 y(to)f(a)m(v)m(oid)f +(creating)g(barco)s(de)f(output)h(with)e(no)i(surrounding)c(white)j +(space)h(\(the)g(problem)e(is)h(esp)s(ecially)94 1669 +y(relev)-5 b(an)m(t)31 b(for)f(EPS)g(output\).)219 1793 +y(EAN-128)44 b(is)d(not)h(\(y)m(et\))i(supp)s(orted.)73 +b(I)42 b(plan)e(to)j(implemen)m(t)e(it)g(prett)m(y)h(so)s(on)g(and)f +(then)h(bless)f(the)94 1893 y(pac)m(k)-5 b(age)33 b(as)d(v)m(ersion)g +(1.0.)p eop +%%Page: -1 12 +-1 11 bop 3849 -116 a Fl(i)94 365 y Fi(T)-13 b(able)55 +b(of)e(Con)l(ten)l(ts)94 697 y Fk(Barco)t(de)45 b(to)t(ols)16 +b Fa(.)k(.)g(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.) +f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g +(.)h(.)60 b Fk(1)94 955 y(1)135 b(Ov)l(erview)12 b Fa(.)21 +b(.)f(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h +(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.) +f(.)57 b Fk(1)94 1212 y(2)135 b(The)45 b(Underlying)g(Data)h(Structure) +41 b Fa(.)20 b(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)86 +b Fk(1)393 1337 y Fl(2.1)92 b(The)30 b(Fields)19 b Fg(.)14 +b(.)h(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)49 +b Fl(1)692 1436 y(Use)31 b(of)g(the)f Fg(width)39 b Fl(and)30 +b Fg(sc)-5 b(alef)50 b Fl(\014elds.)25 b Fg(.)15 b(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)g(.)56 b Fl(2)393 1536 y(2.2)92 b(The)30 b(In)m(termediate)h +(Represen)m(tation)24 b Fg(.)15 b(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)54 b Fl(3)94 1768 y Fk(3)135 b(The)45 b(Flags)28 +b Fa(.)20 b(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f +(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.) +f(.)g(.)73 b Fk(3)94 2026 y(4)135 b(F)-11 b(unctions)44 +b(Exp)t(orted)h(b)l(y)g(the)g(Library)37 b Fa(.)19 b(.)h(.)f(.)g(.)h(.) +f(.)h(.)f(.)h(.)f(.)g(.)81 b Fk(4)94 2283 y(5)135 b(The)45 +b Fa(b)-7 b(ar)g(c)g(o)g(de)52 b Fk(fron)l(tend)46 b(program)11 +b Fa(.)19 b(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h +(.)55 b Fk(5)393 2408 y Fl(5.1)92 b(The)30 b(Command)g(Line)24 +b Fg(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)g(.)g(.)g(.)g(.)g(.)g(.)55 b Fl(5)94 2640 y Fk(6)135 +b(Supp)t(orted)44 b(Enco)t(dings)33 b Fa(.)20 b(.)f(.)g(.)h(.)f(.)h(.)f +(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.) +78 b Fk(7)94 2897 y(7)135 b(PCL)45 b(Output)40 b Fa(.)20 +b(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f +(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)85 +b Fk(9)94 3155 y(8)135 b(Bugs)45 b(and)f(P)l(ending)h(Issues.)36 +b Fa(.)19 b(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h +(.)f(.)g(.)h(.)79 b Fk(10)p eop +%%Trailer +end +userdict /end-hook known{end-hook}if +%%EOF diff --git a/glabels1/barcode-0.98/doc/barcodedoc.txt b/glabels1/barcode-0.98/doc/barcodedoc.txt new file mode 100644 index 00000000..08eadeee --- /dev/null +++ b/glabels1/barcode-0.98/doc/barcodedoc.txt @@ -0,0 +1,734 @@ + + +This is barcode.info, produced by makeinfo version 4.0 from +barcode.texinfo. + + This file is the User's Manual for the barcode library (version +0.98). + + + + +*Node: Overview + Overview + ******** + + The "barcode" package is mainly a C library for creating bar-code +output files. It also includes a command line front-end and (in a +foreseeable future) a graphic frontend. + + The package is designed as a library because we think the main use +for barcode-generation tools is inside more featured applications. The +library addresses bar code printing as two distinct problems: creation +of bar information and actual conversion to an output format. To this +aim we use an intermediate representation for bar codes, which is +currently documented in the `ps.c' source file (not in this document). + + Note that the library and the accompanying material is released +according to the GPL license, not the LGPL one. A copy of the GPL is +included in the distribution tarball. + + + + +*Node: The Barcode Object + The Underlying Data Structure + ***************************** + + Every barcode-related function acts on a data structure defined in +the `barcode.h' header, which must be included by any C source file +that uses the library. The header is installed by make install. + + The definition of the data structure is included here for reference: + + struct Barcode_Item { + int flags; /* type of encoding and other flags */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text placement */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ + }; + + The exact meaning of each field and the various flags implemented are +described in the following sections. + + Even though you won't usually need to act on the contents of this +structure, some of the functions in the library receive arguments that +are directly related to one or more of these fields. + + + + +*Node: The Field List + The Fields + ========== + +`int flags;' + The flags are, as you may suspect, meant to specify the exact + behaviour of the library. They are often passed as an argument to + barcode functions and are discussed in the next section. + +`char *ascii;' +`char *partial;' +`char *textinfo;' +`char *encoding;' + These fields are internally managed by the library, and you are + not expected to touch them if you use the provided API. All of + them are allocated with malloc. + +`int width;' +`int height;' + They specify the width and height of the active barcode region + (i.e., excluding the white margin), in the units used to create + output data (for postscript they are points, 1/72th of an inch, + 0.352 mm). The fields can be either assigned to in the structure + or via Barcode_Position(), at your choice. If either value or + both are left to their default value of zero, the output engine + will assign default values according to the specified scaling + factor. If the specified width is bigger than needed (according to + the scaling factor), the output barcode will be centered in its + requested region. If either the width of the height are too small + for the specified scale factor, the output bar code will expand + symmetrically around the requested region. + +`int xoff;' +`int yoff;' + The fields specify offset from the coordinate origin of the output + engine (for postscript, position 0,0 is the lower left corner of + the page). The fields can be either assigned to in the structure + or via Barcode_Position(), at your choice. The offset specifies + where the white margin begins, not where the first bar will be + printed. To print real ink to the specified position you should + set margin to 0. + +`int margin;' + The white margin that will be left around the printed area of the + bar code. The same margin is applied to all sides of the printed + area. The default value for the margin is defined in `barcode.h' + as BARCODE_DEFAULT_MARGIN (10). + +`double scalef;' + The enlarge or shrink value for the bar code over its default + dimension. The width and scalef fields interact deeply in the + creation of the output, and a complete description of the issues + appears later in this section. + +`int error;' + The field is used when a barcode function fails to host an + errno-like integer value. + +Use of the width and scalef fields. +----------------------------------- + + A width unit is the width of the thinnest bar and/or space in the +chosen code; it defaults to 1 point if the output is postscript or +encapsulated postscript. + + Either or both the code width and the scale factor can be left +unspecified (i.e., zero). The library deals with defaults in the +following way: + +Both unspecified + If both the width and the scale factor are unspecified, the scale + factor will default to 1.0 and the width is calculated according + to the actual width of the bar code being printed. + +Width unspecified + If the width is not specified, it is calculated according to the + values of scalef. + +Scale factor unspecified + If the scale factor is not specified, it will be chosen so that + the generated bar code exactly fits the specified width. + +Both specified + The code will be printed inside the specified region according to + the specified scale factor. It will be aligned to the left. If, + however, the chosen width is too small for the specific bar code + and scaling factor, then the code will extend symmetrically to the + left and to the right of the chosen region. + + + + +*Node: The Intermediate Representation + The Intermediate Representation + =============================== + + The encoding functions print their output into the partial and +texinfo fields of the barcode data structure. Those fields, together +with position information, are then used to generate actual output. +This is an informal description of the intermediate format. + + The first char in partial tells how much extra space to add to the +left of the bars. For EAN-13, it is used to leave space to print the +first digit, other codes may have '0' for no-extra-space-needed. + + The next characters are alternating bars and spaces, as multiples of +the base dimension which is 1 unless the code is rescaled. Rescaling is +calculated as the ratio from the requested width and the calculated +width. Digits represent bar/space dimensions. Lower-case letters +represent those bars that should extend lower than the others: 'a' is +equivalent to '1', 'b' is '2' and so on up to 'i' which is equivalent to +'9'. Other letters will be used for encoding-specific meanings, as soon +as I implement them. + + The textinfo string is made up of fields %lf:%lf:%c separated by +blank space. The first integer is the x position of the character, the +second is the font size (before rescaling) and the char item is the +character to be printed. + + Both the partial and textinfo strings may include "-" or "+" as +special characters (in textinfo the char should be a stand-alone word). +They state where the text should be printed: below the bars ("-", +default) or above the bars. This is used, for example, to print the +add-5 and add-2 codes to the right of UPC or EAN codes (the add-5 +extension is mostly used in ISBN codes). + + + + +*Node: Supported Flags + The Flags + ********* + + The following flags are supported by version 0.98 of the library: + +`BARCODE_ENCODING_MASK' + The mask is used to extract the encoding-type identifier from the + flags field. + +`BARCODE_EAN' +`BARCODE_UPC' +`BARCODE_ISBN' +`BARCODE_128B' +`BARCODE_128C' +`BARCODE_128' +`BARCODE_128RAW' +`BARCODE_39' +`BARCODE_I25' +`BARCODE_CBR' +`BARCODE_MSI' +`BARCODE_PLS' +`BARCODE_93' + The currently supported encoding types: EAN (13 digits, 8 digits, + 13 + 2 add-on and 13 + 5 add-on), UPC (UPC-A, UPC-E, UPC-A with 2 + or 5 digit add-on), ISBN (with or without the 5-digit add-on), + CODE128-B (the whole set of printable ASCII characters), CODE128-C + (two digits encoded by each barcode symbol), CODE128 (all ASCII + values), a "raw-input" pseudo-code that generates CODE128 output, + CODE39 (alphanumeric), "interleaved 2 of 5" (numeric), Codabar + (numeric plus a few symbols), MSI (numeric) and Plessey (hex + digits). *Note Supported Encodings::. + +`BARCODE_ANY' + This special encoding type (represented by a value of zero, so it + will be the default) tells the encoding procedure to look for the + first encoding type that can deal with a textual string. + Therefore, a 11-digit code will be printed as UPC (as well as + 6-digit, 11+2 and 11+5), a 12-digit (or 7-digit, or 12+2 or 12+5) + as EAN13, an ISBN code (with or without hyphens, with or without + add-5) will be encoded in its EAN13 representation, an even number + of digits is encoded using CODE128C and a generic string is + encoded using CODE128B. Since code-39 offers a much larger + representation for the same text string, code128-b is preferred + over code39 for alphanumeric strings. + +`BARCODE_NO_ASCII' + Instructs the engine not to print the ascii string on output. By + default the bar code is accompanied with an ascii version of the + text it encodes. + +`BARCODE_NO_CHECKSUM' + Instructs the engine not to add the checksum character to the + output. Not all the encoding types can drop the checksum; those + where the checksum is mandatory (like EAN and UPC) just ignore the + flag. + +`BARCODE_OUTPUT_MASK' + The mask is used to extract the output-type identifier from the + flags field. + +`BARCODE_OUT_PS' +`BARCODE_OUT_EPS' +`BARCODE_OUT_PCL' +`BARCODE_OUT_PCL_III' + The currently supported encoding types: full-page postscript and + encapsulated postscript; PCL (print command language, for HP + printers) and PCL-III (same as PCL, but uses a font not available + on older printers). + +`BARCODE_OUT_NOHEADERS' + The flag instructs the printing engine not to print the header and + footer part of the file. This makes sense for the postscript + engine but might not make sense for other engines; such other + engines will silently ignore the flag just like the PCL back-end + does. + + + + +*Node: The API + Functions Exported by the Library + ********************************* + + The functions included in the barcode library are declared in the +header file barcode.h. They perform the following tasks: + +`struct Barcode_Item *Barcode_Create(char *text);' + The function creates a new barcode object to deal with a specified + text string. It returns NULL in case of failure and a pointer to + a barcode data structure in case of success. + +`int Barcode_Delete(struct Barcode_Item *bc);' + Destroy a barcode object. Always returns 0 (success) + +`int Barcode_Encode(struct Barcode_Item *bc, int flags);' + Encode the text included in the bc object. Valid flags are the + encoding type (other flags are ignored) and BARCODE_NO_CHECKSUM + (other flags are silently ignored); if the flag argument is zero, + bc->flags will apply. The function returns 0 on success and -1 in + case of error. After successful termination the data structure + will host the description of the bar code and its textual + representation, after a failure the error field will include the + reason of the failure. + +`int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags);' + Print the bar code described by bc to the specified file. Valid + flags are the output type, BARCODE_NO_ASCII and + BARCODE_OUT_NOHEADERS, other flags are ignored. If any of these + flags is zero, it will be inherited from bc->flags which therefore + takes precedence. The function returns 0 on success and -1 in case + of error (with bc->error set accordingly). In case of success, the + bar code is printed to the specified file, which won't be closed + after use. + +`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, int flags);' + The function deals with the whole life of the barcode object by + calling the other functions; it uses all the specified flags. + +`int Barcode_Version(char *versionname);' + Returns the current version as an integer number of the form major + * 10000 + minor * 100 + release. Therefore, version 1.03.5 will be + returned as 10305 and version 0.53 as 5300. If the argument is + non-null, it will be used to return the version number as a + string. Note that the same information is available from two + preprocessor macros: BARCODE_VERSION (the string) and + BARCODE_VERSION_INT (the integer number). + + + + +*Node: The barcode Executable + The barcode frontend program + **************************** + + The barcode program is a front-end to access some features of the +library from the command line. It is able to read user supplied +strings from the command line or a data file (standard input by default) +and encode all of them. + + + + +*Node: The Command Line + The Command Line + ================ + + barcode accepts the following options: + +`--help or -h' + Print a usage summary and exit. + +`-i filename' + Identify a file where strings to be encoded are read from. If + missing (and if -b is not used) it defaults to standard input. + Each data line of the input file will be used to create one + barcode output. + +`-o filename' + Output file. It defaults to standard output. + +`-b string' + Specify a single "barcode" string to be encoded. The option can + be used multiple times in order to encode multiple strings (this + will result in multi-page postscript output or a table of barcodes + if -t is specified). The strings must match the encoding chosen; + if it doesn't match the program will print a warning to stderr and + generate "blank" output (although not zero-length). Please note + that a string including spaces or other special characters must be + properly quoted. + +`-e encoding' + encoding is the name of the chosen encoding format being used. It + defaults to the value of the environment variable BARCODE_ENCODING + or to auto detection if the environment is also unset. + +`-g geometry' + The geometry argument is of the form "[ x ] [+ + + ]" (with no intervening spaces). Unspecified + margin values will result in no margin; unspecified size results + in default size. The specified values represent print points by + default, and can be inches, millimeters or other units according + to the -u option or the BARCODE_UNIT environment variable. The + argument is used to place the printout code on the page. Note that + an additional white margin of 10 points is added to the printout. + If the option is unspecified, BARCODE_GEOMETRY is looked up in the + environment, if missing a default size and no margin (but the + default 10 points) are used. + +`-t table-geometry' + Used to print several barcodes to a single page, this option is + meant to be used to print stickers. The argument is of the form + " x [+ + [- + [- ]]]" (with no intervening spaces); if + missing, the top and right margin will default to be the same as + the bottom and left margin. The margins are specified in print + points or in the chosen unit (see -u below). If the option is not + specified, BARCODE_TABLE is looked up in the environment, + otherwise no table is printed and each barcode will get its own + page. The size (but not the position) of a barcode item within a + table can also be selected using -g (see "geometry" above), + without struggling with external and internal margins. I still + think management of geometries in a table is suboptimal, but I + can't make it better without introducing incompatibilities. + +`-m margin(s)' + Specifies an internal margin for each sticker in the table. The + argument is of the form "," and the margin is + applied symmetrically to the sticker. If unspecified, the + environment variable BARCODE_MARGIN is used or a default internal + margin of 10 points is used. + +`-n' + "Numeric" output: don't print the ASCII form of the code, only the + bars. + +`-c' + No checksum character (for encodings that allow it, like code 39, + other codes, like UPC or EAN, ignore this option). + +`-E' + Encapsulated postscript (default is normal postscript). When the + output is generated as EPS only one barcode is encoded. + +`-P' + PCL output. Please note that the Y direction goes from top to + bottom for PCL, and the origin for an image is the top-left corner + instead of the bottom-left + +`-p pagesize' + Specify a non-default page size. The page size can be specified in + millimeters, inches or plain numbers (for example: "210x297mm", + "8.5x11in", "595x842"). A page specification as numbers will be + interpreted according to the current unit specification (see -u + below). If libpaper is available, you can also specify the page + size with its name, like "A3" or "letter" (libpaper is a standard + component of Debian GNU/Linux, but may be missing elsewhere). The + default page size is your system-wide default if libpaper is + there, A4 otherwise. + +`-u unit' + Choose the unit used in size specifications. Accepted values are + "mm", "cm", "in" and "pt". By default, the program will check + BARCODE_UNIT in the environment, and assume points otherwise (this + behaviour is compatible with 0.92 and previous versions. If -u + appears more than once, each instance will modified the behaviour + for the arguments at its right, as the command line is processes + left to right. The program internally works with points, and any + size is approximated to the nearest multiple of one point. The -u + option affect -g (geometry), -t (table) and -p (page size). + + + + +*Node: Supported Encodings + Supported Encodings + ******************* + + The program encodes text strings passed either on the command line +(with -b) or retrieved from standard input. The text representation is +interpreted according to the following rules. When auto-detection of +the encoding is enabled (i.e, no explicit encoding type is specified), +the encoding types are scanned to find one that can digest the text +string. The following list of supported types is sorted in the same +order the library uses when auto-detecting a suitable encoding for a +string. + +EAN + The EAN frontend is similar to UPC; it accepts strings of digits, + 12 or 7 characters long. Strings of 13 or 8 characters are + accepted if the provided checksum digit is correct. I expect most + users to feed input without a checksum, though. The add-2 and + add-5 extension are accepted for both the EAN-13 and the EAN-8 + encodings. The following are example of valid input strings: + "123456789012" (EAN-13), "1234567890128" (EAN-13 wih checksum), + "1234567" (EAN-8), "12345670 12345" (EAN-8 with checksum and + add-5), "123456789012 12" (EAN-13 with add-2), "123456789012 + 12345" (EAN-13 with add-5). + +UPC + The UPC frontend accepts only strings made up of digits (and, if a + supplemental encoding is used, a blank to separate it). It + accepts strings of 11 or 12 digits (UPC-A) and 6 or 7 or 8 digits + (UPC-E). + + The 12th digit of UPC-A is the checksum and is added by the + library if not specified in the input; if it is specified, it must + be the right checksum or the code is rejected as invalid. For + UPC-E, 6 digit are considered to be the middle part of the code, a + leading 0 is assumed and the checksum is added; 7 digits are + either considered the initial part (leading digit 0 or 1, checksum + missing) or the final part (checksum specified, leading 0 + assumed); 8 digits are considered to be the complete code, with + leading 0 or 1 and checksum. For both UPC-A and UPC-E, a trailing + string of 2 digits or 5 digits is accepted as well. Therefore, the + following are examples of valid strings that can be encoded as UPC: + "01234567890" (UPC-A) "012345678905" (UPC-A with checksum), + "012345" (UPC-E), "01234567890 12" (UPC-A, add-2) and "01234567890 + 12345" (UPC-A, add-5), "0123456 12" (UPC-E, add-2). Please note + that when setting BARCODE_ANY to auto-detect the encoding to be + used, 12-digit strings and 7-digit strings will always be + identified as EAN. This because I expect most user to provide + input without a checksum. If you need to specify UPC-with-checksum + as input you must explicitly set BARCODE_UPC as a flag or use -e + upc on the command line. + +ISBN + ISBN numbers are encoded as EAN-13 symbols, with an optional add-5 + trailer. The ISBN frontend of the library accepts real ISBN + numbers and deals with any hyphen and, if present, the ISBN + checksum character before encoding data. Valid representations for + ISBN strings are for example: "1-56592-292-1", "3-89721-122-X" and + "3-89721-122-X 06900". + +CODE 128-B + This encoding can represent all of the printing ASCII characters, + from the space (32) to DEL (127). The checksum digit is mandatory + in this encoding. + +CODE 128-C + The "C" variation of Code-128 uses Code-128 symbols to represent + two digits at a time (Code-128 is made up of 104 symbols whose + interpretation is controlled by the start symbol being used). Code + 128-C is thus the most compact way to represent any even number of + digits. The encoder refuses to deal with an odd number of digits + because the caller is expected to provide proper padding to an + even number of digits. (Since Code-128 includes control symbols to + switch charset, it is theoretically possible to represent the odd + digit as a Code 128-A or 128-B symbol, but this tool doesn't + currently implement this option). + +CODE 128 RAW + Code-128 output represented symbol-by-symbol in the input string. + To override part of the problems outlined below in specifying + code128 symbols, this pseudo-encoding allows the used to specify a + list of code128 symbols separated by spaces. Each symbol is + represented by a number in the range 0-105. The list should + include the leading character.The checksum and the stop character + are automatically added by the library. Most likely this + pseudo-encoding will be used with BARCODE_NO_ASCII and some + external program to supply the printed text. + +CODE 39 + The code-39 standard can encode uppercase letters, digits, the + blank space, plus, minus, dot, star, dollar, slash, percent. Any + string that is only composed of such characters is accepted by the + code-39 encoder. To avoid loosing information, the encoder refuses + to encode mixed-case strings (a lowercase string is nonetheless + accepted as a shortcut, but is encoded as uppercase). + +INTERLEAVED 2 OF 5 + This encoding can only represent an even number of digits (odd + digits are represented by bars, and even digits by the + interleaving spaces). The name stresses the fact that two of the + five items (bars or spaces) allocated to each symbol are wide, + while the rest are narrow. The checksum digit is optional (can be + disabled via BARCODE_NO_CHECKSUM). Since the number of digits, + including the checksum, must be even, a leading zero is inserted + in the string being encoded if needed (this is specifically stated + in the specs I have access to). + +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 back-ticks 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. In needed, you can use + the "code 128 raw" pseudo-encoding to represent code128 symbols by + their numerical value. This encoding is used late in the + auto-selection mechanism because (almost) any input string can be + represented using code128. + +CODABAR + Codabar can encode the ten digits and a few special symbols + (minus, plus, dollar, colon, bar, dot). The characters "A", "B", + "C" and "D" are used to represent four different start/stop + characters. The input string to the barcode library can include + the start and stop characters or not include them (in which case + "A" is used as start and "B" as stop). Start and stop characters + in the input string can be either all lowercase or all uppercase + and are always printed as uppercase. + +PLESSEY + Plessey barcodes can encode all the hexadecimal digits. Alphabetic + digits in the input string must either be all lowercase or all + uppercase. The output text is always uppercase. + +MSI + MSI can only encode the decimal digits. While the standard + specifies either one or two check digits, the current + implementation in this library only generates one check digit. + +CODE 93 + The code-93 standard can natively encode 48 different characters, + including uppercase letters, digits, the blank space, plus, minus, + dot, star, dollar, slash, percent, as well as five special + characters: a start/stop delimiter and four "shift characters" + used for extended encoding. Using this "extended encoding" + method, any standard 7-bit ASCII character can be encoded, but it + takes up two symbol lengths in barcode if the character is not + natively supported (one of the 48). The encoder here fully + implements the code 93 encoding standard. Any characters natively + supported (A-Z, 0-9, ".+-/$&%") will be encoded as such - for any + other characters (such as lower case letters, brackets, + parentheses, etc.), the encoder will revert to extended encoding. + As a note, the option to exclude the checksum will eliminate the + two modulo-47 checksums (called C and K) from the barcode, but this + probably will make it unreadable by 99% of all scanning systems. + These checksums are specified to be used at the firmware level, + and their absence will be interpreted as an invalid barcode. + + + + +*Node: PCL Output + PCL Output + ********** + + While the default output is Postscript (possibly EPS), and Postscript +can be post-processed to almost anything, it is sometimes desirable to +create output directly usable by the specific printer at hand. PCL is +currently supported as an output format for this reason. Please note +that the Y coordinate for PCL goes from top to bottom, while for +Postscript it goes from bottom to top. Consistently, while in +Postscript you specify the bottom-left corner as origin, for PCL you +specify the top-left corner. + + Barcode output for PCL Printers (HP LaserJet and compatibles), was +developed using PCL5 Reference manuals from HP. that really refers to +these printers: + * LaserJet III, III P, III D, III Si, + + * LaserJet 4 family + + * LaserJet 5 family + + * LaserJet 6 family + + * Color LaserJet + + * DeskJet 1200 and 1600. + + + However, barcode printing uses a very small subset of PCL, probably +also LaserJet II should print it without problem, but the resulting +text may be horrible. + + The only real difference from one printer to another really depends +on which font are available in the printer, used in printing the label +associated to the bars (if requested). + + Earlier LaserJet supports only bitmaps fonts, so these are not +"scalable". (Ljet II ?), Also these fonts, when available, have a +specified direction, and not all of them are available in both Portrait +and Landscape mode. + + From LaserJet 4 series, (except 4L/5L that are entry-level printers), +Arial scalable font should be available, so it's the "default font" +used by this program. + + LaserJet III series printers (and 4L, 5L), don't feature "Arial" as a +resident font, so you should use BARCODE_OUT_PCL_III instead of +BARCODE_OUT_PCL., and font the font used will be "Univers" instead of +"Arial". + + Results on compatible printers, may depend on consistency of PCL5 +compatibility, in doubt, try BARCODE_OUT_PCL_III + + PJL commands are not used here, as it's not very compatible. + + Tested Printers: + * Hp LaserJet 4050 + + * Hp LaserJet 2100 + + * Epson N-1200 emul PCL + + * Toshiba DP2570 (copier) + PCL option + + * Epson EPL-7100 emul. HP LaserJet II: bars print fine but text is + bad. + + + + +*Node: Bugs and Pending Issues + Bugs and Pending Issues. + ************************ + + The current management of borders/margins is far from optimal. The +"default" margin applied by the library interferes with the external +representation, but I feel it is mandatory to avoid creating barcode +output with no surrounding white space (the problem is especially +relevant for EPS output). + + EAN-128 is not (yet) supported. I plan to implement it pretty soon +and then bless the package as version 1.0. + + + + + +Tag Table:Node: Top153 + Node: Overview525 + Node: The Barcode Object1403 +Node: The Field List2820 +Node: The Intermediate Representation6585 +Node: Supported Flags8358 +Node: The API11342 +Node: The barcode Executable14028 +Node: The Command Line14457 +Node: Supported Encodings19556 +Node: PCL Output28996 +Node: Bugs and Pending Issues31315 + + + +End Tag Table \ No newline at end of file diff --git a/glabels1/barcode-0.98/doc/doc.barcode b/glabels1/barcode-0.98/doc/doc.barcode new file mode 100644 index 00000000..7b460558 --- /dev/null +++ b/glabels1/barcode-0.98/doc/doc.barcode @@ -0,0 +1,939 @@ +\input texinfo @c -*-texinfo-*- +% +% doc.barcode - main file for the documentation +% +%%%% + +%------------------------------------------------------------------------------ +% +% NOTE FOR THE UNAWARE USER +% ========================= +% +% This file is a texinfo source. It isn't the binary file of some strange +% editor of mine. If you want ascii, you should "make barcodedoc.txt". +% +%------------------------------------------------------------------------------ + +% +% This is not a conventional info file... +% I use two extra features: +% - The '%' as a comment marker, if at beg. of line ("\%" -> "%") +% - leading blanks are allowed +% + +@comment %**start of header +@setfilename barcode.info +@settitle Barcode @value{version} +@iftex +@afourpaper +@end iftex +@comment %**end of header + +@setchapternewpage off + +@set version 0.98 +@set update-month March 2002 + +@finalout + +@ifinfo + +This file is the User's Manual for the barcode library (version +@value{version}). + +@end ifinfo + +@setchapternewpage odd +@titlepage +@c use the new format for titles +@title barcode @value{version} +@subtitle A library for drawing bar codes +@subtitle @value{update-month} + +@author by Alessandro Rubini (@code{rubini@@gnu.org}) + +@end titlepage +@setchapternewpage off +@headings single + + +@node Top, Overview, (dir), (dir) +@top Barcode tools + +This file documents version @value{version} of the barcode +library and sample programs (@value{update-month}). + +@menu +* Overview:: +* The Barcode Object:: +* Supported Flags:: +* The API:: +* The barcode Executable:: +* Supported Encodings:: +* PCL Output:: +* Bugs and Pending Issues:: +@end menu + + +%########################################################################## +%########################################################################## + +@node Overview, The Barcode Object, Top, Top +@chapter Overview + +The @dfn{barcode} package is mainly a C library for creating bar-code +output files. It also includes a command line front-end and (in a +foreseeable future) a graphic frontend. + +The package is designed as a library because we think the main use for +barcode-generation tools is inside more featured applications. The +library addresses bar code printing as two distinct problems: creation +of bar information and actual conversion to an output format. To this +aim we use an intermediate representation for bar codes, which is +currently documented in the @file{ps.c} source file (not in this +document). + +Note that the library and the accompanying material is released +according to the GPL license, not the LGPL one. A copy of the GPL is +included in the distribution tarball. + +%########################################################################## + +@node The Barcode Object, Supported Flags, Overview, Top +@chapter The Underlying Data Structure + +Every barcode-related function acts on a data structure defined in the +@file{barcode.h} header, which must be included by any C source file +that uses the library. The header is installed by @t{make install}. + +The definition of the data structure is included here for reference: + +@lisp +struct Barcode_Item @{ + int flags; /* type of encoding and other flags */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text placement */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ +@}; +@end lisp + +The exact meaning of each field and the various flags implemented are +described in the following sections. + +Even though you won't usually need to act on the contents of this +structure, some of the functions in the library receive arguments that +are directly related to one or more of these fields. + +%========================================================================== + +@menu +* The Field List:: +* The Intermediate Representation:: +@end menu + +%-------------------------------------------------------------------------- +@node The Field List, The Intermediate Representation, The Barcode Object, The Barcode Object +@section The Fields + +@table @code + +@item int flags; + + The flags are, as you may suspect, meant to specify the exact + behaviour of the library. They are often passed as an argument + to @i{barcode} functions and are discussed in the next section. + +@item char *ascii; +@itemx char *partial; +@itemx char *textinfo; +@itemx char *encoding; + + These fields are internally managed by the library, and you are + not expected to touch them if you use the provided API. All + of them are allocated with @i{malloc}. + +@item int width; +@itemx int height; + + They specify the width and height of the @i{active} barcode + region (i.e., excluding the white margin), in the units used + to create output data (for postscript they are points, 1/72th + of an inch, 0.352 mm). The fields can be either assigned to + in the structure or via @i{Barcode_Position()}, at your + choice. If either value or both are left to their default + value of zero, the output engine will assign default values + according to the specified scaling factor. If the specified + width is bigger than needed (according to the scaling factor), + the output barcode will be centered in its requested + region. If either the width of the height are too small for + the specified scale factor, the output bar code will expand + symmetrically around the requested region. + +@item int xoff; +@itemx int yoff; + + The fields specify offset from the coordinate origin of the + output engine (for postscript, position 0,0 is the lower left + corner of the page). The fields can be either assigned to in + the structure or via @i{Barcode_Position()}, at your choice. + The offset specifies where the white margin begins, not where + the first bar will be printed. To print real ink to the + specified position you should set @i{margin} to 0. + +@item int margin; + + The white margin that will be left around the printed area of + the bar code. The same margin is applied to all sides of the + printed area. The default value for the margin is defined in + @file{barcode.h} as @t{BARCODE_DEFAULT_MARGIN} (10). + +@item double scalef; + + The enlarge or shrink value for the bar code over its default + dimension. The @i{width} and @i{scalef} fields interact deeply + in the creation of the output, and a complete description of + the issues appears later in this section. + +@item int error; + + The field is used when a @i{barcode} function fails to host + an @t{errno}-like integer value. + +@end table + + +@unnumberedsubsec Use of the @i{width} and @i{scalef} fields. + +A width unit is the width of the thinnest bar and/or space in the +chosen code; it defaults to 1 point if the output is postscript or +encapsulated postscript. + +Either or both the code width and the scale factor can be left +unspecified (i.e., zero). The library deals with defaults in the +following way: + +@table @i + +@item Both unspecified + + If both the width and the scale factor are unspecified, the + scale factor will default to 1.0 and the width is calculated + according to the actual width of the bar code being printed. + +@item Width unspecified + + If the width is not specified, it is calculated according to + the values of @i{scalef}. + +@item Scale factor unspecified + + If the scale factor is not specified, it will be chosen so + that the generated bar code exactly fits the specified width. + +@item Both specified + + The code will be printed inside the specified region according + to the specified scale factor. It will be aligned to the left. + If, however, the chosen width is too small for the specific + bar code and scaling factor, then the code will extend + symmetrically to the left and to the right of the chosen + region. + +@end table + +%-------------------------------------------------------------------------- +@node The Intermediate Representation, , The Field List, The Barcode Object +@section The Intermediate Representation + +The encoding functions print their output into the @t{partial} and +@t{texinfo} fields of the barcode data structure. Those fields, together +with position information, are then used to generate actual output. +This is an informal description of the intermediate format. + +The first char in @t{partial} tells how much extra space to add to the +left of the bars. For EAN-13, it is used to leave space to print the +first digit, other codes may have '0' for no-extra-space-needed. + +The next characters are alternating bars and spaces, as multiples of the +base dimension which is 1 unless the code is rescaled. Rescaling is +calculated as the ratio from the requested width and the calculated +width. Digits represent bar/space dimensions. Lower-case letters +represent those bars that should extend lower than the others: 'a' is +equivalent to '1', 'b' is '2' and so on up to 'i' which is equivalent to +'9'. Other letters will be used for encoding-specific meanings, as soon +as I implement them. + +The @t{textinfo} string is made up of fields @t{%lf:%lf:%c} separated by +blank space. The first integer is the x position of the character, +the second is the font size (before rescaling) and the char item is +the character to be printed. + +Both the @t{partial} and @t{textinfo} strings may include ``@t{-}'' or +``@t{+}'' as special characters (in @t{textinfo} the char should be a +stand-alone word). They state where the text should be printed: below +the bars (``@t{-}'', default) or above the bars. This is used, for +example, to print the add-5 and add-2 codes to the right of UPC or EAN +codes (the add-5 extension is mostly used in ISBN codes). + + + + +%========================================================================== + +@node Supported Flags, The API, The Barcode Object, Top +@chapter The Flags + +The following flags are supported by version @value{version} of the +library: + +@table @code + +@item BARCODE_ENCODING_MASK + + The mask is used to extract the encoding-type identifier from + the @i{flags} field. + +@item BARCODE_EAN +@itemx BARCODE_UPC +@itemx BARCODE_ISBN +@itemx BARCODE_128B +@itemx BARCODE_128C +@itemx BARCODE_128 +@itemx BARCODE_128RAW +@itemx BARCODE_39 +@itemx BARCODE_I25 +@itemx BARCODE_CBR +@itemx BARCODE_MSI +@itemx BARCODE_PLS +@itemx BARCODE_93 + + The currently supported encoding types: EAN (13 digits, 8 + digits, 13 + 2 add-on and 13 + 5 add-on), UPC (UPC-A, UPC-E, + UPC-A with 2 or 5 digit add-on), ISBN (with or without the + 5-digit add-on), CODE128-B (the whole set of printable + ASCII characters), CODE128-C (two digits encoded by each barcode + symbol), CODE128 (all ASCII values), a ``raw-input'' pseudo-code + that generates CODE128 output, CODE39 (alphanumeric), + "interleaved 2 of 5" (numeric), Codabar (numeric plus a few + symbols), MSI (numeric) and Plessey (hex digits). + @xref{Supported Encodings}. + +@item BARCODE_ANY + + This special encoding type (represented by a value of zero, so + it will be the default) tells the encoding procedure to look + for the first encoding type that can deal with a textual + string. Therefore, a 11-digit code will be printed as UPC (as + well as 6-digit, 11+2 and 11+5), a 12-digit (or 7-digit, or + 12+2 or 12+5) as EAN13, an ISBN code (with or without hyphens, + with or without add-5) will be encoded in its EAN13 + representation, an even number of digits is encoded using + CODE128C and a generic string is encoded using CODE128B. Since + code-39 offers a much larger representation for the same + text string, code128-b is preferred over code39 for + alphanumeric strings. + +@item BARCODE_NO_ASCII + + Instructs the engine not to print the ascii string on + output. By default the bar code is accompanied with an ascii + version of the text it encodes. + +@item BARCODE_NO_CHECKSUM + + Instructs the engine not to add the checksum character to the + output. Not all the encoding types can drop the checksum; + those where the checksum is mandatory (like EAN and UPC) + just ignore the flag. + +@item BARCODE_OUTPUT_MASK + + The mask is used to extract the output-type identifier from + the @i{flags} field. + +@item BARCODE_OUT_PS +@itemx BARCODE_OUT_EPS +@itemx BARCODE_OUT_PCL +@itemx BARCODE_OUT_PCL_III + + The currently supported encoding types: full-page postscript + and encapsulated postscript; PCL (print command language, for + HP printers) and PCL-III (same as PCL, but uses a font not + available on older printers). + +@item BARCODE_OUT_NOHEADERS + + The flag instructs the printing engine not to print the header + and footer part of the file. This makes sense for the + postscript engine but might not make sense for other engines; + such other engines will silently ignore the flag just like + the PCL back-end does. + +@end table + +%########################################################################## + +@node The API, The barcode Executable, Supported Flags, Top +@chapter Functions Exported by the Library + +%MANPAGE barcode.3 +%M .TH BARCODE 3 "October 1999" "GNU" "GNU barcode" +%M .UC 4 +%M .SH NAME +%M barcode \- a library to create and print bar codes +%M .SH SYNOPSIS +%M .B #include +%M .sp +%M .BI "struct Barcode_Item *Barcode_Create(char *" text ");" +%M .br +%M .BI "int Barcode_Delete(struct Barcode_Item *" bc ");" +%M .br +%M .BI "int Barcode_Encode(struct Barcode_Item *" bc ", int " flags ");" +%M .br +%M .BI "int Barcode_Print(struct Barcode_Item *" bc ", FILE *" f ", int " flags ");" +%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 ", int " flags ");" +%M .br +%M .BI "int Barcode_Version(char *" versionname ");" +%M +%M .SH DESCRIPTION +%M +%M The barcode family of library functions is meant to ease +%M creation of bar-code printouts. +%M +%M The information below is extracted from the texinfo file, which is the +%M preferred source of information. + +The functions included in the barcode library are declared in the +header file @t{barcode.h}. They perform the following tasks: + +@table @code + +@item struct Barcode_Item *Barcode_Create(char *text); + The function creates a new barcode object to deal with a + specified text string. It returns NULL in case of failure and + a pointer to a barcode data structure in case of success. + +@item int Barcode_Delete(struct Barcode_Item *bc); + Destroy a barcode object. Always returns 0 (success) + +@item int Barcode_Encode(struct Barcode_Item *bc, int flags); + Encode the text included in the @i{bc} object. Valid flags are + the encoding type (other flags are ignored) and + BARCODE_NO_CHECKSUM (other flags are silently ignored); if the + flag argument is zero, @t{bc->flags} will apply. The function + returns 0 on success and -1 in case of error. After + successful termination the data structure will host the + description of the bar code and its textual representation, + after a failure the @t{error} field will include the reason of + the failure. + +@item int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags); + Print the bar code described by @t{bc} to the specified file. + Valid flags are the output type, @t{BARCODE_NO_ASCII} and + @t{BARCODE_OUT_NOHEADERS}, other flags are ignored. If any of + these flags is zero, it will be inherited from @t{bc->flags} + which therefore takes precedence. The function returns 0 on + success and -1 in case of error (with @t{bc->error} set + accordingly). In case of success, the bar code is printed to + the specified file, which won't be closed after use. + +@item 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. + +@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. + +@item int Barcode_Version(char *versionname); + Returns the current version as an integer number of the form + major * 10000 + minor * 100 + release. Therefore, version + 1.03.5 will be returned as 10305 and version 0.53 as 5300. If + the argument is non-null, it will be used to return the version + number as a string. Note that the same information is available from + two preprocessor macros: @t{BARCODE_VERSION} (the string) and + @t{BARCODE_VERSION_INT} (the integer number). + +@end table + +%MANPAGE END + +%########################################################################## + +@node The barcode Executable, Supported Encodings, The API, Top +@chapter The @i{barcode} frontend program + +%MANPAGE barcode.1 +%M .TH BARCODE 1 "October 2001" "GNU" "GNU barcode" +%M .UC 4 +%M .SH NAME +%M barcode \- a stand alone program to run the barcode library +%M .SH SYNOPSIS +%M .B barcode +%M [\-b - | string] [\-e encoding] [\-o - | outfile] [ +%M .I other-flags +%M ] +%M .SH DESCRIPTION +%M +%M The information below is extracted from the texinfo file, which is the +%M preferred source of information. +%M .PP +The @b{barcode} program is a front-end to access some features of the +library from the command line. It is able to read user supplied +strings from the command line or a data file (standard input by default) +and encode all of them. + +%M .SH OPTIONS +%M .PP + +@menu +* The Command Line:: +@end menu + +%-------------------------------------------------------------------------- +@node The Command Line, , The barcode Executable, The barcode Executable +@section The Command Line + + +@b{barcode} accepts the following options: + +@table @code + +@item --help or -h + Print a usage summary and exit. + +@item -i filename + Identify a file where strings to be encoded are read from. If + missing (and if @t{-b} is not used) it defaults to standard + input. Each data line of the input file will be used to create + one barcode output. + +@item -o filename + Output file. It defaults to standard output. + +@item -b string + Specify a single ``barcode'' string to be encoded. + The option can be used multiple times in order to encode + multiple strings (this will result in multi-page postscript + output or a table of barcodes if @t{-t} is specified). The + strings must match the encoding chosen; if it doesn't + match the program will print a warning to @t{stderr} and + generate ``blank'' output (although not zero-length). + Please note that a string including spaces or + other special characters must be properly quoted. + +@item -e encoding + @b{encoding} is the name of the chosen encoding format being + used. It defaults to the value of the environment variable + @t{BARCODE_ENCODING} or to auto detection if the environment is + also unset. + +@item -g geometry + The geometry argument is of the form ``[@i{} @t{x} + @i{}] [@t{+} @i{} @t{+} @i{}]'' (with + no intervening spaces). Unspecified margin values will result in + no margin; unspecified size results in default size. + The specified values represent print points by + default, and can be inches, millimeters or other units + according to the @t{-u} option or the @t{BARCODE_UNIT} + environment variable. The argument is used to place the + printout code on the page. Note that an additional white + margin of 10 points is added to the printout. If the option is + unspecified, @t{BARCODE_GEOMETRY} is looked up in the + environment, if missing a default size and no margin (but the + default 10 points) are used. + +@item -t table-geometry + Used to print several barcodes to a single page, this option + is meant to be used to print stickers. The argument is of the + form ``@i{} @t{x} @i{} [@t{+} @i{} + @t{+} @i{} [@t{-} @i{} [@t{-} + @i{}]]]'' (with no intervening spaces); if missing, + the top and right margin will default to be the same as the + bottom and left margin. The margins are specified in print + points or in the chosen unit (see @t{-u} below). If the + option is not specified, @t{BARCODE_TABLE} is looked up in the + environment, otherwise no table is printed and each barcode + will get its own page. The size (but not the position) + of a barcode item within a table can also be selected using + @t{-g} (see "geometry" above), without struggling with + external and internal margins. I still think management of + geometries in a table is suboptimal, but I can't make it + better without introducing incompatibilities. + + +@item -m margin(s) + Specifies an internal margin for each sticker in the + table. The argument is of the form + ``@i{}@t{,}@i{}'' and the margin is applied + symmetrically to the sticker. If unspecified, the environment + variable @t{BARCODE_MARGIN} is used or a default internal + margin of 10 points is used. + +@item -n + ``Numeric'' output: don't print the ASCII form of the code, + only the bars. + +@item -c + No checksum character (for encodings that allow it, like code 39, + other codes, like UPC or EAN, ignore this option). + +@item -E + Encapsulated postscript (default is normal postscript). When + the output is generated as EPS only one barcode is encoded. + +@item -P + PCL output. Please note that the Y direction goes from top + to bottom for PCL, and the origin for an image is the top-left + corner instead of the bottom-left + +@item -p pagesize + Specify a non-default page size. The page size can be specified + in millimeters, inches or plain numbers (for example: "@t{210x297mm}", + "@t{8.5x11in}", "@t{595x842}"). A page specification as numbers + will be interpreted according to the current unit specification + (see @t{-u} below). If libpaper is available, + you can also specify the page size with its name, like "@t{A3}" + or "@t{letter}" (libpaper is a standard component of Debian + GNU/Linux, but may be missing elsewhere). The default page + size is your system-wide default if libpaper is there, A4 otherwise. + +@item -u unit + Choose the unit used in size specifications. Accepted values + are ``mm'', ``cm'', ``in'' and ``pt''. By default, the program + will check @t{BARCODE_UNIT} in the environment, and assume + points otherwise (this behaviour is compatible with 0.92 and + previous versions. If @t{-u} appears more than once, each + instance will modified the behaviour for the arguments at its + right, as the command line is processes left to right. The + program internally works with points, and any size is + approximated to the nearest multiple of one point. The @t{-u} + option affect @t{-g} (geometry), @t{-t} (table) and @t{-p} + (page size). + +@end table + +%M .SH ENCODING TYPES +%M .PP + +%########################################################################## +@node Supported Encodings, PCL Output, The barcode Executable, Top +@chapter Supported Encodings + +The program encodes text strings passed either on the command line +(with -b) or retrieved from standard input. The text representation is +interpreted according to the following rules. When auto-detection +of the encoding is enabled (i.e, no explicit encoding type is specified), +the encoding types are scanned to find one that can digest the text string. +The following list of supported types is sorted in the same order +the library uses when auto-detecting a suitable encoding for a string. + +@table @var + +@item EAN + The EAN frontend is similar to UPC; it accepts strings of + digits, 12 or 7 characters long. Strings of 13 or 8 characters + are accepted if the provided checksum digit is correct. + I expect most users to feed input without a + checksum, though. The add-2 and add-5 extension are accepted for both + the EAN-13 and the EAN-8 encodings. + The following are example of valid input strings: + ``@t{123456789012}'' (EAN-13), ``@t{1234567890128}'' (EAN-13 wih + checksum), ``@t{1234567}'' (EAN-8), ``@t{12345670 12345}'' (EAN-8 + with checksum and add-5), + ``@t{123456789012 12}'' (EAN-13 with add-2), + ``@t{123456789012 12345}'' (EAN-13 with add-5). + +@item UPC + The UPC frontend accepts only strings made up of digits (and, + if a supplemental encoding is used, a blank to separate it). + It accepts strings of 11 or 12 digits (UPC-A) and 6 or 7 or 8 + digits (UPC-E). + + The 12th digit of UPC-A is the checksum and is added by the + library if not specified in the input; if it is specified, it + must be the right checksum or the code is rejected as invalid. + For UPC-E, 6 digit are considered to be the middle part of the + code, a leading 0 is assumed and the checksum is added; + 7 digits are either considered the initial part (leading digit + 0 or 1, checksum missing) or the final part (checksum specified, + leading 0 assumed); 8 digits are considered to be the complete code, + with leading 0 or 1 and checksum. + For both UPC-A and UPC-E, a trailing string of 2 digits or 5 digits + is accepted as well. Therefore, the following are examples + of valid strings that can be encoded as UPC: + ``@t{01234567890}'' (UPC-A) + ``@t{012345678905}'' (UPC-A with checksum), ``@t{012345}'' + (UPC-E), ``@t{01234567890 12}'' (UPC-A, add-2) and + ``@t{01234567890 12345}'' (UPC-A, add-5), ``@t{0123456 12}'' + (UPC-E, add-2). + Please note that when setting @t{BARCODE_ANY} to auto-detect + the encoding to be used, 12-digit strings and 7-digit strings + will always be identified as EAN. This because I expect most + user to provide input without a checksum. If you need to + specify UPC-with-checksum as input you must explicitly set + @t{BARCODE_UPC} as a flag or use @t{-e upc} on the command line. + +@item ISBN + ISBN numbers are encoded as EAN-13 symbols, with an optional + add-5 trailer. The ISBN frontend of the library accepts real + ISBN numbers and deals with any hyphen and, if present, the + ISBN checksum character before encoding data. Valid + representations for ISBN strings are for example: + ``@t{1-56592-292-1}'', ``@t{3-89721-122-X}'' and ``@t{3-89721-122-X + 06900}''. + +@item code 128-B + This encoding can represent all of the printing ASCII + characters, from the space (32) to DEL (127). The checksum + digit is mandatory in this encoding. + +@item code 128-C + The ``C'' variation of Code-128 uses Code-128 symbols to + represent two digits at a time (Code-128 is made up of 104 + symbols whose interpretation is controlled by the start symbol + being used). Code 128-C is thus the most compact way to + represent any even number of digits. The encoder refuses to + deal with an odd number of digits because the caller is + expected to provide proper padding to an even number of + digits. (Since Code-128 includes control symbols to switch + charset, it is theoretically possible to represent the odd + digit as a Code 128-A or 128-B symbol, but this tool doesn't + currently implement this option). + +@item code 128 raw + Code-128 output represented symbol-by-symbol in the input + string. To override part of the problems outlined below in + specifying code128 symbols, this pseudo-encoding allows the + used to specify a list of code128 symbols separated by + spaces. Each symbol is represented by a number in the range + 0-105. The list should include the leading character.The + checksum and the stop character are automatically added by the + library. Most likely this pseudo-encoding will be used with + @t{BARCODE_NO_ASCII} and some external program to supply the + printed text. + +@item code 39 + The code-39 standard can encode uppercase letters, digits, the + blank space, plus, minus, dot, star, dollar, slash, percent. + Any string that is only composed of such characters is + accepted by the code-39 encoder. To avoid loosing information, + the encoder refuses to encode mixed-case strings (a lowercase + string is nonetheless accepted as a shortcut, but is encoded + as uppercase). + +@item interleaved 2 of 5 + This encoding can only represent an even number of digits + (odd digits are represented by bars, and even digits by the + interleaving spaces). The name stresses the fact that two + of the five items (bars or spaces) allocated to each symbol + are wide, while the rest are narrow. The checksum digit is + optional (can be disabled via @t{BARCODE_NO_CHECKSUM}). + Since the number of digits, including the checksum, must be even, + a leading zero is inserted in the string being encoded if needed + (this is specifically stated in the specs I have access to). + +@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 back-ticks 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. In needed, you can + use the ``@i{code 128 raw}'' pseudo-encoding to represent + code128 symbols by their numerical value. This encoding is + used late in the auto-selection mechanism because (almost) any + input string can be represented using code128. + +@item Codabar + Codabar can encode the ten digits and a few special symbols + (minus, plus, dollar, colon, bar, dot). The characters + ``@t{A}'', ``@t{B}'', ``@t{C}'' and ``@t{D}'' are used to + represent four different start/stop characters. The input + string to the barcode library can include the start and stop + characters or not include them (in which case ``@t{A}'' is + used as start and ``@t{B}'' as stop). Start and stop + characters in the input string can be either all lowercase or + all uppercase and are always printed as uppercase. + +@item Plessey + Plessey barcodes can encode all the hexadecimal + digits. Alphabetic digits in the input string must either be + all lowercase or all uppercase. The output text is always + uppercase. + +@item MSI + MSI can only encode the decimal digits. While the standard + specifies either one or two check digits, the current + implementation in this library only generates one check digit. + +@item code 93 + The code-93 standard can natively encode 48 different characters, + including uppercase letters, digits, the blank space, plus, minus, + dot, star, dollar, slash, percent, as well as five special + characters: a start/stop delimiter and four "shift characters" used + for extended encoding. Using this "extended encoding" method, any + standard 7-bit ASCII character can be encoded, but it takes up two + symbol lengths in barcode if the character is not natively supported + (one of the 48). + The encoder here fully implements the code 93 encoding standard. + Any characters natively supported (A-Z, 0-9, ".+-/$&%") will be + encoded as such - for any other characters (such as lower case + letters, brackets, parentheses, etc.), the encoder will revert + to extended encoding. + As a note, the option to exclude the checksum will eliminate the + two modulo-47 checksums (called C and K) from the barcode, but this + probably will make it unreadable by 99% of all scanning systems. + These checksums are specified to be used at the firmware level, + and their absence will be interpreted as an invalid barcode. + + +@end table + +%M .SH PCL OUTPUT + +%########################################################################## +@node PCL Output, Bugs and Pending Issues, Supported Encodings, Top +@chapter PCL Output + +While the default output is Postscript (possibly EPS), and Postscript +can be post-processed to almost anything, it is sometimes desirable to +create output directly usable by the specific printer at hand. +PCL is currently supported as an output format for this reason. +Please note that the Y coordinate for PCL goes from top to bottom, while +for Postscript it goes from bottom to top. Consistently, while in +Postscript you specify the bottom-left corner as origin, for PCL +you specify the top-left corner. + +Barcode output for PCL Printers (HP LaserJet and compatibles), +was developed using PCL5 Reference manuals from HP. +that really refers to these printers: +@itemize @bullet + +@item +LaserJet III, III P, III D, III Si, + +@item +LaserJet 4 family + +@item +LaserJet 5 family + +@item +LaserJet 6 family + +@item +Color LaserJet + +@item +DeskJet 1200 and 1600. + +@end itemize + +However, barcode printing uses a very small subset of PCL, probably also +LaserJet II should print it without problem, but the resulting text may +be horrible. + +The only real difference from one printer to another really depends on +which font are available in the printer, used in printing the label +associated to the bars (if requested). + +Earlier LaserJet supports only bitmaps fonts, so these are not +"scalable". (Ljet II ?), Also these fonts, when available, have a +specified direction, and not all of them are available in +both Portrait and Landscape mode. + +From LaserJet 4 series, (except 4L/5L that are entry-level printers), +Arial scalable font should be available, so it's the "default font" +used by this program. + +LaserJet III series printers (and 4L, 5L), don't feature "Arial" as a +resident font, so you should use @t{BARCODE_OUT_PCL_III} instead of +@t{BARCODE_OUT_PCL.}, and font the font used will be "Univers" instead +of "Arial". + +Results on compatible printers, may depend on consistency of +PCL5 compatibility, in doubt, try BARCODE_OUT_PCL_III + +PJL commands are not used here, as it's not very compatible. + + +Tested Printers: +@itemize @bullet +@item +Hp LaserJet 4050 +@item +Hp LaserJet 2100 +@item +Epson N-1200 emul PCL +@item +Toshiba DP2570 (copier) + PCL option +@item +Epson EPL-7100 emul. HP LaserJet II: bars print fine but text is bad. +@end itemize + + +%M .SH BUGS + +%########################################################################## +@node Bugs and Pending Issues, , PCL Output, Top +@chapter Bugs and Pending Issues. + +The current management of borders/margins is far from optimal. The +``default'' margin applied by the library interferes with the external +representation, but I feel it is mandatory to avoid creating barcode +output with no surrounding white space (the problem is especially +relevant for EPS output). + +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 (maintainer) +%M .PP +%M Leonid A. Broukhis (several encodings) +%M .PP +%M Andrea Scopece (PCL output) +%MANPAGE END + +@iftex +@contents +@end iftex + +@bye +@c LocalWords: barcode ifinfo titlepage iftex texinfo ascii frontend LGPL +@c LocalWords: tarball malloced textinfo scalef isbn Plessey codabar GPL Ljet +@c LocalWords: LocalWords LaserJet Univers Arial Debian libpaper pagesize +@c LocalWords: Epson MANPAGE stderr barcodes emul DeskJet xmargin ymargin +@c LocalWords: leftmargin rightmargin topmargin bottommargin unset struct +@c LocalWords: NOHEADERS yoff xoff versionname errno malloc behaviour charset diff --git a/glabels1/barcode-0.98/doc/infofilter b/glabels1/barcode-0.98/doc/infofilter new file mode 100755 index 00000000..92bc8b7d --- /dev/null +++ b/glabels1/barcode-0.98/doc/infofilter @@ -0,0 +1,16 @@ +#! /usr/bin/sed -f + + +# allow "%" as a comment char, but only at the beginning of the line +s/^%/@c / +#s/[^\\]%.*$// +s/^\\%/%/ + +#preserve blanks in @lisp blocks +/@lisp/,/@end lisp/ p +/@lisp/,/@end lisp/ d + +# remove leading blanks +s/^[ ]*// + +#s/\\t/@code/g diff --git a/glabels1/barcode-0.98/doc/manpager b/glabels1/barcode-0.98/doc/manpager new file mode 100755 index 00000000..46de5be2 --- /dev/null +++ b/glabels1/barcode-0.98/doc/manpager @@ -0,0 +1,120 @@ +#! /usr/bin/awk -f +# Copyright (c) 1998-2001 Alessandro Rubini + +BEGIN {IN=0} + +/^%MANPAGE END/ {IN=0; next} +/^%MANPAGE/ {IN=1; USELP=NEEDLP=INTABLE=0; NAME=$2; next} +IN==0 {next} + +/^%MSKIP/ {SKIP=1;next} +/^%M/ {SKIP=0} + +/^@menu/ {SKIP=1;next} +/^@end menu/ {SKIP=0;next} + +SKIP==1 {next} +/^%M$/ {next} +/^@ignore/ {next} +/^@end ign/ {next} + +#now perform all the substitutions needed + + { gsub("^%M ?",""); } + +# Use gensub for converting tags: itz Sep 30 1998 +# +# However, the gensub function is gawk-specific, and we want things +# to work with original-awk too (for portability). +# Therefore, use a normal gsub, even though it's a subobptimal solution +# as it may step in extra braces. The good solution will be piping to sed, +# or match, extract subesxpression, replace, reinsert -- bleah... +# (ARub, Oct 10 2000) +/@b\{/ { + #$0 = gensub(/@b\{([^}]+)\}/, "\\\\fB\\1\\\\fP","g"); + gsub("@b\{","\\fB"); + gsub("\}","\\fP"); +} + +/@var\{/ { + #$0 = gensub(/@var\{([^}]+)\}/, "\\\\fI\\1\\\\fP","g"); + gsub("@var\{","\\fB"); + gsub("\}","\\fP"); +} + +/@(samp|code|file)\{/ { + #$0 = gensub(/@(samp|code|file)\{([^}]+)\}/, "`\\2'","g"); + gsub("@(samp|code|file)\{",""); + gsub("\}",""); +} + + +/@xref\{.*\}\./ { + gsub(/@xref\{.*\}\./,""); +} + +/@ref\{.*\}/ { + gsub("@ref\{",""); + gsub("\}",""); +} + +/@\*/ { + gsub(/@\* */,"\n.br\n"); +} + +/@[a-z]+\{/ { + gsub("@[a-z]+\\{",""); + gsub("}",""); + } + +/^@table/ { TABLE=1; } +/^@itemize/ { TABLE=1; next} + +/^@item/ { + gsub("^@item *",""); + printf ".TP\n%s\n",$0 > NAME; + NEEDLP=0; next; + } + +/^@end table/ {TABLE=0} +/^@end itemize/ {TABLE=0} + +# discard other texinfo commands + +/^@/ {next} + +# manage comments and '%' + +/^%/ {next} + + + { + gsub("[^\\\\]%.*$",""); + gsub("\\%","%"); + } + +# remove leading blanks + +/^[ \t]/ {gsub("^[ \t]*","");} + +# put a .LP at blank lines + +/^.nf/ {USELP=0} +/^.fi/ {USELP=1} + +/^$/ {if (USELP) {NEEDLP++; next;} } + + +/./ { if (NEEDLP) { printf "\n.LP\n" > NAME; NEEDLP=0; } } + +/^.TH/ {USELP=1} + +# Escape single slashes (e.g. in documentation for `-l' command line option) + + {gsub("\\\\ ", "\\\\ ");} + + {gsub("~", "~~");} + + {print > NAME} + + diff --git a/glabels1/barcode-0.98/doc/mktxt b/glabels1/barcode-0.98/doc/mktxt new file mode 100755 index 00000000..bd3f88ba --- /dev/null +++ b/glabels1/barcode-0.98/doc/mktxt @@ -0,0 +1,38 @@ +#! /usr/bin/awk -f + +# Warning: this may use gnu-awk features + +# Program to create ascii from info; +# Missing: table of contents + +# skip + +BEGIN {NODELINE=0; NODE=0; KEEP=1; printf "\n\n"} + + +/^\037$/ { NODELINE=1; NODE=NODE+1; KEEP=1; next} + +NODE==1 { next } + +NODELINE==1 { + NODELINE=2; + sub("^.*Node: ","*Node: "); + sub(",.*$",""); + printf "\n\n\n%s",$0; +#print + next; + } + +NODELINE { NODELINE=NODELINE+1 } + +NODELINE==4 { printf "\t\t\t\t"; } +NODELINE==5 { printf "\t\t\t\t"; NODELINE=0} + + +/^\* Menu:$/ { KEEP=0 } + + + +KEEP==0 { next } + +{ print } diff --git a/glabels1/barcode-0.98/doc/texi2html b/glabels1/barcode-0.98/doc/texi2html new file mode 100755 index 00000000..2c61aa93 --- /dev/null +++ b/glabels1/barcode-0.98/doc/texi2html @@ -0,0 +1,2021 @@ +#!/usr/local/bin/perl +'di '; +'ig 00 '; +#+############################################################################## +# # +# File: texi2html # +# # +# Description: Program to transform most Texinfo documents to HTML # +# # +#-############################################################################## + +# @(#)texi2html 1.51 09/10/96 Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch + +# The man page for this program is included at the end of this file and can be +# viewed using the command 'nroff -man texi2html'. +# Please read the copyright at the end of the man page. + +#+++############################################################################ +# # +# Constants # +# # +#---############################################################################ + +$DEBUG_TOC = 1; +$DEBUG_INDEX = 2; +$DEBUG_BIB = 4; +$DEBUG_GLOSS = 8; +$DEBUG_DEF = 16; +$DEBUG_HTML = 32; +$DEBUG_USER = 64; + +$BIBRE = '\[[\w\/]+\]'; # RE for a bibliography reference +$FILERE = '[\/\w.+-]+'; # RE for a file name +$VARRE = '[^\s\{\}]+'; # RE for a variable name +$NODERE = '[^@{}:\'`",]+'; # RE for a node name +$NODESRE = '[^@{}:\'`"]+'; # RE for a list of node names +$XREFRE = '[^@{}]+'; # RE for a xref (should use NODERE) + +$ERROR = "***"; # prefix for errors and warnings +$THISPROG = "texi2html 1.51"; # program name and version +$HOMEPAGE = "http://wwwcn.cern.ch/dci/texi2html/"; # program home page +$TODAY = &pretty_date; # like "20 September 1993" +$SPLITTAG = "\n"; # tag to know where to split +$PROTECTTAG = "_ThisIsProtected_"; # tag to recognize protected sections +$html2_doctype = ''; + +# +# language dependent constants +# +#$LDC_SEE = 'see'; +#$LDC_SECTION = 'section'; +#$LDC_IN = 'in'; +#$LDC_TOC = 'Table of Contents'; +#$LDC_GOTO = 'Go to the'; +#$LDC_FOOT = 'Footnotes'; +# TODO: @def* shortcuts + +# +# pre-defined indices +# +%predefined_index = ( + 'cp', 'c', + 'fn', 'f', + 'vr', 'v', + 'ky', 'k', + 'pg', 'p', + 'tp', 't', + ); + +# +# valid indices +# +%valid_index = ( + 'c', 1, + 'f', 1, + 'v', 1, + 'k', 1, + 'p', 1, + 't', 1, + ); + +# +# texinfo section names to level +# +%sec2level = ( + 'top', 0, + 'chapter', 1, + 'unnumbered', 1, + 'majorheading', 1, + 'chapheading', 1, + 'appendix', 1, + 'section', 2, + 'unnumberedsec', 2, + 'heading', 2, + 'appendixsec', 2, + 'appendixsection', 2, + 'subsection', 3, + 'unnumberedsubsec', 3, + 'subheading', 3, + 'appendixsubsec', 3, + 'subsubsection', 4, + 'unnumberedsubsubsec', 4, + 'subsubheading', 4, + 'appendixsubsubsec', 4, + ); + +# +# accent map, TeX command to ISO name +# +%accent_map = ( + '"', 'uml', + '~', 'tilde', + '^', 'circ', + '`', 'grave', + '\'', 'acute', + ); + +# +# texinfo "simple things" (@foo) to HTML ones +# +%simple_map = ( + # cf. makeinfo.c + "*", "
", # HTML+ + " ", " ", + "\n", "\n", + "|", "", + # spacing commands + ":", "", + "!", "!", + "?", "?", + ".", ".", + ); + +# +# texinfo "things" (@foo{}) to HTML ones +# +%things_map = ( + 'TeX', 'TeX', + 'br', '

', # paragraph break + 'bullet', '*', + 'copyright', '(C)', + 'dots', '...', + 'equiv', '==', + 'error', 'error-->', + 'expansion', '==>', + 'minus', '-', + 'point', '-!-', + 'print', '-|', + 'result', '=>', + 'today', $TODAY, + ); + +# +# texinfo styles (@foo{bar}) to HTML ones +# +%style_map = ( + 'asis', '', + 'b', 'B', + 'cite', 'CITE', + 'code', 'CODE', + 'ctrl', '&do_ctrl', # special case + 'dfn', 'STRONG', # DFN tag is illegal in the standard + 'dmn', '', # useless + 'emph', 'EM', + 'file', '"TT', # will put quotes, cf. &apply_style + 'i', 'I', + 'kbd', 'KBD', + 'key', 'KBD', + 'r', '', # unsupported + 'samp', '"SAMP', # will put quotes, cf. &apply_style + 'sc', '&do_sc', # special case + 'strong', 'STRONG', + 't', 'TT', + 'titlefont', '', # useless + 'var', 'VAR', + 'w', '', # unsupported + ); + +# +# texinfo format (@foo/@end foo) to HTML ones +# +%format_map = ( + 'display', 'PRE', + 'example', 'PRE', + 'format', 'PRE', + 'lisp', 'PRE', + 'quotation', 'BLOCKQUOTE', + 'smallexample', 'PRE', + 'smalllisp', 'PRE', + # lists + 'itemize', 'UL', + 'enumerate', 'OL', + # poorly supported + 'flushleft', 'PRE', + 'flushright', 'PRE', + ); + +# +# texinfo definition shortcuts to real ones +# +%def_map = ( + # basic commands + 'deffn', 0, + 'defvr', 0, + 'deftypefn', 0, + 'deftypevr', 0, + 'defcv', 0, + 'defop', 0, + 'deftp', 0, + # basic x commands + 'deffnx', 0, + 'defvrx', 0, + 'deftypefnx', 0, + 'deftypevrx', 0, + 'defcvx', 0, + 'defopx', 0, + 'deftpx', 0, + # shortcuts + 'defun', 'deffn Function', + 'defmac', 'deffn Macro', + 'defspec', 'deffn {Special Form}', + 'defvar', 'defvr Variable', + 'defopt', 'defvr {User Option}', + 'deftypefun', 'deftypefn Function', + 'deftypevar', 'deftypevr Variable', + 'defivar', 'defcv {Instance Variable}', + 'defmethod', 'defop Method', + # x shortcuts + 'defunx', 'deffnx Function', + 'defmacx', 'deffnx Macro', + 'defspecx', 'deffnx {Special Form}', + 'defvarx', 'defvrx Variable', + 'defoptx', 'defvrx {User Option}', + 'deftypefunx', 'deftypefnx Function', + 'deftypevarx', 'deftypevrx Variable', + 'defivarx', 'defcvx {Instance Variable}', + 'defmethodx', 'defopx Method', + ); + +# +# things to skip +# +%to_skip = ( + # comments + 'c', 1, + 'comment', 1, + # useless + 'contents', 1, + 'shortcontents', 1, + 'summarycontents', 1, + 'footnotestyle', 1, + 'end ifclear', 1, + 'end ifset', 1, + 'titlepage', 1, + 'end titlepage', 1, + # unsupported commands (formatting) + 'afourpaper', 1, + 'cropmarks', 1, + 'finalout', 1, + 'headings', 1, + 'need', 1, + 'page', 1, + 'setchapternewpage', 1, + 'everyheading', 1, + 'everyfooting', 1, + 'evenheading', 1, + 'evenfooting', 1, + 'oddheading', 1, + 'oddfooting', 1, + 'smallbook', 1, + 'vskip', 1, + 'filbreak', 1, + # unsupported formats + 'cartouche', 1, + 'end cartouche', 1, + 'group', 1, + 'end group', 1, + ); + +#+++############################################################################ +# # +# Argument parsing, initialisation # +# # +#---############################################################################ + +$use_bibliography = 1; +$use_acc = 0; +$debug = 0; +$doctype = ''; +$check = 0; +$expandinfo = 0; +$use_glossary = 0; +$invisible_mark = ''; +$use_iso = 0; +@include_dirs = (); +$show_menu = 0; +$number_sections = 0; +$split_node = 0; +$split_chapter = 0; +$monolithic = 0; +$verbose = 0; +$usage = <= 0 && $ARGV[0] =~ /^-/) { + $_ = shift(@ARGV); + if (/^-acc$/) { $use_acc = 1; next; } + if (/^-d(ebug)?(\d+)?$/) { $debug = $2 || shift(@ARGV); next; } + if (/^-doctype$/) { $doctype = shift(@ARGV); next; } + if (/^-c(heck)?$/) { $check = 1; next; } + if (/^-e(xpandinfo)?$/) { $expandinfo = 1; next; } + if (/^-g(lossary)?$/) { $use_glossary = 1; next; } + if (/^-i(nvisible)?$/) { $invisible_mark = shift(@ARGV); next; } + if (/^-iso$/) { $use_iso = 1; next; } + if (/^-I(.+)?$/) { push(@include_dirs, $1 || shift(@ARGV)); next; } + if (/^-m(enu)?$/) { $show_menu = 1; next; } + if (/^-mono(lithic)?$/) { $monolithic = 1; next; } + if (/^-n(umber)?$/) { $number_sections = 1; next; } + if (/^-s(plit)?_?(n(ode)?|c(hapter)?)?$/) { + if ($2 =~ /^n/) { + $split_node = 1; + } else { + $split_chapter = 1; + } + next; + } + if (/^-v(erbose)?$/) { $verbose = 1; next; } + die $usage; +} +if ($check) { + die $usage unless @ARGV > 0; + ✓ + exit; +} + +if (($split_node || $split_chapter) && $monolithic) { + warn "Can't use -monolithic with -split, -monolithic ignored.\n"; + $monolithic = 0; +} +if ($expandinfo) { + $to_skip{'ifinfo'}++; + $to_skip{'end ifinfo'}++; +} else { + $to_skip{'iftex'}++; + $to_skip{'end iftex'}++; +} +$invisible_mark = '' if $invisible_mark eq 'xbm'; +die $usage unless @ARGV == 1; +$docu = shift(@ARGV); +if ($docu =~ /.*\//) { + chop($docu_dir = $&); + $docu_name = $'; +} else { + $docu_dir = '.'; + $docu_name = $docu; +} +unshift(@include_dirs, $docu_dir); +$docu_name =~ s/\.te?x(i|info)?$//; # basename of the document + +$docu_doc = "$docu_name.html"; # document's contents +if ($monolithic) { + $docu_toc = $docu_foot = $docu_doc; +} else { + $docu_toc = "${docu_name}_toc.html"; # document's table of contents + $docu_foot = "${docu_name}_foot.html"; # document's footnotes +} + +# +# variables +# +%value = (); # hold texinfo variables +$value{'html'} = 1; # predefine html (the output format) +$value{'texi2html'} = '1.51'; # predefine texi2html (the translator) +# _foo: internal to track @foo +foreach ('_author', '_title', '_subtitle', + '_settitle', '_setfilename') { + $value{$_} = ''; # prevent -w warnings +} +%node2sec = (); # node to section name +%node2href = (); # node to HREF +%bib2href = (); # bibliography reference to HREF +%gloss2href = (); # glossary term to HREF +@sections = (); # list of sections +%tag2pro = (); # protected sections + +# +# initial indexes +# +$bib_num = 0; +$foot_num = 0; +$gloss_num = 0; +$idx_num = 0; +$sec_num = 0; +$doc_num = 0; +$html_num = 0; + +# +# can I use ISO8879 characters? (HTML+) +# +if ($use_iso) { + $things_map{'bullet'} = "•"; + $things_map{'copyright'} = "©"; + $things_map{'dots'} = "…"; + $things_map{'equiv'} = "≡"; + $things_map{'expansion'} = "→"; + $things_map{'point'} = "∗"; + $things_map{'result'} = "⇒"; +} + +# +# read texi2html extensions (if any) +# +$extensions = 'texi2html.ext'; # extensions in working directory +if (-f $extensions) { + print "# reading extensions from $extensions\n" if $verbose; + require($extensions); +} +($progdir = $0) =~ s/[^\/]+$//; +if ($progdir && ($progdir ne './')) { + $extensions = "${progdir}texi2html.ext"; # extensions in texi2html directory + if (-f $extensions) { + print "# reading extensions from $extensions\n" if $verbose; + require($extensions); + } +} + +print "# reading from $docu\n" if $verbose; + +#+++############################################################################ +# # +# Pass 1: read source, handle command, variable, simple substitution # +# # +#---############################################################################ + +@lines = (); # whole document +@toc_lines = (); # table of contents +$toplevel = 0; # top level seen in hierarchy +$curlevel = 0; # current level in TOC +$node = ''; # current node name +$in_table = 0; # am I inside a table +$table_type = ''; # type of table ('', 'f', 'v') +@tables = (); # nested table support +$in_bibliography = 0; # am I inside a bibliography +$in_glossary = 0; # am I inside a glossary +$in_top = 0; # am I inside the top node +$in_pre = 0; # am I inside a preformatted section +$in_list = 0; # am I inside a list +$in_html = 0; # am I inside an HTML section +$first_line = 1; # is it the first line +$dont_html = 0; # don't protect HTML on this line +$split_num = 0; # split index +$deferred_ref = ''; # deferred reference for indexes +@html_stack = (); # HTML elements stack +$html_element = ''; # current HTML element +&html_reset; + +# build code for simple substitutions +# the maps used (%simple_map and %things_map) MUST be aware of this +# watch out for regexps, / and escaped characters! +$subst_code = ''; +foreach (keys(%simple_map)) { + ($re = $_) =~ s/(\W)/\\$1/g; # protect regexp chars + $subst_code .= "s/\\\@$re/$simple_map{$_}/g;\n"; +} +foreach (keys(%things_map)) { + $subst_code .= "s/\\\@$_\\{\\}/$things_map{$_}/g;\n"; +} +if ($use_acc) { + # accentuated characters + foreach (keys(%accent_map)) { + if ($_ eq "`") { + $subst_code .= "s/$;3"; + } elsif ($_ eq "'") { + $subst_code .= "s/$;4"; + } else { + $subst_code .= "s/\\\@\\$_"; + } + $subst_code .= "([aeiou])/&\${1}$accent_map{$_};/gi;\n"; + } +} +eval("sub simple_substitutions { $subst_code }"); + +&init_input; +while ($_ = &next_line) { + # + # remove \input on the first lines only + # + if ($first_line) { + next if /^\\input/; + $first_line = 0; + } + # + # parse texinfo tags + # + $tag = ''; + $end_tag = ''; + if (/^\@end\s+(\w+)\b/) { + $end_tag = $1; + } elsif (/^\@(\w+)\b/) { + $tag = $1; + } + # + # handle @ifhtml / @end ifhtml + # + if ($in_html) { + if ($end_tag eq 'ifhtml') { + $in_html = 0; + } else { + $tag2pro{$in_html} .= $_; + } + next; + } elsif ($tag eq 'ifhtml') { + $in_html = $PROTECTTAG . ++$html_num; + push(@lines, $in_html); + next; + } + # + # try to skip the line + # + if ($end_tag) { + next if $to_skip{"end $end_tag"}; + } elsif ($tag) { + next if $to_skip{$tag}; + last if $tag eq 'bye'; + } + if ($in_top) { + # parsing the top node + if ($tag eq 'node' || $tag eq 'include' || $sec2level{$tag}) { + # no more in top + $in_top = 0; + } else { + # skip it + next; + } + } + # + # try to remove inlined comments + # syntax from tex-mode.el comment-start-skip + # + s/((^|[^\@])(\@\@)*)\@c(omment)? .*/$1/; + # non-@ substitutions cf. texinfmt.el + s/``/\"/g; + s/''/\"/g; + s/([\w ])---([\w ])/$1--$2/g; + # + # analyze the tag + # + if ($tag) { + # skip lines + &skip_until($tag), next if $tag eq 'ignore'; + if ($expandinfo) { + &skip_until($tag), next if $tag eq 'iftex'; + } else { + &skip_until($tag), next if $tag eq 'ifinfo'; + } + &skip_until($tag), next if $tag eq 'tex'; + # handle special tables + if ($tag eq 'table') { + $table_type = ''; + } elsif ($tag eq 'ftable') { + $tag = 'table'; + $table_type = 'f'; + } elsif ($tag eq 'vtable') { + $tag = 'table'; + $table_type = 'v'; + } + # special cases + if ($tag eq 'top' || ($tag eq 'node' && /^\@node\s+top\s*,/i)) { + $in_top = 1; + @lines = (); # ignore all lines before top (title page garbage) + next; + } elsif ($tag eq 'node') { + $in_top = 0; + warn "$ERROR Bad node line: $_" unless $_ =~ /^\@node\s$NODESRE$/o; + $_ = &protect_html($_); # if node contains '&' for instance + s/^\@node\s+//; + ($node) = split(/,/); + &normalise_node($node); + if ($split_node) { + &next_doc; + push(@lines, $SPLITTAG) if $split_num++; + push(@sections, $node); + } + next; + } elsif ($tag eq 'include') { + if (/^\@include\s+($FILERE)\s*$/o) { + $file = $1; + unless (-e $file) { + foreach $dir (@include_dirs) { + $file = "$dir/$1"; + last if -e $file; + } + } + if (-e $file) { + &open($file); + print "# including $file\n" if $verbose; + } else { + warn "$ERROR Can't find $file, skipping"; + } + } else { + warn "$ERROR Bad include line: $_"; + } + next; + } elsif ($tag eq 'ifclear') { + if (/^\@ifclear\s+($VARRE)\s*$/o) { + next unless defined($value{$1}); + &skip_until($tag); + } else { + warn "$ERROR Bad ifclear line: $_"; + } + next; + } elsif ($tag eq 'ifset') { + if (/^\@ifset\s+($VARRE)\s*$/o) { + next if defined($value{$1}); + &skip_until($tag); + } else { + warn "$ERROR Bad ifset line: $_"; + } + next; + } elsif ($tag eq 'menu') { + unless ($show_menu) { + &skip_until($tag); + next; + } + &html_push_if($tag); + push(@lines, &html_debug("\n", __LINE__)); + } elsif ($format_map{$tag}) { + $in_pre = 1 if $format_map{$tag} eq 'PRE'; + &html_push_if($format_map{$tag}); + push(@lines, &html_debug("\n", __LINE__)); + $in_list++ if $format_map{$tag} eq 'UL' || $format_map{$tag} eq 'OL' ; + push(@lines, &debug("<$format_map{$tag}>\n", __LINE__)); + next; + } elsif ($tag eq 'table') { + if (/^\@[fv]?table\s+\@(\w+)\s*$/) { + $in_table = $1; + unshift(@tables, join($;, $table_type, $in_table)); + push(@lines, &debug("

\n", __LINE__)); + &html_push_if('DL'); + push(@lines, &html_debug("\n", __LINE__)); + } else { + warn "$ERROR Bad table line: $_"; + } + next; + } elsif ($tag eq 'synindex' || $tag eq 'syncodeindex') { + if (/^\@$tag\s+(\w)\w\s+(\w)\w\s*$/) { + eval("*${1}index = *${2}index"); + } else { + warn "$ERROR Bad syn*index line: $_"; + } + next; + } elsif ($tag eq 'sp') { + push(@lines, &debug("

\n", __LINE__)); + next; + } elsif ($tag eq 'setref') { + &protect_html; # if setref contains '&' for instance + if (/^\@$tag\s*{($NODERE)}\s*$/) { + $setref = $1; + $setref =~ s/\s+/ /g; # normalize + $setref =~ s/ $//; + $node2sec{$setref} = $name; + $node2href{$setref} = "$docu_doc#$docid"; + } else { + warn "$ERROR Bad setref line: $_"; + } + next; + } elsif ($tag eq 'defindex' || $tag eq 'defcodeindex') { + if (/^\@$tag\s+(\w\w)\s*$/) { + $valid_index{$1} = 1; + } else { + warn "$ERROR Bad defindex line: $_"; + } + next; + } elsif (defined($def_map{$tag})) { + if ($def_map{$tag}) { + s/^\@$tag\s+//; + $tag = $def_map{$tag}; + $_ = "\@$tag $_"; + $tag =~ s/\s.*//; + } + } elsif (defined($user_sub{$tag})) { + s/^\@$tag\s+//; + $sub = $user_sub{$tag}; + print "# user $tag = $sub, arg: $_" if $debug & $DEBUG_USER; + if (defined(&$sub)) { + chop($_); + &$sub($_); + } else { + warn "$ERROR Bad user sub for $tag: $sub\n"; + } + next; + } + if (defined($def_map{$tag})) { + s/^\@$tag\s+//; + if ($tag =~ /x$/) { + # extra definition line + $tag = $`; + $is_extra = 1; + } else { + $is_extra = 0; + } + while (/\{([^\{\}]*)\}/) { + # this is a {} construct + ($before, $contents, $after) = ($`, $1, $'); + # protect spaces + $contents =~ s/\s+/$;9/g; + # restore $_ protecting {} + $_ = "$before$;7$contents$;8$after"; + } + @args = split(/\s+/, &protect_html($_)); + foreach (@args) { + s/$;9/ /g; # unprotect spaces + s/$;7/\{/g; # ... { + s/$;8/\}/g; # ... } + } + $type = shift(@args); + $type =~ s/^\{(.*)\}$/$1/; + print "# def ($tag): {$type} ", join(', ', @args), "\n" + if $debug & $DEBUG_DEF; + $type .= ':'; # it's nicer like this + $name = shift(@args); + $name =~ s/^\{(.*)\}$/$1/; + if ($is_extra) { + $_ = &debug("

", __LINE__); + } else { + $_ = &debug("
\n
", __LINE__); + } + if ($tag eq 'deffn' || $tag eq 'defvr' || $tag eq 'deftp') { + $_ .= "$type $name"; + $_ .= " @args" if @args; + } elsif ($tag eq 'deftypefn' || $tag eq 'deftypevr' + || $tag eq 'defcv' || $tag eq 'defop') { + $ftype = $name; + $name = shift(@args); + $name =~ s/^\{(.*)\}$/$1/; + $_ .= "$type $ftype $name"; + $_ .= " @args" if @args; + } else { + warn "$ERROR Unknown definition type: $tag\n"; + $_ .= "$type $name"; + $_ .= " @args" if @args; + } + $_ .= &debug("\n
", __LINE__); + $name = &unprotect_html($name); + if ($tag eq 'deffn' || $tag eq 'deftypefn') { + unshift(@input_spool, "\@findex $name\n"); + } elsif ($tag eq 'defop') { + unshift(@input_spool, "\@findex $name on $ftype\n"); + } elsif ($tag eq 'defvr' || $tag eq 'deftypevr' || $tag eq 'defcv') { + unshift(@input_spool, "\@vindex $name\n"); + } else { + unshift(@input_spool, "\@tindex $name\n"); + } + $dont_html = 1; + } + } elsif ($end_tag) { + if ($format_map{$end_tag}) { + $in_pre = 0 if $format_map{$end_tag} eq 'PRE'; + $in_list-- if $format_map{$end_tag} eq 'UL' || $format_map{$end_tag} eq 'OL' ; + &html_pop_if('LI', 'P'); + &html_pop_if(); + push(@lines, &debug("\n", __LINE__)); + push(@lines, &html_debug("\n", __LINE__)); + } elsif ($end_tag eq 'table' || + $end_tag eq 'ftable' || + $end_tag eq 'vtable') { + shift(@tables); + if (@tables) { + ($table_type, $in_table) = split($;, $tables[0]); + } else { + $in_table = 0; + } + push(@lines, "
\n"); + &html_pop_if('DD'); + &html_pop_if(); + } elsif (defined($def_map{$end_tag})) { + push(@lines, &debug("
\n", __LINE__)); + } elsif ($end_tag eq 'menu') { + &html_pop_if(); + push(@lines, $_); # must keep it for pass 2 + } + next; + } + # + # misc things + # + # protect texi and HTML things + &protect_texi; + $_ = &protect_html($_) unless $dont_html; + $dont_html = 0; + # substitution (unsupported things) + s/^\@center\s+//g; + s/^\@exdent\s+//g; + s/\@noindent\s+//g; + s/\@refill\s+//g; + # other substitutions + &simple_substitutions; + s/\@value{($VARRE)}/$value{$1}/eg; + s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4 + # + # analyze the tag again + # + if ($tag) { + if (defined($sec2level{$tag}) && $sec2level{$tag} > 0) { + if (/^\@$tag\s+(.+)$/) { + $name = $1; + $name =~ s/\s+$//; + $level = $sec2level{$tag}; + $name = &update_sec_num($tag, $level) . " $name" + if $number_sections && $tag !~ /^unnumbered/; + if ($tag =~ /heading$/) { + push(@lines, &html_debug("\n", __LINE__)); + if ($html_element ne 'body') { + # We are in a nice pickle here. We are trying to get a H? heading + # even though we are not in the body level. So, we convert it to a + # nice, bold, line by itself. + $_ = &debug("\n\n

$name

\n\n", __LINE__); + } else { + $_ = &debug("$name\n", __LINE__); + &html_push_if('body'); + } + print "# heading, section $name, level $level\n" + if $debug & $DEBUG_TOC; + } else { + if ($split_chapter) { + unless ($toplevel) { + # first time we see a "section" + unless ($level == 1) { + warn "$ERROR The first section found is not of level 1: $_"; + warn "$ERROR I'll split on sections of level $level...\n"; + } + $toplevel = $level; + } + if ($level == $toplevel) { + &next_doc; + push(@lines, $SPLITTAG) if $split_num++; + push(@sections, $name); + } + } + $sec_num++; + $docid = "SEC$sec_num"; + $tocid = "TOC$sec_num"; + # check biblio and glossary + $in_bibliography = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*bibliography$/i); + $in_glossary = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*glossary$/i); + # check node + if ($node) { + if ($node2sec{$node}) { + warn "$ERROR Duplicate node found: $node\n"; + } else { + $node2sec{$node} = $name; + $node2href{$node} = "$docu_doc#$docid"; + print "# node $node, section $name, level $level\n" + if $debug & $DEBUG_TOC; + } + $node = ''; + } else { + print "# no node, section $name, level $level\n" + if $debug & $DEBUG_TOC; + } + # update TOC + while ($level > $curlevel) { + $curlevel++; + push(@toc_lines, "
    \n"); + } + while ($level < $curlevel) { + $curlevel--; + push(@toc_lines, "
\n"); + } + $_ = "
  • " . &anchor($tocid, "$docu_doc#$docid", $name, 1); + push(@toc_lines, &substitute_style($_)); + # update DOC + push(@lines, &html_debug("\n", __LINE__)); + &html_reset; + $_ = "".&anchor($docid, "$docu_toc#$tocid", $name)."\n"; + $_ = &debug($_, __LINE__); + push(@lines, &html_debug("\n", __LINE__)); + } + # update DOC + foreach $line (split(/\n+/, $_)) { + push(@lines, "$line\n"); + } + next; + } else { + warn "$ERROR Bad section line: $_"; + } + } else { + # track variables + $value{$1} = $2, next if /^\@set\s+($VARRE)\s+(.*)$/o; + delete $value{$1}, next if /^\@clear\s+($VARRE)\s*$/o; + # store things + $value{'_setfilename'} = $1, next if /^\@setfilename\s+(.*)$/; + $value{'_settitle'} = $1, next if /^\@settitle\s+(.*)$/; + $value{'_author'} .= "$1\n", next if /^\@author\s+(.*)$/; + $value{'_subtitle'} .= "$1\n", next if /^\@subtitle\s+(.*)$/; + $value{'_title'} .= "$1\n", next if /^\@title\s+(.*)$/; + # index + if (/^\@(..?)index\s+/) { + unless ($valid_index{$1}) { + warn "$ERROR Undefined index command: $_"; + next; + } + $id = 'IDX' . ++$idx_num; + $index = $1 . 'index'; + $what = &substitute_style($'); + $what =~ s/\s+$//; + print "# found $index for '$what' id $id\n" + if $debug & $DEBUG_INDEX; + eval(<\n", __LINE__)); + push(@lines, &anchor($id, '', $invisible_mark, !$in_pre)); + &html_push('P'); + } elsif ($html_element eq 'DL' || + $html_element eq 'UL' || + $html_element eq 'OL' ) { + $deferred_ref .= &anchor($id, '', $invisible_mark, !$in_pre) . " "; + } + next; + } + # list item + if (/^\@itemx?\s+/) { + $what = $'; + $what =~ s/\s+$//; + if ($in_bibliography && $use_bibliography) { + if ($what =~ /^$BIBRE$/o) { + $id = 'BIB' . ++$bib_num; + $bib2href{$what} = "$docu_doc#$id"; + print "# found bibliography for '$what' id $id\n" + if $debug & $DEBUG_BIB; + $what = &anchor($id, '', $what); + } + } elsif ($in_glossary && $use_glossary) { + $id = 'GLOSS' . ++$gloss_num; + $entry = $what; + $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/; + $gloss2href{$entry} = "$docu_doc#$id"; + print "# found glossary for '$entry' id $id\n" + if $debug & $DEBUG_GLOSS; + $what = &anchor($id, '', $what); + } + &html_pop_if('P'); + if ($html_element eq 'DL' || $html_element eq 'DD') { + if ($things_map{$in_table} && !$what) { + # special case to allow @table @bullet for instance + push(@lines, &debug("
    $things_map{$in_table}\n", __LINE__)); + } else { + push(@lines, &debug("
    \@$in_table\{$what\}\n", __LINE__)); + } + push(@lines, "
    "); + &html_push('DD') unless $html_element eq 'DD'; + if ($table_type) { # add also an index + unshift(@input_spool, "\@${table_type}index $what\n"); + } + } else { + push(@lines, &debug("
  • $what\n", __LINE__)); + &html_push('LI') unless $html_element eq 'LI'; + } + push(@lines, &html_debug("\n", __LINE__)); + if ($deferred_ref) { + push(@lines, &debug("$deferred_ref\n", __LINE__)); + $deferred_ref = ''; + } + next; + } + } + } + # paragraph separator + if ($_ eq "\n") { + next if $#lines >= 0 && $lines[$#lines] eq "\n"; + if ($html_element eq 'P') { + push(@lines, "\n"); + $_ = &debug("

    \n", __LINE__); + &html_pop; + } + } elsif ($html_element eq 'body' || $html_element eq 'BLOCKQUOTE') { + push(@lines, "

    \n"); + &html_push('P'); + $_ = &debug($_, __LINE__); + } + # otherwise + push(@lines, $_); +} + +# finish TOC +$level = 0; +while ($level < $curlevel) { + $curlevel--; + push(@toc_lines, "\n"); +} + +print "# end of pass 1\n" if $verbose; + +#+++############################################################################ +# # +# Pass 2/3: handle style, menu, index, cross-reference # +# # +#---############################################################################ + +@lines2 = (); # whole document (2nd pass) +@lines3 = (); # whole document (3rd pass) +$in_menu = 0; # am I inside a menu + +while (@lines) { + $_ = shift(@lines); + # + # special case (protected sections) + # + if (/^$PROTECTTAG/o) { + push(@lines2, $_); + next; + } + # + # menu + # + $in_menu = 1, push(@lines2, &debug("

      \n", __LINE__)), next if /^\@menu\b/; + $in_menu = 0, push(@lines2, &debug("
    \n", __LINE__)), next if /^\@end\s+menu\b/; + if ($in_menu) { + if (/^\*\s+($NODERE)::/o) { + $descr = $'; + chop($descr); + &menu_entry($1, $1, $descr); + } elsif (/^\*\s+(.+):\s+([^\t,\.\n]+)[\t,\.\n]/) { + $descr = $'; + chop($descr); + &menu_entry($1, $2, $descr); + } elsif (/^\*/) { + warn "$ERROR Bad menu line: $_"; + } else { # description continued? + push(@lines2, $_); + } + next; + } + # + # printindex + # + if (/^\@printindex\s+(\w\w)\b/) { + local($index, *ary, @keys, $key, $letter, $last_letter, @refs); + if ($predefined_index{$1}) { + $index = $predefined_index{$1} . 'index'; + } else { + $index = $1 . 'index'; + } + eval("*ary = *$index"); + @keys = keys(%ary); + foreach $key (@keys) { + $_ = $key; + 1 while s/<(\w+)>\`(.*)\'<\/\1>/$2/; # remove HTML tags with quotes + 1 while s/<(\w+)>(.*)<\/\1>/$2/; # remove HTML tags + $_ = &unprotect_html($_); + &unprotect_texi; + tr/A-Z/a-z/; # lowercase + $key2alpha{$key} = $_; + print "# index $key sorted as $_\n" + if $key ne $_ && $debug & $DEBUG_INDEX; + } + $last_letter = undef; + foreach $key (sort byalpha @keys) { + $letter = substr($key2alpha{$key}, 0, 1); + $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;; + if (!defined($last_letter) || $letter ne $last_letter) { + push(@lines2, "\n") if defined($last_letter); + push(@lines2, "

    " . &protect_html($letter) . "

    \n"); + push(@lines2, "\n"); + $last_letter = $letter; + } + @refs = (); + foreach (split(/$;/, $ary{$key})) { + push(@refs, &anchor('', $_, $key, 0)); + } + push(@lines2, "
  • " . join(", ", @refs) . "\n"); + } + push(@lines2, "
  • \n") if defined($last_letter); + next; + } + # + # simple style substitutions + # + $_ = &substitute_style($_); + # + # xref + # + while (/\@(x|px|info|)ref{($XREFRE)(}?)/o) { + # note: Texinfo may accept other characters + ($type, $nodes, $full) = ($1, $2, $3); + ($before, $after) = ($`, $'); + if (! $full && $after) { + warn "$ERROR Bad xref (no ending } on line): $_"; + $_ = "$before$;0${type}ref\{$nodes$after"; + next; # while xref + } + if ($type eq 'x') { + $type = 'See '; + } elsif ($type eq 'px') { + $type = 'see '; + } elsif ($type eq 'info') { + $type = 'See Info'; + } else { + $type = ''; + } + unless ($full) { + $next = shift(@lines); + $next = &substitute_style($next); + chop($nodes); # remove final newline + if ($next =~ /\}/) { # split on 2 lines + $nodes .= " $`"; + $after = $'; + } else { + $nodes .= " $next"; + $next = shift(@lines); + $next = &substitute_style($next); + chop($nodes); + if ($next =~ /\}/) { # split on 3 lines + $nodes .= " $`"; + $after = $'; + } else { + warn "$ERROR Bad xref (no ending }): $_"; + $_ = "$before$;0xref\{$nodes$after"; + unshift(@lines, $next); + next; # while xref + } + } + } + $nodes =~ s/\s+/ /g; # remove useless spaces + @args = split(/\s*,\s*/, $nodes); + $node = $args[0]; # the node is always the first arg + &normalise_node($node); + $sec = $node2sec{$node}; + if (@args == 5) { # reference to another manual + $sec = $args[2] || $node; + $man = $args[4] || $args[3]; + $_ = "${before}${type}section `$sec' in \@cite{$man}$after"; + } elsif ($type =~ /Info/) { # inforef + warn "$ERROR Wrong number of arguments: $_" unless @args == 3; + ($nn, $_, $in) = @args; + $_ = "${before}${type} file `$in', node `$nn'$after"; + } elsif ($sec) { + $href = $node2href{$node}; + $_ = "${before}${type}section " . &anchor('', $href, $sec) . $after; + } else { + warn "$ERROR Undefined node ($node): $_"; + $_ = "$before$;0xref{$nodes}$after"; + } + } + # + # try to guess bibliography references or glossary terms + # + unless (/^/) { + $done .= $pre . &anchor('', $href, $what); + } else { + $done .= "$pre$what"; + } + $_ = $post; + } + $_ = $done . $_; + } + if ($use_glossary) { + $done = ''; + while (/\b\w+\b/) { + ($pre, $what, $post) = ($`, $&, $'); + $entry = $what; + $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/; + $href = $gloss2href{$entry}; + if (defined($href) && $post !~ /^[^<]*<\/A>/) { + $done .= $pre . &anchor('', $href, $what); + } else { + $done .= "$pre$what"; + } + $_ = $post; + } + $_ = $done . $_; + } + } + # otherwise + push(@lines2, $_); +} +print "# end of pass 2\n" if $verbose; + +# +# split style substitutions +# +while (@lines2) { + $_ = shift(@lines2); + # + # special case (protected sections) + # + if (/^$PROTECTTAG/o) { + push(@lines3, $_); + next; + } + # + # split style substitutions + # + $old = ''; + while ($old ne $_) { + $old = $_; + if (/\@(\w+)\{/) { + ($before, $style, $after) = ($`, $1, $'); + if (defined($style_map{$style})) { + $_ = $after; + $text = ''; + $after = ''; + $failed = 1; + while (@lines2) { + if (/\}/) { + $text .= $`; + $after = $'; + $failed = 0; + last; + } else { + $text .= $_; + $_ = shift(@lines2); + } + } + if ($failed) { + die "* Bad syntax (\@$style) after: $before\n"; + } else { + $text = &apply_style($style, $text); + $_ = "$before$text$after"; + } + } + } + } + # otherwise + push(@lines3, $_); +} +print "# end of pass 3\n" if $verbose; + +#+++############################################################################ +# # +# Pass 4: foot notes, final cleanup # +# # +#---############################################################################ + +@foot_lines = (); # footnotes +@doc_lines = (); # final document +$end_of_para = 0; # true if last line is

    + +while (@lines3) { + $_ = shift(@lines3); + # + # special case (protected sections) + # + if (/^$PROTECTTAG/o) { + push(@doc_lines, $_); + $end_of_para = 0; + next; + } + # + # footnotes + # + while (/\@footnote([^\{\s]+)\{/) { + ($before, $d, $after) = ($`, $1, $'); + $_ = $after; + $text = ''; + $after = ''; + $failed = 1; + while (@lines3) { + if (/\}/) { + $text .= $`; + $after = $'; + $failed = 0; + last; + } else { + $text .= $_; + $_ = shift(@lines3); + } + } + if ($failed) { + die "* Bad syntax (\@footnote) after: $before\n"; + } else { + $foot_num++; + $docid = "DOCF$foot_num"; + $footid = "FOOT$foot_num"; + $foot = "($foot_num)"; + push(@foot_lines, "

    " . &anchor($footid, "$d#$docid", $foot) . "

    \n"); + $text = "

    $text" unless $text =~ /^\s*

    /; + push(@foot_lines, "$text\n"); + $_ = $before . &anchor($docid, "$docu_foot#$footid", $foot) . $after; + } + } + # + # remove unnecessary

    + # + if (/^\s*

    \s*$/) { + next if $end_of_para++; + } else { + $end_of_para = 0; + } + # otherwise + push(@doc_lines, $_); +} +print "# end of pass 4\n" if $verbose; + +#+++############################################################################ +# # +# Pass 5: print things # +# # +#---############################################################################ + +$header = < +EOT + +$full_title = $value{'_title'} || $value{'_settitle'} || "Untitled Document"; +$title = $value{'_settitle'} || $full_title; +$_ = &substitute_style($full_title); +&unprotect_texi; +s/\n$//; # rmv last \n (if any) +$full_title = "

    " . join("

    \n

    ", split(/\n/, $_)) . "

    \n"; + +# +# print ToC +# +if (!$monolithic && @toc_lines) { + if (open(FILE, "> $docu_toc")) { + print "# creating $docu_toc...\n" if $verbose; + &print_toplevel_header("$title - Table of Contents"); + &print_ruler; + &print(*toc_lines, FILE); + &print_toplevel_footer; + close(FILE); + } else { + warn "$ERROR Can't write to $docu_toc: $!\n"; + } +} + +# +# print footnotes +# +if (!$monolithic && @foot_lines) { + if (open(FILE, "> $docu_foot")) { + print "# creating $docu_foot...\n" if $verbose; + &print_toplevel_header("$title - Footnotes"); + &print_ruler; + &print(*foot_lines, FILE); + &print_toplevel_footer; + close(FILE); + } else { + warn "$ERROR Can't write to $docu_foot: $!\n"; + } +} + +# +# print document +# +if ($split_chapter || $split_node) { # split + $doc_num = 0; + $last_num = scalar(@sections); + $first_doc = &doc_name(1); + $last_doc = &doc_name($last_num); + while (@sections) { + $section = shift(@sections); + &next_doc; + if (open(FILE, "> $docu_doc")) { + print "# creating $docu_doc...\n" if $verbose; + &print_header("$title - $section"); + $prev_doc = ($doc_num == 1 ? undef : &doc_name($doc_num - 1)); + $next_doc = ($doc_num == $last_num ? undef : &doc_name($doc_num + 1)); + $navigation = "Go to the "; + $navigation .= ($prev_doc ? &anchor('', $first_doc, "first") : "first"); + $navigation .= ", "; + $navigation .= ($prev_doc ? &anchor('', $prev_doc, "previous") : "previous"); + $navigation .= ", "; + $navigation .= ($next_doc ? &anchor('', $next_doc, "next") : "next"); + $navigation .= ", "; + $navigation .= ($next_doc ? &anchor('', $last_doc, "last") : "last"); + $navigation .= " section, " . &anchor('', $docu_toc, "table of contents") . ".\n"; + print FILE $navigation; + &print_ruler; + # find corresponding lines + @tmp_lines = (); + while (@doc_lines) { + $_ = shift(@doc_lines); + last if ($_ eq $SPLITTAG); + push(@tmp_lines, $_); + } + &print(*tmp_lines, FILE); + &print_ruler; + print FILE $navigation; + &print_footer; + close(FILE); + } else { + warn "$ERROR Can't write to $docu_doc: $!\n"; + } + } +} else { # not split + if (open(FILE, "> $docu_doc")) { + print "# creating $docu_doc...\n" if $verbose; + if ($monolithic || !@toc_lines) { + &print_toplevel_header($title); + } else { + &print_header($title); + print FILE $full_title; + } + if ($monolithic && @toc_lines) { + &print_ruler; + print FILE "

    Table of Contents

    \n"; + &print(*toc_lines, FILE); + } + &print_ruler; + &print(*doc_lines, FILE); + if ($monolithic && @foot_lines) { + &print_ruler; + print FILE "

    Footnotes

    \n"; + &print(*foot_lines, FILE); + } + if ($monolithic || !@toc_lines) { + &print_toplevel_footer; + } else { + &print_footer; + } + close(FILE); + } else { + warn "$ERROR Can't write to $docu_doc: $!\n"; + } +} + +print "# that's all folks\n" if $verbose; + +#+++############################################################################ +# # +# Low level functions # +# # +#---############################################################################ + +sub update_sec_num { + local($name, $level) = @_; + + $level--; # here we start at 0 + if ($name =~ /^appendix/) { + # appendix style + if (defined(@appendix_sec_num)) { + &incr_sec_num($level, @appendix_sec_num); + } else { + @appendix_sec_num = ('A', 0, 0, 0); + } + return(join('.', @appendix_sec_num[0..$level])); + } else { + # normal style + if (defined(@normal_sec_num)) { + &incr_sec_num($level, @normal_sec_num); + } else { + @normal_sec_num = (1, 0, 0, 0); + } + return(join('.', @normal_sec_num[0..$level])); + } +} + +sub incr_sec_num { + local($level, $l); + $level = shift(@_); + $_[$level]++; + foreach $l ($level+1 .. 3) { + $_[$l] = 0; + } +} + +sub check { + local($_, %seen, %context, $before, $match, $after); + + while (<>) { + if (/\@(\*|\.|\:|\@|\{|\})/) { + $seen{$&}++; + $context{$&} .= "> $_" if $verbose; + $_ = "$`XX$'"; + redo; + } + if (/\@(\w+)/) { + ($before, $match, $after) = ($`, $&, $'); + if ($before =~ /\b[\w-]+$/ && $after =~ /^[\w-.]*\b/) { # e-mail address + $seen{'e-mail address'}++; + $context{'e-mail address'} .= "> $_" if $verbose; + } else { + $seen{$match}++; + $context{$match} .= "> $_" if $verbose; + } + $match =~ s/^\@/X/; + $_ = "$before$match$after"; + redo; + } + } + + foreach (sort(keys(%seen))) { + if ($verbose) { + print "$_\n"; + print $context{$_}; + } else { + print "$_ ($seen{$_})\n"; + } + } +} + +sub open { + local($name) = @_; + + ++$fh_name; + if (open($fh_name, $name)) { + unshift(@fhs, $fh_name); + } else { + warn "$ERROR Can't read file $name: $!\n"; + } +} + +sub init_input { + @fhs = (); # hold the file handles to read + @input_spool = (); # spooled lines to read + $fh_name = 'FH000'; + &open($docu); +} + +sub next_line { + local($fh, $line); + + if (@input_spool) { + $line = shift(@input_spool); + return($line); + } + while (@fhs) { + $fh = $fhs[0]; + $line = <$fh>; + return($line) if $line; + close($fh); + shift(@fhs); + } + return(undef); +} + +# used in pass 1, use &next_line +sub skip_until { + local($tag) = @_; + local($_); + + while ($_ = &next_line) { + return if /^\@end\s+$tag\s*$/; + } + die "* Failed to find '$tag' after: " . $lines[$#lines]; +} + +# +# HTML stacking to have a better HTML output +# + +sub html_reset { + @html_stack = ('html'); + $html_element = 'body'; +} + +sub html_push { + local($what) = @_; + push(@html_stack, $html_element); + $html_element = $what; +} + +sub html_push_if { + local($what) = @_; + push(@html_stack, $html_element) + if ($html_element && $html_element ne 'P'); + $html_element = $what; +} + +sub html_pop { + $html_element = pop(@html_stack); +} + +sub html_pop_if { + local($elt); + + if (@_) { + foreach $elt (@_) { + if ($elt eq $html_element) { + $html_element = pop(@html_stack) if @html_stack; + last; + } + } + } else { + $html_element = pop(@html_stack) if @html_stack; + } +} + +sub html_debug { + local($what, $line) = @_; + return("$what") + if $debug & $DEBUG_HTML; + return($what); +} + +# to debug the output... +sub debug { + local($what, $line) = @_; + return("$what") + if $debug & $DEBUG_HTML; + return($what); +} + +sub normalise_node { + $_[0] =~ s/\s+/ /g; + $_[0] =~ s/ $//; + $_[0] =~ s/^ //; +} + +sub menu_entry { + local($entry, $node, $descr) = @_; + local($href); + + &normalise_node($node); + $href = $node2href{$node}; + if ($href) { + $descr =~ s/^\s+//; + $descr = ": $descr" if $descr; + push(@lines2, "
  • " . &anchor('', $href, $entry) . "$descr\n"); + } else { + warn "$ERROR Undefined node ($node): $_"; + } +} + +sub do_ctrl { "^$_[0]" } + +sub do_sc { "\U$_[0]\E" } + +sub apply_style { + local($texi_style, $text) = @_; + local($style); + + $style = $style_map{$texi_style}; + if (defined($style)) { # known style + if ($style =~ /^\"/) { # add quotes + $style = $'; + $text = "\`$text\'"; + } + if ($style =~ /^\&/) { # custom + $style = $'; + $text = &$style($text); + } elsif ($style) { # good style + $text = "<$style>$text"; + } else { # no style + } + } else { # unknown style + $text = undef; + } + return($text); +} + +# remove Texinfo styles +sub remove_style { + local($_) = @_; + s/\@\w+{([^\{\}]+)}/$1/g; + return($_); +} + +sub substitute_style { + local($_) = @_; + local($changed, $done, $style, $text); + + $changed = 1; + while ($changed) { + $changed = 0; + $done = ''; + while (/\@(\w+){([^\{\}]+)}/) { + $text = &apply_style($1, $2); + if ($text) { + $_ = "$`$text$'"; + $changed = 1; + } else { + $done .= "$`\@$1"; + $_ = "{$2}$'"; + } + } + $_ = $done . $_; + } + return($_); +} + +sub anchor { + local($name, $href, $text, $newline) = @_; + local($result); + + $result = "

    \n"; +} + +sub print_header { + local($_); + + # clean the title + $_ = &remove_style($_[0]); + &unprotect_texi; + # print the header + if ($doctype eq 'html2') { + print FILE $html2_doctype; + } elsif ($doctype) { + print FILE $doctype; + } + print FILE < + +$header +$_ + + +EOT +} + +sub print_toplevel_header { + local($_); + + &print_header; # pass given arg... + print FILE $full_title; + if ($value{'_subtitle'}) { + $value{'_subtitle'} =~ s/\n+$//; + foreach (split(/\n/, $value{'_subtitle'})) { + $_ = &substitute_style($_); + &unprotect_texi; + print FILE "

    $_

    \n"; + } + } + if ($value{'_author'}) { + $value{'_author'} =~ s/\n+$//; + foreach (split(/\n/, $value{'_author'})) { + $_ = &substitute_style($_); + &unprotect_texi; + s/[\w.-]+\@[\w.-]+/
    $&<\/A>/g; + print FILE "
    $_
    \n"; + } + } + print FILE "

    \n"; +} + +sub print_footer { + print FILE < + +EOT +} + +sub print_toplevel_footer { + &print_ruler; + print FILE <texi2html +translator version 1.51.

    +EOT + &print_footer; +} + +sub protect_texi { + # protect @ { } ` ' + s/\@\@/$;0/go; + s/\@\{/$;1/go; + s/\@\}/$;2/go; + s/\@\`/$;3/go; + s/\@\'/$;4/go; +} + +sub protect_html { + local($what) = @_; + # protect & < > + $what =~ s/\&/\&\#38;/g; + $what =~ s/\/\&\#62;/g; + # but recognize some HTML things + $what =~ s/\&\#60;\/A\&\#62;/<\/A>/g; # + $what =~ s/\&\#60;A ([^\&]+)\&\#62;//g; # + $what =~ s/\&\#60;IMG ([^\&]+)\&\#62;//g; # + return($what); +} + +sub unprotect_texi { + s/$;0/\@/go; + s/$;1/\{/go; + s/$;2/\}/go; + s/$;3/\`/go; + s/$;4/\'/go; +} + +sub unprotect_html { + local($what) = @_; + $what =~ s/\&\#38;/\&/g; + $what =~ s/\&\#60;/\/g; + return($what); +} + +sub byalpha { + $key2alpha{$a} cmp $key2alpha{$b}; +} + +############################################################################## + + # These next few lines are legal in both Perl and nroff. + +.00 ; # finish .ig + +'di \" finish diversion--previous line must be blank +.nr nl 0-1 \" fake up transition to first page again +.nr % 0 \" start at page 1 +'; __END__ ############# From here on it's a standard manual page ############ +.TH TEXI2HTML 1 "09/10/96" +.AT 3 +.SH NAME +texi2html \- a Texinfo to HTML converter +.SH SYNOPSIS +.B texi2html [options] file +.PP +.B texi2html -check [-verbose] files +.SH DESCRIPTION +.I Texi2html +converts the given Texinfo file to a set of HTML files. It tries to handle +most of the Texinfo commands. It creates hypertext links for cross-references, +footnotes... +.PP +It also tries to add links from a reference to its corresponding entry in the +bibliography (if any). It may also handle a glossary (see the +.B \-glossary +option). +.PP +.I Texi2html +creates several files depending on the contents of the Texinfo file and on +the chosen options (see FILES). +.PP +The HTML files created by +.I texi2html +are closer to TeX than to Info, that's why +.I texi2html +converts @iftex sections and not @ifinfo ones by default. You can reverse +this with the \-expandinfo option. +.SH OPTIONS +.TP 12 +.B \-check +Check the given file and give the list of all things that may be Texinfo commands. +This may be used to check the output of +.I texi2html +to find the Texinfo commands that have been left in the HTML file. +.TP +.B \-expandinfo +Expand @ifinfo sections, not @iftex ones. +.TP +.B \-glossary +Use the section named 'Glossary' to build a list of terms and put links in the HTML +document from each term toward its definition. +.TP +.B \-invisible \fIname\fP +Use \fIname\fP to create invisible destination anchors for index links. This is a workaround +for a known bug of many WWW browsers, including xmosaic. +.TP +.B \-I \fIdir\fP +Look also in \fIdir\fP to find included files. +.TP +.B \-menu +Show the Texinfo menus; by default they are ignored. +.TP +.B \-monolithic +Output only one file, including the table of contents and footnotes. +.TP +.B \-number +Number the sections. +.TP +.B \-split_chapter +Split the output into several HTML files (one per main section: +chapter, appendix...). +.TP +.B \-split_node +Split the output into several HTML files (one per node). +.TP +.B \-usage +Print usage instructions, listing the current available command-line options. +.TP +.B \-verbose +Give a verbose output. Can be used with the +.B \-check +option. +.PP +.SH FILES +By default +.I texi2html +creates the following files (foo being the name of the Texinfo file): +.TP 16 +.B foo_toc.html +The table of contents. +.TP +.B foo.html +The document's contents. +.TP +.B foo_foot.html +The footnotes (if any). +.PP +When used with the +.B \-split +option, it creates several files (one per chapter or node), named +.B foo_n.html +(n being the indice of the chapter or node), instead of the single +.B foo.html +file. +.PP +When used with the +.B \-monolithic +option, it creates only one file: +.B foo.html +.SH VARIABLES +.I texi2html +predefines the following variables: \fBhtml\fP, \fBtexi2html\fP. +.SH ADDITIONAL COMMANDS +.I texi2html +implements the following non-Texinfo commands: +.TP 16 +.B @ifhtml +This indicates the start of an HTML section, this section will passed through +without any modofication. +.TP +.B @end ifhtml +This indcates the end of an HTML section. +.SH VERSION +This is \fItexi2html\fP version 1.51, 09/10/96. +.PP +The latest version of \fItexi2html\fP can be found in WWW, cf. URL +http://wwwcn.cern.ch/dci/texi2html/ +.SH AUTHOR +The main author is Lionel Cons, CERN CN/DCI/UWS, Lionel.Cons@cern.ch. +Many other people around the net contributed to this program. +.SH COPYRIGHT +This program is the intellectual property of the European +Laboratory for Particle Physics (known as CERN). No guarantee whatsoever is +provided by CERN. No liability whatsoever is accepted for any loss or damage +of any kind resulting from any defect or inaccuracy in this information or +code. +.PP +CERN, 1211 Geneva 23, Switzerland +.SH "SEE ALSO" +GNU Texinfo Documentation Format, +HyperText Markup Language (HTML), +World Wide Web (WWW). +.SH BUGS +This program does not understand all Texinfo commands (yet). +.PP +TeX specific commands (normally enclosed in @iftex) will be +passed unmodified. +.ex diff --git a/glabels1/barcode-0.98/ean.c b/glabels1/barcode-0.98/ean.c new file mode 100644 index 00000000..0801a0ef --- /dev/null +++ b/glabels1/barcode-0.98/ean.c @@ -0,0 +1,774 @@ +/* + * ean.c -- encoding for ean, upc and isbn + * + * Copyright (c) 1999 Alessandro Rubini + * Copyright (c) 1999 Prosa Srl. + * Copyright (c) 2001 Boszormenyi Zoltan + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +/* + * IMPORTANT NOTE: if you are reading this file to learn how to add a + * new encoding type, this is the wrong place as there are too many + * special cases. Please refer to code39.c instead. If you want to + * learn how UPC, EAN, ISBN work, on the other hand, I did my best to + * commend things and hope you enjoy it. + */ + +/* + * These following static arrays are used to describe the barcode. + * + * The various forms of UPC and EAN are documented as using three + * different alphabets to encode the ten digits. However, each digit + * has exactly one encoding; only, it is sometimes mirrored. Moreover, + * if you represent the width of each symbol (bar/space) instead of + * the sequence of 1's and 0's, you find that even-parity and odd-parity + * encoding are exactly the same. So, here are the digits: */ +static char *digits[] = { + "3211","2221","2122","1411","1132", + "1231","1114","1312","1213","3112"}; + +/* + * What EAN encoding does is adding a leading digit (the 13th digit). + * Such an extra digit is encoded by mirroring three of the six digits that + * appear in the left half of the UPC code. Here how mirroring works: + */ +static char *ean_mirrortab[] = { + "------","--1-11","--11-1","--111-","-1--11", + "-11--1","-111--","-1-1-1","-1-11-","-11-1-" +}; + +/* + * UPC-E (the 6-digit one), instead, encodes the check character as + * a mirroring of the symbols. This is similar, but the encoding for "0" is + * different (EAN uses no mirroring for "0" to be compatible with UPC). + * The same rule is used for UPC-5 (the supplemental digits for ISBN) + */ +static char *upc_mirrortab[] = { + "---111","--1-11","--11-1","--111-","-1--11", + "-11--1","-111--","-1-1-1","-1-11-","-11-1-" +}; + +/* + * UPC-E mirroring for encoding "1" + */ +static char *upc_mirrortab1[] = { + "111---","11-1--","11--1-","11---1","1-11--", + "1--11-","1---11","1-1-1-","1-1--1","1--1-1" +}; + +/* UPC-2 has just two digits to mirror */ +static char *upc_mirrortab2[] = { + "11","1-","-1","--" +}; + +/* + * initial, middle, final guard bars (first symbol is a a space). + * EAN-13 overwrites the first "0" with "9" to make space for the extra digit. + */ +static char *guard[] = {"0a1a","1a1a1","a1a"}; + +/* initial, final guard bars for UPC-E*/ +static char *guardE[] = {"0a1a","1a1a1a"}; + +/* initial and inter-char guard bars for supplementals (first is space) */ +static char *guardS[] = {"9112","11"}; + +/* + * These functions are shortcuts I use in the encoding engine + */ +static int ean_make_checksum(char *text, int mode) +{ + int esum = 0, osum = 0, i; + int even=1; /* last char is even */ + + if (strchr(text, ' ')) + i = strchr(text, ' ') - text; /* end of first part */ + else + i = strlen(text); /* end of all */ + + while (i-- > 0) { + if (even) esum += text[i]-'0'; + else osum += text[i]-'0'; + even = !even; + } + if (!mode) { /* standard upc/ean checksum */ + i = (3*esum + osum) % 10; + return (10-i) % 10; /* complement to 10 */ + } else { /* add-5 checksum */ + i = (3*esum + 9*osum); + return i%10; + } +} + +/* + * Check that the text can be encoded. Returns 0 or -1. + * Accept: + * 13 or 12 digits: EAN-13 w/ or w/o checksum + * or + * 8 or 7 digits: EAN-8 w/ or w/o checksum. + * For both EAN-13 and EAN-8, accept an addon of 2 or 5 digits, + * separated by ' ' + */ +int Barcode_ean_verify(unsigned char *text) +{ + int i, len0, len, addon; + unsigned char tmp[24], *spc; + + len = strlen(text); + spc = strchr(text, ' '); + if (spc) { + len0 = spc - text; + addon = len - len0 - 1; + if (addon != 2 && addon != 5) + return -1; + for (i=len0+1; i= '5' && text[10] <= '9') { + memcpy(&result[1], text+1, 5); + result[6] = text[10]; + } else { + return NULL; + } + result[7] = chksum + '0'; + + return result; +} + +/* + * UPC-A is the same as EAN, but accept + * 12 or 11 digits (UPC-A w/ or w/o checksum) + * or accept UPC-E as: + * 6 digits (w/o number system and checksum): number system '0' assumed, + * 7 digits (either w/o number system or checksum), + * 8 digits (w/ number system and checksum) + * plus the 2 or 5-digit add-on + */ +int Barcode_upc_verify(unsigned char *text) +{ + int i, len0, len, addon; + unsigned char tmp[24], *spc; + + len = strlen(text); + spc = strchr(text, ' '); + if (spc) { + len0 = spc - text; + addon = len - len0 - 1; + if (addon != 2 && addon != 5) + return -1; + for (i=len0+1; iascii) { + bc->error = EINVAL; + return -1; + } + + /* Find out whether the barcode has addon and + * the length of the barcode w/o the addon. + */ + len = strlen(bc->ascii); + spc = strchr(bc->ascii, ' '); + if (spc) { + len0 = spc - bc->ascii; + addon = strlen(spc + 1); + if (addon != 2 && addon != 5) { + bc->error = EINVAL; /* impossible, actually */ + return -1; + } + } else { + len0 = len; + addon = 0; + } + + if (!bc->encoding) { + /* ISBN already wrote what it is; if unknown, find it out */ + + /* + * Do not decide only by barcode length, it may be ambiguous. + * Anyway, either the user specified the barcode type or + * we already found a fitting one. + */ + switch(bc->flags & BARCODE_ENCODING_MASK) { + case BARCODE_EAN: + switch (len0) { + case 7: case 8: + bc->encoding = strdup("EAN-8"); + encoding = EAN8; + break; + case 12: case 13: + bc->encoding = strdup("EAN-13"); + encoding = EAN13; + break; + default: + bc->error = -EINVAL; + return -1; + } + break; + + case BARCODE_UPC: + switch (len0) { + case 6: case 7: case 8: + bc->encoding = strdup("UPC-E"); + encoding = UPCE; + break; + case 11: case 12: + bc->encoding = strdup("UPC-A"); + encoding = UPCA; + break; + default: + bc->error = -EINVAL; + return -1; + } + break; + default: + /* else, it's wrong (impossible, as the text is checked) */ + bc->error = -EINVAL; + return -1; + } + } + + /* better safe than sorry */ + if (bc->partial) free(bc->partial); bc->partial = NULL; + if (bc->textinfo) free(bc->textinfo); bc->textinfo = NULL; + + if (encoding == UPCA) { /* add the leading 0 (not printed) */ + text[0] = '0'; + strcpy(text+1, bc->ascii); + } else if (encoding == UPCE) { + strcpy(text, upc_a_to_e(upc_e_to_a(bc->ascii))); + } else { + strcpy(text, bc->ascii); + } + + /* + * build the checksum and the bars: any encoding is slightly different + */ + if (encoding == UPCA || encoding == EAN13 || encoding == ISBN) { + if (!(encoding == UPCA && len0 == 12) && + !(encoding == EAN13 && len0 == 13)) { + checksum = ean_make_checksum(text, 0); + text[12] = '0' + checksum; /* add it to the text */ + text[13] = '\0'; + } + + strcpy(partial, guard[0]); + if (encoding == EAN13 || encoding == ISBN) { /* The first digit */ + sprintf(tptr,"0:12:%c ",text[0]); + tptr += strlen(tptr); + partial[0] = '9'; /* extra space for the digit */ + } else if (encoding == UPCA) + partial[0] = '9'; /* UPC has one digit before the symbol, too */ + xpos = width_of_partial(partial); + mirror = ean_mirrortab[text[0]-'0']; + + /* left part */ + for (i=1;i<7;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i]-'0']; /* source */ + strcpy(ptr1, ptr2); + if (mirror[i-1] == '1') { + /* mirror this */ + ptr1[0] = ptr2[3]; + ptr1[1] = ptr2[2]; + ptr1[2] = ptr2[1]; + ptr1[3] = ptr2[0]; + } + /* + * Write the ascii digit. UPC has a special case + * for the first digit, which is out of the bars + */ + if (encoding == UPCA && i==1) { + sprintf(tptr, "0:10:%c ", text[i]); + tptr += strlen(tptr); + ptr1[1] += 'a'-'1'; /* bars are long */ + ptr1[3] += 'a'-'1'; + } else { + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + } + /* count the width of the symbol */ + xpos += 7; /* width_of_partial(ptr2) */ + } + + strcat(partial, guard[1]); /* middle */ + xpos += width_of_partial(guard[1]); + + /* right part */ + for (i=7;i<13;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i]-'0']; /* source */ + strcpy(ptr1, ptr2); + /* + * Ascii digit. Once again, UPC has a special + * case for the last digit + */ + if (encoding == UPCA && i==12) { + sprintf(tptr, "%i:10:%c ", xpos+13, text[i]); + tptr += strlen(tptr); + ptr1[0] += 'a'-'1'; /* bars are long */ + ptr1[2] += 'a'-'1'; + } else { + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + } + xpos += 7; /* width_of_partial(ptr2) */ + } + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guard[2]); /* end */ + xpos += width_of_partial(guard[2]); + + } else if (encoding == UPCE) { + checksum = text[7] - '0'; + + strcpy(partial, guardE[0]); + partial[0] = '9'; /* UPC-A has one digit before the symbol, too */ + xpos = width_of_partial(partial); + + /* UPC-E has the number system written before the bars. */ + sprintf(tptr, "0:10:%c ", text[0]); + tptr += strlen(tptr); + + if (text[0] == '0') + mirror = upc_mirrortab[checksum]; + else + mirror = upc_mirrortab1[checksum]; + + for (i=0;i<6;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i+1]-'0']; /* source */ + strcpy(ptr1, ptr2); + if (mirror[i] != '1') { /* negated wrt EAN13 */ + /* mirror this */ + ptr1[0] = ptr2[3]; + ptr1[1] = ptr2[2]; + ptr1[2] = ptr2[1]; + ptr1[3] = ptr2[0]; + } + sprintf(tptr, "%i:12:%c ", xpos, text[i+1]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(ptr2) */ + } + + sprintf(tptr, "%i:10:%c ", xpos+10, text[7]); + tptr += strlen(tptr); + ptr1[0] += 'a'-'1'; /* bars are long */ + ptr1[2] += 'a'-'1'; + + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guardE[1]); /* end */ + + } else { /* EAN-8 almost identical to EAN-13 but no mirroring */ + + if (len0 != 8) { + checksum = ean_make_checksum(text, 0); + text[7] = '0' + checksum; /* add it to the text */ + text[8] = '\0'; + } + + strcpy(partial, guard[0]); + xpos = width_of_partial(partial); + + /* left part */ + for (i=0;i<4;i++) { + strcpy(partial + strlen(partial), digits[text[i]-'0']); + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(digits[text[i]-'0' */ + } + strcat(partial, guard[1]); /* middle */ + xpos += width_of_partial(guard[1]); + + /* right part */ + for (i=4;i<8;i++) { + strcpy(partial + strlen(partial), digits[text[i]-'0']); + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(digits[text[i]-'0' */ + } + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guard[2]); /* end */ + } + + /* + * And that's it. Now, in case some add-on is specified it + * must be encoded too. Look for it. + */ + if ( (ptr1 = spc) ) { + ptr1++; + strcpy(text, ptr1); + if (strlen(ptr1)==5) { + checksum = ean_make_checksum(text, 1 /* special way */); + mirror = upc_mirrortab[checksum]+1; /* only last 5 digits */ + } else { + checksum = atoi(text)%4; + mirror = upc_mirrortab2[checksum]; + } + strcat(textinfo, " +"); strcat(partial, "+"); + tptr = textinfo + strlen(textinfo); + for (i=0; ipartial = strdup(partial); + if (!bc->partial) { + bc->error = errno; + return -1; + } + bc->textinfo = strdup(textinfo); + if (!bc->textinfo) { + bc->error = errno; + free(bc->partial); + bc->partial = NULL; + return -1; + } + if (!bc->width) + bc->width = width_of_partial(partial); + + return 0; /* success */ +} + +int Barcode_upc_encode(struct Barcode_Item *bc) +{ + return Barcode_ean_encode(bc); /* UPC is folded into EAN */ +} + +int Barcode_isbn_encode(struct Barcode_Item *bc) +{ + /* For ISBN we must normalize the string and prefix "978" */ + unsigned char *text = malloc(24); /* 13 + ' ' + 5 plus some slack */ + unsigned char *otext; + int i, j, retval; + + if (!text) { + bc->error = ENOMEM; + return -1; + } + strcpy(text, "978"); j=3; + + otext = bc->ascii; + for (i=0; otext[i]; i++) { + if (isdigit(otext[i])) + text[j++] = otext[i]; + if (j == 12) /* checksum added later */ + break; + } + text[j]='\0'; + if (strchr(otext, ' ')) + strcat(text, strchr(otext, ' ')); + bc->ascii = text; + bc->encoding = strdup("ISBN"); + retval = Barcode_ean_encode(bc); + bc->ascii = otext; /* restore ascii for the ps comments */ + free(text); + return retval; +} + diff --git a/glabels1/barcode-0.98/i25.c b/glabels1/barcode-0.98/i25.c new file mode 100644 index 00000000..72bd0358 --- /dev/null +++ b/glabels1/barcode-0.98/i25.c @@ -0,0 +1,164 @@ +/* + * i25.c -- "interleaved 2 of 5" + * + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +static char *codes[] = { + "11331", "31113", "13113", "33111", "11313", + "31311", "13311", "11133", "31131", "13131" +}; + +static char *guard[] = {"a1a1", "c1a"}; /* begin end */ + +int Barcode_i25_verify(unsigned char *text) +{ + if (!text[0]) + return -1; + while (*text && isdigit(*text)) + text++; + if (*text) + return -1; /* a non-digit char */ + return 0; /* ok */ +} + +int Barcode_i25_encode(struct Barcode_Item *bc) +{ + unsigned char *text; + unsigned char *partial; /* dynamic */ + unsigned char *textinfo; /* dynamic */ + unsigned char *textptr, *p1, *p2, *pd; + int i, len, sum[2], textpos, usesum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("interleaved 2 of 5"); + + text = bc->ascii; + if (!bc->ascii) { + bc->error = EINVAL; + return -1; + } + + if ((bc->flags & BARCODE_NO_CHECKSUM)) usesum = 0; else usesum = 1; + + /* create the real text string, padded to an even number of digits */ + text = malloc(strlen(bc->ascii) + 3); /* leading 0, checksum, term. */ + if (!text) { + bc->error = errno; + return -1; + } + /* add the leading 0 if needed */ + i = strlen(bc->ascii) + usesum; + if (i % 2) { + /* add a leading 0 */ + text[0] = '0'; + strcpy(text+1, bc->ascii); + } else { + strcpy(text, bc->ascii); + } + /* add the trailing checksum if needed, the leading 0 is ignored */ + if (usesum) { + sum[0] = sum[1] = 0; + for (i=0; text[i]; i++) + sum[i%2] += text[i]-'0'; + /* + * The "even" sum must be multiplied by three, and the * + * rightmost digit is defined as "even". The digits' position + * is already correct, whether or not we added a leading zero. + * (e.g., they are in pos. 0..4 or 1..4 of the string) + */ + i = sum[0] * 3 + sum[1]; + strcat(text, "0"); + text[strlen(text)-1] += (10 - (i%10)) % 10; + } + + /* the partial code is 5 * (text + check) + 4(head) + 3(tail) + term. */ + partial = malloc( (strlen(text) + 3) * 5 +2); /* be large... */ + if (!partial) { + bc->error = errno; + free(text); + return -1; + } + + /* the text information is at most "nnn:fff:c " * (strlen+1) +term */ + textinfo = malloc(10*(strlen(text)+1) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(text); + return -1; + } + + + strcpy(partial, "0"); /* the first space */ + strcat(partial, guard[0]); /* start */ + textpos = 4; /* width of initial guard */ + textptr = textinfo; + + len = strlen(text); + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + free(text); + return -1; + } + /* interleave two digits */ + p1 = codes[text[i]-'0']; + p2 = codes[text[i+1]-'0']; + pd = partial + strlen(partial); /* destination */ + while (*p1) { + *(pd++) = *(p1++); + *(pd++) = *(p2++); + } + *pd = '\0'; + /* and print the ascii text (but don't print the checksum, if any */ + if (usesum && strlen(text+i)==2) { + /* print only one digit, discard the checksum */ + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + } else { + sprintf(textptr, "%i:12:%c %i:12:%c ", textpos, text[i], + textpos+9, text[i+1]); + } + textpos += 18; /* width of two codes */ + textptr += strlen(textptr); + } + strcat(partial, guard[1]); + + bc->partial = partial; + bc->textinfo = textinfo; + free(text); + + return 0; +} + diff --git a/glabels1/barcode-0.98/install-sh b/glabels1/barcode-0.98/install-sh new file mode 100644 index 00000000..ab74c882 --- /dev/null +++ b/glabels1/barcode-0.98/install-sh @@ -0,0 +1,238 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/glabels1/barcode-0.98/library.c b/glabels1/barcode-0.98/library.c new file mode 100644 index 00000000..a8787020 --- /dev/null +++ b/glabels1/barcode-0.98/library.c @@ -0,0 +1,244 @@ +/* + * library.c -- external functions of libbarcode + * + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H /* sometimes (windows, for instance) it's missing */ +# include +#endif +#include + +#include "barcode.h" + +/* + * This function allocates a barcode structure and strdup()s the + * text string. It returns NULL in case of error + */ +struct Barcode_Item *Barcode_Create(char *text) +{ + struct Barcode_Item *bc; + + bc = malloc(sizeof(*bc)); + if (!bc) return NULL; + + memset(bc, 0, sizeof(*bc)); + bc->ascii = strdup(text); + bc->margin = BARCODE_DEFAULT_MARGIN; /* default margin */ + return bc; +} + + +/* + * Free a barcode structure + */ +int Barcode_Delete(struct Barcode_Item *bc) +{ + if (bc->ascii) + free(bc->ascii); + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + if (bc->encoding) + free(bc->encoding); + free(bc); + return 0; /* always success */ +} + + +/* + * The various supported encodings. This might be extended to support + * dynamic addition of extra encodings + */ +extern int Barcode_ean_verify(unsigned char *text); +extern int Barcode_ean_encode(struct Barcode_Item *bc); +extern int Barcode_upc_verify(unsigned char *text); +extern int Barcode_upc_encode(struct Barcode_Item *bc); +extern int Barcode_isbn_verify(unsigned char *text); +extern int Barcode_isbn_encode(struct Barcode_Item *bc); +extern int Barcode_39_verify(unsigned char *text); +extern int Barcode_39_encode(struct Barcode_Item *bc); +extern int Barcode_128b_verify(unsigned char *text); +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_128raw_verify(unsigned char *text); +extern int Barcode_128raw_encode(struct Barcode_Item *bc); +extern int Barcode_i25_verify(unsigned char *text); +extern int Barcode_i25_encode(struct Barcode_Item *bc); +extern int Barcode_cbr_verify(unsigned char *text); +extern int Barcode_cbr_encode(struct Barcode_Item *bc); +extern int Barcode_msi_verify(unsigned char *text); +extern int Barcode_msi_encode(struct Barcode_Item *bc); +extern int Barcode_pls_verify(unsigned char *text); +extern int Barcode_pls_encode(struct Barcode_Item *bc); +extern int Barcode_93_verify(unsigned char *text); +extern int Barcode_93_encode(struct Barcode_Item *bc); + + +struct encoding { + int type; + int (*verify)(unsigned char *text); + int (*encode)(struct Barcode_Item *bc); +}; + +struct encoding encodings[] = { + {BARCODE_EAN, Barcode_ean_verify, Barcode_ean_encode}, + {BARCODE_UPC, Barcode_upc_verify, Barcode_upc_encode}, + {BARCODE_ISBN, Barcode_isbn_verify, Barcode_isbn_encode}, + {BARCODE_128B, Barcode_128b_verify, Barcode_128b_encode}, + {BARCODE_128C, Barcode_128c_verify, Barcode_128c_encode}, + {BARCODE_128RAW, Barcode_128raw_verify, Barcode_128raw_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}, + {BARCODE_CBR, Barcode_cbr_verify, Barcode_cbr_encode}, + {BARCODE_PLS, Barcode_pls_verify, Barcode_pls_encode}, + {BARCODE_MSI, Barcode_msi_verify, Barcode_msi_encode}, + {BARCODE_93, Barcode_93_verify, Barcode_93_encode}, + {0, NULL, NULL} +}; + +/* + * A function to encode a string into bc->partial, ready for + * postprocessing to the output file. Meaningful bits for "flags" are + * the encoding mask and the no-checksum flag. These bits + * get saved in the data structure. + */ +int Barcode_Encode(struct Barcode_Item *bc, int flags) +{ + int validbits = BARCODE_ENCODING_MASK | BARCODE_NO_CHECKSUM; + struct encoding *cptr; + + /* If any flag is cleared in "flags", inherit it from "bc->flags" */ + if (!(flags & BARCODE_ENCODING_MASK)) + flags |= bc->flags & BARCODE_ENCODING_MASK; + if (!(flags & BARCODE_NO_CHECKSUM)) + flags |= bc->flags & BARCODE_NO_CHECKSUM; + flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); + + if (!(flags & BARCODE_ENCODING_MASK)) { + /* get the first code able to handle the text */ + for (cptr = encodings; cptr->verify; cptr++) + if (cptr->verify((unsigned char *)bc->ascii)==0) + break; + if (!cptr->verify) { + bc->error = EINVAL; /* no code can handle this text */ + return -1; + } + flags |= cptr->type; /* this works */ + bc->flags |= cptr->type; + } + for (cptr = encodings; cptr->verify; cptr++) + if (cptr->type == (flags & BARCODE_ENCODING_MASK)) + break; + if (!cptr->verify) { + bc->error = EINVAL; /* invalid barcode type */ + return -1; + } + if (cptr->verify(bc->ascii) != 0) { + bc->error = EINVAL; + return -1; + } + return cptr->encode(bc); +} + + +/* + * When multiple output formats are supported, there will + * be a jumpt table like the one for the types. Now we don't need it + */ +extern int Barcode_ps_print(struct Barcode_Item *bc, FILE *f); +extern int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f); + +/* + * A function to print a partially decoded string. Meaningful bits for + * "flags" are the output mask etc. These bits get saved in the data + * structure. + */ +int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags) +{ + int validbits = BARCODE_OUTPUT_MASK | BARCODE_NO_ASCII + | BARCODE_OUT_NOHEADERS; + + /* If any flag is clear in "flags", inherit it from "bc->flags" */ + if (!(flags & BARCODE_OUTPUT_MASK)) + flags |= bc->flags & BARCODE_OUTPUT_MASK; + if (!(flags & BARCODE_NO_ASCII)) + flags |= bc->flags & BARCODE_NO_ASCII; + if (!(flags & BARCODE_OUT_NOHEADERS)) + flags |= bc->flags & BARCODE_OUT_NOHEADERS; + flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); + + if (bc->flags & BARCODE_OUT_PCL) + return Barcode_pcl_print(bc, f); + return Barcode_ps_print(bc, f); +} + +/* + * Choose the position + */ +int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, + int xoff, int yoff, double scalef) +{ + bc->width = wid; bc->height = hei; + bc->xoff = xoff; bc->yoff = yoff; + bc->scalef = scalef; + return 0; +} + +/* + * Do it all in one step + */ +int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags) +{ + struct Barcode_Item * bc; + + if (!(bc=Barcode_Create(text))) { + errno = -ENOMEM; + return -1; + } + if ( Barcode_Position(bc, wid, hei, xoff, yoff, 0.0) < 0 + || Barcode_Encode(bc, flags) < 0 + || Barcode_Print(bc, f, flags) < 0) { + errno = bc->error; + Barcode_Delete(bc); + return -1; + } + Barcode_Delete(bc); + return 0; +} + +/* + * Return the version + */ + +int Barcode_Version(char *vptr) +{ + if (vptr) + strcpy(vptr, BARCODE_VERSION); + return BARCODE_VERSION_INT; +} diff --git a/glabels1/barcode-0.98/main.c b/glabels1/barcode-0.98/main.c new file mode 100644 index 00000000..e07e4d3c --- /dev/null +++ b/glabels1/barcode-0.98/main.c @@ -0,0 +1,604 @@ +/* + * main.c - a commandline frontend for the barcode library + * + * Copyright (c) 1999 Michele Comitini (mcm@glisco.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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include + +#include "cmdline.h" +#include "barcode.h" + +#ifndef NO_LIBPAPER +#include +#endif + +/* + * Most of this file deals with command line options, by exploiting + * the cmdline.[ch] engine to offer defaults via environment variables + * and handling functions for complex options. + * + * In order to offer a friendly interface (for those who feel the + * cmdline *is* friendly, like me), we have to convert names to enums... + */ + +struct { + char *name; + int type; +} encode_tab[] = { + {"ean", BARCODE_EAN}, + {"ean13", BARCODE_EAN}, + {"ean-13", BARCODE_EAN}, + {"ean8", BARCODE_EAN}, + {"ean-8", BARCODE_EAN}, + {"upc", BARCODE_UPC}, + {"upc-a", BARCODE_UPC}, + {"upc-e", BARCODE_UPC}, + {"isbn", BARCODE_ISBN}, + {"39", BARCODE_39}, + {"code39", BARCODE_39}, + {"128c", BARCODE_128C}, + {"code128c", BARCODE_128C}, + {"128b", BARCODE_128B}, + {"code128b", BARCODE_128B}, + {"128", BARCODE_128}, + {"code128", BARCODE_128}, + {"128raw", BARCODE_128RAW}, + {"i25", BARCODE_I25}, + {"interleaved 2 of 5", BARCODE_I25}, + {"cbr", BARCODE_CBR}, + {"codabar", BARCODE_CBR}, + {"msi", BARCODE_MSI}, + {"pls", BARCODE_PLS}, + {"plessey", BARCODE_PLS}, + {"code93", BARCODE_93}, + {"93", BARCODE_93}, + + {NULL, 0} +}; + +/* + * Get encoding type from string rapresentation. + * Returns -1 on error. + */ +#ifndef HAVE_STRCASECMP /* some libs (windows, for example) have stricmp */ +# define strcasecmp stricmp +#endif + +int encode_id(char *encode_name) +{ + int i; + for (i = 0; encode_tab[i].name; i++) + if (!strcasecmp(encode_tab[i].name, encode_name)) + return encode_tab[i].type; + return -1; +} + +int list_encodes(FILE *f) /* used in the help message */ +{ + int prev = -1; + int i; + + fprintf(f, "Known encodings are (synonyms appear on the same line):"); + for (i = 0; encode_tab[i].name; i++) { + if (encode_tab[i].type != prev) + fprintf(f, "\n\t"); + else + fprintf(f, ", "); + fprintf(f, "\"%s\"", encode_tab[i].name); + prev = encode_tab[i].type; + } + fprintf(f, "\n"); + return 0; +} + + +/* + * Variables to hold cmdline arguments (or defaults) + */ + +char *ifilename, *ofilename; +int encoding_type; /* filled by get_encoding() */ +int code_width, code_height; /* "-g" for standalone codes */ +int lines, columns; /* "-t" for tables */ +int xmargin0, ymargin0; /* both for "-g" and "-t" */ +int xmargin1, ymargin1; /* same, but right and top */ +int ximargin, yimargin; /* "-m": internal margins */ +int eps, pcl, ps, noascii, nochecksum; /* boolean flags */ +int page_wid, page_hei; /* page size in points */ +char *page_name; /* name of the media */ +double unit = 1.0; /* unit specification */ + +char *prgname; /* used to print error msgs, initialized to argv[0] by main */ + +/* + * Functions to handle command line arguments + */ + +struct encode_item { + char *string; + struct encode_item *next; +} *list_head, *list_tail; + +/* each "-b" option adds a string to the input pool allocating its space */ +int get_input_string(void *arg) +{ + struct encode_item *item = malloc(sizeof(*item)); + if (!item) { + fprintf(stderr, "%s: malloc: %s\n", prgname, strerror(errno)); + return -2; + } + item->string = strdup(arg); + if (!list_head) { + list_head = list_tail = item; + } else { + list_tail->next = item; + list_tail = item; + } + item->next = NULL; + return 0; +} + +/* and this function extracts strings from the pool */ +unsigned char *retrieve_input_string(FILE *ifile) +{ + char *string; + static char fileline[128]; + + struct encode_item *item = list_head; + if (list_tail) { /* this means at least one "-b" was specified */ + if (!item) + return NULL; /* the list is empty */ + string = item->string; + list_head = item->next; + free(item); + return string; + } + + /* else, read from the file */ + if (!fgets(fileline, 128, ifile)) + return NULL; + if (fileline[strlen(fileline)-1]=='\n') + fileline[strlen(fileline)-1]= '\0'; + return strdup(fileline); +} + +/* accept a unit specification */ +int get_unit(void *arg) +{ + static struct { + char *str; + double unit; + } *ptr, unittab[] = { + {"pt", 1.0}, + {"in", 72.0}, + {"cm", 72.0/2.54}, + {"mm", 72.0/25.4}, + {NULL, 0.0} + }; + + for (ptr = unittab; ptr->str && strcmp((char *)arg, ptr->str); ptr++) + ; + unit = ptr->unit; + if (ptr->str) return 0; + + fprintf(stderr, "%s: incorrect unit \"%s\" (use one of", + prgname, (char *)arg); + for (ptr = unittab; ptr->str; ptr++) + fprintf(stderr, " \"%s\"", ptr->str); + fprintf(stderr, ")\n"); + return -2; +} + +/* convert an encoding name to an encoding integer code */ +int get_encoding(void *arg) +{ + encoding_type = encode_id((char *)arg); + if (encoding_type >=0) return 0; + fprintf(stderr, "%s: wrong encoding \"%s\"\n", prgname, + (char *)arg); + return -2; /* error, no help */ +} + +/* convert a geometry specification */ +int get_geometry(void *arg) +{ + double w = 0.0, h = 0.0; + double x = 0.0, y = 0.0; + int n; + + if (((char *)arg)[0]=='+') { + n = sscanf((char *)arg, "+%lf+%lf%s", &x, &y, (char *)arg); + } else { + n = sscanf((char *)arg, "%lfx%lf+%lf+%lf%s", &w, &h, &x, &y, + (char *)arg); + } + if (n!=4 && n!=2) { + fprintf(stderr, "%s: wrong geometry \"%s\"\n", prgname, (char *)arg); + return -2; + } + /* convert to points */ + code_width = w * unit; + code_height = h * unit; + xmargin0 = x * unit; + ymargin0 = y * unit; + return 0; +} + +/* convert a geometry specification */ +int get_table(void *arg) +{ + double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0; + int n; + + n = sscanf((char *)arg, "%dx%d+%lf+%lf-%lf-%lf", + &columns, &lines, &x0, &y0, &x1, &y1); + + if (n==1 || n==3) { /* error: 2, 4, 5, 6 are fine */ + fprintf(stderr, "%s: wrong table specification \"%s\"\n", prgname, + (char *)arg); + return -2; + } + if (n < 6) y1 = y0; /* symmetric by default */ + if (n < 5) x1 = x0; + + /* convert and return */ + xmargin0 = x0 * unit; + ymargin0 = y0 * unit; + xmargin1 = x1 * unit; + ymargin1 = y1 * unit; + return 0; +} + +/* convert an internal margin specification */ +int get_margin(void *arg) +{ + char separator; + double x,y; + int n; + + /* accept one number or two, separated by any char */ + n = sscanf((char *)arg, "%lf%c%lf", &x, &separator, &y); + + if (n==1) { + n=3; y = x; + } + if (n==3) { + ximargin = x * unit; + yimargin = y * unit; + return 0; + } + fprintf(stderr, "%s: wrong margin specification \"%s\"\n", prgname, + (char *)arg); + return -2; + return 0; +} + +/* convert a page geometry specification */ +int get_page_geometry(void *arg) +{ + int n; + double dpw, dph; /* page width, height in mm or inches */ + static char tmpstr[20]; + page_name = arg; /* if undecipherable, we won't run the program :) */ + /* + * try to decode a "mm" string (eg. "210mmx297mm" or "210x297mm") + */ + n = sscanf((char *)arg, "%lfmmx%lf", &dpw, &dph); + if (n != 2 && strlen(arg)<20) { + n = sscanf((char *)arg, "%lfx%lf%s", &dpw, &dph, tmpstr); + if (n == 3 && !strcmp(tmpstr, "mm")) { + /* Ok, convert to points: 1in is 25.4mm, 1in is also 72p */ + page_wid = (int)(dpw / 25.4 * 72.0 + 0.5); + page_hei = (int)(dph / 25.4 * 72.0 + 0.5); + return 0; + } + } + + /* + * try to decode an "in" string (eg. "8.5inx11in" or "8.5x11in") + */ + n = sscanf((char *)arg, "%lfinx%lf", &dpw, &dph); + if (n != 2 && strlen(arg)<20) { + n = sscanf((char *)arg, "%lfx%lf%s", &dpw, &dph, tmpstr); + if (n == 3 && !strcmp(tmpstr, "in")) { + page_wid = (int)(dpw * 72.0 + 0.5); /* round to points */ + page_hei = (int)(dph * 72.0 + 0.5); + return 0; + } + } + + /* + * try to decode a numeric specification + */ + n = sscanf((char *)arg, "%lfx%lf", &dpw, &dph); + if (n == 2) { + page_wid = dpw * unit; + page_hei = dph * unit; + if (unit != 1.0) { /* rebuild the page name */ + 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; + } + +#ifndef NO_LIBPAPER + /* + * try to use libpaper, since it is available + */ + { + const struct paper* paptr; + + paperinit(); + paptr = paperinfo(arg); + if (!paptr) { /* unknown name */ + paperdone(); + return -1; + } + page_wid = (int)(paperpswidth(paptr) + 0.5); + page_hei = (int)(paperpsheight(paptr) + 0.5); + paperdone(); + return 0; + } +#endif + /* If we got here, the argument is undecipherable: fail */ + fprintf(stderr, "%s: wrong page size specification \"%s\"\n", prgname, + (char *)arg); + return -2; +} + +/* + * The table of possible arguments + */ +struct commandline option_table[] = { + {'i', CMDLINE_S, &ifilename, NULL, NULL, NULL, + "input file (strings to encode), default is stdin"}, + {'o', CMDLINE_S, &ofilename, NULL, NULL, NULL, + "output file, default is stdout"}, + {'b', CMDLINE_S, NULL, get_input_string, NULL, NULL, + "string to encode (use input file if missing)"}, + {'e', CMDLINE_S, NULL, get_encoding, "BARCODE_ENCODING", NULL, + "encoding type (default is best fit for first string)"}, + {'u', CMDLINE_S, NULL, get_unit, "BARCODE_UNIT", NULL, + "unit (\"mm\", \"in\", ...) used to decode -g, -t, -p"}, + {'g', CMDLINE_S, NULL, get_geometry, "BARCODE_GEOMETRY", NULL, + "geometry on the page: [x][++]"}, + {'t', CMDLINE_S, NULL, get_table, "BARCODE_TABLE", NULL, + "table geometry: x[++]"}, + {'m', CMDLINE_S, NULL, get_margin, "BARCODE_MARGIN", "10", + "internal margin for each item in a table: [,]"}, + {'n', CMDLINE_NONE, &noascii, NULL, NULL, NULL, + "\"numeric\": avoid printing text along with the bars"}, + {'c', CMDLINE_NONE, &nochecksum, NULL, NULL, NULL, + "no Checksum character, if the chosen encoding allows it"}, + {'E', CMDLINE_NONE, &eps, NULL, NULL, NULL, + "print one code as eps file (default: multi-page ps)"}, + {'P', CMDLINE_NONE, &pcl, NULL, NULL, NULL, + "create PCL output instead of postscript"}, + {'p', CMDLINE_S, NULL, get_page_geometry, NULL, NULL, + "page size (refer to the man page)"}, + {0,} +}; + +#ifdef NO_STRERROR +/* + * A strerror replacement (thanks to Thad Floryan ) + */ +char *strerror(int error) +{ + static char msg[16]; + if (error >= 0 && error < sys_nerr) + return sys_errlist[error]; + sprintf(msg, "Error %d", error); + return msg; +} +#endif + +/* + * The main function + */ +int main(int argc, char **argv) +{ + struct Barcode_Item * bc; + FILE *ifile = stdin; + FILE *ofile = stdout; + char *line; + int flags=0; /* for the library */ + int page, retval; + + prgname = argv[0]; + + /* First of all, accept "--help" and "-h" as a special case */ + if (argc == 2 && (!strcmp(argv[1],"--help") || !strcmp(argv[1],"-h"))) { + commandline_errormsg(stderr, option_table, argv[0], "Options:\n"); + fprintf(stderr,"\n"); + list_encodes(stderr); + exit(1); + } + /* Also, accept "--version" as a special case */ + if (argc == 2 && (!strcmp(argv[1],"--version"))) { + printf("barcode frontend (GNU barcode) " BARCODE_VERSION "\n"); + exit(0); + } + + /* Otherwise, parse the commandline */ + retval = commandline(option_table, argc, argv, "Use: %s [options]\n"); + if (retval) { + if (retval == -1) /* help printed, complete it */ + list_encodes(stderr); + else /* no help printed, suggest it */ + fprintf(stderr, "%s: try \"%s --help\"\n", prgname, prgname); + exit(1); + } + + /* If no paper size has been specified, use the default, if any */ + if (!page_name) { + page_wid = 595; page_hei = 842; + page_name = "A4"; /* I live in Europe :) */ +#ifndef NO_LIBPAPER + get_page_geometry(systempapername()); /* or the system default */ +#endif + } + + /* FIXME: print warnings for incompatible options */ + + /* open the input stream if specified */ + if (ifilename) + ifile = fopen(ifilename,"r"); + if (!ifile) { + fprintf(stderr, "%s: %s: %s\n", argv[0], ifilename, + strerror(errno)); + exit(1); + } + + /* open the output stream if specified */ + if (ofilename) + ofile = fopen(ofilename,"w"); + if (!ofile) { + fprintf(stderr, "%s: %s: %s\n", argv[0], ofilename, + strerror(errno)); + exit(1); + } + + if (encoding_type < 0) { /* unknown type specified */ + fprintf(stderr,"%s: Unknown endoding. Try \"%s --help\"\n", + argv[0], argv[0]); + exit(1); + } + flags |= encoding_type; + if (pcl) { + flags |= BARCODE_OUT_PCL; + } else { + ps = !eps; /* a shortcut */ + if (eps) + flags |= BARCODE_OUT_EPS; /* print headers too */ + else + flags |= BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; + } + if (noascii) + flags |= BARCODE_NO_ASCII; + if (nochecksum) + flags |= BARCODE_NO_CHECKSUM; + + /* the table is not available in eps mode */ + if (eps && (lines>1 || columns>1)) { + fprintf(stderr, "%s: can't print tables in EPS format\n",argv[0]); + exit(1); + } + + if (ps) { /* The header is independent of single/table mode */ + /* Headers. Don't let the library do it, we may need multi-page */ + fprintf(ofile, "%%!PS-Adobe-2.0\n"); + /* It would be nice to know the bounding box. Leave it alone */ + fprintf(ofile, "%%%%Creator: \"barcode\", " + "libbarcode sample frontend\n"); + if (page_name) + fprintf(ofile, "%%%%DocumentPaperSizes: %s\n", page_name); + fprintf(ofile, "%%%%EndComments\n"); + fprintf(ofile, "%%%%EndProlog\n\n"); + } + + /* + * Here we are, ready to work. Handle the one-per-page case first, + * as it is shorter. + */ + if (!lines && !columns) { + page = 0; + while ( (line = retrieve_input_string(ifile)) ) { + page++; + if (ps) { + fprintf(ofile, "%%%%Page: %i %i\n\n",page,page); + } + if (Barcode_Encode_and_Print(line, ofile, code_width, code_height, + xmargin0, ymargin0, flags) < 0) { + fprintf(stderr, "%s: can't encode \"%s\"\n", argv[0], line); + } + if (eps) break; /* if output is eps, do it once only */ + if (ps) fprintf(ofile, "showpage\n"); + if (pcl) fprintf(ofile, "\f"); + } + /* no more lines, print footers */ + if (ps) { + fprintf(ofile, "%%%%Trailer\n\n"); + } + } else { + + /* table mode, the header has been already printed */ + + int xstep = (page_wid - xmargin0 - xmargin1)/columns; + int ystep = (page_hei - ymargin0 - ymargin1)/lines; + int x = columns, y = -1; /* position in the table, start off-page */ + + if (!ximargin) ximargin = BARCODE_DEFAULT_MARGIN; + if (!yimargin) yimargin = BARCODE_DEFAULT_MARGIN; + /* Assign default size unless -g did it (Joachim Reichelt) */ + if ( !code_width && !code_height) { + code_width = xstep - 2*ximargin; + code_height = ystep - 2*yimargin; + } + + page=0; + while ( (line = retrieve_input_string(ifile)) ) { + x++; /* fit x and y */ + if (x >= columns) { + x=0; y--; + if (y<0) { + y = lines-1; page++; + /* flush page */ + if (ps && page > 1) fprintf(ofile, "showpage\n"); + if (pcl && page > 1) fprintf(ofile, "\f"); + /* new page */ + if (ps) fprintf(ofile, "%%%%Page: %i %i\n\n",page,page); + } + } + + /* + * Create a barcode item. This allows to set the margin to 0, as + * we have [xy]imargin to use. But don't use Encode_and_Print(), + * unroll it here instead + */ + bc = Barcode_Create(line); + if (!bc) { + fprintf(stderr, "%s: Barcode_Create(): %s\n", argv[0], + strerror(errno)); + exit(1); + } + bc->margin = 0; + if ( (Barcode_Position(bc, code_width, code_height, + xmargin0 + ximargin + x * xstep, + ymargin0 + yimargin + y * ystep, 0.0) < 0) + || (Barcode_Encode(bc, flags) < 0) + || (Barcode_Print(bc, ofile, flags) < 0) ) { + fprintf(stderr, "%s: can't encode \"%s\": %s\n", argv[0], + line, strerror(bc->error)); + } + Barcode_Delete(bc); + } + if (ps) fprintf(ofile, "showpage\n\n%%%%Trailer\n\n"); + if (pcl) fprintf(ofile, "\f"); + } + return 0; +} + + + diff --git a/glabels1/barcode-0.98/msi.c b/glabels1/barcode-0.98/msi.c new file mode 100644 index 00000000..77a373b2 --- /dev/null +++ b/glabels1/barcode-0.98/msi.c @@ -0,0 +1,155 @@ +/* + * msi.c -- encoding for MSI-Plessey + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* Patterns */ +static char *patterns[] = { "13", "31" }; + +static char *fillers[] = { "031", "131" }; + +static int width = 16 /* each character uses 4 patterns */, + startpos = 6 /* length of the first filler */; + +/* + * Check that the text can be encoded. Returns 0 or -1. + */ +int Barcode_msi_verify(unsigned char *text) +{ + int i; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + if (!isdigit(text[i])) + return -1; + } + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr, "%s%s%s%s", + patterns[(code >> 3) & 1], + patterns[(code >> 2) & 1], + patterns[(code >> 1) & 1], + patterns[code & 1]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_msi_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *ptr, *textptr; + int i, code, textpos, usesum, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("msi"); + + if ((bc->flags & BARCODE_NO_CHECKSUM)) + usesum = 0; + else + usesum = 1; + + text = bc->ascii; + + /* the partial code is head + 8 * (text + check) + tail + margin + term. */ + partial = malloc( 3 + 8 * (strlen(text) + 1) + 3 + 2 ); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = startpos; + + for (i=0; ipartial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels1/barcode-0.98/pcl.c b/glabels1/barcode-0.98/pcl.c new file mode 100644 index 00000000..d5ec097a --- /dev/null +++ b/glabels1/barcode-0.98/pcl.c @@ -0,0 +1,200 @@ +/* + * pcl.c -- printing the "partial" bar encoding in PCL format + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2001 Andrea Scopece (a.scopece@tin.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ + + +/* + * How do the "partial" and "textinfo" strings work? See file "ps.c" + */ + + +int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f) +{ + int i, j, k, barlen; + double f1, f2, fsav=0; + int mode = '-'; /* text below bars */ + double scalef=1, xpos, x0, y0, yr; + unsigned char *ptr; + unsigned char c; + + char font_id[6]; /* default font, should be "scalable" */ + /* 0 Line printer, use on older LJet II, isn't scalable */ + /* 4148 Univers, use on LJet III series, and Lj 4L, 5L */ + /* 16602 Arial, default LJ family 4, 5, 6, Color, Djet */ + + if (!bc->partial || !bc->textinfo) { + bc->error = EINVAL; + return -1; + } + + /* + * Maybe this first part can be made common to several printing back-ends, + * we'll see how that works when other ouput engines are added + */ + + /* First, calculate barlen */ + barlen = bc->partial[0] - '0'; + for (ptr = bc->partial+1; *ptr; ptr++) + if (isdigit(*ptr)) + barlen += (*ptr - '0'); + else if (islower(*ptr)) + barlen += (*ptr - 'a'+1); + + /* The scale factor depends on bar length */ + if (!bc->scalef) { + if (!bc->width) bc->width = barlen; /* default */ + scalef = bc->scalef = (double)bc->width / (double)barlen; + } + + /* The width defaults to "just enough" */ + if (!bc->width) bc->width = barlen * scalef +1; + + /* But it can be too small, in this case enlarge and center the area */ + if (bc->width < barlen * scalef) { + int wid = barlen * scalef + 1; + bc->xoff -= (wid - bc->width)/2 ; + bc->width = wid; + /* Can't extend too far on the left */ + if (bc->xoff < 0) { + bc->width += -bc->xoff; + bc->xoff = 0; + } + } + + /* The height defaults to 80 points (rescaled) */ + if (!bc->height) bc->height = 80 * scalef; + +#if 0 + /* If too small (5 + text), enlarge and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + int hei = i * scalef; + bc->yoff -= (hei-bc->height)/2; + bc->height = hei; + if (bc->yoff < 0) { + bc->height += -bc->yoff; + bc->yoff = 0; + } + } +#else + /* If too small (5 + text), reduce the scale factor and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + double scaleg = ((double)bc->height) / i; + int wid = bc->width * scaleg / scalef; + bc->xoff += (bc->width - wid)/2; + bc->width = wid; + scalef = scaleg; + } +#endif + + /* + * deal with PCL output + */ + + xpos = bc->margin + (bc->partial[0]-'0') * scalef; + for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { + /* special cases: '+' and '-' */ + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; /* don't count it */ i++; continue; + } + + /* j is the width of this bar/space */ + if (isdigit (*ptr)) j = *ptr-'0'; + else j = *ptr-'a'+1; + if (i%2) { /* bar */ + x0 = bc->xoff + xpos; + y0 = bc->yoff + bc->margin; + yr = bc->height; + if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 points or five points */ + yr -= (isdigit(*ptr) ? 10 : 5) * scalef; + } else { /* '+' */ + /* text above bars: 10 or 0 from bottom, and 10 from top */ + y0 += (isdigit(*ptr) ? 10 : 0) * scalef; + yr -= (isdigit(*ptr) ? 20 : 10) * scalef; + } + } + + fprintf(f,"%c&a%.0fH", 27, x0 * 10.0); + fprintf(f,"%c&a%.0fV", 27, y0 * 10.0); + fprintf(f,"%c*c%.0fH", 27, ((j*scalef)-SHRINK_AMOUNT) * 10.0); + fprintf(f,"%c*c%.0fV", 27, yr * 10.0); + fprintf(f,"%c*c0P\n", 27); + } + xpos += j * scalef; + } + + /* the text */ + + mode = '-'; /* reinstantiate default */ + if (!(bc->flags & BARCODE_NO_ASCII)) { + k=0; /* k is the "previous font size" */ + for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { + while (*ptr == ' ') ptr++; + if (!*ptr) break; + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; continue; + } + if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + fprintf(stderr, "barcode: impossible data: %s\n", ptr); + continue; + } + + /* select a Scalable Font */ + + if (fsav != f2) + { + if ((bc->flags & BARCODE_OUT_PCL_III) == BARCODE_OUT_PCL_III) + { strcpy(font_id, "4148"); /* font Univers */ + } + else + { strcpy(font_id, "16602"); /* font Arial */ + } + + fprintf(f,"%c(8U%c(s1p%5.2fv0s0b%sT", 27, 27, f2 * scalef, font_id); + } + fsav = f2; + + fprintf(f,"%c&a%.0fH", 27, (bc->xoff + f1 * scalef + bc->margin) * 10.0); + fprintf(f,"%c&a%.0fV", 27, + mode != '-' + ? ((double)bc->yoff + bc->margin + 8*scalef) * 10.0 + : ((double)bc->yoff + bc->margin + bc->height ) * 10.0); + + fprintf(f, "%c", c); + } + + } + + return 0; +} diff --git a/glabels1/barcode-0.98/plessey.c b/glabels1/barcode-0.98/plessey.c new file mode 100644 index 00000000..ec471005 --- /dev/null +++ b/glabels1/barcode-0.98/plessey.c @@ -0,0 +1,164 @@ +/* + * plessey.c -- encoding for Plessey + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +static char * patterns[] = { "13", "31" }; + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789" "ABCDEF"; + +/* stop sequence may be 231311313 (barcodemill.com) */ +static char *fillers[] = { "031311331", "331311313" }; + +static int width = 16, startpos = 16; + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it + */ +int Barcode_pls_verify(unsigned char *text) +{ + int i, upper = 0, lower = 0; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + if (!strchr(alphabet,toupper(text[i]))) + return -1; + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + } + if (upper && lower) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr, "%s%s%s%s", + patterns[code & 1], + patterns[(code >> 1) & 1], + patterns[(code >> 2) & 1], + patterns[(code >> 3) & 1] + ); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_pls_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + unsigned char *checkptr; + int i, code, textpos; + static char check[9] = {1,1,1,1,0,1,0,0,1}; + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("plessey"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 8 * (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 4) * 8 + 3); + checkptr = calloc (1, strlen(text) * 4 + 8); + + if (!partial || !checkptr) { + if (partial) free(partial); + if (checkptr) free(checkptr); + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = startpos; + + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + + textpos += width; /* width of each code */ + textptr += strlen(textptr); + ptr += strlen(ptr); + checkptr[4*i] = code & 1; + checkptr[4*i+1] = (code >> 1) & 1; + checkptr[4*i+2] = (code >> 2) & 1; + checkptr[4*i+3] = (code >> 3) & 1; + } + /* The CRC checksum is required */ + for (i=0; i < 4*strlen(text); i++) { + int j; + if (checkptr[i]) + for (j = 0; j < 9; j++) + checkptr[i+j] ^= check[j]; + } + for (i = 0; i < 8; i++) { + sprintf(ptr, patterns[checkptr[strlen(text) * 4 + i]]); + ptr += 2; + } + fprintf(stderr, "CRC: "); + for (i = 0; i < 8; i++) { + fputc('0' + checkptr[strlen(text) * 4 + i], stderr); + } + fputc('\n', stderr); + strcpy(ptr, fillers[1]); + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels1/barcode-0.98/ps.c b/glabels1/barcode-0.98/ps.c new file mode 100644 index 00000000..35917517 --- /dev/null +++ b/glabels1/barcode-0.98/ps.c @@ -0,0 +1,272 @@ +/* + * ps.c -- printing the "partial" bar encoding + * + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ + + +/* + * How do the "partial" and "textinfo" strings work? + * + * The first char in "partial" tells how much extra space to add to the + * left of the bars. For EAN-13, it is used to leave space to print the + * first digit, other codes may have '0' for no-extra-space-needed. + * + * The next characters are alternating bars and spaces, as multiples + * of the base dimension which is 1 unless the code is + * rescaled. Rescaling is calculated as the ratio from the requested + * width and the calculated width. Digits represent bar/space + * dimensions. Lower-case letters represent those bars that should + * extend lower than the others: 'a' is equivalent to '1', 'b' is '2' and + * so on. + * + * The "textinfo" string is made up of fields "%lf:%lf:%c" separated by + * blank space. The first integer is the x position of the character, + * the second is the font size (before rescaling) and the char item is + * the charcter to be printed. + * + * Both the "partial" and "textinfo" strings may include "-" or "+" as + * special characters (in "textinfo" the char should be a standalone + * word). They state where the text should be printed: below the bars + * ("-", default) or above the bars. This is used, for example, to + * print the add-5 and add-2 codes to the right of UPC or EAN codes + * (the add-5 extension is mostly used in ISBN codes. + */ + + +int Barcode_ps_print(struct Barcode_Item *bc, FILE *f) +{ + int i, j, k, barlen, printable=1; + double f1, f2, fsav=0; + int mode = '-'; /* text below bars */ + double scalef=1, xpos, x0, y0, yr; + unsigned char *ptr; + unsigned char c; + + if (!bc->partial || !bc->textinfo) { + bc->error = EINVAL; + return -1; + } + + + /* + * Maybe this first part can be made common to several printing back-ends, + * we'll see how that works when other ouput engines are added + */ + + /* First, calculate barlen */ + barlen = bc->partial[0] - '0'; + for (ptr = bc->partial+1; *ptr; ptr++) + if (isdigit(*ptr)) + barlen += (*ptr - '0'); + else if (islower(*ptr)) + barlen += (*ptr - 'a'+1); + + /* The scale factor depends on bar length */ + if (!bc->scalef) { + if (!bc->width) bc->width = barlen; /* default */ + scalef = bc->scalef = (double)bc->width / (double)barlen; + } + + /* The width defaults to "just enough" */ + if (!bc->width) bc->width = barlen * scalef +1; + + /* But it can be too small, in this case enlarge and center the area */ + if (bc->width < barlen * scalef) { + int wid = barlen * scalef + 1; + bc->xoff -= (wid - bc->width)/2 ; + bc->width = wid; + /* Can't extend too far on the left */ + if (bc->xoff < 0) { + bc->width += -bc->xoff; + bc->xoff = 0; + } + } + + /* The height defaults to 80 points (rescaled) */ + if (!bc->height) bc->height = 80 * scalef; + +#if 0 + /* If too small (5 + text), enlarge and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + int hei = i * scalef; + bc->yoff -= (hei-bc->height)/2; + bc->height = hei; + if (bc->yoff < 0) { + bc->height += -bc->yoff; + bc->yoff = 0; + } + } +#else + /* If too small (5 + text), reduce the scale factor and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + double scaleg = ((double)bc->height) / i; + int wid = bc->width * scaleg / scalef; + bc->xoff += (bc->width - wid)/2; + bc->width = wid; + scalef = scaleg; + } +#endif + + /* + * Ok, then deal with actual ps (eps) output + */ + + if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { /* spit a header first */ + if (bc->flags & BARCODE_OUT_EPS) + fprintf(f, "%%!PS-Adobe-2.0 EPSF-1.2\n"); + else + fprintf(f, "%%!PS-Adobe-2.0\n"); + fprintf(f, "%%%%Creator: libbarcode\n"); + if (bc->flags & BARCODE_OUT_EPS) { + fprintf(f, "%%%%BoundingBox: %i %i %i %i\n", + bc->xoff, + bc->yoff, + bc->xoff + bc->width + 2* bc->margin, + bc->yoff + bc->height + 2* bc->margin); + } + fprintf(f, "%%%%EndComments\n"); + if (bc->flags & BARCODE_OUT_PS) { + fprintf(f, "%%%%EndProlog\n\n"); + fprintf(f, "%%%%Page: 1 1\n\n"); + } + } + + /* 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", + printable ? bc->ascii : "", scalef); + if (bc->encoding) + fprintf(f,", encoded using \"%s\"",bc->encoding); + fprintf(f, "\n"); + fprintf(f,"%% The space/bar succession is represented " + "by the following widths (space first):\n" + "%% "); + for (i=0; ipartial); i++) { + unsigned char c = bc->partial[i]; + if (isdigit(c)) putc(c, f); + if (islower(c)) putc(c-'a'+'1', f); + if (isupper(c)) putc(c-'A'+'1', f); + } + /* open array for "forall" */ + fprintf(f, "\n[\n%% height xpos ypos width" + " height xpos ypos width\n"); + + xpos = bc->margin + (bc->partial[0]-'0') * scalef; + for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { + /* special cases: '+' and '-' */ + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; /* don't count it */ i++; continue; + } + /* j is the width of this bar/space */ + if (isdigit (*ptr)) j = *ptr-'0'; + else j = *ptr-'a'+1; + if (i%2) { /* bar */ + x0 = bc->xoff + xpos + (j*scalef)/2; + y0 = bc->yoff + bc->margin; + yr = bc->height; + if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 points or five points */ + y0 += (isdigit(*ptr) ? 10 : 5) * scalef; + yr -= (isdigit(*ptr) ? 10 : 5) * scalef; + } else { /* '+' */ + /* text above bars: 10 or 0 from bottom, and 10 from top */ + y0 += (isdigit(*ptr) ? 10 : 0) * scalef; + yr -= (isdigit(*ptr) ? 20 : 10) * scalef; + } + } + /* Define an array and then use "forall" (Hans Schou) */ + fprintf(f," [%5.2f %6.2f %6.2f %5.2f]%s", + yr, x0, y0, (j * scalef) - SHRINK_AMOUNT, + i%4 == 1 ? " " : "\n"); + } + xpos += j * scalef; + } + fprintf(f,"\n]\t{ {} forall setlinewidth moveto 0 exch rlineto stroke} " + "bind forall\n"); + + /* Then, the text */ + + mode = '-'; /* reinstantiate default */ + if (!(bc->flags & BARCODE_NO_ASCII)) { + fprintf(f, "[\n%% char xpos ypos fontsize\n"); + k=0; /* k is the "previous font size" */ + for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { + while (*ptr == ' ') ptr++; + if (!*ptr) break; + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; continue; + } + if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + fprintf(stderr, "barcode: impossible data: %s\n", ptr); + continue; + } + + fprintf(f, " [("); + /* Both the backslash and the two parens are special */ + if (c=='\\' || c==')' || c=='(') + fprintf(f, "\\%c) ", c); + else + fprintf(f, "%c) ", c); + fprintf(f, "%6.2f %6.2f %5.2f]\n", + bc->xoff + f1 * scalef + bc->margin, + mode == '-' + ? (double)bc->yoff + bc->margin + : (double)bc->yoff + bc->margin+bc->height - 8*scalef, + fsav == f2 ? 0.0 : f2 * scalef); + fsav = f2; + } + fprintf(f,"] { {} forall dup 0.00 ne {\n\t" + "/Helvetica findfont exch scalefont setfont\n" + " } {pop} ifelse\n" + " moveto show} bind forall\n"); + + + } + + fprintf(f,"%% End barcode for \"%s\"\n\n", + printable ? bc->ascii : ""); + + if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { + if (bc->flags & BARCODE_OUT_PS) { + fprintf(f,"showpage\n"); + fprintf(f, "%%%%Trailer\n\n"); + } + } + return 0; +} + + + + diff --git a/glabels1/barcode-0.98/sample.c b/glabels1/barcode-0.98/sample.c new file mode 100644 index 00000000..46e62058 --- /dev/null +++ b/glabels1/barcode-0.98/sample.c @@ -0,0 +1,98 @@ +#include +#include + +#include "barcode.h" + +int main(int argc, char **argv) +{ + int ps = 1, pcl = 0, oflags; + if (argc == 2 && !strcmp(argv[1],"-P")) { + ps = 0; pcl = 1; argc=1; + } + if (argc>2) { + fprintf(stderr, "%s: use \"%s\" for postscript or \"%s -P\" for PCL\n", + argv[0], argv[0], argv[0]); + exit(1); + } + if (pcl) { + oflags = BARCODE_OUT_PCL; + } else { + oflags = BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; + printf("%%!PS-Adobe-2.0\n"); + printf("%%%%Creator: barcode sample program\n"); + printf("%%%%EndComments\n"); + printf("%%%%EndProlog\n\n"); + printf("%%%%Page: 1 1\n\n"); + } + /* Print a few barcodes in several places in the page */ + + /* default size, bottom left */ + Barcode_Encode_and_Print("800894002700",stdout, 0, 0, 40, 40, + BARCODE_EAN | oflags); + + /* smaller */ + Barcode_Encode_and_Print("800894002700",stdout, 70, 50, 160, 55, + BARCODE_EAN | oflags); + + /* smallest */ + Barcode_Encode_and_Print("800894002700",stdout, 40, 30, 270, 70, + BARCODE_EAN | oflags); + + /* A bigger all-0 */ + Barcode_Encode_and_Print("000000000000",stdout, 170, 0, 40, 160, + BARCODE_EAN | oflags); + + /* Still bigger all-0 (but UPC, this time) */ + Barcode_Encode_and_Print("00000000000",stdout, 250, 0, 270, 160, + BARCODE_UPC | oflags); + + /* A few code-39 ones */ + Barcode_Encode_and_Print("silly code",stdout, 0, 0, 40, 320, + BARCODE_39 | oflags); + Barcode_Encode_and_Print("SAMPLE CODES",stdout, 100, 30, 400, 80, + BARCODE_39 | oflags); + + /* ISBN with add-5 */ + Barcode_Encode_and_Print("1-56592-292-1 90000",stdout, 0, 0, 40, 430, + BARCODE_ISBN | oflags); + + /* UPC with add-2 */ + Barcode_Encode_and_Print("07447084452 07",stdout, 0, 0, 300, 410, + BARCODE_UPC | oflags); + + /* code 128-C */ + Barcode_Encode_and_Print("12345678900123456789",stdout, 0, 0, 40, 530, + BARCODE_128C | oflags); + + /* and my data as code-128B autodetected */ + Barcode_Encode_and_Print("RBNLSN68T11E897W",stdout, 0, 60, 240, 510, + oflags); + /* same as code-39, forced */ + Barcode_Encode_and_Print("RBNLSN68T11E897W",stdout, 0, 60, 240, 590, + BARCODE_NO_CHECKSUM | BARCODE_39 | oflags); + + /* one interleaved 2 of 5 */ + Barcode_Encode_and_Print("0123456789",stdout, 0, 0, 40, 620, + BARCODE_I25 | oflags); + + /* upc-e and ean-8 (autotected based on code size) */ + Barcode_Encode_and_Print("012345",stdout, 0, 0, 50, 720, oflags); + Barcode_Encode_and_Print("0123456",stdout, 0, 0, 160, 720, oflags); + + + + if (pcl) { + printf("\f"); + } else { + printf("\nshowpage\n"); + printf("%%%%Trailer\n\n"); + } + return 0; +} + + + + + + +