forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10088 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
bb5c918345
commit
d84b3c190d
|
@ -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++;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue