File: update_register_all_functions

package info (click to toggle)
evolvotron 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,444 kB
  • sloc: cpp: 9,855; sh: 258; python: 162; makefile: 11; sed: 6
file content (45 lines) | stat: -rwxr-xr-x 988 bytes parent folder | download | duplicates (9)
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
#!/bin/bash

rm -f register_all_functions.cpp

cat <<EOF >> register_all_functions.cpp
/* AUTO GENERATED FILE.  DO NOT EDIT */

/* Should be updated by update_register_all_functions script when new functions are added */

#include "libfunction_precompiled.h"

#include "register_all_functions.h"

#include "function_boilerplate.h"
EOF

HEADERS=`grep -l FUNCTION_BEGIN *.h | sed 's/function_boilerplate.h//'`

for f in $HEADERS ; do
    sed -f stripcomments.sed "$f" \
	| grep FUNCTION_BEGIN \
	| sed 's/FUNCTION_BEGIN(//' \
	| sed 's/,.*//' \
	| awk '{printf("REGISTER_DCL(%s);\n",$0);}' \
	>> register_all_functions.cpp
done

cat <<EOF >> register_all_functions.cpp

void register_all_functions(FunctionRegistry& r)
{
EOF

for f in $HEADERS ; do
    sed -f stripcomments.sed "$f" \
	| grep FUNCTION_BEGIN \
	| sed 's/FUNCTION_BEGIN(//' \
	| sed 's/,.*//' \
	| awk '{printf("  register_%s(r);\n",$0);}' \
	>> register_all_functions.cpp
done

cat <<EOF >> register_all_functions.cpp
}
EOF