home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
messroms.de
/
2007-01-13_www.messroms.de.zip
/
VZ200
/
TOOLS
/
ZCCSRC.ZIP
/
scc
/
while.c
< prev
Wrap
C/C++ Source or Header
|
2000-03-01
|
1KB
|
81 lines
/* File while.c: 2.1 (83/03/20,16:02:22) */
/*% cc -O -c %
*
*/
#include <stdio.h>
#include "defs.h"
#include "data.h"
#include "proto.h"
void addwhile(int ptr[])
{
int k;
if (wsptr == WSMAX)
{
error("too many active whiles");
return;
}
k = 0;
while (k < WSSIZ)
*wsptr++ = ptr[k++];
}
void delwhile(void)
{
if (readwhile())
wsptr = wsptr - WSSIZ;
}
int *readwhile(void)
{
if (wsptr == ws)
{
error("no active do/for/while/switch");
return NULL;
}
else
return (wsptr - WSSIZ);
}
int *findwhile(void)
{
int *ptr;
for (ptr = wsptr; ptr != ws;)
{
ptr = ptr - WSSIZ;
if (ptr[WSTYP] != WSSWITCH)
return (ptr);
}
error("no active do/for/while");
return NULL;
}
int *readswitch(void)
{
int *ptr;
if (NULL!=(ptr = readwhile()))
if (ptr[WSTYP] == WSSWITCH)
return (ptr);
return NULL;
}
void addcase(int val)
{
int lab;
if (swstp == SWSTSZ)
error("too many case labels");
else
{
swstcase[swstp] = val;
swstlab[swstp++] = lab = getlabel();
printlabel(lab);
col();
nl();
}
}