Commit | Line | Data |
adfe19db |
1 | #!/bin/bash |
2 | ################################################################################ |
3 | # |
4 | # mkapidoc.sh -- generate apidoc.fnc from scanning the Perl source |
5 | # |
6 | ################################################################################ |
7 | # |
c1a049cb |
8 | # $Revision: 11 $ |
adfe19db |
9 | # $Author: mhx $ |
c1a049cb |
10 | # $Date: 2008/01/04 10:47:39 +0100 $ |
adfe19db |
11 | # |
12 | ################################################################################ |
13 | # |
c1a049cb |
14 | # Version 3.x, Copyright (C) 2004-2008, Marcus Holland-Moritz. |
adfe19db |
15 | # Version 2.x, Copyright (C) 2001, Paul Marquess. |
16 | # Version 1.x, Copyright (C) 1999, Kenneth Albanowski. |
17 | # |
18 | # This program is free software; you can redistribute it and/or |
19 | # modify it under the same terms as Perl itself. |
20 | # |
21 | ################################################################################ |
22 | |
23 | function isperlroot |
24 | { |
25 | [ -f "$1/embed.fnc" ] && [ -f "$1/perl.h" ] |
26 | } |
27 | |
28 | function usage |
29 | { |
30 | echo "USAGE: $0 [perlroot] [output-file] [embed.fnc]" |
31 | exit 0 |
32 | } |
33 | |
34 | if [ -z "$1" ]; then |
35 | if isperlroot "../../.."; then |
36 | PERLROOT=../../.. |
37 | else |
38 | PERLROOT=. |
39 | fi |
40 | else |
41 | PERLROOT=$1 |
42 | fi |
43 | |
44 | if [ -z "$2" ]; then |
45 | if [ -f "parts/apidoc.fnc" ]; then |
46 | OUTPUT="parts/apidoc.fnc" |
47 | else |
48 | usage |
49 | fi |
50 | else |
51 | OUTPUT=$2 |
52 | fi |
53 | |
54 | if [ -z "$3" ]; then |
55 | if [ -f "parts/embed.fnc" ]; then |
56 | EMBED="parts/embed.fnc" |
57 | else |
58 | usage |
59 | fi |
60 | else |
61 | EMBED=$3 |
62 | fi |
63 | |
64 | if isperlroot $PERLROOT; then |
679ad62d |
65 | cat >$OUTPUT <<EOF |
66 | :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
67 | : |
68 | : !!!!! Do NOT edit this file directly! -- Edit PPPort_pm.PL instead. !!!!! |
69 | : |
70 | : This file was automatically generated from the API documentation scattered |
71 | : all over the Perl source code. To learn more about how all this works, |
72 | : please read the F<HACKERS> file that came with this distribution. |
73 | : |
74 | :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
75 | |
76 | : |
77 | : This file lists all API functions/macros that are documented in the Perl |
78 | : source code, but are not contained in F<embed.fnc>. |
79 | : |
80 | |
81 | EOF |
9132e1a3 |
82 | grep -hr '^=for apidoc' $PERLROOT | sed -e 's/=for apidoc //' | grep '|' | sort | uniq \ |
adfe19db |
83 | | perl -e'$f=pop;open(F,$f)||die"$f:$!";while(<F>){(split/\|/)[2]=~/(\w+)/;$h{$1}++} |
679ad62d |
84 | while(<>){s/[ \t]+$//;(split/\|/)[2]=~/(\w+)/;$h{$1}||print}' $EMBED >>$OUTPUT |
adfe19db |
85 | else |
86 | usage |
87 | fi |