/* Generated by re2c 1.3 on Wed Mar 4 13:32:28 2020 */ #line 1 "led_pattern.h.in" /* LED MODULE Copyright (C) 2020 by Maxim Prokhorov */ #pragma once #include #include "led.h" // Scans input string with format // ',, ,, ...' // Directly changing `led.pattern.delays` contents void _ledLoadPattern(led_t& led, const char* input) { char buffer[16]; const char* d1; const char* d2; const char* d3; const char* p = input; const char* marker; led.pattern.delays.clear(); loop: const char *yyt1;const char *yyt2;const char *yyt3; #line 37 "led_pattern.h" { char yych; static const unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; yych = (char)*p; if (yybm[0+yych] & 64) { goto yy4; } if (yych <= '/') goto yy2; if (yych <= '9') { yyt1 = p; goto yy7; } yy2: ++p; yy3: #line 45 "led_pattern.h.in" { return; } #line 88 "led_pattern.h" yy4: yych = (char)*++p; if (yybm[0+yych] & 64) { goto yy4; } #line 46 "led_pattern.h.in" { goto loop; } #line 96 "led_pattern.h" yy7: yych = (char)*(marker = ++p); if (yybm[0+yych] & 128) { goto yy10; } if (yych != ',') goto yy3; yy8: yych = (char)*++p; if (yych <= '/') goto yy9; if (yych <= '9') { yyt2 = p; goto yy12; } yy9: p = marker; goto yy3; yy10: yych = (char)*++p; if (yybm[0+yych] & 128) { goto yy10; } if (yych == ',') goto yy8; goto yy9; yy12: yych = (char)*++p; if (yych == ',') goto yy14; if (yych <= '/') goto yy9; if (yych <= '9') goto yy12; goto yy9; yy14: yych = (char)*++p; if (yych <= '/') goto yy9; if (yych >= ':') goto yy9; yyt3 = p; yy15: yych = (char)*++p; if (yych <= '/') goto yy17; if (yych <= '9') goto yy15; yy17: d1 = yyt1; d2 = yyt2; d3 = yyt3; #line 47 "led_pattern.h.in" { unsigned long on; unsigned long off; unsigned char repeats; memcpy(buffer, d1, int(d2 - d1)); buffer[int(d2 - d1 - 1)] = '\0'; on = strtoul(buffer, nullptr, 10); memcpy(buffer, d2, int(d3 - d2)); buffer[int(d3 - d2 - 1)] = '\0'; off = strtoul(buffer, nullptr, 10); memcpy(buffer, d3, int(p - d3)); buffer[int(p - d3)] = '\0'; repeats = strtoul(buffer, nullptr, 10); led.pattern.delays.emplace_back( on, off, repeats ); goto loop; } #line 163 "led_pattern.h" } #line 70 "led_pattern.h.in" }