/* implementation of two stacks used in xetal, Copyright (C) 1991 Raphael Cerf (e-mail: cerf@ens.ens.fr) This file is part of xetal. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "proto.h" #include "stack.h" /* * file stack */ char *fich_name(e) fich_t *e; { return(e->name); } FILE *fich_fd(e) fich_t *e; { return(e->fd); } long fich_line(e) fich_t *e; { return(e->line); } fich_t f_stack[F_MAX]; int f_top=0; int is_f_stack_empty() { return(f_top==0); } int is_f_stack_full() { return(f_top==F_MAX-1); } fich_t *f_pop() { return( &(f_stack[--f_top]) ); } void f_push(e) fich_t *e; { f_stack[f_top++]=*e; } fich_t *f_read() { if (f_top==0) return((fich_t *)0); else return(f_stack+f_top-1); } void f_display() { int i; printf("%d elements\n", f_top); for (i=0; i0) S_pop(); } int is_S_stack_empty() { return(S_top==0); } int is_S_stack_full() { return(S_top==S_MAX-1); } int is_S_in_stack(e) int e; { int i; for (i=0; i