added method for unparsing an expression in Fortran or C

This commit is contained in:
ALEXks
2024-04-09 10:36:46 +03:00
parent aa0a464ead
commit 82de4d6f03
7 changed files with 40 additions and 72 deletions

View File

@@ -263,6 +263,7 @@ extern void updateTypeAndSymbolInStmts();
extern void updateTypesAndSymbolsInBodyOfRoutine();
extern PTR_SYMB duplicateSymbolOfRoutine();
extern char* UnparseBif_Char();
char *UnparseLLnode_Char();
extern void UnparseProgram_ThroughAllocBuffer();

View File

@@ -266,6 +266,7 @@ extern "C" {
void updateTypeAndSymbolInStmts(...);
void updateTypesAndSymbolsInBodyOfRoutine(...);
char* UnparseBif_Char(...);
char *UnparseLLND_Char(...);
char *UnparseLLND_Char(...);
char *UnparseLLnode_Char(...);
void UnparseProgram_ThroughAllocBuffer(...);
}

View File

@@ -382,6 +382,7 @@ public:
inline SgExpression &copy();
inline SgExpression *copyPtr();
char *unparse();
inline char *unparse(int lang); //0 - Fortran, 1 - C
std::string sunparse();
inline void unparsestdout();
inline SgExpression *IsSymbolInExpression(SgSymbol &symbol);
@@ -3819,6 +3820,11 @@ inline char* SgExpression::unparse()
{
return UnparseLLND_Char(thellnd);
}
// podd 08.04.24
inline char* SgExpression::unparse(int lang) //0 - Fortran, 1 - C
{
return UnparseLLnode_Char(thellnd,lang);
}
inline void SgExpression::unparsestdout()
{

View File

@@ -1051,6 +1051,29 @@ char *UnparseBif_Char(bif,lang)
return(s);
}
/* podd 08.04.24 */
char *UnparseLLnode_Char(llnd,lang)
PTR_LLND llnd;
int lang; /* ForSrc=0 - Fortran language, CSrc=1 - C language */
{
char *s;
/* PTR_BLOB b, bl;
*/ /* podd 15.03.99*/
if (Check_Lang_Fortran(cur_proj) && lang != CSrc) /*podd 16.12.11*/
{
Init_Unparser();
s = filter(Tool_Unparse2_LLnode(llnd));
} else
{ if(lang == CSrc)
Set_Function_Language(CSrc);
Init_Unparser();
s = Tool_Unparse2_LLnode(llnd);
if(lang == CSrc)
Unset_Function_Language();
}
return(s);
}
/* Kataev N.A. 03.09.2013 base on UnparseBif_Char with change podd 16.12.11
Kataev N.A. 19.10.2013 fix
*/