Skip to content

Commit

Permalink
Added RO flag in INFO attribute.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2522 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Sep 12, 2006
1 parent af81815 commit 08d3ee8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Compiler/absyn_builder/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

using namespace std;
string modelicafilename; // The filename for the parsed file.
bool modelicafileReadOnly; // True if file is read only.
extern "C"
{

Expand Down Expand Up @@ -105,7 +106,9 @@ extern "C"
if (filestring.size()-4 == filestring.rfind(".mof")){
parseFlatModelica=true;
}

std::ifstream checkROfile(filename,ios::out); // open file in write mode to check if readonly
modelicafileReadOnly = !checkROfile;

std::ifstream stream(filename);
if (!stream)
{
Expand Down Expand Up @@ -394,6 +397,7 @@ extern "C"
bool a1set=false;
bool debug = check_debug_flag("parsedump");
std::istringstream stream(str);
modelicafileReadOnly = false;
modelica_lexer lex(stream);
modelica_parser parse(lex);

Expand Down Expand Up @@ -531,7 +535,7 @@ extern "C"
try
{
std::istringstream stream(str);

modelicafileReadOnly = false;
modelica_lexer lex(stream);
modelica_expression_parser parse(lex);
ANTLR_USE_NAMESPACE(antlr)ASTFactory factory;
Expand Down Expand Up @@ -617,7 +621,7 @@ extern "C"
try
{
std::ifstream stream(filename);

modelicafileReadOnly = false;
modelica_lexer lex(stream);
modelica_expression_parser parse(lex);
ANTLR_USE_NAMESPACE(antlr)ASTFactory factory;
Expand Down
3 changes: 2 additions & 1 deletion Compiler/absyn_builder/walker.g
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ header "post_include_hpp" {
#include <string.h>
extern std::string modelicafilename; // Global filename string.
extern bool modelicafileReadOnly; // Global readonly flag for file.
extern "C" {
#include <stdio.h>
Expand Down Expand Up @@ -300,7 +301,7 @@ class_definition [bool final] returns [ void* ast ]
class_spec,
Absyn__INFO(
mk_scon((char*)(modelicafilename.c_str())),
RML_PRIM_MKBOOL(0), /* false */
RML_PRIM_MKBOOL(modelicafileReadOnly),
mk_icon(classDef?classDef->getLine():0),
mk_icon(classDef?classDef->getColumn():0),
mk_icon(classDef?classDef->getEndLine():0),
Expand Down

0 comments on commit 08d3ee8

Please sign in to comment.