home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
OS2_LEX.ZIP
/
LEXSWI.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-10-25
|
913b
|
55 lines
/*
* lexswitch -- switch lex tables
*/
/*
* Bob Denny 28-Aug-82 Remove reference to stdio.h
* Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C
*/
#include <lex.h>
#include <stdlib.h>
extern struct lextab *_tabp;
typedef struct stack {
struct stack *next;
struct lextab *table;
} STACK;
static STACK *lextop = NULL;
struct lextab *lexswitch(struct lextab *lp)
{
register struct lextab *olp;
olp = _tabp;
_tabp = lp;
return(olp);
}
void lexpush(struct lextab *lp)
{
STACK *sp;
sp = (STACK *) malloc(sizeof(STACK));
sp->next = lextop;
sp->table = lexswitch(lp);
lextop = sp;
}
void lexpop(void)
{
STACK *sp;
if (lextop != NULL)
{
sp = lextop;
lextop = sp->next;
lexswitch(sp->table);
free(sp);
}
}