X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=bytecode.h;h=3e8a6a9eade52c66084187a2e84f5ee3e73935cf;hb=5a0924038aa1098308ad491a6148bc59d3045ce6;hp=4676b5ad601ac19af0fb4063e9e715de432a461b;hpb=f7d144c835d02593edb2388cf7cb0c7395c53ae2;p=p5sagit%2Fp5-mst-13.2.git diff --git a/bytecode.h b/bytecode.h index 4676b5a..3e8a6a9 100644 --- a/bytecode.h +++ b/bytecode.h @@ -2,7 +2,7 @@ typedef char *pvcontents; typedef char *strconst; typedef U32 PV; typedef char *op_tr_array; -typedef int comment; +typedef int comment_t; typedef SV *svindex; typedef OP *opindex; typedef IV IV64; @@ -23,16 +23,16 @@ EXT I32 obj_list_fill INIT(-1); bs.fread((char*)(argp),(len),(nelem),bs.data) #define BGET_FGETC() bs.fgetc(bs.data) #else -#define BGET_FREAD(argp, len, nelem) PerlIO_fread((argp), (len), (nelem), fp) +#define BGET_FREAD(argp, len, nelem) PerlIO_read(fp, (argp), (len)*(nelem)) #define BGET_FGETC() PerlIO_getc(fp) #endif /* INDIRECT_BGET_MACROS */ #define BGET_U32(arg) \ - BGET_FREAD(&arg, sizeof(U32), 1); arg = ntohl((U32)arg) + BGET_FREAD(&arg, sizeof(U32), 1); arg = PerlSock_ntohl((U32)arg) #define BGET_I32(arg) \ - BGET_FREAD(&arg, sizeof(I32), 1); arg = (I32)ntohl((U32)arg) + BGET_FREAD(&arg, sizeof(I32), 1); arg = (I32)PerlSock_ntohl((U32)arg) #define BGET_U16(arg) \ - BGET_FREAD(&arg, sizeof(U16), 1); arg = ntohs((U16)arg) + BGET_FREAD(&arg, sizeof(U16), 1); arg = PerlSock_ntohs((U16)arg) #define BGET_U8(arg) arg = BGET_FGETC() #if INDIRECT_BGET_MACROS @@ -51,7 +51,7 @@ EXT I32 obj_list_fill INIT(-1); BGET_U32(arg); \ if (arg) { \ New(666, pv.xpv_pv, arg, char); \ - PerlIO_fread(pv.xpv_pv, 1, arg, fp);\ + PerlIO_read(fp, pv.xpv_pv, arg); \ pv.xpv_len = arg; \ pv.xpv_cur = arg - 1; \ } else { \ @@ -92,7 +92,7 @@ EXT I32 obj_list_fill INIT(-1); New(666, ary, 256, unsigned short); \ BGET_FREAD(ary, 256, 2); \ for (i = 0; i < 256; i++) \ - ary[i] = ntohs(ary[i]); \ + ary[i] = PerlSock_ntohs(ary[i]); \ arg = (char *) ary; \ } while (0) @@ -108,11 +108,13 @@ EXT I32 obj_list_fill INIT(-1); arg = atof(str); \ } STMT_END -#define BGET_objindex(arg) STMT_START { \ - U32 ix; \ - BGET_U32(ix); \ - arg = obj_list[ix]; \ +#define BGET_objindex(arg, type) STMT_START { \ + U32 ix; \ + BGET_U32(ix); \ + arg = (type)obj_list[ix]; \ } STMT_END +#define BGET_svindex(arg) BGET_objindex(arg, svindex) +#define BGET_opindex(arg) BGET_objindex(arg, opindex) #define BSET_ldspecsv(sv, arg) sv = specialsv_list[arg]