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