DXFILMEDGE: various tweaks:

change # 147 -> 127 to use up barcode # holes;
  use "common.h" funcs `str_to_uppercase()` -> `to_upper()`,
  `count_char_occurrences()` -> `chr_cnt()`;
  prefix defines with `DX_` and funcs with `dx_`;
  `ZINT_DEBUG_PRINT` -> `symbol->debug & ZINT_DEBUG_PRINT`;
  bools to ints; use `posn()` to check for slash (returns length);
  restrict line lengths to 118; suppress some clang-tidy warnings;
  normalize some error messages;
  check for single "A" if any (`sscanf()`);
  use compliant height default; some whitespace formatting;
Tcl: add DXFILMEDGE support
docs: document DXFILMEDGE; update to latest pandoc
test suite: ZXingCPP: DXFILMEDGE support
This commit is contained in:
gitlost 2024-12-23 20:52:08 +00:00
parent d13a3aaf1a
commit fe3907c2cb
21 changed files with 451 additions and 255 deletions

View file

@ -1,4 +1,4 @@
Version 2.13.0.9 (dev) not released yet (2024-11-23) Version 2.13.0.9 (dev) not released yet (2024-12-23)
==================================================== ====================================================
**Incompatible changes** **Incompatible changes**
@ -51,6 +51,7 @@ Changes
touch add-on TODO: revisit when standard clarified touch add-on TODO: revisit when standard clarified
- manual: make explicit that AI "(00)" and "(01)" prefixes added by Zint are - manual: make explicit that AI "(00)" and "(01)" prefixes added by Zint are
HRT-only; clarify Codablock-F length maximum & add examples HRT-only; clarify Codablock-F length maximum & add examples
- add DXFILMEDGE (MR #159, props Antoine Mérino)
Bugs Bugs
---- ----

13
README
View file

@ -38,12 +38,13 @@ Deutsche Post Leitcode Telepen
DotCode Telepen Numeric DotCode Telepen Numeric
DPD Code UK Plessey DPD Code UK Plessey
Dutch Post KIX Ultracode Dutch Post KIX Ultracode
EAN (EAN-2, EAN-5, EAN-8 and EAN-13) UPC-A DX Film Edge Barcode UPC-A
EAN-14 UPC-E EAN (EAN-2, EAN-5, EAN-8 and EAN-13) UPC-E
FIM (Facing Identification Mark) UPNQR EAN-14 UPNQR
Flattermarken UPU S10 FIM (Facing Identification Mark) UPU S10
Grid Matrix USPS Intelligent Mail (OneCode) Flattermarken USPS Intelligent Mail (OneCode)
GS1 Composite (EAN/UPC/DataBar/GS-128) VIN (Vehicle Identification Number) Grid Matrix VIN (Vehicle Identification Number)
GS1 Composite (EAN/UPC/DataBar/GS-128)
Output can be saved as BMP, EMF, EPS, GIF, PCX, PNG, SVG or TIF. Output can be saved as BMP, EMF, EPS, GIF, PCX, PNG, SVG or TIF.

View file

@ -1,7 +1,7 @@
/* dxfilmedge.c - Handles DX Film Edge symbology */ /* dxfilmedge.c - Handles DX Film Edge symbology */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2024-2025 Antoine Merino <antoine.merino.dev@gmail.com> Copyright (C) 2024 Antoine Merino <antoine.merino.dev@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -40,19 +40,19 @@
* https://patents.google.com/patent/US4965628A/en * https://patents.google.com/patent/US4965628A/en
*/ */
#include <ctype.h> #include <assert.h>
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "common.h" #include "common.h"
#define DEBUG_STR_LEN 20 #define DX_DEBUG_STR_LEN 20
/* Max length of the DX info part. Include the \0. Eg: "018500\0", "150-10\0" */ /* Max length of the DX info part. Include the \0. Eg: "018500\0", "150-10\0" */
#define MAX_DX_INFO_LENGTH 7 #define DX_MAX_DX_INFO_LENGTH 6
#define DX_MAX_DX_INFO_MAX_STR "6" /* String version of above */
/* Max length of the frame info part. Eg: "00A\0", "23A\0" */ /* Max length of the frame info part. Eg: "00A\0", "23A\0" */
#define MAX_FRAME_INFO_LENGTH 4 #define DX_MAX_FRAME_INFO_LENGTH 3
#define DX_MAX_FRAME_INFO_MAX_STR "3" /* String version of above */
void int_to_binary(int value, int width, char *output) { static void dx_int_to_binary(const int value, const int width, char *output) {
int i; int i;
for (i = 0; i < width; i++) { for (i = 0; i < width; i++) {
output[width - 1 - i] = (value & (1 << i)) ? '1' : '0'; output[width - 1 - i] = (value & (1 << i)) ? '1' : '0';
@ -60,134 +60,133 @@ void int_to_binary(int value, int width, char *output) {
output[width] = '\0'; output[width] = '\0';
} }
void str_to_uppercase(char *str) { static int dx_parse_code(struct zint_symbol *symbol, const unsigned char *source, const int length,
int i; char *binary_output, int *output_length, int *has_frame_info) {
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 i;
int parity_bit = 0; int parity_bit = 0;
int dx_extract = -1, dx_code_1 = -1, dx_code_2 = -1, frame_number = -1; 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 binary_dx_code_1[8], binary_dx_code_2[5], binary_frame_number[7];
char half_frame_flag = '\0'; char half_frame_flag = '\0';
char dx_info[MAX_DX_INFO_LENGTH] = "\0"; char dx_info[DX_MAX_DX_INFO_LENGTH + 1] = "\0";
char frame_info[MAX_FRAME_INFO_LENGTH] = "\0"; char frame_info[DX_MAX_FRAME_INFO_LENGTH + 1] = "\0";
char *detected_char = strchr((const char *)(source), ' '); int dx_length;
const char *frame_start; const char *frame_start;
const int debug_print = symbol->debug & ZINT_DEBUG_PRINT;
*has_frame_info = false; *has_frame_info = 0;
/* All codes should start with a digit*/ /* All codes should start with a digit*/
if (not_sane(IS_NUM_F, (unsigned char *)source, 1)){ if (!z_isdigit(source[0])) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1018, "Invalid character \"%c\", DX code should start with a number", source[0]); return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 970,
"Invalid first character \"%c\", DX code should start with a number", source[0]);
} }
/* Check if there is the '/' separator, which indicates the frame number is present. */ /* Check if there is the '/' separator, which indicates the frame number is present. */
detected_char = strchr((const char *)(source), '/'); dx_length = posn((const char *) source, '/');
if (detected_char){ if (dx_length != -1) {
/* Split the DX information from the frame number */ /* Split the DX information from the frame number */
size_t dx_length = detected_char - (char *)source; int frame_info_len;
if (dx_length >= MAX_DX_INFO_LENGTH){ if (dx_length > DX_MAX_DX_INFO_LENGTH) {
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1014, "DX information is too long"); return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 971,
"DX information length %d too long (maximum " DX_MAX_DX_INFO_MAX_STR ")", dx_length);
} }
strncat(dx_info, source, dx_length); ustrncat(dx_info, source, dx_length);
dx_info[dx_length] = '\0'; dx_info[dx_length] = '\0';
frame_start = detected_char + 1; frame_start = (const char *) source + dx_length + 1;
if (strlen(frame_start) >= MAX_FRAME_INFO_LENGTH) { frame_info_len = (int) strlen(frame_start);
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1002, "Frame number part is too long"); if (frame_info_len > DX_MAX_FRAME_INFO_LENGTH) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 972,
"Frame number part length %d too long (maximum " DX_MAX_FRAME_INFO_MAX_STR ")", frame_info_len);
} }
strncat(frame_info, frame_start, sizeof(frame_info) - 1); ustrcpy(frame_info, frame_start);
*has_frame_info = true; *has_frame_info = 1;
str_to_uppercase(frame_info); to_upper((unsigned char *) frame_info, frame_info_len);
if ((i = not_sane(IS_UPR_F | IS_NUM_F | IS_MNS_F, (unsigned char *)(frame_info), strlen(frame_info)))){ if (not_sane(IS_UPR_F | IS_NUM_F | IS_MNS_F, (const unsigned char *) frame_info, frame_info_len)) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1012, "Frame number \"%s\" is invalid (expected digits, eventually followed by \'A\')", frame_info); return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 973,
"Frame number \"%s\" is invalid (expected digits, optionally followed by a single \"A\")",
frame_info);
} }
} } else {
else{
/* No "/" found, store the entire input in dx_info */ /* No "/" found, store the entire input in dx_info */
if (strlen(source) >= MAX_DX_INFO_LENGTH) { dx_length = length;
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 1003, "DX information is too long"); if (dx_length > DX_MAX_DX_INFO_LENGTH) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 974,
"DX information length %d too long (maximum " DX_MAX_DX_INFO_MAX_STR ")", dx_length);
} }
strncat(dx_info, source, sizeof(dx_info) - 1); ustrcpy(dx_info, source);
} }
if ((i = not_sane(IS_NUM_F | IS_MNS_F, (unsigned char *)dx_info, strlen(dx_info)))){ if ((i = not_sane(IS_NUM_F | IS_MNS_F, (const unsigned char *) dx_info, dx_length))) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1016, "Invalid character at position %d in DX info (digits and \'-\' character only)", i); return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 975,
"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); if (debug_print) printf("\nDX info part: \"%s\", Frame info part: \"%s\"\n", dx_info, frame_info);
/* Parse the DX information */ /* Parse the DX information */
if (strchr(dx_info, '-')){ if (strchr(dx_info, '-')) {
/* DX code parts 1 and 2 are given directly, separated by a '-'. Eg: "79-7" */ /* 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 (debug_print) printf("DX code 1 and 2 are separated by a dash \"-\"\n");
if (count_char_occurrences(dx_info, '-') > 1){ if (chr_cnt((const unsigned char *) dx_info, dx_length, '-') > 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"); return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 976,
"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){ 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)"); return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 977,
"Wrong format for DX parts 1 and 2 (expected format: XXX-XX, digits)");
} }
if (dx_code_1 <= 0 || dx_code_1 > 127){ 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); return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 978, "DX part 1 \"%d\" out of range (1 to 127)",
dx_code_1);
} }
if (dx_code_2 < 0 || dx_code_2 > 15){ 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); return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 979, "DX part 2 \"%d\" out of range (0 to 15)",
dx_code_2);
} }
} } else {
else{
/* DX format is either 4 digits (DX Extract, eg: 1271) or 6 digits (DX Full, eg: 012710) */ /* 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 (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){ if (dx_length == 5 || dx_length > 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); return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 980,
"DX number \"%s\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)", dx_info);
} }
if (strlen(dx_info) == 6){ if (dx_length == 6) {
if (ZINT_DEBUG_PRINT) printf("DX full format detected: %s. Removing the first and the last characters.\n", dx_info); if (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) */ /* Convert DX Full to DX Extract (remove first and last character) */
for (i=0; i <= 3; ++i){ for (i = 0; i <= 3; ++i) {
dx_info[i] = dx_info[i+1]; dx_info[i] = dx_info[i + 1];
} }
dx_info[4] = '\0'; dx_info[4] = '\0';
dx_length = 4;
} }
/* Compute the DX parts 1 and 2 from the DX extract */ /* Compute the DX parts 1 and 2 from the DX extract */
if (sscanf(dx_info, "%d", &dx_extract) < 1){ dx_extract = to_int((const unsigned char *) dx_info, dx_length);
/* Should not happen (DX info format has been checked above), but better safe than sorry */ assert(dx_extract != -1);
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, 981, "DX extract \"%d\" out of range (16 to 2047)",
dx_extract);
} }
if (dx_extract < 16 || dx_extract > 2047){ if (debug_print) printf("Computed DX extract: %04d\n", dx_extract);
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_1 = dx_extract / 16;
dx_code_2 = dx_extract % 16; dx_code_2 = dx_extract % 16;
} }
/* Convert components to binary strings */ /* Convert components to binary strings */
int_to_binary(dx_code_1, 7, binary_dx_code_1); dx_int_to_binary(dx_code_1, 7, binary_dx_code_1);
int_to_binary(dx_code_2, 4, binary_dx_code_2); dx_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 (debug_print) {
if (ZINT_DEBUG_PRINT) printf("%-*s%d\t-> %s\n", DEBUG_STR_LEN, "DX code 2:", dx_code_2, binary_dx_code_2); printf("%-*s%d\t-> %s\n", DX_DEBUG_STR_LEN, "DX code 1:", dx_code_1, binary_dx_code_1);
printf("%-*s%d\t-> %s\n", DX_DEBUG_STR_LEN, "DX code 2:", dx_code_2, binary_dx_code_2);
}
if (*has_frame_info) { if (*has_frame_info) {
if (strlen(frame_info) < 1){ int ret_sscanf, n;
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)); if (strlen(frame_info) < 1) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 982,
"Frame number indicator \"/\" at position %d, but frame number is empty",
dx_length + 1);
} }
/* Some frame numbers are special values, convert them their equivalent number */ /* Some frame numbers are special values, convert them their equivalent number */
if (strcmp(frame_info, "S") == 0 || strcmp(frame_info, "X") == 0) { if (strcmp(frame_info, "S") == 0 || strcmp(frame_info, "X") == 0) {
@ -204,14 +203,20 @@ int parse_dx_code(struct zint_symbol *symbol, const char *source, char *binary_o
strcpy(frame_info, "0A"); strcpy(frame_info, "0A");
} }
if (sscanf(frame_info, "%d%c", &frame_number, &half_frame_flag) < 1){ ret_sscanf = sscanf(frame_info, "%d%c%n", &frame_number, &half_frame_flag, &n);
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 1012, "Frame number \"%s\" is invalid (expected digits, eventually followed by \'A\')", frame_info); if (ret_sscanf < 1 || (ret_sscanf == 2 && frame_info[n] != '\0')) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 983,
"Frame number \"%s\" is invalid (expected digits, optionally followed by a single \"A\")",
frame_info);
} }
if (frame_number < 0 || frame_number > 63){ 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); return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 984, "Frame number \"%d\" out of range (0 to 63)",
frame_number);
}
dx_int_to_binary(frame_number, 6, binary_frame_number);
if (debug_print) {
printf("%-*s%d\t-> %s\n", DX_DEBUG_STR_LEN, "Frame number:", frame_number, binary_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 */ /* Build the binary output */
@ -221,19 +226,22 @@ int parse_dx_code(struct zint_symbol *symbol, const char *source, char *binary_o
strcat(binary_output, binary_dx_code_2); strcat(binary_output, binary_dx_code_2);
if (*has_frame_info) { if (*has_frame_info) {
strcat(binary_output, binary_frame_number); strcat(binary_output, binary_frame_number);
if (toupper(half_frame_flag) == 'A') { to_upper((unsigned char *) &half_frame_flag, 1);
if (ZINT_DEBUG_PRINT) printf("%-*s\'%c\'\t-> 1\n", DEBUG_STR_LEN, "Half frame flag:", half_frame_flag); if (half_frame_flag == 'A') {
if (debug_print) printf("%-*s'%c'\t-> 1\n", DX_DEBUG_STR_LEN, "Half frame flag:", half_frame_flag);
strcat(binary_output, "1"); /* Half-frame is set */ strcat(binary_output, "1"); /* Half-frame is set */
} else { } else {
if (half_frame_flag){ 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); return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 985,
"Frame number \"%s\" is invalid (expected digits, optionally followed by a single \"A\")",
frame_info);
} }
if (ZINT_DEBUG_PRINT) printf("%-*s\'%c\'\t-> 0\n", DEBUG_STR_LEN, "Half frame flag:", half_frame_flag); if (debug_print) printf("%-*s'%c'\t-> 0\n", DX_DEBUG_STR_LEN, "Half frame flag:", half_frame_flag);
strcat(binary_output, "0"); /* Half-frame is NOT set */ strcat(binary_output, "0"); /* Half-frame is NOT set */
} }
strcat(binary_output, "0"); /* Separator between half frame flag and parity bit*/ strcat(binary_output, "0"); /* Separator between half frame flag and parity bit*/
} }
/* Parity bit */ /* Parity bit */
for (i = 6; binary_output[i] != '\0'; i++) { for (i = 6; binary_output[i] != '\0'; i++) {
if (binary_output[i] == '1') { if (binary_output[i] == '1') {
@ -241,56 +249,56 @@ int parse_dx_code(struct zint_symbol *symbol, const char *source, char *binary_o
} }
} }
parity_bit %= 2; 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 (debug_print) {
if (parity_bit){ printf("%-*s%s\t-> %d\n", DX_DEBUG_STR_LEN, "Parity bit:", parity_bit ? "yes" : "no", parity_bit);
strcat(binary_output, "1");
} }
else{ if (parity_bit) {
strcat(binary_output, "1");
} else {
strcat(binary_output, "0"); strcat(binary_output, "0");
} }
strcat(binary_output, "0101"); /* Stop pattern */ strcat(binary_output, "0101"); /* Stop pattern */
*output_length = strlen(binary_output); *output_length = (int) strlen(binary_output);
return 0; return 0;
} }
INTERNAL int dxfilmedge(struct zint_symbol *symbol, unsigned char source[], int length) {
INTERNAL int dxfilmedge(struct zint_symbol *symbol, char source[], int length) {
int i; int i;
int writer = 0; int writer = 0;
int error_number = 0; int error_number = 0;
char char_data[32]; char char_data[32];
int data_length; int data_length;
bool has_frame_info; int has_frame_info;
const char long_clock_pattern[] = "1111101010101010101010101010111"; const char long_clock_pattern[] = "1111101010101010101010101010111";
const char short_clock_pattern[] = "11111010101010101010111"; const char short_clock_pattern[] = "11111010101010101010111";
const char *clock_pattern; const char *clock_pattern;
int clock_length; int clock_length;
int parse_result = -1; int parse_result = -1;
const int debug_print = symbol->debug & ZINT_DEBUG_PRINT;
if (length > 10) { if (length > 10) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 1013, "Input length %d too long (maximum 10)", length); return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 986, "Input length %d too long (maximum 10)", length);
} }
parse_result = parse_dx_code(symbol, source, char_data, &data_length, &has_frame_info); parse_result = dx_parse_code(symbol, source, length, char_data, &data_length, &has_frame_info);
if (parse_result != 0){ if (parse_result != 0) {
if (ZINT_DEBUG_PRINT) printf("Error %s\n\n", symbol->errtxt); if (debug_print) printf("Error %s\n\n", symbol->errtxt);
return parse_result; return parse_result;
} }
/* Clock signal is longer if the frame number is provided */ /* Clock signal is longer if the frame number is provided */
if (has_frame_info){ if (has_frame_info) {
clock_pattern = long_clock_pattern; clock_pattern = long_clock_pattern;
clock_length = sizeof(long_clock_pattern) -1; clock_length = sizeof(long_clock_pattern) -1;
} } else {
else{
clock_pattern = short_clock_pattern; clock_pattern = short_clock_pattern;
clock_length = sizeof(short_clock_pattern) -1; clock_length = sizeof(short_clock_pattern) -1;
} }
/* First row: clock pattern */ /* First row: clock pattern */
for (i = 0; i < clock_length; i++) { for (i = 0; i < clock_length; i++) {
if (clock_pattern[i] == '1') { if (clock_pattern[i] == '1') {
@ -313,7 +321,7 @@ INTERNAL int dxfilmedge(struct zint_symbol *symbol, char source[], int length) {
} }
writer++; writer++;
} }
symbol->rows = 2; symbol->rows = 2;
symbol->width = clock_length; symbol->width = clock_length;
if (symbol->output_options & COMPLIANT_HEIGHT) { if (symbol->output_options & COMPLIANT_HEIGHT) {
@ -324,7 +332,13 @@ INTERNAL int dxfilmedge(struct zint_symbol *symbol, char source[], int length) {
const float min_row_height = 2.2f; const float min_row_height = 2.2f;
const float max_height = 7.5f; const float max_height = 7.5f;
error_number = set_height(symbol, min_row_height, default_height, max_height, 0 /*no_errtxt*/); error_number = set_height(symbol, min_row_height, default_height, max_height, 0 /*no_errtxt*/);
} else {
/* Using compliant height as default as no backwards compatibility to consider */
const float default_height = 6.0f;
(void) set_height(symbol, 0.0f, default_height, 0.0f, 1 /*no_errtxt*/);
} }
return error_number; return error_number;
} }
/* vim: set ts=4 sw=4 et : */

