use common::sense;
+sub symbol {
+ my ($sym) = @_;
+ return if $sym =~ m{^(ucw|ucwlib)_};
+ print "$sym\n";
+}
+
sub parse {
my ($file) = @_;
print "# $file\n";
open my $f, '<', $file or die;
while (<$f>) {
chomp;
+ # Interpret special comments
+ m{// NOAPI} and next;
+ if (m{// API: (\w+)}) {
+ print "$1\n";
+ next;
+ }
# Find things which look like top-level declarations
s{//.*}{};
s{/\*.*}{};
if (m{^extern [^,]*(\s+\**\w+(,\s+\**\w+)*);}) {
my $x = $1;
$x =~ s{[,*]}{}g;
- print join("\n", grep { !/^$/ } split /\s+/, $x), "\n";
+ symbol $_ for grep { !/^$/ } split /\s+/, $x;
} elsif (m{( |\*)(\w+)\(}) {
- print "$2\n";
+ symbol($2);
} else {
print "??? $_\n";
}
extern char *log_title; /** An optional log message title. Set to program name by log_init(). **/
extern int log_pid; /** An optional PID printed in each log message. Set to 0 if it shouldn't be logged. **/
-extern void (*log_die_hook)(void); /** An optional function called just before die() exists. **/
+extern void (*log_die_hook)(void); /** An optional function called just before die() exists. **/ // API: log_die_hook
void log_init(const char *argv0); /** Set @log_title to the program name extracted from @argv[0]. **/
void log_fork(void); /** Call after fork() to update @log_pid. **/
/* string.c */
#ifdef CONFIG_DARWIN
-uns strnlen(const char *str, uns n);
+uns strnlen(const char *str, uns n); // NOAPI
#endif
/**