1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| uint8_t addfield_parse_uint8(char *s);
uint16_t addfield_parse_uint16(char *s);
uint32_t addfield_parse_uint32(char *s);
uint64_t addfield_parse_uint64(char *s);
uint8_t addfield_parse_uint8(char *s){
uint8_t i; char c; int res;
if(s[0] != '0' || s[1] == '\0')
res = sscanf(s,"%""hhu""%c",&i,&c);
else if(s[1] == 'x' || s[1] == 'X') res = sscanf(s + 2,"%"SCNx8 "%c",&i,&c);
else res = sscanf(s + 1,"%"SCNo8 "%c",&i,&c);
if(res != 1) gep_erreur_full(1 , "D:\\workspace\\gliss\\src\\gep\\gep_addfield.c",129,"Cannot see an uint""8"" in '%s`\n",s);
return i;};
uint16_t addfield_parse_uint16(char *s){ uint16_t i; char c; int res; if(s[0] != '0' || s[1] == '\0') res = sscanf(s,"%""hu""%c",&i,&c); else if(s[1] == 'x' || s[1] == 'X') res = sscanf(s + 2,"%""hx""%c",&i,&c); else res = sscanf(s + 1,"%""ho""%c",&i,&c); if(res != 1) gep_erreur_full(1 , "D:\\workspace\\gliss\\src\\gep\\gep_addfield.c",130,"Cannot see an uint""16"" in '%s`\n",s); return i;};
uint32_t addfield_parse_uint32(char *s){ uint32_t i; char c; int res; if(s[0] != '0' || s[1] == '\0') res = sscanf(s,"%""u""%c",&i,&c); else if(s[1] == 'x' || s[1] == 'X') res = sscanf(s + 2,"%""x""%c",&i,&c); else res = sscanf(s + 1,"%""o""%c",&i,&c); if(res != 1) gep_erreur_full(1 , "D:\\workspace\\gliss\\src\\gep\\gep_addfield.c",131,"Cannot see an uint""32"" in '%s`\n",s); return i;};
uint64_t addfield_parse_uint64(char *s){ uint64_t i; char c; int res; if(s[0] != '0' || s[1] == '\0') res = sscanf(s,"%""I64u""%c",&i,&c); else if(s[1] == 'x' || s[1] == 'X') res = sscanf(s + 2,"%""I64x""%c",&i,&c); else res = sscanf(s + 1,"%""I64o""%c",&i,&c); if(res != 1) gep_erreur_full(1 , "D:\\workspace\\gliss\\src\\gep\\gep_addfield.c",132,"Cannot see an uint""64"" in '%s`\n",s); return i;}; |
Partager