mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-09 13:41:59 -04:00
Add symbology: DX Film Edge barcode
DX Film Edge barcodes are used 35 mm and APS films
This commit is contained in:
parent
1456af0e8b
commit
d13a3aaf1a
20 changed files with 680 additions and 9 deletions
|
@ -10,7 +10,7 @@ if(ZINT_USE_PNG)
|
|||
endif()
|
||||
|
||||
set(zint_COMMON_SRCS common.c library.c large.c reedsol.c gs1.c eci.c filemem.c general_field.c)
|
||||
set(zint_ONEDIM_SRCS bc412.c code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c)
|
||||
set(zint_ONEDIM_SRCS bc412.c code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c dxfilmedge.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 ultra.c)
|
||||
if(ZINT_USE_PNG AND PNG_FOUND)
|
||||
|
|
330
backend/dxfilmedge.c
Normal file
330
backend/dxfilmedge.c
Normal file
|
@ -0,0 +1,330 @@
|
|||
/* dxfilmedge.c - Handles DX Film Edge symbology */
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2024-2025 Antoine Merino <antoine.merino.dev@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.
|
||||
*/
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
/* DX Film Edge Barcode is used on 35mm and APS films:
|
||||
* https://en.wikipedia.org/wiki/DX_encoding
|
||||
*
|
||||
* A little information about decoding this symbology can be found at
|
||||
* https://www.merinorus.com/blog/identifying-manufacturer-35-mm-films/
|
||||
*
|
||||
* Partial specification and history can be found on this Kodak patent:
|
||||
* https://patents.google.com/patent/US4965628A/en
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
|
||||
#define DEBUG_STR_LEN 20
|
||||
/* Max length of the DX info part. Include the \0. Eg: "018500\0", "150-10\0" */
|
||||
#define MAX_DX_INFO_LENGTH 7
|
||||
/* Max length of the frame info part. Eg: "00A\0", "23A\0" */
|
||||
#define MAX_FRAME_INFO_LENGTH 4
|
||||
|
||||
void int_to_binary(int value, int width, char *output) {
|
||||
int i;
|
||||
for (i = 0; i < width; i++) {
|
||||
output[width - 1 - i] = (value & (1 << i)) ? '1' : '0';
|
||||
}
|
||||
output[width] = '\0';
|
||||
}
|
||||
|
||||
void str_to_uppercase(char *str) {
|
||||
int i;
|
||||
for (i = 0; str[i] != '\0'; i++) {
|
||||
str[i] = toupper(str[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int count_char_occurrences(const char *str, char target) {
|
||||
int i, count = 0;
|
||||
for (i = 0; str[i] != '\0'; i++) {
|
||||
if (str[i] == target) {
|
||||
count++;
|
||||
if (count > 1) {
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
int parse_dx_code(struct zint_symbol *symbol, const char *source, char *binary_output, int *output_length, bool *has_frame_info) {
|
||||
|
||||
int i;
|
||||
int parity_bit = 0;
|
||||
int dx_extract = -1, dx_code_1 = -1, dx_code_2 = -1, frame_number = -1;
|
||||
char binary_dx_code_1[8], binary_dx_code_2[5], binary_frame_number[7];
|
||||
char half_frame_flag = '\0';
|
||||
char dx_info[MAX_DX_INFO_LENGTH] = "\0";
|
||||
char frame_info[MAX_FRAME_INFO_LENGTH] = "\0";
|
||||
char *detected_char = strchr((const char *)(source), ' ');
|
||||
const char *frame_start;
|
||||
|
||||
*has_frame_info = false;
|
||||
|
||||
/* All codes should start with a digit*/
|
||||
if (not_sane(IS_NUM_F, (unsigned char *)source, 1)){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1018, "Invalid character \"%c\", DX code should start with a number", source[0]);
|
||||
}
|
||||
|
||||
/* Check if there is the '/' separator, which indicates the frame number is present. */
|
||||
detected_char = strchr((const char *)(source), '/');
|
||||
if (detected_char){
|
||||
/* Split the DX information from the frame number */
|
||||
size_t dx_length = detected_char - (char *)source;
|
||||
if (dx_length >= MAX_DX_INFO_LENGTH){
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1014, "DX information is too long");
|
||||
}
|
||||
strncat(dx_info, source, dx_length);
|
||||
dx_info[dx_length] = '\0';
|
||||
frame_start = detected_char + 1;
|
||||
if (strlen(frame_start) >= MAX_FRAME_INFO_LENGTH) {
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1002, "Frame number part is too long");
|
||||
}
|
||||
strncat(frame_info, frame_start, sizeof(frame_info) - 1);
|
||||
*has_frame_info = true;
|
||||
str_to_uppercase(frame_info);
|
||||
if ((i = not_sane(IS_UPR_F | IS_NUM_F | IS_MNS_F, (unsigned char *)(frame_info), strlen(frame_info)))){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1012, "Frame number \"%s\" is invalid (expected digits, eventually followed by \'A\')", frame_info);
|
||||
}
|
||||
}
|
||||
else{
|
||||
/* No "/" found, store the entire input in dx_info */
|
||||
if (strlen(source) >= MAX_DX_INFO_LENGTH) {
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1003, "DX information is too long");
|
||||
}
|
||||
strncat(dx_info, source, sizeof(dx_info) - 1);
|
||||
}
|
||||
|
||||
if ((i = not_sane(IS_NUM_F | IS_MNS_F, (unsigned char *)dx_info, strlen(dx_info)))){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1016, "Invalid character at position %d in DX info (digits and \'-\' character only)", i);
|
||||
}
|
||||
|
||||
if (ZINT_DEBUG_PRINT) printf("\nDX info part: \"%s\", Frame info part: \"%s\"\n", dx_info, frame_info);
|
||||
/* Parse the DX information */
|
||||
if (strchr(dx_info, '-')){
|
||||
/* DX code parts 1 and 2 are given directly, separated by a '-'. Eg: "79-7" */
|
||||
if (ZINT_DEBUG_PRINT) printf("DX code 1 and 2 are separated by a dash \'-\'\n");
|
||||
if (count_char_occurrences(dx_info, '-') > 1){
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1009, "The \'-\' is used to separate DX parts 1 and 2, and should be used no more than once");
|
||||
}
|
||||
if (sscanf(dx_info, "%d-%d", &dx_code_1, &dx_code_2) < 2){
|
||||
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1004, "Wrong format for DX parts 1 and 2 (expected format: XXX-XX, digits)");
|
||||
}
|
||||
if (dx_code_1 <= 0 || dx_code_1 > 127){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1006, "DX part 1 \"%d\" must be between 1 and 127", dx_code_1);
|
||||
}
|
||||
if (dx_code_2 < 0 || dx_code_2 > 15){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1007, "DX part 2 \"%d\" must be between 0 and 15", dx_code_2);
|
||||
}
|
||||
}
|
||||
else{
|
||||
/* DX format is either 4 digits (DX Extract, eg: 1271) or 6 digits (DX Full, eg: 012710) */
|
||||
if (ZINT_DEBUG_PRINT) printf("No \'-\' separator, computing from DX Extract (4 digits) or DX Full (6 digits)\n");
|
||||
if (strlen(dx_info) == 5 || strlen(dx_info) > 6){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1005, "DX number \"%s\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)", dx_info);
|
||||
}
|
||||
if (strlen(dx_info) == 6){
|
||||
if (ZINT_DEBUG_PRINT) printf("DX full format detected: %s. Removing the first and the last characters.\n", dx_info);
|
||||
/* Convert DX Full to DX Extract (remove first and last character) */
|
||||
for (i=0; i <= 3; ++i){
|
||||
dx_info[i] = dx_info[i+1];
|
||||
}
|
||||
dx_info[4] = '\0';
|
||||
}
|
||||
/* Compute the DX parts 1 and 2 from the DX extract */
|
||||
if (sscanf(dx_info, "%d", &dx_extract) < 1){
|
||||
/* Should not happen (DX info format has been checked above), but better safe than sorry */
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1005, "DX number \"%s\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)", dx_info);
|
||||
}
|
||||
if (dx_extract < 16 || dx_extract > 2047){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1015, "DX extract \"%d\" must be between 16 and 2047", dx_extract);
|
||||
}
|
||||
if (ZINT_DEBUG_PRINT) printf("Computed DX extract: %04d\n", dx_extract);
|
||||
dx_code_1 = dx_extract / 16;
|
||||
dx_code_2 = dx_extract % 16;
|
||||
}
|
||||
|
||||
/* Convert components to binary strings */
|
||||
int_to_binary(dx_code_1, 7, binary_dx_code_1);
|
||||
int_to_binary(dx_code_2, 4, binary_dx_code_2);
|
||||
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s%d\t-> %s\n", DEBUG_STR_LEN, "DX code 1:", dx_code_1, binary_dx_code_1);
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s%d\t-> %s\n", DEBUG_STR_LEN, "DX code 2:", dx_code_2, binary_dx_code_2);
|
||||
|
||||
if (*has_frame_info) {
|
||||
if (strlen(frame_info) < 1){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1017, "Frame number indicator \"/\" at position %d, but frame number is empty", (int)(detected_char - (char *)source + 1));
|
||||
}
|
||||
/* Some frame numbers are special values, convert them their equivalent number */
|
||||
if (strcmp(frame_info, "S") == 0 || strcmp(frame_info, "X") == 0) {
|
||||
strcpy(frame_info, "62");
|
||||
} else if (strcmp(frame_info, "SA") == 0 || strcmp(frame_info, "XA") == 0) {
|
||||
strcpy(frame_info, "62A");
|
||||
} else if (strcmp(frame_info, "K") == 0 || strcmp(frame_info, "00") == 0) {
|
||||
strcpy(frame_info, "63");
|
||||
} else if (strcmp(frame_info, "KA") == 0 || strcmp(frame_info, "00A") == 0) {
|
||||
strcpy(frame_info, "63A");
|
||||
} else if (strcmp(frame_info, "F") == 0) {
|
||||
strcpy(frame_info, "0");
|
||||
} else if (strcmp(frame_info, "FA") == 0) {
|
||||
strcpy(frame_info, "0A");
|
||||
}
|
||||
|
||||
if (sscanf(frame_info, "%d%c", &frame_number, &half_frame_flag) < 1){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1012, "Frame number \"%s\" is invalid (expected digits, eventually followed by \'A\')", frame_info);
|
||||
}
|
||||
if (frame_number < 0 || frame_number > 63){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1008, "Frame number \"%d\"should be between 0 and 63", frame_number);
|
||||
}
|
||||
int_to_binary(frame_number, 6, binary_frame_number);
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s%d\t-> %s\n", DEBUG_STR_LEN, "Frame number:", frame_number, binary_frame_number);
|
||||
}
|
||||
|
||||
/* Build the binary output */
|
||||
strcpy(binary_output, "101010"); /* Start pattern */
|
||||
strcat(binary_output, binary_dx_code_1);
|
||||
strcat(binary_output, "0"); /* Separator between DX part 1 and DX part 2 */
|
||||
strcat(binary_output, binary_dx_code_2);
|
||||
if (*has_frame_info) {
|
||||
strcat(binary_output, binary_frame_number);
|
||||
if (toupper(half_frame_flag) == 'A') {
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s\'%c\'\t-> 1\n", DEBUG_STR_LEN, "Half frame flag:", half_frame_flag);
|
||||
strcat(binary_output, "1"); /* Half-frame is set */
|
||||
} else {
|
||||
if (half_frame_flag){
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1012, "Frame number \"%s\" is invalid (expected digits, eventually followed by \'A\')", frame_info);
|
||||
}
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s\'%c\'\t-> 0\n", DEBUG_STR_LEN, "Half frame flag:", half_frame_flag);
|
||||
strcat(binary_output, "0"); /* Half-frame is NOT set */
|
||||
}
|
||||
strcat(binary_output, "0"); /* Separator between half frame flag and parity bit*/
|
||||
}
|
||||
|
||||
/* Parity bit */
|
||||
for (i = 6; binary_output[i] != '\0'; i++) {
|
||||
if (binary_output[i] == '1') {
|
||||
parity_bit++;
|
||||
}
|
||||
}
|
||||
parity_bit %= 2;
|
||||
if (ZINT_DEBUG_PRINT) printf("%-*s%s\t-> %d\n", DEBUG_STR_LEN, "Parity bit:", parity_bit?"yes":"no", parity_bit);
|
||||
if (parity_bit){
|
||||
strcat(binary_output, "1");
|
||||
}
|
||||
else{
|
||||
strcat(binary_output, "0");
|
||||
}
|
||||
|
||||
strcat(binary_output, "0101"); /* Stop pattern */
|
||||
|
||||
*output_length = strlen(binary_output);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
INTERNAL int dxfilmedge(struct zint_symbol *symbol, char source[], int length) {
|
||||
int i;
|
||||
int writer = 0;
|
||||
int error_number = 0;
|
||||
|
||||
char char_data[32];
|
||||
int data_length;
|
||||
bool has_frame_info;
|
||||
|
||||
const char long_clock_pattern[] = "1111101010101010101010101010111";
|
||||
const char short_clock_pattern[] = "11111010101010101010111";
|
||||
const char *clock_pattern;
|
||||
int clock_length;
|
||||
int parse_result = -1;
|
||||
|
||||
if (length > 10) {
|
||||
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 1013, "Input length %d too long (maximum 10)", length);
|
||||
}
|
||||
|
||||
parse_result = parse_dx_code(symbol, source, char_data, &data_length, &has_frame_info);
|
||||
if (parse_result != 0){
|
||||
if (ZINT_DEBUG_PRINT) printf("Error %s\n\n", symbol->errtxt);
|
||||
return parse_result;
|
||||
}
|
||||
|
||||
/* Clock signal is longer if the frame number is provided */
|
||||
if (has_frame_info){
|
||||
clock_pattern = long_clock_pattern;
|
||||
clock_length = sizeof(long_clock_pattern) -1;
|
||||
}
|
||||
else{
|
||||
clock_pattern = short_clock_pattern;
|
||||
clock_length = sizeof(short_clock_pattern) -1;
|
||||
}
|
||||
|
||||
/* First row: clock pattern */
|
||||
for (i = 0; i < clock_length; i++) {
|
||||
if (clock_pattern[i] == '1') {
|
||||
set_module(symbol, 0, writer);
|
||||
} else if (clock_pattern[i] == '0') {
|
||||
unset_module(symbol, 0, writer);
|
||||
}
|
||||
writer++;
|
||||
}
|
||||
|
||||
/* Reset writer X position for the second row */
|
||||
writer = 0;
|
||||
|
||||
/* Second row: data signal */
|
||||
for (i = 0; i < clock_length; i++) {
|
||||
if (char_data[i] == '1') {
|
||||
set_module(symbol, 1, writer);
|
||||
} else if (char_data[i] == '0') {
|
||||
unset_module(symbol, 1, writer);
|
||||
}
|
||||
writer++;
|
||||
}
|
||||
symbol->rows = 2;
|
||||
symbol->width = clock_length;
|
||||
|
||||
if (symbol->output_options & COMPLIANT_HEIGHT) {
|
||||
/* Measured ratio on 35mm films. Depending on the brands, one symbol height is about 3 * the X-dim.*/
|
||||
const float default_height = 6.0f;
|
||||
|
||||
/* AFAIK There is no standard on minimum and maximum height, so we stay close to the measurements */
|
||||
const float min_row_height = 2.2f;
|
||||
const float max_height = 7.5f;
|
||||
error_number = set_height(symbol, min_row_height, default_height, max_height, 0 /*no_errtxt*/);
|
||||
}
|
||||
|
||||
return error_number;
|
||||
}
|
|
@ -235,6 +235,7 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int
|
|||
INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int seg_count); /* rMQR */
|
||||
INTERNAL int dpd(struct zint_symbol *symbol, unsigned char source[], int length); /* DPD Code */
|
||||
INTERNAL int bc412(struct zint_symbol *symbol, unsigned char source[], int length); /* BC412 */
|
||||
INTERNAL int dxfilmedge(struct zint_symbol *symbol, unsigned char source[], int length); /* DX Film Edge Barcode */
|
||||
|
||||
/* Output handlers */
|
||||
/* Plot to BMP/GIF/PCX/PNG/TIF */
|
||||
|
@ -512,6 +513,7 @@ static int has_hrt(const int symbology) {
|
|||
case BARCODE_FIM:
|
||||
case BARCODE_PHARMA:
|
||||
case BARCODE_PHARMA_TWO:
|
||||
case BARCODE_DXFILMEDGE:
|
||||
case BARCODE_CEPNET:
|
||||
case BARCODE_PDF417:
|
||||
case BARCODE_PDF417COMP:
|
||||
|
@ -580,7 +582,7 @@ static const barcode_src_func_t barcode_src_funcs[BARCODE_LAST + 1] = {
|
|||
composite, composite, composite, composite, composite, /*130-134*/
|
||||
composite, composite, composite, composite, composite, /*135-139*/
|
||||
channel, NULL, NULL, upnqr, NULL, /*140-144*/
|
||||
NULL, bc412, /*145-146*/
|
||||
NULL, bc412, dxfilmedge, /*145-147*/
|
||||
};
|
||||
|
||||
#define LIB_SEG_FUNCS_START 55
|
||||
|
@ -1640,7 +1642,7 @@ int ZBarcode_BarcodeName(int symbol_id, char name[32]) {
|
|||
"EANX_CC", "GS1_128_CC", "DBAR_OMN_CC", "DBAR_LTD_CC", "DBAR_EXP_CC", /*130-134*/
|
||||
"UPCA_CC", "UPCE_CC", "DBAR_STK_CC", "DBAR_OMNSTK_CC", "DBAR_EXPSTK_CC", /*135-139*/
|
||||
"CHANNEL", "CODEONE", "GRIDMATRIX", "UPNQR", "ULTRA", /*140-144*/
|
||||
"RMQR", "BC412", /*145-146*/
|
||||
"RMQR", "BC412", "DXFILMEDGE", /*145-147*/
|
||||
};
|
||||
|
||||
name[0] = '\0';
|
||||
|
@ -1867,7 +1869,9 @@ float ZBarcode_Default_Xdim(int symbol_id) {
|
|||
case BARCODE_DBAR_EXPSTK_CC:
|
||||
x_dim_mm = 0.33f; /* GS1 General Standards 22.0 Section 5.12.3 Table 1 except DBAR_LTD Table 4 */
|
||||
break;
|
||||
|
||||
case BARCODE_DXFILMEDGE:
|
||||
x_dim_mm = 0.403548f; /* Measured on Kodak 35mm film, a DX Film Edge with frame number with 31 symbols is 12,51 mm long*/
|
||||
break;
|
||||
/* Specific */
|
||||
case BARCODE_BC412:
|
||||
x_dim_mm = 0.12f; /* SEMI T1-95 Table 1 */
|
||||
|
|
|
@ -360,6 +360,12 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
|
|||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_DXFILMEDGE:
|
||||
/* No known standard. Add a little horizontal space to make the detection easier. Tested with Zxing-CPP. */
|
||||
*left = *right = 1.8f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_C25INTER:
|
||||
/* ISO/IEC 16390:2007 Section 4.4 10X */
|
||||
|
|
|
@ -56,6 +56,7 @@ zint_add_test(common test_common)
|
|||
zint_add_test(composite test_composite)
|
||||
zint_add_test(dmatrix test_dmatrix)
|
||||
zint_add_test(dotcode test_dotcode)
|
||||
zint_add_test(dxfilmedge test_dxfilmedge)
|
||||
zint_add_test(eci test_eci)
|
||||
zint_add_test(emf test_emf)
|
||||
zint_add_test(filemem test_filemem)
|
||||
|
|
310
backend/tests/test_dxfilmedge.c
Normal file
310
backend/tests/test_dxfilmedge.c
Normal file
|
@ -0,0 +1,310 @@
|
|||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2024-2025 Antoine Merino <antoine.merino.dev@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.
|
||||
*/
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#include "testcommon.h"
|
||||
|
||||
|
||||
static void test_encode(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int symbology;
|
||||
int option_2;
|
||||
char *data;
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
char *comment;
|
||||
char *expected;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* DX code 1: 79, DX code 2: 7. DX Extract = 1271. DX Full: X1271X (X is any digit)*/
|
||||
/* 0*/ { BARCODE_DXFILMEDGE, -1, "79-7", 0, 2, 23, "",
|
||||
"1111101010101010101011110101010011110011100101"
|
||||
},
|
||||
/* 1*/ { BARCODE_DXFILMEDGE, -1, "1271", 0, 2, 23, "",
|
||||
"1111101010101010101011110101010011110011100101"
|
||||
},
|
||||
/* 2*/ { BARCODE_DXFILMEDGE, -1, "012710", 0, 2, 23, "",
|
||||
"1111101010101010101011110101010011110011100101"
|
||||
},
|
||||
/* 3*/ { BARCODE_DXFILMEDGE, -1, "112712", 0, 2, 23, "",
|
||||
"1111101010101010101011110101010011110011100101"
|
||||
},
|
||||
/* Lower limit: DX part 1 = 1, DX part 2 = 0*/
|
||||
/* 4*/ { BARCODE_DXFILMEDGE, -1, "1-0", 0, 2, 23, "",
|
||||
"1111101010101010101011110101000000010000010101"
|
||||
},
|
||||
/* 5*/ { BARCODE_DXFILMEDGE, -1, "000160", 0, 2, 23, "",
|
||||
"1111101010101010101011110101000000010000010101"
|
||||
},
|
||||
/* 6*/ { BARCODE_DXFILMEDGE, -1, "16", 0, 2, 23, "",
|
||||
"1111101010101010101011110101000000010000010101"
|
||||
},
|
||||
/* Upper limit: DX part 1 = 127, DX part 2 = 15 */
|
||||
/* 7*/ { BARCODE_DXFILMEDGE, -1, "920479/63A", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101111111011111111111000101"
|
||||
},
|
||||
/* 8*/ { BARCODE_DXFILMEDGE, -1, "127-15/00A", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101111111011111111111000101"
|
||||
},
|
||||
|
||||
/* 9*/ { BARCODE_DXFILMEDGE, -1, "79-7/1", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000010010101"
|
||||
},
|
||||
/* Optional behaviour: leading zeros are accepted*/
|
||||
/* 10*/ { BARCODE_DXFILMEDGE, -1, "0079-7/001", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000010010101"
|
||||
},
|
||||
/* Frame number */
|
||||
/* 11*/ { BARCODE_DXFILMEDGE, -1, "79-7/1", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000010010101"
|
||||
},
|
||||
/* 12*/ { BARCODE_DXFILMEDGE, -1, "1271/1", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000010010101"
|
||||
},
|
||||
/* 13*/ { BARCODE_DXFILMEDGE, -1, "912718/1", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000010010101"
|
||||
},
|
||||
/* 14*/ { BARCODE_DXFILMEDGE, -1, "79-7/1A", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000011000101"
|
||||
},
|
||||
/* 15*/ { BARCODE_DXFILMEDGE, -1, "1271/1a", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000011000101"
|
||||
},
|
||||
/* 16*/ { BARCODE_DXFILMEDGE, -1, "212715/1A", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000011000101"
|
||||
},
|
||||
/* Special frame numbers */
|
||||
/* 17*/ { BARCODE_DXFILMEDGE, -1, "79-7/62", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111100010101"
|
||||
},
|
||||
/* 18*/ { BARCODE_DXFILMEDGE, -1, "79-7/S", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111100010101"
|
||||
},
|
||||
/* 19*/ { BARCODE_DXFILMEDGE, -1, "79-7/x", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111100010101"
|
||||
},
|
||||
/* 20*/ { BARCODE_DXFILMEDGE, -1, "79-7/62a", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111101000101"
|
||||
},
|
||||
/* 21*/ { BARCODE_DXFILMEDGE, -1, "79-7/sA", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111101000101"
|
||||
},
|
||||
/* 22*/ { BARCODE_DXFILMEDGE, -1, "79-7/Xa", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111101000101"
|
||||
},
|
||||
/* 23*/ { BARCODE_DXFILMEDGE, -1, "79-7/63", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111110000101"
|
||||
},
|
||||
/* 24*/ { BARCODE_DXFILMEDGE, -1, "79-7/k", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111110000101"
|
||||
},
|
||||
/* 25*/ { BARCODE_DXFILMEDGE, -1, "79-7/00", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111110000101"
|
||||
},
|
||||
/* 26*/ { BARCODE_DXFILMEDGE, -1, "79-7/63a", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111111010101"
|
||||
},
|
||||
/* 27*/ { BARCODE_DXFILMEDGE, -1, "79-7/kA", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111111010101"
|
||||
},
|
||||
/* 28*/ { BARCODE_DXFILMEDGE, -1, "79-7/00a", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001111111111010101"
|
||||
},
|
||||
/* 29*/ { BARCODE_DXFILMEDGE, -1, "79-7/0", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000000000101"
|
||||
},
|
||||
/* 30*/ { BARCODE_DXFILMEDGE, -1, "79-7/F", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000000000101"
|
||||
},
|
||||
/* 31*/ { BARCODE_DXFILMEDGE, -1, "79-7/0a", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000001010101"
|
||||
},
|
||||
/* 32*/ { BARCODE_DXFILMEDGE, -1, "79-7/fA", 0, 2, 31, "",
|
||||
"11111010101010101010101010101111010101001111001110000001010101"
|
||||
},
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
char escaped[1024];
|
||||
char cmp_buf[4096];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n",
|
||||
i, testUtilBarcodeName(data[i].symbology), data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
|
||||
testUtilModulesPrint(symbol, " ", "\n");
|
||||
printf(" },\n");
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
int width, row;
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
|
||||
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
|
||||
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
|
||||
ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
|
||||
}
|
||||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_input(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int symbology;
|
||||
int input_mode;
|
||||
char *data;
|
||||
int ret;
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
char *expected_errtxt;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_DXFILMEDGE, -1, "79-1/123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1002: Frame number part is too long" },
|
||||
/* 1*/ { BARCODE_DXFILMEDGE, -1, "012312365", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1003: DX information is too long" },
|
||||
/* 2*/ { BARCODE_DXFILMEDGE, -1, "12-", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1004: Wrong format for DX parts 1 and 2 (expected format: XXX-XX, digits)" },
|
||||
/* 3*/ { BARCODE_DXFILMEDGE, -1, "01234/00A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1005: DX number \"01234\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)" },
|
||||
/* 4*/ { BARCODE_DXFILMEDGE, -1, "01234/00A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1005: DX number \"01234\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)" },
|
||||
/* 5*/ { BARCODE_DXFILMEDGE, -1, "128-0/24", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1006: DX part 1 \"128\" must be between 1 and 127" },
|
||||
/* 6*/ { BARCODE_DXFILMEDGE, -1, "127-16", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1007: DX part 2 \"16\" must be between 0 and 15" },
|
||||
/* 7*/ { BARCODE_DXFILMEDGE, -1, "79-2/-1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1008: Frame number \"-1\"should be between 0 and 63" },
|
||||
/* 8*/ { BARCODE_DXFILMEDGE, -1, "79-2/64", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1008: Frame number \"64\"should be between 0 and 63" },
|
||||
/* 9*/ { BARCODE_DXFILMEDGE, -1, "79-2-1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1009: The \'-\' is used to separate DX parts 1 and 2, and should be used no more than once" },
|
||||
/* 10*/ { BARCODE_DXFILMEDGE, -1, "110-2/2B", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1012: Frame number \"2B\" is invalid (expected digits, eventually followed by \'A\')" },
|
||||
/* 11*/ { BARCODE_DXFILMEDGE, -1, "099990/123A", ZINT_ERROR_TOO_LONG, -1, -1, "Error 1013: Input length 11 too long (maximum 10)" },
|
||||
/* 12*/ { BARCODE_DXFILMEDGE, -1, "0123123/1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1014: DX information is too long" },
|
||||
/* 13*/ { BARCODE_DXFILMEDGE, -1, "120481", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1015: DX extract \"2048\" must be between 16 and 2047" },
|
||||
/* 14*/ { BARCODE_DXFILMEDGE, -1, "100151", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1015: DX extract \"15\" must be between 16 and 2047" },
|
||||
/* 15*/ { BARCODE_DXFILMEDGE, -1, "15", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1015: DX extract \"15\" must be between 16 and 2047" },
|
||||
/* 16*/ { BARCODE_DXFILMEDGE, -1, "12-12A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1016: Invalid character at position 6 in DX info (digits and \'-\' character only)" },
|
||||
/* 17*/ { BARCODE_DXFILMEDGE, -1, "012X", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1016: Invalid character at position 4 in DX info (digits and \'-\' character only)" },
|
||||
/* 18*/ { BARCODE_DXFILMEDGE, -1, "110-2/", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1017: Frame number indicator \"/\" at position 6, but frame number is empty" },
|
||||
/* 19*/ { BARCODE_DXFILMEDGE, -1, "/", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1018: Invalid character \"/\", DX code should start with a number" },
|
||||
/* 20*/ { BARCODE_DXFILMEDGE, -1, "-12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1018: Invalid character \"-\", DX code should start with a number" },
|
||||
/* 21*/ { BARCODE_DXFILMEDGE, -1, "X1234X", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1018: Invalid character \"X\", DX code should start with a number" },
|
||||
};
|
||||
|
||||
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func */
|
||||
{ "test_input", test_input },
|
||||
{ "test_encode", test_encode },
|
||||
};
|
||||
|
||||
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||
|
||||
testReport();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -191,8 +191,8 @@ static void test_checks(const testCtx *const p_ctx) {
|
|||
/*127*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*128*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*129*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*130*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*131*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*130*/ { 148, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*131*/ { 148, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*132*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/*133*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/*134*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
|
||||
|
@ -964,6 +964,7 @@ static void test_cap_compliant_height(const testCtx *const p_ctx) {
|
|||
case BARCODE_DBAR_EXPSTK_CC:
|
||||
case BARCODE_CHANNEL:
|
||||
case BARCODE_BC412:
|
||||
case BARCODE_DXFILMEDGE: /* TODO: what's this? */
|
||||
assert_equal(uret, ZINT_CAP_COMPLIANT_HEIGHT, "symbol_id %d (%s) uret 0x%X != ZINT_CAP_COMPLIANT_HEIGHT\n", symbol_id, testUtilBarcodeName(symbol_id), uret);
|
||||
break;
|
||||
default:
|
||||
|
@ -1549,6 +1550,7 @@ static int test_prev_ZBarcode_BarcodeName(int symbol_id, char name[32]) {
|
|||
{ "BARCODE_ULTRA", BARCODE_ULTRA, 144 },
|
||||
{ "BARCODE_RMQR", BARCODE_RMQR, 145 },
|
||||
{ "BARCODE_BC412", BARCODE_BC412, 146 },
|
||||
{ "BARCODE_DXFILMEDGE", BARCODE_DXFILMEDGE, 147 },
|
||||
};
|
||||
|
||||
name[0] = '\0';
|
||||
|
|
|
@ -274,7 +274,8 @@ extern "C" {
|
|||
#define BARCODE_ULTRA 144 /* Ultracode */
|
||||
#define BARCODE_RMQR 145 /* Rectangular Micro QR Code (rMQR) */
|
||||
#define BARCODE_BC412 146 /* IBM BC412 (SEMI T1-95) */
|
||||
#define BARCODE_LAST 146 /* Max barcode number marker, not barcode */
|
||||
#define BARCODE_DXFILMEDGE 147 /* DX Film Edge Barcode on 35mm and APS films*/
|
||||
#define BARCODE_LAST 147 /* Max barcode number marker, not barcode */
|
||||
|
||||
/* Output options (`symbol->output_options`) */
|
||||
#define BARCODE_BIND_TOP 0x00001 /* Boundary bar above the symbol only (not below), does not affect stacking */
|
||||
|
|
|
@ -85,6 +85,7 @@ SOURCES += ../backend/2of5.c \
|
|||
../backend/composite.c \
|
||||
../backend/dmatrix.c \
|
||||
../backend/dotcode.c \
|
||||
../backend/dxfilmedge.c \
|
||||
../backend/eci.c \
|
||||
../backend/emf.c \
|
||||
../backend/filemem.c \
|
||||
|
|
|
@ -68,6 +68,7 @@ SOURCES += ../backend/2of5.c \
|
|||
../backend/composite.c \
|
||||
../backend/dmatrix.c \
|
||||
../backend/dotcode.c \
|
||||
../backend/dxfilmedge.c \
|
||||
../backend/eci.c \
|
||||
../backend/emf.c \
|
||||
../backend/gridmtx.c \
|
||||
|
|
1
backend_tcl/configure
vendored
1
backend_tcl/configure
vendored
|
@ -5450,6 +5450,7 @@ printf "%s\n" "$ac_cv_c_bigendian" >&6; }
|
|||
../backend/dllversion.c
|
||||
../backend/dmatrix.c
|
||||
../backend/dotcode.c
|
||||
../backend/dxfilmedge.c
|
||||
../backend/eci.c
|
||||
../backend/emf.c
|
||||
../backend/filemem.c
|
||||
|
|
|
@ -88,6 +88,7 @@ TEA_ADD_SOURCES([
|
|||
../backend/dllversion.c
|
||||
../backend/dmatrix.c
|
||||
../backend/dotcode.c
|
||||
../backend/dxfilmedge.c
|
||||
../backend/eci.c
|
||||
../backend/emf.c
|
||||
../backend/filemem.c
|
||||
|
|
|
@ -116,7 +116,7 @@ static void types(void) {
|
|||
"71 DATAMATRIX Data Matrix 144 ULTRA Ultracode\n"
|
||||
"72 EAN14 EAN-14 145 RMQR Rectangular Micro QR\n"
|
||||
"73 VIN Vehicle Information No. 146 BC412 BC412\n", stdout);
|
||||
fputs("74 CODABLOCKF Codablock-F\n", stdout);
|
||||
fputs("74 CODABLOCKF Codablock-F 147 DXFILMEDGE DX Film Edge\n", stdout);
|
||||
}
|
||||
|
||||
/* Output version information */
|
||||
|
@ -480,6 +480,7 @@ static int get_barcode_name(const char *barcode_name) {
|
|||
{ BARCODE_DPD, "dpd" },
|
||||
{ BARCODE_DPIDENT, "dpident" },
|
||||
{ BARCODE_DPLEIT, "dpleit" },
|
||||
{ BARCODE_DXFILMEDGE, "dxfilmedge" },
|
||||
{ BARCODE_EANX, "ean" }, /* Synonym */
|
||||
{ BARCODE_GS1_128, "ean128" }, /* Synonym */
|
||||
{ BARCODE_GS1_128_CC, "ean128cc" }, /* Synonym */
|
||||
|
|
|
@ -145,6 +145,7 @@ static const struct bstyle_item bstyle_items[] = {
|
|||
{ QSL("DotCode"), BARCODE_DOTCODE },
|
||||
{ QSL("DPD Code"), BARCODE_DPD },
|
||||
{ QSL("Dutch Post KIX"), BARCODE_KIX },
|
||||
{ QSL("DX Film Edge"), BARCODE_DXFILMEDGE },
|
||||
{ QSL("EAN (EAN-2, EAN-5, EAN-8 and EAN-13) (ISO 15420)"), BARCODE_EANX },
|
||||
{ QSL("EAN-14"), BARCODE_EAN14 },
|
||||
{ QSL("FIM (Facing Identification Mark)"), BARCODE_FIM },
|
||||
|
@ -295,7 +296,6 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
|||
/* Prior to Qt 5.10 comboboxes have display issues when filtered (scrollers not accounted for), so disable */
|
||||
filter_bstyle->hide();
|
||||
#endif
|
||||
|
||||
bstyle->setCurrentIndex(settings.value(QSL("studio/symbology"), 12).toInt());
|
||||
|
||||
load_settings(settings);
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
<ClCompile Include="..\backend\dllversion.c" />
|
||||
<ClCompile Include="..\backend\dmatrix.c" />
|
||||
<ClCompile Include="..\backend\dotcode.c" />
|
||||
<ClCompile Include="..\backend\dxfilmedge.c" />
|
||||
<ClCompile Include="..\backend\eci.c" />
|
||||
<ClCompile Include="..\backend\emf.c" />
|
||||
<ClCompile Include="..\backend\filemem.c" />
|
||||
|
|
|
@ -256,6 +256,10 @@
|
|||
<File
|
||||
RelativePath="..\..\backend\dotcode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\backend\dxfilmedge.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\backend\eci.c"
|
||||
|
|
|
@ -314,6 +314,7 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="..\..\backend\dmatrix.c" />
|
||||
<ClCompile Include="..\..\backend\dotcode.c" />
|
||||
<ClCompile Include="..\..\backend\dxfilmedge.c" />
|
||||
<ClCompile Include="..\..\backend\eci.c" />
|
||||
<ClCompile Include="..\..\backend\emf.c" />
|
||||
<ClCompile Include="..\..\backend\filemem.c" />
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
<ClCompile Include="..\..\backend\dllversion.c" />
|
||||
<ClCompile Include="..\..\backend\dmatrix.c" />
|
||||
<ClCompile Include="..\..\backend\dotcode.c" />
|
||||
<ClCompile Include="..\..\backend\dxfilmedge.c" />
|
||||
<ClCompile Include="..\..\backend\eci.c" />
|
||||
<ClCompile Include="..\..\backend\emf.c" />
|
||||
<ClCompile Include="..\..\backend\filemem.c" />
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
<ClCompile Include="..\..\backend\dllversion.c" />
|
||||
<ClCompile Include="..\..\backend\dmatrix.c" />
|
||||
<ClCompile Include="..\..\backend\dotcode.c" />
|
||||
<ClCompile Include="..\..\backend\dxfilmedge.c" />
|
||||
<ClCompile Include="..\..\backend\eci.c" />
|
||||
<ClCompile Include="..\..\backend\emf.c" />
|
||||
<ClCompile Include="..\..\backend\filemem.c" />
|
||||
|
|
|
@ -148,6 +148,10 @@ SOURCE=..\..\backend\dotcode.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\backend\dxfilmedge.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\backend\eci.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue