-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbarcode.h
More file actions
128 lines (109 loc) · 4.04 KB
/
barcode.h
File metadata and controls
128 lines (109 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* barcode.h -- definitions for libbarcode
*
* Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org)
* Copyright (c) 1999 Prosa Srl. (prosa@prosa.it)
* Copyright (c) 2010 Giuseppe Scrivano <gscrivano@gnu.org>
* Copyright (c) 2010, 2011 Giuseppe Scrivano (gscrivano@gnu.org)
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _BARCODE_H_
#define _BARCODE_H_
#include "config.h"
#include <stdio.h>
#include <gettext.h>
#define _(X) gettext (X)
#define _N(X) (X)
/*
* 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_SVG 0x00010000
#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) */
BARCODE_11, /* code 11 (USD-8) */
BARCODE_39EXT /* code 39 extended (by Ian Ward) */
};
#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
int streaming;
#endif /* _BARCODE_H_ */