25 if (stream->status != DmtxStatusEncoding) { \
33 if (sizeIdx == DmtxUndefined) { \
34 streamMarkInvalid(stream, DmtxErrorUnknown); \
42 if (passFail == DmtxFail) { \
43 streamMarkFatal(stream, DmtxErrorUnknown); \
49#define RETURN_IF_FAIL \
51 if (*passFail == DmtxFail) \
76 for (i = 0; i < valueList.length % 3; i++) {
108 while (valueList.length >= 3) {
116 if (valueList.length == 0) {
151 if (valueList->length < 3) {
157 pairValue = (1600 * valueList->b[0]) + (40 * valueList->b[1]) + valueList->b[2] + 1;
158 cw0 = pairValue / 256;
159 cw1 = pairValue % 256;
217 if (symbolRemaining > 0) {
255 int sizeIdx1, sizeIdx2;
256 int symbolRemaining1, symbolRemaining2;
268 DmtxAssert(valueList->length == 1 || valueList->length == 2);
276 if (valueList->length == 2 && symbolRemaining2 == 2) {
297 if (valueList->length == 2 && outputTmp.length == 1) {
311 if (outputTmp.length == 1 && symbolRemaining1 == 1) {
325 for (i = 0; i < outputTmp.length; i++) {
360 DmtxAssert(valueList->length == 1 || valueList->length == 2);
363 for (i = 0; i < valueList->length; i++) {
374 if (outputTmp.length == 1 && symbolRemaining == 1) {
388 for (i = 0; i < outputTmp.length; i++) {
438 if (valueList.length >= 3) {
456 if (inputValue > 127 && (fnc1 ==
DmtxUndefined || (
int)inputValue != fnc1)) {
471 if (inputValue == 13) {
474 }
else if (inputValue == 42) {
477 }
else if (inputValue == 62) {
480 }
else if (inputValue == 32) {
483 }
else if (inputValue >= 48 && inputValue <= 57) {
486 }
else if (inputValue >= 65 && inputValue <= 90) {
502 }
else if (inputValue <= 31) {
507 }
else if (inputValue == 32) {
510 }
else if (inputValue <= 47) {
515 }
else if (inputValue <= 57) {
518 }
else if (inputValue <= 64) {
523 }
else if (inputValue <= 90 && targetScheme ==
DmtxSchemeC40) {
531 }
else if (inputValue <= 95) {
544 }
else if (inputValue <= 127) {
584 for (i = 0; i < list->length - 3; i++) {
585 list->b[i] = list->b[i + 3];
589 for (i = 0; i < 3; i++) {
595 if (list->length == 0) {
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.
DmtxByteList dmtxByteListBuild(DmtxByte *storage, int capacity)
void dmtxByteListPush(DmtxByteList *list, DmtxByte value, DmtxPassFail *passFail)
DmtxByte dmtxByteListPop(DmtxByteList *list, DmtxPassFail *passFail)
static void shiftValueListBy3(DmtxByteList *list, DmtxPassFail *passFail)
static void completePartialX12(DmtxEncodeStream *stream, DmtxByteList *valueList, int sizeIdxRequest)
Partial chunks are not valid in X12.
static void completeIfDoneCTX(DmtxEncodeStream *stream, int sizeIdxRequest)
Complete C40/Text/X12 encoding if it matches a known end-of-symbol condition.
static void appendUnlatchCTX(DmtxEncodeStream *stream)
static DmtxBoolean partialX12ChunkRemains(DmtxEncodeStream *stream)
Return DmtxTrue 1 or 2 X12 values remain, otherwise DmtxFalse.
static void appendValuesCTX(DmtxEncodeStream *stream, DmtxByteList *valueList)
static void encodeNextChunkCTX(DmtxEncodeStream *stream, int sizeIdxRequest)
static void pushCTXValues(DmtxByteList *valueList, DmtxByte inputValue, int targetScheme, DmtxPassFail *passFail, int fnc1)
static void completePartialC40Text(DmtxEncodeStream *stream, DmtxByteList *valueList, int sizeIdxRequest)
The remaining values can exist in 3 possible cases:
static DmtxBoolean isCTX(int scheme)
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.
static DmtxByte streamInputAdvanceNext(DmtxEncodeStream *stream)
#define DmtxValueCTXShift1
static void streamOutputChainAppend(DmtxEncodeStream *stream, DmtxByte value)
@ DmtxErrorUnsupportedCharacter
@ DmtxErrorIncompleteValueList
@ DmtxErrorNotOnByteBoundary
@ DmtxErrorUnexpectedScheme
static void padRemainingInAscii(DmtxEncodeStream *stream, int sizeIdx)
#define DmtxValueCTXShift3
static void streamMarkInvalid(DmtxEncodeStream *stream, int reasonIdx)
static DmtxByte streamInputPeekNext(DmtxEncodeStream *stream)
static void streamInputAdvancePrev(DmtxEncodeStream *stream)
static int findSymbolSize(int dataWords, int sizeIdxRequest)
static DmtxByteList encodeTmpRemainingInAscii(DmtxEncodeStream *stream, DmtxByte *storage, int capacity, DmtxPassFail *passFail)
static void streamMarkComplete(DmtxEncodeStream *stream, int sizeIdx)
#define DmtxUnlatchImplicit
static void encodeChangeScheme(DmtxEncodeStream *stream, DmtxScheme targetScheme, int unlatchType)
static int getRemainingSymbolCapacity(int outputLength, int sizeIdx)
static void appendValueAscii(DmtxEncodeStream *stream, DmtxByte value)
#define DmtxUnlatchExplicit
#define DmtxValueCTXShift2
static void streamMarkFatal(DmtxEncodeStream *stream, int reasonIdx)
static DmtxBoolean streamInputHasNext(DmtxEncodeStream *stream)
#define DmtxValueCTXUnlatch
DmtxByteList Use signed int for length fields instead of size_t to play nicely with RS arithmetic.
int outputChainValueCount