13 die if !GetOptions("d|debug+",\$D);
18 my($ref,$missval,$sub)=@_;
20 $$ref=$missval if !defined $$ref;
26 my($slot,$type,$symref)=@_;
28 defmiss(\$slot,{},sub {
30 push(@{$$$typeref{$type}},$symref);
38 $sym{"fn_c"}=~s#^$ENV{PWD}/#./# if defined $sym{"fn_c"};
39 defmiss(\$symtab{$sym{"name"}},{},sub {
41 my($type)=$sym{"type"};
42 addsymtype($$slotref,$type,\%sym);
43 addsymtype($$slotref,$type,\%sym)
44 if ($type!~/nU/ && ($type=~s/(n)[[:upper:]]/$1+/ || $type=~s/(n)[[:lower:]]/$1-/));
48 open(NM,"-|",'find -name "*.o"|xargs nm -f posix --print-file-name --no-sort --line-numbers')
49 or die "Cannot get nm output: $!";
52 die "Line $. of nm output not recognized: $_"
54 if !/^([^:]*):\s*(\S*) (\w) [^\t]*(?:\t(.*))?$/;
64 open(CTAGS,"-|",'find -name "*.h"|xargs ctags -f - --c-types=xp')
65 or die "Cannot get ctags output: $!";
68 die "Line $. of ctags output not recognized: $_"
70 if !/^([^\t]*)\t([^\t]*)\t.*\t(\w)$/;
79 print Data::Dumper->Dump([\%symtab],["%symtab"]) if $D;
85 print("$error ".$arr[0]{"name"}.($arr[0]{"type"}=~/cp|n[tT]/ ? "()" : "").":\n");
87 while ($symref=shift(@arr)) {
89 if (defined($$symref{"fn_c"})) {
90 print($$symref{"fn_c"});
91 print("\t(".$$symref{"fn_o"}.")") if defined $$symref{"fn_o"};
94 my($fn)=$$symref{"fn_o"};
106 return [] if !defined($ref);
111 foreach $symname (sort keys %symtab) {
112 my($typesref)=$symtab{$symname};
113 my($ref,$ref1,$ref2);
115 # >=2 n[:upper:]\U symbols => global conflict
116 if (@{refendef($ref=$$typesref{"n+"})}>=2) {
117 dumpsyms("global conflict",@{$ref});
120 # >=1 n[:upper:]\U symbol && >=1 n[:lower:] symbol => local override
121 if (@{refendef($ref1=$$typesref{"n+"})}>=1 && @{refendef($ref2=$$typesref{"n-"})}>=1) {
122 dumpsyms("local override of global",@{$ref1});
123 dumpsyms(" -- with local",@{$ref2});
126 # >=1 n[:upper:]\U symbol && ==0 nU symbol => global singularity
127 if (@{refendef($ref=$$typesref{"n+"})}>=1 && @{refendef($$typesref{"n-"})}==0) {
128 dumpsyms("global singularity",@{$ref});
131 # >=1 cx symbol && ==0 n[:upper:]\U symbol => floating extern data
132 if (@{refendef($ref=$$typesref{"cx"})}>=1 && @{refendef($$typesref{"n+"})}==0) {
133 dumpsyms("floating extern data",@{$ref});
136 # >=1 cp symbol && ==0 n[:upper:]\U symbol => floating extern func
137 if (@{refendef($ref=$$typesref{"cp"})}>=1 && @{refendef($$typesref{"n+"})}==0) {
138 dumpsyms("floating extern func",@{$ref});