This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Storing the length of all the overloading names saves a strlen() in a
[perl5.git] / overload.c
1 /* -*- buffer-read-only: t -*-
2  *
3  *    overload.c
4  *
5  *    Copyright (C) 1997, 1998, 2000, 2001, 2005, 2006, 2007 by Larry Wall
6  *    and others
7  *
8  *    You may distribute under the terms of either the GNU General Public
9  *    License or the Artistic License, as specified in the README file.
10  *
11  *  !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
12  *  This file is built by overload.pl
13  */
14
15 #define AMG_id2name(id) (PL_AMG_names[id]+1)
16
17 const U8 PL_AMG_namelens[NofAMmeth] = {
18     2,
19     4,
20     4,
21     4,
22     4,
23     4,
24     3,
25     3,
26     5,
27     3,
28     3,
29     2,
30     2,
31     4,
32     4,
33     3,
34     4,
35     2,
36     3,
37     2,
38     3,
39     3,
40     3,
41     3,
42     3,
43     3,
44     3,
45     3,
46     3,
47     9,
48     2,
49     3,
50     2,
51     3,
52     2,
53     3,
54     2,
55     3,
56     2,
57     3,
58     3,
59     4,
60     3,
61     4,
62     3,
63     4,
64     2,
65     3,
66     2,
67     3,
68     2,
69     3,
70     4,
71     4,
72     2,
73     6,
74     4,
75     4,
76     4,
77     4,
78     5,
79     2,
80     3,
81     2,
82     3,
83     3,
84     7
85 };
86
87 char * const PL_AMG_names[NofAMmeth] = {
88   /* Names kept in the symbol table.  fallback => "()", the rest has
89      "(" prepended.  The only other place in perl which knows about
90      this convention is AMG_id2name (used for debugging output and
91      'nomethod' only), the only other place which has it hardwired is
92      overload.pm.  */
93     "()",
94     "(${}",
95     "(@{}",
96     "(%{}",
97     "(*{}",
98     "(&{}",
99     "(++",
100     "(--",
101     "(bool",
102     "(0+",
103     "(\"\"",
104     "(!",
105     "(=",
106     "(abs",
107     "(neg",
108     "(<>",
109     "(int",
110     "(<",
111     "(<=",
112     "(>",
113     "(>=",
114     "(==",
115     "(!=",
116     "(lt",
117     "(le",
118     "(gt",
119     "(ge",
120     "(eq",
121     "(ne",
122     "(nomethod",
123     "(+",
124     "(+=",
125     "(-",
126     "(-=",
127     "(*",
128     "(*=",
129     "(/",
130     "(/=",
131     "(%",
132     "(%=",
133     "(**",
134     "(**=",
135     "(<<",
136     "(<<=",
137     "(>>",
138     "(>>=",
139     "(&",
140     "(&=",
141     "(|",
142     "(|=",
143     "(^",
144     "(^=",
145     "(<=>",
146     "(cmp",
147     "(~",
148     "(atan2",
149     "(cos",
150     "(sin",
151     "(exp",
152     "(log",
153     "(sqrt",
154     "(x",
155     "(x=",
156     "(.",
157     "(.=",
158     "(~~",
159     "DESTROY"
160 };