From ca24105ca07a4c2d38d0db73a083d3a07fb520d6 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Thu, 21 Mar 2019 09:14:24 +0000 Subject: [PATCH] Add placeholder for Ultracode --- backend/CMakeLists.txt | 2 +- backend/library.c | 7 ++++++- backend/ultra.c | 41 +++++++++++++++++++++++++++++++++++++++++ backend/zint.h | 1 + 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 backend/ultra.c diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index 7a94fe1a..11f2dd82 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -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_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_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_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS}) diff --git a/backend/library.c b/backend/library.c index 42e8cc6c..e4b33f16 100644 --- a/backend/library.c +++ b/backend/library.c @@ -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 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 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_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_GRIDMATRIX: case BARCODE_HANXIN: + case BARCODE_ULTRA: result = 1; break; } @@ -565,6 +567,7 @@ int ZBarcode_ValidID(int symbol_id) { case BARCODE_UPNQR: case BARCODE_VIN: case BARCODE_MAILMARK: + case BARCODE_ULTRA: result = 1; break; } @@ -788,6 +791,8 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour break; case BARCODE_MAILMARK: error_number = mailmark(symbol, preprocessed, in_length); break; + case BARCODE_ULTRA: error_number = ultracode(symbol, preprocessed, in_length); + break; } 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 */ - if (symbol->symbology >= 144) { + if (symbol->symbology >= 145) { strcpy(symbol->errtxt, "216: Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; diff --git a/backend/ultra.c b/backend/ultra.c new file mode 100644 index 00000000..da5cfb38 --- /dev/null +++ b/backend/ultra.c @@ -0,0 +1,41 @@ +/* ultra.c - Ultracode + + libzint - the open source barcode library + Copyright (C) 2019 Robin Stuart + + 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 +#include +#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; +} diff --git a/backend/zint.h b/backend/zint.h index 830814a3..1886a1a7 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -241,6 +241,7 @@ extern "C" { #define BARCODE_CODEONE 141 #define BARCODE_GRIDMATRIX 142 #define BARCODE_UPNQR 143 +#define BARCODE_ULTRA 144 // Output options #define BARCODE_NO_ASCII 1