Add placeholder for Ultracode

This commit is contained in:
Robin Stuart 2019-03-21 09:14:24 +00:00
parent 7239d2249c
commit ca24105ca0
4 changed files with 49 additions and 2 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 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 mailmark.c) set(zint_POSTAL_SRCS postal.c auspost.c imail.c mailmark.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_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 ultra.c)
set(zint_OUTPUT_SRCS vector.c render.c ps.c svg.c emf.c bmp.c pcx.c gif.c png.c tif.c raster.c) set(zint_OUTPUT_SRCS vector.c render.c ps.c svg.c emf.c bmp.c pcx.c gif.c png.c tif.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})

View File

@ -179,6 +179,7 @@ extern int qr_code(struct zint_symbol *symbol, const unsigned char source[], siz
extern int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Data Matrix (IEC16022) */ extern int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Data Matrix (IEC16022) */
extern int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* VIN Code (Vehicle Identification Number) */ extern int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* VIN Code (Vehicle Identification Number) */
extern int mailmark(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Royal Mail 4-state Mailmark */ extern int mailmark(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Royal Mail 4-state Mailmark */
extern int ultracode(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Ultracode */
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 plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to EPS/EMF/SVG */ extern int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to EPS/EMF/SVG */
@ -460,6 +461,7 @@ static int supports_eci(const int symbology) {
case BARCODE_DOTCODE: case BARCODE_DOTCODE:
case BARCODE_GRIDMATRIX: case BARCODE_GRIDMATRIX:
case BARCODE_HANXIN: case BARCODE_HANXIN:
case BARCODE_ULTRA:
result = 1; result = 1;
break; break;
} }
@ -565,6 +567,7 @@ int ZBarcode_ValidID(int symbol_id) {
case BARCODE_UPNQR: case BARCODE_UPNQR:
case BARCODE_VIN: case BARCODE_VIN:
case BARCODE_MAILMARK: case BARCODE_MAILMARK:
case BARCODE_ULTRA:
result = 1; result = 1;
break; break;
} }
@ -788,6 +791,8 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
break; break;
case BARCODE_MAILMARK: error_number = mailmark(symbol, preprocessed, in_length); case BARCODE_MAILMARK: error_number = mailmark(symbol, preprocessed, in_length);
break; break;
case BARCODE_ULTRA: error_number = ultracode(symbol, preprocessed, in_length);
break;
} }
return error_number; return error_number;
@ -1054,7 +1059,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
} }
} }
/* Everything from 128 up is Zint-specific */ /* Everything from 128 up is Zint-specific */
if (symbol->symbology >= 144) { if (symbol->symbology >= 145) {
strcpy(symbol->errtxt, "216: Symbology out of range, using Code 128"); strcpy(symbol->errtxt, "216: Symbology out of range, using Code 128");
symbol->symbology = BARCODE_CODE128; symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION; error_number = ZINT_WARN_INVALID_OPTION;

41
backend/ultra.c Normal file
View File

@ -0,0 +1,41 @@
/* ultra.c - Ultracode
libzint - the open source barcode library
Copyright (C) 2019 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#include <stdio.h>
#include <string.h>
#include "common.h"
int ultracode(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) {
strcpy(symbol->errtxt, "1000: Ultracode has not been implemented - yet!");
return ZINT_ERROR_INVALID_OPTION;
}

View File

@ -241,6 +241,7 @@ extern "C" {
#define BARCODE_CODEONE 141 #define BARCODE_CODEONE 141
#define BARCODE_GRIDMATRIX 142 #define BARCODE_GRIDMATRIX 142
#define BARCODE_UPNQR 143 #define BARCODE_UPNQR 143
#define BARCODE_ULTRA 144
// Output options // Output options
#define BARCODE_NO_ASCII 1 #define BARCODE_NO_ASCII 1