git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10088 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2013-06-18 14:04:16 +00:00
parent bb5c918345
commit d84b3c190d
2 changed files with 13 additions and 0 deletions

View File

@ -72,6 +72,7 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp)
label_active = 0;
labelstr = NULL;
jump_skip = 0;
ifthenelse_flag = 0;
if (me == 0) {
nfile = maxfile = 1;
@ -682,7 +683,9 @@ void Input::ifthenelse()
ncommands++;
}
ifthenelse_flag = 1;
for (int i = 0; i < ncommands; i++) one(commands[i]);
ifthenelse_flag = 0;
for (int i = 0; i < ncommands; i++) delete [] commands[i];
delete [] commands;
@ -736,7 +739,9 @@ void Input::ifthenelse()
// execute the list of commands
ifthenelse_flag = 1;
for (int i = 0; i < ncommands; i++) one(commands[i]);
ifthenelse_flag = 0;
// clean up
@ -753,6 +758,13 @@ void Input::include()
{
if (narg != 1) error->all(FLERR,"Illegal include command");
// do not allow include inside an if command
// NOTE: this check will fail if a 2nd if command was inside the if command
// and came before the include
if (ifthenelse_flag)
error->all(FLERR,"Cannot use include command within an if command");
if (me == 0) {
if (nfile == maxfile) {
maxfile++;

View File

@ -45,6 +45,7 @@ class Input : protected Pointers {
int label_active; // 0 = no label, 1 = looking for label
char *labelstr; // label string being looked for
int jump_skip; // 1 if skipping next jump, 0 otherwise
int ifthenelse_flag; // 1 if executing commands inside an if-then-else
FILE **infiles; // list of open input files