version 1.9, 1999/12/16 16:41:41 |
version 1.10, 1999/12/16 17:02:45 |
|
|
|
|
static int forLevel = 0; /* Nesting level */ |
static int forLevel = 0; /* Nesting level */ |
static char *forVar; /* Iteration variable */ |
static char *forVar; /* Iteration variable */ |
static Buffer forBuf; /* Commands in loop */ |
static BUFFER forBuf; /* Commands in loop */ |
static Lst forLst; /* List of items */ |
static Lst forLst; /* List of items */ |
static unsigned long forLineno; /* Line at beginning of loop */ |
static unsigned long forLineno; /* Line at beginning of loop */ |
|
|
|
|
build_words_list(forLst, sub); |
build_words_list(forLst, sub); |
free(sub); |
free(sub); |
forLineno = Parse_Getlineno(); |
forLineno = Parse_Getlineno(); |
forBuf = Buf_Init(0); |
Buf_Init(&forBuf, 0); |
forLevel++; |
forLevel++; |
return 1; |
return 1; |
} |
} |
|
|
} |
} |
|
|
if (forLevel != 0) { |
if (forLevel != 0) { |
Buf_AddString(forBuf, line); |
Buf_AddString(&forBuf, line); |
Buf_AddChar(forBuf, '\n'); |
Buf_AddChar(&forBuf, '\n'); |
return 1; |
return 1; |
} |
} |
else { |
else { |
|
|
{ |
{ |
For arg; |
For arg; |
|
|
if (forVar == NULL || forBuf == NULL || forLst == NULL) |
if (forVar == NULL || forLst == NULL) |
return; |
return; |
arg.var = forVar; |
arg.var = forVar; |
arg.buf = forBuf; |
arg.buf = &forBuf; |
arg.lst = forLst; |
arg.lst = forLst; |
arg.lineno = forLineno; |
arg.lineno = forLineno; |
forVar = NULL; |
forVar = NULL; |
forBuf = NULL; |
|
forLst = NULL; |
forLst = NULL; |
|
|
Lst_ForEach(arg.lst, ForExec, (ClientData) &arg); |
Lst_ForEach(arg.lst, ForExec, (ClientData) &arg); |
|
|
free((Address)arg.var); |
free((Address)arg.var); |
Lst_Destroy(arg.lst, (void (*) __P((ClientData))) free); |
Lst_Destroy(arg.lst, (void (*) __P((ClientData))) free); |
Buf_Destroy(arg.buf, TRUE); |
Buf_Destroy(arg.buf); |
} |
} |