1 # sed -f fdfixh.sed < somefile.h > fixedfile.h
3 # It contains the instructions that sed requires to manipulate
4 # the header files produced by fdesign into a form usable by LyX
6 s/\(extern \)\(.*\)/\1 "C" \2/
8 # Replaces lines such as "extern void func(args);"
9 # with "extern "C" void func(args);"
13 # Deletes lines containing "create_form_"
15 s,\(generated with fdesign\)\(.*\)\(\*\*/\),\1 \3,
17 # Deletes the dated signature so we can rebuild everything as often
18 # as we want without silly clashes due to the date.
21 # typedef struct { struct FD_form_xxx {
22 # FL_FORM *form_xxx; ~FD_form_xxx();
24 # char *cdata; FL_FORM *form;
29 # This is detailed more closely below
31 #Manipulate the struct
32 #=====================
33 /typedef struct {/,/} .*;/{
35 # delete lines containing ...
41 # rewrite "FL_FORM *form_xxx;" as "FL_FORM *form;"
42 s/FL_FORM \(.*\);/FL_FORM *form;/
44 # copy remaining lines into the hold space
47 # rewrite "} someStruct;" as "struct someStruct {" and print
50 s/} \(.*\);/struct \1 {/p
51 s/struct \(.*\) {/ ~\1();/p
54 # delete line from pattern space
57 # swap the hold space back into the pattern space and...
60 # rewrite "} someStruct;" as "};"