POSIX-compliant sed.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7743 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-09-15 08:12:13 +00:00
parent 74f08e13ea
commit 14dcb1b93a
4 changed files with 23 additions and 8 deletions

View File

@ -1,3 +1,7 @@
2003-09-15 Angus Leeming <leeming@lyx.org>
* forms/fdfix[ch].sed, tmp_str,sed: POSIX-compliant sed.
2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org> 2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
* several files: change Assert to BOOST_ASSERT * several files: change Assert to BOOST_ASSERT

View File

@ -23,7 +23,7 @@ s/[ ]*$//
# Remove '#include "forms.h"'. It is replace by a macro in fdfix.sh. # Remove '#include "forms.h"'. It is replace by a macro in fdfix.sh.
/^#include \"forms\.h\"/d /^#include "forms\.h"/d
# Pretty formatting; replace all leading whitespace with a tab # Pretty formatting; replace all leading whitespace with a tab

View File

@ -70,7 +70,9 @@ s/extern \(.*\) create_form_form_\(.*\)[(]void[)]/\1 build_\2(void *)/
# All other lines are deleted: # All other lines are deleted:
/^typedef struct/d /^typedef struct/d
/^ /{ /FL_OBJECT/!d; } /^ /{
/FL_OBJECT/!d
}
# For all lines starting with FL_OBJECT... # For all lines starting with FL_OBJECT...
@ -80,7 +82,8 @@ s/extern \(.*\) create_form_form_\(.*\)[(]void[)]/\1 build_\2(void *)/
s/\(FL_OBJECT \*\)/\1 / s/\(FL_OBJECT \*\)/\1 /
# 2. Append to the hold space and delete from the pattern space. # 2. Append to the hold space and delete from the pattern space.
H; d H
d
} }
@ -95,11 +98,16 @@ struct \1 : public FD_base {/
# 2. The hold space contains the FL_OBJECT lines, preceded by a new line. # 2. The hold space contains the FL_OBJECT lines, preceded by a new line.
# To get rid of this new line, we exchange the contents of the hold and # To get rid of this new line, we exchange the contents of the hold and
# pattern spaces, remove the new line and then exchange back. # pattern spaces, remove the new line and then exchange back.
x; s/^\n//; x x
s/^\n//
x
# 3. Paste the contents of the hold space beneath the "struct FD_xxx" line. # 3. Paste the contents of the hold space beneath the "struct FD_xxx" line.
# and empty the hold space # and empty the hold space
G; h; s/.*//; x G
h
s/.*//
x
# 4. Close the struct and append an empty line. # 4. Close the struct and append an empty line.
a\ a\

View File

@ -16,7 +16,8 @@
# Initialise the hold space at the start of the function. # Initialise the hold space at the start of the function.
/ \* build_/ { / \* build_/ {
h; d h
d
} }
@ -25,14 +26,16 @@ h; d
# If it isn't the last line, append it to the hold space. # If it isn't the last line, append it to the hold space.
/^}$/!{ /^}$/!{
H; d H
d
} }
# If it is the last line, paste the contents of the hold space above it, # If it is the last line, paste the contents of the hold space above it,
# seach for the string "tmp_str" and, if found, add its declaration to the top # seach for the string "tmp_str" and, if found, add its declaration to the top
# of the function. # of the function.
/^}$/ { /^}$/ {
x; G x
G
/tmp_str/s/\( FL_OBJECT \*\)/ string tmp_str;\ /tmp_str/s/\( FL_OBJECT \*\)/ string tmp_str;\
\1/ \1/