Merge Dotcode

This commit is contained in:
Robin Stuart 2016-08-07 20:28:56 +01:00
commit 8029dec9c7
4 changed files with 1255 additions and 22 deletions

View File

@ -7,7 +7,7 @@ find_package(PNG)
set(zint_COMMON_SRCS common.c library.c render.c large.c reedsol.c gs1.c) set(zint_COMMON_SRCS common.c library.c render.c large.c reedsol.c gs1.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) 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_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})

1230
backend/dotcode.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -182,8 +182,9 @@ extern int channel_code(struct zint_symbol *symbol, unsigned char source[], int
extern int code_one(struct zint_symbol *symbol, unsigned char source[], int length); /* Code One */ extern int code_one(struct zint_symbol *symbol, unsigned char source[], int length); /* Code One */
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 plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG or BMP */ 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 */
extern int ps_plot(struct zint_symbol *symbol); /* Plot to EPS */ extern int ps_plot(struct zint_symbol *symbol); /* Plot to EPS */
extern int svg_plot(struct zint_symbol *symbol); /* Plot to SVG */ extern int svg_plot(struct zint_symbol *symbol); /* Plot to SVG */
@ -374,6 +375,7 @@ static int gs1_compliant(const int symbology) {
case BARCODE_CODEONE: case BARCODE_CODEONE:
case BARCODE_CODE49: case BARCODE_CODE49:
case BARCODE_QRCODE: case BARCODE_QRCODE:
case BARCODE_DOTCODE:
result = 1; result = 1;
break; break;
} }
@ -470,6 +472,7 @@ int ZBarcode_ValidID(int symbol_id) {
case BARCODE_CODEONE: case BARCODE_CODEONE:
case BARCODE_GRIDMATRIX: case BARCODE_GRIDMATRIX:
case BARCODE_HANXIN: case BARCODE_HANXIN:
case BARCODE_DOTCODE:
result = 1; result = 1;
break; break;
} }
@ -690,6 +693,8 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
break; break;
case BARCODE_AZTEC: error_number = aztec(symbol, preprocessed, length); case BARCODE_AZTEC: error_number = aztec(symbol, preprocessed, length);
break; break;
case BARCODE_DOTCODE: error_number = dotcode(symbol, preprocessed, length);
break;
} }
return error_number; return error_number;
@ -834,9 +839,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
error_number = ZINT_WARN_INVALID_OPTION; error_number = ZINT_WARN_INVALID_OPTION;
} }
if (symbol->symbology == 115) { if (symbol->symbology == 115) {
strcpy(symbol->errtxt, "Dot Code not supported"); symbol->symbology = BARCODE_DOTCODE;
symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION;
} }
if ((symbol->symbology >= 117) && (symbol->symbology <= 127)) { if ((symbol->symbology >= 117) && (symbol->symbology <= 127)) {
strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); strcpy(symbol->errtxt, "Symbology out of range, using Code 128");

View File

@ -48,23 +48,23 @@ void types(void) {
"13: EAN 63: AP Standard Customer 106: HIBC PDF417\n" "13: EAN 63: AP Standard Customer 106: HIBC PDF417\n"
"16: GS1-128 66: AP Reply Paid 108: HIBC MicroPDF417\n" "16: GS1-128 66: AP Reply Paid 108: HIBC MicroPDF417\n"
"18: Codabar 67: AP Routing 112: HIBC Aztec Code\n" "18: Codabar 67: AP Routing 112: HIBC Aztec Code\n"
"20: Code 128 68: AP Redirection 116: Han Xin Code\n" "20: Code 128 68: AP Redirection 115: DotCode\n"
"21: Leitcode 69: ISBN 128: Aztec Runes\n" "21: Leitcode 69: ISBN 116: Han Xin Code\n"
"22: Identcode 70: RM4SCC 129: Code 32\n" "22: Identcode 70: RM4SCC 128: Aztec Runes\n"
"23: Code 16k 71: Data Matrix 130: Comp EAN\n" "23: Code 16k 71: Data Matrix 129: Code 32\n"
"24: Code 49 72: EAN-14 131: Comp GS1-128\n" "24: Code 49 72: EAN-14 130: Comp EAN\n"
"25: Code 93 75: NVE-18 132: Comp DataBar Omni\n" "25: Code 93 75: NVE-18 131: Comp GS1-128\n"
"28: Flattermarken 76: Japanese Post 133: Comp DataBar Ltd\n" "28: Flattermarken 76: Japanese Post 132: Comp DataBar Omni\n"
"29: GS1 DataBar Omni 77: Korea Post 134: Comp DataBar ExpOm\n" "29: GS1 DataBar Omni 77: Korea Post 133: Comp DataBar Ltd\n"
"30: GS1 DataBar Ltd 79: GS1 DataBar Stack 135: Comp UPC-A\n" "30: GS1 DataBar Ltd 79: GS1 DataBar Stack 134: Comp DataBar ExpOm\n"
"31: GS1 DataBar ExpOm 80: GS1 DataBar Stack Omni 136: Comp UPC-E\n" "31: GS1 DataBar ExpOm 80: GS1 DataBar Stack Omni 135: Comp UPC-A\n"
"32: Telepen Alpha 81: GS1 DataBar ESO 137: Comp DataBar Stack\n" "32: Telepen Alpha 81: GS1 DataBar ESO 136: Comp UPC-E\n"
"34: UPC-A 82: Planet 138: Comp DataBar Stack Omni\n" "34: UPC-A 82: Planet 137: Comp DataBar Stack\n"
"37: UPC-E 84: MicroPDF 139: Comp DataBar ESO\n" "37: UPC-E 84: MicroPDF 138: Comp DataBar Stack Omni\n"
"40: Postnet 85: USPS OneCode 140: Channel Code\n" "40: Postnet 85: USPS OneCode 139: Comp DataBar ESO\n"
"47: MSI Plessey 86: UK Plessey 141: Code One\n" "47: MSI Plessey 86: UK Plessey 140: Channel Code\n"
"49: FIM 87: Telepen Numeric 142: Grid Matrix\n" "49: FIM 87: Telepen Numeric 141: Code One\n"
"50: Logmars 89: ITF-14\n" "50: Logmars 89: ITF-14 142: Grid Matrix\n"
); );
} }