Commit 073e7581 authored by Daniel Salzman's avatar Daniel Salzman Committed by Libor Peltan

zscanner: add comment callback processing support

parent af3a9826
......@@ -376,6 +376,20 @@ int zs_set_processing(
return 0;
}
__attribute__((visibility("default")))
int zs_set_processing_comment(
zs_scanner_t *s,
void (*process_comment)(zs_scanner_t *))
{
if (s == NULL) {
return -1;
}
s->process.comment = process_comment;
return 0;
}
typedef enum {
WRAP_NONE, // Initial state.
WRAP_DETECTED, // Input block end is a first '\' in rdata.
......@@ -1705,6 +1719,16 @@ tr89:
tr92:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1127; goto _out;}
}
}
}
{
if (rdata_tail - s->r_data > UINT16_MAX) {
......@@ -1737,6 +1761,16 @@ tr92:
tr666:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1127; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -1749,6 +1783,16 @@ tr760:
}
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1127; goto _out;}
}
}
}
{
if (rdata_tail - s->r_data > UINT16_MAX) {
......@@ -1812,6 +1856,16 @@ tr878:
}
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1127; goto _out;}
}
}
}
goto st1127;
tr882:
......@@ -1844,6 +1898,16 @@ tr882:
}
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1127; goto _out;}
}
}
}
goto st1127;
tr3618:
......@@ -3148,6 +3212,16 @@ tr34:
tr719:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 3; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -3421,6 +3495,16 @@ tr64:
tr96:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 5; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -13809,6 +13893,16 @@ case 13:
tr112:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1128; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -19321,6 +19415,16 @@ tr648:
tr606:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 64; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -21152,6 +21256,16 @@ case 141:
tr914:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1129; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -21517,6 +21631,16 @@ tr637:
tr664:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 145; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -21996,6 +22120,16 @@ tr610:
tr912:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1130; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -22004,6 +22138,16 @@ tr912:
tr801:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1130; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -22400,6 +22544,16 @@ tr687:
tr691:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 161; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -22554,6 +22708,16 @@ tr22:
tr910:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1132; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -22562,6 +22726,16 @@ tr910:
tr756:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1132; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -22692,6 +22866,16 @@ tr824:
tr827:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1132; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -23010,6 +23194,16 @@ tr701:
tr704:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 164; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -23570,6 +23764,16 @@ tr731:
tr896:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 171; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -27448,6 +27652,16 @@ tr133:
tr874:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1135; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -27456,6 +27670,16 @@ tr874:
tr772:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1135; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -36243,6 +36467,16 @@ tr968:
tr1007:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 292; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -36521,6 +36755,16 @@ tr988:
tr991:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1141; goto _out;}
}
}
}
{
if (s->number64 <= UINT32_MAX) {
......@@ -36922,6 +37166,16 @@ tr1012:
tr1043:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 301; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -37239,6 +37493,16 @@ tr1031:
tr1034:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 1142; goto _out;}
}
}
}
{
s->zone_origin_length = s->dname_tmp_length;
......@@ -37504,6 +37768,16 @@ tr1047:
tr1101:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 313; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -38191,6 +38465,16 @@ tr1083:
cs = 1143;
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; goto _out;}
}
}
}
{
// Extend relative file path.
......@@ -38518,6 +38802,16 @@ tr1092:
cs = 1144;
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -38647,6 +38941,16 @@ tr1096:
tr1099:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 326; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -38891,6 +39195,16 @@ tr1111:
tr1117:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 333; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -39143,6 +39457,16 @@ tr1145:
tr1172:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 337; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -47469,6 +47793,16 @@ tr1615:
tr1646:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 469; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -47589,6 +47923,16 @@ tr1630:
tr1644:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 471; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -47733,6 +48077,16 @@ tr1636:
tr1642:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 473; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -48078,6 +48432,16 @@ tr1650:
tr1686:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 478; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -48287,6 +48651,16 @@ tr1665:
tr1679:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 480; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -48431,6 +48805,16 @@ tr1671:
tr1677:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 482; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -50798,6 +51182,16 @@ tr1878:
tr2022:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 638; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -50933,6 +51327,16 @@ tr1890:
tr2020:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 640; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -51090,6 +51494,16 @@ tr1902:
tr2018:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 642; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -51285,6 +51699,16 @@ tr1920:
tr2003:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 644; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -51577,6 +52001,16 @@ tr1937:
tr1988:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 646; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -51869,6 +52303,16 @@ tr1954:
tr1973:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 648; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -53455,6 +53899,16 @@ tr2033:
tr2037:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 670; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -53732,6 +54186,16 @@ tr2048:
tr2052:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 675; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -53985,6 +54449,16 @@ tr2064:
tr2068:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 680; goto _out;}
}
}
}
{
s->line_counter++;
......@@ -54276,6 +54750,16 @@ tr2083:
tr2089:
{
s->buffer[s->buffer_length++] = 0;
// Execute the comment callback.
if (s->process.automatic && s->process.comment != NULL) {
s->process.comment(s);
// Stop if required from the callback.
if (s->state == ZS_STATE_STOP) {
{p++; cs = 685; goto _out;}
}