📄 report.c
字号:
#include <stdio.h>
#include <stdarg.h>
#include "utility.h"
#include "symbol.h"
extern long returnlabel;
int error_count, warning_count;
static char *error_message[ERROR_MAPPER]={
"can not open file", //0
"unknown character", //1
"unknown size", //2
"syntax error", //3
"unknown preprocess directive", //4
"wrong preprocess directive format", //5
"unknown constant value", //6
"redefine viriable", //7
"wrong basic data type",//8
"redefined type", //9
"types conflict", //10
"expected constant expression", //11
"expected positive value", //12
"redefined member", //13
"no struct/union members",//14
"can not allocate memory of zero size",//15
"unknown identifier", //16
"not match the parameter", //17
"to few arguments in function call",//18
"expected a function name or function pointer", //19
"expected a pointer", //20
"expected a struct/union type when ./-> operator", //21
"not a member name", //22
"expected a integer", //23
"expected a variable", //24
"storage class error", //25
"redefined function", //26
"declaration differs from the previous", //27
"array element type can not be function", //28
"redefined label", //29
"not in a loop/switch", //30
"not found label", //31
"more than one default action in switch"
};
void generror(int errcode, const char *info)
{
error_count++;
if(returnlabel == UNKNOWN)fprintf(stderr, "%s(%d): error: %s -- %s\n",
currentfile, lineno, error_message[errcode], info);
else fprintf(stderr, "%s: error: %s -- %s\n",
currentfile, error_message[errcode], info);
}
void genwarning(int errcode, const char *info)
{
warning_count++;
fprintf(stderr, "%s(%d): warning: %s -- %s\n",
currentfile, lineno, error_message[errcode], info);
}
int report()
{
fprintf(stderr, "%-10s ---- %2d error(s), %2d warning(s)\n",
currentfile, error_count, warning_count);
return error_count;
}
void
debug(const char *info, ...)
{
va_list ap;
va_start(ap, info);
vfprintf(stderr, info, ap);
va_end(ap);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -