1 /* 2 * barcode.h -- definitions for libbarcode 3 * 4 * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) 5 * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 */ 21 22 #ifndef _BARCODE_H_ 23 #define _BARCODE_H_ 24 25 #include <stdio.h> 26 27 #define BARCODE_VERSION "0.98" 28 #define BARCODE_VERSION_INT 9800 29 30 /* 31 * The object 32 */ 33 struct Barcode_Item { 34 int flags; /* type of encoding and decoding */ 35 char *ascii; /* malloced */ 36 char *partial; /* malloced too */ 37 char *textinfo; /* information about text positioning */ 38 char *encoding; /* code name, filled by encoding engine */ 39 int width, height; /* output units */ 40 int xoff, yoff; /* output units */ 41 int margin; /* output units */ 42 double scalef; /* requested scaling for barcode */ 43 int error; /* an errno-like value, in case of failure */ 44 }; 45 46 /* 47 * The flags field 48 */ 49 #define BARCODE_DEFAULT_FLAGS 0x00000000 50 51 #define BARCODE_ENCODING_MASK 0x000000ff /* 256 possibilites... */ 52 #define BARCODE_NO_ASCII 0x00000100 /* avoid text in output */ 53 #define BARCODE_NO_CHECKSUM 0x00000200 /* avoid checksum in output */ 54 55 #define BARCODE_OUTPUT_MASK 0x000ff000 /* 256 output types */ 56 #define BARCODE_OUT_EPS 0x00001000 57 #define BARCODE_OUT_PS 0x00002000 58 #define BARCODE_OUT_PCL 0x00004000 /* by Andrea Scopece */ 59 /* PCL_III 0x00008000 */ 60 #define BARCODE_OUT_PCL_III 0x0000C000 61 #define BARCODE_OUT_NOHEADERS 0x00100000 /* no header nor footer */ 62 63 enum { 64 BARCODE_ANY = 0, /* choose best-fit */ 65 BARCODE_EAN, 66 BARCODE_UPC, /* upc == 12-digit ean */ 67 BARCODE_ISBN, /* isbn numbers (still EAN13) */ 68 BARCODE_39, /* code 39 */ 69 BARCODE_128, /* code 128 (a,b,c: autoselection) */ 70 BARCODE_128C, /* code 128 (compact form for digits) */ 71 BARCODE_128B, /* code 128, full printable ascii */ 72 BARCODE_I25, /* interleaved 2 of 5 (only digits) */ 73 BARCODE_128RAW, /* Raw code 128 (by Leonid A. Broukhis) */ 74 BARCODE_CBR, /* Codabar (by Leonid A. Broukhis) */ 75 BARCODE_MSI, /* MSI (by Leonid A. Broukhis) */ 76 BARCODE_PLS, /* Plessey (by Leonid A. Broukhis) */ 77 BARCODE_93 /* code 93 (by Nathan D. Holmes) */ 78 }; 79 80 #define BARCODE_DEFAULT_MARGIN 10 81 82 #ifdef __cplusplus 83 extern "C" { 84 #endif 85 /* 86 * Create and destroy barcode structures 87 */ 88 extern struct Barcode_Item *Barcode_Create(char *text); 89 extern int Barcode_Delete(struct Barcode_Item *bc); 90 91 /* 92 * Encode and print 93 */ 94 extern int Barcode_Encode(struct Barcode_Item *bc, int flags); 95 extern int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags); 96 97 /* 98 * Choose the position 99 */ 100 extern int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, 101 int xoff, int yoff, double scalef); 102 103 /* 104 * Do it all in one step 105 */ 106 extern int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, 107 int xoff, int yoff, int flags); 108 109 110 /* 111 * Return current version (integer and string) 112 */ 113 extern int Barcode_Version(char *versionname); 114 115 #ifdef __cplusplus 116 } 117 #endif 118 119 #endif /* _BARCODE_H_ */ 120