machdep.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. *
  4. * This product is part of the Amsterdam Compiler Kit.
  5. *
  6. * Permission to use, sell, duplicate or disclose this software must be
  7. * obtained in writing. Requests for such permissions may be sent to
  8. *
  9. * Dr. Andrew S. Tanenbaum
  10. * Wiskundig Seminarium
  11. * Vrije Universiteit
  12. * Postbox 7161
  13. * 1007 MC Amsterdam
  14. * The Netherlands
  15. *
  16. */
  17. /*
  18. * L L G E N
  19. *
  20. * An Extended LL(1) Parser Generator
  21. *
  22. * Author : Ceriel J.H. Jacobs
  23. */
  24. /*
  25. * machdep.c
  26. * Machine dependant things
  27. */
  28. # include "../../../h/em_path.h"
  29. # include "types.h"
  30. # ifndef NORCSID
  31. static string rcsid5 = "$Header$";
  32. # endif
  33. /* In this file the following routines are defined: */
  34. extern UNLINK();
  35. extern RENAME();
  36. extern string libpath();
  37. UNLINK(x) string x; {
  38. /* Must remove the file "x" */
  39. unlink(x); /* systemcall to remove file */
  40. }
  41. RENAME(x,y) string x,y; {
  42. /* Must move the file "x" to the file "y" */
  43. unlink(y);
  44. if(link(x,y)!=0)fatal(1,"Cannot link to %s",y);
  45. unlink(x);
  46. }
  47. string
  48. libpath(s) string s; {
  49. /* Must deliver a full pathname to the library file "s" */
  50. static char buf[100];
  51. string strcpy(), strcat();
  52. strcpy(buf,EM_DIR);
  53. strcat(buf,"/lib/LLgen/");
  54. strcat(buf,s);
  55. return buf;
  56. }