-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathname.c
More file actions
40 lines (33 loc) · 801 Bytes
/
Copy pathname.c
File metadata and controls
40 lines (33 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Temporary-Variable Allocation Routines
*
* Copyright (C) 2018 Nicolas Mauger
* This file is subject to the terms and conditions of the
* CeCILL free software license agreement. See the file
* LICENSE in the main directory of T7 for more details.
*/
#include <stdio.h>
#include <stdlib.h>
#include "lex.h"
char *Names[] = { "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7" };
char **Namep = Names;
char *newname()
{
if ( Namep >= &Names[sizeof(Names) / sizeof(*Names)])
{
fprintf(stderr, "%d: Expression too complex\n", yylineno);
exit(1);
}
return (*Namep++);
}
void freename(char *s)
{
if (Namep > Names)
{
*--Namep = s;
}
else
{
fprintf(stderr, "%d: (Internal error) Name stack underflow\n", yylineno);
}
}