use &dl_error rather than &dl_load_file as the guard for calling
[p5sagit/p5-mst-13.2.git] / ext / ByteLoader / bytecode.h
index 04a05e4..1621fed 100644 (file)
@@ -30,8 +30,22 @@ typedef IV IV64;
        }                               \
     } STMT_END
 
-#define BGET_comment_t(arg) \
+#ifdef BYTELOADER_LOG_COMMENTS
+#  define BGET_comment_t(arg) \
+    STMT_START {                                                       \
+       char buf[1024];                                                 \
+       int i = 0;                                                      \
+       do {                                                            \
+           arg = BGET_FGETC();                                         \
+           buf[i++] = (char)arg;                                       \
+       } while (arg != '\n' && arg != EOF);                            \
+       buf[i] = '\0';                                                  \
+       PerlIO_printf(PerlIO_stderr(), "%s", buf);                      \
+    } STMT_END
+#else
+#  define BGET_comment_t(arg) \
        do { arg = BGET_FGETC(); } while (arg != '\n' && arg != EOF)
+#endif
 
 /*
  * In the following, sizeof(IV)*4 is just a way of encoding 32 on 64-bit-IV
@@ -43,7 +57,7 @@ typedef IV IV64;
        BGET_U32(hi);                                   \
        BGET_U32(lo);                                   \
        if (sizeof(IV) == 8)                            \
-           arg = (IV) (hi << (sizeof(IV)*4) | lo);     \
+           arg = ((IV)hi << (sizeof(IV)*4) | (IV)lo);  \
        else if (((I32)hi == -1 && (I32)lo < 0)         \
                 || ((I32)hi == 0 && (I32)lo >= 0)) {   \
            arg = (I32)lo;                              \
@@ -73,7 +87,7 @@ typedef IV IV64;
 #define BGET_NV(arg) STMT_START {      \
        char *str;                      \
        BGET_strconst(str);             \
-       arg = Perl_atonv(str);          \
+       arg = Atof(str);                \
     } STMT_END
 
 #define BGET_objindex(arg, type) STMT_START {  \
@@ -113,7 +127,8 @@ typedef IV IV64;
        ((PMOP*)o)->op_pmregexp = arg ? \
                CALLREGCOMP(aTHX_ arg, arg + bytecode_pv.xpv_cur, ((PMOP*)o)) : 0
 #define BSET_newsv(sv, arg)    sv = NEWSV(666,0); SvUPGRADE(sv, arg)
-#define BSET_newop(o, arg)     o = (OP*)safemalloc(optype_size[arg])
+#define BSET_newop(o, arg)     ((o = (OP*)safemalloc(optype_size[arg])), \
+                                memzero((char*)o,optype_size[arg]))
 #define BSET_newopn(o, arg) STMT_START {       \
        OP *oldop = o;                          \
        BSET_newop(o, arg);                     \
@@ -137,6 +152,9 @@ typedef IV IV64;
        PL_comppad = (AV *)arg;                 \
        pad = AvARRAY(arg);                     \
     } STMT_END
+#define BSET_cop_file(cop, arg)                CopFILE_set(cop,arg)
+#define BSET_cop_line(cop, arg)                CopLINE_set(cop,arg)
+#define BSET_cop_stashpv(cop, arg)     CopSTASHPV_set(cop,arg)
 
 #define BSET_OBJ_STORE(obj, ix)                \
        (I32)ix > bytecode_obj_list_fill ?      \