test: compile pike on fly

This commit is contained in:
Kyryl Melekhin
2021-08-03 18:33:41 +00:00
parent 11c505447c
commit 70766fb93e
2 changed files with 3 additions and 8 deletions

9
pike.c
View File

@@ -53,13 +53,6 @@ static int isword(const char *s)
return isalnum(c) || c == '_' || c > 127; return isalnum(c) || c == '_' || c > 127;
} }
static char *uc_beg(char *beg, char *s)
{
while (s > beg && (((unsigned char) *s) & 0xc0) == 0x80)
s--;
return s;
}
typedef struct rcode rcode; typedef struct rcode rcode;
struct rcode struct rcode
{ {
@@ -634,7 +627,7 @@ int main(int argc, char *argv[])
int sub_els = (_code->sub + 1) * 2; int sub_els = (_code->sub + 1) * 2;
const char *sub[sub_els]; const char *sub[sub_els];
for (int i = 2; i < argc; i++) { for (int i = 2; i < argc; i++) {
printf("input bytelen: %d\n", strlen(argv[i])); printf("input bytelen: %ld\n", strlen(argv[i]));
clock_t start_time = clock(); clock_t start_time = clock();
sz = re_pikevm(_code, argv[i], sub, sub_els); sz = re_pikevm(_code, argv[i], sub, sub_els);
double elapsed_time = (double)(clock() - start_time) / CLOCKS_PER_SEC; double elapsed_time = (double)(clock() - start_time) / CLOCKS_PER_SEC;

View File

@@ -253,6 +253,8 @@ expect="\
(4,13)(?,?) (4,13)(?,?)
(0,0) (0,0)
" "
gcc pike.c -pedantic -Wall -Wfatal-errors -std=c99
c=1 c=1
echo "$regex" | tr '\n' | while read re; do echo "$regex" | tr '\n' | while read re; do
inp=$(echo "$input" | awk -v c=$c 'BEGIN{ RS = "" ; FS = "\n" }{print $c}') inp=$(echo "$input" | awk -v c=$c 'BEGIN{ RS = "" ; FS = "\n" }{print $c}')