forked from nuttx/nuttx-update
tools: fix nxstyle errors
Fix nxstyle errors to pass CI Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
parent
911bc68833
commit
00ac789e4e
11 changed files with 166 additions and 118 deletions
|
@ -33,10 +33,8 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* Based one the "Glyph Bitmap Distribution Format (BDF) Specification",
|
||||
/* Based one the "Glyph Bitmap Distribution Format (BDF) Specification",
|
||||
* Version 2.2, by Adobe Systems Incorporated.
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -60,9 +58,9 @@
|
|||
#endif
|
||||
|
||||
/* BDF Specification Version 2.2:
|
||||
* This version lifts the restriction on line length. In this version, the new
|
||||
* maximum length of a value of the type string is 65535 characters, and hence
|
||||
* lines may now be at least this long.
|
||||
* This version lifts the restriction on line length. In this version,
|
||||
* the new maximum length of a value of the type string is 65535 characters,
|
||||
* and hence lines may now be at least this long.
|
||||
*/
|
||||
|
||||
#define BDF_MAX_LINE_LENGTH 65535
|
||||
|
@ -117,7 +115,7 @@ typedef struct nx_fontmetric_s
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: MY_strtok_r
|
||||
* Name: my_strtok_r
|
||||
*
|
||||
* Description:
|
||||
* MinGW does not seem to provide strtok_r
|
||||
|
@ -125,7 +123,7 @@ typedef struct nx_fontmetric_s
|
|||
****************************************************************************/
|
||||
|
||||
#ifndef HAVE_STRTOK_R
|
||||
static char *MY_strtok_r(char *str, const char *delim, char **saveptr)
|
||||
static char *my_strtok_r(char *str, const char *delim, char **saveptr)
|
||||
{
|
||||
char *pbegin;
|
||||
char *pend = NULL;
|
||||
|
@ -187,15 +185,16 @@ static char *MY_strtok_r(char *str, const char *delim, char **saveptr)
|
|||
{
|
||||
*saveptr = pend;
|
||||
}
|
||||
|
||||
return pbegin;
|
||||
}
|
||||
|
||||
#undef strtok_r
|
||||
#define strtok_r MY_strtok_r
|
||||
#define strtok_r my_strtok_r
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: trimLine
|
||||
* Name: trimline
|
||||
*
|
||||
* Description:
|
||||
* Trims the line removing space characters at the front and at the end
|
||||
|
@ -206,15 +205,15 @@ static char *MY_strtok_r(char *str, const char *delim, char **saveptr)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void trimLine(char *line)
|
||||
static void trimline(char *line)
|
||||
{
|
||||
char *str;
|
||||
str = line;
|
||||
char *strEnd;
|
||||
for (strEnd = str + strlen(str) - 1;
|
||||
strEnd >= str && isspace((int)(*strEnd));
|
||||
strEnd--);
|
||||
*(strEnd + 1) = 0;
|
||||
char *strend;
|
||||
for (strend = str + strlen(str) - 1;
|
||||
strend >= str && isspace((int)(*strend));
|
||||
strend--);
|
||||
*(strend + 1) = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -240,7 +239,9 @@ static void trimLine(char *line)
|
|||
|
||||
static void bdf_parseintline(char *line, unsigned int count, int *info)
|
||||
{
|
||||
char *str, *token, *saveptr1;
|
||||
char *str;
|
||||
char *token;
|
||||
char *saveptr1;
|
||||
str = line;
|
||||
|
||||
/* Ignore the key */
|
||||
|
@ -331,21 +332,22 @@ static void bdf_printnxmetricinfo(const nx_fontmetric_t *info)
|
|||
static void bdf_getglyphinfo(FILE *file, glyphinfo_t *ginfo)
|
||||
{
|
||||
char line[BDF_MAX_LINE_LENGTH];
|
||||
char lineCopy[BDF_MAX_LINE_LENGTH];
|
||||
char *str, *token, *saveptr1;
|
||||
char linecopy[BDF_MAX_LINE_LENGTH];
|
||||
char *str;
|
||||
char *token;
|
||||
char *saveptr1;
|
||||
bool done;
|
||||
|
||||
done = false;
|
||||
|
||||
while (fgets(line, BDF_MAX_LINE_LENGTH, file) != NULL && !done)
|
||||
{
|
||||
trimLine(line);
|
||||
strcpy(lineCopy, line);
|
||||
trimline(line);
|
||||
strcpy(linecopy, line);
|
||||
str = line;
|
||||
|
||||
while ((token = (char *)strtok_r(str, " ", &saveptr1)))
|
||||
{
|
||||
|
||||
/* ENCODING information */
|
||||
|
||||
if (strcmp(token, "ENCODING") == 0)
|
||||
|
@ -369,13 +371,13 @@ static void bdf_getglyphinfo(FILE *file, glyphinfo_t *ginfo)
|
|||
else if (strcmp(token, "BBX") == 0)
|
||||
{
|
||||
int bbxinfo[4];
|
||||
bdf_parseintline(lineCopy, 4, bbxinfo);
|
||||
bdf_parseintline(linecopy, 4, bbxinfo);
|
||||
ginfo->bb_w = bbxinfo[0];
|
||||
ginfo->bb_h = bbxinfo[1];
|
||||
ginfo->bb_x_off = bbxinfo[2];
|
||||
ginfo->bb_y_off = bbxinfo[3];
|
||||
|
||||
/* This is the last BDF property of interest*/
|
||||
/* This is the last BDF property of interest */
|
||||
|
||||
done = true;
|
||||
}
|
||||
|
@ -411,7 +413,7 @@ static void bdf_getglyphbitmap(FILE *file, glyphinfo_t *ginfo)
|
|||
{
|
||||
if (fgets(line, BDF_MAX_LINE_LENGTH, file) != NULL)
|
||||
{
|
||||
trimLine(line);
|
||||
trimline(line);
|
||||
|
||||
if (strcmp(line, "ENDCHAR") == 0)
|
||||
{
|
||||
|
@ -446,6 +448,7 @@ static void bdf_getglyphbitmap(FILE *file, glyphinfo_t *ginfo)
|
|||
* return the stride.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void bdf_getstride(glyphinfo_t *ginfo, uint32_t *stride)
|
||||
{
|
||||
*stride = (ginfo->bb_w % 8 == 0) ? ginfo->bb_w / 8 : ginfo->bb_w / 8 + 1;
|
||||
|
@ -464,10 +467,13 @@ static void bdf_getstride(glyphinfo_t *ginfo, uint32_t *stride)
|
|||
* nxmetric - A nx_fontmetric_t struct with the glyph's information.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void bdf_printoutput(FILE *out,
|
||||
glyphinfo_t *ginfo,
|
||||
nx_fontmetric_t *nxmetric)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
/* Only interested in the 7 and 8 bit ranges */
|
||||
|
||||
|
@ -505,7 +511,7 @@ static void bdf_printoutput(FILE *out,
|
|||
/* Glyph bitmap */
|
||||
|
||||
fprintf(out, "#define NXFONT_BITMAP_%d {", ginfo->encoding);
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < ginfo->bb_h - 1; i++)
|
||||
{
|
||||
for (j = 1; j <= nxmetric->stride; j++)
|
||||
|
@ -557,17 +563,21 @@ int main(int argc, char **argv)
|
|||
{
|
||||
FILE *file, *out;
|
||||
char line[BDF_MAX_LINE_LENGTH];
|
||||
char lineCopy[BDF_MAX_LINE_LENGTH];
|
||||
char *str, *token, *saveptr1;
|
||||
char *input, *output;
|
||||
char linecopy[BDF_MAX_LINE_LENGTH];
|
||||
char *str;
|
||||
char *token;
|
||||
char *saveptr1;
|
||||
char *input;
|
||||
char *output;
|
||||
|
||||
/* FONTBOUNDINGBOX properties*/
|
||||
/* FONTBOUNDINGBOX properties */
|
||||
|
||||
int fbb_x = 0;
|
||||
int fbb_y = 0;
|
||||
//int fbb_x_off = 0;
|
||||
int fbb_y_off = 0;
|
||||
|
||||
/* int fbb_x_off = 0; */
|
||||
|
||||
/* Input BDF file */
|
||||
|
||||
input = argv[1];
|
||||
|
@ -615,32 +625,32 @@ int main(int argc, char **argv)
|
|||
{
|
||||
while (fgets(line, BDF_MAX_LINE_LENGTH, file) != NULL)
|
||||
{
|
||||
|
||||
#ifdef DBG
|
||||
printf("--\n");
|
||||
#endif /* DBG */
|
||||
|
||||
// Save a copy of the line
|
||||
/* Save a copy of the line */
|
||||
|
||||
strcpy(lineCopy,line);
|
||||
strcpy(linecopy, line);
|
||||
|
||||
// Clean it
|
||||
/* Clean it */
|
||||
|
||||
trimLine(line);
|
||||
trimline(line);
|
||||
str = line;
|
||||
|
||||
while ((token = (char *)strtok_r(str, " ", &saveptr1)))
|
||||
{
|
||||
|
||||
/* FONTBOUNDINGBOX - Global font information */
|
||||
|
||||
if (strcmp(token, "FONTBOUNDINGBOX") == 0)
|
||||
{
|
||||
int fbbinfo[4];
|
||||
bdf_parseintline(lineCopy, 4, fbbinfo);
|
||||
bdf_parseintline(linecopy, 4, fbbinfo);
|
||||
fbb_x = fbbinfo[0];
|
||||
fbb_y = fbbinfo[1];
|
||||
//fbb_x_off = fbbinfo[2];
|
||||
|
||||
/* fbb_x_off = fbbinfo[2]; */
|
||||
|
||||
fbb_y_off = fbbinfo[3];
|
||||
|
||||
/* Print FONTBOUNDINGBOX information */
|
||||
|
@ -666,10 +676,10 @@ int main(int argc, char **argv)
|
|||
#endif /* VERBOSE */
|
||||
|
||||
/* Glyph information:
|
||||
* ENCODING
|
||||
* DWIDTH
|
||||
* BBX
|
||||
*/
|
||||
* ENCODING
|
||||
* DWIDTH
|
||||
* BBX
|
||||
*/
|
||||
|
||||
ginfo.encoding = 0;
|
||||
ginfo.dw_x0 = 0;
|
||||
|
@ -699,7 +709,8 @@ int main(int argc, char **argv)
|
|||
nxmetric.height = ginfo.bb_h;
|
||||
|
||||
/* The NuttX font format does not support
|
||||
* negative X offsets. */
|
||||
* negative X offsets.
|
||||
*/
|
||||
|
||||
if (ginfo.bb_x_off < 0)
|
||||
{
|
||||
|
@ -727,7 +738,8 @@ int main(int argc, char **argv)
|
|||
if (ginfo.encoding == 32)
|
||||
{
|
||||
fprintf(out, "/* The width of a space */\n\n");
|
||||
fprintf(out, "#define NXFONT_SPACEWIDTH %d\n\n", ginfo.dw_x0);
|
||||
fprintf(out, "#define NXFONT_SPACEWIDTH %d\n\n",
|
||||
ginfo.dw_x0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -737,12 +749,10 @@ int main(int argc, char **argv)
|
|||
/* Free memory */
|
||||
|
||||
free(ginfo.bitmap);
|
||||
|
||||
}
|
||||
|
||||
str = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
@ -751,7 +761,6 @@ int main(int argc, char **argv)
|
|||
/* The End */
|
||||
|
||||
printf("Generated \"%s\"\n", output);
|
||||
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
@ -53,10 +53,10 @@
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
extern char line[LINESIZE+1];
|
||||
extern char line[LINESIZE + 1];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
* Public Functions Definitions
|
||||
****************************************************************************/
|
||||
|
||||
void generate_definitions(FILE *stream);
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
char line[LINESIZE+1];
|
||||
char line[LINESIZE + 1];
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
|
@ -85,14 +85,15 @@ static char *find_value_end(char *ptr)
|
|||
{
|
||||
if (*ptr == '"')
|
||||
{
|
||||
do ptr++; while (*ptr && *ptr != '"');
|
||||
if (*ptr) ptr++;
|
||||
do ptr++; while (*ptr && *ptr != '"');
|
||||
if (*ptr) ptr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"');
|
||||
do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"');
|
||||
}
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -102,7 +103,7 @@ static char *read_line(FILE *stream)
|
|||
{
|
||||
char *ptr;
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
line[LINESIZE] = '\0';
|
||||
if (!fgets(line, LINESIZE, stream))
|
||||
|
@ -239,7 +240,8 @@ void parse_file(FILE *stream, struct variable_s **list)
|
|||
* variable name and the value.
|
||||
*/
|
||||
|
||||
curr = (struct variable_s *)malloc(sizeof(struct variable_s) + varlen + vallen - 1);
|
||||
curr = (struct variable_s *)malloc(sizeof(struct variable_s) +
|
||||
varlen + vallen - 1);
|
||||
if (curr)
|
||||
{
|
||||
/* Add the variable to the list */
|
||||
|
@ -279,7 +281,8 @@ void parse_file(FILE *stream, struct variable_s **list)
|
|||
while (ptr);
|
||||
}
|
||||
|
||||
struct variable_s *find_variable(const char *varname, struct variable_s *list)
|
||||
struct variable_s *find_variable(const char *varname,
|
||||
struct variable_s *list)
|
||||
{
|
||||
while (list)
|
||||
{
|
||||
|
|
|
@ -65,13 +65,14 @@ struct variable_s
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
extern char line[LINESIZE+1];
|
||||
extern char line[LINESIZE + 1];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
* Public Functions Definitions
|
||||
****************************************************************************/
|
||||
|
||||
void parse_file(FILE *stream, struct variable_s **list);
|
||||
struct variable_s *find_variable(const char *varname, struct variable_s *list);
|
||||
struct variable_s *find_variable(const char *varname,
|
||||
struct variable_s *list);
|
||||
|
||||
#endif /* __TOOLS_CFGPARSER_H */
|
||||
|
|
|
@ -117,7 +117,8 @@ static bool dequote_path(const char *winpath)
|
|||
|
||||
while (*src && len < MAX_PATH)
|
||||
{
|
||||
if (src[0] != '\\' || (src[1] != ' ' && src[1] != '(' && src[1] != ')'))
|
||||
if (src[0] != '\\' || (src[1] != ' ' &&
|
||||
src[1] != '(' && src[1] != ')'))
|
||||
{
|
||||
*dest++ = *src;
|
||||
len++;
|
||||
|
@ -148,7 +149,8 @@ static bool convert_path(const char *winpath)
|
|||
|
||||
quoted = dequote_path(winpath);
|
||||
|
||||
size = cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, g_dequoted, NULL, 0);
|
||||
size = cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE,
|
||||
g_dequoted, NULL, 0);
|
||||
if (size > MAX_PATH)
|
||||
{
|
||||
fprintf(stderr, "%lu: POSIX path too long: %lu\n",
|
||||
|
@ -156,7 +158,8 @@ static bool convert_path(const char *winpath)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, g_dequoted, g_posix, MAX_PATH);
|
||||
ret = cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE,
|
||||
g_dequoted, g_posix, MAX_PATH);
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr, "%lu: cygwin_conv_path '%s' failed: %s\n",
|
||||
|
@ -245,7 +248,7 @@ int main(int argc, char **argv, char **envp)
|
|||
{
|
||||
printf("%s:", g_posix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
begin = false;
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static char g_lineA[LINESIZE + 3];
|
||||
static char g_lineB[LINESIZE + 3];
|
||||
static char g_linea[LINESIZE + 3];
|
||||
static char g_lineb[LINESIZE + 3];
|
||||
static char g_iobuffer[LINESIZE];
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -108,8 +108,8 @@ int main(int argc, char **argv)
|
|||
|
||||
/* Prime the pump */
|
||||
|
||||
g_line0 = g_lineA;
|
||||
g_line1 = g_lineB;
|
||||
g_line0 = g_linea;
|
||||
g_line1 = g_lineb;
|
||||
wasblank = true;
|
||||
wascomment = false;
|
||||
lastindent = 0;
|
||||
|
@ -214,13 +214,17 @@ int main(int argc, char **argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Check for a C++ style comment at this indentation in line n + 1 */
|
||||
/* Check for a C++ style comment
|
||||
* at this indentation in line n + 1
|
||||
*/
|
||||
|
||||
willbeblank = false;
|
||||
willbecomment = strncmp(ptr, "//", 2) == 0;
|
||||
}
|
||||
|
||||
/* Check for a C++ style comment at this indentation in line n + 1 */
|
||||
/* Check for a C++ style comment
|
||||
* at this indentation in line n + 1
|
||||
*/
|
||||
|
||||
willbecomment = strncmp(ptr, "//", 2) == 0;
|
||||
}
|
||||
|
@ -231,8 +235,8 @@ int main(int argc, char **argv)
|
|||
nextindent = 0;
|
||||
}
|
||||
|
||||
/* If current line is not a comment line, then check for a C++ style comment at the
|
||||
* end of the line.
|
||||
/* If current line is not a comment line, then check for a C++ style
|
||||
* comment at the end of the line.
|
||||
*/
|
||||
|
||||
if (!iscomment)
|
||||
|
@ -253,7 +257,8 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
printf("*****************************************************************************\n");
|
||||
printf("***************************************
|
||||
**************************************\n");
|
||||
printf("* %5lu. %s\n", lineno, g_line0);
|
||||
printf("* indent: last=%u curr=%u next=%u\n",
|
||||
lastindent, indent, nextindent);
|
||||
|
@ -261,7 +266,8 @@ int main(int argc, char **argv)
|
|||
wascomment, iscomment, willbecomment);
|
||||
printf("* blank: last=%u curr=%u next=%u\n",
|
||||
wasblank, isblank, willbeblank);
|
||||
printf("*****************************************************************************\n");
|
||||
printf("***************************************
|
||||
**************************************\n");
|
||||
|
||||
/* Does line n start with a comment */
|
||||
|
||||
|
@ -367,8 +373,8 @@ int main(int argc, char **argv)
|
|||
}
|
||||
else if (wascomment)
|
||||
{
|
||||
/* Line n is not a comment, but line n - 1 was. Output a closing on a
|
||||
* newline at the same indentation.
|
||||
/* Line n is not a comment, but line n - 1 was.
|
||||
* Output a closing on a newline at the same indentation.
|
||||
*/
|
||||
|
||||
memset(g_iobuffer, ' ', LINESIZE);
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
bool g_debug;
|
||||
char g_line[LINESIZE+1];
|
||||
char g_line[LINESIZE + 1];
|
||||
char g_parm[MAX_FIELDS][MAX_PARMSIZE];
|
||||
int g_lineno;
|
||||
|
||||
|
@ -97,7 +97,8 @@ static char *copy_parm(char *src, char *dest)
|
|||
}
|
||||
else if (*src == '\n' || *src == '\0')
|
||||
{
|
||||
fprintf(stderr, "%d: Unexpected end of line: \"%s\"\n", g_lineno, start);
|
||||
fprintf(stderr, "%d: Unexpected end of line: \"%s\"\n",
|
||||
g_lineno, start);
|
||||
exit(4);
|
||||
}
|
||||
else
|
||||
|
@ -123,6 +124,7 @@ static char *find_parm(char *ptr)
|
|||
fprintf(stderr, "%d: I'm confused: \"%s\"\n", g_lineno, start);
|
||||
exit(5);
|
||||
}
|
||||
|
||||
ptr++;
|
||||
|
||||
ptr = skip_space(ptr);
|
||||
|
@ -135,6 +137,7 @@ static char *find_parm(char *ptr)
|
|||
fprintf(stderr, "%d: Expected ',': \"%s\"\n", g_lineno, start);
|
||||
exit(6);
|
||||
}
|
||||
|
||||
ptr++;
|
||||
|
||||
ptr = skip_space(ptr);
|
||||
|
@ -143,6 +146,7 @@ static char *find_parm(char *ptr)
|
|||
fprintf(stderr, "%d: Expected \": \"%s\"\n", g_lineno, start);
|
||||
exit(7);
|
||||
}
|
||||
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
|
@ -160,7 +164,7 @@ char *read_line(FILE *stream)
|
|||
{
|
||||
char *ptr;
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
g_line[LINESIZE] = '\0';
|
||||
if (!fgets(g_line, LINESIZE, stream))
|
||||
|
@ -215,7 +219,8 @@ int parse_csvline(char *ptr)
|
|||
{
|
||||
if (nparms >= MAX_FIELDS)
|
||||
{
|
||||
fprintf(stderr, "%d: Too many Parameters: \"%s\"\n", g_lineno, g_line);
|
||||
fprintf(stderr, "%d: Too many Parameters: \"%s\"\n",
|
||||
g_lineno, g_line);
|
||||
exit(8);
|
||||
}
|
||||
|
||||
|
@ -232,7 +237,7 @@ int parse_csvline(char *ptr)
|
|||
printf("Parameters: %d\n", nparms);
|
||||
for (i = 0; i < nparms; i++)
|
||||
{
|
||||
printf(" Parm%d: \"%s\"\n", i+1, g_parm[i]);
|
||||
printf(" Parm%d: \"%s\"\n", i + 1, g_parm[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ int main(int argc, char **argv, char **envp)
|
|||
if (strcmp(argv[1], "-4") != 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unrecognized option\n");
|
||||
fprintf(stderr, "Usage: %s [-4] <source-file> <out-file>\n", argv[0]);
|
||||
fprintf(stderr, "Usage: %s [-4] <source-file> <out-file>\n",
|
||||
argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -137,12 +137,12 @@ static char *find_value_end(char *ptr)
|
|||
{
|
||||
if (*ptr == '"')
|
||||
{
|
||||
do ptr++; while (*ptr && *ptr != '"');
|
||||
if (*ptr) ptr++;
|
||||
do ptr++; while (*ptr && *ptr != '"');
|
||||
if (*ptr) ptr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"');
|
||||
do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,7 @@ static int enum_architectures(const char *dirpath, struct dirent *entry,
|
|||
if (g_narch >= MAX_ARCHITECTURES)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"ERROR: Too many architecture directories found\n");
|
||||
"ERROR: Too many architecture directories found\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -697,25 +697,25 @@ char *list_select(char **list, unsigned nitems)
|
|||
|
||||
printf("Enter [1");
|
||||
if (nitems > 1)
|
||||
{
|
||||
printf("-%c", nitems >= 9 ? '9' : '0' + nitems);
|
||||
if (nitems > 9)
|
||||
{
|
||||
printf(",a");
|
||||
if (nitems > 10)
|
||||
{
|
||||
printf("-%c", 'a' + nitems - 10);
|
||||
if (nitems > 35)
|
||||
{
|
||||
printf(",A");
|
||||
if (nitems > 36)
|
||||
{
|
||||
printf("-%c", 'A' + nitems - 36);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
printf("-%c", nitems >= 9 ? '9' : '0' + nitems);
|
||||
if (nitems > 9)
|
||||
{
|
||||
printf(",a");
|
||||
if (nitems > 10)
|
||||
{
|
||||
printf("-%c", 'a' + nitems - 10);
|
||||
if (nitems > 35)
|
||||
{
|
||||
printf(",A");
|
||||
if (nitems > 36)
|
||||
{
|
||||
printf("-%c", 'A' + nitems - 36);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("]: ");
|
||||
|
||||
|
|
|
@ -71,16 +71,29 @@ static int nhdrfiles;
|
|||
|
||||
static void show_usage(const char *progname)
|
||||
{
|
||||
fprintf(stderr, "USAGE: %s [-d] <cvs-file> <symtab-file> [<symtab-name> [<nsymbols-name>]]\n\n",
|
||||
progname);
|
||||
fprintf(stderr, "Where:\n\n");
|
||||
fprintf(stderr, " <cvs-file> : The path to the input CSV file (required)\n");
|
||||
fprintf(stderr, " <symtab-file> : The path to the output symbol table file (required)\n");
|
||||
fprintf(stderr, " <symtab-name> : Optional name for the symbol table variable\n");
|
||||
fprintf(stderr, " Default: \"%s\"\n", SYMTAB_NAME);
|
||||
fprintf(stderr, " <nsymbols-name> : Optional name for the symbol table variable\n");
|
||||
fprintf(stderr, " Default: \"%s\"\n", NSYMBOLS_NAME);
|
||||
fprintf(stderr, " -d : Enable debug output\n");
|
||||
fprintf(stderr,
|
||||
"USAGE:\n");
|
||||
fprintf(stderr,
|
||||
"%s [-d] <cvs-file> <symtab-file> [<symtab-name> [<nsymbols-name>]]\n\n",
|
||||
progname);
|
||||
fprintf(stderr,
|
||||
"Where:\n\n");
|
||||
fprintf(stderr,
|
||||
" <cvs-file> : The path to the input CSV file (required)\n");
|
||||
fprintf(stderr,
|
||||
" <symtab-file> : The path to the output symbol table file\n");
|
||||
fprintf(stderr,
|
||||
"(required)\n");
|
||||
fprintf(stderr,
|
||||
" <symtab-name> : Optional name for the symbol table variable\n");
|
||||
fprintf(stderr,
|
||||
" Default: \"%s\"\n", SYMTAB_NAME);
|
||||
fprintf(stderr,
|
||||
" <nsymbols-name> : Optional name for the symbol table variable\n");
|
||||
fprintf(stderr,
|
||||
" Default: \"%s\"\n", NSYMBOLS_NAME);
|
||||
fprintf(stderr,
|
||||
" -d : Enable debug output\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -107,7 +120,8 @@ static void add_hdrfile(const char *hdrfile)
|
|||
{
|
||||
if (nhdrfiles > MAX_HEADER_FILES)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Too man header files. Increase MAX_HEADER_FILES\n");
|
||||
fprintf(stderr,
|
||||
"ERROR: Too man header files. Increase MAX_HEADER_FILES\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -242,7 +256,8 @@ int main(int argc, char **argv, char **envp)
|
|||
|
||||
/* Output up-front file boilerplate */
|
||||
|
||||
fprintf(outstream, "/* %s: Auto-generated symbol table. Do not edit */\n\n", sympath);
|
||||
fprintf(outstream,
|
||||
"/* %s: Auto-generated symbol table. Do not edit */\n\n", sympath);
|
||||
fprintf(outstream, "#include <nuttx/config.h>\n");
|
||||
fprintf(outstream, "#include <nuttx/compiler.h>\n");
|
||||
fprintf(outstream, "#include <nuttx/symtab.h>\n\n");
|
||||
|
@ -302,7 +317,8 @@ int main(int argc, char **argv, char **envp)
|
|||
}
|
||||
|
||||
fprintf(outstream, "%s};\n\n", finalterm);
|
||||
fprintf(outstream, "#define NSYMBOLS (sizeof(%s) / sizeof (struct symtab_s))\n", symtab);
|
||||
fprintf(outstream,
|
||||
"#define NSYMBOLS (sizeof(%s) / sizeof (struct symtab_s))\n", symtab);
|
||||
fprintf(outstream, "int %s = NSYMBOLS;\n", nsymbols);
|
||||
|
||||
/* Close the CSV and symbol table files and exit */
|
||||
|
|
|
@ -58,6 +58,10 @@ static char g_line[LINESIZE];
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *instream;
|
||||
|
|
Loading…
Reference in a new issue