<commit_before>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../inc/sizes.h"
#include "../inc/cc.h"
#include "cc1.h"

unsigned yytoken;
struct yystype yylval;
char yytext[STRINGSIZ+3];
unsigned short yylen;
int cppoff;
int lexmode = CCMODE;

static unsigned lex_ns = NS_IDEN;
static int safe, eof;
Input *input;

static void
allocinput(char *fname, FILE *fp)
{
	Input *ip;

	ip = xmalloc(sizeof(Input));
	ip->fname = xstrdup(fname);
	ip->p = ip->begin = ip->line = xmalloc(INPUTSIZ);
	ip->nline = 0;
	ip->next = input;
	ip->fp = fp;
	input = ip;
}

void
ilex(char *fname)
{
	FILE *fp;

	if (!fname) {
		fp = stdin;
		fname = "<stdin>";
	} else {
		if ((fp = fopen(fname, "r")) == NULL)
			die("error opening output:%s", strerror(errno));
		fname = fname;
	}
	allocinput(fname, fp);
	*input->begin = '\0';
}

bool
addinput(char *fname)
{
	FILE *fp;

	if ((fp = fopen(fname, "r")) == NULL)
		return 0;
	allocinput(fname, fp);
	return 1;
}<commit_msg>Add file name in file error reports<commit_after>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../inc/sizes.h"
#include "../inc/cc.h"
#include "cc1.h"

unsigned yytoken;
struct yystype yylval;
char yytext[STRINGSIZ+3];
unsigned short yylen;
int cppoff;
int lexmode = CCMODE;

static unsigned lex_ns = NS_IDEN;
static int safe, eof;
Input *input;

static void
allocinput(char *fname, FILE *fp)
{
	Input *ip;

	ip = xmalloc(sizeof(Input));
	ip->fname = xstrdup(fname);
	ip->p = ip->begin = ip->line = xmalloc(INPUTSIZ);
	ip->nline = 0;
	ip->next = input;
	ip->fp = fp;
	input = ip;
}

void
ilex(char *fname)
{
	FILE *fp;

	if (!fname) {
		fp = stdin;
		fname = "<stdin>";
	} else {
		if ((fp = fopen(fname, "r")) == NULL) {
			die("error opening input '%s':%s",
			    fname, strerror(errno));
		}	
	}
	allocinput(fname, fp);
	*input->begin = '\0';
}

bool
addinput(char *fname)
{
	FILE *fp;

	if ((fp = fopen(fname, "r")) == NULL)
		return 0;
	allocinput(fname, fp);
	return 1;
}
{'fraction_non_alphanumeric': 0.18632958801498128, 'fraction_numerical': 0.0056179775280898875, 'mean_word_length': 3.946759259259259, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6452228', 'n_tokens_mistral': 951, 'n_tokens_neox': 918, 'n_words': 232}