Skip to content
Snippets Groups Projects
Commit 84470f6d authored by Patrick Dular's avatar Patrick Dular
Browse files

Extension of Print Struct

parent c3d7cabf
Branches
No related tags found
No related merge requests found
......@@ -639,6 +639,7 @@ void ClearProject()
#if defined(HAVE_PARSER)
gmsh_yysymbols.clear();
gmsh_yystringsymbols.clear();
nameSpaces.clear();
#endif
for(int i = GModel::list.size() - 1; i >= 0; i--)
delete GModel::list[i];
......
......@@ -589,6 +589,7 @@ int gmsh_yyerrorstate = 0;
int gmsh_yyviewindex = 0;
std::map<std::string, gmsh_yysymbol> gmsh_yysymbols;
std::map<std::string, std::vector<std::string> > gmsh_yystringsymbols;
NameSpaces nameSpaces;
 
// static parser variables (accessible only in this file)
#if defined(HAVE_POST)
......@@ -606,7 +607,6 @@ static int yylinenoImbricatedLoopsTab[MAX_RECUR_LOOPS];
static double LoopControlVariablesTab[MAX_RECUR_LOOPS][3];
static std::string LoopControlVariablesNameTab[MAX_RECUR_LOOPS];
static std::string factory;
static NameSpaces nameSpaces;
static std::string struct_name, struct_namespace;
static int flag_tSTRING_alloc = 0;
 
......@@ -13455,9 +13455,9 @@ void PrintParserSymbols(bool help, std::vector<std::string> &vec)
vec.push_back("// Structures");
vec.push_back("//");
}
std::string s;
nameSpaces.sprint(s);
vec.push_back(s);
std::vector<std::string> strs;
nameSpaces.sprint(strs);
vec.insert(vec.end(), strs.begin(), strs.end());
}
}
 
......
......@@ -68,6 +68,7 @@ int gmsh_yyerrorstate = 0;
int gmsh_yyviewindex = 0;
std::map<std::string, gmsh_yysymbol> gmsh_yysymbols;
std::map<std::string, std::vector<std::string> > gmsh_yystringsymbols;
NameSpaces nameSpaces;
// static parser variables (accessible only in this file)
#if defined(HAVE_POST)
......@@ -85,7 +86,6 @@ static int yylinenoImbricatedLoopsTab[MAX_RECUR_LOOPS];
static double LoopControlVariablesTab[MAX_RECUR_LOOPS][3];
static std::string LoopControlVariablesNameTab[MAX_RECUR_LOOPS];
static std::string factory;
static NameSpaces nameSpaces;
static std::string struct_name, struct_namespace;
static int flag_tSTRING_alloc = 0;
......@@ -6235,9 +6235,9 @@ void PrintParserSymbols(bool help, std::vector<std::string> &vec)
vec.push_back("// Structures");
vec.push_back("//");
}
std::string s;
nameSpaces.sprint(s);
vec.push_back(s);
std::vector<std::string> strs;
nameSpaces.sprint(strs);
vec.insert(vec.end(), strs.begin(), strs.end());
}
}
......
......@@ -191,6 +191,16 @@ public:
it_st != this->get().end(); ++it_st )
it_st->second.sprint(str, it_st->first, struct_namespace);
}
void sprint(std::vector<std::string> & strs_out, const std::string & struct_namespace) const
{
std::string str;
for (Map_string_Struct::const_iterator it_st = this->get().begin();
it_st != this->get().end(); ++it_st ) {
str.clear();
it_st->second.sprint(str, it_st->first, struct_namespace);
strs_out.insert(strs_out.end(), str);
}
}
private:
int _max_tag;
......@@ -287,6 +297,15 @@ public:
it_ns != this->get().end(); ++it_ns )
it_ns->second.sprint(str, it_ns->first);
}
void sprint(std::vector<std::string> & strs_out) const
{
std::vector<std::string> strs;
for (Map_string_Structs::const_iterator it_ns = this->get().begin();
it_ns != this->get().end(); ++it_ns ) {
it_ns->second.sprint(strs, it_ns->first);
strs_out.insert(strs_out.end(), strs.begin(), strs.end());
}
}
};
......@@ -299,6 +318,7 @@ extern std::string gmsh_yyname;
extern int gmsh_yyerrorstate;
extern std::map<std::string, gmsh_yysymbol> gmsh_yysymbols;
extern std::map<std::string, std::vector<std::string> > gmsh_yystringsymbols;
extern NameSpaces nameSpaces;
void PrintParserSymbols(bool help, std::vector<std::string> &vec);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment