VMS updates (direct)
[p5sagit/p5-mst-13.2.git] / vms / vmsish.h
1 /*  vmsish.h
2  *
3  * VMS-specific C header file for perl5.
4  *
5  * Last revised: 18-Feb-1997 by Charles Bailey  bailey@genetics.upenn.edu
6  * Version: 5.3.28
7  */
8
9 #ifndef __vmsish_h_included
10 #define __vmsish_h_included
11
12 #include <descrip.h> /* for dirent struct definitions */
13 #include <libdef.h>  /* status codes for various places */
14 #include <rmsdef.h>  /* at which errno and vaxc$errno are */
15 #include <ssdef.h>   /* explicitly set in the perl source code */
16 #include <stsdef.h>  /* bitmasks for exit status testing */
17
18 /* Suppress compiler warnings from DECC for VMS-specific extensions:
19  * GLOBALEXT, NOSHAREEXT, READONLYEXT: global[dr]ef declarations
20  * ADDRCONSTEXT,NEEDCONSTEXT: initialization of data with non-constant values
21  *                            (e.g. pointer fields of descriptors)
22  */
23 #ifdef __DECC
24 #  pragma message disable (GLOBALEXT,NOSHAREEXT,READONLYEXT,ADDRCONSTEXT,NEEDCONSTEXT)
25 #endif
26
27 /* DEC's C compilers and gcc use incompatible definitions of _to(upp|low)er() */
28 #ifdef _toupper
29 #  undef _toupper
30 #endif
31 #define _toupper(c) (((c) < 'a' || (c) > 'z') ? (c) : (c) & ~040)
32 #ifdef _tolower
33 #  undef _tolower
34 #endif
35 #define _tolower(c) (((c) < 'A' || (c) > 'Z') ? (c) : (c) | 040)
36 /* DECC 1.3 has a funny definition of abs; it's fixed in DECC 4.0, so this
37  * can go away once DECC 1.3 isn't in use any more. */
38 #if defined(__ALPHA) && defined(__DECC)
39 #undef abs
40 #define abs(__x)        __ABS(__x)
41 #undef labs
42 #define labs(__x)        __LABS(__x)
43 #endif /* __ALPHA && __DECC */
44
45 /* Assorted things to look like Unix */
46 #ifdef __GNUC__
47 #ifndef _IOLBF /* gcc's stdio.h doesn't define this */
48 #define _IOLBF 1
49 #endif
50 #endif
51 #include <processes.h> /* for vfork() */
52 #include <unixio.h>
53 #include <unixlib.h>
54 #include <file.h>  /* it's not <sys/file.h>, so don't use I_SYS_FILE */
55 #if defined(__DECC) && defined(__DECC_VER) && __DECC_VER > 20000000
56 #  include <unistd.h> /* DECC has this; VAXC and gcc don't */
57 #endif
58
59 /* VAXC doesn't have a unary plus operator, so we need to get there indirectly */
60 #if defined(VAXC) && !defined(__DECC)
61 #  define NO_UNARY_PLUS
62 #endif
63
64 #ifdef NO_PERL_TYPEDEFS /* a2p; we don't want Perl's special routines */
65 #  define DONT_MASK_RTL_CALLS
66 #endif
67
68     /* defined for vms.c so we can see CRTL |  defined for a2p */
69 #ifndef DONT_MASK_RTL_CALLS
70 #  ifdef getenv
71 #    undef getenv
72 #  endif
73 #  define getenv(v) my_getenv(v)  /* getenv used for regular logical names */
74 #endif
75
76 /* DECC introduces this routine in the RTL as of VMS 7.0; for now,
77  * we'll use ours, since it gives us the full VMS exit status. */
78 #ifdef __PID_T
79 #  define Pid_t pid_t
80 #else
81 #  define Pid_t unsigned int
82 #endif
83 #define waitpid my_waitpid
84
85 /* Don't redeclare standard RTL routines in Perl's header files;
86  * VMS history or extensions makes some of the formal protoypes
87  * differ from the common Unix forms.
88  */
89 #define DONT_DECLARE_STD 1
90
91 /* Our own contribution to PerlShr's global symbols . . . */
92 #ifdef EMBED
93 #  define my_trnlnm             Perl_my_trnlnm
94 #  define my_getenv             Perl_my_getenv
95 #  define prime_env_iter        Perl_prime_env_iter
96 #  define my_setenv             Perl_my_setenv
97 #  define my_crypt              Perl_my_crypt
98 #  define my_waitpid            Perl_my_waitpid
99 #  define my_gconvert           Perl_my_gconvert
100 #  define do_rmdir              Perl_do_rmdir
101 #  define kill_file             Perl_kill_file
102 #  define my_mkdir              Perl_my_mkdir
103 #  define my_utime              Perl_my_utime
104 #  define rmsexpand     Perl_rmsexpand
105 #  define rmsexpand_ts  Perl_rmsexpand_ts
106 #  define fileify_dirspec       Perl_fileify_dirspec
107 #  define fileify_dirspec_ts    Perl_fileify_dirspec_ts
108 #  define pathify_dirspec       Perl_pathify_dirspec
109 #  define pathify_dirspec_ts    Perl_pathify_dirspec_ts
110 #  define tounixspec            Perl_tounixspec
111 #  define tounixspec_ts         Perl_tounixspec_ts
112 #  define tovmsspec             Perl_tovmsspec
113 #  define tovmsspec_ts          Perl_tovmsspec_ts
114 #  define tounixpath            Perl_tounixpath
115 #  define tounixpath_ts         Perl_tounixpath_ts
116 #  define tovmspath             Perl_tovmspath
117 #  define tovmspath_ts          Perl_tovmspath_ts
118 #  define vms_image_init        Perl_vms_image_init
119 #  define opendir               Perl_opendir
120 #  define readdir               Perl_readdir
121 #  define telldir               Perl_telldir
122 #  define seekdir               Perl_seekdir
123 #  define closedir              Perl_closedir
124 #  define vmsreaddirversions    Perl_vmsreaddirversions
125 #  define my_gmtime             Perl_my_gmtime
126 #  define my_localtime          Perl_my_localtime
127 #  define my_time               Perl_my_time
128 #  define my_sigemptyset        Perl_my_sigemptyset
129 #  define my_sigfillset         Perl_my_sigfillset
130 #  define my_sigaddset          Perl_my_sigaddset
131 #  define my_sigdelset          Perl_my_sigdelset
132 #  define my_sigismember        Perl_my_sigismember
133 #  define my_sigprocmask        Perl_my_sigprocmask
134 #  define cando_by_name         Perl_cando_by_name
135 #  define flex_fstat            Perl_flex_fstat
136 #  define flex_stat             Perl_flex_stat
137 #  define trim_unixpath         Perl_trim_unixpath
138 #  define my_vfork              Perl_my_vfork
139 #  define vms_do_aexec          Perl_vms_do_aexec
140 #  define vms_do_exec           Perl_vms_do_exec
141 #  define do_aspawn             Perl_do_aspawn
142 #  define do_spawn              Perl_do_spawn
143 #  define my_fwrite             Perl_my_fwrite
144 #  define my_flush              Perl_my_flush
145 #  define my_binmode            Perl_my_binmode
146 #  define my_getpwnam           Perl_my_getpwnam
147 #  define my_getpwuid           Perl_my_getpwuid
148 #  define my_getpwent           Perl_my_getpwent
149 #  define my_endpwent           Perl_my_endpwent
150 #  define my_getlogin           Perl_my_getlogin
151 #  define rmscopy               Perl_rmscopy
152 #  define init_os_extras        Perl_init_os_extras
153 #endif
154
155 /* Delete if at all possible, changing protections if necessary. */
156 #define unlink kill_file
157
158 /* 
159  * Intercept calls to fork, so we know whether subsequent calls to
160  * exec should be handled in VMSish or Unixish style.
161  */
162 #define fork my_vfork
163 #ifndef DONT_MASK_RTL_CALLS     /* #defined in vms.c so we see real vfork */
164 #  ifdef vfork
165 #    undef vfork
166 #  endif
167 #  define vfork my_vfork
168 #endif
169
170 /* BIG_TIME:
171  *      This symbol is defined if Time_t is an unsigned type on this system.
172  */
173 #define BIG_TIME
174
175 /* ACME_MESS:
176  *      This symbol, if defined, indicates that error messages should be 
177  *      should be generated in a format that allows the use of the Acme
178  *      GUI/editor's autofind feature.
179  */
180 #undef ACME_MESS        /**/
181
182 /* ALTERNATE_SHEBANG:
183  *      This symbol, if defined, contains a "magic" string which may be used
184  *      as the first line of a Perl program designed to be executed directly
185  *      by name, instead of the standard Unix #!.  If ALTERNATE_SHEBANG
186  *      begins with a character other then #, then Perl will only treat
187  *      it as a command line if if finds the string "perl" in the first
188  *      word; otherwise it's treated as the first line of code in the script.
189  *      (IOW, Perl won't hand off to another interpreter via an alternate
190  *      shebang sequence that might be legal Perl code.)
191  */
192 #define ALTERNATE_SHEBANG "$"
193
194 /* Macros to set errno using the VAX thread-safe calls, if present */
195 #if (defined(__DECC) || defined(__DECCXX)) && !defined(__ALPHA)
196 #  define set_errno(v)      (cma$tis_errno_set_value(v))
197    void cma$tis_errno_set_value(int __value);  /* missing in some errno.h */
198 #  define set_vaxc_errno(v) (vaxc$errno = (v))
199 #else
200 #  define set_errno(v)      (errno = (v))
201 #  define set_vaxc_errno(v) (vaxc$errno = (v))
202 #endif
203
204 /* Support for 'vmsish' behaviors enabled with C<use vmsish> pragma */
205
206 #define COMPLEX_STATUS  1       /* We track both "POSIX" and VMS values */
207
208 #define HINT_V_VMSISH           24
209 #define HINT_M_VMSISH_STATUS    0x01000000 /* system, $? return VMS status */
210 #define HINT_M_VMSISH_EXIT      0x02000000 /* exit(1) ==> SS$_NORMAL */
211 #define HINT_M_VMSISH_TIME      0x04000000 /* times are local, not UTC */
212 #define NATIVE_HINTS            (hints >> HINT_V_VMSISH)  /* used in op.c */
213
214 #define TEST_VMSISH(h)  (curcop->op_private & ((h) >> HINT_V_VMSISH))
215 #define VMSISH_STATUS   TEST_VMSISH(HINT_M_VMSISH_STATUS)
216 #define VMSISH_EXIT     TEST_VMSISH(HINT_M_VMSISH_EXIT)
217 #define VMSISH_TIME     TEST_VMSISH(HINT_M_VMSISH_TIME)
218
219 /* Handy way to vet calls to VMS system services and RTL routines. */
220 #define _ckvmssts(call) STMT_START { register unsigned long int __ckvms_sts; \
221   if (!((__ckvms_sts=(call))&1)) { \
222   set_errno(EVMSERR); set_vaxc_errno(__ckvms_sts); \
223   croak("Fatal VMS error (status=%d) at %s, line %d", \
224   __ckvms_sts,__FILE__,__LINE__); } } STMT_END
225
226 /* Same thing, but don't call back to Perl's croak(); useful for errors
227  * occurring during startup, before Perl's state is initialized */
228 #define _ckvmssts_noperl(call) STMT_START { register unsigned long int __ckvms_sts; \
229   if (!((__ckvms_sts=(call))&1)) { \
230   set_errno(EVMSERR); set_vaxc_errno(__ckvms_sts); \
231   fprintf(Perl_debug_log,"Fatal VMS error (status=%d) at %s, line %d", \
232   __ckvms_sts,__FILE__,__LINE__); lib$signal(__ckvms_sts); } } STMT_END
233
234 #ifdef VMS_DO_SOCKETS
235 #include "sockadapt.h"
236 #endif
237
238 #define BIT_BUCKET "_NLA0:"
239 #define PERL_SYS_INIT(c,v)      vms_image_init((c),(v)); MALLOC_INIT
240 #define PERL_SYS_TERM()         MALLOC_TERM
241 #define dXSUB_SYS
242 #define HAS_KILL
243 #define HAS_WAIT
244
245 /* VMS:
246  *      This symbol, if defined, indicates that the program is running under
247  *      VMS.  It's a symbol automagically defined by all VMS C compilers I've seen.
248  * Just in case, however . . . */
249 #ifndef VMS
250 #define VMS             /**/
251 #endif
252
253 /* HAS_IOCTL:
254  *      This symbol, if defined, indicates that the ioctl() routine is
255  *      available to set I/O characteristics
256  */
257 #undef  HAS_IOCTL               /**/
258  
259 /* HAS_UTIME:
260  *      This symbol, if defined, indicates that the routine utime() is
261  *      available to update the access and modification times of files.
262  */
263 #define HAS_UTIME               /**/
264
265 /* HAS_GROUP
266  *      This symbol, if defined, indicates that the getgrnam(),
267  *      getgrgid(), and getgrent() routines are available to 
268  *      get group entries.
269  */
270 #undef HAS_GROUP                /**/
271
272 /* HAS_PASSWD
273  *      This symbol, if defined, indicates that the getpwnam(),
274  *      getpwuid(), and getpwent() routines are available to 
275  *      get password entries.
276  */
277 #define HAS_PASSWD              /**/
278
279 #define HAS_KILL
280 #define HAS_WAIT
281   
282 /* USEMYBINMODE
283  *      This symbol, if defined, indicates that the program should
284  *      use the routine my_binmode(FILE *fp, char iotype) to insure
285  *      that a file is in "binary" mode -- that is, that no translation
286  *      of bytes occurs on read or write operations.
287  */
288 #define USEMYBINMODE
289
290 /* Stat_t:
291  *      This symbol holds the type used to declare buffers for information
292  *      returned by stat().  It's usually just struct stat.  It may be necessary
293  *      to include <sys/stat.h> and <sys/types.h> to get any typedef'ed
294  *      information.
295  */
296 /* VMS:
297  * We need this typedef to point to the new type even if DONT_MASK_RTL_CALLS
298  * is in effect, since Perl's thread.h embeds one of these structs in its
299  * thread data struct, and our struct mystat is a different size from the
300  * regular struct stat (cf. note above about having to pad struct to work
301  * around bug in compiler.)
302  * It's OK to pass one of these to the RTL's stat(), though, since the
303  * fields it fills are the same in each struct.
304  */
305 #define Stat_t struct mystat
306
307 /* USE_STAT_RDEV:
308 *       This symbol is defined if this system has a stat structure declaring
309 *       st_rdev
310 *       VMS: Field exists in POSIXish version of struct stat(), but is not used.
311 */
312 #undef USE_STAT_RDEV            /**/
313
314 /*
315  * fwrite1() should be a routine with the same calling sequence as fwrite(),
316  * but which outputs all of the bytes requested as a single stream (unlike
317  * fwrite() itself, which on some systems outputs several distinct records
318  * if the number_of_items parameter is >1).
319  */
320 #define fwrite1 my_fwrite
321
322 /* By default, flush data all the way to disk, not just to RMS buffers */
323 #define Fflush(fp) my_flush(fp)
324
325 /* Use our own rmdir() */
326 #define rmdir(name) do_rmdir(name)
327
328 /* Assorted fiddling with sigs . . . */
329 # include <signal.h>
330 #define ABORT() abort()
331     /* VAXC's signal.h doesn't #define SIG_ERR, but provides BADSIG instead. */
332 #if !defined(SIG_ERR) && defined(BADSIG)
333 #  define SIG_ERR BADSIG
334 #endif
335
336
337 /* Used with our my_utime() routine in vms.c */
338 struct utimbuf {
339   time_t actime;
340   time_t modtime;
341 };
342 #define utime my_utime
343
344 /* This is what times() returns, but <times.h> calls it tbuffer_t on VMS
345  * prior to v7.0.  We check the DECC manifest to see whether it's already
346  * done this for us, relying on the fact that perl.h #includes <time.h>
347  * before it #includes "vmsish.h".
348  */
349
350 #ifndef __TMS
351   struct tms {
352     clock_t tms_utime;    /* user time */
353     clock_t tms_stime;    /* system time - always 0 on VMS */
354     clock_t tms_cutime;   /* user time, children */
355     clock_t tms_cstime;   /* system time, children - always 0 on VMS */
356   };
357 #else
358    /* The new headers change the times() prototype to tms from tbuffer */
359 #  define tbuffer_t struct tms
360 #endif
361
362 /* Substitute our own routines for gmtime(), localtime(), and time(),
363  * which allow us to implement the vmsish 'time' pragma, and work
364  * around absence of system-level UTC support on old versions of VMS.
365  */
366 #define gmtime(t) my_gmtime(t)
367 #define localtime(t) my_localtime(t)
368 #define time(t) my_time(t)
369
370 /* If we're using an older version of VMS whose Unix signal emulation
371  * isn't very POSIXish, then roll our own.
372  */
373 #if __VMS_VER < 70000000 || __DECC_VER < 50200000
374 #  define HOMEGROWN_POSIX_SIGNALS
375 #endif
376 #ifdef HOMEGROWN_POSIX_SIGNALS
377 #  define sigemptyset(t) my_sigemptyset(t)
378 #  define sigfillset(t) my_sigfillset(t)
379 #  define sigaddset(t, u) my_sigaddset(t, u)
380 #  define sigdelset(t, u) my_sigdelset(t, u)
381 #  define sigismember(t, u) my_sigismember(t, u)
382 #  define sigprocmask(t, u, v) my_sigprocmask(t, u, v)
383 #  ifndef _SIGSET_T
384    typedef int sigset_t;
385 #  endif
386    /* The tools for sigprocmask() are there, just not the routine itself */
387 #  ifndef SIG_UNBLOCK
388 #    define SIG_UNBLOCK 1
389 #  endif
390 #  ifndef SIG_BLOCK
391 #    define SIG_BLOCK 2
392 #  endif
393 #  ifndef SIG_SETMASK
394 #    define SIG_SETMASK 3
395 #  endif
396 #  define sigaction sigvec
397 #  define sa_flags sv_onstack
398 #  define sa_handler sv_handler
399 #  define sa_mask sv_mask
400 #  define sigsuspend(set) sigpause(*set)
401 #  define sigpending(a) (not_here("sigpending"),0)
402 #endif
403
404 /* VMS doesn't use a real sys_nerr, but we need this when scanning for error
405  * messages in text strings . . .
406  */
407
408 #define sys_nerr EVMSERR  /* EVMSERR is as high as we can go. */
409
410 /* Look up new %ENV values on the fly */
411 #define DYNAMIC_ENV_FETCH 1
412 #define ENV_HV_NAME "%EnV%VmS%"
413   /* Special getenv function for retrieving %ENV elements. */
414 #define ENV_getenv(v) my_getenv(v)
415
416
417 /* Thin jacket around cuserid() tomatch Unix' calling sequence */
418 #define getlogin my_getlogin
419
420 /* Ditto for sys$hash_passwrod() . . . */
421 #define crypt  my_crypt
422
423 /* Tweak arg to mkdir first, so we can tolerate trailing /. */
424 #define Mkdir(dir,mode) my_mkdir((dir),(mode))
425
426 /* Use our own stat() clones, which handle Unix-style directory names */
427 #define Stat(name,bufptr) flex_stat(name,bufptr)
428 #define Fstat(fd,bufptr) flex_fstat(fd,bufptr)
429
430 /* Setup for the dirent routines:
431  * opendir(), closedir(), readdir(), seekdir(), telldir(), and
432  * vmsreaddirversions(), and preprocessor stuff on which these depend:
433  *    Written by Rich $alz, <rsalz@bbn.com> in August, 1990.
434  */
435     /* Data structure returned by READDIR(). */
436 struct dirent {
437     char        d_name[256];            /* File name            */
438     int         d_namlen;                       /* Length of d_name */
439     int         vms_verscount;          /* Number of versions   */
440     int         vms_versions[20];       /* Version numbers      */
441 };
442
443     /* Handle returned by opendir(), used by the other routines.  You
444      * are not supposed to care what's inside this structure. */
445 typedef struct _dirdesc {
446     long                        context;
447     int                         vms_wantversions;
448     unsigned long int           count;
449     char                        *pattern;
450     struct dirent               entry;
451     struct dsc$descriptor_s     pat;
452 } DIR;
453
454 #define rewinddir(dirp)         seekdir((dirp), 0)
455
456 /* used for our emulation of getpw* */
457 struct passwd {
458         char    *pw_name;    /* Username */
459         char    *pw_passwd;
460         Uid_t   pw_uid;      /* UIC member number */
461         Gid_t   pw_gid;      /* UIC group  number */
462         char    *pw_comment; /* Default device/directory (Unix-style) */
463         char    *pw_gecos;   /* Owner */
464         char    *pw_dir;     /* Default device/directory (VMS-style) */
465         char    *pw_shell;   /* Default CLI name (eg. DCL) */
466 };
467 #define pw_unixdir pw_comment  /* Default device/directory (Unix-style) */
468 #define getpwnam my_getpwnam
469 #define getpwuid my_getpwuid
470 #define getpwent my_getpwent
471 #define endpwent my_endpwent
472 #define setpwent my_endpwent
473
474 /* Our own stat_t substitute, since we play with st_dev and st_ino -
475  * we want atomic types so Unix-bound code which compares these fields
476  * for two files will work most of the time under VMS.
477  * N.B. 1. The st_ino hack assumes that sizeof(unsigned short[3]) ==
478  * sizeof(unsigned) + sizeof(unsigned short).  We can't use a union type
479  * to map the unsigned int we want and the unsigned short[3] the CRTL
480  * returns into the same member, since gcc has different ideas than DECC
481  * and VAXC about sizing union types.
482  * N.B 2. The routine cando() in vms.c assumes that &stat.st_ino is the
483  * address of a FID.
484  */
485 /* First, grab the system types, so we don't clobber them later */
486 #include <stat.h>
487 /* Since we've got to match the size of the CRTL's stat_t, we need
488  * to mimic DECC's alignment settings.
489  */
490 #if defined(__DECC) || defined(__DECCXX)
491 #  pragma __member_alignment __save
492 #  pragma __nomember_alignment
493 #endif
494 #if defined(__DECC) 
495 #  pragma __message __save
496 #  pragma __message disable (__MISALGNDSTRCT)
497 #  pragma __message disable (__MISALGNDMEM)
498 #endif
499 struct mystat
500 {
501         char *st_devnam;  /* pointer to device name */
502         unsigned st_ino;    /* hack - CRTL uses unsigned short[3] for */
503         unsigned short rvn; /* FID (num,seq,rvn) */
504         unsigned short st_mode; /* file "mode" i.e. prot, dir, reg, etc. */
505         int     st_nlink;       /* for compatibility - not really used */
506         unsigned st_uid;        /* from ACP - QIO uic field */
507         unsigned short st_gid;  /* group number extracted from st_uid */
508         dev_t   st_rdev;        /* for compatibility - always zero */
509         off_t   st_size;        /* file size in bytes */
510         unsigned st_atime;      /* file access time; always same as st_mtime */
511         unsigned st_mtime;      /* last modification time */
512         unsigned st_ctime;      /* file creation time */
513         char    st_fab_rfm;     /* record format */
514         char    st_fab_rat;     /* record attributes */
515         char    st_fab_fsz;     /* fixed header size */
516         unsigned st_dev;        /* encoded device name */
517         /* Pad struct out to integral number of longwords, since DECC 5.6/VAX
518          * has a bug in dealing with offsets in structs in which are embedded
519          * other structs whose size is an odd number of bytes.  (An even
520          * number of bytes is enough to make it happy, but we go for natural
521          * alignment anyhow.)
522          */
523         char    st_fill1[sizeof(void *) - (3*sizeof(unsigned short) + 3*sizeof(char))%sizeof(void *)];
524 };
525 typedef unsigned mydev_t;
526 typedef unsigned myino_t;
527 #ifndef DONT_MASK_RTL_CALLS  /* defined for vms.c so we can see RTL calls */
528 #  ifdef stat
529 #    undef stat
530 #  endif
531 #  define stat mystat
532 #  define dev_t mydev_t
533 #  define ino_t myino_t
534 #endif
535 #if defined(__DECC) || defined(__DECCXX)
536 #  pragma __member_alignment __restore
537 #endif
538 #if defined(__DECC) 
539 #  pragma __message __restore
540 #endif
541 /* Cons up a 'delete' bit for testing access */
542 #define S_IDUSR (S_IWUSR | S_IXUSR)
543 #define S_IDGRP (S_IWGRP | S_IXGRP)
544 #define S_IDOTH (S_IWOTH | S_IXOTH)
545
546 /* Prototypes for functions unique to vms.c.  Don't include replacements
547  * for routines in the mainline source files excluded by #ifndef VMS;
548  * their prototypes are already in proto.h.
549  *
550  * In order to keep Gen_ShrFls.Pl happy, functions which are to be made
551  * available to images linked to PerlShr.Exe must be declared between the
552  * __VMS_PROTOTYPES__ and __VMS_SEPYTOTORP__ lines, and must be in the form
553  *    <data type><TAB>name<WHITESPACE>_((<prototype args>));
554  */
555
556 #ifdef NO_PERL_TYPEDEFS
557   /* We don't have Perl typedefs available (e.g. when building a2p), so
558      we fake them here.  N.B.  There is *no* guarantee that the faked
559      prototypes will actually match the real routines.  If you want to
560      call Perl routines, include perl.h to get the real typedefs.  */
561 #  ifndef bool
562 #    define bool int
563 #    define __MY_BOOL_TYPE_FAKE
564 #  endif
565 #  ifndef I32
566 #    define I32  int
567 #    define __MY_I32_TYPE_FAKE
568 #  endif
569 #  ifndef SV
570 #    define SV   void   /* Since we only see SV * in prototypes */
571 #    define __MY_SV_TYPE_FAKE
572 #  endif
573 #endif
574
575 void    prime_env_iter _((void));
576 void    init_os_extras _(());
577 /* prototype section start marker; `typedef' passes through cpp */
578 typedef char  __VMS_PROTOTYPES__;
579 int     my_trnlnm _((char *, char *, unsigned long int));
580 char *  my_getenv _((char *));
581 char *  my_crypt _((const char *, const char *));
582 Pid_t   my_waitpid _((Pid_t, int *, int));
583 char *  my_gconvert _((double, int, int, char *));
584 int     do_rmdir _((char *));
585 int     kill_file _((char *));
586 int     my_mkdir _((char *, Mode_t));
587 int     my_utime _((char *, struct utimbuf *));
588 char *  rmsexpand _((char *, char *, char *, unsigned));
589 char *  rmsexpand_ts _((char *, char *, char *, unsigned));
590 char *  fileify_dirspec _((char *, char *));
591 char *  fileify_dirspec_ts _((char *, char *));
592 char *  pathify_dirspec _((char *, char *));
593 char *  pathify_dirspec_ts _((char *, char *));
594 char *  tounixspec _((char *, char *));
595 char *  tounixspec_ts _((char *, char *));
596 char *  tovmsspec _((char *, char *));
597 char *  tovmsspec_ts _((char *, char *));
598 char *  tounixpath _((char *, char *));
599 char *  tounixpath_ts _((char *, char *));
600 char *  tovmspath _((char *, char *));
601 char *  tovmspath_ts _((char *, char *));
602 void    vms_image_init _((int *, char ***));
603 DIR *   opendir _((char *));
604 struct dirent * readdir _((DIR *));
605 long    telldir _((DIR *));
606 void    seekdir _((DIR *, long));
607 void    closedir _((DIR *));
608 void    vmsreaddirversions _((DIR *, int));
609 struct tm *     my_gmtime _((const time_t *));
610 struct tm *     my_localtime _((const time_t *));
611 time_t  my_time _((time_t *));
612 #ifdef HOMEGROWN_POSIX_SIGNALS
613 int     my_sigemptyset _((sigset_t *));
614 int     my_sigfillset  _((sigset_t *));
615 int     my_sigaddset   _((sigset_t *, int));
616 int     my_sigdelset   _((sigset_t *, int));
617 int     my_sigismember _((sigset_t *, int));
618 int     my_sigprocmask _((int, sigset_t *, sigset_t *));
619 #endif
620 I32     cando_by_name _((I32, I32, char *));
621 int     flex_fstat _((int, Stat_t *));
622 int     flex_stat _((char *, Stat_t *));
623 int     trim_unixpath _((char *, char*, int));
624 int     my_vfork _(());
625 bool    vms_do_aexec _((SV *, SV **, SV **));
626 bool    vms_do_exec _((char *));
627 unsigned long int       do_aspawn _((void *, void **, void **));
628 unsigned long int       do_spawn _((char *));
629 int     my_fwrite _((void *, size_t, size_t, FILE *));
630 int     my_flush _((FILE *));
631 FILE *  my_binmode _((FILE *, char));
632 struct passwd * my_getpwnam _((char *name));
633 struct passwd * my_getpwuid _((Uid_t uid));
634 struct passwd * my_getpwent _(());
635 void    my_endpwent _(());
636 char *  my_getlogin _(());
637 int     rmscopy _((char *, char *, int));
638 typedef char __VMS_SEPYTOTORP__;
639 /* prototype section end marker; `typedef' passes through cpp */
640
641 #ifdef NO_PERL_TYPEDEFS  /* We'll try not to scramble later files */
642 #  ifdef __MY_BOOL_TYPE_FAKE
643 #    undef bool
644 #    undef __MY_BOOL_TYPE_FAKE
645 #  endif
646 #  ifdef __MY_I32_TYPE_FAKE
647 #    undef I32
648 #    undef __MY_I32_TYPE_FAKE
649 #  endif
650 #  ifdef __MY_SV_TYPE_FAKE
651 #    undef SV
652 #    undef __MY_SV_TYPE_FAKE
653 #  endif
654 #endif
655
656 #ifndef VMS_DO_SOCKETS
657 /* This relies on tricks in perl.h to pick up that these manifest constants
658  * are undefined and set up conversion routines.  It will then redefine
659  * these manifest constants, so the actual values will match config.h
660  */
661 #undef HAS_HTONS
662 #undef HAS_NTOHS
663 #undef HAS_HTONL
664 #undef HAS_NTOHL
665 #endif
666
667 #define TMPPATH "sys$scratch:perl-eXXXXXX"
668
669 #endif  /* __vmsish_h_included */