Commit 838f7bad authored by Andre Maroneze's avatar Andre Maroneze 💬
Browse files

sync with frama-c master

parent 8731623c
......@@ -143,8 +143,8 @@ void getColor(uint8_t value, char *color, size_t length)
foreground += 2;
}
}
snprintf_va_1(color,length,"\033[38;5;%d;48;5;%dm",(int)*foreground,
(int)*background);
snprintf(color,length,"\033[38;5;%d;48;5;%dm",(int)*foreground,
(int)*background); /* snprintf_va_1 */
return;
}
......@@ -405,52 +405,52 @@ void drawBoard(uint8_t (* /*[4]*/ board)[4])
char c;
char color[40];
char reset[4] = {(char)'\033', (char)'[', (char)'m', (char)'\000'};
printf_va_1("\033[H");
printf_va_2("2048.c %17d pts\n\n",(int)score);
printf("\033[H"); /* printf_va_1 */
printf("2048.c %17d pts\n\n",(int)score); /* printf_va_2 */
y = (unsigned char)0;
while ((int)y < 4) {
x = (unsigned char)0;
while ((int)x < 4) {
getColor((*(board + x))[y],color,(unsigned int)40);
printf_va_3("%s",color);
printf_va_4(" ");
printf_va_5("%s",reset);
printf("%s",color); /* printf_va_3 */
printf(" "); /* printf_va_4 */
printf("%s",reset); /* printf_va_5 */
x = (uint8_t)((int)x + 1);
}
printf_va_6("\n");
printf("\n"); /* printf_va_6 */
x = (unsigned char)0;
while ((int)x < 4) {
getColor((*(board + x))[y],color,(unsigned int)40);
printf_va_7("%s",color);
printf("%s",color); /* printf_va_7 */
if ((int)(*(board + x))[y] != 0) {
char s[8];
size_t tmp;
snprintf_va_2(s,(unsigned int)8,"%u",
(unsigned int)1 << (int)(*(board + x))[y]);
snprintf(s,(unsigned int)8,"%u",
(unsigned int)1 << (int)(*(board + x))[y]); /* snprintf_va_2 */
tmp = strlen((char const *)(s));
uint8_t t = (unsigned char)((size_t)7 - tmp);
printf_va_8("%*s%s%*s",(int)t - (int)t / 2,(char *)"",s,(int)t / 2,
(char *)"");
printf("%*s%s%*s",(int)t - (int)t / 2,(char *)"",s,(int)t / 2,
(char *)""); /* printf_va_8 */
}
else printf_va_9(" \302\267 ");
printf_va_10("%s",reset);
else printf(" \302\267 "); /* printf_va_9 */
printf("%s",reset); /* printf_va_10 */
x = (uint8_t)((int)x + 1);
}
printf_va_11("\n");
printf("\n"); /* printf_va_11 */
x = (unsigned char)0;
while ((int)x < 4) {
getColor((*(board + x))[y],color,(unsigned int)40);
printf_va_12("%s",color);
printf_va_13(" ");
printf_va_14("%s",reset);
printf("%s",color); /* printf_va_12 */
printf(" "); /* printf_va_13 */
printf("%s",reset); /* printf_va_14 */
x = (uint8_t)((int)x + 1);
}
printf_va_15("\n");
printf("\n"); /* printf_va_15 */
y = (uint8_t)((int)y + 1);
}
printf_va_16("\n");
printf_va_17(" \342\206\220,\342\206\221,\342\206\222,\342\206\223 or q \n");
printf_va_18("\033[A");
printf("\n"); /* printf_va_16 */
printf(" \342\206\220,\342\206\221,\342\206\222,\342\206\223 or q \n"); /* printf_va_17 */
printf("\033[A"); /* printf_va_18 */
return;
}
......@@ -993,34 +993,33 @@ int test(void)
if ((int)success == 0) {
i = (unsigned char)0;
while ((int)i < 4) {
printf_va_19("%d ",(int)*(in + i));
printf("%d ",(int)*(in + i)); /* printf_va_19 */
i = (uint8_t)((int)i + 1);
}
printf_va_20("=> ");
printf("=> "); /* printf_va_20 */
i = (unsigned char)0;
while ((int)i < 4) {
printf_va_21("%d ",(int)array[i]);
printf("%d ",(int)array[i]); /* printf_va_21 */
i = (uint8_t)((int)i + 1);
}
printf_va_22("expected ");
printf("expected "); /* printf_va_22 */
i = (unsigned char)0;
while ((int)i < 4) {
printf_va_23("%d ",(int)*(in + i));
printf("%d ",(int)*(in + i)); /* printf_va_23 */
i = (uint8_t)((int)i + 1);
}
printf_va_24("=> ");
printf("=> "); /* printf_va_24 */
i = (unsigned char)0;
while ((int)i < 4) {
printf_va_25("%d ",(int)*(out + i));
printf("%d ",(int)*(out + i)); /* printf_va_25 */
i = (uint8_t)((int)i + 1);
}
printf_va_26("\n");
printf("\n"); /* printf_va_26 */
break;
}
t = (uint8_t)((int)t + 1);
}
if (success) printf_va_27("All %hhu tests executed successfully\n",
(int)tests);
if (success) printf("All %hhu tests executed successfully\n",(int)tests); /* printf_va_27 */
__retres = ! success;
return __retres;
}
......@@ -1051,9 +1050,9 @@ int printf_va_29(char const * __restrict format);
void signal_callback_handler(int signum)
{
printf_va_28(" TERMINATED \n");
printf(" TERMINATED \n"); /* printf_va_28 */
setBufferedInput((_Bool)1);
printf_va_29("\033[?25h\033[m");
printf("\033[?25h\033[m"); /* printf_va_29 */
exit(signum);
return;
}
......@@ -1124,7 +1123,7 @@ int main(int argc, char **argv)
uint8_t board[4][4];
char c;
_Bool success;
printf_va_30("\033[?25l\033[2J");
printf("\033[?25l\033[2J"); /* printf_va_30 */
signal(2,& signal_callback_handler);
initBoard(board);
setBufferedInput((_Bool)0);
......@@ -1152,13 +1151,13 @@ int main(int argc, char **argv)
drawBoard(board);
tmp_0 = gameEnded(board);
if (tmp_0) {
printf_va_31(" GAME OVER \n");
printf(" GAME OVER \n"); /* printf_va_31 */
break;
}
}
if ((int)c == 'q') {
int tmp_1;
printf_va_32(" QUIT? (y/n) \n");
printf(" QUIT? (y/n) \n"); /* printf_va_32 */
tmp_1 = getchar();
c = (char)tmp_1;
if ((int)c == 'y') break;
......@@ -1166,7 +1165,7 @@ int main(int argc, char **argv)
}
if ((int)c == 'r') {
int tmp_2;
printf_va_33(" RESTART? (y/n) \n");
printf(" RESTART? (y/n) \n"); /* printf_va_33 */
tmp_2 = getchar();
c = (char)tmp_2;
if ((int)c == 'y') initBoard(board);
......@@ -1175,7 +1174,7 @@ int main(int argc, char **argv)
}
}
setBufferedInput((_Bool)1);
printf_va_34("\033[?25h\033[m");
printf("\033[?25h\033[m"); /* printf_va_34 */
__retres = 0;
return __retres;
}
......
......@@ -34,7 +34,7 @@ static void validate_addr_form(char *v)
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-0123456789.");
tmp_0 = strlen((char const *)v);
if (tmp < tmp_0) {
fprintf_va_1(__fc_stderr,"hostname contains invalid characters");
fprintf(__fc_stderr,"hostname contains invalid characters"); /* fprintf_va_1 */
exit(1);
}
return;
......
......@@ -34,7 +34,7 @@ static void validate_addr_form(char *v)
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-0123456789.");
tmp_0 = strlen((char const *)v);
if (tmp < tmp_0) {
fprintf_va_1(__fc_stderr,"hostname contains invalid characters");
fprintf(__fc_stderr,"hostname contains invalid characters"); /* fprintf_va_1 */
exit(1);
}
return;
......
......@@ -109,16 +109,16 @@ int main(void)
int n;
int error;
board_square_t *board;
printf_va_1("Please specify the board height: \n");
error = scanf_va_1("%d",& m);
printf("Please specify the board height: \n"); /* printf_va_1 */
error = scanf("%d",& m); /* scanf_va_1 */
if (-1 == error) {
fprintf_va_1(__fc_stderr,"No integer passed: Die evil hacker!\n");
fprintf(__fc_stderr,"No integer passed: Die evil hacker!\n"); /* fprintf_va_1 */
exit(1);
}
printf_va_2("Please specify the board width: \n");
error = scanf_va_2("%d",& n);
printf("Please specify the board width: \n"); /* printf_va_2 */
error = scanf("%d",& n); /* scanf_va_2 */
if (-1 == error) {
fprintf_va_2(__fc_stderr,"No integer passed: Die evil hacker!\n");
fprintf(__fc_stderr,"No integer passed: Die evil hacker!\n"); /* fprintf_va_2 */
exit(1);
}
if (m > 100) goto _LOR;
......@@ -126,7 +126,7 @@ int main(void)
if (n > 100) {
_LOR:
{
fprintf_va_3(__fc_stderr,"Value too large: Die evil hacker!\n");
fprintf(__fc_stderr,"Value too large: Die evil hacker!\n"); /* fprintf_va_3 */
exit(1);
}
}
......
......@@ -109,16 +109,16 @@ int main(void)
int n;
int error;
board_square_t *board;
printf_va_1("Please specify the board height: \n");
error = scanf_va_1("%d",& m);
printf("Please specify the board height: \n"); /* printf_va_1 */
error = scanf("%d",& m); /* scanf_va_1 */
if (-1 == error) {
fprintf_va_1(__fc_stderr,"No integer passed: Die evil hacker!\n");
fprintf(__fc_stderr,"No integer passed: Die evil hacker!\n"); /* fprintf_va_1 */
exit(1);
}
printf_va_2("Please specify the board width: \n");
error = scanf_va_2("%d",& n);
printf("Please specify the board width: \n"); /* printf_va_2 */
error = scanf("%d",& n); /* scanf_va_2 */
if (-1 == error) {
fprintf_va_2(__fc_stderr,"No integer passed: Die evil hacker!\n");
fprintf(__fc_stderr,"No integer passed: Die evil hacker!\n"); /* fprintf_va_2 */
exit(1);
}
if (m > 100) goto _LOR;
......@@ -126,7 +126,7 @@ int main(void)
if (n > 100) {
_LOR:
{
fprintf_va_3(__fc_stderr,"Value too large: Die evil hacker!\n");
fprintf(__fc_stderr,"Value too large: Die evil hacker!\n"); /* fprintf_va_3 */
exit(1);
}
}
......
......@@ -32,7 +32,7 @@ int main(void)
int a;
bf.a1 = (int)1;
a = (int)bf.a1;
printf_va_1("a=%i\n",a);
printf("a=%i\n",a); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -32,7 +32,7 @@ int main(void)
unsigned int a;
bf.a1 = (unsigned int)1;
a = (unsigned int)bf.a1;
printf_va_1("a=%u\n",a);
printf("a=%u\n",a); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -57,13 +57,13 @@ int main(void)
int tmp;
char const *tmp_0;
int tmp_1;
printf_va_1("status=0x%x\n",(unsigned int)status);
printf("status=0x%x\n",(unsigned int)status); /* printf_va_1 */
status = set(status,0);
tmp = isset(status,0);
_Bool b = (_Bool)(tmp != 0);
if (b) tmp_0 = "true"; else tmp_0 = "false";
;
printf_va_2("status=0x%x b=%s\n",(unsigned int)status,(char *)tmp_0);
printf("status=0x%x b=%s\n",(unsigned int)status,(char *)tmp_0); /* printf_va_2 */
tmp_1 = isset(status,0);
return tmp_1;
}
......
......@@ -34,7 +34,7 @@ int main(void)
int *pi = & s.i;
st *p = (st *)pi;
p->f = (float)2.0;
printf_va_1("s.f=%f p->f=%f\n",(double)s.f,(double)p->f);
printf("s.f=%f p->f=%f\n",(double)s.f,(double)p->f); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -37,7 +37,7 @@ int main(void)
unsigned char *pcf = (pci - 4U) + 0U;
float *pf = (float *)pcf;
*pf = (float)2.0;
printf_va_1("s.f=%f *pf=%f s.i=%i\n",(double)s.f,(double)*pf,s.i);
printf("s.f=%f *pf=%f s.i=%i\n",(double)s.f,(double)*pf,s.i); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -38,7 +38,7 @@ int main(void)
st1 s1 = {.i1 = 1, .f1 = (float)1.0};
st2 *p2 = (st2 *)(& s1);
p2->f2 = (float)2.0;
printf_va_1("s1.f1=%f p2->f2=%f\n",(double)s1.f1,(double)p2->f2);
printf("s1.f1=%f p2->f2=%f\n",(double)s1.f1,(double)p2->f2); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -42,7 +42,7 @@ int main(void)
st1 s1 = {.i1 = 1, .f1 = (float)1.0, .c1 = (char)'a', .d1 = 1.0};
st2 *p2 = (st2 *)(& s1);
p2->f2 = (float)2.0;
printf_va_1("s1.f1=%f p2->f2=%f\n",(double)s1.f1,(double)p2->f2);
printf("s1.f1=%f p2->f2=%f\n",(double)s1.f1,(double)p2->f2); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -34,7 +34,7 @@ int main(void)
int *pi = & u.i;
un *p = (un *)pi;
p->f = (float)2.0;
printf_va_1("u.f=%f p->f=%f\n",(double)u.f,(double)p->f);
printf("u.f=%f p->f=%f\n",(double)u.f,(double)p->f); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -30,7 +30,7 @@ int main(void)
int const *p = (int const *)(& x);
int *q = (int *)p;
*q = 1;
printf_va_1("x=%i *p=%i *q=%i\n",x,*p,*q);
printf("x=%i *p=%i *q=%i\n",x,*p,*q); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -38,8 +38,7 @@ int main(void)
char *pcst = pcj - (8U - 0U);
st *ps = (st *)pcst;
ps->f = (float)22.0;
printf_va_1("s.i=%i s.f=%f s.j=%i ps->f=%f\n",s.i,(double)s.f,s.j,
(double)ps->f);
printf("s.i=%i s.f=%f s.j=%i ps->f=%f\n",s.i,(double)s.f,s.j,(double)ps->f); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -30,7 +30,7 @@ int main(void)
int *q = p + 11;
q -= 10;
*q = 1;
printf_va_1("x[1]=%i *q=%i\n",x[1],*q);
printf("x[1]=%i *q=%i\n",x[1],*q); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -31,8 +31,8 @@ int main(void)
unsigned char *q = p + 11;
q -= 10;
*q = (unsigned char)1;
printf_va_1("x=0x%x *p=0x%x *q=0x%x\n",(unsigned int)x,
(unsigned int)((int)*p),(unsigned int)((int)*q));
printf("x=0x%x *p=0x%x *q=0x%x\n",(unsigned int)x,
(unsigned int)((int)*p),(unsigned int)((int)*q)); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -31,7 +31,7 @@ int main(void)
uintptr_t ql = (unsigned int)px;
int *q = (int *)ql;
*q = 1;
printf_va_1("x=%i *px=%i *q=%i\n",x,*px,*q);
printf("x=%i *px=%i *q=%i\n",x,*px,*q); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -31,7 +31,7 @@ int main(void)
unsigned long ql = (unsigned long)px;
int *q = (int *)ql;
*q = 1;
printf_va_1("x=%i *px=%i *q=%i\n",x,*px,*q);
printf("x=%i *px=%i *q=%i\n",x,*px,*q); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
......@@ -33,7 +33,7 @@ int main(void)
ql -= (uintptr_t)287343;
int *q = (int *)ql;
*q = 1;
printf_va_1("x=%i *px=%i *q=%i\n",x,*px,*q);
printf("x=%i *px=%i *q=%i\n",x,*px,*q); /* printf_va_1 */
__retres = 0;
return __retres;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment