general: change BARCODE_RAW_TEXT to write to new zint_symbol

fields `raw_segs` and `raw_seg_count` instead of `text`, and to
  do so for all symbologies, using new common funcs `rt_cpy()` etc.
MICROPDF417: return ECC percentage in top byte of `option_1`
DBAR_EXP_STK: return `option_2`/`option_3` feedback
CLI: change warning text "ignoring" -> "**IGNORED**"
GUI: show feedback for DBAR_EXP_STK, MICROPDF417, UPNQR
ctest: fix recent inability to run tests via "ctest" on Windows
  (MSVC) by using cmake 3.22 feature `ENVIRONMENT_MODIFICATION`
manual: document feedback and RAW_TEXT in new "Feedback" section;
  rephrase some symbology descriptions
test suite: new general-use arg "-a"; add `func_name` to context;
  new "test_bwipp" test for testing BWIPP against ZXing-C++
This commit is contained in:
gitlost 2025-03-28 10:02:19 +00:00
parent d1bf02e156
commit a6c225447e
120 changed files with 10511 additions and 5620 deletions

View file

@ -911,15 +911,20 @@ INTERNAL void sjis_cpy(const unsigned char source[], int *p_length, unsigned int
}
/* Call `sjis_cpy()` for each segment */
INTERNAL void sjis_cpy_segs(struct zint_seg segs[], const int seg_count, unsigned int *ddata,
const int full_multibyte) {
INTERNAL int sjis_cpy_segs(struct zint_symbol *symbol, struct zint_seg segs[], const int seg_count,
unsigned int *ddata, const int full_multibyte) {
int i;
unsigned int *dd = ddata;
const int raw_text = symbol->output_options & BARCODE_RAW_TEXT; /* Note only called for DATA_MODE */
for (i = 0; i < seg_count; i++) {
sjis_cpy(segs[i].source, &segs[i].length, dd, full_multibyte);
if (raw_text && rt_cpy_seg_ddata(symbol, i, &segs[i], 0 /*eci*/, dd)) {
return ZINT_ERROR_MEMORY; /* `rt_cpy_seg_ddata()` only fails with OOM */
}
dd += segs[i].length;
}
return 0;
}
/* Convert UTF-8 string to ECI and place in array of ints using `sjis_cpy()` */
@ -1013,15 +1018,21 @@ INTERNAL void gb2312_cpy_test(const unsigned char source[], int *p_length, unsig
#endif
/* Call `gb2312_cpy()` for each segment */
INTERNAL void gb2312_cpy_segs(struct zint_seg segs[], const int seg_count, unsigned int *ddata,
const int full_multibyte) {
INTERNAL int gb2312_cpy_segs(struct zint_symbol *symbol, struct zint_seg segs[], const int seg_count,
unsigned int *ddata, const int full_multibyte) {
int i;
unsigned int *dd = ddata;
const int raw_text = symbol->output_options & BARCODE_RAW_TEXT;
for (i = 0; i < seg_count; i++) {
const int eci = segs[i].eci ? segs[i].eci : 29; /* Need to set as `rt_cpy_seg_ddata()` defaults to 3 */
gb2312_cpy(segs[i].source, &segs[i].length, dd, full_multibyte);
if (raw_text && rt_cpy_seg_ddata(symbol, i, &segs[i], eci, dd)) {
return ZINT_ERROR_MEMORY; /* `rt_cpy_seg_ddata()` only fails with OOM */
}
dd += segs[i].length;
}
return 0;
}
/* Convert UTF-8 string to ECI and place in array of ints using `gb2312_cpy()` */
@ -1132,15 +1143,20 @@ INTERNAL void gb18030_cpy_test(const unsigned char source[], int *p_length, unsi
#endif
/* Call `gb18030_cpy()` for each segment */
INTERNAL void gb18030_cpy_segs(struct zint_seg segs[], const int seg_count, unsigned int *ddata,
const int full_multibyte) {
INTERNAL int gb18030_cpy_segs(struct zint_symbol *symbol, struct zint_seg segs[], const int seg_count,
unsigned int *ddata, const int full_multibyte) {
int i;
unsigned int *dd = ddata;
const int raw_text = symbol->output_options & BARCODE_RAW_TEXT;
for (i = 0; i < seg_count; i++) {
gb18030_cpy(segs[i].source, &segs[i].length, dd, full_multibyte);
if (raw_text && rt_cpy_seg_ddata(symbol, i, &segs[i], 0 /*eci*/, dd)) {
return ZINT_ERROR_MEMORY; /* `rt_cpy_seg_ddata()` only fails with OOM */
}
dd += segs[i].length;
}
return 0;
}
/* Convert UTF-8 string to ECI and place in array of ints using `gb18030_cpy()` */