ack/util/LLgen/src/machdep.c

65 lines
1.2 KiB
C
Raw Normal View History

1984-10-08 14:14:53 +00:00
/*
1987-03-10 01:26:51 +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".
1984-10-08 14:14:53 +00:00
*
*/
/*
* L L G E N
*
* An Extended LL(1) Parser Generator
*
* Author : Ceriel J.H. Jacobs
*/
/*
* machdep.c
* Machine dependant things
*/
1987-05-12 18:23:09 +00:00
# include <em_path.h>
1984-10-08 14:14:53 +00:00
# include "types.h"
1984-10-08 17:11:03 +00:00
# ifndef NORCSID
static string rcsid5 = "$Header$";
# endif
1984-10-08 14:14:53 +00:00
/* In this file the following routines are defined: */
extern UNLINK();
extern RENAME();
extern string libpath();
UNLINK(x) string x; {
/* Must remove the file "x" */
1988-06-28 11:20:50 +00:00
sys_remove(x); /* systemcall to remove file */
1984-10-08 14:14:53 +00:00
}
RENAME(x,y) string x,y; {
/* Must move the file "x" to the file "y" */
1988-06-28 11:20:50 +00:00
if(! sys_rename(x,y)) fatal(1,"Cannot rename to %s",y);
1984-10-08 14:14:53 +00:00
}
1988-08-19 13:26:27 +00:00
/* to make it easier to patch ... */
char emdir[64] = EM_DIR;
1984-10-08 14:14:53 +00:00
string
libpath(s) string s; {
/* Must deliver a full pathname to the library file "s" */
register string p;
register length;
p_mem alloc();
string strcpy(), strcat();
static string subdir = "/lib/LLgen/";
1984-10-08 14:14:53 +00:00
1988-08-19 13:26:27 +00:00
length = strlen(emdir) + strlen(subdir) + strlen(s) + 1;
p = (string) alloc((unsigned) length);
1988-08-19 13:26:27 +00:00
strcpy(p,emdir);
strcat(p,subdir);
strcat(p,s);
return p;
1984-10-08 14:14:53 +00:00
}