1987-03-10 17:51:10 +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".
|
|
|
|
*/
|
1986-03-10 13:07:55 +00:00
|
|
|
/* $Header$ */
|
|
|
|
|
1986-12-04 16:29:44 +00:00
|
|
|
#include "inputtype.h"
|
|
|
|
#include "file_info.h"
|
|
|
|
#include "input.h"
|
|
|
|
#define INP_TYPE struct file_info
|
|
|
|
#define INP_VAR finfo
|
|
|
|
struct file_info finfo;
|
1988-03-08 11:42:00 +00:00
|
|
|
extern int nestlevel;
|
1986-12-04 16:29:44 +00:00
|
|
|
#include "nopp.h"
|
1987-03-27 16:39:57 +00:00
|
|
|
#include <inp_pkg.body>
|
1993-10-07 14:07:42 +00:00
|
|
|
#include <alloc.h>
|
1986-03-10 13:07:55 +00:00
|
|
|
|
1991-11-08 15:12:28 +00:00
|
|
|
#include "dbsymtab.h"
|
1986-03-10 13:07:55 +00:00
|
|
|
#ifndef NOPP
|
1991-11-08 15:12:28 +00:00
|
|
|
#ifdef DBSYMTAB
|
|
|
|
#include <stb.h>
|
|
|
|
extern int IncludeLevel;
|
|
|
|
extern char options[];
|
|
|
|
#endif
|
1986-12-04 16:29:44 +00:00
|
|
|
char *
|
|
|
|
getwdir(fn)
|
1987-02-09 23:19:42 +00:00
|
|
|
register char *fn;
|
1986-03-10 13:07:55 +00:00
|
|
|
{
|
|
|
|
register char *p;
|
1986-03-26 16:58:43 +00:00
|
|
|
char *strrindex();
|
1986-03-10 13:07:55 +00:00
|
|
|
|
1986-03-26 16:58:43 +00:00
|
|
|
p = strrindex(fn, '/');
|
1986-03-10 13:07:55 +00:00
|
|
|
while (p && *(p + 1) == '\0') { /* remove trailing /'s */
|
|
|
|
*p = '\0';
|
1986-03-26 16:58:43 +00:00
|
|
|
p = strrindex(fn, '/');
|
1986-03-10 13:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
|
1986-12-04 16:29:44 +00:00
|
|
|
return "";
|
1986-03-10 13:07:55 +00:00
|
|
|
if (p) {
|
|
|
|
*p = '\0';
|
1986-12-04 16:29:44 +00:00
|
|
|
fn = Salloc(fn, p - &fn[0] + 1);
|
1986-03-10 13:07:55 +00:00
|
|
|
*p = '/';
|
1986-12-04 16:29:44 +00:00
|
|
|
return fn;
|
1986-03-10 13:07:55 +00:00
|
|
|
}
|
1989-02-16 11:18:44 +00:00
|
|
|
return "";
|
1986-03-10 13:07:55 +00:00
|
|
|
}
|
1989-07-14 09:51:02 +00:00
|
|
|
|
|
|
|
int InputLevel;
|
1991-12-17 14:11:15 +00:00
|
|
|
#endif /* NOPP */
|
1986-03-10 13:07:55 +00:00
|
|
|
|
1986-12-04 16:29:44 +00:00
|
|
|
int NoUnstack;
|
1986-09-15 08:47:53 +00:00
|
|
|
|
1986-12-04 16:29:44 +00:00
|
|
|
AtEoIT()
|
1986-03-10 13:07:55 +00:00
|
|
|
{
|
1986-12-04 16:29:44 +00:00
|
|
|
#ifndef NOPP
|
1988-03-08 11:42:00 +00:00
|
|
|
/* if (NoUnstack) lexwarning("unexpected EOF"); ??? */
|
1986-12-04 16:29:44 +00:00
|
|
|
DoUnstack();
|
1989-07-14 09:51:02 +00:00
|
|
|
InputLevel--;
|
1991-12-17 14:11:15 +00:00
|
|
|
#endif /* NOPP */
|
1986-12-04 16:29:44 +00:00
|
|
|
return 0;
|
|
|
|
}
|
1986-03-10 13:07:55 +00:00
|
|
|
|
1986-12-04 16:29:44 +00:00
|
|
|
AtEoIF()
|
|
|
|
{
|
1987-08-07 19:53:54 +00:00
|
|
|
#ifndef NOPP
|
|
|
|
|
1988-03-08 11:42:00 +00:00
|
|
|
if (nestlevel != nestlow) lexwarning("missing #endif");
|
1987-08-07 19:53:54 +00:00
|
|
|
else
|
1991-12-17 14:11:15 +00:00
|
|
|
#endif /* NOPP */
|
1988-05-02 15:37:13 +00:00
|
|
|
if (NoUnstack) lexerror("unexpected EOF");
|
|
|
|
#ifndef NOPP
|
1988-03-08 11:42:00 +00:00
|
|
|
nestlevel = nestlow;
|
1991-11-08 15:12:28 +00:00
|
|
|
#ifdef DBSYMTAB
|
|
|
|
if (options['g'] && IncludeLevel > 0) {
|
|
|
|
C_ms_std(FileName, N_EINCL, 0);
|
|
|
|
}
|
|
|
|
IncludeLevel--;
|
|
|
|
#endif
|
1988-05-02 15:37:13 +00:00
|
|
|
#endif
|
1986-12-04 16:29:44 +00:00
|
|
|
return 0;
|
1986-03-10 13:07:55 +00:00
|
|
|
}
|