1989-02-07 11:04:05 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1994-06-27 08:03:14 +00:00
|
|
|
/* $Id$ */
|
1989-02-07 11:04:05 +00:00
|
|
|
|
2013-05-12 19:45:55 +00:00
|
|
|
#include "parameters.h"
|
2006-07-19 10:28:43 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1989-02-07 11:04:05 +00:00
|
|
|
#include "file_info.h"
|
|
|
|
#include "input.h"
|
|
|
|
|
|
|
|
#define INP_PUSHBACK 3
|
|
|
|
#define INP_TYPE struct file_info
|
|
|
|
#define INP_VAR finfo
|
|
|
|
struct file_info finfo;
|
|
|
|
#include <inp_pkg.body>
|
1992-12-22 15:29:56 +00:00
|
|
|
#include <alloc.h>
|
1989-02-07 11:04:05 +00:00
|
|
|
|
|
|
|
#ifndef NOPP
|
1990-10-19 11:50:32 +00:00
|
|
|
#ifdef DBSYMTAB
|
1993-10-22 14:24:31 +00:00
|
|
|
#include <stb.h>
|
|
|
|
#include <em.h>
|
1990-10-19 11:50:32 +00:00
|
|
|
extern int IncludeLevel;
|
|
|
|
extern char options[];
|
|
|
|
#endif
|
|
|
|
|
1989-02-07 11:04:05 +00:00
|
|
|
char *
|
|
|
|
getwdir(fn)
|
|
|
|
register char *fn;
|
|
|
|
{
|
|
|
|
register char *p;
|
2006-07-23 20:01:02 +00:00
|
|
|
char *strrchr();
|
1989-02-07 11:04:05 +00:00
|
|
|
|
2006-07-23 20:01:02 +00:00
|
|
|
p = strrchr(fn, '/');
|
1989-02-07 11:04:05 +00:00
|
|
|
while (p && *(p + 1) == '\0') { /* remove trailing /'s */
|
|
|
|
*p = '\0';
|
2006-07-23 20:01:02 +00:00
|
|
|
p = strrchr(fn, '/');
|
1989-02-07 11:04:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
|
|
|
|
return "";
|
|
|
|
if (p) {
|
|
|
|
*p = '\0';
|
1989-09-19 16:13:23 +00:00
|
|
|
fn = Salloc(fn,(unsigned) (p - &fn[0] + 1));
|
1989-02-07 11:04:05 +00:00
|
|
|
*p = '/';
|
|
|
|
return fn;
|
|
|
|
}
|
1989-02-16 11:46:39 +00:00
|
|
|
return "";
|
1989-02-07 11:04:05 +00:00
|
|
|
}
|
1989-10-12 14:22:35 +00:00
|
|
|
|
|
|
|
int InputLevel;
|
1989-11-08 16:52:34 +00:00
|
|
|
extern int nestlevel;
|
1991-12-17 13:12:22 +00:00
|
|
|
#endif /* NOPP */
|
1989-02-07 11:04:05 +00:00
|
|
|
|
|
|
|
int NoUnstack;
|
|
|
|
|
|
|
|
AtEoIT()
|
|
|
|
{
|
1989-10-12 14:22:35 +00:00
|
|
|
#ifndef NOPP
|
1989-09-19 16:13:23 +00:00
|
|
|
InputLevel--;
|
1989-02-07 11:04:05 +00:00
|
|
|
unstackrepl();
|
1991-12-17 13:12:22 +00:00
|
|
|
#endif /* NOPP */
|
1989-02-07 11:04:05 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1993-01-18 15:10:01 +00:00
|
|
|
extern char *source;
|
1989-10-12 14:22:35 +00:00
|
|
|
|
1989-02-07 11:04:05 +00:00
|
|
|
AtEoIF()
|
|
|
|
{
|
|
|
|
#ifndef NOPP
|
|
|
|
if (nestlevel != nestlow) lexwarning("missing #endif");
|
|
|
|
else
|
1991-12-17 13:12:22 +00:00
|
|
|
#endif /* NOPP */
|
1989-02-07 11:04:05 +00:00
|
|
|
if (NoUnstack) lexerror("unexpected EOF");
|
|
|
|
#ifndef NOPP
|
|
|
|
nestlevel = nestlow;
|
1990-10-19 11:50:32 +00:00
|
|
|
#ifdef DBSYMTAB
|
|
|
|
if (options['g'] && IncludeLevel > 0) {
|
1993-10-22 14:24:31 +00:00
|
|
|
C_ms_stb_cst(FileName, N_EINCL, 0, (arith) 0);
|
1990-10-19 11:50:32 +00:00
|
|
|
}
|
|
|
|
IncludeLevel--;
|
1989-02-07 11:04:05 +00:00
|
|
|
#endif
|
2016-03-17 19:52:27 +00:00
|
|
|
/* We don't free WorkingDir and FileName here because the rest of the
|
|
|
|
* compiler may be holding pointers to them for displaying error messages.
|
|
|
|
*/
|
1995-03-24 13:56:20 +00:00
|
|
|
#endif /* NOPP */
|
1989-02-07 11:04:05 +00:00
|
|
|
return 0;
|
|
|
|
}
|