1 /* -*-comment-start: "//";comment-end:""-*-
2 * Mes --- Maxwell Equations of Software
3 * Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
5 * This file is part of Mes.
7 * Mes is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or (at
10 * your option) any later version.
12 * Mes is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Mes. If not, see <http://www.gnu.org/licenses/>.
35 file_struct *stack[STACK_SIZE];
37 file_struct **stack_ptr;
49 s.stack_ptr = s.stack;
50 ps->stack_ptr = ps->stack;
51 eputs ("ps->stack="); eputs (itoa (ps->stack)); eputs ("\n");
54 if (ps->stack_ptr >= ps->stack + STACK_SIZE) return 1;
57 struct file f = {"first.h"};
59 strcpy (f.name, "first.h");
61 eputs (f.name); eputs ("\n");
67 eputs ("s.stack_ptr -stack ="); eputs (itoa (ps->stack_ptr - ps->stack)); eputs ("\n");
70 for (file_struct **p = ps->stack; p < ps->stack_ptr; p++)
72 eputs ((*p)->name); eputs ("\n");
78 i = ps->stack_ptr - ps->stack + STACK_SIZE;
79 eputs ("i="); eputs (itoa (i)); eputs ("\n");
81 if (ps->stack_ptr >= ps->stack + STACK_SIZE) return 2;
84 struct file f2 = {"second.h"};
86 strcpy (f2.name, "second.h");
92 eputs ("s.stack_ptr -stack ="); eputs (itoa (ps->stack_ptr - ps->stack)); eputs ("\n");
94 for (file_struct **p = ps->stack; p < ps->stack_ptr; p++)
96 eputs ((*p)->name); eputs ("\n");
99 if (ps->stack_ptr >= ps->stack + STACK_SIZE) return 0;
100 struct file f3 = {"third.h"};
101 *ps->stack_ptr = &f3;