summaryrefslogtreecommitdiffstats
path: root/util/parsevar.pl
blob: 97689a192f58f4f5b60e9b996b750eae97ad4eb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl
# $Id$
print << '.';
/*
 * This header file is auto-generated from pttbbs/mbbsd/var.c .
 * Please do NOT edit this file directly.
 */

#ifndef INCLUDE_VAR_H
#define INCLUDE_VAR_H
#include "bbs.h"
.
while( <> ){
    if( /^\w/ ){
    chomp;
    s|//.*||;
    s|/\*.*?\*/||;
    s/\=\s*\{.*?\}//;

    s/\=.*?([,;])/$1/g;
    s/\=.*?\{//g;
    $_ .= ';' if( index($_, ';') == -1 );
    s/\=.*?([,;])/$1/g;
    s/\=.*?\{//g;
    print "extern $_\n";
    } elsif( /^\s*\#/ && !/include/ ){
    print;
    }
}
print "#endif /* INCLUDE_VAR_H */\n";