1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2% 3% File: PXK:EXTERNALS.SL 4% Description: Definitions of foreign language functions 5% Author: Brian Beach, Hewlett-Packard CRC 6% Created: 19-Apr-84 7% Modified: 15-Feb-85 13:25:43 8% Mode: Lisp 9% Package: 10% Status: Experimental (Do Not Distribute) 11% 12% (c) Copyright 1984, Hewlett-Packard Company, all rights reserved. 13% 14%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15% 16% Revisions: 17% 18% 29-May-87 (Harold Carr & Leigh Stoller) 19% Added external definition for setenv. 20% 05-May-87 (Leigh Stoller) 21% Added external definitions for fast-math.sl. They are in float.c 22% 13-Apr-87 (Leigh Stoller & Harold Carr) 23% Added external definition of allocatemorebps, defined in bpsheap.c. 24% 26-Sep-86 (Leigh Stoller) 25% Added external entry for exit which is needed on the sun to pass an exit 26% code back to unix. 27% 01-Sep-86 (Leigh Stoller) 28% Added external-system to do a standard system call from C. 29% 19-Aug-86 (Leigh Stoller) 30% Added entries for get_file_status, sigrelse, and sigset. 31% 15-Feb-85 13:25:18 (Brian Beach) 32% Commented out a couple of functions for Pisces. 33% 01-Feb-85 (Bill Williams) 34% Add external entries for Lisp terminal emulator. 35% 24-Jan-85 (Vicki O'Day) 36% Added sleep entry. 37% 7-Jan-85 (Vicki O'Day) 38% Removed nmodekeys entry. 39% 17-Dec-84 (Vicki O'Day) 40% Added setlinebuf entry. 41% Added syscall entry, for access to HP-UX system calls. The syntax 42% of this command is (syscall <system call #> <arg1> <arg2> ...). 43% Currently, a limit of four arguments to the system call is imposed, 44% since no system calls that we can use have more than this. The 45% various forms of execl do, but since we can't use fork now, we don't 46% need this. When we can use fork, the number of arguments allowed 47% by syscall should be increased. 48% 7-Dec-84 (Vicki O'Day) 49% Added nmodekeys entry, so 9836-users can call it. 50% 27-Sep-84 19:57:38 (Dave Matthews) 51% Added an external function declaration for the new alterheapsize function. 52% 17-Jul-84 22:51:12 (RAM) 53% Changed chdir to unixcd and time to external_time. 54% Added external_stat, link, and unlink. 55% 56%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 57 58(compiletime 59 (setf *foreign-functions* nil) 60 ) 61 62(compiletime 63 (defmacro external-function (name args) 64 (setf *foreign-functions* (cons name *foreign-functions*)) 65 (flag1 name 'foreignfunction) 66 `(de ,name ,args 67 (,name ,@args) 68 ))) 69 70(off r2i) 71 72% Defined in echo.c 73% 74(external-function echoon ()) 75(external-function echooff ()) 76(external-function external_charsininputbuffer (chan)) 77(external-function flushstdoutputbuffer ()) 78(external-function external_user_homedir_string ()) 79(external-function external_anyuser_homedir_string (user)) 80 81 82% Defined in bpsheap.c 83% 84(external-function alterheapsize (integer)) 85(external-function allocatemorebps (amount)) 86 87% Defined in file-status.c 88% 89(external-function get_file_status (filename block flag)) 90 91 92% Defined in os-hooks.c 93% 94(external-function os_startup_hook (pargc pargv)) 95(external-function os_cleanup_hook ()) 96 97 98% Defined in pslextras.c 99% 100(external-function external_alarm (sec)) 101(external-function external_ualarm (usec repeat)) 102(external-function external_time (buffer)) 103(external-function external_timc (buffer)) 104(external-function external_stat (path buf)) 105(external-function external_link (path1 path2)) 106(external-function external_unlink (path)) 107(external-function external_strlen (strptr)) 108(external-function external_setenv (varstring valstring)) 109(external-function external_getenv (envstring)) 110(external-function uxfloat (buffer integer)) 111(external-function uxfix (buffer)) 112(external-function uxassign (arg1-buffer arg2-buffere)) 113(external-function uxplus2 (result-buffer arg1-buffer arg2-buffer)) 114(external-function uxdifference (result-buffer arg1-buffer arg2-buffer)) 115(external-function uxtimes2 (result-buffer arg1-buffer arg2-buffer)) 116(external-function uxquotient (result-buffer arg1-buffer arg2-buffer)) 117(external-function uxgreaterp (arg1-buffer arg2-buffer tee nill)) 118(external-function uxlessp (arg1-buffer arg2-buffer tee nill)) 119(external-function uxwritefloat (buffer floatptr convstr)) 120(external-function uxdoubletofloat (x y)) 121(external-function uxfloattodouble (y y)) 122(external-function uxsin (r x)) 123(external-function uxcos (r x)) 124(external-function uxtan (r x)) 125(external-function uxasin (r x)) 126(external-function uxacos (r x)) 127(external-function uxatan (r x)) 128(external-function uxsqrt (r x)) 129(external-function uxexp (r x)) 130(external-function uxlog (r x)) 131(external-function uxatan2 (r y x)) 132 133 134% Defined in pwd-fn.c 135% 136(external-function external_pwd ()) 137 138 139% Defined in sigs.c 140% 141(external-function psl_sigset (signame handler)) 142(external-function sigrelse (signame handler)) 143 144 145% Defined In unexec.c 146% 147(external-function unexec (newname aname dstart bstart)) 148 149 150% Defined in unix-io.c 151% 152(external-function unixputc (ch)) 153(external-function unixputs (str)) 154(external-function unixputn (num)) 155(external-function unixcleario ()) 156(external-function expand_file_name (str)) 157(external-function unixopen (name mode)) 158(external-function unixcd (dir)) 159(external-function ctime (buffer)) 160(external-function external_system (command)) 161 162 163% Defined In the C Library 164% 165(external-function external_exit (status)) 166(external-function fopen (name mode)) 167(external-function fclose (fp)) 168(external-function fread (buf size count fp)) 169(external-function fputc (ch fp)) 170(external-function fgetc (fp)) 171(external-function fgets (buf count fp)) 172(external-function fwrite (str strlen count fp)) 173(external-function fflush (fp)) 174(external-function fseek (fp offset ptrname)) 175(external-function clearerr (fp)) 176(external-function getw (fp)) 177%(external-function ieee_handler (set common signalhandler)) 178(external-function putw (w fp)) 179(external-function signal (signame handler)) 180(external-function sleep (sec)) 181(external-function setjmp (env)) % added for sparc 182(external-function longjmp (env val)) % to process interrupts. 183 184(external-function fork ()) 185(external-function wait(ptr)) 186 187(external-function vvm_cflush (addr len)) % flush the cache(s) 188(external-function datetag()) % returns date of bpsl build 189 190 191%% See $pxnk/sys-io.sl for the call to this. In SYS V, it may have to be 192%% moved into the microkernel since it is not directly supported. Under 193%% SYS V, buffering can only be changed before any writes on the stream, 194%% which means it must be called before setupbpsandheap. Also, under BSD, 195%% setlinebuf is a system call, while under SYS V, it must be written using 196%% setbuf and setvbuf. See the Bobcat version of setlinebuf.c in $pb. 197%(external-function setlinebuf (iobuffer)) 198 199 200(external-function getpid ()) 201 202%%socketinterface 203 204(external-function unixsocketopen (name number)) 205(external-function getsocket (fd name number)) 206(external-function writesocket (fd name number)) 207(external-function unixclosesocket (number)) 208 209%% popen pclose 210 211(external-function popen (cmd mode)) 212(external-function pclose (stream)) 213 214%% shared memory , semaphores 215 216(external-function shmctl (shmid cmd buf)) 217(external-function shmget (key size shmflg)) 218(external-function shmat (shmid shmaddr shmflag)) 219(external-function shmdt (shmaddr)) 220 221(external-function semctl (semid semnum cmd arg)) 222(external-function semget (key nsems semflg)) 223(external-function semop (semid sembuf nsops)) 224 225(on r2i) 226 227(compiletime 228 (for (in name *foreign-functions*) 229 (do (remflag1 name 'foreignfunction)) 230 )) 231