summaryrefslogtreecommitdiff
path: root/ext/B/B.xs
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1998-12-05 16:14:42 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1998-12-05 16:14:42 +0000
commit0cc1d052f2b5aa0a485e4a60aabe91829ddbe78c (patch)
treeb4979327e0d5279d1ca64dcbac71db825e46eaef /ext/B/B.xs
parentcf86991c04b212c029b30807ecab507b784fd8ad (diff)
downloadperl-0cc1d052f2b5aa0a485e4a60aabe91829ddbe78c.tar.gz
Avoid hard-coding op numbers
Update CC.pm to save %INC, and to co-exist with new C.pm p4raw-id: //depot/perl@2453
Diffstat (limited to 'ext/B/B.xs')
-rw-r--r--ext/B/B.xs23
1 files changed, 22 insertions, 1 deletions
diff --git a/ext/B/B.xs b/ext/B/B.xs
index 3b8a7e35de..3e300240ea 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -514,7 +514,28 @@ svref_2object(sv)
croak("argument is not a reference");
RETVAL = (SV*)SvRV(sv);
OUTPUT:
- RETVAL
+ RETVAL
+
+void
+opnumber(name)
+char * name
+CODE:
+{
+ int i;
+ IV result = -1;
+ ST(0) = sv_newmortal();
+ if (strncmp(name,"pp_",3) == 0)
+ name += 3;
+ for (i = 0; i < PL_maxo; i++)
+ {
+ if (strcmp(name, PL_op_name[i]) == 0)
+ {
+ result = i;
+ break;
+ }
+ }
+ sv_setiv(ST(0),result);
+}
void
ppname(opnum)