⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.93
Server IP:
65.108.141.171
Server:
Linux server.heloix.com 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
re2c
/
examples
/
View File Name :
03_arbitrary_large_input.i.re
#include <stdio.h> #include <string.h> /*!max:re2c*/ static const size_t SIZE = 16; struct input_t { char buf[SIZE + YYMAXFILL]; char *lim; char *cur; char *tok; bool eof; input_t() : buf() , lim(buf + SIZE) , cur(lim) , tok(lim) , eof(false) {} bool fill(size_t need) { if (eof) { return false; } const size_t free = tok - buf; if (free < need) { return false; } memmove(buf, tok, lim - tok); lim -= free; cur -= free; tok -= free; lim += fread(lim, 1, free, stdin); if (lim < buf + SIZE) { eof = true; memset(lim, 0, YYMAXFILL); lim += YYMAXFILL; } return true; } }; static bool lex(input_t & in, unsigned int &count) { for (count = 0;;) { in.tok = in.cur; /*!re2c re2c:define:YYCTYPE = char; re2c:define:YYCURSOR = in.cur; re2c:define:YYLIMIT = in.lim; re2c:define:YYFILL = "if (!in.fill(@@)) return false;"; re2c:define:YYFILL:naked = 1; end = "\x00"; wsp = [\n]+; num = [0-9]+; * { return false; } end { return YYMAXFILL == in.lim - in.tok; } wsp { continue; } num { ++count; continue; } */ } } int main() { input_t in; unsigned int count; if (lex(in, count)) { printf("glorious %u numbers!\n", count); } else { printf("error\n"); } return 0; }