1 #define PERL_NO_GET_CONTEXT 2 #include "EXTERN.h" 3 #include "perl.h" 4 #include "XSUB.h" 5 6 #include "ppport.h" 7 #include "const-c.inc" 8 9 /* Private flags added by me for the optimizer, not in CORE */ 10 #define OA_NOSTACK 512 11 #define OA_MAYSCALAR 1024 12 #define OA_MAYARRAY 2048 13 #define OA_MAYVOID 4096 14 #define OA_RETFIXED 8192 15 #define OA_MAYBRANCH 16384 16 17 MODULE = Opcodes PACKAGE = Opcodes 18 19 PROTOTYPES: DISABLE 20 21 INCLUDE: const-xs.inc 22 23 void 24 opcodes() 25 PPCODE: 26 if (GIMME == G_ARRAY) { 27 int i; 28 EXTEND(sp, MAXO); 29 /* ([ opcode opname ppaddr check opargs ]) from opnames.h/opcode.h */ 30 for (i=0; i < MAXO; i++) { 31 AV* ref; 32 ref = newAV(); 33 av_extend(ref, 5); 34 av_store(ref, 0, newSViv( i )); 35 av_store(ref, 1, newSVpvn(PL_op_name[i], strlen(PL_op_name[i]) )); 36 av_store(ref, 2, newSVuv( PTR2UV(PL_ppaddr[i]) )); 37 av_store(ref, 3, newSVuv( PTR2UV(PL_check[i]) )); 38 av_store(ref, 4, newSViv( PL_opargs[i] )); 39 XPUSHs( sv_2mortal(newRV((SV*)ref)) ); 40 } 41 } 42 else { 43 XPUSHs(sv_2mortal(newSViv(PL_maxo))); 44 } 45 46