Mercurial > hg > xemacs-beta
annotate src/sysproc.h @ 5294:bbff29a01820
Add compiler macros and compilation sanity-checks for functions with keywords.
2010-10-25 Aidan Kehoe <kehoea@parhasard.net>
Add compiler macros and compilation sanity-checking for various
functions that take keywords.
* byte-optimize.el (side-effect-free-fns): #'symbol-value is
side-effect free and not error free.
* bytecomp.el (byte-compile-normal-call): Check keyword argument
lists for sanity; store information about the positions where
keyword arguments start using the new byte-compile-keyword-start
property.
* cl-macs.el (cl-const-expr-val): Take a new optional argument,
cl-not-constant, defaulting to nil, in this function; return it if
the expression is not constant.
(cl-non-fixnum-number-p): Make this into a separate function, we
want to pass it to #'every.
(eql): Use it.
(define-star-compiler-macros): Use the same code to generate the
member*, assoc* and rassoc* compiler macros; special-case some
code in #'add-to-list in subr.el.
(remove, remq): Add compiler macros for these two functions, in
preparation for #'remove being in C.
(define-foo-if-compiler-macros): Transform (remove-if-not ...) calls to
(remove ... :if-not) at compile time, which will be a real win
once the latter is in C.
(define-substitute-if-compiler-macros)
(define-subst-if-compiler-macros): Similarly for these functions.
(delete-duplicates): Change this compiler macro to use
#'plists-equal; if we don't have information about the type of
SEQUENCE at compile time, don't bother attempting to inline the
call, the function will be in C soon enough.
(equalp): Remove an old commented-out compiler macro for this, if
we want to see it it's in version control.
(subst-char-in-string): Transform this to a call to nsubstitute or
nsubstitute, if that is appropriate.
* cl.el (ldiff): Don't call setf here, this makes for a load-time
dependency problem in cl-macs.el
| author | Aidan Kehoe <kehoea@parhasard.net> |
|---|---|
| date | Mon, 25 Oct 2010 13:04:04 +0100 |
| parents | aa5ed11f473b |
| children | 308d34e9f07d |
| rev | line source |
|---|---|
| 428 | 1 /* |
| 2 Copyright (C) 1995 Free Software Foundation, Inc. | |
| 853 | 3 Copyright (C) 2000, 2002 Ben Wing. |
| 428 | 4 |
| 5 This file is part of XEmacs. | |
| 6 | |
| 7 XEmacs is free software; you can redistribute it and/or modify it | |
| 8 under the terms of the GNU General Public License as published by the | |
| 9 Free Software Foundation; either version 2, or (at your option) any | |
| 10 later version. | |
| 11 | |
| 12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 15 for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
| 18 along with XEmacs; see the file COPYING. If not, write to | |
| 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 20 Boston, MA 02111-1307, USA. */ | |
| 21 | |
| 22 /* Synched up with: Not really in FSF. */ | |
| 23 | |
| 440 | 24 #ifndef INCLUDED_sysproc_h_ |
| 25 #define INCLUDED_sysproc_h_ | |
| 26 | |
| 428 | 27 #include "systime.h" /* necessary for sys/resource.h; also gets the |
| 28 FD_* defines on some systems. */ | |
| 442 | 29 #ifndef WIN32_NATIVE |
| 428 | 30 #include <sys/resource.h> |
| 31 #endif | |
| 32 | |
| 771 | 33 #ifdef MINGW |
| 34 #include <../mingw/process.h> | |
| 35 #elif defined (CYGWIN) | |
| 36 #include <../include/process.h> | |
| 37 #elif defined (WIN32_NATIVE) | |
| 38 /* <process.h> should not conflict with "process.h", as per ANSI definition. | |
| 39 This is not true with visual c though. The trick below works with | |
| 40 VC4.2b, 5.0 and 6.0. It assumes that VC is installed in a kind of | |
| 41 standard way, so include path ends with /include. | |
| 42 */ | |
| 43 #include <../include/process.h> | |
| 44 #endif | |
| 45 | |
| 428 | 46 #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ |
| 47 # include <sys/types.h> /* AJK */ | |
| 442 | 48 # ifndef WIN32_NATIVE |
| 49 # include <sys/socket.h> | |
| 50 # include <netdb.h> | |
| 51 # include <netinet/in.h> | |
| 52 # include <arpa/inet.h> | |
| 53 # endif | |
| 428 | 54 #endif /* HAVE_SOCKETS */ |
| 55 | |
| 442 | 56 #ifdef WIN32_NATIVE |
| 57 /* Note: winsock.h already included in systime.h above */ | |
| 58 /* map winsock error codes to standard names */ | |
| 59 #define EWOULDBLOCK WSAEWOULDBLOCK | |
| 60 #define EINPROGRESS WSAEINPROGRESS | |
| 61 #define EALREADY WSAEALREADY | |
| 62 #define ENOTSOCK WSAENOTSOCK | |
| 63 #define EDESTADDRREQ WSAEDESTADDRREQ | |
| 64 #define EMSGSIZE WSAEMSGSIZE | |
| 65 #define EPROTOTYPE WSAEPROTOTYPE | |
| 66 #define ENOPROTOOPT WSAENOPROTOOPT | |
| 67 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT | |
| 68 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT | |
| 69 #define EOPNOTSUPP WSAEOPNOTSUPP | |
| 70 #define EPFNOSUPPORT WSAEPFNOSUPPORT | |
| 71 #define EAFNOSUPPORT WSAEAFNOSUPPORT | |
| 72 #define EADDRINUSE WSAEADDRINUSE | |
| 73 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL | |
| 74 #define ENETDOWN WSAENETDOWN | |
| 75 #define ENETUNREACH WSAENETUNREACH | |
| 76 #define ENETRESET WSAENETRESET | |
| 77 #define ECONNABORTED WSAECONNABORTED | |
| 78 #define ECONNRESET WSAECONNRESET | |
| 79 #define ENOBUFS WSAENOBUFS | |
| 80 #define EISCONN WSAEISCONN | |
| 81 #define ENOTCONN WSAENOTCONN | |
| 82 #define ESHUTDOWN WSAESHUTDOWN | |
| 83 #define ETOOMANYREFS WSAETOOMANYREFS | |
| 84 #define ETIMEDOUT WSAETIMEDOUT | |
| 85 #define ECONNREFUSED WSAECONNREFUSED | |
| 86 #define ELOOP WSAELOOP | |
| 87 /* #define ENAMETOOLONG WSAENAMETOOLONG */ | |
| 88 #define EHOSTDOWN WSAEHOSTDOWN | |
| 89 #define EHOSTUNREACH WSAEHOSTUNREACH | |
| 90 /* #define ENOTEMPTY WSAENOTEMPTY */ | |
| 91 #define EPROCLIM WSAEPROCLIM | |
| 92 #define EUSERS WSAEUSERS | |
| 93 #define EDQUOT WSAEDQUOT | |
| 94 #define ESTALE WSAESTALE | |
| 95 #define EREMOTE WSAEREMOTE | |
| 96 #endif /* WIN32_NATIVE */ | |
| 97 | |
| 3025 | 98 /* On some systems, e.g. DGUX, inet_addr returns a `struct in_addr'. */ |
| 428 | 99 #ifdef HAVE_BROKEN_INET_ADDR |
| 100 # define IN_ADDR struct in_addr | |
| 101 # define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == -1) | |
| 102 #else | |
| 103 # if (LONGBITS > 32) | |
| 104 # define IN_ADDR unsigned int | |
| 105 # else | |
| 106 # define IN_ADDR unsigned long | |
| 107 # endif | |
| 108 # define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1) | |
| 109 #endif | |
| 110 | |
| 111 /* Define first descriptor number available for subprocesses. */ | |
| 112 #define FIRST_PROC_DESC 3 | |
| 113 | |
| 114 #ifdef AIX | |
| 115 #include <sys/select.h> | |
| 116 #endif | |
| 117 | |
| 444 | 118 #ifdef HAVE_STROPTS_H |
| 119 #include <stropts.h> /* isastream(), I_PUSH */ | |
| 442 | 120 #endif |
| 121 | |
| 444 | 122 #ifdef HAVE_STRTIO_H |
| 123 #include <strtio.h> /* TIOCSIGNAL */ | |
| 442 | 124 #endif |
| 125 | |
| 126 #ifdef HAVE_PTY_H | |
| 127 #include <pty.h> /* openpty() on Tru64, Linux */ | |
| 128 #endif | |
| 129 | |
| 130 #ifdef HAVE_LIBUTIL_H | |
| 458 | 131 #include <libutil.h> /* openpty() on FreeBSD */ |
| 132 #endif | |
| 133 | |
| 134 #ifdef HAVE_UTIL_H | |
| 135 #include <util.h> /* openpty() on NetBSD */ | |
| 442 | 136 #endif |
| 137 | |
| 2286 | 138 /* The FD_* macros expand to __extension__ forms on glibc-based systems. Uno |
| 139 does not understand such forms, so let's help it out. */ | |
| 140 #ifdef UNO | |
| 141 #undef FD_SET | |
| 142 #undef FD_CLR | |
| 143 #undef FD_ISSET | |
| 144 #undef FD_ZERO | |
| 145 #undef MAXDESC | |
| 146 #undef SELECT_TYPE | |
| 147 #endif /* UNO */ | |
| 148 | |
| 428 | 149 #ifdef FD_SET |
| 150 | |
| 151 /* We could get this from param.h, but better not to depend on finding that. | |
| 152 And better not to risk that it might define other symbols used in this | |
| 153 file. */ | |
| 154 # ifdef FD_SETSIZE | |
| 155 # define MAXDESC FD_SETSIZE | |
| 156 # else | |
| 157 # define MAXDESC 64 | |
| 158 # endif /* FD_SETSIZE */ | |
| 159 # define SELECT_TYPE fd_set | |
| 160 | |
| 161 #else /* no FD_SET */ | |
| 162 | |
| 163 # define MAXDESC 32 | |
| 164 # define SELECT_TYPE int | |
| 165 | |
| 166 /* Define the macros to access a single-int bitmap of descriptors. */ | |
| 167 # define FD_SET(n, p) (*(p) |= (1 << (n))) | |
| 168 # define FD_CLR(n, p) (*(p) &= ~(1 << (n))) | |
| 169 # define FD_ISSET(n, p) (*(p) & (1 << (n))) | |
| 170 # define FD_ZERO(p) (*(p) = 0) | |
| 171 | |
| 172 #endif /* no FD_SET */ | |
| 173 | |
| 174 int poll_fds_for_input (SELECT_TYPE mask); | |
| 867 | 175 int qxe_execve (const Ibyte *filename, Ibyte * const argv[], |
| 176 Ibyte * const envp[]); | |
| 771 | 177 pid_t qxe_getpid (void); |
| 428 | 178 |
| 853 | 179 /* #### I would really like to delete the remaining synchronous code entirely. |
| 180 We are now using it only for *REALLY* old systems -- how many systems | |
| 181 nowadays | |
| 182 | |
| 183 (a) lack job control, or | |
| 184 (b) lack mkdir() or rmdir() | |
| 185 | |
| 186 ????? | |
| 187 | |
| 188 --ben | |
| 189 */ | |
| 190 | |
| 859 | 191 #include "syssignal.h" /* needed for SIGTSTP */ |
| 854 | 192 |
|
4759
aa5ed11f473b
Remove support for obsolete systems. See xemacs-patches message with ID
Jerry James <james@xemacs.org>
parents:
3025
diff
changeset
|
193 #if !defined (WIN32_NATIVE) && (!defined (SIGTSTP) || !defined (HAVE_MKDIR) || !defined (HAVE_RMDIR)) |
| 853 | 194 |
| 195 #define NEED_SYNC_PROCESS_CODE | |
| 196 | |
| 197 /* True iff we are about to fork off a synchronous process or if we | |
| 198 are waiting for it. */ | |
| 199 extern volatile int synch_process_alive; | |
| 200 | |
| 201 /* Nonzero => this is a string explaining death of synchronous subprocess. */ | |
| 202 extern const char *synch_process_death; | |
| 203 | |
| 204 /* If synch_process_death is zero, | |
| 205 this is exit code of synchronous subprocess. */ | |
| 206 extern int synch_process_retcode; | |
| 207 | |
| 208 #endif | |
| 209 | |
| 210 | |
| 440 | 211 #endif /* INCLUDED_sysproc_h_ */ |
