mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-12 22:25:59 -04:00
Initial implementation of rMQR
According to draft dated June 2018
This commit is contained in:
parent
385a0a246f
commit
ad28de1819
6 changed files with 783 additions and 211 deletions
|
@ -181,6 +181,7 @@ extern int dmatrix(struct zint_symbol *symbol, const unsigned char source[], con
|
|||
extern int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* VIN Code (Vehicle Identification Number) */
|
||||
extern int mailmark(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Royal Mail 4-state Mailmark */
|
||||
extern int ultracode(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Ultracode */
|
||||
extern int rmqr(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* rMQR */
|
||||
|
||||
extern int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */
|
||||
extern int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to EPS/EMF/SVG */
|
||||
|
@ -385,7 +386,7 @@ static void check_row_heights(struct zint_symbol *symbol) {
|
|||
|
||||
static int check_force_gs1(const int symbology) {
|
||||
/* Returns 1 if symbology MUST have GS1 data */
|
||||
|
||||
|
||||
int result = is_composite(symbology);
|
||||
|
||||
switch (symbology) {
|
||||
|
@ -397,7 +398,7 @@ static int check_force_gs1(const int symbology) {
|
|||
result = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -414,6 +415,7 @@ static int gs1_compliant(const int symbology) {
|
|||
case BARCODE_CODE49:
|
||||
case BARCODE_QRCODE:
|
||||
case BARCODE_DOTCODE:
|
||||
case BARCODE_RMQR:
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -440,6 +442,7 @@ static int is_matrix(const int symbology) {
|
|||
case BARCODE_HANXIN:
|
||||
case BARCODE_DOTCODE:
|
||||
case BARCODE_UPNQR:
|
||||
case BARCODE_RMQR:
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -449,7 +452,7 @@ static int is_matrix(const int symbology) {
|
|||
|
||||
static int is_linear(const int symbology) {
|
||||
/* Returns 1 if symbology is linear (1 dimensional) */
|
||||
|
||||
|
||||
int result = 0;
|
||||
switch (symbology) {
|
||||
case BARCODE_CODE11:
|
||||
|
@ -506,7 +509,7 @@ static int is_linear(const int symbology) {
|
|||
result = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -633,6 +636,7 @@ int ZBarcode_ValidID(int symbol_id) {
|
|||
case BARCODE_VIN:
|
||||
case BARCODE_MAILMARK:
|
||||
case BARCODE_ULTRA:
|
||||
case BARCODE_RMQR:
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -642,7 +646,7 @@ int ZBarcode_ValidID(int symbol_id) {
|
|||
|
||||
static int extended_charset(struct zint_symbol *symbol, const unsigned char *source, const int length) {
|
||||
int error_number = 0;
|
||||
|
||||
|
||||
/* These are the "elite" standards which can support multiple character sets */
|
||||
switch (symbol->symbology) {
|
||||
case BARCODE_QRCODE: error_number = qr_code(symbol, source, length);
|
||||
|
@ -655,6 +659,8 @@ static int extended_charset(struct zint_symbol *symbol, const unsigned char *sou
|
|||
break;
|
||||
case BARCODE_UPNQR: error_number = upnqr(symbol, source, length);
|
||||
break;
|
||||
case BARCODE_RMQR: error_number = rmqr(symbol, source, length);
|
||||
break;
|
||||
}
|
||||
|
||||
return error_number;
|
||||
|
@ -669,7 +675,7 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
|
|||
#else
|
||||
unsigned char* preprocessed = (unsigned char*) _alloca(in_length + 1);
|
||||
#endif
|
||||
|
||||
|
||||
if (symbol->symbology == BARCODE_CODE16K) {
|
||||
symbol->whitespace_width = 16;
|
||||
symbol->border_width = 2;
|
||||
|
@ -685,7 +691,7 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
|
|||
symbol->output_options += BARCODE_BOX;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (symbol->input_mode & 0x07) {
|
||||
case DATA_MODE:
|
||||
case GS1_MODE:
|
||||
|
@ -700,11 +706,11 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((symbol->height == 0) && is_linear(symbol->symbology)) {
|
||||
symbol->height = 50;
|
||||
}
|
||||
|
||||
|
||||
switch (symbol->symbology) {
|
||||
case BARCODE_C25MATRIX: error_number = matrix_two_of_five(symbol, preprocessed, in_length);
|
||||
break;
|
||||
|
@ -894,7 +900,7 @@ int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string,
|
|||
|
||||
in_posn = 0;
|
||||
out_posn = 0;
|
||||
|
||||
|
||||
do {
|
||||
if (input_string[in_posn] == '\\') {
|
||||
switch (input_string[in_posn + 1]) {
|
||||
|
@ -968,11 +974,11 @@ int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string,
|
|||
}
|
||||
out_posn++;
|
||||
} while (in_posn < *length);
|
||||
|
||||
|
||||
memcpy(input_string, escaped_string, out_posn);
|
||||
input_string[out_posn] = '\0';
|
||||
*length = out_posn;
|
||||
|
||||
|
||||
error_number = 0;
|
||||
|
||||
return error_number;
|
||||
|
@ -1125,7 +1131,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||
}
|
||||
}
|
||||
/* Everything from 128 up is Zint-specific */
|
||||
if (symbol->symbology >= 145) {
|
||||
if (symbol->symbology > 145) {
|
||||
strcpy(symbol->errtxt, "216: Symbology out of range, using Code 128");
|
||||
symbol->symbology = BARCODE_CODE128;
|
||||
error_number = ZINT_WARN_INVALID_OPTION;
|
||||
|
@ -1193,7 +1199,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||
if ((input_mode < 0) || (input_mode > 2)) {
|
||||
input_mode = DATA_MODE;
|
||||
}
|
||||
|
||||
|
||||
if ((symbol->eci != 0) && (symbol->eci != 26)) {
|
||||
input_mode = DATA_MODE;
|
||||
}
|
||||
|
@ -1201,13 +1207,14 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||
if (input_mode == UNICODE_MODE) {
|
||||
strip_bom(local_source, &in_length);
|
||||
}
|
||||
|
||||
|
||||
switch (symbol->symbology) {
|
||||
case BARCODE_QRCODE:
|
||||
case BARCODE_MICROQR:
|
||||
case BARCODE_GRIDMATRIX:
|
||||
case BARCODE_HANXIN:
|
||||
case BARCODE_UPNQR:
|
||||
case BARCODE_RMQR:
|
||||
error_number = extended_charset(symbol, local_source, in_length);
|
||||
break;
|
||||
default:
|
||||
|
@ -1247,7 +1254,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||
error_number = reduced_charset(symbol, local_source, in_length);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (error_number == 0) {
|
||||
error_number = ZINT_WARN_USES_ECI;
|
||||
strcpy(symbol->errtxt, "222: Encoded data includes ECI");
|
||||
|
@ -1341,7 +1348,7 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
|
|||
error_number = dump_plot(symbol);
|
||||
} else
|
||||
if (!(strcmp(output, "EPS"))) {
|
||||
error_number = plot_vector(symbol, rotate_angle, OUT_EPS_FILE);
|
||||
error_number = plot_vector(symbol, rotate_angle, OUT_EPS_FILE);
|
||||
} else
|
||||
if (!(strcmp(output, "SVG"))) {
|
||||
error_number = plot_vector(symbol, rotate_angle, OUT_SVG_FILE);
|
||||
|
@ -1434,7 +1441,7 @@ int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input,
|
|||
if (error_number == 0) {
|
||||
error_number = first_err;
|
||||
}
|
||||
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -1452,7 +1459,7 @@ int ZBarcode_Encode_and_Buffer_Vector(struct zint_symbol *symbol, unsigned char
|
|||
if (error_number == 0) {
|
||||
error_number = first_err;
|
||||
}
|
||||
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -1523,13 +1530,13 @@ int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, char *filename, i
|
|||
if (error_number >= 5) {
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
||||
first_err = error_number;
|
||||
error_number = ZBarcode_Print(symbol, rotate_angle);
|
||||
if (error_number == 0) {
|
||||
error_number = first_err;
|
||||
}
|
||||
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -1541,7 +1548,7 @@ int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename,
|
|||
if (error_number >= 5) {
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
||||
first_err = error_number;
|
||||
error_number = ZBarcode_Buffer(symbol, rotate_angle);
|
||||
if (error_number == 0) {
|
||||
|
@ -1559,7 +1566,7 @@ int ZBarcode_Encode_File_and_Buffer_Vector(struct zint_symbol *symbol, char *fil
|
|||
if (error_number >= 5) {
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
||||
first_err = error_number;
|
||||
error_number = ZBarcode_Buffer_Vector(symbol, rotate_angle);
|
||||
if (error_number == 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue