CODE128: Add minimal encodation algorithm (non-extended ASCII only)

from ZXing (props Alex Geller) - about 25-60% slower depending on
  data & stack heavy but does improve some outcomes when FNC1s
  present (GS1_MODE or manual) although not much else it appears
  (the previous algorithm was very good), but has a logical clarity
  the other lacked - funcs `c128_dxsmooth()` etc shared with
  CODE16K now moved there and renamed as `c16k_`;
  also fix extended char latching when exactly 4 extended chars
  at end
  also manual code set switching now honoured exactly even if
  immediate shift required;
manual: make explicit that AI "(00)" and "(01)" prefixes added by
  Zint are HRT-only
general: add `extern "C"` wrappers to a few header files
This commit is contained in:
gitlost 2024-09-07 12:44:16 +01:00
parent 10747d6385
commit 93c3e27fba
23 changed files with 1017 additions and 958 deletions

View file

@ -39,23 +39,11 @@ extern "C" {
/* Allow for a reasonable number of special Code Set escapes and for GS1 AI delimiters */
#define C128_MAX 256
#define C128_LATCHA 'A'
#define C128_LATCHB 'B'
#define C128_LATCHC 'C'
#define C128_SHIFTA 'a'
#define C128_SHIFTB 'b'
#define C128_ABORC '9'
#define C128_AORB 'Z'
INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int length);
INTERNAL int c128_parunmodd(const unsigned char llyth, const int check_fnc1);
INTERNAL void c128_dxsmooth(int list[2][C128_MAX], int *indexliste, const char *manual_set);
INTERNAL void c128_set_a(const unsigned char source, int values[], int *bar_chars);
INTERNAL int c128_set_b(const unsigned char source, int values[], int *bar_chars);
INTERNAL void c128_set_c(const unsigned char source_a, const unsigned char source_b, int values[], int *bar_chars);
INTERNAL void c128_put_in_set(int list[2][C128_MAX], const int indexliste, char set[C128_MAX],
const unsigned char *source);
INTERNAL_DATA_EXTERN const char C128Table[107][6];