id stringlengths 21 132 | codebase stringclasses 57
values | c_file stringlengths 3 108 | function stringlengths 3 74 | sloc stringclasses 134
values | c_code stringlengths 25 52.1k | c_constructs dict |
|---|---|---|---|---|---|---|
transcoder-set#PROGRAM_FOR_SURFACE_AREA_OF_OCTAHEDRON_prep#max.c | transcoder-set | PROGRAM_FOR_SURFACE_AREA_OF_OCTAHEDRON.c | max | 1 | int max(int x, int y) { return (x > y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
optipng-0.7.8#png_prep#png_init_io.c | optipng-0.7.8 | png.c | png_init_io | 8 | void
png_init_io(png_structrp png_ptr, png_FILE_p fp)
{
((void)0);
if (png_ptr == ((void *)0))
return;
png_ptr->io_ptr = (png_voidp)fp;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlunicode_prep#xmlUCSIsTibetan.c | libxml2 | xmlunicode.c | xmlUCSIsTibetan | 4 | int
xmlUCSIsTibetan(int code) {
return(((code >= 0x0F00) && (code <= 0x0FFF)));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
screen-4.9.0#logfile_prep#logfflush.c | screen-4.9.0 | logfile.c | logfflush | 19 | int logfflush(struct logfile *l) {
int r = 0;
if (!l)
for (l = logroot; l; l = l->next) {
if (stolen_logfile(l) && lf_reopen_fn(l->name, fileno(l->fp), l))
return -1;
r |= fflush(l->fp);
l->flushcount++;
changed_logfile(l);
}
else {
if (stolen_logfile(l) && lf_reopen_fn(l->name, fileno(l->fp), l))
return -1;
r = fflush(l->fp);
l->flushcount++;
changed_logfile(l);
}
return r;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#SUM_NODES_K_TH_LEVEL_TREE_REPRESENTED_STRING_prep#f_gold.c | transcoder-set | SUM_NODES_K_TH_LEVEL_TREE_REPRESENTED_STRING.c | f_gold | 15 | int f_gold ( char tree [], int k ) {
int level = - 1;
int sum = 0;
int n = strlen(tree);
for ( int i = 0;
i < n;
i ++ ) {
if ( tree [ i ] == '(' ) level ++;
else if ( tree [ i ] == ')' ) level --;
else {
if ( level == k ) sum += ( tree [ i ] - '0' );
}
}
return sum;
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#error_prep#xmlParserValidityWarning.c | libxml2 | error.c | xmlParserValidityWarning | 8 | void
xmlParserValidityWarning(void *ctx, const char *msg __attribute__((unused)), ...)
{
va_list ap;
__builtin_va_start(ap,msg);
xmlVFormatLegacyError(ctx, "validity warning", msg, ap);
__builtin_va_end(ap);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#CHECK_IF_X_CAN_GIVE_CHANGE_TO_EVERY_PERSON_IN_THE_QUEUE_prep#f_filled.c | transcoder-set | CHECK_IF_X_CAN_GIVE_CHANGE_TO_EVERY_PERSON_IN_THE_QUEUE.c | f_filled | 1 | int f_filled ( int notes [ ], int n ) {}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#gosthash94_prep#nettle_gosthash94cp_update.c | nettle-3.9.1 | gosthash94.c | nettle_gosthash94cp_update | 7 | void
nettle_gosthash94cp_update (struct gosthash94_ctx *ctx,
size_t length, const uint8_t *msg)
{
gosthash94_update_int (ctx, length, msg,
_nettle_gost28147_param_CryptoPro_3411.sbox);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
optipng-0.7.8#pngwutil_prep#png_save_uint_16.c | optipng-0.7.8 | pngwutil.c | png_save_uint_16 | 6 | void
png_save_uint_16(png_bytep buf, unsigned int i)
{
buf[0] = (png_byte)((i >> 8) & 0xffU);
buf[1] = (png_byte)( i & 0xffU);
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
rcs-5.10.1#partime_prep#partime.c | rcs-5.10.1 | partime.c | partime | 19 | char const*
partime (char const *s, struct partime *t)
{
struct partime p;
undefine (t);
while (*s)
{
int i = 0;
char const *s1;
do
{
if (!(s1 = parse_prefix (s, &p, &i)))
return s;
}
while ((0 > (merge_partime (t, &p))));
s = s1;
}
return s;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 2
} |
gawk-5.2.2#awkgram_prep#yyparse.c | gawk-5.2.2 | awkgram.c | yyparse | 1947 | int
yyparse (void)
{
yy_state_fast_t yystate = 0;
int yyerrstatus = 0;
long int yystacksize = 200;
yy_state_t yyssa[200];
yy_state_t *yyss = yyssa;
yy_state_t *yyssp = yyss;
INSTRUCTION * yyvsa[200];
INSTRUCTION * *yyvs = yyvsa;
INSTRUCTION * *yyvsp = yyvs;
int yyn;
int yyresult;
yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
INSTRUCTION * yyval;
int yylen = 0;
((void) 0);
yychar = -2;
goto yysetstate;
yynewstate:
yyssp++;
yysetstate:
((void) 0);
((void) (0 && (0 <= yystate && yystate < 356)));
*yyssp = ((yy_state_t) (yystate));
;
if (yyss + yystacksize - 1 <= yyssp)
{
long int yysize = yyssp - yyss + 1;
if (10000 <= yystacksize)
goto yyexhaustedlab;
yystacksize *= 2;
if (10000 < yystacksize)
yystacksize = 10000;
{
yy_state_t *yyss1 = yyss;
union yyalloc *yyptr =
((union yyalloc *) (pma_malloc (((long unsigned int) (((yystacksize) * (((long int) (sizeof (yy_state_t))) + ((long int) (sizeof (INSTRUCTION *)))) + (((long int) (sizeof (union yyalloc))) - 1)))))));
if (! yyptr)
goto yyexhaustedlab;
do { long int yynewbytes; __builtin_memcpy (&yyptr->yyss_alloc, yyss, ((long unsigned int) ((yysize))) * sizeof (*(yyss))); yyss = &yyptr->yyss_alloc; yynewbytes = yystacksize * ((long int) (sizeof (*yyss))) + (((long int) (sizeof (union yyalloc))) - 1); yyptr += yynewbytes / ((long int) (sizeof (*yyptr))); } while (0);
do { long int yynewbytes; __builtin_memcpy (&yyptr->yyvs_alloc, yyvs, ((long unsigned int) ((yysize))) * sizeof (*(yyvs))); yyvs = &yyptr->yyvs_alloc; yynewbytes = yystacksize * ((long int) (sizeof (*yyvs))) + (((long int) (sizeof (union yyalloc))) - 1); yyptr += yynewbytes / ((long int) (sizeof (*yyptr))); } while (0);
if (yyss1 != yyssa)
pma_free (yyss1);
}
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
((void) 0);
if (yyss + yystacksize - 1 <= yyssp)
goto yyabortlab;
}
if (yystate == 2)
goto yyacceptlab;
goto yybackup;
yybackup:
yyn = yypact[yystate];
if (((yyn) == (-276)))
goto yydefault;
if (yychar == -2)
{
((void) 0);
yychar = yylex ();
}
if (yychar <= 0)
{
yychar = 0;
yytoken = YYSYMBOL_YYEOF;
((void) 0);
}
else if (yychar == 256)
{
yychar = 257;
yytoken = YYSYMBOL_YYerror;
goto yyerrlab1;
}
else
{
yytoken = (0 <= (yychar) && (yychar) <= 310 ? ((yysymbol_kind_t) (yytranslate[yychar])) : YYSYMBOL_YYUNDEF);
;
}
yyn += yytoken;
if (yyn < 0 || 1200 < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (((yyn) == (-119)))
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
if (yyerrstatus)
yyerrstatus--;
;
yystate = yyn;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
*++yyvsp = yylval;
#pragma GCC diagnostic pop
yychar = -2;
goto yynewstate;
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
yyreduce:
yylen = yyr2[yyn];
yyval = yyvsp[1-yylen];
;
switch (yyn)
{
case 2:
{ yyval = ((void *)0); }
break;
case 3:
{
rule = 0;
(yyerrstatus = 0);
}
break;
case 4:
{
if (yyvsp[0] != ((void *)0)) {
if (yyvsp[-1] == ((void *)0))
outer_comment = yyvsp[0];
else
interblock_comment = yyvsp[0];
}
yyval = yyvsp[-1];
}
break;
case 5:
{
next_sourcefile();
}
break;
case 6:
{
rule = 0;
}
break;
case 7:
{
(void) append_rule(yyvsp[-1], yyvsp[0]);
if (pending_comment != ((void *)0)) {
interblock_comment = pending_comment;
pending_comment = ((void *)0);
}
}
break;
case 8:
{
if (rule != Rule) {
msg(gettext("%s blocks must have an action part"), ruletab[rule]);
errcount++;
} else if (yyvsp[-1] == ((void *)0)) {
msg(gettext("each rule must have a pattern or an action part"));
errcount++;
} else {
if (yyvsp[0] != ((void *)0))
list_append(yyvsp[-1], yyvsp[0]);
(void) append_rule(yyvsp[-1], ((void *)0));
}
}
break;
case 9:
{
in_function = 0;
(void) mk_function(yyvsp[-1], yyvsp[0]);
want_param_names = DONT_CHECK;
if (pending_comment != ((void *)0)) {
interblock_comment = pending_comment;
pending_comment = ((void *)0);
}
(yyerrstatus = 0);
}
break;
case 10:
{
want_source = 0;
at_seen--;
if (yyvsp[-1] != ((void *)0) && yyvsp[0] != ((void *)0)) {
SRCFILE *s = (SRCFILE *) yyvsp[-1];
s->comment = yyvsp[0];
}
(yyerrstatus = 0);
}
break;
case 11:
{
want_source = 0;
at_seen--;
if (yyvsp[-1] != ((void *)0) && yyvsp[0] != ((void *)0)) {
SRCFILE *s = (SRCFILE *) yyvsp[-1];
s->comment = yyvsp[0];
}
(yyerrstatus = 0);
}
break;
case 12:
{
want_source = 0;
want_namespace = 0;
at_seen--;
set_namespace(yyvsp[-1], yyvsp[0]);
(yyerrstatus = 0);
}
break;
case 13:
{
void *srcfile = ((void *)0);
if (! include_source(yyvsp[0], & srcfile))
goto yyabortlab;
pma_free(yyvsp[0]->d.name);
bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile;
}
break;
case 14:
{ yyval = ((void *)0); }
break;
case 15:
{ yyval = ((void *)0); }
break;
case 16:
{
void *srcfile;
if (! load_library(yyvsp[0], & srcfile))
goto yyabortlab;
pma_free(yyvsp[0]->d.name);
bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile;
}
break;
case 17:
{ yyval = ((void *)0); }
break;
case 18:
{ yyval = ((void *)0); }
break;
case 19:
{ yyval = yyvsp[0]; }
break;
case 20:
{ yyval = ((void *)0); }
break;
case 21:
{ yyval = ((void *)0); }
break;
case 22:
{
rule = Rule;
yyval = ((void *)0);
}
break;
case 23:
{
rule = Rule;
}
break;
case 24:
{
INSTRUCTION *tp;
add_lint(yyvsp[-2], LINT_assign_in_cond);
add_lint(yyvsp[0], LINT_assign_in_cond);
tp = bcalloc(Op_no_op, 1, 0);
list_prepend(yyvsp[-2], bcalloc(Op_line_range, !!(do_flags & DO_PRETTY_PRINT) + 1, 0));
yyvsp[-2]->nexti->x.xl = 0;
yyvsp[-2]->nexti->d.di = yyvsp[0]->nexti;
list_append(yyvsp[-2], bcalloc(Op_cond_pair, 1, 0));
yyvsp[-2]->d.di->x.xi = yyvsp[-2]->nexti;
yyvsp[-2]->d.di->d.di = tp;
list_append(yyvsp[0], bcalloc(Op_cond_pair, 1, 0));
yyvsp[0]->d.di->x.xi = yyvsp[-2]->nexti;
yyvsp[0]->d.di->d.di = tp;
if ((do_flags & DO_PRETTY_PRINT)) {
(yyvsp[-2]->nexti + 1)->d.di = yyvsp[-2]->d.di;
(yyvsp[-2]->nexti + 1)->x.xi = yyvsp[0]->d.di;
}
if (yyvsp[-1] != ((void *)0))
yyval = list_append(list_merge(list_prepend(yyvsp[-2], yyvsp[-1]), yyvsp[0]), tp);
else
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), tp);
rule = Rule;
}
break;
case 25:
{
static int begin_seen = 0;
if ((do_flags & DO_LINT_OLD) && ++begin_seen == 2)
lintwarn_ln(yyvsp[0]->source_line,
gettext("old awk does not support multiple `BEGIN' or `END' rules"));
yyvsp[0]->x.xl = rule = BEGIN;
yyvsp[0]->d.name = source;
yyval = yyvsp[0];
}
break;
case 26:
{
static int end_seen = 0;
if ((do_flags & DO_LINT_OLD) && ++end_seen == 2)
lintwarn_ln(yyvsp[0]->source_line,
gettext("old awk does not support multiple `BEGIN' or `END' rules"));
yyvsp[0]->x.xl = rule = END;
yyvsp[0]->d.name = source;
yyval = yyvsp[0];
}
break;
case 27:
{
yyvsp[0]->x.xl = rule = BEGINFILE;
yyvsp[0]->d.name = source;
yyval = yyvsp[0];
}
break;
case 28:
{
yyvsp[0]->x.xl = rule = ENDFILE;
yyvsp[0]->d.name = source;
yyval = yyvsp[0];
}
break;
case 29:
{
INSTRUCTION *ip = make_braced_statements(yyvsp[-4], yyvsp[-3], yyvsp[-2]);
if (yyvsp[-2] != ((void *)0) && yyvsp[0] != ((void *)0)) {
merge_comments(yyvsp[-2], yyvsp[0]);
pending_comment = yyvsp[-2];
} else if (yyvsp[-2] != ((void *)0)) {
pending_comment = yyvsp[-2];
} else if (yyvsp[0] != ((void *)0)) {
pending_comment = yyvsp[0];
}
yyval = ip;
}
break;
case 31:
{
const char *name = yyvsp[0]->d.name;
char *qname = qualify_name(name, strlen(name));
if (qname != name) {
pma_free((void *)name);
yyvsp[0]->d.name = qname;
}
yyval = yyvsp[0];
}
break;
case 32:
{
yyerror(gettext("`%s' is a built-in function, it cannot be redefined"),
tokstart);
goto yyabortlab;
}
break;
case 33:
{
yyval = yyvsp[0];
at_seen--;
}
break;
case 36:
{ want_param_names = FUNC_HEADER; }
break;
case 37:
{
INSTRUCTION *func_comment = ((void *)0);
if (yyvsp[-2] != ((void *)0) && yyvsp[-2]->comment != ((void *)0)) {
if (yyvsp[0] != ((void *)0)) {
merge_comments(yyvsp[-2]->comment, yyvsp[0]);
}
func_comment = yyvsp[-2]->comment;
} else if (yyvsp[0] != ((void *)0)) {
func_comment = yyvsp[0];
}
yyvsp[-6]->d.name = source;
yyvsp[-6]->comment = func_comment;
if (install_function(yyvsp[-5]->d.name, yyvsp[-6], yyvsp[-2]) < 0)
goto yyabortlab;
in_function = 1;
yyvsp[-5]->d.name = ((void *)0);
bcfree(yyvsp[-5]);
yyval = yyvsp[-6];
want_param_names = FUNC_BODY;
}
break;
case 38:
{ want_regexp = 1; }
break;
case 39:
{
NODE *n, *exp;
char *re;
size_t len;
re = yyvsp[0]->d.name;
yyvsp[0]->d.name = ((void *)0);
len = strlen(re);
if ((do_flags & (DO_LINT_INVALID|DO_LINT_ALL))) {
if (len == 0)
lintwarn_ln(yyvsp[0]->source_line,
gettext("regexp constant `//' looks like a C++ comment, but is not"));
else if (re[0] == '*' && re[len-1] == '*')
lintwarn_ln(yyvsp[0]->source_line,
gettext("regexp constant `/%s/' looks like a C comment, but is not"), re);
}
exp = make_str_node(re, len, 2);
n = make_regnode(Node_regex, exp);
if (n == ((void *)0)) {
unref(exp);
goto yyabortlab;
}
yyval = yyvsp[0];
yyval->opcode = Op_match_rec;
yyval->d.dn = n;
}
break;
case 40:
{
char *re;
size_t len;
re = yyvsp[0]->d.name;
yyvsp[0]->d.name = ((void *)0);
len = strlen(re);
yyval = yyvsp[0];
yyval->opcode = Op_push_re;
yyval->d.dn = make_typed_regex(re, len);
}
break;
case 41:
{ bcfree(yyvsp[0]); }
break;
case 43:
{ yyval = ((void *)0); }
break;
case 44:
{
if (yyvsp[0] == ((void *)0)) {
yyval = yyvsp[-1];
} else {
add_lint(yyvsp[0], LINT_no_effect);
if (yyvsp[-1] == ((void *)0)) {
yyval = yyvsp[0];
} else {
yyval = list_merge(yyvsp[-1], yyvsp[0]);
}
}
if (trailing_comment != ((void *)0)) {
yyval = list_append(yyval, trailing_comment);
trailing_comment = ((void *)0);
}
(yyerrstatus = 0);
}
break;
case 45:
{ yyval = ((void *)0); }
break;
case 46:
{ yyval = yyvsp[0]; }
break;
case 47:
{ yyval = yyvsp[0]; }
break;
case 48:
{
if (yyvsp[0] != ((void *)0)) {
INSTRUCTION *ip;
merge_comments(yyvsp[0], ((void *)0));
ip = list_create(bcalloc(Op_no_op, 1, 0));
yyval = list_append(ip, yyvsp[0]);
} else
yyval = ((void *)0);
}
break;
case 49:
{
trailing_comment = yyvsp[0];
yyval = make_braced_statements(yyvsp[-2], yyvsp[-1], yyvsp[0]);
}
break;
case 50:
{
if ((do_flags & DO_PRETTY_PRINT))
yyval = list_prepend(yyvsp[0], bcalloc(Op_exec_count, 1, 0));
else
yyval = yyvsp[0];
}
break;
case 51:
{
INSTRUCTION *dflt, *curr = ((void *)0), *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
const char **case_values = ((void *)0);
int maxcount = 128;
int case_count = 0;
int i;
tbreak = bcalloc(Op_no_op, 1, 0);
cstmt = list_create(tbreak);
cexp = list_create(bcalloc(Op_pop, 1, 0));
dflt = bcalloc(Op_jmp, 1, 0);
dflt->d.di = tbreak;
if (yyvsp[-2] != ((void *)0)) {
curr = yyvsp[-2]->nexti;
bcfree(yyvsp[-2]);
}
for (; curr != ((void *)0); curr = nextc) {
INSTRUCTION *caseexp = curr->d.di;
INSTRUCTION *casestmt = curr->x.xi;
nextc = curr->nexti;
if (curr->opcode == Op_K_case) {
if (caseexp->opcode == Op_push_i) {
char *caseval;
caseval = force_string_fmt((caseexp->d.dn), CONVFMT, CONVFMTidx)->sub.val.sp;
for (i = 0; i < case_count; i++) {
if (strcmp(caseval, case_values[i]) == 0)
error_ln(curr->source_line,
gettext("duplicate case values in switch body: %s"), caseval);
}
if (case_values == ((void *)0))
(void) (case_values = (const char **) emalloc_real((size_t)(sizeof(char *) * maxcount), "statement", "case_values", "awkgram.y", 699));
else if (case_count >= maxcount) {
maxcount += 128;
(void) (case_values = (const char **) erealloc_real((void *) case_values, (size_t)(sizeof(char*) * maxcount), "statement", "case_values", "awkgram.y", 702));
}
case_values[case_count++] = caseval;
} else {
(curr + 1)->x.xl = 1;
}
curr->d.di = casestmt->nexti;
curr->x.xi = casestmt->d.di;
(void) list_prepend(cexp, curr);
(void) list_prepend(cexp, caseexp);
} else {
if (dflt->d.di != tbreak)
error_ln(curr->source_line,
gettext("duplicate `default' detected in switch body"));
else
dflt->d.di = casestmt->nexti;
if ((do_flags & DO_PRETTY_PRINT)) {
curr->d.di = casestmt->nexti;
curr->x.xi = casestmt->d.di;
(void) list_prepend(cexp, curr);
} else
bcfree(curr);
}
cstmt = list_merge(casestmt, cstmt);
}
if (case_values != ((void *)0))
pma_free(case_values);
ip = yyvsp[-6];
if ((do_flags & DO_PRETTY_PRINT)) {
INSTRUCTION *head_comment = ((void *)0);
if (yyvsp[-4] != ((void *)0) && yyvsp[-3] != ((void *)0)) {
merge_comments(yyvsp[-4], yyvsp[-3]);
head_comment = yyvsp[-4];
} else if (yyvsp[-4] != ((void *)0))
head_comment = yyvsp[-4];
else
head_comment = yyvsp[-3];
yyvsp[-8]->comment = head_comment;
(void) list_prepend(ip, yyvsp[-8]);
(void) list_prepend(ip, bcalloc(Op_exec_count, 1, 0));
yyvsp[-8]->x.xi = tbreak;
(yyvsp[-8] + 1)->d.di = cexp->nexti;
(yyvsp[-8] + 1)->x.xi = cexp->d.di;
(yyvsp[-8] + 1)->x.xi->comment = yyvsp[0];
}
(void) list_append(cexp, dflt);
(void) list_merge(ip, cexp);
if (yyvsp[-1] != ((void *)0))
(void) list_append(cstmt, yyvsp[-1]);
yyval = list_merge(ip, cstmt);
break_allowed--;
fix_break_continue(ip, tbreak, ((void *)0));
}
break;
case 52:
{
INSTRUCTION *ip, *tbreak, *tcont;
tbreak = bcalloc(Op_no_op, 1, 0);
add_lint(yyvsp[-3], LINT_assign_in_cond);
tcont = yyvsp[-3]->nexti;
ip = list_append(yyvsp[-3], bcalloc(Op_jmp_false, 1, 0));
ip->d.di->d.di = tbreak;
if ((do_flags & DO_PRETTY_PRINT)) {
(void) list_append(ip, bcalloc(Op_exec_count, 1, 0));
yyvsp[-5]->x.xi = tbreak;
yyvsp[-5]->d.di = tcont;
(yyvsp[-5] + 1)->d.di = ip->d.di;
(void) list_prepend(ip, yyvsp[-5]);
}
if (yyvsp[-1] != ((void *)0)) {
if (yyvsp[0] == ((void *)0))
yyvsp[0] = list_create(bcalloc(Op_no_op, 1, 0));
yyvsp[-1]->d.dn->sub.val.comtype = BLOCK_COMMENT;
yyvsp[0] = list_prepend(yyvsp[0], yyvsp[-1]);
}
if (yyvsp[0] != ((void *)0))
(void) list_merge(ip, yyvsp[0]);
(void) list_append(ip, bcalloc(Op_jmp, 1, 0));
ip->d.di->d.di = tcont;
yyval = list_append(ip, tbreak);
break_allowed--;
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
break;
case 53:
{
INSTRUCTION *ip, *tbreak, *tcont;
tbreak = bcalloc(Op_no_op, 1, 0);
tcont = yyvsp[-2]->nexti;
add_lint(yyvsp[-2], LINT_assign_in_cond);
if (yyvsp[-5] != ((void *)0))
ip = list_merge(yyvsp[-5], yyvsp[-2]);
else
ip = list_prepend(yyvsp[-2], bcalloc(Op_no_op, 1, 0));
if (yyvsp[-6] != ((void *)0))
(void) list_prepend(ip, yyvsp[-6]);
if ((do_flags & DO_PRETTY_PRINT))
(void) list_prepend(ip, bcalloc(Op_exec_count, 1, 0));
(void) list_append(ip, bcalloc(Op_jmp_true, 1, 0));
ip->d.di->d.di = ip->nexti;
yyval = list_append(ip, tbreak);
break_allowed--;
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
if ((do_flags & DO_PRETTY_PRINT)) {
yyvsp[-7]->x.xi = tbreak;
yyvsp[-7]->d.di = tcont;
(yyvsp[-7] + 1)->d.di = tcont;
yyval = list_prepend(ip, yyvsp[-7]);
bcfree(yyvsp[-4]);
if (yyvsp[0] != ((void *)0))
yyvsp[-7]->comment = yyvsp[0];
}
}
break;
case 54:
{
INSTRUCTION *ip;
char *var_name = yyvsp[-5]->d.name;
if (yyvsp[0] != ((void *)0)
&& yyvsp[0]->d.di->opcode == Op_K_delete
&& yyvsp[0]->d.di->x.xl == 1
&& yyvsp[0]->nexti->opcode == Op_push
&& (yyvsp[0]->nexti->d.dn->type != Node_var || !(yyvsp[0]->nexti->d.dn->sub.nodep.r.uptr))
&& strcmp(yyvsp[0]->nexti->d.dn->sub.nodep.name, var_name) == 0
) {
NODE *arr = ((void *)0);
ip = yyvsp[0]->nexti->nexti;
if (yyvsp[-3]->nexti->opcode == Op_push && yyvsp[-3]->d.di == yyvsp[-3]->nexti)
arr = yyvsp[-3]->nexti->d.dn;
if (arr != ((void *)0)
&& ip->opcode == Op_no_op
&& ip->nexti->opcode == Op_push_array
&& strcmp(ip->nexti->d.dn->sub.nodep.name, arr->sub.nodep.name) == 0
&& ip->nexti->nexti == yyvsp[0]->d.di
) {
(void) make_assignable(yyvsp[0]->nexti);
yyvsp[0]->d.di->opcode = Op_K_delete_loop;
yyvsp[0]->d.di->x.xl = 0;
if (yyvsp[-7] != ((void *)0))
bcfree(yyvsp[-7]);
pma_free(var_name);
bcfree(yyvsp[-5]);
bcfree(yyvsp[-4]);
bcfree(yyvsp[-3]);
if (yyvsp[-1] != ((void *)0)) {
merge_comments(yyvsp[-1], ((void *)0));
yyvsp[0] = list_prepend(yyvsp[0], yyvsp[-1]);
}
yyval = yyvsp[0];
} else
goto regular_loop;
} else {
INSTRUCTION *tbreak, *tcont;
regular_loop:
ip = yyvsp[-3];
ip->nexti->opcode = Op_push_array;
tbreak = bcalloc(Op_arrayfor_final, 1, 0);
yyvsp[-4]->opcode = Op_arrayfor_incr;
yyvsp[-4]->x.xn = variable(yyvsp[-5]->source_line, var_name, Node_var);
yyvsp[-4]->d.di = tbreak;
tcont = yyvsp[-4];
yyvsp[-5]->opcode = Op_arrayfor_init;
yyvsp[-5]->d.di = tbreak;
(void) list_append(ip, yyvsp[-5]);
if ((do_flags & DO_PRETTY_PRINT)) {
yyvsp[-7]->opcode = Op_K_arrayfor;
yyvsp[-7]->d.di = tcont;
yyvsp[-7]->x.xi = tbreak;
(void) list_append(ip, yyvsp[-7]);
}
if (yyvsp[-4]->x.xn->type == Node_var && yyvsp[-4]->x.xn->sub.nodep.r.uptr) {
(void) list_append(ip, bcalloc(Op_var_update, 1, 0));
ip->d.di->x.aptr = yyvsp[-4]->x.xn->sub.nodep.r.uptr;
}
(void) list_append(ip, yyvsp[-4]);
if (yyvsp[-4]->x.xn->type == Node_var && yyvsp[-4]->x.xn->sub.nodep.x.aptr) {
(void) list_append(ip, bcalloc(Op_var_assign, 1, 0));
ip->d.di->x.aptr = yyvsp[-4]->x.xn->sub.nodep.x.aptr;
}
if ((do_flags & DO_PRETTY_PRINT)) {
(void) list_append(ip, bcalloc(Op_exec_count, 1, 0));
(yyvsp[-7] + 1)->d.di = yyvsp[-4];
(yyvsp[-7] + 1)->x.xi = ip->d.di;
}
if (yyvsp[-1] != ((void *)0))
merge_comments(yyvsp[-1], ((void *)0));
if (yyvsp[0] != ((void *)0)) {
if (yyvsp[-1] != ((void *)0))
yyvsp[0] = list_prepend(yyvsp[0], yyvsp[-1]);
(void) list_merge(ip, yyvsp[0]);
} else if (yyvsp[-1] != ((void *)0))
(void) list_append(ip, yyvsp[-1]);
(void) list_append(ip, bcalloc(Op_jmp, 1, 0));
ip->d.di->d.di = yyvsp[-4];
yyval = list_append(ip, tbreak);
fix_break_continue(ip, tbreak, tcont);
}
break_allowed--;
continue_allowed--;
}
break;
case 55:
{
if (yyvsp[-7] != ((void *)0)) {
merge_comments(yyvsp[-7], ((void *)0));
yyvsp[-11]->comment = yyvsp[-7];
}
if (yyvsp[-4] != ((void *)0)) {
merge_comments(yyvsp[-4], ((void *)0));
if (yyvsp[-11]->comment == ((void *)0)) {
yyvsp[-4]->d.dn->sub.val.comtype = FOR_COMMENT;
yyvsp[-11]->comment = yyvsp[-4];
} else
yyvsp[-11]->comment->comment = yyvsp[-4];
}
if (yyvsp[-1] != ((void *)0))
yyvsp[0] = list_prepend(yyvsp[0], yyvsp[-1]);
add_lint(yyvsp[-6], LINT_assign_in_cond);
yyval = mk_for_loop(yyvsp[-11], yyvsp[-9], yyvsp[-6], yyvsp[-3], yyvsp[0]);
break_allowed--;
continue_allowed--;
}
break;
case 56:
{
if (yyvsp[-6] != ((void *)0)) {
merge_comments(yyvsp[-6], ((void *)0));
yyvsp[-10]->comment = yyvsp[-6];
}
if (yyvsp[-4] != ((void *)0)) {
merge_comments(yyvsp[-4], ((void *)0));
if (yyvsp[-10]->comment == ((void *)0)) {
yyvsp[-4]->d.dn->sub.val.comtype = FOR_COMMENT;
yyvsp[-10]->comment = yyvsp[-4];
} else
yyvsp[-10]->comment->comment = yyvsp[-4];
}
if (yyvsp[-1] != ((void *)0))
yyvsp[0] = list_prepend(yyvsp[0], yyvsp[-1]);
yyval = mk_for_loop(yyvsp[-10], yyvsp[-8], (INSTRUCTION *) ((void *)0), yyvsp[-3], yyvsp[0]);
break_allowed--;
continue_allowed--;
}
break;
case 57:
{
if ((do_flags & DO_PRETTY_PRINT))
yyval = list_prepend(yyvsp[0], bcalloc(Op_exec_count, 1, 0));
else
yyval = yyvsp[0];
}
break;
case 58:
{
if (! break_allowed)
error_ln(yyvsp[-1]->source_line,
gettext("`break' is not allowed outside a loop or switch"));
yyvsp[-1]->d.di = ((void *)0);
yyval = list_create(yyvsp[-1]);
if (yyvsp[0] != ((void *)0))
yyval = list_append(yyval, yyvsp[0]);
}
break;
case 59:
{
if (! continue_allowed)
error_ln(yyvsp[-1]->source_line,
gettext("`continue' is not allowed outside a loop"));
yyvsp[-1]->d.di = ((void *)0);
yyval = list_create(yyvsp[-1]);
if (yyvsp[0] != ((void *)0))
yyval = list_append(yyval, yyvsp[0]);
}
break;
case 60:
{
if (rule && rule != Rule)
error_ln(yyvsp[-1]->source_line,
gettext("`next' used in %s action"), ruletab[rule]);
yyvsp[-1]->d.di = ip_rec;
yyval = list_create(yyvsp[-1]);
if (yyvsp[0] != ((void *)0))
yyval = list_append(yyval, yyvsp[0]);
}
break;
case 61:
{
if (rule == BEGIN || rule == END || rule == ENDFILE)
error_ln(yyvsp[-1]->source_line,
gettext("`nextfile' used in %s action"), ruletab[rule]);
yyvsp[-1]->d.di = ip_newfile;
yyvsp[-1]->x.xi = ip_endfile;
yyval = list_create(yyvsp[-1]);
if (yyvsp[0] != ((void *)0))
yyval = list_append(yyval, yyvsp[0]);
}
break;
case 62:
{
yyvsp[-2]->d.di = ip_end;
yyvsp[-2]->x.xi = ip_atexit;
if (yyvsp[-1] == ((void *)0)) {
yyval = list_create(yyvsp[-2]);
(void) list_prepend(yyval, bcalloc(Op_push_i, 1, 0));
yyval->nexti->d.dn = dupnode(Nnull_string);
} else
yyval = list_append(yyvsp[-1], yyvsp[-2]);
if (yyvsp[0] != ((void *)0))
yyval = list_append(yyval, yyvsp[0]);
}
break;
case 63:
{
if (! in_function)
yyerror(gettext("`return' used outside function context"));
}
break;
case 64:
{
if (called_from_eval)
yyvsp[-3]->opcode = Op_K_return_from_eval;
if (yyvsp[-1] == ((void *)0)) {
yyval = list_create(yyvsp[-3]);
(void) list_prepend(yyval, bcalloc(Op_push_i, 1, 0));
yyval->nexti->d.dn = dupnode(Nnull_string);
} else
yyval = list_append(yyvsp[-1], yyvsp[-3]);
if (yyvsp[0] != ((void *)0))
yyval = list_append(yyval, yyvsp[0]);
}
break;
case 65:
{
if (yyvsp[0] != ((void *)0))
yyval = list_append(yyvsp[-1], yyvsp[0]);
else
yyval = yyvsp[-1];
}
break;
case 66:
{ in_print = 1; in_parens = 0; }
break;
case 67:
{
if (do_optimize && yyvsp[-3]->opcode == Op_K_print &&
(yyvsp[-1] == ((void *)0)
|| (yyvsp[-1]->d.di->opcode == Op_field_spec
&& yyvsp[-1]->nexti->nexti->nexti == yyvsp[-1]->d.di
&& yyvsp[-1]->nexti->nexti->opcode == Op_push_i
&& yyvsp[-1]->nexti->nexti->d.dn->type == Node_val)
)
) {
static _Bool warned = 0;
if (yyvsp[-1] != ((void *)0)) {
NODE *n = yyvsp[-1]->nexti->nexti->d.dn;
if ((n->flags & (STRING|STRCUR)) != 0 || ! (!(((n))->flags & (MPFN|MPZN)) ? (((n)->sub.val.nm.fltnum == 0.0)) : ((((n))->flags & MPFN) ? ((((mpfr_srcptr) (0 ? ((n)->sub.val.nm.mpnum) : (mpfr_srcptr) ((n)->sub.val.nm.mpnum)))->_mpfr_exp == (0 - ((mpfr_exp_t) (((mpfr_uexp_t) -1) >> 1))))) : (((((n)->sub.val.nm.mpi)->_mp_size < 0 ? -1 : ((n)->sub.val.nm.mpi)->_mp_size > 0) == 0)))))
goto regular_print;
bcfree(yyvsp[-1]->d.di);
unref(n);
bcfree(yyvsp[-1]->nexti->nexti);
bcfree(yyvsp[-1]->nexti);
bcfree(yyvsp[-1]);
} else {
if ((do_flags & (DO_LINT_INVALID|DO_LINT_ALL)) && (rule == BEGIN || rule == END) && ! warned) {
warned = 1;
lintwarn_ln(yyvsp[-3]->source_line,
gettext("plain `print' in BEGIN or END rule should probably be `print \"\"'"));
}
}
yyvsp[-3]->x.xl = 0;
yyvsp[-3]->opcode = Op_K_print_rec;
if (yyvsp[0] == ((void *)0)) {
yyvsp[-3]->d.dl = redirect_none;
yyval = list_create(yyvsp[-3]);
} else {
INSTRUCTION *ip;
ip = yyvsp[0]->nexti;
yyvsp[-3]->d.dl = ip->d.dl;
yyvsp[0]->nexti = ip->nexti;
bcfree(ip);
yyval = list_append(yyvsp[0], yyvsp[-3]);
}
} else {
regular_print:
if (yyvsp[0] == ((void *)0)) {
if (yyvsp[-1] == ((void *)0)) {
yyvsp[-3]->x.xl = 0;
if (yyvsp[-3]->opcode == Op_K_print)
yyvsp[-3]->opcode = Op_K_print_rec;
yyvsp[-3]->d.dl = redirect_none;
yyval = list_create(yyvsp[-3]);
} else {
INSTRUCTION *t = yyvsp[-1];
yyvsp[-3]->x.xl = count_expressions(&t, 0);
yyvsp[-3]->d.dl = redirect_none;
yyval = list_append(t, yyvsp[-3]);
}
} else {
INSTRUCTION *ip;
ip = yyvsp[0]->nexti;
yyvsp[-3]->d.dl = ip->d.dl;
yyvsp[0]->nexti = ip->nexti;
bcfree(ip);
if (yyvsp[-1] == ((void *)0)) {
yyvsp[-3]->x.xl = 0;
if (yyvsp[-3]->opcode == Op_K_print)
yyvsp[-3]->opcode = Op_K_print_rec;
yyval = list_append(yyvsp[0], yyvsp[-3]);
} else {
INSTRUCTION *t = yyvsp[-1];
yyvsp[-3]->x.xl = count_expressions(&t, 0);
yyval = list_append(list_merge(yyvsp[0], t), yyvsp[-3]);
}
}
}
}
break;
case 68:
{ sub_counter = 0; }
break;
case 69:
{
char *arr = yyvsp[-2]->d.name;
yyvsp[-2]->opcode = Op_push_array;
yyvsp[-2]->d.dn = variable(yyvsp[-2]->source_line, arr, Node_var_new);
if (! (do_flags & DO_POSIX) && ! (do_flags & DO_TRADITIONAL)) {
if (yyvsp[-2]->d.dn == symbol_table)
(*(set_loc("awkgram.y", 1255), r_fatal))(gettext("`delete' is not allowed with SYMTAB"));
else if (yyvsp[-2]->d.dn == func_table)
(*(set_loc("awkgram.y", 1257), r_fatal))(gettext("`delete' is not allowed with FUNCTAB"));
}
if (yyvsp[0] == ((void *)0)) {
yyvsp[-3]->x.xl = 0;
yyval = list_append(list_create(yyvsp[-2]), yyvsp[-3]);
} else {
yyvsp[-3]->x.xl = sub_counter;
yyval = list_append(list_append(yyvsp[0], yyvsp[-2]), yyvsp[-3]);
}
}
break;
case 70:
{
static _Bool warned = 0;
char *arr = yyvsp[-1]->d.name;
if ((do_flags & (DO_LINT_INVALID|DO_LINT_ALL)) && ! warned) {
warned = 1;
lintwarn_ln(yyvsp[-3]->source_line,
gettext("`delete(array)' is a non-portable tawk extension"));
}
if ((do_flags & DO_TRADITIONAL)) {
error_ln(yyvsp[-3]->source_line,
gettext("`delete(array)' is a non-portable tawk extension"));
}
yyvsp[-1]->d.dn = variable(yyvsp[-1]->source_line, arr, Node_var_new);
yyvsp[-1]->opcode = Op_push_array;
yyvsp[-3]->x.xl = 0;
yyval = list_append(list_create(yyvsp[-1]), yyvsp[-3]);
if (! (do_flags & DO_POSIX) && ! (do_flags & DO_TRADITIONAL)) {
if (yyvsp[-1]->d.dn == symbol_table)
(*(set_loc("awkgram.y", 1304), r_fatal))(gettext("`delete' is not allowed with SYMTAB"));
else if (yyvsp[-1]->d.dn == func_table)
(*(set_loc("awkgram.y", 1306), r_fatal))(gettext("`delete' is not allowed with FUNCTAB"));
}
}
break;
case 71:
{
yyval = optimize_assignment(yyvsp[0]);
}
break;
case 72:
{ yyval = ((void *)0); }
break;
case 73:
{ yyval = yyvsp[0]; }
break;
case 74:
{ yyval = ((void *)0); }
break;
case 75:
{
if (yyvsp[-1] == ((void *)0))
yyval = list_create(yyvsp[0]);
else
yyval = list_prepend(yyvsp[-1], yyvsp[0]);
}
break;
case 76:
{ yyval = ((void *)0); }
break;
case 77:
{
INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == ((void *)0))
casestmt = list_create(bcalloc(Op_no_op, 1, 0));
if ((do_flags & DO_PRETTY_PRINT))
(void) list_prepend(casestmt, bcalloc(Op_exec_count, 1, 0));
yyvsp[-4]->d.di = yyvsp[-3];
yyvsp[-4]->x.xi = casestmt;
yyvsp[-4]->comment = yyvsp[-1];
bcfree(yyvsp[-2]);
yyval = yyvsp[-4];
}
break;
case 78:
{
INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == ((void *)0))
casestmt = list_create(bcalloc(Op_no_op, 1, 0));
if ((do_flags & DO_PRETTY_PRINT))
(void) list_prepend(casestmt, bcalloc(Op_exec_count, 1, 0));
bcfree(yyvsp[-2]);
yyvsp[-3]->x.xi = casestmt;
yyvsp[-3]->comment = yyvsp[-1];
yyval = yyvsp[-3];
}
break;
case 79:
{ yyval = yyvsp[0]; }
break;
case 80:
{
NODE *n = yyvsp[0]->d.dn;
(void) force_number(n);
negate_num(n);
bcfree(yyvsp[-1]);
yyval = yyvsp[0];
}
break;
case 81:
{
NODE *n = yyvsp[0]->d.di->d.dn;
bcfree(yyvsp[-1]);
add_sign_to_num(n, '+');
yyval = yyvsp[0];
}
break;
case 82:
{ yyval = yyvsp[0]; }
break;
case 83:
{
if (yyvsp[0]->d.dn->type == Node_regex)
yyvsp[0]->opcode = Op_push_re;
else
yyvsp[0]->opcode = Op_push;
yyval = yyvsp[0];
}
break;
case 84:
{
((void) (0));
yyvsp[0]->opcode = Op_push_re;
yyval = yyvsp[0];
}
break;
case 85:
{ yyval = yyvsp[0]; }
break;
case 86:
{ yyval = yyvsp[0]; }
break;
case 88:
{
yyval = yyvsp[-1];
}
break;
case 89:
{
in_print = 0;
in_parens = 0;
yyval = ((void *)0);
}
break;
case 90:
{ in_print = 0; in_parens = 0; }
break;
case 91:
{
if (yyvsp[-2]->d.dl == redirect_twoway
&& yyvsp[0]->d.di->opcode == Op_K_getline_redir
&& yyvsp[0]->d.di->d.dl == redirect_twoway)
yyerror(gettext("multistage two-way pipelines don't work"));
if ((do_flags & (DO_LINT_INVALID|DO_LINT_ALL)) && yyvsp[-2]->d.dl == redirect_output && yyvsp[0]->d.di->opcode == Op_concat)
(*(set_loc("awkgram.y", 1433),lintfunc))(gettext("concatenation as I/O `>' redirection target is ambiguous"));
yyval = list_prepend(yyvsp[0], yyvsp[-2]);
}
break;
case 92:
{
if (yyvsp[-1] != ((void *)0))
yyvsp[-5]->comment = yyvsp[-1];
add_lint(yyvsp[-3], LINT_assign_in_cond);
yyval = mk_condition(yyvsp[-3], yyvsp[-5], yyvsp[0], ((void *)0), ((void *)0));
}
break;
case 93:
{
if (yyvsp[-4] != ((void *)0))
yyvsp[-8]->comment = yyvsp[-4];
if (yyvsp[-1] != ((void *)0))
yyvsp[-2]->comment = yyvsp[-1];
add_lint(yyvsp[-6], LINT_assign_in_cond);
yyval = mk_condition(yyvsp[-6], yyvsp[-8], yyvsp[-3], yyvsp[-2], yyvsp[0]);
}
break;
case 94:
{
yyval = yyvsp[0];
}
break;
case 95:
{
if (yyvsp[-1] != ((void *)0) && yyvsp[0] != ((void *)0)) {
if (yyvsp[-1]->d.dn->sub.val.comtype == EOL_COMMENT) {
((void) (0));
yyvsp[-1]->comment = yyvsp[0];
} else {
merge_comments(yyvsp[-1], yyvsp[0]);
}
yyval = yyvsp[-1];
} else if (yyvsp[-1] != ((void *)0)) {
yyval = yyvsp[-1];
} else if (yyvsp[0] != ((void *)0)) {
yyval = yyvsp[0];
} else
yyval = ((void *)0);
}
break;
case 96:
{ yyval = ((void *)0); }
break;
case 97:
{ yyval = yyvsp[0]; }
break;
case 98:
{ yyval = ((void *)0); }
break;
case 99:
{
bcfree(yyvsp[-1]);
yyval = yyvsp[0];
}
break;
case 100:
{ yyval = ((void *)0); }
break;
case 101:
{ yyval = yyvsp[0]; }
break;
case 102:
{
yyvsp[0]->x.xl = 0;
yyval = list_create(yyvsp[0]);
}
break;
case 103:
{
if (yyvsp[-2] != ((void *)0) && yyvsp[0] != ((void *)0)) {
yyvsp[0]->x.xl = yyvsp[-2]->d.di->x.xl + 1;
yyval = list_append(yyvsp[-2], yyvsp[0]);
(yyerrstatus = 0);
if (yyvsp[-1] != ((void *)0)) {
if (yyvsp[-2]->comment != ((void *)0))
merge_comments(yyvsp[-2]->comment, yyvsp[-1]);
else
yyvsp[-2]->comment = yyvsp[-1];
}
} else
yyval = ((void *)0);
}
break;
case 104:
{ yyval = ((void *)0); }
break;
case 105:
{ yyval = yyvsp[-1]; }
break;
case 106:
{ yyval = yyvsp[-2]; }
break;
case 107:
{ yyval = ((void *)0); }
break;
case 108:
{ yyval = yyvsp[0]; }
break;
case 109:
{ yyval = ((void *)0); }
break;
case 110:
{ yyval = yyvsp[0]; }
break;
case 111:
{ yyval = mk_expression_list(((void *)0), yyvsp[0]); }
break;
case 112:
{
if (yyvsp[-1] != ((void *)0))
yyvsp[-2]->d.di->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
(yyerrstatus = 0);
}
break;
case 113:
{ yyval = ((void *)0); }
break;
case 114:
{
yyval = yyvsp[-1];
}
break;
case 115:
{
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
}
break;
case 116:
{
if (yyvsp[-1] != ((void *)0))
yyvsp[-2]->d.di->comment = yyvsp[-1];
yyval = yyvsp[-2];
}
break;
case 117:
{ yyval = ((void *)0); }
break;
case 118:
{ yyval = yyvsp[0]; }
break;
case 119:
{ yyval = mk_expression_list(((void *)0), yyvsp[0]); }
break;
case 120:
{
if (yyvsp[-1] != ((void *)0))
yyvsp[-2]->d.di->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
(yyerrstatus = 0);
}
break;
case 121:
{ yyval = ((void *)0); }
break;
case 122:
{
yyval = yyvsp[-1];
}
break;
case 123:
{
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
}
break;
case 124:
{
if (yyvsp[-1] != ((void *)0))
yyvsp[-2]->comment = yyvsp[-1];
yyval = yyvsp[-2];
}
break;
case 125:
{ yyval = yyvsp[0]; }
break;
case 126:
{ yyval = list_create(yyvsp[0]); }
break;
case 127:
{ yyval = ((void *)0); }
break;
case 128:
{ yyval = yyvsp[0]; }
break;
case 129:
{
if ((do_flags & (DO_LINT_INVALID|DO_LINT_ALL)) && yyvsp[0]->d.di->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line,
gettext("regular expression on right of assignment"));
yyval = mk_assignment(yyvsp[-2], yyvsp[0], yyvsp[-1]);
}
break;
case 130:
{
yyval = mk_assignment(yyvsp[-2], list_create(yyvsp[0]), yyvsp[-1]);
}
break;
case 131:
{ yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 132:
{ yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 133:
{
if (yyvsp[-2]->d.di->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line,
gettext("regular expression on left of `~' or `!~' operator"));
((void) (0));
yyvsp[-1]->d.dn = yyvsp[0]->d.dn;
bcfree(yyvsp[0]);
yyval = list_append(yyvsp[-2], yyvsp[-1]);
}
break;
case 134:
{
if (yyvsp[-2]->d.di->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line,
gettext("regular expression on left of `~' or `!~' operator"));
if (yyvsp[0]->d.di == yyvsp[0]->nexti && yyvsp[0]->nexti->opcode == Op_match_rec) {
yyvsp[-1]->d.dn = yyvsp[0]->nexti->d.dn;
bcfree(yyvsp[0]->nexti);
bcfree(yyvsp[0]);
yyval = list_append(yyvsp[-2], yyvsp[-1]);
} else {
yyvsp[-1]->d.dn = make_regnode(Node_dynregex, ((void *)0));
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
}
break;
case 135:
{
if ((do_flags & DO_LINT_OLD))
lintwarn_ln(yyvsp[-1]->source_line,
gettext("old awk does not support the keyword `in' except after `for'"));
yyvsp[0]->nexti->opcode = Op_push_array;
yyvsp[-1]->opcode = Op_in_array;
yyvsp[-1]->x.xl = 1;
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
break;
case 136:
{
if ((do_flags & (DO_LINT_INVALID|DO_LINT_ALL)) && yyvsp[0]->d.di->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line,
gettext("regular expression on right of comparison"));
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
break;
case 137:
{ yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1], yyvsp[0]); }
break;
case 138:
{ yyval = yyvsp[0]; }
break;
case 139:
{ yyval = yyvsp[0]; }
break;
case 140:
{ yyval = yyvsp[0]; }
break;
case 141:
{
yyvsp[0]->opcode = Op_assign_quotient;
yyval = yyvsp[0];
}
break;
case 142:
{ yyval = yyvsp[0]; }
break;
case 143:
{ yyval = yyvsp[0]; }
break;
case 144:
{ yyval = yyvsp[0]; }
break;
case 145:
{ yyval = yyvsp[0]; }
break;
case 146:
{ yyval = yyvsp[0]; }
break;
case 147:
{ yyval = yyvsp[0]; }
break;
case 148:
{
int count = 2;
_Bool is_simple_var = 0;
if (yyvsp[-1]->d.di->opcode == Op_concat) {
is_simple_var = (yyvsp[-1]->d.di->d.dl & 2) != 0;
count = yyvsp[-1]->d.di->x.xl + 1;
yyvsp[-1]->d.di->opcode = Op_no_op;
} else {
is_simple_var = (yyvsp[-1]->nexti->opcode == Op_push
&& yyvsp[-1]->d.di == yyvsp[-1]->nexti);
}
if (do_optimize
&& yyvsp[-1]->nexti == yyvsp[-1]->d.di && yyvsp[-1]->nexti->opcode == Op_push_i
&& yyvsp[0]->nexti == yyvsp[0]->d.di && yyvsp[0]->nexti->opcode == Op_push_i
) {
NODE *n1 = yyvsp[-1]->nexti->d.dn;
NODE *n2 = yyvsp[0]->nexti->d.dn;
size_t nlen;
if ((n1->flags & (NUMBER|NUMINT|INTLSTR)) != 0 || (n2->flags & (NUMBER|NUMINT|INTLSTR)) != 0)
goto plain_concat;
n1 = force_string_fmt((n1), CONVFMT, CONVFMTidx);
n2 = force_string_fmt((n2), CONVFMT, CONVFMTidx);
nlen = n1->sub.val.slen + n2->sub.val.slen;
(void) (n1->sub.val.sp = (char *) erealloc_real((void *) n1->sub.val.sp, (size_t)(nlen + 1), "constant fold", "n1->stptr", "awkgram.y", 1775));
memcpy(n1->sub.val.sp + n1->sub.val.slen, n2->sub.val.sp, n2->sub.val.slen);
n1->sub.val.slen = nlen;
n1->sub.val.sp[nlen] = '\0';
n1->flags &= ~(NUMCUR|NUMBER|NUMINT);
n1->flags |= (STRING|STRCUR);
unref(n2);
bcfree(yyvsp[0]->nexti);
bcfree(yyvsp[0]);
yyval = yyvsp[-1];
} else {
plain_concat:
yyval = list_append(list_merge(yyvsp[-1], yyvsp[0]), bcalloc(Op_concat, 1, 0));
yyval->d.di->d.dl = (is_simple_var ? 2 : 0);
yyval->d.di->x.xl = count;
if (count > max_args)
max_args = count;
}
}
break;
case 150:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 151:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 152:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 153:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 154:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 155:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 156:
{
if ((rule == BEGINFILE || rule == ENDFILE) && yyvsp[0] == ((void *)0))
error_ln(yyvsp[-2]->source_line,
gettext("non-redirected `getline' invalid inside `%s' rule"), ruletab[rule]);
if ((do_flags & (DO_LINT_INVALID|DO_LINT_ALL)) && rule == END && yyvsp[0] == ((void *)0))
lintwarn_ln(yyvsp[-2]->source_line,
gettext("non-redirected `getline' undefined inside END action"));
yyval = mk_getline(yyvsp[-2], yyvsp[-1], yyvsp[0], redirect_input);
}
break;
case 157:
{
yyvsp[0]->opcode = Op_postincrement;
yyval = mk_assignment(yyvsp[-1], ((void *)0), yyvsp[0]);
}
break;
case 158:
{
yyvsp[0]->opcode = Op_postdecrement;
yyval = mk_assignment(yyvsp[-1], ((void *)0), yyvsp[0]);
}
break;
case 159:
{
if ((do_flags & DO_LINT_OLD)) {
warning_ln(yyvsp[-1]->source_line,
gettext("old awk does not support the keyword `in' except after `for'"));
lintwarn_ln(yyvsp[-1]->source_line,
gettext("old awk does not support multidimensional arrays"));
}
yyvsp[0]->nexti->opcode = Op_push_array;
yyvsp[-1]->opcode = Op_in_array;
if (yyvsp[-3] == ((void *)0)) {
errcount++;
yyvsp[-1]->x.xl = 0;
yyval = list_merge(yyvsp[0], yyvsp[-1]);
} else {
INSTRUCTION *t = yyvsp[-3];
yyvsp[-1]->x.xl = count_expressions(&t, 0);
yyval = list_append(list_merge(t, yyvsp[0]), yyvsp[-1]);
}
}
break;
case 160:
{
yyval = mk_getline(yyvsp[-1], yyvsp[0], yyvsp[-3], yyvsp[-2]->d.dl);
bcfree(yyvsp[-2]);
}
break;
case 161:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 162:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 163:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 164:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 165:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 166:
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
break;
case 167:
{
yyval = list_create(yyvsp[0]);
}
break;
case 168:
{
if (yyvsp[0]->opcode == Op_match_rec) {
yyvsp[0]->opcode = Op_nomatch;
yyvsp[-1]->opcode = Op_push_i;
yyvsp[-1]->d.dn = set_profile_text(make_number(0.0), "0", 1);
yyval = list_append(list_append(list_create(yyvsp[-1]),
bcalloc(Op_field_spec, 1, 0)), yyvsp[0]);
} else {
if (do_optimize && yyvsp[0]->nexti == yyvsp[0]->d.di
&& yyvsp[0]->nexti->opcode == Op_push_i
&& (yyvsp[0]->nexti->d.dn->flags & (MPFN|MPZN|INTLSTR)) == 0
) {
NODE *n = yyvsp[0]->nexti->d.dn;
if ((n->flags & STRING) != 0) {
n->sub.val.nm.fltnum = (double) (n->sub.val.slen == 0);
n->flags &= ~(STRCUR|STRING);
n->flags |= (NUMCUR|NUMBER);
pma_free(n->sub.val.sp);
n->sub.val.sp = ((void *)0);
n->sub.val.slen = 0;
} else
n->sub.val.nm.fltnum = (double) (n->sub.val.nm.fltnum == 0.0);
bcfree(yyvsp[-1]);
yyval = yyvsp[0];
} else {
yyvsp[-1]->opcode = Op_not;
add_lint(yyvsp[0], LINT_assign_in_cond);
yyval = list_append(yyvsp[0], yyvsp[-1]);
}
}
}
break;
case 169:
{
yyval = list_append(yyvsp[-1], bcalloc(Op_parens, 1, sourceline));
}
break;
case 170:
{
yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == ((void *)0))
goto yyabortlab;
}
break;
case 171:
{
yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == ((void *)0))
goto yyabortlab;
}
break;
case 172:
{
static _Bool warned = 0;
if ((do_flags & (DO_LINT_INVALID|DO_LINT_ALL)) && ! warned) {
warned = 1;
lintwarn_ln(yyvsp[0]->source_line,
gettext("call of `length' without parentheses is not portable"));
}
yyval = snode(((void *)0), yyvsp[0]);
if (yyval == ((void *)0))
goto yyabortlab;
}
break;
case 175:
{
yyvsp[-1]->opcode = Op_preincrement;
yyval = mk_assignment(yyvsp[0], ((void *)0), yyvsp[-1]);
}
break;
case 176:
{
yyvsp[-1]->opcode = Op_predecrement;
yyval = mk_assignment(yyvsp[0], ((void *)0), yyvsp[-1]);
}
break;
case 177:
{
yyval = list_create(yyvsp[0]);
}
break;
case 178:
{
yyval = list_create(yyvsp[0]);
}
break;
case 179:
{
if (yyvsp[0]->d.di->opcode == Op_push_i
&& (yyvsp[0]->d.di->d.dn->flags & STRING) == 0
) {
NODE *n = yyvsp[0]->d.di->d.dn;
(void) force_number(n);
negate_num(n);
yyval = yyvsp[0];
bcfree(yyvsp[-1]);
} else {
yyvsp[-1]->opcode = Op_unary_minus;
yyval = list_append(yyvsp[0], yyvsp[-1]);
}
}
break;
case 180:
{
if (yyvsp[0]->d.di->opcode == Op_push_i
&& (yyvsp[0]->d.di->d.dn->flags & STRING) == 0
&& (yyvsp[0]->d.di->d.dn->flags & NUMCONSTSTR) != 0) {
NODE *n = yyvsp[0]->d.di->d.dn;
add_sign_to_num(n, '+');
yyval = yyvsp[0];
bcfree(yyvsp[-1]);
} else {
yyvsp[-1]->opcode = Op_unary_plus;
yyval = list_append(yyvsp[0], yyvsp[-1]);
}
}
break;
case 181:
{
func_use(yyvsp[0]->d.di->d.name, FUNC_USE);
yyval = yyvsp[0];
}
break;
case 182:
{
INSTRUCTION *f, *t;
char *name;
NODE *indirect_var;
static _Bool warned = 0;
const char *msg = gettext("indirect function calls are a gawk extension");
if ((do_flags & DO_TRADITIONAL) || (do_flags & DO_POSIX))
yyerror("%s", msg);
else if ((do_flags & DO_LINT_EXTENSIONS) && ! warned) {
warned = 1;
(*(set_loc("awkgram.y", 2025),lintfunc))("%s", msg);
}
f = yyvsp[0]->d.di;
f->opcode = Op_indirect_func_call;
name = estrdup(f->d.name, strlen(f->d.name));
if (is_std_var(name))
yyerror(gettext("cannot use special variable `%s' for indirect function call"), name);
indirect_var = variable(f->source_line, name, Node_var_new);
t = bcalloc(Op_push, 1, 0);
t->d.dn = indirect_var;
yyval = list_prepend(yyvsp[0], t);
at_seen--;
}
break;
case 183:
{
NODE *n;
char *name = yyvsp[-3]->d.name;
char *qname = qualify_name(name, strlen(name));
if (qname != name) {
pma_free((char *) name);
yyvsp[-3]->d.name = qname;
}
if (! at_seen) {
n = lookup(yyvsp[-3]->d.name);
if (n != ((void *)0) && n->type != Node_func
&& n->type != Node_ext_func) {
error_ln(yyvsp[-3]->source_line,
gettext("attempt to use non-function `%s' in function call"),
yyvsp[-3]->d.name);
}
}
param_sanity(yyvsp[-1]);
yyvsp[-3]->opcode = Op_func_call;
yyvsp[-3]->x.xn = ((void *)0);
if (yyvsp[-1] == ((void *)0)) {
(yyvsp[-3] + 1)->x.xl = 0;
yyval = list_create(yyvsp[-3]);
} else {
INSTRUCTION *t = yyvsp[-1];
(yyvsp[-3] + 1)->x.xl = count_expressions(&t, 1);
yyval = list_append(t, yyvsp[-3]);
}
}
break;
case 184:
{ yyval = ((void *)0); }
break;
case 185:
{ yyval = yyvsp[0]; }
break;
case 186:
{ yyval = ((void *)0); }
break;
case 187:
{ yyval = yyvsp[-1]; }
break;
case 188:
{ yyval = yyvsp[0]; }
break;
case 189:
{
yyval = list_merge(yyvsp[-1], yyvsp[0]);
}
break;
case 190:
{
INSTRUCTION *ip = yyvsp[0]->d.di;
int count = ip->d.dl;
if (count > 1) {
ip->opcode = Op_concat;
ip->d.dl = 1;
ip->x.xl = count;
} else
ip->opcode = Op_no_op;
sub_counter++;
yyval = yyvsp[0];
}
break;
case 191:
{
INSTRUCTION *t = yyvsp[-1];
if (yyvsp[-1] == ((void *)0)) {
error_ln(yyvsp[0]->source_line,
gettext("invalid subscript expression"));
t = list_create(bcalloc(Op_push_i, 1, 0));
t->nexti->d.dn = dupnode(Nnull_string);
yyvsp[0]->d.dl = 1;
} else
yyvsp[0]->d.dl = count_expressions(&t, 0);
yyval = list_append(t, yyvsp[0]);
}
break;
case 192:
{ yyval = yyvsp[0]; }
break;
case 193:
{
yyval = list_merge(yyvsp[-1], yyvsp[0]);
}
break;
case 194:
{ yyval = yyvsp[-1]; }
break;
case 195:
{
yyvsp[0]->opcode = Op_push;
yyvsp[0]->d.dn = variable(yyvsp[0]->source_line, yyvsp[0]->d.name, Node_var_new);
yyval = list_create(yyvsp[0]);
}
break;
case 196:
{
char *arr = yyvsp[-1]->d.name;
yyvsp[-1]->d.dn = variable(yyvsp[-1]->source_line, arr, Node_var_new);
yyvsp[-1]->opcode = Op_push_array;
yyval = list_prepend(yyvsp[0], yyvsp[-1]);
}
break;
case 197:
{
INSTRUCTION *ip = yyvsp[0]->nexti;
if (ip->opcode == Op_push
&& ip->d.dn->type == Node_var
&& ip->d.dn->sub.nodep.r.uptr
) {
yyval = list_prepend(yyvsp[0], bcalloc(Op_var_update, 1, 0));
yyval->nexti->x.aptr = ip->d.dn->sub.nodep.r.uptr;
} else
yyval = yyvsp[0];
}
break;
case 198:
{
yyval = list_append(yyvsp[-1], yyvsp[-2]);
if (yyvsp[0] != ((void *)0))
mk_assignment(yyvsp[-1], ((void *)0), yyvsp[0]);
}
break;
case 199:
{
yyvsp[0]->opcode = Op_postincrement;
}
break;
case 200:
{
yyvsp[0]->opcode = Op_postdecrement;
}
break;
case 201:
{ yyval = ((void *)0); }
break;
case 202:
{ yyval = yyvsp[0]; }
break;
case 203:
{ yyval = yyvsp[0]; (yyerrstatus = 0); }
break;
case 204:
{ (yyerrstatus = 0); }
break;
case 205:
{ yyval = ((void *)0); }
break;
case 207:
{ (yyerrstatus = 0); }
break;
case 208:
{ yyval = yyvsp[0]; (yyerrstatus = 0); }
break;
case 209:
{ yyval = yyvsp[0]; (yyerrstatus = 0); }
break;
default: break;
}
;
(yyvsp -= (yylen), yyssp -= (yylen));
yylen = 0;
*++yyvsp = yyval;
{
const int yylhs = yyr1[yyn] - 77;
const int yyi = yypgoto[yylhs] + *yyssp;
yystate = (0 <= yyi && yyi <= 1200 && yycheck[yyi] == *yyssp
? yytable[yyi]
: yydefgoto[yylhs]);
}
goto yynewstate;
yyerrlab:
yytoken = yychar == -2 ? YYSYMBOL_YYEMPTY : (0 <= (yychar) && (yychar) <= 310 ? ((yysymbol_kind_t) (yytranslate[yychar])) : YYSYMBOL_YYUNDEF);
if (!yyerrstatus)
{
++yynerrs;
yyerror ("syntax error");
}
if (yyerrstatus == 3)
{
if (yychar <= 0)
{
if (yychar == 0)
goto yyabortlab;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval);
yychar = -2;
}
}
goto yyerrlab1;
yyerrorlab:
if (0)
goto yyerrorlab;
++yynerrs;
(yyvsp -= (yylen), yyssp -= (yylen));
yylen = 0;
;
yystate = *yyssp;
goto yyerrlab1;
yyerrlab1:
yyerrstatus = 3;
for (;;)
{
yyn = yypact[yystate];
if (!((yyn) == (-276)))
{
yyn += YYSYMBOL_YYerror;
if (0 <= yyn && yyn <= 1200 && yycheck[yyn] == YYSYMBOL_YYerror)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
if (yyssp == yyss)
goto yyabortlab;
yydestruct ("Error: popping",
((yysymbol_kind_t) (yystos[yystate])), yyvsp);
(yyvsp -= (1), yyssp -= (1));
yystate = *yyssp;
;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
*++yyvsp = yylval;
#pragma GCC diagnostic pop
;
yystate = yyn;
goto yynewstate;
yyacceptlab:
yyresult = 0;
goto yyreturnlab;
yyabortlab:
yyresult = 1;
goto yyreturnlab;
yyexhaustedlab:
yyerror ("memory exhausted");
yyresult = 2;
goto yyreturnlab;
yyreturnlab:
if (yychar != -2)
{
yytoken = (0 <= (yychar) && (yychar) <= 310 ? ((yysymbol_kind_t) (yytranslate[yychar])) : YYSYMBOL_YYUNDEF);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
(yyvsp -= (yylen), yyssp -= (yylen));
;
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
((yysymbol_kind_t) (yystos[+*yyssp])), yyvsp);
(yyvsp -= (1), yyssp -= (1));
}
if (yyss != yyssa)
pma_free (yyss);
return yyresult;
}
| {
"array_type": 17,
"break_continue_statement": 203,
"enum_type": 0,
"for_loop": 3,
"function_pointer": 0,
"goto_statement": 35,
"if_statement": 193,
"memory_management": 0,
"memory_operation": 1,
"pointer_type": 36,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 1,
"type_casting": 211,
"union_type": 4,
"while_loop": 3
} |
transcoder-set#WAYS_REMOVE_ONE_ELEMENT_BINARY_STRING_XOR_BECOMES_ZERO_prep#main.c | transcoder-set | WAYS_REMOVE_ONE_ELEMENT_BINARY_STRING_XOR_BECOMES_ZERO.c | main | 14 | int main(void) {
int n_success = 0;
char param0[][100] = {"KfcTJNP","05312505872","100111","tDEEhKxrQ","50824233019","10001110010","T SEZaNm MYQ","838415739","01110100","WYQiAey H"};
for(int i = 0; i < len(param0); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
break;
}
printf("#Results:", " ", n_success, ", ", len(param0));
return 0;
}
| {
"array_type": 1,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#obj_chain_prep#Pl_Find_Linked_Objects.c | gprolog-1.5.0 | obj_chain.c | Pl_Find_Linked_Objects | 23 | void
Pl_Find_Linked_Objects(void)
{
int i;
for(i = nb_obj; --i >= 0; )
{
if (obj_tbl[i].fct_obj_init != ((void *)0)) {
(*(obj_tbl[i].fct_obj_init)) ();
}
}
for(i = 0; i < nb_obj; i++)
{
if (obj_tbl[i].fct_exec_system != ((void *)0)) {
(*(obj_tbl[i].fct_exec_system)) ();
}
}
for(i = nb_obj; --i >= 0; )
{
if (obj_tbl[i].fct_exec_user != ((void *)0)) {
(*(obj_tbl[i].fct_exec_user)) ();
}
}
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 3,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
binn-3.0#binn_prep#binn_map_blob.c | binn-3.0 | binn.c | binn_map_blob | 5 | void * binn_map_blob(void *map, int id, int *psize) {
void *value;
binn_map_get(map, id, 0xC0, &value, psize);
return value;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
tmux#server-fn_prep#server_check_unattached.c | tmux | server-fn.c | server_check_unattached | 11 | void
server_check_unattached(void)
{
struct session *s;
for ((s) = sessions_RB_MINMAX(&sessions, -1); (s) != ((void *)0); (s) = sessions_RB_NEXT(s)) {
if (!(s->flags & 0x1))
continue;
if (options_get_number (s->options, "destroy-unattached"))
session_destroy(s, __func__);
}
}
| {
"array_type": 0,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 0,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_leading_plus_sign_prep#json_hexadecimal_digit.c | json.h | allow_leading_plus_sign.c | json_hexadecimal_digit | 12 | int json_hexadecimal_digit(const char c) {
if ('0' <= c && c <= '9') {
return c - '0';
}
if ('a' <= c && c <= 'f') {
return c - 'a' + 10;
}
if ('A' <= c && c <= 'F') {
return c - 'A' + 10;
}
return -1;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#HTMLparser_prep#htmlElementAllowedHere.c | libxml2 | HTMLparser.c | htmlElementAllowedHere | 10 | int
htmlElementAllowedHere(const htmlElemDesc* parent, const xmlChar* elt) {
const char** p ;
if ( ! elt || ! parent || ! parent->subelts )
return 0 ;
for ( p = parent->subelts; *p; ++p )
if ( !xmlStrcmp((const xmlChar *)*p, elt) )
return 1 ;
return 0 ;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#CHECK_NUMBER_POWER_K_USING_BASE_CHANGING_METHOD_prep#f_gold.c | transcoder-set | CHECK_NUMBER_POWER_K_USING_BASE_CHANGING_METHOD.c | f_gold | 13 | _Bool f_gold ( unsigned int n, unsigned int k ) {
_Bool oneSeen = 0;
while ( n > 0 ) {
int digit = n % k;
if ( digit > 1 ) return 0;
if ( digit == 1 ) {
if ( oneSeen ) return 0;
oneSeen = 1;
}
n /= k;
}
return 1;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
libxml2#libxml2-py_prep#libxml_xmlUCSIsLetterlikeSymbols.c | libxml2 | libxml2-py.c | libxml_xmlUCSIsLetterlikeSymbols | 13 | PyObject *
libxml_xmlUCSIsLetterlikeSymbols(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
int c_retval;
int code;
if (libxml_deprecationWarning("xmlUCSIsLetterlikeSymbols") == -1)
return(((void *)0));
if (!_PyArg_ParseTuple_SizeT(args, (char *)"i:xmlUCSIsLetterlikeSymbols", &code))
return(((void *)0));
c_retval = xmlUCSIsLetterlikeSymbols(code);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
tulipindicators-0.9.1#smoke_prep#test.c | tulipindicators-0.9.1 | smoke.c | test | 22 | void test(const char *fname, int count) {
printf("%s:\n", fname);
FILE *fp = fopen(fname, "r");
if (!fp) {
do { ++ltests; if (!(0)) { ++lfails; printf("%s:%d error \n", "smoke.c", 315); }} while (0);
return;
}
char *line;
while ((line = next_line(fp))) {
if (line[0] < 'a' || line[0] > 'z') {
do { ++ltests; if (!(0)) { ++lfails; printf("%s:%d error \n", "smoke.c", 325); }} while (0);
continue;
}
char *name = strtok(line, " \n\r");
if (!strcmp(name, "candle")) {
do { const int ts = ltests; const int fs = lfails; const clock_t start = clock(); printf("\t%-16s", name); test_candles(fp, count); printf("pass:%2d fail:%2d %4dms\n", (ltests-ts)-(lfails-fs), lfails-fs, (int)((clock() - start) * 1000 / ((__clock_t) 1000000)));} while (0);
} else {
do { const int ts = ltests; const int fs = lfails; const clock_t start = clock(); printf("\t%-16s", name); test_ind_name(fp, name, count); printf("pass:%2d fail:%2d %4dms\n", (ltests-ts)-(lfails-fs), lfails-fs, (int)((clock() - start) * 1000 / ((__clock_t) 1000000)));} while (0);
}
}
fclose(fp);
}
| {
"array_type": 1,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 5
} |
transcoder-set#SUM_MATRIX_ELEMENT_ELEMENT_INTEGER_DIVISION_ROW_COLUMN_1_prep#len.c | transcoder-set | SUM_MATRIX_ELEMENT_ELEMENT_INTEGER_DIVISION_ROW_COLUMN_1.c | len | 1 | int len (int arr [ ]) {return ((int) (sizeof (arr) / sizeof (arr)[0]));}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#misc_prep#must_be_dot_or_slash.c | tar-1.34 | misc.c | must_be_dot_or_slash | 26 | _Bool
must_be_dot_or_slash (char const *file_name)
{
file_name += ((void) (file_name), 0);
if (((file_name[0]) == '/'))
{
for (;;)
if (((file_name[1]) == '/'))
file_name++;
else if (file_name[1] == '.'
&& ((file_name[2 + (file_name[2] == '.')]) == '/'))
file_name += 2 + (file_name[2] == '.');
else
return ! file_name[1];
}
else
{
while (file_name[0] == '.' && ((file_name[1]) == '/'))
{
file_name += 2;
while (((*file_name) == '/'))
file_name++;
}
return ! file_name[0] || (file_name[0] == '.' && ! file_name[1]);
}
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 2
} |
tinycc#tccpp_prep#define_push.c | tinycc | tccpp.c | define_push | 11 | void define_push(int v, int macro_type, int *str, Sym *first_arg)
{
Sym *s, *o;
o = define_find(v);
s = sym_push2(&define_stack, v, macro_type, 0);
s->d = str;
s->next = first_arg;
table_ident[v - 256]->sym_define = s;
if (o && !macro_is_equal(o->d, s->d))
tcc_warning("%s redefined", get_tok_str(v, ((void *)0)));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#CHECK_IF_X_CAN_GIVE_CHANGE_TO_EVERY_PERSON_IN_THE_QUEUE_prep#sort.c | transcoder-set | CHECK_IF_X_CAN_GIVE_CHANGE_TO_EVERY_PERSON_IN_THE_QUEUE.c | sort | 1 | void sort (int arr [ ], int n) {qsort (arr, n, sizeof(int), cmpfunc);}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
nano-7.2#search_prep#tidy_up_after_search.c | nano-7.2 | search.c | tidy_up_after_search | 10 | void tidy_up_after_search(void)
{
if (have_compiled_regexp) {
regfree(&search_regexp);
have_compiled_regexp = 0;
}
if (openfile->mark)
refresh_needed = 1;
recook |= perturbed;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#xinclude_prep#xmlXIncludeSetStreamingMode.c | libxml2 | xinclude.c | xmlXIncludeSetStreamingMode | 7 | int
xmlXIncludeSetStreamingMode(xmlXIncludeCtxtPtr ctxt, int mode) {
if (ctxt == ((void *)0))
return(-1);
ctxt->isStream = !!mode;
return(0);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#MULTIPLY_AN_INTEGER_WITH_3_5_prep#len.c | transcoder-set | MULTIPLY_AN_INTEGER_WITH_3_5.c | len | 1 | int len (int arr [ ]) {return ((int) (sizeof (arr) / sizeof (arr)[0]));}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
heman#vec4_prep#kmVec4Scale.c | heman | vec4.c | kmVec4Scale | 8 | kmVec4* kmVec4Scale(kmVec4* pOut, const kmVec4* pIn, const float s) {
kmVec4Normalize(pOut, pIn);
pOut->x *= s;
pOut->y *= s;
pOut->z *= s;
pOut->w *= s;
return pOut;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
nano-7.2#cut_prep#do_delete.c | nano-7.2 | cut.c | do_delete | 12 | void do_delete(void)
{
if (openfile->mark && ((flags[((LET_THEM_ZAP) / (sizeof(unsigned) * 8))] & ((unsigned)1 << ((LET_THEM_ZAP) % (sizeof(unsigned) * 8)))) != 0))
zap_text();
else
{
do_deletion(DEL);
while (openfile->current->data[openfile->current_x] != '\0' &&
is_zerowidth(openfile->current->data + openfile->current_x))
do_deletion(DEL);
}
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 1
} |
libosip2-5.3.1#osip_authorization_prep#osip_authorization_get_opaque.c | libosip2-5.3.1 | osip_authorization.c | osip_authorization_get_opaque | 3 | char *osip_authorization_get_opaque(osip_authorization_t *authorization) {
return authorization->opaque;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#COUNT_SET_BITS_IN_AN_INTEGER_prep#max.c | transcoder-set | COUNT_SET_BITS_IN_AN_INTEGER.c | max | 1 | int max(int x, int y) { return (x > y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
binn-3.0#binn_prep#binn_map_read_pair.c | binn-3.0 | binn.c | binn_map_read_pair | 7 | void * binn_map_read_pair(void *ptr, int pos, int *pid, int *ptype, int *psize) {
binn value;
if (binn_map_get_pair(ptr, pos, pid, &value) == 0) return ((void *)0);
if (ptype) *ptype = value.type;
if (psize) *psize = value.size;
return store_value(&value);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#tree_prep#xmlAddSibling.c | libxml2 | tree.c | xmlAddSibling | 17 | xmlNodePtr
xmlAddSibling(xmlNodePtr node, xmlNodePtr cur) {
if ((node == ((void *)0)) || (node->type == XML_NAMESPACE_DECL) ||
(cur == ((void *)0)) || (cur->type == XML_NAMESPACE_DECL) ||
(cur == node))
return(((void *)0));
if ((node->type != XML_ATTRIBUTE_NODE) && (node->parent != ((void *)0))) {
if (node->parent->last != ((void *)0))
node = node->parent->last;
} else {
while (node->next != ((void *)0))
node = node->next;
}
if (cur == node)
return(cur);
return(xmlInsertNode(node->doc, cur, node->parent, node, ((void *)0), 1));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 7,
"union_type": 0,
"while_loop": 1
} |
dap-3.10#ps_prep#pict_bhrect.c | dap-3.10 | ps.c | pict_bhrect | 45 | void pict_bhrect(pict *p, double spacing, double x0, double y0, double xside, double yside)
{
int vlines, hlines;
int linen;
int ptn;
double xl, xr, yb, yt;
int even;
vlines = (int) floor(yside / spacing);
hlines = (int) floor(xside / spacing);
pict_point(p, x0, y0);
pict_point(p, x0 + xside, y0);
pict_point(p, x0 + xside, y0 + yside);
pict_point(p, x0, y0 + yside);
pict_point(p, x0, y0);
for (linen = -vlines, ptn = 0, even = 0; linen <= hlines;
linen++, ptn += 2, even = 1 - even)
{
xl = x0 + ((double) linen) * spacing;
yt = y0 + yside;
xr = xl + yside;
yb = y0;
if (xl < x0)
{
yt -= x0 - xl;
xl = x0;
}
if (xr > x0 + xside)
{
if (!even && xr < x0 + xside + spacing)
pict_point(p, x0 + xside, y0);
yb += xr - x0 - xside;
xr = x0 + xside;
}
if (even)
{
pict_point(p, xl, yt);
pict_point(p, xr, yb);
}
else
{
pict_point(p, xr, yb);
pict_point(p, xl, yt);
}
}
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
enscript-1.6.6#main_prep#main.c | enscript-1.6.6 | main.c | main | 575 | int
main (int argc, char *argv[])
{
InputStream is;
time_t tim;
struct tm *tm;
int i, j, found;
unsigned int ui;
MediaEntry *mentry;
AFMError afm_error;
char *cp, *cp2;
int retval = 0;
Buffer buffer;
buffer_init (&buffer);
program = strrchr (argv[0], '/');
if (program == ((void *)0))
program = argv[0];
else
program++;
argv[0] = program;
toc_fmt_string = gettext ("$3v $-40N $3% pages $4L lines $E $C");
setlocale (5, "");
bindtextdomain ("enscript", "/usr/local/share/locale");
textdomain ("enscript");
tim = time (((void *)0));
tm = localtime (&tim);
memcpy (&run_tm, tm, sizeof (*tm));
date_string = xstrdup (asctime (&run_tm));
i = strlen (date_string);
date_string[i - 1] = '\0';
passwd = getpwuid (getuid ());
if (passwd == ((void *)0))
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("couldn't get passwd entry for uid=%d: %s"), getuid (), strerror ((*__errno_location ()))); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
media_name = xstrdup ("A4");
encoding_name = xstrdup ("88591");
npf_name = xstrdup ("octal");
page_label_format = xstrdup ("short");
ul_style_str = xstrdup ("outline");
ul_position = xstrdup ("+0-0");
spooler_command = xstrdup ("lpr");
queue_param = xstrdup ("-P");
no_job_header_switch = xstrdup ("-h");
fancy_header_default = xstrdup ("enscript");
output_first_line = xstrdup ("%!PS-Adobe-3.0");
cp = getenv ("ENSCRIPT_LIBRARY");
if (cp)
enscript_library = cp;
cp = getenv ("HOME");
if (cp == ((void *)0))
cp = passwd->pw_dir;
buffer_clear (&buffer);
buffer_append (&buffer, enscript_library);
buffer_append (&buffer, ":");
buffer_append (&buffer, cp);
buffer_append (&buffer, "/.enscript");
libpath = buffer_copy (&buffer);
states_binary = xstrdup ("states");
buffer_clear (&buffer);
buffer_append (&buffer, enscript_library);
buffer_append (&buffer, "/hl/enscript.st");
states_config_file = buffer_copy (&buffer);
states_highlight_style = xstrdup ("emacs");
buffer_clear (&buffer);
buffer_append (&buffer, cp);
buffer_append (&buffer, "/.enscript");
buffer_append (&buffer, ":");
buffer_append (&buffer, enscript_library);
buffer_append (&buffer, "/hl");
states_path = buffer_copy (&buffer);
res_fonts = strhash_init ();
download_fonts = strhash_init ();
pagedevice = strhash_init ();
statusdict = strhash_init ();
user_strings = strhash_init ();
if (!read_config ("/usr/local/etc", "enscript.cfg"))
{
int saved_errno = (*__errno_location ());
if (!read_config (enscript_library, "enscript.cfg"))
{
buffer_clear (&buffer);
buffer_append (&buffer, enscript_library);
buffer_append (&buffer, "/../../etc");
if (!read_config (buffer_ptr (&buffer), "enscript.cfg"))
{
if (!read_config ("../lib", "enscript.cfg")
&& !read_config ("../../lib", "enscript.cfg"))
{
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("couldn't read config file \"%s/%s\": %s"), enscript_library, "enscript.cfg", strerror (saved_errno)); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("I did also try the following directories:")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\t%s"), "/usr/local/etc"); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\t%s"), enscript_library); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\t%s"), buffer_ptr (&buffer)); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\t../lib")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\t../../lib")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("This is probably an installation error. Please, try to rebuild:")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\tmake distclean")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\t./configure --prefix=PREFIX")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\tmake")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\tmake check")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("\tmake install")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("or set the environment variable `ENSCRIPT_LIBRARY'" " to point to your library directory.")); fprintf (stderr, "\n"); fflush (stderr); } while (0);
exit (1);
}
buffer_clear (&buffer);
buffer_append (&buffer, libpath);
buffer_append (&buffer, ":");
buffer_append (&buffer, "../lib");
buffer_append (&buffer, ":");
buffer_append (&buffer, "../../lib");
xfree (libpath);
libpath = buffer_copy (&buffer);
}
}
}
read_config ("/usr/local/etc", "enscriptsite.cfg");
read_config (cp, ".enscriptrc");
handle_env_options ("ENSCRIPT");
handle_env_options ("GENSCRIPT");
handle_options (argc, argv);
default_escape_char = escape_char;
found = 0;
for (i = 0; !found && encodings[i].names[0]; i++)
for (j = 0; j < 3; j++)
if (encodings[i].names[j] != ((void *)0) && (strcmp (encodings[i].names[j], encoding_name) == 0))
{
encoding = encodings[i].encoding;
xfree (encoding_name);
encoding_name = xstrdup (encodings[i].names[0]);
if (nl < 0)
nl = encodings[i].nl;
bs = encodings[i].bs;
found = 1;
break;
}
if (!found)
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("unknown encoding: %s"), encoding_name); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
if (!user_body_font_defined && landscape && num_columns > 1)
Fpt.w = Fpt.h = 7.0;
afm_cache = strhash_init ();
afm_info_cache = strhash_init ();
afm_error = afm_create (afm_path, verbose, &afm);
if (afm_error != 0)
{
char buf[256];
afm_error_to_string (afm_error, buf);
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("couldn't open AFM library: %s"), buf); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
}
default_Fpt.w = Fpt.w;
default_Fpt.h = Fpt.h;
default_Fname = Fname;
default_Fencoding = encoding;
strhash_put (res_fonts, Fname, strlen (Fname) + 1, ((void *)0), ((void *)0));
strhash_put (res_fonts, HFname, strlen (HFname) + 1, ((void *)0), ((void *)0));
strhash_put (download_fonts, Fname, strlen (Fname) + 1, ((void *)0), ((void *)0));
strhash_put (download_fonts, HFname, strlen (HFname) + 1, ((void *)0), ((void *)0));
read_font_info ();
line_indent = parse_float (line_indent_spec, 1, 1);
if (list_media)
{
printf (gettext ("known media:\nname width\theight\tllx\tlly\turx\tury\n------------------------------------------------------------\n"));
for (mentry = media_names; mentry; mentry = mentry->next)
printf ("%-16s %d\t%d\t%d\t%d\t%d\t%d\n",
mentry->name, mentry->w, mentry->h,
mentry->llx, mentry->lly, mentry->urx, mentry->ury);
exit (0);
}
for (mentry = media_names; mentry; mentry = mentry->next)
if (strcmp (media_name, mentry->name) == 0)
{
media = mentry;
break;
}
if (media == ((void *)0))
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("do not know anything about media \"%s\""), media_name); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
if (margins_spec)
{
for (i = 0; i < 4; i++)
{
if (*margins_spec == '\0')
break;
if (*margins_spec == ':')
{
margins_spec++;
continue;
}
j = atoi (margins_spec);
for (; *margins_spec != ':' && *margins_spec != '\0'; margins_spec++)
;
if (*margins_spec == ':')
margins_spec++;
switch (i)
{
case 0:
media->llx = j;
break;
case 1:
media->urx = media->w - j;
break;
case 2:
media->ury = media->h - j;
break;
case 3:
media->lly = j;
break;
}
}
do { if (!quiet && verbose >= (1)) fprintf (stderr, gettext ("set new marginals for media `%s' (%dx%d): llx=%d, lly=%d, urx=%d, ury=%d\n"), media->name, media->w, media->h, media->llx, media->lly, media->urx, media->ury); } while (0);
}
if ((strcmp (page_label_format, "short") == 0))
page_label = LABEL_SHORT;
else if ((strcmp (page_label_format, "long") == 0))
page_label = LABEL_LONG;
else
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("illegal page label format \"%s\""), page_label_format); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
if ((strcmp (npf_name, "space") == 0))
non_printable_format = NPF_SPACE;
else if ((strcmp (npf_name, "questionmark") == 0))
non_printable_format = NPF_QUESTIONMARK;
else if ((strcmp (npf_name, "caret") == 0))
non_printable_format = NPF_CARET;
else if ((strcmp (npf_name, "octal") == 0))
non_printable_format = NPF_OCTAL;
else
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("illegal non-printable format \"%s\""), npf_name); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
if (mark_wrapped_lines_style_name)
{
if ((strcmp (mark_wrapped_lines_style_name, "none") == 0))
mark_wrapped_lines_style = MWLS_NONE;
else if ((strcmp (mark_wrapped_lines_style_name, "plus") == 0))
mark_wrapped_lines_style = MWLS_PLUS;
else if ((strcmp (mark_wrapped_lines_style_name, "box") == 0))
mark_wrapped_lines_style = MWLS_BOX;
else if ((strcmp (mark_wrapped_lines_style_name, "arrow") == 0))
mark_wrapped_lines_style = MWLS_ARROW;
else
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("illegal style for wrapped line marker: \"%s\""), mark_wrapped_lines_style_name); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
}
for (i = 0; ; i++)
{
ui = nup >> i;
if (ui == 0)
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("illegal N-up argument: %d"), nup); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
if (ui & 0x1)
{
if (ui != 1)
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("N-up argument must be power of 2: %d"), nup); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
nup_exp = i;
break;
}
}
nup_rows = nup_exp / 2 * 2;
if (nup_rows == 0)
nup_rows = 1;
nup_columns = (nup_exp + 1) / 2 * 2;
if (nup_columns == 0)
nup_columns = 1;
nup_landscape = nup_exp & 0x1;
if (landscape)
{
d_page_w = media->ury - media->lly;
d_page_h = media->urx - media->llx;
}
else
{
d_page_w = media->urx - media->llx;
d_page_h = media->ury - media->lly;
}
if (nup_landscape)
{
nup_width = media->ury - media->lly;
nup_height = media->urx - media->llx;
}
else
{
nup_width = media->urx - media->llx;
nup_height = media->ury - media->lly;
}
{
double w, h;
w = ((double) nup_width - (nup_columns - 1) * nup_xpad) / nup_columns;
h = ((double) nup_height - (nup_rows - 1) * nup_ypad) / nup_rows;
nup_width = w;
nup_height = h;
w = w / (media->urx - media->llx);
h = h / (media->ury - media->lly);
nup_scale = w < h ? w : h;
}
if (underlay != ((void *)0))
{
strhash_put (res_fonts, ul_font, strlen (ul_font) + 1, ((void *)0), ((void *)0));
underlay = escape_string (underlay);
}
ul_x = strtod (ul_position, &cp);
if (cp == ul_position)
{
malformed_position:
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("malformed underlay position: %s"), ul_position); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
}
if (ul_position[0] == '-')
ul_x += d_page_w;
ul_y = strtod (cp, &cp2);
if (cp2 == cp)
goto malformed_position;
if (cp[0] == '-')
ul_y += d_page_h;
if (!ul_angle_p)
ul_angle = (atan2 (-d_page_h, d_page_w) / 3.14159265 * 180);
if (strcmp (ul_style_str, "outline") == 0)
ul_style = 0;
else if (strcmp (ul_style_str, "filled") == 0)
ul_style = 1;
else
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("illegal underlay style: %s"), ul_style_str); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
d_header_w = d_page_w;
switch (header)
{
case HDR_NONE:
d_header_h = 0;
break;
case HDR_SIMPLE:
d_header_h = HFpt.h * 1.5;
break;
case HDR_FANCY:
d_header_h = 36;
break;
}
if (help_highlight)
{
printf (gettext ("Highlighting is supported for the following languages and file formats:\n\n"));
fflush (stdout);
buffer_clear (&buffer);
buffer_append (&buffer, states_binary);
buffer_append (&buffer, " -f \"");
buffer_append (&buffer, states_config_file);
buffer_append (&buffer, "\" -p \"");
buffer_append (&buffer, states_path);
buffer_append (&buffer, "\" -s describe_languages ");
buffer_append (&buffer, enscript_library);
buffer_append (&buffer, "/hl/*.st");
system (buffer_ptr (&buffer));
exit (0);
}
if (output_language_pass_through)
{
char *start_state;
Buffer cmd;
char intbuf[256];
if (hl_start_state)
start_state = hl_start_state;
else if (highlight)
start_state = ((void *)0);
else
start_state = "passthrough";
buffer_init (&cmd);
buffer_append (&cmd, states_binary);
buffer_append (&cmd, " -f \"");
buffer_append (&cmd, states_config_file);
buffer_append (&cmd, "\" -p \"");
buffer_append (&cmd, states_path);
buffer_append (&cmd, "\" ");
if (verbose > 0)
buffer_append (&cmd, "-v ");
if (start_state)
{
buffer_append (&cmd, "-s");
buffer_append (&cmd, start_state);
buffer_append (&cmd, " ");
}
buffer_append (&cmd, "-Dcolor=");
buffer_append (&cmd, states_color ? "1" : "0");
buffer_append (&cmd, " ");
buffer_append (&cmd, "-Dstyle=");
buffer_append (&cmd, states_highlight_style);
buffer_append (&cmd, " ");
buffer_append (&cmd, "-Dlanguage=");
buffer_append (&cmd, output_language);
buffer_append (&cmd, " ");
buffer_append (&cmd, "-Dnum_input_files=");
sprintf (intbuf, "%d", optind == argc ? 1 : argc - optind);
buffer_append (&cmd, intbuf);
buffer_append (&cmd, " ");
buffer_append (&cmd, "-Ddocument_title=\'");
if ((cp = shell_escape (title)) != ((void *)0))
{
buffer_append (&cmd, cp);
free (cp);
}
buffer_append (&cmd, "\' ");
buffer_append (&cmd, "-Dtoc=");
buffer_append (&cmd, toc ? "1" : "0");
if (helper_options['s'])
{
Buffer *opts = helper_options['s'];
buffer_append (&cmd, " ");
buffer_append_len (&cmd, buffer_ptr (opts), buffer_len (opts));
}
for (i = optind; i < argc; i++)
{
char *cp;
if ((cp = shell_escape (argv[i])) != ((void *)0))
{
buffer_append (&cmd, " \'");
buffer_append (&cmd, cp);
buffer_append (&cmd, "\'");
free (cp);
}
}
if (is_open (&is, stdin, ((void *)0), buffer_ptr (&cmd)))
{
open_output_file ();
process_file ("unused", &is, 0);
is_close (&is);
}
buffer_uninit (&cmd);
}
else
{
if (highlight)
{
char fbuf[256];
buffer_clear (&buffer);
buffer_append (&buffer, states_binary);
buffer_append (&buffer, " -f \"");
buffer_append (&buffer, states_config_file);
buffer_append (&buffer, "\" -p \"");
buffer_append (&buffer, states_path);
buffer_append (&buffer, "\"");
if (verbose > 0)
buffer_append (&buffer, " -v");
if (hl_start_state)
{
buffer_append (&buffer, " -s ");
buffer_append (&buffer, hl_start_state);
}
buffer_append (&buffer, " -Dcolor=");
buffer_append (&buffer, states_color ? "1" : "0");
buffer_append (&buffer, " -Dstyle=");
buffer_append (&buffer, states_highlight_style);
buffer_append (&buffer, " -Dfont_spec=");
buffer_append (&buffer, Fname);
sprintf (fbuf, "@%g/%g", Fpt.w, Fpt.h);
buffer_append (&buffer, fbuf);
if (helper_options['s'])
{
Buffer *opts = helper_options['s'];
buffer_append (&buffer, " ");
buffer_append_len (&buffer,
buffer_ptr (opts), buffer_len (opts));
}
buffer_append (&buffer, " \'%s\'");
input_filter = buffer_copy (&buffer);
input_filter_stdin = "-";
}
if (toc)
{
toc_fp = tmpfile ();
if (toc_fp == ((void *)0))
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("couldn't create temporary toc file: %s"), strerror ((*__errno_location ()))); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
}
if (optind == argc)
{
memcpy (&mod_tm, &run_tm, sizeof (run_tm));
if (is_open (&is, stdin, ((void *)0), input_filter))
{
open_output_file ();
process_file (title_given ? title : "", &is, 0);
is_close (&is);
}
}
else
{
for (; optind < argc; optind++)
{
if (is_open (&is, ((void *)0), argv[optind], input_filter))
{
struct stat stat_st;
if (stat (argv[optind], &stat_st) == 0)
{
tim = stat_st.st_mtim.tv_sec;
tm = localtime (&tim);
memcpy (&mod_tm, tm, sizeof (*tm));
open_output_file ();
process_file (argv[optind], &is, 0);
}
else
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("couldn't stat input file \"%s\": %s"), argv[optind], strerror ((*__errno_location ()))); fprintf (stderr, "\n"); fflush (stderr); } while (0);
is_close (&is);
}
}
}
if (toc)
{
toc = 0;
special_escapes = 1;
line_numbers = 0;
if (fseek (toc_fp, 0, 0) != 0)
do { fprintf (stderr, "%s: ", program); fprintf (stderr, gettext ("couldn't rewind toc file: %s"), strerror ((*__errno_location ()))); fprintf (stderr, "\n"); fflush (stderr); exit (1); } while (0);
memcpy (&mod_tm, &run_tm, sizeof (run_tm));
if (is_open (&is, toc_fp, ((void *)0), ((void *)0)))
{
process_file (gettext ("Table of Contents"), &is, 1);
is_close (&is);
}
}
dump_ps_trailer ();
if (ofp != ((void *)0) && append_ctrl_D)
fprintf (ofp, "\004\n");
}
close_output_file ();
if (ofp == ((void *)0))
{
do { if (!quiet && verbose >= (0)) fprintf (stderr, gettext ("no output generated\n")); } while (0);
}
else if (output_language_pass_through)
{
if (output_file == ((void *)0))
do { if (!quiet && verbose >= (0)) fprintf (stderr, gettext ("output sent to %s\n"), printer ? printer : gettext ("printer")); } while (0);
else
do { if (!quiet && verbose >= (0)) fprintf (stderr, gettext ("output left in %s\n"), output_file == ((char *) 1) ? "-" : output_file); } while (0);
}
else
{
unsigned int real_total_pages;
if (nup > 1)
{
if (total_pages > 0)
real_total_pages = (total_pages - 1) / nup + 1;
else
real_total_pages = 0;
}
else
real_total_pages = total_pages;
char message[80];
snprintf(message, sizeof message, "%s%s%s%s%s",
"[ ",
ngettext("%d page", "%d pages", real_total_pages),
" * ",
ngettext("%d copy", "%d copies", num_copies),
" ]");
do { if (!quiet && verbose >= (0)) fprintf (stderr, message, real_total_pages, num_copies); } while (0);
if (output_file == ((void *)0))
do { if (!quiet && verbose >= (0)) fprintf (stderr, gettext (" sent to %s\n"), printer ? printer : gettext ("printer")); } while (0);
else
do { if (!quiet && verbose >= (0)) fprintf (stderr, gettext (" left in %s\n"), output_file == ((char *) 1) ? "-" : output_file); } while (0);
if (num_truncated_lines)
{
retval |= 2;
do { if (!quiet && verbose >= (0)) fprintf (stderr, ngettext("%d line was %s\n", "%d lines were %s\n", num_truncated_lines), num_truncated_lines, line_end == LE_TRUNCATE ? gettext ("truncated") : gettext ("wrapped")); } while (0);
}
if (num_missing_chars)
{
retval |= 4;
do { if (!quiet && verbose >= (0)) fprintf (stderr, ngettext("%d character was missing\n", "%d characters were missing\n", num_missing_chars), num_missing_chars); } while (0);
if (list_missing_characters)
{
do { if (!quiet && verbose >= (0)) fprintf (stderr, gettext ("missing character codes (decimal):\n")); } while (0);
do_list_missing_characters (missing_chars);
}
}
if (num_non_printable_chars)
{
retval |= 8;
do { if (!quiet && verbose >= (0)) fprintf (stderr, ngettext("%d non-printable character\n", "%d non-printable characters\n", num_non_printable_chars), num_non_printable_chars); } while (0);
if (list_missing_characters)
{
do { if (!quiet && verbose >= (0)) fprintf (stderr, gettext ("non-printable character codes (decimal):\n")); } while (0);
do_list_missing_characters (non_printable_chars);
}
}
}
buffer_uninit (&buffer);
if (!extended_return_values)
retval = 0;
return retval;
}
| {
"array_type": 9,
"break_continue_statement": 12,
"enum_type": 0,
"for_loop": 9,
"function_pointer": 0,
"goto_statement": 1,
"if_statement": 94,
"memory_management": 2,
"memory_operation": 4,
"pointer_type": 6,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 2,
"type_casting": 28,
"union_type": 0,
"while_loop": 40
} |
nano-7.2#files_prep#close_buffer.c | nano-7.2 | files.c | close_buffer | 20 | void close_buffer(void)
{
openfilestruct *orphan = openfile;
if (orphan == startfile)
startfile = startfile->next;
orphan->prev->next = orphan->next;
orphan->next->prev = orphan->prev;
free(orphan->filename);
free_lines(orphan->filetop);
free(orphan->statinfo);
free(orphan->lock_filename);
discard_until(((void *)0));
free(orphan->errormessage);
openfile = orphan->prev;
if (openfile == orphan)
openfile = ((void *)0);
free(orphan);
if (openfile && openfile == openfile->next)
exitfunc->tag = exit_tag;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 5,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_single_quoted_strings_prep#json_parse_string.c | json.h | allow_single_quoted_strings.c | json_parse_string | 102 | void json_parse_string(struct json_parse_state_s *state,
struct json_string_s *string) {
size_t offset = state->offset;
size_t bytes_written = 0;
const char *const src = state->src;
const char quote_to_use = '\'' == src[offset] ? '\'' : '"';
char *data = state->data;
unsigned long high_surrogate = 0;
unsigned long codepoint;
string->string = data;
offset++;
while (quote_to_use != src[offset]) {
if ('\\' == src[offset]) {
offset++;
switch (src[offset++]) {
default:
return;
case 'u': {
codepoint = 0;
if (!json_hexadecimal_value(&src[offset], 4, &codepoint)) {
return;
}
offset += 4;
if (codepoint <= 0x7fu) {
data[bytes_written++] = (char)codepoint;
} else if (codepoint <= 0x7ffu) {
data[bytes_written++] =
(char)(0xc0u | (codepoint >> 6));
data[bytes_written++] =
(char)(0x80u | (codepoint & 0x3fu));
} else if (codepoint >= 0xd800 &&
codepoint <= 0xdbff) {
high_surrogate = codepoint;
continue;
} else if (codepoint >= 0xdc00 &&
codepoint <= 0xdfff) {
const unsigned long surrogate_offset =
0x10000u - (0xD800u << 10) - 0xDC00u;
codepoint = (high_surrogate << 10) + codepoint + surrogate_offset;
high_surrogate = 0;
data[bytes_written++] =
(char)(0xF0u | (codepoint >> 18));
data[bytes_written++] =
(char)(0x80u | ((codepoint >> 12) & 0x3fu));
data[bytes_written++] =
(char)(0x80u | ((codepoint >> 6) & 0x3fu));
data[bytes_written++] =
(char)(0x80u | (codepoint & 0x3fu));
} else {
data[bytes_written++] =
(char)(0xe0u | (codepoint >> 12));
data[bytes_written++] =
(char)(0x80u | ((codepoint >> 6) & 0x3fu));
data[bytes_written++] =
(char)(0x80u | (codepoint & 0x3fu));
}
} break;
case '"':
data[bytes_written++] = '"';
break;
case '\\':
data[bytes_written++] = '\\';
break;
case '/':
data[bytes_written++] = '/';
break;
case 'b':
data[bytes_written++] = '\b';
break;
case 'f':
data[bytes_written++] = '\f';
break;
case 'n':
data[bytes_written++] = '\n';
break;
case 'r':
data[bytes_written++] = '\r';
break;
case 't':
data[bytes_written++] = '\t';
break;
case '\r':
data[bytes_written++] = '\r';
if ('\n' == src[offset]) {
data[bytes_written++] = '\n';
offset++;
}
break;
case '\n':
data[bytes_written++] = '\n';
break;
}
} else {
data[bytes_written++] = src[offset++];
}
}
offset++;
string->string_size = bytes_written;
data[bytes_written++] = '\0';
state->data += bytes_written;
state->offset = offset;
}
| {
"array_type": 1,
"break_continue_statement": 12,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 7,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 2,
"switch_statement": 1,
"type_casting": 10,
"union_type": 0,
"while_loop": 1
} |
nettle-3.9.1#rsa-decrypt_prep#rsa_session_set_decrypt_key.c | nettle-3.9.1 | rsa-decrypt.c | rsa_session_set_decrypt_key | 11 | void
rsa_session_set_decrypt_key(struct rsa_session *ctx,
const struct rsa_session_info *key)
{
const uint8_t *aes_key = ((key)->key + 4);
const uint8_t *iv = ((key)->key + 4 + 32);
const uint8_t *hmac_key = ((key)->key + 4 + 32 + 16);
nettle_aes256_set_decrypt_key(&ctx->aes.ctx, aes_key);
memcpy((&ctx->aes)->iv, (iv), sizeof((&ctx->aes)->iv));
nettle_hmac_sha1_set_key(&ctx->hmac, 20, hmac_key);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 1,
"pointer_type": 3,
"return_statement": 0,
"struct_type": 2,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
xzoom#xzoom_prep#timeout_func.c | xzoom | xzoom.c | timeout_func | 5 | void
timeout_func(int signum) {
set_title = 1;
signum = signum;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
patch-2.7.6#utimens_prep#utimens.c | patch-2.7.6 | utimens.c | utimens | 5 | int
utimens (char const *file, struct timespec const timespec[2])
{
return fdutimens (-1, file, timespec);
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_PATTERNS_101_GIVEN_STRING_prep#cmpfunc.c | transcoder-set | FIND_PATTERNS_101_GIVEN_STRING.c | cmpfunc | 1 | int cmpfunc (const void * a, const void * b) {return ( *(int*)a - *(int*)b );}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_global_object_prep#json_value_is_null.c | json.h | allow_global_object.c | json_value_is_null | 3 | int json_value_is_null(const struct json_value_s *const value) {
return value->type == json_type_null;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
pth-2.0.7#pth_fork_prep#pth_atfork_pop.c | pth-2.0.7 | pth_fork.c | pth_atfork_pop | 7 | int pth_atfork_pop(void)
{
if (pth_atfork_idx <= 0)
return (0);
pth_atfork_idx--;
return (!(0));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#PAINTING_FENCE_ALGORITHM_prep#main.c | transcoder-set | PAINTING_FENCE_ALGORITHM.c | main | 15 | int main(void) {
int n_success = 0;
int param0[] = {6,23,89,63,23,44,81,43,9,41};
int param1[] = {30,87,31,36,68,66,18,73,42,98};
for(int i = 0; i < len(param0); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
break;
}
printf("#Results:", " ", n_success, ", ", len(param0));
return 0;
}
| {
"array_type": 2,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlCatalogDump.c | libxml2 | libxml2-py.c | libxml_xmlCatalogDump | 12 | PyObject *
libxml_xmlCatalogDump(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
FILE * out;
PyObject *pyobj_out;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"O:xmlCatalogDump", &pyobj_out))
return(((void *)0));
out = (FILE *) (((pyobj_out) == (&_Py_NoneStruct)) ? ((void *)0) : libxml_PyFileGet(pyobj_out));
xmlCatalogDump(out);
libxml_PyFileRelease(out);
_Py_INCREF(((PyObject*)((&_Py_NoneStruct))));
return((&_Py_NoneStruct));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlmemory_prep#xmlCleanupMemory.c | libxml2 | xmlmemory.c | xmlCleanupMemory | 3 | void
xmlCleanupMemory(void) {
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
tinycc#tccgen_prep#sym_pop.c | tinycc | tccgen.c | sym_pop | 24 | void sym_pop(Sym **ptop, Sym *b, int keep)
{
Sym *s, *ss, **ps;
TokenSym *ts;
int v;
s = *ptop;
while(s != b) {
ss = s->prev;
v = s->v;
if (!(v & 0x20000000) && (v & ~0x40000000) < 0x10000000) {
ts = table_ident[(v & ~0x40000000) - 256];
if (v & 0x40000000)
ps = &ts->sym_struct;
else
ps = &ts->sym_identifier;
*ps = s->prev_tok;
}
if (!keep)
sym_free(s);
s = ss;
}
if (!keep)
*ptop = b;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 4,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
libosip2-5.3.1#osip_uri_prep#osip_uri_set_port.c | libosip2-5.3.1 | osip_uri.c | osip_uri_set_port | 5 | void osip_uri_set_port(osip_uri_t *url, char *port) {
if (url == ((void *)0))
return;
url->port = port;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
uucp-1.07#fsusg_prep#get_fs_usage.c | uucp-1.07 | fsusg.c | get_fs_usage | 15 | int
get_fs_usage (path, disk, fsp)
char *path, *disk __attribute__ ((__unused__));
struct fs_usage *fsp;
{
struct statvfs fsd;
if (statvfs (path, &fsd) < 0)
return -1;
fsp->fsu_blocks = adjust_blocks ((fsd.f_blocks), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512);
fsp->fsu_bfree = adjust_blocks ((fsd.f_bfree), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512);
fsp->fsu_bavail = adjust_blocks ((fsd.f_bavail), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512);
fsp->fsu_files = fsd.f_files;
fsp->fsu_ffree = fsd.f_ffree;
return 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#relaxng_prep#xmlRelaxNGNewDocParserCtxt.c | libxml2 | relaxng.c | xmlRelaxNGNewDocParserCtxt | 23 | xmlRelaxNGParserCtxtPtr
xmlRelaxNGNewDocParserCtxt(xmlDocPtr doc)
{
xmlRelaxNGParserCtxtPtr ret;
xmlDocPtr copy;
if (doc == ((void *)0))
return (((void *)0));
copy = xmlCopyDoc(doc, 1);
if (copy == ((void *)0))
return (((void *)0));
ret =
(xmlRelaxNGParserCtxtPtr) xmlMalloc(sizeof(xmlRelaxNGParserCtxt));
if (ret == ((void *)0)) {
xmlRngPErrMemory(((void *)0));
xmlFreeDoc(copy);
return (((void *)0));
}
memset(ret, 0, sizeof(xmlRelaxNGParserCtxt));
ret->document = copy;
ret->freedoc = 1;
ret->userData = (*__xmlGenericErrorContext());
return (ret);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 1,
"pointer_type": 0,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 7,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#sdp_accessor_prep#sdp_message_c_addrtype_get.c | libosip2-5.3.1 | sdp_accessor.c | sdp_message_c_addrtype_get | 6 | char *sdp_message_c_addrtype_get(sdp_message_t *sdp, int pos_media, int pos) {
sdp_connection_t *conn = sdp_message_connection_get(sdp, pos_media, pos);
if (conn == ((void *)0))
return ((void *)0);
return conn->c_addrtype;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#rsa-sha256-sign_prep#nettle_rsa_sha256_sign_digest.c | nettle-3.9.1 | rsa-sha256-sign.c | nettle_rsa_sha256_sign_digest | 16 | int
nettle_rsa_sha256_sign_digest(const struct rsa_private_key *key,
const uint8_t *digest,
mpz_t s)
{
if (nettle_pkcs1_rsa_sha256_encode_digest(s, key->size, digest))
{
nettle_rsa_compute_root(key, s, s);
return 1;
}
else
{
__gmpz_set_ui(s, 0);
return 0;
}
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#MINIMUM_STEPS_TO_DELETE_A_STRING_AFTER_REPEATED_DELETION_OF_PALINDROME_SUBSTRINGS_prep#f_filled.c | transcoder-set | MINIMUM_STEPS_TO_DELETE_A_STRING_AFTER_REPEATED_DELETION_OF_PALINDROME_SUBSTRINGS.c | f_filled | 1 | int f_filled ( char str [] ) {}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_inf_and_nan_prep#json_skip_whitespace.c | json.h | allow_inf_and_nan.c | json_skip_whitespace | 35 | int json_skip_whitespace(struct json_parse_state_s *state) {
size_t offset = state->offset;
const size_t size = state->size;
const char *const src = state->src;
if (offset >= state->size) {
return 0;
}
switch (src[offset]) {
default:
return 0;
case ' ':
case '\r':
case '\t':
case '\n':
break;
}
do {
switch (src[offset]) {
default:
state->offset = offset;
return 1;
case ' ':
case '\r':
case '\t':
break;
case '\n':
state->line_no++;
state->line_offset = offset;
break;
}
offset++;
} while (offset < size);
state->offset = offset;
return 1;
}
| {
"array_type": 1,
"break_continue_statement": 3,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 4,
"struct_type": 1,
"switch_statement": 2,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
mcsim-6.2.0#matutil_prep#ColumnMeans.c | mcsim-6.2.0 | matutil.c | ColumnMeans | 8 | void ColumnMeans (long cRows, long cCols, double **x, double *x_bar)
{
register long i, l;
for (l = 0; l < cCols; l++) x_bar[l] = 0.0;
for (i = 0; i < cRows; i++)
for (l = 0; l < cCols; l++) x_bar[l] += x[i][l];
for (l = 0; l < cCols; l++) x_bar[l] /= cRows;
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 4,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#COUNT_OFDIFFERENT_WAYS_EXPRESS_N_SUM_1_3_4_prep#sort.c | transcoder-set | COUNT_OFDIFFERENT_WAYS_EXPRESS_N_SUM_1_3_4.c | sort | 1 | void sort (int arr [ ], int n) {qsort (arr, n, sizeof(int), cmpfunc);}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
patch-2.7.6#hard-locale_prep#hard_locale.c | patch-2.7.6 | hard-locale.c | hard_locale | 29 | _Bool
hard_locale (int category)
{
_Bool hard = 1;
char const *p = setlocale (category, ((void *)0));
if (p)
{
if (2 <= 2)
{
if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0)
hard = 0;
}
else
{
char *locale = strdup (p);
if (locale)
{
if (((p = setlocale (category, "C"))
&& strcmp (p, locale) == 0)
|| ((p = setlocale (category, "POSIX"))
&& strcmp (p, locale) == 0))
hard = 0;
setlocale (category, locale);
free (locale);
}
}
}
return hard;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
heman#mat3_prep#kmMat3Translation.c | heman | mat3.c | kmMat3Translation | 7 | kmMat3* kmMat3Translation(kmMat3* pOut, const float x, const float y)
{
kmMat3Identity(pOut);
pOut->mat[6] = x;
pOut->mat[7] = y;
return pOut;
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#ma2asm_inst_prep#Pl_Ret.c | gprolog-1.5.0 | ma2asm_inst.c | Pl_Ret | 5 | void
Pl_Ret(void)
{
Inst_Printf("jmp", "*%s", asm_reg_cp);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
mtools-4.0.43#file_prep#getDirCacheP.c | mtools-4.0.43 | file.c | getDirCacheP | 4 | struct dirCache_t **getDirCacheP(Stream_t *Stream)
{
return &getUnbufferedFile(Stream)->dcp;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#DYNAMIC_PROGRAMMING_HIGH_EFFORT_VS_LOW_EFFORT_TASKS_PROBLEM_prep#f_filled.c | transcoder-set | DYNAMIC_PROGRAMMING_HIGH_EFFORT_VS_LOW_EFFORT_TASKS_PROBLEM.c | f_filled | 1 | int f_filled ( int high [ ], int low [ ], int n ) {}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#linedit_prep#Pl_LE_Compl_Del_Word.c | gprolog-1.5.0 | linedit.c | Pl_LE_Compl_Del_Word | 19 | char *
Pl_LE_Compl_Del_Word(char *word)
{
CompNode **p;
CompNode *q;
int cmp;
for (p = &comp_start; *p; p = &(*p)->next)
{
cmp = strcmp((*p)->word, word);
if (cmp == 0)
break;
if (cmp > 0)
return ((void *)0);
}
q = *p;
*p = q->next;
free(q);
return word;
}
| {
"array_type": 0,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#COMPOSITE_NUMBER_prep#len.c | transcoder-set | COMPOSITE_NUMBER.c | len | 1 | int len (int arr [ ]) {return ((int) (sizeof (arr) / sizeof (arr)[0]));}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#arith_inl_c_prep#Pl_Fct_Fast_Div.c | gprolog-1.5.0 | arith_inl_c.c | Pl_Fct_Fast_Div | 9 | WamWord
Pl_Fct_Fast_Div(WamWord x, WamWord y)
{
PlLong vx = ((PlLong) ((x) << 0) >> 3);
PlLong vy = ((PlLong) ((y) << 0) >> 3);
if (vy == 0)
Pl_Err_Evaluation(pl_evaluation_zero_divisor);
return (((PlULong) (vx / vy) << 3) | (PlULong)0x7);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#COUNT_STRINGS_CAN_FORMED_USING_B_C_GIVEN_CONSTRAINTS_1_prep#len.c | transcoder-set | COUNT_STRINGS_CAN_FORMED_USING_B_C_GIVEN_CONSTRAINTS_1.c | len | 1 | int len (int arr [ ]) {return ((int) (sizeof (arr) / sizeof (arr)[0]));}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_PATTERNS_101_GIVEN_STRING_prep#f_filled.c | transcoder-set | FIND_PATTERNS_101_GIVEN_STRING.c | f_filled | 1 | int f_filled ( char str [] ) {}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
bc-1.07.1#load_prep#def_label.c | bc-1.07.1 | load.c | def_label | 26 | void
def_label (unsigned long lab)
{
bc_label_group *temp;
unsigned long group, offset, func;
group = lab >> 6;
offset = lab % 64;
func = load_adr.pc_func;
if (functions[func].f_label == ((void *)0))
{
functions[func].f_label = bc_malloc (sizeof(bc_label_group));
functions[func].f_label->l_next = ((void *)0);
}
temp = functions[func].f_label;
while (group > 0)
{
if (temp->l_next == ((void *)0))
{
temp->l_next = bc_malloc (sizeof(bc_label_group));
temp->l_next->l_next = ((void *)0);
}
temp = temp->l_next;
group --;
}
temp->l_adrs [offset] = load_adr.pc_addr;
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 1
} |
screen-4.9.0#socket_prep#SendErrorMsg.c | screen-4.9.0 | socket.c | SendErrorMsg | 23 | int
SendErrorMsg(tty, buf)
char *tty, *buf;
{
int s;
struct msg m;
_Bool is_socket;
do {} while (0);
strncpy(m.m.message, buf, sizeof(m.m.message) - 1);
m.m.message[sizeof(m.m.message) - 1] = 0;
is_socket = IsSocket(SockPath);
s = MakeClientSocket(0, is_socket);
if (s < 0)
return -1;
m.type = 1;
strncpy(m.m_tty, tty, sizeof(m.m_tty) - 1);
m.m_tty[sizeof(m.m_tty) - 1] = 0;
m.protocol_revision = (('m'<<24) | ('s'<<16) | ('g'<<8) | 5);
do {} while (0);
(void) write(s, (char *) &m, sizeof m);
close(s);
return 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 2
} |
findutils-4.9.0#ioctl_prep#rpl_ioctl.c | findutils-4.9.0 | ioctl.c | rpl_ioctl | 10 | int
rpl_ioctl (int fd, int request, ... )
{
void *buf;
va_list args;
__builtin_va_start(args,request);
buf = __builtin_va_arg(args,void *);
__builtin_va_end(args);
return ioctl (fd, (unsigned int) request, buf);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#parserInternals_prep#xmlCtxtNewInputFromString.c | libxml2 | parserInternals.c | xmlCtxtNewInputFromString | 15 | xmlParserInputPtr
xmlCtxtNewInputFromString(xmlParserCtxtPtr ctxt, const char *url,
const char *str, const char *encoding, int flags) {
xmlParserInputPtr input;
if ((ctxt == ((void *)0)) || (str == ((void *)0)))
return(((void *)0));
input = xmlNewInputFromString(url, str, flags);
if (input == ((void *)0)) {
xmlCtxtErrMemory(ctxt);
return(((void *)0));
}
if (encoding != ((void *)0))
xmlSwitchInputEncodingName(ctxt, input, encoding);
return(input);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 5,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlunicode_prep#xmlUCSIsKangxiRadicals.c | libxml2 | xmlunicode.c | xmlUCSIsKangxiRadicals | 4 | int
xmlUCSIsKangxiRadicals(int code) {
return(((code >= 0x2F00) && (code <= 0x2FDF)));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
tulipindicators-0.9.1#typprice_prep#ti_typprice_start.c | tulipindicators-0.9.1 | typprice.c | ti_typprice_start | 4 | int ti_typprice_start(double const *options) {
(void)options;
return 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#arith_inl_c_prep#Pl_Fct_Abs.c | gprolog-1.5.0 | arith_inl_c.c | Pl_Fct_Abs | 5 | WamWord
Pl_Fct_Abs(WamWord x)
{
return ((((PlLong) (x) & ((PlULong)0x7)) == (PlULong)0x7)) ? Pl_Fct_Fast_Abs(x) : Make_Tagged_Float(fabs(To_Double(x)));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
wget-1.21.4#css__prep#yy_flush_buffer.c | wget-1.21.4 | css_.c | yy_flush_buffer | 13 | void yy_flush_buffer (YY_BUFFER_STATE b )
{
if ( ! b )
return;
b->yy_n_chars = 0;
b->yy_ch_buf[0] = 0;
b->yy_ch_buf[1] = 0;
b->yy_buf_pos = &b->yy_ch_buf[0];
b->yy_at_bol = 1;
b->yy_buffer_status = 0;
if ( b == ( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : ((void *)0)) )
yy_load_buffer_state( );
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
ed-1.19#main_prep#traditional.c | ed-1.19 | main.c | traditional | 1 | bool traditional( void ) { return traditional_; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
less-633#option_prep#getnum.c | less-633 | option.c | getnum | 23 | int getnum(char **sp, char *printopt, int *errp)
{
char *s;
int n;
int neg;
s = skipsp(*sp);
neg = 0;
if (*s == '-')
{
neg = 1;
s++;
}
if (*s < '0' || *s > '9')
return (num_error(printopt, errp, 0));
n = lstrtoi(s, sp, 10);
if (n < 0)
return (num_error(printopt, errp, 1));
if (errp != ((void *)0))
*errp = 0;
if (neg)
n = -n;
return (n);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
wget-1.21.4#css__prep#yyset_debug.c | wget-1.21.4 | css_.c | yyset_debug | 4 | void yyset_debug (int _bdebug )
{
yy_flex_debug = _bdebug ;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_ONE_EXTRA_CHARACTER_STRING_1_prep#main.c | transcoder-set | FIND_ONE_EXTRA_CHARACTER_STRING_1.c | main | 15 | int main(void) {
int n_success = 0;
char param0[][100] = {"obfLA mmMYvghH","2941","0111111","oWvbFstI","4937516500","101110100","hYZscJQFBE","58443","1100","ZUdYuIBVNaeeb"};
char param1[][100] = {"obfLA mmMYvghH","23941","01011111","oWvsbFstI","49376516500","1011210100","hYZscJQQFBE","584443","11000","ZUdYVuIBVNaeeb"};
for(int i = 0; i < len(param0); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
break;
}
printf("#Results:", " ", n_success, ", ", len(param0));
return 0;
}
| {
"array_type": 2,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#SUM_OF_ALL_ELEMENTS_UP_TO_NTH_ROW_IN_A_PASCALS_TRIANGLE_prep#min.c | transcoder-set | SUM_OF_ALL_ELEMENTS_UP_TO_NTH_ROW_IN_A_PASCALS_TRIANGLE.c | min | 1 | int min(int x, int y) { return (x < y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
optipng-0.7.8#pngrio_prep#png_default_read_data.c | optipng-0.7.8 | pngrio.c | png_default_read_data | 10 | void
png_default_read_data(png_structp png_ptr, png_bytep data, size_t length)
{
size_t check;
if (png_ptr == ((void *)0))
return;
check = fread(data, 1, length, (png_ptr->io_ptr));
if (check != length)
png_error(png_ptr, "Read Error");
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_leading_plus_sign_prep#utest_main.c | json.h | allow_leading_plus_sign.c | utest_main | 118 | __attribute__((weak)) int utest_main(int argc, const char *const argv[]) {
utest_uint64_t failed = 0;
size_t index = 0;
size_t *failed_testcases = 0;
size_t failed_testcases_length = 0;
const char *filter = 0;
utest_uint64_t ran_tests = 0;
enum colours { RESET, GREEN, RED };
const int use_colours = (isatty(1));
const char *colours[] = {"\033[0m", "\033[32m", "\033[31m"};
if (!use_colours) {
for (index = 0; index < sizeof colours / sizeof colours[0]; index++) {
colours[index] = "";
}
}
for (index = 1; index < ((size_t)argc); index++) {
const char help_str[] = "--help";
const char list_str[] = "--list-tests";
const char filter_str[] = "--filter=";
const char output_str[] = "--output=";
if (0 == utest_strncmp(argv[index], help_str, strlen(help_str))) {
printf("utest.h - the single file unit testing solution for C/C++!\n"
"Command line Options:\n"
" --help Show this message and exit.\n"
" --filter=<filter> Filter the test cases to run (EG. MyTest*.a "
"would run MyTestCase.a but not MyTestCase.b).\n"
" --list-tests List testnames, one per line. Output names "
"can be passed to --filter.\n"
" --output=<output> Output an xunit XML file to the file "
"specified in <output>.\n");
goto cleanup;
} else if (0 ==
utest_strncmp(argv[index], filter_str, strlen(filter_str))) {
filter = argv[index] + strlen(filter_str);
} else if (0 ==
utest_strncmp(argv[index], output_str, strlen(output_str))) {
utest_state.output = utest_fopen(argv[index] + strlen(output_str), "w+");
} else if (0 == utest_strncmp(argv[index], list_str, strlen(list_str))) {
for (index = 0; index < utest_state.tests_length; index++) {
if (utest_state.output) { fprintf(utest_state.output, "%s\n", utest_state.tests[index].name); } printf("%s\n", utest_state.tests[index].name);
}
return 0;
}
}
for (index = 0; index < utest_state.tests_length; index++) {
if (utest_should_filter_test(filter, utest_state.tests[index].name)) {
continue;
}
ran_tests++;
}
printf("%s[==========]%s Running %" "l" "u" " test cases.\n",
colours[GREEN], colours[RESET], ((utest_uint64_t)ran_tests));
if (utest_state.output) {
fprintf(utest_state.output, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fprintf(utest_state.output,
"<testsuites tests=\"%" "l" "u" "\" name=\"All\">\n",
((utest_uint64_t)ran_tests));
fprintf(utest_state.output,
"<testsuite name=\"Tests\" tests=\"%" "l" "u" "\">\n",
((utest_uint64_t)ran_tests));
}
for (index = 0; index < utest_state.tests_length; index++) {
int result = 0;
utest_int64_t ns = 0;
if (utest_should_filter_test(filter, utest_state.tests[index].name)) {
continue;
}
printf("%s[ RUN ]%s %s\n", colours[GREEN], colours[RESET],
utest_state.tests[index].name);
if (utest_state.output) {
fprintf(utest_state.output, "<testcase name=\"%s\">",
utest_state.tests[index].name);
}
ns = utest_ns();
(*__errno_location ()) = 0;
utest_state.tests[index].func(&result, utest_state.tests[index].index);
ns = utest_ns() - ns;
if (utest_state.output) {
fprintf(utest_state.output, "</testcase>\n");
}
if (0 != result) {
const size_t failed_testcase_index = failed_testcases_length++;
failed_testcases = ((size_t *)realloc(((void *)failed_testcases), sizeof(size_t) * failed_testcases_length));
failed_testcases[failed_testcase_index] = index;
failed++;
printf("%s[ FAILED ]%s %s (%" "l" "d" "ns)\n", colours[RED],
colours[RESET], utest_state.tests[index].name, ns);
} else {
printf("%s[ OK ]%s %s (%" "l" "d" "ns)\n", colours[GREEN],
colours[RESET], utest_state.tests[index].name, ns);
}
}
printf("%s[==========]%s %" "l" "u" " test cases ran.\n", colours[GREEN],
colours[RESET], ran_tests);
printf("%s[ PASSED ]%s %" "l" "u" " tests.\n", colours[GREEN],
colours[RESET], ran_tests - failed);
if (0 != failed) {
printf("%s[ FAILED ]%s %" "l" "u" " tests, listed below:\n",
colours[RED], colours[RESET], failed);
for (index = 0; index < failed_testcases_length; index++) {
printf("%s[ FAILED ]%s %s\n", colours[RED], colours[RESET],
utest_state.tests[failed_testcases[index]].name);
}
}
if (utest_state.output) {
fprintf(utest_state.output, "</testsuite>\n</testsuites>\n");
}
cleanup:
for (index = 0; index < utest_state.tests_length; index++) {
free(((void *)utest_state.tests[index].name));
}
free(((void *)failed_testcases));
free(((void *)utest_state.tests));
if (utest_state.output) {
fclose(utest_state.output);
}
return ((int)failed);
}
| {
"array_type": 5,
"break_continue_statement": 2,
"enum_type": 0,
"for_loop": 7,
"function_pointer": 0,
"goto_statement": 1,
"if_statement": 15,
"memory_management": 4,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 6,
"union_type": 0,
"while_loop": 0
} |
patch-2.7.6#quotearg_prep#quote.c | patch-2.7.6 | quotearg.c | quote | 5 | char const *
quote (char const *arg)
{
return quote_n (0, arg);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
uucp-1.07#getopt_prep#gnu_getopt.c | uucp-1.07 | getopt.c | gnu_getopt | 11 | int
gnu_getopt (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
(int *) 0,
0);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#machine_prep#Pl_M_Set_Working_Dir.c | gprolog-1.5.0 | machine.c | Pl_M_Set_Working_Dir | 6 | Bool
Pl_M_Set_Working_Dir(char *path)
{
char *new_path = Pl_M_Absolute_Path_Name(path);
return (new_path != ((void *)0) && chdir(new_path) == 0);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlUCSIsNumberForms.c | libxml2 | libxml2-py.c | libxml_xmlUCSIsNumberForms | 13 | PyObject *
libxml_xmlUCSIsNumberForms(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
int c_retval;
int code;
if (libxml_deprecationWarning("xmlUCSIsNumberForms") == -1)
return(((void *)0));
if (!_PyArg_ParseTuple_SizeT(args, (char *)"i:xmlUCSIsNumberForms", &code))
return(((void *)0));
c_retval = xmlUCSIsNumberForms(code);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#xheader_prep#xheader_xhdr_name.c | tar-1.34 | xheader.c | xheader_xhdr_name | 7 | char *
xheader_xhdr_name (struct tar_stat_info *st)
{
if (!exthdr_name)
assign_string (&exthdr_name, header_template[pax_file_header][posixly_correct]);
return xheader_format_name (st, exthdr_name, 0);
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
mtools-4.0.43#init_prep#GetFs.c | mtools-4.0.43 | init.c | GetFs | 6 | Stream_t *GetFs(Stream_t *Fs)
{
while(Fs && Fs->Class != &FsClass)
Fs = Fs->Next;
return Fs;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
json.h#allow_location_information_prep#json_parse_array.c | json.h | allow_location_information.c | json_parse_array | 57 | void json_parse_array(struct json_parse_state_s *state,
struct json_array_s *array) {
const char *const src = state->src;
const size_t size = state->size;
size_t elements = 0;
int allow_comma = 0;
struct json_array_element_s *previous = 0;
state->offset++;
(void)json_skip_all_skippables(state);
elements = 0;
do {
struct json_array_element_s *element = 0;
struct json_value_s *value = 0;
(void)json_skip_all_skippables(state);
if (']' == src[state->offset]) {
state->offset++;
break;
}
if (allow_comma) {
if (',' == src[state->offset]) {
state->offset++;
allow_comma = 0;
continue;
}
}
element = (struct json_array_element_s *)state->dom;
state->dom += sizeof(struct json_array_element_s);
if (0 == previous) {
array->start = element;
} else {
previous->next = element;
}
previous = element;
if (json_parse_flags_allow_location_information & state->flags_bitset) {
struct json_value_ex_s *value_ex = (struct json_value_ex_s *)state->dom;
state->dom += sizeof(struct json_value_ex_s);
value_ex->offset = state->offset;
value_ex->line_no = state->line_no;
value_ex->row_no = state->offset - state->line_offset;
value = &(value_ex->value);
} else {
value = (struct json_value_s *)state->dom;
state->dom += sizeof(struct json_value_s);
}
element->value = value;
json_parse_value(state, 0, value);
elements++;
allow_comma = 1;
} while (state->offset < size);
if (previous) {
previous->next = 0;
}
if (0 == elements) {
array->start = 0;
}
array->length = elements;
}
| {
"array_type": 0,
"break_continue_statement": 2,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 7,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 4,
"return_statement": 0,
"struct_type": 6,
"switch_statement": 0,
"type_casting": 8,
"union_type": 0,
"while_loop": 1
} |
transcoder-set#COUNT_PAIRS_DIFFERENCE_EQUAL_K_prep#f_gold.c | transcoder-set | COUNT_PAIRS_DIFFERENCE_EQUAL_K.c | f_gold | 11 | int f_gold ( int arr [ ], int n, int k ) {
int count = 0;
for ( int i = 0;
i < n;
i ++ ) {
for ( int j = i + 1;
j < n;
j ++ ) if ( arr [ i ] - arr [ j ] == k || arr [ j ] - arr [ i ] == k ) count ++;
}
return count;
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#parser_prep#xmlCheckLanguageID.c | libxml2 | parser.c | xmlCheckLanguageID | 105 | int
xmlCheckLanguageID(const xmlChar * lang)
{
const xmlChar *cur = lang, *nxt;
if (cur == ((void *)0))
return (0);
if (((cur[0] == 'i') && (cur[1] == '-')) ||
((cur[0] == 'I') && (cur[1] == '-')) ||
((cur[0] == 'x') && (cur[1] == '-')) ||
((cur[0] == 'X') && (cur[1] == '-'))) {
cur += 2;
while (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
return(cur[0] == 0);
}
nxt = cur;
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if (nxt - cur >= 4) {
if ((nxt - cur > 8) || (nxt[0] != 0))
return(0);
return(1);
}
if (nxt - cur < 2)
return(0);
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
nxt++;
cur = nxt;
if ((nxt[0] >= '0') && (nxt[0] <= '9'))
goto region_m49;
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if (nxt - cur == 4)
goto script;
if (nxt - cur == 2)
goto region;
if ((nxt - cur >= 5) && (nxt - cur <= 8))
goto variant;
if (nxt - cur != 3)
return(0);
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
nxt++;
cur = nxt;
if ((nxt[0] >= '0') && (nxt[0] <= '9'))
goto region_m49;
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if (nxt - cur == 2)
goto region;
if ((nxt - cur >= 5) && (nxt - cur <= 8))
goto variant;
if (nxt - cur != 4)
return(0);
script:
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
nxt++;
cur = nxt;
if ((nxt[0] >= '0') && (nxt[0] <= '9'))
goto region_m49;
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if ((nxt - cur >= 5) && (nxt - cur <= 8))
goto variant;
if (nxt - cur != 2)
return(0);
region:
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
nxt++;
cur = nxt;
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if ((nxt - cur < 5) || (nxt - cur > 8))
return(0);
variant:
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
return (1);
region_m49:
if (((nxt[1] >= '0') && (nxt[1] <= '9')) &&
((nxt[2] >= '0') && (nxt[2] <= '9'))) {
nxt += 3;
goto region;
}
return(0);
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 10,
"if_statement": 29,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 21,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 6
} |
gzip-1.12#printf-args_prep#printf_fetchargs.c | gzip-1.12 | printf-args.c | printf_fetchargs | 95 | int
printf_fetchargs (va_list args, arguments *a)
{
size_t i;
argument *ap;
for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
switch (ap->type)
{
case TYPE_SCHAR:
ap->a.a_schar = __builtin_va_arg(args,int);
break;
case TYPE_UCHAR:
ap->a.a_uchar = __builtin_va_arg(args,int);
break;
case TYPE_SHORT:
ap->a.a_short = __builtin_va_arg(args,int);
break;
case TYPE_USHORT:
ap->a.a_ushort = __builtin_va_arg(args,int);
break;
case TYPE_INT:
ap->a.a_int = __builtin_va_arg(args,int);
break;
case TYPE_UINT:
ap->a.a_uint = __builtin_va_arg(args,unsigned int);
break;
case TYPE_LONGINT:
ap->a.a_longint = __builtin_va_arg(args,long int);
break;
case TYPE_ULONGINT:
ap->a.a_ulongint = __builtin_va_arg(args,unsigned long int);
break;
case TYPE_LONGLONGINT:
ap->a.a_longlongint = __builtin_va_arg(args,long long int);
break;
case TYPE_ULONGLONGINT:
ap->a.a_ulonglongint = __builtin_va_arg(args,unsigned long long int);
break;
case TYPE_DOUBLE:
ap->a.a_double = __builtin_va_arg(args,double);
break;
case TYPE_LONGDOUBLE:
ap->a.a_longdouble = __builtin_va_arg(args,long double);
break;
case TYPE_CHAR:
ap->a.a_char = __builtin_va_arg(args,int);
break;
case TYPE_WIDE_CHAR:
ap->a.a_wide_char =
(sizeof (wint_t) < sizeof (int)
? (wint_t) __builtin_va_arg(args,int)
: __builtin_va_arg(args,wint_t));
break;
case TYPE_STRING:
ap->a.a_string = __builtin_va_arg(args,const char *);
if (ap->a.a_string == ((void *)0))
ap->a.a_string = "(NULL)";
break;
case TYPE_WIDE_STRING:
ap->a.a_wide_string = __builtin_va_arg(args,const wchar_t *);
if (ap->a.a_wide_string == ((void *)0))
{
static const wchar_t wide_null_string[] =
{
(wchar_t)'(',
(wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
(wchar_t)')',
(wchar_t)0
};
ap->a.a_wide_string = wide_null_string;
}
break;
case TYPE_POINTER:
ap->a.a_pointer = __builtin_va_arg(args,void *);
break;
case TYPE_COUNT_SCHAR_POINTER:
ap->a.a_count_schar_pointer = __builtin_va_arg(args,signed char *);
break;
case TYPE_COUNT_SHORT_POINTER:
ap->a.a_count_short_pointer = __builtin_va_arg(args,short *);
break;
case TYPE_COUNT_INT_POINTER:
ap->a.a_count_int_pointer = __builtin_va_arg(args,int *);
break;
case TYPE_COUNT_LONGINT_POINTER:
ap->a.a_count_longint_pointer = __builtin_va_arg(args,long int *);
break;
case TYPE_COUNT_LONGLONGINT_POINTER:
ap->a.a_count_longlongint_pointer = __builtin_va_arg(args,long long int *);
break;
default:
return -1;
}
return 0;
}
| {
"array_type": 1,
"break_continue_statement": 22,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 1,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_htmlParseCharRef.c | libxml2 | libxml2-py.c | libxml_htmlParseCharRef | 15 | PyObject *
libxml_htmlParseCharRef(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
int c_retval;
htmlParserCtxtPtr ctxt;
PyObject *pyobj_ctxt;
if (libxml_deprecationWarning("htmlParseCharRef") == -1)
return(((void *)0));
if (!_PyArg_ParseTuple_SizeT(args, (char *)"O:htmlParseCharRef", &pyobj_ctxt))
return(((void *)0));
ctxt = (htmlParserCtxtPtr) (((pyobj_ctxt) == (&_Py_NoneStruct)) ? ((void *)0) : (((PyparserCtxt_Object *)(pyobj_ctxt))->obj));
c_retval = htmlParseCharRef(ctxt);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 5,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_simplified_json_prep#json_value_is_false.c | json.h | allow_simplified_json.c | json_value_is_false | 3 | int json_value_is_false(const struct json_value_s *const value) {
return value->type == json_type_false;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#BIRTHDAY_PARADOX_prep#len.c | transcoder-set | BIRTHDAY_PARADOX.c | len | 1 | int len (int arr [ ]) {return ((int) (sizeof (arr) / sizeof (arr)[0]));}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_global_object_prep#json_parse_key.c | json.h | allow_global_object.c | json_parse_key | 23 | void json_parse_key(struct json_parse_state_s *state,
struct json_string_s *string) {
if (json_parse_flags_allow_unquoted_keys & state->flags_bitset) {
const char *const src = state->src;
char *const data = state->data;
size_t offset = state->offset;
if (('"' == src[offset]) || ('\'' == src[offset])) {
json_parse_string(state, string);
} else {
size_t size = 0;
string->string = state->data;
while (is_valid_unquoted_key_char(src[offset])) {
data[size++] = src[offset++];
}
data[size] = '\0';
string->string_size = size++;
state->data += size;
state->offset = offset;
}
} else {
json_parse_string(state, string);
}
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 2,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
wget-1.21.4#ptimer_prep#ptimer_destroy.c | wget-1.21.4 | ptimer.c | ptimer_destroy | 5 | void
ptimer_destroy (struct ptimer *pt)
{
do { free ((void *) (pt)); pt = ((void *)0); } while (0);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 1
} |
bc-1.07.1#execute_prep#byte.c | bc-1.07.1 | execute.c | byte | 5 | unsigned char
byte ( program_counter *p )
{
return (functions[p->pc_func].f_body[p->pc_addr++]);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
optipng-0.7.8#infback_prep#inflateBackInit_.c | optipng-0.7.8 | infback.c | inflateBackInit_ | 30 | int inflateBackInit_(z_streamp strm, int windowBits,
unsigned char *window, const char *version,
int stream_size) {
struct inflate_state *state;
if (version == 0 || version[0] != "1.3-optipng"[0] ||
stream_size != (int)(sizeof(z_stream)))
return (-6);
if (strm == 0 || window == 0 ||
windowBits < 8 || windowBits > 15)
return (-2);
strm->msg = 0;
if (strm->zalloc == (alloc_func)0) {
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0;
}
if (strm->zfree == (free_func)0)
strm->zfree = zcfree;
state = (struct inflate_state *)(*((strm)->zalloc))((strm)->opaque, (1), (sizeof(struct inflate_state)));
if (state == 0) return (-4);
;
strm->state = (struct internal_state *)state;
state->dmax = 32768U;
state->wbits = (uInt)windowBits;
state->wsize = 1U << windowBits;
state->window = window;
state->wnext = 0;
state->whave = 0;
state->sane = 1;
return 0;
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 4,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#HOW_TO_TURN_OFF_A_PARTICULAR_BIT_IN_A_NUMBER_prep#max.c | transcoder-set | HOW_TO_TURN_OFF_A_PARTICULAR_BIT_IN_A_NUMBER.c | max | 1 | int max(int x, int y) { return (x > y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#xpath_prep#xmlInitXPathInternal.c | libxml2 | xpath.c | xmlInitXPathInternal | 7 | __attribute__((no_sanitize("float-divide-by-zero")))
void
xmlInitXPathInternal(void) {
xmlXPathNAN = (__builtin_nanf (""));
xmlXPathPINF = (__builtin_inff ());
xmlXPathNINF = -(__builtin_inff ());
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.