Skip to content
Snippets Groups Projects
Commit e18d7397 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

temp fix for global lock

parent e383ae8c
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "Gmsh.h" #include "Gmsh.h"
#include "Context.h"
#include "MVertex.h" #include "MVertex.h"
#include "MElement.h" #include "MElement.h"
#include "Bindings.h" #include "Bindings.h"
...@@ -14,6 +15,7 @@ ...@@ -14,6 +15,7 @@
#include "dgConservationLawAdvection.h" #include "dgConservationLawAdvection.h"
#include "dgConservationLawPerfectGas.h" #include "dgConservationLawPerfectGas.h"
#include "dgConservationLawWaveEquation.h" #include "dgConservationLawWaveEquation.h"
extern "C" { extern "C" {
#include "lua.h" #include "lua.h"
#include "lualib.h" #include "lualib.h"
...@@ -104,7 +106,7 @@ int binding::readFile(const char *filename) ...@@ -104,7 +106,7 @@ int binding::readFile(const char *filename)
{ {
int s = luaL_loadfile(L, filename); int s = luaL_loadfile(L, filename);
if ( s==0 ) { if ( s==0 ) {
Msg::Info("lua executes %s\n",filename); Msg::Info("lua executes %s",filename);
s = lua_pcall(L, 0, LUA_MULTRET, 0); s = lua_pcall(L, 0, LUA_MULTRET, 0);
} }
report_errors(L, s); report_errors(L, s);
...@@ -112,9 +114,13 @@ int binding::readFile(const char *filename) ...@@ -112,9 +114,13 @@ int binding::readFile(const char *filename)
return (s==0); return (s==0);
} }
void binding::interactiveSession(){ void binding::interactiveSession()
{
int lock = CTX::instance()->lock;
CTX::instance()->lock = 0;
Msg::Info("Starting interactive lua session, press Ctrl-D to exit"); Msg::Info("Starting interactive lua session, press Ctrl-D to exit");
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
using_history(); using_history();
while (const char *line=readline("lua> ")){ while (const char *line=readline("lua> ")){
char *expansion; char *expansion;
...@@ -129,13 +135,14 @@ void binding::interactiveSession(){ ...@@ -129,13 +135,14 @@ void binding::interactiveSession(){
free(expansion); free(expansion);
} }
clear_history(); clear_history();
#else #else
std::string line; std::string line;
while(std::cout<<"lua> ", while(std::cout<<"lua> ",
getline(std::cin,line) ){ getline(std::cin,line) ){
report_errors(L, luaL_dostring(L, line.c_str())); report_errors(L, luaL_dostring(L, line.c_str()));
} }
#endif #endif
CTX::instance()->lock = lock;
} }
binding::binding(){ binding::binding(){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment