pack changes and related fixes
[p5sagit/p5-mst-13.2.git] / perl.h
diff --git a/perl.h b/perl.h
index d316734..89d1494 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1,6 +1,6 @@
 /*    perl.h
  *
- *    Copyright (c) 1987-2002, Larry Wall
+ *    Copyright (c) 1987-2003, Larry Wall
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -2161,8 +2161,13 @@ typedef pthread_key_t    perl_key;
  *   of bytes occurs on read or write operations.
  */
 #  define USEMYBINMODE / **/
+#  include <io.h> /* for setmode() prototype */
 #  define my_binmode(fp, iotype, mode) \
-            (PerlLIO_setmode(PerlIO_fileno(fp), mode) != -1 ? TRUE : FALSE)
+            (PerlLIO_setmode(fileno(fp), mode) != -1 ? TRUE : FALSE)
+#endif
+
+#ifdef __CYGWIN__
+void init_os_extras(void);
 #endif
 
 #ifdef UNION_ANY_DEFINITION
@@ -2933,6 +2938,8 @@ EXTCONST char PL_no_func[]
   INIT("The %s function is unimplemented");
 EXTCONST char PL_no_myglob[]
   INIT("\"my\" variable %s can't be in a package");
+EXTCONST char PL_no_localize_ref[]
+  INIT("Can't localize through a reference");
 
 EXTCONST char PL_uuemap[65]
   INIT("`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_");
@@ -3239,7 +3246,9 @@ enum {            /* pass one of these to get_vtbl */
 #define HINT_FILETEST_ACCESS   0x00400000 /* filetest pragma */
 #define HINT_UTF8              0x00800000 /* utf8 pragma */
 
+/* assertions pragma */
 #define HINT_ASSERTING          0x01000000
+#define HINT_ASSERTIONSSEEN     0x02000000
 
 /* The following are stored in $sort::hints, not in PL_hints */
 #define HINT_SORT_SORT_BITS    0x000000FF /* allow 256 different ones */
@@ -3346,6 +3355,25 @@ typedef void *Thread;
 #undef PERLVARI
 #undef PERLVARIC
 
+/* Types used by pack/unpack */ 
+typedef enum {
+  e_no_len,     /* no length  */
+  e_number,     /* number, [] */
+  e_star        /* asterisk   */
+} howlen_t;
+
+typedef struct {
+  char*    patptr;   /* current template char */
+  char*    patend;   /* one after last char   */
+  char*    grpbeg;   /* 1st char of ()-group  */
+  char*    grpend;   /* end of ()-group       */
+  I32      code;     /* template code (!)     */
+  I32      length;   /* length/repeat count   */
+  howlen_t howlen;   /* how length is given   */ 
+  int      level;    /* () nesting level      */
+  U32      flags;    /* /=4, comma=2, pack=1  */
+} tempsym_t;
+
 #include "thread.h"
 #include "pp.h"
 
@@ -3485,7 +3513,7 @@ EXT MGVTBL PL_vtbl_defelem = {MEMBER_TO_FPTR(Perl_magic_getdefelem),
                                        MEMBER_TO_FPTR(Perl_magic_setdefelem),
                                        0,      0,      0};
 
-EXT MGVTBL PL_vtbl_regexp = {0,0,0,0, MEMBER_TO_FPTR(Perl_magic_freeregexp)};
+EXT MGVTBL PL_vtbl_regexp = {0, MEMBER_TO_FPTR(Perl_magic_setregexp),0,0, MEMBER_TO_FPTR(Perl_magic_freeregexp)};
 EXT MGVTBL PL_vtbl_regdata = {0, 0, MEMBER_TO_FPTR(Perl_magic_regdata_cnt), 0, 0};
 EXT MGVTBL PL_vtbl_regdatum = {MEMBER_TO_FPTR(Perl_magic_regdatum_get),
                               MEMBER_TO_FPTR(Perl_magic_regdatum_set), 0, 0, 0};
@@ -4173,15 +4201,22 @@ extern void moncontrol(int);
 #define PERL_UNICODE_STDIN_FLAG                        0x0001
 #define PERL_UNICODE_STDOUT_FLAG               0x0002
 #define PERL_UNICODE_STDERR_FLAG               0x0004
-#define PERL_UNICODE_STD_FLAG                  0x0007
 #define PERL_UNICODE_IN_FLAG                   0x0008
 #define PERL_UNICODE_OUT_FLAG                  0x0010
-#define PERL_UNICODE_INOUT_FLAG                        0x0018
-#define PERL_UNICODE_ARGV_FLAG                 0x0020 /* For @ARGV? */
+#define PERL_UNICODE_ARGV_FLAG                 0x0020
 #define PERL_UNICODE_LOCALE_FLAG               0x0040
 #define PERL_UNICODE_WIDESYSCALLS_FLAG         0x0080 /* for Sarathy */
 
-#define PERL_UNICODE_DEFAULT_FLAGS \
+#define PERL_UNICODE_STD_FLAG          \
+       (PERL_UNICODE_STDIN_FLAG        | \
+        PERL_UNICODE_STDOUT_FLAG       | \
+        PERL_UNICODE_STDERR_FLAG)
+
+#define PERL_UNICODE_INOUT_FLAG                \
+       (PERL_UNICODE_IN_FLAG   | \
+        PERL_UNICODE_OUT_FLAG)
+
+#define PERL_UNICODE_DEFAULT_FLAGS     \
        (PERL_UNICODE_STD_FLAG          | \
         PERL_UNICODE_INOUT_FLAG        | \
         PERL_UNICODE_LOCALE_FLAG)
@@ -4227,10 +4262,14 @@ extern void moncontrol(int);
 #ifndef PERL_BLOCKSIG_BLOCK
 #   define PERL_BLOCKSIG_BLOCK(set)    NOOP
 #endif
-#ifndef PERL_BLOCKSIG_ADD
+#ifndef PERL_BLOCKSIG_UNBLOCK
 #   define PERL_BLOCKSIG_UNBLOCK(set)  NOOP
 #endif
 
+/* Use instead of abs() since abs() forces its argument to be an int,
+ * but also beware since this evaluates its argument twice, so no x++. */
+#define PERL_ABS(x) ((x) < 0 ? -(x) : (x))
+
 /* and finally... */
 #define PERL_PATCHLEVEL_H_IMPLICIT
 #include "patchlevel.h"