FreeCalypso > hg > tcs211-l1-reconst
comparison chipsetsw/drivers/drv_app/ffs/board/mkeffs.pl @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
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 |