comparison src/cs/drivers/drv_app/ffs/board/mkeffs.pl @ 0:945cf7f506b2

src/cs: chipsetsw import from tcs211-fcmodem binary blobs and LCD demo files have been excluded, all line endings are LF only
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Sep 2016 22:50:11 +0000 (2016-09-25)
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:945cf7f506b2
1 #!/usr/bin/perl -w
2
3 if ($#ARGV < 0) { die "Must give argument 'c' or 'pl'"; }
4
5 $c = ($ARGV[0] eq "c");
6 shift;
7
8 $c && c_begin();
9 !$c && pl_begin();
10
11 while (<>) {
12 chop;
13 if (/^\s*(EFFS_\w+)\s*=\s*(-?[0-9]+),\s*\/\* (.*) \*\//) {
14 $name = $1;
15 $code = $2;
16 $text = $3;
17 $c && print " case $name: return \"$text\"; /* $code */\n";
18 !$c && print "\$$name = $code;\n";
19 !$c && print "\$FFS_ERRORSTR{$code} = \"$text\";\n";
20 }
21 }
22
23 $c && c_end();
24 !$c && pl_end();
25
26
27 sub c_begin
28 {
29 print "/* This file is autogenerated --- do not edit. */\n\n";
30
31 print "#include \"ffs/ffs.h\"\n\n";
32
33 print "char *ffs_strerror(effs_t error)\n";
34 print "{\n";
35 print " switch (error) {\n";
36 }
37
38 sub c_end
39 {
40 print " default: return \"unknown ffs error code!\";\n";
41 print " }\n";
42 print "}\n";
43 }
44
45 sub pl_begin
46 {
47 print "# This file is autogenerated --- do not edit.\n\n";
48 }
49
50 sub pl_end
51 {
52 }
53