2000-08-14 05:24:35 +00:00
|
|
|
# sed -f fdfixh.sed < somefile.h > fixedfile.h
|
|
|
|
#
|
2000-07-14 07:52:03 +00:00
|
|
|
# It contains the instructions that sed requires to manipulate
|
|
|
|
# the header files produced by fdesign into a form usable by LyX
|
|
|
|
|
2000-08-14 05:24:35 +00:00
|
|
|
s/\(extern \)\(.*\)/\1 "C" \2/
|
2000-07-14 07:52:03 +00:00
|
|
|
#
|
|
|
|
# Replaces lines such as "extern void func(args);"
|
|
|
|
# with "extern "C" void func(args);"
|
|
|
|
|
2000-08-14 05:24:35 +00:00
|
|
|
/create_form_/d
|
|
|
|
#
|
|
|
|
# Deletes lines containing "create_form_"
|
|
|
|
|
|
|
|
s,\(generated with fdesign\)\(.*\)\(\*\*/\),\1 \3,
|
2000-07-14 07:52:03 +00:00
|
|
|
#
|
2000-08-14 05:24:35 +00:00
|
|
|
# Deletes the dated signature so we can rebuild everything as often
|
|
|
|
# as we want without silly clashes due to the date.
|
|
|
|
|
|
|
|
# Rewrites as
|
|
|
|
# typedef struct { struct FD_form_xxx {
|
|
|
|
# FL_FORM *form_xxx; ~FD_form_xxx();
|
|
|
|
# void *vdata;
|
|
|
|
# char *cdata; FL_FORM *form;
|
|
|
|
# long ldata; ...
|
|
|
|
# ... }
|
|
|
|
# } FD_form_xxx;
|
2000-07-14 07:52:03 +00:00
|
|
|
#
|
|
|
|
# This is detailed more closely below
|
|
|
|
|
2000-08-14 05:24:35 +00:00
|
|
|
#Manipulate the struct
|
|
|
|
#=====================
|
|
|
|
/typedef struct {/,/} .*;/{
|
2000-07-14 07:52:03 +00:00
|
|
|
|
|
|
|
# delete lines containing ...
|
2000-08-14 05:24:35 +00:00
|
|
|
/typedef struct {/d
|
|
|
|
/vdata/d
|
|
|
|
/cdata/d
|
|
|
|
/ldata/d
|
|
|
|
|
|
|
|
# rewrite "FL_FORM *form_xxx;" as "FL_FORM *form;"
|
|
|
|
s/FL_FORM \(.*\);/FL_FORM *form;/
|
2000-07-14 07:52:03 +00:00
|
|
|
|
|
|
|
# copy remaining lines into the hold space
|
2000-08-14 05:24:35 +00:00
|
|
|
H
|
2000-07-14 07:52:03 +00:00
|
|
|
|
2000-08-14 05:24:35 +00:00
|
|
|
# rewrite "} someStruct;" as "struct someStruct {" and print
|
|
|
|
# " ~someStruct();"
|
|
|
|
/} \(.*\);/{
|
|
|
|
s/} \(.*\);/struct \1 {/p
|
|
|
|
s/struct \(.*\) {/ ~\1();/p
|
|
|
|
}
|
2000-07-14 07:52:03 +00:00
|
|
|
|
|
|
|
# delete line from pattern space
|
2000-08-14 05:24:35 +00:00
|
|
|
d
|
2000-07-14 07:52:03 +00:00
|
|
|
}
|
|
|
|
# swap the hold space back into the pattern space and...
|
|
|
|
/^$/x
|
2000-08-14 05:24:35 +00:00
|
|
|
|
2000-07-14 07:52:03 +00:00
|
|
|
# rewrite "} someStruct;" as "};"
|
|
|
|
s/} \(.*\);/};/
|