2015-08-19 00:23:28 +12:00
|
|
|
/* zint_tcl.c TCL binding for zint */
|
|
|
|
/*
|
|
|
|
zint - the open source tcl binding to the zint barcode library
|
2022-04-10 22:12:18 +12:00
|
|
|
Copyright (C) 2014-2022 Harald Oehlmann <oehhar@users.sourceforge.net>
|
2015-08-19 00:23:28 +12:00
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
|
2016-09-14 19:51:54 +12:00
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
2015-08-19 00:23:28 +12:00
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
2016-09-14 19:51:54 +12:00
|
|
|
documentation and/or other materials provided with the distribution.
|
2015-08-19 00:23:28 +12:00
|
|
|
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
|
2016-09-14 19:51:54 +12:00
|
|
|
without specific prior written permission.
|
2015-08-19 00:23:28 +12:00
|
|
|
|
|
|
|
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
|
2016-09-14 19:51:54 +12:00
|
|
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
2015-08-19 00:23:28 +12:00
|
|
|
SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
History
|
|
|
|
|
|
|
|
2014-06-16 2.5.0 HaO
|
2016-10-15 03:23:15 +13:00
|
|
|
First implementation
|
|
|
|
2016-09-14 2.5.1 HaO
|
|
|
|
- Added Codablock F options "-rows".
|
2016-09-14 19:51:54 +12:00
|
|
|
- Adopted to new image format of zint
|
2016-10-15 03:23:15 +13:00
|
|
|
2016-10-14 2.5.2 HaO
|
2017-10-24 08:34:31 +13:00
|
|
|
- Include the upstream reverted image format
|
|
|
|
2016-12-12 2.5.3 HaO
|
2020-08-05 01:49:25 +12:00
|
|
|
- No changes here, take 2.5.1 framework files
|
2017-10-24 08:34:31 +13:00
|
|
|
2017-05-12 2.6.0 HaO
|
2020-08-05 01:49:25 +12:00
|
|
|
- No changes here, take 2.6 framework files
|
2017-10-24 08:34:31 +13:00
|
|
|
2017-08-29 2.6.1 HaO
|
2020-08-05 01:49:25 +12:00
|
|
|
- Framework 2.6.1 extensions
|
|
|
|
- EAN/UPC Codes with included check digit
|
|
|
|
- UPNQR Code
|
|
|
|
- Misspelled symbology: AztecRunes
|
2017-10-24 08:34:31 +13:00
|
|
|
2017-10-23 2.6.2 HaO
|
2020-08-05 01:49:25 +12:00
|
|
|
- Framework 2.6.2 bugfixes
|
|
|
|
- Allow dll unload
|
|
|
|
2018-02-13 2.6.3 HaO
|
|
|
|
- Framework trunk update
|
|
|
|
- Added VIN and MailMark symbologies.
|
|
|
|
2018-11-02 2.6.4 HaO
|
|
|
|
- Framework trunk update
|
|
|
|
- Add options -bold, -dotted, -dotsize, -dmre, -eci
|
|
|
|
- Implemented ECI logic
|
2019-09-02 22:37:01 +12:00
|
|
|
2019-09-01 2.6.5 HaO
|
2020-08-05 01:49:25 +12:00
|
|
|
- Framework 2.6.5 update
|
|
|
|
- Add option -gssep
|
2019-09-18 21:58:57 +12:00
|
|
|
2019-09-18 2.6.6 HaO
|
2020-08-05 01:49:25 +12:00
|
|
|
- Framework 2.6.6 update
|
2019-10-07 22:57:35 +13:00
|
|
|
2019-10-07 2.6.7 HaO
|
2020-08-05 01:49:25 +12:00
|
|
|
- Framework 2.6.7 update
|
2019-12-06 08:16:39 +13:00
|
|
|
2019-12-05 2.7.0 HaO
|
2020-08-05 01:49:25 +12:00
|
|
|
- Framework 2.7.0 update
|
2019-12-06 08:16:39 +13:00
|
|
|
- Add symbology rmqr
|
2020-02-02 07:36:50 +13:00
|
|
|
2020-02-01 2.7.1 HaO
|
2020-08-05 01:49:25 +12:00
|
|
|
- Framework 2.7.1 update
|
|
|
|
2020-04-06 HaO
|
|
|
|
- Added option -fullmultibyte
|
|
|
|
2020-04-07 2.8.0 HaO
|
2020-04-08 04:11:33 +12:00
|
|
|
- Added symbology "UltraCode".
|
2020-05-19 22:02:18 +12:00
|
|
|
2020-05-19 HaO
|
|
|
|
- Added option -separator to specify stacked symbology separator width
|
|
|
|
- -cols maximum changed from 66 to 67
|
2020-07-28 04:44:51 +12:00
|
|
|
2020-07-27 2.9.0 HaO
|
|
|
|
- added option "-addongap"
|
|
|
|
- Renamed symbology names:
|
|
|
|
- Matrix2of5 -> Standard2of5
|
|
|
|
- PDF417Trunc -> PDF417Compact
|
|
|
|
- RSS14Stacked -> GS1DataBarStacked
|
|
|
|
- RSS14Stacked -> GS1DataBarStacked
|
|
|
|
- RSS14StackedOmni -> GS1DataBarSstackedOmni
|
|
|
|
- RSS14ExpandedStacked -> GS1DataBarExpandedStacked
|
|
|
|
- OneCode -> USPSIntelligentMail
|
|
|
|
- EAN128-CC -> GS1-128-CC
|
|
|
|
- RSS14-CC -> GS1DataBarOmni-CC
|
|
|
|
- RSSLimited-CC -> GS1DataBarLimited-CC
|
|
|
|
- RSSExpandedStacked-CC -> GS1DataBarExpanded-CC
|
|
|
|
- RSSEXPanded-CC -> GS1DataBarExpanded-CC
|
|
|
|
- RSS14Stacked-CC -> GS1DataBarStacked-CC
|
|
|
|
- RSS14Omni-CC -> GS1DataBarStackedOmni-CC
|
|
|
|
- RSSExpandedStacked-CC -> GS1DataBarExpandedStacked-CC
|
|
|
|
*** Potential incompatibility ***
|
2020-08-05 01:49:25 +12:00
|
|
|
2020-08-04 2.10.0 HaO
|
|
|
|
- added symbology "DPDCode"
|
|
|
|
- Alpha channel support added:
|
|
|
|
- added option -nobackground
|
|
|
|
- also allow RRGGBBAA for -fg and -bg options
|
2021-01-06 02:13:11 +13:00
|
|
|
2021-01-05 2.9.1 HaO
|
|
|
|
- Added options -reverse, -werror, -wzpl
|
|
|
|
- Use version number from zint.h (first 3 digits). Do not use an own one.
|
2021-01-14 22:07:25 +13:00
|
|
|
2021-01-14 GL
|
|
|
|
- Removed TCL native encoding of ECI's and replace by zint buildin mechanism.
|
|
|
|
The input is now UTF-8 for any ECI and zint cares about the encoding.
|
2021-01-14 23:03:13 +13:00
|
|
|
2021-01-14 HaO
|
|
|
|
- Added detection of presence of the Tk package and late initialization.
|
|
|
|
This is a preparation to add a TCL only mode to the DLL.
|
2021-01-23 07:07:59 +13:00
|
|
|
2021-01-22 GL
|
|
|
|
- -cols maximum changed from 67 to 108 (DotCode)
|
2021-05-15 23:23:46 +12:00
|
|
|
2021-05-10 GL
|
|
|
|
- Added -gs1parens option
|
2021-05-26 07:42:26 +12:00
|
|
|
2021-05-22 GL
|
|
|
|
- Added -vwhitesp option
|
2021-05-29 02:05:06 +12:00
|
|
|
2021-05-28 GL
|
|
|
|
- -cols maximum changed from 108 to 200 (DotCode)
|
2021-07-14 04:39:03 +12:00
|
|
|
2021-07-09 GL
|
|
|
|
- Removed -wzpl, added -gs1nocheck
|
|
|
|
- Made -format position independent
|
|
|
|
- Tabs -> spaces
|
2021-09-22 11:04:15 +12:00
|
|
|
2021-09-21 GL
|
|
|
|
- Added -guarddescent option
|
|
|
|
- iHeight check int -> double
|
2021-09-25 00:21:24 +12:00
|
|
|
2021-09-24 GL
|
|
|
|
- Added -quietzones and -noquietzones options
|
Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
DOTCODE: use pre-calculated generator poly coeffs in Reed-Solomon for
performance improvement
PDF417/MICROPDF417: use common routine pdf417_initial()
GUI: code lines <= 118, shorthand widget_obj(),
shorten calling upcean_addon_gap(), upcean_guard_descent()
various backend: var name debug -> debug_print
2021-09-29 09:42:44 +13:00
|
|
|
2021-09-27 GL
|
|
|
|
- Added -structapp
|
|
|
|
- Split up -to parsing (could seg fault if given non-int for X0 or Y0)
|
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
|
|
|
2021-10-05 GL
|
|
|
|
- Added -compliantheight option
|
2021-10-31 10:00:31 +13:00
|
|
|
2021-10-30 GL
|
|
|
|
- Added PDF417 -rows
|
2021-11-21 00:32:30 +13:00
|
|
|
2021-11-19 GL
|
|
|
|
- Added -heightperrow option
|
|
|
|
- Added DBAR_EXPSTK, CODE16K, CODE49 -rows
|
2021-12-19 05:22:02 +13:00
|
|
|
2021-12-17 GL
|
|
|
|
- Added -fast option
|
2022-04-10 22:12:18 +12:00
|
|
|
2022-04-08 GL
|
|
|
|
- Updated ECIs to AIM ITS/04-023:2022
|
|
|
|
Note changed names "unicode" -> "utf-16be", "euc-cn" -> "gb2312"
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
2022-04-24 GL
|
|
|
|
- Added -segN options
|
|
|
|
- Added "invariant" and "binary" ECIs
|
|
|
|
- Tcl_GetIndexFromObj() flags arg -> 0
|
2022-05-13 07:35:06 +12:00
|
|
|
2022-05-12 GL
|
|
|
|
- -vers maximum changed to 999 (DAFT)
|
2022-08-21 07:45:51 +12:00
|
|
|
2022-07-03 GL
|
|
|
|
- Added BC412
|
|
|
|
2022-08-20 GL
|
|
|
|
- Added CEPNet
|
2015-08-19 00:23:28 +12:00
|
|
|
*/
|
|
|
|
|
2016-07-04 23:46:30 +12:00
|
|
|
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
2015-08-19 00:23:28 +12:00
|
|
|
#pragma warning(disable : 4201 4214 4514)
|
|
|
|
#define STRICT
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
/* TCL Defines */
|
|
|
|
#define DLL_BUILD
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
/* Define ERROR_INVALID_DATA is also used by zint... */
|
|
|
|
#ifdef ERROR_INVALID_DATA
|
|
|
|
#undef ERROR_INVALID_DATA
|
|
|
|
#endif
|
2016-07-04 23:46:30 +12:00
|
|
|
#endif
|
2015-08-19 00:23:28 +12:00
|
|
|
|
|
|
|
#include <zint.h>
|
2021-01-06 02:13:11 +13:00
|
|
|
/* Load version defines */
|
|
|
|
#include <zintconfig.h>
|
2016-07-04 23:46:30 +12:00
|
|
|
#include <string.h>
|
2015-08-19 00:23:28 +12:00
|
|
|
|
2016-07-04 23:46:30 +12:00
|
|
|
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
2015-08-19 00:23:28 +12:00
|
|
|
#define USE_TCL_STUBS
|
|
|
|
#define USE_TK_STUBS
|
2016-07-04 23:46:30 +12:00
|
|
|
#endif
|
|
|
|
|
2015-08-19 00:23:28 +12:00
|
|
|
#include <tcl.h>
|
2016-09-14 19:51:54 +12:00
|
|
|
#include <tk.h>
|
2015-08-19 00:23:28 +12:00
|
|
|
|
2016-07-04 23:46:30 +12:00
|
|
|
#undef EXPORT
|
|
|
|
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
|
|
|
#define EXPORT __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define EXPORT
|
|
|
|
#endif
|
2015-08-19 00:23:28 +12:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
2021-10-31 10:00:31 +13:00
|
|
|
/* >>>>> Helper defines */
|
2015-08-19 00:23:28 +12:00
|
|
|
|
2021-01-14 22:07:25 +13:00
|
|
|
/* Two macros are necessary to not include the define name, but the value */
|
2021-01-06 02:13:11 +13:00
|
|
|
#define STRING(x) #x
|
|
|
|
#define TOSTRING(x) STRING(x)
|
|
|
|
|
|
|
|
/* Define VERSION as the first 3 digits of the zint library version number */
|
|
|
|
#define VERSION TOSTRING( ZINT_VERSION_MAJOR ) \
|
|
|
|
"." TOSTRING( ZINT_VERSION_MINOR ) \
|
|
|
|
"." TOSTRING( ZINT_VERSION_RELEASE )
|
2015-08-19 00:23:28 +12:00
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* >>>> External Prototypes (exports) */
|
2016-07-04 23:46:30 +12:00
|
|
|
EXPORT int Zint_Init (Tcl_Interp *interp);
|
2017-10-24 08:34:31 +13:00
|
|
|
EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags);
|
2015-08-19 00:23:28 +12:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* >>>> local prototypes */
|
2021-01-14 23:03:13 +13:00
|
|
|
static void InterpCleanupProc(ClientData clientData, Tcl_Interp *interp);
|
|
|
|
static int CheckForTk(Tcl_Interp *interp, int *tkFlagPtr);
|
2016-09-14 19:51:54 +12:00
|
|
|
static int Zint(ClientData unused, Tcl_Interp *interp, int objc,
|
|
|
|
Tcl_Obj *CONST objv[]);
|
|
|
|
static int Encode(Tcl_Interp *interp, int objc,
|
|
|
|
Tcl_Obj *CONST objv[]);
|
2015-08-19 00:23:28 +12:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* >>>> File Global Variables */
|
|
|
|
|
|
|
|
/* >> List of Codes */
|
|
|
|
|
2021-10-31 10:00:31 +13:00
|
|
|
static const char *s_code_list[] = {
|
2016-09-14 19:51:54 +12:00
|
|
|
"Code11",
|
2020-07-28 04:44:51 +12:00
|
|
|
"Standard2of5",
|
2016-09-14 19:51:54 +12:00
|
|
|
"Interleaved2of5",
|
|
|
|
"IATAC2of5",
|
|
|
|
"Logic2of5",
|
|
|
|
"Ind2of5",
|
|
|
|
"Code39",
|
|
|
|
"Code39Extended",
|
2017-10-24 08:34:31 +13:00
|
|
|
"EAN",
|
2020-07-28 04:44:51 +12:00
|
|
|
"EAN+Check",
|
2016-09-14 19:51:54 +12:00
|
|
|
"GS1-128",
|
|
|
|
"Codabar",
|
|
|
|
"Code128",
|
|
|
|
"DPLeit",
|
|
|
|
"DPIdent",
|
|
|
|
"Code16K",
|
|
|
|
"Code49",
|
|
|
|
"Code93",
|
|
|
|
"Flat",
|
|
|
|
"GS1DataBar",
|
|
|
|
"GS1DataBarLimited",
|
|
|
|
"GS1DataBarExpanded",
|
|
|
|
"Telepen",
|
2017-10-24 08:34:31 +13:00
|
|
|
"UPC-A",
|
2020-07-28 04:44:51 +12:00
|
|
|
"UPC-A+Check",
|
2016-09-14 19:51:54 +12:00
|
|
|
"UPC-E",
|
2017-10-24 08:34:31 +13:00
|
|
|
"UPC-E+Check",
|
2020-10-04 10:51:08 +13:00
|
|
|
"POSTNET",
|
2016-09-14 19:51:54 +12:00
|
|
|
"MSIPlessey",
|
|
|
|
"FIM",
|
|
|
|
"Logmars",
|
|
|
|
"Pharma",
|
|
|
|
"PZN",
|
|
|
|
"PharmaTwo",
|
2022-08-21 07:45:51 +12:00
|
|
|
"CEPNet",
|
2016-09-14 19:51:54 +12:00
|
|
|
"PDF417",
|
2020-07-28 04:44:51 +12:00
|
|
|
"PDF417Compact",
|
2016-09-14 19:51:54 +12:00
|
|
|
"MaxiCode",
|
|
|
|
"QR",
|
|
|
|
"Code128B",
|
|
|
|
"AusPost",
|
|
|
|
"AusReply",
|
|
|
|
"AusRoute",
|
|
|
|
"AusRedirect",
|
|
|
|
"ISBN",
|
|
|
|
"RM4SCC",
|
|
|
|
"Datamatrix",
|
2020-08-05 01:49:25 +12:00
|
|
|
"EAN14",
|
2020-07-28 04:44:51 +12:00
|
|
|
"VIN",
|
2016-09-14 19:51:54 +12:00
|
|
|
"CodablockF",
|
|
|
|
"NVE18",
|
|
|
|
"JapanPost",
|
|
|
|
"KoreaPost",
|
2020-07-28 04:44:51 +12:00
|
|
|
"GS1DataBarStacked",
|
|
|
|
"GS1DataBarSstackedOmni",
|
|
|
|
"GS1DataBarExpandedStacked",
|
2020-10-04 10:51:08 +13:00
|
|
|
"PLANET",
|
2020-08-05 01:49:25 +12:00
|
|
|
"DPDCode",
|
2016-09-14 19:51:54 +12:00
|
|
|
"MicroPDF417",
|
2020-07-28 04:44:51 +12:00
|
|
|
"USPSIntelligentMail",
|
2016-09-14 19:51:54 +12:00
|
|
|
"Plessey",
|
|
|
|
"TelepenNum",
|
|
|
|
"ITF14",
|
|
|
|
"KIX",
|
|
|
|
"Aztec",
|
|
|
|
"DAFT",
|
|
|
|
"MicroQR",
|
|
|
|
"HIBC-128",
|
|
|
|
"HIBC-39",
|
|
|
|
"HIBC-DM",
|
|
|
|
"HIBC-QR",
|
|
|
|
"HIBC-PDF",
|
|
|
|
"HIBC-MicroPDF",
|
|
|
|
"HIBC-CodablockF",
|
2017-10-24 08:34:31 +13:00
|
|
|
"HIBCAztec",
|
2020-07-28 04:44:51 +12:00
|
|
|
"DotCode",
|
2020-08-05 01:49:25 +12:00
|
|
|
"HanXin",
|
2020-07-28 04:44:51 +12:00
|
|
|
"MailMark",
|
2017-08-30 08:19:55 +12:00
|
|
|
"AztecRunes",
|
2016-09-14 19:51:54 +12:00
|
|
|
"Code32",
|
|
|
|
"EAN-CC",
|
2020-07-28 04:44:51 +12:00
|
|
|
"GS1-128-CC",
|
|
|
|
"GS1DataBarOmni-CC",
|
|
|
|
"GS1DataBarLimited-CC",
|
|
|
|
"GS1DataBarExpanded-CC",
|
2016-09-14 19:51:54 +12:00
|
|
|
"UPCA-CC",
|
|
|
|
"UPCE-CC",
|
2020-07-28 04:44:51 +12:00
|
|
|
"GS1DataBarStacked-CC",
|
|
|
|
"GS1DataBarStackedOmni-CC",
|
|
|
|
"GS1DataBarExpandedStacked-CC",
|
2016-09-14 19:51:54 +12:00
|
|
|
"Channel",
|
|
|
|
"CodeOne",
|
2016-10-15 03:23:15 +13:00
|
|
|
"GridMatrix",
|
2020-08-05 01:49:25 +12:00
|
|
|
"UPNQR",
|
|
|
|
"UltraCode",
|
2019-12-06 08:16:39 +13:00
|
|
|
"rMQR",
|
2022-07-04 10:54:42 +12:00
|
|
|
"BC412",
|
2016-09-14 19:51:54 +12:00
|
|
|
NULL};
|
2015-08-19 00:23:28 +12:00
|
|
|
|
2021-10-31 10:00:31 +13:00
|
|
|
static const int s_code_number[] = {
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_CODE11,
|
2020-07-30 07:43:08 +12:00
|
|
|
BARCODE_C25STANDARD,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_C25INTER,
|
|
|
|
BARCODE_C25IATA,
|
|
|
|
BARCODE_C25LOGIC,
|
|
|
|
BARCODE_C25IND,
|
|
|
|
BARCODE_CODE39,
|
|
|
|
BARCODE_EXCODE39,
|
2017-10-24 08:34:31 +13:00
|
|
|
BARCODE_EANX,
|
2020-08-05 01:49:25 +12:00
|
|
|
BARCODE_EANX_CHK,
|
2020-07-30 07:43:08 +12:00
|
|
|
BARCODE_GS1_128,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_CODABAR,
|
|
|
|
BARCODE_CODE128,
|
|
|
|
BARCODE_DPLEIT,
|
|
|
|
BARCODE_DPIDENT,
|
|
|
|
BARCODE_CODE16K,
|
|
|
|
BARCODE_CODE49,
|
|
|
|
BARCODE_CODE93,
|
|
|
|
BARCODE_FLAT,
|
2020-07-30 07:43:08 +12:00
|
|
|
BARCODE_DBAR_OMN,
|
|
|
|
BARCODE_DBAR_LTD,
|
|
|
|
BARCODE_DBAR_EXP,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_TELEPEN,
|
2017-10-24 08:34:31 +13:00
|
|
|
BARCODE_UPCA,
|
2020-08-05 01:49:25 +12:00
|
|
|
BARCODE_UPCA_CHK,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_UPCE,
|
2017-10-24 08:34:31 +13:00
|
|
|
BARCODE_UPCE_CHK,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_POSTNET,
|
|
|
|
BARCODE_MSI_PLESSEY,
|
|
|
|
BARCODE_FIM,
|
|
|
|
BARCODE_LOGMARS,
|
|
|
|
BARCODE_PHARMA,
|
|
|
|
BARCODE_PZN,
|
|
|
|
BARCODE_PHARMA_TWO,
|
2022-08-21 07:45:51 +12:00
|
|
|
BARCODE_CEPNET,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_PDF417,
|
2020-07-30 09:35:31 +12:00
|
|
|
BARCODE_PDF417COMP,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_MAXICODE,
|
|
|
|
BARCODE_QRCODE,
|
|
|
|
BARCODE_CODE128B,
|
|
|
|
BARCODE_AUSPOST,
|
|
|
|
BARCODE_AUSREPLY,
|
|
|
|
BARCODE_AUSROUTE,
|
|
|
|
BARCODE_AUSREDIRECT,
|
|
|
|
BARCODE_ISBNX,
|
|
|
|
BARCODE_RM4SCC,
|
|
|
|
BARCODE_DATAMATRIX,
|
2020-08-05 01:49:25 +12:00
|
|
|
BARCODE_EAN14,
|
|
|
|
BARCODE_VIN,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_CODABLOCKF,
|
|
|
|
BARCODE_NVE18,
|
|
|
|
BARCODE_JAPANPOST,
|
|
|
|
BARCODE_KOREAPOST,
|
2020-07-30 07:43:08 +12:00
|
|
|
BARCODE_DBAR_STK,
|
|
|
|
BARCODE_DBAR_OMNSTK,
|
|
|
|
BARCODE_DBAR_EXPSTK,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_PLANET,
|
2020-08-05 01:49:25 +12:00
|
|
|
BARCODE_DPD,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_MICROPDF417,
|
2020-07-30 07:43:08 +12:00
|
|
|
BARCODE_USPS_IMAIL,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_PLESSEY,
|
|
|
|
BARCODE_TELEPEN_NUM,
|
|
|
|
BARCODE_ITF14,
|
|
|
|
BARCODE_KIX,
|
|
|
|
BARCODE_AZTEC,
|
|
|
|
BARCODE_DAFT,
|
|
|
|
BARCODE_MICROQR,
|
|
|
|
BARCODE_HIBC_128,
|
|
|
|
BARCODE_HIBC_39,
|
|
|
|
BARCODE_HIBC_DM,
|
|
|
|
BARCODE_HIBC_QR,
|
|
|
|
BARCODE_HIBC_PDF,
|
|
|
|
BARCODE_HIBC_MICPDF,
|
|
|
|
BARCODE_HIBC_BLOCKF,
|
2017-10-24 08:34:31 +13:00
|
|
|
BARCODE_HIBC_AZTEC,
|
2020-08-05 01:49:25 +12:00
|
|
|
BARCODE_DOTCODE,
|
|
|
|
BARCODE_HANXIN,
|
|
|
|
BARCODE_MAILMARK,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_AZRUNE,
|
|
|
|
BARCODE_CODE32,
|
|
|
|
BARCODE_EANX_CC,
|
2020-07-30 07:43:08 +12:00
|
|
|
BARCODE_GS1_128_CC,
|
|
|
|
BARCODE_DBAR_OMN_CC,
|
|
|
|
BARCODE_DBAR_LTD_CC,
|
|
|
|
BARCODE_DBAR_EXP_CC,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_UPCA_CC,
|
|
|
|
BARCODE_UPCE_CC,
|
2020-07-30 07:43:08 +12:00
|
|
|
BARCODE_DBAR_STK_CC,
|
|
|
|
BARCODE_DBAR_OMNSTK_CC,
|
|
|
|
BARCODE_DBAR_EXPSTK_CC,
|
2016-09-14 19:51:54 +12:00
|
|
|
BARCODE_CHANNEL,
|
|
|
|
BARCODE_CODEONE,
|
2016-10-15 03:23:15 +13:00
|
|
|
BARCODE_GRIDMATRIX,
|
2020-08-05 01:49:25 +12:00
|
|
|
BARCODE_UPNQR,
|
|
|
|
BARCODE_ULTRA,
|
2019-12-06 08:16:39 +13:00
|
|
|
BARCODE_RMQR,
|
2022-07-04 10:54:42 +12:00
|
|
|
BARCODE_BC412,
|
2016-09-14 19:51:54 +12:00
|
|
|
0};
|
2015-08-19 00:23:28 +12:00
|
|
|
|
2018-11-03 06:48:04 +13:00
|
|
|
/* ECI TCL encoding names.
|
|
|
|
* The ECI comments are given after the name.
|
|
|
|
* A ** indicates encodings where native data must be delivered and not utf-8
|
|
|
|
*/
|
2021-10-31 10:00:31 +13:00
|
|
|
static const char *s_eci_list[] = {
|
2018-11-03 06:48:04 +13:00
|
|
|
"iso8859-1", /* 3: ISO-8859-1 - Latin alphabet No. 1 (default)*/
|
|
|
|
"iso8859-2", /* 4: ISO-8859-2 - Latin alphabet No. 2*/
|
|
|
|
"iso8859-3", /* 5: ISO-8859-3 - Latin alphabet No. 3*/
|
|
|
|
"iso8859-4", /* 6: ISO-8859-4 - Latin alphabet No. 4*/
|
|
|
|
"iso8859-5", /* 7: ISO-8859-5 - Latin/Cyrillic alphabet*/
|
|
|
|
"iso8859-6", /* 8: ISO-8859-6 - Latin/Arabic alphabet*/
|
|
|
|
"iso8859-7", /* 9: ISO-8859-7 - Latin/Greek alphabet*/
|
|
|
|
"iso8859-9", /*10: ISO-8859-8 - Latin/Hebrew alphabet*/
|
|
|
|
"iso8859-9", /*11: ISO-8859-9 - Latin alphabet No. 5*/
|
|
|
|
"iso8859-10", /*12: ISO-8859-10 - Latin alphabet No. 6*/
|
|
|
|
"iso8859-11", /*13: ISO-8859-11 - Latin/Thai alphabet*/
|
|
|
|
"iso8859-13", /*15: ISO-8859-13 - Latin alphabet No. 7*/
|
|
|
|
"iso8859-14", /*16: ISO-8859-14 - Latin alphabet No. 8 (Celtic)*/
|
|
|
|
"iso8859-15", /*17: ISO-8859-15 - Latin alphabet No. 9*/
|
|
|
|
"iso8859-16", /*18: ISO-8859-16 - Latin alphabet No. 10*/
|
2021-01-13 03:11:53 +13:00
|
|
|
"jis0208", /*20: Shift JIS (JIS X 0208 and JIS X 0201)*/
|
2018-11-03 06:48:04 +13:00
|
|
|
"cp1250", /*21: Windows-1250*/
|
|
|
|
"cp1251", /*22: Windows-1251*/
|
|
|
|
"cp1252", /*23: Windows-1252*/
|
|
|
|
"cp1256", /*24: Windows-1256*/
|
2022-04-10 22:12:18 +12:00
|
|
|
"utf-16be", /*25: UTF-16BE (High order byte first) Unicode*/
|
2018-11-03 06:48:04 +13:00
|
|
|
"utf-8", /*26: Unicode (UTF-8)*/
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
"ascii", /*27: ISO-646:1991 7-bit character set ASCII*/
|
2021-01-13 03:11:53 +13:00
|
|
|
"big5", /*28: Big5 (Taiwan) Chinese Character Set*/
|
2022-04-10 22:12:18 +12:00
|
|
|
"gb2312", /*29: GB 2312 (PRC) Chinese Character Set*/
|
2021-03-21 03:36:21 +13:00
|
|
|
"iso2022-kr", /*30: Korean Character Set EUC-KR (KS X 1001:2002)*/
|
2022-04-10 22:12:18 +12:00
|
|
|
"gbk", /*31: GBK Chinese Character Set*/
|
|
|
|
"gb18030", /*32: GB 18030 Chinese Character Set*/
|
|
|
|
"utf-16le", /*33: UTF-16LE (Low order byte first) Unicode*/
|
|
|
|
"utf-32be", /*34: UTF-32BE (High order byte first) Unicode*/
|
|
|
|
"utf-32le", /*35: UTF-32BE (Low order byte first) Unicode*/
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
"invariant", /*170: ISO-646:1991 7-bit character set invariant*/
|
|
|
|
"binary", /*899: 8-bit binary*/
|
2020-08-05 01:49:25 +12:00
|
|
|
NULL
|
2018-11-03 06:48:04 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The ECI numerical number to pass to ZINT */
|
2021-10-31 10:00:31 +13:00
|
|
|
static const int s_eci_number[] = {
|
2022-04-10 22:12:18 +12:00
|
|
|
3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
31,32,33,34,35,170,899
|
2018-11-03 06:48:04 +13:00
|
|
|
};
|
|
|
|
|
2015-08-19 00:23:28 +12:00
|
|
|
/* Version information */
|
2021-10-31 10:00:31 +13:00
|
|
|
static const char version_string[] = VERSION;
|
2015-08-19 00:23:28 +12:00
|
|
|
/* Help text */
|
2021-10-31 10:00:31 +13:00
|
|
|
static const char help_message[] = "zint tcl(stub,obj) dll\n"
|
2018-11-03 06:48:04 +13:00
|
|
|
" Generate barcode in tk images\n"
|
2016-09-14 19:51:54 +12:00
|
|
|
"Usage:\n"
|
2021-01-14 23:03:13 +13:00
|
|
|
" zint encode data photo ?option value? ...\n"
|
2017-10-24 08:34:31 +13:00
|
|
|
" data: data to encode in the symbol\n"
|
2017-10-24 04:32:57 +13:00
|
|
|
" photo: a tcl photo image handle ('p' after 'image create photo p')\n"
|
2016-09-14 19:51:54 +12:00
|
|
|
" Available options:\n"
|
2018-11-03 06:48:04 +13:00
|
|
|
" -barcode choice: symbology, use 'zint symbology' to get a list\n"
|
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
|
|
|
" -addongap integer: (7..12, default: 9) set add-on gap in multiple of module size (EAN/UPC-CC)\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -bg color: set background color as 6 or 8 hex rrggbbaa\n"
|
|
|
|
/* cli option --binary internally handled */
|
2016-09-14 19:51:54 +12:00
|
|
|
" -bind bool: bars above/below the code, size set by -border\n"
|
2022-11-11 11:13:41 +13:00
|
|
|
" -bindtop bool: bar above the code, size set by -border\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -bold bool: use bold text\n"
|
2022-11-11 11:13:41 +13:00
|
|
|
" -border integer: width of a border around the symbol. Use with -bind/-box/-bindtop 1\n"
|
2016-09-14 19:51:54 +12:00
|
|
|
" -box bool: box around bar code, size set be -border\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
/* cli option --cmyk not supported as no corresponding output */
|
2021-10-31 10:00:31 +13:00
|
|
|
" -cols integer: Codablock F, DotCode, PDF417: number of columns\n"
|
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
|
|
|
" -compliantheight bool: warn if height not compliant, and use standard default\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
/* cli option --data is standard parameter */
|
2018-11-02 21:36:51 +13:00
|
|
|
" -dmre bool: Allow Data Matrix Rectangular Extended\n"
|
2018-11-03 06:48:04 +13:00
|
|
|
" -dotsize number: radius ratio of dots from 0.01 to 1.0\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -dotty bool: use dots instead of boxes for matrix codes\n"
|
|
|
|
/* cli option --dump not supported */
|
|
|
|
/* cli option --ecinos not supported */
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
" -eci choice: ECI to use\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
/* cli option --esc not supported */
|
2021-12-19 05:22:02 +13:00
|
|
|
" -fast bool: use fast encodation (Data Matrix)\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -fg color: set foreground color as 6 or 8 hex rrggbbaa\n"
|
|
|
|
/* replaces cli options --binary and --gs1 */
|
2020-08-05 01:49:25 +12:00
|
|
|
" -format binary|unicode|gs1: input data format. Default:unicode\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -fullmultibyte bool: allow multibyte compaction for xQR, HanXin, Gridmatrix\n"
|
|
|
|
/* cli option --gs1 replaced by -format */
|
2021-07-14 04:39:03 +12:00
|
|
|
" -gs1nocheck bool: for gs1, do not check validity of data (allows non-standard symbols)\n"
|
2021-05-15 23:23:46 +12:00
|
|
|
" -gs1parens bool: for gs1, AIs enclosed in parentheses instead of square brackets\n"
|
2020-08-05 01:49:25 +12:00
|
|
|
" -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n"
|
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
|
|
|
" -guarddescent double: Height of guard bar descent in modules (EAN/UPC only)\n"
|
2021-06-20 00:11:23 +12:00
|
|
|
" -height double: Symbol height in modules\n"
|
2021-11-21 00:32:30 +13:00
|
|
|
" -heightperrow bool: treat height as per-row\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
/* cli option --input not supported */
|
2016-09-14 19:51:54 +12:00
|
|
|
" -init bool: Create reader initialisation symbol (Code 128, Data Matrix)\n"
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
" -mask integer: set masking pattern to use (QR/MicroQR/HanXin/DotCode)\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
/* cli option --mirror not supported */
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
" -mode integer: set encoding mode (MaxiCode, Composite)\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -nobackground bool: set background transparent\n"
|
2021-09-25 00:21:24 +12:00
|
|
|
" -noquietzones bool: disable default quiet zones\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -notext bool: no interpretation line\n"
|
|
|
|
/* cli option --output not supported */
|
|
|
|
" -primary text: Structured primary data (MaxiCode, Composite)\n"
|
2021-09-25 00:21:24 +12:00
|
|
|
" -quietzones bool: add compliant quiet zones to whitespace\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -reverse bool: Reverse colours (white on black)\n"
|
|
|
|
" -rotate angle: Image rotation by 0,90 or 270 degrees\n"
|
2021-10-31 10:00:31 +13:00
|
|
|
" -rows integer: Codablock F, PDF417: number of rows\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -scale double: Scale the image to this factor\n"
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
" -scmvv integer: Prefix SCM with [)>\\R01\\Gvv (vv is integer) (MaxiCode)\n"
|
2021-10-31 10:00:31 +13:00
|
|
|
" -secure integer: EC Level (Aztec, GridMatrix, HanXin, PDF417, QR, UltraCode)\n"
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
" -segN {eci data}: Set the ECI & data content for segment N where N is 1 to 9\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -separator 0..4 (default: 1) : Stacked symbologies: separator width\n"
|
|
|
|
/* cli option --small replaced by -smalltext */
|
2016-09-14 19:51:54 +12:00
|
|
|
" -smalltext bool: tiny interpretation line font\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -square bool: force Data Matrix symbols to be square\n"
|
Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
DOTCODE: use pre-calculated generator poly coeffs in Reed-Solomon for
performance improvement
PDF417/MICROPDF417: use common routine pdf417_initial()
GUI: code lines <= 118, shorthand widget_obj(),
shorten calling upcean_addon_gap(), upcean_guard_descent()
various backend: var name debug -> debug_print
2021-09-29 09:42:44 +13:00
|
|
|
" -structapp {index count ?id?}: set Structured Append info\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
/* cli option --types not supported */
|
|
|
|
" -vers integer: Symbology option\n"
|
2022-05-13 07:35:06 +12:00
|
|
|
/* cli option --version not supported */
|
2021-05-26 07:42:26 +12:00
|
|
|
" -vwhitesp integer: vertical quiet zone in modules\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
" -whitesp integer: horizontal quiet zone in modules\n"
|
|
|
|
" -werror bool: Convert all warnings into errors\n"
|
2016-09-14 19:51:54 +12:00
|
|
|
" -to {x0 y0 ?width? ?height?}: place to put in photo image\n"
|
|
|
|
"\n"
|
|
|
|
"zint symbologies: List available symbologies\n"
|
2018-11-03 06:48:04 +13:00
|
|
|
"zint eci: List available eci tables\n"
|
2021-01-06 02:13:11 +13:00
|
|
|
"zint help\n"
|
|
|
|
"zint version\n"
|
2016-09-14 19:51:54 +12:00
|
|
|
;
|
2021-01-06 02:13:11 +13:00
|
|
|
|
2015-08-19 00:23:28 +12:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* Exported symbols */
|
2016-07-04 23:46:30 +12:00
|
|
|
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
2016-09-14 19:51:54 +12:00
|
|
|
EXPORT BOOL WINAPI DllEntryPoint (HINSTANCE hInstance,
|
|
|
|
DWORD seginfo, LPVOID lpCmdLine)
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
|
|
|
/* Don't do anything, so just return true */
|
|
|
|
return TRUE;
|
|
|
|
}
|
2016-07-04 23:46:30 +12:00
|
|
|
#endif
|
2015-08-19 00:23:28 +12:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* Initialisation Procedures */
|
2017-09-11 03:03:09 +12:00
|
|
|
EXPORT int Zint_Init (Tcl_Interp *interp)
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
2021-01-14 23:03:13 +13:00
|
|
|
int * tkFlagPtr;
|
2016-09-14 19:51:54 +12:00
|
|
|
/*------------------------------------------------------------------------*/
|
2016-07-04 23:46:30 +12:00
|
|
|
#ifdef USE_TCL_STUBS
|
2021-01-14 23:03:13 +13:00
|
|
|
if (Tcl_InitStubs(interp, "8.5", 0) == NULL)
|
2016-07-04 23:46:30 +12:00
|
|
|
#else
|
2021-01-14 23:03:13 +13:00
|
|
|
if (Tcl_PkgRequire(interp, "Tcl", "8.5", 0) == NULL)
|
2016-07-04 23:46:30 +12:00
|
|
|
#endif
|
2016-09-14 19:51:54 +12:00
|
|
|
{
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
2021-01-14 23:03:13 +13:00
|
|
|
/* This procedure is called once per thread and any thread local data */
|
|
|
|
/* should be allocated and initialized here (and not in static variables) */
|
|
|
|
|
|
|
|
/* Create a flag if Tk is loaded */
|
|
|
|
tkFlagPtr = (int *)ckalloc(sizeof(int));
|
|
|
|
*tkFlagPtr = 0;
|
|
|
|
Tcl_CallWhenDeleted(interp, InterpCleanupProc, (ClientData)tkFlagPtr);
|
2016-09-14 19:51:54 +12:00
|
|
|
/*------------------------------------------------------------------------*/
|
2021-01-14 23:03:13 +13:00
|
|
|
Tcl_CreateObjCommand(interp, "zint", Zint, (ClientData)tkFlagPtr,
|
|
|
|
(Tcl_CmdDeleteProc *)NULL);
|
2017-10-17 06:26:54 +13:00
|
|
|
Tcl_PkgProvide (interp, "zint", version_string);
|
2016-09-14 19:51:54 +12:00
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
return TCL_OK;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2021-01-14 23:03:13 +13:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* >>>> Cleanup procedure */
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* This routine is called, if a thread is terminated */
|
|
|
|
static void InterpCleanupProc(ClientData clientData, Tcl_Interp *interp)
|
|
|
|
{
|
|
|
|
ckfree( (char *)clientData );
|
|
|
|
}
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* >>>> Unload Procedures */
|
|
|
|
/*----------------------------------------------------------------------------*/
|
2017-10-24 08:34:31 +13:00
|
|
|
EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags)
|
|
|
|
{
|
2020-08-05 01:49:25 +12:00
|
|
|
// Allow unload
|
|
|
|
return TCL_OK;
|
2017-10-24 08:34:31 +13:00
|
|
|
}
|
2015-08-19 00:23:28 +12:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* >>>>> Called routine */
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* Decode tcl commands */
|
2021-01-14 23:03:13 +13:00
|
|
|
static int Zint(ClientData tkFlagPtr, Tcl_Interp *interp, int objc,
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_Obj *CONST objv[])
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
2016-09-14 19:51:54 +12:00
|
|
|
/* Option list and indexes */
|
2018-11-03 06:48:04 +13:00
|
|
|
enum iCommand {iEncode, iSymbologies, iECI, iVersion, iHelp};
|
2016-09-14 19:51:54 +12:00
|
|
|
/* choice of option */
|
|
|
|
int Index;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/* > Check if option argument is given and decode it */
|
|
|
|
if (objc > 1)
|
|
|
|
{
|
2021-07-14 04:39:03 +12:00
|
|
|
char *subCmds[] = {"encode", "symbologies", "eci", "version", "help", NULL};
|
2016-09-14 19:51:54 +12:00
|
|
|
if(Tcl_GetIndexFromObj(interp, objv[1], (const char **) subCmds,
|
|
|
|
"option", 0, &Index)
|
|
|
|
== TCL_ERROR)
|
|
|
|
{
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Tcl_WrongNumArgs(interp, 1, objv, "option");
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/* > Call functions in dependency of Index */
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
switch (Index)
|
|
|
|
{
|
|
|
|
case iEncode:
|
2021-01-14 23:03:13 +13:00
|
|
|
if (CheckForTk(interp, (int *)tkFlagPtr) != TCL_OK) {
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
return Encode(interp, objc, objv);
|
|
|
|
case iSymbologies:
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
|
|
|
Tcl_Obj *oRes;
|
|
|
|
int posCur;
|
|
|
|
oRes = Tcl_NewObj();
|
|
|
|
for (posCur = 0 ; s_code_list[posCur] != NULL; posCur++) {
|
|
|
|
if( ZBarcode_ValidID(s_code_number[posCur]) != 0) {
|
|
|
|
if (TCL_OK != Tcl_ListObjAppendElement(interp,
|
2016-09-14 19:51:54 +12:00
|
|
|
oRes, Tcl_NewStringObj(s_code_list[posCur],-1)))
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Tcl_SetObjResult(interp,oRes);
|
|
|
|
return TCL_OK;
|
|
|
|
}
|
2018-11-03 06:48:04 +13:00
|
|
|
case iECI:
|
|
|
|
{
|
|
|
|
Tcl_Obj *oRes;
|
|
|
|
int posCur;
|
|
|
|
oRes = Tcl_NewObj();
|
|
|
|
for (posCur = 0 ; s_eci_list[posCur] != NULL; posCur++) {
|
|
|
|
if (TCL_OK != Tcl_ListObjAppendElement(interp,
|
|
|
|
oRes, Tcl_NewStringObj(s_eci_list[posCur],-1)))
|
|
|
|
{
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Tcl_SetObjResult(interp,oRes);
|
|
|
|
return TCL_OK;
|
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
case iVersion:
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj(version_string, -1));
|
|
|
|
return TCL_OK;
|
|
|
|
case iHelp:
|
|
|
|
default:
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj(help_message, -1));
|
|
|
|
return TCL_OK;
|
|
|
|
}
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2021-01-14 23:03:13 +13:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
* Check availability of Tk.
|
|
|
|
*----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int CheckForTk(Tcl_Interp *interp, int *tkFlagPtr)
|
|
|
|
{
|
|
|
|
if (*tkFlagPtr > 0) {
|
|
|
|
return TCL_OK;
|
|
|
|
}
|
|
|
|
if (*tkFlagPtr == 0) {
|
|
|
|
if ( ! Tcl_PkgPresent(interp, "Tk", "8.5", 0) ) {
|
|
|
|
Tcl_SetResult(interp, "package Tk not loaded", TCL_STATIC);
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef USE_TK_STUBS
|
|
|
|
if (*tkFlagPtr < 0 || Tk_InitStubs(interp, "8.5", 0) == NULL) {
|
|
|
|
*tkFlagPtr = -1;
|
|
|
|
Tcl_SetResult(interp, "error initializing Tk", TCL_STATIC);
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
*tkFlagPtr = 1;
|
|
|
|
return TCL_OK;
|
|
|
|
}/*----------------------------------------------------------------------------*/
|
2015-08-19 00:23:28 +12:00
|
|
|
/* >>>>> Encode */
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* Encode image */
|
2016-09-14 19:51:54 +12:00
|
|
|
static int Encode(Tcl_Interp *interp, int objc,
|
|
|
|
Tcl_Obj *CONST objv[])
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
2021-01-06 02:13:11 +13:00
|
|
|
struct zint_symbol *my_symbol;
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_DString dsInput;
|
|
|
|
char *pStr = NULL;
|
|
|
|
int lStr;
|
2018-11-03 06:48:04 +13:00
|
|
|
Tcl_Encoding hZINTEncoding;
|
2016-09-14 19:51:54 +12:00
|
|
|
int rotate_angle=0;
|
|
|
|
int fError = 0;
|
|
|
|
Tcl_DString dString;
|
|
|
|
int optionPos;
|
|
|
|
int destX0 = 0;
|
|
|
|
int destY0 = 0;
|
|
|
|
int destWidth = 0;
|
|
|
|
int destHeight = 0;
|
2020-08-05 01:49:25 +12:00
|
|
|
int ECIIndex = 0;
|
2020-07-28 04:44:51 +12:00
|
|
|
int fFullMultiByte = 0;
|
|
|
|
int addon_gap = 0;
|
2020-05-19 22:02:18 +12:00
|
|
|
int Separator = 1;
|
2020-11-28 01:54:44 +13:00
|
|
|
int Mask = 0;
|
2021-10-31 10:00:31 +13:00
|
|
|
int rows = 0;
|
2021-01-06 02:13:11 +13:00
|
|
|
unsigned int cap;
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
int seg_count = 0;
|
|
|
|
int seg_no;
|
|
|
|
Tcl_Obj *pSegDataObjs[10] = {0};
|
|
|
|
Tcl_DString segInputs[10];
|
|
|
|
struct zint_seg segs[10];
|
2016-09-14 19:51:54 +12:00
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/* >> Check if at least data and object is given and a pair number of */
|
|
|
|
/* >> options */
|
|
|
|
if ( objc < 4 || (objc % 2) != 0 )
|
|
|
|
{
|
|
|
|
Tcl_WrongNumArgs(interp, 2, objv, "data photo ?-switch value?...");
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/* >>> Prepare encoding */
|
2018-11-03 06:48:04 +13:00
|
|
|
hZINTEncoding = Tcl_GetEncoding(interp, "utf-8");
|
|
|
|
if (NULL == hZINTEncoding) {
|
2016-09-14 19:51:54 +12:00
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/* >>> Prepare zint object */
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol = ZBarcode_Create();
|
|
|
|
my_symbol->input_mode = UNICODE_MODE;
|
|
|
|
my_symbol->option_3 = 0;
|
2016-09-14 19:51:54 +12:00
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/* >> Decode options */
|
|
|
|
for (optionPos = 4; optionPos < objc; optionPos+=2) {
|
|
|
|
/*--------------------------------------------------------------------*/
|
|
|
|
/* Option list and indexes */
|
2021-10-31 10:00:31 +13:00
|
|
|
static const char *optionList[] = {
|
2022-11-11 11:13:41 +13:00
|
|
|
"-addongap", "-barcode", "-bg", "-bind", "-bindtop", "-bold", "-border", "-box",
|
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
|
|
|
"-cols", "-compliantheight", "-dmre", "-dotsize", "-dotty",
|
2021-12-19 05:22:02 +13:00
|
|
|
"-eci", "-fast", "-fg", "-format", "-fullmultibyte",
|
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
|
|
|
"-gs1nocheck", "-gs1parens", "-gssep", "-guarddescent",
|
2021-11-21 00:32:30 +13:00
|
|
|
"-height", "-heightperrow", "-init", "-mask", "-mode",
|
2021-09-25 00:21:24 +12:00
|
|
|
"-nobackground", "-noquietzones", "-notext", "-primary", "-quietzones",
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
"-reverse", "-rotate", "-rows", "-scale", "-scmvv", "-secure",
|
|
|
|
"-seg1", "-seg2", "-seg3", "-seg4", "-seg5", "-seg6", "-seg7", "-seg8", "-seg9",
|
|
|
|
"-separator", "-smalltext", "-square", "-structapp",
|
2021-09-25 00:21:24 +12:00
|
|
|
"-to", "-vers", "-vwhitesp", "-werror", "-whitesp",
|
2021-01-06 02:13:11 +13:00
|
|
|
NULL};
|
2016-09-14 19:51:54 +12:00
|
|
|
enum iOption {
|
2022-11-11 11:13:41 +13:00
|
|
|
iAddonGap, iBarcode, iBG, iBind, iBindTop, iBold, iBorder, iBox,
|
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
|
|
|
iCols, iCompliantHeight, iDMRE, iDotSize, iDotty,
|
2021-12-19 05:22:02 +13:00
|
|
|
iECI, iFast, iFG, iFormat, iFullMultiByte,
|
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
|
|
|
iGS1NoCheck, iGS1Parens, iGSSep, iGuardDescent,
|
2021-11-21 00:32:30 +13:00
|
|
|
iHeight, iHeightPerRow, iInit, iMask, iMode,
|
2021-09-25 00:21:24 +12:00
|
|
|
iNoBackground, iNoQuietZones, iNoText, iPrimary, iQuietZones,
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
iReverse, iRotate, iRows, iScale, iSCMvv, iSecure,
|
|
|
|
iSeg1, iSeg2, iSeg3, iSeg4, iSeg5, iSeg6, iSeg7, iSeg8, iSeg9,
|
|
|
|
iSeparator, iSmallText, iSquare, iStructApp,
|
2021-09-25 00:21:24 +12:00
|
|
|
iTo, iVers, iVWhiteSp, iWError, iWhiteSp
|
2016-09-14 19:51:54 +12:00
|
|
|
};
|
|
|
|
int optionIndex;
|
|
|
|
int intValue;
|
|
|
|
double doubleValue;
|
|
|
|
/*--------------------------------------------------------------------*/
|
|
|
|
if(Tcl_GetIndexFromObj(interp, objv[optionPos],
|
|
|
|
(const char **) optionList,
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
"zint option", 0, &optionIndex)
|
2016-09-14 19:51:54 +12:00
|
|
|
== TCL_ERROR)
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------*/
|
|
|
|
/* >> Decode object */
|
|
|
|
switch (optionIndex) {
|
|
|
|
case iBind:
|
2022-11-11 11:13:41 +13:00
|
|
|
case iBindTop:
|
2018-11-03 06:48:04 +13:00
|
|
|
case iBold:
|
2016-09-14 19:51:54 +12:00
|
|
|
case iBox:
|
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
|
|
|
case iCompliantHeight:
|
2018-11-03 06:48:04 +13:00
|
|
|
case iDMRE:
|
|
|
|
case iDotty:
|
2021-12-19 05:22:02 +13:00
|
|
|
case iFast:
|
2021-07-14 04:39:03 +12:00
|
|
|
case iGS1NoCheck:
|
2021-05-15 23:23:46 +12:00
|
|
|
case iGS1Parens:
|
2020-08-05 01:49:25 +12:00
|
|
|
case iGSSep:
|
2021-11-21 00:32:30 +13:00
|
|
|
case iHeightPerRow:
|
2016-09-14 19:51:54 +12:00
|
|
|
case iInit:
|
2020-08-05 01:49:25 +12:00
|
|
|
case iNoBackground:
|
2021-09-25 00:21:24 +12:00
|
|
|
case iNoQuietZones:
|
2016-09-14 19:51:54 +12:00
|
|
|
case iNoText:
|
2021-09-25 00:21:24 +12:00
|
|
|
case iQuietZones:
|
2018-11-03 06:48:04 +13:00
|
|
|
case iSmallText:
|
2020-08-05 01:49:25 +12:00
|
|
|
case iSquare:
|
|
|
|
case iFullMultiByte:
|
2021-01-06 02:13:11 +13:00
|
|
|
case iReverse:
|
|
|
|
case iWError:
|
2016-09-14 19:51:54 +12:00
|
|
|
/* >> Binary options */
|
|
|
|
if (TCL_OK != Tcl_GetBooleanFromObj(interp, objv[optionPos+1],
|
|
|
|
&intValue))
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case iFG:
|
|
|
|
case iBG:
|
|
|
|
/* >> Colors */
|
|
|
|
pStr = Tcl_GetStringFromObj(objv[optionPos+1],&lStr);
|
2020-08-05 01:49:25 +12:00
|
|
|
if (lStr != 6 && lStr != 8) {
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_SetObjResult(interp,
|
2020-08-05 01:49:25 +12:00
|
|
|
Tcl_NewStringObj("Color is not 6 or 8 hex",-1));
|
2016-09-14 19:51:54 +12:00
|
|
|
fError = 1;
|
|
|
|
}
|
|
|
|
break;
|
2021-09-22 11:04:15 +12:00
|
|
|
case iHeight:
|
|
|
|
case iGuardDescent:
|
2018-11-03 06:48:04 +13:00
|
|
|
case iDotSize:
|
2016-09-14 19:51:54 +12:00
|
|
|
case iScale:
|
|
|
|
/* >> Float */
|
|
|
|
if (TCL_OK != Tcl_GetDoubleFromObj(interp, objv[optionPos+1],
|
|
|
|
&doubleValue))
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
}
|
|
|
|
break;
|
2020-07-28 04:44:51 +12:00
|
|
|
case iAddonGap:
|
2016-09-14 19:51:54 +12:00
|
|
|
case iBorder:
|
2016-10-15 03:23:15 +13:00
|
|
|
case iCols:
|
2021-05-26 07:42:26 +12:00
|
|
|
case iMask:
|
2016-09-14 19:51:54 +12:00
|
|
|
case iMode:
|
|
|
|
case iRotate:
|
2018-11-03 06:48:04 +13:00
|
|
|
case iRows:
|
|
|
|
case iSecure:
|
2020-05-19 22:02:18 +12:00
|
|
|
case iSeparator:
|
2020-12-20 06:13:35 +13:00
|
|
|
case iSCMvv:
|
2021-05-26 07:42:26 +12:00
|
|
|
case iVers:
|
|
|
|
case iVWhiteSp:
|
|
|
|
case iWhiteSp:
|
2020-11-28 01:54:44 +13:00
|
|
|
/* >> Int */
|
|
|
|
if (TCL_OK != Tcl_GetIntFromObj(interp, objv[optionPos+1],
|
|
|
|
&intValue))
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iPrimary:
|
|
|
|
/* > Primary String up to 90 characters */
|
|
|
|
/* > Output filename up to 250 characters */
|
|
|
|
Tcl_DStringInit(& dString);
|
|
|
|
pStr = Tcl_GetStringFromObj(objv[optionPos+1], &lStr);
|
2018-11-03 06:48:04 +13:00
|
|
|
Tcl_UtfToExternalDString( hZINTEncoding, pStr, lStr, &dString);
|
2016-09-14 19:51:54 +12:00
|
|
|
if (Tcl_DStringLength(&dString) > (optionIndex==iPrimary?90:250)) {
|
|
|
|
Tcl_DStringFree(&dString);
|
Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
DOTCODE: use pre-calculated generator poly coeffs in Reed-Solomon for
performance improvement
PDF417/MICROPDF417: use common routine pdf417_initial()
GUI: code lines <= 118, shorthand widget_obj(),
shorten calling upcean_addon_gap(), upcean_guard_descent()
various backend: var name debug -> debug_print
2021-09-29 09:42:44 +13:00
|
|
|
Tcl_SetObjResult(interp,Tcl_NewStringObj("String too long", -1));
|
2016-09-14 19:51:54 +12:00
|
|
|
fError = 1;
|
|
|
|
}
|
|
|
|
break;
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
case iSeg1: case iSeg2: case iSeg3: case iSeg4: case iSeg5:
|
|
|
|
case iSeg6: case iSeg7: case iSeg8: case iSeg9:
|
|
|
|
seg_no = optionIndex - iSeg1 + 1;
|
|
|
|
if (pSegDataObjs[seg_no]) {
|
|
|
|
Tcl_SetObjResult(interp, Tcl_NewStringObj("duplicate segment", -1));
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
|
|
|
Tcl_Obj *poParam;
|
|
|
|
if (TCL_OK != Tcl_ListObjLength(interp, objv[optionPos+1], &lStr)) {
|
|
|
|
Tcl_SetObjResult(interp, Tcl_Format(interp, "option %s not a list", 1, objv + optionPos));
|
|
|
|
fError = 1;
|
|
|
|
} else if (lStr != 2) {
|
|
|
|
Tcl_SetObjResult(interp, Tcl_Format(interp, "option %s not a list of 2", 1, objv + optionPos));
|
|
|
|
fError = 1;
|
|
|
|
} else if (TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
|
|
|
|
0, &poParam)
|
|
|
|
|| TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
|
|
|
|
1, &pSegDataObjs[seg_no])) {
|
|
|
|
Tcl_SetObjResult(interp, Tcl_Format(interp, "option %s list format is {eci data}", 1, objv + optionPos));
|
|
|
|
fError = 1;
|
|
|
|
} else if (Tcl_GetIndexFromObj(interp, poParam,
|
|
|
|
(const char **) s_eci_list, Tcl_GetString(objv[optionPos]), 0, &ECIIndex)
|
|
|
|
== TCL_ERROR) {
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
|
|
|
segs[seg_no].eci = s_eci_number[ECIIndex];
|
|
|
|
if (seg_no >= seg_count) {
|
|
|
|
seg_count = seg_no + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
}
|
|
|
|
if (fError) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------*/
|
|
|
|
switch (optionIndex) {
|
2020-07-28 04:44:51 +12:00
|
|
|
case iAddonGap:
|
|
|
|
if (intValue < 7 || intValue > 12) {
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Invalid add-on gap value not within 7 to 12", -1));
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
|
|
|
addon_gap = intValue;
|
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iBind:
|
|
|
|
if (intValue) {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options |= BARCODE_BIND;
|
2016-09-14 19:51:54 +12:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options &= ~BARCODE_BIND;
|
2016-09-14 19:51:54 +12:00
|
|
|
}
|
|
|
|
break;
|
2022-11-11 11:13:41 +13:00
|
|
|
case iBindTop:
|
|
|
|
if (intValue) {
|
|
|
|
my_symbol->output_options |= BARCODE_BIND_TOP;
|
|
|
|
} else {
|
|
|
|
my_symbol->output_options &= ~BARCODE_BIND_TOP;
|
|
|
|
}
|
|
|
|
break;
|
2018-11-03 06:48:04 +13:00
|
|
|
case iBold:
|
|
|
|
if (intValue) {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options |= BOLD_TEXT;
|
2018-11-03 06:48:04 +13:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options &= ~BOLD_TEXT;
|
2018-11-03 06:48:04 +13:00
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iBox:
|
|
|
|
if (intValue) {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options |= BARCODE_BOX;
|
2016-09-14 19:51:54 +12:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options &= ~BARCODE_BOX;
|
2016-09-14 19:51:54 +12:00
|
|
|
}
|
|
|
|
break;
|
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
|
|
|
case iCompliantHeight:
|
|
|
|
if (intValue) {
|
|
|
|
my_symbol->output_options |= COMPLIANT_HEIGHT;
|
|
|
|
} else {
|
|
|
|
my_symbol->output_options &= ~COMPLIANT_HEIGHT;
|
|
|
|
}
|
|
|
|
break;
|
2018-11-03 06:48:04 +13:00
|
|
|
case iDotSize:
|
|
|
|
if (doubleValue < 0.01) {
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Dot size below 0.01", -1));
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->dot_size = (float)doubleValue;
|
2018-11-03 06:48:04 +13:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case iDotty:
|
|
|
|
if (intValue) {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options |= BARCODE_DOTTY_MODE;
|
2018-11-03 06:48:04 +13:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options &= ~BARCODE_DOTTY_MODE;
|
2019-09-02 22:37:01 +12:00
|
|
|
}
|
|
|
|
break;
|
2021-12-19 05:22:02 +13:00
|
|
|
case iFast:
|
|
|
|
if (intValue) {
|
|
|
|
my_symbol->input_mode |= FAST_MODE;
|
|
|
|
} else {
|
|
|
|
my_symbol->input_mode &= ~FAST_MODE;
|
|
|
|
}
|
|
|
|
break;
|
2021-07-14 04:39:03 +12:00
|
|
|
case iGS1NoCheck:
|
|
|
|
if (intValue) {
|
|
|
|
my_symbol->input_mode |= GS1NOCHECK_MODE;
|
|
|
|
} else {
|
|
|
|
my_symbol->input_mode &= ~GS1NOCHECK_MODE;
|
|
|
|
}
|
|
|
|
break;
|
2021-05-15 23:23:46 +12:00
|
|
|
case iGS1Parens:
|
|
|
|
if (intValue) {
|
|
|
|
my_symbol->input_mode |= GS1PARENS_MODE;
|
|
|
|
} else {
|
|
|
|
my_symbol->input_mode &= ~GS1PARENS_MODE;
|
|
|
|
}
|
|
|
|
break;
|
2019-09-02 22:37:01 +12:00
|
|
|
case iGSSep:
|
|
|
|
if (intValue) {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options |= GS1_GS_SEPARATOR;
|
2019-09-02 22:37:01 +12:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options &= ~GS1_GS_SEPARATOR;
|
2018-11-03 06:48:04 +13:00
|
|
|
}
|
2020-08-05 01:49:25 +12:00
|
|
|
break;
|
|
|
|
case iFullMultiByte:
|
|
|
|
fFullMultiByte = intValue;
|
|
|
|
break;
|
2018-11-03 06:48:04 +13:00
|
|
|
case iECI:
|
|
|
|
if(Tcl_GetIndexFromObj(interp, objv[optionPos+1],
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
(const char **) s_eci_list, "-eci", 0, &ECIIndex)
|
2018-11-03 06:48:04 +13:00
|
|
|
== TCL_ERROR)
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->eci = s_eci_number[ECIIndex];
|
2018-11-03 06:48:04 +13:00
|
|
|
}
|
|
|
|
break;
|
2021-11-21 00:32:30 +13:00
|
|
|
case iHeightPerRow:
|
|
|
|
if (intValue) {
|
|
|
|
my_symbol->input_mode |= HEIGHTPERROW_MODE;
|
|
|
|
} else {
|
|
|
|
my_symbol->input_mode &= ~HEIGHTPERROW_MODE;
|
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iInit:
|
|
|
|
if (intValue) {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options |= READER_INIT;
|
2016-09-14 19:51:54 +12:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options &= ~READER_INIT;
|
2016-09-14 19:51:54 +12:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case iSmallText:
|
|
|
|
if (intValue) {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options |= SMALL_TEXT;
|
2016-09-14 19:51:54 +12:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->output_options &= ~SMALL_TEXT;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case iReverse:
|
|
|
|
if (intValue) {
|
|
|
|
strcpy(my_symbol->fgcolour, "ffffff");
|
|
|
|
strcpy(my_symbol->bgcolour, "000000");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case iWError:
|
|
|
|
if (intValue) {
|
|
|
|
my_symbol->warn_level = WARN_FAIL_ALL;
|
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iFG:
|
2021-01-06 02:13:11 +13:00
|
|
|
strncpy(my_symbol->fgcolour, pStr, lStr);
|
|
|
|
my_symbol->fgcolour[lStr]='\0';
|
2022-05-13 07:35:06 +12:00
|
|
|
printf("my_symbol->fgcolour %s\n", my_symbol->fgcolour);
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
|
|
|
case iBG:
|
2021-01-06 02:13:11 +13:00
|
|
|
strncpy(my_symbol->bgcolour, pStr, lStr);
|
|
|
|
my_symbol->bgcolour[lStr]='\0';
|
2020-08-05 01:49:25 +12:00
|
|
|
break;
|
|
|
|
case iNoBackground:
|
|
|
|
if (intValue) {
|
2021-01-06 02:13:11 +13:00
|
|
|
strcpy(my_symbol->bgcolour, "ffffff00");
|
2020-08-05 01:49:25 +12:00
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
2021-09-25 00:21:24 +12:00
|
|
|
case iNoQuietZones:
|
|
|
|
if (intValue) {
|
|
|
|
my_symbol->output_options |= BARCODE_NO_QUIET_ZONES;
|
|
|
|
} else {
|
|
|
|
my_symbol->output_options &= ~BARCODE_NO_QUIET_ZONES;
|
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iNoText:
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->show_hrt = (intValue?0:1);
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
2021-09-25 00:21:24 +12:00
|
|
|
case iQuietZones:
|
|
|
|
if (intValue) {
|
|
|
|
my_symbol->output_options |= BARCODE_QUIET_ZONES;
|
|
|
|
} else {
|
|
|
|
my_symbol->output_options &= ~BARCODE_QUIET_ZONES;
|
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iSquare:
|
2018-11-03 06:48:04 +13:00
|
|
|
/* DM_SQUARE overwrites DM_DMRE */
|
|
|
|
if (intValue)
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->option_3 = DM_SQUARE;
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
|
|
|
case iDMRE:
|
2018-11-03 06:48:04 +13:00
|
|
|
/* DM_DMRE overwrites DM_SQUARE */
|
|
|
|
if (intValue)
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->option_3 = DM_DMRE;
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
|
|
|
case iScale:
|
2015-08-19 00:23:28 +12:00
|
|
|
if (doubleValue < 0.01) {
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Scale below 0.01", -1));
|
|
|
|
fError = 1;
|
2015-08-19 00:23:28 +12:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->scale = (float)doubleValue;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
|
|
|
case iBorder:
|
2015-08-19 00:23:28 +12:00
|
|
|
if (intValue < 0 || intValue > 1000) {
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Border out of range", -1));
|
|
|
|
fError = 1;
|
2015-08-19 00:23:28 +12:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->border_width = intValue;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2021-09-22 11:04:15 +12:00
|
|
|
break;
|
|
|
|
case iGuardDescent:
|
|
|
|
if ((float)doubleValue < 0.0f || (float)doubleValue > 50.0f) {
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Guard bar descent out of range", -1));
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
|
|
|
my_symbol->guard_descent = (float)doubleValue;
|
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
|
|
|
case iHeight:
|
2021-10-19 02:05:51 +13:00
|
|
|
if ((float)doubleValue < 0.5f || (float)doubleValue > 2000.0f) {
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Height out of range", -1));
|
|
|
|
fError = 1;
|
2015-08-19 00:23:28 +12:00
|
|
|
} else {
|
2021-06-20 00:11:23 +12:00
|
|
|
my_symbol->height = (float)doubleValue;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
2020-05-19 22:02:18 +12:00
|
|
|
case iSeparator:
|
|
|
|
if (intValue < 0 || intValue > 4) {
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Separator out of range", -1));
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
|
|
|
Separator = intValue;
|
|
|
|
}
|
|
|
|
break;
|
2020-11-28 01:54:44 +13:00
|
|
|
case iMask:
|
|
|
|
if (intValue < 0 || intValue > 7) {
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Mask out of range", -1));
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
|
|
|
Mask = intValue + 1;
|
|
|
|
}
|
|
|
|
break;
|
2020-12-20 06:13:35 +13:00
|
|
|
case iSCMvv:
|
|
|
|
if (intValue < 0 || intValue > 99) {
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("SCM version out of range", -1));
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->option_2 = intValue + 1;
|
2020-12-20 06:13:35 +13:00
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iCols:
|
|
|
|
case iVers:
|
|
|
|
/* >> Int in Option 2 */
|
2015-08-19 00:23:28 +12:00
|
|
|
if (intValue < 1
|
2021-05-29 02:05:06 +12:00
|
|
|
|| (optionIndex==iCols && intValue > 200)
|
2022-05-13 07:35:06 +12:00
|
|
|
|| (optionIndex==iVers && intValue > 999))
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("cols/vers out of range", -1));
|
|
|
|
fError = 1;
|
2015-08-19 00:23:28 +12:00
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->option_2 = intValue;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
|
|
|
case iSecure:
|
2016-10-15 03:23:15 +13:00
|
|
|
case iMode:
|
2016-09-14 19:51:54 +12:00
|
|
|
case iRows:
|
2021-10-31 10:00:31 +13:00
|
|
|
/* >> Int in Option 1 for Codablock, Option 3 for PDF417 */
|
2015-08-19 00:23:28 +12:00
|
|
|
if ( (optionIndex==iSecure && (intValue < 1 || intValue > 8))
|
2016-09-14 19:51:54 +12:00
|
|
|
|| (optionIndex==iMode && (intValue < 0 || intValue > 6))
|
2021-10-31 10:00:31 +13:00
|
|
|
|| (optionIndex==iRows && (intValue < 0 || intValue > 90)))
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("secure/mode/rows out of range", -1));
|
|
|
|
fError = 1;
|
2015-08-19 00:23:28 +12:00
|
|
|
} else {
|
2021-10-31 10:00:31 +13:00
|
|
|
rows = intValue;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
|
|
|
case iPrimary:
|
2021-01-06 02:13:11 +13:00
|
|
|
strcpy(my_symbol->primary, Tcl_DStringValue( &dString ) );
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_DStringFree(&dString);
|
|
|
|
break;
|
|
|
|
case iRotate:
|
2015-08-19 00:23:28 +12:00
|
|
|
/* >> Rotate angle */
|
|
|
|
/*----------------------------------------------------------------*/
|
|
|
|
{
|
2018-11-02 21:36:51 +13:00
|
|
|
char *rotateList[] = {"0", "90", "180", "270", NULL};
|
2015-08-19 00:23:28 +12:00
|
|
|
enum iRotate { iRotate0, iRotate90, iRotate180, iRotate270 };
|
|
|
|
/*------------------------------------------------------------*/
|
|
|
|
if(Tcl_GetIndexFromObj(interp, objv[optionPos+1],
|
|
|
|
(const char **) rotateList,
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
"-rotate", 0, &intValue)
|
2015-08-19 00:23:28 +12:00
|
|
|
== TCL_ERROR)
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (intValue) {
|
|
|
|
case iRotate90: rotate_angle = 90; break;
|
|
|
|
case iRotate180: rotate_angle = 180; break;
|
|
|
|
case iRotate270: rotate_angle = 270; break;
|
|
|
|
default: rotate_angle = 0; break;
|
|
|
|
}
|
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
|
|
|
case iBarcode:
|
2015-08-19 00:23:28 +12:00
|
|
|
if(Tcl_GetIndexFromObj(interp, objv[optionPos+1],
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
(const char **) s_code_list, "-barcode", 0, &intValue)
|
2015-08-19 00:23:28 +12:00
|
|
|
== TCL_ERROR)
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->symbology = s_code_number[intValue];
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
2021-05-26 07:42:26 +12:00
|
|
|
case iVWhiteSp:
|
|
|
|
my_symbol->whitespace_height = intValue;
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iWhiteSp:
|
2021-01-06 02:13:11 +13:00
|
|
|
my_symbol->whitespace_width = intValue;
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
DOTCODE: use pre-calculated generator poly coeffs in Reed-Solomon for
performance improvement
PDF417/MICROPDF417: use common routine pdf417_initial()
GUI: code lines <= 118, shorthand widget_obj(),
shorten calling upcean_addon_gap(), upcean_guard_descent()
various backend: var name debug -> debug_print
2021-09-29 09:42:44 +13:00
|
|
|
case iStructApp:
|
|
|
|
/* >> Decode the -structapp parameter as list of index count ?ID? */
|
|
|
|
{
|
|
|
|
Tcl_Obj *poParam;
|
|
|
|
struct zint_structapp structapp = { 0, 0, "" };
|
|
|
|
char *pStructAppId = NULL;
|
|
|
|
int lStructAppId = 0;
|
|
|
|
if (TCL_OK != Tcl_ListObjLength(interp,
|
|
|
|
objv[optionPos+1], &lStr))
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
} else if ( ! ( lStr == 2 || lStr == 3 ) ) {
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj(
|
|
|
|
"option -structapp not a list of 2 or 3", -1));
|
|
|
|
fError = 1;
|
|
|
|
} else {
|
|
|
|
if (TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
|
|
|
|
0, &poParam)
|
|
|
|
|| TCL_OK != Tcl_GetIntFromObj(interp, poParam, &structapp.index)
|
|
|
|
|| TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
|
|
|
|
1, &poParam)
|
|
|
|
|| TCL_OK != Tcl_GetIntFromObj(interp, poParam, &structapp.count))
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
}
|
|
|
|
if (!fError && lStr == 3 && (
|
|
|
|
TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
|
|
|
|
2, &poParam)
|
|
|
|
|| !(pStructAppId = Tcl_GetStringFromObj(poParam, &lStructAppId))
|
|
|
|
|| lStructAppId > 32
|
|
|
|
))
|
|
|
|
{
|
|
|
|
if (lStructAppId > 32) {
|
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Structured Append ID too long", -1));
|
|
|
|
}
|
|
|
|
fError = 1;
|
|
|
|
}
|
|
|
|
if (!fError) {
|
|
|
|
my_symbol->structapp = structapp;
|
|
|
|
if (lStr == 3 && pStructAppId && lStructAppId) {
|
|
|
|
strncpy(my_symbol->structapp.id, pStructAppId, lStructAppId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2016-09-14 19:51:54 +12:00
|
|
|
case iTo:
|
2015-08-19 00:23:28 +12:00
|
|
|
/* >> Decode the -to parameter as list of X0 Y0 ?Width Height? */
|
|
|
|
{
|
|
|
|
Tcl_Obj *poParam;
|
|
|
|
if (TCL_OK != Tcl_ListObjLength(interp,
|
2016-09-14 19:51:54 +12:00
|
|
|
objv[optionPos+1], &lStr))
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
} else if ( ! ( lStr == 2 || lStr == 4 ) ) {
|
|
|
|
Tcl_SetObjResult(interp,
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_NewStringObj(
|
|
|
|
"option -to not a list of 2 or 4", -1));
|
2015-08-19 00:23:28 +12:00
|
|
|
fError = 1;
|
Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
DOTCODE: use pre-calculated generator poly coeffs in Reed-Solomon for
performance improvement
PDF417/MICROPDF417: use common routine pdf417_initial()
GUI: code lines <= 118, shorthand widget_obj(),
shorten calling upcean_addon_gap(), upcean_guard_descent()
various backend: var name debug -> debug_print
2021-09-29 09:42:44 +13:00
|
|
|
} else {
|
|
|
|
if (TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
|
|
|
|
0, &poParam)
|
|
|
|
|| TCL_OK != Tcl_GetIntFromObj(interp,poParam,&destX0)
|
|
|
|
|| TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
|
|
|
|
1, &poParam)
|
|
|
|
|| TCL_OK != Tcl_GetIntFromObj(interp,poParam,&destY0))
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
}
|
|
|
|
if (!fError && lStr == 4 && (
|
|
|
|
TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
|
|
|
|
2, &poParam)
|
|
|
|
|| TCL_OK != Tcl_GetIntFromObj(interp,poParam,
|
|
|
|
&destWidth)
|
|
|
|
|| TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
|
|
|
|
3, &poParam)
|
|
|
|
|| TCL_OK != Tcl_GetIntFromObj(interp,poParam,
|
|
|
|
&destHeight)
|
|
|
|
))
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
}
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
break;
|
2015-08-19 00:23:28 +12:00
|
|
|
case iFormat:
|
|
|
|
/* >> Format of the input data */
|
|
|
|
/*----------------------------------------------------------------*/
|
|
|
|
{
|
|
|
|
char *formatList[] = {"binary", "gs1", "unicode",NULL};
|
|
|
|
enum iFormat { iBinary, iGS1, iUnicode };
|
|
|
|
/*------------------------------------------------------------*/
|
|
|
|
if(Tcl_GetIndexFromObj(interp, objv[optionPos+1],
|
|
|
|
(const char **) formatList,
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
"-format", 0, &intValue)
|
2015-08-19 00:23:28 +12:00
|
|
|
== TCL_ERROR)
|
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (intValue) {
|
2021-07-14 04:39:03 +12:00
|
|
|
case iBinary: my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | DATA_MODE; break;
|
|
|
|
case iGS1: my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | GS1_MODE; break;
|
|
|
|
default: my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | UNICODE_MODE; break;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
}
|
2020-05-19 22:02:18 +12:00
|
|
|
/*------------------------------------------------------------------------*/
|
2021-01-06 02:13:11 +13:00
|
|
|
/* >>> Get symbology capability mask */
|
|
|
|
cap = ZBarcode_Cap(my_symbol->symbology,
|
|
|
|
ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | ZINT_CAP_FULL_MULTIBYTE
|
|
|
|
| ZINT_CAP_MASK);
|
|
|
|
/*------------------------------------------------------------------------*/
|
2020-11-28 01:54:44 +13:00
|
|
|
/* >>> option_3 is set by three values depending on the symbology */
|
2020-05-19 22:02:18 +12:00
|
|
|
/* On wrong symbology, the option is ignored(as does the zint program)*/
|
2021-07-14 04:39:03 +12:00
|
|
|
if (fFullMultiByte && (cap & ZINT_CAP_FULL_MULTIBYTE)) {
|
|
|
|
my_symbol->option_3 = ZINT_FULL_MULTIBYTE;
|
|
|
|
}
|
|
|
|
if (Mask && (cap & ZINT_CAP_MASK)) {
|
|
|
|
my_symbol->option_3 |= Mask << 8;
|
|
|
|
}
|
2021-01-06 02:13:11 +13:00
|
|
|
if (Separator && (cap & ZINT_CAP_STACKABLE)) {
|
2021-07-14 04:39:03 +12:00
|
|
|
my_symbol->option_3 = Separator;
|
|
|
|
}
|
2015-08-19 00:23:28 +12:00
|
|
|
/*------------------------------------------------------------------------*/
|
2020-07-28 04:44:51 +12:00
|
|
|
/* >>> option_2 is set by two values depending on the symbology */
|
|
|
|
/* On wrong symbology, the option is ignored(as does the zint program)*/
|
2021-01-06 02:13:11 +13:00
|
|
|
if (addon_gap && (cap & ZINT_CAP_EXTENDABLE)) {
|
|
|
|
my_symbol->option_2 = addon_gap;
|
2020-07-28 04:44:51 +12:00
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
2021-10-31 10:00:31 +13:00
|
|
|
if (rows) {
|
2021-11-21 00:32:30 +13:00
|
|
|
/* PDF417 and DBAR_EXPSTK use option 3 for rows */
|
2021-10-31 10:00:31 +13:00
|
|
|
if (my_symbol->symbology == BARCODE_PDF417
|
|
|
|
|| my_symbol->symbology == BARCODE_PDF417COMP
|
2021-11-21 00:32:30 +13:00
|
|
|
|| my_symbol->symbology == BARCODE_HIBC_PDF
|
|
|
|
|| my_symbol->symbology == BARCODE_DBAR_EXPSTK
|
|
|
|
|| my_symbol->symbology == BARCODE_DBAR_EXPSTK_CC) {
|
2021-10-31 10:00:31 +13:00
|
|
|
my_symbol->option_3 = rows;
|
|
|
|
} else if (my_symbol->symbology == BARCODE_CODABLOCKF
|
2021-11-21 00:32:30 +13:00
|
|
|
|| my_symbol->symbology == BARCODE_HIBC_BLOCKF
|
|
|
|
|| my_symbol->symbology == BARCODE_CODE16K
|
|
|
|
|| my_symbol->symbology == BARCODE_CODE49) {
|
2021-10-31 10:00:31 +13:00
|
|
|
my_symbol->option_1 = rows;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
2018-11-03 06:48:04 +13:00
|
|
|
/* >>> Prepare input dstring and encode it to ECI encoding*/
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_DStringInit(& dsInput);
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
if (!fError) {
|
|
|
|
/*--------------------------------------------------------------------*/
|
2018-11-03 06:48:04 +13:00
|
|
|
/* >>> Get input mode */
|
2021-07-14 04:39:03 +12:00
|
|
|
if ((my_symbol->input_mode & 0x07) == DATA_MODE) {
|
2015-08-19 00:23:28 +12:00
|
|
|
/* Binary data */
|
2016-07-04 23:46:30 +12:00
|
|
|
pStr = (char *) Tcl_GetByteArrayFromObj(objv[2], &lStr);
|
2015-08-19 00:23:28 +12:00
|
|
|
} else {
|
2021-01-13 03:11:53 +13:00
|
|
|
/* UTF8 Data */
|
2021-07-14 04:39:03 +12:00
|
|
|
pStr = Tcl_GetStringFromObj(objv[2], &lStr);
|
|
|
|
Tcl_UtfToExternalDString( hZINTEncoding, pStr, lStr, &dsInput);
|
|
|
|
pStr = Tcl_DStringValue( &dsInput );
|
|
|
|
lStr = Tcl_DStringLength( &dsInput );
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
if (seg_count) {
|
|
|
|
segs[0].source = (unsigned char *) pStr;
|
|
|
|
segs[0].length = lStr;
|
|
|
|
segs[0].eci = my_symbol->eci;
|
|
|
|
for (seg_no = 1; seg_no < seg_count; seg_no++) {
|
|
|
|
if (!pSegDataObjs[seg_no]) {
|
|
|
|
Tcl_SetObjResult(interp, Tcl_NewStringObj("Segments must be consecutive", -1));
|
|
|
|
fError = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!fError) {
|
|
|
|
for (seg_no = 1; seg_no < seg_count; seg_no++) {
|
|
|
|
if ((my_symbol->input_mode & 0x07) == DATA_MODE) {
|
|
|
|
segs[seg_no].source = (unsigned char *) Tcl_GetByteArrayFromObj(pSegDataObjs[seg_no],
|
|
|
|
&segs[seg_no].length);
|
|
|
|
} else {
|
|
|
|
pStr = Tcl_GetStringFromObj(pSegDataObjs[seg_no], &lStr);
|
|
|
|
Tcl_DStringInit(& segInputs[seg_no]);
|
|
|
|
Tcl_UtfToExternalDString( hZINTEncoding, pStr, lStr, &segInputs[seg_no]);
|
|
|
|
segs[seg_no].source = (unsigned char *) Tcl_DStringValue( &segInputs[seg_no] );
|
|
|
|
segs[seg_no].length = Tcl_DStringLength( &segInputs[seg_no] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-11-03 06:48:04 +13:00
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/* >>> Build symbol graphic */
|
|
|
|
if (! fError ) {
|
2020-08-05 01:49:25 +12:00
|
|
|
int ErrorNumber;
|
|
|
|
Tk_PhotoHandle hPhoto;
|
|
|
|
/*--------------------------------------------------------------------*/
|
|
|
|
/* call zint graphic creation to buffer */
|
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
|
|
|
if (seg_count) {
|
|
|
|
ErrorNumber = ZBarcode_Encode_Segs_and_Buffer(my_symbol,
|
|
|
|
segs, seg_count, rotate_angle);
|
|
|
|
} else {
|
|
|
|
ErrorNumber = ZBarcode_Encode_and_Buffer(my_symbol,
|
|
|
|
(unsigned char *) pStr, lStr, rotate_angle);
|
|
|
|
}
|
2015-08-19 00:23:28 +12:00
|
|
|
/*--------------------------------------------------------------------*/
|
2018-11-03 06:48:04 +13:00
|
|
|
/* >> Show a message */
|
|
|
|
if( 0 != ErrorNumber )
|
|
|
|
{
|
2021-01-06 02:13:11 +13:00
|
|
|
Tcl_SetObjResult(interp, Tcl_NewStringObj(my_symbol->errtxt, -1));
|
2018-11-03 06:48:04 +13:00
|
|
|
}
|
2020-10-01 00:19:12 +13:00
|
|
|
if( ZINT_ERROR <= ErrorNumber )
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
|
|
|
/* >> Encode error */
|
|
|
|
fError = 1;
|
2016-09-14 19:51:54 +12:00
|
|
|
} else if (
|
|
|
|
NULL == (hPhoto = Tk_FindPhoto(interp, Tcl_GetString(objv[3]))))
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_SetObjResult(interp,
|
|
|
|
Tcl_NewStringObj("Unknown photo image", -1));
|
2015-08-19 00:23:28 +12:00
|
|
|
fError = 1;
|
2016-10-15 03:23:15 +13:00
|
|
|
} else {
|
|
|
|
Tk_PhotoImageBlock sImageBlock;
|
2020-08-05 01:49:25 +12:00
|
|
|
char * pImageRGBA = NULL;
|
2021-01-06 02:13:11 +13:00
|
|
|
if (my_symbol->alphamap == NULL) {
|
|
|
|
sImageBlock.pixelPtr = (unsigned char *) my_symbol->bitmap;
|
|
|
|
sImageBlock.width = my_symbol->bitmap_width;
|
|
|
|
sImageBlock.height = my_symbol->bitmap_height;
|
|
|
|
sImageBlock.pitch = 3*my_symbol->bitmap_width;
|
2020-08-05 01:49:25 +12:00
|
|
|
sImageBlock.pixelSize = 3;
|
|
|
|
sImageBlock.offset[0] = 0;
|
|
|
|
sImageBlock.offset[1] = 1;
|
|
|
|
sImageBlock.offset[2] = 2;
|
|
|
|
sImageBlock.offset[3] = 0;
|
|
|
|
} else {
|
|
|
|
int index;
|
|
|
|
/* Alpha channel present - prepare the image data in rgba order */
|
2021-01-06 02:13:11 +13:00
|
|
|
pImageRGBA = ckalloc(my_symbol->bitmap_width*my_symbol->bitmap_height*4);
|
|
|
|
for (index = 0; index < my_symbol->bitmap_width*my_symbol->bitmap_height; index++) {
|
|
|
|
pImageRGBA[index*4] = my_symbol->bitmap[index*3];
|
|
|
|
pImageRGBA[index*4+1] = my_symbol->bitmap[index*3+1];
|
|
|
|
pImageRGBA[index*4+2] = my_symbol->bitmap[index*3+2];
|
|
|
|
pImageRGBA[index*4+3] = my_symbol->alphamap[index];
|
2020-08-05 01:49:25 +12:00
|
|
|
}
|
|
|
|
sImageBlock.pixelPtr = (unsigned char *) pImageRGBA;
|
2021-01-06 02:13:11 +13:00
|
|
|
sImageBlock.width = my_symbol->bitmap_width;
|
|
|
|
sImageBlock.height = my_symbol->bitmap_height;
|
|
|
|
sImageBlock.pitch = 4*my_symbol->bitmap_width;
|
2020-08-05 01:49:25 +12:00
|
|
|
sImageBlock.pixelSize = 4;
|
|
|
|
sImageBlock.offset[0] = 0;
|
|
|
|
sImageBlock.offset[1] = 1;
|
|
|
|
sImageBlock.offset[2] = 2;
|
|
|
|
sImageBlock.offset[3] = 3;
|
|
|
|
}
|
2015-08-19 00:23:28 +12:00
|
|
|
if (0 == destWidth) {
|
2021-01-06 02:13:11 +13:00
|
|
|
destWidth = my_symbol->bitmap_width;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
|
|
|
if (0 == destHeight) {
|
2021-01-06 02:13:11 +13:00
|
|
|
destHeight = my_symbol->bitmap_height;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
|
|
|
if (TCL_OK != Tk_PhotoPutBlock(interp, hPhoto, &sImageBlock,
|
2016-09-14 19:51:54 +12:00
|
|
|
destX0, destY0, destWidth, destHeight,
|
|
|
|
TK_PHOTO_COMPOSITE_OVERLAY))
|
2015-08-19 00:23:28 +12:00
|
|
|
{
|
|
|
|
fError = 1;
|
|
|
|
}
|
2020-08-05 01:49:25 +12:00
|
|
|
if (pImageRGBA != NULL) {
|
|
|
|
ckfree(pImageRGBA);
|
|
|
|
}
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2016-09-14 19:51:54 +12:00
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
2018-11-03 06:48:04 +13:00
|
|
|
Tcl_FreeEncoding(hZINTEncoding);
|
2016-09-14 19:51:54 +12:00
|
|
|
Tcl_DStringFree(& dsInput);
|
2021-01-06 02:13:11 +13:00
|
|
|
ZBarcode_Delete(my_symbol);
|
2016-09-14 19:51:54 +12:00
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
if (fError) {
|
|
|
|
return TCL_ERROR;
|
|
|
|
}
|
|
|
|
return TCL_OK;
|
2015-08-19 00:23:28 +12:00
|
|
|
}
|
2022-04-10 22:12:18 +12:00
|
|
|
|
|
|
|
/* vim: set ts=4 sw=4 et : */
|