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 die "overload.h: $!" unless open(C, ">overload.c");
27 die "overload.h: $!" unless open(H, ">overload.h");
33 /* -*- buffer-read-only: t -*-
37 * Copyright (C) 1997, 1998, 2000, 2001, 2005, 2006, 2007 by Larry Wall
40 * You may distribute under the terms of either the GNU General Public
41 * License or the Artistic License, as specified in the README file.
43 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
44 * This file is built by overload.pl
50 print_header('overload.c');
53 print_header('overload.h');
59 print " ${_}_amg,\n", foreach @enums;
63 /* Do not leave a trailing comma here. C9X allows it, C89 doesn't. */
66 #define NofAMmeth max_amg_code
72 #define AMG_id2name(id) (PL_AMG_names[id]+1)
73 #define AMG_id2namelen(id) (PL_AMG_namelens[id]-1)
75 const U8 PL_AMG_namelens[NofAMmeth] = {
78 my $last = pop @names;
80 print C " $_,\n" foreach map { length $_ } @names;
82 my $lastlen = length $last;
87 const 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
95 print C " \"$_\",\n" foreach map { s/(["\\"])/\\$1/g; $_ } @names;
106 # Fallback should be the first
109 # These 5 are the most common in the fallback switch statement in amagic_call
116 # These have non-default cases in that switch statement
129 # These 12 feature in the next switch statement
180 # Note: Perl_Gv_AMupdate() assumes that DESTROY is the last entry