Get em22 working. Remove the leading-underscore system calls from its libsys.
authorDavid Given <dg@cowlark.com>
Sat, 23 Jun 2018 13:57:57 +0000 (15:57 +0200)
committerDavid Given <dg@cowlark.com>
Sat, 23 Jun 2018 13:57:57 +0000 (15:57 +0200)
46 files changed:
build.lua
lang/cem/libcc.ansi/build.lua
lang/cem/libcc.ansi/headers/ack/config.h
lang/cem/libcc.ansi/headers/sys/times.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/unistd.h
lang/cem/libcc.ansi/misc/getpass.c
lang/cem/libcc.ansi/misc/isatty.c
lang/cem/libcc.ansi/stdio/isatty.c [deleted file]
lang/cem/libcc.ansi/stdlib/system.c
lang/cem/libcc.ansi/time/clock.c
lang/cem/libcc.ansi/time/misc.c
plat/em/include/ack/plat.h [moved from plat/em22/include/ack/plat.h with 66% similarity]
plat/em/include/ack/signal.h [moved from plat/em22/include/unistd.h with 51% similarity]
plat/em/include/build.lua [new file with mode: 0644]
plat/em/include/sgtty.h [moved from plat/em22/include/sgtty.h with 100% similarity]
plat/em/include/sys/timeb.h [moved from plat/em22/include/sys/timeb.h with 83% similarity]
plat/em/include/sys/types.h [moved from plat/em22/include/sys/types.h with 86% similarity]
plat/em/libsys/_alarm.e [deleted file]
plat/em/libsys/_brk.e [deleted file]
plat/em/libsys/_close.e [deleted file]
plat/em/libsys/_creat.e [deleted file]
plat/em/libsys/_dup.e [deleted file]
plat/em/libsys/_dup2.e [deleted file]
plat/em/libsys/_execl.e [deleted file]
plat/em/libsys/_execve.e [deleted file]
plat/em/libsys/_fork.e [deleted file]
plat/em/libsys/_fstat.e [deleted file]
plat/em/libsys/_ftime.e [deleted file]
plat/em/libsys/_getpid.e [deleted file]
plat/em/libsys/_gtty.c [deleted file]
plat/em/libsys/_ioctl.e [deleted file]
plat/em/libsys/_kill.e [deleted file]
plat/em/libsys/_link.e [deleted file]
plat/em/libsys/_lseek.e [deleted file]
plat/em/libsys/_open.e [deleted file]
plat/em/libsys/_pause.e [deleted file]
plat/em/libsys/_pipe.e [deleted file]
plat/em/libsys/_read.e [deleted file]
plat/em/libsys/_sbrk.e [deleted file]
plat/em/libsys/_stty.c [deleted file]
plat/em/libsys/_times.e [deleted file]
plat/em/libsys/_unlink.e [deleted file]
plat/em/libsys/_wait.e [deleted file]
plat/em/libsys/_write.e [deleted file]
plat/em22/descr
plat/em22/include/build.lua

