2 # This file is part of LyX, the document processor.
3 # Licence details can be found in the file COPYING.
7 # Full author contact details are available in file CREDITS
10 # sed -f fdfixh.sed somefile.h > fixedfile.h
12 # It contains the instructions that sed requires to manipulate
13 # the .h files produced by fdesign into a form usable by LyX
15 # Pretty formatting; remove trailing whitespace.
19 # Delete blank lines, "extern void" function declarations and fdesign comments.
24 /generated with fdesign/d
27 # Pretty formatting; add an empty line before "#endif"
31 # Immediately after line "#define FD_xxx_h_" that starts off the header file,
32 # #include "fdesign_base.h" and append the contents of file EXTERN_FUNCS.
33 # This latter is a sorted, unique list of any function declarations.
34 # The actual name of the file is inserted by the parent shell script.
38 #include "fdesign_base.h"\
44 # Rewrite FD_form_xxx as FD_xxx.
45 # This is done both for the structs and for the #define bounding the header.
46 s/\(.*\) FD_form_\(.*\)/\1 FD_\2/
49 # Rename the function create_form_form_xxx(void) as build_xxx(void *).
50 s/extern \(.*\) create_form_form_\(.*\)[(]void[)]/\1 build_\2(void *)/
53 # Manipulate the structs:
56 # typedef struct { struct FD_xxx : public FD_base {
57 # FL_FORM *form_xxx; FL_OBJECT * some_obj;
61 # FL_OBJECT *some_obj;
65 # This is detailed more closely below
67 # We retain only those lines in the struct that start " FL_OBJECT *",
68 # placing them in the hold space until the end of the struct is reached
69 # and we can ascertain the struct's name.
71 # All other lines are deleted:
78 # For all lines starting with FL_OBJECT...
81 # 1. Perform a little pretty formatting.
82 s/\(FL_OBJECT \*\)/\1 /
84 # 2. Append to the hold space and delete from the pattern space.
90 # The struct is ended by "} FD_xxx;", so now's the time to paste back the
91 # contents of the hold space.
94 # 1. Rewrite "} FD_xxx;" as "\nstruct FD_xxx : public FD_base {".
96 struct \1 : public FD_base {/
98 # 2. The hold space contains the FL_OBJECT lines, preceded by a new line.
99 # To get rid of this new line, we exchange the contents of the hold and
100 # pattern spaces, remove the new line and then exchange back.
105 # 3. Paste the contents of the hold space beneath the "struct FD_xxx" line.
106 # and empty the hold space
112 # 4. Close the struct and append an empty line.