Make hex scanning warn on "\x{x}" and "\xx".
[p5sagit/p5-mst-13.2.git] / iperlsys.h
index 7b20d5d..9bf7387 100644 (file)
  *
  */
 
-
 /*
-    Interface for perl stdio functions
-*/
-
-
-/* Clean up (or at least document) the various possible #defines.
-   This section attempts to match the 5.003_03 Configure variables
-   onto the 5.003_02 header file values.
-   I can't figure out where USE_STDIO was supposed to be set.
-   --AD
+    Interface for perl stdio functions, or whatever we are Configure-d
+    to use.
 */
-#ifndef USE_PERLIO
-# define PERLIO_IS_STDIO
-#endif
-
-/* Below is the 5.003_02 stuff. */
-#ifdef USE_STDIO
-#  ifndef PERLIO_IS_STDIO
-#      define PERLIO_IS_STDIO
-#  endif
-#else
-extern void PerlIO_init (void);
-#endif
+#include "perlio.h"
 
 #ifndef Sighandler_t
 typedef Signal_t (*Sighandler_t) (int);
@@ -80,10 +61,6 @@ typedef Signal_t (*Sighandler_t) (int);
 
 #if defined(PERL_IMPLICIT_SYS)
 
-#ifndef PerlIO
-typedef struct _PerlIO PerlIO;
-#endif
-
 /* IPerlStdIO          */
 struct IPerlStdIO;
 struct IPerlStdIOInfo;
@@ -120,7 +97,7 @@ typedef void         (*LPSetCnt)(struct IPerlStdIO*, PerlIO*, int);
 typedef void           (*LPSetPtrCnt)(struct IPerlStdIO*, PerlIO*, char*,
                            int);
 typedef void           (*LPSetlinebuf)(struct IPerlStdIO*, PerlIO*);
-typedef int            (*LPPrintf)(struct IPerlStdIO*, PerlIO*, const char*, 
+typedef int            (*LPPrintf)(struct IPerlStdIO*, PerlIO*, const char*,
                            ...);
 typedef int            (*LPVprintf)(struct IPerlStdIO*, PerlIO*, const char*,
                            va_list);
@@ -134,6 +111,7 @@ typedef int         (*LPSetpos)(struct IPerlStdIO*, PerlIO*,
 typedef void           (*LPInit)(struct IPerlStdIO*);
 typedef void           (*LPInitOSExtras)(struct IPerlStdIO*);
 typedef PerlIO*                (*LPFdupopen)(struct IPerlStdIO*, PerlIO*);
+typedef int            (*LPIsUtf8)(struct IPerlStdIO*, PerlIO*);
 
 struct IPerlStdIO
 {
@@ -176,6 +154,7 @@ struct IPerlStdIO
     LPInit             pInit;
     LPInitOSExtras     pInitOSExtras;
     LPFdupopen         pFdupopen;
+    LPIsUtf8           pIsUtf8;
 };
 
 struct IPerlStdIOInfo
@@ -184,15 +163,23 @@ struct IPerlStdIOInfo
     struct IPerlStdIO  perlStdIOList;
 };
 
+/* These do not belong here ... NI-S, 14 Nov 2000 */
+
 #ifdef USE_STDIO_PTR
-#  define PerlIO_has_cntptr(f)         1       
-#  ifdef STDIO_CNT_LVALUE
-#    define PerlIO_canset_cnt(f)       1      
-#    ifdef STDIO_PTR_LVALUE
-#      define PerlIO_fast_gets(f)      1        
+#  define PerlIO_has_cntptr(f)         1
+#  ifdef STDIO_PTR_LVALUE
+#    ifdef  STDIO_CNT_LVALUE
+#      define PerlIO_canset_cnt(f)     1
+#      ifdef STDIO_PTR_LVAL_NOCHANGE_CNT
+#        define PerlIO_fast_gets(f)    1
+#      endif
+#    else /* STDIO_CNT_LVALUE */
+#      define PerlIO_canset_cnt(f)     0
+#    endif
+#  else /* STDIO_PTR_LVALUE */
+#    ifdef STDIO_PTR_LVAL_SETS_CNT
+#      define PerlIO_fast_gets(f)      1
 #    endif
-#  else
-#    define PerlIO_canset_cnt(f)       0      
 #  endif
 #else  /* USE_STDIO_PTR */
 #  define PerlIO_has_cntptr(f)         0
@@ -200,7 +187,7 @@ struct IPerlStdIOInfo
 #endif /* USE_STDIO_PTR */
 
 #ifndef PerlIO_fast_gets
-#define PerlIO_fast_gets(f)            0        
+#define PerlIO_fast_gets(f)            0
 #endif
 
 #ifdef FILE_base
@@ -209,6 +196,8 @@ struct IPerlStdIOInfo
 #define PerlIO_has_base(f)             0
 #endif
 
+/* Now take PerlIO * via function table */
+
 #define PerlIO_stdin()                                                 \
        (*PL_StdIO->pStdin)(PL_StdIO)
 #define PerlIO_stdout()                                                        \
@@ -268,7 +257,7 @@ struct IPerlStdIOInfo
 #define PerlIO_printf          Perl_fprintf_nocontext
 #define PerlIO_stdoutf         *PL_StdIO->pPrintf
 #define PerlIO_vprintf(f,fmt,a)                                                \
-       (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a)          
+       (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a)
 #define PerlIO_tell(f)                                                 \
        (*PL_StdIO->pTell)(PL_StdIO, (f))
 #define PerlIO_seek(f,o,w)                                             \
@@ -288,194 +277,11 @@ struct IPerlStdIOInfo
        (*PL_StdIO->pInitOSExtras)(PL_StdIO)
 #define PerlIO_fdupopen(f)                                             \
        (*PL_StdIO->pFdupopen)(PL_StdIO, (f))
-
-#else  /* PERL_IMPLICIT_SYS */
-
-#include "perlsdio.h"
-#include "perl.h"
-#define PerlIO_fdupopen(f)             (f)
+#define PerlIO_isutf8(f)                                               \
+       (*PL_StdIO->pIsUtf8)(PL_StdIO, (f))
 
 #endif /* PERL_IMPLICIT_SYS */
 
-#ifndef PERLIO_IS_STDIO
-#ifdef USE_SFIO
-#include "perlsfio.h"
-#endif /* USE_SFIO */
-#endif /* PERLIO_IS_STDIO */
-
-#ifndef EOF
-#define EOF (-1)
-#endif
-
-/* This is to catch case with no stdio */
-#ifndef BUFSIZ
-#define BUFSIZ 1024
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
-#ifndef SEEK_CUR
-#define SEEK_CUR 1
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END 2
-#endif
-
-#ifndef PerlIO
-struct _PerlIO;
-#define PerlIO struct _PerlIO
-#endif /* No PerlIO */
-
-#ifndef Fpos_t
-#define Fpos_t long
-#endif
-
-#ifndef NEXT30_NO_ATTRIBUTE
-#ifndef HASATTRIBUTE       /* disable GNU-cc attribute checking? */
-#ifdef  __attribute__      /* Avoid possible redefinition errors */
-#undef  __attribute__
-#endif
-#define __attribute__(attr)
-#endif
-#endif
-
-#ifndef PerlIO_stdoutf
-extern int     PerlIO_stdoutf          (const char *,...)
-                                       __attribute__((__format__ (__printf__, 1, 2)));
-#endif
-#ifndef PerlIO_puts
-extern int     PerlIO_puts             (PerlIO *,const char *);
-#endif
-#ifndef PerlIO_open
-extern PerlIO *        PerlIO_open             (const char *,const char *);
-#endif
-#ifndef PerlIO_close
-extern int     PerlIO_close            (PerlIO *);
-#endif
-#ifndef PerlIO_eof
-extern int     PerlIO_eof              (PerlIO *);
-#endif
-#ifndef PerlIO_error
-extern int     PerlIO_error            (PerlIO *);
-#endif
-#ifndef PerlIO_clearerr
-extern void    PerlIO_clearerr         (PerlIO *);
-#endif
-#ifndef PerlIO_getc
-extern int     PerlIO_getc             (PerlIO *);
-#endif
-#ifndef PerlIO_putc
-extern int     PerlIO_putc             (PerlIO *,int);
-#endif
-#ifndef PerlIO_flush
-extern int     PerlIO_flush            (PerlIO *);
-#endif
-#ifndef PerlIO_ungetc
-extern int     PerlIO_ungetc           (PerlIO *,int);
-#endif
-#ifndef PerlIO_fileno
-extern int     PerlIO_fileno           (PerlIO *);
-#endif
-#ifndef PerlIO_fdopen
-extern PerlIO *        PerlIO_fdopen           (int, const char *);
-#endif
-#ifndef PerlIO_importFILE
-extern PerlIO *        PerlIO_importFILE       (FILE *,int);
-#endif
-#ifndef PerlIO_exportFILE
-extern FILE *  PerlIO_exportFILE       (PerlIO *,int);
-#endif
-#ifndef PerlIO_findFILE
-extern FILE *  PerlIO_findFILE         (PerlIO *);
-#endif
-#ifndef PerlIO_releaseFILE
-extern void    PerlIO_releaseFILE      (PerlIO *,FILE *);
-#endif
-#ifndef PerlIO_read
-extern SSize_t PerlIO_read             (PerlIO *,void *,Size_t);
-#endif
-#ifndef PerlIO_write
-extern SSize_t PerlIO_write            (PerlIO *,const void *,Size_t);
-#endif
-#ifndef PerlIO_setlinebuf
-extern void    PerlIO_setlinebuf       (PerlIO *);
-#endif
-#ifndef PerlIO_printf
-extern int     PerlIO_printf           (PerlIO *, const char *,...)
-                                       __attribute__((__format__ (__printf__, 2, 3)));
-#endif
-#ifndef PerlIO_sprintf
-extern int     PerlIO_sprintf          (char *, int, const char *,...)
-                                       __attribute__((__format__ (__printf__, 3, 4)));
-#endif
-#ifndef PerlIO_vprintf
-extern int     PerlIO_vprintf          (PerlIO *, const char *, va_list);
-#endif
-#ifndef PerlIO_tell
-extern Off_t   PerlIO_tell             (PerlIO *);
-#endif
-#ifndef PerlIO_seek
-extern int     PerlIO_seek             (PerlIO *, Off_t, int);
-#endif
-#ifndef PerlIO_rewind
-extern void    PerlIO_rewind           (PerlIO *);
-#endif
-#ifndef PerlIO_has_base
-extern int     PerlIO_has_base         (PerlIO *);
-#endif
-#ifndef PerlIO_has_cntptr
-extern int     PerlIO_has_cntptr       (PerlIO *);
-#endif
-#ifndef PerlIO_fast_gets
-extern int     PerlIO_fast_gets        (PerlIO *);
-#endif
-#ifndef PerlIO_canset_cnt
-extern int     PerlIO_canset_cnt       (PerlIO *);
-#endif
-#ifndef PerlIO_get_ptr
-extern STDCHAR * PerlIO_get_ptr                (PerlIO *);
-#endif
-#ifndef PerlIO_get_cnt
-extern int     PerlIO_get_cnt          (PerlIO *);
-#endif
-#ifndef PerlIO_set_cnt
-extern void    PerlIO_set_cnt          (PerlIO *,int);
-#endif
-#ifndef PerlIO_set_ptrcnt
-extern void    PerlIO_set_ptrcnt       (PerlIO *,STDCHAR *,int);
-#endif
-#ifndef PerlIO_get_base
-extern STDCHAR * PerlIO_get_base       (PerlIO *);
-#endif
-#ifndef PerlIO_get_bufsiz
-extern int     PerlIO_get_bufsiz       (PerlIO *);
-#endif
-#ifndef PerlIO_tmpfile
-extern PerlIO *        PerlIO_tmpfile          (void);
-#endif
-#ifndef PerlIO_stdin
-extern PerlIO *        PerlIO_stdin    (void);
-#endif
-#ifndef PerlIO_stdout
-extern PerlIO *        PerlIO_stdout   (void);
-#endif
-#ifndef PerlIO_stderr
-extern PerlIO *        PerlIO_stderr   (void);
-#endif
-#ifndef PerlIO_getpos
-extern int     PerlIO_getpos           (PerlIO *,Fpos_t *);
-#endif
-#ifndef PerlIO_setpos
-extern int     PerlIO_setpos           (PerlIO *,const Fpos_t *);
-#endif
-#ifndef PerlIO_fdupopen
-extern PerlIO *        PerlIO_fdupopen         (PerlIO *);
-#endif
-
-
 /*
  *   Interface for directory functions
  */
@@ -551,8 +357,8 @@ struct IPerlDirInfo
 
 #define PerlDir_mkdir(name, mode)      Mkdir((name), (mode))
 #ifdef VMS
-#  define PerlDir_chdir(n)             chdir(((n) && *(n)) ? (n) : "SYS$LOGIN")
-#else 
+#  define PerlDir_chdir(n)             Chdir(((n) && *(n)) ? (n) : "SYS$LOGIN")
+#else
 #  define PerlDir_chdir(name)          chdir((name))
 #endif
 #define PerlDir_rmdir(name)            rmdir((name))
@@ -595,8 +401,10 @@ typedef char*              (*LPENVGetenv_len)(struct IPerlEnv*,
 #endif
 #ifdef WIN32
 typedef unsigned long  (*LPEnvOsID)(struct IPerlEnv*);
-typedef char*          (*LPEnvLibPath)(struct IPerlEnv*, char*);
-typedef char*          (*LPEnvSiteLibPath)(struct IPerlEnv*, char*);
+typedef char*          (*LPEnvLibPath)(struct IPerlEnv*, const char*);
+typedef char*          (*LPEnvSiteLibPath)(struct IPerlEnv*, const char*);
+typedef char*          (*LPEnvVendorLibPath)(struct IPerlEnv*, const char*);
+typedef void           (*LPEnvGetChildIO)(struct IPerlEnv*, child_IO_table*);
 #endif
 
 struct IPerlEnv
@@ -618,6 +426,8 @@ struct IPerlEnv
     LPEnvOsID          pEnvOsID;
     LPEnvLibPath       pLibPath;
     LPEnvSiteLibPath   pSiteLibPath;
+    LPEnvVendorLibPath pVendorLibPath;
+    LPEnvGetChildIO    pGetChildIO;
 #endif
 };
 
@@ -663,6 +473,10 @@ struct IPerlEnvInfo
        (*PL_Env->pLibPath)(PL_Env,(str))
 #define PerlEnv_sitelib_path(str)                              \
        (*PL_Env->pSiteLibPath)(PL_Env,(str))
+#define PerlEnv_vendorlib_path(str)                            \
+       (*PL_Env->pVendorLibPath)(PL_Env,(str))
+#define PerlEnv_get_child_IO(ptr)                              \
+       (*PL_Env->pGetChildIO)(PL_Env, ptr)
 #endif
 
 #else  /* PERL_IMPLICIT_SYS */
@@ -686,6 +500,10 @@ struct IPerlEnvInfo
 
 #ifdef WIN32
 #define PerlEnv_os_id()                        win32_os_id()
+#define PerlEnv_lib_path(str)          win32_get_privlib(str)
+#define PerlEnv_sitelib_path(str)      win32_get_sitelib(str)
+#define PerlEnv_vendorlib_path(str)    win32_get_vendorlib(str)
+#define PerlEnv_get_child_IO(ptr)      win32_get_child_IO(ptr)
 #endif
 
 #endif /* PERL_IMPLICIT_SYS */
@@ -1244,7 +1062,7 @@ typedef int               (*LPRecvfrom)(struct IPerlSock*, SOCKET, char*, int,
 typedef int            (*LPSelect)(struct IPerlSock*, int, char*, char*,
                            char*, const struct timeval*);
 typedef int            (*LPSend)(struct IPerlSock*, SOCKET, const char*, int,
-                           int); 
+                           int);
 typedef int            (*LPSendto)(struct IPerlSock*, SOCKET, const char*,
                            int, int, const struct sockaddr*, int);
 typedef void           (*LPSethostent)(struct IPerlSock*, int);