index 8175af5..9bce99f 100644 (file)
--- a/build.lua
+++ b/build.lua
@@ -16,7 +16,7 @@ vars.plats = {
        "pc86",
        "rpi",
        "pdpv7",
---     "em22",
+       "em22",
 }
 vars.plats_with_tests = {
        "linux68k",
index d5e33a6..4c89867 100644 (file)
@@ -50,6 +50,8 @@ for _, plat in ipairs(vars.plats) do
                        "./stdlib/*.c",
                        "./string/*.c",
                        "./time/*.c",
+                       "./misc/getpass.c",
+                       "./misc/isatty.c",
                },
                hdrs = {}, -- must be empty
                deps = {
index 84174a1..ae397db 100644 (file)
@@ -19,4 +19,9 @@
 #define ACKCONF_WANT_STANDARD_SIGNALS 1
 #endif
 
+#ifndef ACKCONF_WANT_TERMIOS
+/* Don't compile termios-using functions unless the plat explicitly asks for it. */
+#define ACKCONF_WANT_TERMIOS 0
+#endif
+
 #endif
diff --git a/lang/cem/libcc.ansi/headers/sys/times.h b/lang/cem/libcc.ansi/headers/sys/times.h
new file mode 100644 (file)
index 0000000..8311a80
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _SYS_TIMES_H
+#define _SYS_TIMES_H
+
+struct tms {
+    clock_t tms_utime;  /* user time */
+    clock_t tms_stime;  /* system time */
+    clock_t tms_cutime; /* user time of children */
+    clock_t tms_cstime; /* system time of children */
+};
+
+extern clock_t times(struct tms* buf);
+
+#endif
index b088f95..ef3b816 100644 (file)
@@ -92,7 +92,9 @@ extern int sigaction(int, const struct sigaction *, struct sigaction *);
 extern int sigprocmask(int, const sigset_t *, sigset_t *);
 extern int unlink(const char* path);
 extern off_t lseek(int fildes, off_t offset, int whence);
+extern pid_t fork(void);
 extern pid_t getpid(void);
+extern pid_t wait(int* wstatus);
 extern sighandler_t signal(int signum, sighandler_t handler);
 extern ssize_t read(int fd, void* buffer, size_t count);
 extern ssize_t write(int fd, void* buffer, size_t count);
index 4b21512..a24c65d 100644 (file)
@@ -6,41 +6,67 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <string.h>
-#include <sgtty.h>
 #include <fcntl.h>
 
-int _open(const char* path, int flags);
-int _write(int d, const char* buf, int nbytes);
-int _read(int d, char* buf, int nbytes);
-int _close(int d);
+#if ACKCONF_WANT_TERMIOS
 
-int _stty(int, struct sgttyb*);
-int _gtty(int, struct sgttyb*);
+#include <termios.h>
+static int intr;
 
-char* getpass(const char* prompt)
+static void catch(int sig)
 {
-       int i = 0;
-       struct sgttyb tty, ttysave;
-       static char pwdbuf[9];
-       int fd;
-       void (*savesig)(int);
-
-       if ((fd = _open("/dev/tty", O_RDONLY)) < 0)
-               fd = 0;
-       savesig = signal(SIGINT, SIG_IGN);
-       _write(2, prompt, strlen(prompt));
-       _gtty(fd, &tty);
-       ttysave = tty;
-       tty.sg_flags &= ~ECHO;
-       _stty(fd, &tty);
-       i = _read(fd, pwdbuf, 9);
-       while (pwdbuf[i - 1] != '\n')
-               _read(fd, &pwdbuf[i - 1], 1);
-       pwdbuf[i - 1] = '\0';
-       _stty(fd, &ttysave);
-       _write(2, "\n", 1);
-       if (fd != 0)
-               _close(fd);
-       signal(SIGINT, savesig);
-       return (pwdbuf);
+       intr= 1;
 }
+
+char *getpass(const char *prompt)
+{
+       struct sigaction osa, sa;
+       struct termios cooked, raw;
+       static char password[32+1];
+       int fd, n= 0;
+
+       /* Try to open the controlling terminal. */
+       if ((fd= open("/dev/tty", O_RDONLY)) < 0) return NULL;
+
+       /* Trap interrupts unless ignored. */
+       intr= 0;
+       sigaction(SIGINT, NULL, &osa);
+       if (osa.sa_handler != SIG_IGN) {
+               sigemptyset(&sa.sa_mask);
+               sa.sa_flags= 0;
+               sa.sa_handler= catch;
+               sigaction(SIGINT, &sa, &osa);
+       }
+
+       /* Set the terminal to non-echo mode. */
+       tcgetattr(fd, &cooked);
+       raw= cooked;
+       raw.c_iflag|= ICRNL;
+       raw.c_lflag&= ~ECHO;
+       raw.c_lflag|= ECHONL;
+       raw.c_oflag|= OPOST | ONLCR;
+       tcsetattr(fd, TCSANOW, &raw);
+
+       /* Print the prompt.  (After setting non-echo!) */
+       write(2, prompt, strlen(prompt));
+
+       /* Read the password, 32 characters max. */
+       while (read(fd, password+n, 1) > 0) {
+               if (password[n] == '\n') break;
+               if (n < 32) n++;
+       }
+       password[n]= 0;
+
+       /* Terminal back to cooked mode. */
+       tcsetattr(fd, TCSANOW, &cooked);
+
+       close(fd);
+
+       /* Interrupt? */
+       sigaction(SIGINT, &osa, NULL);
+       if (intr) raise(SIGINT);
+
+       return password;
+}
+
+#endif
index cda06f4..a2d3f78 100644 (file)
@@ -3,9 +3,16 @@
  */
 /* $Id$ */
 
-int _isatty(int d);
+#include <stdlib.h>
 
-int isatty(int d)
+#if ACKCONF_WANT_TERMIOS
+
+#include <termios.h>
+int isatty(int fd)
 {
-       return _isatty(d);
+  struct termios dummy;
+
+  return(tcgetattr(fd, &dummy) == 0);
 }
+
+#endif
diff --git a/lang/cem/libcc.ansi/stdio/isatty.c b/lang/cem/libcc.ansi/stdio/isatty.c
deleted file mode 100644 (file)
index 97d7ca4..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * _isatty - check if a file descriptor is associated with a terminal
- */
-/* $Id$ */
-
-int _gtty(int d, char* buf);
-
-int _isatty(int d)
-{
-       char buf[128];
-       /* not a sgttyb struct; it might not be large enough;
-          I know for a fact that it isn't large enough on PC/IX,
-          where gtty is an ioctl(..., TCGETA, ...)
-       */
-
-       return _gtty(d, buf) >= 0;
-}
index ba31b04..49dba63 100644 (file)
@@ -4,19 +4,10 @@
  */
 /* $Id$ */
 
-#if defined(_POSIX_SOURCE)
 #include <sys/types.h>
-#endif
 #include <stdlib.h>
 #include <signal.h>
-
-extern char** environ;
-
-extern int _fork(void);
-extern int _wait(int*);
-extern void _exit(int);
-extern void _execve(const char* path, const char** argv, const char** envp);
-extern void _close(int);
+#include <unistd.h>
 
 #define FAIL 127
 
@@ -32,21 +23,21 @@ int system(const char* str)
        int pid, exitstatus, waitval;
        int i;
 
-       if ((pid = _fork()) < 0)
+       if ((pid = fork()) < 0)
                return str ? -1 : 0;
 
        if (pid == 0)
        {
                for (i = 3; i <= 20; i++)
-                       _close(i);
+                       close(i);
                if (!str)
                        str = "cd ."; /* just testing for a shell */
                exec_tab[2] = str; /* fill in command */
-               _execve("/bin/sh", exec_tab, (char const**)environ);
+               execve("/bin/sh", (char* const*)exec_tab, (char* const*)environ);
                /* get here if execve fails ... */
                _exit(FAIL); /* see manual page */
        }
-       while ((waitval = _wait(&exitstatus)) != pid)
+       while ((waitval = wait(&exitstatus)) != pid)
        {
                if (waitval == -1)
                        break;
index e5d2577..f41e12d 100644 (file)
@@ -4,80 +4,14 @@
 /* $Id$ */
 
 #include <time.h>
-
-#if defined(__BSD4_2)
-
-#define RUSAGE_SELF 0
-#define RUSAGE_CHILDREN -1
-
-struct rusage
-{
-       struct timeval ru_utime; /* user time used */
-       struct timeval ru_stime; /* system time used */
-       long ru_maxrss;
-       long ru_ixrss; /* integral shared memory size */
-       long ru_idrss; /* integral unshared data size */
-       long ru_isrss; /* integral unshared stack size */
-       long ru_minflt; /* page reclaims */
-       long ru_majflt; /* page faults */
-       long ru_nswap; /* swaps */
-       long ru_inblock; /* block input operations */
-       long ru_oublock; /* block output operations */
-       long ru_msgsnd; /* messages sent */
-       long ru_msgrcv; /* messages received */
-       long ru_nsignals; /* signals received */
-       long ru_nvcsw; /* voluntary context switches */
-       long ru_nivcsw; /* involuntary context switches */
-};
-
-void _getrusage(int who, struct rusage* rusage);
-
-#elif defined(_POSIX_SOURCE) || defined(__USG)
-
-struct tms
-{
-       time_t tms_utime; /* user time */
-       time_t tms_stime; /* system time */
-       time_t tms_cutime; /* user time, children */
-       time_t tms_cstime; /* system time, children */
-};
-
-long _times(struct tms* buffer);
-
-#else /* Version 7 UNIX */
-
-struct tbuffer
-{
-       long proc_user_time;
-       long proc_system_time;
-       long child_user_time;
-       long child_system_time;
-};
-
-long _times(struct tbuffer* buffer);
-
-#endif
+#include <sys/times.h>
 
 clock_t
 clock(void)
 {
-#if defined(__BSD4_2)
-       struct rusage rusage;
-
-       _getrusage(RUSAGE_SELF, &rusage);
-
-       return (((unsigned long)rusage.ru_utime.tv_sec * CLOCKS_PER_SEC)
-           + rusage.ru_utime.tv_usec);
-#elif defined(_POSIX_SOURCE) || defined(__USG)
        struct tms tms;
 
-       _times(&tms);
+       times(&tms);
        /* Assume that time_t can be converted to clock_t for Sys5 */
        return tms.tms_utime;
-#else
-       struct tbuffer tbuffer;
-
-       _times(&tbuffer);
-       return tbuffer.proc_user_time;
-#endif
 }
index 8a21fb5..6a18230 100644 (file)
@@ -8,23 +8,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#if defined(__BSD4_2)
-
-extern int _gettimeofday(struct timeval* tp, struct timezone* tzp);
-
-#elif !defined(_POSIX_SOURCE) && !defined(__USG)
-#if !defined(_MINIX) /* MINIX has no ftime() */
-struct timeb
-{
-       long time;
-       unsigned short millitm;
-       short timezone;
-       short dstflag;
-};
-void _ftime(struct timeb* bp);
-#endif
-#endif
-
 #include "loc_time.h"
 
 #define RULE_LEN 120
@@ -42,15 +25,8 @@ long _dst_off = 60 * 60;
 int _daylight = 0;
 char* _tzname[2] = { ntstr, dststr };
 
-#if defined(__USG) || defined(_POSIX_SOURCE)
 char* tzname[2] = { ntstr, dststr };
 
-#if defined(__USG)
-long timezone = 0;
-int daylight = 0;
-#endif
-#endif
-
 static struct dsttype
 {
        char ds_type; /* Unknown, Julian, Zero-based or M */
@@ -427,37 +403,10 @@ parseTZ(const char* p)
 
 void _tzset(void)
 {
-#if defined(__BSD4_2)
-
-       struct timeval tv;
-       struct timezone tz;
-
-       _gettimeofday(&tv, &tz);
-       _daylight = tz.tz_dsttime;
-       _timezone = tz.tz_minuteswest * 60L;
-
-#elif !defined(_POSIX_SOURCE) && !defined(__USG)
-
-#if !defined(_MINIX) /* MINIX has no ftime() */
-       struct timeb tim;
-
-       _ftime(&tim);
-       _timezone = tim.timezone * 60L;
-       _daylight = tim.dstflag;
-#endif
-
-#endif /* !_POSIX_SOURCE && !__USG */
-
        parseTZ(getenv("TZ")); /* should go inside #if */
 
-#if defined(__USG) || defined(_POSIX_SOURCE)
        tzname[0] = _tzname[0];
        tzname[1] = _tzname[1];
-#if defined(__USG)
-       timezone = _timezone;
-       daylight = _daylight;
-#endif
-#endif /* __USG || _POSIX_SOURCE */
 }
 
 static int
similarity index 66%
rename from plat/em22/include/ack/plat.h
rename to plat/em/include/ack/plat.h
index 87be3d0..585a6ab 100644 (file)
@@ -3,4 +3,6 @@
 
 #define ACKCONF_TIME_IS_A_SYSCALL
 
+#define ACKCONF_WANT_STANDARD_SIGNALS 0
+
 #endif
similarity index 51%
rename from plat/em22/include/unistd.h
rename to plat/em/include/ack/signal.h
index 7b45573..6b8edd8 100644 (file)
@@ -1,59 +1,9 @@
-/*
- * unistd.h - standard system calls
- */
-
-#ifndef _UNISTD_H
-#define _UNISTD_H
-
-#include <stddef.h>
-
-/* Types */
-
-typedef int pid_t;
-typedef int mode_t;
-
-/* Constants for file access (open and friends) */
-
-enum
-{
-       O_ACCMODE = 0x3,
-       
-       O_RDONLY = 0,
-       O_WRONLY = 1,
-       O_RDWR = 2,
-       
-       O_CREAT = 0100,
-       O_TRUNC = 01000,
-       O_APPEND = 02000,
-       O_NONBLOCK = 04000
-};
-
-/* Special variables */
-
-extern char** environ;
-
-/* Implemented system calls */
-
-extern void _exit(int);
-extern pid_t getpid(void);
-extern int brk(void* addr);
-extern void* sbrk(int increment);
-extern int isatty(int d);
-extern off_t lseek(int fildes, off_t offset, int whence);
-extern int close(int d);
-extern int open(const char* path, int access, ...);
-extern int creat(const char* path, mode_t mode);
-extern int read(int fd, void* buffer, size_t count);
-extern int write(int fd, void* buffer, size_t count);
-
-/* Unimplemented system calls (these are just prototypes to let the library
- * compile). */
-
-extern int fcntl(int fd, int op, ...);
-
-/* Signal handling */
+#ifndef _ACK_SIGNAL_H
+#define _ACK_SIGNAL_H
 
 typedef int sig_atomic_t;
+struct sigaction;
+typedef unsigned short sigset_t;
 
 #define SIG_ERR ((sighandler_t) -1)           /* Error return.  */
 #define SIG_DFL ((sighandler_t) 0)            /* Default action.  */
@@ -78,8 +28,4 @@ typedef int sig_atomic_t;
 #define SIGALRM           14   /* alarm clock */
 #define SIGTERM           15   /* software termination signal from kill */
 
-typedef void (*sighandler_t)(int);
-extern sighandler_t signal(int signum, sighandler_t handler);
-extern int raise(int signum);
-
 #endif
diff --git a/plat/em/include/build.lua b/plat/em/include/build.lua
new file mode 100644 (file)
index 0000000..b59e64d
--- /dev/null
@@ -0,0 +1,27 @@
+include("plat/build.lua")
+
+headermap = {}
+packagemap = {}
+
+local function addheader(h)
+       headermap[h] = "./"..h
+       packagemap["$(PLATIND)/em/include/"..h] = "./"..h
+end
+
+addheader("ack/plat.h")
+addheader("sys/types.h")
+addheader("sys/timeb.h")
+addheader("ack/signal.h")
+addheader("sgtty.h")
+
+acklibrary {
+       name = "headers",
+       hdrs = headermap
+}
+
+installable {
+       name = "pkg",
+       map = packagemap
+}
+
+
similarity index 83%
rename from plat/em22/include/sys/timeb.h
rename to plat/em/include/sys/timeb.h
index 92f48ed..5a8286a 100644 (file)
@@ -3,9 +3,14 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
+#ifndef _SYS_TIMEB_H
+#define _SYS_TIMEB_H
+
 struct timeb {
        time_t  time;
        unsigned short  millitm;
        short   timezone;
        short   dstflag;
 };
+
+#endif
similarity index 86%
rename from plat/em22/include/sys/types.h
rename to plat/em/include/sys/types.h
index 8d431b0..e133027 100644 (file)
@@ -11,8 +11,8 @@ typedef unsigned int          ino_t;
 typedef unsigned short         mode_t;
 typedef unsigned short         nlink_t;
 typedef int                    pid_t;
-typedef ptrdiff_t              ssize_t;
 typedef unsigned int           uid_t;
-typedef unsigned long  time_t;
+typedef long time_t;
+typedef int suseconds_t;
 
 #endif
diff --git a/plat/em/libsys/_alarm.e b/plat/em/libsys/_alarm.e
deleted file mode 100644 (file)
index dc530b2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_alarm
- pro $_alarm,0
- lol 0
- loc 27
- mon
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_brk.e b/plat/em/libsys/_brk.e
deleted file mode 100644 (file)
index d7dd6e4..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-#include <em_abs.h>
-
- mes 2,EM_WSIZE,EM_PSIZE
-
-.1
- bss EM_PSIZE,0,0
-.2
- bss EM_WSIZE,0,0
-
- pro $ctch,0
- lol 0
- loc EHEAP
- beq *1
- lae .1
- loi EM_PSIZE
- sig
- asp EM_PSIZE
- lol 0
- trp
- rtt
-1
- loc 1
- ste .2
- rtt
- end
-
-
- exp $_brk
- pro $_brk,0
- lpi $ctch
- sig
- lae .1
- sti EM_PSIZE
- loc 0
- ste .2
- lal 0
- loi EM_PSIZE
- str 2          ; The - possibly - occurring trap is caught
- lae .1
- loi EM_PSIZE
- sig
- asp EM_PSIZE
- loe .2
- zgt *1
- zer EM_PSIZE
- ret EM_PSIZE
-1
- loc -1
- loc EM_WSIZE
- loc EM_PSIZE
- cii
- ret EM_PSIZE
- end
diff --git a/plat/em/libsys/_close.e b/plat/em/libsys/_close.e
deleted file mode 100644 (file)
index e22c982..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_close
- pro $_close,0
- lol 0
- loc 6
- mon
- zne *1
- loc 0
- ret EM_WSIZE
-1
- ste errno
- loc -1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_creat.e b/plat/em/libsys/_creat.e
deleted file mode 100644 (file)
index 0d883dd..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_creat
- pro $_creat,0
- lal 0
- loi EM_WSIZE+EM_PSIZE
- loc 8
- mon
- zeq *1
- ste errno              ; since e==r0
- loc -1
-1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_dup.e b/plat/em/libsys/_dup.e
deleted file mode 100644 (file)
index 9d11700..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_dup
- pro $_dup,0
- lol 0
- dup EM_WSIZE
- loc 41
- mon
- zeq *1
- ste errno
- loc -1
-1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_dup2.e b/plat/em/libsys/_dup2.e
deleted file mode 100644 (file)
index 719e3a1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_dup2
- pro $_dup2,0
- lal 0
- loi 2*EM_WSIZE
- loc 64
- ior EM_WSIZE
- loc 41
- mon
- zeq *1
- ste errno
- loc -1
-1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_execl.e b/plat/em/libsys/_execl.e
deleted file mode 100644 (file)
index 3ce7ed5..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_execl
- pro $_execl,0
- lae environ
- loi EM_PSIZE
- lal EM_PSIZE
- lal 0
- loi EM_PSIZE
- loc 59
- mon
- ste errno
- loc -1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_execve.e b/plat/em/libsys/_execve.e
deleted file mode 100644 (file)
index 023a5b8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_execve
- pro $_execve,0
- lal 0
- loi 3*EM_PSIZE
- loc 59
- mon
- ste errno
- loc -1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_fork.e b/plat/em/libsys/_fork.e
deleted file mode 100644 (file)
index 6104140..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
-
- exp $_fork
- pro $_fork,0
- loc 2
- mon
- zeq *1
- ste errno
- loc -1
- ret EM_WSIZE
-1
- zeq *2
- asp EM_WSIZE
- loc 0
-2
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_fstat.e b/plat/em/libsys/_fstat.e
deleted file mode 100644 (file)
index 336e1c8..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_fstat
- pro $_fstat,0
- lal 0
- loi EM_WSIZE+EM_PSIZE
- loc 28
- mon
- zne *1
- loc 0
- ret EM_WSIZE
-1
- ste errno
- loc -1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_ftime.e b/plat/em/libsys/_ftime.e
deleted file mode 100644 (file)
index 46190b6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_ftime
- pro $_ftime,0
- lal 0
- loi EM_PSIZE
- loc 35
- mon
- zne *1
- loc 0
- bra *2
-1
- ste errno
- loc -1
-2
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_getpid.e b/plat/em/libsys/_getpid.e
deleted file mode 100644 (file)
index c4527b9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_getpid
- pro $_getpid,0
- loc 20
- mon
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_gtty.c b/plat/em/libsys/_gtty.c
deleted file mode 100644 (file)
index 7b7cf08..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $Id$ */
-#include <sgtty.h>
-int
-_gtty(fildes,argp) int fildes ; struct sgttyb *argp ; {
-       return _ioctl(fildes,TIOCGETP,argp) ;
-}
diff --git a/plat/em/libsys/_ioctl.e b/plat/em/libsys/_ioctl.e
deleted file mode 100644 (file)
index ce41262..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_ioctl
- pro $_ioctl,0
- lal 0
- loi EM_PSIZE+2*EM_WSIZE
- loc 54
- mon
- zne *1
- loc 0
- ret EM_WSIZE
-1
- ste errno
- loc -1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_kill.e b/plat/em/libsys/_kill.e
deleted file mode 100644 (file)
index fed5ec7..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_kill
- pro $_kill,0
- ldl 0
- loc 37
- mon
- zne *1
- loc 0
- ret EM_WSIZE
-1
- ste errno
- loc -1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_link.e b/plat/em/libsys/_link.e
deleted file mode 100644 (file)
index 21d3a86..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_link
- pro $_link,0
- lal 0
- loi 2*EM_PSIZE
- loc 9
- mon
- zne *1
- loc 0
- ret EM_WSIZE
-1
- ste errno
- loc -1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_lseek.e b/plat/em/libsys/_lseek.e
deleted file mode 100644 (file)
index a2b160a..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_lseek
- pro $_lseek,0
- lal 0
- loi 4*EM_WSIZE
- loc 19
- mon
- zeq *1
- ste errno
-#if EM_WSIZE==1
- ldc -1
- loc 2
- loc 4
- cii
-#endif
-#if EM_WSIZE==2
- ldc -1
-#endif
-#if EM_WSIZE==4
- loc -1
-#endif
-1
-#if EM_WSIZE==1
- ret 4*EM_WSIZE
-#endif
-#if EM_WSIZE==2
- ret 2*EM_WSIZE
-#endif
-#if EM_WSIZE==4
- ret EM_WSIZE
-#endif
- end
diff --git a/plat/em/libsys/_open.e b/plat/em/libsys/_open.e
deleted file mode 100644 (file)
index 0f3d511..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_open
- pro $_open,0
- lal 0
- loi EM_WSIZE+EM_PSIZE
- loc 5
- mon
- zeq *1
- ste errno
- loc -1
-1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_pause.e b/plat/em/libsys/_pause.e
deleted file mode 100644 (file)
index 81a9cab..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_pause
- pro $_pause,0
- loc 29
- mon
- ret 0
- end
diff --git a/plat/em/libsys/_pipe.e b/plat/em/libsys/_pipe.e
deleted file mode 100644 (file)
index faed4f6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_pipe
- pro $_pipe,0
- loc 42
- mon
- zeq *1
- ste errno
- loc -1
- ret EM_WSIZE
-1
- lal 0
- loi EM_PSIZE
- stf EM_WSIZE
- sil 0
- loc 0
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_read.e b/plat/em/libsys/_read.e
deleted file mode 100644 (file)
index 0c47d27..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_read
- pro $_read,0
- lol EM_WSIZE+EM_PSIZE
- loc EM_WSIZE
- loc EM_PSIZE
- ciu
- lal 0
- loi EM_WSIZE+EM_PSIZE
- loc 3
- mon
- zne *1
- loc EM_PSIZE
- loc EM_WSIZE
- cui
- bra *2
-1
- ste errno
- loc -1
-2
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_sbrk.e b/plat/em/libsys/_sbrk.e
deleted file mode 100644 (file)
index cd59228..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-#include <em_abs.h>
-
- mes 2,EM_WSIZE,EM_PSIZE
-
-.1
- bss EM_PSIZE,0,0
-.2
- bss EM_WSIZE,0,0
-
- pro $ctch,0
- lol 0
- loc EHEAP
- beq *1
- lae .1
- loi EM_PSIZE
- sig
- asp EM_PSIZE
- lol 0
- trp
- rtt
-1
- loc 1
- ste .2
- rtt
- end
-
-
- exp $_sbrk
- pro $_sbrk,0
- lor 2
- lor 2
- lpi $ctch
- sig
- lae .1
- sti EM_PSIZE
- loc 0
- ste .2
- lol 0
- ads EM_WSIZE  ; this is the new heap pointer, but watch out for overflow!
- dup EM_PSIZE
- lor 2
- cmp           ; compare with old heap pointer
- zlt *1
- str 2          ; The - possibly - occurring trap is caught
- lae .1
- loi EM_PSIZE
- sig
- asp EM_PSIZE
- loe .2
- zgt *1
- ret EM_PSIZE
-1
- asp EM_PSIZE
- loc -1
- loc EM_WSIZE
- loc EM_PSIZE
- cii
- ret EM_PSIZE
- end
diff --git a/plat/em/libsys/_stty.c b/plat/em/libsys/_stty.c
deleted file mode 100644 (file)
index b5d1f9a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $Id$ */
-#include <sgtty.h>
-int
-_stty(fildes,argp) int fildes ; struct sgttyb *argp ; {
-       return _ioctl(fildes,TIOCSETP,argp) ;
-}
diff --git a/plat/em/libsys/_times.e b/plat/em/libsys/_times.e
deleted file mode 100644 (file)
index a94fa4f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_times
- pro $_times,0
- lal 0
- loi EM_PSIZE
- loc 43
- mon
- ret 0
- end
diff --git a/plat/em/libsys/_unlink.e b/plat/em/libsys/_unlink.e
deleted file mode 100644 (file)
index 7a72b3e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_unlink
- pro $_unlink,0
- lal 0
- loi EM_PSIZE
- loc 10
- mon
- zne *1
- loc 0
- ret EM_WSIZE
-1
- ste errno
- loc -1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_wait.e b/plat/em/libsys/_wait.e
deleted file mode 100644 (file)
index 3ed01f0..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
-#if EM_WSIZE<4
-#define STATUS_SIZE 2
-#else
-#define STATUS_SIZE EM_WSIZE
-#endif
- exp $_wait
- pro $_wait,0
- loc 7
- mon
- zne *1
- lal 0
- loi EM_PSIZE
- zer EM_PSIZE
- cms EM_PSIZE
- zeq *2
-#if EM_WSIZE==1
- lal 0
- loi EM_PSIZE
- sti 2                  ; 2 bytes, not one int!
-#else
- sil 0
-#endif
- ret EM_WSIZE
-2
- asp STATUS_SIZE
- ret EM_WSIZE
-1
- ste errno
- loc -1
- ret EM_WSIZE
- end
diff --git a/plat/em/libsys/_write.e b/plat/em/libsys/_write.e
deleted file mode 100644 (file)
index f83775d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#
- mes 2,EM_WSIZE,EM_PSIZE
- exp $_write
- pro $_write,0
- lol EM_WSIZE+EM_PSIZE
- loc EM_WSIZE
- loc EM_PSIZE
- ciu
- lal 0
- loi EM_WSIZE+EM_PSIZE
- loc 4
- mon
- zne *1
- loc EM_PSIZE
- loc EM_WSIZE
- cui
- bra *2
-1
- ste errno
- loc -1
-2
- ret EM_WSIZE
- end
index 27e0c0f..c8610dd 100644 (file)
@@ -24,7 +24,7 @@ var SIZE_FLAG=-sx
 # Override the setting in fe so that files compiled for this platform can see
 # the platform-specific headers.
 
-var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/share/ack/include/ansi
+var C_INCLUDES=-I{EM}/share/ack/em/include -I{EM}/share/ack/include/ansi
 
 name asld
        from .k.m.a.g
index ab7564b..0a2c69d 100644 (file)
@@ -1,27 +1,4 @@
-include("plat/build.lua")
-
-headermap = {}
-packagemap = {}
-
-local function addheader(h)
-       headermap[h] = "./"..h
-       packagemap["$(PLATIND)/em22/include/"..h] = "./"..h
-end
-
-addheader("ack/plat.h")
-addheader("sys/types.h")
-addheader("sys/timeb.h")
-addheader("unistd.h")
-addheader("sgtty.h")
-
-acklibrary {
-       name = "headers",
-       hdrs = headermap
-}
-
 installable {
        name = "pkg",
-       map = packagemap
+       map = { "plat/em/include+pkg" }
 }
-
-