mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Add framework for Codablock
This commit is contained in:
parent
d7c60cf422
commit
4e13b0e95d
@ -7,7 +7,7 @@ find_package(PNG)
|
|||||||
set(zint_COMMON_SRCS common.c library.c render.c large.c reedsol.c gs1.c eci.c)
|
set(zint_COMMON_SRCS common.c library.c render.c large.c reedsol.c gs1.c eci.c)
|
||||||
set(zint_ONEDIM_SRCS code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c)
|
set(zint_ONEDIM_SRCS code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c)
|
||||||
set(zint_POSTAL_SRCS postal.c auspost.c imail.c)
|
set(zint_POSTAL_SRCS postal.c auspost.c imail.c)
|
||||||
set(zint_TWODIM_SRCS code16k.c dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c hanxin.c dotcode.c)
|
set(zint_TWODIM_SRCS code16k.c codablock.c dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c hanxin.c dotcode.c)
|
||||||
set(zint_OUTPUT_SRCS render.c ps.c svg.c bmp.c pcx.c gif.c png.c raster.c)
|
set(zint_OUTPUT_SRCS render.c ps.c svg.c bmp.c pcx.c gif.c png.c raster.c)
|
||||||
set(zint_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS})
|
set(zint_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS})
|
||||||
|
|
||||||
|
@ -187,6 +187,7 @@ extern int code_one(struct zint_symbol *symbol, unsigned char source[], int leng
|
|||||||
extern int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int length); /* Grid Matrix */
|
extern int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int length); /* Grid Matrix */
|
||||||
extern int han_xin(struct zint_symbol * symbol, const unsigned char source[], int length); /* Han Xin */
|
extern int han_xin(struct zint_symbol * symbol, const unsigned char source[], int length); /* Han Xin */
|
||||||
extern int dotcode(struct zint_symbol * symbol, const unsigned char source[], int length); /* DotCode */
|
extern int dotcode(struct zint_symbol * symbol, const unsigned char source[], int length); /* DotCode */
|
||||||
|
extern int codablock(struct zint_symbol * symbol, const unsigned char source[], int length); /* Codablock */
|
||||||
|
|
||||||
extern int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */
|
extern int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */
|
||||||
extern int render_plot(struct zint_symbol *symbol, float width, float height); /* Plot to gLabels */
|
extern int render_plot(struct zint_symbol *symbol, float width, float height); /* Plot to gLabels */
|
||||||
@ -349,6 +350,9 @@ int hibc(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
case BARCODE_HIBC_AZTEC:
|
case BARCODE_HIBC_AZTEC:
|
||||||
error_number = aztec(symbol, (unsigned char *) to_process, length);
|
error_number = aztec(symbol, (unsigned char *) to_process, length);
|
||||||
break;
|
break;
|
||||||
|
case BARCODE_HIBC_BLOCKF:
|
||||||
|
error_number = codablock(symbol, (unsigned char *) to_process, length);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return error_number;
|
return error_number;
|
||||||
@ -380,6 +384,7 @@ static int gs1_compliant(const int symbology) {
|
|||||||
case BARCODE_CODE49:
|
case BARCODE_CODE49:
|
||||||
case BARCODE_QRCODE:
|
case BARCODE_QRCODE:
|
||||||
case BARCODE_DOTCODE:
|
case BARCODE_DOTCODE:
|
||||||
|
case BARCODE_CODABLOCK:
|
||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -508,6 +513,7 @@ int ZBarcode_ValidID(int symbol_id) {
|
|||||||
case BARCODE_HIBC_PDF:
|
case BARCODE_HIBC_PDF:
|
||||||
case BARCODE_HIBC_MICPDF:
|
case BARCODE_HIBC_MICPDF:
|
||||||
case BARCODE_HIBC_AZTEC:
|
case BARCODE_HIBC_AZTEC:
|
||||||
|
case BARCODE_HIBC_BLOCKF:
|
||||||
case BARCODE_AZRUNE:
|
case BARCODE_AZRUNE:
|
||||||
case BARCODE_CODE32:
|
case BARCODE_CODE32:
|
||||||
case BARCODE_EANX_CC:
|
case BARCODE_EANX_CC:
|
||||||
@ -525,6 +531,7 @@ int ZBarcode_ValidID(int symbol_id) {
|
|||||||
case BARCODE_GRIDMATRIX:
|
case BARCODE_GRIDMATRIX:
|
||||||
case BARCODE_HANXIN:
|
case BARCODE_HANXIN:
|
||||||
case BARCODE_DOTCODE:
|
case BARCODE_DOTCODE:
|
||||||
|
case BARCODE_CODABLOCK:
|
||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -726,6 +733,8 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
|
|||||||
break;
|
break;
|
||||||
case BARCODE_HIBC_AZTEC: error_number = hibc(symbol, preprocessed, length);
|
case BARCODE_HIBC_AZTEC: error_number = hibc(symbol, preprocessed, length);
|
||||||
break;
|
break;
|
||||||
|
case BARCODE_HIBC_BLOCKF: error_number = hibc(symbol, preprocessed, length);
|
||||||
|
break;
|
||||||
case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed, length);
|
case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed, length);
|
||||||
break;
|
break;
|
||||||
case BARCODE_CODE49: error_number = code_49(symbol, preprocessed, length);
|
case BARCODE_CODE49: error_number = code_49(symbol, preprocessed, length);
|
||||||
@ -748,6 +757,8 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
|
|||||||
break;
|
break;
|
||||||
case BARCODE_DOTCODE: error_number = dotcode(symbol, preprocessed, length);
|
case BARCODE_DOTCODE: error_number = dotcode(symbol, preprocessed, length);
|
||||||
break;
|
break;
|
||||||
|
case BARCODE_CODABLOCK: error_number = codablock(symbol, preprocessed, length);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return error_number;
|
return error_number;
|
||||||
@ -843,8 +854,8 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->symbology = BARCODE_AUSPOST;
|
symbol->symbology = BARCODE_AUSPOST;
|
||||||
}
|
}
|
||||||
if (symbol->symbology == 73) {
|
if (symbol->symbology == 73) {
|
||||||
strcpy(symbol->errtxt, "Codablock E not supported");
|
symbol->symbology = BARCODE_CODABLOCK;
|
||||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
symbol->input_mode = GS1_MODE;
|
||||||
}
|
}
|
||||||
if (symbol->symbology == 78) {
|
if (symbol->symbology == 78) {
|
||||||
symbol->symbology = BARCODE_RSS14;
|
symbol->symbology = BARCODE_RSS14;
|
||||||
@ -905,10 +916,6 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
if ((symbol->symbology == BARCODE_CODABLOCKF) || (symbol->symbology == BARCODE_HIBC_BLOCKF)) {
|
|
||||||
strcpy(symbol->errtxt, "Codablock F not supported");
|
|
||||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error_number > 4) {
|
if (error_number > 4) {
|
||||||
error_tag(symbol->errtxt, error_number);
|
error_tag(symbol->errtxt, error_number);
|
||||||
|
@ -143,7 +143,7 @@ extern "C" {
|
|||||||
#define BARCODE_RM4SCC 70
|
#define BARCODE_RM4SCC 70
|
||||||
#define BARCODE_DATAMATRIX 71
|
#define BARCODE_DATAMATRIX 71
|
||||||
#define BARCODE_EAN14 72
|
#define BARCODE_EAN14 72
|
||||||
#define BARCODE_CODABLOCKF 74
|
#define BARCODE_CODABLOCK 74
|
||||||
#define BARCODE_NVE18 75
|
#define BARCODE_NVE18 75
|
||||||
#define BARCODE_JAPANPOST 76
|
#define BARCODE_JAPANPOST 76
|
||||||
#define BARCODE_KOREAPOST 77
|
#define BARCODE_KOREAPOST 77
|
||||||
|
@ -37,34 +37,35 @@
|
|||||||
|
|
||||||
/* Print list of supported symbologies */
|
/* Print list of supported symbologies */
|
||||||
void types(void) {
|
void types(void) {
|
||||||
printf( " 1: Code 11 51: Pharma One-Track 90: KIX Code\n"
|
printf( " 1: Code 11 52: PZN 92: Aztec Code\n"
|
||||||
" 2: Standard 2of5 52: PZN 92: Aztec Code\n"
|
" 2: Standard 2of5 53: Pharma Two-Track 93: DAFT Code\n"
|
||||||
" 3: Interleaved 2of5 53: Pharma Two-Track 93: DAFT Code\n"
|
" 3: Interleaved 2of5 55: PDF417 97: Micro QR Code\n"
|
||||||
" 4: IATA 2of5 55: PDF417 97: Micro QR Code\n"
|
" 4: IATA 2of5 56: PDF417 Trunc 98: HIBC Code 128\n"
|
||||||
" 6: Data Logic 56: PDF417 Trunc 98: HIBC Code 128\n"
|
" 6: Data Logic 57: Maxicode 99: HIBC Code 39\n"
|
||||||
" 7: Industrial 2of5 57: Maxicode 99: HIBC Code 39\n"
|
" 7: Industrial 2of5 58: QR Code 102: HIBC Data Matrix\n"
|
||||||
" 8: Code 39 58: QR Code 102: HIBC Data Matrix\n"
|
" 8: Code 39 60: Code 128-B 104: HIBC QR Code\n"
|
||||||
" 9: Extended Code 39 60: Code 128-B 104: HIBC QR Code\n"
|
" 9: Extended Code 39 63: AP Standard Customer 106: HIBC PDF417\n"
|
||||||
"13: EAN 63: AP Standard Customer 106: HIBC PDF417\n"
|
"13: EAN 66: AP Reply Paid 108: HIBC MicroPDF417\n"
|
||||||
"16: GS1-128 66: AP Reply Paid 108: HIBC MicroPDF417\n"
|
"16: GS1-128 67: AP Routing 112: HIBC Aztec Code\n"
|
||||||
"18: Codabar 67: AP Routing 112: HIBC Aztec Code\n"
|
"18: Codabar 68: AP Redirection 115: DotCode\n"
|
||||||
"20: Code 128 68: AP Redirection 115: DotCode\n"
|
"20: Code 128 69: ISBN 116: Han Xin Code\n"
|
||||||
"21: Leitcode 69: ISBN 116: Han Xin Code\n"
|
"21: Leitcode 70: RM4SCC 128: Aztec Runes\n"
|
||||||
"22: Identcode 70: RM4SCC 128: Aztec Runes\n"
|
"22: Identcode 71: Data Matrix 129: Code 32\n"
|
||||||
"23: Code 16k 71: Data Matrix 129: Code 32\n"
|
"23: Code 16k 72: EAN-14 130: Comp EAN\n"
|
||||||
"24: Code 49 72: EAN-14 130: Comp EAN\n"
|
"24: Code 49 74: Codablock 131: Comp GS1-128\n"
|
||||||
"25: Code 93 75: NVE-18 131: Comp GS1-128\n"
|
"25: Code 93 75: NVE-18 132: Comp DataBar Omni\n"
|
||||||
"28: Flattermarken 76: Japanese Post 132: Comp DataBar Omni\n"
|
"28: Flattermarken 76: Japanese Post 133: Comp DataBar Ltd\n"
|
||||||
"29: GS1 DataBar Omni 77: Korea Post 133: Comp DataBar Ltd\n"
|
"29: GS1 DataBar Omni 77: Korea Post 134: Comp DataBar ExpOm\n"
|
||||||
"30: GS1 DataBar Ltd 79: GS1 DataBar Stack 134: Comp DataBar ExpOm\n"
|
"30: GS1 DataBar Ltd 79: GS1 DataBar Stack 135: Comp UPC-A\n"
|
||||||
"31: GS1 DataBar ExpOm 80: GS1 DataBar Stack Omni 135: Comp UPC-A\n"
|
"31: GS1 DataBar ExpOm 80: GS1 DataBar Stack Omni 136: Comp UPC-E\n"
|
||||||
"32: Telepen Alpha 81: GS1 DataBar ESO 136: Comp UPC-E\n"
|
"32: Telepen Alpha 81: GS1 DataBar ESO 137: Comp DataBar Stack\n"
|
||||||
"34: UPC-A 82: Planet 137: Comp DataBar Stack\n"
|
"34: UPC-A 82: Planet 138: Comp DataBar Stack Omni\n"
|
||||||
"37: UPC-E 84: MicroPDF 138: Comp DataBar Stack Omni\n"
|
"37: UPC-E 84: MicroPDF 139: Comp DataBar ESO\n"
|
||||||
"40: Postnet 85: USPS OneCode 139: Comp DataBar ESO\n"
|
"40: Postnet 85: USPS OneCode 140: Channel Code\n"
|
||||||
"47: MSI Plessey 86: UK Plessey 140: Channel Code\n"
|
"47: MSI Plessey 86: UK Plessey 141: Code One\n"
|
||||||
"49: FIM 87: Telepen Numeric 141: Code One\n"
|
"49: FIM 87: Telepen Numeric 142: Grid Matrix\n"
|
||||||
"50: Logmars 89: ITF-14 142: Grid Matrix\n"
|
"50: Logmars 89: ITF-14\n"
|
||||||
|
"51: Pharma One-Track 90: KIX Code\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ void usage(void) {
|
|||||||
" --dump Dump hexadecimal representation to stdout\n"
|
" --dump Dump hexadecimal representation to stdout\n"
|
||||||
" --rotate=NUMBER Rotate symbol (PNG output only).\n"
|
" --rotate=NUMBER Rotate symbol (PNG output only).\n"
|
||||||
" --cols=NUMBER (PDF417) Number of columns.\n"
|
" --cols=NUMBER (PDF417) Number of columns.\n"
|
||||||
" --vers=NUMBER (QR Code) Version\n"
|
" --vers=NUMBER (QR Code or Han Xin) Version\n"
|
||||||
" --secure=NUMBER (PDF417 and QR Code) Error correction level.\n"
|
" --secure=NUMBER (PDF417 and QR Code) Error correction level.\n"
|
||||||
" --primary=STRING (Maxicode and Composite) Structured primary message.\n"
|
" --primary=STRING (Maxicode and Composite) Structured primary message.\n"
|
||||||
" --mode=NUMBER (Maxicode and Composite) Set encoding mode.\n"
|
" --mode=NUMBER (Maxicode and Composite) Set encoding mode.\n"
|
||||||
@ -624,10 +625,10 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!strcmp(long_options[option_index].name, "vers")) {
|
if (!strcmp(long_options[option_index].name, "vers")) {
|
||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 47)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 84)) {
|
||||||
my_symbol->option_2 = atoi(optarg);
|
my_symbol->option_2 = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Invalid QR Code version\n");
|
fprintf(stderr, "Invalid Version\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
|||||||
"Aztec Runes",
|
"Aztec Runes",
|
||||||
"Channel Code",
|
"Channel Code",
|
||||||
"Codabar",
|
"Codabar",
|
||||||
|
"Codablock",
|
||||||
"Code 11",
|
"Code 11",
|
||||||
"Code 128 (ISO 15417)",
|
"Code 128 (ISO 15417)",
|
||||||
"Code 16k",
|
"Code 16k",
|
||||||
@ -70,7 +71,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
|||||||
"GS1 DataBar Stacked",
|
"GS1 DataBar Stacked",
|
||||||
"GS1 DataBar Stacked Omnidirectional",
|
"GS1 DataBar Stacked Omnidirectional",
|
||||||
"Han Xin (Chinese Sensible) Code",
|
"Han Xin (Chinese Sensible) Code",
|
||||||
"ITF-14",
|
"ITF-14",
|
||||||
"International Standard Book Number (ISBN)",
|
"International Standard Book Number (ISBN)",
|
||||||
"Japanese Postal Barcode",
|
"Japanese Postal Barcode",
|
||||||
"Korean Postal Barcode",
|
"Korean Postal Barcode",
|
||||||
@ -108,7 +109,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
|||||||
bstyle->addItem(metaObject()->enumerator(0).key(i));
|
bstyle->addItem(metaObject()->enumerator(0).key(i));
|
||||||
bstyle->setItemText(i,bstyle_text[i]);
|
bstyle->setItemText(i,bstyle_text[i]);
|
||||||
}
|
}
|
||||||
bstyle->setCurrentIndex(9);
|
bstyle->setCurrentIndex(10);
|
||||||
change_options();
|
change_options();
|
||||||
update_preview();
|
update_preview();
|
||||||
view->scene()->addItem(&m_bc);
|
view->scene()->addItem(&m_bc);
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
AZRUNE =128,
|
AZRUNE =128,
|
||||||
CHANNEL =140,
|
CHANNEL =140,
|
||||||
CODABAR =18,
|
CODABAR =18,
|
||||||
|
CODABLOCK =74,
|
||||||
CODE11 =1,
|
CODE11 =1,
|
||||||
CODE128 =20,
|
CODE128 =20,
|
||||||
CODE16K =23,
|
CODE16K =23,
|
||||||
|
Loading…
Reference in New Issue
Block a user