diff --git a/Makefile.in b/Makefile.in index bce0b0c21c..3ea821c0fd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1499,6 +1499,7 @@ debian-dist: debian-native-dist debian-msw-dirs MSW_DIST mv $(DISTDIR) $(WXDIR)/../wxwindows$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER)-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER) debian-native-dist: @GUIDIST@ UNIV_DIST MANUAL_DIST PYTHON_DIST + cp $(SRCDIR)/files.lst $(DISTDIR)/src debian-msw-dirs: mkdir $(DISTDIR)/include/wx/msw diff --git a/acinclude.m4 b/acinclude.m4 index 47508a0fbc..b818c04013 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -19,7 +19,7 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([WX_PATH_FIND_INCLUDES], [ ac_find_includes= -for ac_dir in $1; +for ac_dir in $1 /usr/include; do if test -f "$ac_dir/$2"; then ac_find_includes=$ac_dir @@ -35,7 +35,7 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([WX_PATH_FIND_LIBRARIES], [ ac_find_libraries= -for ac_dir in $1; +for ac_dir in $1 /usr/lib; do for ac_extension in a so sl dylib; do if test -f "$ac_dir/lib$2.$ac_extension"; then @@ -51,13 +51,17 @@ dnl Path to include, already defined dnl --------------------------------------------------------------------------- AC_DEFUN([WX_INCLUDE_PATH_EXIST], [ - ac_path_to_include=$1 - echo "$2" | grep "\-I$1" > /dev/null - result=$? - if test $result = 0; then + dnl never add -I/usr/include to the CPPFLAGS + if test "x$1" = "x/usr/include"; then ac_path_to_include="" else - ac_path_to_include=" -I$1" + echo "$2" | grep "\-I$1" > /dev/null + result=$? + if test $result = 0; then + ac_path_to_include="" + else + ac_path_to_include=" -I$1" + fi fi ]) diff --git a/aclocal.m4 b/aclocal.m4 index 808ecf4a94..8c128f04e8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -31,7 +31,7 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([WX_PATH_FIND_INCLUDES], [ ac_find_includes= -for ac_dir in $1; +for ac_dir in $1 /usr/include; do if test -f "$ac_dir/$2"; then ac_find_includes=$ac_dir @@ -47,7 +47,7 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([WX_PATH_FIND_LIBRARIES], [ ac_find_libraries= -for ac_dir in $1; +for ac_dir in $1 /usr/lib; do for ac_extension in a so sl dylib; do if test -f "$ac_dir/lib$2.$ac_extension"; then @@ -63,13 +63,17 @@ dnl Path to include, already defined dnl --------------------------------------------------------------------------- AC_DEFUN([WX_INCLUDE_PATH_EXIST], [ - ac_path_to_include=$1 - echo "$2" | grep "\-I$1" > /dev/null - result=$? - if test $result = 0; then + dnl never add -I/usr/include to the CPPFLAGS + if test "x$1" = "x/usr/include"; then ac_path_to_include="" else - ac_path_to_include=" -I$1" + echo "$2" | grep "\-I$1" > /dev/null + result=$? + if test $result = 0; then + ac_path_to_include="" + else + ac_path_to_include=" -I$1" + fi fi ]) diff --git a/configure b/configure index 53b06bcd3a..bcdb596730 100755 --- a/configure +++ b/configure @@ -1239,11 +1239,11 @@ EOF USE_BSD=1 USE_OPENBSD=1 cat >> confdefs.h <<\EOF -#define __FREEBSD__ 1 +#define __OPENBSD__ 1 EOF cat >> confdefs.h <<\EOF -#define __OPENBSD__ 1 +#define __BSD__ 1 EOF DEFAULT_DEFAULT_wxUSE_GTK=1 @@ -1252,11 +1252,11 @@ EOF USE_BSD=1 USE_NETBSD=1 cat >> confdefs.h <<\EOF -#define __FREEBSD__ 1 +#define __NETBSD__ 1 EOF cat >> confdefs.h <<\EOF -#define __NETBSD__ 1 +#define __BSD__ 1 EOF DEFAULT_DEFAULT_wxUSE_GTK=1 @@ -1305,7 +1305,7 @@ EOF USE_AIX=1 USE_SYSV=1 USE_SVR4=1 - SO_SUFFIX=a + SO_SUFFIX=a cat >> confdefs.h <<\EOF #define __AIX__ 1 EOF @@ -10719,13 +10719,26 @@ if eval "test \"`echo '$''{'wx_cv_sizeof_wchar_t'+set}'`\" = set"; then else if test "$cross_compiling" = yes; then - wx_cv_sizeof_wchar_t=4 + + case "${host}" in + *-pc-msdosdjgpp ) + wx_cv_sizeof_wchar_t=0 + ;; + * ) + wx_cv_sizeof_wchar_t=4 + ;; + esac + else cat > conftest.$ac_ext < @@ -10745,7 +10758,7 @@ else } EOF -if { (eval echo configure:10749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then wx_cv_sizeof_wchar_t=`cat conftestval` else @@ -10777,13 +10790,13 @@ if test "$enable_largefile" != no; then wx_largefile=no echo $ac_n "checking for _FILE_OFFSET_BITS value needed for large files""... $ac_c" 1>&6 -echo "configure:10781: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo "configure:10794: checking for _FILE_OFFSET_BITS value needed for large files" >&5 if eval "test \"`echo '$''{'ac_cv_sys_file_offset_bits'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -10794,7 +10807,7 @@ typedef struct { ; return 0; } EOF -if { (eval echo configure:10798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_file_offset_bits=64 else @@ -10821,13 +10834,13 @@ EOF if test "x$wx_largefile" != "xyes"; then echo $ac_n "checking for _LARGE_FILES value needed for large files""... $ac_c" 1>&6 -echo "configure:10825: checking for _LARGE_FILES value needed for large files" >&5 +echo "configure:10838: checking for _LARGE_FILES value needed for large files" >&5 if eval "test \"`echo '$''{'ac_cv_sys_large_files'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -10838,7 +10851,7 @@ typedef struct { ; return 0; } EOF -if { (eval echo configure:10842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10855: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_large_files=1 else @@ -10865,7 +10878,7 @@ EOF fi echo $ac_n "checking if large file support is available""... $ac_c" 1>&6 -echo "configure:10869: checking if large file support is available" >&5 +echo "configure:10882: checking if large file support is available" >&5 if test "x$wx_largefile" = "xyes"; then cat >> confdefs.h <<\EOF #define HAVE_LARGEFILE_SUPPORT 1 @@ -10886,14 +10899,14 @@ if test "x$wx_largefile" = "xyes"; then fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:10890: checking whether byte ordering is bigendian" >&5 +echo "configure:10903: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -10904,11 +10917,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:10908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -10919,7 +10932,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:10923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10936: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -10939,7 +10952,7 @@ if test "$cross_compiling" = yes; then ac_cv_c_bigendian=unknown else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -10980,7 +10993,7 @@ fi echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:10984: checking how to run the C++ preprocessor" >&5 +echo "configure:10997: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -10993,12 +11006,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11002: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11015: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -11042,17 +11055,17 @@ cross_compiling=$ac_cv_prog_cxx_cross do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11046: checking for $ac_hdr" >&5 +echo "configure:11059: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11056: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11100,7 +11113,7 @@ cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking if C++ compiler supports bool""... $ac_c" 1>&6 -echo "configure:11104: checking if C++ compiler supports bool" >&5 +echo "configure:11117: checking if C++ compiler supports bool" >&5 if eval "test \"`echo '$''{'wx_cv_cpp_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11115,7 +11128,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11144: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_cpp_bool=yes @@ -11165,7 +11178,7 @@ EOF echo $ac_n "checking if C++ compiler supports the explicit keyword""... $ac_c" 1>&6 -echo "configure:11169: checking if C++ compiler supports the explicit keyword" >&5 +echo "configure:11182: checking if C++ compiler supports the explicit keyword" >&5 if eval "test \"`echo '$''{'wx_cv_explicit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11180,7 +11193,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11225: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_explicit=no else @@ -11313,8 +11326,7 @@ SEARCH_INCLUDE="\ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ - /usr/openwin/share/include \ - /usr/include" + /usr/openwin/share/include" SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s/include/lib/g` " @@ -11369,13 +11381,13 @@ rm -f confcache if test "$USE_LINUX" = 1; then echo $ac_n "checking for glibc 2.1 or later""... $ac_c" 1>&6 -echo "configure:11373: checking for glibc 2.1 or later" >&5 +echo "configure:11385: checking for glibc 2.1 or later" >&5 if eval "test \"`echo '$''{'wx_cv_lib_glibc21'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -11386,7 +11398,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:11390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11402: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_lib_glibc21=yes @@ -11434,17 +11446,17 @@ EOF if test "$wxUSE_REGEX" = "sys" -o "$wxUSE_REGEX" = "yes" ; then ac_safe=`echo "regex.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for regex.h""... $ac_c" 1>&6 -echo "configure:11438: checking for regex.h" >&5 +echo "configure:11450: checking for regex.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11448: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11463,12 +11475,12 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then for ac_func in regcomp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:11467: checking for $ac_func" >&5 +echo "configure:11479: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11549,17 +11561,17 @@ EOF if test "$wxUSE_ZLIB" = "sys" -o "$wxUSE_ZLIB" = "yes" ; then ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for zlib.h""... $ac_c" 1>&6 -echo "configure:11553: checking for zlib.h" >&5 +echo "configure:11565: checking for zlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11575: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11576,7 +11588,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6 -echo "configure:11580: checking for deflate in -lz" >&5 +echo "configure:11592: checking for deflate in -lz" >&5 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11584,7 +11596,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11660,17 +11672,17 @@ EOF if test "$wxUSE_LIBPNG" = "sys" -o "$wxUSE_LIBPNG" = "yes" ; then ac_safe=`echo "png.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for png.h""... $ac_c" 1>&6 -echo "configure:11664: checking for png.h" >&5 +echo "configure:11676: checking for png.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11674: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11687,7 +11699,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for png_check_sig in -lpng""... $ac_c" 1>&6 -echo "configure:11691: checking for png_check_sig in -lpng" >&5 +echo "configure:11703: checking for png_check_sig in -lpng" >&5 ac_lib_var=`echo png'_'png_check_sig | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11695,7 +11707,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpng -lz -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11769,12 +11781,12 @@ EOF if test "$wxUSE_MGL" != 1 ; then if test "$wxUSE_LIBJPEG" = "sys" -o "$wxUSE_LIBJPEG" = "yes" ; then echo $ac_n "checking for jpeglib.h""... $ac_c" 1>&6 -echo "configure:11773: checking for jpeglib.h" >&5 +echo "configure:11785: checking for jpeglib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_jpeglib_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11802: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_jpeglib_h=yes else @@ -11804,7 +11816,7 @@ fi if test "$ac_cv_header_jpeglib_h" = "yes"; then echo $ac_n "checking for jpeg_read_header in -ljpeg""... $ac_c" 1>&6 -echo "configure:11808: checking for jpeg_read_header in -ljpeg" >&5 +echo "configure:11820: checking for jpeg_read_header in -ljpeg" >&5 ac_lib_var=`echo jpeg'_'jpeg_read_header | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11812,7 +11824,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ljpeg $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11875,17 +11887,17 @@ EOF if test "$wxUSE_LIBTIFF" = "sys" -o "$wxUSE_LIBTIFF" = "yes" ; then ac_safe=`echo "tiffio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tiffio.h""... $ac_c" 1>&6 -echo "configure:11879: checking for tiffio.h" >&5 +echo "configure:11891: checking for tiffio.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11901: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11902,7 +11914,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for TIFFError in -ltiff""... $ac_c" 1>&6 -echo "configure:11906: checking for TIFFError in -ltiff" >&5 +echo "configure:11918: checking for TIFFError in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFError | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11910,7 +11922,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltiff -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11976,17 +11988,17 @@ if test "$USE_WIN32" = 1 ; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11980: checking for $ac_hdr" >&5 +echo "configure:11992: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12002: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12014,17 +12026,17 @@ done ac_safe=`echo "windows.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for windows.h""... $ac_c" 1>&6 -echo "configure:12018: checking for windows.h" >&5 +echo "configure:12030: checking for windows.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12050,13 +12062,13 @@ fi echo $ac_n "checking if w32api has good enough MSIE support""... $ac_c" 1>&6 -echo "configure:12054: checking if w32api has good enough MSIE support" >&5 +echo "configure:12066: checking if w32api has good enough MSIE support" >&5 if eval "test \"`echo '$''{'wx_cv_w32api_win32_ie'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -12072,7 +12084,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12076: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:12088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_w32api_win32_ie=yes @@ -12139,7 +12151,7 @@ if test "$wxUSE_GUI" = "yes"; then if test "$wxUSE_GTK" = 1; then echo $ac_n "checking for GTK+ version""... $ac_c" 1>&6 -echo "configure:12143: checking for GTK+ version" >&5 +echo "configure:12155: checking for GTK+ version" >&5 gtk_version_cached=1 if eval "test \"`echo '$''{'wx_cv_lib_gtk'+set}'`\" = set"; then @@ -12180,7 +12192,7 @@ fi # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:12184: checking for $ac_word" >&5 +echo "configure:12196: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12228,7 +12240,7 @@ fi min_gtk_version=2.0.0 echo $ac_n "checking for GTK+ - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:12232: checking for GTK+ - version >= $min_gtk_version" >&5 +echo "configure:12244: checking for GTK+ - version >= $min_gtk_version" >&5 if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs @@ -12263,7 +12275,7 @@ echo "configure:12232: checking for GTK+ - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -12338,7 +12350,7 @@ main () } EOF -if { (eval echo configure:12342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -12372,7 +12384,7 @@ fi CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat > conftest.$ac_ext < @@ -12382,7 +12394,7 @@ int main() { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } EOF -if { (eval echo configure:12386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK+ or finding the wrong" @@ -12466,7 +12478,7 @@ fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:12470: checking for $ac_word" >&5 +echo "configure:12482: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12501,7 +12513,7 @@ fi min_gtk_version=1.2.7 echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:12505: checking for GTK - version >= $min_gtk_version" >&5 +echo "configure:12517: checking for GTK - version >= $min_gtk_version" >&5 no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes @@ -12524,7 +12536,7 @@ echo "configure:12505: checking for GTK - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -12602,7 +12614,7 @@ main () } EOF -if { (eval echo configure:12606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -12636,7 +12648,7 @@ fi CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat > conftest.$ac_ext < @@ -12646,7 +12658,7 @@ int main() { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } EOF -if { (eval echo configure:12650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" @@ -12737,7 +12749,7 @@ fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:12741: checking for $ac_word" >&5 +echo "configure:12753: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12772,7 +12784,7 @@ fi min_gtk_version=1.2.3 echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:12776: checking for GTK - version >= $min_gtk_version" >&5 +echo "configure:12788: checking for GTK - version >= $min_gtk_version" >&5 no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes @@ -12795,7 +12807,7 @@ echo "configure:12776: checking for GTK - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -12873,7 +12885,7 @@ main () } EOF -if { (eval echo configure:12877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -12907,7 +12919,7 @@ fi CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat > conftest.$ac_ext < @@ -12917,7 +12929,7 @@ int main() { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } EOF -if { (eval echo configure:12921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" @@ -12998,7 +13010,7 @@ equivalent variable and GTK+ is version 1.2.3 or above. # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:13002: checking for $ac_word" >&5 +echo "configure:13014: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -13042,19 +13054,19 @@ fi PKG_CONFIG_MIN_VERSION=0.9.0 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then echo $ac_n "checking for pangoft2""... $ac_c" 1>&6 -echo "configure:13046: checking for pangoft2" >&5 +echo "configure:13058: checking for pangoft2" >&5 if $PKG_CONFIG --exists "pangoft2" ; then echo "$ac_t""yes" 1>&6 succeeded=yes echo $ac_n "checking PANGOFT2_CFLAGS""... $ac_c" 1>&6 -echo "configure:13053: checking PANGOFT2_CFLAGS" >&5 +echo "configure:13065: checking PANGOFT2_CFLAGS" >&5 PANGOFT2_CFLAGS=`$PKG_CONFIG --cflags "pangoft2"` echo "$ac_t""$PANGOFT2_CFLAGS" 1>&6 echo $ac_n "checking PANGOFT2_LIBS""... $ac_c" 1>&6 -echo "configure:13058: checking PANGOFT2_LIBS" >&5 +echo "configure:13070: checking PANGOFT2_LIBS" >&5 PANGOFT2_LIBS=`$PKG_CONFIG --libs "pangoft2"` echo "$ac_t""$PANGOFT2_LIBS" 1>&6 else @@ -13098,7 +13110,7 @@ echo "configure:13058: checking PANGOFT2_LIBS" >&5 GUIDIST=GTK_DIST echo $ac_n "checking for gdk_im_open in -lgdk""... $ac_c" 1>&6 -echo "configure:13102: checking for gdk_im_open in -lgdk" >&5 +echo "configure:13114: checking for gdk_im_open in -lgdk" >&5 ac_lib_var=`echo gdk'_'gdk_im_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13106,7 +13118,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgdk $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13144,7 +13156,7 @@ fi if test "$wxUSE_MGL" = 1; then echo $ac_n "checking for SciTech MGL library""... $ac_c" 1>&6 -echo "configure:13148: checking for SciTech MGL library" >&5 +echo "configure:13160: checking for SciTech MGL library" >&5 if test "x$MGL_ROOT" = x ; then echo "$ac_t""not found" 1>&6 { echo "configure: error: Cannot find MGL library. Make sure MGL_ROOT is set." 1>&2; exit 1; } @@ -13192,7 +13204,7 @@ echo "configure:13148: checking for SciTech MGL library" >&5 if test "$wxUSE_MICROWIN" = 1; then echo $ac_n "checking for MicroWindows""... $ac_c" 1>&6 -echo "configure:13196: checking for MicroWindows" >&5 +echo "configure:13208: checking for MicroWindows" >&5 if test "x$MICROWINDOWS" = x ; then echo "$ac_t""not found" 1>&6 { echo "configure: error: Cannot find MicroWindows library. Make sure MICROWINDOWS is set." 1>&2; exit 1; } @@ -13224,7 +13236,7 @@ echo "configure:13196: checking for MicroWindows" >&5 # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:13228: checking for X" >&5 +echo "configure:13240: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -13286,12 +13298,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13360,14 +13372,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -13473,17 +13485,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:13477: checking whether -R must be followed by a space" >&5 +echo "configure:13489: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -13499,14 +13511,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -13538,7 +13550,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:13542: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:13554: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13546,7 +13558,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13579,7 +13591,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:13583: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:13595: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13587,7 +13599,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13627,12 +13639,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:13631: checking for gethostbyname" >&5 +echo "configure:13643: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -13676,7 +13688,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:13680: checking for gethostbyname in -lnsl" >&5 +echo "configure:13692: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13684,7 +13696,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13725,12 +13737,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:13729: checking for connect" >&5 +echo "configure:13741: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -13774,7 +13786,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:13778: checking for connect in -lsocket" >&5 +echo "configure:13790: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13782,7 +13794,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13817,12 +13829,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:13821: checking for remove" >&5 +echo "configure:13833: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -13866,7 +13878,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:13870: checking for remove in -lposix" >&5 +echo "configure:13882: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13874,7 +13886,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13909,12 +13921,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:13913: checking for shmat" >&5 +echo "configure:13925: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -13958,7 +13970,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:13962: checking for shmat in -lipc" >&5 +echo "configure:13974: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13966,7 +13978,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14010,7 +14022,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:14014: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:14026: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14018,7 +14030,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14065,7 +14077,7 @@ fi if test "$wxUSE_NANOX" = "yes"; then echo $ac_n "checking for MicroWindows/NanoX distribution""... $ac_c" 1>&6 -echo "configure:14069: checking for MicroWindows/NanoX distribution" >&5 +echo "configure:14081: checking for MicroWindows/NanoX distribution" >&5 if test "x$MICROWIN" = x ; then echo "$ac_t""not found" 1>&6 { echo "configure: error: Cannot find MicroWindows library. Make sure MICROWIN is set." 1>&2; exit 1; } @@ -14080,10 +14092,10 @@ EOF xpm_link= echo $ac_n "checking for Xpm library""... $ac_c" 1>&6 -echo "configure:14084: checking for Xpm library" >&5 +echo "configure:14096: checking for Xpm library" >&5 ac_find_libraries= -for ac_dir in $SEARCH_LIB; +for ac_dir in $SEARCH_LIB /usr/lib; do for ac_extension in a so sl dylib; do if test -f "$ac_dir/libXpm.$ac_extension"; then @@ -14112,7 +14124,7 @@ EOF echo "$ac_t""found at $ac_find_libraries" 1>&6 else cat > conftest.$ac_ext < @@ -14124,7 +14136,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14128: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* xpm_link=" -lXpm" @@ -14166,17 +14178,17 @@ rm -f conftest* if test "$wxUSE_WINE" = 1; then ac_safe=`echo "windows.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for windows.h""... $ac_c" 1>&6 -echo "configure:14170: checking for windows.h" >&5 +echo "configure:14182: checking for windows.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:14180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:14192: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -14203,10 +14215,10 @@ fi xpm_link= echo $ac_n "checking for Xpm library""... $ac_c" 1>&6 -echo "configure:14207: checking for Xpm library" >&5 +echo "configure:14219: checking for Xpm library" >&5 ac_find_libraries= -for ac_dir in $SEARCH_LIB; +for ac_dir in $SEARCH_LIB /usr/lib; do for ac_extension in a so sl dylib; do if test -f "$ac_dir/libXpm.$ac_extension"; then @@ -14231,10 +14243,10 @@ EOF mesa_link= echo $ac_n "checking for Mesa library""... $ac_c" 1>&6 -echo "configure:14235: checking for Mesa library" >&5 +echo "configure:14247: checking for Mesa library" >&5 ac_find_libraries= -for ac_dir in $SEARCH_LIB; +for ac_dir in $SEARCH_LIB /usr/lib; do for ac_extension in a so sl dylib; do if test -f "$ac_dir/libMesaGL.$ac_extension"; then @@ -14281,17 +14293,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:14285: checking whether -R must be followed by a space" >&5 +echo "configure:14297: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -14307,14 +14319,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -14346,7 +14358,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:14350: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:14362: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14354,7 +14366,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14387,7 +14399,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:14391: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:14403: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14395,7 +14407,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14435,12 +14447,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:14439: checking for gethostbyname" >&5 +echo "configure:14451: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -14484,7 +14496,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:14488: checking for gethostbyname in -lnsl" >&5 +echo "configure:14500: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14492,7 +14504,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14533,12 +14545,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:14537: checking for connect" >&5 +echo "configure:14549: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14577: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -14582,7 +14594,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:14586: checking for connect in -lsocket" >&5 +echo "configure:14598: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14590,7 +14602,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14625,12 +14637,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:14629: checking for remove" >&5 +echo "configure:14641: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -14674,7 +14686,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:14678: checking for remove in -lposix" >&5 +echo "configure:14690: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14682,7 +14694,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14717,12 +14729,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:14721: checking for shmat" >&5 +echo "configure:14733: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -14766,7 +14778,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:14770: checking for shmat in -lipc" >&5 +echo "configure:14782: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14774,7 +14786,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14818,7 +14830,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:14822: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:14834: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14826,7 +14838,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14866,16 +14878,16 @@ fi { echo "configure: error: X11 not found" 1>&2; exit 1; } fi - GUI_TK_LIBRARY="$X_LIBS" - TOOLKIT_INCLUDE="$X_CFLAGS" + GUI_TK_LIBRARY=`echo $X_LIBS | sed 's/ -LNONE//'` + TOOLKIT_INCLUDE=`echo $X_CFLAGS | sed 's/ -INONE//'` AFMINSTALL=afminstall COMPILED_X_PROGRAM=0 echo $ac_n "checking for Motif/Lesstif headers""... $ac_c" 1>&6 -echo "configure:14876: checking for Motif/Lesstif headers" >&5 +echo "configure:14888: checking for Motif/Lesstif headers" >&5 ac_find_includes= -for ac_dir in $SEARCH_INCLUDE; +for ac_dir in $SEARCH_INCLUDE /usr/include; do if test -f "$ac_dir/Xm/Xm.h"; then ac_find_includes=$ac_dir @@ -14886,19 +14898,22 @@ for ac_dir in $SEARCH_INCLUDE; if test "$ac_find_includes" != "" ; then echo "$ac_t""found in $ac_find_includes" 1>&6 - ac_path_to_include=$ac_find_includes - echo "$TOOLKIT_INCLUDE" | grep "\-I$ac_find_includes" > /dev/null - result=$? - if test $result = 0; then + if test "x$ac_find_includes" = "x/usr/include"; then ac_path_to_include="" else - ac_path_to_include=" -I$ac_find_includes" + echo "$TOOLKIT_INCLUDE" | grep "\-I$ac_find_includes" > /dev/null + result=$? + if test $result = 0; then + ac_path_to_include="" + else + ac_path_to_include=" -I$ac_find_includes" + fi fi TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE$ac_path_to_include" else cat > conftest.$ac_ext < @@ -14910,7 +14925,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14914: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14929: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""found in default search path" 1>&6 @@ -14931,10 +14946,10 @@ rm -f conftest* if test "$COMPILED_X_PROGRAM" = 0; then echo $ac_n "checking for Motif/Lesstif library""... $ac_c" 1>&6 -echo "configure:14935: checking for Motif/Lesstif library" >&5 +echo "configure:14950: checking for Motif/Lesstif library" >&5 ac_find_libraries= -for ac_dir in $SEARCH_LIB; +for ac_dir in $SEARCH_LIB /usr/lib; do for ac_extension in a so sl dylib; do if test -f "$ac_dir/libXm.$ac_extension"; then @@ -14962,7 +14977,7 @@ for ac_dir in $SEARCH_LIB; CFLAGS="$CFLAGS $TOOLKIT_INCLUDE" cat > conftest.$ac_ext < @@ -14974,7 +14989,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""found in default search path" 1>&6 @@ -14998,10 +15013,10 @@ rm -f conftest* xpm_link= echo $ac_n "checking for Xpm library""... $ac_c" 1>&6 -echo "configure:15002: checking for Xpm library" >&5 +echo "configure:15017: checking for Xpm library" >&5 ac_find_libraries= -for ac_dir in $SEARCH_LIB; +for ac_dir in $SEARCH_LIB /usr/lib; do for ac_extension in a so sl dylib; do if test -f "$ac_dir/libXpm.$ac_extension"; then @@ -15034,7 +15049,7 @@ EOF CFLAGS="$CFLAGS $TOOLKIT_INCLUDE" cat > conftest.$ac_ext < @@ -15046,7 +15061,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:15050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:15065: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* xpm_link=" -lXpm" @@ -15073,7 +15088,7 @@ rm -f conftest* fi echo $ac_n "checking if we need -lXp and/or -lSM -lICE""... $ac_c" 1>&6 -echo "configure:15077: checking if we need -lXp and/or -lSM -lICE" >&5 +echo "configure:15092: checking if we need -lXp and/or -lSM -lICE" >&5 libp_link="" libsm_ice_link="" libs_found=0 @@ -15087,7 +15102,7 @@ echo "configure:15077: checking if we need -lXp and/or -lSM -lICE" >&5 CFLAGS="$CFLAGS $TOOLKIT_INCLUDE" cat > conftest.$ac_ext < @@ -15102,7 +15117,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:15106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:15121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* libp_link="$libp" @@ -15245,17 +15260,17 @@ if test "$wxUSE_OPENGL" = "yes"; then else ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6 -echo "configure:15249: checking for GL/gl.h" >&5 +echo "configure:15264: checking for GL/gl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:15259: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:15274: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -15273,10 +15288,10 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for -lGL""... $ac_c" 1>&6 -echo "configure:15277: checking for -lGL" >&5 +echo "configure:15292: checking for -lGL" >&5 ac_find_libraries= -for ac_dir in $SEARCH_LIB; +for ac_dir in $SEARCH_LIB /usr/lib; do for ac_extension in a so sl dylib; do if test -f "$ac_dir/libGL.$ac_extension"; then @@ -15306,10 +15321,10 @@ for ac_dir in $SEARCH_LIB; else echo "$ac_t""no" 1>&6 echo $ac_n "checking for -lMesaGL""... $ac_c" 1>&6 -echo "configure:15310: checking for -lMesaGL" >&5 +echo "configure:15325: checking for -lMesaGL" >&5 ac_find_libraries= -for ac_dir in $SEARCH_LIB; +for ac_dir in $SEARCH_LIB /usr/lib; do for ac_extension in a so sl dylib; do if test -f "$ac_dir/libMesaGL.$ac_extension"; then @@ -15388,6 +15403,7 @@ fi WX_LIBRARY="wx_${TOOLCHAIN_NAME}" WX_LIBRARY_GL="wx_${TOOLCHAIN_NAME_GL}" +WX_LIBRARY_BASENAME="wx_${TOOLKIT_DIR}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}" WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}.${SO_SUFFIX}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}" WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY_GL}.${SO_SUFFIX}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}" @@ -15482,13 +15498,13 @@ if test "$wxUSE_SHARED" = "yes"; then *-*-linux* ) if test "$GCC" != "yes"; then echo $ac_n "checking for Intel compiler""... $ac_c" 1>&6 -echo "configure:15486: checking for Intel compiler" >&5 +echo "configure:15502: checking for Intel compiler" >&5 if eval "test \"`echo '$''{'wx_cv_prog_icc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:15519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_prog_icc=yes else @@ -15548,10 +15564,11 @@ echo "$ac_t""$wx_cv_prog_icc" 1>&6 ;; *-*-aix* ) - # Extract the first word of "makeC++SharedLib", so it can be a program name with args. + if test "$GCC" != "yes"; then + # Extract the first word of "makeC++SharedLib", so it can be a program name with args. set dummy makeC++SharedLib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:15555: checking for $ac_word" >&5 +echo "configure:15572: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AIX_CXX_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -15579,11 +15596,11 @@ else fi - SHARED_LD="$(AIX_CXX_LD) -p 0 -o" + SHARED_LD="$(AIX_CXX_LD) -p 0 -o" + fi ;; *-*-cygwin* | *-*-mingw32* ) - WX_LIBRARY_IMPORTLIB="${WX_LIBRARY_NAME_SHARED}.a" SHARED_LD="${CXX} -shared -Wl,--out-implib,lib/${WX_LIBRARY_IMPORTLIB} -o" @@ -15603,9 +15620,14 @@ fi SHARED_LD="${LD} -shared -o" ;; + *-*-irix* ) + if test "$GCC" != "yes"; then + PIC_FLAG="-KPIC" + fi + ;; + *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \ *-*-sunos4* | \ - *-*-irix5* | *-*-irix6* | \ *-*-osf* | \ *-*-dgux5* | \ *-*-sysv5* ) @@ -15659,7 +15681,7 @@ if test "$wxUSE_MAC" = 1; then # Extract the first word of "Rez", so it can be a program name with args. set dummy Rez; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:15663: checking for $ac_word" >&5 +echo "configure:15685: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RESCOMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -15689,7 +15711,7 @@ fi # Extract the first word of "DeRez", so it can be a program name with args. set dummy DeRez; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:15693: checking for $ac_word" >&5 +echo "configure:15715: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DEREZ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -15732,12 +15754,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:15736: checking for ANSI C header files" >&5 +echo "configure:15758: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -15745,7 +15767,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:15749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:15771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -15762,7 +15784,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -15780,7 +15802,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -15801,7 +15823,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -15812,7 +15834,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:15816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:15838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -15836,12 +15858,12 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:15840: checking for mode_t" >&5 +echo "configure:15862: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -15869,12 +15891,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:15873: checking for off_t" >&5 +echo "configure:15895: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -15902,12 +15924,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:15906: checking for pid_t" >&5 +echo "configure:15928: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -15935,12 +15957,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:15939: checking for size_t" >&5 +echo "configure:15961: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -15968,12 +15990,12 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:15972: checking for uid_t in sys/types.h" >&5 +echo "configure:15994: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -16011,12 +16033,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking if size_t is unsigned int""... $ac_c" 1>&6 -echo "configure:16015: checking if size_t is unsigned int" >&5 +echo "configure:16037: checking if size_t is unsigned int" >&5 if eval "test \"`echo '$''{'wx_cv_size_t_is_uint'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -16029,7 +16051,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:16033: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_size_t_is_uint=no else @@ -16052,12 +16074,12 @@ EOF else echo $ac_n "checking if size_t is unsigned long""... $ac_c" 1>&6 -echo "configure:16056: checking if size_t is unsigned long" >&5 +echo "configure:16078: checking if size_t is unsigned long" >&5 if eval "test \"`echo '$''{'wx_cv_size_t_is_ulong'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -16070,7 +16092,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:16074: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_size_t_is_ulong=no else @@ -16104,13 +16126,13 @@ cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking for pw_gecos in struct passwd""... $ac_c" 1>&6 -echo "configure:16108: checking for pw_gecos in struct passwd" >&5 +echo "configure:16130: checking for pw_gecos in struct passwd" >&5 if eval "test \"`echo '$''{'wx_cv_struct_pw_gecos'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -16121,7 +16143,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:16125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16147: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_struct_pw_gecos=yes @@ -16161,12 +16183,12 @@ EOF for ac_func in wcslen do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:16165: checking for $ac_func" >&5 +echo "configure:16187: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -16217,7 +16239,7 @@ done if test "$WCSLEN_FOUND" = 0; then if test "$TOOLKIT" = "MSW"; then echo $ac_n "checking for wcslen in -lmsvcrt""... $ac_c" 1>&6 -echo "configure:16221: checking for wcslen in -lmsvcrt" >&5 +echo "configure:16243: checking for wcslen in -lmsvcrt" >&5 ac_lib_var=`echo msvcrt'_'wcslen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -16225,7 +16247,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmsvcrt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -16258,7 +16280,7 @@ fi else echo $ac_n "checking for wcslen in -lw""... $ac_c" 1>&6 -echo "configure:16262: checking for wcslen in -lw" >&5 +echo "configure:16284: checking for wcslen in -lw" >&5 ac_lib_var=`echo w'_'wcslen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -16266,7 +16288,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lw $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -16313,12 +16335,12 @@ EOF for ac_func in wcsrtombs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:16317: checking for $ac_func" >&5 +echo "configure:16339: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -16381,12 +16403,12 @@ cross_compiling=$ac_cv_prog_cxx_cross for ac_func in vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:16385: checking for $ac_func" >&5 +echo "configure:16407: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -16441,12 +16463,12 @@ if test "$wxUSE_UNICODE" = yes; then for ac_func in fputwc wprintf vswprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:16445: checking for $ac_func" >&5 +echo "configure:16467: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -16497,16 +16519,16 @@ fi done echo $ac_n "checking for _vsnwprintf""... $ac_c" 1>&6 -echo "configure:16501: checking for _vsnwprintf" >&5 +echo "configure:16523: checking for _vsnwprintf" >&5 cat > conftest.$ac_ext < int main() { &_vsnwprintf; ; return 0; } EOF -if { (eval echo configure:16510: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -16558,7 +16580,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:16562: checking for iconv" >&5 +echo "configure:16584: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -16566,7 +16588,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext < #include @@ -16576,7 +16598,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:16580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -16588,7 +16610,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext < #include @@ -16598,7 +16620,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:16602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -16619,12 +16641,12 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking if iconv needs const""... $ac_c" 1>&6 -echo "configure:16623: checking if iconv needs const" >&5 +echo "configure:16645: checking if iconv needs const" >&5 if eval "test \"`echo '$''{'wx_cv_func_iconv_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -16643,7 +16665,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:16647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16669: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_iconv_const="no" else @@ -16688,12 +16710,12 @@ if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then for ac_func in sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:16692: checking for $ac_func" >&5 +echo "configure:16714: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -16757,13 +16779,13 @@ cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking for sa_handler type""... $ac_c" 1>&6 -echo "configure:16761: checking for sa_handler type" >&5 +echo "configure:16783: checking for sa_handler type" >&5 if eval "test \"`echo '$''{'wx_cv_type_sa_handler'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -16775,7 +16797,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:16779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_sa_handler=int @@ -16812,12 +16834,12 @@ fi for ac_func in mkstemp mktemp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:16816: checking for $ac_func" >&5 +echo "configure:16838: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -16866,12 +16888,12 @@ done echo $ac_n "checking for statfs""... $ac_c" 1>&6 -echo "configure:16870: checking for statfs" >&5 +echo "configure:16892: checking for statfs" >&5 if eval "test \"`echo '$''{'wx_cv_func_statfs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_statfs=yes @@ -16919,12 +16941,12 @@ EOF else echo $ac_n "checking for statvfs""... $ac_c" 1>&6 -echo "configure:16923: checking for statvfs" >&5 +echo "configure:16945: checking for statvfs" >&5 if eval "test \"`echo '$''{'wx_cv_func_statvfs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -16940,7 +16962,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:16944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_statvfs=yes @@ -16974,12 +16996,12 @@ if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then for ac_func in fcntl flock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:16978: checking for $ac_func" >&5 +echo "configure:17000: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -17036,12 +17058,12 @@ fi for ac_func in timegm do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:17040: checking for $ac_func" >&5 +echo "configure:17062: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -17092,12 +17114,12 @@ done for ac_func in putenv setenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:17096: checking for $ac_func" >&5 +echo "configure:17118: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -17167,12 +17189,12 @@ if test "$HAVE_SOME_SLEEP_FUNC" != 1; then for ac_func in nanosleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:17171: checking for $ac_func" >&5 +echo "configure:17193: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -17220,7 +17242,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for nanosleep in -lposix4""... $ac_c" 1>&6 -echo "configure:17224: checking for nanosleep in -lposix4" >&5 +echo "configure:17246: checking for nanosleep in -lposix4" >&5 ac_lib_var=`echo posix4'_'nanosleep | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -17228,7 +17250,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -17267,12 +17289,12 @@ else for ac_func in usleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:17271: checking for $ac_func" >&5 +echo "configure:17293: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -17338,12 +17360,12 @@ fi for ac_func in uname gethostname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:17342: checking for $ac_func" >&5 +echo "configure:17364: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -17403,12 +17425,12 @@ cross_compiling=$ac_cv_prog_cxx_cross for ac_func in strtok_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:17407: checking for $ac_func" >&5 +echo "configure:17429: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -17471,12 +17493,12 @@ INET_LINK= for ac_func in inet_addr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:17475: checking for $ac_func" >&5 +echo "configure:17497: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -17524,7 +17546,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_addr in -lnsl""... $ac_c" 1>&6 -echo "configure:17528: checking for inet_addr in -lnsl" >&5 +echo "configure:17550: checking for inet_addr in -lnsl" >&5 ac_lib_var=`echo nsl'_'inet_addr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -17532,7 +17554,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -17562,7 +17584,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_addr in -lresolv""... $ac_c" 1>&6 -echo "configure:17566: checking for inet_addr in -lresolv" >&5 +echo "configure:17588: checking for inet_addr in -lresolv" >&5 ac_lib_var=`echo resolv'_'inet_addr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -17570,7 +17592,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -17600,7 +17622,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_addr in -lsocket""... $ac_c" 1>&6 -echo "configure:17604: checking for inet_addr in -lsocket" >&5 +echo "configure:17626: checking for inet_addr in -lsocket" >&5 ac_lib_var=`echo socket'_'inet_addr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -17608,7 +17630,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -17655,12 +17677,12 @@ done for ac_func in inet_aton do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:17659: checking for $ac_func" >&5 +echo "configure:17681: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -17708,7 +17730,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_aton in -l$INET_LINK""... $ac_c" 1>&6 -echo "configure:17712: checking for inet_aton in -l$INET_LINK" >&5 +echo "configure:17734: checking for inet_aton in -l$INET_LINK" >&5 ac_lib_var=`echo $INET_LINK'_'inet_aton | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -17716,7 +17738,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$INET_LINK $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -17862,18 +17884,18 @@ if test "$TOOLKIT" != "MSW"; then case $flag in none) echo $ac_n "checking whether pthreads work without any flags""... $ac_c" 1>&6 -echo "configure:17866: checking whether pthreads work without any flags" >&5 +echo "configure:17888: checking whether pthreads work without any flags" >&5 ;; -*) echo $ac_n "checking whether pthreads work with $flag""... $ac_c" 1>&6 -echo "configure:17871: checking whether pthreads work with $flag" >&5 +echo "configure:17893: checking whether pthreads work with $flag" >&5 THREADS_CFLAGS="$flag" ;; *) echo $ac_n "checking for the pthreads library -l$flag""... $ac_c" 1>&6 -echo "configure:17877: checking for the pthreads library -l$flag" >&5 +echo "configure:17899: checking for the pthreads library -l$flag" >&5 THREADS_LINK="-l$flag" ;; esac @@ -17884,14 +17906,14 @@ echo "configure:17877: checking for the pthreads library -l$flag" >&5 CFLAGS="$THREADS_CFLAGS $CFLAGS" cat > conftest.$ac_ext < int main() { pthread_create(0,0,0,0); ; return 0; } EOF -if { (eval echo configure:17895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:17917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* THREADS_OK=yes else @@ -17920,10 +17942,14 @@ rm -f conftest* LIBS="$THREADS_LINK $LIBS" echo $ac_n "checking if more special flags are required for pthreads""... $ac_c" 1>&6 -echo "configure:17924: checking if more special flags are required for pthreads" >&5 +echo "configure:17946: checking if more special flags are required for pthreads" >&5 flag=no case "${host}" in - *-aix* | *-freebsd*) + *-aix*) + LDFLAGS="-L/usr/lib/threads $LDFLAGS" + flag="-D_THREAD_SAFE" + ;; + *-freebsd*) flag="-D_THREAD_SAFE" ;; *-hp-hpux* ) @@ -17949,12 +17975,12 @@ echo "configure:17924: checking if more special flags are required for pthreads" for ac_func in thr_setconcurrency do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:17953: checking for $ac_func" >&5 +echo "configure:17979: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:18007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -18006,17 +18032,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:18010: checking for $ac_hdr" >&5 +echo "configure:18036: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:18020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:18046: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -18044,12 +18070,12 @@ done if test "$ac_cv_header_sched_h" = "yes"; then echo $ac_n "checking for sched_yield""... $ac_c" 1>&6 -echo "configure:18048: checking for sched_yield" >&5 +echo "configure:18074: checking for sched_yield" >&5 if eval "test \"`echo '$''{'ac_cv_func_sched_yield'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:18102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_sched_yield=yes" else @@ -18094,7 +18120,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6 -echo "configure:18098: checking for sched_yield in -lposix4" >&5 +echo "configure:18124: checking for sched_yield in -lposix4" >&5 ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -18102,7 +18128,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:18143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -18146,12 +18172,12 @@ fi HAVE_PRIOR_FUNCS=0 echo $ac_n "checking for pthread_attr_getschedpolicy""... $ac_c" 1>&6 -echo "configure:18150: checking for pthread_attr_getschedpolicy" >&5 +echo "configure:18176: checking for pthread_attr_getschedpolicy" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_getschedpolicy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:18204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_attr_getschedpolicy=yes" else @@ -18189,12 +18215,12 @@ fi if eval "test \"`echo '$ac_cv_func_'pthread_attr_getschedpolicy`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for pthread_attr_setschedparam""... $ac_c" 1>&6 -echo "configure:18193: checking for pthread_attr_setschedparam" >&5 +echo "configure:18219: checking for pthread_attr_setschedparam" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_setschedparam'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:18247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_attr_setschedparam=yes" else @@ -18232,12 +18258,12 @@ fi if eval "test \"`echo '$ac_cv_func_'pthread_attr_setschedparam`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for sched_get_priority_max""... $ac_c" 1>&6 -echo "configure:18236: checking for sched_get_priority_max" >&5 +echo "configure:18262: checking for sched_get_priority_max" >&5 if eval "test \"`echo '$''{'ac_cv_func_sched_get_priority_max'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:18292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_sched_get_priority_max=yes" else @@ -18280,7 +18306,7 @@ if eval "test \"`echo '$ac_cv_func_'sched_get_priority_max`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_get_priority_max in -lposix4""... $ac_c" 1>&6 -echo "configure:18284: checking for sched_get_priority_max in -lposix4" >&5 +echo "configure:18310: checking for sched_get_priority_max in -lposix4" >&5 ac_lib_var=`echo posix4'_'sched_get_priority_max | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -18288,7 +18314,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:18329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -18344,12 +18370,12 @@ EOF fi echo $ac_n "checking for pthread_cancel""... $ac_c" 1>&6 -echo "configure:18348: checking for pthread_cancel" >&5 +echo "configure:18374: checking for pthread_cancel" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_cancel'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:18402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_cancel=yes" else @@ -18397,13 +18423,13 @@ fi echo $ac_n "checking for pthread_cleanup_push/pop""... $ac_c" 1>&6 -echo "configure:18401: checking for pthread_cleanup_push/pop" >&5 +echo "configure:18427: checking for pthread_cleanup_push/pop" >&5 if eval "test \"`echo '$''{'wx_cv_func_pthread_cleanup_push'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -18413,7 +18439,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:18417: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:18443: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_pthread_cleanup_push=yes @@ -18441,13 +18467,13 @@ EOF echo $ac_n "checking for pthread_mutexattr_t""... $ac_c" 1>&6 -echo "configure:18445: checking for pthread_mutexattr_t" >&5 +echo "configure:18471: checking for pthread_mutexattr_t" >&5 if eval "test \"`echo '$''{'wx_cv_type_pthread_mutexattr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -18457,7 +18483,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:18461: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:18487: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_pthread_mutexattr_t=yes @@ -18484,13 +18510,13 @@ EOF else echo $ac_n "checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER""... $ac_c" 1>&6 -echo "configure:18488: checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER" >&5 +echo "configure:18514: checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER" >&5 if eval "test \"`echo '$''{'wx_cv_type_pthread_rec_mutex_init'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -18499,7 +18525,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:18503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:18529: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_pthread_rec_mutex_init=yes @@ -18534,7 +18560,7 @@ else case "${host}" in *-*-mingw32* ) echo $ac_n "checking if compiler supports -mthreads""... $ac_c" 1>&6 -echo "configure:18538: checking if compiler supports -mthreads" >&5 +echo "configure:18564: checking if compiler supports -mthreads" >&5 if eval "test \"`echo '$''{'wx_cv_cflags_mthread'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -18542,14 +18568,14 @@ else CFLAGS_OLD="$CFLAGS" CFLAGS="$CFLAGS -mthreads" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:18579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_cflags_mthread=yes else @@ -18588,7 +18614,7 @@ EOF else if test "$ac_cv_func_strtok_r" = "yes"; then echo $ac_n "checking if -D_REENTRANT is needed""... $ac_c" 1>&6 -echo "configure:18592: checking if -D_REENTRANT is needed" >&5 +echo "configure:18618: checking if -D_REENTRANT is needed" >&5 if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D_REENTRANT" echo "$ac_t""yes" 1>&6 @@ -18973,12 +18999,12 @@ if test "$wxUSE_DATETIME" = "yes"; then for ac_func in strptime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:18977: checking for $ac_func" >&5 +echo "configure:19003: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -19027,13 +19053,13 @@ done echo $ac_n "checking for timezone variable in ""... $ac_c" 1>&6 -echo "configure:19031: checking for timezone variable in " >&5 +echo "configure:19057: checking for timezone variable in " >&5 if eval "test \"`echo '$''{'wx_cv_var_timezone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -19045,7 +19071,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:19049: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:19075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_var_timezone=timezone @@ -19056,7 +19082,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -19068,7 +19094,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:19072: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:19098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_var_timezone=_timezone @@ -19079,7 +19105,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -19091,7 +19117,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:19095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:19121: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_var_timezone=__timezone @@ -19132,12 +19158,12 @@ EOF for ac_func in localtime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:19136: checking for $ac_func" >&5 +echo "configure:19162: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -19187,13 +19213,13 @@ done if test "$ac_cv_func_localtime" = "yes"; then echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:19191: checking for tm_gmtoff in struct tm" >&5 +echo "configure:19217: checking for tm_gmtoff in struct tm" >&5 if eval "test \"`echo '$''{'wx_cv_struct_tm_has_gmtoff'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -19205,7 +19231,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:19209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:19235: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_struct_tm_has_gmtoff=yes @@ -19234,12 +19260,12 @@ EOF for ac_func in gettimeofday ftime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:19238: checking for $ac_func" >&5 +echo "configure:19264: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -19289,7 +19315,7 @@ done if test "$ac_cv_func_gettimeofday" = "yes"; then echo $ac_n "checking whether gettimeofday takes two arguments""... $ac_c" 1>&6 -echo "configure:19293: checking whether gettimeofday takes two arguments" >&5 +echo "configure:19319: checking whether gettimeofday takes two arguments" >&5 if eval "test \"`echo '$''{'wx_cv_func_gettimeofday_has_2_args'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -19304,7 +19330,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext < @@ -19317,7 +19343,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:19321: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:19347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_gettimeofday_has_2_args=yes else @@ -19325,7 +19351,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -19338,7 +19364,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:19342: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:19368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_gettimeofday_has_2_args=no else @@ -19393,12 +19419,12 @@ fi if test "$wxUSE_SOCKETS" = "yes"; then if test "$TOOLKIT" != "MSW"; then echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:19397: checking for socket" >&5 +echo "configure:19423: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -19439,7 +19465,7 @@ if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:19443: checking for socket in -lsocket" >&5 +echo "configure:19469: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -19447,7 +19473,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -19494,7 +19520,7 @@ fi if test "$wxUSE_SOCKETS" = "yes" ; then if test "$TOOLKIT" != "MSW"; then echo $ac_n "checking what is the type of the third argument of getsockname""... $ac_c" 1>&6 -echo "configure:19498: checking what is the type of the third argument of getsockname" >&5 +echo "configure:19524: checking what is the type of the third argument of getsockname" >&5 if eval "test \"`echo '$''{'wx_cv_type_getsockname3'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -19509,7 +19535,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext < @@ -19522,7 +19548,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:19526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:19552: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_getsockname3=socklen_t else @@ -19530,7 +19556,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -19543,7 +19569,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:19547: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:19573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_getsockname3=size_t else @@ -19551,7 +19577,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -19564,7 +19590,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:19568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:19594: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_getsockname3=int else @@ -19636,17 +19662,17 @@ if test "$wxUSE_GUI" = "yes"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:19640: checking for $ac_hdr" >&5 +echo "configure:19666: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:19650: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:19676: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -19700,12 +19726,12 @@ if test "$TOOLKIT" != "MSW"; then for ac_func in dlopen do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:19704: checking for $ac_func" >&5 +echo "configure:19730: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -19756,7 +19782,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:19760: checking for dlopen in -ldl" >&5 +echo "configure:19786: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -19764,7 +19790,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -19804,12 +19830,12 @@ else for ac_func in shl_load do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:19808: checking for $ac_func" >&5 +echo "configure:19834: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -19860,7 +19886,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dld in -lshl_load""... $ac_c" 1>&6 -echo "configure:19864: checking for dld in -lshl_load" >&5 +echo "configure:19890: checking for dld in -lshl_load" >&5 ac_lib_var=`echo shl_load'_'dld | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -19868,7 +19894,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lshl_load $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -19918,12 +19944,12 @@ done for ac_func in dlerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:19922: checking for $ac_func" >&5 +echo "configure:19948: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:19976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -19971,7 +19997,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlerror in -ldl""... $ac_c" 1>&6 -echo "configure:19975: checking for dlerror in -ldl" >&5 +echo "configure:20001: checking for dlerror in -ldl" >&5 ac_lib_var=`echo dl'_'dlerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -19979,7 +20005,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:20020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -20065,7 +20091,7 @@ EOF if test "$wxUSE_MSW" = 1 -a "$wxUSE_UNICODE_MSLU" = "yes"; then echo $ac_n "checking for main in -lunicows""... $ac_c" 1>&6 -echo "configure:20069: checking for main in -lunicows" >&5 +echo "configure:20095: checking for main in -lunicows" >&5 ac_lib_var=`echo unicows'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -20073,14 +20099,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lunicows $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:20110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -20258,17 +20284,17 @@ if test "$wxUSE_MSW" = 1 -a \( "$wxUSE_DATAOBJ" = "yes" \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:20262: checking for $ac_hdr" >&5 +echo "configure:20288: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:20272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:20298: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -20307,9 +20333,9 @@ cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking if g++ requires -fvtable-thunks""... $ac_c" 1>&6 -echo "configure:20311: checking if g++ requires -fvtable-thunks" >&5 +echo "configure:20337: checking if g++ requires -fvtable-thunks" >&5 cat > conftest.$ac_ext < #include @@ -20317,7 +20343,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:20321: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:20347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""no" 1>&6 else @@ -20378,17 +20404,17 @@ if test "$wxUSE_WINE" = 1 -a \( "$wxUSE_DATAOBJ" = "yes" \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:20382: checking for $ac_hdr" >&5 +echo "configure:20408: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:20392: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:20418: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -20427,9 +20453,9 @@ cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking if g++ requires -fvtable-thunks""... $ac_c" 1>&6 -echo "configure:20431: checking if g++ requires -fvtable-thunks" >&5 +echo "configure:20457: checking if g++ requires -fvtable-thunks" >&5 cat > conftest.$ac_ext < #include @@ -20437,7 +20463,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:20441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:20467: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""no" 1>&6 else @@ -21419,10 +21445,11 @@ SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq + echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:21426: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:21453: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -21462,9 +21489,16 @@ wx_cv_program_ext=$PROGRAM_EXT wx_cv_target_library=$WX_TARGET_LIBRARY wx_cv_target_library_gl=$WX_TARGET_LIBRARY_GL wx_cv_target_libtype=$WX_TARGET_LIBRARY_TYPE +wx_cv_library_basename=${WX_LIBRARY_BASENAME} +wx_cv_release=${WX_RELEASE} +wx_cv_current=${WX_CURRENT} +wx_cv_revision=${WX_REVISION} +wx_cv_age=${WX_AGE} export wx_cv_path_samplesubdirs wx_cv_if_gnu_make \ wx_cv_path_ifs wx_cv_program_ext \ - wx_cv_target_library wx_cv_target_library_gl wx_cv_target_libtype + wx_cv_target_library wx_cv_target_library_gl wx_cv_target_libtype \ + wx_cv_library_basename wx_cv_release wx_cv_current wx_cv_revision wx_cv_age + subdirs="demos samples utils contrib" @@ -21717,6 +21751,7 @@ s%@MACOSX_BUNDLE@%$MACOSX_BUNDLE%g s%@LIBWXMACRES@%$LIBWXMACRES%g s%@LIBWXMACRESCOMP@%$LIBWXMACRESCOMP%g s%@LIBWXMACRESWXCONFIG@%$LIBWXMACRESWXCONFIG%g +s%@GCC@%$GCC%g s%@DLLTOOL@%$DLLTOOL%g s%@AS@%$AS%g s%@NM@%$NM%g diff --git a/configure.in b/configure.in index ac95c8e3e4..2199e4e49c 100644 --- a/configure.in +++ b/configure.in @@ -187,15 +187,15 @@ case "${host}" in *-*-openbsd*) USE_BSD=1 USE_OPENBSD=1 - AC_DEFINE(__FREEBSD__) AC_DEFINE(__OPENBSD__) + AC_DEFINE(__BSD__) DEFAULT_DEFAULT_wxUSE_GTK=1 ;; *-*-netbsd*) USE_BSD=1 USE_NETBSD=1 - AC_DEFINE(__FREEBSD__) AC_DEFINE(__NETBSD__) + AC_DEFINE(__BSD__) DEFAULT_DEFAULT_wxUSE_GTK=1 ;; *-*-osf* ) @@ -224,8 +224,11 @@ case "${host}" in USE_AIX=1 USE_SYSV=1 USE_SVR4=1 - dnl Irvin Probst reports that the shared - dnl libraries under AIX have the same suffix as the normal ones + dnl quoting from http://www-1.ibm.com/servers/esdd/articles/gnu.html: + dnl + dnl Both archive libraries and shared libraries on AIX have an .a + dnl extension. This will explain why you can't link with an .so and + dnl why it works with the name changed to .a. SO_SUFFIX=a AC_DEFINE(__AIX__) AC_DEFINE(__SYSV__) @@ -1223,7 +1226,7 @@ dnl defines GCC empty if not using gcc dnl defines CFLAGS dnl dnl this magic incantation is needed to prevent AC_PROG_CC from setting the -dnl default CFLAGS (something like "-g -O2") - we don't need this as add +dnl default CFLAGS (something like "-g -O2") -- we don't need this as we add dnl -g and -O flags ourselves below CFLAGS=${CFLAGS:=} AC_PROG_CC @@ -1441,6 +1444,10 @@ AC_CACHE_CHECK([size of wchar_t], wx_cv_sizeof_wchar_t, [ AC_TRY_RUN( [ + /* DJGPP only has fake wchar_t: */ + #ifdef __DJGPP__ + # error "fake wchar_t" + #endif #ifdef HAVE_WCHAR_H # ifdef __CYGWIN__ # include @@ -1461,7 +1468,16 @@ AC_CACHE_CHECK([size of wchar_t], wx_cv_sizeof_wchar_t, ], wx_cv_sizeof_wchar_t=`cat conftestval`, wx_cv_sizeof_wchar_t=0, - wx_cv_sizeof_wchar_t=4 + [ + case "${host}" in + *-pc-msdosdjgpp ) + wx_cv_sizeof_wchar_t=0 + ;; + * ) + wx_cv_sizeof_wchar_t=4 + ;; + esac + ] ) ]) @@ -1501,13 +1517,9 @@ dnl Define search path for includes and libraries: all headers and libs will be dnl looked for in all directories of this path dnl --------------------------------------------------------------------------- -dnl notice that /usr/include should not be in this list, otherwise it breaks -dnl compilation on Solaris/gcc because standard headers are included instead -dnl of the gcc ones. (recorrection.. sadly much depends on this since it was -dnl first created and then 'corrected'.. removing /usr/include means system -dnl GL and Xpm libs will dnl not be found on linux and probably other platforms -dnl now. We need to correct that first before removing /usr/include again. -dnl see the various (ab)uses of WX_PATH_FIND_LIBRARIES below ) +dnl Notice that /usr/include should *not* be in this list, otherwise it breaks +dnl compilation on Solaris/AIX/... with gcc because standard (non ANSI C) +dnl headers are included instead of the "fixed" (ANSI-fied) gcc ones. dnl dnl Also try to put all directories which may contain X11R6 before those which dnl may contain X11R5/4 - we want to use R6 on machines which have both! @@ -1574,8 +1586,7 @@ SEARCH_INCLUDE="\ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ - /usr/openwin/share/include \ - /usr/include" + /usr/openwin/share/include" SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s/include/lib/g` " @@ -2233,8 +2244,10 @@ equivalent variable and GTK+ is version 1.2.3 or above. AC_MSG_ERROR(X11 not found, please use --x-includes and/or --x-libraries options) fi - GUI_TK_LIBRARY="$X_LIBS" - TOOLKIT_INCLUDE="$X_CFLAGS" + dnl for some reason AC_PATH_XTRA seems to add -INONE and -LNONE to + dnl X_LIBS and X_CFLAGS respectively -- what for?? + GUI_TK_LIBRARY=`echo $X_LIBS | sed 's/ -LNONE//'` + TOOLKIT_INCLUDE=`echo $X_CFLAGS | sed 's/ -INONE//'` AFMINSTALL=afminstall COMPILED_X_PROGRAM=0 @@ -2588,6 +2601,7 @@ fi dnl library link name WX_LIBRARY="wx_${TOOLCHAIN_NAME}" WX_LIBRARY_GL="wx_${TOOLCHAIN_NAME_GL}" +WX_LIBRARY_BASENAME="wx_${TOOLKIT_DIR}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}" dnl the name of the shared library WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}.${SO_SUFFIX}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}" @@ -2757,16 +2771,18 @@ if test "$wxUSE_SHARED" = "yes"; then ;; *-*-aix* ) - dnl the abs path below used to be hardcoded here so I guess it must - dnl be some sort of standard location under AIX? - AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib, - makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib) + dnl default settings are ok for gcc + if test "$GCC" != "yes"; then + dnl the abs path below used to be hardcoded here so I guess it must + dnl be some sort of standard location under AIX? + AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib, + makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib) - SHARED_LD="$(AIX_CXX_LD) -p 0 -o" + SHARED_LD="$(AIX_CXX_LD) -p 0 -o" + fi ;; *-*-cygwin* | *-*-mingw32* ) - WX_LIBRARY_IMPORTLIB="${WX_LIBRARY_NAME_SHARED}.a" SHARED_LD="${CXX} -shared -Wl,--out-implib,lib/${WX_LIBRARY_IMPORTLIB} -o" @@ -2789,9 +2805,15 @@ if test "$wxUSE_SHARED" = "yes"; then SHARED_LD="${LD} -shared -o" ;; + *-*-irix* ) + dnl default settings are ok for gcc + if test "$GCC" != "yes"; then + PIC_FLAG="-KPIC" + fi + ;; + *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \ *-*-sunos4* | \ - *-*-irix5* | *-*-irix6* | \ *-*-osf* | \ *-*-dgux5* | \ *-*-sysv5* ) @@ -3364,7 +3386,17 @@ if test "$TOOLKIT" != "MSW"; then AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host}" in - *-aix* | *-freebsd*) + *-aix*) + dnl again quoting from + dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html: + dnl + dnl When compiling and linking with -pthread, the library + dnl search path should include -L/usr/lib/threads at the + dnl beginning of the path. + LDFLAGS="-L/usr/lib/threads $LDFLAGS" + flag="-D_THREAD_SAFE" + ;; + *-freebsd*) flag="-D_THREAD_SAFE" ;; *-hp-hpux* ) @@ -5144,7 +5176,8 @@ AC_SUBST(LIBWXMACRES) AC_SUBST(LIBWXMACRESCOMP) AC_SUBST(LIBWXMACRESWXCONFIG) -dnl These seem to be missing +dnl other tools +AC_SUBST(GCC) AC_SUBST(DLLTOOL) AC_SUBST(AS) AC_SUBST(NM) @@ -5175,9 +5208,16 @@ wx_cv_program_ext=$PROGRAM_EXT wx_cv_target_library=$WX_TARGET_LIBRARY wx_cv_target_library_gl=$WX_TARGET_LIBRARY_GL wx_cv_target_libtype=$WX_TARGET_LIBRARY_TYPE +wx_cv_library_basename=${WX_LIBRARY_BASENAME} +wx_cv_release=${WX_RELEASE} +wx_cv_current=${WX_CURRENT} +wx_cv_revision=${WX_REVISION} +wx_cv_age=${WX_AGE} export wx_cv_path_samplesubdirs wx_cv_if_gnu_make \ wx_cv_path_ifs wx_cv_program_ext \ - wx_cv_target_library wx_cv_target_library_gl wx_cv_target_libtype + wx_cv_target_library wx_cv_target_library_gl wx_cv_target_libtype \ + wx_cv_library_basename wx_cv_release wx_cv_current wx_cv_revision wx_cv_age + AC_CONFIG_SUBDIRS(demos samples utils contrib) diff --git a/contrib/configure b/contrib/configure index 32d878c135..b1c7eb953b 100755 --- a/contrib/configure +++ b/contrib/configure @@ -691,6 +691,16 @@ fi PATH_IFS=$wx_cv_path_ifs WX_TARGET_LIBRARY=$wx_cv_target_library WX_TARGET_LIBRARY_TYPE=$wx_cv_target_libtype +WX_LIBRARY_BASENAME=$wx_cv_library_basename +WX_RELEASE=$wx_cv_release +WX_CURRENT=$wx_cv_current +WX_REVISION=$wx_cv_revision +WX_AGE=$wx_cv_age + + + + + @@ -830,7 +840,7 @@ trap 'rm -fr `echo " samples/ogl/ogledit/Makefile samples/ogl/studio/Makefile samples/stc/Makefile - samples/svg/Makefile + samples/svg/Makefile samples/canvas/Makefile samples/canvas/test/Makefile samples/canvas/simple/Makefile @@ -890,6 +900,11 @@ s%@PATH_IFS@%$PATH_IFS%g s%@ESD_LINK@%$ESD_LINK%g s%@WX_TARGET_LIBRARY@%$WX_TARGET_LIBRARY%g s%@WX_TARGET_LIBRARY_TYPE@%$WX_TARGET_LIBRARY_TYPE%g +s%@WX_LIBRARY_BASENAME@%$WX_LIBRARY_BASENAME%g +s%@WX_RELEASE@%$WX_RELEASE%g +s%@WX_CURRENT@%$WX_CURRENT%g +s%@WX_REVISION@%$WX_REVISION%g +s%@WX_AGE@%$WX_AGE%g CEOF EOF @@ -949,7 +964,7 @@ CONFIG_FILES=\${CONFIG_FILES-"src/Makefile samples/ogl/ogledit/Makefile samples/ogl/studio/Makefile samples/stc/Makefile - samples/svg/Makefile + samples/svg/Makefile samples/canvas/Makefile samples/canvas/test/Makefile samples/canvas/simple/Makefile diff --git a/contrib/configure.in b/contrib/configure.in index ef6db6c6ec..ab945e61b8 100644 --- a/contrib/configure.in +++ b/contrib/configure.in @@ -26,11 +26,21 @@ dnl Final subst PATH_IFS=$wx_cv_path_ifs WX_TARGET_LIBRARY=$wx_cv_target_library WX_TARGET_LIBRARY_TYPE=$wx_cv_target_libtype +WX_LIBRARY_BASENAME=$wx_cv_library_basename +WX_RELEASE=$wx_cv_release +WX_CURRENT=$wx_cv_current +WX_REVISION=$wx_cv_revision +WX_AGE=$wx_cv_age AC_SUBST(PATH_IFS) AC_SUBST(ESD_LINK) AC_SUBST(WX_TARGET_LIBRARY) AC_SUBST(WX_TARGET_LIBRARY_TYPE) +AC_SUBST(WX_LIBRARY_BASENAME) +AC_SUBST(WX_RELEASE) +AC_SUBST(WX_CURRENT) +AC_SUBST(WX_REVISION) +AC_SUBST(WX_AGE) dnl ----------- dnl File output @@ -55,6 +65,7 @@ AC_OUTPUT([ samples/ogl/ogledit/Makefile samples/ogl/studio/Makefile samples/stc/Makefile + samples/svg/Makefile samples/canvas/Makefile samples/canvas/test/Makefile samples/canvas/simple/Makefile diff --git a/contrib/include/wx/xrc/xmlres.h b/contrib/include/wx/xrc/xmlres.h index ca37a9cfa7..f52356bd72 100644 --- a/contrib/include/wx/xrc/xmlres.h +++ b/contrib/include/wx/xrc/xmlres.h @@ -37,6 +37,9 @@ class WXDLLEXPORT wxFrame; class WXDLLEXPORT wxToolBar; class WXXMLDLLEXPORT wxXmlResourceHandler; +class WXXMLDLLEXPORT wxXmlSubclassFactory; +class WXXMLDLLEXPORT wxXmlSubclassFactoriesList; +class wxXmlResourceModule; // These macros indicate current version of XML resources (this information is @@ -133,6 +136,11 @@ public: // Removes all handlers void ClearHandlers(); + + // Registers subclasses factory for use in XRC. This function is not meant + // for public use, please see the comment above wxXmlSubclassFactory + // definition. + static void AddSubclassFactory(wxXmlSubclassFactory *factory); // Loads menu from resource. Returns NULL on failure. wxMenu *LoadMenu(const wxString& name); @@ -244,6 +252,9 @@ private: #endif friend class wxXmlResourceHandler; + friend class wxXmlResourceModule; + + static wxXmlSubclassFactoriesList *ms_subclassFactories; // singleton instance: static wxXmlResource *ms_instance; @@ -438,6 +449,20 @@ protected: void wxXmlInitResourceModule(); +// This class is used to create instances of XRC "object" nodes with "subclass" +// property. It is _not_ supposed to be used by XRC users, you should instead +// register your subclasses via wxWindows' RTTI mechanism. This class is useful +// only for language bindings developer who need a way to implement subclassing +// in wxWindows ports that don't support wxRTTI (e.g. wxPython). +class WXXMLDLLEXPORT wxXmlSubclassFactory +{ +public: + // Try to create instance of given class and return it, return NULL on failure: + virtual wxObject *Create(const wxString& className) = 0; + virtual ~wxXmlSubclassFactory() {} +}; + + /* ------------------------------------------------------------------------- Backward compatibility macros. Do *NOT* use, they may disappear in future versions of the XRC library! diff --git a/contrib/samples/animate/Makefile.in b/contrib/samples/animate/Makefile.in index d645e9ad99..29bf8fb02f 100644 --- a/contrib/samples/animate/Makefile.in +++ b/contrib/samples/animate/Makefile.in @@ -17,7 +17,7 @@ PROGRAM=anitest OBJECTS=$(PROGRAM).o -APPEXTRALIBS=$(top_builddir)/lib/libwx_anim.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_anim-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/applet/Makefile.in b/contrib/samples/applet/Makefile.in index 08d399dcb9..4300fb618c 100644 --- a/contrib/samples/applet/Makefile.in +++ b/contrib/samples/applet/Makefile.in @@ -19,7 +19,7 @@ DATAFILES=about.html index.html OBJECTS=applet.o dialogs_wdr.o monitorapplet.o combobox.o -APPEXTRALIBS=$(top_builddir)/lib/libapplet.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_applet-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/canvas/simple/Makefile.in b/contrib/samples/canvas/simple/Makefile.in index 1618e568a5..b92c3904af 100644 --- a/contrib/samples/canvas/simple/Makefile.in +++ b/contrib/samples/canvas/simple/Makefile.in @@ -17,7 +17,7 @@ PROGRAM=simple OBJECTS=simple.o -APPEXTRALIBS=$(top_builddir)/lib/libcanvas.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_canvas-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/canvas/test/Makefile.in b/contrib/samples/canvas/test/Makefile.in index 500d2bdd8a..081537852d 100644 --- a/contrib/samples/canvas/test/Makefile.in +++ b/contrib/samples/canvas/test/Makefile.in @@ -19,7 +19,7 @@ OBJECTS=test.o DATAFILES = pat4.bmp pat36.bmp -APPEXTRALIBS=$(top_builddir)/lib/libcanvas.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_canvas-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/fl/fl_demo1/Makefile.in b/contrib/samples/fl/fl_demo1/Makefile.in index 88f55027f9..83f4fe3496 100644 --- a/contrib/samples/fl/fl_demo1/Makefile.in +++ b/contrib/samples/fl/fl_demo1/Makefile.in @@ -17,7 +17,7 @@ TARGET = fl_demo1 program_dir = contrib/samples/fl/$(TARGET) APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\" -APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS = $(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_fl-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ PROGRAM = $(TARGET) OBJECTS = $(TARGET).o diff --git a/contrib/samples/fl/fl_demo2/Makefile.in b/contrib/samples/fl/fl_demo2/Makefile.in index 911f9b5b42..da24607db2 100644 --- a/contrib/samples/fl/fl_demo2/Makefile.in +++ b/contrib/samples/fl/fl_demo2/Makefile.in @@ -17,7 +17,7 @@ TARGET = fl_demo2 program_dir = contrib/samples/fl/$(TARGET) APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\" -APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS = $(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_fl-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ PROGRAM = $(TARGET) OBJECTS = $(TARGET).o diff --git a/contrib/samples/fl/fl_sample1/Makefile.in b/contrib/samples/fl/fl_sample1/Makefile.in index 11d671a280..ad507429e4 100644 --- a/contrib/samples/fl/fl_sample1/Makefile.in +++ b/contrib/samples/fl/fl_sample1/Makefile.in @@ -17,7 +17,7 @@ TARGET = fl_sample1 program_dir = contrib/samples/fl/$(TARGET) APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\" -APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS = $(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_fl-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ PROGRAM = $(TARGET) OBJECTS = $(TARGET).o diff --git a/contrib/samples/fl/fl_sample2/Makefile.in b/contrib/samples/fl/fl_sample2/Makefile.in index 85b50b407c..6a863be5a1 100644 --- a/contrib/samples/fl/fl_sample2/Makefile.in +++ b/contrib/samples/fl/fl_sample2/Makefile.in @@ -17,7 +17,7 @@ TARGET = fl_sample2 program_dir = contrib/samples/fl/$(TARGET) APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\" -APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS = $(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_fl-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ PROGRAM = $(TARGET) OBJECTS = $(TARGET).o diff --git a/contrib/samples/fl/fl_sample3/Makefile.in b/contrib/samples/fl/fl_sample3/Makefile.in index b19998869b..fab8e27cce 100644 --- a/contrib/samples/fl/fl_sample3/Makefile.in +++ b/contrib/samples/fl/fl_sample3/Makefile.in @@ -17,7 +17,7 @@ TARGET = fl_sample3 program_dir = contrib/samples/fl/$(TARGET) APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\" -APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS = $(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_fl-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ PROGRAM = $(TARGET) OBJECTS = $(TARGET).o diff --git a/contrib/samples/gizmos/dynsash/Makefile.in b/contrib/samples/gizmos/dynsash/Makefile.in index 5e5fd58b72..5ec22a79b8 100644 --- a/contrib/samples/gizmos/dynsash/Makefile.in +++ b/contrib/samples/gizmos/dynsash/Makefile.in @@ -16,7 +16,7 @@ program_dir = contrib/samples/gizmos/dynsash PROGRAM=dynsash OBJECTS=dynsash.o -APPEXTRALIBS=$(top_builddir)/lib/libgizmos.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_gizmos-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/gizmos/dynsash_switch/Makefile.in b/contrib/samples/gizmos/dynsash_switch/Makefile.in index b9796bb40e..1c104bba81 100644 --- a/contrib/samples/gizmos/dynsash_switch/Makefile.in +++ b/contrib/samples/gizmos/dynsash_switch/Makefile.in @@ -16,7 +16,7 @@ program_dir = contrib/samples/gizmos/dynsash_switch PROGRAM=dynsash_switch OBJECTS=dynsash_switch.o -APPEXTRALIBS=$(top_builddir)/lib/libgizmos.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_gizmos-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/gizmos/editlbox/Makefile.in b/contrib/samples/gizmos/editlbox/Makefile.in index 465981c704..1ffec80c2a 100644 --- a/contrib/samples/gizmos/editlbox/Makefile.in +++ b/contrib/samples/gizmos/editlbox/Makefile.in @@ -16,7 +16,7 @@ program_dir = contrib/samples/gizmos/editlbox PROGRAM=test OBJECTS=test.o -APPEXTRALIBS=$(top_builddir)/lib/libgizmos.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_gizmos-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/gizmos/multicell/Makefile.in b/contrib/samples/gizmos/multicell/Makefile.in index f703be5269..10f2c56048 100644 --- a/contrib/samples/gizmos/multicell/Makefile.in +++ b/contrib/samples/gizmos/multicell/Makefile.in @@ -17,7 +17,7 @@ PROGRAM=multicell OBJECTS=mtest.o -APPEXTRALIBS=$(top_builddir)/lib/libgizmos.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_gizmos-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/gizmos/splittree/Makefile.in b/contrib/samples/gizmos/splittree/Makefile.in index 7935a90651..8fc452aa91 100644 --- a/contrib/samples/gizmos/splittree/Makefile.in +++ b/contrib/samples/gizmos/splittree/Makefile.in @@ -16,7 +16,7 @@ program_dir = contrib/samples/gizmos/splittree PROGRAM=splittree OBJECTS=tree.o -APPEXTRALIBS=$(top_builddir)/lib/libgizmos.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_gizmos-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/mmedia/Makefile.in b/contrib/samples/mmedia/Makefile.in index 7c4c5cbbba..9a06dcb206 100644 --- a/contrib/samples/mmedia/Makefile.in +++ b/contrib/samples/mmedia/Makefile.in @@ -9,7 +9,7 @@ PROGRAM=mmboard OBJECTS=mmboard.o mmbman.o -APPEXTRALIBS=$(top_builddir)/lib/libmmedia.@WX_TARGET_LIBRARY_TYPE@ @ESD_LINK@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_mmedia-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ @ESD_LINK@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/ogl/ogledit/Makefile.in b/contrib/samples/ogl/ogledit/Makefile.in index 055739c441..cd83570f71 100644 --- a/contrib/samples/ogl/ogledit/Makefile.in +++ b/contrib/samples/ogl/ogledit/Makefile.in @@ -9,7 +9,7 @@ PROGRAM=ogledit OBJECTS=$(PROGRAM).o doc.o view.o palette.o -APPEXTRALIBS=$(top_builddir)/lib/libogl.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_ogl-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/ogl/studio/Makefile.in b/contrib/samples/ogl/studio/Makefile.in index 1f6d9c4673..1e0b48dd54 100644 --- a/contrib/samples/ogl/studio/Makefile.in +++ b/contrib/samples/ogl/studio/Makefile.in @@ -12,7 +12,7 @@ DATAFILES=studio_resources.wxr OBJECTS=$(PROGRAM).o doc.o shapes.o symbols.o view.o cspalette.o\ mainfrm.o project.o dialogs.o csprint.o -APPEXTRALIBS=$(top_builddir)/lib/libogl.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_ogl-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include -I$(top_srcdir)/$(program_dir)/bitmaps include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/plot/Makefile.in b/contrib/samples/plot/Makefile.in index 8ba9e2abff..32b1812b66 100644 --- a/contrib/samples/plot/Makefile.in +++ b/contrib/samples/plot/Makefile.in @@ -9,7 +9,7 @@ PROGRAM=plot OBJECTS=plot.o -APPEXTRALIBS=$(top_builddir)/lib/libwx_plot.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_plot-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/stc/Makefile.in b/contrib/samples/stc/Makefile.in index cffdcc78d7..0de249989a 100644 --- a/contrib/samples/stc/Makefile.in +++ b/contrib/samples/stc/Makefile.in @@ -13,7 +13,7 @@ PROGRAM=stctest OBJECTS=$(PROGRAM).o -APPEXTRALIBS=$(top_builddir)/lib/libstc.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_stc-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include DATAFILES=stctest.cpp diff --git a/contrib/samples/svg/Makefile.in b/contrib/samples/svg/Makefile.in index 8c63b68960..5f1ba42210 100644 --- a/contrib/samples/svg/Makefile.in +++ b/contrib/samples/svg/Makefile.in @@ -9,7 +9,7 @@ PROGRAM=svgtest OBJECTS=svgtest.o -APPEXTRALIBS=$(top_builddir)/lib/libwx_dcsvg.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_dcsvg-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/samples/xrc/Makefile.in b/contrib/samples/xrc/Makefile.in index 74b1001946..81d9b9a620 100644 --- a/contrib/samples/xrc/Makefile.in +++ b/contrib/samples/xrc/Makefile.in @@ -16,7 +16,7 @@ OBJECTS=$(PROGRAM).o \ derivdlg.o \ custclas.o -APPEXTRALIBS=$(top_builddir)/lib/libwxxrc.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_xrc-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include DATADIRS = rc diff --git a/contrib/src/animate/Makefile.in b/contrib/src/animate/Makefile.in index a902f90775..a749a523d8 100644 --- a/contrib/src/animate/Makefile.in +++ b/contrib/src/animate/Makefile.in @@ -4,11 +4,12 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/animate -TARGET_LIBNAME=libwx_anim +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_animate-@WX_RELEASE@ + +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=plot diff --git a/contrib/src/applet/Makefile.in b/contrib/src/applet/Makefile.in index 1cfa1d7264..e1e99f6a30 100644 --- a/contrib/src/applet/Makefile.in +++ b/contrib/src/applet/Makefile.in @@ -4,11 +4,12 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/applet -TARGET_LIBNAME=libapplet +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_applet-@WX_RELEASE@ + +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=applet diff --git a/contrib/src/canvas/Makefile.in b/contrib/src/canvas/Makefile.in index 277ad0c0f4..555666e305 100644 --- a/contrib/src/canvas/Makefile.in +++ b/contrib/src/canvas/Makefile.in @@ -4,11 +4,12 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/canvas -TARGET_LIBNAME=libcanvas +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_canvas-@WX_RELEASE@ + +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=canvas diff --git a/contrib/src/fl/Makefile.in b/contrib/src/fl/Makefile.in index e902c419f7..c1ac8f3190 100644 --- a/contrib/src/fl/Makefile.in +++ b/contrib/src/fl/Makefile.in @@ -4,11 +4,12 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/fl -TARGET_LIBNAME = libfl +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_fl-@WX_RELEASE@ + +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=fl diff --git a/contrib/src/gizmos/Makefile.in b/contrib/src/gizmos/Makefile.in index 2e8619349b..436da14ab3 100644 --- a/contrib/src/gizmos/Makefile.in +++ b/contrib/src/gizmos/Makefile.in @@ -4,11 +4,12 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/gizmos -TARGET_LIBNAME=libgizmos +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_gizmos-@WX_RELEASE@ + +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=gizmos diff --git a/contrib/src/mmedia/Makefile.in b/contrib/src/mmedia/Makefile.in index ace479e123..aed8a229d5 100644 --- a/contrib/src/mmedia/Makefile.in +++ b/contrib/src/mmedia/Makefile.in @@ -4,11 +4,12 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/mmedia -TARGET_LIBNAME=libmmedia +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_mmedia-@WX_RELEASE@ + +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=mmedia diff --git a/contrib/src/net/Makefile.in b/contrib/src/net/Makefile.in index 9809ddec64..5d9bce041c 100644 --- a/contrib/src/net/Makefile.in +++ b/contrib/src/net/Makefile.in @@ -4,14 +4,15 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/net -TARGET_LIBNAME=libwx_net +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_net-@WX_RELEASE@ + +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 HEADER_PATH=$(top_srcdir)/contrib/include/wx -HEADER_SUBDIR=plot +HEADER_SUBDIR=net HEADERS=msg.h email.h web.h diff --git a/contrib/src/ogl/Makefile.in b/contrib/src/ogl/Makefile.in index 2b86eff47a..f3094fe3cf 100644 --- a/contrib/src/ogl/Makefile.in +++ b/contrib/src/ogl/Makefile.in @@ -4,11 +4,12 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/ogl -TARGET_LIBNAME=libogl +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_ogl-@WX_RELEASE@ + +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=ogl diff --git a/contrib/src/plot/Makefile.in b/contrib/src/plot/Makefile.in index 7b5c8a7fbf..f5435cd265 100644 --- a/contrib/src/plot/Makefile.in +++ b/contrib/src/plot/Makefile.in @@ -4,11 +4,11 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/plot -TARGET_LIBNAME=libwx_plot +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_plot-@WX_RELEASE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=plot diff --git a/contrib/src/stc/Makefile.in b/contrib/src/stc/Makefile.in index 01b2877cb8..b8a080b862 100644 --- a/contrib/src/stc/Makefile.in +++ b/contrib/src/stc/Makefile.in @@ -11,11 +11,11 @@ top_builddir = ../../.. scintilla_dir = $(top_srcdir)/contrib/src/stc/scintilla libsrc_dir = contrib/src/stc@PATH_IFS@$(scintilla_dir)/src -TARGET_LIBNAME=libstc +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_stc-@WX_RELEASE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=stc diff --git a/contrib/src/svg/Makefile.in b/contrib/src/svg/Makefile.in index 9f1f1e253b..904597247e 100644 --- a/contrib/src/svg/Makefile.in +++ b/contrib/src/svg/Makefile.in @@ -4,14 +4,14 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/svg -TARGET_LIBNAME=libwx_dcsvg +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_dcsvg-@WX_RELEASE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ HEADER_PATH=$(top_srcdir)/contrib/include/wx -HEADER_SUBDIR=dcsvg +HEADER_SUBDIR=svg HEADERS=dcsvg.h diff --git a/contrib/src/xrc/Makefile.in b/contrib/src/xrc/Makefile.in index f645274010..6305285017 100644 --- a/contrib/src/xrc/Makefile.in +++ b/contrib/src/xrc/Makefile.in @@ -7,11 +7,11 @@ expat_dir = $(top_srcdir)/contrib/src/xrc/expat libsrc_dir = contrib/src/xrc@PATH_IFS@$(expat_dir)/xmlparse@PATH_IFS@$(expat_dir)/xmltok -TARGET_LIBNAME=libwxxrc +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_xrc-@WX_RELEASE@ -LIBVERSION_CURRENT=0 -LIBVERSION_REVISION=1 -LIBVERSION_AGE=0 +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=xrc @@ -22,7 +22,7 @@ EXPAT_OBJECTS=xmltok.o xmlrole.o xmlparse.o HEADERS=xh_all.h xh_bttn.h xh_chckb.h xh_chckl.h xh_choic.h xh_combo.h \ xh_dlg.h xh_gauge.h xh_html.h xh_menu.h xh_notbk.h xh_panel.h \ xh_radbt.h xh_radbx.h xh_sizer.h xh_slidr.h xh_spin.h xh_stbmp.h \ - xh_sttxt.h xh_text.h xh_listb.h xml.h xmlio.h xmlres.h xh_toolb.h \ + xh_sttxt.h xh_text.h xh_listb.h xml.h xmlres.h xh_toolb.h \ xh_bmpbt.h xh_cald.h xh_listc.h xh_scrol.h xh_stbox.h xh_tree.h \ xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h xh_gdctl.h diff --git a/contrib/src/xrc/xh_dlg.cpp b/contrib/src/xrc/xh_dlg.cpp index d44ad16a91..3c916a9e1d 100644 --- a/contrib/src/xrc/xh_dlg.cpp +++ b/contrib/src/xrc/xh_dlg.cpp @@ -41,6 +41,8 @@ wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler() XRC_ADD_STYLE(wxTAB_TRAVERSAL); XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY); XRC_ADD_STYLE(wxCLIP_CHILDREN); + XRC_ADD_STYLE(wxMAXIMIZE_BOX); + XRC_ADD_STYLE(wxMINIMIZE_BOX); AddWindowStyles(); } diff --git a/contrib/src/xrc/xmlres.cpp b/contrib/src/xrc/xmlres.cpp index 0a1b72cd3a..17581fa357 100644 --- a/contrib/src/xrc/xmlres.cpp +++ b/contrib/src/xrc/xmlres.cpp @@ -547,6 +547,40 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent, wx } +#include "wx/listimpl.cpp" +WX_DECLARE_LIST(wxXmlSubclassFactory, wxXmlSubclassFactoriesList); +WX_DEFINE_LIST(wxXmlSubclassFactoriesList); + +wxXmlSubclassFactoriesList *wxXmlResource::ms_subclassFactories = NULL; + +/*static*/ void wxXmlResource::AddSubclassFactory(wxXmlSubclassFactory *factory) +{ + if (!ms_subclassFactories) + { + ms_subclassFactories = new wxXmlSubclassFactoriesList; + ms_subclassFactories->DeleteContents(TRUE); + } + ms_subclassFactories->Append(factory); +} + +class wxXmlSubclassFactoryCXX : public wxXmlSubclassFactory +{ +public: + ~wxXmlSubclassFactoryCXX() {} + + wxObject *Create(const wxString& className) + { + wxClassInfo* classInfo = wxClassInfo::FindClass(className); + + if (classInfo) + return classInfo->CreateObject(); + else + return NULL; + } +}; + + + wxXmlResourceHandler::wxXmlResourceHandler() @@ -568,18 +602,23 @@ wxObject *wxXmlResourceHandler::CreateResource(wxXmlNode *node, wxObject *parent !(m_resource->GetFlags() & wxXRC_NO_SUBCLASSING)) { wxString subclass = node->GetPropVal(wxT("subclass"), wxEmptyString); - wxClassInfo* classInfo = wxClassInfo::FindClass(subclass); - - if (classInfo) - m_instance = classInfo->CreateObject(); - - if (!m_instance) + if (!subclass.empty()) { - wxLogError(_("Subclass '%s' not found for resource '%s', not subclassing!"), - subclass.c_str(), node->GetPropVal(wxT("name"), wxEmptyString).c_str()); - } + for (wxXmlSubclassFactoriesList::Node *i = wxXmlResource::ms_subclassFactories->GetFirst(); + i; i = i->GetNext()) + { + m_instance = i->GetData()->Create(subclass); + if (m_instance) + break; + } - m_instance = classInfo->CreateObject(); + if (!m_instance) + { + wxString name = node->GetPropVal(wxT("name"), wxEmptyString); + wxLogError(_("Subclass '%s' not found for resource '%s', not subclassing!"), + subclass.c_str(), name.c_str()); + } + } } m_node = node; @@ -733,6 +772,7 @@ int wxXmlResourceHandler::GetID() stdID(wxID_STATIC); stdID(wxID_FORWARD); stdID(wxID_BACKWARD); stdID(wxID_DEFAULT); stdID(wxID_MORE); stdID(wxID_SETUP); stdID(wxID_RESET); stdID(wxID_HELP_CONTEXT); + stdID(wxID_CLOSE_ALL); #undef stdID else return wxXmlResource::GetXRCID(sid); } @@ -1166,11 +1206,13 @@ public: wxXmlResourceModule() {} bool OnInit() { + wxXmlResource::AddSubclassFactory(new wxXmlSubclassFactoryCXX); return TRUE; } void OnExit() { delete wxXmlResource::Set(NULL); + wxDELETE(wxXmlResource::ms_subclassFactories); CleanXRCID_Records(); } }; diff --git a/contrib/utils/wxrc/Makefile.in b/contrib/utils/wxrc/Makefile.in index 9685e6f172..b20802bbb0 100644 --- a/contrib/utils/wxrc/Makefile.in +++ b/contrib/utils/wxrc/Makefile.in @@ -9,7 +9,7 @@ PROGRAM=wxrc OBJECTS=wxrc.o -APPEXTRALIBS=$(top_builddir)/lib/libwxxrc.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_xrc-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/utils/wxrc/wxrc.cpp b/contrib/utils/wxrc/wxrc.cpp index 23b27952a7..f62a235ff3 100644 --- a/contrib/utils/wxrc/wxrc.cpp +++ b/contrib/utils/wxrc/wxrc.cpp @@ -251,28 +251,40 @@ wxArrayString XmlResApp::PrepareTempFiles() // find all files mentioned in structure, e.g. filename void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath) { - wxXmlNode *n = node; - if (n == NULL) return; - n = n->GetChildren(); - + // Is 'node' XML node element? + if (node == NULL) return; + if (node->GetType() != wxXML_ELEMENT_NODE) return; + + // Does 'node' contain filename information at all? + bool containsFilename = ( + // Any bitmaps: + (node->GetName() == _T("bitmap")) || + // URLs in wxHtmlWindow: + (node->GetName() == _T("url")) || + // wxBitmapButton: + (node->GetParent() != NULL && + node->GetParent()->GetPropVal(_T("class"), _T("")) == _T("wxBitmapButton") && + (node->GetName() == _T("focus") || + node->GetName() == _T("disabled") || + node->GetName() == _T("selected"))) + ); + + wxXmlNode *n = node->GetChildren(); while (n) { - if ((node->GetType() == wxXML_ELEMENT_NODE) && - // parent is an element, i.e. has subnodes... + if (containsFilename && (n->GetType() == wxXML_TEXT_NODE || - n->GetType() == wxXML_CDATA_SECTION_NODE) && - // ...it is textnode... - ((node/*not n!*/->GetName() == "bitmap") || - (node/*not n!*/->GetName() == "url"))) - // ...and known to contain filename + n->GetType() == wxXML_CDATA_SECTION_NODE)) { wxString fullname; - if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") fullname = n->GetContent(); - else fullname = inputPath + "/" + n->GetContent(); + if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") + fullname = n->GetContent(); + else + fullname = inputPath + "/" + n->GetContent(); if (flagVerbose) wxPrintf("adding " + fullname + "...\n"); - + wxString filename = GetInternalFileName(n->GetContent(), flist); n->SetContent(filename); @@ -282,11 +294,11 @@ void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxSt wxFileOutputStream sout(parOutputPath + "/" + filename); sin.Read(sout); // copy the stream } - + // subnodes: if (n->GetType() == wxXML_ELEMENT_NODE) FindFilesInXML(n, flist, inputPath); - + n = n->GetNext(); } } diff --git a/contrib/utils/wxrcedit/Makefile.in b/contrib/utils/wxrcedit/Makefile.in index 8f84122ee3..7fef156197 100644 --- a/contrib/utils/wxrcedit/Makefile.in +++ b/contrib/utils/wxrcedit/Makefile.in @@ -25,7 +25,7 @@ DATAFILES = df/break.df df/control.df df/menu_item.df df/notebookpage.df \ df/wxStaticLine.df df/wxStaticText.df df/wxTextCtrl.df \ df/wxToolBar.df df/wxTreeCtrl.df -APPEXTRALIBS=$(top_builddir)/lib/libwxxrc.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_xrc-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/contrib/utils/wxrcedit/editor.cpp b/contrib/utils/wxrcedit/editor.cpp index affbc9e01b..a84cc5f336 100644 --- a/contrib/utils/wxrcedit/editor.cpp +++ b/contrib/utils/wxrcedit/editor.cpp @@ -494,8 +494,7 @@ void EditorFrame::OnTreeSel(wxTreeEvent& event) } RecursivelyExpand(m_TreeCtrl, event.GetItem()); - PreviewFrame::Get()->Preview(node,m_Resource->GetRoot()->GetPropVal( - wxT("version"), wxT("0.0.0.0"))); + PreviewFrame::Get()->Preview(node,m_Resource); } } @@ -509,8 +508,7 @@ void EditorFrame::OnToolbar(wxCommandEvent& event) { XmlTreeData* dt = (XmlTreeData*)m_TreeCtrl->GetItemData(m_TreeCtrl->GetSelection());; if (dt != NULL && dt->Node != NULL) - PreviewFrame::Get()->Preview(dt->Node,m_Resource->GetRoot()->GetPropVal( - wxT("version"), wxT("0.0.0.0"))); + PreviewFrame::Get()->Preview(dt->Node, m_Resource); break; } diff --git a/contrib/utils/wxrcedit/preview.cpp b/contrib/utils/wxrcedit/preview.cpp index ddf3be2b61..a7ffa2eacd 100644 --- a/contrib/utils/wxrcedit/preview.cpp +++ b/contrib/utils/wxrcedit/preview.cpp @@ -140,8 +140,10 @@ void PreviewFrame::MakeDirty() -void PreviewFrame::Preview(wxXmlNode *node,const wxString &version) +void PreviewFrame::Preview(wxXmlNode *node, wxXmlDocument *orig_doc) { + wxString version = orig_doc->GetRoot()->GetPropVal(wxT("version"), wxT("0.0.0.0")); + while (node->GetParent()->GetParent() != NULL) node = node->GetParent(); { @@ -150,6 +152,7 @@ void PreviewFrame::Preview(wxXmlNode *node,const wxString &version) root->AddProperty(new wxXmlProperty(wxT("version"),version,NULL)); doc.SetRoot(root); doc.GetRoot()->AddChild(new wxXmlNode(*node)); + doc.SetFileEncoding(orig_doc->GetFileEncoding()); if (XmlGetClass(doc.GetRoot()->GetChildren()) == _T("wxDialog")) XmlSetClass(doc.GetRoot()->GetChildren(), _T("wxPanel")); @@ -168,7 +171,7 @@ void PreviewFrame::Preview(wxXmlNode *node,const wxString &version) } m_Node = node; - m_Version = version; + m_Doc = orig_doc; m_LogCtrl->Clear(); wxLogTextCtrl mylog(m_LogCtrl); @@ -237,5 +240,5 @@ END_EVENT_TABLE() void PreviewFrame::OnMouseEnter(wxMouseEvent& event) { - if (m_Dirty) Preview(m_Node,m_Version); + if (m_Dirty) Preview(m_Node,m_Doc); } diff --git a/contrib/utils/wxrcedit/preview.h b/contrib/utils/wxrcedit/preview.h index abacbc1578..50b690a9df 100644 --- a/contrib/utils/wxrcedit/preview.h +++ b/contrib/utils/wxrcedit/preview.h @@ -31,7 +31,7 @@ class PreviewFrame : public wxFrame PreviewFrame(); ~PreviewFrame(); - void Preview(wxXmlNode *node,const wxString &version); + void Preview(wxXmlNode *node,wxXmlDocument *doc); void MakeDirty(); // current node updated, needs preview refresh // (will be done once mouse enters preview win) @@ -47,7 +47,7 @@ class PreviewFrame : public wxFrame private: static PreviewFrame *ms_Instance; wxXmlNode *m_Node; - wxString m_Version; + wxXmlDocument *m_Doc; wxScrolledWindow *m_ScrollWin; wxTextCtrl *m_LogCtrl; wxSplitterWindow *m_Splitter; diff --git a/debian/changelog b/debian/changelog index f50761b210..59eccbaa25 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,34 @@ +wxwindows2.3 (2.3.3.2) unstable; urgency=low + + * The one more for luck release. + * Debian-wise, it fixes the problem with contrib lib name clashes; + code-wise, lots of little issues (and a couple of big 'uns) from + 2.3.3 -- see the more regular change or cvs logs for details... + * Yes, it's still the unstable branch, yes the request for testing + to see if we can reasonably obsolete 2.2 in post-woody debian + is still current, and yes we're still working toward a stable + 2.4 release as fast as we can. Big thanks to everyone who's + been patient and/or active fixing things. + + -- Ron Lee Thu, 26 Sep 2002 17:43:05 -0700 + +wxwindows2.3 (2.3.3.1) unstable; urgency=low + + * Ok, Robin says wxPython is good to go. + * Since wx2.2 has crashed and burned with the new releases of + python and png, Could package maintainers with packages that + depend on wx please recompile with this package and let me + know if they still need 2.2 in woody? If not I'll have them + removed. There should be a 2.4 release following very soon. + (hah, let's see how the date on that comment testifies!) + * Yes, I know wxpython is missing man pages for some of its + scripts. File a bug if you must, but preferably, if you know + what they do, attach a patch containing one. I don't use them + myself or could even do more than guess what they do today. + Sorry, C++. + + -- Ron Lee Thu, 19 Sep 2002 16:25:12 -0700 + wxwindows2.3 (2.3.3) unstable; urgency=low * The "If it sucks, You whined for it!" release. diff --git a/debian/control.in b/debian/control.in index 3d02a9e5f0..218a57954b 100644 --- a/debian/control.in +++ b/debian/control.in @@ -116,7 +116,7 @@ Description: wxWindows Cross-platform C++ GUI toolkit (GTK+ development) Package: libwxgtk=V-python Architecture: any Section: interpreters -Depends: python (>=2.1), python (<<2.2), ${shlibs:Depends} +Depends: python (>=2.2), python (<<2.3), ${shlibs:Depends} Suggests: wxwin=V-doc, wxwin=V-examples Conflicts: libwxgtk=V-python-contrib, python-wxwin Replaces: libwxgtk=V-python-contrib, python-wxwin diff --git a/debian/libwxgtk-contrib-dev.files b/debian/libwxgtk-contrib-dev.files index c88f73cd31..d569a54361 100644 --- a/debian/libwxgtk-contrib-dev.files +++ b/debian/libwxgtk-contrib-dev.files @@ -1,12 +1,12 @@ usr/include/wx/ -usr/lib/libcanvas.so -usr/lib/libfl.so -usr/lib/libgizmos.so -usr/lib/libmmedia.so -usr/lib/libogl.so -usr/lib/libstc.so -usr/lib/libwx_dcsvg.so -usr/lib/libwx_net.so -usr/lib/libwx_plot.so -usr/lib/libwxxrc.so +usr/lib/libwx_gtk_canvas-*.so +usr/lib/libwx_gtk_dcsvg-*.so +usr/lib/libwx_gtk_fl-*.so +usr/lib/libwx_gtk_gizmos-*.so +usr/lib/libwx_gtk_mmedia-*.so +usr/lib/libwx_gtk_net-*.so +usr/lib/libwx_gtk_ogl-*.so +usr/lib/libwx_gtk_plot-*.so +usr/lib/libwx_gtk_stc-*.so +usr/lib/libwx_gtk_xrc-*.so diff --git a/debian/rules b/debian/rules index 03e582f943..a534bbee40 100755 --- a/debian/rules +++ b/debian/rules @@ -562,7 +562,8 @@ install-gtk-dev: build-gtk-static-stamp install-gtk-lib dh_clean -k dh_installdirs dh_movefiles --sourcedir=debian/$(package_gtk_lib) - cp $(objdir_gtk_static)/lib/libwx_gtk*.a debian/$(package_gtk_dev)/usr/lib + cp $(objdir_gtk_static)/lib/libwx_gtk-*.a debian/$(package_gtk_dev)/usr/lib + cp $(objdir_gtk_static)/lib/libwx_gtk_gl-*.a debian/$(package_gtk_dev)/usr/lib install-gtk-dbg: DH_OPTIONS=-p$(package_gtk_dbg) install-gtk-dbg: build-gtk-debug-stamp @@ -601,7 +602,8 @@ install-gtk-contrib-dev: build-contrib-static-stamp install-gtk-dev dh_installdirs dh_movefiles --sourcedir=debian/$(package_gtk_contrib) cp $(objdir_gtk_static)/lib/*.a debian/$(package_gtk_contrib_dev)/usr/lib - rm -f debian/$(package_gtk_contrib_dev)/usr/lib/libwx_gtk*.a + rm -f debian/$(package_gtk_contrib_dev)/usr/lib/libwx_gtk-*.a + rm -f debian/$(package_gtk_contrib_dev)/usr/lib/libwx_gtk_gl-*.a install-gtk-py: DH_OPTIONS=-p$(package_gtk_py) install-gtk-py: build-gtk-py-stamp diff --git a/demos/dbbrowse/makefile.gtk b/demos/dbbrowse/makefile.gtk deleted file mode 100644 index cd8a960812..0000000000 --- a/demos/dbbrowse/makefile.gtk +++ /dev/null @@ -1,15 +0,0 @@ - -# Top dir of wxWindows -top_builddir = /gtm/bart/wxGTK - -PROGRAM=dbbrowser_gtk - - -OBJECTS= dbbrowse.o doc.o pgmctrl.o tabpgwin.o\ - browsedb.o dbtree.o dbgrid.o dlguser.o - - - - -include $(top_builddir)/src/makeprog.env - diff --git a/distrib/msw/copybase.bat b/distrib/msw/copybase.bat index 8512cde9d4..a33d12365f 100755 --- a/distrib/msw/copybase.bat +++ b/distrib/msw/copybase.bat @@ -3,7 +3,7 @@ rem VZ: this is quick and _very_ dirty set VER=2.3.3 -set DEST=s:\upload\wxBase-%VER% +set DEST=q:\wxBase-%VER% mkdir %DEST% mkdir %DEST%\include @@ -20,6 +20,7 @@ mkdir %DEST%\src\msw mkdir %DEST%\src\regex mkdir %DEST%\src\unix mkdir %DEST%\src\zlib +mkdir %DEST%\lib chdir %WXWIN% @@ -27,19 +28,23 @@ rem Copy the files to the root directory copy /q docs\changes.txt %DEST%\CHANGES.txt copy /q docs\licence.txt %DEST%\LICENCE.txt -copy /q docs\install.txt %DEST%\README.txt -copy /q docs\symbols.txt %DEST%\SYMBOLS.txt +copy /q docs\base\readme.txt %DEST%\README.txt -rem Copy the project files +rem Copy the project/make files copy /q src\wxBase.dsp %DEST%\src\wxBase.dsp copy /q src\wxBase.dsw %DEST%\src\wxBase.dsw -copy /q include\wx\msw\setup.h %DEST%\include\wx\msw\setup.h +copy /q include\wx\msw\setup0.h %DEST%\include\wx\msw\setup.h +copy /q src\makeb32.env %DEST%\src\makeb32.env +copy /q src\makelib.b32 %DEST%\src\makelib.b32 +copy /q src\makeprog.b32 %DEST%\src\makeprog.b32 +copy /q src\msw\makebase.b32 %DEST%\src\msw\makebase.b32 rem Copy the sample copy /q samples\console\console.cpp %DEST%\samples\console\console.cpp copy /q samples\console\console.dsp %DEST%\samples\console\console.dsp +copy /q samples\console\makefile.b32 %DEST%\samples\console\makefile.b32 copy /q samples\console\testdata.fc %DEST%\samples\console\testdata.fc rem Copy regex and zlib files @@ -51,101 +56,27 @@ rem The files not in src/files.lst copy /q src\msw\dummy.cpp %DEST%\src\msw\dummy.cpp copy /q src\msw\dummydll.cpp %DEST%\src\msw\dummydll.cpp +copy /q src\common\execcmn.cpp %DEST%\src\common\execcmn.cpp copy /q src\common\unictabl.inc %DEST%\src\common\unictabl.inc +copy /q src\common\unzip.h %DEST%\src\common\unzip.h -rem The rest is generated from src/files.lst - -copy /q include\wx\app.h %DEST%\include\wx\app.h -copy /q include\wx\arrimpl.cpp %DEST%\include\wx\arrimpl.cpp -copy /q include\wx\buffer.h %DEST%\include\wx\buffer.h -copy /q include\wx\chkconf.h %DEST%\include\wx\chkconf.h -copy /q include\wx\clntdata.h %DEST%\include\wx\clntdata.h -copy /q include\wx\cmdline.h %DEST%\include\wx\cmdline.h -copy /q include\wx\confbase.h %DEST%\include\wx\confbase.h -copy /q include\wx\config.h %DEST%\include\wx\config.h -copy /q include\wx\date.h %DEST%\include\wx\date.h -copy /q include\wx\datetime.h %DEST%\include\wx\datetime.h -copy /q include\wx\datetime.inl %DEST%\include\wx\datetime.inl -copy /q include\wx\datstrm.h %DEST%\include\wx\datstrm.h -copy /q include\wx\db.h %DEST%\include\wx\db.h -copy /q include\wx\dbtable.h %DEST%\include\wx\dbtable.h -copy /q include\wx\dde.h %DEST%\include\wx\dde.h -copy /q include\wx\debug.h %DEST%\include\wx\debug.h -copy /q include\wx\defs.h %DEST%\include\wx\defs.h -copy /q include\wx\dir.h %DEST%\include\wx\dir.h -copy /q include\wx\dynarray.h %DEST%\include\wx\dynarray.h -copy /q include\wx\dynlib.h %DEST%\include\wx\dynlib.h -copy /q include\wx\encconv.h %DEST%\include\wx\encconv.h -copy /q include\wx\event.h %DEST%\include\wx\event.h -copy /q include\wx\ffile.h %DEST%\include\wx\ffile.h -copy /q include\wx\file.h %DEST%\include\wx\file.h -copy /q include\wx\fileconf.h %DEST%\include\wx\fileconf.h -copy /q include\wx\filefn.h %DEST%\include\wx\filefn.h -copy /q include\wx\filename.h %DEST%\include\wx\filename.h -copy /q include\wx\filesys.h %DEST%\include\wx\filesys.h -copy /q include\wx\fontenc.h %DEST%\include\wx\fontenc.h -copy /q include\wx\fontmap.h %DEST%\include\wx\fontmap.h -copy /q include\wx\fs_inet.h %DEST%\include\wx\fs_inet.h -copy /q include\wx\fs_mem.h %DEST%\include\wx\fs_mem.h -copy /q include\wx\fs_zip.h %DEST%\include\wx\fs_zip.h -copy /q include\wx\gsocket.h %DEST%\include\wx\gsocket.h -copy /q include\wx\hash.h %DEST%\include\wx\hash.h -copy /q include\wx\intl.h %DEST%\include\wx\intl.h -copy /q include\wx\ioswrap.h %DEST%\include\wx\ioswrap.h -copy /q include\wx\ipcbase.h %DEST%\include\wx\ipcbase.h -copy /q include\wx\list.h %DEST%\include\wx\list.h -copy /q include\wx\listimpl.cpp %DEST%\include\wx\listimpl.cpp -copy /q include\wx\log.h %DEST%\include\wx\log.h -copy /q include\wx\longlong.h %DEST%\include\wx\longlong.h -copy /q include\wx\memconf.h %DEST%\include\wx\memconf.h -copy /q include\wx\memory.h %DEST%\include\wx\memory.h -copy /q include\wx\memtext.h %DEST%\include\wx\memtext.h -copy /q include\wx\mimetype.h %DEST%\include\wx\mimetype.h -copy /q include\wx\module.h %DEST%\include\wx\module.h -copy /q include\wx\mstream.h %DEST%\include\wx\mstream.h -copy /q include\wx\object.h %DEST%\include\wx\object.h -copy /q include\wx\objstrm.h %DEST%\include\wx\objstrm.h -copy /q include\wx\platform.h %DEST%\include\wx\platform.h -copy /q include\wx\process.h %DEST%\include\wx\process.h -copy /q include\wx\regex.h %DEST%\include\wx\regex.h -copy /q include\wx\sckaddr.h %DEST%\include\wx\sckaddr.h -copy /q include\wx\sckipc.h %DEST%\include\wx\sckipc.h -copy /q include\wx\sckstrm.h %DEST%\include\wx\sckstrm.h -copy /q include\wx\serbase.h %DEST%\include\wx\serbase.h -copy /q include\wx\snglinst.h %DEST%\include\wx\snglinst.h -copy /q include\wx\socket.h %DEST%\include\wx\socket.h -copy /q include\wx\strconv.h %DEST%\include\wx\strconv.h -copy /q include\wx\stream.h %DEST%\include\wx\stream.h -copy /q include\wx\string.h %DEST%\include\wx\string.h -copy /q include\wx\sysopt.h %DEST%\include\wx\sysopt.h -copy /q include\wx\textbuf.h %DEST%\include\wx\textbuf.h -copy /q include\wx\textfile.h %DEST%\include\wx\textfile.h -copy /q include\wx\thread.h %DEST%\include\wx\thread.h -copy /q include\wx\time.h %DEST%\include\wx\time.h -copy /q include\wx\timer.h %DEST%\include\wx\timer.h -copy /q include\wx\tokenzr.h %DEST%\include\wx\tokenzr.h -copy /q include\wx\txtstrm.h %DEST%\include\wx\txtstrm.h -copy /q include\wx\unzip.h %DEST%\include\wx\unzip.h -copy /q include\wx\url.h %DEST%\include\wx\url.h -copy /q include\wx\utils.h %DEST%\include\wx\utils.h -copy /q include\wx\variant.h %DEST%\include\wx\variant.h -copy /q include\wx\vector.h %DEST%\include\wx\vector.h -copy /q include\wx\version.h %DEST%\include\wx\version.h -copy /q include\wx\wfstream.h %DEST%\include\wx\wfstream.h -copy /q include\wx\wx.h %DEST%\include\wx\wx.h -copy /q include\wx\wxchar.h %DEST%\include\wx\wxchar.h -copy /q include\wx\wxprec.h %DEST%\include\wx\wxprec.h -copy /q include\wx\zipstrm.h %DEST%\include\wx\zipstrm.h -copy /q include\wx\zstream.h %DEST%\include\wx\zstream.h -copy /q include\wx\unix\gsockunx.h %DEST%\include\wx\unix\gsockunx.h -copy /q include\wx\unix\mimetype.h %DEST%\include\wx\unix\mimetype.h -copy /q include\wx\msw\dde.h %DEST%\include\wx\msw\dde.h -copy /q include\wx\msw\mimetype.h %DEST%\include\wx\msw\mimetype.h -copy /q include\wx\protocol\file.h %DEST%\include\wx\protocol\file.h -copy /q include\wx\protocol\ftp.h %DEST%\include\wx\protocol\ftp.h -copy /q include\wx\protocol\http.h %DEST%\include\wx\protocol\http.h -copy /q include\wx\protocol\protocol.h %DEST%\include\wx\protocol\protocol.h +copy /q include\wx\msw\gsockmsw.h %DEST%\include\wx\msw\gsockmsw.h +copy /q include\wx\msw\missing.h %DEST%\include\wx\msw\missing.h +copy /q include\wx\msw\mslu.h %DEST%\include\wx\msw\mslu.h +copy /q include\wx\msw\msvcrt.h %DEST%\include\wx\msw\msvcrt.h +copy /q include\wx\msw\private.h %DEST%\include\wx\msw\private.h +copy /q include\wx\msw\regconf.h %DEST%\include\wx\msw\regconf.h +copy /q include\wx\msw\registry.h %DEST%\include\wx\msw\registry.h +rem The rest is generated from src/files.lst by pasting the ALL_SOURCES and +rem ALL_HEADERS here and doing +rem +rem .,$s@^\s*\(.*\)/\([^ ]*\)\( \\\)\?$@copy /q src\\\1\\\2 %DEST%\\src\\\1\\\2 +rem +rem and +rem +rem .,$s@/@\\@|exe "normal "|.,$s@^\s*\([^ ]*\)\( \\\)\?$@copy /q include\\wx\\\1 %DEST%\\include\\wx\\\1 +rem copy /q src\common\init.cpp %DEST%\src\common\init.cpp copy /q src\common\appcmn.cpp %DEST%\src\common\appcmn.cpp copy /q src\common\clntdata.cpp %DEST%\src\common\clntdata.cpp @@ -158,6 +89,7 @@ copy /q src\common\dbtable.cpp %DEST%\src\common\dbtable.cpp copy /q src\common\dircmn.cpp %DEST%\src\common\dircmn.cpp copy /q src\common\dynarray.cpp %DEST%\src\common\dynarray.cpp copy /q src\common\dynlib.cpp %DEST%\src\common\dynlib.cpp +copy /q src\common\dynload.cpp %DEST%\src\common\dynload.cpp copy /q src\common\encconv.cpp %DEST%\src\common\encconv.cpp copy /q src\common\event.cpp %DEST%\src\common\event.cpp copy /q src\common\extended.c %DEST%\src\common\extended.c @@ -173,6 +105,7 @@ copy /q src\common\fs_mem.cpp %DEST%\src\common\fs_mem.cpp copy /q src\common\fs_zip.cpp %DEST%\src\common\fs_zip.cpp copy /q src\common\ftp.cpp %DEST%\src\common\ftp.cpp copy /q src\common\hash.cpp %DEST%\src\common\hash.cpp +copy /q src\common\hashmap.cpp %DEST%\src\common\hashmap.cpp copy /q src\common\http.cpp %DEST%\src\common\http.cpp copy /q src\common\intl.cpp %DEST%\src\common\intl.cpp copy /q src\common\ipcbase.cpp %DEST%\src\common\ipcbase.cpp @@ -182,9 +115,9 @@ copy /q src\common\longlong.cpp %DEST%\src\common\longlong.cpp copy /q src\common\memory.cpp %DEST%\src\common\memory.cpp copy /q src\common\mimecmn.cpp %DEST%\src\common\mimecmn.cpp copy /q src\common\module.cpp %DEST%\src\common\module.cpp +copy /q src\common\msgout.cpp %DEST%\src\common\msgout.cpp copy /q src\common\mstream.cpp %DEST%\src\common\mstream.cpp copy /q src\common\object.cpp %DEST%\src\common\object.cpp -copy /q src\common\objstrm.cpp %DEST%\src\common\objstrm.cpp copy /q src\common\process.cpp %DEST%\src\common\process.cpp copy /q src\common\protocol.cpp %DEST%\src\common\protocol.cpp copy /q src\common\regex.cpp %DEST%\src\common\regex.cpp @@ -192,7 +125,6 @@ copy /q src\common\sckaddr.cpp %DEST%\src\common\sckaddr.cpp copy /q src\common\sckfile.cpp %DEST%\src\common\sckfile.cpp copy /q src\common\sckipc.cpp %DEST%\src\common\sckipc.cpp copy /q src\common\sckstrm.cpp %DEST%\src\common\sckstrm.cpp -copy /q src\common\serbase.cpp %DEST%\src\common\serbase.cpp copy /q src\common\socket.cpp %DEST%\src\common\socket.cpp copy /q src\common\strconv.cpp %DEST%\src\common\strconv.cpp copy /q src\common\stream.cpp %DEST%\src\common\stream.cpp @@ -229,3 +161,103 @@ copy /q src\msw\snglinst.cpp %DEST%\src\msw\snglinst.cpp copy /q src\msw\thread.cpp %DEST%\src\msw\thread.cpp copy /q src\msw\utils.cpp %DEST%\src\msw\utils.cpp copy /q src\msw\utilsexc.cpp %DEST%\src\msw\utilsexc.cpp +copy /q src\msw\volume.cpp %DEST%\src\msw\volume.cpp + +copy /q include\wx\app.h %DEST%\include\wx\app.h +copy /q include\wx\arrimpl.cpp %DEST%\include\wx\arrimpl.cpp +copy /q include\wx\buffer.h %DEST%\include\wx\buffer.h +copy /q include\wx\build.h %DEST%\include\wx\build.h +copy /q include\wx\chkconf.h %DEST%\include\wx\chkconf.h +copy /q include\wx\clntdata.h %DEST%\include\wx\clntdata.h +copy /q include\wx\cmdline.h %DEST%\include\wx\cmdline.h +copy /q include\wx\confbase.h %DEST%\include\wx\confbase.h +copy /q include\wx\config.h %DEST%\include\wx\config.h +copy /q include\wx\date.h %DEST%\include\wx\date.h +copy /q include\wx\datetime.h %DEST%\include\wx\datetime.h +copy /q include\wx\datetime.inl %DEST%\include\wx\datetime.inl +copy /q include\wx\datstrm.h %DEST%\include\wx\datstrm.h +copy /q include\wx\db.h %DEST%\include\wx\db.h +copy /q include\wx\dbtable.h %DEST%\include\wx\dbtable.h +copy /q include\wx\dde.h %DEST%\include\wx\dde.h +copy /q include\wx\debug.h %DEST%\include\wx\debug.h +copy /q include\wx\defs.h %DEST%\include\wx\defs.h +copy /q include\wx\dir.h %DEST%\include\wx\dir.h +copy /q include\wx\dynarray.h %DEST%\include\wx\dynarray.h +copy /q include\wx\dynlib.h %DEST%\include\wx\dynlib.h +copy /q include\wx\dynload.h %DEST%\include\wx\dynload.h +copy /q include\wx\encconv.h %DEST%\include\wx\encconv.h +copy /q include\wx\event.h %DEST%\include\wx\event.h +copy /q include\wx\features.h %DEST%\include\wx\features.h +copy /q include\wx\ffile.h %DEST%\include\wx\ffile.h +copy /q include\wx\file.h %DEST%\include\wx\file.h +copy /q include\wx\fileconf.h %DEST%\include\wx\fileconf.h +copy /q include\wx\filefn.h %DEST%\include\wx\filefn.h +copy /q include\wx\filename.h %DEST%\include\wx\filename.h +copy /q include\wx\filesys.h %DEST%\include\wx\filesys.h +copy /q include\wx\fontenc.h %DEST%\include\wx\fontenc.h +copy /q include\wx\fontmap.h %DEST%\include\wx\fontmap.h +copy /q include\wx\fs_inet.h %DEST%\include\wx\fs_inet.h +copy /q include\wx\fs_mem.h %DEST%\include\wx\fs_mem.h +copy /q include\wx\fs_zip.h %DEST%\include\wx\fs_zip.h +copy /q include\wx\gsocket.h %DEST%\include\wx\gsocket.h +copy /q include\wx\hash.h %DEST%\include\wx\hash.h +copy /q include\wx\hashmap.h %DEST%\include\wx\hashmap.h +copy /q include\wx\intl.h %DEST%\include\wx\intl.h +copy /q include\wx\ioswrap.h %DEST%\include\wx\ioswrap.h +copy /q include\wx\ipc.h %DEST%\include\wx\ipc.h +copy /q include\wx\ipcbase.h %DEST%\include\wx\ipcbase.h +copy /q include\wx\isql.h %DEST%\include\wx\isql.h +copy /q include\wx\isqlext.h %DEST%\include\wx\isqlext.h +copy /q include\wx\list.h %DEST%\include\wx\list.h +copy /q include\wx\listimpl.cpp %DEST%\include\wx\listimpl.cpp +copy /q include\wx\log.h %DEST%\include\wx\log.h +copy /q include\wx\longlong.h %DEST%\include\wx\longlong.h +copy /q include\wx\memconf.h %DEST%\include\wx\memconf.h +copy /q include\wx\memory.h %DEST%\include\wx\memory.h +copy /q include\wx\memtext.h %DEST%\include\wx\memtext.h +copy /q include\wx\mimetype.h %DEST%\include\wx\mimetype.h +copy /q include\wx\module.h %DEST%\include\wx\module.h +copy /q include\wx\msgout.h %DEST%\include\wx\msgout.h +copy /q include\wx\mstream.h %DEST%\include\wx\mstream.h +copy /q include\wx\object.h %DEST%\include\wx\object.h +copy /q include\wx\platform.h %DEST%\include\wx\platform.h +copy /q include\wx\process.h %DEST%\include\wx\process.h +copy /q include\wx\regex.h %DEST%\include\wx\regex.h +copy /q include\wx\sckaddr.h %DEST%\include\wx\sckaddr.h +copy /q include\wx\sckipc.h %DEST%\include\wx\sckipc.h +copy /q include\wx\sckstrm.h %DEST%\include\wx\sckstrm.h +copy /q include\wx\snglinst.h %DEST%\include\wx\snglinst.h +copy /q include\wx\socket.h %DEST%\include\wx\socket.h +copy /q include\wx\strconv.h %DEST%\include\wx\strconv.h +copy /q include\wx\stream.h %DEST%\include\wx\stream.h +copy /q include\wx\string.h %DEST%\include\wx\string.h +copy /q include\wx\sysopt.h %DEST%\include\wx\sysopt.h +copy /q include\wx\textbuf.h %DEST%\include\wx\textbuf.h +copy /q include\wx\textfile.h %DEST%\include\wx\textfile.h +copy /q include\wx\thread.h %DEST%\include\wx\thread.h +copy /q include\wx\thrimpl.cpp %DEST%\include\wx\thrimpl.cpp +copy /q include\wx\time.h %DEST%\include\wx\time.h +copy /q include\wx\timer.h %DEST%\include\wx\timer.h +copy /q include\wx\tokenzr.h %DEST%\include\wx\tokenzr.h +copy /q include\wx\txtstrm.h %DEST%\include\wx\txtstrm.h +copy /q include\wx\url.h %DEST%\include\wx\url.h +copy /q include\wx\utils.h %DEST%\include\wx\utils.h +copy /q include\wx\variant.h %DEST%\include\wx\variant.h +copy /q include\wx\vector.h %DEST%\include\wx\vector.h +copy /q include\wx\version.h %DEST%\include\wx\version.h +copy /q include\wx\volume.h %DEST%\include\wx\volume.h +copy /q include\wx\wfstream.h %DEST%\include\wx\wfstream.h +copy /q include\wx\wx.h %DEST%\include\wx\wx.h +copy /q include\wx\wxchar.h %DEST%\include\wx\wxchar.h +copy /q include\wx\wxprec.h %DEST%\include\wx\wxprec.h +copy /q include\wx\zipstrm.h %DEST%\include\wx\zipstrm.h +copy /q include\wx\zstream.h %DEST%\include\wx\zstream.h +copy /q include\wx\unix\gsockunx.h %DEST%\include\wx\unix\gsockunx.h +copy /q include\wx\unix\mimetype.h %DEST%\include\wx\unix\mimetype.h +copy /q include\wx\msw\dde.h %DEST%\include\wx\msw\dde.h +copy /q include\wx\msw\mimetype.h %DEST%\include\wx\msw\mimetype.h +copy /q include\wx\msw\winundef.h %DEST%\include\wx\msw\winundef.h +copy /q include\wx\protocol\file.h %DEST%\include\wx\protocol\file.h +copy /q include\wx\protocol\ftp.h %DEST%\include\wx\protocol\ftp.h +copy /q include\wx\protocol\http.h %DEST%\include\wx\protocol\http.h +copy /q include\wx\protocol\protocol.h %DEST%\include\wx\protocol\protocol.h diff --git a/distrib/msw/tarwxx11 b/distrib/msw/tarwxx11 new file mode 100755 index 0000000000..5745a29b5f --- /dev/null +++ b/distrib/msw/tarwxx11 @@ -0,0 +1,85 @@ +#!/bin/sh +# tarwxall: make up a tar.gz distribution of wxX11 +# Supply a source (e.g. ~/wx2) and destination (e.g. ~/wx2/deliver) + +# We can't use e.g. this: +# ls `cat $SRC/distrib/msw/makefile.rsp` zip -@ -u $DEST/wxWindows-$VERSION-gen.zip +# because there's not enough space on the command line, plus we need to ignore the +# blank lines. + +TAR=tar +ARCH=`arch` +if [ "$ARCH" = "ppc" ]; then + TAR=gnutar +fi + +expandlines() +{ + toexpand=$1 + outputfile=$2 + + rm -f $outputfile + touch $outputfile + for line in `cat $toexpand` ; do + if [ "$line" != "" ]; then + ls $line >> $outputfile + fi + uniq < $outputfile > /tmp/uniqtemp.txt + mv /tmp/uniqtemp.txt $outputfile + done +} + + +init="" +if [ "$1" = "" ] +then + echo Usage: tarwxx11 wx-dir output-dir version + exit +fi + +if [ "$2" = "" ] +then + echo Usage: tarwxx11 wx-dir output-dir version + exit +fi + +if [ "$3" = "" ] +then + echo Usage: tarwxx11 wx-dir output-dir version + exit +fi + +WXVER=$3 + +echo About to archive wxAll: +echo From $1 +echo To $2 +echo CTRL-C if this is not correct. +read dummy + +cd $1 + +echo Removing backup files... +rm *~ */*~ */*/*~ */*/*/*~ */*/*/*/*~ + +rm -f $2/wxX11-${WXVER}*.tar.gz +rm -f $2/wxWindows-${WXVER} + +### wxX11: combined wxMotif and wxX11 distributions +cd $1 +cat $1/distrib/msw/generic.rsp $1/distrib/msw/motif.rsp $1/distrib/msw/x11.rsp $1/distrib/msw/univ.rsp $1/distrib/msw/contrib.rsp $1/distrib/msw/utils.rsp $1/distrib/msw/xml.rsp $1/distrib/msw/dialoged.rsp $1/distrib/msw/ogl.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/jpeg.rsp > /tmp/wxx11_in.txt +expandlines /tmp/wxx11_in.txt /tmp/wxx11.txt +$TAR cf $2/wxX11-${WXVER}.tar -T /tmp/wxx11.txt + +echo Re-tarring wxX11 in a subdirectory... +cd $2 +mkdir wxWindows-${WXVER} +cd wxWindows-${WXVER} +$TAR xf ../wxX11-${WXVER}.tar +cd .. +rm -f wxX11-${WXVER}.tar +$TAR cf $2/wxX11-${WXVER}.tar wxWindows-${WXVER}/* +rm -f -r wxWindows-${WXVER} +gzip $2/wxX11-${WXVER}.tar + + diff --git a/distrib/msw/tmake/b32base.t b/distrib/msw/tmake/b32base.t index c80f5de01d..9366f8c9e9 100644 --- a/distrib/msw/tmake/b32base.t +++ b/distrib/msw/tmake/b32base.t @@ -85,8 +85,8 @@ wxUSE_GUI=0 !include $(WXDIR)\src\makeb32.env PERIPH_LIBS= -PERIPH_TARGET=zlib png jpeg tiff regex $(PERIPH_TARGET) -PERIPH_CLEAN_TARGET=clean_zlib clean_png clean_jpeg clean_tiff clean_regex $(PERIPH_CLEAN_TARGET) +PERIPH_TARGET=zlib regex $(PERIPH_TARGET) +PERIPH_CLEAN_TARGET=clean_zlib clean_regex $(PERIPH_CLEAN_TARGET) !if "$(DLL)" == "0" DUMMY=dummy @@ -106,7 +106,6 @@ MSWDIR=. DOCDIR = $(WXDIR)\docs COMMONOBJS = \ - $(MSWDIR)\y_tab.obj \ #$ ExpandList("WXCOMMONOBJS"); MSWOBJS = #$ ExpandList("WXMSWOBJS"); @@ -164,19 +163,6 @@ dummydll.obj: dummydll.$(SRCSUFF) $(LOCALHEADERS) $(BASEHEADERS) $(WXDIR)\includ version.res: brc32 -r -i$(WXDIR)\include\ $(MSWDIR)\version.rc -$(MSWDIR)\y_tab.obj: $(COMMDIR)\y_tab.c $(COMMDIR)\lex_yy.c - -# cl @<< -# $(CPPFLAGS2) /c $*.c -DUSE_DEFINE -DYY_USE_PROTOS /Fo$@ -# << - -$(COMMDIR)\y_tab.c: $(COMMDIR)\dosyacc.c - copy $(COMMDIR)\dosyacc.c $(COMMDIR)\y_tab.c - -$(COMMDIR)\lex_yy.c: $(COMMDIR)\doslex.c - copy $(COMMDIR)\doslex.c $(COMMDIR)\lex_yy.c - - #${ $_ = $project{"WXMSWOBJS"}; my @objs = split; @@ -305,8 +291,6 @@ clean: $(PERIPH_CLEAN_TARGET) -erase *.pch -erase *.csm -erase "wx32.#??" - -erase ..\common\y_tab.c - -erase ..\common\lex_yy.c cleanall: clean diff --git a/distrib/msw/tmake/g95.t b/distrib/msw/tmake/g95.t index 7fb2d7fd44..f1c494ef52 100644 --- a/distrib/msw/tmake/g95.t +++ b/distrib/msw/tmake/g95.t @@ -343,9 +343,12 @@ $(ARCHINCDIR)/wx: mkdir $(subst $(PATH_SUBST),$(PATH_SEPARATOR),$(ARCHINCDIR)) mkdir $(subst $(PATH_SUBST),$(PATH_SEPARATOR),$(ARCHINCDIR)/wx) -$(SETUP_H): $(ARCHINCDIR)/wx - $(COPY) $(WXDIR)/include/wx/msw/setup.h $@ +# Copy ALWAYS uses forward slashes now. +$(SETUP_H): $(ARCHINCDIR)/wx + $(COPY) $(WXDIR)/include/wx/msw/setup.h $(subst $(BACKSLASH),/,$@) + +# $(COPY) $(WXDIR)/include/wx/msw/setup.h $@ # $(COPY) $(subst $(PATH_SUBST),$(PATH_SEPARATOR),$(WXDIR)/include/wx/msw/setup.h) $(subst $(PATH_SUBST),$(PATH_SEPARATOR),$@) ifndef WXMAKINGDLL diff --git a/distrib/msw/tmake/vc6app.t b/distrib/msw/tmake/vc6app.t index 39ff9c463e..9ceace9bb1 100644 --- a/distrib/msw/tmake/vc6app.t +++ b/distrib/msw/tmake/vc6app.t @@ -49,7 +49,7 @@ } else { $project{"VC_PROJ_TYPE"} = 'Win32 (x86) Console Application'; $project{"VC_PROJ_CODE"} = '0x0103'; - $vc_base_libs = 'kernel32.lib user32.lib advapi32.lib '; + $vc_base_libs = 'kernel32.lib user32.lib advapi32.lib shell32.lib '; if ( Config("wx") ) { $vc_base_libs .= 'wsock32.lib '; } diff --git a/docs/changes.txt b/docs/changes.txt index 9107de419e..a03e2ec239 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -170,6 +170,14 @@ wxThread and related classes: OTHER CHANGES ============= +2.4.0 +----- + +Unix (Base/GUI): + +- minor OpenBSD compilation/linking fixes, now builds OOB under OpenBSD 3.1 +- don't include -I/usr/include nor -I/usr/local/include in wx-config output + 2.3.3 ----- diff --git a/docs/latex/wx/dragimag.tex b/docs/latex/wx/dragimag.tex index 72cca31294..42eab1e207 100644 --- a/docs/latex/wx/dragimag.tex +++ b/docs/latex/wx/dragimag.tex @@ -28,6 +28,14 @@ override \helpref{wxDragImage::DoDrawImage}{wxdragimagedodrawimage} and Please see {\tt samples/dragimag} for an example. +%\wxheading{Notes} +% +%Using the native Windows implementation, you must supply an image with a mask, or +%the image will not show when dragged. It is not clear if this is a bug +%in Windows or in the wxDragImage implementation. You can add a mask +%with a call to wxImage::SetMaskColour, passing RGB values not likely +%to be in the image. [CURED by creating the ImageList with ILC_MASK] + \wxheading{Derived from} \helpref{wxObject}{wxobject} diff --git a/docs/latex/wx/filedlg.tex b/docs/latex/wx/filedlg.tex index 6e95b41ec0..5f2b412dd6 100644 --- a/docs/latex/wx/filedlg.tex +++ b/docs/latex/wx/filedlg.tex @@ -164,7 +164,7 @@ Sets the default filename. \func{void}{SetFilterIndex}{\param{int }{filterIndex}} -Sets the default filter index, starting from zero. Windows only. +Sets the default filter index, starting from zero. \membersection{wxFileDialog::SetMessage}\label{wxfiledialogsetmessage} diff --git a/docs/latex/wx/listctrl.tex b/docs/latex/wx/listctrl.tex index 9aef15d27c..8f076fa117 100644 --- a/docs/latex/wx/listctrl.tex +++ b/docs/latex/wx/listctrl.tex @@ -14,7 +14,12 @@ without consuming much memory. To use virtual list control you must use \helpref{OnGetItemText}{wxlistctrlongetitemtext} (and optionally \helpref{OnGetItemImage}{wxlistctrlongetitemimage} and \helpref{OnGetItemAttr}{wxlistctrlongetitemattr}) to return the information -about the items when the control requests it. +about the items when the control requests it. Virtual list control can be used +as a normal one except that no operations which can take time proportional to +the number of items in the control happen -- this is required to allow having a +practically infinite number of items. For example, in a multiple selection +virtual list control, the selections won't be sent when many items are selected +at once because this could mean iterating over all the items. Using many of wxListCtrl features is shown in the \helpref{corresponding sample}{samplelistctrl}. diff --git a/docs/latex/wx/tstring.tex b/docs/latex/wx/tstring.tex index b40d241257..d69304d57e 100644 --- a/docs/latex/wx/tstring.tex +++ b/docs/latex/wx/tstring.tex @@ -9,8 +9,8 @@ wxString is a class which represents a character string of arbitrary length (lim arbitrary characters. The ASCII NUL character is allowed, although care should be taken when passing strings containing it to other functions. -wxString works with both ASCII (8 bit characters) as well as UNICODE (16 but -characters) strings. +wxString works with both ASCII (traditional, 7 or 8 bit, characters) as well as +Unicode (wide characters) strings. This class has all the standard operations you can expect to find in a string class: dynamic memory management (string extends to accommodate new characters), @@ -48,9 +48,10 @@ very useful but don't exist in most of other string classes: for example, \helpref{BeforeLast}{wxstringbeforelast}, \helpref{operator<<}{wxstringoperatorout} or \helpref{Printf}{wxstringprintf}. Of course, all the standard string operations are supported as well. -\item {\bf UNICODE} In this release, wxString only supports {\it construction} from -a UNICODE string, but in the next one it will be capable of also storing its -internal data in either ASCII or UNICODE format. +\item {\bf Unicode} wxString is Unicode friendly: it allows to easily convert +to and from ANSI and Unicode strings in any build mode (see the +\helpref{Unicode overview}{unicode} for more details) and maps to either +{\tt string} or {\tt wstring} transparently depending on the current mode. \item {\bf Used by wxWindows} And, of course, this class is used everywhere inside wxWindows so there is no performance loss which would result from conversions of objects of any other string class (including std::string) to diff --git a/docs/latex/wx/wizard.tex b/docs/latex/wx/wizard.tex index 2ae93d6650..5a1f6b50fe 100644 --- a/docs/latex/wx/wizard.tex +++ b/docs/latex/wx/wizard.tex @@ -134,9 +134,9 @@ also \helpref{GetBitmap}{wxwizardpagegetbitmap}.} \docparam{pos}{The position of the dialog, it will be centered on the screen by default.} -\membersection{wxWizard::Fit}\label{wxwizardfit} +\membersection{wxWizard::FitToPage}\label{wxwizardfittopage} -\func{void}{Fit}{\param{const wxWizardPage* }{firstPage}} +\func{void}{FittoPage}{\param{const wxWizardPage* }{firstPage}} Sets the page size to be big enough for all the pages accessible via the given {\it firstPage}, i.e. this page, its next page and so on. diff --git a/docs/publicity/publicity.txt b/docs/publicity/publicity.txt index 362a44be1c..565119023c 100644 --- a/docs/publicity/publicity.txt +++ b/docs/publicity/publicity.txt @@ -32,7 +32,7 @@ comp.windows.x.motif News and links sites: ----------------------- -slashdot.org, freshmeat.net +slashdot.org, freshmeat.net, http://lwn.net/ Many of these links will be out of date now: diff --git a/docs/tech/tn0010.htm b/docs/tech/tn0010.htm index c8b8063f0a..8476f9a079 100644 --- a/docs/tech/tn0010.htm +++ b/docs/tech/tn0010.htm @@ -24,7 +24,7 @@ Compiling wxWindows applications in the VC++ IDE

-Settings for wxWindows 2 / Settings for wxWindows 1.68 +Settings for wxWindows 2.2 / Settings for wxWindows 1.68

@@ -44,9 +44,10 @@ installation path.

-

Settings for wxWindows 2

+

Settings for wxWindows 2.2

-These settings apply to wxWindows 2.1.14 and above.

+These settings apply to wxWindows 2.1.14 and above but most of them are not +necessary any longer for wxWindows 2.3+.

General
@@ -206,77 +207,6 @@ Select your .rc file. The Additional resource include directories field s
-

- - - - - diff --git a/include/wx/arrimpl.cpp b/include/wx/arrimpl.cpp index 8296608a01..46f94e5dab 100644 --- a/include/wx/arrimpl.cpp +++ b/include/wx/arrimpl.cpp @@ -75,6 +75,8 @@ void name::RemoveAt(size_t uiIndex, size_t nRemove) \ \ void name::Add(const T& item, size_t nInsert) \ { \ + if (nInsert == 0) \ + return; \ T* pItem = new T(item); \ size_t nOldSize = GetCount(); \ if ( pItem != NULL ) \ @@ -85,6 +87,8 @@ void name::Add(const T& item, size_t nInsert) \ \ void name::Insert(const T& item, size_t uiIndex, size_t nInsert) \ { \ + if (nInsert == 0) \ + return; \ T* pItem = new T(item); \ if ( pItem != NULL ) \ wxBaseArrayPtrVoid::Insert(pItem, uiIndex, nInsert); \ diff --git a/include/wx/db.h b/include/wx/db.h index e43e77db95..531a348d53 100644 --- a/include/wx/db.h +++ b/include/wx/db.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: db.h +// Name: wx/db.h // Purpose: Header file wxDb class. The wxDb class represents a connection // to an ODBC data source. The wxDb class allows operations on the data // source such as opening and closing the data source. @@ -32,13 +32,8 @@ // /////////////////////////////////////////////////////////////////////////////// -/* -// SYNOPSIS START -// SYNOPSIS STOP -*/ - -#ifndef DB_DOT_H -#define DB_DOT_H +#ifndef _WX_DB_H_ +#define _WX_DB_H_ // BJO 20000503: introduce new GetColumns members which are more database independant and @@ -58,36 +53,40 @@ #include "wx/string.h" #ifdef __VISUALC__ -// include standard Windows headers -#if defined(__WXMSW__) && !wxUSE_MFC - #ifndef STRICT - #define STRICT 1 - #endif + // we need to include standard Windows headers but we can't include + // directly when using MFC because it includes it itself in a + // different manner + #if wxUSE_MFC + #include + #else // !wxUSE_MFC + #ifndef STRICT + #define STRICT 1 + #endif - #include - #include "wx/msw/winundef.h" -#endif + #include + #include "wx/msw/winundef.h" + #endif // wxUSE_MFC/!wxUSE_MFC -// If you use the wxDbCreateDataSource() function with MSW/VC6, -// you cannot use the iODBC headers, you must use the VC headers, -// plus the odbcinst.h header - gt Nov 2 2000 -// -// Must add "odbccp32.lib" in \wx2\wxWindows\src\makevc.env to the WINLIBS= line -// + // If you use the wxDbCreateDataSource() function with MSW/VC6, + // you cannot use the iODBC headers, you must use the VC headers, + // plus the odbcinst.h header - gt Nov 2 2000 + // + // Must add "odbccp32.lib" in \wx2\wxWindows\src\makevc.env to the WINLIBS= line + // #include "sql.h" #include "sqlext.h" #include "odbcinst.h" #elif defined( __VMS ) -// For OpenVMS use the ones from the library -extern "C" { - #include - #include -} -#else -extern "C" { - #include "wx/isql.h" - #include "wx/isqlext.h" -} + // For OpenVMS use the ones from the library + extern "C" { + #include + #include + } +#else // !__VISUALC__, !__VMS + extern "C" { + #include "wx/isql.h" + #include "wx/isqlext.h" + } #endif @@ -772,10 +771,11 @@ bool WXDLLEXPORT FreeDbConnection(wxDB *pDb); void WXDLLEXPORT CloseDbConnections(void); int WXDLLEXPORT NumberDbConnectionsInUse(void); -bool SqlLog(sqlLog state, const char *filename = SQL_LOG_FILENAME); +bool SqlLog(sqlLog state, const wxChar *filename = SQL_LOG_FILENAME); bool WXDLLEXPORT GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDescMax, UWORD direction = SQL_FETCH_NEXT); #endif // Deprecated structures/classes/functions -#endif +#endif // _WX_DB_H_ + diff --git a/include/wx/generic/filedlgg.h b/include/wx/generic/filedlgg.h index 452a01cf6a..41e4ba171a 100644 --- a/include/wx/generic/filedlgg.h +++ b/include/wx/generic/filedlgg.h @@ -89,13 +89,16 @@ public: void OnHome( wxCommandEvent &event ); void OnListOk( wxCommandEvent &event ); void OnNew( wxCommandEvent &event ); - void OnChoice( wxCommandEvent &event ); + void OnChoiceFilter( wxCommandEvent &event ); void OnTextEnter( wxCommandEvent &event ); void OnCheck( wxCommandEvent &event ); void HandleAction( const wxString &fn ); protected: + // use the filter with the given index + void DoSetFilterIndex(int filterindex); + wxString m_message; long m_dialogStyle; wxString m_dir; diff --git a/include/wx/generic/mdig.h b/include/wx/generic/mdig.h index 2a5ab74f22..467bddfef4 100644 --- a/include/wx/generic/mdig.h +++ b/include/wx/generic/mdig.h @@ -63,7 +63,7 @@ public: #if wxUSE_MENUS wxMenu* GetWindowMenu() const { return m_pWindowMenu; }; - void SetWindowMenu(wxMenu* pMenu); + void SetWindowMenu(wxMenu* pMenu); virtual void SetMenuBar(wxMenuBar *pMenuBar); #endif // wxUSE_MENUS @@ -134,13 +134,13 @@ public: long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr ); -#if wxUSE_MENUS +#if wxUSE_MENUS virtual void SetMenuBar( wxMenuBar *menu_bar ); virtual wxMenuBar *GetMenuBar() const; -#endif // wxUSE_MENUS +#endif // wxUSE_MENUS virtual void SetTitle(const wxString& title); - virtual wxString GetTitle(); + virtual wxString GetTitle() const; virtual void Activate(); @@ -187,8 +187,8 @@ public: virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return FALSE; } virtual bool IsFullScreen() const { return FALSE; } - virtual bool IsTopLevel() const { return FALSE; } - + virtual bool IsTopLevel() const { return FALSE; } + void OnMenuHighlight(wxMenuEvent& event); void OnActivate(wxActivateEvent& event); @@ -206,7 +206,7 @@ protected: #if wxUSE_MENUS wxMenuBar *m_pMenuBar; -#endif // wxUSE_MENUS +#endif // wxUSE_MENUS protected: void Init(); @@ -214,7 +214,7 @@ protected: virtual void DoMoveWindow(int x, int y, int width, int height); // This function needs to be called when a size change is confirmed, - // we needed this function to prevent any body from the outside + // we needed this function to prevent any body from the outside // changing the panel... it messes the UI layout when we would allow it. void ApplyMDIChildFrameRect(); @@ -256,7 +256,7 @@ private: */ #ifndef wxUSE_GENERIC_MDI_AS_NATIVE -#if defined(__WXUNIVERSAL__) +#if defined(__WXUNIVERSAL__) || defined(__WXPM__) #define wxUSE_GENERIC_MDI_AS_NATIVE 1 #else #define wxUSE_GENERIC_MDI_AS_NATIVE 0 diff --git a/include/wx/generic/panelg.h b/include/wx/generic/panelg.h index b7f14c0af2..cb4a5f7769 100644 --- a/include/wx/generic/panelg.h +++ b/include/wx/generic/panelg.h @@ -82,8 +82,8 @@ public: virtual void InitDialog(); #ifdef __WXUNIVERSAL__ - virtual bool IsCanvasWindow() { return TRUE; } - virtual bool ProvidesBackground() { return TRUE; } + virtual bool IsCanvasWindow() const { return TRUE; } + virtual bool ProvidesBackground() const { return TRUE; } #endif WX_DECLARE_CONTROL_CONTAINER(); diff --git a/include/wx/generic/sashwin.h b/include/wx/generic/sashwin.h index f21b76c8a3..73648209eb 100644 --- a/include/wx/generic/sashwin.h +++ b/include/wx/generic/sashwin.h @@ -144,6 +144,11 @@ public: // Adjusts the panes void OnSize(wxSizeEvent& event); +#ifdef __WXMSW__ + // Handle cursor correctly + void OnSetCursor(wxSetCursorEvent& event); +#endif // wxMSW + // Draws borders void DrawBorders(wxDC& dc); @@ -189,6 +194,7 @@ private: wxColour m_hilightColour; wxColour m_faceColour; bool m_mouseCaptured; + wxCursor* m_currentCursor; DECLARE_EVENT_TABLE() }; diff --git a/include/wx/gtk/region.h b/include/wx/gtk/region.h index 7c224ab08b..51e739c73f 100644 --- a/include/wx/gtk/region.h +++ b/include/wx/gtk/region.h @@ -146,11 +146,11 @@ public: void Reset() { m_current = 0u; } void Reset(const wxRegion& region); - operator bool () const; bool HaveRects() const; + operator bool () const { return HaveRects(); } - void operator ++ (); - void operator ++ (int); + wxRegionIterator& operator ++ (); + wxRegionIterator operator ++ (int); wxCoord GetX() const; wxCoord GetY() const; diff --git a/include/wx/gtk1/region.h b/include/wx/gtk1/region.h index 7c224ab08b..51e739c73f 100644 --- a/include/wx/gtk1/region.h +++ b/include/wx/gtk1/region.h @@ -146,11 +146,11 @@ public: void Reset() { m_current = 0u; } void Reset(const wxRegion& region); - operator bool () const; bool HaveRects() const; + operator bool () const { return HaveRects(); } - void operator ++ (); - void operator ++ (int); + wxRegionIterator& operator ++ (); + wxRegionIterator operator ++ (int); wxCoord GetX() const; wxCoord GetY() const; diff --git a/include/wx/html/helpfrm.h b/include/wx/html/helpfrm.h index 11a5e82961..3e0e6e9264 100644 --- a/include/wx/html/helpfrm.h +++ b/include/wx/html/helpfrm.h @@ -33,7 +33,9 @@ #include "wx/stattext.h" #include "wx/html/htmlwin.h" #include "wx/html/htmprint.h" + class WXDLLEXPORT wxButton; +class WXDLLEXPORT wxTextCtrl; // style flags for the Help Frame diff --git a/include/wx/list.h b/include/wx/list.h index 886c744618..03260003d7 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -193,7 +193,7 @@ private: class WXDLLEXPORT wxListBase : public wxObject { -friend class wxNodeBase; // should be able to call DetachNode() +friend class WXDLLEXPORT wxNodeBase; // should be able to call DetachNode() friend class wxHashTableBase; // should be able to call untyped Find() private: // common part of all ctors diff --git a/include/wx/mac/app.h b/include/wx/mac/app.h index bbc96c1099..0241b2e649 100644 --- a/include/wx/mac/app.h +++ b/include/wx/mac/app.h @@ -109,6 +109,8 @@ public: static bool s_macDefaultEncodingIsPC ; static bool s_macSupportPCMenuShortcuts ; static long s_macAboutMenuItemId ; + static long s_macPreferencesMenuItemId ; + static long s_macExitMenuItemId ; static wxString s_macHelpMenuTitleName ; static bool s_macHasAppearance ; diff --git a/include/wx/mac/menu.h b/include/wx/mac/menu.h index 4c79dbf2aa..6ed7985df9 100644 --- a/include/wx/mac/menu.h +++ b/include/wx/mac/menu.h @@ -63,7 +63,6 @@ public: // implementation only from now on // ------------------------------- - bool MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum) ; int MacGetIndexFromId( int id ) ; int MacGetIndexFromItem( wxMenuItem *pItem ) ; void MacEnableMenu( bool bDoEnable ) ; @@ -176,7 +175,6 @@ public: void Refresh(bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL); void MacInstallMenuBar() ; - void MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum) ; static wxMenuBar* MacGetInstalledMenuBar() { return s_macInstalledMenuBar ; } protected: diff --git a/include/wx/mac/private.h b/include/wx/mac/private.h index f34b32ea62..341d5307c7 100644 --- a/include/wx/mac/private.h +++ b/include/wx/mac/private.h @@ -129,7 +129,7 @@ PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ; CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ; void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ; CTabHandle wxMacCreateColorTable( int numColors ) ; -void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , bool forceColorIcon = false ) ; +void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ; #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a))) #define MAC_WXHBITMAP(a) (GWorldPtr(a)) diff --git a/include/wx/mac/textctrl.h b/include/wx/mac/textctrl.h index 1d9b218333..5c2c753c43 100644 --- a/include/wx/mac/textctrl.h +++ b/include/wx/mac/textctrl.h @@ -152,7 +152,8 @@ public: void OnUpdateRedo(wxUpdateUIEvent& event); virtual bool MacCanFocus() const { return true ; } - + virtual bool MacSetupCursor( const wxPoint& pt ) ; + virtual void MacSuperShown( bool show ) ; virtual bool Show(bool show = TRUE) ; diff --git a/include/wx/mac/window.h b/include/wx/mac/window.h index 6018e46219..cef26853e1 100644 --- a/include/wx/mac/window.h +++ b/include/wx/mac/window.h @@ -242,7 +242,7 @@ public: virtual void Update() ; // for compatibility void MacUpdateImmediately() { Update() ; } - bool MacSetupCursor( const wxPoint& pt ) ; + virtual bool MacSetupCursor( const wxPoint& pt ) ; // virtual bool MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* rootwin ) ; // virtual void MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin ) ; diff --git a/include/wx/motif/statbox.h b/include/wx/motif/statbox.h index a2a31bdcb7..38a5e89ebd 100644 --- a/include/wx/motif/statbox.h +++ b/include/wx/motif/statbox.h @@ -55,20 +55,11 @@ public: // Implementation virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - WXWidget GetTopWidget() const { return m_formWidget; } - WXWidget GetLabelWidget() const { return m_labelWidget; } protected: // Motif-specific - WXWidget m_formWidget; WXWidget m_labelWidget; - - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - + private: DECLARE_EVENT_TABLE() }; diff --git a/include/wx/msw/brush.h b/include/wx/msw/brush.h index ccc307e118..842e259d27 100644 --- a/include/wx/msw/brush.h +++ b/include/wx/msw/brush.h @@ -50,8 +50,8 @@ public: bool Ok() const { return m_refData != NULL; } - // create (if necessary) and return the HBRUSH for this brush - WXHBRUSH GetResourceHandle() const; + // return the HBRUSH for this brush + virtual WXHANDLE GetResourceHandle() const; protected: virtual wxObjectRefData *CreateRefData() const; diff --git a/include/wx/msw/checkbox.h b/include/wx/msw/checkbox.h index 97cf1d32b5..57603fc9a0 100644 --- a/include/wx/msw/checkbox.h +++ b/include/wx/msw/checkbox.h @@ -17,31 +17,37 @@ #endif // Checkbox item (single checkbox) -class WXDLLEXPORT wxBitmap; class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase { public: wxCheckBox() { } - wxCheckBox(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) + wxCheckBox(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) { Create(parent, id, label, pos, size, style, validator, name); } - bool Create(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); virtual void SetValue(bool value); - virtual bool GetValue() const ; + virtual bool GetValue() const; + + virtual void SetLabel(const wxString& label); virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual void SetLabel(const wxString& label); virtual void Command(wxCommandEvent& event); protected: @@ -51,32 +57,5 @@ private: DECLARE_DYNAMIC_CLASS(wxCheckBox) }; -class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox -{ -DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) - -public: - int checkWidth ; - int checkHeight ; - - wxBitmapCheckBox() { checkWidth = -1; checkHeight = -1; } - wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, const wxBitmap *bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - virtual void SetLabel(const wxBitmap& bitmap); -}; - #endif // _WX_CHECKBOX_H_ diff --git a/include/wx/msw/checklst.h b/include/wx/msw/checklst.h index 7b7db054e4..ffc70a0a51 100644 --- a/include/wx/msw/checklst.h +++ b/include/wx/msw/checklst.h @@ -64,7 +64,7 @@ public: protected: // we create our items ourselves and they have non-standard size, // so we need to override these functions - virtual wxOwnerDrawn *CreateItem(size_t n); + virtual wxOwnerDrawn *CreateLboxItem(size_t n); virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); // this can't be called DoHitTest() because wxWindow already has this method diff --git a/include/wx/msw/dialog.h b/include/wx/msw/dialog.h index 3a779079b4..2c3b5b2088 100644 --- a/include/wx/msw/dialog.h +++ b/include/wx/msw/dialog.h @@ -20,6 +20,8 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; +class WXDLLEXPORT wxWindowDisabler; + // Dialog boxes class WXDLLEXPORT wxDialog : public wxDialogBase { @@ -115,7 +117,7 @@ private: // while we are showing a modal dialog we disable the other windows using // this object - class wxWindowDisabler *m_windowDisabler; + wxWindowDisabler *m_windowDisabler; DECLARE_DYNAMIC_CLASS(wxDialog) DECLARE_EVENT_TABLE() diff --git a/include/wx/msw/font.h b/include/wx/msw/font.h index 06c17b10b1..505e9970b9 100644 --- a/include/wx/msw/font.h +++ b/include/wx/msw/font.h @@ -90,11 +90,10 @@ public: virtual bool IsFree() const; virtual bool RealizeResource(); - virtual WXHANDLE GetResourceHandle(); + virtual WXHANDLE GetResourceHandle() const; virtual bool FreeResource(bool force = FALSE); - // for consistency with other wxMSW classes and to have a const - // GetResourceHandle()-like function we have a synonym for it + // for consistency with other wxMSW classes WXHFONT GetHFONT() const; /* diff --git a/include/wx/msw/gdiimage.h b/include/wx/msw/gdiimage.h index 0dca4c7931..3bf601dda4 100644 --- a/include/wx/msw/gdiimage.h +++ b/include/wx/msw/gdiimage.h @@ -180,7 +180,7 @@ public: // forward some of base class virtuals to wxGDIImageRefData bool FreeResource(bool force = FALSE); - virtual WXHANDLE GetResourceHandle(); + virtual WXHANDLE GetResourceHandle() const; protected: // create the data for the derived class here diff --git a/include/wx/msw/gdiobj.h b/include/wx/msw/gdiobj.h index e7285541d1..7ea71fbec2 100644 --- a/include/wx/msw/gdiobj.h +++ b/include/wx/msw/gdiobj.h @@ -49,7 +49,7 @@ public: bool IsNull() const { return (m_refData == 0); } // Returns handle. - virtual WXHANDLE GetResourceHandle() { return 0; } + virtual WXHANDLE GetResourceHandle() const { return 0; } virtual bool GetVisible() { return m_visible; } virtual void SetVisible(bool v) { m_visible = v; } diff --git a/include/wx/msw/listbox.h b/include/wx/msw/listbox.h index 0021cc304f..0c5161b91f 100644 --- a/include/wx/msw/listbox.h +++ b/include/wx/msw/listbox.h @@ -95,7 +95,7 @@ public: bool MSWOnDraw(WXDRAWITEMSTRUCT *item); // plug-in for derived classes - virtual wxOwnerDrawn *CreateItem(size_t n); + virtual wxOwnerDrawn *CreateLboxItem(size_t n); // allows to get the item and use SetXXX functions to set it's appearance wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } diff --git a/include/wx/msw/pen.h b/include/wx/msw/pen.h index 3c56bdaa70..a653d39db0 100644 --- a/include/wx/msw/pen.h +++ b/include/wx/msw/pen.h @@ -89,7 +89,7 @@ public: // Internal bool RealizeResource(); bool FreeResource(bool force = FALSE); - WXHANDLE GetResourceHandle() ; + WXHANDLE GetResourceHandle() const; bool IsFree() const; void Unshare(); }; diff --git a/include/wx/msw/region.h b/include/wx/msw/region.h index 72f8dfcd02..bb1e56cea6 100644 --- a/include/wx/msw/region.h +++ b/include/wx/msw/region.h @@ -5,7 +5,7 @@ // Modified by: // Created: 01/02/97 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart +// Copyright: (c) 1997-2002 wxWindows team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,10 +13,9 @@ #define _WX_REGION_H_ #ifdef __GNUG__ -#pragma interface "region.h" + #pragma interface "region.h" #endif -#include "wx/list.h" #include "wx/gdiobj.h" #include "wx/gdicmn.h" @@ -93,11 +92,11 @@ public: // Outer bounds of region void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const; - wxRect GetBox(void) const ; + wxRect GetBox() const ; // Is region empty? - bool Empty(void) const; - inline bool IsEmpty(void) const { return Empty(); } + bool Empty() const; + inline bool IsEmpty() const { return Empty(); } // Tests // Does the region contain the point (x,y)? @@ -129,31 +128,39 @@ protected: class WXDLLEXPORT wxRegionIterator : public wxObject { public: - wxRegionIterator(void); + wxRegionIterator() { Init(); } wxRegionIterator(const wxRegion& region); - ~wxRegionIterator(void); + wxRegionIterator(const wxRegionIterator& ri) { Init(); *this = ri; } - void Reset(void) { m_current = 0; } + wxRegionIterator& operator=(const wxRegionIterator& ri); + + virtual ~wxRegionIterator(); + + void Reset() { m_current = 0; } void Reset(const wxRegion& region); + bool HaveRects() const { return (m_current < m_numRects); } + #ifndef __SALFORDC__ - operator bool (void) const { return (m_current < m_numRects); } + operator bool () const { return HaveRects(); } #endif - bool HaveRects(void) const { return (m_current < m_numRects); } + wxRegionIterator& operator++(); + wxRegionIterator operator++(int); - void operator ++ (void); - void operator ++ (int); + wxCoord GetX() const; + wxCoord GetY() const; + wxCoord GetW() const; + wxCoord GetWidth() const { return GetW(); } + wxCoord GetH() const; + wxCoord GetHeight() const { return GetH(); } - wxCoord GetX(void) const; - wxCoord GetY(void) const; - wxCoord GetW(void) const; - wxCoord GetWidth(void) const { return GetW(); } - wxCoord GetH(void) const; - wxCoord GetHeight(void) const { return GetH(); } - wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); } + wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); } private: + // common part of all ctors + void Init(); + long m_current; long m_numRects; wxRegion m_region; diff --git a/include/wx/msw/stattext.h b/include/wx/msw/stattext.h index 29561640a9..20c49b73a4 100644 --- a/include/wx/msw/stattext.h +++ b/include/wx/msw/stattext.h @@ -48,7 +48,6 @@ protected: virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags = wxSIZE_AUTO); virtual wxSize DoGetBestSize() const; - virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); DECLARE_DYNAMIC_CLASS(wxStaticText) }; diff --git a/include/wx/object.h b/include/wx/object.h index 4fcb3c178c..be4a7bbc3f 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -501,7 +501,7 @@ protected: class WXDLLEXPORT wxObjectRefData { - friend class wxObject; + friend class WXDLLEXPORT wxObject; public: wxObjectRefData() : m_count(1) { } diff --git a/include/wx/strconv.h b/include/wx/strconv.h index 7b4b2255f3..050fbac84a 100644 --- a/include/wx/strconv.h +++ b/include/wx/strconv.h @@ -54,6 +54,9 @@ public: const wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); } const wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); } #endif // Unicode/ANSI + + // virtual dtor for any base class + virtual ~wxMBConv(); }; WXDLLEXPORT_DATA(extern wxMBConv) wxConvLibc; @@ -115,7 +118,7 @@ public: virtual ~wxCSConv(); wxCSConv& operator=(const wxCSConv& conv); - + void LoadNow(); virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const; diff --git a/include/wx/univ/listbox.h b/include/wx/univ/listbox.h index aa608cfba6..363f523ac8 100644 --- a/include/wx/univ/listbox.h +++ b/include/wx/univ/listbox.h @@ -129,10 +129,10 @@ public: void Activate(int item = -1); // select or unselect the specified or current (if -1) item - void Select(bool sel = TRUE, int item = -1); + void DoSelect(int item = -1, bool sel = TRUE); // more readable wrapper - void Unselect(int item) { Select(FALSE, item); } + void DoUnselect(int item) { DoSelect(item, FALSE); } // select an item and send a notification about it void SelectAndNotify(int item); diff --git a/include/wx/univ/toplevel.h b/include/wx/univ/toplevel.h index 9edcf899f6..e9265722ee 100644 --- a/include/wx/univ/toplevel.h +++ b/include/wx/univ/toplevel.h @@ -36,7 +36,7 @@ enum wxTOPLEVEL_BUTTON_MAXIMIZE = 0x02000000, wxTOPLEVEL_BUTTON_ICONIZE = 0x04000000, wxTOPLEVEL_BUTTON_RESTORE = 0x08000000, - wxTOPLEVEL_BUTTON_HELP = 0x10000000, + wxTOPLEVEL_BUTTON_HELP = 0x10000000 }; // frame hit test return values: @@ -143,7 +143,7 @@ public: virtual int GetMinWidth() const; virtual int GetMinHeight() const; - virtual bool ProvidesBackground() { return TRUE; } + virtual bool ProvidesBackground() const { return TRUE; } protected: // handle titlebar button click event diff --git a/include/wx/univ/window.h b/include/wx/univ/window.h index 673dddf1e3..2c0d484df6 100644 --- a/include/wx/univ/window.h +++ b/include/wx/univ/window.h @@ -179,7 +179,7 @@ public: // to be used with function above: transparent windows get // their background from parents that return TRUE here, // so this is mostly for wxPanel, wxTopLevelWindow etc. - virtual bool ProvidesBackground() { return FALSE; } + virtual bool ProvidesBackground() const { return FALSE; } // return TRUE if this control can be highlighted when the mouse is over // it (the theme decides itself whether it is really highlighted or not) diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h index 31bbb35f47..5a1b12b0d1 100644 --- a/include/wx/wxchar.h +++ b/include/wx/wxchar.h @@ -257,6 +257,7 @@ #define wxStrcoll _tcscoll #define wxStrcpy _tcscpy #define wxStrcspn _tcscspn + #define wxStrdup _tcsdup #define wxStrftime _tcsftime #define wxStricmp _tcsicmp #define wxStrnicmp _tcsnicmp diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index ca37a9cfa7..f52356bd72 100644 --- a/include/wx/xrc/xmlres.h +++ b/include/wx/xrc/xmlres.h @@ -37,6 +37,9 @@ class WXDLLEXPORT wxFrame; class WXDLLEXPORT wxToolBar; class WXXMLDLLEXPORT wxXmlResourceHandler; +class WXXMLDLLEXPORT wxXmlSubclassFactory; +class WXXMLDLLEXPORT wxXmlSubclassFactoriesList; +class wxXmlResourceModule; // These macros indicate current version of XML resources (this information is @@ -133,6 +136,11 @@ public: // Removes all handlers void ClearHandlers(); + + // Registers subclasses factory for use in XRC. This function is not meant + // for public use, please see the comment above wxXmlSubclassFactory + // definition. + static void AddSubclassFactory(wxXmlSubclassFactory *factory); // Loads menu from resource. Returns NULL on failure. wxMenu *LoadMenu(const wxString& name); @@ -244,6 +252,9 @@ private: #endif friend class wxXmlResourceHandler; + friend class wxXmlResourceModule; + + static wxXmlSubclassFactoriesList *ms_subclassFactories; // singleton instance: static wxXmlResource *ms_instance; @@ -438,6 +449,20 @@ protected: void wxXmlInitResourceModule(); +// This class is used to create instances of XRC "object" nodes with "subclass" +// property. It is _not_ supposed to be used by XRC users, you should instead +// register your subclasses via wxWindows' RTTI mechanism. This class is useful +// only for language bindings developer who need a way to implement subclassing +// in wxWindows ports that don't support wxRTTI (e.g. wxPython). +class WXXMLDLLEXPORT wxXmlSubclassFactory +{ +public: + // Try to create instance of given class and return it, return NULL on failure: + virtual wxObject *Create(const wxString& className) = 0; + virtual ~wxXmlSubclassFactory() {} +}; + + /* ------------------------------------------------------------------------- Backward compatibility macros. Do *NOT* use, they may disappear in future versions of the XRC library! diff --git a/samples/configure.in b/samples/configure.in index 46bb5016ef..e412e8d77b 100644 --- a/samples/configure.in +++ b/samples/configure.in @@ -63,12 +63,17 @@ AC_OUTPUT([ mobile/Makefile mobile/wxedit/Makefile mobile/styles/Makefile + multimon/Makefile + nativedlg/Makefile newgrid/Makefile notebook/Makefile + oleauto/Makefile + ownerdrw/Makefile png/Makefile printing/Makefile proplist/Makefile propsize/Makefile + regtest/Makefile resource/Makefile rotate/Makefile sashtest/Makefile diff --git a/samples/console/console.cpp b/samples/console/console.cpp index d63263979a..410911209c 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -1766,7 +1766,7 @@ static void TestMimeFilename() wxFileType::MessageParameters(fname, _T(""))) ) cmd = _T(""); else - cmd = wxString('"') + cmd + '"'; + cmd = wxString(_T('"')) + cmd + _T('"'); wxPrintf(_T("To open %s (%s) do %s.\n"), fname.c_str(), desc.c_str(), cmd.c_str()); diff --git a/samples/console/console.dsp b/samples/console/console.dsp index c665160353..a6cfa8d063 100644 --- a/samples/console/console.dsp +++ b/samples/console/console.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /machine:I386 ..\..\lib\wxbase232u.lib +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:console /machine:I386 ..\..\lib\wxbase233u.lib !IF "$(CFG)" == "console - Win32 Debug Unicode DLL" @@ -76,7 +76,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ..\..\lib\wxbase232ud.lib +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ..\..\lib\wxbase233ud.lib !IF "$(CFG)" == "console - Win32 Release Unicode" @@ -99,7 +99,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /machine:I386 ..\..\lib\zlib.lib ..\..\lib\regex.lib ..\..\lib\wxbaseu.lib +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:console /machine:I386 ..\..\lib\zlib.lib ..\..\lib\regex.lib ..\..\lib\wxbaseu.lib !IF "$(CFG)" == "console - Win32 Debug Unicode" @@ -122,7 +122,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ..\..\lib\zlibd.lib ..\..\lib\regexd.lib ..\..\lib\wxbaseud.lib +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ..\..\lib\zlibd.lib ..\..\lib\regexd.lib ..\..\lib\wxbaseud.lib !IF "$(CFG)" == "console - Win32 Release DLL" @@ -145,7 +145,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /machine:I386 ..\..\lib\wxbase232.lib +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:console /machine:I386 ..\..\lib\wxbase233.lib !IF "$(CFG)" == "console - Win32 Debug DLL" @@ -168,7 +168,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ..\..\lib\wxbase232d.lib +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ..\..\lib\wxbase233d.lib !IF "$(CFG)" == "console - Win32 Release" @@ -191,7 +191,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /machine:I386 ..\..\lib\zlib.lib ..\..\lib\regex.lib ..\..\lib\wxbase.lib +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:console /machine:I386 ..\..\lib\zlib.lib ..\..\lib\regex.lib ..\..\lib\wxbase.lib !IF "$(CFG)" == "console - Win32 Debug" @@ -214,7 +214,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ..\..\lib\zlibd.lib ..\..\lib\regexd.lib ..\..\lib\wxbased.lib +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ..\..\lib\zlibd.lib ..\..\lib\regexd.lib ..\..\lib\wxbased.lib !ENDIF diff --git a/samples/console/makefile.b32 b/samples/console/makefile.b32 new file mode 100644 index 0000000000..76aa03aa5a --- /dev/null +++ b/samples/console/makefile.b32 @@ -0,0 +1,16 @@ +# +# File: makefile.b32 +# Author: Julian Smart +# Created: 1999 +# Updated: +# Copyright: +# +# Makefile : Builds sample for 32-bit BC++ + +WXDIR = $(WXWIN) + +TARGET=console +OBJECTS = $(TARGET).obj + +!include $(WXDIR)\src\makeprog.b32 + diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 059006ed3c..6ef90dcc7a 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -534,16 +534,16 @@ void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) ) wxFileDialog dialog(this, _T("Testing save file dialog"), _T(""), - _T("myletter.txt"), + _T("myletter.doc"), _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"), wxSAVE|wxOVERWRITE_PROMPT); + dialog.SetFilterIndex(1); + if (dialog.ShowModal() == wxID_OK) { - wxChar buf[400]; - wxSprintf(buf, _T("%s, filter %d"), (const wxChar*)dialog.GetPath(), dialog.GetFilterIndex()); - wxMessageDialog dialog2(this, wxString(buf), _T("Selected path")); - dialog2.ShowModal(); + wxLogMessage(_T("%s, filter %d"), + dialog.GetPath().c_str(), dialog.GetFilterIndex()); } } @@ -557,8 +557,7 @@ void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) ) if (dialog.ShowModal() == wxID_OK) { - wxMessageDialog dialog2(this, dialog.GetPath(), _T("Selected path")); - dialog2.ShowModal(); + wxLogMessage(_T("Selected path: %s"), dialog.GetPath().c_str()); } } diff --git a/samples/multimon/Makefile.in b/samples/multimon/Makefile.in new file mode 100644 index 0000000000..f3c2192412 --- /dev/null +++ b/samples/multimon/Makefile.in @@ -0,0 +1,23 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1998 +# Updated: +# Copyright: (c) 1998 Julian Smart +# +# "%W% %G%" +# +# Makefile for multimon example (UNIX). + +top_srcdir = @top_srcdir@/.. +top_builddir = ../.. +program_dir = samples/multimon + +PROGRAM=multimon_test + +OBJECTS =$(PROGRAM).o +DEPFILES=$(PROGRAM).d + +include ../../src/makeprog.env + +@IF_GNU_MAKE@-include $(DEPFILES) diff --git a/samples/nativdlg/Makefile.in b/samples/nativdlg/Makefile.in new file mode 100644 index 0000000000..5270185df6 --- /dev/null +++ b/samples/nativdlg/Makefile.in @@ -0,0 +1,23 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1998 +# Updated: +# Copyright: (c) 1998 Julian Smart +# +# "%W% %G%" +# +# Makefile for nativedlg example (UNIX). + +top_srcdir = @top_srcdir@/.. +top_builddir = ../.. +program_dir = samples/nativedlg + +PROGRAM=nativedlg + +OBJECTS =$(PROGRAM).o +DEPFILES=$(PROGRAM).d + +include ../../src/makeprog.env + +@IF_GNU_MAKE@-include $(DEPFILES) diff --git a/samples/newgrid/griddemo.cpp b/samples/newgrid/griddemo.cpp index 5557e3743c..e1820b8a53 100644 --- a/samples/newgrid/griddemo.cpp +++ b/samples/newgrid/griddemo.cpp @@ -246,7 +246,13 @@ GridFrame::GridFrame() // this will create a grid and, by default, an associated grid // table for strings - grid->CreateGrid( 100, 100 ); + grid->CreateGrid( 0, 0 ); + grid->AppendRows(100); + grid->AppendCols(100); + + int ir = grid->GetNumberRows(); + grid->DeleteRows(0, ir); + grid->AppendRows(ir); grid->SetRowSize( 0, 60 ); grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" ); diff --git a/samples/oleauto/Makefile.in b/samples/oleauto/Makefile.in new file mode 100644 index 0000000000..fd2aaba9a2 --- /dev/null +++ b/samples/oleauto/Makefile.in @@ -0,0 +1,23 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1998 +# Updated: +# Copyright: (c) 1998 Julian Smart +# +# "%W% %G%" +# +# Makefile for oleauto example (UNIX). + +top_srcdir = @top_srcdir@/.. +top_builddir = ../.. +program_dir = samples/oleauto + +PROGRAM=oleauto + +OBJECTS =$(PROGRAM).o +DEPFILES=$(PROGRAM).d + +include ../../src/makeprog.env + +@IF_GNU_MAKE@-include $(DEPFILES) diff --git a/samples/opengl/penguin/makefile.unx b/samples/opengl/penguin/makefile.unx index 778d905184..bc26127d08 100644 --- a/samples/opengl/penguin/makefile.unx +++ b/samples/opengl/penguin/makefile.unx @@ -11,22 +11,22 @@ OPENGL_LIBS=-lGL -lGLU #if you have old Mesa, try this: #OPENGL_LIBS=-lMesaGL -lMesaGLU -CPP = g++ +CC = $(shell wx-config --cc) CXX = $(shell wx-config --cxx) Penguin: penguin.o trackball.o lw.o - $(CPP) -o Penguin \ + $(CXX) -o Penguin \ penguin.o trackball.o lw.o \ `wx-config --libs` -lwx_gtk_gl $(OPENGL_LIBS) penguin.o: penguin.cpp - $(CPP) `wx-config --cxxflags` -I../../gtk -c penguin.cpp + $(CXX) `wx-config --cxxflags` -I../../gtk -c penguin.cpp lw.o: lw.cpp - $(CPP) `wx-config --cxxflags` -I../../gtk -c lw.cpp + $(CXX) `wx-config --cxxflags` -I../../gtk -c lw.cpp trackball.o: trackball.c - $(CXX) `wx-config --cxxflags` -I../../gtk -c trackball.c + $(CC) `wx-config --cflags` -I../../gtk -c trackball.c clean: rm -f *.o Penguin diff --git a/samples/ownerdrw/Makefile.in b/samples/ownerdrw/Makefile.in new file mode 100644 index 0000000000..dcd63259b4 --- /dev/null +++ b/samples/ownerdrw/Makefile.in @@ -0,0 +1,23 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1998 +# Updated: +# Copyright: (c) 1998 Julian Smart +# +# "%W% %G%" +# +# Makefile for owner draw example (UNIX). + +top_srcdir = @top_srcdir@/.. +top_builddir = ../.. +program_dir = samples/ownerdrw + +PROGRAM=ownerdrw + +OBJECTS =$(PROGRAM).o +DEPFILES=$(PROGRAM).d + +include ../../src/makeprog.env + +@IF_GNU_MAKE@-include $(DEPFILES) diff --git a/samples/regtest/Makefile.in b/samples/regtest/Makefile.in new file mode 100644 index 0000000000..4ad13b651f --- /dev/null +++ b/samples/regtest/Makefile.in @@ -0,0 +1,23 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1998 +# Updated: +# Copyright: (c) 1998 Julian Smart +# +# "%W% %G%" +# +# Makefile for regtest example (UNIX). + +top_srcdir = @top_srcdir@/.. +top_builddir = ../.. +program_dir = samples/regtest + +PROGRAM=regtest + +OBJECTS =$(PROGRAM).o +DEPFILES=$(PROGRAM).d + +include ../../src/makeprog.env + +@IF_GNU_MAKE@-include $(DEPFILES) diff --git a/samples/stc/Makefile.in b/samples/stc/Makefile.in index cffdcc78d7..0de249989a 100644 --- a/samples/stc/Makefile.in +++ b/samples/stc/Makefile.in @@ -13,7 +13,7 @@ PROGRAM=stctest OBJECTS=$(PROGRAM).o -APPEXTRALIBS=$(top_builddir)/lib/libstc.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_stc-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include DATAFILES=stctest.cpp diff --git a/samples/svg/Makefile.in b/samples/svg/Makefile.in index 8c63b68960..5f1ba42210 100644 --- a/samples/svg/Makefile.in +++ b/samples/svg/Makefile.in @@ -9,7 +9,7 @@ PROGRAM=svgtest OBJECTS=svgtest.o -APPEXTRALIBS=$(top_builddir)/lib/libwx_dcsvg.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_dcsvg-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index 9eea80a9d9..0a849c5b3f 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -140,6 +140,9 @@ private: m_horzToolbar; size_t m_rows; // 1 or 2 only + // the number of print buttons we have (they're added/removed dynamically) + size_t m_nPrint; + wxTextCtrl *m_textWindow; wxToolBar *m_tbar; @@ -301,11 +304,11 @@ void MyFrame::RecreateToolbar() if ( m_horzToolbar ) { wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, "", wxDefaultPosition, wxSize(200,-1) ); - combo->Append("This"); - combo->Append("is a"); - combo->Append("combobox"); - combo->Append("in a"); - combo->Append("toolbar"); + combo->Append(_T("This")); + combo->Append(_T("is a")); + combo->Append(_T("combobox")); + combo->Append(_T("in a")); + combo->Append(_T("toolbar")); toolBar->AddControl(combo); } #endif // toolbars which don't support controls @@ -339,11 +342,12 @@ MyFrame::MyFrame(wxFrame* parent, : wxFrame(parent, id, title, pos, size, style) { m_tbar = NULL; - m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE); + m_textWindow = new wxTextCtrl(this, -1, _T(""), wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE); m_smallToolbar = TRUE; m_horzToolbar = TRUE; m_rows = 1; + m_nPrint = 1; // Give it a status line CreateStatusBar(); @@ -354,49 +358,49 @@ MyFrame::MyFrame(wxFrame* parent, // Make a menubar wxMenu *tbarMenu = new wxMenu; tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_TOOLBAR, - "Toggle &toolbar\tCtrl-Z", - "Show or hide the toolbar"); + _T("Toggle &toolbar\tCtrl-Z"), + _T("Show or hide the toolbar")); tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, - "Toggle &another toolbar\tCtrl-A", - "Show/hide another test toolbar"); + _T("Toggle &another toolbar\tCtrl-A"), + _T("Show/hide another test toolbar")); tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARSIZE, - "&Toggle toolbar size\tCtrl-S", - "Toggle between big/small toolbar"); + _T("&Toggle toolbar size\tCtrl-S"), + _T("Toggle between big/small toolbar")); tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARORIENT, - "Toggle toolbar &orientation\tCtrl-O", - "Toggle toolbar orientation"); + _T("Toggle toolbar &orientation\tCtrl-O"), + _T("Toggle toolbar orientation")); tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARROWS, - "Toggle number of &rows\tCtrl-R", - "Toggle number of toolbar rows between 1 and 2"); + _T("Toggle number of &rows\tCtrl-R"), + _T("Toggle number of toolbar rows between 1 and 2")); tbarMenu->AppendSeparator(); - tbarMenu->Append(IDM_TOOLBAR_ENABLEPRINT, "&Enable print button\tCtrl-E", ""); - tbarMenu->Append(IDM_TOOLBAR_DELETEPRINT, "&Delete print button\tCtrl-D", ""); - tbarMenu->Append(IDM_TOOLBAR_INSERTPRINT, "&Insert print button\tCtrl-I", ""); - tbarMenu->Append(IDM_TOOLBAR_TOGGLEHELP, "Toggle &help button\tCtrl-T", ""); + tbarMenu->Append(IDM_TOOLBAR_ENABLEPRINT, _T("&Enable print button\tCtrl-E"), _T("")); + tbarMenu->Append(IDM_TOOLBAR_DELETEPRINT, _T("&Delete print button\tCtrl-D"), _T("")); + tbarMenu->Append(IDM_TOOLBAR_INSERTPRINT, _T("&Insert print button\tCtrl-I"), _T("")); + tbarMenu->Append(IDM_TOOLBAR_TOGGLEHELP, _T("Toggle &help button\tCtrl-T"), _T("")); tbarMenu->AppendSeparator(); - tbarMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, "Change tool tip", ""); + tbarMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, _T("Change tool tip"), _T("")); tbarMenu->AppendSeparator(); - tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_TEXT, "Show &text\tAlt-T"); - tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_ICONS, "Show &icons\tAlt-I"); - tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, "Show &both\tAlt-B"); + tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_TEXT, _T("Show &text\tAlt-T")); + tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_ICONS, _T("Show &icons\tAlt-I")); + tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, _T("Show &both\tAlt-B")); wxMenu *fileMenu = new wxMenu; - fileMenu->Append(wxID_EXIT, "E&xit\tAlt-X", "Quit toolbar sample" ); + fileMenu->Append(wxID_EXIT, _T("E&xit\tAlt-X"), _T("Quit toolbar sample") ); wxMenu *helpMenu = new wxMenu; - helpMenu->Append(wxID_HELP, "&About", "About toolbar sample"); + helpMenu->Append(wxID_HELP, _T("&About"), _T("About toolbar sample")); wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE ); - menuBar->Append(fileMenu, "&File"); - menuBar->Append(tbarMenu, "&Toolbar"); - menuBar->Append(helpMenu, "&Help"); + menuBar->Append(fileMenu, _T("&File")); + menuBar->Append(tbarMenu, _T("&Toolbar")); + menuBar->Append(helpMenu, _T("&Help")); // Associate the menu bar with the frame SetMenuBar(menuBar); @@ -530,7 +534,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - (void)wxMessageBox("wxWindows toolbar sample", "About wxToolBar"); + (void)wxMessageBox(_T("wxWindows toolbar sample"), _T("About wxToolBar")); } void MyFrame::OnToolLeftClick(wxCommandEvent& event) @@ -570,18 +574,22 @@ void MyFrame::OnCombo(wxCommandEvent& event) void MyFrame::DoEnablePrint() { + if ( !m_nPrint ) + return; + wxToolBarBase *tb = GetToolBar(); - if (tb->GetToolEnabled(wxID_PRINT)) - tb->EnableTool( wxID_PRINT, FALSE ); - else - tb->EnableTool( wxID_PRINT, TRUE ); + tb->EnableTool(wxID_PRINT, !tb->GetToolEnabled(wxID_PRINT)); } void MyFrame::DoDeletePrint() { - wxToolBarBase *tb = GetToolBar(); + if ( !m_nPrint ) + return; + wxToolBarBase *tb = GetToolBar(); tb->DeleteTool( wxID_PRINT ); + + m_nPrint--; } void MyFrame::DoToggleHelp() @@ -624,14 +632,17 @@ void MyFrame::OnToolbarStyle(wxCommandEvent& event) void MyFrame::OnInsertPrint(wxCommandEvent& WXUNUSED(event)) { - wxBitmap bmp = wxBITMAP(print); + m_nPrint++; - GetToolBar()->InsertTool(0, wxID_PRINT, bmp, wxNullBitmap, - FALSE, (wxObject *) NULL, - "Delete this tool", - "This button was inserted into the toolbar"); + wxToolBarBase *tb = GetToolBar(); + tb->InsertTool(0, wxID_PRINT, _T("New print"), + wxBITMAP(print), wxNullBitmap, + wxITEM_NORMAL, + _T("Delete this tool"), + _T("This button was inserted into the toolbar")); - GetToolBar()->Realize(); + // must call Realize() after adding a new button + tb->Realize(); } void MyFrame::OnToolEnter(wxCommandEvent& event) @@ -643,6 +654,6 @@ void MyFrame::OnToolEnter(wxCommandEvent& event) SetStatusText(str); } else - SetStatusText(""); + SetStatusText(_T("")); } diff --git a/samples/widgets/notebook.cpp b/samples/widgets/notebook.cpp index 4491785d2f..6eb8b1ae65 100644 --- a/samples/widgets/notebook.cpp +++ b/samples/widgets/notebook.cpp @@ -380,18 +380,17 @@ void NotebookWidgetsPage::CreateNotebook() if ( notebook ) { - int sel = notebook->GetSelection(); + const int sel = notebook->GetSelection(); - int count = notebook->GetPageCount(); + const int count = notebook->GetPageCount(); + + // recreate the pages for ( int n = 0; n < count; n++ ) { - wxNotebookPage *page = notebook->GetPage(0); - page->Reparent(m_notebook); - - m_notebook->AddPage(page, notebook->GetPageText(0), FALSE, - notebook->GetPageImage(0)); - - notebook->RemovePage(0); + m_notebook->AddPage(CreateNewPage(), + notebook->GetPageText(n), + FALSE, + notebook->GetPageImage(n)); } m_sizerNotebook->Remove(notebook); @@ -543,4 +542,4 @@ void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event) event.Skip(); } -#endif \ No newline at end of file +#endif diff --git a/samples/xrc/Makefile.in b/samples/xrc/Makefile.in index 74b1001946..81d9b9a620 100644 --- a/samples/xrc/Makefile.in +++ b/samples/xrc/Makefile.in @@ -16,7 +16,7 @@ OBJECTS=$(PROGRAM).o \ derivdlg.o \ custclas.o -APPEXTRALIBS=$(top_builddir)/lib/libwxxrc.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_xrc-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include DATADIRS = rc diff --git a/setup.h.in b/setup.h.in index 071a63dbc0..31d49960a7 100644 --- a/setup.h.in +++ b/setup.h.in @@ -83,6 +83,7 @@ #undef __FREEBSD__ #undef __DARWIN__ #undef __NETBSD__ +#undef __OPENBSD__ #undef __VMS__ #undef __ULTRIX__ #undef __DATA_GENERAL__ diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index cfd1d3df14..32c2fe5e00 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -446,8 +446,23 @@ bool wxAppBase::CheckBuildOptions(const wxBuildOptions& opts) if ( !(wxCMP(isDebug) && wxCMP(verMaj) && wxCMP(verMin)) ) { - wxLogFatalError(_T("Mismatch between the program and library build ") - _T("versions detected.")); + wxString msg; + wxString libDebug, progDebug; + + if (isDebug) + libDebug = wxT("debug"); + else + libDebug = wxT("no debug"); + + if (opts.m_isDebug) + progDebug = wxT("debug"); + else + progDebug = wxT("no debug"); + + msg.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %d.%d (%s), and your program used %d.%d (%s)."), + verMaj, verMin, libDebug.c_str(), opts.m_verMaj, opts.m_verMin, progDebug.c_str()); + + wxLogFatalError(msg); // normally wxLogFatalError doesn't return return FALSE; diff --git a/src/common/containr.cpp b/src/common/containr.cpp index daf414ce55..7ca89fb072 100644 --- a/src/common/containr.cpp +++ b/src/common/containr.cpp @@ -288,39 +288,18 @@ bool wxControlContainer::DoSetFocus() wxLogTrace(_T("focus"), _T("SetFocus on wxPanel 0x%08lx."), (unsigned long)m_winParent->GetHandle()); - // If the panel gets the focus *by way of getting it set directly* - // we move the focus to the first window that can get it. + // when the panel gets the focus we move the focus to either the last + // window that had the focus or the first one that can get it unless the + // focus had been already set to some other child - // VZ: no, we set the focus to the last window too. I don't understand why - // should we make this distinction: if an app wants to set focus to - // some precise control, it may always do it directly, but if we don't - // use m_winLastFocused here, the focus won't be set correctly after a - // notebook page change nor after frame activation under MSW (it calls - // SetFocus too) - // - // RR: yes, when I the tab key to navigate in a panel with some controls and - // a notebook and the focus jumps to the notebook (typically coming from - // a button at the top) the notebook should focus the first child in the - // current notebook page, not the last one which would otherwise get the - // focus if you used the tab key to navigate from the current notebook - // page to button at the bottom. See every page in the controls sample. - // - // VZ: ok, but this still doesn't (at least I don't see how it can) take - // care of first/last child problem: i.e. if Shift-TAB is pressed in a - // situation like above, the focus should be given to the last child, - // not the first one (and not to the last focused one neither) - I - // think my addition to OnNavigationKey() above takes care of it. - // Keeping #ifdef __WXGTK__ for now, but please try removing it and see - // what happens. - // - // RR: Removed for now. Let's see what happens.. - - // if our child already has focus, don't take it away from it wxWindow *win = wxWindow::FindFocus(); while ( win ) { if ( win == m_winParent ) + { + // our child already has focus, don't take it away from it return TRUE; + } if ( win->IsTopLevel() ) { @@ -341,10 +320,7 @@ void wxControlContainer::HandleOnFocus(wxFocusEvent& event) (unsigned long)m_winParent->GetHandle(), m_winParent->GetName().c_str() ); - // If we panel got the focus *by way of getting clicked on* - // we move the focus to either the last window that had the - // focus or the first one that can get it. - (void)SetFocusToChild(); + DoSetFocus(); event.Skip(); } diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index d874e1a2fe..e1b894b63c 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -40,7 +40,6 @@ #include "wx/containr.h" #endif - //-------------------------------------------------------------------------- // wxDialogBase //-------------------------------------------------------------------------- @@ -72,6 +71,20 @@ void wxDialogBase::Init() wxSizer *wxDialogBase::CreateTextSizer( const wxString& message ) { + bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); + + wxString text = message; + + // I admit that this is complete bogus, but it makes + // message boxes work for pda screens temporarily.. + int max_width = -1; + if (is_pda) + { + max_width = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) - 25; + text += wxT('\n'); + } + + wxBoxSizer *box = new wxBoxSizer( wxVERTICAL ); // get line height for empty lines @@ -79,18 +92,19 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString& message ) wxFont font( GetFont() ); if (!font.Ok()) font = *wxSWISS_FONT; - GetTextExtent(_T("H"), (int*)NULL, &y, (int*)NULL, (int*)NULL, &font); + GetTextExtent( wxT("H"), (int*)NULL, &y, (int*)NULL, (int*)NULL, &font); + size_t last_space = 0; wxString line; - for ( size_t pos = 0; pos < message.length(); pos++ ) + for ( size_t pos = 0; pos < text.length(); pos++ ) { - switch ( message[pos] ) + switch ( text[pos] ) { - case _T('\n'): + case wxT('\n'): if (!line.IsEmpty()) { - wxStaticText *s1 = new wxStaticText( this, -1, line ); - box->Add( s1 ); + wxStaticText *s = new wxStaticText( this, -1, line ); + box->Add( s ); line = wxT(""); } else @@ -99,17 +113,44 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString& message ) } break; - case _T('&'): + case wxT('&'): // this is used as accel mnemonic prefix in the wxWindows // controls but in the static messages created by // CreateTextSizer() (used by wxMessageBox, for example), we // don't want this special meaning, so we need to quote it - line += _T('&'); + line += wxT('&'); // fall through to add it normally too default: + if (text[pos] == wxT(' ')) + last_space = pos; + line += message[pos]; + + if (is_pda) + { + int width = 0; + GetTextExtent( line, &width, (int*)NULL, (int*)NULL, (int*)NULL, &font ); + + if (width > max_width) + { + // exception if there was no previous space + if (last_space == 0) + last_space = pos; + + int diff = pos-last_space; + int len = line.Len(); + line.Remove( len-diff, diff ); + + wxStaticText *s = new wxStaticText( this, -1, line ); + box->Add( s ); + + pos = last_space; + last_space = 0; + line = wxT(""); + } + } } } @@ -129,7 +170,29 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString& message ) wxSizer *wxDialogBase::CreateButtonSizer( long flags ) { - wxBoxSizer *box = new wxBoxSizer( wxHORIZONTAL ); + bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); + + wxBoxSizer *box = NULL; + + // If we have a PDA screen, put yes/no button over + // all other buttons, otherwise on the left side. + if (is_pda) + box = new wxBoxSizer( wxVERTICAL ); + else + box = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer *inner_yes_no = NULL; + + // Only create sizer containing yes/no + // if it is actually required + if ( (flags & wxYES_NO) != 0 ) + { + inner_yes_no = new wxBoxSizer( wxHORIZONTAL ); + box->Add( inner_yes_no, 0, wxBOTTOM, 10 ); + } + + wxBoxSizer *inner_rest = new wxBoxSizer( wxHORIZONTAL ); + box->Add( inner_rest, 0, 0, 0 ); #if defined(__WXMSW__) || defined(__WXMAC__) static const int margin = 6; @@ -149,39 +212,39 @@ wxSizer *wxDialogBase::CreateButtonSizer( long flags ) if (flags & wxYES) { yes = new wxButton( this, wxID_YES, _("Yes"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ); - box->Add( yes, 0, wxLEFT|wxRIGHT, margin ); + inner_yes_no->Add( yes, 0, wxLEFT|wxRIGHT, margin ); } if (flags & wxNO) { no = new wxButton( this, wxID_NO, _("No"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ); - box->Add( no, 0, wxLEFT|wxRIGHT, margin ); + inner_yes_no->Add( no, 0, wxLEFT|wxRIGHT, margin ); } if (flags & wxOK) { ok = new wxButton( this, wxID_OK, _("OK"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ); - box->Add( ok, 0, wxLEFT|wxRIGHT, margin ); + inner_rest->Add( ok, 0, wxLEFT|wxRIGHT, margin ); } if (flags & wxFORWARD) - box->Add( new wxButton( this, wxID_FORWARD, _("Forward"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); + inner_rest->Add( new wxButton( this, wxID_FORWARD, _("Forward"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); if (flags & wxBACKWARD) - box->Add( new wxButton( this, wxID_BACKWARD, _("Backward"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); + inner_rest->Add( new wxButton( this, wxID_BACKWARD, _("Backward"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); if (flags & wxSETUP) - box->Add( new wxButton( this, wxID_SETUP, _("Setup"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); + inner_rest->Add( new wxButton( this, wxID_SETUP, _("Setup"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); if (flags & wxMORE) - box->Add( new wxButton( this, wxID_MORE, _("More..."),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); + inner_rest->Add( new wxButton( this, wxID_MORE, _("More..."),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); if (flags & wxHELP) - box->Add( new wxButton( this, wxID_HELP, _("Help"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); + inner_rest->Add( new wxButton( this, wxID_HELP, _("Help"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ), 0, wxLEFT|wxRIGHT, margin ); if (flags & wxCANCEL) { cancel = new wxButton( this, wxID_CANCEL, _("Cancel"),wxDefaultPosition,wxDefaultSize,wxCLIP_SIBLINGS ); - box->Add( cancel, 0, wxLEFT|wxRIGHT, margin ); + inner_rest->Add( cancel, 0, wxLEFT|wxRIGHT, margin ); } // choose the default button diff --git a/src/common/dynarray.cpp b/src/common/dynarray.cpp index 1b3a0353b9..4d0ee51d28 100644 --- a/src/common/dynarray.cpp +++ b/src/common/dynarray.cpp @@ -110,7 +110,7 @@ name& name::operator=(const name& src) \ void name::Grow(size_t nIncrement) \ { \ /* only do it if no more place */ \ - if( m_nCount == m_nSize ) { \ + if( (m_nCount == m_nSize) || ((m_nSize - m_nCount) < nIncrement) ) { \ if( m_nSize == 0 ) { \ /* was empty, determine initial size */ \ size_t size = WX_ARRAY_DEFAULT_INITIAL_SIZE; \ @@ -253,6 +253,8 @@ int name::Index(T lItem, CMPFUNC fnCompare) const \ /* add item at the end */ \ void name::Add(T lItem, size_t nInsert) \ { \ + if (nInsert == 0) \ + return; \ Grow(nInsert); \ for (size_t i = 0; i < nInsert; i++) \ m_pItems[m_nCount++] = lItem; \ @@ -271,6 +273,8 @@ void name::Insert(T lItem, size_t nIndex, size_t nInsert) \ wxCHECK_RET( m_nCount <= m_nCount + nInsert, \ wxT("array size overflow in wxArray::Insert") ); \ \ + if (nInsert == 0) \ + return; \ Grow(nInsert); \ \ memmove(&m_pItems[nIndex + nInsert], &m_pItems[nIndex], \ diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 5ef534169b..199d111fee 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -851,37 +851,62 @@ bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue) { - wxConfigPathChanger path(this, key); + wxConfigPathChanger path(this, key); + wxString strName = path.Name(); + + wxLogTrace( _T("wxFileConfig"), + _T(" Writing String '%s' = '%s' to Group '%s'"), + strName.c_str(), + szValue.c_str(), + GetPath().c_str() ); - wxString strName = path.Name(); - if ( strName.IsEmpty() ) { - // setting the value of a group is an error - wxASSERT_MSG( wxIsEmpty(szValue), wxT("can't set value of a group!") ); + if ( strName.IsEmpty() ) + { + // setting the value of a group is an error - // ... except if it's empty in which case it's a way to force it's creation - m_pCurrentGroup->SetDirty(); + wxASSERT_MSG( wxIsEmpty(szValue), wxT("can't set value of a group!") ); - // this will add a line for this group if it didn't have it before - (void)m_pCurrentGroup->GetGroupLine(); - } - else { - // writing an entry + // ... except if it's empty in which case it's a way to force it's creation - // check that the name is reasonable - if ( strName[0u] == wxCONFIG_IMMUTABLE_PREFIX ) { - wxLogError(_("Config entry name cannot start with '%c'."), - wxCONFIG_IMMUTABLE_PREFIX); - return FALSE; + wxLogTrace( _T("wxFileConfig"), + _T(" Creating group %s"), + m_pCurrentGroup->Name().c_str() ); + + m_pCurrentGroup->SetDirty(); + + // this will add a line for this group if it didn't have it before + + (void)m_pCurrentGroup->GetGroupLine(); + } + else + { + // writing an entry + // check that the name is reasonable + + if ( strName[0u] == wxCONFIG_IMMUTABLE_PREFIX ) + { + wxLogError( _("Config entry name cannot start with '%c'."), + wxCONFIG_IMMUTABLE_PREFIX); + return FALSE; + } + + wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strName); + + if ( pEntry == 0 ) + { + wxLogTrace( _T("wxFileConfig"), + _T(" Adding Entry %s"), + strName.c_str() ); + pEntry = m_pCurrentGroup->AddEntry(strName); + } + + wxLogTrace( _T("wxFileConfig"), + _T(" Setting value %s"), + szValue.c_str() ); + pEntry->SetValue(szValue); } - wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strName); - if ( pEntry == NULL ) - pEntry = m_pCurrentGroup->AddEntry(strName); - - pEntry->SetValue(szValue); - } - - return TRUE; + return TRUE; } bool wxFileConfig::DoWriteLong(const wxString& key, long lValue) @@ -1048,74 +1073,135 @@ bool wxFileConfig::DeleteAll() // linked list functions // ---------------------------------------------------------------------------- -// append a new line to the end of the list + // append a new line to the end of the list + wxFileConfigLineList *wxFileConfig::LineListAppend(const wxString& str) { - wxFileConfigLineList *pLine = new wxFileConfigLineList(str); + wxLogTrace( _T("wxFileConfig"), + _T(" ** Adding Line '%s'"), + str.c_str() ); + wxLogTrace( _T("wxFileConfig"), + _T(" head: %s"), + ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); + wxLogTrace( _T("wxFileConfig"), + _T(" tail: %s"), + ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); - if ( m_linesTail == NULL ) { - // list is empty - m_linesHead = pLine; - } - else { - // adjust pointers - m_linesTail->SetNext(pLine); - pLine->SetPrev(m_linesTail); - } + wxFileConfigLineList *pLine = new wxFileConfigLineList(str); - m_linesTail = pLine; - return m_linesTail; + if ( m_linesTail == NULL ) + { + // list is empty + m_linesHead = pLine; + } + else + { + // adjust pointers + m_linesTail->SetNext(pLine); + pLine->SetPrev(m_linesTail); + } + + m_linesTail = pLine; + + wxLogTrace( _T("wxFileConfig"), + _T(" head: %s"), + ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); + wxLogTrace( _T("wxFileConfig"), + _T(" tail: %s"), + ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); + + return m_linesTail; } -// insert a new line after the given one or in the very beginning if !pLine + // insert a new line after the given one or in the very beginning if !pLine + wxFileConfigLineList *wxFileConfig::LineListInsert(const wxString& str, - wxFileConfigLineList *pLine) + wxFileConfigLineList *pLine) { - if ( pLine == m_linesTail ) - return LineListAppend(str); + wxLogTrace( _T("wxFileConfig"), + _T(" ** Inserting Line '%s' after '%s'"), + str.c_str(), + ((pLine) ? pLine->Text().c_str() : wxEmptyString) ); + wxLogTrace( _T("wxFileConfig"), + _T(" head: %s"), + ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); + wxLogTrace( _T("wxFileConfig"), + _T(" tail: %s"), + ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); - wxFileConfigLineList *pNewLine = new wxFileConfigLineList(str); - if ( pLine == NULL ) { - // prepend to the list - pNewLine->SetNext(m_linesHead); - m_linesHead->SetPrev(pNewLine); - m_linesHead = pNewLine; - } - else { - // insert before pLine - wxFileConfigLineList *pNext = pLine->Next(); - pNewLine->SetNext(pNext); - pNewLine->SetPrev(pLine); - pNext->SetPrev(pNewLine); - pLine->SetNext(pNewLine); - } + if ( pLine == m_linesTail ) + return LineListAppend(str); - return pNewLine; + wxFileConfigLineList *pNewLine = new wxFileConfigLineList(str); + if ( pLine == NULL ) + { + // prepend to the list + pNewLine->SetNext(m_linesHead); + m_linesHead->SetPrev(pNewLine); + m_linesHead = pNewLine; + } + else + { + // insert before pLine + wxFileConfigLineList *pNext = pLine->Next(); + pNewLine->SetNext(pNext); + pNewLine->SetPrev(pLine); + pNext->SetPrev(pNewLine); + pLine->SetNext(pNewLine); + } + + wxLogTrace( _T("wxFileConfig"), + _T(" head: %s"), + ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); + wxLogTrace( _T("wxFileConfig"), + _T(" tail: %s"), + ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); + + return pNewLine; } void wxFileConfig::LineListRemove(wxFileConfigLineList *pLine) { - wxFileConfigLineList *pPrev = pLine->Prev(), - *pNext = pLine->Next(); + wxLogTrace( _T("wxFileConfig"), + _T(" ** Removing Line '%s'"), + pLine->Text().c_str() ); + wxLogTrace( _T("wxFileConfig"), + _T(" head: %s"), + ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); + wxLogTrace( _T("wxFileConfig"), + _T(" tail: %s"), + ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); - // first entry? - if ( pPrev == NULL ) - m_linesHead = pNext; - else - pPrev->SetNext(pNext); + wxFileConfigLineList *pPrev = pLine->Prev(), + *pNext = pLine->Next(); - // last entry? - if ( pNext == NULL ) - m_linesTail = pPrev; - else - pNext->SetPrev(pPrev); + // first entry? - delete pLine; + if ( pPrev == NULL ) + m_linesHead = pNext; + else + pPrev->SetNext(pNext); + + // last entry? + + if ( pNext == NULL ) + m_linesTail = pPrev; + else + pNext->SetPrev(pPrev); + + wxLogTrace( _T("wxFileConfig"), + _T(" head: %s"), + ((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) ); + wxLogTrace( _T("wxFileConfig"), + _T(" tail: %s"), + ((m_linesTail) ? m_linesTail->Text().c_str() : wxEmptyString) ); + + delete pLine; } bool wxFileConfig::LineListIsEmpty() { - return m_linesHead == NULL; + return m_linesHead == NULL; } // ============================================================================ @@ -1163,9 +1249,8 @@ wxFileConfigGroup::~wxFileConfigGroup() void wxFileConfigGroup::SetLine(wxFileConfigLineList *pLine) { - wxASSERT( m_pLine == NULL ); // shouldn't be called twice - - m_pLine = pLine; + wxASSERT( m_pLine == 0 ); // shouldn't be called twice + m_pLine = pLine; } /* @@ -1204,27 +1289,42 @@ void wxFileConfigGroup::SetLine(wxFileConfigLineList *pLine) // have it or in the very beginning if we're the root group. wxFileConfigLineList *wxFileConfigGroup::GetGroupLine() { - if ( m_pLine == NULL ) { - wxFileConfigGroup *pParent = Parent(); + wxLogTrace( _T("wxFileConfig"), + _T(" GetGroupLine() for Group '%s'"), + Name().c_str() ); - // this group wasn't present in local config file, add it now - if ( pParent != NULL ) { - wxString strFullName; - strFullName << wxT("[") - // +1: no '/' - << FilterOutEntryName(GetFullName().c_str() + 1) - << wxT("]"); - m_pLine = m_pConfig->LineListInsert(strFullName, - pParent->GetLastGroupLine()); - pParent->SetLastGroup(this); // we're surely after all the others - } - else { - // we return NULL, so that LineListInsert() will insert us in the - // very beginning - } - } + if ( m_pLine == 0 ) + { + wxLogTrace( _T("wxFileConfig"), + _T(" Getting Line item pointer") ); - return m_pLine; + wxFileConfigGroup *pParent = Parent(); + + // this group wasn't present in local config file, add it now + + if ( pParent != 0 ) + { + wxLogTrace( _T("wxFileConfig"), + _T(" checking parent '%s'"), + pParent->Name().c_str() ); + + wxString strFullName; + + strFullName << wxT("[") // +1: no '/' + << FilterOutEntryName(GetFullName().c_str() + 1) + << wxT("]"); + m_pLine = m_pConfig->LineListInsert(strFullName, + pParent->GetLastGroupLine()); + pParent->SetLastGroup(this); // we're surely after all the others + } + else + { + // we return NULL, so that LineListInsert() will insert us in the + // very beginning + } + } + + return m_pLine; } // Return the last line belonging to the subgroups of this group (after which @@ -1232,17 +1332,20 @@ wxFileConfigLineList *wxFileConfigGroup::GetGroupLine() // last line is the group line (m_pLine) itself. wxFileConfigLineList *wxFileConfigGroup::GetLastGroupLine() { - // if we have any subgroups, our last line is the last line of the last - // subgroup - if ( m_pLastGroup != NULL ) { - wxFileConfigLineList *pLine = m_pLastGroup->GetLastGroupLine(); + // if we have any subgroups, our last line is + // the last line of the last subgroup - wxASSERT( pLine != NULL ); // last group must have !NULL associated line - return pLine; - } + if ( m_pLastGroup != 0 ) + { + wxFileConfigLineList *pLine = m_pLastGroup->GetLastGroupLine(); - // no subgroups, so the last line is the line of thelast entry (if any) - return GetLastEntryLine(); + wxASSERT( pLine != 0 ); // last group must have !NULL associated line + return pLine; + } + + // no subgroups, so the last line is the line of thelast entry (if any) + + return GetLastEntryLine(); } // return the last line belonging to the entries of this group (after which @@ -1250,15 +1353,21 @@ wxFileConfigLineList *wxFileConfigGroup::GetLastGroupLine() // one immediately after the group line itself. wxFileConfigLineList *wxFileConfigGroup::GetLastEntryLine() { - if ( m_pLastEntry != NULL ) { - wxFileConfigLineList *pLine = m_pLastEntry->GetLine(); + wxLogTrace( _T("wxFileConfig"), + _T(" GetLastEntryLine() for Group '%s'"), + Name().c_str() ); - wxASSERT( pLine != NULL ); // last entry must have !NULL associated line - return pLine; - } + if ( m_pLastEntry != 0 ) + { + wxFileConfigLineList *pLine = m_pLastEntry->GetLine(); - // no entries: insert after the group header - return GetGroupLine(); + wxASSERT( pLine != 0 ); // last entry must have !NULL associated line + return pLine; + } + + // no entries: insert after the group header + + return GetGroupLine(); } // ---------------------------------------------------------------------------- @@ -1355,27 +1464,25 @@ wxFileConfigGroup::FindSubgroup(const wxChar *szName) const // ---------------------------------------------------------------------------- // create a new entry and add it to the current group -wxFileConfigEntry * -wxFileConfigGroup::AddEntry(const wxString& strName, int nLine) +wxFileConfigEntry *wxFileConfigGroup::AddEntry(const wxString& strName, int nLine) { - wxASSERT( FindEntry(strName) == NULL ); + wxASSERT( FindEntry(strName) == 0 ); - wxFileConfigEntry *pEntry = new wxFileConfigEntry(this, strName, nLine); - m_aEntries.Add(pEntry); + wxFileConfigEntry *pEntry = new wxFileConfigEntry(this, strName, nLine); - return pEntry; + m_aEntries.Add(pEntry); + return pEntry; } // create a new group and add it to the current group -wxFileConfigGroup * -wxFileConfigGroup::AddSubgroup(const wxString& strName) +wxFileConfigGroup *wxFileConfigGroup::AddSubgroup(const wxString& strName) { - wxASSERT( FindSubgroup(strName) == NULL ); + wxASSERT( FindSubgroup(strName) == 0 ); - wxFileConfigGroup *pGroup = new wxFileConfigGroup(this, strName, m_pConfig); - m_aSubgroups.Add(pGroup); + wxFileConfigGroup *pGroup = new wxFileConfigGroup(this, strName, m_pConfig); - return pGroup; + m_aSubgroups.Add(pGroup); + return pGroup; } // ---------------------------------------------------------------------------- @@ -1394,71 +1501,146 @@ bool wxFileConfigGroup::DeleteSubgroupByName(const wxChar *szName) return DeleteSubgroup(FindSubgroup(szName)); } -// doesn't delete the subgroup itself, but does remove references to it from -// all other data structures (and normally the returned pointer should be -// deleted a.s.a.p. because there is nothing much to be done with it anyhow) +// Delete the subgroup and remove all references to it from +// other data structures. bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup) { - wxCHECK( pGroup != NULL, FALSE ); // deleting non existing group? + wxLogTrace( _T("wxFileConfig"), + _T("Deleting group '%s' from '%s'"), + pGroup->Name().c_str(), + Name().c_str() ); - // delete all entries - size_t nCount = pGroup->m_aEntries.Count(); - for ( size_t nEntry = 0; nEntry < nCount; nEntry++ ) { - wxFileConfigLineList *pLine = pGroup->m_aEntries[nEntry]->GetLine(); - if ( pLine != NULL ) - m_pConfig->LineListRemove(pLine); - } + wxLogTrace( _T("wxFileConfig"), + _T(" (m_pLine) = prev: %p, this %p, next %p"), + ((m_pLine) ? m_pLine->Prev() : 0), + m_pLine, + ((m_pLine) ? m_pLine->Next() : 0) ); + wxLogTrace( _T("wxFileConfig"), + _T(" text: '%s'"), + ((m_pLine) ? m_pLine->Text().c_str() : wxEmptyString) ); - // and subgroups of this sungroup - nCount = pGroup->m_aSubgroups.Count(); - for ( size_t nGroup = 0; nGroup < nCount; nGroup++ ) { - pGroup->DeleteSubgroup(pGroup->m_aSubgroups[0]); - } + wxCHECK_MSG( pGroup != 0, FALSE, _T("deleting non existing group?") ); - wxFileConfigLineList *pLine = pGroup->m_pLine; - if ( pLine != NULL ) { - // notice that we may do this test inside the previous "if" because the - // last entry's line is surely !NULL - if ( pGroup == m_pLastGroup ) { - // our last entry is being deleted - find the last one which stays - wxASSERT( m_pLine != NULL ); // we have a subgroup with !NULL pLine... + // delete all entries - // go back until we find a subgroup or reach the group's line - wxFileConfigGroup *pNewLast = NULL; - size_t n, nSubgroups = m_aSubgroups.Count(); - wxFileConfigLineList *pl; - for ( pl = pLine->Prev(); pl != m_pLine; pl = pl->Prev() ) { - // is it our subgroup? - for ( n = 0; (pNewLast == NULL) && (n < nSubgroups); n++ ) { - // do _not_ call GetGroupLine! we don't want to add it to the local - // file if it's not already there - if ( m_aSubgroups[n]->m_pLine == m_pLine ) - pNewLast = m_aSubgroups[n]; + size_t nCount = pGroup->m_aEntries.Count(); + + wxLogTrace( _T("wxFileConfig"), + _T(" Removing %u Entries"), + nCount ); + + for ( size_t nEntry = 0; nEntry < nCount; nEntry++ ) + { + wxFileConfigLineList *pLine = pGroup->m_aEntries[nEntry]->GetLine(); + + if ( pLine != 0 ) + { + wxLogTrace( _T("wxFileConfig"), + _T(" '%s'"), + pLine->Text().c_str() ); + m_pConfig->LineListRemove(pLine); } - - if ( pNewLast != NULL ) // found? - break; - } - - if ( pl == m_pLine ) { - wxASSERT( !pNewLast ); // how comes it has the same line as we? - - // we've reached the group line without finding any subgroups - m_pLastGroup = NULL; - } - else - m_pLastGroup = pNewLast; } - m_pConfig->LineListRemove(pLine); - } + // and subgroups of this subgroup - SetDirty(); + nCount = pGroup->m_aSubgroups.Count(); - m_aSubgroups.Remove(pGroup); - delete pGroup; + wxLogTrace( _T("wxFileConfig"), + _T(" Removing %u SubGroups"), + nCount ); - return TRUE; + for ( size_t nGroup = 0; nGroup < nCount; nGroup++ ) + { + pGroup->DeleteSubgroup(pGroup->m_aSubgroups[0]); + } + + // finally the group itself + + wxFileConfigLineList *pLine = pGroup->m_pLine; + + if ( pLine != 0 ) + { + wxLogTrace( _T("wxFileConfig"), + _T(" Removing line entry for Group '%s' : '%s'"), + pGroup->Name().c_str(), + pLine->Text().c_str() ); + wxLogTrace( _T("wxFileConfig"), + _T(" Removing from Group '%s' : '%s'"), + Name().c_str(), + ((m_pLine) ? m_pLine->Text().c_str() : wxEmptyString) ); + + // notice that we may do this test inside the previous "if" + // because the last entry's line is surely !NULL + + if ( pGroup == m_pLastGroup ) + { + wxLogTrace( _T("wxFileConfig"), + _T(" ------- Removing last group -------") ); + + // our last entry is being deleted, so find the last one which stays. + // go back until we find a subgroup or reach the group's line, unless + // we are the root group, which we'll notice shortly. + + wxFileConfigGroup *pNewLast = 0; + size_t nSubgroups = m_aSubgroups.Count(); + wxFileConfigLineList *pl; + + for ( pl = pLine->Prev(); pl != m_pLine; pl = pl->Prev() ) + { + // is it our subgroup? + + for ( size_t n = 0; (pNewLast == 0) && (n < nSubgroups); n++ ) + { + // do _not_ call GetGroupLine! we don't want to add it to the local + // file if it's not already there + + if ( m_aSubgroups[n]->m_pLine == m_pLine ) + pNewLast = m_aSubgroups[n]; + } + + if ( pNewLast != 0 ) // found? + break; + } + + if ( pl == m_pLine || m_pParent == 0 ) + { + wxLogTrace( _T("wxFileConfig"), + _T(" ------- No previous group found -------") ); + + wxASSERT_MSG( !pNewLast || m_pLine == 0, + _T("how comes it has the same line as we?") ); + + // we've reached the group line without finding any subgroups, + // or realised we removed the last group from the root. + + m_pLastGroup = 0; + } + else + { + wxLogTrace( _T("wxFileConfig"), + _T(" ------- Last Group set to '%s' -------"), + pNewLast->Name().c_str() ); + + m_pLastGroup = pNewLast; + } + } + + m_pConfig->LineListRemove(pLine); + } + else + { + wxLogTrace( _T("wxFileConfig"), + _T(" No line entry for Group '%s'?"), + pGroup->Name().c_str() ); + } + + SetDirty(); + + m_aSubgroups.Remove(pGroup); + delete pGroup; + + return TRUE; } bool wxFileConfigGroup::DeleteEntry(const wxChar *szName) @@ -1566,47 +1748,54 @@ void wxFileConfigEntry::SetLine(wxFileConfigLineList *pLine) // entry from being marked as 'dirty' void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser) { - if ( bUser && IsImmutable() ) { - wxLogWarning(_("attempt to change immutable key '%s' ignored."), - Name().c_str()); - return; - } - - // do nothing if it's the same value: but don't test for it if m_bHasValue - // hadn't been set yet or we'd never write empty values to the file - if ( m_bHasValue && strValue == m_strValue ) - return; - - m_bHasValue = TRUE; - m_strValue = strValue; - - if ( bUser ) { - wxString strValFiltered; - if ( Group()->Config()->GetStyle() & wxCONFIG_USE_NO_ESCAPE_CHARACTERS ) { - strValFiltered = strValue; - } - else { - strValFiltered = FilterOutValue(strValue); + if ( bUser && IsImmutable() ) + { + wxLogWarning( _("attempt to change immutable key '%s' ignored."), + Name().c_str()); + return; } - wxString strLine; - strLine << FilterOutEntryName(m_strName) << wxT('=') << strValFiltered; + // do nothing if it's the same value: but don't test for it + // if m_bHasValue hadn't been set yet or we'd never write + // empty values to the file - if ( m_pLine != NULL ) { - // entry was read from the local config file, just modify the line - m_pLine->SetText(strLine); + if ( m_bHasValue && strValue == m_strValue ) + return; + + m_bHasValue = TRUE; + m_strValue = strValue; + + if ( bUser ) + { + wxString strValFiltered; + + if ( Group()->Config()->GetStyle() & wxCONFIG_USE_NO_ESCAPE_CHARACTERS ) + { + strValFiltered = strValue; + } + else { + strValFiltered = FilterOutValue(strValue); + } + + wxString strLine; + strLine << FilterOutEntryName(m_strName) << wxT('=') << strValFiltered; + + if ( m_pLine != 0 ) + { + // entry was read from the local config file, just modify the line + m_pLine->SetText(strLine); + } + else { + // add a new line to the file + wxASSERT( m_nLine == wxNOT_FOUND ); // consistency check + + m_pLine = Group()->Config()->LineListInsert(strLine, + Group()->GetLastEntryLine()); + Group()->SetLastEntry(this); + } + + SetDirty(); } - else { - // add a new line to the file - wxASSERT( m_nLine == wxNOT_FOUND ); // consistency check - - m_pLine = Group()->Config()->LineListInsert(strLine, - Group()->GetLastEntryLine()); - Group()->SetLastEntry(this); - } - - SetDirty(); - } } void wxFileConfigEntry::SetDirty() @@ -1797,3 +1986,5 @@ static wxString GetAppName(const wxString& appName) #endif // wxUSE_CONFIG + +// vi:sts=4:sw=4:et diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index 6c591571f0..65f109691c 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -537,10 +537,14 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, const wxChar *p = cs.c_str() + 3; if ( *p == wxT('-') ) p++; + + // printf( "iso %s\n", (const char*) cs.ToAscii() ); unsigned int value; if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 ) { + // printf( "value %d\n", (int)value ); + // make it 0 based and check that it is strictly positive in // the process (no such thing as iso8859-0 encoding) if ( (value-- > 0) && diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index b1fea3c1fe..856c1369e9 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -188,6 +188,10 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_expand( png_ptr ); + // Fix for Bug [ 439207 ] Monochrome PNG images come up black + if (bit_depth < 8) + png_set_expand( png_ptr ); + png_set_strip_16( png_ptr ); png_set_packing( png_ptr ); if (png_get_valid( png_ptr, info_ptr, PNG_INFO_tRNS)) diff --git a/src/common/log.cpp b/src/common/log.cpp index b577f27aef..6e66555323 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -509,9 +509,8 @@ wxLogStderr::wxLogStderr(FILE *fp) m_fp = fp; } -#if defined(__WXMAC__) && !defined(__DARWIN__) && (__MWERKS__ > 0x5300) +#if defined(__WXMAC__) && !defined(__DARWIN__) && defined(__MWERKS__) && (__MWERKS__ >= 0x2400) -#if !TARGET_API_MAC_CARBON // MetroNub stuff doesn't seem to work in CodeWarrior 5.3 Carbon builds... #ifndef __MetroNubUtils__ @@ -694,9 +693,7 @@ OSErr ClearWatchPoint (WatchPointIDT watchPointID) } #endif -#endif // !TARGET_API_MAC_CARBON - -#endif // defined(__WXMAC__) && !defined(__DARWIN__) && (__MWERKS__ > 0x5300) +#endif // defined(__WXMAC__) && !defined(__DARWIN__) && (__MWERKS__ >= 0x2400) void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) { @@ -722,7 +719,7 @@ void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) Boolean running = false ; -#if !TARGET_API_MAC_CARBON && (__MWERKS__ > 0x5300) +#if defined(__MWERKS__) && (__MWERKS__ >= 0x2400) if ( IsMWDebuggerRunning() && AmIBeingMWDebugged() ) { diff --git a/src/common/settcmn.cpp b/src/common/settcmn.cpp index 93ebe6286d..6e84b6a118 100644 --- a/src/common/settcmn.cpp +++ b/src/common/settcmn.cpp @@ -44,7 +44,7 @@ wxSystemScreenType wxSystemSettings::ms_screen = wxSYS_SCREEN_NONE; wxSystemScreenType wxSystemSettings::GetScreenType() { if (ms_screen == wxSYS_SCREEN_NONE) -#ifndef __WXUNIV__ +#ifndef __WXUNIVERSAL__ { // As a start, all GUI are desktops. ms_screen = wxSYS_SCREEN_DESKTOP; @@ -52,9 +52,7 @@ wxSystemScreenType wxSystemSettings::GetScreenType() #else { // wxUniv will be used on small devices, too. - int x = 0; - int y = 0; - wxGetDisplaySize( &x, &y ); + int x = GetMetric( wxSYS_SCREEN_X ); ms_screen = wxSYS_SCREEN_DESKTOP; diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index dafd61269a..7c861f9daf 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -188,6 +188,11 @@ static size_t decode_utf16(const wchar_t* input, wxUint32& output) #define IGNORE_LIBC 0 +wxMBConv::~wxMBConv() +{ + // nothing to do here +} + size_t wxMBConv::MB2WC(wchar_t *buf, const char *psz, size_t n) const { #if IGNORE_LIBC diff --git a/src/common/string.cpp b/src/common/string.cpp index 32a0adab79..395a09476c 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1752,7 +1752,7 @@ void wxArrayString::Copy(const wxArrayString& src) void wxArrayString::Grow(size_t nIncrement) { // only do it if no more place - if ( m_nCount == m_nSize ) { + if ( (m_nSize - m_nCount) < nIncrement ) { // if ARRAY_DEFAULT_INITIAL_SIZE were set to 0, the initially empty would // be never resized! #if ARRAY_DEFAULT_INITIAL_SIZE == 0 diff --git a/src/common/unzip.h b/src/common/unzip.h index 78dee0ee4d..acb137bc66 100644 --- a/src/common/unzip.h +++ b/src/common/unzip.h @@ -52,17 +52,37 @@ $Id$ extern "C" { #endif +/* include zlib.h if not done yet */ #ifndef _ZLIB_H -//#include "zlib.h" -// normally, the compiler options should contain -I../zlib, but it is -// apparently not the case for all MSW makefiles and so, unless we use -// configure (which defines __WX_SETUP_H__) or it is explicitly overridden by -// the user (who can define wxUSE_ZLIB_H_IN_PATH), we hardcode the path here -#if defined(__WXMSW__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH) - #include "../zlib/zlib.h" -#else - #include "zlib.h" + /* + normally, the compiler options should contain -I../zlib, but it is + apparently not the case for all MSW makefiles and so, unless we use + configure (which defines __WX_SETUP_H__) or it is explicitly overridden + by the user (who can define wxUSE_ZLIB_H_IN_PATH), we hardcode the path + here + */ +# if defined(__WXMSW__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH) +# include "../zlib/zlib.h" +# else +# include "zlib.h" +# endif +#endif /* _ZLIB_H */ + +/* + Some system zlib.h headers are modified to not define the OF() macro but use + the (standard) __P() instead (example: NetBSD 1.6), work around this if + needed assuming that we deal with an ANSI C compiler (which is a natural + assumption in 21st century!) + */ +#ifndef OF +# define OF(args) args #endif + +/* + And on some systems ZEXPORT is not defined neither -- work around this too + */ +#ifndef ZEXPORT +# define ZEXPORT #endif #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index d88d0e5206..9cbd444ab7 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -207,7 +207,8 @@ int strncasecmp(const char *str_1, const char *str_2, size_t maxchar) // This declaration is missing in SunOS! // (Yes, I know it is NOT ANSI-C but its in BSD libc) -#if defined(__xlC) || defined(__AIX__) || defined(__GNUG__) +#if defined(__xlC) || defined(__AIX__) +// || defined(__GNUG__) extern "C" { int strcasecmp (const char *, const char *); diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 3890805a6d..48d1d06db6 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -673,6 +673,10 @@ long wxFileCtrl::Add( wxFileData *fd, wxListItem &item ) void wxFileCtrl::UpdateFiles() { + // don't do anything before ShowModal() call which sets m_dirName + if ( m_dirName.empty() ) + return; + wxBusyCursor bcur; // this may take a while... long my_style = GetWindowStyleFlag(); @@ -988,7 +992,7 @@ BEGIN_EVENT_TABLE(wxFileDialog,wxDialog) EVT_BUTTON(wxID_OK, wxFileDialog::OnListOk) EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL, wxFileDialog::OnSelected) EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxFileDialog::OnActivated) - EVT_CHOICE(ID_CHOICE,wxFileDialog::OnChoice) + EVT_CHOICE(ID_CHOICE,wxFileDialog::OnChoiceFilter) EVT_TEXT_ENTER(ID_TEXT,wxFileDialog::OnTextEnter) EVT_CHECKBOX(ID_CHECK,wxFileDialog::OnCheck) END_EVENT_TABLE() @@ -1064,6 +1068,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, if ( m_filterExtension == ".*" ) m_filterExtension = wxEmptyString; // layout + + bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL ); @@ -1114,13 +1120,13 @@ wxFileDialog::wxFileDialog(wxWindow *parent, #endif buttonsizer->Add( butNewDir, 0, wxALL, 5 ); - if (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA) + if (is_pda) mainsizer->Add( buttonsizer, 0, wxALL | wxEXPAND, 0 ); else mainsizer->Add( buttonsizer, 0, wxALL | wxEXPAND, 5 ); wxBoxSizer *staticsizer = new wxBoxSizer( wxHORIZONTAL ); - if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA) + if (is_pda) staticsizer->Add( new wxStaticText( this, -1, _("Current directory:") ), 0, wxRIGHT, 10 ); m_static = new wxStaticText( this, -1, m_dir ); staticsizer->Add( m_static, 1 ); @@ -1137,7 +1143,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, m_list->SetNewDirControl(butNewDir); m_list->SetGoToParentControl(butDirUp); - if (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA) + if (is_pda) { // PDAs have a different screen layout mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 5 ); @@ -1219,27 +1225,33 @@ int wxFileDialog::ShowModal() return wxDialog::ShowModal(); } +void wxFileDialog::DoSetFilterIndex(int filterindex) +{ + wxString *str = (wxString*) m_choice->GetClientData( filterindex ); + m_list->SetWild( *str ); + m_filterIndex = filterindex; + if ( str->Left(2) == wxT("*.") ) + { + m_filterExtension = str->Mid(2); + if (m_filterExtension == _T("*")) + m_filterExtension.clear(); + } + else + { + m_filterExtension.clear(); + } +} + void wxFileDialog::SetFilterIndex( int filterindex ) { m_choice->SetSelection( filterindex ); - wxCommandEvent event; - event.SetInt( filterindex ); - OnChoice( event ); + + DoSetFilterIndex(filterindex); } -void wxFileDialog::OnChoice( wxCommandEvent &event ) +void wxFileDialog::OnChoiceFilter( wxCommandEvent &event ) { - int index = (int)event.GetInt(); - wxString *str = (wxString*) m_choice->GetClientData( index ); - m_list->SetWild( *str ); - m_filterIndex = index; - if ( str -> Left( 2 ) == wxT("*.") ) - { - m_filterExtension = str -> Mid( 1 ); - if (m_filterExtension == ".*") m_filterExtension = wxEmptyString; - } - else - m_filterExtension = wxEmptyString; + DoSetFilterIndex((int)event.GetInt()); } void wxFileDialog::OnCheck( wxCommandEvent &event ) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 8e541e67f2..1ecb7e28b0 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1353,15 +1353,15 @@ void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid) m_startValue = grid->GetTable()->GetValue(row, col); - Combo()->SetValue(m_startValue); - size_t count = m_choices.GetCount(); - for (size_t i=0; iSetValue(m_startValue); + else { - if (m_startValue == m_choices[i]) - { - Combo()->SetSelection(i); - break; - } + // find the right position, or default to the first if not found + int pos = Combo()->FindString(m_startValue); + if (pos == -1) + pos = 0; + Combo()->SetSelection(pos); } Combo()->SetInsertionPointEnd(); Combo()->SetFocus(); @@ -1377,7 +1377,10 @@ bool wxGridCellChoiceEditor::EndEdit(int row, int col, grid->GetTable()->SetValue(row, col, value); m_startValue = wxEmptyString; - Combo()->SetValue(m_startValue); + if (m_allowOthers) + Combo()->SetValue(m_startValue); + else + Combo()->SetSelection(0); return changed; } @@ -1581,9 +1584,9 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid, for (int j=row; j 0) c_rows = 0; - if (grid.GetTable()->IsEmptyCell(row+c_rows, i)) + if (!grid.GetTable()->IsEmptyCell(j+c_rows, i)) { is_empty = FALSE; break; @@ -1605,7 +1608,7 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid, if (overflowCols > 0) // redraw overflow cells w/ proper hilight { hAlign = wxALIGN_LEFT; // if oveflowed then it's left aligned - wxRect clip = rect; + wxRect clip = rect; clip.x += rectCell.width; // draw each overflow cell individually int col_end = col+cell_cols+overflowCols; @@ -3909,7 +3912,7 @@ void wxGrid::InitRowHeights() m_rowBottoms.Alloc( m_numRows ); int rowBottom = 0; - + m_rowHeights.Add( m_defaultRowHeight, m_numRows ); for ( int i = 0; i < m_numRows; i++ ) @@ -5898,7 +5901,7 @@ void wxGrid::Refresh(bool eraseb, const wxRect* rect) else { m_cornerLabelWin->Refresh(eraseb, NULL); - m_colLabelWin->Refresh(eraseb, NULL); + m_colLabelWin->Refresh(eraseb, NULL); m_rowLabelWin->Refresh(eraseb, NULL); m_gridWin->Refresh(eraseb, NULL); } @@ -6258,7 +6261,7 @@ void wxGrid::HighlightBlock( int topRow, int leftCol, int bottomRow, int rightCo wxRect rect; rect = BlockToDeviceRect( wxGridCellCoords ( topRow, leftCol ), wxGridCellCoords ( bottomRow, rightCol ) ); - m_gridWin->Refresh( FALSE, &rect ); + m_gridWin->Refresh( FALSE, &rect ); } // Now handle changing an existing selection area. else if ( m_selectingTopLeft != updateTopLeft || diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index 2781694fb5..bac2f8950b 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -4,7 +4,7 @@ // Author: Stefan Neis // Modified by: // Created: 20/02/1999 -// RCS-ID: $$ +// RCS-ID: $Id$ // Copyright: (c) Stefan Neis (Stefan.Neis@t-online.de) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -165,7 +165,7 @@ void wxGridSelection::SetSelectionMode(wxGrid::wxGridSelectionModes selmode) m_blockSelectionBottomRight.RemoveAt(n); SelectBlock( topRow, 0, bottomRow, m_grid->GetNumberCols() - 1, - 0, FALSE ); + FALSE, FALSE, FALSE, FALSE, FALSE ); } } else // selmode == wxGridSelectColumns) @@ -176,7 +176,7 @@ void wxGridSelection::SetSelectionMode(wxGrid::wxGridSelectionModes selmode) m_blockSelectionBottomRight.RemoveAt(n); SelectBlock( 0, leftCol, m_grid->GetNumberRows() - 1, rightCol, - 0, FALSE ); + FALSE, FALSE, FALSE, FALSE, FALSE ); } } } @@ -522,13 +522,13 @@ void wxGridSelection::SelectCell( int row, int col, if ( m_selectionMode == wxGrid::wxGridSelectRows ) { SelectBlock(row, 0, row, m_grid->GetNumberCols() - 1, - ControlDown, ShiftDown, AltDown, MetaDown); + ControlDown, ShiftDown, AltDown, MetaDown, sendEvent); return; } else if ( m_selectionMode == wxGrid::wxGridSelectColumns ) { SelectBlock(0, col, m_grid->GetNumberRows() - 1, col, - ControlDown, ShiftDown, AltDown, MetaDown); + ControlDown, ShiftDown, AltDown, MetaDown, sendEvent); return; } else if ( IsInSelection ( row, col ) ) @@ -647,18 +647,20 @@ void wxGridSelection::ToggleCellSelection( int row, int col, if ( m_selectionMode != wxGrid::wxGridSelectColumns ) { if ( topRow < row ) - SelectBlock( topRow, leftCol, - row - 1, rightCol, 0, FALSE ); + SelectBlock( topRow, leftCol, row - 1, rightCol, + FALSE, FALSE, FALSE, FALSE, FALSE ); if ( bottomRow > row ) - SelectBlock( row + 1, leftCol, - bottomRow, rightCol, 0, FALSE ); + SelectBlock( row + 1, leftCol, bottomRow, rightCol, + FALSE, FALSE, FALSE, FALSE, FALSE ); } if ( m_selectionMode != wxGrid::wxGridSelectRows ) { if ( leftCol < col ) - SelectBlock( row, leftCol, row, col - 1, 0, FALSE ); + SelectBlock( row, leftCol, row, col - 1, + FALSE, FALSE, FALSE, FALSE, FALSE ); if ( rightCol > col ) - SelectBlock( row, col + 1, row, rightCol, 0, FALSE ); + SelectBlock( row, col + 1, row, rightCol, + FALSE, FALSE, FALSE, FALSE, FALSE ); } } } @@ -676,11 +678,12 @@ void wxGridSelection::ToggleCellSelection( int row, int col, if (m_selectionMode == wxGrid::wxGridSelectCells) { if ( col > 0 ) - SelectBlock( row, 0, row, col - 1, 0, FALSE ); + SelectBlock( row, 0, row, col - 1, + FALSE, FALSE, FALSE, FALSE, FALSE ); if ( col < m_grid->GetNumberCols() - 1 ) SelectBlock( row, col + 1, row, m_grid->GetNumberCols() - 1, - 0, FALSE ); + FALSE, FALSE, FALSE, FALSE, FALSE ); } } } @@ -699,11 +702,12 @@ void wxGridSelection::ToggleCellSelection( int row, int col, if (m_selectionMode == wxGrid::wxGridSelectCells) { if ( row > 0 ) - SelectBlock( 0, col, row - 1, col, 0, FALSE ); + SelectBlock( 0, col, row - 1, col, + FALSE, FALSE, FALSE, FALSE, FALSE ); if ( row < m_grid->GetNumberRows() - 1 ) SelectBlock( row + 1, col, m_grid->GetNumberRows() - 1, col, - 0, FALSE ); + FALSE, FALSE, FALSE, FALSE, FALSE ); } } } diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 911612205e..ff71df4edf 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -879,6 +879,8 @@ private: DECLARE_DYNAMIC_CLASS(wxListMainWindow) DECLARE_EVENT_TABLE() + + friend class wxGenericListCtrl; }; // ============================================================================ @@ -1811,6 +1813,11 @@ wxListHeaderWindow::~wxListHeaderWindow() delete m_resizeCursor; } +#ifdef __WXUNIVERSAL__ +#include "wx/univ/renderer.h" +#include "wx/univ/theme.h" +#endif + void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h ) { #if defined(__WXGTK__) && !defined(__WXUNIVERSAL__) @@ -1824,7 +1831,11 @@ void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h ) (GdkRectangle*) NULL, m_wxwindow, (char *)"button", // const_cast x-1, y-1, w+2, h+2); -#elif defined( __WXMAC__ ) +#elif defined(__WXUNIVERSAL__) + wxTheme *theme = wxTheme::Get(); + wxRenderer *renderer = theme->GetRenderer(); + renderer->DrawBorder( *dc, wxBORDER_RAISED, wxRect(x,y,w,h), 0 ); +#elif defined(__WXMAC__) const int m_corner = 1; dc->SetBrush( *wxTRANSPARENT_BRUSH ); @@ -4882,7 +4893,9 @@ void wxGenericListCtrl::SetTextColour(const wxColour& col) long wxGenericListCtrl::GetTopItem() const { - return 0; + size_t top; + m_mainWin->GetVisibleLinesRange(&top, NULL); + return (long)top; } long wxGenericListCtrl::GetNextItem( long item, int geom, int state ) const diff --git a/src/generic/mdig.cpp b/src/generic/mdig.cpp index 69445c6b27..e86ba99ee9 100644 --- a/src/generic/mdig.cpp +++ b/src/generic/mdig.cpp @@ -35,7 +35,7 @@ #include "wx/generic/mdig.h" -enum MDI_MENU_ID +enum MDI_MENU_ID { wxWINDOWCLOSE = 4001, wxWINDOWCLOSEALL, @@ -53,9 +53,9 @@ BEGIN_EVENT_TABLE(wxGenericMDIParentFrame, wxFrame) EVT_MENU (-1, wxGenericMDIParentFrame::DoHandleMenu) END_EVENT_TABLE() -wxGenericMDIParentFrame::wxGenericMDIParentFrame() -{ - Init(); +wxGenericMDIParentFrame::wxGenericMDIParentFrame() +{ + Init(); } wxGenericMDIParentFrame::wxGenericMDIParentFrame(wxWindow *parent, @@ -67,22 +67,22 @@ wxGenericMDIParentFrame::wxGenericMDIParentFrame(wxWindow *parent, const wxString& name) { Init(); - + (void)Create(parent, id, title, pos, size, style, name); } wxGenericMDIParentFrame::~wxGenericMDIParentFrame() -{ +{ // Make sure the client window is destructed before the menu bars are! wxDELETE(m_pClientWindow); -#if wxUSE_MENUS +#if wxUSE_MENUS if (m_pMyMenuBar) { delete m_pMyMenuBar; m_pMyMenuBar = (wxMenuBar *) NULL; } - + RemoveWindowMenu(GetMenuBar()); if (m_pWindowMenu) @@ -162,7 +162,7 @@ void wxGenericMDIParentFrame::SetChildMenuBar(wxGenericMDIChildFrame *pChild) { // No Child, set Our menu bar back. SetMenuBar(m_pMyMenuBar); - + // Make sure we know our menu bar is in use m_pMyMenuBar = (wxMenuBar*) NULL; } @@ -195,7 +195,7 @@ bool wxGenericMDIParentFrame::ProcessEvent(wxEvent& event) // Let the active child (if any) process the event first. bool res = FALSE; - if (m_pActiveChild && event.IsKindOf(CLASSINFO(wxCommandEvent)) + if (m_pActiveChild && event.IsKindOf(CLASSINFO(wxCommandEvent)) #if 0 /* This is sure to not give problems... */ && (event.GetEventType() == wxEVT_COMMAND_MENU_SELECTED || @@ -302,8 +302,8 @@ void wxGenericMDIParentFrame::RemoveWindowMenu(wxMenuBar *pMenuBar) void wxGenericMDIParentFrame::AddWindowMenu(wxMenuBar *pMenuBar) { if (pMenuBar && m_pWindowMenu) - { - int pos = pMenuBar->FindMenu(_T("Help")); + { + int pos = pMenuBar->FindMenu(_T("Help")); if (pos == wxNOT_FOUND) { pMenuBar->Append(m_pWindowMenu, _T("&Window")); @@ -319,7 +319,7 @@ void wxGenericMDIParentFrame::DoHandleMenu(wxCommandEvent &event) { switch (event.GetId()) { - case wxWINDOWCLOSE: + case wxWINDOWCLOSE: if (m_pActiveChild) { m_pActiveChild->Close(); @@ -327,7 +327,7 @@ void wxGenericMDIParentFrame::DoHandleMenu(wxCommandEvent &event) break; case wxWINDOWCLOSEALL: { -#if 0 // code is only needed if next #if is set to 0! +#if 0 // code is only needed if next #if is set to 0! wxGenericMDIChildFrame *pFirstActiveChild = m_pActiveChild; #endif while (m_pActiveChild) @@ -340,7 +340,7 @@ void wxGenericMDIParentFrame::DoHandleMenu(wxCommandEvent &event) { #if 1 // What's best? Delayed deleting or immediate deleting? delete m_pActiveChild; -#else +#else ActivateNext(); if (pFirstActiveChild == m_pActiveChild) @@ -425,7 +425,7 @@ wxGenericMDIChildFrame::~wxGenericMDIChildFrame() break; } } - + if (bActive) { // Set the new selection to the a remaining page @@ -456,7 +456,7 @@ bool wxGenericMDIChildFrame::Create( wxGenericMDIParentFrame *parent, wxASSERT_MSG((pClientWindow != (wxWindow*) NULL), "Missing MDI client window."); wxPanel::Create(pClientWindow, id, wxDefaultPosition, size, style, name); - + SetMDIParentFrame(parent); // This is the currently active child @@ -471,7 +471,7 @@ bool wxGenericMDIChildFrame::Create( wxGenericMDIParentFrame *parent, return TRUE; } -#if wxUSE_MENUS +#if wxUSE_MENUS void wxGenericMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) { wxMenuBar *pOldMenuBar = m_pMenuBar; @@ -480,7 +480,7 @@ void wxGenericMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) if (m_pMenuBar) { wxGenericMDIParentFrame *pParentFrame = GetMDIParentFrame(); - + if (pParentFrame != NULL) { m_pMenuBar->SetParent(pParentFrame); @@ -500,20 +500,20 @@ wxMenuBar *wxGenericMDIChildFrame::GetMenuBar() const { return m_pMenuBar; } -#endif // wxUSE_MENUS +#endif // wxUSE_MENUS void wxGenericMDIChildFrame::SetTitle(const wxString& title) { m_Title = title; wxGenericMDIParentFrame *pParentFrame = GetMDIParentFrame(); - + if (pParentFrame != NULL) { wxGenericMDIClientWindow * pClientWindow = pParentFrame->GetClientWindow(); - + if (pClientWindow != NULL) - { + { int pos; for (pos = 0; pos < pClientWindow->GetPageCount(); pos++) { @@ -522,12 +522,12 @@ void wxGenericMDIChildFrame::SetTitle(const wxString& title) pClientWindow->SetPageText(pos, m_Title); break; } - } + } } } } -wxString wxGenericMDIChildFrame::GetTitle() +wxString wxGenericMDIChildFrame::GetTitle() const { return m_Title; } @@ -560,7 +560,7 @@ void wxGenericMDIChildFrame::OnMenuHighlight(wxMenuEvent& event) #if wxUSE_STATUSBAR if ( m_pMDIParentFrame) { - // we don't have any help text for this item, + // we don't have any help text for this item, // but may be the MDI frame does? m_pMDIParentFrame->OnMenuHighlight(event); } @@ -633,14 +633,14 @@ void wxGenericMDIChildFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) Destroy(); } -void wxGenericMDIChildFrame::SetMDIParentFrame(wxGenericMDIParentFrame* parentFrame) -{ - m_pMDIParentFrame = parentFrame; +void wxGenericMDIChildFrame::SetMDIParentFrame(wxGenericMDIParentFrame* parentFrame) +{ + m_pMDIParentFrame = parentFrame; } -wxGenericMDIParentFrame* wxGenericMDIChildFrame::GetMDIParentFrame() const -{ - return m_pMDIParentFrame; +wxGenericMDIParentFrame* wxGenericMDIChildFrame::GetMDIParentFrame() const +{ + return m_pMDIParentFrame; } void wxGenericMDIChildFrame::Init() @@ -648,11 +648,11 @@ void wxGenericMDIChildFrame::Init() m_pMDIParentFrame = (wxGenericMDIParentFrame *) NULL; #if wxUSE_MENUS m_pMenuBar = (wxMenuBar *) NULL; -#endif // wxUSE_MENUS +#endif // wxUSE_MENUS } void wxGenericMDIChildFrame::DoMoveWindow(int x, int y, int width, int height) -{ +{ m_MDIRect = wxRect(x, y, width, height); } @@ -714,7 +714,7 @@ int wxGenericMDIClientWindow::SetSelection(int nPage) { int oldSelection = wxNotebook::SetSelection(nPage); -#if !defined(__WXMSW__) // No need to do this for wxMSW as wxNotebook::SetSelection() +#if !defined(__WXMSW__) // No need to do this for wxMSW as wxNotebook::SetSelection() // will already cause this to be done! // Handle the page change. PageChanged(oldSelection, nPage); diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index 2b1b8b33db..467ce46b18 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -40,6 +40,7 @@ #include "wx/generic/msgdlgg.h" #include "wx/artprov.h" +#include "wx/settings.h" #if wxUSE_STATLINE #include "wx/statline.h" @@ -66,6 +67,8 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, { m_dialogStyle = style; + bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); + wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL ); @@ -97,13 +100,16 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, break; } wxStaticBitmap *icon = new wxStaticBitmap(this, -1, bitmap); - icon_text->Add( icon, 0, wxCENTER ); + if (is_pda) + topsizer->Add( icon, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 ); + else + icon_text->Add( icon, 0, wxCENTER ); } // 2) text icon_text->Add( CreateTextSizer( message ), 0, wxCENTER | wxLEFT, 10 ); - topsizer->Add( icon_text, 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 ); + topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 ); #if wxUSE_STATLINE // 3) static line @@ -140,8 +146,8 @@ void wxGenericMessageDialog::OnNo(wxCommandEvent& WXUNUSED(event)) void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { - /* Allow cancellation via ESC/Close button except if - only YES and NO are specified. */ + // Allow cancellation via ESC/Close button except if + // only YES and NO are specified. if ( (m_dialogStyle & wxYES_NO) != wxYES_NO || (m_dialogStyle & wxCANCEL) ) { EndModal( wxID_CANCEL ); diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index 90bc832b39..6f0fc70c24 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -46,6 +46,10 @@ BEGIN_EVENT_TABLE(wxSashWindow, wxWindow) EVT_PAINT(wxSashWindow::OnPaint) EVT_SIZE(wxSashWindow::OnSize) EVT_MOUSE_EVENTS(wxSashWindow::OnMouseEvent) +#ifdef __WXMSW__ + EVT_SET_CURSOR(wxSashWindow::OnSetCursor) +#endif // wxMSW + END_EVENT_TABLE() bool wxSashWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, @@ -77,6 +81,7 @@ void wxSashWindow::Init() m_sashCursorWE = new wxCursor(wxCURSOR_SIZEWE); m_sashCursorNS = new wxCursor(wxCURSOR_SIZENS); m_mouseCaptured = FALSE; + m_currentCursor = NULL; // Eventually, we'll respond to colour change messages InitColours(); @@ -86,9 +91,7 @@ void wxSashWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); - // if ( m_borderSize > 0 ) DrawBorders(dc); - DrawSashes(dc); } @@ -99,15 +102,6 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) wxSashEdgePosition sashHit = SashHitTest(x, y); - // reset the cursor -#if defined(__WXMOTIF__) || defined(__WXGTK__) - // Not necessary and in fact inhibits proper cursor setting (JACS 8/2000) - //SetCursor(* wxSTANDARD_CURSOR); -#endif -#ifdef __WXMSW__ - SetCursor(wxNullCursor); -#endif - if (event.LeftDown()) { CaptureMouse(); @@ -139,11 +133,19 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) if ( (sashHit == wxSASH_LEFT) || (sashHit == wxSASH_RIGHT) ) { - SetCursor(*m_sashCursorWE); + if (m_currentCursor != m_sashCursorWE) + { + SetCursor(*m_sashCursorWE); + } + m_currentCursor = m_sashCursorWE; } else { - SetCursor(*m_sashCursorNS); + if (m_currentCursor != m_sashCursorNS) + { + SetCursor(*m_sashCursorNS); + } + m_currentCursor = m_sashCursorNS; } } } @@ -296,16 +298,25 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) { if ( (sashHit == wxSASH_LEFT) || (sashHit == wxSASH_RIGHT) ) { - SetCursor(*m_sashCursorWE); + if (m_currentCursor != m_sashCursorWE) + { + SetCursor(*m_sashCursorWE); + } + m_currentCursor = m_sashCursorWE; } else { - SetCursor(*m_sashCursorNS); + if (m_currentCursor != m_sashCursorNS) + { + SetCursor(*m_sashCursorNS); + } + m_currentCursor = m_sashCursorNS; } } else { SetCursor(wxNullCursor); + m_currentCursor = NULL; } } else if ( event.Dragging() && @@ -314,11 +325,19 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) { if ( (m_draggingEdge == wxSASH_LEFT) || (m_draggingEdge == wxSASH_RIGHT) ) { - SetCursor(*m_sashCursorWE); + if (m_currentCursor != m_sashCursorWE) + { + SetCursor(*m_sashCursorWE); + } + m_currentCursor = m_sashCursorWE; } else { - SetCursor(*m_sashCursorNS); + if (m_currentCursor != m_sashCursorNS) + { + SetCursor(*m_sashCursorNS); + } + m_currentCursor = m_sashCursorNS; } if (m_dragMode == wxSASH_DRAG_LEFT_DOWN) @@ -683,4 +702,23 @@ void wxSashWindow::SetSashVisible(wxSashEdgePosition edge, bool sash) m_sashes[edge].m_margin = 0; } +#ifdef __WXMSW__ + +// this is currently called (and needed) under MSW only... +void wxSashWindow::OnSetCursor(wxSetCursorEvent& event) +{ + // if we don't do it, the resizing cursor might be set for child window: + // and like this we explicitly say that our cursor should not be used for + // children windows which overlap us + + if ( SashHitTest(event.GetX(), event.GetY()) != wxSASH_NONE) + { + // default processing is ok + event.Skip(); + } + //else: do nothing, in particular, don't call Skip() +} + +#endif // wxMSW + #endif // wxUSE_SASH diff --git a/src/generic/tbarsmpl.cpp b/src/generic/tbarsmpl.cpp index 522736e77f..b7e16e0d4d 100644 --- a/src/generic/tbarsmpl.cpp +++ b/src/generic/tbarsmpl.cpp @@ -356,13 +356,15 @@ bool wxToolBarSimple::Realize() } if ( GetWindowStyleFlag() & wxTB_HORIZONTAL ) - m_maxWidth += maxToolWidth; - else m_maxHeight += maxToolHeight; + else + m_maxWidth += maxToolWidth; m_maxWidth += m_xMargin; m_maxHeight += m_yMargin; + SetSize(m_maxWidth, m_maxHeight); + return TRUE; } diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 20d8961d6c..61b722b708 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -44,13 +44,27 @@ #endif #include + +// TODO: use configure test to detect which of select()/poll() is available! #if defined(__DARWIN__) -# warning "FIXME: select must be used instead of poll (GD)" + #warning "FIXME: select must be used instead of poll (GD)" #elif defined(__VMS) -# include + #include #else -# include -#endif + // bug in the OpenBSD headers: at least in 3.1 there is no extern "C" in + // neither poll.h nor sys/poll.h which results in link errors later + #ifdef __OPENBSD__ + extern "C" + { + #endif + + #include + + #ifdef __OPENBSD__ + }; + #endif +#endif // platform + #include "wx/gtk/win_gtk.h" #include @@ -545,7 +559,7 @@ bool wxApp::SendIdleEvents( wxWindow* win ) event.SetEventObject(win); win->GetEventHandler()->ProcessEvent(event); - + if (event.MoreRequested()) needMore = TRUE; diff --git a/src/gtk/colour.cpp b/src/gtk/colour.cpp index 84c790a329..0eac04248a 100644 --- a/src/gtk/colour.cpp +++ b/src/gtk/colour.cpp @@ -217,7 +217,6 @@ void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue ) { AllocExclusive(); - m_refData = new wxColourRefData(); M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT; M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT; M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT; diff --git a/src/gtk/glcanvas.cpp b/src/gtk/glcanvas.cpp index e46cac9e32..03a256aeda 100644 --- a/src/gtk/glcanvas.cpp +++ b/src/gtk/glcanvas.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: glcanvas.cpp +// Name: gtk/glcanvas.cpp // Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK // Author: Robert Roebling // Modified by: // Created: 17/08/98 // RCS-ID: $Id$ // Copyright: (c) Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -24,7 +24,8 @@ #include "wx/module.h" #include "wx/app.h" -extern "C" { +extern "C" +{ #include "gtk/gtk.h" #include "gdk/gdk.h" #include "gdk/gdkx.h" @@ -58,16 +59,16 @@ wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette& wxGLCanvas *gc = (wxGLCanvas*) win; XVisualInfo *vi = (XVisualInfo *) gc->m_vi; - - wxCHECK_RET( vi, "invalid visual for OpenGl" ); - + + wxCHECK_RET( vi, _T("invalid visual for OpenGl") ); + m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE ); - - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); + + wxCHECK_RET( m_glContext, _T("Couldn't create OpenGl context") ); } -wxGLContext::wxGLContext( - bool WXUNUSED(isRGB), wxWindow *win, +wxGLContext::wxGLContext( + bool WXUNUSED(isRGB), wxWindow *win, const wxPalette& WXUNUSED(palette), const wxGLContext *other /* for sharing display lists */ ) @@ -77,26 +78,28 @@ wxGLContext::wxGLContext( wxGLCanvas *gc = (wxGLCanvas*) win; XVisualInfo *vi = (XVisualInfo *) gc->m_vi; - - wxCHECK_RET( vi, "invalid visual for OpenGl" ); - - if( other != 0 ) - m_glContext = glXCreateContext( GDK_DISPLAY(), vi, other->m_glContext, GL_TRUE ); - else - m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE ); - - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); + + wxCHECK_RET( vi, _T("invalid visual for OpenGl") ); + + m_glContext = glXCreateContext( GDK_DISPLAY(), vi, + other ? other->m_glContext : None, + GL_TRUE ); + + if ( !m_glContext ) + { + wxFAIL_MSG( _T("Couldn't create OpenGl context") ); + } } wxGLContext::~wxGLContext() { if (!m_glContext) return; - + if (m_glContext == glXGetCurrentContext()) { glXMakeCurrent( GDK_DISPLAY(), None, NULL); } - + glXDestroyContext( GDK_DISPLAY(), m_glContext ); } @@ -111,8 +114,8 @@ void wxGLContext::SwapBuffers() void wxGLContext::SetCurrent() { - if (m_glContext) - { + if (m_glContext) + { GdkWindow *window = GTK_PIZZA(m_widget)->bin_window; glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(window), m_glContext ); } @@ -185,10 +188,10 @@ gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) // "expose_event" of m_wxwindow //----------------------------------------------------------------------------- -static void +static void gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxGLCanvas *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); win->m_exposed = TRUE; @@ -203,10 +206,10 @@ gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_e // "draw" of m_wxwindow //----------------------------------------------------------------------------- -static void +static void gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxGLCanvas *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); win->m_exposed = TRUE; @@ -219,7 +222,7 @@ gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxG // "size_allocate" of m_wxwindow //----------------------------------------------------------------------------- -static void +static void gtk_glcanvas_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxGLCanvas *win ) { if (g_isIdle) @@ -244,77 +247,80 @@ BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow) END_EVENT_TABLE() wxGLCanvas::wxGLCanvas( wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette ) + const wxPoint& pos, const wxSize& size, + long style, const wxString& name, + int *attribList, + const wxPalette& palette ) { Create( parent, NULL, NULL, id, pos, size, style, name, attribList, palette ); } -wxGLCanvas::wxGLCanvas( wxWindow *parent, +wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLContext *shared, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette ) -{ + const wxPoint& pos, const wxSize& size, + long style, const wxString& name, + int *attribList, + const wxPalette& palette ) +{ Create( parent, shared, NULL, id, pos, size, style, name, attribList, palette ); } -wxGLCanvas::wxGLCanvas( wxWindow *parent, +wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette ) -{ + const wxPoint& pos, const wxSize& size, + long style, const wxString& name, + int *attribList, + const wxPalette& palette ) +{ Create( parent, NULL, shared, id, pos, size, style, name, attribList, palette ); } -bool wxGLCanvas::Create( wxWindow *parent, +bool wxGLCanvas::Create( wxWindow *parent, const wxGLContext *shared, const wxGLCanvas *shared_context_of, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette) + const wxPoint& pos, const wxSize& size, + long style, const wxString& name, + int *attribList, + const wxPalette& palette) { m_sharedContext = (wxGLContext*)shared; // const_cast m_sharedContextOf = (wxGLCanvas*)shared_context_of; // const_cast m_glContext = (wxGLContext*) NULL; - + m_exposed = FALSE; m_noExpose = TRUE; m_nativeSizeEvent = TRUE; - + XVisualInfo *vi = NULL; - if (wxTheApp->m_glVisualInfo != NULL) { - vi = (XVisualInfo *) wxTheApp->m_glVisualInfo; + if (wxTheApp->m_glVisualInfo != NULL) + { + vi = (XVisualInfo *) wxTheApp->m_glVisualInfo; m_canFreeVi = FALSE; // owned by wxTheApp - don't free upon destruction - } else { + } + else + { vi = (XVisualInfo *) ChooseGLVisual(attribList); m_canFreeVi = TRUE; } m_vi = vi; // save for later use - - wxCHECK_MSG( m_vi, FALSE, "required visual couldn't be found" ); + + wxCHECK_MSG( m_vi, FALSE, _T("required visual couldn't be found") ); GdkVisual *visual = gdkx_visual_get( vi->visualid ); GdkColormap *colormap = gdk_colormap_new( gdkx_visual_get(vi->visualid), TRUE ); - + gtk_widget_push_colormap( colormap ); gtk_widget_push_visual( visual ); wxWindow::Create( parent, id, pos, size, style, name ); m_glWidget = m_wxwindow; - + gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE ); - + gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize", GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this ); @@ -326,26 +332,26 @@ bool wxGLCanvas::Create( wxWindow *parent, gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer)this ); - + gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer)this ); gtk_widget_pop_visual(); gtk_widget_pop_colormap(); - + if (GTK_WIDGET_REALIZED(m_wxwindow)) gtk_glwindow_realized_callback( m_wxwindow, this ); - + if (GTK_WIDGET_MAPPED(m_wxwindow)) gtk_glwindow_map_callback( m_wxwindow, this ); - + return TRUE; } wxGLCanvas::~wxGLCanvas() { XVisualInfo *vi = (XVisualInfo *) m_vi; - + if (vi && m_canFreeVi) XFree( vi ); if (m_glContext) delete m_glContext; } @@ -365,12 +371,12 @@ void* wxGLCanvas::ChooseGLVisual(int *attribList) data[10] = GLX_ALPHA_SIZE; data[11] = 0; data[12] = None; - attribList = (int*) data; + attribList = (int*) data; } else { int arg=0, p=0; - + while( (attribList[arg]!=0) && (p<510) ) { switch( attribList[arg++] ) @@ -392,9 +398,9 @@ void* wxGLCanvas::ChooseGLVisual(int *attribList) data[p++]=GLX_BLUE_SIZE; data[p++]=attribList[arg++]; break; case WX_GL_MIN_ALPHA: data[p++]=GLX_ALPHA_SIZE; data[p++]=attribList[arg++]; break; - case WX_GL_DEPTH_SIZE: + case WX_GL_DEPTH_SIZE: data[p++]=GLX_DEPTH_SIZE; data[p++]=attribList[arg++]; break; - case WX_GL_STENCIL_SIZE: + case WX_GL_STENCIL_SIZE: data[p++]=GLX_STENCIL_SIZE; data[p++]=attribList[arg++]; break; case WX_GL_MIN_ACCUM_RED: data[p++]=GLX_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break; @@ -407,21 +413,22 @@ void* wxGLCanvas::ChooseGLVisual(int *attribList) default: break; } - } - data[p] = 0; + } + data[p] = 0; attribList = (int*) data; } - - + + Display *dpy = GDK_DISPLAY(); - + return glXChooseVisual( dpy, DefaultScreen(dpy), attribList ); } void wxGLCanvas::SwapBuffers() { - if (m_glContext) m_glContext->SwapBuffers(); + if (m_glContext) + m_glContext->SwapBuffers(); } void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) @@ -430,12 +437,14 @@ void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) void wxGLCanvas::SetCurrent() { - if (m_glContext) m_glContext->SetCurrent(); + if (m_glContext) + m_glContext->SetCurrent(); } void wxGLCanvas::SetColour( const char *colour ) { - if (m_glContext) m_glContext->SetColour( colour ); + if (m_glContext) + m_glContext->SetColour( colour ); } void wxGLCanvas::OnInternalIdle() @@ -449,7 +458,7 @@ void wxGLCanvas::OnInternalIdle() m_exposed = FALSE; GetUpdateRegion().Clear(); } - + wxWindow::OnInternalIdle(); } @@ -460,17 +469,21 @@ void wxGLCanvas::OnInternalIdle() //--------------------------------------------------------------------------- IMPLEMENT_CLASS(wxGLApp, wxApp) - + wxGLApp::~wxGLApp() { - if (m_glVisualInfo) XFree(m_glVisualInfo); + if (m_glVisualInfo) + XFree(m_glVisualInfo); } bool wxGLApp::InitGLVisual(int *attribList) { - if (m_glVisualInfo) XFree(m_glVisualInfo); + if (m_glVisualInfo) + XFree(m_glVisualInfo); + m_glVisualInfo = wxGLCanvas::ChooseGLVisual(attribList); - return (m_glVisualInfo != NULL); + + return m_glVisualInfo != NULL; } #endif diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index 7ca7653e2a..f9ac057cbe 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -191,25 +191,20 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) if ( !width || !height ) return TRUE; - GdkRectangle rect; - rect.x = x; - rect.y = y; - rect.width = width; - rect.height = height; - - if (!m_refData) + if ( !m_refData ) { - m_refData = new wxRegionRefData(); -#ifdef __WXGTK20__ - M_REGIONDATA->m_region = gdk_region_rectangle( &rect ); -#else - M_REGIONDATA->m_region = gdk_region_union_with_rect(wxGdkRegion(), &rect); -#endif + InitRect(x, y, width, height); } else { AllocExclusive(); + GdkRectangle rect; + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = height; + #ifdef __WXGTK20__ gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); #else @@ -274,16 +269,11 @@ bool wxRegion::Intersect( const wxRegion& region ) if (!m_refData) { - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); + // intersecting with invalid region doesn't make sense + return FALSE; + } - // leave here - return TRUE; - } - else - { - AllocExclusive(); - } + AllocExclusive(); #ifdef __WXGTK20__ gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() ); @@ -315,14 +305,12 @@ bool wxRegion::Subtract( const wxRegion& region ) if (!m_refData) { - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); - } - else - { - AllocExclusive(); + // subtracting from an invalid region doesn't make sense + return FALSE; } + AllocExclusive(); + #ifdef __WXGTK20__ gdk_region_subtract( M_REGIONDATA->m_region, region.GetRegion() ); #else @@ -353,14 +341,11 @@ bool wxRegion::Xor( const wxRegion& region ) if (!m_refData) { - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); - } - else - { - AllocExclusive(); + return FALSE; } + AllocExclusive(); + #ifdef __WXGTK20__ gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() ); #else @@ -372,6 +357,18 @@ bool wxRegion::Xor( const wxRegion& region ) return TRUE; } +bool wxRegion::Offset( wxCoord x, wxCoord y ) +{ + if (!m_refData) + return FALSE; + + AllocExclusive(); + + gdk_region_offset( M_REGIONDATA->m_region, x, y ); + + return TRUE; +} + // ---------------------------------------------------------------------------- // wxRegion tests // ---------------------------------------------------------------------------- @@ -403,18 +400,6 @@ wxRect wxRegion::GetBox() const return wxRect( x, y, w, h ); } -bool wxRegion::Offset( wxCoord x, wxCoord y ) -{ - if (!m_refData) - return FALSE; - - AllocExclusive(); - - gdk_region_offset( M_REGIONDATA->m_region, x, y ); - - return TRUE; -} - bool wxRegion::Empty() const { if (!m_refData) @@ -495,7 +480,7 @@ struct _XRegion { _XBox *rects, extents; }; -#endif +#endif // GTK+ 1.x class wxRIRefData: public wxObjectRefData { @@ -592,42 +577,48 @@ bool wxRegionIterator::HaveRects() const return m_current < ((wxRIRefData*)m_refData)->m_numRects; } -wxRegionIterator::operator bool () const +wxRegionIterator& wxRegionIterator::operator ++ () { - return HaveRects(); + if (HaveRects()) + ++m_current; + + return *this; } -void wxRegionIterator::operator ++ () +wxRegionIterator wxRegionIterator::operator ++ (int) { - if (HaveRects()) ++m_current; -} + wxRegionIterator tmp = *this; + if (HaveRects()) + ++m_current; -void wxRegionIterator::operator ++ (int) -{ - if (HaveRects()) ++m_current; + return tmp; } wxCoord wxRegionIterator::GetX() const { - if( !HaveRects() ) return 0; + wxCHECK_MSG( HaveRects(), 0, _T("invalid wxRegionIterator") ); + return ((wxRIRefData*)m_refData)->m_rects[m_current].x; } wxCoord wxRegionIterator::GetY() const { - if( !HaveRects() ) return 0; + wxCHECK_MSG( HaveRects(), 0, _T("invalid wxRegionIterator") ); + return ((wxRIRefData*)m_refData)->m_rects[m_current].y; } wxCoord wxRegionIterator::GetW() const { - if( !HaveRects() ) return -1; + wxCHECK_MSG( HaveRects(), 0, _T("invalid wxRegionIterator") ); + return ((wxRIRefData*)m_refData)->m_rects[m_current].width; } wxCoord wxRegionIterator::GetH() const { - if( !HaveRects() ) return -1; + wxCHECK_MSG( HaveRects(), 0, _T("invalid wxRegionIterator") ); + return ((wxRIRefData*)m_refData)->m_rects[m_current].height; } diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 235319eb16..fe543054f9 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -380,31 +380,34 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) if ( tool->IsButton() ) { - wxBitmap bitmap = tool->GetNormalBitmap(); + if ( !HasFlag(wxTB_NOICONS) ) + { + wxBitmap bitmap = tool->GetNormalBitmap(); - wxCHECK_MSG( bitmap.Ok(), FALSE, - wxT("invalid bitmap for wxToolBar icon") ); + wxCHECK_MSG( bitmap.Ok(), FALSE, + wxT("invalid bitmap for wxToolBar icon") ); - wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE, - wxT("wxToolBar doesn't support GdkBitmap") ); + wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE, + wxT("wxToolBar doesn't support GdkBitmap") ); - wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE, - wxT("wxToolBar::Add needs a wxBitmap") ); + wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE, + wxT("wxToolBar::Add needs a wxBitmap") ); - GtkWidget *tool_pixmap = (GtkWidget *)NULL; + GtkWidget *tool_pixmap = (GtkWidget *)NULL; - GdkPixmap *pixmap = bitmap.GetPixmap(); + GdkPixmap *pixmap = bitmap.GetPixmap(); - GdkBitmap *mask = (GdkBitmap *)NULL; - if ( bitmap.GetMask() ) - mask = bitmap.GetMask()->GetBitmap(); + GdkBitmap *mask = (GdkBitmap *)NULL; + if ( bitmap.GetMask() ) + mask = bitmap.GetMask()->GetBitmap(); - tool_pixmap = gtk_pixmap_new( pixmap, mask ); - gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE ); + tool_pixmap = gtk_pixmap_new( pixmap, mask ); + gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE ); - gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 ); + gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 ); - tool->m_pixmap = tool_pixmap; + tool->m_pixmap = tool_pixmap; + } } switch ( tool->GetStyle() ) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 034a4cce4a..eec8c86a86 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -552,6 +552,7 @@ void wxTextCtrl::WriteText( const wxString &text ) wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) ); #endif GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) ); + // TODO: call wahtever is needed to delete the selection gtk_text_buffer_insert_at_cursor( text_buffer, buffer, strlen(buffer) ); #else // GTK 1.x @@ -561,6 +562,7 @@ void wxTextCtrl::WriteText( const wxString &text ) // always use m_defaultStyle, even if it is empty as otherwise // resetting the style and appending some more text wouldn't work: if // we don't specify the style explicitly, the old style would be used + gtk_editable_delete_selection( GTK_EDITABLE(m_text) ); wxGtkTextInsert(m_text, m_defaultStyle, text.c_str(), text.Len()); // Bring editable's cursor back uptodate. @@ -569,6 +571,9 @@ void wxTextCtrl::WriteText( const wxString &text ) } else // single line { + // First remove the selection if there is one + gtk_editable_delete_selection( GTK_EDITABLE(m_text) ); + // This moves the cursor pos to behind the inserted text. gint len = GET_EDITABLE_POS(m_text); @@ -585,9 +590,6 @@ void wxTextCtrl::WriteText( const wxString &text ) gtk_editable_insert_text( GTK_EDITABLE(m_text), text.c_str(), text.Len(), &len ); #endif - // Bring editable's cursor uptodate. - len += text.Len(); - // Bring entry's cursor uptodate. gtk_entry_set_position( GTK_ENTRY(m_text), len ); } @@ -928,6 +930,12 @@ void wxTextCtrl::SetSelection( long from, long to ) { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + if (from == -1 && to == -1) + { + from = 0; + to = GetValue().Length(); + } + #ifndef __WXGTK20__ if ( (m_windowStyle & wxTE_MULTILINE) && !GTK_TEXT(m_text)->line_start_cache ) diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 1ca2768d11..0866c33410 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -25,6 +25,7 @@ #include "wx/defs.h" +#include "wx/log.h" #include "wx/dialog.h" #include "wx/control.h" #include "wx/app.h" @@ -835,6 +836,11 @@ void wxTopLevelWindowGTK::OnInternalIdle() if ( g_delayedFocus && wxGetTopLevelParent((wxWindow*)g_delayedFocus) == this ) { + wxLogTrace(_T("focus"), + _T("Setting focus from wxTLW::OnIdle() to %s(%s)"), + g_delayedFocus->GetClassInfo()->GetClassName(), + g_delayedFocus->GetLabel().c_str()); + g_delayedFocus->SetFocus(); g_delayedFocus = NULL; } diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 20d8961d6c..61b722b708 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -44,13 +44,27 @@ #endif #include + +// TODO: use configure test to detect which of select()/poll() is available! #if defined(__DARWIN__) -# warning "FIXME: select must be used instead of poll (GD)" + #warning "FIXME: select must be used instead of poll (GD)" #elif defined(__VMS) -# include + #include #else -# include -#endif + // bug in the OpenBSD headers: at least in 3.1 there is no extern "C" in + // neither poll.h nor sys/poll.h which results in link errors later + #ifdef __OPENBSD__ + extern "C" + { + #endif + + #include + + #ifdef __OPENBSD__ + }; + #endif +#endif // platform + #include "wx/gtk/win_gtk.h" #include @@ -545,7 +559,7 @@ bool wxApp::SendIdleEvents( wxWindow* win ) event.SetEventObject(win); win->GetEventHandler()->ProcessEvent(event); - + if (event.MoreRequested()) needMore = TRUE; diff --git a/src/gtk1/colour.cpp b/src/gtk1/colour.cpp index 84c790a329..0eac04248a 100644 --- a/src/gtk1/colour.cpp +++ b/src/gtk1/colour.cpp @@ -217,7 +217,6 @@ void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue ) { AllocExclusive(); - m_refData = new wxColourRefData(); M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT; M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT; M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT; diff --git a/src/gtk1/glcanvas.cpp b/src/gtk1/glcanvas.cpp index e46cac9e32..03a256aeda 100644 --- a/src/gtk1/glcanvas.cpp +++ b/src/gtk1/glcanvas.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: glcanvas.cpp +// Name: gtk/glcanvas.cpp // Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK // Author: Robert Roebling // Modified by: // Created: 17/08/98 // RCS-ID: $Id$ // Copyright: (c) Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -24,7 +24,8 @@ #include "wx/module.h" #include "wx/app.h" -extern "C" { +extern "C" +{ #include "gtk/gtk.h" #include "gdk/gdk.h" #include "gdk/gdkx.h" @@ -58,16 +59,16 @@ wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette& wxGLCanvas *gc = (wxGLCanvas*) win; XVisualInfo *vi = (XVisualInfo *) gc->m_vi; - - wxCHECK_RET( vi, "invalid visual for OpenGl" ); - + + wxCHECK_RET( vi, _T("invalid visual for OpenGl") ); + m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE ); - - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); + + wxCHECK_RET( m_glContext, _T("Couldn't create OpenGl context") ); } -wxGLContext::wxGLContext( - bool WXUNUSED(isRGB), wxWindow *win, +wxGLContext::wxGLContext( + bool WXUNUSED(isRGB), wxWindow *win, const wxPalette& WXUNUSED(palette), const wxGLContext *other /* for sharing display lists */ ) @@ -77,26 +78,28 @@ wxGLContext::wxGLContext( wxGLCanvas *gc = (wxGLCanvas*) win; XVisualInfo *vi = (XVisualInfo *) gc->m_vi; - - wxCHECK_RET( vi, "invalid visual for OpenGl" ); - - if( other != 0 ) - m_glContext = glXCreateContext( GDK_DISPLAY(), vi, other->m_glContext, GL_TRUE ); - else - m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE ); - - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); + + wxCHECK_RET( vi, _T("invalid visual for OpenGl") ); + + m_glContext = glXCreateContext( GDK_DISPLAY(), vi, + other ? other->m_glContext : None, + GL_TRUE ); + + if ( !m_glContext ) + { + wxFAIL_MSG( _T("Couldn't create OpenGl context") ); + } } wxGLContext::~wxGLContext() { if (!m_glContext) return; - + if (m_glContext == glXGetCurrentContext()) { glXMakeCurrent( GDK_DISPLAY(), None, NULL); } - + glXDestroyContext( GDK_DISPLAY(), m_glContext ); } @@ -111,8 +114,8 @@ void wxGLContext::SwapBuffers() void wxGLContext::SetCurrent() { - if (m_glContext) - { + if (m_glContext) + { GdkWindow *window = GTK_PIZZA(m_widget)->bin_window; glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(window), m_glContext ); } @@ -185,10 +188,10 @@ gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) // "expose_event" of m_wxwindow //----------------------------------------------------------------------------- -static void +static void gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxGLCanvas *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); win->m_exposed = TRUE; @@ -203,10 +206,10 @@ gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_e // "draw" of m_wxwindow //----------------------------------------------------------------------------- -static void +static void gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxGLCanvas *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); win->m_exposed = TRUE; @@ -219,7 +222,7 @@ gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxG // "size_allocate" of m_wxwindow //----------------------------------------------------------------------------- -static void +static void gtk_glcanvas_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxGLCanvas *win ) { if (g_isIdle) @@ -244,77 +247,80 @@ BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow) END_EVENT_TABLE() wxGLCanvas::wxGLCanvas( wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette ) + const wxPoint& pos, const wxSize& size, + long style, const wxString& name, + int *attribList, + const wxPalette& palette ) { Create( parent, NULL, NULL, id, pos, size, style, name, attribList, palette ); } -wxGLCanvas::wxGLCanvas( wxWindow *parent, +wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLContext *shared, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette ) -{ + const wxPoint& pos, const wxSize& size, + long style, const wxString& name, + int *attribList, + const wxPalette& palette ) +{ Create( parent, shared, NULL, id, pos, size, style, name, attribList, palette ); } -wxGLCanvas::wxGLCanvas( wxWindow *parent, +wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette ) -{ + const wxPoint& pos, const wxSize& size, + long style, const wxString& name, + int *attribList, + const wxPalette& palette ) +{ Create( parent, NULL, shared, id, pos, size, style, name, attribList, palette ); } -bool wxGLCanvas::Create( wxWindow *parent, +bool wxGLCanvas::Create( wxWindow *parent, const wxGLContext *shared, const wxGLCanvas *shared_context_of, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette) + const wxPoint& pos, const wxSize& size, + long style, const wxString& name, + int *attribList, + const wxPalette& palette) { m_sharedContext = (wxGLContext*)shared; // const_cast m_sharedContextOf = (wxGLCanvas*)shared_context_of; // const_cast m_glContext = (wxGLContext*) NULL; - + m_exposed = FALSE; m_noExpose = TRUE; m_nativeSizeEvent = TRUE; - + XVisualInfo *vi = NULL; - if (wxTheApp->m_glVisualInfo != NULL) { - vi = (XVisualInfo *) wxTheApp->m_glVisualInfo; + if (wxTheApp->m_glVisualInfo != NULL) + { + vi = (XVisualInfo *) wxTheApp->m_glVisualInfo; m_canFreeVi = FALSE; // owned by wxTheApp - don't free upon destruction - } else { + } + else + { vi = (XVisualInfo *) ChooseGLVisual(attribList); m_canFreeVi = TRUE; } m_vi = vi; // save for later use - - wxCHECK_MSG( m_vi, FALSE, "required visual couldn't be found" ); + + wxCHECK_MSG( m_vi, FALSE, _T("required visual couldn't be found") ); GdkVisual *visual = gdkx_visual_get( vi->visualid ); GdkColormap *colormap = gdk_colormap_new( gdkx_visual_get(vi->visualid), TRUE ); - + gtk_widget_push_colormap( colormap ); gtk_widget_push_visual( visual ); wxWindow::Create( parent, id, pos, size, style, name ); m_glWidget = m_wxwindow; - + gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE ); - + gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize", GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this ); @@ -326,26 +332,26 @@ bool wxGLCanvas::Create( wxWindow *parent, gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer)this ); - + gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer)this ); gtk_widget_pop_visual(); gtk_widget_pop_colormap(); - + if (GTK_WIDGET_REALIZED(m_wxwindow)) gtk_glwindow_realized_callback( m_wxwindow, this ); - + if (GTK_WIDGET_MAPPED(m_wxwindow)) gtk_glwindow_map_callback( m_wxwindow, this ); - + return TRUE; } wxGLCanvas::~wxGLCanvas() { XVisualInfo *vi = (XVisualInfo *) m_vi; - + if (vi && m_canFreeVi) XFree( vi ); if (m_glContext) delete m_glContext; } @@ -365,12 +371,12 @@ void* wxGLCanvas::ChooseGLVisual(int *attribList) data[10] = GLX_ALPHA_SIZE; data[11] = 0; data[12] = None; - attribList = (int*) data; + attribList = (int*) data; } else { int arg=0, p=0; - + while( (attribList[arg]!=0) && (p<510) ) { switch( attribList[arg++] ) @@ -392,9 +398,9 @@ void* wxGLCanvas::ChooseGLVisual(int *attribList) data[p++]=GLX_BLUE_SIZE; data[p++]=attribList[arg++]; break; case WX_GL_MIN_ALPHA: data[p++]=GLX_ALPHA_SIZE; data[p++]=attribList[arg++]; break; - case WX_GL_DEPTH_SIZE: + case WX_GL_DEPTH_SIZE: data[p++]=GLX_DEPTH_SIZE; data[p++]=attribList[arg++]; break; - case WX_GL_STENCIL_SIZE: + case WX_GL_STENCIL_SIZE: data[p++]=GLX_STENCIL_SIZE; data[p++]=attribList[arg++]; break; case WX_GL_MIN_ACCUM_RED: data[p++]=GLX_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break; @@ -407,21 +413,22 @@ void* wxGLCanvas::ChooseGLVisual(int *attribList) default: break; } - } - data[p] = 0; + } + data[p] = 0; attribList = (int*) data; } - - + + Display *dpy = GDK_DISPLAY(); - + return glXChooseVisual( dpy, DefaultScreen(dpy), attribList ); } void wxGLCanvas::SwapBuffers() { - if (m_glContext) m_glContext->SwapBuffers(); + if (m_glContext) + m_glContext->SwapBuffers(); } void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) @@ -430,12 +437,14 @@ void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) void wxGLCanvas::SetCurrent() { - if (m_glContext) m_glContext->SetCurrent(); + if (m_glContext) + m_glContext->SetCurrent(); } void wxGLCanvas::SetColour( const char *colour ) { - if (m_glContext) m_glContext->SetColour( colour ); + if (m_glContext) + m_glContext->SetColour( colour ); } void wxGLCanvas::OnInternalIdle() @@ -449,7 +458,7 @@ void wxGLCanvas::OnInternalIdle() m_exposed = FALSE; GetUpdateRegion().Clear(); } - + wxWindow::OnInternalIdle(); } @@ -460,17 +469,21 @@ void wxGLCanvas::OnInternalIdle() //--------------------------------------------------------------------------- IMPLEMENT_CLASS(wxGLApp, wxApp) - + wxGLApp::~wxGLApp() { - if (m_glVisualInfo) XFree(m_glVisualInfo); + if (m_glVisualInfo) + XFree(m_glVisualInfo); } bool wxGLApp::InitGLVisual(int *attribList) { - if (m_glVisualInfo) XFree(m_glVisualInfo); + if (m_glVisualInfo) + XFree(m_glVisualInfo); + m_glVisualInfo = wxGLCanvas::ChooseGLVisual(attribList); - return (m_glVisualInfo != NULL); + + return m_glVisualInfo != NULL; } #endif diff --git a/src/gtk1/region.cpp b/src/gtk1/region.cpp index 7ca7653e2a..f9ac057cbe 100644 --- a/src/gtk1/region.cpp +++ b/src/gtk1/region.cpp @@ -191,25 +191,20 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) if ( !width || !height ) return TRUE; - GdkRectangle rect; - rect.x = x; - rect.y = y; - rect.width = width; - rect.height = height; - - if (!m_refData) + if ( !m_refData ) { - m_refData = new wxRegionRefData(); -#ifdef __WXGTK20__ - M_REGIONDATA->m_region = gdk_region_rectangle( &rect ); -#else - M_REGIONDATA->m_region = gdk_region_union_with_rect(wxGdkRegion(), &rect); -#endif + InitRect(x, y, width, height); } else { AllocExclusive(); + GdkRectangle rect; + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = height; + #ifdef __WXGTK20__ gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); #else @@ -274,16 +269,11 @@ bool wxRegion::Intersect( const wxRegion& region ) if (!m_refData) { - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); + // intersecting with invalid region doesn't make sense + return FALSE; + } - // leave here - return TRUE; - } - else - { - AllocExclusive(); - } + AllocExclusive(); #ifdef __WXGTK20__ gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() ); @@ -315,14 +305,12 @@ bool wxRegion::Subtract( const wxRegion& region ) if (!m_refData) { - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); - } - else - { - AllocExclusive(); + // subtracting from an invalid region doesn't make sense + return FALSE; } + AllocExclusive(); + #ifdef __WXGTK20__ gdk_region_subtract( M_REGIONDATA->m_region, region.GetRegion() ); #else @@ -353,14 +341,11 @@ bool wxRegion::Xor( const wxRegion& region ) if (!m_refData) { - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); - } - else - { - AllocExclusive(); + return FALSE; } + AllocExclusive(); + #ifdef __WXGTK20__ gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() ); #else @@ -372,6 +357,18 @@ bool wxRegion::Xor( const wxRegion& region ) return TRUE; } +bool wxRegion::Offset( wxCoord x, wxCoord y ) +{ + if (!m_refData) + return FALSE; + + AllocExclusive(); + + gdk_region_offset( M_REGIONDATA->m_region, x, y ); + + return TRUE; +} + // ---------------------------------------------------------------------------- // wxRegion tests // ---------------------------------------------------------------------------- @@ -403,18 +400,6 @@ wxRect wxRegion::GetBox() const return wxRect( x, y, w, h ); } -bool wxRegion::Offset( wxCoord x, wxCoord y ) -{ - if (!m_refData) - return FALSE; - - AllocExclusive(); - - gdk_region_offset( M_REGIONDATA->m_region, x, y ); - - return TRUE; -} - bool wxRegion::Empty() const { if (!m_refData) @@ -495,7 +480,7 @@ struct _XRegion { _XBox *rects, extents; }; -#endif +#endif // GTK+ 1.x class wxRIRefData: public wxObjectRefData { @@ -592,42 +577,48 @@ bool wxRegionIterator::HaveRects() const return m_current < ((wxRIRefData*)m_refData)->m_numRects; } -wxRegionIterator::operator bool () const +wxRegionIterator& wxRegionIterator::operator ++ () { - return HaveRects(); + if (HaveRects()) + ++m_current; + + return *this; } -void wxRegionIterator::operator ++ () +wxRegionIterator wxRegionIterator::operator ++ (int) { - if (HaveRects()) ++m_current; -} + wxRegionIterator tmp = *this; + if (HaveRects()) + ++m_current; -void wxRegionIterator::operator ++ (int) -{ - if (HaveRects()) ++m_current; + return tmp; } wxCoord wxRegionIterator::GetX() const { - if( !HaveRects() ) return 0; + wxCHECK_MSG( HaveRects(), 0, _T("invalid wxRegionIterator") ); + return ((wxRIRefData*)m_refData)->m_rects[m_current].x; } wxCoord wxRegionIterator::GetY() const { - if( !HaveRects() ) return 0; + wxCHECK_MSG( HaveRects(), 0, _T("invalid wxRegionIterator") ); + return ((wxRIRefData*)m_refData)->m_rects[m_current].y; } wxCoord wxRegionIterator::GetW() const { - if( !HaveRects() ) return -1; + wxCHECK_MSG( HaveRects(), 0, _T("invalid wxRegionIterator") ); + return ((wxRIRefData*)m_refData)->m_rects[m_current].width; } wxCoord wxRegionIterator::GetH() const { - if( !HaveRects() ) return -1; + wxCHECK_MSG( HaveRects(), 0, _T("invalid wxRegionIterator") ); + return ((wxRIRefData*)m_refData)->m_rects[m_current].height; } diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 235319eb16..fe543054f9 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -380,31 +380,34 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) if ( tool->IsButton() ) { - wxBitmap bitmap = tool->GetNormalBitmap(); + if ( !HasFlag(wxTB_NOICONS) ) + { + wxBitmap bitmap = tool->GetNormalBitmap(); - wxCHECK_MSG( bitmap.Ok(), FALSE, - wxT("invalid bitmap for wxToolBar icon") ); + wxCHECK_MSG( bitmap.Ok(), FALSE, + wxT("invalid bitmap for wxToolBar icon") ); - wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE, - wxT("wxToolBar doesn't support GdkBitmap") ); + wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE, + wxT("wxToolBar doesn't support GdkBitmap") ); - wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE, - wxT("wxToolBar::Add needs a wxBitmap") ); + wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE, + wxT("wxToolBar::Add needs a wxBitmap") ); - GtkWidget *tool_pixmap = (GtkWidget *)NULL; + GtkWidget *tool_pixmap = (GtkWidget *)NULL; - GdkPixmap *pixmap = bitmap.GetPixmap(); + GdkPixmap *pixmap = bitmap.GetPixmap(); - GdkBitmap *mask = (GdkBitmap *)NULL; - if ( bitmap.GetMask() ) - mask = bitmap.GetMask()->GetBitmap(); + GdkBitmap *mask = (GdkBitmap *)NULL; + if ( bitmap.GetMask() ) + mask = bitmap.GetMask()->GetBitmap(); - tool_pixmap = gtk_pixmap_new( pixmap, mask ); - gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE ); + tool_pixmap = gtk_pixmap_new( pixmap, mask ); + gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE ); - gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 ); + gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 ); - tool->m_pixmap = tool_pixmap; + tool->m_pixmap = tool_pixmap; + } } switch ( tool->GetStyle() ) diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 034a4cce4a..eec8c86a86 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -552,6 +552,7 @@ void wxTextCtrl::WriteText( const wxString &text ) wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) ); #endif GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) ); + // TODO: call wahtever is needed to delete the selection gtk_text_buffer_insert_at_cursor( text_buffer, buffer, strlen(buffer) ); #else // GTK 1.x @@ -561,6 +562,7 @@ void wxTextCtrl::WriteText( const wxString &text ) // always use m_defaultStyle, even if it is empty as otherwise // resetting the style and appending some more text wouldn't work: if // we don't specify the style explicitly, the old style would be used + gtk_editable_delete_selection( GTK_EDITABLE(m_text) ); wxGtkTextInsert(m_text, m_defaultStyle, text.c_str(), text.Len()); // Bring editable's cursor back uptodate. @@ -569,6 +571,9 @@ void wxTextCtrl::WriteText( const wxString &text ) } else // single line { + // First remove the selection if there is one + gtk_editable_delete_selection( GTK_EDITABLE(m_text) ); + // This moves the cursor pos to behind the inserted text. gint len = GET_EDITABLE_POS(m_text); @@ -585,9 +590,6 @@ void wxTextCtrl::WriteText( const wxString &text ) gtk_editable_insert_text( GTK_EDITABLE(m_text), text.c_str(), text.Len(), &len ); #endif - // Bring editable's cursor uptodate. - len += text.Len(); - // Bring entry's cursor uptodate. gtk_entry_set_position( GTK_ENTRY(m_text), len ); } @@ -928,6 +930,12 @@ void wxTextCtrl::SetSelection( long from, long to ) { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + if (from == -1 && to == -1) + { + from = 0; + to = GetValue().Length(); + } + #ifndef __WXGTK20__ if ( (m_windowStyle & wxTE_MULTILINE) && !GTK_TEXT(m_text)->line_start_cache ) diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index 1ca2768d11..0866c33410 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -25,6 +25,7 @@ #include "wx/defs.h" +#include "wx/log.h" #include "wx/dialog.h" #include "wx/control.h" #include "wx/app.h" @@ -835,6 +836,11 @@ void wxTopLevelWindowGTK::OnInternalIdle() if ( g_delayedFocus && wxGetTopLevelParent((wxWindow*)g_delayedFocus) == this ) { + wxLogTrace(_T("focus"), + _T("Setting focus from wxTLW::OnIdle() to %s(%s)"), + g_delayedFocus->GetClassInfo()->GetClassName(), + g_delayedFocus->GetLabel().c_str()); + g_delayedFocus->SetFocus(); g_delayedFocus = NULL; } diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index 4e1c99dcc4..ab2a8df644 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -878,10 +878,15 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path cfg->Write(wxT("hcNavigPanel"), m_Cfg.navig_on); cfg->Write(wxT("hcSashPos"), (long)m_Cfg.sashpos); - cfg->Write(wxT("hcX"), (long)m_Cfg.x); - cfg->Write(wxT("hcY"), (long)m_Cfg.y); - cfg->Write(wxT("hcW"), (long)m_Cfg.w); - cfg->Write(wxT("hcH"), (long)m_Cfg.h); + if ( !IsIconized() ) + { + // Don't write if iconized as this would make the window + // disappear next time it is shown! + cfg->Write(wxT("hcX"), (long)m_Cfg.x); + cfg->Write(wxT("hcY"), (long)m_Cfg.y); + cfg->Write(wxT("hcW"), (long)m_Cfg.w); + cfg->Write(wxT("hcH"), (long)m_Cfg.h); + } cfg->Write(wxT("hcFixedFace"), m_FixedFace); cfg->Write(wxT("hcNormalFace"), m_NormalFace); cfg->Write(wxT("hcBaseFontSize"), (long)m_FontSize); diff --git a/src/html/htmlfilter.cpp b/src/html/htmlfilter.cpp deleted file mode 100644 index 57508b1069..0000000000 --- a/src/html/htmlfilter.cpp +++ /dev/null @@ -1,172 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: filter.cpp -// Purpose: wxHtmlFilter - input filter for translating into HTML format -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - - -#ifdef __GNUG__ -#pragma implementation "htmlfilter.h" -#endif - -#include "wx/wxprec.h" - -#if wxUSE_HTML - -#ifdef __BORDLANDC__ -#pragma hdrstop -#endif - -#ifndef WXPRECOMP -#endif - -#include "wx/html/htmlfilter.h" -#include "wx/html/htmlwin.h" - - -/* - -There is code for several default filters: - -*/ - -IMPLEMENT_ABSTRACT_CLASS(wxHtmlFilter, wxObject) - -//-------------------------------------------------------------------------------- -// wxHtmlFilterPlainText -// filter for text/plain or uknown -//-------------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterPlainText, wxHtmlFilter) - -bool wxHtmlFilterPlainText::CanRead(const wxFSFile& WXUNUSED(file)) const -{ - return TRUE; -} - - - -wxString wxHtmlFilterPlainText::ReadFile(const wxFSFile& file) const -{ - wxInputStream *s = file.GetStream(); - char *src; - wxString doc, doc2; - - if (s == NULL) return wxEmptyString; - src = new char[s -> GetSize()+1]; - src[s -> GetSize()] = 0; - s -> Read(src, s -> GetSize()); - doc = src; - delete [] src; - - doc.Replace(_T("<"), _T("<"), TRUE); - doc.Replace(_T(">"), _T(">"), TRUE); - doc2 = _T("

\n") + doc + _T("\n
"); - return doc2; -} - - - - - -//-------------------------------------------------------------------------------- -// wxHtmlFilterImage -// filter for image/* -//-------------------------------------------------------------------------------- - -class wxHtmlFilterImage : public wxHtmlFilter -{ - DECLARE_DYNAMIC_CLASS(wxHtmlFilterImage) - - public: - virtual bool CanRead(const wxFSFile& file) const; - virtual wxString ReadFile(const wxFSFile& file) const; -}; - -IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterImage, wxHtmlFilter) - - - -bool wxHtmlFilterImage::CanRead(const wxFSFile& file) const -{ - return (file.GetMimeType().Left(6) == "image/"); -} - - - -wxString wxHtmlFilterImage::ReadFile(const wxFSFile& file) const -{ - return (""); -} - - - - -//-------------------------------------------------------------------------------- -// wxHtmlFilterPlainText -// filter for text/plain or uknown -//-------------------------------------------------------------------------------- - -class wxHtmlFilterHTML : public wxHtmlFilter -{ - DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML) - - public: - virtual bool CanRead(const wxFSFile& file) const; - virtual wxString ReadFile(const wxFSFile& file) const; -}; - - -IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterHTML, wxHtmlFilter) - -bool wxHtmlFilterHTML::CanRead(const wxFSFile& file) const -{ -// return (file.GetMimeType() == "text/html"); -// This is true in most case but some page can return: -// "text/html; char-encoding=...." -// So we use Find instead - return (file.GetMimeType().Find(_T("text/html")) == 0); -} - - - -wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const -{ - wxInputStream *s = file.GetStream(); - char *src; - wxString doc; - - if (s == NULL) return wxEmptyString; - src = new char[s -> GetSize() + 1]; - src[s -> GetSize()] = 0; - s -> Read(src, s -> GetSize()); - doc = src; - delete[] src; - - return doc; -} - - - - -///// Module: - -class wxHtmlFilterModule : public wxModule -{ - DECLARE_DYNAMIC_CLASS(wxHtmlFilterModule) - - public: - virtual bool OnInit() - { - wxHtmlWindow::AddFilter(new wxHtmlFilterHTML); - wxHtmlWindow::AddFilter(new wxHtmlFilterImage); - return TRUE; - } - virtual void OnExit() {} -}; - -IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterModule, wxModule) - -#endif diff --git a/src/html/htmlhelp.cpp b/src/html/htmlhelp.cpp deleted file mode 100644 index 8ea6466640..0000000000 --- a/src/html/htmlhelp.cpp +++ /dev/null @@ -1,839 +0,0 @@ -// Name: htmlhelp.cpp -// Purpose: Help controller -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#error This file should not be compiled! Update your build system! \ -(configure users, rerun configure to get a new Makefile) \ -Instead of htmlhelp[_io], use helpdata, helpfrm and helpctrl. This \ -file is only left to point out the problem and will be removed r.s.n. - -#ifdef __GNUG__ -#pragma implementation "htmlhelp.h" -#endif - -#include "wx/wxprec.h" - -#if wxUSE_HTML - -#ifdef __BORDLANDC__ -#pragma hdrstop -#endif - -#ifndef WXPRECOMP -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#if !((wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))) -#include -#endif - - -// Bitmaps: - -#ifndef __WXMSW__ - // XPM hack: make the arrays const - #define static static const - - #include "bitmaps/panel.xpm" - #include "bitmaps/back.xpm" - #include "bitmaps/forward.xpm" - #include "bitmaps/book.xpm" - #include "bitmaps/folder.xpm" - #include "bitmaps/page.xpm" - - #undef static -#endif - -#include "search.h" - - - - -#include -WX_DEFINE_OBJARRAY(HtmlBookRecArray) - - - - - - - - - -//----------------------------------------------------------------------------- -// wxHtmlHelpController -//----------------------------------------------------------------------------- - - -IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxEvtHandler) - - -wxHtmlHelpController::wxHtmlHelpController() : wxEvtHandler() -{ - m_Frame = NULL; - m_Config = NULL; - m_ConfigRoot = wxEmptyString; - m_TitleFormat = _("Help : %s"); - m_TempPath = wxEmptyString; - - m_Cfg.x = m_Cfg.y = 0; - m_Cfg.w = 700; m_Cfg.h = 480; - m_Cfg.sashpos = 240; - m_Cfg.navig_on = TRUE; - - m_ContentsImageList = new wxImageList(12, 12); - m_ContentsImageList -> Add(wxICON(book)); - m_ContentsImageList -> Add(wxICON(folder)); - m_ContentsImageList -> Add(wxICON(page)); - - m_Contents = NULL; - m_ContentsCnt = 0; - m_Index = NULL; - m_IndexCnt = 0; - - m_IndexBox = NULL; - m_ContentsBox = NULL; - m_SearchList = NULL; - m_SearchText = NULL; - m_SearchButton = NULL; - m_HtmlWin = NULL; - m_Splitter = NULL; - m_NavigPan = NULL; -} - - - -wxHtmlHelpController::~wxHtmlHelpController() -{ - int i; - - m_BookRecords.Empty(); - delete m_ContentsImageList; - if (m_Contents) { - for (i = 0; i < m_ContentsCnt; i++) { - delete[] m_Contents[i].m_Page; - delete[] m_Contents[i].m_Name; - } - free(m_Contents); - } - if (m_Index) { - for (i = 0; i < m_IndexCnt; i++) { - delete[] m_Index[i].m_Page; - delete[] m_Index[i].m_Name; - } - free(m_Index); - } -} - - - -void wxHtmlHelpController::SetTempDir(const wxString& path) -{ - if (path == wxEmptyString) m_TempPath = path; - else { - if (wxIsAbsolutePath(path)) m_TempPath = path; - else m_TempPath = wxGetCwd() + "/" + path; - - if (m_TempPath[m_TempPath.Length() - 1] != '/') - m_TempPath << "/"; - } -} - - - - -// Reads one line, stores it into buf and returns pointer to new line or NULL. -static char* ReadLine(char *line, char *buf) -{ - char *writeptr = buf, *readptr = line; - - while (*readptr != 0 && *readptr != '\r' && *readptr != '\n') *(writeptr++) = *(readptr++); - *writeptr = 0; - while (*readptr == '\r' || *readptr == '\n') readptr++; - if (*readptr == 0) return NULL; - else return readptr; -} - - -static wxString SafeFileName(const wxString& s) -{ - wxString res = s; - res.Replace(_T(":"), _T("_"), TRUE); - res.Replace(_T(" "), _T("_"), TRUE); - res.Replace(_T("/"), _T("_"), TRUE); - res.Replace(_T("\\"), _T("_"), TRUE); - res.Replace(_T("#"), _T("_"), TRUE); - res.Replace(_T("."), _T("_"), TRUE); - return res; -} - - -static int IndexCompareFunc(const void *a, const void *b) -{ - return strcmp(((HtmlContentsItem*)a) -> m_Name, ((HtmlContentsItem*)b) -> m_Name); -} - - - -bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) -{ - wxFSFile *fi; - wxFileSystem fsys; - wxInputStream *s; - HtmlBookRecord *bookr; - wxString bookFull; - - int sz; - char *buff, *lineptr; - char linebuf[300]; - - wxString title = _("noname"), - safetitle, - start = wxEmptyString, - contents = wxEmptyString, index = wxEmptyString; - - if (wxIsAbsolutePath(book)) bookFull = book; - else bookFull = wxGetCwd() + "/" + book; - - fi = fsys.OpenFile(bookFull); - if (fi == NULL) return FALSE; - fsys.ChangePathTo(bookFull); - s = fi -> GetStream(); - sz = s -> GetSize(); - buff = new char[sz+1]; - buff[sz] = 0; - s -> Read(buff, sz); - lineptr = buff; - delete fi; - - while ((lineptr = ReadLine(lineptr, linebuf)) != NULL) { - if (strstr(linebuf, "Title=") == linebuf) - title = linebuf + strlen("Title="); - if (strstr(linebuf, "Default topic=") == linebuf) - start = linebuf + strlen("Default topic="); - if (strstr(linebuf, "Index file=") == linebuf) - index = linebuf + strlen("Index file="); - if (strstr(linebuf, "Contents file=") == linebuf) - contents = linebuf + strlen("Contents file="); - } - delete[] buff; - - bookr = new HtmlBookRecord(fsys.GetPath(), title, start); - - if (m_ContentsCnt % HTML_REALLOC_STEP == 0) - m_Contents = (HtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + HTML_REALLOC_STEP) * sizeof(HtmlContentsItem)); - m_Contents[m_ContentsCnt].m_Level = 0; - m_Contents[m_ContentsCnt].m_ID = 0; - m_Contents[m_ContentsCnt].m_Page = new char[start.Length() + 1]; - strcpy(m_Contents[m_ContentsCnt].m_Page, start.c_str()); - m_Contents[m_ContentsCnt].m_Name = new char [title.Length() + 1]; - strcpy(m_Contents[m_ContentsCnt].m_Name, title.c_str()); - m_Contents[m_ContentsCnt].m_Book = bookr; - m_ContentsCnt++; - - // Try to find cached binary versions: - safetitle = SafeFileName(title); - fi = fsys.OpenFile(safetitle + ".cached"); - if (fi == NULL) fi = fsys.OpenFile(m_TempPath + safetitle + ".cached"); - if ((fi == NULL) || (m_TempPath == wxEmptyString)) { - LoadMSProject(bookr, fsys, index, contents, show_wait_msg); - if (m_TempPath != wxEmptyString) { - wxFileOutputStream *outs = new wxFileOutputStream(m_TempPath + safetitle + ".cached"); - SaveCachedBook(bookr, outs); - delete outs; - } - } - else { - LoadCachedBook(bookr, fi -> GetStream()); - delete fi; - } - - m_BookRecords.Add(bookr); - if (m_IndexCnt > 0) - qsort(m_Index, m_IndexCnt, sizeof(HtmlContentsItem), IndexCompareFunc); - - return TRUE; -} - - - - -void wxHtmlHelpController::Display(const wxString& x) -{ - int cnt; - int i; - wxFileSystem fsys; - wxFSFile *f; - - CreateHelpWindow(); - - /* 1. try to open given file: */ - - cnt = m_BookRecords.GetCount(); - for (i = 0; i < cnt; i++) { - f = fsys.OpenFile(m_BookRecords[i].GetBasePath() + x); - if (f) { - m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + x); - delete f; - return; - } - } - - - /* 2. try to find a book: */ - - for (i = 0; i < cnt; i++) { - if (m_BookRecords[i].GetTitle() == x) { - m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + m_BookRecords[i].GetStart()); - return; - } - } - - /* 3. try to find in contents: */ - - cnt = m_ContentsCnt; - for (i = 0; i < cnt; i++) { - if (strcmp(m_Contents[i].m_Name, x) == 0) { - m_HtmlWin -> LoadPage(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page); - return; - } - } - - - /* 4. try to find in index: */ - - cnt = m_IndexCnt; - for (i = 0; i < cnt; i++) { - if (strcmp(m_Index[i].m_Name, x) == 0) { - m_HtmlWin -> LoadPage(m_Index[i].m_Book -> GetBasePath() + m_Index[i].m_Page); - return; - } - } - - - /* 5. if everything failed, search the documents: */ - - KeywordSearch(x); -} - - - -void wxHtmlHelpController::Display(const int id) -{ - CreateHelpWindow(); - - for (int i = 0; i < m_ContentsCnt; i++) { - if (m_Contents[i].m_ID == id) { - m_HtmlWin -> LoadPage(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page); - return; - } - } -} - - - -void wxHtmlHelpController::DisplayContents() -{ - CreateHelpWindow(); - m_Frame -> Raise(); - if (!m_Splitter -> IsSplit()) { - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); - } - m_NavigPan -> SetSelection(0); -} - - - -void wxHtmlHelpController::DisplayIndex() -{ - CreateHelpWindow(); - m_Frame -> Raise(); - if (!m_Splitter -> IsSplit()) { - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); - } - m_NavigPan -> SetSelection(1); -} - - - - -#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) - -class MyProgressDlg : public wxDialog -{ - public: - bool m_Canceled; - - MyProgressDlg(wxWindow *parent) : wxDialog(parent, -1, - _("Searching..."), - wxPoint(0, 0), -#ifdef __WXGTK__ - wxSize(300, 110) -#else - wxSize(300, 130) -#endif - ) - {m_Canceled = FALSE;} - void OnCancel(wxCommandEvent& event) {m_Canceled = TRUE;} - DECLARE_EVENT_TABLE() -}; -BEGIN_EVENT_TABLE(MyProgressDlg, wxDialog) - EVT_BUTTON(wxID_CANCEL, MyProgressDlg::OnCancel) -END_EVENT_TABLE() - -#endif - - -bool wxHtmlHelpController::KeywordSearch(const wxString& keyword) -{ - int foundcnt = 0; - CreateHelpWindow(); - // if these are not set, we can't continue - if (! (m_SearchList && m_HtmlWin)) - return FALSE; - m_Frame -> Raise(); - if (m_Splitter && m_NavigPan && m_SearchButton) { - if (!m_Splitter -> IsSplit()) { - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); - } - m_NavigPan -> SetSelection(2); - m_SearchList -> Clear(); - m_SearchText -> SetValue(keyword); - m_SearchButton -> Enable(FALSE); - } - { - int cnt = m_ContentsCnt; - wxSearchEngine engine; - wxFileSystem fsys; - wxFSFile *file; - wxString lastpage = wxEmptyString; - wxString foundstr; - -#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) - MyProgressDlg progress(m_Frame); - - wxStaticText *prompt = new wxStaticText(&progress, -1, "", wxPoint(20, 50), wxSize(260, 25), wxALIGN_CENTER); - wxGauge *gauge = new wxGauge(&progress, -1, cnt, wxPoint(20, 20), wxSize(260, 25)); - wxButton *btn = new wxButton(&progress, wxID_CANCEL, _("Cancel"), wxPoint(110, 70), wxSize(80, 25)); - btn = btn; /* fool compiler :-) */ - prompt -> SetLabel(_("No matching page found yet")); - - progress.Centre(wxBOTH); - progress.Show(TRUE); -#else - wxProgressDialog progress(_("Searching..."), _("No matching page found yet"), cnt, m_Frame, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE); -#endif - - engine.LookFor(keyword); - - for (int i = 0; i < cnt; i++) { -#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) - gauge -> SetValue(i); - if (progress.m_Canceled) break; -#else - if (progress.Update(i) == FALSE) break; -#endif - wxYield(); - - file = fsys.OpenFile(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page); - if (file) { - if (lastpage != file -> GetLocation()) { - lastpage = file -> GetLocation(); - if (engine.Scan(file -> GetStream())) { - foundstr.Printf(_("Found %i matches"), ++foundcnt); -#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) - prompt -> SetLabel(foundstr); -#else - progress.Update(i, foundstr); -#endif - wxYield(); - m_SearchList -> Append(m_Contents[i].m_Name, (char*)(m_Contents + i)); - } - } - delete file; - } - } - -#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) - progress.Close(TRUE); -#endif - } - if (m_SearchButton) - m_SearchButton -> Enable(TRUE); - if (m_SearchText) { - m_SearchText -> SetSelection(0, keyword.Length()); - m_SearchText -> SetFocus(); - } - if (foundcnt) { - HtmlContentsItem *it = (HtmlContentsItem*) m_SearchList -> GetClientData(0); - if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); - } - return (foundcnt > 0); -} - - - - - - -void wxHtmlHelpController::CreateHelpWindow() -{ - wxBusyCursor cur; - wxString oldpath; - wxStatusBar *sbar; - - if (m_Frame) { - m_Frame -> Raise(); - m_Frame -> Show(TRUE); - return; - } - -#if wxUSE_BUSYINFO - wxBusyInfo busyinfo(_("Preparing help window...")); -#endif - - if (m_Config) ReadCustomization(m_Config, m_ConfigRoot); - - m_Frame = new wxFrame(NULL, -1, "", wxPoint(m_Cfg.x, m_Cfg.y), wxSize(m_Cfg.w, m_Cfg.h)); - m_Frame -> PushEventHandler(this); - sbar = m_Frame -> CreateStatusBar(); - - { - wxToolBar *toolBar; - toolBar = m_Frame -> CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE); - toolBar -> SetMargins(2, 2); - wxBitmap* toolBarBitmaps[3]; - -#ifdef __WXMSW__ - toolBarBitmaps[0] = new wxBitmap("panel"); - toolBarBitmaps[1] = new wxBitmap("back"); - toolBarBitmaps[2] = new wxBitmap("forward"); - int width = 24; -#else - toolBarBitmaps[0] = new wxBitmap(panel_xpm); - toolBarBitmaps[1] = new wxBitmap(back_xpm); - toolBarBitmaps[2] = new wxBitmap(forward_xpm); - int width = 16; -#endif - - int currentX = 5; - - toolBar -> AddTool(wxID_HTML_PANEL, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Show/hide navigation panel")); - currentX += width + 5; - toolBar -> AddSeparator(); - toolBar -> AddTool(wxID_HTML_BACK, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Go back to the previous HTML page")); - currentX += width + 5; - toolBar -> AddTool(wxID_HTML_FORWARD, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Go forward to the next HTML page")); - currentX += width + 5; - - toolBar -> Realize(); - - // Can delete the bitmaps since they're reference counted - for (int i = 0; i < 3; i++) delete toolBarBitmaps[i]; - } - - - { - m_Splitter = new wxSplitterWindow(m_Frame); - - m_HtmlWin = new wxHtmlWindow(m_Splitter); - m_HtmlWin -> SetRelatedFrame(m_Frame, m_TitleFormat); - m_HtmlWin -> SetRelatedStatusBar(0); - if (m_Config) m_HtmlWin -> ReadCustomization(m_Config, m_ConfigRoot); - - m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK, wxDefaultPosition, wxDefaultSize); - { - m_ContentsBox = new wxTreeCtrl(m_NavigPan, wxID_HTML_TREECTRL, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxSUNKEN_BORDER); - m_ContentsBox -> SetImageList(m_ContentsImageList); - m_NavigPan -> AddPage(m_ContentsBox, _("Contents")); - } - - { - wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE); - wxLayoutConstraints *b1 = new wxLayoutConstraints; - b1 -> top.SameAs (dummy, wxTop, 0); - b1 -> left.SameAs (dummy, wxLeft, 0); - b1 -> width.PercentOf (dummy, wxWidth, 100); - b1 -> bottom.SameAs (dummy, wxBottom, 0); - m_IndexBox = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, 0); - m_IndexBox -> SetConstraints(b1); - dummy -> SetAutoLayout(TRUE); - m_NavigPan -> AddPage(dummy, _("Index")); - } - - { - wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE); - - wxLayoutConstraints *b1 = new wxLayoutConstraints; - m_SearchText = new wxTextCtrl(dummy, wxID_HTML_SEARCHTEXT); - b1 -> top.SameAs (dummy, wxTop, 0); - b1 -> left.SameAs (dummy, wxLeft, 0); - b1 -> right.SameAs (dummy, wxRight, 0); - b1 -> height.AsIs(); - m_SearchText -> SetConstraints(b1); - - wxLayoutConstraints *b2 = new wxLayoutConstraints; - m_SearchButton = new wxButton(dummy, wxID_HTML_SEARCHBUTTON, _("Search!")); - b2 -> top.Below (m_SearchText, 10); - b2 -> right.SameAs (dummy, wxRight, 10); - b2 -> width.AsIs(); - b2 -> height.AsIs(); - m_SearchButton -> SetConstraints(b2); - - wxLayoutConstraints *b3 = new wxLayoutConstraints; - m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0); - b3 -> top.Below (m_SearchButton, 10); - b3 -> left.SameAs (dummy, wxLeft, 0); - b3 -> right.SameAs (dummy, wxRight, 0); - b3 -> bottom.SameAs (dummy, wxBottom, 0); - m_SearchList -> SetConstraints(b3); - - dummy -> SetAutoLayout(TRUE); - dummy -> Layout(); - m_NavigPan -> AddPage(dummy, _("Search")); - } - - RefreshLists(); - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SetMinimumPaneSize(20); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); - if (!m_Cfg.navig_on) m_Splitter -> Unsplit(m_NavigPan); - wxYield(); - } - - m_Frame -> Show(TRUE); - wxYield(); -} - - - -#define MAX_ROOTS 64 - -void wxHtmlHelpController::CreateContents() -{ - HtmlContentsItem *it; - wxTreeItemId roots[MAX_ROOTS]; - bool imaged[MAX_ROOTS]; - int count = m_ContentsCnt; - - m_ContentsBox -> DeleteAllItems(); - roots[0] = m_ContentsBox -> AddRoot(_("(Help)")); - imaged[0] = TRUE; - - for (int i = 0; i < count; i++) { - it = m_Contents + i; - roots[it -> m_Level + 1] = m_ContentsBox -> AppendItem(roots[it -> m_Level], it -> m_Name, IMG_Page, -1, new wxHtmlHelpTreeItemData(it)); - if (it -> m_Level == 0) { - m_ContentsBox -> SetItemBold(roots[1], TRUE); - m_ContentsBox -> SetItemImage(roots[1], IMG_Book); - m_ContentsBox -> SetItemSelectedImage(roots[1], IMG_Book); - imaged[1] = TRUE; - } - else imaged[it -> m_Level + 1] = FALSE; - - if (!imaged[it -> m_Level]) { - m_ContentsBox -> SetItemImage(roots[it -> m_Level], IMG_Folder); - m_ContentsBox -> SetItemSelectedImage(roots[it -> m_Level], IMG_Folder); - imaged[it -> m_Level] = TRUE; - } - } - - m_ContentsBox -> Expand(roots[0]); -} - - - - -void wxHtmlHelpController::CreateIndex() -{ - m_IndexBox -> Clear(); - - for (int i = 0; i < m_IndexCnt; i++) - m_IndexBox -> Append(m_Index[i].m_Name, (char*)(m_Index + i)); -} - - - -void wxHtmlHelpController::RefreshLists() -{ - if (m_Frame) { - CreateContents(); - CreateIndex(); - m_SearchList -> Clear(); - } -} - - - - - - - -void wxHtmlHelpController::ReadCustomization(wxConfigBase *cfg, wxString path) -{ - wxString oldpath; - wxString tmp; - - if (path != wxEmptyString) { - oldpath = cfg -> GetPath(); - cfg -> SetPath(path); - } - - m_Cfg.navig_on = cfg -> Read("hcNavigPanel", m_Cfg.navig_on) != 0; - m_Cfg.sashpos = cfg -> Read("hcSashPos", m_Cfg.sashpos); - m_Cfg.x = cfg -> Read("hcX", m_Cfg.x); - m_Cfg.y = cfg -> Read("hcY", m_Cfg.y); - m_Cfg.w = cfg -> Read("hcW", m_Cfg.w); - m_Cfg.h = cfg -> Read("hcH", m_Cfg.h); - - if (path != wxEmptyString) - cfg -> SetPath(oldpath); -} - - - -void wxHtmlHelpController::WriteCustomization(wxConfigBase *cfg, wxString path) -{ - wxString oldpath; - wxString tmp; - - if (path != wxEmptyString) { - oldpath = cfg -> GetPath(); - cfg -> SetPath(path); - } - - cfg -> Write("hcNavigPanel", m_Cfg.navig_on); - cfg -> Write("hcSashPos", (long)m_Cfg.sashpos); - cfg -> Write("hcX", (long)m_Cfg.x); - cfg -> Write("hcY", (long)m_Cfg.y); - cfg -> Write("hcW", (long)m_Cfg.w); - cfg -> Write("hcH", (long)m_Cfg.h); - - if (path != wxEmptyString) - cfg -> SetPath(oldpath); -} - - - - - -/* -EVENT HANDLING : -*/ - - -void wxHtmlHelpController::OnToolbar(wxCommandEvent& event) -{ - switch (event.GetId()) { - case wxID_HTML_BACK : - m_HtmlWin -> HistoryBack(); - break; - case wxID_HTML_FORWARD : - m_HtmlWin -> HistoryForward(); - break; - case wxID_HTML_PANEL : - if (m_Splitter -> IsSplit()) { - m_Cfg.sashpos = m_Splitter -> GetSashPosition(); - m_Splitter -> Unsplit(m_NavigPan); - } - else { - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); - } - break; - } -} - - - -void wxHtmlHelpController::OnContentsSel(wxTreeEvent& event) -{ - wxHtmlHelpTreeItemData *pg; - - pg = (wxHtmlHelpTreeItemData*) m_ContentsBox -> GetItemData(event.GetItem()); - if (pg) m_HtmlWin -> LoadPage(pg -> GetPage()); -} - - - -void wxHtmlHelpController::OnIndexSel(wxCommandEvent& event) -{ - HtmlContentsItem *it = (HtmlContentsItem*) m_IndexBox -> GetClientData(m_IndexBox -> GetSelection()); - if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); -} - - - -void wxHtmlHelpController::OnSearchSel(wxCommandEvent& event) -{ - HtmlContentsItem *it = (HtmlContentsItem*) m_SearchList -> GetClientData(m_SearchList -> GetSelection()); - if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); -} - - - -void wxHtmlHelpController::OnCloseWindow(wxCloseEvent& event) -{ - int a, b; - - m_Cfg.navig_on = m_Splitter -> IsSplit(); - if (m_Cfg.navig_on) - m_Cfg.sashpos = m_Splitter -> GetSashPosition(); - m_Frame -> GetPosition(&a, &b); - m_Cfg.x = a, m_Cfg.y = b; - m_Frame -> GetSize(&a, &b); - m_Cfg.w = a, m_Cfg.h = b; - - if (m_Config) { - WriteCustomization(m_Config, m_ConfigRoot); - m_HtmlWin -> WriteCustomization(m_Config, m_ConfigRoot); - } - m_Frame = NULL; - - event.Skip(); -} - - - -void wxHtmlHelpController::OnSearch(wxCommandEvent& event) -{ - wxString sr = m_SearchText -> GetLineText(0); - - if (sr != wxEmptyString) KeywordSearch(sr); -} - - - -BEGIN_EVENT_TABLE(wxHtmlHelpController, wxEvtHandler) - EVT_TOOL_RANGE(wxID_HTML_PANEL, wxID_HTML_FORWARD, wxHtmlHelpController::OnToolbar) - EVT_TREE_SEL_CHANGED(wxID_HTML_TREECTRL, wxHtmlHelpController::OnContentsSel) - EVT_LISTBOX(wxID_HTML_INDEXLIST, wxHtmlHelpController::OnIndexSel) - EVT_LISTBOX(wxID_HTML_SEARCHLIST, wxHtmlHelpController::OnSearchSel) - EVT_CLOSE(wxHtmlHelpController::OnCloseWindow) - EVT_BUTTON(wxID_HTML_SEARCHBUTTON, wxHtmlHelpController::OnSearch) - EVT_TEXT_ENTER(wxID_HTML_SEARCHTEXT, wxHtmlHelpController::OnSearch) -END_EVENT_TABLE() - - - -#endif - diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 50b878f4da..5abb39fbd0 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -432,11 +432,15 @@ wxHtmlEntitiesParser::~wxHtmlEntitiesParser() void wxHtmlEntitiesParser::SetEncoding(wxFontEncoding encoding) { #if wxUSE_WCHAR_T && !wxUSE_UNICODE - if (encoding == m_encoding) return; + if (encoding == m_encoding) + return; + delete m_conv; - m_conv = NULL; + m_encoding = encoding; - if (m_encoding != wxFONTENCODING_SYSTEM) + if (m_encoding == wxFONTENCODING_SYSTEM) + m_conv = NULL; + else m_conv = new wxCSConv(wxFontMapper::GetEncodingName(m_encoding)); #else (void) encoding; diff --git a/src/html/search.cpp b/src/html/search.cpp deleted file mode 100644 index 85a59a2b2e..0000000000 --- a/src/html/search.cpp +++ /dev/null @@ -1,72 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: search.cpp -// Purpose: search engine -// Author: Vaclav Slavik -// RCS-ID: $Id$ -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - - - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "wx/wxprec.h" - -#include "wx/defs.h" -#if wxUSE_HTML - -#ifdef __BORDLANDC__ -#pragma hdrstop -#endif - -#ifndef WXPRECOMP -#endif - -#include "wx/html/helpdata.h" - - -//-------------------------------------------------------------------------------- -// wxSearchEngine -//-------------------------------------------------------------------------------- - -void wxSearchEngine::LookFor(const wxString& keyword) -{ - if (m_Keyword) delete[] m_Keyword; - m_Keyword = new wxChar[keyword.Length() + 1]; - wxStrcpy(m_Keyword, keyword.c_str()); - for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--) - if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z'))) - m_Keyword[i] += wxT('a') - wxT('A'); -} - - - -bool wxSearchEngine::Scan(wxInputStream *stream) -{ - wxASSERT_MSG(m_Keyword != NULL, _("wxSearchEngine::LookFor must be called before scanning!")); - - int i, j; - int lng = stream ->GetSize(); - int wrd = wxStrlen(m_Keyword); - bool found = FALSE; - char *buf = new char[lng + 1]; - stream -> Read(buf, lng); - buf[lng] = 0; - - for (i = 0; i < lng; i++) - if ((buf[i] >= 'A') && (buf[i] <= 'Z')) buf[i] += 'a' - 'A'; - - for (i = 0; i < lng - wrd; i++) { - j = 0; - while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++; - if (j == wrd) {found = TRUE; break;} - } - - delete[] buf; - return found; -} - -#endif diff --git a/src/mac/app.cpp b/src/mac/app.cpp index 587cdeb344..6e824ed0ae 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -101,6 +101,8 @@ long wxApp::s_lastModifiers = 0 ; bool wxApp::s_macDefaultEncodingIsPC = true ; bool wxApp::s_macSupportPCMenuShortcuts = true ; long wxApp::s_macAboutMenuItemId = wxID_ABOUT ; +long wxApp::s_macPreferencesMenuItemId = 0 ; +long wxApp::s_macExitMenuItemId = wxID_EXIT ; wxString wxApp::s_macHelpMenuTitleName = "&Help" ; pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ; @@ -1628,23 +1630,28 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr ) break; case inGrow: { - int growResult = GrowWindow(window , ev->where, &screenBits.bounds); - if (growResult != 0) + Rect newContentRect ; + Rect constraintRect ; + constraintRect.top = win->GetMinHeight() ; + if ( constraintRect.top == -1 ) + constraintRect.top = 0 ; + constraintRect.left = win->GetMinWidth() ; + if ( constraintRect.left == -1 ) + constraintRect.left = 0 ; + constraintRect.right = win->GetMaxWidth() ; + if ( constraintRect.right == -1 ) + constraintRect.right = 32000 ; + constraintRect.bottom = win->GetMaxHeight() ; + if ( constraintRect.bottom == -1 ) + constraintRect.bottom = 32000 ; + + Boolean growResult = ResizeWindow( window , ev->where , + &constraintRect , &newContentRect ) ; + if ( growResult ) { - int newWidth = LoWord(growResult); - int newHeight = HiWord(growResult); - int oldWidth, oldHeight; - - - if (win) - { - win->GetSize(&oldWidth, &oldHeight); - if (newWidth == 0) - newWidth = oldWidth; - if (newHeight == 0) - newHeight = oldHeight; - win->SetSize( -1, -1 , newWidth, newHeight, wxSIZE_USE_EXISTING); - } + win->SetSize( newContentRect.left , newContentRect.top , + newContentRect.right - newContentRect.left , + newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING); } s_lastMouseDown = 0; } @@ -2309,35 +2316,14 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum ) } else { + MenuCommand id ; + GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ; wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ; - if ( frontwindow && wxMenuBar::MacGetInstalledMenuBar() ) - wxMenuBar::MacGetInstalledMenuBar()->MacMenuSelect( frontwindow->GetEventHandler() , 0 , macMenuId , macMenuItemNum ) ; + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id ); + event.m_timeStamp = ((EventRecord*) MacGetCurrentEvent())->when ; + event.SetEventObject(frontwindow->GetEventHandler()); + event.SetInt( id ); + frontwindow->GetEventHandler()->ProcessEvent(event); } HiliteMenu(0); } - -/* -long wxApp::MacTranslateKey(char key, int mods) -{ -} - -void wxApp::MacAdjustCursor() -{ -} - -*/ -/* -void -wxApp::macAdjustCursor() -{ - if (ev->what != kHighLevelEvent) - { - wxWindow* theMacWxFrame = wxFrame::MacFindFrameOrDialog(::FrontWindow()); - if (theMacWxFrame) - { - if (!theMacWxFrame->MacAdjustCursor(ev->where)) - ::SetCursor(&(qd.arrow)); - } - } -} -*/ diff --git a/src/mac/bitmap.cpp b/src/mac/bitmap.cpp index 08590d1006..be0b45bafb 100644 --- a/src/mac/bitmap.cpp +++ b/src/mac/bitmap.cpp @@ -293,7 +293,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask) return pict; } -void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , bool forceColorIcon ) +void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType ) { memset( info , 0 , sizeof(ControlButtonContentInfo) ) ; if ( bitmap.Ok() ) @@ -309,7 +309,7 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi } else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld ) { - if ( (forceColorIcon || bmap->m_width == bmap->m_height) && ((bmap->m_width & 0x3) == 0) ) + if ( (forceType == kControlContentCIconHandle || ( bmap->m_width == bmap->m_height && forceType != kControlContentPictHandle ) ) && ((bmap->m_width & 0x3) == 0) ) { info->contentType = kControlContentCIconHandle ; if ( bitmap.GetMask() ) diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 587cdeb344..6e824ed0ae 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -101,6 +101,8 @@ long wxApp::s_lastModifiers = 0 ; bool wxApp::s_macDefaultEncodingIsPC = true ; bool wxApp::s_macSupportPCMenuShortcuts = true ; long wxApp::s_macAboutMenuItemId = wxID_ABOUT ; +long wxApp::s_macPreferencesMenuItemId = 0 ; +long wxApp::s_macExitMenuItemId = wxID_EXIT ; wxString wxApp::s_macHelpMenuTitleName = "&Help" ; pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ; @@ -1628,23 +1630,28 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr ) break; case inGrow: { - int growResult = GrowWindow(window , ev->where, &screenBits.bounds); - if (growResult != 0) + Rect newContentRect ; + Rect constraintRect ; + constraintRect.top = win->GetMinHeight() ; + if ( constraintRect.top == -1 ) + constraintRect.top = 0 ; + constraintRect.left = win->GetMinWidth() ; + if ( constraintRect.left == -1 ) + constraintRect.left = 0 ; + constraintRect.right = win->GetMaxWidth() ; + if ( constraintRect.right == -1 ) + constraintRect.right = 32000 ; + constraintRect.bottom = win->GetMaxHeight() ; + if ( constraintRect.bottom == -1 ) + constraintRect.bottom = 32000 ; + + Boolean growResult = ResizeWindow( window , ev->where , + &constraintRect , &newContentRect ) ; + if ( growResult ) { - int newWidth = LoWord(growResult); - int newHeight = HiWord(growResult); - int oldWidth, oldHeight; - - - if (win) - { - win->GetSize(&oldWidth, &oldHeight); - if (newWidth == 0) - newWidth = oldWidth; - if (newHeight == 0) - newHeight = oldHeight; - win->SetSize( -1, -1 , newWidth, newHeight, wxSIZE_USE_EXISTING); - } + win->SetSize( newContentRect.left , newContentRect.top , + newContentRect.right - newContentRect.left , + newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING); } s_lastMouseDown = 0; } @@ -2309,35 +2316,14 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum ) } else { + MenuCommand id ; + GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ; wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ; - if ( frontwindow && wxMenuBar::MacGetInstalledMenuBar() ) - wxMenuBar::MacGetInstalledMenuBar()->MacMenuSelect( frontwindow->GetEventHandler() , 0 , macMenuId , macMenuItemNum ) ; + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id ); + event.m_timeStamp = ((EventRecord*) MacGetCurrentEvent())->when ; + event.SetEventObject(frontwindow->GetEventHandler()); + event.SetInt( id ); + frontwindow->GetEventHandler()->ProcessEvent(event); } HiliteMenu(0); } - -/* -long wxApp::MacTranslateKey(char key, int mods) -{ -} - -void wxApp::MacAdjustCursor() -{ -} - -*/ -/* -void -wxApp::macAdjustCursor() -{ - if (ev->what != kHighLevelEvent) - { - wxWindow* theMacWxFrame = wxFrame::MacFindFrameOrDialog(::FrontWindow()); - if (theMacWxFrame) - { - if (!theMacWxFrame->MacAdjustCursor(ev->where)) - ::SetCursor(&(qd.arrow)); - } - } -} -*/ diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp index 08590d1006..be0b45bafb 100644 --- a/src/mac/carbon/bitmap.cpp +++ b/src/mac/carbon/bitmap.cpp @@ -293,7 +293,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask) return pict; } -void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , bool forceColorIcon ) +void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType ) { memset( info , 0 , sizeof(ControlButtonContentInfo) ) ; if ( bitmap.Ok() ) @@ -309,7 +309,7 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi } else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld ) { - if ( (forceColorIcon || bmap->m_width == bmap->m_height) && ((bmap->m_width & 0x3) == 0) ) + if ( (forceType == kControlContentCIconHandle || ( bmap->m_width == bmap->m_height && forceType != kControlContentPictHandle ) ) && ((bmap->m_width & 0x3) == 0) ) { info->contentType = kControlContentCIconHandle ; if ( bitmap.GetMask() ) diff --git a/src/mac/carbon/filedlg.cpp b/src/mac/carbon/filedlg.cpp index cef71e0136..63ce8a76f9 100644 --- a/src/mac/carbon/filedlg.cpp +++ b/src/mac/carbon/filedlg.cpp @@ -46,15 +46,13 @@ extern bool gUseNavServices ; // and a copy of the "previous" file spec of the reply record // so we can see if the selection has changed -const int kwxMacFileTypes = 10 ; - struct OpenUserDataRec { int currentfilter ; - wxString name [kwxMacFileTypes] ; - wxString extensions[kwxMacFileTypes] ; - OSType filtermactypes[kwxMacFileTypes] ; - int numfilters ; + wxArrayString name ; + wxArrayString extensions ; + wxArrayLong filtermactypes ; }; + typedef struct OpenUserDataRec OpenUserDataRec, *OpenUserDataRecPtr; @@ -125,15 +123,15 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) int filterIndex = 0; bool isName = true ; wxString current ; - for( unsigned int i = 0; i < filter2.Len(); i++ ) + for( unsigned int i = 0; i < filter2.Len() ; i++ ) { if( filter2.GetChar(i) == wxT('|') ) { if( isName ) { - myData->name[filterIndex] = current ; + myData->name.Add( current ) ; } else { - myData->extensions[filterIndex] = current.MakeUpper() ; + myData->extensions.Add( current.MakeUpper() ) ; ++filterIndex ; } isName = !isName ; @@ -149,35 +147,32 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ; if ( current.IsEmpty() ) - myData->extensions[filterIndex] = myData->name[filterIndex] ; + myData->extensions.Add( myData->name[filterIndex] ) ; else - myData->extensions[filterIndex] = current.MakeUpper() ; + myData->extensions.Add( current.MakeUpper() ) ; + if ( filterIndex == 0 || isName ) + myData->name.Add( current.MakeUpper() ) ; + ++filterIndex ; - myData->numfilters = filterIndex ; - for ( int i = 0 ; i < myData->numfilters ; i++ ) + for ( int i = 0 ; i < myData->extensions.GetCount() ; i++ ) { int j ; for ( j = 0 ; gfilters[j] ; j++ ) { if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 ) { - myData->filtermactypes[i] = gfiltersmac[j] ; + myData->filtermactypes.Add( gfiltersmac[j] ) ; break ; } } if( gfilters[j] == NULL ) { - myData->filtermactypes[i] = '****' ; + myData->filtermactypes.Add( '****' ) ; } } } - else - { - myData->numfilters = 0 ; - } - } static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecPtr data) @@ -193,7 +188,7 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP wxString file(filename) ; file.MakeUpper() ; - if ( data->numfilters > 0 ) + if ( data->extensions.GetCount() > 0 ) { //for ( int i = 0 ; i < data->numfilters ; ++i ) int i = data->currentfilter ; @@ -430,10 +425,10 @@ int wxFileDialog::ShowModal() MakeUserDataRec( &myData , m_wildCard ) ; NavTypeListHandle typelist = NULL ; - if ( myData.numfilters > 0 ) + if ( myData.extensions.GetCount() > 0 ) { - mNavOptions.popupExtension = (NavMenuItemSpecArrayHandle) NewHandle( sizeof( NavMenuItemSpec ) * myData.numfilters ) ; - for ( int i = 0 ; i < myData.numfilters ; ++i ) { + mNavOptions.popupExtension = (NavMenuItemSpecArrayHandle) NewHandle( sizeof( NavMenuItemSpec ) * myData.extensions.GetCount() ) ; + for ( int i = 0 ; i < myData.extensions.GetCount() ; ++i ) { (*mNavOptions.popupExtension)[i].version = kNavMenuItemSpecVersion ; (*mNavOptions.popupExtension)[i].menuCreator = 'WXNG' ; (*mNavOptions.popupExtension)[i].menuType = i ; diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index caadf18ce3..0ded39739c 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -209,10 +209,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) if ( pos == (size_t)-1 ) { UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), label,key,modifiers); + SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , CountMenuItems(MAC_WXHMENU(m_hMenu)) , pItem->GetId() ) ; if ( pItem->GetBitmap().Ok() ) { ControlButtonContentInfo info ; - wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ; + wxMacCreateBitmapButton( &info , pItem->GetBitmap() , kControlContentCIconHandle ) ; if ( info.contentType != kControlNoContent ) { if ( info.contentType == kControlContentCIconHandle ) @@ -225,10 +226,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) else { UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), label , pos,key,modifiers); + SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ; if ( pItem->GetBitmap().Ok() ) { ControlButtonContentInfo info ; - wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ; + wxMacCreateBitmapButton( &info , pItem->GetBitmap() , kControlContentCIconHandle ) ; if ( info.contentType != kControlNoContent ) { if ( info.contentType == kControlContentCIconHandle ) @@ -429,114 +431,6 @@ void wxMenu::MacEnableMenu( bool bDoEnable ) ::DrawMenuBar() ; } -bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum ) -{ - int pos; - wxNode *node; - - if ( m_macMenuId == macMenuId ) - { - node = GetMenuItems().Nth(macMenuItemNum-1); - if (node) - { - wxMenuItem *pItem = (wxMenuItem*)node->Data(); - - if (pItem->IsCheckable()) - pItem->Check(! pItem->IsChecked()); - - wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId()); - event.m_timeStamp = when; - event.SetEventObject(handler); - event.SetInt( pItem->GetId() ); - { - bool processed = false ; - -#if WXWIN_COMPATIBILITY - // Try a callback - if (m_callback) - { - (void) (*(m_callback)) (*this, event); - processed = TRUE; - } -#endif - // Try the menu's event handler - if ( !processed && handler) - { - processed = handler->ProcessEvent(event); - } - - // Try the window the menu was popped up from (and up - // through the hierarchy) - if ( !processed && GetInvokingWindow()) - processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event); - } - return true ; - } - } - else if ( macMenuId == kHMHelpMenuID ) - { - int menuItem = firstUserHelpMenuItem-1 ; - for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++) - { - wxMenuItem * pItem = (wxMenuItem *) node->Data() ; - - wxMenu *pSubMenu = pItem->GetSubMenu() ; - if ( pSubMenu != NULL ) - { - } - else - { - if ( pItem->GetId() != wxApp::s_macAboutMenuItemId ) - ++menuItem ; - - if ( menuItem == macMenuItemNum ) - { - wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId()); - event.m_timeStamp = when; - event.SetEventObject(handler); - event.SetInt( pItem->GetId() ); - { - bool processed = false ; -#if WXWIN_COMPATIBILITY - // Try a callback - if (m_callback) - { - (void) (*(m_callback)) (*this, event); - processed = TRUE; - } -#endif - // Try the menu's event handler - if ( !processed && handler) - { - processed = handler->ProcessEvent(event); - } - - // Try the window the menu was popped up from (and up - // through the hierarchy) - if ( !processed && GetInvokingWindow()) - processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event); - } - return true ; - } - } - } - } - - for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++) - { - wxMenuItem * pItem = (wxMenuItem *) node->Data() ; - - wxMenu *pSubMenu = pItem->GetSubMenu() ; - if ( pSubMenu != NULL ) - { - if ( pSubMenu->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) ) - return true ; - } - } - - return false ; -} - // Menu Bar /* @@ -664,89 +558,93 @@ void wxMenuBar::MacInstallMenuBar() for (size_t i = 0; i < m_menus.GetCount(); i++) { - Str255 label; - wxNode *node; - wxMenuItem *item; - int pos ; - wxMenu* menu = m_menus[i] , *subMenu = NULL ; - - if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) + Str255 label; + wxNode *node; + wxMenuItem *item; + int pos ; + wxMenu* menu = m_menus[i] , *subMenu = NULL ; + + if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) + { + MenuHandle mh = NULL ; + if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) != noErr ) { - MenuHandle mh = NULL ; - if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) != noErr ) - { continue ; - } + } for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i ) { - DeleteMenuItem( mh , i ) ; + DeleteMenuItem( mh , i ) ; } - - for (pos = 0 , node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) - { - item = (wxMenuItem *)node->Data(); - subMenu = item->GetSubMenu() ; - if (subMenu) + + for (pos = 0 , node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) + { + item = (wxMenuItem *)node->Data(); + subMenu = item->GetSubMenu() ; + if (subMenu) + { + // we don't support hierarchical menus in the help menu yet + } + else + { + if ( item->IsSeparator() ) { - // we don't support hierarchical menus in the help menu yet + if ( mh ) + MacAppendMenu(mh, "\p-" ); } - else + else { - if ( item->IsSeparator() ) + Str255 label ; + UInt8 modifiers ; + SInt16 key ; + wxMenuItem::MacBuildMenuString( label, &key , &modifiers , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu + if ( label[0] == 0 ) { - if ( mh ) - MacAppendMenu(mh, "\p-" ); + // we cannot add empty menus on mac + label[0] = 1 ; + label[1] = ' ' ; } + if ( item->GetId() == wxApp::s_macAboutMenuItemId ) + { + ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label ); + UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 ); + SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ; + } else { - Str255 label ; - UInt8 modifiers ; - SInt16 key ; - wxMenuItem::MacBuildMenuString( label, &key , &modifiers , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu - if ( label[0] == 0 ) + if ( mh ) { - // we cannot add empty menus on mac - label[0] = 1 ; - label[1] = ' ' ; - } - if ( item->GetId() == wxApp::s_macAboutMenuItemId ) - { - ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label ); - UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 ); - } - else - { - if ( mh ) - UMAAppendMenuItem(mh, label , key , modifiers ); + UMAAppendMenuItem(mh, label , key , modifiers ); + SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ; } } } } } - else - { - wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_titles[i] , false ); - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , label ) ; - wxArrayPtrVoid submenus ; - - for (pos = 0, node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) - { - item = (wxMenuItem *)node->Data(); - subMenu = item->GetSubMenu() ; - if (subMenu) - { - submenus.Add(subMenu) ; - } - } - ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0); - for ( size_t i = 0 ; i < submenus.GetCount() ; ++i ) + } + else + { + wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_titles[i] , false ); + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , label ) ; + wxArrayPtrVoid submenus ; + + for (pos = 0, node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) + { + item = (wxMenuItem *)node->Data(); + subMenu = item->GetSubMenu() ; + if (subMenu) { - wxMenu* submenu = (wxMenu*) submenus[i] ; - wxNode *subnode; - wxMenuItem *subitem; - int subpos ; - for ( subpos = 0 , subnode = submenu->GetMenuItems().First(); subnode; subnode = subnode->Next(), subpos++) + submenus.Add(subMenu) ; + } + } + ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0); + for ( size_t i = 0 ; i < submenus.GetCount() ; ++i ) + { + wxMenu* submenu = (wxMenu*) submenus[i] ; + wxNode *subnode; + wxMenuItem *subitem; + int subpos ; + for ( subpos = 0 , subnode = submenu->GetMenuItems().First(); subnode; subnode = subnode->Next(), subpos++) { subitem = (wxMenuItem *)subnode->Data(); wxMenu* itsSubMenu = subitem->GetSubMenu() ; @@ -755,11 +653,11 @@ void wxMenuBar::MacInstallMenuBar() submenus.Add(itsSubMenu) ; } } - ::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ; - } - } + ::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ; + } } - ::DrawMenuBar() ; + } + ::DrawMenuBar() ; s_macInstalledMenuBar = this; } @@ -900,44 +798,6 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) return TRUE; } -void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum) -{ - // first scan fast for direct commands, i.e. menus which have these commands directly in their own list - - if ( macMenuId == kwxMacAppleMenuId && macMenuItemNum == 1 ) - { - wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, wxApp::s_macAboutMenuItemId ); - event.m_timeStamp = when; - event.SetEventObject(handler); - event.SetInt( wxApp::s_macAboutMenuItemId ); - handler->ProcessEvent(event); - } - else - { - for (size_t i = 0; i < m_menus.GetCount() ; i++) - { - if ( m_menus[i]->MacGetMenuId() == macMenuId || ( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) ) ) - { - if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) ) - return ; - else - { - //TODO flag this as an error since it must contain the item - return ; - } - } - } - - for (size_t i = 0; i < m_menus.GetCount(); i++) - { - if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) ) - { - break ; - } - } - } -} - wxMenu *wxMenuBar::Remove(size_t pos) { wxMenu *menu = wxMenuBarBase::Remove(pos); diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 4f8d67ae6d..e82348226f 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -1606,7 +1606,13 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event) event.Enable( CanRedo() ); } - +bool wxTextCtrl::MacSetupCursor( const wxPoint& pt ) +{ + if ( m_macUsesTXN ) + return true ; + else + return wxWindow::MacSetupCursor( pt ) ; +} #endif // wxUSE_TEXTCTRL diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index efcf1a737d..35f09fe55f 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -322,7 +322,11 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, } else { +#if TARGET_CARBON wclass = kPlainWindowClass ; +#else + wclass = kFloatingWindowClass ; +#endif } } else if ( HasFlag( wxCAPTION ) ) @@ -345,7 +349,11 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, } else { +#if TARGET_CARBON wclass = kPlainWindowClass ; +#else + wclass = kModalWindowClass ; +#endif } } @@ -604,8 +612,8 @@ bool wxTopLevelWindowMac::Show(bool show) return FALSE; if (show) - { - ::ShowWindow( (WindowRef)m_macWindow ) ; + { + ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil); ::SelectWindow( (WindowRef)m_macWindow ) ; // no need to generate events here, they will get them triggered by macos // actually they should be , but apparently they are not @@ -616,7 +624,7 @@ bool wxTopLevelWindowMac::Show(bool show) } else { - ::HideWindow( (WindowRef)m_macWindow ) ; + ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowHideTransitionAction,nil); } if ( !show ) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index bc83a282a2..510d695ce5 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -353,7 +353,17 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y) ::InsertMenu( (MenuHandle) menu->GetHMenu() , -1 ) ; long menuResult = ::PopUpMenuSelect((MenuHandle) menu->GetHMenu() ,y,x, 0) ; - menu->MacMenuSelect( this , TickCount() , HiWord(menuResult) , LoWord(menuResult) ) ; + if ( HiWord(menuResult) != 0 ) + { + MenuCommand id ; + GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ; + + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id ); + event.m_timeStamp = TickCount() ; + event.SetEventObject(this->GetEventHandler()); + event.SetInt( id ); + GetEventHandler()->ProcessEvent(event); + } ::DeleteMenu( menu->MacGetMenuId() ) ; menu->SetInvokingWindow(NULL); diff --git a/src/mac/filedlg.cpp b/src/mac/filedlg.cpp index cef71e0136..63ce8a76f9 100644 --- a/src/mac/filedlg.cpp +++ b/src/mac/filedlg.cpp @@ -46,15 +46,13 @@ extern bool gUseNavServices ; // and a copy of the "previous" file spec of the reply record // so we can see if the selection has changed -const int kwxMacFileTypes = 10 ; - struct OpenUserDataRec { int currentfilter ; - wxString name [kwxMacFileTypes] ; - wxString extensions[kwxMacFileTypes] ; - OSType filtermactypes[kwxMacFileTypes] ; - int numfilters ; + wxArrayString name ; + wxArrayString extensions ; + wxArrayLong filtermactypes ; }; + typedef struct OpenUserDataRec OpenUserDataRec, *OpenUserDataRecPtr; @@ -125,15 +123,15 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) int filterIndex = 0; bool isName = true ; wxString current ; - for( unsigned int i = 0; i < filter2.Len(); i++ ) + for( unsigned int i = 0; i < filter2.Len() ; i++ ) { if( filter2.GetChar(i) == wxT('|') ) { if( isName ) { - myData->name[filterIndex] = current ; + myData->name.Add( current ) ; } else { - myData->extensions[filterIndex] = current.MakeUpper() ; + myData->extensions.Add( current.MakeUpper() ) ; ++filterIndex ; } isName = !isName ; @@ -149,35 +147,32 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ; if ( current.IsEmpty() ) - myData->extensions[filterIndex] = myData->name[filterIndex] ; + myData->extensions.Add( myData->name[filterIndex] ) ; else - myData->extensions[filterIndex] = current.MakeUpper() ; + myData->extensions.Add( current.MakeUpper() ) ; + if ( filterIndex == 0 || isName ) + myData->name.Add( current.MakeUpper() ) ; + ++filterIndex ; - myData->numfilters = filterIndex ; - for ( int i = 0 ; i < myData->numfilters ; i++ ) + for ( int i = 0 ; i < myData->extensions.GetCount() ; i++ ) { int j ; for ( j = 0 ; gfilters[j] ; j++ ) { if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 ) { - myData->filtermactypes[i] = gfiltersmac[j] ; + myData->filtermactypes.Add( gfiltersmac[j] ) ; break ; } } if( gfilters[j] == NULL ) { - myData->filtermactypes[i] = '****' ; + myData->filtermactypes.Add( '****' ) ; } } } - else - { - myData->numfilters = 0 ; - } - } static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecPtr data) @@ -193,7 +188,7 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP wxString file(filename) ; file.MakeUpper() ; - if ( data->numfilters > 0 ) + if ( data->extensions.GetCount() > 0 ) { //for ( int i = 0 ; i < data->numfilters ; ++i ) int i = data->currentfilter ; @@ -430,10 +425,10 @@ int wxFileDialog::ShowModal() MakeUserDataRec( &myData , m_wildCard ) ; NavTypeListHandle typelist = NULL ; - if ( myData.numfilters > 0 ) + if ( myData.extensions.GetCount() > 0 ) { - mNavOptions.popupExtension = (NavMenuItemSpecArrayHandle) NewHandle( sizeof( NavMenuItemSpec ) * myData.numfilters ) ; - for ( int i = 0 ; i < myData.numfilters ; ++i ) { + mNavOptions.popupExtension = (NavMenuItemSpecArrayHandle) NewHandle( sizeof( NavMenuItemSpec ) * myData.extensions.GetCount() ) ; + for ( int i = 0 ; i < myData.extensions.GetCount() ; ++i ) { (*mNavOptions.popupExtension)[i].version = kNavMenuItemSpecVersion ; (*mNavOptions.popupExtension)[i].menuCreator = 'WXNG' ; (*mNavOptions.popupExtension)[i].menuType = i ; diff --git a/src/mac/menu.cpp b/src/mac/menu.cpp index caadf18ce3..0ded39739c 100644 --- a/src/mac/menu.cpp +++ b/src/mac/menu.cpp @@ -209,10 +209,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) if ( pos == (size_t)-1 ) { UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), label,key,modifiers); + SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , CountMenuItems(MAC_WXHMENU(m_hMenu)) , pItem->GetId() ) ; if ( pItem->GetBitmap().Ok() ) { ControlButtonContentInfo info ; - wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ; + wxMacCreateBitmapButton( &info , pItem->GetBitmap() , kControlContentCIconHandle ) ; if ( info.contentType != kControlNoContent ) { if ( info.contentType == kControlContentCIconHandle ) @@ -225,10 +226,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) else { UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), label , pos,key,modifiers); + SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ; if ( pItem->GetBitmap().Ok() ) { ControlButtonContentInfo info ; - wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ; + wxMacCreateBitmapButton( &info , pItem->GetBitmap() , kControlContentCIconHandle ) ; if ( info.contentType != kControlNoContent ) { if ( info.contentType == kControlContentCIconHandle ) @@ -429,114 +431,6 @@ void wxMenu::MacEnableMenu( bool bDoEnable ) ::DrawMenuBar() ; } -bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum ) -{ - int pos; - wxNode *node; - - if ( m_macMenuId == macMenuId ) - { - node = GetMenuItems().Nth(macMenuItemNum-1); - if (node) - { - wxMenuItem *pItem = (wxMenuItem*)node->Data(); - - if (pItem->IsCheckable()) - pItem->Check(! pItem->IsChecked()); - - wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId()); - event.m_timeStamp = when; - event.SetEventObject(handler); - event.SetInt( pItem->GetId() ); - { - bool processed = false ; - -#if WXWIN_COMPATIBILITY - // Try a callback - if (m_callback) - { - (void) (*(m_callback)) (*this, event); - processed = TRUE; - } -#endif - // Try the menu's event handler - if ( !processed && handler) - { - processed = handler->ProcessEvent(event); - } - - // Try the window the menu was popped up from (and up - // through the hierarchy) - if ( !processed && GetInvokingWindow()) - processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event); - } - return true ; - } - } - else if ( macMenuId == kHMHelpMenuID ) - { - int menuItem = firstUserHelpMenuItem-1 ; - for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++) - { - wxMenuItem * pItem = (wxMenuItem *) node->Data() ; - - wxMenu *pSubMenu = pItem->GetSubMenu() ; - if ( pSubMenu != NULL ) - { - } - else - { - if ( pItem->GetId() != wxApp::s_macAboutMenuItemId ) - ++menuItem ; - - if ( menuItem == macMenuItemNum ) - { - wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId()); - event.m_timeStamp = when; - event.SetEventObject(handler); - event.SetInt( pItem->GetId() ); - { - bool processed = false ; -#if WXWIN_COMPATIBILITY - // Try a callback - if (m_callback) - { - (void) (*(m_callback)) (*this, event); - processed = TRUE; - } -#endif - // Try the menu's event handler - if ( !processed && handler) - { - processed = handler->ProcessEvent(event); - } - - // Try the window the menu was popped up from (and up - // through the hierarchy) - if ( !processed && GetInvokingWindow()) - processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event); - } - return true ; - } - } - } - } - - for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++) - { - wxMenuItem * pItem = (wxMenuItem *) node->Data() ; - - wxMenu *pSubMenu = pItem->GetSubMenu() ; - if ( pSubMenu != NULL ) - { - if ( pSubMenu->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) ) - return true ; - } - } - - return false ; -} - // Menu Bar /* @@ -664,89 +558,93 @@ void wxMenuBar::MacInstallMenuBar() for (size_t i = 0; i < m_menus.GetCount(); i++) { - Str255 label; - wxNode *node; - wxMenuItem *item; - int pos ; - wxMenu* menu = m_menus[i] , *subMenu = NULL ; - - if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) + Str255 label; + wxNode *node; + wxMenuItem *item; + int pos ; + wxMenu* menu = m_menus[i] , *subMenu = NULL ; + + if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) + { + MenuHandle mh = NULL ; + if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) != noErr ) { - MenuHandle mh = NULL ; - if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) != noErr ) - { continue ; - } + } for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i ) { - DeleteMenuItem( mh , i ) ; + DeleteMenuItem( mh , i ) ; } - - for (pos = 0 , node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) - { - item = (wxMenuItem *)node->Data(); - subMenu = item->GetSubMenu() ; - if (subMenu) + + for (pos = 0 , node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) + { + item = (wxMenuItem *)node->Data(); + subMenu = item->GetSubMenu() ; + if (subMenu) + { + // we don't support hierarchical menus in the help menu yet + } + else + { + if ( item->IsSeparator() ) { - // we don't support hierarchical menus in the help menu yet + if ( mh ) + MacAppendMenu(mh, "\p-" ); } - else + else { - if ( item->IsSeparator() ) + Str255 label ; + UInt8 modifiers ; + SInt16 key ; + wxMenuItem::MacBuildMenuString( label, &key , &modifiers , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu + if ( label[0] == 0 ) { - if ( mh ) - MacAppendMenu(mh, "\p-" ); + // we cannot add empty menus on mac + label[0] = 1 ; + label[1] = ' ' ; } + if ( item->GetId() == wxApp::s_macAboutMenuItemId ) + { + ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label ); + UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 ); + SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ; + } else { - Str255 label ; - UInt8 modifiers ; - SInt16 key ; - wxMenuItem::MacBuildMenuString( label, &key , &modifiers , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu - if ( label[0] == 0 ) + if ( mh ) { - // we cannot add empty menus on mac - label[0] = 1 ; - label[1] = ' ' ; - } - if ( item->GetId() == wxApp::s_macAboutMenuItemId ) - { - ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label ); - UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 ); - } - else - { - if ( mh ) - UMAAppendMenuItem(mh, label , key , modifiers ); + UMAAppendMenuItem(mh, label , key , modifiers ); + SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ; } } } } } - else - { - wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_titles[i] , false ); - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , label ) ; - wxArrayPtrVoid submenus ; - - for (pos = 0, node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) - { - item = (wxMenuItem *)node->Data(); - subMenu = item->GetSubMenu() ; - if (subMenu) - { - submenus.Add(subMenu) ; - } - } - ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0); - for ( size_t i = 0 ; i < submenus.GetCount() ; ++i ) + } + else + { + wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_titles[i] , false ); + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , label ) ; + wxArrayPtrVoid submenus ; + + for (pos = 0, node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) + { + item = (wxMenuItem *)node->Data(); + subMenu = item->GetSubMenu() ; + if (subMenu) { - wxMenu* submenu = (wxMenu*) submenus[i] ; - wxNode *subnode; - wxMenuItem *subitem; - int subpos ; - for ( subpos = 0 , subnode = submenu->GetMenuItems().First(); subnode; subnode = subnode->Next(), subpos++) + submenus.Add(subMenu) ; + } + } + ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0); + for ( size_t i = 0 ; i < submenus.GetCount() ; ++i ) + { + wxMenu* submenu = (wxMenu*) submenus[i] ; + wxNode *subnode; + wxMenuItem *subitem; + int subpos ; + for ( subpos = 0 , subnode = submenu->GetMenuItems().First(); subnode; subnode = subnode->Next(), subpos++) { subitem = (wxMenuItem *)subnode->Data(); wxMenu* itsSubMenu = subitem->GetSubMenu() ; @@ -755,11 +653,11 @@ void wxMenuBar::MacInstallMenuBar() submenus.Add(itsSubMenu) ; } } - ::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ; - } - } + ::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ; + } } - ::DrawMenuBar() ; + } + ::DrawMenuBar() ; s_macInstalledMenuBar = this; } @@ -900,44 +798,6 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) return TRUE; } -void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum) -{ - // first scan fast for direct commands, i.e. menus which have these commands directly in their own list - - if ( macMenuId == kwxMacAppleMenuId && macMenuItemNum == 1 ) - { - wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, wxApp::s_macAboutMenuItemId ); - event.m_timeStamp = when; - event.SetEventObject(handler); - event.SetInt( wxApp::s_macAboutMenuItemId ); - handler->ProcessEvent(event); - } - else - { - for (size_t i = 0; i < m_menus.GetCount() ; i++) - { - if ( m_menus[i]->MacGetMenuId() == macMenuId || ( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) ) ) - { - if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) ) - return ; - else - { - //TODO flag this as an error since it must contain the item - return ; - } - } - } - - for (size_t i = 0; i < m_menus.GetCount(); i++) - { - if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) ) - { - break ; - } - } - } -} - wxMenu *wxMenuBar::Remove(size_t pos) { wxMenu *menu = wxMenuBarBase::Remove(pos); diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 4f8d67ae6d..e82348226f 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -1606,7 +1606,13 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event) event.Enable( CanRedo() ); } - +bool wxTextCtrl::MacSetupCursor( const wxPoint& pt ) +{ + if ( m_macUsesTXN ) + return true ; + else + return wxWindow::MacSetupCursor( pt ) ; +} #endif // wxUSE_TEXTCTRL diff --git a/src/mac/toplevel.cpp b/src/mac/toplevel.cpp index efcf1a737d..35f09fe55f 100644 --- a/src/mac/toplevel.cpp +++ b/src/mac/toplevel.cpp @@ -322,7 +322,11 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, } else { +#if TARGET_CARBON wclass = kPlainWindowClass ; +#else + wclass = kFloatingWindowClass ; +#endif } } else if ( HasFlag( wxCAPTION ) ) @@ -345,7 +349,11 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, } else { +#if TARGET_CARBON wclass = kPlainWindowClass ; +#else + wclass = kModalWindowClass ; +#endif } } @@ -604,8 +612,8 @@ bool wxTopLevelWindowMac::Show(bool show) return FALSE; if (show) - { - ::ShowWindow( (WindowRef)m_macWindow ) ; + { + ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil); ::SelectWindow( (WindowRef)m_macWindow ) ; // no need to generate events here, they will get them triggered by macos // actually they should be , but apparently they are not @@ -616,7 +624,7 @@ bool wxTopLevelWindowMac::Show(bool show) } else { - ::HideWindow( (WindowRef)m_macWindow ) ; + ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowHideTransitionAction,nil); } if ( !show ) diff --git a/src/mac/window.cpp b/src/mac/window.cpp index bc83a282a2..510d695ce5 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -353,7 +353,17 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y) ::InsertMenu( (MenuHandle) menu->GetHMenu() , -1 ) ; long menuResult = ::PopUpMenuSelect((MenuHandle) menu->GetHMenu() ,y,x, 0) ; - menu->MacMenuSelect( this , TickCount() , HiWord(menuResult) , LoWord(menuResult) ) ; + if ( HiWord(menuResult) != 0 ) + { + MenuCommand id ; + GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ; + + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id ); + event.m_timeStamp = TickCount() ; + event.SetEventObject(this->GetEventHandler()); + event.SetInt( id ); + GetEventHandler()->ProcessEvent(event); + } ::DeleteMenu( menu->MacGetMenuId() ) ; menu->SetInvokingWindow(NULL); diff --git a/src/makeg95.env b/src/makeg95.env index 39f402da26..46c9254159 100644 --- a/src/makeg95.env +++ b/src/makeg95.env @@ -15,8 +15,8 @@ MINGW32=1 # Set to the version you have -#MINGW32VERSION=2.95 -MINGW32VERSION=3.0 +MINGW32VERSION=2.95 +#MINGW32VERSION=3.0 # If building DLL, the version WXVERSION=233 diff --git a/src/makeprog.b32 b/src/makeprog.b32 index 67c9a6854d..2afd2304d6 100644 --- a/src/makeprog.b32 +++ b/src/makeprog.b32 @@ -14,10 +14,16 @@ WXDIR = $(WXWIN) !include $(WXDIR)\src\makeb32.env -!if "$(WXUSINGDLL)" == "1" -LIBS=$(WXLIB) $(EXTRALIBS) cw32mti import32 ole2w32 winpng regex zlib jpeg tiff odbc32 +!if "$(wxUSE_GUI)" == "0" +IMGLIBS= !else -LIBS=$(WXLIB) $(EXTRALIBS) cw32mt import32 ole2w32 winpng regex zlib jpeg tiff odbc32 +IMGLIBS= winpng jpeg tiff +!endif + +!if "$(WXUSINGDLL)" == "1" +LIBS=$(WXLIB) $(EXTRALIBS) cw32mti import32 ole2w32 regex zlib $(IMGLIBS) odbc32 +!else +LIBS=$(WXLIB) $(EXTRALIBS) cw32mt import32 ole2w32 regex zlib $(IMGLIBS) odbc32 !endif # Note: you may need to remove some libraries for earlier versions of BC++, as below diff --git a/src/makeva.env b/src/makeva.env index eafd3a48a1..1fd0dc138f 100644 --- a/src/makeva.env +++ b/src/makeva.env @@ -116,17 +116,17 @@ D=DebugOS2 WXLIB=$(WXDIR)\lib\$(WXLIBNAME).lib -INC=-I$(WXINC) -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/xpm -I$(WXDIR)/src/tiff -I$(WXDIR)/src/png -I$(EXTRAINC) +INC=-I$(WXINC) -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/tiff -I$(WXDIR)/src/png -I$(EXTRAINC) !if "$(WXMAKINGDLL)" == "1" || "$(WXUSINGDLL)" == "1" LINKLIBS=CPPOM30I.LIB CPPOOC3I.LIB OS2386.LIB $(UPMLIB)\UPM32.LIB $(NETLIB)\NETAPI32.LIB $(TCPIP)\TCP32DLL.LIB $(TCPIP)\SO32DLL.LIB $(TCPIP)\TCPIP32.LIB $(TCPIP)\R0LIB32.LIB -EXTRALIBS=$(WXDIR)\lib\os2pngd.lib $(WXDIR)\lib\os2zlibd.lib $(WXDIR)\lib\os2jpegd.lib $(WXDIR)\lib\os2xpmd.lib $(WXDIR)\lib\os2tiffd.lib +EXTRALIBS=$(WXDIR)\lib\os2pngd.lib $(WXDIR)\lib\os2zlibd.lib $(WXDIR)\lib\os2jpegd.lib $(WXDIR)\lib\os2tiffd.lib !if "$(WXUSINGDLL)" == "1" EXTRALIBS=$(EXTRALIBS) $(WXLIB) !endif LIBS=$(LINKLIBS) $(EXTRALIBS) !else LINKLIBS=CPPOM30.LIB CPPOOC3.LIB OS2386.LIB $(UPMLIB)\UPM32.LIB $(NETLIB)\NETAPI32.LIB $(TCPIP)\TCP32DLL.LIB $(TCPIP)\SO32DLL.LIB $(TCPIP)\TCPIP32.LIB $(TCPIP)\R0LIB32.LIB -EXTRALIBS=$(WXDIR)\lib\os2png.lib $(WXDIR)\lib\os2zlib.lib $(WXDIR)\lib\os2jpeg.lib $(WXDIR)\lib\os2xpm.lib $(WXDIR)\lib\os2tiff.lib +EXTRALIBS=$(WXDIR)\lib\os2png.lib $(WXDIR)\lib\os2zlib.lib $(WXDIR)\lib\os2jpeg.lib $(WXDIR)\lib\os2tiff.lib LIBS=$(WXLIB) $(LINKLIBS) $(EXTRALIBS) !endif diff --git a/src/motif/combobox.cpp b/src/motif/combobox.cpp index d1c470999e..e8e5fd66c7 100644 --- a/src/motif/combobox.cpp +++ b/src/motif/combobox.cpp @@ -44,8 +44,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, SetValidator(validator); m_noStrings = n; m_windowStyle = style; - // m_backgroundColour = parent->GetBackgroundColour(); - m_backgroundColour = * wxWHITE; + m_backgroundColour = parent->GetBackgroundColour(); + // m_backgroundColour = * wxWHITE; m_foregroundColour = parent->GetForegroundColour(); if (parent) parent->AddChild(this); diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index 5092f9fa1a..2d07cc18c0 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -383,6 +383,12 @@ wxFrame::~wxFrame() m_frameStatusBar = NULL; } + if (m_frameToolBar) + { + delete m_frameToolBar; + m_frameToolBar = NULL; + } + DestroyChildren(); if (m_workArea) @@ -392,6 +398,11 @@ wxFrame::~wxFrame() XtDestroyWidget ((Widget) m_workArea); } + // We need to destroy the base class icons here before we stop + // the event loop. This is a hack until we have a real top level + // window (which would be responsible for killing the event loop). + m_icons.m_icons.Empty(); + if (m_frameWidget) { wxDeleteWindowFromTable((Widget) m_frameWidget); diff --git a/src/motif/radiobox.cpp b/src/motif/radiobox.cpp index 8598837d8d..9076292ca0 100644 --- a/src/motif/radiobox.cpp +++ b/src/motif/radiobox.cpp @@ -119,6 +119,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, // TODO: check this still looks OK for Motif 1.2. #if (XmVersion > 1200) XmNframeChildType, XmFRAME_TITLE_CHILD, +#else + XmNchildType, XmFRAME_TITLE_CHILD, #endif XmNchildVerticalAlignment, XmALIGNMENT_CENTER, NULL); diff --git a/src/motif/statbox.cpp b/src/motif/statbox.cpp index 4258f52c1c..46f69f1189 100644 --- a/src/motif/statbox.cpp +++ b/src/motif/statbox.cpp @@ -48,7 +48,6 @@ END_EVENT_TABLE() wxStaticBox::wxStaticBox() { - m_formWidget = (WXWidget) 0; m_labelWidget = (WXWidget) 0; } @@ -59,8 +58,6 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { - m_formWidget = (WXWidget) 0; - m_labelWidget = (WXWidget) 0; m_backgroundColour = parent->GetBackgroundColour(); m_foregroundColour = parent->GetForegroundColour(); m_font = parent->GetFont(); @@ -76,59 +73,35 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, m_windowStyle = style; - bool hasLabel = (!label.IsNull() && !label.IsEmpty()) ; - Widget parentWidget = (Widget) parent->GetClientWidget(); - Widget formWidget = XtVaCreateManagedWidget ((char*) (const char*) name, - xmFormWidgetClass, parentWidget, - XmNmarginHeight, 0, - XmNmarginWidth, 0, - NULL); - - - if (hasLabel) - { - XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget)); - - wxString label1(wxStripMenuCodes(label)); - XmString text = XmStringCreateSimple ((char*) (const char*) label1); - m_labelWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) label1, - xmLabelWidgetClass, formWidget, - XmNfontList, fontList, - XmNlabelString, text, - NULL); - XmStringFree (text); - } - - Widget frameWidget = XtVaCreateManagedWidget ("frame", - xmFrameWidgetClass, formWidget, + m_mainWidget = XtVaCreateManagedWidget ("staticboxframe", + xmFrameWidgetClass, parentWidget, XmNshadowType, XmSHADOW_IN, //XmNmarginHeight, 0, //XmNmarginWidth, 0, NULL); + bool hasLabel = (!label.IsNull() && !label.IsEmpty()) ; if (hasLabel) - XtVaSetValues ((Widget) m_labelWidget, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNalignment, XmALIGNMENT_BEGINNING, + { + XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget)); + wxString label1(wxStripMenuCodes(label)); + wxXmString text(label1); + m_labelWidget = (WXWidget) XtVaCreateManagedWidget (label1.c_str(), + xmLabelWidgetClass, (Widget)m_mainWidget, + XmNfontList, fontList, + XmNlabelString, text(), +#if (XmVersion > 1200) + XmNframeChildType, XmFRAME_TITLE_CHILD, +#else + XmNchildType, XmFRAME_TITLE_CHILD, +#endif NULL); - - XtVaSetValues (frameWidget, - XmNtopAttachment, hasLabel ? XmATTACH_WIDGET : XmATTACH_FORM, - XmNtopWidget, hasLabel ? (Widget) m_labelWidget : formWidget, - XmNbottomAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); - - m_mainWidget = (WXWidget) frameWidget; - m_formWidget = (WXWidget) formWidget; - + } + SetCanAddEventHandler(TRUE); - AttachWidget (parent, (WXWidget) frameWidget, (WXWidget) formWidget, pos.x, pos.y, size.x, size.y); + AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y); ChangeBackgroundColour(); return TRUE; @@ -136,16 +109,11 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, wxStaticBox::~wxStaticBox() { - DetachWidget(m_formWidget); DetachWidget(m_mainWidget); XtDestroyWidget((Widget) m_mainWidget); - if (m_labelWidget) - XtDestroyWidget((Widget) m_labelWidget); - XtDestroyWidget((Widget) m_formWidget); m_mainWidget = (WXWidget) 0; m_labelWidget = (WXWidget) 0; - m_formWidget = (WXWidget) 0; } void wxStaticBox::SetLabel(const wxString& label) @@ -157,12 +125,11 @@ void wxStaticBox::SetLabel(const wxString& label) { wxString label1(wxStripMenuCodes(label)); - XmString text = XmStringCreateSimple ((char*) (const char*) label1); + wxXmString text(label1); XtVaSetValues ((Widget) m_labelWidget, - XmNlabelString, text, + XmNlabelString, text(), XmNlabelType, XmSTRING, NULL); - XmStringFree (text); } } @@ -192,40 +159,9 @@ wxString wxStaticBox::GetLabel() const } } -void wxStaticBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) -{ - wxControl::DoSetSize (x, y, width, height, sizeFlags); - - if (m_labelWidget) - { - Dimension xx, yy; - XtVaGetValues ((Widget) m_labelWidget, XmNwidth, &xx, XmNheight, &yy, NULL); - - if (width > -1) - XtVaSetValues ((Widget) m_mainWidget, XmNwidth, width, - NULL); - if (height > -1) - XtVaSetValues ((Widget) m_mainWidget, XmNheight, height - yy, - NULL); - } -} - void wxStaticBox::ChangeFont(bool keepOriginalSize) { wxWindow::ChangeFont(keepOriginalSize); } -void wxStaticBox::ChangeBackgroundColour() -{ - wxWindow::ChangeBackgroundColour(); - if (m_labelWidget) - DoChangeBackgroundColour(m_labelWidget, m_backgroundColour); -} - -void wxStaticBox::ChangeForegroundColour() -{ - wxWindow::ChangeForegroundColour(); - if (m_labelWidget) - DoChangeForegroundColour(m_labelWidget, m_foregroundColour); -} diff --git a/src/motif/toolbar.cpp b/src/motif/toolbar.cpp index f62b739ad0..5f920cc7a1 100644 --- a/src/motif/toolbar.cpp +++ b/src/motif/toolbar.cpp @@ -164,9 +164,8 @@ wxToolBarTool::~wxToolBarTool() { if ( m_widget ) XtDestroyWidget(m_widget); - if ( m_pixmap ) - XmDestroyPixmap(DefaultScreenOfDisplay((Display*)wxGetDisplay()), - m_pixmap); + // note: do not delete m_pixmap here because it will be deleted + // by the base class when the bitmap is destroyed. } // ---------------------------------------------------------------------------- diff --git a/src/motif/xmcombo/xmcombo.c b/src/motif/xmcombo/xmcombo.c index b5e148b629..6519996ac5 100644 --- a/src/motif/xmcombo/xmcombo.c +++ b/src/motif/xmcombo/xmcombo.c @@ -1268,24 +1268,32 @@ static struct { String Resource; int Flag; } static int UpdateColors(XmComboBoxWidget w, int flags) { - Pixel Color; + Pixel Color, White, Black, EditCol; int i, size = XtNumber(ColorResources); Widget ScrolledWin, ScrollBar; ScrolledWin = XtParent(w->combobox.ListCtrl); XtVaGetValues(ScrolledWin, XmNverticalScrollBar, &ScrollBar, NULL); + White = WhitePixel(XtDisplay(w), WidgetToScreen((Widget) w)); + Black = BlackPixel(XtDisplay(w), WidgetToScreen((Widget) w)); for ( i=0; icombobox.ListCtrl, - ColorResources[i].Resource, Color, NULL); - XtVaSetValues(ScrolledWin, - ColorResources[i].Resource, Color, NULL); XtVaSetValues(ScrollBar, ColorResources[i].Resource, Color, NULL); - XtVaSetValues(w->combobox.EditCtrl, - ColorResources[i].Resource, Color, NULL); + XtVaSetValues(w->combobox.ListCtrl, + ColorResources[i].Resource, EditCol, NULL); + XtVaSetValues(w->combobox.EditCtrl, + ColorResources[i].Resource, EditCol, NULL); + XtVaSetValues(ScrolledWin, + ColorResources[i].Resource, Color, NULL); XtVaSetValues(w->combobox.LabelCtrl, ColorResources[i].Resource, Color, NULL); XtVaSetValues(w->combobox.ArrowCtrl, diff --git a/src/msw/brush.cpp b/src/msw/brush.cpp index c201a55748..e47a77f3b1 100644 --- a/src/msw/brush.cpp +++ b/src/msw/brush.cpp @@ -293,11 +293,11 @@ wxBitmap *wxBrush::GetStipple() const return M_BRUSHDATA->GetStipple(); } -WXHBRUSH wxBrush::GetResourceHandle() const +WXHANDLE wxBrush::GetResourceHandle() const { wxCHECK_MSG( Ok(), FALSE, _T("invalid brush") ); - return (WXHBRUSH)M_BRUSHDATA->GetHBRUSH(); + return (WXHANDLE)M_BRUSHDATA->GetHBRUSH(); } // ---------------------------------------------------------------------------- diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index bc4e9e8393..f1e29a2395 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: checkbox.cpp +// Name: msw/checkbox.cpp // Purpose: wxCheckBox // Author: Julian Smart // Modified by: @@ -39,17 +39,16 @@ #include "wx/msw/private.h" -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox) +#ifndef BST_CHECKED + #define BST_CHECKED 0x0001 +#endif // ============================================================================ // implementation // ============================================================================ +IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) + // ---------------------------------------------------------------------------- // wxCheckBox // ---------------------------------------------------------------------------- @@ -123,87 +122,15 @@ void wxCheckBox::SetValue(bool val) SendMessage(GetHwnd(), BM_SETCHECK, val, 0); } -#ifndef BST_CHECKED -#define BST_CHECKED 0x0001 -#endif - bool wxCheckBox::GetValue() const { -#ifdef __WIN32__ - return (SendMessage(GetHwnd(), BM_GETCHECK, 0, 0) == BST_CHECKED); -#else - return ((0x001 & SendMessage(GetHwnd(), BM_GETCHECK, 0, 0)) == 0x001); -#endif + return (SendMessage(GetHwnd(), BM_GETCHECK, 0, 0) & BST_CHECKED) != 0; } -void wxCheckBox::Command (wxCommandEvent & event) +void wxCheckBox::Command(wxCommandEvent& event) { - SetValue ((event.GetInt() != 0)); - ProcessCommand (event); -} - -// ---------------------------------------------------------------------------- -// wxBitmapCheckBox -// ---------------------------------------------------------------------------- - -bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *WXUNUSED(label), - const wxPoint& pos, - const wxSize& size, long style, - const wxValidator& validator, - const wxString& name) -{ - SetName(name); -#if wxUSE_VALIDATORS - SetValidator(validator); -#endif // wxUSE_VALIDATORS - if (parent) parent->AddChild(this); - - SetBackgroundColour(parent->GetBackgroundColour()) ; - SetForegroundColour(parent->GetForegroundColour()) ; - m_windowStyle = style; - - if ( id == -1 ) - m_windowId = NewControlId(); - else - m_windowId = id; - - int x = pos.x; - int y = pos.y; - int width = size.x; - int height = size.y; - - checkWidth = -1 ; - checkHeight = -1 ; - long msStyle = CHECK_FLAGS; - - HWND wx_button = CreateWindowEx(MakeExtendedStyle(m_windowStyle), CHECK_CLASS, wxT("toggle"), - msStyle, - 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, - wxGetInstance(), NULL); - -#if wxUSE_CTL3D - if (!(GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS)) - { - Ctl3dSubclassCtl(wx_button); - m_useCtl3D = TRUE; - } -#endif - - m_hWnd = (WXHWND)wx_button; - - // Subclass again for purposes of dialog editing mode - SubclassWin((WXHWND)wx_button); - - SetSize(x, y, width, height); - - ShowWindow(wx_button, SW_SHOW); - - return TRUE; -} - -void wxBitmapCheckBox::SetLabel(const wxBitmap& WXUNUSED(bitmap)) -{ - wxFAIL_MSG(wxT("not implemented")); + SetValue(event.GetInt() != 0); + ProcessCommand(event); } #endif // wxUSE_CHECKBOX diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index d72f1c609e..f35eed0ffc 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -73,7 +73,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox) class wxCheckListBoxItem : public wxOwnerDrawn { -friend class wxCheckListBox; +friend class WXDLLEXPORT wxCheckListBox; public: // ctor wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex); @@ -329,7 +329,7 @@ bool wxCheckListBox::SetFont( const wxFont &font ) // -------------------- // create a check list box item -wxOwnerDrawn *wxCheckListBox::CreateItem(size_t nIndex) +wxOwnerDrawn *wxCheckListBox::CreateLboxItem(size_t nIndex) { wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this, nIndex); return pItem; diff --git a/src/msw/dragimag.cpp b/src/msw/dragimag.cpp index b80fac16b7..ae349c83fd 100644 --- a/src/msw/dragimag.cpp +++ b/src/msw/dragimag.cpp @@ -129,8 +129,12 @@ bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor) flags = ILC_COLOR32; bool mask = (image.GetMask() != 0); - if ( mask ) - flags |= ILC_MASK; + + // Curiously, even if the image doesn't have a mask, + // we still have to use ILC_MASK or the image won't show + // up when dragged. +// if ( mask ) + flags |= ILC_MASK; m_hImageList = (WXHIMAGELIST) ImageList_Create(image.GetWidth(), image.GetHeight(), flags, 1, 1); diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 94a4e60b58..d6b76c137f 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -61,7 +61,7 @@ // ---------------------------------------------------------------------------- #ifdef __WIN32__ -# define wxMAXPATH 4096 +# define wxMAXPATH 65534 #else # define wxMAXPATH 1024 #endif diff --git a/src/msw/files.lst b/src/msw/files.lst index a4d6e527bf..7c1c8a97ec 100644 --- a/src/msw/files.lst +++ b/src/msw/files.lst @@ -658,7 +658,6 @@ ALL_HEADERS = \ generic/imaglist.h \ generic/laywin.h \ generic/listctrl.h \ - generic/mdig.cpp \ generic/msgdlgg.h \ generic/notebook.h \ generic/paletteg.h \ diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 4cd6532a0c..dc601f5af8 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -742,9 +742,9 @@ bool wxFont::FreeResource(bool WXUNUSED(force)) return FALSE; } -WXHANDLE wxFont::GetResourceHandle() +WXHANDLE wxFont::GetResourceHandle() const { - return GetHFONT(); + return (WXHANDLE)GetHFONT(); } WXHFONT wxFont::GetHFONT() const diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index 6f904e43d7..1b5000fa5e 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -208,7 +208,7 @@ bool wxGDIImage::FreeResource(bool WXUNUSED(force)) return TRUE; } -WXHANDLE wxGDIImage::GetResourceHandle() +WXHANDLE wxGDIImage::GetResourceHandle() const { return GetHandle(); } @@ -424,6 +424,27 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, nameReal = name.BeforeLast(wxT(';')); } +#if 0 + // If we don't know what size icon we're looking for, + // try to find out what's there. + // Unfortunately this doesn't work, because ExtractIconEx + // will scale the icon to the 'desired' size, even if that + // size of icon isn't explicitly stored. So we would have + // to parse the icon file outselves. + if ( desiredWidth == -1 && + desiredHeight == -1) + { + // Try loading a large icon first + if ( ::ExtractIconEx(nameReal, iconIndex, &hicon, NULL, 1) == 1) + { + } + // Then try loading a small icon + else if ( ::ExtractIconEx(nameReal, iconIndex, NULL, &hicon, 1) == 1) + { + } + } + else +#endif // were we asked for a large icon? if ( desiredWidth == ::GetSystemMetrics(SM_CXICON) && desiredHeight == ::GetSystemMetrics(SM_CYICON) ) diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 2eeafd8a78..5044afb5fd 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -102,7 +102,7 @@ wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE) SetMarginWidth(0); } -wxOwnerDrawn *wxListBox::CreateItem(size_t WXUNUSED(n)) +wxOwnerDrawn *wxListBox::CreateLboxItem(size_t WXUNUSED(n)) { return new wxListBoxItem(); } @@ -282,7 +282,7 @@ int wxListBox::DoAppend(const wxString& item) #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { - wxOwnerDrawn *pNewItem = CreateItem(index); // dummy argument + wxOwnerDrawn *pNewItem = CreateLboxItem(index); // dummy argument pNewItem->SetName(item); m_aItems.Insert(pNewItem, index); ListBox_SetItemData(GetHwnd(), index, pNewItem); @@ -333,7 +333,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) // then create new ones for ( size_t ui = 0; ui < (size_t)m_noItems; ui++ ) { - wxOwnerDrawn *pNewItem = CreateItem(ui); + wxOwnerDrawn *pNewItem = CreateLboxItem(ui); pNewItem->SetName(choices[ui]); m_aItems.Add(pNewItem); ListBox_SetItemData(GetHwnd(), ui, pNewItem); @@ -529,7 +529,7 @@ wxListBox::DoInsertItems(const wxArrayString& items, int pos) #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { - wxOwnerDrawn *pNewItem = CreateItem(idx); + wxOwnerDrawn *pNewItem = CreateLboxItem(idx); pNewItem->SetName(items[i]); pNewItem->SetFont(GetFont()); m_aItems.Insert(pNewItem, idx); diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 524a9413f4..3ee1003c8e 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1284,6 +1284,12 @@ wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass) m_textCtrl->SubclassWin(hWnd); m_textCtrl->SetParent(this); + // we must disallow TABbing away from the control while the edit contol is + // shown because this leaves it in some strange state (just try removing + // this line and then pressing TAB while editing an item in listctrl + // inside a panel) + m_textCtrl->SetWindowStyle(m_textCtrl->GetWindowStyle() | wxTE_PROCESS_TAB); + return m_textCtrl; } @@ -1719,8 +1725,33 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // almost all messages use NM_LISTVIEW NM_LISTVIEW *nmLV = (NM_LISTVIEW *)nmhdr; - // this is true for almost all events - event.m_item.m_data = nmLV->lParam; + const int iItem = nmLV->iItem; + + // set the data event field for all messages for which the system gives + // us a valid NM_LISTVIEW::lParam + switch( nmLV->hdr.code ) + { + case LVN_BEGINDRAG: + case LVN_BEGINRDRAG: + case LVN_COLUMNCLICK: +#ifdef LVN_HOTTRACK + case LVN_HOTTRACK: +#endif + case LVN_ITEMCHANGED: + case LVN_ITEMCHANGING: + if ( iItem != -1 ) + { + wxListItemInternalData *internaldata = + (wxListItemInternalData *) nmLV->lParam; + + if ( internaldata ) + event.m_item.m_data = internaldata->lParam; + } + + default: + // fall through + ; + } switch ( nmhdr->code ) { @@ -1734,7 +1765,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) eventType = wxEVT_COMMAND_LIST_BEGIN_DRAG; } - event.m_itemIndex = nmLV->iItem; + event.m_itemIndex = iItem; event.m_pointDrag.x = nmLV->ptAction.x; event.m_pointDrag.y = nmLV->ptAction.y; break; @@ -1796,9 +1827,9 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case LVN_DELETEITEM: eventType = wxEVT_COMMAND_LIST_DELETE_ITEM; - event.m_itemIndex = nmLV->iItem; + event.m_itemIndex = iItem; // delete the assoicated internal data - wxDeleteInternalData(this, nmLV->iItem); + wxDeleteInternalData(this, iItem); break; case LVN_SETDISPINFO: @@ -1811,25 +1842,33 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case LVN_INSERTITEM: eventType = wxEVT_COMMAND_LIST_INSERT_ITEM; - event.m_itemIndex = nmLV->iItem; + event.m_itemIndex = iItem; break; case LVN_ITEMCHANGED: // we translate this catch all message into more interesting // (and more easy to process) wxWindows events - // first of all, we deal with the state change events only - if ( nmLV->uChanged & LVIF_STATE ) + // first of all, we deal with the state change events only and + // only for valid items (item == -1 for the virtual list + // control) + if ( nmLV->uChanged & LVIF_STATE && iItem != -1 ) { // temp vars for readability const UINT stOld = nmLV->uOldState; const UINT stNew = nmLV->uNewState; + event.m_item.SetId(iItem); + event.m_item.SetMask(wxLIST_MASK_TEXT | + wxLIST_MASK_IMAGE | + wxLIST_MASK_DATA); + GetItem(event.m_item); + // has the focus changed? if ( !(stOld & LVIS_FOCUSED) && (stNew & LVIS_FOCUSED) ) { eventType = wxEVT_COMMAND_LIST_ITEM_FOCUSED; - event.m_itemIndex = nmLV->iItem; + event.m_itemIndex = iItem; } if ( (stNew & LVIS_SELECTED) != (stOld & LVIS_SELECTED) ) @@ -1846,7 +1885,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { // then need to set m_itemIndex as it wasn't done // above - event.m_itemIndex = nmLV->iItem; + event.m_itemIndex = iItem; } eventType = stNew & LVIS_SELECTED @@ -1914,16 +1953,16 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // else translate it into wxEVT_COMMAND_LIST_ITEM_ACTIVATED event // if it happened on an item (and not on empty place) - if ( nmLV->iItem == -1 ) + if ( iItem == -1 ) { // not on item return FALSE; } eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED; - event.m_itemIndex = nmLV->iItem; - event.m_item.m_text = GetItemText(nmLV->iItem); - event.m_item.m_data = GetItemData(nmLV->iItem); + event.m_itemIndex = iItem; + event.m_item.m_text = GetItemText(iItem); + event.m_item.m_data = GetItemData(iItem); break; case NM_RCLICK: diff --git a/src/msw/makebase.b32 b/src/msw/makebase.b32 index a277518f99..5bbba8fbea 100644 --- a/src/msw/makebase.b32 +++ b/src/msw/makebase.b32 @@ -37,8 +37,8 @@ wxUSE_GUI=0 !include $(WXDIR)\src\makeb32.env PERIPH_LIBS= -PERIPH_TARGET=zlib png jpeg tiff regex $(PERIPH_TARGET) -PERIPH_CLEAN_TARGET=clean_zlib clean_png clean_jpeg clean_tiff clean_regex $(PERIPH_CLEAN_TARGET) +PERIPH_TARGET=zlib regex $(PERIPH_TARGET) +PERIPH_CLEAN_TARGET=clean_zlib clean_regex $(PERIPH_CLEAN_TARGET) !if "$(DLL)" == "0" DUMMY=dummy @@ -58,7 +58,6 @@ MSWDIR=. DOCDIR = $(WXDIR)\docs COMMONOBJS = \ - $(MSWDIR)\y_tab.obj \ $(MSWDIR)\appcmn.obj \ $(MSWDIR)\clntdata.obj \ $(MSWDIR)\cmdline.obj \ @@ -193,19 +192,6 @@ dummydll.obj: dummydll.$(SRCSUFF) $(LOCALHEADERS) $(BASEHEADERS) $(WXDIR)\includ version.res: brc32 -r -i$(WXDIR)\include\ $(MSWDIR)\version.rc -$(MSWDIR)\y_tab.obj: $(COMMDIR)\y_tab.c $(COMMDIR)\lex_yy.c - -# cl @<< -# $(CPPFLAGS2) /c $*.c -DUSE_DEFINE -DYY_USE_PROTOS /Fo$@ -# << - -$(COMMDIR)\y_tab.c: $(COMMDIR)\dosyacc.c - copy $(COMMDIR)\dosyacc.c $(COMMDIR)\y_tab.c - -$(COMMDIR)\lex_yy.c: $(COMMDIR)\doslex.c - copy $(COMMDIR)\doslex.c $(COMMDIR)\lex_yy.c - - $(MSWDIR)\dde.obj: $(MSWDIR)\dde.$(SRCSUFF) $(MSWDIR)\dir.obj: $(MSWDIR)\dir.$(SRCSUFF) @@ -472,8 +458,6 @@ clean: $(PERIPH_CLEAN_TARGET) -erase *.pch -erase *.csm -erase "wx32.#??" - -erase ..\common\y_tab.c - -erase ..\common\lex_yy.c cleanall: clean diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index 1043e14499..74e523f6d3 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -546,9 +546,12 @@ $(ARCHINCDIR)/wx: mkdir $(subst $(PATH_SUBST),$(PATH_SEPARATOR),$(ARCHINCDIR)) mkdir $(subst $(PATH_SUBST),$(PATH_SEPARATOR),$(ARCHINCDIR)/wx) -$(SETUP_H): $(ARCHINCDIR)/wx - $(COPY) $(WXDIR)/include/wx/msw/setup.h $@ +# Copy ALWAYS uses forward slashes now. +$(SETUP_H): $(ARCHINCDIR)/wx + $(COPY) $(WXDIR)/include/wx/msw/setup.h $(subst $(BACKSLASH),/,$@) + +# $(COPY) $(WXDIR)/include/wx/msw/setup.h $@ # $(COPY) $(subst $(PATH_SUBST),$(PATH_SEPARATOR),$(WXDIR)/include/wx/msw/setup.h) $(subst $(PATH_SUBST),$(PATH_SEPARATOR),$@) ifndef WXMAKINGDLL diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index c5d5039212..8473fd1136 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -237,6 +237,9 @@ wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const wxRegKey(wxRegKey::HKCR, strKey + _T("\\Topic")). QueryValue(_T(""), ddeTopic); + if (ddeTopic.IsEmpty()) + ddeTopic = wxT("System"); + // HACK: we use a special feature of wxExecute which exists // just because we need it here: it will establish DDE // conversation with the program it just launched diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index 599d747603..993af83b62 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -278,7 +278,7 @@ bool wxPen::RealizeResource() return FALSE; } -WXHANDLE wxPen::GetResourceHandle() +WXHANDLE wxPen::GetResourceHandle() const { if ( !M_PENDATA ) return 0; diff --git a/src/msw/region.cpp b/src/msw/region.cpp index dc33bc15a2..4da2054b10 100644 --- a/src/msw/region.cpp +++ b/src/msw/region.cpp @@ -1,16 +1,24 @@ ///////////////////////////////////////////////////////////////////////////// // Name: msw/region.cpp -// Purpose: Region handling for wxWindows/X11 -// Author: Markus Holzem +// Purpose: wxRegion implementation using Win32 API +// Author: Markus Holzem, Vadim Zeitlin // Modified by: // Created: Fri Oct 24 10:46:34 MET 1997 // RCS-ID: $Id$ -// Copyright: (c) 1997 Julian Smart and Markus Holzem +// Copyright: (c) 1997-2002 wxWindows team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + #ifdef __GNUG__ -#pragma implementation "region.h" + #pragma implementation "region.h" #endif // For compilers that support precompilation, includes "wx.h". @@ -20,18 +28,17 @@ #pragma hdrstop #endif -#include "wx/msw/region.h" +#include "wx/region.h" #include "wx/gdicmn.h" -#include "wx/window.h" #include "wx/msw/private.h" IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject) -//----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // wxRegionRefData implementation -//----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- class WXDLLEXPORT wxRegionRefData : public wxGDIRefData { @@ -56,7 +63,7 @@ public: #endif } - ~wxRegionRefData() + virtual ~wxRegionRefData() { ::DeleteObject(m_region); m_region = 0; @@ -68,13 +75,14 @@ public: #define M_REGION (((wxRegionRefData*)m_refData)->m_region) #define M_REGION_OF(rgn) (((wxRegionRefData*)(rgn.m_refData))->m_region) -//----------------------------------------------------------------------------- -// wxRegion -//----------------------------------------------------------------------------- +// ============================================================================ +// wxRegion implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// ctors and dtor +// ---------------------------------------------------------------------------- -/* - * Create an empty region. - */ wxRegion::wxRegion() { m_refData = (wxRegionRefData *)NULL; @@ -135,9 +143,9 @@ wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const return new wxRegionRefData(*(wxRegionRefData *)data); } -//----------------------------------------------------------------------------- -// Modify region -//----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +// wxRegion operations +// ---------------------------------------------------------------------------- // Clear current region void wxRegion::Clear() @@ -195,6 +203,8 @@ bool wxRegion::Combine(const wxRegion& rgn, wxRegionOp op) } else // we have a valid region { + AllocExclusive(); + int mode; switch ( op ) { @@ -248,9 +258,9 @@ bool wxRegion::Combine(const wxRect& rect, wxRegionOp op) rect.GetWidth(), rect.GetHeight(), op); } -//----------------------------------------------------------------------------- -// Information on region -//----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +// wxRegion bounding box +// ---------------------------------------------------------------------------- // Outer bounds of region void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const @@ -286,9 +296,9 @@ bool wxRegion::Empty() const return (w == 0) && (h == 0); } -//----------------------------------------------------------------------------- -// Tests -//----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +// wxRegion hit testing +// ---------------------------------------------------------------------------- // Does the region contain the point (x,y)? wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y) const @@ -296,26 +306,18 @@ wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y) const if (!m_refData) return wxOutRegion; - if (::PtInRegion(M_REGION, (int) x, (int) y)) - return wxInRegion; - else - return wxOutRegion; + return ::PtInRegion(M_REGION, (int) x, (int) y) ? wxInRegion : wxOutRegion; } // Does the region contain the point pt? wxRegionContain wxRegion::Contains(const wxPoint& pt) const { - if (!m_refData) - return wxOutRegion; - - if (::PtInRegion(M_REGION, (int) pt.x, (int) pt.y)) - return wxInRegion; - else - return wxOutRegion; + return Contains(pt.x, pt.y); } // Does the region contain the rectangle (x, y, w, h)? -wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const +wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y, + wxCoord w, wxCoord h) const { if (!m_refData) return wxOutRegion; @@ -326,56 +328,43 @@ wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) c rect.right = x + w; rect.bottom = y + h; - if (::RectInRegion(M_REGION, & rect)) - return wxInRegion; - else - return wxOutRegion; + return ::RectInRegion(M_REGION, &rect) ? wxInRegion : wxOutRegion; } // Does the region contain the rectangle rect wxRegionContain wxRegion::Contains(const wxRect& rect) const { - if (!m_refData) - return wxOutRegion; - - wxCoord x, y, w, h; - x = rect.x; - y = rect.y; - w = rect.GetWidth(); - h = rect.GetHeight(); - return Contains(x, y, w, h); + return Contains(rect.x, rect.y, rect.width, rect.height); } // Get internal region handle WXHRGN wxRegion::GetHRGN() const { - if (!m_refData) - return (WXHRGN) 0; - return (WXHRGN) M_REGION; + return (WXHRGN)(m_refData ? M_REGION : 0); } -/////////////////////////////////////////////////////////////////////////////// -// // -// wxRegionIterator // -// // -/////////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// wxRegionIterator implementation +// ============================================================================ -/* - * Initialize empty iterator - */ -wxRegionIterator::wxRegionIterator() : m_current(0), m_numRects(0), m_rects(NULL) +// ---------------------------------------------------------------------------- +// wxRegionIterator ctors/dtor +// ---------------------------------------------------------------------------- + +void wxRegionIterator::Init() { + m_current = + m_numRects = 0; + + m_rects = NULL; } wxRegionIterator::~wxRegionIterator() { - if (m_rects) - delete[] m_rects; + delete [] m_rects; } -/* - * Initialize iterator for region - */ +// Initialize iterator for region wxRegionIterator::wxRegionIterator(const wxRegion& region) { m_rects = NULL; @@ -383,18 +372,42 @@ wxRegionIterator::wxRegionIterator(const wxRegion& region) Reset(region); } -/* - * Reset iterator for a new /e region. - */ +wxRegionIterator& wxRegionIterator::operator=(const wxRegionIterator& ri) +{ + delete [] m_rects; + + m_current = ri.m_current; + m_numRects = ri.m_numRects; + if ( m_numRects ) + { + m_rects = new wxRect[m_numRects]; + for ( long n = 0; n < m_numRects; n++ ) + m_rects[n] = ri.m_rects[n]; + } + else + { + m_rects = NULL; + } + + return *this; +} + +// ---------------------------------------------------------------------------- +// wxRegionIterator operations +// ---------------------------------------------------------------------------- + +// Reset iterator for a new region. void wxRegionIterator::Reset(const wxRegion& region) { m_current = 0; m_region = region; if (m_rects) + { delete[] m_rects; - m_rects = NULL; + m_rects = NULL; + } if (m_region.Empty()) m_numRects = 0; @@ -421,7 +434,7 @@ void wxRegionIterator::Reset(const wxRegion& region) m_numRects = header->nCount; delete[] (char*) rgnData; -#else +#else // Win16 RECT rect; ::GetRgnBox(((wxRegionRefData*)region.m_refData)->m_region, &rect); m_rects = new wxRect[1]; @@ -431,55 +444,56 @@ void wxRegionIterator::Reset(const wxRegion& region) m_rects[0].height = rect.bottom - rect.top; m_numRects = 1; -#endif +#endif // Win32/16 } } -/* - * Increment iterator. The rectangle returned is the one after the - * incrementation. - */ -void wxRegionIterator::operator ++ () +wxRegionIterator& wxRegionIterator::operator++() { if (m_current < m_numRects) ++m_current; + + return *this; } -/* - * Increment iterator. The rectangle returned is the one before the - * incrementation. - */ -void wxRegionIterator::operator ++ (int) +wxRegionIterator wxRegionIterator::operator ++ (int) { + wxRegionIterator tmp = *this; if (m_current < m_numRects) ++m_current; + + return tmp; } +// ---------------------------------------------------------------------------- +// wxRegionIterator accessors +// ---------------------------------------------------------------------------- + wxCoord wxRegionIterator::GetX() const { - if (m_current < m_numRects) - return m_rects[m_current].x; - return 0; + wxCHECK_MSG( m_current < m_numRects, 0, _T("invalid wxRegionIterator") ); + + return m_rects[m_current].x; } wxCoord wxRegionIterator::GetY() const { - if (m_current < m_numRects) - return m_rects[m_current].y; - return 0; + wxCHECK_MSG( m_current < m_numRects, 0, _T("invalid wxRegionIterator") ); + + return m_rects[m_current].y; } wxCoord wxRegionIterator::GetW() const { - if (m_current < m_numRects) - return m_rects[m_current].width; - return 0; + wxCHECK_MSG( m_current < m_numRects, 0, _T("invalid wxRegionIterator") ); + + return m_rects[m_current].width; } wxCoord wxRegionIterator::GetH() const { - if (m_current < m_numRects) - return m_rects[m_current].height; - return 0; + wxCHECK_MSG( m_current < m_numRects, 0, _T("invalid wxRegionIterator") ); + + return m_rects[m_current].height; } diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index 7c32db671e..d10d08daad 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -122,9 +122,40 @@ wxScrollBar::~wxScrollBar(void) bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, WXWORD pos, WXHWND control) { - int position = ::GetScrollPos((HWND) control, SB_CTL); - int minPos, maxPos; - ::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos); + // current and max positions + int position, + maxPos, trackPos = pos; + +#ifdef __WIN32__ + // when we're dragging the scrollbar we can't use pos parameter because it + // is limited to 16 bits + if ( wParam == SB_THUMBPOSITION || wParam == SB_THUMBTRACK ) + { + SCROLLINFO scrollInfo; + wxZeroMemory(scrollInfo); + scrollInfo.cbSize = sizeof(SCROLLINFO); + + // also get the range if we call GetScrollInfo() anyhow -- this is less + // expensive than call it once here and then call GetScrollRange() + // below + scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_TRACKPOS; + + if ( !::GetScrollInfo(GetHwnd(), SB_CTL, &scrollInfo) ) + { + wxLogLastError(_T("GetScrollInfo")); + } + + trackPos = scrollInfo.nTrackPos; + position = scrollInfo.nPos; + maxPos = scrollInfo.nMax; + } + else +#endif // Win32 + { + position = ::GetScrollPos((HWND) control, SB_CTL); + int minPos; + ::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos); + } #if defined(__WIN95__) // A page size greater than one has the effect of reducing the effective @@ -170,12 +201,12 @@ bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, break; case SB_THUMBPOSITION: - nScrollInc = pos - position; + nScrollInc = trackPos - position; scrollEvent = wxEVT_SCROLL_THUMBRELEASE; break; case SB_THUMBTRACK: - nScrollInc = pos - position; + nScrollInc = trackPos - position; scrollEvent = wxEVT_SCROLL_THUMBTRACK; break; @@ -217,16 +248,16 @@ bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, void wxScrollBar::SetThumbPosition(int viewStart) { #if defined(__WIN95__) - SCROLLINFO info; - info.cbSize = sizeof(SCROLLINFO); - info.nPage = 0; - info.nMin = 0; - info.nPos = viewStart; - info.fMask = SIF_POS ; + SCROLLINFO info; + info.cbSize = sizeof(SCROLLINFO); + info.nPage = 0; + info.nMin = 0; + info.nPos = viewStart; + info.fMask = SIF_POS ; - ::SetScrollInfo((HWND) GetHWND(), SB_CTL, &info, TRUE); + ::SetScrollInfo((HWND) GetHWND(), SB_CTL, &info, TRUE); #else - ::SetScrollPos((HWND) GetHWND(), SB_CTL, viewStart, TRUE); + ::SetScrollPos((HWND) GetHWND(), SB_CTL, viewStart, TRUE); #endif } diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 4b33ade2c9..1c0810694c 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -170,16 +170,4 @@ bool wxStaticText::SetFont(const wxFont& font) return ret; } -long wxStaticText::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) -{ - // Ensure that static items get messages. Some controls don't like this - // message to be intercepted (e.g. RichEdit), hence the tests. - // Messes up display with Windows XP, apparently, so have to - // do explicit hit-testing in wxWindowMSW. -#if 0 - if (nMsg == WM_NCHITTEST) - return (long)HTCLIENT; -#endif - return wxWindow::MSWWindowProc(nMsg, wParam, lParam); -} #endif // wxUSE_STATTEXT diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 8777634b70..9fd39ade69 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -472,6 +472,15 @@ bool wxToolBar::Realize() const bool isVertical = HasFlag(wxTB_VERTICAL); + // delete all old buttons, if any + for ( size_t pos = 0; pos < m_nButtons; pos++ ) + { + if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, 0, 0) ) + { + wxLogDebug(wxT("TB_DELETEBUTTON failed")); + } + } + // First, add the bitmap: we use one bitmap for all toolbar buttons // ---------------------------------------------------------------- @@ -612,15 +621,6 @@ bool wxToolBar::Realize() bitmapId = m_nButtons; } - - // Now delete all the buttons - for ( size_t pos = 0; pos < m_nButtons; pos++ ) - { - if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, 0, 0) ) - { - wxLogDebug(wxT("TB_DELETEBUTTON failed")); - } - } } if ( addBitmap ) // no old bitmap or we can't replace it diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 9cb0a4f03a..ac0e8b75ff 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -722,6 +722,15 @@ void wxTextCtrl::AppendText(const wxString& text) SetInsertionPointEnd(); WriteText(text); + +#if wxUSE_RICHEDIT + if ( IsMultiLine() && GetRichVersion() > 1 ) + { + // setting the caret to the end and showing it simply doesn't work for + // RichEdit 2.0 -- force it to still do what we want + ::SendMessage(GetHwnd(), EM_LINESCROLL, 0, GetNumberOfLines()); + } +#endif // wxUSE_RICHEDIT } void wxTextCtrl::Clear() diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 58b26f2c07..92f78fc292 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -453,7 +453,7 @@ static bool wxExecuteDDE(const wxString& ddeServer, const wxString& ddeTopic, const wxString& ddeCommand) { - bool ok; + bool ok = FALSE; wxDDEClient client; wxConnectionBase *conn = client.MakeConnection(_T(""), @@ -470,17 +470,17 @@ static bool wxExecuteDDE(const wxString& ddeServer, // important ones - like IE and other MS stuff - use // XTYP_REQUEST! // - // so we try it first and then the other one if it + // so we try one first and then the other one if it // failed { wxLogNull noErrors; - ok = conn->Request(ddeCommand) != NULL; + ok = conn->Execute(ddeCommand); } if ( !ok ) { - // now try execute - but show the errors - ok = conn->Execute(ddeCommand); + // now try request - but show the errors + ok = conn->Request(ddeCommand) != NULL; } } diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 07d4a17190..c79e87c99c 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -3499,6 +3499,8 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd), if ( hcursor ) { +// wxLogDebug("HandleSetCursor: Setting cursor %ld", (long) hcursor); + ::SetCursor(hcursor); // cursor set, stop here @@ -4378,9 +4380,18 @@ bool wxWindowMSW::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII) } wxKeyEvent event(CreateKeyEvent(wxEVT_CHAR, id, lParam, wParam)); - if ( ctrlDown ) + + // the alphanumeric keys produced by pressing AltGr+something on European + // keyboards have both Ctrl and Alt modifiers which may confuse the user + // code as, normally, keys with Ctrl and/or Alt don't result in anything + // alphanumeric, so pretend that there are no modifiers at all (the + // KEY_DOWN event would still have the correct modifiers if they're really + // needed) + if ( event.m_controlDown && event.m_altDown && + (id >= 32 && id < 256) ) { - event.m_controlDown = TRUE; + event.m_controlDown = + event.m_altDown = FALSE; } return GetEventHandler()->ProcessEvent(event); diff --git a/src/os2/file.lst b/src/os2/file.lst index d9b38dacc3..8f2f489186 100644 --- a/src/os2/file.lst +++ b/src/os2/file.lst @@ -1,77 +1,39 @@ -List of files yet to be implemented. As you finish a file, delete it from the list +List of files yet to be implemented. As you finish a file, delete it from the list. - ..\os2\$D\accel.obj \ - ..\os2\$D\app.obj \ - ..\os2\$D\bitmap.obj \ - ..\os2\$D\bmpbuttn.obj \ - ..\os2\$D\brush.obj \ - ..\os2\$D\button.obj \ - ..\os2\$D\checkbox.obj \ - ..\os2\$D\checklst.obj \ - ..\os2\$D\choice.obj \ - ..\os2\$D\clipbrd.obj \ - ..\os2\$D\colour.obj \ - ..\os2\$D\combobox.obj \ - ..\os2\$D\control.obj \ - ..\os2\$D\cursor.obj \ - ..\os2\$D\data.obj \ - ..\os2\$D\dc.obj \ - ..\os2\$D\dcclient.obj \ - ..\os2\$D\dcmemory.obj \ ..\os2\$D\dcprint.obj \ - ..\os2\$D\dcscreen.obj \ - ..\os2\$D\dialog.obj \ - ..\os2\$D\dirdlg.obj \ ..\os2\$D\dnd.obj \ - ..\os2\$D\filedlg.obj \ - ..\os2\$D\font.obj \ - ..\os2\$D\fontdlg.obj \ - ..\os2\$D\frame.obj \ - ..\os2\$D\gauge.obj \ - ..\os2\$D\gdiobj.obj \ - ..\os2\$D\gsocket.obj \ ..\os2\$D\helpwin.obj \ - ..\os2\$D\icon.obj \ - ..\os2\$D\imaglist.obj \ - ..\os2\$D\iniconf.obj \ ..\os2\$D\joystick.obj \ - ..\os2\$D\listbox.obj \ - ..\os2\$D\listctrl.obj \ - ..\os2\$D\main.obj \ - ..\os2\$D\mdi.obj \ - ..\os2\$D\menu.obj \ - ..\os2\$D\menuitem.obj \ ..\os2\$D\metafile.obj \ - ..\os2\$D\minifram.obj \ - ..\os2\$D\msgdlg.obj \ - ..\os2\$D\nativdlg.obj \ - ..\os2\$D\notebook.obj \ - ..\os2\$D\ownerdrw.obj \ - ..\os2\$D\palette.obj \ - ..\os2\$D\pen.obj \ - ..\os2\$D\pnghand.obj \ ..\os2\$D\print.obj \ - ..\os2\$D\radiobox.obj \ - ..\os2\$D\radiobut.obj \ - ..\os2\$D\region.obj \ - ..\os2\$D\scrolbar.obj \ - ..\os2\$D\settings.obj \ - ..\os2\$D\slider.obj \ - ..\os2\$D\spinbutt.obj \ - ..\os2\$D\spinctrl.obj \ - ..\os2\$D\statbmp.obj \ - ..\os2\$D\statbox.obj \ - ..\os2\$D\stattext.obj \ - ..\os2\$D\statbrpm.obj \ - ..\os2\$D\tabctrl.obj \ ..\os2\$D\taskbar.obj \ - ..\os2\$D\textctrl.obj \ - ..\os2\$D\thread.obj \ - ..\os2\$D\toolbar.obj \ - ..\os2\$D\tooltip.obj \ - ..\os2\$D\treectrl.obj \ - ..\os2\$D\utils.obj \ - ..\os2\$D\utilsexc.obj \ ..\os2\$D\wave.obj \ - ..\os2\$D\window.obj + + +List of things that still need doing, include the above files. Some are more difficult than others. + +DND is a needed component of the tree control. + +The tree control is a component of the list and dirctrl's. These are, in turn, components of the dirdlgg. + +DDE isn't used much anymore as an IPC protocol, but if OS/2 needs DDE, it should be straight forward. + +Printing is an untouched area, but should not be too difficult to finish. + +Not sure what good a taskbar control is but the other ports have one. + +The wave file is for OS/2 to be able to simply play back a .wav file. I have not touched +multimedia as of yet. + +There is a problem with TIFF right now for some reason. + +The color sliders in the color dialog do not seem to display correctly. + +Dialogs are generally not resizable, but in wxOS2, resizing a dialog leaves the title bar un-resized. + +Static bitmap controls need some work as they are non-wx standard, requiring a resource. Probably need +a "roll-our-own" control that is a simple window with an icon or bitmap drawn directly in it. + + + diff --git a/src/os2/makefile.va b/src/os2/makefile.va index 7f384a8e98..514668cd37 100644 --- a/src/os2/makefile.va +++ b/src/os2/makefile.va @@ -515,7 +515,6 @@ OS2OBJS = \ ..\os2\$D\menuitem.obj \ ..\os2\$D\metafile.obj \ ..\os2\$D\mimetype.obj \ - ..\os2\$D\minifram.obj \ ..\os2\$D\msgdlg.obj \ ..\os2\$D\nativdlg.obj \ ..\os2\$D\notebook.obj \ @@ -597,7 +596,6 @@ OS2LIBOBJS1 = \ mimetype.obj OS2LIBOBJS2 = \ - minifram.obj \ msgdlg.obj \ nativdlg.obj \ notebook.obj \ @@ -862,6 +860,7 @@ $(GENLIBOBJS): copy ..\generic\$D\laywin.obj copy ..\generic\$D\listctrl.obj copy ..\generic\$D\logg.obj + copy ..\generic\$D\mdig.obj copy ..\generic\$D\numdlgg.obj copy ..\generic\$D\panelg.obj copy ..\generic\$D\printps.obj @@ -955,7 +954,6 @@ $(OS2LIBOBJS1): copy ..\os2\$D\mimetype.obj $(OS2LIBOBJS2): - copy ..\os2\$D\minifram.obj copy ..\os2\$D\msgdlg.obj copy ..\os2\$D\nativdlg.obj copy ..\os2\$D\notebook.obj diff --git a/src/os2/wx23.def b/src/os2/wx23.def index fefe5ab4c4..991cacfa5a 100644 --- a/src/os2/wx23.def +++ b/src/os2/wx23.def @@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL CODE LOADONCALL EXPORTS -;From library: F:\DEV\WX2\WXWINDOWS\LIB\wx.lib +;From library: H:\DEV\WX24\WXWINDOWS\LIB\wx.lib ;From object file: dummy.cpp ;PUBDEFs (Symbols available from object file): wxDummyChar @@ -1965,7 +1965,7 @@ EXPORTS wxEVT_NC_LEFT_DCLICK wxEVT_INIT_DIALOG wxEVT_COMMAND_SET_FOCUS - ;From object file: F:\DEV\WX2\WXWINDOWS\src\common\extended.c + ;From object file: H:\DEV\WX24\WXWINDOWS\src\common\extended.c ;PUBDEFs (Symbols available from object file): ConvertToIeeeExtended ConvertFromIeeeExtended @@ -6261,7 +6261,7 @@ EXPORTS Read32__17wxTextInputStreamFv ;wxTextInputStream::SkipIfEndOfLine(char) SkipIfEndOfLine__17wxTextInputStreamFc - ;From object file: F:\DEV\WX2\WXWINDOWS\src\common\unzip.c + ;From object file: H:\DEV\WX24\WXWINDOWS\src\common\unzip.c ;PUBDEFs (Symbols available from object file): unzReadCurrentFile unzGetCurrentFileInfo @@ -9795,6 +9795,141 @@ EXPORTS __ct__10wxLogFrameFP7wxFrameP11wxLogWindowPCc ;wxLogWindow::wxLogWindow(wxFrame*,const char*,unsigned long,unsigned long) __ct__11wxLogWindowFP7wxFramePCcUlT3 + ;From object file: ..\generic\mdig.cpp + ;PUBDEFs (Symbols available from object file): + ;wxGenericMDIClientWindow::CreateClient(wxGenericMDIParentFrame*,long) + CreateClient__24wxGenericMDIClientWindowFP23wxGenericMDIParentFramel + ;wxGenericMDIChildFrame::DoMoveWindow(int,int,int,int) + DoMoveWindow__22wxGenericMDIChildFrameFiN31 + ;wxConstructorForwxGenericMDIParentFrame() + wxConstructorForwxGenericMDIParentFrame__Fv + ;wxGenericMDIParentFrame::RemoveWindowMenu(wxMenuBar*) + RemoveWindowMenu__23wxGenericMDIParentFrameFP9wxMenuBar + ;wxGenericMDIParentFrame::OnCreateClient() + OnCreateClient__23wxGenericMDIParentFrameFv + ;wxGenericMDIParentFrame::ActivatePrevious() + ActivatePrevious__23wxGenericMDIParentFrameFv + ;wxGenericMDIParentFrame::ActivateNext() + ActivateNext__23wxGenericMDIParentFrameFv + ;wxMDIClientWindow::sm_classwxMDIClientWindow + sm_classwxMDIClientWindow__17wxMDIClientWindow + ;wxGenericMDIClientWindow::sm_eventTable + sm_eventTable__24wxGenericMDIClientWindow + ;wxGenericMDIClientWindow::wxGenericMDIClientWindow(wxGenericMDIParentFrame*,long) + __ct__24wxGenericMDIClientWindowFP23wxGenericMDIParentFramel + __vft24wxGenericMDIClientWindow8wxObject + ;wxGenericMDIClientWindow::OnPageChanged(wxNotebookEvent&) + OnPageChanged__24wxGenericMDIClientWindowFR15wxNotebookEvent + ;wxGenericMDIParentFrame::SetChildMenuBar(wxGenericMDIChildFrame*) + SetChildMenuBar__23wxGenericMDIParentFrameFP22wxGenericMDIChildFrame + ;wxGenericMDIChildFrame::sm_eventTableEntries + sm_eventTableEntries__22wxGenericMDIChildFrame + ;wxMDIParentFrame::sm_classwxMDIParentFrame + sm_classwxMDIParentFrame__16wxMDIParentFrame + ;wxGenericMDIParentFrame::sm_classwxGenericMDIParentFrame + sm_classwxGenericMDIParentFrame__23wxGenericMDIParentFrame + ;wxGenericMDIClientWindow::SetSelection(int) + SetSelection__24wxGenericMDIClientWindowFi + ;wxGenericMDIChildFrame::wxGenericMDIChildFrame() + __ct__22wxGenericMDIChildFrameFv + ;wxGenericMDIClientWindow::wxGenericMDIClientWindow() + __ct__24wxGenericMDIClientWindowFv + ;wxGenericMDIParentFrame::SetMenuBar(wxMenuBar*) + SetMenuBar__23wxGenericMDIParentFrameFP9wxMenuBar + ;wxGenericMDIParentFrame::AddWindowMenu(wxMenuBar*) + AddWindowMenu__23wxGenericMDIParentFrameFP9wxMenuBar + ;wxGenericMDIParentFrame::ProcessEvent(wxEvent&) + ProcessEvent__23wxGenericMDIParentFrameFR7wxEvent + __vft23wxGenericMDIParentFrame8wxObject + ;wxGenericMDIParentFrame::DoHandleMenu(wxCommandEvent&) + DoHandleMenu__23wxGenericMDIParentFrameFR14wxCommandEvent + ;wxGenericMDIChildFrame::sm_classwxGenericMDIChildFrame + sm_classwxGenericMDIChildFrame__22wxGenericMDIChildFrame + ;wxGenericMDIChildFrame::sm_eventTable + sm_eventTable__22wxGenericMDIChildFrame + ;wxMDIChildFrame::sm_classwxMDIChildFrame + sm_classwxMDIChildFrame__15wxMDIChildFrame + ;wxGenericMDIChildFrame::~wxGenericMDIChildFrame() + __dt__22wxGenericMDIChildFrameFv + ;wxGenericMDIClientWindow::~wxGenericMDIClientWindow() + __dt__24wxGenericMDIClientWindowFv + ;wxGenericMDIChildFrame::SetMenuBar(wxMenuBar*) + SetMenuBar__22wxGenericMDIChildFrameFP9wxMenuBar + ;wxGenericMDIChildFrame::GetMenuBar() const + GetMenuBar__22wxGenericMDIChildFrameCFv + ;wxGenericMDIParentFrame::GetActiveChild() const + GetActiveChild__23wxGenericMDIParentFrameCFv + ;wxGenericMDIChildFrame::Activate() + Activate__22wxGenericMDIChildFrameFv + ;wxGenericMDIParentFrame::wxGenericMDIParentFrame(wxWindow*,int,const wxString&,const wxPoint&,const wxSize&,long,const wxString&) + __ct__23wxGenericMDIParentFrameFP8wxWindowiRC8wxStringRC7wxPointRC6wxSizelT3 + ;wxGenericMDIClientWindow::sm_classwxGenericMDIClientWindow + sm_classwxGenericMDIClientWindow__24wxGenericMDIClientWindow + ;wxGenericMDIChildFrame::OnSize(wxSizeEvent&) + OnSize__22wxGenericMDIChildFrameFR11wxSizeEvent + __vft22wxGenericMDIChildFrame8wxObject + ;wxGenericMDIClientWindow::OnSize(wxSizeEvent&) + OnSize__24wxGenericMDIClientWindowFR11wxSizeEvent + ;wxGenericMDIChildFrame::OnCloseWindow(wxCloseEvent&) + OnCloseWindow__22wxGenericMDIChildFrameFR12wxCloseEvent + ;wxGenericMDIParentFrame::SetWindowMenu(wxMenu*) + SetWindowMenu__23wxGenericMDIParentFrameFP6wxMenu + ;wxGenericMDIParentFrame::sm_eventTableEntries + sm_eventTableEntries__23wxGenericMDIParentFrame + ;wxGenericMDIChildFrame::SetMDIParentFrame(wxGenericMDIParentFrame*) + SetMDIParentFrame__22wxGenericMDIChildFrameFP23wxGenericMDIParentFrame + ;wxGenericMDIParentFrame::DoGetClientSize(int*,int*) const + DoGetClientSize__23wxGenericMDIParentFrameCFPiT1 + ;wxGenericMDIParentFrame::wxGenericMDIParentFrame() + __ct__23wxGenericMDIParentFrameFv + ;wxConstructorForwxGenericMDIClientWindow() + wxConstructorForwxGenericMDIClientWindow__Fv + ;wxConstructorForwxGenericMDIChildFrame() + wxConstructorForwxGenericMDIChildFrame__Fv + ;wxGenericMDIParentFrame::Init() + Init__23wxGenericMDIParentFrameFv + ;wxGenericMDIChildFrame::GetMDIParentFrame() const + GetMDIParentFrame__22wxGenericMDIChildFrameCFv + ;wxGenericMDIClientWindow::GetEventTable() const + GetEventTable__24wxGenericMDIClientWindowCFv + ;wxGenericMDIParentFrame::GetEventTable() const + GetEventTable__23wxGenericMDIParentFrameCFv + ;wxGenericMDIParentFrame::GetClientWindow() const + GetClientWindow__23wxGenericMDIParentFrameCFv + ;wxGenericMDIChildFrame::Create(wxGenericMDIParentFrame*,int,const wxString&,const wxPoint&,const wxSize&,long,const wxString&) + Create__22wxGenericMDIChildFrameFP23wxGenericMDIParentFrameiRC8wxStringRC7wxPointRC6wxSizelT3 + ;wxGenericMDIChildFrame::OnMenuHighlight(wxMenuEvent&) + OnMenuHighlight__22wxGenericMDIChildFrameFR11wxMenuEvent + ;wxGenericMDIChildFrame::OnActivate(wxActivateEvent&) + OnActivate__22wxGenericMDIChildFrameFR15wxActivateEvent + ;wxGenericMDIClientWindow::PageChanged(int,int) + PageChanged__24wxGenericMDIClientWindowFiT1 + ;wxGenericMDIParentFrame::sm_eventTable + sm_eventTable__23wxGenericMDIParentFrame + ;wxGenericMDIParentFrame::~wxGenericMDIParentFrame() + __dt__23wxGenericMDIParentFrameFv + ;wxConstructorForwxMDIParentFrame() + wxConstructorForwxMDIParentFrame__Fv + ;wxConstructorForwxMDIClientWindow() + wxConstructorForwxMDIClientWindow__Fv + ;wxConstructorForwxMDIChildFrame() + wxConstructorForwxMDIChildFrame__Fv + ;wxGenericMDIChildFrame::Init() + Init__22wxGenericMDIChildFrameFv + ;wxGenericMDIChildFrame::GetTitle() const + GetTitle__22wxGenericMDIChildFrameCFv + ;wxGenericMDIChildFrame::GetEventTable() const + GetEventTable__22wxGenericMDIChildFrameCFv + ;wxGenericMDIChildFrame::ApplyMDIChildFrameRect() + ApplyMDIChildFrameRect__22wxGenericMDIChildFrameFv + ;wxGenericMDIChildFrame::wxGenericMDIChildFrame(wxGenericMDIParentFrame*,int,const wxString&,const wxPoint&,const wxSize&,long,const wxString&) + __ct__22wxGenericMDIChildFrameFP23wxGenericMDIParentFrameiRC8wxStringRC7wxPointRC6wxSizelT3 + ;wxGenericMDIClientWindow::sm_eventTableEntries + sm_eventTableEntries__24wxGenericMDIClientWindow + ;wxGenericMDIChildFrame::SetTitle(const wxString&) + SetTitle__22wxGenericMDIChildFrameFRC8wxString + ;wxGenericMDIParentFrame::Create(wxWindow*,int,const wxString&,const wxPoint&,const wxSize&,long,const wxString&) + Create__23wxGenericMDIParentFrameFP8wxWindowiRC8wxStringRC7wxPointRC6wxSizelT3 ;From object file: ..\generic\numdlgg.cpp ;PUBDEFs (Symbols available from object file): ;wxGetNumberFromUser(const wxString&,const wxString&,const wxString&,long,long,long,wxWindow*,const wxPoint&) @@ -13369,111 +13504,6 @@ EXPORTS ;From object file: ..\os2\main.cpp ;PUBDEFs (Symbols available from object file): main - ;From object file: ..\os2\mdi.cpp - ;PUBDEFs (Symbols available from object file): - ;wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent&) - OnSysColourChanged__16wxMDIParentFrameFR23wxSysColourChangedEvent - ;wxMDIClientWindow::GetEventTable() const - GetEventTable__17wxMDIClientWindowCFv - ;wxMDIChildFrame::~wxMDIChildFrame() - __dt__15wxMDIChildFrameFv - ;wxMDIParentFrame::ArrangeIcons() - ArrangeIcons__16wxMDIParentFrameFv - ;wxMDIParentFrame::ActivatePrevious() - ActivatePrevious__16wxMDIParentFrameFv - ;wxMDIClientWindow::sm_classwxMDIClientWindow - sm_classwxMDIClientWindow__17wxMDIClientWindow - ;wxMDIParentFrame::OnSize(wxSizeEvent&) - OnSize__16wxMDIParentFrameFR11wxSizeEvent - ;wxMDIChildFrame::Maximize(unsigned long) - Maximize__15wxMDIChildFrameFUl - ;wxMDIClientWindow::CreateClient(wxMDIParentFrame*,long) - CreateClient__17wxMDIClientWindowFP16wxMDIParentFramel - ;wxMDIChildFrame::DoSetClientSize(int,int) - DoSetClientSize__15wxMDIChildFrameFiT1 - ;wxMDIParentFrame::sm_classwxMDIParentFrame - sm_classwxMDIParentFrame__16wxMDIParentFrame - ;wxMDIParentFrame::GetEventTable() const - GetEventTable__16wxMDIParentFrameCFv - ;wxMDIParentFrame::~wxMDIParentFrame() - __dt__16wxMDIParentFrameFv - ;wxMDIParentFrame::Tile() - Tile__16wxMDIParentFrameFv - ;wxMDIChildFrame::Restore() - Restore__15wxMDIChildFrameFv - ;wxMDIParentFrame::OS2WindowProc(unsigned int,void*,void*) - OS2WindowProc__16wxMDIParentFrameFUiPvT2 - ;wxMDIParentFrame::OS2TranslateMessage(void**) - OS2TranslateMessage__16wxMDIParentFrameFPPv - ;wxMDIParentFrame::OS2DefWindowProc(unsigned int,void*,void*) - OS2DefWindowProc__16wxMDIParentFrameFUiPvT2 - ;wxMDIParentFrame::InternalSetMenuBar() - InternalSetMenuBar__16wxMDIParentFrameFv - ;wxMDIChildFrame::HandleWindowPosChanging(void*) - HandleWindowPosChanging__15wxMDIChildFrameFPv - ;wxMDIParentFrame::Cascade() - Cascade__16wxMDIParentFrameFv - ;wxMDIParentFrame::HandleCommand(unsigned short,unsigned short,unsigned long) - HandleCommand__16wxMDIParentFrameFUsT1Ul - ;wxMDIClientWindow::OnScroll(wxScrollEvent&) - OnScroll__17wxMDIClientWindowFR13wxScrollEvent - ;wxMDIChildFrame::HandleCommand(unsigned short,unsigned short,unsigned long) - HandleCommand__15wxMDIChildFrameFUsT1Ul - ;wxMDIChildFrame::sm_classwxMDIChildFrame - sm_classwxMDIChildFrame__15wxMDIChildFrame - ;wxMDIParentFrame::wxMDIParentFrame() - __ct__16wxMDIParentFrameFv - ;wxMDIChildFrame::OS2TranslateMessage(void**) - OS2TranslateMessage__15wxMDIChildFrameFPPv - ;wxMDIChildFrame::InternalSetMenuBar() - InternalSetMenuBar__15wxMDIChildFrameFv - ;wxMDIParentFrame::Create(wxWindow*,int,const wxString&,const wxPoint&,const wxSize&,long,const wxString&) - Create__16wxMDIParentFrameFP8wxWindowiRC8wxStringRC7wxPointRC6wxSizelT3 - __vft16wxMDIParentFrame8wxObject - ;wxMDIChildFrame::HandleSize(int,int,unsigned int) - HandleSize__15wxMDIChildFrameFiT1Ui - ;wxMDIParentFrame::sm_eventTable - sm_eventTable__16wxMDIParentFrame - ;wxMDIParentFrame::sm_eventTableEntries - sm_eventTableEntries__16wxMDIParentFrame - ;wxMDIParentFrame::GetActiveChild() const - GetActiveChild__16wxMDIParentFrameCFv - ;wxMDIParentFrame::OnCreateClient() - OnCreateClient__16wxMDIParentFrameFv - ;wxMDIChildFrame::OS2WindowProc(unsigned int,void*,void*) - OS2WindowProc__15wxMDIChildFrameFUiPvT2 - ;wxMDIChildFrame::OS2DestroyWindow() - OS2DestroyWindow__15wxMDIChildFrameFv - ;wxMDIParentFrame::HandleActivate(int,unsigned long,unsigned long) - HandleActivate__16wxMDIParentFrameFiUlT2 - ;wxMDIClientWindow::sm_eventTableEntries - sm_eventTableEntries__17wxMDIClientWindow - __vft15wxMDIChildFrame8wxObject - __vft17wxMDIClientWindow8wxObject - ;wxMDIChildFrame::DoGetPosition(int*,int*) const - DoGetPosition__15wxMDIChildFrameCFPiT1 - ;wxConstructorForwxMDIParentFrame() - wxConstructorForwxMDIParentFrame__Fv - ;wxConstructorForwxMDIClientWindow() - wxConstructorForwxMDIClientWindow__Fv - ;wxConstructorForwxMDIChildFrame() - wxConstructorForwxMDIChildFrame__Fv - ;wxMDIChildFrame::wxMDIChildFrame() - __ct__15wxMDIChildFrameFv - ;wxMDIChildFrame::ResetWindowStyle(void*) - ResetWindowStyle__15wxMDIChildFrameFPv - ;wxMDIChildFrame::OS2DefWindowProc(unsigned int,void*,void*) - OS2DefWindowProc__15wxMDIChildFrameFUiPvT2 - ;wxMDIChildFrame::HandleMDIActivate(long,unsigned long,unsigned long) - HandleMDIActivate__15wxMDIChildFrameFlUlT2 - ;wxMDIChildFrame::Activate() - Activate__15wxMDIChildFrameFv - ;wxMDIParentFrame::ActivateNext() - ActivateNext__16wxMDIParentFrameFv - ;wxMDIChildFrame::Create(wxMDIParentFrame*,int,const wxString&,const wxPoint&,const wxSize&,long,const wxString&) - Create__15wxMDIChildFrameFP16wxMDIParentFrameiRC8wxStringRC7wxPointRC6wxSizelT3 - ;wxMDIClientWindow::sm_eventTable - sm_eventTable__17wxMDIClientWindow ;From object file: ..\os2\menu.cpp ;PUBDEFs (Symbols available from object file): ;wxMenuBar::wxMenuBar(long) @@ -13665,12 +13695,6 @@ EXPORTS GetFileTypeFromMimeType__22wxMimeTypesManagerImplFRC8wxString ;wxFileTypeImpl::GetExtensions(wxArrayString&) GetExtensions__14wxFileTypeImplFR13wxArrayString - ;From object file: ..\os2\minifram.cpp - ;PUBDEFs (Symbols available from object file): - ;wxMiniFrame::sm_classwxMiniFrame - sm_classwxMiniFrame__11wxMiniFrame - ;wxConstructorForwxMiniFrame() - wxConstructorForwxMiniFrame__Fv ;From object file: ..\os2\msgdlg.cpp ;PUBDEFs (Symbols available from object file): ;wxMessageDialog::ShowModal() diff --git a/src/png/makefile.nt b/src/png/makefile.nt deleted file mode 100644 index ab823c8fc9..0000000000 --- a/src/png/makefile.nt +++ /dev/null @@ -1,68 +0,0 @@ -# -# File: makefile.nt -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds winpng.lib library for Windows 3.1 - -# Change WXDIR or WXWIN to wherever wxWindows is found -WXDIR = $(WXWIN) -WXLIB = $(WXDIR)\lib\wx.lib -WXINC = $(WXDIR)\include - -WINPNGDIR = ..\png -WINPNGINC = $(WINPNGDIR) -WINPNGLIB = ..\..\lib\winpng.lib - -INC = /I..\zlib - -FINAL=1 - -# Set this to nothing if your compiler is MS C++ 7 -ZOPTION= - -!ifndef FINAL -FINAL=0 -!endif - -PRECOMP=/YuWX.H - -!if "$(FINAL)" == "0" -OPT = /Od -CPPFLAGS= /W4 /Zi /MD /GX- $(ZOPTION) $(OPT) /Dwx_msw $(INC) # $(PRECOMP) /Fp$(WXDIR)\src\msw\wx.pch -CFLAGS= /W4 /Zi /MD /GX- /Od /Dwx_msw $(INC) -LINKFLAGS=/NOD /CO /ONERROR:NOEXE -!else -# /Ox for real FINAL version -OPT = /O2 -CPPFLAGS= /W4 /MD /GX- /Dwx_msw $(INC) # $(PRECOMP) /Fp$(WXDIR)\src\msw\wx.pch -CFLAGS= /W4 /MD /GX- /Dwx_msw $(INC) -LINKFLAGS=/NOD /ONERROR:NOEXE -!endif - -OBJECTS = png.obj pngread.obj pngrtran.obj pngrutil.obj \ - pngpread.obj pngtrans.obj pngwrite.obj pngwtran.obj pngwutil.obj \ - pngerror.obj pngmem.obj pngwio.obj pngrio.obj pngget.obj pngset.obj - -all: $(WINPNGLIB) - -$(WINPNGLIB): $(OBJECTS) - erase $(WINPNGLIB) - lib @<< --out:$(WINPNGLIB) -$(OBJECTS) -<< - -.c.obj: - cl -DWIN32 $(OPT) $(CFLAGS) /c $*.c - -clean: - erase *.obj - erase *.exe - erase *.lib - -cleanall: clean diff --git a/src/regex/COPYRIGHT b/src/regex/COPYRIGHT index 65aaadd6cf..30c1f7a488 100644 --- a/src/regex/COPYRIGHT +++ b/src/regex/COPYRIGHT @@ -1,166 +1,20 @@ -This regular expression package was originally developed by Henry Spencer. -It bears the following copyright notice: +Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved. +This software is not subject to any license of the American Telephone +and Telegraph Company or of the Regents of the University of California. -********************************************************************** +Permission is granted to anyone to use this software for any purpose on +any computer system, and to alter it and redistribute it, subject +to the following restrictions: -Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. +1. The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from flaws in it. -Development of this software was funded, in part, by Cray Research Inc., -UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics -Corporation, none of whom are responsible for the results. The author -thanks all of them. +2. The origin of this software must not be misrepresented, either by + explicit claim or by omission. Since few users ever read sources, + credits must appear in the documentation. -Redistribution and use in source and binary forms -- with or without -modification -- are permitted for any purpose, provided that -redistributions in source form retain this entire copyright notice and -indicate the origin and nature of any modifications. - -I'd appreciate being given credit for this package in the documentation -of software which uses it, but that is not a requirement. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -********************************************************************** - -PostgreSQL adopted the code out of Tcl 8.4.1. Portions of regc_locale.c -and re_syntax.n were developed by Tcl developers other than Henry; these -files bear the Tcl copyright and license notice: - -********************************************************************** - -This software is copyrighted by the Regents of the University of -California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState -Corporation and other parties. The following terms apply to all files -associated with the software unless explicitly disclaimed in -individual files. - -The authors hereby grant permission to use, copy, modify, distribute, -and license this software and its documentation for any purpose, provided -that existing copyright notices are retained in all copies and that this -notice is included verbatim in any distributions. No written agreement, -license, or royalty fee is required for any of the authorized uses. -Modifications to this software may be copyrighted by their authors -and need not follow the licensing terms described here, provided that -the new terms are clearly indicated on the first page of each file where -they apply. - -IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY -FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY -DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE -IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE -NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR -MODIFICATIONS. - -GOVERNMENT USE: If you are acquiring this software on behalf of the -U.S. government, the Government shall have only "Restricted Rights" -in the software and related documentation as defined in the Federal -Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you -are acquiring the software on behalf of the Department of Defense, the -software shall be classified as "Commercial Computer Software" and the -Government shall have only "Restricted Rights" as defined in Clause -252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the -authors grant the U.S. Government and others acting in its behalf -permission to use and distribute the software in accordance with the -terms specified in this license. - -********************************************************************** - -Subsequent modifications to the code by the PostgreSQL project follow -the same license terms as the rest of PostgreSQL. -(License follows) -**************************************************************************** -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose, without fee, and without a written agreement -is hereby granted, provided that the above copyright notice and this -paragraph and the following two paragraphs appear in all copies. - -IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING -LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS -DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -**************************************************************************** -And if that's not enough, changes made from wxWindows are put under the -wxWindows license: -**************************************************************************** - wxWindows Library Licence, Version 3 - ==================================== - - Copyright (C) 1998 Julian Smart, Robert Roebling [, ...] - - Everyone is permitted to copy and distribute verbatim copies - of this licence document, but changing it is not allowed. - - WXWINDOWS LIBRARY LICENCE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public Licence as published by - the Free Software Foundation; either version 2 of the Licence, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library - General Public Licence for more details. - - You should have received a copy of the GNU Library General Public Licence - along with this software, usually in a file named COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA. - - EXCEPTION NOTICE - - 1. As a special exception, the copyright holders of this library give - permission for additional uses of the text contained in this release of - the library as licenced under the wxWindows Library Licence, applying - either version 3 of the Licence, or (at your option) any later version of - the Licence as published by the copyright holders of version 3 of the - Licence document. - - 2. The exception is that you may use, copy, link, modify and distribute - under the user's own terms, binary object code versions of works based - on the Library. - - 3. If you copy code from files distributed under the terms of the GNU - General Public Licence or the GNU Library General Public Licence into a - copy of this library, as this licence permits, the exception does not - apply to the code that you add in this way. To avoid misleading anyone as - to the status of such modified files, you must delete this exception - notice from such code and/or adjust the licensing conditions notice - accordingly. - - 4. If you write modifications of your own for this library, it is your - choice whether to permit this exception to apply to your modifications. - If you do not wish that, you must delete the exception notice from such - code and/or adjust the licensing conditions notice accordingly. -**************************************************************************** +3. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. Since few users + ever read sources, credits must appear in the documentation. +4. This notice may not be removed or altered. diff --git a/src/regex/Makefile b/src/regex/Makefile index cb76d37ea7..ce20561fa9 100644 --- a/src/regex/Makefile +++ b/src/regex/Makefile @@ -1,28 +1,130 @@ -#------------------------------------------------------------------------- -# -# Makefile-- -# Makefile for backend/regex -# -# IDENTIFICATION -# $Header: /projects/cvsroot/pgsql-server/src/backend/regex/Makefile,v 1.20 2003/02/05 17:41:32 tgl Exp $ -# -#------------------------------------------------------------------------- +# You probably want to take -DREDEBUG out of CFLAGS, and put something like +# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of +# internal assertion checking and some debugging facilities). +# Put -Dconst= in for a pre-ANSI compiler. +# Do not take -DPOSIX_MISTAKE out. +# REGCFLAGS isn't important to you (it's for my use in some special contexts). +CFLAGS=-I. -DPOSIX_MISTAKE -DREDEBUG $(REGCFLAGS) -subdir = src/backend/regex -top_builddir = ../../.. -include $(top_builddir)/src/Makefile.global +# If you have a pre-ANSI compiler, put -o into MKHFLAGS. If you want +# the Berkeley __P macro, put -b in. +MKHFLAGS= -OBJS = regcomp.o regerror.o regexec.o regfree.o +# Flags for linking but not compiling, if any. +LDFLAGS= -all: SUBSYS.o +# Extra libraries for linking, if any. +LIBS= -SUBSYS.o: $(OBJS) - $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS) +# Internal stuff, should not need changing. +OBJPRODN=regcomp.o regexec.o regerror.o regfree.o +OBJS=$(OBJPRODN) split.o debug.o re_main.o +H=cclass.h cname.h regex2.h utils.h +REGSRC=regcomp.c regerror.c regexec.c regfree.c +ALLSRC=$(REGSRC) engine.c debug.c re_main.c split.c -# mark inclusion dependencies between .c files explicitly -regcomp.o: regcomp.c regc_lex.c regc_color.c regc_nfa.c regc_cvec.c regc_locale.c +# Stuff that matters only if you're trying to lint the package. +LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG +LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c re_main.c +JUNKLINT=possible pointer alignment|null effect -regexec.o: regexec.c rege_dfa.c +# arrangements to build forward-reference header files +.SUFFIXES: .ih .h +.c.ih: + sh ./mkh $(MKHFLAGS) -p $< >$@ -clean: - rm -f SUBSYS.o $(OBJS) +default: r + +lib: purge $(OBJPRODN) + rm -f libregex.a + ar crv libregex.a $(OBJPRODN) + +purge: + rm -f *.o + +# stuff to build regex.h +REGEXH=regex.h +REGEXHSRC=regex2.h $(REGSRC) +$(REGEXH): $(REGEXHSRC) mkh + sh ./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.tmp + cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h + rm -f regex.tmp + +# dependencies +$(OBJPRODN) debug.o: utils.h regex.h regex2.h +regcomp.o: cclass.h cname.h regcomp.ih +regexec.o: engine.c engine.ih +regerror.o: regerror.ih +debug.o: debug.ih +re_main.o: re_main.ih + +# tester +re: $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ + +# regression test +r: re tests + ./re &1 | egrep -v '$(JUNKLINT)' | tee lint + +fullprint: + ti README WHATSNEW notes todo | list + ti *.h | list + list *.c + list regex.3 regex.7 + +print: + ti README WHATSNEW notes todo | list + ti *.h | list + list reg*.c engine.c + + +mf.tmp: Makefile + sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@ + +DTRH=cclass.h cname.h regex2.h utils.h +PRE=COPYRIGHT README WHATSNEW +POST=mkh regex.3 regex.7 tests $(DTRH) $(ALLSRC) fake/*.[ch] +FILES=$(PRE) Makefile $(POST) +DTR=$(PRE) Makefile=mf.tmp $(POST) +dtr: $(FILES) mf.tmp + makedtr $(DTR) >$@ + rm mf.tmp + +cio: $(FILES) + cio $(FILES) + +rdf: $(FILES) + rcsdiff -c $(FILES) 2>&1 | p + +# various forms of cleanup +tidy: + rm -f junk* core core.* *.core dtr *.tmp lint + +clean: tidy + rm -f *.o *.s *.ih re libregex.a + +# don't do this one unless you know what you're doing +spotless: clean + rm -f mkh regex.h diff --git a/src/regex/cclass.h b/src/regex/cclass.h new file mode 100644 index 0000000000..2b50a76197 --- /dev/null +++ b/src/regex/cclass.h @@ -0,0 +1,20 @@ +/* character-class table */ +static struct cclass { + char *name; + char *chars; + char *multis; +} cclasses[] = { + { "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "" }, + { "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "" }, + { "blank", " \t", "" }, + { "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177", "" }, + { "digit", "0123456789", "" }, + { "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" }, + { "lower", "abcdefghijklmnopqrstuvwxyz", "" }, + { "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", "" }, + { "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" }, + { "space", "\t\n\v\f\r ", "" }, + { "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "" }, + { "xdigit", "0123456789ABCDEFabcdef", "" }, + { NULL, 0, "" } +}; diff --git a/src/regex/cname.h b/src/regex/cname.h new file mode 100644 index 0000000000..c1a6dd5656 --- /dev/null +++ b/src/regex/cname.h @@ -0,0 +1,102 @@ +/* character-name table */ +static struct cname { + char *name; + char code; +} cnames[] = { + { "NUL", '\0' }, + { "SOH", '\001' }, + { "STX", '\002' }, + { "ETX", '\003' }, + { "EOT", '\004' }, + { "ENQ", '\005' }, + { "ACK", '\006' }, + { "BEL", '\007' }, + { "alert", '\007' }, + { "BS", '\010' }, + { "backspace", '\b' }, + { "HT", '\011' }, + { "tab", '\t' }, + { "LF", '\012' }, + { "newline", '\n' }, + { "VT", '\013' }, + { "vertical-tab", '\v' }, + { "FF", '\014' }, + { "form-feed", '\f' }, + { "CR", '\015' }, + { "carriage-return", '\r' }, + { "SO", '\016' }, + { "SI", '\017' }, + { "DLE", '\020' }, + { "DC1", '\021' }, + { "DC2", '\022' }, + { "DC3", '\023' }, + { "DC4", '\024' }, + { "NAK", '\025' }, + { "SYN", '\026' }, + { "ETB", '\027' }, + { "CAN", '\030' }, + { "EM", '\031' }, + { "SUB", '\032' }, + { "ESC", '\033' }, + { "IS4", '\034' }, + { "FS", '\034' }, + { "IS3", '\035' }, + { "GS", '\035' }, + { "IS2", '\036' }, + { "RS", '\036' }, + { "IS1", '\037' }, + { "US", '\037' }, + { "space", ' ' }, + { "exclamation-mark", '!' }, + { "quotation-mark", '"' }, + { "number-sign", '#' }, + { "dollar-sign", '$' }, + { "percent-sign", '%' }, + { "ampersand", '&' }, + { "apostrophe", '\'' }, + { "left-parenthesis", '(' }, + { "right-parenthesis", ')' }, + { "asterisk", '*' }, + { "plus-sign", '+' }, + { "comma", ',' }, + { "hyphen", '-' }, + { "hyphen-minus", '-' }, + { "period", '.' }, + { "full-stop", '.' }, + { "slash", '/' }, + { "solidus", '/' }, + { "zero", '0' }, + { "one", '1' }, + { "two", '2' }, + { "three", '3' }, + { "four", '4' }, + { "five", '5' }, + { "six", '6' }, + { "seven", '7' }, + { "eight", '8' }, + { "nine", '9' }, + { "colon", ':' }, + { "semicolon", ';' }, + { "less-than-sign", '<' }, + { "equals-sign", '=' }, + { "greater-than-sign", '>' }, + { "question-mark", '?' }, + { "commercial-at", '@' }, + { "left-square-bracket", '[' }, + { "backslash", '\\' }, + { "reverse-solidus", '\\' }, + { "right-square-bracket", ']' }, + { "circumflex", '^' }, + { "circumflex-accent", '^' }, + { "underscore", '_' }, + { "low-line", '_' }, + { "grave-accent", '`' }, + { "left-brace", '{' }, + { "left-curly-bracket", '{' }, + { "vertical-line", '|' }, + { "right-brace", '}' }, + { "right-curly-bracket", '}' }, + { "tilde", '~' }, + { "DEL", '\177' }, + { NULL, 0 }, +}; diff --git a/src/regex/debug.c b/src/regex/debug.c new file mode 100644 index 0000000000..bf40bbb3bd --- /dev/null +++ b/src/regex/debug.c @@ -0,0 +1,242 @@ +#include +#include +#include +#include +#include +#include +#include "regex.h" + +#include "utils.h" +#include "regex2.h" +#include "debug.ih" + +/* + - regprint - print a regexp for debugging + == void regprint(regex_t *r, FILE *d); + */ +void +regprint(r, d) +regex_t *r; +FILE *d; +{ + register struct re_guts *g = r->re_g; + register int i; + register int c; + register int last; + int nincat[NC]; + + fprintf(d, "%ld states, %d categories", (long)g->nstates, + g->ncategories); + fprintf(d, ", first %ld last %ld", (long)g->firststate, + (long)g->laststate); + if (g->iflags&USEBOL) + fprintf(d, ", USEBOL"); + if (g->iflags&USEEOL) + fprintf(d, ", USEEOL"); + if (g->iflags&BAD) + fprintf(d, ", BAD"); + if (g->nsub > 0) + fprintf(d, ", nsub=%ld", (long)g->nsub); + if (g->must != NULL) + fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen, + g->must); + if (g->backrefs) + fprintf(d, ", backrefs"); + if (g->nplus > 0) + fprintf(d, ", nplus %ld", (long)g->nplus); + fprintf(d, "\n"); + s_print(g, d); + for (i = 0; i < g->ncategories; i++) { + nincat[i] = 0; + for (c = CHAR_MIN; c <= CHAR_MAX; c++) + if (g->categories[c] == i) + nincat[i]++; + } + fprintf(d, "cc0#%d", nincat[0]); + for (i = 1; i < g->ncategories; i++) + if (nincat[i] == 1) { + for (c = CHAR_MIN; c <= CHAR_MAX; c++) + if (g->categories[c] == i) + break; + fprintf(d, ", %d=%s", i, regchar(c)); + } + fprintf(d, "\n"); + for (i = 1; i < g->ncategories; i++) + if (nincat[i] != 1) { + fprintf(d, "cc%d\t", i); + last = -1; + for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */ + if (c <= CHAR_MAX && g->categories[c] == i) { + if (last < 0) { + fprintf(d, "%s", regchar(c)); + last = c; + } + } else { + if (last >= 0) { + if (last != c-1) + fprintf(d, "-%s", + regchar(c-1)); + last = -1; + } + } + fprintf(d, "\n"); + } +} + +/* + - s_print - print the strip for debugging + == static void s_print(register struct re_guts *g, FILE *d); + */ +static void +s_print(g, d) +register struct re_guts *g; +FILE *d; +{ + register sop *s; + register cset *cs; + register int i; + register int done = 0; + register sop opnd; + register int col = 0; + register int last; + register sopno offset = 2; +# define GAP() { if (offset % 5 == 0) { \ + if (col > 40) { \ + fprintf(d, "\n\t"); \ + col = 0; \ + } else { \ + fprintf(d, " "); \ + col++; \ + } \ + } else \ + col++; \ + offset++; \ + } + + if (OP(g->strip[0]) != OEND) + fprintf(d, "missing initial OEND!\n"); + for (s = &g->strip[1]; !done; s++) { + opnd = OPND(*s); + switch (OP(*s)) { + case OEND: + fprintf(d, "\n"); + done = 1; + break; + case OCHAR: + if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL) + fprintf(d, "\\%c", (char)opnd); + else + fprintf(d, "%s", regchar((char)opnd)); + break; + case OBOL: + fprintf(d, "^"); + break; + case OEOL: + fprintf(d, "$"); + break; + case OBOW: + fprintf(d, "\\{"); + break; + case OEOW: + fprintf(d, "\\}"); + break; + case OANY: + fprintf(d, "."); + break; + case OANYOF: + fprintf(d, "[(%ld)", (long)opnd); + cs = &g->sets[opnd]; + last = -1; + for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */ + if (CHIN(cs, i) && i < g->csetsize) { + if (last < 0) { + fprintf(d, "%s", regchar(i)); + last = i; + } + } else { + if (last >= 0) { + if (last != i-1) + fprintf(d, "-%s", + regchar(i-1)); + last = -1; + } + } + fprintf(d, "]"); + break; + case OBACK_: + fprintf(d, "(\\<%ld>", (long)opnd); + break; + case O_BACK: + fprintf(d, "<%ld>\\)", (long)opnd); + break; + case OPLUS_: + fprintf(d, "(+"); + if (OP(*(s+opnd)) != O_PLUS) + fprintf(d, "<%ld>", (long)opnd); + break; + case O_PLUS: + if (OP(*(s-opnd)) != OPLUS_) + fprintf(d, "<%ld>", (long)opnd); + fprintf(d, "+)"); + break; + case OQUEST_: + fprintf(d, "(?"); + if (OP(*(s+opnd)) != O_QUEST) + fprintf(d, "<%ld>", (long)opnd); + break; + case O_QUEST: + if (OP(*(s-opnd)) != OQUEST_) + fprintf(d, "<%ld>", (long)opnd); + fprintf(d, "?)"); + break; + case OLPAREN: + fprintf(d, "((<%ld>", (long)opnd); + break; + case ORPAREN: + fprintf(d, "<%ld>))", (long)opnd); + break; + case OCH_: + fprintf(d, "<"); + if (OP(*(s+opnd)) != OOR2) + fprintf(d, "<%ld>", (long)opnd); + break; + case OOR1: + if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_) + fprintf(d, "<%ld>", (long)opnd); + fprintf(d, "|"); + break; + case OOR2: + fprintf(d, "|"); + if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH) + fprintf(d, "<%ld>", (long)opnd); + break; + case O_CH: + if (OP(*(s-opnd)) != OOR1) + fprintf(d, "<%ld>", (long)opnd); + fprintf(d, ">"); + break; + default: + fprintf(d, "!%d(%d)!", OP(*s), opnd); + break; + } + if (!done) + GAP(); + } +} + +/* + - regchar - make a character printable + == static char *regchar(int ch); + */ +static char * /* -> representation */ +regchar(ch) +int ch; +{ + static char buf[10]; + + if (isprint(ch) || ch == ' ') + sprintf(buf, "%c", ch); + else + sprintf(buf, "\\%o", ch); + return(buf); +} diff --git a/src/regex/engine.c b/src/regex/engine.c new file mode 100644 index 0000000000..0b88dcf1ed --- /dev/null +++ b/src/regex/engine.c @@ -0,0 +1,1019 @@ +/* + * The matching engine and friends. This file is #included by regexec.c + * after suitable #defines of a variety of macros used herein, so that + * different state representations can be used without duplicating masses + * of code. + */ + +#ifdef SNAMES +#define matcher smatcher +#define fast sfast +#define slow sslow +#define dissect sdissect +#define backref sbackref +#define step sstep +#define print sprint +#define at sat +#define match smat +#endif +#ifdef LNAMES +#define matcher lmatcher +#define fast lfast +#define slow lslow +#define dissect ldissect +#define backref lbackref +#define step lstep +#define print lprint +#define at lat +#define match lmat +#endif + +/* another structure passed up and down to avoid zillions of parameters */ +struct match { + struct re_guts *g; + int eflags; + regmatch_t *pmatch; /* [nsub+1] (0 element unused) */ + char *offp; /* offsets work from here */ + char *beginp; /* start of string -- virtual NUL precedes */ + char *endp; /* end of string -- virtual NUL here */ + char *coldp; /* can be no match starting before here */ + char **lastpos; /* [nplus+1] */ + STATEVARS; + states st; /* current states */ + states fresh; /* states for a fresh start */ + states tmp; /* temporary */ + states empty; /* empty set of states */ +}; + +#include "engine.ih" + +#ifdef REDEBUG +#define SP(t, s, c) print(m, t, s, c, stdout) +#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2) +#define NOTE(str) { if (m->eflags®_TRACE) printf("=%s\n", (str)); } +#else +#define SP(t, s, c) /* nothing */ +#define AT(t, p1, p2, s1, s2) /* nothing */ +#define NOTE(s) /* nothing */ +#endif + +/* + - matcher - the actual matching engine + == static int matcher(register struct re_guts *g, char *string, \ + == size_t nmatch, regmatch_t pmatch[], int eflags); + */ +static int /* 0 success, REG_NOMATCH failure */ +matcher(g, string, nmatch, pmatch, eflags) +register struct re_guts *g; +char *string; +size_t nmatch; +regmatch_t pmatch[]; +int eflags; +{ + register char *endp; + register size_t i; + struct match mv; + register struct match *m = &mv; + register char *dp; + const register sopno gf = g->firststate+1; /* +1 for OEND */ + const register sopno gl = g->laststate; + char *start; + char *stop; + + /* simplify the situation where possible */ + if (g->cflags®_NOSUB) + nmatch = 0; + if (eflags®_STARTEND) { + start = string + pmatch[0].rm_so; + stop = string + pmatch[0].rm_eo; + } else { + start = string; + stop = start + strlen(start); + } + if (stop < start) + return(REG_INVARG); + + /* prescreening; this does wonders for this rather slow code */ + if (g->must != NULL) { + for (dp = start; dp < stop; dp++) + if (*dp == g->must[0] && stop - dp >= g->mlen && + memcmp(dp, g->must, (size_t)g->mlen) == 0) + break; + if (dp == stop) /* we didn't find g->must */ + return(REG_NOMATCH); + } + + /* match struct setup */ + m->g = g; + m->eflags = eflags; + m->pmatch = NULL; + m->lastpos = NULL; + m->offp = string; + m->beginp = start; + m->endp = stop; + STATESETUP(m, 4); + SETUP(m->st); + SETUP(m->fresh); + SETUP(m->tmp); + SETUP(m->empty); + CLEAR(m->empty); + + /* this loop does only one repetition except for backrefs */ + for (;;) { + endp = fast(m, start, stop, gf, gl); + if (endp == NULL) { /* a miss */ + STATETEARDOWN(m); + return(REG_NOMATCH); + } + if (nmatch == 0 && !g->backrefs) + break; /* no further info needed */ + + /* where? */ + assert(m->coldp != NULL); + for (;;) { + NOTE("finding start"); + endp = slow(m, m->coldp, stop, gf, gl); + if (endp != NULL) + break; + assert(m->coldp < m->endp); + m->coldp++; + } + if (nmatch == 1 && !g->backrefs) + break; /* no further info needed */ + + /* oh my, he wants the subexpressions... */ + if (m->pmatch == NULL) + m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) * + sizeof(regmatch_t)); + if (m->pmatch == NULL) { + STATETEARDOWN(m); + return(REG_ESPACE); + } + for (i = 1; i <= m->g->nsub; i++) + m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1; + if (!g->backrefs && !(m->eflags®_BACKR)) { + NOTE("dissecting"); + dp = dissect(m, m->coldp, endp, gf, gl); + } else { + if (g->nplus > 0 && m->lastpos == NULL) + m->lastpos = (char **)malloc((g->nplus+1) * + sizeof(char *)); + if (g->nplus > 0 && m->lastpos == NULL) { + free(m->pmatch); + STATETEARDOWN(m); + return(REG_ESPACE); + } + NOTE("backref dissect"); + dp = backref(m, m->coldp, endp, gf, gl, (sopno)0); + } + if (dp != NULL) + break; + + /* uh-oh... we couldn't find a subexpression-level match */ + assert(g->backrefs); /* must be back references doing it */ + assert(g->nplus == 0 || m->lastpos != NULL); + for (;;) { + if (dp != NULL || endp <= m->coldp) + break; /* defeat */ + NOTE("backoff"); + endp = slow(m, m->coldp, endp-1, gf, gl); + if (endp == NULL) + break; /* defeat */ + /* try it on a shorter possibility */ +#ifndef NDEBUG + for (i = 1; i <= m->g->nsub; i++) { + assert(m->pmatch[i].rm_so == -1); + assert(m->pmatch[i].rm_eo == -1); + } +#endif + NOTE("backoff dissect"); + dp = backref(m, m->coldp, endp, gf, gl, (sopno)0); + } + assert(dp == NULL || dp == endp); + if (dp != NULL) /* found a shorter one */ + break; + + /* despite initial appearances, there is no match here */ + NOTE("false alarm"); + start = m->coldp + 1; /* recycle starting later */ + assert(start <= stop); + } + + /* fill in the details if requested */ + if (nmatch > 0) { + pmatch[0].rm_so = m->coldp - m->offp; + pmatch[0].rm_eo = endp - m->offp; + } + if (nmatch > 1) { + assert(m->pmatch != NULL); + for (i = 1; i < nmatch; i++) + if (i <= m->g->nsub) + pmatch[i] = m->pmatch[i]; + else { + pmatch[i].rm_so = -1; + pmatch[i].rm_eo = -1; + } + } + + if (m->pmatch != NULL) + free((char *)m->pmatch); + if (m->lastpos != NULL) + free((char *)m->lastpos); + STATETEARDOWN(m); + return(0); +} + +/* + - dissect - figure out what matched what, no back references + == static char *dissect(register struct match *m, char *start, \ + == char *stop, sopno startst, sopno stopst); + */ +static char * /* == stop (success) always */ +dissect(m, start, stop, startst, stopst) +register struct match *m; +char *start; +char *stop; +sopno startst; +sopno stopst; +{ + register int i; + register sopno ss; /* start sop of current subRE */ + register sopno es; /* end sop of current subRE */ + register char *sp; /* start of string matched by it */ + register char *stp; /* string matched by it cannot pass here */ + register char *rest; /* start of rest of string */ + register char *tail; /* string unmatched by rest of RE */ + register sopno ssub; /* start sop of subsubRE */ + register sopno esub; /* end sop of subsubRE */ + register char *ssp; /* start of string matched by subsubRE */ + register char *sep; /* end of string matched by subsubRE */ + register char *oldssp; /* previous ssp */ + register char *dp; + + AT("diss", start, stop, startst, stopst); + sp = start; + for (ss = startst; ss < stopst; ss = es) { + /* identify end of subRE */ + es = ss; + switch (OP(m->g->strip[es])) { + case OPLUS_: + case OQUEST_: + es += OPND(m->g->strip[es]); + break; + case OCH_: + while (OP(m->g->strip[es]) != O_CH) + es += OPND(m->g->strip[es]); + break; + } + es++; + + /* figure out what it matched */ + switch (OP(m->g->strip[ss])) { + case OEND: + assert(nope); + break; + case OCHAR: + sp++; + break; + case OBOL: + case OEOL: + case OBOW: + case OEOW: + break; + case OANY: + case OANYOF: + sp++; + break; + case OBACK_: + case O_BACK: + assert(nope); + break; + /* cases where length of match is hard to find */ + case OQUEST_: + stp = stop; + for (;;) { + /* how long could this one be? */ + rest = slow(m, sp, stp, ss, es); + assert(rest != NULL); /* it did match */ + /* could the rest match the rest? */ + tail = slow(m, rest, stop, es, stopst); + if (tail == stop) + break; /* yes! */ + /* no -- try a shorter match for this one */ + stp = rest - 1; + assert(stp >= sp); /* it did work */ + } + ssub = ss + 1; + esub = es - 1; + /* did innards match? */ + if (slow(m, sp, rest, ssub, esub) != NULL) { + dp = dissect(m, sp, rest, ssub, esub); + assert(dp == rest); + } else /* no */ + assert(sp == rest); + sp = rest; + break; + case OPLUS_: + stp = stop; + for (;;) { + /* how long could this one be? */ + rest = slow(m, sp, stp, ss, es); + assert(rest != NULL); /* it did match */ + /* could the rest match the rest? */ + tail = slow(m, rest, stop, es, stopst); + if (tail == stop) + break; /* yes! */ + /* no -- try a shorter match for this one */ + stp = rest - 1; + assert(stp >= sp); /* it did work */ + } + ssub = ss + 1; + esub = es - 1; + ssp = sp; + oldssp = ssp; + for (;;) { /* find last match of innards */ + sep = slow(m, ssp, rest, ssub, esub); + if (sep == NULL || sep == ssp) + break; /* failed or matched null */ + oldssp = ssp; /* on to next try */ + ssp = sep; + } + if (sep == NULL) { + /* last successful match */ + sep = ssp; + ssp = oldssp; + } + assert(sep == rest); /* must exhaust substring */ + assert(slow(m, ssp, sep, ssub, esub) == rest); + dp = dissect(m, ssp, sep, ssub, esub); + assert(dp == sep); + sp = rest; + break; + case OCH_: + stp = stop; + for (;;) { + /* how long could this one be? */ + rest = slow(m, sp, stp, ss, es); + assert(rest != NULL); /* it did match */ + /* could the rest match the rest? */ + tail = slow(m, rest, stop, es, stopst); + if (tail == stop) + break; /* yes! */ + /* no -- try a shorter match for this one */ + stp = rest - 1; + assert(stp >= sp); /* it did work */ + } + ssub = ss + 1; + esub = ss + OPND(m->g->strip[ss]) - 1; + assert(OP(m->g->strip[esub]) == OOR1); + for (;;) { /* find first matching branch */ + if (slow(m, sp, rest, ssub, esub) == rest) + break; /* it matched all of it */ + /* that one missed, try next one */ + assert(OP(m->g->strip[esub]) == OOR1); + esub++; + assert(OP(m->g->strip[esub]) == OOR2); + ssub = esub + 1; + esub += OPND(m->g->strip[esub]); + if (OP(m->g->strip[esub]) == OOR2) + esub--; + else + assert(OP(m->g->strip[esub]) == O_CH); + } + dp = dissect(m, sp, rest, ssub, esub); + assert(dp == rest); + sp = rest; + break; + case O_PLUS: + case O_QUEST: + case OOR1: + case OOR2: + case O_CH: + assert(nope); + break; + case OLPAREN: + i = OPND(m->g->strip[ss]); + assert(0 < i && i <= m->g->nsub); + m->pmatch[i].rm_so = sp - m->offp; + break; + case ORPAREN: + i = OPND(m->g->strip[ss]); + assert(0 < i && i <= m->g->nsub); + m->pmatch[i].rm_eo = sp - m->offp; + break; + default: /* uh oh */ + assert(nope); + break; + } + } + + assert(sp == stop); + return(sp); +} + +/* + - backref - figure out what matched what, figuring in back references + == static char *backref(register struct match *m, char *start, \ + == char *stop, sopno startst, sopno stopst, sopno lev); + */ +static char * /* == stop (success) or NULL (failure) */ +backref(m, start, stop, startst, stopst, lev) +register struct match *m; +char *start; +char *stop; +sopno startst; +sopno stopst; +sopno lev; /* PLUS nesting level */ +{ + register int i; + register sopno ss; /* start sop of current subRE */ + register char *sp; /* start of string matched by it */ + register sopno ssub; /* start sop of subsubRE */ + register sopno esub; /* end sop of subsubRE */ + register char *ssp; /* start of string matched by subsubRE */ + register char *dp; + register size_t len; + register int hard; + register sop s; + register regoff_t offsave; + register cset *cs; + + AT("back", start, stop, startst, stopst); + sp = start; + + /* get as far as we can with easy stuff */ + hard = 0; + for (ss = startst; !hard && ss < stopst; ss++) + switch (OP(s = m->g->strip[ss])) { + case OCHAR: + if (sp == stop || *sp++ != (char)OPND(s)) + return(NULL); + break; + case OANY: + if (sp == stop) + return(NULL); + sp++; + break; + case OANYOF: + cs = &m->g->sets[OPND(s)]; + if (sp == stop || !CHIN(cs, *sp++)) + return(NULL); + break; + case OBOL: + if ( (sp == m->beginp && !(m->eflags®_NOTBOL)) || + (sp < m->endp && *(sp-1) == '\n' && + (m->g->cflags®_NEWLINE)) ) + { /* yes */ } + else + return(NULL); + break; + case OEOL: + if ( (sp == m->endp && !(m->eflags®_NOTEOL)) || + (sp < m->endp && *sp == '\n' && + (m->g->cflags®_NEWLINE)) ) + { /* yes */ } + else + return(NULL); + break; + case OBOW: + if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) || + (sp < m->endp && *(sp-1) == '\n' && + (m->g->cflags®_NEWLINE)) || + (sp > m->beginp && + !ISWORD(*(sp-1))) ) && + (sp < m->endp && ISWORD(*sp)) ) + { /* yes */ } + else + return(NULL); + break; + case OEOW: + if (( (sp == m->endp && !(m->eflags®_NOTEOL)) || + (sp < m->endp && *sp == '\n' && + (m->g->cflags®_NEWLINE)) || + (sp < m->endp && !ISWORD(*sp)) ) && + (sp > m->beginp && ISWORD(*(sp-1))) ) + { /* yes */ } + else + return(NULL); + break; + case O_QUEST: + break; + case OOR1: /* matches null but needs to skip */ + ss++; + s = m->g->strip[ss]; + do { + assert(OP(s) == OOR2); + ss += OPND(s); + } while (OP(s = m->g->strip[ss]) != O_CH); + /* note that the ss++ gets us past the O_CH */ + break; + default: /* have to make a choice */ + hard = 1; + break; + } + if (!hard) { /* that was it! */ + if (sp != stop) + return(NULL); + return(sp); + } + ss--; /* adjust for the for's final increment */ + + /* the hard stuff */ + AT("hard", sp, stop, ss, stopst); + s = m->g->strip[ss]; + switch (OP(s)) { + case OBACK_: /* the vilest depths */ + i = OPND(s); + assert(0 < i && i <= m->g->nsub); + if (m->pmatch[i].rm_eo == -1) + return(NULL); + assert(m->pmatch[i].rm_so != -1); + len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so; + assert(stop - m->beginp >= len); + if (sp > stop - len) + return(NULL); /* not enough left to match */ + ssp = m->offp + m->pmatch[i].rm_so; + if (memcmp(sp, ssp, len) != 0) + return(NULL); + while (m->g->strip[ss] != SOP(O_BACK, i)) + ss++; + return(backref(m, sp+len, stop, ss+1, stopst, lev)); + break; + case OQUEST_: /* to null or not */ + dp = backref(m, sp, stop, ss+1, stopst, lev); + if (dp != NULL) + return(dp); /* not */ + return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev)); + break; + case OPLUS_: + assert(m->lastpos != NULL); + assert(lev+1 <= m->g->nplus); + m->lastpos[lev+1] = sp; + return(backref(m, sp, stop, ss+1, stopst, lev+1)); + break; + case O_PLUS: + if (sp == m->lastpos[lev]) /* last pass matched null */ + return(backref(m, sp, stop, ss+1, stopst, lev-1)); + /* try another pass */ + m->lastpos[lev] = sp; + dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev); + if (dp == NULL) + return(backref(m, sp, stop, ss+1, stopst, lev-1)); + else + return(dp); + break; + case OCH_: /* find the right one, if any */ + ssub = ss + 1; + esub = ss + OPND(s) - 1; + assert(OP(m->g->strip[esub]) == OOR1); + for (;;) { /* find first matching branch */ + dp = backref(m, sp, stop, ssub, esub, lev); + if (dp != NULL) + return(dp); + /* that one missed, try next one */ + if (OP(m->g->strip[esub]) == O_CH) + return(NULL); /* there is none */ + esub++; + assert(OP(m->g->strip[esub]) == OOR2); + ssub = esub + 1; + esub += OPND(m->g->strip[esub]); + if (OP(m->g->strip[esub]) == OOR2) + esub--; + else + assert(OP(m->g->strip[esub]) == O_CH); + } + break; + case OLPAREN: /* must undo assignment if rest fails */ + i = OPND(s); + assert(0 < i && i <= m->g->nsub); + offsave = m->pmatch[i].rm_so; + m->pmatch[i].rm_so = sp - m->offp; + dp = backref(m, sp, stop, ss+1, stopst, lev); + if (dp != NULL) + return(dp); + m->pmatch[i].rm_so = offsave; + return(NULL); + break; + case ORPAREN: /* must undo assignment if rest fails */ + i = OPND(s); + assert(0 < i && i <= m->g->nsub); + offsave = m->pmatch[i].rm_eo; + m->pmatch[i].rm_eo = sp - m->offp; + dp = backref(m, sp, stop, ss+1, stopst, lev); + if (dp != NULL) + return(dp); + m->pmatch[i].rm_eo = offsave; + return(NULL); + break; + default: /* uh oh */ + assert(nope); + break; + } + + /* "can't happen" */ + assert(nope); + /* NOTREACHED */ + return((char *)NULL); /* dummy */ +} + +/* + - fast - step through the string at top speed + == static char *fast(register struct match *m, char *start, \ + == char *stop, sopno startst, sopno stopst); + */ +static char * /* where tentative match ended, or NULL */ +fast(m, start, stop, startst, stopst) +register struct match *m; +char *start; +char *stop; +sopno startst; +sopno stopst; +{ + register states st = m->st; + register states fresh = m->fresh; + register states tmp = m->tmp; + register char *p = start; + register int c = (start == m->beginp) ? OUT : *(start-1); + register int lastc; /* previous c */ + register int flagch; + register int i; + register char *coldp; /* last p after which no match was underway */ + + CLEAR(st); + SET1(st, startst); + st = step(m->g, startst, stopst, st, NOTHING, st); + ASSIGN(fresh, st); + SP("start", st, *p); + coldp = NULL; + for (;;) { + /* next character */ + lastc = c; + c = (p == m->endp) ? OUT : *p; + if (EQ(st, fresh)) + coldp = p; + + /* is there an EOL and/or BOL between lastc and c? */ + flagch = '\0'; + i = 0; + if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || + (lastc == OUT && !(m->eflags®_NOTBOL)) ) { + flagch = BOL; + i = m->g->nbol; + } + if ( (c == '\n' && m->g->cflags®_NEWLINE) || + (c == OUT && !(m->eflags®_NOTEOL)) ) { + flagch = (flagch == BOL) ? BOLEOL : EOL; + i += m->g->neol; + } + if (i != 0) { + for (; i > 0; i--) + st = step(m->g, startst, stopst, st, flagch, st); + SP("boleol", st, c); + } + + /* how about a word boundary? */ + if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && + (c != OUT && ISWORD(c)) ) { + flagch = BOW; + } + if ( (lastc != OUT && ISWORD(lastc)) && + (flagch == EOL || (c != OUT && !ISWORD(c))) ) { + flagch = EOW; + } + if (flagch == BOW || flagch == EOW) { + st = step(m->g, startst, stopst, st, flagch, st); + SP("boweow", st, c); + } + + /* are we done? */ + if (ISSET(st, stopst) || p == stop) + break; /* NOTE BREAK OUT */ + + /* no, we must deal with this character */ + ASSIGN(tmp, st); + ASSIGN(st, fresh); + assert(c != OUT); + st = step(m->g, startst, stopst, tmp, c, st); + SP("aft", st, c); + assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); + p++; + } + + assert(coldp != NULL); + m->coldp = coldp; + if (ISSET(st, stopst)) + return(p+1); + else + return(NULL); +} + +/* + - slow - step through the string more deliberately + == static char *slow(register struct match *m, char *start, \ + == char *stop, sopno startst, sopno stopst); + */ +static char * /* where it ended */ +slow(m, start, stop, startst, stopst) +register struct match *m; +char *start; +char *stop; +sopno startst; +sopno stopst; +{ + register states st = m->st; + register states empty = m->empty; + register states tmp = m->tmp; + register char *p = start; + register int c = (start == m->beginp) ? OUT : *(start-1); + register int lastc; /* previous c */ + register int flagch; + register int i; + register char *matchp; /* last p at which a match ended */ + + AT("slow", start, stop, startst, stopst); + CLEAR(st); + SET1(st, startst); + SP("sstart", st, *p); + st = step(m->g, startst, stopst, st, NOTHING, st); + matchp = NULL; + for (;;) { + /* next character */ + lastc = c; + c = (p == m->endp) ? OUT : *p; + + /* is there an EOL and/or BOL between lastc and c? */ + flagch = '\0'; + i = 0; + if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || + (lastc == OUT && !(m->eflags®_NOTBOL)) ) { + flagch = BOL; + i = m->g->nbol; + } + if ( (c == '\n' && m->g->cflags®_NEWLINE) || + (c == OUT && !(m->eflags®_NOTEOL)) ) { + flagch = (flagch == BOL) ? BOLEOL : EOL; + i += m->g->neol; + } + if (i != 0) { + for (; i > 0; i--) + st = step(m->g, startst, stopst, st, flagch, st); + SP("sboleol", st, c); + } + + /* how about a word boundary? */ + if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && + (c != OUT && ISWORD(c)) ) { + flagch = BOW; + } + if ( (lastc != OUT && ISWORD(lastc)) && + (flagch == EOL || (c != OUT && !ISWORD(c))) ) { + flagch = EOW; + } + if (flagch == BOW || flagch == EOW) { + st = step(m->g, startst, stopst, st, flagch, st); + SP("sboweow", st, c); + } + + /* are we done? */ + if (ISSET(st, stopst)) + matchp = p; + if (EQ(st, empty) || p == stop) + break; /* NOTE BREAK OUT */ + + /* no, we must deal with this character */ + ASSIGN(tmp, st); + ASSIGN(st, empty); + assert(c != OUT); + st = step(m->g, startst, stopst, tmp, c, st); + SP("saft", st, c); + assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); + p++; + } + + return(matchp); +} + + +/* + - step - map set of states reachable before char to set reachable after + == static states step(register struct re_guts *g, sopno start, sopno stop, \ + == register states bef, int ch, register states aft); + == #define BOL (OUT+1) + == #define EOL (BOL+1) + == #define BOLEOL (BOL+2) + == #define NOTHING (BOL+3) + == #define BOW (BOL+4) + == #define EOW (BOL+5) + == #define CODEMAX (BOL+5) // highest code used + == #define NONCHAR(c) ((c) > CHAR_MAX) + == #define NNONCHAR (CODEMAX-CHAR_MAX) + */ +static states +step(g, start, stop, bef, ch, aft) +register struct re_guts *g; +sopno start; /* start state within strip */ +sopno stop; /* state after stop state within strip */ +register states bef; /* states reachable before */ +int ch; /* character or NONCHAR code */ +register states aft; /* states already known reachable after */ +{ + register cset *cs; + register sop s; + register sopno pc; + register onestate here; /* note, macros know this name */ + register sopno look; + register long i; + + for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) { + s = g->strip[pc]; + switch (OP(s)) { + case OEND: + assert(pc == stop-1); + break; + case OCHAR: + /* only characters can match */ + assert(!NONCHAR(ch) || ch != (char)OPND(s)); + if (ch == (char)OPND(s)) + FWD(aft, bef, 1); + break; + case OBOL: + if (ch == BOL || ch == BOLEOL) + FWD(aft, bef, 1); + break; + case OEOL: + if (ch == EOL || ch == BOLEOL) + FWD(aft, bef, 1); + break; + case OBOW: + if (ch == BOW) + FWD(aft, bef, 1); + break; + case OEOW: + if (ch == EOW) + FWD(aft, bef, 1); + break; + case OANY: + if (!NONCHAR(ch)) + FWD(aft, bef, 1); + break; + case OANYOF: + cs = &g->sets[OPND(s)]; + if (!NONCHAR(ch) && CHIN(cs, ch)) + FWD(aft, bef, 1); + break; + case OBACK_: /* ignored here */ + case O_BACK: + FWD(aft, aft, 1); + break; + case OPLUS_: /* forward, this is just an empty */ + FWD(aft, aft, 1); + break; + case O_PLUS: /* both forward and back */ + FWD(aft, aft, 1); + i = ISSETBACK(aft, OPND(s)); + BACK(aft, aft, OPND(s)); + if (!i && ISSETBACK(aft, OPND(s))) { + /* oho, must reconsider loop body */ + pc -= OPND(s) + 1; + INIT(here, pc); + } + break; + case OQUEST_: /* two branches, both forward */ + FWD(aft, aft, 1); + FWD(aft, aft, OPND(s)); + break; + case O_QUEST: /* just an empty */ + FWD(aft, aft, 1); + break; + case OLPAREN: /* not significant here */ + case ORPAREN: + FWD(aft, aft, 1); + break; + case OCH_: /* mark the first two branches */ + FWD(aft, aft, 1); + assert(OP(g->strip[pc+OPND(s)]) == OOR2); + FWD(aft, aft, OPND(s)); + break; + case OOR1: /* done a branch, find the O_CH */ + if (ISSTATEIN(aft, here)) { + for (look = 1; + OP(s = g->strip[pc+look]) != O_CH; + look += OPND(s)) + assert(OP(s) == OOR2); + FWD(aft, aft, look); + } + break; + case OOR2: /* propagate OCH_'s marking */ + FWD(aft, aft, 1); + if (OP(g->strip[pc+OPND(s)]) != O_CH) { + assert(OP(g->strip[pc+OPND(s)]) == OOR2); + FWD(aft, aft, OPND(s)); + } + break; + case O_CH: /* just empty */ + FWD(aft, aft, 1); + break; + default: /* ooooops... */ + assert(nope); + break; + } + } + + return(aft); +} + +#ifdef REDEBUG +/* + - print - print a set of states + == #ifdef REDEBUG + == static void print(struct match *m, char *caption, states st, \ + == int ch, FILE *d); + == #endif + */ +static void +print(m, caption, st, ch, d) +struct match *m; +char *caption; +states st; +int ch; +FILE *d; +{ + register struct re_guts *g = m->g; + register int i; + register int first = 1; + + if (!(m->eflags®_TRACE)) + return; + + fprintf(d, "%s", caption); + if (ch != '\0') + fprintf(d, " %s", pchar(ch)); + for (i = 0; i < g->nstates; i++) + if (ISSET(st, i)) { + fprintf(d, "%s%d", (first) ? "\t" : ", ", i); + first = 0; + } + fprintf(d, "\n"); +} + +/* + - at - print current situation + == #ifdef REDEBUG + == static void at(struct match *m, char *title, char *start, char *stop, \ + == sopno startst, sopno stopst); + == #endif + */ +static void +at(m, title, start, stop, startst, stopst) +struct match *m; +char *title; +char *start; +char *stop; +sopno startst; +sopno stopst; +{ + if (!(m->eflags®_TRACE)) + return; + + printf("%s %s-", title, pchar(*start)); + printf("%s ", pchar(*stop)); + printf("%ld-%ld\n", (long)startst, (long)stopst); +} + +#ifndef PCHARDONE +#define PCHARDONE /* never again */ +/* + - pchar - make a character printable + == #ifdef REDEBUG + == static char *pchar(int ch); + == #endif + * + * Is this identical to regchar() over in debug.c? Well, yes. But a + * duplicate here avoids having a debugging-capable regexec.o tied to + * a matching debug.o, and this is convenient. It all disappears in + * the non-debug compilation anyway, so it doesn't matter much. + */ +static char * /* -> representation */ +pchar(ch) +int ch; +{ + static char pbuf[10]; + + if (isprint(ch) || ch == ' ') + sprintf(pbuf, "%c", ch); + else + sprintf(pbuf, "\\%o", ch); + return(pbuf); +} +#endif +#endif + +#undef matcher +#undef fast +#undef slow +#undef dissect +#undef backref +#undef step +#undef print +#undef at +#undef match diff --git a/src/regex/re_main.c b/src/regex/re_main.c new file mode 100644 index 0000000000..0221e7713d --- /dev/null +++ b/src/regex/re_main.c @@ -0,0 +1,510 @@ +#include +#include +#include +#include +#include + +#include "main.ih" + +char *progname; +int debug = 0; +int line = 0; +int status = 0; + +int copts = REG_EXTENDED; +int eopts = 0; +regoff_t startoff = 0; +regoff_t endoff = 0; + + +extern int split(); +extern void regprint(); + +/* + - main - do the simple case, hand off to regress() for regression + */ +main(argc, argv) +int argc; +char *argv[]; +{ + regex_t re; +# define NS 10 + regmatch_t subs[NS]; + char erbuf[100]; + int err; + size_t len; + int c; + int errflg = 0; + register int i; + extern int optind; + extern char *optarg; + + progname = argv[0]; + + while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF) + switch (c) { + case 'c': /* compile options */ + copts = options('c', optarg); + break; + case 'e': /* execute options */ + eopts = options('e', optarg); + break; + case 'S': /* start offset */ + startoff = (regoff_t)atoi(optarg); + break; + case 'E': /* end offset */ + endoff = (regoff_t)atoi(optarg); + break; + case 'x': /* Debugging. */ + debug++; + break; + case '?': + default: + errflg++; + break; + } + if (errflg) { + fprintf(stderr, "usage: %s ", progname); + fprintf(stderr, "[-c copt][-C][-d] [re]\n"); + exit(2); + } + + if (optind >= argc) { + regress(stdin); + exit(status); + } + + err = regcomp(&re, argv[optind++], copts); + if (err) { + len = regerror(err, &re, erbuf, sizeof(erbuf)); + fprintf(stderr, "error %s, %d/%d `%s'\n", + eprint(err), len, sizeof(erbuf), erbuf); + exit(status); + } + regprint(&re, stdout); + + if (optind >= argc) { + regfree(&re); + exit(status); + } + + if (eopts®_STARTEND) { + subs[0].rm_so = startoff; + subs[0].rm_eo = strlen(argv[optind]) - endoff; + } + err = regexec(&re, argv[optind], (size_t)NS, subs, eopts); + if (err) { + len = regerror(err, &re, erbuf, sizeof(erbuf)); + fprintf(stderr, "error %s, %d/%d `%s'\n", + eprint(err), len, sizeof(erbuf), erbuf); + exit(status); + } + if (!(copts®_NOSUB)) { + len = (int)(subs[0].rm_eo - subs[0].rm_so); + if (subs[0].rm_so != -1) { + if (len != 0) + printf("match `%.*s'\n", len, + argv[optind] + subs[0].rm_so); + else + printf("match `'@%.1s\n", + argv[optind] + subs[0].rm_so); + } + for (i = 1; i < NS; i++) + if (subs[i].rm_so != -1) + printf("(%d) `%.*s'\n", i, + (int)(subs[i].rm_eo - subs[i].rm_so), + argv[optind] + subs[i].rm_so); + } + exit(status); +} + +/* + - regress - main loop of regression test + == void regress(FILE *in); + */ +void +regress(in) +FILE *in; +{ + char inbuf[1000]; +# define MAXF 10 + char *f[MAXF]; + int nf; + int i; + char erbuf[100]; + size_t ne; + char *badpat = "invalid regular expression"; +# define SHORT 10 + char *bpname = "REG_BADPAT"; + regex_t re; + + while (fgets(inbuf, sizeof(inbuf), in) != NULL) { + line++; + if (inbuf[0] == '#' || inbuf[0] == '\n') + continue; /* NOTE CONTINUE */ + inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */ + if (debug) + fprintf(stdout, "%d:\n", line); + nf = split(inbuf, f, MAXF, "\t\t"); + if (nf < 3) { + fprintf(stderr, "bad input, line %d\n", line); + exit(1); + } + for (i = 0; i < nf; i++) + if (strcmp(f[i], "\"\"") == 0) + f[i] = ""; + if (nf <= 3) + f[3] = NULL; + if (nf <= 4) + f[4] = NULL; + try(f[0], f[1], f[2], f[3], f[4], options('c', f[1])); + if (opt('&', f[1])) /* try with either type of RE */ + try(f[0], f[1], f[2], f[3], f[4], + options('c', f[1]) &~ REG_EXTENDED); + } + + ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf)); + if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) { + fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n", + erbuf, badpat); + status = 1; + } + ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT); + if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' || + ne != strlen(badpat)+1) { + fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n", + erbuf, SHORT-1, badpat); + status = 1; + } + ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf)); + if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) { + fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n", + erbuf, bpname); + status = 1; + } + re.re_endp = bpname; + ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf)); + if (atoi(erbuf) != (int)REG_BADPAT) { + fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n", + erbuf, (long)REG_BADPAT); + status = 1; + } else if (ne != strlen(erbuf)+1) { + fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n", + erbuf, (long)REG_BADPAT); + status = 1; + } +} + +/* + - try - try it, and report on problems + == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts); + */ +void +try(f0, f1, f2, f3, f4, opts) +char *f0; +char *f1; +char *f2; +char *f3; +char *f4; +int opts; /* may not match f1 */ +{ + regex_t re; +# define NSUBS 10 + regmatch_t subs[NSUBS]; +# define NSHOULD 15 + char *should[NSHOULD]; + int nshould; + char erbuf[100]; + int err; + int len; + char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE"; + register int i; + char *grump; + char f0copy[1000]; + char f2copy[1000]; + + strcpy(f0copy, f0); + re.re_endp = (opts®_PEND) ? f0copy + strlen(f0copy) : NULL; + fixstr(f0copy); + err = regcomp(&re, f0copy, opts); + if (err != 0 && (!opt('C', f1) || err != efind(f2))) { + /* unexpected error or wrong error */ + len = regerror(err, &re, erbuf, sizeof(erbuf)); + fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n", + line, type, eprint(err), len, + sizeof(erbuf), erbuf); + status = 1; + } else if (err == 0 && opt('C', f1)) { + /* unexpected success */ + fprintf(stderr, "%d: %s should have given REG_%s\n", + line, type, f2); + status = 1; + err = 1; /* so we won't try regexec */ + } + + if (err != 0) { + regfree(&re); + return; + } + + strcpy(f2copy, f2); + fixstr(f2copy); + + if (options('e', f1)®_STARTEND) { + if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL) + fprintf(stderr, "%d: bad STARTEND syntax\n", line); + subs[0].rm_so = strchr(f2, '(') - f2 + 1; + subs[0].rm_eo = strchr(f2, ')') - f2; + } + err = regexec(&re, f2copy, NSUBS, subs, options('e', f1)); + + if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) { + /* unexpected error or wrong error */ + len = regerror(err, &re, erbuf, sizeof(erbuf)); + fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n", + line, type, eprint(err), len, + sizeof(erbuf), erbuf); + status = 1; + } else if (err != 0) { + /* nothing more to check */ + } else if (f3 == NULL) { + /* unexpected success */ + fprintf(stderr, "%d: %s exec should have failed\n", + line, type); + status = 1; + err = 1; /* just on principle */ + } else if (opts®_NOSUB) { + /* nothing more to check */ + } else if ((grump = check(f2, subs[0], f3)) != NULL) { + fprintf(stderr, "%d: %s %s\n", line, type, grump); + status = 1; + err = 1; + } + + if (err != 0 || f4 == NULL) { + regfree(&re); + return; + } + + for (i = 1; i < NSHOULD; i++) + should[i] = NULL; + nshould = split(f4, should+1, NSHOULD-1, ","); + if (nshould == 0) { + nshould = 1; + should[1] = ""; + } + for (i = 1; i < NSUBS; i++) { + grump = check(f2, subs[i], should[i]); + if (grump != NULL) { + fprintf(stderr, "%d: %s $%d %s\n", line, + type, i, grump); + status = 1; + err = 1; + } + } + + regfree(&re); +} + +/* + - options - pick options out of a regression-test string + == int options(int type, char *s); + */ +int +options(type, s) +int type; /* 'c' compile, 'e' exec */ +char *s; +{ + register char *p; + register int o = (type == 'c') ? copts : eopts; + register char *legal = (type == 'c') ? "bisnmp" : "^$#tl"; + + for (p = s; *p != '\0'; p++) + if (strchr(legal, *p) != NULL) + switch (*p) { + case 'b': + o &= ~REG_EXTENDED; + break; + case 'i': + o |= REG_ICASE; + break; + case 's': + o |= REG_NOSUB; + break; + case 'n': + o |= REG_NEWLINE; + break; + case 'm': + o &= ~REG_EXTENDED; + o |= REG_NOSPEC; + break; + case 'p': + o |= REG_PEND; + break; + case '^': + o |= REG_NOTBOL; + break; + case '$': + o |= REG_NOTEOL; + break; + case '#': + o |= REG_STARTEND; + break; + case 't': /* trace */ + o |= REG_TRACE; + break; + case 'l': /* force long representation */ + o |= REG_LARGE; + break; + case 'r': /* force backref use */ + o |= REG_BACKR; + break; + } + return(o); +} + +/* + - opt - is a particular option in a regression string? + == int opt(int c, char *s); + */ +int /* predicate */ +opt(c, s) +int c; +char *s; +{ + return(strchr(s, c) != NULL); +} + +/* + - fixstr - transform magic characters in strings + == void fixstr(register char *p); + */ +void +fixstr(p) +register char *p; +{ + if (p == NULL) + return; + + for (; *p != '\0'; p++) + if (*p == 'N') + *p = '\n'; + else if (*p == 'T') + *p = '\t'; + else if (*p == 'S') + *p = ' '; + else if (*p == 'Z') + *p = '\0'; +} + +/* + - check - check a substring match + == char *check(char *str, regmatch_t sub, char *should); + */ +char * /* NULL or complaint */ +check(str, sub, should) +char *str; +regmatch_t sub; +char *should; +{ + register int len; + register int shlen; + register char *p; + static char grump[500]; + register char *at = NULL; + + if (should != NULL && strcmp(should, "-") == 0) + should = NULL; + if (should != NULL && should[0] == '@') { + at = should + 1; + should = ""; + } + + /* check rm_so and rm_eo for consistency */ + if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) || + (sub.rm_so != -1 && sub.rm_eo == -1) || + (sub.rm_so != -1 && sub.rm_so < 0) || + (sub.rm_eo != -1 && sub.rm_eo < 0) ) { + sprintf(grump, "start %ld end %ld", (long)sub.rm_so, + (long)sub.rm_eo); + return(grump); + } + + /* check for no match */ + if (sub.rm_so == -1 && should == NULL) + return(NULL); + if (sub.rm_so == -1) + return("did not match"); + + /* check for in range */ + if (sub.rm_eo > strlen(str)) { + sprintf(grump, "start %ld end %ld, past end of string", + (long)sub.rm_so, (long)sub.rm_eo); + return(grump); + } + + len = (int)(sub.rm_eo - sub.rm_so); + shlen = (int)strlen(should); + p = str + sub.rm_so; + + /* check for not supposed to match */ + if (should == NULL) { + sprintf(grump, "matched `%.*s'", len, p); + return(grump); + } + + /* check for wrong match */ + if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) { + sprintf(grump, "matched `%.*s' instead", len, p); + return(grump); + } + if (shlen > 0) + return(NULL); + + /* check null match in right place */ + if (at == NULL) + return(NULL); + shlen = strlen(at); + if (shlen == 0) + shlen = 1; /* force check for end-of-string */ + if (strncmp(p, at, shlen) != 0) { + sprintf(grump, "matched null at `%.20s'", p); + return(grump); + } + return(NULL); +} + +/* + - eprint - convert error number to name + == static char *eprint(int err); + */ +static char * +eprint(err) +int err; +{ + static char epbuf[100]; + size_t len; + + len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf)); + assert(len <= sizeof(epbuf)); + return(epbuf); +} + +/* + - efind - convert error name to number + == static int efind(char *name); + */ +static int +efind(name) +char *name; +{ + static char efbuf[100]; + size_t n; + regex_t re; + + sprintf(efbuf, "REG_%s", name); + assert(strlen(efbuf) < sizeof(efbuf)); + re.re_endp = efbuf; + (void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf)); + return(atoi(efbuf)); +} diff --git a/src/regex/re_syntax.n b/src/regex/re_syntax.n deleted file mode 100644 index f37bb85abd..0000000000 --- a/src/regex/re_syntax.n +++ /dev/null @@ -1,970 +0,0 @@ -'\" -'\" Copyright (c) 1998 Sun Microsystems, Inc. -'\" Copyright (c) 1999 Scriptics Corporation -'\" -'\" This software is copyrighted by the Regents of the University of -'\" California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState -'\" Corporation and other parties. The following terms apply to all files -'\" associated with the software unless explicitly disclaimed in -'\" individual files. -'\" -'\" The authors hereby grant permission to use, copy, modify, distribute, -'\" and license this software and its documentation for any purpose, provided -'\" that existing copyright notices are retained in all copies and that this -'\" notice is included verbatim in any distributions. No written agreement, -'\" license, or royalty fee is required for any of the authorized uses. -'\" Modifications to this software may be copyrighted by their authors -'\" and need not follow the licensing terms described here, provided that -'\" the new terms are clearly indicated on the first page of each file where -'\" they apply. -'\" -'\" IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY -'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -'\" ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY -'\" DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE -'\" POSSIBILITY OF SUCH DAMAGE. -'\" -'\" THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, -'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, -'\" FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE -'\" IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE -'\" NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR -'\" MODIFICATIONS. -'\" -'\" GOVERNMENT USE: If you are acquiring this software on behalf of the -'\" U.S. government, the Government shall have only "Restricted Rights" -'\" in the software and related documentation as defined in the Federal -'\" Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you -'\" are acquiring the software on behalf of the Department of Defense, the -'\" software shall be classified as "Commercial Computer Software" and the -'\" Government shall have only "Restricted Rights" as defined in Clause -'\" 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the -'\" authors grant the U.S. Government and others acting in its behalf -'\" permission to use and distribute the software in accordance with the -'\" terms specified in this license. -'\" -'\" RCS: @(#) Id: re_syntax.n,v 1.3 1999/07/14 19:09:36 jpeek Exp -'\" -.so man.macros -.TH re_syntax n "8.1" Tcl "Tcl Built-In Commands" -.BS -.SH NAME -re_syntax \- Syntax of Tcl regular expressions. -.BE - -.SH DESCRIPTION -.PP -A \fIregular expression\fR describes strings of characters. -It's a pattern that matches certain strings and doesn't match others. - -.SH "DIFFERENT FLAVORS OF REs" -Regular expressions (``RE''s), as defined by POSIX, come in two -flavors: \fIextended\fR REs (``EREs'') and \fIbasic\fR REs (``BREs''). -EREs are roughly those of the traditional \fIegrep\fR, while BREs are -roughly those of the traditional \fIed\fR. This implementation adds -a third flavor, \fIadvanced\fR REs (``AREs''), basically EREs with -some significant extensions. -.PP -This manual page primarily describes AREs. BREs mostly exist for -backward compatibility in some old programs; they will be discussed at -the end. POSIX EREs are almost an exact subset of AREs. Features of -AREs that are not present in EREs will be indicated. - -.SH "REGULAR EXPRESSION SYNTAX" -.PP -Tcl regular expressions are implemented using the package written by -Henry Spencer, based on the 1003.2 spec and some (not quite all) of -the Perl5 extensions (thanks, Henry!). Much of the description of -regular expressions below is copied verbatim from his manual entry. -.PP -An ARE is one or more \fIbranches\fR, -separated by `\fB|\fR', -matching anything that matches any of the branches. -.PP -A branch is zero or more \fIconstraints\fR or \fIquantified atoms\fR, -concatenated. -It matches a match for the first, followed by a match for the second, etc; -an empty branch matches the empty string. -.PP -A quantified atom is an \fIatom\fR possibly followed -by a single \fIquantifier\fR. -Without a quantifier, it matches a match for the atom. -The quantifiers, -and what a so-quantified atom matches, are: -.RS 2 -.TP 6 -\fB*\fR -a sequence of 0 or more matches of the atom -.TP -\fB+\fR -a sequence of 1 or more matches of the atom -.TP -\fB?\fR -a sequence of 0 or 1 matches of the atom -.TP -\fB{\fIm\fB}\fR -a sequence of exactly \fIm\fR matches of the atom -.TP -\fB{\fIm\fB,}\fR -a sequence of \fIm\fR or more matches of the atom -.TP -\fB{\fIm\fB,\fIn\fB}\fR -a sequence of \fIm\fR through \fIn\fR (inclusive) matches of the atom; -\fIm\fR may not exceed \fIn\fR -.TP -\fB*? +? ?? {\fIm\fB}? {\fIm\fB,}? {\fIm\fB,\fIn\fB}?\fR -\fInon-greedy\fR quantifiers, -which match the same possibilities, -but prefer the smallest number rather than the largest number -of matches (see MATCHING) -.RE -.PP -The forms using -\fB{\fR and \fB}\fR -are known as \fIbound\fRs. -The numbers -\fIm\fR and \fIn\fR are unsigned decimal integers -with permissible values from 0 to 255 inclusive. -.PP -An atom is one of: -.RS 2 -.TP 6 -\fB(\fIre\fB)\fR -(where \fIre\fR is any regular expression) -matches a match for -\fIre\fR, with the match noted for possible reporting -.TP -\fB(?:\fIre\fB)\fR -as previous, -but does no reporting -(a ``non-capturing'' set of parentheses) -.TP -\fB()\fR -matches an empty string, -noted for possible reporting -.TP -\fB(?:)\fR -matches an empty string, -without reporting -.TP -\fB[\fIchars\fB]\fR -a \fIbracket expression\fR, -matching any one of the \fIchars\fR (see BRACKET EXPRESSIONS for more detail) -.TP - \fB.\fR -matches any single character -.TP -\fB\e\fIk\fR -(where \fIk\fR is a non-alphanumeric character) -matches that character taken as an ordinary character, -e.g. \e\e matches a backslash character -.TP -\fB\e\fIc\fR -where \fIc\fR is alphanumeric -(possibly followed by other characters), -an \fIescape\fR (AREs only), -see ESCAPES below -.TP -\fB{\fR -when followed by a character other than a digit, -matches the left-brace character `\fB{\fR'; -when followed by a digit, it is the beginning of a -\fIbound\fR (see above) -.TP -\fIx\fR -where \fIx\fR is -a single character with no other significance, matches that character. -.RE -.PP -A \fIconstraint\fR matches an empty string when specific conditions -are met. -A constraint may not be followed by a quantifier. -The simple constraints are as follows; some more constraints are -described later, under ESCAPES. -.RS 2 -.TP 8 -\fB^\fR -matches at the beginning of a line -.TP -\fB$\fR -matches at the end of a line -.TP -\fB(?=\fIre\fB)\fR -\fIpositive lookahead\fR (AREs only), matches at any point -where a substring matching \fIre\fR begins -.TP -\fB(?!\fIre\fB)\fR -\fInegative lookahead\fR (AREs only), matches at any point -where no substring matching \fIre\fR begins -.RE -.PP -The lookahead constraints may not contain back references (see later), -and all parentheses within them are considered non-capturing. -.PP -An RE may not end with `\fB\e\fR'. - -.SH "BRACKET EXPRESSIONS" -A \fIbracket expression\fR is a list of characters enclosed in `\fB[\|]\fR'. -It normally matches any single character from the list (but see below). -If the list begins with `\fB^\fR', -it matches any single character -(but see below) \fInot\fR from the rest of the list. -.PP -If two characters in the list are separated by `\fB\-\fR', -this is shorthand -for the full \fIrange\fR of characters between those two (inclusive) in the -collating sequence, -e.g. -\fB[0\-9]\fR -in ASCII matches any decimal digit. -Two ranges may not share an -endpoint, so e.g. -\fBa\-c\-e\fR -is illegal. -Ranges are very collating-sequence-dependent, -and portable programs should avoid relying on them. -.PP -To include a literal -\fB]\fR -or -\fB\-\fR -in the list, -the simplest method is to -enclose it in -\fB[.\fR and \fB.]\fR -to make it a collating element (see below). -Alternatively, -make it the first character -(following a possible `\fB^\fR'), -or (AREs only) precede it with `\fB\e\fR'. -Alternatively, for `\fB\-\fR', -make it the last character, -or the second endpoint of a range. -To use a literal -\fB\-\fR -as the first endpoint of a range, -make it a collating element -or (AREs only) precede it with `\fB\e\fR'. -With the exception of these, some combinations using -\fB[\fR -(see next -paragraphs), and escapes, -all other special characters lose their -special significance within a bracket expression. -.PP -Within a bracket expression, a collating element (a character, -a multi-character sequence that collates as if it were a single character, -or a collating-sequence name for either) -enclosed in -\fB[.\fR and \fB.]\fR -stands for the -sequence of characters of that collating element. -The sequence is a single element of the bracket expression's list. -A bracket expression in a locale that has -multi-character collating elements -can thus match more than one character. -.VS 8.2 -So (insidiously), a bracket expression that starts with \fB^\fR -can match multi-character collating elements even if none of them -appear in the bracket expression! -(\fINote:\fR Tcl currently has no multi-character collating elements. -This information is only for illustration.) -.PP -For example, assume the collating sequence includes a \fBch\fR -multi-character collating element. -Then the RE \fB[[.ch.]]*c\fR (zero or more \fBch\fP's followed by \fBc\fP) -matches the first five characters of `\fBchchcc\fR'. -Also, the RE \fB[^c]b\fR matches all of `\fBchb\fR' -(because \fB[^c]\fR matches the multi-character \fBch\fR). -.VE 8.2 -.PP -Within a bracket expression, a collating element enclosed in -\fB[=\fR -and -\fB=]\fR -is an equivalence class, standing for the sequences of characters -of all collating elements equivalent to that one, including itself. -(If there are no other equivalent collating elements, -the treatment is as if the enclosing delimiters were `\fB[.\fR'\& -and `\fB.]\fR'.) -For example, if -\fBo\fR -and -\fB\o'o^'\fR -are the members of an equivalence class, -then `\fB[[=o=]]\fR', `\fB[[=\o'o^'=]]\fR', -and `\fB[o\o'o^']\fR'\& -are all synonymous. -An equivalence class may not be an endpoint -of a range. -.VS 8.2 -(\fINote:\fR -Tcl currently implements only the Unicode locale. -It doesn't define any equivalence classes. -The examples above are just illustrations.) -.VE 8.2 -.PP -Within a bracket expression, the name of a \fIcharacter class\fR enclosed -in -\fB[:\fR -and -\fB:]\fR -stands for the list of all characters -(not all collating elements!) -belonging to that -class. -Standard character classes are: -.PP -.RS -.ne 5 -.nf -.ta 3c -\fBalpha\fR A letter. -\fBupper\fR An upper-case letter. -\fBlower\fR A lower-case letter. -\fBdigit\fR A decimal digit. -\fBxdigit\fR A hexadecimal digit. -\fBalnum\fR An alphanumeric (letter or digit). -\fBprint\fR An alphanumeric (same as alnum). -\fBblank\fR A space or tab character. -\fBspace\fR A character producing white space in displayed text. -\fBpunct\fR A punctuation character. -\fBgraph\fR A character with a visible representation. -\fBcntrl\fR A control character. -.fi -.RE -.PP -A locale may provide others. -.VS 8.2 -(Note that the current Tcl implementation has only one locale: -the Unicode locale.) -.VE 8.2 -A character class may not be used as an endpoint of a range. -.PP -There are two special cases of bracket expressions: -the bracket expressions -\fB[[:<:]]\fR -and -\fB[[:>:]]\fR -are constraints, matching empty strings at -the beginning and end of a word respectively. -'\" note, discussion of escapes below references this definition of word -A word is defined as a sequence of -word characters -that is neither preceded nor followed by -word characters. -A word character is an -\fIalnum\fR -character -or an underscore -(\fB_\fR). -These special bracket expressions are deprecated; -users of AREs should use constraint escapes instead (see below). -.SH ESCAPES -Escapes (AREs only), which begin with a -\fB\e\fR -followed by an alphanumeric character, -come in several varieties: -character entry, class shorthands, constraint escapes, and back references. -A -\fB\e\fR -followed by an alphanumeric character but not constituting -a valid escape is illegal in AREs. -In EREs, there are no escapes: -outside a bracket expression, -a -\fB\e\fR -followed by an alphanumeric character merely stands for that -character as an ordinary character, -and inside a bracket expression, -\fB\e\fR -is an ordinary character. -(The latter is the one actual incompatibility between EREs and AREs.) -.PP -Character-entry escapes (AREs only) exist to make it easier to specify -non-printing and otherwise inconvenient characters in REs: -.RS 2 -.TP 5 -\fB\ea\fR -alert (bell) character, as in C -.TP -\fB\eb\fR -backspace, as in C -.TP -\fB\eB\fR -synonym for -\fB\e\fR -to help reduce backslash doubling in some -applications where there are multiple levels of backslash processing -.TP -\fB\ec\fIX\fR -(where X is any character) the character whose -low-order 5 bits are the same as those of -\fIX\fR, -and whose other bits are all zero -.TP -\fB\ee\fR -the character whose collating-sequence name -is `\fBESC\fR', -or failing that, the character with octal value 033 -.TP -\fB\ef\fR -formfeed, as in C -.TP -\fB\en\fR -newline, as in C -.TP -\fB\er\fR -carriage return, as in C -.TP -\fB\et\fR -horizontal tab, as in C -.TP -\fB\eu\fIwxyz\fR -(where -\fIwxyz\fR -is exactly four hexadecimal digits) -the Unicode character -\fBU+\fIwxyz\fR -in the local byte ordering -.TP -\fB\eU\fIstuvwxyz\fR -(where -\fIstuvwxyz\fR -is exactly eight hexadecimal digits) -reserved for a somewhat-hypothetical Unicode extension to 32 bits -.TP -\fB\ev\fR -vertical tab, as in C -are all available. -.TP -\fB\ex\fIhhh\fR -(where -\fIhhh\fR -is any sequence of hexadecimal digits) -the character whose hexadecimal value is -\fB0x\fIhhh\fR -(a single character no matter how many hexadecimal digits are used). -.TP -\fB\e0\fR -the character whose value is -\fB0\fR -.TP -\fB\e\fIxy\fR -(where -\fIxy\fR -is exactly two octal digits, -and is not a -\fIback reference\fR (see below)) -the character whose octal value is -\fB0\fIxy\fR -.TP -\fB\e\fIxyz\fR -(where -\fIxyz\fR -is exactly three octal digits, -and is not a -back reference (see below)) -the character whose octal value is -\fB0\fIxyz\fR -.RE -.PP -Hexadecimal digits are `\fB0\fR'-`\fB9\fR', `\fBa\fR'-`\fBf\fR', -and `\fBA\fR'-`\fBF\fR'. -Octal digits are `\fB0\fR'-`\fB7\fR'. -.PP -The character-entry escapes are always taken as ordinary characters. -For example, -\fB\e135\fR -is -\fB]\fR -in ASCII, -but -\fB\e135\fR -does not terminate a bracket expression. -Beware, however, that some applications (e.g., C compilers) interpret -such sequences themselves before the regular-expression package -gets to see them, which may require doubling (quadrupling, etc.) the `\fB\e\fR'. -.PP -Class-shorthand escapes (AREs only) provide shorthands for certain commonly-used -character classes: -.RS 2 -.TP 10 -\fB\ed\fR -\fB[[:digit:]]\fR -.TP -\fB\es\fR -\fB[[:space:]]\fR -.TP -\fB\ew\fR -\fB[[:alnum:]_]\fR -(note underscore) -.TP -\fB\eD\fR -\fB[^[:digit:]]\fR -.TP -\fB\eS\fR -\fB[^[:space:]]\fR -.TP -\fB\eW\fR -\fB[^[:alnum:]_]\fR -(note underscore) -.RE -.PP -Within bracket expressions, `\fB\ed\fR', `\fB\es\fR', -and `\fB\ew\fR'\& -lose their outer brackets, -and `\fB\eD\fR', `\fB\eS\fR', -and `\fB\eW\fR'\& -are illegal. -.VS 8.2 -(So, for example, \fB[a-c\ed]\fR is equivalent to \fB[a-c[:digit:]]\fR. -Also, \fB[a-c\eD]\fR, which is equivalent to \fB[a-c^[:digit:]]\fR, is illegal.) -.VE 8.2 -.PP -A constraint escape (AREs only) is a constraint, -matching the empty string if specific conditions are met, -written as an escape: -.RS 2 -.TP 6 -\fB\eA\fR -matches only at the beginning of the string -(see MATCHING, below, for how this differs from `\fB^\fR') -.TP -\fB\em\fR -matches only at the beginning of a word -.TP -\fB\eM\fR -matches only at the end of a word -.TP -\fB\ey\fR -matches only at the beginning or end of a word -.TP -\fB\eY\fR -matches only at a point that is not the beginning or end of a word -.TP -\fB\eZ\fR -matches only at the end of the string -(see MATCHING, below, for how this differs from `\fB$\fR') -.TP -\fB\e\fIm\fR -(where -\fIm\fR -is a nonzero digit) a \fIback reference\fR, see below -.TP -\fB\e\fImnn\fR -(where -\fIm\fR -is a nonzero digit, and -\fInn\fR -is some more digits, -and the decimal value -\fImnn\fR -is not greater than the number of closing capturing parentheses seen so far) -a \fIback reference\fR, see below -.RE -.PP -A word is defined as in the specification of -\fB[[:<:]]\fR -and -\fB[[:>:]]\fR -above. -Constraint escapes are illegal within bracket expressions. -.PP -A back reference (AREs only) matches the same string matched by the parenthesized -subexpression specified by the number, -so that (e.g.) -\fB([bc])\e1\fR -matches -\fBbb\fR -or -\fBcc\fR -but not `\fBbc\fR'. -The subexpression must entirely precede the back reference in the RE. -Subexpressions are numbered in the order of their leading parentheses. -Non-capturing parentheses do not define subexpressions. -.PP -There is an inherent historical ambiguity between octal character-entry -escapes and back references, which is resolved by heuristics, -as hinted at above. -A leading zero always indicates an octal escape. -A single non-zero digit, not followed by another digit, -is always taken as a back reference. -A multi-digit sequence not starting with a zero is taken as a back -reference if it comes after a suitable subexpression -(i.e. the number is in the legal range for a back reference), -and otherwise is taken as octal. -.SH "METASYNTAX" -In addition to the main syntax described above, there are some special -forms and miscellaneous syntactic facilities available. -.PP -Normally the flavor of RE being used is specified by -application-dependent means. -However, this can be overridden by a \fIdirector\fR. -If an RE of any flavor begins with `\fB***:\fR', -the rest of the RE is an ARE. -If an RE of any flavor begins with `\fB***=\fR', -the rest of the RE is taken to be a literal string, -with all characters considered ordinary characters. -.PP -An ARE may begin with \fIembedded options\fR: -a sequence -\fB(?\fIxyz\fB)\fR -(where -\fIxyz\fR -is one or more alphabetic characters) -specifies options affecting the rest of the RE. -These supplement, and can override, -any options specified by the application. -The available option letters are: -.RS 2 -.TP 3 -\fBb\fR -rest of RE is a BRE -.TP 3 -\fBc\fR -case-sensitive matching (usual default) -.TP 3 -\fBe\fR -rest of RE is an ERE -.TP 3 -\fBi\fR -case-insensitive matching (see MATCHING, below) -.TP 3 -\fBm\fR -historical synonym for -\fBn\fR -.TP 3 -\fBn\fR -newline-sensitive matching (see MATCHING, below) -.TP 3 -\fBp\fR -partial newline-sensitive matching (see MATCHING, below) -.TP 3 -\fBq\fR -rest of RE is a literal (``quoted'') string, all ordinary characters -.TP 3 -\fBs\fR -non-newline-sensitive matching (usual default) -.TP 3 -\fBt\fR -tight syntax (usual default; see below) -.TP 3 -\fBw\fR -inverse partial newline-sensitive (``weird'') matching (see MATCHING, below) -.TP 3 -\fBx\fR -expanded syntax (see below) -.RE -.PP -Embedded options take effect at the -\fB)\fR -terminating the sequence. -They are available only at the start of an ARE, -and may not be used later within it. -.PP -In addition to the usual (\fItight\fR) RE syntax, in which all characters are -significant, there is an \fIexpanded\fR syntax, -available in all flavors of RE -with the \fB-expanded\fR switch, or in AREs with the embedded x option. -In the expanded syntax, -white-space characters are ignored -and all characters between a -\fB#\fR -and the following newline (or the end of the RE) are ignored, -permitting paragraphing and commenting a complex RE. -There are three exceptions to that basic rule: -.RS 2 -.PP -a white-space character or `\fB#\fR' preceded by `\fB\e\fR' is retained -.PP -white space or `\fB#\fR' within a bracket expression is retained -.PP -white space and comments are illegal within multi-character symbols -like the ARE `\fB(?:\fR' or the BRE `\fB\e(\fR' -.RE -.PP -Expanded-syntax white-space characters are blank, tab, newline, and -.VS 8.2 -any character that belongs to the \fIspace\fR character class. -.VE 8.2 -.PP -Finally, in an ARE, -outside bracket expressions, the sequence `\fB(?#\fIttt\fB)\fR' -(where -\fIttt\fR -is any text not containing a `\fB)\fR') -is a comment, -completely ignored. -Again, this is not allowed between the characters of -multi-character symbols like `\fB(?:\fR'. -Such comments are more a historical artifact than a useful facility, -and their use is deprecated; -use the expanded syntax instead. -.PP -\fINone\fR of these metasyntax extensions is available if the application -(or an initial -\fB***=\fR -director) -has specified that the user's input be treated as a literal string -rather than as an RE. -.SH MATCHING -In the event that an RE could match more than one substring of a given -string, -the RE matches the one starting earliest in the string. -If the RE could match more than one substring starting at that point, -its choice is determined by its \fIpreference\fR: -either the longest substring, or the shortest. -.PP -Most atoms, and all constraints, have no preference. -A parenthesized RE has the same preference (possibly none) as the RE. -A quantified atom with quantifier -\fB{\fIm\fB}\fR -or -\fB{\fIm\fB}?\fR -has the same preference (possibly none) as the atom itself. -A quantified atom with other normal quantifiers (including -\fB{\fIm\fB,\fIn\fB}\fR -with -\fIm\fR -equal to -\fIn\fR) -prefers longest match. -A quantified atom with other non-greedy quantifiers (including -\fB{\fIm\fB,\fIn\fB}?\fR -with -\fIm\fR -equal to -\fIn\fR) -prefers shortest match. -A branch has the same preference as the first quantified atom in it -which has a preference. -An RE consisting of two or more branches connected by the -\fB|\fR -operator prefers longest match. -.PP -Subject to the constraints imposed by the rules for matching the whole RE, -subexpressions also match the longest or shortest possible substrings, -based on their preferences, -with subexpressions starting earlier in the RE taking priority over -ones starting later. -Note that outer subexpressions thus take priority over -their component subexpressions. -.PP -Note that the quantifiers -\fB{1,1}\fR -and -\fB{1,1}?\fR -can be used to force longest and shortest preference, respectively, -on a subexpression or a whole RE. -.PP -Match lengths are measured in characters, not collating elements. -An empty string is considered longer than no match at all. -For example, -\fBbb*\fR -matches the three middle characters of `\fBabbbc\fR', -\fB(week|wee)(night|knights)\fR -matches all ten characters of `\fBweeknights\fR', -when -\fB(.*).*\fR -is matched against -\fBabc\fR -the parenthesized subexpression -matches all three characters, and -when -\fB(a*)*\fR -is matched against -\fBbc\fR -both the whole RE and the parenthesized -subexpression match an empty string. -.PP -If case-independent matching is specified, -the effect is much as if all case distinctions had vanished from the -alphabet. -When an alphabetic that exists in multiple cases appears as an -ordinary character outside a bracket expression, it is effectively -transformed into a bracket expression containing both cases, -so that -\fBx\fR -becomes `\fB[xX]\fR'. -When it appears inside a bracket expression, all case counterparts -of it are added to the bracket expression, so that -\fB[x]\fR -becomes -\fB[xX]\fR -and -\fB[^x]\fR -becomes `\fB[^xX]\fR'. -.PP -If newline-sensitive matching is specified, \fB.\fR -and bracket expressions using -\fB^\fR -will never match the newline character -(so that matches will never cross newlines unless the RE -explicitly arranges it) -and -\fB^\fR -and -\fB$\fR -will match the empty string after and before a newline -respectively, in addition to matching at beginning and end of string -respectively. -ARE -\fB\eA\fR -and -\fB\eZ\fR -continue to match beginning or end of string \fIonly\fR. -.PP -If partial newline-sensitive matching is specified, -this affects \fB.\fR -and bracket expressions -as with newline-sensitive matching, but not -\fB^\fR -and `\fB$\fR'. -.PP -If inverse partial newline-sensitive matching is specified, -this affects -\fB^\fR -and -\fB$\fR -as with -newline-sensitive matching, -but not \fB.\fR -and bracket expressions. -This isn't very useful but is provided for symmetry. -.SH "LIMITS AND COMPATIBILITY" -No particular limit is imposed on the length of REs. -Programs intended to be highly portable should not employ REs longer -than 256 bytes, -as a POSIX-compliant implementation can refuse to accept such REs. -.PP -The only feature of AREs that is actually incompatible with -POSIX EREs is that -\fB\e\fR -does not lose its special -significance inside bracket expressions. -All other ARE features use syntax which is illegal or has -undefined or unspecified effects in POSIX EREs; -the -\fB***\fR -syntax of directors likewise is outside the POSIX -syntax for both BREs and EREs. -.PP -Many of the ARE extensions are borrowed from Perl, but some have -been changed to clean them up, and a few Perl extensions are not present. -Incompatibilities of note include `\fB\eb\fR', `\fB\eB\fR', -the lack of special treatment for a trailing newline, -the addition of complemented bracket expressions to the things -affected by newline-sensitive matching, -the restrictions on parentheses and back references in lookahead constraints, -and the longest/shortest-match (rather than first-match) matching semantics. -.PP -The matching rules for REs containing both normal and non-greedy quantifiers -have changed since early beta-test versions of this package. -(The new rules are much simpler and cleaner, -but don't work as hard at guessing the user's real intentions.) -.PP -Henry Spencer's original 1986 \fIregexp\fR package, -still in widespread use (e.g., in pre-8.1 releases of Tcl), -implemented an early version of today's EREs. -There are four incompatibilities between \fIregexp\fR's near-EREs -(`RREs' for short) and AREs. -In roughly increasing order of significance: -.PP -.RS -In AREs, -\fB\e\fR -followed by an alphanumeric character is either an -escape or an error, -while in RREs, it was just another way of writing the -alphanumeric. -This should not be a problem because there was no reason to write -such a sequence in RREs. -.PP -\fB{\fR -followed by a digit in an ARE is the beginning of a bound, -while in RREs, -\fB{\fR -was always an ordinary character. -Such sequences should be rare, -and will often result in an error because following characters -will not look like a valid bound. -.PP -In AREs, -\fB\e\fR -remains a special character within `\fB[\|]\fR', -so a literal -\fB\e\fR -within -\fB[\|]\fR -must be written `\fB\e\e\fR'. -\fB\e\e\fR -also gives a literal -\fB\e\fR -within -\fB[\|]\fR -in RREs, -but only truly paranoid programmers routinely doubled the backslash. -.PP -AREs report the longest/shortest match for the RE, -rather than the first found in a specified search order. -This may affect some RREs which were written in the expectation that -the first match would be reported. -(The careful crafting of RREs to optimize the search order for fast -matching is obsolete (AREs examine all possible matches -in parallel, and their performance is largely insensitive to their -complexity) but cases where the search order was exploited to deliberately -find a match which was \fInot\fR the longest/shortest will need rewriting.) -.RE - -.SH "BASIC REGULAR EXPRESSIONS" -BREs differ from EREs in several respects. `\fB|\fR', `\fB+\fR', -and -\fB?\fR -are ordinary characters and there is no equivalent -for their functionality. -The delimiters for bounds are -\fB\e{\fR -and `\fB\e}\fR', -with -\fB{\fR -and -\fB}\fR -by themselves ordinary characters. -The parentheses for nested subexpressions are -\fB\e(\fR -and `\fB\e)\fR', -with -\fB(\fR -and -\fB)\fR -by themselves ordinary characters. -\fB^\fR -is an ordinary character except at the beginning of the -RE or the beginning of a parenthesized subexpression, -\fB$\fR -is an ordinary character except at the end of the -RE or the end of a parenthesized subexpression, -and -\fB*\fR -is an ordinary character if it appears at the beginning of the -RE or the beginning of a parenthesized subexpression -(after a possible leading `\fB^\fR'). -Finally, -single-digit back references are available, -and -\fB\e<\fR -and -\fB\e>\fR -are synonyms for -\fB[[:<:]]\fR -and -\fB[[:>:]]\fR -respectively; -no other escapes are available. - -.SH "SEE ALSO" -RegExp(3), regexp(n), regsub(n), lsearch(n), switch(n), text(n) - -.SH KEYWORDS -match, regular expression, string diff --git a/src/regex/regc_color.c b/src/regex/regc_color.c deleted file mode 100644 index 5376af2ed5..0000000000 --- a/src/regex/regc_color.c +++ /dev/null @@ -1,780 +0,0 @@ -/* - * colorings of characters - * This file is #included by regcomp.c. - * - * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. - * - * Development of this software was funded, in part, by Cray Research Inc., - * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics - * Corporation, none of whom are responsible for the results. The author - * thanks all of them. - * - * Redistribution and use in source and binary forms -- with or without - * modification -- are permitted for any purpose, provided that - * redistributions in source form retain this entire copyright notice and - * indicate the origin and nature of any modifications. - * - * I'd appreciate being given credit for this package in the documentation - * of software which uses it, but that is not a requirement. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Header$ - * - * - * Note that there are some incestuous relationships between this code and - * NFA arc maintenance, which perhaps ought to be cleaned up sometime. - */ - - - -#define CISERR() VISERR(cm->v) -#define CERR(e) VERR(cm->v, (e)) - - - -/* - * initcm - set up new colormap - */ -static void -initcm(struct vars * v, - struct colormap * cm) -{ - int i; - int j; - union tree *t; - union tree *nextt; - struct colordesc *cd; - - cm->magic = CMMAGIC; - cm->v = v; - - cm->ncds = NINLINECDS; - cm->cd = cm->cdspace; - cm->max = 0; - cm->free = 0; - - cd = cm->cd; /* cm->cd[WHITE] */ - cd->sub = NOSUB; - cd->arcs = NULL; - cd->flags = 0; - cd->nchrs = CHR_MAX - CHR_MIN + 1; - - /* upper levels of tree */ - for (t = &cm->tree[0], j = NBYTS - 1; j > 0; t = nextt, j--) - { - nextt = t + 1; - for (i = BYTTAB - 1; i >= 0; i--) - t->tptr[i] = nextt; - } - /* bottom level is solid white */ - t = &cm->tree[NBYTS - 1]; - for (i = BYTTAB - 1; i >= 0; i--) - t->tcolor[i] = WHITE; - cd->block = t; -} - -/* - * freecm - free dynamically-allocated things in a colormap - */ -static void -freecm(struct colormap * cm) -{ - size_t i; - union tree *cb; - - cm->magic = 0; - if (NBYTS > 1) - cmtreefree(cm, cm->tree, 0); - for (i = 1; i <= cm->max; i++) /* skip WHITE */ - if (!UNUSEDCOLOR(&cm->cd[i])) - { - cb = cm->cd[i].block; - if (cb != NULL) - FREE(cb); - } - if (cm->cd != cm->cdspace) - FREE(cm->cd); -} - -/* - * cmtreefree - free a non-terminal part of a colormap tree - */ -static void -cmtreefree(struct colormap * cm, - union tree * tree, - int level) /* level number (top == 0) of this block */ -{ - int i; - union tree *t; - union tree *fillt = &cm->tree[level + 1]; - union tree *cb; - - assert(level < NBYTS - 1); /* this level has pointers */ - for (i = BYTTAB - 1; i >= 0; i--) - { - t = tree->tptr[i]; - assert(t != NULL); - if (t != fillt) - { - if (level < NBYTS - 2) - { /* more pointer blocks below */ - cmtreefree(cm, t, level + 1); - FREE(t); - } - else - { /* color block below */ - cb = cm->cd[t->tcolor[0]].block; - if (t != cb) /* not a solid block */ - FREE(t); - } - } - } -} - -/* - * setcolor - set the color of a character in a colormap - */ -static color /* previous color */ -setcolor(struct colormap * cm, - chr c, - pcolor co) -{ - uchr uc = c; - int shift; - int level; - int b; - int bottom; - union tree *t; - union tree *newt; - union tree *fillt; - union tree *lastt; - union tree *cb; - color prev; - - assert(cm->magic == CMMAGIC); - if (CISERR() || co == COLORLESS) - return COLORLESS; - - t = cm->tree; - for (level = 0, shift = BYTBITS * (NBYTS - 1); shift > 0; - level++, shift -= BYTBITS) - { - b = (uc >> shift) & BYTMASK; - lastt = t; - t = lastt->tptr[b]; - assert(t != NULL); - fillt = &cm->tree[level + 1]; - bottom = (shift <= BYTBITS) ? 1 : 0; - cb = (bottom) ? cm->cd[t->tcolor[0]].block : fillt; - if (t == fillt || t == cb) - { /* must allocate a new block */ - newt = (union tree *) MALLOC((bottom) ? - sizeof(struct colors) : sizeof(struct ptrs)); - if (newt == NULL) - { - CERR(REG_ESPACE); - return COLORLESS; - } - if (bottom) - memcpy(VS(newt->tcolor), VS(t->tcolor), - BYTTAB * sizeof(color)); - else - memcpy(VS(newt->tptr), VS(t->tptr), - BYTTAB * sizeof(union tree *)); - t = newt; - lastt->tptr[b] = t; - } - } - - b = uc & BYTMASK; - prev = t->tcolor[b]; - t->tcolor[b] = (color) co; - return prev; -} - -/* - * maxcolor - report largest color number in use - */ -static color -maxcolor(struct colormap * cm) -{ - if (CISERR()) - return COLORLESS; - - return (color) cm->max; -} - -/* - * newcolor - find a new color (must be subject of setcolor at once) - * Beware: may relocate the colordescs. - */ -static color /* COLORLESS for error */ -newcolor(struct colormap * cm) -{ - struct colordesc *cd; - struct colordesc *new; - size_t n; - - if (CISERR()) - return COLORLESS; - - if (cm->free != 0) - { - assert(cm->free > 0); - assert((size_t) cm->free < cm->ncds); - cd = &cm->cd[cm->free]; - assert(UNUSEDCOLOR(cd)); - assert(cd->arcs == NULL); - cm->free = cd->sub; - } - else if (cm->max < cm->ncds - 1) - { - cm->max++; - cd = &cm->cd[cm->max]; - } - else - { - /* oops, must allocate more */ - n = cm->ncds * 2; - if (cm->cd == cm->cdspace) - { - new = (struct colordesc *) MALLOC(n * - sizeof(struct colordesc)); - if (new != NULL) - memcpy(VS(new), VS(cm->cdspace), cm->ncds * - sizeof(struct colordesc)); - } - else - new = (struct colordesc *) REALLOC(cm->cd, - n * sizeof(struct colordesc)); - if (new == NULL) - { - CERR(REG_ESPACE); - return COLORLESS; - } - cm->cd = new; - cm->ncds = n; - assert(cm->max < cm->ncds - 1); - cm->max++; - cd = &cm->cd[cm->max]; - } - - cd->nchrs = 0; - cd->sub = NOSUB; - cd->arcs = NULL; - cd->flags = 0; - cd->block = NULL; - - return (color) (cd - cm->cd); -} - -/* - * freecolor - free a color (must have no arcs or subcolor) - */ -static void -freecolor(struct colormap * cm, - pcolor co) -{ - struct colordesc *cd = &cm->cd[co]; - color pco, - nco; /* for freelist scan */ - - assert(co >= 0); - if (co == WHITE) - return; - - assert(cd->arcs == NULL); - assert(cd->sub == NOSUB); - assert(cd->nchrs == 0); - cd->flags = FREECOL; - if (cd->block != NULL) - { - FREE(cd->block); - cd->block = NULL; /* just paranoia */ - } - - if ((size_t) co == cm->max) - { - while (cm->max > WHITE && UNUSEDCOLOR(&cm->cd[cm->max])) - cm->max--; - assert(cm->free >= 0); - while ((size_t) cm->free > cm->max) - cm->free = cm->cd[cm->free].sub; - if (cm->free > 0) - { - assert(cm->free < cm->max); - pco = cm->free; - nco = cm->cd[pco].sub; - while (nco > 0) - if ((size_t) nco > cm->max) - { - /* take this one out of freelist */ - nco = cm->cd[nco].sub; - cm->cd[pco].sub = nco; - } - else - { - assert(nco < cm->max); - pco = nco; - nco = cm->cd[pco].sub; - } - } - } - else - { - cd->sub = cm->free; - cm->free = (color) (cd - cm->cd); - } -} - -/* - * pseudocolor - allocate a false color, to be managed by other means - */ -static color -pseudocolor(struct colormap * cm) -{ - color co; - - co = newcolor(cm); - if (CISERR()) - return COLORLESS; - cm->cd[co].nchrs = 1; - cm->cd[co].flags = PSEUDO; - return co; -} - -/* - * subcolor - allocate a new subcolor (if necessary) to this chr - */ -static color -subcolor(struct colormap * cm, chr c) -{ - color co; /* current color of c */ - color sco; /* new subcolor */ - - co = GETCOLOR(cm, c); - sco = newsub(cm, co); - if (CISERR()) - return COLORLESS; - assert(sco != COLORLESS); - - if (co == sco) /* already in an open subcolor */ - return co; /* rest is redundant */ - cm->cd[co].nchrs--; - cm->cd[sco].nchrs++; - setcolor(cm, c, sco); - return sco; -} - -/* - * newsub - allocate a new subcolor (if necessary) for a color - */ -static color -newsub(struct colormap * cm, - pcolor co) -{ - color sco; /* new subcolor */ - - sco = cm->cd[co].sub; - if (sco == NOSUB) - { /* color has no open subcolor */ - if (cm->cd[co].nchrs == 1) /* optimization */ - return co; - sco = newcolor(cm); /* must create subcolor */ - if (sco == COLORLESS) - { - assert(CISERR()); - return COLORLESS; - } - cm->cd[co].sub = sco; - cm->cd[sco].sub = sco; /* open subcolor points to self */ - } - assert(sco != NOSUB); - - return sco; -} - -/* - * subrange - allocate new subcolors to this range of chrs, fill in arcs - */ -static void -subrange(struct vars * v, - chr from, - chr to, - struct state * lp, - struct state * rp) -{ - uchr uf; - int i; - - assert(from <= to); - - /* first, align "from" on a tree-block boundary */ - uf = (uchr) from; - i = (int) (((uf + BYTTAB - 1) & (uchr) ~BYTMASK) - uf); - for (; from <= to && i > 0; i--, from++) - newarc(v->nfa, PLAIN, subcolor(v->cm, from), lp, rp); - if (from > to) /* didn't reach a boundary */ - return; - - /* deal with whole blocks */ - for (; to - from >= BYTTAB; from += BYTTAB) - subblock(v, from, lp, rp); - - /* clean up any remaining partial table */ - for (; from <= to; from++) - newarc(v->nfa, PLAIN, subcolor(v->cm, from), lp, rp); -} - -/* - * subblock - allocate new subcolors for one tree block of chrs, fill in arcs - */ -static void -subblock(struct vars * v, - chr start, /* first of BYTTAB chrs */ - struct state * lp, - struct state * rp) -{ - uchr uc = start; - struct colormap *cm = v->cm; - int shift; - int level; - int i; - int b; - union tree *t; - union tree *cb; - union tree *fillt; - union tree *lastt; - int previ; - int ndone; - color co; - color sco; - - assert((uc % BYTTAB) == 0); - - /* find its color block, making new pointer blocks as needed */ - t = cm->tree; - fillt = NULL; - for (level = 0, shift = BYTBITS * (NBYTS - 1); shift > 0; - level++, shift -= BYTBITS) - { - b = (uc >> shift) & BYTMASK; - lastt = t; - t = lastt->tptr[b]; - assert(t != NULL); - fillt = &cm->tree[level + 1]; - if (t == fillt && shift > BYTBITS) - { /* need new ptr block */ - t = (union tree *) MALLOC(sizeof(struct ptrs)); - if (t == NULL) - { - CERR(REG_ESPACE); - return; - } - memcpy(VS(t->tptr), VS(fillt->tptr), - BYTTAB * sizeof(union tree *)); - lastt->tptr[b] = t; - } - } - - /* special cases: fill block or solid block */ - co = t->tcolor[0]; - cb = cm->cd[co].block; - if (t == fillt || t == cb) - { - /* either way, we want a subcolor solid block */ - sco = newsub(cm, co); - t = cm->cd[sco].block; - if (t == NULL) - { /* must set it up */ - t = (union tree *) MALLOC(sizeof(struct colors)); - if (t == NULL) - { - CERR(REG_ESPACE); - return; - } - for (i = 0; i < BYTTAB; i++) - t->tcolor[i] = sco; - cm->cd[sco].block = t; - } - /* find loop must have run at least once */ - lastt->tptr[b] = t; - newarc(v->nfa, PLAIN, sco, lp, rp); - cm->cd[co].nchrs -= BYTTAB; - cm->cd[sco].nchrs += BYTTAB; - return; - } - - /* general case, a mixed block to be altered */ - i = 0; - while (i < BYTTAB) - { - co = t->tcolor[i]; - sco = newsub(cm, co); - newarc(v->nfa, PLAIN, sco, lp, rp); - previ = i; - do - { - t->tcolor[i++] = sco; - } while (i < BYTTAB && t->tcolor[i] == co); - ndone = i - previ; - cm->cd[co].nchrs -= ndone; - cm->cd[sco].nchrs += ndone; - } -} - -/* - * okcolors - promote subcolors to full colors - */ -static void -okcolors(struct nfa * nfa, - struct colormap * cm) -{ - struct colordesc *cd; - struct colordesc *end = CDEND(cm); - struct colordesc *scd; - struct arc *a; - color co; - color sco; - - for (cd = cm->cd, co = 0; cd < end; cd++, co++) - { - sco = cd->sub; - if (UNUSEDCOLOR(cd) || sco == NOSUB) - { - /* has no subcolor, no further action */ - } - else if (sco == co) - { - /* is subcolor, let parent deal with it */ - } - else if (cd->nchrs == 0) - { - /* parent empty, its arcs change color to subcolor */ - cd->sub = NOSUB; - scd = &cm->cd[sco]; - assert(scd->nchrs > 0); - assert(scd->sub == sco); - scd->sub = NOSUB; - while ((a = cd->arcs) != NULL) - { - assert(a->co == co); - /* uncolorchain(cm, a); */ - cd->arcs = a->colorchain; - a->co = sco; - /* colorchain(cm, a); */ - a->colorchain = scd->arcs; - scd->arcs = a; - } - freecolor(cm, co); - } - else - { - /* parent's arcs must gain parallel subcolor arcs */ - cd->sub = NOSUB; - scd = &cm->cd[sco]; - assert(scd->nchrs > 0); - assert(scd->sub == sco); - scd->sub = NOSUB; - for (a = cd->arcs; a != NULL; a = a->colorchain) - { - assert(a->co == co); - newarc(nfa, a->type, sco, a->from, a->to); - } - } - } -} - -/* - * colorchain - add this arc to the color chain of its color - */ -static void -colorchain(struct colormap * cm, - struct arc * a) -{ - struct colordesc *cd = &cm->cd[a->co]; - - a->colorchain = cd->arcs; - cd->arcs = a; -} - -/* - * uncolorchain - delete this arc from the color chain of its color - */ -static void -uncolorchain(struct colormap * cm, - struct arc * a) -{ - struct colordesc *cd = &cm->cd[a->co]; - struct arc *aa; - - aa = cd->arcs; - if (aa == a) /* easy case */ - cd->arcs = a->colorchain; - else - { - for (; aa != NULL && aa->colorchain != a; aa = aa->colorchain) - continue; - assert(aa != NULL); - aa->colorchain = a->colorchain; - } - a->colorchain = NULL; /* paranoia */ -} - -/* - * singleton - is this character in its own color? - */ -static int /* predicate */ -singleton(struct colormap * cm, - chr c) -{ - color co; /* color of c */ - - co = GETCOLOR(cm, c); - if (cm->cd[co].nchrs == 1 && cm->cd[co].sub == NOSUB) - return 1; - return 0; -} - -/* - * rainbow - add arcs of all full colors (but one) between specified states - */ -static void -rainbow(struct nfa * nfa, - struct colormap * cm, - int type, - pcolor but, /* COLORLESS if no exceptions */ - struct state * from, - struct state * to) -{ - struct colordesc *cd; - struct colordesc *end = CDEND(cm); - color co; - - for (cd = cm->cd, co = 0; cd < end && !CISERR(); cd++, co++) - if (!UNUSEDCOLOR(cd) && cd->sub != co && co != but && - !(cd->flags & PSEUDO)) - newarc(nfa, type, co, from, to); -} - -/* - * colorcomplement - add arcs of complementary colors - * - * The calling sequence ought to be reconciled with cloneouts(). - */ -static void -colorcomplement(struct nfa * nfa, - struct colormap * cm, - int type, - struct state * of, /* complements of this guy's PLAIN - * outarcs */ - struct state * from, - struct state * to) -{ - struct colordesc *cd; - struct colordesc *end = CDEND(cm); - color co; - - assert(of != from); - for (cd = cm->cd, co = 0; cd < end && !CISERR(); cd++, co++) - if (!UNUSEDCOLOR(cd) && !(cd->flags & PSEUDO)) - if (findarc(of, PLAIN, co) == NULL) - newarc(nfa, type, co, from, to); -} - - -#ifdef REG_DEBUG - -/* - * dumpcolors - debugging output - */ -static void -dumpcolors(struct colormap * cm, - FILE *f) -{ - struct colordesc *cd; - struct colordesc *end; - color co; - chr c; - char *has; - - fprintf(f, "max %ld\n", (long) cm->max); - if (NBYTS > 1) - fillcheck(cm, cm->tree, 0, f); - end = CDEND(cm); - for (cd = cm->cd + 1, co = 1; cd < end; cd++, co++) /* skip 0 */ - if (!UNUSEDCOLOR(cd)) - { - assert(cd->nchrs > 0); - has = (cd->block != NULL) ? "#" : ""; - if (cd->flags & PSEUDO) - fprintf(f, "#%2ld%s(ps): ", (long) co, has); - else - fprintf(f, "#%2ld%s(%2d): ", (long) co, - has, cd->nchrs); - /* it's hard to do this more efficiently */ - for (c = CHR_MIN; c < CHR_MAX; c++) - if (GETCOLOR(cm, c) == co) - dumpchr(c, f); - assert(c == CHR_MAX); - if (GETCOLOR(cm, c) == co) - dumpchr(c, f); - fprintf(f, "\n"); - } -} - -/* - * fillcheck - check proper filling of a tree - */ -static void -fillcheck(struct colormap * cm, - union tree * tree, - int level, /* level number (top == 0) of this block */ - FILE *f) -{ - int i; - union tree *t; - union tree *fillt = &cm->tree[level + 1]; - - assert(level < NBYTS - 1); /* this level has pointers */ - for (i = BYTTAB - 1; i >= 0; i--) - { - t = tree->tptr[i]; - if (t == NULL) - fprintf(f, "NULL found in filled tree!\n"); - else if (t == fillt) - { - } - else if (level < NBYTS - 2) /* more pointer blocks below */ - fillcheck(cm, t, level + 1, f); - } -} - -/* - * dumpchr - print a chr - * - * Kind of char-centric but works well enough for debug use. - */ -static void -dumpchr(chr c, - FILE *f) -{ - if (c == '\\') - fprintf(f, "\\\\"); - else if (c > ' ' && c <= '~') - putc((char) c, f); - else - fprintf(f, "\\u%04lx", (long) c); -} - -#endif /* REG_DEBUG */ diff --git a/src/regex/regc_cvec.c b/src/regex/regc_cvec.c deleted file mode 100644 index b6aa8c98f1..0000000000 --- a/src/regex/regc_cvec.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Utility functions for handling cvecs - * This file is #included by regcomp.c. - * - * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. - * - * Development of this software was funded, in part, by Cray Research Inc., - * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics - * Corporation, none of whom are responsible for the results. The author - * thanks all of them. - * - * Redistribution and use in source and binary forms -- with or without - * modification -- are permitted for any purpose, provided that - * redistributions in source form retain this entire copyright notice and - * indicate the origin and nature of any modifications. - * - * I'd appreciate being given credit for this package in the documentation - * of software which uses it, but that is not a requirement. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Header$ - * - */ - -/* - * newcvec - allocate a new cvec - */ -static struct cvec * -newcvec(int nchrs, /* to hold this many chrs... */ - int nranges, /* ... and this many ranges... */ - int nmcces) /* ... and this many MCCEs */ -{ - size_t n; - size_t nc; - struct cvec *cv; - - nc = (size_t) nchrs + (size_t) nmcces *(MAXMCCE + 1) + (size_t) nranges *2; - - n = sizeof(struct cvec) + (size_t) (nmcces - 1) * sizeof(chr *) - + nc * sizeof(chr); - cv = (struct cvec *) MALLOC(n); - if (cv == NULL) - return NULL; - cv->chrspace = nchrs; - cv->chrs = (chr *) &cv->mcces[nmcces]; /* chrs just after MCCE - * ptrs */ - cv->mccespace = nmcces; - cv->ranges = cv->chrs + nchrs + nmcces * (MAXMCCE + 1); - cv->rangespace = nranges; - return clearcvec(cv); -} - -/* - * clearcvec - clear a possibly-new cvec - * Returns pointer as convenience. - */ -static struct cvec * -clearcvec(struct cvec * cv) -{ - int i; - - assert(cv != NULL); - cv->nchrs = 0; - assert(cv->chrs == (chr *) &cv->mcces[cv->mccespace]); - cv->nmcces = 0; - cv->nmccechrs = 0; - cv->nranges = 0; - for (i = 0; i < cv->mccespace; i++) - cv->mcces[i] = NULL; - - return cv; -} - -/* - * addchr - add a chr to a cvec - */ -static void -addchr(struct cvec * cv, /* character vector */ - chr c) /* character to add */ -{ - assert(cv->nchrs < cv->chrspace - cv->nmccechrs); - cv->chrs[cv->nchrs++] = (chr) c; -} - -/* - * addrange - add a range to a cvec - */ -static void -addrange(struct cvec * cv, /* character vector */ - chr from, /* first character of range */ - chr to) /* last character of range */ -{ - assert(cv->nranges < cv->rangespace); - cv->ranges[cv->nranges * 2] = (chr) from; - cv->ranges[cv->nranges * 2 + 1] = (chr) to; - cv->nranges++; -} - -/* - * addmcce - add an MCCE to a cvec - */ -static void -addmcce(struct cvec * cv, /* character vector */ - chr *startp, /* beginning of text */ - chr *endp) /* just past end of text */ -{ - int len; - int i; - chr *s; - chr *d; - - if (startp == NULL && endp == NULL) - return; - len = endp - startp; - assert(len > 0); - assert(cv->nchrs + len < cv->chrspace - cv->nmccechrs); - assert(cv->nmcces < cv->mccespace); - d = &cv->chrs[cv->chrspace - cv->nmccechrs - len - 1]; - cv->mcces[cv->nmcces++] = d; - for (s = startp, i = len; i > 0; s++, i--) - *d++ = *s; - *d++ = 0; /* endmarker */ - assert(d == &cv->chrs[cv->chrspace - cv->nmccechrs]); - cv->nmccechrs += len + 1; -} - -/* - * haschr - does a cvec contain this chr? - */ -static int /* predicate */ -haschr(struct cvec * cv, /* character vector */ - chr c) /* character to test for */ -{ - int i; - chr *p; - - for (p = cv->chrs, i = cv->nchrs; i > 0; p++, i--) - { - if (*p == c) - return 1; - } - for (p = cv->ranges, i = cv->nranges; i > 0; p += 2, i--) - { - if ((*p <= c) && (c <= *(p + 1))) - return 1; - } - return 0; -} - -/* - * getcvec - get a cvec, remembering it as v->cv - */ -static struct cvec * -getcvec(struct vars * v, /* context */ - int nchrs, /* to hold this many chrs... */ - int nranges, /* ... and this many ranges... */ - int nmcces) /* ... and this many MCCEs */ -{ - if (v->cv != NULL && nchrs <= v->cv->chrspace && - nranges <= v->cv->rangespace && nmcces <= v->cv->mccespace) - return clearcvec(v->cv); - - if (v->cv != NULL) - freecvec(v->cv); - v->cv = newcvec(nchrs, nranges, nmcces); - if (v->cv == NULL) - ERR(REG_ESPACE); - - return v->cv; -} - -/* - * freecvec - free a cvec - */ -static void -freecvec(struct cvec * cv) -{ - FREE(cv); -} diff --git a/src/regex/regc_lex.c b/src/regex/regc_lex.c deleted file mode 100644 index a24290d1a1..0000000000 --- a/src/regex/regc_lex.c +++ /dev/null @@ -1,1146 +0,0 @@ -/* - * lexical analyzer - * This file is #included by regcomp.c. - * - * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. - * - * Development of this software was funded, in part, by Cray Research Inc., - * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics - * Corporation, none of whom are responsible for the results. The author - * thanks all of them. - * - * Redistribution and use in source and binary forms -- with or without - * modification -- are permitted for any purpose, provided that - * redistributions in source form retain this entire copyright notice and - * indicate the origin and nature of any modifications. - * - * I'd appreciate being given credit for this package in the documentation - * of software which uses it, but that is not a requirement. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Header$ - * - */ - -/* scanning macros (know about v) */ -#define ATEOS() (v->now >= v->stop) -#define HAVE(n) (v->stop - v->now >= (n)) -#define NEXT1(c) (!ATEOS() && *v->now == CHR(c)) -#define NEXT2(a,b) (HAVE(2) && *v->now == CHR(a) && *(v->now+1) == CHR(b)) -#define NEXT3(a,b,c) (HAVE(3) && *v->now == CHR(a) && \ - *(v->now+1) == CHR(b) && \ - *(v->now+2) == CHR(c)) -#define SET(c) (v->nexttype = (c)) -#define SETV(c, n) (v->nexttype = (c), v->nextvalue = (n)) -#define RET(c) return (SET(c), 1) -#define RETV(c, n) return (SETV(c, n), 1) -#define FAILW(e) return (ERR(e), 0) /* ERR does SET(EOS) */ -#define LASTTYPE(t) (v->lasttype == (t)) - -/* lexical contexts */ -#define L_ERE 1 /* mainline ERE/ARE */ -#define L_BRE 2 /* mainline BRE */ -#define L_Q 3 /* REG_QUOTE */ -#define L_EBND 4 /* ERE/ARE bound */ -#define L_BBND 5 /* BRE bound */ -#define L_BRACK 6 /* brackets */ -#define L_CEL 7 /* collating element */ -#define L_ECL 8 /* equivalence class */ -#define L_CCL 9 /* character class */ -#define INTOCON(c) (v->lexcon = (c)) -#define INCON(con) (v->lexcon == (con)) - -/* construct pointer past end of chr array */ -#define ENDOF(array) ((array) + sizeof(array)/sizeof(chr)) - -/* - * lexstart - set up lexical stuff, scan leading options - */ -static void -lexstart(struct vars * v) -{ - prefixes(v); /* may turn on new type bits etc. */ - NOERR(); - - if (v->cflags & REG_QUOTE) - { - assert(!(v->cflags & (REG_ADVANCED | REG_EXPANDED | REG_NEWLINE))); - INTOCON(L_Q); - } - else if (v->cflags & REG_EXTENDED) - { - assert(!(v->cflags & REG_QUOTE)); - INTOCON(L_ERE); - } - else - { - assert(!(v->cflags & (REG_QUOTE | REG_ADVF))); - INTOCON(L_BRE); - } - - v->nexttype = EMPTY; /* remember we were at the start */ - next(v); /* set up the first token */ -} - -/* - * prefixes - implement various special prefixes - */ -static void -prefixes(struct vars * v) -{ - /* literal string doesn't get any of this stuff */ - if (v->cflags & REG_QUOTE) - return; - - /* initial "***" gets special things */ - if (HAVE(4) && NEXT3('*', '*', '*')) - switch (*(v->now + 3)) - { - case CHR('?'): /* "***?" error, msg shows version */ - ERR(REG_BADPAT); - return; /* proceed no further */ - break; - case CHR('='): /* "***=" shifts to literal string */ - NOTE(REG_UNONPOSIX); - v->cflags |= REG_QUOTE; - v->cflags &= ~(REG_ADVANCED | REG_EXPANDED | REG_NEWLINE); - v->now += 4; - return; /* and there can be no more prefixes */ - break; - case CHR(':'): /* "***:" shifts to AREs */ - NOTE(REG_UNONPOSIX); - v->cflags |= REG_ADVANCED; - v->now += 4; - break; - default: /* otherwise *** is just an error */ - ERR(REG_BADRPT); - return; - break; - } - - /* BREs and EREs don't get embedded options */ - if ((v->cflags & REG_ADVANCED) != REG_ADVANCED) - return; - - /* embedded options (AREs only) */ - if (HAVE(3) && NEXT2('(', '?') && iscalpha(*(v->now + 2))) - { - NOTE(REG_UNONPOSIX); - v->now += 2; - for (; !ATEOS() && iscalpha(*v->now); v->now++) - switch (*v->now) - { - case CHR('b'): /* BREs (but why???) */ - v->cflags &= ~(REG_ADVANCED | REG_QUOTE); - break; - case CHR('c'): /* case sensitive */ - v->cflags &= ~REG_ICASE; - break; - case CHR('e'): /* plain EREs */ - v->cflags |= REG_EXTENDED; - v->cflags &= ~(REG_ADVF | REG_QUOTE); - break; - case CHR('i'): /* case insensitive */ - v->cflags |= REG_ICASE; - break; - case CHR('m'): /* Perloid synonym for n */ - case CHR('n'): /* \n affects ^ $ . [^ */ - v->cflags |= REG_NEWLINE; - break; - case CHR('p'): /* ~Perl, \n affects . [^ */ - v->cflags |= REG_NLSTOP; - v->cflags &= ~REG_NLANCH; - break; - case CHR('q'): /* literal string */ - v->cflags |= REG_QUOTE; - v->cflags &= ~REG_ADVANCED; - break; - case CHR('s'): /* single line, \n ordinary */ - v->cflags &= ~REG_NEWLINE; - break; - case CHR('t'): /* tight syntax */ - v->cflags &= ~REG_EXPANDED; - break; - case CHR('w'): /* weird, \n affects ^ $ only */ - v->cflags &= ~REG_NLSTOP; - v->cflags |= REG_NLANCH; - break; - case CHR('x'): /* expanded syntax */ - v->cflags |= REG_EXPANDED; - break; - default: - ERR(REG_BADOPT); - return; - } - if (!NEXT1(')')) - { - ERR(REG_BADOPT); - return; - } - v->now++; - if (v->cflags & REG_QUOTE) - v->cflags &= ~(REG_EXPANDED | REG_NEWLINE); - } -} - -/* - * lexnest - "call a subroutine", interpolating string at the lexical level - * - * Note, this is not a very general facility. There are a number of - * implicit assumptions about what sorts of strings can be subroutines. - */ -static void -lexnest(struct vars * v, - chr *beginp, /* start of interpolation */ - chr *endp) /* one past end of interpolation */ -{ - assert(v->savenow == NULL); /* only one level of nesting */ - v->savenow = v->now; - v->savestop = v->stop; - v->now = beginp; - v->stop = endp; -} - -/* - * string constants to interpolate as expansions of things like \d - */ -static chr backd[] = { /* \d */ - CHR('['), CHR('['), CHR(':'), - CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'), - CHR(':'), CHR(']'), CHR(']') -}; -static chr backD[] = { /* \D */ - CHR('['), CHR('^'), CHR('['), CHR(':'), - CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'), - CHR(':'), CHR(']'), CHR(']') -}; -static chr brbackd[] = { /* \d within brackets */ - CHR('['), CHR(':'), - CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'), - CHR(':'), CHR(']') -}; -static chr backs[] = { /* \s */ - CHR('['), CHR('['), CHR(':'), - CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'), - CHR(':'), CHR(']'), CHR(']') -}; -static chr backS[] = { /* \S */ - CHR('['), CHR('^'), CHR('['), CHR(':'), - CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'), - CHR(':'), CHR(']'), CHR(']') -}; -static chr brbacks[] = { /* \s within brackets */ - CHR('['), CHR(':'), - CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'), - CHR(':'), CHR(']') -}; -static chr backw[] = { /* \w */ - CHR('['), CHR('['), CHR(':'), - CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'), - CHR(':'), CHR(']'), CHR('_'), CHR(']') -}; -static chr backW[] = { /* \W */ - CHR('['), CHR('^'), CHR('['), CHR(':'), - CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'), - CHR(':'), CHR(']'), CHR('_'), CHR(']') -}; -static chr brbackw[] = { /* \w within brackets */ - CHR('['), CHR(':'), - CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'), - CHR(':'), CHR(']'), CHR('_') -}; - -/* - * lexword - interpolate a bracket expression for word characters - * Possibly ought to inquire whether there is a "word" character class. - */ -static void -lexword(struct vars * v) -{ - lexnest(v, backw, ENDOF(backw)); -} - -/* - * next - get next token - */ -static int /* 1 normal, 0 failure */ -next(struct vars * v) -{ - chr c; - - /* errors yield an infinite sequence of failures */ - if (ISERR()) - return 0; /* the error has set nexttype to EOS */ - - /* remember flavor of last token */ - v->lasttype = v->nexttype; - - /* REG_BOSONLY */ - if (v->nexttype == EMPTY && (v->cflags & REG_BOSONLY)) - { - /* at start of a REG_BOSONLY RE */ - RETV(SBEGIN, 0); /* same as \A */ - } - - /* if we're nested and we've hit end, return to outer level */ - if (v->savenow != NULL && ATEOS()) - { - v->now = v->savenow; - v->stop = v->savestop; - v->savenow = v->savestop = NULL; - } - - /* skip white space etc. if appropriate (not in literal or []) */ - if (v->cflags & REG_EXPANDED) - switch (v->lexcon) - { - case L_ERE: - case L_BRE: - case L_EBND: - case L_BBND: - skip(v); - break; - } - - /* handle EOS, depending on context */ - if (ATEOS()) - { - switch (v->lexcon) - { - case L_ERE: - case L_BRE: - case L_Q: - RET(EOS); - break; - case L_EBND: - case L_BBND: - FAILW(REG_EBRACE); - break; - case L_BRACK: - case L_CEL: - case L_ECL: - case L_CCL: - FAILW(REG_EBRACK); - break; - } - assert(NOTREACHED); - } - - /* okay, time to actually get a character */ - c = *v->now++; - - /* deal with the easy contexts, punt EREs to code below */ - switch (v->lexcon) - { - case L_BRE: /* punt BREs to separate function */ - return brenext(v, c); - break; - case L_ERE: /* see below */ - break; - case L_Q: /* literal strings are easy */ - RETV(PLAIN, c); - break; - case L_BBND: /* bounds are fairly simple */ - case L_EBND: - switch (c) - { - case CHR('0'): - case CHR('1'): - case CHR('2'): - case CHR('3'): - case CHR('4'): - case CHR('5'): - case CHR('6'): - case CHR('7'): - case CHR('8'): - case CHR('9'): - RETV(DIGIT, (chr) DIGITVAL(c)); - break; - case CHR(','): - RET(','); - break; - case CHR('}'): /* ERE bound ends with } */ - if (INCON(L_EBND)) - { - INTOCON(L_ERE); - if ((v->cflags & REG_ADVF) && NEXT1('?')) - { - v->now++; - NOTE(REG_UNONPOSIX); - RETV('}', 0); - } - RETV('}', 1); - } - else - FAILW(REG_BADBR); - break; - case CHR('\\'): /* BRE bound ends with \} */ - if (INCON(L_BBND) && NEXT1('}')) - { - v->now++; - INTOCON(L_BRE); - RET('}'); - } - else - FAILW(REG_BADBR); - break; - default: - FAILW(REG_BADBR); - break; - } - assert(NOTREACHED); - break; - case L_BRACK: /* brackets are not too hard */ - switch (c) - { - case CHR(']'): - if (LASTTYPE('[')) - RETV(PLAIN, c); - else - { - INTOCON((v->cflags & REG_EXTENDED) ? - L_ERE : L_BRE); - RET(']'); - } - break; - case CHR('\\'): - NOTE(REG_UBBS); - if (!(v->cflags & REG_ADVF)) - RETV(PLAIN, c); - NOTE(REG_UNONPOSIX); - if (ATEOS()) - FAILW(REG_EESCAPE); - (DISCARD) lexescape(v); - switch (v->nexttype) - { /* not all escapes okay here */ - case PLAIN: - return 1; - break; - case CCLASS: - switch (v->nextvalue) - { - case 'd': - lexnest(v, brbackd, ENDOF(brbackd)); - break; - case 's': - lexnest(v, brbacks, ENDOF(brbacks)); - break; - case 'w': - lexnest(v, brbackw, ENDOF(brbackw)); - break; - default: - FAILW(REG_EESCAPE); - break; - } - /* lexnest done, back up and try again */ - v->nexttype = v->lasttype; - return next(v); - break; - } - /* not one of the acceptable escapes */ - FAILW(REG_EESCAPE); - break; - case CHR('-'): - if (LASTTYPE('[') || NEXT1(']')) - RETV(PLAIN, c); - else - RETV(RANGE, c); - break; - case CHR('['): - if (ATEOS()) - FAILW(REG_EBRACK); - switch (*v->now++) - { - case CHR('.'): - INTOCON(L_CEL); - /* might or might not be locale-specific */ - RET(COLLEL); - break; - case CHR('='): - INTOCON(L_ECL); - NOTE(REG_ULOCALE); - RET(ECLASS); - break; - case CHR(':'): - INTOCON(L_CCL); - NOTE(REG_ULOCALE); - RET(CCLASS); - break; - default: /* oops */ - v->now--; - RETV(PLAIN, c); - break; - } - assert(NOTREACHED); - break; - default: - RETV(PLAIN, c); - break; - } - assert(NOTREACHED); - break; - case L_CEL: /* collating elements are easy */ - if (c == CHR('.') && NEXT1(']')) - { - v->now++; - INTOCON(L_BRACK); - RETV(END, '.'); - } - else - RETV(PLAIN, c); - break; - case L_ECL: /* ditto equivalence classes */ - if (c == CHR('=') && NEXT1(']')) - { - v->now++; - INTOCON(L_BRACK); - RETV(END, '='); - } - else - RETV(PLAIN, c); - break; - case L_CCL: /* ditto character classes */ - if (c == CHR(':') && NEXT1(']')) - { - v->now++; - INTOCON(L_BRACK); - RETV(END, ':'); - } - else - RETV(PLAIN, c); - break; - default: - assert(NOTREACHED); - break; - } - - /* that got rid of everything except EREs and AREs */ - assert(INCON(L_ERE)); - - /* deal with EREs and AREs, except for backslashes */ - switch (c) - { - case CHR('|'): - RET('|'); - break; - case CHR('*'): - if ((v->cflags & REG_ADVF) && NEXT1('?')) - { - v->now++; - NOTE(REG_UNONPOSIX); - RETV('*', 0); - } - RETV('*', 1); - break; - case CHR('+'): - if ((v->cflags & REG_ADVF) && NEXT1('?')) - { - v->now++; - NOTE(REG_UNONPOSIX); - RETV('+', 0); - } - RETV('+', 1); - break; - case CHR('?'): - if ((v->cflags & REG_ADVF) && NEXT1('?')) - { - v->now++; - NOTE(REG_UNONPOSIX); - RETV('?', 0); - } - RETV('?', 1); - break; - case CHR('{'): /* bounds start or plain character */ - if (v->cflags & REG_EXPANDED) - skip(v); - if (ATEOS() || !iscdigit(*v->now)) - { - NOTE(REG_UBRACES); - NOTE(REG_UUNSPEC); - RETV(PLAIN, c); - } - else - { - NOTE(REG_UBOUNDS); - INTOCON(L_EBND); - RET('{'); - } - assert(NOTREACHED); - break; - case CHR('('): /* parenthesis, or advanced extension */ - if ((v->cflags & REG_ADVF) && NEXT1('?')) - { - NOTE(REG_UNONPOSIX); - v->now++; - switch (*v->now++) - { - case CHR(':'): /* non-capturing paren */ - RETV('(', 0); - break; - case CHR('#'): /* comment */ - while (!ATEOS() && *v->now != CHR(')')) - v->now++; - if (!ATEOS()) - v->now++; - assert(v->nexttype == v->lasttype); - return next(v); - break; - case CHR('='): /* positive lookahead */ - NOTE(REG_ULOOKAHEAD); - RETV(LACON, 1); - break; - case CHR('!'): /* negative lookahead */ - NOTE(REG_ULOOKAHEAD); - RETV(LACON, 0); - break; - default: - FAILW(REG_BADRPT); - break; - } - assert(NOTREACHED); - } - if (v->cflags & REG_NOSUB) - RETV('(', 0); /* all parens non-capturing */ - else - RETV('(', 1); - break; - case CHR(')'): - if (LASTTYPE('(')) - NOTE(REG_UUNSPEC); - RETV(')', c); - break; - case CHR('['): /* easy except for [[:<:]] and [[:>:]] */ - if (HAVE(6) && *(v->now + 0) == CHR('[') && - *(v->now + 1) == CHR(':') && - (*(v->now + 2) == CHR('<') || - *(v->now + 2) == CHR('>')) && - *(v->now + 3) == CHR(':') && - *(v->now + 4) == CHR(']') && - *(v->now + 5) == CHR(']')) - { - c = *(v->now + 2); - v->now += 6; - NOTE(REG_UNONPOSIX); - RET((c == CHR('<')) ? '<' : '>'); - } - INTOCON(L_BRACK); - if (NEXT1('^')) - { - v->now++; - RETV('[', 0); - } - RETV('[', 1); - break; - case CHR('.'): - RET('.'); - break; - case CHR('^'): - RET('^'); - break; - case CHR('$'): - RET('$'); - break; - case CHR('\\'): /* mostly punt backslashes to code below */ - if (ATEOS()) - FAILW(REG_EESCAPE); - break; - default: /* ordinary character */ - RETV(PLAIN, c); - break; - } - - /* ERE/ARE backslash handling; backslash already eaten */ - assert(!ATEOS()); - if (!(v->cflags & REG_ADVF)) - { /* only AREs have non-trivial escapes */ - if (iscalnum(*v->now)) - { - NOTE(REG_UBSALNUM); - NOTE(REG_UUNSPEC); - } - RETV(PLAIN, *v->now++); - } - (DISCARD) lexescape(v); - if (ISERR()) - FAILW(REG_EESCAPE); - if (v->nexttype == CCLASS) - { /* fudge at lexical level */ - switch (v->nextvalue) - { - case 'd': - lexnest(v, backd, ENDOF(backd)); - break; - case 'D': - lexnest(v, backD, ENDOF(backD)); - break; - case 's': - lexnest(v, backs, ENDOF(backs)); - break; - case 'S': - lexnest(v, backS, ENDOF(backS)); - break; - case 'w': - lexnest(v, backw, ENDOF(backw)); - break; - case 'W': - lexnest(v, backW, ENDOF(backW)); - break; - default: - assert(NOTREACHED); - FAILW(REG_ASSERT); - break; - } - /* lexnest done, back up and try again */ - v->nexttype = v->lasttype; - return next(v); - } - /* otherwise, lexescape has already done the work */ - return !ISERR(); -} - -/* - * lexescape - parse an ARE backslash escape (backslash already eaten) - * Note slightly nonstandard use of the CCLASS type code. - */ -static int /* not actually used, but convenient for - * RETV */ -lexescape(struct vars * v) -{ - chr c; - static chr alert[] = { - CHR('a'), CHR('l'), CHR('e'), CHR('r'), CHR('t') - }; - static chr esc[] = { - CHR('E'), CHR('S'), CHR('C') - }; - chr *save; - - assert(v->cflags & REG_ADVF); - - assert(!ATEOS()); - c = *v->now++; - if (!iscalnum(c)) - RETV(PLAIN, c); - - NOTE(REG_UNONPOSIX); - switch (c) - { - case CHR('a'): - RETV(PLAIN, chrnamed(v, alert, ENDOF(alert), CHR('\007'))); - break; - case CHR('A'): - RETV(SBEGIN, 0); - break; - case CHR('b'): - RETV(PLAIN, CHR('\b')); - break; - case CHR('B'): - RETV(PLAIN, CHR('\\')); - break; - case CHR('c'): - NOTE(REG_UUNPORT); - if (ATEOS()) - FAILW(REG_EESCAPE); - RETV(PLAIN, (chr) (*v->now++ & 037)); - break; - case CHR('d'): - NOTE(REG_ULOCALE); - RETV(CCLASS, 'd'); - break; - case CHR('D'): - NOTE(REG_ULOCALE); - RETV(CCLASS, 'D'); - break; - case CHR('e'): - NOTE(REG_UUNPORT); - RETV(PLAIN, chrnamed(v, esc, ENDOF(esc), CHR('\033'))); - break; - case CHR('f'): - RETV(PLAIN, CHR('\f')); - break; - case CHR('m'): - RET('<'); - break; - case CHR('M'): - RET('>'); - break; - case CHR('n'): - RETV(PLAIN, CHR('\n')); - break; - case CHR('r'): - RETV(PLAIN, CHR('\r')); - break; - case CHR('s'): - NOTE(REG_ULOCALE); - RETV(CCLASS, 's'); - break; - case CHR('S'): - NOTE(REG_ULOCALE); - RETV(CCLASS, 'S'); - break; - case CHR('t'): - RETV(PLAIN, CHR('\t')); - break; - case CHR('u'): - c = lexdigits(v, 16, 4, 4); - if (ISERR()) - FAILW(REG_EESCAPE); - RETV(PLAIN, c); - break; - case CHR('U'): - c = lexdigits(v, 16, 8, 8); - if (ISERR()) - FAILW(REG_EESCAPE); - RETV(PLAIN, c); - break; - case CHR('v'): - RETV(PLAIN, CHR('\v')); - break; - case CHR('w'): - NOTE(REG_ULOCALE); - RETV(CCLASS, 'w'); - break; - case CHR('W'): - NOTE(REG_ULOCALE); - RETV(CCLASS, 'W'); - break; - case CHR('x'): - NOTE(REG_UUNPORT); - c = lexdigits(v, 16, 1, 255); /* REs >255 long outside - * spec */ - if (ISERR()) - FAILW(REG_EESCAPE); - RETV(PLAIN, c); - break; - case CHR('y'): - NOTE(REG_ULOCALE); - RETV(WBDRY, 0); - break; - case CHR('Y'): - NOTE(REG_ULOCALE); - RETV(NWBDRY, 0); - break; - case CHR('Z'): - RETV(SEND, 0); - break; - case CHR('1'): - case CHR('2'): - case CHR('3'): - case CHR('4'): - case CHR('5'): - case CHR('6'): - case CHR('7'): - case CHR('8'): - case CHR('9'): - save = v->now; - v->now--; /* put first digit back */ - c = lexdigits(v, 10, 1, 255); /* REs >255 long outside - * spec */ - if (ISERR()) - FAILW(REG_EESCAPE); - /* ugly heuristic (first test is "exactly 1 digit?") */ - if (v->now - save == 0 || (int) c <= v->nsubexp) - { - NOTE(REG_UBACKREF); - RETV(BACKREF, (chr) c); - } - /* oops, doesn't look like it's a backref after all... */ - v->now = save; - /* and fall through into octal number */ - case CHR('0'): - NOTE(REG_UUNPORT); - v->now--; /* put first digit back */ - c = lexdigits(v, 8, 1, 3); - if (ISERR()) - FAILW(REG_EESCAPE); - RETV(PLAIN, c); - break; - default: - assert(iscalpha(c)); - FAILW(REG_EESCAPE); /* unknown alphabetic escape */ - break; - } - assert(NOTREACHED); -} - -/* - * lexdigits - slurp up digits and return chr value - */ -static chr /* chr value; errors signalled via ERR */ -lexdigits(struct vars * v, - int base, - int minlen, - int maxlen) -{ - uchr n; /* unsigned to avoid overflow misbehavior */ - int len; - chr c; - int d; - const uchr ub = (uchr) base; - - n = 0; - for (len = 0; len < maxlen && !ATEOS(); len++) - { - c = *v->now++; - switch (c) - { - case CHR('0'): - case CHR('1'): - case CHR('2'): - case CHR('3'): - case CHR('4'): - case CHR('5'): - case CHR('6'): - case CHR('7'): - case CHR('8'): - case CHR('9'): - d = DIGITVAL(c); - break; - case CHR('a'): - case CHR('A'): - d = 10; - break; - case CHR('b'): - case CHR('B'): - d = 11; - break; - case CHR('c'): - case CHR('C'): - d = 12; - break; - case CHR('d'): - case CHR('D'): - d = 13; - break; - case CHR('e'): - case CHR('E'): - d = 14; - break; - case CHR('f'): - case CHR('F'): - d = 15; - break; - default: - v->now--; /* oops, not a digit at all */ - d = -1; - break; - } - - if (d >= base) - { /* not a plausible digit */ - v->now--; - d = -1; - } - if (d < 0) - break; /* NOTE BREAK OUT */ - n = n * ub + (uchr) d; - } - if (len < minlen) - ERR(REG_EESCAPE); - - return (chr) n; -} - -/* - * brenext - get next BRE token - * - * This is much like EREs except for all the stupid backslashes and the - * context-dependency of some things. - */ -static int /* 1 normal, 0 failure */ -brenext(struct vars * v, - chr pc) -{ - chr c = (chr) pc; - - switch (c) - { - case CHR('*'): - if (LASTTYPE(EMPTY) || LASTTYPE('(') || LASTTYPE('^')) - RETV(PLAIN, c); - RET('*'); - break; - case CHR('['): - if (HAVE(6) && *(v->now + 0) == CHR('[') && - *(v->now + 1) == CHR(':') && - (*(v->now + 2) == CHR('<') || - *(v->now + 2) == CHR('>')) && - *(v->now + 3) == CHR(':') && - *(v->now + 4) == CHR(']') && - *(v->now + 5) == CHR(']')) - { - c = *(v->now + 2); - v->now += 6; - NOTE(REG_UNONPOSIX); - RET((c == CHR('<')) ? '<' : '>'); - } - INTOCON(L_BRACK); - if (NEXT1('^')) - { - v->now++; - RETV('[', 0); - } - RETV('[', 1); - break; - case CHR('.'): - RET('.'); - break; - case CHR('^'): - if (LASTTYPE(EMPTY)) - RET('^'); - if (LASTTYPE('(')) - { - NOTE(REG_UUNSPEC); - RET('^'); - } - RETV(PLAIN, c); - break; - case CHR('$'): - if (v->cflags & REG_EXPANDED) - skip(v); - if (ATEOS()) - RET('$'); - if (NEXT2('\\', ')')) - { - NOTE(REG_UUNSPEC); - RET('$'); - } - RETV(PLAIN, c); - break; - case CHR('\\'): - break; /* see below */ - default: - RETV(PLAIN, c); - break; - } - - assert(c == CHR('\\')); - - if (ATEOS()) - FAILW(REG_EESCAPE); - - c = *v->now++; - switch (c) - { - case CHR('{'): - INTOCON(L_BBND); - NOTE(REG_UBOUNDS); - RET('{'); - break; - case CHR('('): - RETV('(', 1); - break; - case CHR(')'): - RETV(')', c); - break; - case CHR('<'): - NOTE(REG_UNONPOSIX); - RET('<'); - break; - case CHR('>'): - NOTE(REG_UNONPOSIX); - RET('>'); - break; - case CHR('1'): - case CHR('2'): - case CHR('3'): - case CHR('4'): - case CHR('5'): - case CHR('6'): - case CHR('7'): - case CHR('8'): - case CHR('9'): - NOTE(REG_UBACKREF); - RETV(BACKREF, (chr) DIGITVAL(c)); - break; - default: - if (iscalnum(c)) - { - NOTE(REG_UBSALNUM); - NOTE(REG_UUNSPEC); - } - RETV(PLAIN, c); - break; - } - - assert(NOTREACHED); -} - -/* - * skip - skip white space and comments in expanded form - */ -static void -skip(struct vars * v) -{ - chr *start = v->now; - - assert(v->cflags & REG_EXPANDED); - - for (;;) - { - while (!ATEOS() && iscspace(*v->now)) - v->now++; - if (ATEOS() || *v->now != CHR('#')) - break; /* NOTE BREAK OUT */ - assert(NEXT1('#')); - while (!ATEOS() && *v->now != CHR('\n')) - v->now++; - /* leave the newline to be picked up by the iscspace loop */ - } - - if (v->now != start) - NOTE(REG_UNONPOSIX); -} - -/* - * newline - return the chr for a newline - * - * This helps confine use of CHR to this source file. - */ -static chr -newline(void) -{ - return CHR('\n'); -} - -/* - * chrnamed - return the chr known by a given (chr string) name - * - * The code is a bit clumsy, but this routine gets only such specialized - * use that it hardly matters. - */ -static chr -chrnamed(struct vars * v, - chr *startp, /* start of name */ - chr *endp, /* just past end of name */ - chr lastresort) /* what to return if name lookup fails */ -{ - celt c; - int errsave; - int e; - struct cvec *cv; - - errsave = v->err; - v->err = 0; - c = element(v, startp, endp); - e = v->err; - v->err = errsave; - - if (e != 0) - return (chr) lastresort; - - cv = range(v, c, c, 0); - if (cv->nchrs == 0) - return (chr) lastresort; - return cv->chrs[0]; -} diff --git a/src/regex/regc_locale.c b/src/regex/regc_locale.c deleted file mode 100644 index 4e13b8488b..0000000000 --- a/src/regex/regc_locale.c +++ /dev/null @@ -1,838 +0,0 @@ -/* - * regc_locale.c -- - * - * This file contains locale-specific regexp routines. - * This file is #included by regcomp.c. - * - * Copyright (c) 1998 by Scriptics Corporation. - * - * This software is copyrighted by the Regents of the University of - * California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState - * Corporation and other parties. The following terms apply to all files - * associated with the software unless explicitly disclaimed in - * individual files. - * - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - * - * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY - * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY - * DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE - * IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE - * NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR - * MODIFICATIONS. - * - * GOVERNMENT USE: If you are acquiring this software on behalf of the - * U.S. government, the Government shall have only "Restricted Rights" - * in the software and related documentation as defined in the Federal - * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you - * are acquiring the software on behalf of the Department of Defense, the - * software shall be classified as "Commercial Computer Software" and the - * Government shall have only "Restricted Rights" as defined in Clause - * 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the - * authors grant the U.S. Government and others acting in its behalf - * permission to use and distribute the software in accordance with the - * terms specified in this license. - * - * $Header$ - */ - -int char_and_wchar_strncmp (const char* cp, const wx_wchar* wp, size_t nNum) -{ - while(*cp++ == (const char)*wp++ && --nNum){} - - return nNum; -} - -/* ASCII character-name table */ - -static struct cname -{ - char *name; - char code; -} cnames[] = - -{ - { - "NUL", '\0' - }, - { - "SOH", '\001' - }, - { - "STX", '\002' - }, - { - "ETX", '\003' - }, - { - "EOT", '\004' - }, - { - "ENQ", '\005' - }, - { - "ACK", '\006' - }, - { - "BEL", '\007' - }, - { - "alert", '\007' - }, - { - "BS", '\010' - }, - { - "backspace", '\b' - }, - { - "HT", '\011' - }, - { - "tab", '\t' - }, - { - "LF", '\012' - }, - { - "newline", '\n' - }, - { - "VT", '\013' - }, - { - "vertical-tab", '\v' - }, - { - "FF", '\014' - }, - { - "form-feed", '\f' - }, - { - "CR", '\015' - }, - { - "carriage-return", '\r' - }, - { - "SO", '\016' - }, - { - "SI", '\017' - }, - { - "DLE", '\020' - }, - { - "DC1", '\021' - }, - { - "DC2", '\022' - }, - { - "DC3", '\023' - }, - { - "DC4", '\024' - }, - { - "NAK", '\025' - }, - { - "SYN", '\026' - }, - { - "ETB", '\027' - }, - { - "CAN", '\030' - }, - { - "EM", '\031' - }, - { - "SUB", '\032' - }, - { - "ESC", '\033' - }, - { - "IS4", '\034' - }, - { - "FS", '\034' - }, - { - "IS3", '\035' - }, - { - "GS", '\035' - }, - { - "IS2", '\036' - }, - { - "RS", '\036' - }, - { - "IS1", '\037' - }, - { - "US", '\037' - }, - { - "space", ' ' - }, - { - "exclamation-mark", '!' - }, - { - "quotation-mark", '"' - }, - { - "number-sign", '#' - }, - { - "dollar-sign", '$' - }, - { - "percent-sign", '%' - }, - { - "ampersand", '&' - }, - { - "apostrophe", '\'' - }, - { - "left-parenthesis", '(' - }, - { - "right-parenthesis", ')' - }, - { - "asterisk", '*' - }, - { - "plus-sign", '+' - }, - { - "comma", ',' - }, - { - "hyphen", '-' - }, - { - "hyphen-minus", '-' - }, - { - "period", '.' - }, - { - "full-stop", '.' - }, - { - "slash", '/' - }, - { - "solidus", '/' - }, - { - "zero", '0' - }, - { - "one", '1' - }, - { - "two", '2' - }, - { - "three", '3' - }, - { - "four", '4' - }, - { - "five", '5' - }, - { - "six", '6' - }, - { - "seven", '7' - }, - { - "eight", '8' - }, - { - "nine", '9' - }, - { - "colon", ':' - }, - { - "semicolon", ';' - }, - { - "less-than-sign", '<' - }, - { - "equals-sign", '=' - }, - { - "greater-than-sign", '>' - }, - { - "question-mark", '?' - }, - { - "commercial-at", '@' - }, - { - "left-square-bracket", '[' - }, - { - "backslash", '\\' - }, - { - "reverse-solidus", '\\' - }, - { - "right-square-bracket", ']' - }, - { - "circumflex", '^' - }, - { - "circumflex-accent", '^' - }, - { - "underscore", '_' - }, - { - "low-line", '_' - }, - { - "grave-accent", '`' - }, - { - "left-brace", '{' - }, - { - "left-curly-bracket", '{' - }, - { - "vertical-line", '|' - }, - { - "right-brace", '}' - }, - { - "right-curly-bracket", '}' - }, - { - "tilde", '~' - }, - { - "DEL", '\177' - }, - { - NULL, 0 - } -}; - -/* - * some ctype functions with non-ascii-char guard - */ -static int -wx_isdigit(wx_wchar c) -{ - return (c >= 0 && c <= UCHAR_MAX && isdigit((unsigned char) c)); -} - -static int -wx_isalpha(wx_wchar c) -{ - return (c >= 0 && c <= UCHAR_MAX && isalpha((unsigned char) c)); -} - -static int -wx_isalnum(wx_wchar c) -{ - return (c >= 0 && c <= UCHAR_MAX && isalnum((unsigned char) c)); -} - -static int -wx_isupper(wx_wchar c) -{ - return (c >= 0 && c <= UCHAR_MAX && isupper((unsigned char) c)); -} - -static int -wx_islower(wx_wchar c) -{ - return (c >= 0 && c <= UCHAR_MAX && islower((unsigned char) c)); -} - -static int -wx_isgraph(wx_wchar c) -{ - return (c >= 0 && c <= UCHAR_MAX && isgraph((unsigned char) c)); -} - -static int -wx_ispunct(wx_wchar c) -{ - return (c >= 0 && c <= UCHAR_MAX && ispunct((unsigned char) c)); -} - -static int -wx_isspace(wx_wchar c) -{ - return (c >= 0 && c <= UCHAR_MAX && isspace((unsigned char) c)); -} - -static wx_wchar -wx_toupper(wx_wchar c) -{ - if (c >= 0 && c <= UCHAR_MAX) - return toupper((unsigned char) c); - return c; -} - -static wx_wchar -wx_tolower(wx_wchar c) -{ - if (c >= 0 && c <= UCHAR_MAX) - return tolower((unsigned char) c); - return c; -} - - -/* - * nmcces - how many distinct MCCEs are there? - */ -static int -nmcces(struct vars * v) -{ - /* - * No multi-character collating elements defined at the moment. - */ - return 0; -} - -/* - * nleaders - how many chrs can be first chrs of MCCEs? - */ -static int -nleaders(struct vars * v) -{ - return 0; -} - -/* - * allmcces - return a cvec with all the MCCEs of the locale - */ -static struct cvec * -allmcces(struct vars * v, /* context */ - struct cvec * cv) /* this is supposed to have enough room */ -{ - return clearcvec(cv); -} - -/* - * element - map collating-element name to celt - */ -static celt -element(struct vars * v, /* context */ - chr *startp, /* points to start of name */ - chr *endp) /* points just past end of name */ -{ - struct cname *cn; - size_t len; - - /* generic: one-chr names stand for themselves */ - assert(startp < endp); - len = endp - startp; - if (len == 1) - return *startp; - - NOTE(REG_ULOCALE); - - /* search table */ - for (cn = cnames; cn->name != NULL; cn++) - { - if (strlen(cn->name) == len && - char_and_wchar_strncmp(cn->name, startp, len) == 0) - { - break; /* NOTE BREAK OUT */ - } - } - if (cn->name != NULL) - return CHR(cn->code); - - /* couldn't find it */ - ERR(REG_ECOLLATE); - return 0; -} - -/* - * range - supply cvec for a range, including legality check - */ -static struct cvec * -range(struct vars * v, /* context */ - celt a, /* range start */ - celt b, /* range end, might equal a */ - int cases) /* case-independent? */ -{ - int nchrs; - struct cvec *cv; - celt c, - lc, - uc; - - if (a != b && !before(a, b)) - { - ERR(REG_ERANGE); - return NULL; - } - - if (!cases) - { /* easy version */ - cv = getcvec(v, 0, 1, 0); - NOERRN(); - addrange(cv, a, b); - return cv; - } - - /* - * When case-independent, it's hard to decide when cvec ranges are - * usable, so for now at least, we won't try. We allocate enough - * space for two case variants plus a little extra for the two title - * case variants. - */ - - nchrs = (b - a + 1) * 2 + 4; - - cv = getcvec(v, nchrs, 0, 0); - NOERRN(); - - for (c = a; c <= b; c++) - { - addchr(cv, c); - lc = wx_tolower((chr) c); - if (c != lc) - addchr(cv, lc); - uc = wx_toupper((chr) c); - if (c != uc) - addchr(cv, uc); - } - - return cv; -} - -/* - * before - is celt x before celt y, for purposes of range legality? - */ -static int /* predicate */ -before(celt x, celt y) -{ - /* trivial because no MCCEs */ - if (x < y) - return 1; - return 0; -} - -/* - * eclass - supply cvec for an equivalence class - * Must include case counterparts on request. - */ -static struct cvec * -eclass(struct vars * v, /* context */ - celt c, /* Collating element representing the - * equivalence class. */ - int cases) /* all cases? */ -{ - struct cvec *cv; - - /* crude fake equivalence class for testing */ - if ((v->cflags & REG_FAKE) && c == 'x') - { - cv = getcvec(v, 4, 0, 0); - addchr(cv, (chr) 'x'); - addchr(cv, (chr) 'y'); - if (cases) - { - addchr(cv, (chr) 'X'); - addchr(cv, (chr) 'Y'); - } - return cv; - } - - /* otherwise, none */ - if (cases) - return allcases(v, c); - cv = getcvec(v, 1, 0, 0); - assert(cv != NULL); - addchr(cv, (chr) c); - return cv; -} - -/* - * cclass - supply cvec for a character class - * - * Must include case counterparts on request. - */ -static struct cvec * -cclass(struct vars * v, /* context */ - chr *startp, /* where the name starts */ - chr *endp, /* just past the end of the name */ - int cases) /* case-independent? */ -{ - size_t len; - struct cvec *cv = NULL; - char **namePtr; - int i, - index; - - /* - * The following arrays define the valid character class names. - */ - - static char *classNames[] = { - "alnum", "alpha", "ascii", "blank", "cntrl", "digit", "graph", - "lower", "print", "punct", "space", "upper", "xdigit", NULL - }; - - enum classes - { - CC_ALNUM, CC_ALPHA, CC_ASCII, CC_BLANK, CC_CNTRL, CC_DIGIT, CC_GRAPH, - CC_LOWER, CC_PRINT, CC_PUNCT, CC_SPACE, CC_UPPER, CC_XDIGIT - }; - - /* - * Map the name to the corresponding enumerated value. - */ - len = endp - startp; - index = -1; - for (namePtr = classNames, i = 0; *namePtr != NULL; namePtr++, i++) - { - if (strlen(*namePtr) == len && - char_and_wchar_strncmp(*namePtr, startp, len) == 0) - { - index = i; - break; - } - } - if (index == -1) - { - ERR(REG_ECTYPE); - return NULL; - } - - /* - * Remap lower and upper to alpha if the match is case insensitive. - */ - - if (cases && - ((enum classes) index == CC_LOWER || - (enum classes) index == CC_UPPER)) - index = (int) CC_ALPHA; - - /* - * Now compute the character class contents. - * - * For the moment, assume that only char codes < 256 can be in these - * classes. - */ - - switch ((enum classes) index) - { - case CC_PRINT: - case CC_ALNUM: - cv = getcvec(v, UCHAR_MAX, 1, 0); - if (cv) - { - for (i = 0; i <= UCHAR_MAX; i++) - { - if (wx_isalpha((chr) i)) - addchr(cv, (chr) i); - } - addrange(cv, (chr) '0', (chr) '9'); - } - break; - case CC_ALPHA: - cv = getcvec(v, UCHAR_MAX, 0, 0); - if (cv) - { - for (i = 0; i <= UCHAR_MAX; i++) - { - if (wx_isalpha((chr) i)) - addchr(cv, (chr) i); - } - } - break; - case CC_ASCII: - cv = getcvec(v, 0, 1, 0); - if (cv) - addrange(cv, 0, 0x7f); - break; - case CC_BLANK: - cv = getcvec(v, 2, 0, 0); - addchr(cv, '\t'); - addchr(cv, ' '); - break; - case CC_CNTRL: - cv = getcvec(v, 0, 2, 0); - addrange(cv, 0x0, 0x1f); - addrange(cv, 0x7f, 0x9f); - break; - case CC_DIGIT: - cv = getcvec(v, 0, 1, 0); - if (cv) - addrange(cv, (chr) '0', (chr) '9'); - break; - case CC_PUNCT: - cv = getcvec(v, UCHAR_MAX, 0, 0); - if (cv) - { - for (i = 0; i <= UCHAR_MAX; i++) - { - if (wx_ispunct((chr) i)) - addchr(cv, (chr) i); - } - } - break; - case CC_XDIGIT: - cv = getcvec(v, 0, 3, 0); - if (cv) - { - addrange(cv, '0', '9'); - addrange(cv, 'a', 'f'); - addrange(cv, 'A', 'F'); - } - break; - case CC_SPACE: - cv = getcvec(v, UCHAR_MAX, 0, 0); - if (cv) - { - for (i = 0; i <= UCHAR_MAX; i++) - { - if (wx_isspace((chr) i)) - addchr(cv, (chr) i); - } - } - break; - case CC_LOWER: - cv = getcvec(v, UCHAR_MAX, 0, 0); - if (cv) - { - for (i = 0; i <= UCHAR_MAX; i++) - { - if (wx_islower((chr) i)) - addchr(cv, (chr) i); - } - } - break; - case CC_UPPER: - cv = getcvec(v, UCHAR_MAX, 0, 0); - if (cv) - { - for (i = 0; i <= UCHAR_MAX; i++) - { - if (wx_isupper((chr) i)) - addchr(cv, (chr) i); - } - } - break; - case CC_GRAPH: - cv = getcvec(v, UCHAR_MAX, 0, 0); - if (cv) - { - for (i = 0; i <= UCHAR_MAX; i++) - { - if (wx_isgraph((chr) i)) - addchr(cv, (chr) i); - } - } - break; - } - if (cv == NULL) - ERR(REG_ESPACE); - return cv; -} - -/* - * allcases - supply cvec for all case counterparts of a chr (including itself) - * - * This is a shortcut, preferably an efficient one, for simple characters; - * messy cases are done via range(). - */ -static struct cvec * -allcases(struct vars * v, /* context */ - chr pc) /* character to get case equivs of */ -{ - struct cvec *cv; - chr c = (chr) pc; - chr lc, - uc; - - lc = wx_tolower((chr) c); - uc = wx_toupper((chr) c); - - cv = getcvec(v, 2, 0, 0); - addchr(cv, lc); - if (lc != uc) - addchr(cv, uc); - return cv; -} - -/* - * cmp - chr-substring compare - * - * Backrefs need this. It should preferably be efficient. - * Note that it does not need to report anything except equal/unequal. - * Note also that the length is exact, and the comparison should not - * stop at embedded NULs! - */ -static int /* 0 for equal, nonzero for unequal */ -cmp(const chr *x, const chr *y, /* strings to compare */ - size_t len) /* exact length of comparison */ -{ - return memcmp(VS(x), VS(y), len * sizeof(chr)); -} - -/* - * casecmp - case-independent chr-substring compare - * - * REG_ICASE backrefs need this. It should preferably be efficient. - * Note that it does not need to report anything except equal/unequal. - * Note also that the length is exact, and the comparison should not - * stop at embedded NULs! - */ -static int /* 0 for equal, nonzero for unequal */ -casecmp(const chr *x, const chr *y, /* strings to compare */ - size_t len) /* exact length of comparison */ -{ - for (; len > 0; len--, x++, y++) - { - if ((*x != *y) && (wx_tolower(*x) != wx_tolower(*y))) - return 1; - } - return 0; -} diff --git a/src/regex/regc_nfa.c b/src/regex/regc_nfa.c deleted file mode 100644 index cc9f6ea2f9..0000000000 --- a/src/regex/regc_nfa.c +++ /dev/null @@ -1,1559 +0,0 @@ -/* - * NFA utilities. - * This file is #included by regcomp.c. - * - * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. - * - * Development of this software was funded, in part, by Cray Research Inc., - * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics - * Corporation, none of whom are responsible for the results. The author - * thanks all of them. - * - * Redistribution and use in source and binary forms -- with or without - * modification -- are permitted for any purpose, provided that - * redistributions in source form retain this entire copyright notice and - * indicate the origin and nature of any modifications. - * - * I'd appreciate being given credit for this package in the documentation - * of software which uses it, but that is not a requirement. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Header$ - * - * - * One or two things that technically ought to be in here - * are actually in color.c, thanks to some incestuous relationships in - * the color chains. - */ - -#define NISERR() VISERR(nfa->v) -#define NERR(e) VERR(nfa->v, (e)) - - -/* - * newnfa - set up an NFA - */ -static struct nfa * /* the NFA, or NULL */ -newnfa(struct vars * v, - struct colormap * cm, - struct nfa * parent) /* NULL if primary NFA */ -{ - struct nfa *nfa; - - nfa = (struct nfa *) MALLOC(sizeof(struct nfa)); - if (nfa == NULL) - return NULL; - - nfa->states = NULL; - nfa->slast = NULL; - nfa->free = NULL; - nfa->nstates = 0; - nfa->cm = cm; - nfa->v = v; - nfa->bos[0] = nfa->bos[1] = COLORLESS; - nfa->eos[0] = nfa->eos[1] = COLORLESS; - nfa->post = newfstate(nfa, '@'); /* number 0 */ - nfa->pre = newfstate(nfa, '>'); /* number 1 */ - nfa->parent = parent; - - nfa->init = newstate(nfa); /* may become invalid later */ - nfa->final = newstate(nfa); - if (ISERR()) - { - freenfa(nfa); - return NULL; - } - rainbow(nfa, nfa->cm, PLAIN, COLORLESS, nfa->pre, nfa->init); - newarc(nfa, '^', 1, nfa->pre, nfa->init); - newarc(nfa, '^', 0, nfa->pre, nfa->init); - rainbow(nfa, nfa->cm, PLAIN, COLORLESS, nfa->final, nfa->post); - newarc(nfa, '$', 1, nfa->final, nfa->post); - newarc(nfa, '$', 0, nfa->final, nfa->post); - - if (ISERR()) - { - freenfa(nfa); - return NULL; - } - return nfa; -} - -/* - * freenfa - free an entire NFA - */ -static void -freenfa(struct nfa * nfa) -{ - struct state *s; - - while ((s = nfa->states) != NULL) - { - s->nins = s->nouts = 0; /* don't worry about arcs */ - freestate(nfa, s); - } - while ((s = nfa->free) != NULL) - { - nfa->free = s->next; - destroystate(nfa, s); - } - - nfa->slast = NULL; - nfa->nstates = -1; - nfa->pre = NULL; - nfa->post = NULL; - FREE(nfa); -} - -/* - * newstate - allocate an NFA state, with zero flag value - */ -static struct state * /* NULL on error */ -newstate(struct nfa * nfa) -{ - struct state *s; - - if (nfa->free != NULL) - { - s = nfa->free; - nfa->free = s->next; - } - else - { - s = (struct state *) MALLOC(sizeof(struct state)); - if (s == NULL) - { - NERR(REG_ESPACE); - return NULL; - } - s->oas.next = NULL; - s->free = NULL; - s->noas = 0; - } - - assert(nfa->nstates >= 0); - s->no = nfa->nstates++; - s->flag = 0; - if (nfa->states == NULL) - nfa->states = s; - s->nins = 0; - s->ins = NULL; - s->nouts = 0; - s->outs = NULL; - s->tmp = NULL; - s->next = NULL; - if (nfa->slast != NULL) - { - assert(nfa->slast->next == NULL); - nfa->slast->next = s; - } - s->prev = nfa->slast; - nfa->slast = s; - return s; -} - -/* - * newfstate - allocate an NFA state with a specified flag value - */ -static struct state * /* NULL on error */ -newfstate(struct nfa * nfa, int flag) -{ - struct state *s; - - s = newstate(nfa); - if (s != NULL) - s->flag = (char) flag; - return s; -} - -/* - * dropstate - delete a state's inarcs and outarcs and free it - */ -static void -dropstate(struct nfa * nfa, - struct state * s) -{ - struct arc *a; - - while ((a = s->ins) != NULL) - freearc(nfa, a); - while ((a = s->outs) != NULL) - freearc(nfa, a); - freestate(nfa, s); -} - -/* - * freestate - free a state, which has no in-arcs or out-arcs - */ -static void -freestate(struct nfa * nfa, - struct state * s) -{ - assert(s != NULL); - assert(s->nins == 0 && s->nouts == 0); - - s->no = FREESTATE; - s->flag = 0; - if (s->next != NULL) - s->next->prev = s->prev; - else - { - assert(s == nfa->slast); - nfa->slast = s->prev; - } - if (s->prev != NULL) - s->prev->next = s->next; - else - { - assert(s == nfa->states); - nfa->states = s->next; - } - s->prev = NULL; - s->next = nfa->free; /* don't delete it, put it on the free - * list */ - nfa->free = s; -} - -/* - * destroystate - really get rid of an already-freed state - */ -static void -destroystate(struct nfa * nfa, - struct state * s) -{ - struct arcbatch *ab; - struct arcbatch *abnext; - - assert(s->no == FREESTATE); - for (ab = s->oas.next; ab != NULL; ab = abnext) - { - abnext = ab->next; - FREE(ab); - } - s->ins = NULL; - s->outs = NULL; - s->next = NULL; - FREE(s); -} - -/* - * newarc - set up a new arc within an NFA - */ -static void -newarc(struct nfa * nfa, - int t, - pcolor co, - struct state * from, - struct state * to) -{ - struct arc *a; - - assert(from != NULL && to != NULL); - - /* check for duplicates */ - for (a = from->outs; a != NULL; a = a->outchain) - if (a->to == to && a->co == co && a->type == t) - return; - - a = allocarc(nfa, from); - if (NISERR()) - return; - assert(a != NULL); - - a->type = t; - a->co = (color) co; - a->to = to; - a->from = from; - - /* - * Put the new arc on the beginning, not the end, of the chains. Not - * only is this easier, it has the very useful side effect that - * deleting the most-recently-added arc is the cheapest case rather - * than the most expensive one. - */ - a->inchain = to->ins; - to->ins = a; - a->outchain = from->outs; - from->outs = a; - - from->nouts++; - to->nins++; - - if (COLORED(a) && nfa->parent == NULL) - colorchain(nfa->cm, a); - - return; -} - -/* - * allocarc - allocate a new out-arc within a state - */ -static struct arc * /* NULL for failure */ -allocarc(struct nfa * nfa, - struct state * s) -{ - struct arc *a; - struct arcbatch *new; - int i; - - /* shortcut */ - if (s->free == NULL && s->noas < ABSIZE) - { - a = &s->oas.a[s->noas]; - s->noas++; - return a; - } - - /* if none at hand, get more */ - if (s->free == NULL) - { - new = (struct arcbatch *) MALLOC(sizeof(struct arcbatch)); - if (new == NULL) - { - NERR(REG_ESPACE); - return NULL; - } - new->next = s->oas.next; - s->oas.next = new; - - for (i = 0; i < ABSIZE; i++) - { - new->a[i].type = 0; - new->a[i].freechain = &new->a[i + 1]; - } - new->a[ABSIZE - 1].freechain = NULL; - s->free = &new->a[0]; - } - assert(s->free != NULL); - - a = s->free; - s->free = a->freechain; - return a; -} - -/* - * freearc - free an arc - */ -static void -freearc(struct nfa * nfa, - struct arc * victim) -{ - struct state *from = victim->from; - struct state *to = victim->to; - struct arc *a; - - assert(victim->type != 0); - - /* take it off color chain if necessary */ - if (COLORED(victim) && nfa->parent == NULL) - uncolorchain(nfa->cm, victim); - - /* take it off source's out-chain */ - assert(from != NULL); - assert(from->outs != NULL); - a = from->outs; - if (a == victim) /* simple case: first in chain */ - from->outs = victim->outchain; - else - { - for (; a != NULL && a->outchain != victim; a = a->outchain) - continue; - assert(a != NULL); - a->outchain = victim->outchain; - } - from->nouts--; - - /* take it off target's in-chain */ - assert(to != NULL); - assert(to->ins != NULL); - a = to->ins; - if (a == victim) /* simple case: first in chain */ - to->ins = victim->inchain; - else - { - for (; a != NULL && a->inchain != victim; a = a->inchain) - continue; - assert(a != NULL); - a->inchain = victim->inchain; - } - to->nins--; - - /* clean up and place on free list */ - victim->type = 0; - victim->from = NULL; /* precautions... */ - victim->to = NULL; - victim->inchain = NULL; - victim->outchain = NULL; - victim->freechain = from->free; - from->free = victim; -} - -/* - * findarc - find arc, if any, from given source with given type and color - * If there is more than one such arc, the result is random. - */ -static struct arc * -findarc(struct state * s, - int type, - pcolor co) -{ - struct arc *a; - - for (a = s->outs; a != NULL; a = a->outchain) - if (a->type == type && a->co == co) - return a; - return NULL; -} - -/* - * cparc - allocate a new arc within an NFA, copying details from old one - */ -static void -cparc(struct nfa * nfa, - struct arc * oa, - struct state * from, - struct state * to) -{ - newarc(nfa, oa->type, oa->co, from, to); -} - -/* - * moveins - move all in arcs of a state to another state - * - * You might think this could be done better by just updating the - * existing arcs, and you would be right if it weren't for the desire - * for duplicate suppression, which makes it easier to just make new - * ones to exploit the suppression built into newarc. - */ -static void -moveins(struct nfa * nfa, - struct state * old, - struct state * new) -{ - struct arc *a; - - assert(old != new); - - while ((a = old->ins) != NULL) - { - cparc(nfa, a, a->from, new); - freearc(nfa, a); - } - assert(old->nins == 0); - assert(old->ins == NULL); -} - -/* - * copyins - copy all in arcs of a state to another state - */ -static void -copyins(struct nfa * nfa, - struct state * old, - struct state * new) -{ - struct arc *a; - - assert(old != new); - - for (a = old->ins; a != NULL; a = a->inchain) - cparc(nfa, a, a->from, new); -} - -/* - * moveouts - move all out arcs of a state to another state - */ -static void -moveouts(struct nfa * nfa, - struct state * old, - struct state * new) -{ - struct arc *a; - - assert(old != new); - - while ((a = old->outs) != NULL) - { - cparc(nfa, a, new, a->to); - freearc(nfa, a); - } -} - -/* - * copyouts - copy all out arcs of a state to another state - */ -static void -copyouts(struct nfa * nfa, - struct state * old, - struct state * new) -{ - struct arc *a; - - assert(old != new); - - for (a = old->outs; a != NULL; a = a->outchain) - cparc(nfa, a, new, a->to); -} - -/* - * cloneouts - copy out arcs of a state to another state pair, modifying type - */ -static void -cloneouts(struct nfa * nfa, - struct state * old, - struct state * from, - struct state * to, - int type) -{ - struct arc *a; - - assert(old != from); - - for (a = old->outs; a != NULL; a = a->outchain) - newarc(nfa, type, a->co, from, to); -} - -/* - * delsub - delete a sub-NFA, updating subre pointers if necessary - * - * This uses a recursive traversal of the sub-NFA, marking already-seen - * states using their tmp pointer. - */ -static void -delsub(struct nfa * nfa, - struct state * lp, /* the sub-NFA goes from here... */ - struct state * rp) /* ...to here, *not* inclusive */ -{ - assert(lp != rp); - - rp->tmp = rp; /* mark end */ - - deltraverse(nfa, lp, lp); - assert(lp->nouts == 0 && rp->nins == 0); /* did the job */ - assert(lp->no != FREESTATE && rp->no != FREESTATE); /* no more */ - - rp->tmp = NULL; /* unmark end */ - lp->tmp = NULL; /* and begin, marked by deltraverse */ -} - -/* - * deltraverse - the recursive heart of delsub - * This routine's basic job is to destroy all out-arcs of the state. - */ -static void -deltraverse(struct nfa * nfa, - struct state * leftend, - struct state * s) -{ - struct arc *a; - struct state *to; - - if (s->nouts == 0) - return; /* nothing to do */ - if (s->tmp != NULL) - return; /* already in progress */ - - s->tmp = s; /* mark as in progress */ - - while ((a = s->outs) != NULL) - { - to = a->to; - deltraverse(nfa, leftend, to); - assert(to->nouts == 0 || to->tmp != NULL); - freearc(nfa, a); - if (to->nins == 0 && to->tmp == NULL) - { - assert(to->nouts == 0); - freestate(nfa, to); - } - } - - assert(s->no != FREESTATE); /* we're still here */ - assert(s == leftend || s->nins != 0); /* and still reachable */ - assert(s->nouts == 0); /* but have no outarcs */ - - s->tmp = NULL; /* we're done here */ -} - -/* - * dupnfa - duplicate sub-NFA - * - * Another recursive traversal, this time using tmp to point to duplicates - * as well as mark already-seen states. (You knew there was a reason why - * it's a state pointer, didn't you? :-)) - */ -static void -dupnfa(struct nfa * nfa, - struct state * start, /* duplicate of subNFA starting here */ - struct state * stop, /* and stopping here */ - struct state * from, /* stringing duplicate from here */ - struct state * to) /* to here */ -{ - if (start == stop) - { - newarc(nfa, EMPTY, 0, from, to); - return; - } - - stop->tmp = to; - duptraverse(nfa, start, from); - /* done, except for clearing out the tmp pointers */ - - stop->tmp = NULL; - cleartraverse(nfa, start); -} - -/* - * duptraverse - recursive heart of dupnfa - */ -static void -duptraverse(struct nfa * nfa, - struct state * s, - struct state * stmp) /* s's duplicate, or NULL */ -{ - struct arc *a; - - if (s->tmp != NULL) - return; /* already done */ - - s->tmp = (stmp == NULL) ? newstate(nfa) : stmp; - if (s->tmp == NULL) - { - assert(NISERR()); - return; - } - - for (a = s->outs; a != NULL && !NISERR(); a = a->outchain) - { - duptraverse(nfa, a->to, (struct state *) NULL); - assert(a->to->tmp != NULL); - cparc(nfa, a, s->tmp, a->to->tmp); - } -} - -/* - * cleartraverse - recursive cleanup for algorithms that leave tmp ptrs set - */ -static void -cleartraverse(struct nfa * nfa, - struct state * s) -{ - struct arc *a; - - if (s->tmp == NULL) - return; - s->tmp = NULL; - - for (a = s->outs; a != NULL; a = a->outchain) - cleartraverse(nfa, a->to); -} - -/* - * specialcolors - fill in special colors for an NFA - */ -static void -specialcolors(struct nfa * nfa) -{ - /* false colors for BOS, BOL, EOS, EOL */ - if (nfa->parent == NULL) - { - nfa->bos[0] = pseudocolor(nfa->cm); - nfa->bos[1] = pseudocolor(nfa->cm); - nfa->eos[0] = pseudocolor(nfa->cm); - nfa->eos[1] = pseudocolor(nfa->cm); - } - else - { - assert(nfa->parent->bos[0] != COLORLESS); - nfa->bos[0] = nfa->parent->bos[0]; - assert(nfa->parent->bos[1] != COLORLESS); - nfa->bos[1] = nfa->parent->bos[1]; - assert(nfa->parent->eos[0] != COLORLESS); - nfa->eos[0] = nfa->parent->eos[0]; - assert(nfa->parent->eos[1] != COLORLESS); - nfa->eos[1] = nfa->parent->eos[1]; - } -} - -/* - * optimize - optimize an NFA - */ -static long /* re_info bits */ -optimize(struct nfa * nfa, - FILE *f) /* for debug output; NULL none */ -{ -#ifdef REG_DEBUG - int verbose = (f != NULL) ? 1 : 0; - - if (verbose) - fprintf(f, "\ninitial cleanup:\n"); -#endif - cleanup(nfa); /* may simplify situation */ -#ifdef REG_DEBUG - if (verbose) - dumpnfa(nfa, f); - if (verbose) - fprintf(f, "\nempties:\n"); -#endif - fixempties(nfa, f); /* get rid of EMPTY arcs */ -#ifdef REG_DEBUG - if (verbose) - fprintf(f, "\nconstraints:\n"); -#endif - pullback(nfa, f); /* pull back constraints backward */ - pushfwd(nfa, f); /* push fwd constraints forward */ -#ifdef REG_DEBUG - if (verbose) - fprintf(f, "\nfinal cleanup:\n"); -#endif - cleanup(nfa); /* final tidying */ - return analyze(nfa); /* and analysis */ -} - -/* - * pullback - pull back constraints backward to (with luck) eliminate them - */ -static void -pullback(struct nfa * nfa, - FILE *f) /* for debug output; NULL none */ -{ - struct state *s; - struct state *nexts; - struct arc *a; - struct arc *nexta; - int progress; - - /* find and pull until there are no more */ - do - { - progress = 0; - for (s = nfa->states; s != NULL && !NISERR(); s = nexts) - { - nexts = s->next; - for (a = s->outs; a != NULL && !NISERR(); a = nexta) - { - nexta = a->outchain; - if (a->type == '^' || a->type == BEHIND) - if (pull(nfa, a)) - progress = 1; - assert(nexta == NULL || s->no != FREESTATE); - } - } - if (progress && f != NULL) - dumpnfa(nfa, f); - } while (progress && !NISERR()); - if (NISERR()) - return; - - for (a = nfa->pre->outs; a != NULL; a = nexta) - { - nexta = a->outchain; - if (a->type == '^') - { - assert(a->co == 0 || a->co == 1); - newarc(nfa, PLAIN, nfa->bos[a->co], a->from, a->to); - freearc(nfa, a); - } - } -} - -/* - * pull - pull a back constraint backward past its source state - * A significant property of this function is that it deletes at most - * one state -- the constraint's from state -- and only if the constraint - * was that state's last outarc. - */ -static int /* 0 couldn't, 1 could */ -pull(struct nfa * nfa, - struct arc * con) -{ - struct state *from = con->from; - struct state *to = con->to; - struct arc *a; - struct arc *nexta; - struct state *s; - - if (from == to) - { /* circular constraint is pointless */ - freearc(nfa, con); - return 1; - } - if (from->flag) /* can't pull back beyond start */ - return 0; - if (from->nins == 0) - { /* unreachable */ - freearc(nfa, con); - return 1; - } - - /* first, clone from state if necessary to avoid other outarcs */ - if (from->nouts > 1) - { - s = newstate(nfa); - if (NISERR()) - return 0; - assert(to != from); /* con is not an inarc */ - copyins(nfa, from, s); /* duplicate inarcs */ - cparc(nfa, con, s, to); /* move constraint arc */ - freearc(nfa, con); - from = s; - con = from->outs; - } - assert(from->nouts == 1); - - /* propagate the constraint into the from state's inarcs */ - for (a = from->ins; a != NULL; a = nexta) - { - nexta = a->inchain; - switch (combine(con, a)) - { - case INCOMPATIBLE: /* destroy the arc */ - freearc(nfa, a); - break; - case SATISFIED: /* no action needed */ - break; - case COMPATIBLE: /* swap the two arcs, more or less */ - s = newstate(nfa); - if (NISERR()) - return 0; - cparc(nfa, a, s, to); /* anticipate move */ - cparc(nfa, con, a->from, s); - if (NISERR()) - return 0; - freearc(nfa, a); - break; - default: - assert(NOTREACHED); - break; - } - } - - /* remaining inarcs, if any, incorporate the constraint */ - moveins(nfa, from, to); - dropstate(nfa, from); /* will free the constraint */ - return 1; -} - -/* - * pushfwd - push forward constraints forward to (with luck) eliminate them - */ -static void -pushfwd(struct nfa * nfa, - FILE *f) /* for debug output; NULL none */ -{ - struct state *s; - struct state *nexts; - struct arc *a; - struct arc *nexta; - int progress; - - /* find and push until there are no more */ - do - { - progress = 0; - for (s = nfa->states; s != NULL && !NISERR(); s = nexts) - { - nexts = s->next; - for (a = s->ins; a != NULL && !NISERR(); a = nexta) - { - nexta = a->inchain; - if (a->type == '$' || a->type == AHEAD) - if (push(nfa, a)) - progress = 1; - assert(nexta == NULL || s->no != FREESTATE); - } - } - if (progress && f != NULL) - dumpnfa(nfa, f); - } while (progress && !NISERR()); - if (NISERR()) - return; - - for (a = nfa->post->ins; a != NULL; a = nexta) - { - nexta = a->inchain; - if (a->type == '$') - { - assert(a->co == 0 || a->co == 1); - newarc(nfa, PLAIN, nfa->eos[a->co], a->from, a->to); - freearc(nfa, a); - } - } -} - -/* - * push - push a forward constraint forward past its destination state - * A significant property of this function is that it deletes at most - * one state -- the constraint's to state -- and only if the constraint - * was that state's last inarc. - */ -static int /* 0 couldn't, 1 could */ -push(struct nfa * nfa, - struct arc * con) -{ - struct state *from = con->from; - struct state *to = con->to; - struct arc *a; - struct arc *nexta; - struct state *s; - - if (to == from) - { /* circular constraint is pointless */ - freearc(nfa, con); - return 1; - } - if (to->flag) /* can't push forward beyond end */ - return 0; - if (to->nouts == 0) - { /* dead end */ - freearc(nfa, con); - return 1; - } - - /* first, clone to state if necessary to avoid other inarcs */ - if (to->nins > 1) - { - s = newstate(nfa); - if (NISERR()) - return 0; - copyouts(nfa, to, s); /* duplicate outarcs */ - cparc(nfa, con, from, s); /* move constraint */ - freearc(nfa, con); - to = s; - con = to->ins; - } - assert(to->nins == 1); - - /* propagate the constraint into the to state's outarcs */ - for (a = to->outs; a != NULL; a = nexta) - { - nexta = a->outchain; - switch (combine(con, a)) - { - case INCOMPATIBLE: /* destroy the arc */ - freearc(nfa, a); - break; - case SATISFIED: /* no action needed */ - break; - case COMPATIBLE: /* swap the two arcs, more or less */ - s = newstate(nfa); - if (NISERR()) - return 0; - cparc(nfa, con, s, a->to); /* anticipate move */ - cparc(nfa, a, from, s); - if (NISERR()) - return 0; - freearc(nfa, a); - break; - default: - assert(NOTREACHED); - break; - } - } - - /* remaining outarcs, if any, incorporate the constraint */ - moveouts(nfa, to, from); - dropstate(nfa, to); /* will free the constraint */ - return 1; -} - -/* - * combine - constraint lands on an arc, what happens? - * - * #def INCOMPATIBLE 1 // destroys arc - * #def SATISFIED 2 // constraint satisfied - * #def COMPATIBLE 3 // compatible but not satisfied yet - */ -static int -combine(struct arc * con, - struct arc * a) -{ -#define CA(ct,at) (((ct)<type, a->type)) - { - case CA('^', PLAIN): /* newlines are handled separately */ - case CA('$', PLAIN): - return INCOMPATIBLE; - break; - case CA(AHEAD, PLAIN): /* color constraints meet colors */ - case CA(BEHIND, PLAIN): - if (con->co == a->co) - return SATISFIED; - return INCOMPATIBLE; - break; - case CA('^', '^'): /* collision, similar constraints */ - case CA('$', '$'): - case CA(AHEAD, AHEAD): - case CA(BEHIND, BEHIND): - if (con->co == a->co) /* true duplication */ - return SATISFIED; - return INCOMPATIBLE; - break; - case CA('^', BEHIND): /* collision, dissimilar constraints */ - case CA(BEHIND, '^'): - case CA('$', AHEAD): - case CA(AHEAD, '$'): - return INCOMPATIBLE; - break; - case CA('^', '$'): /* constraints passing each other */ - case CA('^', AHEAD): - case CA(BEHIND, '$'): - case CA(BEHIND, AHEAD): - case CA('$', '^'): - case CA('$', BEHIND): - case CA(AHEAD, '^'): - case CA(AHEAD, BEHIND): - case CA('^', LACON): - case CA(BEHIND, LACON): - case CA('$', LACON): - case CA(AHEAD, LACON): - return COMPATIBLE; - break; - } - assert(NOTREACHED); - return INCOMPATIBLE; /* for benefit of blind compilers */ -} - -/* - * fixempties - get rid of EMPTY arcs - */ -static void -fixempties(struct nfa * nfa, - FILE *f) /* for debug output; NULL none */ -{ - struct state *s; - struct state *nexts; - struct arc *a; - struct arc *nexta; - int progress; - - /* find and eliminate empties until there are no more */ - do - { - progress = 0; - for (s = nfa->states; s != NULL && !NISERR(); s = nexts) - { - nexts = s->next; - for (a = s->outs; a != NULL && !NISERR(); a = nexta) - { - nexta = a->outchain; - if (a->type == EMPTY && unempty(nfa, a)) - progress = 1; - assert(nexta == NULL || s->no != FREESTATE); - } - } - if (progress && f != NULL) - dumpnfa(nfa, f); - } while (progress && !NISERR()); -} - -/* - * unempty - optimize out an EMPTY arc, if possible - * - * Actually, as it stands this function always succeeds, but the return - * value is kept with an eye on possible future changes. - */ -static int /* 0 couldn't, 1 could */ -unempty(struct nfa * nfa, - struct arc * a) -{ - struct state *from = a->from; - struct state *to = a->to; - int usefrom; /* work on from, as opposed to to? */ - - assert(a->type == EMPTY); - assert(from != nfa->pre && to != nfa->post); - - if (from == to) - { /* vacuous loop */ - freearc(nfa, a); - return 1; - } - - /* decide which end to work on */ - usefrom = 1; /* default: attack from */ - if (from->nouts > to->nins) - usefrom = 0; - else if (from->nouts == to->nins) - { - /* decide on secondary issue: move/copy fewest arcs */ - if (from->nins > to->nouts) - usefrom = 0; - } - - freearc(nfa, a); - if (usefrom) - { - if (from->nouts == 0) - { - /* was the state's only outarc */ - moveins(nfa, from, to); - freestate(nfa, from); - } - else - copyins(nfa, from, to); - } - else - { - if (to->nins == 0) - { - /* was the state's only inarc */ - moveouts(nfa, to, from); - freestate(nfa, to); - } - else - copyouts(nfa, to, from); - } - - return 1; -} - -/* - * cleanup - clean up NFA after optimizations - */ -static void -cleanup(struct nfa * nfa) -{ - struct state *s; - struct state *nexts; - int n; - - /* clear out unreachable or dead-end states */ - /* use pre to mark reachable, then post to mark can-reach-post */ - markreachable(nfa, nfa->pre, (struct state *) NULL, nfa->pre); - markcanreach(nfa, nfa->post, nfa->pre, nfa->post); - for (s = nfa->states; s != NULL; s = nexts) - { - nexts = s->next; - if (s->tmp != nfa->post && !s->flag) - dropstate(nfa, s); - } - assert(nfa->post->nins == 0 || nfa->post->tmp == nfa->post); - cleartraverse(nfa, nfa->pre); - assert(nfa->post->nins == 0 || nfa->post->tmp == NULL); - /* the nins==0 (final unreachable) case will be caught later */ - - /* renumber surviving states */ - n = 0; - for (s = nfa->states; s != NULL; s = s->next) - s->no = n++; - nfa->nstates = n; -} - -/* - * markreachable - recursive marking of reachable states - */ -static void -markreachable(struct nfa * nfa, - struct state * s, - struct state * okay, /* consider only states with this - * mark */ - struct state * mark) /* the value to mark with */ -{ - struct arc *a; - - if (s->tmp != okay) - return; - s->tmp = mark; - - for (a = s->outs; a != NULL; a = a->outchain) - markreachable(nfa, a->to, okay, mark); -} - -/* - * markcanreach - recursive marking of states which can reach here - */ -static void -markcanreach(struct nfa * nfa, - struct state * s, - struct state * okay, /* consider only states with this - * mark */ - struct state * mark) /* the value to mark with */ -{ - struct arc *a; - - if (s->tmp != okay) - return; - s->tmp = mark; - - for (a = s->ins; a != NULL; a = a->inchain) - markcanreach(nfa, a->from, okay, mark); -} - -/* - * analyze - ascertain potentially-useful facts about an optimized NFA - */ -static long /* re_info bits to be ORed in */ -analyze(struct nfa * nfa) -{ - struct arc *a; - struct arc *aa; - - if (nfa->pre->outs == NULL) - return REG_UIMPOSSIBLE; - for (a = nfa->pre->outs; a != NULL; a = a->outchain) - for (aa = a->to->outs; aa != NULL; aa = aa->outchain) - if (aa->to == nfa->post) - return REG_UEMPTYMATCH; - return 0; -} - -/* - * compact - compact an NFA - */ -static void -compact(struct nfa * nfa, - struct cnfa * cnfa) -{ - struct state *s; - struct arc *a; - size_t nstates; - size_t narcs; - struct carc *ca; - struct carc *first; - - assert(!NISERR()); - - nstates = 0; - narcs = 0; - for (s = nfa->states; s != NULL; s = s->next) - { - nstates++; - narcs += 1 + s->nouts + 1; - /* 1 as a fake for flags, nouts for arcs, 1 as endmarker */ - } - - cnfa->states = (struct carc **) MALLOC(nstates * sizeof(struct carc *)); - cnfa->arcs = (struct carc *) MALLOC(narcs * sizeof(struct carc)); - if (cnfa->states == NULL || cnfa->arcs == NULL) - { - if (cnfa->states != NULL) - FREE(cnfa->states); - if (cnfa->arcs != NULL) - FREE(cnfa->arcs); - NERR(REG_ESPACE); - return; - } - cnfa->nstates = nstates; - cnfa->pre = nfa->pre->no; - cnfa->post = nfa->post->no; - cnfa->bos[0] = nfa->bos[0]; - cnfa->bos[1] = nfa->bos[1]; - cnfa->eos[0] = nfa->eos[0]; - cnfa->eos[1] = nfa->eos[1]; - cnfa->ncolors = maxcolor(nfa->cm) + 1; - cnfa->flags = 0; - - ca = cnfa->arcs; - for (s = nfa->states; s != NULL; s = s->next) - { - assert((size_t) s->no < nstates); - cnfa->states[s->no] = ca; - ca->co = 0; /* clear and skip flags "arc" */ - ca++; - first = ca; - for (a = s->outs; a != NULL; a = a->outchain) - switch (a->type) - { - case PLAIN: - ca->co = a->co; - ca->to = a->to->no; - ca++; - break; - case LACON: - assert(s->no != cnfa->pre); - ca->co = (color) (cnfa->ncolors + a->co); - ca->to = a->to->no; - ca++; - cnfa->flags |= HASLACONS; - break; - default: - assert(NOTREACHED); - break; - } - carcsort(first, ca - 1); - ca->co = COLORLESS; - ca->to = 0; - ca++; - } - assert(ca == &cnfa->arcs[narcs]); - assert(cnfa->nstates != 0); - - /* mark no-progress states */ - for (a = nfa->pre->outs; a != NULL; a = a->outchain) - cnfa->states[a->to->no]->co = 1; - cnfa->states[nfa->pre->no]->co = 1; -} - -/* - * carcsort - sort compacted-NFA arcs by color - * - * Really dumb algorithm, but if the list is long enough for that to matter, - * you're in real trouble anyway. - */ -static void -carcsort(struct carc * first, - struct carc * last) -{ - struct carc *p; - struct carc *q; - struct carc tmp; - - if (last - first <= 1) - return; - - for (p = first; p <= last; p++) - for (q = p; q <= last; q++) - if (p->co > q->co || - (p->co == q->co && p->to > q->to)) - { - assert(p != q); - tmp = *p; - *p = *q; - *q = tmp; - } -} - -/* - * freecnfa - free a compacted NFA - */ -static void -freecnfa(struct cnfa * cnfa) -{ - assert(cnfa->nstates != 0); /* not empty already */ - cnfa->nstates = 0; - FREE(cnfa->states); - FREE(cnfa->arcs); -} - -/* - * dumpnfa - dump an NFA in human-readable form - */ -static void -dumpnfa(struct nfa * nfa, - FILE *f) -{ -#ifdef REG_DEBUG - struct state *s; - - fprintf(f, "pre %d, post %d", nfa->pre->no, nfa->post->no); - if (nfa->bos[0] != COLORLESS) - fprintf(f, ", bos [%ld]", (long) nfa->bos[0]); - if (nfa->bos[1] != COLORLESS) - fprintf(f, ", bol [%ld]", (long) nfa->bos[1]); - if (nfa->eos[0] != COLORLESS) - fprintf(f, ", eos [%ld]", (long) nfa->eos[0]); - if (nfa->eos[1] != COLORLESS) - fprintf(f, ", eol [%ld]", (long) nfa->eos[1]); - fprintf(f, "\n"); - for (s = nfa->states; s != NULL; s = s->next) - dumpstate(s, f); - if (nfa->parent == NULL) - dumpcolors(nfa->cm, f); - fflush(f); -#endif -} - -#ifdef REG_DEBUG /* subordinates of dumpnfa */ - -/* - * dumpstate - dump an NFA state in human-readable form - */ -static void -dumpstate(struct state * s, - FILE *f) -{ - struct arc *a; - - fprintf(f, "%d%s%c", s->no, (s->tmp != NULL) ? "T" : "", - (s->flag) ? s->flag : '.'); - if (s->prev != NULL && s->prev->next != s) - fprintf(f, "\tstate chain bad\n"); - if (s->nouts == 0) - fprintf(f, "\tno out arcs\n"); - else - dumparcs(s, f); - fflush(f); - for (a = s->ins; a != NULL; a = a->inchain) - { - if (a->to != s) - fprintf(f, "\tlink from %d to %d on %d's in-chain\n", - a->from->no, a->to->no, s->no); - } -} - -/* - * dumparcs - dump out-arcs in human-readable form - */ -static void -dumparcs(struct state * s, - FILE *f) -{ - int pos; - - assert(s->nouts > 0); - /* printing arcs in reverse order is usually clearer */ - pos = dumprarcs(s->outs, s, f, 1); - if (pos != 1) - fprintf(f, "\n"); -} - -/* - * dumprarcs - dump remaining outarcs, recursively, in reverse order - */ -static int /* resulting print position */ -dumprarcs(struct arc * a, - struct state * s, - FILE *f, - int pos) /* initial print position */ -{ - if (a->outchain != NULL) - pos = dumprarcs(a->outchain, s, f, pos); - dumparc(a, s, f); - if (pos == 5) - { - fprintf(f, "\n"); - pos = 1; - } - else - pos++; - return pos; -} - -/* - * dumparc - dump one outarc in readable form, including prefixing tab - */ -static void -dumparc(struct arc * a, - struct state * s, - FILE *f) -{ - struct arc *aa; - struct arcbatch *ab; - - fprintf(f, "\t"); - switch (a->type) - { - case PLAIN: - fprintf(f, "[%ld]", (long) a->co); - break; - case AHEAD: - fprintf(f, ">%ld>", (long) a->co); - break; - case BEHIND: - fprintf(f, "<%ld<", (long) a->co); - break; - case LACON: - fprintf(f, ":%ld:", (long) a->co); - break; - case '^': - case '$': - fprintf(f, "%c%d", a->type, (int) a->co); - break; - case EMPTY: - break; - default: - fprintf(f, "0x%x/0%lo", a->type, (long) a->co); - break; - } - if (a->from != s) - fprintf(f, "?%d?", a->from->no); - for (ab = &a->from->oas; ab != NULL; ab = ab->next) - { - for (aa = &ab->a[0]; aa < &ab->a[ABSIZE]; aa++) - if (aa == a) - break; /* NOTE BREAK OUT */ - if (aa < &ab->a[ABSIZE]) /* propagate break */ - break; /* NOTE BREAK OUT */ - } - if (ab == NULL) - fprintf(f, "?!?"); /* not in allocated space */ - fprintf(f, "->"); - if (a->to == NULL) - { - fprintf(f, "NULL"); - return; - } - fprintf(f, "%d", a->to->no); - for (aa = a->to->ins; aa != NULL; aa = aa->inchain) - if (aa == a) - break; /* NOTE BREAK OUT */ - if (aa == NULL) - fprintf(f, "?!?"); /* missing from in-chain */ -} -#endif /* REG_DEBUG */ - -/* - * dumpcnfa - dump a compacted NFA in human-readable form - */ -#ifdef REG_DEBUG -static void -dumpcnfa(struct cnfa * cnfa, - FILE *f) -{ - int st; - - fprintf(f, "pre %d, post %d", cnfa->pre, cnfa->post); - if (cnfa->bos[0] != COLORLESS) - fprintf(f, ", bos [%ld]", (long) cnfa->bos[0]); - if (cnfa->bos[1] != COLORLESS) - fprintf(f, ", bol [%ld]", (long) cnfa->bos[1]); - if (cnfa->eos[0] != COLORLESS) - fprintf(f, ", eos [%ld]", (long) cnfa->eos[0]); - if (cnfa->eos[1] != COLORLESS) - fprintf(f, ", eol [%ld]", (long) cnfa->eos[1]); - if (cnfa->flags & HASLACONS) - fprintf(f, ", haslacons"); - fprintf(f, "\n"); - for (st = 0; st < cnfa->nstates; st++) - dumpcstate(st, cnfa->states[st], cnfa, f); - fflush(f); -} -#endif - -#ifdef REG_DEBUG /* subordinates of dumpcnfa */ - -/* - * dumpcstate - dump a compacted-NFA state in human-readable form - */ -static void -dumpcstate(int st, - struct carc * ca, - struct cnfa * cnfa, - FILE *f) -{ - int i; - int pos; - - fprintf(f, "%d%s", st, (ca[0].co) ? ":" : "."); - pos = 1; - for (i = 1; ca[i].co != COLORLESS; i++) - { - if (ca[i].co < cnfa->ncolors) - fprintf(f, "\t[%ld]->%d", (long) ca[i].co, ca[i].to); - else - fprintf(f, "\t:%ld:->%d", (long) ca[i].co - cnfa->ncolors, - ca[i].to); - if (pos == 5) - { - fprintf(f, "\n"); - pos = 1; - } - else - pos++; - } - if (i == 1 || pos != 1) - fprintf(f, "\n"); - fflush(f); -} - -#endif /* REG_DEBUG */ diff --git a/src/regex/rege_dfa.c b/src/regex/rege_dfa.c deleted file mode 100644 index 5347b90d73..0000000000 --- a/src/regex/rege_dfa.c +++ /dev/null @@ -1,699 +0,0 @@ -/* - * DFA routines - * This file is #included by regexec.c. - * - * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. - * - * Development of this software was funded, in part, by Cray Research Inc., - * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics - * Corporation, none of whom are responsible for the results. The author - * thanks all of them. - * - * Redistribution and use in source and binary forms -- with or without - * modification -- are permitted for any purpose, provided that - * redistributions in source form retain this entire copyright notice and - * indicate the origin and nature of any modifications. - * - * I'd appreciate being given credit for this package in the documentation - * of software which uses it, but that is not a requirement. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Header$ - * - */ - -/* - * longest - longest-preferred matching engine - */ -static chr * /* endpoint, or NULL */ -longest(struct vars * v, /* used only for debug and exec flags */ - struct dfa * d, - chr *start, /* where the match should start */ - chr *stop, /* match must end at or before here */ - int *hitstopp) /* record whether hit v->stop, if non-NULL */ -{ - chr *cp; - chr *realstop = (stop == v->stop) ? stop : stop + 1; - color co; - struct sset *css; - struct sset *ss; - chr *post; - int i; - struct colormap *cm = d->cm; - - /* initialize */ - css = initialize(v, d, start); - cp = start; - if (hitstopp != NULL) - *hitstopp = 0; - - /* startup */ - FDEBUG(("+++ startup +++\n")); - if (cp == v->start) - { - co = d->cnfa->bos[(v->eflags & REG_NOTBOL) ? 0 : 1]; - FDEBUG(("color %ld\n", (long) co)); - } - else - { - co = GETCOLOR(cm, *(cp - 1)); - FDEBUG(("char %c, color %ld\n", (char) *(cp - 1), (long) co)); - } - css = miss(v, d, css, co, cp, start); - if (css == NULL) - return NULL; - css->lastseen = cp; - - /* main loop */ - if (v->eflags & REG_FTRACE) - while (cp < realstop) - { - FDEBUG(("+++ at c%d +++\n", css - d->ssets)); - co = GETCOLOR(cm, *cp); - FDEBUG(("char %c, color %ld\n", (char) *cp, (long) co)); - ss = css->outs[co]; - if (ss == NULL) - { - ss = miss(v, d, css, co, cp + 1, start); - if (ss == NULL) - break; /* NOTE BREAK OUT */ - } - cp++; - ss->lastseen = cp; - css = ss; - } - else - while (cp < realstop) - { - co = GETCOLOR(cm, *cp); - ss = css->outs[co]; - if (ss == NULL) - { - ss = miss(v, d, css, co, cp + 1, start); - if (ss == NULL) - break; /* NOTE BREAK OUT */ - } - cp++; - ss->lastseen = cp; - css = ss; - } - - /* shutdown */ - FDEBUG(("+++ shutdown at c%d +++\n", css - d->ssets)); - if (cp == v->stop && stop == v->stop) - { - if (hitstopp != NULL) - *hitstopp = 1; - co = d->cnfa->eos[(v->eflags & REG_NOTEOL) ? 0 : 1]; - FDEBUG(("color %ld\n", (long) co)); - ss = miss(v, d, css, co, cp, start); - /* special case: match ended at eol? */ - if (ss != NULL && (ss->flags & POSTSTATE)) - return cp; - else if (ss != NULL) - ss->lastseen = cp; /* to be tidy */ - } - - /* find last match, if any */ - post = d->lastpost; - for (ss = d->ssets, i = d->nssused; i > 0; ss++, i--) - if ((ss->flags & POSTSTATE) && post != ss->lastseen && - (post == NULL || post < ss->lastseen)) - post = ss->lastseen; - if (post != NULL) /* found one */ - return post - 1; - - return NULL; -} - -/* - * shortest - shortest-preferred matching engine - */ -static chr * /* endpoint, or NULL */ -shortest(struct vars * v, - struct dfa * d, - chr *start, /* where the match should start */ - chr *min, /* match must end at or after here */ - chr *max, /* match must end at or before here */ - chr **coldp, /* store coldstart pointer here, if - * nonNULL */ - int *hitstopp) /* record whether hit v->stop, if non-NULL */ -{ - chr *cp; - chr *realmin = (min == v->stop) ? min : min + 1; - chr *realmax = (max == v->stop) ? max : max + 1; - color co; - struct sset *css; - struct sset *ss; - struct colormap *cm = d->cm; - - /* initialize */ - css = initialize(v, d, start); - cp = start; - if (hitstopp != NULL) - *hitstopp = 0; - - /* startup */ - FDEBUG(("--- startup ---\n")); - if (cp == v->start) - { - co = d->cnfa->bos[(v->eflags & REG_NOTBOL) ? 0 : 1]; - FDEBUG(("color %ld\n", (long) co)); - } - else - { - co = GETCOLOR(cm, *(cp - 1)); - FDEBUG(("char %c, color %ld\n", (char) *(cp - 1), (long) co)); - } - css = miss(v, d, css, co, cp, start); - if (css == NULL) - return NULL; - css->lastseen = cp; - ss = css; - - /* main loop */ - if (v->eflags & REG_FTRACE) - while (cp < realmax) - { - FDEBUG(("--- at c%d ---\n", css - d->ssets)); - co = GETCOLOR(cm, *cp); - FDEBUG(("char %c, color %ld\n", (char) *cp, (long) co)); - ss = css->outs[co]; - if (ss == NULL) - { - ss = miss(v, d, css, co, cp + 1, start); - if (ss == NULL) - break; /* NOTE BREAK OUT */ - } - cp++; - ss->lastseen = cp; - css = ss; - if ((ss->flags & POSTSTATE) && cp >= realmin) - break; /* NOTE BREAK OUT */ - } - else - while (cp < realmax) - { - co = GETCOLOR(cm, *cp); - ss = css->outs[co]; - if (ss == NULL) - { - ss = miss(v, d, css, co, cp + 1, start); - if (ss == NULL) - break; /* NOTE BREAK OUT */ - } - cp++; - ss->lastseen = cp; - css = ss; - if ((ss->flags & POSTSTATE) && cp >= realmin) - break; /* NOTE BREAK OUT */ - } - - if (ss == NULL) - return NULL; - - if (coldp != NULL) /* report last no-progress state set, if - * any */ - *coldp = lastcold(v, d); - - if ((ss->flags & POSTSTATE) && cp > min) - { - assert(cp >= realmin); - cp--; - } - else if (cp == v->stop && max == v->stop) - { - co = d->cnfa->eos[(v->eflags & REG_NOTEOL) ? 0 : 1]; - FDEBUG(("color %ld\n", (long) co)); - ss = miss(v, d, css, co, cp, start); - /* match might have ended at eol */ - if ((ss == NULL || !(ss->flags & POSTSTATE)) && hitstopp != NULL) - *hitstopp = 1; - } - - if (ss == NULL || !(ss->flags & POSTSTATE)) - return NULL; - - return cp; -} - -/* - * lastcold - determine last point at which no progress had been made - */ -static chr * /* endpoint, or NULL */ -lastcold(struct vars * v, - struct dfa * d) -{ - struct sset *ss; - chr *nopr; - int i; - - nopr = d->lastnopr; - if (nopr == NULL) - nopr = v->start; - for (ss = d->ssets, i = d->nssused; i > 0; ss++, i--) - if ((ss->flags & NOPROGRESS) && nopr < ss->lastseen) - nopr = ss->lastseen; - return nopr; -} - -/* - * newdfa - set up a fresh DFA - */ -static struct dfa * -newdfa(struct vars * v, - struct cnfa * cnfa, - struct colormap * cm, - struct smalldfa * small) /* preallocated space, may be NULL */ -{ - struct dfa *d; - size_t nss = cnfa->nstates * 2; - int wordsper = (cnfa->nstates + UBITS - 1) / UBITS; - struct smalldfa *smallwas = small; - - assert(cnfa != NULL && cnfa->nstates != 0); - - if (nss <= FEWSTATES && cnfa->ncolors <= FEWCOLORS) - { - assert(wordsper == 1); - if (small == NULL) - { - small = (struct smalldfa *) MALLOC( - sizeof(struct smalldfa)); - if (small == NULL) - { - ERR(REG_ESPACE); - return NULL; - } - } - d = &small->dfa; - d->ssets = small->ssets; - d->statesarea = small->statesarea; - d->work = &d->statesarea[nss]; - d->outsarea = small->outsarea; - d->incarea = small->incarea; - d->cptsmalloced = 0; - d->mallocarea = (smallwas == NULL) ? (char *) small : NULL; - } - else - { - d = (struct dfa *) MALLOC(sizeof(struct dfa)); - if (d == NULL) - { - ERR(REG_ESPACE); - return NULL; - } - d->ssets = (struct sset *) MALLOC(nss * sizeof(struct sset)); - d->statesarea = (unsigned *) MALLOC((nss + WORK) * wordsper * - sizeof(unsigned)); - d->work = &d->statesarea[nss * wordsper]; - d->outsarea = (struct sset **) MALLOC(nss * cnfa->ncolors * - sizeof(struct sset *)); - d->incarea = (struct arcp *) MALLOC(nss * cnfa->ncolors * - sizeof(struct arcp)); - d->cptsmalloced = 1; - d->mallocarea = (char *) d; - if (d->ssets == NULL || d->statesarea == NULL || - d->outsarea == NULL || d->incarea == NULL) - { - freedfa(d); - ERR(REG_ESPACE); - return NULL; - } - } - - d->nssets = (v->eflags & REG_SMALL) ? 7 : nss; - d->nssused = 0; - d->nstates = cnfa->nstates; - d->ncolors = cnfa->ncolors; - d->wordsper = wordsper; - d->cnfa = cnfa; - d->cm = cm; - d->lastpost = NULL; - d->lastnopr = NULL; - d->search = d->ssets; - - /* initialization of sset fields is done as needed */ - - return d; -} - -/* - * freedfa - free a DFA - */ -static void -freedfa(struct dfa * d) -{ - if (d->cptsmalloced) - { - if (d->ssets != NULL) - FREE(d->ssets); - if (d->statesarea != NULL) - FREE(d->statesarea); - if (d->outsarea != NULL) - FREE(d->outsarea); - if (d->incarea != NULL) - FREE(d->incarea); - } - - if (d->mallocarea != NULL) - FREE(d->mallocarea); -} - -/* - * hash - construct a hash code for a bitvector - * - * There are probably better ways, but they're more expensive. - */ -static unsigned -hash(unsigned *uv, - int n) -{ - int i; - unsigned h; - - h = 0; - for (i = 0; i < n; i++) - h ^= uv[i]; - return h; -} - -/* - * initialize - hand-craft a cache entry for startup, otherwise get ready - */ -static struct sset * -initialize(struct vars * v, /* used only for debug flags */ - struct dfa * d, - chr *start) -{ - struct sset *ss; - int i; - - /* is previous one still there? */ - if (d->nssused > 0 && (d->ssets[0].flags & STARTER)) - ss = &d->ssets[0]; - else - { /* no, must (re)build it */ - ss = getvacant(v, d, start, start); - for (i = 0; i < d->wordsper; i++) - ss->states[i] = 0; - BSET(ss->states, d->cnfa->pre); - ss->hash = HASH(ss->states, d->wordsper); - assert(d->cnfa->pre != d->cnfa->post); - ss->flags = STARTER | LOCKED | NOPROGRESS; - /* lastseen dealt with below */ - } - - for (i = 0; i < d->nssused; i++) - d->ssets[i].lastseen = NULL; - ss->lastseen = start; /* maybe untrue, but harmless */ - d->lastpost = NULL; - d->lastnopr = NULL; - return ss; -} - -/* - * miss - handle a cache miss - */ -static struct sset * /* NULL if goes to empty set */ -miss(struct vars * v, /* used only for debug flags */ - struct dfa * d, - struct sset * css, - pcolor co, - chr *cp, /* next chr */ - chr *start) /* where the attempt got started */ -{ - struct cnfa *cnfa = d->cnfa; - int i; - unsigned h; - struct carc *ca; - struct sset *p; - int ispost; - int noprogress; - int gotstate; - int dolacons; - int sawlacons; - - /* for convenience, we can be called even if it might not be a miss */ - if (css->outs[co] != NULL) - { - FDEBUG(("hit\n")); - return css->outs[co]; - } - FDEBUG(("miss\n")); - - /* first, what set of states would we end up in? */ - for (i = 0; i < d->wordsper; i++) - d->work[i] = 0; - ispost = 0; - noprogress = 1; - gotstate = 0; - for (i = 0; i < d->nstates; i++) - if (ISBSET(css->states, i)) - for (ca = cnfa->states[i] + 1; ca->co != COLORLESS; ca++) - if (ca->co == co) - { - BSET(d->work, ca->to); - gotstate = 1; - if (ca->to == cnfa->post) - ispost = 1; - if (!cnfa->states[ca->to]->co) - noprogress = 0; - FDEBUG(("%d -> %d\n", i, ca->to)); - } - dolacons = (gotstate) ? (cnfa->flags & HASLACONS) : 0; - sawlacons = 0; - while (dolacons) - { /* transitive closure */ - dolacons = 0; - for (i = 0; i < d->nstates; i++) - if (ISBSET(d->work, i)) - for (ca = cnfa->states[i] + 1; ca->co != COLORLESS; - ca++) - { - if (ca->co <= cnfa->ncolors) - continue; /* NOTE CONTINUE */ - sawlacons = 1; - if (ISBSET(d->work, ca->to)) - continue; /* NOTE CONTINUE */ - if (!lacon(v, cnfa, cp, ca->co)) - continue; /* NOTE CONTINUE */ - BSET(d->work, ca->to); - dolacons = 1; - if (ca->to == cnfa->post) - ispost = 1; - if (!cnfa->states[ca->to]->co) - noprogress = 0; - FDEBUG(("%d :> %d\n", i, ca->to)); - } - } - if (!gotstate) - return NULL; - h = HASH(d->work, d->wordsper); - - /* next, is that in the cache? */ - for (p = d->ssets, i = d->nssused; i > 0; p++, i--) - if (HIT(h, d->work, p, d->wordsper)) - { - FDEBUG(("cached c%d\n", p - d->ssets)); - break; /* NOTE BREAK OUT */ - } - if (i == 0) - { /* nope, need a new cache entry */ - p = getvacant(v, d, cp, start); - assert(p != css); - for (i = 0; i < d->wordsper; i++) - p->states[i] = d->work[i]; - p->hash = h; - p->flags = (ispost) ? POSTSTATE : 0; - if (noprogress) - p->flags |= NOPROGRESS; - /* lastseen to be dealt with by caller */ - } - - if (!sawlacons) - { /* lookahead conds. always cache miss */ - FDEBUG(("c%d[%d]->c%d\n", css - d->ssets, co, p - d->ssets)); - css->outs[co] = p; - css->inchain[co] = p->ins; - p->ins.ss = css; - p->ins.co = (color) co; - } - return p; -} - -/* - * lacon - lookahead-constraint checker for miss() - */ -static int /* predicate: constraint satisfied? */ -lacon(struct vars * v, - struct cnfa * pcnfa, /* parent cnfa */ - chr *cp, - pcolor co) /* "color" of the lookahead constraint */ -{ - int n; - struct subre *sub; - struct dfa *d; - struct smalldfa sd; - chr *end; - - n = co - pcnfa->ncolors; - assert(n < v->g->nlacons && v->g->lacons != NULL); - FDEBUG(("=== testing lacon %d\n", n)); - sub = &v->g->lacons[n]; - d = newdfa(v, &sub->cnfa, &v->g->cmap, &sd); - if (d == NULL) - { - ERR(REG_ESPACE); - return 0; - } - end = longest(v, d, cp, v->stop, (int *) NULL); - freedfa(d); - FDEBUG(("=== lacon %d match %d\n", n, (end != NULL))); - return (sub->subno) ? (end != NULL) : (end == NULL); -} - -/* - * getvacant - get a vacant state set - * This routine clears out the inarcs and outarcs, but does not otherwise - * clear the innards of the state set -- that's up to the caller. - */ -static struct sset * -getvacant(struct vars * v, /* used only for debug flags */ - struct dfa * d, - chr *cp, - chr *start) -{ - int i; - struct sset *ss; - struct sset *p; - struct arcp ap; - struct arcp lastap; - color co; - - ss = pickss(v, d, cp, start); - assert(!(ss->flags & LOCKED)); - - /* clear out its inarcs, including self-referential ones */ - ap = ss->ins; - while ((p = ap.ss) != NULL) - { - co = ap.co; - FDEBUG(("zapping c%d's %ld outarc\n", p - d->ssets, (long) co)); - p->outs[co] = NULL; - ap = p->inchain[co]; - p->inchain[co].ss = NULL; /* paranoia */ - } - ss->ins.ss = NULL; - - /* take it off the inarc chains of the ssets reached by its outarcs */ - for (i = 0; i < d->ncolors; i++) - { - p = ss->outs[i]; - assert(p != ss); /* not self-referential */ - if (p == NULL) - continue; /* NOTE CONTINUE */ - FDEBUG(("del outarc %d from c%d's in chn\n", i, p - d->ssets)); - if (p->ins.ss == ss && p->ins.co == i) - p->ins = ss->inchain[i]; - else - { - assert(p->ins.ss != NULL); - for (ap = p->ins; ap.ss != NULL && - !(ap.ss == ss && ap.co == i); - ap = ap.ss->inchain[ap.co]) - lastap = ap; - assert(ap.ss != NULL); - lastap.ss->inchain[lastap.co] = ss->inchain[i]; - } - ss->outs[i] = NULL; - ss->inchain[i].ss = NULL; - } - - /* if ss was a success state, may need to remember location */ - if ((ss->flags & POSTSTATE) && ss->lastseen != d->lastpost && - (d->lastpost == NULL || d->lastpost < ss->lastseen)) - d->lastpost = ss->lastseen; - - /* likewise for a no-progress state */ - if ((ss->flags & NOPROGRESS) && ss->lastseen != d->lastnopr && - (d->lastnopr == NULL || d->lastnopr < ss->lastseen)) - d->lastnopr = ss->lastseen; - - return ss; -} - -/* - * pickss - pick the next stateset to be used - */ -static struct sset * -pickss(struct vars * v, /* used only for debug flags */ - struct dfa * d, - chr *cp, - chr *start) -{ - int i; - struct sset *ss; - struct sset *end; - chr *ancient; - - /* shortcut for cases where cache isn't full */ - if (d->nssused < d->nssets) - { - i = d->nssused; - d->nssused++; - ss = &d->ssets[i]; - FDEBUG(("new c%d\n", i)); - /* set up innards */ - ss->states = &d->statesarea[i * d->wordsper]; - ss->flags = 0; - ss->ins.ss = NULL; - ss->ins.co = WHITE; /* give it some value */ - ss->outs = &d->outsarea[i * d->ncolors]; - ss->inchain = &d->incarea[i * d->ncolors]; - for (i = 0; i < d->ncolors; i++) - { - ss->outs[i] = NULL; - ss->inchain[i].ss = NULL; - } - return ss; - } - - /* look for oldest, or old enough anyway */ - if (cp - start > d->nssets * 2 / 3) /* oldest 33% are expendable */ - ancient = cp - d->nssets * 2 / 3; - else - ancient = start; - for (ss = d->search, end = &d->ssets[d->nssets]; ss < end; ss++) - if ((ss->lastseen == NULL || ss->lastseen < ancient) && - !(ss->flags & LOCKED)) - { - d->search = ss + 1; - FDEBUG(("replacing c%d\n", ss - d->ssets)); - return ss; - } - for (ss = d->ssets, end = d->search; ss < end; ss++) - if ((ss->lastseen == NULL || ss->lastseen < ancient) && - !(ss->flags & LOCKED)) - { - d->search = ss + 1; - FDEBUG(("replacing c%d\n", ss - d->ssets)); - return ss; - } - - /* nobody's old enough?!? -- something's really wrong */ - FDEBUG(("can't find victim to replace!\n")); - assert(NOTREACHED); - ERR(REG_ASSERT); - return d->ssets; -} diff --git a/src/regex/regerrs.h b/src/regex/regerrs.h deleted file mode 100644 index f99dbf4f73..0000000000 --- a/src/regex/regerrs.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id$ - */ - -{ - REG_OKAY, "REG_OKAY", "no errors detected" -}, - -{ - REG_NOMATCH, "REG_NOMATCH", "failed to match" -}, - -{ - REG_BADPAT, "REG_BADPAT", "invalid regexp (reg version 0.8)" -}, - -{ - REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" -}, - -{ - REG_ECTYPE, "REG_ECTYPE", "invalid character class" -}, - -{ - REG_EESCAPE, "REG_EESCAPE", "invalid escape \\ sequence" -}, - -{ - REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" -}, - -{ - REG_EBRACK, "REG_EBRACK", "brackets [] not balanced" -}, - -{ - REG_EPAREN, "REG_EPAREN", "parentheses () not balanced" -}, - -{ - REG_EBRACE, "REG_EBRACE", "braces {} not balanced" -}, - -{ - REG_BADBR, "REG_BADBR", "invalid repetition count(s)" -}, - -{ - REG_ERANGE, "REG_ERANGE", "invalid character range" -}, - -{ - REG_ESPACE, "REG_ESPACE", "out of memory" -}, - -{ - REG_BADRPT, "REG_BADRPT", "quantifier operand invalid" -}, - -{ - REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug" -}, - -{ - REG_INVARG, "REG_INVARG", "invalid argument to regex function" -}, - -{ - REG_MIXED, "REG_MIXED", "character widths of regex and string differ" -}, - -{ - REG_BADOPT, "REG_BADOPT", "invalid embedded option" -}, diff --git a/src/regex/regex.7 b/src/regex/regex.7 new file mode 100644 index 0000000000..0fa180269e --- /dev/null +++ b/src/regex/regex.7 @@ -0,0 +1,235 @@ +.TH REGEX 7 "25 Oct 1995" +.BY "Henry Spencer" +.SH NAME +regex \- POSIX 1003.2 regular expressions +.SH DESCRIPTION +Regular expressions (``RE''s), +as defined in POSIX 1003.2, come in two forms: +modern REs (roughly those of +.IR egrep ; +1003.2 calls these ``extended'' REs) +and obsolete REs (roughly those of +.IR ed ; +1003.2 ``basic'' REs). +Obsolete REs mostly exist for backward compatibility in some old programs; +they will be discussed at the end. +1003.2 leaves some aspects of RE syntax and semantics open; +`\(dg' marks decisions on these aspects that +may not be fully portable to other 1003.2 implementations. +.PP +A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR, +separated by `|'. +It matches anything that matches one of the branches. +.PP +A branch is one\(dg or more \fIpieces\fR, concatenated. +It matches a match for the first, followed by a match for the second, etc. +.PP +A piece is an \fIatom\fR possibly followed +by a single\(dg `*', `+', `?', or \fIbound\fR. +An atom followed by `*' matches a sequence of 0 or more matches of the atom. +An atom followed by `+' matches a sequence of 1 or more matches of the atom. +An atom followed by `?' matches a sequence of 0 or 1 matches of the atom. +.PP +A \fIbound\fR is `{' followed by an unsigned decimal integer, +possibly followed by `,' +possibly followed by another unsigned decimal integer, +always followed by `}'. +The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive, +and if there are two of them, the first may not exceed the second. +An atom followed by a bound containing one integer \fIi\fR +and no comma matches +a sequence of exactly \fIi\fR matches of the atom. +An atom followed by a bound +containing one integer \fIi\fR and a comma matches +a sequence of \fIi\fR or more matches of the atom. +An atom followed by a bound +containing two integers \fIi\fR and \fIj\fR matches +a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom. +.PP +An atom is a regular expression enclosed in `()' (matching a match for the +regular expression), +an empty set of `()' (matching the null string)\(dg, +a \fIbracket expression\fR (see below), `.' +(matching any single character), `^' (matching the null string at the +beginning of a line), `$' (matching the null string at the +end of a line), a `\e' followed by one of the characters +`^.[$()|*+?{\e' +(matching that character taken as an ordinary character), +a `\e' followed by any other character\(dg +(matching that character taken as an ordinary character, +as if the `\e' had not been present\(dg), +or a single character with no other significance (matching that character). +A `{' followed by a character other than a digit is an ordinary +character, not the beginning of a bound\(dg. +It is illegal to end an RE with `\e'. +.PP +A \fIbracket expression\fR is a list of characters enclosed in `[]'. +It normally matches any single character from the list (but see below). +If the list begins with `^', +it matches any single character +(but see below) \fInot\fR from the rest of the list. +If two characters in the list are separated by `\-', this is shorthand +for the full \fIrange\fR of characters between those two (inclusive) in the +collating sequence, +e.g. `[0\-9]' in ASCII matches any decimal digit. +It is illegal\(dg for two ranges to share an +endpoint, e.g. `a\-c\-e'. +Ranges are very collating-sequence-dependent, +and portable programs should avoid relying on them. +.PP +To include a literal `]' in the list, make it the first character +(following a possible `^'). +To include a literal `\-', make it the first or last character, +or the second endpoint of a range. +To use a literal `\-' as the first endpoint of a range, +enclose it in `[.' and `.]' to make it a collating element (see below). +With the exception of these and some combinations using `[' (see next +paragraphs), all other special characters, including `\e', lose their +special significance within a bracket expression. +.PP +Within a bracket expression, a collating element (a character, +a multi-character sequence that collates as if it were a single character, +or a collating-sequence name for either) +enclosed in `[.' and `.]' stands for the +sequence of characters of that collating element. +The sequence is a single element of the bracket expression's list. +A bracket expression containing a multi-character collating element +can thus match more than one character, +e.g. if the collating sequence includes a `ch' collating element, +then the RE `[[.ch.]]*c' matches the first five characters +of `chchcc'. +.PP +Within a bracket expression, a collating element enclosed in `[=' and +`=]' is an equivalence class, standing for the sequences of characters +of all collating elements equivalent to that one, including itself. +(If there are no other equivalent collating elements, +the treatment is as if the enclosing delimiters were `[.' and `.]'.) +For example, if o and \o'o^' are the members of an equivalence class, +then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous. +An equivalence class may not\(dg be an endpoint +of a range. +.PP +Within a bracket expression, the name of a \fIcharacter class\fR enclosed +in `[:' and `:]' stands for the list of all characters belonging to that +class. +Standard character class names are: +.PP +.RS +.nf +.ta 3c 6c 9c +alnum digit punct +alpha graph space +blank lower upper +cntrl print xdigit +.fi +.RE +.PP +These stand for the character classes defined in +.IR ctype (3). +A locale may provide others. +A character class may not be used as an endpoint of a range. +.PP +There are two special cases\(dg of bracket expressions: +the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at +the beginning and end of a word respectively. +A word is defined as a sequence of +word characters +which is neither preceded nor followed by +word characters. +A word character is an +.I alnum +character (as defined by +.IR ctype (3)) +or an underscore. +This is an extension, +compatible with but not specified by POSIX 1003.2, +and should be used with +caution in software intended to be portable to other systems. +.PP +In the event that an RE could match more than one substring of a given +string, +the RE matches the one starting earliest in the string. +If the RE could match more than one substring starting at that point, +it matches the longest. +Subexpressions also match the longest possible substrings, subject to +the constraint that the whole match be as long as possible, +with subexpressions starting earlier in the RE taking priority over +ones starting later. +Note that higher-level subexpressions thus take priority over +their lower-level component subexpressions. +.PP +Match lengths are measured in characters, not collating elements. +A null string is considered longer than no match at all. +For example, +`bb*' matches the three middle characters of `abbbc', +`(wee|week)(knights|nights)' matches all ten characters of `weeknights', +when `(.*).*' is matched against `abc' the parenthesized subexpression +matches all three characters, and +when `(a*)*' is matched against `bc' both the whole RE and the parenthesized +subexpression match the null string. +.PP +If case-independent matching is specified, +the effect is much as if all case distinctions had vanished from the +alphabet. +When an alphabetic that exists in multiple cases appears as an +ordinary character outside a bracket expression, it is effectively +transformed into a bracket expression containing both cases, +e.g. `x' becomes `[xX]'. +When it appears inside a bracket expression, all case counterparts +of it are added to the bracket expression, so that (e.g.) `[x]' +becomes `[xX]' and `[^x]' becomes `[^xX]'. +.PP +No particular limit is imposed on the length of REs\(dg. +Programs intended to be portable should not employ REs longer +than 256 bytes, +as an implementation can refuse to accept such REs and remain +POSIX-compliant. +.PP +Obsolete (``basic'') regular expressions differ in several respects. +`|', `+', and `?' are ordinary characters and there is no equivalent +for their functionality. +The delimiters for bounds are `\e{' and `\e}', +with `{' and `}' by themselves ordinary characters. +The parentheses for nested subexpressions are `\e(' and `\e)', +with `(' and `)' by themselves ordinary characters. +`^' is an ordinary character except at the beginning of the +RE or\(dg the beginning of a parenthesized subexpression, +`$' is an ordinary character except at the end of the +RE or\(dg the end of a parenthesized subexpression, +and `*' is an ordinary character if it appears at the beginning of the +RE or the beginning of a parenthesized subexpression +(after a possible leading `^'). +Finally, there is one new type of atom, a \fIback reference\fR: +`\e' followed by a non-zero decimal digit \fId\fR +matches the same sequence of characters +matched by the \fId\fRth parenthesized subexpression +(numbering subexpressions by the positions of their opening parentheses, +left to right), +so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'. +.SH SEE ALSO +regex(3) +.PP +POSIX 1003.2, section 2.8 (Regular Expression Notation). +.SH HISTORY +Written by Henry Spencer, based on the 1003.2 spec. +.SH BUGS +Having two kinds of REs is a botch. +.PP +The current 1003.2 spec says that `)' is an ordinary character in +the absence of an unmatched `('; +this was an unintentional result of a wording error, +and change is likely. +Avoid relying on it. +.PP +Back references are a dreadful botch, +posing major problems for efficient implementations. +They are also somewhat vaguely defined +(does +`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?). +Avoid using them. +.PP +1003.2's specification of case-independent matching is vague. +The ``one case implies all cases'' definition given above +is current consensus among implementors as to the right interpretation. +.PP +The syntax for word boundaries is incredibly ugly. diff --git a/src/regex/regex.h b/src/regex/regex.h index a1fcec2e1c..d094d072d5 100644 --- a/src/regex/regex.h +++ b/src/regex/regex.h @@ -1,202 +1,74 @@ #ifndef _REGEX_H_ #define _REGEX_H_ /* never again */ -/* - * regular expressions - * - * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. - * - * Development of this software was funded, in part, by Cray Research Inc., - * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics - * Corporation, none of whom are responsible for the results. The author - * thanks all of them. - * - * Redistribution and use in source and binary forms -- with or without - * modification -- are permitted for any purpose, provided that - * redistributions in source form retain this entire copyright notice and - * indicate the origin and nature of any modifications. - * - * I'd appreciate being given credit for this package in the documentation - * of software which uses it, but that is not a requirement. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id$ - */ - -/* - * Add your own defines, if needed, here. - */ +/* ========= begin header generated by ./mkh ========= */ #ifdef __cplusplus extern "C" { #endif -#include -#include -#include - -#ifndef wxCHECK_GCC_VERSION -#define wxCHECK_GCC_VERSION( major, minor ) \ - ( defined(__GNUC__) && defined(__GNUC_MINOR__) \ - && ( ( __GNUC__ > (major) ) \ - || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) ) -#endif - -#if !wxUSE_UNICODE -# define wx_wchar char -#else // Unicode - #if (defined(__GNUC__) && !wxCHECK_GCC_VERSION(2, 96)) -# define wx_wchar __WCHAR_TYPE__ - #else // __WCHAR_TYPE__ and gcc < 2.96 - // standard case -# define wx_wchar wchar_t - #endif // __WCHAR_TYPE__ -#endif // ASCII/Unicode - -/* - * interface types etc. - */ - -/* - * regoff_t has to be large enough to hold either off_t or ssize_t, - * and must be signed; it's only a guess that long is suitable. - */ -typedef long regoff_t; - -/* - * other interface types - */ - -/* the biggie, a compiled RE (or rather, a front end to same) */ -typedef struct -{ - int re_magic; /* magic number */ - size_t re_nsub; /* number of subexpressions */ - long re_info; /* information about RE */ -#define REG_UBACKREF 000001 -#define REG_ULOOKAHEAD 000002 -#define REG_UBOUNDS 000004 -#define REG_UBRACES 000010 -#define REG_UBSALNUM 000020 -#define REG_UPBOTCH 000040 -#define REG_UBBS 000100 -#define REG_UNONPOSIX 000200 -#define REG_UUNSPEC 000400 -#define REG_UUNPORT 001000 -#define REG_ULOCALE 002000 -#define REG_UEMPTYMATCH 004000 -#define REG_UIMPOSSIBLE 010000 -#define REG_USHORTEST 020000 - int re_csize; /* sizeof(character) */ - char *re_endp; /* backward compatibility kludge */ - /* the rest is opaque pointers to hidden innards */ - char *re_guts; /* `char *' is more portable than `void *' */ - char *re_fns; +/* === regex2.h === */ +typedef off_t regoff_t; +typedef struct { + int re_magic; + size_t re_nsub; /* number of parenthesized subexpressions */ + const char *re_endp; /* end pointer for REG_PEND */ + struct re_guts *re_g; /* none of your business :-) */ } regex_t; - -/* result reporting (may acquire more fields later) */ -typedef struct -{ - regoff_t rm_so; /* start of substring */ - regoff_t rm_eo; /* end of substring */ +typedef struct { + regoff_t rm_so; /* start of match */ + regoff_t rm_eo; /* end of match */ } regmatch_t; -/* supplementary control and reporting */ -typedef struct -{ - regmatch_t rm_extend; /* see REG_EXPECT */ -} rm_detail_t; + +/* === regcomp.c === */ +extern int regcomp(regex_t *, const char *, int); +#define REG_BASIC 0000 +#define REG_EXTENDED 0001 +#define REG_ICASE 0002 +#define REG_NOSUB 0004 +#define REG_NEWLINE 0010 +#define REG_NOSPEC 0020 +#define REG_PEND 0040 +#define REG_DUMP 0200 - -/* - * regex compilation flags - */ -#define REG_BASIC 000000 /* BREs (convenience) */ -#define REG_EXTENDED 000001 /* EREs */ -#define REG_ADVF 000002 /* advanced features in EREs */ -#define REG_ADVANCED 000003 /* AREs (which are also EREs) */ -#define REG_QUOTE 000004 /* no special characters, none */ -#define REG_NOSPEC REG_QUOTE /* historical synonym */ -#define REG_ICASE 000010 /* ignore case */ -#define REG_NOSUB 000020 /* don't care about subexpressions */ -#define REG_EXPANDED 000040 /* expanded format, white space & comments */ -#define REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ -#define REG_NLANCH 000200 /* ^ matches after \n, $ before */ -#define REG_NEWLINE 000300 /* newlines are line terminators */ -#define REG_PEND 000400 /* ugh -- backward-compatibility hack */ -#define REG_EXPECT 001000 /* report details on partial/limited - * matches */ -#define REG_BOSONLY 002000 /* temporary kludge for BOS-only matches */ -#define REG_DUMP 004000 /* none of your business :-) */ -#define REG_FAKE 010000 /* none of your business :-) */ -#define REG_PROGRESS 020000 /* none of your business :-) */ - - - -/* - * regex execution flags - */ -#define REG_NOTBOL 0001 /* BOS is not BOL */ -#define REG_NOTEOL 0002 /* EOS is not EOL */ -#define REG_STARTEND 0004 /* backward compatibility kludge */ -#define REG_FTRACE 0010 /* none of your business */ -#define REG_MTRACE 0020 /* none of your business */ -#define REG_SMALL 0040 /* none of your business */ - - -/* - * error reporting - * Be careful if modifying the list of error codes -- the table used by - * regerror() is generated automatically from this file! - */ -#define REG_OKAY 0 /* no errors detected */ -#define REG_NOMATCH 1 /* failed to match */ -#define REG_BADPAT 2 /* invalid regexp */ -#define REG_ECOLLATE 3 /* invalid collating element */ -#define REG_ECTYPE 4 /* invalid character class */ -#define REG_EESCAPE 5 /* invalid escape \ sequence */ -#define REG_ESUBREG 6 /* invalid backreference number */ -#define REG_EBRACK 7 /* brackets [] not balanced */ -#define REG_EPAREN 8 /* parentheses () not balanced */ -#define REG_EBRACE 9 /* braces {} not balanced */ -#define REG_BADBR 10 /* invalid repetition count(s) */ -#define REG_ERANGE 11 /* invalid character range */ -#define REG_ESPACE 12 /* out of memory */ -#define REG_BADRPT 13 /* quantifier operand invalid */ -#define REG_ASSERT 15 /* "can't happen" -- you found a bug */ -#define REG_INVARG 16 /* invalid argument to regex function */ -#define REG_MIXED 17 /* character widths of regex and string - * differ */ -#define REG_BADOPT 18 /* invalid embedded option */ -/* two specials for debugging and testing */ -#define REG_ATOI 101 /* convert error-code name to number */ -#define REG_ITOA 102 /* convert error-code number to name */ - - - -/* - * the prototypes for exported functions - */ -extern int wx_regcomp(regex_t *, const wx_wchar *, size_t, int); -extern int regcomp(regex_t *, const wx_wchar *, int); -extern int wx_regexec(regex_t *, const wx_wchar *, size_t, rm_detail_t *, size_t, regmatch_t[], int); -extern int regexec(regex_t *, const wx_wchar *, size_t, regmatch_t[], int); -extern void regfree(regex_t *); +/* === regerror.c === */ +#define REG_OKAY 0 +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 +#define REG_EMPTY 14 +#define REG_ASSERT 15 +#define REG_INVARG 16 +#define REG_ATOI 255 /* convert name to number (!) */ +#define REG_ITOA 0400 /* convert number to name (!) */ extern size_t regerror(int, const regex_t *, char *, size_t); -extern void wx_regfree(regex_t *); -extern size_t wx_regerror(int, const regex_t *, char *, size_t); + + +/* === regexec.c === */ +extern int regexec(const regex_t *, const char *, size_t, regmatch_t [], int); +#define REG_NOTBOL 00001 +#define REG_NOTEOL 00002 +#define REG_STARTEND 00004 +#define REG_TRACE 00400 /* tracing of execution */ +#define REG_LARGE 01000 /* force large representation */ +#define REG_BACKR 02000 /* force use of backref code */ + + +/* === regfree.c === */ +extern void regfree(regex_t *); #ifdef __cplusplus } #endif - -#endif /* _REGEX_H_ */ +/* ========= end header generated by ./mkh ========= */ +#endif diff --git a/src/regex/regex2.h b/src/regex/regex2.h new file mode 100644 index 0000000000..58fd8d8a43 --- /dev/null +++ b/src/regex/regex2.h @@ -0,0 +1,134 @@ +/* + * First, the stuff that ends up in the outside-world include file + = typedef off_t regoff_t; + = typedef struct { + = int re_magic; + = size_t re_nsub; // number of parenthesized subexpressions + = const char *re_endp; // end pointer for REG_PEND + = struct re_guts *re_g; // none of your business :-) + = } regex_t; + = typedef struct { + = regoff_t rm_so; // start of match + = regoff_t rm_eo; // end of match + = } regmatch_t; + */ +/* + * internals of regex_t + */ +#define MAGIC1 ((('r'^0200)<<8) | 'e') + +/* + * The internal representation is a *strip*, a sequence of + * operators ending with an endmarker. (Some terminology etc. is a + * historical relic of earlier versions which used multiple strips.) + * Certain oddities in the representation are there to permit running + * the machinery backwards; in particular, any deviation from sequential + * flow must be marked at both its source and its destination. Some + * fine points: + * + * - OPLUS_ and O_PLUS are *inside* the loop they create. + * - OQUEST_ and O_QUEST are *outside* the bypass they create. + * - OCH_ and O_CH are *outside* the multi-way branch they create, while + * OOR1 and OOR2 are respectively the end and the beginning of one of + * the branches. Note that there is an implicit OOR2 following OCH_ + * and an implicit OOR1 preceding O_CH. + * + * In state representations, an operator's bit is on to signify a state + * immediately *preceding* "execution" of that operator. + */ +typedef long sop; /* strip operator */ +typedef long sopno; +#define OPRMASK 0x7c000000 +#define OPDMASK 0x03ffffff +#define OPSHIFT (26) +#define OP(n) ((n)&OPRMASK) +#define OPND(n) ((n)&OPDMASK) +#define SOP(op, opnd) ((op)|(opnd)) +/* operators meaning operand */ +/* (back, fwd are offsets) */ +#define OEND (1< uch [csetsize] */ + uch mask; /* bit within array */ + uch hash; /* hash code */ + size_t smultis; + char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */ +} cset; +/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */ +#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c)) +#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c)) +#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask) +#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */ +#define MCsub(p, cs, cp) mcsub(p, cs, cp) +#define MCin(p, cs, cp) mcin(p, cs, cp) + +/* stuff for character categories */ +typedef unsigned char cat_t; + +/* + * main compiled-expression structure + */ +struct re_guts { + int magic; +# define MAGIC2 ((('R'^0200)<<8)|'E') + sop *strip; /* malloced area for strip */ + int csetsize; /* number of bits in a cset vector */ + int ncsets; /* number of csets in use */ + cset *sets; /* -> cset [ncsets] */ + uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */ + int cflags; /* copy of regcomp() cflags argument */ + sopno nstates; /* = number of sops */ + sopno firststate; /* the initial OEND (normally 0) */ + sopno laststate; /* the final OEND */ + int iflags; /* internal flags */ +# define USEBOL 01 /* used ^ */ +# define USEEOL 02 /* used $ */ +# define BAD 04 /* something wrong */ + int nbol; /* number of ^ used */ + int neol; /* number of $ used */ + int ncategories; /* how many character categories */ + cat_t *categories; /* ->catspace[-CHAR_MIN] */ + char *must; /* match must contain this string */ + int mlen; /* length of must */ + size_t nsub; /* copy of re_nsub */ + int backrefs; /* does it use back references? */ + sopno nplus; /* how deep does it nest +s? */ + /* catspace must be last */ + cat_t catspace[1]; /* actually [NC] */ +}; + +/* misc utilities */ +#define OUT (CHAR_MAX+1) /* a non-character value */ +#define ISWORD(c) (isalnum(c) || (c) == '_') diff --git a/src/regex/regfronts.c b/src/regex/regfronts.c deleted file mode 100644 index 82f48e2abc..0000000000 --- a/src/regex/regfronts.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * regcomp and regexec - front ends to re_ routines - * - * Mostly for implementation of backward-compatibility kludges. Note - * that these routines exist ONLY in char versions. - * - * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. - * - * Development of this software was funded, in part, by Cray Research Inc., - * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics - * Corporation, none of whom are responsible for the results. The author - * thanks all of them. - * - * Redistribution and use in source and binary forms -- with or without - * modification -- are permitted for any purpose, provided that - * redistributions in source form retain this entire copyright notice and - * indicate the origin and nature of any modifications. - * - * I'd appreciate being given credit for this package in the documentation - * of software which uses it, but that is not a requirement. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "regguts.h" - -/* - - regcomp - compile regular expression - */ -int -regcomp(re, str, flags) -regex_t *re; -CONST char *str; -int flags; -{ - size_t len; - int f = flags; - - if (f®_PEND) { - len = re->re_endp - str; - f &= ~REG_PEND; - } else - len = strlen(str); - - return re_comp(re, str, len, f); -} - -/* - - regexec - execute regular expression - */ -int -regexec(re, str, nmatch, pmatch, flags) -regex_t *re; -CONST char *str; -size_t nmatch; -regmatch_t pmatch[]; -int flags; -{ - CONST char *start; - size_t len; - int f = flags; - - if (f®_STARTEND) { - start = str + pmatch[0].rm_so; - len = pmatch[0].rm_eo - pmatch[0].rm_so; - f &= ~REG_STARTEND; - } else { - start = str; - len = strlen(str); - } - - return re_exec(re, start, len, nmatch, pmatch, f); -} diff --git a/src/regex/regguts.h b/src/regex/regguts.h deleted file mode 100644 index aa12dbf445..0000000000 --- a/src/regex/regguts.h +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Internal interface definitions, etc., for the reg package - * - * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. - * - * Development of this software was funded, in part, by Cray Research Inc., - * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics - * Corporation, none of whom are responsible for the results. The author - * thanks all of them. - * - * Redistribution and use in source and binary forms -- with or without - * modification -- are permitted for any purpose, provided that - * redistributions in source form retain this entire copyright notice and - * indicate the origin and nature of any modifications. - * - * I'd appreciate being given credit for this package in the documentation - * of software which uses it, but that is not a requirement. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id$ - */ - - - -/* - * Environmental customization. It should not (I hope) be necessary to - * alter the file you are now reading -- regcustom.h should handle it all, - * given care here and elsewhere. - */ -#include "regcustom.h" - - - -/* - * Things that regcustom.h might override. - */ - -/* assertions */ -#ifndef assert -#ifndef REG_DEBUG -# ifndef NDEBUG -# define NDEBUG /* no assertions */ -# endif -#endif -#include -#endif - -/* voids */ -#ifndef DISCARD -#define DISCARD void /* for throwing values away */ -#endif -#ifndef VS -#define VS(x) ((void *)(x)) /* cast something to generic ptr */ -#endif - -/* function-pointer declarator */ -#ifndef FUNCPTR -#define FUNCPTR(name, args) (*name) args -#endif - -/* memory allocation */ -#ifndef MALLOC -#define MALLOC(n) malloc(n) -#endif -#ifndef REALLOC -#define REALLOC(p, n) realloc(VS(p), n) -#endif -#ifndef FREE -#define FREE(p) free(VS(p)) -#endif - -/* want size of a char in bits, and max value in bounded quantifiers */ -#ifndef CHAR_BIT -#include -#endif -#ifndef _POSIX2_RE_DUP_MAX -#define _POSIX2_RE_DUP_MAX 255 /* normally from */ -#endif - - - -/* - * misc - */ - -#define NOTREACHED 0 -#define xxx 1 - -#define DUPMAX _POSIX2_RE_DUP_MAX -#define INFINITY (DUPMAX+1) - -#define REMAGIC 0xfed7 /* magic number for main struct */ - - - -/* - * debugging facilities - */ -#ifdef REG_DEBUG -/* FDEBUG does finite-state tracing */ -#define FDEBUG(arglist) { if (v->eflags®_FTRACE) printf arglist; } -/* MDEBUG does higher-level tracing */ -#define MDEBUG(arglist) { if (v->eflags®_MTRACE) printf arglist; } -#else -#define FDEBUG(arglist) {} -#define MDEBUG(arglist) {} -#endif - - - -/* - * bitmap manipulation - */ -#define UBITS (CHAR_BIT * sizeof(unsigned)) -#define BSET(uv, sn) ((uv)[(sn)/UBITS] |= (unsigned)1 << ((sn)%UBITS)) -#define ISBSET(uv, sn) ((uv)[(sn)/UBITS] & ((unsigned)1 << ((sn)%UBITS))) - - - -/* - * We dissect a chr into byts for colormap table indexing. Here we define - * a byt, which will be the same as a byte on most machines... The exact - * size of a byt is not critical, but about 8 bits is good, and extraction - * of 8-bit chunks is sometimes especially fast. - */ -#ifndef BYTBITS -#define BYTBITS 8 /* bits in a byt */ -#endif -#define BYTTAB (1<flags&FREECOL) - union tree *block; /* block of solid color, if any */ -}; - -/* the color map itself */ -struct colormap -{ - int magic; -#define CMMAGIC 0x876 - struct vars *v; /* for compile error reporting */ - size_t ncds; /* number of colordescs */ - size_t max; /* highest in use */ - color free; /* beginning of free chain (if non-0) */ - struct colordesc *cd; -#define CDEND(cm) (&(cm)->cd[(cm)->max + 1]) -#define NINLINECDS ((size_t)10) - struct colordesc cdspace[NINLINECDS]; - union tree tree[NBYTS]; /* tree top, plus fill blocks */ -}; - -/* optimization magic to do fast chr->color mapping */ -#define B0(c) ((c) & BYTMASK) -#define B1(c) (((c)>>BYTBITS) & BYTMASK) -#define B2(c) (((c)>>(2*BYTBITS)) & BYTMASK) -#define B3(c) (((c)>>(3*BYTBITS)) & BYTMASK) -#if NBYTS == 1 -#define GETCOLOR(cm, c) ((cm)->tree->tcolor[B0(c)]) -#endif -/* beware, for NBYTS>1, GETCOLOR() is unsafe -- 2nd arg used repeatedly */ -#if NBYTS == 2 -#define GETCOLOR(cm, c) ((cm)->tree->tptr[B1(c)]->tcolor[B0(c)]) -#endif -#if NBYTS == 4 -#define GETCOLOR(cm, c) ((cm)->tree->tptr[B3(c)]->tptr[B2(c)]->tptr[B1(c)]->tcolor[B0(c)]) -#endif - - - -/* - * Interface definitions for locale-interface functions in locale.c. - * Multi-character collating elements (MCCEs) cause most of the trouble. - */ -struct cvec -{ - int nchrs; /* number of chrs */ - int chrspace; /* number of chrs possible */ - chr *chrs; /* pointer to vector of chrs */ - int nranges; /* number of ranges (chr pairs) */ - int rangespace; /* number of chrs possible */ - chr *ranges; /* pointer to vector of chr pairs */ - int nmcces; /* number of MCCEs */ - int mccespace; /* number of MCCEs possible */ - int nmccechrs; /* number of chrs used for MCCEs */ - chr *mcces[1]; /* pointers to 0-terminated MCCEs */ - /* and both batches of chrs are on the end */ -}; - -/* caution: this value cannot be changed easily */ -#define MAXMCCE 2 /* length of longest MCCE */ - - - -/* - * definitions for NFA internal representation - * - * Having a "from" pointer within each arc may seem redundant, but it - * saves a lot of hassle. - */ -struct state; - -struct arc -{ - int type; -#define ARCFREE '\0' - color co; - struct state *from; /* where it's from (and contained within) */ - struct state *to; /* where it's to */ - struct arc *outchain; /* *from's outs chain or free chain */ -#define freechain outchain - struct arc *inchain; /* *to's ins chain */ - struct arc *colorchain; /* color's arc chain */ -}; - -struct arcbatch -{ /* for bulk allocation of arcs */ - struct arcbatch *next; -#define ABSIZE 10 - struct arc a[ABSIZE]; -}; - -struct state -{ - int no; -#define FREESTATE (-1) - char flag; /* marks special states */ - int nins; /* number of inarcs */ - struct arc *ins; /* chain of inarcs */ - int nouts; /* number of outarcs */ - struct arc *outs; /* chain of outarcs */ - struct arc *free; /* chain of free arcs */ - struct state *tmp; /* temporary for traversal algorithms */ - struct state *next; /* chain for traversing all */ - struct state *prev; /* back chain */ - struct arcbatch oas; /* first arcbatch, avoid malloc in easy - * case */ - int noas; /* number of arcs used in first arcbatch */ -}; - -struct nfa -{ - struct state *pre; /* pre-initial state */ - struct state *init; /* initial state */ - struct state *final; /* final state */ - struct state *post; /* post-final state */ - int nstates; /* for numbering states */ - struct state *states; /* state-chain header */ - struct state *slast; /* tail of the chain */ - struct state *free; /* free list */ - struct colormap *cm; /* the color map */ - color bos[2]; /* colors, if any, assigned to BOS and BOL */ - color eos[2]; /* colors, if any, assigned to EOS and EOL */ - struct vars *v; /* simplifies compile error reporting */ - struct nfa *parent; /* parent NFA, if any */ -}; - - - -/* - * definitions for compacted NFA - */ -struct carc -{ - color co; /* COLORLESS is list terminator */ - int to; /* state number */ -}; - -struct cnfa -{ - int nstates; /* number of states */ - int ncolors; /* number of colors */ - int flags; -#define HASLACONS 01 /* uses lookahead constraints */ - int pre; /* setup state number */ - int post; /* teardown state number */ - color bos[2]; /* colors, if any, assigned to BOS and BOL */ - color eos[2]; /* colors, if any, assigned to EOS and EOL */ - struct carc **states; /* vector of pointers to outarc lists */ - struct carc *arcs; /* the area for the lists */ -}; - -#define ZAPCNFA(cnfa) ((cnfa).nstates = 0) -#define NULLCNFA(cnfa) ((cnfa).nstates == 0) - - - -/* - * subexpression tree - */ -struct subre -{ - char op; /* '|', '.' (concat), 'b' (backref), '(', - * '=' */ - char flags; -#define LONGER 01 /* prefers longer match */ -#define SHORTER 02 /* prefers shorter match */ -#define MIXED 04 /* mixed preference below */ -#define CAP 010 /* capturing parens below */ -#define BACKR 020 /* back reference below */ -#define INUSE 0100 /* in use in final tree */ -#define LOCAL 03 /* bits which may not propagate up */ -#define LMIX(f) ((f)<<2) /* LONGER -> MIXED */ -#define SMIX(f) ((f)<<1) /* SHORTER -> MIXED */ -#define UP(f) (((f)&~LOCAL) | (LMIX(f) & SMIX(f) & MIXED)) -#define MESSY(f) ((f)&(MIXED|CAP|BACKR)) -#define PREF(f) ((f)&LOCAL) -#define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2)) -#define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2)) - short retry; /* index into retry memory */ - int subno; /* subexpression number (for 'b' and '(') */ - short min; /* min repetitions, for backref only */ - short max; /* max repetitions, for backref only */ - struct subre *left; /* left child, if any (also freelist - * chain) */ - struct subre *right; /* right child, if any */ - struct state *begin; /* outarcs from here... */ - struct state *end; /* ...ending in inarcs here */ - struct cnfa cnfa; /* compacted NFA, if any */ - struct subre *chain; /* for bookkeeping and error cleanup */ -}; - - - -/* - * table of function pointers for generic manipulation functions - * A regex_t's re_fns points to one of these. - */ -struct fns -{ - void FUNCPTR(free, (regex_t *)); -}; - - - -/* - * the insides of a regex_t, hidden behind a void * - */ -struct guts -{ - int magic; -#define GUTSMAGIC 0xfed9 - int cflags; /* copy of compile flags */ - long info; /* copy of re_info */ - size_t nsub; /* copy of re_nsub */ - struct subre *tree; - struct cnfa search; /* for fast preliminary search */ - int ntree; - struct colormap cmap; - int FUNCPTR(compare, (const chr *, const chr *, size_t)); - struct subre *lacons; /* lookahead-constraint vector */ - int nlacons; /* size of lacons */ -}; diff --git a/src/regex/split.c b/src/regex/split.c new file mode 100644 index 0000000000..188bdb775b --- /dev/null +++ b/src/regex/split.c @@ -0,0 +1,316 @@ +#include +#include + +/* + - split - divide a string into fields, like awk split() + = int split(char *string, char *fields[], int nfields, char *sep); + */ +int /* number of fields, including overflow */ +split(string, fields, nfields, sep) +char *string; +char *fields[]; /* list is not NULL-terminated */ +int nfields; /* number of entries available in fields[] */ +char *sep; /* "" white, "c" single char, "ab" [ab]+ */ +{ + register char *p = string; + register char c; /* latest character */ + register char sepc = sep[0]; + register char sepc2; + register int fn; + register char **fp = fields; + register char *sepp; + register int trimtrail; + + /* white space */ + if (sepc == '\0') { + while ((c = *p++) == ' ' || c == '\t') + continue; + p--; + trimtrail = 1; + sep = " \t"; /* note, code below knows this is 2 long */ + sepc = ' '; + } else + trimtrail = 0; + sepc2 = sep[1]; /* now we can safely pick this up */ + + /* catch empties */ + if (*p == '\0') + return(0); + + /* single separator */ + if (sepc2 == '\0') { + fn = nfields; + for (;;) { + *fp++ = p; + fn--; + if (fn == 0) + break; + while ((c = *p++) != sepc) + if (c == '\0') + return(nfields - fn); + *(p-1) = '\0'; + } + /* we have overflowed the fields vector -- just count them */ + fn = nfields; + for (;;) { + while ((c = *p++) != sepc) + if (c == '\0') + return(fn); + fn++; + } + /* not reached */ + } + + /* two separators */ + if (sep[2] == '\0') { + fn = nfields; + for (;;) { + *fp++ = p; + fn--; + while ((c = *p++) != sepc && c != sepc2) + if (c == '\0') { + if (trimtrail && **(fp-1) == '\0') + fn++; + return(nfields - fn); + } + if (fn == 0) + break; + *(p-1) = '\0'; + while ((c = *p++) == sepc || c == sepc2) + continue; + p--; + } + /* we have overflowed the fields vector -- just count them */ + fn = nfields; + while (c != '\0') { + while ((c = *p++) == sepc || c == sepc2) + continue; + p--; + fn++; + while ((c = *p++) != '\0' && c != sepc && c != sepc2) + continue; + } + /* might have to trim trailing white space */ + if (trimtrail) { + p--; + while ((c = *--p) == sepc || c == sepc2) + continue; + p++; + if (*p != '\0') { + if (fn == nfields+1) + *p = '\0'; + fn--; + } + } + return(fn); + } + + /* n separators */ + fn = 0; + for (;;) { + if (fn < nfields) + *fp++ = p; + fn++; + for (;;) { + c = *p++; + if (c == '\0') + return(fn); + sepp = sep; + while ((sepc = *sepp++) != '\0' && sepc != c) + continue; + if (sepc != '\0') /* it was a separator */ + break; + } + if (fn < nfields) + *(p-1) = '\0'; + for (;;) { + c = *p++; + sepp = sep; + while ((sepc = *sepp++) != '\0' && sepc != c) + continue; + if (sepc == '\0') /* it wasn't a separator */ + break; + } + p--; + } + + /* not reached */ +} + +#ifdef TEST_SPLIT + + +/* + * test program + * pgm runs regression + * pgm sep splits stdin lines by sep + * pgm str sep splits str by sep + * pgm str sep n splits str by sep n times + */ +int +main(argc, argv) +int argc; +char *argv[]; +{ + char buf[512]; + register int n; +# define MNF 10 + char *fields[MNF]; + + if (argc > 4) + for (n = atoi(argv[3]); n > 0; n--) { + (void) strcpy(buf, argv[1]); + } + else if (argc > 3) + for (n = atoi(argv[3]); n > 0; n--) { + (void) strcpy(buf, argv[1]); + (void) split(buf, fields, MNF, argv[2]); + } + else if (argc > 2) + dosplit(argv[1], argv[2]); + else if (argc > 1) + while (fgets(buf, sizeof(buf), stdin) != NULL) { + buf[strlen(buf)-1] = '\0'; /* stomp newline */ + dosplit(buf, argv[1]); + } + else + regress(); + + exit(0); +} + +dosplit(string, seps) +char *string; +char *seps; +{ +# define NF 5 + char *fields[NF]; + register int nf; + + nf = split(string, fields, NF, seps); + print(nf, NF, fields); +} + +print(nf, nfp, fields) +int nf; +int nfp; +char *fields[]; +{ + register int fn; + register int bound; + + bound = (nf > nfp) ? nfp : nf; + printf("%d:\t", nf); + for (fn = 0; fn < bound; fn++) + printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n"); +} + +#define RNF 5 /* some table entries know this */ +struct { + char *str; + char *seps; + int nf; + char *fi[RNF]; +} tests[] = { + "", " ", 0, { "" }, + " ", " ", 2, { "", "" }, + "x", " ", 1, { "x" }, + "xy", " ", 1, { "xy" }, + "x y", " ", 2, { "x", "y" }, + "abc def g ", " ", 5, { "abc", "def", "", "g", "" }, + " a bcd", " ", 4, { "", "", "a", "bcd" }, + "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" }, + " a b c d ", " ", 6, { "", "a", "b", "c", "d " }, + + "", " _", 0, { "" }, + " ", " _", 2, { "", "" }, + "x", " _", 1, { "x" }, + "x y", " _", 2, { "x", "y" }, + "ab _ cd", " _", 2, { "ab", "cd" }, + " a_b c ", " _", 5, { "", "a", "b", "c", "" }, + "a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" }, + " a b c d ", " _", 6, { "", "a", "b", "c", "d " }, + + "", " _~", 0, { "" }, + " ", " _~", 2, { "", "" }, + "x", " _~", 1, { "x" }, + "x y", " _~", 2, { "x", "y" }, + "ab _~ cd", " _~", 2, { "ab", "cd" }, + " a_b c~", " _~", 5, { "", "a", "b", "c", "" }, + "a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" }, + "~a b c d ", " _~", 6, { "", "a", "b", "c", "d " }, + + "", " _~-", 0, { "" }, + " ", " _~-", 2, { "", "" }, + "x", " _~-", 1, { "x" }, + "x y", " _~-", 2, { "x", "y" }, + "ab _~- cd", " _~-", 2, { "ab", "cd" }, + " a_b c~", " _~-", 5, { "", "a", "b", "c", "" }, + "a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" }, + "~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " }, + + "", " ", 0, { "" }, + " ", " ", 2, { "", "" }, + "x", " ", 1, { "x" }, + "xy", " ", 1, { "xy" }, + "x y", " ", 2, { "x", "y" }, + "abc def g ", " ", 4, { "abc", "def", "g", "" }, + " a bcd", " ", 3, { "", "a", "bcd" }, + "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" }, + " a b c d ", " ", 6, { "", "a", "b", "c", "d " }, + + "", "", 0, { "" }, + " ", "", 0, { "" }, + "x", "", 1, { "x" }, + "xy", "", 1, { "xy" }, + "x y", "", 2, { "x", "y" }, + "abc def g ", "", 3, { "abc", "def", "g" }, + "\t a bcd", "", 2, { "a", "bcd" }, + " a \tb\t c ", "", 3, { "a", "b", "c" }, + "a b c d e ", "", 5, { "a", "b", "c", "d", "e" }, + "a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" }, + " a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " }, + + NULL, NULL, 0, { NULL }, +}; + +regress() +{ + char buf[512]; + register int n; + char *fields[RNF+1]; + register int nf; + register int i; + register int printit; + register char *f; + + for (n = 0; tests[n].str != NULL; n++) { + (void) strcpy(buf, tests[n].str); + fields[RNF] = NULL; + nf = split(buf, fields, RNF, tests[n].seps); + printit = 0; + if (nf != tests[n].nf) { + printf("split `%s' by `%s' gave %d fields, not %d\n", + tests[n].str, tests[n].seps, nf, tests[n].nf); + printit = 1; + } else if (fields[RNF] != NULL) { + printf("split() went beyond array end\n"); + printit = 1; + } else { + for (i = 0; i < nf && i < RNF; i++) { + f = fields[i]; + if (f == NULL) + f = "(NULL)"; + if (strcmp(f, tests[n].fi[i]) != 0) { + printf("split `%s' by `%s', field %d is `%s', not `%s'\n", + tests[n].str, tests[n].seps, + i, fields[i], tests[n].fi[i]); + printit = 1; + } + } + } + if (printit) + print(nf, RNF, fields); + } +} +#endif diff --git a/src/regex/tclUniData.c b/src/regex/tclUniData.c deleted file mode 100644 index 9f0c6e05ae..0000000000 --- a/src/regex/tclUniData.c +++ /dev/null @@ -1,904 +0,0 @@ -/* - * tclUniData.c -- - * - * Declarations of Unicode character information tables. This file is - * automatically generated by the tools/uniParse.tcl script. Do not - * modify this file by hand. - * - * Copyright (c) 1998 by Scriptics Corporation. - * All rights reserved. - * - * RCS: @(#) $Id$ - */ - -/* - * A 16-bit Unicode character is split into two parts in order to index - * into the following tables. The lower OFFSET_BITS comprise an offset - * into a page of characters. The upper bits comprise the page number. - */ - -#define OFFSET_BITS 5 - -/* - * The pageMap is indexed by page number and returns an alternate page number - * that identifies a unique page of characters. Many Unicode characters map - * to the same alternate page number. - */ - -static unsigned char pageMap[] = { - 0, 1, 2, 3, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, 15, 16, 17, - 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 7, 32, - 7, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 47, - 48, 49, 50, 51, 52, 35, 47, 53, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 58, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 80, 81, - 84, 85, 80, 86, 87, 88, 89, 90, 91, 92, 35, 93, 94, 95, 35, 96, 97, - 98, 99, 100, 101, 102, 35, 47, 103, 104, 35, 35, 105, 106, 107, 47, - 47, 108, 47, 47, 109, 47, 110, 111, 47, 112, 47, 113, 114, 115, 116, - 114, 47, 117, 118, 35, 47, 47, 119, 90, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 120, 121, 47, 47, 122, - 35, 35, 35, 35, 47, 123, 124, 125, 126, 47, 127, 128, 47, 129, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 7, 7, 7, 7, 130, 7, 7, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 156, 156, 156, 156, 156, 156, - 157, 158, 159, 160, 161, 162, 35, 35, 35, 160, 163, 164, 165, 166, - 167, 168, 169, 160, 160, 160, 160, 170, 171, 172, 173, 174, 160, 160, - 175, 35, 35, 35, 35, 176, 177, 178, 179, 180, 181, 35, 35, 160, 160, - 160, 160, 160, 160, 160, 160, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 182, 160, 160, 155, 160, 160, 160, 160, 160, 160, 170, 183, 184, 185, - 90, 47, 186, 90, 47, 187, 188, 189, 47, 47, 190, 128, 35, 35, 191, - 192, 193, 194, 192, 195, 196, 197, 160, 160, 160, 198, 160, 160, 199, - 197, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 200, 35, 35, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 201, 35, 35, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 202, 203, 204, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 205, 35, 35, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 47, 47, 47, 47, 47, 47, 47, 47, 47, 208, 35, 35, 35, 35, - 35, 35, 209, 210, 211, 47, 47, 212, 213, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 214, 215, 47, 216, 47, 217, 218, 35, 219, 220, 221, 47, - 47, 47, 222, 223, 2, 224, 225, 226, 227, 228, 229, 230, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 231, 35, 232, 233, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 208, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 47, 234, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 235, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 236, 207, 207, 207, 207, 207, 207, 207, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35 -}; - -/* - * The groupMap is indexed by combining the alternate page number with - * the page offset and returns a group number that identifies a unique - * set of character attributes. - */ - -static unsigned char groupMap[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 4, 3, 3, 3, 5, 6, 3, 7, 3, 8, - 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 3, 7, 7, 7, 3, 3, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 5, 3, 6, 11, 12, 11, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 5, 7, 6, 7, 1, 2, 3, 4, 4, 4, 4, 14, 14, 11, 14, 15, 16, - 7, 8, 14, 11, 14, 7, 17, 17, 11, 18, 14, 3, 11, 17, 15, 19, 17, 17, - 17, 3, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 7, 10, 10, 10, 10, 10, 10, 10, 15, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 7, 13, 13, 13, 13, 13, 13, 13, 20, 21, 22, - 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, - 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, - 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 23, 24, 21, 22, 21, - 22, 21, 22, 15, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, - 22, 21, 22, 15, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, - 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, - 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 25, - 21, 22, 21, 22, 21, 22, 26, 15, 27, 21, 22, 21, 22, 28, 21, 22, 29, - 29, 21, 22, 15, 30, 31, 32, 21, 22, 29, 33, 34, 35, 36, 21, 22, 15, - 15, 35, 37, 15, 38, 21, 22, 21, 22, 21, 22, 39, 21, 22, 39, 15, 15, - 21, 22, 39, 21, 22, 40, 40, 21, 22, 21, 22, 41, 21, 22, 15, 42, 21, - 22, 15, 43, 42, 42, 42, 42, 44, 45, 46, 44, 45, 46, 44, 45, 46, 21, - 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 47, 21, - 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, - 15, 44, 45, 46, 21, 22, 48, 49, 21, 22, 21, 22, 21, 22, 21, 22, 0, - 0, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, - 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 50, 51, 15, 52, 52, 15, 53, 15, - 54, 15, 15, 15, 15, 52, 15, 15, 55, 15, 15, 15, 15, 56, 57, 15, 15, - 15, 15, 15, 57, 15, 15, 58, 15, 15, 59, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 60, 15, 15, 60, 15, 15, 15, 15, 60, 15, 61, 61, 15, 15, - 15, 15, 15, 15, 62, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 11, 11, 63, 63, 63, 63, 63, 63, 63, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 63, 63, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 63, 63, 63, 63, - 63, 11, 11, 11, 11, 11, 11, 11, 11, 11, 63, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, - 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, - 0, 0, 0, 0, 63, 0, 0, 0, 3, 0, 0, 0, 0, 0, 11, 11, 66, 3, 67, 67, 67, - 0, 68, 0, 69, 69, 15, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 70, 71, - 71, 71, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 72, 13, 13, 13, 13, 13, 13, 13, 13, 13, 73, 74, 74, 0, - 75, 76, 77, 77, 77, 78, 79, 15, 0, 0, 21, 22, 21, 22, 21, 22, 21, 22, - 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 80, 81, 47, - 15, 82, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 84, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 21, 22, 14, 64, 64, 64, 64, 0, 85, 85, 0, 0, 21, 22, - 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, - 22, 77, 21, 22, 21, 22, 0, 0, 21, 22, 0, 0, 21, 22, 0, 0, 0, 21, 22, - 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, - 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, - 21, 22, 0, 0, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 0, 0, 63, 3, 3, 3, 3, 3, 3, 0, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 15, 0, 3, 8, 0, 0, - 0, 0, 0, 0, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 0, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 64, 64, 64, 3, 64, 3, 64, - 64, 3, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 0, 0, 0, 0, 0, 42, 42, 42, 3, 3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 0, 0, 0, 0, 0, 63, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 3, 3, 3, 0, 0, 64, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 3, 42, 64, - 64, 64, 64, 64, 64, 64, 85, 85, 64, 64, 64, 64, 64, 64, 63, 63, 64, - 64, 14, 64, 64, 64, 64, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 42, 42, - 42, 14, 14, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 88, 42, - 64, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 42, 42, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, - 64, 89, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 0, 0, 64, 42, 89, 89, 89, 64, 64, 64, 64, 64, 64, - 64, 64, 89, 89, 89, 89, 64, 0, 0, 42, 64, 64, 64, 64, 0, 0, 0, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 64, 64, 3, 3, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, - 89, 89, 0, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 42, 42, 0, 0, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 0, 42, 0, 0, 0, 42, - 42, 42, 42, 0, 0, 64, 0, 89, 89, 89, 64, 64, 64, 64, 0, 0, 89, 89, - 0, 0, 89, 89, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 0, 0, 0, 0, 42, 42, - 0, 42, 42, 42, 64, 64, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 42, 42, - 4, 4, 17, 17, 17, 17, 17, 17, 14, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 42, - 42, 42, 42, 42, 42, 0, 0, 0, 0, 42, 42, 0, 0, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, - 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 0, 42, 42, 0, 42, 42, 0, 0, - 64, 0, 89, 89, 89, 64, 64, 0, 0, 0, 0, 64, 64, 0, 0, 64, 64, 64, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 0, 42, 0, 0, 0, 0, 0, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 64, 64, 42, 42, 42, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 64, 64, 89, 0, 42, 42, 42, 42, 42, 42, 42, - 0, 42, 0, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, - 42, 42, 0, 42, 42, 0, 42, 42, 42, 42, 42, 0, 0, 64, 42, 89, 89, 89, - 64, 64, 64, 64, 64, 0, 64, 64, 89, 0, 89, 89, 64, 0, 0, 42, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 0, 42, - 42, 0, 0, 42, 42, 42, 42, 0, 0, 64, 42, 89, 64, 89, 64, 64, 64, 0, - 0, 0, 89, 89, 0, 0, 89, 89, 64, 0, 0, 0, 0, 0, 0, 0, 0, 64, 89, 0, - 0, 0, 0, 42, 42, 0, 42, 42, 42, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 89, - 0, 42, 42, 42, 42, 42, 42, 0, 0, 0, 42, 42, 42, 0, 42, 42, 42, 42, - 0, 0, 0, 42, 42, 0, 42, 0, 42, 42, 0, 0, 0, 42, 42, 0, 0, 0, 42, 42, - 42, 0, 0, 0, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 42, 0, 0, 0, - 0, 89, 89, 64, 89, 89, 0, 0, 0, 89, 89, 89, 0, 89, 89, 89, 64, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 89, 89, 89, 0, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, - 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 0, 42, 42, 42, 42, 42, 0, 0, 0, 0, 64, 64, 64, 89, 89, - 89, 89, 0, 64, 64, 64, 0, 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, 64, - 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, - 89, 0, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 42, 0, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 42, - 42, 42, 0, 0, 0, 0, 89, 64, 89, 89, 89, 89, 89, 0, 64, 89, 89, 0, 89, - 89, 64, 64, 0, 0, 0, 0, 0, 0, 0, 89, 89, 0, 0, 0, 0, 0, 0, 0, 42, 0, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 89, 89, 89, 64, 64, - 64, 0, 0, 89, 89, 89, 0, 89, 89, 89, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 0, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 0, 0, - 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 64, 0, 0, 0, 0, 89, 89, 89, 64, - 64, 64, 0, 64, 0, 89, 89, 89, 89, 89, 89, 89, 89, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 3, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 64, 42, 42, 64, 64, 64, 64, 64, 64, 64, 0, 0, 0, 0, 4, 42, 42, - 42, 42, 42, 42, 63, 64, 64, 64, 64, 64, 64, 64, 64, 3, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 3, 3, 0, 0, 0, 0, 0, 42, 42, 0, 42, 0, 0, 42, 42, - 0, 42, 0, 0, 42, 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 0, 42, 42, 42, 42, - 42, 42, 42, 0, 42, 42, 42, 0, 42, 0, 42, 0, 0, 42, 42, 0, 42, 42, 42, - 42, 64, 42, 42, 64, 64, 64, 64, 64, 64, 0, 64, 64, 42, 0, 0, 42, 42, - 42, 42, 42, 0, 63, 0, 64, 64, 64, 64, 64, 64, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 42, 42, 0, 0, 42, 14, 14, 14, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 14, 14, 14, 14, 14, 64, 64, 14, 14, 14, - 14, 14, 14, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 14, 64, 14, 64, 14, 64, 5, 6, 5, 6, 89, 89, 42, 42, 42, - 42, 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 89, 64, 64, 64, 64, 64, 3, 64, 64, 42, - 42, 42, 42, 0, 0, 0, 0, 64, 64, 64, 64, 64, 64, 64, 64, 0, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 0, 14, 14, 14, 14, 14, 14, 14, 14, 64, 14, 14, 14, 14, 14, 14, 0, 0, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 0, 42, - 42, 42, 42, 42, 0, 42, 42, 0, 89, 64, 64, 64, 64, 89, 64, 0, 0, 0, - 64, 64, 89, 64, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, - 3, 3, 3, 3, 3, 42, 42, 42, 42, 42, 42, 89, 89, 64, 64, 0, 0, 0, 0, - 0, 0, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 0, 0, 0, 0, 3, 0, 0, 0, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, - 0, 0, 0, 0, 42, 42, 42, 42, 0, 0, 0, 0, 0, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 42, 42, 42, - 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 0, 42, 0, 42, 42, 42, 42, 0, 0, 42, 42, 42, 42, 42, 42, 42, - 0, 42, 0, 42, 42, 42, 42, 0, 0, 42, 42, 42, 42, 42, 42, 42, 0, 42, - 0, 42, 42, 42, 42, 0, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 0, 42, 0, 42, 42, 42, 42, 0, 0, 42, 42, 42, 42, 42, 42, - 42, 0, 42, 0, 42, 42, 42, 42, 0, 0, 42, 42, 42, 42, 42, 42, 42, 0, - 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, - 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 0, 0, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 3, 3, 42, 42, 42, 42, 42, - 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 5, 6, 0, 0, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 3, 3, 3, 90, 90, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 89, 89, 89, 64, 64, 64, 64, 64, 64, 64, 89, 89, 89, 89, 89, - 89, 89, 89, 64, 89, 89, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 3, 3, 3, 3, 3, 3, 3, 4, 3, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, - 3, 3, 3, 3, 8, 3, 3, 3, 3, 88, 88, 88, 88, 0, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 0, 0, 0, 0, 0, 0, 42, 42, 42, 63, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, - 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 64, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 22, 21, 22, 21, 22, 21, - 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 15, 15, - 15, 15, 15, 91, 0, 0, 0, 0, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, - 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 0, - 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, - 93, 93, 93, 92, 92, 92, 92, 92, 92, 0, 0, 93, 93, 93, 93, 93, 93, 0, - 0, 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, - 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 92, - 92, 92, 92, 92, 92, 0, 0, 93, 93, 93, 93, 93, 93, 0, 0, 15, 92, 15, - 92, 15, 92, 15, 92, 0, 93, 0, 93, 0, 93, 0, 93, 92, 92, 92, 92, 92, - 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 95, 95, 95, 95, - 96, 96, 97, 97, 98, 98, 99, 99, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, - 100, 100, 100, 100, 100, 100, 100, 100, 92, 92, 92, 92, 92, 92, 92, - 92, 100, 100, 100, 100, 100, 100, 100, 100, 92, 92, 92, 92, 92, 92, - 92, 92, 100, 100, 100, 100, 100, 100, 100, 100, 92, 92, 15, 101, 15, - 0, 15, 15, 93, 93, 102, 102, 103, 11, 104, 11, 11, 11, 15, 101, 15, - 0, 15, 15, 105, 105, 105, 105, 103, 11, 11, 11, 92, 92, 15, 15, 0, - 0, 15, 15, 93, 93, 106, 106, 0, 11, 11, 11, 92, 92, 15, 15, 15, 107, - 15, 15, 93, 93, 108, 108, 109, 11, 11, 11, 0, 0, 15, 101, 15, 0, 15, - 15, 110, 110, 111, 111, 103, 11, 11, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 88, 88, 88, 88, 8, 8, 8, 8, 8, 8, 3, 3, 16, 19, 5, 16, 16, - 19, 5, 16, 3, 3, 3, 3, 3, 3, 3, 3, 112, 113, 88, 88, 88, 88, 88, 2, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 16, 19, 3, 3, 3, 3, 12, 12, 3, 3, 3, 7, - 5, 6, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 88, 88, 88, 88, 88, 17, - 0, 0, 0, 17, 17, 17, 17, 17, 17, 7, 7, 7, 5, 6, 15, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 7, 7, 7, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 85, 85, 85, 85, 64, 85, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 77, - 14, 14, 14, 14, 77, 14, 14, 15, 77, 77, 77, 15, 15, 77, 77, 77, 15, - 14, 77, 14, 14, 14, 77, 77, 77, 77, 77, 14, 14, 14, 14, 14, 14, 77, - 14, 114, 14, 77, 14, 115, 116, 77, 77, 14, 15, 77, 77, 14, 77, 15, - 42, 42, 42, 42, 15, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 118, 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 90, 90, 90, 90, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 7, 7, 14, 14, - 14, 14, 7, 14, 14, 7, 14, 14, 7, 14, 14, 14, 14, 14, 14, 14, 7, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 7, 7, 14, 14, 7, - 14, 7, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 7, 7, 7, 7, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 7, 7, 14, 14, 14, 14, 14, 14, 14, 5, 6, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 7, 14, 14, 14, 14, 14, 14, 14, 14, 14, 7, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 7, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, - 14, 14, 14, 0, 14, 14, 14, 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 0, 14, 0, 14, 14, 14, 14, 0, 0, 0, 14, 0, 14, 14, - 14, 14, 14, 14, 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, - 0, 0, 0, 2, 3, 3, 3, 14, 63, 42, 90, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, - 14, 14, 5, 6, 5, 6, 5, 6, 5, 6, 8, 5, 6, 6, 14, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 64, 64, 64, 64, 64, 64, 8, 63, 63, 63, 63, 63, 14, - 14, 90, 90, 90, 0, 0, 0, 14, 14, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 64, 64, - 11, 11, 63, 63, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 12, 63, - 63, 63, 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 14, 14, 17, 17, 17, - 17, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 0, 14, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 42, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 122, 122, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 0, - 0, 0, 0, 0, 42, 64, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 7, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 42, 42, 42, 42, - 42, 0, 42, 0, 42, 42, 0, 42, 42, 0, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, 0, 64, 64, 64, 64, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 8, 8, 12, 12, 5, 6, 5, 6, 5, - 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 0, 0, 0, 0, 3, 3, 3, 3, 12, 12, 12, - 3, 3, 3, 0, 3, 3, 3, 3, 8, 5, 6, 5, 6, 5, 6, 3, 3, 3, 7, 8, 7, 7, 7, - 0, 3, 4, 3, 3, 0, 0, 0, 0, 42, 42, 42, 0, 42, 0, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 0, 0, 88, 0, 3, 3, 3, 4, 3, 3, 3, 5, 6, 3, 7, 3, 8, 3, 3, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 3, 3, 7, 7, 7, 3, 11, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 5, 7, 6, 7, 0, 0, 3, 5, 6, 3, 12, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 63, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 63, - 63, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, - 42, 42, 42, 42, 42, 42, 0, 0, 42, 42, 42, 42, 42, 42, 0, 0, 42, 42, - 42, 42, 42, 42, 0, 0, 42, 42, 42, 0, 0, 0, 4, 4, 7, 11, 14, 4, 4, 0, - 14, 7, 7, 7, 7, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 88, 88, 14, - 14, 42, 17, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 123, 123, - 126, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 89, 64, 14, 14, 14, - 14, 14, 0, 0, 77, 77, 15, 15, 77, 15, 15, 77, 77, 15, 77, 77, 15, 77, - 77, 15, 15, 77, 15, 15, 77, 77, 15, 77, 77, 15, 77, 77, 15, 15, 77, - 15, 15, 77, 77, 15, 77, 77, 15, 77, 77, 15, 15, 77, 77, 15, 15, 77, - 15, 15, 77, 77, 15, 15, 77, 15, 15, 77, 77, 15, 15, 9, 9, 9, 42, 42, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 88, 0, 88, 88, 88, 88, 88, 88, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122 -}; - -/* - * Each group represents a unique set of character attributes. The attributes - * are encoded into a 32-bit value as follows: - * - * Bits 0-4 Character category: see the constants listed below. - * - * Bits 5-7 Case delta type: 000 = identity - * 010 = add delta for lower - * 011 = add delta for lower, add 1 for title - * 100 = sutract delta for title/upper - * 101 = sub delta for upper, sub 1 for title - * 110 = sub delta for upper, add delta for lower - * - * Bits 8-21 Reserved for future use. - * - * Bits 22-31 Case delta: delta for case conversions. This should be the - * highest field so we can easily sign extend. - */ - -static int groups[] = { - 0, 15, 12, 25, 27, 21, 22, 26, 20, 9, 134217793, 28, 19, 134217858, - 29, 2, 23, 11, 1178599554, 24, -507510654, 4194369, 4194434, -834666431, - 973078658, -507510719, 1258291330, 880803905, 864026689, 859832385, - 331350081, 847249473, 851443777, 868220993, -406847358, 884998209, - 876609601, 893386817, 897581121, 914358337, 910164033, 918552641, - 5, -234880894, 8388705, 4194499, 8388770, 331350146, -406847423, - -234880959, 880803970, 864026754, 859832450, 847249538, 851443842, - 868221058, 876609666, 884998274, 893386882, 897581186, 914358402, - 910164098, 918552706, 4, 6, -352321402, 159383617, 155189313, - 268435521, 264241217, 159383682, 155189378, 130023554, 268435586, - 264241282, 260046978, 239075458, 1, 197132418, 226492546, 360710274, - 335544450, -251658175, 402653314, 335544385, 7, 201326657, 201326722, - 16, 8, 10, 247464066, -33554302, -33554367, -310378366, -360710014, - -419430270, -536870782, -469761918, -528482174, -33554365, -37748606, - -310378431, -37748669, 155189378, -360710079, -419430335, -29359998, - -469761983, -29360063, -536870847, -528482239, 13, 14, -1463812031, - -801111999, -293601215, 67108938, 67109002, 109051997, 109052061, - 18, 17, 8388673, 12582977, 8388738, 12583042 -}; - -/* - * The following constants are used to determine the category of a - * Unicode character. - */ - -#define UNICODE_CATEGORY_MASK 0X1F - -enum { - UNASSIGNED, - UPPERCASE_LETTER, - LOWERCASE_LETTER, - TITLECASE_LETTER, - MODIFIER_LETTER, - OTHER_LETTER, - NON_SPACING_MARK, - ENCLOSING_MARK, - COMBINING_SPACING_MARK, - DECIMAL_DIGIT_NUMBER, - LETTER_NUMBER, - OTHER_NUMBER, - SPACE_SEPARATOR, - LINE_SEPARATOR, - PARAGRAPH_SEPARATOR, - CONTROL, - FORMAT, - PRIVATE_USE, - SURROGATE, - CONNECTOR_PUNCTUATION, - DASH_PUNCTUATION, - OPEN_PUNCTUATION, - CLOSE_PUNCTUATION, - INITIAL_QUOTE_PUNCTUATION, - FINAL_QUOTE_PUNCTUATION, - OTHER_PUNCTUATION, - MATH_SYMBOL, - CURRENCY_SYMBOL, - MODIFIER_SYMBOL, - OTHER_SYMBOL -}; - -/* - * The following macros extract the fields of the character info. The - * GetDelta() macro is complicated because we can't rely on the C compiler - * to do sign extension on right shifts. - */ - -#define GetCaseType(info) (((info) & 0xE0) >> 5) -#define GetCategory(info) ((info) & 0x1F) -#define GetDelta(info) (((info) > 0) ? ((info) >> 22) : (~(~((info)) >> 22))) - -/* - * This macro extracts the information about a character from the - * Unicode character tables. - */ - -#define GetUniCharInfo(ch) (groups[groupMap[(pageMap[(((int)(ch)) & 0xffff) >> OFFSET_BITS] << OFFSET_BITS) | ((ch) & ((1 << OFFSET_BITS)-1))]]) - diff --git a/src/regex/utils.h b/src/regex/utils.h new file mode 100644 index 0000000000..1a997ac8fc --- /dev/null +++ b/src/regex/utils.h @@ -0,0 +1,22 @@ +/* utility definitions */ +#ifdef _POSIX2_RE_DUP_MAX +#define DUPMAX _POSIX2_RE_DUP_MAX +#else +#define DUPMAX 255 +#endif +#define INFINITY (DUPMAX + 1) +#define NC (CHAR_MAX - CHAR_MIN + 1) +typedef unsigned char uch; + +/* switch off assertions (if not already off) if no REDEBUG */ +#ifndef REDEBUG +#ifndef NDEBUG +#define NDEBUG /* no assertions please */ +#endif +#endif +#include + +/* for old systems with bcopy() but no memmove() */ +#ifdef USEBCOPY +#define memmove(d, s, c) bcopy(s, d, c) +#endif diff --git a/src/stc/Makefile.in b/src/stc/Makefile.in index 01b2877cb8..b8a080b862 100644 --- a/src/stc/Makefile.in +++ b/src/stc/Makefile.in @@ -11,11 +11,11 @@ top_builddir = ../../.. scintilla_dir = $(top_srcdir)/contrib/src/stc/scintilla libsrc_dir = contrib/src/stc@PATH_IFS@$(scintilla_dir)/src -TARGET_LIBNAME=libstc +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_stc-@WX_RELEASE@ -LIBVERSION_CURRENT=1 -LIBVERSION_REVISION=0 -LIBVERSION_AGE=0 +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=stc diff --git a/src/univ/listbox.cpp b/src/univ/listbox.cpp index 725eafa5ec..f0f783992a 100644 --- a/src/univ/listbox.cpp +++ b/src/univ/listbox.cpp @@ -1007,7 +1007,7 @@ void wxListBox::ExtendSelection(int itemTo) } } -void wxListBox::Select(bool sel, int item) +void wxListBox::DoSelect(int item, bool sel) { if ( item != -1 ) { @@ -1027,7 +1027,7 @@ void wxListBox::Select(bool sel, int item) void wxListBox::SelectAndNotify(int item) { - Select(TRUE, item); + DoSelect(item); SendEvent(wxEVT_COMMAND_LISTBOX_SELECTED); } @@ -1046,7 +1046,7 @@ void wxListBox::Activate(int item) if ( item != -1 ) { - Select(TRUE, item); + DoSelect(item); SendEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); } @@ -1089,7 +1089,7 @@ bool wxListBox::PerformAction(const wxControlAction& action, item = m_current; if ( IsSelected(item) ) - Unselect(item); + DoUnselect(item); else SelectAndNotify(item); } @@ -1100,12 +1100,12 @@ bool wxListBox::PerformAction(const wxControlAction& action, if ( strArg.empty() ) SelectAndNotify(item); else - Select(TRUE, item); + DoSelect(item); } else if ( action == wxACTION_LISTBOX_SELECTADD ) - Select(TRUE, item); + DoSelect(item); else if ( action == wxACTION_LISTBOX_UNSELECT ) - Select(FALSE, item); + DoUnselect(item); else if ( action == wxACTION_LISTBOX_MOVEDOWN ) ChangeCurrent(1); else if ( action == wxACTION_LISTBOX_MOVEUP ) diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index ab9a0db5b4..5c4f87e74c 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -2810,7 +2810,7 @@ int wxGTKRenderer::HitTestFrame(const wxRect& rect, const wxPoint& pt, int flags // standard icons // ---------------------------------------------------------------------------- -static char *error_xpm[] = { +static const char *error_xpm[] = { /* columns rows colors chars-per-pixel */ "48 48 537 2", " c Gray0", @@ -3401,7 +3401,7 @@ static char *error_xpm[] = { "W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+W+" }; -static char *info_xpm[] = { +static const char *info_xpm[] = { /* columns rows colors chars-per-pixel */ "48 48 478 2", " c Gray0", @@ -3934,7 +3934,7 @@ static char *info_xpm[] = { }; /* XPM */ -static char *warning_xpm[] = { +static const char *warning_xpm[] = { /* columns rows colors chars-per-pixel */ "48 48 270 2", " c Gray0", @@ -4259,7 +4259,7 @@ static char *warning_xpm[] = { }; /* XPM */ -static char *question_xpm[] = { +static const char *question_xpm[] = { /* columns rows colors chars-per-pixel */ "48 48 101 2", " c Gray0", diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp index 3b0a025004..afc1a6efbd 100644 --- a/src/univ/winuniv.cpp +++ b/src/univ/winuniv.cpp @@ -109,7 +109,7 @@ void wxWindow::Init() m_isCurrent = FALSE; m_renderer = wxTheme::Get()->GetRenderer(); - + m_oldSize.x = -1; m_oldSize.y = -1; } @@ -240,7 +240,7 @@ void wxWindow::OnErase(wxEraseEvent& event) return; } - + DoDrawBackground(*event.GetDC()); // if we have both scrollbars, we also have a square in the corner between @@ -267,41 +267,42 @@ void wxWindow::OnErase(wxEraseEvent& event) bool wxWindow::DoDrawBackground(wxDC& dc) { wxRect rect; - + wxSize size = GetSize(); // Why not GetClientSize() ? rect.x = 0; rect.y = 0; rect.width = size.x; rect.height = size.y; - - if (HasTransparentBackground() && GetParent() && GetParent()->ProvidesBackground()) + + wxWindow * const parent = GetParent(); + if ( HasTransparentBackground() && parent && parent->ProvidesBackground() ) { wxASSERT( !IsTopLevel() ); - + wxPoint pos = GetPosition(); - + AdjustForParentClientOrigin( pos.x, pos.y, 0 ); - + // Adjust DC logical origin wxCoord x,y; dc.GetLogicalOrigin( &x, &y ); x += pos.x; y += pos.y; dc.SetLogicalOrigin( x, y ); - + // Adjust draw rect rect.x = pos.x; rect.y = pos.y; - + // Let parent draw the background - GetParent()->EraseBackground( dc, rect ); + parent->EraseBackground( dc, rect ); } else { // Draw background ouselves - EraseBackground( dc, rect ); + EraseBackground( dc, rect ); } - + return TRUE; } @@ -315,10 +316,10 @@ void wxWindow::EraseBackground(wxDC& dc, const wxRect& rect) wxBitmap bmp = GetBackgroundBitmap(&alignment, &stretch); wxControlRenderer::DrawBitmap(dc, bmp, rect, alignment, stretch); } - else + else { // Just fill it with bg colour if no bitmap - + m_renderer->DrawBackground(dc, wxTHEME_BG_COLOUR(this), rect, GetStateFlags()); } @@ -478,28 +479,28 @@ int wxWindow::GetStateFlags() const void wxWindow::OnSize(wxSizeEvent& event) { event.Skip(); - + if ( m_scrollbarVert || m_scrollbarHorz ) { PositionScrollbars(); } - + #if 0 // ndef __WXMSW__ // Refresh the area (strip) previously occupied by the border - + if (HasFlag( wxNO_FULL_REPAINT_ON_RESIZE ) && IsShown()) { // This code assumes that wxSizeEvent.GetSize() returns // the area of the entire window, not just the client // area. wxSize newSize = event.GetSize(); - + if (m_oldSize.x == -1 && m_oldSize.y == -1) { m_oldSize = newSize; return; } - + if (HasFlag( wxSIMPLE_BORDER )) { if (newSize.y > m_oldSize.y) @@ -520,7 +521,7 @@ void wxWindow::OnSize(wxSizeEvent& event) rect.width = newSize.x; wxWindowNative::Refresh( TRUE, &rect ); } - + if (newSize.x > m_oldSize.x) { wxRect rect; @@ -561,7 +562,7 @@ void wxWindow::OnSize(wxSizeEvent& event) rect.width = newSize.x; wxWindowNative::Refresh( TRUE, &rect ); } - + if (newSize.x > m_oldSize.x) { wxRect rect; @@ -581,7 +582,7 @@ void wxWindow::OnSize(wxSizeEvent& event) wxWindowNative::Refresh( TRUE, &rect ); } } - + m_oldSize = newSize; } #endif @@ -915,7 +916,7 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) wxWindowNative::ScrollWindow(dx, dy, rect); -#else +#else // !wxX11 // before scrolling it, ensure that we don't have any unpainted areas Update(); @@ -933,11 +934,11 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) r = ScrollNoRefresh(0, dy, rect); Refresh(TRUE /* erase bkgnd */, &r); } - - // scroll children accordingly: + + // scroll children accordingly: wxPoint offset(dx, dy); - - for (wxWindowList::Node *node = GetChildren().GetFirst(); + + for (wxWindowList::Node *node = GetChildren().GetFirst(); node; node = node->GetNext()) { wxWindow *child = node->GetData(); @@ -945,13 +946,13 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) continue; // VS: Scrolling children has non-trivial semantics. If rect=NULL then - // it is easy: we scroll all children. Otherwise it gets + // it is easy: we scroll all children. Otherwise it gets // complicated: // 1. if scrolling in one direction only, scroll only // those children that intersect shaft defined by the rectangle // and scrolling direction // 2. if scrolling in both axes, scroll all children - + if ( rect && (dx * dy == 0 /* moving in only one of x, y axis */) ) { wxRect childRect = child->GetRect(); @@ -970,8 +971,8 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) { child->Move(child->GetPosition() + offset); } - } -#endif + } +#endif // wxX11/!wxX11 } wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal) diff --git a/src/unix/dialup.cpp b/src/unix/dialup.cpp index 8d6a76058e..50150eb326 100644 --- a/src/unix/dialup.cpp +++ b/src/unix/dialup.cpp @@ -785,7 +785,7 @@ wxDialUpManagerImpl::NetConnection wxDialUpManagerImpl::CheckPing() cmd << m_PingPath << ' '; #if defined(__SOLARIS__) || defined (__SUNOS__) // nothing to add to ping command -#elif defined(__LINUX__) || defined ( __FREEBSD__) || defined(__DARWIN__) || defined( __VMS ) +#elif defined(__LINUX__) || defined (__BSD__) || defined( __VMS ) cmd << "-c 1 "; // only ping once #elif defined(__HPUX__) cmd << "64 1 "; // only ping once (need also specify the packet size) diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index faf0bd2d6c..8c5508c557 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -1346,6 +1346,7 @@ void wxMimeTypesManagerImpl::ClearData() m_aExtensions.Clear (); m_aDescriptions.Clear (); + WX_CLEAR_ARRAY(m_aEntries); m_aEntries.Empty(); m_mailcapStylesInited = 0; @@ -1354,8 +1355,6 @@ void wxMimeTypesManagerImpl::ClearData() wxMimeTypesManagerImpl::~wxMimeTypesManagerImpl() { ClearData(); - - WX_CLEAR_ARRAY(m_aEntries); } @@ -2367,11 +2366,11 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName, // something is wrong, bail out cont = FALSE; - wxLogDebug(wxT("Mailcap file %s, line %d: " + wxLogDebug(wxT("Mailcap file %s, line %lu: " "'\\' on the end of the last line " "ignored."), strFileName.c_str(), - nLine + 1); + (unsigned long)nLine + 1); } else { @@ -2433,11 +2432,11 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName, // this might be useful for the programmer wxLogDebug ( - wxT("Mailcap file %s, line %d: " + wxT("Mailcap file %s, line %lu: " "unknown field '%s' for the " "MIME type '%s' ignored."), strFileName.c_str(), - nLine + 1, + (unsigned long)nLine + 1, curField.c_str(), data.type.c_str() ); @@ -2504,7 +2503,8 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName, if ( data.needsterminal ) { - data.cmdOpen.Printf(_T("xterm -e sh -c '%s'"), data.cmdOpen.c_str()); + data.cmdOpen = wxString::Format(_T("xterm -e sh -c '%s'"), + data.cmdOpen.c_str()); } if ( !data.cmdOpen.empty() ) diff --git a/src/unix/net.cpp b/src/unix/net.cpp deleted file mode 100644 index 8fff0bfdd1..0000000000 --- a/src/unix/net.cpp +++ /dev/null @@ -1,422 +0,0 @@ -// -*- c++ -*- /////////////////////////////////////////////////////////////// -// Name: unix/net.cpp -// Purpose: Network related wxWindows classes and functions -// Author: Karsten Ballüder -// Modified by: -// Created: 03.10.99 -// RCS-ID: $Id$ -// Copyright: (c) Karsten Ballüder -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/setup.h" - -#if wxUSE_DIALUP_MANAGER - -#ifndef WX_PRECOMP -# include "wx/defs.h" -#endif // !PCH - -#include "wx/string.h" -#include "wx/event.h" -#include "wx/net.h" -#include "wx/timer.h" -#include "wx/filefn.h" -#include "wx/utils.h" -#include "wx/log.h" -#include "wx/file.h" - -#include -#include -#include -#include -#define __STRICT_ANSI__ -#include -#include -#include -#include -#include -#include - -// ---------------------------------------------------------------------------- -// A class which groups functions dealing with connecting to the network from a -// workstation using dial-up access to the net. There is at most one instance -// of this class in the program accessed via GetDialUpManager(). -// ---------------------------------------------------------------------------- - -/* TODO - * - * 1. more configurability for Unix: i.e. how to initiate the connection, how - * to check for online status, &c. - * 2. add a "long Dial(long connectionId = -1)" function which asks the user - * about which connection to dial (this may be done using native dialogs - * under NT, need generic dialogs for all others) and returns the identifier - * of the selected connection (it's opaque to the application) - it may be - * reused later to dial the same connection later (or use strings instead of - * longs may be?) - * 3. add an async version of dialing functions which notify the caller about - * the progress (or may be even start another thread to monitor it) - * 4. the static creation/accessor functions are not MT-safe - but is this - * really crucial? I think we may suppose they're always called from the - * main thread? - */ - -class WXDLLEXPORT wxDialUpManagerImpl : public wxDialUpManager -{ -public: - wxDialUpManagerImpl() - { - m_IsOnline = -1; // unknown - m_timer = NULL; - m_CanUseIfconfig = -1; // unknown - m_BeaconHost = WXDIALUP_MANAGER_DEFAULT_BEACONHOST; - m_BeaconPort = 80; - } - - /** Could the dialup manager be initialized correctly? If this function - returns FALSE, no other functions will work neither, so it's a good idea - to call this function and check its result before calling any other - wxDialUpManager methods. - */ - virtual bool IsOk() const - { return TRUE; } - - /** The simplest way to initiate a dial up: this function dials the given - ISP (exact meaning of the parameter depends on the platform), returns - TRUE on success or FALSE on failure and logs the appropriate error - message in the latter case. - @param nameOfISP optional paramater for dial program - @param username unused - @param password unused - */ - virtual bool Dial(const wxString& nameOfISP, - const wxString& WXUNUSED(username), - const wxString& WXUNUSED(password)); - - /// Hang up the currently active dial up connection. - virtual bool HangUp(); - - // returns TRUE if the computer is connected to the network: under Windows, - // this just means that a RAS connection exists, under Unix we check that - // the "well-known host" (as specified by SetWellKnownHost) is reachable - virtual bool IsOnline() const - { - if( (! m_timer) // we are not polling, so test now: - || m_IsOnline == -1 - ) - CheckStatus(); - return m_IsOnline != 0; - } - - // sometimes the built-in logic for determining the online status may fail, - // so, in general, the user should be allowed to override it. This function - // allows to forcefully set the online status - whatever our internal - // algorithm may think about it. - virtual void SetOnlineStatus(bool isOnline = TRUE) - { m_IsOnline = isOnline; } - - // set misc wxDialUpManager options - // -------------------------------- - - // enable automatical checks for the connection status and sending of - // wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval - // parameter is only for Unix where we do the check manually: under - // Windows, the notification about the change of connection status is - // instantenous. - // - // Returns FALSE if couldn't set up automatic check for online status. - virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds); - - // disable automatic check for connection status change - notice that the - // wxEVT_DIALUP_XXX events won't be sent any more neither. - virtual void DisableAutoCheckOnlineStatus(); - - // under Unix, the value of well-known host is used to check whether we're - // connected to the internet. It's unused under Windows, but this function - // is always safe to call. The default value is www.yahoo.com. - virtual void SetWellKnownHost(const wxString& hostname, - int portno = 80); - /** Sets the commands to start up the network and to hang up - again. Used by the Unix implementations only. - */ - virtual void SetConnectCommand(const wxString &command, const wxString &hupcmd) - { m_ConnectCommand = command; m_HangUpCommand = hupcmd; } - -private: - /// -1: don´t know, 0 = no, 1 = yes - int m_IsOnline; - - /// Can we use ifconfig to list active devices? - int m_CanUseIfconfig; - /// The path to ifconfig - wxString m_IfconfigPath; - - /// beacon host: - wxString m_BeaconHost; - /// beacon host portnumber for connect: - int m_BeaconPort; - - /// command to connect to network - wxString m_ConnectCommand; - /// command to hang up - wxString m_HangUpCommand; - /// name of ISP - wxString m_ISPname; - /// a timer for regular testing - class AutoCheckTimer *m_timer; - - friend class AutoCheckTimer; - /// determine status - void CheckStatus(void) const; - - /// real status check - void CheckStatusInternal(void); -}; - - -class AutoCheckTimer : public wxTimer -{ -public: - AutoCheckTimer(wxDialUpManagerImpl *dupman) - { - m_dupman = dupman; - m_started = FALSE; - } - - virtual bool Start( int millisecs = -1 ) - { m_started = TRUE; return wxTimer::Start(millisecs, FALSE); } - - virtual void Notify() - { wxLogTrace("Checking dial up network status."); m_dupman->CheckStatus(); } - - virtual void Stop() - { if ( m_started ) wxTimer::Stop(); } -public: - bool m_started; - wxDialUpManagerImpl *m_dupman; -}; - -bool -wxDialUpManagerImpl::Dial(const wxString &isp, - const wxString & WXUNUSED(username), - const wxString & WXUNUSED(password)) -{ - if(m_IsOnline == 1) - return FALSE; - m_IsOnline = -1; - m_ISPname = isp; - wxString cmd; - if(m_ConnectCommand.Find("%s")) - cmd.Printf(m_ConnectCommand,m_ISPname.c_str()); - else - cmd = m_ConnectCommand; - return wxExecute(cmd, /* sync */ TRUE) == 0; -} - -bool -wxDialUpManagerImpl::HangUp(void) -{ - if(m_IsOnline == 0) - return FALSE; - m_IsOnline = -1; - wxString cmd; - if(m_HangUpCommand.Find("%s")) - cmd.Printf(m_HangUpCommand,m_ISPname.c_str()); - else - cmd = m_HangUpCommand; - return wxExecute(cmd, /* sync */ TRUE) == 0; -} - - -bool -wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds) -{ - wxASSERT(m_timer == NULL); - m_timer = new AutoCheckTimer(this); - bool rc = m_timer->Start(nSeconds*1000); - if(! rc) - { - delete m_timer; - m_timer = NULL; - } - return rc; -} - -void -wxDialUpManagerImpl::DisableAutoCheckOnlineStatus() -{ - wxASSERT(m_timer != NULL); - m_timer->Stop(); - delete m_timer; - m_timer = NULL; -} - - -void -wxDialUpManagerImpl::SetWellKnownHost(const wxString& hostname, int portno) -{ - /// does hostname contain a port number? - wxString port = hostname.After(':'); - if(port.Length()) - { - m_BeaconHost = hostname.Before(':'); - m_BeaconPort = atoi(port); - } - else - { - m_BeaconHost = hostname; - m_BeaconPort = portno; - } -} - - -void -wxDialUpManagerImpl::CheckStatus(void) const -{ - // This function calls the CheckStatusInternal() helper function - // which is OS - specific and then sends the events. - - int oldIsOnline = m_IsOnline; - ( /* non-const */ (wxDialUpManagerImpl *)this)->CheckStatusInternal(); - - // now send the events as appropriate: - if(m_IsOnline != oldIsOnline) - { - if(m_IsOnline) - ; // send ev - else - ; // send ev - } -} - -/* - We have three methods that we can use: - - 1. test via /sbin/ifconfig and grep for "sl", "ppp", "pl" - --> should be fast enough for regular polling - 2. test if we can reach the well known beacon host - --> too slow for polling - 3. check /proc/net/dev on linux?? - This method should be preferred, if possible. Need to do more - testing. - -*/ - -void -wxDialUpManagerImpl::CheckStatusInternal(void) -{ - m_IsOnline = -1; - - // First time check for ifconfig location. We only use the variant - // which does not take arguments, a la GNU. - if(m_CanUseIfconfig == -1) // unknown - { - if(wxFileExists("/sbin/ifconfig")) - m_IfconfigPath = "/sbin/ifconfig"; - else if(wxFileExists("/usr/sbin/ifconfig")) - m_IfconfigPath = "/usr/sbin/ifconfig"; - } - - wxLogNull ln; // suppress all error messages - // Let´s try the ifconfig method first, should be fastest: - if(m_CanUseIfconfig != 0) // unknown or yes - { - wxASSERT(m_IfconfigPath.length()); - - wxString tmpfile = wxGetTempFileName("_wxdialuptest"); - wxString cmd = "/bin/sh -c \'"; - cmd << m_IfconfigPath << " >" << tmpfile << '\''; - /* I tried to add an option to wxExecute() to not close stdout, - so we could let ifconfig write directly to the tmpfile, but - this does not work. That should be faster, as it doesn´t call - the shell first. I have no idea why. :-( (KB) */ -#if 0 - // temporarily redirect stdout/stderr: - int - new_stdout = dup(STDOUT_FILENO), - new_stderr = dup(STDERR_FILENO); - close(STDOUT_FILENO); - close(STDERR_FILENO); - - int - // new stdout: - output_fd = open(tmpfile, O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR), - // new stderr: - null_fd = open("/dev/null", O_CREAT, S_IRUSR|S_IWUSR); - // verify well behaved unix behaviour: - wxASSERT(output_fd == STDOUT_FILENO); - wxASSERT(null_fd == STDERR_FILENO); - int rc = wxExecute(m_IfconfigPath,TRUE /* sync */,NULL ,wxEXECUTE_DONT_CLOSE_FDS); - close(null_fd); close(output_fd); - // restore old stdout, stderr: - int test; - test = dup(new_stdout); close(new_stdout); wxASSERT(test == STDOUT_FILENO); - test = dup(new_stderr); close(new_stderr); wxASSERT(test == STDERR_FILENO); - if(rc == 0) -#endif - if(wxExecute(cmd,TRUE /* sync */) == 0) - { - m_CanUseIfconfig = 1; - wxFile file; - if( file.Open(tmpfile) ) - { - char *output = new char [file.Length()+1]; - output[file.Length()] = '\0'; - if(file.Read(output,file.Length()) == file.Length()) - { - if(strstr(output,"ppp") // ppp - || strstr(output,"sl") // slip - || strstr(output,"pl") // plip - ) - m_IsOnline = 1; - else - m_IsOnline = 0; - } - file.Close(); - delete [] output; - } - // else m_IsOnline remains -1 as we don't know for sure - } - else // could not run ifconfig correctly - m_CanUseIfconfig = 0; // don´t try again - (void) wxRemoveFile(tmpfile); - if(m_IsOnline != -1) // we are done - return; - } - - // second method: try to connect to well known host: - // This can be used under Win 9x, too! - struct hostent *hp; - struct sockaddr_in serv_addr; - int sockfd; - - m_IsOnline = 0; // assume false - if((hp = gethostbyname(m_BeaconHost)) == NULL) - return; // no DNS no net - - serv_addr.sin_family = hp->h_addrtype; - memcpy(&serv_addr.sin_addr,hp->h_addr, hp->h_length); - serv_addr.sin_port = htons(m_BeaconPort); - if( ( sockfd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) - { - // sys_error("cannot create socket for gw"); - return; - } - if( connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) - { - //sys_error("cannot connect to server"); - return; - } - //connected! - close(sockfd); -} - - -/* static */ -wxDialUpManager * -wxDialUpManager::wxDialUpManager::Create(void) -{ - return new wxDialUpManagerImpl; -} - -#endif // wxUSE_DIALUP_MANAGER diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index 47e9a41e62..add39edb3e 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -495,8 +495,8 @@ wxSemaError wxSemaphoreInternal::Wait() return wxSEMA_MISC_ERROR; wxLogTrace(TRACE_SEMA, - "Thread %ld finished waiting for semaphore, count = %u", - wxThread::GetCurrentId(), m_count); + "Thread %ld finished waiting for semaphore, count = %lu", + wxThread::GetCurrentId(), (unsigned long)m_count); } m_count--; @@ -553,9 +553,9 @@ wxSemaError wxSemaphoreInternal::Post() m_count++; wxLogTrace(TRACE_SEMA, - "Thread %ld about to signal semaphore, count = %u", - wxThread::GetCurrentId(), m_count); - + "Thread %ld about to signal semaphore, count = %lu", + wxThread::GetCurrentId(), (unsigned long)m_count); + return m_cond.Signal() == wxCOND_NO_ERROR ? wxSEMA_NO_ERROR : wxSEMA_MISC_ERROR; } @@ -620,7 +620,7 @@ public: }; wxLogTrace(TRACE_THREADS, _T("Thread %ld: %s => %s."), - GetId(), stateNames[m_state], stateNames[state]); + (long)GetId(), stateNames[m_state], stateNames[state]); #endif // __WXDEBUG__ m_state = state; @@ -696,7 +696,7 @@ void *wxThreadInternal::PthreadStart(wxThread *thread) { wxThreadInternal *pthread = thread->m_internal; - wxLogTrace(TRACE_THREADS, _T("Thread %ld started."), pthread->GetId()); + wxLogTrace(TRACE_THREADS, _T("Thread %ld started."), (long)pthread->GetId()); // associate the thread pointer with the newly created thread so that // wxThread::This() will work @@ -734,12 +734,12 @@ void *wxThreadInternal::PthreadStart(wxThread *thread) { // call the main entry wxLogTrace(TRACE_THREADS, _T("Thread %ld about to enter its Entry()."), - pthread->GetId()); + (long)pthread->GetId()); pthread->m_exitcode = thread->Entry(); wxLogTrace(TRACE_THREADS, _T("Thread %ld Entry() returned %lu."), - pthread->GetId(), (unsigned long)pthread->m_exitcode); + (long)pthread->GetId(), (unsigned long)pthread->m_exitcode); { wxCriticalSectionLocker lock(thread->m_critsect); @@ -849,7 +849,7 @@ void wxThreadInternal::Wait() wxMutexGuiLeave(); wxLogTrace(TRACE_THREADS, - _T("Starting to wait for thread %ld to exit."), GetId()); + _T("Starting to wait for thread %ld to exit."), (long)GetId()); // to avoid memory leaks we should call pthread_join(), but it must only be // done once so use a critical section to serialize the code below @@ -862,7 +862,7 @@ void wxThreadInternal::Wait() // we're cancelled inside pthread_join(), things will almost // certainly break - but if we disable the cancellation, we // might deadlock - if ( pthread_join((pthread_t)GetId(), &m_exitcode) != 0 ) + if ( pthread_join(GetId(), &m_exitcode) != 0 ) { // this is a serious problem, so use wxLogError and not // wxLogDebug: it is possible to bring the system to its knees @@ -888,7 +888,7 @@ void wxThreadInternal::Pause() wxCHECK_RET( m_state == STATE_PAUSED, wxT("thread must first be paused with wxThread::Pause().") ); - wxLogTrace(TRACE_THREADS, _T("Thread %ld goes to sleep."), GetId()); + wxLogTrace(TRACE_THREADS, _T("Thread %ld goes to sleep."), (long)GetId()); // wait until the semaphore is Post()ed from Resume() m_semSuspend.Wait(); @@ -903,7 +903,7 @@ void wxThreadInternal::Resume() // TestDestroy() since the last call to Pause() for example if ( IsReallyPaused() ) { - wxLogTrace(TRACE_THREADS, _T("Waking up thread %ld"), GetId()); + wxLogTrace(TRACE_THREADS, _T("Waking up thread %ld"), (long)GetId()); // wake up Pause() m_semSuspend.Post(); @@ -914,7 +914,7 @@ void wxThreadInternal::Resume() else { wxLogTrace(TRACE_THREADS, _T("Thread %ld is not yet really paused"), - GetId()); + (long)GetId()); } SetState(STATE_RUNNING); @@ -1598,8 +1598,9 @@ void wxThreadModule::OnExit() if ( nThreadsBeingDeleted > 0 ) { - wxLogTrace(TRACE_THREADS, _T("Waiting for %u threads to disappear"), - nThreadsBeingDeleted); + wxLogTrace(TRACE_THREADS, + _T("Waiting for %lu threads to disappear"), + (unsigned long)nThreadsBeingDeleted); // have to wait until all of them disappear gs_condAllDeleted->Wait(); @@ -1610,8 +1611,8 @@ void wxThreadModule::OnExit() size_t count = gs_allThreads.GetCount(); if ( count != 0u ) { - wxLogDebug(wxT("%u threads were not terminated by the application."), - count); + wxLogDebug(wxT("%lu threads were not terminated by the application."), + (unsigned long)count); } for ( size_t n = 0u; n < count; n++ ) @@ -1645,8 +1646,8 @@ static void ScheduleThreadForDeletion() gs_nThreadsBeingDeleted++; - wxLogTrace(TRACE_THREADS, _T("%u thread%s waiting to be deleted"), - gs_nThreadsBeingDeleted, + wxLogTrace(TRACE_THREADS, _T("%lu thread%s waiting to be deleted"), + (unsigned long)gs_nThreadsBeingDeleted, gs_nThreadsBeingDeleted == 1 ? "" : "s"); } @@ -1663,8 +1664,8 @@ static void DeleteThread(wxThread *This) wxCHECK_RET( gs_nThreadsBeingDeleted > 0, _T("no threads scheduled for deletion, yet we delete one?") ); - wxLogTrace(TRACE_THREADS, _T("%u scheduled for deletion threads left."), - gs_nThreadsBeingDeleted - 1); + wxLogTrace(TRACE_THREADS, _T("%lu scheduled for deletion threads left."), + (unsigned long)gs_nThreadsBeingDeleted - 1); if ( !--gs_nThreadsBeingDeleted ) { diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 1eb072f8aa..5171e0abd7 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -344,8 +344,19 @@ void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) if (m_pen.GetStyle() != wxTRANSPARENT) { if (m_window) - XDrawLine( (Display*) m_display, (Window) m_window, - (GC) m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) ); + { + // This hack is for the iPaq: XDrawLine draws + // nothing, whereas XDrawLines works... + wxPoint points[2]; + points[0].x = x1; + points[0].y = y1; + points[1].x = x2; + points[1].y = y2; + DrawLines( 2, points, 0, 0 ); + + // XDrawLine( (Display*) m_display, (Window) m_window, + // (GC) m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) ); + } CalcBoundingBox(x1, y1); CalcBoundingBox(x2, y2); @@ -2047,7 +2058,7 @@ wxClientDC::wxClientDC( wxWindow *window ) m_window = (WXWindow*) window->GetClientAreaWindow(); - // Adjust the client area when the wxWindow is not using 2 X windows. + // Adjust the client area when the wxWindow is not using 2 X11 windows. if (m_window == (WXWindow*) window->GetMainWindow()) { wxPoint ptOrigin = window->GetClientAreaOrigin(); diff --git a/src/x11/gsockx11.c b/src/x11/gsockx11.c index 1eabbedac9..a710c403d2 100644 --- a/src/x11/gsockx11.c +++ b/src/x11/gsockx11.c @@ -76,8 +76,10 @@ void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event) default: return; } - // if (m_id[c] != -1) - // XtRemoveInput(m_id[c]); +#if 0 + if (m_id[c] != -1) + XtRemoveInput(m_id[c]); +#endif /* 0 */ if (c == 0) { diff --git a/src/x11/popupwin.cpp b/src/x11/popupwin.cpp index 2fbf352a72..2e53b27408 100644 --- a/src/x11/popupwin.cpp +++ b/src/x11/popupwin.cpp @@ -17,6 +17,7 @@ #include "wx/popupwin.h" #include "wx/app.h" +#include "wx/settings.h" #include "wx/x11/private.h" #include "X11/Xatom.h" diff --git a/src/x11/reparent.cpp b/src/x11/reparent.cpp index bbeedaea5d..3ada5a3a29 100644 --- a/src/x11/reparent.cpp +++ b/src/x11/reparent.cpp @@ -21,10 +21,11 @@ #pragma implementation "reparent.h" #endif -#include "wx/x11/reparent.h" +#include "wx/setup.h" #if !wxUSE_NANOX +#include "wx/x11/reparent.h" #include "wx/evtloop.h" #include "wx/log.h" #include "wx/app.h" diff --git a/src/x11/settings.cpp b/src/x11/settings.cpp index f7d484b3d6..ef5de6e208 100644 --- a/src/x11/settings.cpp +++ b/src/x11/settings.cpp @@ -19,6 +19,7 @@ #include "wx/settings.h" #include "wx/gdicmn.h" +#include "wx/x11/private.h" wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) { @@ -123,11 +124,11 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index) // TODO return 0; case wxSYS_SCREEN_X: - // TODO - return 0; + return DisplayWidth( wxGlobalDisplay(), 0 ); + case wxSYS_SCREEN_Y: - // TODO - return 0; + return DisplayHeight( wxGlobalDisplay(), 0 ); + case wxSYS_FRAMESIZE_X: // TODO return 0; diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index fc15ff0ce1..ba245b3dba 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +// #include #include #if (defined(__SUNCC__) || defined(__CLCC__)) diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 1df4868f14..739d82887c 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -160,9 +160,9 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id, pos2.x = 0; if (pos2.y == -1) pos2.y = 0; - + #if wxUSE_TWO_WINDOWS - bool need_two_windows = + bool need_two_windows = ((( wxSUNKEN_BORDER | wxRAISED_BORDER | wxSIMPLE_BORDER | wxHSCROLL | wxVSCROLL ) & m_windowStyle) != 0); #else bool need_two_windows = FALSE; @@ -307,7 +307,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id, xattributes_mask |= CWBitGravity; xattributes.bit_gravity = NorthWestGravity; } - + Window xwindow = XCreateWindow( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y, 0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes ); #endif diff --git a/src/xrc/Makefile.in b/src/xrc/Makefile.in index f645274010..6305285017 100644 --- a/src/xrc/Makefile.in +++ b/src/xrc/Makefile.in @@ -7,11 +7,11 @@ expat_dir = $(top_srcdir)/contrib/src/xrc/expat libsrc_dir = contrib/src/xrc@PATH_IFS@$(expat_dir)/xmlparse@PATH_IFS@$(expat_dir)/xmltok -TARGET_LIBNAME=libwxxrc +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_xrc-@WX_RELEASE@ -LIBVERSION_CURRENT=0 -LIBVERSION_REVISION=1 -LIBVERSION_AGE=0 +LIBVERSION_CURRENT=@WX_CURRENT@ +LIBVERSION_REVISION=@WX_REVISION@ +LIBVERSION_AGE=@WX_AGE@ HEADER_PATH=$(top_srcdir)/contrib/include/wx HEADER_SUBDIR=xrc @@ -22,7 +22,7 @@ EXPAT_OBJECTS=xmltok.o xmlrole.o xmlparse.o HEADERS=xh_all.h xh_bttn.h xh_chckb.h xh_chckl.h xh_choic.h xh_combo.h \ xh_dlg.h xh_gauge.h xh_html.h xh_menu.h xh_notbk.h xh_panel.h \ xh_radbt.h xh_radbx.h xh_sizer.h xh_slidr.h xh_spin.h xh_stbmp.h \ - xh_sttxt.h xh_text.h xh_listb.h xml.h xmlio.h xmlres.h xh_toolb.h \ + xh_sttxt.h xh_text.h xh_listb.h xml.h xmlres.h xh_toolb.h \ xh_bmpbt.h xh_cald.h xh_listc.h xh_scrol.h xh_stbox.h xh_tree.h \ xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h xh_gdctl.h diff --git a/src/xrc/xh_dlg.cpp b/src/xrc/xh_dlg.cpp index d44ad16a91..3c916a9e1d 100644 --- a/src/xrc/xh_dlg.cpp +++ b/src/xrc/xh_dlg.cpp @@ -41,6 +41,8 @@ wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler() XRC_ADD_STYLE(wxTAB_TRAVERSAL); XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY); XRC_ADD_STYLE(wxCLIP_CHILDREN); + XRC_ADD_STYLE(wxMAXIMIZE_BOX); + XRC_ADD_STYLE(wxMINIMIZE_BOX); AddWindowStyles(); } diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 0a1b72cd3a..17581fa357 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -547,6 +547,40 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent, wx } +#include "wx/listimpl.cpp" +WX_DECLARE_LIST(wxXmlSubclassFactory, wxXmlSubclassFactoriesList); +WX_DEFINE_LIST(wxXmlSubclassFactoriesList); + +wxXmlSubclassFactoriesList *wxXmlResource::ms_subclassFactories = NULL; + +/*static*/ void wxXmlResource::AddSubclassFactory(wxXmlSubclassFactory *factory) +{ + if (!ms_subclassFactories) + { + ms_subclassFactories = new wxXmlSubclassFactoriesList; + ms_subclassFactories->DeleteContents(TRUE); + } + ms_subclassFactories->Append(factory); +} + +class wxXmlSubclassFactoryCXX : public wxXmlSubclassFactory +{ +public: + ~wxXmlSubclassFactoryCXX() {} + + wxObject *Create(const wxString& className) + { + wxClassInfo* classInfo = wxClassInfo::FindClass(className); + + if (classInfo) + return classInfo->CreateObject(); + else + return NULL; + } +}; + + + wxXmlResourceHandler::wxXmlResourceHandler() @@ -568,18 +602,23 @@ wxObject *wxXmlResourceHandler::CreateResource(wxXmlNode *node, wxObject *parent !(m_resource->GetFlags() & wxXRC_NO_SUBCLASSING)) { wxString subclass = node->GetPropVal(wxT("subclass"), wxEmptyString); - wxClassInfo* classInfo = wxClassInfo::FindClass(subclass); - - if (classInfo) - m_instance = classInfo->CreateObject(); - - if (!m_instance) + if (!subclass.empty()) { - wxLogError(_("Subclass '%s' not found for resource '%s', not subclassing!"), - subclass.c_str(), node->GetPropVal(wxT("name"), wxEmptyString).c_str()); - } + for (wxXmlSubclassFactoriesList::Node *i = wxXmlResource::ms_subclassFactories->GetFirst(); + i; i = i->GetNext()) + { + m_instance = i->GetData()->Create(subclass); + if (m_instance) + break; + } - m_instance = classInfo->CreateObject(); + if (!m_instance) + { + wxString name = node->GetPropVal(wxT("name"), wxEmptyString); + wxLogError(_("Subclass '%s' not found for resource '%s', not subclassing!"), + subclass.c_str(), name.c_str()); + } + } } m_node = node; @@ -733,6 +772,7 @@ int wxXmlResourceHandler::GetID() stdID(wxID_STATIC); stdID(wxID_FORWARD); stdID(wxID_BACKWARD); stdID(wxID_DEFAULT); stdID(wxID_MORE); stdID(wxID_SETUP); stdID(wxID_RESET); stdID(wxID_HELP_CONTEXT); + stdID(wxID_CLOSE_ALL); #undef stdID else return wxXmlResource::GetXRCID(sid); } @@ -1166,11 +1206,13 @@ public: wxXmlResourceModule() {} bool OnInit() { + wxXmlResource::AddSubclassFactory(new wxXmlSubclassFactoryCXX); return TRUE; } void OnExit() { delete wxXmlResource::Set(NULL); + wxDELETE(wxXmlResource::ms_subclassFactories); CleanXRCID_Records(); } }; diff --git a/utils/wxprop/src/prop.cpp b/utils/wxprop/src/prop.cpp deleted file mode 100644 index 59802962de..0000000000 --- a/utils/wxprop/src/prop.cpp +++ /dev/null @@ -1,1119 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: prop.cpp -// Purpose: Propert sheet classes implementation -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "prop.h" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include -#include -#include -#include - -#if wxUSE_IOSTREAMH -#if defined(__WXMSW__) && !defined(__GNUWIN32__) -#include -#else -#include -#endif -#else -#include -#endif - -#include "wx/window.h" -#include "wx/utils.h" -#include "wx/list.h" -#include "prop.h" - -IMPLEMENT_DYNAMIC_CLASS(wxPropertyValue, wxObject) - -wxPropertyValue::wxPropertyValue(void) -{ - m_type = wxPropertyValueNull; - m_next = NULL; - m_last = NULL; - m_value.first = NULL; - m_clientData = NULL; - m_modifiedFlag = FALSE; -} - -wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom) -{ - m_modifiedFlag = FALSE; - Copy((wxPropertyValue& )copyFrom); -} - -wxPropertyValue::wxPropertyValue(const char *val) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueString; - - m_value.string = copystring(val); - m_clientData = NULL; - m_next = NULL; - m_last = NULL; -} - -wxPropertyValue::wxPropertyValue(const wxString& val) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueString; - - m_value.string = copystring((const char *)val); - m_clientData = NULL; - m_next = NULL; - m_last = NULL; -} - -wxPropertyValue::wxPropertyValue(long the_integer) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueInteger; - m_value.integer = the_integer; - m_clientData = NULL; - m_next = NULL; -} - -wxPropertyValue::wxPropertyValue(bool val) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValuebool; - m_value.integer = val; - m_clientData = NULL; - m_next = NULL; -} - -wxPropertyValue::wxPropertyValue(float the_real) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueReal; - m_value.real = the_real; - m_clientData = NULL; - m_next = NULL; -} - -wxPropertyValue::wxPropertyValue(double the_real) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueReal; - m_value.real = (float)the_real; - m_clientData = NULL; - m_next = NULL; -} - -// Pointer versions: we have a pointer to the real C++ value. -wxPropertyValue::wxPropertyValue(char **val) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueStringPtr; - - m_value.stringPtr = val; - m_clientData = NULL; - m_next = NULL; - m_last = NULL; -} - -wxPropertyValue::wxPropertyValue(long *val) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueIntegerPtr; - m_value.integerPtr = val; - m_clientData = NULL; - m_next = NULL; -} - -wxPropertyValue::wxPropertyValue(bool *val) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueboolPtr; - m_value.boolPtr = val; - m_clientData = NULL; - m_next = NULL; -} - -wxPropertyValue::wxPropertyValue(float *val) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueRealPtr; - m_value.realPtr = val; - m_clientData = NULL; - m_next = NULL; -} - -wxPropertyValue::wxPropertyValue(wxList *the_list) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueList; - m_clientData = NULL; - m_last = NULL; - m_value.first = NULL; - - wxNode *node = the_list->First(); - while (node) - { - wxPropertyValue *expr = (wxPropertyValue *)node->Data(); - Append(expr); - node = node->Next(); - } - - delete the_list; -} - -wxPropertyValue::wxPropertyValue(wxStringList *the_list) -{ - m_modifiedFlag = FALSE; - m_type = wxPropertyValueList; - m_clientData = NULL; - m_last = NULL; - m_value.first = NULL; - - wxNode *node = the_list->First(); - while (node) - { - char *s = (char *)node->Data(); - Append(new wxPropertyValue(s)); - node = node->Next(); - } - delete the_list; -} - -wxPropertyValue::~wxPropertyValue(void) -{ - switch (m_type) - { - case wxPropertyValueInteger: - case wxPropertyValuebool: - case wxPropertyValueReal: - { - break; - } - case wxPropertyValueString: - { - delete[] m_value.string; - break; - } - case wxPropertyValueList: - { - wxPropertyValue *expr = m_value.first; - while (expr) - { - wxPropertyValue *expr1 = expr->m_next; - - delete expr; - expr = expr1; - } - break; - } - default: - case wxPropertyValueNull: break; - } -} - -void wxPropertyValue::Append(wxPropertyValue *expr) -{ - m_modifiedFlag = TRUE; - if (!m_value.first) - m_value.first = expr; - - if (m_last) - m_last->m_next = expr; - m_last = expr; -} - -void wxPropertyValue::Insert(wxPropertyValue *expr) -{ - m_modifiedFlag = TRUE; - expr->m_next = m_value.first; - m_value.first = expr; - - if (!m_last) - m_last = expr; -} - -// Delete from list -void wxPropertyValue::Delete(wxPropertyValue *node) -{ - wxPropertyValue *expr = GetFirst(); - - wxPropertyValue *previous = NULL; - while (expr && (expr != node)) - { - previous = expr; - expr = expr->GetNext(); - } - - if (expr) - { - if (previous) - previous->m_next = expr->m_next; - - // If node was the first in the list, - // make the list point to the NEXT one. - if (GetFirst() == expr) - { - m_value.first = expr->m_next; - } - - // If node was the last in the list, - // make the list 'last' pointer point to the PREVIOUS one. - if (GetLast() == expr) - { - if (previous) - m_last = previous; - else - m_last = NULL; - } - m_modifiedFlag = TRUE; - delete expr; - } - -} - -void wxPropertyValue::ClearList(void) -{ - wxPropertyValue *val = GetFirst(); - if (val) - m_modifiedFlag = TRUE; - - while (val) - { - wxPropertyValue *next = val->GetNext(); - delete val; - val = next; - } - m_value.first = NULL; - m_last = NULL; -} - -wxPropertyValue *wxPropertyValue::NewCopy(void) const -{ - switch (m_type) - { - case wxPropertyValueInteger: - return new wxPropertyValue(m_value.integer); - case wxPropertyValuebool: - return new wxPropertyValue((bool) (m_value.integer != 0)); - case wxPropertyValueReal: - return new wxPropertyValue(m_value.real); - case wxPropertyValueString: - return new wxPropertyValue(m_value.string); - case wxPropertyValueList: - { - wxPropertyValue *expr = m_value.first; - wxPropertyValue *new_list = new wxPropertyValue; - new_list->SetType(wxPropertyValueList); - while (expr) - { - wxPropertyValue *expr2 = expr->NewCopy(); - new_list->Append(expr2); - expr = expr->m_next; - } - return new_list; - } - case wxPropertyValueIntegerPtr: - return new wxPropertyValue(m_value.integerPtr); - case wxPropertyValueRealPtr: - return new wxPropertyValue(m_value.realPtr); - case wxPropertyValueboolPtr: - return new wxPropertyValue(m_value.boolPtr); - case wxPropertyValueStringPtr: - return new wxPropertyValue(m_value.stringPtr); - - case wxPropertyValueNull: -#ifdef __X__ - cerr << "Should never get here!\n"; -#endif - break; - } - return NULL; -} - -void wxPropertyValue::Copy(wxPropertyValue& copyFrom) -{ - m_type = copyFrom.Type(); - - switch (m_type) - { - case wxPropertyValueInteger: - (*this) = copyFrom.IntegerValue(); - return ; - - case wxPropertyValueReal: - (*this) = copyFrom.RealValue(); - return ; - - case wxPropertyValueString: - (*this) = wxString(copyFrom.StringValue()); - return ; - - case wxPropertyValuebool: - (*this) = copyFrom.BoolValue(); - return ; - - // Pointers - case wxPropertyValueboolPtr: - (*this) = copyFrom.BoolValuePtr(); - return ; - case wxPropertyValueRealPtr: - (*this) = copyFrom.RealValuePtr(); - return ; - case wxPropertyValueIntegerPtr: - (*this) = copyFrom.IntegerValuePtr(); - return ; - case wxPropertyValueStringPtr: - { - char** s = copyFrom.StringValuePtr(); - (*this) = s != 0; - return ; - } - - case wxPropertyValueList: - { - m_value.first = NULL; - m_next = NULL; - m_last = NULL; - wxPropertyValue *expr = copyFrom.m_value.first; - while (expr) - { - wxPropertyValue *expr2 = expr->NewCopy(); - Append(expr2); - expr = expr->m_next; - } - return; - } - case wxPropertyValueNull: -#ifdef __X__ - cerr << "Should never get here!\n"; -#endif - break; - } -} - -// Return nth argument of a clause (starting from 1) -wxPropertyValue *wxPropertyValue::Arg(wxPropertyValueType type, int arg) const -{ - wxPropertyValue *expr = m_value.first; - for (int i = 1; i < arg; i++) - if (expr) - expr = expr->m_next; - - if (expr && (expr->m_type == type)) - return expr; - else - return NULL; -} - -// Return nth argument of a list expression (starting from zero) -wxPropertyValue *wxPropertyValue::Nth(int arg) const -{ - if (m_type != wxPropertyValueList) - return NULL; - - wxPropertyValue *expr = m_value.first; - for (int i = 0; i < arg; i++) - if (expr) - expr = expr->m_next; - else return NULL; - - if (expr) - return expr; - else - return NULL; -} - - // Returns the number of elements in a list expression -int wxPropertyValue::Number(void) const -{ - if (m_type != wxPropertyValueList) - return 0; - - int i = 0; - wxPropertyValue *expr = m_value.first; - while (expr) - { - expr = expr->m_next; - i ++; - } - return i; -} - -void wxPropertyValue::WritePropertyClause(ostream& stream) // Write this expression as a top-level clause -{ - if (m_type != wxPropertyValueList) - return; - - wxPropertyValue *node = m_value.first; - if (node) - { - node->WritePropertyType(stream); - stream << "("; - node = node->m_next; - bool first = TRUE; - while (node) - { - if (!first) - stream << " "; - node->WritePropertyType(stream); - node = node->m_next; - if (node) stream << ",\n"; - first = FALSE; - } - stream << ").\n\n"; - } -} - -void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any other subexpression -{ - switch (m_type) - { - case wxPropertyValueInteger: - { - stream << m_value.integer; - break; - } - case wxPropertyValueIntegerPtr: - { - stream << *m_value.integerPtr; - break; - } - case wxPropertyValuebool: - { - if (m_value.integer) - stream << "True"; - else - stream << "False"; - break; - } - case wxPropertyValueboolPtr: - { - if (*m_value.integerPtr) - stream << "True"; - else - stream << "False"; - break; - } - case wxPropertyValueReal: - { - float f = m_value.real; - sprintf(wxBuffer, "%.6g", (double)f); - stream << wxBuffer; - break; - } - case wxPropertyValueRealPtr: - { - float f = *m_value.realPtr; -/* Now the parser can cope with this. - // Prevent printing in 'e' notation. Any better way? - if (fabs(f) < 0.00001) - f = 0.0; -*/ - sprintf(wxBuffer, "%.6g", f); - stream << wxBuffer; - break; - } - case wxPropertyValueString: - { -// stream << "\""; - int i; - int len = strlen(m_value.string); - for (i = 0; i < len; i++) - { - char ch = m_value.string[i]; -// if (ch == '"' || ch == '\\') -// stream << "\\"; - stream << ch; - } - -// stream << "\""; - break; - } - case wxPropertyValueStringPtr: - { - int i; - int len = strlen(*(m_value.stringPtr)); - for (i = 0; i < len; i++) - { - char ch = *(m_value.stringPtr)[i]; - - } - break; - } - case wxPropertyValueList: - { - if (!m_value.first) - stream << "[]"; - else - { - wxPropertyValue *expr = m_value.first; - - stream << "["; - while (expr) - { - expr->WritePropertyType(stream); - expr = expr->m_next; - if (expr) stream << ", "; - } - stream << "]"; - } - break; - } - case wxPropertyValueNull: break; - } -} - -wxString wxPropertyValue::GetStringRepresentation(void) -{ - char buf[500]; - buf[0] = 0; - - ostrstream str((char *)buf, (int)500, ios::out); - WritePropertyType(str); - str << '\0'; - str.flush(); - - wxString theString(buf); - return theString; -} - -void wxPropertyValue::operator=(const wxPropertyValue& val) -{ - m_modifiedFlag = TRUE; - Copy((wxPropertyValue&)val); -} - -// void wxPropertyValue::operator=(const char *val) -void wxPropertyValue::operator=(const wxString& val1) -{ - const char *val = (const char *)val1; - - m_modifiedFlag = TRUE; - if (m_type == wxPropertyValueNull) - m_type = wxPropertyValueString; - - if (m_type == wxPropertyValueString) - { - if (val) - m_value.string = copystring(val); - else - m_value.string = NULL; - } - else if (m_type == wxPropertyValueStringPtr) - { - if (*m_value.stringPtr) - delete[] *m_value.stringPtr; - if (val) - *m_value.stringPtr = copystring(val); - else - *m_value.stringPtr = NULL; - } - - m_clientData = NULL; - m_next = NULL; - m_last = NULL; - -} - -void wxPropertyValue::operator=(const long val) -{ - m_modifiedFlag = TRUE; - if (m_type == wxPropertyValueNull) - m_type = wxPropertyValueInteger; - - if (m_type == wxPropertyValueInteger) - m_value.integer = val; - else if (m_type == wxPropertyValueIntegerPtr) - *m_value.integerPtr = val; - else if (m_type == wxPropertyValueReal) - m_value.real = (float)val; - else if (m_type == wxPropertyValueRealPtr) - *m_value.realPtr = (float)val; - - m_clientData = NULL; - m_next = NULL; -} - -void wxPropertyValue::operator=(const bool val) -{ - m_modifiedFlag = TRUE; - if (m_type == wxPropertyValueNull) - m_type = wxPropertyValuebool; - - if (m_type == wxPropertyValuebool) - m_value.integer = (long)val; - else if (m_type == wxPropertyValueboolPtr) - *m_value.boolPtr = val; - - m_clientData = NULL; - m_next = NULL; -} - -void wxPropertyValue::operator=(const float val) -{ - m_modifiedFlag = TRUE; - if (m_type == wxPropertyValueNull) - m_type = wxPropertyValueReal; - - if (m_type == wxPropertyValueInteger) - m_value.integer = (long)val; - else if (m_type == wxPropertyValueIntegerPtr) - *m_value.integerPtr = (long)val; - else if (m_type == wxPropertyValueReal) - m_value.real = val; - else if (m_type == wxPropertyValueRealPtr) - *m_value.realPtr = val; - - m_clientData = NULL; - m_next = NULL; -} - -void wxPropertyValue::operator=(const char **val) -{ - m_modifiedFlag = TRUE; - m_type = wxPropertyValueStringPtr; - - if (val) - m_value.stringPtr = (char **)val; - else - m_value.stringPtr = NULL; - m_clientData = NULL; - m_next = NULL; - m_last = NULL; - -} - -void wxPropertyValue::operator=(const long *val) -{ - m_modifiedFlag = TRUE; - m_type = wxPropertyValueIntegerPtr; - m_value.integerPtr = (long *)val; - m_clientData = NULL; - m_next = NULL; -} - -void wxPropertyValue::operator=(const bool *val) -{ - m_modifiedFlag = TRUE; - m_type = wxPropertyValueboolPtr; - m_value.boolPtr = (bool *)val; - m_clientData = NULL; - m_next = NULL; -} - -void wxPropertyValue::operator=(const float *val) -{ - m_modifiedFlag = TRUE; - m_type = wxPropertyValueRealPtr; - m_value.realPtr = (float *)val; - m_clientData = NULL; - m_next = NULL; -} - -long wxPropertyValue::IntegerValue(void) const - { - if (m_type == wxPropertyValueInteger) - return m_value.integer; - else if (m_type == wxPropertyValueReal) - return (long)m_value.real; - else if (m_type == wxPropertyValueIntegerPtr) - return *m_value.integerPtr; - else if (m_type == wxPropertyValueRealPtr) - return (long)(*m_value.realPtr); - else return 0; - } - -long *wxPropertyValue::IntegerValuePtr(void) const -{ - return m_value.integerPtr; -} - -float wxPropertyValue::RealValue(void) const { - if (m_type == wxPropertyValueReal) - return m_value.real; - else if (m_type == wxPropertyValueRealPtr) - return *m_value.realPtr; - else if (m_type == wxPropertyValueInteger) - return (float)m_value.integer; - else if (m_type == wxPropertyValueIntegerPtr) - return (float)*(m_value.integerPtr); - else return 0.0; - } - -float *wxPropertyValue::RealValuePtr(void) const -{ - return m_value.realPtr; -} - -bool wxPropertyValue::BoolValue(void) const { - if (m_type == wxPropertyValueReal) - return (m_value.real != 0.0); - if (m_type == wxPropertyValueRealPtr) - return (*(m_value.realPtr) != 0.0); - else if (m_type == wxPropertyValueInteger) - return (m_value.integer != 0); - else if (m_type == wxPropertyValueIntegerPtr) - return (*(m_value.integerPtr) != 0); - else if (m_type == wxPropertyValuebool) - return (m_value.integer != 0); - else if (m_type == wxPropertyValueboolPtr) - return (*(m_value.boolPtr) != 0); - else return FALSE; - } - -bool *wxPropertyValue::BoolValuePtr(void) const -{ - return m_value.boolPtr; -} - -char *wxPropertyValue::StringValue(void) const { - if (m_type == wxPropertyValueString) - return m_value.string; - else if (m_type == wxPropertyValueStringPtr) - return *(m_value.stringPtr); - else return NULL; - } - -char **wxPropertyValue::StringValuePtr(void) const -{ - return m_value.stringPtr; -} - -/* - * A property (name plus value) - */ - -IMPLEMENT_DYNAMIC_CLASS(wxProperty, wxObject) - -wxProperty::wxProperty(void) -{ - m_propertyRole = (char *)NULL; - m_propertyValidator = NULL; - m_propertyWindow = NULL; - m_enabled = TRUE; -} - -wxProperty::wxProperty(wxProperty& copyFrom) -{ - m_value = copyFrom.GetValue(); - m_name = copyFrom.GetName(); - m_propertyRole = copyFrom.GetRole(); - m_propertyValidator = copyFrom.GetValidator(); - m_enabled = copyFrom.IsEnabled(); - m_propertyWindow = NULL; -} - -wxProperty::wxProperty(wxString nm, wxString role, wxPropertyValidator *ed):m_name(nm), m_propertyRole(role) -{ - m_propertyValidator = ed; - m_propertyWindow = NULL; - m_enabled = TRUE; -} - -wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed): - m_name(nm), m_value(val), m_propertyRole(role) -{ - m_propertyValidator = ed; - m_propertyWindow = NULL; - m_enabled = TRUE; -} - -wxProperty::~wxProperty(void) -{ - if (m_propertyValidator) - delete m_propertyValidator; -} - -wxPropertyValue& wxProperty::GetValue(void) const -{ - return (wxPropertyValue&) m_value; -} - -wxPropertyValidator *wxProperty::GetValidator(void) const -{ - return m_propertyValidator; -} - -wxString& wxProperty::GetName(void) const -{ - return (wxString&) m_name; -} - -wxString& wxProperty::GetRole(void) const -{ - return (wxString&) m_propertyRole; -} - -void wxProperty::SetValue(const wxPropertyValue& val) -{ - m_value = val; -} - -void wxProperty::SetValidator(wxPropertyValidator *ed) -{ - m_propertyValidator = ed; -} - -void wxProperty::SetRole(wxString& role) -{ - m_propertyRole = role; -} - -void wxProperty::SetName(wxString& nm) -{ - m_name = nm; -} - -void wxProperty::operator=(const wxPropertyValue& val) -{ - m_value = val; -} - -/* - * Base property view class - */ - -IMPLEMENT_DYNAMIC_CLASS(wxPropertyView, wxEvtHandler) - -wxPropertyView::wxPropertyView(long flags) -{ - m_buttonFlags = flags; - m_propertySheet = NULL; - m_currentValidator = NULL; - m_currentProperty = NULL; -} - -wxPropertyView::~wxPropertyView(void) -{ -} - -void wxPropertyView::AddRegistry(wxPropertyValidatorRegistry *registry) -{ - m_validatorRegistryList.Append(registry); -} - -wxPropertyValidator *wxPropertyView::FindPropertyValidator(wxProperty *property) -{ - if (property->GetValidator()) - return property->GetValidator(); - - wxNode *node = m_validatorRegistryList.First(); - while (node) - { - wxPropertyValidatorRegistry *registry = (wxPropertyValidatorRegistry *)node->Data(); - wxPropertyValidator *validator = registry->GetValidator(property->GetRole()); - if (validator) - return validator; - node = node->Next(); - } - return NULL; -/* - if (!wxDefaultPropertyValidator) - wxDefaultPropertyValidator = new wxPropertyListValidator; - return wxDefaultPropertyValidator; -*/ -} - -/* - * Property sheet - */ - -IMPLEMENT_DYNAMIC_CLASS(wxPropertySheet, wxObject) - -wxPropertySheet::wxPropertySheet(void):m_properties(wxKEY_STRING) -{ -} - -wxPropertySheet::~wxPropertySheet(void) -{ - Clear(); -} - -bool wxPropertySheet::Save( ostream& WXUNUSED(str) ) -{ - return FALSE; -} - -bool wxPropertySheet::Load( ostream& WXUNUSED(str) ) -{ - return FALSE; -} - -void wxPropertySheet::UpdateAllViews( wxPropertyView *WXUNUSED(thisView) ) -{ -} - -// Add a property -void wxPropertySheet::AddProperty(wxProperty *property) -{ - m_properties.Append((const char*) property->GetName(), property); -} - -// Get property by name -wxProperty *wxPropertySheet::GetProperty(wxString name) -{ - wxNode *node = m_properties.Find((const char*) name); - if (!node) - return NULL; - else - return (wxProperty *)node->Data(); -} - -// Clear all properties -void wxPropertySheet::Clear(void) -{ - wxNode *node = m_properties.First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - wxNode *next = node->Next(); - delete prop; - delete node; - node = next; - } -} - -// Sets/clears the modified flag for each property value -void wxPropertySheet::SetAllModified(bool flag) -{ - wxNode *node = m_properties.First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - prop->GetValue().SetModified(flag); - node = node->Next(); - } -} - -/* - * Property validator registry - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxPropertyValidatorRegistry, wxHashTable) - -wxPropertyValidatorRegistry::wxPropertyValidatorRegistry(void):wxHashTable(wxKEY_STRING) -{ -} - -wxPropertyValidatorRegistry::~wxPropertyValidatorRegistry(void) -{ - ClearRegistry(); -} - -void wxPropertyValidatorRegistry::RegisterValidator(const wxString& typeName, wxPropertyValidator *validator) -{ - Put((const char*) typeName, validator); -} - -wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(const wxString& typeName) -{ - return (wxPropertyValidator *)Get((const char*) typeName); -} - -void wxPropertyValidatorRegistry::ClearRegistry(void) -{ - BeginFind(); - wxNode *node; - while (node = Next()) - { - delete (wxPropertyValidator *)node->Data(); - } -} - - /* - * Property validator - */ - - -IMPLEMENT_ABSTRACT_CLASS(wxPropertyValidator, wxEvtHandler) - -wxPropertyValidator::wxPropertyValidator(long flags) -{ - m_validatorFlags = flags; - m_validatorProperty = NULL; -} - -wxPropertyValidator::~wxPropertyValidator(void) -{} - -bool wxPropertyValidator::StringToFloat (char *s, float *number) { - double num; - bool ok = StringToDouble (s, &num); - *number = (float) num; - return ok; -} - -bool wxPropertyValidator::StringToDouble (char *s, double *number) { - bool ok = TRUE; - char *value_ptr; - *number = strtod (s, &value_ptr); - if (value_ptr) { - int len = strlen (value_ptr); - for (int i = 0; i < len; i++) { - ok = (isspace (value_ptr[i]) != 0); - if (!ok) return FALSE; - } - } - return ok; -} - -bool wxPropertyValidator::StringToInt (char *s, int *number) { - long num; - bool ok = StringToLong (s, &num); - *number = (int) num; - return ok; -} - -bool wxPropertyValidator::StringToLong (char *s, long *number) { - bool ok = TRUE; - char *value_ptr; - *number = strtol (s, &value_ptr, 10); - if (value_ptr) { - int len = strlen (value_ptr); - for (int i = 0; i < len; i++) { - ok = (isspace (value_ptr[i]) != 0); - if (!ok) return FALSE; - } - } - return ok; -} - -char *wxPropertyValidator::FloatToString (float number) { - static char buf[20]; - sprintf (buf, "%.6g", number); - return buf; -} - -char *wxPropertyValidator::DoubleToString (double number) { - static char buf[20]; - sprintf (buf, "%.6g", number); - return buf; -} - -char *wxPropertyValidator::IntToString (int number) { - return ::IntToString (number); -} - -char *wxPropertyValidator::LongToString (long number) { - return ::LongToString (number); - } - - diff --git a/utils/wxrc/Makefile.in b/utils/wxrc/Makefile.in index 9685e6f172..b20802bbb0 100644 --- a/utils/wxrc/Makefile.in +++ b/utils/wxrc/Makefile.in @@ -9,7 +9,7 @@ PROGRAM=wxrc OBJECTS=wxrc.o -APPEXTRALIBS=$(top_builddir)/lib/libwxxrc.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_xrc-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makeprog.env diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp index 23b27952a7..f62a235ff3 100644 --- a/utils/wxrc/wxrc.cpp +++ b/utils/wxrc/wxrc.cpp @@ -251,28 +251,40 @@ wxArrayString XmlResApp::PrepareTempFiles() // find all files mentioned in structure, e.g. filename void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath) { - wxXmlNode *n = node; - if (n == NULL) return; - n = n->GetChildren(); - + // Is 'node' XML node element? + if (node == NULL) return; + if (node->GetType() != wxXML_ELEMENT_NODE) return; + + // Does 'node' contain filename information at all? + bool containsFilename = ( + // Any bitmaps: + (node->GetName() == _T("bitmap")) || + // URLs in wxHtmlWindow: + (node->GetName() == _T("url")) || + // wxBitmapButton: + (node->GetParent() != NULL && + node->GetParent()->GetPropVal(_T("class"), _T("")) == _T("wxBitmapButton") && + (node->GetName() == _T("focus") || + node->GetName() == _T("disabled") || + node->GetName() == _T("selected"))) + ); + + wxXmlNode *n = node->GetChildren(); while (n) { - if ((node->GetType() == wxXML_ELEMENT_NODE) && - // parent is an element, i.e. has subnodes... + if (containsFilename && (n->GetType() == wxXML_TEXT_NODE || - n->GetType() == wxXML_CDATA_SECTION_NODE) && - // ...it is textnode... - ((node/*not n!*/->GetName() == "bitmap") || - (node/*not n!*/->GetName() == "url"))) - // ...and known to contain filename + n->GetType() == wxXML_CDATA_SECTION_NODE)) { wxString fullname; - if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") fullname = n->GetContent(); - else fullname = inputPath + "/" + n->GetContent(); + if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") + fullname = n->GetContent(); + else + fullname = inputPath + "/" + n->GetContent(); if (flagVerbose) wxPrintf("adding " + fullname + "...\n"); - + wxString filename = GetInternalFileName(n->GetContent(), flist); n->SetContent(filename); @@ -282,11 +294,11 @@ void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxSt wxFileOutputStream sout(parOutputPath + "/" + filename); sin.Read(sout); // copy the stream } - + // subnodes: if (n->GetType() == wxXML_ELEMENT_NODE) FindFilesInXML(n, flist, inputPath); - + n = n->GetNext(); } } diff --git a/wx-config.in b/wx-config.in index d6e090754c..2a4f02956f 100755 --- a/wx-config.in +++ b/wx-config.in @@ -4,11 +4,13 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ exec_prefix_set=no CC="@CC@" +GCC="@GCC@" CXX="@CXX@" LD="@SHARED_LD@" cross_compiling=@cross_compiling@ target=@host_alias@ static_flag=@STATIC_FLAG@ +inplace_flag=no usage() { @@ -17,12 +19,18 @@ Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--static] [--libs] [--gl-libs] [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags] [--cc] [--cxx] [--ld] + [--inplace] wx-config returns configuration information about the installed version of wxWindows. It may be used to query its version and installation directories and also retrieve the C and C++ compilers and linker which were used for its building and the corresponding flags. + +The --inplace flag allows wx-config to be used from the wxWindows +build directory and output flags to use the uninstalled version of +the headers and libs in the build directory. (Currently configure +must be invoked via a full path name for this to work correctly.) EOF exit $1 @@ -30,16 +38,36 @@ EOF cppflags() { + # we should never specify -I/usr/include on the compiler command line: this + # is at best useless and at worst breaks compilation on the systems where + # the system headers are non-ANSI because gcc works around this by storing + # the ANSI-fied versions of them in its private directory which is searched + # after all the directories on the cmd line. + # + # the situation is a bit more complicated with -I/usr/local/include: again, + # it shouldn't be specified with gcc which looks there by default anyhow + # and gives warnings (at least 3.1 does) if it is specified explicitly -- + # but this -I switch *is* needed for the other compilers + # + # note that we assume that if we use GNU cc we also use GNU c++ and vice + # versa, i.e. this won't work (either for --cflags or --cxxflags) if GNU C + # compiler and non-GNU C++ compiler are used or vice versa -- we'll fix + # this when/if anybody complains about it if test "@includedir@" != "/usr/include" \ -a "@includedir@" != "/usr/include/c++" \ - -a "@includedir@" != "/usr/local/include" \ + -a \( "${GCC}" != "yes" \ + -o "@includedir@" != "/usr/local/include" \) \ -a \( "${cross_compiling}" != "yes" \ -o "@includedir@" != "/usr/${target}/include" \) ; then - includes=-I@includedir@ + includes=" -I@includedir@" fi - includes="-I@libdir@/wx/include/@TOOLCHAIN_NAME@ $includes" + if test $inplace_flag = yes ; then + includes="-I$inplace_builddir/lib/wx/include/@TOOLCHAIN_NAME@ -I$inplace_include" + else + includes="-I@libdir@/wx/include/@TOOLCHAIN_NAME@$includes" + fi if test $static_flag = yes ; then echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@ @@ -104,6 +132,10 @@ while test $# -gt 0; do libs="-L@libdir@" fi + if test $inplace_flag = yes ; then + libs="-L$inplace_builddir/lib" + fi + if test $static_flag = yes ; then echo "$libs @LDFLAGS@ @WXCONFIG_RPATH@ @libdir@/@WXCONFIG_LIBS_STATIC@ @LIBS@ @DMALLOC_LIBS@" else @@ -117,7 +149,10 @@ while test $# -gt 0; do else gllibs="@WXCONFIG_LIBS_GL@" fi - echo @LDFLAGS_GL@ "$gllibs" + if test $inplace_flag = yes ; then + libdir="-L$inplace_builddir/lib" + fi + echo @LDFLAGS_GL@ $libdir $gllibs ;; --cc) echo $CC @@ -128,6 +163,11 @@ while test $# -gt 0; do --ld) echo $LD ;; + --inplace) + inplace_flag=yes + inplace_builddir=`dirname $0` + inplace_include=@top_srcdir@/include + ;; *) usage 1 1>&2 ;; diff --git a/wxPython/BUILD.osx.txt b/wxPython/BUILD.osx.txt index 1af6b0d189..e752109c4f 100644 --- a/wxPython/BUILD.osx.txt +++ b/wxPython/BUILD.osx.txt @@ -1,11 +1,11 @@ Building wxPython on Mac OS X ----------------------------- -NOTE: OS X support is HIGHLY EXPERIMENTAL at this time. Most things - are working now, but a few still don't. I know about most of - them and am addressing them as I have time. If you have any - ideas about a fix for the stuff that's still broken then - please persue them and send the fixes to me. +NOTE: OS X support is EXPERIMENTAL at this time. Most things are + working now, but a few still don't. I know about most of them + and am addressing them as I have time. If you have any ideas + about a fix for the stuff that's still broken then please + persue them and send the fixes to me. These are the steps I have used for building wxPython on Mac OS X 10.1 @@ -14,13 +14,14 @@ that you know your way around a command line and that you know how to get things from various CVS repositories as needed. -1. Python 2.2 is required. There is a disk image with an installer - package in the wxPython Sourceforge download area, in this group: +1. "MachoPython" 2.2 is required. There is a disk image with an + installer package in the wxPython Sourceforge download area, in + this group: http://sourceforge.net/project/showfiles.php?group_id=10718&release_id=84730 If, for some reason you need to build your own Python, get the - source from www.python.org and follow theinstructions in the + source from www.python.org and follow the instructions in the Mac/OSX/README file to build and install Python.app and the Python.framework. @@ -33,8 +34,8 @@ get things from various CVS repositories as needed. sudo ln -s python2.2 python Also, if you create a /usr/local/bin/pythonw script like the - following then you can run Python GUI apps (like wxPython) directly - from the command line: + following then you can run Python GUI apps (like wxPython apps) + directly from the command line: #!/bin/sh exec /Applications/Python.app/Contents/MacOS/python $@ @@ -45,13 +46,15 @@ get things from various CVS repositories as needed. If you would like to make a MachoPython installer from what you built then you may want to look at the scripts I use to do it - located in wxPython/distrib/mac/buildPython. + located in wxPython/distrib/mac/buildPython in CVS. One last thing, make sure that /usr/local/bin is in your PATH environment variable. -2. In a wxWindows CVS tree make a build directory. +2. In a wxWindows CVS tree make a build directory. (You can also use + a CVS snapshot located in http://wxwindows.org/snapshots/ or the + released wxPythonSrc-*.tr.gz archive.) cd ~/proj/wxWindows # or wherever you put it mkdir build diff --git a/wxPython/BUILD.unix.txt b/wxPython/BUILD.unix.txt index 32bc8aeee6..7a9b793e70 100644 --- a/wxPython/BUILD.unix.txt +++ b/wxPython/BUILD.unix.txt @@ -249,7 +249,9 @@ C. Change to the root wxPython directory and look at the setup.py and shadow python files. IN_CVS_TREE If you are using the CVS version of the - wxWindows and wxPython sources then you will + wxWindows and wxPython sources, or a combined + source archive from the CVS snapshots or the + distributed wxPythonSrc-*.tar.gz then you will need to set this flag to non-zero. This is needed because some source files from the wxWindows tree are copied to be under the @@ -257,9 +259,6 @@ C. Change to the root wxPython directory and look at the setup.py With this flag set then setup.py will automatically keep these copied sources up to date if the original version is ever updated. - If you are using the tar.gz version of the - Python sources then these copied sources are - already present in your source tree. D. To build and install wxPython you simply need to execute the diff --git a/wxPython/BUILD.win32.txt b/wxPython/BUILD.win32.txt index 163cc1664c..2090fc4663 100644 --- a/wxPython/BUILD.win32.txt +++ b/wxPython/BUILD.win32.txt @@ -246,18 +246,17 @@ B. Change to the root wxPython directory and look at the setup.py will be executed to regenerate the wrapper C++ and shadow python files. - IN_CVS_TREE If you are using the CVS version of the - wxWindows and wxPython sources then you will - need to set this flag to non-zero. This is - needed because some source files from the - wxWindows tree are copied to be under the - wxPython tree in order to keep Distutils happy. - With this flag set then setup.py will - automatically keep these copied sources up to - date if the original version is ever updated. - If you are using the tar.gz version of the - Python sources then these copied sources are - already present in your source tree. + IN_CVS_TREE If you are using the CVS version of the + wxWindows and wxPython sources, or a combined + source archive from the CVS snapshots or the + distributed wxPythonSrc-*.tar.gz then you will + need to set this flag to non-zero. This is + needed because some source files from the + wxWindows tree are copied to be under the + wxPython tree in order to keep Distutils happy. + With this flag set then setup.py will + automatically keep these copied sources up to + date if the original version is ever updated. C. To build and install wxPython you simply need to execute the diff --git a/wxPython/CHANGES.txt b/wxPython/CHANGES.txt index eefa6256aa..d48e6a7950 100644 --- a/wxPython/CHANGES.txt +++ b/wxPython/CHANGES.txt @@ -174,6 +174,9 @@ Added wxXmlResourceHandler which allows you to create custom handlers for nonstandard class types in XRC resources. See the demo for an example. +Added wxPython.lib.mixins.rubberband module from Robb Shecter. + +Added wxTimeCtrl from Will Sadkin. diff --git a/wxPython/b.bat b/wxPython/b.bat index 22f0042c1e..69db82ec26 100755 --- a/wxPython/b.bat +++ b/wxPython/b.bat @@ -71,29 +71,19 @@ elseiff "%1" == "a" then shift set CMD=echo Finished! - call b.bat 15 c - call b.bat 15 f - cd demo - p15 encode_bitmaps.py - cd - - call b.bat 15 r - call b.bat 15 c - call b.bat 15 h - call b.bat 15 r - - call b.bat 21 c - call b.bat 21 f - call b.bat 21 r - call b.bat 21 c + call b.bat 21 d call b.bat 21 h call b.bat 21 r + call b.bat 21 d UNICODE=1 + call b.bat 21 h UNICODE=1 + call b.bat 21 r UNICODE=1 - call b.bat 22 c - call b.bat 22 f - call b.bat 22 r - call b.bat 22 c + call b.bat 22 d call b.bat 22 h call b.bat 22 r + call b.bat 22 d UNICODE=1 + call b.bat 22 h UNICODE=1 + call b.bat 22 r UNICODE=1 rem "b" --> both debug and hybrid builds diff --git a/wxPython/contrib/stc/_stcextras.py b/wxPython/contrib/stc/_stcextras.py index eefe2c4547..dc8f3456ef 100644 --- a/wxPython/contrib/stc/_stcextras.py +++ b/wxPython/contrib/stc/_stcextras.py @@ -3,5 +3,5 @@ wx.wxStyledTextEventPtr = wxStyledTextEventPtr wx.wxStyledTextCtrlPtr = wxStyledTextCtrlPtr - -wxSTC_CARET_CENTER = wxSTC_CARET_STRICT +# This constant no longer exists in Scintilla, but I'll put it here for a while to avoid disrupting user code... +wxSTC_CARET_CENTER = 0 diff --git a/wxPython/contrib/stc/gtk/stc_.py b/wxPython/contrib/stc/gtk/stc_.py index 283ac7527d..6a5b12ac93 100644 --- a/wxPython/contrib/stc/gtk/stc_.py +++ b/wxPython/contrib/stc/gtk/stc_.py @@ -1819,5 +1819,5 @@ wxEVT_STC_ZOOM = stc_c.wxEVT_STC_ZOOM wx.wxStyledTextEventPtr = wxStyledTextEventPtr wx.wxStyledTextCtrlPtr = wxStyledTextCtrlPtr - -wxSTC_CARET_CENTER = wxSTC_CARET_STRICT +# This constant no longer exists in Scintilla, but I'll put it here for a while to avoid disrupting user code... +wxSTC_CARET_CENTER = 0 diff --git a/wxPython/contrib/stc/mac/stc_.py b/wxPython/contrib/stc/mac/stc_.py index 283ac7527d..6a5b12ac93 100644 --- a/wxPython/contrib/stc/mac/stc_.py +++ b/wxPython/contrib/stc/mac/stc_.py @@ -1819,5 +1819,5 @@ wxEVT_STC_ZOOM = stc_c.wxEVT_STC_ZOOM wx.wxStyledTextEventPtr = wxStyledTextEventPtr wx.wxStyledTextCtrlPtr = wxStyledTextCtrlPtr - -wxSTC_CARET_CENTER = wxSTC_CARET_STRICT +# This constant no longer exists in Scintilla, but I'll put it here for a while to avoid disrupting user code... +wxSTC_CARET_CENTER = 0 diff --git a/wxPython/contrib/stc/msw/stc_.py b/wxPython/contrib/stc/msw/stc_.py index 283ac7527d..6a5b12ac93 100644 --- a/wxPython/contrib/stc/msw/stc_.py +++ b/wxPython/contrib/stc/msw/stc_.py @@ -1819,5 +1819,5 @@ wxEVT_STC_ZOOM = stc_c.wxEVT_STC_ZOOM wx.wxStyledTextEventPtr = wxStyledTextEventPtr wx.wxStyledTextCtrlPtr = wxStyledTextCtrlPtr - -wxSTC_CARET_CENTER = wxSTC_CARET_STRICT +# This constant no longer exists in Scintilla, but I'll put it here for a while to avoid disrupting user code... +wxSTC_CARET_CENTER = 0 diff --git a/wxPython/demo/GridCustTable.py b/wxPython/demo/GridCustTable.py index ff78201fcb..66514d2318 100644 --- a/wxPython/demo/GridCustTable.py +++ b/wxPython/demo/GridCustTable.py @@ -45,7 +45,10 @@ class CustomDataTable(wxPyGridTableBase): return len(self.data[0]) def IsEmptyCell(self, row, col): - return not self.data[row][col] + try: + return not self.data[row][col] + except IndexError: + return true # Get/Set values in the table. The Python version of these # methods can handle any data-type, (as long as the Editor and @@ -138,8 +141,22 @@ class CustTableGrid(wxGrid): class TestFrame(wxFrame): def __init__(self, parent, log): wxFrame.__init__(self, parent, -1, "Custom Table, data driven Grid Demo", size=(640,480)) - grid = CustTableGrid(self, log) + p = wxPanel(self, -1, style=0) + grid = CustTableGrid(p, log) + b = wxButton(p, -1, "Another Control...") + b.SetDefault() + EVT_BUTTON(self, b.GetId(), self.OnButton) + EVT_SET_FOCUS(b, self.OnButtonFocus) + bs = wxBoxSizer(wxVERTICAL) + bs.Add(grid, 1, wxGROW|wxALL, 5) + bs.Add(b) + p.SetSizer(bs) + def OnButton(self, evt): + print "button selected" + + def OnButtonFocus(self, evt): + print "button focus" #--------------------------------------------------------------------------- diff --git a/wxPython/demo/GridSimple.py b/wxPython/demo/GridSimple.py index 9857e22ae0..1475cd40ed 100644 --- a/wxPython/demo/GridSimple.py +++ b/wxPython/demo/GridSimple.py @@ -53,6 +53,14 @@ class SimpleGrid(wxGrid): ##, wxGridAutoEditMixin): self.SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_BOTTOM) + # overflow cells + self.SetCellValue( 9, 1, "This default cell will overflow into neighboring cells, but not if you turn overflow off."); + self.SetCellSize(11, 1, 3, 3); + self.SetCellAlignment(11, 1, wxALIGN_CENTRE, wxALIGN_CENTRE); + self.SetCellValue(11, 1, "This cell is set span 3 rows and 3 columns"); + + + # test all the events EVT_GRID_CELL_LEFT_CLICK(self, self.OnCellLeftClick) EVT_GRID_CELL_RIGHT_CLICK(self, self.OnCellRightClick) diff --git a/wxPython/demo/Main.py b/wxPython/demo/Main.py index 82736b72fe..51458681d7 100644 --- a/wxPython/demo/Main.py +++ b/wxPython/demo/Main.py @@ -37,6 +37,7 @@ _treeList = [ 'wxKeyEvents', 'wxWizard', 'wxXmlResourceHandler', + 'wxTimeCtrl', ]), # managed windows == things with a caption you can close @@ -129,6 +130,7 @@ _treeList = [ 'wxRightTextCtrl', 'wxStyledTextCtrl_1', 'wxStyledTextCtrl_2', + 'wxTimeCtrl', ]), # How to lay out the controls in a frame/dialog diff --git a/wxPython/demo/wxDialog.py b/wxPython/demo/wxDialog.py index 8d614756e1..399ebe3c1e 100644 --- a/wxPython/demo/wxDialog.py +++ b/wxPython/demo/wxDialog.py @@ -4,7 +4,10 @@ from wxPython.wx import * #--------------------------------------------------------------------------- def runTest(frame, nb, log): - win = wxDialog(frame, -1, "This is a wxDialog", size=wxSize(350, 200), style=wxCAPTION) + win = wxDialog(frame, -1, "This is a wxDialog", size=wxSize(350, 200), + style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME + #style = wxDEFAULT_DIALOG_STYLE + ) sizer = wxBoxSizer(wxVERTICAL) @@ -63,10 +66,13 @@ def runTest(frame, nb, log): - - - - - overview = """\ """ + + + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) + diff --git a/wxPython/demo/wxListCtrl.py b/wxPython/demo/wxListCtrl.py index 0979a5c738..e64a5256bb 100644 --- a/wxPython/demo/wxListCtrl.py +++ b/wxPython/demo/wxListCtrl.py @@ -223,7 +223,8 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin): def OnItemActivated(self, event): self.currentItem = event.m_itemIndex - self.log.WriteText("OnItemActivated: %s\n" % self.list.GetItemText(self.currentItem)) + self.log.WriteText("OnItemActivated: %s\nTopItem: %s" % + (self.list.GetItemText(self.currentItem), self.list.GetTopItem())) def OnItemDelete(self, event): self.log.WriteText("OnItemDelete\n") diff --git a/wxPython/demo/wxListCtrl_virtual.py b/wxPython/demo/wxListCtrl_virtual.py index f7489db1c8..7dffd52fdd 100644 --- a/wxPython/demo/wxListCtrl_virtual.py +++ b/wxPython/demo/wxListCtrl_virtual.py @@ -45,7 +45,8 @@ class TestVirtualList(wxListCtrl): def OnItemActivated(self, event): self.currentItem = event.m_itemIndex - self.log.WriteText("OnItemActivated: %s\n" % self.GetItemText(self.currentItem)) + self.log.WriteText("OnItemActivated: %s\nTopItem: %s\n" % + (self.GetItemText(self.currentItem), self.GetTopItem())) def getColumnText(self, index, col): item = self.GetItem(index, col) diff --git a/wxPython/demo/wxScrolledWindow.py b/wxPython/demo/wxScrolledWindow.py index e0ad207b73..9b2b9b26ba 100644 --- a/wxPython/demo/wxScrolledWindow.py +++ b/wxPython/demo/wxScrolledWindow.py @@ -149,6 +149,7 @@ class MyCanvas(wxScrolledWindow): def OnLeftButtonEvent(self, event): if event.LeftDown(): + self.SetFocus() self.SetXY(event) self.curLine = [] self.CaptureMouse() diff --git a/wxPython/demo/wxTextCtrl.py b/wxPython/demo/wxTextCtrl.py index 7b55456399..54cf006c2d 100644 --- a/wxPython/demo/wxTextCtrl.py +++ b/wxPython/demo/wxTextCtrl.py @@ -20,50 +20,64 @@ class TestPanel(wxPanel): self.log = log l1 = wxStaticText(self, -1, "wxTextCtrl") - t1 = wxTextCtrl(self, 10, "Test it out and see", size=(125, -1)) + t1 = wxTextCtrl(self, -1, "Test it out and see", size=(125, -1)) t1.SetInsertionPoint(0) - EVT_TEXT(self, 10, self.EvtText) + self.tc1 = t1 + EVT_TEXT(self, t1.GetId(), self.EvtText) EVT_CHAR(t1, self.EvtChar) EVT_SET_FOCUS(t1, self.OnSetFocus) EVT_KILL_FOCUS(t1, self.OnKillFocus) EVT_WINDOW_DESTROY(t1, self.OnWindowDestroy) l2 = wxStaticText(self, -1, "Passsword") - t2 = wxTextCtrl(self, 20, "", size=(125, -1), style=wxTE_PASSWORD) - EVT_TEXT(self, 20, self.EvtText) + t2 = wxTextCtrl(self, -1, "", size=(125, -1), style=wxTE_PASSWORD) + EVT_TEXT(self, t2.GetId(), self.EvtText) l3 = wxStaticText(self, -1, "Multi-line") - t3 = wxTextCtrl(self, 30, + t3 = wxTextCtrl(self, -1, "Here is a looooooooooooooong line of text set in the control.\n\n" "The quick brown fox jumped over the lazy dog...", size=(200, 100), style=wxTE_MULTILINE) t3.SetInsertionPoint(0) - EVT_TEXT(self, 30, self.EvtText) + EVT_TEXT(self, t3.GetId(), self.EvtText) b = wxButton(self, -1, "Test Replace") EVT_BUTTON(self, b.GetId(), self.OnTestReplace) b2 = wxButton(self, -1, "Test GetSelection") EVT_BUTTON(self, b2.GetId(), self.OnTestGetSelection) + b3 = wxButton(self, -1, "Test WriteText") + EVT_BUTTON(self, b3.GetId(), self.OnTestWriteText) self.tc = t3 l4 = wxStaticText(self, -1, "Rich Text") - t4 = wxTextCtrl(self, 40, "If supported by the native control, this is red, and this is a different font.", + t4 = wxTextCtrl(self, -1, "If supported by the native control, this is red, and this is a different font.", size=(200, 100), style=wxTE_MULTILINE|wxTE_RICH2) t4.SetInsertionPoint(0) t4.SetStyle(44, 47, wxTextAttr("RED", "YELLOW")) - points = t4.GetFont().GetPointSize() # get the current size f = wxFont(points+3, wxROMAN, wxITALIC, wxBOLD, true) t4.SetStyle(63, 77, wxTextAttr("BLUE", wxNullColour, f)) + l5 = wxStaticText(self, -1, "Test Positions") + t5 = wxTextCtrl(self, -1, "0123456789\n" * 5, size=(200, 100), + style = wxTE_MULTILINE + #| wxTE_RICH + | wxTE_RICH2 + ) + EVT_LEFT_DOWN(t5, self.OnT5LeftDown) + self.t5 = t5 + + bsizer = wxBoxSizer(wxVERTICAL) bsizer.Add(b, 0, wxGROW) bsizer.Add(b2, 0, wxGROW) + bsizer.Add(b3, 0, wxGROW) sizer = wxFlexGridSizer(cols=3, hgap=6, vgap=6) sizer.AddMany([ l1, t1, (0,0), l2, t2, (0,0), l3, t3, bsizer, l4, t4, (0,0), + l5, t5, (0,0), ]) border = wxBoxSizer(wxVERTICAL) border.Add(sizer, 0, wxALL, 25) @@ -84,6 +98,9 @@ class TestPanel(wxPanel): self.tc.Replace(5, 9, "IS A") #self.tc.Remove(5, 9) + def OnTestWriteText(self, evt): + self.tc.WriteText("TEXT") + def OnTestGetSelection(self, evt): start, end = self.tc.GetSelection() text = self.tc.GetValue() @@ -96,6 +113,22 @@ class TestPanel(wxPanel): self.tc.GetStringSelection(), repr(text[start:end]))) + def OnT5LeftDown(self, evt): + evt.Skip() + wxCallAfter(self.LogT5Position, evt) + + def LogT5Position(self, evt): + text = self.t5.GetValue() + ip = self.t5.GetInsertionPoint() + lp = self.t5.GetLastPosition() + self.log.write("LogT5Position:\n" + "\tGetInsertionPoint:\t%d\n" + "\ttext[insertionpoint]:\t%s\n" + "\tGetLastPosition:\t%d\n" + "\tlen(text):\t\t%d\n" + % (ip, text[ip], lp, len(text))) + + #--------------------------------------------------------------------------- diff --git a/wxPython/demo/wxTimeCtrl.py b/wxPython/demo/wxTimeCtrl.py new file mode 100644 index 0000000000..c20117afe3 --- /dev/null +++ b/wxPython/demo/wxTimeCtrl.py @@ -0,0 +1,213 @@ +from wxPython.wx import * +from wxPython.lib.timectrl import * + +#---------------------------------------------------------------------- + +class TestPanel( wxPanel ): + def __init__( self, parent, log ): + + wxPanel.__init__( self, parent, -1 ) + self.log = log + panel = wxPanel( self, -1 ) + + grid = wxFlexGridSizer( 0, 2, 20, 0 ) + + text1 = wxStaticText( panel, 10, "A 12-hour format wxTimeCtrl:") + self.time12 = wxTimeCtrl( panel, 20, name="12 hour control" ) + spin1 = wxSpinButton( panel, 30, wxDefaultPosition, wxSize(-1,20), 0 ) + self.time12.BindSpinButton( spin1 ) + + grid.AddWindow( text1, 0, wxALIGN_RIGHT, 5 ) + hbox1 = wxBoxSizer( wxHORIZONTAL ) + hbox1.AddWindow( self.time12, 0, wxALIGN_CENTRE, 5 ) + hbox1.AddWindow( spin1, 0, wxALIGN_CENTRE, 5 ) + grid.AddSizer( hbox1, 0, wxLEFT, 5 ) + + + text2 = wxStaticText( panel, 40, "A 24-hour format wxTimeCtrl:") + self.time24 = wxTimeCtrl( panel, 50, fmt24hr=true, name="24 hour control" ) + spin2 = wxSpinButton( panel, 60, wxDefaultPosition, wxSize(-1,20), 0 ) + self.time24.BindSpinButton( spin2 ) + + grid.AddWindow( text2, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM, 5 ) + hbox2 = wxBoxSizer( wxHORIZONTAL ) + hbox2.AddWindow( self.time24, 0, wxALIGN_CENTRE, 5 ) + hbox2.AddWindow( spin2, 0, wxALIGN_CENTRE, 5 ) + grid.AddSizer( hbox2, 0, wxLEFT, 5 ) + + + text3 = wxStaticText( panel, 70, "A wxTimeCtrl without a spin button:") + self.spinless_ctrl = wxTimeCtrl( panel, 80, name="spinless control" ) + + grid.AddWindow( text3, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM, 5 ) + grid.AddWindow( self.spinless_ctrl, 0, wxLEFT, 5 ) + + + buttonChange = wxButton( panel, 100, "Change Controls") + self.radio12to24 = wxRadioButton( panel, 110, "Copy 12-hour time to 24-hour control", wxDefaultPosition, wxDefaultSize, wxRB_GROUP ) + self.radio24to12 = wxRadioButton( panel, 120, "Copy 24-hour time to 12-hour control") + self.radioWx = wxRadioButton( panel, 130, "Set controls to 'now' using wxDateTime") + self.radioMx = wxRadioButton( panel, 140, "Set controls to 'now' using mxDateTime") + + radio_vbox = wxBoxSizer( wxVERTICAL ) + radio_vbox.AddWindow( self.radio12to24, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ) + radio_vbox.AddWindow( self.radio24to12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ) + radio_vbox.AddWindow( self.radioWx, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ) + radio_vbox.AddWindow( self.radioMx, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ) + + box_label = wxStaticBox( panel, 90, "Change Controls through API" ) + buttonbox = wxStaticBoxSizer( box_label, wxHORIZONTAL ) + buttonbox.AddWindow( buttonChange, 0, wxALIGN_CENTRE|wxALL, 5 ) + buttonbox.AddSizer( radio_vbox, 0, wxALIGN_CENTRE|wxALL, 5 ) + + outer_box = wxBoxSizer( wxVERTICAL ) + outer_box.AddSizer( grid, 0, wxALIGN_CENTRE|wxBOTTOM, 20 ) + outer_box.AddSizer( buttonbox, 0, wxALIGN_CENTRE|wxALL, 5 ) + + + # Turn on mxDateTime option only if we can import the module: + try: + from mx import DateTime + except ImportError: + self.radioMx.Enable( false ) + + + panel.SetAutoLayout( true ) + panel.SetSizer( outer_box ) + outer_box.Fit( panel ) + panel.Move( (50,50) ) + self.panel = panel + + + EVT_TIMEUPDATE( self, self.time12.GetId(), self.OnTimeChange ) + EVT_TIMEUPDATE( self, self.time24.GetId(), self.OnTimeChange ) + EVT_TIMEUPDATE( self, self.spinless_ctrl.GetId(), self.OnTimeChange ) + + EVT_BUTTON( self, buttonChange.GetId(), self.OnButtonClick ) + + + def OnTimeChange( self, event ): + timectrl = self.panel.FindWindowById( event.GetId() ) + self.log.write('%s time = %s\n' % ( timectrl.GetName(), timectrl.GetValue() ) ) + + def OnButtonClick( self, event ): + if self.radio12to24.GetValue(): + self.time24.SetValue( self.time12.GetValue() ) + + elif self.radio24to12.GetValue(): + self.time12.SetValue( self.time24.GetValue() ) + + elif self.radioWx.GetValue(): + now = wxDateTime_Now() + self.time12.SetWxDateTime( now ) + self.time24.SetWxDateTime( now ) + self.spinless_ctrl.SetWxDateTime( now ) + + elif self.radioMx.GetValue(): + from mx import DateTime + now = DateTime.now() + self.time12.SetMxDateTime( now ) + self.time24.SetMxDateTime( now ) + self.spinless_ctrl.SetMxDateTime( now ) + +#---------------------------------------------------------------------- + +def runTest( frame, nb, log ): + win = TestPanel( nb, log ) + return win + +#---------------------------------------------------------------------- + +overview = """ +

+wxTimeCtrl provides a multi-cell control that allows manipulation of a time +value. It supports 12 or 24 hour format, and you can use wxDateTime or mxDateTime +to get/set values from the control. +

+Left/right/tab keys to switch cells within a wxTimeCtrl, and the up/down arrows act +like a spin control. wxTimeCtrl also allows for an actual spin button to be attached +to the control, so that it acts like the up/down arrow keys. +

+The ! key sets the value of the control to now! +

+Here's the API for wxTimeCtrl: +

+    wxTimeCtrl(
+         parent, id = -1,
+         value = '12:00:00 AM',
+         pos = wxDefaultPosition,
+         size = wxDefaultSize,
+         fmt24hr = false,
+         spinButton = None,
+         style = wxTE_PROCESS_TAB,
+         name = "time")
+
+
    +
    value +
    If no initial value is set, the default will be midnight; if an illegal string + is specified, a ValueError will result. (You can always later set the initial time + with SetValue() after instantiation of the control.) +
    size +
    The size of the control will be automatically adjusted for 12/24 hour format + if wxDefaultSize is specified. +
    +
    fmt24hr +
    If true, control will display time in 24 hour time format; if false, it will + use 12 hour AM/PM format. SetValue() will adjust values accordingly for the + control, based on the format specified. +
    +
    spinButton +
    If specified, this button's events will be bound to the behavior of the + wxTimeCtrl, working like up/down cursor key events. (See BindSpinButton.) +
    +
    style +
    By default, wxTimeCtrl will process TAB events, by allowing tab to the + different cells within the control. +
    +
+
+
+
SetValue(time_string) +
Sets the value of the control to a particular time, given a valid time string; +raises ValueError on invalid value +
+
GetValue() +
Retrieves the string value of the time from the control +
+
SetWxDateTime(wxDateTime) +
Uses the time portion of a wxDateTime to construct a value for the control. +
+
GetWxDateTime() +
Retrieves the value of the control, and applies it to the wxDateTimeFromHMS() +constructor, and returns the resulting value. (This returns the date portion as +"today".) +
+
SetMxDateTime(mxDateTime) +
Uses the time portion of an mxDateTime to construct a value for the control. +NOTE: This imports mx.DateTime at runtime only if this or the Get function +is called. +
+
GetMxDateTime() +
Retrieves the value of the control and applies it to the DateTime.Time() +constructor, and returns the resulting value. (mxDateTime is smart enough to +know this is just a time value.) +
+
BindSpinButton(wxSpinBtton) +
Binds an externally created spin button to the control, so that up/down spin +events change the active cell or selection in the control (in addition to the +up/down cursor keys.) (This is primarily to allow you to create a "standard" +interface to time controls, as seen in Windows.) +
+
EVT_TIMEUPDATE(win, id, func) +
func is fired whenever the value of the control changes. +
+ +""" + + + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) + diff --git a/wxPython/distrib/README.1st.txt b/wxPython/distrib/README.1st.txt new file mode 100644 index 0000000000..f97ebfa0aa --- /dev/null +++ b/wxPython/distrib/README.1st.txt @@ -0,0 +1,83 @@ +README for wxPythonSrc-*.tar.gz +------------------------------- + +Prior to version 2.3.3 of wxPython I had always made my Linux/Unix +binaries based on the released binary of wxGTK and wxGTK-gl. This +imposed a few restrictions and so starting with 2.3.3 I have decided +to do a combined binary that inlcudes wxGTK as well as wxPython. This +allows me a bit more flexibility and is consistent with how the +Windows and Mac OS X binaries are built. + +If you are reading this file then you are probably interested in +building your own copy of wxPython from the sources contained in this +file. If you wish to use the released wxGTK binary as has been done +in the past then you can still follow the old build directions in +wxPython/BUILD.unix.txt. If you are building for Windows or Mac OS X +then you should look at BUILD.win32.txt or BUILD.osx.txt respectivly. +In all these cases you should use the IN_CVS_TREE=1 flag since this +archive is really just a modified CVS snapshot. + +If, on the other hand, you would like to build Linux/Unix binaries +with a private copy of wxGTK like what I am now distributing then +you'll want to follow the instructions in this file. + +Clear as mud? Good. Let's get started. + + +1. We'll be making a private copy of wxGTK so it doesn't conflict with + one used by wxGTK C++ apps that expect to have the default binary + installed from RPM or whatever. I put it in /usr/lib/wxPython, but + you can use whatever you like. I'll just set a variable to our wx + prefix to reference later: + + export WXPREF=/usr/lib/wxPython + + +2. Make a build directory and configure wxGTK. + + cd wxPythonGTK-2.3.3 # or whatever the top-level dir is + mkdir build + cd build + ../configure --with-gtk \ + --prefix=$WXPREF \ + --enable-rpath=$WXPREF/lib \ + --with-opengl \ + --enable-optimise \ + --enable-debug_flag \ + --with-libjpeg=builtin \ + --with-libpng=builtin \ + --with-libtiff=builtin \ + --with-zlib=builtin + + You may want to use --enable-debug instead of --enable-optimise if + you need to run though a debugger and want full debugging symbols. + + +3. Build and install wxGTK. (You may need to be root for the last + step, depending on where your WXPREF is.) + + make + cd ../locale + make allmo + cd ../build + make install + +4. Build and install wxPython. If you want to use a different version + of Python than is found by default on the PATH then specify the + whole pathname in these steps. The version of Python that runs + setup.py is the version wxPython will be built and installed for. + (You will need to be root for the install step unless your Python + is not in a system location.) + + cd ../wxPython + python setup.py \ + IN_CVS_TREE=1 WX_CONFIG=$WXPREF/bin/wx-config \ + build install + +5. That's all! + +-- +Robin Dunn +Software Craftsman +http://wxPython.org Java give you jitters? Relax with wxPython! + diff --git a/wxPython/distrib/genfilelist.py b/wxPython/distrib/genfilelist.py new file mode 100644 index 0000000000..db2cb0b9c1 --- /dev/null +++ b/wxPython/distrib/genfilelist.py @@ -0,0 +1,51 @@ +""" +Walk a directory tree and output a filename list suitable for use +in an RPM spec. + +Usage: genfilelist.py [-r] build_root filespec(s) + +""" + + +import sys, os, glob + + +def walktree(names, buildroot, recurse): + for name in names: + isdir = os.path.isdir(name) + printfilename(name, buildroot, isdir) + if isdir and recurse: + walktree([os.path.join(name, x) for x in os.listdir(name)], buildroot, recurse) + + +def printfilename(name, buildroot, isdir): + s = os.lstat(name) + realname = name[len(buildroot):] + if isdir: + fmt = "%%dir %%attr(%o, root, root) %s" + else: + fmt = "%%attr(%o, root, root) %s" + print fmt % (s.st_mode & 0777, realname) + + +def main(args): + if args[0] == '-r': + recurse = 1 + args = args[1:] + else: + recurse = 0 + + if len(args) < 2: + print __str__ + sys.exit(1) + + buildroot = args[0] + for arg in args[1:]: + if arg[0] == '/': + arg = arg[1:] + walktree(glob.glob(os.path.join(buildroot, arg)), buildroot, recurse) + +if __name__ == "__main__": + main(sys.argv[1:]) + + diff --git a/wxPython/distrib/mac/resources/Welcome.txt b/wxPython/distrib/mac/resources/Welcome.txt index e981f01c24..af1ba17a27 100644 --- a/wxPython/distrib/mac/resources/Welcome.txt +++ b/wxPython/distrib/mac/resources/Welcome.txt @@ -1,2 +1,2 @@ -You will be guided through the steps necessary to install wxPython 2.3.3pre (including wxMac) for MachoPython 2.2.x on Mac OS X 10.1 or later. +You will be guided through the steps necessary to install wxPython 2.3.3.2 (including wxMac) for MachoPython 2.2.x on Mac OS X 10.1 or later. diff --git a/wxPython/distrib/make_installer.py b/wxPython/distrib/make_installer.py index 3b77adba35..8151a7725f 100644 --- a/wxPython/distrib/make_installer.py +++ b/wxPython/distrib/make_installer.py @@ -37,10 +37,10 @@ DirExistsWarning = no DisableReadyMemo = true DisableReadyPage = true ;;DisableDirPage = true -DisableProgramGroupPage = true +DisableProgramGroupPage = no DisableAppendDir = true UsePreviousAppDir = no -UsePreviousGroup = no +UsePreviousGroup = yes UninstallFilesDir = {app}\wxPython AppPublisherURL = http://wxPython.org/ diff --git a/wxPython/distrib/makedemo b/wxPython/distrib/makedemo index bf340d4335..4cc6c737da 100755 --- a/wxPython/distrib/makedemo +++ b/wxPython/distrib/makedemo @@ -23,13 +23,15 @@ rm -f `find _distrib_tgz/wxPython-$1 -name "*.pyc"` rm -f `find _distrib_tgz/wxPython-$1 -name .cvsignore` rm -f `find _distrib_tgz/wxPython-$1 -name core` rm -f `find _distrib_tgz/wxPython-$1 -name wxPython` -rm -f `find _distrib_tgz/wxPython-$1 -name *.o` -rm -f `find _distrib_tgz/wxPython-$1 -name *.so` +rm -f `find _distrib_tgz/wxPython-$1 -name "*.o"` +rm -f `find _distrib_tgz/wxPython-$1 -name "*.so"` +rm -f `find _distrib_tgz/wxPython-$1 -name "*~"` +rm -f `find _distrib_tgz/wxPython-$1 -name ".#*"` cd _distrib_tgz tar cvf ../dist/wxPythonDemo-$1.tar wxPython-$1 -gzip ../dist/wxPythonDemo-$1.tar +gzip -9 ../dist/wxPythonDemo-$1.tar cd .. rm -r _distrib_tgz diff --git a/wxPython/distrib/makedocs.bat b/wxPython/distrib/makedocs.bat index 4e353fb32c..d3561b2689 100755 --- a/wxPython/distrib/makedocs.bat +++ b/wxPython/distrib/makedocs.bat @@ -17,8 +17,8 @@ copy wxPython-%1\docs\ogl\ogl.htm wxPython-%1\docs\ogl\index.htm rem **** zip up the docs rem zip -r ..\distrib\wxPython-docs-%1.zip wxPython-%1\docs -tar cvf ..\dist\wxPythonDocs-%1.tar wxPython-%1 -gzip -9 ..\dist\wxPythonDocs-%1.tar +tar cvf ../dist/wxPythonDocs-%1.tar wxPython-%1 +gzip -9 ../dist/wxPythonDocs-%1.tar rem **** Cleanup diff --git a/wxPython/distrib/makerpm b/wxPython/distrib/makerpm index ccb1f5bb9e..a850b4df14 100755 --- a/wxPython/distrib/makerpm +++ b/wxPython/distrib/makerpm @@ -172,6 +172,7 @@ cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec if [ -z "${skiptar}" ]; then echo "*** Creating tarball..." + cp distrib/README.1st.txt ${builddir}/${tarver} pushd ${builddir} > /dev/null tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null echo "*** Compressing..." diff --git a/wxPython/distrib/wxPythonFull.spec.in b/wxPython/distrib/wxPythonFull.spec.in index 8dbf5154b6..3a471081ed 100644 --- a/wxPython/distrib/wxPythonFull.spec.in +++ b/wxPython/distrib/wxPythonFull.spec.in @@ -65,13 +65,13 @@ This package is implemented using the %{port} port of wxWindows, and includes the wx%{port} shared libs and etc. -%package devel +%package -n wxPython%{port}-devel Summary: wxPython%{port} development files Group: Development/Libraries Requires: wxPython%{port} = %{version} -%description devel +%description -n wxPython%{port}-devel This packages contains the headers and etc. for building apps or Python extension modules that use the same wx%{port} shared libraries that wxPython uses. @@ -89,11 +89,12 @@ else MAKE="make" fi +WXDIR=`pwd` mkdir build cd build -# Configure, trying to reduce dependencies -../configure --with-%{lcport} \ +# Configure, trying to reduce external dependencies +$WXDIR/configure --with-%{lcport} \ --prefix=%{wxpref} \ --disable-soname \ --enable-rpath=%{wxpref}/lib \ @@ -111,39 +112,33 @@ cd build --with-libtiff=builtin \ --with-zlib=builtin \ -## --enable-debug_flag \ -## --with-odbc \ # Build wxWindows $MAKE - -cd ../locale +cd $WXDIR/locale make allmo - -# ** Unfortunately we have to do a bit of installation here so wxPython -# can be built. Perhaps wx-config should be changed to be able to be -# used from the build dir, maybe with an --inplace flag... Move these -# three lines to %install if/when that happens. -[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT -cd ../build -make prefix=$RPM_BUILD_ROOT%{wxpref} install - - # Now build wxPython -cd ../wxPython +cd $WXDIR/wxPython %{python} setup.py \ IN_CVS_TREE=1 \ NO_SCRIPTS=1 \ - WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ + WX_CONFIG="$WXDIR/build/wx-config --inplace --prefix=$RPM_BUILD_ROOT%{wxpref}" \ build #---------------------------------------------------------------- %install -%find_lang wxstd -cd wxPython +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT + +# install wxWindows +WXDIR=`pwd` +cd build +make prefix=$RPM_BUILD_ROOT%{wxpref} install + +# install wxPython +cd $WXDIR/wxPython %{python} setup.py \ IN_CVS_TREE=1 \ NO_SCRIPTS=1 \ @@ -152,11 +147,11 @@ cd wxPython --root=$RPM_BUILD_ROOT # Since I want this RPM to be as generic as possible I won't let -# distutils copy the scripts, since it will mangle the #! line -# to use the real python pathname. Since some distros install -# python 2.2 as python2 and others as python, then I can't let -# it do that otherwise the dependencies will be fouled up. Copy -# them manually instead: +# distutils copy the scripts since it will mangle the #! line to use +# the real python pathname. Since some distros install python 2.2 as +# python2 and others as python, then I can't let distutils do that +# otherwise the dependencies will be fouled up. Copy them manually +# instead, leaving the #!/bin/env line intact: mkdir -p $RPM_BUILD_ROOT/usr/bin for s in \ @@ -170,6 +165,29 @@ for s in \ done +# Generate the filelists. For some reason the %defattr below is still +# resulting in many (but not all) files not owned by root when just +# specifying directories and wildcards to be included in each package. +# So instead we'll build some explicit filelists here and use %attr on +# each entry. +cd $WXDIR +mkdir -p $RPM_BUILD_ROOT%{pref}/share/doc +GFL="%{python} wxPython/distrib/genfilelist.py" +$GFL $RPM_BUILD_ROOT %{pref} > FILELIST +$GFL -r $RPM_BUILD_ROOT %{pref}/bin >> FILELIST +$GFL $RPM_BUILD_ROOT %{pref}/lib >> FILELIST +$GFL -r $RPM_BUILD_ROOT %{pref}/lib/python%{pyver} >> FILELIST +$GFL -r $RPM_BUILD_ROOT %{pref}/share >> FILELIST +$GFL $RPM_BUILD_ROOT %{wxpref} >> FILELIST +$GFL $RPM_BUILD_ROOT %{wxpref}/lib >> FILELIST +$GFL $RPM_BUILD_ROOT "%{wxpref}/lib/libwx*" >> FILELIST +$GFL -r $RPM_BUILD_ROOT %{wxpref}/share >> FILELIST + +$GFL $RPM_BUILD_ROOT %{wxpref}/include > DEVELLIST +$GFL -r $RPM_BUILD_ROOT %{wxpref}/include/wx >> DEVELLIST +$GFL -r $RPM_BUILD_ROOT %{wxpref}/lib/wx >> DEVELLIST +$GFL $RPM_BUILD_ROOT %{wxconfigname} >> DEVELLIST +$GFL $RPM_BUILD_ROOT %{wxpref}/bin/wx-config >> DEVELLIST #---------------------------------------------------------------- @@ -178,37 +196,15 @@ done #---------------------------------------------------------------- -%post -/sbin/ldconfig - -#---------------------------------------------------------------- -%postun -/sbin/ldconfig - - - -#---------------------------------------------------------------- -%files -%doc docs/preamble.txt -%doc docs/licence.txt -%doc docs/readme.txt -%doc docs/changes.txt -%doc wxPython/README.txt -%doc wxPython/CHANGES.txt +%files -f FILELIST %defattr(-,root,root) -%{wxpref}/lib/libwx* -%{pref}/lib/python* -%{wxpref}/share/ -%{pref}/bin/* +%doc docs/preamble.txt docs/licence.txt docs/readme.txt docs/changes.txt +%doc wxPython/README.txt wxPython/CHANGES.txt -%files devel +%files -n wxPython%{port}-devel -f DEVELLIST %defattr(-,root,root) -%{wxpref}/include/wx -%{wxpref}/lib/wx -%{wxconfigname} -%{wxpref}/bin/wx-config #---------------------------------------------------------------- diff --git a/wxPython/setup.py b/wxPython/setup.py index 7d6a2c6247..47778ff0e9 100755 --- a/wxPython/setup.py +++ b/wxPython/setup.py @@ -13,7 +13,7 @@ from my_distutils import run_swig, contrib_copy_tree # flags and values that affect this script #---------------------------------------------------------------------- -VERSION = "2.3.3pre8" +VERSION = "2.3.3.2" DESCRIPTION = "Cross platform GUI toolkit for Python" AUTHOR = "Robin Dunn" AUTHOR_EMAIL = "Robin Dunn " diff --git a/wxPython/src/__version__.py b/wxPython/src/__version__.py index b846f0cf7f..a3ad44740c 100644 --- a/wxPython/src/__version__.py +++ b/wxPython/src/__version__.py @@ -1 +1 @@ -ver = '2.3.3pre8' +ver = '2.3.3.2' diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index 0e72a395d9..b2fb86c8bd 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -765,10 +765,14 @@ class wxApp(wxPyApp): error = 'wxApp.error' outputWindowClass = wxPyOnDemandOutputWindow - def __init__(self, redirect=_defRedirect, filename=None): + def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=true): wxPyApp.__init__(self) self.stdioWin = None self.saveStdio = (sys.stdout, sys.stderr) + + # This has to be done before OnInit + self.SetUseBestVisual(useBestVisual) + if redirect: self.RedirectStdio(filename) # this initializes wxWindows and then calls our OnInit diff --git a/wxPython/src/gtk/windows.cpp b/wxPython/src/gtk/windows.cpp index c89603067a..2283f7a66e 100644 --- a/wxPython/src/gtk/windows.cpp +++ b/wxPython/src/gtk/windows.cpp @@ -9978,6 +9978,35 @@ static PyObject *_wrap_wxMenuBar_EnableTop(PyObject *self, PyObject *args, PyObj return _resultobj; } +#define wxMenuBar_IsEnabledTop(_swigobj,_swigarg0) (_swigobj->IsEnabledTop(_swigarg0)) +static PyObject *_wrap_wxMenuBar_IsEnabledTop(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxMenuBar * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxMenuBar_IsEnabledTop",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMenuBar_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMenuBar_IsEnabledTop. Expected _wxMenuBar_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxMenuBar_IsEnabledTop(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxMenuBar_SetLabelTop(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetLabelTop(_swigarg0,_swigarg1)) static PyObject *_wrap_wxMenuBar_SetLabelTop(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -11377,6 +11406,7 @@ static PyMethodDef windowscMethods[] = { { "wxMenuBar_FindMenu", (PyCFunction) _wrap_wxMenuBar_FindMenu, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_GetLabelTop", (PyCFunction) _wrap_wxMenuBar_GetLabelTop, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_SetLabelTop", (PyCFunction) _wrap_wxMenuBar_SetLabelTop, METH_VARARGS | METH_KEYWORDS }, + { "wxMenuBar_IsEnabledTop", (PyCFunction) _wrap_wxMenuBar_IsEnabledTop, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_EnableTop", (PyCFunction) _wrap_wxMenuBar_EnableTop, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_Remove", (PyCFunction) _wrap_wxMenuBar_Remove, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_Replace", (PyCFunction) _wrap_wxMenuBar_Replace, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/gtk/windows.py b/wxPython/src/gtk/windows.py index 757dd2a53b..d549d1ccf7 100644 --- a/wxPython/src/gtk/windows.py +++ b/wxPython/src/gtk/windows.py @@ -977,6 +977,9 @@ class wxMenuBarPtr(wxWindowPtr): def EnableTop(self, *_args, **_kwargs): val = apply(windowsc.wxMenuBar_EnableTop,(self,) + _args, _kwargs) return val + def IsEnabledTop(self, *_args, **_kwargs): + val = apply(windowsc.wxMenuBar_IsEnabledTop,(self,) + _args, _kwargs) + return val def SetLabelTop(self, *_args, **_kwargs): val = apply(windowsc.wxMenuBar_SetLabelTop,(self,) + _args, _kwargs) return val diff --git a/wxPython/src/gtk/wx.py b/wxPython/src/gtk/wx.py index 627080b5ae..d67821e25a 100644 --- a/wxPython/src/gtk/wx.py +++ b/wxPython/src/gtk/wx.py @@ -1691,10 +1691,14 @@ class wxApp(wxPyApp): error = 'wxApp.error' outputWindowClass = wxPyOnDemandOutputWindow - def __init__(self, redirect=_defRedirect, filename=None): + def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=true): wxPyApp.__init__(self) self.stdioWin = None self.saveStdio = (sys.stdout, sys.stderr) + + # This has to be done before OnInit + self.SetUseBestVisual(useBestVisual) + if redirect: self.RedirectStdio(filename) # this initializes wxWindows and then calls our OnInit diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index e317a426be..74b75a67bf 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -92,7 +92,6 @@ BOOL WINAPI DllMain( wxPyApp::wxPyApp() { - SetUseBestVisual(TRUE); } wxPyApp::~wxPyApp() { @@ -889,7 +888,6 @@ size_t wxPyCBInputStream::OnSysRead(void *buffer, size_t bufsize) { else m_lasterror = wxSTREAM_READ_ERROR; wxPyEndBlockThreads(); - m_lastcount = o; return o; } diff --git a/wxPython/src/mac/windows.cpp b/wxPython/src/mac/windows.cpp index c6ef38888a..97fbc28b7f 100644 --- a/wxPython/src/mac/windows.cpp +++ b/wxPython/src/mac/windows.cpp @@ -9978,6 +9978,35 @@ static PyObject *_wrap_wxMenuBar_EnableTop(PyObject *self, PyObject *args, PyObj return _resultobj; } +#define wxMenuBar_IsEnabledTop(_swigobj,_swigarg0) (_swigobj->IsEnabledTop(_swigarg0)) +static PyObject *_wrap_wxMenuBar_IsEnabledTop(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxMenuBar * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxMenuBar_IsEnabledTop",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMenuBar_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMenuBar_IsEnabledTop. Expected _wxMenuBar_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxMenuBar_IsEnabledTop(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxMenuBar_SetLabelTop(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetLabelTop(_swigarg0,_swigarg1)) static PyObject *_wrap_wxMenuBar_SetLabelTop(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -11377,6 +11406,7 @@ static PyMethodDef windowscMethods[] = { { "wxMenuBar_FindMenu", (PyCFunction) _wrap_wxMenuBar_FindMenu, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_GetLabelTop", (PyCFunction) _wrap_wxMenuBar_GetLabelTop, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_SetLabelTop", (PyCFunction) _wrap_wxMenuBar_SetLabelTop, METH_VARARGS | METH_KEYWORDS }, + { "wxMenuBar_IsEnabledTop", (PyCFunction) _wrap_wxMenuBar_IsEnabledTop, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_EnableTop", (PyCFunction) _wrap_wxMenuBar_EnableTop, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_Remove", (PyCFunction) _wrap_wxMenuBar_Remove, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_Replace", (PyCFunction) _wrap_wxMenuBar_Replace, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/mac/windows.py b/wxPython/src/mac/windows.py index 757dd2a53b..d549d1ccf7 100644 --- a/wxPython/src/mac/windows.py +++ b/wxPython/src/mac/windows.py @@ -977,6 +977,9 @@ class wxMenuBarPtr(wxWindowPtr): def EnableTop(self, *_args, **_kwargs): val = apply(windowsc.wxMenuBar_EnableTop,(self,) + _args, _kwargs) return val + def IsEnabledTop(self, *_args, **_kwargs): + val = apply(windowsc.wxMenuBar_IsEnabledTop,(self,) + _args, _kwargs) + return val def SetLabelTop(self, *_args, **_kwargs): val = apply(windowsc.wxMenuBar_SetLabelTop,(self,) + _args, _kwargs) return val diff --git a/wxPython/src/mac/wx.py b/wxPython/src/mac/wx.py index 627080b5ae..d67821e25a 100644 --- a/wxPython/src/mac/wx.py +++ b/wxPython/src/mac/wx.py @@ -1691,10 +1691,14 @@ class wxApp(wxPyApp): error = 'wxApp.error' outputWindowClass = wxPyOnDemandOutputWindow - def __init__(self, redirect=_defRedirect, filename=None): + def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=true): wxPyApp.__init__(self) self.stdioWin = None self.saveStdio = (sys.stdout, sys.stderr) + + # This has to be done before OnInit + self.SetUseBestVisual(useBestVisual) + if redirect: self.RedirectStdio(filename) # this initializes wxWindows and then calls our OnInit diff --git a/wxPython/src/msw/windows.cpp b/wxPython/src/msw/windows.cpp index 59aa429f09..a808dcacbf 100644 --- a/wxPython/src/msw/windows.cpp +++ b/wxPython/src/msw/windows.cpp @@ -10072,6 +10072,35 @@ static PyObject *_wrap_wxMenuBar_EnableTop(PyObject *self, PyObject *args, PyObj return _resultobj; } +#define wxMenuBar_IsEnabledTop(_swigobj,_swigarg0) (_swigobj->IsEnabledTop(_swigarg0)) +static PyObject *_wrap_wxMenuBar_IsEnabledTop(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxMenuBar * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxMenuBar_IsEnabledTop",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMenuBar_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMenuBar_IsEnabledTop. Expected _wxMenuBar_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxMenuBar_IsEnabledTop(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxMenuBar_SetLabelTop(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetLabelTop(_swigarg0,_swigarg1)) static PyObject *_wrap_wxMenuBar_SetLabelTop(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -11859,6 +11888,7 @@ static PyMethodDef windowscMethods[] = { { "wxMenuBar_FindMenu", (PyCFunction) _wrap_wxMenuBar_FindMenu, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_GetLabelTop", (PyCFunction) _wrap_wxMenuBar_GetLabelTop, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_SetLabelTop", (PyCFunction) _wrap_wxMenuBar_SetLabelTop, METH_VARARGS | METH_KEYWORDS }, + { "wxMenuBar_IsEnabledTop", (PyCFunction) _wrap_wxMenuBar_IsEnabledTop, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_EnableTop", (PyCFunction) _wrap_wxMenuBar_EnableTop, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_Remove", (PyCFunction) _wrap_wxMenuBar_Remove, METH_VARARGS | METH_KEYWORDS }, { "wxMenuBar_Replace", (PyCFunction) _wrap_wxMenuBar_Replace, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/windows.py b/wxPython/src/msw/windows.py index a79d3e40bd..a6de1a3897 100644 --- a/wxPython/src/msw/windows.py +++ b/wxPython/src/msw/windows.py @@ -983,6 +983,9 @@ class wxMenuBarPtr(wxWindowPtr): def EnableTop(self, *_args, **_kwargs): val = apply(windowsc.wxMenuBar_EnableTop,(self,) + _args, _kwargs) return val + def IsEnabledTop(self, *_args, **_kwargs): + val = apply(windowsc.wxMenuBar_IsEnabledTop,(self,) + _args, _kwargs) + return val def SetLabelTop(self, *_args, **_kwargs): val = apply(windowsc.wxMenuBar_SetLabelTop,(self,) + _args, _kwargs) return val diff --git a/wxPython/src/msw/wx.py b/wxPython/src/msw/wx.py index 7fd9408c79..61050b8fdd 100644 --- a/wxPython/src/msw/wx.py +++ b/wxPython/src/msw/wx.py @@ -1697,10 +1697,14 @@ class wxApp(wxPyApp): error = 'wxApp.error' outputWindowClass = wxPyOnDemandOutputWindow - def __init__(self, redirect=_defRedirect, filename=None): + def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=true): wxPyApp.__init__(self) self.stdioWin = None self.saveStdio = (sys.stdout, sys.stderr) + + # This has to be done before OnInit + self.SetUseBestVisual(useBestVisual) + if redirect: self.RedirectStdio(filename) # this initializes wxWindows and then calls our OnInit diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 702922d27b..be61dd34fa 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -761,6 +761,7 @@ public: wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); wxMenu *Remove(size_t pos); void EnableTop(size_t pos, bool enable); + bool IsEnabledTop(size_t pos); void SetLabelTop(size_t pos, const wxString& label); wxString GetLabelTop(size_t pos); int FindMenu(const wxString& title); diff --git a/wxPython/wxPython/lib/PyCrust/PyCrustApp.py b/wxPython/wxPython/lib/PyCrust/PyCrustApp.py index d262fbea91..1ed59b2fc5 100755 --- a/wxPython/wxPython/lib/PyCrust/PyCrustApp.py +++ b/wxPython/wxPython/lib/PyCrust/PyCrustApp.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """PyCrustApp is a python shell and namespace browser application.""" __author__ = "Patrick K. O'Brien " diff --git a/wxPython/wxPython/lib/PyCrust/PyFillingApp.py b/wxPython/wxPython/lib/PyCrust/PyFillingApp.py index 6869f1aa73..a4ec426e77 100755 --- a/wxPython/wxPython/lib/PyCrust/PyFillingApp.py +++ b/wxPython/wxPython/lib/PyCrust/PyFillingApp.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """PyFillingApp is a python namespace inspection application.""" __author__ = "Patrick K. O'Brien " diff --git a/wxPython/wxPython/lib/PyCrust/PyShellApp.py b/wxPython/wxPython/lib/PyCrust/PyShellApp.py index ff60f5f845..f20ed1b385 100755 --- a/wxPython/wxPython/lib/PyCrust/PyShellApp.py +++ b/wxPython/wxPython/lib/PyCrust/PyShellApp.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """PyShellApp is a python shell application.""" __author__ = "Patrick K. O'Brien " diff --git a/wxPython/wxPython/lib/mixins/listctrl.py b/wxPython/wxPython/lib/mixins/listctrl.py index 1c70c12ce7..0e49c11307 100644 --- a/wxPython/wxPython/lib/mixins/listctrl.py +++ b/wxPython/wxPython/lib/mixins/listctrl.py @@ -132,137 +132,102 @@ class wxColumnSorterMixin: class wxListCtrlAutoWidthMixin: """ A mix-in class that automatically resizes the last column to take up - the remaining width of the wxListCtrl. + the remaining width of the wxListCtrl. - This causes the wxListCtrl to automatically take up the full width of - the list, without either a horizontal scroll bar (unless absolutely - necessary) or empty space to the right of the last column. + This causes the wxListCtrl to automatically take up the full width of + the list, without either a horizontal scroll bar (unless absolutely + necessary) or empty space to the right of the last column. - NOTE: This only works for report-style lists. + NOTE: This only works for report-style lists. - WARNING: If you override the EVT_SIZE event in your wxListCtrl, make - sure you call event.Skip() to ensure that the mixin's - _OnResize method is called. + WARNING: If you override the EVT_SIZE event in your wxListCtrl, make + sure you call event.Skip() to ensure that the mixin's + _OnResize method is called. - This mix-in class was written by Erik Westra + This mix-in class was written by Erik Westra """ def __init__(self): - """ Standard initialiser. - """ - self._needResize = false - self._lastColMinWidth = None + """ Standard initialiser. + """ + self._lastColMinWidth = None - EVT_SIZE(self, self._onResize) - EVT_LIST_COL_END_DRAG(self, self.GetId(), self._onEndColDrag) - EVT_IDLE(self, self._onIdle) + EVT_SIZE(self, self._onResize) + EVT_LIST_COL_END_DRAG(self, self.GetId(), self._onResize) def resizeLastColumn(self, minWidth): - """ Resize the last column appropriately. + """ Resize the last column appropriately. - If the list's columns are too wide to fit within the window, we use - a horizontal scrollbar. Otherwise, we expand the right-most column - to take up the remaining free space in the list. + If the list's columns are too wide to fit within the window, we use + a horizontal scrollbar. Otherwise, we expand the right-most column + to take up the remaining free space in the list. - This method is called automatically when the wxListCtrl is resized; - you can also call it yourself whenever you want the last column to - be resized appropriately (eg, when adding, removing or resizing - columns). + This method is called automatically when the wxListCtrl is resized; + you can also call it yourself whenever you want the last column to + be resized appropriately (eg, when adding, removing or resizing + columns). - 'minWidth' is the preferred minimum width for the last column. - """ - self._lastColMinWidth = minWidth - self._doResize() + 'minWidth' is the preferred minimum width for the last column. + """ + self._lastColMinWidth = minWidth + self._doResize() # ===================== # == Private Methods == # ===================== def _onResize(self, event): - """ Respond to the wxListCtrl being resized. + """ Respond to the wxListCtrl being resized. - We automatically resize the last column in the list. - """ - self._doResize() - event.Skip() - - def _onEndColDrag(self, event): - """ Respond to the user resizing one of our columns. - - We resize the last column in the list to match. Note that, because - of a quirk in the way columns are resized under MS Windows, we - actually have to do the column resize in idle time. - """ - self._needResize = true - event.Skip() - - - def _onIdle(self, event): - """ Respond to an idle event. - - We resize the last column, if we've been asked to do so. - """ - if self._needResize: - self._doResize() - self.Refresh() # Fixes redraw problem under MS Windows. - self._needResize = false + We automatically resize the last column in the list. + """ + wxCallAfter(self._doResize) event.Skip() def _doResize(self): - """ Resize the last column as appropriate. + """ Resize the last column as appropriate. - If the list's columns are too wide to fit within the window, we use - a horizontal scrollbar. Otherwise, we expand the right-most column - to take up the remaining free space in the list. + If the list's columns are too wide to fit within the window, we use + a horizontal scrollbar. Otherwise, we expand the right-most column + to take up the remaining free space in the list. - We remember the current size of the last column, before resizing, - as the preferred minimum width if we haven't previously been given - or calculated a minimum width. This ensure that repeated calls to - _doResize() don't cause the last column to size itself too large. - """ - numCols = self.GetColumnCount() - if numCols == 0: return # Nothing to resize. + We remember the current size of the last column, before resizing, + as the preferred minimum width if we haven't previously been given + or calculated a minimum width. This ensure that repeated calls to + _doResize() don't cause the last column to size itself too large. + """ + numCols = self.GetColumnCount() + if numCols == 0: return # Nothing to resize. - if self._lastColMinWidth == None: - self._lastColMinWidth = self.GetColumnWidth(numCols - 1) + if self._lastColMinWidth == None: + self._lastColMinWidth = self.GetColumnWidth(numCols - 1) - listWidth = self.GetSize().width - if self.GetItemCount() > self.GetCountPerPage(): - # We're showing the vertical scrollbar -> allow for scrollbar width - scrollWidth = wxSystemSettings_GetSystemMetric(wxSYS_VSCROLL_X) - listWidth = listWidth - scrollWidth + # We're showing the vertical scrollbar -> allow for scrollbar width + # NOTE: on GTK, the scrollbar is included in the client size, but on + # Windows it is not included + listWidth = self.GetClientSize().width + if wxPlatform != '__WXMSW__': + if self.GetItemCount() > self.GetCountPerPage(): + scrollWidth = wxSystemSettings_GetSystemMetric(wxSYS_VSCROLL_X) + listWidth = listWidth - scrollWidth - totColWidth = 0 # Width of all columns except last one. - for col in range(numCols-1): - totColWidth = totColWidth + self.GetColumnWidth(col) + totColWidth = 0 # Width of all columns except last one. + for col in range(numCols-1): + totColWidth = totColWidth + self.GetColumnWidth(col) - lastColWidth = self.GetColumnWidth(numCols - 1) + lastColWidth = self.GetColumnWidth(numCols - 1) - # NOTE: This is the extra number of pixels required to make the - # wxListCtrl size correctly, at least under Windows 2000. - # Unfortunately, different OSs and even different versions of the - # same OS may implement the wxListCtrl differently, so different - # margins may be needed to get the columns resized correctly. No - # doubt the margin could be calculated in a more intelligent - # manner... - if wxPlatform == '__WXMSW__': - margin = 6 - elif wxPlatform == '__WXGTK__': - margin = 8 - else: - margin = 0 + if totColWidth + self._lastColMinWidth > listWidth: + # We haven't got the width to show the last column at its minimum + # width -> set it to its minimum width and allow the horizontal + # scrollbar to show. + self.SetColumnWidth(numCols-1, self._lastColMinWidth) + return - if totColWidth + self._lastColMinWidth > listWidth - margin: - # We haven't got the width to show the last column at its minimum - # width -> set it to its minimum width and allow the horizontal - # scrollbar to show. - self.SetColumnWidth(numCols-1, self._lastColMinWidth) - return + # Resize the last column to take up the remaining available space. - # Resize the last column to take up the remaining available space. - - self.SetColumnWidth(numCols-1, listWidth - totColWidth - margin) + self.SetColumnWidth(numCols-1, listWidth - totColWidth) diff --git a/wxPython/wxPython/lib/mixins/rubberband.py b/wxPython/wxPython/lib/mixins/rubberband.py new file mode 100644 index 0000000000..e4d9ff7709 --- /dev/null +++ b/wxPython/wxPython/lib/mixins/rubberband.py @@ -0,0 +1,389 @@ +""" +A mixin class for doing "RubberBand"-ing on a window. + +by "Robb Shecter" + +$Id$ + +""" + +from wxPython.wx import * +import Image + +# +# Some miscellaneous mathematical and geometrical functions +# + +def isNegative(aNumber): + """ + x < 0: 1 + else: 0 + """ + return aNumber < 0 + + +def normalizeBox(box): + """ + Convert any negative measurements in the current + box to positive, and adjust the origin. + """ + x, y, w, h = box + if w < 0: + x += (w+1) + w *= -1 + if h < 0: + y += (h+1) + h *= -1 + return (x, y, w, h) + + +def boxToExtent(box): + """ + Convert a box specification to an extent specification. + I put this into a seperate function after I realized that + I had been implementing it wrong in several places. + """ + b = normalizeBox(box) + return (b[0], b[1], b[0]+b[2]-1, b[1]+b[3]-1) + + +def pointInBox(x, y, box): + """ + Return true if the given point is contained in the box. + """ + e = boxToExtent(box) + return x >= e[0] and x <= e[2] and y >= e[1] and y <= e[3] + + +def pointOnBox(x, y, box, thickness=1): + """ + Return true if the point is on the outside edge + of the box. The thickness defines how thick the + edge should be. This is necessary for HCI reasons: + For example, it's normally very difficult for a user + to manuever the mouse onto a one pixel border. + """ + outerBox = box + innerBox = (box[0]+thickness, box[1]+thickness, box[2]-(thickness*2), box[3]-(thickness*2)) + return pointInBox(x, y, outerBox) and not pointInBox(x, y, innerBox) + + +def getCursorPosition(x, y, box, thickness=1): + """ + Return a position number in the range 0 .. 7 to indicate + where on the box border the point is. The layout is: + + 0 1 2 + 7 3 + 6 5 4 + """ + x0, y0, x1, y1 = boxToExtent(box) + w, h = box[2], box[3] + delta = thickness - 1 + p = None + + if pointInBox(x, y, (x0, y0, thickness, thickness)): + p = 0 + elif pointInBox(x, y, (x1-delta, y0, thickness, thickness)): + p = 2 + elif pointInBox(x, y, (x1-delta, y1-delta, thickness, thickness)): + p = 4 + elif pointInBox(x, y, (x0, y1-delta, thickness, thickness)): + p = 6 + elif pointInBox(x, y, (x0+thickness, y0, w-(thickness*2), thickness)): + p = 1 + elif pointInBox(x, y, (x1-delta, y0+thickness, thickness, h-(thickness*2))): + p = 3 + elif pointInBox(x, y, (x0+thickness, y1-delta, w-(thickness*2), thickness)): + p = 5 + elif pointInBox(x, y, (x0, y0+thickness, thickness, h-(thickness*2))): + p = 7 + + return p + + + + +class RubberBand: + """ + A stretchable border which is drawn on top of an + image to define an area. + """ + def __init__(self, drawingSurface, aspectRatio=None): + self.__THICKNESS = 5 + self.drawingSurface = drawingSurface + self.aspectRatio = aspectRatio + self.hasLetUp = 0 + self.currentlyMoving = None + self.currentBox = None + self.__enabled = 1 + self.__currentCursor = None + EVT_MOUSE_EVENTS(drawingSurface, self.__handleMouseEvents) + EVT_PAINT(drawingSurface, self.__handleOnPaint) + + def __setEnabled(self, enabled): + self.__enabled = enabled + + def __isEnabled(self): + return self.__enabled + + def __handleOnPaint(self, event): + #print 'paint' + event.Skip() + + def __isMovingCursor(self): + """ + Return true if the current cursor is one used to + mean moving the rubberband. + """ + return self.__currentCursor == wxCURSOR_HAND + + def __isSizingCursor(self): + """ + Return true if the current cursor is one of the ones + I may use to signify sizing. + """ + sizingCursors = [wxCURSOR_SIZENESW, + wxCURSOR_SIZENS, + wxCURSOR_SIZENWSE, + wxCURSOR_SIZEWE, + wxCURSOR_SIZING, + wxCURSOR_CROSS] + try: + sizingCursors.index(self.__currentCursor) + return 1 + except ValueError: + return 0 + + + def __handleMouseEvents(self, event): + """ + React according to the new event. This is the main + entry point into the class. This method contains the + logic for the class's behavior. + """ + if not self.enabled: + return + + x, y = event.GetPosition() + + # First make sure we have started a box. + if self.currentBox == None and not event.LeftDown(): + # No box started yet. Set cursor to the initial kind. + self.__setCursor(wxCURSOR_CROSS) + return + + if event.LeftDown(): + if self.currentBox == None: + # No RB Box, so start a new one. + self.currentBox = (x, y, 0, 0) + self.hasLetUp = 0 + elif self.__isSizingCursor(): + # Starting a sizing operation. Change the origin. + position = getCursorPosition(x, y, self.currentBox, thickness=self.__THICKNESS) + self.currentBox = self.__denormalizeBox(position, self.currentBox) + + elif event.Dragging() and event.LeftIsDown(): + # Use the cursor type to determine operation + if self.__isMovingCursor(): + if self.currentlyMoving or pointInBox(x, y, self.currentBox): + if not self.currentlyMoving: + self.currentlyMoving = (x - self.currentBox[0], y - self.currentBox[1]) + self.__moveTo(x - self.currentlyMoving[0], y - self.currentlyMoving[1]) + elif self.__isSizingCursor(): + self.__resizeBox(x, y) + + elif event.LeftUp(): + self.hasLetUp = 1 + self.currentlyMoving = None + self.__normalizeBox() + + elif event.Moving() and not event.Dragging(): + # Simple mouse movement event + self.__mouseMoved(x,y) + + def __denormalizeBox(self, position, box): + x, y, w, h = box + b = box + if position == 2 or position == 3: + b = (x, y + (h-1), w, h * -1) + elif position == 0 or position == 1 or position == 7: + b = (x + (w-1), y + (h-1), w * -1, h * -1) + elif position == 6: + b = (x + (w-1), y, w * -1, h) + return b + + def __resizeBox(self, x, y): + """ + Resize and repaint the box based on the given mouse + coordinates. + """ + # Implement the correct behavior for dragging a side + # of the box: Only change one dimension. + if not self.aspectRatio: + if self.__currentCursor == wxCURSOR_SIZENS: + x = None + elif self.__currentCursor == wxCURSOR_SIZEWE: + y = None + + x0,y0,w0,h0 = self.currentBox + currentExtent = boxToExtent(self.currentBox) + if x == None: + if w0 < 1: + w0 += 1 + else: + w0 -= 1 + x = x0 + w0 + if y == None: + if h0 < 1: + h0 += 1 + else: + h0 -= 1 + y = y0 + h0 + x1,y1 = x, y + w, h = abs(x1-x0)+1, abs(y1-y0)+1 + if self.aspectRatio: + w = max(w, int(h * self.aspectRatio)) + h = int(w / self.aspectRatio) + w *= [1,-1][isNegative(x1-x0)] + h *= [1,-1][isNegative(y1-y0)] + newbox = (x0, y0, w, h) + self.__drawAndErase(boxToDraw=normalizeBox(newbox), boxToErase=normalizeBox(self.currentBox)) + self.currentBox = (x0, y0, w, h) + + def __normalizeBox(self): + """ + Convert any negative measurements in the current + box to positive, and adjust the origin. + """ + self.currentBox = normalizeBox(self.currentBox) + + def __mouseMoved(self, x, y): + """ + Called when the mouse moved without any buttons pressed + or dragging being done. + """ + # Are we on the bounding box? + if pointOnBox(x, y, self.currentBox, thickness=self.__THICKNESS): + position = getCursorPosition(x, y, self.currentBox, thickness=self.__THICKNESS) + cursor = [ + wxCURSOR_SIZENWSE, + wxCURSOR_SIZENS, + wxCURSOR_SIZENESW, + wxCURSOR_SIZEWE, + wxCURSOR_SIZENWSE, + wxCURSOR_SIZENS, + wxCURSOR_SIZENESW, + wxCURSOR_SIZEWE + ] [position] + self.__setCursor(cursor) + elif pointInBox(x, y, self.currentBox): + self.__setCursor(wxCURSOR_HAND) + else: + self.__setCursor() + + def __setCursor(self, id=None): + """ + Set the mouse cursor to the given id. + """ + if self.__currentCursor != id: # Avoid redundant calls + if id: + self.drawingSurface.SetCursor(wxStockCursor(id)) + else: + self.drawingSurface.SetCursor(wxNullCursor) + self.__currentCursor = id + + def __moveCenterTo(self, x, y): + """ + Move the rubber band so that its center is at (x,y). + """ + x0, y0, w, h = self.currentBox + x2, y2 = x - (w/2), y - (h/2) + self.__moveTo(x2, y2) + + def __moveTo(self, x, y): + """ + Move the rubber band so that its origin is at (x,y). + """ + newbox = (x, y, self.currentBox[2], self.currentBox[3]) + self.__drawAndErase(boxToDraw=newbox, boxToErase=self.currentBox) + self.currentBox = newbox + + def __drawAndErase(self, boxToDraw, boxToErase=None): + """ + Draw one box shape and possibly erase another. + """ + dc = wxClientDC(self.drawingSurface) + dc.BeginDrawing() + dc.SetPen(wxPen(wxWHITE, 1, wxDOT)) + dc.SetBrush(wxTRANSPARENT_BRUSH) + dc.SetLogicalFunction(wxXOR) + if boxToErase: + dc.DrawRectangle(*boxToErase) + dc.DrawRectangle(*boxToDraw) + dc.EndDrawing() + + def __dumpMouseEvent(self, event): + print 'Moving: ',event.Moving() + print 'Dragging: ',event.Dragging() + print 'LeftDown: ',event.LeftDown() + print 'LeftisDown: ',event.LeftIsDown() + print 'LeftUp: ',event.LeftUp() + print 'Position: ',event.GetPosition() + print 'x,y: ',event.GetX(),event.GetY() + print + + + # + # The public API: + # + + def reset(self, aspectRatio=None): + """ + Clear the existing rubberband + """ + self.currentBox = None + self.aspectRatio = aspectRatio + self.drawingSurface.Refresh() + + def getCurrentExtent(self): + """ + Return (x0, y0, x1, y1) or None if + no drawing has yet been done. + """ + if not self.currentBox: + extent = None + else: + extent = boxToExtent(self.currentBox) + return extent + + enabled = property(__isEnabled, __setEnabled, None, 'True if I am responding to mouse events') + + + +if __name__ == '__main__': + app = wxPySimpleApp() + frame = wxFrame(None, -1, title='RubberBand Test', size=(300,300)) + + # Add a panel that the rubberband will work on. + panel = wxPanel(frame, -1) + panel.SetBackgroundColour(wxBLUE) + + # Create the rubberband + frame.rubberBand = RubberBand(drawingSurface=panel) + frame.rubberBand.reset(aspectRatio=0.5) + + # Add a button that creates a new rubberband + def __newRubberBand(event): + frame.rubberBand.reset() + button = wxButton(frame, 100, 'Reset Rubberband') + EVT_BUTTON(frame, 100, __newRubberBand) + + # Layout the frame + sizer = wxBoxSizer(wxVERTICAL) + sizer.Add(panel, 1, wxEXPAND | wxALL, 5) + sizer.Add(button, 0, wxALIGN_CENTER | wxALL, 5) + frame.SetAutoLayout(1) + frame.SetSizer(sizer) + frame.Show(1) + app.MainLoop() diff --git a/wxPython/wxPython/lib/timectrl.py b/wxPython/wxPython/lib/timectrl.py new file mode 100644 index 0000000000..7e6fd09e85 --- /dev/null +++ b/wxPython/wxPython/lib/timectrl.py @@ -0,0 +1,801 @@ +#---------------------------------------------------------------------------- +# Name: wxTimeCtrl.py +# Author: Will Sadkin +# Created: 09/19/2002 +# Copyright: (c) 2002 by Will Sadkin, 2002 +# RCS-ID: $Id$ +# License: wxWindows license +#---------------------------------------------------------------------------- +# NOTE: +# This was written way it is because of the lack of masked edit controls +# in wxWindows/wxPython. I would also have preferred to derive this +# control from a wxSpinCtrl rather than wxTextCtrl, but the wxTextCtrl +# component of that control is inaccessible through the interface exposed in +# wxPython. +# +# wxTimeCtrl does not use validators, because it does careful manipulation +# of the cursor in the text window on each keystroke, and validation is +# cursor-position specific, so the control intercepts the key codes before the +# validator would fire. +# + +from wxPython.wx import * +import string + +# The following bit of function is for debugging the subsequent code. +# To turn on debugging output, set _debug to 1 +_debug = 0 +_indent = 0 + +if _debug: + def _dbg(*args, **kwargs): + global _indent + + if len(args): + if _indent: print ' ' * 3 * _indent, + for arg in args: print arg, + print + # else do nothing + + # post process args: + for kwarg, value in kwargs.items(): + if kwarg == 'indent' and value: _indent = _indent + 1 + elif kwarg == 'indent' and value == 0: _indent = _indent - 1 + if _indent < 0: _indent = 0 +else: + def _dbg(*args, **kwargs): + pass + + +# This class of event fires whenever the value of the time changes in the control: +wxEVT_TIMEVAL_UPDATED = wxNewId() +def EVT_TIMEUPDATE(win, id, func): + """Used to trap events indicating that the current time has been changed.""" + win.Connect(id, -1, wxEVT_TIMEVAL_UPDATED, func) + +class TimeUpdatedEvent(wxPyCommandEvent): + def __init__(self, id, value ='12:00:00 AM'): + wxPyCommandEvent.__init__(self, wxEVT_TIMEVAL_UPDATED, id) + self.value = value + def GetValue(self): + """Retrieve the value of the time control at the time this event was generated""" + return self.value + + +# Set up all the positions of the cells in the wxTimeCtrl (once at module import): +# Format of control is: +# hh:mm:ss xM +# 1 +# positions: 01234567890 +_listCells = ['hour', 'minute', 'second', 'am_pm'] +_listCellRange = [(0,1,2), (3,4,5), (6,7,8), (9,10,11)] +_listDelimPos = [2,5,8] + +# Create dictionary of cell ranges, indexed by name or position in the range: +_dictCellRange = {} +for i in range(4): + _dictCellRange[_listCells[i]] = _listCellRange[i] +for cell in _listCells: + for i in _dictCellRange[cell]: + _dictCellRange[i] = _dictCellRange[cell] + + +# Create lists of starting and ending positions for each range, and a dictionary of starting +# positions indexed by name +_listStartCellPos = [] +_listEndCellPos = [] +for tup in _listCellRange: + _listStartCellPos.append(tup[0]) # 1st char of cell + _listEndCellPos.append(tup[1]) # last char of cell (not including delimiter) + +_dictStartCellPos = {} +for i in range(4): + _dictStartCellPos[_listCells[i]] = _listStartCellPos[i] + + +class wxTimeCtrl(wxTextCtrl): + def __init__ ( + self, parent, id=-1, value = '12:00:00 AM', + pos = wxDefaultPosition, size = wxDefaultSize, + fmt24hr=0, + spinButton = None, + style = wxTE_PROCESS_TAB, name = "time" + ): + wxTextCtrl.__init__(self, parent, id, value='', + pos=pos, size=size, style=style, name=name) + + self.__fmt24hr = fmt24hr + + if size == wxDefaultSize: + # set appropriate default sizes depending on format: + if self.__fmt24hr: + testText = '00:00:00X' # give it a little extra space + else: + testText = '00:00:00 XXX' # give it a little extra space + if wxPlatform == "__WXMAC__": + testText += 'X' + w, h = self.GetTextExtent(testText) + self.SetClientSize( (w+4, self.GetClientSize().height) ) + + + if self.__fmt24hr: self.__lastCell = 'second' + else: self.__lastCell = 'am_pm' + + # Validate initial value and set if appropriate + try: + self.SetValue(value) + except ValueError: + self.SetValue('12:00:00 AM') + + # set initial position and selection state + self.__SetCurrentCell(_dictStartCellPos['hour']) + self.__bSelection = false + self.__posSelectTo = self.__posCurrent + + # Set up internal event handlers to change the event reaction behavior of + # the base wxTextCtrl: + EVT_TEXT(self, self.GetId(), self.__OnTextChange) + EVT_SET_FOCUS(self, self.__OnFocus) + EVT_LEFT_UP(self, self.__OnChangePos) + EVT_LEFT_DCLICK(self, self.__OnDoubleClick) + EVT_CHAR(self, self.__OnChar) + + if spinButton: + self.BindSpinbutton(spinButton) # bind spin button up/down events to this control + + + def BindSpinButton(self, sb): + """ + This function binds an externally created spin button to the control, so that + up/down events from the button automatically change the control. + """ + _dbg('wxTimeCtrl::BindSpinButton') + self.__spinButton = sb + if self.__spinButton: + # bind event handlers to spin ctrl + EVT_SPIN_UP(self.__spinButton, self.__spinButton.GetId(), self.__OnSpinUp) + EVT_SPIN_DOWN(self.__spinButton, self.__spinButton.GetId(), self.__OnSpinDown) + + + + def __repr__(self): + return "" % self.GetValue() + + + + def SetValue(self, value): + """ + Validating SetValue function for time strings, doing 12/24 format conversion as appropriate. + """ + _dbg('wxTimeCtrl::SetValue', indent=1) + dict_range = _dictCellRange # (for brevity) + dict_start = _dictStartCellPos + + fmt12len = dict_range['am_pm'][-1] + fmt24len = dict_range['second'][-1] + try: + separators_correct = value[2] == ':' and value[5] == ':' + len_ok = len(value) in (fmt12len, fmt24len) + + if len(value) > fmt24len: + separators_correct = separators_correct and value[8] == ' ' + hour = int(value[dict_range['hour'][0]:dict_range['hour'][-1]]) + hour_ok = ((hour in range(0,24) and len(value) == fmt24len) + or (hour in range(1,13) and len(value) == fmt12len + and value[dict_start['am_pm']:] in ('AM', 'PM'))) + + minute = int(value[dict_range['minute'][0]:dict_range['minute'][-1]]) + min_ok = minute in range(60) + second = int(value[dict_range['second'][0]:dict_range['second'][-1]]) + sec_ok = second in range(60) + + _dbg('len_ok =', len_ok, 'separators_correct =', separators_correct) + _dbg('hour =', hour, 'hour_ok =', hour_ok, 'min_ok =', min_ok, 'sec_ok =', sec_ok) + + if len_ok and hour_ok and min_ok and sec_ok and separators_correct: + _dbg('valid time string') + + self.__hour = hour + if len(value) == fmt12len: # handle 12 hour format conversion for actual hour: + am = value[dict_start['am_pm']:] == 'AM' + if hour != 12 and not am: + self.__hour = hour = (hour+12) % 24 + elif hour == 12: + if am: self.__hour = hour = 0 + + self.__minute = minute + self.__second = second + + # valid time + need_to_convert = ((self.__fmt24hr and len(value) == fmt12len) + or (not self.__fmt24hr and len(value) == fmt24len)) + _dbg('need_to_convert =', need_to_convert) + + if need_to_convert: #convert to 12/24 hour format as specified: + if self.__fmt24hr and len(value) == fmt12len: + text = '%.2d:%.2d:%.2d' % (hour, minute, second) + else: + if hour > 12: + hour = hour - 12 + am_pm = 'PM' + elif hour == 12: + am_pm = 'PM' + else: + if hour == 0: hour = 12 + am_pm = 'AM' + text = '%2d:%.2d:%.2d %s' % (hour, minute, second, am_pm) + else: + text = value + _dbg('text=', text) + wxTextCtrl.SetValue(self, text) + _dbg('firing TimeUpdatedEvent...') + evt = TimeUpdatedEvent(self.GetId(), text) + evt.SetEventObject(self) + self.GetEventHandler().ProcessEvent(evt) + else: + _dbg('len_ok:', len_ok, 'separators_correct =', separators_correct) + _dbg('hour_ok:', hour_ok, 'min_ok:', min_ok, 'sec_ok:', sec_ok, indent=0) + raise ValueError, 'value is not a valid time string' + + except (TypeError, ValueError): + _dbg(indent=0) + raise ValueError, 'value is not a valid time string' + _dbg(indent=0) + + def SetWxDateTime(self, wxdt): + value = '%2d:%.2d:%.2d' % (wxdt.GetHour(), wxdt.GetMinute(), wxdt.GetSecond()) + self.SetValue(value) + + def GetWxDateTime(self): + t = wxDateTimeFromHMS(self.__hour, self.__minute, self.__second) + return t + + def SetMxDateTime(self, mxdt): + from mx import DateTime + value = '%2d:%.2d:%.2d' % (mxdt.hour, mxdt.minute, mxdt.second) + self.SetValue(value) + + def GetMxDateTime(self): + from mx import DateTime + t = DateTime.Time(self.__hour, self.__minute, self.__second) + return t + +#------------------------------------------------------------------------------------------------------------- +# these are private functions and overrides: + + def __SetCurrentCell(self, pos): + """ + Sets state variables that indicate the current cell and position within the control. + """ + self.__posCurrent = pos + self.__cellStart, self.__cellEnd = _dictCellRange[pos][0], _dictCellRange[pos][-1] + + + def SetInsertionPoint(self, pos): + """ + Records the specified position and associated cell before calling base class' function. + """ + self.__SetCurrentCell(pos) + wxTextCtrl.SetInsertionPoint(self, pos) # (causes EVT_TEXT event to fire) + + + def SetSelection(self, sel_start, sel_to): + _dbg('wxTimeCtrl::SetSelection', sel_start, sel_to) + self.__bSelection = sel_start != sel_to + self.__posSelectTo = sel_to + wxTextCtrl.SetSelection(self, sel_start, sel_to) + + + def __OnFocus(self,event): + """ + This event handler is currently necessary to work around new default + behavior as of wxPython2.3.3; + The TAB key auto selects the entire contents of the wxTextCtrl *after* + the EVT_SET_FOCUS event occurs; therefore we can't query/adjust the selection + *here*, because it hasn't happened yet. So to prevent this behavior, and + preserve the correct selection when the focus event is not due to tab, + we need to pull the following trick: + """ + _dbg('wxTimeCtrl::OnFocus') + wxCallAfter(self.__FixSelection) + event.Skip() + + + def __FixSelection(self): + """ + This gets called after the TAB traversal selection is made, if the + focus event was due to this, but before the EVT_LEFT_* events if + the focus shift was due to a mouse event. + + The trouble is that, a priori, there's no explicit notification of + why the focus event we received. However, the whole reason we need to + do this is because the default behavior on TAB traveral in a wxTextCtrl is + now to select the entire contents of the window, something we don't want. + So we can *now* test the selection range, and if it's "the whole text" + we can assume the cause, change the insertion point to the start of + the control, and deselect. + """ + _dbg('wxTimeCtrl::FixSelection', indent=1) + sel_start, sel_to = self.GetSelection() + if sel_start == 0 and sel_to in _dictCellRange[self.__lastCell]: + # This isn't normally allowed, and so assume we got here by the new + # "tab traversal" behavior, so we need to reset the selection + # and insertion point: + _dbg('entire text selected; resetting selection to start of control') + self.__SetCurrentCell(0) + self.SetInsertionPoint(0) + self.SetSelection(self.__posCurrent, self.__posCurrent) + _dbg(indent=0) + + + def __OnTextChange(self, event): + """ + This private event handler is required to retain the current position information of the cursor + after update to the underlying text control is done. + """ + _dbg('wxTimeCtrl::OnTextChange', indent=1) + self.__SetCurrentCell(self.__posCurrent) # ensure cell range vars are set + + # Note: must call self.SetSelection here to preserve insertion point cursor after update! + # (I don't know why, but this does the trick!) + if self.__bSelection: + _dbg('reselecting from ', self.__posCurrent, 'to', self.__posSelectTo) + self.SetSelection(self.__posCurrent, self.__posSelectTo) + else: + self.SetSelection(self.__posCurrent, self.__posCurrent) + event.Skip() + _dbg(indent=0) + + def __OnSpin(self, key): + self.IncrementValue(key, self.__posCurrent) + self.SetFocus() + self.SetInsertionPoint(self.__posCurrent) + self.SetSelection(self.__posCurrent, self.__posSelectTo) + + def __OnSpinUp(self, event): + """ + Event handler for any bound spin button on EVT_SPIN_UP; + causes control to behave as if up arrow was pressed. + """ + _dbg('wxTimeCtrl::OnSpinUp') + self.__OnSpin(WXK_UP) + + + def __OnSpinDown(self, event): + """ + Event handler for any bound spin button on EVT_SPIN_DOWN; + causes control to behave as if down arrow was pressed. + """ + _dbg('wxTimeCtrl::OnSpinDown') + self.__OnSpin(WXK_DOWN) + + + def __OnChangePos(self, event): + """ + Event handler for left mouse click events; this handler + changes limits the selection to the new cell boundaries. + """ + _dbg('wxTimeCtrl::OnChangePos', indent=1) + pos = self.GetInsertionPoint() + self.__SetCurrentCell(pos) + sel_start, sel_to = self.GetSelection() + selection = sel_start != sel_to + if not selection: + if pos in _listDelimPos: # disallow position at end of field: + self.__posCurrent = pos-1 + self.__posSelectTo = self.__posCurrent + self.__bSelection = false + else: + # only allow selection to end of current cell: + if sel_to < pos: self.__posSelectTo = self.__cellStart + elif sel_to > pos: self.__posSelectTo = self.__cellEnd + + _dbg('new pos =', pos, 'select to ', self.__posSelectTo, indent=0) + self.SetSelection(self.__posCurrent, self.__posSelectTo) + event.Skip() + + def __OnDoubleClick(self, event): + """ + Event handler for left double-click mouse events; this handler + causes the cell at the double-click point to be selected. + """ + _dbg('wxTimeCtrl::OnDoubleClick') + pos = self.GetInsertionPoint() + self.__SetCurrentCell(pos) + self.SetSelection(self.__cellStart, self.__cellEnd) + + + def __OnChar(self, event): + """ + This private event handler is the main control point for the wxTimeCtrl. + It governs whether input characters are accepted and if so, handles them + so as to provide appropriate cursor and selection behavior for the control. + """ + _dbg('wxTimeCtrl::OnChar', indent=1) + + # NOTE: Returning without calling event.Skip() eats the event before it + # gets to the text control... + + key = event.GetKeyCode() + text = self.GetValue() + pos = self.GetInsertionPoint() + if pos != self.__posCurrent: + _dbg("insertion point has moved; resetting current cell") + self.__SetCurrentCell(pos) + self.SetSelection(self.__posCurrent, self.__posCurrent) + + sel_start, sel_to = self.GetSelection() + selection = sel_start != sel_to + if not selection: + self.__bSelection = false # predict unselection of entire region + + _dbg('keycode = ', key) + _dbg('pos = ', pos) + + if key in (WXK_DELETE, WXK_BACK): # don't allow deletion + _dbg(indent=0) + return + + elif key == WXK_TAB: # skip to next field if applicable: + _dbg('key == WXK_TAB') + dict_range = _dictCellRange # (for brevity) + dict_start = _dictStartCellPos + if event.ShiftDown(): # tabbing backwords + + ###(NOTE: doesn't work; wxTE_PROCESS_TAB doesn't appear to send us this event!) + + _dbg('event.ShiftDown()') + if pos in dict_range['hour']: # already in 1st field + self.__SetCurrentCell(dict_start['hour']) # ensure we have our member vars set + event.Skip() #then do normal tab processing for the form + + elif pos in dict_range['minute']: # skip to hours field + new_pos = dict_start['hour'] + elif pos in dict_range['second']: # skip to minutes field + new_pos = dict_start['minute'] + elif pos in dict_range['am_pm']: # skip to seconds field + new_pos = dict_start['second'] + + self.__bSelection = true + self.__posSelectTo = new_pos+2 + self.SetInsertionPoint(new_pos) # force insert point to jump to next cell (swallowing TAB) + + else: + if pos in dict_range[self.__lastCell]: # already in last field; ensure we have our members set + self.__SetCurrentCell(dict_start[self.__lastCell]) + _dbg('tab in last cell') + event.Skip() # then do normal tab processing for the form + _dbg(indent=0) + return + + if pos in dict_range['second']: # skip to AM/PM field (if not last cell) + new_pos = dict_start['am_pm'] + elif pos in dict_range['minute']: # skip to seconds field + new_pos = dict_start['second'] + elif pos in dict_range['hour']: # skip to minutes field + new_pos = dict_start['minute'] + + self.__bSelection = true + self.__posSelectTo = new_pos+2 + self.SetInsertionPoint(new_pos) # force insert point to jump to next cell (swallowing TAB) + + elif key == WXK_LEFT: # move left; set insertion point as appropriate: + _dbg('key == WXK_LEFT') + if event.ShiftDown(): # selecting a range... + _dbg('event.ShiftDown()') + if sel_to != pos: + if sel_to - 1 == pos: # allow unselection of position + self.__bSelection = false # predict unselection of entire region + self.__posSelectTo = pos + event.Skip() + if pos in _listStartCellPos: # can't select pass delimiters + _dbg(indent=0) + return + elif pos in _listEndCellPos: # can't use normal selection, because position ends up + # at delimeter + _dbg('set selection from', pos-1, 'to', self.__posCurrent) + self.__posCurrent = pos-1 + self.SetSelection(self.__posCurrent, pos) + _dbg(indent=0) + return + else: + self.__posSelectTo = sel_to - 1 # predict change in selection + event.Skip() # allow selection + + # else... not selecting + if selection: + _dbg('sel_start=', sel_start, 'sel_to=', sel_to, '(Clearing selection)') + self.SetSelection(pos,pos) # clear selection + + if pos == 0: # let base ctrl handle left bound case + event.Skip() + elif pos in _listStartCellPos: # skip (left) OVER the colon/space: + self.SetInsertionPoint(pos-1) # (this causes a EVT_TEXT) + self.__SetCurrentCell(pos-2) # set resulting position as "current" + else: + self.__SetCurrentCell(pos-1) # record the new cell position after the event is finishedI + # and update spinbutton as necessary + event.Skip() # let base control handle event + + elif key == WXK_RIGHT: # move right + _dbg('key == WXK_RIGHT') + if event.ShiftDown(): + _dbg('event.ShiftDown()') + if sel_to in _listDelimPos: # can't select pass delimiters + _dbg(indent=0) + return + elif pos in _listEndCellPos: # can't use normal selection, because position ends up + # at delimeter + _dbg('set selection from', self.__posCurrent, 'to', pos+1) + self.SetSelection(self.__posCurrent, pos+1) + _dbg(indent=0) + return + else: event.Skip() + + else: + if selection: + _dbg('sel_start=', sel_start, 'sel_to=', sel_to, '(Clearing selection)') + pos = sel_start + self.SetSelection(pos,pos) # clear selection + if pos == _dictStartCellPos[self.__lastCell]+1: + _dbg(indent=0) + return # don't allow cursor past last cell + if pos in _listEndCellPos: # skip (right) OVER the colon/space: + self.SetInsertionPoint(pos+1) # (this causes a EVT_TEXT) + self.__SetCurrentCell(pos+2) # set resulting position + else: + self.__SetCurrentCell(pos+1) # record the new cell position after the event is finished + event.Skip() + + elif key in (WXK_UP, WXK_DOWN): + _dbg('key in (WXK_UP, WXK_DOWN)') + self.IncrementValue(key, pos) # increment/decrement as appropriate + + + elif key < WXK_SPACE or key == WXK_DELETE or key > 255: + event.Skip() # non alphanumeric; process normally (Right thing to do?) + + elif chr(key) in ['!', 'c', 'C']: # Special character; sets the value of the control to "now" + _dbg("key == '!'; setting time to 'now'") + now = wxDateTime_Now() + self.SetWxDateTime(now) + _dbg(indent=0) + return + + elif chr(key) in string.digits: # let ChangeValue validate and update current position + self.ChangeValue(chr(key), pos) # handle event (and swallow it) + + elif chr(key) in ('A', 'P', 'M', ' '): # let ChangeValue validate and update current position + self.ChangeValue(chr(key), pos) # handle event (and swallow it) + + else: # disallowed char; swallow event + _dbg(indent=0) + return + _dbg(indent=0) + + + def IncrementValue(self, key, pos): + _dbg('wxTimeCtrl::IncrementValue', key, pos) + text = self.GetValue() + + sel_start, sel_to = self.GetSelection() + selection = sel_start != sel_to + cell_selected = selection and sel_to -1 != pos + + dict_start = _dictStartCellPos # (for brevity) + + # Determine whether we should change the entire cell or just a portion of it: + if( cell_selected + or (pos in _listStartCellPos and not selection) + or (text[pos] == ' ' and text[pos+1] not in ('1', '2')) + or (text[pos] == '9' and text[pos-1] == ' ' and key == WXK_UP) + or (text[pos] == '1' and text[pos-1] == ' ' and key == WXK_DOWN) + or pos >= dict_start['am_pm']): + + _dbg(indent=1) + self.IncrementCell(key, pos) + self.SetInsertionPoint(pos) + _dbg(indent=0) + else: + if key == WXK_UP: inc = 1 + else: inc = -1 + + if pos == dict_start['hour'] and not self.__fmt24hr: + if text[pos] == ' ': digit = '1' # allow ' ' or 1 for 1st digit in 12hr format + else: digit = ' ' + else: + if pos == dict_start['hour']: + if int(text[pos + 1]) >3: mod = 2 # allow for 20-23 + else: mod = 3 # allow 00-19 + elif pos == dict_start['hour'] + 1: + if self.__fmt24hr: + if text[pos - 1] == '2': mod = 4 # allow hours 20-23 + else: mod = 10 # allow hours 00-19 + else: + if text[pos - 1] == '1': mod = 3 # allow hours 10-12 + else: mod = 10 # allow 0-9 + + elif pos in (dict_start['minute'], + dict_start['second']): mod = 6 # allow minutes/seconds 00-59 + else: mod = 10 + + digit = '%d' % ((int(text[pos]) + inc) % mod) + + _dbg(indent=1) + _dbg("new digit = \'%s\'" % digit) + self.ChangeValue(digit, pos) + self.SetInsertionPoint(pos) + _dbg(indent=0) + + + def IncrementCell(self, key, pos): + _dbg('wxTimeCtrl::IncrementCell', key, pos) + self.__SetCurrentCell(pos) # determine current cell + hour, minute, second = self.__hour, self.__minute, self.__second + text = self.GetValue() + dict_start = _dictStartCellPos # (for brevity) + if key == WXK_UP: inc = 1 + else: inc = -1 + + if self.__cellStart == dict_start['am_pm']: + am = text[dict_start['am_pm']:] == 'AM' + if am: hour = hour + 12 + else: hour = hour - 12 + else: + if self.__cellStart == dict_start['hour']: + hour = (hour + inc) % 24 + elif self.__cellStart == dict_start['minute']: + minute = (minute + inc) % 60 + elif self.__cellStart == dict_start['second']: + second = (second + inc) % 60 + + newvalue = '%.2d:%.2d:%.2d' % (hour, minute, second) + + self.__posCurrent = self.__cellStart + _dbg(indent=1) + self.SetValue(newvalue) + _dbg(indent=0) + self.SetSelection(self.__cellStart, self.__cellEnd) + + + def ChangeValue(self, char, pos): + _dbg('wxTimeCtrl::ChangeValue', "\'" + char + "\'", pos) + text = self.GetValue() + + self.__SetCurrentCell(pos) + sel_start, sel_to = self.GetSelection() + self.__posSelectTo = sel_to + self.__bSelection = selection = sel_start != sel_to + cell_selected = selection and sel_to -1 != pos + _dbg('cell_selected =', cell_selected) + + dict_start = _dictStartCellPos # (for brevity) + + if pos in _listDelimPos: return # don't allow change of punctuation + + elif( 0 < pos < dict_start['am_pm'] and char not in string.digits): + return # AM/PM not allowed in this position + + # See if we're changing the hour cell, and validate/update appropriately: + # + hour_start = dict_start['hour'] # (ie. 0) + + if pos == hour_start: # if at 1st position, + if self.__fmt24hr: # and using 24 hour format + if cell_selected: # replace cell contents with hour represented by digit + newtext = '%.2d' % int(char) + text[hour_start+2:] + elif char not in ('0', '1', '2'): # return if digit not 0,1, or 2 + return + else: # relace current position + newtext = char + text[pos+1:] + else: # (12 hour format) + if cell_selected: + if char == ' ': return # can't erase entire cell + elif char == '0': # treat 0 as '12' + newtext = '12' + text[hour_start+2:] + else: # replace cell contents with hour represented by digit + newtext = '%2d' % int(char) + text[hour_start+2:] + else: + if char not in ('1', ' '): # can only type a 1 or space + return + if text[pos+1] not in ('0', '1', '2'): # and then, only if other column is 0,1, or 2 + return + if char == ' ' and text[pos+1] == '0': # and char isn't space if 2nd column is 0 + return + else: # ok; replace current position + newtext = char + text[pos+1:] + if char == ' ': self.SetInsertionPoint(pos+1) # move insert point to legal position + + elif pos == hour_start+1: # if editing 2nd position of hour + if( not self.__fmt24hr # and using 12 hour format + and text[hour_start] == '1' # if 1st char is 1, + and char not in ('0', '1', '2')): # disallow anything bug 0,1, or 2 + return + newtext = text[hour_start] + char + text[hour_start+2:] # else any digit ok + + # Do the same sort of validation for minute and second cells + elif pos in (dict_start['minute'], dict_start['second']): + if cell_selected: # if cell selected, replace value + newtext = text[:pos] + '%.2d' % int(char) + text[pos+2:] + elif int(char) > 5: return # else disallow > 59 for minute and second fields + else: + newtext = text[:pos] + char + text[pos+1:] # else ok + + elif pos in (dict_start['minute']+1, dict_start['second']+1): + newtext = text[:pos] + char + text[pos+1:] # all digits ok for 2nd digit of minute/second + + # Process AM/PM cell + elif pos == dict_start['am_pm']: + if char not in ('A','P'): return # disallow all but A or P as 1st char of column + newtext = text[:pos] + char + text[pos+1:] + else: return # not a valid position + + # update member position vars and set selection to character changed + if not cell_selected: + _dbg('selecting current digit') + self.SetSelection(self.__posCurrent, pos+1) + _dbg(indent=1) + _dbg('newtext=', newtext) + _dbg(indent=0) + self.SetValue(newtext) + self.SetSelection(self.__posCurrent, self.__posSelectTo) + +#---------------------------------------------------------------------------- +# Test jig for wxTimeCtrl: + +if __name__ == '__main__': + import traceback + + class TestPanel(wxPanel): + def __init__(self, parent, id, + pos = wxPyDefaultPosition, size = wxPyDefaultSize, + fmt24hr = 0, test_mx = 0, + style = wxTAB_TRAVERSAL ): + + wxPanel.__init__(self, parent, id, pos, size, style) + + self.test_mx = test_mx + + self.tc = wxTimeCtrl(self, 10, fmt24hr = fmt24hr) + sb = wxSpinButton( self, 20, wxDefaultPosition, wxSize(-1,20), 0 ) + self.tc.BindSpinButton(sb) + + sizer = wxBoxSizer( wxHORIZONTAL ) + sizer.AddWindow( self.tc, 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5 ) + sizer.AddWindow( sb, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 ) + + self.SetAutoLayout( true ) + self.SetSizer( sizer ) + sizer.Fit( self ) + sizer.SetSizeHints( self ) + + EVT_TIMEUPDATE(self, self.tc.GetId(), self.OnTimeChange) + + def OnTimeChange(self, event): + _dbg('OnTimeChange: value = ', event.GetValue()) + wxdt = self.tc.GetWxDateTime() + _dbg('wxdt =', wxdt.GetHour(), wxdt.GetMinute(), wxdt.GetSecond()) + if self.test_mx: + mxdt = self.tc.GetMxDateTime() + _dbg('mxdt =', mxdt.hour, mxdt.minute, mxdt.second) + + + class MyApp(wxApp): + def OnInit(self): + import sys + fmt24hr = '24' in sys.argv + test_mx = 'mx' in sys.argv + try: + frame = wxFrame(NULL, -1, "wxTimeCtrl Test", wxPoint(20,20), wxSize(100,100) ) + panel = TestPanel(frame, -1, wxPoint(-1,-1), fmt24hr=fmt24hr, test_mx = test_mx) + frame.Show(true) + except: + traceback.print_exc() + return false + return true + + try: + app = MyApp(0) + app.MainLoop() + except: + traceback.print_exc() diff --git a/wxPython/wxPython/tools/XRCed/CHANGES b/wxPython/wxPython/tools/XRCed/CHANGES index 89b20ff696..c2fc33f141 100644 --- a/wxPython/wxPython/tools/XRCed/CHANGES +++ b/wxPython/wxPython/tools/XRCed/CHANGES @@ -26,6 +26,7 @@ contrib/src/xrc/xmlrsall.cpp > AddHandler(new wxListCtrlXmlHandler); > #if wxUSE_CHECKLISTBOX +This is fixed in CVS. 0.0.6 ----- diff --git a/wxPython/wxPython/tools/XRCed/params.py b/wxPython/wxPython/tools/XRCed/params.py index 30b0ae9072..10f19daa15 100644 --- a/wxPython/wxPython/tools/XRCed/params.py +++ b/wxPython/wxPython/tools/XRCed/params.py @@ -109,7 +109,7 @@ class ParamBinaryOr(PPanel): class ParamFlag(ParamBinaryOr): values = ['wxTOP', 'wxBOTTOM', 'wxLEFT', 'wxRIGHT', 'wxALL', - 'wxEXPAND', 'wxSHAPED', 'wxALIGN_CENTRE', 'wxALIGN_RIGHT', + 'wxEXPAND', 'wxGROW', 'wxSHAPED', 'wxALIGN_CENTRE', 'wxALIGN_RIGHT', 'wxALIGN_BOTTOM', 'wxALIGN_CENTRE_VERTICAL', 'wxALIGN_CENTRE_HORIZONTAL'] equal = {'wxALIGN_CENTER': 'wxALIGN_CENTRE', diff --git a/wxPython/wxPython/tools/XRCed/xrced.py b/wxPython/wxPython/tools/XRCed/xrced.py index 7d3c4459a5..b2c931ec7c 100644 --- a/wxPython/wxPython/tools/XRCed/xrced.py +++ b/wxPython/wxPython/tools/XRCed/xrced.py @@ -8,8 +8,7 @@ from wxPython.wx import * from wxPython.xrc import * from wxPython.html import wxHtmlWindow from xml.dom import minidom -import os -import getopt +import os, sys, getopt, traceback # Icons import images @@ -27,7 +26,7 @@ else: modernFont = wxFont(10, wxMODERN, wxNORMAL, wxNORMAL) progname = 'XRCed' -version = '0.0.7-3' +version = '0.0.7-5' # Local modules from xxx import * @@ -294,7 +293,7 @@ class PropPage(ParamPage): (control, 0, wxALIGN_CENTER_VERTICAL) ]) self.controlName = control for param in xxx.allParams: - present = param in xxx.params + present = xxx.params.has_key(param) if param in xxx.required: label = wxStaticText(self, paramIDs[param], param + ':', size = (100,-1), name = param) @@ -354,7 +353,7 @@ class StylePage(ParamPage): topSizer = wxStaticBoxSizer(box, wxVERTICAL) sizer = wxFlexGridSizer(len(xxx.styles), 2, 1, 1) for param in xxx.styles: - present = param in xxx.params.keys() + present = xxx.params.has_key(param) check = wxCheckBox(self, paramIDs[param], param + ':', size = (100,-1), name = param) check.SetValue(present) @@ -372,7 +371,7 @@ class StylePage(ParamPage): def SetValues(self, xxx): self.xxx = xxx for param in xxx.styles: - present = param in xxx.params.keys() + present = xxx.params.has_key(param) check = self.checks[param] check.SetValue(present) w = self.controls[param] @@ -388,6 +387,8 @@ class StylePage(ParamPage): class HightLightBox: def __init__(self, pos, size): + if size.x == -1: size.x = 0 + if size.y == -1: size.y = 0 w = testWin.panel l1 = wxWindow(w, -1, pos, wxSize(size.x, 2)) l1.SetBackgroundColour(wxRED) @@ -400,12 +401,12 @@ class HightLightBox: self.lines = [l1, l2, l3, l4] # Move highlight to a new position def Replace(self, pos, size): - self.lines[0].SetDimensions(pos.x, pos.y, size.x, 2, wxSIZE_ALLOW_MINUS_ONE) - self.lines[1].SetDimensions(pos.x, pos.y, 2, size.y, wxSIZE_ALLOW_MINUS_ONE) - self.lines[2].SetDimensions(pos.x + size.x - 2, pos.y, 2, size.y, - wxSIZE_ALLOW_MINUS_ONE) - self.lines[3].SetDimensions(pos.x, pos.y + size.y - 2, size.x, 2, - wxSIZE_ALLOW_MINUS_ONE) + if size.x == -1: size.x = 0 + if size.y == -1: size.y = 0 + self.lines[0].SetDimensions(pos.x, pos.y, size.x, 2) + self.lines[1].SetDimensions(pos.x, pos.y, 2, size.y) + self.lines[2].SetDimensions(pos.x + size.x - 2, pos.y, 2, size.y) + self.lines[3].SetDimensions(pos.x, pos.y + size.y - 2, size.x, 2) # Remove it def Remove(self): map(wxWindow.Destroy, self.lines) @@ -578,21 +579,16 @@ class XML_Tree(wxTreeCtrl): return parentPos + pos # Find window (or sizer) corresponding to a tree item. def FindNodeObject(self, item): + # If top-level, return testWin (or panel its panel) if item == testWin.item: return testWin.panel itemParent = self.GetItemParent(item) - # If top-level, return testWin (or panel if wxFrame) xxx = self.GetPyData(item).treeObject() parentWin = self.FindNodeObject(itemParent) # Top-level sizer? return window's sizer if xxx.isSizer and isinstance(parentWin, wxWindowPtr): return parentWin.GetSizer() # Otherwise get parent's object and it's child - n = 0 # index of sibling - prev = self.GetPrevSibling(item) - while prev.IsOk(): - prev = self.GetPrevSibling(prev) - n += 1 - child = parentWin.GetChildren()[n] + child = parentWin.GetChildren()[self.ItemIndex(item)] # Return window or sizer for sizer items if child.GetClassName() == 'wxSizerItem': if child.IsWindow(): child = child.GetWindow() @@ -615,7 +611,7 @@ class XML_Tree(wxTreeCtrl): self.Apply(xxx, oldItem) #if conf.autoRefresh: if testWin: - if testWin.highLight and not tree.IsHighlatable(oldItem): + if testWin.highLight: testWin.highLight.Remove() self.needUpdate = true status = 'Changes were applied' @@ -642,12 +638,9 @@ class XML_Tree(wxTreeCtrl): # Highlight selected item def HighLight(self, item): self.pendingHighLight = None - if not testWin or self.GetPyData(testWin.item).className \ - not in ['wxDialog', 'wxPanel', 'wxFrame']: - return - # Top-level does not have highlight - if item == testWin.item or item == tree.root: - if testWin.highLight: testWin.highLight.Remove() + # Can highlight only with some top-level windows + if not testWin or self.GetPyData(testWin.item).__class__ \ + not in [xxxDialog, xxxPanel, xxxFrame]: return # If a control from another window is selected, remove highlight if not self.IsHighlatable(item): @@ -673,14 +666,12 @@ class XML_Tree(wxTreeCtrl): 'wxMenuBar', 'wxToolBar']: wxLogMessage('No view for this element (yet)') return - if not treeObj.name: - wxLogError("Can't display a noname element!") - return # Show item in bold - if testWin: + if testWin: # Reset old self.SetItemBold(testWin.item, false) - self.SetItemBold(item) self.CreateTestWin(item) + # Maybe an error occured, so we need to test + if testWin: self.SetItemBold(testWin.item) # Double-click on Linux def OnItemActivated(self, evt): if evt.GetItem() != self.root: @@ -731,6 +722,12 @@ class XML_Tree(wxTreeCtrl): # Remove temporarily from old parent elem = xxx.element + # Give temporary name if not exist + if not xxx.name: + name = 'noname' + elem.setAttribute('name', name) + else: + name = xxx.name parent = elem.parentNode next = elem.nextSibling parent.replaceChild(self.dummyNode, elem) @@ -741,46 +738,57 @@ class XML_Tree(wxTreeCtrl): mainNode.removeChild(elem) dom.unlink() parent.replaceChild(elem, self.dummyNode) + if not xxx.name: + name = 'noname' + elem.removeAttribute('name') memFile.close() # write to wxMemoryFS res = wxXmlResource('') res.Load('memory:xxx.xrc') - if xxx.className == 'wxFrame': - # Create new frame + if xxx.__class__ == xxxFrame: + # Frame can't have many children, + # but it's first child possibly can... + child = tree.GetFirstChild(item, 0)[0] + if child.IsOk() and tree.GetPyData(child).__class__ == xxxPanel: + # Clean-up before recurcive call or error + wxMemoryFSHandler_RemoveFile('xxx.xrc') + wxEndBusyCursor() + self.CreateTestWin(child) + return + # This currently works under GTK, but not under MSW testWin = wxPreFrame() - res.LoadOnFrame(testWin, frame, xxx.name) + res.LoadOnFrame(testWin, frame, name) # Create status bar testWin.CreateStatusBar() testWin.panel = testWin testWin.SetPosition(pos) testWin.Show(true) - elif xxx.className == 'wxPanel': + elif xxx.__class__ == xxxPanel: # Create new frame if not testWin: - testWin = wxFrame(frame, -1, 'Panel: ' + xxx.name, pos=pos) - testWin.panel = res.LoadPanel(testWin, xxx.name) + testWin = wxFrame(frame, -1, 'Panel: ' + name, pos=pos) + testWin.panel = res.LoadPanel(testWin, name) testWin.SetClientSize(testWin.panel.GetSize()) testWin.Show(true) - elif xxx.className == 'wxDialog': - # Create new frame - testWin = res.LoadDialog(None, xxx.name) + elif xxx.__class__ == xxxDialog: + testWin = res.LoadDialog(None, name) testWin.panel = testWin testWin.Layout() testWin.SetPosition(pos) testWin.Show(true) - elif xxx.className == 'wxMenuBar': - testWin = wxFrame(frame, -1, 'MenuBar: ' + xxx.name, pos=pos) + elif xxx.__class__ == xxxMenuBar: + testWin = wxFrame(frame, -1, 'MenuBar: ' + name, pos=pos) testWin.panel = None # Set status bar to display help testWin.CreateStatusBar() - testWin.menuBar = res.LoadMenuBar(xxx.name) + testWin.menuBar = res.LoadMenuBar(name) testWin.SetMenuBar(testWin.menuBar) testWin.Show(true) - elif xxx.className == 'wxToolBar': - testWin = wxFrame(frame, -1, 'ToolBar: ' + xxx.name, pos=pos) + elif xxx.__class__ == xxxToolBar: + testWin = wxFrame(frame, -1, 'ToolBar: ' + name, pos=pos) testWin.panel = None # Set status bar to display help testWin.CreateStatusBar() - testWin.toolBar = res.LoadToolBar(testWin, xxx.name) + testWin.toolBar = res.LoadToolBar(testWin, name) testWin.SetToolBar(testWin.toolBar) testWin.Show(true) wxMemoryFSHandler_RemoveFile('xxx.xrc') @@ -801,13 +809,13 @@ class XML_Tree(wxTreeCtrl): testWin = None # Return item index in parent - def ItemIndex(self, parent, item): - i = 0 - it, cookie = self.GetFirstChild(parent, 0) - while it != item: - i += 1 - it, cookie = self.GetNextChild(parent, cookie) - return i + def ItemIndex(self, item): + n = 0 # index of sibling + prev = self.GetPrevSibling(item) + while prev.IsOk(): + prev = self.GetPrevSibling(prev) + n += 1 + return n # True if next item should be inserted after current (vs. appended to it) def NeedInsert(self, item): @@ -1028,6 +1036,9 @@ class Frame(wxFrame): menu.Append(wxID_PASTE, '&Paste\tCtrl-V', 'Paste from the clipboard') self.ID_DELETE = wxNewId() menu.Append(self.ID_DELETE, '&Delete\tCtrl-D', 'Delete object') +# menu.AppendSeparator() + ID_SELECT = wxNewId() +# menu.Append(ID_SELECT, '&Select', 'Select object') menuBar.Append(menu, '&Edit') menu = wxMenu() @@ -1095,6 +1106,7 @@ class Frame(wxFrame): EVT_MENU(self, wxID_COPY, self.OnCopy) EVT_MENU(self, wxID_PASTE, self.OnPaste) EVT_MENU(self, self.ID_DELETE, self.OnDelete) + EVT_MENU(self, ID_SELECT, self.OnSelect) # View EVT_MENU(self, self.ID_EMBED_PANEL, self.OnEmbedPanel) EVT_MENU(self, self.ID_TEST, self.OnTest) @@ -1118,7 +1130,6 @@ class Frame(wxFrame): splitter = wxSplitterWindow(self, -1, style=wxSP_3DSASH) self.splitter = splitter splitter.SetMinimumPaneSize(100) - # Create tree global tree tree = XML_Tree(splitter, -1) @@ -1281,6 +1292,7 @@ class Frame(wxFrame): # Other events EVT_IDLE(self, self.OnIdle) EVT_CLOSE(self, self.OnCloseWindow) + EVT_LEFT_DOWN(self, self.OnLeftDown) def OnNew(self, evt): self.Clear() @@ -1294,12 +1306,10 @@ class Frame(wxFrame): self.SetStatusText('Loading...') wxYield() wxBeginBusyCursor() - try: - self.Open(path) + if self.Open(path): self.SetStatusText('Data loaded') - except: + else: self.SetStatusText('Failed') - raise wxEndBusyCursor() dlg.Destroy() @@ -1472,7 +1482,7 @@ class Frame(wxFrame): node = tree.GetPyData(nextItem).element parent.element.insertBefore(elem, node) # Inserting before is difficult, se we insert after or first child - index = tree.ItemIndex(parentLeaf, nextItem) + index = tree.ItemIndex(nextItem) newItem = tree.InsertItemBefore(parentLeaf, index, xxx.treeName(), image=xxx.treeImage()) tree.SetPyData(newItem, xxx) @@ -1515,9 +1525,9 @@ class Frame(wxFrame): testWin = None else: # Remove highlight, update testWin - if not tree.IsHighlatable(selected): - if testWin.highLight: testWin.highLight.Remove() - tree.needUpdate = true + if testWin.highLight: + testWin.highLight.Remove() + tree.needUpdate = true xnode = tree.RemoveLeaf(selected) # !!! cloneNode is broken, or something is wrong # self.undo.append(xnode.cloneNode(true)) @@ -1528,6 +1538,17 @@ class Frame(wxFrame): self.modified = true self.SetStatusText('Deleted') + def OnSelect(self, evt): + print >> sys.stderr, 'Xperimental function!' + wxYield() + self.SetCursor(wxCROSS_CURSOR) + self.CaptureMouse() + + def OnLeftDown(self, evt): + pos = evt.GetPosition() + self.SetCursor(wxNullCursor) + self.ReleaseMouse() + def OnEmbedPanel(self, evt): conf.embedPanel = evt.IsChecked() if conf.embedPanel: @@ -1669,7 +1690,7 @@ class Frame(wxFrame): parent.element.insertBefore(elem, node) # !!! There is a different behavious on Win and GTK # !!! On Win InsertItem(parent, parent, ...) inserts at the end. - index = tree.ItemIndex(parentLeaf, nextItem) + index = tree.ItemIndex(nextItem) newItem = tree.InsertItemBefore(parentLeaf, index, xxx.treeName(), image=xxx.treeImage()) # data=wxTreeItemData(xxx)) # does not work @@ -1771,6 +1792,9 @@ class Frame(wxFrame): self.maxIDs[xxxMenuBar] = self.maxIDs[xxxMenu] = self.maxIDs[xxxToolBar] = 0 def Open(self, path): + if not os.path.exists(path): + wxLogError('File does not exists: %s' % path) + return false # Try to read the file try: open(path) @@ -1781,8 +1805,12 @@ class Frame(wxFrame): self.dataFile = path self.SetTitle(progname + ': ' + os.path.basename(path)) except: + # Nice exception printing + inf = sys.exc_info() + wxLogError(traceback.format_exception(inf[0], inf[1], None)[-1]) wxLogError('Error reading file: %s' % path) - raise + return false + return true def Indent(self, node, indent = 0): # Copy child list because it will change soon @@ -1804,7 +1832,8 @@ class Frame(wxFrame): def Save(self, path): try: # Apply changes - self.OnRefresh(wxCommandEvent()) + if tree.selection and panel.IsModified(): + self.OnRefresh(wxCommandEvent()) f = open(path, 'w') # Make temporary copy # !!! We can't clone dom node, it works only once diff --git a/wxPython/wxPython/tools/XRCed/xxx.py b/wxPython/wxPython/tools/XRCed/xxx.py index cf141ee949..378a9269a3 100644 --- a/wxPython/wxPython/tools/XRCed/xxx.py +++ b/wxPython/wxPython/tools/XRCed/xxx.py @@ -129,7 +129,7 @@ class xxxParamContentCheckList(xxxNode): for n in childNodes: self.node.removeChild(n) l = [] - for (s,ch) in value: + for s,ch in value: itemElem = tree.dom.createElement('item') itemElem.setAttribute('checked', str(ch)) itemText = tree.dom.createTextNode(s) @@ -184,7 +184,7 @@ class xxxObject: tag = node.tagName if tag == 'object': continue # do nothing for object children here - if not tag in self.allParams and not tag in self.styles: + if tag not in self.allParams and tag not in self.styles: print 'WARNING: unknown parameter for %s: %s' % \ (self.className, tag) elif tag in self.specials: @@ -511,7 +511,7 @@ class xxxFlexGridSizer(xxxGridSizer): # Special processing for growable* parameters # (they are represented by several nodes) def special(self, tag, node): - if tag not in self.params: + if not self.params.has_key(tag): self.params[tag] = xxxParamMulti() self.params[tag].append(xxxParamInt(node)) def setSpecial(self, param, value): @@ -668,12 +668,12 @@ def IsObject(node): # Make XXX object from some DOM object, selecting correct class def MakeXXXFromDOM(parent, element): try: - return xxxDict[element.getAttribute('class')](parent, element) + klass = xxxDict[element.getAttribute('class')] except KeyError: # Verify that it's not recursive exception - if element.getAttribute('class') not in xxxDict: - print 'ERROR: unknown class:', element.getAttribute('class') + print 'ERROR: unknown class:', element.getAttribute('class') raise + return klass(parent, element) # Make empty DOM element def MakeEmptyDOM(className): diff --git a/wxPython/wxPython/tools/img2png.py b/wxPython/wxPython/tools/img2png.py index 76e7f6db06..02d048a5e9 100644 --- a/wxPython/wxPython/tools/img2png.py +++ b/wxPython/wxPython/tools/img2png.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """ img2png.py -- convert several image formats to PNG format diff --git a/wxPython/wxPython/tools/img2py.py b/wxPython/wxPython/tools/img2py.py index 1a5bd0ea0b..127c80130e 100644 --- a/wxPython/wxPython/tools/img2py.py +++ b/wxPython/wxPython/tools/img2py.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """ img2py.py -- Convert an image to PNG format and embed it in a Python module with appropriate code so it can be loaded into diff --git a/wxPython/wxPython/tools/img2xpm.py b/wxPython/wxPython/tools/img2xpm.py index 2b9a99555c..c4a495b2c0 100644 --- a/wxPython/wxPython/tools/img2xpm.py +++ b/wxPython/wxPython/tools/img2xpm.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """ img2xpm.py -- convert several image formats to XPM