From 13a8a80136f2e76640d9260a5d90f71df91cfd90 Mon Sep 17 00:00:00 2001 From: hooper114 Date: Tue, 3 Nov 2009 10:54:21 +0000 Subject: [PATCH] Update to HIBC allows Aztec Code encoding --- backend/library.c | 7 ++++++- backend/zint.h | 1 + frontend/main.c | 34 ++++++++++++++++------------------ 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/backend/library.c b/backend/library.c index 0ff059b2..07f0a2cc 100644 --- a/backend/library.c +++ b/backend/library.c @@ -229,6 +229,9 @@ int hibc(struct zint_symbol *symbol, unsigned char source[], int length) case BARCODE_HIBC_BLOCKF: error_number = codablock(symbol, (unsigned char *)to_process, length); break; + case BARCODE_HIBC_AZTEC: + error_number = aztec(symbol, (unsigned char *)to_process, length); + break; } return error_number; @@ -343,6 +346,7 @@ int ZBarcode_ValidID(int symbol_id) case BARCODE_HIBC_PDF: case BARCODE_HIBC_MICPDF: case BARCODE_HIBC_BLOCKF: + case BARCODE_HIBC_AZTEC: case BARCODE_AZRUNE: case BARCODE_CODE32: case BARCODE_EANX_CC: @@ -485,6 +489,7 @@ int reduced_charset(struct zint_symbol *symbol, unsigned char *source, int lengt case BARCODE_HIBC_PDF: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_HIBC_MICPDF: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_HIBC_BLOCKF: error_number = hibc(symbol, preprocessed, length); break; + case BARCODE_HIBC_AZTEC: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed, length); break; case BARCODE_CODE49: error_number = code_49(symbol, preprocessed, length); break; case BARCODE_CHANNEL: error_number = channel_code(symbol, preprocessed, length); break; @@ -555,7 +560,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt if(symbol->symbology == 107) { symbol->symbology = BARCODE_HIBC_PDF; } if(symbol->symbology == 109) { symbol->symbology = BARCODE_HIBC_MICPDF; } if(symbol->symbology == 111) { symbol->symbology = BARCODE_HIBC_BLOCKF; } - if((symbol->symbology >= 112) && (symbol->symbology <= 127)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } + if((symbol->symbology >= 113) && (symbol->symbology <= 127)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } /* Everything from 128 up is Zint-specific */ if(symbol->symbology >= 143) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } diff --git a/backend/zint.h b/backend/zint.h index 304b38b2..65541ac5 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -121,6 +121,7 @@ struct zint_symbol { #define BARCODE_HIBC_PDF 106 #define BARCODE_HIBC_MICPDF 108 #define BARCODE_HIBC_BLOCKF 110 +#define BARCODE_HIBC_AZTEC 112 /* Zint specific */ #define BARCODE_AZRUNE 128 diff --git a/frontend/main.c b/frontend/main.c index c66df221..d00ed427 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -44,22 +44,22 @@ void types(void) { "16: GS1-128 66: AP Reply Paid 106: HIBC PDF417\n" "18: Codabar 67: AP Routing 108: HIBC MicroPDF417\n" "20: Code 128 68: AP Redirection 110: HIBC Codablock-F\n" - "21: Leitcode 69: ISBN 128: Aztec Runes\n" - "22: Identcode 70: RM4SCC 129: Code 23\n" - "23: Code 16k 71: Data Matrix 130: Comp EAN\n" - "24: Code 49 72: EAN-14 131: Comp GS1-128\n" - "25: Code 93 74: Codablock-F 132: Comp Databar-14\n" - "28: Flattermarken 75: NVE-18 133: Comp Databar Ltd\n" - "29: Databar-14 76: Japanese Post 134: Comp Databar Ext\n" - "30: Databar Limited 77: Korea Post 135: Comp UPC-A\n" - "31: Databar Extended 79: Databar-14 Stack 136: Comp UPC-E\n" - "32: Telepen Alpha 80: Databar-14 Stack Omni 137: Comp Databar-14 Stack\n" - "34: UPC-A 81: Databar Extended Stack 138: Comp Databar Stack Omni\n" - "37: UPC-E 82: Planet 139: Comp Databar Ext Stack\n" - "40: Postnet 84: MicroPDF 140: Channel Code\n" - "47: MSI Plessey 85: USPS OneCode 141: Code One\n" - "49: FIM 86: UK Plessey\n" - "50: Logmars 87: Telepen Numeric\n" + "21: Leitcode 69: ISBN 112: HIBC Aztec Code\n" + "22: Identcode 70: RM4SCC 128: Aztec Runes\n" + "23: Code 16k 71: Data Matrix 129: Code 23\n" + "24: Code 49 72: EAN-14 130: Comp EAN\n" + "25: Code 93 74: Codablock-F 131: Comp GS1-128\n" + "28: Flattermarken 75: NVE-18 132: Comp Databar-14\n" + "29: Databar-14 76: Japanese Post 133: Comp Databar Ltd\n" + "30: Databar Limited 77: Korea Post 134: Comp Databar Ext\n" + "31: Databar Extended 79: Databar-14 Stack 135: Comp UPC-A\n" + "32: Telepen Alpha 80: Databar-14 Stack Omni 136: Comp UPC-E\n" + "34: UPC-A 81: Databar Extended Stack 137: Comp Databar-14 Stack\n" + "37: UPC-E 82: Planet 138: Comp Databar Stack Omni\n" + "40: Postnet 84: MicroPDF 139: Comp Databar Ext Stack\n" + "47: MSI Plessey 85: USPS OneCode 140: Channel Code\n" + "49: FIM 86: UK Plessey 141: Code One\n" + "50: Logmars 87: Telepen Numeric 142: Grid Matrix\n" ); } @@ -93,8 +93,6 @@ void usage(void) " --primary=STRING (Maxicode and Composite) Structured primary message.\n" " --mode=NUMBER (Maxicode and Composite) Set encoding mode.\n" " --gs1 Treat input as GS1 data\n" - " --kanji Treat input as Kanji characters in Unicode\n" - " --sjis Treat input as Shift-JIS\n" " --binary Treat input as Binary data\n" , ZINT_VERSION); }