Convert this flex scanner to prefix all of its symbols with
"mca_llm_base_yy" so that we can have multiple flex scanners in one library. This commit was SVN r2407.
Этот коммит содержится в:
родитель
639882b063
Коммит
1569ecdba3
@ -9,6 +9,8 @@ noinst_LTLIBRARIES = libmca_llm_base.la
|
|||||||
# For VPATH builds, have to specify where static-modules.h will be found
|
# For VPATH builds, have to specify where static-modules.h will be found
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(top_builddir)/src
|
AM_CPPFLAGS = -I$(top_builddir)/src
|
||||||
|
AM_LFLAGS = -Pmca_llm_base_yy
|
||||||
|
LEX_OUTPUT_ROOT = lex.mca_llm_base_yy
|
||||||
|
|
||||||
# Source code files
|
# Source code files
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern int yylex(void);
|
extern int yylex(void);
|
||||||
extern FILE *yyin;
|
extern FILE *mca_llm_base_yyin;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
@ -24,9 +24,9 @@ main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
yyin = fopen(argv[1], "r");
|
mca_llm_base_yyin = fopen(argv[1], "r");
|
||||||
while (!mca_llm_base_parse_done) {
|
while (!mca_llm_base_parse_done) {
|
||||||
ret = yylex();
|
ret = mca_llm_base_yylex();
|
||||||
printf("%d: %s\n", ret, mca_llm_base_string);
|
printf("%d: %s\n", ret, mca_llm_base_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ static void
|
|||||||
parse_error()
|
parse_error()
|
||||||
{
|
{
|
||||||
printf("hostfile: error reading hostfile at line %d, %s\n",
|
printf("hostfile: error reading hostfile at line %d, %s\n",
|
||||||
yynewlines, mca_llm_base_string);
|
mca_llm_base_yynewlines, mca_llm_base_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -44,13 +44,13 @@ parse_keyval(int first, ompi_rte_node_allocation_t *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* find the equals */
|
/* find the equals */
|
||||||
if (MCA_LLM_BASE_EQUAL != yylex()) {
|
if (MCA_LLM_BASE_EQUAL != mca_llm_base_yylex()) {
|
||||||
free(key);
|
free(key);
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure we have a value */
|
/* make sure we have a value */
|
||||||
val = yylex();
|
val = mca_llm_base_yylex();
|
||||||
if (MCA_LLM_BASE_STRING != val && MCA_LLM_BASE_QUOTED_STRING != val) {
|
if (MCA_LLM_BASE_STRING != val && MCA_LLM_BASE_QUOTED_STRING != val) {
|
||||||
free(key);
|
free(key);
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
@ -79,9 +79,9 @@ int
|
|||||||
parse_count(void)
|
parse_count(void)
|
||||||
{
|
{
|
||||||
/* find the equals */
|
/* find the equals */
|
||||||
if (MCA_LLM_BASE_EQUAL != yylex()) return -1;
|
if (MCA_LLM_BASE_EQUAL != mca_llm_base_yylex()) return -1;
|
||||||
/* and now the string */
|
/* and now the string */
|
||||||
if (MCA_LLM_BASE_STRING != yylex()) return -1;
|
if (MCA_LLM_BASE_STRING != mca_llm_base_yylex()) return -1;
|
||||||
|
|
||||||
return atoi(mca_llm_base_string);
|
return atoi(mca_llm_base_string);
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ parse_line(int first, ompi_rte_node_allocation_t *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (!mca_llm_base_parse_done) {
|
while (!mca_llm_base_parse_done) {
|
||||||
val = yylex();
|
val = mca_llm_base_yylex();
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case MCA_LLM_BASE_DONE:
|
case MCA_LLM_BASE_DONE:
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
@ -147,10 +147,10 @@ mca_llm_base_parse_hostfile(const char *hostfile)
|
|||||||
|
|
||||||
list = OBJ_NEW(ompi_list_t);
|
list = OBJ_NEW(ompi_list_t);
|
||||||
|
|
||||||
mca_llm_base_parse_done = 0;
|
mca_llm_base_parse_done = false;
|
||||||
|
|
||||||
yyin = fopen(hostfile, "r");
|
mca_llm_base_yyin = fopen(hostfile, "r");
|
||||||
if (NULL == yyin) {
|
if (NULL == mca_llm_base_yyin) {
|
||||||
printf("hostfile: could not open %s\n", hostfile);
|
printf("hostfile: could not open %s\n", hostfile);
|
||||||
OBJ_RELEASE(list);
|
OBJ_RELEASE(list);
|
||||||
list = NULL;
|
list = NULL;
|
||||||
@ -158,7 +158,7 @@ mca_llm_base_parse_hostfile(const char *hostfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (!mca_llm_base_parse_done) {
|
while (!mca_llm_base_parse_done) {
|
||||||
val = yylex();
|
val = mca_llm_base_yylex();
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case MCA_LLM_BASE_DONE:
|
case MCA_LLM_BASE_DONE:
|
||||||
goto parse_exit;
|
goto parse_exit;
|
||||||
|
@ -5,14 +5,35 @@
|
|||||||
#ifndef MCA_LLM_BASE_PARSE_HOSTFILE_LEX_H_
|
#ifndef MCA_LLM_BASE_PARSE_HOSTFILE_LEX_H_
|
||||||
#define MCA_LLM_BASE_PARSE_HOSTFILE_LEX_H_
|
#define MCA_LLM_BASE_PARSE_HOSTFILE_LEX_H_
|
||||||
|
|
||||||
|
#include "ompi_config.h"
|
||||||
|
|
||||||
|
#ifdef malloc
|
||||||
|
#undef malloc
|
||||||
|
#endif
|
||||||
|
#ifdef realloc
|
||||||
|
#undef realloc
|
||||||
|
#endif
|
||||||
|
#ifdef free
|
||||||
|
#undef free
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
extern int yylex(void);
|
extern int mca_llm_base_yylex(void);
|
||||||
|
|
||||||
extern FILE *yyin;
|
extern FILE *mca_llm_base_yyin;
|
||||||
extern int mca_llm_base_parse_done;
|
extern bool mca_llm_base_parse_done;
|
||||||
extern char *mca_llm_base_string;
|
extern char *mca_llm_base_string;
|
||||||
extern int yynewlines;
|
extern int mca_llm_base_yynewlines;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make lex-generated files not issue compiler warnings
|
||||||
|
*/
|
||||||
|
#define YY_STACK_USED 0
|
||||||
|
#define YY_ALWAYS_INTERACTIVE 0
|
||||||
|
#define YY_NEVER_INTERACTIVE 0
|
||||||
|
#define YY_MAIN 0
|
||||||
|
#define YY_NO_UNPUT 1
|
||||||
|
|
||||||
#define MCA_LLM_BASE_DONE 0
|
#define MCA_LLM_BASE_DONE 0
|
||||||
#define MCA_LLM_BASE_ERROR 1
|
#define MCA_LLM_BASE_ERROR 1
|
||||||
|
@ -6,23 +6,23 @@
|
|||||||
/*
|
/*
|
||||||
* local functions
|
* local functions
|
||||||
*/
|
*/
|
||||||
static int yyerror(void);
|
static int mca_llm_base_yyerror(void);
|
||||||
int yywrap(void);
|
static int mca_llm_base_yywrap(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* global variables
|
* global variables
|
||||||
*/
|
*/
|
||||||
int yynewlines=1;
|
int mca_llm_base_yynewlines=1;
|
||||||
int mca_llm_base_parse_done = 0;
|
bool mca_llm_base_parse_done = false;
|
||||||
char *mca_llm_base_string = NULL;
|
char *mca_llm_base_string = NULL;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
\n { yynewlines++; return MCA_LLM_BASE_NEWLINE; }
|
\n { mca_llm_base_yynewlines++; return MCA_LLM_BASE_NEWLINE; }
|
||||||
|
|
||||||
\"[^\"]*\" { mca_llm_base_string = yytext; return MCA_LLM_BASE_QUOTED_STRING; }
|
\"[^\"]*\" { mca_llm_base_string = yytext; return MCA_LLM_BASE_QUOTED_STRING; }
|
||||||
|
|
||||||
[\f\t\v ] ; /* whitespace */
|
[\f\t\v ] ; /* whitespace */
|
||||||
|
|
||||||
@ -33,23 +33,20 @@ count { mca_llm_base_string = yytext; return MCA_LLM_BASE_COUNT; }
|
|||||||
|
|
||||||
[A-Za-z0-9_\-\.]* { mca_llm_base_string = yytext; return MCA_LLM_BASE_STRING; }
|
[A-Za-z0-9_\-\.]* { mca_llm_base_string = yytext; return MCA_LLM_BASE_STRING; }
|
||||||
|
|
||||||
. { mca_llm_base_string = yytext; return MCA_LLM_BASE_ERROR; }
|
. { mca_llm_base_string = yytext; return MCA_LLM_BASE_ERROR; }
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|
||||||
static
|
static int mca_llm_base_yyerror(void)
|
||||||
int
|
|
||||||
yyerror()
|
|
||||||
{
|
{
|
||||||
printf("%d: Invalid input (%s)\n", yynewlines, yytext);
|
printf("%d: Invalid input (%s)\n", mca_llm_base_yynewlines, yytext);
|
||||||
return MCA_LLM_BASE_ERROR;
|
return MCA_LLM_BASE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
static int mca_llm_base_yywrap(void)
|
||||||
yywrap()
|
|
||||||
{
|
{
|
||||||
mca_llm_base_parse_done = 1;
|
mca_llm_base_parse_done = true;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user