]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/forms/c_str.sed
Rob's changes patch
[lyx.git] / src / frontends / xforms / forms / c_str.sed
1 # file c_str.sed
2 # This file is part of LyX, the document processor.
3 # Licence details can be found in the file COPYING.
4 #
5 # author Angus Leeming
6 #
7 # Full author contact details are available in file CREDITS
8
9 # This sed script is run on the .C file after the main fdfixc.sed has done
10 # its stuff. It ensures that any c_str variables inserted by fdfixc.sed
11 # are declared at the top of the appropriate function.
12 #
13 # We use a two-pass algorithm like this because a single pass results in
14 # convoluted sed.
15
16
17 # Initialise the hold space at the start of the function.
18 / \* build_/ {
19 h; d
20 }
21
22
23 # For all lines within the function...
24 /^{$/,/^}$/ {
25
26 # If it isn't the last line, append it to the hold space.
27 /^}$/!{
28 H; d
29 }
30
31 # If it is the last line, paste the contents of the hold space above it,
32 # seach for the string "c_str" and, if found, add its declaration to the top
33 # of the function.
34 /^}$/ {
35 x; G
36
37 /c_str/s/\(     FL_OBJECT \*\)/ char const * c_str;\
38 \1/
39 }
40
41 }