44 unsigned char *ptr, *dataEnd;
46 msg->
output = (outputStart == NULL) ? msg->
output : outputStart;
58 while (ptr < dataEnd) {
217 while (ptr < dataEnd) {
218 int codeword = (int)(*ptr);
226 int pushword = codeword + 127;
237 msg->
padCount = (int)(dataEnd - ptr);
239 }
else if (codeword == 0 || codeword >= 242) {
241 }
else if (codeword <= 128) {
243 }
else if (codeword <= 229) {
244 int digits = codeword - 130;
249 int pushword = msg->
fnc1;
283 if (dataEnd - ptr < 2) {
287 while (ptr < dataEnd) {
289 packed = (*ptr << 8) | *(ptr + 1);
290 c40Values[0] = ((packed - 1) / 1600);
291 c40Values[1] = ((packed - 1) / 40) % 40;
292 c40Values[2] = (packed - 1) % 40;
295 for (i = 0; i < 3; i++) {
297 if (c40Values[i] <= 2) {
298 state.
shift = c40Values[i] + 1;
299 }
else if (c40Values[i] == 3) {
301 }
else if (c40Values[i] <= 13) {
303 }
else if (c40Values[i] <= 39) {
313 if (c40Values[i] <= 14) {
315 }
else if (c40Values[i] <= 21) {
317 }
else if (c40Values[i] <= 26) {
319 }
else if (c40Values[i] == 27) {
323 }
else if (c40Values[i] == 30) {
331 if (c40Values[i] == 0) {
333 }
else if (c40Values[i] <= 26) {
348 if (dataEnd - ptr < 2) {
370 if (dataEnd - ptr < 2) {
374 while (ptr < dataEnd) {
376 packed = (*ptr << 8) | *(ptr + 1);
377 x12Values[0] = ((packed - 1) / 1600);
378 x12Values[1] = ((packed - 1) / 40) % 40;
379 x12Values[2] = (packed - 1) % 40;
382 for (i = 0; i < 3; i++) {
383 if (x12Values[i] == 0) {
385 }
else if (x12Values[i] == 1) {
387 }
else if (x12Values[i] == 2) {
389 }
else if (x12Values[i] == 3) {
391 }
else if (x12Values[i] <= 13) {
393 }
else if (x12Values[i] <= 90) {
404 if (dataEnd - ptr < 2) {
422 unsigned char unpacked[4];
425 if (dataEnd - ptr < 3) {
429 while (ptr < dataEnd) {
433 unpacked[0] = (*ptr & 0xfc) >> 2;
434 unpacked[1] = (*ptr & 0x03) << 4 | (*(ptr + 1) & 0xf0) >> 4;
435 unpacked[2] = (*(ptr + 1) & 0x0f) << 2 | (*(ptr + 2) & 0xc0) >> 6;
436 unpacked[3] = *(ptr + 2) & 0x3f;
438 for (i = 0; i < 4; i++) {
450 pushOutputWord(msg, unpacked[i] ^ (((unpacked[i] & 0x20) ^ 0x20) << 1));
454 if (dataEnd - ptr < 3) {
506 unsigned char *ptrEnd;
511 idx = (int)(ptr + 1 - msg->
code);
516 }
else if (d0 <= 249) {
520 ptrEnd = ptr + (d0 - 249) * 250 + d1;
523 if (ptrEnd > dataEnd) {
527 while (ptr < ptrEnd) {
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.
int dmtxGetSymbolAttribute(int attribute, int sizeIdx)
根据规格索引返回二维码规格各个参数
@ DmtxSymAttribSymbolDataWords
enum DmtxScheme_enum DmtxScheme
static unsigned char * decodeSchemeC40Text(DmtxMessage *msg, unsigned char *ptr, unsigned char *dataEnd, DmtxScheme encScheme)
Decode stream assuming C40 or Text encodation.
static unsigned char * decodeSchemeAscii(DmtxMessage *msg, unsigned char *ptr, unsigned char *dataEnd)
Decode stream assuming standard ASCII encodation.
static int getEncodationScheme(unsigned char cw)
Determine next encodation scheme.
static unsigned char * decodeSchemeX12(DmtxMessage *msg, unsigned char *ptr, unsigned char *dataEnd)
Decode stream assuming X12 encodation.
static void pushOutputWord(DmtxMessage *msg, int value)
static DmtxBoolean validOutputWord(int value)
static void pushOutputMacroHeader(DmtxMessage *msg, int macroType)
static unsigned char * decodeSchemeEdifact(DmtxMessage *msg, unsigned char *ptr, unsigned char *dataEnd)
Decode stream assuming EDIFACT encodation.
DmtxPassFail decodeDataStream(DmtxMessage *msg, int sizeIdx, unsigned char *outputStart)
Translate encoded data stream into final output.
static void pushOutputMacroTrailer(DmtxMessage *msg)
static unsigned char * decodeSchemeBase256(DmtxMessage *msg, unsigned char *ptr, unsigned char *dataEnd)
Decode stream assuming Base 256 encodation.
static void pushOutputC40TextWord(DmtxMessage *msg, C40TextState *state, int value)
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.
#define DmtxValueBase256Latch
#define DmtxValueAsciiPad
#define DmtxC40TextShift2
#define DmtxValueC40Latch
#define DmtxC40TextShift3
#define DmtxC40TextBasicSet
#define DmtxValueTextLatch
static unsigned char unRandomize255State(unsigned char value, int idx)
#define DmtxValueX12Latch
#define DmtxValueAsciiUpperShift
#define DmtxValueEdifactUnlatch
#define DmtxC40TextShift1
#define DmtxValueCTXUnlatch
#define DmtxValueEdifactLatch
unsigned char * code
指向码字(数据字和纠错字)的指针
int outputIdx
Internal index used to store output progress.
int fnc1
表示FNC1或DmtxUndefined的字符
unsigned char * output
指向二维码码值的指针