From: Angus Leeming Date: Mon, 19 May 2003 19:12:30 +0000 (+0000) Subject: Use "string tmp_str" rather than "char const * c_str" in the xforms autogenerated... X-Git-Tag: 1.6.10~16809 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=d2bfb9fa0f2a4f90a45fc2ad82c0a05ac8a91179;p=features.git Use "string tmp_str" rather than "char const * c_str" in the xforms autogenerated files. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6980 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 67003a7b57..787df107e3 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,14 @@ +2003-05-19 Angus Leeming + + * forms/c_str.sed: removed. Renamed as: + * forms/tmp_str.sed + + * forms/Makefile.am (EXTRA_DIST): add tmp_str.sed. + ($(libfdesign_la_SOURCES)): make it depend on tmp_str.sed. + + * forms/fdfix.sh: + * forms/fdfixc.sed: + * forms/tmp_str.sed: s/c_str\([^(]\)/tmp_str\1/. 2003-05-15 André Pönitz diff --git a/src/frontends/xforms/forms/Makefile.am b/src/frontends/xforms/forms/Makefile.am index c037dfb530..1ef3041717 100644 --- a/src/frontends/xforms/forms/Makefile.am +++ b/src/frontends/xforms/forms/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/config/common.am MAINTAINERCLEANFILES += *.C *.h *.c -EXTRA_DIST = fdfixc.sed fdfixh.sed fdfix.sh README $(SRCS) +EXTRA_DIST = fdfixc.sed fdfixh.sed fdfix.sh tmp_str.sed README $(SRCS) # For (forms_fwd.h, forms_gettext.h) and LString.h, respectively. INCLUDES = -I$(srcdir)/.. -I$(top_srcdir)/src -I.. @@ -52,7 +52,7 @@ SRCS = form_aboutlyx.fd \ nodist_libfdesign_la_SOURCES = $(SRCS:.fd=.C) $(SRCS:.fd=.h) # This is a trick so that the actual .la file never gets build, # so we do not need to use diskspace and time for it. -# It is only getting linked into libxforms.la any way. +# It is only getting linked into libxforms.la anyway. libfdesign_la_LINK = touch libfdesign.la # These are used to generate the .[Ch] files from the .fd ones. @@ -60,8 +60,5 @@ SHELL = /bin/sh SCRIPT = $(srcdir)/fdfix.sh SUFFIXES = .fd -# Make the .Ch files dependent on the fdfix files. -$(libfdesign_la_SOURCES): $(srcdir)/fdfix.sh $(srcdir)/fdfix[ch].sed - -%.C: %.fd +%.C: %.fd $(srcdir)/fdfix.sh $(srcdir)/fdfix[ch].sed $(srcdir)/tmp_str.sed $(SHELL) $(SCRIPT) $< diff --git a/src/frontends/xforms/forms/c_str.sed b/src/frontends/xforms/forms/c_str.sed deleted file mode 100644 index b01f1f7e37..0000000000 --- a/src/frontends/xforms/forms/c_str.sed +++ /dev/null @@ -1,41 +0,0 @@ -# file c_str.sed -# This file is part of LyX, the document processor. -# Licence details can be found in the file COPYING. -# -# author Angus Leeming -# -# Full author contact details are available in file CREDITS - -# This sed script is run on the .C file after the main fdfixc.sed has done -# its stuff. It ensures that any c_str variables inserted by fdfixc.sed -# are declared at the top of the appropriate function. -# -# We use a two-pass algorithm like this because a single pass results in -# convoluted sed. - - -# Initialise the hold space at the start of the function. -/ \* build_/ { -h; d -} - - -# For all lines within the function... -/^{$/,/^}$/ { - -# If it isn't the last line, append it to the hold space. -/^}$/!{ -H; d -} - -# If it is the last line, paste the contents of the hold space above it, -# seach for the string "c_str" and, if found, add its declaration to the top -# of the function. -/^}$/ { -x; G - -/c_str/s/\( FL_OBJECT \*\)/ char const * c_str;\ -\1/ -} - -} diff --git a/src/frontends/xforms/forms/fdfix.sh b/src/frontends/xforms/forms/fdfix.sh index fb0df9db26..9450d0245f 100644 --- a/src/frontends/xforms/forms/fdfix.sh +++ b/src/frontends/xforms/forms/fdfix.sh @@ -149,9 +149,9 @@ grep combox ${CIN} > /dev/null && sed -f ${FDFIXC} < ${CIN} >> ${TMP} -# Pass 2. Ensure that any c_str variables inserted by fdfixc.sed +# Pass 2. Ensure that any tmp_str variables inserted by fdfixc.sed # are declared at the top of the appropriate function. -FDFIXC=${DIRNAME}/c_str.sed +FDFIXC=${DIRNAME}/tmp_str.sed sed -f ${FDFIXC} < ${TMP} > ${COUT} rm -f ${TMP} diff --git a/src/frontends/xforms/forms/fdfixc.sed b/src/frontends/xforms/forms/fdfixc.sed index 9171accce7..47928dfe78 100644 --- a/src/frontends/xforms/forms/fdfixc.sed +++ b/src/frontends/xforms/forms/fdfixc.sed @@ -106,13 +106,13 @@ s/CHOICE/COMBOX/ # change so: # fdui->counter_zoom = obj = fl_add_counter(...,"Zoom %|#Z"); # becomes -# c_str = _("Zoom %|#Z"); -# fdui->counter_zoom = obj = fl_add_counter(...,idex(c_str).c_str()); -# fl_set_button_shortcut(obj,scex(c_str).c_str(),1); +# tmp_str = _("Zoom %|#Z"); +# fdui->counter_zoom = obj = fl_add_counter(...,idex(tmp_str).c_str()); +# fl_set_button_shortcut(obj,scex(tmp_str).c_str(),1); -/fl_add.*".*[|].*"/s/fdui\(.*\)"\(.*\)".*/c_str = _("\2");\ - fdui\1idex(c_str).c_str());\ - fl_set_button_shortcut(obj,scex(c_str).c_str(),1);/ +/fl_add.*".*[|].*"/s/fdui\(.*\)"\(.*\)".*/tmp_str = _("\2");\ + fdui\1idex(tmp_str).c_str());\ + fl_set_button_shortcut(obj,scex(tmp_str).c_str(),1);/ # gettext will get confused if the string contains a "%" unless the line is diff --git a/src/frontends/xforms/forms/tmp_str.sed b/src/frontends/xforms/forms/tmp_str.sed new file mode 100644 index 0000000000..60e0fad2a1 --- /dev/null +++ b/src/frontends/xforms/forms/tmp_str.sed @@ -0,0 +1,41 @@ +# file tmp_str.sed +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Angus Leeming +# +# Full author contact details are available in file CREDITS + +# This sed script is run on the .C file after the main fdfixc.sed has done +# its stuff. It ensures that any tmp_str variables inserted by fdfixc.sed +# are declared at the top of the appropriate function. +# +# We use a two-pass algorithm like this because a single pass results in +# convoluted sed. + + +# Initialise the hold space at the start of the function. +/ \* build_/ { +h; d +} + + +# For all lines within the function... +/^{$/,/^}$/ { + +# If it isn't the last line, append it to the hold space. +/^}$/!{ +H; d +} + +# 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 +# of the function. +/^}$/ { +x; G + +/tmp_str/s/\( FL_OBJECT \*\)/ string tmp_str;\ +\1/ +} + +}