mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
* development/tools/mkdoclinks.sh:
* development/tools/makeLyXsigc.sh: * development/tools/scgen.pl: remove obsolete files git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14637 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
425dfd3a24
commit
69c839dccf
@ -1,413 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
## Author: Allan Rae <rae@lyx.org>
|
|
||||||
## With bug fixes and improvements by Karl Nelson.
|
|
||||||
##
|
|
||||||
## Severely hacked version of the libsigc++/win32/makevc.sh script
|
|
||||||
## Builds the 'mini' libsigc++ distribution for use with LyX.
|
|
||||||
## Hopefully the generated distribution is generic enough for use by
|
|
||||||
## other apps also.
|
|
||||||
##
|
|
||||||
if test ! -f .cvsignore ; then
|
|
||||||
## could also test for acconfig.h since we need that too.
|
|
||||||
echo "Must be run in a CVS controlled source directory"
|
|
||||||
echo "You can't build the lyx-sigc distribution from a tarball"
|
|
||||||
## This just makes my life considerably easier.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test ! -f config.status ; then
|
|
||||||
echo "Must be run in configured source directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
version=`grep SIGC_VERSION config.status | awk -F% '{print $3}'`
|
|
||||||
package="libsigc++-$version"
|
|
||||||
tarfile="$package.tar.gz"
|
|
||||||
configure="$package/configure.in"
|
|
||||||
|
|
||||||
if test ! -f $tarfile ; then
|
|
||||||
echo "Must have dist file $tarfile"
|
|
||||||
echo "Try: make dist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Unpack distribution."
|
|
||||||
if test -d $package; then
|
|
||||||
rm -R $package
|
|
||||||
fi
|
|
||||||
tar xzf $tarfile --exclude CVS
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "Removing irrelevent or regeneratable files."
|
|
||||||
find $package -name "Makefile.in" | xargs rm
|
|
||||||
find $package -name "*.Makefile" | xargs rm
|
|
||||||
( cd $package;
|
|
||||||
cp ../acconfig.h sigc++;
|
|
||||||
mv [ACFT]* doc;
|
|
||||||
rm -f doc/riscos doc/ChangeLog;
|
|
||||||
mv ltdll.c sigc-config.in doc sigc++;
|
|
||||||
rm -Rf lyx win32 scripts tests riscos djgpp borland examples;
|
|
||||||
rm -Rf aclocal.m4 libsigc++.spec*;
|
|
||||||
cd sigc++/ ;
|
|
||||||
find macros -name "*.h.m4" | sed -e 's,macros/\(.*\)\.m4,\1,' | xargs rm;
|
|
||||||
rm -rf README scripts/README generator.h config )
|
|
||||||
|
|
||||||
|
|
||||||
echo "Make autogen.sh for testing"
|
|
||||||
( cd $package/sigc++;
|
|
||||||
cat > autogen.sh << EOF
|
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# You shouldn't need to use this script in your application unless it doesn't
|
|
||||||
# have its own equivalent.
|
|
||||||
#
|
|
||||||
libtoolize --automake
|
|
||||||
aclocal $ACLOCAL_FLAG
|
|
||||||
autoheader
|
|
||||||
automake --add-missing --foreign
|
|
||||||
autoconf
|
|
||||||
EOF
|
|
||||||
chmod a+x autogen.sh
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
echo "Limiting to Signal3"
|
|
||||||
# we only need up to Signal3
|
|
||||||
# NOTE: sigc++ needs 2 slots higher than the number of signals (see bind.h)
|
|
||||||
# Anyone feeling keen?
|
|
||||||
# How would you like to make this a parameter-controlled stripping of
|
|
||||||
# the headers instead?
|
|
||||||
#
|
|
||||||
for i in `ls $package/sigc++/macros/*.h.m4`; do
|
|
||||||
case $i in
|
|
||||||
$package/sigc++/macros/slot.h.m4)
|
|
||||||
sed < $i > $i.tmp \
|
|
||||||
-e '/.*ARGS(P,[6789]).*/d'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
sed < $i > $i.tmp \
|
|
||||||
-e '/.*ARGS(P,[456789]).*/d'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
rm -f $i
|
|
||||||
mv $i.tmp $i
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
echo "Changing <sigc++config.h> to <sigc++/sigc++config.h>"
|
|
||||||
#
|
|
||||||
# This change means that if the compiler can find <sigc++/slot.h> it can also
|
|
||||||
# find the sigc++config.h header which is internal to the library.
|
|
||||||
#
|
|
||||||
for i in `ls $package/sigc++/macros/*.h.m4 $package/sigc++/*.h`; do
|
|
||||||
sed < $i > $i.tmp \
|
|
||||||
-e 's%\(\(sigc++\)config.h\)%\2/\1%'
|
|
||||||
rm -f $i
|
|
||||||
mv $i.tmp $i
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
echo "Building application level config/"
|
|
||||||
mkdir $package/config
|
|
||||||
mv $package/sigc++.m4 $package/config
|
|
||||||
|
|
||||||
|
|
||||||
echo "Creating custom sigc++/configure.in"
|
|
||||||
## My sed doesn't seem to want to match newlines in scripts. As a result
|
|
||||||
## the first two scripts haven't been merged into one.
|
|
||||||
## These separate scripts are ordered approximately in the order in which
|
|
||||||
## they match in the unmodified configure.in.
|
|
||||||
##
|
|
||||||
## Note that you have to be very careful about quoting. Look at the second
|
|
||||||
## script for example: '\'', \\\ and \$
|
|
||||||
##
|
|
||||||
## Now for some explanation of what each script is supposed to change:
|
|
||||||
##
|
|
||||||
# -e 's/\(Nelson\)/\1\
|
|
||||||
### Modified by makeLyXsigc.sh (Allan Rae)/'
|
|
||||||
#
|
|
||||||
# Credit where credit is due.
|
|
||||||
#
|
|
||||||
# -e 's%\(AC_INIT\)(sigc++)%\1(slot.cc)\
|
|
||||||
#\
|
|
||||||
#AC_DEFUN(LYX_FIX_MAKEFILE_IN,[\
|
|
||||||
### modify Makefile.in if need be -- since we still use automake\
|
|
||||||
#for dir in \$srcdir \$srcdir/macros ; do\
|
|
||||||
#( cd \$dir ;\
|
|
||||||
# sed < Makefile.in > Makefile_tmp \\\
|
|
||||||
# -e '\''s/all\: all-redirect/all: all-@USE_INCLUDED_SIGC@\\\
|
|
||||||
#all-yes: all-redirect\\\
|
|
||||||
#all-no:/'\'' ;\
|
|
||||||
# mv Makefile_tmp Makefile.in )\
|
|
||||||
#done\
|
|
||||||
#])\
|
|
||||||
#\
|
|
||||||
#LYX_FIX_MAKEFILE_IN%'
|
|
||||||
#
|
|
||||||
# Change which file autoconf demands to be in the current directory.
|
|
||||||
# Add a way to not make anything in the sigc++ package when using an
|
|
||||||
# externally supplied library.
|
|
||||||
#
|
|
||||||
# -e 's%\(AUX_DIR(\)scripts%\1../config%'
|
|
||||||
#
|
|
||||||
# Use the applications auxilliary directory. Assumed to be ../config.
|
|
||||||
#
|
|
||||||
# -e 's%config/\(sigc++config\.h\)%\1%'
|
|
||||||
#
|
|
||||||
# Move sigc++config.h out of the now removed config/.
|
|
||||||
#
|
|
||||||
# -e 's/--dis\(able-threads\)/--en\1/' \
|
|
||||||
# -e 's;dis\(ables.*threading\);en\1;' \
|
|
||||||
# -e 's;\(^enable.*threads=\"\)yes;\1no;' \
|
|
||||||
#
|
|
||||||
# Don't use threads.
|
|
||||||
#
|
|
||||||
# -e '/.*\.spec.*/d' \
|
|
||||||
# -e '\%.*sigc++/Makefile.*%d' \
|
|
||||||
# -e '\%.*config/Makefile.*%d'
|
|
||||||
#
|
|
||||||
# Remove unnecessary files from the AC_OUTPUT list.
|
|
||||||
#
|
|
||||||
# -e 's,sigc++/,,g'
|
|
||||||
#
|
|
||||||
# No subdir sigc++. This also results in sigc++/macros -> macros.
|
|
||||||
#
|
|
||||||
# -e '\%.*tests/.*%d' \
|
|
||||||
# -e '\%.*examples/.*%d' \
|
|
||||||
# -e '\%.*scripts/.*%d'
|
|
||||||
#
|
|
||||||
# These directories have been completely removed and aren't relevent.
|
|
||||||
#
|
|
||||||
# -e 's/.*\(AM_DISABLE_\)STATIC/\1SHARED/' \
|
|
||||||
#
|
|
||||||
# We want to default to static libs. Although we still need to ensure that
|
|
||||||
# configure is forced to only produce static libs.
|
|
||||||
#
|
|
||||||
# -e 's/AM_MAINTAINER_MODE/AC_ARG_WITH([included-libsigc],\
|
|
||||||
# [ --without-included-libsigc\
|
|
||||||
# Use the libsigc++ installed on the system\
|
|
||||||
# Used when libsigc++ is bundled with applications],\
|
|
||||||
# [sigc_use_included_libsigc=$withval],\
|
|
||||||
# [sigc_use_included_libsigc=yes])\
|
|
||||||
#if test x$sigc_use_included_libsigc = xno; then\
|
|
||||||
# ## just change the setting for the Makefile\
|
|
||||||
# USE_INCLUDED_SIGC=no\
|
|
||||||
# AC_SUBST(USE_INCLUDED_SIGC)\
|
|
||||||
#else\
|
|
||||||
####\
|
|
||||||
#### This else..fi goes till the end of the file!\
|
|
||||||
####\
|
|
||||||
# USE_INCLUDED_SIGC=yes\
|
|
||||||
# AC_SUBST(USE_INCLUDED_SIGC)/'
|
|
||||||
#
|
|
||||||
# Kill two birds with the one stone. We want maintainer access as standard
|
|
||||||
# and we want to be able to choose between using this package or the full
|
|
||||||
# library installed on the local system. If using the latter option we don't
|
|
||||||
# have to run most of the configure script so we hide it in a conditional.
|
|
||||||
#
|
|
||||||
# -e 's/\(AC_OUTPUT.*\)/\
|
|
||||||
####\
|
|
||||||
#### This is the end of the massive if..then..else..fi\
|
|
||||||
####\
|
|
||||||
#fi\
|
|
||||||
#\
|
|
||||||
#\1/'
|
|
||||||
#
|
|
||||||
# Close the conditional introduced in the previous script.
|
|
||||||
#
|
|
||||||
( cd $package;
|
|
||||||
sed < configure.in > sigc++/configure.in \
|
|
||||||
-e 's/\(Nelson\)/\1\
|
|
||||||
## Modified by makeLyXsigc.sh (Allan Rae)/' \
|
|
||||||
-e 's%\(AC_INIT\)(sigc++)%\1(slot.cc)\
|
|
||||||
\
|
|
||||||
AC_DEFUN(LYX_FIX_MAKEFILE_IN,[\
|
|
||||||
## modify Makefile.in if need be -- since we still use automake\
|
|
||||||
for dir in \$srcdir \$srcdir/macros ; do\
|
|
||||||
( cd \$dir ;\
|
|
||||||
sed < Makefile.in > Makefile_tmp \\\
|
|
||||||
-e '\''s/all\: all-redirect/all: all-@USE_INCLUDED_SIGC@\\\
|
|
||||||
all-yes: all-redirect\\\
|
|
||||||
all-no:/'\'' ;\
|
|
||||||
mv Makefile_tmp Makefile.in )\
|
|
||||||
done\
|
|
||||||
])\
|
|
||||||
\
|
|
||||||
LYX_FIX_MAKEFILE_IN%' \
|
|
||||||
-e 's%\(AUX_DIR(\)scripts%\1../config%' \
|
|
||||||
-e 's%config/\(sigc++config\.h\)%\1%' \
|
|
||||||
-e 's/--dis\(able-threads\)/--en\1/' \
|
|
||||||
-e 's;dis\(ables.*threading\);en\1;' \
|
|
||||||
-e 's;\(^enable.*threads=\"\)yes;\1no;' \
|
|
||||||
-e '/.*\.spec.*/d' \
|
|
||||||
-e '\%.*sigc++/Makefile.*%d' \
|
|
||||||
-e '\%.*config/Makefile.*%d' \
|
|
||||||
-e 's,sigc++/,,g' \
|
|
||||||
-e '\%.*tests/.*%d' \
|
|
||||||
-e '\%.*examples/.*%d' \
|
|
||||||
-e '\%.*scripts/.*%d' \
|
|
||||||
-e 's/.*\(AM_DISABLE_\)STATIC/\1SHARED/' \
|
|
||||||
-e 's/AM_MAINTAINER_MODE/AC_ARG_WITH([included-libsigc],\
|
|
||||||
[ --without-included-libsigc\
|
|
||||||
Use the libsigc++ installed on the system\
|
|
||||||
Used when libsigc++ is bundled with applications],\
|
|
||||||
[sigc_use_included_libsigc=$withval],\
|
|
||||||
[sigc_use_included_libsigc=yes])\
|
|
||||||
if test x$sigc_use_included_libsigc = xno; then\
|
|
||||||
## just change the setting for the Makefile\
|
|
||||||
USE_INCLUDED_SIGC=no\
|
|
||||||
AC_SUBST(USE_INCLUDED_SIGC)\
|
|
||||||
else\
|
|
||||||
###\
|
|
||||||
### This else..fi goes till the end of the file!\
|
|
||||||
###\
|
|
||||||
USE_INCLUDED_SIGC=yes\
|
|
||||||
AC_SUBST(USE_INCLUDED_SIGC)/' \
|
|
||||||
-e 's/\(AC_OUTPUT.*\)/\
|
|
||||||
###\
|
|
||||||
### This is the end of the massive if..then..else..fi\
|
|
||||||
###\
|
|
||||||
fi\
|
|
||||||
\
|
|
||||||
\1/' )
|
|
||||||
|
|
||||||
echo "Modifying sigc++/Makefile.am"
|
|
||||||
#
|
|
||||||
# -e 's%\(SUBDIRS =\)\(.*\)config\(.*\)%\1\2\3\
|
|
||||||
#DISTCLEANFILES= *.orig *.rej *~ *.bak core \
|
|
||||||
#MAINTAINERCLEANFILES= \$(srcdir)/Makefile.in \$(srcdir)/configure \$(srcdir)/sigc++config* \$(srcdir)/stamp* \$(srcdir)/aclocal.m4 \$(srcdir)/acinclude.m4 \
|
|
||||||
#ETAGS_ARGS = --lang=c++%'
|
|
||||||
#
|
|
||||||
# We've removed the sigc++/config/ above now we just make sure automake knows.
|
|
||||||
# We also want maintainer-clean to actually remove stuff. Same for distclean.
|
|
||||||
#
|
|
||||||
# -e '/^INCLUDES/{s%\(dir)\)%\1/..%;}'
|
|
||||||
#
|
|
||||||
# All the headers are included with <sigc++/xxx.h> so we need an adjustment.
|
|
||||||
#
|
|
||||||
# -e '/^M4_DIR/{s/sigc++\///;}'
|
|
||||||
#
|
|
||||||
# In the mini-dist the macros are directly under the top_srcdir which in this
|
|
||||||
# case is sigc++/.
|
|
||||||
#
|
|
||||||
# -e '/^libsigc.*dir/d'
|
|
||||||
#
|
|
||||||
# Not installing the headers or the library.
|
|
||||||
#
|
|
||||||
# -e 's/^libsigcinclude/noinst/'
|
|
||||||
#
|
|
||||||
# Don't install the headers.
|
|
||||||
#
|
|
||||||
# -e 's/generator.h//'
|
|
||||||
#
|
|
||||||
# We don't need generator.h.
|
|
||||||
#
|
|
||||||
# -e 's/lib_//' \
|
|
||||||
# -e 's/\(LTLIB\)/noinst_\1/'
|
|
||||||
#
|
|
||||||
# These two lines make sure we don't install the library.
|
|
||||||
#
|
|
||||||
# -e '/EXTRA_DIST.*/d';
|
|
||||||
#
|
|
||||||
# We don't want the extra bits that libsigc++ does.
|
|
||||||
#
|
|
||||||
# -e 's/\(libsigc_la_SOURCES=\)\(.*\)/\1 $(BUILT_SOURCES)\2/' \
|
|
||||||
# -e '/%.h:/i\
|
|
||||||
#Makefile: $(BUILT_SOURCES)\
|
|
||||||
#'
|
|
||||||
# Make sure the built sources are built.
|
|
||||||
#
|
|
||||||
( cd $package/sigc++;
|
|
||||||
sed < Makefile.am > Makefile.tmp \
|
|
||||||
-e 's%\(SUBDIRS =\)\(.*\)config\(.*\)%\1\2\3\
|
|
||||||
DISTCLEANFILES= *.orig *.rej *~ *.bak core \
|
|
||||||
MAINTAINERCLEANFILES= \$(srcdir)/Makefile.in \$(srcdir)/configure \$(srcdir)/sigc++config* \$(srcdir)/stamp* \$(srcdir)/aclocal.m4 \$(srcdir)/acinclude.m4 \
|
|
||||||
ETAGS_ARGS = --lang=c++%' \
|
|
||||||
-e '/^INCLUDES/{s%\(dir)\)%\1/..%g;}' \
|
|
||||||
-e '/^M4_DIR/{s/sigc++\///;}' \
|
|
||||||
-e '/^libsigc.*dir/d' \
|
|
||||||
-e 's/^libsigcinclude/noinst/' \
|
|
||||||
-e 's/generator.h//' \
|
|
||||||
-e 's/lib_//' \
|
|
||||||
-e 's/\(LTLIB\)/noinst_\1/' \
|
|
||||||
-e '/EXTRA_DIST.*/d' \
|
|
||||||
-e 's/-version-info.*ION)//' \
|
|
||||||
-e 's/-release.*EASE)//' \
|
|
||||||
-e 's/\(libsigc_la_SOURCES=\)\(.*\)/\1 $(BUILT_SOURCES)\2/' \
|
|
||||||
-e '/%.h:/i\
|
|
||||||
Makefile: $(BUILT_SOURCES)\
|
|
||||||
';
|
|
||||||
rm -f Makefile.am ;
|
|
||||||
mv Makefile.tmp Makefile.am )
|
|
||||||
|
|
||||||
|
|
||||||
echo "Modifying sigc++/macros/Makefile.am"
|
|
||||||
#
|
|
||||||
# -e '/^m4includedir/d' \
|
|
||||||
# -e 's/^m4include/noinst/'
|
|
||||||
#
|
|
||||||
# We're not installing any of this.
|
|
||||||
#
|
|
||||||
# -e '$a\
|
|
||||||
#MAINTAINERCLEANFILES=\$(srcdir)/Makefile.in'
|
|
||||||
#
|
|
||||||
# Clean up.
|
|
||||||
#
|
|
||||||
( cd $package/sigc++/macros;
|
|
||||||
sed < Makefile.am > Makefile.tmp \
|
|
||||||
-e '/^m4includedir/d' \
|
|
||||||
-e 's/^m4include/noinst/' \
|
|
||||||
-e '$a\
|
|
||||||
MAINTAINERCLEANFILES=\$(srcdir)/Makefile.in' ;
|
|
||||||
rm -f Makefile.am ;
|
|
||||||
mv Makefile.tmp Makefile.am )
|
|
||||||
|
|
||||||
|
|
||||||
echo "Adding various .cvsignore"
|
|
||||||
( cd $package/sigc++;
|
|
||||||
cp ../../sigc++/.cvsignore . ;
|
|
||||||
cp ../../sigc++/macros/.cvsignore macros;
|
|
||||||
cp ../../doc/.cvsignore doc;
|
|
||||||
cat >> .cvsignore <<EOF
|
|
||||||
aclocal.m4
|
|
||||||
config.log
|
|
||||||
config.status
|
|
||||||
configure
|
|
||||||
libtool
|
|
||||||
sigc-config
|
|
||||||
stamp*
|
|
||||||
sigc++config.h
|
|
||||||
sigc++config.h.in
|
|
||||||
acinclude.m4
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
echo "Adding sigc++/DO_NOT_MODIFY_THESE_FILES"
|
|
||||||
( cd $package/sigc++;
|
|
||||||
cat > DO_NOT_MODIFY_THESE_FILES <<EOF
|
|
||||||
These files are all collected together from a checked out copy of the
|
|
||||||
libsigc++ CVS repository by the ../development/tools/makeLyXsigc.sh file.
|
|
||||||
Some of these files are modified by that script. If you need to fix a bug in
|
|
||||||
the code then you should try to get the latest CVS libsigc++ and regenerate
|
|
||||||
this entire subpackage. If the problem still persists it may be necessary to
|
|
||||||
modify the generation script.
|
|
||||||
|
|
||||||
If an error is found while porting to a new platform read the doc/requirements
|
|
||||||
file.
|
|
||||||
|
|
||||||
Remember to contact the LyX developers list if you are having problems.
|
|
||||||
Allan. (ARRae)
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
echo "Packing files."
|
|
||||||
( cd $package ;
|
|
||||||
chmod -R a+r sigc++ config ;
|
|
||||||
GZIP=--best tar chozf lyx-sigc++-$version.tar.gz sigc++ config )
|
|
||||||
mv $package/lyx*gz .
|
|
||||||
#rm -Rf $package
|
|
||||||
|
|
||||||
chmod a+r lyx-sigc++-$version.tar.gz
|
|
@ -1,70 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
# This script makes a bunch of symbolic links from the current directory
|
|
||||||
# to the one containing the LyX documentation.
|
|
||||||
|
|
||||||
USAGE () {
|
|
||||||
echo Usage: $0 dir_where_the_docs_are_found
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
USAGE
|
|
||||||
fi
|
|
||||||
|
|
||||||
DIR=$1
|
|
||||||
|
|
||||||
if [ ! -d ${DIR} ]; then
|
|
||||||
USAGE
|
|
||||||
fi
|
|
||||||
|
|
||||||
FILES=`ls ${DIR}/*.*`
|
|
||||||
|
|
||||||
N_LYXFILES=`echo "${FILES}" | grep ".lyx" | wc -l`
|
|
||||||
|
|
||||||
if [ ${N_LYXFILES} -eq 0 ]; then
|
|
||||||
echo ${DIR} contains NO lyx files!
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
EXAMPLE_FILE=`echo "${FILES}" | grep ".lyx" | sed -e '2,$d'`
|
|
||||||
PARSABLEDIR=`echo ${DIR} | sed 's/\//\\\\\//g'`
|
|
||||||
EXAMPLE_FILE=`echo ${EXAMPLE_FILE} | sed "s/${PARSABLEDIR}\///"`
|
|
||||||
|
|
||||||
echo ${DIR} contains ${N_LYXFILES} .lyx files, an example being ${EXAMPLE_FILE}
|
|
||||||
echo
|
|
||||||
echo "Would you like to generate links to the files in this dir? (Y/N) >N<"
|
|
||||||
read ANSWER
|
|
||||||
|
|
||||||
if [ "${ANSWER}" != "y" -a "${ANSWER}" != "Y" ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Would you like these file names in the .cvsignore file? (Y/N) >N<"
|
|
||||||
read ANSWER
|
|
||||||
|
|
||||||
CVSIGNORE=0
|
|
||||||
if [ "${ANSWER}" = "y" -o "${ANSWER}" = "Y" ]; then
|
|
||||||
CVSIGNORE=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Keep the original .cvsignore file safe
|
|
||||||
if [ ${CVSIGNORE} -eq 1 ]; then
|
|
||||||
if [ -r .cvsignore ]; then
|
|
||||||
if [ -r .cvsignore-safe ]; then
|
|
||||||
cp .cvsignore-safe .cvsignore
|
|
||||||
else
|
|
||||||
cp .cvsignore .cvsignore-safe
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo .cvsignore-safe > .cvsignore
|
|
||||||
echo '*.lyx' >> .cvsignore
|
|
||||||
echo '*.eps' >> .cvsignore
|
|
||||||
fi
|
|
||||||
|
|
||||||
for FILE in ${FILES}
|
|
||||||
do
|
|
||||||
DESTFILE=`echo ${FILE} | sed "s/${PARSABLEDIR}\///"`
|
|
||||||
ln -fs ${FILE} ${DESTFILE}
|
|
||||||
done
|
|
@ -1,207 +0,0 @@
|
|||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
% Prolog
|
|
||||||
%
|
|
||||||
% Shortcut generator v1.0
|
|
||||||
%
|
|
||||||
% This program is known to work with SWI-Prolog version 2.9.5, which you
|
|
||||||
% can find at
|
|
||||||
%
|
|
||||||
% http://www.swi.psy.uva.nl/usr/jan/SWI-Prolog.html
|
|
||||||
%
|
|
||||||
% Purpose: to generate shortcuts for labels in menus and dialogs that are
|
|
||||||
% guaranteed to be unique within a set of labels. The shortcuts are
|
|
||||||
% generated in a prioritized manner, such that characters at the beginning
|
|
||||||
% of words are preferred to characters in the middle of words.
|
|
||||||
%
|
|
||||||
% You might find this progam useful if you are translating LyX.
|
|
||||||
%
|
|
||||||
% Don't use this file in the development/tools-directory; copy it
|
|
||||||
% somewhere out of the LyX-distribution tree, unless you're improving
|
|
||||||
% the tool itself. The input is to be hard-coded into the file and that
|
|
||||||
% may cause unnecessary garbage to appear in any patch you're putting
|
|
||||||
% together.
|
|
||||||
%
|
|
||||||
% The labels are supposed to be entered at "LABELS" below,
|
|
||||||
% and you get one solution (hopefully) with "go.".
|
|
||||||
% If there are no solutions, the Prolog-interpretator will reply with a
|
|
||||||
% "No."
|
|
||||||
%
|
|
||||||
% You can get all candidate solutions with "all.", but this requires
|
|
||||||
% lots of memory.
|
|
||||||
%
|
|
||||||
% You can inspect the correspondance between the original strings and
|
|
||||||
% the prioritized ones with "inspect.".
|
|
||||||
%
|
|
||||||
% I have no idea what the big O for the algorithm is, but I suspect it's
|
|
||||||
% rather steep.
|
|
||||||
% Asger speculates that the algorithm is O(n^m), where n is the cardinality
|
|
||||||
% of the candidate sets, while m is the number of sets. Since we do an
|
|
||||||
% exhausitive search, this has to be the case.
|
|
||||||
|
|
||||||
% Predicates:
|
|
||||||
|
|
||||||
% print out one solution, i.e. a set of label/shortcut's
|
|
||||||
% writef/2 may be specific for SWI-prolog
|
|
||||||
show_one_alternative([]).
|
|
||||||
show_one_alternative([L/_/C|Rest]):-
|
|
||||||
writef('%s|#%n\n',[L,C]),
|
|
||||||
show_one_alternative(Rest).
|
|
||||||
|
|
||||||
% printout predicate for "all."
|
|
||||||
show_solutions([]).
|
|
||||||
show_solutions([H|T]):-
|
|
||||||
write('-----------\n'),
|
|
||||||
show_one_alternative(H),
|
|
||||||
show_solutions(T).
|
|
||||||
|
|
||||||
% print out correspondance between original strings and prioritized ones.
|
|
||||||
show_priority([]).
|
|
||||||
show_priority([L/P/_|Rest]):-
|
|
||||||
writef('%s|%n\n',[L,P]),
|
|
||||||
show_priority(Rest).
|
|
||||||
|
|
||||||
% character is from a set of allowed characters.
|
|
||||||
% "AZaz09"=[65, 90, 97, 122, 48, 57]
|
|
||||||
allowed_char(C):-
|
|
||||||
C >= 97, C =< 122. % a-z
|
|
||||||
allowed_char(C):-
|
|
||||||
C >= 65, C =< 90. % A-Z
|
|
||||||
allowed_char(C):-
|
|
||||||
C >= 48, C =< 57. % 0-9
|
|
||||||
|
|
||||||
% turn lowercase to uppercase; alt-<key> is case insensitive
|
|
||||||
uppercase(L,U):-
|
|
||||||
(L >= 97, L =< 122) -> U is L - 32;
|
|
||||||
U is L.
|
|
||||||
|
|
||||||
% possible_char/2: Gets all characters in label, one after one.
|
|
||||||
possible_char(_/Label,Char):-
|
|
||||||
member(Char,Label). % the character is part of the label
|
|
||||||
|
|
||||||
% prepare_labels/2: Prepares all labels. Constructs a new list of pairs
|
|
||||||
% where the original string is coupled with the prepared string.
|
|
||||||
prepare_labels([], []).
|
|
||||||
prepare_labels([H1|T1], [H1/H2|T2]):-
|
|
||||||
prepare_string(H1, H2),
|
|
||||||
prepare_labels(T1, T2).
|
|
||||||
|
|
||||||
% prepare_string/2: Prepares a string by removing duplicate characters,
|
|
||||||
% prioritizing initials letters, removing illegal characters and turning
|
|
||||||
% lowercase to uppercase characters.
|
|
||||||
prepare_string(Label,Result):-
|
|
||||||
string_to_list(Label,List1), % make a list of the string
|
|
||||||
prioritize(List1, List2), % Prioritize string
|
|
||||||
filter_chars(List2, List3), % Filter out unwanted chars
|
|
||||||
unique(List3, Result). % Remove duplicates
|
|
||||||
|
|
||||||
% prioritize/2: This predicate rearranges a list, such that
|
|
||||||
% chars at the beginning of words are put first in the list.
|
|
||||||
% i.e. prioritize("Foo bar", "Fboo ar")" is true.
|
|
||||||
prioritize(L1,L2):-
|
|
||||||
initial_chars(L1, I), % Find all initial characters
|
|
||||||
subtract(L1, I, Rest), % and the others
|
|
||||||
append(I, Rest, L2). % and we have the result.
|
|
||||||
|
|
||||||
% initial_chars/2: Returns a list of characters that appear at the beginning
|
|
||||||
% of words. i.e. initial_chars("Foo bar", "Fb") is true.
|
|
||||||
initial_chars([],[]).
|
|
||||||
initial_chars([A|T1], [A|T3]):-
|
|
||||||
rest_after_space(T1, T2), % Return rest of list after space
|
|
||||||
initial_chars(T2, T3).
|
|
||||||
|
|
||||||
% rest_after_space/2: Returns the list after the first space.
|
|
||||||
% i.e. "rest_after_space("Foo bar", "bar") is true.
|
|
||||||
rest_after_space([], []).
|
|
||||||
rest_after_space([32, H1|T1], [H1|T1]):- !.
|
|
||||||
rest_after_space([_|T1], T2):-
|
|
||||||
rest_after_space(T1, T2).
|
|
||||||
|
|
||||||
% filterchars/2: Filter outs non-allowed characters from list, and turns
|
|
||||||
% lowercase to uppercase.
|
|
||||||
filter_chars([], []).
|
|
||||||
filter_chars([H|T1], [C|T2]):-
|
|
||||||
allowed_char(H), !, uppercase(H, C),
|
|
||||||
filter_chars(T1, T2).
|
|
||||||
filter_chars([_|T1], T2):-
|
|
||||||
filter_chars(T1, T2).
|
|
||||||
|
|
||||||
% unique/2: This predicate removes duplicate characters without reordering.
|
|
||||||
% i.e. unique("Foo bar", "Fo bar") is true.
|
|
||||||
unique([], []).
|
|
||||||
unique([H|T1], [H|T3]):-
|
|
||||||
delete(T1, H, T2), % Remove duplicates.
|
|
||||||
unique(T2,T3).
|
|
||||||
|
|
||||||
% working_shortcuts/2 instantiates Char in the first argument for a whole
|
|
||||||
% menu/dialog.
|
|
||||||
working_shortcuts([],_). % end of the list
|
|
||||||
|
|
||||||
working_shortcuts([Label/Char|Rest],Used):-
|
|
||||||
possible_char(Label,Char), % i.e. part of the label string
|
|
||||||
\+member(Char,Used), % not used by any other shortcut
|
|
||||||
working_shortcuts(Rest,[Char|Used]). % and all the other labels have
|
|
||||||
% shortcuts
|
|
||||||
% The prolog motor will backtrack up and down the list of labels
|
|
||||||
% until it finds a set with unique characters for each label
|
|
||||||
|
|
||||||
|
|
||||||
% Label strings goes here.
|
|
||||||
% Just cut&paste the strings from the LyX-source, and remove any
|
|
||||||
% control sequences for menus. We could add a couple of predicates to scan
|
|
||||||
% a file, but re-consulting this file takes only a fraction of a second
|
|
||||||
% so I didn't bother to add a fancy user interface here. The solution is
|
|
||||||
% printed like <label> '|#' <key>, allthough this isn't nessecarily useful,
|
|
||||||
% for menus for instance.
|
|
||||||
%
|
|
||||||
% The characters are picked with priority from left to right within
|
|
||||||
% strings, and the labels are listed in falling priority.
|
|
||||||
% If you want a certain label to have a certain shortcut, try adding that
|
|
||||||
% character in front of the string (like 'Exit' -> 'xExit') and move it
|
|
||||||
% higher up in the list.
|
|
||||||
% If this doesn't work, replace the string with only that character
|
|
||||||
% ('Exit' -> 'x'). If you get a "No." then, you lose.
|
|
||||||
% Use "inspect." to inspect the resulting priotized strings.
|
|
||||||
|
|
||||||
% LABELS
|
|
||||||
lab(Labels):-
|
|
||||||
Strings = [
|
|
||||||
"New...",
|
|
||||||
"New from template...",
|
|
||||||
"Open...",
|
|
||||||
"Close",
|
|
||||||
"Save",
|
|
||||||
"Save As...",
|
|
||||||
"Revert to saved",
|
|
||||||
"View dvi",
|
|
||||||
"View PostScript",
|
|
||||||
"Update dvi",
|
|
||||||
"Update PostScript",
|
|
||||||
"Print...",
|
|
||||||
"Fax...",
|
|
||||||
"Export",
|
|
||||||
"Exit"
|
|
||||||
% NB, no comma on the last one. Easy to forget.
|
|
||||||
],
|
|
||||||
prepare_labels(Strings, Str),
|
|
||||||
bagof(L/_,member(L,Str),Labels).
|
|
||||||
|
|
||||||
% Inspect mapping between original string and prioritized ones.
|
|
||||||
inspect:-
|
|
||||||
lab(Labels),
|
|
||||||
show_priority(Labels).
|
|
||||||
|
|
||||||
% Find ALL solutions (they are often legion - don't bother ;)
|
|
||||||
all:- % May (probably, on large dialogs) run out on memory.
|
|
||||||
lab(Labels),
|
|
||||||
setof(Labels,working_shortcuts(Labels,[]),Solutions),
|
|
||||||
show_solutions(Solutions).
|
|
||||||
|
|
||||||
% Find one solution
|
|
||||||
one:-
|
|
||||||
lab(Labels),
|
|
||||||
working_shortcuts(Labels,[]),
|
|
||||||
show_one_alternative(Labels).
|
|
||||||
|
|
||||||
% Entry point.
|
|
||||||
go:-
|
|
||||||
one.
|
|
Loading…
Reference in New Issue
Block a user