View file

@ -578,11 +578,11 @@ static const barcode_src_func_t barcode_src_funcs[BARCODE_LAST + 1] = {
NULL, NULL, NULL, NULL, NULL, /*110-114*/ NULL, NULL, NULL, NULL, NULL, /*110-114*/
NULL, NULL, NULL, NULL, mailmark_2d, /*115-119*/ NULL, NULL, NULL, NULL, mailmark_2d, /*115-119*/
upu_s10, mailmark_4s, NULL, NULL, NULL, /*120-124*/ upu_s10, mailmark_4s, NULL, NULL, NULL, /*120-124*/
NULL, NULL, NULL, azrune, code32, /*125-129*/ NULL, NULL, dxfilmedge, azrune, code32, /*125-129*/
composite, composite, composite, composite, composite, /*130-134*/ composite, composite, composite, composite, composite, /*130-134*/
composite, composite, composite, composite, composite, /*135-139*/ composite, composite, composite, composite, composite, /*135-139*/
channel, NULL, NULL, upnqr, NULL, /*140-144*/ channel, NULL, NULL, upnqr, NULL, /*140-144*/
NULL, bc412, dxfilmedge, /*145-147*/ NULL, bc412, /*145-146*/
}; };
#define LIB_SEG_FUNCS_START 55 #define LIB_SEG_FUNCS_START 55
@ -1638,11 +1638,11 @@ int ZBarcode_BarcodeName(int symbol_id, char name[32]) {
"HIBC_BLOCKF", "", "HIBC_AZTEC", "", "", /*110-114*/ "HIBC_BLOCKF", "", "HIBC_AZTEC", "", "", /*110-114*/
"DOTCODE", "HANXIN", "", "", "MAILMARK_2D", /*115-119*/ "DOTCODE", "HANXIN", "", "", "MAILMARK_2D", /*115-119*/
"UPU_S10", "MAILMARK_4S", "", "", "", /*120-124*/ "UPU_S10", "MAILMARK_4S", "", "", "", /*120-124*/
"", "", "", "AZRUNE", "CODE32", /*125-129*/ "", "", "DXFILMEDGE", "AZRUNE", "CODE32", /*125-129*/
"EANX_CC", "GS1_128_CC", "DBAR_OMN_CC", "DBAR_LTD_CC", "DBAR_EXP_CC", /*130-134*/ "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*/ "UPCA_CC", "UPCE_CC", "DBAR_STK_CC", "DBAR_OMNSTK_CC", "DBAR_EXPSTK_CC", /*135-139*/
"CHANNEL", "CODEONE", "GRIDMATRIX", "UPNQR", "ULTRA", /*140-144*/ "CHANNEL", "CODEONE", "GRIDMATRIX", "UPNQR", "ULTRA", /*140-144*/
"RMQR", "BC412", "DXFILMEDGE", /*145-147*/ "RMQR", "BC412", /*145-146*/
}; };
name[0] = '\0'; name[0] = '\0';
@ -1870,7 +1870,8 @@ float ZBarcode_Default_Xdim(int symbol_id) {
x_dim_mm = 0.33f; /* GS1 General Standards 22.0 Section 5.12.3 Table 1 except DBAR_LTD Table 4 */ x_dim_mm = 0.33f; /* GS1 General Standards 22.0 Section 5.12.3 Table 1 except DBAR_LTD Table 4 */
break; break;
case BARCODE_DXFILMEDGE: 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*/ /* Measured on Kodak 35mm film, a DX Film Edge with frame number with 31 symbols is 12,51 mm long */
x_dim_mm = 0.403548f;
break; break;
/* Specific */ /* Specific */
case BARCODE_BC412: case BARCODE_BC412:

View file

@ -362,7 +362,7 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
break; break;
case BARCODE_DXFILMEDGE: case BARCODE_DXFILMEDGE:
/* No known standard. Add a little horizontal space to make the detection easier. Tested with Zxing-CPP. */ /* No known standard. Add a little horizontal space to make the detection easier. Tested with Zxing-CPP */
*left = *right = 1.8f; *left = *right = 1.8f;
done = 1; done = 1;
break; break;

View file

@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2024-2025 Antoine Merino <antoine.merino.dev@gmail.com> Copyright (C) 2024 Antoine Merino <antoine.merino.dev@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -31,7 +31,6 @@
#include "testcommon.h" #include "testcommon.h"
static void test_encode(const testCtx *const p_ctx) { static void test_encode(const testCtx *const p_ctx) {
int debug = p_ctx->debug; int debug = p_ctx->debug;
@ -47,8 +46,7 @@ static void test_encode(const testCtx *const p_ctx) {
char *expected; char *expected;
}; };
static const struct item data[] = { 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, "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" "1111101010101010101011110101010011110011100101"
}, },
/* 1*/ { BARCODE_DXFILMEDGE, -1, "1271", 0, 2, 23, "", /* 1*/ { BARCODE_DXFILMEDGE, -1, "1271", 0, 2, 23, "",
@ -60,8 +58,7 @@ static void test_encode(const testCtx *const p_ctx) {
/* 3*/ { BARCODE_DXFILMEDGE, -1, "112712", 0, 2, 23, "", /* 3*/ { BARCODE_DXFILMEDGE, -1, "112712", 0, 2, 23, "",
"1111101010101010101011110101010011110011100101" "1111101010101010101011110101010011110011100101"
}, },
/* Lower limit: DX part 1 = 1, DX part 2 = 0*/ /* 4*/ { BARCODE_DXFILMEDGE, -1, "1-0", 0, 2, 23, "Lower limit: DX part 1 = 1, DX part 2 = 0",
/* 4*/ { BARCODE_DXFILMEDGE, -1, "1-0", 0, 2, 23, "",
"1111101010101010101011110101000000010000010101" "1111101010101010101011110101000000010000010101"
}, },
/* 5*/ { BARCODE_DXFILMEDGE, -1, "000160", 0, 2, 23, "", /* 5*/ { BARCODE_DXFILMEDGE, -1, "000160", 0, 2, 23, "",
@ -70,23 +67,19 @@ static void test_encode(const testCtx *const p_ctx) {
/* 6*/ { BARCODE_DXFILMEDGE, -1, "16", 0, 2, 23, "", /* 6*/ { BARCODE_DXFILMEDGE, -1, "16", 0, 2, 23, "",
"1111101010101010101011110101000000010000010101" "1111101010101010101011110101000000010000010101"
}, },
/* Upper limit: DX part 1 = 127, DX part 2 = 15 */ /* 7*/ { BARCODE_DXFILMEDGE, -1, "920479/63A", 0, 2, 31, "Upper limit: DX part 1 = 127, DX part 2 = 15",
/* 7*/ { BARCODE_DXFILMEDGE, -1, "920479/63A", 0, 2, 31, "",
"11111010101010101010101010101111010101111111011111111111000101" "11111010101010101010101010101111010101111111011111111111000101"
}, },
/* 8*/ { BARCODE_DXFILMEDGE, -1, "127-15/00A", 0, 2, 31, "", /* 8*/ { BARCODE_DXFILMEDGE, -1, "127-15/00A", 0, 2, 31, "",
"11111010101010101010101010101111010101111111011111111111000101" "11111010101010101010101010101111010101111111011111111111000101"
}, },
/* 9*/ { BARCODE_DXFILMEDGE, -1, "79-7/1", 0, 2, 31, "", /* 9*/ { BARCODE_DXFILMEDGE, -1, "79-7/1", 0, 2, 31, "",
"11111010101010101010101010101111010101001111001110000010010101" "11111010101010101010101010101111010101001111001110000010010101"
}, },
/* Optional behaviour: leading zeros are accepted*/ /* 10*/ { BARCODE_DXFILMEDGE, -1, "0079-7/001", 0, 2, 31, "Optional behaviour: leading zeros are accepted",
/* 10*/ { BARCODE_DXFILMEDGE, -1, "0079-7/001", 0, 2, 31, "",
"11111010101010101010101010101111010101001111001110000010010101" "11111010101010101010101010101111010101001111001110000010010101"
}, },
/* Frame number */ /* 11*/ { BARCODE_DXFILMEDGE, -1, "79-7/1", 0, 2, 31, "Frame number",
/* 11*/ { BARCODE_DXFILMEDGE, -1, "79-7/1", 0, 2, 31, "",
"11111010101010101010101010101111010101001111001110000010010101" "11111010101010101010101010101111010101001111001110000010010101"
}, },
/* 12*/ { BARCODE_DXFILMEDGE, -1, "1271/1", 0, 2, 31, "", /* 12*/ { BARCODE_DXFILMEDGE, -1, "1271/1", 0, 2, 31, "",
@ -104,8 +97,7 @@ static void test_encode(const testCtx *const p_ctx) {
/* 16*/ { BARCODE_DXFILMEDGE, -1, "212715/1A", 0, 2, 31, "", /* 16*/ { BARCODE_DXFILMEDGE, -1, "212715/1A", 0, 2, 31, "",
"11111010101010101010101010101111010101001111001110000011000101" "11111010101010101010101010101111010101001111001110000011000101"
}, },
/* Special frame numbers */ /* 17*/ { BARCODE_DXFILMEDGE, -1, "79-7/62", 0, 2, 31, "Special frame numbers",
/* 17*/ { BARCODE_DXFILMEDGE, -1, "79-7/62", 0, 2, 31, "",
"11111010101010101010101010101111010101001111001111111100010101" "11111010101010101010101010101111010101001111001111111100010101"
}, },
/* 18*/ { BARCODE_DXFILMEDGE, -1, "79-7/S", 0, 2, 31, "", /* 18*/ { BARCODE_DXFILMEDGE, -1, "79-7/S", 0, 2, 31, "",
@ -162,7 +154,6 @@ static void test_encode(const testCtx *const p_ctx) {
char cmp_buf[4096]; char cmp_buf[4096];
char cmp_msg[1024]; 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 */ int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
testStartSymbol("test_encode", &symbol); testStartSymbol("test_encode", &symbol);
@ -195,14 +186,6 @@ static void test_encode(const testCtx *const p_ctx) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); 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); 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)) { if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len; int cmp_len, ret_len;
char modules_dump[8192 + 1]; char modules_dump[8192 + 1];
@ -237,31 +220,31 @@ static void test_input(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = { 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" }, /* 0*/ { BARCODE_DXFILMEDGE, -1, "79-1/123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 972: Frame number part length 4 too long (maximum 3)" },
/* 1*/ { BARCODE_DXFILMEDGE, -1, "012312365", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1003: DX information is too long" }, /* 1*/ { BARCODE_DXFILMEDGE, -1, "79-1/1@A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 973: Frame number \"1@A\" is invalid (expected digits, optionally followed by a single \"A\")" },
/* 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)" }, /* 2*/ { BARCODE_DXFILMEDGE, -1, "012312365", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 974: DX information length 9 too long (maximum 6)" },
/* 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)" }, /* 3*/ { BARCODE_DXFILMEDGE, -1, "12-", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 977: Wrong format for DX parts 1 and 2 (expected format: XXX-XX, digits)" },
/* 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)" }, /* 4*/ { BARCODE_DXFILMEDGE, -1, "01234/00A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 980: 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" }, /* 5*/ { BARCODE_DXFILMEDGE, -1, "0123/0AA", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 983: Frame number \"0AA\" is invalid (expected digits, optionally followed by a single \"A\")" },
/* 6*/ { BARCODE_DXFILMEDGE, -1, "127-16", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1007: DX part 2 \"16\" must be between 0 and 15" }, /* 6*/ { BARCODE_DXFILMEDGE, -1, "128-0/24", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 978: DX part 1 \"128\" out of range (1 to 127)" },
/* 7*/ { BARCODE_DXFILMEDGE, -1, "79-2/-1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1008: Frame number \"-1\"should be between 0 and 63" }, /* 7*/ { BARCODE_DXFILMEDGE, -1, "127-16", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 979: DX part 2 \"16\" out of range (0 to 15)" },
/* 8*/ { BARCODE_DXFILMEDGE, -1, "79-2/64", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1008: Frame number \"64\"should be between 0 and 63" }, /* 8*/ { BARCODE_DXFILMEDGE, -1, "79-2/A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 983: Frame number \"A\" is invalid (expected digits, optionally followed by a single \"A\")" },
/* 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" }, /* 9*/ { BARCODE_DXFILMEDGE, -1, "79-2/-1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 984: Frame number \"-1\" out of range (0 to 63)" },
/* 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\')" }, /* 10*/ { BARCODE_DXFILMEDGE, -1, "79-2/64", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 984: Frame number \"64\" out of range (0 to 63)" },
/* 11*/ { BARCODE_DXFILMEDGE, -1, "099990/123A", ZINT_ERROR_TOO_LONG, -1, -1, "Error 1013: Input length 11 too long (maximum 10)" }, /* 11*/ { BARCODE_DXFILMEDGE, -1, "79-2-1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 976: The \"-\" is used to separate DX parts 1 and 2, and should be used no more than once" },
/* 12*/ { BARCODE_DXFILMEDGE, -1, "0123123/1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1014: DX information is too long" }, /* 12*/ { BARCODE_DXFILMEDGE, -1, "110-2/2B", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 985: Frame number \"2B\" is invalid (expected digits, optionally followed by a single \"A\")" },
/* 13*/ { BARCODE_DXFILMEDGE, -1, "120481", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1015: DX extract \"2048\" must be between 16 and 2047" }, /* 13*/ { BARCODE_DXFILMEDGE, -1, "099990/123A", ZINT_ERROR_TOO_LONG, -1, -1, "Error 986: Input length 11 too long (maximum 10)" },
/* 14*/ { BARCODE_DXFILMEDGE, -1, "100151", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1015: DX extract \"15\" must be between 16 and 2047" }, /* 14*/ { BARCODE_DXFILMEDGE, -1, "0123123/1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 971: DX information length 7 too long (maximum 6)" },
/* 15*/ { BARCODE_DXFILMEDGE, -1, "15", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1015: DX extract \"15\" must be between 16 and 2047" }, /* 15*/ { BARCODE_DXFILMEDGE, -1, "120481", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 981: DX extract \"2048\" out of range (16 to 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)" }, /* 16*/ { BARCODE_DXFILMEDGE, -1, "100151", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 981: DX extract \"15\" out of range (16 to 2047)" },
/* 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)" }, /* 17*/ { BARCODE_DXFILMEDGE, -1, "15", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 981: DX extract \"15\" out of range (16 to 2047)" },
/* 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" }, /* 18*/ { BARCODE_DXFILMEDGE, -1, "12-12A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 975: Invalid character at position 6 in DX info (digits and \"-\" character only)" },
/* 19*/ { BARCODE_DXFILMEDGE, -1, "/", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1018: Invalid character \"/\", DX code should start with a number" }, /* 19*/ { BARCODE_DXFILMEDGE, -1, "012X", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 975: Invalid character at position 4 in DX info (digits and \"-\" character only)" },
/* 20*/ { BARCODE_DXFILMEDGE, -1, "-12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1018: Invalid character \"-\", DX code should start with a number" }, /* 20*/ { BARCODE_DXFILMEDGE, -1, "110-2/", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 982: Frame number indicator \"/\" at position 6, but frame number is empty" },
/* 21*/ { BARCODE_DXFILMEDGE, -1, "X1234X", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 1018: Invalid character \"X\", DX code should start with a number" }, /* 21*/ { BARCODE_DXFILMEDGE, -1, "/", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 970: Invalid first character \"/\", DX code should start with a number" },
/* 22*/ { BARCODE_DXFILMEDGE, -1, "-12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 970: Invalid first character \"-\", DX code should start with a number" },
/* 23*/ { BARCODE_DXFILMEDGE, -1, "X1234X", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 970: Invalid first character \"X\", DX code should start with a number" },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
@ -293,7 +276,6 @@ static void test_input(const testCtx *const p_ctx) {
testFinish(); testFinish();
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func */ testFunction funcs[] = { /* name, func */
@ -308,3 +290,4 @@ int main(int argc, char *argv[]) {
return 0; return 0;
} }
/* vim: set ts=4 sw=4 et : */

View file

@ -189,32 +189,30 @@ static void test_checks(const testCtx *const p_ctx) {
/*125*/ { 125, -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 }, /*125*/ { 125, -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 },
/*126*/ { 126, -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 }, /*126*/ { 126, -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 },
/*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 }, /*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 }, /*128*/ { 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 },
/*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 }, /*129*/ { 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 }, /*130*/ { 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 },
/*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 }, /*131*/ { 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 },
/*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 }, /*132*/ { 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 },
/*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 }, /*133*/ { BARCODE_CODE128, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -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 }, /*134*/ { BARCODE_MAXICODE, -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 },
/*135*/ { BARCODE_CODE128, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 }, /*135*/ { BARCODE_MAXICODE, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
/*136*/ { BARCODE_MAXICODE, -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 }, /*136*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
/*137*/ { BARCODE_MAXICODE, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 }, /*137*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
/*138*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /*138*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 },
/*139*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /*139*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*140*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, /*140*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
/*141*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /*141*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 },
/*142*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, /*142*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 },
/*143*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /*143*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /* Warning in encoder overrides library warnings */
/*144*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 }, /*144*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /* But not errors */
/*145*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /* Warning in encoder overrides library warnings */ /*145*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 },
/*146*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /* But not errors */ /*146*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*147*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, /*147*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
/*148*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /*148*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Error correction level '6' out of range (1 to 4), ignoring", -1 },
/*149*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, /*149*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 },
/*150*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Error correction level '6' out of range (1 to 4), ignoring", -1 }, /*150*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /* ECI warning trumps all other warnings */
/*151*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 }, /*151*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 }, /* But not errors */
/*152*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /* ECI warning trumps all other warnings */
/*153*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 }, /* But not errors */
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@ -964,10 +962,12 @@ static void test_cap_compliant_height(const testCtx *const p_ctx) {
case BARCODE_DBAR_EXPSTK_CC: case BARCODE_DBAR_EXPSTK_CC:
case BARCODE_CHANNEL: case BARCODE_CHANNEL:
case BARCODE_BC412: case BARCODE_BC412:
case BARCODE_DXFILMEDGE: /* TODO: what's this? */ case BARCODE_DXFILMEDGE:
/* Make sure ZINT_CAP_COMPLIANT_HEIGHT set for those that have it */
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); 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; break;
default: default:
/* And not set for those that don't */
assert_zero(uret, "symbol_id %d (%s) uret 0x%X non-zero\n", symbol_id, testUtilBarcodeName(symbol_id), uret); assert_zero(uret, "symbol_id %d (%s) uret 0x%X non-zero\n", symbol_id, testUtilBarcodeName(symbol_id), uret);
break; break;
} }
@ -1530,7 +1530,7 @@ static int test_prev_ZBarcode_BarcodeName(int symbol_id, char name[32]) {
{ "", -1, 124 }, { "", -1, 124 },
{ "", -1, 125 }, { "", -1, 125 },
{ "", -1, 126 }, { "", -1, 126 },
{ "", -1, 127 }, { "BARCODE_DXFILMEDGE", BARCODE_DXFILMEDGE, 127 },
{ "BARCODE_AZRUNE", BARCODE_AZRUNE, 128 }, { "BARCODE_AZRUNE", BARCODE_AZRUNE, 128 },
{ "BARCODE_CODE32", BARCODE_CODE32, 129 }, { "BARCODE_CODE32", BARCODE_CODE32, 129 },
{ "BARCODE_EANX_CC", BARCODE_EANX_CC, 130 }, { "BARCODE_EANX_CC", BARCODE_EANX_CC, 130 },
@ -1550,7 +1550,6 @@ static int test_prev_ZBarcode_BarcodeName(int symbol_id, char name[32]) {
{ "BARCODE_ULTRA", BARCODE_ULTRA, 144 }, { "BARCODE_ULTRA", BARCODE_ULTRA, 144 },
{ "BARCODE_RMQR", BARCODE_RMQR, 145 }, { "BARCODE_RMQR", BARCODE_RMQR, 145 },
{ "BARCODE_BC412", BARCODE_BC412, 146 }, { "BARCODE_BC412", BARCODE_BC412, 146 },
{ "BARCODE_DXFILMEDGE", BARCODE_DXFILMEDGE, 147 },
}; };
name[0] = '\0'; name[0] = '\0';

View file

@ -2357,7 +2357,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "", -1, 124, 0, 0, 0, 0, 0, }, { "", -1, 124, 0, 0, 0, 0, 0, },
{ "", -1, 125, 0, 0, 0, 0, 0, }, { "", -1, 125, 0, 0, 0, 0, 0, },
{ "", -1, 126, 0, 0, 0, 0, 0, }, { "", -1, 126, 0, 0, 0, 0, 0, },
{ "", -1, 127, 0, 0, 0, 0, 0, }, { "", BARCODE_DXFILMEDGE, 127, 0, 0, 0, 0, 0, },
{ "aztecrune", BARCODE_AZRUNE, 128, 0, 0, 0, 0, 0, }, { "aztecrune", BARCODE_AZRUNE, 128, 0, 0, 0, 0, 0, },
{ "code32", BARCODE_CODE32, 129, 0, 0, 0, 0, 0, }, { "code32", BARCODE_CODE32, 129, 0, 0, 0, 0, 0, },
{ "ean13composite", BARCODE_EANX_CC, 130, 1, 1, 0, 72 /*linear_row_height*/, 1 /*gs1_cvt*/, }, { "ean13composite", BARCODE_EANX_CC, 130, 1, 1, 0, 72 /*linear_row_height*/, 1 /*gs1_cvt*/, },
@ -3513,6 +3513,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
return 0; return 0;
} }
/* Append multiple segments together and then call `testUtilBwipp()` */
int testUtilBwippSegs(int index, struct zint_symbol *symbol, int option_1, int option_2, int option_3, int testUtilBwippSegs(int index, struct zint_symbol *symbol, int option_1, int option_2, int option_3,
const struct zint_seg segs[], const int seg_count, const char *primary, char *buffer, int buffer_size) { const struct zint_seg segs[], const int seg_count, const char *primary, char *buffer, int buffer_size) {
const int symbology = symbol->symbology; const int symbology = symbol->symbology;
@ -3679,6 +3680,7 @@ int testUtilHaveZXingCPPDecoder(void) {
return system("zxingcppdecoder " DEV_NULL_STDERR) == 0; return system("zxingcppdecoder " DEV_NULL_STDERR) == 0;
} }
/* Helper to test whether have non-ASCII */
static int testUtilHasNonASCII(const char *source, const int length) { static int testUtilHasNonASCII(const char *source, const int length) {
int i; int i;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
@ -3825,7 +3827,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "", -1, 124, }, { "", -1, 124, },
{ "", -1, 125, }, { "", -1, 125, },
{ "", -1, 126, }, { "", -1, 126, },
{ "", -1, 127, }, { "DXFilmEdge", BARCODE_DXFILMEDGE, 127, },
{ "", BARCODE_AZRUNE, 128, }, { "", BARCODE_AZRUNE, 128, },
{ "", BARCODE_CODE32, 129, }, /* Code39 based */ { "", BARCODE_CODE32, 129, }, /* Code39 based */
{ "", BARCODE_EANX_CC, 130, }, { "", BARCODE_EANX_CC, 130, },
@ -3844,6 +3846,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "QRCode", BARCODE_UPNQR, 143, }, { "QRCode", BARCODE_UPNQR, 143, },
{ "", BARCODE_ULTRA, 144, }, { "", BARCODE_ULTRA, 144, },
{ "RMQRCode", BARCODE_RMQR, 145, }, { "RMQRCode", BARCODE_RMQR, 145, },
{ "", BARCODE_BC412, 146, },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
@ -3906,6 +3909,7 @@ int testUtilCanZXingCPP(int index, const struct zint_symbol *symbol, const char
return testUtilZXingCPPName(index, symbol, source, length, debug) != NULL; return testUtilZXingCPPName(index, symbol, source, length, debug) != NULL;
} }
/* Run "zxingcppdecoder", returning result in `buffer` */
int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, char *bits, int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, char *bits,
char *buffer, const int buffer_size, int *p_cmp_len) { char *buffer, const int buffer_size, int *p_cmp_len) {
static const char cmd_fmt[] = "zxingcppdecoder -textonly -format %s -width %d -bits '%s'"; static const char cmd_fmt[] = "zxingcppdecoder -textonly -format %s -width %d -bits '%s'";
@ -4038,6 +4042,37 @@ INTERNAL int escape_char_process_test(struct zint_symbol *symbol, const unsigned
static const char TECHNETIUM[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; /* Same as SILVER (CODE39) */ static const char TECHNETIUM[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; /* Same as SILVER (CODE39) */
/* Helper to strip leading zeroes (as long as have at least one non-zero digit) */
static const char *testUtilZXingCPPLeadingZeroes(const char *expected) {
const char *stripped = expected;
while (*stripped == '0') stripped++;
return z_isdigit(*stripped) ? stripped : expected;
}
/* Helper to convert DX number from "NNNN"/"NNNNNN" format to "NNN-NN" format */
static int textUtilZXingCPPDX(const char *expected, const int expected_len, const char *cmp_buf, char *out) {
if (strchr(cmp_buf, '-')) {
const char *stripped;
if (strchr(expected, '-') == NULL) {
if (expected_len == 6) {
const int dx = to_int((const unsigned char *) expected + 1, expected_len - 2);
sprintf(out, "%d-%d", dx / 16, dx % 16);
} else {
const int dx = to_int((const unsigned char *) expected, expected_len);
sprintf(out, "%d-%d", dx / 16, dx % 16);
}
return 1;
}
if ((stripped = testUtilZXingCPPLeadingZeroes(expected)) != expected) {
memcpy(out, stripped, expected_len - (stripped - expected));
out[expected_len - (stripped - expected)] = '\0';
return 1;
}
}
return 0;
}
/* Massage result from "zxingcppdecoder" so as can compare to Zint input */
int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len, int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len,
const char *expected, int expected_len, const char *primary, char *ret_buf, int *p_ret_len) { const char *expected, int expected_len, const char *primary, char *ret_buf, int *p_ret_len) {
const int symbology = symbol->symbology; const int symbology = symbol->symbology;
@ -4068,6 +4103,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
? (char *) z_alloca(expected_len + 3 + 19 + 1) : NULL; ? (char *) z_alloca(expected_len + 3 + 19 + 1) : NULL;
char *dpd = need_dpd_prefix ? (char *) z_alloca(28 + 1) : NULL; char *dpd = need_dpd_prefix ? (char *) z_alloca(28 + 1) : NULL;
char *pzn = symbology == BARCODE_PZN ? (char *) z_alloca(expected_len + 1 + 1) : NULL; char *pzn = symbology == BARCODE_PZN ? (char *) z_alloca(expected_len + 1 + 1) : NULL;
char *dxfe = symbology == BARCODE_DXFILMEDGE ? (char *) z_alloca(expected_len * 2 + 1) : NULL;
int ret; int ret;
int ret_memcmp; int ret_memcmp;
@ -4226,7 +4262,6 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
expected_len++; expected_len++;
} }
c25inter[expected_len] = '\0'; c25inter[expected_len] = '\0';
printf("c25inter %s\n", c25inter);
expected = c25inter; expected = c25inter;
} }
} else if (symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT) { } else if (symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT) {
@ -4397,6 +4432,48 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
} }
expected = pzn; expected = pzn;
expected_len++; expected_len++;
} else if (symbology == BARCODE_DXFILMEDGE) {
const int dx_info_len = posn(expected, '/');
if (dx_info_len != -1) {
char frame_info[20];
assert(strlen(expected + dx_info_len + 1) < sizeof(frame_info));
strcpy(frame_info, expected + dx_info_len + 1);
to_upper((unsigned char *) frame_info, (int) strlen(frame_info));
if (!textUtilZXingCPPDX(expected, dx_info_len, cmp_buf, dxfe)) {
memcpy(dxfe, expected, dx_info_len);
dxfe[dx_info_len] = '\0';
}
if (strcmp(frame_info, "S") == 0 || strcmp(frame_info, "X") == 0) {
strcat(dxfe, "/62");
} else if (strcmp(frame_info, "SA") == 0 || strcmp(frame_info, "XA") == 0) {
strcat(dxfe, "/62A");
} else if (strcmp(frame_info, "K") == 0 || strcmp(frame_info, "00") == 0) {
strcat(dxfe, "/63");
} else if (strcmp(frame_info, "KA") == 0 || strcmp(frame_info, "00A") == 0) {
strcat(dxfe, "/63A");
} else if (strcmp(frame_info, "F") == 0) {
strcat(dxfe, "/0");
} else if (strcmp(frame_info, "FA") == 0) {
strcat(dxfe, "/0A");
} else {
const char *stripped;
if ((stripped = testUtilZXingCPPLeadingZeroes(frame_info)) != frame_info) {
strcat(dxfe, "/");
strcat(dxfe, stripped);
} else {
strcat(dxfe, expected + dx_info_len);
}
}
expected = dxfe;
expected_len = (int) strlen(expected);
to_upper((unsigned char *) expected, expected_len);
} else {
if (textUtilZXingCPPDX(expected, expected_len, cmp_buf, dxfe)) {
expected = dxfe;
expected_len = (int) strlen(expected);
}
}
} }
if (ret_buf) { if (ret_buf) {

View file

@ -248,6 +248,7 @@ extern "C" {
#define BARCODE_MAILMARK 121 /* Legacy */ #define BARCODE_MAILMARK 121 /* Legacy */
/* Zint specific */ /* Zint specific */
#define BARCODE_DXFILMEDGE 127 /* DX Film Edge Barcode on 35mm and APS films */
#define BARCODE_AZRUNE 128 /* Aztec Runes */ #define BARCODE_AZRUNE 128 /* Aztec Runes */
#define BARCODE_CODE32 129 /* Code 32 */ #define BARCODE_CODE32 129 /* Code 32 */
#define BARCODE_EANX_CC 130 /* EAN Composite */ #define BARCODE_EANX_CC 130 /* EAN Composite */
@ -274,8 +275,7 @@ extern "C" {
#define BARCODE_ULTRA 144 /* Ultracode */ #define BARCODE_ULTRA 144 /* Ultracode */
#define BARCODE_RMQR 145 /* Rectangular Micro QR Code (rMQR) */ #define BARCODE_RMQR 145 /* Rectangular Micro QR Code (rMQR) */
#define BARCODE_BC412 146 /* IBM BC412 (SEMI T1-95) */ #define BARCODE_BC412 146 /* IBM BC412 (SEMI T1-95) */
#define BARCODE_DXFILMEDGE 147 /* DX Film Edge Barcode on 35mm and APS films*/ #define BARCODE_LAST 146 /* Max barcode number marker, not barcode */
#define BARCODE_LAST 147 /* Max barcode number marker, not barcode */
/* Output options (`symbol->output_options`) */ /* Output options (`symbol->output_options`) */
#define BARCODE_BIND_TOP 0x00001 /* Boundary bar above the symbol only (not below), does not affect stacking */ #define BARCODE_BIND_TOP 0x00001 /* Boundary bar above the symbol only (not below), does not affect stacking */

View file

@ -5450,7 +5450,7 @@ printf "%s\n" "$ac_cv_c_bigendian" >&6; }
../backend/dllversion.c ../backend/dllversion.c
../backend/dmatrix.c ../backend/dmatrix.c
../backend/dotcode.c ../backend/dotcode.c
../backend/dxfilmedge.c ../backend/dxfilmedge.c
../backend/eci.c ../backend/eci.c
../backend/emf.c ../backend/emf.c
../backend/filemem.c ../backend/filemem.c

View file

@ -51,6 +51,7 @@ PRJ_OBJS = \
$(TMP_DIR)\dllversion.obj \ $(TMP_DIR)\dllversion.obj \
$(TMP_DIR)\dmatrix.obj \ $(TMP_DIR)\dmatrix.obj \
$(TMP_DIR)\dotcode.obj \ $(TMP_DIR)\dotcode.obj \
$(TMP_DIR)\dxfilmedge.obj \
$(TMP_DIR)\eci.obj \ $(TMP_DIR)\eci.obj \
$(TMP_DIR)\emf.obj \ $(TMP_DIR)\emf.obj \
$(TMP_DIR)\filemem.obj \ $(TMP_DIR)\filemem.obj \

View file

@ -1,7 +1,7 @@
/* zint_tcl.c TCL binding for zint */ /* zint_tcl.c TCL binding for zint */
/* /*
zint - the open source tcl binding to the zint barcode library zint - the open source tcl binding to the zint barcode library
Copyright (C) 2014-2023 Harald Oehlmann <oehhar@users.sourceforge.net> Copyright (C) 2014-2024 Harald Oehlmann <oehhar@users.sourceforge.net>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -176,6 +176,8 @@
- TCL 9 compatibility - TCL 9 compatibility
- support TCL buildinfo - support TCL buildinfo
- remove the zint command on dll unload - remove the zint command on dll unload
2024-12-23 GL
- Added DXFILMEDGE
*/ */
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
@ -330,6 +332,7 @@ static const char *s_code_list[] = {
"MailMark-2D", "MailMark-2D",
"UPU-S10", "UPU-S10",
"MailMark-4S", "MailMark-4S",
"DXFilmEdge",
"AztecRunes", "AztecRunes",
"Code32", "Code32",
"EAN-CC", "EAN-CC",
@ -432,6 +435,7 @@ static const int s_code_number[] = {
BARCODE_MAILMARK_2D, BARCODE_MAILMARK_2D,
BARCODE_UPU_S10, BARCODE_UPU_S10,
BARCODE_MAILMARK_4S, BARCODE_MAILMARK_4S,
BARCODE_DXFILMEDGE,
BARCODE_AZRUNE, BARCODE_AZRUNE,
BARCODE_CODE32, BARCODE_CODE32,
BARCODE_EANX_CC, BARCODE_EANX_CC,

View file

@ -1,11 +1,11 @@
% docs/README 2024-10-27 % docs/README 2024-12-23
For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" using a recent version of pandoc For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" using a recent version of pandoc
On Ubuntu/Debian (tested on Ubuntu 22.04 and Ubuntu 24.04) On Ubuntu/Debian (tested on Ubuntu 22.04 and Ubuntu 24.04)
wget https://github.com/jgm/pandoc/releases/download/3.5/pandoc-3.5-1-amd64.deb wget https://github.com/jgm/pandoc/releases/download/3.6.1/pandoc-3.6.1-1-amd64.deb
sudo dpkg -i pandoc-3.5-1-amd64.deb sudo dpkg -i pandoc-3.6.1-1-amd64.deb
For Ubuntu 22.04 (python < 3.12) For Ubuntu 22.04 (python < 3.12)
sudo apt install python3-pip sudo apt install python3-pip
pip install pandoc-tablenos --user pip install pandoc-tablenos --user
@ -27,9 +27,9 @@ Then
On Fedora (tested on Fedora Linux 38 (Workstation Edition) and Fedora Linux 40 (Workstation Edition)) On Fedora (tested on Fedora Linux 38 (Workstation Edition) and Fedora Linux 40 (Workstation Edition))
wget https://github.com/jgm/pandoc/releases/download/3.5/pandoc-3.5-linux-amd64.tar.gz wget https://github.com/jgm/pandoc/releases/download/3.6.1/pandoc-3.6.1-linux-amd64.tar.gz
tar xf pandoc-3.5-linux-amd64.tar.gz tar xf pandoc-3.6.1-linux-amd64.tar.gz
sudo mv -i pandoc-3.5/bin/pandoc /usr/local/bin sudo mv -i pandoc-3.6.1/bin/pandoc /usr/local/bin
sudo dnf install python3-pip sudo dnf install python3-pip
pip install pandoc-tablenos --user pip install pandoc-tablenos --user
export PATH=~/.local/bin:"$PATH" export PATH=~/.local/bin:"$PATH"

View file

@ -0,0 +1,9 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="248" height="48" version="1.1" xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="248" height="48" fill="#FFFFFF"/>
<path d="M0 0h40v24h-40ZM48 0h8v24h-8ZM64 0h8v24h-8ZM80 0h8v24h-8ZM96 0h8v24h-8ZM112 0h8v24h-8ZM128 0h8v24h-8ZM144 0h8v24h-8ZM160 0h8v48h-8ZM176 0h8v48h-8ZM192 0h8v48h-8ZM208 0h8v48h-8ZM224 0h24v24h-24ZM0 24h8v24h-8ZM16 24h8v24h-8ZM32 24h8v24h-8ZM48 24h24v24h-24ZM136 24h8v24h-8ZM224 24h8v24h-8ZM240 24h8v24h-8Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 676 B

View file

@ -260,8 +260,9 @@
} }
.display.math{display: block; text-align: center; margin: 0.5rem auto;} .display.math{display: block; text-align: center; margin: 0.5rem auto;}
/* CSS for syntax highlighting */ /* CSS for syntax highlighting */
html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; } pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; } .sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; } code.sourceCode > span { color: inherit; text-decoration: inherit; }
@ -272,7 +273,7 @@
} }
@media print { @media print {
pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
} }
pre.numberSource code pre.numberSource code
{ counter-reset: source-line 0; } { counter-reset: source-line 0; }
@ -332,7 +333,7 @@
<h1 class="title">Zint Barcode Generator and Zint Barcode Studio User <h1 class="title">Zint Barcode Generator and Zint Barcode Studio User
Manual</h1> Manual</h1>
<p class="author">Version 2.13.0.9</p> <p class="author">Version 2.13.0.9</p>
<p class="date">November 2024</p> <p class="date">December 2024</p>
</header> </header>
<nav id="TOC" role="doc-toc"> <nav id="TOC" role="doc-toc">
<ul> <ul>
@ -655,6 +656,8 @@ Two-Track Pharmacode</a></li>
<li><a href="#planet" id="toc-planet">6.4.3 PLANET</a></li> <li><a href="#planet" id="toc-planet">6.4.3 PLANET</a></li>
<li><a href="#brazilian-cepnet" id="toc-brazilian-cepnet">6.4.4 <li><a href="#brazilian-cepnet" id="toc-brazilian-cepnet">6.4.4
Brazilian CEPNet</a></li> Brazilian CEPNet</a></li>
<li><a href="#dx-film-edge-barcode" id="toc-dx-film-edge-barcode">6.4.5
DX Film Edge Barcode</a></li>
</ul></li> </ul></li>
<li><a href="#state-postal-codes" id="toc-state-postal-codes">6.5 <li><a href="#state-postal-codes" id="toc-state-postal-codes">6.5
4-State Postal Codes</a> 4-State Postal Codes</a>
@ -1950,6 +1953,11 @@ Matrix)</td>
<td style="text-align: left;">Royal Mail 4-State Mailmark</td> <td style="text-align: left;">Royal Mail 4-State Mailmark</td>
</tr> </tr>
<tr> <tr>
<td style="text-align: left;">127</td>
<td style="text-align: left;"><code>BARCODE_DXFILMEDGE</code></td>
<td style="text-align: left;">DX Film Edge Barcode</td>
</tr>
<tr>
<td style="text-align: left;">128</td> <td style="text-align: left;">128</td>
<td style="text-align: left;"><code>BARCODE_AZRUNE</code></td> <td style="text-align: left;"><code>BARCODE_AZRUNE</code></td>
<td style="text-align: left;">Aztec Runes</td> <td style="text-align: left;">Aztec Runes</td>
@ -5575,6 +5583,35 @@ aria-hidden="true"><code>zint -b CEPNET --compliantheight -d "12345678"</code></
Brazilian postal service, to encode CEP (Código de Endereçamento Postal) Brazilian postal service, to encode CEP (Código de Endereçamento Postal)
numbers on mail items. Input should consist of eight digits with the numbers on mail items. Input should consist of eight digits with the
check digit being automatically added by Zint.</p> check digit being automatically added by Zint.</p>
<h3 id="dx-film-edge-barcode">6.4.5 DX Film Edge Barcode</h3>
<figure>
<img src="images/dxfilmedge.svg" title="fig:" class="trk"
alt="zint -b DXFILMEDGE --compliantheight -d &quot;112-1/10A&quot;" />
<figcaption
aria-hidden="true"><code>zint -b DXFILMEDGE --compliantheight -d "112-1/10A"</code></figcaption>
</figure>
<p>Introduced by Kodak in the 1980s, the DX (Digital Index) barcode is
printed on the bottom edge of 35mm film to aid in the reordering and
post-processing of prints.</p>
<p>The data can be in two parts. The first part (required) is the “DX
number”, identifying the manufacturer and film type - the National
Association of Photographic Manufacturers (NAPM) number. The second
part, which is optional and if present is separated from the first by a
slash (<code>/</code>), gives the frame number.</p>
<p>The DX number is in either of two formats. The first format is a
number of 1 to 4 digits (“DX Extract”) or 6 digits (“DX Full”), but for
the 6-digit version the first and last digit are ignored, leaving a
4-digit DX Extract number in any case, which must be in the range 16 to
2047. The second format “NNN-NN” represents the DX Extract as two
numbers separated by a dash (<code>-</code>), the first number being 1
to 3 digits (range 1 to 127) and the second 1 to 2 digits (range 0 to
15).<a href="#fn15" class="footnote-ref" id="fnref15"
role="doc-noteref"><sup>15</sup></a></p>
<p>The optional frame number is a number in the range 0 to 63, and may
have a half frame indicator “A” appended. Special character sequences
(with or without a half frame indicator appended) may also be used: “S”
or “X” means frame number 62, “K” or “00” means frame number 63, and “F”
means frame number 0.</p>
<h2 id="state-postal-codes">6.5 4-State Postal Codes</h2> <h2 id="state-postal-codes">6.5 4-State Postal Codes</h2>
<h3 id="australia-post-4-state-symbols">6.5.1 Australia Post 4-State <h3 id="australia-post-4-state-symbols">6.5.1 Australia Post 4-State
Symbols</h3> Symbols</h3>
@ -9497,6 +9534,9 @@ href="#fnref13" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn14"><p><code>BARCODE_CODE128AB</code> previously used the name <li id="fn14"><p><code>BARCODE_CODE128AB</code> previously used the name
<code>BARCODE_CODE128B</code>, which is still recognised.<a <code>BARCODE_CODE128B</code>, which is still recognised.<a
href="#fnref14" class="footnote-back" role="doc-backlink">↩︎</a></p></li> href="#fnref14" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn15"><p>The DX Number may be looked up in The (Modified) Big
Film Database at https://thebigfilmdatabase.merinorus.com<a
href="#fnref15" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol> </ol>
</section> </section>
</body> </body>

View file

@ -1,6 +1,6 @@
% Zint Barcode Generator and Zint Barcode Studio User Manual % Zint Barcode Generator and Zint Barcode Studio User Manual
% Version 2.13.0.9 % Version 2.13.0.9
% November 2024 % December 2024
# 1. Introduction # 1. Introduction
@ -817,6 +817,8 @@ Value
121 `BARCODE_MAILMARK_4S` Royal Mail 4-State Mailmark 121 `BARCODE_MAILMARK_4S` Royal Mail 4-State Mailmark
127 `BARCODE_DXFILMEDGE` DX Film Edge Barcode
128 `BARCODE_AZRUNE` Aztec Runes 128 `BARCODE_AZRUNE` Aztec Runes
129 `BARCODE_CODE32` Code 32 129 `BARCODE_CODE32` Code 32
@ -3733,6 +3735,37 @@ service, to encode CEP (Código de Endereçamento Postal) numbers on mail items.
Input should consist of eight digits with the check digit being automatically Input should consist of eight digits with the check digit being automatically
added by Zint. added by Zint.
### 6.4.5 DX Film Edge Barcode
![`zint -b DXFILMEDGE --compliantheight -d
"112-1/10A"`](images/dxfilmedge.svg){.trk}
Introduced by Kodak in the 1980s, the DX (Digital Index) barcode is printed on
the bottom edge of 35mm film to aid in the reordering and post-processing of
prints.
The data can be in two parts. The first part (required) is the "DX number",
identifying the manufacturer and film type - the National Association of
Photographic Manufacturers (NAPM) number. The second part, which is
optional and if present is separated from the first by a slash (`/`), gives the
frame number.
The DX number is in either of two formats. The first format is a number of 1 to
4 digits ("DX Extract") or 6 digits ("DX Full"), but for the 6-digit version the
first and last digit are ignored, leaving a 4-digit DX Extract number in any
case, which must be in the range 16 to 2047. The second format "NNN-NN"
represents the DX Extract as two numbers separated by a dash (`-`), the first
number being 1 to 3 digits (range 1 to 127) and the second 1 to 2 digits (range
0 to 15).[^15]
The optional frame number is a number in the range 0 to 63, and may have a half
frame indicator "A" appended. Special character sequences (with or without a
half frame indicator appended) may also be used: "S" or "X" means frame number
62, "K" or "00" means frame number 63, and "F" means frame number 0.
[^15]: The DX Number may be looked up in The (Modified) Big Film Database at
https://thebigfilmdatabase.merinorus.com
\clearpage \clearpage
## 6.5 4-State Postal Codes ## 6.5 4-State Postal Codes

View file

@ -1,6 +1,6 @@
Zint Barcode Generator and Zint Barcode Studio User Manual Zint Barcode Generator and Zint Barcode Studio User Manual
Version 2.13.0.9 Version 2.13.0.9
November 2024 December 2024
******************************************************************************* *******************************************************************************
* For reference the following is a text-only version of the Zint manual, * * For reference the following is a text-only version of the Zint manual, *
@ -145,6 +145,7 @@ November 2024
- 6.4.2 POSTNET - 6.4.2 POSTNET
- 6.4.3 PLANET - 6.4.3 PLANET
- 6.4.4 Brazilian CEPNet - 6.4.4 Brazilian CEPNet
- 6.4.5 DX Film Edge Barcode
- 6.5 4-State Postal Codes - 6.5 4-State Postal Codes
- 6.5.1 Australia Post 4-State Symbols - 6.5.1 Australia Post 4-State Symbols
- 6.5.1.1 Customer Barcodes - 6.5.1.1 Customer Barcodes
@ -951,6 +952,8 @@ underscores are optional.
121 BARCODE_MAILMARK_4S Royal Mail 4-State Mailmark 121 BARCODE_MAILMARK_4S Royal Mail 4-State Mailmark
127 BARCODE_DXFILMEDGE DX Film Edge Barcode
128 BARCODE_AZRUNE Aztec Runes 128 BARCODE_AZRUNE Aztec Runes
129 BARCODE_CODE32 Code 32 129 BARCODE_CODE32 Code 32
@ -3583,6 +3586,32 @@ service, to encode CEP (Código de Endereçamento Postal) numbers on mail items.
Input should consist of eight digits with the check digit being automatically Input should consist of eight digits with the check digit being automatically
added by Zint. added by Zint.
6.4.5 DX Film Edge Barcode
[zint -b DXFILMEDGE --compliantheight -d "112-1/10A"]
Introduced by Kodak in the 1980s, the DX (Digital Index) barcode is printed on
the bottom edge of 35mm film to aid in the reordering and post-processing of
prints.
The data can be in two parts. The first part (required) is the “DX number”,
identifying the manufacturer and film type - the National Association of
Photographic Manufacturers (NAPM) number. The second part, which is optional and
if present is separated from the first by a slash (/), gives the frame number.
The DX number is in either of two formats. The first format is a number of 1 to
4 digits (“DX Extract”) or 6 digits (“DX Full”), but for the 6-digit version the
first and last digit are ignored, leaving a 4-digit DX Extract number in any
case, which must be in the range 16 to 2047. The second format “NNN-NN”
represents the DX Extract as two numbers separated by a dash (-), the first
number being 1 to 3 digits (range 1 to 127) and the second 1 to 2 digits (range
0 to 15).[15]
The optional frame number is a number in the range 0 to 63, and may have a half
frame indicator “A” appended. Special character sequences (with or without a
half frame indicator appended) may also be used: “S” or “X” means frame number
62, “K” or “00” means frame number 63, and “F” means frame number 0.
6.5 4-State Postal Codes 6.5 4-State Postal Codes
6.5.1 Australia Post 4-State Symbols 6.5.1 Australia Post 4-State Symbols
@ -4829,7 +4858,7 @@ configured barcode is displayed once the "Generate" button is pressed.
Annex D. Man Page ZINT(1) Annex D. Man Page ZINT(1)
% ZINT(1) Version 2.13.0.9 % % November 2024 % ZINT(1) Version 2.13.0.9 % % December 2024
NAME NAME
@ -5581,3 +5610,6 @@ recognised.
[14] BARCODE_CODE128AB previously used the name BARCODE_CODE128B, which is still [14] BARCODE_CODE128AB previously used the name BARCODE_CODE128B, which is still
recognised. recognised.
[15] The DX Number may be looked up in The (Modified) Big Film Database at
https://thebigfilmdatabase.merinorus.com

View file

@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.5 .\" Automatically generated by Pandoc 3.6
.\" .\"
.TH "ZINT" "1" "November 2024" "Version 2.13.0.9" .TH "ZINT" "1" "December 2024" "Version 2.13.0.9"
.SH NAME .SH NAME
\f[CR]zint\f[R] \- encode data as a barcode image \f[CR]zint\f[R] \- encode data as a barcode image
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -1,6 +1,6 @@
% ZINT(1) Version 2.13.0.9 % ZINT(1) Version 2.13.0.9
% %
% November 2024 % December 2024
# NAME # NAME

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright (C) 2022 <rstuart114@gmail.com> # Copyright (C) 2022-2024 <rstuart114@gmail.com>
# #
# Generate the barcode .svg images for manual.pdf (via manual.pmd) # Generate the barcode .svg images for manual.pdf (via manual.pmd)
@ -104,6 +104,7 @@ zint -b PHARMA_TWO --compliantheight -d "29876543" --scale=$SCALE_TRACK -o image
zint -b POSTNET --compliantheight -d "12345678901" --scale=$SCALE_TRACK -o images/postnet.svg zint -b POSTNET --compliantheight -d "12345678901" --scale=$SCALE_TRACK -o images/postnet.svg
zint -b PLANET --compliantheight -d "4012345235636" --scale=$SCALE_TRACK -o images/planet.svg zint -b PLANET --compliantheight -d "4012345235636" --scale=$SCALE_TRACK -o images/planet.svg
zint -b CEPNET --compliantheight -d "12345678" --scale=$SCALE_TRACK -o images/cepnet.svg zint -b CEPNET --compliantheight -d "12345678" --scale=$SCALE_TRACK -o images/cepnet.svg
zint -b DXFILMEDGE --compliantheight -d "112-1/10A" --scale=$SCALE_TRACK -o images/dxfilmedge.svg
zint -b AUSPOST --compliantheight -d "96184209" --scale=$SCALE_TRACK -o images/auspost.svg zint -b AUSPOST --compliantheight -d "96184209" --scale=$SCALE_TRACK -o images/auspost.svg
zint -b AUSROUTE --compliantheight -d "34567890" --scale=$SCALE_TRACK -o images/ausroute.svg zint -b AUSROUTE --compliantheight -d "34567890" --scale=$SCALE_TRACK -o images/ausroute.svg
zint -b AUSREPLY --compliantheight -d "12345678" --scale=$SCALE_TRACK -o images/ausreply.svg zint -b AUSREPLY --compliantheight -d "12345678" --scale=$SCALE_TRACK -o images/ausreply.svg

View file

@ -97,26 +97,26 @@ static void types(void) {
"40 POSTNET USPS POSTNET 119 MAILMARK_2D Royal Mail 2D Mailmark\n" "40 POSTNET USPS POSTNET 119 MAILMARK_2D Royal Mail 2D Mailmark\n"
"47 MSI_PLESSEY MSI Plessey 120 UPU_S10 UPU S10\n", stdout); "47 MSI_PLESSEY MSI Plessey 120 UPU_S10 UPU S10\n", stdout);
fputs("49 FIM Facing Ident Mark 121 MAILMARK_4S RM 4-State Mailmark\n" fputs("49 FIM Facing Ident Mark 121 MAILMARK_4S RM 4-State Mailmark\n"
"50 LOGMARS LOGMARS Code 39 128 AZRUNE Aztec Runes\n" "50 LOGMARS LOGMARS Code 39 127 DXFILMEDGE DX Film Edge Barcode\n"
"51 PHARMA Pharmacode One-Track 129 CODE32 Code 32\n" "51 PHARMA Pharmacode One-Track 128 AZRUNE Aztec Runes\n"
"52 PZN Pharmazentralnummer 130 EANX_CC Composite EAN\n" "52 PZN Pharmazentralnummer 129 CODE32 Code 32\n"
"53 PHARMA_TWO Pharmacode Two-Track 131 GS1_128_CC Composite GS1-128\n", stdout); "53 PHARMA_TWO Pharmacode Two-Track 130 EANX_CC Composite EAN\n", stdout);
fputs("54 CEPNET Brazilian CEPNet 132 DBAR_OMN_CC Comp DataBar Omni\n" fputs("54 CEPNET Brazilian CEPNet 131 GS1_128_CC Composite GS1-128\n"
"55 PDF417 PDF417 133 DBAR_LTD_CC Comp DataBar Limited\n" "55 PDF417 PDF417 132 DBAR_OMN_CC Comp DataBar Omni\n"
"56 PDF417COMP Compact PDF417 134 DBAR_EXP_CC Comp DataBar Expanded\n" "56 PDF417COMP Compact PDF417 133 DBAR_LTD_CC Comp DataBar Limited\n"
"57 MAXICODE MaxiCode 135 UPCA_CC Composite UPC-A\n" "57 MAXICODE MaxiCode 134 DBAR_EXP_CC Comp DataBar Expanded\n"
"58 QRCODE QR Code 136 UPCE_CC Composite UPC-E\n", stdout); "58 QRCODE QR Code 135 UPCA_CC Composite UPC-A\n", stdout);
fputs("60 CODE128AB Code 128 (Suppress C) 137 DBAR_STK_CC Comp DataBar Stacked\n" fputs("60 CODE128AB Code 128 (Suppress C) 136 UPCE_CC Composite UPC-E\n"
"63 AUSPOST AP Standard Customer 138 DBAR_OMNSTK_CC Comp DataBar Stack Omn\n" "63 AUSPOST AP Standard Customer 137 DBAR_STK_CC Comp DataBar Stacked\n"
"66 AUSREPLY AP Reply Paid 139 DBAR_EXPSTK_CC Comp DataBar Exp Stack\n" "66 AUSREPLY AP Reply Paid 138 DBAR_OMNSTK_CC Comp DataBar Stack Omn\n"
"67 AUSROUTE AP Routing 140 CHANNEL Channel Code\n" "67 AUSROUTE AP Routing 139 DBAR_EXPSTK_CC Comp DataBar Exp Stack\n"
"68 AUSREDIRECT AP Redirection 141 CODEONE Code One\n", stdout); "68 AUSREDIRECT AP Redirection 140 CHANNEL Channel Code\n", stdout);
fputs("69 ISBNX ISBN 142 GRIDMATRIX Grid Matrix\n" fputs("69 ISBNX ISBN 141 CODEONE Code One\n"
"70 RM4SCC Royal Mail 4SCC 143 UPNQR UPN QR Code\n" "70 RM4SCC Royal Mail 4SCC 142 GRIDMATRIX Grid Matrix\n"
"71 DATAMATRIX Data Matrix 144 ULTRA Ultracode\n" "71 DATAMATRIX Data Matrix 143 UPNQR UPN QR Code\n"
"72 EAN14 EAN-14 145 RMQR Rectangular Micro QR\n" "72 EAN14 EAN-14 144 ULTRA Ultracode\n"
"73 VIN Vehicle Information No. 146 BC412 BC412\n", stdout); "73 VIN Vehicle Information No. 145 RMQR Rectangular Micro QR\n", stdout);
fputs("74 CODABLOCKF Codablock-F 147 DXFILMEDGE DX Film Edge\n", stdout); fputs("74 CODABLOCKF Codablock-F 146 BC412 BC412\n", stdout);
} }
/* Output version information */ /* Output version information */