]> git.lyx.org Git - features.git/blob - src/frontends/xforms/forms/fdfixh.sed
Some forgotten files and Anguses citation patch.
[features.git] / src / frontends / xforms / forms / fdfixh.sed
1 # cat someFile.h | sed -f fdfixh.sed
2
3 # It contains the instructions that sed requires to manipulate
4 # the header files produced by fdesign into a form usable by LyX
5
6 # In summary it...
7
8 # s/\(extern \)\(.*\)/\1 "C" \2/
9 #
10 #  Replaces lines such as "extern void func(args);"
11 #  with "extern "C" void func(args);"
12
13 # /create_form_/d
14 #
15 #  Deletes lines containing "/create_form_/d"
16
17 # Rewrites                        as
18 # typedef struct {                struct someStruct {
19 #        ...                              ...
20 #        void *vdata;                     ...
21 #        char *cdata;             };
22 #        long  ldata;
23 #        ...
24 # } someStruct;
25 #
26 # This is detailed more closely below 
27
28 s/\(extern \)\(.*\)/\1 "C" \2/
29 /create_form_/d
30
31 /typedef struct {/,/} .*;/{  
32 # delete lines containing ...
33 /typedef struct {/d
34 /vdata/d
35 /cdata/d
36 /ldata/d
37
38 # copy remaining lines into the hold space
39 H
40
41 # rewrite "} someStruct;" as "struct someStruct {" and print
42 s/} \(.*\);/struct \1 {/p
43
44 # delete line from pattern space
45 d
46 }
47 # swap the hold space back into the pattern space and...
48 /^$/x
49 {
50 # rewrite "} someStruct;" as "};"
51 s/} \(.*\);/};/
52 }