APIENC.H文件 //
/*********************************************************************
* Module Header
*
* Identification: APIENC.H - Library Record Definitions
* Copyright (c) 1993-1997 Symbol Technologies, Inc.
*
* Edit History:
* $Log: APIENC.H $
* Revision 1.3 1997/12/19 22:23:38 Anne
* Added field for disable Macro Character Substitution in app params
* data structure.
* Revision 1.2 1997/11/26 01:09:16 Anne
* Moved defines for style bare and style naked from micropdf.h into this
* file. Added field for code128 emulation mode to AppParams data structure
* and changed return value for EncodeTC, EncodeNum and EncodeBin
* from Bool to unsigned int in order to return the number of bytes encoded.
* Revision 1.1 1997/02/18 15:26:10 toml
* Initial revision
*
* Description: Header file which contains structures and definitions
* which are internal to the API.
*
* NOTE: This header requires PDFAPI.H.
*
**********************************************************************/
#ifndef __APIENC_H_
#define __APIENC_H_
/*
Output driver (formatting routines) operations
*/
#define DRIVER_ISTYPE 1 /* return installed driver id */
#define DRIVER_QUERYLEN 2 /* get length of barcode image output */
#define DRIVER_BUILDIMAGE 3 /* generate barcode image */
#define DRIVER_QUERYDPI 4 /* current DPI setting for output */
#define DRIVER_QUERYSCALE 5 /* current scale factor for output */
#define DRIVER_VERIFYWPARAM 6 /* assert value of wParam with driver */
#define DRIVER_VERIFYLPARAM 7 /* assert value of lParam with driver */
#define DRIVERTYPE_NULL 0
#define DRIVERTYPE_CODEWORDS 1 /* codeword output - each line is a PDF row */
#define DRIVERTYPE_PATTERNS 2 /* bar/space patterns - each line is a PDF row */
#define DRIVERTYPE_TIFF 3 /* Tagged Image File Format */
#define DRIVERTYPE_PCX 4 /* ZSoft Paintbrush format */
#define DRIVERTYPE_EPS 5 /* Encapsultaed PostScript format */
#define DRIVERTYPE_DIBMEM 6 /* Windows DIB - memory image format */
#define DRIVERTYPE_DIBFILE 7 /* Windows DIB - file format */
#define DRIVERTYPE_WMF 8 /* Windows MetaFile format */
#define DRIVERTYPE_PCL 9 /* HP Printer Command Language (HP Laser printer) */
#define DRIVERTYPE_PS10xx 10 /* Symbol PS10xx family of printers */
#define DRIVERTYPE_ZPL 11 /* Zebra graphic format */
#define DRIVERTYPE_ZSF 12 /* Zebra Soft-Font format */
#define DRIVERTYPE_EPSON9 13 /* Epson 9-pin format */
#define DRIVERTYPE_EPSON24 14 /* Epson 24-pin format */
#define DRIVERTYPE_MAXTYPES 15
#ifndef NULL
#define NULL (void *)0
#endif
#define DriverQueryIOType( lpApp ) \
(*(lpApp)->lpfnFilter)( DRIVER_ISTYPE, NULL, NULL, \
(lpApp)->lparam, (lpApp)->wparam )
#define DriverQueryLen( lpApp, lpnLen ) \
(*(lpApp)->lpfnFilter)( DRIVER_QUERYLEN, \
(LPPDFObject)(LPVOID)lpnLen, \
(LPEncodeInfoRec)((lpApp)->if_buf), \
(lpApp)->lparam, (lpApp)->wparam )
#define DriverBuildImage( lpApp, lpObj ) \
(*(lpApp)->lpfnFilter)( DRIVER_BUILDIMAGE, lpObj, \
(LPEncodeInfoRec)((lpApp)->if_buf), \
(lpApp)->lparam, (lpApp)->wparam )
#define DriverQueryDPI( lpApp ) \
(uint16)((*(lpApp)->lpfnFilter)( DRIVER_QUERYDPI, NULL, NULL, \
(lpApp)->lparam, (lpApp)->wparam ))
#define DriverQueryScale( lpApp ) \
(uint16)((*(lpApp)->lpfnFilter)( DRIVER_QUERYSCALE, NULL, NULL,\
(lpApp)->lparam, (lpApp)->wparam ))
#define DriverVerifyWParam( lpfnDriver, wParam ) \
((*lpfnDriver)( DRIVER_VERIFYWPARAM, NULL, NULL, 0L, wParam ))
#define DriverVerifyLParam( lpfnDriver, lParam ) \
((*lpfnDriver)( DRIVER_VERIFYLPARAM, NULL, NULL, lParam, 0 ))
#ifndef CWREC
#define CWREC
typedef struct s_cwrec {
uint16 n; /* number of codewords in data array */
uint16 max_data; /* maximum limit for 'n' -- leaves room in data[] */
uint16 max_len; /* maximum number that array can hold */
CW data[1]; /* variable length data array */
} CWRec;
typedef CWRec FAR *LPCWRec;
#endif
/*
PDFEncode Intermediate Format output structure
*/
typedef struct s_matrix {
uint16 rows; /* data codeword rows */
uint16 cols; /* data codewords columns (excluding row indicators) */
} MatrixDim;
typedef MatrixDim FAR *LPMatrixDim;
typedef struct s_encodeinforec {
uint16 nrows; /* rows of codewords in data[] */
uint16 ncols; /* columns of codewords in data[] -- includes */
/* row indicators in column count */
uint16 ecc_level; /* ECC level assigned to barcode */
uint16 symtype; /* normal/truncated/naked symbol type */
uint16 nMicroSize; /* for MicroPDF -- micro size code */
uint16 mpdf_cws; /* number of Macro PDF record codewords */
uint16 pad_cws; /* number of pad (900) codewords */
uint16 data_cws; /* data codewords (including length codeword) */
uint16 mod_height, /* module aspect ratio */
mod_width;
MatrixDim dmatrix; /* barcode data matrix dimensions */
/*
maximum data elements for PDF is 90 x 10:
90 LeftRowIdicator + 90 RightRowIndicator + 900 Data --> 1080
*/
CW data[ 1080 ]; /* maximum PDF w/o start/stop bars */
} EncodeInfoRec;
typedef EncodeInfoRec FAR *LPEncodeInfoRec;
/*
PDFAPI Application control block
*/
typedef struct s_appparamsrec {
uint16 rows, cols; /* user imposed maximums for row and/or cols */
uint16 dimtype; /* row,col values are fixed or limits? */
uint16 pdf_aspect; /* asect ratio for barcode - in hundreths */
uint16 module_height, /* aspect ratio for PDF element */
module_width;
Bool fEccFixed; /* TRUE: use fixed level, FALSE: use percentage */
Bool fPadWithECC; /* Pad symbol using ECC not 900's */
uint16 nEccLevel; /* fixed ECC level */
uint16 nEccPercent; /* ECC as a percentage of barcode content */
uint16 symtype; /* normal/truncated/naked symbol type */
int16 c128Emulation; /* Code-128 emulation mode - C1 linked or unlinked, C0, C2 */
Bool fNoMacroCharSub; /* Disable Macro Character Substitution Feature of MicroPDF */
Bool fBinaryOnly; /* encode in binary mode only */
Bool fEncodeActive; /* active encoding input stream (MPDF) */
LPFNPDFFILTER lpfnFilter;/* barcode output filter */
uint32 lparam; /* pointer parameter for filter */
uint16 wparam; /* word parameter for filter */
uint16 nMicroSize; /* for MicroPDF -- micro size code */
uint16 nMicroECC; /* Fixed ECC based upon micro size */
LPCWRec lpCw; /* active barcode data record */
struct s_mpdfrec FAR *lpMpdf; /* macro PDF info and module access */
/*
Allocate room for a PDF codeword record which will contain the data
for the active barcode. This will be overlaid by the PdfCw structure
*/
uchar cw_buf[ sizeof(CWRec) + (928 * sizeof(CW)) ];
uchar if_buf[ sizeof(EncodeInfoRec) ];
} AppParamsRec;
typedef AppParamsRec FAR *LPAppParamsRec;
typedef const AppParamsRec FAR *LPCAppParamsRec;
/*
* Encoder Library Global Declaration
*/
extern const char g_acDigitsStr[ 17 ];
/*
* TC Encoding sub-mode values -- passed between EncodeTC() routine
*/
typedef uint8 TCSUBMODE;
#define TC_ALPHA 0
#define TC_LOWER 1
#define TC_MIXED 2
#define TC_PUNCT 3
uint16 EncodeTC( LPPDFObject lpObj, uint16 numbytes, LPCWRec lpCw, TCSUBMODE FAR *tcsubmode );
uint16 EncodeNUM( LPPDFObject lpObj, uint16 numbytes, LPCWRec lpCw );
uint16 EncodeBIN( LPPDFObject lpObj, uint16 numbytes, LPCWRec lpCw, Bool encodeGS );
PDFSTATUS bcstats( LPCWRec lpCW, LPEncodeInfoRec lpEnc, LPCAppParamsRec lpAppParam );
PDFSTATUS bcbuild( LPCWRec lpCw, LPEncodeInfoRec lpEnc, LPCAppParamsRec lpAppParam );
PDFSTATUS encode_data( LPPDFObject lpObj, LPCAppParamsRec lpAppParam, LPCWRec lpCw );
PDFSTATUS setup_cwrec( LPCAppParamsRec lpAppParam, LPCWRec lpCw );
uint16 CalcPDFBitwidth( uint16 fSymbolType, uint16 cols );
#define STYLE_NAKED 2 /* Carry-overs from older versions */
#define STYLE_BARE 3
#endif
MACHINE.H文件 ///
/**************************************** B-N(伀) *********************************/
/**************************************** B-N(仾) *********************************/
/*********************************************************************
* Module Header
*
* Identification: machine.h - Size Specific Type Definitions
* Copyright (c) 1993-1997 Symbol Technologies, Inc.
*
* Edit History:
* $Log: MACHINE.H $
* Revision 1.4 1997/11/26 22:37:00 Anne
* Added defines for no MicroPDF and no Code 128 Emulation
* Revision 1.3 1997/04/07 13:16:06 toml
* Fixed error in PDFCALLBACK define for Windows, was not using
* _export directive to setup DS correctly
* Changed Bool def to int to be compatible for 16/32 bit env's
* Revision 1.2 1997/04/01 07:30:00 toml
* Update timestamps to reflect encoder version 2.30
* Revision 1.1 1997/01/22 21:37:12 toml
* Initial revision
*
* Description: Defines basic data types based on target machine.
*
**********************************************************************/
#ifndef __MACHINE_H__
#define __MACHINE_H__
#ifndef _MSDOS
#define _MSDOS
#endif
#define PDF_NOFILEIO /* Excluded file input/output methods */
#define PDF_NOBARPATTERN /* Excluded Bar Pattern Output */
#define PDF_NOMACROPDF /* Exclude macro PDF files */
#define NO_C128EMULATION /* Exclude the Code128 Emulation feature of MicroPDF */
/*
* Source Code Library Only
*
* To restrict the modules are included in the library build, place one
* or more of the following preprocessor directives in this file
*
*#define NO_MICROPDF Exclude MicroPDF Symbology
*/
#ifdef NO_MICROPDF /* code 128 emulation must be excluded if MicroPDF is excluded */
#define NO_C128EMULATION
#endif
/*
* Define system and library type codes
*/
#define PDF_E_WIN16 1
#define PDF_E_WIN32 2
#define PDF_E_DOS 4
#define PDF_E_FLAT 8
#define PDF_E_UNDEF 0
#define PDF_L_DYNAMIC 1
#define PDF_L_STATIC 2
#define PDF_L_UNDEF 0
#define PDF_E_WINMASK 3
/* 98.04.14 #if defined(_WIN32) || defined(__WIN32) */
/* 98.04.14 #define WIN32_EXTRA_LEAN */
/* 98.04.14 #define WIN32_LEAN_AND_MEAN */
/* 98.04.14 #include "windows.h" */
/* 98.04.14 */
/* 98.04.14 * We consider any build for a 32 bit system similar to a static libary */
/* 98.04.14 * build. This differs from a 16 bit DLL enviroment since we had to concern */
/* 98.04.14 * ourselves with a single, shared data segment among all processes attached */
/* 98.04.14 * to the DLL */
/* 98.04.14 */
/* 98.04.14 # define ENVTYPE PDF_E_WIN32 */
/* 98.04.14 # define LIBTYPE PDF_L_STATIC */
/* 98.04.14 */
/* 98.04.14 # ifndef PDFAPI */
/* 98.04.14 # define PDFAPI __stdcall */
/* 98.04.14 # endif */
/* 98.04.14 */
/* 98.04.14 # define PDFCALLBACK __stdcall */
/* 98.04.14 */
/* 98.04.14 #elif defined(_WINDOWS) || defined(_Windows) */
/* 98.04.14 # include <windows.h> */
/* 98.04.14 */
/* 98.04.14 # define ENVTYPE PDF_E_WIN16 */
/* 98.04.14 */
/* 98.04.14 # ifndef PDFAPI */
/* 98.04.14 # define PDFAPI _far _pascal */
/* 98.04.14 # endif */
/* 98.04.14 # define PDFCALLBACK _far _pascal _export */
/* 98.04.14 */
/* 98.04.14 #elif defined(_MSDOS) */
# if defined (_TLCS_)
# define ENVTYPE PDF_E_DOS
# define LIBTYPE PDF_L_STATIC
# define PDFAPI
# define PDFCALLBACK
# define FAR
# else
# define ENVTYPE PDF_E_DOS
# define LIBTYPE PDF_L_STATIC
/**************************************** B-N(伀) *********************************/
/* # define PDFAPI _far _pascal */
/* # define PDFCALLBACK _far _pascal */
/* # define FAR _far */
# define PDFAPI
# define PDFCALLBACK
# define FAR
/**************************************** B-N(仾) *********************************/
# endif
/* 98.04.14 #elif defined(_FLAT) */
/* 98.04.14 # define ENVTYPE PDF_E_FLAT */
/* 98.04.14 # define LIBTYPE PDF_L_STATIC */
/* 98.04.14 */
/* 98.04.14 # define PDFAPI */
/* 98.04.14 # define PDFCALLBACK */
/* 98.04.14 # define FAR */
/* 98.04.14 #else */
/* 98.04.14 # error Unspecified library type (DOS/Windows) */
/* 98.04.14 #endif */
/*
* The following definitions are applicable to the source code version of
* the PDF Encoder library. Changing their values will have no effect on
* the DOS library or Windows DLL versions of the encoder.
*/
/*
* Newline terminated output (bar/space patterns or codeword) must know
* whether to expand newline characters to CR/LF. This only applies to
* DOS machines.
*
* This only applies to the output_dump() output filter.
*/
#ifndef NEWLINE_EXPANSION
#define NEWLINE_EXPANSION 1
#endif
/*
* Some output filters need to know the byte ordering: big or little endian.
* By setting the INTEL_BYTE_ORDER variable you are specifying a byte order
* for a word of: LSB,MSB -- Intel 80x86 style ordering.
*/
#ifndef INTEL_BYTE_ORDER
#define INTEL_BYTE_ORDER 1
#endif
/*
* To enable the use of _huge pointers (DOS based machines whose pointers
* can address more than 64K) set the following preprocessor variable.
*/
#if (ENVTYPE == PDF_E_WIN16) || (ENVTYPE == PDF_E_DOS)
#ifndef _TLCS_
# define HUGE_PTRS
#else
# undef HUGE_PTRS
#endif
#else
# undef HUGE_PTRS
#endif
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned long uint32;
typedef signed char int8;
typedef short int16;
typedef long int32;
typedef unsigned char uchar;
typedef int16 Bool;
#endif
MEMFUNC.H文件
/**************************************** B-N(伀) *********************************/
/**************************************** B-N(仾) *********************************/
/*********************************************************************
* Module Header
*
* Identification: MEMFUNC.H - Memory/String Functions
* Copyright (c) 1994-1997 Symbol Technologies, Inc.
*
* Edit History:
* $Log: MEMFUNC.H $
* Revision 1.1 1997/01/20 15:15:04 toml
* Initial revision
*
* Description: Memory/String functions defined through macros. These
* provide memory model independence from segmented
* memory model architectures by allowing a choice to
* substitute memory independent versions. For example:
* memcpy() - Memory model dependent
* _fmemcpy() - Model independent (Microsoft/Borland)
*
**********************************************************************/
#ifndef __MEMFUNC_H__
#define __MEMFUNC_H__
/*
* Note: lint -esym(534,...) turns off the "ignoring return value of
* function" warning.
*/
#if (ENVTYPE == PDF_E_WIN32) || (ENVTYPE == PDF_E_FLAT)
# include <string.h>
/*lint -esym(534,strcpy,strcat,strchr,memset,memcpy) */
# define STRLEN( s ) (unsigned)strlen( s )
# define STRCPY( dst, src ) strcpy( dst, src )
# define STRCHR( str, chr ) strchr( str, chr )
# define STRCAT( str1, str2 ) strcat( str1, str2 )
# define MEMSET( src, data, len ) memset( src, data, len )
# define MEMCPY( dst, src, len ) memcpy( dst, src, len )
#elif (ENVTYPE == PDF_E_WIN16 )
# include <string.h>
/*lint -esym(534,lstrcpy,lstrcat,_fstrchr,_fmemset,_fmemcpy) */
# define STRLEN( s ) (unsigned)lstrlen( (LPCSTR)(s) )
# define STRCPY( dst, src ) lstrcpy( (LPSTR)(dst), (LPCSTR)(src) )
# define STRCAT( str1, str2 ) lstrcat( (LPSTR)(str1), (LPCSTR)(str2) )
# define STRCHR( str, chr ) _fstrchr( (LPCSTR)(str), (int)(chr) )
# define MEMSET( src, data, len ) _fmemset( src, (int)(data), (size_t)(len) )
# define MEMCPY( dst, src, len ) _fmemcpy( dst, src, (size_t)(len) )
#elif (ENVTYPE == PDF_E_DOS)
# include <string.h>
#ifdef _TLCS_
# define STRLEN( s ) (unsigned)strlen( s )
# define STRCAT( str1, str2 ) strcat( str1, str2 )
# define STRCPY( dst, src ) strcpy( dst, src )
# define STRCHR( str, chr ) strchr( str, chr )
# define MEMSET( src, data, len ) memset( src, (int)data, (size_t)len )
# define MEMCPY( dst, src, len ) memcpy( dst, src, (size_t)len )
#else
/*lint -esym(534,_fstrcpy,_fstrcat,_fstrchr,_fmemset,_fmemcpy) */
/**************************************** B-N(伀) *********************************/
/* # define STRLEN( s ) (unsigned)_fstrlen( s ) */
/* # define STRCAT( str1, str2 ) _fstrcat( str1, str2 ) */
/* # define STRCPY( dst, src ) _fstrcpy( dst, src ) */
/* # define STRCHR( str, chr ) _fstrchr( str, chr ) */
/* # define MEMSET( src, data, len ) _fmemset( src, (int)data, (size_t)len ) */
/* # define MEMCPY( dst, src, len ) _fmemcpy( dst, src, (size_t)len ) */
# define STRLEN( s ) (unsigned)strlen( s )
# define STRCAT( str1, str2 ) strcat( str1, str2 )
# define STRCPY( dst, src ) strcpy( dst, src )
# define STRCHR( str, chr ) strchr( str, chr )
# define MEMSET( src, data, len ) memset( src, (int)data, (size_t)len )
# define MEMCPY( dst, src, len ) memcpy( dst, src, (size_t)len )
/**************************************** B-N(仾) *********************************/
#endif
#else
Undefined operating system for memory/string function: MEMFUNC.H
#endif
#endif /* __MEMFUNC_H__ */
SESSION.H文件//
/*********************************************************************
* Module Header
*
* Identification: SESSION.H - Session Specific Allocations Header
* Copyright (c) 1994-1997 Symbol Technologies, Inc.
*
* Edit History:
* $Log: SESSION.H $
* Revision 1.1 1997/01/20 17:10:18 toml
* Initial revision
*
* Description:
*
* Notes: Header requires PDFAPI.H and APIENC.H
*
**********************************************************************/
#ifndef __SESSION_H__
#define __SESSION_H__
#if (LIBTYPE == PDF_L_STATIC) || (ENVTYPE == PDF_E_WIN32)
/*
* Static library can only handle one encode session, therefore we share a common
* set of buffers for encode settings (recAppParams) and scratch buffer
*/
#define SESS_SCRATCHBUFSIZE 2048
extern char g_abSessionScratch[ SESS_SCRATCHBUFSIZE ];
extern AppParamsRec g_recAppParams;
#define GetSessionSettings() ((LPAppParamsRec)&g_recAppParams)
#define GetSessionPDFObjBuf() ((LPVOID)abObjBuf)
#define GetSessionMPDFBuf() ((LPVOID)abMPDFBuf)
#define ReleaseSessionMPDFBuf()
#define GetTempBuf( n ) ((LPVOID)g_abSessionScratch)
#define ReleaseTempBuf( lp )
#define GetTempBitRunRec() ((LPVOID)abBitRunRec)
#define ReleaseTempBitRunRec( lp )
#endif
#if (ENVTYPE == PDF_E_WIN16) && (LIBTYPE == PDF_L_DYNAMIC)
#define GetTempBuf( nBytes ) NewScratchBuf( nBytes )
#define ReleaseTempBuf( lp ) ReleaseScratchBuf( lp )
#define GetTempBitRunRec() NewScratchBuf( sizeof(BitRunRec) )
#define ReleaseTempBitRunRec( lp ) ReleaseScratchBuf( lp )
LPAppParamsRec GetSessionSettings( void );
LPVOID GetSessionPDFObjBuf( void );
LPVOID GetSessionMPDFBuf( void );
void ReleaseSessionMPDFBuf( void );
LPVOID NewScratchBuf( uint16 nBytes );
void ReleaseScratchBuf( LPVOID lpBuf );
#endif
#endif /* __SESSION_H__ */
TCMAP.H文件/
/*********************************************************************
* Module Header
*
* Identification: TCMAP.H - TC Mode Set Testing Macro
* Copyright (c) 1994-1997 Symbol Technologies, Inc.
*
* Edit History:
* $Log: TCMAP.H $
* Revision 1.1 1997/01/20 17:10:44 toml
* Initial revision
*
* Description:
*
**********************************************************************/
#ifndef __TCMAP_H__
#define __TCMAP_H__
/*
* Flags which characters are members of the TC/NUM mode
*/
#define _PDFNUM 0x10
#define _PDFALPHA 0x01
#define _PDFLOWER 0x02
#define _PDFMIXED 0x04
#define _PDFPUNCT 0x08
extern const uchar g_pdftcset[ 256 ];
#define isNUM(ch) ( g_pdftcset[ (uchar)ch ] & _PDFNUM )
#define isTC(ch) ( g_pdftcset[ (uchar)ch ] & (_PDFALPHA|_PDFLOWER|_PDFMIXED|_PDFPUNCT) )
#define isTcAlpha(ch) ( g_pdftcset[ (uchar)ch ] & _PDFALPHA )
#define isTcLower(ch) ( g_pdftcset[ (uchar)ch ] & _PDFLOWER )
#define isTcMixed(ch) ( g_pdftcset[ (uchar)ch ] & _PDFMIXED )
#define isTcPunct(ch) ( g_pdftcset[ (uchar)ch ] & _PDFPUNCT )
#endif /* __TCMAP_H__ */