5 # This allows the order of overloading constants to be changed.
9 # Get function prototypes
10 require 'regen_lib.pl';
19 my ($enum, $name) = /^(\S+)\s+(\S+)/ or die "Can't parse $_";
24 safer_unlink ('overload.h', 'overload.c');
25 my $c = safer_open("overload.c");
26 my $h = safer_open("overload.h");
31 /* -*- buffer-read-only: t -*-
35 * Copyright (C) 1997, 1998, 2000, 2001, 2005, 2006, 2007 by Larry Wall
38 * You may distribute under the terms of either the GNU General Public
39 * License or the Artistic License, as specified in the README file.
41 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
42 * This file is built by overload.pl
48 print_header('overload.c');
51 print_header('overload.h');
57 print " ${_}_amg,\n", foreach @enums;
61 /* Do not leave a trailing comma here. C9X allows it, C89 doesn't. */
64 #define NofAMmeth max_amg_code
70 #define AMG_id2name(id) (PL_AMG_names[id]+1)
71 #define AMG_id2namelen(id) (PL_AMG_namelens[id]-1)
73 static const U8 PL_AMG_namelens[NofAMmeth] = {
76 my $last = pop @names;
78 print $c " $_,\n" foreach map { length $_ } @names;
80 my $lastlen = length $last;
85 static const char * const PL_AMG_names[NofAMmeth] = {
86 /* Names kept in the symbol table. fallback => "()", the rest has
87 "(" prepended. The only other place in perl which knows about
88 this convention is AMG_id2name (used for debugging output and
89 'nomethod' only), the only other place which has it hardwired is
93 print $c " \"$_\",\n" foreach map { s/(["\\"])/\\$1/g; $_ } @names;
104 # Fallback should be the first
107 # These 5 are the most common in the fallback switch statement in amagic_call
114 # These have non-default cases in that switch statement
127 # These 12 feature in the next switch statement
178 # Note: Perl_Gv_AMupdate() assumes that DESTROY is the last entry