-
Notifications
You must be signed in to change notification settings - Fork 4
/
lmt_help.pl
82 lines (71 loc) · 1.67 KB
/
lmt_help.pl
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/perl
#
# This program reads a module interface file and creates a
# C program syntax table that contains the module function
# search table.
#
# Do not use this simple script as an automation tool for
# code generation. Rather this is a helpful little quick and
# dirty solution to create the module function search table
# first version for already existing modules. Later maintain
# the table with great care. Edit the table into the interface
# file at the end.
#
$ModuleFile = shift;
open(F,$ModuleFile) or die "Cannot open $ModuleFile";
$ModuleFile =~ s/\.c$//;
$ModuleFile = uc $ModuleFile;
print <<END;
/* Module function search table.
*/
SLFST ${ModuleFile}_SLFST\[\] ={
END
while( <F> ){
if( /besVERSION_NEGOTIATE/ ){
print "{ \"versmodu\" , versmodu },\n";
next;
}
if( /besSUB_START/ ){
print "{ \"bootmodu\" , bootmodu },\n";
next;
}
if( /besSUB_FINISH/ ){
print "{ \"finimodu\" , finimodu },\n";
next;
}
if( /besSUB_ERRMSG/ ){
print "{ \"emsgmodu\" , emsgmodu },\n";
next;
}
if( /besSUB_PROCESS_START/ ){
print "{ \"_init\" , _init },\n";
next;
}
if( /besSUB_PROCESS_FINISH/ ){
print "{ \"_fini\" , _fini },\n";
next;
}
if( /besSUB_KEEP/ ){
print "{ \"keepmodu\" , keepmodu },\n";
next;
}
if( /besSUB_SHUTDOWN/ ){
print "{ \"shutmodu\" , shutmodu },\n";
next;
}
if( /besSUB_AUTO/ ){
print "{ \"automodu\" , automodu },\n";
next;
}
if( /besFUNCTION\((\w+)\)/ ){
print "{ \"$1\" , $1 },\n";
next;
}
if( /besCOMMAND\((\w+)\)/ ){
print "{ \"$1\" , $1 },\n";
next;
}
}
print "{ NULL , NULL }\n";
print " };\n";
close F;