diff --git a/backend_tcl/readme.txt b/backend_tcl/readme.txt index c60495ad..a9bfb028 100644 --- a/backend_tcl/readme.txt +++ b/backend_tcl/readme.txt @@ -11,13 +11,20 @@ Build: The header files of a Tcl and Tk build are required for the build. They are included in a Tcl/Tk source tree or in an installed Tcl/Tk. -There are 3 build environments available: +There are the standard TCL build environments available: - configure based build system for Linux/macOS and MSYS/Cygwin/MSYS2 (Windows) (contributed by Christian Werner) - see "docs/manual.txt" Annex C for details - "win\makefile.vc" for Microsoft Visual Studio command prompt (nmake) - see "win\README.txt" for details -- "zint_tcl.vcxproj" for Microsoft Visual C++ 2022 interactive build + +The GS1 syntax engine may be added optionally. +https://github.com/gs1/gs1-syntax-engine +Please look to the top of makefile.vc to activate it. + +The GS1 syntax engine project currently only allows to build a dll and an import lib. +This hopefully changes in future. +Remark, that the syntax engine dll may not be included in a starkit or zipkit. Usage: diff --git a/backend_tcl/win/makefile.vc b/backend_tcl/win/makefile.vc index 9c9e7aaa..881d1c55 100644 --- a/backend_tcl/win/makefile.vc +++ b/backend_tcl/win/makefile.vc @@ -18,6 +18,17 @@ # #------------------------------------------------------------------------------ +# Activate GS1 syntax engine support (option "-gs1strict") +# https://github.com/gs1/gs1-syntax-engine +# Build the library gs1encoders.dll +ZINT_HAVE_GS1SE = 0 + +# folder of the include file gs1encoders.h (in src/c-lib folder of the syntax engine) +SYNTAX_ENGINE_INCLUDE = $(ROOT)\..\..\gs1-syntax-engine-main\src\c-lib + +# folder of the library gs1encoders.lib of the syntax engine +SYNTAX_ENGINE_LIB = $(ROOT)\..\..\gs1-syntax-engine-main\src\c-lib\build\library\x64\Release + # The name of the package PROJECT = zint PROJECT_REQUIRES_TK = 1 @@ -94,11 +105,14 @@ PRJ_OBJS = \ PRJ_DEFINES = -D_CRT_SECURE_NO_DEPRECATE PRJ_DEFINES = $(PRJ_DEFINES) -DZINT_NO_PNG=1 # PRJ_DEFINES = $(PRJ_DEFINES) -DZINT_VERSION=PACKAGE_VERSION -PRJ_DEFINES = $(PRJ_DEFINES) -I$(TMP_DIR) -PRJ_DEFINES = $(PRJ_DEFINES) -I$(BACKEND_DIR) - - +PRJ_INCLUDES = -I$(TMP_DIR) +PRJ_INCLUDES = $(PRJ_INCLUDES) -I$(BACKEND_DIR) +!if $(ZINT_HAVE_GS1SE) +PRJ_DEFINES = $(PRJ_DEFINES) -DZINT_HAVE_GS1SE=1 +PRJ_INCLUDES = $(PRJ_INCLUDES) -I$(SYNTAX_ENGINE_INCLUDE) +PRJ_LIBS = $(SYNTAX_ENGINE_LIB)\gs1encoders.lib +!endif # Define the standard targets !include "$(_RULESDIR)\targets.vc" diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index 26cd1292..7183200a 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -577,7 +577,9 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n" " -gs1nocheck bool: for gs1, do not check validity of data (allows non-standard symbols)\n" " -gs1parens bool: for gs1, AIs enclosed in parentheses instead of square brackets\n" #ifdef ZINT_HAVE_GS1SE - " -gs1strict bool: Use GS1 Syntax Engine to strictly validate GS1 data\n" + " -gs1strict bool: use GS1 Syntax Engine to strictly validate GS1 data\n" +#else + " -gs1strict 0: GS1 syntax engine not compiled in, may not be activated.\n" #endif " -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n" " -guarddescent double: Height of guard bar descent in modules (EAN/UPC only)\n" @@ -904,9 +906,7 @@ static int Encode(Tcl_Interp *interp, int objc, "-cols", "-compliantheight", "-dmiso144", "-dmre", "-dotsize", "-dotty", "-eci", "-esc", "-extraesc", "-fast", "-fg", "-format", "-fullmultibyte", "-gs1nocheck", "-gs1parens", -#ifdef ZINT_HAVE_GS1SE "-gs1strict", -#endif "-gssep", "-guarddescent", "-guardwhitespace", "-height", "-heightperrow", "-init", "-mask", "-mode", "-nobackground", "-noquietzones", "-notext", "-primary", "-quietzones", @@ -920,9 +920,7 @@ static int Encode(Tcl_Interp *interp, int objc, iCols, iCompliantHeight, iDMISO144, iDMRE, iDotSize, iDotty, iECI, iEsc, iExtraEsc, iFast, iFG, iFormat, iFullMultiByte, iGS1NoCheck, iGS1Parens, -#ifdef ZINT_HAVE_GS1SE iGS1Strict, -#endif iGSSep, iGuardDescent, iGuardWhitespace, iHeight, iHeightPerRow, iInit, iMask, iMode, iNoBackground, iNoQuietZones, iNoText, iPrimary, iQuietZones, @@ -959,9 +957,7 @@ static int Encode(Tcl_Interp *interp, int objc, case iFast: case iGS1NoCheck: case iGS1Parens: -#ifdef ZINT_HAVE_GS1SE case iGS1Strict: -#endif case iGSSep: case iGuardWhitespace: case iHeightPerRow: @@ -1170,16 +1166,20 @@ static int Encode(Tcl_Interp *interp, int objc, my_symbol->input_mode &= ~GS1PARENS_MODE; } break; -#ifdef ZINT_HAVE_GS1SE case iGS1Strict: if (intValue) { +#ifdef ZINT_HAVE_GS1SE my_symbol->input_mode |= GS1SYNTAXENGINE_MODE; my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | GS1_MODE; /* Now sets GS1_MODE also */ +#else + Tcl_SetObjResult(interp, + Tcl_NewStringObj("GS1 syntax engine not compiled in", -1)); + fError = 1; +#endif } else { my_symbol->input_mode &= ~GS1SYNTAXENGINE_MODE; } break; -#endif case iGSSep: if (intValue) { my_symbol->output_options |= GS1_GS_SEPARATOR;