diff options
527 files changed, 14985 insertions, 10204 deletions
diff --git a/.gitignore b/.gitignore index 3b0e21bde3..e5e74f9a3d 100644 --- a/.gitignore +++ b/.gitignore @@ -129,6 +129,7 @@ JAVADOC-GENERATED /release +/make/output.mk /make/emd2exml # Created by "out_build update_primary" @@ -242,6 +243,8 @@ JAVADOC-GENERATED # hipe +/lib/hipe/boot_ebin/hipe.app +/lib/hipe/boot_ebin/hipe.appup /lib/hipe/main/hipe.hrl /lib/hipe/rtl/hipe_literals.hrl diff --git a/Makefile.in b/Makefile.in index 544233f097..e5909aa7f0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,6 +35,9 @@ OTP = OTP-@OTP_REL@ # erts (Erlang RunTime System) version ERTS = erts-@ERTS_VSN@ +# Include verbose output variables +include $(ERL_TOP)/make/output.mk + # ---------------------------------------------------------------------- # @@ -426,57 +429,58 @@ BOOTSTRAP_COMPILER = $(BOOTSTRAP_TOP)/primary_compiler .PHONY: emulator libs kernel stdlib compiler hipe typer syntax_tools preloaded emulator: - cd erts && ERL_TOP=$(ERL_TOP) $(MAKE) NO_START_SCRIPTS=true $(TYPE) FLAVOR=$(FLAVOR) + $(make_verbose)cd erts && ERL_TOP=$(ERL_TOP) $(MAKE) NO_START_SCRIPTS=true $(TYPE) FLAVOR=$(FLAVOR) libs: ifeq ($(OTP_SMALL_BUILD),true) - cd lib && \ + $(make_verbose)cd lib && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt else - cd lib && \ + $(make_verbose)cd lib && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt BUILD_ALL=true endif kernel: - cd lib/kernel && \ + $(make_verbose)cd lib/kernel && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt BUILD_ALL=true stdlib: - cd lib/stdlib && \ + $(make_verbose)cd lib/stdlib && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt BUILD_ALL=true compiler: - cd lib/compiler && \ + $(make_verbose)cd lib/compiler && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt BUILD_ALL=true hipe: - cd lib/hipe && \ + $(make_verbose)cd lib/hipe && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt BUILD_ALL=true typer: - cd lib/typer && \ + $(make_verbose)cd lib/typer && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt BUILD_ALL=true syntax_tools: - cd lib/syntax_tools && \ + $(make_verbose)cd lib/syntax_tools && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt BUILD_ALL=true preloaded: - cd erts/preloaded/src && \ + $(make_verbose)cd erts/preloaded/src && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt BUILD_ALL=true dep depend: - test X"$$ERTS_SKIP_DEPEND" = X"true" || (cd erts/emulator && ERL_TOP=$(ERL_TOP) $(MAKE) generate) - test X"$$ERTS_SKIP_DEPEND" = X"true" || (cd erts/emulator && ERL_TOP=$(ERL_TOP) $(MAKE) depend) - test X"$$ERTS_SKIP_DEPEND" = X"true" || (cd erts/lib_src && ERL_TOP=$(ERL_TOP) $(MAKE) depend) + $(make_verbose) + $(V_at)test X"$$ERTS_SKIP_DEPEND" = X"true" || (cd erts/emulator && ERL_TOP=$(ERL_TOP) $(MAKE) generate) + $(V_at)test X"$$ERTS_SKIP_DEPEND" = X"true" || (cd erts/emulator && ERL_TOP=$(ERL_TOP) $(MAKE) depend) + $(V_at)test X"$$ERTS_SKIP_DEPEND" = X"true" || (cd erts/lib_src && ERL_TOP=$(ERL_TOP) $(MAKE) depend) # Creates "erl" and "erlc" in bootstrap/bin which uses the precompiled # libraries in the bootstrap directory @@ -530,14 +534,15 @@ bootstrap_setup_target: echo $(TARGET) > $(BOOTSTRAP_ROOT)/bootstrap/target secondary_bootstrap_build: - cd lib && \ + $(make_verbose)cd lib && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt SECONDARY_BOOTSTRAP=true secondary_bootstrap_copy: - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe/ebin ; fi - for x in lib/hipe/$(HIPE_BOOTSTRAP_EBIN)/*.beam; do \ + $(make_verbose) + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe/ebin ; fi + $(V_at)for x in lib/hipe/$(HIPE_BOOTSTRAP_EBIN)/*.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/hipe/ebin/$$BN; \ test -f $$TF && \ @@ -547,12 +552,12 @@ secondary_bootstrap_copy: cp $$x $$TF; \ true; \ done - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/orber ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/orber ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/orber/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/orber/include ; fi - for x in lib/parsetools/ebin/*.beam; do \ + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/orber ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/orber ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/orber/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/orber/include ; fi + $(V_at)for x in lib/parsetools/ebin/*.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin/$$BN; \ test -f $$TF && \ @@ -562,8 +567,8 @@ secondary_bootstrap_copy: cp $$x $$TF; \ true; \ done -# cp lib/parsetools/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin - for x in lib/parsetools/include/*.hrl; do \ +# $(V_at)cp lib/parsetools/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin + $(V_at)for x in lib/parsetools/include/*.hrl; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include/$$BN; \ test -f $$TF && \ @@ -573,11 +578,11 @@ secondary_bootstrap_copy: cp $$x $$TF; \ true; \ done -# cp -f lib/parsetools/include/*.hrl $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1 ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1 ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/ebin ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/src ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/src ; fi - for x in lib/asn1/ebin/*.beam; do \ +# $(V_at)cp -f lib/parsetools/include/*.hrl $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1 ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1 ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/ebin ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/src ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/src ; fi + $(V_at)for x in lib/asn1/ebin/*.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/ebin/$$BN; \ test -f $$TF && \ @@ -587,8 +592,8 @@ secondary_bootstrap_copy: cp $$x $$TF; \ true; \ done -# cp lib/asn1/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/ebin - for x in lib/asn1/src/*.[eh]rl; do \ +# $(V_at)cp lib/asn1/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/ebin + $(V_at)for x in lib/asn1/src/*.[eh]rl; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/src/$$BN; \ test -f $$TF && \ @@ -598,8 +603,8 @@ secondary_bootstrap_copy: cp $$x $$TF; \ true; \ done -# cp -f lib/asn1/src/*.erl lib/asn1/src/*.hrl $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/src - for x in lib/orber/include/*.hrl; do \ +# $(V_at)cp -f lib/asn1/src/*.erl lib/asn1/src/*.hrl $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/src + $(V_at)for x in lib/orber/include/*.hrl; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/orber/include/$$BN; \ test -f $$TF && \ @@ -609,9 +614,9 @@ secondary_bootstrap_copy: cp $$x $$TF; \ true; \ done - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl/include ; fi - for x in lib/xmerl/include/*.hrl; do \ + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl/include ; fi + $(V_at)for x in lib/xmerl/include/*.hrl; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl/include/$$BN; \ test -f $$TF && \ @@ -623,15 +628,16 @@ secondary_bootstrap_copy: done tertiary_bootstrap_build: - cd lib && \ + $(make_verbose)cd lib && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \ $(MAKE) opt TERTIARY_BOOTSTRAP=true tertiary_bootstrap_copy: - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/ebin ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/include ; fi - for x in lib/snmp/ebin/*.beam; do \ + $(make_verbose) + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/ebin ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/include ; fi + $(V_at)for x in lib/snmp/ebin/*.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/ebin/$$BN; \ test -f $$TF && \ @@ -641,21 +647,21 @@ tertiary_bootstrap_copy: cp $$x $$TF; \ true; \ done -# cp lib/snmp/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/ebin - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/include ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/ic ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/ic ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/wx ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/wx ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/ebin ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/include ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/test_server ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/test_server ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/test_server/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/test_server/include ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test/include ; fi - for x in lib/ic/ebin/*.beam; do \ +# $(V_at)cp lib/snmp/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/snmp/ebin + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/include ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/ic ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/ic ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/wx ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/wx ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/ebin ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/include ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/test_server ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/test_server ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/test_server/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/test_server/include ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test/include ; fi + $(V_at)for x in lib/ic/ebin/*.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin/$$BN; \ test -f $$TF && \ @@ -665,8 +671,8 @@ tertiary_bootstrap_copy: cp $$x $$TF; \ true; \ done -# cp lib/ic/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin - for x in lib/ic/include/*.idl; do \ +# $(V_at)cp lib/ic/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin + $(V_at)for x in lib/ic/include/*.idl; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include/$$BN; \ test -f $$TF && \ @@ -676,7 +682,7 @@ tertiary_bootstrap_copy: cp $$x $$TF; \ true; \ done - for x in lib/ic/include/*.h; do \ + $(V_at)for x in lib/ic/include/*.h; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include/$$BN; \ test -f $$TF && \ @@ -686,8 +692,8 @@ tertiary_bootstrap_copy: cp $$x $$TF; \ true; \ done -# cp -f lib/ic/include/*.idl lib/ic/include/*.h $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include - for x in lib/sasl/ebin/*.beam; do \ +# $(V_at)cp -f lib/ic/include/*.idl lib/ic/include/*.h $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include + $(V_at)for x in lib/sasl/ebin/*.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin/$$BN; \ test -f $$TF && \ @@ -697,10 +703,10 @@ tertiary_bootstrap_copy: cp $$x $$TF; \ true; \ done -# cp lib/sasl/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools ; fi - if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools/ebin ; fi - for x in lib/syntax_tools/ebin/*.beam; do \ +# $(V_at)cp lib/sasl/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools ; fi + $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools/ebin ; fi + $(V_at)for x in lib/syntax_tools/ebin/*.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools/ebin/$$BN; \ test -f $$TF && \ @@ -710,7 +716,7 @@ tertiary_bootstrap_copy: cp $$x $$TF; \ true; \ done - for x in lib/wx/include/*.hrl; do \ + $(V_at)for x in lib/wx/include/*.hrl; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/wx/include/$$BN; \ test -f $$TF && \ @@ -721,7 +727,7 @@ tertiary_bootstrap_copy: true; \ done # copy wx_object to remove undef behaviour warnings - for x in lib/wx/ebin/wx_object.beam; do \ + $(V_at)for x in lib/wx/ebin/wx_object.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/wx/ebin/$$BN; \ test -f $$TF && \ @@ -733,7 +739,7 @@ tertiary_bootstrap_copy: done # copy test includes to be able to compile tests with bootstrap compiler - for x in lib/test_server/include/*.hrl; do \ + $(V_at)for x in lib/test_server/include/*.hrl; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/test_server/include/$$BN; \ test -f $$TF && \ @@ -744,7 +750,7 @@ tertiary_bootstrap_copy: true; \ done - for x in lib/common_test/include/*.hrl; do \ + $(V_at)for x in lib/common_test/include/*.hrl; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/common_test/include/$$BN; \ test -f $$TF && \ @@ -754,7 +760,7 @@ tertiary_bootstrap_copy: cp $$x $$TF; \ true; \ done -# cp lib/syntax_tools/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools/ebin +# $(V_at)cp lib/syntax_tools/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/syntax_tools/ebin .PHONY: check_recreate_primary_bootstrap recreate_primary_bootstrap @@ -783,7 +789,7 @@ check_recreate_primary_bootstrap: # directories of all applications part of the primary bootstrap. # recreate_primary_bootstrap: - $(ERL_TOP)/otp_build save_bootstrap + $(V_at)$(ERL_TOP)/otp_build save_bootstrap # The first bootstrap build is rarely (never) used in open source, it's # used to build the shipped bootstrap directory. The Open source bootstrap @@ -802,21 +808,21 @@ recreate_primary_bootstrap: primary_bootstrap: @echo "=== Building a bootstrap compiler in $(BOOTSTRAP_ROOT)/bootstrap" - $(MAKE) BOOTSTRAP_ROOT=$(BOOTSTRAP_ROOT) \ + $(V_at)$(MAKE) BOOTSTRAP_ROOT=$(BOOTSTRAP_ROOT) \ ERL_TOP=$(ERL_TOP) \ bootstrap_clean - cd $(ERL_TOP) && \ + $(V_at)cd $(ERL_TOP) && \ $(MAKE) TESTROOT=$(BOOTSTRAP_TOP) \ BOOTSTRAP_TOP=$(BOOTSTRAP_TOP) \ primary_bootstrap_build - cd $(ERL_TOP) && \ + $(V_at)cd $(ERL_TOP) && \ $(MAKE) TESTROOT=$(BOOTSTRAP_TOP) \ BOOTSTRAP_TOP=$(BOOTSTRAP_TOP) \ primary_bootstrap_copy - cd $(ERL_TOP)/erts/start_scripts && \ + $(V_at)cd $(ERL_TOP)/erts/start_scripts && \ $(MAKE) TESTROOT=$(BOOTSTRAP_TOP) \ BOOTSTRAP_TOP=$(BOOTSTRAP_TOP) bootstrap_scripts - test $(BOOTSTRAP_ROOT) = $(ERL_TOP) \ + $(V_at)test $(BOOTSTRAP_ROOT) = $(ERL_TOP) \ || $(ERL_TOP)/otp_build \ copy_primary_bootstrap \ $(BOOTSTRAP_TOP) \ @@ -824,50 +830,52 @@ primary_bootstrap: primary_bootstrap_build: primary_bootstrap_mkdirs primary_bootstrap_compiler \ primary_bootstrap_stdlib - cd lib && $(MAKE) ERLC_FLAGS='-pa $(BOOTSTRAP_COMPILER)/ebin' \ + $(make_verbose)cd lib && $(MAKE) ERLC_FLAGS='-pa $(BOOTSTRAP_COMPILER)/ebin' \ BOOTSTRAP_TOP=$(BOOTSTRAP_TOP) \ BOOTSTRAP=1 opt primary_bootstrap_compiler: - cd lib/compiler && $(MAKE) \ + $(make_verbose)cd lib/compiler && $(MAKE) \ BOOTSTRAP_TOP=$(BOOTSTRAP_TOP) \ BOOTSTRAP_COMPILER=$(BOOTSTRAP_COMPILER) \ BOOTSTRAP=1 \ opt primary_bootstrap_stdlib: - cd lib/stdlib/src && $(MAKE) \ + $(make_verbose)cd lib/stdlib/src && $(MAKE) \ BOOTSTRAP_COMPILER=$(BOOTSTRAP_COMPILER) \ primary_bootstrap_compiler primary_bootstrap_mkdirs: - test -d $(BOOTSTRAP_COMPILER)/egen \ + $(make_verbose) + $(V_at)test -d $(BOOTSTRAP_COMPILER)/egen \ || mkdir -p $(BOOTSTRAP_COMPILER)/egen - test -d $(BOOTSTRAP_COMPILER)/ebin \ + $(V_at)test -d $(BOOTSTRAP_COMPILER)/ebin \ || mkdir -p $(BOOTSTRAP_COMPILER)/ebin - test -d $(BOOTSTRAP_TOP)/lib/kernel/egen \ + $(V_at)test -d $(BOOTSTRAP_TOP)/lib/kernel/egen \ || mkdir -p $(BOOTSTRAP_TOP)/lib/kernel/egen - test -d $(BOOTSTRAP_TOP)/lib/kernel/ebin \ + $(V_at)test -d $(BOOTSTRAP_TOP)/lib/kernel/ebin \ || mkdir -p $(BOOTSTRAP_TOP)/lib/kernel/ebin - test -d $(BOOTSTRAP_TOP)/lib/kernel/include \ + $(V_at)test -d $(BOOTSTRAP_TOP)/lib/kernel/include \ || mkdir -p $(BOOTSTRAP_TOP)/lib/kernel/include - test -d $(BOOTSTRAP_TOP)/lib/stdlib/egen \ + $(V_at)test -d $(BOOTSTRAP_TOP)/lib/stdlib/egen \ || mkdir -p $(BOOTSTRAP_TOP)/lib/stdlib/egen - test -d $(BOOTSTRAP_TOP)/lib/stdlib/ebin \ + $(V_at)test -d $(BOOTSTRAP_TOP)/lib/stdlib/ebin \ || mkdir -p $(BOOTSTRAP_TOP)/lib/stdlib/ebin - test -d $(BOOTSTRAP_TOP)/lib/stdlib/include \ + $(V_at)test -d $(BOOTSTRAP_TOP)/lib/stdlib/include \ || mkdir -p $(BOOTSTRAP_TOP)/lib/stdlib/include - test -d $(BOOTSTRAP_TOP)/lib/compiler/egen \ + $(V_at)test -d $(BOOTSTRAP_TOP)/lib/compiler/egen \ || mkdir -p $(BOOTSTRAP_TOP)/lib/compiler/egen - test -d $(BOOTSTRAP_TOP)/lib/compiler/ebin \ + $(V_at)test -d $(BOOTSTRAP_TOP)/lib/compiler/ebin \ || mkdir -p $(BOOTSTRAP_TOP)/lib/compiler/ebin - test -d $(BOOTSTRAP_TOP)/lib/orber/include \ + $(V_at)test -d $(BOOTSTRAP_TOP)/lib/orber/include \ || mkdir -p $(BOOTSTRAP_TOP)/lib/orber/include primary_bootstrap_copy: - cp -f lib/kernel/include/*.hrl $(BOOTSTRAP_TOP)/lib/kernel/include - cp -f lib/stdlib/include/*.hrl $(BOOTSTRAP_TOP)/lib/stdlib/include - cp -f lib/orber/include/* $(BOOTSTRAP_TOP)/lib/orber/include + $(make_verbose) + $(V_at)cp -f lib/kernel/include/*.hrl $(BOOTSTRAP_TOP)/lib/kernel/include + $(V_at)cp -f lib/stdlib/include/*.hrl $(BOOTSTRAP_TOP)/lib/stdlib/include + $(V_at)cp -f lib/orber/include/* $(BOOTSTRAP_TOP)/lib/orber/include # To remove modules left by the bootstrap building, but leave (restore) # the modules in kernel which are needed for an emulator build @@ -1000,9 +1008,10 @@ eclean: # bootstrap_root_clean: - rm -f $(BOOTSTRAP_ROOT)/bootstrap/lib/*/ebin/*.beam - rm -f $(BOOTSTRAP_ROOT)/bootstrap/lib/*/include/*.hrl - rm -f $(BOOTSTRAP_ROOT)/bootstrap/bin/*.* + $(make_verbose) + $(V_at)rm -f $(BOOTSTRAP_ROOT)/bootstrap/lib/*/ebin/*.beam + $(V_at)rm -f $(BOOTSTRAP_ROOT)/bootstrap/lib/*/include/*.hrl + $(V_at)rm -f $(BOOTSTRAP_ROOT)/bootstrap/bin/*.* # $(ERL_TOP)/bootstrap *should* equal $(BOOTSTRAP_TOP) # @@ -1010,15 +1019,16 @@ bootstrap_root_clean: # extra safety precaution (we would really make a mess if # $(BOOTSTRAP_TOP) for some reason should be empty). bootstrap_clean: - rm -f $(ERL_TOP)/bootstrap/lib/*/ebin/*.beam - rm -f $(ERL_TOP)/bootstrap/lib/*/ebin/*.app - rm -f $(ERL_TOP)/bootstrap/lib/*/egen/* - rm -f $(ERL_TOP)/bootstrap/lib/*/include/*.hrl - rm -f $(ERL_TOP)/bootstrap/primary_compiler/ebin/* - rm -f $(ERL_TOP)/bootstrap/primary_compiler/egen/* - rm -f $(ERL_TOP)/bootstrap/bin/*.* - rm -f $(KERNEL_PRELOAD:%=$(ERL_TOP)/lib/kernel/ebin/%.beam) - test $(BOOTSTRAP_ROOT) = $(ERL_TOP) \ + $(make_verbose) + $(V_at)rm -f $(ERL_TOP)/bootstrap/lib/*/ebin/*.beam + $(V_at)rm -f $(ERL_TOP)/bootstrap/lib/*/ebin/*.app + $(V_at)rm -f $(ERL_TOP)/bootstrap/lib/*/egen/* + $(V_at)rm -f $(ERL_TOP)/bootstrap/lib/*/include/*.hrl + $(V_at)rm -f $(ERL_TOP)/bootstrap/primary_compiler/ebin/* + $(V_at)rm -f $(ERL_TOP)/bootstrap/primary_compiler/egen/* + $(V_at)rm -f $(ERL_TOP)/bootstrap/bin/*.* + $(V_at)rm -f $(KERNEL_PRELOAD:%=$(ERL_TOP)/lib/kernel/ebin/%.beam) + $(V_at)test $(BOOTSTRAP_ROOT) = $(ERL_TOP) \ || $(MAKE) BOOTSTRAP_ROOT=$(BOOTSTRAP_ROOT) bootstrap_root_clean # ---------------------------------------------------------------------- diff --git a/aclocal.m4 b/aclocal.m4 index 9578cd35c4..918e30a886 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1849,6 +1849,31 @@ case $erl_gethrvtime in esac ])dnl +dnl ---------------------------------------------------------------------- +dnl +dnl LM_TRY_ENABLE_CFLAG +dnl +dnl +dnl Tries a CFLAG and sees if it can be enabled without compiler errors +dnl $1: textual cflag to add +dnl $2: variable to store the modified CFLAG in +dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) +dnl +dnl +AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) + saved_CFLAGS=$CFLAGS; + CFLAGS="$1 $$2"; + AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue"; then + AC_MSG_RESULT([yes]) + AS_VAR_SET($2, "$1 $$2") + else + AC_MSG_RESULT([no]) + fi +]) + dnl ERL_TRY_LINK_JAVA(CLASSES, FUNCTION-BODY dnl [ACTION_IF_FOUND [, ACTION-IF-NOT-FOUND]]) dnl Freely inspired by AC_TRY_LINK. (Maybe better to create a diff --git a/bootstrap/lib/compiler/ebin/compile.beam b/bootstrap/lib/compiler/ebin/compile.beam Binary files differindex d2e93214d1..373c0afc0c 100644 --- a/bootstrap/lib/compiler/ebin/compile.beam +++ b/bootstrap/lib/compiler/ebin/compile.beam diff --git a/bootstrap/lib/compiler/ebin/compiler.app b/bootstrap/lib/compiler/ebin/compiler.app index a4a7dec7c3..733120aa9e 100644 --- a/bootstrap/lib/compiler/ebin/compiler.app +++ b/bootstrap/lib/compiler/ebin/compiler.app @@ -57,7 +57,6 @@ sys_core_dsetel, sys_core_fold, sys_core_inline, - sys_expand_pmod, sys_pre_attributes, sys_pre_expand, v3_codegen, diff --git a/bootstrap/lib/compiler/ebin/core_lint.beam b/bootstrap/lib/compiler/ebin/core_lint.beam Binary files differindex 4dcf3868aa..bc18af0f7c 100644 --- a/bootstrap/lib/compiler/ebin/core_lint.beam +++ b/bootstrap/lib/compiler/ebin/core_lint.beam diff --git a/bootstrap/lib/compiler/ebin/sys_core_fold.beam b/bootstrap/lib/compiler/ebin/sys_core_fold.beam Binary files differindex 7637853aea..a4529cdd39 100644 --- a/bootstrap/lib/compiler/ebin/sys_core_fold.beam +++ b/bootstrap/lib/compiler/ebin/sys_core_fold.beam diff --git a/bootstrap/lib/compiler/ebin/sys_expand_pmod.beam b/bootstrap/lib/compiler/ebin/sys_expand_pmod.beam Binary files differdeleted file mode 100644 index 17a208a769..0000000000 --- a/bootstrap/lib/compiler/ebin/sys_expand_pmod.beam +++ /dev/null diff --git a/bootstrap/lib/compiler/ebin/sys_pre_expand.beam b/bootstrap/lib/compiler/ebin/sys_pre_expand.beam Binary files differindex 4c8547ea27..60933730c3 100644 --- a/bootstrap/lib/compiler/ebin/sys_pre_expand.beam +++ b/bootstrap/lib/compiler/ebin/sys_pre_expand.beam diff --git a/bootstrap/lib/kernel/ebin/application.beam b/bootstrap/lib/kernel/ebin/application.beam Binary files differindex ef1cb50098..3287c3f132 100644 --- a/bootstrap/lib/kernel/ebin/application.beam +++ b/bootstrap/lib/kernel/ebin/application.beam diff --git a/bootstrap/lib/kernel/ebin/error_handler.beam b/bootstrap/lib/kernel/ebin/error_handler.beam Binary files differindex 45dfcee12b..740ba28f72 100644 --- a/bootstrap/lib/kernel/ebin/error_handler.beam +++ b/bootstrap/lib/kernel/ebin/error_handler.beam diff --git a/bootstrap/lib/kernel/ebin/file.beam b/bootstrap/lib/kernel/ebin/file.beam Binary files differindex 3d3da9c344..b66197b778 100644 --- a/bootstrap/lib/kernel/ebin/file.beam +++ b/bootstrap/lib/kernel/ebin/file.beam diff --git a/bootstrap/lib/kernel/ebin/file_io_server.beam b/bootstrap/lib/kernel/ebin/file_io_server.beam Binary files differindex b5380a69cf..2c617ae7e4 100644 --- a/bootstrap/lib/kernel/ebin/file_io_server.beam +++ b/bootstrap/lib/kernel/ebin/file_io_server.beam diff --git a/bootstrap/lib/kernel/ebin/group.beam b/bootstrap/lib/kernel/ebin/group.beam Binary files differindex 2a7e46faf5..4338bb4687 100644 --- a/bootstrap/lib/kernel/ebin/group.beam +++ b/bootstrap/lib/kernel/ebin/group.beam diff --git a/bootstrap/lib/kernel/ebin/ram_file.beam b/bootstrap/lib/kernel/ebin/ram_file.beam Binary files differindex 87af871756..74fcc898c3 100644 --- a/bootstrap/lib/kernel/ebin/ram_file.beam +++ b/bootstrap/lib/kernel/ebin/ram_file.beam diff --git a/bootstrap/lib/kernel/include/file.hrl b/bootstrap/lib/kernel/include/file.hrl index bf97173122..69aec1ee36 100644 --- a/bootstrap/lib/kernel/include/file.hrl +++ b/bootstrap/lib/kernel/include/file.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2011. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -22,32 +22,37 @@ %%-------------------------------------------------------------------------- -record(file_info, - {size :: non_neg_integer(), % Size of file in bytes. - type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink', - access :: 'read' | 'write' | 'read_write' | 'none', - atime :: file:date_time() | integer(), % The local time the file was last read: - % {{Year, Mon, Day}, {Hour, Min, Sec}}. - % atime, ctime, mtime may also be unix epochs() - mtime :: file:date_time() | integer(), % The local time the file was last written. - ctime :: file:date_time() | integer(), % The interpretation of this time field - % is dependent on operating system. - % On Unix it is the last time the file - % or the inode was changed. On Windows, - % it is the creation time. - mode :: integer(), % File permissions. On Windows, - % the owner permissions will be - % duplicated for group and user. - links :: non_neg_integer(), % Number of links to the file (1 if the - % filesystem doesn't support links). - major_device :: integer(), % Identifies the file system (Unix), - % or the drive number (A: = 0, B: = 1) - % (Windows). - %% The following are Unix specific. - %% They are set to zero on other operating systems. - minor_device :: integer(), % Only valid for devices. - inode :: integer(), % Inode number for file. - uid :: integer(), % User id for owner. - gid :: integer()}). % Group id for owner. + {size :: non_neg_integer(), % Size of file in bytes. + type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink', + access :: 'read' | 'write' | 'read_write' | 'none', + atime :: file:date_time() | non_neg_integer(), + % The local time the file was last read: + % {{Year, Mon, Day}, {Hour, Min, Sec}}. + % atime, ctime, mtime may also be unix epochs() + mtime :: file:date_time() | non_neg_integer(), + % The local time the file was last written. + ctime :: file:date_time() | non_neg_integer(), + % The interpretation of this time field + % is dependent on operating system. + % On Unix it is the last time the file + % or the inode was changed. On Windows, + % it is the creation time. + mode :: non_neg_integer(), % File permissions. On Windows, + % the owner permissions will be + % duplicated for group and user. + links :: non_neg_integer(), + % Number of links to the file (1 if the + % filesystem doesn't support links). + major_device :: non_neg_integer(), + % Identifies the file system (Unix), + % or the drive number (A: = 0, B: = 1) + % (Windows). + %% The following are Unix specific. + %% They are set to zero on other operating systems. + minor_device :: non_neg_integer(), % Only valid for devices. + inode :: non_neg_integer(), % Inode number for file. + uid :: non_neg_integer(), % User id for owner. + gid :: non_neg_integer()}). % Group id for owner. -record(file_descriptor, diff --git a/bootstrap/lib/stdlib/ebin/edlin.beam b/bootstrap/lib/stdlib/ebin/edlin.beam Binary files differindex 3eac2b2000..bb586c5f6a 100644 --- a/bootstrap/lib/stdlib/ebin/edlin.beam +++ b/bootstrap/lib/stdlib/ebin/edlin.beam diff --git a/bootstrap/lib/stdlib/ebin/epp.beam b/bootstrap/lib/stdlib/ebin/epp.beam Binary files differindex a3a86afce9..168bd3e878 100644 --- a/bootstrap/lib/stdlib/ebin/epp.beam +++ b/bootstrap/lib/stdlib/ebin/epp.beam diff --git a/bootstrap/lib/stdlib/ebin/erl_lint.beam b/bootstrap/lib/stdlib/ebin/erl_lint.beam Binary files differindex 3b330266f3..b387a2c62c 100644 --- a/bootstrap/lib/stdlib/ebin/erl_lint.beam +++ b/bootstrap/lib/stdlib/ebin/erl_lint.beam diff --git a/bootstrap/lib/stdlib/ebin/erl_parse.beam b/bootstrap/lib/stdlib/ebin/erl_parse.beam Binary files differindex 144d485b7f..ee3064f9e1 100644 --- a/bootstrap/lib/stdlib/ebin/erl_parse.beam +++ b/bootstrap/lib/stdlib/ebin/erl_parse.beam diff --git a/bootstrap/lib/stdlib/ebin/erl_pp.beam b/bootstrap/lib/stdlib/ebin/erl_pp.beam Binary files differindex 33b1962d20..52759b0ea5 100644 --- a/bootstrap/lib/stdlib/ebin/erl_pp.beam +++ b/bootstrap/lib/stdlib/ebin/erl_pp.beam diff --git a/bootstrap/lib/stdlib/ebin/erl_scan.beam b/bootstrap/lib/stdlib/ebin/erl_scan.beam Binary files differindex 7614fe72d8..56d710de2a 100644 --- a/bootstrap/lib/stdlib/ebin/erl_scan.beam +++ b/bootstrap/lib/stdlib/ebin/erl_scan.beam diff --git a/bootstrap/lib/stdlib/ebin/otp_internal.beam b/bootstrap/lib/stdlib/ebin/otp_internal.beam Binary files differindex cff55cb641..84feea2c66 100644 --- a/bootstrap/lib/stdlib/ebin/otp_internal.beam +++ b/bootstrap/lib/stdlib/ebin/otp_internal.beam diff --git a/bootstrap/lib/stdlib/ebin/queue.beam b/bootstrap/lib/stdlib/ebin/queue.beam Binary files differindex 688c411798..8907a03b57 100644 --- a/bootstrap/lib/stdlib/ebin/queue.beam +++ b/bootstrap/lib/stdlib/ebin/queue.beam diff --git a/configure.in b/configure.in index e906c17ecc..c0994245e8 100644 --- a/configure.in +++ b/configure.in @@ -354,6 +354,21 @@ elif test X"$TMPSYS" '=' X"Darwin-i386"; then export LDFLAGS fi +AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) + +DEFAULT_VERBOSITY=1 +if test X${enable_silent_rules} = Xyes; then + DEFAULT_VERBOSITY=0 +fi +AC_SUBST(DEFAULT_VERBOSITY) + if test X${enable_m64_build} = Xyes; then enable_hipe=no CFLAGS="-m64 $CFLAGS" @@ -378,7 +393,7 @@ AC_SUBST(NATIVE_LIBS_ENABLED) export ERL_TOP AC_CONFIG_SUBDIRS(lib erts) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile make/output.mk]) AC_CONFIG_FILES([make/emd2exml], [chmod +x make/emd2exml]) AC_OUTPUT diff --git a/erts/Makefile.in b/erts/Makefile.in index 5df6d71ef3..0bcb784972 100644 --- a/erts/Makefile.in +++ b/erts/Makefile.in @@ -19,6 +19,7 @@ .NOTPARALLEL: +include $(ERL_TOP)/make/output.mk include $(ERL_TOP)/make/target.mk include vsn.mk @@ -38,11 +39,11 @@ all: smp opt .PHONY: docs docs: - ( cd doc/src && $(MAKE) $@ ) + $(V_at)( cd doc/src && $(MAKE) $@ ) .PHONY: debug opt clean debug opt clean: - for d in emulator $(ERTSDIRS); do \ + $(V_at)for d in emulator $(ERTSDIRS); do \ if test -d $$d; then \ ( cd $$d && $(MAKE) $@ FLAVOR=$(FLAVOR) ) || exit $$? ; \ fi ; \ @@ -55,7 +56,7 @@ debug opt clean: .PHONY: $(EXTRA_FLAVORS) $(EXTRA_FLAVORS): - ( cd emulator && $(MAKE) opt FLAVOR=$@ ) + $(V_at)( cd emulator && $(MAKE) opt FLAVOR=$@ ) # Make erl script and erlc in $(ERL_TOP)/bin which runs the compiled version # Note that erlc is not a script and requires extra handling on cygwin. @@ -67,7 +68,7 @@ $(EXTRA_FLAVORS): .PHONY: local_setup local_setup: @cd start_scripts && $(MAKE) - @echo `ls $(ERL_TOP)/bin/` + $(V_colon)@echo `ls $(ERL_TOP)/bin/` @rm -f $(ERL_TOP)/bin/erl $(ERL_TOP)/bin/erlc $(ERL_TOP)/bin/cerl \ $(ERL_TOP)/bin/erl.exe $(ERL_TOP)/bin/erlc.exe \ $(ERL_TOP)/bin/escript $(ERL_TOP)/bin/escript.exe \ @@ -128,10 +129,10 @@ makefiles: .PHONY: release release: - for f in plain $(EXTRA_FLAVORS) ; do \ + $(V_at)for f in plain $(EXTRA_FLAVORS) ; do \ ( cd emulator && $(MAKE) release FLAVOR=$$f ) \ done - for d in $(ERTSDIRS) $(XINSTDIRS); do \ + $(V_at)for d in $(ERTSDIRS) $(XINSTDIRS); do \ if test -d $$d; then \ ( cd $$d && $(MAKE) $@ ) || exit $$? ; \ fi ; \ @@ -139,4 +140,4 @@ release: .PHONY: release_docs release_docs: - ( cd doc/src && $(MAKE) $@ ) + $(V_at)( cd doc/src && $(MAKE) $@ ) diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 index 9578cd35c4..918e30a886 100644 --- a/erts/aclocal.m4 +++ b/erts/aclocal.m4 @@ -1849,6 +1849,31 @@ case $erl_gethrvtime in esac ])dnl +dnl ---------------------------------------------------------------------- +dnl +dnl LM_TRY_ENABLE_CFLAG +dnl +dnl +dnl Tries a CFLAG and sees if it can be enabled without compiler errors +dnl $1: textual cflag to add +dnl $2: variable to store the modified CFLAG in +dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) +dnl +dnl +AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) + saved_CFLAGS=$CFLAGS; + CFLAGS="$1 $$2"; + AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue"; then + AC_MSG_RESULT([yes]) + AS_VAR_SET($2, "$1 $$2") + else + AC_MSG_RESULT([no]) + fi +]) + dnl ERL_TRY_LINK_JAVA(CLASSES, FUNCTION-BODY dnl [ACTION_IF_FOUND [, ACTION-IF-NOT-FOUND]]) dnl Freely inspired by AC_TRY_LINK. (Maybe better to create a diff --git a/erts/configure.in b/erts/configure.in index 3256b0cb59..a0c5cab181 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -537,6 +537,9 @@ else fi if test "x$GCC" = xyes; then + # Treat certain GCC warnings as errors + LM_TRY_ENABLE_CFLAG([-Werror=return-type], [WERRORFLAGS]) + # until the emulator can handle this, I suggest we turn it off! #WFLAGS="-Wall -Wshadow -Wcast-qual -Wmissing-declarations" WFLAGS="-Wall -Wstrict-prototypes" @@ -559,11 +562,13 @@ if test "x$GCC" = xyes; then CFLAGS=$saved_CFLAGS else WFLAGS="" + WERRORFLAGS="" fi dnl DEBUG_FLAGS is obsolete (I hope) AC_SUBST(DEBUG_FLAGS) AC_SUBST(DEBUG_CFLAGS) AC_SUBST(WFLAGS) +AC_SUBST(WERRORFLAGS) AC_SUBST(CFLAG_RUNTIME_LIBRARY_PATH) AC_CHECK_SIZEOF(void *) # Needed for ARCH and smp checks below @@ -735,12 +740,8 @@ esac AC_MSG_CHECKING(if VM has to be linked with Carbon framework) case $ARCH-$OPSYS in - amd64-darwin*) - LIBCARBON= - AC_MSG_RESULT([no]) - ;; *-darwin*) - LIBCARBON="-framework Carbon " + LIBCARBON="-framework Carbon -framework Cocoa" AC_MSG_RESULT([yes]) ;; *) @@ -826,6 +827,12 @@ if test -z "$FOP"; then AC_MSG_WARN([No 'fop' command found: going to generate placeholder PDF files]) fi +AC_CHECK_PROGS(XMLLINT, xmllint) +if test -z "$XMLLINT"; then + echo "xmllint" >> doc/CONF_INFO + AC_MSG_WARN([No 'xmllint' command found: can't run the xmllint target for the documentation]) +fi + dnl dnl We can live with Solaris /usr/ucb/install dnl @@ -1075,8 +1082,45 @@ fi AC_SUBST(ERTS_BUILD_SMP_EMU) -AC_CHECK_FUNCS([posix_fadvise]) +AC_CHECK_FUNCS([posix_fadvise, fallocate]) +AC_CHECK_HEADERS([linux/falloc.h]) +dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it. +dnl * It may also be broken in AIX. +AC_CACHE_CHECK([whether posix_fallocate() works],i_cv_posix_fallocate_works,[ + AC_TRY_RUN([ + #if !defined(__sun) && !defined(__sun__) + #define _XOPEN_SOURCE 600 + #endif + #include <stdio.h> + #include <stdlib.h> + #include <fcntl.h> + #include <unistd.h> + #if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)) + possibly broken posix_fallocate + #endif + int main() { + int fd = creat("conftest.temp", 0600); + int ret; + if (-1 == fd) { + perror("creat()"); + return 2; + } + ret = posix_fallocate(fd, 1024, 1024) < 0 ? 1 : 0; + unlink("conftest.temp"); + return ret; + } + ], [ + i_cv_posix_fallocate_works=yes + ], [ + i_cv_posix_fallocate_works=no + ], [ + i_cv_posix_fallocate_works=no + ]) +]) +if test $i_cv_posix_fallocate_works = yes; then + AC_DEFINE(HAVE_POSIX_FALLOCATE,, Define if you have a working posix_fallocate()) +fi # # Figure out if the emulator should use threads. The default is set above @@ -4461,7 +4505,7 @@ dnl needs to be rebuilt. dnl AC_DEFINE_UNQUOTED(ERTS_EMU_CMDLINE_FLAGS, -"$STATIC_CFLAGS $CFLAGS $DEBUG_CFLAGS $EMU_THR_DEFS $DEFS $WFLAGS", +"$STATIC_CFLAGS $CFLAGS $DEBUG_CFLAGS $EMU_THR_DEFS $DEFS $WERRORFLAGS $WFLAGS", [The only reason ERTS_EMU_CMDLINE_FLAGS exists is to force modification of config.h when the emulator command line flags are modified by configure]) dnl ---------------------------------------------------------------------- @@ -4524,6 +4568,10 @@ AH_BOTTOM([ #endif ]) +if test "x$GCC" = xyes; then + CFLAGS="$WERRORFLAGS $CFLAGS" +fi + dnl ---------------------------------------------------------------------- dnl Output the result. dnl ---------------------------------------------------------------------- diff --git a/erts/doc/src/absform.xml b/erts/doc/src/absform.xml index 4455d0ac92..d036b4c7fb 100644 --- a/erts/doc/src/absform.xml +++ b/erts/doc/src/absform.xml @@ -290,13 +290,6 @@ <item>If E is <c><![CDATA[fun Fc_1 ; ... ; Fc_k end]]></c> where each <c><![CDATA[Fc_i]]></c> is a function clause then Rep(E) = <c><![CDATA[{'fun',LINE,{clauses,[Rep(Fc_1), ..., Rep(Fc_k)]}}]]></c>.</item> - <item>If E is <c><![CDATA[query [E_0 || W_1, ..., W_k] end]]></c>, - where each <c><![CDATA[W_i]]></c> is a generator or a filter, then - Rep(E) = <c><![CDATA[{'query',LINE,{lc,LINE,Rep(E_0),[Rep(W_1), ..., Rep(W_k)]}}]]></c>. - For Rep(W), see below.</item> - <item>If E is <c><![CDATA[E_0.Field]]></c>, a Mnesia record access - inside a query, then - Rep(E) = <c><![CDATA[{record_field,LINE,Rep(E_0),Rep(Field)}]]></c>.</item> <item>If E is <c><![CDATA[( E_0 )]]></c>, then Rep(E) = <c><![CDATA[Rep(E_0)]]></c>, i.e., parenthesized expressions cannot be distinguished from their bodies.</item> diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml index 99f2466d79..37c7f3466b 100644 --- a/erts/doc/src/erl.xml +++ b/erts/doc/src/erl.xml @@ -479,7 +479,7 @@ <tag><marker id="async_thread_pool_size"><c><![CDATA[+A size]]></c></marker></tag> <item> <p>Sets the number of threads in async thread pool, valid range - is 0-1024. Default is 0.</p> + is 0-1024. If thread support is available, the default is 10.</p> </item> <tag><c><![CDATA[+B [c | d | i]]]></c></tag> <item> @@ -582,7 +582,7 @@ <seealso marker="erts_alloc">erts_alloc(3)</seealso> for further information.</p> </item> - <tag><c><![CDATA[+n Behavior]]></c></tag> + <tag><marker id="+n"/><c><![CDATA[+n Behavior]]></c></tag> <item> <p>Control behavior of signals to ports.</p> <p>As of OTP-R16 signals to ports are truly asynchronously @@ -615,7 +615,7 @@ debugging.</item> </taglist> </item> - <tag><marker id="max_processes"><c><![CDATA[+P Number]]></c></marker></tag> + <tag><marker id="+P"/><marker id="max_processes"><c><![CDATA[+P Number]]></c></marker></tag> <item> <p>Sets the maximum number of simultaneously existing processes for this system. Valid range for <c>Number</c> is <c>[1024-134217727]</c></p> @@ -627,7 +627,7 @@ <seealso marker="erlang#system_info_process_limit">erlang:system_info(process_limit)</seealso>.</p> <p>The default value is <c>262144</c></p> </item> - <tag><marker id="max_ports"><c><![CDATA[+Q Number]]></c></marker></tag> + <tag><marker id="+Q"/><marker id="max_ports"><c><![CDATA[+Q Number]]></c></marker></tag> <item> <p>Sets the maximum number of simultaneously existing ports for this system. Valid range for <c>Number</c> is <c>[1024-134217727]</c></p> @@ -672,7 +672,7 @@ <item> <p>Limits the amount of reader groups used by read/write locks optimized for read operations in the Erlang runtime system. By - default the reader groups limit equals 8.</p> + default the reader groups limit equals 64.</p> <p>When the amount of schedulers is less than or equal to the reader groups limit, each scheduler has its own reader group. When the amount of schedulers is larger than the reader groups limit, @@ -710,7 +710,24 @@ <taglist> <tag><marker id="+sbt"><c>+sbt BindType</c></marker></tag> <item> - <p>Set scheduler bind type. Currently valid <c>BindType</c>s: + <p>Set scheduler bind type.</p> + <p>Schedulers can also be bound using the + <seealso marker="#+stbt">+stbt</seealso> flag. The only difference + between these two flags is how the following errors are handled:</p> + <list> + <item>Binding of schedulers is not supported on the specific + platform.</item> + <item>No available CPU topology. That is the runtime system + was not able to automatically detected the CPU topology, and + no <seealso marker="#+sct">user defined CPU topology</seealso> + was set.</item> + </list> + <p>If any of these errors occur when <c>+sbt</c> has been passed, + the runtime system will print an error message, and refuse to + start. If any of these errors occur when <c>+stbt</c> has been + passed, the runtime system will silently ignore the error, and + start up using unbound schedulers.</p> + <p>Currently valid <c>BindType</c>s: </p> <taglist> <tag><c>u</c></tag> @@ -960,6 +977,14 @@ <p>For more information, see <seealso marker="erlang#system_info_cpu_topology">erlang:system_info(cpu_topology)</seealso>.</p> </item> + <tag><marker id="+stbt"><c>+stbt BindType</c></marker></tag> + <item> + <p>Try to set scheduler bind type. The same as the + <seealso marker="#+sbt">+sbt</seealso> flag with the exception of + how some errors are handled. For more information, see the + documentation of the <seealso marker="#+sbt">+sbt</seealso> flag. + </p> + </item> <tag><marker id="+sws"><c>+sws default|legacy|proposal</c></marker></tag> <item> <p>Set scheduler wakeup strategy. Default is <c>legacy</c> (has been diff --git a/erts/doc/src/erl_dist_protocol.xml b/erts/doc/src/erl_dist_protocol.xml index 6c725fc82d..0252187be5 100644 --- a/erts/doc/src/erl_dist_protocol.xml +++ b/erts/doc/src/erl_dist_protocol.xml @@ -547,13 +547,289 @@ If Result > 0, the packet only consists of [119, Result]. --> </section> - + <marker id="distribution_handshake"/> <section> - <title>Handshake</title> - <p> - The handshake is discussed in detail in the internal documentation for - the kernel (Erlang) application. - </p> + <title>Distribution Handshake</title> + <p> + This section describes the distribution handshake protocol + introduced in the OTP-R6 release of Erlang/OTP. This + description was previously located in + <c>$ERL_TOP/lib/kernel/internal_doc/distribution_handshake.txt</c>, + and has more or less been copied and "formatted" here. It has been + more or less unchanged since the year 1999, but the handshake + should not have changed much since then either. + </p> + <section> + <title>General</title> + <p> + The TCP/IP distribution uses a handshake which expects a + connection based protocol, i.e. the protocol does not include + any authentication after the handshake procedure. + </p> + <p> + This is not entirely safe, as it is vulnerable against takeover + attacks, but it is a tradeoff between fair safety and performance. + </p> + <p> + The cookies are never sent in cleartext and the handshake procedure + expects the client (called A) to be the first one to prove that it can + generate a sufficient digest. The digest is generated with the + MD5 message digest algorithm and the challenges are expected to be very + random numbers. + </p> + </section> + <section> + <title>Definitions</title> + <p> + A challenge is a 32 bit integer number in big endian order. Below the function + <c>gen_challenge()</c> returns a random 32 bit integer used as a challenge. + </p> + <p> + A digest is a (16 bytes) MD5 hash of the Challenge (as text) concatenated + with the cookie (as text). Below, the function <c>gen_digest(Challenge, Cookie)</c> + generates a digest as described above. + </p> + <p> + An out_cookie is the cookie used in outgoing communication to a certain node, + so that A's out_cookie for B should correspond with B's in_cookie for A and + the other way around. A's out_cookie for B and A's in_cookie for B need <em>NOT</em> + be the same. Below the function <c>out_cookie(Node)</c> returns the current + node's out_cookie for <c>Node</c>. + </p> + <p> + An in_cookie is the cookie expected to be used by another node when + communicating with us, so that A's in_cookie for B corresponds with B's + out_cookie for A. Below the function <c>in_cookie(Node)</c> returns the current + node's <c>in_cookie</c> for <c>Node</c>. + </p> + <p> + The cookies are text strings that can be viewed as passwords. + </p> + <p> + Every message in the handshake starts with a 16 bit big endian integer + which contains the length of the message (not counting the two initial bytes). + In erlang this corresponds to the <c>gen_tcp</c> option <c>{packet, 2}</c>. Note that after + the handshake, the distribution switches to 4 byte packet headers. + </p> + + </section> + <section> + <title>The Handshake in Detail</title> + <p> + Imagine two nodes, node A, which initiates the handshake and node B, which + accepts the connection. + </p> + <taglist> + <tag>1) connect/accept</tag> + <item><p>A connects to B via TCP/IP and B accepts the connection.</p></item> + <tag>2) send_name/receive_name</tag> + <item><p>A sends an initial identification to B. B receives the message. + The message looks like this (every "square" being one byte and the packet + header removed): + </p> +<pre> ++---+--------+--------+-----+-----+-----+-----+-----+-----+-...-+-----+ +|'n'|Version0|Version1|Flag0|Flag1|Flag2|Flag3|Name0|Name1| ... |NameN| ++---+--------+--------+-----+-----+-----+-----+-----+-----+-... +-----+ +</pre> + <p> + The 'n' is just a message tag. + Version0 and Version1 is the distribution version selected by node A, + based on information from EPMD. (16 bit big endian) + Flag0 ... Flag3 are capability flags, the capabilities defined in + <c>$ERL_TOP/lib/kernel/include/dist.hrl</c>. + (32 bit big endian) + Name0 ... NameN is the full nodename of A, as a string of bytes (the + packet length denotes how long it is). + </p></item> + <tag>3) recv_status/send_status</tag> + <item><p>B sends a status message to A, which indicates + if the connection is allowed. The following status codes are defined:</p> + <taglist> + <tag><c>ok</c></tag> + <item>The handshake will continue.</item> + <tag><c>ok_simultaneous</c></tag> + <item>The handshake will continue, but A is informed that B + has another ongoing connection attempt that will be + shut down (simultaneous connect where A's name is + greater than B's name, compared literally).</item> + <tag><c>nok</c></tag> + <item>The handshake will not continue, as B already has an ongoing handshake + which it itself has initiated. (simultaneous connect where B's name is + greater than A's).</item> + <tag><c>not_allowed</c></tag> + <item>The connection is disallowed for some (unspecified) security + reason.</item> + <tag><c>alive</c></tag> + <item>A connection to the node is already active, which either means + that node A is confused or that the TCP connection breakdown + of a previous node with this name has not yet reached node B. + See 3B below.</item> + </taglist> + <p>This is the format of the status message:</p> +<pre> ++---+-------+-------+-...-+-------+ +|'s'|Status0|Status1| ... |StatusN| ++---+-------+-------+-...-+-------+ +</pre> + <p> + 's' is the message tag Status0 ... StatusN is the status as a string (not terminated) + </p> + </item> + <tag>3B) send_status/recv_status</tag> + <item><p>If status was 'alive', node A will answer with + another status message containing either 'true' which means that the + connection should continue (The old connection from this node is broken), or + <c>'false'</c>, which simply means that the connection should be closed, the + connection attempt was a mistake.</p></item> + <tag>4) recv_challenge/send_challenge</tag> + <item><p>If the status was <c>ok</c> or <c>ok_simultaneous</c>, + The handshake continues with B sending A another message, the challenge. + The challenge contains the same type of information as the "name" message + initially sent from A to B, with the addition of a 32 bit challenge:</p> +<pre> ++---+--------+--------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-...-+-----+ +|'n'|Version0|Version1|Flag0|Flag1|Flag2|Flag3|Chal0|Chal1|Chal2|Chal3|Name0|Name1| ... |NameN| ++---+--------+--------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-... +-----+ +</pre> + <p> + Where Chal0 ... Chal3 is the challenge as a 32 bit big endian integer + and the other fields are B's version, flags and full nodename. + </p></item> + <tag>5) send_challenge_reply/recv_challenge_reply</tag> + <item><p>Now A has generated a digest and its own challenge. Those are + sent together in a package to B:</p> +<pre> ++---+-----+-----+-----+-----+-----+-----+-----+-----+-...-+------+ +|'r'|Chal0|Chal1|Chal2|Chal3|Dige0|Dige1|Dige2|Dige3| ... |Dige15| ++---+-----+-----+-----+-----+-----+-----+-----+-----+-...-+------+ +</pre> + <p> + Where 'r' is the tag, Chal0 ... Chal3 is A's challenge for B to handle and + Dige0 ... Dige15 is the digest that A constructed from the challenge B sent + in the previous step. + </p></item> + <tag>6) recv_challenge_ack/send_challenge_ack</tag> + <item><p>B checks that the digest received from A is correct and generates a + digest from the challenge received from A. The digest is then sent to A. The + message looks like this:</p> +<pre> ++---+-----+-----+-----+-----+-...-+------+ +|'a'|Dige0|Dige1|Dige2|Dige3| ... |Dige15| ++---+-----+-----+-----+-----+-...-+------+ +</pre> + <p> + Where 'a' is the tag and Dige0 ... Dige15 is the digest calculated by B + for A's challenge.</p></item> + <tag>7)</tag> + <item><p>A checks the digest from B and the connection is up.</p></item> + </taglist> + </section> + <section> + <title>Semigraphic View</title> +<pre> +A (initiator) B (acceptor) + +TCP connect -----------------------------------------> + TCP accept + +send_name -----------------------------------------> + recv_name + + <---------------------------------------- send_status +recv_status +(if status was 'alive' + send_status - - - - - - - - - - - - - - - - - - - -> + recv_status) + ChB = gen_challenge() + (ChB) + <---------------------------------------- send_challenge +recv_challenge + +ChA = gen_challenge(), +OCA = out_cookie(B), +DiA = gen_digest(ChB,OCA) + (ChA, DiA) +send_challenge_reply --------------------------------> + recv_challenge_reply + ICB = in_cookie(A), + check: + DiA == gen_digest + (ChB, ICB) ? + - if OK: + OCB = out_cookie(A), + DiB = gen_digest + (DiB) (ChA, OCB) + <----------------------------------------- send_challenge_ack +recv_challenge_ack DONE +ICA = in_cookie(B), - else +check: CLOSE +DiB == gen_digest(ChA,ICA) ? +- if OK + DONE +- else + CLOSE +</pre> + </section> + <marker id="dflags"/> + <section> + <title>The Currently Defined Distribution Flags</title> + <p> + Currently (OTP-R16) the following capability flags are defined: + </p> +<pre> +%% The node should be published and part of the global namespace +-define(DFLAG_PUBLISHED,1). + +%% The node implements an atom cache (obsolete) +-define(DFLAG_ATOM_CACHE,2). + +%% The node implements extended (3 * 32 bits) references. This is +%% required today. If not present connection will be refused. +-define(DFLAG_EXTENDED_REFERENCES,4). + +%% The node implements distributed process monitoring. +-define(DFLAG_DIST_MONITOR,8). + +%% The node uses separate tag for fun's (lambdas) in the distribution protocol. +-define(DFLAG_FUN_TAGS,16#10). + +%% The node implements distributed named process monitoring. +-define(DFLAG_DIST_MONITOR_NAME,16#20). + +%% The (hidden) node implements atom cache (obsolete) +-define(DFLAG_HIDDEN_ATOM_CACHE,16#40). + +%% The node understand new fun-tags +-define(DFLAG_NEW_FUN_TAGS,16#80). + +%% The node is capable of handling extended pids and ports. This is +%% required today. If not present connection will be refused. +-define(DFLAG_EXTENDED_PIDS_PORTS,16#100). + +%% +-define(DFLAG_EXPORT_PTR_TAG,16#200). + +%% +-define(DFLAG_BIT_BINARIES,16#400). + +%% The node understands new float format +-define(DFLAG_NEW_FLOATS,16#800). + +%% +-define(DFLAG_UNICODE_IO,16#1000). + +%% The node implements atom cache in distribution header. +-define(DFLAG_DIST_HDR_ATOM_CACHE,16#2000). + +%% The node understand the SMALL_ATOM_EXT tag +-define(DFLAG_SMALL_ATOM_TAGS, 16#4000). + +%% The node understand UTF-8 encoded atoms +-define(DFLAG_UTF8_ATOMS, 16#10000). + +</pre> + </section> </section> <section> diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml index 13f42a74a7..1212c34586 100644 --- a/erts/doc/src/erl_driver.xml +++ b/erts/doc/src/erl_driver.xml @@ -317,9 +317,9 @@ minor version used by the driver is greater than the one used by the runtime system.</p> <p>The emulator will refuse to load a driver that does not use - the extended driver interface since, + the extended driver interface, to allow for 64-bit capable drivers, - incompatible type changes for the callbacks + since incompatible type changes for the callbacks <seealso marker="driver_entry#output">output</seealso>, <seealso marker="driver_entry#control">control</seealso> and <seealso marker="driver_entry#call">call</seealso> @@ -1560,7 +1560,7 @@ typedef struct ErlIOVec { <c>[ERL_DRV_BUSY_MSGQ_LIM_MIN, ERL_DRV_BUSY_MSGQ_LIM_MAX]</c>. Limits will be automatically adjusted to be sane. That is, the system will adjust values so that the low limit used is - lower or equal to the high limit used. By default the high + lower than or equal to the high limit used. By default the high limit will be 8 kB and the low limit will be 4 kB.</p> <p>By passing a pointer to an integer variable containing diff --git a/erts/doc/src/erl_ext_dist.xml b/erts/doc/src/erl_ext_dist.xml index fd2da2cfe3..28afea8b29 100644 --- a/erts/doc/src/erl_ext_dist.xml +++ b/erts/doc/src/erl_ext_dist.xml @@ -119,10 +119,39 @@ <cell align="center">Data</cell> </row> <tcaption></tcaption></table> + <marker id="utf8_atoms"/> + <note> + <p>As of ERTS version 5.10 (OTP-R16) support + for UTF-8 encoded atoms has been introduced in the external format. + However, only characters that can be encoded using Latin1 (ISO-8859-1) + are currently supported in atoms. The support for UTF-8 encoded atoms + in the external format has been implemented in order to be able to support + all Unicode characters in atoms in <em>some future release</em>. Full + support for Unicode atoms will not happen before OTP-R18, and might + be introduced even later than that. Until full Unicode support for + atoms has been introduced, it is an <em>error</em> to pass atoms containing + characters that cannot be encoded in Latin1, and <em>the behavior is + undefined</em>.</p> + <p>When the + <seealso marker="erl_dist_protocol#dflags"><c>DFLAG_UTF8_ATOMS</c></seealso> + distribution flag has been exchanged between both nodes in the + <seealso marker="erl_dist_protocol#distribution_handshake">distribution handshake</seealso>, + all atoms in the distribution header will be encoded in UTF-8; otherwise, + all atoms in the distribution header will be encoded in Latin1. The two + new tags <seealso marker="#ATOM_UTF8_EXT">ATOM_UTF8_EXT</seealso>, and + <seealso marker="#SMALL_ATOM_UTF8_EXT">SMALL_ATOM_UTF8_EXT</seealso> + will only be used if the <c>DFLAG_UTF8_ATOMS</c> distribution flag has + been exchanged between nodes, or if an atom containing characters + that cannot be encoded in Latin1 is encountered. + </p> + <p>The maximum number of allowed characters in an atom is 255. In the + UTF-8 case each character may need 4 bytes to be encoded. + </p> + </note> </section> - <section> - <marker id="distribution_header"/> + <marker id="distribution_header"/> + <section> <title>Distribution header</title> <p> As of erts version 5.7.2 the old atom cache protocol was @@ -219,8 +248,7 @@ <p> The least significant bit in that half byte is the <c>LongAtoms</c> flag. If it is set, 2 bytes are used for atom lengths instead of - 1 byte in the distribution header. However, the current emulator - cannot handle long atoms, so it will currently always be 0. + 1 byte in the distribution header. </p> <p> After the <c>Flags</c> field follow the <c>AtomCacheRefs</c>. The @@ -247,16 +275,26 @@ <p> <c>InternalSegmentIndex</c> together with the <c>SegmentIndex</c> completely identify the location of an atom cache entry in the - atom cache. <c>Length</c> is number of one byte characters that - the atom text consists of. Length is a two byte big endian integer + atom cache. <c>Length</c> is number of bytes that <c>AtomText</c> + consists of. Length is a two byte big endian integer if the <c>LongAtoms</c> flag has been set, otherwise a one byte - integer. Subsequent <c>CachedAtomRef</c>s with the same + integer. When the + <seealso marker="erl_dist_protocol#dflags"><c>DFLAG_UTF8_ATOMS</c></seealso> + distribution flag has been exchanged between both nodes in the + <seealso marker="erl_dist_protocol#distribution_handshake">distribution handshake</seealso>, + characters in <c>AtomText</c> is encoded in UTF-8; otherwise, + encoded in Latin1. Subsequent <c>CachedAtomRef</c>s with the same <c>SegmentIndex</c> and <c>InternalSegmentIndex</c> as this <c>NewAtomCacheRef</c> will refer to this atom until a new <c>NewAtomCacheRef</c> with the same <c>SegmentIndex</c> and <c>InternalSegmentIndex</c> appear. </p> <p> + For more information on encoding of atoms, see + <seealso marker="#utf8_atoms">note on UTF-8 encoded atoms</seealso> + in the beginning of this document. + </p> + <p> If the <c>NewCacheEntryFlag</c> for the next <c>AtomCacheRef</c> has not been set, a <c>CachedAtomRef</c> on the following format will follow: @@ -383,9 +421,9 @@ <tcaption></tcaption></table> <p> An atom is stored with a 2 byte unsigned length in big-endian order, - followed by <c>Len</c> numbers of 8 bit characters that forms the - <c>AtomName</c>. - Note: The maximum allowed value for <c>Len</c> is 255. + followed by <c>Len</c> numbers of 8 bit Latin1 characters that forms + the <c>AtomName</c>. + <em>Note</em>: The maximum allowed value for <c>Len</c> is 255. </p> </section> @@ -754,12 +792,14 @@ <tcaption></tcaption></table> <p> An atom is stored with a 1 byte unsigned length, - followed by <c>Len</c> numbers of 8 bit characters that + followed by <c>Len</c> numbers of 8 bit Latin1 characters that forms the <c>AtomName</c>. Longer atoms can be represented by <seealso marker="#ATOM_EXT">ATOM_EXT</seealso>. <em>Note</em> the <c>SMALL_ATOM_EXT</c> was introduced in erts version 5.7.2 and - require a small atom distribution flag exchanged in the distribution - handshake. + require an exchange of the + <seealso marker="erl_dist_protocol#dflags"><c>DFLAG_SMALL_ATOM_TAGS</c></seealso> + distribution flag in the + <seealso marker="erl_dist_protocol#distribution_handshake">distribution handshake</seealso>. </p> </section> @@ -1007,7 +1047,62 @@ This term is used in minor version 1 of the external format. </p> </section> + <section> + <marker id="ATOM_UTF8_EXT"/> + <title>ATOM_UTF8_EXT</title> + + <table align="left"> + <row> + <cell align="center">1</cell> + <cell align="center">2</cell> + <cell align="center">Len</cell> + </row> + <row> + <cell align="center"><c>118</c></cell> + <cell align="center"><c>Len</c></cell> + <cell align="center"><c>AtomName</c></cell> + </row> + <tcaption></tcaption></table> + <p> + An atom is stored with a 2 byte unsigned length in big-endian order, + followed by <c>Len</c> bytes containing the <c>AtomName</c> encoded + in UTF-8. + </p> + <p> + For more information on encoding of atoms, see + <seealso marker="#utf8_atoms">note on UTF-8 encoded atoms</seealso> + in the beginning of this document. + </p> + </section> + <section> + <marker id="SMALL_ATOM_UTF8_EXT"/> + <title>SMALL_ATOM_UTF8_EXT</title> + + <table align="left"> + <row> + <cell align="center">1</cell> + <cell align="center">1</cell> + <cell align="center">Len</cell> + </row> + <row> + <cell align="center"><c>119</c></cell> + <cell align="center"><c>Len</c></cell> + <cell align="center"><c>AtomName</c></cell> + </row> + <tcaption></tcaption></table> + <p> + An atom is stored with a 1 byte unsigned length, + followed by <c>Len</c> bytes containing the <c>AtomName</c> encoded + in UTF-8. Longer atoms encoded in UTF-8 can be represented using + <seealso marker="#ATOM_UTF8_EXT">ATOM_UTF8_EXT</seealso>. + </p> + <p> + For more information on encoding of atoms, see + <seealso marker="#utf8_atoms">note on UTF-8 encoded atoms</seealso> + in the beginning of this document. + </p> + </section> </chapter> diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 1d67be2e52..315dc323ba 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -277,7 +277,9 @@ the binary contains Unicode characters greater than 16#FF. In a future release, such Unicode characters might be allowed and <c>binary_to_atom(<anno>Binary</anno>, utf8)</c> - will not fail in that case.</p></note> + will not fail in that case. For more information on Unicode support in atoms + see <seealso marker="erl_ext_dist#utf8_atoms">note on UTF-8 encoded atoms</seealso> + in the chapter about the external term format in the ERTS User's Guide.</p></note> <pre> > <input>binary_to_atom(<<"Erlang">>, latin1).</input> @@ -968,6 +970,37 @@ true </desc> </func> <func> + <name>float_to_list(Float, Options) -> string()</name> + <fsummary>Text representation of a float formatted using given options</fsummary> + <type> + <v>Float = float()</v> + <v>Options = [Option]</v> + <v>Option = {decimals, Decimals::0..249} | + {scientific, Decimals::0..249} | + compact</v> + </type> + <desc> + <p>Returns a string which corresponds to the text + representation of <c>Float</c> using fixed decimal point formatting. + When <c>decimals</c> option is specified + the returned value will contain at most <c>Decimals</c> number of + digits past the decimal point. If the number doesn't fit in the + internal static buffer of 256 bytes, the function throws <c>badarg</c>. + When <c>compact</c> option is provided + the trailing zeros at the end of the list are truncated (this option is + only meaningful together with the <c>decimals</c> option). When + <c>scientific</c> option is provided, the float will be formatted using + scientific notation with <c>Decimals</c> digits of precision. If + <c>Options</c> is <c>[]</c> the function behaves like <c>float_to_list/1</c>. + </p> + <pre> +> <input>float_to_list(7.12, [{decimals, 4}]).</input> +"7.1200" +> <input>float_to_list(7.12, [{decimals, 4}, compact]).</input> +"7.12"</pre> + </desc> + </func> + <func> <name name="fun_info" arity="1"/> <fsummary>Information about a fun</fsummary> <desc> @@ -1681,9 +1714,11 @@ os_prompt% </pre> <desc> <p>Returns the atom whose text representation is <c><anno>String</anno></c>.</p> <p><c><anno>String</anno></c> may only contain ISO-latin-1 - characterns (i.e. numbers below 256) as the current + characters (i.e. numbers below 256) as the current implementation does not allow unicode characters >= 256 in - atoms.</p> + atoms. For more information on Unicode support in atoms + see <seealso marker="erl_ext_dist#utf8_atoms">note on UTF-8 encoded atoms</seealso> + in the chapter about the external term format in the ERTS User's Guide.</p> <pre> > <input>list_to_atom("Erlang").</input> 'Erlang'</pre> @@ -5679,35 +5714,35 @@ ok For more information see the <seealso marker="erl#+spp">+spp</seealso> command line argument of <seealso marker="erl">erl(1)</seealso>.</p></item> - <tag><c>process_count</c></tag> + <tag><marker id="system_info_port_count"/><c>port_count</c></tag> <item> <p>Returns the number of ports currently existing at the local node as an integer. The same value as - <c>length(erlang:ports())</c> returns.</p> + <c>length(erlang:ports())</c> returns, but more efficient.</p> </item> <tag><marker id="system_info_port_limit"><c>port_limit</c></marker></tag> <item> <p>Returns the maximum number of simultaneously existing ports at the local node as an integer. This limit can be configured at startup by using the - <seealso marker="erl#max_ports"><c>+Q</c></seealso> + <seealso marker="erl#+Q">+Q</seealso> command line flag of - <seealso marker="erl"><c>erl(1)</c></seealso>.</p> + <seealso marker="erl">erl(1)</seealso>.</p> </item> - <tag><c>process_count</c></tag> + <tag><marker id="system_info_process_count"/><c>process_count</c></tag> <item> <p>Returns the number of processes currently existing at the local node as an integer. The same value as - <c>length(processes())</c> returns.</p> + <c>length(processes())</c> returns, but more efficient.</p> </item> <tag><marker id="system_info_process_limit"><c>process_limit</c></marker></tag> <item> <p>Returns the maximum number of simultaneously existing processes at the local node as an integer. This limit can be configured at startup by using the - <seealso marker="erl#max_processes"><c>+P</c></seealso> + <seealso marker="erl#+P">+P</seealso> command line flag of - <seealso marker="erl"><c>erl(1)</c></seealso>.</p> + <seealso marker="erl">erl(1)</seealso>.</p> </item> <tag><c>procs</c></tag> <item> diff --git a/erts/doc/src/notes.xml b/erts/doc/src/notes.xml index e996d3e8e3..de6696671b 100644 --- a/erts/doc/src/notes.xml +++ b/erts/doc/src/notes.xml @@ -30,6 +30,213 @@ </header> <p>This document describes the changes made to the ERTS application.</p> +<section><title>Erts 5.10</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Set new peeled off SCTP socket to nonblocking socket + (Thanks to Jonas Falkevik)</p> + <p> + Own Id: OTP-10491</p> + </item> + <item> + <p> + Fix various typos (thanks to Tuncer Ayaz)</p> + <p> + Own Id: OTP-10611</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + A boolean socket option 'ipv6_v6only' for IPv6 sockets + has been added. The default value of the option is OS + dependent, so applications aiming to be portable should + consider using <c>{ipv6_v6only,true}</c> when creating an + <c>inet6</c> listening/destination socket, and if + neccesary also create an <c>inet</c> socket on the same + port for IPv4 traffic. See the documentation.</p> + <p> + Own Id: OTP-8928 Aux Id: kunagi-193 [104] </p> + </item> + <item> + <p>It is now allowed to define stubs for BIFs, to allow + type specs to be written for BIFs. For example, if there + is BIF called <c>lists:member/2</c>, a dummy definition + of <c>lists:member/2</c> is now allowed.</p> + <p> + Own Id: OTP-9861</p> + </item> + <item> + <p> + Code loading and upgrade are now done without blocking + the emulator in single threaded mode. This will improve + realtime characteristics when code is loaded/upgraded on + a running SMP system.</p> + <p> + Own Id: OTP-9974</p> + </item> + <item> + <p>In the SMP emulator, turning on and off tracing will + no longer take down the system to single-scheduling. </p> + <p> + Own Id: OTP-10122</p> + </item> + <item> + <p> + Tuple funs (deprecated in R15B) are no longer supported.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-10170</p> + </item> + <item> + <p>Major port improvements. The most notable:</p> <list> + <item>New internal port table implementation allowing for + both parallel reads as well as writes. Especially read + operations have become really cheap.</item> <item>Dynamic + allocation of port structures. This allow for a much + larger maximum amount of ports allowed as a default. The + previous default of 1024 has been raised to 65536. + Maximum amount of ports can be set using the <seealso + marker="erts:erl#+Q">+Q</seealso> command line flag of + <seealso marker="erts:erl">erl(1)</seealso>. The + previously used environment variable <c>ERL_MAX_PORTS</c> + has been deprecated and scheduled for removal in + OTP-R17.</item> <item>Major rewrite of scheduling of port + tasks. Major benefits of the rewrite are reduced + contention on run queue locks, and reduced amount of + memory allocation operations needed. The rewrite was also + necessary in order to make it possible to schedule + signals from processes to ports.</item> <item>Improved + internal thread progress functionality for easy + management of unmanaged threads. This improvement was + necessary for the rewrite of the port task + scheduling.</item> <item>Rewrite of all process to port + signal implementations in order to make it possible to + schedule those operations. All port operations can now be + scheduled which allows for reduced lock contention on the + port lock as well as truly asynchronous communication + with ports.</item> <item>Optimized lookup of port handles + from drivers.</item> <item>Optimized driver lookup when + creating ports.</item> <item>Preemptable <seealso + marker="erts:erlang#ports-0">erlang:ports/0</seealso> + BIF.</item> </list> + <p>These changes imply changes of the characteristics of + the system. The most notable:</p> <taglist> <tag>Order of + signal delivery.</tag> <item>The previous implementation + of the VM has delivered signals from processes to ports + in a synchronous stricter fashion than required by the + language. As of ERTS version 5.10, signals are truly + asynchronously delivered. The order of signal delivery + still adheres to the requirements of the language, but + only to the requirements. That is, some signal sequences + that previously always were delivered in one specific + order may now from time to time be delivered in different + orders. This may cause Erlang programs that have made + <em>false assumptions</em> about signal delivery order to + fail even though they previously succeeded. For more + information about signal ordering guarantees, see the + chapter on <seealso + marker="erts:communication">communication</seealso> in + the ERTS user's guide. The <seealso + marker="erts:erl#+n">+n</seealso> command line flag of + <seealso marker="erts:erl">erl(1)</seealso> can be + helpful when trying to find signaling order bugs in + Erlang code that have been exposed by these + changes.</item> <tag>Latency of signals sent from + processes to ports.</tag> <item>Signals from processes to + ports where previously always delivered immediately. This + kept latency for such communication to a minimum, but it + could cause lock contention which was very expensive for + the system as a whole. In order to keep this latency low + also in the future, most signals from processes to ports + are by default still delivered immediately as long as no + conflicts occur. Such conflicts include not being able to + acquire the port lock, but also include other conflicts. + When a conflict occur, the signal will be scheduled for + delivery at a later time. A scheduled signal delivery may + cause a higher latency for this specific communication, + but improves the overall performance of the system since + it reduce lock contention between schedulers. The default + behavior of only scheduling delivery of these signals on + conflict can be changed by passing the <seealso + marker="erts:erl#+spp">+spp</seealso> command line flag + to <seealso marker="erts:erl">erl(1)</seealso>. The + behavior can also be changed on port basis using the + <seealso + marker="erts:erlang#open_port_parallelism">parallelism</seealso> + option of the <seealso + marker="erts:erlang#open_port-2">open_port/2</seealso> + BIF.</item> <tag>Execution time of the + <c>erlang:ports/0</c> BIF.</tag> <item>Since <seealso + marker="erts:erlang#ports-0">erlang:ports/0</seealso> now + can be preempted, the responsiveness of the system as a + whole has been improved. A call to <c>erlang:ports/0</c> + may, however, take a much longer time to complete than + before. How much longer time heavily depends on the + system load.</item> </taglist> + <p><em>Potential incompatibilities</em>:</p> <list> + <item><c>driver_send_term()</c> has been deprecated and + has been scheduled for removal in OTP-R17. Replace usage + of <c>driver_send_term()</c> with usage of <seealso + marker="erts:erl_driver#erl_drv_send_term">erl_drv_send_term()</seealso>.</item> + <item><c>driver_output_term()</c> has been deprecated and + has been scheduled for removal in OTP-R17. Replace usage + of <c>driver_output_term()</c> with usage of <seealso + marker="erts:erl_driver#erl_drv_output_term">erl_drv_output_term()</seealso>.</item> + <item>The new function <seealso + marker="erts:erl_driver#erl_drv_busy_msgq_limits">erl_drv_busy_msgq_limits()</seealso> + has been added in order to able to control management of + port queues.</item> </list> + <p>The <seealso + marker="erts:erl_driver#version_management">driver API + version</seealso> has been bumped to 2.1 from 2.0 due to + the above changes in the driver API.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-10336 Aux Id: kunagi-138 + [b5b97f67-fe34-46dc-93e6-a2931576db12] </p> + </item> + <item> + <p> + Erlang specification 4.7.3 defines max tuple size to + 65535 elements It is now enforced to no more than + 16777215 elements (arity 24 bits)</p> + <p> + Previous edge cases (28 bits) were not validated and + could cause undefined behaviour.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-10633</p> + </item> + <item> + <p> + The previous default of a maximum of 32768 simultaneous + processes has been raised to 262144. This value can be + changed using the the <seealso + marker="erl#+P">+P</seealso> command line flag of + <seealso marker="erl">erl(1)</seealso>. Note that the + value passed now is considered as a hint, and that actual + value chosen in most cases will be a power of two.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-10647 Aux Id: OTP-10336 </p> + </item> + </list> + </section> + +</section> + <section><title>Erts 5.9.3.1</title> <section><title>Known Bugs and Problems</title> diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index 89c948cc00..3e44bbb8db 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -399,7 +399,7 @@ include zlib/zlib.mk include pcre/pcre.mk $(ERTS_LIB): - cd $(ERTS_LIB_DIR) && $(MAKE) $(TYPE) + $(V_at)cd $(ERTS_LIB_DIR) && $(MAKE) $(TYPE) .PHONY: clean clean: @@ -491,7 +491,7 @@ $(TTF_DIR)/beam_pred_funcs.h \ $(TTF_DIR)/beam_tr_funcs.h \ : $(TTF_DIR)/OPCODES-GENERATED $(TTF_DIR)/OPCODES-GENERATED: $(OPCODE_TABLES) utils/beam_makeops - LANG=C $(PERL) utils/beam_makeops \ + $(gen_verbose)LANG=C $(PERL) utils/beam_makeops \ -wordsize @EXTERNAL_WORD_SIZE@ \ -outdir $(TTF_DIR) \ -DUSE_VM_PROBES=$(if $(USE_VM_PROBES),1,0) \ @@ -525,22 +525,22 @@ $(TARGET)/erl_atom_table.h \ $(TARGET)/erl_pbifs.c \ : $(TARGET)/TABLES-GENERATED $(TARGET)/TABLES-GENERATED: $(ATOMS) $(BIFS) utils/make_tables - LANG=C $(PERL) utils/make_tables -src $(TARGET) -include $(TARGET)\ + $(gen_verbose)LANG=C $(PERL) utils/make_tables -src $(TARGET) -include $(TARGET)\ $(ATOMS) $(BIFS) && echo $? >$(TARGET)/TABLES-GENERATED GENERATE += $(TARGET)/TABLES-GENERATED $(TTF_DIR)/erl_alloc_types.h: beam/erl_alloc.types utils/make_alloc_types - LANG=C $(PERL) utils/make_alloc_types -src $< -dst $@ $(ENABLE_ALLOC_TYPE_VARS) + $(gen_verbose)LANG=C $(PERL) utils/make_alloc_types -src $< -dst $@ $(ENABLE_ALLOC_TYPE_VARS) GENERATE += $(TTF_DIR)/erl_alloc_types.h # version include file $(TARGET)/erl_version.h: ../vsn.mk - LANG=C $(PERL) utils/make_version -o $@ $(SYSTEM_VSN) $(VSN)$(SERIALNO) $(TARGET) + $(gen_verbose)LANG=C $(PERL) utils/make_version -o $@ $(SYSTEM_VSN) $(VSN)$(SERIALNO) $(TARGET) GENERATE += $(TARGET)/erl_version.h # driver table $(TTF_DIR)/driver_tab.c: Makefile.in - LANG=C $(PERL) utils/make_driver_tab -o $@ $(DRV_OBJS) + $(gen_verbose)LANG=C $(PERL) utils/make_driver_tab -o $@ $(DRV_OBJS) GENERATE += $(TTF_DIR)/driver_tab.c @@ -562,7 +562,7 @@ $(PRELOAD_SRC): $(ERL_TOP)/erts/preloaded/ebin/otp_ring0.beam \ $(ERL_TOP)/erts/preloaded/ebin/erl_prim_loader.beam \ $(ERL_TOP)/erts/preloaded/ebin/erlang.beam \ $(ERL_TOP)/erts/preloaded/ebin/erts_internal.beam - LANG=C $(PERL) utils/make_preload $(MAKE_PRELOAD_EXTRA) -rc $^ > $@ + $(gen_verbose)LANG=C $(PERL) utils/make_preload $(MAKE_PRELOAD_EXTRA) -rc $^ > $@ else PRELOAD_OBJ = $(OBJDIR)/preload.o PRELOAD_SRC = $(TARGET)/preload.c @@ -575,7 +575,7 @@ $(PRELOAD_SRC): $(ERL_TOP)/erts/preloaded/ebin/otp_ring0.beam \ $(ERL_TOP)/erts/preloaded/ebin/erl_prim_loader.beam \ $(ERL_TOP)/erts/preloaded/ebin/erlang.beam \ $(ERL_TOP)/erts/preloaded/ebin/erts_internal.beam - LANG=C $(PERL) utils/make_preload -old $^ > $@ + $(gen_verbose)LANG=C $(PERL) utils/make_preload -old $^ > $@ endif .PHONY : generate @@ -586,13 +586,13 @@ else generate: $(TTF_DIR)/GENERATED $(PRELOAD_SRC) $(TTF_DIR)/GENERATED: $(GENERATE) - echo $? >$(TTF_DIR)/GENERATED + $(gen_verbose)echo $? >$(TTF_DIR)/GENERATED endif $(TARGET)/erlang_dtrace.h: beam/erlang_dtrace.d - dtrace -h -C -Ibeam -s $< -o ./erlang_dtrace.tmp - sed -e '/^#define[ ]*ERLANG_[A-Z0-9_]*(.*)/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' ./erlang_dtrace.tmp > $@ - rm ./erlang_dtrace.tmp + $(dtrace_verbose)dtrace -h -C -Ibeam -s $< -o ./erlang_dtrace.tmp + $(V_at)sed -e '/^#define[ ]*ERLANG_[A-Z0-9_]*(.*)/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' ./erlang_dtrace.tmp > $@ + $(V_at)rm ./erlang_dtrace.tmp # ---------------------------------------------------------------------- # Pattern rules @@ -613,45 +613,45 @@ endif ifeq ($(TARGET),win32) $(OBJDIR)/dll_sys.o: sys/$(ERLANG_OSTYPE)/sys.c - $(CC) $(CFLAGS) -DERL_RUN_SHARED_LIB=1 $(INCLUDES) -c $< -o $@ + $(V_CC) $(CFLAGS) -DERL_RUN_SHARED_LIB=1 $(INCLUDES) -c $< -o $@ $(OBJDIR)/beams.$(RES_EXT): $(TARGET)/beams.rc - $(RC) -o $@ -I$(ERL_TOP)/erts/etc/win32 $(TARGET)/beams.rc + $(V_RC) -o $@ -I$(ERL_TOP)/erts/etc/win32 $(TARGET)/beams.rc endif ifneq ($(filter tile-%,$(TARGET)),) $(OBJDIR)/beam_emu.o: beam/beam_emu.c - $(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) \ + $(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) \ -OPT:Olimit=0 -WOPT:lpre=off:spre=off:epre=off \ $(INCLUDES) -c $< -o $@ else # Usually the same as the default rule, but certain platforms (e.g. win32) mix # different compilers $(OBJDIR)/beam_emu.o: beam/beam_emu.c - $(EMU_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ + $(V_EMU_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ endif $(OBJDIR)/%.o: beam/%.c - $(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ + $(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ $(OBJDIR)/%.o: $(TARGET)/%.c - $(CC) $(CFLAGS) $(INCLUDES) -Idrivers/common -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -Idrivers/common -c $< -o $@ $(OBJDIR)/%.o: $(TTF_DIR)/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(OBJDIR)/%.o: sys/$(ERLANG_OSTYPE)/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(OBJDIR)/%.o: sys/common/%.c - $(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ + $(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ $(OBJDIR)/%.o: drivers/common/%.c - $(CC) $(CFLAGS) -DLIBSCTP=$(LIBSCTP) $(INCLUDES) -Idrivers/common -Idrivers/$(ERLANG_OSTYPE) -c $< -o $@ + $(V_CC) $(CFLAGS) -DLIBSCTP=$(LIBSCTP) $(INCLUDES) -Idrivers/common -Idrivers/$(ERLANG_OSTYPE) -c $< -o $@ $(OBJDIR)/%.o: drivers/$(ERLANG_OSTYPE)/%.c - $(CC) $(CFLAGS) $(INCLUDES) -Idrivers/common -Idrivers/$(ERLANG_OSTYPE) -I../etc/$(ERLANG_OSTYPE) -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -Idrivers/common -Idrivers/$(ERLANG_OSTYPE) -I../etc/$(ERLANG_OSTYPE) -c $< -o $@ # ---------------------------------------------------------------------- # Specials @@ -659,19 +659,19 @@ $(OBJDIR)/%.o: drivers/$(ERLANG_OSTYPE)/%.c CS_SRC = sys/$(ERLANG_OSTYPE)/erl_child_setup.c $(BINDIR)/$(CS_EXECUTABLE): $(TTF_DIR)/GENERATED $(PRELOAD_SRC) $(CS_SRC) $(ERTS_LIB) - $(CS_PURIFY) $(CC) $(CS_LDFLAGS) -o $(BINDIR)/$(CS_EXECUTABLE) \ + $(ld_verbose)$(CS_PURIFY) $(CC) $(CS_LDFLAGS) -o $(BINDIR)/$(CS_EXECUTABLE) \ $(CS_CFLAGS) $(COMMON_INCLUDES) $(CS_SRC) $(CS_LIBS) $(OBJDIR)/%.kp.o: sys/common/%.c - $(CC) -DERTS_KERNEL_POLL_VERSION $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ + $(V_CC) -DERTS_KERNEL_POLL_VERSION $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ $(OBJDIR)/%.nkp.o: sys/common/%.c - $(CC) -DERTS_NO_KERNEL_POLL_VERSION $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ + $(V_CC) -DERTS_NO_KERNEL_POLL_VERSION $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ ifeq ($(GCC),yes) $(OBJDIR)/erl_goodfit_alloc.o: beam/erl_goodfit_alloc.c - $(CC) $(subst -O2, $(GEN_OPT_FLGS) $(UNROLL_FLG), $(CFLAGS)) $(INCLUDES) -c $< -o $@ + $(V_CC) $(subst -O2, $(GEN_OPT_FLGS) $(UNROLL_FLG), $(CFLAGS)) $(INCLUDES) -c $< -o $@ endif # ---------------------------------------------------------------------- @@ -844,28 +844,28 @@ $(OBJS): $(TTF_DIR)/GENERATED M4FLAGS += -DTARGET=$(TARGET) -DOPSYS=$(OPSYS) -DARCH=$(ARCH) $(TTF_DIR)/%.S: hipe/%.m4 - m4 $(M4FLAGS) $< > $@ + $(m4_verbose)m4 $(M4FLAGS) $< > $@ $(TTF_DIR)/%.h: hipe/%.m4 - m4 $(M4FLAGS) $< > $@ + $(m4_verbose)m4 $(M4FLAGS) $< > $@ $(OBJDIR)/%.o: $(TTF_DIR)/%.S - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(OBJDIR)/%.o: hipe/%.S - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(OBJDIR)/%.o: hipe/%.c - $(CC) $(subst O2,O3, $(CFLAGS)) $(INCLUDES) -c $< -o $@ + $(V_CC) $(subst O2,O3, $(CFLAGS)) $(INCLUDES) -c $< -o $@ $(BINDIR)/hipe_mkliterals$(TF_MARKER): $(OBJDIR)/hipe_mkliterals.o - $(CC) $(CFLAGS) $(INCLUDES) -o $@ $< + $(ld_verbose)$(CC) $(CFLAGS) $(INCLUDES) -o $@ $< $(OBJDIR)/hipe_mkliterals.o: $(HIPE_ASM) $(TTF_DIR)/erl_alloc_types.h \ $(TTF_DIR)/OPCODES-GENERATED $(TARGET)/TABLES-GENERATED $(TTF_DIR)/hipe_literals.h: $(BINDIR)/hipe_mkliterals$(TF_MARKER) - $(BINDIR)/hipe_mkliterals$(TF_MARKER) -c > $@ + $(gen_verbose)$(BINDIR)/hipe_mkliterals$(TF_MARKER) -c > $@ $(OBJDIR)/hipe_x86_glue.o: hipe/hipe_x86_glue.S \ $(TTF_DIR)/hipe_x86_asm.h $(TTF_DIR)/hipe_literals.h \ @@ -908,7 +908,7 @@ $(OBJDIR)/hipe_arm_bifs.o: $(TTF_DIR)/hipe_arm_bifs.S \ # Use -fomit-frame-pointer to work around gcc (v4.5.2) bug causing # "error: r7 cannot be used in asm here" for DEBUG build. $(OBJDIR)/hipe_arm.o: hipe/hipe_arm.c - $(CC) $(subst O2,O3, $(CFLAGS)) -fomit-frame-pointer $(INCLUDES) -c $< -o $@ + $(V_CC) $(subst O2,O3, $(CFLAGS)) -fomit-frame-pointer $(INCLUDES) -c $< -o $@ # end of HiPE section ######################################## @@ -919,13 +919,13 @@ $(OBJDIR)/hipe_arm.o: hipe/hipe_arm.c ifeq ($(TARGET), win32) # Only the basic erlang to begin with eh? $(BINDIR)/$(EMULATOR_EXECUTABLE): $(INIT_OBJS) $(OBJS) $(DEPLIBS) - $(PURIFY) $(LD) -dll -def:sys/$(ERLANG_OSTYPE)/erl.def -implib:$(BINDIR)/erl_dll.lib -o $(BINDIR)/$(EMULATOR_EXECUTABLE) \ + $(ld_verbose)$(PURIFY) $(LD) -dll -def:sys/$(ERLANG_OSTYPE)/erl.def -implib:$(BINDIR)/erl_dll.lib -o $(BINDIR)/$(EMULATOR_EXECUTABLE) \ $(LDFLAGS) $(DEXPORT) $(INIT_OBJS) $(OBJS) $(LIBS) else $(BINDIR)/$(EMULATOR_EXECUTABLE): $(INIT_OBJS) $(OBJS) $(DEPLIBS) - $(PURIFY) $(LD) -o $(BINDIR)/$(EMULATOR_EXECUTABLE) \ + $(ld_verbose)$(PURIFY) $(LD) -o $(BINDIR)/$(EMULATOR_EXECUTABLE) \ $(HIPEBEAMLDFLAGS) $(LDFLAGS) $(DEXPORT) $(INIT_OBJS) $(OBJS) $(LIBS) endif @@ -1013,23 +1013,24 @@ depend: else depend: $(TTF_DIR)/depend.mk $(TTF_DIR)/depend.mk: $(TTF_DIR)/GENERATED $(PRELOAD_SRC) - $(DEP_CC) $(DEP_FLAGS) $(BEAM_SRC) \ + $(gen_verbose) + $(V_at)$(DEP_CC) $(DEP_FLAGS) $(BEAM_SRC) \ | $(SED_DEPEND) > $(TTF_DIR)/depend.mk - $(DEP_CC) $(DEP_FLAGS) -DLIBSCTP=$(LIBSCTP) $(DRV_COMMON_SRC) \ + $(V_at)$(DEP_CC) $(DEP_FLAGS) -DLIBSCTP=$(LIBSCTP) $(DRV_COMMON_SRC) \ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk - $(DEP_CC) $(DEP_FLAGS) -I../etc/$(ERLANG_OSTYPE) $(DRV_OSTYPE_SRC) \ + $(V_at)$(DEP_CC) $(DEP_FLAGS) -I../etc/$(ERLANG_OSTYPE) $(DRV_OSTYPE_SRC) \ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk - $(DEP_CC) $(DEP_FLAGS) $(SYS_SRC) \ + $(V_at)$(DEP_CC) $(DEP_FLAGS) $(SYS_SRC) \ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk - $(DEP_CC) $(DEP_FLAGS) $(TARGET_SRC) \ + $(V_at)$(DEP_CC) $(DEP_FLAGS) $(TARGET_SRC) \ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk - $(DEP_CC) $(DEP_FLAGS) $(ZLIB_SRC) \ + $(V_at)$(DEP_CC) $(DEP_FLAGS) $(ZLIB_SRC) \ | $(SED_DEPEND_ZLIB) >> $(TTF_DIR)/depend.mk ifdef HIPE_ENABLED - $(DEP_CC) $(DEP_FLAGS) $(HIPE_SRC) \ + $(V_at)$(DEP_CC) $(DEP_FLAGS) $(HIPE_SRC) \ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk endif - cd $(ERTS_LIB_DIR) && $(MAKE) depend + $(V_at)cd $(ERTS_LIB_DIR) && $(MAKE) depend endif ifneq ($(MAKECMDGOALS),clean) diff --git a/erts/emulator/beam/atom.c b/erts/emulator/beam/atom.c index d7c7f117cf..82dd320ea9 100644 --- a/erts/emulator/beam/atom.c +++ b/erts/emulator/beam/atom.c @@ -111,7 +111,7 @@ atom_text_alloc(int bytes) { byte *res; - ASSERT(bytes <= MAX_ATOM_LENGTH); + ASSERT(bytes <= MAX_ATOM_SZ_LIMIT); if (atom_text_pos + bytes >= atom_text_end) { more_atom_space(); } @@ -162,6 +162,7 @@ atom_alloc(Atom* tmpl) obj->name = atom_text_alloc(tmpl->len); sys_memcpy(obj->name, tmpl->name, tmpl->len); obj->len = tmpl->len; + obj->latin1_chars = tmpl->latin1_chars; obj->slot.index = -1; /* @@ -192,44 +193,146 @@ atom_free(Atom* obj) erts_free(ERTS_ALC_T_ATOM, (void*) obj); } +static void latin1_to_utf8(byte* conv_buf, const byte** srcp, int* lenp) +{ + byte* dst; + const byte* src = *srcp; + int i, len = *lenp; + + for (i=0 ; i < len; ++i) { + if (src[i] & 0x80) { + goto need_convertion; + } + } + return; + +need_convertion: + sys_memcpy(conv_buf, src, i); + dst = conv_buf + i; + for ( ; i < len; ++i) { + unsigned char chr = src[i]; + if (!(chr & 0x80)) { + *dst++ = chr; + } + else { + *dst++ = 0xC0 | (chr >> 6); + *dst++ = 0x80 | (chr & 0x3F); + } + } + *srcp = conv_buf; + *lenp = dst - conv_buf; +} + +/* + * erts_atom_put() may fail. If it fails THE_NON_VALUE is returned! + */ Eterm -am_atom_put(const char* name, int len) +erts_atom_put(const byte *name, int len, ErtsAtomEncoding enc, int trunc) { + byte utf8_copy[MAX_ATOM_SZ_FROM_LATIN1]; + const byte *text = name; + int tlen = len; + Sint no_latin1_chars; Atom a; - Eterm ret; int aix; - /* - * Silently truncate the atom if it is too long. Overlong atoms - * could occur in situations where we have no good way to return - * an error, such as in the I/O system. (Unfortunately, many - * drivers don't check for errors.) - * - * If an error should be produced for overlong atoms (such in - * list_to_atom/1), the caller should check the length before - * calling this function. - */ - if (len > MAX_ATOM_LENGTH) { - len = MAX_ATOM_LENGTH; - } #ifdef ERTS_ATOM_PUT_OPS_STAT erts_smp_atomic_inc_nob(&atom_put_ops); #endif - a.len = len; - a.name = (byte*)name; + + if (tlen < 0) { + if (trunc) + tlen = 0; + else + return THE_NON_VALUE; + } + + switch (enc) { + case ERTS_ATOM_ENC_7BIT_ASCII: + if (tlen > MAX_ATOM_CHARACTERS) { + if (trunc) + tlen = MAX_ATOM_CHARACTERS; + else + return THE_NON_VALUE; + } +#ifdef DEBUG + for (aix = 0; aix < len; aix++) { + ASSERT((name[aix] & 0x80) == 0); + } +#endif + no_latin1_chars = tlen; + break; + case ERTS_ATOM_ENC_LATIN1: + if (tlen > MAX_ATOM_CHARACTERS) { + if (trunc) + tlen = MAX_ATOM_CHARACTERS; + else + return THE_NON_VALUE; + } + no_latin1_chars = tlen; + latin1_to_utf8(utf8_copy, &text, &tlen); + break; + case ERTS_ATOM_ENC_UTF8: + /* First sanity check; need to verify later */ + if (tlen > MAX_ATOM_SZ_LIMIT && !trunc) + return THE_NON_VALUE; + break; + } + + a.len = tlen; + a.name = (byte *) text; atom_read_lock(); aix = index_get(&erts_atom_table, (void*) &a); atom_read_unlock(); - if (aix >= 0) - ret = make_atom(aix); - else { - atom_write_lock(); - ret = make_atom(index_put(&erts_atom_table, (void*) &a)); - atom_write_unlock(); + if (aix >= 0) { + /* Already in table no need to verify it */ + return make_atom(aix); } - return ret; + + if (enc == ERTS_ATOM_ENC_UTF8) { + /* Need to verify encoding and length */ + byte *err_pos; + Uint no_chars; + switch (erts_analyze_utf8_x((byte *) text, + (Uint) tlen, + &err_pos, + &no_chars, NULL, + &no_latin1_chars, + MAX_ATOM_CHARACTERS)) { + case ERTS_UTF8_OK: + ASSERT(no_chars <= MAX_ATOM_CHARACTERS); + break; + case ERTS_UTF8_OK_MAX_CHARS: + /* Truncated... */ + if (!trunc) + return THE_NON_VALUE; + ASSERT(no_chars == MAX_ATOM_CHARACTERS); + tlen = err_pos - text; + break; + default: + /* Bad utf8... */ + return THE_NON_VALUE; + } + } + + ASSERT(tlen <= MAX_ATOM_SZ_LIMIT); + ASSERT(-1 <= no_latin1_chars && no_latin1_chars <= MAX_ATOM_CHARACTERS); + + a.len = tlen; + a.latin1_chars = (Sint16) no_latin1_chars; + a.name = (byte *) text; + atom_write_lock(); + aix = index_put(&erts_atom_table, (void*) &a); + atom_write_unlock(); + return make_atom(aix); } +Eterm +am_atom_put(const char* name, int len) +{ + /* Assumes 7-bit ascii; use erts_atom_put() for other encodings... */ + return erts_atom_put((byte *) name, len, ERTS_ATOM_ENC_7BIT_ASCII, 1); +} int atom_table_size(void) { @@ -264,14 +367,19 @@ int atom_table_sz(void) } int -erts_atom_get(const char *name, int len, Eterm* ap) +erts_atom_get(const char *name, int len, Eterm* ap, int is_latin1) { + byte utf8_copy[MAX_ATOM_SZ_FROM_LATIN1]; Atom a; int i; int res; - a.len = len; + a.len = (Sint16) len; a.name = (byte *)name; + if (is_latin1) { + latin1_to_utf8(utf8_copy, (const byte**)&a.name, &len); + a.len = (Sint16) len; + } atom_read_lock(); i = index_get(&erts_atom_table, (void*) &a); res = i < 0 ? 0 : (*ap = make_atom(i), 1); @@ -333,8 +441,15 @@ init_atom_table(void) for (i = 0; erl_atom_names[i] != 0; i++) { int ix; a.len = strlen(erl_atom_names[i]); + a.latin1_chars = a.len; a.name = (byte*)erl_atom_names[i]; a.slot.index = i; +#ifdef DEBUG + /* Verify 7-bit ascii */ + for (ix = 0; ix < a.len; ix++) { + ASSERT((a.name[ix] & 0x80) == 0); + } +#endif ix = index_put(&erts_atom_table, (void*) &a); atom_text_pos -= a.len; atom_space -= a.len; diff --git a/erts/emulator/beam/atom.h b/erts/emulator/beam/atom.h index fd9c04d3d0..f721999a4c 100644 --- a/erts/emulator/beam/atom.h +++ b/erts/emulator/beam/atom.h @@ -26,7 +26,9 @@ #include "erl_atom_table.h" -#define MAX_ATOM_LENGTH 255 +#define MAX_ATOM_CHARACTERS 255 +#define MAX_ATOM_SZ_FROM_LATIN1 (2*MAX_ATOM_CHARACTERS) +#define MAX_ATOM_SZ_LIMIT (4*MAX_ATOM_CHARACTERS) /* theoretical byte limit */ #define ATOM_LIMIT (1024*1024) #define MIN_ATOM_TABLE_SIZE 8192 @@ -45,7 +47,8 @@ */ typedef struct atom { IndexSlot slot; /* MUST BE LOCATED AT TOP OF STRUCT!!! */ - int len; /* length of atom name */ + Sint16 len; /* length of atom name (UTF-8 encoded) */ + Sint16 latin1_chars; /* 0-255 if atom can be encoded in latin1; otherwise, -1 */ int ord0; /* ordinal value of first 3 bytes + 7 bits */ byte* name; /* name of atom */ } Atom; @@ -53,8 +56,8 @@ typedef struct atom { extern IndexTable erts_atom_table; ERTS_GLB_INLINE Atom* atom_tab(Uint i); -ERTS_GLB_INLINE int erts_is_atom_bytes(byte *text, size_t len, Eterm term); -ERTS_GLB_INLINE int erts_is_atom_str(char *str, Eterm term); +ERTS_GLB_INLINE int erts_is_atom_utf8_bytes(byte *text, size_t len, Eterm term); +ERTS_GLB_INLINE int erts_is_atom_str(const char *str, Eterm term, int is_latin1); #if ERTS_GLB_INLINE_INCL_FUNC_DEF ERTS_GLB_INLINE Atom* @@ -63,7 +66,7 @@ atom_tab(Uint i) return (Atom *) erts_index_lookup(&erts_atom_table, i); } -ERTS_GLB_INLINE int erts_is_atom_bytes(byte *text, size_t len, Eterm term) +ERTS_GLB_INLINE int erts_is_atom_utf8_bytes(byte *text, size_t len, Eterm term) { Atom *a; if (!is_atom(term)) @@ -73,43 +76,70 @@ ERTS_GLB_INLINE int erts_is_atom_bytes(byte *text, size_t len, Eterm term) && sys_memcmp((void *) a->name, (void *) text, len) == 0); } -ERTS_GLB_INLINE int erts_is_atom_str(char *str, Eterm term) +ERTS_GLB_INLINE int erts_is_atom_str(const char *str, Eterm term, int is_latin1) { Atom *a; int i, len; - char *aname; + const byte* aname; + const byte* s = (const byte*) str; + if (!is_atom(term)) return 0; a = atom_tab(atom_val(term)); len = a->len; - aname = (char *) a->name; - for (i = 0; i < len; i++) - if (aname[i] != str[i] || str[i] == '\0') - return 0; - return str[len] == '\0'; + aname = a->name; + if (is_latin1) { + for (i = 0; i < len; s++) { + if (aname[i] < 0x80) { + if (aname[i] != *s || *s == '\0') + return 0; + i++; + } + else { + if (aname[i] != (0xC0 | (*s >> 6)) || + aname[i+1] != (0x80 | (*s & 0x3F))) { + return 0; + } + i += 2; + } + } + } + else { + for (i = 0; i < len; i++, s++) + if (aname[i] != *s || *s == '\0') + return 0; + } + return *s == '\0'; } #endif +typedef enum { + ERTS_ATOM_ENC_7BIT_ASCII, + ERTS_ATOM_ENC_LATIN1, + ERTS_ATOM_ENC_UTF8 +} ErtsAtomEncoding; + /* * Note, ERTS_IS_ATOM_STR() expects the first argument to be a - * string literal. + * 7-bit ASCII string literal. */ #define ERTS_IS_ATOM_STR(LSTR, TERM) \ - (erts_is_atom_bytes((byte *) LSTR, sizeof(LSTR) - 1, (TERM))) + (erts_is_atom_utf8_bytes((byte *) LSTR, sizeof(LSTR) - 1, (TERM))) #define ERTS_DECL_AM(S) Eterm AM_ ## S = am_atom_put(#S, sizeof(#S) - 1) #define ERTS_INIT_AM(S) AM_ ## S = am_atom_put(#S, sizeof(#S) - 1) int atom_table_size(void); /* number of elements */ int atom_table_sz(void); /* table size in bytes, excluding stored objects */ -Eterm am_atom_put(const char*, int); /* most callers pass plain char*'s */ +Eterm am_atom_put(const char*, int); /* ONLY 7-bit ascii! */ +Eterm erts_atom_put(const byte *name, int len, ErtsAtomEncoding enc, int trunc); int atom_erase(byte*, int); int atom_static_put(byte*, int); void init_atom_table(void); void atom_info(int, void *); void dump_atoms(int, void *); -int erts_atom_get(const char* name, int len, Eterm* ap); +int erts_atom_get(const char* name, int len, Eterm* ap, int is_latin1); void erts_atom_get_text_space_sizes(Uint *reserved, Uint *used); #endif diff --git a/erts/emulator/beam/atom.names b/erts/emulator/beam/atom.names index c47a608215..590b2fc960 100644 --- a/erts/emulator/beam/atom.names +++ b/erts/emulator/beam/atom.names @@ -18,6 +18,8 @@ # # +# IMPORTANT! All atoms defined here *need* to be in 7-bit ascii! +# # File format: # # Lines starting with '#' are ignored. @@ -144,6 +146,7 @@ atom close atom closed atom code atom command +atom compact atom compat_rel atom compile atom compressed @@ -165,6 +168,7 @@ atom current_location atom current_stacktrace atom data atom debug_flags +atom decimals atom delay_trap atom dexit atom depth @@ -480,6 +484,7 @@ atom scheduler atom scheduler_id atom schedulers_online atom scheme +atom scientific atom scope atom sensitive atom sequential_tracer diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index b51f076a5d..8b4135e21d 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -1230,7 +1230,7 @@ load_atom_table(LoaderState* stp) GetByte(stp, n); GetString(stp, atom, n); - stp->atom[i] = am_atom_put((char*)atom, n); + stp->atom[i] = erts_atom_put(atom, n, ERTS_ATOM_ENC_LATIN1, 1); } /* @@ -1240,7 +1240,7 @@ load_atom_table(LoaderState* stp) if (is_nil(stp->module)) { stp->module = stp->atom[1]; } else if (stp->atom[1] != stp->module) { - char sbuf[256]; + char sbuf[MAX_ATOM_SZ_FROM_LATIN1]; Atom* ap; ap = atom_tab(atom_val(stp->atom[1])); @@ -1620,7 +1620,7 @@ read_line_table(LoaderState* stp) GetInt(stp, 2, n); GetString(stp, fname, n); - stp->fname[i] = am_atom_put((char*)fname, n); + stp->fname[i] = erts_atom_put(fname, n, ERTS_ATOM_ENC_LATIN1, 1); } } diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 97c8114437..bde70911a2 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -2604,9 +2604,13 @@ BIF_RETTYPE delete_element_2(BIF_ALIST_3) BIF_RETTYPE atom_to_list_1(BIF_ALIST_1) { - Uint need; - Eterm* hp; Atom* ap; + Uint num_chars, num_built, num_eaten; + byte* err_pos; + Eterm res; +#ifdef DEBUG + int ares; +#endif if (is_not_atom(BIF_ARG_1)) BIF_ERROR(BIF_P, BADARG); @@ -2615,9 +2619,18 @@ BIF_RETTYPE atom_to_list_1(BIF_ALIST_1) ap = atom_tab(atom_val(BIF_ARG_1)); if (ap->len == 0) BIF_RET(NIL); /* the empty atom */ - need = ap->len*2; - hp = HAlloc(BIF_P, need); - BIF_RET(buf_to_intlist(&hp,(char*)ap->name,ap->len, NIL)); + +#ifdef DEBUG + ares = +#endif + erts_analyze_utf8(ap->name, ap->len, &err_pos, &num_chars, NULL); + ASSERT(ares == ERTS_UTF8_OK); + + res = erts_utf8_to_list(BIF_P, num_chars, ap->name, ap->len, ap->len, + &num_built, &num_eaten, NIL); + ASSERT(num_built == num_chars); + ASSERT(num_eaten == ap->len); + BIF_RET(res); } /**********************************************************************/ @@ -2627,18 +2640,19 @@ BIF_RETTYPE atom_to_list_1(BIF_ALIST_1) BIF_RETTYPE list_to_atom_1(BIF_ALIST_1) { Eterm res; - char *buf = (char *) erts_alloc(ERTS_ALC_T_TMP, MAX_ATOM_LENGTH); - int i = intlist_to_buf(BIF_ARG_1, buf, MAX_ATOM_LENGTH); + char *buf = (char *) erts_alloc(ERTS_ALC_T_TMP, MAX_ATOM_CHARACTERS); + int i = intlist_to_buf(BIF_ARG_1, buf, MAX_ATOM_CHARACTERS); if (i < 0) { erts_free(ERTS_ALC_T_TMP, (void *) buf); i = list_length(BIF_ARG_1); - if (i > MAX_ATOM_LENGTH) { + if (i > MAX_ATOM_CHARACTERS) { BIF_ERROR(BIF_P, SYSTEM_LIMIT); } BIF_ERROR(BIF_P, BADARG); } - res = am_atom_put(buf, i); + res = erts_atom_put((byte *) buf, i, ERTS_ATOM_ENC_LATIN1, 1); + ASSERT(is_atom(res)); erts_free(ERTS_ALC_T_TMP, (void *) buf); BIF_RET(res); } @@ -2648,16 +2662,16 @@ BIF_RETTYPE list_to_atom_1(BIF_ALIST_1) BIF_RETTYPE list_to_existing_atom_1(BIF_ALIST_1) { int i; - char *buf = (char *) erts_alloc(ERTS_ALC_T_TMP, MAX_ATOM_LENGTH); + char *buf = (char *) erts_alloc(ERTS_ALC_T_TMP, MAX_ATOM_CHARACTERS); - if ((i = intlist_to_buf(BIF_ARG_1, buf, MAX_ATOM_LENGTH)) < 0) { + if ((i = intlist_to_buf(BIF_ARG_1, buf, MAX_ATOM_CHARACTERS)) < 0) { error: erts_free(ERTS_ALC_T_TMP, (void *) buf); BIF_ERROR(BIF_P, BADARG); } else { Eterm a; - if (erts_atom_get(buf, i, &a)) { + if (erts_atom_get(buf, i, &a, 1)) { erts_free(ERTS_ALC_T_TMP, (void *) buf); BIF_RET(a); } else { @@ -2917,7 +2931,73 @@ BIF_RETTYPE float_to_list_1(BIF_ALIST_1) need = i*2; hp = HAlloc(BIF_P, need); BIF_RET(buf_to_intlist(&hp, fbuf, i, NIL)); - } +} + +BIF_RETTYPE float_to_list_2(BIF_ALIST_2) +{ + const static int arity_two = make_arityval(2); + int decimals = SYS_DEFAULT_FLOAT_DECIMALS; + int compact = 0; + enum fmt_type_ { + FMT_LEGACY, + FMT_FIXED, + FMT_SCIENTIFIC + } fmt_type = FMT_LEGACY; + Eterm list = BIF_ARG_2; + Eterm arg; + int i; + Uint need; + Eterm* hp; + FloatDef f; + char fbuf[256]; + + /* check the arguments */ + if (is_not_float(BIF_ARG_1)) + goto badarg; + + for(; is_list(list); list = CDR(list_val(list))) { + arg = CAR(list_val(list)); + if (arg == am_compact) { + compact = 1; + continue; + } else if (is_tuple(arg)) { + Eterm* tp = tuple_val(arg); + if (*tp == arity_two && is_small(tp[2])) { + decimals = signed_val(tp[2]); + if (decimals > 0 && decimals < sizeof(fbuf) - 6 /* "X." ++ "e+YY" */) + switch (tp[1]) { + case am_decimals: + fmt_type = FMT_FIXED; + continue; + case am_scientific: + fmt_type = FMT_SCIENTIFIC; + continue; + } + } + } + goto badarg; + } + if (is_not_nil(list)) { + goto badarg; + } + + GET_DOUBLE(BIF_ARG_1, f); + + if (fmt_type == FMT_FIXED) { + if ((i = sys_double_to_chars_fast(f.fd, fbuf, sizeof(fbuf), + decimals, compact)) <= 0) + goto badarg; + } else { + if ((i = sys_double_to_chars_ext(f.fd, fbuf, sizeof(fbuf), decimals)) <= 0) + goto badarg; + } + + need = i*2; + hp = HAlloc(BIF_P, need); + BIF_RET(buf_to_intlist(&hp, fbuf, i, NIL)); +badarg: + BIF_ERROR(BIF_P, BADARG); +} /**********************************************************************/ diff --git a/erts/emulator/beam/bif.h b/erts/emulator/beam/bif.h index 71f232035d..4e456988a3 100644 --- a/erts/emulator/beam/bif.h +++ b/erts/emulator/beam/bif.h @@ -59,6 +59,8 @@ do { \ } while(0) #define BUMP_REDS(p, gc) do { \ + ASSERT(p); \ + ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(p));\ (p)->fcalls -= (gc); \ if ((p)->fcalls < 0) { \ if (!ERTS_PROC_GET_SAVED_CALLS_BUF((p))) \ diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab index 59a91cd40c..a79feb6da3 100644 --- a/erts/emulator/beam/bif.tab +++ b/erts/emulator/beam/bif.tab @@ -64,6 +64,7 @@ bif erlang:external_size/1 bif erlang:external_size/2 ubif erlang:float/1 bif erlang:float_to_list/1 +bif erlang:float_to_list/2 bif erlang:fun_info/2 bif erlang:garbage_collect/0 bif erlang:garbage_collect/1 diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c index 64cd93a100..145e6861f6 100644 --- a/erts/emulator/beam/dist.c +++ b/erts/emulator/beam/dist.c @@ -1729,7 +1729,7 @@ dsig_send(ErtsDSigData *dsdp, Eterm ctl, Eterm msg, int force_busy) data_size += erts_encode_dist_ext_size(ctl, flags, acmp); if (is_value(msg)) data_size += erts_encode_dist_ext_size(msg, flags, acmp); - erts_finalize_atom_cache_map(acmp); + erts_finalize_atom_cache_map(acmp, flags); dhdr_ext_size = erts_encode_ext_dist_header_size(acmp); data_size += dhdr_ext_size; @@ -2073,7 +2073,8 @@ erts_dist_command(Port *prt, int reds_limit) ASSERT(ob); do { ob->extp = erts_encode_ext_dist_header_finalize(ob->extp, - dep->cache); + dep->cache, + flags); if (!(flags & DFLAG_DIST_HDR_ATOM_CACHE)) *--ob->extp = PASS_THROUGH; /* Old node; 'pass through' needed */ @@ -2117,7 +2118,8 @@ erts_dist_command(Port *prt, int reds_limit) Uint size; oq.first->extp = erts_encode_ext_dist_header_finalize(oq.first->extp, - dep->cache); + dep->cache, + flags); reds += ERTS_PORT_REDS_DIST_CMD_FINALIZE; if (!(flags & DFLAG_DIST_HDR_ATOM_CACHE)) *--oq.first->extp = PASS_THROUGH; /* Old node; 'pass through' diff --git a/erts/emulator/beam/dist.h b/erts/emulator/beam/dist.h index 2bc3d9c881..310d09768d 100644 --- a/erts/emulator/beam/dist.h +++ b/erts/emulator/beam/dist.h @@ -38,7 +38,8 @@ #define DFLAG_UNICODE_IO 0x1000 #define DFLAG_DIST_HDR_ATOM_CACHE 0x2000 #define DFLAG_SMALL_ATOM_TAGS 0x4000 -#define DFLAGS_INTERNAL_TAGS 0x8000 +#define DFLAG_INTERNAL_TAGS 0x8000 +#define DFLAG_UTF8_ATOMS 0x10000 /* All flags that should be enabled when term_to_binary/1 is used. */ #define TERM_TO_BINARY_DFLAGS (DFLAG_EXTENDED_REFERENCES \ diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c index 5da8c69c03..007cdbdfa6 100644 --- a/erts/emulator/beam/erl_alloc.c +++ b/erts/emulator/beam/erl_alloc.c @@ -3062,13 +3062,13 @@ erts_request_alloc_info(struct process *c_p, Eterm alloc = CAR(consp); for (ai = ERTS_ALC_A_MIN; ai <= ERTS_ALC_A_MAX; ai++) - if (erts_is_atom_str((char *) erts_alc_a2ad[ai], alloc)) + if (erts_is_atom_str(erts_alc_a2ad[ai], alloc, 0)) goto save_alloc; - if (erts_is_atom_str("mseg_alloc", alloc)) { + if (erts_is_atom_str("mseg_alloc", alloc, 0)) { ai = ERTS_ALC_INFO_A_MSEG_ALLOC; goto save_alloc; } - if (erts_is_atom_str("alloc_util", alloc)) { + if (erts_is_atom_str("alloc_util", alloc, 0)) { ai = ERTS_ALC_INFO_A_ALLOC_UTIL; save_alloc: if (req_ai[ai]) diff --git a/erts/emulator/beam/erl_alloc.types b/erts/emulator/beam/erl_alloc.types index d4de0d076a..3d437652ce 100644 --- a/erts/emulator/beam/erl_alloc.types +++ b/erts/emulator/beam/erl_alloc.types @@ -49,6 +49,8 @@ # true after a "+enable X" statement or if it has been passed as a # command line argument to make_alloc_types. The variable X is false # after a "+disable X" statement or if it has never been mentioned. +# +# IMPORTANT! Only use 7-bit ascii text in this file! +if smp +disable threads_no_smp diff --git a/erts/emulator/beam/erl_alloc_util.c b/erts/emulator/beam/erl_alloc_util.c index 3d6761339b..6de0099636 100644 --- a/erts/emulator/beam/erl_alloc_util.c +++ b/erts/emulator/beam/erl_alloc_util.c @@ -2906,10 +2906,10 @@ make_name_atoms(Allctr_t *allctr) char alloc[] = "alloc"; char realloc[] = "realloc"; char free[] = "free"; - char buf[MAX_ATOM_LENGTH]; + char buf[MAX_ATOM_CHARACTERS]; size_t prefix_len = strlen(allctr->name_prefix); - if (prefix_len > MAX_ATOM_LENGTH + sizeof(realloc) - 1) + if (prefix_len > MAX_ATOM_CHARACTERS + sizeof(realloc) - 1) erl_exit(1,"Too long allocator name: %salloc\n",allctr->name_prefix); memcpy((void *) buf, (void *) allctr->name_prefix, prefix_len); diff --git a/erts/emulator/beam/erl_bif_ddll.c b/erts/emulator/beam/erl_bif_ddll.c index 7cbea55eac..889fefacfc 100644 --- a/erts/emulator/beam/erl_bif_ddll.c +++ b/erts/emulator/beam/erl_bif_ddll.c @@ -1835,7 +1835,10 @@ static Eterm build_load_error_hp(Eterm *hp, int code) static Eterm mkatom(char *str) { - return am_atom_put(str, sys_strlen(str)); + return erts_atom_put((byte *) str, + sys_strlen(str), + ERTS_ATOM_ENC_LATIN1, + 1); } static char *pick_list_or_atom(Eterm name_term) diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c index fabddffc68..b8026063e6 100755 --- a/erts/emulator/beam/erl_bif_info.c +++ b/erts/emulator/beam/erl_bif_info.c @@ -2298,8 +2298,10 @@ BIF_RETTYPE system_info_1(BIF_ALIST_1) for (i = num_instructions-1; i >= 0; i--) { res = erts_bld_cons(hpp, hszp, erts_bld_tuple(hpp, hszp, 2, - am_atom_put(opc[i].name, - strlen(opc[i].name)), + erts_atom_put(opc[i].name, + strlen(opc[i].name), + ERTS_ATOM_ENC_LATIN1, + 1), erts_bld_uint(hpp, hszp, opc[i].count)), res); @@ -3873,7 +3875,7 @@ static Eterm lcnt_build_lock_stats_term(Eterm **hpp, Uint *szp, erts_lcnt_lock_s timer_ns = stats->timer.ns; timer_n = stats->timer_n; - af = am_atom_put(stats->file, strlen(stats->file)); + af = erts_atom_put(stats->file, strlen(stats->file), ERTS_ATOM_ENC_LATIN1, 1); uil = erts_bld_uint( hpp, szp, line); tloc = erts_bld_tuple(hpp, szp, 2, af, uil); @@ -3910,13 +3912,13 @@ static Eterm lcnt_build_lock_term(Eterm **hpp, Uint *szp, erts_lcnt_lock_t *lock ASSERT(ltype); - type = am_atom_put(ltype, strlen(ltype)); - name = am_atom_put(lock->name, strlen(lock->name)); + type = erts_atom_put(ltype, strlen(ltype), ERTS_ATOM_ENC_LATIN1, 1); + name = erts_atom_put(lock->name, strlen(lock->name), ERTS_ATOM_ENC_LATIN1, 1); if (lock->flag & ERTS_LCNT_LT_ALLOC) { /* use allocator types names as id's for allocator locks */ ltype = (char *) ERTS_ALC_A2AD(signed_val(lock->id)); - id = am_atom_put(ltype, strlen(ltype)); + id = erts_atom_put(ltype, strlen(ltype), ERTS_ATOM_ENC_LATIN1, 1); } else if (lock->flag & ERTS_LCNT_LT_PROCLOCK) { /* use registered names as id's for process locks if available */ proc = erts_proc_lookup(lock->id); @@ -3956,12 +3958,12 @@ static Eterm lcnt_build_result_term(Eterm **hpp, Uint *szp, erts_lcnt_data_t *da dtns = erts_bld_uint( hpp, szp, data->duration.ns); tdt = erts_bld_tuple(hpp, szp, 2, dts, dtns); - adur = am_atom_put(str_duration, strlen(str_duration)); + adur = erts_atom_put(str_duration, strlen(str_duration), ERTS_ATOM_ENC_LATIN1, 1); tdur = erts_bld_tuple(hpp, szp, 2, adur, tdt); /* lock tuple */ - aloc = am_atom_put(str_locks, strlen(str_locks)); + aloc = erts_atom_put(str_locks, strlen(str_locks), ERTS_ATOM_ENC_LATIN1, 1); for (lock = data->current_locks->head; lock != NULL ; lock = lock->next ) { lloc = lcnt_build_lock_term(hpp, szp, lock, lloc); @@ -4097,14 +4099,14 @@ BIF_RETTYPE erts_debug_lock_counters_1(BIF_ALIST_1) static void os_info_init(void) { - Eterm type = am_atom_put(os_type, strlen(os_type)); + Eterm type = erts_atom_put((byte *) os_type, strlen(os_type), ERTS_ATOM_ENC_LATIN1, 1); Eterm flav; int major, minor, build; char* buf = erts_alloc(ERTS_ALC_T_TMP, 1024); /* More than enough */ Eterm* hp; os_flavor(buf, 1024); - flav = am_atom_put(buf, strlen(buf)); + flav = erts_atom_put((byte *) buf, strlen(buf), ERTS_ATOM_ENC_LATIN1, 1); erts_free(ERTS_ALC_T_TMP, (void *) buf); hp = erts_alloc(ERTS_ALC_T_LL_TEMP_TERM, (3+4)*sizeof(Eterm)); os_type_tuple = TUPLE2(hp, type, flav); diff --git a/erts/emulator/beam/erl_bif_port.c b/erts/emulator/beam/erl_bif_port.c index 81146e38d7..a4b837541b 100644 --- a/erts/emulator/beam/erl_bif_port.c +++ b/erts/emulator/beam/erl_bif_port.c @@ -66,7 +66,7 @@ BIF_RETTYPE open_port_2(BIF_ALIST_2) } else { str = "einval"; } - BIF_P->fvalue = am_atom_put(str, strlen(str)); + BIF_P->fvalue = erts_atom_put((byte *) str, strlen(str), ERTS_ATOM_ENC_LATIN1, 1); BIF_ERROR(BIF_P, EXC_ERROR); } diff --git a/erts/emulator/beam/erl_cpu_topology.c b/erts/emulator/beam/erl_cpu_topology.c index 3f90f34736..88456a85f3 100644 --- a/erts/emulator/beam/erl_cpu_topology.c +++ b/erts/emulator/beam/erl_cpu_topology.c @@ -34,7 +34,7 @@ #include "bif.h" #include "erl_cpu_topology.h" -#define ERTS_MAX_READER_GROUPS 8 +#define ERTS_MAX_READER_GROUPS 64 /* * Cpu topology hierarchy. @@ -620,30 +620,38 @@ write_schedulers_bind_change(erts_cpu_topology_t *cpudata, int size) int erts_init_scheduler_bind_type_string(char *how) { + ErtsCpuBindOrder order; + if (sys_strcmp(how, "u") == 0) - cpu_bind_order = ERTS_CPU_BIND_NONE; - else if (erts_bind_to_cpu(cpuinfo, -1) == -ENOTSUP) - return ERTS_INIT_SCHED_BIND_TYPE_NOT_SUPPORTED; - else if (!system_cpudata && !user_cpudata) - return ERTS_INIT_SCHED_BIND_TYPE_ERROR_NO_CPU_TOPOLOGY; + order = ERTS_CPU_BIND_NONE; else if (sys_strcmp(how, "db") == 0) - cpu_bind_order = ERTS_CPU_BIND_DEFAULT_BIND; + order = ERTS_CPU_BIND_DEFAULT_BIND; else if (sys_strcmp(how, "s") == 0) - cpu_bind_order = ERTS_CPU_BIND_SPREAD; + order = ERTS_CPU_BIND_SPREAD; else if (sys_strcmp(how, "ps") == 0) - cpu_bind_order = ERTS_CPU_BIND_PROCESSOR_SPREAD; + order = ERTS_CPU_BIND_PROCESSOR_SPREAD; else if (sys_strcmp(how, "ts") == 0) - cpu_bind_order = ERTS_CPU_BIND_THREAD_SPREAD; + order = ERTS_CPU_BIND_THREAD_SPREAD; else if (sys_strcmp(how, "tnnps") == 0) - cpu_bind_order = ERTS_CPU_BIND_THREAD_NO_NODE_PROCESSOR_SPREAD; + order = ERTS_CPU_BIND_THREAD_NO_NODE_PROCESSOR_SPREAD; else if (sys_strcmp(how, "nnps") == 0) - cpu_bind_order = ERTS_CPU_BIND_NO_NODE_PROCESSOR_SPREAD; + order = ERTS_CPU_BIND_NO_NODE_PROCESSOR_SPREAD; else if (sys_strcmp(how, "nnts") == 0) - cpu_bind_order = ERTS_CPU_BIND_NO_NODE_THREAD_SPREAD; + order = ERTS_CPU_BIND_NO_NODE_THREAD_SPREAD; else if (sys_strcmp(how, "ns") == 0) - cpu_bind_order = ERTS_CPU_BIND_NO_SPREAD; + order = ERTS_CPU_BIND_NO_SPREAD; else - return ERTS_INIT_SCHED_BIND_TYPE_ERROR_NO_BAD_TYPE; + return ERTS_INIT_SCHED_BIND_TYPE_ERROR_BAD_TYPE; + + if (order != ERTS_CPU_BIND_NONE) { + if (erts_bind_to_cpu(cpuinfo, -1) == -ENOTSUP) + return ERTS_INIT_SCHED_BIND_TYPE_NOT_SUPPORTED; + else if (!system_cpudata && !user_cpudata) + return ERTS_INIT_SCHED_BIND_TYPE_ERROR_NO_CPU_TOPOLOGY; + } + + cpu_bind_order = order; + return ERTS_INIT_SCHED_BIND_TYPE_SUCCESS; } diff --git a/erts/emulator/beam/erl_cpu_topology.h b/erts/emulator/beam/erl_cpu_topology.h index c5a9520b61..11915e1ea8 100644 --- a/erts/emulator/beam/erl_cpu_topology.h +++ b/erts/emulator/beam/erl_cpu_topology.h @@ -40,7 +40,7 @@ void erts_init_cpu_topology(void); #define ERTS_INIT_SCHED_BIND_TYPE_SUCCESS 0 #define ERTS_INIT_SCHED_BIND_TYPE_NOT_SUPPORTED 1 #define ERTS_INIT_SCHED_BIND_TYPE_ERROR_NO_CPU_TOPOLOGY 2 -#define ERTS_INIT_SCHED_BIND_TYPE_ERROR_NO_BAD_TYPE 3 +#define ERTS_INIT_SCHED_BIND_TYPE_ERROR_BAD_TYPE 3 int erts_init_scheduler_bind_type_string(char *how); diff --git a/erts/emulator/beam/erl_db.c b/erts/emulator/beam/erl_db.c index 48a95cdf32..7932966539 100644 --- a/erts/emulator/beam/erl_db.c +++ b/erts/emulator/beam/erl_db.c @@ -3830,7 +3830,7 @@ erts_ets_colliding_names(Process* p, Eterm name, Uint cnt) while (index >= atom_table_size()) { char tmp[20]; erts_snprintf(tmp, sizeof(tmp), "am%x", atom_table_size()); - am_atom_put(tmp,strlen(tmp)); + erts_atom_put((byte *) tmp, strlen(tmp), ERTS_ATOM_ENC_LATIN1, 1); } list = CONS(hp, make_atom(index), list); hp += 2; diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c index bb08762b26..58c4d75c31 100644 --- a/erts/emulator/beam/erl_db_util.c +++ b/erts/emulator/beam/erl_db_util.c @@ -4773,7 +4773,8 @@ static int match_compact(ErlHeapFragment *expr, DMCErrInfo *err_info) ASSERT(j < x); erts_snprintf(buff+1, sizeof(buff) - 1, "%u", (unsigned) j); /* Yes, writing directly into terms, they ARE off heap */ - *p = am_atom_put(buff, strlen(buff)); + *p = erts_atom_put((byte *) buff, strlen(buff), + ERTS_ATOM_ENC_LATIN1, 1); } ++p; } diff --git a/erts/emulator/beam/erl_driver.h b/erts/emulator/beam/erl_driver.h index 046b46513f..d50ba364d0 100644 --- a/erts/emulator/beam/erl_driver.h +++ b/erts/emulator/beam/erl_driver.h @@ -85,7 +85,7 @@ #include "erl_drv_nif.h" #include <stdlib.h> -#include <string.h> /* ssize_t on Mac OS X */ +#include <sys/types.h> /* ssize_t */ #if defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_) #ifndef STATIC_ERLANG_DRIVER diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c index 8cdf954dd2..61b3c09d16 100644 --- a/erts/emulator/beam/erl_init.c +++ b/erts/emulator/beam/erl_init.c @@ -55,6 +55,8 @@ # include <sys/resource.h> #endif +#define ERTS_DEFAULT_NO_ASYNC_THREADS 10 + /* * The variables below (prefixed with etp_) are for erts/etc/unix/etp-commands * only. Do not remove even though they aren't used elsewhere in the emulator! @@ -356,7 +358,7 @@ erl_first_process_otp(char* modname, void* code, unsigned size, int argc, char** ErlSpawnOpts so; Eterm env; - start_mod = am_atom_put(modname, sys_strlen(modname)); + start_mod = erts_atom_put((byte *) modname, sys_strlen(modname), ERTS_ATOM_ENC_LATIN1, 1); if (erts_find_function(start_mod, am_start, 2, erts_active_code_ix()) == NULL) { erl_exit(5, "No function %s:start/2\n", modname); @@ -453,7 +455,7 @@ load_preloaded(void) i = 0; while ((name = preload_p[i].name) != NULL) { length = preload_p[i].size; - module_name = am_atom_put(name, sys_strlen(name)); + module_name = erts_atom_put((byte *) name, sys_strlen(name), ERTS_ATOM_ENC_LATIN1, 1); if ((code = sys_preload_begin(&preload_p[i])) == 0) erl_exit(1, "Failed to find preloaded code for module %s\n", name); @@ -521,7 +523,7 @@ void erts_usage(void) erts_fprintf(stderr, "-r force ets memory block to be moved on realloc\n"); erts_fprintf(stderr, "-rg amount set reader groups limit\n"); erts_fprintf(stderr, "-sbt type set scheduler bind type, valid types are:\n"); - erts_fprintf(stderr, " u|ns|ts|ps|s|nnts|nnps|tnnps|db\n"); + erts_fprintf(stderr, "-stbt type u|ns|ts|ps|s|nnts|nnps|tnnps|db\n"); erts_fprintf(stderr, "-sbwt val set scheduler busy wait threshold, valid values are:\n"); erts_fprintf(stderr, " none|very_short|short|medium|long|very_long.\n"); erts_fprintf(stderr, "-scl bool enable/disable compaction of scheduler load,\n"); @@ -529,7 +531,7 @@ void erts_usage(void) erts_fprintf(stderr, "-sct cput set cpu topology,\n"); erts_fprintf(stderr, " see the erl(1) documentation for more info.\n"); erts_fprintf(stderr, "-sws val set scheduler wakeup strategy, valid values are:\n"); - erts_fprintf(stderr, " default|legacy|proposal.\n"); + erts_fprintf(stderr, " default|legacy.\n"); erts_fprintf(stderr, "-swt val set scheduler wakeup threshold, valid values are:\n"); erts_fprintf(stderr, " very_low|low|medium|high|very_high.\n"); erts_fprintf(stderr, "-sss size suggested stack size in kilo words for scheduler threads,\n"); @@ -631,7 +633,7 @@ early_init(int *argc, char **argv) /* erts_disable_tolerant_timeofday = 0; display_items = 200; erts_backtrace_depth = DEFAULT_BACKTRACE_SIZE; - erts_async_max_threads = 0; + erts_async_max_threads = ERTS_DEFAULT_NO_ASYNC_THREADS; erts_async_thread_suggested_stack_size = ERTS_ASYNC_THREAD_MIN_STACK_SIZE; H_MIN_SIZE = H_DEFAULT_SIZE; BIN_VH_MIN_SIZE = VH_DEFAULT_SIZE; @@ -700,7 +702,7 @@ early_init(int *argc, char **argv) /* if (erts_sys_getenv__("ERL_THREAD_POOL_SIZE", envbuf, &envbufsz) == 0) erts_async_max_threads = atoi(envbuf); else - erts_async_max_threads = 0; + erts_async_max_threads = ERTS_DEFAULT_NO_ASYNC_THREADS; if (erts_async_max_threads > ERTS_MAX_NO_OF_ASYNC_THREADS) erts_async_max_threads = ERTS_MAX_NO_OF_ASYNC_THREADS; @@ -1238,7 +1240,7 @@ erl_start(int argc, char **argv) case ERTS_INIT_SCHED_BIND_TYPE_ERROR_NO_CPU_TOPOLOGY: estr = "no cpu topology available"; break; - case ERTS_INIT_SCHED_BIND_TYPE_ERROR_NO_BAD_TYPE: + case ERTS_INIT_SCHED_BIND_TYPE_ERROR_BAD_TYPE: estr = "invalid type"; break; default: @@ -1333,6 +1335,16 @@ erl_start(int argc, char **argv) } else if (sys_strcmp("nsp", sub_param) == 0) erts_use_sender_punish = 0; + else if (has_prefix("tbt", sub_param)) { + arg = get_arg(sub_param+3, argv[i+1], &i); + res = erts_init_scheduler_bind_type_string(arg); + if (res == ERTS_INIT_SCHED_BIND_TYPE_ERROR_BAD_TYPE) { + erts_fprintf(stderr, + "setting scheduler bind type '%s' failed: invalid type\n", + arg); + erts_usage(); + } + } else if (sys_strcmp("wt", sub_param) == 0) { arg = get_arg(sub_param+2, argv[i+1], &i); if (erts_sched_set_wakeup_other_thresold(arg) != 0) { @@ -1520,6 +1532,14 @@ erl_start(int argc, char **argv) i++; } +/* Output format on windows for sprintf defaults to three exponents. + * We use two-exponent to mimic normal sprintf behaviour. + */ + +#if defined(__WIN32__) && defined(_TWO_DIGIT_EXPONENT) + _set_output_format(_TWO_DIGIT_EXPONENT); +#endif + /* Restart will not reinstall the break handler */ #ifdef __WIN32__ if (ignore_break) diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 1bd2d933b2..fb295c9a8a 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -743,16 +743,23 @@ int enif_get_atom(ErlNifEnv* env, Eterm atom, char* buf, unsigned len, { Atom* ap; ASSERT(encoding == ERL_NIF_LATIN1); - if (is_not_atom(atom)) { + if (is_not_atom(atom) || len==0) { return 0; } ap = atom_tab(atom_val(atom)); - if (ap->len+1 > len) { + + if (ap->latin1_chars < 0 || ap->latin1_chars >= len) { return 0; } - sys_memcpy(buf, ap->name, ap->len); - buf[ap->len] = '\0'; - return ap->len + 1; + if (ap->latin1_chars == ap->len) { + sys_memcpy(buf, ap->name, ap->len); + } + else { + int dlen = erts_utf8_to_latin1((byte*)buf, ap->name, ap->len); + ASSERT(dlen == ap->latin1_chars); (void)dlen; + } + buf[ap->latin1_chars] = '\0'; + return ap->latin1_chars + 1; } int enif_get_int(ErlNifEnv* env, Eterm term, int* ip) @@ -854,7 +861,10 @@ int enif_get_atom_length(ErlNifEnv* env, Eterm atom, unsigned* len, ASSERT(enc == ERL_NIF_LATIN1); if (is_not_atom(atom)) return 0; ap = atom_tab(atom_val(atom)); - *len = ap->len; + if (ap->latin1_chars < 0) { + return 0; + } + *len = ap->latin1_chars; return 1; } @@ -961,7 +971,7 @@ ERL_NIF_TERM enif_make_atom(ErlNifEnv* env, const char* name) ERL_NIF_TERM enif_make_atom_len(ErlNifEnv* env, const char* name, size_t len) { - return am_atom_put(name, len); + return erts_atom_put((byte*)name, len, ERTS_ATOM_ENC_LATIN1, 1); } int enif_make_existing_atom(ErlNifEnv* env, const char* name, ERL_NIF_TERM* atom, @@ -974,7 +984,7 @@ int enif_make_existing_atom_len(ErlNifEnv* env, const char* name, size_t len, ERL_NIF_TERM* atom, ErlNifCharEncoding encoding) { ASSERT(encoding == ERL_NIF_LATIN1); - return erts_atom_get(name, len, atom); + return erts_atom_get(name, len, atom, 1); } ERL_NIF_TERM enif_make_tuple(ErlNifEnv* env, unsigned cnt, ...) @@ -1633,7 +1643,7 @@ BIF_RETTYPE load_nif_2(BIF_ALIST_2) "this vm variant (%s).", entry->vm_variant, ERL_NIF_VM_VARIANT); } - else if (!erts_is_atom_str((char*)entry->name, mod_atom)) { + else if (!erts_is_atom_str((char*)entry->name, mod_atom, 1)) { ret = load_nif_error(BIF_P, bad_lib, "Library module name '%s' does not" " match calling module '%T'", entry->name, mod_atom); } @@ -1643,7 +1653,7 @@ BIF_RETTYPE load_nif_2(BIF_ALIST_2) for (i=0; i < entry->num_of_funcs && ret==am_ok; i++) { BeamInstr** code_pp; ErlNifFunc* f = &entry->funcs[i]; - if (!erts_atom_get(f->name, sys_strlen(f->name), &f_atom) + if (!erts_atom_get(f->name, sys_strlen(f->name), &f_atom, 1) || (code_pp = get_func_pp(mod->curr.code, f_atom, f->arity))==NULL) { ret = load_nif_error(BIF_P,bad_lib,"Function not found %T:%s/%u", mod_atom, f->name, f->arity); @@ -1746,7 +1756,7 @@ BIF_RETTYPE load_nif_2(BIF_ALIST_2) for (i=0; i < entry->num_of_funcs; i++) { BeamInstr* code_ptr; - erts_atom_get(entry->funcs[i].name, sys_strlen(entry->funcs[i].name), &f_atom); + erts_atom_get(entry->funcs[i].name, sys_strlen(entry->funcs[i].name), &f_atom, 1); code_ptr = *get_func_pp(mod->curr.code, f_atom, entry->funcs[i].arity); if (code_ptr[1] == 0) { diff --git a/erts/emulator/beam/erl_port.h b/erts/emulator/beam/erl_port.h index fb07f3d5bc..65b4cd0bfe 100644 --- a/erts/emulator/beam/erl_port.h +++ b/erts/emulator/beam/erl_port.h @@ -273,29 +273,28 @@ extern erts_smp_atomic_t erts_bytes_in; /* no bytes sent into the system */ (ERTS_PORT_SFLGS_INVALID_LOOKUP \ | ERTS_PORT_SFLG_DISTRIBUTION) - /* * Costs in reductions for some port operations. */ -#define ERTS_PORT_REDS_EXECUTE 10 -#define ERTS_PORT_REDS_FREE 100 -#define ERTS_PORT_REDS_TIMEOUT 400 -#define ERTS_PORT_REDS_INPUT 400 -#define ERTS_PORT_REDS_OUTPUT 400 -#define ERTS_PORT_REDS_EVENT 400 -#define ERTS_PORT_REDS_CMD_OUTPUTV 400 -#define ERTS_PORT_REDS_CMD_OUTPUT 400 -#define ERTS_PORT_REDS_EXIT 300 -#define ERTS_PORT_REDS_CONNECT 40 -#define ERTS_PORT_REDS_UNLINK 40 -#define ERTS_PORT_REDS_LINK 40 -#define ERTS_PORT_REDS_BADSIG 40 -#define ERTS_PORT_REDS_CONTROL 400 -#define ERTS_PORT_REDS_CALL 400 -#define ERTS_PORT_REDS_INFO 100 -#define ERTS_PORT_REDS_SET_DATA 40 -#define ERTS_PORT_REDS_GET_DATA 40 -#define ERTS_PORT_REDS_TERMINATE 200 +#define ERTS_PORT_REDS_EXECUTE (CONTEXT_REDS/4) +#define ERTS_PORT_REDS_FREE (CONTEXT_REDS/400) +#define ERTS_PORT_REDS_TIMEOUT (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_INPUT (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_OUTPUT (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_EVENT (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_CMD_OUTPUTV (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_CMD_OUTPUT (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_EXIT (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_CONNECT (CONTEXT_REDS/200) +#define ERTS_PORT_REDS_UNLINK (CONTEXT_REDS/200) +#define ERTS_PORT_REDS_LINK (CONTEXT_REDS/200) +#define ERTS_PORT_REDS_BADSIG (CONTEXT_REDS/200) +#define ERTS_PORT_REDS_CONTROL (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_CALL (CONTEXT_REDS/50) +#define ERTS_PORT_REDS_INFO (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_SET_DATA (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_GET_DATA (CONTEXT_REDS/100) +#define ERTS_PORT_REDS_TERMINATE (CONTEXT_REDS/50) void print_port_info(Port *, int, void *); void erts_port_free(Port *); diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c index 8ceadcdb8c..82c3e235b4 100644 --- a/erts/emulator/beam/erl_port_task.c +++ b/erts/emulator/beam/erl_port_task.c @@ -35,6 +35,11 @@ #include "dtrace-wrapper.h" #include <stdarg.h> +/* + * ERTS_PORT_CALLBACK_VREDS: Limit the amount of callback calls we do... + */ +#define ERTS_PORT_CALLBACK_VREDS (CONTEXT_REDS/20) + #if defined(DEBUG) && 0 #define ERTS_HARD_DEBUG_TASK_QUEUES #else @@ -1544,6 +1549,7 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp) ErtsPortTask *execq; int processing_busy_q; int res = 0; + int vreds = 0; int reds = ERTS_PORT_REDS_EXECUTE; erts_aint_t io_tasks_executed = 0; int fpe_was_unmasked; @@ -1688,6 +1694,9 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp) break; } + vreds += ERTS_PORT_CALLBACK_VREDS; + reds += ERTS_PORT_CALLBACK_VREDS; + if (reds >= CONTEXT_REDS) break; } @@ -1757,6 +1766,7 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp) res = (erts_smp_atomic_read_nob(&erts_port_task_outstanding_io_tasks) != (erts_aint_t) 0); + reds -= vreds; runq->scheduler->reductions += reds; ERTS_SMP_LC_ASSERT(erts_smp_lc_runq_is_locked(runq)); diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index aaca4b5f59..6e9bf7ca12 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -4080,11 +4080,11 @@ typedef enum { } ErtsSchedWakeupOtherThreshold; typedef enum { - ERTS_SCHED_WAKEUP_OTHER_TYPE_PROPOSAL, + ERTS_SCHED_WAKEUP_OTHER_TYPE_DEFAULT, ERTS_SCHED_WAKEUP_OTHER_TYPE_LEGACY } ErtsSchedWakeupOtherType; -/* First proposal */ +/* Default */ #define ERTS_WAKEUP_OTHER_LIMIT_VERY_HIGH (200*CONTEXT_REDS) #define ERTS_WAKEUP_OTHER_LIMIT_HIGH (50*CONTEXT_REDS) @@ -4101,7 +4101,7 @@ typedef enum { #define ERTS_WAKEUP_OTHER_DEC_SHIFT 2 #define ERTS_WAKEUP_OTHER_FIXED_INC (CONTEXT_REDS/10) -/* To be legacy */ +/* Legacy */ #define ERTS_WAKEUP_OTHER_LIMIT_VERY_HIGH_LEGACY (200*CONTEXT_REDS) #define ERTS_WAKEUP_OTHER_LIMIT_HIGH_LEGACY (50*CONTEXT_REDS) @@ -4239,7 +4239,7 @@ static void set_wakeup_other_data(void) { switch (wakeup_other.type) { - case ERTS_SCHED_WAKEUP_OTHER_TYPE_PROPOSAL: + case ERTS_SCHED_WAKEUP_OTHER_TYPE_DEFAULT: wakeup_other.check = wakeup_other_check; wakeup_other_set_limit(); break; @@ -4258,7 +4258,7 @@ erts_early_init_scheduling(int no_schedulers) aux_work_timeout_early_init(no_schedulers); #ifdef ERTS_SMP wakeup_other.threshold = ERTS_SCHED_WAKEUP_OTHER_THRESHOLD_MEDIUM; - wakeup_other.type = ERTS_SCHED_WAKEUP_OTHER_TYPE_LEGACY; + wakeup_other.type = ERTS_SCHED_WAKEUP_OTHER_TYPE_DEFAULT; #endif sched_busy_wait.sys_schedule = ERTS_SCHED_SYS_SLEEP_SPINCOUNT_MEDIUM; sched_busy_wait.tse = (ERTS_SCHED_SYS_SLEEP_SPINCOUNT_MEDIUM @@ -4294,10 +4294,8 @@ int erts_sched_set_wakeup_other_type(char *str) { ErtsSchedWakeupOtherType type; - if (sys_strcmp(str, "proposal") == 0) - type = ERTS_SCHED_WAKEUP_OTHER_TYPE_PROPOSAL; - else if (sys_strcmp(str, "default") == 0) - type = ERTS_SCHED_WAKEUP_OTHER_TYPE_LEGACY; + if (sys_strcmp(str, "default") == 0) + type = ERTS_SCHED_WAKEUP_OTHER_TYPE_DEFAULT; else if (sys_strcmp(str, "legacy") == 0) type = ERTS_SCHED_WAKEUP_OTHER_TYPE_LEGACY; else diff --git a/erts/emulator/beam/erl_unicode.c b/erts/emulator/beam/erl_unicode.c index 51559aea1c..883405d066 100644 --- a/erts/emulator/beam/erl_unicode.c +++ b/erts/emulator/beam/erl_unicode.c @@ -1154,15 +1154,24 @@ BIF_RETTYPE unicode_characters_to_list_2(BIF_ALIST_2) * When input to characters_to_list is a plain binary and the format is 'unicode', we do * a faster analyze and size count with this function. */ -int erts_analyze_utf8(byte *source, Uint size, - byte **err_pos, Uint *num_chars, int *left) +static ERTS_INLINE int +analyze_utf8(byte *source, Uint size, byte **err_pos, Uint *num_chars, int *left, + Sint *num_latin1_chars, Uint max_chars) { + Uint latin1_count; + int is_latin1; *err_pos = source; + if (num_latin1_chars) { + is_latin1 = 1; + latin1_count = 0; + } *num_chars = 0; while (size) { if (((*source) & ((byte) 0x80)) == 0) { source++; - --size; + --size; + if (num_latin1_chars) + latin1_count++; } else if (((*source) & ((byte) 0xE0)) == 0xC0) { if (size < 2) { return ERTS_UTF8_INCOMPLETE; @@ -1171,6 +1180,11 @@ int erts_analyze_utf8(byte *source, Uint size, ((*source) < 0xC2) /* overlong */) { return ERTS_UTF8_ERROR; } + if (num_latin1_chars) { + latin1_count++; + if ((source[0] & ((byte) 0xFC)) != ((byte) 0xC0)) + is_latin1 = 0; + } source += 2; size -= 2; } else if (((*source) & ((byte) 0xF0)) == 0xE0) { @@ -1188,6 +1202,8 @@ int erts_analyze_utf8(byte *source, Uint size, } source += 3; size -= 3; + if (num_latin1_chars) + is_latin1 = 0; } else if (((*source) & ((byte) 0xF8)) == 0xF0) { if (size < 4) { return ERTS_UTF8_INCOMPLETE; @@ -1205,21 +1221,40 @@ int erts_analyze_utf8(byte *source, Uint size, } source += 4; size -= 4; + if (num_latin1_chars) + is_latin1 = 0; } else { return ERTS_UTF8_ERROR; } ++(*num_chars); *err_pos = source; - if (left && --(*left) <= 0) { + if (max_chars && size > 0 && *num_chars == max_chars) + return ERTS_UTF8_OK_MAX_CHARS; + if (left && --(*left) <= 0 && size) { return ERTS_UTF8_ANALYZE_MORE; } } + if (num_latin1_chars) + *num_latin1_chars = is_latin1 ? latin1_count : -1; return ERTS_UTF8_OK; } +int erts_analyze_utf8(byte *source, Uint size, + byte **err_pos, Uint *num_chars, int *left) +{ + return analyze_utf8(source, size, err_pos, num_chars, left, NULL, 0); +} + +int erts_analyze_utf8_x(byte *source, Uint size, + byte **err_pos, Uint *num_chars, int *left, + Sint *num_latin1_chars, Uint max_chars) +{ + return analyze_utf8(source, size, err_pos, num_chars, left, num_latin1_chars, max_chars); +} + /* * No errors should be able to occur - no overlongs, no malformed, no nothing - */ + */ static Eterm do_utf8_to_list(Process *p, Uint num, byte *bytes, Uint sz, Uint left, Uint *num_built, Uint *num_eaten, Eterm tail) @@ -1275,6 +1310,12 @@ static Eterm do_utf8_to_list(Process *p, Uint num, byte *bytes, Uint sz, return ret; } +Eterm erts_utf8_to_list(Process *p, Uint num, byte *bytes, Uint sz, Uint left, + Uint *num_built, Uint *num_eaten, Eterm tail) +{ + return do_utf8_to_list(p, num, bytes, sz, left, num_built, num_eaten, tail); +} + static int is_candidate(Uint cp) { int index,pos; @@ -1812,31 +1853,25 @@ BIF_RETTYPE atom_to_binary_2(BIF_ALIST_2) ap = atom_tab(atom_val(BIF_ARG_1)); if (BIF_ARG_2 == am_latin1) { - BIF_RET(new_binary(BIF_P, ap->name, ap->len)); - } else if (BIF_ARG_2 == am_utf8 || BIF_ARG_2 == am_unicode) { - int bin_size = 0; - int i; Eterm bin_term; - byte* bin_p; - for (i = 0; i < ap->len; i++) { - bin_size += (ap->name[i] >= 0x80) ? 2 : 1; + if (ap->latin1_chars < 0) { + goto error; } - if (bin_size == ap->len) { - BIF_RET(new_binary(BIF_P, ap->name, ap->len)); + if (ap->latin1_chars == ap->len) { + bin_term = new_binary(BIF_P, ap->name, ap->len); } - bin_term = new_binary(BIF_P, 0, bin_size); - bin_p = binary_bytes(bin_term); - for (i = 0; i < ap->len; i++) { - byte b = ap->name[i]; - if (b < 0x80) { - *bin_p++ = b; - } else { - *bin_p++ = 0xC0 | (b >> 6); - *bin_p++ = 0x80 | (b & 0x3F); - } + else { + byte* bin_p; + int dbg_sz; + bin_term = new_binary(BIF_P, 0, ap->latin1_chars); + bin_p = binary_bytes(bin_term); + dbg_sz = erts_utf8_to_latin1(bin_p, ap->name, ap->len); + ASSERT(dbg_sz == ap->latin1_chars); (void)dbg_sz; } BIF_RET(bin_term); + } else if (BIF_ARG_2 == am_utf8 || BIF_ARG_2 == am_unicode) { + BIF_RET(new_binary(BIF_P, ap->name, ap->len)); } else { error: BIF_ERROR(BIF_P, BADARG); @@ -1844,118 +1879,78 @@ BIF_RETTYPE atom_to_binary_2(BIF_ALIST_2) } static BIF_RETTYPE -binary_to_atom(Process* p, Eterm bin, Eterm enc, int must_exist) +binary_to_atom(Process* proc, Eterm bin, Eterm enc, int must_exist) { byte* bytes; byte *temp_alloc = NULL; Uint bin_size; if ((bytes = erts_get_aligned_binary_bytes(bin, &temp_alloc)) == 0) { - BIF_ERROR(p, BADARG); + BIF_ERROR(proc, BADARG); } bin_size = binary_size(bin); if (enc == am_latin1) { Eterm a; - if (bin_size > MAX_ATOM_LENGTH) { + if (bin_size > MAX_ATOM_CHARACTERS) { system_limit: erts_free_aligned_binary_bytes(temp_alloc); - BIF_ERROR(p, SYSTEM_LIMIT); + BIF_ERROR(proc, SYSTEM_LIMIT); } if (!must_exist) { - a = am_atom_put((char *)bytes, bin_size); - erts_free_aligned_binary_bytes(temp_alloc); + a = erts_atom_put((byte *) bytes, + bin_size, + ERTS_ATOM_ENC_LATIN1, + 0); + erts_free_aligned_binary_bytes(temp_alloc); + if (is_non_value(a)) + goto badarg; BIF_RET(a); - } else if (erts_atom_get((char *)bytes, bin_size, &a)) { + } else if (erts_atom_get((char *)bytes, bin_size, &a, 1)) { erts_free_aligned_binary_bytes(temp_alloc); BIF_RET(a); } else { goto badarg; } } else if (enc == am_utf8 || enc == am_unicode) { - char *buf; - char *dst; - int i; - int num_chars; Eterm res; + Uint num_chars = 0; + const byte* p = bytes; + Uint left = bin_size; - if (bin_size > 2*MAX_ATOM_LENGTH) { - byte* err_pos; - Uint n; - int reds_left = bin_size+1; /* Number of reductions left. */ - - if (erts_analyze_utf8(bytes, bin_size, &err_pos, - &n, &reds_left) == ERTS_UTF8_OK) { - /* - * Correct UTF-8 encoding, but too many characters to - * fit in an atom. - */ + while (left) { + if (++num_chars > MAX_ATOM_CHARACTERS) { goto system_limit; - } else { - /* - * Something wrong in the UTF-8 encoding or Unicode code - * points > 255. - */ - goto badarg; } - } - - /* - * Allocate a temporary buffer the same size as the binary, - * so that we don't need an extra overflow test. - */ - buf = (char *) erts_alloc(ERTS_ALC_T_TMP, bin_size); - dst = buf; - for (i = 0; i < bin_size; i++) { - int c = bytes[i]; - if (c < 0x80) { - *dst++ = c; - } else if (i < bin_size-1) { - int c2; - if ((c & 0xE0) != 0xC0) { - goto free_badarg; - } - i++; - c = (c & 0x3F) << 6; - c2 = bytes[i]; - if ((c2 & 0xC0) != 0x80) { - goto free_badarg; - } - c = c | (c2 & 0x3F); - if (0x80 <= c && c < 256) { - *dst++ = c; - } else { - goto free_badarg; - } - } else { - free_badarg: - erts_free(ERTS_ALC_T_TMP, (void *) buf); - goto badarg; + if ((p[0] & 0x80) == 0) { + ++p; + --left; } + else if (left >= 2 + && (p[0] & 0xFE) == 0xC2 /* only allow latin1 subset */ + && (p[1] & 0xC0) == 0x80) { + p += 2; + left -= 2; + } + else goto badarg; } - num_chars = dst - buf; - if (num_chars > MAX_ATOM_LENGTH) { - erts_free(ERTS_ALC_T_TMP, (void *) buf); - goto system_limit; - } + if (!must_exist) { - res = am_atom_put(buf, num_chars); - erts_free(ERTS_ALC_T_TMP, (void *) buf); - erts_free_aligned_binary_bytes(temp_alloc); - BIF_RET(res); - } else { - int exists = erts_atom_get(buf, num_chars, &res); - erts_free(ERTS_ALC_T_TMP, (void *) buf); - if (exists) { - erts_free_aligned_binary_bytes(temp_alloc); - BIF_RET(res); - } else { - goto badarg; - } + res = erts_atom_put((byte *) bytes, + bin_size, + ERTS_ATOM_ENC_UTF8, + 0); + } + else if (!erts_atom_get((char*)bytes, bin_size, &res, 0)) { + goto badarg; } + erts_free_aligned_binary_bytes(temp_alloc); + if (is_non_value(res)) + goto badarg; + BIF_RET(res); } else { badarg: erts_free_aligned_binary_bytes(temp_alloc); - BIF_ERROR(p, BADARG); + BIF_ERROR(proc, BADARG); } } @@ -2670,3 +2665,28 @@ BIF_RETTYPE file_native_name_encoding_0(BIF_ALIST_0) } } +int erts_utf8_to_latin1(byte* dest, const byte* source, int slen) +{ + /* + * Assumes source contains valid utf8 that can be encoded as latin1, + * and that dest has enough room. + */ + byte* dp = dest; + + while (slen > 0) { + if ((source[0] & 0x80) == 0) { + *dp++ = *source++; + --slen; + } + else { + ASSERT(slen > 1); + ASSERT((source[0] & 0xFE) == 0xC2); + ASSERT((source[1] & 0xC0) == 0x80); + *dp++ = (char) ((source[0] << 6) | (source[1] & 0x3F)); + source += 2; + slen -= 2; + } + } + return dp - dest; +} + diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c index ab1065aaa1..8c4d9108d4 100644 --- a/erts/emulator/beam/external.c +++ b/erts/emulator/beam/external.c @@ -142,6 +142,7 @@ erts_init_atom_cache_map(ErtsAtomCacheMap *acmp) { if (acmp) { int ix; + acmp->long_atoms = 0; for (ix = 0; ix < ERTS_ATOM_CACHE_SIZE; ix++) acmp->cache[ix].iix = -1; acmp->sz = 0; @@ -154,6 +155,7 @@ erts_reset_atom_cache_map(ErtsAtomCacheMap *acmp) { if (acmp) { int i; + acmp->long_atoms = 0; for (i = 0; i < acmp->sz; i++) { ASSERT(0 <= acmp->cix[i] && acmp->cix[i] < ERTS_ATOM_CACHE_SIZE); acmp->cache[acmp->cix[i]].iix = -1; @@ -175,9 +177,23 @@ erts_destroy_atom_cache_map(ErtsAtomCacheMap *acmp) } static ERTS_INLINE void -insert_acache_map(ErtsAtomCacheMap *acmp, Eterm atom) +insert_acache_map(ErtsAtomCacheMap *acmp, Eterm atom, Uint32 dflags) { - if (acmp && acmp->sz < ERTS_MAX_INTERNAL_ATOM_CACHE_ENTRIES) { + /* + * If the receiver do not understand utf8 atoms + * and this atom cannot be represented in latin1, + * we are not allowed to cache it. + * + * In this case all atoms are assumed to have + * latin1 encoding in the cache. By refusing it + * in the cache we will instead encode it using + * ATOM_UTF8_EXT/SMALL_ATOM_UTF8_EXT which the + * receiver do not recognize and tear down the + * connection. + */ + if (acmp && acmp->sz < ERTS_MAX_INTERNAL_ATOM_CACHE_ENTRIES + && ((dflags & DFLAG_UTF8_ATOMS) + || atom_tab(atom_val(atom))->latin1_chars >= 0)) { int ix; ASSERT(acmp->hdr_sz < 0); ix = atom2cix(atom); @@ -190,7 +206,7 @@ insert_acache_map(ErtsAtomCacheMap *acmp, Eterm atom) } static ERTS_INLINE int -get_iix_acache_map(ErtsAtomCacheMap *acmp, Eterm atom) +get_iix_acache_map(ErtsAtomCacheMap *acmp, Eterm atom, Uint32 dflags) { if (!acmp) return -1; @@ -199,7 +215,9 @@ get_iix_acache_map(ErtsAtomCacheMap *acmp, Eterm atom) ASSERT(is_atom(atom)); ix = atom2cix(atom); if (acmp->cache[ix].iix < 0) { - ASSERT(acmp->sz == ERTS_MAX_INTERNAL_ATOM_CACHE_ENTRIES); + ASSERT(acmp->sz == ERTS_MAX_INTERNAL_ATOM_CACHE_ENTRIES + || (!(dflags & DFLAG_UTF8_ATOMS) + && atom_tab(atom_val(atom))->latin1_chars < 0)); return -1; } else { @@ -210,18 +228,17 @@ get_iix_acache_map(ErtsAtomCacheMap *acmp, Eterm atom) } void -erts_finalize_atom_cache_map(ErtsAtomCacheMap *acmp) +erts_finalize_atom_cache_map(ErtsAtomCacheMap *acmp, Uint32 dflags) { if (acmp) { -#if MAX_ATOM_LENGTH > 255 -#error "This code is not complete; long_atoms info need to be passed to the following stages." - int long_atoms = 0; /* !0 if one or more atoms are long than 255. */ -#endif + int utf8_atoms = (int) (dflags & DFLAG_UTF8_ATOMS); + int long_atoms = 0; /* !0 if one or more atoms are longer than 255. */ int i; int sz; int fix_sz = 1 /* VERSION_MAGIC */ + 1 /* DIST_HEADER */ + + 1 /* dist header flags */ + 1 /* number of internal cache entries */ ; int min_sz; @@ -230,22 +247,23 @@ erts_finalize_atom_cache_map(ErtsAtomCacheMap *acmp) min_sz = fix_sz+(2+4)*acmp->sz; sz = fix_sz; for (i = 0; i < acmp->sz; i++) { + Atom *a; Eterm atom; int len; atom = acmp->cache[acmp->cix[i]].atom; ASSERT(is_atom(atom)); - len = atom_tab(atom_val(atom))->len; -#if MAX_ATOM_LENGTH > 255 + a = atom_tab(atom_val(atom)); + len = (int) (utf8_atoms ? a->len : a->latin1_chars); + ASSERT(len >= 0); if (!long_atoms && len > 255) long_atoms = 1; -#endif /* Enough for a new atom cache value */ sz += 1 /* cix */ + 1 /* length */ + len /* text */; } -#if MAX_ATOM_LENGTH > 255 - if (long_atoms) + if (long_atoms) { + acmp->long_atoms = 1; sz += acmp->sz; /* we need 2 bytes per atom for length */ -#endif + } /* Dynamically sized flag field */ sz += ERTS_DIST_HDR_ATOM_CACHE_FLAG_BYTES(acmp->sz); if (sz < min_sz) @@ -274,6 +292,7 @@ byte *erts_encode_ext_dist_header_setup(byte *ctl_ext, ErtsAtomCacheMap *acmp) else { int i; byte *ep = ctl_ext; + byte dist_hdr_flags = acmp->long_atoms ? ERTS_DIST_HDR_LONG_ATOMS_FLG : 0; ASSERT(acmp->hdr_sz >= 0); /* * Write cache update instructions. Note that this is a purely @@ -296,28 +315,36 @@ byte *erts_encode_ext_dist_header_setup(byte *ctl_ext, ErtsAtomCacheMap *acmp) } --ep; put_int8(acmp->sz, ep); + --ep; + put_int8(dist_hdr_flags, ep); *--ep = DIST_HEADER; *--ep = VERSION_MAGIC; return ep; } } -byte *erts_encode_ext_dist_header_finalize(byte *ext, ErtsAtomCache *cache) +byte *erts_encode_ext_dist_header_finalize(byte *ext, ErtsAtomCache *cache, Uint32 dflags) { byte *ip; byte instr_buf[(2+4)*ERTS_ATOM_CACHE_SIZE]; int ci, sz; + byte dist_hdr_flags; + int long_atoms; + int utf8_atoms = (int) (dflags & DFLAG_UTF8_ATOMS); register byte *ep = ext; ASSERT(ep[0] == VERSION_MAGIC); if (ep[1] != DIST_HEADER) return ext; + dist_hdr_flags = ep[2]; + long_atoms = ERTS_DIST_HDR_LONG_ATOMS_FLG & ((int) dist_hdr_flags); + /* * Update output atom cache and write the external version of * the dist header. We write the header backwards just * before the actual term(s). */ - ep += 2; + ep += 3; ci = (int) get_int8(ep); ASSERT(0 <= ci && ci < ERTS_ATOM_CACHE_SIZE); ep += 1; @@ -342,12 +369,7 @@ byte *erts_encode_ext_dist_header_finalize(byte *ext, ErtsAtomCache *cache) flgs_bytes = ERTS_DIST_HDR_ATOM_CACHE_FLAG_BYTES(ci); ASSERT(flgs_bytes <= sizeof(flgs_buf)); -#if MAX_ATOM_LENGTH > 255 - /* long_atoms info needs to be passed from previous stages */ - if (long_atoms) - flgs |= ERTS_DIST_HDR_LONG_ATOMS_FLG; -#endif - flgs = 0; + flgs = (Uint32) dist_hdr_flags; flgs_buf_ix = 0; if ((ci & 1) == 0) used_half_bytes = 2; @@ -382,17 +404,22 @@ byte *erts_encode_ext_dist_header_finalize(byte *ext, ErtsAtomCache *cache) Atom *a; cache->out_arr[cix] = atom; a = atom_tab(atom_val(atom)); - sz = a->len; - ep -= sz; - sys_memcpy((void *) ep, (void *) a->name, sz); -#if MAX_ATOM_LENGTH > 255 + if (utf8_atoms) { + sz = a->len; + ep -= sz; + sys_memcpy((void *) ep, (void *) a->name, sz); + } + else { + ASSERT(0 <= a->latin1_chars && a->latin1_chars <= MAX_ATOM_CHARACTERS); + ep -= a->latin1_chars; + sz = erts_utf8_to_latin1(ep, a->name, a->len); + ASSERT(a->latin1_chars == sz); + } if (long_atoms) { ep -= 2; put_int16(sz, ep); } - else -#endif - { + else { ASSERT(0 <= sz && sz <= 255); --ep; put_int8(sz, ep); @@ -467,7 +494,7 @@ Uint erts_encode_ext_size_2(Eterm term, unsigned dflags) Uint erts_encode_ext_size_ets(Eterm term) { - return encode_size_struct2(NULL, term, TERM_TO_BINARY_DFLAGS|DFLAGS_INTERNAL_TAGS); + return encode_size_struct2(NULL, term, TERM_TO_BINARY_DFLAGS|DFLAG_INTERNAL_TAGS); } @@ -500,7 +527,7 @@ void erts_encode_ext(Eterm term, byte **ext) byte* erts_encode_ext_ets(Eterm term, byte *ep, struct erl_off_heap_header** off_heap) { - return enc_term(NULL, term, ep, TERM_TO_BINARY_DFLAGS|DFLAGS_INTERNAL_TAGS, + return enc_term(NULL, term, ep, TERM_TO_BINARY_DFLAGS|DFLAG_INTERNAL_TAGS, off_heap); } @@ -553,6 +580,7 @@ erts_prepare_dist_ext(ErtsDistExternal *edep, #endif register byte *ep = ext; + int utf8_atoms = (int) (dep->flags & DFLAG_UTF8_ATOMS); edep->heap_size = -1; edep->ext_endp = ext+size; @@ -611,9 +639,7 @@ erts_prepare_dist_ext(ErtsDistExternal *edep, ERTS_EXT_HDR_FAIL; ep++; if (no_atoms) { -#if MAX_ATOM_LENGTH > 255 int long_atoms = 0; -#endif #ifdef DEBUG byte *flgs_buf = ep; #endif @@ -632,14 +658,8 @@ erts_prepare_dist_ext(ErtsDistExternal *edep, */ byte_ix = ERTS_DIST_HDR_ATOM_CACHE_FLAG_BYTE_IX(no_atoms); bit_ix = ERTS_DIST_HDR_ATOM_CACHE_FLAG_BIT_IX(no_atoms); - if (flgsp[byte_ix] & (((byte) ERTS_DIST_HDR_LONG_ATOMS_FLG) - << bit_ix)) { -#if MAX_ATOM_LENGTH > 255 + if (flgsp[byte_ix] & (((byte) ERTS_DIST_HDR_LONG_ATOMS_FLG) << bit_ix)) long_atoms = 1; -#else - ERTS_EXT_HDR_FAIL; /* Long atoms not supported yet */ -#endif - } #ifdef DEBUG byte_ix = 0; @@ -707,23 +727,25 @@ erts_prepare_dist_ext(ErtsDistExternal *edep, if (cix >= ERTS_ATOM_CACHE_SIZE) ERTS_EXT_HDR_FAIL; ep++; -#if MAX_ATOM_LENGTH > 255 if (long_atoms) { CHKSIZE(2); len = get_int16(ep); ep += 2; } - else -#endif - { + else { CHKSIZE(1); len = get_int8(ep); ep++; } - if (len > MAX_ATOM_LENGTH) - ERTS_EXT_HDR_FAIL; /* Too long atom */ CHKSIZE(len); - atom = am_atom_put((char *) ep, len); + atom = erts_atom_put((byte *) ep, + len, + (utf8_atoms + ? ERTS_ATOM_ENC_UTF8 + : ERTS_ATOM_ENC_LATIN1), + 0); + if (is_non_value(atom)) + ERTS_EXT_HDR_FAIL; ep += len; cache->in_arr[cix] = atom; edep->attab.atom[tix] = atom; @@ -1404,11 +1426,12 @@ static byte* enc_atom(ErtsAtomCacheMap *acmp, Eterm atom, byte *ep, Uint32 dflags) { int iix; - int i, j; + int len; + int utf8_atoms = (int) (dflags & DFLAG_UTF8_ATOMS); ASSERT(is_atom(atom)); - if (dflags & DFLAGS_INTERNAL_TAGS) { + if (dflags & DFLAG_INTERNAL_TAGS) { Uint aval = atom_val(atom); ASSERT(aval < (1<<24)); if (aval >= (1 << 16)) { @@ -1423,27 +1446,46 @@ enc_atom(ErtsAtomCacheMap *acmp, Eterm atom, byte *ep, Uint32 dflags) } return ep; } + /* * term_to_binary/1,2 and the initial distribution message * don't use the cache. */ - iix = get_iix_acache_map(acmp, atom); - if (iix < 0) { - i = atom_val(atom); - j = atom_tab(i)->len; - if ((MAX_ATOM_LENGTH <= 255 || j <= 255) - && (dflags & DFLAG_SMALL_ATOM_TAGS)) { - *ep++ = SMALL_ATOM_EXT; - put_int8(j, ep); - ep++; + + iix = get_iix_acache_map(acmp, atom, dflags); + if (iix < 0) { + Atom *a = atom_tab(atom_val(atom)); + if (utf8_atoms || a->latin1_chars < 0) { + len = a->len; + if (len > 255) { + *ep++ = ATOM_UTF8_EXT; + put_int16(len, ep); + ep += 2; + } + else { + *ep++ = SMALL_ATOM_UTF8_EXT; + put_int8(len, ep); + ep += 1; + } + sys_memcpy((char *) ep, (char *) a->name, len); } else { - *ep++ = ATOM_EXT; - put_int16(j, ep); - ep += 2; + if (a->latin1_chars <= 255 && (dflags & DFLAG_SMALL_ATOM_TAGS)) { + *ep++ = SMALL_ATOM_EXT; + len = erts_utf8_to_latin1(ep+1, a->name, a->len); + ASSERT(len == a->latin1_chars); + put_int8(len, ep); + ep++; + } + else { + *ep++ = ATOM_EXT; + len = erts_utf8_to_latin1(ep+2, a->name, a->len); + ASSERT(len == a->latin1_chars); + put_int16(len, ep); + ep += 2; + } } - sys_memcpy((char *) ep, (char*)atom_tab(i)->name, (int) j); - ep += j; + ep += len; return ep; } @@ -1472,7 +1514,7 @@ enc_pid(ErtsAtomCacheMap *acmp, Eterm pid, byte* ep, Uint32 dflags) ep += 4; put_int32(os, ep); ep += 4; - *ep++ = (is_internal_pid(pid) && (dflags & DFLAGS_INTERNAL_TAGS)) ? + *ep++ = (is_internal_pid(pid) && (dflags & DFLAG_INTERNAL_TAGS)) ? INTERNAL_CREATION : pid_creation(pid); return ep; } @@ -1482,7 +1524,7 @@ static byte* dec_atom(ErtsDistExternal *edep, byte* ep, Eterm* objp) { Uint len; - int n; + int n, is_latin1; switch (*ep++) { case ATOM_CACHE_REF: @@ -1498,17 +1540,37 @@ dec_atom(ErtsDistExternal *edep, byte* ep, Eterm* objp) case ATOM_EXT: len = get_int16(ep), ep += 2; + is_latin1 = 1; goto dec_atom_common; case SMALL_ATOM_EXT: len = get_int8(ep); ep++; + is_latin1 = 1; + goto dec_atom_common; + case ATOM_UTF8_EXT: + len = get_int16(ep), + ep += 2; + is_latin1 = 0; + goto dec_atom_common; + case SMALL_ATOM_UTF8_EXT: + len = get_int8(ep), + ep++; + is_latin1 = 0; dec_atom_common: if (edep && (edep->flags & ERTS_DIST_EXT_BTT_SAFE)) { - if (!erts_atom_get((char*)ep, len, objp)) { + if (!erts_atom_get((char*)ep, len, objp, is_latin1)) { goto error; } } else { - *objp = am_atom_put((char*)ep, len); + Eterm atom = erts_atom_put(ep, + len, + (is_latin1 + ? ERTS_ATOM_ENC_LATIN1 + : ERTS_ATOM_ENC_UTF8), + 0); + if (is_non_value(atom)) + goto error; + *objp = atom; } ep += len; break; @@ -1770,7 +1832,7 @@ enc_term(ErtsAtomCacheMap *acmp, Eterm obj, byte* ep, Uint32 dflags, put_int16(i, ep); ep += 2; ep = enc_atom(acmp,ref_node_name(obj),ep,dflags); - *ep++ = ((dflags & DFLAGS_INTERNAL_TAGS) && is_internal_ref(obj)) ? + *ep++ = ((dflags & DFLAG_INTERNAL_TAGS) && is_internal_ref(obj)) ? INTERNAL_CREATION : ref_creation(obj); ref_num = ref_numbers(obj); for (j = 0; j < i; j++) { @@ -1787,7 +1849,7 @@ enc_term(ErtsAtomCacheMap *acmp, Eterm obj, byte* ep, Uint32 dflags, j = port_number(obj); put_int32(j, ep); ep += 4; - *ep++ = ((dflags & DFLAGS_INTERNAL_TAGS) && is_internal_port(obj)) ? + *ep++ = ((dflags & DFLAG_INTERNAL_TAGS) && is_internal_port(obj)) ? INTERNAL_CREATION : port_creation(obj); break; @@ -1868,7 +1930,7 @@ enc_term(ErtsAtomCacheMap *acmp, Eterm obj, byte* ep, Uint32 dflags, byte* bytes; ERTS_GET_BINARY_BYTES(obj, bytes, bitoffs, bitsize); - if (dflags & DFLAGS_INTERNAL_TAGS) { + if (dflags & DFLAG_INTERNAL_TAGS) { ProcBin* pb = (ProcBin*) binary_val(obj); Uint bytesize = pb->size; if (pb->thing_word == HEADER_SUB_BIN) { @@ -2113,7 +2175,7 @@ static byte* dec_term(ErtsDistExternal *edep, Eterm** hpp, byte* ep, ErlOffHeap* off_heap, Eterm* objp) { Eterm* hp_saved = *hpp; - int n; + int n, is_latin1; register Eterm* hp = *hpp; /* Please don't take the address of hp */ Eterm* next = objp; @@ -2199,17 +2261,37 @@ dec_term(ErtsDistExternal *edep, Eterm** hpp, byte* ep, ErlOffHeap* off_heap, Et case ATOM_EXT: n = get_int16(ep); ep += 2; - goto dec_term_atom_common; + is_latin1 = 1; + goto dec_term_atom_common; case SMALL_ATOM_EXT: n = get_int8(ep); ep++; + is_latin1 = 1; + goto dec_term_atom_common; + case ATOM_UTF8_EXT: + n = get_int16(ep); + ep += 2; + is_latin1 = 0; + goto dec_term_atom_common; + case SMALL_ATOM_UTF8_EXT: + n = get_int8(ep); + ep++; + is_latin1 = 0; dec_term_atom_common: if (edep && (edep->flags & ERTS_DIST_EXT_BTT_SAFE)) { - if (!erts_atom_get((char*)ep, n, objp)) { + if (!erts_atom_get((char*)ep, n, objp, is_latin1)) { goto error; } } else { - *objp = am_atom_put((char*)ep, n); + Eterm atom = erts_atom_put(ep, + n, + (is_latin1 + ? ERTS_ATOM_ENC_LATIN1 + : ERTS_ATOM_ENC_UTF8), + 0); + if (is_non_value(atom)) + goto error; + *objp = atom; } ep += n; break; @@ -2869,7 +2951,7 @@ encode_size_struct2(ErtsAtomCacheMap *acmp, Eterm obj, unsigned dflags) result++; break; case ATOM_DEF: - if (dflags & DFLAGS_INTERNAL_TAGS) { + if (dflags & DFLAG_INTERNAL_TAGS) { if (atom_val(obj) >= (1<<16)) { result += 1 + 3; } @@ -2878,17 +2960,22 @@ encode_size_struct2(ErtsAtomCacheMap *acmp, Eterm obj, unsigned dflags) } } else { - int alen = atom_tab(atom_val(obj))->len; - if ((MAX_ATOM_LENGTH <= 255 || alen <= 255) - && (dflags & DFLAG_SMALL_ATOM_TAGS)) { - /* Make sure a SMALL_ATOM_EXT fits: SMALL_ATOM_EXT l t1 t2... */ - result += 1 + 1 + alen; + Atom *a = atom_tab(atom_val(obj)); + int alen; + if ((dflags & DFLAG_UTF8_ATOMS) || a->latin1_chars < 0) { + alen = a->len; + result += 1 + 1 + alen; + if (alen > 255) { + result++; /* ATOM_UTF8_EXT (not small) */ + } } else { - /* Make sure an ATOM_EXT fits: ATOM_EXT l1 l0 t1 t2... */ - result += 1 + 2 + alen; + alen = a->latin1_chars; + result += 1 + 1 + alen; + if (alen > 255 || !(dflags & DFLAG_SMALL_ATOM_TAGS)) + result++; /* ATOM_EXT (not small) */ } - insert_acache_map(acmp, obj); + insert_acache_map(acmp, obj, dflags); } break; case SMALL_DEF: @@ -2969,7 +3056,7 @@ encode_size_struct2(ErtsAtomCacheMap *acmp, Eterm obj, unsigned dflags) } break; case BINARY_DEF: - if (dflags & DFLAGS_INTERNAL_TAGS) { + if (dflags & DFLAG_INTERNAL_TAGS) { ProcBin* pb = (ProcBin*) binary_val(obj); Uint sub_extra = 0; Uint tot_bytes = pb->size; @@ -3058,6 +3145,17 @@ encode_size_struct2(ErtsAtomCacheMap *acmp, Eterm obj, unsigned dflags) return result; } +static int is_valid_utf8_atom(byte* bytes, Uint nbytes) +{ + byte* err_pos; + Uint num_chars; + + /*SVERK Do we really need to validate correct utf8? */ + return nbytes <= MAX_ATOM_SZ_LIMIT + && erts_analyze_utf8(bytes, nbytes, &err_pos, &num_chars, NULL) == ERTS_UTF8_OK + && num_chars <= MAX_ATOM_CHARACTERS; +} + static Sint decoded_size(byte *ep, byte* endp, int internal_tags) { @@ -3125,21 +3223,41 @@ decoded_size(byte *ep, byte* endp, int internal_tags) case ATOM_EXT: CHKSIZE(2); n = get_int16(ep); - if (n > MAX_ATOM_LENGTH) { + if (n > MAX_ATOM_CHARACTERS) { return -1; } SKIP(n+2+atom_extra_skip); atom_extra_skip = 0; break; + case ATOM_UTF8_EXT: + CHKSIZE(2); + n = get_int16(ep); + ep += 2; + if (!is_valid_utf8_atom(ep, n)) { + return -1; + } + SKIP(n+atom_extra_skip); + atom_extra_skip = 0; + break; case SMALL_ATOM_EXT: CHKSIZE(1); n = get_int8(ep); - if (n > MAX_ATOM_LENGTH) { + if (n > MAX_ATOM_CHARACTERS) { return -1; } SKIP(n+1+atom_extra_skip); atom_extra_skip = 0; break; + case SMALL_ATOM_UTF8_EXT: + CHKSIZE(1); + n = get_int8(ep); + ep++; + if (!is_valid_utf8_atom(ep, n)) { + return -1; + } + SKIP(n+atom_extra_skip); + atom_extra_skip = 0; + break; case ATOM_CACHE_REF: SKIP(1+atom_extra_skip); atom_extra_skip = 0; diff --git a/erts/emulator/beam/external.h b/erts/emulator/beam/external.h index eddd4571dd..ad430117c8 100644 --- a/erts/emulator/beam/external.h +++ b/erts/emulator/beam/external.h @@ -51,6 +51,8 @@ #define NEW_FUN_EXT 'p' #define EXPORT_EXT 'q' #define FUN_EXT 'u' +#define ATOM_UTF8_EXT 'v' +#define SMALL_ATOM_UTF8_EXT 'w' #define DIST_HEADER 'D' #define ATOM_CACHE_REF 'R' @@ -90,6 +92,7 @@ typedef struct cache { typedef struct { int hdr_sz; int sz; + int long_atoms; int cix[ERTS_ATOM_CACHE_SIZE]; struct { Eterm atom; @@ -150,12 +153,12 @@ typedef struct { void erts_init_atom_cache_map(ErtsAtomCacheMap *); void erts_reset_atom_cache_map(ErtsAtomCacheMap *); void erts_destroy_atom_cache_map(ErtsAtomCacheMap *); -void erts_finalize_atom_cache_map(ErtsAtomCacheMap *); +void erts_finalize_atom_cache_map(ErtsAtomCacheMap *, Uint32); Uint erts_encode_ext_dist_header_size(ErtsAtomCacheMap *); Uint erts_encode_ext_dist_header_size(ErtsAtomCacheMap *); byte *erts_encode_ext_dist_header_setup(byte *, ErtsAtomCacheMap *); -byte *erts_encode_ext_dist_header_finalize(byte *, ErtsAtomCache *); +byte *erts_encode_ext_dist_header_finalize(byte *, ErtsAtomCache *, Uint32); Uint erts_encode_dist_ext_size(Eterm, Uint32, ErtsAtomCacheMap *); void erts_encode_dist_ext(Eterm, byte **, Uint32, ErtsAtomCacheMap *); diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h index 298241618f..41c2a0f2b9 100755 --- a/erts/emulator/beam/global.h +++ b/erts/emulator/beam/global.h @@ -786,16 +786,23 @@ Sint erts_native_filename_need(Eterm ioterm, int encoding); void erts_copy_utf8_to_utf16_little(byte *target, byte *bytes, int num_chars); int erts_analyze_utf8(byte *source, Uint size, byte **err_pos, Uint *num_chars, int *left); +int erts_analyze_utf8_x(byte *source, Uint size, + byte **err_pos, Uint *num_chars, int *left, + Sint *num_latin1_chars, Uint max_chars); char *erts_convert_filename_to_native(Eterm name, char *statbuf, size_t statbuf_size, ErtsAlcType_t alloc_type, int allow_empty, int allow_atom, Sint *used /* out */); Eterm erts_convert_native_to_filename(Process *p, byte *bytes); +Eterm erts_utf8_to_list(Process *p, Uint num, byte *bytes, Uint sz, Uint left, + Uint *num_built, Uint *num_eaten, Eterm tail); +int erts_utf8_to_latin1(byte* dest, const byte* source, int slen); #define ERTS_UTF8_OK 0 #define ERTS_UTF8_INCOMPLETE 1 #define ERTS_UTF8_ERROR 2 #define ERTS_UTF8_ANALYZE_MORE 3 +#define ERTS_UTF8_OK_MAX_CHARS 4 void bin_write(int, void*, byte*, size_t); int intlist_to_buf(Eterm, char*, int); /* most callers pass plain char*'s */ diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index e466f0e299..536a3cc819 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -663,8 +663,11 @@ erts_open_driver(erts_driver_t* driver, /* Pointer to driver. */ if (IS_TRACED_FL(port, F_TRACE_PORTS)) { trace_port_open(port, - pid, - am_atom_put(port->name, strlen(port->name))); + pid, + erts_atom_put((byte *) port->name, + strlen(port->name), + ERTS_ATOM_ENC_LATIN1, + 1)); } error_number = error_type = 0; @@ -1573,6 +1576,8 @@ bad_port_signal(Process *c_p, try_call_state.state, flags & ERTS_PORT_SIG_FLG_BAD_OUTPUT); finalize_imm_drv_call(&try_call_state); + if (c_p) + BUMP_REDS(c_p, ERTS_PORT_REDS_BADSIG); return ERTS_PORT_OP_BADARG; case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: return ERTS_PORT_OP_DROPPED; @@ -1950,10 +1955,11 @@ erts_port_output(Process *c_p, driver_free_binary(cbin); if (evp != &ev) erts_free(ERTS_ALC_T_TMP, evp); - if (try_call_res == ERTS_TRY_IMM_DRV_CALL_OK) - return ERTS_PORT_OP_DONE; - else + if (try_call_res != ERTS_TRY_IMM_DRV_CALL_OK) return ERTS_PORT_OP_DROPPED; + if (c_p) + BUMP_REDS(c_p, ERTS_PORT_REDS_CMD_OUTPUTV); + return ERTS_PORT_OP_DONE; case ERTS_TRY_IMM_DRV_CALL_INVALID_SCHED_FLAGS: sched_flags = try_call_state.sched_flags; case ERTS_TRY_IMM_DRV_CALL_BUSY_LOCK: @@ -2096,10 +2102,11 @@ erts_port_output(Process *c_p, /* Fall through... */ case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: erts_free(ERTS_ALC_T_TMP, buf); - if (try_call_res == ERTS_TRY_IMM_DRV_CALL_OK) - return ERTS_PORT_OP_DONE; - else + if (try_call_res != ERTS_TRY_IMM_DRV_CALL_OK) return ERTS_PORT_OP_DROPPED; + if (c_p) + BUMP_REDS(c_p, ERTS_PORT_REDS_CMD_OUTPUT); + return ERTS_PORT_OP_DONE; case ERTS_TRY_IMM_DRV_CALL_INVALID_SCHED_FLAGS: sched_flags = try_call_state.sched_flags; case ERTS_TRY_IMM_DRV_CALL_BUSY_LOCK: @@ -2267,6 +2274,8 @@ erts_port_exit(Process *c_p, reason, flags & ERTS_PORT_SIG_FLG_BROKEN_LINK); finalize_imm_drv_call(&try_call_state); + if (res == ERTS_PORT_OP_DONE && c_p) + BUMP_REDS(c_p, ERTS_PORT_REDS_EXIT); return res; } case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: @@ -2434,6 +2443,8 @@ erts_port_connect(Process *c_p, try_call_state.state, connect_id); finalize_imm_drv_call(&try_call_state); + if (res == ERTS_PORT_OP_DONE) + BUMP_REDS(c_p, ERTS_PORT_REDS_CONNECT); return res; } case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: @@ -2492,6 +2503,7 @@ erts_port_unlink(Process *c_p, Port *prt, Eterm from, Eterm *refp) case ERTS_TRY_IMM_DRV_CALL_OK: port_unlink(prt, from); finalize_imm_drv_call(&try_call_state); + BUMP_REDS(c_p, ERTS_PORT_REDS_UNLINK); return ERTS_PORT_OP_DONE; case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: return ERTS_PORT_OP_DROPPED; @@ -2579,6 +2591,7 @@ erts_port_link(Process *c_p, Port *prt, Eterm to, Eterm *refp) case ERTS_TRY_IMM_DRV_CALL_OK: port_link(prt, try_call_state.state, to); finalize_imm_drv_call(&try_call_state); + BUMP_REDS(c_p, ERTS_PORT_REDS_LINK); return ERTS_PORT_OP_DONE; case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: return ERTS_PORT_OP_BADARG; @@ -2667,8 +2680,11 @@ static ERTS_INLINE void lcnt_enable_drv_lock_count(erts_driver_t *dp, int enable erts_lcnt_init_lock_x(&dp->lock->lcnt, "driver_lock", ERTS_LCNT_LT_MUTEX, - am_atom_put(dp->name, - sys_strlen(dp->name))); + erts_atom_put((byte*)dp->name, + sys_strlen(dp->name), + ERTS_ATOM_ENC_LATIN1, + 1)); + else erts_lcnt_destroy_lock(&dp->lock->lcnt); @@ -3944,6 +3960,7 @@ erts_port_control(Process* c_p, &hp, NULL, &c_p->off_heap); + BUMP_REDS(c_p, ERTS_PORT_REDS_CONTROL); return ERTS_PORT_OP_DONE; } case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: @@ -4244,6 +4261,7 @@ erts_port_call(Process* c_p, if (resp_buf != &resp_buf[0] && !(ret_flags & DRIVER_CALL_KEEP_BUFFER)) driver_free(resp_buf); + BUMP_REDS(c_p, ERTS_PORT_REDS_CALL); return ERTS_PORT_OP_DONE; } case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: @@ -4423,6 +4441,7 @@ erts_port_info(Process* c_p, *retvalp = copy_struct(value, used_h_size, &hp, &MSO(c_p)); free_message_buffer(bp); } + BUMP_REDS(c_p, ERTS_PORT_REDS_INFO); return ERTS_PORT_OP_DONE; } case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: @@ -4509,6 +4528,7 @@ erts_port_set_data(Process* c_p, prt->bp = bp; prt->data = set_data; finalize_imm_drv_call(&try_call_state); + BUMP_REDS(c_p, ERTS_PORT_REDS_SET_DATA); return ERTS_PORT_OP_DONE; case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: return ERTS_PORT_OP_DROPPED; @@ -4641,6 +4661,7 @@ erts_port_get_data(Process* c_p, free_message_buffer(bp); } *retvalp = TUPLE2(hp, am_ok, data); + BUMP_REDS(c_p, ERTS_PORT_REDS_GET_DATA); return ERTS_PORT_OP_DONE; } case ERTS_TRY_IMM_DRV_CALL_INVALID_PORT: @@ -7028,7 +7049,8 @@ int driver_exit(ErlDrvPort ix, int err) return driver_failure_term(ix, am_normal, 0); else { char* err_str = erl_errno_id(err); - Eterm am_err = am_atom_put(err_str, sys_strlen(err_str)); + Eterm am_err = erts_atom_put((byte *) err_str, sys_strlen(err_str), + ERTS_ATOM_ENC_LATIN1, 1); return driver_failure_term(ix, am_err, 0); } } @@ -7041,8 +7063,12 @@ int driver_failure(ErlDrvPort ix, int code) int driver_failure_atom(ErlDrvPort ix, char* string) { - Eterm am = am_atom_put(string, strlen(string)); - return driver_failure_term(ix, am, 0); + return driver_failure_term(ix, + erts_atom_put((byte *) string, + strlen(string), + ERTS_ATOM_ENC_LATIN1, + 1), + 0); } int driver_failure_posix(ErlDrvPort ix, int err) @@ -7059,7 +7085,10 @@ int driver_failure_eof(ErlDrvPort ix) ErlDrvTermData driver_mk_atom(char* string) { - Eterm am = am_atom_put(string, sys_strlen(string)); + Eterm am = erts_atom_put((byte *) string, + sys_strlen(string), + ERTS_ATOM_ENC_LATIN1, + 1); ERTS_SMP_CHK_NO_PROC_LOCKS; return (ErlDrvTermData) am; } @@ -7354,7 +7383,10 @@ init_driver(erts_driver_t *drv, ErlDrvEntry *de, DE_Handle *handle) erts_mtx_init_x(drv->lock, "driver_lock", #if defined(ERTS_ENABLE_LOCK_CHECK) || defined(ERTS_ENABLE_LOCK_COUNT) - am_atom_put(drv->name, sys_strlen(drv->name)) + erts_atom_put((byte *) drv->name, + sys_strlen(drv->name), + ERTS_ATOM_ENC_LATIN1, + 1) #else NIL #endif diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h index 898a30b010..cecaff54a4 100644 --- a/erts/emulator/beam/sys.h +++ b/erts/emulator/beam/sys.h @@ -729,9 +729,12 @@ char * getenv_string(GETENV_STATE *); void fini_getenv_state(GETENV_STATE *); /* xxxP */ +#define SYS_DEFAULT_FLOAT_DECIMALS 20 void init_sys_float(void); int sys_chars_to_double(char*, double*); int sys_double_to_chars(double, char*, size_t); +int sys_double_to_chars_ext(double, char*, size_t, size_t); +int sys_double_to_chars_fast(double, char*, int, int, int); void sys_get_pid(char *, size_t); /* erts_sys_putenv() returns, 0 on success and a value != 0 on failure. */ diff --git a/erts/emulator/beam/time.c b/erts/emulator/beam/time.c index 932d157cd8..e8cd4a3a02 100644 --- a/erts/emulator/beam/time.c +++ b/erts/emulator/beam/time.c @@ -105,7 +105,14 @@ static ErlTimer *tiw_min_ptr; /* END tiw_lock protected variables */ /* Actual interval time chosen by sys_init_time() */ -static int itime; /* Constant after init */ + +#if SYS_CLOCK_RESOLUTION == 1 +# define TIW_ITIME 1 +# define TIW_ITIME_IS_CONSTANT +#else +static int tiw_itime; /* Constant after init */ +# define TIW_ITIME tiw_itime +#endif erts_smp_atomic32_t do_time; /* set at clock interrupt */ static ERTS_INLINE erts_short_time_t do_time_read(void) @@ -123,7 +130,7 @@ static ERTS_INLINE void do_time_init(void) erts_smp_atomic32_init_nob(&do_time, 0); } -/* get the time (in units of itime) to the next timeout, +/* get the time (in units of TIW_ITIME) to the next timeout, or -1 if there are no timeouts */ static erts_short_time_t next_time_internal(void) /* PRE: tiw_lock taken by caller */ @@ -305,11 +312,18 @@ erts_timer_wheel_memory_size(void) void erts_init_time(void) { - int i; + int i, itime; /* system dependent init; must be done before do_time_init() if timer thread is enabled */ itime = erts_init_time_sup(); +#ifdef TIW_ITIME_IS_CONSTANT + if (itime != TIW_ITIME) { + erl_exit(ERTS_ABORT_EXIT, "timer resolution mismatch %d != %d", itime, TIW_ITIME); + } +#else + tiw_itime = itime; +#endif erts_smp_mtx_init(&tiw_lock, "timer_wheel"); @@ -340,7 +354,7 @@ insert_timer(ErlTimer* p, Uint t) * * (x + y - 1)/y is precisely the "number of bins" formula. */ - ticks = (t + itime - 1) / itime; + ticks = (t + (TIW_ITIME - 1)) / TIW_ITIME; /* * Ticks must be a Uint64, or the addition may overflow here, @@ -455,7 +469,7 @@ erts_time_left(ErlTimer *p) erts_smp_mtx_unlock(&tiw_lock); - return (Uint) left * itime; + return (Uint) left * TIW_ITIME; } #ifdef DEBUG diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c index 5261effef9..2a6a8efd4d 100644 --- a/erts/emulator/beam/utils.c +++ b/erts/emulator/beam/utils.c @@ -371,7 +371,7 @@ Eterm erts_bld_atom(Uint **hpp, Uint *szp, char *str) { if (hpp) - return am_atom_put(str, sys_strlen(str)); + return erts_atom_put((byte *) str, sys_strlen(str), ERTS_ATOM_ENC_LATIN1, 1); else return THE_NON_VALUE; } diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c index 2ac7f169af..186af03eff 100644 --- a/erts/emulator/drivers/common/efile_drv.c +++ b/erts/emulator/drivers/common/efile_drv.c @@ -56,7 +56,8 @@ #define FILE_FDATASYNC 30 #define FILE_FADVISE 31 #define FILE_SENDFILE 32 - +#define FILE_FALLOCATE 33 +#define FILE_CLOSE_ON_PORT_EXIT 34 /* Return codes */ #define FILE_RESP_OK 0 @@ -177,6 +178,7 @@ dt_private *get_dt_private(int); #define MUTEX_LOCK(m) do { IF_THRDS { TRACE_DRIVER; driver_pdl_lock(m); } } while (0) #define MUTEX_UNLOCK(m) do { IF_THRDS { TRACE_DRIVER; driver_pdl_unlock(m); } } while (0) #else +#define IF_THRDS if (0) #define MUTEX_INIT(m, p) #define MUTEX_LOCK(m) #define MUTEX_UNLOCK(m) @@ -428,6 +430,7 @@ struct t_data int level; void (*invoke)(void *); void (*free)(void *); + void *data_to_free; /* used by FILE_CLOSE_ON_PORT_EXIT only */ int again; int reply; #ifdef USE_VM_PROBES @@ -504,6 +507,10 @@ struct t_data Uint64 written; } sendfile; #endif /* HAVE_SENDFILE */ + struct { + Sint64 offset; + Sint64 length; + } fallocate; } c; char b[1]; }; @@ -803,34 +810,25 @@ static void free_data(void *data) { struct t_data *d = (struct t_data *) data; - if (d->command == FILE_OPEN && d->is_fd_unused && d->fd != FILE_FD_INVALID) { - do_close(d->flags, d->fd); + switch (d->command) { + case FILE_OPEN: + if (d->is_fd_unused && d->fd != FILE_FD_INVALID) { + /* This is OK to do in scheduler thread because there can be no async op + ongoing for this fd here, as we exited during async open. + Ideally, this close should happen in an async thread too, but that would + require a substantial rewrite, as we are here because of a dead port and + cannot schedule async jobs for that port any more... */ + do_close(d->flags, d->fd); + } + break; + case FILE_CLOSE_ON_PORT_EXIT: + EF_FREE(d->data_to_free); + break; } EF_FREE(data); } -/********************************************************************* - * Driver entry point -> stop - */ -static void -file_stop(ErlDrvData e) -{ - file_descriptor* desc = (file_descriptor*)e; - - TRACE_C('p'); - - if (desc->fd != FILE_FD_INVALID) { - do_close(desc->flags, desc->fd); - desc->fd = FILE_FD_INVALID; - desc->flags = 0; - } - if (desc->read_binp) { - driver_free_binary(desc->read_binp); - } - EF_FREE(desc); -} - /* * Sends back an error reply to Erlang. @@ -1963,6 +1961,17 @@ static int flush_sendfile(file_descriptor *desc,void *_) { #endif /* HAVE_SENDFILE */ +static void invoke_fallocate(void *data) +{ + struct t_data *d = (struct t_data *) data; + int fd = (int) d->fd; + Sint64 offset = d->c.fallocate.offset; + Sint64 length = d->c.fallocate.length; + + d->again = 0; + d->result_ok = efile_fallocate(&d->errInfo, fd, offset, length); +} + static void free_readdir(void *data) { struct t_data *d = (struct t_data *) data; @@ -2226,6 +2235,47 @@ static int lseek_flush_read(file_descriptor *desc, int *errp } +/********************************************************************* + * Driver entry point -> stop + * The close has to be scheduled on async thread, so that currently active + * async operation does not suddenly have the ground disappearing under their feet... + */ +static void +file_stop(ErlDrvData e) +{ + file_descriptor* desc = (file_descriptor*)e; + + TRACE_C('p'); + + IF_THRDS { + flush_read(desc); + if (desc->fd != FILE_FD_INVALID) { + struct t_data *d = EF_SAFE_ALLOC(sizeof(struct t_data)); + d->command = FILE_CLOSE_ON_PORT_EXIT; + d->reply = !0; + d->fd = desc->fd; + d->flags = desc->flags; + d->invoke = invoke_close; + d->free = free_data; + d->level = 2; + d->data_to_free = (void *) desc; + cq_enq(desc, d); + desc->fd = FILE_FD_INVALID; + desc->flags = 0; + cq_execute(desc); + } + } else { + if (desc->fd != FILE_FD_INVALID) { + do_close(desc->flags, desc->fd); + desc->fd = FILE_FD_INVALID; + desc->flags = 0; + } + if (desc->read_binp) { + driver_free_binary(desc->read_binp); + } + EF_FREE(desc); + } +} /********************************************************************* * Driver entry point -> ready_async @@ -2358,6 +2408,7 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data) case FILE_RENAME: case FILE_WRITE_INFO: case FILE_FADVISE: + case FILE_FALLOCATE: reply(desc, d->result_ok, &d->errInfo); free_data(data); break; @@ -2448,7 +2499,6 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data) } free_readdir(data); break; - /* See file_stop */ case FILE_CLOSE: if (d->reply) { TRACE_C('K'); @@ -2508,6 +2558,15 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data) } break; #endif + case FILE_CLOSE_ON_PORT_EXIT: + /* See file_stop. However this is never invoked after the port is killed. */ + free_data(data); + EF_FREE(desc); + desc = NULL; + /* This is it for this port, so just send dtrace and return, avoid doing anything to the freed data */ + DTRACE6(efile_drv_return, sched_i1, sched_i2, sched_utag, + command, result_ok, posix_errno); + return; default: abort(); } @@ -2518,6 +2577,7 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data) driver_set_timer(desc->port, desc->write_delay); } cq_execute(desc); + } @@ -2971,6 +3031,20 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count) goto done; } + case FILE_FALLOCATE: + { + d = EF_SAFE_ALLOC(sizeof(struct t_data)); + + d->fd = fd; + d->command = command; + d->invoke = invoke_fallocate; + d->free = free_data; + d->level = 2; + d->c.fallocate.offset = get_int64((uchar*) buf); + d->c.fallocate.length = get_int64(((uchar*) buf) + sizeof(Sint64)); + goto done; + } + } /* diff --git a/erts/emulator/drivers/common/erl_efile.h b/erts/emulator/drivers/common/erl_efile.h index 69ad02633c..b29b4f971c 100644 --- a/erts/emulator/drivers/common/erl_efile.h +++ b/erts/emulator/drivers/common/erl_efile.h @@ -185,3 +185,4 @@ int efile_fadvise(Efile_error* errInfo, int fd, Sint64 offset, Sint64 length, int efile_sendfile(Efile_error* errInfo, int in_fd, int out_fd, off_t *offset, Uint64 *nbytes, struct t_sendfile_hdtl *hdtl); #endif /* HAVE_SENDFILE */ +int efile_fallocate(Efile_error* errInfo, int fd, Sint64 offset, Sint64 length); diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index 236b8710fb..f0c22e9ebe 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -933,12 +933,20 @@ typedef struct { int bufsz; /* minimum buffer constraint */ unsigned int hsz; /* the list header size, -1 is large !!! */ /* statistics */ - unsigned long recv_oct[2]; /* number of received octets >= 64 bits */ +#ifdef ARCH_64 + Uint64 recv_oct; /* number of received octets, 64 bits */ +#else + Uint32 recv_oct[2]; /* number of received octets, 64 bits */ +#endif unsigned long recv_cnt; /* number of packets received */ unsigned long recv_max; /* maximum packet size received */ double recv_avg; /* average packet size received */ double recv_dvi; /* avarage deviation from avg_size */ - unsigned long send_oct[2]; /* number of octets sent >= 64 bits */ +#ifdef ARCH_64 + Uint64 send_oct; /* number of octets sent, 64 bits */ +#else + Uint32 send_oct[2]; /* number of octets sent, 64 bits */ +#endif unsigned long send_cnt; /* number of packets sent */ unsigned long send_max; /* maximum packet send */ double send_avg; /* average packet size sent */ @@ -7377,13 +7385,21 @@ static ErlDrvSSizeT inet_fill_stat(inet_descriptor* desc, val = (unsigned long) driver_sizeq(desc->port); break; case INET_STAT_RECV_OCT: +#ifdef ARCH_64 + put_int64(desc->recv_oct, dst); /* write it all */ +#else put_int32(desc->recv_oct[1], dst); /* write high 32bit */ put_int32(desc->recv_oct[0], dst+4); /* write low 32bit */ +#endif dst += 8; continue; case INET_STAT_SEND_OCT: +#ifdef ARCH_64 + put_int64(desc->send_oct, dst); /* write it all */ +#else put_int32(desc->send_oct[1], dst); /* write high 32bit */ put_int32(desc->send_oct[0], dst+4); /* write low 32bit */ +#endif dst += 8; continue; default: return -1; /* invalid argument */ @@ -7491,12 +7507,20 @@ static ErlDrvData inet_start(ErlDrvPort port, int size, int protocol) desc->peer_ptr = NULL; desc->name_ptr = NULL; +#ifdef ARCH_64 + desc->recv_oct = 0; +#else desc->recv_oct[0] = desc->recv_oct[1] = 0; +#endif desc->recv_cnt = 0; desc->recv_max = 0; desc->recv_avg = 0.0; desc->recv_dvi = 0.0; +#ifdef ARCH_64 + desc->send_oct = 0; +#else desc->send_oct[0] = desc->send_oct[1] = 0; +#endif desc->send_cnt = 0; desc->send_max = 0; desc->send_avg = 0.0; @@ -7885,14 +7909,19 @@ static ErlDrvSSizeT inet_ctl(inet_descriptor* desc, int cmd, char* buf, static void inet_output_count(inet_descriptor* desc, ErlDrvSizeT len) { unsigned long n = desc->send_cnt + 1; - unsigned long t = desc->send_oct[0] + len; +#ifndef ARCH_64 + Uint32 t = desc->send_oct[0] + len; int c = (t < desc->send_oct[0]); +#endif double avg = desc->send_avg; - /* at least 64 bit octet count */ +#ifdef ARCH_64 + desc->send_oct += len; +#else + /* 64 bit octet count in 32 bit words */ desc->send_oct[0] = t; desc->send_oct[1] += c; - +#endif if (n == 0) /* WRAP, use old avg as input to a new sequence */ n = 1; desc->send_avg += (len - avg) / n; @@ -7905,14 +7934,20 @@ static void inet_output_count(inet_descriptor* desc, ErlDrvSizeT len) static void inet_input_count(inet_descriptor* desc, ErlDrvSizeT len) { unsigned long n = desc->recv_cnt + 1; - unsigned long t = desc->recv_oct[0] + len; +#ifndef ARCH_64 + Uint32 t = (desc->recv_oct[0] + len); int c = (t < desc->recv_oct[0]); +#endif double avg = desc->recv_avg; double dvi; - /* at least 64 bit octet count */ +#ifdef ARCH_64 + desc->recv_oct += len; +#else + /* 64 bit octet count in 32 bit words */ desc->recv_oct[0] = t; desc->recv_oct[1] += c; +#endif if (n == 0) /* WRAP */ n = 1; @@ -9723,6 +9758,7 @@ static int tcp_inet_output(tcp_descriptor* desc, HANDLE event) DEBUGF(("tcp_inet_output(%ld): s=%d, About to send %d items\r\n", (long)desc->inet.port, desc->inet.s, vsize)); if (IS_SOCKET_ERROR(sock_sendv(desc->inet.s, iov, vsize, &n, 0))) { + write_error: if ((sock_errno() != ERRNO_BLOCK) && (sock_errno() != EINTR)) { DEBUGF(("tcp_inet_output(%ld): sock_sendv(%d) errno = %d\r\n", (long)desc->inet.port, vsize, sock_errno())); @@ -9733,6 +9769,22 @@ static int tcp_inet_output(tcp_descriptor* desc, HANDLE event) desc->inet.send_would_block = 1; #endif goto done; + } else if (n == 0) { /* Workaround for redhat/CentOS 6.3 returning + 0 when sending packets with + sizes > (max 32 bit signed int) */ + size_t howmuch = 0x7FFFFFFF; /* max signed 32 bit */ + int x; + for(x = 0; x < vsize && iov[x].iov_len == 0; ++x) + ; + if (x < vsize) { + if (howmuch > iov[x].iov_len) { + howmuch = iov[x].iov_len; + } + n = sock_send(desc->inet.s, iov[x].iov_base,howmuch,0); + if (IS_SOCKET_ERROR(n)) { + goto write_error; + } + } } if (driver_deq(ix, n) <= desc->low) { if (IS_BUSY(INETP(desc))) { diff --git a/erts/emulator/drivers/common/ram_file_drv.c b/erts/emulator/drivers/common/ram_file_drv.c index a109e40333..7f7cd7cd91 100644 --- a/erts/emulator/drivers/common/ram_file_drv.c +++ b/erts/emulator/drivers/common/ram_file_drv.c @@ -48,6 +48,7 @@ #define RAM_FILE_SIZE 37 /* get file size */ #define RAM_FILE_ADVISE 38 /* predeclare the access * pattern for file data */ +#define RAM_FILE_ALLOCATE 39 /* allocate space for a file */ /* possible new operations include: DES_ENCRYPT DES_DECRYPT @@ -720,6 +721,13 @@ static void rfile_command(ErlDrvData e, char* buf, ErlDrvSizeT count) else reply(f, 1, 0); break; + + case RAM_FILE_ALLOCATE: + if (f->flags == 0) + error_reply(f, EBADF); + else + reply(f, 1, 0); + break; } /* * Ignore anything else -- let the caller hang. diff --git a/erts/emulator/drivers/unix/unix_efile.c b/erts/emulator/drivers/unix/unix_efile.c index cf7af71b92..558651fff9 100644 --- a/erts/emulator/drivers/unix/unix_efile.c +++ b/erts/emulator/drivers/unix/unix_efile.c @@ -22,6 +22,12 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif +#if defined(HAVE_POSIX_FALLOCATE) && !defined(__sun) && !defined(__sun__) +#define _XOPEN_SOURCE 600 +#endif +#if !defined(_GNU_SOURCE) && defined(HAVE_LINUX_FALLOC_H) +#define _GNU_SOURCE +#endif #include "sys.h" #include "erl_driver.h" #include "erl_efile.h" @@ -41,9 +47,13 @@ #define DARWIN 1 #endif -#ifdef DARWIN +#if defined(DARWIN) || defined(HAVE_LINUX_FALLOC_H) || defined(HAVE_POSIX_FALLOCATE) #include <fcntl.h> -#endif /* DARWIN */ +#endif + +#ifdef HAVE_LINUX_FALLOC_H +#include <linux/falloc.h> +#endif #ifdef SUNOS4 # define getcwd(buf, size) getwd(buf) @@ -967,3 +977,81 @@ efile_sendfile(Efile_error* errInfo, int in_fd, int out_fd, return check_error(retval, errInfo); } #endif /* HAVE_SENDFILE */ + +#ifdef HAVE_POSIX_FALLOCATE +static int +call_posix_fallocate(int fd, Sint64 offset, Sint64 length) +{ + int ret; + + /* + * On Linux and Solaris for example, posix_fallocate() returns + * a positive error number on error and it does not set errno. + * On FreeBSD however (9.0 at least), it returns -1 on error + * and it sets errno. + */ + do { + ret = posix_fallocate(fd, (off_t) offset, (off_t) length); + if (ret > 0) { + errno = ret; + ret = -1; + } + } while (ret != 0 && errno == EINTR); + + return ret; +} +#endif /* HAVE_POSIX_FALLOCATE */ + +int +efile_fallocate(Efile_error* errInfo, int fd, Sint64 offset, Sint64 length) +{ +#if defined HAVE_FALLOCATE + /* Linux specific, more efficient than posix_fallocate. */ + int ret; + + do { + ret = fallocate(fd, FALLOC_FL_KEEP_SIZE, (off_t) offset, (off_t) length); + } while (ret != 0 && errno == EINTR); + +#if defined HAVE_POSIX_FALLOCATE + /* Fallback to posix_fallocate if available. */ + if (ret != 0) { + ret = call_posix_fallocate(fd, offset, length); + } +#endif + + return check_error(ret, errInfo); +#elif defined F_PREALLOCATE + /* Mac OS X specific, equivalent to posix_fallocate. */ + int ret; + fstore_t fs; + + memset(&fs, 0, sizeof(fs)); + fs.fst_flags = F_ALLOCATECONTIG; + fs.fst_posmode = F_VOLPOSMODE; + fs.fst_offset = (off_t) offset; + fs.fst_length = (off_t) length; + + ret = fcntl(fd, F_PREALLOCATE, &fs); + + if (-1 == ret) { + fs.fst_flags = F_ALLOCATEALL; + ret = fcntl(fd, F_PREALLOCATE, &fs); + +#if defined HAVE_POSIX_FALLOCATE + /* Fallback to posix_fallocate if available. */ + if (-1 == ret) { + ret = call_posix_fallocate(fd, offset, length); + } +#endif + } + + return check_error(ret, errInfo); +#elif defined HAVE_POSIX_FALLOCATE + /* Other Unixes, use posix_fallocate if available. */ + return check_error(call_posix_fallocate(fd, offset, length), errInfo); +#else + errno = ENOTSUP; + return check_error(-1, errInfo); +#endif +} diff --git a/erts/emulator/drivers/win32/win_efile.c b/erts/emulator/drivers/win32/win_efile.c index dc7add01f7..f2b0c8a843 100644 --- a/erts/emulator/drivers/win32/win_efile.c +++ b/erts/emulator/drivers/win32/win_efile.c @@ -41,6 +41,8 @@ #define IS_DOT_OR_DOTDOT(s) \ ((s)[0] == L'.' && ((s)[1] == L'\0' || ((s)[1] == L'.' && (s)[2] == L'\0'))) +#define FILE_SHARE_FLAGS (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE) + #ifndef INVALID_FILE_ATTRIBUTES #define INVALID_FILE_ATTRIBUTES ((DWORD) 0xFFFFFFFF) #endif @@ -724,7 +726,7 @@ efile_openfile(Efile_error* errInfo, /* Where to return error codes. */ crFlags = CREATE_NEW; } fd = CreateFileW(wname, access, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + FILE_SHARE_FLAGS, NULL, crFlags, FILE_ATTRIBUTE_NORMAL, NULL); /* @@ -909,7 +911,7 @@ efile_fileinfo(Efile_error* errInfo, Efile_info* pInfo, { HANDLE handle; /* Handle returned by CreateFile() */ BY_HANDLE_FILE_INFORMATION fileInfo; /* from CreateFile() */ - if (handle = CreateFileW(name, GENERIC_READ, 0,NULL, + if (handle = CreateFileW(name, GENERIC_READ, FILE_SHARE_FLAGS, NULL, OPEN_EXISTING, 0, NULL)) { GetFileInformationByHandle(handle, &fileInfo); pInfo->links = fileInfo.nNumberOfLinks; @@ -1021,7 +1023,7 @@ efile_write_info(Efile_error* errInfo, } fd = CreateFileW(wname, GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_SHARE_FLAGS, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (fd != INVALID_HANDLE_VALUE) { BOOL result = SetFileTime(fd, &CreationFileTime, &AccessFileTime, &ModifyFileTime); @@ -1384,7 +1386,7 @@ efile_readlink(Efile_error* errInfo, char* name, char* buffer, size_t size) DWORD fileAttributes = GetFileAttributesW(wname); if ((fileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) { BOOLEAN success = 0; - HANDLE h = CreateFileW(wname, GENERIC_READ, 0,NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + HANDLE h = CreateFileW(wname, GENERIC_READ, FILE_SHARE_FLAGS, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); int len; if(h != INVALID_HANDLE_VALUE) { success = pGetFinalPathNameByHandle(h, wbuffer, size / sizeof(WCHAR),0); @@ -1558,3 +1560,13 @@ efile_fadvise(Efile_error* errInfo, int fd, Sint64 offset, errno = ERROR_SUCCESS; return check_error(0, errInfo); } + +int +efile_fallocate(Efile_error* errInfo, int fd, Sint64 offset, Sint64 length) +{ + /* No file preallocation method available in Windows. */ + errno = errno_map(ERROR_NOT_SUPPORTED); + SetLastError(ERROR_NOT_SUPPORTED); + + return check_error(-1, errInfo); +} diff --git a/erts/emulator/hipe/hipe_x86_gc.h b/erts/emulator/hipe/hipe_x86_gc.h index aa4abb6f59..4bea9276c0 100644 --- a/erts/emulator/hipe/hipe_x86_gc.h +++ b/erts/emulator/hipe/hipe_x86_gc.h @@ -71,7 +71,7 @@ nstack_walk_init_sdesc(const Process *p, struct nstack_walk_state *state) state->sdesc0[0].livebits[0] = 0; # ifdef DEBUG state->sdesc0[0].dbg_M = 0; - state->sdesc0[0].dbg_F = am_init; + state->sdesc0[0].dbg_F = am_undefined; state->sdesc0[0].dbg_A = 0; # endif /* XXX: this appears to prevent a gcc-4.1.1 bug on x86 */ diff --git a/erts/emulator/pcre/pcre.mk b/erts/emulator/pcre/pcre.mk index 352137b341..57bf5de2fb 100644 --- a/erts/emulator/pcre/pcre.mk +++ b/erts/emulator/pcre/pcre.mk @@ -49,18 +49,18 @@ PCRE_CFLAGS = $(filter-out -DDEBUG,$(CFLAGS)) -DERLANG_INTEGRATION ifeq ($(TARGET), win32) $(EPCRE_LIB): $(PCRE_OBJS) - $(AR) -out:$@ $(PCRE_OBJS) + $(V_AR) -out:$@ $(PCRE_OBJS) else $(EPCRE_LIB): $(PCRE_OBJS) - $(AR) $(ARFLAGS) $@ $(PCRE_OBJS) + $(V_AR) $(ARFLAGS) $@ $(PCRE_OBJS) -@ ($(RANLIB) $@ || true) 2>/dev/null endif $(PCRE_OBJDIR)/%.o: pcre/%.c - $(CC) -c $(PCRE_CFLAGS) -o $@ $< + $(V_CC) -c $(PCRE_CFLAGS) -o $@ $< $(PCRE_GENINC): pcre/pcre_exec.c - for x in `grep -n COST_CHK pcre/pcre_exec.c | grep -v 'COST_CHK(N)' | awk -F: '{print $$1}'`; \ + $(gen_verbose)for x in `grep -n COST_CHK pcre/pcre_exec.c | grep -v 'COST_CHK(N)' | awk -F: '{print $$1}'`; \ do \ N=`expr $$x + 100`; \ echo "case $$N: goto L_LOOP_COUNT_$${x};"; \ diff --git a/erts/emulator/sys/common/erl_sys_common_misc.c b/erts/emulator/sys/common/erl_sys_common_misc.c index 461e763f03..d22914acea 100644 --- a/erts/emulator/sys/common/erl_sys_common_misc.c +++ b/erts/emulator/sys/common/erl_sys_common_misc.c @@ -105,3 +105,154 @@ int erts_get_native_filename_encoding(void) { return filename_encoding; } + +/* For internal use by sys_double_to_chars_fast() */ +static char* float_first_trailing_zero(char* p) +{ + for (--p; *p == '0' && *(p-1) == '0'; --p); + if (*(p-1) == '.') ++p; + return p; +} + +int +sys_double_to_chars(double fp, char *buffer, size_t buffer_size) +{ + return sys_double_to_chars_ext(fp, buffer, buffer_size, SYS_DEFAULT_FLOAT_DECIMALS); +} + +int +sys_double_to_chars_fast(double f, char *outbuf, int maxlen, int decimals, int compact) +{ + enum { + FRAC_SIZE = 52 + , EXP_SIZE = 11 + , EXP_MASK = (1ll << EXP_SIZE) - 1 + , FRAC_MASK = (1ll << FRAC_SIZE) - 1 + , FRAC_MASK2 = (1ll << (FRAC_SIZE + 1)) - 1 + , MAX_FLOAT = 1ll << (FRAC_SIZE+1) + }; + + long long mantissa, int_part, int_part2, frac_part; + short exp; + int sign, i, n, m, max; + double absf; + union { long long L; double F; } x; + char c, *p = outbuf; + int digit, roundup; + + x.F = f; + + exp = (x.L >> FRAC_SIZE) & EXP_MASK; + mantissa = x.L & FRAC_MASK; + sign = x.L >= 0 ? 1 : -1; + if (exp == EXP_MASK) { + if (mantissa == 0) { + if (sign == -1) + *p++ = '-'; + *p++ = 'i'; + *p++ = 'n'; + *p++ = 'f'; + } else { + *p++ = 'n'; + *p++ = 'a'; + *p++ = 'n'; + } + *p = '\0'; + return p - outbuf; + } + + exp -= EXP_MASK >> 1; + mantissa |= (1ll << FRAC_SIZE); + frac_part = 0; + int_part = 0; + absf = f * sign; + + /* Don't bother with optimizing too large numbers and decimals */ + if (absf > MAX_FLOAT || decimals > maxlen-17) { + int len = erts_snprintf(outbuf, maxlen, "%.*f", decimals, f); + if (len >= maxlen) + return -1; + p = outbuf + len; + /* Delete trailing zeroes */ + if (compact) + p = float_first_trailing_zero(outbuf + len); + *p = '\0'; + return p - outbuf; + } + + if (exp >= FRAC_SIZE) + int_part = mantissa << (exp - FRAC_SIZE); + else if (exp >= 0) { + int_part = mantissa >> (FRAC_SIZE - exp); + frac_part = (mantissa << (exp + 1)) & FRAC_MASK2; + } + else /* if (exp < 0) */ + frac_part = (mantissa & FRAC_MASK2) >> -(exp + 1); + + if (int_part == 0) { + if (sign == -1) + *p++ = '-'; + *p++ = '0'; + } else { + int ret; + while (int_part != 0) { + int_part2 = int_part / 10; + *p++ = (char)(int_part - ((int_part2 << 3) + (int_part2 << 1)) + '0'); + int_part = int_part2; + } + if (sign == -1) + *p++ = '-'; + /* Reverse string */ + ret = p - outbuf; + for (i = 0, n = ret/2; i < n; i++) { + int j = ret - i - 1; + c = outbuf[i]; + outbuf[i] = outbuf[j]; + outbuf[j] = c; + } + } + if (decimals != 0) + *p++ = '.'; + + max = maxlen - (p - outbuf) - 1 /* leave room for trailing '\0' */; + if (max > decimals) + max = decimals; + for (m = 0; m < max; m++) { + /* frac_part *= 10; */ + frac_part = (frac_part << 3) + (frac_part << 1); + + *p++ = (char)((frac_part >> (FRAC_SIZE + 1)) + '0'); + frac_part &= FRAC_MASK2; + } + + roundup = 0; + /* Rounding - look at the next digit */ + frac_part = (frac_part << 3) + (frac_part << 1); + digit = (frac_part >> (FRAC_SIZE + 1)); + if (digit > 5) + roundup = 1; + else if (digit == 5) { + frac_part &= FRAC_MASK2; + if (frac_part != 0) roundup = 1; + } + if (roundup) { + char d; + int pos = p - outbuf - 1; + do { + d = outbuf[pos]; + if (d == '-') break; + if (d == '.') continue; + if (++d != ':') { + outbuf[pos] = d; + break; + } + outbuf[pos] = '0'; + } while (--pos); + } + + /* Delete trailing zeroes */ + if (compact && *(p - 1) == '0') + p = float_first_trailing_zero(--p); + *p = '\0'; + return p - outbuf; +} diff --git a/erts/emulator/sys/unix/sys_float.c b/erts/emulator/sys/unix/sys_float.c index 3fcb4d88dc..6875c17a75 100644 --- a/erts/emulator/sys/unix/sys_float.c +++ b/erts/emulator/sys/unix/sys_float.c @@ -735,7 +735,7 @@ void erts_sys_unblock_fpe(int unmasked) /* ** Convert a double to ascii format 0.dddde[+|-]ddd - ** return number of characters converted + ** return number of characters converted or -1 if error. ** ** These two functions should maybe use localeconv() to pick up ** the current radix character, but since it is uncertain how @@ -745,11 +745,12 @@ void erts_sys_unblock_fpe(int unmasked) */ int -sys_double_to_chars(double fp, char *buffer, size_t buffer_size) +sys_double_to_chars_ext(double fp, char *buffer, size_t buffer_size, size_t decimals) { char *s = buffer; - - (void) erts_snprintf(buffer, buffer_size, "%.20e", fp); + + if (erts_snprintf(buffer, buffer_size, "%.*e", decimals, fp) >= buffer_size) + return -1; /* Search upto decimal point */ if (*s == '+' || *s == '-') s++; while (ISDIGIT(*s)) s++; diff --git a/erts/emulator/sys/win32/sys_float.c b/erts/emulator/sys/win32/sys_float.c index 09dad89140..960edaa7a5 100644 --- a/erts/emulator/sys/win32/sys_float.c +++ b/erts/emulator/sys/win32/sys_float.c @@ -114,15 +114,16 @@ sys_chars_to_double(char *buf, double *fp) /* ** Convert a double to ascii format 0.dddde[+|-]ddd -** return number of characters converted +** return number of characters converted or -1 if error. */ int -sys_double_to_chars(double fp, char *buffer, size_t buffer_size) +sys_double_to_chars_ext(double fp, char *buffer, size_t buffer_size, size_t decimals) { char *s = buffer; - - (void) erts_snprintf(buffer, buffer_size, "%.20e", fp); + + if (erts_snprintf(buffer, buffer_size, "%.*e", decimals, fp) >= buffer_size) + return -1; /* Search upto decimal point */ if (*s == '+' || *s == '-') s++; while (isdigit(*s)) s++; diff --git a/erts/emulator/test/alloc_SUITE_data/testcase_driver.c b/erts/emulator/test/alloc_SUITE_data/testcase_driver.c index 66971654a2..5c4b11454f 100644 --- a/erts/emulator/test/alloc_SUITE_data/testcase_driver.c +++ b/erts/emulator/test/alloc_SUITE_data/testcase_driver.c @@ -42,6 +42,7 @@ typedef struct { TestCaseState_t visible; ErlDrvPort port; + ErlDrvTermData port_id; int result; jmp_buf done_jmp_buf; char *comment; @@ -97,6 +98,7 @@ testcase_drv_start(ErlDrvPort port, char *command) itcs->visible.testcase_name = testcase_name(); itcs->visible.extra = NULL; itcs->port = port; + itcs->port_id = driver_mk_port(port); itcs->result = TESTCASE_FAILED; itcs->comment = ""; @@ -142,7 +144,7 @@ testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) msg[1] = (ErlDrvTermData) result_atom; msg[2] = ERL_DRV_PORT; - msg[3] = driver_mk_port(itcs->port); + msg[3] = itcs->port_id; msg[4] = ERL_DRV_ATOM; msg[5] = driver_mk_atom(itcs->visible.testcase_name); @@ -154,7 +156,7 @@ testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) msg[9] = ERL_DRV_TUPLE; msg[10] = (ErlDrvTermData) 4; - driver_output_term(itcs->port, msg, 11); + erl_drv_output_term(itcs->port_id, msg, 11); } int @@ -184,7 +186,7 @@ testcase_printf(TestCaseState_t *tcs, char *frmt, ...) msg[1] = (ErlDrvTermData) driver_mk_atom("print"); msg[2] = ERL_DRV_PORT; - msg[3] = driver_mk_port(itcs->port); + msg[3] = itcs->port_id; msg[4] = ERL_DRV_ATOM; msg[5] = driver_mk_atom(itcs->visible.testcase_name); @@ -196,7 +198,7 @@ testcase_printf(TestCaseState_t *tcs, char *frmt, ...) msg[9] = ERL_DRV_TUPLE; msg[10] = (ErlDrvTermData) 4; - driver_output_term(itcs->port, msg, 11); + erl_drv_output_term(itcs->port_id, msg, 11); } diff --git a/erts/emulator/test/bif_SUITE.erl b/erts/emulator/test/bif_SUITE.erl index e2442861c7..02c6de8cb1 100644 --- a/erts/emulator/test/bif_SUITE.erl +++ b/erts/emulator/test/bif_SUITE.erl @@ -481,8 +481,6 @@ binary_to_atom(Config) when is_list(Config) -> %% Bad UTF8 sequences. ?line ?BADARG(binary_to_atom(id(<<255>>), utf8)), ?line ?BADARG(binary_to_atom(id(<<255,0>>), utf8)), - ?line ?BADARG(binary_to_atom(id(<<0:512/unit:8,255>>), utf8)), - ?line ?BADARG(binary_to_atom(id(<<0:512/unit:8,255,0>>), utf8)), ?line ?BADARG(binary_to_atom(id(<<16#C0,16#80>>), utf8)), %Overlong 0. ?line [?BADARG(binary_to_atom(<<C/utf8>>, utf8)) || C <- lists:seq(256, 16#D7FF)], @@ -494,6 +492,8 @@ binary_to_atom(Config) when is_list(Config) -> C <- lists:seq(16#90000, 16#10FFFF)], %% system_limit failures. + ?line ?SYS_LIMIT(binary_to_atom(id(<<0:512/unit:8,255>>), utf8)), + ?line ?SYS_LIMIT(binary_to_atom(id(<<0:512/unit:8,255,0>>), utf8)), ?line ?SYS_LIMIT(binary_to_atom(<<0:256/unit:8>>, latin1)), ?line ?SYS_LIMIT(binary_to_atom(<<0:257/unit:8>>, latin1)), ?line ?SYS_LIMIT(binary_to_atom(<<0:512/unit:8>>, latin1)), diff --git a/erts/emulator/test/busy_port_SUITE.erl b/erts/emulator/test/busy_port_SUITE.erl index 32e907ca69..a92afef003 100644 --- a/erts/emulator/test/busy_port_SUITE.erl +++ b/erts/emulator/test/busy_port_SUITE.erl @@ -26,6 +26,8 @@ no_trap_exit_unlinked/1, trap_exit/1, multiple_writers/1, hard_busy_driver/1, soft_busy_driver/1]). +-compile(export_all). + -include_lib("test_server/include/test_server.hrl"). %% Internal exports. @@ -36,7 +38,9 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [io_to_busy, message_order, send_3, system_monitor, no_trap_exit, no_trap_exit_unlinked, trap_exit, - multiple_writers, hard_busy_driver, soft_busy_driver]. + multiple_writers, hard_busy_driver, soft_busy_driver, + scheduling_delay_busy,scheduling_delay_busy_nosuspend, + scheduling_busy_link]. groups() -> []. @@ -528,6 +532,304 @@ hs_busy_pcmd(Prt, Opts, StartFun, EndFun) -> EndFun(P, Res, Time) end. +scheduling_delay_busy(Config) -> + + Scenario = + [{1,{spawn,[{var,drvname},undefined]}}, + {2,{call,[{var,1},open_port]}}, + {3,{spawn,[{var,2},{var,1}]}}, + {0,{ack,[{var,1},{busy,1,250}]}}, + {0,{cast,[{var,3},{command,2}]}}, + [{0,{cast,[{var,3},{command,I}]}} + || I <- lists:seq(3,50)], + {0,{cast,[{var,3},take_control]}}, + {0,{cast,[{var,1},{new_owner,{var,3}}]}}, + {0,{cast,[{var,3},close]}}, + {0,{timer,sleep,[300]}}, + {0,{erlang,port_command,[{var,2},<<$N>>,[force]]}}, + [{0,{cast,[{var,1},{command,I}]}} + || I <- lists:seq(101,127)] + ,{10,{call,[{var,3},get_data]}} + ], + + Validation = [{seq,10,lists:seq(1,50)}], + + port_scheduling(Scenario,Validation,?config(data_dir,Config)). + +scheduling_delay_busy_nosuspend(Config) -> + + Scenario = + [{1,{spawn,[{var,drvname},undefined]}}, + {2,{call,[{var,1},open_port]}}, + {0,{cast,[{var,1},{command,1,100}]}}, + {0,{cast,[{var,1},{busy,2}]}}, + {10,{call,[{var,1},{command,3,[nosuspend]}]}}, + {0,{timer,sleep,[200]}}, + {0,{erlang,port_command,[{var,2},<<$N>>,[force]]}}, + {0,{cast,[{var,1},close]}}, + {20,{call,[{var,1},get_data]}} + ], + + Validation = [{eq,10,nosuspend},{seq,20,[1,2]}], + + port_scheduling(Scenario,Validation,?config(data_dir,Config)). + +scheduling_busy_link(Config) -> + + Scenario = + [{1,{spawn,[{var,drvname},undefined]}}, + {2,{call,[{var,1},open_port]}}, + {3,{spawn,[{var,2},{var,1}]}}, + {0,{cast,[{var,1},unlink]}}, + {0,{cast,[{var,1},{busy,1}]}}, + {0,{cast,[{var,1},{command,2}]}}, + {0,{cast,[{var,1},link]}}, + {0,{timer,sleep,[1000]}}, + {0,{ack,[{var,3},take_control]}}, + {0,{cast,[{var,1},{new_owner,{var,3}}]}}, + {0,{cast,[{var,3},close]}}, + {10,{call,[{var,3},get_data]}}, + {20,{call,[{var,1},get_exit]}} + ], + + Validation = [{seq,10,[1]}, + {seq,20,[{'EXIT',noproc}]}], + + port_scheduling(Scenario,Validation,?config(data_dir,Config)). + +process_init(DrvName,Owner) -> + process_flag(trap_exit,true), + process_loop(DrvName,Owner, {[],[]}). + +process_loop(DrvName,undefined,Data) when is_list(DrvName) -> + process_loop(DrvName,[binary],Data); +process_loop(DrvName,PortOpts,Data) when is_list(DrvName) -> + receive + {call,open_port,P} -> + Port = open_port({spawn, DrvName}, PortOpts), + send(P,Port), + process_loop(Port,self(),Data) + end; +process_loop(Port,undefined,Data) -> + receive + {cast,{new_owner,Pid}} -> + pal("NewOwner: ~p",[Pid]), + process_loop(Port,Pid,Data) + end; +process_loop(Port,Owner,{Data,Exit} = DE) -> + receive + {Port,connected} -> + pal("Connected",[]), + process_loop(Port,undefined,DE); + {Port,{data,NewData}} -> + pal("Got: ~p",[NewData]), + receive + {Port,closed} -> + process_loop(Port,Owner,{Data ++ [NewData],Exit}) + after 2000 -> + exit(did_not_get_port_close) + end; + {'EXIT',Port,Reason} = Exit -> + pal("Exit: ~p",[Exit]), + process_loop(Port,Owner,{Data, Exit ++ [[{'EXIT',Reason}]]}); + {'EXIT',_Port,_Reason} = Exit -> + pal("Exit: ~p",[Exit]); + {call,Msg,P} -> + case handle_msg(Msg,Port,Owner,DE) of + {Reply,NewOwner,NewData} -> + send(P,Reply), + process_loop(Port,NewOwner,NewData); + Reply -> + send(P,Reply), + process_loop(Port,Owner,DE) + end; + {ack,Msg,P} -> + send(P,ok), + case handle_msg(Msg,Port,Owner,DE) of + {_Reply,NewOwner,NewData} -> + process_loop(Port,NewOwner,NewData); + _Reply -> + process_loop(Port,Owner,DE) + end; + {cast,Msg} when is_atom(Msg) orelse element(1,Msg) /= new_owner -> + case handle_msg(Msg,Port,Owner,DE) of + {_Reply,NewOwner,NewData} -> + process_loop(Port,NewOwner,NewData); + _ -> + process_loop(Port,Owner,DE) + end + end. + +handle_msg({busy,Value,Delay},Port,Owner,_Data) -> + pal("Long busy: ~p",[Value]), + send(Port,{Owner,{command,<<$L,Value:32,(round(Delay/100))>>}}); +handle_msg({busy,Value},Port,Owner,_Data) -> + pal("Busy: ~p",[Value]), + send(Port,{Owner,{command,<<$B,Value:32>>}}); +handle_msg({command,Value},Port,Owner,_Data) -> + pal("Short: ~p",[Value]), + send(Port,{Owner,{command,<<$C,Value:32>>}}); +handle_msg({command,Value,Delay},Port,Owner,_Data) when is_integer(Delay) -> + pal("Long: ~p",[Value]), + send(Port,{Owner,{command,<<$D,Value:32,(round(Delay/100))>>}}); +handle_msg({command,Value,Opts},Port,Owner,_Data) -> + pal("Short Opt: ~p",[Value]), + send(Port,{Owner,{command,<<$C,Value:32>>}},Opts); +handle_msg({command,Value,Opts,Delay},Port,Owner,_Data) -> + pal("Long Opt: ~p",[Value]), + send(Port,{Owner,{command,<<$D,Value:32,(round(Delay/100))>>}},Opts); +handle_msg(take_control,Port,Owner,Data) -> + pal("Connect: ~p",[self()]), + send(Port,{Owner, {connect, self()}}), + {undefined,self(),Data}; +handle_msg(unlink,Port,_Owner,_Data) -> + pal("Unlink:",[]), + erlang:unlink(Port); +handle_msg(link,Port,_Owner,_Data) -> + pal("Link:",[]), + erlang:link(Port); +handle_msg(close,Port,Owner,_Data) -> + pal("Close",[]), + send(Port,{Owner,close}); +handle_msg(get_data,Port,_Owner,{[],_Exit}) -> + %% Wait for data if it has not arrived yet + receive + {Port,{data,Data}} -> + Data + after 2000 -> + pal("~p",[erlang:process_info(self())]), + exit(did_not_get_port_data) + end; +handle_msg(get_data,_Port,Owner,{Data,Exit}) -> + pal("GetData",[]), + {hd(Data),Owner,{tl(Data),Exit}}; +handle_msg(get_exit,Port,_Owner,{_Data,[]}) -> + %% Wait for exit if it has not arrived yet + receive + {'EXIT',Port,Reason} -> + [{'EXIT',Reason}] + after 2000 -> + pal("~p",[erlang:process_info(self())]), + exit(did_not_get_port_exit) + end; +handle_msg(get_exit,_Port,Owner,{Data,Exit}) -> + {hd(Exit),Owner,{Data,tl(Exit)}}. + + + +call(Pid,Msg) -> + pal("call(~p,~p)",[Pid,Msg]), + send(Pid,{call,Msg,self()}), + receive + Ret -> + Ret + end. +ack(Pid,Msg) -> + pal("ack(~p,~p)",[Pid,Msg]), + send(Pid,{ack,Msg,self()}), + receive + Ret -> + Ret + end. + +cast(Pid,Msg) -> + pal("cast(~p,~p)",[Pid,Msg]), + send(Pid,{cast,Msg}). + +send(Pid,Msg) -> + erlang:send(Pid,Msg). +send(Prt,Msg,Opts) -> + erlang:send(Prt,Msg,Opts). + + +port_scheduling(Scenario,Validation,Path) -> + DrvName = "scheduling_drv", + erl_ddll:start(), + case erl_ddll:load_driver(Path, DrvName) of + ok -> ok; + {error, Error} -> + io:format("~s\n", [erl_ddll:format_error(Error)]), + ?line ?t:fail() + end, + + Data = run_scenario(lists:flatten(Scenario),[{drvname,DrvName}]), + ok = validate_scenario(Data,Validation). + + +run_scenario([{V,{Module,Cmd,Args}}|T],Vars) -> + Res = run_command(Module,Cmd, + replace_args(Args,Vars)), + run_scenario(T,[{V,Res}|Vars]); +run_scenario([{V,{Cmd,Args}}|T],Vars) -> + run_scenario([{V,{?MODULE,Cmd,Args}}|T],Vars); +run_scenario([],Vars) -> + Vars. + +run_command(_M,spawn,{Args,Opts}) -> + Pid = spawn_opt(fun() -> apply(?MODULE,process_init,Args) end,[link|Opts]), + pal("spawn(~p): ~p",[Args,Pid]), + Pid; +run_command(M,spawn,Args) -> + run_command(M,spawn,{Args,[]}); +run_command(Mod,Func,Args) -> + erlang:display({{Mod,Func,Args},now()}), + apply(Mod,Func,Args). + +validate_scenario(Data,[{print,Var}|T]) -> + pal("Val: ~p",[proplists:get_value(Var,Data)]), + validate_scenario(Data,T); +validate_scenario(Data,[{eq,Var,Value}|T]) -> + case proplists:get_value(Var,Data) of + Value -> + validate_scenario(Data,T); + Else -> + exit({eq_return,Value,Else}) + end; +validate_scenario(Data,[{neq,Var,Value}|T]) -> + case proplists:get_value(Var,Data) of + Value -> + exit({neq_return,Value}); + _Else -> + validate_scenario(Data,T) + end; +validate_scenario(Data,[{seq,Var,Seq}|T]) -> + try + validate_sequence(proplists:get_value(Var,Data),Seq) + catch _:{validate_sequence,NotFound} -> + exit({validate_sequence,NotFound,Data}) + end, + validate_scenario(Data,T); +validate_scenario(_,[]) -> + ok. + +validate_sequence(Data,Validation) when is_binary(Data) -> + validate_sequence(binary_to_list(Data),Validation); +validate_sequence([H|R],[H|T]) -> + validate_sequence(R,T); +validate_sequence([_|R],Seq) -> + validate_sequence(R,Seq); +validate_sequence(_,[]) -> + ok; +validate_sequence([],NotFound) -> + exit({validate_sequence,NotFound}). + +replace_args({var,Var},Vars) -> + proplists:get_value(Var,Vars); +replace_args([H|T],Vars) -> + [replace_args(H,Vars)|replace_args(T,Vars)]; +replace_args([],_Vars) -> + []; +replace_args(Tuple,Vars) when is_tuple(Tuple) -> + list_to_tuple(replace_args(tuple_to_list(Tuple),Vars)); +replace_args(Else,_Vars) -> + Else. + +pal(_F,_A) -> ok. +%pal(Format,Args) -> +% ct:pal("~p "++Format,[self()|Args]). +% erlang:display(lists:flatten(io_lib:format("~p "++Format,[self()|Args]))). + + %%% Utilities. chk_range(Min, Val, Max) when Min =< Val, Val =< Max -> diff --git a/erts/emulator/test/busy_port_SUITE_data/Makefile.src b/erts/emulator/test/busy_port_SUITE_data/Makefile.src index 664909db71..b5fcf25176 100644 --- a/erts/emulator/test/busy_port_SUITE_data/Makefile.src +++ b/erts/emulator/test/busy_port_SUITE_data/Makefile.src @@ -17,9 +17,10 @@ # %CopyrightEnd% # -all: busy_drv@dll@ hard_busy_drv@dll@ soft_busy_drv@dll@ +all: busy_drv@dll@ hard_busy_drv@dll@ soft_busy_drv@dll@ scheduling_drv@dll@ @SHLIB_RULES@ hard_busy_drv@obj@: hard_busy_drv.c hs_busy_drv.c soft_busy_drv@obj@: soft_busy_drv.c hs_busy_drv.c +scheduling_drv@obj@: scheduling_drv.c diff --git a/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c b/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c index 9f6bd310c6..dcbaf500b8 100644 --- a/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c +++ b/erts/emulator/test/busy_port_SUITE_data/hs_busy_drv.c @@ -71,9 +71,9 @@ void output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) ERL_DRV_PID, driver_caller(port), ERL_DRV_TUPLE, (ErlDrvTermData) 3 }; - res = driver_output_term(port, msg, sizeof(msg)/sizeof(ErlDrvTermData)); + res = erl_drv_output_term(driver_mk_port(port), msg, sizeof(msg)/sizeof(ErlDrvTermData)); if (res <= 0) - driver_failure_atom(port, "driver_output_term failed"); + driver_failure_atom(port, "erl_drv_output_term failed"); } ErlDrvSSizeT control(ErlDrvData drv_data, unsigned int command, char *buf, diff --git a/erts/emulator/test/busy_port_SUITE_data/scheduling_drv.c b/erts/emulator/test/busy_port_SUITE_data/scheduling_drv.c new file mode 100644 index 0000000000..57be9b6392 --- /dev/null +++ b/erts/emulator/test/busy_port_SUITE_data/scheduling_drv.c @@ -0,0 +1,190 @@ +/* + * %CopyrightBegin% + * + * Copyright Ericsson AB 2009-2011. All Rights Reserved. + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% + */ + +#ifdef __WIN32__ +#include <windows.h> +#else +#include <sys/select.h> +#endif +#include <errno.h> +#include <stdio.h> +#include "erl_driver.h" + +#define get_int32(s) ((((unsigned char*) (s))[0] << 24) | \ + (((unsigned char*) (s))[1] << 16) | \ + (((unsigned char*) (s))[2] << 8) | \ + (((unsigned char*) (s))[3])) + +#define ERTS_TEST_SCHEDULING_DRV_NAME "scheduling_drv" +#define ERTS_TEST_SCHEDULING_DRV_FLAGS \ + ERL_DRV_FLAG_USE_PORT_LOCKING | ERL_DRV_FLAG_SOFT_BUSY + +ErlDrvData start(ErlDrvPort port, char *command); +void output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len); +ErlDrvSSizeT control(ErlDrvData drv_data, unsigned int command, char *buf, + ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen); +void stop(ErlDrvData drv_data); +void timeout(ErlDrvData drv_data); + +static void delay(unsigned ms); + +static ErlDrvEntry busy_drv_entry = { + NULL /* init */, + start, + stop, + output, + NULL /* ready_input */, + NULL /* ready_output */, + ERTS_TEST_SCHEDULING_DRV_NAME, + NULL /* finish */, + NULL /* handle */, + control, + timeout, + NULL /* outputv */, + NULL /* ready_async */, + NULL /* flush */, + NULL /* call */, + NULL /* event */, + ERL_DRV_EXTENDED_MARKER, + ERL_DRV_EXTENDED_MAJOR_VERSION, + ERL_DRV_EXTENDED_MINOR_VERSION, + ERTS_TEST_SCHEDULING_DRV_FLAGS, + NULL /* handle2 */, + NULL /* handle_monitor */, + NULL /* stop_select */ +}; + +#define DBG(data,FMT) +/* #define DBG(data,FMT) printf("0x%.8lx: %s",driver_caller(data->port),FMT); */ + +typedef struct SchedDrvData { + ErlDrvPort port; + char data[255]; + int curr; + int use_auto_busy; +} SchedDrvData; + +DRIVER_INIT(busy_drv) +{ + return &busy_drv_entry; +} + +ErlDrvData start(ErlDrvPort port, char *command) +{ + SchedDrvData *d = driver_alloc(sizeof(SchedDrvData)); + d->port = port; + d->curr = 0; + d->use_auto_busy = 0; + DBG(d,"start\r\n"); + return (ErlDrvData) d; +} + +void stop(ErlDrvData drv_data) { + SchedDrvData *d = (SchedDrvData*)drv_data; + driver_output(d->port,d->data,d->curr); + DBG(d,"close\r\n"); + driver_free(d); + return; +} + +void timeout(ErlDrvData drv_data) { + SchedDrvData *d = (SchedDrvData*)drv_data; + set_busy_port(d->port, 0); + DBG(d,"timeout\r\n"); +} + +void output(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) +{ + int res; + unsigned int command = *buf; + SchedDrvData *d = (SchedDrvData*)drv_data; + + switch (command) { + case 'B': /* busy */ + DBG(d,"busy: "); + set_busy_port(d->port, 1); + break; + case 'L': /* busy long call */ + DBG(d,"long: "); + delay(buf[5]*100); + set_busy_port(d->port, 1); + break; + case 'D': /* delay call */ + DBG(d,"delay: "); + delay(buf[5]*100); + break; + case 'N': /* not busy */ + DBG(d,"not"); + set_busy_port(d->port, 0); + goto done; + case 'C': /* change state */ + DBG(d,"chang: "); + break; + case 'G': /* get state */ + DBG(d,"get : "); + driver_output(d->port,d->data,d->curr); + return; + default: + driver_failure_posix((ErlDrvPort) drv_data, EINVAL); + break; + } + if (len > 1) { + unsigned int val = get_int32(buf+1); + fprintf(stderr,"%u",val); + d->data[d->curr++] = val; + } + done: + fprintf(stderr,"\r\n"); +} + +ErlDrvSSizeT control(ErlDrvData drv_data, unsigned int command, char *buf, + ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen) +{ + switch (command) { + case 'B': /* busy */ + set_busy_port((ErlDrvPort) drv_data, 1); + break; + case 'N': /* not busy */ + set_busy_port((ErlDrvPort) drv_data, 0); + break; + default: + driver_failure_posix((ErlDrvPort) drv_data, EINVAL); + break; + } + return 0; +} + + +/* + * Delays (sleeps) the given number of milli-seconds. + */ + +static void delay(unsigned ms) +{ + fprintf(stderr,"delay(%u)",ms); +#ifdef __WIN32__ + Sleep(ms); +#else + struct timeval t; + t.tv_sec = ms/1000; + t.tv_usec = (ms % 1000) * 1000; + + select(0, NULL, NULL, NULL, &t); +#endif +} diff --git a/erts/emulator/test/distribution_SUITE.erl b/erts/emulator/test/distribution_SUITE.erl index f3a177faf2..101007c288 100644 --- a/erts/emulator/test/distribution_SUITE.erl +++ b/erts/emulator/test/distribution_SUITE.erl @@ -18,7 +18,17 @@ %% -module(distribution_SUITE). --compile(r13). +-compile(r15). + +-define(VERSION_MAGIC, 131). + +-define(ATOM_EXT, 100). +-define(REFERENCE_EXT, 101). +-define(PORT_EXT, 102). +-define(PID_EXT, 103). +-define(NEW_REFERENCE_EXT, 114). +-define(ATOM_UTF8_EXT, 118). +-define(SMALL_ATOM_UTF8_EXT, 119). %% Tests distribution and the tcp driver. @@ -37,8 +47,10 @@ dist_auto_connect_never/1, dist_auto_connect_once/1, dist_parallel_send/1, atom_roundtrip/1, - atom_roundtrip_r13b/1, + unicode_atom_roundtrip/1, + atom_roundtrip_r15b/1, contended_atom_cache_entry/1, + contended_unicode_atom_cache_entry/1, bad_dist_structure/1, bad_dist_ext_receive/1, bad_dist_ext_process_info/1, @@ -62,8 +74,9 @@ all() -> link_to_dead_new_node, applied_monitor_node, ref_port_roundtrip, nil_roundtrip, stop_dist, {group, trap_bif}, {group, dist_auto_connect}, - dist_parallel_send, atom_roundtrip, atom_roundtrip_r13b, - contended_atom_cache_entry, bad_dist_structure, {group, bad_dist_ext}]. + dist_parallel_send, atom_roundtrip, unicode_atom_roundtrip, atom_roundtrip_r15b, + contended_atom_cache_entry, contended_unicode_atom_cache_entry, + bad_dist_structure, {group, bad_dist_ext}]. groups() -> [{bulk_send, [], [bulk_send_small, bulk_send_big, bulk_send_bigbig]}, @@ -1085,19 +1098,27 @@ atom_roundtrip(Config) when is_list(Config) -> ?line stop_node(Node), ?line ok. -atom_roundtrip_r13b(Config) when is_list(Config) -> - case ?t:is_release_available("r13b") of +atom_roundtrip_r15b(Config) when is_list(Config) -> + case ?t:is_release_available("r15b") of true -> ?line AtomData = atom_data(), ?line verify_atom_data(AtomData), - ?line {ok, Node} = start_node(Config, [], "r13b"), + ?line {ok, Node} = start_node(Config, [], "r15b"), ?line do_atom_roundtrip(Node, AtomData), ?line stop_node(Node), ?line ok; false -> - ?line {skip,"No OTP R13B available"} + ?line {skip,"No OTP R15B available"} end. +unicode_atom_roundtrip(Config) when is_list(Config) -> + ?line AtomData = unicode_atom_data(), + ?line verify_atom_data(AtomData), + ?line {ok, Node} = start_node(Config), + ?line do_atom_roundtrip(Node, AtomData), + ?line stop_node(Node), + ?line ok. + do_atom_roundtrip(Node, AtomData) -> ?line Parent = self(), ?line Proc = spawn_link(Node, fun () -> verify_atom_data_loop(Parent) end), @@ -1128,12 +1149,76 @@ atom_data() -> lists:seq(1, 2000)). verify_atom_data(AtomData) -> - lists:foreach(fun ({Atom, AtomTxt}) -> - AtomTxt = atom_to_list(Atom) + lists:foreach(fun ({Atom, AtomTxt}) when is_atom(Atom) -> + AtomTxt = atom_to_list(Atom); + ({PPR, AtomTxt}) -> + % Pid, Port, or Ref + AtomTxt = atom_to_list(node(PPR)) end, AtomData). +uc_atom_tup(ATxt) -> + Atom = string_to_atom(ATxt), + ATxt = atom_to_list(Atom), + {Atom, ATxt}. + +uc_pid_tup(ATxt) -> + ATxtExt = string_to_atom_ext(ATxt), + Pid = mk_pid({ATxtExt, 1}, 4711,17), + true = is_pid(Pid), + Atom = node(Pid), + true = is_atom(Atom), + ATxt = atom_to_list(Atom), + {Pid, ATxt}. + +uc_port_tup(ATxt) -> + ATxtExt = string_to_atom_ext(ATxt), + Port = mk_port({ATxtExt, 2}, 4711), + true = is_port(Port), + Atom = node(Port), + true = is_atom(Atom), + ATxt = atom_to_list(Atom), + {Port, ATxt}. + +uc_ref_tup(ATxt) -> + ATxtExt = string_to_atom_ext(ATxt), + Ref = mk_ref({ATxtExt, 3}, [4711,17, 4711]), + true = is_reference(Ref), + Atom = node(Ref), + true = is_atom(Atom), + ATxt = atom_to_list(Atom), + {Ref, ATxt}. + + +unicode_atom_data() -> + [uc_pid_tup(lists:seq(16#1f600, 16#1f600+249) ++ "@host"), + uc_pid_tup(lists:seq(16#1f600, 16#1f600+30) ++ "@host"), + uc_port_tup(lists:seq(16#1f600, 16#1f600+249) ++ "@host"), + uc_port_tup(lists:seq(16#1f600, 16#1f600+30) ++ "@host"), + uc_ref_tup(lists:seq(16#1f600, 16#1f600+249) ++ "@host"), + uc_ref_tup(lists:seq(16#1f600, 16#1f600+30) ++ "@host"), + uc_atom_tup(lists:seq(16#1f600, 16#1f600+254)), + uc_atom_tup(lists:seq(16#1f600, 16#1f600+63)), + uc_atom_tup(lists:seq(0, 254)), + uc_atom_tup(lists:seq(100, 163)), + uc_atom_tup(lists:seq(200, 354)), + uc_atom_tup(lists:seq(200, 263)), + uc_atom_tup(lists:seq(2000, 2254)), + uc_atom_tup(lists:seq(2000, 2063)), + uc_atom_tup(lists:seq(65500, 65754)), + uc_atom_tup(lists:seq(65500, 65563)) + | lists:map(fun (N) -> + uc_atom_tup(lists:seq(64000+N, 64254+N)) + end, + lists:seq(1, 2000))]. + contended_atom_cache_entry(Config) when is_list(Config) -> + contended_atom_cache_entry_test(Config, latin1). + +contended_unicode_atom_cache_entry(Config) when is_list(Config) -> + contended_atom_cache_entry_test(Config, unicode). + +contended_atom_cache_entry_test(Config, Type) -> ?line TestServer = self(), ?line ProcessPairs = 10, ?line Msgs = 100000, @@ -1147,9 +1232,16 @@ contended_atom_cache_entry(Config) when is_list(Config) -> true), Master = self(), CIX = get_cix(), - TestAtoms = get_conflicting_atoms(CIX, ProcessPairs), + TestAtoms = case Type of + latin1 -> + get_conflicting_atoms(CIX, + ProcessPairs); + unicode -> + get_conflicting_unicode_atoms(CIX, + ProcessPairs) + end, io:format("Testing with the following atoms all using " - "cache index ~p:~n ~p~n", + "cache index ~p:~n ~w~n", [CIX, TestAtoms]), Ps = lists:map( fun (A) -> @@ -1159,8 +1251,12 @@ contended_atom_cache_entry(Config) when is_list(Config) -> fun () -> Atom = receive {Ref, txt, ATxt} -> - list_to_atom( - ATxt) + case Type of + latin1 -> + list_to_atom(ATxt); + unicode -> + string_to_atom(ATxt) + end end, receive_ref_atom(Ref, Atom, @@ -1252,6 +1348,20 @@ get_conflicting_atoms(CIX, N) -> get_conflicting_atoms(CIX, N) end. +get_conflicting_unicode_atoms(_CIX, 0) -> + []; +get_conflicting_unicode_atoms(CIX, N) -> + {A, B, C} = now(), + Atom = string_to_atom([16#1f608] ++ "atom" ++ integer_to_list(A*1000000000000 + + B*1000000 + + C)), + case erts_debug:get_internal_state({atom_out_cache_index, Atom}) of + CIX -> + [Atom|get_conflicting_unicode_atoms(CIX, N-1)]; + _ -> + get_conflicting_unicode_atoms(CIX, N) + end. + -define(COOKIE, ''). -define(DOP_LINK, 1). -define(DOP_SEND, 2). @@ -2131,3 +2241,190 @@ repeat(_Fun, 0) -> repeat(Fun, N) -> Fun(), repeat(Fun, N-1). + +string_to_atom_ext(String) -> + Utf8List = string_to_utf8_list(String), + Len = length(Utf8List), + case Len < 256 of + true -> + [?SMALL_ATOM_UTF8_EXT, Len | Utf8List]; + false -> + [?ATOM_UTF8_EXT, Len bsr 8, Len band 16#ff | Utf8List] + end. + +string_to_atom(String) -> + binary_to_term(list_to_binary([?VERSION_MAGIC + | string_to_atom_ext(String)])). + +string_to_utf8_list([]) -> + []; +string_to_utf8_list([CP|CPs]) when is_integer(CP), + 0 =< CP, + CP =< 16#7F -> + [CP | string_to_utf8_list(CPs)]; +string_to_utf8_list([CP|CPs]) when is_integer(CP), + 16#80 =< CP, + CP =< 16#7FF -> + [16#C0 bor (CP bsr 6), + 16#80 bor (16#3F band CP) + | string_to_utf8_list(CPs)]; +string_to_utf8_list([CP|CPs]) when is_integer(CP), + 16#800 =< CP, + CP =< 16#FFFF -> + [16#E0 bor (CP bsr 12), + 16#80 bor (16#3F band (CP bsr 6)), + 16#80 bor (16#3F band CP) + | string_to_utf8_list(CPs)]; +string_to_utf8_list([CP|CPs]) when is_integer(CP), + 16#10000 =< CP, + CP =< 16#10FFFF -> + [16#F0 bor (CP bsr 18), + 16#80 bor (16#3F band (CP bsr 12)), + 16#80 bor (16#3F band (CP bsr 6)), + 16#80 bor (16#3F band CP) + | string_to_utf8_list(CPs)]. + +utf8_list_to_string([]) -> + []; +utf8_list_to_string([B|Bs]) when is_integer(B), + 0 =< B, + B =< 16#7F -> + [B | utf8_list_to_string(Bs)]; +utf8_list_to_string([B0, B1 | Bs]) when is_integer(B0), + 16#C0 =< B0, + B0 =< 16#DF, + is_integer(B1), + 16#80 =< B1, + B1 =< 16#BF -> + [(((B0 band 16#1F) bsl 6) + bor (B1 band 16#3F)) + | utf8_list_to_string(Bs)]; +utf8_list_to_string([B0, B1, B2 | Bs]) when is_integer(B0), + 16#E0 =< B0, + B0 =< 16#EF, + is_integer(B1), + 16#80 =< B1, + B1 =< 16#BF, + is_integer(B2), + 16#80 =< B2, + B2 =< 16#BF -> + [(((B0 band 16#F) bsl 12) + bor ((B1 band 16#3F) bsl 6) + bor (B2 band 16#3F)) + | utf8_list_to_string(Bs)]; +utf8_list_to_string([B0, B1, B2, B3 | Bs]) when is_integer(B0), + 16#F0 =< B0, + B0 =< 16#F7, + is_integer(B1), + 16#80 =< B1, + B1 =< 16#BF, + is_integer(B2), + 16#80 =< B2, + B2 =< 16#BF, + is_integer(B3), + 16#80 =< B3, + B3 =< 16#BF -> + [(((B0 band 16#7) bsl 18) + bor ((B1 band 16#3F) bsl 12) + bor ((B2 band 16#3F) bsl 6) + bor (B3 band 16#3F)) + | utf8_list_to_string(Bs)]. + +mk_pid({NodeName, Creation}, Number, Serial) when is_atom(NodeName) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_pid({NodeNameExt, Creation}, Number, Serial); +mk_pid({NodeNameExt, Creation}, Number, Serial) -> + case catch binary_to_term(list_to_binary([?VERSION_MAGIC, + ?PID_EXT, + NodeNameExt, + uint32_be(Number), + uint32_be(Serial), + uint8(Creation)])) of + Pid when is_pid(Pid) -> + Pid; + {'EXIT', {badarg, _}} -> + exit({badarg, mk_pid, [{NodeNameExt, Creation}, Number, Serial]}); + Other -> + exit({unexpected_binary_to_term_result, Other}) + end. + +mk_port({NodeName, Creation}, Number) when is_atom(NodeName) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_port({NodeNameExt, Creation}, Number); +mk_port({NodeNameExt, Creation}, Number) -> + case catch binary_to_term(list_to_binary([?VERSION_MAGIC, + ?PORT_EXT, + NodeNameExt, + uint32_be(Number), + uint8(Creation)])) of + Port when is_port(Port) -> + Port; + {'EXIT', {badarg, _}} -> + exit({badarg, mk_port, [{NodeNameExt, Creation}, Number]}); + Other -> + exit({unexpected_binary_to_term_result, Other}) + end. + +mk_ref({NodeName, Creation}, [Number] = NL) when is_atom(NodeName), + is_integer(Creation), + is_integer(Number) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_ref({NodeNameExt, Creation}, NL); +mk_ref({NodeNameExt, Creation}, [Number]) when is_integer(Creation), + is_integer(Number) -> + case catch binary_to_term(list_to_binary([?VERSION_MAGIC, + ?REFERENCE_EXT, + NodeNameExt, + uint32_be(Number), + uint8(Creation)])) of + Ref when is_reference(Ref) -> + Ref; + {'EXIT', {badarg, _}} -> + exit({badarg, mk_ref, [{NodeNameExt, Creation}, [Number]]}); + Other -> + exit({unexpected_binary_to_term_result, Other}) + end; +mk_ref({NodeName, Creation}, Numbers) when is_atom(NodeName), + is_integer(Creation), + is_list(Numbers) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_ref({NodeNameExt, Creation}, Numbers); +mk_ref({NodeNameExt, Creation}, Numbers) when is_integer(Creation), + is_list(Numbers) -> + case catch binary_to_term(list_to_binary([?VERSION_MAGIC, + ?NEW_REFERENCE_EXT, + uint16_be(length(Numbers)), + NodeNameExt, + uint8(Creation), + lists:map(fun (N) -> + uint32_be(N) + end, + Numbers)])) of + Ref when is_reference(Ref) -> + Ref; + {'EXIT', {badarg, _}} -> + exit({badarg, mk_ref, [{NodeNameExt, Creation}, Numbers]}); + Other -> + exit({unexpected_binary_to_term_result, Other}) + end. + + +uint32_be(Uint) when is_integer(Uint), 0 =< Uint, Uint < 1 bsl 32 -> + [(Uint bsr 24) band 16#ff, + (Uint bsr 16) band 16#ff, + (Uint bsr 8) band 16#ff, + Uint band 16#ff]; +uint32_be(Uint) -> + exit({badarg, uint32_be, [Uint]}). + + +uint16_be(Uint) when is_integer(Uint), 0 =< Uint, Uint < 1 bsl 16 -> + [(Uint bsr 8) band 16#ff, + Uint band 16#ff]; +uint16_be(Uint) -> + exit({badarg, uint16_be, [Uint]}). + +uint8(Uint) when is_integer(Uint), 0 =< Uint, Uint < 1 bsl 8 -> + Uint band 16#ff; +uint8(Uint) -> + exit({badarg, uint8, [Uint]}). diff --git a/erts/emulator/test/driver_SUITE_data/async_blast_drv.c b/erts/emulator/test/driver_SUITE_data/async_blast_drv.c index c2086c5860..d72b20d143 100644 --- a/erts/emulator/test/driver_SUITE_data/async_blast_drv.c +++ b/erts/emulator/test/driver_SUITE_data/async_blast_drv.c @@ -56,6 +56,7 @@ static ErlDrvEntry async_blast_drv_entry = { typedef struct { ErlDrvPort port; + ErlDrvTermData port_id; ErlDrvTermData caller; int counter; } async_blast_data_t; @@ -81,6 +82,7 @@ static ErlDrvData start(ErlDrvPort port, return ERL_DRV_ERROR_GENERAL; abd->port = port; + abd->port_id = driver_mk_port(port); abd->counter = 0; return (ErlDrvData) abd; } @@ -97,12 +99,12 @@ static void ready_async(ErlDrvData drv_data, async_blast_data_t *abd = (async_blast_data_t *) drv_data; if (--abd->counter == 0) { ErlDrvTermData spec[] = { - ERL_DRV_PORT, driver_mk_port(abd->port), + ERL_DRV_PORT, abd->port_id, ERL_DRV_ATOM, driver_mk_atom("done"), ERL_DRV_TUPLE, 2 }; - driver_send_term(abd->port, abd->caller, - spec, sizeof(spec)/sizeof(spec[0])); + erl_drv_send_term(abd->port_id, abd->caller, + spec, sizeof(spec)/sizeof(spec[0])); } } diff --git a/erts/emulator/test/driver_SUITE_data/caller_drv.c b/erts/emulator/test/driver_SUITE_data/caller_drv.c index 1ed20b0638..2731f9b317 100644 --- a/erts/emulator/test/driver_SUITE_data/caller_drv.c +++ b/erts/emulator/test/driver_SUITE_data/caller_drv.c @@ -85,9 +85,9 @@ send_caller(ErlDrvData drv_data, char *func) ERL_DRV_PID, driver_caller(port), ERL_DRV_TUPLE, (ErlDrvTermData) 4 }; - res = driver_output_term(port, msg, sizeof(msg)/sizeof(ErlDrvTermData)); + res = erl_drv_output_term(driver_mk_port(port), msg, sizeof(msg)/sizeof(ErlDrvTermData)); if (res <= 0) - driver_failure_atom(port, "driver_output_term failed"); + driver_failure_atom(port, "erl_drv_output_term failed"); } static ErlDrvData diff --git a/erts/emulator/test/driver_SUITE_data/monitor_drv.c b/erts/emulator/test/driver_SUITE_data/monitor_drv.c index 3da067fd09..81dfb65191 100644 --- a/erts/emulator/test/driver_SUITE_data/monitor_drv.c +++ b/erts/emulator/test/driver_SUITE_data/monitor_drv.c @@ -117,7 +117,7 @@ static void handle_monitor(ErlDrvData drv_data, ErlDrvMonitor *monitor) o->next = p->next; } driver_free(p); - driver_send_term(data->port, data->ipid, spec, sizeof(spec)/sizeof(ErlDrvTermData)); + erl_drv_send_term(driver_mk_port(data->port), data->ipid, spec, sizeof(spec)/sizeof(ErlDrvTermData)); } return; diff --git a/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c b/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c index 221fd0ce51..93ef767d75 100644 --- a/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c +++ b/erts/emulator/test/driver_SUITE_data/otp_9302_drv.c @@ -134,8 +134,8 @@ static void send_reply(Otp9302AsyncData *adata) ERL_DRV_ATOM, adata->term_data.msg, ERL_DRV_TUPLE, 2 }; - driver_send_term(adata->port, adata->term_data.receiver, - spec, sizeof(spec)/sizeof(spec[0])); + erl_drv_send_term(adata->term_data.port, adata->term_data.receiver, + spec, sizeof(spec)/sizeof(spec[0])); } static void enqueue_reply(Otp9302AsyncData *adata) diff --git a/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c b/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c index 0c86a26604..cbee1c3dce 100644 --- a/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c +++ b/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c @@ -177,15 +177,16 @@ static void ready_async(ErlDrvData drv_data, ErlDrvThreadData thread_data) { PeekNonXQDrvData *dp = (PeekNonXQDrvData *) drv_data; if (dp->cmd == PEEK_NONXQ_WAIT) { + ErlDrvTermData port_id = driver_mk_port(dp->port); ErlDrvTermData spec[] = { - ERL_DRV_PORT, driver_mk_port(dp->port), + ERL_DRV_PORT, port_id, ERL_DRV_ATOM, driver_mk_atom("test_successful"), ERL_DRV_TUPLE, 2 }; - driver_send_term(dp->port, - dp->caller, - spec, - sizeof(spec) / sizeof(spec[0])); + erl_drv_send_term(port_id, + dp->caller, + spec, + sizeof(spec) / sizeof(spec[0])); } if (thread_data) driver_free(thread_data); diff --git a/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c b/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c index 1070678d7b..5a9112afa3 100644 --- a/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c +++ b/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c @@ -168,8 +168,8 @@ static void *thread(void *varg) for (s = 0; s < THR_MSG_BLAST_NO_SENDS_PER_PROC; s++) { for (p = 0; p < THR_MSG_BLAST_NO_PROCS; p++) { - int res = driver_send_term(tmbd->port, tmbd->proc[p], - spec, sizeof(spec)/sizeof(spec[0])); + int res = erl_drv_send_term(tmbd->td_port, tmbd->proc[p], + spec, sizeof(spec)/sizeof(spec[0])); if (p == 0 && res <= 0) abort(); /* Could not send to creator */ } diff --git a/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c b/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c index b4542f3e36..2cd3209231 100644 --- a/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c +++ b/erts/emulator/test/erl_drv_thread_SUITE_data/testcase_driver.c @@ -42,6 +42,7 @@ typedef struct { TestCaseState_t visible; ErlDrvPort port; + ErlDrvTermData port_id; int result; jmp_buf done_jmp_buf; char *comment; @@ -98,6 +99,7 @@ testcase_drv_start(ErlDrvPort port, char *command) itcs->visible.testcase_name = testcase_name(); itcs->visible.extra = NULL; itcs->port = port; + itcs->port_id = driver_mk_port(port); itcs->result = TESTCASE_FAILED; itcs->comment = ""; @@ -143,7 +145,7 @@ testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) msg[1] = (ErlDrvTermData) result_atom; msg[2] = ERL_DRV_PORT; - msg[3] = driver_mk_port(itcs->port); + msg[3] = itcs->port_id; msg[4] = ERL_DRV_ATOM; msg[5] = driver_mk_atom(itcs->visible.testcase_name); @@ -155,7 +157,7 @@ testcase_drv_run(ErlDrvData drv_data, char *buf, ErlDrvSizeT len) msg[9] = ERL_DRV_TUPLE; msg[10] = (ErlDrvTermData) 4; - driver_output_term(itcs->port, msg, 11); + erl_drv_output_term(itcs->port_id, msg, 11); } int @@ -185,7 +187,7 @@ testcase_printf(TestCaseState_t *tcs, char *frmt, ...) msg[1] = (ErlDrvTermData) driver_mk_atom("print"); msg[2] = ERL_DRV_PORT; - msg[3] = driver_mk_port(itcs->port); + msg[3] = itcs->port_id; msg[4] = ERL_DRV_ATOM; msg[5] = driver_mk_atom(itcs->visible.testcase_name); @@ -197,7 +199,7 @@ testcase_printf(TestCaseState_t *tcs, char *frmt, ...) msg[9] = ERL_DRV_TUPLE; msg[10] = (ErlDrvTermData) 4; - driver_output_term(itcs->port, msg, 11); + erl_drv_output_term(itcs->port_id, msg, 11); } diff --git a/erts/emulator/test/num_bif_SUITE.erl b/erts/emulator/test/num_bif_SUITE.erl index 4459732257..7a045484cf 100644 --- a/erts/emulator/test/num_bif_SUITE.erl +++ b/erts/emulator/test/num_bif_SUITE.erl @@ -25,6 +25,7 @@ %% abs/1 %% float/1 %% float_to_list/1 +%% float_to_list/2 %% integer_to_list/1 %% list_to_float/1 %% list_to_integer/1 @@ -114,14 +115,46 @@ t_float(Config) when is_list(Config) -> ok. -%% Tests float_to_list/1. +%% Tests float_to_list/1, float_to_list/2. t_float_to_list(Config) when is_list(Config) -> - ?line test_ftl("0.0e+0", 0.0), - ?line test_ftl("2.5e+1", 25.0), - ?line test_ftl("2.5e+0", 2.5), - ?line test_ftl("2.5e-1", 0.25), - ?line test_ftl("-3.5e+17", -350.0e15), + test_ftl("0.0e+0", 0.0), + test_ftl("2.5e+1", 25.0), + test_ftl("2.5e+0", 2.5), + test_ftl("2.5e-1", 0.25), + test_ftl("-3.5e+17", -350.0e15), + "1.00000000000000000000e+00" = float_to_list(1.0), + "1.00000000000000000000e+00" = float_to_list(1.0, []), + "-1.00000000000000000000e+00" = float_to_list(-1.0, []), + "-1.00000000000000000000" = float_to_list(-1.0, [{decimals, 20}]), + {'EXIT', {badarg, _}} = (catch float_to_list(1.0, [{decimals, -1}])), + {'EXIT', {badarg, _}} = (catch float_to_list(1.0, [{decimals, 250}])), + {'EXIT', {badarg, _}} = (catch float_to_list(1.0e+300, [{decimals, 1}])), + "1.0e+300" = float_to_list(1.0e+300, [{scientific, 1}]), + "1.0" = float_to_list(1.0, [{decimals, 249}, compact]), + Expected = "1." ++ string:copies("0", 249) ++ "e+00", + Expected = float_to_list(1.0, [{scientific, 249}, compact]), + + X1 = float_to_list(1.0), + X2 = float_to_list(1.0, [{scientific, 20}]), + X1 = X2, + "1.000e+00" = float_to_list(1.0, [{scientific, 3}]), + "1.000" = float_to_list(1.0, [{decimals, 3}]), + "1.0" = float_to_list(1.0, [{decimals, 3}, compact]), + "1.12" = float_to_list(1.123, [{decimals, 2}]), + "1.123" = float_to_list(1.123, [{decimals, 3}]), + "1.123" = float_to_list(1.123, [{decimals, 3}, compact]), + "1.1230" = float_to_list(1.123, [{decimals, 4}]), + "1.12300" = float_to_list(1.123, [{decimals, 5}]), + "1.123" = float_to_list(1.123, [{decimals, 5}, compact]), + "1.1234" = float_to_list(1.1234,[{decimals, 6}, compact]), + "2.333333" = erlang:float_to_list(7/3, [{decimals, 6}, compact]), + "2.333333" = erlang:float_to_list(7/3, [{decimals, 6}]), + "0.00000000000000000000e+00" = float_to_list(0.0, [compact]), + "0.0" = float_to_list(0.0, [{decimals, 10}, compact]), + "123000000000000000000.0" = float_to_list(1.23e20, [{decimals, 10}, compact]), + "1.2300000000e+20" = float_to_list(1.23e20, [{scientific, 10}, compact]), + "1.23000000000000000000e+20" = float_to_list(1.23e20, []), ok. test_ftl(Expect, Float) -> diff --git a/erts/emulator/test/send_term_SUITE_data/send_term_drv.c b/erts/emulator/test/send_term_SUITE_data/send_term_drv.c index b3feca79f0..f8613487b0 100644 --- a/erts/emulator/test/send_term_SUITE_data/send_term_drv.c +++ b/erts/emulator/test/send_term_SUITE_data/send_term_drv.c @@ -664,7 +664,7 @@ static void send_term_drv_run(ErlDrvData port, char *buf, ErlDrvSizeT count) /* Signal end of test case */ msg[0] = ERL_DRV_NIL; - driver_output_term(erlang_port, msg, 1); + erl_drv_output_term(driver_mk_port(erlang_port), msg, 1); return; } break; @@ -687,14 +687,14 @@ static void send_term_drv_run(ErlDrvData port, char *buf, ErlDrvSizeT count) static void output_term(ErlDrvTermData* msg, int len) { - if (driver_output_term(erlang_port, msg, len) <= 0) { - driver_failure_atom(erlang_port, "driver_output_term_failed"); + if (erl_drv_output_term(driver_mk_port(erlang_port), msg, len) <= 0) { + driver_failure_atom(erlang_port, "erl_drv_output_term_failed"); } } static void fail_term(ErlDrvTermData* msg, int len, int line) { - int status = driver_output_term(erlang_port, msg, len); + int status = erl_drv_output_term(driver_mk_port(erlang_port), msg, len); if (status == 1) { char buf[1024]; diff --git a/erts/emulator/zlib/zlib.mk b/erts/emulator/zlib/zlib.mk index fa1f159fae..ff5ffa5328 100644 --- a/erts/emulator/zlib/zlib.mk +++ b/erts/emulator/zlib/zlib.mk @@ -63,12 +63,12 @@ endif # gcov ifeq ($(TARGET), win32) $(ZLIB_LIBRARY): $(ZLIB_OBJS) - $(AR) -out:$@ $(ZLIB_OBJS) + $(V_AR) -out:$@ $(ZLIB_OBJS) else $(ZLIB_LIBRARY): $(ZLIB_OBJS) - $(AR) $(ARFLAGS) $@ $(ZLIB_OBJS) + $(V_AR) $(ARFLAGS) $@ $(ZLIB_OBJS) -@ ($(RANLIB) $@ || true) 2>/dev/null endif $(ZLIB_OBJDIR)/%.o: zlib/%.c - $(CC) -c $(ZLIB_CFLAGS) -o $@ $< + $(V_CC) -c $(ZLIB_CFLAGS) -o $@ $< diff --git a/erts/epmd/src/Makefile.in b/erts/epmd/src/Makefile.in index 577fc77c13..e94674e6f4 100644 --- a/erts/epmd/src/Makefile.in +++ b/erts/epmd/src/Makefile.in @@ -128,13 +128,13 @@ clean: # $(BINDIR)/$(EPMD): $(EPMD_OBJS) $(ERTS_LIB) - $(PURIFY) $(LD) $(LDFLAGS) -o $@ $(EPMD_OBJS) $(LIBS) + $(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $(EPMD_OBJS) $(LIBS) $(OBJDIR)/%.o: %.c epmd.h epmd_int.h - $(CC) $(CFLAGS) $(EPMD_FLAGS) -o $@ -c $< + $(V_CC) $(CFLAGS) $(EPMD_FLAGS) -o $@ -c $< $(ERTS_LIB): - cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE) + $(make_verbose)cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE) include $(ERL_TOP)/make/otp_release_targets.mk diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c index 74408e3ebe..1d4de64b63 100644 --- a/erts/epmd/src/epmd_cli.c +++ b/erts/epmd/src/epmd_cli.c @@ -22,6 +22,7 @@ #endif #include "epmd.h" /* Renamed from 'epmd_r4.h' */ #include "epmd_int.h" +#include "erl_printf.h" /* erts_snprintf */ /* forward declarations */ @@ -114,16 +115,18 @@ void epmd_call(EpmdVars *g,int what) epmd_cleanup_exit(g,1); } j = ntohl(i); - if (!g->silent) - printf("epmd: up and running on port %d with data:\n", j); + if (!g->silent) { + rval = erts_snprintf(buf, OUTBUF_SIZE, + "epmd: up and running on port %d with data:\n", j); + write(1, buf, rval); + } while(1) { - if ((rval = read(fd,buf,1)) <= 0) { + if ((rval = read(fd,buf,OUTBUF_SIZE)) <= 0) { close(fd); epmd_cleanup_exit(g,0); } - buf[rval] = '\0'; if (!g->silent) - printf("%s",buf); + write(1, buf, rval); /* Potentially UTF-8 encoded */ } } diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h index 14d05c3f19..b25412c905 100644 --- a/erts/epmd/src/epmd_int.h +++ b/erts/epmd/src/epmd_int.h @@ -226,13 +226,25 @@ #define MAX_UNREG_COUNT 1000 #define DEBUG_MAX_UNREG_COUNT 5 -/* Maximum length of a node name == atom name */ -#define MAXSYMLEN 255 +/* + * Maximum length of a node name == atom name + * 255 characters; UTF-8 encoded -> max 255*4 + */ +#define MAXSYMLEN (255*4) #define MAX_LISTEN_SOCKETS 16 -#define INBUF_SIZE 1024 -#define OUTBUF_SIZE 1024 +/* + * Largest request: ALIVE2_REQ + * 2 + 13 + 2*MAXSYMLEN + * Largest response: PORT2_RESP + * 2 + 14 + 2*MAXSYMLEN + * + * That is, 3*MAXSYMLEN should be large enough + */ + +#define INBUF_SIZE (3*MAXSYMLEN) +#define OUTBUF_SIZE (3*MAXSYMLEN) #define get_int16(s) ((((unsigned char*) (s))[0] << 8) | \ (((unsigned char*) (s))[1])) diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c index 36565b7438..2a74c4955e 100644 --- a/erts/epmd/src/epmd_srv.c +++ b/erts/epmd/src/epmd_srv.c @@ -73,7 +73,7 @@ static int conn_open(EpmdVars*,int); static int conn_close_fd(EpmdVars*,int); static void node_init(EpmdVars*); -static Node *node_reg2(EpmdVars*,char*, int, int, unsigned char, unsigned char, int, int, int, char*); +static Node *node_reg2(EpmdVars*, int, char*, int, int, unsigned char, unsigned char, int, int, int, char*); static int node_unreg(EpmdVars*,char*); static int node_unreg_sock(EpmdVars*,int); @@ -81,6 +81,113 @@ static int reply(EpmdVars*,int,char *,int); static void dbg_print_buf(EpmdVars*,char *,int); static void print_names(EpmdVars*); +static int is_same_str(char *x, char *y) +{ + int i = 0; + /* + * Using strcmp() == 0 is probably ok, but just to be sure, + * since we got UTF-8 strings, we do it ourselves. + * + * We assume null-terminated correctly encoded UTF-8. + */ + while (x[i] == y[i]) { + if (x[i] == '\0') + return 1; + i++; + } + return 0; +} + +static int copy_str(char *x, char *y) +{ + int i = 0; + /* + * Using strcpy() is probably ok, but just to be sure, + * since we got UTF-8 strings, we do it ourselves. + * + * We assume null-terminated correctly encoded UTF-8. + */ + while (1) { + x[i] = y[i]; + if (y[i] == '\0') + return i; + i++; + } +} + +static int length_str(char *x) +{ + int i = 0; + /* + * Using strlen is probably ok, but just to be sure, + * since we got UTF-8 strings, we do it ourselves. + * + * We assume null-terminated correctly encoded UTF-8. + */ + while (x[i]) + i++; + return i; +} + +static int verify_utf8(const char *src, int sz, int null_term) +{ + unsigned char *source = (unsigned char *) src; + int size = sz; + int num_chars = 0; + while (size) { + if (null_term && (*source) == 0) + return num_chars; + if (((*source) & ((unsigned char) 0x80)) == 0) { + source++; + --size; + } else if (((*source) & ((unsigned char) 0xE0)) == 0xC0) { + if (size < 2) + return -1; + if (((source[1] & ((unsigned char) 0xC0)) != 0x80) || + ((*source) < 0xC2) /* overlong */) { + return -1; + } + source += 2; + size -= 2; + } else if (((*source) & ((unsigned char) 0xF0)) == 0xE0) { + if (size < 3) + return -1; + if (((source[1] & ((unsigned char) 0xC0)) != 0x80) || + ((source[2] & ((unsigned char) 0xC0)) != 0x80) || + (((*source) == 0xE0) && (source[1] < 0xA0)) /* overlong */ ) { + return -1; + } + if ((((*source) & ((unsigned char) 0xF)) == 0xD) && + ((source[1] & 0x20) != 0)) { + return -1; + } + source += 3; + size -= 3; + } else if (((*source) & ((unsigned char) 0xF8)) == 0xF0) { + if (size < 4) + return -1; + if (((source[1] & ((unsigned char) 0xC0)) != 0x80) || + ((source[2] & ((unsigned char) 0xC0)) != 0x80) || + ((source[3] & ((unsigned char) 0xC0)) != 0x80) || + (((*source) == 0xF0) && (source[1] < 0x90)) /* overlong */) { + return -1; + } + if ((((*source) & ((unsigned char)0x7)) > 0x4U) || + ((((*source) & ((unsigned char)0x7)) == 0x4U) && + ((source[1] & ((unsigned char)0x3F)) > 0xFU))) { + return -1; + } + source += 4; + size -= 4; + } else { + return -1; + } + ++num_chars; + } + return num_chars; +} + + static EPMD_INLINE void select_fd_set(EpmdVars* g, int fd) { FD_SET(fd, &g->orig_read_mask); @@ -525,10 +632,11 @@ static void do_request(g, fd, s, buf, bsize) } name = &buf[11]; name[namelen]='\000'; + extra = &buf[11+namelen+2]; extra[extralen]='\000'; wbuf[0] = EPMD_ALIVE2_RESP; - if ((node = node_reg2(g, name, fd, eport, nodetype, protocol, + if ((node = node_reg2(g, namelen, name, fd, eport, nodetype, protocol, highvsn, lowvsn, extralen, extra)) == NULL) { wbuf[1] = 1; /* error */ put_int16(99, wbuf+2); @@ -573,22 +681,28 @@ static void do_request(g, fd, s, buf, bsize) { char *name = &buf[1]; /* Points to node name */ + int nsz; Node *node; - + + nsz = verify_utf8(name, bsize, 0); + if (nsz < 1 || 255 < nsz) { + dbg_printf(g,0,"invalid node name in PORT2_REQ"); + return; + } + wbuf[0] = EPMD_PORT2_RESP; for (node = g->nodes.reg; node; node = node->next) { int offset; - if (strcmp(node->symname, name) == 0) { + if (is_same_str(node->symname, name)) { wbuf[1] = 0; /* ok */ put_int16(node->port,wbuf+2); wbuf[4] = node->nodetype; wbuf[5] = node->protocol; put_int16(node->highvsn,wbuf+6); put_int16(node->lowvsn,wbuf+8); - put_int16(strlen(node->symname),wbuf+10); + put_int16(length_str(node->symname),wbuf+10); offset = 12; - strcpy(wbuf + offset,node->symname); - offset += strlen(node->symname); + offset += copy_str(wbuf + offset,node->symname); put_int16(node->extralen,wbuf + offset); offset += 2; memcpy(wbuf + offset,node->extra,node->extralen); @@ -629,15 +743,22 @@ static void do_request(g, fd, s, buf, bsize) for (node = g->nodes.reg; node; node = node->next) { - int len; + int len = 0; + int r; /* CAREFUL!!! These are parsed by "erl_epmd.erl" so a slight change in syntax will break < OTP R3A */ - erts_snprintf(wbuf, sizeof(wbuf), "name %s at port %d\n",node->symname, node->port); - len = strlen(wbuf); + len += copy_str(&wbuf[len], "name "); + len += copy_str(&wbuf[len], node->symname); + r = erts_snprintf(&wbuf[len], sizeof(wbuf)-len, + " at port %d\n", node->port); + if (r < 0) + goto failed_names_resp; + len += r; if (reply(g, fd, wbuf, len) != len) { + failed_names_resp: dbg_tty_printf(g,1,"failed to send NAMES_RESP"); return; } @@ -665,16 +786,22 @@ static void do_request(g, fd, s, buf, bsize) for (node = g->nodes.reg; node; node = node->next) { - int len; + int len = 0, r; /* CAREFUL!!! These are parsed by "erl_epmd.erl" so a slight change in syntax will break < OTP R3A */ - erts_snprintf(wbuf, sizeof(wbuf), "active name <%s> at port %d, fd = %d\n", - node->symname, node->port, node->fd); - len = strlen(wbuf) + 1; - if (reply(g, fd,wbuf,len) != len) + len += copy_str(&wbuf[len], "active name <"); + len += copy_str(&wbuf[len], node->symname); + r = erts_snprintf(&wbuf[len], sizeof(wbuf)-len, + "> at port %d, fd = %d\n", + node->port, node->fd); + if (r < 0) + goto failed_dump_resp; + len += r + 1; + if (reply(g, fd,wbuf,len) != len) { + failed_dump_resp: dbg_tty_printf(g,1,"failed to send DUMP_RESP"); return; } @@ -682,16 +809,22 @@ static void do_request(g, fd, s, buf, bsize) for (node = g->nodes.unreg; node; node = node->next) { - int len; + int len = 0, r; /* CAREFUL!!! These are parsed by "erl_epmd.erl" so a slight change in syntax will break < OTP R3A */ - erts_snprintf(wbuf, sizeof(wbuf), "old/unused name <%s>, port = %d, fd = %d \n", - node->symname,node->port, node->fd); - len = strlen(wbuf) + 1; - if (reply(g, fd,wbuf,len) != len) + len += copy_str(&wbuf[len], "old/unused name <"); + len += copy_str(&wbuf[len], node->symname); + r = erts_snprintf(&wbuf[len], sizeof(wbuf)-len, + ">, port = %d, fd = %d \n", + node->port, node->fd); + if (r < 0) + goto failed_dump_resp2; + len += r + 1; + if (reply(g, fd,wbuf,len) != len) { + failed_dump_resp2: dbg_tty_printf(g,1,"failed to send DUMP_RESP"); return; } @@ -933,7 +1066,7 @@ static int node_unreg(EpmdVars *g,char *name) Node *node = g->nodes.reg; /* Point to first node */ for (; node; prev = &node->next, node = node->next) - if (strcmp(node->symname, name) == 0) + if (is_same_str(node->symname, name)) { dbg_tty_printf(g,1,"unregistering '%s:%d', port %d", node->symname, node->creation, node->port); @@ -1013,6 +1146,7 @@ static int node_unreg_sock(EpmdVars *g,int fd) */ static Node *node_reg2(EpmdVars *g, + int namelen, char* name, int fd, int port, @@ -1025,6 +1159,7 @@ static Node *node_reg2(EpmdVars *g, { Node *prev; /* Point to previous node or NULL */ Node *node; /* Point to first node */ + int sz; /* Can be NULL; means old style */ if (extra == NULL) @@ -1032,21 +1167,47 @@ static Node *node_reg2(EpmdVars *g, /* Fail if node name is too long */ - if (strlen(name) > MAXSYMLEN) + + if (namelen > MAXSYMLEN) { - dbg_printf(g,0,"node name is too long (%d) %s", strlen(name), name); + too_long_name: + dbg_printf(g,0,"node name is too long (%d) %s", namelen, name); return NULL; } + + sz = verify_utf8(name, namelen, 0); + if (sz > 255) + goto too_long_name; + + if (sz < 0) { + dbg_printf(g,0,"invalid node name encoding"); + return NULL; + } + if (extralen > MAXSYMLEN) { - dbg_printf(g,0,"extra data is too long (%d) %s", strlen(name), name); +#if 0 + too_long_extra: +#endif + dbg_printf(g,0,"extra data is too long (%d) %s", extralen, extra); return NULL; } +#if 0 /* Should we require valid utf8 here? */ + sz = verify_utf8(extra, extralen, 0); + if (sz > 255) + goto too_long_extra; + + if (sz < 0) { + dbg_printf(g,0,"invalid extra data encoding"); + return NULL; + } +#endif + /* Fail if it is already registered */ for (node = g->nodes.reg; node; node = node->next) - if (strcmp(node->symname, name) == 0) + if (is_same_str(node->symname, name)) { dbg_printf(g,0,"node name already occupied %s", name); return NULL; @@ -1058,7 +1219,7 @@ static Node *node_reg2(EpmdVars *g, prev = NULL; for (node = g->nodes.unreg; node; prev = node, node = node->next) - if (strcmp(node->symname, name) == 0) + if (is_same_str(node->symname, name)) { dbg_tty_printf(g,1,"reusing slot with same name '%s'", node->symname); @@ -1126,7 +1287,7 @@ static Node *node_reg2(EpmdVars *g, node->lowvsn = lowvsn; node->extralen = extralen; memcpy(node->extra,extra,extralen); - strcpy(node->symname,name); + copy_str(node->symname,name); select_fd_set(g, fd); if (highvsn == 0) { diff --git a/erts/epmd/test/epmd_SUITE.erl b/erts/epmd/test/epmd_SUITE.erl index fd9969ae2b..fc0abef400 100644 --- a/erts/epmd/test/epmd_SUITE.erl +++ b/erts/epmd/test/epmd_SUITE.erl @@ -45,6 +45,8 @@ register_names_1/1, register_names_2/1, register_duplicate_name/1, + unicode_name/1, + long_unicode_name/1, get_port_nr/1, slow_get_port_nr/1, unregister_others_name_1/1, @@ -107,7 +109,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [register_name, register_names_1, register_names_2, - register_duplicate_name, get_port_nr, slow_get_port_nr, + register_duplicate_name, unicode_name, long_unicode_name, + get_port_nr, slow_get_port_nr, unregister_others_name_1, unregister_others_name_2, register_overflow, name_with_null_inside, name_null_terminated, stupid_names_req, no_data, @@ -197,6 +200,37 @@ register_duplicate_name(Config) when is_list(Config) -> ?line ok = close(Sock), % Unregister ok. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +unicode_name(doc) -> + ["Check that we can register and lookup a unicode name"]; +unicode_name(suite) -> + []; +unicode_name(Config) when is_list(Config) -> + ok = epmdrun(), + NodeName = [16#1f608], + {ok,Sock} = register_node_v2(4711, 72, 0, 5, 5, NodeName, []), + {ok,NodeInfo} = port_please_v2(NodeName), + NodeName = NodeInfo#node_info.node_name, + ok = close(Sock), + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +long_unicode_name(doc) -> + ["Check that we can register and lookup a long unicode name"]; +long_unicode_name(suite) -> + []; +long_unicode_name(Config) when is_list(Config) -> + ok = epmdrun(), + BaseChar = 16#1f600, + NodeName = lists:seq(BaseChar, BaseChar+200), % will be 800 bytes long + {ok,Sock} = register_node_v2(4711, 72, 0, 5, 5, NodeName, []), + {ok,NodeInfo} = port_please_v2(NodeName), + NodeName = NodeInfo#node_info.node_name, + ok = close(Sock), + ok. + % Internal function to register a node name, no close, i.e. unregister register_node(Name) -> @@ -205,9 +239,10 @@ register_node(Name,Port) -> register_node_v2(Port,$M,0,5,5,Name,""). register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> + Utf8Name = unicode:characters_to_binary(Name), Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot, put16(HVsn), put16(LVsn), - size16(Name), Name, + put16(size(Utf8Name)), binary_to_list(Utf8Name), size16(Extra), Extra], case send_req(Req) of {ok,Sock} -> @@ -226,7 +261,8 @@ register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> % Internal function to fetch information about a node port_please_v2(Name) -> - case send_req([?EPMD_PORT_PLEASE2_REQ, Name]) of + case send_req([?EPMD_PORT_PLEASE2_REQ, + binary_to_list(unicode:characters_to_binary(Name))]) of {ok,Sock} -> case recv_until_sock_closes(Sock) of {ok, Resp} -> @@ -247,7 +283,7 @@ parse_port2_resp(Resp) -> ELen:16,Extra:ELen/binary>> when Res =:= 0 -> {ok, #node_info{port=Port,node_type=NodeType,prot=Prot, hvsn=HVsn,lvsn=LVsn, - node_name=binary_to_list(NodeName), + node_name=unicode:characters_to_list(NodeName), extra=binary_to_list(Extra)}}; _Other -> test_server:format("invalid port2 resp: ~p~n", @@ -737,7 +773,7 @@ buffer_overrun_2(doc) -> ["Test security vulnerability in fake extra lengths in alive2_req"]; buffer_overrun_2(Config) when is_list(Config) -> ?line ok = epmdrun(), - ?line [false | Rest] = [hostile2(N) || N <- lists:seq(255,10000)], + ?line [false | Rest] = [hostile2(N) || N <- lists:seq(255*4,10000)], ?line true = alltrue(Rest), ok. hostile(N) -> @@ -880,6 +916,7 @@ no_live_killing(Config) when is_list(Config) -> ?line close(Sock3), ok. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Terminate all tests with killing epmd. diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in index ea70946346..5c1ce51644 100644 --- a/erts/etc/common/Makefile.in +++ b/erts/etc/common/Makefile.in @@ -17,6 +17,7 @@ # %CopyrightEnd% # +include $(ERL_TOP)/make/output.mk include $(ERL_TOP)/make/target.mk ERTS_LIB_TYPEMARKER=.$(TYPE) @@ -191,7 +192,7 @@ etc: $(ENTRY_OBJ) $(INSTALL_PROGS) $(INSTALL_LIBS) $(TEXTFILES) $(INSTALL_TOP_BI # erlexec needs the erts_internal library... $(ERTS_LIB): - cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE) + $(V_at)cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE) .PHONY: docs docs: @@ -249,23 +250,23 @@ endif ifeq ($(TARGET),win32) $(BINDIR)/$(ERLEXEC): $(OBJDIR)/erlexec.o $(OBJDIR)/win_erlexec.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) $(ERTS_LIB) - $(LD) -dll $(LDFLAGS) -o $@ $(OBJDIR)/erlexec.o $(OBJDIR)/win_erlexec.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) $(ERTS_INTERNAL_LIBS) + $(V_LD) -dll $(LDFLAGS) -o $@ $(OBJDIR)/erlexec.o $(OBJDIR)/win_erlexec.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) $(ERTS_INTERNAL_LIBS) $(BINDIR)/erl@EXEEXT@: $(OBJDIR)/erl.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) - $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/erl.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) + $(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/erl.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) $(BINDIR)/werl@EXEEXT@: $(OBJDIR)/werl.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) - $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/werl.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) + $(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/werl.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) $(BINDIR)/start_erl@EXEEXT@: $(OBJDIR)/start_erl.o - $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/start_erl.o + $(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/start_erl.o $(BINDIR)/Install@EXEEXT@: $(OBJDIR)/Install.o $(OBJDIR)/init_file.o - $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/Install.o $(OBJDIR)/init_file.o + $(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/Install.o $(OBJDIR)/init_file.o # The service expects to be compiled with $(MT_FLAG) flag. $(BINDIR)/erlsrv@EXEEXT@: $(ERLSRV_OBJECTS) - $(LD) $(LDFLAGS) $(MT_FLAG) -o $@ $(ERLSRV_OBJECTS) + $(V_LD) $(LDFLAGS) $(MT_FLAG) -o $@ $(ERLSRV_OBJECTS) # To fix a spooky parallel make build problem on Windows there are some # false dependencies on the $(MC), $(RC) and .o rules. The theory behind @@ -280,62 +281,62 @@ $(BINDIR)/erlsrv@EXEEXT@: $(ERLSRV_OBJECTS) LOGMESS_GENERATED = $(OBJDIR)/LOGMESS-GENERATED $(MC_OUTPUTS): $(LOGMESS_GENERATED) $(LOGMESS_GENERATED): $(WINETC)/erlsrv/erlsrv_logmess.mc - $(MC) -o $(OBJDIR) $(WINETC)/erlsrv/erlsrv_logmess.mc && \ + $(V_MC) -o $(OBJDIR) $(WINETC)/erlsrv/erlsrv_logmess.mc && \ echo $? >$(LOGMESS_GENERATED) $(OBJDIR)/$(ERLRES_OBJ): $(WINETC)/erl.rc $(WINETC)/erlang.ico \ $(WINETC)/erl_icon.ico $(WINETC)/hrl_icon.ico \ $(WINETC)/beam_icon.ico $(LOGMESS_GENERATED) - $(RC) -o $@ -I$(WINETC) $(WINETC)/erl.rc + $(V_RC) -o $@ -I$(WINETC) $(WINETC)/erl.rc ifeq ($(USING_VC), yes) RC_GENERATED = $(OBJDIR)/erlsrv_logmess.res $(RC_GENERATED): $(OBJDIR)/erlsrv_logmess.rc $(OBJDIR)/$(ERLRES_OBJ) - $(RC) -o $(OBJDIR)/erlsrv_logmess.res -I$(OBJDIR) $(OBJDIR)/erlsrv_logmess.rc + $(V_RC) -o $(OBJDIR)/erlsrv_logmess.res -I$(OBJDIR) $(OBJDIR)/erlsrv_logmess.rc else RC_GENERATED = $(OBJDIR)/erlsrv_logmess.o $(RC_GENERATED): $(OBJDIR)/erlsrv_logmess.res $(OBJDIR)/$(ERLRES_OBJ) - $(RC) -o $(OBJDIR)/erlsrv_logmess.o -I$(OBJDIR) $(OBJDIR)/erlsrv_logmess.res + $(V_RC) -o $(OBJDIR)/erlsrv_logmess.o -I$(OBJDIR) $(OBJDIR)/erlsrv_logmess.res endif # The service expects to be compiled with $(MT_FLAG) flag. $(OBJDIR)/%.o: $(WINETC)/erlsrv/%.c $(ERLSRV_HEADERS) $(RC_GENERATED) - $(CC) $(CFLAGS) $(MT_FLAG) -o $@ -c $< + $(V_CC) $(CFLAGS) $(MT_FLAG) -o $@ -c $< $(OBJDIR)/erlsrv_util.o: $(WINETC)/erlsrv/erlsrv_util.c $(ERLSRV_HEADERS) \ $(OBJDIR)/erlsrv_logmess.h $(RC_GENERATED) - $(CC) $(CFLAGS) -I$(OBJDIR) $(MT_FLAG) -o $@ -c $< + $(V_CC) $(CFLAGS) -I$(OBJDIR) $(MT_FLAG) -o $@ -c $< $(OBJDIR)/werl.o: $(WINETC)/erl.c $(WINETC)/init_file.h $(RC_GENERATED) - $(CC) $(CFLAGS) -DBUILD_TYPE=\"-$(TYPE)\" -DERL_RUN_SHARED_LIB=1 \ + $(V_CC) $(CFLAGS) -DBUILD_TYPE=\"-$(TYPE)\" -DERL_RUN_SHARED_LIB=1 \ -DWIN32_WERL -o $@ -c $(WINETC)/erl.c $(OBJDIR)/erl.o: $(WINETC)/erl.c $(WINETC)/init_file.h $(RC_GENERATED) - $(CC) $(CFLAGS) -DBUILD_TYPE=\"-$(TYPE)\" -DERL_RUN_SHARED_LIB=1 \ + $(V_CC) $(CFLAGS) -DBUILD_TYPE=\"-$(TYPE)\" -DERL_RUN_SHARED_LIB=1 \ -o $@ -c $(WINETC)/erl.c $(OBJDIR)/erlexec.o: $(ERLEXECDIR)/erlexec.c $(RC_GENERATED) - $(CC) $(CFLAGS) -DBUILD_TYPE=\"-$(TYPE)\" -DERL_RUN_SHARED_LIB=1 \ + $(V_CC) $(CFLAGS) -DBUILD_TYPE=\"-$(TYPE)\" -DERL_RUN_SHARED_LIB=1 \ -o $@ -c $(ERLEXECDIR)/erlexec.c $(OBJDIR)/win_erlexec.o: $(WINETC)/win_erlexec.c $(RC_GENERATED) - $(CC) $(CFLAGS) -DBUILD_TYPE=\"-$(TYPE)\" -DERL_RUN_SHARED_LIB=1 \ + $(V_CC) $(CFLAGS) -DBUILD_TYPE=\"-$(TYPE)\" -DERL_RUN_SHARED_LIB=1 \ -o $@ -c $(WINETC)/win_erlexec.c $(OBJDIR)/init_file.o: $(WINETC)/init_file.c $(WINETC)/init_file.h $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c $(WINETC)/init_file.c + $(V_CC) $(CFLAGS) -o $@ -c $(WINETC)/init_file.c $(OBJDIR)/Install.o: $(WINETC)/Install.c $(WINETC)/init_file.h $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c $(WINETC)/Install.c + $(V_CC) $(CFLAGS) -o $@ -c $(WINETC)/Install.c $(OBJDIR)/start_erl.o: $(WINETC)/start_erl.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c $(WINETC)/start_erl.c + $(V_CC) $(CFLAGS) -o $@ -c $(WINETC)/start_erl.c $(ENTRY_OBJ): $(ENTRY_SRC) $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c $(ENTRY_SRC) + $(V_CC) $(CFLAGS) -o $@ -c $(ENTRY_SRC) Install.ini: ../$(TARGET)/Install.src ../../vsn.mk $(TARGET)/Makefile - sed -e 's;%I_VSN%;$(VSN);' \ + $(vsn_verbose)sed -e 's;%I_VSN%;$(VSN);' \ -e 's;%I_SYSTEM_VSN%;$(SYSTEM_VSN);' \ ../$(TARGET)/Install.src > Install.ini @@ -348,99 +349,99 @@ endif #--------------------------------------------------------- $(BINDIR)/heart@EXEEXT@: $(OBJDIR)/heart.o $(ENTRY_OBJ) - $(LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/heart.o \ + $(V_LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/heart.o \ $(RTLIBS) $(ENTRY_OBJ) $(WINDSOCK) $(OBJDIR)/heart.o: heart.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c heart.c + $(V_CC) $(CFLAGS) -o $@ -c heart.c # # Objects & executables # #$(OBJDIR)/%.o: %.c -# $(CC) $(CFLAGS) -o $@ -c $< +# $(V_CC) $(CFLAGS) -o $@ -c $< # #$(OBJDIR)/%.o: ../unix/%.c -# $(CC) $(CFLAGS) -o $@ -c $< +# $(V_CC) $(CFLAGS) -o $@ -c $< # #$(BINDIR)/%: $(OBJDIR)/%.o -# $(PURIFY) $(LD) $(LDFLAGS) -o $@ $< $(LIBS) +# $(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $< $(LIBS) $(OBJDIR)/inet_gethost.o: inet_gethost.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c inet_gethost.c + $(V_CC) $(CFLAGS) -o $@ -c inet_gethost.c $(BINDIR)/inet_gethost@EXEEXT@: $(OBJDIR)/inet_gethost.o $(ENTRY_OBJ) $(ERTS_LIB) - $(PURIFY) $(LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/inet_gethost.o $(ENTRY_OBJ) $(LIBS) $(ERTS_INTERNAL_LIBS) + $(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/inet_gethost.o $(ENTRY_OBJ) $(LIBS) $(ERTS_INTERNAL_LIBS) $(BINDIR)/run_erl: $(OBJDIR)/safe_string.o $(OBJDIR)/run_erl.o - $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/safe_string.o $(OBJDIR)/run_erl.o $(LIBS) + $(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/safe_string.o $(OBJDIR)/run_erl.o $(LIBS) $(OBJDIR)/run_erl.o: ../unix/run_erl.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c ../unix/run_erl.c + $(V_CC) $(CFLAGS) -o $@ -c ../unix/run_erl.c $(BINDIR)/to_erl: $(OBJDIR)/safe_string.o $(OBJDIR)/to_erl.o - $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/safe_string.o $(OBJDIR)/to_erl.o + $(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/safe_string.o $(OBJDIR)/to_erl.o $(OBJDIR)/to_erl.o: ../unix/to_erl.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c ../unix/to_erl.c + $(V_CC) $(CFLAGS) -o $@ -c ../unix/to_erl.c $(BINDIR)/dyn_erl: $(OBJDIR)/safe_string.o $(OBJDIR)/dyn_erl.o - $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/safe_string.o $(OBJDIR)/dyn_erl.o + $(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/safe_string.o $(OBJDIR)/dyn_erl.o $(OBJDIR)/dyn_erl.o: ../unix/dyn_erl.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c ../unix/dyn_erl.c + $(V_CC) $(CFLAGS) -o $@ -c ../unix/dyn_erl.c $(OBJDIR)/safe_string.o: ../unix/safe_string.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c ../unix/safe_string.c + $(V_CC) $(CFLAGS) -o $@ -c ../unix/safe_string.c ifneq ($(TARGET),win32) $(BINDIR)/$(ERLEXEC): $(OBJDIR)/$(ERLEXEC).o $(ERTS_LIB) - $(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/$(ERLEXEC).o $(ERTS_INTERNAL_LIBS) + $(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/$(ERLEXEC).o $(ERTS_INTERNAL_LIBS) $(OBJDIR)/$(ERLEXEC).o: $(ERLEXECDIR)/$(ERLEXEC).c $(RC_GENERATED) - $(CC) -I$(EMUDIR) $(CFLAGS) -o $@ -c $(ERLEXECDIR)/$(ERLEXEC).c + $(V_CC) -I$(EMUDIR) $(CFLAGS) -o $@ -c $(ERLEXECDIR)/$(ERLEXEC).c endif $(BINDIR)/erlc@EXEEXT@: $(OBJDIR)/erlc.o $(ERTS_LIB) - $(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/erlc.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) + $(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/erlc.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) $(OBJDIR)/erlc.o: erlc.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c erlc.c + $(V_CC) $(CFLAGS) -o $@ -c erlc.c $(BINDIR)/dialyzer@EXEEXT@: $(OBJDIR)/dialyzer.o $(ERTS_LIB) - $(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/dialyzer.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) + $(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/dialyzer.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) $(OBJDIR)/dialyzer.o: dialyzer.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c dialyzer.c + $(V_CC) $(CFLAGS) -o $@ -c dialyzer.c $(BINDIR)/typer@EXEEXT@: $(OBJDIR)/typer.o $(ERTS_LIB) - $(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/typer.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) + $(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/typer.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) $(OBJDIR)/typer.o: typer.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c typer.c + $(V_CC) $(CFLAGS) -o $@ -c typer.c $(BINDIR)/escript@EXEEXT@: $(OBJDIR)/escript.o $(ERTS_LIB) - $(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/escript.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) + $(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/escript.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) $(OBJDIR)/escript.o: escript.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c escript.c + $(V_CC) $(CFLAGS) -o $@ -c escript.c $(BINDIR)/ct_run@EXEEXT@: $(OBJDIR)/ct_run.o $(ERTS_LIB) - $(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/ct_run.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) + $(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/ct_run.o -L$(OBJDIR) $(LIBS) $(ERTS_INTERNAL_LIBS) $(OBJDIR)/ct_run.o: ct_run.c $(RC_GENERATED) - $(CC) $(CFLAGS) -o $@ -c ct_run.c + $(V_CC) $(CFLAGS) -o $@ -c ct_run.c Install: ../unix/Install.src ../../vsn.mk $(TARGET)/Makefile - sed -e 's;%I_VSN%;$(VSN);' \ + $(vsn_verbose)sed -e 's;%I_VSN%;$(VSN);' \ -e 's;%EMULATOR%;$(EMULATOR);' \ -e 's;%EMULATOR_NUMBER%;$(EMULATOR_NUMBER);' \ -e 's;%I_SYSTEM_VSN%;$(SYSTEM_VSN);' \ ../unix/Install.src > Install erl.src: ../unix/erl.src.src ../../vsn.mk $(TARGET)/Makefile - sed -e 's;%EMULATOR%;$(EMULATOR);' \ + $(vsn_verbose)sed -e 's;%EMULATOR%;$(EMULATOR);' \ -e 's;%EMULATOR_NUMBER%;$(EMULATOR_NUMBER);' \ -e 's;%VSN%;$(VSN);' \ ../unix/erl.src.src > erl.src diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c index 50c61f50eb..d865164bb0 100644 --- a/erts/etc/common/erlexec.c +++ b/erts/etc/common/erlexec.c @@ -124,6 +124,7 @@ static char *pluss_val_switches[] = { "bwt", "cl", "ct", + "tbt", "wt", "ws", "ss", diff --git a/erts/etc/common/escript.c b/erts/etc/common/escript.c index 9e80ec6656..3566406bf3 100644 --- a/erts/etc/common/escript.c +++ b/erts/etc/common/escript.c @@ -264,7 +264,7 @@ append_shebang_args(char* scriptname) static char linebuf[LINEBUFSZ]; char* ptr = fgets(linebuf, LINEBUFSZ, fd); - if (ptr != NULL && linebuf[0] == '#' && linebuf[1] == '!') { + if (ptr != NULL) { /* Try to find args on second or third line */ ptr = fgets(linebuf, LINEBUFSZ, fd); if (ptr != NULL && linebuf[0] == '%' && linebuf[1] == '%' && linebuf[2] == '!') { diff --git a/erts/lib_src/Makefile.in b/erts/lib_src/Makefile.in index aed889eaef..88083bfe7d 100644 --- a/erts/lib_src/Makefile.in +++ b/erts/lib_src/Makefile.in @@ -17,6 +17,7 @@ # %CopyrightEnd% # +include $(ERL_TOP)/make/output.mk include $(ERL_TOP)/make/target.mk include ../include/internal/$(TARGET)/ethread.mk @@ -326,6 +327,7 @@ _create_dirs := $(shell mkdir -p $(CREATE_DIRS)) all: $(OBJ_DIR)/MADE $(OBJ_DIR)/MADE: $(ETHREAD_LIB) $(ERTS_LIBS) $(ERTS_INTERNAL_LIBS) + $(gen_verbose) ifeq ($(OMIT_OMIT_FP),yes) @echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *' @echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *' @@ -335,7 +337,7 @@ ifeq ($(OMIT_OMIT_FP),yes) @echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *' @echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *' endif - echo $? > $(OBJ_DIR)/MADE + $(V_at)echo $? > $(OBJ_DIR)/MADE # # The libs ... @@ -345,93 +347,97 @@ AR_OUT=-out: AR_FLAGS= else AR_OUT= +ifeq ($(V),0) +AR_FLAGS=rc +else AR_FLAGS=rcv endif +endif ifndef RANLIB RANLIB=true endif $(ETHREAD_LIB): $(ETHREAD_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ETHREAD_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ETHREAD_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_INTERNAL_LIB): $(ERTS_INTERNAL_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_INTERNAL_r_LIB): $(ERTS_INTERNAL_r_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_r_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_r_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_MD_LIB): $(ERTS_MD_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MD_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MD_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_MDd_LIB): $(ERTS_MDd_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MDd_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MDd_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_MT_LIB): $(ERTS_MT_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MT_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MT_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_MTd_LIB): $(ERTS_MTd_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MTd_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MTd_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_r_LIB): $(ERTS_r_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_r_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_r_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_LIB): $(ERTS_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_LIB_OBJS) + $(V_RANLIB) $@ # # Object files # $(r_OBJ_DIR)/ethr_x86_sse2_asm.o: pthread/ethr_x86_sse2_asm.c - $(CC) -msse2 $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) -msse2 $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(r_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(r_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(OBJ_DIR)/%.o: common/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ # Win32 specific $(MD_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@ $(MD_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@ $(MDd_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@ $(MDd_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@ $(MT_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@ $(MT_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@ $(MTd_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@ $(MTd_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@ # # Install @@ -560,73 +566,74 @@ DEPEND_MK=$(OBJ_DIR)/depend.mk .PHONY: depend depend: $(DEPEND_MK) $(DEPEND_MK): - @echo "Generating dependency file $(DEPEND_MK)..." + $(gen_verbose) + $(V_colon)@echo "Generating dependency file $(DEPEND_MK)..." @echo "# Generated dependency rules" > $(DEPEND_MK); @echo "# " >> $(DEPEND_MK); ifneq ($(strip $(ETHREAD_LIB_SRC)),) @echo "# ethread lib objects..." >> $(DEPEND_MK); ifeq ($(USING_VC),yes) - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) else - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ - | $(SED_r_DEPEND) >> $(DEPEND_MK) + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ + | $(SED_r_DEPEND) >$(V_at)> $(DEPEND_MK) endif endif ifneq ($(strip $(ERTS_INTERNAL_LIB_SRCS)),) ifneq ($(strip $(ETHREAD_LIB_SRC)),) @echo "# erts_internal_r lib objects..." >> $(DEPEND_MK); ifeq ($(USING_VC),yes) - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) else - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_r_DEPEND) >> $(DEPEND_MK) endif endif @echo "# erts_internal lib objects..." >> $(DEPEND_MK); ifeq ($(USING_VC),yes) - $(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) - $(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) else - $(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_DEPEND) >> $(DEPEND_MK) endif endif ifneq ($(strip $(ERTS_LIB_SRCS)),) ifeq ($(USING_VC),yes) @echo "# erts_MD lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) @echo "# erts_MDd lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) @echo "# erts_MT lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_MT_DEPEND) >> $(DEPEND_MK) @echo "# erts_MTd lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_MTd_DEPEND) >> $(DEPEND_MK) @echo "# erts_internal_r lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) @echo "# erts_internal_r.debug lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) else ifneq ($(strip $(ETHREAD_LIB_SRC)),) @echo "# erts_r lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_r_DEPEND) >> $(DEPEND_MK) endif @echo "# erts lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_DEPEND) >> $(DEPEND_MK) endif endif diff --git a/erts/preloaded/ebin/erlang.beam b/erts/preloaded/ebin/erlang.beam Binary files differindex bea586b11c..4ff729e06c 100644 --- a/erts/preloaded/ebin/erlang.beam +++ b/erts/preloaded/ebin/erlang.beam diff --git a/erts/preloaded/ebin/prim_file.beam b/erts/preloaded/ebin/prim_file.beam Binary files differindex ff44d38fa9..b8f71b0c1e 100644 --- a/erts/preloaded/ebin/prim_file.beam +++ b/erts/preloaded/ebin/prim_file.beam diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index 061db72dd8..50546b1856 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -84,7 +84,8 @@ -export([display_nl/0, display_string/1, dist_exit/3, erase/0, erase/1]). -export([error/1, error/2, exit/1, exit/2, external_size/1]). -export([external_size/2, finish_after_on_load/2, finish_loading/1, float/1]). --export([float_to_list/1, fun_info/2, fun_to_list/1, function_exported/3]). +-export([float_to_list/1, float_to_list/2]). +-export([fun_info/2, fun_to_list/1, function_exported/3]). -export([garbage_collect/0, garbage_collect/1]). -export([garbage_collect_message_area/0, get/0, get/1, get_keys/1]). -export([get_module_info/1, get_stacktrace/0, group_leader/0]). @@ -711,6 +712,16 @@ float(_Number) -> float_to_list(_Float) -> erlang:nif_error(undefined). +%% float_to_list/2 +-spec float_to_list(Float, Options) -> string() when + Float :: float(), + Options :: [Option], + Option :: {decimals, non_neg_integer()} | + {scientific, non_neg_integer()} | + compact. +float_to_list(_Float, _Options) -> + erlang:nif_error(undefined). + %% fun_info/2 -spec erlang:fun_info(Fun, Item) -> {Item, Info} when Fun :: function(), @@ -2057,6 +2068,8 @@ tuple_to_list(_Tuple) -> (multi_scheduling) -> disabled | blocked | enabled; (multi_scheduling_blockers) -> [PID :: pid()]; (otp_release) -> string(); + (port_count) -> non_neg_integer(); + (port_limit) -> pos_integer(); (process_count) -> pos_integer(); (process_limit) -> pos_integer(); (procs) -> binary(); diff --git a/erts/preloaded/src/prim_file.erl b/erts/preloaded/src/prim_file.erl index eafab1bae4..c412b7faf2 100644 --- a/erts/preloaded/src/prim_file.erl +++ b/erts/preloaded/src/prim_file.erl @@ -27,7 +27,7 @@ %% Generic file contents operations -export([open/2, close/1, datasync/1, sync/1, advise/4, position/2, truncate/1, write/2, pwrite/2, pwrite/3, read/2, read_line/1, pread/2, pread/3, - copy/3, sendfile/10]). + copy/3, sendfile/10, allocate/3]). %% Specialized file operations -export([open/1, open/3]). @@ -100,6 +100,7 @@ -define(FILE_FDATASYNC, 30). -define(FILE_ADVISE, 31). -define(FILE_SENDFILE, 32). +-define(FILE_ALLOCATE, 33). %% Driver responses -define(FILE_RESP_OK, 0). @@ -293,6 +294,11 @@ advise(#file_descriptor{module = ?MODULE, data = {Port, _}}, end. %% Returns {error, Reason} | ok. +allocate(#file_descriptor{module = ?MODULE, data = {Port, _}}, Offset, Length) -> + Cmd = <<?FILE_ALLOCATE, Offset:64/signed, Length:64/signed>>, + drv_command(Port, Cmd). + +%% Returns {error, Reason} | ok. write(#file_descriptor{module = ?MODULE, data = {Port, _}}, Bytes) -> case drv_command_nt(Port, [?FILE_WRITE,erlang:dt_prepend_vm_tag_data(Bytes)],undefined) of {ok, _Size} -> diff --git a/erts/start_scripts/Makefile b/erts/start_scripts/Makefile index 608679b016..3bf233cbb6 100644 --- a/erts/start_scripts/Makefile +++ b/erts/start_scripts/Makefile @@ -65,28 +65,28 @@ debug opt script: rel $(INSTALL_SCRIPTS) $(RELEASES_SRC) rel: $(REL_SCRIPTS) RELEASES.src: - $(INSTALL_DIR) $(SS_TMP) - ( cd $(SS_TMP) && \ + $(gen_verbose)$(INSTALL_DIR) $(SS_TMP) + $(V_at)( cd $(SS_TMP) && \ $(ERL) -noinput +B -eval 'release_handler:create_RELEASES("%ERL_ROOT%", "$(SS_ROOT)", "$(SS_ROOT)/start_sasl.rel", []), halt()') - mv RELEASES RELEASES.src + $(V_at)mv RELEASES RELEASES.src $(SS_ROOT)/start_clean.script \ $(SS_ROOT)/start_clean.boot: $(SS_ROOT)/start_clean.rel - $(INSTALL_DIR) $(SS_TMP) - ( cd $(SS_TMP) && \ + $(gen_verbose)$(INSTALL_DIR) $(SS_TMP) + $(V_at)( cd $(SS_TMP) && \ $(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) +no_warn_sasl -o $(SS_ROOT) $< ) $(SS_ROOT)/start_sasl.script \ $(SS_ROOT)/start_sasl.boot: $(SS_ROOT)/start_sasl.rel - $(INSTALL_DIR) $(SS_TMP) - ( cd $(SS_TMP) && \ + $(gen_verbose)$(INSTALL_DIR) $(SS_TMP) + $(V_at)( cd $(SS_TMP) && \ $(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) -o $(SS_ROOT) $< ) $(SS_ROOT)/start_clean.rel: $(SS_ROOT)/start_clean.rel.src \ ../vsn.mk \ $(LIBPATH)/kernel/vsn.mk \ $(LIBPATH)/stdlib/vsn.mk - sed -e 's;%SYS_VSN%;$(SYSTEM_VSN);' \ + $(gen_verbose)sed -e 's;%SYS_VSN%;$(SYSTEM_VSN);' \ -e 's;%ERTS_VSN%;$(VSN);' \ -e 's;%KERNEL_VSN%;$(KERNEL_VSN);' \ -e 's;%STDLIB_VSN%;$(STDLIB_VSN);' \ @@ -97,7 +97,7 @@ $(SS_ROOT)/start_sasl.rel: $(SS_ROOT)/start_sasl.rel.src \ $(LIBPATH)/kernel/vsn.mk \ $(LIBPATH)/stdlib/vsn.mk \ $(LIBPATH)/sasl/vsn.mk - sed -e 's;%SYS_VSN%;$(SYSTEM_VSN);' \ + $(gen_verbose)sed -e 's;%SYS_VSN%;$(SYSTEM_VSN);' \ -e 's;%ERTS_VSN%;$(VSN);' \ -e 's;%KERNEL_VSN%;$(KERNEL_VSN);' \ -e 's;%STDLIB_VSN%;$(STDLIB_VSN);' \ @@ -113,7 +113,7 @@ $(SS_ROOT)/start_all_example.rel: $(SS_ROOT)/start_all_example.rel.src \ $(LIBPATH)/mnesia/vsn.mk \ $(LIBPATH)/snmp/vsn.mk \ $(LIBPATH)/inets/vsn.mk - sed -e 's;%SYS_VSN%;$(SYSTEM_VSN);' \ + $(gen_verbose)sed -e 's;%SYS_VSN%;$(SYSTEM_VSN);' \ -e 's;%ERTS_VSN%;$(VSN);' \ -e 's;%KERNEL_VSN%;$(KERNEL_VSN);' \ -e 's;%STDLIB_VSN%;$(STDLIB_VSN);' \ @@ -126,33 +126,33 @@ $(SS_ROOT)/start_all_example.rel: $(SS_ROOT)/start_all_example.rel.src \ ## Special target used from $(ERL_TOP)/erts/Makefile. $(ERL_TOP)/bin/start.script: - $(INSTALL_DIR) $(SS_TMP) - ( cd $(SS_TMP) && \ + $(gen_verbose)$(INSTALL_DIR) $(SS_TMP) + $(V_at)( cd $(SS_TMP) && \ $(ERLC) $(SCRIPT_PATH) +no_warn_sasl +otp_build -o $@ $(SS_ROOT)/start_clean.rel ) $(ERL_TOP)/bin/start_sasl.script: - $(INSTALL_DIR) $(SS_TMP) - ( cd $(SS_TMP) && \ + $(gen_verbose)$(INSTALL_DIR) $(SS_TMP) + $(V_at)( cd $(SS_TMP) && \ $(ERLC) $(SCRIPT_PATH) +otp_build -o $@ $(SS_ROOT)/start_sasl.rel ) $(ERL_TOP)/bin/start_clean.script: - $(INSTALL_DIR) $(SS_TMP) - ( cd $(SS_TMP) && \ + $(gen_verbose)$(INSTALL_DIR) $(SS_TMP) + $(V_at)( cd $(SS_TMP) && \ $(ERLC) $(SCRIPT_PATH) +no_warn_sasl +otp_build -o $@ $(SS_ROOT)/start_clean.rel ) ## Special target used from system/build/Makefile for source code release bootstrap. bootstrap_scripts: $(SS_ROOT)/start_clean.rel - $(INSTALL_DIR) $(TESTROOT)/bin - $(INSTALL_DIR) $(SS_TMP) - ( cd $(SS_TMP) && \ + $(V_at)$(INSTALL_DIR) $(TESTROOT)/bin + $(V_at)$(INSTALL_DIR) $(SS_TMP) + $(V_at)( cd $(SS_TMP) && \ $(ERLC) $(BOOTSTRAP_SCRIPT_PATH) +otp_build +no_module_tests \ -o $(TESTROOT)/bin/start.script $(SS_ROOT)/start_clean.rel ) - ( cd $(SS_TMP) && \ + $(V_at)( cd $(SS_TMP) && \ $(ERLC) $(BOOTSTRAP_SCRIPT_PATH) +otp_build +no_module_tests \ -o $(TESTROOT)/bin/start_clean.script $(SS_ROOT)/start_clean.rel ) clean: - $(RM) $(REL_SCRIPTS) $(INSTALL_SCRIPTS) + $(V_at)$(RM) $(REL_SCRIPTS) $(INSTALL_SCRIPTS) docs: @@ -163,14 +163,14 @@ docs: include $(ERL_TOP)/make/otp_release_targets.mk release_spec: script - $(INSTALL_DIR) "$(RELEASE_PATH)/releases/$(SYSTEM_VSN)" + $(V_at)$(INSTALL_DIR) "$(RELEASE_PATH)/releases/$(SYSTEM_VSN)" ifneq ($(findstring win32,$(TARGET)),win32) - $(INSTALL_DATA) RELEASES.src "$(RELEASE_PATH)/releases" + $(V_at)$(INSTALL_DATA) RELEASES.src "$(RELEASE_PATH)/releases" endif - $(INSTALL_DATA) $(INSTALL_SCRIPTS) $(REL_SCRIPTS) \ + $(V_at)$(INSTALL_DATA) $(INSTALL_SCRIPTS) $(REL_SCRIPTS) \ "$(RELEASE_PATH)/releases/$(SYSTEM_VSN)" - $(INSTALL_DATA) start_clean.script "$(RELEASE_PATH)/releases/$(SYSTEM_VSN)/start.script" - $(INSTALL_DATA) start_clean.boot "$(RELEASE_PATH)/releases/$(SYSTEM_VSN)/start.boot" + $(V_at)$(INSTALL_DATA) start_clean.script "$(RELEASE_PATH)/releases/$(SYSTEM_VSN)/start.script" + $(V_at)$(INSTALL_DATA) start_clean.boot "$(RELEASE_PATH)/releases/$(SYSTEM_VSN)/start.boot" release_docs_spec: diff --git a/erts/vsn.mk b/erts/vsn.mk index a13326a02a..7d42bb1d01 100644 --- a/erts/vsn.mk +++ b/erts/vsn.mk @@ -17,9 +17,8 @@ # %CopyrightEnd% # - VSN = 5.10 -SYSTEM_VSN = R16B +SYSTEM_VSN = R16A # Port number 4365 in 4.2 # Port number 4366 in 4.3 diff --git a/lib/appmon/src/Makefile b/lib/appmon/src/Makefile index 06e61b7cc8..c42ce068b4 100644 --- a/lib/appmon/src/Makefile +++ b/lib/appmon/src/Makefile @@ -37,13 +37,15 @@ MODULES= \ appmon \ appmon_a \ appmon_dg \ - appmon_info \ appmon_place \ appmon_txt \ appmon_lb \ process_info \ appmon_web +# appmon_info \ Moved to runtime tools where it belongs + + HRL_FILES= appmon_dg.hrl ERL_FILES= $(MODULES:%=%.erl) @@ -81,10 +83,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/appmon/src/appmon.app.src b/lib/appmon/src/appmon.app.src index 2e1aa3ef3b..aa6a08772e 100644 --- a/lib/appmon/src/appmon.app.src +++ b/lib/appmon/src/appmon.app.src @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ {application, appmon, [{description, "DEVTOOLS CXC 138 16"}, {vsn, "%VSN%"}, - {modules, [appmon, appmon_a, appmon_dg, appmon_info, + {modules, [appmon, appmon_a, appmon_dg, %% appmon_info, moved to runtime tools appmon_lb, appmon_place, appmon_txt,process_info,appmon_web]}, {registered,[appmon, appmon_info, appmon_txt,webappmon_server,proc_info]}, {applications, [kernel, stdlib]}]}. diff --git a/lib/asn1/c_src/Makefile b/lib/asn1/c_src/Makefile index dc926947af..70238335c4 100644 --- a/lib/asn1/c_src/Makefile +++ b/lib/asn1/c_src/Makefile @@ -94,10 +94,10 @@ docs: $(OBJDIR)/%.o: %.c - $(CC) -c $(CFLAGS) -O3 -o $@ $< + $(V_CC) -c $(CFLAGS) -O3 -o $@ $< $(NIF_SHARED_OBJ_FILE): $(NIF_OBJ_FILES) - $(LD) $(LDFLAGS) -o $(NIF_SHARED_OBJ_FILE) $(NIF_OBJ_FILES) $(CLIB_FLAGS) $(LIBS) + $(V_LD) $(LDFLAGS) -o $(NIF_SHARED_OBJ_FILE) $(NIF_OBJ_FILES) $(CLIB_FLAGS) $(LIBS) # ---------------------------------------------------- # Release Target diff --git a/lib/asn1/src/Makefile b/lib/asn1/src/Makefile index 8d9422144e..4e61a6374b 100644 --- a/lib/asn1/src/Makefile +++ b/lib/asn1/src/Makefile @@ -110,7 +110,7 @@ endif ERL_COMPILE_FLAGS += \ -I$(ERL_TOP)/lib/stdlib \ - +warn_unused_vars + -Werror YRL_FLAGS = @@ -136,13 +136,13 @@ info: # ---------------------------------------------------- $(EBIN)/asn1ct.$(EMULATOR):asn1ct.erl - $(ERLC) -b$(EMULATOR) -o$(EBIN) $(ERL_COMPILE_FLAGS) -Dvsn=\"$(VSN)\" $< + $(V_ERLC) -b$(EMULATOR) -o$(EBIN) $(ERL_COMPILE_FLAGS) -Dvsn=\"$(VSN)\" $< $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- diff --git a/lib/common_test/doc/src/notes.xml b/lib/common_test/doc/src/notes.xml index 8c3b13951d..0345fab8e8 100644 --- a/lib/common_test/doc/src/notes.xml +++ b/lib/common_test/doc/src/notes.xml @@ -32,6 +32,122 @@ <file>notes.xml</file> </header> +<section><title>Common_Test 1.7</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Severe errors detected by <c>test_server</c> (e.g. if log + files directories cannot be created) will now be reported + to <c>common_test</c> and noted in the <c>common_test</c> + logs.</p> + <p> + Own Id: OTP-9769 Aux Id: kunagi-202 [113] </p> + </item> + <item> + <p> + If a busy test case generated lots of error messages, + cth_log_redirect:post_end_per_testcase would crash with a + timeout while waiting for the error logger to finish + handling all error reports. The default timer was 5 + seconds. This has now been extended to 5 minutes.</p> + <p> + Own Id: OTP-10040 Aux Id: kunagi-173 [84] </p> + </item> + <item> + <p> + Some bugfixes in <c>ct_snmp:</c></p> + <p> + <list> <item> ct_snmp will now use the value of the + 'agent_vsns' config variable when setting the 'variables' + parameter to snmp application agent configuration. + Earlier this had to be done separately - i.e. the + supported versions had to be specified twice. </item> + <item> Snmp application failed to write notify.conf since + ct_snmp gave the notify type as a string instead of an + atom. This has been corrected. </item> </list></p> + <p> + Own Id: OTP-10432</p> + </item> + <item> + <p> + Some bugfixes in <c>ct_snmp</c>:</p> + <p> + <list> <item> Functions <c>register_users/2</c>, + <c>register_agents/2</c> and <c>register_usm_users/2</c>, + and the corresponding <c>unregister_*/1</c> functions + were not executable. These are corrected/rewritten. + </item> <item> Function <c>update_usm_users/2</c> is + removed, and an unregister function is added instead. + Update can now be done with unregister_usm_users and then + register_usm_users. </item> <item> Functions + <c>unregister_*/2</c> are added, so specific + users/agents/usm users can be unregistered. </item> + <item> Function <c>unload_mibs/1</c> is added for + completeness. </item> <item> Overriding configuration + files did not work, since the files were written in + priv_dir instead of in the configuration dir + (priv_dir/conf). This has been corrected. </item> <item> + Arguments to <c>register_usm_users/2</c> were faulty + documented. This has been corrected. </item> </list></p> + <p> + Own Id: OTP-10434 Aux Id: kunagi-264 [175] </p> + </item> + <item> + <p> + Faulty exported specs in common test has been corrected + to <c>ct_netconfc:hook_options/0</c> and + <c>inet:hostname/0</c></p> + <p> + Own Id: OTP-10601</p> + </item> + <item> + <p> + The netconf client in common_test did not adjust the + window after receiving data. Due to this, the client + stopped receiving data after a while. This has been + corrected.</p> + <p> + Own Id: OTP-10646</p> + </item> + </list> + </section> + + + <section><title>Known Bugs and Problems</title> + <list> + <item> + <p> + The earlier undocumented cross cover feature for + accumulating cover data over multiple tests has now been + fixed and documented.</p> + <p> + Own Id: OTP-9870 Aux Id: kunagi-206 [117] </p> + </item> + <item> + <p> + CT drops error reason when groups/0 crashes.</p> + <p> + Own Id: OTP-10631 Aux Id: kunagi-345 [256] </p> + </item> + <item> + <p> + Problem opening sftp connection with ct_ssh.</p> + <p> + Own Id: OTP-10632 Aux Id: kunagi-346 [257] </p> + </item> + <item> + <p> + Event handler on a ct_master node causes hanging.</p> + <p> + Own Id: OTP-10634 Aux Id: kunagi-347 [258] </p> + </item> + </list> + </section> + +</section> + <section><title>Common_Test 1.6.3.1</title> <section><title>Known Bugs and Problems</title> diff --git a/lib/common_test/priv/Makefile.in b/lib/common_test/priv/Makefile.in index 4372ab124e..5a9fabbe45 100644 --- a/lib/common_test/priv/Makefile.in +++ b/lib/common_test/priv/Makefile.in @@ -68,15 +68,15 @@ JS = jquery-latest.js jquery.tablesorter.min.js include ../../test_server/vsn.mk debug opt: - sed -e 's;@CT_VSN@;$(VSN);' \ + $(V_at)sed -e 's;@CT_VSN@;$(VSN);' \ -e 's;@TS_VSN@;$(TEST_SERVER_VSN);' \ ../install.sh.in > install.sh - chmod 775 install.sh + $(V_at)chmod 775 install.sh docs: clean: - rm -f $(SCRIPTS) + $(V_at)rm -f $(SCRIPTS) # ---------------------------------------------------- diff --git a/lib/common_test/src/Makefile b/lib/common_test/src/Makefile index dd2923ece9..31906b4568 100644 --- a/lib/common_test/src/Makefile +++ b/lib/common_test/src/Makefile @@ -97,7 +97,7 @@ DTD_FILES = \ # ---------------------------------------------------- ERL_COMPILE_FLAGS += -pa ../ebin -I../include -I $(ERL_TOP)/lib/snmp/include/ \ -I../../test_server/include -I../../xmerl/inc/ \ - -I $(ERL_TOP)/lib/kernel/include + -I $(ERL_TOP)/lib/kernel/include -Werror # ---------------------------------------------------- # Targets @@ -127,10 +127,10 @@ clean: # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/common_test/test/ct_hooks_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE.erl index 405df1e978..796a0832d7 100644 --- a/lib/common_test/test/ct_hooks_SUITE.erl +++ b/lib/common_test/test/ct_hooks_SUITE.erl @@ -64,7 +64,7 @@ end_per_testcase(TestCase, Config) -> suite() -> - [{timetrap,{seconds,20}}]. + [{timetrap,{minutes,1}}]. all() -> all(suite). diff --git a/lib/common_test/test/ct_master_SUITE.erl b/lib/common_test/test/ct_master_SUITE.erl index 56a343a96f..b89d7d4dc5 100644 --- a/lib/common_test/test/ct_master_SUITE.erl +++ b/lib/common_test/test/ct_master_SUITE.erl @@ -154,6 +154,9 @@ make_spec(DataDir, FileName, NodeNames, Suites, Config) -> {init,NodeName,[ {node_start,[{startup_functions,[]}, {monitor_master,true}, + {boot_timeout,10}, + {init_timeout,10}, + {startup_timeout,10}, {env,Env}]}, {eval,{erlang,nodes,[]}}] } diff --git a/lib/common_test/test/ct_netconfc_SUITE.erl b/lib/common_test/test/ct_netconfc_SUITE.erl index 3042a924fe..c89a4cdabe 100644 --- a/lib/common_test/test/ct_netconfc_SUITE.erl +++ b/lib/common_test/test/ct_netconfc_SUITE.erl @@ -43,12 +43,11 @@ %% there will be clashes with logging processes etc). %%-------------------------------------------------------------------- init_per_suite(Config) -> - Config1 = ct_test_support:init_per_suite(Config), case application:load(crypto) of - {error,Reason} -> + {error,Reason} when Reason=/={already_loaded,crypto} -> {skip, Reason}; _ -> - Config1 + ct_test_support:init_per_suite(Config) end. end_per_suite(Config) -> diff --git a/lib/common_test/test/ct_netconfc_SUITE_data/netconfc1_SUITE.erl b/lib/common_test/test/ct_netconfc_SUITE_data/netconfc1_SUITE.erl index d337158bce..54526e8e83 100644 --- a/lib/common_test/test/ct_netconfc_SUITE_data/netconfc1_SUITE.erl +++ b/lib/common_test/test/ct_netconfc_SUITE_data/netconfc1_SUITE.erl @@ -1044,12 +1044,9 @@ gen_dsa(LSize,NSize) when is_integer(LSize), is_integer(NSize) -> Key = gen_dsa2(LSize, NSize), {Key, encode_key(Key)}. -encode_key(Key = #'RSAPrivateKey'{}) -> - {ok, Der} = 'OTP-PUB-KEY':encode('RSAPrivateKey', Key), - {'RSAPrivateKey', list_to_binary(Der), not_encrypted}; encode_key(Key = #'DSAPrivateKey'{}) -> - {ok, Der} = 'OTP-PUB-KEY':encode('DSAPrivateKey', Key), - {'DSAPrivateKey', list_to_binary(Der), not_encrypted}. + Der = public_key:der_encode('DSAPrivateKey', Key), + {'DSAPrivateKey', Der, not_encrypted}. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl index fc572aa82f..8814570e99 100644 --- a/lib/common_test/test/ct_test_support.erl +++ b/lib/common_test/test/ct_test_support.erl @@ -1043,8 +1043,8 @@ result_match({SkipOrFail,{ErrorInd,{EMod,EFunc,{Why,'_'}}}}, true; result_match({failed,{timetrap_timeout,{'$approx',Num}}}, {failed,{timetrap_timeout,Value}}) -> - if Value >= trunc(Num-0.02*Num), - Value =< trunc(Num+0.02*Num) -> true; + if Value >= trunc(Num-0.05*Num), + Value =< trunc(Num+0.05*Num) -> true; true -> false end; result_match({user_timetrap_error,{Why,'_'}}, diff --git a/lib/common_test/vsn.mk b/lib/common_test/vsn.mk index f9bb22867e..c92fb2ca37 100644 --- a/lib/common_test/vsn.mk +++ b/lib/common_test/vsn.mk @@ -1 +1 @@ -COMMON_TEST_VSN = 1.6.3 +COMMON_TEST_VSN = 1.7 diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml index 27d750f929..ddaae2655d 100644 --- a/lib/compiler/doc/src/compile.xml +++ b/lib/compiler/doc/src/compile.xml @@ -816,6 +816,32 @@ pi() -> 3.1416. </section> <section> + <title>Inlining of list functions</title> + <p>The compiler can also inline a variety of list manipulation functions + from the stdlib's lists module.</p> + + <p>This feature must be explicitly enabled with a compiler option or a + <c>-compile()</c> attribute in the source module.</p> + + <p>To enable inlining of list functions, use the <c>inline_list_funcs</c> + option.</p> + + <p>The following functions are inlined:</p> + <list type="bulleted"> + <item><seealso marker="stdlib:lists#all/2">lists:all/2</seealso></item> + <item><seealso marker="stdlib:lists#any/2">lists:any/2</seealso></item> + <item><seealso marker="stdlib:lists#foreach/2">lists:foreach/2</seealso></item> + <item><seealso marker="stdlib:lists#map/2">lists:map/2</seealso></item> + <item><seealso marker="stdlib:lists#flatmap/2">lists:flatmap/2</seealso></item> + <item><seealso marker="stdlib:lists#filter/2">lists:filter/2</seealso></item> + <item><seealso marker="stdlib:lists#foldl/3">lists:foldl/3</seealso></item> + <item><seealso marker="stdlib:lists#foldr/3">lists:foldr/3</seealso></item> + <item><seealso marker="stdlib:lists#mapfoldl/3">lists:mapfoldl/3</seealso></item> + <item><seealso marker="stdlib:lists#mapfoldr/3">lists:mapfoldr/3</seealso></item> + </list> + </section> + + <section> <title>Parse Transformations</title> <p>Parse transformations are used when a programmer wants to use diff --git a/lib/compiler/src/Makefile b/lib/compiler/src/Makefile index cbcbf79839..5fbc41b0f7 100644 --- a/lib/compiler/src/Makefile +++ b/lib/compiler/src/Makefile @@ -82,7 +82,6 @@ MODULES = \ sys_core_dsetel \ sys_core_fold \ sys_core_inline \ - sys_expand_pmod \ sys_pre_attributes \ sys_pre_expand \ v3_codegen \ @@ -123,7 +122,7 @@ ifeq ($(NATIVE_LIBS_ENABLED),yes) ERL_COMPILE_FLAGS += +native endif ERL_COMPILE_FLAGS += +inline +warn_unused_import \ - +warnings_as_errors \ + -Werror \ -I../../stdlib/include -I$(EGEN) -W # ---------------------------------------------------- @@ -145,19 +144,19 @@ clean: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(EGEN)/beam_opcodes.erl $(EGEN)/beam_opcodes.hrl: genop.tab - $(PERL) $(ERL_TOP)/erts/emulator/utils/beam_makeops -compiler -outdir $(EGEN) $< + $(gen_verbose)$(PERL) $(ERL_TOP)/erts/emulator/utils/beam_makeops -compiler -outdir $(EGEN) $< $(EBIN)/beam_asm.beam: $(ESRC)/beam_asm.erl $(EGEN)/beam_opcodes.hrl - $(ERLC) $(ERL_COMPILE_FLAGS) -DCOMPILER_VSN='"$(VSN)"' -o$(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) -DCOMPILER_VSN='"$(VSN)"' -o$(EBIN) $< $(EBIN)/cerl_inline.beam: $(ESRC)/cerl_inline.erl - $(ERLC) $(ERL_COMPILE_FLAGS) +nowarn_shadow_vars -o$(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) +nowarn_shadow_vars -o$(EBIN) $< # ---------------------------------------------------- # Release Target diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index 10e7f5e9ce..5f394f0b65 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -895,7 +895,6 @@ foldl_core_transforms(St, []) -> {ok,St}. %%% Fetches the module name from a list of forms. The module attribute must %%% be present. -get_module([{attribute,_,module,{M,_As}} | _]) -> M; get_module([{attribute,_,module,M} | _]) -> M; get_module([_ | Rest]) -> get_module(Rest). @@ -907,11 +906,8 @@ add_default_base(St, Forms) -> F = St#compile.filename, case F of "" -> - M = case get_module(Forms) of - PackageModule when is_list(PackageModule) -> last(PackageModule); - M0 -> M0 - end, - St#compile{base = atom_to_list(M)}; + M = get_module(Forms), + St#compile{base=atom_to_list(M)}; _ -> St end. diff --git a/lib/compiler/src/compiler.app.src b/lib/compiler/src/compiler.app.src index 94c78e68f9..9a02121d8b 100644 --- a/lib/compiler/src/compiler.app.src +++ b/lib/compiler/src/compiler.app.src @@ -57,7 +57,6 @@ sys_core_dsetel, sys_core_fold, sys_core_inline, - sys_expand_pmod, sys_pre_attributes, sys_pre_expand, v3_codegen, diff --git a/lib/compiler/src/core_lint.erl b/lib/compiler/src/core_lint.erl index b513a8965c..21296a8b66 100644 --- a/lib/compiler/src/core_lint.erl +++ b/lib/compiler/src/core_lint.erl @@ -247,7 +247,8 @@ gbody(E, Def, Rt, St0) -> false -> St1 end. -gexpr(#c_var{name=N}, Def, _Rt, St) -> expr_var(N, Def, St); +gexpr(#c_var{name=N}, Def, _Rt, St) when is_atom(N); is_integer(N) -> + expr_var(N, Def, St); gexpr(#c_literal{}, _Def, _Rt, St) -> St; gexpr(#c_cons{hd=H,tl=T}, Def, _Rt, St) -> gexpr_list([H,T], Def, St); diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index 18fba7962b..fbd7452301 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -686,11 +686,14 @@ call_1(#c_call{anno=Anno}, lists, all, [Arg1,Arg2], Sub) -> C1 = #c_clause{pats=[#c_cons{hd=X, tl=Xs}], guard=#c_literal{val=true}, body=#c_case{arg=#c_apply{anno=Anno, op=F, args=[X]}, clauses = [CC1, CC2, CC3]}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=true}}, - Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err2)}, + body=match_fail([{function_name,{'lists^all',1}}|Anno], Err2)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -713,11 +716,14 @@ call_1(#c_call{anno=Anno}, lists, any, [Arg1,Arg2], Sub) -> C1 = #c_clause{pats=[#c_cons{hd=X, tl=Xs}], guard=#c_literal{val=true}, body=#c_case{arg=#c_apply{anno=Anno, op=F, args=[X]}, clauses = [CC1, CC2, CC3]}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=false}}, - Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err2)}, + body=match_fail([{function_name,{'lists^any',1}}|Anno], Err2)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -733,11 +739,14 @@ call_1(#c_call{anno=Anno}, lists, foreach, [Arg1,Arg2], Sub) -> C1 = #c_clause{pats=[#c_cons{hd=X, tl=Xs}], guard=#c_literal{val=true}, body=#c_seq{arg=#c_apply{anno=Anno, op=F, args=[X]}, body=#c_apply{anno=Anno, op=Loop, args=[Xs]}}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=ok}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^foreach',1}}|Anno], Err)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -756,14 +765,18 @@ call_1(#c_call{anno=Anno}, lists, map, [Arg1,Arg2], Sub) -> op=F, args=[X]}, body=#c_cons{hd=H, + anno=[compiler_generated], tl=#c_apply{anno=Anno, op=Loop, args=[Xs]}}}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=[]}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^map',1}}|Anno], Err)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -780,18 +793,21 @@ call_1(#c_call{anno=Anno}, lists, flatmap, [Arg1,Arg2], Sub) -> C1 = #c_clause{pats=[#c_cons{hd=X, tl=Xs}], guard=#c_literal{val=true}, body=#c_let{vars=[H], arg=#c_apply{anno=Anno, op=F, args=[X]}, - body=#c_call{anno=Anno, + body=#c_call{anno=[compiler_generated|Anno], module=#c_literal{val=erlang}, name=#c_literal{val='++'}, args=[H, #c_apply{anno=Anno, op=Loop, args=[Xs]}]}}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=[]}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^flatmap',1}}|Anno], Err)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -807,7 +823,7 @@ call_1(#c_call{anno=Anno}, lists, filter, [Arg1,Arg2], Sub) -> B = #c_var{name='B'}, Err1 = #c_tuple{es=[#c_literal{val='case_clause'}, X]}, CC1 = #c_clause{pats=[#c_literal{val=true}], guard=#c_literal{val=true}, - body=#c_cons{hd=X, tl=Xs}}, + body=#c_cons{anno=[compiler_generated], hd=X, tl=Xs}}, CC2 = #c_clause{pats=[#c_literal{val=false}], guard=#c_literal{val=true}, body=Xs}, CC3 = #c_clause{pats=[X], guard=#c_literal{val=true}, @@ -821,11 +837,14 @@ call_1(#c_call{anno=Anno}, lists, filter, [Arg1,Arg2], Sub) -> op=Loop, args=[Xs]}, body=Case}}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=[]}}, - Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err2)}, + body=match_fail([{function_name,{'lists^filter',1}}|Anno], Err2)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -845,10 +864,14 @@ call_1(#c_call{anno=Anno}, lists, foldl, [Arg1,Arg2,Arg3], Sub) -> args=[Xs, #c_apply{anno=Anno, op=F, args=[X, A]}]}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, body=A}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=2}]}, + body=A}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, A, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^foldl',2}}|Anno], Err)}, Fun = #c_fun{vars=[Xs, A], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -868,10 +891,14 @@ call_1(#c_call{anno=Anno}, lists, foldr, [Arg1,Arg2,Arg3], Sub) -> args=[X, #c_apply{anno=Anno, op=Loop, args=[Xs, A]}]}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, body=A}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=2}]}, + body=A}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, A, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^foldr',2}}|Anno], Err)}, Fun = #c_fun{vars=[Xs, A], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -901,7 +928,10 @@ call_1(#c_call{anno=Anno}, lists, mapfoldl, [Arg1,Arg2,Arg3], Sub) -> op=Loop, args=[Xs, Avar]}, #c_tuple{es=[Xs, Avar]}, - #c_tuple{es=[#c_cons{hd=X, tl=Xs}, Avar]}) + #c_tuple{anno=[compiler_generated], + es=[#c_cons{anno=[compiler_generated], + hd=X, tl=Xs}, + Avar]}) %%% Multiple-value version %%% #c_let{vars=[Xs,A], %%% %% The tuple here will be optimised @@ -910,14 +940,18 @@ call_1(#c_call{anno=Anno}, lists, mapfoldl, [Arg1,Arg2,Arg3], Sub) -> %%% body=#c_values{es=[#c_cons{hd=X, tl=Xs}, %%% A]}} )}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=2}]}, %%% Tuple passing version - body=#c_tuple{es=[#c_literal{val=[]}, Avar]}}, + body=#c_tuple{anno=[compiler_generated], + es=[#c_literal{val=[]}, Avar]}}, %%% Multiple-value version %%% body=#c_values{es=[#c_literal{val=[]}, A]}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Avar, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^mapfoldl',2}}|Anno], Err)}, Fun = #c_fun{vars=[Xs, Avar], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -955,7 +989,9 @@ call_1(#c_call{anno=Anno}, lists, mapfoldr, [Arg1,Arg2,Arg3], Sub) -> #c_tuple{es=[Xs, Avar]}, Match(#c_apply{anno=Anno, op=F, args=[X, Avar]}, #c_tuple{es=[X, Avar]}, - #c_tuple{es=[#c_cons{hd=X, tl=Xs}, Avar]})) + #c_tuple{anno=[compiler_generated], + es=[#c_cons{anno=[compiler_generated], + hd=X, tl=Xs}, Avar]})) %%% Multiple-value version %%% body=#c_let{vars=[Xs,A], %%% %% The tuple will be optimised away @@ -965,14 +1001,18 @@ call_1(#c_call{anno=Anno}, lists, mapfoldr, [Arg1,Arg2,Arg3], Sub) -> %%% #c_values{es=[#c_cons{hd=X, tl=Xs}, %%% A]})} }, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=2}]}, %%% Tuple passing version - body=#c_tuple{es=[#c_literal{val=[]}, Avar]}}, + body=#c_tuple{anno=[compiler_generated], + es=[#c_literal{val=[]}, Avar]}}, %%% Multiple-value version %%% body=#c_values{es=[#c_literal{val=[]}, A]}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Avar, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^mapfoldr',2}}|Anno], Err)}, Fun = #c_fun{vars=[Xs, Avar], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -2632,16 +2672,19 @@ bsm_nonempty([#c_clause{pats=Ps}|Cs], Pos) -> bsm_nonempty([], _ ) -> false. %% bsm_ensure_no_partition(Cs, Pos) -> ok (exception if problem) -%% We must make sure that binary matching is not partitioned between +%% We must make sure that matching is not partitioned between %% variables like this: %% foo(<<...>>) -> ... -%% foo(Var) when ... -> ... -%% foo(<<...>>) -> +%% foo(<Variable>) when ... -> ... +%% foo(<Any non-variable pattern>) -> %% If there is such partition, we are not allowed to reuse the binary variable -%% for the match context. Also, arguments to the left of the argument that -%% is matched against a binary, are only allowed to be simple variables, not -%% used in guards. The reason is that we must know that the binary is only -%% matched in one place. +%% for the match context. +%% +%% Also, arguments to the left of the argument that is matched +%% against a binary, are only allowed to be simple variables, not +%% used in guards. The reason is that we must know that the binary is +%% only matched in one place (i.e. there must be only one bs_start_match2 +%% instruction emitted). bsm_ensure_no_partition(Cs, Pos) -> bsm_ensure_no_partition_1(Cs, Pos, before). @@ -2649,6 +2692,12 @@ bsm_ensure_no_partition(Cs, Pos) -> %% Loop through each clause. bsm_ensure_no_partition_1([#c_clause{pats=Ps,guard=G}|Cs], Pos, State0) -> State = bsm_ensure_no_partition_2(Ps, Pos, G, simple_vars, State0), + case State of + 'after' -> + bsm_ensure_no_partition_after(Cs, Pos); + _ -> + ok + end, bsm_ensure_no_partition_1(Cs, Pos, State); bsm_ensure_no_partition_1([], _, _) -> ok. @@ -2658,8 +2707,7 @@ bsm_ensure_no_partition_2([#c_binary{}=Where|_], 1, _, Vstate, State) -> before when Vstate =:= simple_vars -> within; before -> bsm_problem(Where, Vstate); within when Vstate =:= simple_vars -> within; - within -> bsm_problem(Where, Vstate); - 'after' -> bsm_problem(Where, bin_partition) + within -> bsm_problem(Where, Vstate) end; bsm_ensure_no_partition_2([#c_alias{}=Alias|_], 1, N, Vstate, State) -> %% Retrieve the real pattern that the alias refers to and check that. @@ -2708,6 +2756,15 @@ bsm_ensure_no_partition_2([#c_var{name=V}|Ps], N, G, Vstate, S) -> bsm_ensure_no_partition_2([_|Ps], N, G, _, S) -> bsm_ensure_no_partition_2(Ps, N-1, G, bin_argument_order, S). +bsm_ensure_no_partition_after([#c_clause{pats=Ps}|Cs], Pos) -> + case nth(Pos, Ps) of + #c_var{} -> + bsm_ensure_no_partition_after(Cs, Pos); + P -> + bsm_problem(P, bin_partition) + end; +bsm_ensure_no_partition_after([], _) -> ok. + bsm_could_match_binary(#c_alias{pat=P}) -> bsm_could_match_binary(P); bsm_could_match_binary(#c_cons{}) -> false; bsm_could_match_binary(#c_tuple{}) -> false; @@ -2832,7 +2889,7 @@ format_error(useless_building) -> format_error(bin_opt_alias) -> "INFO: the '=' operator will prevent delayed sub binary optimization"; format_error(bin_partition) -> - "INFO: non-consecutive clauses that match binaries " + "INFO: matching non-variables after a previous clause matching a variable " "will prevent delayed sub binary optimization"; format_error(bin_left_var_used_in_guard) -> "INFO: a variable to the left of the binary pattern is used in a guard; " diff --git a/lib/compiler/src/sys_expand_pmod.erl b/lib/compiler/src/sys_expand_pmod.erl deleted file mode 100644 index da644b4f0b..0000000000 --- a/lib/compiler/src/sys_expand_pmod.erl +++ /dev/null @@ -1,433 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% --module(sys_expand_pmod). - -%% Expand function definition forms of parameterized module. We assume -%% all record definitions, imports, queries, etc., have been expanded -%% away. Any calls on the form 'foo(...)' must be calls to local -%% functions. Auto-generated functions (module_info,...) have not yet -%% been added to the function definitions, but are listed in 'defined' -%% and 'exports'. The automatic 'new/N' function is neither added to the -%% definitions nor to the 'exports'/'defines' lists yet. - --export([forms/4]). - --record(pmod, {parameters, exports, defined, predef}). - -%% TODO: more abstract handling of predefined/static functions. - -forms(Fs0, Ps, Es0, Ds0) -> - PreDef = [{module_info,0},{module_info,1}], - forms(Fs0, Ps, Es0, Ds0, PreDef). - -forms(Fs0, Ps, Es0, Ds0, PreDef) -> - St0 = #pmod{parameters=Ps,exports=Es0,defined=Ds0, predef=PreDef}, - {Fs1, St1} = forms(Fs0, St0), - Es1 = update_function_names(Es0, St1), - Ds1 = update_function_names(Ds0, St1), - Fs2 = update_forms(Fs1, St1), - {Fs2,Es1,Ds1}. - -%% This is extremely simplistic for now; all functions get an extra -%% parameter, whether they need it or not, except for static functions. - -update_function_names(Es, St) -> - [update_function_name(E, St) || E <- Es]. - -update_function_name(E={F,A}, St) when F =/= new -> - case ordsets:is_element(E, St#pmod.predef) of - true -> E; - false -> {F, A + 1} - end; -update_function_name(E, _St) -> - E. - -update_forms([{function,L,N,A,Cs}|Fs],St) when N =/= new -> - [{function,L,N,A+1,Cs}|update_forms(Fs,St)]; -update_forms([F|Fs],St) -> - [F|update_forms(Fs,St)]; -update_forms([],_St) -> - []. - -%% Process the program forms. - -forms([F0|Fs0],St0) -> - {F1,St1} = form(F0,St0), - {Fs1,St2} = forms(Fs0,St1), - {[F1|Fs1],St2}; -forms([], St0) -> - {[], St0}. - -%% Only function definitions are of interest here. State is not updated. -form({function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> - {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), - {{function,Line,Name,Arity,Clauses},St}; -%% Pass anything else through -form(F,St) -> {F,St}. - -function(Name, Arity, Clauses0, St) -> - Clauses1 = clauses(Clauses0,St), - {Name,Arity,Clauses1}. - -clauses([C|Cs],St) -> - {clause,L,H,G,B} = clause(C,St), - T = {tuple,L,[{var,L,V} || V <- ['_'|St#pmod.parameters]]}, - [{clause,L,H++[{match,L,T,{var,L,'THIS'}}],G,B}|clauses(Cs,St)]; -clauses([],_St) -> []. - -clause({clause,Line,H0,G0,B0},St) -> - H1 = head(H0,St), - G1 = guard(G0,St), - B1 = exprs(B0,St), - {clause,Line,H1,G1,B1}. - -head(Ps,St) -> patterns(Ps,St). - -patterns([P0|Ps],St) -> - P1 = pattern(P0,St), - [P1|patterns(Ps,St)]; -patterns([],_St) -> []. - -string_to_conses([], _Line, Tail) -> - Tail; -string_to_conses([E|Rest], Line, Tail) -> - {cons, Line, {integer, Line, E}, string_to_conses(Rest, Line, Tail)}. - -pattern({var,_Line,_V}=Var,_St) -> Var; -pattern({match,Line,L0,R0},St) -> - L1 = pattern(L0,St), - R1 = pattern(R0,St), - {match,Line,L1,R1}; -pattern({integer,_Line,_I}=Integer,_St) -> Integer; -pattern({char,_Line,_C}=Char,_St) -> Char; -pattern({float,_Line,_F}=Float,_St) -> Float; -pattern({atom,_Line,_A}=Atom,_St) -> Atom; -pattern({string,_Line,_S}=String,_St) -> String; -pattern({nil,_Line}=Nil,_St) -> Nil; -pattern({cons,Line,H0,T0},St) -> - H1 = pattern(H0,St), - T1 = pattern(T0,St), - {cons,Line,H1,T1}; -pattern({tuple,Line,Ps0},St) -> - Ps1 = pattern_list(Ps0,St), - {tuple,Line,Ps1}; -pattern({bin,Line,Fs},St) -> - Fs2 = pattern_grp(Fs,St), - {bin,Line,Fs2}; -pattern({op,_Line,'++',{nil,_},R},St) -> - pattern(R,St); -pattern({op,_Line,'++',{cons,Li,{char,_C2,_I}=Char,T},R},St) -> - pattern({cons,Li,Char,{op,Li,'++',T,R}},St); -pattern({op,_Line,'++',{cons,Li,{integer,_L2,_I}=Integer,T},R},St) -> - pattern({cons,Li,Integer,{op,Li,'++',T,R}},St); -pattern({op,_Line,'++',{string,Li,L},R},St) -> - pattern(string_to_conses(L, Li, R),St); -pattern({op,_Line,_Op,_A}=Op4,_St) -> Op4; -pattern({op,_Line,_Op,_L,_R}=Op5,_St) -> Op5. - -pattern_grp([{bin_element,L1,E1,S1,T1} | Fs],St) -> - S2 = case S1 of - default -> - default; - _ -> - expr(S1,St) - end, - T2 = case T1 of - default -> - default; - _ -> - bit_types(T1) - end, - [{bin_element,L1,expr(E1,St),S2,T2} | pattern_grp(Fs,St)]; -pattern_grp([],_St) -> - []. - -bit_types([]) -> - []; -bit_types([Atom | Rest]) when is_atom(Atom) -> - [Atom | bit_types(Rest)]; -bit_types([{Atom, Integer} | Rest]) when is_atom(Atom), is_integer(Integer) -> - [{Atom, Integer} | bit_types(Rest)]. - -pattern_list([P0|Ps],St) -> - P1 = pattern(P0,St), - [P1|pattern_list(Ps,St)]; -pattern_list([],_St) -> []. - -guard([G0|Gs],St) when is_list(G0) -> - [guard0(G0,St) | guard(Gs,St)]; -guard(L,St) -> - guard0(L,St). - -guard0([G0|Gs],St) -> - G1 = guard_test(G0,St), - [G1|guard0(Gs,St)]; -guard0([],_St) -> []. - -guard_test(Expr={call,Line,{atom,La,F},As0},St) -> - case erl_internal:type_test(F, length(As0)) of - true -> - As1 = gexpr_list(As0,St), - {call,Line,{atom,La,F},As1}; - _ -> - gexpr(Expr,St) - end; -guard_test(Any,St) -> - gexpr(Any,St). - -gexpr({var,_L,_V}=Var,_St) -> Var; -% %% alternative implementation of accessing module parameters -% case index(V,St#pmod.parameters) of -% N when N > 0 -> -% {call,L,{remote,L,{atom,L,erlang},{atom,L,element}}, -% [{integer,L,N+1},{var,L,'THIS'}]}; -% _ -> -% Var -% end; -gexpr({integer,_Line,_I}=Integer,_St) -> Integer; -gexpr({char,_Line,_C}=Char,_St) -> Char; -gexpr({float,_Line,_F}=Float,_St) -> Float; -gexpr({atom,_Line,_A}=Atom,_St) -> Atom; -gexpr({string,_Line,_S}=String,_St) -> String; -gexpr({nil,_Line}=Nil,_St) -> Nil; -gexpr({cons,Line,H0,T0},St) -> - H1 = gexpr(H0,St), - T1 = gexpr(T0,St), - {cons,Line,H1,T1}; -gexpr({tuple,Line,Es0},St) -> - Es1 = gexpr_list(Es0,St), - {tuple,Line,Es1}; -gexpr({call,Line,{atom,_La,F}=Atom,As0},St) -> - true = erl_internal:guard_bif(F, length(As0)), - As1 = gexpr_list(As0,St), - {call,Line,Atom,As1}; -%% Pre-expansion generated calls to erlang:is_record/3 must also be handled -gexpr({call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,is_record}},[_,_,_]=As0},St) -> - As1 = gexpr_list(As0,St), - {call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,is_record}},As1}; -%% Guard BIFs can be remote, but only in the module erlang... -gexpr({call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,F}},As0},St) -> - A = length(As0), - true = - erl_internal:guard_bif(F, A) orelse erl_internal:arith_op(F, A) orelse - erl_internal:comp_op(F, A) orelse erl_internal:bool_op(F, A), - As1 = gexpr_list(As0,St), - {call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,F}},As1}; -%% Unfortunately, writing calls as {M,F}(...) is also allowed. -gexpr({call,Line,{tuple,La,[{atom,Lb,erlang},{atom,Lc,F}]},As0},St) -> - A = length(As0), - true = - erl_internal:guard_bif(F, A) orelse erl_internal:arith_op(F, A) orelse - erl_internal:comp_op(F, A) orelse erl_internal:bool_op(F, A), - As1 = gexpr_list(As0,St), - {call,Line,{tuple,La,[{atom,Lb,erlang},{atom,Lc,F}]},As1}; -gexpr({bin,Line,Fs},St) -> - Fs2 = pattern_grp(Fs,St), - {bin,Line,Fs2}; -gexpr({op,Line,Op,A0},St) -> - true = erl_internal:arith_op(Op, 1) orelse erl_internal:bool_op(Op, 1), - A1 = gexpr(A0,St), - {op,Line,Op,A1}; -gexpr({op,Line,Op,L0,R0},St) -> - true = - Op =:= 'andalso' orelse Op =:= 'orelse' orelse - erl_internal:arith_op(Op, 2) orelse - erl_internal:bool_op(Op, 2) orelse erl_internal:comp_op(Op, 2), - L1 = gexpr(L0,St), - R1 = gexpr(R0,St), - {op,Line,Op,L1,R1}. - -gexpr_list([E0|Es],St) -> - E1 = gexpr(E0,St), - [E1|gexpr_list(Es,St)]; -gexpr_list([],_St) -> []. - -exprs([E0|Es],St) -> - E1 = expr(E0,St), - [E1|exprs(Es,St)]; -exprs([],_St) -> []. - -expr({var,_L,_V}=Var,_St) -> - Var; -% case index(V,St#pmod.parameters) of -% N when N > 0 -> -% {call,L,{remote,L,{atom,L,erlang},{atom,L,element}}, -% [{integer,L,N+1},{var,L,'THIS'}]}; -% _ -> -% Var -% end; -expr({integer,_Line,_I}=Integer,_St) -> Integer; -expr({float,_Line,_F}=Float,_St) -> Float; -expr({atom,_Line,_A}=Atom,_St) -> Atom; -expr({string,_Line,_S}=String,_St) -> String; -expr({char,_Line,_C}=Char,_St) -> Char; -expr({nil,_Line}=Nil,_St) -> Nil; -expr({cons,Line,H0,T0},St) -> - H1 = expr(H0,St), - T1 = expr(T0,St), - {cons,Line,H1,T1}; -expr({lc,Line,E0,Qs0},St) -> - Qs1 = lc_bc_quals(Qs0,St), - E1 = expr(E0,St), - {lc,Line,E1,Qs1}; -expr({bc,Line,E0,Qs0},St) -> - Qs1 = lc_bc_quals(Qs0,St), - E1 = expr(E0,St), - {bc,Line,E1,Qs1}; -expr({tuple,Line,Es0},St) -> - Es1 = expr_list(Es0,St), - {tuple,Line,Es1}; -expr({block,Line,Es0},St) -> - Es1 = exprs(Es0,St), - {block,Line,Es1}; -expr({'if',Line,Cs0},St) -> - Cs1 = icr_clauses(Cs0,St), - {'if',Line,Cs1}; -expr({'case',Line,E0,Cs0},St) -> - E1 = expr(E0,St), - Cs1 = icr_clauses(Cs0,St), - {'case',Line,E1,Cs1}; -expr({'receive',Line,Cs0},St) -> - Cs1 = icr_clauses(Cs0,St), - {'receive',Line,Cs1}; -expr({'receive',Line,Cs0,To0,ToEs0},St) -> - To1 = expr(To0,St), - ToEs1 = exprs(ToEs0,St), - Cs1 = icr_clauses(Cs0,St), - {'receive',Line,Cs1,To1,ToEs1}; -expr({'try',Line,Es0,Scs0,Ccs0,As0},St) -> - Es1 = exprs(Es0,St), - Scs1 = icr_clauses(Scs0,St), - Ccs1 = icr_clauses(Ccs0,St), - As1 = exprs(As0,St), - {'try',Line,Es1,Scs1,Ccs1,As1}; -expr({'fun',_,{function,_,_,_}}=ExtFun,_St) -> - ExtFun; -expr({'fun',Line,Body,Info},St) -> - case Body of - {clauses,Cs0} -> - Cs1 = fun_clauses(Cs0,St), - {'fun',Line,{clauses,Cs1},Info}; - {function,F,A} = Function -> - {F1,A1} = update_function_name({F,A},St), - if A1 =:= A -> - {'fun',Line,Function,Info}; - true -> - %% Must rewrite local fun-name to a fun that does a - %% call with the extra THIS parameter. - As = make_vars(A, Line), - As1 = As ++ [{var,Line,'THIS'}], - Call = {call,Line,{atom,Line,F1},As1}, - Cs = [{clause,Line,As,[],[Call]}], - {'fun',Line,{clauses,Cs},Info} - end; - {function,_M,_F,_A} = Fun4 -> %This is an error in lint! - {'fun',Line,Fun4,Info} - end; -expr({call,Lc,{atom,_,instance}=Name,As0},St) -> - %% All local functions 'instance(...)' are static by definition, - %% so they do not take a 'THIS' argument when called - As1 = expr_list(As0,St), - {call,Lc,Name,As1}; -expr({call,Lc,{atom,_,new}=Name,As0},St) -> - %% All local functions 'new(...)' are static by definition, - %% so they do not take a 'THIS' argument when called - As1 = expr_list(As0,St), - {call,Lc,Name,As1}; -expr({call,Lc,{atom,_,module_info}=Name,As0},St) - when length(As0) =:= 0; length(As0) =:= 1 -> - %% The module_info/0 and module_info/1 functions are also static. - As1 = expr_list(As0,St), - {call,Lc,Name,As1}; -expr({call,Lc,{atom,_Lf,_F}=Atom,As0},St) -> - %% Local function call - needs THIS parameter. - As1 = expr_list(As0,St), - {call,Lc,Atom,As1 ++ [{var,0,'THIS'}]}; -expr({call,Line,F0,As0},St) -> - %% Other function call - F1 = expr(F0,St), - As1 = expr_list(As0,St), - {call,Line,F1,As1}; -expr({'catch',Line,E0},St) -> - E1 = expr(E0,St), - {'catch',Line,E1}; -expr({match,Line,P0,E0},St) -> - E1 = expr(E0,St), - P1 = pattern(P0,St), - {match,Line,P1,E1}; -expr({bin,Line,Fs},St) -> - Fs2 = pattern_grp(Fs,St), - {bin,Line,Fs2}; -expr({op,Line,Op,A0},St) -> - A1 = expr(A0,St), - {op,Line,Op,A1}; -expr({op,Line,Op,L0,R0},St) -> - L1 = expr(L0,St), - R1 = expr(R0,St), - {op,Line,Op,L1,R1}; -%% The following are not allowed to occur anywhere! -expr({remote,Line,M0,F0},St) -> - M1 = expr(M0,St), - F1 = expr(F0,St), - {remote,Line,M1,F1}. - -expr_list([E0|Es],St) -> - E1 = expr(E0,St), - [E1|expr_list(Es,St)]; -expr_list([],_St) -> []. - -icr_clauses([C0|Cs],St) -> - C1 = clause(C0,St), - [C1|icr_clauses(Cs,St)]; -icr_clauses([],_St) -> []. - -lc_bc_quals([{generate,Line,P0,E0}|Qs],St) -> - E1 = expr(E0,St), - P1 = pattern(P0,St), - [{generate,Line,P1,E1}|lc_bc_quals(Qs,St)]; -lc_bc_quals([{b_generate,Line,P0,E0}|Qs],St) -> - E1 = expr(E0,St), - P1 = pattern(P0,St), - [{b_generate,Line,P1,E1}|lc_bc_quals(Qs,St)]; -lc_bc_quals([E0|Qs],St) -> - E1 = expr(E0,St), - [E1|lc_bc_quals(Qs,St)]; -lc_bc_quals([],_St) -> []. - -fun_clauses([C0|Cs],St) -> - C1 = clause(C0,St), - [C1|fun_clauses(Cs,St)]; -fun_clauses([],_St) -> []. - -%% %% Return index from 1 upwards, or 0 if not in the list. -%% -%% index(X,Ys) -> index(X,Ys,1). -%% -%% index(X,[X|Ys],A) -> A; -%% index(X,[Y|Ys],A) -> index(X,Ys,A+1); -%% index(X,[],A) -> 0. - -make_vars(N, L) -> - make_vars(1, N, L). - -make_vars(N, M, L) when N =< M -> - V = list_to_atom("X"++integer_to_list(N)), - [{var,L,V} | make_vars(N + 1, M, L)]; -make_vars(_, _, _) -> - []. diff --git a/lib/compiler/src/sys_pre_expand.erl b/lib/compiler/src/sys_pre_expand.erl index a8c69c3cb1..7d918a55ed 100644 --- a/lib/compiler/src/sys_pre_expand.erl +++ b/lib/compiler/src/sys_pre_expand.erl @@ -28,13 +28,12 @@ %% Main entry point. -export([module/2]). --import(ordsets, [from_list/1,add_element/2,union/2]). +-import(ordsets, [from_list/1,union/2]). -import(lists, [member/2,foldl/3,foldr/3]). -include("../include/erl_bits.hrl"). -record(expand, {module=[], %Module name - parameters=undefined, %Module parameters exports=[], %Exports imports=[], %Imports compile=[], %Compile flags @@ -74,88 +73,20 @@ module(Fs0, Opts0) -> }, %% Expand the functions. {Tfs,St1} = forms(Fs, define_functions(Fs, St0)), - {Efs,St2} = expand_pmod(Tfs, St1), %% Get the correct list of exported functions. - Exports = case member(export_all, St2#expand.compile) of - true -> gb_sets:to_list(St2#expand.defined); - false -> St2#expand.exports + Exports = case member(export_all, St1#expand.compile) of + true -> gb_sets:to_list(St1#expand.defined); + false -> St1#expand.exports end, %% Generate all functions from stored info. - {Ats,St3} = module_attrs(St2#expand{exports = Exports}), + {Ats,St3} = module_attrs(St1#expand{exports = Exports}), {Mfs,St4} = module_predef_funcs(St3), - {St4#expand.module, St4#expand.exports, Ats ++ Efs ++ Mfs, + {St4#expand.module, St4#expand.exports, Ats ++ Tfs ++ Mfs, St4#expand.compile}. compiler_options(Forms) -> lists:flatten([C || {attribute,_,compile,C} <- Forms]). -expand_pmod(Fs0, St0) -> - case St0#expand.parameters of - undefined -> - {Fs0,St0}; - Ps0 -> - Base = get_base(St0#expand.attributes), - Ps = if is_atom(Base) -> - ['BASE' | Ps0]; - true -> - Ps0 - end, - Def = gb_sets:to_list(St0#expand.defined), - {Fs1,Xs,Ds} = sys_expand_pmod:forms(Fs0, Ps, - St0#expand.exports, - Def), - St1 = St0#expand{exports=Xs,defined=gb_sets:from_list(Ds)}, - {Fs2,St2} = add_instance(Ps, Fs1, St1), - {Fs3,St3} = ensure_new(Base, Ps0, Fs2, St2), - {Fs3,St3#expand{attributes = [{abstract, 0, [true]} - | St3#expand.attributes]}} - end. - -get_base(As) -> - case lists:keyfind(extends, 1, As) of - {extends,_,[Base]} when is_atom(Base) -> - Base; - _ -> - [] - end. - -ensure_new(Base, Ps, Fs, St) -> - case has_new(Fs) of - true -> - {Fs, St}; - false -> - add_new(Base, Ps, Fs, St) - end. - -has_new([{function,_L,new,_A,_Cs} | _Fs]) -> - true; -has_new([_ | Fs]) -> - has_new(Fs); -has_new([]) -> - false. - -add_new(Base, Ps, Fs, St) -> - Vs = [{var,0,V} || V <- Ps], - As = if is_atom(Base) -> - [{call,0,{remote,0,{atom,0,Base},{atom,0,new}},Vs} | Vs]; - true -> - Vs - end, - Body = [{call,0,{atom,0,instance},As}], - add_func(new, Vs, Body, Fs, St). - -add_instance(Ps, Fs, St) -> - Vs = [{var,0,V} || V <- Ps], - AbsMod = [{tuple,0,[{atom,0,St#expand.module}|Vs]}], - add_func(instance, Vs, AbsMod, Fs, St). - -add_func(Name, Args, Body, Fs, St) -> - A = length(Args), - F = {function,0,Name,A,[{clause,0,Args,[],Body}]}, - NA = {Name,A}, - {[F|Fs],St#expand{exports=add_element(NA, St#expand.exports), - defined=gb_sets:add_element(NA, St#expand.defined)}}. - %% define_function(Form, State) -> State. %% Add function to defined if form is a function. @@ -235,10 +166,6 @@ forms([], St) -> {[],St}. %% attribute(Attribute, Value, Line, State) -> State'. %% Process an attribute, this just affects the state. -attribute(module, {Module, As}, _L, St) -> - true = is_atom(Module), - St#expand{module=Module, - parameters=As}; attribute(module, Module, _L, St) -> true = is_atom(Module), St#expand{module=Module}; diff --git a/lib/compiler/test/Makefile b/lib/compiler/test/Makefile index 3b065ec3b9..b9c5be09ce 100644 --- a/lib/compiler/test/Makefile +++ b/lib/compiler/test/Makefile @@ -29,7 +29,6 @@ MODULES= \ match_SUITE \ misc_SUITE \ num_bif_SUITE \ - pmod_SUITE \ receive_SUITE \ record_SUITE \ trycatch_SUITE \ diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl index d63d2235d7..e8a92c509e 100644 --- a/lib/compiler/test/bs_match_SUITE.erl +++ b/lib/compiler/test/bs_match_SUITE.erl @@ -33,7 +33,8 @@ matching_meets_construction/1,simon/1,matching_and_andalso/1, otp_7188/1,otp_7233/1,otp_7240/1,otp_7498/1, match_string/1,zero_width/1,bad_size/1,haystack/1, - cover_beam_bool/1,matched_out_size/1,follow_fail_branch/1]). + cover_beam_bool/1,matched_out_size/1,follow_fail_branch/1, + no_partition/1]). -export([coverage_id/1,coverage_external_ignore/2]). @@ -57,7 +58,8 @@ groups() -> matching_meets_construction,simon, matching_and_andalso,otp_7188,otp_7233,otp_7240, otp_7498,match_string,zero_width,bad_size,haystack, - cover_beam_bool,matched_out_size,follow_fail_branch]}]. + cover_beam_bool,matched_out_size,follow_fail_branch, + no_partition]}]. init_per_suite(Config) -> @@ -1133,6 +1135,48 @@ ffb_2(<<_,T/bitstring>>, List, A) -> [_|_] -> bit_size(T) end. +no_partition(_) -> + one = no_partition_1(<<"string">>, a1), + {two,<<"string">>} = no_partition_1(<<"string">>, a2), + {two,<<>>} = no_partition_1(<<>>, a2), + {two,a} = no_partition_1(a, a2), + three = no_partition_1(undefined, a3), + {four,a,[]} = no_partition_1([a], a4), + {five,a,b} = no_partition_1({a,b}, a5), + + one = no_partition_2(<<"string">>, a1), + two = no_partition_2(<<"string">>, a2), + two = no_partition_2(<<>>, a2), + two = no_partition_2(a, a2), + three = no_partition_2(undefined, a3), + four = no_partition_2(42, a4), + five = no_partition_2([], a5), + six = no_partition_2(42.0, a6), + ok. + +no_partition_1(<<"string">>, a1) -> + one; +no_partition_1(V, a2) -> + {two,V}; +no_partition_1(undefined, a3) -> + three; +no_partition_1([H|T], a4) -> + {four,H,T}; +no_partition_1({A,B}, a5) -> + {five,A,B}. + +no_partition_2(<<"string">>, a1) -> + one; +no_partition_2(_, a2) -> + two; +no_partition_2(undefined, a3) -> + three; +no_partition_2(42, a4) -> + four; +no_partition_2([], a5) -> + five; +no_partition_2(42.0, a6) -> + six. check(F, R) -> R = F(). diff --git a/lib/compiler/test/inline_SUITE.erl b/lib/compiler/test/inline_SUITE.erl index e2eb6a0dec..6dc7548437 100644 --- a/lib/compiler/test/inline_SUITE.erl +++ b/lib/compiler/test/inline_SUITE.erl @@ -258,6 +258,49 @@ lists(Config) when is_list(Config) -> %% Cleanup. erase(?MODULE), + + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:map(fun (X) -> X end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:flatmap(fun (X) -> X end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:foreach(fun (X) -> X end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:filter(fun (_) -> true end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:any(fun (_) -> false end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:all(fun (_) -> true end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,acc,not_a_list],_}|_]}} = + (catch lists:foldl(fun (X, Acc) -> {X,Acc} end, acc, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,acc,not_a_list],_}|_]}} = + (catch lists:foldr(fun (X, Acc) -> {X,Acc} end, acc, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,acc,not_a_list],_}|_]}} = + (catch lists:mapfoldl(fun (X, Acc) -> {X,Acc} end, acc, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,acc,not_a_list],_}|_]}} = + (catch lists:mapfoldr(fun (X, Acc) -> {X,Acc} end, acc, not_a_list)), + + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:map(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:flatmap(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:foreach(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:filter(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:any(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:all(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,acc,[]],_}|_]}} = + (catch lists:foldl(not_a_function, acc, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,acc,[]],_}|_]}} = + (catch lists:foldr(not_a_function, acc, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,acc,[]],_}|_]}} = + (catch lists:mapfoldl(not_a_function, acc, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,acc,[]],_}|_]}} = + (catch lists:mapfoldr(not_a_function, acc, [])), + ok. my_apply(M, F, A, Init) -> diff --git a/lib/compiler/test/pmod_SUITE.erl b/lib/compiler/test/pmod_SUITE.erl deleted file mode 100644 index 5dd09a7245..0000000000 --- a/lib/compiler/test/pmod_SUITE.erl +++ /dev/null @@ -1,121 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% --module(pmod_SUITE). - --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - init_per_testcase/2,end_per_testcase/2, - basic/1, otp_8447/1]). - --include_lib("test_server/include/test_server.hrl"). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - test_lib:recompile(?MODULE), - [basic, otp_8447]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> - Dog = test_server:timetrap(?t:minutes(1)), - [{watchdog,Dog}|Config]. - -end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - ok. - -basic(Config) when is_list(Config) -> - ?line basic_1(Config, []), - ?line basic_1(Config, [inline]), - ?line basic_1(Config, [{inline,500},inline]), - ok. - -basic_1(Config, Opts) -> - io:format("Options: ~p\n", [Opts]), - ?line ok = compile_load(pmod_basic, Config, Opts), - - ?line Prop1 = pmod_basic:new([{a,xb},{b,true},{c,false}]), - ?line Prop2 = pmod_basic:new([{y,zz}]), - ?line io:format("Prop1 = ~p\n", [Prop1]), - ?line io:format("Prop2 = ~p\n", [Prop2]), - - ?line {a,xb} = Prop1:lookup(a), - ?line none = Prop1:lookup(glurf), - ?line false = Prop1:or_props([]), - ?line true = Prop1:or_props([b,c]), - ?line true = Prop1:or_props([b,d]), - ?line false = Prop1:or_props([d]), - - ?line none = Prop2:lookup(kalle), - ?line {y,zz} = Prop2:lookup(y), - ?line {a,xb} = Prop1:lookup(a), - - ?line Prop3 = Prop1:prepend({blurf,true}), - ?line io:format("Prop3 = ~p\n", [Prop3]), - ?line {blurf,true} = Prop3:lookup(blurf), - - Prop4 = Prop3:append(42), - ?line io:format("Prop4 = ~p\n", [Prop4]), - ?line {42,5} = Prop4:stupid_sum(), - - %% Some record guards. - ?line ok = Prop4:bar({s,0}), - ?line ok = Prop4:bar_bar({s,blurf}), - ?line error = Prop4:bar_bar({s,a,b}), - ?line error = Prop4:bar_bar([]), - - %% Call from a fun. - Fun = fun(Arg) -> Prop4:bar(Arg) end, - ?line ok = Fun({s,0}), - - [{y,[1,2]},{x,[5,19]}] = Prop4:collapse([{y,[2,1]},{x,[19,5]}]), - ok. - -otp_8447(Config) when is_list(Config) -> - ?line P = pmod_basic:new(foo), - ?line [0,0,1,1,1,0,0,1] = P:bc1(), - ?line <<10:4>> = P:bc2(), - ok. - -compile_load(Module, Conf, Opts) -> - ?line Dir = ?config(data_dir,Conf), - ?line Src = filename:join(Dir, atom_to_list(Module)), - ?line Out = ?config(priv_dir,Conf), - ?line CompRc = compile:file(Src, [report,{outdir,Out}|Opts]), - ?line {ok,Module} = CompRc, - ?line code:purge(Module), - ?line {module,Module} = - code:load_abs(filename:join(Out, atom_to_list(Module))), - ok. diff --git a/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl b/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl deleted file mode 100644 index 19cce452dc..0000000000 --- a/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl +++ /dev/null @@ -1,83 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% --module(pmod_basic, [Props]). - --export([lookup/1,or_props/1,prepend/1,append/1,stupid_sum/0]). --export([bar/1,bar_bar/1]). --export([bc1/0, bc2/0]). --export([collapse/1]). - -lookup(Key) -> - proplists:lookup(Key, Props). - -or_props(Keys) -> - Res = or_props_1(Keys, false), - true = is_bool(Res), %is_bool/1 does not use Props. - Res. - -prepend(Term) -> - new([Term|Props]). - -append(Term) -> - pmod_basic:new(Props++[Term]). - -or_props_1([K|Ks], Acc) -> - or_props_1(Ks, proplists:get_bool(K, Props) or Acc); -or_props_1([], Acc) -> Acc. - -is_bool(true) -> true; -is_bool(false) -> true; -is_bool(_) -> false. - -stupid_sum() -> - put(counter, 0), - Res = stupid_sum_1(Props, 0), - {Res,get(counter)}. - -stupid_sum_1([H|T], Sum0) -> - try add(Sum0, H) of - Sum -> stupid_sum_1(T, Sum) - catch - error:_ -> stupid_sum_1(T, Sum0) - after - bump() - end; -stupid_sum_1([], Sum) -> Sum. - -bump() -> - put(counter, get(counter)+1). - -add(A, B) -> - A+B. - --record(s, {a}). - -bar(S) when S#s.a == 0 -> ok. - -bar_bar(S) when is_record(S, s) -> ok; -bar_bar(_) -> error. - -bc1() -> - [A || <<A:1>> <= <<"9">> ]. - -bc2() -> - << <<A:1>> || A <- [1,0,1,0] >>. - -collapse(L) -> - lists:keymap(fun lists:sort/1, 2, L). diff --git a/lib/cosEvent/src/Makefile b/lib/cosEvent/src/Makefile index 7787fad786..2864ee0538 100644 --- a/lib/cosEvent/src/Makefile +++ b/lib/cosEvent/src/Makefile @@ -168,9 +168,9 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) $(APPUP_TARGET): $(APPUP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) docs: @@ -179,12 +179,12 @@ docs: # ---------------------------------------------------- IDL-GENERATED: CosEventChannelAdmin.idl cosEventApp.idl CosEventComm.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventChannelAdmin.cfg"}' CosEventChannelAdmin.idl - mv $(GEN_HRL_FILES1) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosEventApp.cfg"}' cosEventApp.idl - erlc $(ERL_IDL_FLAGS) CosEventComm.idl - mv $(GEN_HRL_FILES3) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventChannelAdmin.cfg"}' CosEventChannelAdmin.idl + $(V_at)mv $(GEN_HRL_FILES1) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosEventApp.cfg"}' cosEventApp.idl + $(V_at)erlc $(ERL_IDL_FLAGS) CosEventComm.idl + $(V_at)mv $(GEN_HRL_FILES3) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosEventDomain/src/Makefile b/lib/cosEventDomain/src/Makefile index 213d433c72..b4b74bd192 100644 --- a/lib/cosEventDomain/src/Makefile +++ b/lib/cosEventDomain/src/Makefile @@ -141,9 +141,9 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) $(APPUP_TARGET): $(APPUP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) docs: @@ -151,9 +151,9 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: CosEventDomainAdmin.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventDomainAdmin.cfg"}' CosEventDomainAdmin.idl - mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventDomainAdmin.cfg"}' CosEventDomainAdmin.idl + $(V_at)mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosFileTransfer/src/Makefile b/lib/cosFileTransfer/src/Makefile index d552349ede..9d3abb9bba 100644 --- a/lib/cosFileTransfer/src/Makefile +++ b/lib/cosFileTransfer/src/Makefile @@ -151,10 +151,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -162,9 +162,9 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: CosFileTransfer.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosFileTransfer.cfg"}' CosFileTransfer.idl - mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosFileTransfer.cfg"}' CosFileTransfer.idl + $(V_at)mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosNotification/src/Makefile b/lib/cosNotification/src/Makefile index decf598bbf..13153bd7a1 100644 --- a/lib/cosNotification/src/Makefile +++ b/lib/cosNotification/src/Makefile @@ -332,10 +332,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -344,16 +344,16 @@ docs: # ---------------------------------------------------- IDL-GENERATED: CosNotification.idl CosNotifyChannelAdmin.idl \ CosNotifyFilter.idl cosNotificationAppComm.idl CosNotifyComm.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotification.cfg"}' CosNotification.idl - mv $(GEN_NOTIFICATION_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyChannelAdmin.cfg"}' CosNotifyChannelAdmin.idl - mv $(GEN_CHANNELADMIN_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyFilter.cfg"}' CosNotifyFilter.idl - mv $(GEN_NOTIFYFILTER_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosNotificationComm.cfg"}' cosNotificationAppComm.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyComm.cfg"}' CosNotifyComm.idl - mv $(GEN_NOTIFYCOMM_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotification.cfg"}' CosNotification.idl + $(V_at)mv $(GEN_NOTIFICATION_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyChannelAdmin.cfg"}' CosNotifyChannelAdmin.idl + $(V_at)mv $(GEN_CHANNELADMIN_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyFilter.cfg"}' CosNotifyFilter.idl + $(V_at)mv $(GEN_NOTIFYFILTER_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosNotificationComm.cfg"}' cosNotificationAppComm.idl + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyComm.cfg"}' CosNotifyComm.idl + $(V_at)mv $(GEN_NOTIFYCOMM_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(IDL_GEN_ERL_FILES) $(IDL_GEN_HRL_FILES): IDL-GENERATED diff --git a/lib/cosProperty/src/Makefile b/lib/cosProperty/src/Makefile index 54d1b6021c..d7b75d8bc5 100644 --- a/lib/cosProperty/src/Makefile +++ b/lib/cosProperty/src/Makefile @@ -151,10 +151,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -162,9 +162,9 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: CosProperty.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosProperty.cfg"}' CosProperty.idl - mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosProperty.cfg"}' CosProperty.idl + $(V_at)mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosTime/src/Makefile b/lib/cosTime/src/Makefile index e8536a3f0a..0ab2b414ce 100644 --- a/lib/cosTime/src/Makefile +++ b/lib/cosTime/src/Makefile @@ -166,10 +166,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -177,13 +177,13 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: TimeBase.idl CosTime.idl CosTimerEvent.idl - erlc $(ERL_IDL_FLAGS) TimeBase.idl - mv $(GEN_TIMEBASE_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTime.cfg"}' CosTime.idl - mv $(GEN_COSTIME_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTimerEvent.cfg"}' CosTimerEvent.idl - mv $(GEN_COSTIMEREVENT_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) TimeBase.idl + $(V_at)mv $(GEN_TIMEBASE_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTime.cfg"}' CosTime.idl + $(V_at)mv $(GEN_COSTIME_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTimerEvent.cfg"}' CosTimerEvent.idl + $(V_at)mv $(GEN_COSTIMEREVENT_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosTransactions/src/Makefile b/lib/cosTransactions/src/Makefile index 1d935c4d1d..7b4a9cf858 100644 --- a/lib/cosTransactions/src/Makefile +++ b/lib/cosTransactions/src/Makefile @@ -145,10 +145,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -156,9 +156,9 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: CosTransactions.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTransactions.cfg"}' CosTransactions.idl - mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTransactions.cfg"}' CosTransactions.idl + $(V_at)mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/crypto/c_src/Makefile.in b/lib/crypto/c_src/Makefile.in index e19d6617f3..a20ddff05c 100644 --- a/lib/crypto/c_src/Makefile.in +++ b/lib/crypto/c_src/Makefile.in @@ -108,16 +108,16 @@ _create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR)) debug opt valgrind: $(NIF_LIB) $(CALLBACK_LIB) $(OBJDIR)/%$(TYPEMARKER).o: %.c - $(INSTALL_DIR) $(OBJDIR) - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_at)$(INSTALL_DIR) $(OBJDIR) + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(LIBDIR)/crypto$(TYPEMARKER).so: $(CRYPTO_OBJS) - $(INSTALL_DIR) $(LIBDIR) - $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(CRYPTO_LINK_LIB) + $(V_at)$(INSTALL_DIR) $(LIBDIR) + $(V_LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(CRYPTO_LINK_LIB) $(LIBDIR)/crypto$(TYPEMARKER).dll: $(CRYPTO_OBJS) - $(INSTALL_DIR) $(LIBDIR) - $(LD) $(LDFLAGS) -o $@ $(SSL_DED_LD_RUNTIME_LIBRARY_PATH) -L$(SSL_LIBDIR) $(CRYPTO_OBJS) -l$(SSL_CRYPTO_LIBNAME) -l$(SSL_SSL_LIBNAME) + $(V_at)$(INSTALL_DIR) $(LIBDIR) + $(V_LD) $(LDFLAGS) -o $@ $(SSL_DED_LD_RUNTIME_LIBRARY_PATH) -L$(SSL_LIBDIR) $(CRYPTO_OBJS) -l$(SSL_CRYPTO_LIBNAME) -l$(SSL_SSL_LIBNAME) ifeq ($(DYNAMIC_CRYPTO_LIB),yes) $(LIBDIR)/crypto_callback$(TYPEMARKER).so: $(CALLBACK_OBJS) diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index 61e80d7d5f..14c77c873f 100755 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -343,10 +343,27 @@ Mpint() = <![CDATA[<<ByteLen:32/integer-big, Bytes:ByteLen/binary>>]]> </desc> </func> <func> + <name>hmac(Type, Key, Data) -> Mac</name> + <name>hmac(Type, Key, Data, MacLength) -> Mac</name> + <fsummary></fsummary> + <type> + <v>Type = md5 | sha | sha224 | sha256 | sha384 | sha512</v> + <v>Key = iodata()</v> + <v>Data = iodata()</v> + <v>MacLength = integer()</v> + <v>Mac = binary()</v> + </type> + <desc> + <p>Computes a HMAC of type <c>Type</c> from <c>Data</c> using + <c>Key</c> as the authentication key.</p> <c>MacLength</c> + will limit the size of the resultant <c>Mac</c>. + </desc> + </func> + <func> <name>hmac_init(Type, Key) -> Context</name> <fsummary></fsummary> <type> - <v>Type = sha | md5 | ripemd160</v> + <v>Type = md5 | ripemd160 | sha | sha224 | sha256 | sha384 | sha512</v> <v>Key = iolist() | binary()</v> <v>Context = binary()</v> </type> diff --git a/lib/crypto/src/Makefile b/lib/crypto/src/Makefile index 910e89363c..5e09a09aa6 100644 --- a/lib/crypto/src/Makefile +++ b/lib/crypto/src/Makefile @@ -57,7 +57,7 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += +warn_obsolete_guard -DCRYPTO_VSN=\"$(VSN)\" +ERL_COMPILE_FLAGS += +warn_obsolete_guard -DCRYPTO_VSN=\"$(VSN)\" -Werror # ---------------------------------------------------- # Targets @@ -70,10 +70,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index f25d63fe3b..aa89f6cc61 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -35,7 +35,7 @@ -export([sha256_mac/2, sha256_mac/3]). -export([sha384_mac/2, sha384_mac/3]). -export([sha512_mac/2, sha512_mac/3]). --export([hmac_init/2, hmac_update/2, hmac_final/1, hmac_final_n/2]). +-export([hmac/3, hmac/4, hmac_init/2, hmac_update/2, hmac_final/1, hmac_final_n/2]). -export([des_cbc_encrypt/3, des_cbc_decrypt/3, des_cbc_ivec/1]). -export([des_ecb_encrypt/2, des_ecb_decrypt/2]). -export([des_cfb_encrypt/3, des_cfb_decrypt/3, des_cfb_ivec/2]). @@ -107,7 +107,7 @@ blowfish_ecb_encrypt, blowfish_ecb_decrypt, blowfish_ofb64_encrypt, des_cbc_ivec, des_cfb_ivec, erlint, mpint, hash, hash_init, hash_update, hash_final, - hmac_init, hmac_update, hmac_final, hmac_final_n, info, + hmac, hmac_init, hmac_update, hmac_final, hmac_final_n, info, rc2_cbc_encrypt, rc2_cbc_decrypt, info_lib]). @@ -437,11 +437,28 @@ sha512_final_nif(_Context) -> ?nif_stub. %% %% HMAC (multiple hash options) %% + +-spec hmac(_, iodata(), iodata()) -> binary(). +-spec hmac(_, iodata(), iodata(), integer()) -> binary(). -spec hmac_init(atom(), iodata()) -> binary(). -spec hmac_update(binary(), iodata()) -> binary(). -spec hmac_final(binary()) -> binary(). -spec hmac_final_n(binary(), integer()) -> binary(). +hmac(md5, Key, Data) -> md5_mac(Key, Data); +hmac(sha, Key, Data) -> sha_mac(Key, Data); +hmac(sha224, Key, Data) -> sha224_mac(Key, Data); +hmac(sha256, Key, Data) -> sha256_mac(Key, Data); +hmac(sha384, Key, Data) -> sha384_mac(Key, Data); +hmac(sha512, Key, Data) -> sha512_mac(Key, Data). + +hmac(md5, Key, Data, Size) -> md5_mac_n(Key, Data, Size); +hmac(sha, Key, Data, Size) -> sha_mac(Key, Data, Size); +hmac(sha224, Key, Data, Size) -> sha224_mac(Key, Data, Size); +hmac(sha256, Key, Data, Size) -> sha256_mac(Key, Data, Size); +hmac(sha384, Key, Data, Size) -> sha384_mac(Key, Data, Size); +hmac(sha512, Key, Data, Size) -> sha512_mac(Key, Data, Size). + hmac_init(_Type, _Key) -> ?nif_stub. hmac_update(_Context, _Data) -> ? nif_stub. hmac_final(_Context) -> ? nif_stub. diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index 019f5f9d83..142f06677a 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -38,6 +38,7 @@ hmac_update_md5/1, hmac_update_md5_io/1, hmac_update_md5_n/1, + hmac_rfc2202/1, hmac_rfc4231/1, ripemd160/1, ripemd160_update/1, @@ -92,7 +93,7 @@ groups() -> sha256, sha256_update, sha512, sha512_update, hmac_update_sha, hmac_update_sha_n, hmac_update_sha256, hmac_update_sha512, hmac_update_md5_n, hmac_update_md5_io, hmac_update_md5, - hmac_rfc4231, + hmac_rfc2202, hmac_rfc4231, des_cbc, aes_cfb, aes_cbc, des_cfb, des_cfb_iter, des3_cbc, des3_cfb, rc2_cbc, aes_cbc_iter, aes_ctr, aes_ctr_stream, des_cbc_iter, des_ecb, @@ -420,8 +421,169 @@ hmac_update_md5(Config) when is_list(Config) -> ?line Exp2 = crypto:md5_mac(Key2, lists:flatten([Long1, Long2, Long3])), ?line m(Exp2, Mac2). +hmac_rfc2202(doc) -> + ["Generate an HMAC using hmac, md5_mac, and sha_mac." + "Test vectors are taken from RFC-2202."]; +hmac_rfc2202(suite) -> + []; +hmac_rfc2202(Config) when is_list(Config) -> + hmac_rfc2202_md5(), + hmac_rfc2202_sha(). + +hmac_rfc2202_md5() -> + %% Test case 1 + Case1Key = binary:copy(<<16#0b>>, 16), + Case1Data = <<"Hi There">>, + Case1Exp = hexstr2bin("9294727a3638bb1c13f48ef8158bfc9d"), + + ?line Case1Mac_1 = crypto:md5_mac(Case1Key, Case1Data), + ?line Case1Mac_2 = crypto:hmac(md5, Case1Key, Case1Data), + ?line m(Case1Exp, Case1Mac_1), + ?line m(Case1Exp, Case1Mac_2), + + %% Test case 2 + Case2Key = <<"Jefe">>, + Case2Data = <<"what do ya want for nothing?">>, + Case2Exp = hexstr2bin("750c783e6ab0b503eaa86e310a5db738"), + + ?line Case2Mac_1 = crypto:md5_mac(Case2Key, Case2Data), + ?line Case2Mac_2 = crypto:hmac(md5, Case2Key, Case2Data), + ?line m(Case2Exp, Case2Mac_1), + ?line m(Case2Exp, Case2Mac_2), + + %% Test case 3 + Case3Key = binary:copy(<<16#aa>>, 16), + Case3Data = binary:copy(<<16#dd>>, 50), + Case3Exp = hexstr2bin("56be34521d144c88dbb8c733f0e8b3f6"), + + ?line Case3Mac_1 = crypto:md5_mac(Case3Key, Case3Data), + ?line Case3Mac_2 = crypto:hmac(md5, Case3Key, Case3Data), + ?line m(Case3Exp, Case3Mac_1), + ?line m(Case3Exp, Case3Mac_2), + + %% Test case 4 + Case4Key = list_to_binary(lists:seq(1, 16#19)), + Case4Data = binary:copy(<<16#cd>>, 50), + Case4Exp = hexstr2bin("697eaf0aca3a3aea3a75164746ffaa79"), + + ?line Case4Mac_1 = crypto:md5_mac(Case4Key, Case4Data), + ?line Case4Mac_2 = crypto:hmac(md5, Case4Key, Case4Data), + ?line m(Case4Exp, Case4Mac_1), + ?line m(Case4Exp, Case4Mac_2), + + %% Test case 5 + Case5Key = binary:copy(<<16#0c>>, 16), + Case5Data = "Test With Truncation", + Case5Exp = hexstr2bin("56461ef2342edc00f9bab995690efd4c"), + Case5Exp96 = hexstr2bin("56461ef2342edc00f9bab995"), + + ?line Case5Mac_1 = crypto:md5_mac(Case5Key, Case5Data), + ?line Case5Mac_2 = crypto:hmac(md5, Case5Key, Case5Data), + ?line Case5Mac96_1 = crypto:md5_mac_96(Case5Key, Case5Data), + ?line Case5Mac96_2 = crypto:hmac(md5, Case5Key, Case5Data, 12), + ?line m(Case5Exp, Case5Mac_1), + ?line m(Case5Exp, Case5Mac_2), + ?line m(Case5Exp96, Case5Mac96_1), + ?line m(Case5Exp96, Case5Mac96_2), + + %% Test case 6 + Case6Key = binary:copy(<<16#aa>>, 80), + Case6Data = <<"Test Using Larger Than Block-Size Key - Hash Key First">>, + Case6Exp = hexstr2bin("6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd"), + + ?line Case6Mac_1 = crypto:md5_mac(Case6Key, Case6Data), + ?line Case6Mac_2 = crypto:hmac(md5, Case6Key, Case6Data), + ?line m(Case6Exp, Case6Mac_1), + ?line m(Case6Exp, Case6Mac_2), + + %% Test case 7 + Case7Key = binary:copy(<<16#aa>>, 80), + Case7Data = <<"Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data">>, + Case7Exp = hexstr2bin("6f630fad67cda0ee1fb1f562db3aa53e"), + + ?line Case7Mac_1 = crypto:md5_mac(Case7Key, Case7Data), + ?line Case7Mac_2 = crypto:hmac(md5, Case7Key, Case7Data), + ?line m(Case7Exp, Case7Mac_1), + ?line m(Case7Exp, Case7Mac_2). + +hmac_rfc2202_sha() -> + %% Test case 1 + Case1Key = binary:copy(<<16#0b>>, 20), + Case1Data = <<"Hi There">>, + Case1Exp = hexstr2bin("b617318655057264e28bc0b6fb378c8ef146be00"), + + ?line Case1Mac_1 = crypto:sha_mac(Case1Key, Case1Data), + ?line Case1Mac_2 = crypto:hmac(sha, Case1Key, Case1Data), + ?line m(Case1Exp, Case1Mac_1), + ?line m(Case1Exp, Case1Mac_2), + + %% Test case 2 + Case2Key = <<"Jefe">>, + Case2Data = <<"what do ya want for nothing?">>, + Case2Exp = hexstr2bin("effcdf6ae5eb2fa2d27416d5f184df9c259a7c79"), + + ?line Case2Mac_1 = crypto:sha_mac(Case2Key, Case2Data), + ?line Case2Mac_2 = crypto:hmac(sha, Case2Key, Case2Data), + ?line m(Case2Exp, Case2Mac_1), + ?line m(Case2Exp, Case2Mac_2), + + %% Test case 3 + Case3Key = binary:copy(<<16#aa>>, 20), + Case3Data = binary:copy(<<16#dd>>, 50), + Case3Exp = hexstr2bin("125d7342b9ac11cd91a39af48aa17b4f63f175d3"), + + ?line Case3Mac_1 = crypto:sha_mac(Case3Key, Case3Data), + ?line Case3Mac_2 = crypto:hmac(sha, Case3Key, Case3Data), + ?line m(Case3Exp, Case3Mac_1), + ?line m(Case3Exp, Case3Mac_2), + + %% Test case 4 + Case4Key = list_to_binary(lists:seq(1, 16#19)), + Case4Data = binary:copy(<<16#cd>>, 50), + Case4Exp = hexstr2bin("4c9007f4026250c6bc8414f9bf50c86c2d7235da"), + + ?line Case4Mac_1 = crypto:sha_mac(Case4Key, Case4Data), + ?line Case4Mac_2 = crypto:hmac(sha, Case4Key, Case4Data), + ?line m(Case4Exp, Case4Mac_1), + ?line m(Case4Exp, Case4Mac_2), + + %% Test case 5 + Case5Key = binary:copy(<<16#0c>>, 20), + Case5Data = "Test With Truncation", + Case5Exp = hexstr2bin("4c1a03424b55e07fe7f27be1d58bb9324a9a5a04"), + Case5Exp96 = hexstr2bin("4c1a03424b55e07fe7f27be1"), + + ?line Case5Mac_1 = crypto:sha_mac(Case5Key, Case5Data), + ?line Case5Mac_2 = crypto:hmac(sha, Case5Key, Case5Data), + ?line Case5Mac96_1 = crypto:sha_mac_96(Case5Key, Case5Data), + ?line Case5Mac96_2 = crypto:hmac(sha, Case5Key, Case5Data, 12), + ?line m(Case5Exp, Case5Mac_1), + ?line m(Case5Exp, Case5Mac_2), + ?line m(Case5Exp96, Case5Mac96_1), + ?line m(Case5Exp96, Case5Mac96_2), + + %% Test case 6 + Case6Key = binary:copy(<<16#aa>>, 80), + Case6Data = <<"Test Using Larger Than Block-Size Key - Hash Key First">>, + Case6Exp = hexstr2bin("aa4ae5e15272d00e95705637ce8a3b55ed402112"), + + ?line Case6Mac_1 = crypto:sha_mac(Case6Key, Case6Data), + ?line Case6Mac_2 = crypto:hmac(sha, Case6Key, Case6Data), + ?line m(Case6Exp, Case6Mac_1), + ?line m(Case6Exp, Case6Mac_2), + + %% Test case 7 + Case7Key = binary:copy(<<16#aa>>, 80), + Case7Data = <<"Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data">>, + Case7Exp = hexstr2bin("e8e99d0f45237d786d6bbaa7965c7808bbff1a91"), + + ?line Case7Mac_1 = crypto:sha_mac(Case7Key, Case7Data), + ?line Case7Mac_2 = crypto:hmac(sha, Case7Key, Case7Data), + ?line m(Case7Exp, Case7Mac_1), + ?line m(Case7Exp, Case7Mac_2). + hmac_rfc4231(doc) -> - ["Generate an HMAC using crypto:shaXXX_mac and hmac_init, hmac_update, and hmac_final. " + ["Generate an HMAC using crypto:shaXXX_mac, hmac, and hmac_init, hmac_update, and hmac_final. " "Testvectors are take from RFC4231." ]; hmac_rfc4231(suite) -> []; @@ -448,29 +610,37 @@ hmac_rfc4231_do() -> ?line Case1Ctx224_2 = crypto:hmac_update(Case1Ctx224, Case1Data), ?line Case1Mac224_1 = crypto:hmac_final(Case1Ctx224_2), ?line Case1Mac224_2 = crypto:sha224_mac(Case1Key, Case1Data), + ?line Case1Mac224_3 = crypto:hmac(sha224, Case1Key, Case1Data), ?line m(Case1Exp224, Case1Mac224_1), ?line m(Case1Exp224, Case1Mac224_2), + ?line m(Case1Exp224, Case1Mac224_3), ?line Case1Ctx256 = crypto:hmac_init(sha256, Case1Key), ?line Case1Ctx256_2 = crypto:hmac_update(Case1Ctx256, Case1Data), ?line Case1Mac256_1 = crypto:hmac_final(Case1Ctx256_2), ?line Case1Mac256_2 = crypto:sha256_mac(Case1Key, Case1Data), + ?line Case1Mac256_3 = crypto:hmac(sha256, Case1Key, Case1Data), ?line m(Case1Exp256, Case1Mac256_1), ?line m(Case1Exp256, Case1Mac256_2), + ?line m(Case1Exp256, Case1Mac256_3), ?line Case1Ctx384 = crypto:hmac_init(sha384, Case1Key), ?line Case1Ctx384_2 = crypto:hmac_update(Case1Ctx384, Case1Data), ?line Case1Mac384_1 = crypto:hmac_final(Case1Ctx384_2), ?line Case1Mac384_2 = crypto:sha384_mac(Case1Key, Case1Data), + ?line Case1Mac384_3 = crypto:hmac(sha384, Case1Key, Case1Data), ?line m(Case1Exp384, Case1Mac384_1), ?line m(Case1Exp384, Case1Mac384_2), + ?line m(Case1Exp384, Case1Mac384_3), ?line Case1Ctx512 = crypto:hmac_init(sha512, Case1Key), ?line Case1Ctx512_2 = crypto:hmac_update(Case1Ctx512, Case1Data), ?line Case1Mac512_1 = crypto:hmac_final(Case1Ctx512_2), ?line Case1Mac512_2 = crypto:sha512_mac(Case1Key, Case1Data), + ?line Case1Mac512_3 = crypto:hmac(sha512, Case1Key, Case1Data), ?line m(Case1Exp512, Case1Mac512_1), ?line m(Case1Exp512, Case1Mac512_2), + ?line m(Case1Exp512, Case1Mac512_3), %% Test Case 2 Case2Key = <<"Jefe">>, @@ -491,29 +661,37 @@ hmac_rfc4231_do() -> ?line Case2Ctx224_2 = crypto:hmac_update(Case2Ctx224, Case2Data), ?line Case2Mac224_1 = crypto:hmac_final(Case2Ctx224_2), ?line Case2Mac224_2 = crypto:sha224_mac(Case2Key, Case2Data), + ?line Case2Mac224_3 = crypto:hmac(sha224, Case2Key, Case2Data), ?line m(Case2Exp224, Case2Mac224_1), ?line m(Case2Exp224, Case2Mac224_2), + ?line m(Case2Exp224, Case2Mac224_3), ?line Case2Ctx256 = crypto:hmac_init(sha256, Case2Key), ?line Case2Ctx256_2 = crypto:hmac_update(Case2Ctx256, Case2Data), ?line Case2Mac256_1 = crypto:hmac_final(Case2Ctx256_2), ?line Case2Mac256_2 = crypto:sha256_mac(Case2Key, Case2Data), + ?line Case2Mac256_3 = crypto:hmac(sha256, Case2Key, Case2Data), ?line m(Case2Exp256, Case2Mac256_1), ?line m(Case2Exp256, Case2Mac256_2), + ?line m(Case2Exp256, Case2Mac256_3), ?line Case2Ctx384 = crypto:hmac_init(sha384, Case2Key), ?line Case2Ctx384_2 = crypto:hmac_update(Case2Ctx384, Case2Data), ?line Case2Mac384_1 = crypto:hmac_final(Case2Ctx384_2), ?line Case2Mac384_2 = crypto:sha384_mac(Case2Key, Case2Data), + ?line Case2Mac384_3 = crypto:hmac(sha384, Case2Key, Case2Data), ?line m(Case2Exp384, Case2Mac384_1), ?line m(Case2Exp384, Case2Mac384_2), + ?line m(Case2Exp384, Case2Mac384_3), ?line Case2Ctx512 = crypto:hmac_init(sha512, Case2Key), ?line Case2Ctx512_2 = crypto:hmac_update(Case2Ctx512, Case2Data), ?line Case2Mac512_1 = crypto:hmac_final(Case2Ctx512_2), ?line Case2Mac512_2 = crypto:sha512_mac(Case2Key, Case2Data), + ?line Case2Mac512_3 = crypto:hmac(sha512, Case2Key, Case2Data), ?line m(Case2Exp512, Case2Mac512_1), ?line m(Case2Exp512, Case2Mac512_2), + ?line m(Case2Exp512, Case2Mac512_3), %% Test Case 3 Case3Key = binary:copy(<<16#aa>>, 20), @@ -534,29 +712,37 @@ hmac_rfc4231_do() -> ?line Case3Ctx224_2 = crypto:hmac_update(Case3Ctx224, Case3Data), ?line Case3Mac224_1 = crypto:hmac_final(Case3Ctx224_2), ?line Case3Mac224_2 = crypto:sha224_mac(Case3Key, Case3Data), + ?line Case3Mac224_3 = crypto:hmac(sha224, Case3Key, Case3Data), ?line m(Case3Exp224, Case3Mac224_1), ?line m(Case3Exp224, Case3Mac224_2), + ?line m(Case3Exp224, Case3Mac224_3), ?line Case3Ctx256 = crypto:hmac_init(sha256, Case3Key), ?line Case3Ctx256_2 = crypto:hmac_update(Case3Ctx256, Case3Data), ?line Case3Mac256_1 = crypto:hmac_final(Case3Ctx256_2), ?line Case3Mac256_2 = crypto:sha256_mac(Case3Key, Case3Data), + ?line Case3Mac256_3 = crypto:hmac(sha256, Case3Key, Case3Data), ?line m(Case3Exp256, Case3Mac256_1), ?line m(Case3Exp256, Case3Mac256_2), + ?line m(Case3Exp256, Case3Mac256_3), ?line Case3Ctx384 = crypto:hmac_init(sha384, Case3Key), ?line Case3Ctx384_2 = crypto:hmac_update(Case3Ctx384, Case3Data), ?line Case3Mac384_1 = crypto:hmac_final(Case3Ctx384_2), ?line Case3Mac384_2 = crypto:sha384_mac(Case3Key, Case3Data), + ?line Case3Mac384_3 = crypto:hmac(sha384, Case3Key, Case3Data), ?line m(Case3Exp384, Case3Mac384_1), ?line m(Case3Exp384, Case3Mac384_2), + ?line m(Case3Exp384, Case3Mac384_3), ?line Case3Ctx512 = crypto:hmac_init(sha512, Case3Key), ?line Case3Ctx512_2 = crypto:hmac_update(Case3Ctx512, Case3Data), ?line Case3Mac512_1 = crypto:hmac_final(Case3Ctx512_2), ?line Case3Mac512_2 = crypto:sha512_mac(Case3Key, Case3Data), + ?line Case3Mac512_3 = crypto:hmac(sha512, Case3Key, Case3Data), ?line m(Case3Exp512, Case3Mac512_1), ?line m(Case3Exp512, Case3Mac512_2), + ?line m(Case3Exp512, Case3Mac512_3), %% Test Case 4 Case4Key = list_to_binary(lists:seq(1, 16#19)), @@ -577,29 +763,81 @@ hmac_rfc4231_do() -> ?line Case4Ctx224_2 = crypto:hmac_update(Case4Ctx224, Case4Data), ?line Case4Mac224_1 = crypto:hmac_final(Case4Ctx224_2), ?line Case4Mac224_2 = crypto:sha224_mac(Case4Key, Case4Data), + ?line Case4Mac224_3 = crypto:hmac(sha224, Case4Key, Case4Data), ?line m(Case4Exp224, Case4Mac224_1), ?line m(Case4Exp224, Case4Mac224_2), + ?line m(Case4Exp224, Case4Mac224_3), ?line Case4Ctx256 = crypto:hmac_init(sha256, Case4Key), ?line Case4Ctx256_2 = crypto:hmac_update(Case4Ctx256, Case4Data), ?line Case4Mac256_1 = crypto:hmac_final(Case4Ctx256_2), ?line Case4Mac256_2 = crypto:sha256_mac(Case4Key, Case4Data), + ?line Case4Mac256_3 = crypto:hmac(sha256, Case4Key, Case4Data), ?line m(Case4Exp256, Case4Mac256_1), ?line m(Case4Exp256, Case4Mac256_2), + ?line m(Case4Exp256, Case4Mac256_3), ?line Case4Ctx384 = crypto:hmac_init(sha384, Case4Key), ?line Case4Ctx384_2 = crypto:hmac_update(Case4Ctx384, Case4Data), ?line Case4Mac384_1 = crypto:hmac_final(Case4Ctx384_2), ?line Case4Mac384_2 = crypto:sha384_mac(Case4Key, Case4Data), + ?line Case4Mac384_3 = crypto:hmac(sha384, Case4Key, Case4Data), ?line m(Case4Exp384, Case4Mac384_1), ?line m(Case4Exp384, Case4Mac384_2), + ?line m(Case4Exp384, Case4Mac384_3), ?line Case4Ctx512 = crypto:hmac_init(sha512, Case4Key), ?line Case4Ctx512_2 = crypto:hmac_update(Case4Ctx512, Case4Data), ?line Case4Mac512_1 = crypto:hmac_final(Case4Ctx512_2), ?line Case4Mac512_2 = crypto:sha512_mac(Case4Key, Case4Data), + ?line Case4Mac512_3 = crypto:hmac(sha512, Case4Key, Case4Data), ?line m(Case4Exp512, Case4Mac512_1), ?line m(Case4Exp512, Case4Mac512_2), + ?line m(Case4Exp512, Case4Mac512_3), + + %% Test Case 5 + Case5Key = binary:copy(<<16#0c>>, 20), + Case5Data = <<"Test With Truncation">>, + Case5Exp224 = hexstr2bin("0e2aea68a90c8d37c988bcdb9fca6fa8"), + Case5Exp256 = hexstr2bin("a3b6167473100ee06e0c796c2955552b"), + Case5Exp384 = hexstr2bin("3abf34c3503b2a23a46efc619baef897"), + Case5Exp512 = hexstr2bin("415fad6271580a531d4179bc891d87a6"), + + ?line Case5Ctx224 = crypto:hmac_init(sha224, Case5Key), + ?line Case5Ctx224_2 = crypto:hmac_update(Case5Ctx224, Case5Data), + ?line Case5Mac224_1 = crypto:hmac_final_n(Case5Ctx224_2, 16), + ?line Case5Mac224_2 = crypto:sha224_mac(Case5Key, Case5Data, 16), + ?line Case5Mac224_3 = crypto:hmac(sha224, Case5Key, Case5Data, 16), + ?line m(Case5Exp224, Case5Mac224_1), + ?line m(Case5Exp224, Case5Mac224_2), + ?line m(Case5Exp224, Case5Mac224_3), + + ?line Case5Ctx256 = crypto:hmac_init(sha256, Case5Key), + ?line Case5Ctx256_2 = crypto:hmac_update(Case5Ctx256, Case5Data), + ?line Case5Mac256_1 = crypto:hmac_final_n(Case5Ctx256_2, 16), + ?line Case5Mac256_2 = crypto:sha256_mac(Case5Key, Case5Data, 16), + ?line Case5Mac256_3 = crypto:hmac(sha256, Case5Key, Case5Data, 16), + ?line m(Case5Exp256, Case5Mac256_1), + ?line m(Case5Exp256, Case5Mac256_2), + ?line m(Case5Exp256, Case5Mac256_3), + + ?line Case5Ctx384 = crypto:hmac_init(sha384, Case5Key), + ?line Case5Ctx384_2 = crypto:hmac_update(Case5Ctx384, Case5Data), + ?line Case5Mac384_1 = crypto:hmac_final_n(Case5Ctx384_2, 16), + ?line Case5Mac384_2 = crypto:sha384_mac(Case5Key, Case5Data, 16), + ?line Case5Mac384_3 = crypto:hmac(sha384, Case5Key, Case5Data, 16), + ?line m(Case5Exp384, Case5Mac384_1), + ?line m(Case5Exp384, Case5Mac384_2), + ?line m(Case5Exp384, Case5Mac384_3), + + ?line Case5Ctx512 = crypto:hmac_init(sha512, Case5Key), + ?line Case5Ctx512_2 = crypto:hmac_update(Case5Ctx512, Case5Data), + ?line Case5Mac512_1 = crypto:hmac_final_n(Case5Ctx512_2, 16), + ?line Case5Mac512_2 = crypto:sha512_mac(Case5Key, Case5Data, 16), + ?line Case5Mac512_3 = crypto:hmac(sha512, Case5Key, Case5Data, 16), + ?line m(Case5Exp512, Case5Mac512_1), + ?line m(Case5Exp512, Case5Mac512_2), + ?line m(Case5Exp512, Case5Mac512_3), %% Test Case 6 Case6Key = binary:copy(<<16#aa>>, 131), @@ -620,29 +858,37 @@ hmac_rfc4231_do() -> ?line Case6Ctx224_2 = crypto:hmac_update(Case6Ctx224, Case6Data), ?line Case6Mac224_1 = crypto:hmac_final(Case6Ctx224_2), ?line Case6Mac224_2 = crypto:sha224_mac(Case6Key, Case6Data), + ?line Case6Mac224_3 = crypto:hmac(sha224, Case6Key, Case6Data), ?line m(Case6Exp224, Case6Mac224_1), ?line m(Case6Exp224, Case6Mac224_2), + ?line m(Case6Exp224, Case6Mac224_3), ?line Case6Ctx256 = crypto:hmac_init(sha256, Case6Key), ?line Case6Ctx256_2 = crypto:hmac_update(Case6Ctx256, Case6Data), ?line Case6Mac256_1 = crypto:hmac_final(Case6Ctx256_2), ?line Case6Mac256_2 = crypto:sha256_mac(Case6Key, Case6Data), + ?line Case6Mac256_3 = crypto:hmac(sha256, Case6Key, Case6Data), ?line m(Case6Exp256, Case6Mac256_1), ?line m(Case6Exp256, Case6Mac256_2), + ?line m(Case6Exp256, Case6Mac256_3), ?line Case6Ctx384 = crypto:hmac_init(sha384, Case6Key), ?line Case6Ctx384_2 = crypto:hmac_update(Case6Ctx384, Case6Data), ?line Case6Mac384_1 = crypto:hmac_final(Case6Ctx384_2), ?line Case6Mac384_2 = crypto:sha384_mac(Case6Key, Case6Data), + ?line Case6Mac384_3 = crypto:hmac(sha384, Case6Key, Case6Data), ?line m(Case6Exp384, Case6Mac384_1), ?line m(Case6Exp384, Case6Mac384_2), + ?line m(Case6Exp384, Case6Mac384_3), ?line Case6Ctx512 = crypto:hmac_init(sha512, Case6Key), ?line Case6Ctx512_2 = crypto:hmac_update(Case6Ctx512, Case6Data), ?line Case6Mac512_1 = crypto:hmac_final(Case6Ctx512_2), ?line Case6Mac512_2 = crypto:sha512_mac(Case6Key, Case6Data), + ?line Case6Mac512_3 = crypto:hmac(sha512, Case6Key, Case6Data), ?line m(Case6Exp512, Case6Mac512_1), ?line m(Case6Exp512, Case6Mac512_2), + ?line m(Case6Exp512, Case6Mac512_3), %% Test Case 7 Case7Key = binary:copy(<<16#aa>>, 131), @@ -665,29 +911,37 @@ hmac_rfc4231_do() -> ?line Case7Ctx224_2 = crypto:hmac_update(Case7Ctx224, Case7Data), ?line Case7Mac224_1 = crypto:hmac_final(Case7Ctx224_2), ?line Case7Mac224_2 = crypto:sha224_mac(Case7Key, Case7Data), + ?line Case7Mac224_3 = crypto:hmac(sha224, Case7Key, Case7Data), ?line m(Case7Exp224, Case7Mac224_1), ?line m(Case7Exp224, Case7Mac224_2), + ?line m(Case7Exp224, Case7Mac224_3), ?line Case7Ctx256 = crypto:hmac_init(sha256, Case7Key), ?line Case7Ctx256_2 = crypto:hmac_update(Case7Ctx256, Case7Data), ?line Case7Mac256_1 = crypto:hmac_final(Case7Ctx256_2), ?line Case7Mac256_2 = crypto:sha256_mac(Case7Key, Case7Data), + ?line Case7Mac256_3 = crypto:hmac(sha256, Case7Key, Case7Data), ?line m(Case7Exp256, Case7Mac256_1), ?line m(Case7Exp256, Case7Mac256_2), + ?line m(Case7Exp256, Case7Mac256_3), ?line Case7Ctx384 = crypto:hmac_init(sha384, Case7Key), ?line Case7Ctx384_2 = crypto:hmac_update(Case7Ctx384, Case7Data), ?line Case7Mac384_1 = crypto:hmac_final(Case7Ctx384_2), ?line Case7Mac384_2 = crypto:sha384_mac(Case7Key, Case7Data), + ?line Case7Mac384_3 = crypto:hmac(sha384, Case7Key, Case7Data), ?line m(Case7Exp384, Case7Mac384_1), ?line m(Case7Exp384, Case7Mac384_2), + ?line m(Case7Exp384, Case7Mac384_3), ?line Case7Ctx512 = crypto:hmac_init(sha512, Case7Key), ?line Case7Ctx512_2 = crypto:hmac_update(Case7Ctx512, Case7Data), ?line Case7Mac512_1 = crypto:hmac_final(Case7Ctx512_2), ?line Case7Mac512_2 = crypto:sha512_mac(Case7Key, Case7Data), + ?line Case7Mac512_3 = crypto:hmac(sha512, Case7Key, Case7Data), ?line m(Case7Exp512, Case7Mac512_1), - ?line m(Case7Exp512, Case7Mac512_2). + ?line m(Case7Exp512, Case7Mac512_2), + ?line m(Case7Exp512, Case7Mac512_3). hmac_update_md5_io(doc) -> ["Generate an MD5 HMAC using hmac_init, hmac_update, and hmac_final. " @@ -1866,7 +2120,7 @@ worker_loop(N, Config) -> aes_cfb, aes_cbc, des_cbc_iter, rand_uniform_test, strong_rand_test, rsa_verify_test, exor_test, rc4_test, rc4_stream_test, mod_exp_test, hmac_update_md5, hmac_update_sha, hmac_update_sha256, hmac_update_sha512, - hmac_rfc4231, + hmac_rfc2202, hmac_rfc4231, aes_ctr_stream }, F = element(random:uniform(size(Funcs)),Funcs), diff --git a/lib/debugger/src/Makefile b/lib/debugger/src/Makefile index e8b350c0c7..0b4b35412a 100644 --- a/lib/debugger/src/Makefile +++ b/lib/debugger/src/Makefile @@ -98,7 +98,7 @@ APPUP_TARGET = $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += +warn_obsolete_guard +ERL_COMPILE_FLAGS += +warn_obsolete_guard -Werror # ---------------------------------------------------- @@ -112,10 +112,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/debugger/src/dbg_debugged.erl b/lib/debugger/src/dbg_debugged.erl index 4d9ffc4f3b..c21ad486e8 100644 --- a/lib/debugger/src/dbg_debugged.erl +++ b/lib/debugger/src/dbg_debugged.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2011. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -104,7 +104,8 @@ handle_command(Command) -> reply({apply,M,F,As}) -> {value, erlang:apply(M,F,As)}; reply({eval,Expr,Bs}) -> - erl_eval:expr(Expr, Bs). % {value, Value, Bs2} + %% Bindings is an orddict (sort them) + erl_eval:expr(Expr, lists:sort(Bs)). % {value, Value, Bs2} %% Demonitor and delete message from inbox %% diff --git a/lib/debugger/src/dbg_ieval.erl b/lib/debugger/src/dbg_ieval.erl index 5e5948c965..3c084c53ac 100644 --- a/lib/debugger/src/dbg_ieval.erl +++ b/lib/debugger/src/dbg_ieval.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2012. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -249,7 +249,7 @@ meta_loop(Debugged, Bs, #ieval{level=Le} = Ieval) -> {sys, Debugged, {value,Val}} -> {value, Val, Bs}; {sys, Debugged, {value,Val,Bs2}} -> - {value, Val, Bs2}; + {value, Val, merge_bindings(Bs2, Bs, Ieval)}; {sys, Debugged, {exception,{Class,Reason,Stk}}} -> case get(exit_info) of diff --git a/lib/debugger/src/dbg_wx_code.erl b/lib/debugger/src/dbg_wx_code.erl index 99826d9bdb..9853a5dbae 100644 --- a/lib/debugger/src/dbg_wx_code.erl +++ b/lib/debugger/src/dbg_wx_code.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -30,6 +30,21 @@ -define(stc, wxStyledTextCtrl). +%% For wx-2.9 usage +-ifndef(wxSTC_ERLANG_COMMENT_FUNCTION). +-define(wxSTC_ERLANG_COMMENT_FUNCTION, 14). +-define(wxSTC_ERLANG_COMMENT_MODULE, 15). +-define(wxSTC_ERLANG_COMMENT_DOC, 16). +-define(wxSTC_ERLANG_COMMENT_DOC_MACRO, 17). +-define(wxSTC_ERLANG_ATOM_QUOTED, 18). +-define(wxSTC_ERLANG_MACRO_QUOTED, 19). +-define(wxSTC_ERLANG_RECORD_QUOTED, 20). +-define(wxSTC_ERLANG_NODE_NAME_QUOTED, 21). +-define(wxSTC_ERLANG_BIFS, 22). +-define(wxSTC_ERLANG_MODULES, 23). +-define(wxSTC_ERLANG_MODULES_ATT, 24). +-endif. + code_area(Parent) -> FixedFont = wxFont:new(10, ?wxFONTFAMILY_TELETYPE, ?wxNORMAL, ?wxNORMAL,[]), %%Ed = wxStyledTextCtrl:new(Parent, [{size, {700, 500}}]), @@ -58,7 +73,21 @@ code_area(Parent) -> {?wxSTC_ERLANG_MACRO, {40,144,170}}, {?wxSTC_ERLANG_RECORD, {40,100,20}}, {?wxSTC_ERLANG_SEPARATOR,{0,0,0}}, - {?wxSTC_ERLANG_NODE_NAME,{0,0,0}}], + {?wxSTC_ERLANG_NODE_NAME,{0,0,0}}, + %% Optional 2.9 stuff + {?wxSTC_ERLANG_COMMENT_FUNCTION, {160,53,35}}, + {?wxSTC_ERLANG_COMMENT_MODULE, {160,53,35}}, + {?wxSTC_ERLANG_COMMENT_DOC, {160,53,35}}, + {?wxSTC_ERLANG_COMMENT_DOC_MACRO, {160,53,35}}, + {?wxSTC_ERLANG_ATOM_QUOTED, {0,0,0}}, + {?wxSTC_ERLANG_MACRO_QUOTED, {40,144,170}}, + {?wxSTC_ERLANG_RECORD_QUOTED, {40,100,20}}, + {?wxSTC_ERLANG_NODE_NAME_QUOTED, {0,0,0}}, + {?wxSTC_ERLANG_BIFS, {130,40,172}}, + {?wxSTC_ERLANG_MODULES, {64,102,244}}, + {?wxSTC_ERLANG_MODULES_ATT, {64,102,244}} + ], + SetStyle = fun({Style, Color}) -> ?stc:styleSetFont(Ed, Style, FixedFont), ?stc:styleSetForeground(Ed, Style, Color) diff --git a/lib/debugger/src/dbg_wx_filedialog_win.erl b/lib/debugger/src/dbg_wx_filedialog_win.erl index f109652a70..c8ecb7b5d4 100644 --- a/lib/debugger/src/dbg_wx_filedialog_win.erl +++ b/lib/debugger/src/dbg_wx_filedialog_win.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -381,7 +381,6 @@ show_completion(Wanted, State = #state{text=TC, win=Win, list=LC, completion=Com Last = wxTextCtrl:getLastPosition(TC), wxTextCtrl:setSelection(TC, Start, Last), destroy_completion(Comp), - wxWindow:setFocus(TC), State#state{ptext=Path, completion=undefined}; Paths when Comp =:= undefined -> {PosX,PosY} = wxListCtrl:getPosition(LC), @@ -406,14 +405,16 @@ show_completion(Wanted, State = #state{text=TC, win=Win, list=LC, completion=Com %% wxListBox:connect(LB, command_listbox_doubleclicked), wxListBox:connect(LB, command_listbox_selected), wxWindow:show(Temp), + %% setFocus does a select all on 2.9 sigh.. + {Start, Last} = wxTextCtrl:getSelection(TC), wxWindow:setFocus(TC), + wxTextCtrl:setSelection(TC, Start, Last), State#state{completion = {Temp, LB}, ptext=Wanted}; Paths -> {_Temp, LB} = Comp, wxListBox:clear(LB), Files = [filename:basename(File) || File <- Paths], - wxListBox:insertItems(LB,Files,0), - wxWindow:setFocus(TC), + Files /= [] andalso wxListBox:insertItems(LB,Files,0), State#state{ptext=Wanted} end. diff --git a/lib/debugger/src/dbg_wx_trace.erl b/lib/debugger/src/dbg_wx_trace.erl index f61df93aec..0a3cac905f 100644 --- a/lib/debugger/src/dbg_wx_trace.erl +++ b/lib/debugger/src/dbg_wx_trace.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -513,7 +513,7 @@ gui_cmd({edit, {Var, Val}}, State) -> cancel -> State; {Var, Term} -> - Cmd = atom_to_list(Var)++"="++io_lib:format("~p", [Term]), + Cmd = atom_to_list(Var)++"="++io_lib:format("~w", [Term]), gui_cmd({user_command, lists:flatten(Cmd)}, State) end. diff --git a/lib/debugger/src/dbg_wx_trace_win.erl b/lib/debugger/src/dbg_wx_trace_win.erl index 40d110f071..8b206ccd78 100644 --- a/lib/debugger/src/dbg_wx_trace_win.erl +++ b/lib/debugger/src/dbg_wx_trace_win.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(dbg_wx_trace_win). --compile([{nowarn_deprecated_function,{gs,config,2}}]). %% External exports -export([init/0, stop/1]). @@ -481,13 +480,9 @@ display(#winInfo{window=Win, sb=Sb},Arg) -> %% Contents = string() %% Note: remove_code/2 should not be used for currently shown module. %%-------------------------------------------------------------------- -is_shown(WinInfo, Mod) -> - case lists:keyfind(Mod, 1, WinInfo#winInfo.editors) of - {Mod, Editor} -> - gs:config(Editor, raise), %% BUGBUG - {true, WinInfo#winInfo{editor={Mod, Editor}}}; - false -> false - end. +is_shown(_WinInfo, _Mod) -> + %% Previously cached modules here, nyi so return false + false. show_code(WinInfo = #winInfo{editor={_, Ed}}, Mod, Contents) -> %% Insert code and update breakpoints, if any @@ -572,7 +567,7 @@ update_bindings(#winInfo{bind=#sub{out=BA}}, Bs) -> wx:foldl(fun({Var,Val},Row) -> wxListCtrl:insertItem(BA, Row, ""), wxListCtrl:setItem(BA, Row, 0, dbg_wx_win:to_string(Var)), - wxListCtrl:setItem(BA, Row, 1, dbg_wx_win:to_string("~500P",[Val, 80])), + wxListCtrl:setItem(BA, Row, 1, dbg_wx_win:to_string("~99999tP",[Val, 20])), Row+1 end, 0, Bs), put(bindings,Bs), diff --git a/lib/debugger/src/dbg_wx_win.erl b/lib/debugger/src/dbg_wx_win.erl index faf3cc178f..3cb6edd953 100644 --- a/lib/debugger/src/dbg_wx_win.erl +++ b/lib/debugger/src/dbg_wx_win.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -252,9 +252,9 @@ notify(Win,Message) -> %%-------------------------------------------------------------------- entry(Parent, Title, Prompt, {Type, Value}) -> - Ted = wxTextEntryDialog:new(Parent, to_string(Prompt), - [{caption, to_string(Title)}, - {value, to_string(Value)}]), + Ted = wxTextEntryDialog:new(Parent, to_string(Prompt), + [{caption, to_string(Title)}, + {value, to_string("~999999tp",Value)}]), case wxDialog:showModal(Ted) of ?wxID_OK -> @@ -306,7 +306,7 @@ to_string([]) -> ""; to_string(List) when is_list(List) -> List; to_string(Term) -> - io_lib:format("~p",[Term]). + io_lib:format("~tp",[Term]). to_string(Format,Args) -> io_lib:format(Format, Args). diff --git a/lib/dialyzer/src/Makefile b/lib/dialyzer/src/Makefile index 63cc1c98f1..bb2edd419a 100644 --- a/lib/dialyzer/src/Makefile +++ b/lib/dialyzer/src/Makefile @@ -108,22 +108,22 @@ clean: # ---------------------------------------------------- $(EBIN)/dialyzer_cl_parse.$(EMULATOR): dialyzer_cl_parse.erl ../vsn.mk - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_cl_parse.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_cl_parse.erl $(EBIN)/dialyzer_plt.$(EMULATOR): dialyzer_plt.erl ../vsn.mk - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_plt.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_plt.erl $(EBIN)/dialyzer_gui.$(EMULATOR): dialyzer_gui.erl ../vsn.mk - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_gui.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_gui.erl $(EBIN)/dialyzer_gui_wx.$(EMULATOR): dialyzer_gui_wx.erl ../vsn.mk - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_gui_wx.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_gui_wx.erl $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # --------------------------------------------------------------------- # dependencies -- I wish they were somehow automatically generated diff --git a/lib/dialyzer/src/dialyzer_contracts.erl b/lib/dialyzer/src/dialyzer_contracts.erl index 0b932d5a1f..157c951f77 100644 --- a/lib/dialyzer/src/dialyzer_contracts.erl +++ b/lib/dialyzer/src/dialyzer_contracts.erl @@ -254,14 +254,35 @@ check_extraneous([C|Cs], SuccType) -> end. check_extraneous_1(Contract, SuccType) -> - CRngs = erl_types:t_elements(erl_types:t_fun_range(Contract)), + CRng = erl_types:t_fun_range(Contract), + CRngs = erl_types:t_elements(CRng), STRng = erl_types:t_fun_range(SuccType), ?debug("CR = ~p\nSR = ~p\n", [CRngs, STRng]), - case [CR || CR <- CRngs, erl_types:t_is_none(erl_types:t_inf(CR, STRng, opaque))] of - [] -> ok; + case [CR || CR <- CRngs, + erl_types:t_is_none(erl_types:t_inf(CR, STRng, opaque))] of + [] -> + CRngList = list_part(CRng), + STRngList = list_part(STRng), + case is_not_nil_list(CRngList) andalso is_not_nil_list(STRngList) of + false -> ok; + true -> + CRngElements = erl_types:t_list_elements(CRngList), + STRngElements = erl_types:t_list_elements(STRngList), + Inf = erl_types:t_inf(CRngElements, STRngElements, opaque), + case erl_types:t_is_none(Inf) of + true -> {error, invalid_contract}; + false -> ok + end + end; CRs -> {error, {extra_range, erl_types:t_sup(CRs), STRng}} end. +list_part(Type) -> + erl_types:t_inf(erl_types:t_list(), Type, opaque). + +is_not_nil_list(Type) -> + erl_types:t_is_list(Type) andalso not erl_types:t_is_nil(Type). + %% This is the heart of the "range function" -spec process_contracts([contract_pair()], [erl_types:erl_type()]) -> erl_types:erl_type(). diff --git a/lib/dialyzer/test/options1_SUITE_data/src/compiler/sys_pre_expand.erl b/lib/dialyzer/test/options1_SUITE_data/src/compiler/sys_pre_expand.erl index 08bc6cb147..41b7cb248d 100644 --- a/lib/dialyzer/test/options1_SUITE_data/src/compiler/sys_pre_expand.erl +++ b/lib/dialyzer/test/options1_SUITE_data/src/compiler/sys_pre_expand.erl @@ -149,14 +149,12 @@ forms([], St) -> {[],St}. %% Process an attribute, this just affects the state. attribute(module, {Module, As}, St) -> - M = package_to_string(Module), - St#expand{module=list_to_atom(M), - package = packages:strip_last(M), + true = is_atom(Module), + St#expand{module=Module, parameters=As}; attribute(module, Module, St) -> - M = package_to_string(Module), - St#expand{module=list_to_atom(M), - package = packages:strip_last(M)}; + true = is_atom(Module), + St#expand{module=Module}; attribute(export, Es, St) -> St#expand{exports=union(from_list(Es), St#expand.exports)}; attribute(import, Is, St) -> @@ -226,8 +224,6 @@ pattern({tuple,Line,Ps}, St0) -> %%pattern({struct,Line,Tag,Ps}, St0) -> %% {TPs,TPsvs,St1} = pattern_list(Ps, St0), %% {{tuple,Line,[{atom,Line,Tag}|TPs]},TPsvs,St1}; -pattern({record_field,_,_,_}=M, St) -> - {expand_package(M, St), [], [], St}; % must be a package name pattern({record_index,Line,Name,Field}, St) -> {index_expr(Line, Field, Name, record_fields(Name, St)),[],[],St}; pattern({record,Line,Name,Pfs}, St0) -> @@ -401,8 +397,6 @@ expr({tuple,Line,Es0}, Vs, St0) -> %%expr({struct,Line,Tag,Es0}, Vs, St0) -> %% {Es1,Esvs,Esus,St1} = expr_list(Es0, Vs, St0), %% {{tuple,Line,[{atom,Line,Tag}|Es1]},Esvs,Esus,St1}; -expr({record_field,_,_,_}=M, _Vs, St) -> - {expand_package(M, St), [], [], St}; % must be a package name expr({record_index,Line,Name,F}, Vs, St) -> I = index_expr(Line, F, Name, record_fields(Name, St)), expr(I, Vs, St); @@ -483,10 +477,7 @@ expr({call,Line,{atom,La,N},As0}, Vs, St0) -> end end end; -expr({call,Line,{record_field,_,_,_}=M,As0}, Vs, St0) -> - expr({call,Line,expand_package(M, St0),As0}, Vs, St0); -expr({call,Line,{remote,Lr,M,F},As0}, Vs, St0) -> - M1 = expand_package(M, St0), +expr({call,Line,{remote,Lr,M1,F},As0}, Vs, St0) -> {[M2,F1|As1],Asvs,Asus,St1} = expr_list([M1,F|As0], Vs, St0), {{call,Line,{remote,Lr,M2,F1},As1},Asvs,Asus,St1}; expr({call,Line,{tuple,_,[{atom,_,_}=M,{atom,_,_}=F]},As}, Vs, St) -> @@ -922,32 +913,6 @@ string_to_conses(Line, Cs, Tail) -> foldr(fun (C, T) -> {cons,Line,{char,Line,C},T} end, Tail, Cs). -%% In syntax trees, module/package names are atoms or lists of atoms. - -package_to_string(A) when atom(A) -> atom_to_list(A); -package_to_string(L) when list(L) -> packages:concat(L). - -expand_package({atom,L,A} = M, St) -> - case dict:find(A, St#expand.mod_imports) of - {ok, A1} -> - {atom,L,A1}; - error -> - case packages:is_segmented(A) of - true -> - M; - false -> - M1 = packages:concat(St#expand.package, A), - {atom,L,list_to_atom(M1)} - end - end; -expand_package(M, _St) -> - case erl_parse:package_segments(M) of - error -> - M; - M1 -> - {atom,element(2,M),list_to_atom(package_to_string(M1))} - end. - %% Create a case-switch on true/false, generating badarg for all other %% values. @@ -1005,15 +970,10 @@ new_in_all(Before, Region) -> %% Handle import declarations and est for imported functions. No need to %% check when building imports as code is correct. -import({Mod0,Fs}, St) -> - Mod = list_to_atom(package_to_string(Mod0)), +import({Mod,Fs}, St) -> + true = is_atom(Mod), Mfs = from_list(Fs), - St#expand{imports=add_imports(Mod, Mfs, St#expand.imports)}; -import(Mod0, St) -> - Mod = package_to_string(Mod0), - Key = list_to_atom(packages:last(Mod)), - St#expand{mod_imports=dict:store(Key, list_to_atom(Mod), - St#expand.mod_imports)}. + St#expand{imports=add_imports(Mod, Mfs, St#expand.imports)}. add_imports(Mod, [F|Fs], Is) -> add_imports(Mod, Fs, orddict:store(F, Mod, Is)); diff --git a/lib/dialyzer/test/r9c_SUITE_data/results/mnesia b/lib/dialyzer/test/r9c_SUITE_data/results/mnesia index 17f2bd2ea8..1aac46f5b2 100644 --- a/lib/dialyzer/test/r9c_SUITE_data/results/mnesia +++ b/lib/dialyzer/test/r9c_SUITE_data/results/mnesia @@ -6,7 +6,7 @@ mnesia_bup.erl:111: The created fun has no local return mnesia_bup.erl:574: Function fallback_receiver/2 has no local return mnesia_bup.erl:967: Function uninstall_fallback_master/2 has no local return mnesia_checkpoint.erl:1014: The variable Error can never match since previous clauses completely covered the type {'ok',#checkpoint_args{nodes::[any()],retainers::[any(),...]}} -mnesia_checkpoint.erl:894: The call sys:handle_system_msg(Msg::any(),From::any(),'no_parent','mnesia_checkpoint',[],Cp::#checkpoint_args{}) breaks the contract (Msg,From,Parent,Module,Debug,Misc) -> Void when is_subtype(Msg,term()), is_subtype(From,{pid(),Tag::_}), is_subtype(Parent,pid()), is_subtype(Module,module()), is_subtype(Debug,[dbg_opt()]), is_subtype(Misc,term()), is_subtype(Void,term()) +mnesia_checkpoint.erl:894: The call sys:handle_system_msg(Msg::any(),From::any(),'no_parent','mnesia_checkpoint',[],Cp::#checkpoint_args{}) breaks the contract (Msg,From,Parent,Module,Debug,Misc) -> no_return() when is_subtype(Msg,term()), is_subtype(From,{pid(),Tag::_}), is_subtype(Parent,pid()), is_subtype(Module,module()), is_subtype(Debug,[dbg_opt()]), is_subtype(Misc,term()) mnesia_controller.erl:1666: The variable Tab can never match since previous clauses completely covered the type [any()] mnesia_controller.erl:1679: The pattern {'stop', Reason, Reply, State2} can never match the type {'noreply',_} | {'reply',_,_} | {'stop','shutdown',#state{}} mnesia_controller.erl:1685: The pattern {'noreply', State2, _Timeout} can never match the type {'reply',_,_} diff --git a/lib/dialyzer/test/r9c_SUITE_data/src/asn1/asn1ct_gen.erl b/lib/dialyzer/test/r9c_SUITE_data/src/asn1/asn1ct_gen.erl index 32d4a22645..5b33be9eff 100644 --- a/lib/dialyzer/test/r9c_SUITE_data/src/asn1/asn1ct_gen.erl +++ b/lib/dialyzer/test/r9c_SUITE_data/src/asn1/asn1ct_gen.erl @@ -295,7 +295,7 @@ gen_part_decode_funcs([_H|T],N) -> gen_part_decode_funcs([],N) -> if N > 0 -> - .emit([".",nl]); + emit([".",nl]); true -> ok end. diff --git a/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia.erl b/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia.erl index b4f03fab03..17cc9a953d 100644 --- a/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia.erl +++ b/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia.erl @@ -1806,7 +1806,6 @@ system_info2(dump_log_update_in_place) -> system_info2(dump_log_update_in_place) -> mnesia_monitor:get_env(dump_log_update_in_place); system_info2(max_wait_for_decision) -> mnesia_monitor:get_env(max_wait_for_decision); -system_info2(embedded_mnemosyne) -> mnesia_monitor:get_env(embedded_mnemosyne); system_info2(ignore_fallback_at_startup) -> mnesia_monitor:get_env(ignore_fallback_at_startup); system_info2(fallback_error_function) -> mnesia_monitor:get_env(fallback_error_function); system_info2(log_version) -> mnesia_log:version(); @@ -1840,7 +1839,6 @@ system_info_items(yes) -> dump_log_time_threshold, dump_log_update_in_place, dump_log_write_threshold, - embedded_mnemosyne, event_module, extra_db_nodes, fallback_activated, diff --git a/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia_monitor.erl b/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia_monitor.erl index b64419d5a8..a1c25b5120 100644 --- a/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia_monitor.erl +++ b/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia_monitor.erl @@ -631,7 +631,6 @@ env() -> dump_log_time_threshold, dump_log_update_in_place, dump_log_write_threshold, - embedded_mnemosyne, event_module, extra_db_nodes, ignore_fallback_at_startup, @@ -660,8 +659,6 @@ default_env(dump_log_update_in_place) -> true; default_env(dump_log_write_threshold) -> 1000; -default_env(embedded_mnemosyne) -> - false; default_env(event_module) -> mnesia_event; default_env(extra_db_nodes) -> @@ -703,7 +700,6 @@ do_check_type(event_module, A) when atom(A) -> A; do_check_type(ignore_fallback_at_startup, B) -> bool(B); do_check_type(fallback_error_function, {Mod, Func}) when atom(Mod), atom(Func) -> {Mod, Func}; -do_check_type(embedded_mnemosyne, B) -> bool(B); do_check_type(extra_db_nodes, L) when list(L) -> Fun = fun(N) when N == node() -> false; (A) when atom(A) -> true diff --git a/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia_sup.erl b/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia_sup.erl index 78609ffdde..970e0e5f47 100644 --- a/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia_sup.erl +++ b/lib/dialyzer/test/r9c_SUITE_data/src/mnesia/mnesia_sup.erl @@ -57,9 +57,8 @@ init() -> Event = event_procs(), Kernel = kernel_procs(), - Mnemosyne = mnemosyne_procs(), - {ok, {Flags, Event ++ Kernel ++ Mnemosyne}}. + {ok, {Flags, Event ++ Kernel}}. event_procs() -> KillAfter = timer:seconds(30), @@ -72,16 +71,6 @@ kernel_procs() -> KA = infinity, [{K, {K, start, []}, permanent, KA, supervisor, [K, supervisor]}]. -mnemosyne_procs() -> - case mnesia_monitor:get_env(embedded_mnemosyne) of - true -> - Q = mnemosyne_sup, - KA = infinity, - [{Q, {Q, start, []}, permanent, KA, supervisor, [Q, supervisor]}]; - false -> - [] - end. - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% event handler @@ -107,11 +96,8 @@ add_event_handler() -> kill() -> Mnesia = [mnesia_fallback | mnesia:ms()], - Mnemosyne = mnemosyne_ms(), Kill = fun(Name) -> catch exit(whereis(Name), kill) end, - lists:foreach(Kill, Mnemosyne), lists:foreach(Kill, Mnesia), - lists:foreach(fun ensure_dead/1, Mnemosyne), lists:foreach(fun ensure_dead/1, Mnesia), timer:sleep(10), case lists:keymember(mnesia, 1, application:which_applications()) of @@ -128,9 +114,3 @@ ensure_dead(Name) -> timer:sleep(10), ensure_dead(Name) end. - -mnemosyne_ms() -> - case mnesia_monitor:get_env(embedded_mnemosyne) of - true -> mnemosyne:ms(); - false -> [] - end. diff --git a/lib/dialyzer/test/small_SUITE_data/results/cerl_hipeify b/lib/dialyzer/test/small_SUITE_data/results/cerl_hipeify index 06dc0d63ee..91ed552eec 100644 --- a/lib/dialyzer/test/small_SUITE_data/results/cerl_hipeify +++ b/lib/dialyzer/test/small_SUITE_data/results/cerl_hipeify @@ -1,4 +1,3 @@ -cerl_hipeify.erl:370: Function will never be called cerl_hipeify.erl:370: Guard test fun((none()) -> no_return()) =:= F::{_,_,_} | {_,_,_,_} | {_,_,_,_,_} | {_,_,_,_,_,_} | {_,_,_,_,_,_,_} can never succeed cerl_hipeify.erl:641: Function env__new_function_name/2 will never be called diff --git a/lib/dialyzer/test/small_SUITE_data/results/comm_layer b/lib/dialyzer/test/small_SUITE_data/results/comm_layer deleted file mode 100644 index cb4bf14eb4..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/results/comm_layer +++ /dev/null @@ -1,2 +0,0 @@ - -comm_layer.erl:76: Invalid type specification for function 'comm_layer_dir.comm_layer':this/0. The success typing is () -> {_,integer(),pid()} diff --git a/lib/dialyzer/test/small_SUITE_data/results/empty_list_infimum b/lib/dialyzer/test/small_SUITE_data/results/empty_list_infimum new file mode 100644 index 0000000000..6eaf60b91d --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/results/empty_list_infimum @@ -0,0 +1,2 @@ + +empty_list_infimum.erl:38: Invalid type specification for function empty_list_infimum:list_vhost_permissions/1. The success typing is (_) -> [[{_,_}]]
\ No newline at end of file diff --git a/lib/dialyzer/test/small_SUITE_data/results/port_info_test b/lib/dialyzer/test/small_SUITE_data/results/port_info_test index 863a3d61df..53d20a415b 100644 --- a/lib/dialyzer/test/small_SUITE_data/results/port_info_test +++ b/lib/dialyzer/test/small_SUITE_data/results/port_info_test @@ -1,7 +1,7 @@ port_info_test.erl:10: The pattern {'connected', 42} can never match the type 'undefined' | {'connected',pid()} -port_info_test.erl:14: The pattern {'registered_name', "42"} can never match the type 'undefined' | {'registered_name',atom()} +port_info_test.erl:14: The pattern {'registered_name', "42"} can never match the type 'undefined' | [] | {'registered_name',atom()} port_info_test.erl:19: The pattern {'output', 42} can never match the type 'undefined' | {'connected',pid()} port_info_test.erl:24: Guard test 'links' =:= Atom::'connected' can never succeed -port_info_test.erl:28: The pattern {'gazonk', _} can never match the type 'undefined' | {'connected' | 'id' | 'input' | 'links' | 'name' | 'os_pid' | 'output' | 'registered_name',atom() | pid() | [pid() | char()] | integer()} +port_info_test.erl:28: The pattern {'gazonk', _} can never match the type 'undefined' | [] | {'connected' | 'id' | 'input' | 'links' | 'locking' | 'memory' | 'monitors' | 'name' | 'os_pid' | 'output' | 'parallelism' | 'queue_size' | 'registered_name',atom() | pid() | [pid() | char() | {'process',pid()}] | non_neg_integer()} port_info_test.erl:32: The pattern {'os_pid', "42"} can never match the type 'undefined' | {'os_pid','undefined' | non_neg_integer()} diff --git a/lib/dialyzer/test/small_SUITE_data/results/pubsub b/lib/dialyzer/test/small_SUITE_data/results/pubsub deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/results/pubsub +++ /dev/null diff --git a/lib/dialyzer/test/small_SUITE_data/results/record_creation_diffs b/lib/dialyzer/test/small_SUITE_data/results/record_creation_diffs new file mode 100644 index 0000000000..f00c4b10ff --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/results/record_creation_diffs @@ -0,0 +1,3 @@ + +record_creation_diffs.erl:10: Function foo/1 has no local return +record_creation_diffs.erl:11: Record construction #bar{some_list::{'this','is','a','tuple'}} violates the declared type of field some_list::'undefined' | [any()] diff --git a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_acceptor.erl b/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_acceptor.erl deleted file mode 100644 index 2ca1468911..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_acceptor.erl +++ /dev/null @@ -1,119 +0,0 @@ -% Copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. -%%%------------------------------------------------------------------- -%%% File : comm_acceptor.erl -%%% Author : Thorsten Schuett <[email protected]> -%%% Description : Acceptor -%%% This module accepts new connections and starts corresponding -%%% comm_connection processes. -%%% -%%% Created : 18 Apr 2008 by Thorsten Schuett <[email protected]> -%%%------------------------------------------------------------------- -%% @author Thorsten Schuett <[email protected]> -%% @copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -%% @version $Id $ --module(comm_layer_dir.comm_acceptor). - --export([start_link/1, init/2]). - --import(config). --import(gen_tcp). --import(inet). --import(log). --import(lists). --import(process_dictionary). - -start_link(InstanceId) -> - Pid = spawn_link(comm_layer_dir.comm_acceptor, init, [InstanceId, self()]), - receive - {started} -> - {ok, Pid} - end. - -init(InstanceId, Supervisor) -> - process_dictionary:register_process(InstanceId, acceptor, self()), - erlang:register(comm_layer_acceptor, self()), - log:log(info,"[ CC ] listening on ~p:~p", [config:listenIP(), config:listenPort()]), - LS = case config:listenIP() of - undefined -> - open_listen_port(config:listenPort(), first_ip()); - _ -> - open_listen_port(config:listenPort(), config:listenIP()) - end, - {ok, {_LocalAddress, LocalPort}} = inet:sockname(LS), - comm_port:set_local_address(undefined, LocalPort), - %io:format("this() == ~w~n", [{LocalAddress, LocalPort}]), - Supervisor ! {started}, - server(LS). - -server(LS) -> - case gen_tcp:accept(LS) of - {ok, S} -> - case comm_port:get_local_address_port() of - {undefined, LocalPort} -> - {ok, {MyIP, _LocalPort}} = inet:sockname(S), - comm_port:set_local_address(MyIP, LocalPort); - _ -> - ok - end, - receive - {tcp, S, Msg} -> - {endpoint, Address, Port} = binary_to_term(Msg), - % auto determine remote address, when not sent correctly - NewAddress = if Address =:= {0,0,0,0} orelse Address =:= {127,0,0,1} -> - case inet:peername(S) of - {ok, {PeerAddress, _Port}} -> - % io:format("Sent Address ~p\n",[Address]), - % io:format("Peername is ~p\n",[PeerAddress]), - PeerAddress; - {error, _Why} -> - % io:format("Peername error ~p\n",[Why]). - Address - end; - true -> - % io:format("Address is ~p\n",[Address]), - Address - end, - NewPid = comm_connection:new(NewAddress, Port, S), - gen_tcp:controlling_process(S, NewPid), - inet:setopts(S, [{active, once}, {send_timeout, config:read(tcp_send_timeout)}]), - comm_port:register_connection(NewAddress, Port, NewPid, S) - end, - server(LS); - Other -> - log:log(warn,"[ CC ] unknown message ~p", [Other]) - end. - -open_listen_port({From, To}, IP) -> - open_listen_port(lists:seq(From, To), IP); -open_listen_port([Port | Rest], IP) -> - case gen_tcp:listen(Port, [binary, {packet, 4}, {reuseaddr, true}, - {active, once}, {ip, IP}]) of - {ok, Socket} -> - Socket; - {error, Reason} -> - log:log(error,"[ CC ] can't listen on ~p: ~p~n", [Port, Reason]), - open_listen_port(Rest, IP) - end; -open_listen_port([], _) -> - abort; -open_listen_port(Port, IP) -> - open_listen_port([Port], IP). - --include_lib("kernel/include/inet.hrl"). - -first_ip() -> - {ok, Hostname} = inet:gethostname(), - {ok, HostEntry} = inet:gethostbyname(Hostname), - erlang:hd(HostEntry#hostent.h_addr_list). diff --git a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_connection.erl b/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_connection.erl deleted file mode 100644 index 5a8f9710d6..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_connection.erl +++ /dev/null @@ -1,207 +0,0 @@ -%% -*- coding: utf-8 -*- -% Copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. -%%%------------------------------------------------------------------- -%%% File : comm_connection.erl -%%% Author : Thorsten Schuett <[email protected]> -%%% Description : creates and destroys connections and represents the -%%% endpoint of a connection where messages are received and -%% send from/to the network. -%%% -%%% Created : 18 Apr 2008 by Thorsten Schuett <[email protected]> -%%%------------------------------------------------------------------- -%% @author Thorsten Schuett <[email protected]> -%% @copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -%% @version $Id $ --module(comm_layer_dir.comm_connection). - --export([send/3, open_new/4, new/3, open_new_async/4]). - --import(config). --import(gen_tcp). --import(inet). --import(io). --import(io_lib). --import(log). --import(timer). - --include("comm_layer.hrl"). - -%% @doc new accepted connection. called by comm_acceptor -%% @spec new(inet:ip_address(), int(), socket()) -> pid() -new(Address, Port, Socket) -> - spawn(fun () -> loop(Socket, Address, Port) end). - -%% @doc open new connection -%% @spec open_new(inet:ip_address(), int(), inet:ip_address(), int()) -> -%% {local_ip, inet:ip_address(), int(), pid(), inet:socket()} -%% | fail -%% | {connection, pid(), inet:socket()} -open_new(Address, Port, undefined, MyPort) -> - Myself = self(), - LocalPid = spawn(fun () -> - case new_connection(Address, Port, MyPort) of - fail -> - Myself ! {new_connection_failed}; - Socket -> - {ok, {MyIP, _MyPort}} = inet:sockname(Socket), - Myself ! {new_connection_started, MyIP, MyPort, Socket}, - loop(Socket, Address, Port) - end - end), - receive - {new_connection_failed} -> - fail; - {new_connection_started, MyIP, MyPort, S} -> - {local_ip, MyIP, MyPort, LocalPid, S} - end; -open_new(Address, Port, _MyAddress, MyPort) -> - Owner = self(), - LocalPid = spawn(fun () -> - case new_connection(Address, Port, MyPort) of - fail -> - Owner ! {new_connection_failed}; - Socket -> - Owner ! {new_connection_started, Socket}, - loop(Socket, Address, Port) - end - end), - receive - {new_connection_failed} -> - fail; - {new_connection_started, Socket} -> - {connection, LocalPid, Socket} - end. - -% =============================================================================== -% @doc open a new connection asynchronously -% =============================================================================== --spec(open_new_async/4 :: (any(), any(), any(), any()) -> pid()). -open_new_async(Address, Port, _MyAddr, MyPort) -> - Pid = spawn(fun () -> - case new_connection(Address, Port, MyPort) of - fail -> - comm_port:unregister_connection(Address, Port), - ok; - Socket -> - loop(Socket, Address, Port) - end - end), - Pid. - - -send({Address, Port, Socket}, Pid, Message) -> - BinaryMessage = term_to_binary({deliver, Pid, Message}), - SendTimeout = config:read(tcp_send_timeout), - {Time, Result} = timer:tc(gen_tcp, send, [Socket, BinaryMessage]), - if - Time > 1200 * SendTimeout -> - log:log(error,"[ CC ] send to ~p took ~p: ~p", - [Address, Time, inet:getopts(Socket, [keep_alive, send_timeout])]); - true -> - ok - end, - case Result of - ok -> - ?LOG_MESSAGE(erlang:element(1, Message), byte_size(BinaryMessage)), - ok; - {error, closed} -> - comm_port:unregister_connection(Address, Port), - close_connection(Socket); - {error, _Reason} -> - %log:log(error,"[ CC ] couldn't send to ~p:~p (~p)", [Address, Port, Reason]), - comm_port:unregister_connection(Address, Port), - close_connection(Socket) - end. - -loop(fail, Address, Port) -> - comm_port:unregister_connection(Address, Port), - ok; -loop(Socket, Address, Port) -> - receive - {send, Pid, Message} -> - case send({Address, Port, Socket}, Pid, Message) of - ok -> loop(Socket, Address, Port); - _ -> ok - end; - {tcp_closed, Socket} -> - comm_port:unregister_connection(Address, Port), - gen_tcp:close(Socket); - {tcp, Socket, Data} -> - case binary_to_term(Data) of - {deliver, Process, Message} -> - Process ! Message, - inet:setopts(Socket, [{active, once}]), - loop(Socket, Address, Port); - {user_close} -> - comm_port:unregister_connection(Address, Port), - gen_tcp:close(Socket); - {youare, _Address, _Port} -> - %% @TODO what do we get from this information? - inet:setopts(Socket, [{active, once}]), - loop(Socket, Address, Port); - Unknown -> - log:log(warn,"[ CC ] unknown message ~p", [Unknown]), - inet:setopts(Socket, [{active, once}]), - loop(Socket, Address, Port) - end; - - {youare, _IP, _Port} -> - loop(Socket, Address, Port); - - Unknown -> - log:log(warn,"[ CC ] unknown message2 ~p", [Unknown]) , - loop(Socket, Address, Port) - end. - -% =============================================================================== - --spec(new_connection(inet:ip_address(), integer(), integer()) -> inet:socket() | fail). -new_connection(Address, Port, MyPort) -> - case gen_tcp:connect(Address, Port, [binary, {packet, 4}, {nodelay, true}, {active, once}, - {send_timeout, config:read(tcp_send_timeout)}], - config:read(tcp_connect_timeout)) of - {ok, Socket} -> - % send end point data - case inet:sockname(Socket) of - {ok, {MyAddress, _MyPort}} -> - Message = term_to_binary({endpoint, MyAddress, MyPort}), - gen_tcp:send(Socket, Message), - case inet:peername(Socket) of - {ok, {RemoteIP, RemotePort}} -> - YouAre = term_to_binary({youare, RemoteIP, RemotePort}), - gen_tcp:send(Socket, YouAre), - Socket; - {error, _Reason} -> - %log:log(error,"[ CC ] reconnect to ~p because socket is ~p", - % [Address, Reason]), - close_connection(Socket), - new_connection(Address, Port, MyPort) - end; - {error, _Reason} -> - %log:log(error,"[ CC ] reconnect to ~p because socket is ~p", - % [Address, Reason]), - close_connection(Socket), - new_connection(Address, Port, MyPort) - end; - {error, _Reason} -> - %log:log(error,"[ CC ] couldn't connect to ~p:~p (~p)", - %[Address, Port, Reason]), - fail - end. - -close_connection(Socket) -> - spawn( fun () -> - gen_tcp:close(Socket) - end ). diff --git a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_layer.erl b/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_layer.erl deleted file mode 100644 index b7fdd183e1..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_layer.erl +++ /dev/null @@ -1,83 +0,0 @@ -% Copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. -%%%------------------------------------------------------------------- -%%% File : comm_layer.erl -%%% Author : Thorsten Schuett <[email protected]> -%%% Description : Public interface to Communication Layer. -%%% Generic functions to send messages. -%%% Distinguishes on runtime whether the destination is in the -%%% same Erlang virtual machine (use ! for sending) or on a remote -%%% site (use comm_port:send()). -%%% -%%% Created : 04 Feb 2008 by Thorsten Schuett <[email protected]> -%%%------------------------------------------------------------------- -%% @author Thorsten Schuett <[email protected]> -%% @copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -%% @version $Id $ --module(comm_layer_dir.comm_layer). - --author('[email protected]'). --vsn('$Id: comm_layer.erl,v 1.1 2009/11/06 12:41:36 maria Exp $ '). - --export([start_link/0, send/2, this/0, here/1]). - --import(io). --import(util). --import(log). - --include("comm_layer.hrl"). - - -% @TODO: should be ip --type(process_id() :: {any(), integer(), pid()}). -%%==================================================================== -%% public functions -%%==================================================================== - -%% @doc starts the communication port (for supervisor) -%% @spec start_link() -> {ok,Pid} | ignore | {error,Error} -start_link() -> - comm_port_sup:start_link(). - -%% @doc a process descriptor has to specify the erlang vm -%% + the process inside. {IP address, port, pid} -%% @type process_id() = {inet:ip_address(), int(), pid()}. -%% @spec send(process_id(), term()) -> ok - -send({{_IP1, _IP2, _IP3, _IP4} = _IP, _Port, _Pid} = Target, Message) -> - {MyIP,MyPort} = comm_port:get_local_address_port(), - %io:format("send: ~p:~p -> ~p:~p(~p) : ~p\n", [MyIP, MyPort, _IP, _Port, _Pid, Message]), - IsLocal = (MyIP == _IP) and (MyPort == _Port), - if - IsLocal -> - ?LOG_MESSAGE(erlang:element(1, Message), byte_size(term_to_binary(Message))), - _Pid ! Message; - true -> - comm_port:send(Target, Message) - end; - -send(Target, Message) -> - log:log(error,"[ CC ] wrong call to cs_send:send: ~w ! ~w", [Target, Message]), - log:log(error,"[ CC ] stacktrace: ~w", [util:get_stacktrace()]), - ok. - -%% @doc returns process descriptor for the calling process --spec(this/0 :: () -> atom()).%process_id()). -this() -> - here(self()). - --spec(here/1 :: (pid()) -> process_id()). -here(Pid) -> - {LocalIP, LocalPort} = comm_port:get_local_address_port(), - {LocalIP, LocalPort, Pid}. diff --git a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_layer.hrl b/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_layer.hrl deleted file mode 100644 index 54f31b7c55..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_layer.hrl +++ /dev/null @@ -1,29 +0,0 @@ -% Copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. -%%%------------------------------------------------------------------- -%%% File : comm_layer.hrl -%%% Author : Thorsten Schuett <[email protected]> -%%% Description : -%%% -%%% Created : 31 Jul 2008 by Thorsten Schuett <[email protected]> -%%%------------------------------------------------------------------- -%% @author Thorsten Schuett <[email protected]> -%% @copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -%% @version $Id: comm_layer.hrl,v 1.1 2009/11/06 12:41:36 maria Exp $ --author('[email protected]'). --vsn('$Id: comm_layer.hrl,v 1.1 2009/11/06 12:41:36 maria Exp $ '). - -% enable logging of message statistics -%-define(LOG_MESSAGE(TAG, SIZE), comm_layer.comm_logger:log(TAG, SIZE)). --define(LOG_MESSAGE(TAG, SIZE), ok). diff --git a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_logger.erl b/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_logger.erl deleted file mode 100644 index b8882758af..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_logger.erl +++ /dev/null @@ -1,143 +0,0 @@ -% Copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. -%%%------------------------------------------------------------------- -%%% File : comm_logger.erl -%%% Author : Thorsten Schuett <[email protected]> -%%% Description : -%%% -%%% Created : 31 Jul 2008 by Thorsten Schuett <[email protected]> -%%%------------------------------------------------------------------- -%% @author Thorsten Schuett <[email protected]> -%% @copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -%% @version $Id: comm_logger.erl,v 1.1 2009/11/06 12:41:36 maria Exp $ --module(comm_layer_dir.comm_logger). - --author('[email protected]'). --vsn('$Id: comm_logger.erl,v 1.1 2009/11/06 12:41:36 maria Exp $ '). - --behaviour(gen_server). - --import(gb_trees). --import(gen_server). - -%% API --export([start_link/0]). - --export([log/2, dump/0]). - -%% gen_server callbacks --export([init/1, handle_call/3, handle_cast/2, handle_info/2, - terminate/2, code_change/3]). - --record(state, {start, map}). - -%%==================================================================== -%% API -%%==================================================================== -%%-------------------------------------------------------------------- -%% Function: start_link() -> {ok,Pid} | ignore | {error,Error} -%% Description: Starts the server -%%-------------------------------------------------------------------- -start_link() -> - gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). - -%%-------------------------------------------------------------------- -%% Function: log(Tag, Size) -> ok -%% Description: logs a message type with its size -%%-------------------------------------------------------------------- -log(Tag, Size) -> - gen_server:cast(?MODULE, {log, Tag, Size}). - -%%-------------------------------------------------------------------- -%% Function: dump() -> {gb_tree:gb_trees(), {Date, Time}} -%% Description: gets the logging state -%%-------------------------------------------------------------------- -dump() -> - gen_server:call(?MODULE, {dump}). - -%%==================================================================== -%% gen_server callbacks -%%==================================================================== - -%%-------------------------------------------------------------------- -%% Function: init(Args) -> {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%-------------------------------------------------------------------- -init([]) -> - {ok, #state{start=erlang:now(), map=gb_trees:empty()}}. - -%%-------------------------------------------------------------------- -%% Function: %% handle_call(Request, From, State) -> {reply, Reply, State} | -%% {reply, Reply, State, Timeout} | -%% {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, Reply, State} | -%% {stop, Reason, State} -%% Description: Handling call messages -%%-------------------------------------------------------------------- -handle_call({dump}, _From, State) -> - Reply = {State#state.map, State#state.start}, - {reply, Reply, State}; -handle_call(_Request, _From, State) -> - Reply = ok, - {reply, Reply, State}. - -%%-------------------------------------------------------------------- -%% Function: handle_cast(Msg, State) -> {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} -%% Description: Handling cast messages -%%-------------------------------------------------------------------- -handle_cast({log, Tag, Size}, State) -> - case gb_trees:lookup(Tag, State#state.map) of - none -> - {noreply, State#state{map=gb_trees:insert(Tag, {Size, 1}, State#state.map)}}; - {value, {OldSize, OldCount}} -> - {noreply, State#state{map=gb_trees:update(Tag, {Size + OldSize, OldCount + 1}, State#state.map)}} - end; -handle_cast(_Msg, State) -> - {noreply, State}. - -%%-------------------------------------------------------------------- -%% Function: handle_info(Info, State) -> {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} -%% Description: Handling all non call/cast messages -%%-------------------------------------------------------------------- -handle_info(_Info, State) -> - {noreply, State}. - -%%-------------------------------------------------------------------- -%% Function: terminate(Reason, State) -> void() -%% Description: This function is called by a gen_server when it is about to -%% terminate. It should be the opposite of Module:init/1 and do any necessary -%% cleaning up. When it returns, the gen_server terminates with Reason. -%% The return value is ignored. -%%-------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%-------------------------------------------------------------------- -%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState} -%% Description: Convert process state when code is changed -%%-------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- diff --git a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_port.erl b/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_port.erl deleted file mode 100644 index d9fcb5e625..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_port.erl +++ /dev/null @@ -1,241 +0,0 @@ -%% -*- coding: utf-8 -*- -% Copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. -%%%------------------------------------------------------------------- -%%% File : comm_port.erl -%%% Author : Thorsten Schuett <[email protected]> -%%% Description : Main CommLayer Interface -%%% Maps remote addresses to comm_connection PIDs. -%%% -%%% Created : 18 Apr 2008 by Thorsten Schuett <[email protected]> -%%%------------------------------------------------------------------- -%% @author Thorsten Schuett <[email protected]> -%% @copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -%% @version $Id $ --module(comm_layer_dir.comm_port). - --author('[email protected]'). --vsn('$Id: comm_port.erl,v 1.1 2009/11/06 12:41:36 maria Exp $ '). - --behaviour(gen_server). - --import(ets). --import(gen_server). --import(io). --import(log). - --define(ASYNC, true). -%-define(SYNC, true). - -%% API --export([start_link/0, - send/2, - unregister_connection/2, register_connection/4, - set_local_address/2, get_local_address_port/0]). - -%% gen_server callbacks --export([init/1, handle_call/3, handle_cast/2, handle_info/2, - terminate/2, code_change/3]). - -%%==================================================================== -%% API -%%==================================================================== - -%% @doc -%% @spec send({inet:ip_address(), int(), pid()}, term()) -> ok --ifdef(ASYNC). -send({Address, Port, Pid}, Message) -> - gen_server:call(?MODULE, {send, Address, Port, Pid, Message}, 20000). --endif. --ifdef(SYNC). -send({Address, Port, Pid}, Message) -> - case ets:lookup(?MODULE, {Address, Port}) of - [{{Address, Port}, {_LPid, Socket}}] -> - comm_connection:send({Address, Port, Socket}, Pid, Message), - ok; - [] -> - gen_server:call(?MODULE, {send, Address, Port, Pid, Message}, 20000) - end. --endif. - - -%% @doc -%% @spec unregister_connection(inet:ip_address(), int()) -> ok -unregister_connection(Adress, Port) -> - gen_server:call(?MODULE, {unregister_conn, Adress, Port}, 20000). - -%% @doc -%% @spec register_connection(inet:ip_address(), int(), pid(), gen_tcp:socket()) -> ok | duplicate -register_connection(Adress, Port, Pid, Socket) -> - gen_server:call(?MODULE, {register_conn, Adress, Port, Pid, Socket}, 20000). - -%% @doc -%% @spec set_local_address(inet:ip_address(), int()) -> ok -set_local_address(Address, Port) -> - gen_server:call(?MODULE, {set_local_address, Address, Port}, 20000). - - -%% @doc -%% @spec get_local_address_port() -> {inet:ip_address(),int()} -get_local_address_port() -> - case ets:lookup(?MODULE, local_address_port) of - [{local_address_port, Value}] -> - Value; - [] -> - undefined - end. - -%%-------------------------------------------------------------------- -%% Function: start_link() -> {ok,Pid} | ignore | {error,Error} -%% Description: Starts the server -%%-------------------------------------------------------------------- -start_link() -> - gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). - -%%==================================================================== -%% gen_server callbacks -%%==================================================================== - -%%-------------------------------------------------------------------- -%% Function: init(Args) -> {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%-------------------------------------------------------------------- -init([]) -> - ets:new(?MODULE, [set, protected, named_table]), - {ok, ok}. % empty state. - -%%-------------------------------------------------------------------- -%% Function: %% handle_call(Request, From, State) -> {reply, Reply, State} | -%% {reply, Reply, State, Timeout} | -%% {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, Reply, State} | -%% {stop, Reason, State} -%% Description: Handling call messages -%%-------------------------------------------------------------------- -handle_call({send, Address, Port, Pid, Message}, _From, State) -> - send(Address, Port, Pid, Message, State); - -handle_call({unregister_conn, Address, Port}, _From, State) -> - ets:delete(?MODULE, {Address, Port}), - {reply, ok, State}; - -handle_call({register_conn, Address, Port, Pid, Socket}, _From, State) -> - case ets:lookup(?MODULE, {Address, Port}) of - [{{Address, Port}, _}] -> - {reply, duplicate, State}; - [] -> - ets:insert(?MODULE, {{Address, Port}, {Pid, Socket}}), - {reply, ok, State} - end; - -handle_call({set_local_address, Address, Port}, _From, State) -> - ets:insert(?MODULE, {local_address_port, {Address,Port}}), - {reply, ok, State}. - -%%-------------------------------------------------------------------- -%% Function: handle_cast(Msg, State) -> {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} -%% Description: Handling cast messages -%%-------------------------------------------------------------------- -handle_cast(_Msg, State) -> - {noreply, State}. - -%%-------------------------------------------------------------------- -%% Function: handle_info(Info, State) -> {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} -%% Description: Handling all non call/cast messages -%%-------------------------------------------------------------------- -handle_info(_Info, State) -> - {noreply, State}. - -%%-------------------------------------------------------------------- -%% Function: terminate(Reason, State) -> void() -%% Description: This function is called by a gen_server when it is about to -%% terminate. It should be the opposite of Module:init/1 and do any necessary -%% cleaning up. When it returns, the gen_server terminates with Reason. -%% The return value is ignored. -%%-------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%-------------------------------------------------------------------- -%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState} -%% Description: Convert process state when code is changed -%%-------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- - --ifdef(ASYNC). -send(Address, Port, Pid, Message, State) -> - {DepAddr,DepPort} = get_local_address_port(), - if - DepAddr == undefined -> - open_sync_connection(Address, Port, Pid, Message, State); - true -> - case ets:lookup(?MODULE, {Address, Port}) of - [{{Address, Port}, {ConnPid, _Socket}}] -> - ConnPid ! {send, Pid, Message}, - {reply, ok, State}; - [] -> - ConnPid = comm_connection:open_new_async(Address, Port, - DepAddr, DepPort), - ets:insert(?MODULE, {{Address, Port}, {ConnPid, undef}}), - ConnPid ! {send, Pid, Message}, - {reply, ok, State} - end - end. --endif. - --ifdef(SYNC). -send(Address, Port, Pid, Message, State) -> - case ets:lookup(?MODULE, {Address, Port}) of - [{{Address, Port}, {_LPid, Socket}}] -> - comm_connection:send({Address, Port, Socket}, Pid, Message), - {reply, ok, State}; - [] -> - open_sync_connection(Address, Port, Pid, Message, State) - end. --endif. - - -open_sync_connection(Address, Port, Pid, Message, State) -> - {DepAddr,DepPort} = get_local_address_port(), - case comm_connection:open_new(Address, Port, DepAddr, DepPort) of - {local_ip, MyIP, MyPort, MyPid, MySocket} -> - comm_connection:send({Address, Port, MySocket}, Pid, Message), - log:log(info,"[ CC ] this() == ~w", [{MyIP, MyPort}]), - % set_local_address(t, {MyIP,MyPort}}), - % register_connection(Address, Port, MyPid, MySocket), - ets:insert(?MODULE, {local_address_port, {MyIP,MyPort}}), - ets:insert(?MODULE, {{Address, Port}, {MyPid, MySocket}}), - {reply, ok, State}; - fail -> - % drop message (remote node not reachable, failure detector will notice) - {reply, ok, State}; - {connection, LocalPid, NewSocket} -> - comm_connection:send({Address, Port, NewSocket}, Pid, Message), - ets:insert(?MODULE, {{Address, Port}, {LocalPid, NewSocket}}), - % register_connection(Address, Port, LPid, NewSocket), - {reply, ok, State} - end. diff --git a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_port_sup.erl b/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_port_sup.erl deleted file mode 100644 index d7a25b14ab..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/src/comm_layer/comm_port_sup.erl +++ /dev/null @@ -1,88 +0,0 @@ -% Copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. -%%%------------------------------------------------------------------- -%%% File : comm_port_sup.erl -%%% Author : Thorsten Schuett <[email protected]> -%%% Description : -%%% -%%% Created : 04 Feb 2008 by Thorsten Schuett <[email protected]> -%%%------------------------------------------------------------------- -%% @author Thorsten Schuett <[email protected]> -%% @copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -%% @version $Id: comm_port_sup.erl,v 1.1 2009/11/06 12:41:36 maria Exp $ --module(comm_layer_dir.comm_port_sup). - --author('[email protected]'). --vsn('$Id: comm_port_sup.erl,v 1.1 2009/11/06 12:41:36 maria Exp $ '). - --behaviour(supervisor). - --import(supervisor). --import(randoms). --import(string). --import(config). - --export([start_link/0, init/1]). - -%%==================================================================== -%% API functions -%%==================================================================== -%%-------------------------------------------------------------------- -%% Function: start_link() -> {ok,Pid} | ignore | {error,Error} -%% Description: Starts the supervisor -%%-------------------------------------------------------------------- -start_link() -> - supervisor:start_link(?MODULE, []). - -%%==================================================================== -%% Supervisor callbacks -%%==================================================================== -%%-------------------------------------------------------------------- -%% Func: init(Args) -> {ok, {SupFlags, [ChildSpec]}} | -%% ignore | -%% {error, Reason} -%% Description: Whenever a supervisor is started using -%% supervisor:start_link/[2,3], this function is called by the new process -%% to find out about restart strategy, maximum restart frequency and child -%% specifications. -%%-------------------------------------------------------------------- -init([]) -> - InstanceId = string:concat("comm_port_", randoms:getRandomId()), - CommPort = - {comm_port, - {comm_layer_dir.comm_port, start_link, []}, - permanent, - brutal_kill, - worker, - []}, - CommAcceptor = - {comm_acceptor, - {comm_layer_dir.comm_acceptor, start_link, [InstanceId]}, - permanent, - brutal_kill, - worker, - []}, - CommLogger = - {comm_logger, - {comm_layer_dir.comm_logger, start_link, []}, - permanent, - brutal_kill, - worker, - []}, - {ok, {{one_for_all, 10, 1}, - [ - CommPort, - CommLogger, - CommAcceptor - ]}}. diff --git a/lib/dialyzer/test/small_SUITE_data/src/empty_list_infimum.erl b/lib/dialyzer/test/small_SUITE_data/src/empty_list_infimum.erl new file mode 100644 index 0000000000..b58fa732cb --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/empty_list_infimum.erl @@ -0,0 +1,57 @@ +%% +%% The Original Code is RabbitMQ. +%% +%% The Initial Developer of the Original Code is VMware, Inc. +%% + +-module(empty_list_infimum). + +-record(permission, {configure, write, read}). +-record(user_vhost, {username, virtual_host}). +-record(user_permission, {user_vhost, permission}). + +%%---------------------------------------------------------------------------- + +-export([i_delete/1]). + +-type(vhost() :: binary()). + +-type(info_key() :: atom()). +-type(info_keys() :: [info_key()]). + +-type(info() :: {info_key(), any()}). +-type(infos() :: [info()]). + +%%---------------------------------------------------------------------------- + +-spec i_delete(vhost()) -> 'ok'. + +i_delete(VHostPath) -> + [ok || _ <- list_vhost_permissions(VHostPath)], + ok. + +%%---------------------------------------------------------------------------- + +vhost_perms_info_keys() -> + [user, configure, write, read]. + +-spec list_vhost_permissions(vhost()) -> infos(). + +list_vhost_permissions(VHostPath) -> + list_permissions(vhost_perms_info_keys(), rabbit_foo:some_list()). + +filter_props(Keys, Props) -> + [T || T = {K, _} <- Props, lists:member(K, Keys)]. + +list_permissions(Keys, SomeList) -> + [filter_props(Keys, [{user, Username}, + {vhost, VHostPath}, + {configure, ConfigurePerm}, + {write, WritePerm}, + {read, ReadPerm}]) || + #user_permission{user_vhost = #user_vhost{username = Username, + virtual_host = VHostPath}, + permission = #permission{configure = ConfigurePerm, + write = WritePerm, + read = ReadPerm}} <- + SomeList]. diff --git a/lib/dialyzer/test/small_SUITE_data/src/pubsub/pubsub_api.erl b/lib/dialyzer/test/small_SUITE_data/src/pubsub/pubsub_api.erl deleted file mode 100644 index 85ea292077..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/src/pubsub/pubsub_api.erl +++ /dev/null @@ -1,99 +0,0 @@ -% Copyright 2007-2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. -%%%------------------------------------------------------------------- -%%% File : pubsub_api.erl -%%% Author : Thorsten Schuett <[email protected]> -%%% Description : Publish API function -%%% -%%% Created : 17 Sep 2007 by Thorsten Schuett <[email protected]> -%%%------------------------------------------------------------------- -%% @author Thorsten Schuett <[email protected]> -%% @copyright 2007-2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -%% @version $Id $ --module(pubsub_dir.pubsub_api). - --author('[email protected]'). --vsn('$Id: pubsub_api.erl,v 1.1 2009/11/06 12:39:55 maria Exp $ '). - --export([publish/2, subscribe/2, unsubscribe/2, get_subscribers/1]). - --import(transstore.transaction_api). --import(io). --import(lists). - -%%==================================================================== -%% public functions -%%==================================================================== - -%% @doc publishs an event under a given topic. -%% called e.g. from the java-interface -%% @spec publish(string(), string()) -> ok -publish(Topic, Content) -> - Subscribers = get_subscribers(Topic), - io:format("calling subscribers ~p~n", [Subscribers]), - lists:foreach(fun (Subscriber) -> - io:format("calling ~p~n", [Subscriber]), - pubsub_publish:publish(Subscriber, Topic, Content) - end, - Subscribers), - ok. - -%% @doc subscribes a url for a topic. -%% called e.g. from the java-interface -%% @spec subscribe(string(), string()) -> ok | {fail, term()} -subscribe(Topic, URL) -> - TFun = fun(TransLog) -> - {{Success, _ValueOrReason} = Result, TransLog1} = transaction_api:read(Topic, TransLog), - {Result2, TransLog2} = if - Success == fail -> - transaction_api:write(Topic, [URL], TransLog); %obacht: muss TransLog sein! - true -> - {value, Subscribers} = Result, - transaction_api:write(Topic, [URL | Subscribers], TransLog1) - end, - if - Result2 == ok -> - {{ok, ok}, TransLog2}; - true -> - {Result2, TransLog2} - end - end, - transaction_api:do_transaction(TFun, fun (_) -> ok end, fun (X) -> {fail, X} end). - -%% @doc unsubscribes a url for a topic. --spec(unsubscribe/2 :: (string(), string()) -> ok | {fail, any()}). -unsubscribe(Topic, URL) -> - TFun = fun(TransLog) -> - {Subscribers, TransLog1} = transaction_api:read2(TransLog, Topic), - case lists:member(URL, Subscribers) of - true -> - NewSubscribers = lists:delete(URL, Subscribers), - TransLog2 = transaction_api:write2(TransLog1, Topic, NewSubscribers), - {{ok, ok}, TransLog2}; - false -> - {{fail, not_found}, TransLog} - end - end, - transaction_api:do_transaction(TFun, fun (_) -> ok end, fun (X) -> {fail, X} end). - -%% @doc queries the subscribers of a query -%% @spec get_subscribers(string()) -> [string()] -get_subscribers(Topic) -> - {Fl, _Value} = transaction_api:quorum_read(Topic), - if - Fl == fail -> %% Fl is either Fail or the Value/Subscribers - []; - true -> - Fl - end. diff --git a/lib/dialyzer/test/small_SUITE_data/src/pubsub/pubsub_publish.erl b/lib/dialyzer/test/small_SUITE_data/src/pubsub/pubsub_publish.erl deleted file mode 100644 index 601dbad74b..0000000000 --- a/lib/dialyzer/test/small_SUITE_data/src/pubsub/pubsub_publish.erl +++ /dev/null @@ -1,49 +0,0 @@ -% Copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. -%%%------------------------------------------------------------------- -%%% File : pubsub_publish.erl -%%% Author : Thorsten Schuett <[email protected]> -%%% Description : Publish function -%%% -%%% Created : 26 Mar 2008 by Thorsten Schuett <[email protected]> -%%%------------------------------------------------------------------- -%% @author Thorsten Schuett <[email protected]> -%% @copyright 2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin -%% @version $Id $ --module(pubsub_dir.pubsub_publish). - --author('[email protected]'). --vsn('$Id: pubsub_publish.erl,v 1.1 2009/11/06 12:39:55 maria Exp $ '). - --export([publish/3, publish_internal/3]). - --import(json). --import(io). --import(http). --import(jsonrpc). - -%%==================================================================== -%% public functions -%%==================================================================== - -%% @doc publishs an event to a given url. -%% @spec publish(string(), string(), string()) -> ok -%% @todo use pool:pspawn -publish(URL, Topic, Content) -> - spawn(fun () -> pubsub_publish:publish_internal(URL, Topic, Content) end), - ok. - -publish_internal(URL, Topic, Content) -> - Res = jsonrpc:call(URL, [], {call, notify, [Topic, Content]}), - io:format("~p ~p~n", [Res, URL]). diff --git a/lib/dialyzer/test/small_SUITE_data/src/record_creation_diffs.erl b/lib/dialyzer/test/small_SUITE_data/src/record_creation_diffs.erl new file mode 100644 index 0000000000..e813459f8e --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/record_creation_diffs.erl @@ -0,0 +1,11 @@ +-module(record_creation_diffs). + +-export([foo/1]). + +-record(bar, { + some_atom :: atom(), + some_list :: list() + }). + +foo(Input) -> + #bar{some_atom = Input, some_list = {this,is,a,tuple}}. diff --git a/lib/dialyzer/test/small_SUITE_data/src/unknown_arity_function_spec.erl b/lib/dialyzer/test/small_SUITE_data/src/unknown_arity_function_spec.erl new file mode 100644 index 0000000000..c7d7459614 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/unknown_arity_function_spec.erl @@ -0,0 +1,10 @@ +-module(unknown_arity_function_spec). + +-export([test/2]). + +%-type t() :: 42 | fun((...) -> t()). +%-type f() :: fun((...) -> 42). + +-spec test(fun((...) -> 42), list()) -> 42. +test(F, L) -> + 42 = apply(F, L). diff --git a/lib/diameter/doc/src/Makefile b/lib/diameter/doc/src/Makefile index 8ad38ba0d5..0cbe1f000f 100644 --- a/lib/diameter/doc/src/Makefile +++ b/lib/diameter/doc/src/Makefile @@ -173,8 +173,8 @@ release_spec: depend.mk: depend.sed Makefile seealso.ent \ $(XML_REF_FILES) $(XML_CHAPTER_FILES) - sed -f seehere.sed seealso.ent > seehere.ent - (for f in $(XML_REF_FILES) $(XML_CHAPTER_FILES); do \ + $(gen_verbose)sed -f seehere.sed seealso.ent > seehere.ent + $(V_at)(for f in $(XML_REF_FILES) $(XML_CHAPTER_FILES); do \ sed -f $< $$f | sed "s@%FILE%@`basename $$f .xml`@g"; \ done) \ > $@ diff --git a/lib/diameter/doc/src/notes.xml b/lib/diameter/doc/src/notes.xml index d448b01eba..d241e2bd19 100644 --- a/lib/diameter/doc/src/notes.xml +++ b/lib/diameter/doc/src/notes.xml @@ -42,6 +42,22 @@ first.</p> <!-- ===================================================================== --> +<section><title>Diameter 1.3.1</title> + + <section><title>Known Bugs and Problems</title> + <list> + <item> + <p> + Fix function clause resulting from use of an eval + callback.</p> + <p> + Own Id: OTP-10685</p> + </item> + </list> + </section> + +</section> + <section><title>Diameter 1.3</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/diameter/src/Makefile b/lib/diameter/src/Makefile index 060659bce9..3cbcbf536e 100644 --- a/lib/diameter/src/Makefile +++ b/lib/diameter/src/Makefile @@ -119,7 +119,7 @@ ERL_COMPILE_FLAGS += \ # erl/hrl from dictionary file. gen/diameter_gen_%.erl gen/diameter_gen_%.hrl: dict/%.dia - ../bin/diameterc -o gen -i $(EBIN) $< + $(dia_verbose)../bin/diameterc -o gen -i $(EBIN) $< opt: $(TARGET_FILES) @@ -128,17 +128,19 @@ debug: # The dictionary parser. gen/$(DICT_YRL).erl: compiler/$(DICT_YRL).yrl - $(ERLC) -Werror -o $(@D) $< + $(yecc_verbose)$(ERLC) -Werror -o $(@D) $< # Generate the app file. $(APP_TARGET): $(APP_SRC) ../vsn.mk modules.mk - M=`echo $(notdir $(APP_MODULES)) | tr ' ' ,`; \ + $(gen_verbose)M=`echo $(notdir $(APP_MODULES)) | tr ' ' ,`; \ + R=`echo $(REGISTERED) | tr ' ' ,`; \ sed -e 's;%VSN%;$(VSN);' \ -e "s;%MODULES%;$$M;" \ + -e "s;%REGISTERED%;$$R;" \ $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ app: $(APP_TARGET) $(APPUP_TARGET) dict: $(DICT_ERLS) @@ -254,7 +256,7 @@ depend: depend.mk # Generate dependencies makefile. depend.mk: depend.sed $(MODULES:%=%.erl) Makefile - (for f in $(MODULES); do \ + $(gen_verbose)(for f in $(MODULES); do \ (echo $$f; cat $$f.erl) | sed -f $<; \ done) \ > $@ diff --git a/lib/diameter/src/base/diameter.app.src b/lib/diameter/src/base/diameter.app.src index c092fdb022..7e17cd6c9f 100644 --- a/lib/diameter/src/base/diameter.app.src +++ b/lib/diameter/src/base/diameter.app.src @@ -21,7 +21,7 @@ [{description, "Diameter protocol"}, {vsn, "%VSN%"}, {modules, [%MODULES%]}, - {registered, []}, + {registered, [%REGISTERED%]}, {applications, [stdlib, kernel]}, {env, []}, {mod, {diameter_app, []}} diff --git a/lib/diameter/src/base/diameter.appup.src b/lib/diameter/src/base/diameter.appup.src index 5655f98c1b..a04a387918 100644 --- a/lib/diameter/src/base/diameter.appup.src +++ b/lib/diameter/src/base/diameter.appup.src @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2012. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -24,27 +24,9 @@ {"0.10", [{restart_application, diameter}]}, {"1.0", [{restart_application, diameter}]}, {"1.1", [{restart_application, diameter}]}, - {"1.2", [{load, diameter}, - {load, diameter_capx}, - {load, diameter_codec}, - {load, diameter_peer}, - {load, diameter_reg}, - %% order significant from here - {load, diameter_session}, - {load, diameter_peer_fsm}, - {load, diameter_service}, - {load, diameter_watchdog}, - {load, diameter_config}]}, - {"1.2.1", [{load, diameter}, - {load, diameter_capx}, - {load, diameter_peer}, - {load, diameter_reg}, - %% order significant from here - {load, diameter_session}, - {load, diameter_peer_fsm}, - {load, diameter_service}, - {load, diameter_watchdog}, - {load, diameter_config}]} + {"1.2", [{restart_application, diameter}]}, + {"1.2.1", [{restart_application, diameter}]}, + {"1.3", [{load_module, diameter_service}]} ], [ {"0.9", [{restart_application, diameter}]}, @@ -52,6 +34,7 @@ {"1.0", [{restart_application, diameter}]}, {"1.1", [{restart_application, diameter}]}, {"1.2", [{restart_application, diameter}]}, - {"1.2.1", [{restart_application, diameter}]} + {"1.2.1", [{restart_application, diameter}]}, + {"1.3", [{load_module, diameter_service}]} ] }. diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl index a94d37f7a8..0b0bfe3f0a 100644 --- a/lib/diameter/src/base/diameter_codec.erl +++ b/lib/diameter/src/base/diameter_codec.erl @@ -193,9 +193,11 @@ encode_avps(Avps) -> msg_header(Mod, 'answer-message' = MsgName, Header) -> ?BASE = Mod, - #diameter_header{cmd_code = Code} = Header, - {_, Flags, ApplId} = ?BASE:msg_header(MsgName), - {Code, Flags, ApplId}; + #diameter_header{application_id = Aid, + cmd_code = Code} + = Header, + {-1, Flags, ?DIAMETER_APP_ID_COMMON} = ?BASE:msg_header(MsgName), + {Code, Flags, Aid}; msg_header(Mod, MsgName, _) -> Mod:msg_header(MsgName). diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl index c4320fcb99..858870566f 100644 --- a/lib/diameter/src/base/diameter_peer_fsm.erl +++ b/lib/diameter/src/base/diameter_peer_fsm.erl @@ -388,8 +388,9 @@ transition({diameter, {recv, Pkt}}, S) -> recv(Pkt, S); %% Timeout when still in the same state ... -transition({timeout, PS}, #state{state = PS}) -> - {stop, {capx(PS), timeout}}; +transition({timeout = T, PS}, #state{state = PS} = S) -> + close({capx(PS), T}, S), + stop; %% ... or not. transition({timeout, _}, _) -> diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl index 91384b8b91..b5584ca0d0 100644 --- a/lib/diameter/src/base/diameter_service.erl +++ b/lib/diameter/src/base/diameter_service.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2012. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -859,10 +859,10 @@ i(SvcName) -> true = ets:insert_new(?STATE_TABLE, S), %% Start fsms for each transport. + send_event(SvcName, start), lists:foreach(fun(T) -> start_fsm(T,S) end, CL), init_shared(S), - send_event(SvcName, start), S. cfg_acc({SvcName, #diameter_service{applications = Apps} = Rec, Opts}, @@ -1457,7 +1457,7 @@ make_prepare_packet(Mask, #diameter_packet{header = Hdr} = Pkt) -> make_prepare_packet(Mask, Msg) -> make_prepare_packet(Mask, #diameter_packet{msg = Msg}). -%% make_prepare_header/1 +%% make_prepare_header/2 make_prepare_header(Mask, undefined) -> Seq = diameter_session:sequence(Mask), @@ -1465,10 +1465,11 @@ make_prepare_header(Mask, undefined) -> hop_by_hop_id = Seq}); make_prepare_header(Mask, #diameter_header{end_to_end_id = undefined, - hop_by_hop_id = undefined}) -> + hop_by_hop_id = undefined} + = H) -> Seq = diameter_session:sequence(Mask), - make_prepare_header(#diameter_header{end_to_end_id = Seq, - hop_by_hop_id = Seq}); + make_prepare_header(H#diameter_header{end_to_end_id = Seq, + hop_by_hop_id = Seq}); make_prepare_header(Mask, #diameter_header{end_to_end_id = undefined} = H) -> Seq = diameter_session:sequence(Mask), @@ -2053,15 +2054,21 @@ request_cb({eval_packet, RC, F}, App, Mask, T, TC, Fs, Pkt) -> request_cb(RC, App, Mask, T, TC, [F|Fs], Pkt); request_cb({eval, RC, F}, App, Mask, T, TC, Fs, Pkt) -> - request_cb(RC, App, Mask, T, TC, Pkt, Fs), + request_cb(RC, App, Mask, T, TC, Fs, Pkt), diameter_lib:eval(F). %% protocol_error/5 protocol_error(RC, {_, OH, OR}, TPid, Fs, Pkt) -> - #diameter_packet{avps = Avps} = Pkt, + #diameter_packet{avps = Avps, errors = Es} = Pkt, ?LOG({error, RC}, Pkt), - reply(answer_message({OH, OR, RC}, Avps), ?BASE, TPid, Fs, Pkt). + reply(answer_message({OH, OR, RC}, Avps), + ?BASE, + TPid, + Fs, + Pkt#diameter_packet{errors = [RC | Es]}). +%% Note that reply/5 may set the result code once more. It's set in +%% answer_message/2 in case reply/5 doesn't. %% protocol_error/4 @@ -2174,7 +2181,8 @@ is_loop(Code, Vid, OH, Avps) -> %% %% Send a locally originating reply. -%% Skip the setting of Result-Code and Failed-AVP's below. +%% Skip the setting of Result-Code and Failed-AVP's below. This is +%% currently undocumented. reply([Msg], Dict, TPid, Fs, Pkt) when is_list(Msg); is_tuple(Msg) -> @@ -2242,6 +2250,9 @@ rc(RC) -> %% rc/4 +rc(#diameter_packet{msg = Rec} = Pkt, RC, Failed, Dict) -> + Pkt#diameter_packet{msg = rc(Rec, RC, Failed, Dict)}; + rc(Rec, RC, Failed, Dict) when is_integer(RC) -> set(Rec, diff --git a/lib/diameter/src/modules.mk b/lib/diameter/src/modules.mk index 01f9284881..25207625be 100644 --- a/lib/diameter/src/modules.mk +++ b/lib/diameter/src/modules.mk @@ -103,3 +103,12 @@ EXAMPLES = \ dict/rfc4072_eap.dia \ dict/rfc4590_digest.dia \ dict/rfc4740_sip.dia + +# Registered server names. + +REGISTERED = \ + diameter_config \ + diameter_peer \ + diameter_reg \ + diameter_stats \ + diameter_sync diff --git a/lib/diameter/test/diameter_event_SUITE.erl b/lib/diameter/test/diameter_event_SUITE.erl new file mode 100644 index 0000000000..7c1c76f22a --- /dev/null +++ b/lib/diameter/test/diameter_event_SUITE.erl @@ -0,0 +1,182 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2013. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%% +%% Tests of events sent as a consequence of diameter:subscribe/1. +%% Watchdog events are dealt with more extensively in the watchdog +%% suite. +%% + +-module(diameter_event_SUITE). + +-export([suite/0, + all/0, + init_per_testcase/2, + end_per_testcase/2]). + +%% testcases +-export([start/1, + start_server/1, + up/1, + down/1, + cea_timeout/1, + stop/1]). + +-include("diameter.hrl"). + +%% =========================================================================== + +-define(util, diameter_util). + +-define(ADDR, {127,0,0,1}). +-define(REALM, "REALM"). + +-define(SERVER, "SERVER.SERVER-REALM"). +-define(CLIENT, "CLIENT.CLIENT-REALM"). + +-define(DICT_COMMON, ?DIAMETER_DICT_COMMON). +-define(DICT_ACCT, ?DIAMETER_DICT_ACCOUNTING). + +-define(SERVER_CAPX_TMO, 6000). + +%% Config for diameter:start_service/2. +-define(SERVICE(Host, Dicts), + [{'Origin-Host', Host}, + {'Origin-Realm', realm(Host)}, + {'Host-IP-Address', [?ADDR]}, + {'Vendor-Id', 12345}, + {'Product-Name', "OTP/diameter"}, + {'Acct-Application-Id', [D:id() || D <- Dicts]} + | [{application, [{dictionary, D}, + {module, #diameter_callback{}}]} + || D <- Dicts]]). + +%% Diameter Result-Code's: +-define(NO_COMMON_APP, 5010). + +%% =========================================================================== + +suite() -> + [{timetrap, {seconds, 60}}]. + +all() -> + [start, + start_server, + up, + down, + cea_timeout, + stop]. + +init_per_testcase(Name, Config) -> + [{name, Name} | Config]. + +end_per_testcase(_, _) -> + ok. + +%% =========================================================================== +%% start/stop testcases + +start(_Config) -> + ok = diameter:start(). + +start_server(Config) -> + diameter:subscribe(?SERVER), + ok = diameter:start_service(?SERVER, ?SERVICE(?SERVER, [?DICT_COMMON])), + LRef = ?util:listen(?SERVER, tcp, [{capabilities_cb, fun capx_cb/2}, + {capx_timeout, ?SERVER_CAPX_TMO}]), + [PortNr] = ?util:lport(tcp, LRef, 20), + ?util:write_priv(Config, portnr, PortNr), + start = event(?SERVER). + +%% Connect with matching capabilities and expect the connection to +%% come up. +up(Config) -> + {Svc, Ref} = connect(Config, []), + start = event(Svc), + {up, Ref, {_,_Caps}, _Config, #diameter_packet{}} = event(Svc), + {watchdog, Ref, _, {initial, okay}, _} = event(Svc). + +%% Connect with non-matching capabilities and expect CEA from the peer +%% to indicate as much and then for the transport to be restarted +%% (after reconnect_timer). +down(Config) -> + {Svc, Ref} = connect(Config, [{capabilities, [{'Acct-Application-Id', + [?DICT_ACCT:id()]}]}, + {applications, [?DICT_ACCT]}, + {reconnect_timer, 5000}]), + start = event(Svc), + {watchdog, Ref, _, {initial, down}, _} = event(Svc), + {closed, Ref, {'CEA', ?NO_COMMON_APP, _, #diameter_packet{}}, _} + = event(Svc), + {reconnect, Ref, _} = event(Svc). + +%% Connect with matching capabilities but have the server delay its +%% CEA and cause the client to timeout. +cea_timeout(Config) -> + {Svc, Ref} = connect(Config, [{capx_timeout, ?SERVER_CAPX_TMO div 2}, + {reconnect_timer, 2*?SERVER_CAPX_TMO}]), + start = event(Svc), + {watchdog, Ref, _, {initial, down}, _} = event(Svc), + {closed, Ref, {'CEA', timeout}, _} = event(Svc). + +stop(_Config) -> + ok = diameter:stop(). + +%% ---------------------------------------- + +%% Keep the server from sending CEA until the client has timed out. +capx_cb(_, #diameter_caps{origin_host = {_, "cea_timeout-" ++ _}}) -> + receive after ?SERVER_CAPX_TMO -> ok end; + +%% Or not. +capx_cb(_, _Caps) -> + ok. + +%% ---------------------------------------- + +%% Use the testcase name to construct Origin-Host of the client so +%% that the server can match on it in capx_cb/2. +connect(Config, Opts) -> + Pre = atom_to_list(proplists:get_value(name, Config)), + Name = Pre ++ uniq() ++ ?CLIENT, + diameter:subscribe(Name), + ok = start_service(Name, ?SERVICE(Name, [?DICT_COMMON, ?DICT_ACCT])), + {ok, Ref} = diameter:add_transport(Name, opts(Config, Opts)), + {Name, Ref}. + +uniq() -> + {MS,S,US} = now(), + lists:flatten(io_lib:format("-~p-~p-~p-", [MS,S,US])). + +event(Name) -> + receive #diameter_event{service = Name, info = T} -> T end. + +start_service(Name, Opts) -> + diameter:start_service(Name, [{monitor, self()} | Opts]). + +opts(Config, Opts) -> + PortNr = ?util:read_priv(Config, portnr), + + {connect, [{transport_module, diameter_tcp}, + {transport_config, [{ip, ?ADDR}, {port, 0}, + {raddr, ?ADDR}, {rport, PortNr}]} + | Opts]}. + +realm(Host) -> + tl(lists:dropwhile(fun(C) -> C /= $. end, Host)). diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index c157b0e304..b03a9ce4d1 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2012. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -38,7 +38,9 @@ result_codes/1, send_ok/1, send_nok/1, + send_eval/1, send_bad_answer/1, + send_protocol_error/1, send_arbitrary/1, send_unknown/1, send_unknown_mandatory/1, @@ -47,6 +49,9 @@ send_unsupported_app/1, send_error_bit/1, send_unsupported_version/1, + send_invalid_avp_bits/1, + send_invalid_avp_length/1, + send_invalid_reject/1, send_long/1, send_nopeer/1, send_noapp/1, @@ -112,17 +117,23 @@ %% Sequence mask for End-to-End and Hop-by-Hop identifiers. -define(CLIENT_MASK, {1,26}). %% 1 in top 6 bits -%% Run tests cases in different encoding variants. Send outgoing -%% messages as lists or records. +%% How to construct messages, as record or list. -define(ENCODINGS, [list, record]). -%% Identifers for client connections. --define(CONNECTIONS, [c1,c2,c3]). +%% How to send answers, in a diameter_packet or not. +-define(CONTAINERS, [pkt, msg]). + +%% Send over multiple connections that are mapped onto +%% [{E,P} || E <- ?ENCODINGS, P <- ?CONTAINERS]. +-define(CONNECTIONS, [c0,c1,c2,c3]). %% Not really what we should be setting unless the message is sent in %% the common application but diameter doesn't care. -define(APP_ID, ?DIAMETER_APP_ID_COMMON). +%% An Application-ID the server doesn't support. +-define(BAD_APP, 42). + %% Config for diameter:start_service/2. -define(SERVICE(Name), [{'Origin-Host', Name ++ "." ++ ?REALM}, @@ -158,6 +169,8 @@ ?'DIAMETER_BASE_RESULT-CODE_DIAMETER_REALM_NOT_SERVED'). -define(UNABLE_TO_DELIVER, ?'DIAMETER_BASE_RESULT-CODE_DIAMETER_UNABLE_TO_DELIVER'). +-define(INVALID_AVP_LENGTH, + ?'DIAMETER_BASE_RESULT-CODE_DIAMETER_INVALID_AVP_LENGTH'). -define(EVENT_RECORD, ?'DIAMETER_BASE_ACCOUNTING-RECORD-TYPE_EVENT_RECORD'). @@ -170,6 +183,8 @@ ?'DIAMETER_BASE_TERMINATION-CAUSE_DIAMETER_LOGOUT'). -define(BAD_ANSWER, ?'DIAMETER_BASE_TERMINATION-CAUSE_DIAMETER_BAD_ANSWER'). +-define(USER_MOVED, + ?'DIAMETER_BASE_TERMINATION-CAUSE_DIAMETER_USER_MOVED'). -define(A, list_to_atom). -define(L, atom_to_list). @@ -183,14 +198,17 @@ suite() -> all() -> [start, start_services, add_transports, result_codes] - ++ [{group, ?util:name([E,C]), P} || E <- ?ENCODINGS, - C <- ?CONNECTIONS, - P <- [[], [parallel]]] + ++ [{group, ?util:name([R,C,A]), P} || R <- ?ENCODINGS, + C <- ?CONTAINERS, + A <- ?ENCODINGS, + P <- [[], [parallel]]] ++ [remove_transports, stop_services, stop]. groups() -> Ts = tc(), - [{?util:name([E,C]), [], Ts} || E <- ?ENCODINGS, C <- ?CONNECTIONS]. + [{?util:name([R,C,A]), [], Ts} || R <- ?ENCODINGS, + C <- ?CONTAINERS, + A <- ?ENCODINGS]. init_per_group(Name, Config) -> [{group, Name} | Config]. @@ -209,7 +227,9 @@ end_per_testcase(_, _) -> tc() -> [send_ok, send_nok, + send_eval, send_bad_answer, + send_protocol_error, send_arbitrary, send_unknown, send_unknown_mandatory, @@ -218,6 +238,9 @@ tc() -> send_unsupported_app, send_error_bit, send_unsupported_version, + send_invalid_avp_bits, + send_invalid_avp_length, + send_invalid_reject, send_long, send_nopeer, send_noapp, @@ -260,7 +283,9 @@ start_services(_Config) -> add_transports(Config) -> LRef = ?util:listen(?SERVER, tcp, [{capabilities_cb, fun capx/2}]), - Cs = [?util:connect(?CLIENT, tcp, LRef, [{id, C}]) || C <- ?CONNECTIONS], + Cs = [?util:connect(?CLIENT, tcp, LRef, [{id, C}, + {capabilities, [osi(C)]}]) + || C <- ?CONNECTIONS], ?util:write_priv(Config, "transport", [LRef | Cs]). remove_transports(Config) -> @@ -278,11 +303,15 @@ capx(_, #diameter_caps{origin_host = {OH,DH}}) -> io:format("connection: ~p -> ~p~n", [DH,OH]), ok. +osi(Id) -> + [$c,N] = atom_to_list(Id), + {'Origin-State-Id', N - $0}. + %% =========================================================================== %% Ensure that result codes have the expected values. result_codes(_Config) -> - {2001, 3001, 3002, 3003, 3004, 3007, 3008, 3009, 5001, 5011} + {2001, 3001, 3002, 3003, 3004, 3007, 3008, 3009, 5001, 5011, 5014} = {?SUCCESS, ?COMMAND_UNSUPPORTED, ?UNABLE_TO_DELIVER, @@ -292,13 +321,14 @@ result_codes(_Config) -> ?INVALID_HDR_BITS, ?INVALID_AVP_BITS, ?AVP_UNSUPPORTED, - ?UNSUPPORTED_VERSION}. + ?UNSUPPORTED_VERSION, + ?INVALID_AVP_LENGTH}. %% Send an ACR and expect success. send_ok(Config) -> Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, {'Accounting-Record-Number', 1}], - + #diameter_base_accounting_ACA{'Result-Code' = ?SUCCESS} = call(Config, Req). @@ -306,10 +336,18 @@ send_ok(Config) -> send_nok(Config) -> Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, {'Accounting-Record-Number', 0}], - + #'diameter_base_answer-message'{'Result-Code' = ?INVALID_AVP_BITS} = call(Config, Req). +%% Send an ACR and expect success. +send_eval(Config) -> + Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, + {'Accounting-Record-Number', 3}], + + #diameter_base_accounting_ACA{'Result-Code' = ?SUCCESS} + = call(Config, Req). + %% Send an accounting ACR that the server tries to answer with an %% inappropriate header, resulting in no answer being sent and the %% request timing out. @@ -318,6 +356,15 @@ send_bad_answer(Config) -> {'Accounting-Record-Number', 2}], {error, timeout} = call(Config, Req). +%% Send an ACR that the server callback answers explicitly with a +%% protocol error. +send_protocol_error(Config) -> + Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, + {'Accounting-Record-Number', 4}], + + #'diameter_base_answer-message'{'Result-Code' = ?TOO_BUSY} + = call(Config, Req). + %% Send an ASR with an arbitrary AVP and expect success and the same %% AVP in the reply. send_arbitrary(Config) -> @@ -385,6 +432,29 @@ send_unsupported_version(Config) -> #diameter_base_STA{'Result-Code' = ?UNSUPPORTED_VERSION} = call(Config, Req). +%% Send a request containing an incorrect AVP length. +send_invalid_avp_bits(Config) -> + Req = ['STR', {'Termination-Cause', ?LOGOUT}], + + #'diameter_base_answer-message'{'Result-Code' = ?INVALID_AVP_BITS} + = call(Config, Req). + +%% Send a request containing an AVP length that doesn't match the +%% AVP's type. +send_invalid_avp_length(Config) -> + Req = ['STR', {'Termination-Cause', ?LOGOUT}], + + #'diameter_base_STA'{'Result-Code' = ?INVALID_AVP_LENGTH} + = call(Config, Req). + +%% Send a request containing 5xxx errors that the server rejects with +%% 3xxx. +send_invalid_reject(Config) -> + Req = ['STR', {'Termination-Cause', ?USER_MOVED}], + + #'diameter_base_answer-message'{'Result-Code' = ?TOO_BUSY} + = call(Config, Req). + %% Send something long that will be fragmented by TCP. send_long(Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}, @@ -559,21 +629,44 @@ call(Config, Req) -> call(Config, Req, Opts) -> Name = proplists:get_value(testcase, Config), - [Encoding, Client] = ?util:name(proplists:get_value(group, Config)), + [Encoding, C, E] = ?util:name(proplists:get_value(group, Config)), diameter:call(?CLIENT, dict(Req), - req(Req, Encoding), - [{extra, [Name, Client]} | Opts]). + msg(Req, Encoding), + [{extra, [Name, client(E,C)]} | Opts]). + +client(E, C) -> + list_to_atom([$c, $0 + 2*codec(E) + container(C)]). + +client(N) -> + {codec(N bsr 1), container(N rem 2)}. -req(['ACR' = H | T], record) -> +codec(record) -> 0; +codec(list) -> 1; +codec(0) -> record; +codec(1) -> list. + +%% Here we're just mapping booleans but the readable atoms are part of +%% (constructed) group names, so it's good that they're readable. + +container(pkt) -> 0; +container(msg) -> 1; +container(0) -> pkt; +container(1) -> msg. + +msg([H|T], record) + when H == 'ACR'; + H == 'ACA' -> ?ACCT:'#new-'(?ACCT:msg2rec(H), T); -req([H|T], record) -> +msg([H|T], record) -> ?BASE:'#new-'(?BASE:msg2rec(H), T); -req(T, _) -> +msg(T, _) -> T. dict(['ACR' | _]) -> ?ACCT; +dict(#diameter_base_accounting_ACR{}) -> + ?ACCT; dict(_) -> ?BASE. @@ -647,6 +740,40 @@ prepare_request(Pkt, ?CLIENT, {_Ref, Caps}, send_detach, _, _) -> log(#diameter_packet{} = P, T) -> io:format("~p: ~p~n", [T,P]). +%% prepare/3 + +prepare(Pkt, Caps, send_invalid_avp_bits) -> + Req = prepare(Pkt, Caps), + %% Last AVP in our STR is Termination-Cause of type Unsigned32: + %% set its length improperly. + #diameter_packet{header = #diameter_header{length = L}, + bin = B} + = E + = diameter_codec:encode(?BASE, Pkt#diameter_packet{msg = Req}), + Offset = L - 7, %% to AVP Length + <<H:Offset/binary, 12:24/integer, T:4/binary>> = B, + E#diameter_packet{bin = <<H/binary, 13:24/integer, T/binary>>}; + +prepare(Pkt, Caps, N) + when N == send_invalid_avp_length; + N == send_invalid_reject -> + Req = prepare(Pkt, Caps), + %% Second last AVP in our STR is Auth-Application-Id of type + %% Unsigned32: Send a value of length 8. + #diameter_packet{header = #diameter_header{length = L}, + bin = B0} + = E + = diameter_codec:encode(?BASE, Pkt#diameter_packet{msg = Req}), + Offset = L - 7 - 12, %% to AVP Length + <<H0:Offset/binary, 12:24/integer, T:16/binary>> = B0, + <<V, L:24/integer, H/binary>> = H0, %% assert + E#diameter_packet{bin = <<V, + (L+4):24/integer, + H/binary, + 16:24/integer, + 0:32/integer, + T/binary>>}; + prepare(Pkt, Caps, send_unsupported) -> Req = prepare(Pkt, Caps), #diameter_packet{bin = <<H:5/binary, _CmdCode:3/binary, T/binary>>} @@ -659,7 +786,7 @@ prepare(Pkt, Caps, send_unsupported_app) -> #diameter_packet{bin = <<H:8/binary, _ApplId:4/binary, T/binary>>} = E = diameter_codec:encode(?BASE, Pkt#diameter_packet{msg = Req}), - E#diameter_packet{bin = <<H/binary, 42:32/integer, T/binary>>}; + E#diameter_packet{bin = <<H/binary, ?BAD_APP:32/integer, T/binary>>}; prepare(Pkt, Caps, send_error_bit) -> #diameter_packet{header = Hdr} = Pkt, @@ -678,6 +805,8 @@ prepare(Pkt, Caps, send_anything) -> prepare(Pkt, Caps, _Name) -> prepare(Pkt, Caps). +%% prepare/2 + prepare(#diameter_packet{msg = Req}, Caps) when is_record(Req, diameter_base_accounting_ACR); 'ACR' == hd(Req) -> @@ -741,9 +870,26 @@ handle_answer(Pkt, Req, ?CLIENT, Peer, Name, _Id) -> handle_answer(Pkt, _Req, ?CLIENT, _Peer, send_detach, _Id, {Pid, Ref}) -> Pid ! {Ref, Pkt}. -answer(#diameter_packet{msg = Rec, errors = []}, _Req, _Peer, _) -> +answer(Pkt, Req, _Peer, Name) -> + #diameter_packet{header = H, msg = Rec, errors = Es} = Pkt, + ApplId = app(Req, Name), + #diameter_header{application_id = ApplId} = H, %% assert + answer(Rec, Es, Name). + +answer(Rec, [_|_], N) + when N == send_invalid_avp_bits; + N == send_invalid_avp_length; + N == send_invalid_reject -> + Rec; +answer(Rec, [], _) -> Rec. +app(_, send_unsupported_app) -> + ?BAD_APP; +app(Req, _) -> + Dict = dict(Req), + Dict:id(). + %% handle_error/6 handle_error(Reason, _Req, ?CLIENT, _Peer, _Name, _Id) -> @@ -761,12 +907,24 @@ handle_request(#diameter_packet{header = H, msg = M}, ?SERVER, {_Ref, Caps}) -> {V,B} = ?CLIENT_MASK, V = EI bsr B, %% assert V = HI bsr B, %% - request(M, Caps). + #diameter_caps{origin_state_id = {_,[N]}} = Caps, + answer(client(N), request(M, Caps)). + +answer(T, {Tag, Action, Post}) -> + {Tag, answer(T, Action), Post}; +answer({E,C}, {reply, Ans}) -> + answer(C, {reply, msg(Ans, E)}); +answer(pkt, {reply, Ans}) -> + {reply, #diameter_packet{msg = Ans}}; +answer(_, T) -> + T. +%% send_nok request(#diameter_base_accounting_ACR{'Accounting-Record-Number' = 0}, _) -> {eval_packet, {protocol_error, ?INVALID_AVP_BITS}, [fun log/2, invalid]}; +%% send_bad_answer request(#diameter_base_accounting_ACR{'Session-Id' = SId, 'Accounting-Record-Type' = RT, 'Accounting-Record-Number' = 2 = RN}, @@ -779,12 +937,27 @@ request(#diameter_base_accounting_ACR{'Session-Id' = SId, {'Accounting-Record-Type', RT}, {'Accounting-Record-Number', RN}], - {reply, #diameter_packet{header = #diameter_header{is_error = true},%% not + {reply, #diameter_packet{header = #diameter_header{is_error = true},%% NOT msg = Ans}}; +%% send_eval +request(#diameter_base_accounting_ACR{'Session-Id' = SId, + 'Accounting-Record-Type' = RT, + 'Accounting-Record-Number' = 3 = RN}, + #diameter_caps{origin_host = {OH, _}, + origin_realm = {OR, _}}) -> + Ans = ['ACA', {'Result-Code', ?SUCCESS}, + {'Session-Id', SId}, + {'Origin-Host', OH}, + {'Origin-Realm', OR}, + {'Accounting-Record-Type', RT}, + {'Accounting-Record-Number', RN}], + {eval, {reply, Ans}, {erlang, now, []}}; + +%% send_ok request(#diameter_base_accounting_ACR{'Session-Id' = SId, 'Accounting-Record-Type' = RT, - 'Accounting-Record-Number' = RN}, + 'Accounting-Record-Number' = 1 = RN}, #diameter_caps{origin_host = {OH, _}, origin_realm = {OR, _}}) -> {reply, ['ACA', {'Result-Code', ?SUCCESS}, @@ -794,26 +967,42 @@ request(#diameter_base_accounting_ACR{'Session-Id' = SId, {'Accounting-Record-Type', RT}, {'Accounting-Record-Number', RN}]}; +%% send_protocol_error +request(#diameter_base_accounting_ACR{'Accounting-Record-Number' = 4}, + #diameter_caps{origin_host = {OH, _}, + origin_realm = {OR, _}}) -> + Ans = ['answer-message', {'Result-Code', ?TOO_BUSY}, + {'Origin-Host', OH}, + {'Origin-Realm', OR}], + {reply, Ans}; + request(#diameter_base_ASR{'Session-Id' = SId, 'AVP' = Avps}, #diameter_caps{origin_host = {OH, _}, origin_realm = {OR, _}}) -> - {reply, #diameter_base_ASA{'Result-Code' = ?SUCCESS, - 'Session-Id' = SId, - 'Origin-Host' = OH, - 'Origin-Realm' = OR, - 'AVP' = Avps}}; + {reply, ['ASA', {'Result-Code', ?SUCCESS}, + {'Session-Id', SId}, + {'Origin-Host', OH}, + {'Origin-Realm', OR}, + {'AVP', Avps}]}; + +%% send_invalid_reject +request(#diameter_base_STR{'Termination-Cause' = ?USER_MOVED}, _Caps) -> + {protocol_error, ?TOO_BUSY}; +%% send_noreply request(#diameter_base_STR{'Termination-Cause' = T}, _Caps) when T /= ?LOGOUT -> discard; +%% send_destination_5 request(#diameter_base_STR{'Destination-Realm'= R}, #diameter_caps{origin_realm = {OR, _}}) when R /= undefined, R /= OR -> {protocol_error, ?REALM_NOT_SERVED}; +%% send_destination_6 request(#diameter_base_STR{'Destination-Host'= [H]}, #diameter_caps{origin_host = {OH, _}}) when H /= OH -> @@ -822,11 +1011,12 @@ request(#diameter_base_STR{'Destination-Host'= [H]}, request(#diameter_base_STR{'Session-Id' = SId}, #diameter_caps{origin_host = {OH, _}, origin_realm = {OR, _}}) -> - {reply, #diameter_base_STA{'Result-Code' = ?SUCCESS, - 'Session-Id' = SId, - 'Origin-Host' = OH, - 'Origin-Realm' = OR}}; + {reply, ['STA', {'Result-Code', ?SUCCESS}, + {'Session-Id', SId}, + {'Origin-Host', OH}, + {'Origin-Realm', OR}]}; +%% send_error request(#diameter_base_RAR{}, _Caps) -> receive after 2000 -> ok end, {protocol_error, ?TOO_BUSY}. diff --git a/lib/diameter/test/modules.mk b/lib/diameter/test/modules.mk index 5898e125ae..80b1769d04 100644 --- a/lib/diameter/test/modules.mk +++ b/lib/diameter/test/modules.mk @@ -40,7 +40,8 @@ MODULES = \ diameter_relay_SUITE \ diameter_tls_SUITE \ diameter_failover_SUITE \ - diameter_dpr_SUITE + diameter_dpr_SUITE \ + diameter_event_SUITE HRL_FILES = \ diameter_ct.hrl diff --git a/lib/diameter/vsn.mk b/lib/diameter/vsn.mk index c9f74ffcec..7b2208137b 100644 --- a/lib/diameter/vsn.mk +++ b/lib/diameter/vsn.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2010-2012. All Rights Reserved. +# Copyright Ericsson AB 2010-2013. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ # %CopyrightEnd% APPLICATION = diameter -DIAMETER_VSN = 1.3 +DIAMETER_VSN = 1.3.1 PRE_VSN = APP_VSN = "$(APPLICATION)-$(DIAMETER_VSN)$(PRE_VSN)" diff --git a/lib/edoc/priv/Makefile b/lib/edoc/priv/Makefile index 73c42c05eb..9873136201 100644 --- a/lib/edoc/priv/Makefile +++ b/lib/edoc/priv/Makefile @@ -27,8 +27,11 @@ GEN_SCRIPT_SRC = edoc_generate.src GEN_SCRIPT = edoc_generate PRIV_FILES = stylesheet.css erlang.png edoc.dtd -debug opt: - sed -e "s/%EDOC_VSN%/$(EDOC_VSN)/g" \ +debug opt: $(GEN_SCRIPT) + +$(GEN_SCRIPT): ../vsn.mk ../../xmerl/vsn.mk ../../syntax_tools/vsn.mk \ + $(GEN_SCRIPT_SRC) + $(vsn_verbose)sed -e "s/%EDOC_VSN%/$(EDOC_VSN)/g" \ -e "s/%XMERL_VSN%/$(XMERL_VSN)/g" \ -e "s/%SYNTAX_TOOLS_VSN%/$(SYNTAX_TOOLS_VSN)/g" \ $(GEN_SCRIPT_SRC) > $(GEN_SCRIPT) diff --git a/lib/edoc/src/Makefile b/lib/edoc/src/Makefile index 72354ac711..4e5a4182da 100644 --- a/lib/edoc/src/Makefile +++ b/lib/edoc/src/Makefile @@ -67,17 +67,17 @@ distclean: clean realclean: clean $(EBIN)/%.$(EMULATOR):%.erl - erlc -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $< # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/eldap/doc/src/eldap.xml b/lib/eldap/doc/src/eldap.xml index 04dad2eee7..bd6f00af1f 100644 --- a/lib/eldap/doc/src/eldap.xml +++ b/lib/eldap/doc/src/eldap.xml @@ -68,7 +68,7 @@ filter() See present/1, substrings/2, <fsummary>Open a connection to an LDAP server.</fsummary> <type> <v>Handle = handle()</v> - <v>Option = {port, integer()} | {log, function()} | {timeout, integer()} | {ssl, boolean()}</v> + <v>Option = {port, integer()} | {log, function()} | {timeout, integer()} | {ssl, boolean()} | {sslopts, list()}</v> </type> <desc> <p>Setup a connection to an LDAP server, the <c>HOST</c>'s are tried in order.</p> diff --git a/lib/eldap/src/Makefile b/lib/eldap/src/Makefile index 46fb805bcc..e7cbb776bd 100644 --- a/lib/eldap/src/Makefile +++ b/lib/eldap/src/Makefile @@ -59,7 +59,7 @@ APP_TARGET = $(EBIN)/$(APP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += -I../include -I../ebin +ERL_COMPILE_FLAGS += -I../include -I../ebin -Werror # ---------------------------------------------------- # Targets @@ -75,10 +75,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ docs: @@ -88,7 +88,7 @@ $(TARGET_FILES): $(HRL_FILES) # Special Build Targets # ---------------------------------------------------- $(ASN1_HRL): ../asn1/$(ASN1_FILES) - $(ERLC) -o $(EBIN) -bber $(ERL_COMPILE_FLAGS) ../asn1/ELDAPv3.asn1 + $(asn_verbose)$(ERLC) -o $(EBIN) -bber $(ERL_COMPILE_FLAGS) ../asn1/ELDAPv3.asn1 # ---------------------------------------------------- # Release Target diff --git a/lib/eldap/src/eldap.erl b/lib/eldap/src/eldap.erl index 5753cc4749..d030408770 100644 --- a/lib/eldap/src/eldap.erl +++ b/lib/eldap/src/eldap.erl @@ -42,7 +42,8 @@ log, % User provided log function timeout = infinity, % Request timeout anon_auth = false, % Allow anonymous authentication - use_tls = false % LDAP/LDAPS + use_tls = false, % LDAP/LDAPS + tls_opts = [] % ssl:ssloptsion() }). %%% For debug purposes @@ -353,6 +354,10 @@ parse_args([{ssl, true}|T], Cpid, Data) -> parse_args(T, Cpid, Data#eldap{use_tls = true}); parse_args([{ssl, _}|T], Cpid, Data) -> parse_args(T, Cpid, Data); +parse_args([{sslopts, Opts}|T], Cpid, Data) when is_list(Opts) -> + parse_args(T, Cpid, Data#eldap{use_tls = true, tls_opts = Opts ++ Data#eldap.tls_opts}); +parse_args([{sslopts, _}|T], Cpid, Data) -> + parse_args(T, Cpid, Data); parse_args([{log, F}|T], Cpid, Data) when is_function(F) -> parse_args(T, Cpid, Data#eldap{log = F}); parse_args([{log, _}|T], Cpid, Data) -> @@ -384,8 +389,8 @@ try_connect([],_) -> do_connect(Host, Data, Opts) when Data#eldap.use_tls == false -> gen_tcp:connect(Host, Data#eldap.port, Opts, Data#eldap.timeout); do_connect(Host, Data, Opts) when Data#eldap.use_tls == true -> - ssl:connect(Host, Data#eldap.port, [{verify,0}|Opts]). - + SslOpts = [{verify,0} | Opts ++ Data#eldap.tls_opts], + ssl:connect(Host, Data#eldap.port, SslOpts). loop(Cpid, Data) -> receive diff --git a/lib/erl_docgen/priv/dtd/common.refs.dtd b/lib/erl_docgen/priv/dtd/common.refs.dtd index c1237766e1..93592607df 100644 --- a/lib/erl_docgen/priv/dtd/common.refs.dtd +++ b/lib/erl_docgen/priv/dtd/common.refs.dtd @@ -26,10 +26,12 @@ <!ELEMENT description (%block;|quote|br|marker|warning|note)* > <!ELEMENT funcs (func)+ > -<!ELEMENT func (name+,type_desc+,fsummary,type?,desc?) > +<!ELEMENT func (name+,type_desc*,fsummary,type?,desc?) > <!-- ELEMENT name is defined in each ref dtd --> <!ELEMENT fsummary (#PCDATA|c|em)* > -<!ELEMENT type (v,d?)+ > +<!ELEMENT type (v,d?)* > +<!ATTLIST type variable CDATA #IMPLIED + name_i CDATA #IMPLIED> <!ELEMENT v (#PCDATA) > <!ELEMENT d (#PCDATA|c|em)* > <!ELEMENT desc (%block;|quote|br|marker|warning|note|anno)* > @@ -41,3 +43,4 @@ <!ELEMENT datatypes (datatype)+ > <!ELEMENT datatype (name+,desc?) > <!ELEMENT type_desc (#PCDATA) > +<!ATTLIST type_desc variable CDATA #REQUIRED> diff --git a/lib/erl_docgen/priv/dtd/erlref.dtd b/lib/erl_docgen/priv/dtd/erlref.dtd index 9905086ff4..0cc5cfa06d 100644 --- a/lib/erl_docgen/priv/dtd/erlref.dtd +++ b/lib/erl_docgen/priv/dtd/erlref.dtd @@ -29,3 +29,6 @@ <!-- `name' is used in common.refs.dtd and must therefore be defined in each *ref. dtd --> <!ELEMENT name (#PCDATA) > +<!ATTLIST name name CDATA #IMPLIED + arity CDATA #IMPLIED + clause_i CDATA #IMPLIED> diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index 7de5af2a49..c846bdbf34 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -1102,11 +1102,13 @@ <xsl:template match="taglist/item"> <xsl:param name="partnum"/> - <fo:block xsl:use-attribute-sets="tagitem"> - <xsl:apply-templates> - <xsl:with-param name="partnum" select="$partnum"/> - </xsl:apply-templates> - </fo:block> + <fo:block-container> + <fo:block xsl:use-attribute-sets="tagitem"> + <xsl:apply-templates> + <xsl:with-param name="partnum" select="$partnum"/> + </xsl:apply-templates> + </fo:block> + </fo:block-container> </xsl:template> diff --git a/lib/erl_docgen/src/Makefile b/lib/erl_docgen/src/Makefile index 6c8b438b25..ef96f5dbf2 100644 --- a/lib/erl_docgen/src/Makefile +++ b/lib/erl_docgen/src/Makefile @@ -78,10 +78,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/erl_docgen/vsn.mk b/lib/erl_docgen/vsn.mk index 2599dc0ff7..a2262198dc 100644 --- a/lib/erl_docgen/vsn.mk +++ b/lib/erl_docgen/vsn.mk @@ -1,2 +1 @@ -ERL_DOCGEN_VSN = 0.3.3 - +ERL_DOCGEN_VSN = 0.3.4 diff --git a/lib/erl_interface/aclocal.m4 b/lib/erl_interface/aclocal.m4 index 9578cd35c4..918e30a886 100644 --- a/lib/erl_interface/aclocal.m4 +++ b/lib/erl_interface/aclocal.m4 @@ -1849,6 +1849,31 @@ case $erl_gethrvtime in esac ])dnl +dnl ---------------------------------------------------------------------- +dnl +dnl LM_TRY_ENABLE_CFLAG +dnl +dnl +dnl Tries a CFLAG and sees if it can be enabled without compiler errors +dnl $1: textual cflag to add +dnl $2: variable to store the modified CFLAG in +dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) +dnl +dnl +AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) + saved_CFLAGS=$CFLAGS; + CFLAGS="$1 $$2"; + AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue"; then + AC_MSG_RESULT([yes]) + AS_VAR_SET($2, "$1 $$2") + else + AC_MSG_RESULT([no]) + fi +]) + dnl ERL_TRY_LINK_JAVA(CLASSES, FUNCTION-BODY dnl [ACTION_IF_FOUND [, ACTION-IF-NOT-FOUND]]) dnl Freely inspired by AC_TRY_LINK. (Maybe better to create a diff --git a/lib/erl_interface/configure.in b/lib/erl_interface/configure.in index 97f1cff345..d511f2e240 100644 --- a/lib/erl_interface/configure.in +++ b/lib/erl_interface/configure.in @@ -273,6 +273,8 @@ esac AC_SUBST(WFLAGS) if test "x$GCC" = xyes; then + # Treat certain GCC warnings as errors + LM_TRY_ENABLE_CFLAG([-Werror=return-type], [WERRORFLAGS]) WFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline" # check which GCC version GCC_VERSION=`$CC -v 2>&1 | sed -n 's/gcc version //p'` @@ -287,8 +289,10 @@ if test "x$GCC" = xyes; then *) WFLAGS="$WFLAGS -fno-strict-aliasing";; esac + CFLAGS="$WERRORFLAGS $CFLAGS" else WFLAGS="" + WERRORFLAGS="" fi # --------------------------------------------------------------------------- diff --git a/lib/erl_interface/doc/src/ei.xml b/lib/erl_interface/doc/src/ei.xml index 539e16d837..117c787da6 100644 --- a/lib/erl_interface/doc/src/ei.xml +++ b/lib/erl_interface/doc/src/ei.xml @@ -82,6 +82,25 @@ function returns the size required (note that for strings an extra byte is needed for the 0 string terminator).</p> </description> + <section> + <title>DATA TYPES</title> + + <taglist> + <tag><marker id="erlang_char_encoding"/>enum erlang_char_encoding</tag> + <item> + <p/> + <code type="none"> +enum erlang_char_encoding { + ERLANG_ASCII, ERLANG_LATIN1, ERLANG_UTF8 +}; +</code> + <p>The character encoding used for atoms. <c>ERLANG_ASCII</c> represents 7-bit ASCII. + Latin1 and UTF8 are different extensions of 7-bit ASCII. All 7-bit ASCII characters + are valid Latin1 and UTF8 characters. ASCII and Latin1 both represent each character + by one byte. A UTF8 character can consist of one to four bytes.</p> + </item> + </taglist> + </section> <funcs> <func> <name><ret>void</ret><nametext>ei_set_compat_rel(release_number)</nametext></name> @@ -225,12 +244,32 @@ <fsummary>Encode an atom</fsummary> <desc> <p>Encodes an atom in the binary format. The <c><![CDATA[p]]></c> parameter - is the name of the atom. Only upto <c><![CDATA[MAXATOMLEN]]></c> bytes + is the name of the atom in latin1 encoding. Only upto <c>MAXATOMLEN-1</c> bytes are encoded. The name should be zero-terminated, except for the <c><![CDATA[ei_x_encode_atom_len()]]></c> function.</p> </desc> </func> <func> + <name><ret>int</ret><nametext>ei_encode_atom_as(char *buf, int *index, const char *p, enum erlang_char_encoding from_enc, enum erlang_char_encoding to_enc)</nametext></name> + <name><ret>int</ret><nametext>ei_encode_atom_len_as(char *buf, int *index, const char *p, int len, enum erlang_char_encoding from_enc, enum erlang_char_encoding to_enc)</nametext></name> + <name><ret>int</ret><nametext>ei_x_encode_atom_as(ei_x_buff* x, const char *p, enum erlang_char_encoding from_enc, enum erlang_char_encoding to_enc)</nametext></name> + <name><ret>int</ret><nametext>ei_x_encode_atom_len_as(ei_x_buff* x, const char *p, int len, enum erlang_char_encoding from_enc, enum erlang_char_encoding to_enc)</nametext></name> + <fsummary>Encode an atom</fsummary> + <desc> + <p>Encodes an atom in the binary format with character encoding + <c><seealso marker="#erlang_char_encoding">to_enc</seealso></c> (latin1 or utf8). + The <c>p</c> parameter is the name of the atom with character encoding + <c><seealso marker="#erlang_char_encoding">from_enc</seealso></c> (ascii, latin1 or utf8). + The name must either be zero-terminated or a function variant with a <c>len</c> + parameter must be used.</p> + <p>The encoding will fail if <c>p</c> is not a valid string in encoding <c>from_enc</c>, + if the string is too long or if it can not be represented with character encoding <c>to_enc</c>.</p> + <p>These functions were introduced in R16 release of Erlang/OTP as part of a first step + to support UTF8 atoms. Atoms encoded with <c>ERLANG_UTF8</c> + can not be decoded by earlier releases than R16.</p> + </desc> + </func> + <func> <name><ret>int</ret><nametext>ei_encode_binary(char *buf, int *index, const void *p, long len)</nametext></name> <name><ret>int</ret><nametext>ei_x_encode_binary(ei_x_buff* x, const void *p, long len)</nametext></name> <fsummary>Encode a binary</fsummary> @@ -490,11 +529,32 @@ ei_x_encode_empty_list(&x); <fsummary>Decode an atom</fsummary> <desc> <p>This function decodes an atom from the binary format. The - name of the atom is placed at <c><![CDATA[p]]></c>. There can be at most + null terminated name of the atom is placed at <c><![CDATA[p]]></c>. There can be at most <c><![CDATA[MAXATOMLEN]]></c> bytes placed in the buffer.</p> </desc> </func> <func> + <name><ret>int</ret><nametext>ei_decode_atom_as(const char *buf, int *index, char *p, int plen, enum erlang_char_encoding want, enum erlang_char_encoding* was, enum erlang_char_encoding* result)</nametext></name> + <fsummary>Decode an atom</fsummary> + <desc> + <p>This function decodes an atom from the binary format. The + null terminated name of the atom is placed in buffer at <c>p</c> of length + <c>plen</c> bytes.</p> + <p>The wanted string encoding is specified by <c><seealso marker="#erlang_char_encoding"> + want</seealso></c>. The original encoding used in the + binary format (latin1 or utf8) can be obtained from <c>*was</c>. The actual encoding of the resulting string + (7-bit ascii, latin1 or utf8) can be obtained from <c>*result</c>. Both <c>was</c> and <c>result</c> can be <c>NULL</c>. + + <c>*result</c> may differ from <c>want</c> if <c>want</c> is a bitwise-or'd combination like + <c>ERLANG_LATIN1|ERLANG_UTF8</c> or if <c>*result</c> turn out to be pure 7-bit ascii + (compatible with both latin1 and utf8).</p> + <p>This function fails if the atom is too long for the buffer + or if it can not be represented with encoding <c>want</c>.</p> + <p>This function was introduced in R16 release of Erlang/OTP as part of a first step + to support UTF8 atoms.</p> + </desc> + </func> + <func> <name><ret>int</ret><nametext>ei_decode_binary(const char *buf, int *index, void *p, long *len)</nametext></name> <fsummary>Decode a binary</fsummary> <desc> diff --git a/lib/erl_interface/doc/src/erl_eterm.xml b/lib/erl_interface/doc/src/erl_eterm.xml index f403618c59..c7840d7813 100644 --- a/lib/erl_interface/doc/src/erl_eterm.xml +++ b/lib/erl_interface/doc/src/erl_eterm.xml @@ -77,10 +77,12 @@ </p> <taglist> <tag><c><![CDATA[char *ERL_ATOM_PTR(t)]]></c></tag> + <tag><c><![CDATA[char *ERL_ATOM_PTR_UTF8(t)]]></c></tag> <item>A string representing atom <c><![CDATA[t]]></c>. </item> <tag><c><![CDATA[int ERL_ATOM_SIZE(t)]]></c></tag> - <item>The length (in characters) of atom t.</item> + <tag><c><![CDATA[int ERL_ATOM_SIZE_UTF8(t)]]></c></tag> + <item>The length (in bytes) of atom t.</item> <tag><c><![CDATA[void *ERL_BIN_PTR(t)]]></c></tag> <item>A pointer to the contents of <c><![CDATA[t]]></c></item> <tag><c><![CDATA[int ERL_BIN_SIZE(t)]]></c></tag> @@ -92,6 +94,7 @@ <tag><c><![CDATA[double ERL_FLOAT_VALUE(t)]]></c></tag> <item>The floating point value of <c><![CDATA[t]]></c>.</item> <tag><c><![CDATA[ETERM *ERL_PID_NODE(t)]]></c></tag> + <tag><c><![CDATA[ETERM *ERL_PID_NODE_UTF8(t)]]></c></tag> <item>The Node in pid <c><![CDATA[t]]></c>.</item> <tag><c><![CDATA[int ERL_PID_NUMBER(t)]]></c></tag> <item>The sequence number in pid <c><![CDATA[t]]></c>.</item> @@ -104,6 +107,7 @@ <tag><c><![CDATA[int ERL_PORT_CREATION(t)]]></c></tag> <item>The creation number in port <c><![CDATA[t]]></c>.</item> <tag><c><![CDATA[ETERM *ERL_PORT_NODE(t)]]></c></tag> + <tag><c><![CDATA[ETERM *ERL_PORT_NODE_UTF8(t)]]></c></tag> <item>The node in port <c><![CDATA[t]]></c>.</item> <tag><c><![CDATA[int ERL_REF_NUMBER(t)]]></c></tag> <item>The first part of the reference number in ref <c><![CDATA[t]]></c>. Use @@ -296,7 +300,7 @@ iohead ::= Binary <name><ret>ETERM *</ret><nametext>erl_mk_atom(string)</nametext></name> <fsummary>Creates an atom</fsummary> <type> - <v>char *string;</v> + <v>const char *string;</v> </type> <desc> <p>Creates an atom.</p> @@ -305,10 +309,12 @@ iohead ::= Binary <p>Returns an Erlang term containing an atom. Note that it is the callers responsibility to make sure that <c><![CDATA[string]]></c> contains a valid name for an atom.</p> - <p><c><![CDATA[ERL_ATOM_PTR(atom)]]></c> can be used to retrieve the - atom name (as a string). Note that the string is not - 0-terminated in the atom. <c><![CDATA[ERL_ATOM_SIZE(atom)]]></c>returns - the length of the atom name.</p> + <p><c><![CDATA[ERL_ATOM_PTR(atom)]]></c> and <c><![CDATA[ERL_ATOM_PTR_UTF8(atom)]]></c> + can be used to retrieve the atom name (as a null terminated string). <c><![CDATA[ERL_ATOM_SIZE(atom)]]></c> + and <c><![CDATA[ERL_ATOM_SIZE_UTF8(atom)]]></c> returns the length of the atom name.</p> + <note><p>Note that the UTF8 variants were introduced in Erlang/OTP releases R16 + and the string returned by <c>ERL_ATOM_PTR(atom)</c> was not null terminated on older releases.</p> + </note> </desc> </func> <func> diff --git a/lib/erl_interface/include/ei.h b/lib/erl_interface/include/ei.h index ae815b414a..2278a28adb 100644 --- a/lib/erl_interface/include/ei.h +++ b/lib/erl_interface/include/ei.h @@ -115,6 +115,9 @@ #define ERL_FLOAT_EXT 'c' #define NEW_FLOAT_EXT 'F' #define ERL_ATOM_EXT 'd' +#define ERL_SMALL_ATOM_EXT 's' +#define ERL_ATOM_UTF8_EXT 'v' +#define ERL_SMALL_ATOM_UTF8_EXT 'w' #define ERL_REFERENCE_EXT 'e' #define ERL_NEW_REFERENCE_EXT 'r' #define ERL_PORT_EXT 'f' @@ -183,12 +186,21 @@ extern volatile int __erl_errno; #define EI_MAXHOSTNAMELEN 64 #define EI_MAXALIVELEN 63 #define EI_MAX_COOKIE_SIZE 512 -#define MAXATOMLEN 255 +#define MAXATOMLEN (255 + 1) +#define MAXATOMLEN_UTF8 (255*4 + 1) #define MAXNODELEN EI_MAXALIVELEN+1+EI_MAXHOSTNAMELEN +enum erlang_char_encoding { + ERLANG_ASCII = 1, + ERLANG_LATIN1 = 2, + ERLANG_UTF8 = 4, + ERLANG_ANY = ERLANG_ASCII|ERLANG_LATIN1|ERLANG_UTF8 +}; + /* a pid */ typedef struct { - char node[MAXATOMLEN+1]; + char node[MAXATOMLEN_UTF8]; + enum erlang_char_encoding node_org_enc; unsigned int num; unsigned int serial; unsigned int creation; @@ -196,14 +208,16 @@ typedef struct { /* a port */ typedef struct { - char node[MAXATOMLEN+1]; + char node[MAXATOMLEN_UTF8]; + enum erlang_char_encoding node_org_enc; unsigned int id; unsigned int creation; } erlang_port; /* a ref */ typedef struct { - char node[MAXATOMLEN+1]; + char node[MAXATOMLEN_UTF8]; + enum erlang_char_encoding node_org_enc; int len; unsigned int n[3]; unsigned int creation; @@ -223,15 +237,16 @@ typedef struct { long msgtype; erlang_pid from; erlang_pid to; - char toname[MAXATOMLEN+1]; - char cookie[MAXATOMLEN+1]; + char toname[MAXATOMLEN_UTF8]; + char cookie[MAXATOMLEN_UTF8]; erlang_trace token; } erlang_msg; /* a fun */ typedef struct { long arity; - char module[MAXATOMLEN+1]; + char module[MAXATOMLEN_UTF8]; + enum erlang_char_encoding module_org_enc; char md5[16]; long index; long old_index; @@ -256,7 +271,7 @@ typedef struct { union { long i_val; double d_val; - char atom_name[MAXATOMLEN+1]; + char atom_name[MAXATOMLEN_UTF8]; erlang_pid pid; erlang_port port; erlang_ref ref; @@ -425,9 +440,17 @@ int ei_encode_string_len(char *buf, int *index, const char *p, int len); int ei_x_encode_string(ei_x_buff* x, const char* s); int ei_x_encode_string_len(ei_x_buff* x, const char* s, int len); int ei_encode_atom(char *buf, int *index, const char *p); +int ei_encode_atom_as(char *buf, int *index, const char *p, + enum erlang_char_encoding from, enum erlang_char_encoding to); int ei_encode_atom_len(char *buf, int *index, const char *p, int len); +int ei_encode_atom_len_as(char *buf, int *index, const char *p, int len, + enum erlang_char_encoding from, enum erlang_char_encoding to); int ei_x_encode_atom(ei_x_buff* x, const char* s); +int ei_x_encode_atom_as(ei_x_buff* x, const char* s, + enum erlang_char_encoding from, enum erlang_char_encoding to); int ei_x_encode_atom_len(ei_x_buff* x, const char* s, int len); +int ei_x_encode_atom_len_as(ei_x_buff* x, const char* s, int len, + enum erlang_char_encoding from, enum erlang_char_encoding to); int ei_encode_binary(char *buf, int *index, const void *p, long len); int ei_x_encode_binary(ei_x_buff* x, const void* s, int len); int ei_encode_pid(char *buf, int *index, const erlang_pid *p); @@ -477,6 +500,7 @@ int ei_decode_boolean(const char *buf, int *index, int *p); int ei_decode_char(const char *buf, int *index, char *p); int ei_decode_string(const char *buf, int *index, char *p); int ei_decode_atom(const char *buf, int *index, char *p); +int ei_decode_atom_as(const char *buf, int *index, char *p, int destlen, enum erlang_char_encoding want, enum erlang_char_encoding* was, enum erlang_char_encoding* result); int ei_decode_binary(const char *buf, int *index, void *p, long *len); int ei_decode_fun(const char* buf, int* index, erlang_fun* p); void free_fun(erlang_fun* f); diff --git a/lib/erl_interface/include/erl_interface.h b/lib/erl_interface/include/erl_interface.h index 1c4a94700d..98acc0d71d 100644 --- a/lib/erl_interface/include/erl_interface.h +++ b/lib/erl_interface/include/erl_interface.h @@ -95,19 +95,24 @@ #define ERL_FLOAT_VALUE(x) ((x)->uval.fval.f) -#define ERL_ATOM_PTR(x) ((x)->uval.aval.a) -#define ERL_ATOM_SIZE(x) ((x)->uval.aval.len) +#define ERL_ATOM_PTR(x) erl_atom_ptr_latin1((Erl_Atom_data*) &(x)->uval.aval.d) +#define ERL_ATOM_PTR_UTF8(x) erl_atom_ptr_utf8((Erl_Atom_data*) &(x)->uval.aval.d) +#define ERL_ATOM_SIZE(x) erl_atom_size_latin1((Erl_Atom_data*) &(x)->uval.aval.d) +#define ERL_ATOM_SIZE_UTF8(x) erl_atom_size_utf8((Erl_Atom_data*) &(x)->uval.aval.d) -#define ERL_PID_NODE(x) ((x)->uval.pidval.node) +#define ERL_PID_NODE(x) erl_atom_ptr_latin1((Erl_Atom_data*) &(x)->uval.pidval.node) +#define ERL_PID_NODE_UTF8(x) erl_atom_ptr_utf8((Erl_Atom_data*) &(x)->uval.pidval.node) #define ERL_PID_NUMBER(x) ((x)->uval.pidval.number) #define ERL_PID_SERIAL(x) ((x)->uval.pidval.serial) #define ERL_PID_CREATION(x) ((x)->uval.pidval.creation) -#define ERL_PORT_NODE(x) ((x)->uval.portval.node) +#define ERL_PORT_NODE(x) erl_atom_ptr_latin1((Erl_Atom_data*) &(x)->uval.portval.node) +#define ERL_PORT_NODE_UTF8(x) erl_atom_ptr_utf8((Erl_Atom_data*) &(x)->uval.portval.node) #define ERL_PORT_NUMBER(x) ((x)->uval.portval.number) #define ERL_PORT_CREATION(x) ((x)->uval.portval.creation) -#define ERL_REF_NODE(x) ((x)->uval.refval.node) +#define ERL_REF_NODE(x) erl_atom_ptr_latin1((Erl_Atom_data*) &(x)->uval.refval.node) +#define ERL_REF_NODE_UTF8(x) erl_atom_ptr_utf8((Erl_Atom_data*) &(x)->uval.refval.node) #define ERL_REF_NUMBER(x) ((x)->uval.refval.n[0]) #define ERL_REF_NUMBERS(x) ((x)->uval.refval.n) #define ERL_REF_LEN(x) ((x)->uval.refval.len) @@ -183,14 +188,26 @@ typedef struct { } Erl_Float; typedef struct { + char *utf8; + int lenU; + char *latin1; + int lenL; +} Erl_Atom_data; + +char* erl_atom_ptr_latin1(Erl_Atom_data*); +char* erl_atom_ptr_utf8(Erl_Atom_data*); +int erl_atom_size_latin1(Erl_Atom_data*); +int erl_atom_size_utf8(Erl_Atom_data*); +char* erl_atom_init_latin1(Erl_Atom_data*, const char*); + +typedef struct { Erl_Header h; - int len; - char *a; + Erl_Atom_data d; } Erl_Atom; typedef struct { Erl_Header h; - char * node; + Erl_Atom_data node; unsigned int number; unsigned int serial; unsigned char creation; @@ -198,14 +215,14 @@ typedef struct { typedef struct { Erl_Header h; - char * node; + Erl_Atom_data node; unsigned int number; unsigned char creation; } Erl_Port; typedef struct { Erl_Header h; - char * node; + Erl_Atom_data node; int len; unsigned int n[3]; unsigned char creation; @@ -289,7 +306,7 @@ typedef struct _eterm { } ETERM; -#define MAXREGLEN 255 /* max length of registered (atom) name */ +#define MAXREGLEN (255*4) /* max length of registered (atom) name */ typedef struct { int type; /* one of the message type constants in eiext.h */ @@ -409,6 +426,7 @@ unsigned char erl_ext_type(unsigned char*); /* Note: returned 'char' before R9C unsigned char *erl_peek_ext(unsigned char*,int); int erl_term_len(ETERM*); +int cmp_latin1_vs_utf8(const char* sL, int lenL, const char* sU, int lenU); /* -------------------------------------------------------------------- */ /* Wrappers around ei functions */ diff --git a/lib/erl_interface/src/Makefile b/lib/erl_interface/src/Makefile index 5f0367bec1..03e2ce14f0 100644 --- a/lib/erl_interface/src/Makefile +++ b/lib/erl_interface/src/Makefile @@ -22,10 +22,11 @@ # FIXME let configure put in this last part TARGET +include $(ERL_TOP)/make/output.mk include $(ERL_TOP)/make/target.mk debug opt shared purify quantify purecov gcov: - $(MAKE) -f $(TARGET)/Makefile TYPE=$@ + $(make_verbose)$(MAKE) -f $(TARGET)/Makefile TYPE=$@ clean depend docs release release_docs tests release_tests check: - $(MAKE) -f $(TARGET)/Makefile $@ + $(make_verbose)$(MAKE) -f $(TARGET)/Makefile $@ diff --git a/lib/erl_interface/src/Makefile.in b/lib/erl_interface/src/Makefile.in index cb41391fe9..ebacc1cee0 100644 --- a/lib/erl_interface/src/Makefile.in +++ b/lib/erl_interface/src/Makefile.in @@ -38,6 +38,8 @@ TARGET = @TARGET@ include ../vsn.mk include $(TARGET)/eidefs.mk +include $(ERL_TOP)/make/output.mk + USING_MINGW=@MIXED_CYGWIN_MINGW@ USING_MSYS_VC==@MIXED_MSYS_VC@ USING_CYGWIN_VC==@MIXED_MSYS_VC@ @@ -98,6 +100,12 @@ LD = @LD@ AR = @AR@ RANLIB = @RANLIB@ +ifeq ($(V),0) +AR_FLAGS=rc +else +AR_FLAGS=rcv +endif + INCFLAGS = -I. -I../include -Iconnect -Iencode -Idecode -Imisc -Iepmd \ -Iregistry -I$(TARGET) @@ -552,16 +560,18 @@ distclean: clean ifeq ($(findstring vxworks,$(TARGET)),vxworks) $(TARGET)/config.h: - echo "/* Generated by Makefile */" > $@ - echo "#define HAVE_STRERROR 1" >> $@ - echo "#define HAVE_SOCKLEN_T 1" >> $@ + $(gen_verbose) + $(V_at)echo "/* Generated by Makefile */" > $@ + $(V_at)echo "#define HAVE_STRERROR 1" >> $@ + $(V_at)echo "#define HAVE_SOCKLEN_T 1" >> $@ endif ifeq ($(findstring ose,$(TARGET)),ose) $(TARGET)/config.h: - echo "/* Generated by Makefile */" > $@ - echo "#define HAVE_STRERROR 1" >> $@ - echo "#define HAVE_SOCKLEN_T 1" >> $@ + $(gen_verbose) + $(V_at)echo "/* Generated by Makefile */" > $@ + $(V_at)echo "#define HAVE_STRERROR 1" >> $@ + $(V_at)echo "#define HAVE_SOCKLEN_T 1" >> $@ endif ########################################################################### @@ -569,19 +579,19 @@ endif ########################################################################### $(ST_OBJDIR)/%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ + $(V_CC) $(CFLAGS) -c $< -o $@ $(MT_OBJDIR)/%.o: %.c - $(CC) $(MTFLAG) $(CFLAGS) $(THR_DEFS) -c $< -o $@ + $(V_CC) $(MTFLAG) $(CFLAGS) $(THR_DEFS) -c $< -o $@ $(MD_OBJDIR)/%.o: %.c - $(CC) -MD $(CFLAGS) $(THR_DEFS) -c $< -o $@ + $(V_CC) -MD $(CFLAGS) $(THR_DEFS) -c $< -o $@ $(MD_OBJDIR)/%.o: %.c - $(CC) -MD $(CFLAGS) $(THR_DEFS) -c $< -o $@ + $(V_CC) -MD $(CFLAGS) $(THR_DEFS) -c $< -o $@ $(MDD_OBJDIR)/%.o: %.c - $(CC) -MDd $(CFLAGS) $(THR_DEFS) -c $< -o $@ + $(V_CC) -MDd $(CFLAGS) $(THR_DEFS) -c $< -o $@ ########################################################################### # Create directories @@ -598,67 +608,67 @@ ifeq ($(TARGET),win32) # Windows archive creation $(ST_EILIB) : $(ST_EIOBJECTS) - $(AR) -out:$@ $(ST_EIOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(ST_EIOBJECTS) + $(V_RANLIB) $@ $(ST_ERLLIB) : $(ST_ERLOBJECTS) - $(AR) -out:$@ $(ST_ERLOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(ST_ERLOBJECTS) + $(V_RANLIB) $@ $(MT_EILIB) : $(MT_EIOBJECTS) - $(AR) -out:$@ $(MT_EIOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MT_EIOBJECTS) + $(V_RANLIB) $@ $(MT_ERLLIB) : $(MT_ERLOBJECTS) - $(AR) -out:$@ $(MT_ERLOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MT_ERLOBJECTS) + $(V_RANLIB) $@ $(MD_EILIB) : $(MD_EIOBJECTS) - $(AR) -out:$@ $(MD_EIOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MD_EIOBJECTS) + $(V_RANLIB) $@ $(MD_ERLLIB) : $(MD_ERLOBJECTS) - $(AR) -out:$@ $(MD_ERLOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MD_ERLOBJECTS) + $(V_RANLIB) $@ $(MDD_EILIB) : $(MDD_EIOBJECTS) - $(AR) -out:$@ $(MDD_EIOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MDD_EIOBJECTS) + $(V_RANLIB) $@ $(MDD_ERLLIB) : $(MDD_ERLOBJECTS) - $(AR) -out:$@ $(MDD_ERLOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MDD_ERLOBJECTS) + $(V_RANLIB) $@ else # Unix archive creation $(ST_EILIB) : $(ST_EIOBJECTS) - rm -f $@ - $(AR) rcv $@ $(ST_EIOBJECTS) + $(V_at)rm -f $@ + $(V_AR) $(AR_FLAGS) $@ $(ST_EIOBJECTS) ifdef RANLIB - $(RANLIB) $@ + $(V_RANLIB) $@ endif $(ST_ERLLIB) : $(ST_ERLOBJECTS) - rm -f $@ - $(AR) rcv $@ $(ST_ERLOBJECTS) + $(V_at)rm -f $@ + $(V_AR) $(AR_FLAGS) $@ $(ST_ERLOBJECTS) ifdef RANLIB - $(RANLIB) $@ + $(V_RANLIB) $@ endif $(MT_EILIB) : $(MT_EIOBJECTS) - rm -f $@ - $(AR) rcv $@ $(MT_EIOBJECTS) + $(V_at)rm -f $@ + $(V_AR) $(AR_FLAGS) $@ $(MT_EIOBJECTS) ifdef RANLIB - $(RANLIB) $@ + $(V_RANLIB) $@ endif $(MT_ERLLIB) : $(MT_ERLOBJECTS) - rm -f $@ - $(AR) rcv $@ $(MT_ERLOBJECTS) + $(V_at)rm -f $@ + $(V_AR) $(AR_FLAGS) $@ $(MT_ERLOBJECTS) ifdef RANLIB - $(RANLIB) $@ + $(V_RANLIB) $@ endif endif @@ -669,18 +679,18 @@ endif ifeq ($(TARGET),win32) $(ERL_CALL): $(ERLCALL) ../include/ei.h $(MD_EILIB) - $(PURIFY) $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $(ERLCALL) \ + $(ld_verbose)$(PURIFY) $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $(ERLCALL) \ -L$(OBJDIR) -lei_md $(THR_LIBS) $(LIBS) -lsocket else ifeq ($(findstring vxworks,$(TARGET)),vxworks) $(ERL_CALL): $(ST_OBJDIR)/erl_call.o $(ST_OBJDIR)/erl_start.o ../include/ei.h $(ST_EILIB) - $(LD) -r -d -o $@ $(ST_OBJDIR)/erl_call.o $(ST_OBJDIR)/erl_start.o -L$(OBJDIR) -lei $(LIBS) + $(V_LD) -r -d -o $@ $(ST_OBJDIR)/erl_call.o $(ST_OBJDIR)/erl_start.o -L$(OBJDIR) -lei $(LIBS) $(ST_OBJDIR)/erl_call.o: prog/erl_call.c - $(CC) $(CFLAGS) -c $< -o $@ + $(V_CC) $(CFLAGS) -c $< -o $@ $(ST_OBJDIR)/erl_start.o: prog/erl_start.c - $(CC) $(CFLAGS) -c $< -o $@ + $(V_CC) $(CFLAGS) -c $< -o $@ else ifeq ($(findstring ose,$(TARGET)),ose) @@ -688,11 +698,11 @@ $(ERL_CALL): else ifdef THR_DEFS $(ERL_CALL): $(ERLCALL) ../include/ei.h $(MT_EILIB) - $(PURIFY) $(CC) $(PROG_CFLAGS) $(THR_DEFS) $(LDFLAGS) -o $@ $(ERLCALL) \ + $(ld_verbose)$(PURIFY) $(CC) $(PROG_CFLAGS) $(THR_DEFS) $(LDFLAGS) -o $@ $(ERLCALL) \ -L$(OBJDIR) -lei $(THR_LIBS) $(LIBS) else $(ERL_CALL): $(ERLCALL) ../include/ei.h $(ST_EILIB) - $(PURIFY) $(CC) $(PROG_CFLAGS) $(LDFLAGS) -o $@ $(ERLCALL) \ + $(ld_verbose)$(PURIFY) $(CC) $(PROG_CFLAGS) $(LDFLAGS) -o $@ $(ERLCALL) \ -L$(OBJDIR) -lei $(LIBS) endif endif @@ -707,36 +717,36 @@ check: $(FAKE_TARGETS) ifndef THR_DEFS $(ST_OBJDIR)/erl_fake_prog_st$(EXE): prog/erl_fake_prog.c $(ST_ERLLIB) $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lerl_interface -lei \ + $(V_CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lerl_interface -lei \ $(LIBS) $(ST_OBJDIR)/ei_fake_prog_st$(EXE): prog/ei_fake_prog.c $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lei $(LIBS) + $(V_CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lei $(LIBS) $(ST_OBJDIR)/erl_fake_prog_cxx_st$(EXE): prog/erl_fake_prog.c \ $(ST_ERLLIB) $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) \ + $(V_CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) \ -lerl_interface -lei $(LIBS) $(ST_OBJDIR)/ei_fake_prog_cxx_st$(EXE): prog/ei_fake_prog.c $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) -lei $(LIBS) + $(V_CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) -lei $(LIBS) else $(ST_OBJDIR)/erl_fake_prog_st$(EXE): prog/erl_fake_prog.c $(ST_ERLLIB) $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lerl_interface_st -lei_st \ + $(V_CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lerl_interface_st -lei_st \ $(LIBS) $(ST_OBJDIR)/ei_fake_prog_st$(EXE): prog/ei_fake_prog.c $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lei_st $(LIBS) + $(V_CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lei_st $(LIBS) $(ST_OBJDIR)/erl_fake_prog_cxx_st$(EXE): prog/erl_fake_prog.c \ $(ST_ERLLIB) $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) \ + $(V_CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) \ -lerl_interface_st -lei_st $(LIBS) $(ST_OBJDIR)/ei_fake_prog_cxx_st$(EXE): prog/ei_fake_prog.c $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) -lei_st $(LIBS) + $(V_CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) -lei_st $(LIBS) endif @@ -744,63 +754,63 @@ endif $(MT_OBJDIR)/erl_fake_prog_mt$(EXE): prog/erl_fake_prog.c \ $(MT_ERLLIB) $(MT_EILIB) - $(CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ + $(V_CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ -lerl_interface -lei $(THR_LIBS) $(LIBS) $(MT_OBJDIR)/ei_fake_prog_mt$(EXE): prog/ei_fake_prog.c $(MT_EILIB) - $(CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ + $(V_CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ -L$(OBJDIR) -lei $(THR_LIBS) $(LIBS) $(MT_OBJDIR)/erl_fake_prog_mt_cxx$(EXE): prog/erl_fake_prog.c \ $(MT_ERLLIB) $(MT_EILIB) - $(CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lerl_interface -lei \ $(THR_LIBS) $(LIBS) $(MT_OBJDIR)/ei_fake_prog_mt_cxx$(EXE): prog/ei_fake_prog.c $(MT_EILIB) - $(CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lei $(THR_LIBS) $(LIBS) #### $(MD_OBJDIR)/erl_fake_prog_md$(EXE): prog/erl_fake_prog.c \ $(MD_ERLLIB) $(MD_EILIB) - $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ + $(V_CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ -lerl_interface_r -lei_r $(THR_LIBS) $(LIBS) $(MD_OBJDIR)/ei_fake_prog_md$(EXE): prog/ei_fake_prog.c $(MD_EILIB) - $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ + $(V_CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ -L$(OBJDIR) -lei_r $(THR_LIBS) $(LIBS) $(MD_OBJDIR)/erl_fake_prog_md_cxx$(EXE): prog/erl_fake_prog.c \ $(MD_ERLLIB) $(MD_EILIB) - $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lerl_interface_r -lei_r \ $(THR_LIBS) $(LIBS) $(MD_OBJDIR)/ei_fake_prog_md_cxx$(EXE): prog/ei_fake_prog.c $(MD_EILIB) - $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lei_r $(THR_LIBS) $(LIBS) #### $(MDD_OBJDIR)/erl_fake_prog_mdd$(EXE): prog/erl_fake_prog.c \ $(MDD_ERLLIB) $(MDD_EILIB) - $(CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ + $(V_CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ -lerl_interface_r -lei_r $(THR_LIBS) $(LIBS) $(MDD_OBJDIR)/ei_fake_prog_mdd$(EXE): prog/ei_fake_prog.c $(MDD_EILIB) - $(CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ + $(V_CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ -L$(OBJDIR) -lei_r $(THR_LIBS) $(LIBS) $(MDD_OBJDIR)/erl_fake_prog_mdd_cxx$(EXE): prog/erl_fake_prog.c \ $(MDD_ERLLIB) $(MDD_EILIB) - $(CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lerl_interface_r -lei_r \ $(THR_LIBS) $(LIBS) $(MDD_OBJDIR)/ei_fake_prog_mdd_cxx$(EXE): prog/ei_fake_prog.c $(MDD_EILIB) - $(CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lei_r $(THR_LIBS) $(LIBS) ########################################################################### @@ -808,9 +818,10 @@ $(MDD_OBJDIR)/ei_fake_prog_mdd_cxx$(EXE): prog/ei_fake_prog.c $(MDD_EILIB) ########################################################################### depend: - @echo "Generating dependency file depend.mk..." + $(gen_verbose) + $(V_colon)@echo "Generating dependency file depend.mk..." @echo "# Generated dependency rules" > depend.mk; \ - $(CC) $(CFLAGS) -MM $(SOURCES) | \ + $(V_CC) $(CFLAGS) -MM $(SOURCES) | \ sed 's&$(TARGET)&\$$\(TARGET\)&g' | \ sed 's/^.*:/\$$\(ST_OBJDIR\)\/&/' >> depend.mk; \ echo >> depend.mk; \ diff --git a/lib/erl_interface/src/connect/ei_connect.c b/lib/erl_interface/src/connect/ei_connect.c index 34362b4b9f..4421bbb7fe 100644 --- a/lib/erl_interface/src/connect/ei_connect.c +++ b/lib/erl_interface/src/connect/ei_connect.c @@ -459,6 +459,7 @@ int ei_connect_xinit(ei_cnode* ec, const char *thishostname, /* memmove(&ec->this_ipaddr, thisipaddr, sizeof(ec->this_ipaddr)); */ strcpy(ec->self.node,thisnodename); + ec->self.node_org_enc = ERLANG_LATIN1; ec->self.num = 0; ec->self.serial = 0; ec->self.creation = creation; @@ -1070,7 +1071,7 @@ int ei_rpc(ei_cnode* ec, int fd, char *mod, char *fun, int i, index; ei_term t; erlang_msg msg; - char rex[MAXATOMLEN+1]; + char rex[MAXATOMLEN]; if (ei_rpc_to(ec, fd, mod, fun, inbuf, inbuflen) < 0) { return -1; @@ -1332,7 +1333,9 @@ static int send_name_or_challenge(int fd, char *nodename, | DFLAG_EXTENDED_PIDS_PORTS | DFLAG_FUN_TAGS | DFLAG_NEW_FUN_TAGS - | DFLAG_NEW_FLOATS)); + | DFLAG_NEW_FLOATS + | DFLAG_SMALL_ATOM_TAGS + | DFLAG_UTF8_ATOMS)); if (f_chall) put32be(s, challenge); memcpy(s, nodename, strlen(nodename)); diff --git a/lib/erl_interface/src/connect/ei_connect_int.h b/lib/erl_interface/src/connect/ei_connect_int.h index 3c42b49b82..81c384e38d 100644 --- a/lib/erl_interface/src/connect/ei_connect_int.h +++ b/lib/erl_interface/src/connect/ei_connect_int.h @@ -102,6 +102,8 @@ extern int h_errno; #define DFLAG_NEW_FUN_TAGS 0x80 #define DFLAG_EXTENDED_PIDS_PORTS 0x100 #define DFLAG_NEW_FLOATS 0x800 +#define DFLAG_SMALL_ATOM_TAGS 0x4000 +#define DFLAG_UTF8_ATOMS 0x10000 ei_cnode *ei_fd_to_cnode(int fd); int ei_distversion(int fd); diff --git a/lib/erl_interface/src/connect/eirecv.c b/lib/erl_interface/src/connect/eirecv.c index 86852f947d..075f78e3d2 100644 --- a/lib/erl_interface/src/connect/eirecv.c +++ b/lib/erl_interface/src/connect/eirecv.c @@ -108,7 +108,7 @@ ei_recv_internal (int fd, switch (msg->msgtype) { case ERL_SEND: /* { SEND, Cookie, ToPid } */ if (ei_tracelevel >= 4) show_this_msg = 1; - if (ei_decode_atom(header,&index,msg->cookie) + if (ei_decode_atom_as(header,&index,msg->cookie,sizeof(msg->cookie),ERLANG_UTF8,NULL,NULL) || ei_decode_pid(header,&index,&msg->to)) { erl_errno = EIO; @@ -120,8 +120,8 @@ ei_recv_internal (int fd, case ERL_REG_SEND: /* { REG_SEND, From, Cookie, ToName } */ if (ei_tracelevel >= 4) show_this_msg = 1; if (ei_decode_pid(header,&index,&msg->from) - || ei_decode_atom(header,&index,msg->cookie) - || ei_decode_atom(header,&index,msg->toname)) + || ei_decode_atom_as(header,&index,msg->cookie,sizeof(msg->cookie),ERLANG_UTF8,NULL,NULL) + || ei_decode_atom_as(header,&index,msg->toname,sizeof(msg->toname),ERLANG_UTF8,NULL,NULL)) { erl_errno = EIO; return -1; @@ -157,7 +157,7 @@ ei_recv_internal (int fd, case ERL_SEND_TT: /* { SEND_TT, Cookie, ToPid, TraceToken } */ if (ei_tracelevel >= 4) show_this_msg = 1; - if (ei_decode_atom(header,&index,msg->cookie) + if (ei_decode_atom_as(header,&index,msg->cookie,sizeof(msg->cookie),ERLANG_UTF8,NULL,NULL) || ei_decode_pid(header,&index,&msg->to) || ei_decode_trace(header,&index,&msg->token)) { @@ -171,8 +171,8 @@ ei_recv_internal (int fd, case ERL_REG_SEND_TT: /* { REG_SEND_TT, From, Cookie, ToName, TraceToken } */ if (ei_tracelevel >= 4) show_this_msg = 1; if (ei_decode_pid(header,&index,&msg->from) - || ei_decode_atom(header,&index,msg->cookie) - || ei_decode_atom(header,&index,msg->toname) + || ei_decode_atom_as(header,&index,msg->cookie,sizeof(msg->cookie),ERLANG_UTF8,NULL,NULL) + || ei_decode_atom_as(header,&index,msg->toname,sizeof(msg->toname),ERLANG_UTF8,NULL,NULL) || ei_decode_trace(header,&index,&msg->token)) { erl_errno = EIO; diff --git a/lib/erl_interface/src/decode/decode_atom.c b/lib/erl_interface/src/decode/decode_atom.c index c2e6a0426e..9779ad3f35 100644 --- a/lib/erl_interface/src/decode/decode_atom.c +++ b/lib/erl_interface/src/decode/decode_atom.c @@ -21,24 +21,155 @@ #include "eiext.h" #include "putget.h" + int ei_decode_atom(const char *buf, int *index, char *p) { - const char *s = buf + *index; - const char *s0 = s; - int len; + return ei_decode_atom_as(buf, index, p, MAXATOMLEN, ERLANG_LATIN1, NULL, NULL); +} + +int ei_decode_atom_as(const char *buf, int *index, char* p, int destlen, + enum erlang_char_encoding want_enc, + enum erlang_char_encoding* was_encp, + enum erlang_char_encoding* res_encp) +{ + const char *s = buf + *index; + const char *s0 = s; + int len; + enum erlang_char_encoding got_enc; + + switch (get8(s)) { + case ERL_ATOM_EXT: + len = get16be(s); + got_enc = ERLANG_LATIN1; + break; + case ERL_SMALL_ATOM_EXT: + len = get8(s); + got_enc = ERLANG_LATIN1; + break; + case ERL_ATOM_UTF8_EXT: + len = get16be(s); + got_enc = ERLANG_UTF8; + break; + case ERL_SMALL_ATOM_UTF8_EXT: + len = get8(s); + got_enc = ERLANG_UTF8; + break; + default: + return -1; + } + + if ((want_enc & got_enc) || want_enc == ERLANG_ASCII) { + int i, found_non_ascii = 0; + if (len >= destlen) + return -1; + for (i=0; i<len; i++) { + if (s[i] & 0x80) found_non_ascii = 1; + if (p) p[i] = s[i]; + } + if (p) p[len] = 0; + if (want_enc == ERLANG_ASCII && found_non_ascii) { + return -1; + } + if (res_encp) { + *res_encp = found_non_ascii ? got_enc : ERLANG_ASCII; + } + } + else { + int plen = (got_enc == ERLANG_LATIN1) ? + latin1_to_utf8(p, s, len, destlen-1, res_encp) : + utf8_to_latin1(p, s, len, destlen-1, res_encp); + if (plen < 0) return -1; + if (p) p[plen] = 0; + } + if (was_encp) { + *was_encp = got_enc; + } + + s += len; + *index += s-s0; + return 0; +} - if (get8(s) != ERL_ATOM_EXT) return -1; - len = get16be(s); +int utf8_to_latin1(char* dst, const char* src, int slen, int destlen, + enum erlang_char_encoding* res_encp) +{ + const char* const dst_start = dst; + const char* const dst_end = dst + destlen; + int found_non_ascii = 0; + + while (slen > 0) { + if (dst >= dst_end) return -1; + if ((src[0] & 0x80) == 0) { + if (dst_start) { + *dst = *src; + } + ++dst; + ++src; + --slen; + } + else if (slen > 1 && + (src[0] & 0xFE) == 0xC2 && + (src[1] & 0xC0) == 0x80) { + if (dst_start) { + *dst = (char) ((src[0] << 6) | (src[1] & 0x3F)); + } + ++dst; + src += 2; + slen -= 2; + found_non_ascii = 1; + } + else return -1; + } + if (res_encp) { + *res_encp = found_non_ascii ? ERLANG_LATIN1 : ERLANG_ASCII; + } + return dst - dst_start; +} - if (len > MAXATOMLEN) return -1; +int latin1_to_utf8(char* dst, const char* src, int slen, int destlen, + enum erlang_char_encoding* res_encp) +{ + const char* const src_end = src + slen; + const char* const dst_start = dst; + const char* const dst_end = dst + destlen; + int found_non_ascii = 0; - if (p) { - memmove(p,s,len); - p[len] = (char)0; - } - s += len; - *index += s-s0; - - return 0; + while (src < src_end) { + if (dst >= dst_end) return -1; + if ((src[0] & 0x80) == 0) { + if (dst_start) { + *dst = *src; + } + ++dst; + } + else { + if (dst_start) { + unsigned char ch = *src; + dst[0] = 0xC0 | (ch >> 6); + dst[1] = 0x80 | (ch & 0x3F); + } + dst += 2; + found_non_ascii = 1; + } + ++src; + } + if (res_encp) { + *res_encp = found_non_ascii ? ERLANG_UTF8 : ERLANG_ASCII; + } + return dst - dst_start; } + + + +int ei_internal_get_atom(const char** bufp, char* p, + enum erlang_char_encoding* was_encp) +{ + int ix = 0; + if (ei_decode_atom_as(*bufp, &ix, p, MAXATOMLEN_UTF8, ERLANG_UTF8, was_encp, NULL) < 0) + return -1; + *bufp += ix; + return 0; +} + + diff --git a/lib/erl_interface/src/decode/decode_boolean.c b/lib/erl_interface/src/decode/decode_boolean.c index 9fd09c63f1..f20690249b 100644 --- a/lib/erl_interface/src/decode/decode_boolean.c +++ b/lib/erl_interface/src/decode/decode_boolean.c @@ -24,34 +24,20 @@ /* c non-zero -> erlang "true" atom, otherwise "false" */ int ei_decode_boolean(const char *buf, int *index, int *p) { - const char *s = buf + *index; - const char *s0 = s; - int len; + char tbuf[6]; int t; - if (get8(s) != ERL_ATOM_EXT) return -1; + if (ei_decode_atom_as(buf, index, tbuf, sizeof(tbuf), ERLANG_ASCII, NULL, NULL) < 0) + return -1; - len = get16be(s); - - switch (len) { - case 4: - /* typecast makes ansi happy */ - if (strncmp((char*)s,"true",4)) return -1; - t = 1; - break; - - case 5: - if (strncmp((char*)s,"false",5)) return -1; - t = 0; - break; - - default: - return -1; - } - - s += len; + if (memcmp(tbuf, "true", 5) == 0) + t = 1; + else if (memcmp(tbuf, "false", 6) == 0) + t = 0; + else + return -1; + if (p) *p = t; - *index += s-s0; - return 0; } + diff --git a/lib/erl_interface/src/decode/decode_fun.c b/lib/erl_interface/src/decode/decode_fun.c index 64fb9e86d8..7bbef5db44 100644 --- a/lib/erl_interface/src/decode/decode_fun.c +++ b/lib/erl_interface/src/decode/decode_fun.c @@ -42,7 +42,8 @@ int ei_decode_fun(const char *buf, int *index, erlang_fun *p) if (ei_decode_pid(s, &ix, (p == NULL ? (erlang_pid*)NULL : &p->pid)) < 0) return -1; /* then the module (atom) */ - if (ei_decode_atom(s, &ix, (p == NULL ? (char*)NULL : p->module)) < 0) + if (ei_decode_atom_as(s, &ix, (p == NULL ? (char*)NULL : p->module), + MAXATOMLEN_UTF8, ERLANG_UTF8, &p->module_org_enc, NULL) < 0) return -1; /* then the index */ if (ei_decode_long(s, &ix, (p == NULL ? (long*)NULL : &p->index)) < 0) @@ -84,7 +85,8 @@ int ei_decode_fun(const char *buf, int *index, erlang_fun *p) if (p != NULL) p->n_free_vars = i; /* then the module (atom) */ ix = 0; - if (ei_decode_atom(s, &ix, (p == NULL ? (char*)NULL : p->module)) < 0) + if (ei_decode_atom_as(s, &ix, (p == NULL ? (char*)NULL : p->module), + MAXATOMLEN_UTF8, ERLANG_UTF8, &p->module_org_enc, NULL) < 0) return -1; /* then the old_index */ if (ei_decode_long(s, &ix, (p == NULL ? (long*)NULL : &p->old_index)) < 0) diff --git a/lib/erl_interface/src/decode/decode_pid.c b/lib/erl_interface/src/decode/decode_pid.c index 9ed1c36db6..e79952195d 100644 --- a/lib/erl_interface/src/decode/decode_pid.c +++ b/lib/erl_interface/src/decode/decode_pid.c @@ -21,26 +21,16 @@ #include "eiext.h" #include "putget.h" + int ei_decode_pid(const char *buf, int *index, erlang_pid *p) { const char *s = buf + *index; const char *s0 = s; - int len; if (get8(s) != ERL_PID_EXT) return -1; /* first the nodename */ - if (get8(s) != ERL_ATOM_EXT) return -1; - - len = get16be(s); - - if (len > MAXATOMLEN) return -1; - - if (p) { - memmove(p->node, s, len); - p->node[len] = (char)0; - } - s += len; + if (get_atom(&s, p->node, &p->node_org_enc) < 0) return -1; /* now the numbers: num (4), serial (4), creation (1) */ if (p) { diff --git a/lib/erl_interface/src/decode/decode_port.c b/lib/erl_interface/src/decode/decode_port.c index 28abed801a..5fd96b51a4 100644 --- a/lib/erl_interface/src/decode/decode_port.c +++ b/lib/erl_interface/src/decode/decode_port.c @@ -25,22 +25,11 @@ int ei_decode_port(const char *buf, int *index, erlang_port *p) { const char *s = buf + *index; const char *s0 = s; - int len; if (get8(s) != ERL_PORT_EXT) return -1; /* first the nodename */ - if (get8(s) != ERL_ATOM_EXT) return -1; - - len = get16be(s); - - if (len > MAXATOMLEN) return -1; - - if (p) { - memmove(p->node, s, len); - p->node[len] = (char)0; - } - s += len; + if (get_atom(&s, p->node, &p->node_org_enc) < 0) return -1; /* now the numbers: num (4), creation (1) */ if (p) { diff --git a/lib/erl_interface/src/decode/decode_ref.c b/lib/erl_interface/src/decode/decode_ref.c index 7b15808bc5..7294e5d239 100644 --- a/lib/erl_interface/src/decode/decode_ref.c +++ b/lib/erl_interface/src/decode/decode_ref.c @@ -21,27 +21,18 @@ #include "eiext.h" #include "putget.h" + int ei_decode_ref(const char *buf, int *index, erlang_ref *p) { const char *s = buf + *index; const char *s0 = s; - int count, len, i; + int count, i; switch (get8(s)) { case ERL_REFERENCE_EXT: - /* first the nodename */ - if (get8(s) != ERL_ATOM_EXT) return -1; - - len = get16be(s); - - if (len > MAXATOMLEN) return -1; - - if (p) { - memmove(p->node, s, len); - p->node[len] = (char)0; - } - s += len; + /* nodename */ + if (get_atom(&s, p->node, &p->node_org_enc) < 0) return -1; /* now the numbers: num (4), creation (1) */ if (p) { @@ -62,15 +53,7 @@ int ei_decode_ref(const char *buf, int *index, erlang_ref *p) if (p) p->len = count; /* then the nodename */ - if (get8(s) != ERL_ATOM_EXT) return -1; - len = get16be(s); - if (len > MAXATOMLEN) return -1; - - if (p) { - memmove(p->node, s, len); - p->node[len] = (char)0; - } - s += len; + if (get_atom(&s, p->node, &p->node_org_enc) < 0) return -1; /* creation */ if (p) { @@ -95,3 +78,4 @@ int ei_decode_ref(const char *buf, int *index, erlang_ref *p) return -1; } } + diff --git a/lib/erl_interface/src/encode/encode_atom.c b/lib/erl_interface/src/encode/encode_atom.c index 6f41f045e0..044f17cb60 100644 --- a/lib/erl_interface/src/encode/encode_atom.c +++ b/lib/erl_interface/src/encode/encode_atom.c @@ -22,29 +22,108 @@ #include "eiext.h" #include "putget.h" + +static int copy_ascii_atom(char* dst, const char* src, int slen); +static int copy_utf8_atom(char* dst, const char* src, int slen); + + int ei_encode_atom(char *buf, int *index, const char *p) { size_t len = strlen(p); - if (len >= INT_MAX) return -1; - return ei_encode_atom_len(buf, index, p, len); + if (len >= MAXATOMLEN) + len = MAXATOMLEN - 1; + return ei_encode_atom_len_as(buf, index, p, len, ERLANG_LATIN1, ERLANG_LATIN1); } int ei_encode_atom_len(char *buf, int *index, const char *p, int len) { + /* This function is documented to truncate at MAXATOMLEN (256) */ + if (len >= MAXATOMLEN) + len = MAXATOMLEN - 1; + return ei_encode_atom_len_as(buf, index, p, len, ERLANG_LATIN1, ERLANG_LATIN1); +} + +int ei_encode_atom_as(char *buf, int *index, const char *p, + enum erlang_char_encoding from_enc, + enum erlang_char_encoding to_enc) +{ + return ei_encode_atom_len_as(buf, index, p, strlen(p), from_enc, to_enc); +} + +int ei_encode_atom_len_as(char *buf, int *index, const char *p, int len, + enum erlang_char_encoding from_enc, + enum erlang_char_encoding to_enc) +{ char *s = buf + *index; char *s0 = s; + int offs; - /* This function is documented to truncate at MAXATOMLEN (256) */ - if (len > MAXATOMLEN) - len = MAXATOMLEN; + if (len >= MAXATOMLEN && (from_enc & (ERLANG_LATIN1|ERLANG_ASCII))) { + return -1; + } - if (!buf) s += 3; - else { - put8(s,ERL_ATOM_EXT); - put16be(s,len); + switch(to_enc) { + case ERLANG_LATIN1: + if (buf) { + put8(s,ERL_ATOM_EXT); + switch (from_enc) { + case ERLANG_UTF8: + len = utf8_to_latin1(s+2, p, len, MAXATOMLEN-1, NULL); + if (len < 0) return -1; + break; + case ERLANG_ASCII: + if (copy_ascii_atom(s+2, p, len) < 0) return -1; + break; + case ERLANG_LATIN1: + memcpy(s+2, p, len); + break; + default: + return -1; + } + put16be(s,len); + } + else { + s += 3; + if (from_enc == ERLANG_UTF8) { + len = utf8_to_latin1(NULL, p, len, MAXATOMLEN-1, NULL); + if (len < 0) return -1; + } + } + break; + + case ERLANG_UTF8: + offs = 1 + 1; + switch (from_enc) { + case ERLANG_LATIN1: + if (len >= 256/2) offs++; + len = latin1_to_utf8((buf ? s+offs : NULL), p, len, MAXATOMLEN_UTF8-1, NULL); + break; + case ERLANG_ASCII: + if (buf && copy_ascii_atom(s+offs, p, len) < 0) return -1; + break; + case ERLANG_UTF8: + if (len >= 256) offs++; + if (buf && copy_utf8_atom(s+offs, p, len) < 0) return -1; + break; + default: + return -1; + } + if (buf) { + if (offs == 2) { + put8(s, ERL_SMALL_ATOM_UTF8_EXT); + put8(s, len); + } + else { + put8(s, ERL_ATOM_UTF8_EXT); + put16be(s, len); + } + } + else s+= offs; + break; - memmove(s,p,len); /* unterminated string */ + default: + return -1; } s += len; @@ -53,3 +132,58 @@ int ei_encode_atom_len(char *buf, int *index, const char *p, int len) return 0; } +int +ei_internal_put_atom(char** bufp, const char* p, int slen, + enum erlang_char_encoding to_enc) +{ + int ix = 0; + if (ei_encode_atom_len_as(*bufp, &ix, p, slen, ERLANG_UTF8, to_enc) < 0) + return -1; + *bufp += ix; + return 0; +} + + +int copy_ascii_atom(char* dst, const char* src, int slen) +{ + while (slen > 0) { + if ((src[0] & 0x80) != 0) return -1; + *dst++ = *src++; + slen--; + } + return 0; +} + +int copy_utf8_atom(char* dst, const char* src, int slen) +{ + int num_chars = 0; + + while (slen > 0) { + if (++num_chars >= MAXATOMLEN) return -1; + if ((src[0] & 0x80) != 0) { + if ((src[0] & 0xE0) == 0xC0) { + if (slen < 2 || (src[1] & 0xC0) != 0x80) return -1; + *dst++ = *src++; + slen--; + } + else if ((src[0] & 0xF0) == 0xE0) { + if (slen < 3 || (src[1] & 0xC0) != 0x80 || (src[2] & 0xC0) != 0x80) return -1; + *dst++ = *src++; + *dst++ = *src++; + slen -= 2; + } + else if ((src[0] & 0xF8) == 0xF0) { + if (slen < 4 || (src[1] & 0xC0) != 0x80 || (src[2] & 0xC0) != 0x80 || (src[3] & 0xC0) != 0x80) return -1; + *dst++ = *src++; + *dst++ = *src++; + *dst++ = *src++; + slen -= 3; + } + else return -1; + } + *dst++ = *src++; + slen--; + } + return 0; +} + diff --git a/lib/erl_interface/src/encode/encode_fun.c b/lib/erl_interface/src/encode/encode_fun.c index 54ee2083d6..4daee32648 100644 --- a/lib/erl_interface/src/encode/encode_fun.c +++ b/lib/erl_interface/src/encode/encode_fun.c @@ -35,7 +35,7 @@ int ei_encode_fun(char *buf, int *index, const erlang_fun *p) ix += sizeof(char) + 4; if (ei_encode_pid(buf, &ix, &p->pid) < 0) return -1; - if (ei_encode_atom(buf, &ix, p->module) < 0) + if (ei_encode_atom_as(buf, &ix, p->module, ERLANG_UTF8, p->module_org_enc) < 0) return -1; if (ei_encode_long(buf, &ix, p->index) < 0) return -1; @@ -60,7 +60,7 @@ int ei_encode_fun(char *buf, int *index, const erlang_fun *p) } else size_p = NULL; ix += 1 + 4 + 1 + sizeof(p->md5) + 4 + 4; - if (ei_encode_atom(buf, &ix, p->module) < 0) + if (ei_encode_atom_as(buf, &ix, p->module, ERLANG_UTF8, p->module_org_enc) < 0) return -1; if (ei_encode_long(buf, &ix, p->old_index) < 0) return -1; diff --git a/lib/erl_interface/src/encode/encode_pid.c b/lib/erl_interface/src/encode/encode_pid.c index ee7f235c17..0cf3ef4efb 100644 --- a/lib/erl_interface/src/encode/encode_pid.c +++ b/lib/erl_interface/src/encode/encode_pid.c @@ -24,29 +24,23 @@ int ei_encode_pid(char *buf, int *index, const erlang_pid *p) { char *s = buf + *index; - char *s0 = s; - int len = strlen(p->node); - - if (!buf) s += 13 + len; - else { - put8(s,ERL_PID_EXT); - /* first the nodename */ - put8(s,ERL_ATOM_EXT); + ++(*index); /* skip ERL_PID_EXT */ + if (ei_encode_atom_len_as(buf, index, p->node, strlen(p->node), ERLANG_UTF8, p->node_org_enc) < 0) + return -1; + + if (buf) { + put8(s,ERL_PID_EXT); - put16be(s,len); - - memmove(s, p->node, len); - s += len; + s = buf + *index; /* now the integers */ put32be(s,p->num & 0x7fff); /* 15 bits */ put32be(s,p->serial & 0x1fff); /* 13 bits */ put8(s,(p->creation & 0x03)); /* 2 bits */ } - - *index += s-s0; - + + *index += 4 + 4 + 1; return 0; } diff --git a/lib/erl_interface/src/encode/encode_port.c b/lib/erl_interface/src/encode/encode_port.c index fbbb33182e..2bf9e26d78 100644 --- a/lib/erl_interface/src/encode/encode_port.c +++ b/lib/erl_interface/src/encode/encode_port.c @@ -24,28 +24,23 @@ int ei_encode_port(char *buf, int *index, const erlang_port *p) { char *s = buf + *index; - char *s0 = s; - int len = strlen(p->node); - - if (!buf) s += 9 + len; - else { - put8(s,ERL_PORT_EXT); - /* first the nodename */ - put8(s,ERL_ATOM_EXT); + ++(*index); /* skip ERL_PORT_EXT */ + if (ei_encode_atom_len_as(buf, index, p->node, strlen(p->node), ERLANG_UTF8, + p->node_org_enc) < 0) { + return -1; + } + if (buf) { + put8(s,ERL_PORT_EXT); - put16be(s,len); - - memmove(s, p->node, len); - s += len; + s = buf + *index; /* now the integers */ put32be(s,p->id & 0x0fffffff /* 28 bits */); put8(s,(p->creation & 0x03)); } - *index += s-s0; - + *index += 4 + 1; return 0; } diff --git a/lib/erl_interface/src/encode/encode_ref.c b/lib/erl_interface/src/encode/encode_ref.c index 292b452864..e8b3173315 100644 --- a/lib/erl_interface/src/encode/encode_ref.c +++ b/lib/erl_interface/src/encode/encode_ref.c @@ -24,36 +24,32 @@ int ei_encode_ref(char *buf, int *index, const erlang_ref *p) { char *s = buf + *index; - char *s0 = s; - int len = strlen(p->node); int i; + (*index) += 1 + 2; /* skip to node atom */ + if (ei_encode_atom_len_as(buf, index, p->node, strlen(p->node), ERLANG_UTF8, + p->node_org_enc) < 0) { + return -1; + } + /* Always encode as an extended reference; all participating parties are now expected to be able to decode extended references. */ - if (!buf) s += 1 + 2 + (3+len) + p->len*4 + 1; - else { + if (buf) { put8(s,ERL_NEW_REFERENCE_EXT); /* first, number of integers */ put16be(s, p->len); /* then the nodename */ - put8(s,ERL_ATOM_EXT); - - put16be(s,len); - - memmove(s, p->node, len); - s += len; + s = buf + *index; /* now the integers */ put8(s,(p->creation & 0x03)); for (i = 0; i < p->len; i++) put32be(s,p->n[i]); - - } - - *index += s-s0; + } + *index += p->len*4 + 1; return 0; } diff --git a/lib/erl_interface/src/legacy/erl_connect.c b/lib/erl_interface/src/legacy/erl_connect.c index 41d4fa3138..f82704ea8b 100644 --- a/lib/erl_interface/src/legacy/erl_connect.c +++ b/lib/erl_interface/src/legacy/erl_connect.c @@ -125,7 +125,7 @@ static ei_cnode erl_if_ec; int erl_connect_init(int this_node_number, char *cookie, short creation) { - char nn[MAXATOMLEN+1]; + char nn[MAXATOMLEN]; sprintf(nn, "c%d", this_node_number); @@ -247,9 +247,15 @@ int erl_send(int fd, ETERM *to ,ETERM *msg) erl_errno = EINVAL; return -1; } - - strncpy(topid.node, (char *)ERL_PID_NODE(to), sizeof(topid.node)); - topid.node[sizeof(topid.node)-1] = '\0'; + + if (to->uval.pidval.node.latin1) { + strcpy(topid.node, to->uval.pidval.node.latin1); + topid.node_org_enc = ERLANG_LATIN1; + } + else { + strcpy(topid.node, to->uval.pidval.node.utf8); + topid.node_org_enc = ERLANG_UTF8; + } topid.num = ERL_PID_NUMBER(to); topid.serial = ERL_PID_SERIAL(to); topid.creation = ERL_PID_CREATION(to); @@ -263,7 +269,7 @@ static int erl_do_receive_msg(int fd, ei_x_buff* x, ErlMessage* emsg) erlang_msg msg; int r; - msg.from.node[0] = msg.to.node[0] = '\0'; + msg.from.node[0] = msg.to.node[0] = msg.toname[0] = '\0'; r = ei_do_receive_msg(fd, 0, &msg, x, 0); if (r == ERL_MSG) { @@ -299,7 +305,7 @@ static int erl_do_receive_msg(int fd, ei_x_buff* x, ErlMessage* emsg) emsg->to = erl_mk_pid(msg.to.node, msg.to.num, msg.to.serial, msg.to.creation); else emsg->to = NULL; - memcpy(emsg->to_name, msg.toname, MAXATOMLEN+1); + strcpy(emsg->to_name, msg.toname); return r; } diff --git a/lib/erl_interface/src/legacy/erl_eterm.c b/lib/erl_interface/src/legacy/erl_eterm.c index 8d559f0f55..aa0fd5ddcf 100644 --- a/lib/erl_interface/src/legacy/erl_eterm.c +++ b/lib/erl_interface/src/legacy/erl_eterm.c @@ -36,6 +36,7 @@ #include "erl_error.h" #include "erl_internal.h" #include "ei_internal.h" +#include "putget.h" #define ERL_IS_BYTE(x) (ERL_IS_INTEGER(x) && (ERL_INT_VALUE(x) & ~0xFF) == 0) @@ -142,9 +143,7 @@ ETERM *erl_mk_atom (const char *s) ep = erl_alloc_eterm(ERL_ATOM); ERL_COUNT(ep) = 1; - ERL_ATOM_SIZE(ep) = strlen(s); - if ((ERL_ATOM_PTR(ep) = strsave(s)) == NULL) - { + if (erl_atom_init_latin1(&ep->uval.aval.d, s) == NULL) { erl_free_term(ep); erl_errno = ENOMEM; return NULL; @@ -152,6 +151,65 @@ ETERM *erl_mk_atom (const char *s) return ep; } +char* erl_atom_ptr_latin1(Erl_Atom_data* a) +{ + if (a->latin1 == NULL) { + enum erlang_char_encoding enc; + a->lenL = utf8_to_latin1(NULL, a->utf8, a->lenU, a->lenU, &enc); + if (a->lenL < 0) { + a->lenL = 0; + return NULL; + } + if (enc == ERLANG_ASCII) { + a->latin1 = a->utf8; + } + else { + a->latin1 = malloc(a->lenL+1); + utf8_to_latin1(a->latin1, a->utf8, a->lenU, a->lenL, NULL); + a->latin1[a->lenL] = '\0'; + } + } + return a->latin1; +} + +char* erl_atom_ptr_utf8(Erl_Atom_data* a) +{ + if (a->utf8 == NULL) { + int dlen = a->lenL * 2; /* over estimation */ + a->utf8 = malloc(dlen + 1); + a->lenU = latin1_to_utf8(a->utf8, a->latin1, a->lenL, dlen, NULL); + a->utf8[a->lenU] = '\0'; + } + return a->utf8; + +} +int erl_atom_size_latin1(Erl_Atom_data* a) +{ + if (a->latin1 == NULL) { + erl_atom_ptr_latin1(a); + } + return a->lenL; +} +int erl_atom_size_utf8(Erl_Atom_data* a) +{ + if (a->utf8 == NULL) { + erl_atom_ptr_utf8(a); + } + return a->lenU; +} +char* erl_atom_init_latin1(Erl_Atom_data* a, const char* s) +{ + a->lenL = strlen(s); + if ((a->latin1 = strsave(s)) == NULL) + { + return NULL; + } + a->utf8 = NULL; + a->lenU = 0; + return a->latin1; +} + + /* * Given a string as input, creates a list. */ @@ -208,12 +266,19 @@ ETERM *erl_mk_pid(const char *node, ep = erl_alloc_eterm(ERL_PID); ERL_COUNT(ep) = 1; - if ((ERL_PID_NODE(ep) = strsave(node)) == NULL) + if (erl_atom_init_latin1(&ep->uval.pidval.node, node) == NULL) { erl_free_term(ep); erl_errno = ENOMEM; return NULL; } + erl_mk_pid_helper(ep, number, serial, creation); + return ep; +} + +void erl_mk_pid_helper(ETERM *ep, unsigned int number, + unsigned int serial, unsigned char creation) +{ ERL_PID_NUMBER(ep) = number & 0x7fff; /* 15 bits */ if (ei_internal_use_r9_pids_ports()) { ERL_PID_SERIAL(ep) = serial & 0x07; /* 3 bits */ @@ -222,7 +287,6 @@ ETERM *erl_mk_pid(const char *node, ERL_PID_SERIAL(ep) = serial & 0x1fff; /* 13 bits */ } ERL_PID_CREATION(ep) = creation & 0x03; /* 2 bits */ - return ep; } /* @@ -239,12 +303,18 @@ ETERM *erl_mk_port(const char *node, ep = erl_alloc_eterm(ERL_PORT); ERL_COUNT(ep) = 1; - if ((ERL_PORT_NODE(ep) = strsave(node)) == NULL) + if (erl_atom_init_latin1(&ep->uval.portval.node, node) == NULL) { erl_free_term(ep); erl_errno = ENOMEM; return NULL; } + erl_mk_port_helper(ep, number, creation); + return ep; +} + +void erl_mk_port_helper(ETERM* ep, unsigned number, unsigned char creation) +{ if (ei_internal_use_r9_pids_ports()) { ERL_PORT_NUMBER(ep) = number & 0x3ffff; /* 18 bits */ } @@ -252,29 +322,29 @@ ETERM *erl_mk_port(const char *node, ERL_PORT_NUMBER(ep) = number & 0x0fffffff; /* 18 bits */ } ERL_PORT_CREATION(ep) = creation & 0x03; /* 2 bits */ - return ep; } /* * Create any kind of reference. */ -ETERM *__erl_mk_reference (const char *node, +ETERM *__erl_mk_reference (ETERM* t, + const char *node, size_t len, unsigned int n[], unsigned char creation) { - ETERM * t; - - if (node == NULL) return NULL; - - t = erl_alloc_eterm(ERL_REF); - ERL_COUNT(t) = 1; - - if ((ERL_REF_NODE(t) = strsave(node)) == NULL) - { - erl_free_term(t); - erl_errno = ENOMEM; - return NULL; + if (t == NULL) { + if (node == NULL) return NULL; + + t = erl_alloc_eterm(ERL_REF); + ERL_COUNT(t) = 1; + + if (erl_atom_init_latin1(&t->uval.refval.node, node) == NULL) + { + erl_free_term(t); + erl_errno = ENOMEM; + return NULL; + } } ERL_REF_LEN(t) = len; ERL_REF_NUMBERS(t)[0] = n[0] & 0x3ffff; /* 18 bits */ @@ -294,7 +364,7 @@ ETERM *erl_mk_ref (const char *node, { unsigned int n[3] = {0, 0, 0}; n[0] = number; - return __erl_mk_reference(node, 1, n, creation); + return __erl_mk_reference(NULL, node, 1, n, creation); } /* @@ -307,7 +377,7 @@ erl_mk_long_ref (const char *node, { unsigned int n[3] = {0, 0, 0}; n[0] = n3; n[1] = n2; n[2] = n1; - return __erl_mk_reference(node, 3, n, creation); + return __erl_mk_reference(NULL, node, 3, n, creation); } /* @@ -758,6 +828,28 @@ int erl_iolist_length (const ETERM* term) return -1; } +static int erl_atom_copy(Erl_Atom_data* dst, const Erl_Atom_data* src) +{ + if (src->latin1 == src->utf8) { + dst->latin1 = dst->utf8 = strsave(src->latin1); + dst->lenL = dst->lenU = strlen(src->latin1); + } + else if (src->latin1) { + dst->latin1 = strsave(src->latin1); + dst->lenL = strlen(src->latin1); + dst->utf8 = NULL; + dst->lenU = 0; + } + else { + dst->utf8 = strsave(src->utf8); + dst->lenU = strlen(src->utf8); + dst->latin1 = NULL; + dst->lenL = 0; + } + return (dst->latin1 != NULL || dst->utf8 == NULL); +} + + /* * Return a brand NEW COPY of an ETERM. */ @@ -796,9 +888,7 @@ ETERM *erl_copy_term(const ETERM *ep) ERL_FLOAT_VALUE(cp) = ERL_FLOAT_VALUE(ep); break; case ERL_ATOM: - ERL_ATOM_SIZE(cp) = ERL_ATOM_SIZE(ep); - ERL_ATOM_PTR(cp) = strsave(ERL_ATOM_PTR(ep)); - if (ERL_ATOM_PTR(cp) == NULL) + if (!erl_atom_copy(&cp->uval.aval.d, &ep->uval.aval.d)) { erl_free_term(cp); erl_errno = ENOMEM; @@ -810,17 +900,17 @@ ETERM *erl_copy_term(const ETERM *ep) name and plug in. Somewhat ugly (also done with port and ref below). */ memcpy(&cp->uval.pidval, &ep->uval.pidval, sizeof(Erl_Pid)); - ERL_PID_NODE(cp) = strsave(ERL_PID_NODE(ep)); + erl_atom_copy(&cp->uval.pidval.node, &ep->uval.pidval.node); ERL_COUNT(cp) = 1; break; case ERL_PORT: memcpy(&cp->uval.portval, &ep->uval.portval, sizeof(Erl_Port)); - ERL_PORT_NODE(cp) = strsave(ERL_PORT_NODE(ep)); + erl_atom_copy(&cp->uval.portval.node, &ep->uval.portval.node); ERL_COUNT(cp) = 1; break; case ERL_REF: memcpy(&cp->uval.refval, &ep->uval.refval, sizeof(Erl_Ref)); - ERL_REF_NODE(cp) = strsave(ERL_REF_NODE(ep)); + erl_atom_copy(&cp->uval.refval.node, &ep->uval.refval.node); ERL_COUNT(cp) = 1; break; case ERL_LIST: @@ -883,29 +973,29 @@ int erl_print_term(FILE *fp, const ETERM *ep) j = i = doquote = 0; switch(ERL_TYPE(ep)) { - case ERL_ATOM: + case ERL_ATOM: { + char* adata = ERL_ATOM_PTR(ep); /* FIXME: what if some weird locale is in use? */ - if (!islower((int)ERL_ATOM_PTR(ep)[0])) + if (!islower(adata[0])) doquote = 1; for (i = 0; !doquote && i < ERL_ATOM_SIZE(ep); i++) { - doquote = !(isalnum((int)ERL_ATOM_PTR(ep)[i]) - || (ERL_ATOM_PTR(ep)[i] == '_')); + doquote = !(isalnum(adata[i]) || (adata[i] == '_')); } if (doquote) { putc('\'', fp); ch_written++; } - fputs(ERL_ATOM_PTR(ep), fp); + fputs(adata, fp); ch_written += ERL_ATOM_SIZE(ep); if (doquote) { putc('\'', fp); ch_written++; } break; - + } case ERL_VARIABLE: if (!isupper((int)ERL_VAR_NAME(ep)[0])) { doquote = 1; diff --git a/lib/erl_interface/src/legacy/erl_eterm.h b/lib/erl_interface/src/legacy/erl_eterm.h index 41b008f04f..2e8129d9cd 100644 --- a/lib/erl_interface/src/legacy/erl_eterm.h +++ b/lib/erl_interface/src/legacy/erl_eterm.h @@ -55,7 +55,9 @@ typedef struct _heapmark { } Erl_HeapMark; -ETERM * __erl_mk_reference(const char *, size_t, unsigned int n[], unsigned char); +void erl_mk_port_helper(ETERM* ep, unsigned number, unsigned char creation); +void erl_mk_pid_helper(ETERM*, unsigned,unsigned, unsigned char); +ETERM * __erl_mk_reference(ETERM*, const char *, size_t, unsigned int n[], unsigned char); int erl_current_fix_desc(void); #endif /* _ERL_ETERM_H */ diff --git a/lib/erl_interface/src/legacy/erl_format.c b/lib/erl_interface/src/legacy/erl_format.c index dc85806c36..533241e396 100644 --- a/lib/erl_interface/src/legacy/erl_format.c +++ b/lib/erl_interface/src/legacy/erl_format.c @@ -574,10 +574,22 @@ static int ematch(ETERM *p, ETERM *t) switch (type_p) { - case ERL_ATOM: - return p->uval.aval.len == t->uval.aval.len && - memcmp(p->uval.aval.a, t->uval.aval.a, p->uval.aval.len) == 0; - + case ERL_ATOM: { + Erl_Atom_data* pa = &p->uval.aval.d; + Erl_Atom_data* ta = &t->uval.aval.d; + if (pa->utf8 && ta->utf8) { + return pa->lenU == ta->lenU && memcmp(pa->utf8, ta->utf8, pa->lenU)==0; + } + else if (pa->latin1 && ta->latin1) { + return pa->lenL == ta->lenL && memcmp(pa->latin1, ta->latin1, pa->lenL)==0; + } + else if (pa->latin1) { + return cmp_latin1_vs_utf8(pa->latin1, pa->lenL, ta->utf8, ta->lenU)==0; + } + else { + return cmp_latin1_vs_utf8(ta->latin1, ta->lenL, pa->utf8, pa->lenU)==0; + } + } case ERL_VARIABLE: if (strcmp(p->uval.vval.name, "_") == 0) /* anon. variable */ return ERL_TRUE; diff --git a/lib/erl_interface/src/legacy/erl_malloc.c b/lib/erl_interface/src/legacy/erl_malloc.c index f51a6c69b3..d09239e02d 100644 --- a/lib/erl_interface/src/legacy/erl_malloc.c +++ b/lib/erl_interface/src/legacy/erl_malloc.c @@ -112,6 +112,18 @@ do { \ (ptr) = NULL; \ } while (0) +static void erl_atom_free(Erl_Atom_data* p) +{ + erl_free(p->latin1); + if (p->utf8 != p->latin1) { + erl_free(p->utf8); + } + p->latin1 = NULL; + p->utf8 = NULL; + p->lenL = 0; + p->lenU = 0; +} + static void _erl_free_term (ETERM *ep, int external, int compound) { restart: @@ -122,7 +134,7 @@ restart: switch(ERL_TYPE(ep)) { case ERL_ATOM: - FREE_AND_CLEAR(ERL_ATOM_PTR(ep)); + erl_atom_free(&ep->uval.aval.d); break; case ERL_VARIABLE: FREE_AND_CLEAR(ERL_VAR_NAME(ep)); @@ -161,13 +173,13 @@ restart: FREE_AND_CLEAR(ERL_BIN_PTR(ep)); break; case ERL_PID: - FREE_AND_CLEAR(ERL_PID_NODE(ep)); + erl_atom_free(&ep->uval.pidval.node); break; case ERL_PORT: - FREE_AND_CLEAR(ERL_PORT_NODE(ep)); + erl_atom_free(&ep->uval.portval.node); break; case ERL_REF: - FREE_AND_CLEAR(ERL_REF_NODE(ep)); + erl_atom_free(&ep->uval.refval.node); break; case ERL_EMPTY_LIST: case ERL_INTEGER: diff --git a/lib/erl_interface/src/legacy/erl_marshal.c b/lib/erl_interface/src/legacy/erl_marshal.c index dad715c762..4c45cebb02 100644 --- a/lib/erl_interface/src/legacy/erl_marshal.c +++ b/lib/erl_interface/src/legacy/erl_marshal.c @@ -44,6 +44,9 @@ int erl_fp_compare(unsigned *a, unsigned *b); static void erl_long_to_fp(long l, unsigned *d); #endif +static int cmpbytes(unsigned char* s1,int l1,unsigned char* s2,int l2); +static int cmpatoms(unsigned char* s1, int l1, unsigned char tag1, unsigned char* s2, int l2, unsigned char tag2); + /* Used when comparing two encoded byte arrays */ /* this global data is ok (from threading point of view) since it is * initialized once and never changed @@ -51,7 +54,13 @@ static void erl_long_to_fp(long l, unsigned *d); #define CMP_ARRAY_SIZE 256 /* FIXME problem for threaded ? */ -static char cmp_array[CMP_ARRAY_SIZE]; + +static enum +{ + ERL_NUM_CMP=1, ERL_ATOM_CMP, ERL_REF_CMP, ERL_FUN_CMP, ERL_PORT_CMP, + ERL_PID_CMP, ERL_TUPLE_CMP, ERL_NIL_CMP, ERL_LIST_CMP, ERL_BIN_CMP +}cmp_array[CMP_ARRAY_SIZE]; + static int init_cmp_array_p=1; /* initialize array, the first time */ #if defined(VXWORKS) && CPU == PPC860 @@ -69,10 +78,8 @@ static int init_cmp_array_p=1; /* initialize array, the first time */ static int cmp_floats(double f1, double f2); static INLINE double to_float(long l); -#define ERL_NUM_CMP 1 -#define ERL_REF_CMP 3 - #define IS_ERL_NUM(t) (cmp_array[t]==ERL_NUM_CMP) +#define IS_ERL_ATOM(t) (cmp_array[t]==ERL_ATOM_CMP) #define CMP_NUM_CLASS_SIZE 256 static unsigned char cmp_num_class[CMP_NUM_CLASS_SIZE]; @@ -100,25 +107,28 @@ void erl_init_marshal(void) { if (init_cmp_array_p) { memset(cmp_array, 0, CMP_ARRAY_SIZE); - cmp_array[ERL_SMALL_INTEGER_EXT] = 1; - cmp_array[ERL_INTEGER_EXT] = 1; - cmp_array[ERL_FLOAT_EXT] = 1; - cmp_array[NEW_FLOAT_EXT] = 1; - cmp_array[ERL_SMALL_BIG_EXT] = 1; - cmp_array[ERL_LARGE_BIG_EXT] = 1; - cmp_array[ERL_ATOM_EXT] = 2; - cmp_array[ERL_REFERENCE_EXT] = 3; - cmp_array[ERL_NEW_REFERENCE_EXT] = 3; - cmp_array[ERL_FUN_EXT] = 4; - cmp_array[ERL_NEW_FUN_EXT] = 4; - cmp_array[ERL_PORT_EXT] = 5; - cmp_array[ERL_PID_EXT] = 6; - cmp_array[ERL_SMALL_TUPLE_EXT] = 7; - cmp_array[ERL_LARGE_TUPLE_EXT] = 7; - cmp_array[ERL_NIL_EXT] = 8; - cmp_array[ERL_STRING_EXT] = 9; - cmp_array[ERL_LIST_EXT] = 9; - cmp_array[ERL_BINARY_EXT] = 10; + cmp_array[ERL_SMALL_INTEGER_EXT] = ERL_NUM_CMP; + cmp_array[ERL_INTEGER_EXT] = ERL_NUM_CMP; + cmp_array[ERL_FLOAT_EXT] = ERL_NUM_CMP; + cmp_array[NEW_FLOAT_EXT] = ERL_NUM_CMP; + cmp_array[ERL_SMALL_BIG_EXT] = ERL_NUM_CMP; + cmp_array[ERL_LARGE_BIG_EXT] = ERL_NUM_CMP; + cmp_array[ERL_ATOM_EXT] = ERL_ATOM_CMP; + cmp_array[ERL_ATOM_UTF8_EXT] = ERL_ATOM_CMP; + cmp_array[ERL_SMALL_ATOM_EXT] = ERL_ATOM_CMP; + cmp_array[ERL_SMALL_ATOM_UTF8_EXT] = ERL_ATOM_CMP; + cmp_array[ERL_REFERENCE_EXT] = ERL_REF_CMP; + cmp_array[ERL_NEW_REFERENCE_EXT] = ERL_REF_CMP; + cmp_array[ERL_FUN_EXT] = ERL_FUN_CMP; + cmp_array[ERL_NEW_FUN_EXT] = ERL_FUN_CMP; + cmp_array[ERL_PORT_EXT] = ERL_PORT_CMP; + cmp_array[ERL_PID_EXT] = ERL_PID_CMP; + cmp_array[ERL_SMALL_TUPLE_EXT] = ERL_TUPLE_CMP; + cmp_array[ERL_LARGE_TUPLE_EXT] = ERL_TUPLE_CMP; + cmp_array[ERL_NIL_EXT] = ERL_NIL_CMP; + cmp_array[ERL_STRING_EXT] = ERL_LIST_CMP; + cmp_array[ERL_LIST_EXT] = ERL_LIST_CMP; + cmp_array[ERL_BINARY_EXT] = ERL_BIN_CMP; init_cmp_array_p = 0; } if (init_cmp_num_class_p) { @@ -156,6 +166,21 @@ static int erl_length_x(const ETERM *ep) { *============================================================== */ +static void encode_atom(Erl_Atom_data* a, unsigned char **ext) +{ + int ix = 0; + if (a->latin1) { + ei_encode_atom_len_as((char*)*ext, &ix, a->latin1, a->lenL, + ERLANG_LATIN1, ERLANG_LATIN1); + } + else if (ei_encode_atom_len_as((char*)*ext, &ix, a->utf8, a->lenU, + ERLANG_UTF8, ERLANG_LATIN1) < 0) { + ei_encode_atom_len_as((char*)*ext, &ix, a->utf8, a->lenU, + ERLANG_UTF8, ERLANG_UTF8); + } + *ext += ix; +} + /* * The actual ENCODE engine. * Returns 0 on success, otherwise 1. @@ -170,12 +195,7 @@ int erl_encode_it(ETERM *ep, unsigned char **ext, int dist) switch(ERL_TYPE(ep)) { case ERL_ATOM: - i = ep->uval.aval.len; - *(*ext)++ = ERL_ATOM_EXT; - *(*ext)++ = (i >>8) &0xff; - *(*ext)++ = i &0xff; - memcpy((void *) *ext, (const void *) ep->uval.aval.a, i); - *ext += i; + encode_atom(&ep->uval.aval.d, ext); return 0; case ERL_INTEGER: @@ -286,12 +306,7 @@ int erl_encode_it(ETERM *ep, unsigned char **ext, int dist) case ERL_PID: *(*ext)++ = ERL_PID_EXT; /* First poke in node as an atom */ - i = strlen((char *)ERL_PID_NODE(ep)); - *(*ext)++ = ERL_ATOM_EXT; - *(*ext)++ = (i >>8) &0xff; - *(*ext)++ = i &0xff; - memcpy(*ext, ERL_PID_NODE(ep), i); - *ext += i; + encode_atom(&ep->uval.pidval.node, ext); /* And then fill in the integer fields */ i = ERL_PID_NUMBER(ep); *(*ext)++ = (i >> 24) &0xff; @@ -319,11 +334,8 @@ int erl_encode_it(ETERM *ep, unsigned char **ext, int dist) *(*ext)++ = (len >> 8) &0xff; *(*ext)++ = len &0xff; - *(*ext)++ = ERL_ATOM_EXT; - *(*ext)++ = (i >> 8) &0xff; - *(*ext)++ = i &0xff; - memcpy(*ext, ERL_REF_NODE(ep), i); - *ext += i; + encode_atom(&ep->uval.refval.node, ext); + *(*ext)++ = ERL_REF_CREATION(ep); /* Then the integer fields */ for (j = 0; j < ERL_REF_LEN(ep); j++) { @@ -338,12 +350,7 @@ int erl_encode_it(ETERM *ep, unsigned char **ext, int dist) case ERL_PORT: *(*ext)++ = ERL_PORT_EXT; /* First poke in node as an atom */ - i = strlen((char *)ERL_PORT_NODE(ep)); - *(*ext)++ = ERL_ATOM_EXT; - *(*ext)++ = (i >>8) &0xff; - *(*ext)++ = i &0xff; - memcpy(*ext, ERL_PORT_NODE(ep), i); - *ext += i; + encode_atom(&ep->uval.portval.node, ext); /* Then the integer fields */ i = ERL_PORT_NUMBER(ep); *(*ext)++ = (i >> 24) &0xff; @@ -494,6 +501,16 @@ int erl_term_len(ETERM *ep) return 1+erl_term_len_helper(ep, 4); } +static int atom_len_helper(Erl_Atom_data* a) +{ + if (erl_atom_ptr_latin1(a)) { + return 1 + 2 + a->lenL; /* ERL_ATOM_EXT */ + } + else { + return 1 + 1 + (a->lenU > 255) + a->lenU; + } +} + static int erl_term_len_helper(ETERM *ep, int dist) { int len = 0; @@ -505,8 +522,7 @@ static int erl_term_len_helper(ETERM *ep, int dist) if (ep) { switch (ERL_TYPE(ep)) { case ERL_ATOM: - i = ep->uval.aval.len; - len = i + 3; + len = atom_len_helper(&ep->uval.aval.d); break; case ERL_INTEGER: @@ -538,20 +554,15 @@ static int erl_term_len_helper(ETERM *ep, int dist) break; case ERL_PID: - /* 1 + N + 4 + 4 + 1 where N = 3 + strlen */ - i = strlen((char *)ERL_PID_NODE(ep)); - len = 13 + i; + len = 1 + atom_len_helper(&ep->uval.pidval.node) + 4 + 4 + 1; break; case ERL_REF: - i = strlen((char *)ERL_REF_NODE(ep)); - len = 1 + 2 + (i+3) + 1 + ERL_REF_LEN(ep) * 4; + len = 1 + 2 + atom_len_helper(&ep->uval.refval.node) + 1 + ERL_REF_LEN(ep) * 4; break; case ERL_PORT: - /* 1 + N + 4 + 1 where N = 3 + strlen */ - i = strlen((char *)ERL_PORT_NODE(ep)); - len = 9 + i; + len = 1 + atom_len_helper(&ep->uval.portval.node) + 4 + 1; break; case ERL_EMPTY_LIST: @@ -644,31 +655,36 @@ int erl_encode_buf(ETERM *ep, unsigned char **ext) } /* erl_encode_buf */ -/* - * A nice macro to make it look cleaner in the - * cases of PID's,PORT's and REF's below. - * It reads the NODE name from a buffer. - */ -#define READ_THE_NODE(ext,cp,len,i) \ -/* eat first atom, repr. the node */ \ -if (**ext != ERL_ATOM_EXT) \ - return (ETERM *) NULL; \ -*ext += 1; \ -i = (**ext << 8) | (*ext)[1]; \ -cp = (char *) *(ext) + 2; \ -*ext += (i + 2); \ -len = i - -#define STATIC_NODE_BUF_SZ 30 - -#define SET_NODE(node,node_buf,cp,len) \ -if (len >= STATIC_NODE_BUF_SZ) node = erl_malloc(len+1); \ -else node = node_buf; \ -memcpy(node, cp, len); \ -node[len] = '\0' - -#define RESET_NODE(node,len) \ -if (len >= STATIC_NODE_BUF_SZ) free(node) + +static int read_atom(unsigned char** ext, Erl_Atom_data* a) +{ + char buf[MAXATOMLEN_UTF8]; + int offs = 0; + enum erlang_char_encoding enc; + int ret = ei_decode_atom_as((char*)*ext, &offs, buf, MAXATOMLEN_UTF8, + ERLANG_LATIN1|ERLANG_UTF8, NULL, &enc); + *ext += offs; + + if (ret == 0) { + int i = strlen(buf); + char* clone = erl_malloc(i+1); + memcpy(clone, buf, i+1); + + a->latin1 = NULL; + a->lenL = 0; + a->utf8 = NULL; + a->lenU = 0; + if (enc & (ERLANG_LATIN1 | ERLANG_ASCII)) { + a->latin1 = clone; + a->lenL = i; + } + if (enc & (ERLANG_UTF8 | ERLANG_ASCII)) { + a->utf8 = clone; + a->lenU = i; + } + } + return ret; +} /* * The actual DECODE engine. @@ -679,13 +695,13 @@ static ETERM *erl_decode_it(unsigned char **ext) char *cp; ETERM *ep,*tp,*np; unsigned int u,sign; - int i,j,len,arity; + int i,j,arity; double ff; /* Assume we are going to decode an integer */ ep = erl_alloc_eterm(ERL_INTEGER); ERL_COUNT(ep) = 1; - + switch (*(*ext)++) { case ERL_INTEGER_EXT: @@ -774,138 +790,90 @@ static ETERM *erl_decode_it(unsigned char **ext) return ep; case ERL_ATOM_EXT: + case ERL_SMALL_ATOM_EXT: + case ERL_ATOM_UTF8_EXT: + case ERL_SMALL_ATOM_UTF8_EXT: + ERL_TYPE(ep) = ERL_ATOM; - i = (**ext << 8) | (*ext)[1]; - cp = (char *) *(ext) + 2; - *ext += (i + 2); - ep->uval.aval.len = i; - ep->uval.aval.a = (char *) erl_malloc(i+1); - memcpy(ep->uval.aval.a, cp, i); - ep->uval.aval.a[i]='\0'; + --(*ext); + if (read_atom(ext, &ep->uval.aval.d) < 0) return NULL; return ep; case ERL_PID_EXT: - erl_free_term(ep); - { /* Why not use the constructors? */ - char *node; - char node_buf[STATIC_NODE_BUF_SZ]; + { unsigned int number, serial; unsigned char creation; - ETERM *eterm_p; - READ_THE_NODE(ext,cp,len,i); - SET_NODE(node,node_buf,cp,len); + ERL_TYPE(ep) = ERL_PID; + if (read_atom(ext, &ep->uval.pidval.node) < 0) return NULL; /* get the integers */ -#if 0 - /* FIXME: Remove code or whatever.... - Ints on the wire are big-endian (== network byte order) - so use ntoh[sl]. (But some are little-endian! Arrrgh!) - Also, the libc authors can be expected to optimize them - heavily. However, the marshalling makes no guarantees - about alignments -- so it won't work at all. */ - number = ntohl(*((unsigned int *)*ext)++); - serial = ntohl(*((unsigned int *)*ext)++); -#else number = ((*ext)[0] << 24) | ((*ext)[1]) << 16 | ((*ext)[2]) << 8 | ((*ext)[3]); *ext += 4; serial = ((*ext)[0] << 24) | ((*ext)[1]) << 16 | ((*ext)[2]) << 8 | ((*ext)[3]); *ext += 4; -#endif creation = *(*ext)++; - eterm_p = erl_mk_pid(node, number, serial, creation); - RESET_NODE(node,len); - return eterm_p; + erl_mk_pid_helper(ep, number, serial, creation); + return ep; } case ERL_REFERENCE_EXT: - erl_free_term(ep); { - char *node; - char node_buf[STATIC_NODE_BUF_SZ]; - unsigned int number; + unsigned int n[3] = {0, 0, 0}; unsigned char creation; - ETERM *eterm_p; - READ_THE_NODE(ext,cp,len,i); - SET_NODE(node,node_buf,cp,len); + ERL_TYPE(ep) = ERL_REF; + if (read_atom(ext, &ep->uval.refval.node) < 0) return NULL; /* get the integers */ -#if 0 - number = ntohl(*((unsigned int *)*ext)++); -#else - number = ((*ext)[0] << 24) | ((*ext)[1]) << 16 | + n[0] = ((*ext)[0] << 24) | ((*ext)[1]) << 16 | ((*ext)[2]) << 8 | ((*ext)[3]); *ext += 4; -#endif creation = *(*ext)++; - eterm_p = erl_mk_ref(node, number, creation); - RESET_NODE(node,len); - return eterm_p; + __erl_mk_reference(ep, NULL, 1, n, creation); + return ep; } case ERL_NEW_REFERENCE_EXT: - erl_free_term(ep); { - char *node; - char node_buf[STATIC_NODE_BUF_SZ]; size_t cnt, i; unsigned int n[3]; unsigned char creation; - ETERM *eterm_p; -#if 0 - cnt = ntohs(*((unsigned short *)*ext)++); -#else + ERL_TYPE(ep) = ERL_REF; cnt = ((*ext)[0] << 8) | (*ext)[1]; *ext += 2; -#endif - READ_THE_NODE(ext,cp,len,i); - SET_NODE(node,node_buf,cp,len); + if (read_atom(ext, &ep->uval.refval.node) < 0) return NULL; /* get the integers */ creation = *(*ext)++; for(i = 0; i < cnt; i++) { -#if 0 - n[i] = ntohl(*((unsigned int *)*ext)++); -#else n[i] = ((*ext)[0] << 24) | ((*ext)[1]) << 16 | ((*ext)[2]) << 8 | ((*ext)[3]); *ext += 4; -#endif } - eterm_p = __erl_mk_reference(node, cnt, n, creation); - RESET_NODE(node,len); - return eterm_p; + __erl_mk_reference(ep, NULL, cnt, n, creation); + return ep; } case ERL_PORT_EXT: - erl_free_term(ep); { - char *node; - char node_buf[STATIC_NODE_BUF_SZ]; unsigned int number; unsigned char creation; - ETERM *eterm_p; - READ_THE_NODE(ext,cp,len,i); - SET_NODE(node,node_buf,cp,len); + ERL_TYPE(ep) = ERL_PORT; + if (read_atom(ext, &ep->uval.portval.node) < 0) return NULL; /* get the integers */ -#if 0 - number = ntohl(*((unsigned int *)*ext)++); -#else number = ((*ext)[0] << 24) | ((*ext)[1]) << 16 | ((*ext)[2]) << 8 | ((*ext)[3]); *ext += 4; -#endif creation = *(*ext)++; - eterm_p = erl_mk_port(node, number, creation); - RESET_NODE(node,len); - return eterm_p; + erl_mk_port_helper(ep, number, creation); + return ep; } case ERL_NIL_EXT: @@ -1140,6 +1108,9 @@ unsigned char erl_ext_type(unsigned char *ext) case ERL_INTEGER_EXT: return ERL_INTEGER; case ERL_ATOM_EXT: + case ERL_ATOM_UTF8_EXT: + case ERL_SMALL_ATOM_EXT: + case ERL_SMALL_ATOM_UTF8_EXT: return ERL_ATOM; case ERL_PID_EXT: return ERL_PID; @@ -1191,6 +1162,9 @@ int erl_ext_size(unsigned char *t) case ERL_SMALL_INTEGER_EXT: case ERL_INTEGER_EXT: case ERL_ATOM_EXT: + case ERL_ATOM_UTF8_EXT: + case ERL_SMALL_ATOM_EXT: + case ERL_SMALL_ATOM_UTF8_EXT: case ERL_PID_EXT: case ERL_PORT_EXT: case ERL_REFERENCE_EXT: @@ -1229,15 +1203,32 @@ int erl_ext_size(unsigned char *t) } /* ext_size */ -/* - * A nice macro that eats up the atom pointed to. - */ -#define JUMP_ATOM(ext,i) \ -if (**ext != ERL_ATOM_EXT) \ - return 0; \ -*ext += 1; \ -i = (**ext << 8) | (*ext)[1]; \ -*ext += (i + 2) + +static int jump_atom(unsigned char** ext) +{ + unsigned char* e = *ext; + int len; + + switch (*e++) { + case ERL_ATOM_EXT: + case ERL_ATOM_UTF8_EXT: + len = (e[0] << 8) | e[1]; + e += (len + 2); + break; + + case ERL_SMALL_ATOM_EXT: + case ERL_SMALL_ATOM_UTF8_EXT: + len = e[0]; + e += (len + 1); + break; + + default: + return 0; + } + *ext = e; + return 1; +} + /* * MOVE the POINTER PAST the ENCODED ETERM we @@ -1259,25 +1250,27 @@ static int jump(unsigned char **ext) *ext += 1; break; case ERL_ATOM_EXT: - i = (**ext << 8) | (*ext)[1]; - *ext += (i + 2); + case ERL_ATOM_UTF8_EXT: + case ERL_SMALL_ATOM_EXT: + case ERL_SMALL_ATOM_UTF8_EXT: + jump_atom(ext); break; case ERL_PID_EXT: /* eat first atom */ - JUMP_ATOM(ext,i); + if (!jump_atom(ext)) return 0; *ext += 9; /* Two int's and the creation field */ break; case ERL_REFERENCE_EXT: case ERL_PORT_EXT: /* first field is an atom */ - JUMP_ATOM(ext,i); + if (!jump_atom(ext)) return 0; *ext += 5; /* One int and the creation field */ break; case ERL_NEW_REFERENCE_EXT: n = (**ext << 8) | (*ext)[1]; *ext += 2; /* first field is an atom */ - JUMP_ATOM(ext,i); + if (!jump_atom(ext)) return 0; *ext += 4*n+1; break; case ERL_NIL_EXT: @@ -1425,6 +1418,58 @@ static int cmpbytes(unsigned char* s1,int l1,unsigned char* s2,int l2) } /* cmpbytes */ +#define tag2enc(T) ((T)==ERL_ATOM_EXT || (T)==ERL_SMALL_ATOM_EXT ? ERLANG_LATIN1 : ERLANG_UTF8) + +static int cmpatoms(unsigned char* s1, int l1, unsigned char tag1, + unsigned char* s2, int l2, unsigned char tag2) +{ + enum erlang_char_encoding enc1 = tag2enc(tag1); + enum erlang_char_encoding enc2 = tag2enc(tag2); + + if (enc1 == enc2) { + return cmpbytes(s1, l1,s2,l2); + } + + if (enc1 == ERLANG_LATIN1) { + return cmp_latin1_vs_utf8((char*)s1, l1, (char*)s2, l2); + } + else { + return -cmp_latin1_vs_utf8((char*)s2, l2, (char*)s1, l1); + } +} + +int cmp_latin1_vs_utf8(const char* strL, int lenL, const char* strU, int lenU) +{ + unsigned char* sL = (unsigned char*)strL; + unsigned char* sU = (unsigned char*)strU; + unsigned char* sL_end = sL + lenL; + unsigned char* sU_end = sU + lenU; + + while(sL < sL_end && sU < sU_end) { + unsigned char UasL; + if (*sL >= 0x80) { + if (*sU < 0xC4 && (sU+1) < sU_end) { + UasL = ((sU[0] & 0x3) << 6) | (sU[1] & 0x3F); + } + else return -1; + } + else { + UasL = *sU; + } + if (*sL < UasL) return -1; + if (*sL > UasL) return 1; + + sL++; + if (*sU < 0x80) sU++; + else if (*sU < 0xE0) sU += 2; + else if (*sU < 0xF0) sU += 3; + else /*if (*sU < 0xF8)*/ sU += 4; + } + + return (sU >= sU_end) - (sL >= sL_end); /* -1, 0 or 1 */ +} + + #define CMP_EXT_ERROR_CODE 4711 #define CMP_EXT_INT32_BE(AP, BP) \ @@ -1437,9 +1482,8 @@ do { \ #define CMP_EXT_SKIP_ATOM(EP) \ do { \ - if ((EP)[0] != ERL_ATOM_EXT) \ + if (!jump_atom(&(EP))) \ return CMP_EXT_ERROR_CODE; \ - (EP) += 3 + ((EP)[1] << 8 | (EP)[2]); \ } while (0) /* @@ -1561,6 +1605,7 @@ static int cmp_exe2(unsigned char **e1, unsigned char **e2) int min, ret,i,j,k; double ff1, ff2; unsigned char *tmp1, *tmp2; + unsigned char tag1, tag2; if ( ((*e1)[0] == ERL_STRING_EXT) && ((*e2)[0] == ERL_LIST_EXT) ) { return cmp_string_list(e1, e2); @@ -1568,8 +1613,10 @@ static int cmp_exe2(unsigned char **e1, unsigned char **e2) return -cmp_string_list(e2, e1); } - *e2 += 1; - switch (*(*e1)++) + tag1 = *(*e1)++; + tag2 = *(*e2)++; + i = j = 0; + switch (tag1) { case ERL_SMALL_INTEGER_EXT: if (**e1 < **e2) ret = -1; @@ -1589,11 +1636,17 @@ static int cmp_exe2(unsigned char **e1, unsigned char **e2) *e1 += 4; *e2 += 4; return ret; case ERL_ATOM_EXT: - i = (**e1 << 8) | (*e1)[1]; - j = (**e2 << 8) | (*e2)[1]; - ret = cmpbytes(*e1 +2, i, *e2 +2, j); - *e1 += (i + 2); - *e2 += (j + 2); + case ERL_ATOM_UTF8_EXT: + i = (**e1) << 8; (*e1)++; + j = (**e2) << 8; (*e2)++; + /*fall through*/ + case ERL_SMALL_ATOM_EXT: + case ERL_SMALL_ATOM_UTF8_EXT: + i |= (**e1); (*e1)++; + j |= (**e2); (*e2)++; + ret = cmpatoms(*e1, i, tag1, *e2, j, tag2); + *e1 += i; + *e2 += j; return ret; case ERL_PID_EXT: { unsigned char *n1 = *e1; @@ -1622,7 +1675,7 @@ static int cmp_exe2(unsigned char **e1, unsigned char **e2) } case ERL_PORT_EXT: /* First compare node names ... */ - if (**e1 != ERL_ATOM_EXT || **e2 != ERL_ATOM_EXT) + if (!IS_ERL_ATOM(**e1) || !IS_ERL_ATOM(**e2)) return CMP_EXT_ERROR_CODE; ret = cmp_exe2(e1, e2); *e1 += 5; *e2 += 5; diff --git a/lib/erl_interface/src/legacy/global_whereis.c b/lib/erl_interface/src/legacy/global_whereis.c index 2afb193504..e6c556d907 100644 --- a/lib/erl_interface/src/legacy/global_whereis.c +++ b/lib/erl_interface/src/legacy/global_whereis.c @@ -85,7 +85,16 @@ ETERM *erl_global_whereis(int fd, const char *name, char *node) opid = erl_decode((unsigned char*)buf); /* extract the nodename for the caller */ - if (node) strcpy(node,epid.node); + if (node) { + char* node_str = ERL_PID_NODE(opid); + if (node_str) { + strcpy(node, node_str); + } + else { + erl_free_term(opid); + return NULL; + } + } return opid; } diff --git a/lib/erl_interface/src/misc/ei_decode_term.c b/lib/erl_interface/src/misc/ei_decode_term.c index 0b82ef0e35..65afee89cc 100644 --- a/lib/erl_interface/src/misc/ei_decode_term.c +++ b/lib/erl_interface/src/misc/ei_decode_term.c @@ -32,7 +32,7 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) { const char* s = buf + *index, * s0 = s; - int len, i, n, sign; + int i, n, sign; char c; if (term == NULL) return -1; @@ -48,20 +48,13 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) case NEW_FLOAT_EXT: return ei_decode_double(buf, index, &term->value.d_val); case ERL_ATOM_EXT: - len = get16be(s); - if (len > MAXATOMLEN) return -1; - memcpy(term->value.atom_name, s, len); - term->value.atom_name[len] = '\0'; - s += len; - break; + case ERL_ATOM_UTF8_EXT: + case ERL_SMALL_ATOM_EXT: + case ERL_SMALL_ATOM_UTF8_EXT: + return ei_decode_atom(buf, index, term->value.atom_name); case ERL_REFERENCE_EXT: /* first the nodename */ - if (get8(s) != ERL_ATOM_EXT) return -1; - len = get16be(s); - if (len > MAXATOMLEN) return -1; - memcpy(term->value.ref.node, s, len); - term->value.ref.node[len] = '\0'; - s += len; + if (get_atom(&s, term->value.ref.node, &term->value.ref.node_org_enc) < 0) return -1; /* now the numbers: num (4), creation (1) */ term->value.ref.n[0] = get32be(s); term->value.ref.len = 1; @@ -71,12 +64,7 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) /* first the integer count */ term->value.ref.len = get16be(s); /* then the nodename */ - if (get8(s) != ERL_ATOM_EXT) return -1; - len = get16be(s); - if (len > MAXATOMLEN) return -1; - memcpy(term->value.ref.node, s, len); - term->value.ref.node[len] = '\0'; - s += len; + if (get_atom(&s, term->value.ref.node, &term->value.ref.node_org_enc) < 0) return -1; /* creation */ term->value.ref.creation = get8(s) & 0x03; /* finally the id integers */ @@ -88,22 +76,12 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) } break; case ERL_PORT_EXT: - if (get8(s) != ERL_ATOM_EXT) return -1; - len = get16be(s); - if (len > MAXATOMLEN) return -1; - memcpy(term->value.port.node, s, len); - term->value.port.node[len] = '\0'; + if (get_atom(&s, term->value.port.node, &term->value.port.node_org_enc) < 0) return -1; term->value.port.id = get32be(s) & 0x0fffffff; /* 28 bits */; term->value.port.creation = get8(s) & 0x03; break; case ERL_PID_EXT: - if (get8(s) != ERL_ATOM_EXT) return -1; - /* name first */ - len = get16be(s); - if (len > MAXATOMLEN) return -1; - memcpy(term->value.pid.node, s, len); - term->value.pid.node[len] = '\0'; - s += len; + if (get_atom(&s, term->value.pid.node, &term->value.port.node_org_enc) < 0) return -1; /* now the numbers: num (4), serial (4), creation (1) */ term->value.pid.num = get32be(s) & 0x7fff; /* 15 bits */ term->value.pid.serial = get32be(s) & 0x1fff; /* 13 bits */ diff --git a/lib/erl_interface/src/misc/ei_format.c b/lib/erl_interface/src/misc/ei_format.c index 281a192535..b5f11e618e 100644 --- a/lib/erl_interface/src/misc/ei_format.c +++ b/lib/erl_interface/src/misc/ei_format.c @@ -139,8 +139,8 @@ static int patom(const char** fmt, ei_x_buff* x) --(*fmt); len = *fmt - start; /* FIXME why truncate atom name and not fail?! */ - if (len > MAXATOMLEN) - len = MAXATOMLEN; + if (len >= MAXATOMLEN) + len = MAXATOMLEN-1; return ei_x_encode_atom_len(x, start, len); } diff --git a/lib/erl_interface/src/misc/ei_printterm.c b/lib/erl_interface/src/misc/ei_printterm.c index 5fc6b3542c..f3003a6172 100644 --- a/lib/erl_interface/src/misc/ei_printterm.c +++ b/lib/erl_interface/src/misc/ei_printterm.c @@ -115,7 +115,7 @@ static int print_term(FILE* fp, ei_x_buff* x, const char* buf, int* index) { int i, doquote, n, m, ty, r; - char a[MAXATOMLEN+1], *p; + char a[MAXATOMLEN], *p; int ch_written = 0; /* counter of written chars */ erlang_pid pid; erlang_port port; @@ -132,7 +132,10 @@ static int print_term(FILE* fp, ei_x_buff* x, doquote = 0; ei_get_type_internal(buf, index, &ty, &n); switch (ty) { - case ERL_ATOM_EXT: + case ERL_ATOM_EXT: + case ERL_ATOM_UTF8_EXT: + case ERL_SMALL_ATOM_EXT: + case ERL_SMALL_ATOM_UTF8_EXT: if (ei_decode_atom(buf, index, a) < 0) goto err; doquote = !islower((int)a[0]); diff --git a/lib/erl_interface/src/misc/ei_x_encode.c b/lib/erl_interface/src/misc/ei_x_encode.c index fa1e26ccbb..44dcff7664 100644 --- a/lib/erl_interface/src/misc/ei_x_encode.c +++ b/lib/erl_interface/src/misc/ei_x_encode.c @@ -197,18 +197,33 @@ int ei_x_encode_tuple_header(ei_x_buff* x, long n) int ei_x_encode_atom(ei_x_buff* x, const char* s) { - return ei_x_encode_atom_len(x, s, strlen(s)); + return ei_x_encode_atom_len_as(x, s, strlen(s), ERLANG_LATIN1, ERLANG_LATIN1); } int ei_x_encode_atom_len(ei_x_buff* x, const char* s, int len) { + return ei_x_encode_atom_len_as(x, s, len, ERLANG_LATIN1, ERLANG_LATIN1); +} + +int ei_x_encode_atom_as(ei_x_buff* x, const char* s, + enum erlang_char_encoding from_enc, + enum erlang_char_encoding to_enc) +{ + return ei_x_encode_atom_len_as(x, s, strlen(s), from_enc, to_enc); +} + +int ei_x_encode_atom_len_as(ei_x_buff* x, const char* s, int len, + enum erlang_char_encoding from_enc, + enum erlang_char_encoding to_enc) +{ int i = x->index; - ei_encode_atom_len(NULL, &i, s, len); + ei_encode_atom_len_as(NULL, &i, s, len, from_enc, to_enc); if (!x_fix_buff(x, i)) return -1; - return ei_encode_atom_len(x->buff, &x->index, s, len); + return ei_encode_atom_len_as(x->buff, &x->index, s, len, from_enc, to_enc); } + int ei_x_encode_pid(ei_x_buff* x, const erlang_pid* pid) { int i = x->index; diff --git a/lib/erl_interface/src/misc/get_type.c b/lib/erl_interface/src/misc/get_type.c index 2a680d0f94..54465196b0 100644 --- a/lib/erl_interface/src/misc/get_type.c +++ b/lib/erl_interface/src/misc/get_type.c @@ -33,78 +33,6 @@ int ei_get_type(const char *buf, const int *index, int *type, int *len) return ei_get_type_internal(buf, index, type, len); } -#if 0 -int ei_get_type(const char *buf, const int *index, int *type, int *len) -{ - const char *s = buf + *index; - int itype = get8(s); /* Internal type */ - - *len = 0; - - switch (*type) { - - case ERL_SMALL_INTEGER_EXT: - case ERL_INTEGER_EXT: - case ERL_SMALL_BIG_EXT: - case ERL_LARGE_BIG_EXT: - *type = EI_TYPE_INTEGER; - break; - - case ERL_FLOAT_EXT: - *type = EI_TYPE_FLOAT; - break; - - case ERL_SMALL_TUPLE_EXT: - *len = get8(s); - break; - - case ERL_ATOM_EXT: - case ERL_STRING_EXT: - *len = get16be(s); - break; - - case ERL_LARGE_TUPLE_EXT: - case ERL_LIST_EXT: - case ERL_BINARY_EXT: - *len = get32be(s); - break; - - case ERL_SMALL_BIG_EXT: - *len = (get8(s)+1)/2; /* big arity */ - break; - - case ERL_LARGE_BIG_EXT: - *len = (get32be(s)+1)/2; /* big arity */ - break; - - case ERL_BINARY_EXT: - *type = EI_TYPE_BINARY; - break; - - case ERL_PID_EXT: - *type = EI_TYPE_PID; - break; - - case ERL_PORT_EXT: - *type = EI_TYPE_PORT; - break; - - case ERL_REFERENCE_EXT: - case ERL_NEW_REFERENCE_EXT: - *type = EI_TYPE_REF; - break; - - default: - break; - } - - /* leave index unchanged */ - return 0; -} -#endif - - -/* Old definition of function above */ int ei_get_type_internal(const char *buf, const int *index, int *type, int *len) @@ -114,10 +42,15 @@ int ei_get_type_internal(const char *buf, const int *index, *type = get8(s); switch (*type) { + case ERL_SMALL_ATOM_EXT: + case ERL_SMALL_ATOM_UTF8_EXT: + *type = ERL_ATOM_EXT; case ERL_SMALL_TUPLE_EXT: *len = get8(s); break; - + + case ERL_ATOM_UTF8_EXT: + *type = ERL_ATOM_EXT; case ERL_ATOM_EXT: case ERL_STRING_EXT: *len = get16be(s); diff --git a/lib/erl_interface/src/misc/putget.h b/lib/erl_interface/src/misc/putget.h index 7a43de324b..77ae168f8c 100644 --- a/lib/erl_interface/src/misc/putget.h +++ b/lib/erl_interface/src/misc/putget.h @@ -105,6 +105,13 @@ ((EI_ULONGLONG)((unsigned char *)(s))[-2] << 8) | \ (EI_ULONGLONG)((unsigned char *)(s))[-1])) +int utf8_to_latin1(char* dst, const char* src, int slen, int destlen, enum erlang_char_encoding* res_encp); +int latin1_to_utf8(char* dst, const char* src, int slen, int destlen, enum erlang_char_encoding* res_encp); +int ei_internal_get_atom(const char** bufp, char* p, enum erlang_char_encoding*); +int ei_internal_put_atom(char** bufp, const char* p, int slen, enum erlang_char_encoding); +#define get_atom ei_internal_get_atom +#define put_atom ei_internal_put_atom + typedef union float_ext { double d; EI_ULONGLONG val; diff --git a/lib/erl_interface/src/misc/show_msg.c b/lib/erl_interface/src/misc/show_msg.c index 194296798b..33b09643ca 100644 --- a/lib/erl_interface/src/misc/show_msg.c +++ b/lib/erl_interface/src/misc/show_msg.c @@ -132,13 +132,13 @@ int ei_show_sendmsg(FILE *stream, const char *header, const char *msgbuf) switch (msg.msgtype) { case ERL_SEND: - if (ei_decode_atom(header,&index,msg.cookie) + if (ei_decode_atom_as(header,&index,msg.cookie,sizeof(msg.cookie),ERLANG_UTF8,NULL,NULL) || ei_decode_pid(header,&index,&msg.to)) return -1; mbuf = msgbuf; break; case ERL_SEND_TT: - if (ei_decode_atom(header,&index,msg.cookie) + if (ei_decode_atom_as(header,&index,msg.cookie,sizeof(msg.cookie),ERLANG_UTF8,NULL,NULL) || ei_decode_pid(header,&index,&msg.to) || ei_decode_trace(header,&index,&msg.token)) return -1; mbuf = msgbuf; @@ -146,15 +146,15 @@ int ei_show_sendmsg(FILE *stream, const char *header, const char *msgbuf) case ERL_REG_SEND: if (ei_decode_pid(header,&index,&msg.from) - || ei_decode_atom(header,&index,msg.cookie) - || ei_decode_atom(header,&index,msg.toname)) return -1; + || ei_decode_atom_as(header,&index,msg.cookie,sizeof(msg.cookie),ERLANG_UTF8,NULL,NULL) + || ei_decode_atom_as(header,&index,msg.toname,sizeof(msg.toname),ERLANG_UTF8,NULL,NULL)) return -1; mbuf = msgbuf; break; case ERL_REG_SEND_TT: if (ei_decode_pid(header,&index,&msg.from) - || ei_decode_atom(header,&index,msg.cookie) - || ei_decode_atom(header,&index,msg.toname) + || ei_decode_atom_as(header,&index,msg.cookie,sizeof(msg.cookie),ERLANG_UTF8,NULL,NULL) + || ei_decode_atom_as(header,&index,msg.toname,sizeof(msg.toname),ERLANG_UTF8,NULL,NULL) || ei_decode_trace(header,&index,&msg.token)) return -1; mbuf = msgbuf; break; @@ -457,7 +457,7 @@ static void show_term(const char *termbuf, int *index, FILE *stream) break; case ERL_FUN_EXT: { - char atom[MAXATOMLEN+1]; + char atom[MAXATOMLEN]; long idx; long uniq; const char* s = termbuf + *index, * s0 = s; diff --git a/lib/erl_interface/src/prog/ei_fake_prog.c b/lib/erl_interface/src/prog/ei_fake_prog.c index 68eb537211..34101a2851 100644 --- a/lib/erl_interface/src/prog/ei_fake_prog.c +++ b/lib/erl_interface/src/prog/ei_fake_prog.c @@ -96,6 +96,7 @@ int main(void) EI_ULONGLONG *ulonglongp = (EI_ULONGLONG*)NULL; EI_ULONGLONG ulonglongx = 0; #endif + enum erlang_char_encoding enc; intx = erl_errno; @@ -148,9 +149,13 @@ int main(void) ei_x_encode_string(&eix, charp); ei_x_encode_string_len(&eix, charp, intx); ei_encode_atom(charp, intp, charp); + ei_encode_atom_as(charp, intp, charp, ERLANG_LATIN1, ERLANG_UTF8); ei_encode_atom_len(charp, intp, charp, intx); + ei_encode_atom_len_as(charp, intp, charp, intx, ERLANG_ASCII, ERLANG_LATIN1); ei_x_encode_atom(&eix, charp); + ei_x_encode_atom_as(&eix, charp, ERLANG_LATIN1, ERLANG_UTF8); ei_x_encode_atom_len(&eix, charp, intx); + ei_x_encode_atom_len_as(&eix, charp, intx, ERLANG_LATIN1, ERLANG_UTF8); ei_encode_binary(charp, intp, (void *)0, longx); ei_x_encode_binary(&eix, (void*)0, intx); ei_encode_pid(charp, intp, &epid); @@ -181,6 +186,7 @@ int main(void) ei_decode_char(charp, intp, charp); ei_decode_string(charp, intp, charp); ei_decode_atom(charp, intp, charp); + ei_decode_atom_as(charp, intp, charp, MAXATOMLEN_UTF8, ERLANG_WHATEVER, &enc, &enc); ei_decode_binary(charp, intp, (void *)0, longp); ei_decode_fun(charp, intp, &efun); free_fun(&efun); diff --git a/lib/erl_interface/test/ei_decode_encode_SUITE.erl b/lib/erl_interface/test/ei_decode_encode_SUITE.erl index 85cb62239b..0c98b494ec 100644 --- a/lib/erl_interface/test/ei_decode_encode_SUITE.erl +++ b/lib/erl_interface/test/ei_decode_encode_SUITE.erl @@ -118,6 +118,13 @@ test_ei_decode_encode(Config) when is_list(Config) -> ?line send_rec(P, OXPort), ?line send_rec(P, OXRef), + %% Unicode atoms + [begin send_rec(P, Atom), + send_rec(P, mk_pid({Atom,1}, 23434, 3434)), + send_rec(P, mk_port({Atom,1}, 2343434)), + send_rec(P, mk_ref({Atom,1}, [262143, 8723648, 24097245])), + void + end || Atom <- unicode_atom_data()], ?line runner:recv_eot(P), ok. @@ -127,7 +134,7 @@ test_ei_decode_encode(Config) when is_list(Config) -> % We read two packets for each test, the ei_decode_encode and ei_x_decode_encode version.... send_rec(P, Term) when is_port(P) -> - ?t:format("Testing: ~p~n", [Term]), + %%?t:format("Testing: ~p~n", [Term]), P ! {self(), {command, term_to_binary(Term)}}, {_B,Term} = get_buf_and_term(P). @@ -146,7 +153,7 @@ get_buf_and_term(P) -> _ -> B1 = list_to_binary([131,B]), % No magic, add T = binary_to_term(B1), - io:format("~w\n~w\n(got no magic)\n",[B,T]), + %io:format("~w\n~w\n(got no magic)\n",[B,T]), {B,T} end. @@ -160,7 +167,7 @@ get_binary(P) -> case runner:get_term(P) of {bytes,L} -> B = list_to_binary(L), - io:format("~w\n",[L]), + %%io:format("~w\n",[L]), % For strange reasons <<131>> show up as <>.... % io:format("~w\n",[B]), B; @@ -226,38 +233,36 @@ uint8(Uint) -> mk_pid({NodeName, Creation}, Number, Serial) when is_atom(NodeName) -> - mk_pid({atom_to_list(NodeName), Creation}, Number, Serial); -mk_pid({NodeName, Creation}, Number, Serial) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_pid({NodeNameExt, Creation}, Number, Serial); +mk_pid({NodeNameExt, Creation}, Number, Serial) -> case catch binary_to_term(list_to_binary([?VERSION_MAGIC, ?PID_EXT, - ?ATOM_EXT, - uint16_be(length(NodeName)), - NodeName, + NodeNameExt, uint32_be(Number), uint32_be(Serial), uint8(Creation)])) of Pid when is_pid(Pid) -> Pid; {'EXIT', {badarg, _}} -> - exit({badarg, mk_pid, [{NodeName, Creation}, Number, Serial]}); + exit({badarg, mk_pid, [{NodeNameExt, Creation}, Number, Serial]}); Other -> exit({unexpected_binary_to_term_result, Other}) end. mk_port({NodeName, Creation}, Number) when is_atom(NodeName) -> - mk_port({atom_to_list(NodeName), Creation}, Number); -mk_port({NodeName, Creation}, Number) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_port({NodeNameExt, Creation}, Number); +mk_port({NodeNameExt, Creation}, Number) -> case catch binary_to_term(list_to_binary([?VERSION_MAGIC, ?PORT_EXT, - ?ATOM_EXT, - uint16_be(length(NodeName)), - NodeName, + NodeNameExt, uint32_be(Number), uint8(Creation)])) of Port when is_port(Port) -> Port; {'EXIT', {badarg, _}} -> - exit({badarg, mk_port, [{NodeName, Creation}, Number]}); + exit({badarg, mk_port, [{NodeNameExt, Creation}, Number]}); Other -> exit({unexpected_binary_to_term_result, Other}) end. @@ -265,33 +270,30 @@ mk_port({NodeName, Creation}, Number) -> mk_ref({NodeName, Creation}, Numbers) when is_atom(NodeName), is_integer(Creation), is_list(Numbers) -> - mk_ref({atom_to_list(NodeName), Creation}, Numbers); -mk_ref({NodeName, Creation}, [Number]) when is_list(NodeName), - is_integer(Creation), - is_integer(Number) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_ref({NodeNameExt, Creation}, Numbers); +mk_ref({NodeNameExt, Creation}, [Number]) when is_binary(NodeNameExt), + is_integer(Creation), + is_integer(Number) -> case catch binary_to_term(list_to_binary([?VERSION_MAGIC, ?REFERENCE_EXT, - ?ATOM_EXT, - uint16_be(length(NodeName)), - NodeName, + NodeNameExt, uint32_be(Number), uint8(Creation)])) of Ref when is_reference(Ref) -> Ref; {'EXIT', {badarg, _}} -> - exit({badarg, mk_ref, [{NodeName, Creation}, [Number]]}); + exit({badarg, mk_ref, [{NodeNameExt, Creation}, [Number]]}); Other -> exit({unexpected_binary_to_term_result, Other}) end; -mk_ref({NodeName, Creation}, Numbers) when is_list(NodeName), - is_integer(Creation), - is_list(Numbers) -> +mk_ref({NodeNameExt, Creation}, Numbers) when is_binary(NodeNameExt), + is_integer(Creation), + is_list(Numbers) -> case catch binary_to_term(list_to_binary([?VERSION_MAGIC, ?NEW_REFERENCE_EXT, uint16_be(length(Numbers)), - ?ATOM_EXT, - uint16_be(length(NodeName)), - NodeName, + NodeNameExt, uint8(Creation), lists:map(fun (N) -> uint32_be(N) @@ -300,8 +302,67 @@ mk_ref({NodeName, Creation}, Numbers) when is_list(NodeName), Ref when is_reference(Ref) -> Ref; {'EXIT', {badarg, _}} -> - exit({badarg, mk_ref, [{NodeName, Creation}, Numbers]}); + exit({badarg, mk_ref, [{NodeNameExt, Creation}, Numbers]}); Other -> exit({unexpected_binary_to_term_result, Other}) end. + + +unicode_atom_data() -> + [uc_atup(lists:seq(16#1f600, 16#1f600+254)), + uc_atup(lists:seq(16#1f600, 16#1f600+63)), + uc_atup(lists:seq(1, 255)), + uc_atup(lists:seq(100, 163)), + uc_atup(lists:seq(200, 354)), + uc_atup(lists:seq(200, 263)), + uc_atup(lists:seq(2000, 2254)), + uc_atup(lists:seq(2000, 2063)), + uc_atup(lists:seq(65500, 65754)), + uc_atup(lists:seq(65500, 65563)) + | lists:map(fun (N) -> + Pow2 = (1 bsl N), + uc_atup(lists:seq(Pow2 - 127, Pow2 + 127)) + end, + lists:seq(7, 20)) + ]. + +uc_atup(ATxt) -> + string_to_atom(ATxt). + +string_to_atom(String) -> + Utf8List = string_to_utf8_list(String), + Len = length(Utf8List), + TagLen = case Len < 256 of + true -> [119, Len]; + false -> [118, Len bsr 8, Len band 16#ff] + end, + binary_to_term(list_to_binary([131, TagLen, Utf8List])). + +string_to_utf8_list([]) -> + []; +string_to_utf8_list([CP|CPs]) when is_integer(CP), + 0 =< CP, + CP =< 16#7F -> + [CP | string_to_utf8_list(CPs)]; +string_to_utf8_list([CP|CPs]) when is_integer(CP), + 16#80 =< CP, + CP =< 16#7FF -> + [16#C0 bor (CP bsr 6), + 16#80 bor (16#3F band CP) + | string_to_utf8_list(CPs)]; +string_to_utf8_list([CP|CPs]) when is_integer(CP), + 16#800 =< CP, + CP =< 16#FFFF -> + [16#E0 bor (CP bsr 12), + 16#80 bor (16#3F band (CP bsr 6)), + 16#80 bor (16#3F band CP) + | string_to_utf8_list(CPs)]; +string_to_utf8_list([CP|CPs]) when is_integer(CP), + 16#10000 =< CP, + CP =< 16#10FFFF -> + [16#F0 bor (CP bsr 18), + 16#80 bor (16#3F band (CP bsr 12)), + 16#80 bor (16#3F band (CP bsr 6)), + 16#80 bor (16#3F band CP) + | string_to_utf8_list(CPs)]. diff --git a/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c b/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c index 406f02ecfb..e57663f984 100644 --- a/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c +++ b/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c @@ -29,171 +29,229 @@ * Author: [email protected] */ -#define EI_DECODE_ENCODE(FUNC,TYPE) \ - { \ - char *buf; \ - char buf2[1024]; \ - TYPE p; \ - int size1 = 0; \ - int size2 = 0; \ - int size3 = 0; \ - int err; \ - ei_x_buff arg; \ -\ - message("ei_decode_" #FUNC ", arg is type " #TYPE); \ - buf = read_packet(NULL); \ - err = ei_decode_ ## FUNC(buf+1, &size1, &p); \ - if (err != 0) { \ - if (err != -1) { \ - fail("decode returned non zero but not -1"); \ - } else { \ - fail("decode returned non zero"); \ - } \ - return; \ - } \ - if (size1 < 1) { \ - fail("size is < 1"); \ - return; \ - } \ -\ - message("ei_encode_" #FUNC " buf is NULL, arg is type " #TYPE); \ - err = ei_encode_ ## FUNC(NULL, &size2, &p); \ - if (err != 0) { \ - if (err != -1) { \ - fail("size calculation returned non zero but not -1"); \ - return; \ - } else { \ - fail("size calculation returned non zero"); \ - return; \ - } \ - } \ - if (size1 != size2) { \ - message("size1 = %d, size2 = %d\n",size1,size2); \ - fail("decode and encode size differs when buf is NULL"); \ - return; \ - } \ - message("ei_encode_" #FUNC ", arg is type " #TYPE); \ - err = ei_encode_ ## FUNC(buf2, &size3, &p); \ - if (err != 0) { \ - if (err != -1) { \ - fail("returned non zero but not -1"); \ - } else { \ - fail("returned non zero"); \ - } \ - return; \ - } \ - if (size1 != size3) { \ - message("size1 = %d, size2 = %d\n",size1,size3); \ - fail("decode and encode size differs"); \ - return; \ - } \ - send_buffer(buf2, size1); \ -\ - message("ei_x_encode_" #FUNC ", arg is type " #TYPE); \ - ei_x_new(&arg); \ - err = ei_x_encode_ ## FUNC(&arg, &p); \ - if (err != 0) { \ - if (err != -1) { \ - fail("returned non zero but not -1"); \ - } else { \ - fail("returned non zero"); \ - } \ - ei_x_free(&arg); \ - return; \ - } \ - if (arg.index < 1) { \ - fail("size is < 1"); \ - ei_x_free(&arg); \ - return; \ - } \ - send_buffer(arg.buff, arg.index); \ - ei_x_free(&arg); \ - } - -#define EI_DECODE_ENCODE_BIG(FUNC,TYPE) \ - { \ - char *buf; \ - char buf2[2048]; \ - TYPE *p; \ - int size1 = 0; \ - int size2 = 0; \ - int size3 = 0; \ - int err, index = 0, len, type; \ - ei_x_buff arg; \ -\ - message("ei_decode_" #FUNC ", arg is type " #TYPE); \ - buf = read_packet(NULL); \ - ei_get_type(buf+1, &index, &type, &len); \ - p = ei_alloc_big(len); \ - err = ei_decode_ ## FUNC(buf+1, &size1, p); \ - if (err != 0) { \ - if (err != -1) { \ - fail("decode returned non zero but not -1"); \ - } else { \ - fail("decode returned non zero"); \ - } \ - return; \ - } \ - if (size1 < 1) { \ - fail("size is < 1"); \ - return; \ - } \ -\ - message("ei_encode_" #FUNC " buf is NULL, arg is type " #TYPE); \ - err = ei_encode_ ## FUNC(NULL, &size2, p); \ - if (err != 0) { \ - if (err != -1) { \ - fail("size calculation returned non zero but not -1"); \ - return; \ - } else { \ - fail("size calculation returned non zero"); \ - return; \ - } \ - } \ - if (size1 != size2) { \ - message("size1 = %d, size2 = %d\n",size1,size2); \ - fail("decode and encode size differs when buf is NULL"); \ - return; \ - } \ - message("ei_encode_" #FUNC ", arg is type " #TYPE); \ - err = ei_encode_ ## FUNC(buf2, &size3, p); \ - if (err != 0) { \ - if (err != -1) { \ - fail("returned non zero but not -1"); \ - } else { \ - fail("returned non zero"); \ - } \ - return; \ - } \ - if (size1 != size3) { \ - message("size1 = %d, size2 = %d\n",size1,size3); \ - fail("decode and encode size differs"); \ - return; \ - } \ - send_buffer(buf2, size1); \ -\ - message("ei_x_encode_" #FUNC ", arg is type " #TYPE); \ - ei_x_new(&arg); \ - err = ei_x_encode_ ## FUNC(&arg, p); \ - if (err != 0) { \ - if (err != -1) { \ - fail("returned non zero but not -1"); \ - } else { \ - fail("returned non zero"); \ - } \ - ei_x_free(&arg); \ - return; \ - } \ - if (arg.index < 1) { \ - fail("size is < 1"); \ - ei_x_free(&arg); \ - return; \ - } \ - send_buffer(arg.buff, arg.index); \ - ei_x_free(&arg); \ - ei_free_big(p); \ - } +/*#define MESSAGE(FMT,A1,A2) message(FMT,A1,A2)*/ +#define MESSAGE(FMT,A1,A2) +typedef int decodeFT(const char *buf, int *index, void*); +typedef int encodeFT(char *buf, int *index, void*); +typedef int x_encodeFT(ei_x_buff*, void*); + +struct Type { + char* name; + char* type; + decodeFT* ei_decode_fp; + encodeFT* ei_encode_fp; + x_encodeFT* ei_x_encode_fp; +}; + +typedef struct +{ + char name[MAXATOMLEN_UTF8]; + enum erlang_char_encoding enc; +}my_atom; + +int ei_decode_my_atom(const char *buf, int *index, my_atom* a) +{ + return ei_decode_atom_as(buf, index, a->name, sizeof(a->name), ERLANG_UTF8, &a->enc, NULL); +} +int ei_encode_my_atom(char *buf, int *index, my_atom* a) +{ + return ei_encode_atom_as(buf, index, a->name, ERLANG_UTF8, a->enc); +} +int ei_x_encode_my_atom(ei_x_buff* x, my_atom* a) +{ + return ei_x_encode_atom_as(x, a->name, ERLANG_UTF8, a->enc); +} + +#define BUFSZ 2000 + +void decode_encode(struct Type* t, void* obj) +{ + char *buf; + char buf2[BUFSZ]; + int size1 = 0; + int size2 = 0; + int size3 = 0; + int err; + ei_x_buff arg; + + MESSAGE("ei_decode_%s, arg is type %s", t->name, t->type); + buf = read_packet(NULL); + err = t->ei_decode_fp(buf+1, &size1, obj); + if (err != 0) { + if (err != -1) { + fail("decode returned non zero but not -1"); + } else { + fail("decode returned non zero"); + } + return; + } + if (size1 < 1) { + fail("size is < 1"); + return; + } + + if (size1 > BUFSZ) { + fail("size is > BUFSZ"); + return; + } + + MESSAGE("ei_encode_%s buf is NULL, arg is type %s", t->name, t->type); + err = t->ei_encode_fp(NULL, &size2, obj); + if (err != 0) { + if (err != -1) { + fail("size calculation returned non zero but not -1"); + return; + } else { + fail("size calculation returned non zero"); + return; + } + } + if (size1 != size2) { + MESSAGE("size1 = %d, size2 = %d\n",size1,size2); + fail("decode and encode size differs when buf is NULL"); + return; + } + MESSAGE("ei_encode_%s, arg is type %s", t->name, t->type); + err = t->ei_encode_fp(buf2, &size3, obj); + if (err != 0) { + if (err != -1) { + fail("returned non zero but not -1"); + } else { + fail("returned non zero"); + } + return; + } + if (size1 != size3) { + MESSAGE("size1 = %d, size2 = %d\n",size1,size3); + fail("decode and encode size differs"); + return; + } + send_buffer(buf2, size1); + + MESSAGE("ei_x_encode_%s, arg is type %s", t->name, t->type); + ei_x_new(&arg); + err = t->ei_x_encode_fp(&arg, obj); + if (err != 0) { + if (err != -1) { + fail("returned non zero but not -1"); + } else { + fail("returned non zero"); + } + ei_x_free(&arg); + return; + } + if (arg.index < 1) { + fail("size is < 1"); + ei_x_free(&arg); + return; + } + send_buffer(arg.buff, arg.index); + ei_x_free(&arg); +} + + +#define EI_DECODE_ENCODE(TYPE, ERLANG_TYPE) { \ + struct Type type_struct = {#TYPE, #ERLANG_TYPE, \ + (decodeFT*)ei_decode_##TYPE, \ + (encodeFT*)ei_encode_##TYPE, \ + (x_encodeFT*)ei_x_encode_##TYPE }; \ + ERLANG_TYPE type_obj; \ + decode_encode(&type_struct, &type_obj); \ + } + + +void decode_encode_big(struct Type* t) +{ + char *buf; + char buf2[2048]; + void *p; /* (TYPE*) */ + int size1 = 0; + int size2 = 0; + int size3 = 0; + int err, index = 0, len, type; + ei_x_buff arg; + + MESSAGE("ei_decode_%s, arg is type %s", t->name, t->type); + buf = read_packet(NULL); + ei_get_type(buf+1, &index, &type, &len); + p = ei_alloc_big(len); + err = t->ei_decode_fp(buf+1, &size1, p); + if (err != 0) { + if (err != -1) { + fail("decode returned non zero but not -1"); + } else { + fail("decode returned non zero"); + } + return; + } + if (size1 < 1) { + fail("size is < 1"); + return; + } + + MESSAGE("ei_encode_%s buf is NULL, arg is type %s", t->name, t->type); + err = t->ei_encode_fp(NULL, &size2, p); + if (err != 0) { + if (err != -1) { + fail("size calculation returned non zero but not -1"); + return; + } else { + fail("size calculation returned non zero"); + return; + } + } + if (size1 != size2) { + MESSAGE("size1 = %d, size2 = %d\n",size1,size2); + fail("decode and encode size differs when buf is NULL"); + return; + } + MESSAGE("ei_encode_%s, arg is type %s", t->name, t->type); + err = t->ei_encode_fp(buf2, &size3, p); + if (err != 0) { + if (err != -1) { + fail("returned non zero but not -1"); + } else { + fail("returned non zero"); + } + return; + } + if (size1 != size3) { + MESSAGE("size1 = %d, size2 = %d\n",size1,size3); + fail("decode and encode size differs"); + return; + } + send_buffer(buf2, size1); + + MESSAGE("ei_x_encode_%s, arg is type %s", t->name, t->type); + ei_x_new(&arg); + err = t->ei_x_encode_fp(&arg, p); + if (err != 0) { + if (err != -1) { + fail("returned non zero but not -1"); + } else { + fail("returned non zero"); + } + ei_x_free(&arg); + return; + } + if (arg.index < 1) { + fail("size is < 1"); + ei_x_free(&arg); + return; + } + send_buffer(arg.buff, arg.index); + ei_x_free(&arg); + ei_free_big(p); +} + +#define EI_DECODE_ENCODE_BIG(TYPE, ERLANG_TYPE) { \ + struct Type type_struct = {#TYPE, #ERLANG_TYPE, \ + (decodeFT*)ei_decode_##TYPE, \ + (encodeFT*)ei_encode_##TYPE, \ + (x_encodeFT*)ei_x_encode_##TYPE }; \ + decode_encode_big(&type_struct); \ + } @@ -201,6 +259,8 @@ TESTCASE(test_ei_decode_encode) { + int i; + EI_DECODE_ENCODE(fun , erlang_fun); EI_DECODE_ENCODE(pid , erlang_pid); EI_DECODE_ENCODE(port , erlang_port); @@ -223,6 +283,14 @@ TESTCASE(test_ei_decode_encode) EI_DECODE_ENCODE(port , erlang_port); EI_DECODE_ENCODE(ref , erlang_ref); + /* Unicode atoms */ + for (i=0; i<24; i++) { + EI_DECODE_ENCODE(my_atom, my_atom); + EI_DECODE_ENCODE(pid, erlang_pid); + EI_DECODE_ENCODE(port, erlang_port); + EI_DECODE_ENCODE(ref, erlang_ref); + } + report(1); } diff --git a/lib/et/src/Makefile b/lib/et/src/Makefile index c68a3f4efd..386169fe95 100644 --- a/lib/et/src/Makefile +++ b/lib/et/src/Makefile @@ -92,10 +92,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/eunit/src/Makefile b/lib/eunit/src/Makefile index 0a2e71cf7b..e88e28df83 100644 --- a/lib/eunit/src/Makefile +++ b/lib/eunit/src/Makefile @@ -104,10 +104,10 @@ $(OBJECTS): $(PARSE_TRANSFORM_BIN) # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/contribs/bonk/Makefile b/lib/gs/contribs/bonk/Makefile index a630deaf24..d160ca8b73 100644 --- a/lib/gs/contribs/bonk/Makefile +++ b/lib/gs/contribs/bonk/Makefile @@ -81,12 +81,12 @@ clean: # ---------------------------------------------------- $(EBIN)/$(TOOLNAME).gif: $(TOOLNAME).gif - rm -f $@ - cp $(TOOLNAME).gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).gif $@ $(EBIN)/$(TOOLNAME).tool: $(TOOLNAME).tool - rm -f $@ - cp $(TOOLNAME).tool $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).tool $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/contribs/cols/Makefile b/lib/gs/contribs/cols/Makefile index 3af91e1dae..3036e9565e 100644 --- a/lib/gs/contribs/cols/Makefile +++ b/lib/gs/contribs/cols/Makefile @@ -74,16 +74,16 @@ clean: # ---------------------------------------------------- $(EBIN)/$(TOOLNAME).gif: $(TOOLNAME).gif - rm -f $@ - cp $(TOOLNAME).gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).gif $@ $(EBIN)/$(TOOLNAME).tool: $(TOOLNAME).tool - rm -f $@ - cp $(TOOLNAME).tool $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).tool $@ $(EBIN)/help.gif: help.gif - rm -f $@ - cp help.gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp help.gif $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/contribs/mandel/Makefile b/lib/gs/contribs/mandel/Makefile index 5f0b047955..308ba0cbb0 100644 --- a/lib/gs/contribs/mandel/Makefile +++ b/lib/gs/contribs/mandel/Makefile @@ -73,16 +73,16 @@ clean: # ---------------------------------------------------- $(EBIN)/$(TOOLNAME).gif: $(TOOLNAME).gif - rm -f $@ - cp $(TOOLNAME).gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).gif $@ $(EBIN)/$(TOOLNAME).tool: $(TOOLNAME).tool - rm -f $@ - cp $(TOOLNAME).tool $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).tool $@ $(EBIN)/help.gif: help.gif - rm -f $@ - cp help.gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp help.gif $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/contribs/othello/Makefile b/lib/gs/contribs/othello/Makefile index 5f37d164f5..f9d131c315 100644 --- a/lib/gs/contribs/othello/Makefile +++ b/lib/gs/contribs/othello/Makefile @@ -76,12 +76,12 @@ clean: # ---------------------------------------------------- $(EBIN)/$(TOOLNAME).gif: $(TOOLNAME).gif - rm -f $@ - cp $(TOOLNAME).gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).gif $@ $(EBIN)/$(TOOLNAME).tool: $(TOOLNAME).tool - rm -f $@ - cp $(TOOLNAME).tool $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).tool $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/src/Makefile b/lib/gs/src/Makefile index 4b7a4523b9..0a63d5466e 100644 --- a/lib/gs/src/Makefile +++ b/lib/gs/src/Makefile @@ -91,13 +91,13 @@ clean: # ---------------------------------------------------- gstk_generic.hrl: gs_make.erl ../ebin/gs_make.$(EMULATOR) ../ebin/gs.$(EMULATOR) - $(ERL) -pa $(EBIN) -s gs_make -s erlang halt -noshell + $(gen_verbose)$(ERL) -pa $(EBIN) -s gs_make -s erlang halt -noshell $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(GSTK_GENERIC_TARGET): gstk_generic.hrl diff --git a/lib/hipe/Makefile b/lib/hipe/Makefile index 2294f98158..a9e24f4d17 100644 --- a/lib/hipe/Makefile +++ b/lib/hipe/Makefile @@ -57,20 +57,20 @@ edocs: fi all-subdirs: - for dir in $(SUB_DIRECTORIES); do \ + $(V_at)for dir in $(SUB_DIRECTORIES); do \ (cd $$dir; $(MAKE) $(MAKETARGET) EBIN=$(EBIN); cd ..); \ done # distclean and realclean should clean the bootstrap files all-subdirs-x: - for dir in $(SUB_DIRECTORIES); do \ + $(V_at)for dir in $(SUB_DIRECTORIES); do \ (cd $$dir; $(MAKE) $(MAKETARGET) EBIN=../boot_ebin; cd ..); \ done clean: - $(MAKE) MAKETARGET="clean" all-subdirs all-subdirs-x + $(V_at)$(MAKE) MAKETARGET="clean" all-subdirs all-subdirs-x distclean: - $(MAKE) MAKETARGET="distclean" all-subdirs all-subdirs-x + $(V_at)$(MAKE) MAKETARGET="distclean" all-subdirs all-subdirs-x realclean: - $(MAKE) MAKETARGET="realclean" all-subdirs all-subdirs-x + $(V_at)$(MAKE) MAKETARGET="realclean" all-subdirs all-subdirs-x diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index 98d65abba1..d93ad10bd4 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2012. All Rights Reserved. +%% Copyright Ericsson AB 2003-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -765,7 +765,6 @@ type(erlang, node, 0, _) -> t_node(); %% Guard bif, needs to be here. type(erlang, node, 1, Xs) -> strict(arg_types(erlang, node, 1), Xs, fun (_) -> t_node() end); -type(erlang, nodes, 0, _) -> t_list(t_node()); %% Guard bif, needs to be here. type(erlang, round, 1, Xs) -> strict(arg_types(erlang, round, 1), Xs, fun (_) -> t_integer() end); @@ -2250,8 +2249,6 @@ arg_types(erlang, node, 0) -> %% Guard bif, needs to be here. arg_types(erlang, node, 1) -> [t_identifier()]; -arg_types(erlang, nodes, 0) -> - []; %% Guard bif, needs to be here. arg_types(erlang, round, 1) -> [t_number()]; diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index bc7ea17077..7631f5289e 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -3432,7 +3432,7 @@ record_field_diffs_to_string(?tuple([_|Fs], Arity, Tag), RecDict) -> field_diffs([F|Fs], [{FName, DefType}|FDefs], RecDict, Acc) -> NewAcc = - case t_is_subtype(F, DefType) of + case not t_is_none(t_inf(F, DefType)) of true -> Acc; false -> Str = atom_to_string(FName) ++ "::" ++ t_to_string(DefType, RecDict), @@ -3566,7 +3566,7 @@ t_from_form({type, _L, function, []}, _TypeNames, _InOpaque, _RecDict, t_from_form({type, _L, 'fun', []}, _TypeNames, _InOpaque, _RecDict, _VarDict) -> {t_fun(), []}; -t_from_form({type, _L, 'fun', [{type, _, any, []}, Range]}, TypeNames, +t_from_form({type, _L, 'fun', [{type, _, any}, Range]}, TypeNames, InOpaque, RecDict, VarDict) -> {T, R} = t_from_form(Range, TypeNames, InOpaque, RecDict, VarDict), {t_fun(T), R}; @@ -3909,7 +3909,7 @@ t_form_to_string({type, _L, binary, [Base, Unit]} = Type) -> _ -> io_lib:format("Badly formed bitstr type ~w", [Type]) end; t_form_to_string({type, _L, 'fun', []}) -> "fun()"; -t_form_to_string({type, _L, 'fun', [{type, _, any, []}, Range]}) -> +t_form_to_string({type, _L, 'fun', [{type, _, any}, Range]}) -> "fun(...) -> " ++ t_form_to_string(Range); t_form_to_string({type, _L, 'fun', [{type, _, product, Domain}, Range]}) -> "fun((" ++ string:join(t_form_to_string_list(Domain), ",") ++ ") -> " diff --git a/lib/hipe/main/Makefile b/lib/hipe/main/Makefile index 673431a175..66e4c3e39a 100644 --- a/lib/hipe/main/Makefile +++ b/lib/hipe/main/Makefile @@ -76,7 +76,7 @@ ERL_COMPILE_FLAGS += +nowarn_shadow_vars +warn_missing_spec +warn_untyped_record # ---------------------------------------------------- hipe.hrl: ../vsn.mk hipe.hrl.src - sed -e "s;%VSN%;$(HIPE_VSN);" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl + $(vsn_verbose)sed -e "s;%VSN%;$(HIPE_VSN);" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl $(EBIN)/hipe.beam: hipe.hrl ../../compiler/src/beam_disasm.hrl $(EBIN)/hipe_main.beam: hipe.hrl ../icode/hipe_icode.hrl #../rtl/hipe_rtl.hrl @@ -97,17 +97,17 @@ distclean: clean realclean: clean $(DOCS)/%.html:%.erl - erl -noshell -run edoc_run file '"$<"' '[{dir, "$(DOCS)"}]' -s init stop + $(gen_verbose)erl -noshell -run edoc_run file '"$<"' '[{dir, "$(DOCS)"}]' -s init stop # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/hipe/rtl/Makefile b/lib/hipe/rtl/Makefile index 426d1bd3ee..7852a2172b 100644 --- a/lib/hipe/rtl/Makefile +++ b/lib/hipe/rtl/Makefile @@ -134,13 +134,13 @@ HIPE_MKLITERALS=$(ERL_TOP)/bin/$(TARGET)/hipe_mkliterals$(TYPE_STR)$(FLAVOR_STR) hipe_literals.hrl: $(HIPE_MKLITERALS) - $(HIPE_MKLITERALS) $(MKLIT_FLAGS) -e > hipe_literals.hrl + $(gen_verbose)$(HIPE_MKLITERALS) $(MKLIT_FLAGS) -e > hipe_literals.hrl # Need to generate hipe.hrl from one and only one target in one and only # one makefile; otherwise, clearmake will force rebuilds of hipe over and # over again. ../main/hipe.hrl: ../vsn.mk ../main/hipe.hrl.src - (cd ../main && $(MAKE) hipe.hrl) + $(V_at)(cd ../main && $(MAKE) hipe.hrl) # 2012-02-24. Please keep these dependencies up to date. They tend to rot. # grep ^-include *.erl says a lot, but you need to dig further, e.g: diff --git a/lib/ic/c_src/Makefile.in b/lib/ic/c_src/Makefile.in index de46eadb3b..856823b1b3 100644 --- a/lib/ic/c_src/Makefile.in +++ b/lib/ic/c_src/Makefile.in @@ -67,7 +67,11 @@ ifeq ($(findstring solaris,$(HOST_OS)),solaris) SKIP_BUILDING_BINARIES := true endif else +ifeq ($(V),0) +AR_OUT = rc +else AR_OUT = rcv +endif CC_FLAGS = @DED_CFLAGS@ LIBRARY = $(LIBDIR)/libic.a SKIP_BUILDING_BINARIES := false @@ -128,11 +132,13 @@ docs: _create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR)) $(LIBRARY): $(OBJ_FILES) - -$(AR) $(AR_OUT) $@ $(OBJ_FILES) + $(ar_verbose) + -$(AR) $(AR_OUT) $@ $(OBJ_FILES) + $(ranlib_verbose) -$(RANLIB) $@ $(OBJDIR)/%.o: %.c - $(CC) $(CC_FLAGS) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) $(CC_FLAGS) -c -o $@ $(ALL_CFLAGS) $< # ---------------------------------------------------- # Release Target diff --git a/lib/ic/examples/all-against-all/client.c b/lib/ic/examples/all-against-all/client.c index e0a52b142d..5dece9cfa6 100644 --- a/lib/ic/examples/all-against-all/client.c +++ b/lib/ic/examples/all-against-all/client.c @@ -88,6 +88,7 @@ int main(){ /* Initiating pid*/ strcpy(pid.node,client_node); + pid.node_org_enc = ERLANG_LATIN1; pid.num = 99; pid.serial = 0; pid.creation = 0; diff --git a/lib/ic/examples/c-client/client.c b/lib/ic/examples/c-client/client.c index 816477cf15..5b11510ce3 100644 --- a/lib/ic/examples/c-client/client.c +++ b/lib/ic/examples/c-client/client.c @@ -64,6 +64,7 @@ int main() /* Initiating pid*/ strcpy(pid.node,CLNODE); + pid.node_org_enc = ERLANG_LATIN1; pid.num = 99; pid.serial = 0; pid.creation = 0; diff --git a/lib/ic/examples/c-server/client.c b/lib/ic/examples/c-server/client.c index fa570089b5..605e41ddb1 100644 --- a/lib/ic/examples/c-server/client.c +++ b/lib/ic/examples/c-server/client.c @@ -58,6 +58,7 @@ int main() /* Initiating pid*/ strcpy(pid.node, CLNODE); + pid.node_org_enc = ERLANG_LATIN1; pid.num = 99; pid.serial = 0; pid.creation = 0; diff --git a/lib/ic/examples/pre_post_condition/Makefile b/lib/ic/examples/pre_post_condition/Makefile index d18f81fec9..53e647e793 100644 --- a/lib/ic/examples/pre_post_condition/Makefile +++ b/lib/ic/examples/pre_post_condition/Makefile @@ -109,9 +109,9 @@ test: $(TEST_TARGET_FILES) IDL-GENERATED: ex.idl - erlc $(ERL_LOCAL_FLAGS) +'{precond,{tracer,pre}}' \ + $(gen_verbose)erlc $(ERL_LOCAL_FLAGS) +'{precond,{tracer,pre}}' \ +'{{postcond,"m::i::f"},{tracer,post}}' ex.idl - >IDL-GENERATED + $(V_at)>IDL-GENERATED $(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES): IDL-GENERATED diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Makefile b/lib/ic/java_src/com/ericsson/otp/ic/Makefile index cf4c353f3f..273614e8d9 100644 --- a/lib/ic/java_src/com/ericsson/otp/ic/Makefile +++ b/lib/ic/java_src/com/ericsson/otp/ic/Makefile @@ -85,7 +85,10 @@ JAR= jar JAVADOCFLAGS=-d $(DOCDIR) JAVAFLAGS=-d $(JAVA_DEST_ROOT) -JARFLAGS= -cvf +JARFLAGS= -cf +ifneq ($(V),0) +JARFLAGS= -cfv +endif JAVA_OPTIONS = diff --git a/lib/ic/src/Makefile b/lib/ic/src/Makefile index 280d86a8a4..e8769d2335 100644 --- a/lib/ic/src/Makefile +++ b/lib/ic/src/Makefile @@ -175,7 +175,7 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -183,7 +183,7 @@ docs: # Special Build Targets # ---------------------------------------------------- ../ebin/icparse.beam: icparse.erl - $(ERLC) $(ERL_COMPILE_FLAGS) +nowarn_unused_vars +nowarn_unused_function -o$(EBIN) +pj $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) +nowarn_unused_vars +nowarn_unused_function -o$(EBIN) +pj $< icparse.erl: icparse.yrl icyeccpre.hrl diff --git a/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src b/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src index 3143ab427b..a2440adc92 100644 --- a/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src +++ b/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src @@ -86,15 +86,15 @@ clean: java_erl_test.built_erl java_erl_test.built_java java_erl_test.built_java: java_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,java}" java_erl_test.idl - echo done > java_erl_test.built_java + $(gen_verbose)$(ERLC) -I $(IC_INCLUDE_PATH) "+{be,java}" java_erl_test.idl + $(V_at)echo done > java_erl_test.built_java $(CLASS_FILES) : $(JAVA_FILES) - $(JAVAC) -classpath $(CLASSPATH) $(JAVA_FILES) + $(V_JAVAC) -classpath $(CLASSPATH) $(JAVA_FILES) java_erl_test.built_erl: java_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" java_erl_test.idl - echo done > java_erl_test.built_erl + $(gen_verbose)$(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" java_erl_test.idl + $(V_at)echo done > java_erl_test.built_erl .erl.@EMULATOR@: - $(ERLC) -I $(IC_INCLUDE_PATH) $< + $(V_ERLC) -I $(IC_INCLUDE_PATH) $< diff --git a/lib/inets/src/http_client/httpc_response.erl b/lib/inets/src/http_client/httpc_response.erl index 04976447cc..37f5f2ce6d 100644 --- a/lib/inets/src/http_client/httpc_response.erl +++ b/lib/inets/src/http_client/httpc_response.erl @@ -124,6 +124,11 @@ result(Response = {{_, Code, _}, _, _}, (Code =:= 303) orelse (Code =:= 307) -> redirect(Response, Request); +result(Response = {{_, 303, _}, _, _}, + Request = #request{settings = + #http_options{autoredirect = true}, + method = post}) -> + redirect(Response, Request#request{method = get}); result(Response = {{_,503,_}, _, _}, Request) -> diff --git a/lib/inets/src/inets_app/Makefile b/lib/inets/src/inets_app/Makefile index 7d68145287..22426eee79 100644 --- a/lib/inets/src/inets_app/Makefile +++ b/lib/inets/src/inets_app/Makefile @@ -99,10 +99,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index 644b01120c..fbd1b3d38a 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -1326,24 +1326,42 @@ http_redirect(Config) when is_list(Config) -> = httpc:request(post, {URL302, [],"text/plain", "foobar"}, [], []), - URL307 = ?URL_START ++ integer_to_list(Port) ++ "/307.html", + URL303 = ?URL_START ++ integer_to_list(Port) ++ "/303.html", tsp("http_redirect -> issue request 9: " + "~n ~p", [URL303]), + {ok, {{_,200,_}, [_ | _], [_|_]}} + = httpc:request(get, {URL303, []}, [], []), + + tsp("http_redirect -> issue request 10: " + "~n ~p", [URL303]), + {ok, {{_,200,_}, [_ | _], []}} + = httpc:request(head, {URL303, []}, [], []), + + tsp("http_redirect -> issue request 11: " + "~n ~p", [URL303]), + {ok, {{_,200,_}, [_ | _], [_|_]}} + = httpc:request(post, {URL303, [],"text/plain", "foobar"}, + [], []), + + URL307 = ?URL_START ++ integer_to_list(Port) ++ "/307.html", + + tsp("http_redirect -> issue request 12: " "~n ~p", [URL307]), {ok, {{_,200,_}, [_ | _], [_|_]}} = httpc:request(get, {URL307, []}, [], []), - tsp("http_redirect -> issue request 10: " + tsp("http_redirect -> issue request 13: " "~n ~p", [URL307]), {ok, {{_,200,_}, [_ | _], []}} = httpc:request(head, {URL307, []}, [], []), - tsp("http_redirect -> issue request 11: " + tsp("http_redirect -> issue request 14: " "~n ~p", [URL307]), {ok, {{_,307,_}, [_ | _], [_|_]}} = httpc:request(post, {URL307, [],"text/plain", "foobar"}, [], []), - + tsp("http_redirect -> stop dummy server"), DummyServerPid ! stop, tsp("http_redirect -> reset ipfamily option (to inet6fb4)"), @@ -3298,6 +3316,14 @@ handle_http_msg({_, RelUri, _, {_, Headers}, Body}, Socket, Close, Send) -> "Content-Length:80\r\n\r\n" ++ "<HTML><BODY><a href=" ++ NewUri ++ ">New place</a></BODY></HTML>"; + "/303.html" -> + NewUri = ?URL_START ++ + integer_to_list(?IP_PORT) ++ "/dummy.html", + "HTTP/1.1 303 See Other \r\n" ++ + "Location:" ++ NewUri ++ "\r\n" ++ + "Content-Length:80\r\n\r\n" ++ + "<HTML><BODY><a href=" ++ NewUri ++ + ">New place</a></BODY></HTML>"; "/307.html" -> NewUri = ?URL_START ++ integer_to_list(?IP_PORT) ++ "/dummy.html", diff --git a/lib/jinterface/java_src/Makefile b/lib/jinterface/java_src/Makefile index 19f99831eb..0aa9c09548 100644 --- a/lib/jinterface/java_src/Makefile +++ b/lib/jinterface/java_src/Makefile @@ -47,7 +47,7 @@ POM_SRC= $(POM_FILE).src # ---------------------------------------------------- $(POM_TARGET): $(POM_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java index 16cb544a16..c76fad5e45 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java @@ -90,6 +90,8 @@ public class AbstractNode { static final int dFlagExportPtrTag = 0x200; // NOT SUPPORTED static final int dFlagBitBinaries = 0x400; static final int dFlagNewFloats = 0x800; + static final int dFlagUnicodeIo = 0x1000; + static final int dFlagUtf8Atoms = 0x10000; int ntype = NTYPE_R6; int proto = 0; // tcp/ip @@ -98,7 +100,7 @@ public class AbstractNode { int creation = 0; int flags = dFlagExtendedReferences | dFlagExtendedPidsPorts | dFlagBitBinaries | dFlagNewFloats | dFlagFunTags - | dflagNewFunTags; + | dflagNewFunTags | dFlagUtf8Atoms; /* initialize hostname and default cookie */ static { diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile b/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile index 8ae63a1561..f476d4594d 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile @@ -61,7 +61,10 @@ CLASSPATH = $(JAVA_SRC_ROOT) JAVADOCFLAGS=-d $(DOCDIR) JAVAFLAGS=-d $(JAVA_DEST_ROOT) -JARFLAGS=-cvf +JARFLAGS=-cf +ifneq ($(V),0) +JARFLAGS=-cfv +endif JAVA_OPTIONS = @@ -79,13 +82,13 @@ endif debug opt: make_dirs $(JAVA_DEST_ROOT)$(JARFILE) make_dirs: - if [ ! -d "$(JAVA_DEST_ROOT)" ];then mkdir "$(JAVA_DEST_ROOT)"; fi + $(V_at)if [ ! -d "$(JAVA_DEST_ROOT)" ];then mkdir "$(JAVA_DEST_ROOT)"; fi $(JAVA_DEST_ROOT)$(JARFILE): $(TARGET_FILES) @(cd $(JAVA_DEST_ROOT) ; $(JAR) $(JARFLAGS) $(JARFILE) $(JAVA_CLASS_SUBDIR)) clean: - rm -f $(TARGET_FILES) *~ + $(V_at)rm -f $(TARGET_FILES) *~ docs: @@ -96,13 +99,13 @@ docs: # include $(ERL_TOP)/make/otp_release_targets.mk release release_docs release_tests release_html: - $(MAKE) $(MFLAGS) RELEASE_PATH="$(RELEASE_PATH)" $(TARGET_MAKEFILE) $@_spec + $(V_at)$(MAKE) $(MFLAGS) RELEASE_PATH="$(RELEASE_PATH)" $(TARGET_MAKEFILE) $@_spec release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang" - $(INSTALL_DATA) $(JAVA_SRC) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang" - $(INSTALL_DIR) "$(RELSYSDIR)/priv" - $(INSTALL_DATA) $(JAVA_DEST_ROOT)$(JARFILE) "$(RELSYSDIR)/priv" + $(V_at)$(INSTALL_DIR) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang" + $(V_at)$(INSTALL_DATA) $(JAVA_SRC) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang" + $(V_at)$(INSTALL_DIR) "$(RELSYSDIR)/priv" + $(V_at)$(INSTALL_DATA) $(JAVA_DEST_ROOT)$(JARFILE) "$(RELSYSDIR)/priv" release_docs_spec: diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java index ced4dbb8c2..2768edc6fa 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java @@ -51,7 +51,7 @@ public class OtpErlangAtom extends OtpErlangObject implements Serializable, "null string value"); } - if (atom.length() > maxAtomLength) { + if (atom.codePointCount(0, atom.length()) > maxAtomLength) { throw new java.lang.IllegalArgumentException("Atom may not exceed " + maxAtomLength + " characters: " + atom); } diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpExternal.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpExternal.java index e70b9a786b..2a4cd4fa2d 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpExternal.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpExternal.java @@ -88,6 +88,12 @@ public class OtpExternal { /** The tag used for old Funs */ public static final int funTag = 117; + /** The tag used for unicode atoms */ + public static final int atomUtf8Tag = 118; + + /** The tag used for small unicode atoms */ + public static final int smallAtomUtf8Tag = 119; + /** The tag used for compressed terms */ public static final int compressedTag = 80; diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java index ae5f4ee072..c2a79af841 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java @@ -351,26 +351,64 @@ public class OtpInputStream extends ByteArrayInputStream { */ public String read_atom() throws OtpErlangDecodeException { int tag; - int len; + int len = -1; byte[] strbuf; String atom; tag = read1skip_version(); - if (tag != OtpExternal.atomTag) { - throw new OtpErlangDecodeException( - "wrong tag encountered, expected " + OtpExternal.atomTag - + ", got " + tag); - } + switch (tag) { - len = read2BE(); + case OtpExternal.atomTag: + len = read2BE(); + strbuf = new byte[len]; + this.readN(strbuf); + try { + atom = new String(strbuf, "ISO-8859-1"); + } catch (final java.io.UnsupportedEncodingException e) { + throw new OtpErlangDecodeException( + "Failed to decode ISO-8859-1 atom"); + } + if (atom.length() > OtpExternal.maxAtomLength) { + /* + * Throwing an exception would be better I think, + * but truncation seems to be the way it has + * been done in other parts of OTP... + */ + atom = atom.substring(0, OtpExternal.maxAtomLength); + } + break; - strbuf = new byte[len]; - this.readN(strbuf); - atom = OtpErlangString.newString(strbuf); + case OtpExternal.smallAtomUtf8Tag: + len = read1(); + /* fall through */ + case OtpExternal.atomUtf8Tag: + if (len < 0) { + len = read2BE(); + } + strbuf = new byte[len]; + this.readN(strbuf); + try { + atom = new String(strbuf, "UTF-8"); + } catch (final java.io.UnsupportedEncodingException e) { + throw new OtpErlangDecodeException( + "Failed to decode UTF-8 atom"); + } + if (atom.codePointCount(0, atom.length()) > OtpExternal.maxAtomLength) { + /* + * Throwing an exception would be better I think, + * but truncation seems to be the way it has + * been done in other parts of OTP... + */ + final int[] cps = OtpErlangString.stringToCodePoints(atom); + atom = new String(cps, 0, OtpExternal.maxAtomLength); + } + break; - if (atom.length() > OtpExternal.maxAtomLength) { - atom = atom.substring(0, OtpExternal.maxAtomLength); + default: + throw new OtpErlangDecodeException( + "wrong tag encountered, expected " + OtpExternal.atomTag + + ", or " + OtpExternal.atomUtf8Tag + ", got " + tag); } return atom; @@ -1152,6 +1190,8 @@ public class OtpInputStream extends ByteArrayInputStream { return new OtpErlangLong(this); case OtpExternal.atomTag: + case OtpExternal.smallAtomUtf8Tag: + case OtpExternal.atomUtf8Tag: return new OtpErlangAtom(this); case OtpExternal.floatTag: diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java index 22ebb4688a..10bdf389cd 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java @@ -343,9 +343,63 @@ public class OtpOutputStream extends ByteArrayOutputStream { * the string to write. */ public void write_atom(final String atom) { - write1(OtpExternal.atomTag); - write2BE(atom.length()); - writeN(atom.getBytes()); + String enc_atom; + byte[] bytes; + boolean isLatin1 = true; + + if (atom.codePointCount(0, atom.length()) <= OtpExternal.maxAtomLength) { + enc_atom = atom; + } + else { + /* + * Throwing an exception would be better I think, + * but truncation seems to be the way it has + * been done in other parts of OTP... + */ + enc_atom = new String(OtpErlangString.stringToCodePoints(atom), + 0, OtpExternal.maxAtomLength); + } + + for (int offset = 0; offset < enc_atom.length();) { + final int cp = enc_atom.codePointAt(offset); + if ((cp & ~0xFF) != 0) { + isLatin1 = false; + break; + } + offset += Character.charCount(cp); + } + try { + if (isLatin1) { + bytes = enc_atom.getBytes("ISO-8859-1"); + write1(OtpExternal.atomTag); + write2BE(bytes.length); + } + else { + bytes = enc_atom.getBytes("UTF-8"); + final int length = bytes.length; + if (length < 256) { + write1(OtpExternal.smallAtomUtf8Tag); + write1(length); + } + else { + write1(OtpExternal.atomUtf8Tag); + write2BE(length); + } + } + writeN(bytes); + } catch (final java.io.UnsupportedEncodingException e) { + /* + * Sigh, why didn't the API designer add an + * OtpErlangEncodeException to these encoding + * functions?!? Instead of changing the API we + * write an invalid atom and let it fail for + * whoever trying to decode this... Sigh, + * again... + */ + write1(OtpExternal.smallAtomUtf8Tag); + write1(2); + write2BE(0xffff); /* Invalid UTF-8 */ + } } /** diff --git a/lib/jinterface/test/nc_SUITE.erl b/lib/jinterface/test/nc_SUITE.erl index c91c743498..546c600116 100644 --- a/lib/jinterface/test/nc_SUITE.erl +++ b/lib/jinterface/test/nc_SUITE.erl @@ -23,6 +23,15 @@ -include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). +-define(VERSION_MAGIC, 131). + +-define(ATOM_EXT, 100). +-define(REFERENCE_EXT, 101). +-define(PORT_EXT, 102). +-define(PID_EXT, 103). +-define(NEW_REFERENCE_EXT, 114). +-define(ATOM_UTF8_EXT, 118). +-define(SMALL_ATOM_UTF8_EXT, 119). -export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, init_per_suite/1, @@ -46,6 +55,10 @@ unicode/1, unicode_list_to_string/1, unicode_string_to_list/1, + utf8_atom/1, + utf8_pid/1, + utf8_port/1, + utf8_ref/1, connect/1]). @@ -59,7 +72,9 @@ all() -> decompress_roundtrip, compress_roundtrip, integer_roundtrip, fun_roundtrip, lists_roundtrip, lists_roundtrip_2, lists_iterator, unicode, - unicode_list_to_string, unicode_string_to_list, connect]. + unicode_list_to_string, unicode_string_to_list, + utf8_atom, utf8_pid, utf8_port, utf8_ref, + connect]. groups() -> []. @@ -449,6 +464,71 @@ unicode_string_to_list(Config) when is_list(Config) -> end, ["unicode"]). +evil_smiley() -> + <<240,159,152,136>>. + +evil_smileys(0) -> + []; +evil_smileys(N) -> + [evil_smiley() | evil_smileys(N-1)]. + +utf8_atom(Config) when is_list(Config) -> + ES = evil_smiley(), + SmallUA = binary_to_term(list_to_binary([?VERSION_MAGIC, + ?SMALL_ATOM_UTF8_EXT, + size(ES), + ES])), + true = is_atom(SmallUA), + NoESs = 300 div size(ES), + ESs = evil_smileys(NoESs), + LargeUA = binary_to_term(list_to_binary([?VERSION_MAGIC, + ?ATOM_UTF8_EXT, + uint16_be(NoESs*size(ES)), + ESs])), + true = is_atom(LargeUA), + erlang:display({atom, SmallUA, LargeUA}), + do_echo([SmallUA, LargeUA], Config). + +utf8_nodenames_ext() -> + H = "@host", + ES = evil_smiley(), + SmallUANodeExt = list_to_binary([?SMALL_ATOM_UTF8_EXT, + size(ES)+length(H), + ES, + H]), + NoESs = 300 div size(ES), + ESs = evil_smileys(NoESs), + LargeUANodeExt = list_to_binary([?ATOM_UTF8_EXT, + uint16_be(NoESs*size(ES)+length(H)), + ESs, + H]), + {SmallUANodeExt, LargeUANodeExt}. + +utf8_pid(Config) when is_list(Config) -> + {SmallUANodeExt, LargeUANodeExt} = utf8_nodenames_ext(), + SmallPid = mk_pid({SmallUANodeExt, 2}, 4711, 4711), + LargePid = mk_pid({LargeUANodeExt, 2}, 4711, 4711), + erlang:display({pid, SmallPid, node(SmallPid)}), + erlang:display({pid, LargePid, node(LargePid)}), + do_echo([SmallPid, LargePid], Config). + +utf8_port(Config) when is_list(Config) -> + {SmallUANodeExt, LargeUANodeExt} = utf8_nodenames_ext(), + SmallPort = mk_port({SmallUANodeExt, 2}, 4711), + erlang:display({port, SmallPort, node(SmallPort)}), + LargePort = mk_port({LargeUANodeExt, 2}, 4711), + erlang:display({port, LargePort, node(LargePort)}), + do_echo([SmallPort, LargePort], Config). + +utf8_ref(Config) when is_list(Config) -> + {SmallUANodeExt, LargeUANodeExt} = utf8_nodenames_ext(), + SmallRef = mk_ref({SmallUANodeExt, 2}, [4711, 4711, 4711]), + erlang:display({ref, SmallRef, node(SmallRef)}), + LargeRef = mk_ref({LargeUANodeExt, 2}, [4711, 4711, 4711]), + erlang:display({ref, LargeRef, node(LargeRef)}), + do_echo([SmallRef, LargeRef], Config). + + %% Lazy list cp_gen(N) -> cp_gen(N, -1, 16#110000). @@ -647,16 +727,6 @@ make_name() -> ++ "-" ++ integer_to_list(B) ++ "-" ++ integer_to_list(C)). - - --define(VERSION_MAGIC, 131). - --define(ATOM_EXT, 100). --define(REFERENCE_EXT, 101). --define(PORT_EXT, 102). --define(PID_EXT, 103). --define(NEW_REFERENCE_EXT, 114). - uint32_be(Uint) when is_integer(Uint), 0 =< Uint, Uint < 1 bsl 32 -> [(Uint bsr 24) band 16#ff, (Uint bsr 16) band 16#ff, @@ -680,72 +750,70 @@ uint8(Uint) -> mk_pid({NodeName, Creation}, Number, Serial) when is_atom(NodeName) -> - mk_pid({atom_to_list(NodeName), Creation}, Number, Serial); -mk_pid({NodeName, Creation}, Number, Serial) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_pid({NodeNameExt, Creation}, Number, Serial); +mk_pid({NodeNameExt, Creation}, Number, Serial) -> case catch binary_to_term(list_to_binary([?VERSION_MAGIC, ?PID_EXT, - ?ATOM_EXT, - uint16_be(length(NodeName)), - NodeName, + NodeNameExt, uint32_be(Number), uint32_be(Serial), uint8(Creation)])) of Pid when is_pid(Pid) -> Pid; {'EXIT', {badarg, _}} -> - exit({badarg, mk_pid, [{NodeName, Creation}, Number, Serial]}); + exit({badarg, mk_pid, [{NodeNameExt, Creation}, Number, Serial]}); Other -> exit({unexpected_binary_to_term_result, Other}) end. mk_port({NodeName, Creation}, Number) when is_atom(NodeName) -> - mk_port({atom_to_list(NodeName), Creation}, Number); -mk_port({NodeName, Creation}, Number) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_port({NodeNameExt, Creation}, Number); +mk_port({NodeNameExt, Creation}, Number) -> case catch binary_to_term(list_to_binary([?VERSION_MAGIC, ?PORT_EXT, - ?ATOM_EXT, - uint16_be(length(NodeName)), - NodeName, + NodeNameExt, uint32_be(Number), uint8(Creation)])) of Port when is_port(Port) -> Port; {'EXIT', {badarg, _}} -> - exit({badarg, mk_port, [{NodeName, Creation}, Number]}); + exit({badarg, mk_port, [{NodeNameExt, Creation}, Number]}); Other -> exit({unexpected_binary_to_term_result, Other}) end. -mk_ref({NodeName, Creation}, Numbers) when is_atom(NodeName), - is_integer(Creation), - is_list(Numbers) -> - mk_ref({atom_to_list(NodeName), Creation}, Numbers); -mk_ref({NodeName, Creation}, [Number]) when is_list(NodeName), - is_integer(Creation), - is_integer(Number) -> +mk_ref({NodeName, Creation}, [Number] = NL) when is_atom(NodeName), + is_integer(Creation), + is_integer(Number) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_ref({NodeNameExt, Creation}, NL); +mk_ref({NodeNameExt, Creation}, [Number]) when is_integer(Creation), + is_integer(Number) -> case catch binary_to_term(list_to_binary([?VERSION_MAGIC, ?REFERENCE_EXT, - ?ATOM_EXT, - uint16_be(length(NodeName)), - NodeName, + NodeNameExt, uint32_be(Number), uint8(Creation)])) of Ref when is_reference(Ref) -> Ref; {'EXIT', {badarg, _}} -> - exit({badarg, mk_ref, [{NodeName, Creation}, [Number]]}); + exit({badarg, mk_ref, [{NodeNameExt, Creation}, [Number]]}); Other -> exit({unexpected_binary_to_term_result, Other}) end; -mk_ref({NodeName, Creation}, Numbers) when is_list(NodeName), +mk_ref({NodeName, Creation}, Numbers) when is_atom(NodeName), is_integer(Creation), is_list(Numbers) -> + <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName), + mk_ref({NodeNameExt, Creation}, Numbers); +mk_ref({NodeNameExt, Creation}, Numbers) when is_integer(Creation), + is_list(Numbers) -> case catch binary_to_term(list_to_binary([?VERSION_MAGIC, ?NEW_REFERENCE_EXT, uint16_be(length(Numbers)), - ?ATOM_EXT, - uint16_be(length(NodeName)), - NodeName, + NodeNameExt, uint8(Creation), lists:map(fun (N) -> uint32_be(N) @@ -754,7 +822,7 @@ mk_ref({NodeName, Creation}, Numbers) when is_list(NodeName), Ref when is_reference(Ref) -> Ref; {'EXIT', {badarg, _}} -> - exit({badarg, mk_ref, [{NodeName, Creation}, Numbers]}); + exit({badarg, mk_ref, [{NodeNameExt, Creation}, Numbers]}); Other -> exit({unexpected_binary_to_term_result, Other}) end. diff --git a/lib/kernel/doc/src/application.xml b/lib/kernel/doc/src/application.xml index 51a3311ec2..9f19efc793 100644 --- a/lib/kernel/doc/src/application.xml +++ b/lib/kernel/doc/src/application.xml @@ -121,6 +121,15 @@ </desc> </func> <func> + <name name="get_env" arity="3"/> + <fsummary>Get the value of a configuration parameter using a default</fsummary> + <desc> + <p>Works like <seealso marker="#get_env/2">get_env/2</seealso> but returns + <c><anno>Def</anno></c> value when configuration parameter + <c><anno>Par</anno></c> does not exist.</p> + </desc> + </func> + <func> <name name="get_key" arity="1"/> <name name="get_key" arity="2"/> <fsummary>Get the value of an application specification key</fsummary> diff --git a/lib/kernel/doc/src/error_handler.xml b/lib/kernel/doc/src/error_handler.xml index acbf9a2c6e..769a869ffa 100644 --- a/lib/kernel/doc/src/error_handler.xml +++ b/lib/kernel/doc/src/error_handler.xml @@ -43,19 +43,52 @@ A (possibly empty) list of arguments <c>Arg1,..,ArgN</c> </type_desc> <desc> - <p>This function is evaluated if a call is made to + <p>This function is called by the run-time system if a call is made to <c><anno>Module</anno>:<anno>Function</anno>(Arg1,.., ArgN)</c> and <c><anno>Module</anno>:<anno>Function</anno>/N</c> is undefined. Note that <c>undefined_function/3</c> is evaluated inside the process making the original call.</p> - <p>If <c><anno>Module</anno></c> is interpreted, the interpreter is invoked - and the return value of the interpreted - <c><anno>Function</anno>(Arg1,.., ArgN)</c> call is returned.</p> - <p>Otherwise, it returns, if possible, the value of - <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> after an attempt has been - made to autoload <c><anno>Module</anno></c>. If this is not possible, the - call to <c><anno>Module</anno>:<anno>Function</anno>(Arg1,.., ArgN)</c> fails with - exit reason <c>undef</c>.</p> + + <p>This function will first attempt to autoload + <c><anno>Module</anno></c>. If that is not possible, + an <c>undef</c> exception will be raised.</p> + + <p>If it was possible to load <c><anno>Module</anno></c> + and the function <c><anno>Function</anno>/N</c> is exported, + it will be called.</p> + + <p>Otherwise, if the function <c>'$handle_undefined_function'/2</c> + is exported, it will be called as + <c>'$handle_undefined_function'(</c><anno>Function</anno>, + <anno>Args</anno>). + </p> + <warning> + <p>Defining <c>'$handle_undefined_function'/2</c> in + ordinary application code is highly discouraged. It is very + easy to make subtle errors that can take a long time to + debug. Furthermore, none of the tools for static code + analysis (such as Dialyzer and Xref) supports the use of + <c>'$handle_undefined_function'/2</c> and no such support + will be added. Only use this function after having carefully + considered other, less dangerous, solutions. One example of + potential legitimate use is creating stubs for other + sub-systems during testing and debugging. + </p> + </warning> + <p>Otherwise an <c>undef</c> exception will be raised.</p> + </desc> + </func> + <func> + <name name="raise_undef_exception" arity="3"/> + <fsummary>Raise an undef exception</fsummary> + <type_desc variable="Args"> + A (possibly empty) list of arguments <c>Arg1,..,ArgN</c> + </type_desc> + <desc> + <p>Raise an <c>undef</c> exception with a stacktrace indicating + that <c><anno>Module</anno>:<anno>Function</anno>/N</c> is + undefined. + </p> </desc> </func> <func> diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml index 536b98b5f5..4a9b7d2ceb 100644 --- a/lib/kernel/doc/src/file.xml +++ b/lib/kernel/doc/src/file.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2012</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -100,7 +100,11 @@ <name name="deep_list"/> </datatype> <datatype> - <name name="fd"/> + <name><marker id="type-fd">fd()</marker></name> + <desc> + <p>A file descriptor representing a file opened in <seealso + marker="#raw">raw</seealso> mode.</p> + </desc> </datatype> <datatype> <name name="filename"/> @@ -109,8 +113,8 @@ <name name="io_device"/> <desc> <p>As returned by - <seealso marker="#open/2">file:open/2</seealso>, - a process handling I/O-protocols.</p> + <seealso marker="#open/2">file:open/2</seealso>; + <c>pid()</c> is a process handling I/O-protocols.</p> </desc> </datatype> <datatype> @@ -170,6 +174,18 @@ </desc> </func> <func> + <name name="allocate" arity="3"/> + <fsummary>Allocate file space</fsummary> + <desc> + <p><c>allocate/3</c> can be used to preallocate space for a file.</p> + <p>This function only succeeds in platforms that implement this + feature. When it succeeds, space is preallocated for the file but + the file size might not be updated. This behaviour depends on the + preallocation implementation. To guarantee the file size is updated + one must truncate the file to the new size.</p> + </desc> + </func> + <func> <name name="change_group" arity="2"/> <fsummary>Change group of a file</fsummary> <desc> @@ -650,7 +666,8 @@ </item> <tag><c>raw</c></tag> <item> - <p>The <c>raw</c> option allows faster access to a file, + <p><marker id="raw"/> + The <c>raw</c> option allows faster access to a file, because no Erlang process is needed to handle the file. However, a file opened in this way has the following limitations:</p> @@ -1239,11 +1256,11 @@ <p>The record <c>file_info</c> contains the following fields.</p> <taglist> - <tag><c>size = integer()</c></tag> + <tag><c>size = integer() >= 0</c></tag> <item> <p>Size of file in bytes.</p> </item> - <tag><c>type = device | directory | regular | other</c></tag> + <tag><c>type = device | directory | other | regular | symlink</c></tag> <item> <p>The type of the file.</p> </item> @@ -1251,22 +1268,22 @@ <item> <p>The current system access to the file.</p> </item> - <tag><c>atime = <seealso marker="#type-date_time">date_time()</seealso> | integer() </c></tag> + <tag><c>atime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag> <item> <p>The last time the file was read.</p> </item> - <tag><c>mtime = <seealso marker="#type-date_time">date_time()</seealso> | integer() </c></tag> + <tag><c>mtime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag> <item> <p>The last time the file was written.</p> </item> - <tag><c>ctime = <seealso marker="#type-date_time">date_time()</seealso> | integer() </c></tag> + <tag><c>ctime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >=0</c></tag> <item> <p>The interpretation of this time field depends on the operating system. On Unix, it is the last time the file or the inode was changed. In Windows, it is the create time.</p> </item> - <tag><c>mode = integer()</c></tag> + <tag><c>mode = integer() >= 0</c></tag> <item> <p>The file permissions as the sum of the following bit values:</p> @@ -1297,33 +1314,33 @@ <p>On Unix platforms, other bits than those listed above may be set.</p> </item> - <tag><c>links = integer()</c></tag> + <tag><c>links = integer() >= 0</c></tag> <item> <p>Number of links to the file (this will always be 1 for file systems which have no concept of links).</p> </item> - <tag><c>major_device = integer()</c></tag> + <tag><c>major_device = integer() >= 0</c></tag> <item> <p>Identifies the file system where the file is located. In Windows, the number indicates a drive as follows: 0 means A:, 1 means B:, and so on.</p> </item> - <tag><c>minor_device = integer()</c></tag> + <tag><c>minor_device = integer() >= 0</c></tag> <item> <p>Only valid for character devices on Unix. In all other cases, this field is zero.</p> </item> - <tag><c>inode = integer()</c></tag> + <tag><c>inode = integer() >= 0</c></tag> <item> <p>Gives the <c>inode</c> number. On non-Unix file systems, this field will be zero.</p> </item> - <tag><c>uid = integer()</c></tag> + <tag><c>uid = integer() >= 0</c></tag> <item> <p>Indicates the owner of the file. Will be zero for non-Unix file systems.</p> </item> - <tag><c>gid = integer()</c></tag> + <tag><c>gid = integer() >= 0</c></tag> <item> <p>Gives the group that the owner of the file belongs to. Will be zero for non-Unix file systems.</p> @@ -1754,22 +1771,22 @@ <p>The following fields are used from the record, if they are given.</p> <taglist> - <tag><c>atime = <seealso marker="#type-date_time">date_time()</seealso> | integer()</c></tag> + <tag><c>atime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag> <item> <p>The last time the file was read.</p> </item> - <tag><c>mtime = <seealso marker="#type-date_time">date_time()</seealso> | integer()</c></tag> + <tag><c>mtime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag> <item> <p>The last time the file was written.</p> </item> - <tag><c>ctime = <seealso marker="#type-date_time">date_time()</seealso> | integer()</c></tag> + <tag><c>ctime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag> <item> <p>On Unix, any value give for this field will be ignored (the "ctime" for the file will be set to the current time). On Windows, this field is the new creation time to set for the file.</p> </item> - <tag><c>mode = integer()</c></tag> + <tag><c>mode = integer() >= 0</c></tag> <item> <p>The file permissions as the sum of the following bit values:</p> @@ -1800,15 +1817,15 @@ <p>On Unix platforms, other bits than those listed above may be set.</p> </item> - <tag><c>uid = integer()</c></tag> + <tag><c>uid = integer() >= 0</c></tag> <item> <p>Indicates the owner of the file. Ignored for non-Unix file systems.</p> </item> - <tag><c>gid = integer()</c></tag> + <tag><c>gid = integer() >= 0</c></tag> <item> <p>Gives the group that the owner of the file belongs to. - Ignored non-Unix file systems.</p> + Ignored for non-Unix file systems.</p> </item> </taglist> <p>Typical error reasons:</p> diff --git a/lib/kernel/doc/src/packages.xml b/lib/kernel/doc/src/packages.xml deleted file mode 100644 index 8a82b91a90..0000000000 --- a/lib/kernel/doc/src/packages.xml +++ /dev/null @@ -1,208 +0,0 @@ -<?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> - <header> - <copyright> - <year>2004</year><year>2012</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. - - </legalnotice> - - <title>packages</title> - <prepared>Kenneth Lundin</prepared> - <responsible>Kenneth Lundin</responsible> - <docno>1</docno> - <approved>Kenneth Lundin</approved> - <checked></checked> - <date>2004-09-07</date> - <rev>A</rev> - <file>packages.sgml</file> - </header> - <module>packages</module> - <modulesummary>Packages in Erlang</modulesummary> - <description> - <warning><p> - Packages has since it was introduced more than 5 years ago been an - experimental feature. Use it at your own risk, we do not - actively maintain and develop this feature. It might however be - supported some - day. - </p> - <p> - In spite of this packages work quite well, but there are some - known issues in tools and other parts where packages don't work well. - </p> - </warning> - <p><em>Introduction</em></p> - <p>Packages are simply namespaces for modules. - All old Erlang modules automatically belong to the top level - ("empty-string") namespace, and do not need any changes.</p> - <p>The full name of a packaged module is written as e.g. - "<c>fee.fie.foe.foo</c>", - i.e., as atoms separated by periods, - where the package name is the part up to - but not including the last period; - in this case "<c>fee.fie.foe</c>". - A more concrete example is the module <c>erl.lang.term</c>, - which is in the - package <c>erl.lang</c>. - Package names can have any number of segments, as in - <c>erl.lang.list.sort</c>. - The atoms in the name can be quoted, as in <c>foo.'Bar'.baz</c>, - or even the - whole name, as in <c>'foo.bar.baz'</c> but the concatenation of - atoms and - periods must not contain two consecutive period characters or - end with a period, - as in <c>'foo..bar'</c>, <c>foo.'.bar'</c>, or <c>foo.'bar.'</c>. - The periods must not be followed by whitespace.</p> - <p>The code loader maps module names onto the file system directory - structure. - E.g., the module <c>erl.lang.term</c> corresponds to a file - <c>.../erl/lang/term.beam</c> - in the search path. - Note that the name of the actual object file corresponds to - the last part only of the full module name. - (Thus, old existing modules such as <c>lists</c> - simply map to <c>.../lists.beam</c>, exactly as before.)</p> - <p>A packaged module in a file "<c>foo/bar/fred.erl</c>" is declared - as:</p> - <code type="none"> --module(foo.bar.fred).</code> - <p>This can be compiled and loaded from the Erlang shell using - <c>c(fred)</c>, if - your current directory is the same as that of the file. - The object file will be named <c>fred.beam</c>.</p> - <p>The Erlang search path works exactly as before, - except that the package segments will be appended to each - directory in the path in order to find the - file. E.g., assume the path is <c>["/usr/lib/erl", "/usr/local/lib/otp/legacy/ebin", "/home/barney/erl"]</c>. - Then, the code for a module named <c>foo.bar.fred</c> will be - searched for - first as <c>"/usr/lib/erl/foo/bar/fred.beam"</c>, then - <c>"/usr/local/lib/otp/legacy/ebin/foo/bar/fred.beam"</c> - and lastly <c>"/home/barney/erl/foo/bar/fred.beam"</c>. - A module - like <c>lists</c>, which is in the top-level package, - will be looked for as <c>"/usr/lib/erl/lists.beam"</c>, - <c>"/usr/local/lib/otp/legacy/ebin/lists.beam"</c> and - <c>"/home/barney/erl/lists.beam"</c>.</p> - <p><em>Programming</em></p> - <p>Normally, if a call is made from one module to another, - it is assumed that the - called module belongs to the same package as the source module. - The compiler - automatically expands such calls. E.g., in:</p> - <code type="none"> --module(foo.bar.m1). --export([f/1]). - -f(X) -> m2:g(X).</code> - <p><c>m2:g(X)</c> becomes a call to <c>foo.bar.m2</c> - If this is not what was intended, the call can be written - explicitly, as in</p> - <code type="none"> --module(foo.bar.m1). --export([f/1]). - -f(X) -> fee.fie.foe.m2:g(X).</code> - <p>Because the called module is given with an explicit package name, - no expansion is done in this case.</p> - <p>If a module from another package is used repeatedly in a module, - an import declaration can make life easier:</p> - <code type="none"> --module(foo.bar.m1). --export([f/1, g/1]). --import(fee.fie.foe.m2). - -f(X) -> m2:g(X). -g(X) -> m2:h(X).</code> - <p>will make the calls to <c>m2</c> refer to <c>fee.fie.foe.m2</c>. - More generally, a declaration <c>-import(Package.Module).</c> - will cause calls to <c>Module</c> - to be expanded to <c>Package.Module</c>.</p> - <p>Old-style function imports work as normal (but full module - names must be - used); e.g.:</p> - <code type="none"> --import(fee.fie.foe.m2, [g/1, h/1]).</code> - <p>however, it is probably better to avoid this form of import - altogether in new - code, since it makes it hard to see what calls are really "remote".</p> - <p>If it is necessary to call a module in the top-level package - from within a - named package, the module name can be written either with an - initial period as - in e.g. "<c>.lists</c>", or with an empty initial atom, as in - "<c>''.lists</c>". - However, the best way is to use an import declaration - - this is most obvious to - the eye, and makes sure we don't forget adding a period somewhere:</p> - <code type="none"> --module(foo.bar.fred). --export([f/1]). --import(lists). - -f(X) -> lists:reverse(X).</code> - <p>The dot-syntax for module names can be used in any expression. - All segments must - be constant atoms, and the result must be a well-formed - package/module name. - E.g.:</p> - <code type="none"> -spawn(foo.bar.fred, f, [X])</code> - <p>is equivalent to <c>spawn('foo.bar.fred', f, [X])</c>.</p> - <p><em>The Erlang Shell</em></p> - <p>The shell also automatically expands remote calls, - however currently no - expansions are made by default. - The user can change the behaviour by using the <c>import/1</c> - shell command (or its abbreviation <c>use/1</c>). E.g.:</p> - <pre> -1> <input>import(foo.bar.m).</input> -ok -2> <input>m:f().</input></pre> - <p>will evaluate <c>foo.bar.m:f()</c>. - If a new import is made of the same name, - this overrides any previous import. - (It is likely that in the future, some - system packages will be pre-imported.)</p> - <p>In addition, the shell command <c>import_all/1</c> - (and its alias <c>use_all/1</c>) - imports all modules currently found in the path for a given - package name. E.g., - assuming the files "<c>.../foo/bar/fred.beam</c>", - "<c>.../foo/bar/barney.beam</c>" - and "<c>.../foo/bar/bambam.beam</c>" can be found from our current - path,</p> - <pre> -1> <input>import_all(foo.bar).</input></pre> - <p>will make <c>fred</c>, <c>barney</c> and <c>bambam</c> - expand to <c>foo.bar.fred</c>, - <c>foo.bar.barney</c> and <c>foo.bar.bambam</c>, respectively.</p> - <p>Note: The compiler does not have an "import all" directive, for the - reason that Erlang has no compile time type checking. - E.g. if the wrong search - path is used at compile time, a call <c>m:f(...)</c> - could be expanded to <c>foo.bar.m:f(...)</c> - without any warning, instead of the intended - <c>frob.ozz.m:f(...)</c>, if - package <c>foo.bar</c> happens to be found first in the path. - Explicitly - declaring each use of a module makes for safe code.</p> - </description> -</erlref> - diff --git a/lib/kernel/doc/src/ref_man.xml b/lib/kernel/doc/src/ref_man.xml index 9ef0959271..67d91ba585 100644 --- a/lib/kernel/doc/src/ref_man.xml +++ b/lib/kernel/doc/src/ref_man.xml @@ -64,6 +64,5 @@ <xi:include href="zlib_stub.xml"/> <xi:include href="app.xml"/> <xi:include href="config.xml"/> - <xi:include href="packages.xml"/> </application> diff --git a/lib/kernel/include/dist.hrl b/lib/kernel/include/dist.hrl index 5b52f6f294..91e13d99a9 100644 --- a/lib/kernel/include/dist.hrl +++ b/lib/kernel/include/dist.hrl @@ -36,3 +36,4 @@ -define(DFLAG_UNICODE_IO,16#1000). -define(DFLAG_DIST_HDR_ATOM_CACHE,16#2000). -define(DFLAG_SMALL_ATOM_TAGS, 16#4000). +-define(DFLAG_UTF8_ATOMS, 16#10000). diff --git a/lib/kernel/include/file.hrl b/lib/kernel/include/file.hrl index bf97173122..69aec1ee36 100644 --- a/lib/kernel/include/file.hrl +++ b/lib/kernel/include/file.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2011. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -22,32 +22,37 @@ %%-------------------------------------------------------------------------- -record(file_info, - {size :: non_neg_integer(), % Size of file in bytes. - type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink', - access :: 'read' | 'write' | 'read_write' | 'none', - atime :: file:date_time() | integer(), % The local time the file was last read: - % {{Year, Mon, Day}, {Hour, Min, Sec}}. - % atime, ctime, mtime may also be unix epochs() - mtime :: file:date_time() | integer(), % The local time the file was last written. - ctime :: file:date_time() | integer(), % The interpretation of this time field - % is dependent on operating system. - % On Unix it is the last time the file - % or the inode was changed. On Windows, - % it is the creation time. - mode :: integer(), % File permissions. On Windows, - % the owner permissions will be - % duplicated for group and user. - links :: non_neg_integer(), % Number of links to the file (1 if the - % filesystem doesn't support links). - major_device :: integer(), % Identifies the file system (Unix), - % or the drive number (A: = 0, B: = 1) - % (Windows). - %% The following are Unix specific. - %% They are set to zero on other operating systems. - minor_device :: integer(), % Only valid for devices. - inode :: integer(), % Inode number for file. - uid :: integer(), % User id for owner. - gid :: integer()}). % Group id for owner. + {size :: non_neg_integer(), % Size of file in bytes. + type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink', + access :: 'read' | 'write' | 'read_write' | 'none', + atime :: file:date_time() | non_neg_integer(), + % The local time the file was last read: + % {{Year, Mon, Day}, {Hour, Min, Sec}}. + % atime, ctime, mtime may also be unix epochs() + mtime :: file:date_time() | non_neg_integer(), + % The local time the file was last written. + ctime :: file:date_time() | non_neg_integer(), + % The interpretation of this time field + % is dependent on operating system. + % On Unix it is the last time the file + % or the inode was changed. On Windows, + % it is the creation time. + mode :: non_neg_integer(), % File permissions. On Windows, + % the owner permissions will be + % duplicated for group and user. + links :: non_neg_integer(), + % Number of links to the file (1 if the + % filesystem doesn't support links). + major_device :: non_neg_integer(), + % Identifies the file system (Unix), + % or the drive number (A: = 0, B: = 1) + % (Windows). + %% The following are Unix specific. + %% They are set to zero on other operating systems. + minor_device :: non_neg_integer(), % Only valid for devices. + inode :: non_neg_integer(), % Inode number for file. + uid :: non_neg_integer(), % User id for owner. + gid :: non_neg_integer()}). % Group id for owner. -record(file_descriptor, diff --git a/lib/kernel/internal_doc/distribution_handshake.txt b/lib/kernel/internal_doc/distribution_handshake.txt index 6a3ee22ed3..d00c4ceb02 100644 --- a/lib/kernel/internal_doc/distribution_handshake.txt +++ b/lib/kernel/internal_doc/distribution_handshake.txt @@ -1,215 +1 @@ -HOW THE DISTRIBUTION HANDSHAKE WORKS ------------------------------------- - -This document describes the distribution handshake introduced in -the R6 release of Erlang/OTP. - -GENERAL -------- - -The TCP/IP distribution uses a handshake which expects a -connection based protocol, i.e. the protocol does not include -any authentication after the handshake procedure. - -This is not entirely safe, as it is vulnerable against takeover -attacks, but it is a tradeoff between fair safety and performance. - -The cookies are never sent in cleartext and the handshake procedure -expects the client (called A) to be the first one to prove that it can -generate a sufficient digest. The digest is generated with the -MD5 message digest algorithm and the challenges are expected to be very -random numbers. - -DEFINITIONS ------------ - -A challenge is a 32 bit integer number in big endian order. Below the function -gen_challenge() returns a random 32 bit integer used as a challenge. - -A digest is a (16 bytes) MD5 hash of [the Challenge (as text) concatenated -with the cookie (as text)]. Below, the function gen_digest(Challenge, Cookie) -generates a digest as described above. - -An out_cookie is the cookie used in outgoing communication to a certain node, -so that A's out_cookie for B should correspond with B's in_cookie for A and -the other way around. A's out_cookie for B and A's in_cookie for B need *NOT* -be the same. Below the function out_cookie(Node) returns the current -node's out_cookie for Node. - -An in_cookie is the cookie expected to be used by another node when -communicating with us, so that A's in_cookie for B corresponds with B's -out_cookie for A. Below the function in_cookie(Node) returns the current -node's in_cookie for Node. - -The cookies are text strings that can be viewed as passwords. - -Every message in the handshake starts with a 16 bit big endian integer -which contains the length of the message (not counting the two initial bytes). -In erlang this corresponds to the gen_tcp option {packet, 2}. Note that after -the handshake, the distribution switches to 4 byte packet headers. - -THE HANDSHAKE IN DETAIL ------------------------ - -Imagine two nodes, node A, which initiates the handshake and node B, which -accepts the connection. - -1) connect/accept: A connects to B via TCP/IP and B accepts the connection. - -2) send_name/receive_name: A sends an initial identification to B. -B receives the message. The message looks -like this (every "square" being one byte and the packet header removed): - -+---+--------+--------+-----+-----+-----+-----+-----+-----+-...-+-----+ -|'n'|Version0|Version1|Flag0|Flag1|Flag2|Flag3|Name0|Name1| ... |NameN| -+---+--------+--------+-----+-----+-----+-----+-----+-----+-... +-----+ - -The 'n' is just a message tag, -Version0 & Version1 is the distribution version selected by node A, - based on information from EPMD. (16 bit big endian) -Flag0 ... Flag3 are capability flags, the capabilities defined in dist.hrl. - (32 bit big endian) -Name0 ... NameN is the full nodename of A, as a string of bytes (the - packet length denotes how long it is). - -3) recv_status/send_status: B sends a status message to A, which indicates -if the connection is allowed. Four different status codes are defined: -ok: The handshake will continue. -ok_simultaneous: The handshake will continue, but A is informed that B - has another ongoing connection attempt that will be - shut down (simultaneous connect where A's name is - greater than B's name, compared literally), -nok: The handshake will not continue, as B already has an ongoing handshake - which it itself has initiated. (simultaneous connect where B's name is - greater than A's) -not_allowed: The connection is disallowed for some (unspecified) security - reason. -alive: A connection to the node is already active, which either means - that node A is confused or that the TCP connection breakdown - of a previous node with this name has not yet reached node B. - See 3B below. - -This is the format of the status message: - -+---+-------+-------+-...-+-------+ -|'s'|Status0|Status1| ... |StatusN| -+---+-------+-------+-...-+-------+ - -'s' is the message tag -Status0 ... StatusN is the status as a string (not terminated) - -3B) send_status/recv_status: If status was 'alive', node A will answer with -another status message containing either 'true' which means that the -connection should continue (The old connection from this node is broken), or -'false', which simply means that the connection should be closed, the -connection attempt was a mistake. - -4) recv_challenge/send_challenge: If the status was 'ok' or 'ok_simultaneous', -The handshake continues with B sending A another message, the challenge. -The challenge contains the same type of information as the "name" message -initially sent from A to B, with the addition of a 32 bit challenge: - -+---+--------+--------+-----+-----+-----+-----+-----+-----+-----+-----+--- -|'n'|Version0|Version1|Flag0|Flag1|Flag2|Flag3|Chal0|Chal1|Chal2|Chal3| -+---+--------+--------+-----+-----+-----+-----+-----+-----+-----+-----+--- - ------+-----+-...-+-----+ - Name0|Name1| ... |NameN| - ------+-----+-... +-----+ - -Where Chal0 ... Chal3 is the challenge as a 32 bit big endian integer -and the other fields are B's version, flags and full nodename. - -5) send_challenge_reply/recv_challenge_reply: Now A has generated -a digest and its own challenge. Those are sent together in a package -to B: - -+---+-----+-----+-----+-----+-----+-----+-----+-----+-...-+------+ -|'r'|Chal0|Chal1|Chal2|Chal3|Dige0|Dige1|Dige2|Dige3| ... |Dige15| -+---+-----+-----+-----+-----+-----+-----+-----+-----+-...-+------+ - -Where 'r' is the tag, Chal0 ... Chal3 is A's challenge for B to handle and -Dige0 ... Dige15 is the digest that A constructed from the challenge B sent -in the previous step. - -6) recv_challenge_ack/send_challenge_ack: B checks that the digest received -from A is correct and generates a digest from the challenge received from -A. The digest is then sent to A. The message looks like this: - -+---+-----+-----+-----+-----+-...-+------+ -|'a'|Dige0|Dige1|Dige2|Dige3| ... |Dige15| -+---+-----+-----+-----+-----+-...-+------+ - -Where 'a' is the tag and Dige0 ... Dige15 is the digest calculated by B -for A's challenge. - -7) A checks the digest from B and the connection is up. - -SEMIGRAPHIC VIEW ----------------- - -A (initiator) B (acceptor) - -TCP connect -----------------------------------------> - TCP accept - -send_name -----------------------------------------> - recv_name - - <---------------------------------------- send_status -recv_status -(if status was 'alive' - send_status - - - - - - - - - - - - - - - - - - - -> - recv_status) - ChB = gen_challenge() - (ChB) - <---------------------------------------- send_challenge -recv_challenge - -ChA = gen_challenge(), -OCA = out_cookie(B), -DiA = gen_digest(ChB,OCA) - (ChA, DiA) -send_challenge_reply --------------------------------> - recv_challenge_reply - ICB = in_cookie(A), - check: - DiA == gen_digest - (ChB, ICB) ? - - if OK: - OCB = out_cookie(A), - DiB = gen_digest - (DiB) (ChA, OCB) - <----------------------------------------- send_challenge_ack -recv_challenge_ack DONE -ICA = in_cookie(B), - else -check: CLOSE -DiB == gen_digest(ChA,ICA) ? -- if OK - DONE -- else - CLOSE - - -THE CURRENTLY DEFINED FLAGS ---------------------------- -Currently the following capability flags are defined: - -%% The node should be published and part of the global namespace --define(DFLAG_PUBLISHED,1). - -%% The node implements an atom cache --define(DFLAG_ATOM_CACHE,2). - -%% The node implements extended (3 * 32 bits) references --define(DFLAG_EXTENDED_REFERENCES,4). - -%% The node implements distributed process monitoring. --define(DFLAG_DIST_MONITOR,8). - -%% The node uses separate tag for fun's (lambdas) in the distribution protocol. --define(DFLAG_FUN_TAGS,16). - -An R6 erlang node implements all of the above, while a C or Java node only -implements DFLAG_EXTENDED_REFERENCES. - -Last modified 1999-11-08 -- Patrik Nyblom, OTP +This information has been moved to the "Distribution Protocol" chapter of "ERTS User's Guide". diff --git a/lib/kernel/src/Makefile b/lib/kernel/src/Makefile index 60291bbce6..2b529a85b0 100644 --- a/lib/kernel/src/Makefile +++ b/lib/kernel/src/Makefile @@ -148,7 +148,7 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) ifeq ($(NATIVE_LIBS_ENABLED),yes) ERL_COMPILE_FLAGS += +native endif -ERL_COMPILE_FLAGS += -I../include +ERL_COMPILE_FLAGS += -I../include -Werror # ---------------------------------------------------- # Targets @@ -170,13 +170,13 @@ docs: # ---------------------------------------------------- ../../hipe/main/hipe.hrl: ../../hipe/vsn.mk ../../hipe/main/hipe.hrl.src - sed -e "s;%VSN%;$(HIPE_VSN);" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl + $(vsn_verbose)sed -e "s;%VSN%;$(HIPE_VSN);" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@ EPMD_FLAGS = -Depmd_port_no=$(EPMD_PORT_NO) \ @@ -186,10 +186,10 @@ EPMD_FLAGS = -Depmd_port_no=$(EPMD_PORT_NO) \ -Derlang_daemon_port=$(EPMD_PORT_NO) $(ESRC)/inet_dns_record_adts.hrl: $(ESRC)/inet_dns_record_adts.pl - LANG=C $(PERL) $< > $@ + $(gen_verbose)LANG=C $(PERL) $< > $@ $(EBIN)/erl_epmd.beam: $(ESRC)/erl_epmd.erl - $(ERLC) $(ERL_COMPILE_FLAGS) $(EPMD_FLAGS) -o$(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) $(EPMD_FLAGS) -o$(EBIN) $< # ---------------------------------------------------- # Release Target diff --git a/lib/kernel/src/application.erl b/lib/kernel/src/application.erl index 9b7c4aa7b8..4e65883be7 100644 --- a/lib/kernel/src/application.erl +++ b/lib/kernel/src/application.erl @@ -23,7 +23,7 @@ which_applications/0, which_applications/1, loaded_applications/0, permit/2]). -export([set_env/3, set_env/4, unset_env/2, unset_env/3]). --export([get_env/1, get_env/2, get_all_env/0, get_all_env/1]). +-export([get_env/1, get_env/2, get_env/3, get_all_env/0, get_all_env/1]). -export([get_key/1, get_key/2, get_all_key/0, get_all_key/1]). -export([get_application/0, get_application/1, info/0]). -export([start_type/0]). @@ -264,6 +264,20 @@ get_env(Key) -> get_env(Application, Key) -> application_controller:get_env(Application, Key). +-spec get_env(Application, Par, Def) -> Val when + Application :: atom(), + Par :: atom(), + Def :: term(), + Val :: term(). + +get_env(Application, Key, Def) -> + case get_env(Application, Key) of + {ok, Val} -> + Val; + undefined -> + Def + end. + -spec get_all_env() -> Env when Env :: [{Par :: atom(), Val :: term()}]. diff --git a/lib/kernel/src/dist_util.erl b/lib/kernel/src/dist_util.erl index e3511988a6..bbb212cebe 100644 --- a/lib/kernel/src/dist_util.erl +++ b/lib/kernel/src/dist_util.erl @@ -115,7 +115,8 @@ make_this_flags(RequestType, OtherNode) -> ?DFLAG_NEW_FLOATS bor ?DFLAG_UNICODE_IO bor ?DFLAG_DIST_HDR_ATOM_CACHE bor - ?DFLAG_SMALL_ATOM_TAGS). + ?DFLAG_SMALL_ATOM_TAGS bor + ?DFLAG_UTF8_ATOMS). handshake_other_started(#hs_data{request_type=ReqType}=HSData0) -> {PreOtherFlags,Node,Version} = recv_name(HSData0), diff --git a/lib/kernel/src/error_handler.erl b/lib/kernel/src/error_handler.erl index f8bc5f499c..a3aa1f1dcf 100644 --- a/lib/kernel/src/error_handler.erl +++ b/lib/kernel/src/error_handler.erl @@ -23,10 +23,12 @@ %% "error_handler: add no_native compiler directive" -compile(no_native). -%% A simple error handler. +%% Callbacks called from the run-time system. +-export([undefined_function/3,undefined_lambda/3,breakpoint/3]). --export([undefined_function/3, undefined_lambda/3, stub_function/3, - breakpoint/3]). +%% Exported utility functions. +-export([raise_undef_exception/3]). +-export([stub_function/3]). -spec undefined_function(Module, Function, Args) -> any() when @@ -41,12 +43,7 @@ undefined_function(Module, Func, Args) -> true -> apply(Module, Func, Args); false -> - case check_inheritance(Module, Args) of - {value, Base, Args1} -> - apply(Base, Func, Args1); - none -> - crash(Module, Func, Args) - end + call_undefined_function_handler(Module, Func, Args) end; {module, _} -> crash(Module, Func, Args); @@ -77,6 +74,14 @@ undefined_lambda(Module, Fun, Args) -> breakpoint(Module, Func, Args) -> (int()):eval(Module, Func, Args). +-spec raise_undef_exception(Module, Function, Args) -> no_return() when + Module :: atom(), + Function :: atom(), + Args :: list(). + +raise_undef_exception(Module, Func, Args) -> + crash({Module,Func,Args,[]}). + %% Used to make the call to the 'int' module a "weak" one, to avoid %% building strong components in xref or dialyzer. @@ -130,27 +135,11 @@ ensure_loaded(Module) -> stub_function(Mod, Func, Args) -> exit({undef,[{Mod,Func,Args,[]}]}). -check_inheritance(Module, Args) -> - Attrs = erlang:get_module_info(Module, attributes), - case lists:keyfind(extends, 1, Attrs) of - {extends, [Base]} when is_atom(Base), Base =/= Module -> - %% This is just a heuristic for detecting abstract modules - %% with inheritance so they can be handled; it would be - %% much better to do it in the emulator runtime - case lists:keyfind(abstract, 1, Attrs) of - {abstract, [true]} -> - case lists:reverse(Args) of - [M|Rs] when tuple_size(M) > 1, - element(1,M) =:= Module, - tuple_size(element(2,M)) > 0, - is_atom(element(1,element(2,M))) -> - {value, Base, lists:reverse(Rs, [element(2,M)])}; - _ -> - {value, Base, Args} - end; - _ -> - {value, Base, Args} - end; - _ -> - none +call_undefined_function_handler(Module, Func, Args) -> + Handler = '$handle_undefined_function', + case erlang:function_exported(Module, Handler, 2) of + false -> + crash(Module, Func, Args); + true -> + Module:Handler(Func, Args) end. diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index de3eaad5a1..16f2dde464 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -38,7 +38,7 @@ %% Specialized -export([ipread_s32bu_p32bu/3]). %% Generic file contents. --export([open/2, close/1, advise/4, +-export([open/2, close/1, advise/4, allocate/3, read/2, write/2, pread/2, pread/3, pwrite/2, pwrite/3, read_line/1, @@ -490,6 +490,18 @@ advise(#file_descriptor{module = Module} = Handle, Offset, Length, Advise) -> advise(_, _, _, _) -> {error, badarg}. +-spec allocate(File, Offset, Length) -> + 'ok' | {'error', posix()} when + File :: io_device(), + Offset :: non_neg_integer(), + Length :: non_neg_integer(). + +allocate(File, Offset, Length) when is_pid(File) -> + R = file_request(File, {allocate, Offset, Length}), + wait_file_reply(File, R); +allocate(#file_descriptor{module = Module} = Handle, Offset, Length) -> + Module:allocate(Handle, Offset, Length). + -spec read(IoDevice, Number) -> {ok, Data} | eof | {error, Reason} when IoDevice :: io_device() | atom(), Number :: non_neg_integer(), diff --git a/lib/kernel/src/file_io_server.erl b/lib/kernel/src/file_io_server.erl index acaffe1e41..fad2ed7fb3 100644 --- a/lib/kernel/src/file_io_server.erl +++ b/lib/kernel/src/file_io_server.erl @@ -211,6 +211,10 @@ file_request({advise,Offset,Length,Advise}, Reply -> {reply,Reply,State} end; +file_request({allocate, Offset, Length}, + #state{handle = Handle} = State) -> + Reply = ?PRIM_FILE:allocate(Handle, Offset, Length), + {reply, Reply, State}; file_request({pread,At,Sz}, #state{handle=Handle,buf=Buf,read_mode=ReadMode}=State) -> case position(Handle, At, Buf) of diff --git a/lib/kernel/src/group.erl b/lib/kernel/src/group.erl index 4d2e31a429..c66e823a04 100644 --- a/lib/kernel/src/group.erl +++ b/lib/kernel/src/group.erl @@ -515,6 +515,27 @@ get_line1({undefined,{_A,Mode,Char},Cs,Cont,Rs}, Drv, Ls0, Encoding) Drv, Ls, Encoding) end; +%% ^R = backward search, ^S = forward search. +%% Search is tricky to implement and does a lot of back-and-forth +%% work with edlin.erl (from stdlib). Edlin takes care of writing +%% and handling lines and escape characters to get out of search, +%% whereas this module does the actual searching and appending to lines. +%% Erlang's shell wasn't exactly meant to traverse the wall between +%% line and line stack, so we at least restrict it by introducing +%% new modes: search, search_quit, search_found. These are added to +%% the regular ones (none, meta_left_sq_bracket) and handle special +%% cases of history search. +get_line1({undefined,{_A,Mode,Char},Cs,Cont,Rs}, Drv, Ls, Encoding) + when ((Mode =:= none) and (Char =:= $\^R)) -> + send_drv_reqs(Drv, Rs), + %% drop current line, move to search mode. We store the current + %% prompt ('N>') and substitute it with the search prompt. + send_drv_reqs(Drv, edlin:erase_line(Cont)), + put(search_quit_prompt, edlin:prompt(Cont)), + Pbs = prompt_bytes("(search)`': ", Encoding), + {more_chars,Ncont,Nrs} = edlin:start(Pbs, search), + send_drv_reqs(Drv, Nrs), + get_line1(edlin:edit_line1(Cs, Ncont), Drv, Ls, Encoding); get_line1({expand, Before, Cs0, Cont,Rs}, Drv, Ls0, Encoding) -> send_drv_reqs(Drv, Rs), ExpandFun = get(expand_fun), @@ -535,8 +556,59 @@ get_line1({undefined,_Char,Cs,Cont,Rs}, Drv, Ls, Encoding) -> send_drv_reqs(Drv, Rs), send_drv(Drv, beep), get_line1(edlin:edit_line(Cs, Cont), Drv, Ls, Encoding); +%% The search item was found and accepted (new line entered on the exact +%% result found) +get_line1({_What,Cont={line,_Prompt,_Chars,search_found},Rs}, Drv, Ls0, Encoding) -> + Line = edlin:current_line(Cont), + %% this may create duplicate entries. + Ls = save_line(new_stack(get_lines(Ls0)), Line), + get_line1({done, Line, "", Rs}, Drv, Ls, Encoding); +%% The search mode has been exited, but the user wants to remain in line +%% editing mode wherever that was, but editing the search result. +get_line1({What,Cont={line,_Prompt,_Chars,search_quit},Rs}, Drv, Ls, Encoding) -> + Line = edlin:current_chars(Cont), + %% Load back the old prompt with the correct line number. + case get(search_quit_prompt) of + undefined -> % should not happen. Fallback. + LsFallback = save_line(new_stack(get_lines(Ls)), Line), + get_line1({done, "\n", Line, Rs}, Drv, LsFallback, Encoding); + Prompt -> % redraw the line and keep going with the same stack position + NCont = {line,Prompt,{lists:reverse(Line),[]},none}, + send_drv_reqs(Drv, Rs), + send_drv_reqs(Drv, edlin:erase_line(Cont)), + send_drv_reqs(Drv, edlin:redraw_line(NCont)), + get_line1({What, NCont ,[]}, Drv, pad_stack(Ls), Encoding) + end; +%% Search mode is entered. +get_line1({What,{line,Prompt,{RevCmd0,_Aft},search},Rs}, + Drv, Ls0, Encoding) -> + send_drv_reqs(Drv, Rs), + %% Figure out search direction. ^S and ^R are returned through edlin + %% whenever we received a search while being already in search mode. + {Search, Ls1, RevCmd} = case RevCmd0 of + [$\^S|RevCmd1] -> + {fun search_down_stack/2, Ls0, RevCmd1}; + [$\^R|RevCmd1] -> + {fun search_up_stack/2, Ls0, RevCmd1}; + _ -> % new search, rewind stack for a proper search. + {fun search_up_stack/2, new_stack(get_lines(Ls0)), RevCmd0} + end, + Cmd = lists:reverse(RevCmd), + {Ls, NewStack} = case Search(Ls1, Cmd) of + {none, Ls2} -> + send_drv(Drv, beep), + {Ls2, {RevCmd, "': "}}; + {Line, Ls2} -> % found. Complete the output edlin couldn't have done. + send_drv_reqs(Drv, [{put_chars, Encoding, Line}]), + {Ls2, {RevCmd, "': "++Line}} + end, + Cont = {line,Prompt,NewStack,search}, + more_data(What, Cont, Drv, Ls, Encoding); get_line1({What,Cont0,Rs}, Drv, Ls, Encoding) -> send_drv_reqs(Drv, Rs), + more_data(What, Cont0, Drv, Ls, Encoding). + +more_data(What, Cont0, Drv, Ls, Encoding) -> receive {Drv,{data,Cs}} -> get_line1(edlin:edit_line(Cs, Cont0), Drv, Ls, Encoding); @@ -557,7 +629,6 @@ get_line1({What,Cont0,Rs}, Drv, Ls, Encoding) -> get_line1(edlin:edit_line([], Cont0), Drv, Ls, Encoding) end. - get_line_echo_off(Chars, Pbs, Drv) -> send_drv_reqs(Drv, [{put_chars, unicode,Pbs}]), get_line_echo_off1(edit_line(Chars,[]), Drv). @@ -632,12 +703,46 @@ save_line({stack, U, {}, []}, Line) -> save_line({stack, U, _L, D}, Line) -> {stack, U, Line, D}. -get_lines({stack, U, {}, []}) -> +get_lines(Ls) -> get_all_lines(Ls). +%get_lines({stack, U, {}, []}) -> +% U; +%get_lines({stack, U, {}, D}) -> +% tl(lists:reverse(D, U)); +%get_lines({stack, U, L, D}) -> +% get_lines({stack, U, {}, [L|D]}). + +%% There's a funny behaviour whenever the line stack doesn't have a "\n" +%% at its end -- get_lines() seemed to work on the assumption it *will* be +%% there, but the manipulations done with search history do not require it. +%% +%% It is an assumption because the function was built with either the full +%% stack being on the 'Up' side (we're on the new line) where it isn't +%% stripped. The only other case when it isn't on the 'Up' side is when +%% someone has used the up/down arrows (or ^P and ^N) to navigate lines, +%% in which case, a line with only a \n is stored at the end of the stack +%% (the \n is returned by edlin:current_line/1). +%% +%% get_all_lines works the same as get_lines, but only strips the trailing +%% character if it's a linebreak. Otherwise it's kept the same. This is +%% because traversing the stack due to search history will *not* insert +%% said empty line in the stack at the same time as other commands do, +%% and thus it should not always be stripped unless we know a new line +%% is the last entry. +get_all_lines({stack, U, {}, []}) -> U; -get_lines({stack, U, {}, D}) -> - tl(lists:reverse(D, U)); -get_lines({stack, U, L, D}) -> - get_lines({stack, U, {}, [L|D]}). +get_all_lines({stack, U, {}, D}) -> + case lists:reverse(D, U) of + ["\n"|Lines] -> Lines; + Lines -> Lines + end; +get_all_lines({stack, U, L, D}) -> + get_all_lines({stack, U, {}, [L|D]}). + +%% For the same reason as above, though, we need to expand the stack +%% in some cases to make sure we play nice with up/down arrows. We need +%% to insert newlines, but not always. +pad_stack({stack, U, L, D}) -> + {stack, U, L, D++["\n"]}. save_line_buffer("\n", Lines) -> save_line_buffer(Lines); @@ -649,6 +754,27 @@ save_line_buffer(Line, Lines) -> save_line_buffer(Lines) -> put(line_buffer, Lines). +search_up_stack(Stack, Substr) -> + case up_stack(Stack) of + {none,NewStack} -> {none,NewStack}; + {L, NewStack} -> + case string:str(L, Substr) of + 0 -> search_up_stack(NewStack, Substr); + _ -> {string:strip(L,right,$\n), NewStack} + end + end. + +search_down_stack(Stack, Substr) -> + case down_stack(Stack) of + {none,NewStack} -> {none,NewStack}; + {L, NewStack} -> + case string:str(L, Substr) of + 0 -> search_down_stack(NewStack, Substr); + _ -> {string:strip(L,right,$\n), NewStack} + end + end. + + %% This is get_line without line editing (except for backspace) and %% without echo. get_password_line(Chars, Drv) -> @@ -687,7 +813,7 @@ edit_password([$\177|Cs],[_|Chars]) ->%% is backspace enough? edit_password([Char|Cs],Chars) -> edit_password(Cs,[Char|Chars]). -%% prompt_bytes(Prompt) +%% prompt_bytes(Prompt, Encoding) %% Return a flat list of characters for the Prompt. prompt_bytes(Prompt, Encoding) -> lists:flatten(io_lib:format_prompt(Prompt, Encoding)). diff --git a/lib/kernel/src/inet_parse.erl b/lib/kernel/src/inet_parse.erl index 3551e701b6..a7ac6ce040 100644 --- a/lib/kernel/src/inet_parse.erl +++ b/lib/kernel/src/inet_parse.erl @@ -464,7 +464,7 @@ strict_address(Cs) when is_list(Cs) -> _ -> ipv6strict_address(Cs) end; -strict_address(Cs) -> +strict_address(_) -> {error, einval}. %% diff --git a/lib/kernel/src/ram_file.erl b/lib/kernel/src/ram_file.erl index 48ea871433..ca881ff8a4 100644 --- a/lib/kernel/src/ram_file.erl +++ b/lib/kernel/src/ram_file.erl @@ -29,6 +29,7 @@ %% Specialized file operations -export([get_size/1, get_file/1, set_file/2, get_file_close/1]). -export([compress/1, uncompress/1, uuencode/1, uudecode/1, advise/4]). +-export([allocate/3]). -export([open_mode/1]). %% used by ftp-file @@ -72,6 +73,7 @@ -define(RAM_FILE_UUDECODE, 36). -define(RAM_FILE_SIZE, 37). -define(RAM_FILE_ADVISE, 38). +-define(RAM_FILE_ALLOCATE, 39). %% Open modes for RAM_FILE_OPEN -define(RAM_FILE_MODE_READ, 1). @@ -383,6 +385,11 @@ advise(#file_descriptor{module = ?MODULE, data = Port}, Offset, advise(#file_descriptor{}, _Offset, _Length, _Advise) -> {error, enotsup}. +allocate(#file_descriptor{module = ?MODULE, data = Port}, Offset, Length) -> + call_port(Port, <<?RAM_FILE_ALLOCATE, Offset:64/signed, Length:64/signed>>); +allocate(#file_descriptor{}, _Offset, _Length) -> + {error, enotsup}. + %%%----------------------------------------------------------------- diff --git a/lib/kernel/test/Makefile b/lib/kernel/test/Makefile index 7fd3afe93c..8d2d55777b 100644 --- a/lib/kernel/test/Makefile +++ b/lib/kernel/test/Makefile @@ -48,6 +48,7 @@ MODULES= \ erl_distribution_SUITE \ erl_distribution_wb_SUITE \ erl_prim_loader_SUITE \ + error_handler_SUITE \ error_logger_SUITE \ error_logger_warn_SUITE \ file_SUITE \ diff --git a/lib/kernel/test/application_SUITE.erl b/lib/kernel/test/application_SUITE.erl index f469a0af98..2ca8840e1f 100644 --- a/lib/kernel/test/application_SUITE.erl +++ b/lib/kernel/test/application_SUITE.erl @@ -27,7 +27,7 @@ otp_1586/1, otp_2078/1, otp_2012/1, otp_2718/1, otp_2973/1, otp_3002/1, otp_3184/1, otp_4066/1, otp_4227/1, otp_5363/1, otp_5606/1, - start_phases/1, get_key/1, + start_phases/1, get_key/1, get_env/1, permit_false_start_local/1, permit_false_start_dist/1, script_start/1, nodedown_start/1, init2973/0, loop2973/0, loop5606/1]). @@ -49,7 +49,7 @@ all() -> [failover, failover_comp, permissions, load, load_use_cache, {group, reported_bugs}, start_phases, script_start, nodedown_start, permit_false_start_local, - permit_false_start_dist, get_key, + permit_false_start_dist, get_key, get_env, {group, distr_changed}, config_change, shutdown_func, shutdown_timeout]. groups() -> @@ -1503,6 +1503,15 @@ loop5606(Pid) -> Pid ! {self(), Res} end. +get_env(suite) -> []; +get_env(doc) -> + ["Tests get_env/* functions"]; +get_env(Conf) when is_list(Conf) -> + {ok, _} = application:get_env(kernel, error_logger), + undefined = application:get_env(undefined_app, a), + undefined = application:get_env(kernel, error_logger_xyz), + default = application:get_env(kernel, error_logger_xyz, default), + ok. %%----------------------------------------------------------------- %% Should be started in a CC view with: diff --git a/lib/kernel/test/error_handler_SUITE.erl b/lib/kernel/test/error_handler_SUITE.erl new file mode 100644 index 0000000000..2a86d39b74 --- /dev/null +++ b/lib/kernel/test/error_handler_SUITE.erl @@ -0,0 +1,68 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2013. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(error_handler_SUITE). + +-export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1, + init_per_group/2,end_per_group/2, + undefined_function_handler/1]). + +%% Callback from error_handler. +-export(['$handle_undefined_function'/2]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [undefined_function_handler]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +%%----------------------------------------------------------------- + +undefined_function_handler(_) -> + 42 = ?MODULE:forty_two(), + 42 = (id(?MODULE)):forty_two(), + {ok,{a,b,c}} = ?MODULE:one_arg({a,b,c}), + {ok,{a,b,c}} = (id(?MODULE)):one_arg({a,b,c}), + {'EXIT',{undef,[{?MODULE,undef_and_not_handled,[[1,2,3]],[]}|_]}} = + (catch ?MODULE:undef_and_not_handled([1,2,3])), + ok. + +'$handle_undefined_function'(forty_two, []) -> + 42; +'$handle_undefined_function'(one_arg, [Arg]) -> + {ok,Arg}; +'$handle_undefined_function'(Func, Args) -> + error_handler:raise_undef_exception(?MODULE, Func, Args). + +id(I) -> + I. diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index 9c507fd437..f34341f561 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -60,7 +60,8 @@ -export([ read_not_really_compressed/1, read_compressed_cooked/1, read_compressed_cooked_binary/1, read_cooked_tar_problem/1, - write_compressed/1, compress_errors/1, catenated_gzips/1]). + write_compressed/1, compress_errors/1, catenated_gzips/1, + compress_async_crash/1]). -export([ make_link/1, read_link_info_for_non_link/1, symlinks/1]). @@ -84,6 +85,8 @@ -export([advise/1]). +-export([allocate/1]). + -export([standard_io/1,mini_server/1]). %% Debug exports @@ -116,7 +119,7 @@ groups() -> {files, [], [{group, open}, {group, pos}, {group, file_info}, {group, consult}, {group, eval}, {group, script}, - truncate, sync, datasync, advise]}, + truncate, sync, datasync, advise, allocate]}, {open, [], [open1, old_modes, new_modes, path_open, close, access, read_write, pread_write, append, open_errors, @@ -133,7 +136,8 @@ groups() -> {compression, [], [read_compressed_cooked, read_compressed_cooked_binary, read_cooked_tar_problem, read_not_really_compressed, - write_compressed, compress_errors, catenated_gzips]}, + write_compressed, compress_errors, catenated_gzips, + compress_async_crash]}, {links, [], [make_link, read_link_info_for_non_link, symlinks]}]. @@ -1617,6 +1621,74 @@ advise(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. +allocate(suite) -> []; +allocate(doc) -> "Tests that ?FILE_MODULE:allocate/3 at least doesn't crash."; +allocate(Config) when is_list(Config) -> + ?line Dog = test_server:timetrap(test_server:seconds(5)), + ?line PrivDir = ?config(priv_dir, Config), + ?line Allocate = filename:join(PrivDir, + atom_to_list(?MODULE) + ++"_allocate.fil"), + + Line1 = "Hello\n", + Line2 = "World!\n", + + ?line {ok, Fd} = ?FILE_MODULE:open(Allocate, [write, binary]), + allocate_and_assert(Fd, 1, iolist_size([Line1, Line2])), + ?line ok = io:format(Fd, "~s", [Line1]), + ?line ok = io:format(Fd, "~s", [Line2]), + ?line ok = ?FILE_MODULE:close(Fd), + + ?line {ok, Fd2} = ?FILE_MODULE:open(Allocate, [write, binary]), + allocate_and_assert(Fd2, 1, iolist_size(Line1)), + ?line ok = io:format(Fd2, "~s", [Line1]), + ?line ok = io:format(Fd2, "~s", [Line2]), + ?line ok = ?FILE_MODULE:close(Fd2), + + ?line {ok, Fd3} = ?FILE_MODULE:open(Allocate, [write, binary]), + allocate_and_assert(Fd3, 1, iolist_size(Line1) + 1), + ?line ok = io:format(Fd3, "~s", [Line1]), + ?line ok = io:format(Fd3, "~s", [Line2]), + ?line ok = ?FILE_MODULE:close(Fd3), + + ?line {ok, Fd4} = ?FILE_MODULE:open(Allocate, [write, binary]), + allocate_and_assert(Fd4, 1, 4 * iolist_size([Line1, Line2])), + ?line ok = io:format(Fd4, "~s", [Line1]), + ?line ok = io:format(Fd4, "~s", [Line2]), + ?line ok = ?FILE_MODULE:close(Fd4), + + ?line [] = flush(), + ?line test_server:timetrap_cancel(Dog), + ok. + +allocate_and_assert(Fd, Offset, Length) -> + % Just verify that calls to ?PRIM_FILE:allocate/3 don't crash or have + % any other negative side effect. We can't really asssert against a + % specific return value, because support for file space pre-allocation + % depends on the OS, OS version and underlying filesystem. + % + % The Linux kernel added support for fallocate() in version 2.6.23, + % which currently works only for the ext4, ocfs2, xfs and btrfs file + % systems. posix_fallocate() is available in glibc as of version + % 2.1.94, but it was buggy until glibc version 2.7. + % + % Mac OS X, as of version 10.3, supports the fcntl operation F_PREALLOCATE. + % + % Solaris supports posix_fallocate() but only for the UFS file system + % apparently (not supported for ZFS). + % + % FreeBSD 9.0 is the first FreeBSD release supporting posix_fallocate(). + % + % For Windows there's apparently no way to pre-allocate file space, at + % least with same semantics as posix_fallocate(), fallocate() and + % fcntl F_PREALLOCATE. + Result = ?FILE_MODULE:allocate(Fd, Offset, Length), + case os:type() of + {win32, _} -> + ?line {error, enotsup} = Result; + _ -> + ?line _ = Result + end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2242,6 +2314,57 @@ compress_errors(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +compress_async_crash(suite) -> []; +compress_async_crash(doc) -> []; +compress_async_crash(Config) when is_list(Config) -> + ?line DataDir = ?config(data_dir, Config), + ?line Path = filename:join(DataDir, "test.gz"), + ExpectedData = <<"qwerty">>, + + ?line _ = ?FILE_MODULE:delete(Path), + ?line {ok, Fd} = ?FILE_MODULE:open(Path, [write, binary, compressed]), + ?line ok = ?FILE_MODULE:write(Fd, ExpectedData), + ?line ok = ?FILE_MODULE:close(Fd), + + % Test that when using async thread pool, the emulator doesn't crash + % when the efile port driver is stopped while a compressed file operation + % is in progress (being carried by an async thread). + ?line ok = compress_async_crash_loop(10000, Path, ExpectedData), + ?line ok = ?FILE_MODULE:delete(Path), + ok. + +compress_async_crash_loop(0, _Path, _ExpectedData) -> + ok; +compress_async_crash_loop(N, Path, ExpectedData) -> + Parent = self(), + {Pid, Ref} = spawn_monitor( + fun() -> + ?line {ok, Fd} = ?FILE_MODULE:open( + Path, [read, compressed, raw, binary]), + Len = byte_size(ExpectedData), + Parent ! {self(), continue}, + ?line {ok, ExpectedData} = ?FILE_MODULE:read(Fd, Len), + ?line ok = ?FILE_MODULE:close(Fd), + receive foobar -> ok end + end), + receive + {Pid, continue} -> + exit(Pid, shutdown), + receive + {'DOWN', Ref, _, _, Reason} -> + ?line shutdown = Reason + end; + {'DOWN', Ref, _, _, Reason2} -> + test_server:fail({worker_exited, Reason2}) + after 60000 -> + exit(Pid, shutdown), + erlang:demonitor(Ref, [flush]), + test_server:fail(worker_timeout) + end, + compress_async_crash_loop(N - 1, Path, ExpectedData). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + altname(doc) -> "Test the file:altname/1 function"; altname(suite) -> diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index 5d45b91ee5..a72e76f813 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -42,12 +42,13 @@ killing_acceptor/1,killing_multi_acceptors/1,killing_multi_acceptors2/1, several_accepts_in_one_go/1, accept_system_limit/1, active_once_closed/1, send_timeout/1, send_timeout_active/1, - otp_7731/1, zombie_sockets/1, otp_7816/1, otp_8102/1, + otp_7731/1, zombie_sockets/1, otp_7816/1, otp_8102/1, wrapping_oct/1, otp_9389/1]). %% Internal exports. -export([sender/3, not_owner/1, passive_sockets_server/2, priority_server/1, - otp_7731_server/1, zombie_server/2]). + oct_acceptor/1, + otp_7731_server/1, zombie_server/2, do_iter_max_socks/2]). init_per_testcase(_Func, Config) when is_list(Config) -> Dog = test_server:timetrap(test_server:seconds(240)), @@ -75,6 +76,7 @@ all() -> killing_acceptor, killing_multi_acceptors, killing_multi_acceptors2, several_accepts_in_one_go, accept_system_limit, active_once_closed, send_timeout, send_timeout_active, otp_7731, + wrapping_oct, zombie_sockets, otp_7816, otp_8102, otp_9389]. groups() -> @@ -589,7 +591,13 @@ iter_max_socks(doc) -> "that we get the same number of sockets every time."]; iter_max_socks(Config) when is_list(Config) -> N = 20, - L = do_iter_max_socks(N, initalize), + %% Run on a different node in order to limit the effect if this test fails. + Dir = filename:dirname(code:which(?MODULE)), + {ok,Node} = test_server:start_node(test_iter_max_socks,slave, + [{args,"-pa " ++ Dir}]), + L = rpc:call(Node,?MODULE,do_iter_max_socks,[N, initalize]), + test_server:stop_node(Node), + io:format("Result: ~p",[L]), all_equal(L), {comment, "Max sockets: " ++ integer_to_list(hd(L))}. @@ -2575,3 +2583,71 @@ otp_9389_loop(S, OrigLinkHdr, State) -> 3000 -> ?line error({timeout,header}) end. + +wrapping_oct(doc) -> + "Check that 64bit octet counters work."; +wrapping_oct(suite) -> + []; +wrapping_oct(Config) when is_list(Config) -> + Dog = test_server:timetrap(test_server:seconds(600)), + {ok,Sock} = gen_tcp:listen(0,[{active,false},{mode,binary}]), + {ok,Port} = inet:port(Sock), + spawn_link(?MODULE,oct_acceptor,[Sock]), + Res = oct_datapump(Port,16#1FFFFFFFF), + gen_tcp:close(Sock), + test_server:timetrap_cancel(Dog), + ok = Res, + ok. + +oct_datapump(Port,N) -> + {ok,Sock} = gen_tcp:connect("localhost",Port, + [{active,false},{mode,binary}]), + oct_pump(Sock,N,binary:copy(<<$a:8>>,100000),0). + +oct_pump(S,N,_,_) when N =< 0 -> + gen_tcp:close(S), + ok; +oct_pump(S,N,Bin,Last) -> + case gen_tcp:send(S,Bin) of + ok -> + {ok,Stat}=inet:getstat(S), + {_,R}=lists:keyfind(send_oct,1,Stat), + case (R < Last) of + true -> + io:format("ERROR (output) ~p < ~p~n",[R,Last]), + output_counter_error; + false -> + oct_pump(S,N-byte_size(Bin),Bin,R) + end; + _ -> + input_counter_error + end. + + +oct_acceptor(Sock) -> + {ok,Data} = gen_tcp:accept(Sock), + oct_aloop(Data,0,0). + +oct_aloop(S,X,Times) -> + case gen_tcp:recv(S,0) of + {ok,_} -> + {ok,Stat}=inet:getstat(S), + {_,R}=lists:keyfind(recv_oct,1,Stat), + case (R < X) of + true -> + io:format("ERROR ~p < ~p~n",[R,X]), + gen_tcp:close(S), + input_counter_error; + false -> + case Times rem 16#FFFFF of + 0 -> + io:format("Read: ~p~n",[R]); + _ -> + ok + end, + oct_aloop(S,R,Times+1) + end; + _ -> + gen_tcp:close(S), + closed + end. diff --git a/lib/kernel/test/global_SUITE.erl b/lib/kernel/test/global_SUITE.erl index b40c50f79f..9428a38660 100644 --- a/lib/kernel/test/global_SUITE.erl +++ b/lib/kernel/test/global_SUITE.erl @@ -91,27 +91,9 @@ end_per_group(_GroupName, Config) -> Config. init_per_suite(Config) -> - - %% Copied from test_server_ctrl ln 647, we have to do this here as - %% the test_server only does this when run without common_test - global:sync(), - case global:whereis_name(test_server) of - undefined -> - io:format(user, "Registering test_server globally!~n",[]), - global:register_name(test_server, whereis(test_server_ctrl)); - Pid -> - case node() of - N when N == node(Pid) -> - io:format(user, "Warning: test_server already running!\n", []), - global:re_register_name(test_server,self()); - _ -> - ok - end - end, Config. end_per_suite(_Config) -> - global:unregister_name(test_server), ok. @@ -135,8 +117,7 @@ end_per_testcase(_Case, Config) -> ?line write_high_level_trace(Config), ?line _ = gen_server:call(global_name_server, high_level_trace_stop, infinity), - ?line[global:unregister_name(N) || N <- global:registered_names(), - N =/= test_server], + [global:unregister_name(N) || N <- global:registered_names()], ?line InitRegistered = ?registered, ?line Registered = registered(), ?line [io:format("~s local names: ~p~n", [What, N]) || @@ -1840,16 +1821,16 @@ do_otp_3162(StartFun, Config) -> ?line ?UNTIL ([Cp3] =:= lists:sort(rpc:call(Cp1, erlang, nodes, [])) -- [node()]), - ?line ?UNTIL([kalle, test_server, vera] =:= + ?UNTIL([kalle, vera] =:= lists:sort(rpc:call(Cp1, global, registered_names, []))), ?line ?UNTIL ([Cp3] =:= lists:sort(rpc:call(Cp2, erlang, nodes, [])) -- [node()]), - ?line ?UNTIL([stina, test_server, vera] =:= + ?UNTIL([stina, vera] =:= lists:sort(rpc:call(Cp2, global, registered_names, []))), ?line ?UNTIL ([Cp1, Cp2] =:= lists:sort(rpc:call(Cp3, erlang, nodes, [])) -- [node()]), - ?line ?UNTIL([kalle, stina, test_server, vera] =:= + ?UNTIL([kalle, stina, vera] =:= lists:sort(rpc:call(Cp3, global, registered_names, []))), ?line pong = rpc:call(Cp2, net_adm, ping, [Cp1]), @@ -1860,17 +1841,17 @@ do_otp_3162(StartFun, Config) -> ?line ?UNTIL(begin NN = lists:sort(rpc:call(Cp1, global, registered_names, [])), - [kalle, stina, test_server, vera] =:= NN + [kalle, stina, vera] =:= NN end), ?line ?UNTIL ([Cp1, Cp3] =:= lists:sort(rpc:call(Cp2, erlang, nodes, [])) -- [node()]), - ?line ?UNTIL([kalle, stina, test_server, vera] =:= + ?UNTIL([kalle, stina, vera] =:= lists:sort(rpc:call(Cp2, global, registered_names, []))), ?line ?UNTIL ([Cp1, Cp2] =:= lists:sort(rpc:call(Cp3, erlang, nodes, [])) -- [node()]), - ?line ?UNTIL([kalle, stina, test_server, vera] =:= + ?UNTIL([kalle, stina, vera] =:= lists:sort(rpc:call(Cp3, global, registered_names, []))), write_high_level_trace(Config), @@ -4154,7 +4135,7 @@ init_condition(Config) -> {"Global Locks (ETS)", global_locks}, {"Global Pid Names (ETS)", global_pid_names}, {"Global Pid Ids (ETS)", global_pid_ids}]], - ?UNTIL([test_server] =:= global:registered_names()), + ?UNTIL([] =:= global:registered_names()), ?UNTIL([] =:= nodes()), ?UNTIL([node()] =:= get_known(node())), ok. diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl index a56746bbc4..4e93a593b3 100644 --- a/lib/kernel/test/prim_file_SUITE.erl +++ b/lib/kernel/test/prim_file_SUITE.erl @@ -57,6 +57,8 @@ %% System probe functions that might be handy to check from the shell -export([unix_free/1]). +-export([allocate/1]). + -include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). @@ -87,7 +89,7 @@ groups() -> cur_dir_1a, cur_dir_1b]}, {files, [], [{group, open}, {group, pos}, {group, file_info}, - truncate, sync, datasync, advise, large_write]}, + truncate, sync, datasync, advise, large_write, allocate]}, {open, [], [open1, modes, close, access, read_write, pread_write, append, exclusive]}, @@ -1359,6 +1361,76 @@ check_large_write(Dog, Fd, _, _, []) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +allocate(suite) -> []; +allocate(doc) -> "Tests that ?PRIM_FILE:allocate/3 at least doesn't crash."; +allocate(Config) when is_list(Config) -> + ?line Dog = test_server:timetrap(test_server:seconds(5)), + ?line PrivDir = ?config(priv_dir, Config), + ?line Allocate = filename:join(PrivDir, + atom_to_list(?MODULE) + ++"_allocate.fil"), + + Line1 = "Hello\n", + Line2 = "World!\n", + + ?line {ok, Fd} = ?PRIM_FILE:open(Allocate, [write, binary]), + allocate_and_assert(Fd, 1, iolist_size([Line1, Line2])), + ?line ok = ?PRIM_FILE:write(Fd, Line1), + ?line ok = ?PRIM_FILE:write(Fd, Line2), + ?line ok = ?PRIM_FILE:close(Fd), + + ?line {ok, Fd2} = ?PRIM_FILE:open(Allocate, [write, binary]), + allocate_and_assert(Fd2, 1, iolist_size(Line1)), + ?line ok = ?PRIM_FILE:write(Fd2, Line1), + ?line ok = ?PRIM_FILE:write(Fd2, Line2), + ?line ok = ?PRIM_FILE:close(Fd2), + + ?line {ok, Fd3} = ?PRIM_FILE:open(Allocate, [write, binary]), + allocate_and_assert(Fd3, 1, iolist_size(Line1) + 1), + ?line ok = ?PRIM_FILE:write(Fd3, Line1), + ?line ok = ?PRIM_FILE:write(Fd3, Line2), + ?line ok = ?PRIM_FILE:close(Fd3), + + ?line {ok, Fd4} = ?PRIM_FILE:open(Allocate, [write, binary]), + allocate_and_assert(Fd4, 1, 4 * iolist_size([Line1, Line2])), + ?line ok = ?PRIM_FILE:write(Fd4, Line1), + ?line ok = ?PRIM_FILE:write(Fd4, Line2), + ?line ok = ?PRIM_FILE:close(Fd4), + + ?line test_server:timetrap_cancel(Dog), + ok. + +allocate_and_assert(Fd, Offset, Length) -> + % Just verify that calls to ?PRIM_FILE:allocate/3 don't crash or have + % any other negative side effect. We can't really asssert against a + % specific return value, because support for file space pre-allocation + % depends on the OS, OS version and underlying filesystem. + % + % The Linux kernel added support for fallocate() in version 2.6.23, + % which currently works only for the ext4, ocfs2, xfs and btrfs file + % systems. posix_fallocate() is available in glibc as of version + % 2.1.94, but it was buggy until glibc version 2.7. + % + % Mac OS X, as of version 10.3, supports the fcntl operation F_PREALLOCATE. + % + % Solaris supports posix_fallocate() but only for the UFS file system + % apparently (not supported for ZFS). + % + % FreeBSD 9.0 is the first FreeBSD release supporting posix_fallocate(). + % + % For Windows there's apparently no way to pre-allocate file space, at + % least with similar API/semantics as posix_fallocate(), fallocate() or + % fcntl F_PREALLOCATE. + Result = ?PRIM_FILE:allocate(Fd, Offset, Length), + case os:type() of + {win32, _} -> + ?line {error, enotsup} = Result; + _ -> + ?line _ = Result + end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + delete_a(suite) -> []; delete_a(doc) -> []; delete_a(Config) when is_list(Config) -> diff --git a/lib/megaco/aclocal.m4 b/lib/megaco/aclocal.m4 new file mode 100644 index 0000000000..918e30a886 --- /dev/null +++ b/lib/megaco/aclocal.m4 @@ -0,0 +1,1905 @@ +dnl +dnl %CopyrightBegin% +dnl +dnl Copyright Ericsson AB 1998-2012. All Rights Reserved. +dnl +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. +dnl +dnl %CopyrightEnd% +dnl + +dnl +dnl aclocal.m4 +dnl +dnl Local macros used in configure.in. The Local Macros which +dnl could/should be part of autoconf are prefixed LM_, macros specific +dnl to the Erlang system are prefixed ERL_. +dnl + +AC_DEFUN(LM_PRECIOUS_VARS, +[ + +dnl ERL_TOP +AC_ARG_VAR(ERL_TOP, [Erlang/OTP top source directory]) + +dnl Tools +AC_ARG_VAR(CC, [C compiler]) +AC_ARG_VAR(CFLAGS, [C compiler flags]) +AC_ARG_VAR(STATIC_CFLAGS, [C compiler static flags]) +AC_ARG_VAR(CFLAG_RUNTIME_LIBRARY_PATH, [runtime library path linker flag passed via C compiler]) +AC_ARG_VAR(CPP, [C/C++ preprocessor]) +AC_ARG_VAR(CPPFLAGS, [C/C++ preprocessor flags]) +AC_ARG_VAR(CXX, [C++ compiler]) +AC_ARG_VAR(CXXFLAGS, [C++ compiler flags]) +AC_ARG_VAR(LD, [linker (is often overridden by configure)]) +AC_ARG_VAR(LDFLAGS, [linker flags (can be risky to set since LD may be overriden by configure)]) +AC_ARG_VAR(LIBS, [libraries]) +AC_ARG_VAR(DED_LD, [linker for Dynamic Erlang Drivers (set all DED_LD* variables or none)]) +AC_ARG_VAR(DED_LDFLAGS, [linker flags for Dynamic Erlang Drivers (set all DED_LD* variables or none)]) +AC_ARG_VAR(DED_LD_FLAG_RUNTIME_LIBRARY_PATH, [runtime library path linker flag for Dynamic Erlang Drivers (set all DED_LD* variables or none)]) +AC_ARG_VAR(LFS_CFLAGS, [large file support C compiler flags (set all LFS_* variables or none)]) +AC_ARG_VAR(LFS_LDFLAGS, [large file support linker flags (set all LFS_* variables or none)]) +AC_ARG_VAR(LFS_LIBS, [large file support libraries (set all LFS_* variables or none)]) +AC_ARG_VAR(RANLIB, [ranlib]) +AC_ARG_VAR(AR, [ar]) +AC_ARG_VAR(GETCONF, [getconf]) + +dnl Cross system root +AC_ARG_VAR(erl_xcomp_sysroot, [Absolute cross system root path (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only used when cross compiling)]) + +dnl Cross compilation variables +AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_usable_sigaltstack, [have working sigaltstack(): yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_poll, [have working poll(): yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_kqueue, [have working kqueue(): yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_putenv_copy, [putenv() stores key-value copy: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_reliable_fpe, [have reliable floating point exceptions: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_getaddrinfo, [have working getaddrinfo() for both IPv4 and IPv6: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_gethrvtime_procfs_ioctl, [have working gethrvtime() which can be used with procfs ioctl(): yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_clock_gettime_cpu_time, [clock_gettime() can be used for retrieving process CPU time: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_after_morecore_hook, [__after_morecore_hook can track malloc()s core memory usage: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_dlsym_brk_wrappers, [dlsym(RTLD_NEXT, _) brk wrappers can track malloc()s core memory usage: yes|no (only used when cross compiling)]) + +]) + +AC_DEFUN(ERL_XCOMP_SYSROOT_INIT, +[ +erl_xcomp_without_sysroot=no +if test "$cross_compiling" = "yes"; then + test "$erl_xcomp_sysroot" != "" || erl_xcomp_without_sysroot=yes + test "$erl_xcomp_isysroot" != "" || erl_xcomp_isysroot="$erl_xcomp_sysroot" +else + erl_xcomp_sysroot= + erl_xcomp_isysroot= +fi +]) + +AC_DEFUN(LM_CHECK_GETCONF, +[ +if test "$cross_compiling" != "yes"; then + AC_CHECK_PROG([GETCONF], [getconf], [getconf], [false]) +else + dnl First check if we got a `<HOST>-getconf' in $PATH + host_getconf="$host_alias-getconf" + AC_CHECK_PROG([GETCONF], [$host_getconf], [$host_getconf], [false]) + if test "$GETCONF" = "false" && test "$erl_xcomp_sysroot" != ""; then + dnl We should perhaps give up if we have'nt found it by now, but at + dnl least in one Tilera MDE `getconf' under sysroot is a bourne + dnl shell script which we can use. We try to find `<HOST>-getconf' + dnl or `getconf' under sysconf, but only under sysconf since + dnl `getconf' in $PATH is almost guaranteed to be for the build + dnl machine. + GETCONF= + prfx="$erl_xcomp_sysroot" + AC_PATH_TOOL([GETCONF], [getconf], [false], + ["$prfx/usr/bin:$prfx/bin:$prfx/usr/local/bin"]) + fi +fi +]) + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_WINDOWS_ENVIRONMENT +dnl +dnl +dnl Tries to determine thw windows build environment, i.e. +dnl MIXED_CYGWIN_VC or MIXED_MSYS_VC +dnl + +AC_DEFUN(LM_WINDOWS_ENVIRONMENT, +[ +MIXED_CYGWIN=no +MIXED_MSYS=no + +AC_MSG_CHECKING(for mixed cygwin or msys and native VC++ environment) +if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then + if test -x /usr/bin/cygpath; then + CFLAGS="-O2" + MIXED_CYGWIN=yes + AC_MSG_RESULT([Cygwin and VC]) + MIXED_CYGWIN_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_VC" + elif test -x /usr/bin/msysinfo; then + CFLAGS="-O2" + MIXED_MSYS=yes + AC_MSG_RESULT([MSYS and VC]) + MIXED_MSYS_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MSYS_VC" + else + AC_MSG_RESULT([undeterminable]) + AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!) + fi +else + AC_MSG_RESULT([no]) + MIXED_CYGWIN_VC=no + MIXED_MSYS_VC=no +fi +AC_SUBST(MIXED_CYGWIN_VC) +AC_SUBST(MIXED_MSYS_VC) + +MIXED_VC=no +if test "x$MIXED_MSYS_VC" = "xyes" -o "x$MIXED_CYGWIN_VC" = "xyes" ; then + MIXED_VC=yes +fi + +AC_SUBST(MIXED_VC) + +if test "x$MIXED_MSYS" != "xyes"; then + AC_MSG_CHECKING(for mixed cygwin and native MinGW environment) + if test "X$host" = "Xwin32" -a "x$GCC" = x"yes"; then + if test -x /usr/bin/cygpath; then + CFLAGS="-O2" + MIXED_CYGWIN=yes + AC_MSG_RESULT([yes]) + MIXED_CYGWIN_MINGW=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_MINGW" + else + AC_MSG_RESULT([undeterminable]) + AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!) + fi + else + AC_MSG_RESULT([no]) + MIXED_CYGWIN_MINGW=no + fi +else + MIXED_CYGWIN_MINGW=no +fi +AC_SUBST(MIXED_CYGWIN_MINGW) + +AC_MSG_CHECKING(if we mix cygwin with any native compiler) +if test "X$MIXED_CYGWIN" = "Xyes"; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(MIXED_CYGWIN) + +AC_MSG_CHECKING(if we mix msys with another native compiler) +if test "X$MIXED_MSYS" = "Xyes" ; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(MIXED_MSYS) +]) + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_FIND_EMU_CC +dnl +dnl +dnl Tries fairly hard to find a C compiler that can handle jump tables. +dnl Defines the @EMU_CC@ variable for the makefiles and +dnl inserts NO_JUMP_TABLE in the header if one cannot be found... +dnl + +AC_DEFUN(LM_FIND_EMU_CC, + [AC_CACHE_CHECK(for a compiler that handles jumptables, + ac_cv_prog_emu_cc, + [ +AC_TRY_COMPILE([],[ +#if defined(__clang_major__) && __clang_major__ >= 3 + /* clang 3.x or later is fine */ +#elif defined(__llvm__) +#error "this version of llvm is unable to correctly compile beam_emu.c" +#endif + __label__ lbl1; + __label__ lbl2; + int x = magic(); + static void *jtab[2]; + + jtab[0] = &&lbl1; + jtab[1] = &&lbl2; + goto *jtab[x]; +lbl1: + return 1; +lbl2: + return 2; +],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) + +if test $ac_cv_prog_emu_cc = no; then + for ac_progname in emu_cc.sh gcc-4.2 gcc; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_progname; then + ac_cv_prog_emu_cc=$ac_dir/$ac_progname + break + fi + done + IFS="$ac_save_ifs" + if test $ac_cv_prog_emu_cc != no; then + break + fi + done +fi + +if test $ac_cv_prog_emu_cc != no; then + save_CC=$CC + save_CFLAGS=$CFLAGS + save_CPPFLAGS=$CPPFLAGS + CC=$ac_cv_prog_emu_cc + CFLAGS="" + CPPFLAGS="" + AC_TRY_COMPILE([],[ +#if defined(__clang_major__) && __clang_major__ >= 3 + /* clang 3.x or later is fine */ +#elif defined(__llvm__) +#error "this version of llvm is unable to correctly compile beam_emu.c" +#endif + __label__ lbl1; + __label__ lbl2; + int x = magic(); + static void *jtab[2]; + + jtab[0] = &&lbl1; + jtab[1] = &&lbl2; + goto *jtab[x]; + lbl1: + return 1; + lbl2: + return 2; + ],ac_cv_prog_emu_cc=$CC,ac_cv_prog_emu_cc=no) + CC=$save_CC + CFLAGS=$save_CFLAGS + CPPFLAGS=$save_CPPFLAGS +fi +]) +if test $ac_cv_prog_emu_cc = no; then + AC_DEFINE(NO_JUMP_TABLE,[],[Defined if no found C compiler can handle jump tables]) + EMU_CC=$CC +else + EMU_CC=$ac_cv_prog_emu_cc +fi +AC_SUBST(EMU_CC) +]) + + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_PROG_INSTALL_DIR +dnl +dnl This macro may be used by any OTP application. +dnl +dnl Figure out how to create directories with parents. +dnl (In my opinion INSTALL_DIR is a bad name, MKSUBDIRS or something is better) +dnl +dnl We prefer 'install -d', but use 'mkdir -p' if it exists. +dnl If none of these methods works, we give up. +dnl + + +AC_DEFUN(LM_PROG_INSTALL_DIR, +[AC_CACHE_CHECK(how to create a directory including parents, +ac_cv_prog_mkdir_p, +[ +temp_name_base=config.$$ +temp_name=$temp_name_base/x/y/z +$INSTALL -d $temp_name >/dev/null 2>&1 +ac_cv_prog_mkdir_p=none +if test -d $temp_name; then + ac_cv_prog_mkdir_p="$INSTALL -d" +else + mkdir -p $temp_name >/dev/null 2>&1 + if test -d $temp_name; then + ac_cv_prog_mkdir_p="mkdir -p" + fi +fi +rm -fr $temp_name_base +]) + +case "${ac_cv_prog_mkdir_p}" in + none) AC_MSG_ERROR(don't know how create directories with parents) ;; + *) INSTALL_DIR="$ac_cv_prog_mkdir_p" AC_SUBST(INSTALL_DIR) ;; +esac +]) + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_PROG_PERL5 +dnl +dnl Try to find perl version 5. If found set PERL to the absolute path +dnl of the program, if not found set PERL to false. +dnl +dnl On some systems /usr/bin/perl is perl 4 and e.g. +dnl /usr/local/bin/perl is perl 5. We try to handle this case by +dnl putting a couple of +dnl Tries to handle the case that there are two programs called perl +dnl in the path and one of them is perl 5 and the other isn't. +dnl +AC_DEFUN(LM_PROG_PERL5, +[AC_PATH_PROGS(PERL, perl5 perl, false, + /usr/local/bin:/opt/local/bin:/usr/local/gnu/bin:${PATH}) +changequote(, )dnl +dnl[ That bracket is needed to balance the right bracket below +if test "$PERL" = "false" || $PERL -e 'exit ($] >= 5)'; then +changequote([, ])dnl + ac_cv_path_PERL=false + PERL=false +dnl AC_MSG_WARN(perl version 5 not found) +fi +])dnl + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_DECL_SO_BSDCOMPAT +dnl +dnl Check if the system has the SO_BSDCOMPAT flag on sockets (linux) +dnl +AC_DEFUN(LM_DECL_SO_BSDCOMPAT, +[AC_CACHE_CHECK([for SO_BSDCOMPAT declaration], ac_cv_decl_so_bsdcompat, +AC_TRY_COMPILE([#include <sys/socket.h>], [int i = SO_BSDCOMPAT;], + ac_cv_decl_so_bsdcompat=yes, + ac_cv_decl_so_bsdcompat=no)) + +case "${ac_cv_decl_so_bsdcompat}" in + "yes" ) AC_DEFINE(HAVE_SO_BSDCOMPAT,[], + [Define if you have SO_BSDCOMPAT flag on sockets]) ;; + * ) ;; +esac +]) + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_DECL_INADDR_LOOPBACK +dnl +dnl Try to find declaration of INADDR_LOOPBACK, if nowhere provide a default +dnl + +AC_DEFUN(LM_DECL_INADDR_LOOPBACK, +[AC_CACHE_CHECK([for INADDR_LOOPBACK in netinet/in.h], + ac_cv_decl_inaddr_loopback, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <netinet/in.h>], [int i = INADDR_LOOPBACK;], +ac_cv_decl_inaddr_loopback=yes, ac_cv_decl_inaddr_loopback=no) +]) + +if test ${ac_cv_decl_inaddr_loopback} = no; then + AC_CACHE_CHECK([for INADDR_LOOPBACK in rpc/types.h], + ac_cv_decl_inaddr_loopback_rpc, + AC_TRY_COMPILE([#include <rpc/types.h>], + [int i = INADDR_LOOPBACK;], + ac_cv_decl_inaddr_loopback_rpc=yes, + ac_cv_decl_inaddr_loopback_rpc=no)) + + case "${ac_cv_decl_inaddr_loopback_rpc}" in + "yes" ) + AC_DEFINE(DEF_INADDR_LOOPBACK_IN_RPC_TYPES_H,[], + [Define if you need to include rpc/types.h to get INADDR_LOOPBACK defined]) ;; + * ) + AC_CACHE_CHECK([for INADDR_LOOPBACK in winsock2.h], + ac_cv_decl_inaddr_loopback_winsock2, + AC_TRY_COMPILE([#define WIN32_LEAN_AND_MEAN + #include <winsock2.h>], + [int i = INADDR_LOOPBACK;], + ac_cv_decl_inaddr_loopback_winsock2=yes, + ac_cv_decl_inaddr_loopback_winsock2=no)) + case "${ac_cv_decl_inaddr_loopback_winsock2}" in + "yes" ) + AC_DEFINE(DEF_INADDR_LOOPBACK_IN_WINSOCK2_H,[], + [Define if you need to include winsock2.h to get INADDR_LOOPBACK defined]) ;; + * ) + # couldn't find it anywhere + AC_DEFINE(HAVE_NO_INADDR_LOOPBACK,[], + [Define if you don't have a definition of INADDR_LOOPBACK]) ;; + esac;; + esac +fi +]) + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_STRUCT_SOCKADDR_SA_LEN +dnl +dnl Check if the sockaddr structure has the field sa_len +dnl + +AC_DEFUN(LM_STRUCT_SOCKADDR_SA_LEN, +[AC_CACHE_CHECK([whether struct sockaddr has sa_len field], + ac_cv_struct_sockaddr_sa_len, +AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/socket.h>], [struct sockaddr s; s.sa_len = 10;], + ac_cv_struct_sockaddr_sa_len=yes, ac_cv_struct_sockaddr_sa_len=no)) + +dnl FIXME convbreak +case ${ac_cv_struct_sockaddr_sa_len} in + "no" ) AC_DEFINE(NO_SA_LEN,[1],[Define if you dont have salen]) ;; + *) ;; +esac +]) + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_STRUCT_EXCEPTION +dnl +dnl Check to see whether the system supports the matherr function +dnl and its associated type "struct exception". +dnl + +AC_DEFUN(LM_STRUCT_EXCEPTION, +[AC_CACHE_CHECK([for struct exception (and matherr function)], + ac_cv_struct_exception, +AC_TRY_COMPILE([#include <math.h>], + [struct exception x; x.type = DOMAIN; x.type = SING;], + ac_cv_struct_exception=yes, ac_cv_struct_exception=no)) + +case "${ac_cv_struct_exception}" in + "yes" ) AC_DEFINE(USE_MATHERR,[1],[Define if you have matherr() function and struct exception type]) ;; + * ) ;; +esac +]) + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_SYS_IPV6 +dnl +dnl Check for ipv6 support and what the in6_addr structure is called. +dnl (early linux used in_addr6 insted of in6_addr) +dnl + +AC_DEFUN(LM_SYS_IPV6, +[AC_MSG_CHECKING(for IP version 6 support) +AC_CACHE_VAL(ac_cv_sys_ipv6_support, +[ok_so_far=yes + AC_TRY_COMPILE([#include <sys/types.h> +#ifdef __WIN32__ +#include <winsock2.h> +#include <ws2tcpip.h> +#else +#include <netinet/in.h> +#endif], + [struct in6_addr a6; struct sockaddr_in6 s6;], ok_so_far=yes, ok_so_far=no) + +if test $ok_so_far = yes; then + ac_cv_sys_ipv6_support=yes +else + AC_TRY_COMPILE([#include <sys/types.h> +#ifdef __WIN32__ +#include <winsock2.h> +#include <ws2tcpip.h> +#else +#include <netinet/in.h> +#endif], + [struct in_addr6 a6; struct sockaddr_in6 s6;], + ac_cv_sys_ipv6_support=in_addr6, ac_cv_sys_ipv6_support=no) +fi +])dnl + +dnl +dnl Have to use old style AC_DEFINE due to BC with old autoconf. +dnl + +case ${ac_cv_sys_ipv6_support} in + yes) + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IN6,[1],[Define if ipv6 is present]) + ;; + in_addr6) + AC_MSG_RESULT([yes (but I am redefining in_addr6 to in6_addr)]) + AC_DEFINE(HAVE_IN6,[1],[Define if ipv6 is present]) + AC_DEFINE(HAVE_IN_ADDR6_STRUCT,[],[Early linux used in_addr6 instead of in6_addr, define if you have this]) + ;; + *) + AC_MSG_RESULT(no) + ;; +esac +]) + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_SYS_MULTICAST +dnl +dnl Check for multicast support. Only checks for multicast options in +dnl setsockopt(), no check is performed that multicasting actually works. +dnl If options are found defines HAVE_MULTICAST_SUPPORT +dnl + +AC_DEFUN(LM_SYS_MULTICAST, +[AC_CACHE_CHECK([for multicast support], ac_cv_sys_multicast_support, +[AC_EGREP_CPP(yes, +[#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#if defined(IP_MULTICAST_TTL) && defined(IP_MULTICAST_LOOP) && defined(IP_MULTICAST_IF) && defined(IP_ADD_MEMBERSHIP) && defined(IP_DROP_MEMBERSHIP) +yes +#endif +], ac_cv_sys_multicast_support=yes, ac_cv_sys_multicast_support=no)]) +if test $ac_cv_sys_multicast_support = yes; then + AC_DEFINE(HAVE_MULTICAST_SUPPORT,[1], + [Define if setsockopt() accepts multicast options]) +fi +])dnl + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_DECL_SYS_ERRLIST +dnl +dnl Define SYS_ERRLIST_DECLARED if the variable sys_errlist is declared +dnl in a system header file, stdio.h or errno.h. +dnl + +AC_DEFUN(LM_DECL_SYS_ERRLIST, +[AC_CACHE_CHECK([for sys_errlist declaration in stdio.h or errno.h], + ac_cv_decl_sys_errlist, +[AC_TRY_COMPILE([#include <stdio.h> +#include <errno.h>], [char *msg = *(sys_errlist + 1);], + ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)]) +if test $ac_cv_decl_sys_errlist = yes; then + AC_DEFINE(SYS_ERRLIST_DECLARED,[], + [define if the variable sys_errlist is declared in a system header file]) +fi +]) + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_CHECK_FUNC_DECL( funname, declaration [, extra includes +dnl [, action-if-found [, action-if-not-found]]] ) +dnl +dnl Checks if the declaration "declaration" of "funname" conflicts +dnl with the header files idea of how the function should be +dnl declared. It is useful on systems which lack prototypes and you +dnl need to provide your own (e.g. when you want to take the address +dnl of a function). The 4'th argument is expanded if conflicting, +dnl the 5'th argument otherwise +dnl +dnl + +AC_DEFUN(LM_CHECK_FUNC_DECL, +[AC_MSG_CHECKING([for conflicting declaration of $1]) +AC_CACHE_VAL(ac_cv_func_decl_$1, +[AC_TRY_COMPILE([#include <stdio.h> +$3],[$2 +char *c = (char *)$1; +], eval "ac_cv_func_decl_$1=no", eval "ac_cv_func_decl_$1=yes")]) +if eval "test \"`echo '$ac_cv_func_decl_'$1`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$4], , :, [$4]) +else + AC_MSG_RESULT(no) +ifelse([$5], , , [$5 +])dnl +fi +]) + +dnl ---------------------------------------------------------------------- +dnl +dnl AC_DOUBLE_MIDDLE_ENDIAN +dnl +dnl Checks whether doubles are represented in "middle-endian" format. +dnl Sets ac_cv_double_middle_endian={no,yes,unknown} accordingly, +dnl as well as DOUBLE_MIDDLE_ENDIAN. +dnl +dnl + +AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN], +[AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian, +[# It does not; compile a test program. +AC_RUN_IFELSE( +[AC_LANG_SOURCE([[#include <stdlib.h> + +int +main(void) +{ + int i = 0; + int zero = 0; + int bigendian; + int zero_index = 0; + + union + { + long int l; + char c[sizeof (long int)]; + } u; + + /* we'll use the one with 32-bit words */ + union + { + double d; + unsigned int c[2]; + } vint; + + union + { + double d; + unsigned long c[2]; + } vlong; + + union + { + double d; + unsigned short c[2]; + } vshort; + + + /* Are we little or big endian? From Harbison&Steele. */ + u.l = 1; + bigendian = (u.c[sizeof (long int) - 1] == 1); + + zero_index = bigendian ? 1 : 0; + + vint.d = 1.0; + vlong.d = 1.0; + vshort.d = 1.0; + + if (sizeof(unsigned int) == 4) + { + if (vint.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned long) == 4) + { + if (vlong.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned short) == 4) + { + if (vshort.c[zero_index] != 0) + zero = 1; + } + + exit (zero); +} +]])], + [ac_cv_c_double_middle_endian=no], + [ac_cv_c_double_middle_endian=yes], + [ac_cv_c_double_middle=unknown])]) +case $ac_cv_c_double_middle_endian in + yes) + m4_default([$1], + [AC_DEFINE([DOUBLE_MIDDLE_ENDIAN], 1, + [Define to 1 if your processor stores the words in a double in + middle-endian format (like some ARMs).])]) ;; + no) + $2 ;; + *) + m4_default([$3], + [AC_MSG_WARN([unknown double endianness +presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;; +esac +])# AC_C_DOUBLE_MIDDLE_ENDIAN + + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_CHECK_THR_LIB +dnl +dnl This macro may be used by any OTP application. +dnl +dnl LM_CHECK_THR_LIB sets THR_LIBS, THR_DEFS, and THR_LIB_NAME. It also +dnl checks for some pthread headers which will appear in DEFS or config.h. +dnl + +AC_DEFUN(LM_CHECK_THR_LIB, +[ + +NEED_NPTL_PTHREAD_H=no + +dnl win32? +AC_MSG_CHECKING([for native win32 threads]) +if test "X$host_os" = "Xwin32"; then + AC_MSG_RESULT(yes) + THR_DEFS="-DWIN32_THREADS" + THR_LIBS= + THR_LIB_NAME=win32_threads + THR_LIB_TYPE=win32_threads +else + AC_MSG_RESULT(no) + THR_DEFS= + THR_LIBS= + THR_LIB_NAME= + THR_LIB_TYPE=posix_unknown + +dnl Try to find POSIX threads + +dnl The usual pthread lib... + AC_CHECK_LIB(pthread, pthread_create, THR_LIBS="-lpthread") + +dnl Very old versions of FreeBSD have pthreads in special c library, c_r... + if test "x$THR_LIBS" = "x"; then + AC_CHECK_LIB(c_r, pthread_create, THR_LIBS="-lc_r") + fi + +dnl QNX has pthreads in standard C library + if test "x$THR_LIBS" = "x"; then + AC_CHECK_FUNC(pthread_create, THR_LIBS="none_needed") + fi + +dnl On ofs1 the '-pthread' switch should be used + if test "x$THR_LIBS" = "x"; then + AC_MSG_CHECKING([if the '-pthread' switch can be used]) + saved_cflags=$CFLAGS + CFLAGS="$CFLAGS -pthread" + AC_TRY_LINK([#include <pthread.h>], + pthread_create((void*)0,(void*)0,(void*)0,(void*)0);, + [THR_DEFS="-pthread" + THR_LIBS="-pthread"]) + CFLAGS=$saved_cflags + if test "x$THR_LIBS" != "x"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + fi + + if test "x$THR_LIBS" != "x"; then + THR_DEFS="$THR_DEFS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS" + THR_LIB_NAME=pthread + if test "x$THR_LIBS" = "xnone_needed"; then + THR_LIBS= + fi + case $host_os in + solaris*) + THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS" ;; + linux*) + THR_DEFS="$THR_DEFS -D_POSIX_THREAD_SAFE_FUNCTIONS" + + LM_CHECK_GETCONF + AC_MSG_CHECKING(for Native POSIX Thread Library) + libpthr_vsn=`$GETCONF GNU_LIBPTHREAD_VERSION 2>/dev/null` + if test $? -eq 0; then + case "$libpthr_vsn" in + *nptl*|*NPTL*) nptl=yes;; + *) nptl=no;; + esac + elif test "$cross_compiling" = "yes"; then + case "$erl_xcomp_linux_nptl" in + "") nptl=cross;; + yes|no) nptl=$erl_xcomp_linux_nptl;; + *) AC_MSG_ERROR([Bad erl_xcomp_linux_nptl value: $erl_xcomp_linux_nptl]);; + esac + else + nptl=no + fi + AC_MSG_RESULT($nptl) + if test $nptl = cross; then + nptl=yes + AC_MSG_WARN([result yes guessed because of cross compilation]) + fi + if test $nptl = yes; then + THR_LIB_TYPE=posix_nptl + need_nptl_incldir=no + AC_CHECK_HEADER(nptl/pthread.h, + [need_nptl_incldir=yes + NEED_NPTL_PTHREAD_H=yes]) + if test $need_nptl_incldir = yes; then + # Ahh... + nptl_path="$C_INCLUDE_PATH:$CPATH" + if test X$cross_compiling != Xyes; then + nptl_path="$nptl_path:/usr/local/include:/usr/include" + else + IROOT="$erl_xcomp_isysroot" + test "$IROOT" != "" || IROOT="$erl_xcomp_sysroot" + test "$IROOT" != "" || AC_MSG_ERROR([Don't know where to search for includes! Please set erl_xcomp_isysroot]) + nptl_path="$nptl_path:$IROOT/usr/local/include:$IROOT/usr/include" + fi + nptl_ws_path= + save_ifs="$IFS"; IFS=":" + for dir in $nptl_path; do + if test "x$dir" != "x"; then + nptl_ws_path="$nptl_ws_path $dir" + fi + done + IFS=$save_ifs + nptl_incldir= + for dir in $nptl_ws_path; do + AC_CHECK_HEADER($dir/nptl/pthread.h, + nptl_incldir=$dir/nptl) + if test "x$nptl_incldir" != "x"; then + THR_DEFS="$THR_DEFS -isystem $nptl_incldir" + break + fi + done + if test "x$nptl_incldir" = "x"; then + AC_MSG_ERROR(Failed to locate nptl system include directory) + fi + fi + fi + ;; + *) ;; + esac + + dnl We sometimes need THR_DEFS in order to find certain headers + dnl (at least for pthread.h on osf1). + saved_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $THR_DEFS" + + dnl + dnl Check for headers + dnl + + AC_CHECK_HEADER(pthread.h, + AC_DEFINE(HAVE_PTHREAD_H, 1, \ +[Define if you have the <pthread.h> header file.])) + + dnl Some Linuxes have <pthread/mit/pthread.h> instead of <pthread.h> + AC_CHECK_HEADER(pthread/mit/pthread.h, \ + AC_DEFINE(HAVE_MIT_PTHREAD_H, 1, \ +[Define if the pthread.h header file is in pthread/mit directory.])) + + dnl restore CPPFLAGS + CPPFLAGS=$saved_cppflags + + fi +fi + +]) + +AC_DEFUN(ERL_INTERNAL_LIBS, +[ + +ERTS_INTERNAL_X_LIBS= + +AC_CHECK_LIB(kstat, kstat_open, +[AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat]) +ERTS_INTERNAL_X_LIBS="$ERTS_INTERNAL_X_LIBS -lkstat"]) + +AC_SUBST(ERTS_INTERNAL_X_LIBS) + +]) + +AC_DEFUN(ETHR_CHK_SYNC_OP, +[ + AC_MSG_CHECKING([for $3-bit $1()]) + case "$2" in + "1") sync_call="$1(&var);";; + "2") sync_call="$1(&var, ($4) 0);";; + "3") sync_call="$1(&var, ($4) 0, ($4) 0);";; + esac + have_sync_op=no + AC_TRY_LINK([], + [ + $4 res; + volatile $4 var; + res = $sync_call + ], + [have_sync_op=yes]) + test $have_sync_op = yes && $5 + AC_MSG_RESULT([$have_sync_op]) +]) + +AC_DEFUN(ETHR_CHK_INTERLOCKED, +[ + ilckd="$1" + AC_MSG_CHECKING([for ${ilckd}()]) + case "$2" in + "1") ilckd_call="${ilckd}(var);";; + "2") ilckd_call="${ilckd}(var, ($3) 0);";; + "3") ilckd_call="${ilckd}(var, ($3) 0, ($3) 0);";; + "4") ilckd_call="${ilckd}(var, ($3) 0, ($3) 0, arr);";; + esac + have_interlocked_op=no + AC_TRY_LINK( + [ + #define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <intrin.h> + ], + [ + volatile $3 *var; + volatile $3 arr[2]; + + $ilckd_call + return 0; + ], + [have_interlocked_op=yes]) + test $have_interlocked_op = yes && $4 + AC_MSG_RESULT([$have_interlocked_op]) +]) + +dnl ---------------------------------------------------------------------- +dnl +dnl ERL_FIND_ETHR_LIB +dnl +dnl NOTE! This macro may be changed at any time! Should *only* be used by +dnl ERTS! +dnl +dnl Find a thread library to use. Sets ETHR_LIBS to libraries to link +dnl with, ETHR_X_LIBS to extra libraries to link with (same as ETHR_LIBS +dnl except that the ethread lib itself is not included), ETHR_DEFS to +dnl defines to compile with, ETHR_THR_LIB_BASE to the name of the +dnl thread library which the ethread library is based on, and ETHR_LIB_NAME +dnl to the name of the library where the ethread implementation is located. +dnl ERL_FIND_ETHR_LIB currently searches for 'pthreads', and +dnl 'win32_threads'. If no thread library was found ETHR_LIBS, ETHR_X_LIBS, +dnl ETHR_DEFS, ETHR_THR_LIB_BASE, and ETHR_LIB_NAME are all set to the +dnl empty string. +dnl + +AC_DEFUN(ERL_FIND_ETHR_LIB, +[ + +LM_CHECK_THR_LIB +ERL_INTERNAL_LIBS + +ethr_have_native_atomics=no +ethr_have_native_spinlock=no +ETHR_THR_LIB_BASE="$THR_LIB_NAME" +ETHR_THR_LIB_BASE_TYPE="$THR_LIB_TYPE" +ETHR_DEFS="$THR_DEFS" +ETHR_X_LIBS="$THR_LIBS $ERTS_INTERNAL_X_LIBS" +ETHR_LIBS= +ETHR_LIB_NAME= + +ethr_modified_default_stack_size= + +dnl Name of lib where ethread implementation is located +ethr_lib_name=ethread + +case "$THR_LIB_NAME" in + + win32_threads) + ETHR_THR_LIB_BASE_DIR=win + # * _WIN32_WINNT >= 0x0400 is needed for + # TryEnterCriticalSection + # * _WIN32_WINNT >= 0x0403 is needed for + # InitializeCriticalSectionAndSpinCount + # The ethread lib will refuse to build if _WIN32_WINNT < 0x0403. + # + # -D_WIN32_WINNT should have been defined in $CPPFLAGS; fetch it + # and save it in ETHR_DEFS. + found_win32_winnt=no + for cppflag in $CPPFLAGS; do + case $cppflag in + -DWINVER*) + ETHR_DEFS="$ETHR_DEFS $cppflag" + ;; + -D_WIN32_WINNT*) + ETHR_DEFS="$ETHR_DEFS $cppflag" + found_win32_winnt=yes + ;; + *) + ;; + esac + done + if test $found_win32_winnt = no; then + AC_MSG_ERROR([-D_WIN32_WINNT missing in CPPFLAGS]) + fi + + AC_DEFINE(ETHR_WIN32_THREADS, 1, [Define if you have win32 threads]) + + ETHR_CHK_INTERLOCKED([_InterlockedDecrement], [1], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDDECREMENT, 1, [Define if you have _InterlockedDecrement()])) + ETHR_CHK_INTERLOCKED([_InterlockedDecrement_rel], [1], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDDECREMENT_REL, 1, [Define if you have _InterlockedDecrement_rel()])) + ETHR_CHK_INTERLOCKED([_InterlockedIncrement], [1], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDINCREMENT, 1, [Define if you have _InterlockedIncrement()])) + ETHR_CHK_INTERLOCKED([_InterlockedIncrement_acq], [1], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDINCREMENT_ACQ, 1, [Define if you have _InterlockedIncrement_acq()])) + ETHR_CHK_INTERLOCKED([_InterlockedExchangeAdd], [2], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDEXCHANGEADD, 1, [Define if you have _InterlockedExchangeAdd()])) + ETHR_CHK_INTERLOCKED([_InterlockedExchangeAdd_acq], [2], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDEXCHANGEADD_ACQ, 1, [Define if you have _InterlockedExchangeAdd_acq()])) + ETHR_CHK_INTERLOCKED([_InterlockedAnd], [2], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDAND, 1, [Define if you have _InterlockedAnd()])) + ETHR_CHK_INTERLOCKED([_InterlockedOr], [2], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDOR, 1, [Define if you have _InterlockedOr()])) + ETHR_CHK_INTERLOCKED([_InterlockedExchange], [2], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDEXCHANGE, 1, [Define if you have _InterlockedExchange()])) + ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange], [3], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE, 1, [Define if you have _InterlockedCompareExchange()])) + test "$have_interlocked_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange_acq], [3], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE_ACQ, 1, [Define if you have _InterlockedCompareExchange_acq()])) + test "$have_interlocked_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange_rel], [3], [long], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE_REL, 1, [Define if you have _InterlockedCompareExchange_rel()])) + test "$have_interlocked_op" = "yes" && ethr_have_native_atomics=yes + + ETHR_CHK_INTERLOCKED([_InterlockedDecrement64], [1], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDDECREMENT64, 1, [Define if you have _InterlockedDecrement64()])) + ETHR_CHK_INTERLOCKED([_InterlockedDecrement64_rel], [1], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDDECREMENT64_REL, 1, [Define if you have _InterlockedDecrement64_rel()])) + ETHR_CHK_INTERLOCKED([_InterlockedIncrement64], [1], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDINCREMENT64, 1, [Define if you have _InterlockedIncrement64()])) + ETHR_CHK_INTERLOCKED([_InterlockedIncrement64_acq], [1], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDINCREMENT64_ACQ, 1, [Define if you have _InterlockedIncrement64_acq()])) + ETHR_CHK_INTERLOCKED([_InterlockedExchangeAdd64], [2], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDEXCHANGEADD64, 1, [Define if you have _InterlockedExchangeAdd64()])) + ETHR_CHK_INTERLOCKED([_InterlockedExchangeAdd64_acq], [2], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDEXCHANGEADD64_ACQ, 1, [Define if you have _InterlockedExchangeAdd64_acq()])) + ETHR_CHK_INTERLOCKED([_InterlockedAnd64], [2], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDAND64, 1, [Define if you have _InterlockedAnd64()])) + ETHR_CHK_INTERLOCKED([_InterlockedOr64], [2], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDOR64, 1, [Define if you have _InterlockedOr64()])) + ETHR_CHK_INTERLOCKED([_InterlockedExchange64], [2], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDEXCHANGE64, 1, [Define if you have _InterlockedExchange64()])) + ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange64], [3], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE64, 1, [Define if you have _InterlockedCompareExchange64()])) + test "$have_interlocked_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange64_acq], [3], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE64_ACQ, 1, [Define if you have _InterlockedCompareExchange64_acq()])) + test "$have_interlocked_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange64_rel], [3], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE64_REL, 1, [Define if you have _InterlockedCompareExchange64_rel()])) + test "$have_interlocked_op" = "yes" && ethr_have_native_atomics=yes + + ETHR_CHK_INTERLOCKED([_InterlockedCompareExchange128], [4], [__int64], AC_DEFINE_UNQUOTED(ETHR_HAVE__INTERLOCKEDCOMPAREEXCHANGE128, 1, [Define if you have _InterlockedCompareExchange128()])) + + test "$ethr_have_native_atomics" = "yes" && ethr_have_native_spinlock=yes + ;; + + pthread) + ETHR_THR_LIB_BASE_DIR=pthread + AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads]) + case $host_os in + openbsd*) + # The default stack size is insufficient for our needs + # on OpenBSD. We increase it to 256 kilo words. + ethr_modified_default_stack_size=256;; + linux*) + ETHR_DEFS="$ETHR_DEFS -D_GNU_SOURCE" + + if test X$cross_compiling = Xyes; then + case X$erl_xcomp_linux_usable_sigusrx in + X) usable_sigusrx=cross;; + Xyes|Xno) usable_sigusrx=$erl_xcomp_linux_usable_sigusrx;; + *) AC_MSG_ERROR([Bad erl_xcomp_linux_usable_sigusrx value: $erl_xcomp_linux_usable_sigusrx]);; + esac + case X$erl_xcomp_linux_usable_sigaltstack in + X) usable_sigaltstack=cross;; + Xyes|Xno) usable_sigaltstack=$erl_xcomp_linux_usable_sigaltstack;; + *) AC_MSG_ERROR([Bad erl_xcomp_linux_usable_sigaltstack value: $erl_xcomp_linux_usable_sigaltstack]);; + esac + else + # FIXME: Test for actual problems instead of kernel versions + linux_kernel_vsn_=`uname -r` + case $linux_kernel_vsn_ in + [[0-1]].*|2.[[0-1]]|2.[[0-1]].*) + usable_sigusrx=no + usable_sigaltstack=no;; + 2.[[2-3]]|2.[[2-3]].*) + usable_sigusrx=yes + usable_sigaltstack=no;; + *) + usable_sigusrx=yes + usable_sigaltstack=yes;; + esac + fi + + AC_MSG_CHECKING(if SIGUSR1 and SIGUSR2 can be used) + AC_MSG_RESULT($usable_sigusrx) + if test $usable_sigusrx = cross; then + usable_sigusrx=yes + AC_MSG_WARN([result yes guessed because of cross compilation]) + fi + if test $usable_sigusrx = no; then + ETHR_DEFS="$ETHR_DEFS -DETHR_UNUSABLE_SIGUSRX" + fi + + AC_MSG_CHECKING(if sigaltstack can be used) + AC_MSG_RESULT($usable_sigaltstack) + if test $usable_sigaltstack = cross; then + usable_sigaltstack=yes + AC_MSG_WARN([result yes guessed because of cross compilation]) + fi + if test $usable_sigaltstack = no; then + ETHR_DEFS="$ETHR_DEFS -DETHR_UNUSABLE_SIGALTSTACK" + fi + ;; + *) ;; + esac + + dnl We sometimes need ETHR_DEFS in order to find certain headers + dnl (at least for pthread.h on osf1). + saved_cppflags="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $ETHR_DEFS" + + dnl We need the thread library in order to find some functions + saved_libs="$LIBS" + LIBS="$LIBS $ETHR_X_LIBS" + + dnl + dnl Check for headers + dnl + + AC_CHECK_HEADER(pthread.h, \ + AC_DEFINE(ETHR_HAVE_PTHREAD_H, 1, \ +[Define if you have the <pthread.h> header file.])) + + dnl Some Linuxes have <pthread/mit/pthread.h> instead of <pthread.h> + AC_CHECK_HEADER(pthread/mit/pthread.h, \ + AC_DEFINE(ETHR_HAVE_MIT_PTHREAD_H, 1, \ +[Define if the pthread.h header file is in pthread/mit directory.])) + + if test $NEED_NPTL_PTHREAD_H = yes; then + AC_DEFINE(ETHR_NEED_NPTL_PTHREAD_H, 1, \ +[Define if you need the <nptl/pthread.h> header file.]) + fi + + AC_CHECK_HEADER(sched.h, \ + AC_DEFINE(ETHR_HAVE_SCHED_H, 1, \ +[Define if you have the <sched.h> header file.])) + + AC_CHECK_HEADER(sys/time.h, \ + AC_DEFINE(ETHR_HAVE_SYS_TIME_H, 1, \ +[Define if you have the <sys/time.h> header file.])) + + AC_TRY_COMPILE([#include <time.h> + #include <sys/time.h>], + [struct timeval *tv; return 0;], + AC_DEFINE(ETHR_TIME_WITH_SYS_TIME, 1, \ +[Define if you can safely include both <sys/time.h> and <time.h>.])) + + + dnl + dnl Check for functions + dnl + + AC_CHECK_FUNC(pthread_spin_lock, \ + [ethr_have_native_spinlock=yes \ + AC_DEFINE(ETHR_HAVE_PTHREAD_SPIN_LOCK, 1, \ +[Define if you have the pthread_spin_lock function.])]) + + have_sched_yield=no + have_librt_sched_yield=no + AC_CHECK_FUNC(sched_yield, [have_sched_yield=yes]) + if test $have_sched_yield = no; then + AC_CHECK_LIB(rt, sched_yield, + [have_librt_sched_yield=yes + ETHR_X_LIBS="$ETHR_X_LIBS -lrt"]) + fi + if test $have_sched_yield = yes || test $have_librt_sched_yield = yes; then + AC_DEFINE(ETHR_HAVE_SCHED_YIELD, 1, [Define if you have the sched_yield() function.]) + AC_MSG_CHECKING([whether sched_yield() returns an int]) + sched_yield_ret_int=no + AC_TRY_COMPILE([ + #ifdef ETHR_HAVE_SCHED_H + #include <sched.h> + #endif + ], + [int sched_yield();], + [sched_yield_ret_int=yes]) + AC_MSG_RESULT([$sched_yield_ret_int]) + if test $sched_yield_ret_int = yes; then + AC_DEFINE(ETHR_SCHED_YIELD_RET_INT, 1, [Define if sched_yield() returns an int.]) + fi + fi + + have_pthread_yield=no + AC_CHECK_FUNC(pthread_yield, [have_pthread_yield=yes]) + if test $have_pthread_yield = yes; then + AC_DEFINE(ETHR_HAVE_PTHREAD_YIELD, 1, [Define if you have the pthread_yield() function.]) + AC_MSG_CHECKING([whether pthread_yield() returns an int]) + pthread_yield_ret_int=no + AC_TRY_COMPILE([ + #if defined(ETHR_NEED_NPTL_PTHREAD_H) + #include <nptl/pthread.h> + #elif defined(ETHR_HAVE_MIT_PTHREAD_H) + #include <pthread/mit/pthread.h> + #elif defined(ETHR_HAVE_PTHREAD_H) + #include <pthread.h> + #endif + ], + [int pthread_yield();], + [pthread_yield_ret_int=yes]) + AC_MSG_RESULT([$pthread_yield_ret_int]) + if test $pthread_yield_ret_int = yes; then + AC_DEFINE(ETHR_PTHREAD_YIELD_RET_INT, 1, [Define if pthread_yield() returns an int.]) + fi + fi + + have_pthread_rwlock_init=no + AC_CHECK_FUNC(pthread_rwlock_init, [have_pthread_rwlock_init=yes]) + if test $have_pthread_rwlock_init = yes; then + + ethr_have_pthread_rwlockattr_setkind_np=no + AC_CHECK_FUNC(pthread_rwlockattr_setkind_np, + [ethr_have_pthread_rwlockattr_setkind_np=yes]) + + if test $ethr_have_pthread_rwlockattr_setkind_np = yes; then + AC_DEFINE(ETHR_HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP, 1, \ +[Define if you have the pthread_rwlockattr_setkind_np() function.]) + + AC_MSG_CHECKING([for PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP]) + ethr_pthread_rwlock_writer_nonrecursive_initializer_np=no + AC_TRY_LINK([ + #if defined(ETHR_NEED_NPTL_PTHREAD_H) + #include <nptl/pthread.h> + #elif defined(ETHR_HAVE_MIT_PTHREAD_H) + #include <pthread/mit/pthread.h> + #elif defined(ETHR_HAVE_PTHREAD_H) + #include <pthread.h> + #endif + ], + [ + pthread_rwlockattr_t *attr; + return pthread_rwlockattr_setkind_np(attr, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); + ], + [ethr_pthread_rwlock_writer_nonrecursive_initializer_np=yes]) + AC_MSG_RESULT([$ethr_pthread_rwlock_writer_nonrecursive_initializer_np]) + if test $ethr_pthread_rwlock_writer_nonrecursive_initializer_np = yes; then + AC_DEFINE(ETHR_HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 1, \ +[Define if you have the PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP rwlock attribute.]) + fi + fi + fi + + if test "$force_pthread_rwlocks" = "yes"; then + + AC_DEFINE(ETHR_FORCE_PTHREAD_RWLOCK, 1, \ +[Define if you want to force usage of pthread rwlocks]) + + if test $have_pthread_rwlock_init = yes; then + AC_MSG_WARN([Forced usage of pthread rwlocks. Note that this implementation may suffer from starvation issues.]) + else + AC_MSG_ERROR([User forced usage of pthread rwlock, but no such implementation was found]) + fi + fi + + AC_CHECK_FUNC(pthread_attr_setguardsize, \ + AC_DEFINE(ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE, 1, \ +[Define if you have the pthread_attr_setguardsize function.])) + + linux_futex=no + AC_MSG_CHECKING([for Linux futexes]) + AC_TRY_LINK([ + #include <sys/syscall.h> + #include <unistd.h> + #include <linux/futex.h> + #include <sys/time.h> + ], + [ + int i = 1; + syscall(__NR_futex, (void *) &i, FUTEX_WAKE, 1, + (void*)0,(void*)0, 0); + syscall(__NR_futex, (void *) &i, FUTEX_WAIT, 0, + (void*)0,(void*)0, 0); + return 0; + ], + linux_futex=yes) + AC_MSG_RESULT([$linux_futex]) + test $linux_futex = yes && AC_DEFINE(ETHR_HAVE_LINUX_FUTEX, 1, [Define if you have a linux futex implementation.]) + + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(long long) + AC_CHECK_SIZEOF(__int128_t) + + if test "$ac_cv_sizeof_int" = "4"; then + int32="int" + elif test "$ac_cv_sizeof_long" = "4"; then + int32="long" + elif test "$ac_cv_sizeof_long_long" = "4"; then + int32="long long" + else + AC_MSG_ERROR([No 32-bit type found]) + fi + + if test "$ac_cv_sizeof_int" = "8"; then + int64="int" + elif test "$ac_cv_sizeof_long" = "8"; then + int64="long" + elif test "$ac_cv_sizeof_long_long" = "8"; then + int64="long long" + else + AC_MSG_ERROR([No 64-bit type found]) + fi + + int128=no + if test "$ac_cv_sizeof___int128_t" = "16"; then + int128="__int128_t" + fi + + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP32, 1, [Define if you have __sync_val_compare_and_swap() for 32-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH32, 1, [Define if you have __sync_add_and_fetch() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND32, 1, [Define if you have __sync_fetch_and_and() for 32-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [32], [$int32], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR32, 1, [Define if you have __sync_fetch_and_or() for 32-bit integers])) + + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP64, 1, [Define if you have __sync_val_compare_and_swap() for 64-bit integers])) + test "$have_sync_op" = "yes" && ethr_have_native_atomics=yes + ETHR_CHK_SYNC_OP([__sync_add_and_fetch], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_ADD_AND_FETCH64, 1, [Define if you have __sync_add_and_fetch() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_and], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_AND64, 1, [Define if you have __sync_fetch_and_and() for 64-bit integers])) + ETHR_CHK_SYNC_OP([__sync_fetch_and_or], [2], [64], [$int64], AC_DEFINE(ETHR_HAVE___SYNC_FETCH_AND_OR64, 1, [Define if you have __sync_fetch_and_or() for 64-bit integers])) + + if test $int128 != no; then + ETHR_CHK_SYNC_OP([__sync_val_compare_and_swap], [3], [128], [$int128], AC_DEFINE(ETHR_HAVE___SYNC_VAL_COMPARE_AND_SWAP128, 1, [Define if you have __sync_val_compare_and_swap() for 128-bit integers])) + fi + + AC_MSG_CHECKING([for a usable libatomic_ops implementation]) + case "x$with_libatomic_ops" in + xno | xyes | x) + libatomic_ops_include= + ;; + *) + if test -d "${with_libatomic_ops}/include"; then + libatomic_ops_include="-I$with_libatomic_ops/include" + CPPFLAGS="$CPPFLAGS $libatomic_ops_include" + else + AC_MSG_ERROR([libatomic_ops include directory $with_libatomic_ops/include not found]) + fi;; + esac + ethr_have_libatomic_ops=no + AC_TRY_LINK([#include "atomic_ops.h"], + [ + volatile AO_t x; + AO_t y; + int z; + + AO_nop_full(); + AO_store(&x, (AO_t) 0); + z = AO_load(&x); + z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t) 1); + ], + [ethr_have_native_atomics=yes + ethr_have_libatomic_ops=yes]) + AC_MSG_RESULT([$ethr_have_libatomic_ops]) + if test $ethr_have_libatomic_ops = yes; then + AC_CHECK_SIZEOF(AO_t, , + [ + #include <stdio.h> + #include "atomic_ops.h" + ]) + AC_DEFINE_UNQUOTED(ETHR_SIZEOF_AO_T, $ac_cv_sizeof_AO_t, [Define to the size of AO_t if libatomic_ops is used]) + + AC_DEFINE(ETHR_HAVE_LIBATOMIC_OPS, 1, [Define if you have libatomic_ops atomic operations]) + if test "x$with_libatomic_ops" != "xno" && test "x$with_libatomic_ops" != "x"; then + AC_DEFINE(ETHR_PREFER_LIBATOMIC_OPS_NATIVE_IMPLS, 1, [Define if you prefer libatomic_ops native ethread implementations]) + fi + ETHR_DEFS="$ETHR_DEFS $libatomic_ops_include" + elif test "x$with_libatomic_ops" != "xno" && test "x$with_libatomic_ops" != "x"; then + AC_MSG_ERROR([No usable libatomic_ops implementation found]) + fi + + case "$host_cpu" in + sparc | sun4u | sparc64 | sun4v) + case "$with_sparc_memory_order" in + "TSO") + AC_DEFINE(ETHR_SPARC_TSO, 1, [Define if only run in Sparc TSO mode]);; + "PSO") + AC_DEFINE(ETHR_SPARC_PSO, 1, [Define if only run in Sparc PSO, or TSO mode]);; + "RMO"|"") + AC_DEFINE(ETHR_SPARC_RMO, 1, [Define if run in Sparc RMO, PSO, or TSO mode]);; + *) + AC_MSG_ERROR([Unsupported Sparc memory order: $with_sparc_memory_order]);; + esac + ethr_have_native_atomics=yes;; + i86pc | i*86 | x86_64 | amd64) + if test "$enable_x86_out_of_order" = "yes"; then + AC_DEFINE(ETHR_X86_OUT_OF_ORDER, 1, [Define if x86/x86_64 out of order instructions should be synchronized]) + fi + ethr_have_native_atomics=yes;; + macppc | ppc | "Power Macintosh") + ethr_have_native_atomics=yes;; + tile) + ethr_have_native_atomics=yes;; + *) + ;; + esac + + test ethr_have_native_atomics = "yes" && ethr_have_native_spinlock=yes + + dnl Restore LIBS + LIBS=$saved_libs + dnl restore CPPFLAGS + CPPFLAGS=$saved_cppflags + + ;; + *) + ;; +esac + +AC_MSG_CHECKING([whether default stack size should be modified]) +if test "x$ethr_modified_default_stack_size" != "x"; then + AC_DEFINE_UNQUOTED(ETHR_MODIFIED_DEFAULT_STACK_SIZE, $ethr_modified_default_stack_size, [Define if you want to modify the default stack size]) + AC_MSG_RESULT([yes; to $ethr_modified_default_stack_size kilo words]) +else + AC_MSG_RESULT([no]) +fi + +if test "x$ETHR_THR_LIB_BASE" != "x"; then + ETHR_DEFS="-DUSE_THREADS $ETHR_DEFS" + ETHR_LIBS="-l$ethr_lib_name -lerts_internal_r $ETHR_X_LIBS" + ETHR_LIB_NAME=$ethr_lib_name +fi + +AC_CHECK_SIZEOF(void *) +AC_DEFINE_UNQUOTED(ETHR_SIZEOF_PTR, $ac_cv_sizeof_void_p, [Define to the size of pointers]) + +AC_CHECK_SIZEOF(int) +AC_DEFINE_UNQUOTED(ETHR_SIZEOF_INT, $ac_cv_sizeof_int, [Define to the size of int]) +AC_CHECK_SIZEOF(long) +AC_DEFINE_UNQUOTED(ETHR_SIZEOF_LONG, $ac_cv_sizeof_long, [Define to the size of long]) +AC_CHECK_SIZEOF(long long) +AC_DEFINE_UNQUOTED(ETHR_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long, [Define to the size of long long]) +AC_CHECK_SIZEOF(__int64) +AC_DEFINE_UNQUOTED(ETHR_SIZEOF___INT64, $ac_cv_sizeof___int64, [Define to the size of __int64]) +AC_CHECK_SIZEOF(__int128_t) +AC_DEFINE_UNQUOTED(ETHR_SIZEOF___INT128_T, $ac_cv_sizeof___int128_t, [Define to the size of __int128_t]) + + +case X$erl_xcomp_bigendian in + X) ;; + Xyes|Xno) ac_cv_c_bigendian=$erl_xcomp_bigendian;; + *) AC_MSG_ERROR([Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian]);; +esac + +AC_C_BIGENDIAN + +if test "$ac_cv_c_bigendian" = "yes"; then + AC_DEFINE(ETHR_BIGENDIAN, 1, [Define if bigendian]) +fi + +case X$erl_xcomp_double_middle_endian in + X) ;; + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; + *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);; +esac + +AC_C_DOUBLE_MIDDLE_ENDIAN + +AC_ARG_ENABLE(native-ethr-impls, + AS_HELP_STRING([--disable-native-ethr-impls], + [disable native ethread implementations]), +[ case "$enableval" in + no) disable_native_ethr_impls=yes ;; + *) disable_native_ethr_impls=no ;; + esac ], disable_native_ethr_impls=no) + +AC_ARG_ENABLE(x86-out-of-order, + AS_HELP_STRING([--enable-x86-out-of-order], + [enable x86/x84_64 out of order support (default disabled)])) + +test "X$disable_native_ethr_impls" = "Xyes" && + AC_DEFINE(ETHR_DISABLE_NATIVE_IMPLS, 1, [Define if you want to disable native ethread implementations]) + +AC_ARG_ENABLE(prefer-gcc-native-ethr-impls, + AS_HELP_STRING([--enable-prefer-gcc-native-ethr-impls], + [prefer gcc native ethread implementations]), +[ case "$enableval" in + yes) enable_prefer_gcc_native_ethr_impls=yes ;; + *) enable_prefer_gcc_native_ethr_impls=no ;; + esac ], enable_prefer_gcc_native_ethr_impls=no) + +test $enable_prefer_gcc_native_ethr_impls = yes && + AC_DEFINE(ETHR_PREFER_GCC_NATIVE_IMPLS, 1, [Define if you prefer gcc native ethread implementations]) + +AC_ARG_WITH(libatomic_ops, + AS_HELP_STRING([--with-libatomic_ops=PATH], + [specify and prefer usage of libatomic_ops in the ethread library])) + +AC_ARG_WITH(with_sparc_memory_order, + AS_HELP_STRING([--with-sparc-memory-order=TSO|PSO|RMO], + [specify sparc memory order (defaults to RMO)])) + +ETHR_X86_SSE2_ASM=no +case "$GCC-$ac_cv_sizeof_void_p-$host_cpu" in + yes-4-i86pc | yes-4-i*86 | yes-4-x86_64 | yes-4-amd64) + AC_MSG_CHECKING([for gcc sse2 asm support]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -msse2" + gcc_sse2_asm=no + AC_TRY_COMPILE([], + [ + long long x, *y; + __asm__ __volatile__("movq %1, %0\n\t" : "=x"(x) : "m"(*y) : "memory"); + ], + [gcc_sse2_asm=yes]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$gcc_sse2_asm]) + if test "$gcc_sse2_asm" = "yes"; then + AC_DEFINE(ETHR_GCC_HAVE_SSE2_ASM_SUPPORT, 1, [Define if you use a gcc that supports -msse2 and understand sse2 specific asm statements]) + ETHR_X86_SSE2_ASM=yes + fi + ;; + *) + ;; +esac + +case "$GCC-$host_cpu" in + yes-i86pc | yes-i*86 | yes-x86_64 | yes-amd64) + gcc_dw_cmpxchg_asm=no + AC_MSG_CHECKING([for gcc double word cmpxchg asm support]) + AC_TRY_COMPILE([], + [ + char xchgd; + long new[2], xchg[2], *p; + __asm__ __volatile__( +#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__ + "pushl %%ebx\n\t" + "movl %8, %%ebx\n\t" +#endif +#if ETHR_SIZEOF_PTR == 4 + "lock; cmpxchg8b %0\n\t" +#else + "lock; cmpxchg16b %0\n\t" +#endif + "setz %3\n\t" +#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__ + "popl %%ebx\n\t" +#endif + : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=c"(xchgd) + : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "3"(new[1]), +#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__ + "r"(new[0]) +#else + "b"(new[0]) +#endif + : "cc", "memory"); + + ], + [gcc_dw_cmpxchg_asm=yes]) + if test $gcc_dw_cmpxchg_asm = no && test $ac_cv_sizeof_void_p = 4; then + AC_TRY_COMPILE([], + [ + char xchgd; + long new[2], xchg[2], *p; +#if !defined(__PIC__) || !__PIC__ +# error nope +#endif + __asm__ __volatile__( + "pushl %%ebx\n\t" + "movl (%7), %%ebx\n\t" + "movl 4(%7), %%ecx\n\t" + "lock; cmpxchg8b %0\n\t" + "setz %3\n\t" + "popl %%ebx\n\t" + : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=c"(xchgd) + : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "3"(new) + : "cc", "memory"); + + ], + [gcc_dw_cmpxchg_asm=yes]) + if test "$gcc_dw_cmpxchg_asm" = "yes"; then + AC_DEFINE(ETHR_CMPXCHG8B_REGISTER_SHORTAGE, 1, [Define if you get a register shortage with cmpxchg8b and position independent code]) + fi + fi + AC_MSG_RESULT([$gcc_dw_cmpxchg_asm]) + if test "$gcc_dw_cmpxchg_asm" = "yes"; then + AC_DEFINE(ETHR_GCC_HAVE_DW_CMPXCHG_ASM_SUPPORT, 1, [Define if you use a gcc that supports the double word cmpxchg instruction]) + fi;; + *) + ;; +esac + +AC_DEFINE(ETHR_HAVE_ETHREAD_DEFINES, 1, \ +[Define if you have all ethread defines]) + +AC_SUBST(ETHR_X_LIBS) +AC_SUBST(ETHR_LIBS) +AC_SUBST(ETHR_LIB_NAME) +AC_SUBST(ETHR_DEFS) +AC_SUBST(ETHR_THR_LIB_BASE) +AC_SUBST(ETHR_THR_LIB_BASE_DIR) +AC_SUBST(ETHR_X86_SSE2_ASM) + +]) + + + +dnl ---------------------------------------------------------------------- +dnl +dnl ERL_TIME_CORRECTION +dnl +dnl In the presence of a high resolution realtime timer Erlang can adapt +dnl its view of time relative to this timer. On solaris such a timer is +dnl available with the syscall gethrtime(). On other OS's a fallback +dnl solution using times() is implemented. (However on e.g. FreeBSD times() +dnl is implemented using gettimeofday so it doesn't make much sense to +dnl use it there...) On second thought, it seems to be safer to do it the +dnl other way around. I.e. only use times() on OS's where we know it will +dnl work... +dnl + +AC_DEFUN(ERL_TIME_CORRECTION, +[if test x$ac_cv_func_gethrtime = x; then + AC_CHECK_FUNC(gethrtime) +fi +if test x$clock_gettime_correction = xunknown; then + AC_TRY_COMPILE([#include <time.h>], + [struct timespec ts; + long long result; + clock_gettime(CLOCK_MONOTONIC,&ts); + result = ((long long) ts.tv_sec) * 1000000000LL + + ((long long) ts.tv_nsec);], + clock_gettime_compiles=yes, + clock_gettime_compiles=no) +else + clock_gettime_compiles=no +fi + + +AC_CACHE_CHECK([how to correct for time adjustments], erl_cv_time_correction, +[ +case $clock_gettime_correction in + yes) + erl_cv_time_correction=clock_gettime;; + no|unknown) + case $ac_cv_func_gethrtime in + yes) + erl_cv_time_correction=hrtime ;; + no) + case $host_os in + linux*) + case $clock_gettime_correction in + unknown) + if test x$clock_gettime_compiles = xyes; then + if test X$cross_compiling != Xyes; then + linux_kernel_vsn_=`uname -r` + case $linux_kernel_vsn_ in + [[0-1]].*|2.[[0-5]]|2.[[0-5]].*) + erl_cv_time_correction=times ;; + *) + erl_cv_time_correction=clock_gettime;; + esac + else + case X$erl_xcomp_linux_clock_gettime_correction in + X) + erl_cv_time_correction=cross;; + Xyes|Xno) + if test $erl_xcomp_linux_clock_gettime_correction = yes; then + erl_cv_time_correction=clock_gettime + else + erl_cv_time_correction=times + fi;; + *) + AC_MSG_ERROR([Bad erl_xcomp_linux_clock_gettime_correction value: $erl_xcomp_linux_clock_gettime_correction]);; + esac + fi + else + erl_cv_time_correction=times + fi + ;; + *) + erl_cv_time_correction=times ;; + esac + ;; + *) + erl_cv_time_correction=none ;; + esac + ;; + esac + ;; +esac +]) + +xrtlib="" +case $erl_cv_time_correction in + times) + AC_DEFINE(CORRECT_USING_TIMES,[], + [Define if you do not have a high-res. timer & want to use times() instead]) + ;; + clock_gettime|cross) + if test $erl_cv_time_correction = cross; then + erl_cv_time_correction=clock_gettime + AC_MSG_WARN([result clock_gettime guessed because of cross compilation]) + fi + xrtlib="-lrt" + AC_DEFINE(GETHRTIME_WITH_CLOCK_GETTIME,[1], + [Define if you want to use clock_gettime to simulate gethrtime]) + ;; +esac +dnl +dnl Check if gethrvtime is working, and if to use procfs ioctl +dnl or (yet to be written) write to the procfs ctl file. +dnl + +AC_MSG_CHECKING([if gethrvtime works and how to use it]) +AC_TRY_RUN([ +/* gethrvtime procfs ioctl test */ +/* These need to be undef:ed to not break activation of + * micro level process accounting on /proc/self + */ +#ifdef _LARGEFILE_SOURCE +# undef _LARGEFILE_SOURCE +#endif +#ifdef _FILE_OFFSET_BITS +# undef _FILE_OFFSET_BITS +#endif +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <stdio.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/signal.h> +#include <sys/fault.h> +#include <sys/syscall.h> +#include <sys/procfs.h> +#include <fcntl.h> + +int main() { + long msacct = PR_MSACCT; + int fd; + long long start, stop; + int i; + pid_t pid = getpid(); + char proc_self[30] = "/proc/"; + + sprintf(proc_self+strlen(proc_self), "%lu", (unsigned long) pid); + if ( (fd = open(proc_self, O_WRONLY)) == -1) + exit(1); + if (ioctl(fd, PIOCSET, &msacct) < 0) + exit(2); + if (close(fd) < 0) + exit(3); + start = gethrvtime(); + for (i = 0; i < 100; i++) + stop = gethrvtime(); + if (start == 0) + exit(4); + if (start == stop) + exit(5); + exit(0); return 0; +} +], +erl_gethrvtime=procfs_ioctl, +erl_gethrvtime=false, +[ +case X$erl_xcomp_gethrvtime_procfs_ioctl in + X) + erl_gethrvtime=cross;; + Xyes|Xno) + if test $erl_xcomp_gethrvtime_procfs_ioctl = yes; then + erl_gethrvtime=procfs_ioctl + else + erl_gethrvtime=false + fi;; + *) + AC_MSG_ERROR([Bad erl_xcomp_gethrvtime_procfs_ioctl value: $erl_xcomp_gethrvtime_procfs_ioctl]);; +esac +]) + +case $erl_gethrvtime in + procfs_ioctl) + AC_DEFINE(HAVE_GETHRVTIME_PROCFS_IOCTL,[1], + [define if gethrvtime() works and uses ioctl() to /proc/self]) + AC_MSG_RESULT(uses ioctl to procfs) + ;; + *) + if test $erl_gethrvtime = cross; then + erl_gethrvtime=false + AC_MSG_RESULT(cross) + AC_MSG_WARN([result 'not working' guessed because of cross compilation]) + else + AC_MSG_RESULT(not working) + fi + + dnl + dnl Check if clock_gettime (linux) is working + dnl + + AC_MSG_CHECKING([if clock_gettime can be used to get process CPU time]) + save_libs=$LIBS + LIBS="-lrt" + AC_TRY_RUN([ + #include <stdlib.h> + #include <unistd.h> + #include <string.h> + #include <stdio.h> + #include <time.h> + int main() { + long long start, stop; + int i; + struct timespec tp; + + if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tp) < 0) + exit(1); + start = ((long long)tp.tv_sec * 1000000000LL) + (long long)tp.tv_nsec; + for (i = 0; i < 100; i++) + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tp); + stop = ((long long)tp.tv_sec * 1000000000LL) + (long long)tp.tv_nsec; + if (start == 0) + exit(4); + if (start == stop) + exit(5); + exit(0); return 0; + } + ], + erl_clock_gettime=yes, + erl_clock_gettime=no, + [ + case X$erl_xcomp_clock_gettime_cpu_time in + X) erl_clock_gettime=cross;; + Xyes|Xno) erl_clock_gettime=$erl_xcomp_clock_gettime_cpu_time;; + *) AC_MSG_ERROR([Bad erl_xcomp_clock_gettime_cpu_time value: $erl_xcomp_clock_gettime_cpu_time]);; + esac + ]) + LIBS=$save_libs + case $host_os in + linux*) + AC_MSG_RESULT([no; not stable]) + LIBRT=$xrtlib + ;; + *) + AC_MSG_RESULT($erl_clock_gettime) + case $erl_clock_gettime in + yes) + AC_DEFINE(HAVE_CLOCK_GETTIME,[], + [define if clock_gettime() works for getting process time]) + LIBRT=-lrt + ;; + cross) + erl_clock_gettime=no + AC_MSG_WARN([result no guessed because of cross compilation]) + LIBRT=$xrtlib + ;; + *) + LIBRT=$xrtlib + ;; + esac + ;; + esac + AC_SUBST(LIBRT) + ;; +esac +])dnl + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_TRY_ENABLE_CFLAG +dnl +dnl +dnl Tries a CFLAG and sees if it can be enabled without compiler errors +dnl $1: textual cflag to add +dnl $2: variable to store the modified CFLAG in +dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) +dnl +dnl +AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) + saved_CFLAGS=$CFLAGS; + CFLAGS="$1 $$2"; + AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue"; then + AC_MSG_RESULT([yes]) + AS_VAR_SET($2, "$1 $$2") + else + AC_MSG_RESULT([no]) + fi +]) + +dnl ERL_TRY_LINK_JAVA(CLASSES, FUNCTION-BODY +dnl [ACTION_IF_FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Freely inspired by AC_TRY_LINK. (Maybe better to create a +dnl AC_LANG_JAVA instead...) +AC_DEFUN(ERL_TRY_LINK_JAVA, +[java_link='$JAVAC conftest.java 1>&AC_FD_CC' +changequote(, )dnl +cat > conftest.java <<EOF +$1 +class conftest { public static void main(String[] args) { + $2 + ; return; }} +EOF +changequote([, ])dnl +if AC_TRY_EVAL(java_link) && test -s conftest.class; then + ifelse([$3], , :, [rm -rf conftest* + $3]) +else + echo "configure: failed program was:" 1>&AC_FD_CC + cat conftest.java 1>&AC_FD_CC + echo "configure: PATH was $PATH" 1>&AC_FD_CC +ifelse([$4], , , [ rm -rf conftest* + $4 +])dnl +fi +rm -f conftest*]) +#define UNSAFE_MASK 0xc0000000 /* Mask for bits that must be constant */ + + diff --git a/lib/megaco/configure.in b/lib/megaco/configure.in index 722ccc3fb4..643267a154 100644 --- a/lib/megaco/configure.in +++ b/lib/megaco/configure.in @@ -162,6 +162,11 @@ else fi AC_SUBST(OTP_EXTRA_FLAGS) +if test "x$GCC" = xyes; then + # Treat certain GCC warnings as errors + LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) +fi + dnl dnl If ${ERL_TOP}/make/otp_ded.mk.in exists and contains DED_MK_VSN > 0, dnl every thing releted to compiling Dynamic Erlang Drivers can be found diff --git a/lib/megaco/doc/src/definitions/term.defs b/lib/megaco/doc/src/definitions/term.defs index f3d6f865d2..57379eaa5d 100644 --- a/lib/megaco/doc/src/definitions/term.defs +++ b/lib/megaco/doc/src/definitions/term.defs @@ -110,7 +110,6 @@ the module Erlang in the application kernel","kenneth"}, {"Master Agent","Master Agent","The SNMP agent system consists of one Master Agent which terminates the SNMP protocol","mbj"}, {"MIB","Management Information Base (MIB)","An abstract definition of the management information available through a management interface in a system.","mbj"}, {"matching","matching","See pattern matching.","kenneth"}, {"message queue","message queue","The queue of not yet received messages that are in the mailbox of a process.","olin"}, -{"Mnemosyne","Mnemosyne","Mnemosyne was the query language of Mnesia up to the R11B release. Supersed by QLC.","hakan"}, {"Mnesia","Mnesia","Mnesia is a distributed Database Management System, appropriate for telecommunications applications and other applications with need of continuous operation and soft real-time properties.","hakan"}, {"MIBshort","MIB","See Management Information Base.","mbj"}, {"MIME","MIME","Multi-purpose Internet Mail Extensions.","jocke"}, diff --git a/lib/megaco/doc/src/definitions/term.defs.xml b/lib/megaco/doc/src/definitions/term.defs.xml index 28ac0d6eaf..1c80ee8d80 100644 --- a/lib/megaco/doc/src/definitions/term.defs.xml +++ b/lib/megaco/doc/src/definitions/term.defs.xml @@ -794,13 +794,6 @@ The queue of not yet received messages that are in the mailbox of a process. <resp>olin</resp> </term> <term> - <id>Mnemosyne</id> - <shortdef>Mnemosyne</shortdef> - <def> -Mnemosyne was the query language of Mnesia up to the R11B release. Supersed by QLC.</def> - <resp>hakan</resp> - </term> - <term> <id>Mnesia</id> <shortdef>Mnesia</shortdef> <def> diff --git a/lib/megaco/examples/meas/Makefile.in b/lib/megaco/examples/meas/Makefile.in index c517fd21cf..91e342cd9a 100644 --- a/lib/megaco/examples/meas/Makefile.in +++ b/lib/megaco/examples/meas/Makefile.in @@ -147,12 +147,12 @@ release_docs_spec: # ---------------------------------------------------- meas.sh.skel: meas.sh.skel.src - @echo "transforming $< to $@" - $(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ + $(V_colon)@echo "transforming $< to $@" + $(vsn_verbose)$(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ mstone1.sh.skel: mstone1.sh.skel.src - @echo "transforming $< to $@" - $(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ + $(V_colon)@echo "transforming $< to $@" + $(vsn_verbose)$(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ megaco_codec_transform.$(EMULATOR): megaco_codec_transform.erl diff --git a/lib/megaco/src/app/Makefile b/lib/megaco/src/app/Makefile index 42030c5b1c..d18da5326a 100644 --- a/lib/megaco/src/app/Makefile +++ b/lib/megaco/src/app/Makefile @@ -94,10 +94,10 @@ info: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ diff --git a/lib/megaco/src/binary/Makefile b/lib/megaco/src/binary/Makefile index 660713605e..c1fd66b848 100644 --- a/lib/megaco/src/binary/Makefile +++ b/lib/megaco/src/binary/Makefile @@ -129,12 +129,13 @@ opt: prebuild $(TARGET_FILES) prebuild: prebuild.skip prebuild.skip: - @echo "Building prebuild.skip\c" + $(gen_verbose) + $(V_colon)@echo "Building prebuild.skip\c" @touch prebuild.skip @for a in $(SPEC_ASN1DB); do \ echo $$a >> prebuild.skip; \ done - @echo "" + $(V_colon)@echo "" v1: $(V2_SPEC_BINS) diff --git a/lib/megaco/src/binary/depend.mk b/lib/megaco/src/binary/depend.mk index a1318079be..2dce45981f 100644 --- a/lib/megaco/src/binary/depend.mk +++ b/lib/megaco/src/binary/depend.mk @@ -53,8 +53,8 @@ PER_V3_FLAGS = $(ASN1_CT_OPTS) $(BER_ASN1_V1_SPEC).erl: \ $(BER_ASN1_V1_SPEC).set.asn \ $(ASN1_V1_SPEC).asn - @echo "$(BER_ASN1_V1_SPEC):" - $(ERLC) -bber $(BER_V1_FLAGS) $(BER_ASN1_V1_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_V1_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_V1_FLAGS) $(BER_ASN1_V1_SPEC).set.asn $(EBIN)/$(BER_ASN1_V1_SPEC).$(EMULATOR): \ $(BER_ASN1_V1_SPEC).erl @@ -62,8 +62,8 @@ $(EBIN)/$(BER_ASN1_V1_SPEC).$(EMULATOR): \ $(PER_ASN1_V1_SPEC).erl: \ $(PER_ASN1_V1_SPEC).set.asn \ $(ASN1_V1_SPEC).asn - @echo "$(PER_ASN1_V1_SPEC):" - $(ERLC) -bper $(PER_V1_FLAGS) $(PER_ASN1_V1_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_V1_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_V1_FLAGS) $(PER_ASN1_V1_SPEC).set.asn $(EBIN)/$(PER_ASN1_V1_SPEC).$(EMULATOR): \ $(PER_ASN1_V1_SPEC).erl @@ -74,8 +74,8 @@ $(EBIN)/$(PER_ASN1_V1_SPEC).$(EMULATOR): \ $(BER_ASN1_V2_SPEC).erl: \ $(BER_ASN1_V2_SPEC).set.asn \ $(ASN1_V2_SPEC).asn - @echo "$(BER_ASN1_V2_SPEC):" - $(ERLC) -bber $(BER_V2_FLAGS) $(BER_ASN1_V2_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_V2_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_V2_FLAGS) $(BER_ASN1_V2_SPEC).set.asn $(EBIN)/$(BER_ASN1_V2_SPEC).$(EMULATOR): \ $(BER_ASN1_V2_SPEC).erl @@ -83,8 +83,8 @@ $(EBIN)/$(BER_ASN1_V2_SPEC).$(EMULATOR): \ $(PER_ASN1_V2_SPEC).erl: \ $(PER_ASN1_V2_SPEC).set.asn \ $(ASN1_V2_SPEC).asn - @echo "$(PER_ASN1_V2_SPEC):" - $(ERLC) -bper $(PER_V2_FLAGS) $(PER_ASN1_V2_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_V2_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_V2_FLAGS) $(PER_ASN1_V2_SPEC).set.asn $(EBIN)/$(PER_ASN1_V2_SPEC).$(EMULATOR): \ $(PER_ASN1_V2_SPEC).erl @@ -96,8 +96,8 @@ $(EBIN)/$(PER_ASN1_V2_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3A_SPEC).erl: \ $(BER_ASN1_PREV3A_SPEC).set.asn \ $(ASN1_PREV3A_SPEC).asn - @echo "$(BER_ASN1_PREV3A_SPEC):" - $(ERLC) -bber $(BER_PREV3A_FLAGS) $(BER_ASN1_PREV3A_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_PREV3A_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_PREV3A_FLAGS) $(BER_ASN1_PREV3A_SPEC).set.asn $(EBIN)/$(BER_ASN1_PREV3A_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3A_SPEC).erl @@ -105,8 +105,8 @@ $(EBIN)/$(BER_ASN1_PREV3A_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3A_SPEC).erl: \ $(PER_ASN1_PREV3A_SPEC).set.asn \ $(ASN1_PREV3A_SPEC).asn - @echo "$(PER_ASN1_PREV3A_SPEC):" - $(ERLC) -bper $(PER_PREV3A_FLAGS) $(PER_ASN1_PREV3A_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_PREV3A_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_PREV3A_FLAGS) $(PER_ASN1_PREV3A_SPEC).set.asn $(EBIN)/$(PER_ASN1_PREV3A_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3A_SPEC).erl @@ -117,8 +117,8 @@ $(EBIN)/$(PER_ASN1_PREV3A_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3B_SPEC).erl: \ $(BER_ASN1_PREV3B_SPEC).set.asn \ $(ASN1_PREV3B_SPEC).asn - @echo "$(BER_ASN1_PREV3B_SPEC):" - $(ERLC) -bber $(BER_PREV3B_FLAGS) $(BER_ASN1_PREV3B_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_PREV3B_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_PREV3B_FLAGS) $(BER_ASN1_PREV3B_SPEC).set.asn $(EBIN)/$(BER_ASN1_PREV3B_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3B_SPEC).erl @@ -126,8 +126,8 @@ $(EBIN)/$(BER_ASN1_PREV3B_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3B_SPEC).erl: \ $(PER_ASN1_PREV3B_SPEC).set.asn \ $(ASN1_PREV3B_SPEC).asn - @echo "$(PER_ASN1_PREV3B_SPEC):" - $(ERLC) -bper $(PER_PREV3B_FLAGS) $(PER_ASN1_PREV3B_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_PREV3B_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_PREV3B_FLAGS) $(PER_ASN1_PREV3B_SPEC).set.asn $(EBIN)/$(PER_ASN1_PREV3B_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3B_SPEC).erl @@ -138,8 +138,8 @@ $(EBIN)/$(PER_ASN1_PREV3B_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3C_SPEC).erl: \ $(BER_ASN1_PREV3C_SPEC).set.asn \ $(ASN1_PREV3C_SPEC).asn - @echo "$(BER_ASN1_PREV3C_SPEC):" - $(ERLC) -bber $(BER_PREV3C_FLAGS) $(BER_ASN1_PREV3C_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_PREV3C_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_PREV3C_FLAGS) $(BER_ASN1_PREV3C_SPEC).set.asn $(EBIN)/$(BER_ASN1_PREV3C_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3C_SPEC).erl @@ -147,8 +147,8 @@ $(EBIN)/$(BER_ASN1_PREV3C_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3C_SPEC).erl: \ $(PER_ASN1_PREV3C_SPEC).set.asn \ $(ASN1_PREV3C_SPEC).asn - @echo "$(PER_ASN1_PREV3C_SPEC):" - $(ERLC) -bper $(PER_PREV3C_FLAGS) $(PER_ASN1_PREV3C_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_PREV3C_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_PREV3C_FLAGS) $(PER_ASN1_PREV3C_SPEC).set.asn $(EBIN)/$(PER_ASN1_PREV3C_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3C_SPEC).erl @@ -159,8 +159,8 @@ $(EBIN)/$(PER_ASN1_PREV3C_SPEC).$(EMULATOR): \ $(BER_ASN1_V3_SPEC).erl: \ $(BER_ASN1_V3_SPEC).set.asn \ $(ASN1_V3_SPEC).asn - @echo "$(BER_ASN1_V3_SPEC):" - $(ERLC) -bber $(BER_V3_FLAGS) $(BER_ASN1_V3_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_V3_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_V3_FLAGS) $(BER_ASN1_V3_SPEC).set.asn $(EBIN)/$(BER_ASN1_V3_SPEC).$(EMULATOR): \ $(BER_ASN1_V3_SPEC).erl @@ -168,8 +168,8 @@ $(EBIN)/$(BER_ASN1_V3_SPEC).$(EMULATOR): \ $(PER_ASN1_V3_SPEC).erl: \ $(PER_ASN1_V3_SPEC).set.asn \ $(ASN1_V3_SPEC).asn - @echo "$(PER_ASN1_V3_SPEC):" - $(ERLC) -bper $(PER_V3_FLAGS) $(PER_ASN1_V3_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_V3_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_V3_FLAGS) $(PER_ASN1_V3_SPEC).set.asn $(EBIN)/$(PER_ASN1_V3_SPEC).$(EMULATOR): \ $(PER_ASN1_V3_SPEC).erl diff --git a/lib/megaco/src/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in index cb5f5412f4..6111cf2304 100644 --- a/lib/megaco/src/flex/Makefile.in +++ b/lib/megaco/src/flex/Makefile.in @@ -319,16 +319,16 @@ release_docs_spec: $(STD_DRV).flex: megaco_flex_scanner_drv.flex.src ifeq ($(ENABLE_MEGACO_FLEX_SCANNER_LINENO),true) - @printf "std [flex] scanner - lineno enabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "std [flex] scanner - lineno enabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; *\//' \ < $< > $@ else - @printf "std [flex] scanner - lineno disabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "std [flex] scanner - lineno disabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ @@ -339,16 +339,16 @@ endif $(MT_DRV).flex: megaco_flex_scanner_drv.flex.src ifeq ($(ENABLE_MEGACO_FLEX_SCANNER_LINENO),true) ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) - @printf "multi-threaded reentrant [flex] scanner - lineno enabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "multi-threaded reentrant [flex] scanner - lineno enabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ s/%MEGACO_YY_REENTRANT_OPTION%/%option reentrant/ ; \ s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; *\//' \ < $< > $@ else - @printf "multi-threaded non-reentrant [flex] scanner - lineno enabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "multi-threaded non-reentrant [flex] scanner - lineno enabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ @@ -357,16 +357,16 @@ else endif else ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) - @printf "multi-threaded reentrant [flex] scanner - lineno disabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "multi-threaded reentrant [flex] scanner - lineno disabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ s/%MEGACO_YY_REENTRANT_OPTION%/%option reentrant/ ; \ s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; - REENTRANT SCANNER*\//' \ < $< > $@ else - @printf "multi-threaded non-reentrant [flex] scanner - lineno disabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "multi-threaded non-reentrant [flex] scanner - lineno disabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ @@ -376,31 +376,31 @@ endif endif # megaco_flex_scanner_drv.c: megaco_flex_scanner_drv.flex -# $(LEX) $(LEX_FLAGS) -P$* -o$@ $< +# $(V_LEX) $(LEX_FLAGS) -P$* -o$@ $< $(STD_DRV).c: $(STD_DRV).flex - $(LEX) $(STD_LEX_FLAGS) -P$* -o$@ $< + $(V_LEX) $(STD_LEX_FLAGS) -P$* -o$@ $< $(MT_DRV).c: $(MT_DRV).flex - $(LEX) $(MT_LEX_FLAGS) -P$* -o$@ $< + $(V_LEX) $(MT_LEX_FLAGS) -P$* -o$@ $< _create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR)) solibs: $(SOLIBS) $(OBJDIR)/$(STD_DRV).o: $(STD_DRV).c - @echo "compiling std driver:" - $(CC) -c $(STD_DRV_NAME) $(CFLAGS) -o $@ $< + $(V_colon)@echo "compiling std driver:" + $(V_CC) -c $(STD_DRV_NAME) $(CFLAGS) -o $@ $< $(OBJDIR)/$(MT_DRV).o: $(MT_DRV).c - @echo "compiling multi-threaded driver:" - $(CC) -c $(MT_DRV_NAME) $(CFLAGS_MT) -o $@ $< + $(V_colon)@echo "compiling multi-threaded driver:" + $(V_CC) -c $(MT_DRV_NAME) $(CFLAGS_MT) -o $@ $< # No need to link with -lfl as we have also defined %option noyywrap - # and having -lfl doesn't work under Darwin for some reason. - Sean $(LIBDIR)/$(STD_DRV).$(DED_EXT): $(OBJDIR)/$(STD_DRV).o - @echo "linking std driver:" - $(LD) $(LDFLAGS) -o $@ $< + $(V_colon)@echo "linking std driver:" + $(V_LD) $(LDFLAGS) -o $@ $< $(LIBDIR)/$(MT_DRV).$(DED_EXT): $(OBJDIR)/$(MT_DRV).o - @echo "linking multi-threaded driver:" - $(LD) $(LDFLAGS) -o $@ $< + $(V_colon)@echo "linking multi-threaded driver:" + $(V_LD) $(LDFLAGS) -o $@ $< diff --git a/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src b/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src index b8146c345d..5faddb08c5 100644 --- a/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src +++ b/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src @@ -76,6 +76,7 @@ typedef struct { ErlDrvPort port; + ErlDrvTermData port_id; char* digit_map_name_ptr; int digit_map_name_len; char* digit_map_value_ptr; @@ -1497,6 +1498,7 @@ static ErlDrvData mfs_start(ErlDrvPort port, char *buf) DBG( ("mfs_start -> entry\n") ); dataP->port = port; + dataP->port_id = driver_mk_port(port); dataP->digit_map_name_ptr = NULL; dataP->digit_map_name_len = 0; dataP->digit_map_value_ptr = NULL; @@ -1841,10 +1843,10 @@ static ErlDrvSSizeT mfs_control(ErlDrvData handle, "\n term_spec_size: %d\n", dataP->term_spec_index, dataP->term_spec_size) ); - driver_send_term(dataP->port, - driver_caller(dataP->port), - dataP->term_spec, - dataP->term_spec_index); + erl_drv_send_term(dataP->port_id, + driver_caller(dataP->port), + dataP->term_spec, + dataP->term_spec_index); if (dataP->text_buf != NULL) FREE(dataP->text_buf); if (dataP->term_spec != NULL) FREE(dataP->term_spec); diff --git a/lib/mnesia/include/mnemosyne.hrl b/lib/mnesia/include/mnemosyne.hrl deleted file mode 100644 index eb6ec53ae1..0000000000 --- a/lib/mnesia/include/mnemosyne.hrl +++ /dev/null @@ -1,18 +0,0 @@ -%% ``The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved via the world wide web at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. -%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -%% AB. All Rights Reserved.'' -%% -%% $Id$ -%% --compile({parse_transform,mnemosyne}). diff --git a/lib/mnesia/src/Makefile b/lib/mnesia/src/Makefile index 6f289433ff..3a146c009a 100644 --- a/lib/mnesia/src/Makefile +++ b/lib/mnesia/src/Makefile @@ -93,10 +93,9 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) # FLAGS # ---------------------------------------------------- ERL_COMPILE_FLAGS += \ - +warn_unused_vars \ + -Werror \ +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,vsn,"mnesia_$(MNESIA_VSN)"}' \ - -W + +'{attribute,insert,vsn,"mnesia_$(MNESIA_VSN)"}' # ---------------------------------------------------- # Targets @@ -120,10 +119,10 @@ $(TARGET_FILES): $(HRL_FILES) # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- diff --git a/lib/mnesia/src/mnesia.erl b/lib/mnesia/src/mnesia.erl index 3d30debc53..3488d5c99b 100644 --- a/lib/mnesia/src/mnesia.erl +++ b/lib/mnesia/src/mnesia.erl @@ -2186,7 +2186,6 @@ system_info2(dump_log_time_threshold) -> mnesia_monitor:get_env(dump_log_time_th system_info2(dump_log_update_in_place) -> mnesia_monitor:get_env(dump_log_update_in_place); system_info2(max_wait_for_decision) -> mnesia_monitor:get_env(max_wait_for_decision); -system_info2(embedded_mnemosyne) -> mnesia_monitor:get_env(embedded_mnemosyne); system_info2(ignore_fallback_at_startup) -> mnesia_monitor:get_env(ignore_fallback_at_startup); system_info2(fallback_error_function) -> mnesia_monitor:get_env(fallback_error_function); system_info2(log_version) -> mnesia_log:version(); @@ -2224,7 +2223,6 @@ system_info_items(yes) -> dump_log_time_threshold, dump_log_update_in_place, dump_log_write_threshold, - embedded_mnemosyne, event_module, extra_db_nodes, fallback_activated, diff --git a/lib/mnesia/src/mnesia_monitor.erl b/lib/mnesia/src/mnesia_monitor.erl index c08bbc879f..d940bd1cb7 100644 --- a/lib/mnesia/src/mnesia_monitor.erl +++ b/lib/mnesia/src/mnesia_monitor.erl @@ -673,7 +673,6 @@ env() -> dump_log_time_threshold, dump_log_update_in_place, dump_log_write_threshold, - embedded_mnemosyne, event_module, extra_db_nodes, ignore_fallback_at_startup, @@ -706,8 +705,6 @@ default_env(dump_log_update_in_place) -> true; default_env(dump_log_write_threshold) -> 1000; -default_env(embedded_mnemosyne) -> - false; default_env(event_module) -> mnesia_event; default_env(extra_db_nodes) -> @@ -757,7 +754,6 @@ do_check_type(event_module, A) when is_atom(A) -> A; do_check_type(ignore_fallback_at_startup, B) -> bool(B); do_check_type(fallback_error_function, {Mod, Func}) when is_atom(Mod), is_atom(Func) -> {Mod, Func}; -do_check_type(embedded_mnemosyne, B) -> bool(B); do_check_type(extra_db_nodes, L) when is_list(L) -> Fun = fun(N) when N == node() -> false; (A) when is_atom(A) -> true diff --git a/lib/mnesia/src/mnesia_sup.erl b/lib/mnesia/src/mnesia_sup.erl index 9ee4086f50..ef858d2364 100644 --- a/lib/mnesia/src/mnesia_sup.erl +++ b/lib/mnesia/src/mnesia_sup.erl @@ -60,9 +60,8 @@ init() -> Event = event_procs(), Kernel = kernel_procs(), - Mnemosyne = mnemosyne_procs(), - {ok, {Flags, Event ++ Kernel ++ Mnemosyne}}. + {ok, {Flags, Event ++ Kernel}}. event_procs() -> KillAfter = timer:seconds(30), @@ -75,16 +74,6 @@ kernel_procs() -> KA = infinity, [{K, {K, start, []}, permanent, KA, supervisor, [K, supervisor]}]. -mnemosyne_procs() -> - case mnesia_monitor:get_env(embedded_mnemosyne) of - true -> - Q = mnemosyne_sup, - KA = infinity, - [{Q, {Q, start, []}, permanent, KA, supervisor, [Q, supervisor]}]; - false -> - [] - end. - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% event handler diff --git a/lib/mnesia/test/mnesia.spec b/lib/mnesia/test/mnesia.spec index 204d1519cb..653e515317 100644 --- a/lib/mnesia/test/mnesia.spec +++ b/lib/mnesia/test/mnesia.spec @@ -42,9 +42,6 @@ {skip_cases,"../mnesia_test",mnesia_measure_test, [measure_all_api_functions], "Not yet implemented"}. -{skip_cases,"../mnesia_test",mnesia_measure_test, - [mnemosyne_vs_mnesia_kernel], - "Not yet implemented"}. {skip_cases,"../mnesia_test",mnesia_examples_test, [company], "Not yet implemented"}. diff --git a/lib/mnesia/test/mnesia_SUITE.erl b/lib/mnesia/test/mnesia_SUITE.erl index 2267a94164..5dbb80d4eb 100644 --- a/lib/mnesia/test/mnesia_SUITE.erl +++ b/lib/mnesia/test/mnesia_SUITE.erl @@ -105,7 +105,6 @@ groups() -> {otp_r4b, [], [{mnesia_config_test, access_module}, {mnesia_config_test, dump_log_load_regulation}, - {mnesia_config_test, embedded_mnemosyne}, {mnesia_config_test, ignore_fallback_at_startup}, {mnesia_config_test, max_wait_for_decision}, {mnesia_consistency_test, consistency_after_restore}, diff --git a/lib/mnesia/test/mnesia_config_test.erl b/lib/mnesia/test/mnesia_config_test.erl index 93510d539c..fd294780da 100644 --- a/lib/mnesia/test/mnesia_config_test.erl +++ b/lib/mnesia/test/mnesia_config_test.erl @@ -36,7 +36,6 @@ dump_log_load_regulation/1, dump_log_update_in_place/1, - embedded_mnemosyne/1, event_module/1, ignore_fallback_at_startup/1, inconsistent_database/1, @@ -104,7 +103,7 @@ end_per_testcase(Func, Conf) -> all() -> [access_module, auto_repair, backup_module, debug, dir, dump_log_load_regulation, {group, dump_log_thresholds}, - dump_log_update_in_place, embedded_mnemosyne, + dump_log_update_in_place, event_module, ignore_fallback_at_startup, inconsistent_database, max_wait_for_decision, send_compressed, app_test, {group, schema_config}, @@ -610,45 +609,6 @@ dump_log_load_regulation(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -embedded_mnemosyne(doc) -> - ["Start Mnemosyne as an embedded part of Mnesia", - "on some of the nodes"]; -embedded_mnemosyne(suite) -> - []; -embedded_mnemosyne(Config) when is_list(Config) -> - Nodes = ?acquire_nodes(1, Config), - Param = embedded_mnemosyne, - - %% Normal - NoMnem = false, - ?match(NoMnem, mnesia:system_info(Param)), - ?match(undefined, whereis(mnemosyne_catalog)), - ?match([], mnesia_test_lib:stop_mnesia(Nodes)), - - %% Bad - Bad = arne_anka, - ?match({error, {bad_type, Param, Bad}}, - mnesia:start([{Param, Bad}])), - - case code:priv_dir(mnemosyne) of - {error, _} -> %% No mnemosyne on later systems - ok; - _ -> - %% Mnemosyne as embedded application - Mnem = true, - ?match(undefined, whereis(mnemosyne_catalog)), - ?match(ok,mnesia:start([{Param, Mnem}])), - ?match(Mnem, mnesia:system_info(Param)), - ?match(Pid when is_pid(Pid), whereis(mnemosyne_catalog)), - ?match([], mnesia_test_lib:stop_mnesia(Nodes)), - ?match(undefined, whereis(mnemosyne_catalog)) - end, - ?verify_mnesia([], Nodes), - ?cleanup(1, Config), - ok. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ignore_fallback_at_startup(doc) -> ["Start Mnesia without rollback of the database to the fallback. ", "Once Mnesia has been (re)started the installed fallback should", diff --git a/lib/mnesia/test/mnesia_measure_test.erl b/lib/mnesia/test/mnesia_measure_test.erl index e63689d83a..dfed302814 100644 --- a/lib/mnesia/test/mnesia_measure_test.erl +++ b/lib/mnesia/test/mnesia_measure_test.erl @@ -72,8 +72,7 @@ groups() -> resource_consumption_at_full_load]}, {benchmarks, [], [{group, meter}, cost, dbn_meters, - measure_all_api_functions, {group, tpcb}, - mnemosyne_vs_mnesia_kernel]}, + measure_all_api_functions, {group, tpcb}]}, {tpcb, [], [ram_tpcb, disc_tpcb, disc_only_tpcb]}, {meter, [], [ram_meter, disc_meter, disc_only_meter]}]. diff --git a/lib/observer/src/Makefile b/lib/observer/src/Makefile index 7135a6abd5..9069415e44 100644 --- a/lib/observer/src/Makefile +++ b/lib/observer/src/Makefile @@ -102,7 +102,8 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) ERL_COMPILE_FLAGS += \ -I../include \ -I ../../et/include \ - -I ../../../libraries/et/include + -I ../../../libraries/et/include \ + -Werror # ---------------------------------------------------- # Targets @@ -114,10 +115,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(TARGET_FILES): $(INTERNAL_HRL_FILES) diff --git a/lib/observer/src/observer_app_wx.erl b/lib/observer/src/observer_app_wx.erl index 380532e90c..72bafcc5e0 100644 --- a/lib/observer/src/observer_app_wx.erl +++ b/lib/observer/src/observer_app_wx.erl @@ -28,7 +28,7 @@ -include("observer_defs.hrl"). %% Import drawing wrappers --import(observer_perf_wx, [haveGC/1, +-import(observer_perf_wx, [haveGC/0, setPen/2, setFont/3, setBrush/2, strokeLine/5, strokeLines/2, drawRoundedRectangle/6, drawText/4, getTextExtent/2]). @@ -114,9 +114,10 @@ init([Notebook, Parent]) -> _ -> ok end, - UseGC = haveGC(DrawingArea), + UseGC = haveGC(), + Version28 = ?wxMAJOR_VERSION =:= 2 andalso ?wxMINOR_VERSION =:= 8, Font = case os:type() of - {unix,_} when UseGC -> + {unix,_} when UseGC, Version28 -> wxFont:new(12,?wxFONTFAMILY_DECORATIVE,?wxFONTSTYLE_NORMAL,?wxFONTWEIGHT_NORMAL); _ -> wxSystemSettings:getFont(?wxSYS_DEFAULT_GUI_FONT) diff --git a/lib/observer/src/observer_perf_wx.erl b/lib/observer/src/observer_perf_wx.erl index abf90ac612..54c98f3ba3 100644 --- a/lib/observer/src/observer_perf_wx.erl +++ b/lib/observer/src/observer_perf_wx.erl @@ -24,7 +24,7 @@ handle_event/2, handle_sync_event/3, handle_cast/2]). %% Drawing wrappers for DC and GC areas --export([haveGC/1, +-export([haveGC/0, setPen/2, setFont/3, setBrush/2, strokeLine/5, strokeLines/2, drawRoundedRectangle/6, drawText/4, getTextExtent/2]). @@ -90,11 +90,12 @@ init([Notebook, Parent]) -> _ -> ok end, - UseGC = haveGC(Panel), + UseGC = haveGC(), + Version28 = ?wxMAJOR_VERSION =:= 2 andalso ?wxMINOR_VERSION =:= 8, {Font, SmallFont} = case os:type() of - {unix, _} when UseGC -> - %% Def font is really small when using Graphics contexts for some reason + {unix, _} when UseGC, Version28 -> + %% Def font is really small when using Graphics contexts in 2.8 %% Hardcode it F = wxFont:new(12,?wxFONTFAMILY_DECORATIVE,?wxFONTSTYLE_NORMAL,?wxFONTWEIGHT_BOLD), SF = wxFont:new(10, ?wxFONTFAMILY_DECORATIVE, ?wxFONTSTYLE_NORMAL, ?wxFONTWEIGHT_NORMAL), @@ -524,10 +525,9 @@ colors() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% wxDC and ?wxGC wrappers -haveGC(Win) -> +haveGC() -> try - GC = ?wxGC:create(Win), - ?wxGC:destroy(GC), + wxGraphicsRenderer:getDefaultRenderer(), true catch _:_ -> false end. diff --git a/lib/observer/src/observer_pro_wx.erl b/lib/observer/src/observer_pro_wx.erl index ee67664539..9aaf648ea2 100644 --- a/lib/observer/src/observer_pro_wx.erl +++ b/lib/observer/src/observer_pro_wx.erl @@ -225,7 +225,7 @@ handle_info({holder_updated, Count}, State0=#state{grid=Grid}) -> State = update_selection(State0), wxListCtrl:setItemCount(Grid, Count), - wxListCtrl:refreshItems(Grid, 0, Count-1), + Count > 0 andalso wxListCtrl:refreshItems(Grid, 0, Count-1), {noreply, State}; diff --git a/lib/observer/src/observer_tv_table.erl b/lib/observer/src/observer_tv_table.erl index c41f0f006a..5d1ab2e946 100644 --- a/lib/observer/src/observer_tv_table.erl +++ b/lib/observer/src/observer_tv_table.erl @@ -403,7 +403,7 @@ handle_info({new_cols, New}, State = #state{grid=Grid, columns=Cols0}) -> {noreply, State#state{columns=Cols}}; handle_info({refresh, Min, Max}, State = #state{grid=Grid}) -> - wxListCtrl:refreshItems(Grid, Min, Max), + Max > 0 andalso wxListCtrl:refreshItems(Grid, Min, Max), {noreply, State}; handle_info(refresh_interval, State = #state{pid=Pid}) -> diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl index e433bea8c2..47740581f0 100644 --- a/lib/observer/src/observer_wx.erl +++ b/lib/observer/src/observer_wx.erl @@ -465,41 +465,36 @@ create_connect_dialog(ping, #state{frame = Frame, prev_node=Prev}) -> cancel end; create_connect_dialog(connect, #state{frame = Frame}) -> - Dialog = wxDialog:new(Frame, ?wxID_ANY, "Distribute node "), + Dialog = wxDialog:new(Frame, ?wxID_ANY, "Distribute node", + [{style, ?wxDEFAULT_FRAME_STYLE bor ?wxRESIZE_BORDER}]), VSizer = wxBoxSizer:new(?wxVERTICAL), - RadioBoxSizer = wxBoxSizer:new(?wxHORIZONTAL), Choices = ["Short name", "Long name"], - RadioBox = wxRadioBox:new(Dialog, 1, "", - ?wxDefaultPosition, - ?wxDefaultSize, - Choices, - [{majorDim, 2}, - {style, ?wxHORIZONTAL}]), + RadioBox = wxRadioBox:new(Dialog, 1, "", ?wxDefaultPosition, ?wxDefaultSize, + Choices, [{majorDim, 2}, {style, ?wxHORIZONTAL}]), NameText = wxStaticText:new(Dialog, ?wxID_ANY, "Node name: "), - NameCtrl = wxTextCtrl:new(Dialog, ?wxID_ANY, [{size, {200, 25}}]), + NameCtrl = wxTextCtrl:new(Dialog, ?wxID_ANY, [{size, {300,-1}}]), wxTextCtrl:setValue(NameCtrl, "observer"), CookieText = wxStaticText:new(Dialog, ?wxID_ANY, "Secret cookie: "), - CookieCtrl = wxTextCtrl:new(Dialog, ?wxID_ANY, - [{size, {200, 25}}, {style, ?wxTE_PASSWORD}]), + CookieCtrl = wxTextCtrl:new(Dialog, ?wxID_ANY,[{style, ?wxTE_PASSWORD}]), - BtnSizer = wxDialog:createStdDialogButtonSizer(Dialog, ?wxID_DEFAULT), - Flags = [{flag, ?wxEXPAND bor ?wxALL}, {border, 5}], - wxSizer:add(RadioBoxSizer, RadioBox, Flags), - - wxSizer:add(VSizer, RadioBoxSizer, Flags), + BtnSizer = wxDialog:createButtonSizer(Dialog, ?wxOK bor ?wxCANCEL), + Dir = ?wxLEFT bor ?wxRIGHT bor ?wxDOWN, + Flags = [{flag, ?wxEXPAND bor Dir bor ?wxALIGN_CENTER_VERTICAL}, {border, 5}], + wxSizer:add(VSizer, RadioBox, Flags), wxSizer:addSpacer(VSizer, 10), - wxSizer:add(VSizer, NameText), + wxSizer:add(VSizer, NameText, [{flag, ?wxLEFT}, {border, 5}]), wxSizer:add(VSizer, NameCtrl, Flags), wxSizer:addSpacer(VSizer, 10), - wxSizer:add(VSizer, CookieText), + wxSizer:add(VSizer, CookieText, [{flag, ?wxLEFT}, {border, 5}]), wxSizer:add(VSizer, CookieCtrl, Flags), wxSizer:addSpacer(VSizer, 10), - wxSizer:add(VSizer, BtnSizer, [{flag, ?wxALIGN_LEFT}]), + wxSizer:add(VSizer, BtnSizer, [{proportion, 1}, {flag, ?wxEXPAND bor ?wxALL},{border, 5}]), - wxWindow:setSizer(Dialog, VSizer), + wxWindow:setSizerAndFit(Dialog, VSizer), + wxSizer:setSizeHints(VSizer, Dialog), CookiePath = filename:join(os:getenv("HOME"), ".erlang.cookie"), DefaultCookie = case filelib:is_file(CookiePath) of true -> @@ -548,28 +543,36 @@ clean_menus(Menus, MenuBar) -> remove_menu_items(Menus, MenuBar). remove_menu_items([{MenuStr = "File", Menus}|Rest], MenuBar) -> - MenuId = wxMenuBar:findMenu(MenuBar, MenuStr), - Menu = wxMenuBar:getMenu(MenuBar, MenuId), - Items = [wxMenu:findItem(Menu, Tag) || #create_menu{text=Tag} <- Menus], - [wxMenu:delete(Menu, MItem) || MItem <- Items], - case os:type() =:= {unix, darwin} of - true -> - wxMenuBar:remove(MenuBar, MenuId), - wxMenu:destroy(Menu); - false -> - ignore - end, - remove_menu_items(Rest, MenuBar); + case wxMenuBar:findMenu(MenuBar, MenuStr) of + ?wxNOT_FOUND -> + remove_menu_items(Rest, MenuBar); + MenuId -> + Menu = wxMenuBar:getMenu(MenuBar, MenuId), + Items = [wxMenu:findItem(Menu, Tag) || #create_menu{text=Tag} <- Menus], + [wxMenu:delete(Menu, MItem) || MItem <- Items], + case os:type() =:= {unix, darwin} of + true -> + wxMenuBar:remove(MenuBar, MenuId), + wxMenu:destroy(Menu); + false -> + ignore + end, + remove_menu_items(Rest, MenuBar) + end; remove_menu_items([{"Nodes", _}|_], _MB) -> ok; remove_menu_items([{Tag, _Menus}|Rest], MenuBar) -> - MenuId = wxMenuBar:findMenu(MenuBar, Tag), - Menu = wxMenuBar:getMenu(MenuBar, MenuId), - wxMenuBar:remove(MenuBar, MenuId), - Items = wxMenu:getMenuItems(Menu), - [wxMenu:'Destroy'(Menu, Item) || Item <- Items], - wxMenu:destroy(Menu), - remove_menu_items(Rest, MenuBar); + case wxMenuBar:findMenu(MenuBar, Tag) of + ?wxNOT_FOUND -> + remove_menu_items(Rest, MenuBar); + MenuId -> + Menu = wxMenuBar:getMenu(MenuBar, MenuId), + wxMenuBar:remove(MenuBar, MenuId), + Items = wxMenu:getMenuItems(Menu), + [wxMenu:'Destroy'(Menu, Item) || Item <- Items], + wxMenu:destroy(Menu), + remove_menu_items(Rest, MenuBar) + end; remove_menu_items([], _MB) -> ok. @@ -597,15 +600,22 @@ epmd_nodes(Names) -> update_node_list(State = #state{menubar=MenuBar}) -> {Nodes, NodesMenuItems} = get_nodes(), - NodeMenuId = wxMenuBar:findMenu(MenuBar, "Nodes"), - NodeMenu = wxMenuBar:getMenu(MenuBar, NodeMenuId), - wx:foreach(fun(Item) -> wxMenu:'Destroy'(NodeMenu, Item) end, - wxMenu:getMenuItems(NodeMenu)), - + NodeMenu = case wxMenuBar:findMenu(MenuBar, "Nodes") of + ?wxNOT_FOUND -> + Menu = wxMenu:new(), + wxMenuBar:append(MenuBar, Menu, "Nodes"), + Menu; + NodeMenuId -> + Menu = wxMenuBar:getMenu(MenuBar, NodeMenuId), + wx:foreach(fun(Item) -> wxMenu:'Destroy'(Menu, Item) end, + wxMenu:getMenuItems(Menu)), + Menu + end, + Index = wx:foldl(fun(Record, Index) -> observer_lib:create_menu_item(Record, NodeMenu, Index) end, 0, NodesMenuItems), - + Dist = case erlang:is_alive() of true -> #create_menu{id = ?ID_PING, text = "Connect node"}; false -> #create_menu{id = ?ID_CONNECT, text = "Enable distribution"} diff --git a/lib/odbc/aclocal.m4 b/lib/odbc/aclocal.m4 index 9578cd35c4..918e30a886 100644 --- a/lib/odbc/aclocal.m4 +++ b/lib/odbc/aclocal.m4 @@ -1849,6 +1849,31 @@ case $erl_gethrvtime in esac ])dnl +dnl ---------------------------------------------------------------------- +dnl +dnl LM_TRY_ENABLE_CFLAG +dnl +dnl +dnl Tries a CFLAG and sees if it can be enabled without compiler errors +dnl $1: textual cflag to add +dnl $2: variable to store the modified CFLAG in +dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) +dnl +dnl +AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) + saved_CFLAGS=$CFLAGS; + CFLAGS="$1 $$2"; + AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue"; then + AC_MSG_RESULT([yes]) + AS_VAR_SET($2, "$1 $$2") + else + AC_MSG_RESULT([no]) + fi +]) + dnl ERL_TRY_LINK_JAVA(CLASSES, FUNCTION-BODY dnl [ACTION_IF_FOUND [, ACTION-IF-NOT-FOUND]]) dnl Freely inspired by AC_TRY_LINK. (Maybe better to create a diff --git a/lib/odbc/c_src/Makefile.in b/lib/odbc/c_src/Makefile.in index 026da39e6f..6572d28ee8 100644 --- a/lib/odbc/c_src/Makefile.in +++ b/lib/odbc/c_src/Makefile.in @@ -108,17 +108,17 @@ docs: ifdef UNIX_TARGET $(UNIX_TARGET): $(OBJ_DIR)/odbcserver.o - $(CC) $(CFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(LDFLAGS) $(LIBS) + $(V_CC) $(CFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(LDFLAGS) $(LIBS) endif ifdef WIN32_TARGET $(WIN32_TARGET): $(OBJ_DIR)/odbcserver.o - $(LD) $(LDFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(ENTRY_OBJ) \ + $(V_LD) $(LDFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(ENTRY_OBJ) \ $(LIBS) $(ENTRY_LDFLAGS) endif $(OBJ_DIR)/odbcserver.o: odbcserver.c - $(CC) $(CFLAGS) $(INCLUDES) $(TARGET_FLAGS) -o $@ -c odbcserver.c + $(V_CC) $(CFLAGS) $(INCLUDES) $(TARGET_FLAGS) -o $@ -c odbcserver.c # ---------------------------------------------------- # Release Target diff --git a/lib/odbc/c_src/odbcserver.c b/lib/odbc/c_src/odbcserver.c index 4a7a5224e5..b4ee20c3ee 100644 --- a/lib/odbc/c_src/odbcserver.c +++ b/lib/odbc/c_src/odbcserver.c @@ -431,6 +431,20 @@ static db_result_msg handle_db_request(byte *reqstring, db_state *state) <connStrIn>, returns a message indicating the outcome. */ static db_result_msg db_connect(byte *args, db_state *state) { + /* + * Danil Onishchenko aka RubberCthulhu, [email protected]. 2013.01.09. + * It's a fix for Oracle ODBC driver for Linux. + * The issue: Oracle ODBC driver for Linux ignores setup autocommit mode + * during driver initialization before a connection to database has been + * established. + * Solution: set autocommit mode after a connection to database has been + * established. + * + * BEGIN + */ + SQLLEN auto_commit_mode; + /* END */ + SQLCHAR connStrOut[MAX_CONN_STR_OUT + 1] = {0}; SQLRETURN result; SQLSMALLINT stringlength2ptr = 0, connlen; @@ -498,6 +512,42 @@ static db_result_msg db_connect(byte *args, db_state *state) return msg; } + /* + * Danil Onishchenko aka RubberCthulhu, [email protected]. 2013.01.09. + * It's a fix for Oracle ODBC driver for Linux. + * The issue: Oracle ODBC driver for Linux ignores setup autocommit mode + * during driver initialization before a connection to database has been + * established. + * Solution: set autocommit mode after a connection to database has been + * established. + * + * BEGIN + */ + if(erl_auto_commit_mode == ON) { + auto_commit_mode = SQL_AUTOCOMMIT_ON; + } else { + auto_commit_mode = SQL_AUTOCOMMIT_OFF; + } + + if(!sql_success(SQLSetConnectAttr(connection_handle(state), + SQL_ATTR_AUTOCOMMIT, + (SQLPOINTER)auto_commit_mode, 0))) { + diagnos = get_diagnos(SQL_HANDLE_DBC, connection_handle(state), extended_errors(state)); + strcat((char *)diagnos.error_msg, " Set autocommit mode failed."); + + msg = encode_error_message(diagnos.error_msg, extended_error(state, diagnos.sqlState), diagnos.nativeError); + + if(!sql_success(SQLFreeHandle(SQL_HANDLE_DBC, + connection_handle(state)))) + DO_EXIT(EXIT_FREE); + if(!sql_success(SQLFreeHandle(SQL_HANDLE_ENV, + environment_handle(state)))) + DO_EXIT(EXIT_FREE); + + return msg; + } + /* END */ + msg = retrive_scrollable_cursor_support_info(state); return msg; diff --git a/lib/odbc/configure.in b/lib/odbc/configure.in index bec65c71bf..e6ba9f57f5 100644 --- a/lib/odbc/configure.in +++ b/lib/odbc/configure.in @@ -212,4 +212,9 @@ AC_SUBST(ODBC_INCLUDE) fi dnl "$with_odbc" != "no" +if test "x$GCC" = xyes; then + # Treat certain GCC warnings as errors + LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) +fi + AC_OUTPUT(c_src/$host/Makefile:c_src/Makefile.in) diff --git a/lib/odbc/src/Makefile b/lib/odbc/src/Makefile index 2af65cc757..bfbda8aaf4 100644 --- a/lib/odbc/src/Makefile +++ b/lib/odbc/src/Makefile @@ -95,9 +95,9 @@ clean: $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/orber/COSS/CosNaming/Makefile b/lib/orber/COSS/CosNaming/Makefile index 769c08a9e9..814062034c 100644 --- a/lib/orber/COSS/CosNaming/Makefile +++ b/lib/orber/COSS/CosNaming/Makefile @@ -117,7 +117,7 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) docs: @@ -125,10 +125,10 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: cos_naming_ext.idl cos_naming.idl - erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' \ + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' \ +'{this,"CosNaming::NamingContextExt"}' cos_naming_ext.idl - erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' cos_naming.idl - >IDL-GENERATED + $(V_at)erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' cos_naming.idl + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/orber/c_src/Makefile.in b/lib/orber/c_src/Makefile.in index 9970642a9f..126ed8af21 100644 --- a/lib/orber/c_src/Makefile.in +++ b/lib/orber/c_src/Makefile.in @@ -56,10 +56,10 @@ debug opt: $(OBJDIR) orber ifeq ($(findstring win32,$(TARGET)),win32) orber: - echo "Nothing to build on NT" + $(V_colon)echo "Nothing to build on NT" else orber: - echo "Nothing to build" + $(V_colon)echo "Nothing to build" endif clean: @@ -74,7 +74,7 @@ $(OBJDIR): -mkdir -p $(OBJDIR) $(OBJDIR)/%.o: %.c - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< # ---------------------------------------------------- # Release Target diff --git a/lib/orber/examples/Stack/Makefile b/lib/orber/examples/Stack/Makefile index f1a5106a7b..1cbb983cd6 100644 --- a/lib/orber/examples/Stack/Makefile +++ b/lib/orber/examples/Stack/Makefile @@ -104,8 +104,8 @@ docs: test: $(TEST_TARGET_FILES) IDL-GENERATED: stack.idl - erlc $(ERL_IDL_FLAGS) stack.idl - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) stack.idl + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/orber/src/Makefile b/lib/orber/src/Makefile index 6eb659407d..1c6781e5fd 100644 --- a/lib/orber/src/Makefile +++ b/lib/orber/src/Makefile @@ -215,10 +215,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ docs: @@ -227,17 +227,17 @@ docs: # ---------------------------------------------------- IDL-GENERATED: $(ERL_TOP)/lib/ic/include/erlang.idl CORBA.idl OrberIFR.idl - erlc $(ERL_IDL_FLAGS) $(ERL_TOP)/lib/ic/include/erlang.idl - erlc $(ERL_IDL_FLAGS) CORBA.idl - erlc $(ERL_IDL_FLAGS) +'{this,"Orber::IFR"}' OrberIFR.idl - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) $(ERL_TOP)/lib/ic/include/erlang.idl + $(V_at)erlc $(ERL_IDL_FLAGS) CORBA.idl + $(V_at)erlc $(ERL_IDL_FLAGS) +'{this,"Orber::IFR"}' OrberIFR.idl + $(V_at)>IDL-GENERATED $(GEN_ERL_FILES): IDL-GENERATED $(TARGET_FILES): IDL-GENERATED $(GEN_ASN_ERL) $(GEN_ASN_HRL): OrberCSIv2.asn1 OrberCSIv2.set.asn - erlc $(ERL_COMPILE_FLAGS) $(ASN_FLAGS) +'{inline,"OrberCSIv2"}' OrberCSIv2.set.asn - rm -f $(GEN_ASN_ERL:%.erl=%.beam) + $(asn_verbose)erlc $(ERL_COMPILE_FLAGS) $(ASN_FLAGS) +'{inline,"OrberCSIv2"}' OrberCSIv2.set.asn + $(V_at)rm -f $(GEN_ASN_ERL:%.erl=%.beam) # erlc $(ERL_COMPILE_FLAGS) $(ASN_FLAGS) OrberCSIv2.asn1 ;\ # erlc $(GEN_ASN_ERL) diff --git a/lib/orber/src/orber_ifr_exceptiondef.erl b/lib/orber/src/orber_ifr_exceptiondef.erl index 7665d3d1bc..94c25cc4a5 100644 --- a/lib/orber/src/orber_ifr_exceptiondef.erl +++ b/lib/orber/src/orber_ifr_exceptiondef.erl @@ -111,26 +111,6 @@ cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> describe({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> orber_ifr_contained:describe({ObjType,ObjID}). -%%% *** This function should be removed. Use -%%% orber_ifr_repository:lookup_id/2 instead. - -%%lookup_id(SearchId) -> -%% _F = fun() -> -%% Q = query [X.ir_Internal_ID || X <- table(ir_ExceptionDef)] -%% end, -%% mnemosyne:eval(Q) -%% end, -%% case orber_ifr_utils:ifr_transaction_read(_F) of -%% ?read_check_2() -> -%% {ok, []}; -%% ?read_check_1(Rep_IDs) -> -%% ExceptionDefs = lists:map(fun(X) -> {ir_ExceptionDef, X} end, -%% Rep_IDs), -%% {ok, lists:filter(fun(X) -> orber_ifr_exceptiondef:'_get_id'(X) == -%% SearchId end, -%% ExceptionDefs)} -%% end. - move({ObjType, ObjID}, New_container, New_name, New_version) ?tcheck(ir_ExceptionDef, ObjType) -> orber_ifr_contained:move({ObjType,ObjID},New_container,New_name, diff --git a/lib/os_mon/c_src/Makefile.in b/lib/os_mon/c_src/Makefile.in index e728e43a09..51569f6ec9 100644 --- a/lib/os_mon/c_src/Makefile.in +++ b/lib/os_mon/c_src/Makefile.in @@ -93,28 +93,28 @@ docs: # ---------------------------------------------------- $(BINDIR)/win32sysinfo.exe: $(OBJDIR)/win32sysinfo.o $(ENTRY_OBJ) - $(LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/win32sysinfo.o $(ENTRY_OBJ) + $(V_LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/win32sysinfo.o $(ENTRY_OBJ) $(BINDIR)/nteventlog.exe: $(EVLOG_OBJECTS) - $(LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(EVLOG_OBJECTS) $(ENTRY_OBJ) + $(V_LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(EVLOG_OBJECTS) $(ENTRY_OBJ) $(BINDIR)/ferrule: $(OBJDIR)/ferrule.o - $(LD) $(LDFLAGS) -o $@ $< + $(V_LD) $(LDFLAGS) -o $@ $< $(BINDIR)/mod_syslog: $(OBJDIR)/mod_syslog.o - $(LD) $(LDFLAGS) -o $@ $< + $(V_LD) $(LDFLAGS) -o $@ $< $(BINDIR)/memsup: $(OBJDIR)/memsup.o - $(LD) $(LDFLAGS) -o $@ $< + $(V_LD) $(LDFLAGS) -o $@ $< $(BINDIR)/cpu_sup: $(OBJDIR)/cpu_sup.o - $(LD) $(LDFLAGS) -o $@ $< $(CPU_SUP_LIBS) + $(V_LD) $(LDFLAGS) -o $@ $< $(CPU_SUP_LIBS) $(OBJDIR)/%.o: %.c - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(OBJDIR)/%.o: nteventlog/%.c - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(OBJDIR)/memsup.o: memsup.h diff --git a/lib/os_mon/mibs/Makefile b/lib/os_mon/mibs/Makefile index 3e24c3d373..19f3dc8367 100644 --- a/lib/os_mon/mibs/Makefile +++ b/lib/os_mon/mibs/Makefile @@ -67,16 +67,16 @@ OTP_MIBDIR = $(shell if test -d ../../otp_mibs; then echo otp_mibs; \ else echo sasl; fi) $(SNMP_BIN_TARGET_DIR)/OTP-REG.bin: $(ERL_TOP)/lib/$(OTP_MIBDIR)/mibs/OTP-REG.mib - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< $(SNMP_BIN_TARGET_DIR)/OTP-TC.bin: $(ERL_TOP)/lib/$(OTP_MIBDIR)/mibs/OTP-TC.mib - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< $(SNMP_BIN_TARGET_DIR)/OTP-MIB.bin: $(ERL_TOP)/lib/$(OTP_MIBDIR)/mibs/OTP-MIB.mib - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< v1/%.mib.v1: %.mib - $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< + $(gen_verbose)$(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< $(SNMP_BIN_TARGET_DIR)/OTP-OS-MON-MIB.bin: \ $(SNMP_BIN_TARGET_DIR)/OTP-REG.bin \ diff --git a/lib/os_mon/src/Makefile b/lib/os_mon/src/Makefile index 864d7a09d4..06b9b9b8ae 100644 --- a/lib/os_mon/src/Makefile +++ b/lib/os_mon/src/Makefile @@ -59,7 +59,7 @@ TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += +warn_obsolete_guard -I$(INCLUDE) +ERL_COMPILE_FLAGS += +warn_obsolete_guard -I$(INCLUDE) -Werror # ---------------------------------------------------- # Targets @@ -78,10 +78,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ #------------------------------------------------------- # Special dependencies diff --git a/lib/otp_mibs/mibs/Makefile b/lib/otp_mibs/mibs/Makefile index 703c4b3ed4..7f43ef31a6 100644 --- a/lib/otp_mibs/mibs/Makefile +++ b/lib/otp_mibs/mibs/Makefile @@ -68,7 +68,7 @@ docs: # ---------------------------------------------------- v1/%.mib.v1: %.mib - $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< + $(gen_verbose)$(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< # ---------------------------------------------------- # Release Target diff --git a/lib/otp_mibs/src/Makefile b/lib/otp_mibs/src/Makefile index 03298d39d5..4f03d0228a 100644 --- a/lib/otp_mibs/src/Makefile +++ b/lib/otp_mibs/src/Makefile @@ -84,10 +84,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/parsetools/src/Makefile b/lib/parsetools/src/Makefile index 4f199da8ee..92bff00998 100644 --- a/lib/parsetools/src/Makefile +++ b/lib/parsetools/src/Makefile @@ -58,7 +58,8 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += +warn_obsolete_guard -I$(ERL_TOP)/lib/stdlib/include +ERL_COMPILE_FLAGS += +warn_obsolete_guard -I$(ERL_TOP)/lib/stdlib/include \ + -Werror # ---------------------------------------------------- # Targets @@ -78,10 +79,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/parsetools/test/leex_SUITE.erl b/lib/parsetools/test/leex_SUITE.erl index 4a0f70ba71..9d591c0d05 100644 --- a/lib/parsetools/test/leex_SUITE.erl +++ b/lib/parsetools/test/leex_SUITE.erl @@ -649,7 +649,6 @@ reserved_word('fun') -> true; reserved_word('if') -> true; reserved_word('let') -> true; reserved_word('of') -> true; -reserved_word('query') -> true; reserved_word('receive') -> true; reserved_word('when') -> true; reserved_word('bnot') -> true; diff --git a/lib/percept/src/Makefile b/lib/percept/src/Makefile index 253a8c2da3..6bf0af9dc6 100644 --- a/lib/percept/src/Makefile +++ b/lib/percept/src/Makefile @@ -80,10 +80,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/pman/src/Makefile b/lib/pman/src/Makefile index fa01fe7238..eb0413bdbc 100644 --- a/lib/pman/src/Makefile +++ b/lib/pman/src/Makefile @@ -85,10 +85,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/public_key/asn1/Makefile b/lib/public_key/asn1/Makefile index 763b788e53..f765906b3b 100644 --- a/lib/public_key/asn1/Makefile +++ b/lib/public_key/asn1/Makefile @@ -81,10 +81,10 @@ clean: docs: %.erl %.hrl: %.set.asn - erlc $(ASN_FLAGS) $< + $(asn_verbose)erlc $(ASN_FLAGS) $< $(INCLUDE)/%.hrl: %.hrl - cp -p $< $@ + $(gen_verbose)cp -p $< $@ # ---------------------------------------------------- # Release Target @@ -119,6 +119,6 @@ OTP-PUB-KEY.asn1db: PKIX1Algorithms88.asn1 \ OTP-PKIX.asn1 $(EBIN)/PKCS-FRAME.beam: PKCS-FRAME.erl PKCS-FRAME.hrl -PKCS-FRAME.erl PKCS-FRAME.hrl: PKCS-FRAME.asn1db +PKCS-FRAME.erl PKCS-FRAME.hrl: PKCS-FRAME.asn1db PKCS-FRAME.asn1db: PKCS5v2-0.asn1\ PKCS-8.asn1\ diff --git a/lib/public_key/asn1/PKCS-10.asn1 b/lib/public_key/asn1/PKCS-10.asn1 index 333104d230..5ada81c257 100644 --- a/lib/public_key/asn1/PKCS-10.asn1 +++ b/lib/public_key/asn1/PKCS-10.asn1 @@ -20,12 +20,36 @@ IMPORTS ATTRIBUTE FROM InformationFramework informationFramework - Name + Name, Extensions, DirectoryString FROM PKIX1Explicit88 --InformationFramework informationFramework ALGORITHM FROM PKCS-7; --AuthenticationFramework authenticationFramework; +-- start inlined from PKCS-9 + +--pkcs-9-ub-pkcs9String INTEGER ::= 255 +--pkcs-9-ub-challengePassword INTEGER ::= pkcs-9-ub-pkcs9String +pkcs-9-at-challengePassword OBJECT IDENTIFIER ::= {pkcs-9 7} + +challengePassword ATTRIBUTE ::= { + WITH SYNTAX DirectoryString --{pkcs-9-ub-challengePassword} + SINGLE VALUE TRUE + ID pkcs-9-at-challengePassword +} + +pkcs-9-at-extensionRequest OBJECT IDENTIFIER ::= {pkcs-9 14} + +extensionRequest ATTRIBUTE ::= { + WITH SYNTAX ExtensionRequest + SINGLE VALUE TRUE + ID pkcs-9-at-extensionRequest +} + +ExtensionRequest ::= Extensions + +-- end inlined from PKCS-9 + -- Certificate requests CertificationRequestInfo ::= SEQUENCE { diff --git a/lib/public_key/doc/src/cert_records.xml b/lib/public_key/doc/src/cert_records.xml index f01f7dbaf5..ac4b4e4489 100644 --- a/lib/public_key/doc/src/cert_records.xml +++ b/lib/public_key/doc/src/cert_records.xml @@ -649,7 +649,7 @@ oid names see table below. Ex: ?'id-dsa-with-sha1'</p> version atom(), subject {rdnSequence, [#AttributeTypeAndValue'{}]} , subjectPKInfo #'CertificationRequestInfo_subjectPKInfo'{}, - attributes [#AttributeTypeAndValue'{}] + attributes [#'AttributePKCS-10' {}] } #'CertificationRequestInfo_subjectPKInfo'{ @@ -665,7 +665,12 @@ oid names see table below. Ex: ?'id-dsa-with-sha1'</p> #'CertificationRequest_signatureAlgorithm'{ algorithm = oid(), parameters = der_encoded() - } + } + +#'AttributePKCS-10'{ + type = oid(), + values = [der_encoded()] +} </code> </section> diff --git a/lib/public_key/doc/src/public_key.xml b/lib/public_key/doc/src/public_key.xml index 66c9217579..5864de2d57 100644 --- a/lib/public_key/doc/src/public_key.xml +++ b/lib/public_key/doc/src/public_key.xml @@ -34,8 +34,8 @@ <modulesummary> API module for public key infrastructure.</modulesummary> <description> <p>This module provides functions to handle public key infrastructure. It can - encode/decode different file formats (PEM, openssh), sign and verify digital signatures and vlidate - certificate paths and certificate revokation lists. + encode/decode different file formats (PEM, openssh), sign and verify digital signatures and validate + certificate paths and certificate revocation lists. </p> </description> diff --git a/lib/public_key/src/Makefile b/lib/public_key/src/Makefile index d24122221a..b8ad68ecc7 100644 --- a/lib/public_key/src/Makefile +++ b/lib/public_key/src/Makefile @@ -92,10 +92,10 @@ clean: docs: $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl index 5686920dd4..9b7d98728f 100644 --- a/lib/public_key/src/public_key.erl +++ b/lib/public_key/src/public_key.erl @@ -509,7 +509,7 @@ pkix_normalize_name(Issuer) -> %%-------------------------------------------------------------------- -spec pkix_path_validation(Cert::binary()| #'OTPCertificate'{} | atom(), CertChain :: [binary()] , - Options :: proplist:proplist()) -> + Options :: proplists:proplist()) -> {ok, {PublicKeyInfo :: term(), PolicyTree :: term()}} | {error, {bad_cert, Reason :: term()}}. @@ -547,7 +547,7 @@ pkix_path_validation(#'OTPCertificate'{} = TrustedCert, CertChain, Options) %-------------------------------------------------------------------- -spec pkix_crls_validate(#'OTPCertificate'{}, [{DP::#'DistributionPoint'{} ,CRL::#'CertificateList'{}}], - Options :: proplist:proplist()) -> valid | {bad_cert, revocation_status_undetermined} + Options :: proplists:proplist()) -> valid | {bad_cert, revocation_status_undetermined} | {bad_cert, {revoked, crl_reason()}}. %% Description: Performs a basic path validation according to RFC 5280. diff --git a/lib/public_key/vsn.mk b/lib/public_key/vsn.mk index b8af89d040..bd20a5546b 100644 --- a/lib/public_key/vsn.mk +++ b/lib/public_key/vsn.mk @@ -1 +1 @@ -PUBLIC_KEY_VSN = 0.17 +PUBLIC_KEY_VSN = 0.18 diff --git a/lib/reltool/src/Makefile b/lib/reltool/src/Makefile index a7e34053f1..3c67bca1d6 100644 --- a/lib/reltool/src/Makefile +++ b/lib/reltool/src/Makefile @@ -57,7 +57,8 @@ APPUP_TARGET = $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- ERL_COMPILE_FLAGS += +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,$(APP_VSN)}' + +'{attribute,insert,app_vsn,$(APP_VSN)}' \ + -Werror # ---------------------------------------------------- # Targets @@ -79,10 +80,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Dependencies diff --git a/lib/reltool/src/reltool_sys_win.erl b/lib/reltool/src/reltool_sys_win.erl index 0c0b295db1..8e182d02ed 100644 --- a/lib/reltool/src/reltool_sys_win.erl +++ b/lib/reltool/src/reltool_sys_win.erl @@ -49,7 +49,6 @@ rel_book, lib_tree, status_bar, - popup_menu, source, whitelist, blacklist, @@ -136,6 +135,7 @@ init(Options) -> do_init(Options) catch error:Reason -> + io:format("~p: ~p~n",[Reason, erlang:get_stacktrace()]), exit({Reason, erlang:get_stacktrace()}) end. @@ -403,8 +403,6 @@ create_menubar(Frame) -> wxEvtHandler:connect(Frame, command_menu_selected, [{userData, main_window}]), - wxEvtHandler:connect(File, menu_close), - wxEvtHandler:connect(Help, menu_close), MenuBar. create_app_page(#state{book = Book} = S) -> @@ -780,15 +778,12 @@ root_popup(S, Root, Tree, Item) -> wxMenu:appendSeparator(PopupMenu), wxMenu:append(PopupMenu, 1, "Edit"), Choices = [edit], - wxEvtHandler:connect(PopupMenu, command_menu_selected), - wxEvtHandler:connect(PopupMenu, menu_close), + Popup = #root_popup{dir = Root, choices = Choices, + tree = Tree, item = Item}, + wxEvtHandler:connect(PopupMenu, command_menu_selected, [{userData, {popup, Popup}}]), wxWindow:popupMenu(S#state.frame, PopupMenu), - Popup = #root_popup{dir = Root, - choices = Choices, - tree = Tree, - item = Item}, - S#state{popup_menu = Popup}. + S. lib_popup(S, Lib, Tree, Item) -> PopupMenu = wxMenu:new(), @@ -804,12 +799,10 @@ lib_popup(S, Lib, Tree, Item) -> wxMenu:append(PopupMenu, 3, "Delete"), [add, edit, delete] end, - wxEvtHandler:connect(PopupMenu, command_menu_selected), - wxEvtHandler:connect(PopupMenu, menu_close), - wxWindow:popupMenu(S#state.frame, PopupMenu), - Popup = #lib_popup{dir = Lib, choices = Choices, tree = Tree, item = Item}, - S#state{popup_menu = Popup}. + wxEvtHandler:connect(PopupMenu, command_menu_selected, [{userData, {popup, Popup}}]), + wxWindow:popupMenu(S#state.frame, PopupMenu), + S. escript_popup(S, File, Tree, Item) -> PopupMenu = wxMenu:new(), @@ -825,15 +818,11 @@ escript_popup(S, File, Tree, Item) -> wxMenu:append(PopupMenu, 3, "Delete"), [add, edit, delete] end, - wxEvtHandler:connect(PopupMenu, command_menu_selected), - wxEvtHandler:connect(PopupMenu, menu_close), + Popup = #escript_popup{file = File, choices = Choices, + tree = Tree, item = Item}, + wxEvtHandler:connect(PopupMenu, command_menu_selected, [{userData, {popup, Popup}}]), wxWindow:popupMenu(S#state.frame, PopupMenu), - - Popup = #escript_popup{file = File, - choices = Choices, - tree = Tree, - item = Item}, - S#state{popup_menu = Popup}. + S. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -903,11 +892,13 @@ handle_event(S, #wx{id = Id, obj= ObjRef, userData = UserData, event = Event} = wxMessageDialog:showModal(MD), wxMessageDialog:destroy(MD), S; - #wxMenu{type = menu_close} -> - S#state{popup_menu = undefined}; - #wxCommand{type = command_menu_selected = Type, cmdString = Str} - when S#state.popup_menu =/= undefined -> - handle_popup_event(S, Type, Id, ObjRef, UserData, Str); + #wxCommand{type = command_menu_selected = Type, cmdString = Str} -> + case UserData of + {popup, Popup} -> + handle_popup_event(S, Type, Id, ObjRef, Popup, Str); + true -> + S + end; #wxMouse{type = enter_window} -> %% The following is commented out because it raises the %% main system window on top of popup windows. @@ -1028,11 +1019,9 @@ warning_popup_position(#state{frame=MF,warning_list=WL},{WFW,WFH}) -> {X,Y}. handle_popup_event(S, _Type, 0, _ObjRef, _UserData, _Str) -> - S#state{popup_menu = undefined}; -handle_popup_event(#state{popup_menu = #root_popup{dir = OldDir, - choices = Choices}, - sys = Sys} = S, - _Type, Pos, _ObjRef, _UserData, _Str) -> + S; +handle_popup_event(#state{sys = Sys} = S, _Type, Pos, _ObjRef, + #root_popup{dir = OldDir, choices = Choices}, _Str) -> case lists:nth(Pos, Choices) of edit -> Style = ?wxFD_OPEN bor ?wxFD_FILE_MUST_EXIST, @@ -1042,18 +1031,16 @@ handle_popup_event(#state{popup_menu = #root_popup{dir = OldDir, Style) of {ok, NewDir} when NewDir =:= OldDir -> %% Same dir.Ignore. - S#state{popup_menu = undefined}; + S; {ok, NewDir} -> Sys2 = Sys#sys{root_dir = NewDir}, - do_set_sys(S#state{popup_menu = undefined, sys = Sys2}); + do_set_sys(S#state{sys = Sys2}); cancel -> - S#state{popup_menu = undefined} + S end end; -handle_popup_event(#state{popup_menu = #lib_popup{dir = OldDir, - choices = Choices}, - sys = Sys} = S, - _Type, Pos, _ObjRef, _UserData, _Str) -> +handle_popup_event(#state{sys = Sys} = S, _Type, Pos, _ObjRef, + #lib_popup{dir = OldDir, choices = Choices}, _Str) -> case lists:nth(Pos, Choices) of add -> {ok, Cwd} = file:get_cwd(), @@ -1063,15 +1050,14 @@ handle_popup_event(#state{popup_menu = #lib_popup{dir = OldDir, case lists:member(NewDir, Sys#sys.lib_dirs) of true -> %% Ignore duplicate. Keep old. - S#state{popup_menu = undefined}; + S; false -> LibDirs = Sys#sys.lib_dirs ++ [NewDir], Sys2 = Sys#sys{lib_dirs = LibDirs}, - do_set_sys(S#state{popup_menu = undefined, - sys = Sys2}) + do_set_sys(S#state{sys = Sys2}) end; cancel -> - S#state{popup_menu = undefined} + S end; edit -> Style = ?wxFD_OPEN bor ?wxFD_FILE_MUST_EXIST, @@ -1083,28 +1069,25 @@ handle_popup_event(#state{popup_menu = #lib_popup{dir = OldDir, case lists:member(NewDir, Sys#sys.lib_dirs) of true -> %% Ignore duplicate. Keep old. - S#state{popup_menu = undefined}; + S; false -> Pred = fun(E) -> E =/= OldDir end, {Before, [_| After]} = lists:splitwith(Pred, Sys#sys.lib_dirs), LibDirs2 = Before ++ [NewDir | After], Sys2 = Sys#sys{lib_dirs = LibDirs2}, - do_set_sys(S#state{popup_menu = undefined, - sys = Sys2}) + do_set_sys(S#state{sys = Sys2}) end; cancel -> - S#state{popup_menu = undefined} + S end; delete -> LibDirs = Sys#sys.lib_dirs -- [OldDir], Sys2 = Sys#sys{lib_dirs = LibDirs}, - do_set_sys(S#state{popup_menu = undefined, sys = Sys2}) + do_set_sys(S#state{sys = Sys2}) end; -handle_popup_event(#state{popup_menu = #escript_popup{file = OldFile, - choices = Choices}, - sys = Sys} = S, - _Type, Pos, _ObjRef, _UserData, _Str) -> +handle_popup_event(#state{sys = Sys} = S, _Type, Pos, _ObjRef, + #escript_popup{file = OldFile, choices = Choices}, _Str) -> case lists:nth(Pos, Choices) of add -> OldFile2 = @@ -1124,14 +1107,14 @@ handle_popup_event(#state{popup_menu = #escript_popup{file = OldFile, case lists:member(NewFile, Sys#sys.escripts) of true -> %% Ignore duplicate. Keep old. - S#state{popup_menu = undefined}; + S; false -> Escripts = Sys#sys.escripts ++ [NewFile], Sys2 = Sys#sys{escripts = Escripts}, - do_set_sys(S#state{popup_menu = undefined, sys = Sys2}) + do_set_sys(S#state{sys = Sys2}) end; cancel -> - S#state{popup_menu = undefined} + S end; edit -> Style = ?wxFD_OPEN bor ?wxFD_FILE_MUST_EXIST, @@ -1143,23 +1126,22 @@ handle_popup_event(#state{popup_menu = #escript_popup{file = OldFile, case lists:member(NewFile, Sys#sys.escripts) of true -> %% Ignore duplicate. Keep old. - S#state{popup_menu = undefined}; + S; false -> Pred = fun(E) -> E =/= OldFile end, {Before, [_| After]} = lists:splitwith(Pred, Sys#sys.escripts), Escripts2 = Before ++ [NewFile | After], Sys2 = Sys#sys{escripts = Escripts2}, - do_set_sys(S#state{popup_menu = undefined, - sys = Sys2}) + do_set_sys(S#state{sys = Sys2}) end; cancel -> - S#state{popup_menu = undefined} + S end; delete -> Escripts = Sys#sys.escripts -- [OldFile], Sys2 = Sys#sys{escripts = Escripts}, - do_set_sys(S#state{popup_menu = undefined, sys = Sys2}) + do_set_sys(S#state{sys = Sys2}) end. handle_system_event(#state{sys = Sys} = S, diff --git a/lib/runtime_tools/c_src/Makefile.in b/lib/runtime_tools/c_src/Makefile.in index 586f649924..d315a90e18 100644 --- a/lib/runtime_tools/c_src/Makefile.in +++ b/lib/runtime_tools/c_src/Makefile.in @@ -111,11 +111,11 @@ debug opt valgrind: $(SOLIBS) $(OBJDIR) $(LIBDIR) $(NIF_LIB) ifdef DTRACE_ENABLED DTRACE_USER_HEADER=$(OBJDIR)/dtrace_user.h $(OBJDIR)/dtrace_user.h: ./dtrace_user.d - dtrace -h -C $(INCLUDES) \ + $(dtrace_verbose)dtrace -h -C $(INCLUDES) \ -s ./dtrace_user.d \ -o ./dtrace_user.tmp - sed -e '/^#define[ ]*ERLANG_[A-Z0-9_]*(.*)/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' ./dtrace_user.tmp > $@ - rm ./dtrace_user.tmp + $(V_at)sed -e '/^#define[ ]*ERLANG_[A-Z0-9_]*(.*)/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' ./dtrace_user.tmp > $@ + $(V_at)rm ./dtrace_user.tmp else DTRACE_USER_HEADER= endif @@ -124,7 +124,7 @@ DTRACE_OBJS = ifdef DTRACE_ENABLED_2STEP DTRACE_OBJS += $(OBJDIR)/dtrace_user.o $(OBJDIR)/dtrace_user.o: $(before_DTrace_OBJS) $(OBJDIR)/dtrace_user.h - dtrace -G -C \ + $(dtrace_verbose)dtrace -G -C \ -s ./dtrace_user.d \ -o $@ $(before_DTrace_OBJS) endif @@ -138,26 +138,26 @@ $(LIBDIR): -@mkdir -p $(LIBDIR) $(OBJDIR)/dyntrace$(TYPEMARKER).o: dyntrace.c $(DTRACE_USER_HEADER) - $(INSTALL_DIR) $(OBJDIR) - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_at)$(INSTALL_DIR) $(OBJDIR) + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(NIF_LIB): $(DYNTRACE_OBJS) - $(INSTALL_DIR) $(LIBDIR) - $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) + $(V_at)$(INSTALL_DIR) $(LIBDIR) + $(V_LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(OBJDIR)/%.o: %.c - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(LIBDIR)/trace_ip_drv.so: $(TRACE_IP_DRV_OBJS) - $(LD) $(LDFLAGS) -o $@ $^ -lc $(LIBS) + $(V_LD) $(LDFLAGS) -o $@ $^ -lc $(LIBS) $(LIBDIR)/trace_file_drv.so: $(TRACE_FILE_DRV_OBJS) - $(LD) $(LDFLAGS) -o $@ $^ -lc $(LIBS) + $(V_LD) $(LDFLAGS) -o $@ $^ -lc $(LIBS) $(LIBDIR)/trace_ip_drv.dll: $(TRACE_IP_DRV_OBJS) - $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) + $(V_LD) $(LDFLAGS) -o $@ $^ $(LIBS) $(LIBDIR)/trace_file_drv.dll: $(TRACE_FILE_DRV_OBJS) - $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) + $(V_LD) $(LDFLAGS) -o $@ $^ $(LIBS) clean: rm -f $(SOLIBS) $(TRACE_IP_DRV_OBJS) $(TRACE_FILE_DRV_OBJS) diff --git a/lib/runtime_tools/src/Makefile b/lib/runtime_tools/src/Makefile index d6750f3a88..9809004638 100644 --- a/lib/runtime_tools/src/Makefile +++ b/lib/runtime_tools/src/Makefile @@ -35,6 +35,7 @@ RELSYSDIR = $(RELEASE_PATH)/lib/runtime_tools-$(VSN) # ---------------------------------------------------- MODULES= \ + appmon_info \ erts_alloc_config \ runtime_tools \ runtime_tools_sup \ @@ -67,7 +68,8 @@ EXAMPLE_FILES= \ ERL_COMPILE_FLAGS += \ -I../include \ -I ../../et/include \ - -I ../../../libraries/et/include + -I ../../../libraries/et/include \ + -Werror # ---------------------------------------------------- # Targets @@ -80,10 +82,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/appmon/src/appmon_info.erl b/lib/runtime_tools/src/appmon_info.erl index 332140f69d..332140f69d 100644 --- a/lib/appmon/src/appmon_info.erl +++ b/lib/runtime_tools/src/appmon_info.erl diff --git a/lib/runtime_tools/src/runtime_tools.app.src b/lib/runtime_tools/src/runtime_tools.app.src index 60be9ed7c9..602048dc21 100644 --- a/lib/runtime_tools/src/runtime_tools.app.src +++ b/lib/runtime_tools/src/runtime_tools.app.src @@ -19,7 +19,7 @@ {application, runtime_tools, [{description, "RUNTIME_TOOLS"}, {vsn, "%VSN%"}, - {modules, [dbg,observer_backend,percept_profile, + {modules, [appmon_info, dbg,observer_backend,percept_profile, runtime_tools,runtime_tools_sup,erts_alloc_config, ttb_autostart,dyntrace]}, {registered, [runtime_tools_sup]}, diff --git a/lib/runtime_tools/src/runtime_tools_sup.erl b/lib/runtime_tools/src/runtime_tools_sup.erl index 264e172a3c..e8ea08ec97 100644 --- a/lib/runtime_tools/src/runtime_tools_sup.erl +++ b/lib/runtime_tools/src/runtime_tools_sup.erl @@ -34,7 +34,7 @@ %% The runtime tools top most supervisor starts: %% -The ttb_autostart component. This is used for tracing at startup %% using observer/ttb. -init(AutoModArgs) -> +init(_AutoModArgs) -> Flags = {one_for_one, 0, 3600}, Children = [{ttb_autostart, {ttb_autostart, start_link, []}, temporary, 3000, worker, [ttb_autostart]}], diff --git a/lib/sasl/src/Makefile b/lib/sasl/src/Makefile index de0c45e6ae..4daa6e9861 100644 --- a/lib/sasl/src/Makefile +++ b/lib/sasl/src/Makefile @@ -60,7 +60,7 @@ TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += -I../../stdlib/include +ERL_COMPILE_FLAGS += -I../../stdlib/include -Werror # ---------------------------------------------------- @@ -80,10 +80,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/snmp/doc/src/Makefile b/lib/snmp/doc/src/Makefile index 8820565124..6e55498669 100644 --- a/lib/snmp/doc/src/Makefile +++ b/lib/snmp/doc/src/Makefile @@ -118,7 +118,7 @@ clean clean_docs: clean_html clean_man clean_pdf rm -f errs core *~ $(INDEX_TARGET): $(INDEX_SRC) ../../vsn.mk # Create top make file - sed -e 's;%VSN%;$(VSN);' $< > $@ # inserting version number + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # inserting version number man: man1 man3 man6 man7 diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index b6b8751f6c..5b94dcb051 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1996</year><year>2012</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -34,6 +34,86 @@ <section> + <title>SNMP Development Toolkit 4.23</title> +<!-- + <p>Version 4.23 supports code replacement in runtime from/to + version 4.22.1, + 4.22, 4.21.7 4.21.6 4.21.5, 4.21.4, 4.21.3, 4.21.2, 4.21.1 and 4.21. </p> +--> + + <section> + <title>Improvements and new features</title> +<!-- + <p>-</p> +--> + + <list type="bulleted"> + <item> + <p>[manager] Polish return values of snmpm_user_default according + to snmpm_user doc.</p> + <p>Luca Favatella</p> + <p>Own Id: OTP-10671</p> + </item> + + <item> + <p>[agent] Remove runtime warning in snmpa_agent because of + tuple fun usage. </p> + <p>Luca Favatella</p> + <p>Own Id: OTP-10672</p> + </item> + + <item> + <p>[manager] SNMP manager performance optimization. </p> + <p>Ivan Dubovik</p> + <p>Own Id: OTP-10673</p> + </item> + + </list> + + </section> + + <section> + <title>Fixed Bugs and Malfunctions</title> + <p>-</p> + + <!-- + <list type="bulleted"> + <item> + <p>[agent] Simultaneous + <seealso marker="snmpa#backup">snmpa:backup/1,2</seealso> + calls can interfere. + The master agent did not check if a backup was already in + progress when a backup request was accepted. </p> + <p>Own Id: OTP-9884</p> + <p>Aux Id: Seq 11995</p> + </item> + + </list> + --> + + </section> + + <section> + <title>Incompatibilities</title> +<!-- + <p>-</p> +--> + + <list type="bulleted"> + <item> + <p>[manager] The old Addr-and-Port based API functions, previously + long deprecated and marked for deletion in R16B, has now been + removed. </p> + <p>Own Id: OTP-10027</p> + </item> + + </list> + </section> + + </section> <!-- 4.23 --> + + + <section> <title>SNMP Development Toolkit 4.22.1</title> <p>Version 4.22.1 supports code replacement in runtime from/to version 4.22, 4.21.7 4.21.6 4.21.5, 4.21.4, 4.21.3, 4.21.2, 4.21.1 and @@ -126,70 +206,6 @@ <section> - <title>SNMP Development Toolkit 4.23</title> - <p>Version 4.23 supports code replacement in runtime from/to - version 4.22, - 4.21.7 4.21.6 4.21.5, 4.21.4, 4.21.3, 4.21.2, 4.21.1 and 4.21. </p> - - <section> - <title>Improvements and new features</title> - <p>-</p> - -<!-- - <list type="bulleted"> - <item> - <p>[agent] Documenting previously existing but undocumented function, - <seealso marker="snmp_generic#get_table_info">snmp_generic:get_table_info/2</seealso>. </p> - <p>Own Id: OTP-9942</p> - </item> - - </list> ---> - - </section> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <p>-</p> - - <!-- - <list type="bulleted"> - <item> - <p>[agent] Simultaneous - <seealso marker="snmpa#backup">snmpa:backup/1,2</seealso> - calls can interfere. - The master agent did not check if a backup was already in - progress when a backup request was accepted. </p> - <p>Own Id: OTP-9884</p> - <p>Aux Id: Seq 11995</p> - </item> - - </list> - --> - - </section> - - <section> - <title>Incompatibilities</title> -<!-- - <p>-</p> ---> - - <list type="bulleted"> - <item> - <p>[manager] The old Addr-and-Port based API functions, previously - long deprecated and marked for deletion in R16B, has now been - removed. </p> - <p>Own Id: OTP-10027</p> - </item> - - </list> - </section> - - </section> <!-- 4.23 --> - - - <section> <title>SNMP Development Toolkit 4.22</title> <p>Version 4.22 supports code replacement in runtime from/to version 4.21.7 4.21.6 4.21.5, 4.21.4, 4.21.3, 4.21.2, 4.21.1 and 4.21. </p> diff --git a/lib/snmp/mibs/Makefile.in b/lib/snmp/mibs/Makefile.in index 5c1f855fad..e7ca540cc6 100644 --- a/lib/snmp/mibs/Makefile.in +++ b/lib/snmp/mibs/Makefile.in @@ -141,11 +141,11 @@ OTP_MIBDIR = $(shell if test -d ../../otp_mibs; then echo otp_mibs; \ debug opt: $(TARGET_FILES) $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1: $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1.src - $(PERL) -p -e 's?%PERL%?$(PERL)? ' < $< > $@ - chmod 755 $@ + $(gen_verbose)$(PERL) -p -e 's?%PERL%?$(PERL)? ' < $< > $@ + $(V_at)chmod 755 $@ $(SNMP_BIN_TARGET_DIR)/OTP-REG.bin: $(ERL_TOP)/lib/$(OTP_MIBDIR)/mibs/OTP-REG.mib - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< # To support parallel make, we'll need explicit dependencies # to ensure that an imported MIB has been compiled when it's needed. @@ -214,7 +214,7 @@ info: @echo "RELSYSDIR = "$(RELSYSDIR)"" v1/%.mib.v1: %.mib $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 - $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< + $(gen_verbose)$(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< # ---------------------------------------------------- diff --git a/lib/snmp/src/agent/snmpa_agent.erl b/lib/snmp/src/agent/snmpa_agent.erl index 9d30e332f1..57846db13b 100644 --- a/lib/snmp/src/agent/snmpa_agent.erl +++ b/lib/snmp/src/agent/snmpa_agent.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -1134,7 +1134,7 @@ handle_call({get, Vars, Context}, _From, S) -> "~n Vars: ~p" "~n Context: ~p", [Vars, Context]), put_pdu_data({undefined, undefined, undefined, undefined, Context}), - case catch mapfoldl({?MODULE, tr_var}, [], 1, Vars) of + case catch mapfoldl(fun ?MODULE:tr_var/2, [], 1, Vars) of {error, Reason} -> {reply, {error, Reason}, S}; {_, Varbinds} -> ?vdebug("Varbinds: ~p",[Varbinds]), @@ -1155,7 +1155,7 @@ handle_call({get_next, Vars, Context}, _From, S) -> "~n Vars: ~p" "~n Context: ~p",[Vars, Context]), put_pdu_data({undefined, undefined, undefined, undefined, Context}), - case catch mapfoldl({?MODULE, tr_var}, [], 1, Vars) of + case catch mapfoldl(fun ?MODULE:tr_var/2, [], 1, Vars) of {error, Reason} -> {reply, {error, Reason}, S}; {_, Varbinds} -> ?vdebug("Varbinds: ~p",[Varbinds]), diff --git a/lib/snmp/src/app/Makefile b/lib/snmp/src/app/Makefile index f7c311b663..716add8b9e 100644 --- a/lib/snmp/src/app/Makefile +++ b/lib/snmp/src/app/Makefile @@ -116,10 +116,10 @@ info: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 593ddd82bd..a6abf8439a 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2012. All Rights Reserved. +%% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -22,582 +22,12 @@ %% ----- U p g r a d e ------------------------------------------------------- [ - {"4.22", - [ - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []} - ] - }, - {"4.21.7", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {add_module, snmpm_net_if_mt} - ] - }, - {"4.21.6", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {add_module, snmpm_net_if_mt} - ] - }, - {"4.21.5", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {add_module, snmpm_net_if_mt} - ] - }, - {"4.21.4", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {add_module, snmpm_net_if_mt} - ] - }, - {"4.21.3", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {add_module, snmpm_net_if_mt} - ] - }, - {"4.21.2", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {add_module, snmpm_net_if_mt} - ] - }, - {"4.21.1", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []}, - - {add_module, snmpm_net_if_mt} - ] - }, - {"4.21", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []}, - - {add_module, snmpm_net_if_mt} - ] - } ], %% ------D o w n g r a d e --------------------------------------------------- [ - {"4.22", - [ - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []} - ] - }, - {"4.21.7", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} - ] - }, - {"4.21.6", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} - ] - }, - {"4.21.5", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} - ] - }, - {"4.21.4", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} - ] - }, - {"4.21.3", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} - ] - }, - {"4.21.2", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - - {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} - ] - }, - {"4.21.1", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []}, - - {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} - ] - }, - {"4.21", - [ - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, - - {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, - {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp]}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, - [snmp_conf]}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmp_conf, snmpa_mib_lib]}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []}, - - {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} - ] - } ] + }. diff --git a/lib/snmp/src/compile/depend.mk b/lib/snmp/src/compile/depend.mk index 3ee8dc4bec..e6ba1ac810 100644 --- a/lib/snmp/src/compile/depend.mk +++ b/lib/snmp/src/compile/depend.mk @@ -45,5 +45,5 @@ $(EBIN)/snmpc_mib_gram.$(EMULATOR): \ snmpc_mib_gram.erl $(BIN)/snmpc: snmpc.src ../../vsn.mk - $(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ - chmod 755 $@ + $(vsn_verbose)$(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ + $(V_at)chmod 755 $@ diff --git a/lib/snmp/src/manager/snmpm_server.erl b/lib/snmp/src/manager/snmpm_server.erl index 484954addb..61d22362cc 100644 --- a/lib/snmp/src/manager/snmpm_server.erl +++ b/lib/snmp/src/manager/snmpm_server.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -3163,17 +3163,16 @@ request_id() -> %%---------------------------------------------------------------------- agent_data(TargetName, SendOpts) -> - case snmpm_config:agent_info(TargetName, all) of - {ok, Info} -> - Version = agent_data_item(version, Info), + case snmpm_config:agent_info(TargetName, version) of + {ok, Version} -> MsgData = case Version of v3 -> - DefSecModel = agent_data_item(sec_model, Info), - DefSecName = agent_data_item(sec_name, Info), - DefSecLevel = agent_data_item(sec_level, Info), + DefSecModel = agent_data_item(sec_model, TargetName), + DefSecName = agent_data_item(sec_name, TargetName), + DefSecLevel = agent_data_item(sec_level, TargetName), - EngineId = agent_data_item(engine_id, Info), + EngineId = agent_data_item(engine_id, TargetName), CtxName = agent_data_item(context, SendOpts, ?DEFAULT_CONTEXT), @@ -3191,8 +3190,8 @@ agent_data(TargetName, SendOpts) -> {SecModel, SecName, mk_sec_level_flag(SecLevel), EngineId, CtxName, TargetName}; _ -> - DefComm = agent_data_item(community, Info), - DefSecModel = agent_data_item(sec_model, Info), + DefComm = agent_data_item(community, TargetName), + DefSecModel = agent_data_item(sec_model, TargetName), Comm = agent_data_item(community, SendOpts, @@ -3203,21 +3202,21 @@ agent_data(TargetName, SendOpts) -> {Comm, SecModel} end, - Domain = agent_data_item(tdomain, Info), - Addr = agent_data_item(address, Info), - Port = agent_data_item(port, Info), - RegType = agent_data_item(reg_type, Info), + Domain = agent_data_item(tdomain, TargetName), + Addr = agent_data_item(address, TargetName), + Port = agent_data_item(port, TargetName), + RegType = agent_data_item(reg_type, TargetName), {ok, RegType, Domain, Addr, Port, version(Version), MsgData}; Error -> Error end. -agent_data_item(Item, Info) -> - case lists:keysearch(Item, 1, Info) of - {value, {_, Val}} -> +agent_data_item(Item, TargetName) -> + case snmpm_config:agent_info(TargetName, Item) of + {ok, Val} -> Val; - false -> - throw({error, {not_found, Item, Info}}) + {error, not_found} -> + throw({error, {not_found, Item, TargetName}}) end. agent_data_item(Item, Info, Default) -> diff --git a/lib/snmp/src/manager/snmpm_user_default.erl b/lib/snmp/src/manager/snmpm_user_default.erl index d90fc3f258..015198cb76 100644 --- a/lib/snmp/src/manager/snmpm_user_default.erl +++ b/lib/snmp/src/manager/snmpm_user_default.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -62,7 +62,7 @@ handle_trap(TargetName, SnmpTrap, UserData) -> "~n SnmpTrap: ~p" "~n UserData: ~p", [TargetName, SnmpTrap, UserData]), - ok. + ignore. handle_inform(TargetName, SnmpInform, UserData) -> @@ -80,7 +80,7 @@ handle_report(TargetName, SnmpReport, UserData) -> "~n SnmpReport: ~p" "~n UserData: ~p", [TargetName, SnmpReport, UserData]), - ok. + ignore. info(F, A) -> diff --git a/lib/ssh/doc/src/ssh.xml b/lib/ssh/doc/src/ssh.xml index a0afb5056e..7f7d887d5e 100644 --- a/lib/ssh/doc/src/ssh.xml +++ b/lib/ssh/doc/src/ssh.xml @@ -188,6 +188,9 @@ <p>Provide, in bytes, when rekeying should be initiated, defaults to one time each GB and one time per hour.</p> </item> + <tag><c><![CDATA[{idle_time, integer()}]]></c></tag> + <item> + <p>Sets a timeout on connection when no channels are active, default is infinity</p></item> </taglist> </desc> </func> diff --git a/lib/ssh/src/Makefile b/lib/ssh/src/Makefile index 323f0af191..27e43a88ed 100644 --- a/lib/ssh/src/Makefile +++ b/lib/ssh/src/Makefile @@ -120,10 +120,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src index 826a11f1f4..cbd8166bb9 100644 --- a/lib/ssh/src/ssh.appup.src +++ b/lib/ssh/src/ssh.appup.src @@ -19,12 +19,14 @@ {"%VSN%", [ + {<<"2.1.2">>, [{restart_application, ssh}]}, {<<"2.1.1">>, [{restart_application, ssh}]}, {<<"2.1">>, [{restart_application, ssh}]}, {<<"2.0\\.*">>, [{restart_application, ssh}]}, {<<"1\\.*">>, [{restart_application, ssh}]} ], [ + {<<"2.1.2">>, [{restart_application, ssh}]}, {<<"2.1.1">>, [{restart_application, ssh}]}, {<<"2.1">>,[{restart_application, ssh}]}, {<<"2.0\\.*">>, [{restart_application, ssh}]}, diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 3ef26b1678..193f877b98 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -31,11 +31,6 @@ stop_listener/1, stop_listener/2, stop_daemon/1, stop_daemon/2, shell/1, shell/2, shell/3]). --deprecated({sign_data, 2, next_major_release}). --deprecated({verify_data, 3, next_major_release}). - --export([sign_data/2, verify_data/3]). - %%-------------------------------------------------------------------- %% Function: start([, Type]) -> ok %% @@ -278,7 +273,9 @@ do_start_daemon(Host, Port, Options, SocketOptions) -> {ok, SysSup} -> {ok, SysSup}; {error, {already_started, _}} -> - {error, eaddrinuse} + {error, eaddrinuse}; + {error, R} -> + {error, R} catch exit:{noproc, _} -> {error, ssh_not_started} @@ -392,8 +389,8 @@ handle_ssh_option({public_key_alg, Value} = Opt) when Value == 'ssh-rsa'; Value Opt; handle_ssh_option({pref_public_key_algs, Value} = Opt) when is_list(Value), length(Value) >= 1 -> case handle_pref_algs(Value, []) of - true -> - Opt; + {true, NewOpts} -> + NewOpts; _ -> throw({error, {eoptions, Opt}}) end; @@ -501,38 +498,3 @@ inetopt(false) -> %%% %% Deprecated %%% - -%%-------------------------------------------------------------------- -%% Function: sign_data(Data, Algorithm) -> binary() | -%% {error, Reason} -%% -%% Data = binary() -%% Algorithm = "ssh-rsa" -%% -%% Description: Use SSH key to sign data. -%%-------------------------------------------------------------------- -sign_data(Data, Algorithm) when is_binary(Data) -> - case ssh_file:user_key(Algorithm,[]) of - {ok, Key} when Algorithm == "ssh-rsa" -> - public_key:sign(Data, sha, Key); - Error -> - Error - end. - -%%-------------------------------------------------------------------- -%% Function: verify_data(Data, Signature, Algorithm) -> ok | -%% {error, Reason} -%% -%% Data = binary() -%% Signature = binary() -%% Algorithm = "ssh-rsa" -%% -%% Description: Use SSH signature to verify data. -%%-------------------------------------------------------------------- -verify_data(Data, Signature, Algorithm) when is_binary(Data), is_binary(Signature) -> - case ssh_file:user_key(Algorithm, []) of - {ok, #'RSAPrivateKey'{publicExponent = E, modulus = N}} when Algorithm == "ssh-rsa" -> - public_key:verify(Data, sha, Signature, #'RSAPublicKey'{publicExponent = E, modulus = N}); - Error -> - Error - end. diff --git a/lib/ssh/src/ssh_client_key_api.erl b/lib/ssh/src/ssh_client_key_api.erl index eed0b85f47..58054a9fc5 100644 --- a/lib/ssh/src/ssh_client_key_api.erl +++ b/lib/ssh/src/ssh_client_key_api.erl @@ -26,7 +26,7 @@ Algorithm :: 'ssh-rsa'| 'ssh-dss'| atom(), ConnectOptions :: proplists:proplist()) -> boolean(). --callback user_key(Algorithm :: 'ssh-rsa'| 'ssh-dss'| atom(), ConnectOptions :: proplists:proplists()) -> +-callback user_key(Algorithm :: 'ssh-rsa'| 'ssh-dss'| atom(), ConnectOptions :: proplists:proplist()) -> {ok, PrivateKey :: #'RSAPrivateKey'{}| #'DSAPrivateKey'{} | term()} | {error, string()}. diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl index 88b45111ff..9378686242 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -422,11 +422,15 @@ userauth(#ssh_msg_userauth_failure{authentications = Methodes}, #state{ssh_params = #ssh{role = client, userauth_methods = none} = Ssh0} = State) -> AuthMethods = string:tokens(Methodes, ","), - {Msg, Ssh} = ssh_auth:userauth_request_msg( - Ssh0#ssh{userauth_methods = AuthMethods}), - send_msg(Msg, State), - {next_state, userauth, next_packet(State#state{ssh_params = Ssh})}; - + Ssh1 = Ssh0#ssh{userauth_methods = AuthMethods}, + case ssh_auth:userauth_request_msg(Ssh1) of + {disconnect, DisconnectMsg, {Msg, Ssh}} -> + send_msg(Msg, State), + handle_disconnect(DisconnectMsg, State#state{ssh_params = Ssh}); + {Msg, Ssh} -> + send_msg(Msg, State), + {next_state, userauth, next_packet(State#state{ssh_params = Ssh})} + end; %% The prefered authentication method failed try next method userauth(#ssh_msg_userauth_failure{}, #state{ssh_params = #ssh{role = client} = Ssh0} = State) -> diff --git a/lib/ssh/vsn.mk b/lib/ssh/vsn.mk index 921ec2206a..71666a3179 100644 --- a/lib/ssh/vsn.mk +++ b/lib/ssh/vsn.mk @@ -1,5 +1,5 @@ #-*-makefile-*- ; force emacs to enter makefile-mode -SSH_VSN = 2.1.2 +SSH_VSN = 2.1.3 APP_VSN = "ssh-$(SSH_VSN)" diff --git a/lib/ssl/doc/src/notes.xml b/lib/ssl/doc/src/notes.xml index 49bbd5d27d..73cda03b2f 100644 --- a/lib/ssl/doc/src/notes.xml +++ b/lib/ssl/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1999</year><year>2012</year> + <year>1999</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -22,10 +22,6 @@ </legalnotice> <title>SSL Release Notes</title> - <prepared>Peter Högfeldt</prepared> - <docno></docno> - <date>2003-08-03</date> - <rev>G</rev> <file>notes.xml</file> </header> <p>This document describes the changes made to the SSL application.</p> @@ -605,1285 +601,7 @@ </item> </list> </section> - - </section> - - - <section><title>SSL 3.11.1</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - Fixed handling of several ssl/tls packets arriving at the - same time. This was broken during a refactoring of the - code.</p> - <p> - Own Id: OTP-8679</p> - </item> - </list> - </section> - - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> - Added missing checks for padding and Mac value. Removed - code for export ciphers and DH certificates as we decided - not to support them.</p> - <p> - Own Id: OTP-7047</p> - </item> - <item> - <p> - New ssl will no longer return esslerrssl to be backwards - compatible with old ssl as this hids infomation from the - user. format_error/1 has been updated to support new ssl.</p> - <p> - *** POTENTIAL INCOMPATIBILITY ***</p> - <p> - Own Id: OTP-7049</p> - </item> - <item> - <p> - New ssl now supports secure renegotiation as described by - RFC 5746.</p> - <p> - Own Id: OTP-8568</p> - </item> - <item> - <p> - Alert handling has been improved to better handle - unexpected but valid messages and the implementation is - also changed to avoid timing related issues that could - cause different error messages depending on network - latency. Packet handling was sort of broken but would - mostly work as expected when socket was in binary mode. - This has now been fixed.</p> - <p> - Own Id: OTP-8588</p> - </item> - </list> - </section> - -</section> - -<section><title>SSL 3.11</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - Fixes handling of the option fail_if_no_peer_cert and - some undocumented options. Thanks to Rory Byrne.</p> - <p> - Own Id: OTP-8557</p> - </item> - </list> - </section> - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> - Support for Diffie-Hellman. ssl-3.11 requires - public_key-0.6.</p> - <p> - Own Id: OTP-7046</p> - </item> - <item> - <p> - New ssl now properly handles ssl renegotiation, and - initiates a renegotiation if ssl/ltls-sequence numbers - comes close to the max value. However RFC-5746 is not yet - supported, but will be in an upcoming release.</p> - <p> - Own Id: OTP-8517</p> - </item> - <item> - <p> - When gen_tcp is configured with the {packet,http} option, - it automatically switches to expect HTTP Headers after a - HTTP Request/Response line has been received. This update - fixes ssl to behave in the same way. Thanks to Rory - Byrne.</p> - <p> - Own Id: OTP-8545</p> - </item> - <item> - <p> - Ssl now correctly verifies the extended_key_usage - extension and also allows the user to verify application - specific extensions by supplying an appropriate fun.</p> - <p> - Own Id: OTP-8554 Aux Id: OTP-8553 </p> - </item> - <item> - <p> - Fixed ssl:transport_accept/2 to return properly when - socket is closed. Thanks to Rory Byrne.</p> - <p> - Own Id: OTP-8560</p> - </item> - </list> - </section> - -</section> - -<section><title>SSL 3.10.9</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - Fixed a crash in the certificate certification part.</p> - <p> - Own Id: OTP-8510 Aux Id: seq11525 </p> - </item> - </list> - </section> - -</section> - -<section><title>SSL 3.10.8</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p><c>ssl:send/2</c> ignored packet option, fix provided - by YAMASHINA Hio.</p> - <p>Fixed a file cache bug which caused problems when the - same file was used for both cert and cacert.</p> - <p>Allow <c>ssl:listen/2</c> to be called with option - {ssl_imp, old}.</p> - <p> Fixed ssl:setopts(Socket, binary) which didn't work - for 'new' ssl.</p>. - <p> - Own Id: OTP-8441</p> - </item> - <item> - <p> - Do a controlled shutdown if a non ssl packet arrives as - the first packet.</p> - <p> - Own Id: OTP-8459 Aux Id: seq11505 </p> - </item> - </list> - </section> - - - <section><title>Improvements and New Features</title> - <list> - <item> - <p>Fixed session reuse (in new_ssl), thanks Wil Tan.</p> - <p>Send CA list during Certificate Request (in new_ssl) , - thanks Wil Tan.</p> <p><c>NOTE</c>: SSL (new_ssl) - requires public_key-0.5.</p> - <p> - Own Id: OTP-8372</p> - </item> - </list> - </section> - -</section> - -<section><title>SSL 3.10.7</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - A ticker process could potentially be blocked - indefinitely trying to send a tick to a node not - responding. If this happened, the connection would not be - brought down as it should.</p> - <p> This requires erts-5.7.4 and kernel-2.13.4 or later - to be able to get the erlang distribution over ssl to work.</p> - <p> - Own Id: OTP-8218</p> - </item> - </list> - </section> - - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> - The documentation is now built with open source tools - (xsltproc and fop) that exists on most platforms. One - visible change is that the frames are removed.</p> - <p> - Own Id: OTP-8250</p> - </item> - <item> - <p> - Code cleanup from Kostis.</p> - <p> - Own Id: OTP-8260</p> - </item> - </list> - </section> - -</section> - -<section><title>SSL 3.10.6</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - The ssl:ssl_accept/3 issue was not properly fixed in the - previous patch, see OTP-8244.</p> - <p> - Own Id: OTP-8275 Aux Id: seq11451 </p> - </item> - </list> - </section> - -</section> - -<section><title>SSL 3.10.5</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - Allow clients to not send certificates if option - <c>fail_if_no_peer_cert</c> was not set.</p> - <p> - Own Id: OTP-8224</p> - </item> - <item> - <p>An ssl:ssl_accept/3 could crash a connection if the - timing was wrong.</p> <p>Removed info message if the - socket closed without a proper disconnect from the ssl - layer. </p> <p>ssl:send/2 is now blocking until the - message is sent.</p> - <p> - Own Id: OTP-8244 Aux Id: seq11420 </p> - </item> - </list> - </section> - -</section> - -<section><title>SSL 3.10.4</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - A client could avoid a certificate check if the client - code didn't send the requested certificate.</p> - <p> - Own Id: OTP-8137</p> - </item> - </list> - </section> - -</section> - -<section><title>SSL 3.10.3</title> - - <section><title>Improvements and New Features</title> - <list> - <item> - <p>Packet handling was not implemented correctly.</p> - <p>Inet option handling support have been improved.</p> - <p>The <c>verify_fun</c> is now invoked even if - verify_peer is used, that implies that by default - {bad_cert,unknown_ca} is an accepted fault during the - client connection phase. The check can still be done by - suppling another verify_fun.</p> - <p> - Own Id: OTP-8011 Aux Id: seq11287 </p> - </item> - </list> - </section> - -</section> - - -<section><title>SSL 3.10.2</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - A "new_ssl" socket was not closed if the controlling - process died without calling ssl:close/1.</p> - <p> - Own Id: OTP-7963 Aux Id: seq11276 </p> - </item> - </list> </section> - -</section> - -<section><title>SSL 3.10.1</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - Fixed bug that caused the ssl handshake finished message - to be calculated wrongly under the circumstances that the - server did not send the trusted cert and that the - previous cert did not have the extension telling us the - trusted certs name. This manifested it self as - bad_record_mac alert from the server.</p> - <p> - Own Id: OTP-7878</p> - </item> - </list> - </section> - - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> - The cacertsfile option is now optional for ssl servers.</p> - <p> - Own Id: OTP-7656</p> - </item> - <item> - <p> - For the ssl client the options cacertfile, certfile and - keyfile are now optional as they are not always needed - depending on configuration of the client itself and the - configuration of the server. Also as PEM-files may - contain more than one entry the keyfile option will - default to the same file as given by the certfile option.</p> - <p> - Own Id: OTP-7870</p> - </item> - <item> - <p> - Added new ssl client option verify_fun.</p> - <p> - Own Id: OTP-7871</p> - </item> - </list> - </section> - -</section> - - <section><title>SSL 3.10</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - Error log entries are now formatted correctly.</p> - <p> - Own Id: OTP-7258</p> - </item> - </list> - </section> - - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> - All handling of X509-certificates and public keys have - been moved to the new application public_key.</p> - <p> - Own Id: OTP-6894</p> - </item> - <item> - <p> - New ssl now supports SSL-3.0 and TLS-1.0</p> - <p> - Own Id: OTP-7037</p> - </item> - <item> - <p> - New ssl now supports all inet-packet types.</p> - <p> - Own Id: OTP-7039</p> - </item> - <item> - <p> - The new ssl-server is now able to send a certificate - request to the client. However new options may be - introduced later to fully support all features regarding - certificate requests.</p> - <p> - Own Id: OTP-7150</p> - </item> - </list> - </section> - - - <section><title>Known Bugs and Problems</title> - <list> - <item> - <p> - Running erlang distribution over ssl don't work as - described in the documentation.</p> - <p> - Own Id: OTP-7536</p> - </item> - </list> - </section> - - </section> - - - <section><title>SSL 3.9</title> - - <section><title>Fixed Bugs and Malfunctions</title> - <list> - <item> - <p> - ssl_prim.erl was passing an FD rather than an #sslsocket - to ssl_broker:ssl_accept_prim. This could cause problems - in the deprecated accept function, this will not cause - any more problems however this function is deprecated!</p> - <p> - Own Id: OTP-6926</p> - </item> - <item> - <p> - Erlang distribution over ssl was broken after R11B-0, - this has now been fixed.</p> - <p> - Own Id: OTP-7004</p> - </item> - </list> - </section> - - - <section><title>Improvements and New Features</title> - <list> - <item> - <p> - All inet options are available in the new ssl - implementation that is released as a alfa in ssl-3.9 and - will replace the old implementation in ssl-4.0. This will - not be fixed in the old implementation.</p> - <p> - Own Id: OTP-4677</p> - </item> - <item> - <p> - The new ssl implementation released as a alfa in this - version supports upgrading of a tcp connection to an ssl - connection so that http client and servers may implement - RFC 2817.</p> - <p> - Own Id: OTP-5510</p> - </item> - <item> - <p>A new implementation of ssl is released as a alfa - version in ssl-3.9 it will later replace the old - implementation in ssl-4.0. The new implementation can be - accessed by providing the option {ssl_imp, new} to the - ssl:connect and ssl:listen functions.</p> - <p>The new implementation is Erlang based and all logic - is in Erlang and only payload encryption calculations are - done in C via the crypto application. The main reason for - making a new implementation is that the old solution was - very crippled as the control of the ssl-socket was deep - down in openssl making it hard if not impossible to - support all inet options, ipv6 and upgrade of a tcp - connection to an ssl connection. The alfa version has a - few limitations that will be removed before the ssl-4.0 - release. Main differences and limitations in the alfa are - listed below.</p> - - <list type="bulleted"> <item>New ssl requires the crypto - application.</item> <item>The option reuseaddr is - supported and the default value is false as in gen_tcp. - Old ssl is patched to accept that the option is set to - true to provide a smoother migration between the - versions. In old ssl the option is hard coded to - true.</item> <item>ssl:version/0 is replaced by - ssl:versions/0</item> <item>ssl:ciphers/0 is replaced by - ssl:cipher_suites/0</item> <item>ssl:pid/1 is a - meaningless function in new ssl and will be deprecated in - ssl-4.0 until it is removed it will return a valid but - meaningless pid.</item> <item>New API functions are - ssl:shutdown/2, ssl:cipher_suites/[0,1] and - ssl:versions/0</item> <item>Diffie-Hellman keyexchange is - not supported.</item> <item>Not all inet packet types are - supported.</item> <item>CRL and policy certificate - extensions are not supported.</item> <item>In this alfa - only sslv3 is enabled, although tlsv1 and tlsv1.1 - versions are implemented and will be supported in future - versions.</item> <item>For security reasons sslv2 is not - supported.</item> </list> - <p> - Own Id: OTP-6619</p> - </item> - <item> - <p> - New ssl implementation, released as alfa in ssl-3.9, - supports ipv6. It will not be supported in the old - implementation.</p> - <p> - Own Id: OTP-6637 Aux Id: OTP-6636 </p> - </item> - </list> - </section> - - </section> - - <section> - <title>SSL 3.1.1.1</title> - - <section> - <title>Minor Makefile changes</title> - <list type="bulleted"> - <item> - <p>Removed use of <c>erl_flags</c> from Makefile.</p> - <p>Own Id: OTP-6689</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 3.1.1</title> - - <section> - <title>Crash on error in ssl_accept</title> - <list type="bulleted"> - <item> - <p>A bug in ssl_accept could cause all ssl - connections to hang when a connection - attempt was closed by the client while - the server was in <c>ssl_accept</c>.</p> - <p>Own Id: OTP-6612 Aux Id: seq10599</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 3.1</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>SSL now uses a two-phase accept, with a separate accept - calls for the socket and the ssl protocol. This avoids - timeouts when a client doesn't initiate ssl handshake.</p> - <p>With the old implementation of accept, the server - was locked by a client, if the client didn't do - proper ssl handshake.</p> - <p>Own Id: OTP-6418 Aux Id: seq10105</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 3.0.12</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>An integer array pointing to a struct pollfd array, is - now reset before file descriptors are collected to be - included in a call to poll(). This is to prevent file - descriptors to be mixed up.</p> - <p>Own Id: OTP-6084</p> - </item> - <item> - <p>The generation of the module ssl_pkix_oid contained - multiple identifiers, which made the mapping between - atoms and identifiers not one-to-one.</p> - <p>Own Id: OTP-6085</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 3.0.11</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>The state of a connection in active mode could be in a - restrictive state, so that an internal tcp_closed message - was incorrectly considered illegal, resulting in a - premature termination of the connection process.</p> - <p>Own Id: OTP-5972 Aux Id: seq10188 </p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 3.0.10</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>Erlang distribution over SSL was broken. Corrected. - (Thanks to Fredrik Thulin.)</p> - <p>Own Id: OTP-5863</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 3.0.9</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>The port program for the ssl application could waste huge - amounts of CPU time if a write could not be completed - directly and was put in the write queue. (Only on platforms - where poll() is used, such as Solaris and Linux.)</p> - <p>Own Id: OTP-5784</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 3.0.8</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>A process reading only a portion of a sufficiently large - amount of data from an accepted socket, and then quering - the ssl library (e.g. ssl:getpeername()), would cause a - global deadlock in the esock port program.</p> - <p>Own Id: OTP-5702</p> - </item> - <item> - <p>A spelling error in the module <c>ssl_pkix</c> caused the - call to <c>ssl:peercert/2</c> to fail when the option - <c>subject</c> was used.</p> - <p>Own Id: OTP-5708</p> - </item> - <item> - <p>Because fopen() on Solaris 8 can't handle file - descriptor numbers above 255, reading of certificate - files would fail if all file descriptors below 256 were - in use (typically, if many connections were open). This - problem has been worked around.</p> - <p>The ssl application's port program used to use - select(), which meant that it could not handle more than - FD_SETSIZE file descriptors (usually 1024). To eliminate - that limitation, poll() is now used on all platforms that - support it.</p> - <p>Solaris/Sparc, 64-bit emulator: The SO_REUSEADDR - option was not set for listen sockets, which essentially - made the ssl application unusable. Corrected.</p> - <p>The default listen queue size for ssl port program was - changed to 128 (from 5).</p> - <p>Own Id: OTP-5755 Aux Id: seq10068 </p> - </item> - </list> - </section> - </section> - - <section> - <title>Ssl 3.0.7</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>The R/W buffer length i esock.c was too small. It has - been increased from 4k to 32k.</p> - <p>Own Id: OTP-5620</p> - </item> - </list> - </section> - </section> - - <section> - <title>Ssl 3.0.6</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>A configuration option for choosing protocol versions has - been added (<c>sslv2</c>, <c>sslv3</c>, and - <c>tlsv1</c>).</p> - <p>Own Id: OTP-5429 Aux Id: seq9755 </p> - </item> - </list> - </section> - </section> - - <section> - <title>Ssl 3.0.5</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>Linked in drivers in the crypto, and asn1 applications - are now compiled with the -D_THREAD_SAFE and -D_REENTRANT - switches on unix when the emulator has thread support - enabled.</p> - <p>Linked in drivers on MacOSX are not compiled with the - undocumented -lbundle1.o switch anymore. Thanks to Sean - Hinde who sent us a patch.</p> - <p>Linked in driver in crypto, and port programs in ssl, now - compiles on OSF1.</p> - <p>Minor makefile improvements in runtime_tools.</p> - <p>Own Id: OTP-5346</p> - </item> - </list> - </section> - </section> - - <section> - <title>Ssl 3.0.4</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p><c>ssl:recv/3</c> with finite timeout value, closed the - connection at timeout.</p> - <p>Own Id: OTP-4882</p> - </item> - </list> - </section> - </section> - - <section> - <title>Ssl 3.0.3</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>When a file descriptor was marked for closing, and - end-of-file condition had already been detected, the file - descriptor was never closed.</p> - <p>Own Id: OTP-5093 Aux Id: seq8806 </p> - </item> - <item> - <p>When the number of open file descriptors reached - FD_SETSIZE, the SSL port program entered a busy loop.</p> - <p>Own Id: OTP-5094 Aux Id: seq8806 </p> - </item> - </list> - </section> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>The SSL application now supports SSL sessions for - servers, which typically speeds up HTTP requests from - browsers.</p> - <p>Own Id: OTP-5095</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 3.0.2</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>The UTF8String type is now defined in asn1-1.4.4.2 and - later. Therefore the definitions of UTF8String has been - removed from the ASN.1 modules PKIX1Explicit88.asn1 and - PKIXAttributeCertificate.asn1. The SSL application can now - only be built using asn-1.4.4.2 or later.</p> - <p>OwnId: OTP-4971.</p> - </item> - </list> - </section> - - <section> - <title>Known Bugs and Problems</title> - <p>See SSL-3.0. - </p> - </section> - </section> - - <section> - <title>SSL 3.0.1</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>An unexpected object identifier would crash <c>ssl:peercert</c>. </p> - <p>OwnId: OTP-4771.</p> - </item> - </list> - </section> - - <section> - <title>Known Bugs and Problems</title> - <p>See SSL-3.0. - </p> - </section> - </section> - - <section> - <title>SSL 3.0</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>The <c>cache_timout</c> option was silently ignored. It had - to do with SSL sessions, where multiple connections can occur. - Since the Erlang SSL application does not support sessions the - option is still ignored, and consequently the documentation - about it has been removed.</p> - <p>OwnId: OTP-3146</p> - </item> - <item> - <p>The Erlang SSL application is now based on OpenSSL version - 0.9.7a. OpenSSL 0.9.6 should also work.</p> - <p>OwnId: OTP-4002</p> - </item> - <item> - <p>When connecting it is now possible to bind to a local address - and local port. </p> - <p>OwnId: OTP-4675</p> - </item> - <item> - <p>The <c>ssl_esock</c> port program is now part of the - distribution and thus does not have to be created - explicitly. It is dynamically linked to OpenSSL - libraries in a "standard" location (typically - <c>/usr/local/lib</c> on UNIX; in the path on Win32).</p> - <p>OwnId: - OTP-4676</p> - </item> - <item> - <p>The new functions <c>ssl:peercert/1/2</c> provide information - from the certificate of a peer of a connection.</p> - <p>OwnId: OTP-4680 - <br></br> -Aux Id: seq7688</p> - </item> - <item> - <p>The function <c>ssl:port/1</c> has been removed from the - documentation, but not from the <c>ssl</c> interface module. - The recommendation is to use <c>ssl:peername/1</c> - instead, which provides both address and port of the peer.</p> - <p>OwnId: OTP-4681 </p> - </item> - <item> - <p>New User's Guide documentation has been added.</p> - <p>OwnId: OTP-4682 </p> - </item> - <item> - <p>The old <c>ssl_socket</c> interface has been removed and also - the documentation of it. </p> - <p>OwnId: OTP-4683 </p> - </item> - <item> - <p>The use of ephemeral RSA keys is now supported. It is - a global configuration option (see the ssl(6) manual page).</p> - <p>OwnId: OTP-4691.</p> - </item> - </list> - </section> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>The option <c>cacertfile</c> is now in effect, and can - therefore no longer be set with the OS environment - variable SSL_CERT_FILE (which did set the same value for - all connections). </p> - <p>OwnId: OTP-3146</p> - </item> - <item> - <p>There was a synchronization error at closing of an SSL - connection. </p> - <p>OwnId: OTP-4435 - <br></br> -Aux Id: seq7534</p> - </item> - <item> - <p>C macros in <c>debuglog.c</c> were not ANSI C compliant.</p> - <p>OwnId: OTP-4674</p> - </item> - <item> - <p>The <c>binary</c> option was not properly handled.</p> - <p>OwnId: OTP-4678</p> - </item> - <item> - <p>The <c>ssl:format_error/1</c> did not consider <c>inet</c> - error codes, nor did it have a catch all for unknown error - codes.</p> - <p>OwnId: OTP-4679</p> - </item> - </list> - </section> - - <section> - <title>Known Bugs and Problems</title> - <list type="bulleted"> - <item> - <p>Change of controlling process in not OTP compliant. </p> - <p>OwnId; OTP-4712</p> - </item> - <item> - <p>There is still no way to restrict the cipher sizes. </p> - <p>OwnId: OTP-4712</p> - </item> - <item> - <p>The <c>keep_alive</c> and <c>reuse_addr</c> options will be - added in a future release. </p> - <p>OwnId: OTP-4677</p> - </item> - <item> - <p>There is currently no way to restrict the SSL/TLS - protocol versions to use. In a future release this will be - supported as a configuration option, and as an option for - each connection as well. </p> - <p>OwnId: OTP-4711.</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 2.3.6</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>There was a synchronization error at closing, which could - result in that an SSL socket was removed prematurely, resulting - in that a user process referring to it received an unexpected - exit.</p> - <p>OwnId: OTP-4435 - <br></br> -Aux Id: seq7600</p> - </item> - </list> - </section> - - <section> - <title>Known Bugs and Problems</title> - <p>See SSL 2.2 . </p> - </section> - </section> - - <section> - <title>SSL 2.3.5</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>Setting of the option `nodelay' caused the SSL port program - to dump core.</p> - <p>OwnId: OTP-4380 - <br></br> -Aux Id: -</p> - </item> - <item> - <p>Setting of the option '{active, once}' in <c>setopts</c> was - wrong, causing a correct socket message to be regarded as - erroneous. </p> - <p>OwnId: OTP-4380 - <br></br> -Aux Id: -</p> - </item> - <item> - <p>A self-signed peer certificate was always rejected with the - error `eselfsignedcert', irrespective of the `depth' value. </p> - <p>OwnId: OTP-4374 - <br></br> -Aux Id: seq7417</p> - </item> - </list> - </section> - - <section> - <title>Known Bugs and Problems</title> - <p>See SSL 2.2 . </p> - </section> - </section> - - <section> - <title>SSL 2.3.4</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>All TCP options allowed in gen_tcp, are now also allowed in - SSL, except the option <c>{reuseaddr, Boolean}</c>. A new - function <c>getopts</c> has been added to the SSL interface - module <c>ssl</c>. </p> - <p>OwnId: OTP-4305, OTP-4159</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 2.3.3</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>The roles of the SSLeay and OpenSSL packages has been - clarified in the ssl(6) application manual page. Also - the URLs from which to download SSLeay has been updated.</p> - <p>OwnId: OTP-4002 - <br></br> -Aux Id: seq5269</p> - </item> - <item> - <p>A call to <c>ssl:listen(Port, Options)</c> with - <c>Options = []</c> resulted in the cryptic <c>{error, ebadf}</c> return value. The return value has been changed - to <c>{error, enooptions}</c>, and the behaviour has been - documented in the <c>listen/2</c> function.</p> - <p>OwnId: OTP-4016 - <br></br> -Aux Id: seq7006</p> - </item> - <item> - <p>Use of the option <c>{nodelay, boolean()}</c> crashed - the <c>ssl_server</c>.</p> - <p>OwnId: OTP-4070 - <br></br> -Aux Id:</p> - </item> - <item> - <p>A bug caused the Erlang distribution over ssl to fail. - This bug has now been fixed.</p> - <p>OwnId: OTP-4072 - <br></br> -Aux Id:</p> - </item> - <item> - <p>On Windows when the SSL port program encountered an - error code not anticipated it crashed. </p> - <p>OwnId: OTP-4132 - <br></br> -Aux Id:</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 2.3.2</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>The <c>ssl:accept/1-2</c> function sometimes returned - <c>{error, {What, Where}}</c> instead of <c>{error, What}</c>, where <c>What</c> is an atom. </p> - <p>OwnId: OTP-3775 - <br></br> -Aux Id: seq4991</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 2.3.1</title> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>Sometimes the SSL portprogram would loop in an accept - loop, without terminating even when the SSL application - was stopped.. </p> - <p>OwnId: OTP-3691</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 2.3</title> - <p>Functions have been added to SSL to experimentally support - Erlang distribution. - </p> - </section> - - <section> - <title>SSL 2.2.1</title> - <p>The 2.2.1 version of SSL provides code replacement in runtime - by upgrading from, or downgrading to, versions 2.1 and 2.2. - </p> - </section> - - <section> - <title>SSL 2.2</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>The restriction that only the creator of an SSL socket can - read from and write to the socket has been lifted.</p> - <p>OwnId: OTP-3301</p> - </item> - <item> - <p>The option <c>{packet, cdr}</c> for SSL sockets has been added, - which means that SSL sockets also supports CDR encoded packets.</p> - <p>OwnId: OTP-3302</p> - </item> - </list> - </section> - - <section> - <title>Known Bugs and Problems</title> - <list type="bulleted"> - <item> - <p>Setting of a CA certificate file with the <c>cacertfile</c> - option (in calls to <c>ssl:accept/1/2</c> or - <c>ssl:connect/3/4</c>) does not work due to weaknesses - in the SSLeay package. </p> - <p>A work-around is to set the OS environment variable - <c>SSL_CERT_FILE</c> before SSL is started. However, then - the CA certificate file will be global for all connections.</p> - <p>OwnId: OTP-3146</p> - </item> - <item> - <p>When changing controlling process of an SSL socket, a - temporary process is started, which is not gen_server - compliant.</p> - <p>OwnId: OTP-3146</p> - </item> - <item> - <p>Although there is a <c>cache</c> timeout option, it is - silently ignored.</p> - <p>OwnId: OTP-3146</p> - </item> - <item> - <p>There is currently no way to restrict the cipher sizes.</p> - <p>OwnId: OTP-3146</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 2.1</title> - - <section> - <title>Improvements and New Features</title> - <list type="bulleted"> - <item> - <p>The set of possible error reasons has been extended to - contain diagnostics on erroneous certificates and failures - to verify certificates.</p> - <p>OwnId: OTP-3145</p> - </item> - <item> - <p>The maximum number of simultaneous SSL connections on - Windows has been increased from 31 to 127.</p> - <p>OwnId: OTP-3145</p> - </item> - </list> - </section> - - <section> - <title>Fixed Bugs and Malfunctions</title> - <list type="bulleted"> - <item> - <p>A dead-lock occurring when write queues are not empty has - been removed. </p> - <p>OwnId: OTP-3145</p> - </item> - <item> - <p>Error reasons have been unified and changed.</p> - <p>(** POTENTIAL INCOMPATIBILITY **)</p> - <p>OwnId: OTP-3145</p> - </item> - <item> - <p>On Windows a check of the existence of the environment - variable <c>ERLSRV_SERVICE_NAME</c> has been added. If - that variable is defined, the port program of the SSL - application will not terminated when a user logs off.</p> - <p>OwnId: OTP-3145</p> - </item> - <item> - <p>An error in the setting of the <c>nodelay</c> option - has been corrected.</p> - <p>OwnId: OTP-3145</p> - </item> - <item> - <p>The confounded notions of verify mode and verify depth has - been corrected. The option <c>verifydepth</c> has been - removed, and the two separate options <c>verify</c> and - <c>depth</c> has been added.</p> - <p>(** POTENTIAL INCOMPATIBILITY **)</p> - <p>OwnId: OTP-3145</p> - </item> - </list> - </section> - - <section> - <title>Known Bugs and Problems</title> - <list type="bulleted"> - <item> - <p>Setting of a CA certificate file with the <c>cacertfile</c> - option (in calls to <c>ssl:accept/1/2</c> or - <c>ssl:connect/3/4</c>) does not work due to weaknesses - in the SSLeay package. </p> - <p>A work-around is to set the OS environment variable - <c>SSL_CERT_FILE</c> before SSL is started. However, then - the CA certificate file will be global for all connections.</p> - <p>OwnId: OTP-3146</p> - </item> - <item> - <p>When changing controlling process of an SSL socket, a - temporary process is started, which is not gen_server - compliant.</p> - <p>OwnId: OTP-3146</p> - </item> - <item> - <p>Although there is a <c>cache</c> timeout option, it is - silently ignored.</p> - <p>OwnId: OTP-3146</p> - </item> - <item> - <p>There is currently no way to restrict the cipher sizes.</p> - <p>OwnId: OTP-3146</p> - </item> - </list> - </section> - </section> - - <section> - <title>SSL 2.0</title> - <p>A complete new version of SSL with separate I/O channels - for all connections with non-blocking I/O multiplexing.</p> - </section> </chapter> diff --git a/lib/ssl/src/Makefile b/lib/ssl/src/Makefile index 6be8a1456e..043645be41 100644 --- a/lib/ssl/src/Makefile +++ b/lib/ssl/src/Makefile @@ -108,10 +108,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/ssl/src/ssl.appup.src b/lib/ssl/src/ssl.appup.src index 9b1227fa7f..76e14860ec 100644 --- a/lib/ssl/src/ssl.appup.src +++ b/lib/ssl/src/ssl.appup.src @@ -1,24 +1,13 @@ %% -*- erlang -*- {"%VSN%", [ - {"5.1.1", [{restart_application, ssl}] - }, - {"5.1", [ - {load_module, ssl_connection, soft_purge, soft_purge, []} - ] - }, + {<<"5.1\\*">>, [{restart_application, ssl}]}, {<<"5.0\\*">>, [{restart_application, ssl}]}, {<<"4\\.*">>, [{restart_application, ssl}]}, {<<"3\\.*">>, [{restart_application, ssl}]} ], [ - {"5.1.1", [{restart_application, ssl}] - }, - {"5.1", [ - {load_module, ssl_connection, soft_purge, soft_purge, []} - ] - }, - {"5.1", [{restart_application, ssl}]}, + {<<"5.1\\*">>, [{restart_application, ssl}]}, {<<"5.0\\*">>, [{restart_application, ssl}]}, {<<"4\\.*">>, [{restart_application, ssl}]}, {<<"3\\.*">>, [{restart_application, ssl}]} diff --git a/lib/ssl/src/ssl_alert.erl b/lib/ssl/src/ssl_alert.erl index 222b3f1ad7..f94a1136a0 100644 --- a/lib/ssl/src/ssl_alert.erl +++ b/lib/ssl/src/ssl_alert.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2012. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -36,8 +36,7 @@ %% Internal application API %%==================================================================== %%-------------------------------------------------------------------- --spec reason_code(#alert{}, client | server) -> closed | esslconnect | - esslaccept | string(). +-spec reason_code(#alert{}, client | server) -> closed | {essl, string()}. %% %% Description: Returns the error reason that will be returned to the %% user. @@ -45,12 +44,8 @@ reason_code(#alert{description = ?CLOSE_NOTIFY}, _) -> closed; -reason_code(#alert{description = ?HANDSHAKE_FAILURE}, client) -> - esslconnect; -reason_code(#alert{description = ?HANDSHAKE_FAILURE}, server) -> - esslaccept; reason_code(#alert{description = Description}, _) -> - description_txt(Description). + {essl, description_txt(Description)}. %%-------------------------------------------------------------------- -spec alert_txt(#alert{}) -> string(). diff --git a/lib/ssl/src/ssl_certificate_db.erl b/lib/ssl/src/ssl_certificate_db.erl index 67d00f0da7..ff36b5ee26 100644 --- a/lib/ssl/src/ssl_certificate_db.erl +++ b/lib/ssl/src/ssl_certificate_db.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2012. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,10 +18,11 @@ %% %%---------------------------------------------------------------------- -%% Purpose: Storage for trused certificats +%% Purpose: Storage for trusted certificates %%---------------------------------------------------------------------- -module(ssl_certificate_db). + -include("ssl_internal.hrl"). -include_lib("public_key/include/public_key.hrl"). -include_lib("kernel/include/file.hrl"). @@ -37,7 +38,7 @@ %%==================================================================== %%-------------------------------------------------------------------- --spec create() -> [db_handle()]. +-spec create() -> [db_handle(),...]. %% %% Description: Creates a new certificate db. %% Note: lookup_trusted_cert/4 may be called from any process but only @@ -54,7 +55,7 @@ create() -> ]. %%-------------------------------------------------------------------- --spec remove([db_handle()]) -> term(). +-spec remove([db_handle()]) -> ok. %% %% Description: Removes database db %%-------------------------------------------------------------------- @@ -114,8 +115,8 @@ add_trusted_certs(_Pid, File, [CertsDb, RefDb, PemChache] = Db) -> new_trusted_cert_entry({MD5, File}, Db) end. %%-------------------------------------------------------------------- --spec cache_pem_file({binary(), binary()}, [db_handle()]) -> term(). --spec cache_pem_file(reference(), {binary(), binary()}, [db_handle()]) -> term(). +-spec cache_pem_file({binary(), binary()}, [db_handle()]) -> {ok, term()}. +-spec cache_pem_file(reference(), {binary(), binary()}, [db_handle()]) -> {ok, term()}. %% %% Description: Cache file as binary in DB %%-------------------------------------------------------------------- @@ -131,19 +132,25 @@ cache_pem_file(Ref, {MD5, File}, [_CertsDb, _RefDb, PemChache]) -> insert(MD5, {Content, Ref}, PemChache), {ok, Content}. +%%-------------------------------------------------------------------- +-spec remove_trusted_certs(reference(), db_handle()) -> ok. +%% +%% Description: Removes all trusted certificates refernced by <Ref>. +%%-------------------------------------------------------------------- remove_trusted_certs(Ref, CertsDb) -> remove_certs(Ref, CertsDb). %%-------------------------------------------------------------------- --spec remove(term(), db_handle()) -> term(). +-spec remove(term(), db_handle()) -> ok. %% %% Description: Removes an element in a <Db>. %%-------------------------------------------------------------------- remove(Key, Db) -> - _ = ets:delete(Db, Key). + ets:delete(Db, Key), + ok. %%-------------------------------------------------------------------- --spec lookup(term(), db_handle()) -> term() | undefined. +-spec lookup(term(), db_handle()) -> [term()] | undefined. %% %% Description: Looks up an element in a <Db>. %%-------------------------------------------------------------------- @@ -158,7 +165,7 @@ lookup(Key, Db) -> [Pick(Data) || Data <- Contents] end. %%-------------------------------------------------------------------- --spec foldl(fun(), term(), db_handle()) -> term(). +-spec foldl(fun((_,_) -> term()), term(), db_handle()) -> term(). %% %% Description: Calls Fun(Elem, AccIn) on successive elements of the %% cache, starting with AccIn == Acc0. Fun/2 must return a new @@ -178,12 +185,13 @@ ref_count(Key, Db, N) -> ets:update_counter(Db,Key,N). %%-------------------------------------------------------------------- --spec clear(db_handle()) -> term(). +-spec clear(db_handle()) -> ok. %% %% Description: Clears the cache %%-------------------------------------------------------------------- clear(Db) -> - ets:delete_all_objects(Db). + true = ets:delete_all_objects(Db), + ok. %%-------------------------------------------------------------------- -spec db_size(db_handle()) -> integer(). @@ -194,30 +202,35 @@ db_size(Db) -> ets:info(Db, size). %%-------------------------------------------------------------------- -%%-spec insert(Key::term(), Data::term(), Db::db_handle()) -> no_return(). +-spec insert(Key::term(), Data::term(), Db::db_handle()) -> ok. %% %% Description: Inserts data into <Db> %%-------------------------------------------------------------------- insert(Key, Data, Db) -> - true = ets:insert(Db, {Key, Data}). + true = ets:insert(Db, {Key, Data}), + ok. %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- update_counter(Key, Count, Db) -> - true = ets:insert(Db, {Key, Count}). + true = ets:insert(Db, {Key, Count}), + ok. remove_certs(Ref, CertsDb) -> - ets:match_delete(CertsDb, {{Ref, '_', '_'}, '_'}). + true = ets:match_delete(CertsDb, {{Ref, '_', '_'}, '_'}), + ok. add_certs_from_der(DerList, Ref, CertsDb) -> Add = fun(Cert) -> add_certs(Cert, Ref, CertsDb) end, - [Add(Cert) || Cert <- DerList]. + [Add(Cert) || Cert <- DerList], + ok. add_certs_from_pem(PemEntries, Ref, CertsDb) -> Add = fun(Cert) -> add_certs(Cert, Ref, CertsDb) end, - [Add(Cert) || {'Certificate', Cert, not_encrypted} <- PemEntries]. - + [Add(Cert) || {'Certificate', Cert, not_encrypted} <- PemEntries], + ok. + add_certs(Cert, Ref, CertsDb) -> try ErlCert = public_key:pkix_decode_cert(Cert, otp), TBSCertificate = ErlCert#'OTPCertificate'.tbsCertificate, diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index cde13069b5..e5a6181a88 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2012. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -372,8 +372,7 @@ hello(#server_hello{cipher_suite = CipherSuite, ssl_options = SslOptions} = State0) -> case ssl_handshake:hello(Hello, SslOptions, ConnectionStates0, Renegotiation) of #alert{} = Alert -> - handle_own_alert(Alert, ReqVersion, hello, State0), - {stop, {shutdown, own_alert}, State0}; + handle_own_alert(Alert, ReqVersion, hello, State0); {Version, NewId, ConnectionStates, NextProtocol} -> {KeyAlgorithm, _, _, _} = ssl_cipher:suite_definition(CipherSuite), @@ -1135,7 +1134,7 @@ init_certificates(#ssl_options{cacerts = CaCerts, {ok, _, _, _, _, _} = ssl_manager:connection_init(Certs, Role) catch Error:Reason -> - handle_file_error(?LINE, Error, Reason, CACertFile, ecacertfile, + handle_file_error(?LINE, Error, Reason, CACertFile, {ecacertfile, Reason}, erlang:get_stacktrace()) end, init_certificates(Cert, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, CertFile, Role). @@ -1157,7 +1156,7 @@ init_certificates(undefined, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHan {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, OwnCert} catch Error:Reason -> - handle_file_error(?LINE, Error, Reason, CertFile, ecertfile, + handle_file_error(?LINE, Error, Reason, CertFile, {ecertfile, Reason}, erlang:get_stacktrace()) end; init_certificates(Cert, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, _, _) -> @@ -1176,7 +1175,7 @@ init_private_key(DbHandle, undefined, KeyFile, Password, _) -> private_key(public_key:pem_entry_decode(PemEntry, Password)) catch Error:Reason -> - handle_file_error(?LINE, Error, Reason, KeyFile, ekeyfile, + handle_file_error(?LINE, Error, Reason, KeyFile, {ekeyfile, Reason}, erlang:get_stacktrace()) end; @@ -1234,7 +1233,7 @@ init_diffie_hellman(DbHandle,_, DHParamFile, server) -> catch Error:Reason -> handle_file_error(?LINE, Error, Reason, - DHParamFile, edhfile, erlang:get_stacktrace()) + DHParamFile, {edhfile, Reason}, erlang:get_stacktrace()) end. sync_send_all_state_event(FsmPid, Event) -> @@ -1628,78 +1627,49 @@ save_verify_data(client, #finished{verify_data = Data}, ConnectionStates, abbrev save_verify_data(server, #finished{verify_data = Data}, ConnectionStates, abbreviated) -> ssl_record:set_server_verify_data(current_write, Data, ConnectionStates). -handle_server_key(#server_key_exchange{params = - #server_dh_params{dh_p = P, - dh_g = G, - dh_y = ServerPublicDhKey}, - signed_params = <<>>}, - #state{key_algorithm = dh_anon} = State) -> - dh_master_secret(P, G, ServerPublicDhKey, undefined, State); - -handle_server_key( - #server_key_exchange{params = - #server_dh_params{dh_p = P, - dh_g = G, - dh_y = ServerPublicDhKey}, - signed_params = Signed, - hashsign = HashSign}, - #state{negotiated_version = Version, - public_key_info = PubKeyInfo, - connection_states = ConnectionStates} = State) -> - - PLen = size(P), - GLen = size(G), - YLen = size(ServerPublicDhKey), - HashAlgo = connection_hash_algo(HashSign, State), +handle_server_key(#server_key_exchange{exchange_keys = Keys}, + #state{key_algorithm = KeyAlg, + negotiated_version = Version} = State) -> + Params = ssl_handshake:decode_server_key(Keys, KeyAlg, Version), + HashSign = connection_hashsign(Params#server_key_params.hashsign, State), + case HashSign of + {_, anon} -> + server_master_secret(Params#server_key_params.params, State); + _ -> + verify_server_key(Params, HashSign, State) + end. - ConnectionState = +verify_server_key(#server_key_params{params = Params, + params_bin = EncParams, + signature = Signature}, + HashSign = {HashAlgo, _}, + #state{negotiated_version = Version, + public_key_info = PubKeyInfo, + connection_states = ConnectionStates} = State) -> + ConnectionState = ssl_record:pending_connection_state(ConnectionStates, read), SecParams = ConnectionState#connection_state.security_parameters, #security_parameters{client_random = ClientRandom, server_random = ServerRandom} = SecParams, Hash = ssl_handshake:server_key_exchange_hash(HashAlgo, - <<ClientRandom/binary, - ServerRandom/binary, - ?UINT16(PLen), P/binary, - ?UINT16(GLen), G/binary, - ?UINT16(YLen), - ServerPublicDhKey/binary>>), - - case verify_dh_params(Version, Signed, Hash, HashAlgo, PubKeyInfo) of + <<ClientRandom/binary, + ServerRandom/binary, + EncParams/binary>>), + case ssl_handshake:verify_signature(Version, Hash, HashSign, Signature, PubKeyInfo) of true -> - dh_master_secret(P, G, ServerPublicDhKey, undefined, State); + server_master_secret(Params, State); false -> ?ALERT_REC(?FATAL, ?DECRYPT_ERROR) end. -verify_dh_params({3, Minor}, Signed, Hashes, HashAlgo, {?rsaEncryption, PubKey, _PubKeyParams}) - when Minor >= 3 -> - public_key:verify({digest, Hashes}, HashAlgo, Signed, PubKey); -verify_dh_params(_Version, Signed, Hashes, _HashAlgo, {?rsaEncryption, PubKey, _PubKeyParams}) -> - case public_key:decrypt_public(Signed, PubKey, - [{rsa_pad, rsa_pkcs1_padding}]) of - Hashes -> - true; - _ -> - false - end; -verify_dh_params(_Version, Signed, Hash, HashAlgo, {?'id-dsa', PublicKey, PublicKeyParams}) -> - public_key:verify({digest, Hash}, HashAlgo, Signed, {PublicKey, PublicKeyParams}). - -dh_master_secret(Prime, Base, PublicDhKey, undefined, State) -> - PMpint = mpint_binary(Prime), - GMpint = mpint_binary(Base), - Keys = {_, PrivateDhKey} = - crypto:dh_generate_key([PMpint,GMpint]), - dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, State#state{diffie_hellman_keys = Keys}); +server_master_secret(#server_dh_params{dh_p = P, dh_g = G, dh_y = ServerPublicDhKey}, + State) -> + dh_master_secret(P, G, ServerPublicDhKey, undefined, State). -dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, - #state{session = Session, - negotiated_version = Version, role = Role, - connection_states = ConnectionStates0} = State) -> - PremasterSecret = - crypto:dh_compute_key(mpint_binary(PublicDhKey), PrivateDhKey, - [PMpint, GMpint]), +master_from_premaster_secret(PremasterSecret, + #state{session = Session, + negotiated_version = Version, role = Role, + connection_states = ConnectionStates0} = State) -> case ssl_handshake:master_secret(Version, PremasterSecret, ConnectionStates0, Role) of {MasterSecret, ConnectionStates} -> @@ -1711,6 +1681,19 @@ dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, Alert end. +dh_master_secret(Prime, Base, PublicDhKey, undefined, State) -> + PMpint = mpint_binary(Prime), + GMpint = mpint_binary(Base), + Keys = {_, PrivateDhKey} = + crypto:dh_generate_key([PMpint,GMpint]), + dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, State#state{diffie_hellman_keys = Keys}); + +dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, State) -> + PremasterSecret = + crypto:dh_compute_key(mpint_binary(PublicDhKey), PrivateDhKey, + [PMpint, GMpint]), + master_from_premaster_secret(PremasterSecret, State). + cipher_role(client, Data, Session, #state{connection_states = ConnectionStates0} = State) -> ConnectionStates = ssl_record:set_server_verify_data(current_both, Data, ConnectionStates0), next_state_connection(cipher, ack_connection(State#state{session = Session, @@ -2485,10 +2468,10 @@ get_pending_connection_state_prf(CStates, Direction) -> CS = ssl_record:pending_connection_state(CStates, Direction), CS#connection_state.security_parameters#security_parameters.prf_algorithm. -connection_hash_algo({HashAlgo, _}, _State) -> - HashAlgo; -connection_hash_algo(_, #state{hashsign_algorithm = {HashAlgo, _}}) -> - HashAlgo. +connection_hashsign(HashSign = {_, _}, _State) -> + HashSign; +connection_hashsign(_, #state{hashsign_algorithm = HashSign}) -> + HashSign. %% RFC 5246, Sect. 7.4.1.4.1. Signature Algorithms %% If the client does not send the signature_algorithms extension, the @@ -2526,12 +2509,13 @@ default_hashsign(_Version, KeyExchange) start_or_recv_cancel_timer(infinity, _RecvFrom) -> undefined; start_or_recv_cancel_timer(Timeout, RecvFrom) -> - erlang:send_after(Timeout, self(), {cancel_start_or_recv, RecvFrom}). + erlang:send_after(Timeout, self(), {cancel_start_or_recv, RecvFrom}). cancel_timer(undefined) -> ok; cancel_timer(Timer) -> - erlang:cancel_timer(Timer). + erlang:cancel_timer(Timer), + ok. handle_unrecv_data(StateName, #state{socket = Socket, transport_cb = Transport} = State) -> inet:setopts(Socket, [{active, false}]), diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl index db21dac942..1929370991 100644 --- a/lib/ssl/src/ssl_handshake.erl +++ b/lib/ssl/src/ssl_handshake.erl @@ -32,10 +32,10 @@ -export([master_secret/4, client_hello/8, server_hello/5, hello/4, hello_request/0, certify/7, certificate/4, - client_certificate_verify/6, certificate_verify/6, + client_certificate_verify/6, certificate_verify/6, verify_signature/5, certificate_request/3, key_exchange/3, server_key_exchange_hash/2, finished/5, verify_connection/6, get_tls_handshake/3, - decode_client_key/3, server_hello_done/0, + decode_client_key/3, decode_server_key/3, server_hello_done/0, encode_handshake/2, init_handshake_history/0, update_handshake_history/2, decrypt_premaster_secret/2, prf/5, next_protocol/1]). @@ -320,25 +320,36 @@ client_certificate_verify(OwnCert, MasterSecret, Version, %% %% Description: Checks that the certificate_verify message is valid. %%-------------------------------------------------------------------- -certificate_verify(Signature, {?'rsaEncryption', PublicKey, _}, Version, - {HashAlgo, _SignAlgo}, MasterSecret, {_, Handshake}) -> - Hashes = calc_certificate_verify(Version, HashAlgo, MasterSecret, Handshake), - case certificate_verify_rsa(Hashes, HashAlgo, Signature, PublicKey, Version) of +certificate_verify(Signature, PublicKeyInfo, Version, + HashSign = {HashAlgo, _}, MasterSecret, {_, Handshake}) -> + Hash = calc_certificate_verify(Version, HashAlgo, MasterSecret, Handshake), + case verify_signature(Version, Hash, HashSign, Signature, PublicKeyInfo) of true -> valid; _ -> - ?ALERT_REC(?FATAL, ?BAD_CERTIFICATE) - end; -certificate_verify(Signature, {?'id-dsa', PublicKey, PublicKeyParams}, Version, - {HashAlgo, _SignAlgo}, MasterSecret, {_, Handshake}) -> - Hashes = calc_certificate_verify(Version, HashAlgo, MasterSecret, Handshake), - case public_key:verify({digest, Hashes}, sha, Signature, {PublicKey, PublicKeyParams}) of - true -> - valid; - false -> ?ALERT_REC(?FATAL, ?BAD_CERTIFICATE) end. +%%-------------------------------------------------------------------- +-spec verify_signature(tls_version(), binary(), {term(), term()}, binary(), + public_key_info()) -> true | false. +%% +%% Description: Checks that a public_key signature is valid. +%%-------------------------------------------------------------------- +verify_signature(_Version, _Hash, {_HashAlgo, anon}, _Signature, _) -> + true; +verify_signature({3, Minor}, Hash, {HashAlgo, rsa}, Signature, {?rsaEncryption, PubKey, _PubKeyParams}) + when Minor >= 3 -> + public_key:verify({digest, Hash}, HashAlgo, Signature, PubKey); +verify_signature(_Version, Hash, _HashAlgo, Signature, {?rsaEncryption, PubKey, _PubKeyParams}) -> + case public_key:decrypt_public(Signature, PubKey, + [{rsa_pad, rsa_pkcs1_padding}]) of + Hash -> true; + _ -> false + end; +verify_signature(_Version, Hash, {HashAlgo, dsa}, Signature, {?'id-dsa', PublicKey, PublicKeyParams}) -> + public_key:verify({digest, Hash}, HashAlgo, Signature, {PublicKey, PublicKeyParams}). + %%-------------------------------------------------------------------- -spec certificate_request(#connection_states{}, db_handle(), certdb_ref()) -> @@ -382,31 +393,33 @@ key_exchange(client, _Version, {dh, <<?UINT32(Len), PublicKey:Len/binary>>}) -> key_exchange(server, Version, {dh, {<<?UINT32(Len), PublicKey:Len/binary>>, _}, #'DHParameter'{prime = P, base = G}, - {HashAlgo, SignAlgo}, ClientRandom, ServerRandom, PrivateKey}) -> + HashSign, ClientRandom, ServerRandom, PrivateKey}) -> <<?UINT32(_), PBin/binary>> = crypto:mpint(P), <<?UINT32(_), GBin/binary>> = crypto:mpint(G), - PLen = byte_size(PBin), - GLen = byte_size(GBin), - YLen = byte_size(PublicKey), ServerDHParams = #server_dh_params{dh_p = PBin, dh_g = GBin, dh_y = PublicKey}, + enc_server_key_exchange(Version, ServerDHParams, HashSign, + ClientRandom, ServerRandom, PrivateKey). +enc_server_key_exchange(Version, Params, {HashAlgo, SignAlgo}, + ClientRandom, ServerRandom, PrivateKey) -> + EncParams = enc_server_key(Params), case HashAlgo of null -> - #server_key_exchange{params = ServerDHParams, - signed_params = <<>>, - hashsign = {null, anon}}; + #server_key_params{params = Params, + params_bin = EncParams, + hashsign = {null, anon}, + signature = <<>>}; _ -> Hash = server_key_exchange_hash(HashAlgo, <<ClientRandom/binary, - ServerRandom/binary, - ?UINT16(PLen), PBin/binary, - ?UINT16(GLen), GBin/binary, - ?UINT16(YLen), PublicKey/binary>>), - Signed = digitally_signed(Version, Hash, HashAlgo, PrivateKey), - #server_key_exchange{params = ServerDHParams, - signed_params = Signed, - hashsign = {HashAlgo, SignAlgo}} + ServerRandom/binary, + EncParams/binary>>), + Signature = digitally_signed(Version, Hash, HashAlgo, PrivateKey), + #server_key_params{params = Params, + params_bin = EncParams, + hashsign = {HashAlgo, SignAlgo}, + signature = Signature} end. %%-------------------------------------------------------------------- @@ -523,6 +536,15 @@ decode_client_key(ClientKey, Type, Version) -> dec_client_key(ClientKey, key_exchange_alg(Type), Version). %%-------------------------------------------------------------------- +-spec decode_server_key(binary(), key_algo(), tls_version()) -> + #server_key_params{}. +%% +%% Description: Decode server_key data and return appropriate type +%%-------------------------------------------------------------------- +decode_server_key(ServerKey, Type, Version) -> + dec_server_key(ServerKey, key_exchange_alg(Type), Version). + +%%-------------------------------------------------------------------- -spec init_handshake_history() -> tls_handshake_history(). %% @@ -975,31 +997,8 @@ dec_hs(_Version, ?SERVER_HELLO, <<?BYTE(Major), ?BYTE(Minor), Random:32/binary, next_protocol_negotiation = NextProtocolNegotiation}; dec_hs(_Version, ?CERTIFICATE, <<?UINT24(ACLen), ASN1Certs:ACLen/binary>>) -> #certificate{asn1_certificates = certs_to_list(ASN1Certs)}; - -dec_hs(_Version, ?SERVER_KEY_EXCHANGE, <<?UINT16(PLen), P:PLen/binary, - ?UINT16(GLen), G:GLen/binary, - ?UINT16(YLen), Y:YLen/binary, - ?UINT16(0)>>) -> %% May happen if key_algorithm is dh_anon - #server_key_exchange{params = #server_dh_params{dh_p = P,dh_g = G, - dh_y = Y}, - signed_params = <<>>, hashsign = {null, anon}}; -dec_hs({Major, Minor}, ?SERVER_KEY_EXCHANGE, <<?UINT16(PLen), P:PLen/binary, - ?UINT16(GLen), G:GLen/binary, - ?UINT16(YLen), Y:YLen/binary, - ?BYTE(HashAlgo), ?BYTE(SignAlgo), - ?UINT16(Len), Sig:Len/binary>>) - when Major == 3, Minor >= 3 -> - #server_key_exchange{params = #server_dh_params{dh_p = P,dh_g = G, - dh_y = Y}, - signed_params = Sig, - hashsign = {ssl_cipher:hash_algorithm(HashAlgo), ssl_cipher:sign_algorithm(SignAlgo)}}; -dec_hs(_Version, ?SERVER_KEY_EXCHANGE, <<?UINT16(PLen), P:PLen/binary, - ?UINT16(GLen), G:GLen/binary, - ?UINT16(YLen), Y:YLen/binary, - ?UINT16(Len), Sig:Len/binary>>) -> - #server_key_exchange{params = #server_dh_params{dh_p = P,dh_g = G, - dh_y = Y}, - signed_params = Sig, hashsign = undefined}; +dec_hs(_Version, ?SERVER_KEY_EXCHANGE, Keys) -> + #server_key_exchange{exchange_keys = Keys}; dec_hs({Major, Minor}, ?CERTIFICATE_REQUEST, <<?BYTE(CertTypesLen), CertTypes:CertTypesLen/binary, ?UINT16(HashSignsLen), HashSigns:HashSignsLen/binary, @@ -1039,6 +1038,42 @@ dec_client_key(<<?UINT16(DH_YLen), DH_Y:DH_YLen/binary>>, ?KEY_EXCHANGE_DIFFIE_HELLMAN, _) -> #client_diffie_hellman_public{dh_public = DH_Y}. +dec_ske_params(Len, Keys, Version) -> + <<Params:Len/bytes, Signature/binary>> = Keys, + dec_ske_signature(Params, Signature, Version). + +dec_ske_signature(Params, <<?BYTE(HashAlgo), ?BYTE(SignAlgo), + ?UINT16(0)>>, {Major, Minor}) + when Major == 3, Minor >= 3 -> + HashSign = {ssl_cipher:hash_algorithm(HashAlgo), ssl_cipher:sign_algorithm(SignAlgo)}, + {Params, HashSign, <<>>}; +dec_ske_signature(Params, <<?BYTE(HashAlgo), ?BYTE(SignAlgo), + ?UINT16(Len), Signature:Len/binary>>, {Major, Minor}) + when Major == 3, Minor >= 3 -> + HashSign = {ssl_cipher:hash_algorithm(HashAlgo), ssl_cipher:sign_algorithm(SignAlgo)}, + {Params, HashSign, Signature}; +dec_ske_signature(Params, <<>>, _) -> + {Params, {null, anon}, <<>>}; +dec_ske_signature(Params, <<?UINT16(0)>>, _) -> + {Params, {null, anon}, <<>>}; +dec_ske_signature(Params, <<?UINT16(Len), Signature:Len/binary>>, _) -> + {Params, undefined, Signature}; +dec_ske_signature(_, _, _) -> + throw(?ALERT_REC(?FATAL, ?HANDSHAKE_FAILURE)). + +dec_server_key(<<?UINT16(PLen), P:PLen/binary, + ?UINT16(GLen), G:GLen/binary, + ?UINT16(YLen), Y:YLen/binary, _/binary>> = KeyStruct, + ?KEY_EXCHANGE_DIFFIE_HELLMAN, Version) -> + Params = #server_dh_params{dh_p = P, dh_g = G, dh_y = Y}, + {BinMsg, HashSign, Signature} = dec_ske_params(PLen + GLen + YLen + 6, KeyStruct, Version), + #server_key_params{params = Params, + params_bin = BinMsg, + hashsign = HashSign, + signature = Signature}; +dec_server_key(_, _, _) -> + throw(?ALERT_REC(?FATAL, ?HANDSHAKE_FAILURE)). + dec_hello_extensions(<<>>) -> []; dec_hello_extensions(<<?UINT16(ExtLen), Extensions:ExtLen/binary>>) -> @@ -1156,18 +1191,12 @@ enc_hs(#certificate{asn1_certificates = ASN1CertList}, _Version) -> ASN1Certs = certs_from_list(ASN1CertList), ACLen = erlang:iolist_size(ASN1Certs), {?CERTIFICATE, <<?UINT24(ACLen), ASN1Certs:ACLen/binary>>}; -enc_hs(#server_key_exchange{params = #server_dh_params{ - dh_p = P, dh_g = G, dh_y = Y}, - signed_params = SignedParams, hashsign = HashSign}, Version) -> - PLen = byte_size(P), - GLen = byte_size(G), - YLen = byte_size(Y), - Signature = enc_sign(HashSign, SignedParams, Version), - {?SERVER_KEY_EXCHANGE, <<?UINT16(PLen), P/binary, - ?UINT16(GLen), G/binary, - ?UINT16(YLen), Y/binary, - Signature/binary>> - }; +enc_hs(#server_key_exchange{exchange_keys = Keys}, _Version) -> + {?SERVER_KEY_EXCHANGE, Keys}; +enc_hs(#server_key_params{params_bin = Keys, hashsign = HashSign, + signature = Signature}, Version) -> + EncSign = enc_sign(HashSign, Signature, Version), + {?SERVER_KEY_EXCHANGE, <<Keys/binary, EncSign/binary>>}; enc_hs(#certificate_request{certificate_types = CertTypes, hashsign_algorithms = #hash_sign_algos{hash_sign_algos = HashSignAlgos}, certificate_authorities = CertAuths}, @@ -1211,6 +1240,14 @@ enc_cke(#client_diffie_hellman_public{dh_public = DHPublic}, _) -> Len = byte_size(DHPublic), <<?UINT16(Len), DHPublic/binary>>. +enc_server_key(#server_dh_params{dh_p = P, dh_g = G, dh_y = Y}) -> + PLen = byte_size(P), + GLen = byte_size(G), + YLen = byte_size(Y), + <<?UINT16(PLen), P/binary, ?UINT16(GLen), G/binary, ?UINT16(YLen), Y/binary>>. + +enc_sign({_, anon}, _Sign, _Version) -> + <<>>; enc_sign({HashAlg, SignAlg}, Signature, _Version = {Major, Minor}) when Major == 3, Minor >= 3-> SignLen = byte_size(Signature), @@ -1328,8 +1365,8 @@ certificate_authorities_from_db(CertDbHandle, CertDbRef) -> digitally_signed({3, Minor}, Hash, HashAlgo, Key) when Minor >= 3 -> public_key:sign({digest, Hash}, HashAlgo, Key); -digitally_signed(_Version, Hash, _HashAlgo, #'DSAPrivateKey'{} = Key) -> - public_key:sign({digest, Hash}, sha, Key); +digitally_signed(_Version, Hash, HashAlgo, #'DSAPrivateKey'{} = Key) -> + public_key:sign({digest, Hash}, HashAlgo, Key); digitally_signed(_Version, Hash, _HashAlgo, #'RSAPrivateKey'{} = Key) -> public_key:encrypt_private(Hash, Key, [{rsa_pad, rsa_pkcs1_padding}]). @@ -1378,19 +1415,6 @@ apply_user_fun(Fun, OtpCert, ExtensionOrError, UserState0, SslState) -> {unknown, {SslState, UserState}} end. -certificate_verify_rsa(Hashes, sha, Signature, PublicKey, {Major, Minor}) - when Major == 3, Minor >= 3 -> - public_key:verify({digest, Hashes}, sha, Signature, PublicKey); -certificate_verify_rsa(Hashes, HashAlgo, Signature, PublicKey, {Major, Minor}) - when Major == 3, Minor >= 3 -> - public_key:verify({digest, Hashes}, HashAlgo, Signature, PublicKey); -certificate_verify_rsa(Hashes, _HashAlgo, Signature, PublicKey, _Version) -> - case public_key:decrypt_public(Signature, PublicKey, - [{rsa_pad, rsa_pkcs1_padding}]) of - Hashes -> true; - _ -> false - end. - -define(TLSEXT_SIGALG_RSA(MD), {MD, rsa}). -define(TLSEXT_SIGALG_DSA(MD), {MD, dsa}). diff --git a/lib/ssl/src/ssl_handshake.hrl b/lib/ssl/src/ssl_handshake.hrl index 9af6511d68..2414d5b666 100644 --- a/lib/ssl/src/ssl_handshake.hrl +++ b/lib/ssl/src/ssl_handshake.hrl @@ -141,9 +141,14 @@ }). -record(server_key_exchange, { + exchange_keys + }). + +-record(server_key_params, { params, %% #server_rsa_params{} | #server_dh_params{} - signed_params, %% #signature{} - hashsign %% term(atom(), atom()) + params_bin, + hashsign, %% term(atom(), atom()) + signature %% #signature{} }). %% enum { anonymous, rsa, dsa } SignatureAlgorithm; diff --git a/lib/ssl/src/ssl_manager.erl b/lib/ssl/src/ssl_manager.erl index 13689ce7d8..aa9da65bb8 100644 --- a/lib/ssl/src/ssl_manager.erl +++ b/lib/ssl/src/ssl_manager.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2012. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -142,8 +142,15 @@ lookup_trusted_cert(DbHandle, Ref, SerialNumber, Issuer) -> new_session_id(Port) -> call({new_session_id, Port}). +%%-------------------------------------------------------------------- +-spec clean_cert_db(reference(), binary()) -> ok. +%% +%% Description: Send clean request of cert db to ssl_manager process should +%% be called by ssl-connection processes. +%%-------------------------------------------------------------------- clean_cert_db(Ref, File) -> - erlang:send_after(?CLEAN_CERT_DB, self(), {clean_cert_db, Ref, File}). + erlang:send_after(?CLEAN_CERT_DB, get(ssl_manager), {clean_cert_db, Ref, File}), + ok. %%-------------------------------------------------------------------- -spec register_session(inet:port_number(), #session{}) -> ok. @@ -320,19 +327,12 @@ handle_info(clear_pem_cache, #state{certificate_db = [_,_,PemChace]} = State) -> handle_info({clean_cert_db, Ref, File}, #state{certificate_db = [CertDb,RefDb, PemCache]} = State) -> - case ssl_certificate_db:ref_count(Ref, RefDb, 0) of - 0 -> - MD5 = crypto:md5(File), - case ssl_certificate_db:lookup_cached_pem(PemCache, MD5) of - [{Content, Ref}] -> - ssl_certificate_db:insert(MD5, Content, PemCache); - undefined -> - ok - end, - ssl_certificate_db:remove(Ref, RefDb), - ssl_certificate_db:remove_trusted_certs(Ref, CertDb); + + case ssl_certificate_db:lookup(Ref, RefDb) of + undefined -> %% Alredy cleaned + ok; _ -> - ok + clean_cert_db(Ref, CertDb, RefDb, PemCache, File) end, {noreply, State}; @@ -345,7 +345,7 @@ handle_info(_Info, State) -> {noreply, State}. %%-------------------------------------------------------------------- --spec terminate(reason(), #state{}) -> term(). +-spec terminate(reason(), #state{}) -> ok. %% %% Description: This function is called by a gen_server when it is about to %% terminate. It should be the opposite of Module:init/1 and do any necessary @@ -464,3 +464,19 @@ new_id(Port, Tries, Cache, CacheCb) -> _ -> new_id(Port, Tries - 1, Cache, CacheCb) end. + +clean_cert_db(Ref, CertDb, RefDb, PemCache, File) -> + case ssl_certificate_db:ref_count(Ref, RefDb, 0) of + 0 -> + MD5 = crypto:md5(File), + case ssl_certificate_db:lookup_cached_pem(PemCache, MD5) of + [{Content, Ref}] -> + ssl_certificate_db:insert(MD5, Content, PemCache); + _ -> + ok + end, + ssl_certificate_db:remove(Ref, RefDb), + ssl_certificate_db:remove_trusted_certs(Ref, CertDb); + _ -> + ok + end. diff --git a/lib/ssl/src/ssl_tls_dist_proxy.erl b/lib/ssl/src/ssl_tls_dist_proxy.erl index a8476b104f..a22af6b960 100644 --- a/lib/ssl/src/ssl_tls_dist_proxy.erl +++ b/lib/ssl/src/ssl_tls_dist_proxy.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011-2012. All Rights Reserved. +%% Copyright Ericsson AB 2011-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -89,7 +89,7 @@ handle_call({connect, Ip, Port}, {From, _}, State) -> ok -> flush_old_controller(From, Socket), {reply, Res, State} - end; + end; {Pid, Error} -> {reply, Error, State} end; @@ -115,13 +115,13 @@ code_change(_OldVsn, St, _Extra) -> get_tcp_address(Socket) -> case inet:sockname(Socket) of {ok, Address} -> - {ok, Host} = inet:gethostname(), + {ok, Host} = inet:gethostname(), NetAddress = #net_address{ - address = Address, - host = Host, - protocol = proxy, - family = inet - }, + address = Address, + host = Host, + protocol = proxy, + family = inet + }, {ok, NetAddress}; {error, _} = Error -> Error end. @@ -129,17 +129,17 @@ get_tcp_address(Socket) -> accept_loop(Proxy, erts = Type, Listen, Extra) -> process_flag(priority, max), case gen_tcp:accept(Listen) of - {ok, Socket} -> - Extra ! {accept,self(),Socket,inet,proxy}, - receive - {_Kernel, controller, Pid} -> - ok = gen_tcp:controlling_process(Socket, Pid), - flush_old_controller(Pid, Socket), - Pid ! {self(), controller}; - {_Kernel, unsupported_protocol} -> - exit(unsupported_protocol) - end; - Error -> + {ok, Socket} -> + Extra ! {accept,self(),Socket,inet,proxy}, + receive + {_Kernel, controller, Pid} -> + ok = gen_tcp:controlling_process(Socket, Pid), + flush_old_controller(Pid, Socket), + Pid ! {self(), controller}; + {_Kernel, unsupported_protocol} -> + exit(unsupported_protocol) + end; + Error -> exit(Error) end, accept_loop(Proxy, Type, Listen, Extra); @@ -242,7 +242,7 @@ loop_conn(World, Erts) -> ssl:close(World); {ssl_closed, World} -> gen_tcp:close(Erts) - end. + end. get_ssl_options(Type) -> case init:get_argument(ssl_dist_opt) of @@ -255,7 +255,7 @@ get_ssl_options(Type) -> ssl_options(_,[]) -> []; ssl_options(server, ["client_" ++ _, _Value |T]) -> - ssl_options(server,T); + ssl_options(server,T); ssl_options(client, ["server_" ++ _, _Value|T]) -> ssl_options(client,T); ssl_options(server, ["server_certfile", Value|T]) -> @@ -265,7 +265,7 @@ ssl_options(client, ["client_certfile", Value | T]) -> ssl_options(server, ["server_cacertfile", Value|T]) -> [{cacertfile, Value} | ssl_options(server,T)]; ssl_options(client, ["client_cacertfile", Value|T]) -> - [{cacertfile, Value} | ssl_options(client,T)]; + [{cacertfile, Value} | ssl_options(client,T)]; ssl_options(server, ["server_keyfile", Value|T]) -> [{keyfile, Value} | ssl_options(server,T)]; ssl_options(client, ["client_keyfile", Value|T]) -> @@ -277,7 +277,7 @@ ssl_options(client, ["client_password", Value|T]) -> ssl_options(server, ["server_verify", Value|T]) -> [{verify, atomize(Value)} | ssl_options(server,T)]; ssl_options(client, ["client_verify", Value|T]) -> - [{verify, atomize(Value)} | ssl_options(client,T)]; + [{verify, atomize(Value)} | ssl_options(client,T)]; ssl_options(server, ["server_reuse_sessions", Value|T]) -> [{reuse_sessions, atomize(Value)} | ssl_options(server,T)]; ssl_options(client, ["client_reuse_sessions", Value|T]) -> @@ -295,11 +295,11 @@ ssl_options(server, ["server_hibernate_after", Value|T]) -> ssl_options(client, ["client_hibernate_after", Value|T]) -> [{hibernate_after, list_to_integer(Value)} | ssl_options(client,T)]; ssl_options(server, ["server_ciphers", Value|T]) -> - [{ciphers, Value} | ssl_options(server,T)]; + [{ciphers, Value} | ssl_options(server,T)]; ssl_options(client, ["client_ciphers", Value|T]) -> [{ciphers, Value} | ssl_options(client,T)]; ssl_options(server, ["server_dhfile", Value|T]) -> - [{dhfile, Value} | ssl_options(server,T)]; + [{dhfile, Value} | ssl_options(server,T)]; ssl_options(server, ["server_fail_if_no_peer_cert", Value|T]) -> [{fail_if_no_peer_cert, atomize(Value)} | ssl_options(server,T)]; ssl_options(_,_) -> diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl index f206276b69..7067cd861d 100644 --- a/lib/ssl/test/ssl_basic_SUITE.erl +++ b/lib/ssl/test/ssl_basic_SUITE.erl @@ -84,7 +84,8 @@ basic_tests() -> alerts, send_close, connect_twice, - connect_dist + connect_dist, + clear_pem_cache ]. options_tests() -> @@ -536,6 +537,33 @@ connect_dist(Config) when is_list(Config) -> ssl_test_lib:close(Client). %%-------------------------------------------------------------------- + +clear_pem_cache() -> + [{doc,"Test that internal reference tabel is cleaned properly even when " + " the PEM cache is cleared" }]. +clear_pem_cache(Config) when is_list(Config) -> + {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)), + [_, _,_, _, Prop] = StatusInfo, + State = ssl_test_lib:state(Prop), + [_,FilRefDb, _] = element(5, State), + {Server, Client} = basic_verify_test_no_close(Config), + 2 = ets:info(FilRefDb, size), + ssl:clear_pem_cache(), + _ = sys:get_status(whereis(ssl_manager)), + {Server1, Client1} = basic_verify_test_no_close(Config), + 4 = ets:info(FilRefDb, size), + ssl_test_lib:close(Server), + ssl_test_lib:close(Client), + ct:sleep(5000), + _ = sys:get_status(whereis(ssl_manager)), + 2 = ets:info(FilRefDb, size), + ssl_test_lib:close(Server1), + ssl_test_lib:close(Client1), + ct:sleep(5000), + _ = sys:get_status(whereis(ssl_manager)), + 0 = ets:info(FilRefDb, size). + +%%-------------------------------------------------------------------- peername() -> [{doc,"Test API function peername/1"}]. @@ -1567,8 +1595,8 @@ default_reject_anonymous(Config) when is_list(Config) -> [{ciphers,[Cipher]} | ClientOpts]}]), - ssl_test_lib:check_result(Server, {error, "insufficient security"}, - Client, {error, "insufficient security"}). + ssl_test_lib:check_result(Server, {error, {essl, "insufficient security"}}, + Client, {error, {essl, "insufficient security"}}). %%-------------------------------------------------------------------- reuse_session() -> @@ -2641,6 +2669,26 @@ tcp_send_recv_result(Socket) -> {ok,"Hello world"} = gen_tcp:recv(Socket, 11), ok. +basic_verify_test_no_close(Config) -> + ClientOpts = ?config(client_verification_opts, Config), + ServerOpts = ?config(server_verification_opts, Config), + + {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), + + Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, + {from, self()}, + {mfa, {ssl_test_lib, send_recv_result_active, []}}, + {options, ServerOpts}]), + Port = ssl_test_lib:inet_port(Server), + Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, + {host, Hostname}, + {from, self()}, + {mfa, {ssl_test_lib, send_recv_result_active, []}}, + {options, ClientOpts}]), + + ssl_test_lib:check_result(Server, ok, Client, ok), + {Server, Client}. + basic_test(Config) -> ClientOpts = ?config(client_opts, Config), ServerOpts = ?config(server_opts, Config), @@ -2659,7 +2707,6 @@ basic_test(Config) -> {options, ClientOpts}]), ssl_test_lib:check_result(Server, ok, Client, ok), - ssl_test_lib:close(Server), ssl_test_lib:close(Client). diff --git a/lib/ssl/test/ssl_certificate_verify_SUITE.erl b/lib/ssl/test/ssl_certificate_verify_SUITE.erl index 9677d98c1b..86e1d47be7 100644 --- a/lib/ssl/test/ssl_certificate_verify_SUITE.erl +++ b/lib/ssl/test/ssl_certificate_verify_SUITE.erl @@ -252,8 +252,8 @@ server_require_peer_cert_fail(Config) when is_list(Config) -> {from, self()}, {options, [{active, false} | BadClientOpts]}]), - ssl_test_lib:check_result(Server, {error, esslaccept}, - Client, {error, esslconnect}). + ssl_test_lib:check_result(Server, {error, {essl, "handshake failure"}}, + Client, {error, {essl, "handshake failure"}}). %%-------------------------------------------------------------------- @@ -293,14 +293,14 @@ verify_fun_always_run_client(Config) when is_list(Config) -> [{verify, verify_peer}, {verify_fun, FunAndState} | ClientOpts]}]), - %% Server error may be esslaccept or closed depending on timing + %% Server error may be {essl,"handshake failure"} or closed depending on timing %% this is not a bug it is a circumstance of how tcp works! receive {Server, ServerError} -> ct:print("Server Error ~p~n", [ServerError]) end, - ssl_test_lib:check_result(Client, {error, esslconnect}). + ssl_test_lib:check_result(Client, {error, {essl, "handshake failure"}}). %%-------------------------------------------------------------------- verify_fun_always_run_server() -> @@ -342,14 +342,14 @@ verify_fun_always_run_server(Config) when is_list(Config) -> [{verify, verify_peer} | ClientOpts]}]), - %% Client error may be esslconnect or closed depending on timing + %% Client error may be {essl, "handshake failure" } or closed depending on timing %% this is not a bug it is a circumstance of how tcp works! receive {Client, ClientError} -> ct:print("Client Error ~p~n", [ClientError]) end, - ssl_test_lib:check_result(Server, {error, esslaccept}). + ssl_test_lib:check_result(Server, {error, {essl, "handshake failure"}}). %%-------------------------------------------------------------------- @@ -380,7 +380,7 @@ client_verify_none_passive(Config) when is_list(Config) -> ssl_test_lib:close(Client). %%-------------------------------------------------------------------- cert_expired() -> - [{doc,"Test server with invalid signature"}]. + [{doc,"Test server with expired certificate"}]. cert_expired(Config) when is_list(Config) -> ClientOpts = ?config(client_verification_opts, Config), @@ -432,8 +432,8 @@ cert_expired(Config) when is_list(Config) -> {from, self()}, {options, [{verify, verify_peer} | ClientOpts]}]), - ssl_test_lib:check_result(Server, {error, "certificate expired"}, - Client, {error, "certificate expired"}). + ssl_test_lib:check_result(Server, {error, {essl, "certificate expired"}}, + Client, {error, {essl, "certificate expired"}}). two_digits_str(N) when N < 10 -> lists:flatten(io_lib:format("0~p", [N])); @@ -679,7 +679,7 @@ delete_authority_key_extension([Head | Rest], Acc) -> %%-------------------------------------------------------------------- invalid_signature_server() -> - [{doc,"Test server with invalid signature"}]. + [{doc,"Test client with invalid signature"}]. invalid_signature_server(Config) when is_list(Config) -> ClientOpts = ?config(client_verification_opts, Config), @@ -710,8 +710,8 @@ invalid_signature_server(Config) when is_list(Config) -> {from, self()}, {options, [{verify, verify_peer} | ClientOpts]}]), - tcp_delivery_workaround(Server, {error, "bad certificate"}, - Client, {error,"bad certificate"}). + tcp_delivery_workaround(Server, {error, {essl, "bad certificate"}}, + Client, {error, {essl, "bad certificate"}}). %%-------------------------------------------------------------------- @@ -747,8 +747,8 @@ invalid_signature_client(Config) when is_list(Config) -> {from, self()}, {options, NewClientOpts}]), - tcp_delivery_workaround(Server, {error, "bad certificate"}, - Client, {error,"bad certificate"}). + tcp_delivery_workaround(Server, {error, {essl, "bad certificate"}}, + Client, {error, {essl, "bad certificate"}}). %%-------------------------------------------------------------------- @@ -829,8 +829,8 @@ unknown_server_ca_fail(Config) when is_list(Config) -> {verify_fun, FunAndState} | ClientOpts]}]), - ssl_test_lib:check_result(Server, {error,"unknown ca"}, - Client, {error, "unknown ca"}). + ssl_test_lib:check_result(Server, {error, {essl, "unknown ca"}}, + Client, {error, {essl, "unknown ca"}}). %%-------------------------------------------------------------------- unknown_server_ca_accept_verify_none() -> @@ -947,10 +947,6 @@ tcp_delivery_workaround(Server, ServerMsg, Client, ClientMsg) -> {Client, {error,closed}} -> server_msg(Server, ServerMsg); {Server, {error,closed}} -> - client_msg(Client, ClientMsg); - {Client, {error, esslconnect}} -> - server_msg(Server, ServerMsg); - {Server, {error, esslaccept}} -> client_msg(Client, ClientMsg) end. @@ -961,8 +957,8 @@ client_msg(Client, ClientMsg) -> {Client, {error,closed}} -> ct:print("client got close"), ok; - {Client, {error, esslconnect}} -> - ct:print("client got econnaborted"), + {Client, {error, Reason}} -> + ct:print("client got econnaborted: ~p", [Reason]), ok; Unexpected -> ct:fail(Unexpected) @@ -974,8 +970,8 @@ server_msg(Server, ServerMsg) -> {Server, {error,closed}} -> ct:print("server got close"), ok; - {Server, {error, esslaccept}} -> - ct:print("server got econnaborted"), + {Server, {error, Reason}} -> + ct:print("server got econnaborted: ~p", [Reason]), ok; Unexpected -> ct:fail(Unexpected) diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl index e6f71183c7..8d96a70a6e 100644 --- a/lib/ssl/test/ssl_test_lib.erl +++ b/lib/ssl/test/ssl_test_lib.erl @@ -115,7 +115,7 @@ connect(#sslsocket{} = ListenSocket, Opts) -> end; connect(ListenSocket, Opts) -> Node = proplists:get_value(node, Opts), - ct:format("gen_tcp:accept(~p)~n", [ListenSocket]), + ct:print("gen_tcp:accept(~p)~n", [ListenSocket]), {ok, AcceptSocket} = rpc:call(Node, gen_tcp, accept, [ListenSocket]), AcceptSocket. @@ -203,6 +203,67 @@ close(Pid) -> ct:print("Pid: ~p down due to:~p ~n", [Pid, Reason]) end. + +check_result(Server, {error, SReason} = ServerMsg, Client, {error, closed} = ClientMsg) -> + receive + {Server, {error, {SReason, _}}} -> + receive + {Client, ClientMsg} -> + ok; + Unexpected -> + Reason = {{expected, {Client, ClientMsg}}, + {got, Unexpected}}, + ct:fail(Reason) + end; + {Client, ClientMsg} -> + receive + {Server, {error, {SReason, _}}} -> + ok; + Unexpected -> + Reason = {{expected, {Server,{error, {SReason, 'term()'}}}, + {got, Unexpected}}}, + ct:fail(Reason) + end; + {Port, {data,Debug}} when is_port(Port) -> + io:format("openssl ~s~n",[Debug]), + check_result(Server, ServerMsg, Client, ClientMsg); + + Unexpected -> + Reason = {{expected, {Client, ClientMsg}}, + {expected, {Server, {error, {SReason, 'term()'}}}, {got, Unexpected}}}, + ct:fail(Reason) + end; + +check_result(Server, {error, closed} = ServerMsg, Client, {error, CReson} = ClientMsg) -> + receive + {Server, ServerMsg} -> + receive + {Client, {error, {CReson, _}}} -> + ok; + Unexpected -> + Reason = {{expected, {Client, {error, {CReson, 'term()'}}}, + {got, Unexpected}}}, + ct:fail(Reason) + end; + {Client, {error, {CReson, _}}} -> + receive + {Server, ServerMsg} -> + ok; + Unexpected -> + Reason = {{expected, {Server, ServerMsg}}, + {got, Unexpected}}, + ct:fail(Reason) + end; + {Port, {data,Debug}} when is_port(Port) -> + io:format("openssl ~s~n",[Debug]), + check_result(Server, ServerMsg, Client, ClientMsg); + + Unexpected -> + Reason = {{expected, {Client, {error, {CReson, 'term()'}}}, + {expected, {Server, ServerMsg}}, {got, Unexpected}}}, + ct:fail(Reason) + end; + check_result(Server, ServerMsg, Client, ClientMsg) -> receive {Server, ServerMsg} -> @@ -233,6 +294,22 @@ check_result(Server, ServerMsg, Client, ClientMsg) -> ct:fail(Reason) end. +check_result(Pid, {error, Reason} = Err) when Reason == ecertfile; + Reason == ecacertfile; + Reason == ekeyfile; + Reason == edhfile -> + receive + {Pid, {error, {Reason, Str}}} when is_list(Str) -> + ok; + {Port, {data,Debug}} when is_port(Port) -> + io:format("openssl ~s~n",[Debug]), + check_result(Pid, Err); + Unexpected -> + Reason = {{expected, {Pid, {error, {Reason, "'appropriate error string'"}}}}, + {got, Unexpected}}, + ct:fail(Reason) + end; + check_result(Pid, Msg) -> receive {Pid, Msg} -> @@ -542,7 +619,7 @@ run_server_error(Opts) -> {ok, ListenSocket} -> Pid ! {listen, up}, send_selected_port(Pid, Port, ListenSocket), - ct:format("~p:accept(~p)~n", [Transport, ListenSocket]), + ct:print("~p:accept(~p)~n", [Transport, ListenSocket]), case rpc:call(Node, Transport, accept, [ListenSocket]) of {error, _} = Error -> Pid ! {self(), Error} diff --git a/lib/ssl/test/ssl_to_openssl_SUITE.erl b/lib/ssl/test/ssl_to_openssl_SUITE.erl index d5e7d515fd..7c0c00bf36 100644 --- a/lib/ssl/test/ssl_to_openssl_SUITE.erl +++ b/lib/ssl/test/ssl_to_openssl_SUITE.erl @@ -902,7 +902,7 @@ ssl2_erlang_server_openssl_client(Config) when is_list(Config) -> ok end, - ssl_test_lib:check_result(Server, {error,"protocol version"}), + ssl_test_lib:check_result(Server, {error, {essl, "protocol version"}}), process_flag(trap_exit, false). %%-------------------------------------------------------------------- diff --git a/lib/ssl/vsn.mk b/lib/ssl/vsn.mk index adfb29e639..cb73e86ede 100644 --- a/lib/ssl/vsn.mk +++ b/lib/ssl/vsn.mk @@ -1 +1 @@ -SSL_VSN = 5.1.2 +SSL_VSN = 5.2 diff --git a/lib/stdlib/examples/erl_id_trans.erl b/lib/stdlib/examples/erl_id_trans.erl index 34c6ecc394..51def8c8e1 100644 --- a/lib/stdlib/examples/erl_id_trans.erl +++ b/lib/stdlib/examples/erl_id_trans.erl @@ -153,7 +153,6 @@ pattern({record,Line,Name,Pfs0}) -> pattern({record_index,Line,Name,Field0}) -> Field1 = pattern(Field0), {record_index,Line,Name,Field1}; -%% record_field occurs in query expressions pattern({record_field,Line,Rec0,Name,Field0}) -> Rec1 = expr(Rec0), Field1 = expr(Field0), @@ -431,10 +430,6 @@ expr({'catch',Line,E0}) -> %% No new variables added. E1 = expr(E0), {'catch',Line,E1}; -expr({'query', Line, E0}) -> - %% lc expression - E = expr(E0), - {'query', Line, E}; expr({match,Line,P0,E0}) -> E1 = expr(E0), P1 = pattern(P0), diff --git a/lib/stdlib/src/Makefile b/lib/stdlib/src/Makefile index 575a5cbe4a..30bff3bf96 100644 --- a/lib/stdlib/src/Makefile +++ b/lib/stdlib/src/Makefile @@ -149,7 +149,7 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) ifeq ($(NATIVE_LIBS_ENABLED),yes) ERL_COMPILE_FLAGS += +native endif -ERL_COMPILE_FLAGS += -I../include -I../../kernel/include +ERL_COMPILE_FLAGS += -I../include -I../../kernel/include -Werror # ---------------------------------------------------- # Targets @@ -175,24 +175,25 @@ primary_bootstrap_compiler: \ $(BOOTSTRAP_COMPILER)/ebin/otp_internal.beam $(BOOTSTRAP_COMPILER)/ebin/erl_parse.beam: erl_parse.yrl - $(ERLC) -o $(BOOTSTRAP_COMPILER)/egen erl_parse.yrl - $(ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $(BOOTSTRAP_COMPILER)/egen/erl_parse.erl + $(gen_verbose) + $(V_at)$(ERLC) -o $(BOOTSTRAP_COMPILER)/egen erl_parse.yrl + $(V_at)$(ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $(BOOTSTRAP_COMPILER)/egen/erl_parse.erl $(BOOTSTRAP_TOP)/lib/stdlib/egen/erl_parse.erl: erl_parse.yrl - $(ERLC) $(YRL_FLAGS) -o$(BOOTSTRAP_TOP)/lib/stdlib/egen erl_parse.yrl + $(yecc_verbose)$(ERLC) $(YRL_FLAGS) -o$(BOOTSTRAP_TOP)/lib/stdlib/egen erl_parse.yrl $(BOOTSTRAP_COMPILER)/ebin/%.beam: %.erl - $(ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $< + $(V_ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $< # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/stdlib/src/base64.erl b/lib/stdlib/src/base64.erl index 5d800e87b8..0068d82d43 100644 --- a/lib/stdlib/src/base64.erl +++ b/lib/stdlib/src/base64.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2011. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -28,7 +28,7 @@ %% of (some) functions of this module. %%------------------------------------------------------------------------- --type ascii_string() :: [1..255]. +-type ascii_string() :: [1..127]. %%------------------------------------------------------------------------- %% encode_to_string(ASCII) -> Base64String diff --git a/lib/stdlib/src/edlin.erl b/lib/stdlib/src/edlin.erl index 1164ee49eb..3192879f09 100644 --- a/lib/stdlib/src/edlin.erl +++ b/lib/stdlib/src/edlin.erl @@ -22,10 +22,10 @@ %% A simple Emacs-like line editor. %% About Latin-1 characters: see the beginning of erl_scan.erl. --export([init/0,start/1,edit_line/2,prefix_arg/1]). +-export([init/0,start/1,start/2,edit_line/2,prefix_arg/1]). -export([erase_line/1,erase_inp/1,redraw_line/1]). -export([length_before/1,length_after/1,prompt/1]). --export([current_line/1]). +-export([current_line/1, current_chars/1]). %%-export([expand/1]). -export([edit_line1/2]). @@ -54,7 +54,12 @@ init() -> %% {undefined,Char,Rest,Cont,Requests} start(Pbs) -> - {more_chars,{line,Pbs,{[],[]},none},[{put_chars,unicode,Pbs}]}. + start(Pbs, none). + +%% Only two modes used: 'none' and 'search'. Other modes can be +%% handled inline through specific character handling. +start(Pbs, Mode) -> + {more_chars,{line,Pbs,{[],[]},Mode},[{put_chars,unicode,Pbs}]}. edit_line(Cs, {line,P,L,{blink,N}}) -> edit(Cs, P, L, none, [{move_rel,N}]); @@ -76,6 +81,10 @@ edit([C|Cs], P, {Bef,Aft}, Prefix, Rs0) -> edit(Cs, P, {Bef,Aft}, meta, Rs0); meta_left_sq_bracket -> edit(Cs, P, {Bef,Aft}, meta_left_sq_bracket, Rs0); + search_meta -> + edit(Cs, P, {Bef,Aft}, search_meta, Rs0); + search_meta_left_sq_bracket -> + edit(Cs, P, {Bef,Aft}, search_meta_left_sq_bracket, Rs0); ctlx -> edit(Cs, P, {Bef,Aft}, ctlx, Rs0); new_line -> @@ -115,6 +124,8 @@ edit([C|Cs], P, {Bef,Aft}, Prefix, Rs0) -> case do_op(Op, Bef, Aft, Rs0) of {blink,N,Line,Rs} -> edit(Cs, P, Line, {blink,N}, Rs); + {Line, Rs, Mode} -> % allow custom modes from do_op + edit(Cs, P, Line, Mode, Rs); {Line,Rs} -> edit(Cs, P, Line, none, Rs) end @@ -168,9 +179,15 @@ key_map($\^], none) -> auto_blink; key_map($\^X, none) -> ctlx; key_map($\^Y, none) -> yank; key_map($\e, none) -> meta; -key_map($), Prefix) when Prefix =/= meta -> {blink,$),$(}; -key_map($}, Prefix) when Prefix =/= meta -> {blink,$},${}; -key_map($], Prefix) when Prefix =/= meta -> {blink,$],$[}; +key_map($), Prefix) when Prefix =/= meta, + Prefix =/= search, + Prefix =/= search_meta -> {blink,$),$(}; +key_map($}, Prefix) when Prefix =/= meta, + Prefix =/= search, + Prefix =/= search_meta -> {blink,$},${}; +key_map($], Prefix) when Prefix =/= meta, + Prefix =/= search, + Prefix =/= search_meta -> {blink,$],$[}; key_map($B, meta) -> backward_word; key_map($D, meta) -> kill_word; key_map($F, meta) -> forward_word; @@ -188,6 +205,32 @@ key_map($D, meta_left_sq_bracket) -> backward_char; key_map($C, meta_left_sq_bracket) -> forward_char; key_map(C, none) when C >= $\s -> {insert,C}; +%% for search, we need smarter line handling and so +%% we cheat a bit on the dispatching, and allow to +%% return a mode. +key_map($\^H, search) -> {search, backward_delete_char}; +key_map($\177, search) -> {search, backward_delete_char}; +key_map($\^R, search) -> {search, skip_up}; +key_map($\^S, search) -> {search, skip_down}; +key_map($\n, search) -> {search, search_found}; +key_map($\r, search) -> {search, search_found}; +key_map($\^A, search) -> {search, search_quit}; +key_map($\^B, search) -> {search, search_quit}; +key_map($\^D, search) -> {search, search_quit}; +key_map($\^E, search) -> {search, search_quit}; +key_map($\^F, search) -> {search, search_quit}; +key_map($\t, search) -> {search, search_quit}; +key_map($\^L, search) -> {search, search_quit}; +key_map($\^T, search) -> {search, search_quit}; +key_map($\^U, search) -> {search, search_quit}; +key_map($\^], search) -> {search, search_quit}; +key_map($\^X, search) -> {search, search_quit}; +key_map($\^Y, search) -> {search, search_quit}; +key_map($\e, search) -> search_meta; +key_map($[, search_meta) -> search_meta_left_sq_bracket; +key_map(_, search_meta) -> {search, search_quit}; +key_map(_C, search_meta_left_sq_bracket) -> {search, search_quit}; +key_map(C, search) -> {insert_search,C}; key_map(C, _) -> {undefined,C}. %% do_op(Action, Before, After, Requests) @@ -196,6 +239,57 @@ do_op({insert,C}, Bef, [], Rs) -> {{[C|Bef],[]},[{put_chars, unicode,[C]}|Rs]}; do_op({insert,C}, Bef, Aft, Rs) -> {{[C|Bef],Aft},[{insert_chars, unicode, [C]}|Rs]}; +%% Search mode prompt always looks like (search)`$TERMS': $RESULT. +%% the {insert_search, _} handlings allow to share this implementation +%% correctly with group.erl. This module provides $TERMS, and group.erl +%% is in charge of providing $RESULT. +%% This require a bit of trickery. Because search disables moving around +%% on the line (left/right arrow keys and other shortcuts that just exit +%% search mode), we can use the Bef and Aft variables to hold each +%% part of the line. Bef takes charge of "(search)`$TERMS" and Aft +%% takes charge of "': $RESULT". +do_op({insert_search, C}, Bef, [], Rs) -> + Aft="': ", + {{[C|Bef],Aft}, + [{insert_chars, unicode, [C]++Aft}, {delete_chars,-3} | Rs], + search}; +do_op({insert_search, C}, Bef, Aft, Rs) -> + Offset= length(Aft), + NAft = "': ", + {{[C|Bef],NAft}, + [{insert_chars, unicode, [C]++NAft}, {delete_chars,-Offset} | Rs], + search}; +do_op({search, backward_delete_char}, [_|Bef], Aft, Rs) -> + Offset= length(Aft)+1, + NAft = "': ", + {{Bef,NAft}, + [{insert_chars, unicode, NAft}, {delete_chars,-Offset}|Rs], + search}; +do_op({search, backward_delete_char}, [], _Aft, Rs) -> + Aft="': ", + {{[],Aft}, Rs, search}; +do_op({search, skip_up}, Bef, Aft, Rs) -> + Offset= length(Aft), + NAft = "': ", + {{[$\^R|Bef],NAft}, % we insert ^R as a flag to whoever called us + [{insert_chars, unicode, NAft}, {delete_chars,-Offset}|Rs], + search}; +do_op({search, skip_down}, Bef, Aft, Rs) -> + Offset= length(Aft), + NAft = "': ", + {{[$\^S|Bef],NAft}, % we insert ^S as a flag to whoever called us + [{insert_chars, unicode, NAft}, {delete_chars,-Offset}|Rs], + search}; +do_op({search, search_found}, _Bef, Aft, Rs) -> + "': "++NAft = Aft, + {{[],NAft}, + [{put_chars, unicode, "\n"}, {move_rel,-length(Aft)} | Rs], + search_found}; +do_op({search, search_quit}, _Bef, Aft, Rs) -> + "': "++NAft = Aft, + {{[],NAft}, + [{put_chars, unicode, "\n"}, {move_rel,-length(Aft)} | Rs], + search_quit}; %% do blink after $$ do_op({blink,C,M}, Bef=[$$,$$|_], Aft, Rs) -> N = over_paren(Bef, C, M), @@ -453,6 +547,9 @@ prompt({line,Pbs,_,_}) -> current_line({line,_,{Bef, Aft},_}) -> reverse(Bef, Aft ++ "\n"). +current_chars({line,_,{Bef,Aft},_}) -> + reverse(Bef, Aft). + %% %% expand(CurrentBefore) -> %% %% {yes,Expansion} | no %% %% Try to expand the word before as either a module name or a function diff --git a/lib/stdlib/src/epp.erl b/lib/stdlib/src/epp.erl index a0f7660ecf..ebabf8d700 100644 --- a/lib/stdlib/src/epp.erl +++ b/lib/stdlib/src/epp.erl @@ -1224,8 +1224,6 @@ macro_arg([{'try',Lr}|Toks], E, Arg) -> macro_arg(Toks, ['end'|E], [{'try',Lr}|Arg]); macro_arg([{'cond',Lr}|Toks], E, Arg) -> macro_arg(Toks, ['end'|E], [{'cond',Lr}|Arg]); -macro_arg([{'query',Lr}|Toks], E, Arg) -> - macro_arg(Toks, ['end'|E], [{'query',Lr}|Arg]); macro_arg([{Rb,Lrb}|Toks], [Rb|E], Arg) -> %Found matching close macro_arg(Toks, E, [{Rb,Lrb}|Arg]); macro_arg([T|Toks], E, Arg) -> diff --git a/lib/stdlib/src/erl_internal.erl b/lib/stdlib/src/erl_internal.erl index 3063881890..bf2fffbd97 100644 --- a/lib/stdlib/src/erl_internal.erl +++ b/lib/stdlib/src/erl_internal.erl @@ -278,6 +278,7 @@ bif(exit, 1) -> true; bif(exit, 2) -> true; bif(float, 1) -> true; bif(float_to_list, 1) -> true; +bif(float_to_list, 2) -> true; bif(garbage_collect, 0) -> true; bif(garbage_collect, 1) -> true; bif(get, 0) -> true; diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index d24e2fff44..642d972582 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -94,7 +94,6 @@ value_option(Flag, Default, On, OnVal, Off, OffVal, Opts) -> %% the other function collections contain {Function, Arity}. -record(lint, {state=start :: 'start' | 'attribute' | 'function', module=[], %Module - extends=[], %Extends behaviour=[], %Behaviour exports=gb_sets:empty() :: gb_set(), %Exports imports=[], %Imports @@ -112,7 +111,6 @@ value_option(Flag, Default, On, OnVal, Off, OffVal, Opts) -> enabled_warnings=[], %All enabled warnings (ordset). errors=[], %Current errors warnings=[], %Current warnings - global_vt=[], %The global VarTable file = "" :: string(), %From last file attribute recdef_top=false :: boolean(), %true in record initialisation %outside any fun or lc @@ -142,10 +140,8 @@ format_error({bad_module_name, M}) -> io_lib:format("bad module name '~s'", [M]); format_error(redefine_module) -> "redefining module"; -format_error(redefine_extends) -> - "redefining extends attribute"; -format_error(extends_self) -> - "cannot extend from self"; +format_error(pmod_unsupported) -> + "parameterized modules are no longer supported"; %% format_error({redefine_mod_import, M, P}) -> %% io_lib:format("module '~s' already imported from package '~s'", [M, P]); @@ -166,10 +162,6 @@ format_error({bad_inline,{F,A}}) -> io_lib:format("inlined function ~w/~w undefined", [F,A]); format_error({invalid_deprecated,D}) -> io_lib:format("badly formed deprecated attribute ~w", [D]); -format_error(invalid_extends) -> - "badly formed extends attribute"; -format_error(define_instance) -> - "defining instance function not allowed in abstract module"; format_error({bad_deprecated,{F,A}}) -> io_lib:format("deprecated function ~w/~w undefined or not exported", [F,A]); format_error({bad_nowarn_unused_function,{F,A}}) -> @@ -622,8 +614,6 @@ forms(Forms0, St0) -> pre_scan([{function,_L,new,_A,_Cs} | Fs], St) -> pre_scan(Fs, St#lint{new=true}); -pre_scan([{attribute,_L,extends,M} | Fs], St) when is_atom(M) -> - pre_scan(Fs, St#lint{extends=true}); pre_scan([{attribute,L,compile,C} | Fs], St) -> case is_warn_enabled(export_all, St) andalso member(export_all, lists:flatten([C])) of @@ -678,41 +668,15 @@ form(Form, #lint{state=State}=St) -> %% start_state(Form, State) -> State' -start_state({attribute,_,module,{M,Ps}}, St0) -> - St1 = St0#lint{module=M}, - Arity = length(Ps), - Ps1 = if is_atom(St1#lint.extends) -> - ['BASE', 'THIS' | Ps]; - true -> - ['THIS' | Ps] - end, - Vt = orddict:from_list([{V, {bound, used, []}} || V <- Ps1]), - St2 = add_instance(Arity, St1), - St3 = ensure_new(Arity, St2), - St3#lint{state=attribute, extends=[], global_vt=Vt}; +start_state({attribute,Line,module,{_,_}}=Form, St0) -> + St1 = add_error(Line, pmod_unsupported, St0), + attribute_state(Form, St1#lint{state=attribute}); start_state({attribute,_,module,M}, St0) -> St1 = St0#lint{module=M}, - St1#lint{state=attribute, extends=[]}; + St1#lint{state=attribute}; start_state(Form, St) -> St1 = add_error(element(2, Form), undefined_module, St), - attribute_state(Form, St1#lint{state=attribute, extends=[]}). - -ensure_new(Arity, St) -> - case St#lint.new of - true -> - St; - false -> - add_func(new, Arity, St) - end. - -add_instance(Arity, St) -> - A = Arity + (if is_atom(St#lint.extends) -> 1; true -> 0 end), - add_func(instance, A, St). - -add_func(Name, Arity, St) -> - F = {Name, Arity}, - St#lint{exports = gb_sets:add_element(F, St#lint.exports), - defined = gb_sets:add_element(F, St#lint.defined)}. + attribute_state(Form, St1#lint{state=attribute}). %% attribute_state(Form, State) -> %% State' @@ -721,15 +685,6 @@ attribute_state({attribute,_L,module,_M}, #lint{module=[]}=St) -> St; attribute_state({attribute,L,module,_M}, St) -> add_error(L, redefine_module, St); -attribute_state({attribute,L,extends,M}, #lint{module=M}=St) when is_atom(M) -> - add_error(L, extends_self, St); -attribute_state({attribute,_L,extends,M}, #lint{extends=[]}=St) - when is_atom(M) -> - St#lint{extends=M}; -attribute_state({attribute,L,extends,M}, St) when is_atom(M) -> - add_error(L, redefine_extends, St); -attribute_state({attribute,L,extends,_M}, St) -> - add_error(L, invalid_extends, St); attribute_state({attribute,L,export,Es}, St) -> export(L, Es, St); attribute_state({attribute,L,export_type,Es}, St) -> @@ -1322,11 +1277,9 @@ call_function(Line, F, A, #lint{usage=Usage0,called=Cd,func=Func}=St) -> %% function(Line, Name, Arity, Clauses, State) -> State. -function(Line, instance, _Arity, _Cs, St) when St#lint.global_vt =/= [] -> - add_error(Line, define_instance, St); function(Line, Name, Arity, Cs, St0) -> St1 = define_function(Line, Name, Arity, St0#lint{func={Name,Arity}}), - clauses(Cs, St1#lint.global_vt, St1). + clauses(Cs, St1). -spec define_function(line(), atom(), arity(), lint_state()) -> lint_state(). @@ -1349,15 +1302,16 @@ function_check_max_args(Line, Arity, St) when Arity > ?MAX_ARGUMENTS -> add_error(Line, {too_many_arguments,Arity}, St); function_check_max_args(_, _, St) -> St. -%% clauses([Clause], VarTable, State) -> {VarTable, State}. +%% clauses([Clause], State) -> {VarTable, State}. -clauses(Cs, Vt, St) -> +clauses(Cs, St) -> foldl(fun (C, St0) -> - {_,St1} = clause(C, Vt, St0), + {_,St1} = clause(C, St0), St1 end, St, Cs). -clause({clause,_Line,H,G,B}, Vt0, St0) -> +clause({clause,_Line,H,G,B}, St0) -> + Vt0 = [], {Hvt,Binvt,St1} = head(H, Vt0, St0), %% Cannot ignore BinVt since "binsize variables" may have been used. Vt1 = vtupdate(Hvt, vtupdate(Binvt, Vt0)), @@ -2205,9 +2159,7 @@ expr({op,_Line,_Op,L,R}, Vt, St) -> expr_list([L,R], Vt, St); %They see the same variables %% The following are not allowed to occur anywhere! expr({remote,Line,_M,_F}, _Vt, St) -> - {[],add_error(Line, illegal_expr, St)}; -expr({'query',Line,_Q}, _Vt, St) -> - {[],add_error(Line, {mnemosyne,"query"}, St)}. + {[],add_error(Line, illegal_expr, St)}. %% expr_list(Expressions, Variables, State) -> %% {UsedVarTable,State} diff --git a/lib/stdlib/src/erl_parse.yrl b/lib/stdlib/src/erl_parse.yrl index 002abc11e8..8316462989 100644 --- a/lib/stdlib/src/erl_parse.yrl +++ b/lib/stdlib/src/erl_parse.yrl @@ -36,7 +36,7 @@ tuple record_expr record_tuple record_field record_fields if_expr if_clause if_clauses case_expr cr_clause cr_clauses receive_expr fun_expr fun_clause fun_clauses atom_or_var integer_or_var -try_expr try_catch try_clause try_clauses query_expr +try_expr try_catch try_clause try_clauses function_call argument_list exprs guard atomic strings @@ -54,7 +54,7 @@ char integer float atom string var '(' ')' ',' '->' ':-' '{' '}' '[' ']' '|' '||' '<-' ';' ':' '#' '.' 'after' 'begin' 'case' 'try' 'catch' 'end' 'fun' 'if' 'of' 'receive' 'when' -'andalso' 'orelse' 'query' +'andalso' 'orelse' 'bnot' 'not' '*' '/' 'div' 'rem' 'band' 'and' '+' '-' 'bor' 'bxor' 'bsl' 'bsr' 'or' 'xor' @@ -272,7 +272,6 @@ expr_max -> case_expr : '$1'. expr_max -> receive_expr : '$1'. expr_max -> fun_expr : '$1'. expr_max -> try_expr : '$1'. -expr_max -> query_expr : '$1'. list -> '[' ']' : {nil,?line('$1')}. @@ -432,9 +431,6 @@ try_clause -> var ':' expr clause_guard clause_body : L = ?line('$1'), {clause,L,[{tuple,L,['$1','$3',{var,L,'_'}]}],'$4','$5'}. -query_expr -> 'query' list_comprehension 'end' : - {'query',?line('$1'),'$2'}. - argument_list -> '(' ')' : {[],?line('$1')}. argument_list -> '(' exprs ')' : {'$2',?line('$1')}. diff --git a/lib/stdlib/src/erl_pp.erl b/lib/stdlib/src/erl_pp.erl index 0383ce6839..0e1156075a 100644 --- a/lib/stdlib/src/erl_pp.erl +++ b/lib/stdlib/src/erl_pp.erl @@ -510,8 +510,6 @@ lexpr({'fun',_,{clauses,Cs}}, _Prec, Opts) -> lexpr({'fun',_,{clauses,Cs},Extra}, _Prec, Opts) -> {force_nl,fun_info(Extra), {list,[{first,'fun',fun_clauses(Cs, Opts)},'end']}}; -lexpr({'query',_,Lc}, _Prec, Opts) -> - {list,[{step,leaf("query"),lexpr(Lc, 0, Opts)},'end']}; lexpr({call,_,{remote,_,{atom,_,M},{atom,_,F}=N}=Name,Args}, Prec, Opts) -> case erl_internal:bif(M, F, length(Args)) of true -> diff --git a/lib/stdlib/src/erl_scan.erl b/lib/stdlib/src/erl_scan.erl index e5bb287c45..bc0eaf015d 100644 --- a/lib/stdlib/src/erl_scan.erl +++ b/lib/stdlib/src/erl_scan.erl @@ -1404,7 +1404,6 @@ reserved_word('fun') -> true; reserved_word('if') -> true; reserved_word('let') -> true; reserved_word('of') -> true; -reserved_word('query') -> true; reserved_word('receive') -> true; reserved_word('when') -> true; reserved_word('bnot') -> true; diff --git a/lib/stdlib/src/otp_internal.erl b/lib/stdlib/src/otp_internal.erl index 400380a36d..9257953071 100644 --- a/lib/stdlib/src/otp_internal.erl +++ b/lib/stdlib/src/otp_internal.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2012. All Rights Reserved. +%% Copyright Ericsson AB 1999-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -359,6 +359,45 @@ obsolete_1(ssh, sign_data, 2) -> "and public_key:sign/3 instead"}; obsolete_1(ssh, verify_data, 3) -> {deprecated,"deprecated (will be removed in R16A); use public_key:ssh_decode/1, and public_key:verify/4 instead"}; + +%% Added in R16 +obsolete_1(wxCalendarCtrl, enableYearChange, _) -> %% wx bug documented? + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxDC, computeScaleAndOrigin, 1) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxClientDC, new, 0) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxPaintDC, new, 0) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxWindowDC, new, 0) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxGraphicsContext, createLinearGradientBrush, 7) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxGraphicsContext, createRadialGradientBrush, 8) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxGraphicsRenderer, createLinearGradientBrush, 7) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxGraphicsRenderer, createRadialGradientBrush, 8) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxGridCellEditor, endEdit, 4) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxGridCellEditor, paintBackground, 3) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxIdleEvent, canSend, 1) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxMDIClientWindow, new, 1) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxMDIClientWindow, new, 2) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxPostScriptDC, getResolution, 0) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxPostScriptDC, setResolution, 1) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxCursor, new, 3) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; +obsolete_1(wxCursor, new, 4) -> + {deprecated,"deprecated function not available in wxWidgets-2.9 and later"}; + obsolete_1(_, _, _) -> no. diff --git a/lib/stdlib/src/queue.erl b/lib/stdlib/src/queue.erl index afe917b151..bc1bd06534 100644 --- a/lib/stdlib/src/queue.erl +++ b/lib/stdlib/src/queue.erl @@ -472,22 +472,24 @@ init(Q) -> drop_r(Q). -compile({inline, [{r2f,1},{f2r,1}]}). -%% Move all but two from R to F, if there are at least three +%% Move half of elements from R to F, if there are at least three r2f([]) -> {[],[]}; r2f([_]=R) -> {[],R}; r2f([X,Y]) -> {[X],[Y]}; -r2f([X,Y|R]) -> - {[X,Y],lists:reverse(R, [])}. +r2f(List) -> + {FF,RR} = lists:split(length(List) div 2 + 1, List), + {FF,lists:reverse(RR, [])}. -%% Move all but two from F to R, if there are enough +%% Move half of elements from F to R, if there are enough f2r([]) -> {[],[]}; f2r([_]=F) -> {F,[]}; f2r([X,Y]) -> {[Y],[X]}; -f2r([X,Y|F]) -> - {lists:reverse(F, []),[X,Y]}. +f2r(List) -> + {FF,RR} = lists:split(length(List) div 2 + 1, List), + {lists:reverse(RR, []),FF}. diff --git a/lib/stdlib/test/Makefile b/lib/stdlib/test/Makefile index 29b8e28d3a..6aa09d7bd0 100644 --- a/lib/stdlib/test/Makefile +++ b/lib/stdlib/test/Makefile @@ -23,7 +23,6 @@ MODULES= \ dummy_via \ edlin_expand_SUITE \ epp_SUITE \ - erl_eval_helper \ erl_eval_SUITE \ erl_expand_records_SUITE \ erl_internal_SUITE \ diff --git a/lib/stdlib/test/erl_eval_SUITE.erl b/lib/stdlib/test/erl_eval_SUITE.erl index 47792d1052..04d49770cb 100644 --- a/lib/stdlib/test/erl_eval_SUITE.erl +++ b/lib/stdlib/test/erl_eval_SUITE.erl @@ -1160,24 +1160,6 @@ do_funs(LFH, EFH) -> concat(["begin F = fun(F, N) -> [", M, ":count_down(F,N) || X <-[1]] end, F(F,2) end."]), [[[0]]], ['F'], LFH, EFH), - - %% Tests for a bug found by the Dialyzer - used to crash. - case test_server:is_native(erl_eval) of - true -> - %% Parameterized modules are not supported by HiPE. - ok; - false -> - check(fun() -> Pmod = erl_eval_helper:new(42), Pmod:add(5) end, - "begin Pmod = erl_eval_helper:new(42), Pmod:add(5) end.", - 47, - ['Pmod'], LFH, EFH), - check(fun() -> Pmod = erl_eval_helper:new(42), - B = Pmod:add(7), B end, - "begin Pmod = erl_eval_helper:new(42), " - "B = Pmod:add(7), B end.", - 49, - ['B','Pmod'], LFH, EFH) - end, ok. count_down(F, N) when N > 0 -> diff --git a/lib/stdlib/test/erl_eval_helper.erl b/lib/stdlib/test/erl_eval_helper.erl deleted file mode 100644 index 6863b40108..0000000000 --- a/lib/stdlib/test/erl_eval_helper.erl +++ /dev/null @@ -1,28 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2010. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% - --module(erl_eval_helper, [Base]). - --export([add/1]). - -add(Arg) -> - Base+Arg. - - - diff --git a/lib/stdlib/test/erl_expand_records_SUITE.erl b/lib/stdlib/test/erl_expand_records_SUITE.erl index e51c05a22c..94b4397a9c 100644 --- a/lib/stdlib/test/erl_expand_records_SUITE.erl +++ b/lib/stdlib/test/erl_expand_records_SUITE.erl @@ -35,7 +35,7 @@ init_per_group/2,end_per_group/2, init_per_testcase/2, end_per_testcase/2]). --export([abstract_module/1, attributes/1, expr/1, guard/1, +-export([attributes/1, expr/1, guard/1, init/1, pattern/1, strict/1, update/1, otp_5915/1, otp_7931/1, otp_5990/1, otp_7078/1, otp_7101/1]). @@ -55,7 +55,7 @@ end_per_testcase(_Case, _Config) -> suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [abstract_module, attributes, expr, guard, init, + [attributes, expr, guard, init, pattern, strict, update, {group, tickets}]. groups() -> @@ -75,33 +75,6 @@ end_per_group(_GroupName, Config) -> Config. -abstract_module(doc) -> - "Compile an abstract module."; -abstract_module(suite) -> []; -abstract_module(Config) when is_list(Config) -> - %% erl_expand_records does not handle abstract modules. But anyway... - File = filename("param.erl", Config), - Beam = filename("param.beam", Config), - Test = <<"-module(param, [A, B]). - - -export([args/1]). - - args(C) -> - X = local(C), - Z = new(A, B), - {X, Z}. - - local(C) -> - module_info(C). - ">>, - - ?line ok = file:write_file(File, Test), - ?line {ok, param} = compile:file(File, [{outdir,?privdir}]), - - ?line ok = file:delete(File), - ?line ok = file:delete(Beam), - ok. - attributes(doc) -> "Import module and functions."; attributes(suite) -> []; @@ -196,7 +169,7 @@ guard(suite) -> []; guard(Config) when is_list(Config) -> File = filename("guard.erl", Config), Beam = filename("guard.beam", Config), - Test = <<"-module(guard, [A, B]). + Test = <<"-module(guard). -export([t/1]). diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl index 774229fca9..564f27a512 100644 --- a/lib/stdlib/test/erl_lint_SUITE.erl +++ b/lib/stdlib/test/erl_lint_SUITE.erl @@ -2187,27 +2187,9 @@ otp_5878(Config) when is_list(Config) -> ?line [] = run(Config, Ts), Abstr = <<"-module(lint_test, [A, B]). - - -export([args/1]). - - -record(r, {a = A, b = THIS}). % A and THIS are unbound - - %% param:args(compile,param:new(1,2)). - - args(C) -> - X = local(C), - Z = new(A, B), - F = fun(THIS) -> {x, A} end, % THIS unused and shadowed - {X, Z, THIS, F, #r{}}. - - local(C) -> - module_info(C). ">>, - ?line {error,[{5,erl_lint,{unbound_var,'A'}}, - {5,erl_lint,{unbound_var,'THIS'}}], - [{12,erl_lint,{unused_var,'THIS'}}, - {12,erl_lint,{shadowed_var,'THIS','fun'}}]} - = run_test2(Config, Abstr, [warn_unused_record]), + {errors,[{1,erl_lint,pmod_unsupported}],[]} = + run_test2(Config, Abstr, [warn_unused_record]), QLC1 = <<"-module(lint_test). -include_lib(\"stdlib/include/qlc.hrl\"). diff --git a/lib/stdlib/test/erl_pp_SUITE.erl b/lib/stdlib/test/erl_pp_SUITE.erl index db416b03b0..37be61d665 100644 --- a/lib/stdlib/test/erl_pp_SUITE.erl +++ b/lib/stdlib/test/erl_pp_SUITE.erl @@ -537,29 +537,9 @@ messages(Config) when is_list(Config) -> ?line true = "\n" =:= lists:flatten(erl_pp:form({eof,0})), ok. -old_mnemosyne_syntax(suite) -> - []; old_mnemosyne_syntax(Config) when is_list(Config) -> - %% Since we have kept the 'query' syntax and ':-' token, + %% Since we have kept the ':-' token, %% better test that we can pretty print it. - Q = {'query',6, - {lc,6, - {var,6,'X'}, - [{generate,6, - {var,6,'X'}, - {call,6,{atom,6,table},[{atom,6,tab}]}}, - {match,7, - {record_field,7,{var,7,'X'},{atom,7,foo}}, - {atom,7,bar}}]}}, - ?line "query\n" - " [ \n" % extra space... - " X ||\n" - " X <- table(tab),\n" - " X.foo = bar\n" - " ]\n" - "end" = - lists:flatten(erl_pp:expr(Q)), - R = {rule,12,sales,2, [{clause,12, [{var,12,'E'},{atom,12,employee}], diff --git a/lib/stdlib/test/erl_scan_SUITE.erl b/lib/stdlib/test/erl_scan_SUITE.erl index 34e1b99abe..9a6b2f8f34 100644 --- a/lib/stdlib/test/erl_scan_SUITE.erl +++ b/lib/stdlib/test/erl_scan_SUITE.erl @@ -197,7 +197,7 @@ otp_7810(Config) when is_list(Config) -> reserved_words() -> L = ['after', 'begin', 'case', 'try', 'cond', 'catch', 'andalso', 'orelse', 'end', 'fun', 'if', 'let', 'of', - 'query', 'receive', 'when', 'bnot', 'not', 'div', + 'receive', 'when', 'bnot', 'not', 'div', 'rem', 'band', 'and', 'bor', 'bxor', 'bsl', 'bsr', 'or', 'xor'], [begin diff --git a/lib/stdlib/test/escript_SUITE.erl b/lib/stdlib/test/escript_SUITE.erl index 7634c21a17..3749d594f2 100644 --- a/lib/stdlib/test/escript_SUITE.erl +++ b/lib/stdlib/test/escript_SUITE.erl @@ -26,6 +26,7 @@ errors/1, strange_name/1, emulator_flags/1, + emulator_flags_no_shebang/1, module_script/1, beam_script/1, archive_script/1, @@ -45,6 +46,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [basic, errors, strange_name, emulator_flags, + emulator_flags_no_shebang, module_script, beam_script, archive_script, epp, create_and_extract, foldl, overflow, archive_script_file_access, unicode]. @@ -150,6 +152,21 @@ emulator_flags(Config) when is_list(Config) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +emulator_flags_no_shebang(Config) when is_list(Config) -> + Data = ?config(data_dir, Config), + Dir = filename:absname(Data), %Get rid of trailing slash. + %% Need run_with_opts, to always use "escript" explicitly + ?line run_with_opts(Dir, "", "emulator_flags_no_shebang -arg1 arg2 arg3", + [<<"main:[\"-arg1\",\"arg2\",\"arg3\"]\n" + "nostick:[{nostick,[]}]\n" + "mnesia:[{mnesia,[\"dir\",\"a/directory\"]},{mnesia,[\"debug\",\"verbose\"]}]\n" + "ERL_FLAGS=false\n" + "unknown:[]\n" + "ExitCode:0">>]), + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Pick the source code from the emulator_flags script %% Generate a new escript with a module header diff --git a/lib/stdlib/test/escript_SUITE_data/emulator_flags_no_shebang b/lib/stdlib/test/escript_SUITE_data/emulator_flags_no_shebang new file mode 100644 index 0000000000..47d843ebe1 --- /dev/null +++ b/lib/stdlib/test/escript_SUITE_data/emulator_flags_no_shebang @@ -0,0 +1,10 @@ +%% -*- erlang -*- +%%! -nostick -mnesia dir a/directory -mnesia debug verbose + +main(MainArgs) -> + io:format("main:~p\n",[MainArgs]), + ErlArgs = init:get_arguments(), + io:format("nostick:~p\n",[[E || E <- ErlArgs, element(1, E) =:= nostick]]), + io:format("mnesia:~p\n", [[E || E <- ErlArgs, element(1, E) =:= mnesia]]), + io:format("ERL_FLAGS=~p\n", [os:getenv("ERL_FLAGS")]), + io:format("unknown:~p\n",[[E || E <- ErlArgs, element(1, E) =:= unknown]]). diff --git a/lib/stdlib/test/shell_SUITE.erl b/lib/stdlib/test/shell_SUITE.erl index a32f846bd2..f22df96697 100644 --- a/lib/stdlib/test/shell_SUITE.erl +++ b/lib/stdlib/test/shell_SUITE.erl @@ -28,7 +28,7 @@ refman_bit_syntax/1, progex_bit_syntax/1, progex_records/1, progex_lc/1, progex_funs/1, - otp_5990/1, otp_6166/1, otp_6554/1, otp_6785/1, + otp_5990/1, otp_6166/1, otp_6554/1, otp_7184/1, otp_7232/1, otp_8393/1, otp_10302/1]). -export([ start_restricted_from_shell/1, @@ -92,7 +92,7 @@ groups() -> [progex_bit_syntax, progex_records, progex_lc, progex_funs]}, {tickets, [], - [otp_5990, otp_6166, otp_6554, otp_6785, otp_7184, + [otp_5990, otp_6166, otp_6554, otp_7184, otp_7232, otp_8393, otp_10302]}]. init_per_suite(Config) -> @@ -2543,19 +2543,6 @@ otp_6554(Config) when is_list(Config) -> ok. -otp_6785(doc) -> - "OTP-6785. Parameterized modules."; -otp_6785(suite) -> []; -otp_6785(Config) when is_list(Config) -> - MFile = filename:join(?config(priv_dir, Config), "parameterized.erl"), - Contents = <<"-module(parameterized, [A]). " - "-export([test/0]). " - "test() -> A. ">>, - ?line ok = compile_file(Config, MFile, Contents, []), - ?line (parameterized:new(adsf)):test(), - file:delete(MFile), - ok. - otp_7184(doc) -> "OTP-7184. Propagate exit signals from dying evaluator process."; otp_7184(suite) -> []; diff --git a/lib/syntax_tools/src/Makefile b/lib/syntax_tools/src/Makefile index dca5e78be9..c9fbad8f9a 100644 --- a/lib/syntax_tools/src/Makefile +++ b/lib/syntax_tools/src/Makefile @@ -26,7 +26,7 @@ EBIN = ../ebin ifeq ($(NATIVE_LIBS_ENABLED),yes) ERL_COMPILE_FLAGS += +native endif -ERL_COMPILE_FLAGS += +warn_unused_vars +nowarn_shadow_vars +warn_unused_import # +warn_missing_spec +warn_untyped_record +ERL_COMPILE_FLAGS += +nowarn_shadow_vars +warn_unused_import -Werror # +warn_missing_spec +warn_untyped_record SOURCES=erl_syntax.erl erl_prettypr.erl erl_syntax_lib.erl \ erl_comment_scan.erl erl_recomment.erl erl_tidy.erl \ @@ -62,17 +62,17 @@ distclean: clean realclean: clean $(EBIN)/%.$(EMULATOR):%.erl - erlc -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $< # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/syntax_tools/src/erl_prettypr.erl b/lib/syntax_tools/src/erl_prettypr.erl index 1a55a5e71c..1ffcf31134 100644 --- a/lib/syntax_tools/src/erl_prettypr.erl +++ b/lib/syntax_tools/src/erl_prettypr.erl @@ -813,13 +813,6 @@ lay_2(Node, Ctxt) -> reset_prec(Ctxt)), lay_parentheses(D, Ctxt); - query_expr -> - Ctxt1 = reset_prec(Ctxt), - D = lay(erl_syntax:query_expr_body(Node), Ctxt1), - sep([text("query"), - nest(Ctxt1#ctxt.sub_indent, D), - text("end")]); - receive_expr -> Ctxt1 = reset_prec(Ctxt), D1 = lay_clauses(erl_syntax:receive_expr_clauses(Node), diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index f7420030c3..41a1708925 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -235,8 +235,6 @@ prefix_expr/2, prefix_expr_argument/1, prefix_expr_operator/1, - query_expr/1, - query_expr_body/1, receive_expr/1, receive_expr/3, receive_expr_action/1, @@ -449,7 +447,6 @@ %% <td>parentheses</td> %% <td>prefix_expr</td> %% </tr><tr> -%% <td>query_expr</td> %% <td>receive_expr</td> %% <td>record_access</td> %% </tr><tr> @@ -513,7 +510,6 @@ %% @see operator/1 %% @see parentheses/1 %% @see prefix_expr/2 -%% @see query_expr/1 %% @see receive_expr/3 %% @see record_access/3 %% @see record_expr/2 @@ -578,7 +574,6 @@ type(Node) -> {match, _, _, _} -> match_expr; {op, _, _, _, _} -> infix_expr; {op, _, _, _} -> prefix_expr; - {'query', _, _} -> query_expr; {record, _, _, _, _} -> record_expr; {record, _, _, _} -> record_expr; {record_field, _, _, _, _} -> record_access; @@ -4097,7 +4092,6 @@ record_access(Argument, Field) -> %% @see record_access_type/1 %% @see record_access_field/1 %% @see record_expr/3 -%% @see query_expr/1 -record(record_access, {argument :: syntaxTree(), type :: 'none' | syntaxTree(), @@ -4574,50 +4568,6 @@ binary_comp_body(Node) -> %% ===================================================================== -%% @doc Creates an abstract Mnemosyne query expression. The result -%% represents "<code>query <em>Body</em> end</code>". -%% -%% @see query_expr_body/1 -%% @see record_access/2 -%% @see rule/2 - -%% type(Node) = query_expr -%% data(Node) = syntaxTree() -%% -%% `erl_parse' representation: -%% -%% {'query', Pos, Body} -%% -%% Body = erl_parse() - --spec query_expr(syntaxTree()) -> syntaxTree(). - -query_expr(Body) -> - tree(query_expr, Body). - -revert_query_expr(Node) -> - Pos = get_pos(Node), - Body = list_comp_body(Node), - {'query', Pos, Body}. - - -%% ===================================================================== -%% @doc Returns the body subtree of a `query_expr' node. -%% -%% @see query_expr/1 - --spec query_expr_body(syntaxTree()) -> syntaxTree(). - -query_expr_body(Node) -> - case unwrap(Node) of - {'query', _, Body} -> - Body; - Node1 -> - data(Node1) - end. - - -%% ===================================================================== %% @doc Creates an abstract Mnemosyne rule. If `Clauses' is %% `[C1, ..., Cn]', the results represents %% "<code><em>Name</em> <em>C1</em>; ...; <em>Name</em> @@ -6041,8 +5991,6 @@ revert_root(Node) -> revert_parentheses(Node); prefix_expr -> revert_prefix_expr(Node); - query_expr -> - revert_query_expr(Node); receive_expr -> revert_receive_expr(Node); record_access -> @@ -6283,8 +6231,6 @@ subtrees(T) -> prefix_expr -> [[prefix_expr_operator(T)], [prefix_expr_argument(T)]]; - query_expr -> - [[query_expr_body(T)]]; receive_expr -> case receive_expr_timeout(T) of none -> @@ -6413,7 +6359,6 @@ make_tree(match_expr, [[P], [E]]) -> match_expr(P, E); make_tree(module_qualifier, [[M], [N]]) -> module_qualifier(M, N); make_tree(parentheses, [[E]]) -> parentheses(E); make_tree(prefix_expr, [[F], [A]]) -> prefix_expr(F, A); -make_tree(query_expr, [[B]]) -> query_expr(B); make_tree(receive_expr, [C]) -> receive_expr(C); make_tree(receive_expr, [C, [E], A]) -> receive_expr(C, E, A); make_tree(record_access, [[E], [F]]) -> diff --git a/lib/test_server/src/Makefile b/lib/test_server/src/Makefile index 3261936472..7251acd20b 100644 --- a/lib/test_server/src/Makefile +++ b/lib/test_server/src/Makefile @@ -91,7 +91,7 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += -I../include +ERL_COMPILE_FLAGS += -I../include -Werror # ---------------------------------------------------- # Targets @@ -112,10 +112,10 @@ configure: configure.in # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/test_server/src/ts_lib.erl b/lib/test_server/src/ts_lib.erl index d9a699ca9f..c0200ab67c 100644 --- a/lib/test_server/src/ts_lib.erl +++ b/lib/test_server/src/ts_lib.erl @@ -143,7 +143,6 @@ suite_order(inets) -> 28; suite_order(asn1) -> 30; suite_order(os_mon) -> 32; suite_order(snmp) -> 38; -suite_order(mnemosyne) -> 40; suite_order(mnesia_session) -> 42; suite_order(mnesia) -> 44; suite_order(system) -> 999; %% IMPORTANT: system SHOULD always be last! diff --git a/lib/toolbar/src/Makefile b/lib/toolbar/src/Makefile index 102970a59a..a24846976b 100644 --- a/lib/toolbar/src/Makefile +++ b/lib/toolbar/src/Makefile @@ -71,10 +71,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/tools/c_src/Makefile.in b/lib/tools/c_src/Makefile.in index 0382d3228d..aea5686ae9 100644 --- a/lib/tools/c_src/Makefile.in +++ b/lib/tools/c_src/Makefile.in @@ -17,6 +17,7 @@ # %CopyrightEnd% # +include $(ERL_TOP)/make/output.mk include $(ERL_TOP)/make/target.mk include $(ERL_TOP)/erts/include/internal/$(TARGET)/ethread.mk @@ -150,7 +151,7 @@ _create_dirs := $(shell mkdir -p $(CREATE_DIRS)) all: $(PROGS) $(DRIVERS) $(ERTS_LIB): - cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE) + $(make_verbose)cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE) docs: @@ -167,7 +168,7 @@ clean: # $(EMEM_OBJ_DIR)/%.o: %.c - $(CC) $(EMEM_CFLAGS) -o $@ -c $< + $(V_CC) $(EMEM_CFLAGS) -o $@ -c $< # # Driver targets @@ -178,7 +179,7 @@ $(EMEM_OBJ_DIR)/%.o: %.c # $(BIN_DIR)/emem$(TYPEMARKER)@EXEEXT@: $(EMEM_OBJS) $(ERTS_LIB) - $(PRE_LD) $(LD) $(EMEM_LDFLAGS) -o $@ $(EMEM_OBJS) $(EMEM_LIBS) + $(ld_verbose)$(PRE_LD) $(LD) $(EMEM_LDFLAGS) -o $@ $(EMEM_OBJS) $(EMEM_LIBS) # # Release targets @@ -221,7 +222,8 @@ SED_DEPEND=sed '$(SED_REPL_OBJ_DIR);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET);$(SED_ DEPEND_MK=depend.mk dep depend: - @echo "Generating dependency file $(DEPEND_MK)..." + [ $(v_p) == 0 ] && echo " GEN "$(DEPEND_MK) + $(V_colon)@echo "Generating dependency file $(DEPEND_MK)..." @echo "# Generated dependency rules." > $(DEPEND_MK); @echo "# Do *not* edit this file; instead, run 'make depend'." \ >> $(DEPEND_MK); diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index 2967acf310..21615f4cd9 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -723,9 +723,6 @@ resulting regexp is surrounded by \\_< and \\_>." (eval-and-compile (defvar erlang-int-bifs '("abs" - "adler32" - "adler32_combine" - "alive" "apply" "atom_to_binary" "atom_to_list" @@ -733,19 +730,20 @@ resulting regexp is surrounded by \\_< and \\_>." "binary_to_existing_atom" "binary_to_list" "binary_to_term" + "binary_part" "bit_size" + "bitsize" "bitstring_to_list" "byte_size" + "check_old_code" "check_process_code" - "contact_binary" - "crc32" - "crc32_combine" "date" - "decode_packet" "delete_module" + "demonitor" "disconnect_node" "element" "erase" + "error" "exit" "float" "float_to_list" @@ -756,7 +754,6 @@ resulting regexp is surrounded by \\_< and \\_>." "halt" "hd" "integer_to_list" - "internal_bif" "iolist_size" "iolist_to_binary" "is_alive" @@ -787,13 +784,13 @@ resulting regexp is surrounded by \\_< and \\_>." "list_to_tuple" "load_module" "make_ref" + "max" + "min" "module_loaded" + "monitor" "monitor_node" "node" - "node_link" - "node_unlink" "nodes" - "notalive" "now" "open_port" "pid_to_list" @@ -837,48 +834,102 @@ resulting regexp is surrounded by \\_< and \\_>." (eval-and-compile (defvar erlang-ext-bifs - '("append_element" + '("adler32" + "adler32_combine" + "alloc_info" + "alloc_sizes" + "append" + "append_element" + "await_proc_exit" + "await_sched_wall_time_modifications" + "bitstr_to_list" "bump_reductions" + "call_on_load_function" "cancel_timer" - "demonitor" + "crasher" + "crc32" + "crc32_combine" + "decode_packet" + "delay_trap" + "delete_element" + "dexit" + "dgroup_leader" "display" + "display_nl" + "display_string" + "dist_exit" + "dlink" + "dmonitor_node" + "dmonitor_p" + "dsend" + "dt_append_vm_tag_data" + "dt_get_tag" + "dt_get_tag_data" + "dt_prepend_vm_tag_data" + "dt_put_tag" + "dt_restore_tag" + "dt_spread_tag" + "dunlink" + "external_size" + "finish_after_on_load" + "finish_loading" + "flush_monitor_message" + "format_cpu_topology" "fun_info" "fun_to_list" "function_exported" + "garbage_collect_message_area" + "gather_sched_wall_time_result" "get_cookie" + "get_module_info" "get_stacktrace" "hash" - "integer_to_list" + "hibernate" + "insert_element" "is_builtin" - "list_to_integer" + "list_to_bitstr" + "load_nif" "loaded" "localtime" "localtime_to_universaltime" + "make_fun" "make_tuple" - "max" + "match_spec_test" "md5" "md5_final" "md5_init" "md5_update" "memory" - "min" - "monitor" + "module_info" "monitor_node" + "nif_error" "phash" "phash2" "port_call" + "port_get_data" "port_info" + "port_set_data" "port_to_list" "ports" + "posixtime_to_universaltime" + "prepare_loading" "process_display" + "raise" "read_timer" "ref_to_list" "resume_process" "send" "send_after" "send_nosuspend" + "seq_trace" + "seq_trace_info" + "seq_trace_print" "set_cookie" + "set_cpu_topology" + "setnode" + "spawn_opt" "start_timer" + "subtract" "suspend_process" "system_flag" "system_info" @@ -890,6 +941,7 @@ resulting regexp is surrounded by \\_< and \\_>." "trace_pattern" "universaltime" "universaltime_to_localtime" + "universaltime_to_posixtime" "yield") "Erlang built-in functions (BIFs) that needs erlang: prefix")) @@ -1518,9 +1570,9 @@ Other commands: . (("\\(?:^\\|[^$]\\)\"\\(?:[^\"\n]\\|\\\\\"\\)*\\(\\$\\)\"" 1 "w") ;; Likewise for atoms ("\\(?:^\\|[^$]\\)'\\(?:[^'\n]\\|\\\\'\\)*\\(\\$\\)'" 1 "w") - ;; And the dollar sign in $\" escapes two characters, not - ;; just one. - ("\\(\\$\\)\\\\\\\"" 1 "'")))))) + ;; And the dollar sign in $\" or $\' escapes two + ;; characters, not just one. + ("\\(\\$\\)\\\\[\"']" 1 "'")))))) diff --git a/lib/tools/src/Makefile b/lib/tools/src/Makefile index abe1389771..f11589d82b 100644 --- a/lib/tools/src/Makefile +++ b/lib/tools/src/Makefile @@ -75,7 +75,7 @@ APPUP_TARGET = $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += +ERL_COMPILE_FLAGS += -Werror # ---------------------------------------------------- # Targets @@ -94,10 +94,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl index ab29d156aa..680c1781ca 100644 --- a/lib/tools/src/cover.erl +++ b/lib/tools/src/cover.erl @@ -1519,12 +1519,6 @@ aux_var(Vars, N) -> %% This way we will be able to exclude functions defined in include files. munge({function,0,module_info,_Arity,_Clauses},_Vars,_MainFile,_Switch) -> ignore; % module_info will be added again when the forms are recompiled -munge(Form={function,_,'MNEMOSYNE QUERY',_,_},Vars,_MainFile,Switch) -> - {Form,Vars,Switch}; % No bumps in Mnemosyne code. -munge(Form={function,_,'MNEMOSYNE RULE',_,_},Vars,_MainFile,Switch) -> - {Form,Vars,Switch}; -munge(Form={function,_,'MNEMOSYNE RECFUNDEF',_,_},Vars,_MainFile,Switch) -> - {Form,Vars,Switch}; munge({function,Line,Function,Arity,Clauses},Vars,_MainFile,on) -> Vars2 = Vars#vars{function=Function, arity=Arity, diff --git a/lib/tools/src/xref_reader.erl b/lib/tools/src/xref_reader.erl index 92f0c45c7b..2fcc2c503c 100644 --- a/lib/tools/src/xref_reader.erl +++ b/lib/tools/src/xref_reader.erl @@ -80,12 +80,6 @@ form({attribute, Line, xref, Calls}, S) -> % experimental attr(Calls, Line, M, Fun, L, X, B, S); form({attribute, _Line, _Attr, _Val}, S) -> S; -form({function, 0, 'MNEMOSYNE RULE', 1, _Clauses}, S) -> - S; -form({function, 0, 'MNEMOSYNE QUERY', 2, _Clauses}, S) -> - S; -form({function, 0, 'MNEMOSYNE RECFUNDEF', 1, _Clauses}, S) -> - S; form({function, 0, module_info, 0, _Clauses}, S) -> S; form({function, 0, module_info, 1, _Clauses}, S) -> @@ -331,9 +325,6 @@ handle_call(Locality, Module, Name, Arity, Line, S) -> handle_call(Locality, To, Line, S, false) end. -handle_call(_Locality, {_, 'MNEMOSYNE RULE',1}, _Line, S, _) -> S; -handle_call(_Locality, {_, 'MNEMOSYNE QUERY', 2}, _Line, S, _) -> S; -handle_call(_Locality, {_, 'MNEMOSYNE RECFUNDEF',1}, _Line, S, _) -> S; handle_call(Locality, To0, Line, S, IsUnres) -> From = S#xrefr.function, To = adjust_arity(S, To0), diff --git a/lib/tools/test/Makefile b/lib/tools/test/Makefile index 86c81217b6..484cfdf53f 100644 --- a/lib/tools/test/Makefile +++ b/lib/tools/test/Makefile @@ -22,6 +22,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk MODULES = \ cover_SUITE \ eprof_SUITE \ + emacs_SUITE \ emem_SUITE \ fprof_SUITE \ cprof_SUITE \ diff --git a/lib/tools/test/emacs_SUITE.erl b/lib/tools/test/emacs_SUITE.erl new file mode 100644 index 0000000000..369b8c3ab5 --- /dev/null +++ b/lib/tools/test/emacs_SUITE.erl @@ -0,0 +1,76 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2005-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(emacs_SUITE). + +%%-define(line_trace, 1). + +-export([all/0, init_per_testcase/2, end_per_testcase/2]). + +-export([bif_highlight/1]). + +all() -> + [bif_highlight]. + +init_per_testcase(_Case, Config) -> + ErlangEl = filename:join([code:lib_dir(tools),"emacs","erlang.el"]), + case file:read_file_info(ErlangEl) of + {ok, _} -> + [{el, ErlangEl}|Config]; + _ -> + {skip, "Could not find erlang.el"} + end. + +end_per_testcase(_Case, _Config) -> + ok. + +bif_highlight(Config) -> + ErlangEl = proplists:get_value(el,Config), + {ok, Bin} = file:read_file(ErlangEl), + + %% All auto-imported bifs + IntBifs = lists:usort( + [F || {F,A} <- erlang:module_info(exports), + erl_internal:bif(F,A)]), + + %% all bif which need erlang: prefix and are not operands + ExtBifs = lists:usort( + [F || {F,A} <- erlang:module_info(exports), + not erl_internal:bif(F,A) andalso + not is_atom(catch erl_internal:op_type(F,A))]), + + check_bif_highlight(Bin, <<"erlang-int-bifs">>, IntBifs), + check_bif_highlight(Bin, <<"erlang-ext-bifs">>, ExtBifs). + + +check_bif_highlight(Bin, Tag, Compare) -> + [_H,IntMatch,_T] = + re:split(Bin,<<"defvar ",Tag/binary, + "[^(]*\\(([^)]*)">>,[]), + EmacsIntBifs = [list_to_atom(S) || + S <- string:tokens(binary_to_list(IntMatch)," '\"\n")], + + ct:log("Emacs ~p",[EmacsIntBifs]), + ct:log("Int ~p",[Compare]), + + ct:log("Diff1 ~p",[Compare -- EmacsIntBifs]), + ct:log("Diff2 ~p",[EmacsIntBifs -- Compare]), + [] = Compare -- EmacsIntBifs, + [] = EmacsIntBifs -- Compare. + + diff --git a/lib/tools/test/xref_SUITE.erl b/lib/tools/test/xref_SUITE.erl index cf49526156..dc06678b8e 100644 --- a/lib/tools/test/xref_SUITE.erl +++ b/lib/tools/test/xref_SUITE.erl @@ -47,7 +47,7 @@ -export([ add/1, default/1, info/1, lib/1, read/1, read2/1, remove/1, replace/1, update/1, deprecated/1, trycatch/1, - abstract_modules/1, fun_mfa/1, fun_mfa_r14/1, + fun_mfa/1, fun_mfa_r14/1, fun_mfa_vars/1, qlc/1]). -export([ @@ -83,7 +83,7 @@ groups() -> modules]}, {files, [], [add, default, info, lib, read, read2, remove, replace, - update, deprecated, trycatch, abstract_modules, fun_mfa, + update, deprecated, trycatch, fun_mfa, fun_mfa_r14, fun_mfa_vars, qlc]}, {analyses, [], [analyze, basic, md, q, variables, unused_locals]}, @@ -1669,64 +1669,6 @@ trycatch(Conf) when is_list(Conf) -> ok. -abstract_modules(suite) -> []; -abstract_modules(doc) -> ["OTP-5520: Abstract (parameterized) modules."]; -abstract_modules(Conf) when is_list(Conf) -> - Dir = ?copydir, - File = fname(Dir, "absmod.erl"), - MFile = fname(Dir, "absmod"), - Beam = fname(Dir, "absmod.beam"), - Test = <<"-module(param, [A, B]). - - -export([args/1]). - - args(C) -> - X = local(C), - Y = THIS:new(), % undef - Z = new(A, B), - {X, Y, Z}. - - local(C) -> - module_info(C). - ">>, - - ?line ok = file:write_file(File, Test), - - %% The compiler will no longer allow us to have a mismatch between - %% the module name and the output file, so we must use a trick. - ?line {ok, param, BeamCode} = compile:file(File, [binary,debug_info]), - ?line ok = file:write_file(Beam, BeamCode), - - ?line {ok, _} = xref:start(s), - ?line {ok, param} = xref:add_module(s, MFile, {warnings,false}), - A = param, - ?line {ok, [{{{A,args,1},{'$M_EXPR',new,0}},[7]}, - {{{A,args,1},{A,local,1}},[6]}, - {{{A,args,1},{A,new,2}},[8]}, - {{{A,local,1},{A,module_info,1}},[12]}, - {{{param,new,2},{param,instance,2}},[0]}]} = - xref:q(s, "(Lin) E"), - ?line {ok,[{param,args,1}, - {param,instance,2}, - {param,local,1}, - {param,module_info,1}, - {param,new,2}]} = xref:q(s, "F"), - - ?line ok = check_state(s), - ?line xref:stop(s), - - ?line {ok, _} = xref:start(s, {xref_mode, modules}), - ?line {ok, param} = xref:add_module(s, MFile), - ?line {ok,[{param,args,1}, - {param,instance,2}, - {param,new,2}]} = xref:q(s, "X"), - ?line ok = check_state(s), - ?line xref:stop(s), - - ?line ok = file:delete(File), - ?line ok = file:delete(Beam), - ok. - fun_mfa(suite) -> []; fun_mfa(doc) -> ["OTP-5653: fun M:F/A."]; fun_mfa(Conf) when is_list(Conf) -> diff --git a/lib/tv/src/Makefile b/lib/tv/src/Makefile index da1713e156..3d680c1eaf 100644 --- a/lib/tv/src/Makefile +++ b/lib/tv/src/Makefile @@ -109,10 +109,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/tv/src/tv_main.hrl b/lib/tv/src/tv_main.hrl index 28329ca83c..06b405ac1f 100644 --- a/lib/tv/src/tv_main.hrl +++ b/lib/tv/src/tv_main.hrl @@ -131,7 +131,6 @@ ir_WstringDef, lmcounter, locks, - mnemosyne_tmp, pg2_table, queue, snmp_agent_table, diff --git a/lib/typer/src/Makefile b/lib/typer/src/Makefile index 1f94d8fdc8..13af466755 100644 --- a/lib/typer/src/Makefile +++ b/lib/typer/src/Makefile @@ -82,13 +82,13 @@ clean: # ---------------------------------------------------- $(EBIN)/typer.$(EMULATOR): typer.erl ../vsn.mk Makefile - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) typer.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) typer.erl $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # --------------------------------------------------------------------- # dependencies diff --git a/lib/webtool/src/Makefile b/lib/webtool/src/Makefile index 783ffad79a..f28c777240 100644 --- a/lib/webtool/src/Makefile +++ b/lib/webtool/src/Makefile @@ -76,10 +76,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/wx/.gitignore b/lib/wx/.gitignore index 0fa427bfe5..960c76a779 100644 --- a/lib/wx/.gitignore +++ b/lib/wx/.gitignore @@ -1,4 +1,5 @@ test_log_* wx_test_case_info -api_gen/gl_man? -doc/html/*
\ No newline at end of file +doc/html/* +%% Don't delete links to man src when git clean -dfX +%% api_gen/gl_man? diff --git a/lib/wx/aclocal.m4 b/lib/wx/aclocal.m4 index 9578cd35c4..918e30a886 100644 --- a/lib/wx/aclocal.m4 +++ b/lib/wx/aclocal.m4 @@ -1849,6 +1849,31 @@ case $erl_gethrvtime in esac ])dnl +dnl ---------------------------------------------------------------------- +dnl +dnl LM_TRY_ENABLE_CFLAG +dnl +dnl +dnl Tries a CFLAG and sees if it can be enabled without compiler errors +dnl $1: textual cflag to add +dnl $2: variable to store the modified CFLAG in +dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) +dnl +dnl +AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) + saved_CFLAGS=$CFLAGS; + CFLAGS="$1 $$2"; + AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue"; then + AC_MSG_RESULT([yes]) + AS_VAR_SET($2, "$1 $$2") + else + AC_MSG_RESULT([no]) + fi +]) + dnl ERL_TRY_LINK_JAVA(CLASSES, FUNCTION-BODY dnl [ACTION_IF_FOUND [, ACTION-IF-NOT-FOUND]]) dnl Freely inspired by AC_TRY_LINK. (Maybe better to create a diff --git a/lib/wx/api_gen/gen_util.erl b/lib/wx/api_gen/gen_util.erl index 4638d4c7ea..2ba1c6e16f 100644 --- a/lib/wx/api_gen/gen_util.erl +++ b/lib/wx/api_gen/gen_util.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -49,8 +49,10 @@ get_taylor_made(Str, Name) -> [dotall, {capture, all_but_first, list}]). open_write(File) -> + open_write(File, []). +open_write(File, Opts) -> %% io:format("Generating ~s~n",[File]), - {ok, Fd} = file:open(File++".temp", [write]), + {ok, Fd} = file:open(File++".temp", [write|Opts]), put(current_file, {Fd,File}). @@ -187,6 +189,8 @@ replace_and_remove([$| | R], Acc) -> replace_and_remove(R, ["|"|Acc]); replace_and_remove([$* | R], Acc) -> replace_and_remove(R, ["*"|Acc]); +replace_and_remove([$+ | R], Acc) -> + replace_and_remove(R, ["+"|Acc]); replace_and_remove([$& | R], Acc) -> replace_and_remove(R, [$&|Acc]); replace_and_remove([$<,$< | R], Acc) -> @@ -221,7 +225,7 @@ erl_copyright() -> w("%%~n",[]), w("%% %CopyrightBegin%~n",[]), w("%%~n",[]), - w("%% Copyright Ericsson AB ~p-2012. All Rights Reserved.~n", + w("%% Copyright Ericsson AB ~p-2013. All Rights Reserved.~n", [StartYear]), w("%%~n",[]), w("%% The contents of this file are subject to the Erlang Public License,~n",[]), @@ -241,7 +245,7 @@ c_copyright() -> w("/*~n",[]), w(" * %CopyrightBegin%~n",[]), w(" *~n",[]), - w(" * Copyright Ericsson AB 2008-2012. All Rights Reserved.~n",[]), + w(" * Copyright Ericsson AB 2008-2013. All Rights Reserved.~n",[]), w(" *~n",[]), w(" * The contents of this file are subject to the Erlang Public License,~n",[]), w(" * Version 1.1, (the \"License\"); you may not use this file except in~n",[]), diff --git a/lib/wx/api_gen/gl_gen.erl b/lib/wx/api_gen/gl_gen.erl index 331ba32ba4..ea967c958f 100644 --- a/lib/wx/api_gen/gl_gen.erl +++ b/lib/wx/api_gen/gl_gen.erl @@ -185,11 +185,11 @@ parse_define([#xmlElement{name=name,content=[#xmlText{value="WINGDIAPI"++_}]}|_] throw(skip); parse_define([#xmlElement{name=name,content=[#xmlText{value=Name}]}|R], Def, Os) -> parse_define(R, Def#def{name=Name}, Os); -parse_define([#xmlElement{name=initializer,content=[#xmlText{value=V}]}|_],Def,_Os) -> - Val0 = string:strip(V), - try +parse_define([#xmlElement{name=initializer,content=Contents}|_R],Def,_Os) -> + Val0 = extract_def2(Contents), + try case Val0 of - "0x" ++ Val1 -> + "0x" ++ Val1 -> _ = http_util:hexlist_to_integer(Val1), Def#def{val=Val1, type=hex}; _ -> @@ -207,6 +207,23 @@ parse_define([_|R], D, Opts) -> parse_define([], D, _Opts) -> D. +extract_def2([#xmlText{value=Val}|R]) -> + strip_comment(string:strip(Val)) ++ extract_def2(R); +extract_def2([#xmlElement{content=Cs}|R]) -> + extract_def2(Cs) ++ extract_def2(R); +extract_def2([]) -> []. + +strip_comment("/*" ++ Rest) -> + strip_comment_until_end(Rest); +strip_comment("//" ++ _) -> []; +strip_comment([H|R]) -> [H | strip_comment(R)]; +strip_comment([]) -> []. + +strip_comment_until_end("*/" ++ Rest) -> + strip_comment(Rest); +strip_comment_until_end([_|R]) -> + strip_comment_until_end(R). + parse_func(Xml, Opts) -> {Func,_} = foldl(fun(X,Acc) -> parse_func(X,Acc,Opts) end, {#func{},1}, Xml), put(current_func, Func#func.name), diff --git a/lib/wx/api_gen/gl_gen_erl.erl b/lib/wx/api_gen/gl_gen_erl.erl index 25f89e4ad4..446521098e 100644 --- a/lib/wx/api_gen/gl_gen_erl.erl +++ b/lib/wx/api_gen/gl_gen_erl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -31,7 +31,7 @@ -import(lists, [foldl/3,foldr/3,reverse/1, keysearch/3, map/2, filter/2, max/1]). -import(gen_util, [lowercase/1, lowercase_all/1, uppercase/1, uppercase_all/1, - open_write/1, close/0, erl_copyright/0, w/2, + open_write/1, open_write/2, close/0, erl_copyright/0, w/2, args/3, args/4, strip_name/2]). gl_defines(Defs) -> @@ -90,7 +90,8 @@ types() -> ]. gl_api(Fs) -> - open_write("../src/gen/gl.erl"), + open_write("../src/gen/gl.erl", [{encoding,utf8}]), + w("%% -*- coding: utf-8 -*-~n~n", []), erl_copyright(), w("~n%% OPENGL API~n~n", []), w("%% This file is generated DO NOT EDIT~n~n", []), @@ -148,7 +149,8 @@ gl_api(Fs) -> ok. glu_api(Fs) -> - open_write("../src/gen/glu.erl"), + open_write("../src/gen/glu.erl", [{encoding,utf8}]), + w("%% -*- coding: utf-8 -*-~n~n", []), erl_copyright(), w("~n%% OPENGL UTILITY API~n~n", []), w("%% This file is generated DO NOT EDIT~n~n", []), @@ -330,7 +332,7 @@ format_doc([{constant, Const}|Rest], Count) -> w("`?~s'", [Const]), format_doc(Rest, Count-length(Const)-8); format_doc([{emphasis, Const}|Rest], Count) -> - w("`~s'", [Const]), + w("`~ts'", [Const]), format_doc(Rest, Count-length(Const)-7); format_doc([{function, Func}|Rest], Count) -> case Func of @@ -377,7 +379,7 @@ format_doc([{fenced, Open, Close, Eq}|Rest], Count) -> format_doc(Rest, Count); format_doc([{code, Code}|Rest], Count) -> - w("``~s''", [Code]), + w("``~ts''", [Code]), format_doc(Rest, Count-length(Code)-7); format_doc([para|Rest], _Count) -> @@ -387,10 +389,10 @@ format_doc([break|Rest], _Count) -> w("<br />~n%% ", []), format_doc(Rest, ?LINE_LEN); format_doc([{purpose, Purpose}, para | Doc], _Count) -> - w("%% @doc ~s~n%%~n%% ", [uppercase(Purpose)]), + w("%% @doc ~ts~n%%~n%% ", [uppercase(Purpose)]), format_doc(Doc, ?LINE_LEN); format_doc([{purpose, Purpose} | Doc], _Count) -> - w("%% @doc ~s~n%%~n%% ", [Purpose]), + w("%% @doc ~ts~n%%~n%% ", [Purpose]), format_doc(Doc, ?LINE_LEN); format_doc([listentry|Rest], _Count) -> w("~n%%~n%% ", []), @@ -398,11 +400,11 @@ format_doc([listentry|Rest], _Count) -> format_doc([Str|Rest], Count) -> case length(Str) of Len when Len < Count -> - w("~s", [Str]), + w("~ts", [Str]), format_doc(Rest, Count-Len); _ -> {Str1, Str2} = split(Str, Count, []), - w("~s~n%% ", [Str1]), + w("~ts~n%% ", [Str1]), format_doc([Str2|Rest], ?LINE_LEN) end; format_doc([], _) -> ok. diff --git a/lib/wx/api_gen/gl_scan_doc.erl b/lib/wx/api_gen/gl_scan_doc.erl index fc7b7cf275..80b4826a30 100644 --- a/lib/wx/api_gen/gl_scan_doc.erl +++ b/lib/wx/api_gen/gl_scan_doc.erl @@ -2,7 +2,7 @@ %%-------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012. All Rights Reserved. +%% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -56,8 +56,10 @@ gen_output({characters, String0}, #state{gen_output=true, type=Type, str=Str} = mi -> case hd(Str) of "/" -> String; "*" -> String; + [215] -> String; "+" -> String; "-" -> String; + "=" -> String; {fenced,_,_} -> String; _ -> [$ |String] @@ -268,7 +270,9 @@ fix_str([$<|Str]) -> fix_str([$>|Str]) -> [$&,$g,$t,$;|fix_str(Str)]; fix_str("×"++Str) -> - [$*|fix_str(Str)]; + [215|fix_str(Str)]; +%% fix_str([215|Str]) -> +%% [$*|fix_str(Str)]; fix_str("″"++Str) -> [$"|fix_str(Str)]; fix_str("·"++Str) -> @@ -277,10 +281,12 @@ fix_str("⁡"++Str) -> fix_str(Str); fix_str("⁢"++Str) -> [$ |fix_str(Str)]; +fix_str(" "++Str) -> + [$ |fix_str(Str)]; fix_str([$&|Str]) -> [$&,$a,$m,$p,$; |fix_str(Str)]; -fix_str([C|Str]) when C > 255 -> - fix_str(Str); +%% fix_str([C|Str]) when C > 255 -> +%% fix_str(Str); fix_str([C|Str]) -> [C|fix_str(Str)]; fix_str([]) -> []. diff --git a/lib/wx/api_gen/wx_extra/wxPrintout.erl b/lib/wx/api_gen/wx_extra/wxPrintout.erl index be8f2e2fa5..1dfd86ec62 100644 --- a/lib/wx/api_gen/wx_extra/wxPrintout.erl +++ b/lib/wx/api_gen/wx_extra/wxPrintout.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -40,7 +40,8 @@ new(Title, OnPrintPage) -> %% <pre>OnBeginDocument(This,StartPage,EndPage) -> boolean() </pre> %% <pre>OnEndDocument(This) -> term() </pre> %% <pre>HasPage(This,Page)} -> boolean() </pre> -%% <pre>GetPageInfo(This) -> {MinPage:.integer(), MaxPage::integer(), PageFrom::integer(), PageTo::integer()} </pre> +%% <pre>GetPageInfo(This) -> {MinPage::integer(), MaxPage::integer(), +%% PageFrom::integer(), PageTo::integer()} </pre> %% The <b>This</b> argument is the wxPrintout object reference to this object %% <br /> NOTE: The callbacks may not call other processes. new(Title, OnPrintPage, Opts) when is_list(Title), is_function(OnPrintPage), is_list(Opts) -> diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index 7f85151d03..2eb9d9d33d 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -103,7 +103,12 @@ mangle_info({class,CN,P,O,FL}) -> Event = get_value(event,O, false), Acc = get_value(acc, O, []), {Fs,Fopts} = foldr(fun(FWO={F,FO},{Fl,Fopt}) when is_list(FO) -> - {[F|Fl],[FWO|Fopt]}; + Opt = case F of + {Name, ArgLen} when is_integer(ArgLen) -> + {Name, FO}; + _ -> FWO + end, + {[F|Fl],[Opt|Fopt]}; (F,{Fl,Fopt}) -> {[F|Fl], Fopt} end, {[],[]}, FL), @@ -421,22 +426,30 @@ select_member(Several, #class{name=Class,file=Orig}, Defs0, Opts) -> parse_member(Data,MType,Virtual,Opts = #hs{fopt=Fopts}) -> Parse = fun(Con,A) -> parse_member2(Con,Opts,A) end, - Method = #method{name=MName,params=PS0} = + Method = #method{name=MName,params=PS0} = foldl(Parse, #method{method_type=MType, virtual=Virtual}, Data), %% Skip motif name's if it's last and optional PS2 = case PS0 of %% Backward order.. - [#param{name="name",def=Def,type=#type{name="wxString"}}|PS1] - when Def =/= none -> + [#param{name="name",def=Def,type=#type{name="wxString"}}|PS1] + when Def =/= none -> PS1; _ -> PS0 end, Sz = length(PS2), - PS = map(fun(P=#param{name=PName}) -> + PS = map(fun(P=#param{name=PName}) -> patch_param(MName,{Sz,PName},P,Fopts) end, PS2), - Alias = find_erl_alias_name(MName,PS,Fopts), - Method#method{params=PS, alias=Alias}. + Alias = find_erl_alias_name(MName,PS,Fopts), + FOpts = case gb_trees:lookup(MName, Fopts) of + {value, FuncO} when is_list(FuncO) -> + case lists:keyfind({func,Sz}, 1, FuncO) of + false -> FuncO; + {_, FuncNO} -> FuncNO + end; + _ -> [] + end, + Method#method{params=PS, alias=Alias, opts=FOpts}. find_erl_alias_name(MName,Ps,Fopts) -> case gb_trees:lookup(MName, Fopts) of @@ -527,7 +540,7 @@ add_param2(P=#param{name=Name},#hs{fopt=FOpt},M0=#method{name=MName,params=Ps}) M0#method{params=[Patched|Ps]} end. -patch_param(Method, Name, P, Opt) -> +patch_param(Method, Name, P, Opt) -> case gb_trees:lookup(Method,Opt) of none -> P; {value,NoArg} when is_integer(NoArg) -> P; @@ -560,11 +573,14 @@ handle_param_opt(both, P) -> P#param{in=both}; handle_param_opt({def,Def},P) -> P#param{def=Def}; handle_param_opt({type,Type}, P=#param{type=T}) -> P#param{type=T#type{name=Type}}; handle_param_opt({single,Opt}, P=#param{type=T}) -> P#param{type=T#type{single=Opt}}; +handle_param_opt({base,Enum={enum,Type}}, P=#param{type=T}) -> P#param{type=T#type{base=Enum, name=Type}}; handle_param_opt({base,Opt}, P=#param{type=T}) -> P#param{type=T#type{base=Opt}}; handle_param_opt({c_only,Opt},P) -> P#param{where=c, alt=Opt}; -handle_param_opt({ref, pointer}, P=#param{type=T}) -> +handle_param_opt({ref, pointer}, P=#param{type=T}) -> P#param{type=T#type{by_val=false,ref={pointer, 1}}}; -handle_param_opt({mod,Mods}, P=#param{type=T=#type{mod=Mods0}}) -> +handle_param_opt({by_val, true}, P=#param{type=T}) -> + P#param{type=T#type{by_val=true}}; +handle_param_opt({mod,Mods}, P=#param{type=T=#type{mod=Mods0}}) -> P#param{type=T#type{mod=Mods++Mods0}}. get_opt(Opt, Method, Sz, Opts) -> @@ -654,6 +670,12 @@ extract_type_info(#xmlElement{name=ref,attributes=As,content=[#xmlText{value=V}] {value, #xmlAttribute{value = Kind}} = keysearch(kindref,#xmlAttribute.name,As), {reverse(foldl(fun extract_type_info2/2, [], string:tokens(V, " "))) ++ Acc, {Kind,Refid}}; +extract_type_info(#xmlElement{name=ref,attributes=As,content=[#xmlText{value=V}]}, + {Acc,_}) -> + {value, #xmlAttribute{value = Refid}} = keysearch(refid,#xmlAttribute.name,As), + {value, #xmlAttribute{value = Kind}} = keysearch(kindref,#xmlAttribute.name,As), + {reverse(foldl(fun extract_type_info2/2, [], string:tokens(V, " "))) ++ Acc, + {Kind,Refid}}; extract_type_info(What,Acc) -> ?error({parse_error,What,Acc}). @@ -704,11 +726,9 @@ parse_type2([N="wxTextPos"|R],Info,Opts,T) -> %%long parse_type2(R,Info,Opts,T#type{name=N,base=int}); parse_type2([N="wxPrintQuality"|R],Info,Opts,T) -> parse_type2(R,Info,Opts,T#type{name=N,base=int}); -parse_type2([N="wxPaperSize"|R],Info,Opts,T) -> - parse_type2(R,Info,Opts,T#type{name=N,base=int}); parse_type2(["wxDataFormat"|_R],_Info,_Opts,T) -> %% Hack Hack - T#type{name="wxDataFormatId",base=int}; + T#type{name="wxDataFormatId",base={enum,"wxDataFormatId"}}; parse_type2([N="wxArrayInt"|R],Info,Opts,T) -> parse_type2(R,Info,Opts,T#type{name=N,base=int,single=array}); parse_type2([N="wxArrayDouble"|R],Info,Opts,T) -> @@ -1251,7 +1271,7 @@ parse_enums([File|Files], Parsed) -> case gb_sets:is_member(File,Parsed) of false -> FileName = filename:join(["wx_xml",File ++ "_8h.xml"]), -%% io:format("Parse Enums in ~s ~n", [FileName]), + %%io:format("Parse Enums in ~s ~n", [FileName]), case xmerl_scan:file(FileName, [{space, normalize}]) of {error, enoent} -> parse_enums(Files, gb_sets:add(File,Parsed)); @@ -1318,41 +1338,37 @@ extract_enum2([], N, _Id, Acc) -> extract_enum3([#xmlElement{name=name,content=[#xmlText{value=Name}]}|R], Id, Acc) -> case lists:keymember(Name, 1, Acc) of - true -> %% Doxygen double includes some defs. + true -> %% Doxygen double includes some defs. {Acc,Id}; false -> case Id of - This = {Str,Num} -> + This = {Str,Num} -> extract_enum3(R, {Str, Num+1}, [{Name,This}|Acc]); Val -> extract_enum3(R, Val+1, [{Name,Val}|Acc]) end end; -extract_enum3([#xmlElement{name=initializer, - content=Cs=[#xmlText{}|_]}|_],_Id,[{Name,_}|Acc]) -> - - String = lists:append([string:strip(C#xmlText.value) || C <- Cs]), - +extract_enum3([#xmlElement{name=initializer,content=Cs}|_],_Id,[{Name,_}|Acc]) -> + String = extract_def2(Cs), Val0 = gen_util:tokens(String,"<& "), - - try + try case Val0 of - ["0x" ++ Val1] -> + ["0x" ++ Val1] -> Val = http_util:hexlist_to_integer(Val1), {[{Name, Val}|Acc], Val+1}; - [Single] -> - Val = list_to_integer(Single), - {[{Name, Val}|Acc], Val+1}; ["1", "<<", Shift] -> Val = 1 bsl list_to_integer(Shift), {[{Name, Val}|Acc], Val+1}; - [_Str, "+", _What] -> - Val = lists:append(Val0), - {[{Name, {Val, 0}}|Acc], {Val,1}}; - _What -> - %% io:format("~p Name ~p ~p~n",[?LINE, Name, Val0]), - throw(below) + [Str, "+", What] -> + Val = list_to_integer(What), + {[{Name, {Str, Val}}|Acc], {Str,Val+1}}; + [Single] -> + Val = list_to_integer(Single), + {[{Name, Val}|Acc], Val+1}; + _ -> + %% io:format("~p Name ~p ~p ~p~n",[?LINE, Name, Val0, String]), + throw(below) end catch _:_ -> {[{Name,{String,0}}|Acc], {String,1}} @@ -1372,7 +1388,7 @@ extract_defs(Defs, File) -> end. extract_defs2(#xmlElement{name=memberdef,content=C},{Acc,Skip}) -> - try + try Res = {Name,_} = extract_def(C,undefined,Skip), case gb_sets:is_member(Name,Skip) orelse lists:keymember(Name, 1, Acc) of true -> {Acc,Skip}; @@ -1380,30 +1396,31 @@ extract_defs2(#xmlElement{name=memberdef,content=C},{Acc,Skip}) -> end catch throw:SkipName -> {Acc, gb_sets:add(SkipName,Skip)} end. - + extract_def([#xmlElement{name=name,content=[#xmlText{value=Name}]}|R], _N, Skip) -> case Name of "wxUSE" ++ _ -> throw(Name); "wx" ++ _ -> extract_def(R, Name, Skip); - _ -> + _ -> throw(Name) end; extract_def([#xmlElement{name=param}|_],Name,_) -> throw(Name); -extract_def([#xmlElement{name=initializer,content=[#xmlText{value=Val0}]}|_],N,Skip) -> +extract_def([#xmlElement{name=initializer,content=Cs}|_R],N,Skip) -> + Val0 = extract_def2(Cs), case Val0 of "0x" ++ Val1 -> {N, http_util:hexlist_to_integer(Val1)}; _ -> try Val = list_to_integer(Val0), {N, Val} - catch _:_ -> + catch _:_ -> case def_is_ok(Val0, Skip) of false -> throw(N); - NVal when is_integer(NVal) -> + NVal when is_integer(NVal) -> {N, NVal}; NVal -> {N, {NVal,0}} @@ -1414,7 +1431,24 @@ extract_def([_|R],N,Skip) -> extract_def(R,N,Skip); extract_def(_,N,_) -> throw(N). - + +extract_def2([#xmlText{value=Val}|R]) -> + strip_comment(string:strip(Val)) ++ extract_def2(R); +extract_def2([#xmlElement{content=Cs}|R]) -> + extract_def2(Cs) ++ extract_def2(R); +extract_def2([]) -> []. + +strip_comment("/*" ++ Rest) -> + strip_comment_until_end(Rest); +strip_comment("//" ++ _) -> []; +strip_comment([H|R]) -> [H | strip_comment(R)]; +strip_comment([]) -> []. + +strip_comment_until_end("*/" ++ Rest) -> + strip_comment(Rest); +strip_comment_until_end([_|R]) -> + strip_comment_until_end(R). + def_is_ok(Name, Skip) -> Toks = gen_util:tokens(Name,"()| \\:"), R = def_is_ok(Toks, Skip, []), diff --git a/lib/wx/api_gen/wx_gen.hrl b/lib/wx/api_gen/wx_gen.hrl index 426e3adfae..89577b9707 100644 --- a/lib/wx/api_gen/wx_gen.hrl +++ b/lib/wx/api_gen/wx_gen.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -44,7 +44,8 @@ doc, % Extra documentation virtual, % Is virtual? pre_hook = [], % Pre hook before call in c-code - post_hook = [] % Post hook after call in c-code + post_hook = [], % Post hook after call in c-code + opts = [] % Options } ). diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index 2209e4a53b..293c97507e 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -118,12 +118,18 @@ gen_constructors(#class{name=Class, methods=Ms0}) -> gen_constructor(_Class, #method{where=merged_c}) -> ok; gen_constructor(_Class, #method{where=erl_no_opt}) -> ok; -gen_constructor(Class, _M=#method{params=Ps}) -> +gen_constructor(Class, _M=#method{params=Ps, opts=FOpts}) -> Gen1 = fun(#param{name=N, type=T}) -> gen_type(T,1) ++ N end, Gen2 = fun(#param{name=N, type=T}) -> gen_type(T,2) ++ N end, CallA = fun(#param{name=N}) -> N end, HaveMergedType = fun(#param{type={merged,_,_,_,_,_,_}}) -> true; (_) -> false end, ?WTC("gen_constructor"), + Endif = case lists:keysearch(deprecated, 1, FOpts) of + {value, {deprecated, IfDef}} -> + w("#if ~s~n", [IfDef]), + true; + _ -> false + end, case lists:any(HaveMergedType, Ps) of false -> w(" E~s(~s) : ~s(~s) {};~n", @@ -133,7 +139,9 @@ gen_constructor(Class, _M=#method{params=Ps}) -> [Class,args(Gen1,",",Ps),Class,args(CallA,",",Ps)]), w(" E~s(~s) : ~s(~s) {};~n", [Class,args(Gen2,",",Ps),Class,args(CallA,",",Ps)]) - end. + end, + Endif andalso w("#endif~n", []), + ok. gen_type(#type{name=Type, ref={pointer,1}, mod=Mod},_) -> mods(Mod) ++ to_string(Type) ++ " * "; @@ -162,6 +170,14 @@ gen_funcs(Defs) -> w("#include \"wxe_macros.h\"~n"), w("#include \"wxe_derived_dest.h\"~n~n"), + w("#if !wxCHECK_VERSION(2,9,0)~n", []), + [w("#define ~p int~n", [Enum]) || + Enum <- [wxPenJoin, wxPenCap, wxImageResizeQuality, %%wxBitmapType, + wxPolygonFillMode, wxMappingMode, wxRasterOperationMode, + wxFloodFillStyle + ]], + w("#endif~n",[]), + w("void WxeApp::wxe_dispatch(wxeCommand& Ecmd)~n{~n"), w(" char * bp = Ecmd.buffer;~n"), w(" wxeMemEnv *memenv = getMemEnv(Ecmd.port);~n"), @@ -292,10 +308,16 @@ gen_method(CName, M=#method{name=N,params=[Ps],method_type=destructor,id=MethodI ignore end, M; -gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId}) -> +gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId, opts=FOpts}) -> put(current_func, N), put(bin_count,-1), ?WTC("gen_method"), + Endif = case lists:keysearch(deprecated, 1, FOpts) of + {value, {deprecated, IfDef}} -> + w("#if ~s~n", [IfDef]), + true; + _ -> false + end, w("case ~s: { // ~s::~s~n", [wx_gen_erl:get_unique_name(MethodId),CName,N]), Ps1 = declare_variables(void, Ps0), {Ps2,Align} = decode_arguments(Ps1), @@ -314,6 +336,7 @@ gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId free_args(), build_return_vals(T,Ps3), w(" break;~n}~n", []), + Endif andalso w("#endif~n", []), erase(current_func), M. @@ -746,7 +769,7 @@ return_res1(#type{name=Type,ref={pointer,_}, base={term,_}}) -> {Type ++ " * Result = (" ++ Type ++ "*)", ""}; return_res1(#type{name=Type,ref={pointer,_}}) -> {Type ++ " * Result = (" ++ Type ++ "*)", ""}; -return_res1(#type{name=Type,single=true,ref=reference}) -> +return_res1(#type{name=Type,single=true,by_val=false,ref=reference}) -> {Type ++ " * Result = &", ""}; return_res1(#type{name=Type,single=true,by_val=true}) when is_atom(Type) -> @@ -758,7 +781,7 @@ return_res1(#type{name=Type,base={class,_},single=list,ref=reference}) -> return_res1(#type{name=Type,base={comp,_,_},single=array,by_val=true}) -> {Type ++ " Result = ", ""}; return_res1(#type{name=Type,single=true,by_val=true, base={class, _}}) -> - %% Memory leak !!!!!! XXXX BUGBUG FIXME or doument!! + %% Temporary memory leak !!!!!! case Type of "wxImage" -> ok; "wxFont" -> ok; @@ -769,7 +792,6 @@ return_res1(#type{name=Type,single=true,by_val=true, base={class, _}}) -> io:format("~s::~s Building return value of temp ~s~n", [get(current_class),get(current_func),Type]) end, - %% #class{id=Id} = get({class,Type}), {Type ++ " * Result = new " ++ Type ++ "(", "); newPtr((void *) Result," ++ "3, memenv);"}; return_res1(#type{base={enum,_Type},single=true,by_val=true}) -> @@ -794,15 +816,14 @@ call_arg(#param{where=c, alt={length,Alt}}) when is_list(Alt) -> call_arg(#param{where=c, alt={size,Id}}) when is_integer(Id) -> %% It's a binary "Ecmd.bin["++ integer_to_list(Id) ++ "]->size"; -call_arg(#param{name=N,def=Def,type=#type{name=Type,by_val=true,single=true,base=Base}}) +call_arg(#param{name=N,def=Def,type=#type{by_val=true,single=true,base=Base}}) when Base =:= int; Base =:= long; Base =:= float; Base =:= double; Base =:= bool -> case Def of - none -> "(" ++ to_string(Type) ++ ") *" ++ N; + none -> "*" ++ N; _ -> N end; - -call_arg(#param{name=N,type=#type{base={enum,Type}, by_val=true,single=true}}) -> - "(" ++ enum_type(Type) ++") " ++ N; +call_arg(#param{name=N,type=#type{base={enum,_Type}, by_val=true,single=true}}) -> + N; call_arg(#param{name=N,type=#type{base={class,_},by_val=true,single=true}}) -> "*" ++ N; call_arg(#param{name=N,type=#type{base={class,_},ref=reference,single=true}}) -> "*" ++ N; call_arg(#param{name=N,type=#type{base=eventType}}) -> @@ -823,8 +844,8 @@ call_arg(#param{name=N,type={merged,_,#type{base={class,_},single=true, ref=Ref},_,_,_,_}}) when ByVal =:= true; Ref =:= reference -> "*" ++ N; -call_arg(#param{def=Def, type=void}) when Def =/= none -> Def; -call_arg(#param{def=Def, type=voidp}) when Def =/= none -> Def; +call_arg(#param{def=Def, type=void}) when Def =/= none -> Def; +call_arg(#param{def=Def, type=voidp}) when Def =/= none -> "(void **) " ++ Def; call_arg(#param{name=N,type=#type{base={ref,_},by_val=true,single=true}}) -> N; call_arg(#param{name=N,type={merged,_,_,_,_,_,_}}) -> N. @@ -932,10 +953,18 @@ build_ret(Name,_,#type{base={enum,_Type},single=true}) -> w(" rt.addInt(~s);~n",[Name]); build_ret(Name,_,#type{base={comp,_,{record, _}},single=true}) -> w(" rt.add(~s);~n", [Name]); +build_ret(Name,{ret,_},#type{base={comp,_,_},single=true, by_val=true}) -> + w(" rt.add(~s);~n",[Name]); build_ret(Name,{ret,_},#type{base={comp,_,_},single=true, ref=reference}) -> w(" rt.add((*~s));~n",[Name]); build_ret(Name,_,#type{base={comp,_,_},single=true}) -> w(" rt.add(~s);~n",[Name]); +build_ret(Name = "ev->m_scanCode",_,#type{base=bool,single=true,by_val=true}) -> + %% Hardcoded workaround for 2.9 and later + w("#if !wxCHECK_VERSION(2,9,0)~n", []), + w(" rt.addBool(~s);~n",[Name]), + w("#else~n rt.addBool(false);~n",[]), + w("#endif~n",[]); build_ret(Name,_,#type{base=bool,single=true,by_val=true}) -> w(" rt.addBool(~s);~n",[Name]); build_ret(Name,{arg, both},#type{base=int,single=true,mod=M}) -> diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl index a8f23575f3..a999a869e6 100644 --- a/lib/wx/api_gen/wx_gen_erl.erl +++ b/lib/wx/api_gen/wx_gen_erl.erl @@ -70,8 +70,7 @@ gen_class1(C=#class{name=Name,parent="static",methods=Ms,options=_Opts}) -> Exp = fun(M) -> gen_export(C,M) end, ExportList = lists:usort(lists:append(lists:map(Exp,reverse(Ms)))), - w("-export([~s]).~n~n", [args(fun(EF) -> EF end, ",", ExportList, 60)]), - + w("-export([~s]).~n~n", [args(fun({EF,_}) -> EF end, ",", ExportList, 60)]), Gen = fun(M) -> gen_method(Name,M) end, NewMs = lists:map(Gen,reverse(Ms)), @@ -134,7 +133,7 @@ gen_class1(C=#class{name=Name,parent=Parent,methods=Ms,options=Opts}) -> w("-include(\"wxe.hrl\").~n",[]), Exp = fun(M) -> gen_export(C,M) end, ExportList = lists:usort(lists:append(lists:map(Exp,reverse(Ms)))), - w("-export([~s]).~n~n", [args(fun(EF) -> EF end, ",", ExportList, 60)]), + w("-export([~s]).~n~n", [args(fun({EF,_}) -> EF end, ",", ExportList, 60)]), w("%% inherited exports~n",[]), Done0 = ["Destroy", "New", "Create", "destroy", "new", "create"], Done = gb_sets:from_list(Done0 ++ [M|| #method{name=M} <- lists:append(Ms)]), @@ -143,6 +142,10 @@ gen_class1(C=#class{name=Name,parent=Parent,methods=Ms,options=Opts}) -> lists:usort(["parent_class/1"|InExported]), 60)]), w("-export_type([~s/0]).~n", [Name]), + case lists:filter(fun({_F,Depr}) -> Depr end, ExportList) of + [] -> ok; + Depr -> w("-deprecated([~s]).~n~n", [args(fun({EF,_}) -> EF end, ",", Depr, 60)]) + end, w("%% @hidden~n", []), parents_check(Parents), w("-type ~s() :: wx:wx_object().~n", [Name]), @@ -218,33 +221,40 @@ gen_export(#class{name=Class,abstract=Abs},Ms0) -> case Res of [] -> []; [M=#method{where=taylormade}|_] -> - [taylormade_export(Class, M)]; + [deprecated(M, taylormade_export(Class, M))]; Ms -> - GetF = fun(#method{method_type=constructor,where=W,params=Ps}) -> + GetF = fun(M=#method{method_type=constructor,where=W,params=Ps}) -> {Args,Opts} = split_optional(Ps), OptLen = case Opts of [] -> 0; _ when W =:= erl_no_opt -> 0; _ -> 1 end, - "new/" ++ integer_to_list(length(Args)+OptLen); - (#method{method_type=destructor}) -> + deprecated(M, "new" ++ "/" ++ integer_to_list(length(Args)+OptLen)); + (M=#method{method_type=destructor}) -> case Abs of true -> []; - _ -> "destroy/1" + _ -> deprecated(M, "destroy/1") end; - (#method{name=N,alias=A,where=W, params=Ps}) -> + (M=#method{name=N,alias=A,where=W, params=Ps}) -> {Args,Opts} = split_optional(Ps), OptLen = case Opts of [] -> 0; _ when W =:= erl_no_opt -> 0; _ -> 1 end, - erl_func_name(N,A) ++ "/" ++ integer_to_list(length(Args) + OptLen) + deprecated(M, erl_func_name(N,A) ++ "/" ++ integer_to_list(length(Args) + OptLen)) end, lists:map(GetF, Ms) end. +deprecated(#method{opts=FOpts}, FA) -> + case lists:keysearch(deprecated, 1, FOpts) of + {value, {deprecated, _}} -> + {FA,true}; + _ -> + {FA,false} + end. gen_method(Class,Ms0) -> RemoveC = fun(#method{where=merged_c}) -> false;(_Other) -> true end, @@ -832,15 +842,20 @@ doc_enum(_,Ps) -> [doc_enum_type(Type,Name) || #param{name=Name, type=#type{base={enum,Type}}} <- Ps]. doc_enum_type(Type, Name) -> - {Enum0, #enum{vals=Vals}} = wx_gen:get_enum(Type), - Enum = case Enum0 of {_, E} -> E; E -> E end, - Consts = get(consts), - Format = fun({N,_What}) -> - #const{name=N} = gb_trees:get(N, Consts), - "?" ++ enum_name(N) - end, - Vs = args(Format, " | ", Vals), - {uppercase(Enum),Name, Vs}. + try + {Enum0, #enum{vals=Vals}} = wx_gen:get_enum(Type), + Enum = case Enum0 of {_, E} -> E; E -> E end, + Consts = get(consts), + Format = fun({N,_What}) -> + #const{name=N} = gb_trees:get(N, Consts), + "?" ++ enum_name(N) + end, + Vs = args(Format, " | ", Vals), + {uppercase(Enum),Name, Vs} + catch _:_ -> + io:format("Warning missing enum type ~p~n", [Type]), + {uppercase(Type),Name,"integer"} + end. doc_enum_desc([]) -> ok; doc_enum_desc([{_Enum,Name,Vs}|R]) -> @@ -1014,11 +1029,23 @@ align(64, 1, Str) -> {"0:32," ++ Str,0}; align(Sz, W, Str) -> align(Sz, W rem 2, Str). enum_name(Name) -> + case enum_split(Name) of + {undefined, _} -> Name; + {_C, ErlName} -> ErlName + end. + +enum_split(Name) -> case string:tokens(Name, ":") of - [Name] -> Name; - [C,N] -> C ++ "_" ++ N + [Name] -> {undefined, Name}; + [C,N] -> {C, enum_name(C,N)} end. +enum_name(undefined, Name) -> Name; +enum_name(Enum, Name) -> Enum ++ "_" ++ Name. + +enum_name_c(undefined, Name) -> Name; +enum_name_c(Enum, Name) -> Enum ++ "::" ++ Name. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% gen_enums_ints() -> @@ -1058,6 +1085,14 @@ build_enum_ints(#enum{from=From, vals=Vals},Done) -> w("% From class ~s::~s~n",[Class, Name]) end, + Consts = get(consts), + Ignore = fun(Name) -> + case gb_trees:lookup(Name, Consts) of + {value, Const} -> Const; + none -> true + end + end, + Format = fun(#const{name="wxEVT_" ++ _}) -> ignore; %% Ignore event macros they are not valid in our event model (#const{name=Name,val=Value,is_const=true}) when is_number(Value) -> @@ -1065,44 +1100,57 @@ build_enum_ints(#enum{from=From, vals=Vals},Done) -> (#const{name=Name,val=Value,is_const=false}) when is_number(Value) -> w("-define(~s, wxe_util:get_const(~s)).~n", [enum_name(Name),enum_name(Name)]); (#const{name=Name,val={Str,0}}) -> + {EnumClass, EnumName} = enum_split(Name), case string:tokens(Str, " |()") of [Token] -> - w("-define(~s, ~s).~n", [enum_name(Name),const_value(Token)]); + w("-define(~s, ~s).~n", [EnumName,const_value(Token, EnumClass, Ignore)]); Tokens -> - Def = args(fun(T) -> const_value(T) end, " bor ", Tokens), - w("-define(~s, (~s)).~n", [enum_name(Name),Def]) + Def = args(fun(T) -> const_value(T, EnumClass, Ignore) end, " bor ", Tokens), + w("-define(~s, (~s)).~n", [EnumName, Def]) end; (#const{name=Name,val={Str,N}}) -> + {EnumClass, EnumName} = enum_split(Name), case string:tokens(Str, " |()") of [Token] -> - w("-define(~s, (?~s+~p)).~n", [enum_name(Name),Token,N]) + w("-define(~s, (~s+~p)).~n", [EnumName,const_value(Token, EnumClass, Ignore),N]) end end, - Consts = get(consts), + Write = fun({Name,_What}, Skip) -> - case gb_sets:is_member(Name,Skip) of - true -> - Skip; - false -> - case gb_trees:lookup(Name, Consts) of - {value, Const} -> - Format(Const), - gb_sets:add(Name,Skip); - none -> Skip - end + case gb_sets:is_member(Name,Skip) orelse Ignore(Name) of + true -> Skip; + Const -> + try Format(Const) + catch {unknown_value, _Error} -> + %% io:format("Const ~s uses unknown define ~p ignoring~n", [Name, _Error]), + ok + end, + gb_sets:add(Name,Skip) end end, lists:foldl(Write, Done, Vals). -const_value(V) when is_integer(V) -> integer_to_list(V); -const_value(V = "16#" ++ IntList) -> +const_value(V,_,_) when is_integer(V) -> integer_to_list(V); +const_value(V = "16#" ++ IntList,_,_) -> _ = http_util:hexlist_to_integer(IntList), %% ASSERT V; -const_value(V0) -> +const_value(V0, EnumClass, Ignore) -> try _ = list_to_integer(V0), V0 - catch _:_ -> [$?|V0] + catch _:_ -> + EEnum = enum_name(EnumClass, V0), + CEnum = enum_name_c(EnumClass, V0), + case Ignore(CEnum) of + true when CEnum == V0 -> + throw({unknown_value, EEnum}); + true -> + case Ignore(V0) of + true -> throw({unknown_value, EEnum}); + _ -> [$?|V0] + end; + _ -> [$?|EEnum] + end end. gen_event_recs() -> diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index 1f6225ce60..94142ff6ba 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -148,7 +148,8 @@ {class, wxTopLevelWindowGTK, wxWindow, [{alias, [{wxTopLevelWindowGTK, wxTopLevelWindow}]}], - ['GetIcon','GetIcons','GetTitle','IsActive','Iconize', + [{'GetIcon', [{return, {by_val, true}}]}, + 'GetIcons','GetTitle','IsActive','Iconize', 'IsFullScreen','IsIconized','IsMaximized','Maximize', 'RequestUserAttention','SetIcon','SetIcons', 'CenterOnScreen', 'CentreOnScreen', @@ -279,8 +280,11 @@ {class, wxGridCellEditor, root, [], ['Create', 'IsCreated', 'SetSize', 'Show', - 'PaintBackground', 'BeginEdit', 'EndEdit', 'Reset', 'StartingKey', - 'StartingClick', 'HandleReturn' + {'PaintBackground', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + 'BeginEdit', + {'EndEdit', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + 'Reset', 'StartingKey', + 'StartingClick', 'HandleReturn' %'Destroy','Clone','~wxGridCellEditor', ]}. @@ -319,17 +323,25 @@ {class, wxDC, object, [{skip, [{'DrawEllipse',5},{'DrawRectangle',5}, {'DrawRoundedRectangle',6},{'SetClippingRegion',5}]}], - [{'Blit',7},'CalcBoundingBox','Clear','ComputeScaleAndOrigin',{'CrossHair',1}, + [{{'Blit',7},[{"rop", [{base, {enum, "wxRasterOperationMode"}}]}]}, + 'CalcBoundingBox','Clear', + {'ComputeScaleAndOrigin',[{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + {'CrossHair',1}, 'DestroyClippingRegion','DeviceToLogicalX','DeviceToLogicalXRel', 'DeviceToLogicalY','DeviceToLogicalYRel',{'DrawArc',3},{'DrawBitmap',3}, {'DrawCheckMark',1},{'DrawCircle',2},'DrawEllipse',{'DrawEllipticArc',4}, {'DrawIcon',2},{'DrawLabel',4},{'DrawLine',2}, {'DrawLines', [{"n",{c_only,{length,"points"}}}]}, - {'DrawPolygon', [{"n",{c_only,{length,"points"}}}]}, %'DrawPolyPolygon', + {'DrawPolygon', [{"n",{c_only,{length,"points"}}}, + {"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]} + ]}, + %%'DrawPolyPolygon', {'DrawPoint',1},'DrawRectangle', {'DrawRotatedText',3}, 'DrawRoundedRectangle',%'DrawSpline', {'DrawText',2}, - 'EndDoc','EndPage',{'FloodFill',3},'GetBackground','GetBackgroundMode', + 'EndDoc','EndPage', + {{'FloodFill',3},[{"style", [{base, {enum, "wxFloodFillStyle"}}]}]}, + 'GetBackground','GetBackgroundMode', 'GetBrush','GetCharHeight','GetCharWidth',{'GetClippingBox',[{"rect", skip_member}]}, 'GetFont','GetLayoutDirection','GetLogicalFunction','GetMapMode','GetMultiLineTextExtent', {'GetPartialTextExtents', [{"widths", out}]}, @@ -340,21 +352,33 @@ 'LogicalToDeviceX','LogicalToDeviceXRel','LogicalToDeviceY','LogicalToDeviceYRel', 'MaxX','MaxY','MinX','MinY','IsOk','ResetBoundingBox','SetAxisOrientation', 'SetBackground','SetBackgroundMode','SetBrush','SetClippingRegion','SetDeviceOrigin', - 'SetFont','SetLayoutDirection','SetLogicalFunction','SetMapMode', 'SetPalette', + 'SetFont','SetLayoutDirection', + {'SetLogicalFunction', [{"function", [{base, {enum, "wxRasterOperationMode"}}]}]}, + {'SetMapMode', [{"mode", [{base, {enum, "wxMappingMode"}}]}]}, + 'SetPalette', 'SetPen','SetTextBackground','SetTextForeground','SetUserScale','StartDoc','StartPage']}. {class,wxMirrorDC, wxDC, [], ['wxMirrorDC', '~wxMirrorDC']}. {class,wxScreenDC, wxDC, [], ['wxScreenDC', '~wxScreenDC']}. -{class,wxPostScriptDC,wxDC,[],['wxPostScriptDC','~wxPostScriptDC','SetResolution','GetResolution']}. -{class,wxWindowDC, wxDC, [], ['wxWindowDC', '~wxWindowDC']}. -{class,wxClientDC,wxWindowDC,[],['wxClientDC', '~wxClientDC']}. -{class,wxPaintDC, wxWindowDC, [], ['wxPaintDC', '~wxPaintDC']}. +{class,wxPostScriptDC,wxDC,[], + ['wxPostScriptDC','~wxPostScriptDC', + {'SetResolution', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + {'GetResolution', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}]}. +{class,wxWindowDC, wxDC, [], + [{'wxWindowDC', [{{func, 0}, [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}]}, + '~wxWindowDC']}. +{class,wxClientDC,wxWindowDC,[], + [{'wxClientDC', [{{func, 0}, [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}]}, + '~wxClientDC']}. +{class,wxPaintDC, wxWindowDC, [], + [{'wxPaintDC', [{{func, 0}, [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}]}, + '~wxPaintDC']}. %%{class,wxPrinterDC, wxDC, [], ['wxPrinterDC','GetPaperRect']}. Not in GTK {class,wxMemoryDC, wxDC, [], ['wxMemoryDC', '~wxMemoryDC','SelectObject','SelectObjectAsSource']}. {class,wxBufferedDC,wxMemoryDC,[],['wxBufferedDC','~wxBufferedDC','Init']}. {class,wxBufferedPaintDC,wxBufferedDC,[],['wxBufferedPaintDC', '~wxBufferedPaintDC']}. %% Only a typedef! -%%{class,wxAutoBufferedPaintDC,wxBufferedPaintDC,[],['wxAutoBufferedPaintDC']}. +%%{class,wxAutoBufferedPaintDC,wxBufferedPaintDC,[],['wxAutoBufferedPaintDC']}. {class, wxGraphicsObject, object, [{ifdef, wxUSE_GRAPHICS_CONTEXT}], ['~wxGraphicsObject', 'GetRenderer','IsNull']}. @@ -362,13 +386,17 @@ [{ifdef, wxUSE_GRAPHICS_CONTEXT}, {skip, [{'StrokeLines',4}]}], ['~wxGraphicsContext', 'Create', %%CreateFromNative CreateFromNativeWindow - 'CreatePen','CreateBrush','CreateRadialGradientBrush', - 'CreateLinearGradientBrush','CreateFont','CreateMatrix', + 'CreatePen','CreateBrush', + {'CreateRadialGradientBrush', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + {'CreateLinearGradientBrush', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + 'CreateFont','CreateMatrix', 'CreatePath','Clip','ResetClip', 'DrawBitmap','DrawEllipse','DrawIcon', - {'DrawLines', [{"n",{c_only,{length,"points"}}}, {"points", {single,array}}]}, - 'DrawPath', - 'DrawRectangle','DrawRoundedRectangle','DrawText','FillPath', + {'DrawLines', [{"n",{c_only,{length,"points"}}}, {"points", {single,array}}, + {"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]}]}, + {'DrawPath',[{"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]}]}, + 'DrawRectangle','DrawRoundedRectangle','DrawText', + {'FillPath',[{"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]}]}, 'StrokePath', %% 'GetNativeContext', {'GetPartialTextExtents', [{"widths", out}]}, 'GetTextExtent','Rotate','Scale','Translate', @@ -383,15 +411,18 @@ {class, wxGraphicsPath, wxGraphicsObject, [{ifdef, wxUSE_GRAPHICS_CONTEXT}], ['MoveToPoint','AddArc','AddArcToPoint','AddCircle','AddCurveToPoint', 'AddEllipse','AddLineToPoint','AddPath','AddQuadCurveToPoint', - 'AddRectangle','AddRoundedRectangle','CloseSubpath','Contains', - 'GetBox','GetCurrentPoint','Transform' + 'AddRectangle','AddRoundedRectangle','CloseSubpath', + {'Contains', [{"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]}]}, + 'GetBox','GetCurrentPoint','Transform' %'GetNativePath','UnGetNativePath' ]}. {class, wxGraphicsRenderer, object, [{ifdef, wxUSE_GRAPHICS_CONTEXT}], ['GetDefaultRenderer','CreateContext', %%'CreateContextFromNativeContext', 'CreateContextFromNativeWindow', 'CreatePen','CreateBrush', - 'CreateLinearGradientBrush','CreateRadialGradientBrush','CreateFont', + {'CreateLinearGradientBrush', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + {'CreateRadialGradientBrush', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + 'CreateFont', 'CreateMatrix','CreatePath']}. {class, wxGraphicsPen, wxGraphicsObject,[{ifdef, wxUSE_GRAPHICS_CONTEXT}], []}. @@ -501,10 +532,12 @@ 'CopyFromBitmap','~wxIcon']}. {class, wxIconBundle, root, [], - ['wxIconBundle','~wxIconBundle','AddIcon','GetIcon']}. + ['wxIconBundle','~wxIconBundle','AddIcon', + {'GetIcon', [{return, {by_val, true}}]}]}. {class, wxCursor, wxBitmap,[], - [{'wxCursor',[{"bits",[in,{base,binary},{single,true}]}, + [{'wxCursor',[{{func, 5}, [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + {"bits",[in,{base,binary},{single,true}]}, {"maskBits",nowhere},{"fg",nowhere},{"bg",nowhere}]}, '~wxCursor','Ok']}. @@ -549,16 +582,22 @@ {'GetAlpha',[{{0,return},{base,{binary,"(This->GetWidth()*This->GetHeight())"}}}]}, 'GetBlue', {'GetData', [{return,{base,{binary,"(This->GetWidth()*This->GetHeight()*3)"}}}]}, - 'GetGreen', 'GetImageCount', %'GetHandlers', + 'GetGreen', + {'GetImageCount', [{"type", [{base, {enum, "wxBitmapType"}}]}]}, + %%'GetHandlers', 'GetHeight','GetMaskBlue','GetMaskGreen', 'GetMaskRed','GetOrFindMaskColour','GetPalette', 'GetRed','GetSubImage', 'GetWidth',%%':HSVValue', 'HSVtoRGB', 'HasAlpha','HasMask','GetOption','GetOptionInt','HasOption', 'InitAlpha','InitStandardHandlers',%'InsertHandler', 'IsTransparent', 'LoadFile','Ok',%%RGBValue 'RGBtoHSV', - 'RemoveHandler','Mirror','Replace','Rescale','Resize', + 'RemoveHandler','Mirror','Replace', + {'Rescale', [{"quality", [{base, {enum, "wxImageResizeQuality"}}]}]}, + 'Resize', 'Rotate', 'RotateHue', - 'Rotate90','SaveFile','Scale','Size', + 'Rotate90','SaveFile', + {'Scale', [{"quality", [{base, {enum, "wxImageResizeQuality"}}]}]}, + 'Size', {'SetAlpha', [{{2,"alpha"},[in,{base,binary}, {def, none}]}, {{2,pre_hook}, [{c, "if(!static_data) {" @@ -576,15 +615,20 @@ 'SetRGB']}. {class, wxBrush, object, [], - ['wxBrush','~wxBrush','GetColour','GetStipple','GetStyle', + ['wxBrush','~wxBrush', + {'GetColour', [{return, {by_val, true}}]}, + 'GetStipple','GetStyle', 'IsHatch','IsOk','SetColour','SetStipple','SetStyle']}. {class, wxPen, object, [], - ['wxPen','~wxPen','GetCap','GetColour', + ['wxPen','~wxPen','GetCap', + {'GetColour', [{return, {by_val, true}}]}, %%'GetDashes', %'GetStipple', - 'GetJoin', 'GetStyle','GetWidth','IsOk','SetCap','SetColour', + 'GetJoin', 'GetStyle','GetWidth','IsOk', + {'SetCap', [{"capStyle", [{base, {enum, "wxPenCap"}}]}]}, + 'SetColour', %%'SetDashes', %'SetStipple', - 'SetJoin', 'SetStyle','SetWidth']}. + {'SetJoin', [{"joinStyle", [{base, {enum, "wxPenJoin"}}]}]}, 'SetStyle','SetWidth']}. {enum, wxRegionContain, "wx"}. @@ -683,8 +727,11 @@ ['wxButton','~wxButton','Create',%'GetLabel', 'GetDefaultSize', 'SetDefault','SetLabel']}. {class, wxBitmapButton, wxButton, [], - ['wxBitmapButton','~wxBitmapButton','Create','GetBitmapDisabled', - 'GetBitmapFocus','GetBitmapLabel','GetBitmapSelected', + ['wxBitmapButton','~wxBitmapButton','Create', + {'GetBitmapDisabled', [{return, {by_val, true}}]}, + {'GetBitmapFocus', [{return, {by_val, true}}]}, + {'GetBitmapLabel', [{return, {by_val, true}}]}, + {'GetBitmapSelected', [{return, {by_val, true}}]}, 'SetBitmapDisabled','SetBitmapFocus','SetBitmapLabel','SetBitmapSelected']}. {class, wxToggleButton, wxControl, [], ['wxToggleButton','~wxToggleButton','Create','GetValue','SetValue']}. @@ -693,8 +740,10 @@ {class, wxDateTime, root, [ignore], []}. %% Only for ifdefs and enums {class, wxCalendarCtrl, wxControl, [], - ['wxCalendarCtrl','Create','~wxCalendarCtrl','SetDate','GetDate', - 'EnableYearChange','EnableMonthChange','EnableHolidayDisplay', + ['wxCalendarCtrl','Create','~wxCalendarCtrl','SetDate', + {'GetDate', [{return, {by_val, true}}]}, + {'EnableYearChange', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, %% Temp bug in wx I assume + 'EnableMonthChange','EnableHolidayDisplay', 'SetHeaderColours','GetHeaderColourFg','GetHeaderColourBg', 'SetHighlightColours','GetHighlightColourFg','GetHighlightColourBg', 'SetHolidayColours','GetHolidayColourFg','GetHolidayColourBg', @@ -816,8 +865,9 @@ {enum, wxTextAttrAlignment, "wxTEXT_ALIGNMENT_"}. {class, wxTextAttr, root, [], - ['wxTextAttr','GetAlignment','GetBackgroundColour','GetFont','GetLeftIndent', - 'GetLeftSubIndent','GetRightIndent','GetTabs','GetTextColour', + ['wxTextAttr','GetAlignment','GetBackgroundColour', + {'GetFont', [{return, {by_val, true}}]}, + 'GetLeftIndent','GetLeftSubIndent','GetRightIndent','GetTabs','GetTextColour', 'HasBackgroundColour','HasFont','HasTextColour','GetFlags','IsDefault', 'SetAlignment','SetBackgroundColour','SetFlags','SetFont','SetLeftIndent', 'SetRightIndent','SetTabs','SetTextColour']}. @@ -1233,7 +1283,8 @@ {class, wxMDIParentFrame, wxFrame, [], [ - 'wxMDIParentFrame', '~wxMDIParentFrame', 'ActivateNext', 'ActivatePrevious', + 'wxMDIParentFrame', + '~wxMDIParentFrame', 'ActivateNext', 'ActivatePrevious', 'ArrangeIcons', 'Cascade', 'Create', %%'GetClientSize', 'GetToolBar', 'SetToolBar', defined in parent 'GetActiveChild', 'GetClientWindow', @@ -1244,8 +1295,9 @@ {class, wxMDIChildFrame, wxFrame, [], ['wxMDIChildFrame','~wxMDIChildFrame','Activate','Create','Maximize','Restore']}. -{class, wxMDIClientWindow, wxWindow, [], - ['wxMDIClientWindow','~wxMDIClientWindow','CreateClient']}. +{class, wxMDIClientWindow, wxWindow, [], + [{'wxMDIClientWindow', [{{func, 2}, [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}]}, + '~wxMDIClientWindow','CreateClient']}. {class, wxLayoutAlgorithm, object, [], ['wxLayoutAlgorithm', '~wxLayoutAlgorithm', @@ -1310,12 +1362,7 @@ [wxEVT_LEFT_DOWN,wxEVT_LEFT_UP,wxEVT_MIDDLE_DOWN,wxEVT_MIDDLE_UP, wxEVT_RIGHT_DOWN,wxEVT_RIGHT_UP,wxEVT_MOTION,wxEVT_ENTER_WINDOW, wxEVT_LEAVE_WINDOW,wxEVT_LEFT_DCLICK,wxEVT_MIDDLE_DCLICK, - wxEVT_RIGHT_DCLICK,wxEVT_MOUSEWHEEL, - wxEVT_NC_LEFT_DOWN,wxEVT_NC_LEFT_UP, - wxEVT_NC_MIDDLE_DOWN,wxEVT_NC_MIDDLE_UP,wxEVT_NC_RIGHT_DOWN, - wxEVT_NC_RIGHT_UP,wxEVT_NC_MOTION,wxEVT_NC_ENTER_WINDOW, - wxEVT_NC_LEAVE_WINDOW,wxEVT_NC_LEFT_DCLICK,wxEVT_NC_MIDDLE_DCLICK, - wxEVT_NC_RIGHT_DCLICK]}], + wxEVT_RIGHT_DCLICK,wxEVT_MOUSEWHEEL]}], ['AltDown','Button','ButtonDClick','ButtonDown','ButtonUp','CmdDown','ControlDown', 'Dragging', 'Entering', 'GetButton', 'GetPosition', 'GetLogicalPosition', 'GetLinesPerAction', 'GetWheelRotation', 'GetWheelDelta', 'GetX', 'GetY', @@ -1345,8 +1392,8 @@ ['GetSize']}. {class, wxMoveEvent, wxEvent, [{event,[wxEVT_MOVE]}], ['GetPosition']}. -{class, wxPaintEvent, wxEvent, [{event,[wxEVT_PAINT,wxEVT_PAINT_ICON]}],[]}. -{class, wxNcPaintEvent, wxEvent, [{event,[wxEVT_NC_PAINT]}],[]}. +{class, wxPaintEvent, wxEvent, [{event,[wxEVT_PAINT]}],[]}. +%%{class, wxNcPaintEvent, wxEvent, [{event,[wxEVT_NC_PAINT]}],[]}. {class, wxEraseEvent, wxEvent, [{acc, [{m_dc, "GetDC()"}]}, {event, [wxEVT_ERASE_BACKGROUND]}], @@ -1415,7 +1462,8 @@ ['GetPosition','SetPosition']}. {enum, wxIdleMode, "wxIDLE_"}. {class, wxIdleEvent, wxEvent, [{event,[wxEVT_IDLE]}], - ['CanSend','GetMode','RequestMore','MoreRequested','SetMode']}. + [{'CanSend', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + 'GetMode','RequestMore','MoreRequested','SetMode']}. {class, wxGridEvent, wxNotifyEvent, [{acc, [{m_row, "GetRow()"}, {m_col, "GetCol()"}, {m_x, "GetPosition().x"},{m_y, "GetPosition().y"}, {m_selecting, "Selecting()"},{m_control,"ControlDown()"}, @@ -1634,7 +1682,7 @@ 'StyleSetFont', 'StyleSetFontAttr', 'StyleSetCharacterSet', 'StyleSetFontEncoding', 'CmdKeyExecute', 'SetMargins', {'GetSelection', [{"startPos", [out]}, {"endPos",[out]}]}, - 'PointFromPosition', 'ScrollToLine', 'ScrollToColumn', 'SendMsg', + 'PointFromPosition', 'ScrollToLine', 'ScrollToColumn', %% 'SendMsg', 'SetVScrollBar', 'SetHScrollBar', 'GetLastKeydownProcessed', 'SetLastKeydownProcessed', 'SaveFile', 'LoadFile', 'DoDragOver', 'DoDropText', 'GetUseAntiAliasing', {'AddTextRaw', [{"text", [in, {base, binary}]}]}, diff --git a/lib/wx/c_src/Makefile.in b/lib/wx/c_src/Makefile.in index 1497ac4d16..1d17076d23 100644 --- a/lib/wx/c_src/Makefile.in +++ b/lib/wx/c_src/Makefile.in @@ -71,8 +71,7 @@ WX_OBJECTS = $(GENERAL_O) $(GENERATED_O) $(RC_FILE) OBJECTS = $(WX_OBJECTS) $(GL_OBJECTS) -TARGET_APIS = wxe_driver erl_gl -TARGET_DIR = ../priv +TARGET_DIR = ../priv/$(SYS_TYPE) # -O2 -funroll-loops -ffast-math -fomit-frame-pointer @@ -121,7 +120,7 @@ debug: clean: rm -f $(OBJECTS) - rm -f ../priv/$(TARGET_DIR)/$(TARGET_API)$(SO_EXT) + rm -f $(TARGET_DIR)/*$(SO_EXT) rm -f *~ erl_crash.dump complete_clean: diff --git a/lib/wx/c_src/gen/wxe_derived_dest.h b/lib/wx/c_src/gen/wxe_derived_dest.h index 6b7a5378cb..5fdce27d4b 100644 --- a/lib/wx/c_src/gen/wxe_derived_dest.h +++ b/lib/wx/c_src/gen/wxe_derived_dest.h @@ -94,19 +94,25 @@ class EwxPostScriptDC : public wxPostScriptDC { class EwxWindowDC : public wxWindowDC { public: ~EwxWindowDC() {((WxeApp *)wxTheApp)->clearPtr(this);}; EwxWindowDC(wxWindow * win) : wxWindowDC(win) {}; +#if !wxCHECK_VERSION(2,9,0) EwxWindowDC() : wxWindowDC() {}; +#endif }; class EwxClientDC : public wxClientDC { public: ~EwxClientDC() {((WxeApp *)wxTheApp)->clearPtr(this);}; EwxClientDC(wxWindow * win) : wxClientDC(win) {}; +#if !wxCHECK_VERSION(2,9,0) EwxClientDC() : wxClientDC() {}; +#endif }; class EwxPaintDC : public wxPaintDC { public: ~EwxPaintDC() {((WxeApp *)wxTheApp)->clearPtr(this);}; EwxPaintDC(wxWindow * win) : wxPaintDC(win) {}; +#if !wxCHECK_VERSION(2,9,0) EwxPaintDC() : wxPaintDC() {}; +#endif }; class EwxMemoryDC : public wxMemoryDC { @@ -182,7 +188,9 @@ class EwxIcon : public wxIcon { class EwxCursor : public wxCursor { public: ~EwxCursor() {((WxeApp *)wxTheApp)->clearPtr(this);}; +#if !wxCHECK_VERSION(2,9,0) EwxCursor(const char * bits,int width,int height,int hotSpotX,int hotSpotY) : wxCursor(bits,width,height,hotSpotX,hotSpotY) {}; +#endif EwxCursor(int cursorId) : wxCursor(cursorId) {}; EwxCursor(const wxImage& image) : wxCursor(image) {}; EwxCursor() : wxCursor() {}; @@ -286,7 +294,7 @@ class EwxStdDialogButtonSizer : public wxStdDialogButtonSizer { class EwxFont : public wxFont { public: ~EwxFont() {((WxeApp *)wxTheApp)->clearPtr(this);}; - EwxFont(int size,int family,int style,int weight,bool underlined,const wxString& face,wxFontEncoding encoding) : wxFont(size,family,style,weight,underlined,face,encoding) {}; + EwxFont(int size,wxFontFamily family,wxFontStyle style,int weight,bool underlined,const wxString& face,wxFontEncoding encoding) : wxFont(size,family,style,weight,underlined,face,encoding) {}; EwxFont(const wxString& fontname) : wxFont(fontname) {}; EwxFont() : wxFont() {}; }; @@ -712,7 +720,9 @@ class EwxMDIChildFrame : public wxMDIChildFrame { class EwxMDIClientWindow : public wxMDIClientWindow { public: ~EwxMDIClientWindow() {((WxeApp *)wxTheApp)->clearPtr(this);}; +#if !wxCHECK_VERSION(2,9,0) EwxMDIClientWindow(wxMDIParentFrame * parent,long style) : wxMDIClientWindow(parent,style) {}; +#endif EwxMDIClientWindow() : wxMDIClientWindow() {}; }; diff --git a/lib/wx/c_src/gen/wxe_events.cpp b/lib/wx/c_src/gen/wxe_events.cpp index 0afb02150a..7a3233a410 100644 --- a/lib/wx/c_src/gen/wxe_events.cpp +++ b/lib/wx/c_src/gen/wxe_events.cpp @@ -107,18 +107,6 @@ void initEventTable() {wxEVT_MIDDLE_DCLICK, 167, "middle_dclick"}, {wxEVT_RIGHT_DCLICK, 167, "right_dclick"}, {wxEVT_MOUSEWHEEL, 167, "mousewheel"}, - {wxEVT_NC_LEFT_DOWN, 167, "nc_left_down"}, - {wxEVT_NC_LEFT_UP, 167, "nc_left_up"}, - {wxEVT_NC_MIDDLE_DOWN, 167, "nc_middle_down"}, - {wxEVT_NC_MIDDLE_UP, 167, "nc_middle_up"}, - {wxEVT_NC_RIGHT_DOWN, 167, "nc_right_down"}, - {wxEVT_NC_RIGHT_UP, 167, "nc_right_up"}, - {wxEVT_NC_MOTION, 167, "nc_motion"}, - {wxEVT_NC_ENTER_WINDOW, 167, "nc_enter_window"}, - {wxEVT_NC_LEAVE_WINDOW, 167, "nc_leave_window"}, - {wxEVT_NC_LEFT_DCLICK, 167, "nc_left_dclick"}, - {wxEVT_NC_MIDDLE_DCLICK, 167, "nc_middle_dclick"}, - {wxEVT_NC_RIGHT_DCLICK, 167, "nc_right_dclick"}, {wxEVT_SET_CURSOR, 168, "set_cursor"}, {wxEVT_CHAR, 169, "char"}, {wxEVT_CHAR_HOOK, 169, "char_hook"}, @@ -127,187 +115,185 @@ void initEventTable() {wxEVT_SIZE, 170, "size"}, {wxEVT_MOVE, 171, "move"}, {wxEVT_PAINT, 172, "paint"}, - {wxEVT_PAINT_ICON, 172, "paint_icon"}, - {wxEVT_NC_PAINT, 173, "nc_paint"}, - {wxEVT_ERASE_BACKGROUND, 174, "erase_background"}, - {wxEVT_SET_FOCUS, 175, "set_focus"}, - {wxEVT_KILL_FOCUS, 175, "kill_focus"}, - {wxEVT_CHILD_FOCUS, 176, "child_focus"}, - {wxEVT_MENU_OPEN, 177, "menu_open"}, - {wxEVT_MENU_CLOSE, 177, "menu_close"}, - {wxEVT_MENU_HIGHLIGHT, 177, "menu_highlight"}, - {wxEVT_CLOSE_WINDOW, 178, "close_window"}, - {wxEVT_END_SESSION, 178, "end_session"}, - {wxEVT_QUERY_END_SESSION, 178, "query_end_session"}, - {wxEVT_SHOW, 179, "show"}, - {wxEVT_ICONIZE, 180, "iconize"}, - {wxEVT_MAXIMIZE, 181, "maximize"}, - {wxEVT_JOY_BUTTON_DOWN, 182, "joy_button_down"}, - {wxEVT_JOY_BUTTON_UP, 182, "joy_button_up"}, - {wxEVT_JOY_MOVE, 182, "joy_move"}, - {wxEVT_JOY_ZMOVE, 182, "joy_zmove"}, - {wxEVT_UPDATE_UI, 183, "update_ui"}, - {wxEVT_SYS_COLOUR_CHANGED, 184, "sys_colour_changed"}, - {wxEVT_MOUSE_CAPTURE_CHANGED, 185, "mouse_capture_changed"}, - {wxEVT_DISPLAY_CHANGED, 186, "display_changed"}, - {wxEVT_PALETTE_CHANGED, 187, "palette_changed"}, - {wxEVT_QUERY_NEW_PALETTE, 188, "query_new_palette"}, - {wxEVT_NAVIGATION_KEY, 189, "navigation_key"}, - {wxEVT_CREATE, 190, "create"}, - {wxEVT_DESTROY, 191, "destroy"}, - {wxEVT_HELP, 192, "help"}, - {wxEVT_DETAILED_HELP, 192, "detailed_help"}, - {wxEVT_CONTEXT_MENU, 193, "context_menu"}, - {wxEVT_IDLE, 194, "idle"}, - {wxEVT_GRID_CELL_LEFT_CLICK, 195, "grid_cell_left_click"}, - {wxEVT_GRID_CELL_RIGHT_CLICK, 195, "grid_cell_right_click"}, - {wxEVT_GRID_CELL_LEFT_DCLICK, 195, "grid_cell_left_dclick"}, - {wxEVT_GRID_CELL_RIGHT_DCLICK, 195, "grid_cell_right_dclick"}, - {wxEVT_GRID_LABEL_LEFT_CLICK, 195, "grid_label_left_click"}, - {wxEVT_GRID_LABEL_RIGHT_CLICK, 195, "grid_label_right_click"}, - {wxEVT_GRID_LABEL_LEFT_DCLICK, 195, "grid_label_left_dclick"}, - {wxEVT_GRID_LABEL_RIGHT_DCLICK, 195, "grid_label_right_dclick"}, - {wxEVT_GRID_ROW_SIZE, 195, "grid_row_size"}, - {wxEVT_GRID_COL_SIZE, 195, "grid_col_size"}, - {wxEVT_GRID_RANGE_SELECT, 195, "grid_range_select"}, - {wxEVT_GRID_CELL_CHANGE, 195, "grid_cell_change"}, - {wxEVT_GRID_SELECT_CELL, 195, "grid_select_cell"}, - {wxEVT_GRID_EDITOR_SHOWN, 195, "grid_editor_shown"}, - {wxEVT_GRID_EDITOR_HIDDEN, 195, "grid_editor_hidden"}, - {wxEVT_GRID_EDITOR_CREATED, 195, "grid_editor_created"}, - {wxEVT_GRID_CELL_BEGIN_DRAG, 195, "grid_cell_begin_drag"}, - {wxEVT_SASH_DRAGGED, 197, "sash_dragged"}, - {wxEVT_COMMAND_LIST_BEGIN_DRAG, 198, "command_list_begin_drag"}, - {wxEVT_COMMAND_LIST_BEGIN_RDRAG, 198, "command_list_begin_rdrag"}, - {wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, 198, "command_list_begin_label_edit"}, - {wxEVT_COMMAND_LIST_END_LABEL_EDIT, 198, "command_list_end_label_edit"}, - {wxEVT_COMMAND_LIST_DELETE_ITEM, 198, "command_list_delete_item"}, - {wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 198, "command_list_delete_all_items"}, - {wxEVT_COMMAND_LIST_KEY_DOWN, 198, "command_list_key_down"}, - {wxEVT_COMMAND_LIST_INSERT_ITEM, 198, "command_list_insert_item"}, - {wxEVT_COMMAND_LIST_COL_CLICK, 198, "command_list_col_click"}, - {wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, 198, "command_list_col_right_click"}, - {wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, 198, "command_list_col_begin_drag"}, - {wxEVT_COMMAND_LIST_COL_DRAGGING, 198, "command_list_col_dragging"}, - {wxEVT_COMMAND_LIST_COL_END_DRAG, 198, "command_list_col_end_drag"}, - {wxEVT_COMMAND_LIST_ITEM_SELECTED, 198, "command_list_item_selected"}, - {wxEVT_COMMAND_LIST_ITEM_DESELECTED, 198, "command_list_item_deselected"}, - {wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, 198, "command_list_item_right_click"}, - {wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 198, "command_list_item_middle_click"}, - {wxEVT_COMMAND_LIST_ITEM_ACTIVATED, 198, "command_list_item_activated"}, - {wxEVT_COMMAND_LIST_ITEM_FOCUSED, 198, "command_list_item_focused"}, - {wxEVT_COMMAND_LIST_CACHE_HINT, 198, "command_list_cache_hint"}, - {wxEVT_DATE_CHANGED, 199, "date_changed"}, - {wxEVT_CALENDAR_SEL_CHANGED, 200, "calendar_sel_changed"}, - {wxEVT_CALENDAR_DAY_CHANGED, 200, "calendar_day_changed"}, - {wxEVT_CALENDAR_MONTH_CHANGED, 200, "calendar_month_changed"}, - {wxEVT_CALENDAR_YEAR_CHANGED, 200, "calendar_year_changed"}, - {wxEVT_CALENDAR_DOUBLECLICKED, 200, "calendar_doubleclicked"}, - {wxEVT_CALENDAR_WEEKDAY_CLICKED, 200, "calendar_weekday_clicked"}, - {wxEVT_COMMAND_FILEPICKER_CHANGED, 201, "command_filepicker_changed"}, - {wxEVT_COMMAND_DIRPICKER_CHANGED, 201, "command_dirpicker_changed"}, - {wxEVT_COMMAND_COLOURPICKER_CHANGED, 202, "command_colourpicker_changed"}, - {wxEVT_COMMAND_FONTPICKER_CHANGED, 203, "command_fontpicker_changed"}, - {wxEVT_STC_CHANGE, 204, "stc_change"}, - {wxEVT_STC_STYLENEEDED, 204, "stc_styleneeded"}, - {wxEVT_STC_CHARADDED, 204, "stc_charadded"}, - {wxEVT_STC_SAVEPOINTREACHED, 204, "stc_savepointreached"}, - {wxEVT_STC_SAVEPOINTLEFT, 204, "stc_savepointleft"}, - {wxEVT_STC_ROMODIFYATTEMPT, 204, "stc_romodifyattempt"}, - {wxEVT_STC_KEY, 204, "stc_key"}, - {wxEVT_STC_DOUBLECLICK, 204, "stc_doubleclick"}, - {wxEVT_STC_UPDATEUI, 204, "stc_updateui"}, - {wxEVT_STC_MODIFIED, 204, "stc_modified"}, - {wxEVT_STC_MACRORECORD, 204, "stc_macrorecord"}, - {wxEVT_STC_MARGINCLICK, 204, "stc_marginclick"}, - {wxEVT_STC_NEEDSHOWN, 204, "stc_needshown"}, - {wxEVT_STC_PAINTED, 204, "stc_painted"}, - {wxEVT_STC_USERLISTSELECTION, 204, "stc_userlistselection"}, - {wxEVT_STC_URIDROPPED, 204, "stc_uridropped"}, - {wxEVT_STC_DWELLSTART, 204, "stc_dwellstart"}, - {wxEVT_STC_DWELLEND, 204, "stc_dwellend"}, - {wxEVT_STC_START_DRAG, 204, "stc_start_drag"}, - {wxEVT_STC_DRAG_OVER, 204, "stc_drag_over"}, - {wxEVT_STC_DO_DROP, 204, "stc_do_drop"}, - {wxEVT_STC_ZOOM, 204, "stc_zoom"}, - {wxEVT_STC_HOTSPOT_CLICK, 204, "stc_hotspot_click"}, - {wxEVT_STC_HOTSPOT_DCLICK, 204, "stc_hotspot_dclick"}, - {wxEVT_STC_CALLTIP_CLICK, 204, "stc_calltip_click"}, - {wxEVT_STC_AUTOCOMP_SELECTION, 204, "stc_autocomp_selection"}, - {wxEVT_COMMAND_TREE_BEGIN_DRAG, 209, "command_tree_begin_drag"}, - {wxEVT_COMMAND_TREE_BEGIN_RDRAG, 209, "command_tree_begin_rdrag"}, - {wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 209, "command_tree_begin_label_edit"}, - {wxEVT_COMMAND_TREE_END_LABEL_EDIT, 209, "command_tree_end_label_edit"}, - {wxEVT_COMMAND_TREE_DELETE_ITEM, 209, "command_tree_delete_item"}, - {wxEVT_COMMAND_TREE_GET_INFO, 209, "command_tree_get_info"}, - {wxEVT_COMMAND_TREE_SET_INFO, 209, "command_tree_set_info"}, - {wxEVT_COMMAND_TREE_ITEM_EXPANDED, 209, "command_tree_item_expanded"}, - {wxEVT_COMMAND_TREE_ITEM_EXPANDING, 209, "command_tree_item_expanding"}, - {wxEVT_COMMAND_TREE_ITEM_COLLAPSED, 209, "command_tree_item_collapsed"}, - {wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 209, "command_tree_item_collapsing"}, - {wxEVT_COMMAND_TREE_SEL_CHANGED, 209, "command_tree_sel_changed"}, - {wxEVT_COMMAND_TREE_SEL_CHANGING, 209, "command_tree_sel_changing"}, - {wxEVT_COMMAND_TREE_KEY_DOWN, 209, "command_tree_key_down"}, - {wxEVT_COMMAND_TREE_ITEM_ACTIVATED, 209, "command_tree_item_activated"}, - {wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, 209, "command_tree_item_right_click"}, - {wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 209, "command_tree_item_middle_click"}, - {wxEVT_COMMAND_TREE_END_DRAG, 209, "command_tree_end_drag"}, - {wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 209, "command_tree_state_image_click"}, - {wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 209, "command_tree_item_gettooltip"}, - {wxEVT_COMMAND_TREE_ITEM_MENU, 209, "command_tree_item_menu"}, - {wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 210, "command_notebook_page_changed"}, - {wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 210, "command_notebook_page_changing"}, - {wxEVT_COMMAND_SPINCTRL_UPDATED, 216, "command_spinctrl_updated"}, + {wxEVT_ERASE_BACKGROUND, 173, "erase_background"}, + {wxEVT_SET_FOCUS, 174, "set_focus"}, + {wxEVT_KILL_FOCUS, 174, "kill_focus"}, + {wxEVT_CHILD_FOCUS, 175, "child_focus"}, + {wxEVT_MENU_OPEN, 176, "menu_open"}, + {wxEVT_MENU_CLOSE, 176, "menu_close"}, + {wxEVT_MENU_HIGHLIGHT, 176, "menu_highlight"}, + {wxEVT_CLOSE_WINDOW, 177, "close_window"}, + {wxEVT_END_SESSION, 177, "end_session"}, + {wxEVT_QUERY_END_SESSION, 177, "query_end_session"}, + {wxEVT_SHOW, 178, "show"}, + {wxEVT_ICONIZE, 179, "iconize"}, + {wxEVT_MAXIMIZE, 180, "maximize"}, + {wxEVT_JOY_BUTTON_DOWN, 181, "joy_button_down"}, + {wxEVT_JOY_BUTTON_UP, 181, "joy_button_up"}, + {wxEVT_JOY_MOVE, 181, "joy_move"}, + {wxEVT_JOY_ZMOVE, 181, "joy_zmove"}, + {wxEVT_UPDATE_UI, 182, "update_ui"}, + {wxEVT_SYS_COLOUR_CHANGED, 183, "sys_colour_changed"}, + {wxEVT_MOUSE_CAPTURE_CHANGED, 184, "mouse_capture_changed"}, + {wxEVT_DISPLAY_CHANGED, 185, "display_changed"}, + {wxEVT_PALETTE_CHANGED, 186, "palette_changed"}, + {wxEVT_QUERY_NEW_PALETTE, 187, "query_new_palette"}, + {wxEVT_NAVIGATION_KEY, 188, "navigation_key"}, + {wxEVT_CREATE, 189, "create"}, + {wxEVT_DESTROY, 190, "destroy"}, + {wxEVT_HELP, 191, "help"}, + {wxEVT_DETAILED_HELP, 191, "detailed_help"}, + {wxEVT_CONTEXT_MENU, 192, "context_menu"}, + {wxEVT_IDLE, 193, "idle"}, + {wxEVT_GRID_CELL_LEFT_CLICK, 194, "grid_cell_left_click"}, + {wxEVT_GRID_CELL_RIGHT_CLICK, 194, "grid_cell_right_click"}, + {wxEVT_GRID_CELL_LEFT_DCLICK, 194, "grid_cell_left_dclick"}, + {wxEVT_GRID_CELL_RIGHT_DCLICK, 194, "grid_cell_right_dclick"}, + {wxEVT_GRID_LABEL_LEFT_CLICK, 194, "grid_label_left_click"}, + {wxEVT_GRID_LABEL_RIGHT_CLICK, 194, "grid_label_right_click"}, + {wxEVT_GRID_LABEL_LEFT_DCLICK, 194, "grid_label_left_dclick"}, + {wxEVT_GRID_LABEL_RIGHT_DCLICK, 194, "grid_label_right_dclick"}, + {wxEVT_GRID_ROW_SIZE, 194, "grid_row_size"}, + {wxEVT_GRID_COL_SIZE, 194, "grid_col_size"}, + {wxEVT_GRID_RANGE_SELECT, 194, "grid_range_select"}, + {wxEVT_GRID_CELL_CHANGE, 194, "grid_cell_change"}, + {wxEVT_GRID_SELECT_CELL, 194, "grid_select_cell"}, + {wxEVT_GRID_EDITOR_SHOWN, 194, "grid_editor_shown"}, + {wxEVT_GRID_EDITOR_HIDDEN, 194, "grid_editor_hidden"}, + {wxEVT_GRID_EDITOR_CREATED, 194, "grid_editor_created"}, + {wxEVT_GRID_CELL_BEGIN_DRAG, 194, "grid_cell_begin_drag"}, + {wxEVT_SASH_DRAGGED, 196, "sash_dragged"}, + {wxEVT_COMMAND_LIST_BEGIN_DRAG, 197, "command_list_begin_drag"}, + {wxEVT_COMMAND_LIST_BEGIN_RDRAG, 197, "command_list_begin_rdrag"}, + {wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, 197, "command_list_begin_label_edit"}, + {wxEVT_COMMAND_LIST_END_LABEL_EDIT, 197, "command_list_end_label_edit"}, + {wxEVT_COMMAND_LIST_DELETE_ITEM, 197, "command_list_delete_item"}, + {wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 197, "command_list_delete_all_items"}, + {wxEVT_COMMAND_LIST_KEY_DOWN, 197, "command_list_key_down"}, + {wxEVT_COMMAND_LIST_INSERT_ITEM, 197, "command_list_insert_item"}, + {wxEVT_COMMAND_LIST_COL_CLICK, 197, "command_list_col_click"}, + {wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, 197, "command_list_col_right_click"}, + {wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, 197, "command_list_col_begin_drag"}, + {wxEVT_COMMAND_LIST_COL_DRAGGING, 197, "command_list_col_dragging"}, + {wxEVT_COMMAND_LIST_COL_END_DRAG, 197, "command_list_col_end_drag"}, + {wxEVT_COMMAND_LIST_ITEM_SELECTED, 197, "command_list_item_selected"}, + {wxEVT_COMMAND_LIST_ITEM_DESELECTED, 197, "command_list_item_deselected"}, + {wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, 197, "command_list_item_right_click"}, + {wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 197, "command_list_item_middle_click"}, + {wxEVT_COMMAND_LIST_ITEM_ACTIVATED, 197, "command_list_item_activated"}, + {wxEVT_COMMAND_LIST_ITEM_FOCUSED, 197, "command_list_item_focused"}, + {wxEVT_COMMAND_LIST_CACHE_HINT, 197, "command_list_cache_hint"}, + {wxEVT_DATE_CHANGED, 198, "date_changed"}, + {wxEVT_CALENDAR_SEL_CHANGED, 199, "calendar_sel_changed"}, + {wxEVT_CALENDAR_DAY_CHANGED, 199, "calendar_day_changed"}, + {wxEVT_CALENDAR_MONTH_CHANGED, 199, "calendar_month_changed"}, + {wxEVT_CALENDAR_YEAR_CHANGED, 199, "calendar_year_changed"}, + {wxEVT_CALENDAR_DOUBLECLICKED, 199, "calendar_doubleclicked"}, + {wxEVT_CALENDAR_WEEKDAY_CLICKED, 199, "calendar_weekday_clicked"}, + {wxEVT_COMMAND_FILEPICKER_CHANGED, 200, "command_filepicker_changed"}, + {wxEVT_COMMAND_DIRPICKER_CHANGED, 200, "command_dirpicker_changed"}, + {wxEVT_COMMAND_COLOURPICKER_CHANGED, 201, "command_colourpicker_changed"}, + {wxEVT_COMMAND_FONTPICKER_CHANGED, 202, "command_fontpicker_changed"}, + {wxEVT_STC_CHANGE, 203, "stc_change"}, + {wxEVT_STC_STYLENEEDED, 203, "stc_styleneeded"}, + {wxEVT_STC_CHARADDED, 203, "stc_charadded"}, + {wxEVT_STC_SAVEPOINTREACHED, 203, "stc_savepointreached"}, + {wxEVT_STC_SAVEPOINTLEFT, 203, "stc_savepointleft"}, + {wxEVT_STC_ROMODIFYATTEMPT, 203, "stc_romodifyattempt"}, + {wxEVT_STC_KEY, 203, "stc_key"}, + {wxEVT_STC_DOUBLECLICK, 203, "stc_doubleclick"}, + {wxEVT_STC_UPDATEUI, 203, "stc_updateui"}, + {wxEVT_STC_MODIFIED, 203, "stc_modified"}, + {wxEVT_STC_MACRORECORD, 203, "stc_macrorecord"}, + {wxEVT_STC_MARGINCLICK, 203, "stc_marginclick"}, + {wxEVT_STC_NEEDSHOWN, 203, "stc_needshown"}, + {wxEVT_STC_PAINTED, 203, "stc_painted"}, + {wxEVT_STC_USERLISTSELECTION, 203, "stc_userlistselection"}, + {wxEVT_STC_URIDROPPED, 203, "stc_uridropped"}, + {wxEVT_STC_DWELLSTART, 203, "stc_dwellstart"}, + {wxEVT_STC_DWELLEND, 203, "stc_dwellend"}, + {wxEVT_STC_START_DRAG, 203, "stc_start_drag"}, + {wxEVT_STC_DRAG_OVER, 203, "stc_drag_over"}, + {wxEVT_STC_DO_DROP, 203, "stc_do_drop"}, + {wxEVT_STC_ZOOM, 203, "stc_zoom"}, + {wxEVT_STC_HOTSPOT_CLICK, 203, "stc_hotspot_click"}, + {wxEVT_STC_HOTSPOT_DCLICK, 203, "stc_hotspot_dclick"}, + {wxEVT_STC_CALLTIP_CLICK, 203, "stc_calltip_click"}, + {wxEVT_STC_AUTOCOMP_SELECTION, 203, "stc_autocomp_selection"}, + {wxEVT_COMMAND_TREE_BEGIN_DRAG, 208, "command_tree_begin_drag"}, + {wxEVT_COMMAND_TREE_BEGIN_RDRAG, 208, "command_tree_begin_rdrag"}, + {wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 208, "command_tree_begin_label_edit"}, + {wxEVT_COMMAND_TREE_END_LABEL_EDIT, 208, "command_tree_end_label_edit"}, + {wxEVT_COMMAND_TREE_DELETE_ITEM, 208, "command_tree_delete_item"}, + {wxEVT_COMMAND_TREE_GET_INFO, 208, "command_tree_get_info"}, + {wxEVT_COMMAND_TREE_SET_INFO, 208, "command_tree_set_info"}, + {wxEVT_COMMAND_TREE_ITEM_EXPANDED, 208, "command_tree_item_expanded"}, + {wxEVT_COMMAND_TREE_ITEM_EXPANDING, 208, "command_tree_item_expanding"}, + {wxEVT_COMMAND_TREE_ITEM_COLLAPSED, 208, "command_tree_item_collapsed"}, + {wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 208, "command_tree_item_collapsing"}, + {wxEVT_COMMAND_TREE_SEL_CHANGED, 208, "command_tree_sel_changed"}, + {wxEVT_COMMAND_TREE_SEL_CHANGING, 208, "command_tree_sel_changing"}, + {wxEVT_COMMAND_TREE_KEY_DOWN, 208, "command_tree_key_down"}, + {wxEVT_COMMAND_TREE_ITEM_ACTIVATED, 208, "command_tree_item_activated"}, + {wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, 208, "command_tree_item_right_click"}, + {wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 208, "command_tree_item_middle_click"}, + {wxEVT_COMMAND_TREE_END_DRAG, 208, "command_tree_end_drag"}, + {wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 208, "command_tree_state_image_click"}, + {wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 208, "command_tree_item_gettooltip"}, + {wxEVT_COMMAND_TREE_ITEM_MENU, 208, "command_tree_item_menu"}, + {wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 209, "command_notebook_page_changed"}, + {wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 209, "command_notebook_page_changing"}, + {wxEVT_COMMAND_SPINCTRL_UPDATED, 215, "command_spinctrl_updated"}, {wxEVT_SCROLL_LINEUP + wxEVT_USER_FIRST, 165, "spin_up"}, {wxEVT_SCROLL_LINEDOWN + wxEVT_USER_FIRST, 165, "spin_down"}, {wxEVT_SCROLL_THUMBTRACK + wxEVT_USER_FIRST, 165, "spin"}, - {wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 218, "command_splitter_sash_pos_changed"}, - {wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 218, "command_splitter_sash_pos_changing"}, - {wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 218, "command_splitter_doubleclicked"}, - {wxEVT_COMMAND_SPLITTER_UNSPLIT, 218, "command_splitter_unsplit"}, - {wxEVT_COMMAND_HTML_LINK_CLICKED, 220, "command_html_link_clicked"}, - {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 223, "command_auinotebook_page_close"}, - {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 223, "command_auinotebook_page_changed"}, - {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 223, "command_auinotebook_page_changing"}, - {wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 223, "command_auinotebook_button"}, - {wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 223, "command_auinotebook_begin_drag"}, - {wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 223, "command_auinotebook_end_drag"}, - {wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 223, "command_auinotebook_drag_motion"}, - {wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 223, "command_auinotebook_allow_dnd"}, + {wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 217, "command_splitter_sash_pos_changed"}, + {wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 217, "command_splitter_sash_pos_changing"}, + {wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 217, "command_splitter_doubleclicked"}, + {wxEVT_COMMAND_SPLITTER_UNSPLIT, 217, "command_splitter_unsplit"}, + {wxEVT_COMMAND_HTML_LINK_CLICKED, 219, "command_html_link_clicked"}, + {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 222, "command_auinotebook_page_close"}, + {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 222, "command_auinotebook_page_changed"}, + {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 222, "command_auinotebook_page_changing"}, + {wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 222, "command_auinotebook_button"}, + {wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 222, "command_auinotebook_begin_drag"}, + {wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 222, "command_auinotebook_end_drag"}, + {wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 222, "command_auinotebook_drag_motion"}, + {wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 222, "command_auinotebook_allow_dnd"}, #if wxCHECK_VERSION(2,8,5) - {wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, 223, "command_auinotebook_tab_middle_down"}, + {wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, 222, "command_auinotebook_tab_middle_down"}, #endif #if wxCHECK_VERSION(2,8,5) - {wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, 223, "command_auinotebook_tab_middle_up"}, + {wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, 222, "command_auinotebook_tab_middle_up"}, #endif #if wxCHECK_VERSION(2,8,5) - {wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, 223, "command_auinotebook_tab_right_down"}, + {wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, 222, "command_auinotebook_tab_right_down"}, #endif #if wxCHECK_VERSION(2,8,5) - {wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, 223, "command_auinotebook_tab_right_up"}, + {wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, 222, "command_auinotebook_tab_right_up"}, #endif #if wxCHECK_VERSION(2,8,5) - {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, 223, "command_auinotebook_page_closed"}, + {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, 222, "command_auinotebook_page_closed"}, #endif #if wxCHECK_VERSION(2,8,5) - {wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, 223, "command_auinotebook_drag_done"}, + {wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, 222, "command_auinotebook_drag_done"}, #endif #if wxCHECK_VERSION(2,8,5) - {wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 223, "command_auinotebook_bg_dclick"}, + {wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 222, "command_auinotebook_bg_dclick"}, #endif - {wxEVT_AUI_PANE_BUTTON, 224, "aui_pane_button"}, - {wxEVT_AUI_PANE_CLOSE, 224, "aui_pane_close"}, - {wxEVT_AUI_PANE_MAXIMIZE, 224, "aui_pane_maximize"}, - {wxEVT_AUI_PANE_RESTORE, 224, "aui_pane_restore"}, - {wxEVT_AUI_RENDER, 224, "aui_render"}, - {wxEVT_AUI_FIND_MANAGER, 224, "aui_find_manager"}, - {wxEVT_TASKBAR_MOVE, 227, "taskbar_move"}, - {wxEVT_TASKBAR_LEFT_DOWN, 227, "taskbar_left_down"}, - {wxEVT_TASKBAR_LEFT_UP, 227, "taskbar_left_up"}, - {wxEVT_TASKBAR_RIGHT_DOWN, 227, "taskbar_right_down"}, - {wxEVT_TASKBAR_RIGHT_UP, 227, "taskbar_right_up"}, - {wxEVT_TASKBAR_LEFT_DCLICK, 227, "taskbar_left_dclick"}, - {wxEVT_TASKBAR_RIGHT_DCLICK, 227, "taskbar_right_dclick"}, + {wxEVT_AUI_PANE_BUTTON, 223, "aui_pane_button"}, + {wxEVT_AUI_PANE_CLOSE, 223, "aui_pane_close"}, + {wxEVT_AUI_PANE_MAXIMIZE, 223, "aui_pane_maximize"}, + {wxEVT_AUI_PANE_RESTORE, 223, "aui_pane_restore"}, + {wxEVT_AUI_RENDER, 223, "aui_render"}, + {wxEVT_AUI_FIND_MANAGER, 223, "aui_find_manager"}, + {wxEVT_TASKBAR_MOVE, 226, "taskbar_move"}, + {wxEVT_TASKBAR_LEFT_DOWN, 226, "taskbar_left_down"}, + {wxEVT_TASKBAR_LEFT_UP, 226, "taskbar_left_up"}, + {wxEVT_TASKBAR_RIGHT_DOWN, 226, "taskbar_right_down"}, + {wxEVT_TASKBAR_RIGHT_UP, 226, "taskbar_right_up"}, + {wxEVT_TASKBAR_LEFT_DCLICK, 226, "taskbar_left_dclick"}, + {wxEVT_TASKBAR_RIGHT_DCLICK, 226, "taskbar_right_dclick"}, {-1, 0, } }; for(int i=0; event_types[i].ev_type != -1; i++) { @@ -437,7 +423,11 @@ case 169: {// wxKeyEvent rt.addBool(ev->m_shiftDown); rt.addBool(ev->m_altDown); rt.addBool(ev->m_metaDown); +#if !wxCHECK_VERSION(2,9,0) rt.addBool(ev->m_scanCode); +#else + rt.addBool(false); +#endif rt.addInt(ev->m_uniChar); rt.addUint(ev->m_rawCode); rt.addUint(ev->m_rawFlags); @@ -468,14 +458,7 @@ case 172: {// wxPaintEvent rt.addTupleCount(2); break; } -case 173: {// wxNcPaintEvent - evClass = (char*)"wxNcPaintEvent"; - rt.addAtom((char*)"wxNcPaint"); - rt.addAtom(Etype->eName); - rt.addTupleCount(2); - break; -} -case 174: {// wxEraseEvent +case 173: {// wxEraseEvent wxEraseEvent * ev = (wxEraseEvent *) event; wxDC * GetDC = ev->GetDC(); evClass = (char*)"wxEraseEvent"; @@ -485,105 +468,105 @@ case 174: {// wxEraseEvent rt.addTupleCount(3); break; } -case 175: {// wxFocusEvent +case 174: {// wxFocusEvent evClass = (char*)"wxFocusEvent"; rt.addAtom((char*)"wxFocus"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 176: {// wxChildFocusEvent +case 175: {// wxChildFocusEvent evClass = (char*)"wxChildFocusEvent"; rt.addAtom((char*)"wxChildFocus"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 177: {// wxMenuEvent +case 176: {// wxMenuEvent evClass = (char*)"wxMenuEvent"; rt.addAtom((char*)"wxMenu"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 178: {// wxCloseEvent +case 177: {// wxCloseEvent evClass = (char*)"wxCloseEvent"; rt.addAtom((char*)"wxClose"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 179: {// wxShowEvent +case 178: {// wxShowEvent evClass = (char*)"wxShowEvent"; rt.addAtom((char*)"wxShow"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 180: {// wxIconizeEvent +case 179: {// wxIconizeEvent evClass = (char*)"wxIconizeEvent"; rt.addAtom((char*)"wxIconize"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 181: {// wxMaximizeEvent +case 180: {// wxMaximizeEvent evClass = (char*)"wxMaximizeEvent"; rt.addAtom((char*)"wxMaximize"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 182: {// wxJoystickEvent +case 181: {// wxJoystickEvent evClass = (char*)"wxJoystickEvent"; rt.addAtom((char*)"wxJoystick"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 183: {// wxUpdateUIEvent +case 182: {// wxUpdateUIEvent evClass = (char*)"wxUpdateUIEvent"; rt.addAtom((char*)"wxUpdateUI"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 184: {// wxSysColourChangedEvent +case 183: {// wxSysColourChangedEvent evClass = (char*)"wxSysColourChangedEvent"; rt.addAtom((char*)"wxSysColourChanged"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 185: {// wxMouseCaptureChangedEvent +case 184: {// wxMouseCaptureChangedEvent evClass = (char*)"wxMouseCaptureChangedEvent"; rt.addAtom((char*)"wxMouseCaptureChanged"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 186: {// wxDisplayChangedEvent +case 185: {// wxDisplayChangedEvent evClass = (char*)"wxDisplayChangedEvent"; rt.addAtom((char*)"wxDisplayChanged"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 187: {// wxPaletteChangedEvent +case 186: {// wxPaletteChangedEvent evClass = (char*)"wxPaletteChangedEvent"; rt.addAtom((char*)"wxPaletteChanged"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 188: {// wxQueryNewPaletteEvent +case 187: {// wxQueryNewPaletteEvent evClass = (char*)"wxQueryNewPaletteEvent"; rt.addAtom((char*)"wxQueryNewPalette"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 189: {// wxNavigationKeyEvent +case 188: {// wxNavigationKeyEvent wxNavigationKeyEvent * ev = (wxNavigationKeyEvent *) event; evClass = (char*)"wxNavigationKeyEvent"; rt.addAtom((char*)"wxNavigationKey"); @@ -593,42 +576,42 @@ case 189: {// wxNavigationKeyEvent rt.addTupleCount(4); break; } -case 190: {// wxWindowCreateEvent +case 189: {// wxWindowCreateEvent evClass = (char*)"wxWindowCreateEvent"; rt.addAtom((char*)"wxWindowCreate"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 191: {// wxWindowDestroyEvent +case 190: {// wxWindowDestroyEvent evClass = (char*)"wxWindowDestroyEvent"; rt.addAtom((char*)"wxWindowDestroy"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 192: {// wxHelpEvent +case 191: {// wxHelpEvent evClass = (char*)"wxHelpEvent"; rt.addAtom((char*)"wxHelp"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 193: {// wxContextMenuEvent +case 192: {// wxContextMenuEvent evClass = (char*)"wxContextMenuEvent"; rt.addAtom((char*)"wxContextMenu"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 194: {// wxIdleEvent +case 193: {// wxIdleEvent evClass = (char*)"wxIdleEvent"; rt.addAtom((char*)"wxIdle"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 195: {// wxGridEvent +case 194: {// wxGridEvent wxGridEvent * ev = (wxGridEvent *) event; evClass = (char*)"wxGridEvent"; rt.addAtom((char*)"wxGrid"); @@ -645,7 +628,7 @@ case 195: {// wxGridEvent rt.addTupleCount(11); break; } -case 197: {// wxSashEvent +case 196: {// wxSashEvent wxSashEvent * ev = (wxSashEvent *) event; evClass = (char*)"wxSashEvent"; rt.addAtom((char*)"wxSash"); @@ -656,7 +639,7 @@ case 197: {// wxSashEvent rt.addTupleCount(5); break; } -case 198: {// wxListEvent +case 197: {// wxListEvent wxListEvent * ev = (wxListEvent *) event; evClass = (char*)"wxListEvent"; rt.addAtom((char*)"wxList"); @@ -669,7 +652,7 @@ case 198: {// wxListEvent rt.addTupleCount(7); break; } -case 199: {// wxDateEvent +case 198: {// wxDateEvent wxDateEvent * ev = (wxDateEvent *) event; evClass = (char*)"wxDateEvent"; rt.addAtom((char*)"wxDate"); @@ -678,14 +661,14 @@ case 199: {// wxDateEvent rt.addTupleCount(3); break; } -case 200: {// wxCalendarEvent +case 199: {// wxCalendarEvent evClass = (char*)"wxCalendarEvent"; rt.addAtom((char*)"wxCalendar"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 201: {// wxFileDirPickerEvent +case 200: {// wxFileDirPickerEvent wxFileDirPickerEvent * ev = (wxFileDirPickerEvent *) event; evClass = (char*)"wxFileDirPickerEvent"; rt.addAtom((char*)"wxFileDirPicker"); @@ -694,7 +677,7 @@ case 201: {// wxFileDirPickerEvent rt.addTupleCount(3); break; } -case 202: {// wxColourPickerEvent +case 201: {// wxColourPickerEvent wxColourPickerEvent * ev = (wxColourPickerEvent *) event; evClass = (char*)"wxColourPickerEvent"; rt.addAtom((char*)"wxColourPicker"); @@ -703,7 +686,7 @@ case 202: {// wxColourPickerEvent rt.addTupleCount(3); break; } -case 203: {// wxFontPickerEvent +case 202: {// wxFontPickerEvent wxFontPickerEvent * ev = (wxFontPickerEvent *) event; wxFont * GetFont = new wxFont(ev->GetFont()); app->newPtr((void *) GetFont,3, memenv); @@ -714,7 +697,7 @@ case 203: {// wxFontPickerEvent rt.addTupleCount(3); break; } -case 204: {// wxStyledTextEvent +case 203: {// wxStyledTextEvent wxStyledTextEvent * ev = (wxStyledTextEvent *) event; evClass = (char*)"wxStyledTextEvent"; rt.addAtom((char*)"wxStyledText"); @@ -742,7 +725,7 @@ case 204: {// wxStyledTextEvent rt.addTupleCount(22); break; } -case 209: {// wxTreeEvent +case 208: {// wxTreeEvent wxTreeEvent * ev = (wxTreeEvent *) event; evClass = (char*)"wxTreeEvent"; rt.addAtom((char*)"wxTree"); @@ -753,14 +736,14 @@ case 209: {// wxTreeEvent rt.addTupleCount(5); break; } -case 210: {// wxNotebookEvent +case 209: {// wxNotebookEvent evClass = (char*)"wxNotebookEvent"; rt.addAtom((char*)"wxNotebook"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 216: {// wxSpinEvent +case 215: {// wxSpinEvent wxSpinEvent * ev = (wxSpinEvent *) event; evClass = (char*)"wxSpinEvent"; rt.addAtom((char*)"wxSpin"); @@ -769,14 +752,14 @@ case 216: {// wxSpinEvent rt.addTupleCount(3); break; } -case 218: {// wxSplitterEvent +case 217: {// wxSplitterEvent evClass = (char*)"wxSplitterEvent"; rt.addAtom((char*)"wxSplitter"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } -case 220: {// wxHtmlLinkEvent +case 219: {// wxHtmlLinkEvent wxHtmlLinkEvent * ev = (wxHtmlLinkEvent *) event; evClass = (char*)"wxHtmlLinkEvent"; rt.addAtom((char*)"wxHtmlLink"); @@ -785,7 +768,7 @@ case 220: {// wxHtmlLinkEvent rt.addTupleCount(3); break; } -case 223: {// wxAuiNotebookEvent +case 222: {// wxAuiNotebookEvent wxAuiNotebookEvent * ev = (wxAuiNotebookEvent *) event; wxAuiNotebook * GetDragSource = ev->GetDragSource(); evClass = (char*)"wxAuiNotebookEvent"; @@ -797,7 +780,7 @@ case 223: {// wxAuiNotebookEvent rt.addTupleCount(5); break; } -case 224: {// wxAuiManagerEvent +case 223: {// wxAuiManagerEvent wxAuiManagerEvent * ev = (wxAuiManagerEvent *) event; wxAuiManager * GetManager = ev->GetManager(); wxAuiPaneInfo * GetPane = ev->GetPane(); @@ -814,7 +797,7 @@ case 224: {// wxAuiManagerEvent rt.addTupleCount(8); break; } -case 227: {// wxTaskBarIconEvent +case 226: {// wxTaskBarIconEvent evClass = (char*)"wxTaskBarIconEvent"; rt.addAtom((char*)"wxTaskBarIcon"); rt.addAtom(Etype->eName); diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp index 15012011ed..5fbe8a2a9e 100644 --- a/lib/wx/c_src/gen/wxe_funcs.cpp +++ b/lib/wx/c_src/gen/wxe_funcs.cpp @@ -27,6 +27,15 @@ #include "wxe_macros.h" #include "wxe_derived_dest.h" +#if !wxCHECK_VERSION(2,9,0) +#define wxPenJoin int +#define wxPenCap int +#define wxImageResizeQuality int +#define wxPolygonFillMode int +#define wxMappingMode int +#define wxRasterOperationMode int +#define wxFloodFillStyle int +#endif void WxeApp::wxe_dispatch(wxeCommand& Ecmd) { char * bp = Ecmd.buffer; @@ -149,7 +158,7 @@ case wxWindow_new_3: { // wxWindow::wxWindow style = (long)*(int *) bp; bp += 4; } break; }}; - wxWindow * Result = new EwxWindow(parent,(wxWindowID) *id,pos,size,style); + wxWindow * Result = new EwxWindow(parent,*id,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxWindow"); break; @@ -326,7 +335,7 @@ case wxWindow_FindWindow_1_0: { // wxWindow::FindWindow wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * winid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxWindow * Result = (wxWindow*)This->FindWindow((long) *winid); + wxWindow * Result = (wxWindow*)This->FindWindow(*winid); rt.addRef(getRef((void *)Result,memenv), "wxWindow"); break; } @@ -349,7 +358,7 @@ case wxWindow_FindWindowById: { // wxWindow::FindWindowById parent = (wxWindow *) getPtr(bp,memenv); bp += 4; } break; }}; - wxWindow * Result = (wxWindow*)wxWindow::FindWindowById((long) *winid,parent); + wxWindow * Result = (wxWindow*)wxWindow::FindWindowById(*winid,parent); rt.addRef(getRef((void *)Result,memenv), "wxWindow"); break; } @@ -615,7 +624,7 @@ case wxWindow_GetScrollPos: { // wxWindow::GetScrollPos wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * orient = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetScrollPos((int) *orient); + int Result = This->GetScrollPos(*orient); rt.addInt(Result); break; } @@ -623,7 +632,7 @@ case wxWindow_GetScrollRange: { // wxWindow::GetScrollRange wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * orient = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetScrollRange((int) *orient); + int Result = This->GetScrollRange(*orient); rt.addInt(Result); break; } @@ -631,7 +640,7 @@ case wxWindow_GetScrollThumb: { // wxWindow::GetScrollThumb wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * orient = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetScrollThumb((int) *orient); + int Result = This->GetScrollThumb(*orient); rt.addInt(Result); break; } @@ -719,7 +728,7 @@ case wxWindow_HasScrollbar: { // wxWindow::HasScrollbar wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * orient = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->HasScrollbar((int) *orient); + bool Result = This->HasScrollbar(*orient); rt.addBool(Result); break; } @@ -767,7 +776,7 @@ case wxWindow_IsExposed_2: { // wxWindow::IsExposed int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsExposed((int) *x,(int) *y); + bool Result = This->IsExposed(*x,*y); rt.addBool(Result); break; } @@ -778,7 +787,7 @@ case wxWindow_IsExposed_4: { // wxWindow::IsExposed int * w = (int *) bp; bp += 4; int * h = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsExposed((int) *x,(int) *y,(int) *w,(int) *h); + bool Result = This->IsExposed(*x,*y,*w,*h); rt.addBool(Result); break; } @@ -877,7 +886,7 @@ case wxWindow_Move_3: { // wxWindow::Move } break; }}; if(!This) throw wxe_badarg(0); - This->Move((int) *x,(int) *y,flags); + This->Move(*x,*y,flags); break; } case wxWindow_Move_2: { // wxWindow::Move @@ -975,7 +984,7 @@ case wxWindow_PopupMenu_3: { // wxWindow::PopupMenu int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->PopupMenu(menu,(int) *x,(int) *y); + bool Result = This->PopupMenu(menu,*x,*y); rt.addBool(Result); break; } @@ -1071,7 +1080,7 @@ case wxWindow_ScrollLines: { // wxWindow::ScrollLines wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * lines = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->ScrollLines((int) *lines); + bool Result = This->ScrollLines(*lines); rt.addBool(Result); break; } @@ -1079,7 +1088,7 @@ case wxWindow_ScrollPages: { // wxWindow::ScrollPages wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * pages = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->ScrollPages((int) *pages); + bool Result = This->ScrollPages(*pages); rt.addBool(Result); break; } @@ -1100,7 +1109,7 @@ case wxWindow_ScrollWindow: { // wxWindow::ScrollWindow } break; }}; if(!This) throw wxe_badarg(0); - This->ScrollWindow((int) *dx,(int) *dy,rect); + This->ScrollWindow(*dx,*dy,rect); break; } case wxWindow_SetAcceleratorTable: { // wxWindow::SetAcceleratorTable @@ -1114,7 +1123,7 @@ case wxWindow_SetAutoLayout: { // wxWindow::SetAutoLayout wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; bool * autoLayout = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetAutoLayout((bool) *autoLayout); + This->SetAutoLayout(*autoLayout); break; } case wxWindow_SetBackgroundColour: { // wxWindow::SetBackgroundColour @@ -1133,7 +1142,7 @@ case wxWindow_SetBackgroundStyle: { // wxWindow::SetBackgroundStyle wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; wxBackgroundStyle style = *(wxBackgroundStyle *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - bool Result = This->SetBackgroundStyle((wxBackgroundStyle) style); + bool Result = This->SetBackgroundStyle(style); rt.addBool(Result); break; } @@ -1149,7 +1158,7 @@ case wxWindow_SetClientSize_2: { // wxWindow::SetClientSize int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetClientSize((int) *width,(int) *height); + This->SetClientSize(*width,*height); break; } case wxWindow_SetClientSize_1_0: { // wxWindow::SetClientSize @@ -1245,7 +1254,7 @@ case wxWindow_SetExtraStyle: { // wxWindow::SetExtraStyle wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * exStyle = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetExtraStyle((long) *exStyle); + This->SetExtraStyle(*exStyle); break; } case wxWindow_SetFocus: { // wxWindow::SetFocus @@ -1293,7 +1302,7 @@ case wxWindow_SetId: { // wxWindow::SetId wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * winid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetId((wxWindowID) *winid); + This->SetId(*winid); break; } case wxWindow_SetLabel: { // wxWindow::SetLabel @@ -1335,7 +1344,7 @@ case wxWindow_SetScrollbar: { // wxWindow::SetScrollbar } break; }}; if(!This) throw wxe_badarg(0); - This->SetScrollbar((int) *orient,(int) *pos,(int) *thumbVisible,(int) *range,refresh); + This->SetScrollbar(*orient,*pos,*thumbVisible,*range,refresh); break; } case wxWindow_SetScrollPos: { // wxWindow::SetScrollPos @@ -1350,7 +1359,7 @@ case wxWindow_SetScrollPos: { // wxWindow::SetScrollPos } break; }}; if(!This) throw wxe_badarg(0); - This->SetScrollPos((int) *orient,(int) *pos,refresh); + This->SetScrollPos(*orient,*pos,refresh); break; } case wxWindow_SetSize_5: { // wxWindow::SetSize @@ -1367,7 +1376,7 @@ case wxWindow_SetSize_5: { // wxWindow::SetSize } break; }}; if(!This) throw wxe_badarg(0); - This->SetSize((int) *x,(int) *y,(int) *width,(int) *height,sizeFlags); + This->SetSize(*x,*y,*width,*height,sizeFlags); break; } case wxWindow_SetSize_2_0: { // wxWindow::SetSize @@ -1375,7 +1384,7 @@ case wxWindow_SetSize_2_0: { // wxWindow::SetSize int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSize((int) *width,(int) *height); + This->SetSize(*width,*height); break; } case wxWindow_SetSize_1: { // wxWindow::SetSize @@ -1429,7 +1438,7 @@ case wxWindow_SetSizeHints_3: { // wxWindow::SetSizeHints } break; }}; if(!This) throw wxe_badarg(0); - This->SetSizeHints((int) *minW,(int) *minH,maxW,maxH,incW,incH); + This->SetSizeHints(*minW,*minH,maxW,maxH,incW,incH); break; } case wxWindow_SetSizeHints_2: { // wxWindow::SetSizeHints @@ -1488,7 +1497,7 @@ case wxWindow_SetThemeEnabled: { // wxWindow::SetThemeEnabled wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; bool * enableTheme = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetThemeEnabled((bool) *enableTheme); + This->SetThemeEnabled(*enableTheme); break; } case wxWindow_SetToolTip_1_0: { // wxWindow::SetToolTip @@ -1521,7 +1530,7 @@ case wxWindow_SetVirtualSize_2: { // wxWindow::SetVirtualSize int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetVirtualSize((int) *x,(int) *y); + This->SetVirtualSize(*x,*y); break; } case wxWindow_SetVirtualSizeHints_3: { // wxWindow::SetVirtualSizeHints @@ -1540,7 +1549,7 @@ case wxWindow_SetVirtualSizeHints_3: { // wxWindow::SetVirtualSizeHints } break; }}; if(!This) throw wxe_badarg(0); - This->SetVirtualSizeHints((int) *minW,(int) *minH,maxW,maxH); + This->SetVirtualSizeHints(*minW,*minH,maxW,maxH); break; } case wxWindow_SetVirtualSizeHints_2: { // wxWindow::SetVirtualSizeHints @@ -1566,21 +1575,21 @@ case wxWindow_SetWindowStyle: { // wxWindow::SetWindowStyle wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * style = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWindowStyle((long) *style); + This->SetWindowStyle(*style); break; } case wxWindow_SetWindowStyleFlag: { // wxWindow::SetWindowStyleFlag wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; int * style = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWindowStyleFlag((long) *style); + This->SetWindowStyleFlag(*style); break; } case wxWindow_SetWindowVariant: { // wxWindow::SetWindowVariant wxWindow *This = (wxWindow *) getPtr(bp,memenv); bp += 4; wxWindowVariant variant = *(wxWindowVariant *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetWindowVariant((wxWindowVariant) variant); + This->SetWindowVariant(variant); break; } case wxWindow_ShouldInheritColours: { // wxWindow::ShouldInheritColours @@ -1655,13 +1664,13 @@ case wxWindow_WarpPointer: { // wxWindow::WarpPointer int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->WarpPointer((int) *x,(int) *y); + This->WarpPointer(*x,*y); break; } case wxTopLevelWindow_GetIcon: { // wxTopLevelWindow::GetIcon wxTopLevelWindow *This = (wxTopLevelWindow *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxIcon * Result = &This->GetIcon(); + const wxIcon * Result = new wxIcon(This->GetIcon()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxIcon"); break; } @@ -1813,7 +1822,7 @@ case wxTopLevelWindow_ShowFullScreen: { // wxTopLevelWindow::ShowFullScreen } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->ShowFullScreen((bool) *show,style); + bool Result = This->ShowFullScreen(*show,style); rt.addBool(Result); break; } @@ -1843,7 +1852,7 @@ case wxFrame_new_4: { // wxFrame::wxFrame style = (long)*(int *) bp; bp += 4; } break; }}; - wxFrame * Result = new EwxFrame(parent,(wxWindowID) *id,title,pos,size,style); + wxFrame * Result = new EwxFrame(parent,*id,title,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxFrame"); break; @@ -1882,7 +1891,7 @@ case wxFrame_Create: { // wxFrame::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,title,pos,size,style); + bool Result = This->Create(parent,*id,title,pos,size,style); rt.addBool(Result); break; } @@ -1965,7 +1974,7 @@ case wxFrame_ProcessCommand: { // wxFrame::ProcessCommand wxFrame *This = (wxFrame *) getPtr(bp,memenv); bp += 4; int * winid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->ProcessCommand((int) *winid); + bool Result = This->ProcessCommand(*winid); rt.addBool(Result); break; } @@ -1993,7 +2002,7 @@ case wxFrame_SetStatusBarPane: { // wxFrame::SetStatusBarPane wxFrame *This = (wxFrame *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetStatusBarPane((int) *n); + This->SetStatusBarPane(*n); break; } case wxFrame_SetStatusText: { // wxFrame::SetStatusText @@ -2058,7 +2067,7 @@ case wxMiniFrame_new_4: { // wxMiniFrame::wxMiniFrame style = (long)*(int *) bp; bp += 4; } break; }}; - wxMiniFrame * Result = new EwxMiniFrame(parent,(wxWindowID) *id,title,pos,size,style); + wxMiniFrame * Result = new EwxMiniFrame(parent,*id,title,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxMiniFrame"); break; @@ -2091,7 +2100,7 @@ case wxMiniFrame_Create: { // wxMiniFrame::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,title,pos,size,style); + bool Result = This->Create(parent,*id,title,pos,size,style); rt.addBool(Result); break; } @@ -2128,7 +2137,7 @@ case wxSplashScreen_new_6: { // wxSplashScreen::wxSplashScreen style = (long)*(int *) bp; bp += 4; } break; }}; - wxSplashScreen * Result = new EwxSplashScreen(*bitmap,(long) *splashStyle,(int) *milliseconds,parent,(wxWindowID) *id,pos,size,style); + wxSplashScreen * Result = new EwxSplashScreen(*bitmap,*splashStyle,*milliseconds,parent,*id,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxSplashScreen"); break; @@ -2166,7 +2175,7 @@ case wxPanel_new_6: { // wxPanel::wxPanel style = (long)*(int *) bp; bp += 4; } break; }}; - wxPanel * Result = new EwxPanel(parent,(int) *x,(int) *y,(int) *width,(int) *height,style); + wxPanel * Result = new EwxPanel(parent,*x,*y,*width,*height,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxPanel"); break; @@ -2254,7 +2263,7 @@ case wxScrolledWindow_CalcScrolledPosition_4: { // wxScrolledWindow::CalcScrolle int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->CalcScrolledPosition((int) *x,(int) *y,&xx,&yy); + This->CalcScrolledPosition(*x,*y,&xx,&yy); rt.addInt(xx); rt.addInt(yy); rt.addTupleCount(2); @@ -2277,7 +2286,7 @@ case wxScrolledWindow_CalcUnscrolledPosition_4: { // wxScrolledWindow::CalcUnscr int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->CalcUnscrolledPosition((int) *x,(int) *y,&xx,&yy); + This->CalcUnscrolledPosition(*x,*y,&xx,&yy); rt.addInt(xx); rt.addInt(yy); rt.addTupleCount(2); @@ -2298,7 +2307,7 @@ case wxScrolledWindow_EnableScrolling: { // wxScrolledWindow::EnableScrolling bool * x_scrolling = (bool *) bp; bp += 4; bool * y_scrolling = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableScrolling((bool) *x_scrolling,(bool) *y_scrolling); + This->EnableScrolling(*x_scrolling,*y_scrolling); break; } case wxScrolledWindow_GetScrollPixelsPerUnit: { // wxScrolledWindow::GetScrollPixelsPerUnit @@ -2342,7 +2351,7 @@ case wxScrolledWindow_Scroll: { // wxScrolledWindow::Scroll int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Scroll((int) *x,(int) *y); + This->Scroll(*x,*y); break; } case wxScrolledWindow_SetScrollbars: { // wxScrolledWindow::SetScrollbars @@ -2367,7 +2376,7 @@ case wxScrolledWindow_SetScrollbars: { // wxScrolledWindow::SetScrollbars } break; }}; if(!This) throw wxe_badarg(0); - This->SetScrollbars((int) *pixelsPerUnitX,(int) *pixelsPerUnitY,(int) *noUnitsX,(int) *noUnitsY,xPos,yPos,noRefresh); + This->SetScrollbars(*pixelsPerUnitX,*pixelsPerUnitY,*noUnitsX,*noUnitsY,xPos,yPos,noRefresh); break; } case wxScrolledWindow_SetScrollRate: { // wxScrolledWindow::SetScrollRate @@ -2375,7 +2384,7 @@ case wxScrolledWindow_SetScrollRate: { // wxScrolledWindow::SetScrollRate int * xstep = (int *) bp; bp += 4; int * ystep = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetScrollRate((int) *xstep,(int) *ystep); + This->SetScrollRate(*xstep,*ystep); break; } case wxScrolledWindow_SetTargetWindow: { // wxScrolledWindow::SetTargetWindow @@ -2427,7 +2436,7 @@ case wxSashWindow_GetSashVisible: { // wxSashWindow::GetSashVisible wxSashWindow *This = (wxSashWindow *) getPtr(bp,memenv); bp += 4; wxSashEdgePosition edge = *(wxSashEdgePosition *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - bool Result = This->GetSashVisible((wxSashEdgePosition) edge); + bool Result = This->GetSashVisible(edge); rt.addBool(Result); break; } @@ -2463,28 +2472,28 @@ case wxSashWindow_SetMaximumSizeX: { // wxSashWindow::SetMaximumSizeX wxSashWindow *This = (wxSashWindow *) getPtr(bp,memenv); bp += 4; int * max = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMaximumSizeX((int) *max); + This->SetMaximumSizeX(*max); break; } case wxSashWindow_SetMaximumSizeY: { // wxSashWindow::SetMaximumSizeY wxSashWindow *This = (wxSashWindow *) getPtr(bp,memenv); bp += 4; int * max = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMaximumSizeY((int) *max); + This->SetMaximumSizeY(*max); break; } case wxSashWindow_SetMinimumSizeX: { // wxSashWindow::SetMinimumSizeX wxSashWindow *This = (wxSashWindow *) getPtr(bp,memenv); bp += 4; int * min = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMinimumSizeX((int) *min); + This->SetMinimumSizeX(*min); break; } case wxSashWindow_SetMinimumSizeY: { // wxSashWindow::SetMinimumSizeY wxSashWindow *This = (wxSashWindow *) getPtr(bp,memenv); bp += 4; int * min = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMinimumSizeY((int) *min); + This->SetMinimumSizeY(*min); break; } case wxSashWindow_SetSashVisible: { // wxSashWindow::SetSashVisible @@ -2492,7 +2501,7 @@ case wxSashWindow_SetSashVisible: { // wxSashWindow::SetSashVisible wxSashEdgePosition edge = *(wxSashEdgePosition *) bp; bp += 4;; bool * sash = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSashVisible((wxSashEdgePosition) edge,(bool) *sash); + This->SetSashVisible(edge,*sash); break; } case wxSashLayoutWindow_new_0: { // wxSashLayoutWindow::wxSashLayoutWindow @@ -2583,7 +2592,7 @@ case wxSashLayoutWindow_SetAlignment: { // wxSashLayoutWindow::SetAlignment wxSashLayoutWindow *This = (wxSashLayoutWindow *) getPtr(bp,memenv); bp += 4; wxLayoutAlignment align = *(wxLayoutAlignment *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetAlignment((wxLayoutAlignment) align); + This->SetAlignment(align); break; } case wxSashLayoutWindow_SetDefaultSize: { // wxSashLayoutWindow::SetDefaultSize @@ -2599,7 +2608,7 @@ case wxSashLayoutWindow_SetOrientation: { // wxSashLayoutWindow::SetOrientation wxSashLayoutWindow *This = (wxSashLayoutWindow *) getPtr(bp,memenv); bp += 4; wxLayoutOrientation orient = *(wxLayoutOrientation *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetOrientation((wxLayoutOrientation) orient); + This->SetOrientation(orient); break; } case wxGrid_new_0: { // wxGrid::wxGrid @@ -2631,7 +2640,7 @@ case wxGrid_new_3: { // wxGrid::wxGrid style = (long)*(int *) bp; bp += 4; } break; }}; - wxGrid * Result = new EwxGrid(parent,(wxWindowID) *id,pos,size,style); + wxGrid * Result = new EwxGrid(parent,*id,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxGrid"); break; @@ -2655,7 +2664,7 @@ case wxGrid_new_4: { // wxGrid::wxGrid style = (long)*(int *) bp; bp += 4; } break; }}; - wxGrid * Result = new EwxGrid(parent,(int) *x,(int) *y,w,h,style); + wxGrid * Result = new EwxGrid(parent,*x,*y,w,h,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxGrid"); break; @@ -2712,7 +2721,7 @@ case wxGrid_AutoSizeColumn: { // wxGrid::AutoSizeColumn } break; }}; if(!This) throw wxe_badarg(0); - This->AutoSizeColumn((int) *col,setAsMin); + This->AutoSizeColumn(*col,setAsMin); break; } case wxGrid_AutoSizeColumns: { // wxGrid::AutoSizeColumns @@ -2738,7 +2747,7 @@ case wxGrid_AutoSizeRow: { // wxGrid::AutoSizeRow } break; }}; if(!This) throw wxe_badarg(0); - This->AutoSizeRow((int) *row,setAsMin); + This->AutoSizeRow(*row,setAsMin); break; } case wxGrid_AutoSizeRows: { // wxGrid::AutoSizeRows @@ -2806,7 +2815,7 @@ case wxGrid_CellToRect_2: { // wxGrid::CellToRect int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxRect Result = This->CellToRect((int) *row,(int) *col); + wxRect Result = This->CellToRect(*row,*col); rt.add(Result); break; } @@ -2844,7 +2853,7 @@ selmode = *(wxGrid::wxGridSelectionModes *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->CreateGrid((int) *numRows,(int) *numCols,(wxGrid::wxGridSelectionModes) selmode); + bool Result = This->CreateGrid(*numRows,*numCols,selmode); rt.addBool(Result); break; } @@ -2972,7 +2981,7 @@ case wxGrid_EnableEditing: { // wxGrid::EnableEditing wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; bool * edit = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableEditing((bool) *edit); + This->EnableEditing(*edit); break; } case wxGrid_EnableGridLines: { // wxGrid::EnableGridLines @@ -3020,7 +3029,7 @@ case wxGrid_GetCellAlignment: { // wxGrid::GetCellAlignment int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->GetCellAlignment((int) *row,(int) *col,&horiz,&vert); + This->GetCellAlignment(*row,*col,&horiz,&vert); rt.addInt(horiz); rt.addInt(vert); rt.addTupleCount(2); @@ -3031,7 +3040,7 @@ case wxGrid_GetCellBackgroundColour: { // wxGrid::GetCellBackgroundColour int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxColour Result = This->GetCellBackgroundColour((int) *row,(int) *col); + wxColour Result = This->GetCellBackgroundColour(*row,*col); rt.add(Result); break; } @@ -3040,7 +3049,7 @@ case wxGrid_GetCellEditor: { // wxGrid::GetCellEditor int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxGridCellEditor * Result = (wxGridCellEditor*)This->GetCellEditor((int) *row,(int) *col); + wxGridCellEditor * Result = (wxGridCellEditor*)This->GetCellEditor(*row,*col); rt.addRef(getRef((void *)Result,memenv), "wxGridCellEditor"); break; } @@ -3049,7 +3058,7 @@ case wxGrid_GetCellFont: { // wxGrid::GetCellFont int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxFont * Result = new wxFont(This->GetCellFont((int) *row,(int) *col)); newPtr((void *) Result,3, memenv);; + wxFont * Result = new wxFont(This->GetCellFont(*row,*col)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxFont"); break; } @@ -3058,7 +3067,7 @@ case wxGrid_GetCellRenderer: { // wxGrid::GetCellRenderer int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxGridCellRenderer * Result = (wxGridCellRenderer*)This->GetCellRenderer((int) *row,(int) *col); + wxGridCellRenderer * Result = (wxGridCellRenderer*)This->GetCellRenderer(*row,*col); rt.addRef(getRef((void *)Result,memenv), "wxGridCellRenderer"); break; } @@ -3067,7 +3076,7 @@ case wxGrid_GetCellTextColour: { // wxGrid::GetCellTextColour int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxColour Result = This->GetCellTextColour((int) *row,(int) *col); + wxColour Result = This->GetCellTextColour(*row,*col); rt.add(Result); break; } @@ -3076,7 +3085,7 @@ case wxGrid_GetCellValue_2: { // wxGrid::GetCellValue int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetCellValue((int) *row,(int) *col); + wxString Result = This->GetCellValue(*row,*col); rt.add(Result); break; } @@ -3112,7 +3121,7 @@ case wxGrid_GetColLabelValue: { // wxGrid::GetColLabelValue wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetColLabelValue((int) *col); + wxString Result = This->GetColLabelValue(*col); rt.add(Result); break; } @@ -3181,7 +3190,7 @@ case wxGrid_GetDefaultEditorForCell_2: { // wxGrid::GetDefaultEditorForCell int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxGridCellEditor * Result = (wxGridCellEditor*)This->GetDefaultEditorForCell((int) *row,(int) *col); + wxGridCellEditor * Result = (wxGridCellEditor*)This->GetDefaultEditorForCell(*row,*col); rt.addRef(getRef((void *)Result,memenv), "wxGridCellEditor"); break; } @@ -3217,7 +3226,7 @@ case wxGrid_GetDefaultRendererForCell: { // wxGrid::GetDefaultRendererForCell int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxGridCellRenderer * Result = (wxGridCellRenderer*)This->GetDefaultRendererForCell((int) *row,(int) *col); + wxGridCellRenderer * Result = (wxGridCellRenderer*)This->GetDefaultRendererForCell(*row,*col); rt.addRef(getRef((void *)Result,memenv), "wxGridCellRenderer"); break; } @@ -3313,7 +3322,7 @@ case wxGrid_GetOrCreateCellAttr: { // wxGrid::GetOrCreateCellAttr int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxGridCellAttr * Result = (wxGridCellAttr*)This->GetOrCreateCellAttr((int) *row,(int) *col); + wxGridCellAttr * Result = (wxGridCellAttr*)This->GetOrCreateCellAttr(*row,*col); rt.addRef(getRef((void *)Result,memenv), "wxGridCellAttr"); break; } @@ -3346,7 +3355,7 @@ case wxGrid_GetRowLabelValue: { // wxGrid::GetRowLabelValue wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * row = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetRowLabelValue((int) *row); + wxString Result = This->GetRowLabelValue(*row); rt.add(Result); break; } @@ -3354,7 +3363,7 @@ case wxGrid_GetRowSize: { // wxGrid::GetRowSize wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * row = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetRowSize((int) *row); + int Result = This->GetRowSize(*row); rt.addInt(Result); break; } @@ -3541,7 +3550,7 @@ case wxGrid_IsInSelection_2: { // wxGrid::IsInSelection int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsInSelection((int) *row,(int) *col); + bool Result = This->IsInSelection(*row,*col); rt.addBool(Result); break; } @@ -3560,7 +3569,7 @@ case wxGrid_IsReadOnly: { // wxGrid::IsReadOnly int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsReadOnly((int) *row,(int) *col); + bool Result = This->IsReadOnly(*row,*col); rt.addBool(Result); break; } @@ -3583,7 +3592,7 @@ case wxGrid_IsVisible_3: { // wxGrid::IsVisible } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->IsVisible((int) *row,(int) *col,wholeCellVisible); + bool Result = This->IsVisible(*row,*col,wholeCellVisible); rt.addBool(Result); break; } @@ -3609,7 +3618,7 @@ case wxGrid_MakeCellVisible_2: { // wxGrid::MakeCellVisible int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->MakeCellVisible((int) *row,(int) *col); + This->MakeCellVisible(*row,*col); break; } case wxGrid_MakeCellVisible_1: { // wxGrid::MakeCellVisible @@ -3625,7 +3634,7 @@ case wxGrid_MoveCursorDown: { // wxGrid::MoveCursorDown wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; bool * expandSelection = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->MoveCursorDown((bool) *expandSelection); + bool Result = This->MoveCursorDown(*expandSelection); rt.addBool(Result); break; } @@ -3633,7 +3642,7 @@ case wxGrid_MoveCursorLeft: { // wxGrid::MoveCursorLeft wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; bool * expandSelection = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->MoveCursorLeft((bool) *expandSelection); + bool Result = This->MoveCursorLeft(*expandSelection); rt.addBool(Result); break; } @@ -3641,7 +3650,7 @@ case wxGrid_MoveCursorRight: { // wxGrid::MoveCursorRight wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; bool * expandSelection = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->MoveCursorRight((bool) *expandSelection); + bool Result = This->MoveCursorRight(*expandSelection); rt.addBool(Result); break; } @@ -3649,7 +3658,7 @@ case wxGrid_MoveCursorUp: { // wxGrid::MoveCursorUp wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; bool * expandSelection = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->MoveCursorUp((bool) *expandSelection); + bool Result = This->MoveCursorUp(*expandSelection); rt.addBool(Result); break; } @@ -3657,7 +3666,7 @@ case wxGrid_MoveCursorDownBlock: { // wxGrid::MoveCursorDownBlock wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; bool * expandSelection = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->MoveCursorDownBlock((bool) *expandSelection); + bool Result = This->MoveCursorDownBlock(*expandSelection); rt.addBool(Result); break; } @@ -3665,7 +3674,7 @@ case wxGrid_MoveCursorLeftBlock: { // wxGrid::MoveCursorLeftBlock wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; bool * expandSelection = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->MoveCursorLeftBlock((bool) *expandSelection); + bool Result = This->MoveCursorLeftBlock(*expandSelection); rt.addBool(Result); break; } @@ -3673,7 +3682,7 @@ case wxGrid_MoveCursorRightBlock: { // wxGrid::MoveCursorRightBlock wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; bool * expandSelection = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->MoveCursorRightBlock((bool) *expandSelection); + bool Result = This->MoveCursorRightBlock(*expandSelection); rt.addBool(Result); break; } @@ -3681,7 +3690,7 @@ case wxGrid_MoveCursorUpBlock: { // wxGrid::MoveCursorUpBlock wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; bool * expandSelection = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->MoveCursorUpBlock((bool) *expandSelection); + bool Result = This->MoveCursorUpBlock(*expandSelection); rt.addBool(Result); break; } @@ -3736,7 +3745,7 @@ case wxGrid_SelectBlock_5: { // wxGrid::SelectBlock } break; }}; if(!This) throw wxe_badarg(0); - This->SelectBlock((int) *topRow,(int) *leftCol,(int) *bottomRow,(int) *rightCol,addToSelected); + This->SelectBlock(*topRow,*leftCol,*bottomRow,*rightCol,addToSelected); break; } case wxGrid_SelectBlock_3: { // wxGrid::SelectBlock @@ -3768,7 +3777,7 @@ case wxGrid_SelectCol: { // wxGrid::SelectCol } break; }}; if(!This) throw wxe_badarg(0); - This->SelectCol((int) *col,addToSelected); + This->SelectCol(*col,addToSelected); break; } case wxGrid_SelectRow: { // wxGrid::SelectRow @@ -3781,7 +3790,7 @@ case wxGrid_SelectRow: { // wxGrid::SelectRow } break; }}; if(!This) throw wxe_badarg(0); - This->SelectRow((int) *row,addToSelected); + This->SelectRow(*row,addToSelected); break; } case wxGrid_SetCellAlignment_4: { // wxGrid::SetCellAlignment @@ -3791,7 +3800,7 @@ case wxGrid_SetCellAlignment_4: { // wxGrid::SetCellAlignment int * horiz = (int *) bp; bp += 4; int * vert = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCellAlignment((int) *row,(int) *col,(int) *horiz,(int) *vert); + This->SetCellAlignment(*row,*col,*horiz,*vert); break; } case wxGrid_SetCellAlignment_3: { // wxGrid::SetCellAlignment @@ -3800,14 +3809,14 @@ case wxGrid_SetCellAlignment_3: { // wxGrid::SetCellAlignment int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCellAlignment((int) *align,(int) *row,(int) *col); + This->SetCellAlignment(*align,*row,*col); break; } case wxGrid_SetCellAlignment_1: { // wxGrid::SetCellAlignment wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * align = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCellAlignment((int) *align); + This->SetCellAlignment(*align); break; } case wxGrid_SetCellBackgroundColour_3_0: { // wxGrid::SetCellBackgroundColour @@ -3820,7 +3829,7 @@ case wxGrid_SetCellBackgroundColour_3_0: { // wxGrid::SetCellBackgroundColour int * valA = (int *) bp; bp += 4; wxColour val = wxColour(*valR,*valG,*valB,*valA); if(!This) throw wxe_badarg(0); - This->SetCellBackgroundColour((int) *row,(int) *col,val); + This->SetCellBackgroundColour(*row,*col,val); break; } case wxGrid_SetCellBackgroundColour_1: { // wxGrid::SetCellBackgroundColour @@ -3844,7 +3853,7 @@ case wxGrid_SetCellBackgroundColour_3_1: { // wxGrid::SetCellBackgroundColour int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCellBackgroundColour(colour,(int) *row,(int) *col); + This->SetCellBackgroundColour(colour,*row,*col); break; } case wxGrid_SetCellEditor: { // wxGrid::SetCellEditor @@ -3853,7 +3862,7 @@ case wxGrid_SetCellEditor: { // wxGrid::SetCellEditor int * col = (int *) bp; bp += 4; wxGridCellEditor *editor = (wxGridCellEditor *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->SetCellEditor((int) *row,(int) *col,editor); + This->SetCellEditor(*row,*col,editor); break; } case wxGrid_SetCellFont: { // wxGrid::SetCellFont @@ -3862,7 +3871,7 @@ case wxGrid_SetCellFont: { // wxGrid::SetCellFont int * col = (int *) bp; bp += 4; wxFont *val = (wxFont *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->SetCellFont((int) *row,(int) *col,*val); + This->SetCellFont(*row,*col,*val); break; } case wxGrid_SetCellRenderer: { // wxGrid::SetCellRenderer @@ -3871,7 +3880,7 @@ case wxGrid_SetCellRenderer: { // wxGrid::SetCellRenderer int * col = (int *) bp; bp += 4; wxGridCellRenderer *renderer = (wxGridCellRenderer *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->SetCellRenderer((int) *row,(int) *col,renderer); + This->SetCellRenderer(*row,*col,renderer); break; } case wxGrid_SetCellTextColour_3_0: { // wxGrid::SetCellTextColour @@ -3884,7 +3893,7 @@ case wxGrid_SetCellTextColour_3_0: { // wxGrid::SetCellTextColour int * valA = (int *) bp; bp += 4; wxColour val = wxColour(*valR,*valG,*valB,*valA); if(!This) throw wxe_badarg(0); - This->SetCellTextColour((int) *row,(int) *col,val); + This->SetCellTextColour(*row,*col,val); break; } case wxGrid_SetCellTextColour_3_1: { // wxGrid::SetCellTextColour @@ -3897,7 +3906,7 @@ case wxGrid_SetCellTextColour_3_1: { // wxGrid::SetCellTextColour int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCellTextColour(val,(int) *row,(int) *col); + This->SetCellTextColour(val,*row,*col); break; } case wxGrid_SetCellTextColour_1: { // wxGrid::SetCellTextColour @@ -3919,7 +3928,7 @@ case wxGrid_SetCellValue_3_0: { // wxGrid::SetCellValue wxString s = wxString(bp, wxConvUTF8); bp += *sLen+((8-((0+ *sLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetCellValue((int) *row,(int) *col,s); + This->SetCellValue(*row,*col,s); break; } case wxGrid_SetCellValue_2: { // wxGrid::SetCellValue @@ -3942,7 +3951,7 @@ case wxGrid_SetCellValue_3_1: { // wxGrid::SetCellValue int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCellValue(val,(int) *row,(int) *col); + This->SetCellValue(val,*row,*col); break; } case wxGrid_SetColAttr: { // wxGrid::SetColAttr @@ -3950,21 +3959,21 @@ case wxGrid_SetColAttr: { // wxGrid::SetColAttr int * col = (int *) bp; bp += 4; wxGridCellAttr *attr = (wxGridCellAttr *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->SetColAttr((int) *col,attr); + This->SetColAttr(*col,attr); break; } case wxGrid_SetColFormatBool: { // wxGrid::SetColFormatBool wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColFormatBool((int) *col); + This->SetColFormatBool(*col); break; } case wxGrid_SetColFormatNumber: { // wxGrid::SetColFormatNumber wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColFormatNumber((int) *col); + This->SetColFormatNumber(*col); break; } case wxGrid_SetColFormatFloat: { // wxGrid::SetColFormatFloat @@ -3981,7 +3990,7 @@ case wxGrid_SetColFormatFloat: { // wxGrid::SetColFormatFloat } break; }}; if(!This) throw wxe_badarg(0); - This->SetColFormatFloat((int) *col,width,precision); + This->SetColFormatFloat(*col,width,precision); break; } case wxGrid_SetColFormatCustom: { // wxGrid::SetColFormatCustom @@ -3991,7 +4000,7 @@ case wxGrid_SetColFormatCustom: { // wxGrid::SetColFormatCustom wxString typeName = wxString(bp, wxConvUTF8); bp += *typeNameLen+((8-((4+ *typeNameLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetColFormatCustom((int) *col,typeName); + This->SetColFormatCustom(*col,typeName); break; } case wxGrid_SetColLabelAlignment: { // wxGrid::SetColLabelAlignment @@ -3999,14 +4008,14 @@ case wxGrid_SetColLabelAlignment: { // wxGrid::SetColLabelAlignment int * horiz = (int *) bp; bp += 4; int * vert = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColLabelAlignment((int) *horiz,(int) *vert); + This->SetColLabelAlignment(*horiz,*vert); break; } case wxGrid_SetColLabelSize: { // wxGrid::SetColLabelSize wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColLabelSize((int) *height); + This->SetColLabelSize(*height); break; } case wxGrid_SetColLabelValue: { // wxGrid::SetColLabelValue @@ -4016,7 +4025,7 @@ case wxGrid_SetColLabelValue: { // wxGrid::SetColLabelValue wxString val = wxString(bp, wxConvUTF8); bp += *valLen+((8-((4+ *valLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetColLabelValue((int) *col,val); + This->SetColLabelValue(*col,val); break; } case wxGrid_SetColMinimalWidth: { // wxGrid::SetColMinimalWidth @@ -4024,14 +4033,14 @@ case wxGrid_SetColMinimalWidth: { // wxGrid::SetColMinimalWidth int * col = (int *) bp; bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColMinimalWidth((int) *col,(int) *width); + This->SetColMinimalWidth(*col,*width); break; } case wxGrid_SetColMinimalAcceptableWidth: { // wxGrid::SetColMinimalAcceptableWidth wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColMinimalAcceptableWidth((int) *width); + This->SetColMinimalAcceptableWidth(*width); break; } case wxGrid_SetColSize: { // wxGrid::SetColSize @@ -4039,7 +4048,7 @@ case wxGrid_SetColSize: { // wxGrid::SetColSize int * col = (int *) bp; bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColSize((int) *col,(int) *width); + This->SetColSize(*col,*width); break; } case wxGrid_SetDefaultCellAlignment: { // wxGrid::SetDefaultCellAlignment @@ -4047,7 +4056,7 @@ case wxGrid_SetDefaultCellAlignment: { // wxGrid::SetDefaultCellAlignment int * horiz = (int *) bp; bp += 4; int * vert = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetDefaultCellAlignment((int) *horiz,(int) *vert); + This->SetDefaultCellAlignment(*horiz,*vert); break; } case wxGrid_SetDefaultCellBackgroundColour: { // wxGrid::SetDefaultCellBackgroundColour @@ -4103,7 +4112,7 @@ case wxGrid_SetDefaultColSize: { // wxGrid::SetDefaultColSize } break; }}; if(!This) throw wxe_badarg(0); - This->SetDefaultColSize((int) *width,resizeExistingCols); + This->SetDefaultColSize(*width,resizeExistingCols); break; } case wxGrid_SetDefaultRowSize: { // wxGrid::SetDefaultRowSize @@ -4116,7 +4125,7 @@ case wxGrid_SetDefaultRowSize: { // wxGrid::SetDefaultRowSize } break; }}; if(!This) throw wxe_badarg(0); - This->SetDefaultRowSize((int) *height,resizeExistingRows); + This->SetDefaultRowSize(*height,resizeExistingRows); break; } case wxGrid_SetGridCursor: { // wxGrid::SetGridCursor @@ -4124,7 +4133,7 @@ case wxGrid_SetGridCursor: { // wxGrid::SetGridCursor int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetGridCursor((int) *row,(int) *col); + This->SetGridCursor(*row,*col); break; } case wxGrid_SetGridLineColour: { // wxGrid::SetGridLineColour @@ -4172,7 +4181,7 @@ case wxGrid_SetMargins: { // wxGrid::SetMargins int * extraWidth = (int *) bp; bp += 4; int * extraHeight = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMargins((int) *extraWidth,(int) *extraHeight); + This->SetMargins(*extraWidth,*extraHeight); break; } case wxGrid_SetReadOnly: { // wxGrid::SetReadOnly @@ -4187,7 +4196,7 @@ case wxGrid_SetReadOnly: { // wxGrid::SetReadOnly } break; }}; if(!This) throw wxe_badarg(0); - This->SetReadOnly((int) *row,(int) *col,isReadOnly); + This->SetReadOnly(*row,*col,isReadOnly); break; } case wxGrid_SetRowAttr: { // wxGrid::SetRowAttr @@ -4195,7 +4204,7 @@ case wxGrid_SetRowAttr: { // wxGrid::SetRowAttr int * row = (int *) bp; bp += 4; wxGridCellAttr *attr = (wxGridCellAttr *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->SetRowAttr((int) *row,attr); + This->SetRowAttr(*row,attr); break; } case wxGrid_SetRowLabelAlignment: { // wxGrid::SetRowLabelAlignment @@ -4203,14 +4212,14 @@ case wxGrid_SetRowLabelAlignment: { // wxGrid::SetRowLabelAlignment int * horiz = (int *) bp; bp += 4; int * vert = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRowLabelAlignment((int) *horiz,(int) *vert); + This->SetRowLabelAlignment(*horiz,*vert); break; } case wxGrid_SetRowLabelSize: { // wxGrid::SetRowLabelSize wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRowLabelSize((int) *width); + This->SetRowLabelSize(*width); break; } case wxGrid_SetRowLabelValue: { // wxGrid::SetRowLabelValue @@ -4220,7 +4229,7 @@ case wxGrid_SetRowLabelValue: { // wxGrid::SetRowLabelValue wxString val = wxString(bp, wxConvUTF8); bp += *valLen+((8-((4+ *valLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetRowLabelValue((int) *row,val); + This->SetRowLabelValue(*row,val); break; } case wxGrid_SetRowMinimalHeight: { // wxGrid::SetRowMinimalHeight @@ -4228,14 +4237,14 @@ case wxGrid_SetRowMinimalHeight: { // wxGrid::SetRowMinimalHeight int * row = (int *) bp; bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRowMinimalHeight((int) *row,(int) *width); + This->SetRowMinimalHeight(*row,*width); break; } case wxGrid_SetRowMinimalAcceptableHeight: { // wxGrid::SetRowMinimalAcceptableHeight wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRowMinimalAcceptableHeight((int) *width); + This->SetRowMinimalAcceptableHeight(*width); break; } case wxGrid_SetRowSize: { // wxGrid::SetRowSize @@ -4243,21 +4252,21 @@ case wxGrid_SetRowSize: { // wxGrid::SetRowSize int * row = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRowSize((int) *row,(int) *height); + This->SetRowSize(*row,*height); break; } case wxGrid_SetScrollLineX: { // wxGrid::SetScrollLineX wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * x = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetScrollLineX((int) *x); + This->SetScrollLineX(*x); break; } case wxGrid_SetScrollLineY: { // wxGrid::SetScrollLineY wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetScrollLineY((int) *y); + This->SetScrollLineY(*y); break; } case wxGrid_SetSelectionBackground: { // wxGrid::SetSelectionBackground @@ -4286,7 +4295,7 @@ case wxGrid_SetSelectionMode: { // wxGrid::SetSelectionMode wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; wxGrid::wxGridSelectionModes selmode = *(wxGrid::wxGridSelectionModes *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetSelectionMode((wxGrid::wxGridSelectionModes) selmode); + This->SetSelectionMode(selmode); break; } case wxGrid_ShowCellEditControl: { // wxGrid::ShowCellEditControl @@ -4305,7 +4314,7 @@ case wxGrid_XToCol: { // wxGrid::XToCol } break; }}; if(!This) throw wxe_badarg(0); - int Result = This->XToCol((int) *x,clipToMinMax); + int Result = This->XToCol(*x,clipToMinMax); rt.addInt(Result); break; } @@ -4313,7 +4322,7 @@ case wxGrid_XToEdgeOfCol: { // wxGrid::XToEdgeOfCol wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * x = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->XToEdgeOfCol((int) *x); + int Result = This->XToEdgeOfCol(*x); rt.addInt(Result); break; } @@ -4321,7 +4330,7 @@ case wxGrid_YToEdgeOfRow: { // wxGrid::YToEdgeOfRow wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->YToEdgeOfRow((int) *y); + int Result = This->YToEdgeOfRow(*y); rt.addInt(Result); break; } @@ -4329,7 +4338,7 @@ case wxGrid_YToRow: { // wxGrid::YToRow wxGrid *This = (wxGrid *) getPtr(bp,memenv); bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->YToRow((int) *y); + int Result = This->YToRow(*y); rt.addInt(Result); break; } @@ -4347,7 +4356,7 @@ case wxGridCellRenderer_Draw: { // wxGridCellRenderer::Draw int * col = (int *) bp; bp += 4; bool * isSelected = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Draw(*grid,*attr,*dc,rect,(int) *row,(int) *col,(bool) *isSelected); + This->Draw(*grid,*attr,*dc,rect,*row,*col,*isSelected); break; } case wxGridCellRenderer_GetBestSize: { // wxGridCellRenderer::GetBestSize @@ -4358,7 +4367,7 @@ case wxGridCellRenderer_GetBestSize: { // wxGridCellRenderer::GetBestSize int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSize Result = This->GetBestSize(*grid,*attr,*dc,(int) *row,(int) *col); + wxSize Result = This->GetBestSize(*grid,*attr,*dc,*row,*col); rt.add(Result); break; } @@ -4368,7 +4377,7 @@ case wxGridCellEditor_Create: { // wxGridCellEditor::Create int * id = (int *) bp; bp += 4; wxEvtHandler *evtHandler = (wxEvtHandler *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->Create(parent,(wxWindowID) *id,evtHandler); + This->Create(parent,*id,evtHandler); break; } case wxGridCellEditor_IsCreated: { // wxGridCellEditor::IsCreated @@ -4399,9 +4408,10 @@ attr = (wxGridCellAttr *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - This->Show((bool) *show,attr); + This->Show(*show,attr); break; } +#if !wxCHECK_VERSION(2,9,0) case wxGridCellEditor_PaintBackground: { // wxGridCellEditor::PaintBackground wxGridCellEditor *This = (wxGridCellEditor *) getPtr(bp,memenv); bp += 4; int * rectCellX = (int *) bp; bp += 4; @@ -4414,25 +4424,28 @@ case wxGridCellEditor_PaintBackground: { // wxGridCellEditor::PaintBackground This->PaintBackground(rectCell,attr); break; } +#endif case wxGridCellEditor_BeginEdit: { // wxGridCellEditor::BeginEdit wxGridCellEditor *This = (wxGridCellEditor *) getPtr(bp,memenv); bp += 4; int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; wxGrid *grid = (wxGrid *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->BeginEdit((int) *row,(int) *col,grid); + This->BeginEdit(*row,*col,grid); break; } +#if !wxCHECK_VERSION(2,9,0) case wxGridCellEditor_EndEdit: { // wxGridCellEditor::EndEdit wxGridCellEditor *This = (wxGridCellEditor *) getPtr(bp,memenv); bp += 4; int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; wxGrid *grid = (wxGrid *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->EndEdit((int) *row,(int) *col,grid); + bool Result = This->EndEdit(*row,*col,grid); rt.addBool(Result); break; } +#endif case wxGridCellEditor_Reset: { // wxGridCellEditor::Reset wxGridCellEditor *This = (wxGridCellEditor *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); @@ -4552,14 +4565,14 @@ case wxGridCellFloatRenderer_SetPrecision: { // wxGridCellFloatRenderer::SetPrec wxGridCellFloatRenderer *This = (wxGridCellFloatRenderer *) getPtr(bp,memenv); bp += 4; int * precision = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPrecision((int) *precision); + This->SetPrecision(*precision); break; } case wxGridCellFloatRenderer_SetWidth: { // wxGridCellFloatRenderer::SetWidth wxGridCellFloatRenderer *This = (wxGridCellFloatRenderer *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWidth((int) *width); + This->SetWidth(*width); break; } case wxGridCellFloatRenderer_destroy: { // wxGridCellFloatRenderer::destroy @@ -4753,7 +4766,7 @@ case wxGridCellAttr_SetAlignment: { // wxGridCellAttr::SetAlignment int * hAlign = (int *) bp; bp += 4; int * vAlign = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetAlignment((int) *hAlign,(int) *vAlign); + This->SetAlignment(*hAlign,*vAlign); break; } case wxGridCellAttr_SetReadOnly: { // wxGridCellAttr::SetReadOnly @@ -4863,7 +4876,7 @@ case wxGridCellAttr_GetRenderer: { // wxGridCellAttr::GetRenderer int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxGridCellRenderer * Result = (wxGridCellRenderer*)This->GetRenderer(grid,(int) *row,(int) *col); + wxGridCellRenderer * Result = (wxGridCellRenderer*)This->GetRenderer(grid,*row,*col); rt.addRef(getRef((void *)Result,memenv), "wxGridCellRenderer"); break; } @@ -4873,7 +4886,7 @@ case wxGridCellAttr_GetEditor: { // wxGridCellAttr::GetEditor int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxGridCellEditor * Result = (wxGridCellEditor*)This->GetEditor(grid,(int) *row,(int) *col); + wxGridCellEditor * Result = (wxGridCellEditor*)This->GetEditor(grid,*row,*col); rt.addRef(getRef((void *)Result,memenv), "wxGridCellEditor"); break; } @@ -4892,7 +4905,7 @@ case wxGridCellAttr_SetDefAttr: { // wxGridCellAttr::SetDefAttr break; } case wxDC_Blit: { // wxDC::Blit - int rop=wxCOPY; + wxRasterOperationMode rop=wxCOPY; bool useMask=false; wxPoint srcPtMask= wxDefaultPosition; wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; @@ -4908,7 +4921,7 @@ case wxDC_Blit: { // wxDC::Blit wxPoint srcPt = wxPoint(*srcPtX,*srcPtY); while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - rop = (int)*(int *) bp; bp += 4; +rop = *(wxRasterOperationMode *) bp; bp += 4;; } break; case 2: {bp += 4; useMask = *(bool *) bp; bp += 4; @@ -4930,7 +4943,7 @@ case wxDC_CalcBoundingBox: { // wxDC::CalcBoundingBox int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->CalcBoundingBox((wxCoord) *x,(wxCoord) *y); + This->CalcBoundingBox(*x,*y); break; } case wxDC_Clear: { // wxDC::Clear @@ -4939,12 +4952,14 @@ case wxDC_Clear: { // wxDC::Clear This->Clear(); break; } +#if !wxCHECK_VERSION(2,9,0) case wxDC_ComputeScaleAndOrigin: { // wxDC::ComputeScaleAndOrigin wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); This->ComputeScaleAndOrigin(); break; } +#endif case wxDC_CrossHair: { // wxDC::CrossHair wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * ptX = (int *) bp; bp += 4; @@ -4964,7 +4979,7 @@ case wxDC_DeviceToLogicalX: { // wxDC::DeviceToLogicalX wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * x = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxCoord Result = This->DeviceToLogicalX((wxCoord) *x); + wxCoord Result = This->DeviceToLogicalX(*x); rt.addInt(Result); break; } @@ -4972,7 +4987,7 @@ case wxDC_DeviceToLogicalXRel: { // wxDC::DeviceToLogicalXRel wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * x = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxCoord Result = This->DeviceToLogicalXRel((wxCoord) *x); + wxCoord Result = This->DeviceToLogicalXRel(*x); rt.addInt(Result); break; } @@ -4980,7 +4995,7 @@ case wxDC_DeviceToLogicalY: { // wxDC::DeviceToLogicalY wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxCoord Result = This->DeviceToLogicalY((wxCoord) *y); + wxCoord Result = This->DeviceToLogicalY(*y); rt.addInt(Result); break; } @@ -4988,7 +5003,7 @@ case wxDC_DeviceToLogicalYRel: { // wxDC::DeviceToLogicalYRel wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxCoord Result = This->DeviceToLogicalYRel((wxCoord) *y); + wxCoord Result = This->DeviceToLogicalYRel(*y); rt.addInt(Result); break; } @@ -5041,7 +5056,7 @@ case wxDC_DrawCircle: { // wxDC::DrawCircle wxPoint pt = wxPoint(*ptX,*ptY); int * radius = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->DrawCircle(pt,(wxCoord) *radius); + This->DrawCircle(pt,*radius); break; } case wxDC_DrawEllipse_2: { // wxDC::DrawEllipse @@ -5079,7 +5094,7 @@ case wxDC_DrawEllipticArc: { // wxDC::DrawEllipticArc double * sa = (double *) bp; bp += 8; double * ea = (double *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawEllipticArc(pt,sz,(double) *sa,(double) *ea); + This->DrawEllipticArc(pt,sz,*sa,*ea); break; } case wxDC_DrawIcon: { // wxDC::DrawIcon @@ -5155,7 +5170,7 @@ case wxDC_DrawLines: { // wxDC::DrawLines case wxDC_DrawPolygon: { // wxDC::DrawPolygon wxCoord xoffset=0; wxCoord yoffset=0; - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * pointsLen = (int *) bp; bp += 4; wxPoint *points; @@ -5172,7 +5187,7 @@ case wxDC_DrawPolygon: { // wxDC::DrawPolygon yoffset = (wxCoord)*(int *) bp; bp += 4; } break; case 3: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); @@ -5222,7 +5237,7 @@ case wxDC_DrawRotatedText: { // wxDC::DrawRotatedText wxPoint pt = wxPoint(*ptX,*ptY); double * angle = (double *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawRotatedText(text,pt,(double) *angle); + This->DrawRotatedText(text,pt,*angle); break; } case wxDC_DrawRoundedRectangle_3: { // wxDC::DrawRoundedRectangle @@ -5236,7 +5251,7 @@ case wxDC_DrawRoundedRectangle_3: { // wxDC::DrawRoundedRectangle bp += 4; /* Align */ double * radius = (double *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawRoundedRectangle(pt,sz,(double) *radius); + This->DrawRoundedRectangle(pt,sz,*radius); break; } case wxDC_DrawRoundedRectangle_2: { // wxDC::DrawRoundedRectangle @@ -5249,7 +5264,7 @@ case wxDC_DrawRoundedRectangle_2: { // wxDC::DrawRoundedRectangle bp += 4; /* Align */ double * radius = (double *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawRoundedRectangle(r,(double) *radius); + This->DrawRoundedRectangle(r,*radius); break; } case wxDC_DrawText: { // wxDC::DrawText @@ -5277,7 +5292,7 @@ case wxDC_EndPage: { // wxDC::EndPage break; } case wxDC_FloodFill: { // wxDC::FloodFill - int style=wxFLOOD_SURFACE; + wxFloodFillStyle style=wxFLOOD_SURFACE; wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * ptX = (int *) bp; bp += 4; int * ptY = (int *) bp; bp += 4; @@ -5290,7 +5305,7 @@ case wxDC_FloodFill: { // wxDC::FloodFill bp += 4; /* Align */ while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - style = (int)*(int *) bp; bp += 4; +style = *(wxFloodFillStyle *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); @@ -5591,14 +5606,14 @@ nDirection = *(wxDirection *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - This->GradientFillLinear(rect,initialColour,destColour,(wxDirection) nDirection); + This->GradientFillLinear(rect,initialColour,destColour,nDirection); break; } case wxDC_LogicalToDeviceX: { // wxDC::LogicalToDeviceX wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * x = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxCoord Result = This->LogicalToDeviceX((wxCoord) *x); + wxCoord Result = This->LogicalToDeviceX(*x); rt.addInt(Result); break; } @@ -5606,7 +5621,7 @@ case wxDC_LogicalToDeviceXRel: { // wxDC::LogicalToDeviceXRel wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * x = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxCoord Result = This->LogicalToDeviceXRel((wxCoord) *x); + wxCoord Result = This->LogicalToDeviceXRel(*x); rt.addInt(Result); break; } @@ -5614,7 +5629,7 @@ case wxDC_LogicalToDeviceY: { // wxDC::LogicalToDeviceY wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxCoord Result = This->LogicalToDeviceY((wxCoord) *y); + wxCoord Result = This->LogicalToDeviceY(*y); rt.addInt(Result); break; } @@ -5622,7 +5637,7 @@ case wxDC_LogicalToDeviceYRel: { // wxDC::LogicalToDeviceYRel wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxCoord Result = This->LogicalToDeviceYRel((wxCoord) *y); + wxCoord Result = This->LogicalToDeviceYRel(*y); rt.addInt(Result); break; } @@ -5672,7 +5687,7 @@ case wxDC_SetAxisOrientation: { // wxDC::SetAxisOrientation bool * xLeftRight = (bool *) bp; bp += 4; bool * yBottomUp = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetAxisOrientation((bool) *xLeftRight,(bool) *yBottomUp); + This->SetAxisOrientation(*xLeftRight,*yBottomUp); break; } case wxDC_SetBackground: { // wxDC::SetBackground @@ -5686,7 +5701,7 @@ case wxDC_SetBackgroundMode: { // wxDC::SetBackgroundMode wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * mode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetBackgroundMode((int) *mode); + This->SetBackgroundMode(*mode); break; } case wxDC_SetBrush: { // wxDC::SetBrush @@ -5731,7 +5746,7 @@ case wxDC_SetDeviceOrigin: { // wxDC::SetDeviceOrigin int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetDeviceOrigin((wxCoord) *x,(wxCoord) *y); + This->SetDeviceOrigin(*x,*y); break; } case wxDC_SetFont: { // wxDC::SetFont @@ -5745,21 +5760,21 @@ case wxDC_SetLayoutDirection: { // wxDC::SetLayoutDirection wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; wxLayoutDirection dir = *(wxLayoutDirection *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetLayoutDirection((wxLayoutDirection) dir); + This->SetLayoutDirection(dir); break; } case wxDC_SetLogicalFunction: { // wxDC::SetLogicalFunction wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; - int * function = (int *) bp; bp += 4; + wxRasterOperationMode function = *(wxRasterOperationMode *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetLogicalFunction((int) *function); + This->SetLogicalFunction(function); break; } case wxDC_SetMapMode: { // wxDC::SetMapMode wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; - int * mode = (int *) bp; bp += 4; + wxMappingMode mode = *(wxMappingMode *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetMapMode((int) *mode); + This->SetMapMode(mode); break; } case wxDC_SetPalette: { // wxDC::SetPalette @@ -5804,7 +5819,7 @@ case wxDC_SetUserScale: { // wxDC::SetUserScale double * x = (double *) bp; bp += 8; double * y = (double *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->SetUserScale((double) *x,(double) *y); + This->SetUserScale(*x,*y); break; } case wxDC_StartDoc: { // wxDC::StartDoc @@ -5826,7 +5841,7 @@ case wxDC_StartPage: { // wxDC::StartPage case wxMirrorDC_new: { // wxMirrorDC::wxMirrorDC wxDC *dc = (wxDC *) getPtr(bp,memenv); bp += 4; bool * mirror = (bool *) bp; bp += 4; - wxMirrorDC * Result = new EwxMirrorDC(*dc,(bool) *mirror); + wxMirrorDC * Result = new EwxMirrorDC(*dc,*mirror); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxMirrorDC"); break; @@ -5850,22 +5865,28 @@ case wxPostScriptDC_new_1: { // wxPostScriptDC::wxPostScriptDC rt.addRef(getRef((void *)Result,memenv), "wxPostScriptDC"); break; } +#if !wxCHECK_VERSION(2,9,0) case wxPostScriptDC_SetResolution: { // wxPostScriptDC::SetResolution int * ppi = (int *) bp; bp += 4; - wxPostScriptDC::SetResolution((int) *ppi); + wxPostScriptDC::SetResolution(*ppi); break; } +#endif +#if !wxCHECK_VERSION(2,9,0) case wxPostScriptDC_GetResolution: { // wxPostScriptDC::GetResolution int Result = wxPostScriptDC::GetResolution(); rt.addInt(Result); break; } +#endif +#if !wxCHECK_VERSION(2,9,0) case wxWindowDC_new_0: { // wxWindowDC::wxWindowDC wxWindowDC * Result = new EwxWindowDC(); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxWindowDC"); break; } +#endif case wxWindowDC_new_1: { // wxWindowDC::wxWindowDC wxWindow *win = (wxWindow *) getPtr(bp,memenv); bp += 4; wxWindowDC * Result = new EwxWindowDC(win); @@ -5873,12 +5894,14 @@ case wxWindowDC_new_1: { // wxWindowDC::wxWindowDC rt.addRef(getRef((void *)Result,memenv), "wxWindowDC"); break; } +#if !wxCHECK_VERSION(2,9,0) case wxClientDC_new_0: { // wxClientDC::wxClientDC wxClientDC * Result = new EwxClientDC(); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxClientDC"); break; } +#endif case wxClientDC_new_1: { // wxClientDC::wxClientDC wxWindow *win = (wxWindow *) getPtr(bp,memenv); bp += 4; wxClientDC * Result = new EwxClientDC(win); @@ -5886,12 +5909,14 @@ case wxClientDC_new_1: { // wxClientDC::wxClientDC rt.addRef(getRef((void *)Result,memenv), "wxClientDC"); break; } +#if !wxCHECK_VERSION(2,9,0) case wxPaintDC_new_0: { // wxPaintDC::wxPaintDC wxPaintDC * Result = new EwxPaintDC(); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxPaintDC"); break; } +#endif case wxPaintDC_new_1: { // wxPaintDC::wxPaintDC wxWindow *win = (wxWindow *) getPtr(bp,memenv); bp += 4; wxPaintDC * Result = new EwxPaintDC(win); @@ -6085,6 +6110,7 @@ case wxGraphicsContext_CreateBrush: { // wxGraphicsContext::CreateBrush rt.addRef(getRef((void *)Result,memenv), "wxGraphicsBrush"); break; } +#if !wxCHECK_VERSION(2,9,0) case wxGraphicsContext_CreateRadialGradientBrush: { // wxGraphicsContext::CreateRadialGradientBrush wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; bp += 4; /* Align */ @@ -6104,10 +6130,12 @@ case wxGraphicsContext_CreateRadialGradientBrush: { // wxGraphicsContext::Create int * cColorA = (int *) bp; bp += 4; wxColour cColor = wxColour(*cColorR,*cColorG,*cColorB,*cColorA); if(!This) throw wxe_badarg(0); - wxGraphicsBrush * Result = new wxGraphicsBrush(This->CreateRadialGradientBrush((wxDouble) *xo,(wxDouble) *yo,(wxDouble) *xc,(wxDouble) *yc,(wxDouble) *radius,oColor,cColor)); newPtr((void *) Result,3, memenv);; + wxGraphicsBrush * Result = new wxGraphicsBrush(This->CreateRadialGradientBrush(*xo,*yo,*xc,*yc,*radius,oColor,cColor)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxGraphicsBrush"); break; } +#endif +#if !wxCHECK_VERSION(2,9,0) case wxGraphicsContext_CreateLinearGradientBrush: { // wxGraphicsContext::CreateLinearGradientBrush wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; bp += 4; /* Align */ @@ -6126,10 +6154,11 @@ case wxGraphicsContext_CreateLinearGradientBrush: { // wxGraphicsContext::Create int * c2A = (int *) bp; bp += 4; wxColour c2 = wxColour(*c2R,*c2G,*c2B,*c2A); if(!This) throw wxe_badarg(0); - wxGraphicsBrush * Result = new wxGraphicsBrush(This->CreateLinearGradientBrush((wxDouble) *x1,(wxDouble) *y1,(wxDouble) *x2,(wxDouble) *y2,c1,c2)); newPtr((void *) Result,3, memenv);; + wxGraphicsBrush * Result = new wxGraphicsBrush(This->CreateLinearGradientBrush(*x1,*y1,*x2,*y2,c1,c2)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxGraphicsBrush"); break; } +#endif case wxGraphicsContext_CreateFont: { // wxGraphicsContext::CreateFont wxColour col= *wxBLACK; wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; @@ -6211,7 +6240,7 @@ case wxGraphicsContext_Clip_4: { // wxGraphicsContext::Clip wxDouble * w = (wxDouble *) bp; bp += 8; wxDouble * h = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->Clip((wxDouble) *x,(wxDouble) *y,(wxDouble) *w,(wxDouble) *h); + This->Clip(*x,*y,*w,*h); break; } case wxGraphicsContext_ResetClip: { // wxGraphicsContext::ResetClip @@ -6228,7 +6257,7 @@ case wxGraphicsContext_DrawBitmap: { // wxGraphicsContext::DrawBitmap wxDouble * w = (wxDouble *) bp; bp += 8; wxDouble * h = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawBitmap(*bmp,(wxDouble) *x,(wxDouble) *y,(wxDouble) *w,(wxDouble) *h); + This->DrawBitmap(*bmp,*x,*y,*w,*h); break; } case wxGraphicsContext_DrawEllipse: { // wxGraphicsContext::DrawEllipse @@ -6239,7 +6268,7 @@ case wxGraphicsContext_DrawEllipse: { // wxGraphicsContext::DrawEllipse wxDouble * w = (wxDouble *) bp; bp += 8; wxDouble * h = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawEllipse((wxDouble) *x,(wxDouble) *y,(wxDouble) *w,(wxDouble) *h); + This->DrawEllipse(*x,*y,*w,*h); break; } case wxGraphicsContext_DrawIcon: { // wxGraphicsContext::DrawIcon @@ -6250,11 +6279,11 @@ case wxGraphicsContext_DrawIcon: { // wxGraphicsContext::DrawIcon wxDouble * w = (wxDouble *) bp; bp += 8; wxDouble * h = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawIcon(*icon,(wxDouble) *x,(wxDouble) *y,(wxDouble) *w,(wxDouble) *h); + This->DrawIcon(*icon,*x,*y,*w,*h); break; } case wxGraphicsContext_DrawLines: { // wxGraphicsContext::DrawLines - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; int * pointsLen = (int *) bp; bp += 4; wxPoint2DDouble *points; @@ -6265,7 +6294,7 @@ case wxGraphicsContext_DrawLines: { // wxGraphicsContext::DrawLines points[i] = wxPoint2DDouble(x,y);} while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); @@ -6274,12 +6303,12 @@ case wxGraphicsContext_DrawLines: { // wxGraphicsContext::DrawLines break; } case wxGraphicsContext_DrawPath: { // wxGraphicsContext::DrawPath - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; wxGraphicsPath *path = (wxGraphicsPath *) getPtr(bp,memenv); bp += 4; while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); @@ -6294,7 +6323,7 @@ case wxGraphicsContext_DrawRectangle: { // wxGraphicsContext::DrawRectangle wxDouble * w = (wxDouble *) bp; bp += 8; wxDouble * h = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawRectangle((wxDouble) *x,(wxDouble) *y,(wxDouble) *w,(wxDouble) *h); + This->DrawRectangle(*x,*y,*w,*h); break; } case wxGraphicsContext_DrawRoundedRectangle: { // wxGraphicsContext::DrawRoundedRectangle @@ -6306,7 +6335,7 @@ case wxGraphicsContext_DrawRoundedRectangle: { // wxGraphicsContext::DrawRounded wxDouble * h = (wxDouble *) bp; bp += 8; wxDouble * radius = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawRoundedRectangle((wxDouble) *x,(wxDouble) *y,(wxDouble) *w,(wxDouble) *h,(wxDouble) *radius); + This->DrawRoundedRectangle(*x,*y,*w,*h,*radius); break; } case wxGraphicsContext_DrawText_3: { // wxGraphicsContext::DrawText @@ -6317,7 +6346,7 @@ case wxGraphicsContext_DrawText_3: { // wxGraphicsContext::DrawText wxDouble * x = (wxDouble *) bp; bp += 8; wxDouble * y = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawText(str,(wxDouble) *x,(wxDouble) *y); + This->DrawText(str,*x,*y); break; } case wxGraphicsContext_DrawText_4_0: { // wxGraphicsContext::DrawText @@ -6329,7 +6358,7 @@ case wxGraphicsContext_DrawText_4_0: { // wxGraphicsContext::DrawText wxDouble * y = (wxDouble *) bp; bp += 8; wxDouble * angle = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->DrawText(str,(wxDouble) *x,(wxDouble) *y,(wxDouble) *angle); + This->DrawText(str,*x,*y,*angle); break; } case wxGraphicsContext_DrawText_4_1: { // wxGraphicsContext::DrawText @@ -6341,7 +6370,7 @@ case wxGraphicsContext_DrawText_4_1: { // wxGraphicsContext::DrawText wxDouble * y = (wxDouble *) bp; bp += 8; wxGraphicsBrush *backgroundBrush = (wxGraphicsBrush *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->DrawText(str,(wxDouble) *x,(wxDouble) *y,*backgroundBrush); + This->DrawText(str,*x,*y,*backgroundBrush); break; } case wxGraphicsContext_DrawText_5: { // wxGraphicsContext::DrawText @@ -6354,16 +6383,16 @@ case wxGraphicsContext_DrawText_5: { // wxGraphicsContext::DrawText wxDouble * angle = (wxDouble *) bp; bp += 8; wxGraphicsBrush *backgroundBrush = (wxGraphicsBrush *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->DrawText(str,(wxDouble) *x,(wxDouble) *y,(wxDouble) *angle,*backgroundBrush); + This->DrawText(str,*x,*y,*angle,*backgroundBrush); break; } case wxGraphicsContext_FillPath: { // wxGraphicsContext::FillPath - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; wxGraphicsPath *path = (wxGraphicsPath *) getPtr(bp,memenv); bp += 4; while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); @@ -6411,7 +6440,7 @@ case wxGraphicsContext_Rotate: { // wxGraphicsContext::Rotate bp += 4; /* Align */ wxDouble * angle = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->Rotate((wxDouble) *angle); + This->Rotate(*angle); break; } case wxGraphicsContext_Scale: { // wxGraphicsContext::Scale @@ -6420,7 +6449,7 @@ case wxGraphicsContext_Scale: { // wxGraphicsContext::Scale wxDouble * xScale = (wxDouble *) bp; bp += 8; wxDouble * yScale = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->Scale((wxDouble) *xScale,(wxDouble) *yScale); + This->Scale(*xScale,*yScale); break; } case wxGraphicsContext_Translate: { // wxGraphicsContext::Translate @@ -6429,7 +6458,7 @@ case wxGraphicsContext_Translate: { // wxGraphicsContext::Translate wxDouble * dx = (wxDouble *) bp; bp += 8; wxDouble * dy = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->Translate((wxDouble) *dx,(wxDouble) *dy); + This->Translate(*dx,*dy); break; } case wxGraphicsContext_GetTransform: { // wxGraphicsContext::GetTransform @@ -6508,7 +6537,7 @@ case wxGraphicsContext_StrokeLine: { // wxGraphicsContext::StrokeLine wxDouble * x2 = (wxDouble *) bp; bp += 8; wxDouble * y2 = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->StrokeLine((wxDouble) *x1,(wxDouble) *y1,(wxDouble) *x2,(wxDouble) *y2); + This->StrokeLine(*x1,*y1,*x2,*y2); break; } case wxGraphicsContext_StrokeLines: { // wxGraphicsContext::StrokeLines @@ -6579,7 +6608,7 @@ case wxGraphicsMatrix_Rotate: { // wxGraphicsMatrix::Rotate bp += 4; /* Align */ wxDouble * angle = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->Rotate((wxDouble) *angle); + This->Rotate(*angle); break; } case wxGraphicsMatrix_Scale: { // wxGraphicsMatrix::Scale @@ -6588,7 +6617,7 @@ case wxGraphicsMatrix_Scale: { // wxGraphicsMatrix::Scale wxDouble * xScale = (wxDouble *) bp; bp += 8; wxDouble * yScale = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->Scale((wxDouble) *xScale,(wxDouble) *yScale); + This->Scale(*xScale,*yScale); break; } case wxGraphicsMatrix_Translate: { // wxGraphicsMatrix::Translate @@ -6597,7 +6626,7 @@ case wxGraphicsMatrix_Translate: { // wxGraphicsMatrix::Translate wxDouble * dx = (wxDouble *) bp; bp += 8; wxDouble * dy = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->Translate((wxDouble) *dx,(wxDouble) *dy); + This->Translate(*dx,*dy); break; } case wxGraphicsMatrix_Set: { // wxGraphicsMatrix::Set @@ -6669,7 +6698,7 @@ case wxGraphicsPath_MoveToPoint_2: { // wxGraphicsPath::MoveToPoint wxDouble * x = (wxDouble *) bp; bp += 8; wxDouble * y = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->MoveToPoint((wxDouble) *x,(wxDouble) *y); + This->MoveToPoint(*x,*y); break; } case wxGraphicsPath_MoveToPoint_1: { // wxGraphicsPath::MoveToPoint @@ -6692,7 +6721,7 @@ case wxGraphicsPath_AddArc_6: { // wxGraphicsPath::AddArc wxDouble * endAngle = (wxDouble *) bp; bp += 8; bool * clockwise = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AddArc((wxDouble) *x,(wxDouble) *y,(wxDouble) *r,(wxDouble) *startAngle,(wxDouble) *endAngle,(bool) *clockwise); + This->AddArc(*x,*y,*r,*startAngle,*endAngle,*clockwise); break; } case wxGraphicsPath_AddArc_5: { // wxGraphicsPath::AddArc @@ -6706,7 +6735,7 @@ case wxGraphicsPath_AddArc_5: { // wxGraphicsPath::AddArc wxDouble * endAngle = (wxDouble *) bp; bp += 8; bool * clockwise = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AddArc(c,(wxDouble) *r,(wxDouble) *startAngle,(wxDouble) *endAngle,(bool) *clockwise); + This->AddArc(c,*r,*startAngle,*endAngle,*clockwise); break; } case wxGraphicsPath_AddArcToPoint: { // wxGraphicsPath::AddArcToPoint @@ -6718,7 +6747,7 @@ case wxGraphicsPath_AddArcToPoint: { // wxGraphicsPath::AddArcToPoint wxDouble * y2 = (wxDouble *) bp; bp += 8; wxDouble * r = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->AddArcToPoint((wxDouble) *x1,(wxDouble) *y1,(wxDouble) *x2,(wxDouble) *y2,(wxDouble) *r); + This->AddArcToPoint(*x1,*y1,*x2,*y2,*r); break; } case wxGraphicsPath_AddCircle: { // wxGraphicsPath::AddCircle @@ -6728,7 +6757,7 @@ case wxGraphicsPath_AddCircle: { // wxGraphicsPath::AddCircle wxDouble * y = (wxDouble *) bp; bp += 8; wxDouble * r = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->AddCircle((wxDouble) *x,(wxDouble) *y,(wxDouble) *r); + This->AddCircle(*x,*y,*r); break; } case wxGraphicsPath_AddCurveToPoint_6: { // wxGraphicsPath::AddCurveToPoint @@ -6741,7 +6770,7 @@ case wxGraphicsPath_AddCurveToPoint_6: { // wxGraphicsPath::AddCurveToPoint wxDouble * x = (wxDouble *) bp; bp += 8; wxDouble * y = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->AddCurveToPoint((wxDouble) *cx1,(wxDouble) *cy1,(wxDouble) *cx2,(wxDouble) *cy2,(wxDouble) *x,(wxDouble) *y); + This->AddCurveToPoint(*cx1,*cy1,*cx2,*cy2,*x,*y); break; } case wxGraphicsPath_AddCurveToPoint_3: { // wxGraphicsPath::AddCurveToPoint @@ -6768,7 +6797,7 @@ case wxGraphicsPath_AddEllipse: { // wxGraphicsPath::AddEllipse wxDouble * w = (wxDouble *) bp; bp += 8; wxDouble * h = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->AddEllipse((wxDouble) *x,(wxDouble) *y,(wxDouble) *w,(wxDouble) *h); + This->AddEllipse(*x,*y,*w,*h); break; } case wxGraphicsPath_AddLineToPoint_2: { // wxGraphicsPath::AddLineToPoint @@ -6777,7 +6806,7 @@ case wxGraphicsPath_AddLineToPoint_2: { // wxGraphicsPath::AddLineToPoint wxDouble * x = (wxDouble *) bp; bp += 8; wxDouble * y = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->AddLineToPoint((wxDouble) *x,(wxDouble) *y); + This->AddLineToPoint(*x,*y); break; } case wxGraphicsPath_AddLineToPoint_1: { // wxGraphicsPath::AddLineToPoint @@ -6805,7 +6834,7 @@ case wxGraphicsPath_AddQuadCurveToPoint: { // wxGraphicsPath::AddQuadCurveToPoin wxDouble * x = (wxDouble *) bp; bp += 8; wxDouble * y = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->AddQuadCurveToPoint((wxDouble) *cx,(wxDouble) *cy,(wxDouble) *x,(wxDouble) *y); + This->AddQuadCurveToPoint(*cx,*cy,*x,*y); break; } case wxGraphicsPath_AddRectangle: { // wxGraphicsPath::AddRectangle @@ -6816,7 +6845,7 @@ case wxGraphicsPath_AddRectangle: { // wxGraphicsPath::AddRectangle wxDouble * w = (wxDouble *) bp; bp += 8; wxDouble * h = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->AddRectangle((wxDouble) *x,(wxDouble) *y,(wxDouble) *w,(wxDouble) *h); + This->AddRectangle(*x,*y,*w,*h); break; } case wxGraphicsPath_AddRoundedRectangle: { // wxGraphicsPath::AddRoundedRectangle @@ -6828,7 +6857,7 @@ case wxGraphicsPath_AddRoundedRectangle: { // wxGraphicsPath::AddRoundedRectangl wxDouble * h = (wxDouble *) bp; bp += 8; wxDouble * radius = (wxDouble *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->AddRoundedRectangle((wxDouble) *x,(wxDouble) *y,(wxDouble) *w,(wxDouble) *h,(wxDouble) *radius); + This->AddRoundedRectangle(*x,*y,*w,*h,*radius); break; } case wxGraphicsPath_CloseSubpath: { // wxGraphicsPath::CloseSubpath @@ -6838,23 +6867,23 @@ case wxGraphicsPath_CloseSubpath: { // wxGraphicsPath::CloseSubpath break; } case wxGraphicsPath_Contains_3: { // wxGraphicsPath::Contains - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsPath *This = (wxGraphicsPath *) getPtr(bp,memenv); bp += 4; bp += 4; /* Align */ wxDouble * x = (wxDouble *) bp; bp += 8; wxDouble * y = (wxDouble *) bp; bp += 8; while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Contains((wxDouble) *x,(wxDouble) *y,fillStyle); + bool Result = This->Contains(*x,*y,fillStyle); rt.addBool(Result); break; } case wxGraphicsPath_Contains_2: { // wxGraphicsPath::Contains - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsPath *This = (wxGraphicsPath *) getPtr(bp,memenv); bp += 4; bp += 4; /* Align */ wxDouble * cX = (wxDouble *) bp; bp += 8; @@ -6862,7 +6891,7 @@ case wxGraphicsPath_Contains_2: { // wxGraphicsPath::Contains wxPoint2DDouble c = wxPoint2DDouble(*cX,*cY); while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); @@ -6930,6 +6959,7 @@ case wxGraphicsRenderer_CreateBrush: { // wxGraphicsRenderer::CreateBrush rt.addRef(getRef((void *)Result,memenv), "wxGraphicsBrush"); break; } +#if !wxCHECK_VERSION(2,9,0) case wxGraphicsRenderer_CreateLinearGradientBrush: { // wxGraphicsRenderer::CreateLinearGradientBrush wxGraphicsRenderer *This = (wxGraphicsRenderer *) getPtr(bp,memenv); bp += 4; bp += 4; /* Align */ @@ -6948,10 +6978,12 @@ case wxGraphicsRenderer_CreateLinearGradientBrush: { // wxGraphicsRenderer::Crea int * c2A = (int *) bp; bp += 4; wxColour c2 = wxColour(*c2R,*c2G,*c2B,*c2A); if(!This) throw wxe_badarg(0); - wxGraphicsBrush * Result = new wxGraphicsBrush(This->CreateLinearGradientBrush((wxDouble) *x1,(wxDouble) *y1,(wxDouble) *x2,(wxDouble) *y2,c1,c2)); newPtr((void *) Result,3, memenv);; + wxGraphicsBrush * Result = new wxGraphicsBrush(This->CreateLinearGradientBrush(*x1,*y1,*x2,*y2,c1,c2)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxGraphicsBrush"); break; } +#endif +#if !wxCHECK_VERSION(2,9,0) case wxGraphicsRenderer_CreateRadialGradientBrush: { // wxGraphicsRenderer::CreateRadialGradientBrush wxGraphicsRenderer *This = (wxGraphicsRenderer *) getPtr(bp,memenv); bp += 4; bp += 4; /* Align */ @@ -6971,10 +7003,11 @@ case wxGraphicsRenderer_CreateRadialGradientBrush: { // wxGraphicsRenderer::Crea int * cColorA = (int *) bp; bp += 4; wxColour cColor = wxColour(*cColorR,*cColorG,*cColorB,*cColorA); if(!This) throw wxe_badarg(0); - wxGraphicsBrush * Result = new wxGraphicsBrush(This->CreateRadialGradientBrush((wxDouble) *xo,(wxDouble) *yo,(wxDouble) *xc,(wxDouble) *yc,(wxDouble) *radius,oColor,cColor)); newPtr((void *) Result,3, memenv);; + wxGraphicsBrush * Result = new wxGraphicsBrush(This->CreateRadialGradientBrush(*xo,*yo,*xc,*yc,*radius,oColor,cColor)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxGraphicsBrush"); break; } +#endif case wxGraphicsRenderer_CreateFont: { // wxGraphicsRenderer::CreateFont wxColour col= *wxBLACK; wxGraphicsRenderer *This = (wxGraphicsRenderer *) getPtr(bp,memenv); bp += 4; @@ -7050,7 +7083,7 @@ case wxGraphicsRenderer_CreatePath: { // wxGraphicsRenderer::CreatePath #endif // wxUSE_GRAPHICS_CONTEXT case wxMenuBar_new_1: { // wxMenuBar::wxMenuBar int * style = (int *) bp; bp += 4; - wxMenuBar * Result = new EwxMenuBar((long) *style); + wxMenuBar * Result = new EwxMenuBar(*style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxMenuBar"); break; @@ -7077,7 +7110,7 @@ case wxMenuBar_Check: { // wxMenuBar::Check int * itemid = (int *) bp; bp += 4; bool * check = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Check((int) *itemid,(bool) *check); + This->Check(*itemid,*check); break; } case wxMenuBar_Enable_2: { // wxMenuBar::Enable @@ -7085,7 +7118,7 @@ case wxMenuBar_Enable_2: { // wxMenuBar::Enable int * itemid = (int *) bp; bp += 4; bool * enable = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Enable((int) *itemid,(bool) *enable); + This->Enable(*itemid,*enable); break; } case wxMenuBar_Enable_1: { // wxMenuBar::Enable @@ -7107,7 +7140,7 @@ case wxMenuBar_EnableTop: { // wxMenuBar::EnableTop int * pos = (int *) bp; bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableTop((size_t) *pos,(bool) *flag); + This->EnableTop(*pos,*flag); break; } case wxMenuBar_FindMenu: { // wxMenuBar::FindMenu @@ -7138,7 +7171,7 @@ case wxMenuBar_FindItem: { // wxMenuBar::FindItem wxMenuBar *This = (wxMenuBar *) getPtr(bp,memenv); bp += 4; int * id = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->FindItem((int) *id,menu); + wxMenuItem * Result = (wxMenuItem*)This->FindItem(*id,menu); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7146,7 +7179,7 @@ case wxMenuBar_GetHelpString: { // wxMenuBar::GetHelpString wxMenuBar *This = (wxMenuBar *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetHelpString((int) *itemid); + wxString Result = This->GetHelpString(*itemid); rt.add(Result); break; } @@ -7154,7 +7187,7 @@ case wxMenuBar_GetLabel_1: { // wxMenuBar::GetLabel wxMenuBar *This = (wxMenuBar *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetLabel((int) *itemid); + wxString Result = This->GetLabel(*itemid); rt.add(Result); break; } @@ -7169,7 +7202,7 @@ case wxMenuBar_GetLabelTop: { // wxMenuBar::GetLabelTop wxMenuBar *This = (wxMenuBar *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetLabelTop((size_t) *pos); + wxString Result = This->GetLabelTop(*pos); rt.add(Result); break; } @@ -7177,7 +7210,7 @@ case wxMenuBar_GetMenu: { // wxMenuBar::GetMenu wxMenuBar *This = (wxMenuBar *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxMenu * Result = (wxMenu*)This->GetMenu((size_t) *pos); + wxMenu * Result = (wxMenu*)This->GetMenu(*pos); rt.addRef(getRef((void *)Result,memenv), "wxMenu"); break; } @@ -7196,7 +7229,7 @@ case wxMenuBar_Insert: { // wxMenuBar::Insert wxString title = wxString(bp, wxConvUTF8); bp += *titleLen+((8-((0+ *titleLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - bool Result = This->Insert((size_t) *pos,menu,title); + bool Result = This->Insert(*pos,menu,title); rt.addBool(Result); break; } @@ -7204,7 +7237,7 @@ case wxMenuBar_IsChecked: { // wxMenuBar::IsChecked wxMenuBar *This = (wxMenuBar *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsChecked((int) *itemid); + bool Result = This->IsChecked(*itemid); rt.addBool(Result); break; } @@ -7212,7 +7245,7 @@ case wxMenuBar_IsEnabled_1: { // wxMenuBar::IsEnabled wxMenuBar *This = (wxMenuBar *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsEnabled((int) *itemid); + bool Result = This->IsEnabled(*itemid); rt.addBool(Result); break; } @@ -7227,7 +7260,7 @@ case wxMenuBar_Remove: { // wxMenuBar::Remove wxMenuBar *This = (wxMenuBar *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxMenu * Result = (wxMenu*)This->Remove((size_t) *pos); + wxMenu * Result = (wxMenu*)This->Remove(*pos); rt.addRef(getRef((void *)Result,memenv), "wxMenu"); break; } @@ -7239,7 +7272,7 @@ case wxMenuBar_Replace: { // wxMenuBar::Replace wxString title = wxString(bp, wxConvUTF8); bp += *titleLen+((8-((0+ *titleLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - wxMenu * Result = (wxMenu*)This->Replace((size_t) *pos,menu,title); + wxMenu * Result = (wxMenu*)This->Replace(*pos,menu,title); rt.addRef(getRef((void *)Result,memenv), "wxMenu"); break; } @@ -7250,7 +7283,7 @@ case wxMenuBar_SetHelpString: { // wxMenuBar::SetHelpString wxString helpString = wxString(bp, wxConvUTF8); bp += *helpStringLen+((8-((4+ *helpStringLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetHelpString((int) *itemid,helpString); + This->SetHelpString(*itemid,helpString); break; } case wxMenuBar_SetLabel_2: { // wxMenuBar::SetLabel @@ -7260,7 +7293,7 @@ case wxMenuBar_SetLabel_2: { // wxMenuBar::SetLabel wxString label = wxString(bp, wxConvUTF8); bp += *labelLen+((8-((4+ *labelLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetLabel((int) *itemid,label); + This->SetLabel(*itemid,label); break; } case wxMenuBar_SetLabel_1: { // wxMenuBar::SetLabel @@ -7279,7 +7312,7 @@ case wxMenuBar_SetLabelTop: { // wxMenuBar::SetLabelTop wxString label = wxString(bp, wxConvUTF8); bp += *labelLen+((8-((4+ *labelLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetLabelTop((size_t) *pos,label); + This->SetLabelTop(*pos,label); break; } case wxControl_GetLabel: { // wxControl::GetLabel @@ -7345,7 +7378,7 @@ case wxControlWithItems_Delete: { // wxControlWithItems::Delete wxControlWithItems *This = (wxControlWithItems *) getPtr(bp,memenv); bp += 4; unsigned int * n = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Delete((int) *n); + This->Delete(*n); break; } case wxControlWithItems_FindString: { // wxControlWithItems::FindString @@ -7368,7 +7401,7 @@ case wxControlWithItems_getClientData: { // wxControlWithItems::GetClientObject wxControlWithItems *This = (wxControlWithItems *) getPtr(bp,memenv); bp += 4; unsigned int * n = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxeErlTerm * Result = (wxeErlTerm*)This->GetClientObject((int) *n); + wxeErlTerm * Result = (wxeErlTerm*)This->GetClientObject(*n); rt.addExt2Term(Result); break; } @@ -7377,7 +7410,7 @@ case wxControlWithItems_setClientData: { // wxControlWithItems::SetClientObject unsigned int * n = (unsigned int *) bp; bp += 4; wxeErlTerm * clientData = new wxeErlTerm(Ecmd.bin[0]); if(!This) throw wxe_badarg(0); - This->SetClientObject((int) *n,clientData); + This->SetClientObject(*n,clientData); break; } case wxControlWithItems_GetCount: { // wxControlWithItems::GetCount @@ -7398,7 +7431,7 @@ case wxControlWithItems_GetString: { // wxControlWithItems::GetString wxControlWithItems *This = (wxControlWithItems *) getPtr(bp,memenv); bp += 4; unsigned int * n = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetString((int) *n); + wxString Result = This->GetString(*n); rt.add(Result); break; } @@ -7416,7 +7449,7 @@ case wxControlWithItems_Insert_2: { // wxControlWithItems::Insert bp += *itemLen+((8-((0+ *itemLen) & 7)) & 7); unsigned int * pos = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->Insert(item,(int) *pos); + int Result = This->Insert(item,*pos); rt.addInt(Result); break; } @@ -7428,7 +7461,7 @@ case wxControlWithItems_Insert_3: { // wxControlWithItems::Insert unsigned int * pos = (unsigned int *) bp; bp += 4; wxeErlTerm * clientData = new wxeErlTerm(Ecmd.bin[0]); if(!This) throw wxe_badarg(0); - int Result = This->Insert(item,(int) *pos,clientData); + int Result = This->Insert(item,*pos,clientData); rt.addInt(Result); break; } @@ -7443,14 +7476,14 @@ case wxControlWithItems_Select: { // wxControlWithItems::Select wxControlWithItems *This = (wxControlWithItems *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Select((int) *n); + This->Select(*n); break; } case wxControlWithItems_SetSelection: { // wxControlWithItems::SetSelection wxControlWithItems *This = (wxControlWithItems *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((int) *n); + This->SetSelection(*n); break; } case wxControlWithItems_SetString: { // wxControlWithItems::SetString @@ -7460,7 +7493,7 @@ case wxControlWithItems_SetString: { // wxControlWithItems::SetString wxString s = wxString(bp, wxConvUTF8); bp += *sLen+((8-((4+ *sLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetString((int) *n,s); + This->SetString(*n,s); break; } case wxControlWithItems_SetStringSelection: { // wxControlWithItems::SetStringSelection @@ -7519,7 +7552,7 @@ kind = *(wxItemKind *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->Append((int) *itemid,text,help,(wxItemKind) kind); + wxMenuItem * Result = (wxMenuItem*)This->Append(*itemid,text,help,kind); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7542,7 +7575,7 @@ case wxMenu_Append_4_0: { // wxMenu::Append bp += *helpLen+((8-((4+ *helpLen) & 7)) & 7); bool * isCheckable = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Append((int) *itemid,text,help,(bool) *isCheckable); + This->Append(*itemid,text,help,*isCheckable); break; } case wxMenu_Append_4_1: { // wxMenu::Append @@ -7562,7 +7595,7 @@ case wxMenu_Append_4_1: { // wxMenu::Append } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->Append((int) *itemid,text,submenu,help); + wxMenuItem * Result = (wxMenuItem*)This->Append(*itemid,text,submenu,help); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7581,7 +7614,7 @@ case wxMenu_AppendCheckItem: { // wxMenu::AppendCheckItem } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->AppendCheckItem((int) *itemid,text,help); + wxMenuItem * Result = (wxMenuItem*)This->AppendCheckItem(*itemid,text,help); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7600,7 +7633,7 @@ case wxMenu_AppendRadioItem: { // wxMenu::AppendRadioItem } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->AppendRadioItem((int) *itemid,text,help); + wxMenuItem * Result = (wxMenuItem*)This->AppendRadioItem(*itemid,text,help); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7622,14 +7655,14 @@ case wxMenu_Check: { // wxMenu::Check int * itemid = (int *) bp; bp += 4; bool * check = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Check((int) *itemid,(bool) *check); + This->Check(*itemid,*check); break; } case wxMenu_Delete_1_0: { // wxMenu::Delete wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Delete((int) *itemid); + bool Result = This->Delete(*itemid); rt.addBool(Result); break; } @@ -7645,7 +7678,7 @@ case wxMenu_Destroy_1_0: { // wxMenu::Destroy wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Destroy((int) *itemid); + bool Result = This->Destroy(*itemid); rt.addBool(Result); break; } @@ -7662,7 +7695,7 @@ case wxMenu_Enable: { // wxMenu::Enable int * itemid = (int *) bp; bp += 4; bool * enable = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Enable((int) *itemid,(bool) *enable); + This->Enable(*itemid,*enable); break; } case wxMenu_FindItem_1: { // wxMenu::FindItem @@ -7680,7 +7713,7 @@ case wxMenu_FindItem_2: { // wxMenu::FindItem wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->FindItem((int) *itemid,menu); + wxMenuItem * Result = (wxMenuItem*)This->FindItem(*itemid,menu); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7688,7 +7721,7 @@ case wxMenu_FindItemByPosition: { // wxMenu::FindItemByPosition wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * position = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->FindItemByPosition((size_t) *position); + wxMenuItem * Result = (wxMenuItem*)This->FindItemByPosition(*position); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7696,7 +7729,7 @@ case wxMenu_GetHelpString: { // wxMenu::GetHelpString wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetHelpString((int) *itemid); + wxString Result = This->GetHelpString(*itemid); rt.add(Result); break; } @@ -7704,7 +7737,7 @@ case wxMenu_GetLabel: { // wxMenu::GetLabel wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetLabel((int) *itemid); + wxString Result = This->GetLabel(*itemid); rt.add(Result); break; } @@ -7738,7 +7771,7 @@ case wxMenu_Insert_2: { // wxMenu::Insert int * pos = (int *) bp; bp += 4; wxMenuItem *item = (wxMenuItem *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->Insert((size_t) *pos,item); + wxMenuItem * Result = (wxMenuItem*)This->Insert(*pos,item); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7766,7 +7799,7 @@ kind = *(wxItemKind *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->Insert((size_t) *pos,(int) *itemid,text,help,(wxItemKind) kind); + wxMenuItem * Result = (wxMenuItem*)This->Insert(*pos,*itemid,text,help,kind); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7788,7 +7821,7 @@ case wxMenu_Insert_5_1: { // wxMenu::Insert } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->Insert((size_t) *pos,(int) *itemid,text,submenu,help); + wxMenuItem * Result = (wxMenuItem*)This->Insert(*pos,*itemid,text,submenu,help); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7804,7 +7837,7 @@ case wxMenu_Insert_5_0: { // wxMenu::Insert bp += *helpLen+((8-((4+ *helpLen) & 7)) & 7); bool * isCheckable = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Insert((size_t) *pos,(int) *itemid,text,help,(bool) *isCheckable); + This->Insert(*pos,*itemid,text,help,*isCheckable); break; } case wxMenu_InsertCheckItem: { // wxMenu::InsertCheckItem @@ -7823,7 +7856,7 @@ case wxMenu_InsertCheckItem: { // wxMenu::InsertCheckItem } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->InsertCheckItem((size_t) *pos,(int) *itemid,text,help); + wxMenuItem * Result = (wxMenuItem*)This->InsertCheckItem(*pos,*itemid,text,help); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7843,7 +7876,7 @@ case wxMenu_InsertRadioItem: { // wxMenu::InsertRadioItem } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->InsertRadioItem((size_t) *pos,(int) *itemid,text,help); + wxMenuItem * Result = (wxMenuItem*)This->InsertRadioItem(*pos,*itemid,text,help); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7851,7 +7884,7 @@ case wxMenu_InsertSeparator: { // wxMenu::InsertSeparator wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->InsertSeparator((size_t) *pos); + wxMenuItem * Result = (wxMenuItem*)This->InsertSeparator(*pos); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7859,7 +7892,7 @@ case wxMenu_IsChecked: { // wxMenu::IsChecked wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsChecked((int) *itemid); + bool Result = This->IsChecked(*itemid); rt.addBool(Result); break; } @@ -7867,7 +7900,7 @@ case wxMenu_IsEnabled: { // wxMenu::IsEnabled wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsEnabled((int) *itemid); + bool Result = This->IsEnabled(*itemid); rt.addBool(Result); break; } @@ -7901,7 +7934,7 @@ kind = *(wxItemKind *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->Prepend((int) *itemid,text,help,(wxItemKind) kind); + wxMenuItem * Result = (wxMenuItem*)This->Prepend(*itemid,text,help,kind); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7922,7 +7955,7 @@ case wxMenu_Prepend_4_1: { // wxMenu::Prepend } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->Prepend((int) *itemid,text,submenu,help); + wxMenuItem * Result = (wxMenuItem*)This->Prepend(*itemid,text,submenu,help); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7937,7 +7970,7 @@ case wxMenu_Prepend_4_0: { // wxMenu::Prepend bp += *helpLen+((8-((4+ *helpLen) & 7)) & 7); bool * isCheckable = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Prepend((int) *itemid,text,help,(bool) *isCheckable); + This->Prepend(*itemid,text,help,*isCheckable); break; } case wxMenu_PrependCheckItem: { // wxMenu::PrependCheckItem @@ -7955,7 +7988,7 @@ case wxMenu_PrependCheckItem: { // wxMenu::PrependCheckItem } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->PrependCheckItem((int) *itemid,text,help); + wxMenuItem * Result = (wxMenuItem*)This->PrependCheckItem(*itemid,text,help); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7974,7 +8007,7 @@ case wxMenu_PrependRadioItem: { // wxMenu::PrependRadioItem } break; }}; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->PrependRadioItem((int) *itemid,text,help); + wxMenuItem * Result = (wxMenuItem*)This->PrependRadioItem(*itemid,text,help); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -7989,7 +8022,7 @@ case wxMenu_Remove_1_0: { // wxMenu::Remove wxMenu *This = (wxMenu *) getPtr(bp,memenv); bp += 4; int * itemid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxMenuItem * Result = (wxMenuItem*)This->Remove((int) *itemid); + wxMenuItem * Result = (wxMenuItem*)This->Remove(*itemid); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; } @@ -8008,7 +8041,7 @@ case wxMenu_SetHelpString: { // wxMenu::SetHelpString wxString helpString = wxString(bp, wxConvUTF8); bp += *helpStringLen+((8-((4+ *helpStringLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetHelpString((int) *itemid,helpString); + This->SetHelpString(*itemid,helpString); break; } case wxMenu_SetLabel: { // wxMenu::SetLabel @@ -8018,7 +8051,7 @@ case wxMenu_SetLabel: { // wxMenu::SetLabel wxString label = wxString(bp, wxConvUTF8); bp += *labelLen+((8-((4+ *labelLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetLabel((int) *itemid,label); + This->SetLabel(*itemid,label); break; } case wxMenu_SetTitle: { // wxMenu::SetTitle @@ -8061,7 +8094,7 @@ kind = *(wxItemKind *) bp; bp += 4;; subMenu = (wxMenu *) getPtr(bp,memenv); bp += 4; } break; }}; - wxMenuItem * Result = new EwxMenuItem(parentMenu,id,text,help,(wxItemKind) kind,subMenu); + wxMenuItem * Result = new EwxMenuItem(parentMenu,id,text,help,kind,subMenu); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxMenuItem"); break; @@ -8276,7 +8309,7 @@ data = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool((int) *toolid,label,*bitmap,*bmpDisabled,(wxItemKind) kind,shortHelp,longHelp,data); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool(*toolid,label,*bitmap,*bmpDisabled,kind,shortHelp,longHelp,data); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8301,7 +8334,7 @@ kind = *(wxItemKind *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool((int) *toolid,label,*bitmap,shortHelp,(wxItemKind) kind); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool(*toolid,label,*bitmap,shortHelp,kind); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8341,7 +8374,7 @@ clientData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool((int) *toolid,*bitmap,*bmpDisabled,toggle,clientData,shortHelpString,longHelpString); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool(*toolid,*bitmap,*bmpDisabled,toggle,clientData,shortHelpString,longHelpString); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8365,7 +8398,7 @@ case wxToolBar_AddTool_3: { // wxToolBar::AddTool } break; }}; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool((int) *toolid,*bitmap,shortHelpString,longHelpString); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool(*toolid,*bitmap,shortHelpString,longHelpString); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8399,7 +8432,7 @@ clientData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool((int) *toolid,*bitmap,*bmpDisabled,(bool) *toggle,(wxCoord) *xPos,yPos,clientData,shortHelp,longHelp); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddTool(*toolid,*bitmap,*bmpDisabled,*toggle,*xPos,yPos,clientData,shortHelp,longHelp); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8434,7 +8467,7 @@ data = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddCheckTool((int) *toolid,label,*bitmap,*bmpDisabled,shortHelp,longHelp,data); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddCheckTool(*toolid,label,*bitmap,*bmpDisabled,shortHelp,longHelp,data); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8469,7 +8502,7 @@ data = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddRadioTool((int) *toolid,label,*bitmap,*bmpDisabled,shortHelp,longHelp,data); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->AddRadioTool(*toolid,label,*bitmap,*bmpDisabled,shortHelp,longHelp,data); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8477,7 +8510,7 @@ case wxToolBar_DeleteTool: { // wxToolBar::DeleteTool wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * toolid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeleteTool((int) *toolid); + bool Result = This->DeleteTool(*toolid); rt.addBool(Result); break; } @@ -8485,7 +8518,7 @@ case wxToolBar_DeleteToolByPos: { // wxToolBar::DeleteToolByPos wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeleteToolByPos((size_t) *pos); + bool Result = This->DeleteToolByPos(*pos); rt.addBool(Result); break; } @@ -8494,14 +8527,14 @@ case wxToolBar_EnableTool: { // wxToolBar::EnableTool int * toolid = (int *) bp; bp += 4; bool * enable = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableTool((int) *toolid,(bool) *enable); + This->EnableTool(*toolid,*enable); break; } case wxToolBar_FindById: { // wxToolBar::FindById wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * toolid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->FindById((int) *toolid); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->FindById(*toolid); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8509,7 +8542,7 @@ case wxToolBar_FindControl: { // wxToolBar::FindControl wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * toolid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxControl * Result = (wxControl*)This->FindControl((int) *toolid); + wxControl * Result = (wxControl*)This->FindControl(*toolid); rt.addRef(getRef((void *)Result,memenv), "wxControl"); break; } @@ -8518,7 +8551,7 @@ case wxToolBar_FindToolForPosition: { // wxToolBar::FindToolForPosition int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->FindToolForPosition((wxCoord) *x,(wxCoord) *y); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->FindToolForPosition(*x,*y); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8547,7 +8580,7 @@ case wxToolBar_GetToolEnabled: { // wxToolBar::GetToolEnabled wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * toolid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetToolEnabled((int) *toolid); + bool Result = This->GetToolEnabled(*toolid); rt.addBool(Result); break; } @@ -8555,7 +8588,7 @@ case wxToolBar_GetToolLongHelp: { // wxToolBar::GetToolLongHelp wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * toolid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetToolLongHelp((int) *toolid); + wxString Result = This->GetToolLongHelp(*toolid); rt.add(Result); break; } @@ -8570,7 +8603,7 @@ case wxToolBar_GetToolPos: { // wxToolBar::GetToolPos wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * id = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetToolPos((int) *id); + int Result = This->GetToolPos(*id); rt.addInt(Result); break; } @@ -8585,7 +8618,7 @@ case wxToolBar_GetToolShortHelp: { // wxToolBar::GetToolShortHelp wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * toolid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetToolShortHelp((int) *toolid); + wxString Result = This->GetToolShortHelp(*toolid); rt.add(Result); break; } @@ -8593,7 +8626,7 @@ case wxToolBar_GetToolState: { // wxToolBar::GetToolState wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * toolid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetToolState((int) *toolid); + bool Result = This->GetToolState(*toolid); rt.addBool(Result); break; } @@ -8602,7 +8635,7 @@ case wxToolBar_InsertControl: { // wxToolBar::InsertControl int * pos = (int *) bp; bp += 4; wxControl *control = (wxControl *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertControl((size_t) *pos,control); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertControl(*pos,control); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8610,7 +8643,7 @@ case wxToolBar_InsertSeparator: { // wxToolBar::InsertSeparator wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertSeparator((size_t) *pos); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertSeparator(*pos); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8650,7 +8683,7 @@ clientData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertTool((size_t) *pos,(int) *toolid,label,*bitmap,*bmpDisabled,(wxItemKind) kind,shortHelp,longHelp,clientData); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertTool(*pos,*toolid,label,*bitmap,*bmpDisabled,kind,shortHelp,longHelp,clientData); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8659,7 +8692,7 @@ case wxToolBar_InsertTool_2: { // wxToolBar::InsertTool int * pos = (int *) bp; bp += 4; wxToolBarToolBase *tool = (wxToolBarToolBase *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertTool((size_t) *pos,tool); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertTool(*pos,tool); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8695,7 +8728,7 @@ clientData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertTool((size_t) *pos,(int) *toolid,*bitmap,*bmpDisabled,toggle,clientData,shortHelp,longHelp); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->InsertTool(*pos,*toolid,*bitmap,*bmpDisabled,toggle,clientData,shortHelp,longHelp); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8710,7 +8743,7 @@ case wxToolBar_RemoveTool: { // wxToolBar::RemoveTool wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * toolid = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxToolBarToolBase * Result = (wxToolBarToolBase*)This->RemoveTool((int) *toolid); + wxToolBarToolBase * Result = (wxToolBarToolBase*)This->RemoveTool(*toolid); rt.addRef(getRef((void *)Result,memenv), "wx"); break; } @@ -8719,7 +8752,7 @@ case wxToolBar_SetMargins: { // wxToolBar::SetMargins int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMargins((int) *x,(int) *y); + This->SetMargins(*x,*y); break; } case wxToolBar_SetToolBitmapSize: { // wxToolBar::SetToolBitmapSize @@ -8738,14 +8771,14 @@ case wxToolBar_SetToolLongHelp: { // wxToolBar::SetToolLongHelp wxString helpString = wxString(bp, wxConvUTF8); bp += *helpStringLen+((8-((4+ *helpStringLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetToolLongHelp((int) *toolid,helpString); + This->SetToolLongHelp(*toolid,helpString); break; } case wxToolBar_SetToolPacking: { // wxToolBar::SetToolPacking wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * packing = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetToolPacking((int) *packing); + This->SetToolPacking(*packing); break; } case wxToolBar_SetToolShortHelp: { // wxToolBar::SetToolShortHelp @@ -8755,14 +8788,14 @@ case wxToolBar_SetToolShortHelp: { // wxToolBar::SetToolShortHelp wxString helpString = wxString(bp, wxConvUTF8); bp += *helpStringLen+((8-((4+ *helpStringLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetToolShortHelp((int) *id,helpString); + This->SetToolShortHelp(*id,helpString); break; } case wxToolBar_SetToolSeparation: { // wxToolBar::SetToolSeparation wxToolBar *This = (wxToolBar *) getPtr(bp,memenv); bp += 4; int * separation = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetToolSeparation((int) *separation); + This->SetToolSeparation(*separation); break; } case wxToolBar_ToggleTool: { // wxToolBar::ToggleTool @@ -8770,7 +8803,7 @@ case wxToolBar_ToggleTool: { // wxToolBar::ToggleTool int * toolid = (int *) bp; bp += 4; bool * toggle = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ToggleTool((int) *toolid,(bool) *toggle); + This->ToggleTool(*toolid,*toggle); break; } case wxStatusBar_new_0: { // wxStatusBar::wxStatusBar @@ -8824,7 +8857,7 @@ case wxStatusBar_GetFieldRect: { // wxStatusBar::GetFieldRect int * rectH = (int *) bp; bp += 4; wxRect rect = wxRect(*rectX,*rectY,*rectW,*rectH); if(!This) throw wxe_badarg(0); - bool Result = This->GetFieldRect((int) *i,rect); + bool Result = This->GetFieldRect(*i,rect); rt.addBool(Result); break; } @@ -8889,14 +8922,14 @@ case wxStatusBar_SetFieldsCount: { // wxStatusBar::SetFieldsCount } break; }}; if(!This) throw wxe_badarg(0); - This->SetFieldsCount((int) *number,widths); + This->SetFieldsCount(*number,widths); break; } case wxStatusBar_SetMinHeight: { // wxStatusBar::SetMinHeight wxStatusBar *This = (wxStatusBar *) getPtr(bp,memenv); bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMinHeight((int) *height); + This->SetMinHeight(*height); break; } case wxStatusBar_SetStatusText: { // wxStatusBar::SetStatusText @@ -8945,7 +8978,7 @@ case wxBitmap_new_3: { // wxBitmap::wxBitmap depth = (int)*(int *) bp; bp += 4; } break; }}; - wxBitmap * Result = new EwxBitmap((int) *width,(int) *height,depth); + wxBitmap * Result = new EwxBitmap(*width,*height,depth); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; @@ -8960,7 +8993,7 @@ case wxBitmap_new_4: { // wxBitmap::wxBitmap depth = (int)*(int *) bp; bp += 4; } break; }}; - wxBitmap * Result = new EwxBitmap(bits,(int) *width,(int) *height,depth); + wxBitmap * Result = new EwxBitmap(bits,*width,*height,depth); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; @@ -8975,7 +9008,7 @@ case wxBitmap_new_2_0: { // wxBitmap::wxBitmap type = *(wxBitmapType *) bp; bp += 4;; } break; }}; - wxBitmap * Result = new EwxBitmap(filename,(wxBitmapType) type); + wxBitmap * Result = new EwxBitmap(filename,type); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; @@ -9021,7 +9054,7 @@ case wxBitmap_Create: { // wxBitmap::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create((int) *width,(int) *height,depth); + bool Result = This->Create(*width,*height,depth); rt.addBool(Result); break; } @@ -9084,7 +9117,7 @@ type = *(wxBitmapType *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->LoadFile(name,(wxBitmapType) type); + bool Result = This->LoadFile(name,type); rt.addBool(Result); break; } @@ -9109,7 +9142,7 @@ palette = (wxPalette *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->SaveFile(name,(wxBitmapType) type,palette); + bool Result = This->SaveFile(name,type,palette); rt.addBool(Result); break; } @@ -9117,14 +9150,14 @@ case wxBitmap_SetDepth: { // wxBitmap::SetDepth wxBitmap *This = (wxBitmap *) getPtr(bp,memenv); bp += 4; int * depth = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetDepth((int) *depth); + This->SetDepth(*depth); break; } case wxBitmap_SetHeight: { // wxBitmap::SetHeight wxBitmap *This = (wxBitmap *) getPtr(bp,memenv); bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetHeight((int) *height); + This->SetHeight(*height); break; } case wxBitmap_SetMask: { // wxBitmap::SetMask @@ -9145,7 +9178,7 @@ case wxBitmap_SetWidth: { // wxBitmap::SetWidth wxBitmap *This = (wxBitmap *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWidth((int) *width); + This->SetWidth(*width); break; } case wxIcon_new_0: { // wxIcon::wxIcon @@ -9172,7 +9205,7 @@ type = *(wxBitmapType *) bp; bp += 4;; desiredHeight = (int)*(int *) bp; bp += 4; } break; }}; - wxIcon * Result = new EwxIcon(filename,(wxBitmapType) type,desiredWidth,desiredHeight); + wxIcon * Result = new EwxIcon(filename,type,desiredWidth,desiredHeight); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxIcon"); break; @@ -9202,7 +9235,7 @@ case wxIconBundle_new_2: { // wxIconBundle::wxIconBundle wxString file = wxString(bp, wxConvUTF8); bp += *fileLen+((8-((4+ *fileLen) & 7)) & 7); int * type = (int *) bp; bp += 4; - wxIconBundle * Result = new wxIconBundle(file,(long) *type); + wxIconBundle * Result = new wxIconBundle(file,*type); newPtr((void *) Result, 61, memenv); rt.addRef(getRef((void *)Result,memenv), "wxIconBundle"); break; @@ -9234,7 +9267,7 @@ case wxIconBundle_AddIcon_2: { // wxIconBundle::AddIcon bp += *fileLen+((8-((0+ *fileLen) & 7)) & 7); int * type = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AddIcon(file,(long) *type); + This->AddIcon(file,*type); break; } case wxIconBundle_AddIcon_1: { // wxIconBundle::AddIcon @@ -9250,7 +9283,7 @@ case wxIconBundle_GetIcon_1_1: { // wxIconBundle::GetIcon int * sizeH = (int *) bp; bp += 4; wxSize size = wxSize(*sizeW,*sizeH); if(!This) throw wxe_badarg(0); - const wxIcon * Result = &This->GetIcon(size); + const wxIcon * Result = new wxIcon(This->GetIcon(size)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxIcon"); break; } @@ -9264,7 +9297,7 @@ case wxIconBundle_GetIcon_1_0: { // wxIconBundle::GetIcon } break; }}; if(!This) throw wxe_badarg(0); - const wxIcon * Result = &This->GetIcon(size); + const wxIcon * Result = new wxIcon(This->GetIcon(size)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxIcon"); break; } @@ -9276,7 +9309,7 @@ case wxCursor_new_0: { // wxCursor::wxCursor } case wxCursor_new_1_0: { // wxCursor::wxCursor int * cursorId = (int *) bp; bp += 4; - wxCursor * Result = new EwxCursor((int) *cursorId); + wxCursor * Result = new EwxCursor(*cursorId); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxCursor"); break; @@ -9288,6 +9321,7 @@ case wxCursor_new_1_1: { // wxCursor::wxCursor rt.addRef(getRef((void *)Result,memenv), "wxCursor"); break; } +#if !wxCHECK_VERSION(2,9,0) case wxCursor_new_4: { // wxCursor::wxCursor int hotSpotX=-1; int hotSpotY=-1; @@ -9302,11 +9336,12 @@ case wxCursor_new_4: { // wxCursor::wxCursor hotSpotY = (int)*(int *) bp; bp += 4; } break; }}; - wxCursor * Result = new EwxCursor(bits,(int) *width,(int) *height,hotSpotX,hotSpotY); + wxCursor * Result = new EwxCursor(bits,*width,*height,hotSpotX,hotSpotY); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxCursor"); break; } +#endif case wxCursor_Ok: { // wxCursor::Ok wxCursor *This = (wxCursor *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); @@ -9335,7 +9370,7 @@ case wxMask_new_2_1: { // wxMask::wxMask case wxMask_new_2_0: { // wxMask::wxMask wxBitmap *bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4; int * paletteIndex = (int *) bp; bp += 4; - wxMask * Result = new EwxMask(*bitmap,(int) *paletteIndex); + wxMask * Result = new EwxMask(*bitmap,*paletteIndex); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxMask"); break; @@ -9365,7 +9400,7 @@ case wxMask_Create_2_0: { // wxMask::Create wxBitmap *bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4; int * paletteIndex = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Create(*bitmap,(int) *paletteIndex); + bool Result = This->Create(*bitmap,*paletteIndex); rt.addBool(Result); break; } @@ -9392,7 +9427,7 @@ case wxImage_new_3_0: { // wxImage::wxImage clear = *(bool *) bp; bp += 4; } break; }}; - wxImage * Result = new EwxImage((int) *width,(int) *height,clear); + wxImage * Result = new EwxImage(*width,*height,clear); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; @@ -9408,7 +9443,7 @@ case wxImage_new_4: { // wxImage::wxImage } break; }}; if(!static_data) {data = (unsigned char *) malloc(Ecmd.bin[0]->size);memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}; - wxImage * Result = new EwxImage((int) *width,(int) *height,data,static_data); + wxImage * Result = new EwxImage(*width,*height,data,static_data); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; @@ -9425,7 +9460,7 @@ case wxImage_new_5: { // wxImage::wxImage } break; }}; if(!static_data) { data = (unsigned char *) malloc(Ecmd.bin[0]->size); alpha = (unsigned char *) malloc(Ecmd.bin[1]->size); memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size); memcpy(alpha,Ecmd.bin[1]->base,Ecmd.bin[1]->size);}; - wxImage * Result = new EwxImage((int) *width,(int) *height,data,alpha,static_data); + wxImage * Result = new EwxImage(*width,*height,data,alpha,static_data); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; @@ -9471,7 +9506,7 @@ case wxImage_Blur: { // wxImage::Blur wxImage *This = (wxImage *) getPtr(bp,memenv); bp += 4; int * radius = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxImage * Result = new wxImage(This->Blur((int) *radius)); newPtr((void *) Result,3, memenv);; + wxImage * Result = new wxImage(This->Blur(*radius)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; } @@ -9479,7 +9514,7 @@ case wxImage_BlurHorizontal: { // wxImage::BlurHorizontal wxImage *This = (wxImage *) getPtr(bp,memenv); bp += 4; int * radius = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxImage * Result = new wxImage(This->BlurHorizontal((int) *radius)); newPtr((void *) Result,3, memenv);; + wxImage * Result = new wxImage(This->BlurHorizontal(*radius)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; } @@ -9487,7 +9522,7 @@ case wxImage_BlurVertical: { // wxImage::BlurVertical wxImage *This = (wxImage *) getPtr(bp,memenv); bp += 4; int * radius = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxImage * Result = new wxImage(This->BlurVertical((int) *radius)); newPtr((void *) Result,3, memenv);; + wxImage * Result = new wxImage(This->BlurVertical(*radius)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; } @@ -9536,7 +9571,7 @@ case wxImage_ConvertToMono: { // wxImage::ConvertToMono unsigned int * g = (unsigned int *) bp; bp += 4; unsigned int * b = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxImage * Result = new wxImage(This->ConvertToMono((char) *r,(char) *g,(char) *b)); newPtr((void *) Result,3, memenv);; + wxImage * Result = new wxImage(This->ConvertToMono(*r,*g,*b)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; } @@ -9559,7 +9594,7 @@ case wxImage_Create_3: { // wxImage::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create((int) *width,(int) *height,clear); + bool Result = This->Create(*width,*height,clear); rt.addBool(Result); break; } @@ -9577,7 +9612,7 @@ case wxImage_Create_4: { // wxImage::Create }}; if(!static_data) {data = (unsigned char *) malloc(Ecmd.bin[0]->size);memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}; if(!This) throw wxe_badarg(0); - bool Result = This->Create((int) *width,(int) *height,data,static_data); + bool Result = This->Create(*width,*height,data,static_data); rt.addBool(Result); break; } @@ -9596,7 +9631,7 @@ case wxImage_Create_5: { // wxImage::Create }}; if(!static_data) { data = (unsigned char *) malloc(Ecmd.bin[0]->size); alpha = (unsigned char *) malloc(Ecmd.bin[1]->size); memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size); memcpy(alpha,Ecmd.bin[1]->base,Ecmd.bin[1]->size);}; if(!This) throw wxe_badarg(0); - bool Result = This->Create((int) *width,(int) *height,data,alpha,static_data); + bool Result = This->Create(*width,*height,data,alpha,static_data); rt.addBool(Result); break; } @@ -9645,7 +9680,7 @@ case wxImage_GetAlpha_2: { // wxImage::GetAlpha int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - char Result = This->GetAlpha((int) *x,(int) *y); + char Result = This->GetAlpha(*x,*y); rt.addUint(Result); break; } @@ -9663,7 +9698,7 @@ case wxImage_GetBlue: { // wxImage::GetBlue int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - char Result = This->GetBlue((int) *x,(int) *y); + char Result = This->GetBlue(*x,*y); rt.addUint(Result); break; } @@ -9681,18 +9716,18 @@ case wxImage_GetGreen: { // wxImage::GetGreen int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - char Result = This->GetGreen((int) *x,(int) *y); + char Result = This->GetGreen(*x,*y); rt.addUint(Result); break; } case wxImage_GetImageCount: { // wxImage::GetImageCount - long type=wxBITMAP_TYPE_ANY; + wxBitmapType type=wxBITMAP_TYPE_ANY; int * nameLen = (int *) bp; bp += 4; wxString name = wxString(bp, wxConvUTF8); bp += *nameLen+((8-((4+ *nameLen) & 7)) & 7); while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - type = (long)*(int *) bp; bp += 4; +type = *(wxBitmapType *) bp; bp += 4;; } break; }}; int Result = wxImage::GetImageCount(name,type); @@ -9753,7 +9788,7 @@ case wxImage_GetRed: { // wxImage::GetRed int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - char Result = This->GetRed((int) *x,(int) *y); + char Result = This->GetRed(*x,*y); rt.addUint(Result); break; } @@ -9842,7 +9877,7 @@ case wxImage_IsTransparent: { // wxImage::IsTransparent } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->IsTransparent((int) *x,(int) *y,threshold); + bool Result = This->IsTransparent(*x,*y,threshold); rt.addBool(Result); break; } @@ -9923,22 +9958,22 @@ case wxImage_Replace: { // wxImage::Replace unsigned int * g2 = (unsigned int *) bp; bp += 4; unsigned int * b2 = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Replace((char) *r1,(char) *g1,(char) *b1,(char) *r2,(char) *g2,(char) *b2); + This->Replace(*r1,*g1,*b1,*r2,*g2,*b2); break; } case wxImage_Rescale: { // wxImage::Rescale - int quality=wxIMAGE_QUALITY_NORMAL; + wxImageResizeQuality quality=wxIMAGE_QUALITY_NORMAL; wxImage *This = (wxImage *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; bp += 4; /* Align */ while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - quality = (int)*(int *) bp; bp += 4; +quality = *(wxImageResizeQuality *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - wxImage * Result = &This->Rescale((int) *width,(int) *height,quality); + wxImage * Result = &This->Rescale(*width,*height,quality); rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; } @@ -9991,7 +10026,7 @@ case wxImage_Rotate: { // wxImage::Rotate } break; }}; if(!This) throw wxe_badarg(0); - wxImage * Result = new wxImage(This->Rotate((double) *angle,centre_of_rotation,interpolating,offset_after_rotation)); newPtr((void *) Result,3, memenv);; + wxImage * Result = new wxImage(This->Rotate(*angle,centre_of_rotation,interpolating,offset_after_rotation)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; } @@ -10000,7 +10035,7 @@ case wxImage_RotateHue: { // wxImage::RotateHue bp += 4; /* Align */ double * angle = (double *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->RotateHue((double) *angle); + This->RotateHue(*angle); break; } case wxImage_Rotate90: { // wxImage::Rotate90 @@ -10034,7 +10069,7 @@ case wxImage_SaveFile_2_0: { // wxImage::SaveFile bp += *nameLen+((8-((0+ *nameLen) & 7)) & 7); int * type = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SaveFile(name,(int) *type); + bool Result = This->SaveFile(name,*type); rt.addBool(Result); break; } @@ -10052,18 +10087,18 @@ case wxImage_SaveFile_2_1: { // wxImage::SaveFile break; } case wxImage_Scale: { // wxImage::Scale - int quality=wxIMAGE_QUALITY_NORMAL; + wxImageResizeQuality quality=wxIMAGE_QUALITY_NORMAL; wxImage *This = (wxImage *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; bp += 4; /* Align */ while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - quality = (int)*(int *) bp; bp += 4; +quality = *(wxImageResizeQuality *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - wxImage * Result = new wxImage(This->Scale((int) *width,(int) *height,quality)); newPtr((void *) Result,3, memenv);; + wxImage * Result = new wxImage(This->Scale(*width,*height,quality)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; } @@ -10101,7 +10136,7 @@ case wxImage_SetAlpha_3: { // wxImage::SetAlpha int * y = (int *) bp; bp += 4; unsigned int * alpha = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetAlpha((int) *x,(int) *y,(char) *alpha); + This->SetAlpha(*x,*y,*alpha); break; } case wxImage_SetAlpha_2: { // wxImage::SetAlpha @@ -10148,7 +10183,7 @@ case wxImage_SetData_4: { // wxImage::SetData }}; if(!static_data) {data = (unsigned char *) malloc(Ecmd.bin[0]->size);memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}; if(!This) throw wxe_badarg(0); - This->SetData(data,(int) *new_width,(int) *new_height,static_data); + This->SetData(data,*new_width,*new_height,static_data); break; } case wxImage_SetMask: { // wxImage::SetMask @@ -10170,7 +10205,7 @@ case wxImage_SetMaskColour: { // wxImage::SetMaskColour unsigned int * g = (unsigned int *) bp; bp += 4; unsigned int * b = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMaskColour((char) *r,(char) *g,(char) *b); + This->SetMaskColour(*r,*g,*b); break; } case wxImage_SetMaskFromImage: { // wxImage::SetMaskFromImage @@ -10180,7 +10215,7 @@ case wxImage_SetMaskFromImage: { // wxImage::SetMaskFromImage unsigned int * mg = (unsigned int *) bp; bp += 4; unsigned int * mb = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetMaskFromImage(*mask,(char) *mr,(char) *mg,(char) *mb); + bool Result = This->SetMaskFromImage(*mask,*mr,*mg,*mb); rt.addBool(Result); break; } @@ -10203,7 +10238,7 @@ case wxImage_SetOption_2_0: { // wxImage::SetOption bp += *nameLen+((8-((0+ *nameLen) & 7)) & 7); int * value = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetOption(name,(int) *value); + This->SetOption(name,*value); break; } case wxImage_SetPalette: { // wxImage::SetPalette @@ -10221,7 +10256,7 @@ case wxImage_SetRGB_5: { // wxImage::SetRGB unsigned int * g = (unsigned int *) bp; bp += 4; unsigned int * b = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRGB((int) *x,(int) *y,(char) *r,(char) *g,(char) *b); + This->SetRGB(*x,*y,*r,*g,*b); break; } case wxImage_SetRGB_4: { // wxImage::SetRGB @@ -10235,7 +10270,7 @@ case wxImage_SetRGB_4: { // wxImage::SetRGB unsigned int * g = (unsigned int *) bp; bp += 4; unsigned int * b = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRGB(rect,(char) *r,(char) *g,(char) *b); + This->SetRGB(rect,*r,*g,*b); break; } case wxBrush_new_0: { // wxBrush::wxBrush @@ -10271,8 +10306,8 @@ case wxBrush_new_1: { // wxBrush::wxBrush case wxBrush_GetColour: { // wxBrush::GetColour wxBrush *This = (wxBrush *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxColour * Result = &This->GetColour(); - rt.add((*Result)); + wxColour Result = This->GetColour(); + rt.add(Result); break; } case wxBrush_GetStipple: { // wxBrush::GetStipple @@ -10320,7 +10355,7 @@ case wxBrush_SetColour_3: { // wxBrush::SetColour unsigned int * g = (unsigned int *) bp; bp += 4; unsigned int * b = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColour((char) *r,(char) *g,(char) *b); + This->SetColour(*r,*g,*b); break; } case wxBrush_SetStipple: { // wxBrush::SetStipple @@ -10334,7 +10369,7 @@ case wxBrush_SetStyle: { // wxBrush::SetStyle wxBrush *This = (wxBrush *) getPtr(bp,memenv); bp += 4; int * style = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetStyle((int) *style); + This->SetStyle(*style); break; } case wxPen_new_0: { // wxPen::wxPen @@ -10374,8 +10409,8 @@ case wxPen_GetCap: { // wxPen::GetCap case wxPen_GetColour: { // wxPen::GetColour wxPen *This = (wxPen *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxColour * Result = &This->GetColour(); - rt.add((*Result)); + wxColour Result = This->GetColour(); + rt.add(Result); break; } case wxPen_GetJoin: { // wxPen::GetJoin @@ -10408,9 +10443,9 @@ case wxPen_IsOk: { // wxPen::IsOk } case wxPen_SetCap: { // wxPen::SetCap wxPen *This = (wxPen *) getPtr(bp,memenv); bp += 4; - int * capStyle = (int *) bp; bp += 4; + wxPenCap capStyle = *(wxPenCap *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetCap((int) *capStyle); + This->SetCap(capStyle); break; } case wxPen_SetColour_1: { // wxPen::SetColour @@ -10430,28 +10465,28 @@ case wxPen_SetColour_3: { // wxPen::SetColour unsigned int * green = (unsigned int *) bp; bp += 4; unsigned int * blue = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColour((char) *red,(char) *green,(char) *blue); + This->SetColour(*red,*green,*blue); break; } case wxPen_SetJoin: { // wxPen::SetJoin wxPen *This = (wxPen *) getPtr(bp,memenv); bp += 4; - int * joinStyle = (int *) bp; bp += 4; + wxPenJoin joinStyle = *(wxPenJoin *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetJoin((int) *joinStyle); + This->SetJoin(joinStyle); break; } case wxPen_SetStyle: { // wxPen::SetStyle wxPen *This = (wxPen *) getPtr(bp,memenv); bp += 4; int * style = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetStyle((int) *style); + This->SetStyle(*style); break; } case wxPen_SetWidth: { // wxPen::SetWidth wxPen *This = (wxPen *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWidth((int) *width); + This->SetWidth(*width); break; } case wxRegion_new_0: { // wxRegion::wxRegion @@ -10465,7 +10500,7 @@ case wxRegion_new_4: { // wxRegion::wxRegion int * y = (int *) bp; bp += 4; int * w = (int *) bp; bp += 4; int * h = (int *) bp; bp += 4; - wxRegion * Result = new EwxRegion((wxCoord) *x,(wxCoord) *y,(wxCoord) *w,(wxCoord) *h); + wxRegion * Result = new EwxRegion(*x,*y,*w,*h); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxRegion"); break; @@ -10511,7 +10546,7 @@ case wxRegion_Contains_2: { // wxRegion::Contains int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->Contains((wxCoord) *x,(wxCoord) *y); + int Result = This->Contains(*x,*y); rt.addInt(Result); break; } @@ -10532,7 +10567,7 @@ case wxRegion_Contains_4: { // wxRegion::Contains int * w = (int *) bp; bp += 4; int * h = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->Contains((wxCoord) *x,(wxCoord) *y,(wxCoord) *w,(wxCoord) *h); + int Result = This->Contains(*x,*y,*w,*h); rt.addInt(Result); break; } @@ -10569,7 +10604,7 @@ case wxRegion_Intersect_4: { // wxRegion::Intersect int * w = (int *) bp; bp += 4; int * h = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Intersect((wxCoord) *x,(wxCoord) *y,(wxCoord) *w,(wxCoord) *h); + bool Result = This->Intersect(*x,*y,*w,*h); rt.addBool(Result); break; } @@ -10607,7 +10642,7 @@ case wxRegion_Subtract_4: { // wxRegion::Subtract int * w = (int *) bp; bp += 4; int * h = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Subtract((wxCoord) *x,(wxCoord) *y,(wxCoord) *w,(wxCoord) *h); + bool Result = This->Subtract(*x,*y,*w,*h); rt.addBool(Result); break; } @@ -10636,7 +10671,7 @@ case wxRegion_Offset_2: { // wxRegion::Offset int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Offset((wxCoord) *x,(wxCoord) *y); + bool Result = This->Offset(*x,*y); rt.addBool(Result); break; } @@ -10657,7 +10692,7 @@ case wxRegion_Union_4: { // wxRegion::Union int * w = (int *) bp; bp += 4; int * h = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Union((wxCoord) *x,(wxCoord) *y,(wxCoord) *w,(wxCoord) *h); + bool Result = This->Union(*x,*y,*w,*h); rt.addBool(Result); break; } @@ -10715,7 +10750,7 @@ case wxRegion_Xor_4: { // wxRegion::Xor int * w = (int *) bp; bp += 4; int * h = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Xor((wxCoord) *x,(wxCoord) *y,(wxCoord) *w,(wxCoord) *h); + bool Result = This->Xor(*x,*y,*w,*h); rt.addBool(Result); break; } @@ -10751,7 +10786,7 @@ case wxAcceleratorTable_new_2: { // wxAcceleratorTable::wxAcceleratorTable wxAcceleratorEntry *entries; entries = (wxAcceleratorEntry *) driver_alloc(sizeof(wxAcceleratorEntry) * *entriesLen); for(int i=0; i < *entriesLen; i++) { entries[i] = * (wxAcceleratorEntry *) getPtr(bp,memenv); bp += 4;} bp += ((0+ *entriesLen)%2 )*4; - wxAcceleratorTable * Result = new EwxAcceleratorTable((int) *n,entries); + wxAcceleratorTable * Result = new EwxAcceleratorTable(*n,entries); newPtr((void *) Result, 1, memenv); driver_free(entries); rt.addRef(getRef((void *)Result,memenv), "wxAcceleratorTable"); @@ -10828,7 +10863,7 @@ item = (wxMenuItem *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - This->Set((int) *flags,(int) *keyCode,(int) *cmd,item); + This->Set(*flags,*keyCode,*cmd,item); break; } case wxAcceleratorEntry_destroy: { // wxAcceleratorEntry::destroy @@ -10841,7 +10876,7 @@ case wxCaret_new_3: { // wxCaret::wxCaret wxWindow *window = (wxWindow *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; - wxCaret * Result = new EwxCaret(window,(int) *width,(int) *height); + wxCaret * Result = new EwxCaret(window,*width,*height); newPtr((void *) Result, 70, memenv); rt.addRef(getRef((void *)Result,memenv), "wxCaret"); break; @@ -10868,7 +10903,7 @@ case wxCaret_Create_3: { // wxCaret::Create int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Create(window,(int) *width,(int) *height); + bool Result = This->Create(window,*width,*height); rt.addBool(Result); break; } @@ -10934,7 +10969,7 @@ case wxCaret_Move_2: { // wxCaret::Move int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Move((int) *x,(int) *y); + This->Move(*x,*y); break; } case wxCaret_Move_1: { // wxCaret::Move @@ -10948,7 +10983,7 @@ case wxCaret_Move_1: { // wxCaret::Move } case wxCaret_SetBlinkTime: { // wxCaret::SetBlinkTime int * milliseconds = (int *) bp; bp += 4; - wxCaret::SetBlinkTime((int) *milliseconds); + wxCaret::SetBlinkTime(*milliseconds); break; } case wxCaret_SetSize_2: { // wxCaret::SetSize @@ -10956,7 +10991,7 @@ case wxCaret_SetSize_2: { // wxCaret::SetSize int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSize((int) *width,(int) *height); + This->SetSize(*width,*height); break; } case wxCaret_SetSize_1: { // wxCaret::SetSize @@ -11057,7 +11092,7 @@ userData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Add((int) *width,(int) *height,proportion,flag,border,userData); + wxSizerItem * Result = (wxSizerItem*)This->Add(*width,*height,proportion,flag,border,userData); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11083,7 +11118,7 @@ case wxSizer_AddSpacer: { // wxSizer::AddSpacer wxSizer *This = (wxSizer *) getPtr(bp,memenv); bp += 4; int * size = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->AddSpacer((int) *size); + wxSizerItem * Result = (wxSizerItem*)This->AddSpacer(*size); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11141,7 +11176,7 @@ case wxSizer_Detach_1_0: { // wxSizer::Detach wxSizer *This = (wxSizer *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Detach((int) *index); + bool Result = This->Detach(*index); rt.addBool(Result); break; } @@ -11203,7 +11238,7 @@ case wxSizer_GetItem_1: { // wxSizer::GetItem wxSizer *This = (wxSizer *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->GetItem((size_t) *index); + wxSizerItem * Result = (wxSizerItem*)This->GetItem(*index); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11260,7 +11295,7 @@ case wxSizer_Hide_1: { // wxSizer::Hide wxSizer *This = (wxSizer *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Hide((size_t) *index); + bool Result = This->Hide(*index); rt.addBool(Result); break; } @@ -11288,7 +11323,7 @@ userData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Insert((size_t) *index,window,proportion,flag,border,userData); + wxSizerItem * Result = (wxSizerItem*)This->Insert(*index,window,proportion,flag,border,userData); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11316,7 +11351,7 @@ userData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Insert((size_t) *index,sizer,proportion,flag,border,userData); + wxSizerItem * Result = (wxSizerItem*)This->Insert(*index,sizer,proportion,flag,border,userData); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11344,7 +11379,7 @@ userData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Insert((size_t) *index,(int) *width,(int) *height,proportion,flag,border,userData); + wxSizerItem * Result = (wxSizerItem*)This->Insert(*index,*width,*height,proportion,flag,border,userData); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11354,7 +11389,7 @@ case wxSizer_Insert_3_3: { // wxSizer::Insert wxWindow * window = (wxWindow *) getPtr(bp,memenv); bp += 4; wxSizerFlags *flags = (wxSizerFlags *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Insert((size_t) *index,window,*flags); + wxSizerItem * Result = (wxSizerItem*)This->Insert(*index,window,*flags); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11364,7 +11399,7 @@ case wxSizer_Insert_3_2: { // wxSizer::Insert wxSizer *sizer = (wxSizer *) getPtr(bp,memenv); bp += 4; wxSizerFlags *flags = (wxSizerFlags *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Insert((size_t) *index,sizer,*flags); + wxSizerItem * Result = (wxSizerItem*)This->Insert(*index,sizer,*flags); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11373,7 +11408,7 @@ case wxSizer_Insert_2: { // wxSizer::Insert int * index = (int *) bp; bp += 4; wxSizerItem *item = (wxSizerItem *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Insert((size_t) *index,item); + wxSizerItem * Result = (wxSizerItem*)This->Insert(*index,item); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11382,7 +11417,7 @@ case wxSizer_InsertSpacer: { // wxSizer::InsertSpacer int * index = (int *) bp; bp += 4; int * size = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->InsertSpacer((size_t) *index,(int) *size); + wxSizerItem * Result = (wxSizerItem*)This->InsertSpacer(*index,*size); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11396,7 +11431,7 @@ case wxSizer_InsertStretchSpacer: { // wxSizer::InsertStretchSpacer } break; }}; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->InsertStretchSpacer((size_t) *index,prop); + wxSizerItem * Result = (wxSizerItem*)This->InsertStretchSpacer(*index,prop); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11420,7 +11455,7 @@ case wxSizer_IsShown_1_0: { // wxSizer::IsShown wxSizer *This = (wxSizer *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsShown((size_t) *index); + bool Result = This->IsShown(*index); rt.addBool(Result); break; } @@ -11506,7 +11541,7 @@ userData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Prepend((int) *width,(int) *height,proportion,flag,border,userData); + wxSizerItem * Result = (wxSizerItem*)This->Prepend(*width,*height,proportion,flag,border,userData); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11540,7 +11575,7 @@ case wxSizer_PrependSpacer: { // wxSizer::PrependSpacer wxSizer *This = (wxSizer *) getPtr(bp,memenv); bp += 4; int * size = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->PrependSpacer((int) *size); + wxSizerItem * Result = (wxSizerItem*)This->PrependSpacer(*size); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -11576,7 +11611,7 @@ case wxSizer_Remove_1_0: { // wxSizer::Remove wxSizer *This = (wxSizer *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Remove((int) *index); + bool Result = This->Remove(*index); rt.addBool(Result); break; } @@ -11617,7 +11652,7 @@ case wxSizer_Replace_2: { // wxSizer::Replace int * index = (int *) bp; bp += 4; wxSizerItem *newitem = (wxSizerItem *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Replace((size_t) *index,newitem); + bool Result = This->Replace(*index,newitem); rt.addBool(Result); break; } @@ -11628,7 +11663,7 @@ case wxSizer_SetDimension: { // wxSizer::SetDimension int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetDimension((int) *x,(int) *y,(int) *width,(int) *height); + This->SetDimension(*x,*y,*width,*height); break; } case wxSizer_SetMinSize_2: { // wxSizer::SetMinSize @@ -11636,7 +11671,7 @@ case wxSizer_SetMinSize_2: { // wxSizer::SetMinSize int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMinSize((int) *width,(int) *height); + This->SetMinSize(*width,*height); break; } case wxSizer_SetMinSize_1: { // wxSizer::SetMinSize @@ -11654,7 +11689,7 @@ case wxSizer_SetItemMinSize_3_2: { // wxSizer::SetItemMinSize int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetItemMinSize(window,(int) *width,(int) *height); + bool Result = This->SetItemMinSize(window,*width,*height); rt.addBool(Result); break; } @@ -11675,7 +11710,7 @@ case wxSizer_SetItemMinSize_3_1: { // wxSizer::SetItemMinSize int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetItemMinSize(sizer,(int) *width,(int) *height); + bool Result = This->SetItemMinSize(sizer,*width,*height); rt.addBool(Result); break; } @@ -11696,7 +11731,7 @@ case wxSizer_SetItemMinSize_3_0: { // wxSizer::SetItemMinSize int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetItemMinSize((size_t) *index,(int) *width,(int) *height); + bool Result = This->SetItemMinSize(*index,*width,*height); rt.addBool(Result); break; } @@ -11707,7 +11742,7 @@ case wxSizer_SetItemMinSize_2_0: { // wxSizer::SetItemMinSize int * sizeH = (int *) bp; bp += 4; wxSize size = wxSize(*sizeW,*sizeH); if(!This) throw wxe_badarg(0); - bool Result = This->SetItemMinSize((size_t) *index,size); + bool Result = This->SetItemMinSize(*index,size); rt.addBool(Result); break; } @@ -11771,7 +11806,7 @@ case wxSizer_Show_2_0: { // wxSizer::Show } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Show((size_t) *index,show); + bool Result = This->Show(*index,show); rt.addBool(Result); break; } @@ -11779,7 +11814,7 @@ case wxSizer_Show_1: { // wxSizer::Show wxSizer *This = (wxSizer *) getPtr(bp,memenv); bp += 4; bool * show = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Show((bool) *show); + This->Show(*show); break; } case wxSizerFlags_new: { // wxSizerFlags::wxSizerFlags @@ -11798,7 +11833,7 @@ case wxSizerFlags_Align: { // wxSizerFlags::Align wxSizerFlags *This = (wxSizerFlags *) getPtr(bp,memenv); bp += 4; int * alignment = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSizerFlags * Result = &This->Align((int) *alignment); + wxSizerFlags * Result = &This->Align(*alignment); rt.addRef(getRef((void *)Result,memenv), "wxSizerFlags"); break; } @@ -11807,7 +11842,7 @@ case wxSizerFlags_Border_2: { // wxSizerFlags::Border int * direction = (int *) bp; bp += 4; int * borderInPixels = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSizerFlags * Result = &This->Border((int) *direction,(int) *borderInPixels); + wxSizerFlags * Result = &This->Border(*direction,*borderInPixels); rt.addRef(getRef((void *)Result,memenv), "wxSizerFlags"); break; } @@ -11857,7 +11892,7 @@ case wxSizerFlags_Proportion: { // wxSizerFlags::Proportion wxSizerFlags *This = (wxSizerFlags *) getPtr(bp,memenv); bp += 4; int * proportion = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSizerFlags * Result = &This->Proportion((int) *proportion); + wxSizerFlags * Result = &This->Proportion(*proportion); rt.addRef(getRef((void *)Result,memenv), "wxSizerFlags"); break; } @@ -11880,7 +11915,7 @@ case wxSizerItem_new_5_1: { // wxSizerItem::wxSizerItem int * flag = (int *) bp; bp += 4; int * border = (int *) bp; bp += 4; wxObject *userData = (wxObject *) getPtr(bp,memenv); bp += 4; - wxSizerItem * Result = new EwxSizerItem(window,(int) *proportion,(int) *flag,(int) *border,userData); + wxSizerItem * Result = new EwxSizerItem(window,*proportion,*flag,*border,userData); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; @@ -11899,7 +11934,7 @@ case wxSizerItem_new_5_0: { // wxSizerItem::wxSizerItem int * flag = (int *) bp; bp += 4; int * border = (int *) bp; bp += 4; wxObject *userData = (wxObject *) getPtr(bp,memenv); bp += 4; - wxSizerItem * Result = new EwxSizerItem(sizer,(int) *proportion,(int) *flag,(int) *border,userData); + wxSizerItem * Result = new EwxSizerItem(sizer,*proportion,*flag,*border,userData); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; @@ -11919,7 +11954,7 @@ case wxSizerItem_new_6: { // wxSizerItem::wxSizerItem int * flag = (int *) bp; bp += 4; int * border = (int *) bp; bp += 4; wxObject *userData = (wxObject *) getPtr(bp,memenv); bp += 4; - wxSizerItem * Result = new EwxSizerItem((int) *width,(int) *height,(int) *proportion,(int) *flag,(int) *border,userData); + wxSizerItem * Result = new EwxSizerItem(*width,*height,*proportion,*flag,*border,userData); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; @@ -11928,7 +11963,7 @@ case wxSizerItem_new_3: { // wxSizerItem::wxSizerItem int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; wxSizerFlags *flags = (wxSizerFlags *) getPtr(bp,memenv); bp += 4; - wxSizerItem * Result = new EwxSizerItem((int) *width,(int) *height,*flags); + wxSizerItem * Result = new EwxSizerItem(*width,*height,*flags); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; @@ -12074,7 +12109,7 @@ case wxSizerItem_SetBorder: { // wxSizerItem::SetBorder wxSizerItem *This = (wxSizerItem *) getPtr(bp,memenv); bp += 4; int * border = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetBorder((int) *border); + This->SetBorder(*border); break; } case wxSizerItem_SetDimension: { // wxSizerItem::SetDimension @@ -12093,7 +12128,7 @@ case wxSizerItem_SetFlag: { // wxSizerItem::SetFlag wxSizerItem *This = (wxSizerItem *) getPtr(bp,memenv); bp += 4; int * flag = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFlag((int) *flag); + This->SetFlag(*flag); break; } case wxSizerItem_SetInitSize: { // wxSizerItem::SetInitSize @@ -12101,7 +12136,7 @@ case wxSizerItem_SetInitSize: { // wxSizerItem::SetInitSize int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetInitSize((int) *x,(int) *y); + This->SetInitSize(*x,*y); break; } case wxSizerItem_SetMinSize_1: { // wxSizerItem::SetMinSize @@ -12118,14 +12153,14 @@ case wxSizerItem_SetMinSize_2: { // wxSizerItem::SetMinSize int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMinSize((int) *x,(int) *y); + This->SetMinSize(*x,*y); break; } case wxSizerItem_SetProportion: { // wxSizerItem::SetProportion wxSizerItem *This = (wxSizerItem *) getPtr(bp,memenv); bp += 4; int * proportion = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetProportion((int) *proportion); + This->SetProportion(*proportion); break; } case wxSizerItem_SetRatio_2: { // wxSizerItem::SetRatio @@ -12133,7 +12168,7 @@ case wxSizerItem_SetRatio_2: { // wxSizerItem::SetRatio int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRatio((int) *width,(int) *height); + This->SetRatio(*width,*height); break; } case wxSizerItem_SetRatio_1_1: { // wxSizerItem::SetRatio @@ -12149,7 +12184,7 @@ case wxSizerItem_SetRatio_1_0: { // wxSizerItem::SetRatio wxSizerItem *This = (wxSizerItem *) getPtr(bp,memenv); bp += 4; float * ratio = (float *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRatio((float) *ratio); + This->SetRatio(*ratio); break; } case wxSizerItem_SetSizer: { // wxSizerItem::SetSizer @@ -12173,7 +12208,7 @@ case wxSizerItem_SetSpacer_2: { // wxSizerItem::SetSpacer int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSpacer((int) *width,(int) *height); + This->SetSpacer(*width,*height); break; } case wxSizerItem_SetWindow: { // wxSizerItem::SetWindow @@ -12187,12 +12222,12 @@ case wxSizerItem_Show: { // wxSizerItem::Show wxSizerItem *This = (wxSizerItem *) getPtr(bp,memenv); bp += 4; bool * show = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Show((bool) *show); + This->Show(*show); break; } case wxBoxSizer_new: { // wxBoxSizer::wxBoxSizer int * orient = (int *) bp; bp += 4; - wxBoxSizer * Result = new EwxBoxSizer((int) *orient); + wxBoxSizer * Result = new EwxBoxSizer(*orient); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxBoxSizer"); break; @@ -12207,7 +12242,7 @@ case wxBoxSizer_GetOrientation: { // wxBoxSizer::GetOrientation case wxStaticBoxSizer_new_2: { // wxStaticBoxSizer::wxStaticBoxSizer wxStaticBox *box = (wxStaticBox *) getPtr(bp,memenv); bp += 4; int * orient = (int *) bp; bp += 4; - wxStaticBoxSizer * Result = new EwxStaticBoxSizer(box,(int) *orient); + wxStaticBoxSizer * Result = new EwxStaticBoxSizer(box,*orient); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxStaticBoxSizer"); break; @@ -12223,7 +12258,7 @@ case wxStaticBoxSizer_new_3: { // wxStaticBoxSizer::wxStaticBoxSizer bp += *labelLen+((8-((0+ *labelLen) & 7)) & 7); } break; }}; - wxStaticBoxSizer * Result = new EwxStaticBoxSizer((int) *orient,win,label); + wxStaticBoxSizer * Result = new EwxStaticBoxSizer(*orient,win,label); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxStaticBoxSizer"); break; @@ -12240,7 +12275,7 @@ case wxGridSizer_new_4: { // wxGridSizer::wxGridSizer int * cols = (int *) bp; bp += 4; int * vgap = (int *) bp; bp += 4; int * hgap = (int *) bp; bp += 4; - wxGridSizer * Result = new EwxGridSizer((int) *rows,(int) *cols,(int) *vgap,(int) *hgap); + wxGridSizer * Result = new EwxGridSizer(*rows,*cols,*vgap,*hgap); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxGridSizer"); break; @@ -12258,7 +12293,7 @@ case wxGridSizer_new_2: { // wxGridSizer::wxGridSizer hgap = (int)*(int *) bp; bp += 4; } break; }}; - wxGridSizer * Result = new EwxGridSizer((int) *cols,vgap,hgap); + wxGridSizer * Result = new EwxGridSizer(*cols,vgap,hgap); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxGridSizer"); break; @@ -12295,28 +12330,28 @@ case wxGridSizer_SetCols: { // wxGridSizer::SetCols wxGridSizer *This = (wxGridSizer *) getPtr(bp,memenv); bp += 4; int * cols = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCols((int) *cols); + This->SetCols(*cols); break; } case wxGridSizer_SetHGap: { // wxGridSizer::SetHGap wxGridSizer *This = (wxGridSizer *) getPtr(bp,memenv); bp += 4; int * gap = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetHGap((int) *gap); + This->SetHGap(*gap); break; } case wxGridSizer_SetRows: { // wxGridSizer::SetRows wxGridSizer *This = (wxGridSizer *) getPtr(bp,memenv); bp += 4; int * rows = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRows((int) *rows); + This->SetRows(*rows); break; } case wxGridSizer_SetVGap: { // wxGridSizer::SetVGap wxGridSizer *This = (wxGridSizer *) getPtr(bp,memenv); bp += 4; int * gap = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetVGap((int) *gap); + This->SetVGap(*gap); break; } case wxFlexGridSizer_new_4: { // wxFlexGridSizer::wxFlexGridSizer @@ -12324,7 +12359,7 @@ case wxFlexGridSizer_new_4: { // wxFlexGridSizer::wxFlexGridSizer int * cols = (int *) bp; bp += 4; int * vgap = (int *) bp; bp += 4; int * hgap = (int *) bp; bp += 4; - wxFlexGridSizer * Result = new EwxFlexGridSizer((int) *rows,(int) *cols,(int) *vgap,(int) *hgap); + wxFlexGridSizer * Result = new EwxFlexGridSizer(*rows,*cols,*vgap,*hgap); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxFlexGridSizer"); break; @@ -12342,7 +12377,7 @@ case wxFlexGridSizer_new_2: { // wxFlexGridSizer::wxFlexGridSizer hgap = (int)*(int *) bp; bp += 4; } break; }}; - wxFlexGridSizer * Result = new EwxFlexGridSizer((int) *cols,vgap,hgap); + wxFlexGridSizer * Result = new EwxFlexGridSizer(*cols,vgap,hgap); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxFlexGridSizer"); break; @@ -12357,7 +12392,7 @@ case wxFlexGridSizer_AddGrowableCol: { // wxFlexGridSizer::AddGrowableCol } break; }}; if(!This) throw wxe_badarg(0); - This->AddGrowableCol((size_t) *idx,proportion); + This->AddGrowableCol(*idx,proportion); break; } case wxFlexGridSizer_AddGrowableRow: { // wxFlexGridSizer::AddGrowableRow @@ -12370,7 +12405,7 @@ case wxFlexGridSizer_AddGrowableRow: { // wxFlexGridSizer::AddGrowableRow } break; }}; if(!This) throw wxe_badarg(0); - This->AddGrowableRow((size_t) *idx,proportion); + This->AddGrowableRow(*idx,proportion); break; } case wxFlexGridSizer_GetFlexibleDirection: { // wxFlexGridSizer::GetFlexibleDirection @@ -12391,28 +12426,28 @@ case wxFlexGridSizer_RemoveGrowableCol: { // wxFlexGridSizer::RemoveGrowableCol wxFlexGridSizer *This = (wxFlexGridSizer *) getPtr(bp,memenv); bp += 4; int * idx = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->RemoveGrowableCol((size_t) *idx); + This->RemoveGrowableCol(*idx); break; } case wxFlexGridSizer_RemoveGrowableRow: { // wxFlexGridSizer::RemoveGrowableRow wxFlexGridSizer *This = (wxFlexGridSizer *) getPtr(bp,memenv); bp += 4; int * idx = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->RemoveGrowableRow((size_t) *idx); + This->RemoveGrowableRow(*idx); break; } case wxFlexGridSizer_SetFlexibleDirection: { // wxFlexGridSizer::SetFlexibleDirection wxFlexGridSizer *This = (wxFlexGridSizer *) getPtr(bp,memenv); bp += 4; int * direction = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFlexibleDirection((int) *direction); + This->SetFlexibleDirection(*direction); break; } case wxFlexGridSizer_SetNonFlexibleGrowMode: { // wxFlexGridSizer::SetNonFlexibleGrowMode wxFlexGridSizer *This = (wxFlexGridSizer *) getPtr(bp,memenv); bp += 4; wxFlexSizerGrowMode mode = *(wxFlexSizerGrowMode *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetNonFlexibleGrowMode((wxFlexSizerGrowMode) mode); + This->SetNonFlexibleGrowMode(mode); break; } case wxGridBagSizer_new: { // wxGridBagSizer::wxGridBagSizer @@ -12525,7 +12560,7 @@ userData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Add((int) *width,(int) *height,pos,span,flag,border,userData); + wxSizerItem * Result = (wxSizerItem*)This->Add(*width,*height,pos,span,flag,border,userData); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -12613,7 +12648,7 @@ userData = (wxObject *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - wxSizerItem * Result = (wxSizerItem*)This->Add((int) *width,(int) *height,proportion,flag,border,userData); + wxSizerItem * Result = (wxSizerItem*)This->Add(*width,*height,proportion,flag,border,userData); rt.addRef(getRef((void *)Result,memenv), "wxSizerItem"); break; } @@ -12715,7 +12750,7 @@ case wxGridBagSizer_GetCellSize: { // wxGridBagSizer::GetCellSize int * row = (int *) bp; bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSize Result = This->GetCellSize((int) *row,(int) *col); + wxSize Result = This->GetCellSize(*row,*col); rt.add(Result); break; } @@ -12746,7 +12781,7 @@ case wxGridBagSizer_GetItemPosition_1_0: { // wxGridBagSizer::GetItemPosition wxGridBagSizer *This = (wxGridBagSizer *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxGBPosition Result = This->GetItemPosition((size_t) *index); + wxGBPosition Result = This->GetItemPosition(*index); rt.add(Result); break; } @@ -12770,7 +12805,7 @@ case wxGridBagSizer_GetItemSpan_1_0: { // wxGridBagSizer::GetItemSpan wxGridBagSizer *This = (wxGridBagSizer *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxGBSpan Result = This->GetItemSpan((size_t) *index); + wxGBSpan Result = This->GetItemSpan(*index); rt.add(Result); break; } @@ -12812,7 +12847,7 @@ case wxGridBagSizer_SetItemPosition_2_0: { // wxGridBagSizer::SetItemPosition int * posC = (int *) bp; bp += 4; wxGBPosition pos = wxGBPosition(*posR,*posC); if(!This) throw wxe_badarg(0); - bool Result = This->SetItemPosition((size_t) *index,pos); + bool Result = This->SetItemPosition(*index,pos); rt.addBool(Result); break; } @@ -12845,7 +12880,7 @@ case wxGridBagSizer_SetItemSpan_2_0: { // wxGridBagSizer::SetItemSpan int * spanCS = (int *) bp; bp += 4; wxGBSpan span = wxGBSpan(*spanRS,*spanCS); if(!This) throw wxe_badarg(0); - bool Result = This->SetItemSpan((size_t) *index,span); + bool Result = This->SetItemSpan(*index,span); rt.addBool(Result); break; } @@ -12925,7 +12960,7 @@ case wxFont_new_5: { // wxFont::wxFont encoding = *(wxFontEncoding *) bp; bp += 4;; } break; }}; - wxFont * Result = new EwxFont((int) *size,(wxFontFamily) family,(wxFontStyle) style,(int) *weight,underlined,face,(wxFontEncoding) encoding); + wxFont * Result = new EwxFont(*size,family,style,*weight,underlined,face,encoding); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxFont"); break; @@ -13007,7 +13042,7 @@ case wxFont_Ok: { // wxFont::Ok } case wxFont_SetDefaultEncoding: { // wxFont::SetDefaultEncoding wxFontEncoding encoding = *(wxFontEncoding *) bp; bp += 4;; - wxFont::SetDefaultEncoding((wxFontEncoding) encoding); + wxFont::SetDefaultEncoding(encoding); break; } case wxFont_SetFaceName: { // wxFont::SetFaceName @@ -13024,45 +13059,45 @@ case wxFont_SetFamily: { // wxFont::SetFamily wxFont *This = (wxFont *) getPtr(bp,memenv); bp += 4; wxFontFamily family = *(wxFontFamily *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetFamily((wxFontFamily) family); + This->SetFamily(family); break; } case wxFont_SetPointSize: { // wxFont::SetPointSize wxFont *This = (wxFont *) getPtr(bp,memenv); bp += 4; int * pointSize = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPointSize((int) *pointSize); + This->SetPointSize(*pointSize); break; } case wxFont_SetStyle: { // wxFont::SetStyle wxFont *This = (wxFont *) getPtr(bp,memenv); bp += 4; wxFontStyle style = *(wxFontStyle *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetStyle((wxFontStyle) style); + This->SetStyle(style); break; } case wxFont_SetUnderlined: { // wxFont::SetUnderlined wxFont *This = (wxFont *) getPtr(bp,memenv); bp += 4; bool * underlined = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetUnderlined((bool) *underlined); + This->SetUnderlined(*underlined); break; } case wxFont_SetWeight: { // wxFont::SetWeight wxFont *This = (wxFont *) getPtr(bp,memenv); bp += 4; int * weight = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWeight((int) *weight); + This->SetWeight(*weight); break; } case wxToolTip_Enable: { // wxToolTip::Enable bool * flag = (bool *) bp; bp += 4; - wxToolTip::Enable((bool) *flag); + wxToolTip::Enable(*flag); break; } case wxToolTip_SetDelay: { // wxToolTip::SetDelay int * msecs = (int *) bp; bp += 4; - wxToolTip::SetDelay((long) *msecs); + wxToolTip::SetDelay(*msecs); break; } case wxToolTip_new: { // wxToolTip::wxToolTip @@ -13130,7 +13165,7 @@ case wxButton_new_3: { // wxButton::wxButton validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxButton * Result = new EwxButton(parent,(wxWindowID) *id,label,pos,size,style,*validator); + wxButton * Result = new EwxButton(parent,*id,label,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxButton"); break; @@ -13177,7 +13212,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,label,pos,size,style,*validator); + bool Result = This->Create(parent,*id,label,pos,size,style,*validator); rt.addBool(Result); break; } @@ -13230,7 +13265,7 @@ case wxBitmapButton_new_4: { // wxBitmapButton::wxBitmapButton validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxBitmapButton * Result = new EwxBitmapButton(parent,(wxWindowID) *id,*bitmap,pos,size,style,*validator); + wxBitmapButton * Result = new EwxBitmapButton(parent,*id,*bitmap,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxBitmapButton"); break; @@ -13271,35 +13306,35 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,*bitmap,pos,size,style,*validator); + bool Result = This->Create(parent,*id,*bitmap,pos,size,style,*validator); rt.addBool(Result); break; } case wxBitmapButton_GetBitmapDisabled: { // wxBitmapButton::GetBitmapDisabled wxBitmapButton *This = (wxBitmapButton *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxBitmap * Result = &This->GetBitmapDisabled(); + const wxBitmap * Result = new wxBitmap(This->GetBitmapDisabled()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } case wxBitmapButton_GetBitmapFocus: { // wxBitmapButton::GetBitmapFocus wxBitmapButton *This = (wxBitmapButton *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxBitmap * Result = &This->GetBitmapFocus(); + const wxBitmap * Result = new wxBitmap(This->GetBitmapFocus()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } case wxBitmapButton_GetBitmapLabel: { // wxBitmapButton::GetBitmapLabel wxBitmapButton *This = (wxBitmapButton *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxBitmap * Result = &This->GetBitmapLabel(); + const wxBitmap * Result = new wxBitmap(This->GetBitmapLabel()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } case wxBitmapButton_GetBitmapSelected: { // wxBitmapButton::GetBitmapSelected wxBitmapButton *This = (wxBitmapButton *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxBitmap * Result = &This->GetBitmapSelected(); + const wxBitmap * Result = new wxBitmap(This->GetBitmapSelected()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } @@ -13367,7 +13402,7 @@ case wxToggleButton_new_4: { // wxToggleButton::wxToggleButton validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxToggleButton * Result = new EwxToggleButton(parent,(wxWindowID) *id,label,pos,size,style,*validator); + wxToggleButton * Result = new EwxToggleButton(parent,*id,label,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxToggleButton"); break; @@ -13404,7 +13439,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,label,pos,size,style,*validator); + bool Result = This->Create(parent,*id,label,pos,size,style,*validator); rt.addBool(Result); break; } @@ -13419,7 +13454,7 @@ case wxToggleButton_SetValue: { // wxToggleButton::SetValue wxToggleButton *This = (wxToggleButton *) getPtr(bp,memenv); bp += 4; bool * state = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetValue((bool) *state); + This->SetValue(*state); break; } case wxCalendarCtrl_new_0: { // wxCalendarCtrl::wxCalendarCtrl @@ -13462,7 +13497,7 @@ case wxCalendarCtrl_new_3: { // wxCalendarCtrl::wxCalendarCtrl style = (long)*(int *) bp; bp += 4; } break; }}; - wxCalendarCtrl * Result = new EwxCalendarCtrl(parent,(wxWindowID) *id,date,pos,size,style); + wxCalendarCtrl * Result = new EwxCalendarCtrl(parent,*id,date,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxCalendarCtrl"); break; @@ -13504,7 +13539,7 @@ case wxCalendarCtrl_Create: { // wxCalendarCtrl::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,date,pos,size,style); + bool Result = This->Create(parent,*id,date,pos,size,style); rt.addBool(Result); break; } @@ -13525,10 +13560,11 @@ case wxCalendarCtrl_SetDate: { // wxCalendarCtrl::SetDate case wxCalendarCtrl_GetDate: { // wxCalendarCtrl::GetDate wxCalendarCtrl *This = (wxCalendarCtrl *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxDateTime * Result = &This->GetDate(); - rt.add((*Result)); + const wxDateTime Result = This->GetDate(); + rt.add(Result); break; } +#if !wxCHECK_VERSION(2,9,0) case wxCalendarCtrl_EnableYearChange: { // wxCalendarCtrl::EnableYearChange bool enable=true; wxCalendarCtrl *This = (wxCalendarCtrl *) getPtr(bp,memenv); bp += 4; @@ -13542,6 +13578,7 @@ case wxCalendarCtrl_EnableYearChange: { // wxCalendarCtrl::EnableYearChange This->EnableYearChange(enable); break; } +#endif case wxCalendarCtrl_EnableMonthChange: { // wxCalendarCtrl::EnableMonthChange bool enable=true; wxCalendarCtrl *This = (wxCalendarCtrl *) getPtr(bp,memenv); bp += 4; @@ -13662,7 +13699,7 @@ case wxCalendarCtrl_GetAttr: { // wxCalendarCtrl::GetAttr wxCalendarCtrl *This = (wxCalendarCtrl *) getPtr(bp,memenv); bp += 4; int * day = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxCalendarDateAttr * Result = (wxCalendarDateAttr*)This->GetAttr((size_t) *day); + wxCalendarDateAttr * Result = (wxCalendarDateAttr*)This->GetAttr(*day); rt.addRef(getRef((void *)Result,memenv), "wxCalendarDateAttr"); break; } @@ -13671,21 +13708,21 @@ case wxCalendarCtrl_SetAttr: { // wxCalendarCtrl::SetAttr int * day = (int *) bp; bp += 4; wxCalendarDateAttr *attr = (wxCalendarDateAttr *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->SetAttr((size_t) *day,attr); + This->SetAttr(*day,attr); break; } case wxCalendarCtrl_SetHoliday: { // wxCalendarCtrl::SetHoliday wxCalendarCtrl *This = (wxCalendarCtrl *) getPtr(bp,memenv); bp += 4; int * day = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetHoliday((size_t) *day); + This->SetHoliday(*day); break; } case wxCalendarCtrl_ResetAttr: { // wxCalendarCtrl::ResetAttr wxCalendarCtrl *This = (wxCalendarCtrl *) getPtr(bp,memenv); bp += 4; int * day = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ResetAttr((size_t) *day); + This->ResetAttr(*day); break; } case wxCalendarCtrl_HitTest: { // wxCalendarCtrl::HitTest @@ -13743,7 +13780,7 @@ font = (wxFont *) getPtr(bp,memenv); bp += 4; border = *(wxCalendarDateBorder *) bp; bp += 4;; } break; }}; - wxCalendarDateAttr * Result = new wxCalendarDateAttr(colText,colBack,colBorder,*font,(wxCalendarDateBorder) border); + wxCalendarDateAttr * Result = new wxCalendarDateAttr(colText,colBack,colBorder,*font,border); newPtr((void *) Result, 88, memenv); rt.addRef(getRef((void *)Result,memenv), "wxCalendarDateAttr"); break; @@ -13762,7 +13799,7 @@ case wxCalendarDateAttr_new_2_0: { // wxCalendarDateAttr::wxCalendarDateAttr bp += 4; /* Align */ } break; }}; - wxCalendarDateAttr * Result = new wxCalendarDateAttr((wxCalendarDateBorder) border,colBorder); + wxCalendarDateAttr * Result = new wxCalendarDateAttr(border,colBorder); newPtr((void *) Result, 88, memenv); rt.addRef(getRef((void *)Result,memenv), "wxCalendarDateAttr"); break; @@ -13811,14 +13848,14 @@ case wxCalendarDateAttr_SetBorder: { // wxCalendarDateAttr::SetBorder wxCalendarDateAttr *This = (wxCalendarDateAttr *) getPtr(bp,memenv); bp += 4; wxCalendarDateBorder border = *(wxCalendarDateBorder *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetBorder((wxCalendarDateBorder) border); + This->SetBorder(border); break; } case wxCalendarDateAttr_SetHoliday: { // wxCalendarDateAttr::SetHoliday wxCalendarDateAttr *This = (wxCalendarDateAttr *) getPtr(bp,memenv); bp += 4; bool * holiday = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetHoliday((bool) *holiday); + This->SetHoliday(*holiday); break; } case wxCalendarDateAttr_HasTextColour: { // wxCalendarDateAttr::HasTextColour @@ -13934,7 +13971,7 @@ case wxCheckBox_new_4: { // wxCheckBox::wxCheckBox validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxCheckBox * Result = new EwxCheckBox(parent,(wxWindowID) *id,label,pos,size,style,*validator); + wxCheckBox * Result = new EwxCheckBox(parent,*id,label,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxCheckBox"); break; @@ -13977,7 +14014,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,label,pos,size,style,*validator); + bool Result = This->Create(parent,*id,label,pos,size,style,*validator); rt.addBool(Result); break; } @@ -14020,14 +14057,14 @@ case wxCheckBox_SetValue: { // wxCheckBox::SetValue wxCheckBox *This = (wxCheckBox *) getPtr(bp,memenv); bp += 4; bool * state = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetValue((bool) *state); + This->SetValue(*state); break; } case wxCheckBox_Set3StateValue: { // wxCheckBox::Set3StateValue wxCheckBox *This = (wxCheckBox *) getPtr(bp,memenv); bp += 4; wxCheckBoxState state = *(wxCheckBoxState *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->Set3StateValue((wxCheckBoxState) state); + This->Set3StateValue(state); break; } case wxCheckListBox_new_0: { // wxCheckListBox::wxCheckListBox @@ -14075,7 +14112,7 @@ case wxCheckListBox_new_3: { // wxCheckListBox::wxCheckListBox validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxCheckListBox * Result = new EwxCheckListBox(parent,(wxWindowID) *id,pos,size,choices,style,*validator); + wxCheckListBox * Result = new EwxCheckListBox(parent,*id,pos,size,choices,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxCheckListBox"); break; @@ -14090,14 +14127,14 @@ case wxCheckListBox_Check: { // wxCheckListBox::Check } break; }}; if(!This) throw wxe_badarg(0); - This->Check((int) *index,check); + This->Check(*index,check); break; } case wxCheckListBox_IsChecked: { // wxCheckListBox::IsChecked wxCheckListBox *This = (wxCheckListBox *) getPtr(bp,memenv); bp += 4; unsigned int * index = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsChecked((int) *index); + bool Result = This->IsChecked(*index); rt.addBool(Result); break; } @@ -14140,7 +14177,7 @@ case wxChoice_new_3: { // wxChoice::wxChoice validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxChoice * Result = new EwxChoice(parent,(wxWindowID) *id,pos,size,choices,style,*validator); + wxChoice * Result = new EwxChoice(parent,*id,pos,size,choices,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxChoice"); break; @@ -14182,7 +14219,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,pos,size,choices,style,*validator); + bool Result = This->Create(parent,*id,pos,size,choices,style,*validator); rt.addBool(Result); break; } @@ -14190,7 +14227,7 @@ case wxChoice_Delete: { // wxChoice::Delete wxChoice *This = (wxChoice *) getPtr(bp,memenv); bp += 4; unsigned int * n = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Delete((int) *n); + This->Delete(*n); break; } case wxChoice_GetColumns: { // wxChoice::GetColumns @@ -14264,7 +14301,7 @@ case wxComboBox_new_3: { // wxComboBox::wxComboBox validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxComboBox * Result = new EwxComboBox(parent,(wxWindowID) *id,value,pos,size,choices,style,*validator); + wxComboBox * Result = new EwxComboBox(parent,*id,value,pos,size,choices,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxComboBox"); break; @@ -14303,7 +14340,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,value,pos,size,choices,style,*validator); + bool Result = This->Create(parent,*id,value,pos,size,choices,style,*validator); rt.addBool(Result); break; } @@ -14395,7 +14432,7 @@ case wxComboBox_Replace: { // wxComboBox::Replace wxString value = wxString(bp, wxConvUTF8); bp += *valueLen+((8-((0+ *valueLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->Replace((long) *from,(long) *to,value); + This->Replace(*from,*to,value); break; } case wxComboBox_Remove: { // wxComboBox::Remove @@ -14403,14 +14440,14 @@ case wxComboBox_Remove: { // wxComboBox::Remove int * from = (int *) bp; bp += 4; int * to = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Remove((long) *from,(long) *to); + This->Remove(*from,*to); break; } case wxComboBox_SetInsertionPoint: { // wxComboBox::SetInsertionPoint wxComboBox *This = (wxComboBox *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetInsertionPoint((long) *pos); + This->SetInsertionPoint(*pos); break; } case wxComboBox_SetInsertionPointEnd: { // wxComboBox::SetInsertionPointEnd @@ -14423,7 +14460,7 @@ case wxComboBox_SetSelection_1: { // wxComboBox::SetSelection wxComboBox *This = (wxComboBox *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((int) *n); + This->SetSelection(*n); break; } case wxComboBox_SetSelection_2: { // wxComboBox::SetSelection @@ -14431,7 +14468,7 @@ case wxComboBox_SetSelection_2: { // wxComboBox::SetSelection int * from = (int *) bp; bp += 4; int * to = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((long) *from,(long) *to); + This->SetSelection(*from,*to); break; } case wxComboBox_SetValue: { // wxComboBox::SetValue @@ -14484,7 +14521,7 @@ case wxGauge_new_4: { // wxGauge::wxGauge validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxGauge * Result = new EwxGauge(parent,(wxWindowID) *id,(int) *range,pos,size,style,*validator); + wxGauge * Result = new EwxGauge(parent,*id,*range,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxGauge"); break; @@ -14519,7 +14556,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,(int) *range,pos,size,style,*validator); + bool Result = This->Create(parent,*id,*range,pos,size,style,*validator); rt.addBool(Result); break; } @@ -14562,28 +14599,28 @@ case wxGauge_SetBezelFace: { // wxGauge::SetBezelFace wxGauge *This = (wxGauge *) getPtr(bp,memenv); bp += 4; int * w = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetBezelFace((int) *w); + This->SetBezelFace(*w); break; } case wxGauge_SetRange: { // wxGauge::SetRange wxGauge *This = (wxGauge *) getPtr(bp,memenv); bp += 4; int * r = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRange((int) *r); + This->SetRange(*r); break; } case wxGauge_SetShadowWidth: { // wxGauge::SetShadowWidth wxGauge *This = (wxGauge *) getPtr(bp,memenv); bp += 4; int * w = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetShadowWidth((int) *w); + This->SetShadowWidth(*w); break; } case wxGauge_SetValue: { // wxGauge::SetValue wxGauge *This = (wxGauge *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetValue((int) *pos); + This->SetValue(*pos); break; } case wxGauge_Pulse: { // wxGauge::Pulse @@ -14793,7 +14830,7 @@ case wxGenericDirCtrl_SetFilterIndex: { // wxGenericDirCtrl::SetFilterIndex wxGenericDirCtrl *This = (wxGenericDirCtrl *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFilterIndex((int) *n); + This->SetFilterIndex(*n); break; } case wxGenericDirCtrl_SetPath: { // wxGenericDirCtrl::SetPath @@ -14831,7 +14868,7 @@ case wxStaticBox_new_4: { // wxStaticBox::wxStaticBox style = (long)*(int *) bp; bp += 4; } break; }}; - wxStaticBox * Result = new EwxStaticBox(parent,(wxWindowID) *id,label,pos,size,style); + wxStaticBox * Result = new EwxStaticBox(parent,*id,label,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxStaticBox"); break; @@ -14870,7 +14907,7 @@ case wxStaticBox_Create: { // wxStaticBox::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,label,pos,size,style); + bool Result = This->Create(parent,*id,label,pos,size,style); rt.addBool(Result); break; } @@ -14995,7 +15032,7 @@ case wxListBox_new_3: { // wxListBox::wxListBox validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxListBox * Result = new EwxListBox(parent,(wxWindowID) *id,pos,size,choices,style,*validator); + wxListBox * Result = new EwxListBox(parent,*id,pos,size,choices,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxListBox"); break; @@ -15037,7 +15074,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,pos,size,choices,style,*validator); + bool Result = This->Create(parent,*id,pos,size,choices,style,*validator); rt.addBool(Result); break; } @@ -15045,7 +15082,7 @@ case wxListBox_Deselect: { // wxListBox::Deselect wxListBox *This = (wxListBox *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Deselect((int) *n); + This->Deselect(*n); break; } case wxListBox_GetSelections: { // wxListBox::GetSelections @@ -15072,14 +15109,14 @@ case wxListBox_InsertItems: { // wxListBox::InsertItems bp += (8-((0+ itemsASz) & 7 )) & 7; unsigned int * pos = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->InsertItems(items,(int) *pos); + This->InsertItems(items,*pos); break; } case wxListBox_IsSelected: { // wxListBox::IsSelected wxListBox *This = (wxListBox *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsSelected((int) *n); + bool Result = This->IsSelected(*n); rt.addBool(Result); break; } @@ -15096,7 +15133,7 @@ case wxListBox_Set: { // wxListBox::Set } bp += (8-((0+ itemsASz) & 7 )) & 7; if(!This) throw wxe_badarg(0); - This->Set(items,NULL); + This->Set(items,(void **) NULL); break; } case wxListBox_HitTest: { // wxListBox::HitTest @@ -15113,7 +15150,7 @@ case wxListBox_SetFirstItem_1_0: { // wxListBox::SetFirstItem wxListBox *This = (wxListBox *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFirstItem((int) *n); + This->SetFirstItem(*n); break; } case wxListBox_SetFirstItem_1_1: { // wxListBox::SetFirstItem @@ -15203,7 +15240,7 @@ case wxListCtrl_AssignImageList: { // wxListCtrl::AssignImageList wxImageList *imageList = (wxImageList *) getPtr(bp,memenv); bp += 4; int * which = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AssignImageList(imageList,(int) *which); + This->AssignImageList(imageList,*which); break; } case wxListCtrl_ClearAll: { // wxListCtrl::ClearAll @@ -15277,7 +15314,7 @@ case wxListCtrl_DeleteColumn: { // wxListCtrl::DeleteColumn wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeleteColumn((int) *col); + bool Result = This->DeleteColumn(*col); rt.addBool(Result); break; } @@ -15285,7 +15322,7 @@ case wxListCtrl_DeleteItem: { // wxListCtrl::DeleteItem wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeleteItem((long) *item); + bool Result = This->DeleteItem(*item); rt.addBool(Result); break; } @@ -15293,7 +15330,7 @@ case wxListCtrl_EditLabel: { // wxListCtrl::EditLabel wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxTextCtrl * Result = (wxTextCtrl*)This->EditLabel((long) *item); + wxTextCtrl * Result = (wxTextCtrl*)This->EditLabel(*item); rt.addRef(getRef((void *)Result,memenv), "wxTextCtrl"); break; } @@ -15301,7 +15338,7 @@ case wxListCtrl_EnsureVisible: { // wxListCtrl::EnsureVisible wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->EnsureVisible((long) *item); + bool Result = This->EnsureVisible(*item); rt.addBool(Result); break; } @@ -15318,7 +15355,7 @@ case wxListCtrl_FindItem_3_0: { // wxListCtrl::FindItem } break; }}; if(!This) throw wxe_badarg(0); - long Result = This->FindItem((long) *start,str,partial); + long Result = This->FindItem(*start,str,partial); rt.addInt(Result); break; } @@ -15330,7 +15367,7 @@ case wxListCtrl_FindItem_3_1: { // wxListCtrl::FindItem wxPoint pt = wxPoint(*ptX,*ptY); int * direction = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - long Result = This->FindItem((long) *start,pt,(int) *direction); + long Result = This->FindItem(*start,pt,*direction); rt.addInt(Result); break; } @@ -15339,7 +15376,7 @@ case wxListCtrl_GetColumn: { // wxListCtrl::GetColumn int * col = (int *) bp; bp += 4; wxListItem *item = (wxListItem *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetColumn((int) *col,*item); + bool Result = This->GetColumn(*col,*item); rt.addBool(Result); break; } @@ -15354,7 +15391,7 @@ case wxListCtrl_GetColumnWidth: { // wxListCtrl::GetColumnWidth wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetColumnWidth((int) *col); + int Result = This->GetColumnWidth(*col); rt.addInt(Result); break; } @@ -15376,7 +15413,7 @@ case wxListCtrl_GetImageList: { // wxListCtrl::GetImageList wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * which = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxImageList * Result = (wxImageList*)This->GetImageList((int) *which); + wxImageList * Result = (wxImageList*)This->GetImageList(*which); rt.addRef(getRef((void *)Result,memenv), "wxImageList"); break; } @@ -15392,7 +15429,7 @@ case wxListCtrl_GetItemBackgroundColour: { // wxListCtrl::GetItemBackgroundColou wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxColour Result = This->GetItemBackgroundColour((long) *item); + wxColour Result = This->GetItemBackgroundColour(*item); rt.add(Result); break; } @@ -15407,7 +15444,7 @@ case wxListCtrl_GetItemData: { // wxListCtrl::GetItemData wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxUIntPtr Result = This->GetItemData((long) *item); + wxUIntPtr Result = This->GetItemData(*item); rt.addInt(Result); break; } @@ -15415,7 +15452,7 @@ case wxListCtrl_GetItemFont: { // wxListCtrl::GetItemFont wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxFont * Result = new wxFont(This->GetItemFont((long) *item)); newPtr((void *) Result,3, memenv);; + wxFont * Result = new wxFont(This->GetItemFont(*item)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxFont"); break; } @@ -15424,7 +15461,7 @@ case wxListCtrl_GetItemPosition: { // wxListCtrl::GetItemPosition wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetItemPosition((long) *item,pos); + bool Result = This->GetItemPosition(*item,pos); rt.addBool(Result); rt.add(pos); rt.addTupleCount(2); @@ -15441,7 +15478,7 @@ case wxListCtrl_GetItemRect: { // wxListCtrl::GetItemRect } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->GetItemRect((long) *item,rect,code); + bool Result = This->GetItemRect(*item,rect,code); rt.addBool(Result); rt.add(rect); rt.addTupleCount(2); @@ -15459,7 +15496,7 @@ case wxListCtrl_GetItemState: { // wxListCtrl::GetItemState int * item = (int *) bp; bp += 4; int * stateMask = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetItemState((long) *item,(long) *stateMask); + int Result = This->GetItemState(*item,*stateMask); rt.addInt(Result); break; } @@ -15467,7 +15504,7 @@ case wxListCtrl_GetItemText: { // wxListCtrl::GetItemText wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetItemText((long) *item); + wxString Result = This->GetItemText(*item); rt.add(Result); break; } @@ -15475,7 +15512,7 @@ case wxListCtrl_GetItemTextColour: { // wxListCtrl::GetItemTextColour wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxColour Result = This->GetItemTextColour((long) *item); + wxColour Result = This->GetItemTextColour(*item); rt.add(Result); break; } @@ -15493,7 +15530,7 @@ case wxListCtrl_GetNextItem: { // wxListCtrl::GetNextItem } break; }}; if(!This) throw wxe_badarg(0); - long Result = This->GetNextItem((long) *item,geometry,state); + long Result = This->GetNextItem(*item,geometry,state); rt.addInt(Result); break; } @@ -15541,7 +15578,7 @@ case wxListCtrl_InsertColumn_2: { // wxListCtrl::InsertColumn int * col = (int *) bp; bp += 4; wxListItem *info = (wxListItem *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - long Result = This->InsertColumn((long) *col,*info); + long Result = This->InsertColumn(*col,*info); rt.addInt(Result); break; } @@ -15562,7 +15599,7 @@ case wxListCtrl_InsertColumn_3: { // wxListCtrl::InsertColumn } break; }}; if(!This) throw wxe_badarg(0); - long Result = This->InsertColumn((long) *col,heading,format,width); + long Result = This->InsertColumn(*col,heading,format,width); rt.addInt(Result); break; } @@ -15581,7 +15618,7 @@ case wxListCtrl_InsertItem_2_1: { // wxListCtrl::InsertItem wxString label = wxString(bp, wxConvUTF8); bp += *labelLen+((8-((4+ *labelLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - long Result = This->InsertItem((long) *index,label); + long Result = This->InsertItem(*index,label); rt.addInt(Result); break; } @@ -15590,7 +15627,7 @@ case wxListCtrl_InsertItem_2_0: { // wxListCtrl::InsertItem int * index = (int *) bp; bp += 4; int * imageIndex = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - long Result = This->InsertItem((long) *index,(int) *imageIndex); + long Result = This->InsertItem(*index,*imageIndex); rt.addInt(Result); break; } @@ -15602,7 +15639,7 @@ case wxListCtrl_InsertItem_3: { // wxListCtrl::InsertItem bp += *labelLen+((8-((4+ *labelLen) & 7)) & 7); int * imageIndex = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - long Result = This->InsertItem((long) *index,label,(int) *imageIndex); + long Result = This->InsertItem(*index,label,*imageIndex); rt.addInt(Result); break; } @@ -15610,7 +15647,7 @@ case wxListCtrl_RefreshItem: { // wxListCtrl::RefreshItem wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->RefreshItem((long) *item); + This->RefreshItem(*item); break; } case wxListCtrl_RefreshItems: { // wxListCtrl::RefreshItems @@ -15618,7 +15655,7 @@ case wxListCtrl_RefreshItems: { // wxListCtrl::RefreshItems int * itemFrom = (int *) bp; bp += 4; int * itemTo = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->RefreshItems((long) *itemFrom,(long) *itemTo); + This->RefreshItems(*itemFrom,*itemTo); break; } case wxListCtrl_ScrollList: { // wxListCtrl::ScrollList @@ -15626,7 +15663,7 @@ case wxListCtrl_ScrollList: { // wxListCtrl::ScrollList int * dx = (int *) bp; bp += 4; int * dy = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->ScrollList((int) *dx,(int) *dy); + bool Result = This->ScrollList(*dx,*dy); rt.addBool(Result); break; } @@ -15647,7 +15684,7 @@ case wxListCtrl_SetColumn: { // wxListCtrl::SetColumn int * col = (int *) bp; bp += 4; wxListItem *item = (wxListItem *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetColumn((int) *col,*item); + bool Result = This->SetColumn(*col,*item); rt.addBool(Result); break; } @@ -15656,7 +15693,7 @@ case wxListCtrl_SetColumnWidth: { // wxListCtrl::SetColumnWidth int * col = (int *) bp; bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetColumnWidth((int) *col,(int) *width); + bool Result = This->SetColumnWidth(*col,*width); rt.addBool(Result); break; } @@ -15665,7 +15702,7 @@ case wxListCtrl_SetImageList: { // wxListCtrl::SetImageList wxImageList *imageList = (wxImageList *) getPtr(bp,memenv); bp += 4; int * which = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetImageList(imageList,(int) *which); + This->SetImageList(imageList,*which); break; } case wxListCtrl_SetItem_1: { // wxListCtrl::SetItem @@ -15690,7 +15727,7 @@ case wxListCtrl_SetItem_4: { // wxListCtrl::SetItem } break; }}; if(!This) throw wxe_badarg(0); - long Result = This->SetItem((long) *index,(int) *col,label,imageId); + long Result = This->SetItem(*index,*col,label,imageId); rt.addInt(Result); break; } @@ -15703,14 +15740,14 @@ case wxListCtrl_SetItemBackgroundColour: { // wxListCtrl::SetItemBackgroundColou int * colA = (int *) bp; bp += 4; wxColour col = wxColour(*colR,*colG,*colB,*colA); if(!This) throw wxe_badarg(0); - This->SetItemBackgroundColour((long) *item,col); + This->SetItemBackgroundColour(*item,col); break; } case wxListCtrl_SetItemCount: { // wxListCtrl::SetItemCount wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * count = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetItemCount((long) *count); + This->SetItemCount(*count); break; } case wxListCtrl_SetItemData: { // wxListCtrl::SetItemData @@ -15718,7 +15755,7 @@ case wxListCtrl_SetItemData: { // wxListCtrl::SetItemData int * item = (int *) bp; bp += 4; int * data = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetItemData((long) *item,(long) *data); + bool Result = This->SetItemData(*item,*data); rt.addBool(Result); break; } @@ -15727,7 +15764,7 @@ case wxListCtrl_SetItemFont: { // wxListCtrl::SetItemFont int * item = (int *) bp; bp += 4; wxFont *f = (wxFont *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->SetItemFont((long) *item,*f); + This->SetItemFont(*item,*f); break; } case wxListCtrl_SetItemImage: { // wxListCtrl::SetItemImage @@ -15742,7 +15779,7 @@ case wxListCtrl_SetItemImage: { // wxListCtrl::SetItemImage } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->SetItemImage((long) *item,(int) *image,selImage); + bool Result = This->SetItemImage(*item,*image,selImage); rt.addBool(Result); break; } @@ -15752,7 +15789,7 @@ case wxListCtrl_SetItemColumnImage: { // wxListCtrl::SetItemColumnImage int * column = (int *) bp; bp += 4; int * image = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetItemColumnImage((long) *item,(long) *column,(int) *image); + bool Result = This->SetItemColumnImage(*item,*column,*image); rt.addBool(Result); break; } @@ -15763,7 +15800,7 @@ case wxListCtrl_SetItemPosition: { // wxListCtrl::SetItemPosition int * posY = (int *) bp; bp += 4; wxPoint pos = wxPoint(*posX,*posY); if(!This) throw wxe_badarg(0); - bool Result = This->SetItemPosition((long) *item,pos); + bool Result = This->SetItemPosition(*item,pos); rt.addBool(Result); break; } @@ -15773,7 +15810,7 @@ case wxListCtrl_SetItemState: { // wxListCtrl::SetItemState int * state = (int *) bp; bp += 4; int * stateMask = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetItemState((long) *item,(long) *state,(long) *stateMask); + bool Result = This->SetItemState(*item,*state,*stateMask); rt.addBool(Result); break; } @@ -15784,7 +15821,7 @@ case wxListCtrl_SetItemText: { // wxListCtrl::SetItemText wxString str = wxString(bp, wxConvUTF8); bp += *strLen+((8-((4+ *strLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetItemText((long) *item,str); + This->SetItemText(*item,str); break; } case wxListCtrl_SetItemTextColour: { // wxListCtrl::SetItemTextColour @@ -15796,7 +15833,7 @@ case wxListCtrl_SetItemTextColour: { // wxListCtrl::SetItemTextColour int * colA = (int *) bp; bp += 4; wxColour col = wxColour(*colR,*colG,*colB,*colA); if(!This) throw wxe_badarg(0); - This->SetItemTextColour((long) *item,col); + This->SetItemTextColour(*item,col); break; } case wxListCtrl_SetSingleStyle: { // wxListCtrl::SetSingleStyle @@ -15809,7 +15846,7 @@ case wxListCtrl_SetSingleStyle: { // wxListCtrl::SetSingleStyle } break; }}; if(!This) throw wxe_badarg(0); - This->SetSingleStyle((long) *style,add); + This->SetSingleStyle(*style,add); break; } case wxListCtrl_SetTextColour: { // wxListCtrl::SetTextColour @@ -15827,7 +15864,7 @@ case wxListCtrl_SetWindowStyleFlag: { // wxListCtrl::SetWindowStyleFlag wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * style = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWindowStyleFlag((long) *style); + This->SetWindowStyleFlag(*style); break; } @@ -15857,14 +15894,14 @@ case wxListView_ClearColumnImage: { // wxListView::ClearColumnImage wxListView *This = (wxListView *) getPtr(bp,memenv); bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ClearColumnImage((int) *col); + This->ClearColumnImage(*col); break; } case wxListView_Focus: { // wxListView::Focus wxListView *This = (wxListView *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Focus((long) *index); + This->Focus(*index); break; } case wxListView_GetFirstSelected: { // wxListView::GetFirstSelected @@ -15885,7 +15922,7 @@ case wxListView_GetNextSelected: { // wxListView::GetNextSelected wxListView *This = (wxListView *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - long Result = This->GetNextSelected((long) *item); + long Result = This->GetNextSelected(*item); rt.addInt(Result); break; } @@ -15893,7 +15930,7 @@ case wxListView_IsSelected: { // wxListView::IsSelected wxListView *This = (wxListView *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsSelected((long) *index); + bool Result = This->IsSelected(*index); rt.addBool(Result); break; } @@ -15907,7 +15944,7 @@ case wxListView_Select: { // wxListView::Select } break; }}; if(!This) throw wxe_badarg(0); - This->Select((long) *n,on); + This->Select(*n,on); break; } case wxListView_SetColumnImage: { // wxListView::SetColumnImage @@ -15915,7 +15952,7 @@ case wxListView_SetColumnImage: { // wxListView::SetColumnImage int * col = (int *) bp; bp += 4; int * image = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColumnImage((int) *col,(int) *image); + This->SetColumnImage(*col,*image); break; } case wxListItem_new_0: { // wxListItem::wxListItem @@ -16018,7 +16055,7 @@ case wxListItem_SetAlign: { // wxListItem::SetAlign wxListItem *This = (wxListItem *) getPtr(bp,memenv); bp += 4; wxListColumnFormat align = *(wxListColumnFormat *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetAlign((wxListColumnFormat) align); + This->SetAlign(align); break; } case wxListItem_SetBackgroundColour: { // wxListItem::SetBackgroundColour @@ -16036,7 +16073,7 @@ case wxListItem_SetColumn: { // wxListItem::SetColumn wxListItem *This = (wxListItem *) getPtr(bp,memenv); bp += 4; int * col = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColumn((int) *col); + This->SetColumn(*col); break; } case wxListItem_SetFont: { // wxListItem::SetFont @@ -16050,35 +16087,35 @@ case wxListItem_SetId: { // wxListItem::SetId wxListItem *This = (wxListItem *) getPtr(bp,memenv); bp += 4; int * id = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetId((long) *id); + This->SetId(*id); break; } case wxListItem_SetImage: { // wxListItem::SetImage wxListItem *This = (wxListItem *) getPtr(bp,memenv); bp += 4; int * image = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetImage((int) *image); + This->SetImage(*image); break; } case wxListItem_SetMask: { // wxListItem::SetMask wxListItem *This = (wxListItem *) getPtr(bp,memenv); bp += 4; int * mask = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMask((long) *mask); + This->SetMask(*mask); break; } case wxListItem_SetState: { // wxListItem::SetState wxListItem *This = (wxListItem *) getPtr(bp,memenv); bp += 4; int * state = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetState((long) *state); + This->SetState(*state); break; } case wxListItem_SetStateMask: { // wxListItem::SetStateMask wxListItem *This = (wxListItem *) getPtr(bp,memenv); bp += 4; int * stateMask = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetStateMask((long) *stateMask); + This->SetStateMask(*stateMask); break; } case wxListItem_SetText: { // wxListItem::SetText @@ -16105,7 +16142,7 @@ case wxListItem_SetWidth: { // wxListItem::SetWidth wxListItem *This = (wxListItem *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWidth((int) *width); + This->SetWidth(*width); break; } case wxListItemAttr_new_0: { // wxListItemAttr::wxListItemAttr @@ -16227,7 +16264,7 @@ case wxImageList_new_3: { // wxImageList::wxImageList initialCount = (int)*(int *) bp; bp += 4; } break; }}; - wxImageList * Result = new EwxImageList((int) *width,(int) *height,mask,initialCount); + wxImageList * Result = new EwxImageList(*width,*height,mask,initialCount); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxImageList"); break; @@ -16278,7 +16315,7 @@ case wxImageList_Create: { // wxImageList::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create((int) *width,(int) *height,mask,initialCount); + bool Result = This->Create(*width,*height,mask,initialCount); rt.addBool(Result); break; } @@ -16300,7 +16337,7 @@ case wxImageList_Draw: { // wxImageList::Draw } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Draw((int) *index,*dc,(int) *x,(int) *y,flags,solidBackground); + bool Result = This->Draw(*index,*dc,*x,*y,flags,solidBackground); rt.addBool(Result); break; } @@ -16308,7 +16345,7 @@ case wxImageList_GetBitmap: { // wxImageList::GetBitmap wxImageList *This = (wxImageList *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxBitmap * Result = new wxBitmap(This->GetBitmap((int) *index)); newPtr((void *) Result,3, memenv);; + wxBitmap * Result = new wxBitmap(This->GetBitmap(*index)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } @@ -16316,7 +16353,7 @@ case wxImageList_GetIcon: { // wxImageList::GetIcon wxImageList *This = (wxImageList *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxIcon * Result = new wxIcon(This->GetIcon((int) *index)); newPtr((void *) Result,3, memenv);; + wxIcon * Result = new wxIcon(This->GetIcon(*index)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxIcon"); break; } @@ -16333,7 +16370,7 @@ case wxImageList_GetSize: { // wxImageList::GetSize wxImageList *This = (wxImageList *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetSize((int) *index,width,height); + bool Result = This->GetSize(*index,width,height); rt.addBool(Result); rt.addInt(width); rt.addInt(height); @@ -16344,7 +16381,7 @@ case wxImageList_Remove: { // wxImageList::Remove wxImageList *This = (wxImageList *) getPtr(bp,memenv); bp += 4; int * index = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Remove((int) *index); + bool Result = This->Remove(*index); rt.addBool(Result); break; } @@ -16360,7 +16397,7 @@ case wxImageList_Replace_2: { // wxImageList::Replace int * index = (int *) bp; bp += 4; wxBitmap *bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Replace((int) *index,*bitmap); + bool Result = This->Replace(*index,*bitmap); rt.addBool(Result); break; } @@ -16370,7 +16407,7 @@ case wxImageList_Replace_3: { // wxImageList::Replace wxBitmap *bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4; wxBitmap *mask = (wxBitmap *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Replace((int) *index,*bitmap,*mask); + bool Result = This->Replace(*index,*bitmap,*mask); rt.addBool(Result); break; } @@ -16405,7 +16442,7 @@ font = (wxFont *) getPtr(bp,memenv); bp += 4; alignment = *(wxTextAttrAlignment *) bp; bp += 4;; } break; }}; - wxTextAttr * Result = new wxTextAttr(colText,colBack,*font,(wxTextAttrAlignment) alignment); + wxTextAttr * Result = new wxTextAttr(colText,colBack,*font,alignment); newPtr((void *) Result, 103, memenv); rt.addRef(getRef((void *)Result,memenv), "wxTextAttr"); break; @@ -16427,7 +16464,7 @@ case wxTextAttr_GetBackgroundColour: { // wxTextAttr::GetBackgroundColour case wxTextAttr_GetFont: { // wxTextAttr::GetFont wxTextAttr *This = (wxTextAttr *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxFont * Result = &This->GetFont(); + const wxFont * Result = new wxFont(This->GetFont()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxFont"); break; } @@ -16505,7 +16542,7 @@ case wxTextAttr_SetAlignment: { // wxTextAttr::SetAlignment wxTextAttr *This = (wxTextAttr *) getPtr(bp,memenv); bp += 4; wxTextAttrAlignment alignment = *(wxTextAttrAlignment *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetAlignment((wxTextAttrAlignment) alignment); + This->SetAlignment(alignment); break; } case wxTextAttr_SetBackgroundColour: { // wxTextAttr::SetBackgroundColour @@ -16523,7 +16560,7 @@ case wxTextAttr_SetFlags: { // wxTextAttr::SetFlags wxTextAttr *This = (wxTextAttr *) getPtr(bp,memenv); bp += 4; int * flags = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFlags((long) *flags); + This->SetFlags(*flags); break; } case wxTextAttr_SetFont: { // wxTextAttr::SetFont @@ -16549,14 +16586,14 @@ case wxTextAttr_SetLeftIndent: { // wxTextAttr::SetLeftIndent } break; }}; if(!This) throw wxe_badarg(0); - This->SetLeftIndent((int) *indent,subIndent); + This->SetLeftIndent(*indent,subIndent); break; } case wxTextAttr_SetRightIndent: { // wxTextAttr::SetRightIndent wxTextAttr *This = (wxTextAttr *) getPtr(bp,memenv); bp += 4; int * indent = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRightIndent((int) *indent); + This->SetRightIndent(*indent); break; } case wxTextAttr_SetTabs: { // wxTextAttr::SetTabs @@ -16619,7 +16656,7 @@ case wxTextCtrl_new_3: { // wxTextCtrl::wxTextCtrl validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxTextCtrl * Result = new EwxTextCtrl(parent,(wxWindowID) *id,value,pos,size,style,*validator); + wxTextCtrl * Result = new EwxTextCtrl(parent,*id,value,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxTextCtrl"); break; @@ -16722,7 +16759,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,value,pos,size,style,*validator); + bool Result = This->Create(parent,*id,value,pos,size,style,*validator); rt.addBool(Result); break; } @@ -16771,7 +16808,7 @@ case wxTextCtrl_GetLineLength: { // wxTextCtrl::GetLineLength wxTextCtrl *This = (wxTextCtrl *) getPtr(bp,memenv); bp += 4; int * lineNo = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetLineLength((long) *lineNo); + int Result = This->GetLineLength(*lineNo); rt.addInt(Result); break; } @@ -16779,7 +16816,7 @@ case wxTextCtrl_GetLineText: { // wxTextCtrl::GetLineText wxTextCtrl *This = (wxTextCtrl *) getPtr(bp,memenv); bp += 4; int * lineNo = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetLineText((long) *lineNo); + wxString Result = This->GetLineText(*lineNo); rt.add(Result); break; } @@ -16795,7 +16832,7 @@ case wxTextCtrl_GetRange: { // wxTextCtrl::GetRange int * from = (int *) bp; bp += 4; int * to = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetRange((long) *from,(long) *to); + wxString Result = This->GetRange(*from,*to); rt.add(Result); break; } @@ -16822,7 +16859,7 @@ case wxTextCtrl_GetStyle: { // wxTextCtrl::GetStyle int * position = (int *) bp; bp += 4; wxTextAttr *style = (wxTextAttr *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetStyle((long) *position,*style); + bool Result = This->GetStyle(*position,*style); rt.addBool(Result); break; } @@ -16895,7 +16932,7 @@ case wxTextCtrl_PositionToXY: { // wxTextCtrl::PositionToXY wxTextCtrl *This = (wxTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->PositionToXY((long) *pos,&x,&y); + bool Result = This->PositionToXY(*pos,&x,&y); rt.addBool(Result); rt.addInt(x); rt.addInt(y); @@ -16913,7 +16950,7 @@ case wxTextCtrl_Remove: { // wxTextCtrl::Remove int * from = (int *) bp; bp += 4; int * to = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Remove((long) *from,(long) *to); + This->Remove(*from,*to); break; } case wxTextCtrl_Replace: { // wxTextCtrl::Replace @@ -16924,7 +16961,7 @@ case wxTextCtrl_Replace: { // wxTextCtrl::Replace wxString value = wxString(bp, wxConvUTF8); bp += *valueLen+((8-((0+ *valueLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->Replace((long) *from,(long) *to,value); + This->Replace(*from,*to,value); break; } case wxTextCtrl_SaveFile: { // wxTextCtrl::SaveFile @@ -16959,14 +16996,14 @@ case wxTextCtrl_SetEditable: { // wxTextCtrl::SetEditable wxTextCtrl *This = (wxTextCtrl *) getPtr(bp,memenv); bp += 4; bool * editable = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetEditable((bool) *editable); + This->SetEditable(*editable); break; } case wxTextCtrl_SetInsertionPoint: { // wxTextCtrl::SetInsertionPoint wxTextCtrl *This = (wxTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetInsertionPoint((long) *pos); + This->SetInsertionPoint(*pos); break; } case wxTextCtrl_SetInsertionPointEnd: { // wxTextCtrl::SetInsertionPointEnd @@ -16979,7 +17016,7 @@ case wxTextCtrl_SetMaxLength: { // wxTextCtrl::SetMaxLength wxTextCtrl *This = (wxTextCtrl *) getPtr(bp,memenv); bp += 4; unsigned int * len = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMaxLength((long) *len); + This->SetMaxLength(*len); break; } case wxTextCtrl_SetSelection: { // wxTextCtrl::SetSelection @@ -16987,7 +17024,7 @@ case wxTextCtrl_SetSelection: { // wxTextCtrl::SetSelection int * from = (int *) bp; bp += 4; int * to = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((long) *from,(long) *to); + This->SetSelection(*from,*to); break; } case wxTextCtrl_SetStyle: { // wxTextCtrl::SetStyle @@ -16996,7 +17033,7 @@ case wxTextCtrl_SetStyle: { // wxTextCtrl::SetStyle int * end = (int *) bp; bp += 4; wxTextAttr *style = (wxTextAttr *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetStyle((long) *start,(long) *end,*style); + bool Result = This->SetStyle(*start,*end,*style); rt.addBool(Result); break; } @@ -17013,7 +17050,7 @@ case wxTextCtrl_ShowPosition: { // wxTextCtrl::ShowPosition wxTextCtrl *This = (wxTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ShowPosition((long) *pos); + This->ShowPosition(*pos); break; } case wxTextCtrl_Undo: { // wxTextCtrl::Undo @@ -17036,7 +17073,7 @@ case wxTextCtrl_XYToPosition: { // wxTextCtrl::XYToPosition int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - long Result = This->XYToPosition((long) *x,(long) *y); + long Result = This->XYToPosition(*x,*y); rt.addInt(Result); break; } @@ -17069,7 +17106,7 @@ case wxNotebook_new_3: { // wxNotebook::wxNotebook style = (long)*(int *) bp; bp += 4; } break; }}; - wxNotebook * Result = new EwxNotebook(parent,(wxWindowID) *winid,pos,size,style); + wxNotebook * Result = new EwxNotebook(parent,*winid,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxNotebook"); break; @@ -17141,7 +17178,7 @@ case wxNotebook_Create: { // wxNotebook::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,pos,size,style); + bool Result = This->Create(parent,*id,pos,size,style); rt.addBool(Result); break; } @@ -17156,7 +17193,7 @@ case wxNotebook_DeletePage: { // wxNotebook::DeletePage wxNotebook *This = (wxNotebook *) getPtr(bp,memenv); bp += 4; int * nPage = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeletePage((size_t) *nPage); + bool Result = This->DeletePage(*nPage); rt.addBool(Result); break; } @@ -17164,7 +17201,7 @@ case wxNotebook_RemovePage: { // wxNotebook::RemovePage wxNotebook *This = (wxNotebook *) getPtr(bp,memenv); bp += 4; int * nPage = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->RemovePage((size_t) *nPage); + bool Result = This->RemovePage(*nPage); rt.addBool(Result); break; } @@ -17186,7 +17223,7 @@ case wxNotebook_GetPage: { // wxNotebook::GetPage wxNotebook *This = (wxNotebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxWindow * Result = (wxWindow*)This->GetPage((size_t) *n); + wxWindow * Result = (wxWindow*)This->GetPage(*n); rt.addRef(getRef((void *)Result,memenv), "wxWindow"); break; } @@ -17201,7 +17238,7 @@ case wxNotebook_GetPageImage: { // wxNotebook::GetPageImage wxNotebook *This = (wxNotebook *) getPtr(bp,memenv); bp += 4; int * nPage = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetPageImage((size_t) *nPage); + int Result = This->GetPageImage(*nPage); rt.addInt(Result); break; } @@ -17209,7 +17246,7 @@ case wxNotebook_GetPageText: { // wxNotebook::GetPageText wxNotebook *This = (wxNotebook *) getPtr(bp,memenv); bp += 4; int * nPage = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetPageText((size_t) *nPage); + wxString Result = This->GetPageText(*nPage); rt.add(Result); break; } @@ -17265,7 +17302,7 @@ case wxNotebook_InsertPage: { // wxNotebook::InsertPage } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->InsertPage((size_t) *position,win,strText,bSelect,imageId); + bool Result = This->InsertPage(*position,win,strText,bSelect,imageId); rt.addBool(Result); break; } @@ -17299,7 +17336,7 @@ case wxNotebook_SetPageImage: { // wxNotebook::SetPageImage int * nPage = (int *) bp; bp += 4; int * nImage = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetPageImage((size_t) *nPage,(int) *nImage); + bool Result = This->SetPageImage(*nPage,*nImage); rt.addBool(Result); break; } @@ -17310,7 +17347,7 @@ case wxNotebook_SetPageText: { // wxNotebook::SetPageText wxString strText = wxString(bp, wxConvUTF8); bp += *strTextLen+((8-((4+ *strTextLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - bool Result = This->SetPageText((size_t) *nPage,strText); + bool Result = This->SetPageText(*nPage,strText); rt.addBool(Result); break; } @@ -17318,7 +17355,7 @@ case wxNotebook_SetSelection: { // wxNotebook::SetSelection wxNotebook *This = (wxNotebook *) getPtr(bp,memenv); bp += 4; int * nPage = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->SetSelection((size_t) *nPage); + int Result = This->SetSelection(*nPage); rt.addInt(Result); break; } @@ -17326,7 +17363,7 @@ case wxNotebook_ChangeSelection: { // wxNotebook::ChangeSelection wxNotebook *This = (wxNotebook *) getPtr(bp,memenv); bp += 4; int * nPage = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->ChangeSelection((size_t) *nPage); + int Result = This->ChangeSelection(*nPage); rt.addInt(Result); break; } @@ -17359,7 +17396,7 @@ case wxChoicebook_new_3: { // wxChoicebook::wxChoicebook style = (long)*(int *) bp; bp += 4; } break; }}; - wxChoicebook * Result = new EwxChoicebook(parent,(wxWindowID) *id,pos,size,style); + wxChoicebook * Result = new EwxChoicebook(parent,*id,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxChoicebook"); break; @@ -17431,7 +17468,7 @@ case wxChoicebook_Create: { // wxChoicebook::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,pos,size,style); + bool Result = This->Create(parent,*id,pos,size,style); rt.addBool(Result); break; } @@ -17446,7 +17483,7 @@ case wxChoicebook_DeletePage: { // wxChoicebook::DeletePage wxChoicebook *This = (wxChoicebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeletePage((size_t) *n); + bool Result = This->DeletePage(*n); rt.addBool(Result); break; } @@ -17454,7 +17491,7 @@ case wxChoicebook_RemovePage: { // wxChoicebook::RemovePage wxChoicebook *This = (wxChoicebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->RemovePage((size_t) *n); + bool Result = This->RemovePage(*n); rt.addBool(Result); break; } @@ -17476,7 +17513,7 @@ case wxChoicebook_GetPage: { // wxChoicebook::GetPage wxChoicebook *This = (wxChoicebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxWindow * Result = (wxWindow*)This->GetPage((size_t) *n); + wxWindow * Result = (wxWindow*)This->GetPage(*n); rt.addRef(getRef((void *)Result,memenv), "wxWindow"); break; } @@ -17491,7 +17528,7 @@ case wxChoicebook_GetPageImage: { // wxChoicebook::GetPageImage wxChoicebook *This = (wxChoicebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetPageImage((size_t) *n); + int Result = This->GetPageImage(*n); rt.addInt(Result); break; } @@ -17499,7 +17536,7 @@ case wxChoicebook_GetPageText: { // wxChoicebook::GetPageText wxChoicebook *This = (wxChoicebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetPageText((size_t) *n); + wxString Result = This->GetPageText(*n); rt.add(Result); break; } @@ -17541,7 +17578,7 @@ case wxChoicebook_InsertPage: { // wxChoicebook::InsertPage } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->InsertPage((size_t) *n,page,text,bSelect,imageId); + bool Result = This->InsertPage(*n,page,text,bSelect,imageId); rt.addBool(Result); break; } @@ -17566,7 +17603,7 @@ case wxChoicebook_SetPageImage: { // wxChoicebook::SetPageImage int * n = (int *) bp; bp += 4; int * imageId = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetPageImage((size_t) *n,(int) *imageId); + bool Result = This->SetPageImage(*n,*imageId); rt.addBool(Result); break; } @@ -17577,7 +17614,7 @@ case wxChoicebook_SetPageText: { // wxChoicebook::SetPageText wxString strText = wxString(bp, wxConvUTF8); bp += *strTextLen+((8-((4+ *strTextLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - bool Result = This->SetPageText((size_t) *n,strText); + bool Result = This->SetPageText(*n,strText); rt.addBool(Result); break; } @@ -17585,7 +17622,7 @@ case wxChoicebook_SetSelection: { // wxChoicebook::SetSelection wxChoicebook *This = (wxChoicebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->SetSelection((size_t) *n); + int Result = This->SetSelection(*n); rt.addInt(Result); break; } @@ -17593,7 +17630,7 @@ case wxChoicebook_ChangeSelection: { // wxChoicebook::ChangeSelection wxChoicebook *This = (wxChoicebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->ChangeSelection((size_t) *n); + int Result = This->ChangeSelection(*n); rt.addInt(Result); break; } @@ -17626,7 +17663,7 @@ case wxToolbook_new_3: { // wxToolbook::wxToolbook style = (long)*(int *) bp; bp += 4; } break; }}; - wxToolbook * Result = new EwxToolbook(parent,(wxWindowID) *id,pos,size,style); + wxToolbook * Result = new EwxToolbook(parent,*id,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxToolbook"); break; @@ -17698,7 +17735,7 @@ case wxToolbook_Create: { // wxToolbook::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,pos,size,style); + bool Result = This->Create(parent,*id,pos,size,style); rt.addBool(Result); break; } @@ -17713,7 +17750,7 @@ case wxToolbook_DeletePage: { // wxToolbook::DeletePage wxToolbook *This = (wxToolbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeletePage((size_t) *n); + bool Result = This->DeletePage(*n); rt.addBool(Result); break; } @@ -17721,7 +17758,7 @@ case wxToolbook_RemovePage: { // wxToolbook::RemovePage wxToolbook *This = (wxToolbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->RemovePage((size_t) *n); + bool Result = This->RemovePage(*n); rt.addBool(Result); break; } @@ -17743,7 +17780,7 @@ case wxToolbook_GetPage: { // wxToolbook::GetPage wxToolbook *This = (wxToolbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxWindow * Result = (wxWindow*)This->GetPage((size_t) *n); + wxWindow * Result = (wxWindow*)This->GetPage(*n); rt.addRef(getRef((void *)Result,memenv), "wxWindow"); break; } @@ -17758,7 +17795,7 @@ case wxToolbook_GetPageImage: { // wxToolbook::GetPageImage wxToolbook *This = (wxToolbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetPageImage((size_t) *n); + int Result = This->GetPageImage(*n); rt.addInt(Result); break; } @@ -17766,7 +17803,7 @@ case wxToolbook_GetPageText: { // wxToolbook::GetPageText wxToolbook *This = (wxToolbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetPageText((size_t) *n); + wxString Result = This->GetPageText(*n); rt.add(Result); break; } @@ -17808,7 +17845,7 @@ case wxToolbook_InsertPage: { // wxToolbook::InsertPage } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->InsertPage((size_t) *n,page,text,bSelect,imageId); + bool Result = This->InsertPage(*n,page,text,bSelect,imageId); rt.addBool(Result); break; } @@ -17833,7 +17870,7 @@ case wxToolbook_SetPageImage: { // wxToolbook::SetPageImage int * n = (int *) bp; bp += 4; int * imageId = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetPageImage((size_t) *n,(int) *imageId); + bool Result = This->SetPageImage(*n,*imageId); rt.addBool(Result); break; } @@ -17844,7 +17881,7 @@ case wxToolbook_SetPageText: { // wxToolbook::SetPageText wxString strText = wxString(bp, wxConvUTF8); bp += *strTextLen+((8-((4+ *strTextLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - bool Result = This->SetPageText((size_t) *n,strText); + bool Result = This->SetPageText(*n,strText); rt.addBool(Result); break; } @@ -17852,7 +17889,7 @@ case wxToolbook_SetSelection: { // wxToolbook::SetSelection wxToolbook *This = (wxToolbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->SetSelection((size_t) *n); + int Result = This->SetSelection(*n); rt.addInt(Result); break; } @@ -17860,7 +17897,7 @@ case wxToolbook_ChangeSelection: { // wxToolbook::ChangeSelection wxToolbook *This = (wxToolbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->ChangeSelection((size_t) *n); + int Result = This->ChangeSelection(*n); rt.addInt(Result); break; } @@ -17893,7 +17930,7 @@ case wxListbook_new_3: { // wxListbook::wxListbook style = (long)*(int *) bp; bp += 4; } break; }}; - wxListbook * Result = new EwxListbook(parent,(wxWindowID) *id,pos,size,style); + wxListbook * Result = new EwxListbook(parent,*id,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxListbook"); break; @@ -17965,7 +18002,7 @@ case wxListbook_Create: { // wxListbook::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,pos,size,style); + bool Result = This->Create(parent,*id,pos,size,style); rt.addBool(Result); break; } @@ -17980,7 +18017,7 @@ case wxListbook_DeletePage: { // wxListbook::DeletePage wxListbook *This = (wxListbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeletePage((size_t) *n); + bool Result = This->DeletePage(*n); rt.addBool(Result); break; } @@ -17988,7 +18025,7 @@ case wxListbook_RemovePage: { // wxListbook::RemovePage wxListbook *This = (wxListbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->RemovePage((size_t) *n); + bool Result = This->RemovePage(*n); rt.addBool(Result); break; } @@ -18010,7 +18047,7 @@ case wxListbook_GetPage: { // wxListbook::GetPage wxListbook *This = (wxListbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxWindow * Result = (wxWindow*)This->GetPage((size_t) *n); + wxWindow * Result = (wxWindow*)This->GetPage(*n); rt.addRef(getRef((void *)Result,memenv), "wxWindow"); break; } @@ -18025,7 +18062,7 @@ case wxListbook_GetPageImage: { // wxListbook::GetPageImage wxListbook *This = (wxListbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetPageImage((size_t) *n); + int Result = This->GetPageImage(*n); rt.addInt(Result); break; } @@ -18033,7 +18070,7 @@ case wxListbook_GetPageText: { // wxListbook::GetPageText wxListbook *This = (wxListbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetPageText((size_t) *n); + wxString Result = This->GetPageText(*n); rt.add(Result); break; } @@ -18075,7 +18112,7 @@ case wxListbook_InsertPage: { // wxListbook::InsertPage } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->InsertPage((size_t) *n,page,text,bSelect,imageId); + bool Result = This->InsertPage(*n,page,text,bSelect,imageId); rt.addBool(Result); break; } @@ -18100,7 +18137,7 @@ case wxListbook_SetPageImage: { // wxListbook::SetPageImage int * n = (int *) bp; bp += 4; int * imageId = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetPageImage((size_t) *n,(int) *imageId); + bool Result = This->SetPageImage(*n,*imageId); rt.addBool(Result); break; } @@ -18111,7 +18148,7 @@ case wxListbook_SetPageText: { // wxListbook::SetPageText wxString strText = wxString(bp, wxConvUTF8); bp += *strTextLen+((8-((4+ *strTextLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - bool Result = This->SetPageText((size_t) *n,strText); + bool Result = This->SetPageText(*n,strText); rt.addBool(Result); break; } @@ -18119,7 +18156,7 @@ case wxListbook_SetSelection: { // wxListbook::SetSelection wxListbook *This = (wxListbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->SetSelection((size_t) *n); + int Result = This->SetSelection(*n); rt.addInt(Result); break; } @@ -18127,7 +18164,7 @@ case wxListbook_ChangeSelection: { // wxListbook::ChangeSelection wxListbook *This = (wxListbook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->ChangeSelection((size_t) *n); + int Result = This->ChangeSelection(*n); rt.addInt(Result); break; } @@ -18160,7 +18197,7 @@ case wxTreebook_new_3: { // wxTreebook::wxTreebook style = (long)*(int *) bp; bp += 4; } break; }}; - wxTreebook * Result = new EwxTreebook(parent,(wxWindowID) *id,pos,size,style); + wxTreebook * Result = new EwxTreebook(parent,*id,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxTreebook"); break; @@ -18232,7 +18269,7 @@ case wxTreebook_Create: { // wxTreebook::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,pos,size,style); + bool Result = This->Create(parent,*id,pos,size,style); rt.addBool(Result); break; } @@ -18247,7 +18284,7 @@ case wxTreebook_DeletePage: { // wxTreebook::DeletePage wxTreebook *This = (wxTreebook *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeletePage((size_t) *pos); + bool Result = This->DeletePage(*pos); rt.addBool(Result); break; } @@ -18255,7 +18292,7 @@ case wxTreebook_RemovePage: { // wxTreebook::RemovePage wxTreebook *This = (wxTreebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->RemovePage((size_t) *n); + bool Result = This->RemovePage(*n); rt.addBool(Result); break; } @@ -18277,7 +18314,7 @@ case wxTreebook_GetPage: { // wxTreebook::GetPage wxTreebook *This = (wxTreebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxWindow * Result = (wxWindow*)This->GetPage((size_t) *n); + wxWindow * Result = (wxWindow*)This->GetPage(*n); rt.addRef(getRef((void *)Result,memenv), "wxWindow"); break; } @@ -18292,7 +18329,7 @@ case wxTreebook_GetPageImage: { // wxTreebook::GetPageImage wxTreebook *This = (wxTreebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetPageImage((size_t) *n); + int Result = This->GetPageImage(*n); rt.addInt(Result); break; } @@ -18300,7 +18337,7 @@ case wxTreebook_GetPageText: { // wxTreebook::GetPageText wxTreebook *This = (wxTreebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetPageText((size_t) *n); + wxString Result = This->GetPageText(*n); rt.add(Result); break; } @@ -18321,7 +18358,7 @@ case wxTreebook_ExpandNode: { // wxTreebook::ExpandNode } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->ExpandNode((size_t) *pos,expand); + bool Result = This->ExpandNode(*pos,expand); rt.addBool(Result); break; } @@ -18329,7 +18366,7 @@ case wxTreebook_IsNodeExpanded: { // wxTreebook::IsNodeExpanded wxTreebook *This = (wxTreebook *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsNodeExpanded((size_t) *pos); + bool Result = This->IsNodeExpanded(*pos); rt.addBool(Result); break; } @@ -18364,7 +18401,7 @@ case wxTreebook_InsertPage: { // wxTreebook::InsertPage } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->InsertPage((size_t) *pos,page,text,bSelect,imageId); + bool Result = This->InsertPage(*pos,page,text,bSelect,imageId); rt.addBool(Result); break; } @@ -18386,7 +18423,7 @@ case wxTreebook_InsertSubPage: { // wxTreebook::InsertSubPage } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->InsertSubPage((size_t) *pos,page,text,bSelect,imageId); + bool Result = This->InsertSubPage(*pos,page,text,bSelect,imageId); rt.addBool(Result); break; } @@ -18411,7 +18448,7 @@ case wxTreebook_SetPageImage: { // wxTreebook::SetPageImage int * n = (int *) bp; bp += 4; int * imageId = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetPageImage((size_t) *n,(int) *imageId); + bool Result = This->SetPageImage(*n,*imageId); rt.addBool(Result); break; } @@ -18422,7 +18459,7 @@ case wxTreebook_SetPageText: { // wxTreebook::SetPageText wxString strText = wxString(bp, wxConvUTF8); bp += *strTextLen+((8-((4+ *strTextLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - bool Result = This->SetPageText((size_t) *n,strText); + bool Result = This->SetPageText(*n,strText); rt.addBool(Result); break; } @@ -18430,7 +18467,7 @@ case wxTreebook_SetSelection: { // wxTreebook::SetSelection wxTreebook *This = (wxTreebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->SetSelection((size_t) *n); + int Result = This->SetSelection(*n); rt.addInt(Result); break; } @@ -18438,7 +18475,7 @@ case wxTreebook_ChangeSelection: { // wxTreebook::ChangeSelection wxTreebook *This = (wxTreebook *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->ChangeSelection((size_t) *n); + int Result = This->ChangeSelection(*n); rt.addInt(Result); break; } @@ -18790,7 +18827,7 @@ which = *(wxTreeItemIcon *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - int Result = This->GetItemImage(item,(wxTreeItemIcon) which); + int Result = This->GetItemImage(item,which); rt.addInt(Result); break; } @@ -18933,7 +18970,7 @@ case wxTreeCtrl_InsertItem: { // wxTreeCtrl::InsertItem } break; }}; if(!This) throw wxe_badarg(0); - wxTreeItemId Result = This->InsertItem(parent,(size_t) *pos,text,image,selImage,data); + wxTreeItemId Result = This->InsertItem(parent,*pos,text,image,selImage,data); rt.add((wxUIntPtr *) Result.m_pItem); break; } @@ -19043,7 +19080,7 @@ case wxTreeCtrl_SetIndent: { // wxTreeCtrl::SetIndent wxTreeCtrl *This = (wxTreeCtrl *) getPtr(bp,memenv); bp += 4; unsigned int * indent = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetIndent((int) *indent); + This->SetIndent(*indent); break; } case wxTreeCtrl_SetImageList: { // wxTreeCtrl::SetImageList @@ -19132,7 +19169,7 @@ case wxTreeCtrl_SetItemImage_2: { // wxTreeCtrl::SetItemImage wxTreeItemId item = wxTreeItemId((void *) *(wxUint64 *) bp); bp += 8; int * image = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetItemImage(item,(int) *image); + This->SetItemImage(item,*image); break; } case wxTreeCtrl_SetItemImage_3: { // wxTreeCtrl::SetItemImage @@ -19148,7 +19185,7 @@ which = *(wxTreeItemIcon *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - This->SetItemImage(item,(int) *image,(wxTreeItemIcon) which); + This->SetItemImage(item,*image,which); break; } case wxTreeCtrl_SetItemText: { // wxTreeCtrl::SetItemText @@ -19186,7 +19223,7 @@ case wxTreeCtrl_SetWindowStyle: { // wxTreeCtrl::SetWindowStyle wxTreeCtrl *This = (wxTreeCtrl *) getPtr(bp,memenv); bp += 4; const int * styles = (const int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWindowStyle((long) *styles); + This->SetWindowStyle(*styles); break; } case wxTreeCtrl_SortChildren: { // wxTreeCtrl::SortChildren @@ -19266,7 +19303,7 @@ case wxScrollBar_new_3: { // wxScrollBar::wxScrollBar validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxScrollBar * Result = new EwxScrollBar(parent,(wxWindowID) *id,pos,size,style,*validator); + wxScrollBar * Result = new EwxScrollBar(parent,*id,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxScrollBar"); break; @@ -19301,7 +19338,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,pos,size,style,*validator); + bool Result = This->Create(parent,*id,pos,size,style,*validator); rt.addBool(Result); break; } @@ -19337,7 +19374,7 @@ case wxScrollBar_SetThumbPosition: { // wxScrollBar::SetThumbPosition wxScrollBar *This = (wxScrollBar *) getPtr(bp,memenv); bp += 4; int * viewStart = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetThumbPosition((int) *viewStart); + This->SetThumbPosition(*viewStart); break; } case wxScrollBar_SetScrollbar: { // wxScrollBar::SetScrollbar @@ -19354,7 +19391,7 @@ case wxScrollBar_SetScrollbar: { // wxScrollBar::SetScrollbar } break; }}; if(!This) throw wxe_badarg(0); - This->SetScrollbar((int) *position,(int) *thumbSize,(int) *range,(int) *pageSize,refresh); + This->SetScrollbar(*position,*thumbSize,*range,*pageSize,refresh); break; } case wxSpinButton_new_2: { // wxSpinButton::wxSpinButton @@ -19453,14 +19490,14 @@ case wxSpinButton_SetRange: { // wxSpinButton::SetRange int * minVal = (int *) bp; bp += 4; int * maxVal = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRange((int) *minVal,(int) *maxVal); + This->SetRange(*minVal,*maxVal); break; } case wxSpinButton_SetValue: { // wxSpinButton::SetValue wxSpinButton *This = (wxSpinButton *) getPtr(bp,memenv); bp += 4; int * value = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetValue((int) *value); + This->SetValue(*value); break; } case wxSpinCtrl_new_0: { // wxSpinCtrl::wxSpinCtrl @@ -19582,7 +19619,7 @@ case wxSpinCtrl_SetValue_1_0: { // wxSpinCtrl::SetValue wxSpinCtrl *This = (wxSpinCtrl *) getPtr(bp,memenv); bp += 4; int * value = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetValue((int) *value); + This->SetValue(*value); break; } case wxSpinCtrl_GetValue: { // wxSpinCtrl::GetValue @@ -19597,7 +19634,7 @@ case wxSpinCtrl_SetRange: { // wxSpinCtrl::SetRange int * minVal = (int *) bp; bp += 4; int * maxVal = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRange((int) *minVal,(int) *maxVal); + This->SetRange(*minVal,*maxVal); break; } case wxSpinCtrl_SetSelection: { // wxSpinCtrl::SetSelection @@ -19605,7 +19642,7 @@ case wxSpinCtrl_SetSelection: { // wxSpinCtrl::SetSelection int * from = (int *) bp; bp += 4; int * to = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((long) *from,(long) *to); + This->SetSelection(*from,*to); break; } case wxSpinCtrl_GetMin: { // wxSpinCtrl::GetMin @@ -19654,7 +19691,7 @@ case wxStaticText_new_4: { // wxStaticText::wxStaticText style = (long)*(int *) bp; bp += 4; } break; }}; - wxStaticText * Result = new EwxStaticText(parent,(wxWindowID) *id,label,pos,size,style); + wxStaticText * Result = new EwxStaticText(parent,*id,label,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxStaticText"); break; @@ -19687,7 +19724,7 @@ case wxStaticText_Create: { // wxStaticText::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,label,pos,size,style); + bool Result = This->Create(parent,*id,label,pos,size,style); rt.addBool(Result); break; } @@ -19711,7 +19748,7 @@ case wxStaticText_Wrap: { // wxStaticText::Wrap wxStaticText *This = (wxStaticText *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Wrap((int) *width); + This->Wrap(*width); break; } case wxStaticBitmap_new_0: { // wxStaticBitmap::wxStaticBitmap @@ -19745,7 +19782,7 @@ case wxStaticBitmap_new_4: { // wxStaticBitmap::wxStaticBitmap style = (long)*(int *) bp; bp += 4; } break; }}; - wxStaticBitmap * Result = new EwxStaticBitmap(parent,(wxWindowID) *id,*label,pos,size,style); + wxStaticBitmap * Result = new EwxStaticBitmap(parent,*id,*label,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxStaticBitmap"); break; @@ -19776,7 +19813,7 @@ case wxStaticBitmap_Create: { // wxStaticBitmap::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,*label,pos,size,style); + bool Result = This->Create(parent,*id,*label,pos,size,style); rt.addBool(Result); break; } @@ -19830,7 +19867,7 @@ case wxRadioBox_new: { // wxRadioBox::wxRadioBox val = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxRadioBox * Result = new EwxRadioBox(parent,(wxWindowID) *id,title,pos,size,choices,majorDim,style,*val); + wxRadioBox * Result = new EwxRadioBox(parent,*id,title,pos,size,choices,majorDim,style,*val); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxRadioBox"); break; @@ -19873,7 +19910,7 @@ val = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,title,pos,size,choices,majorDim,style,*val); + bool Result = This->Create(parent,*id,title,pos,size,choices,majorDim,style,*val); rt.addBool(Result); break; } @@ -19887,7 +19924,7 @@ case wxRadioBox_Enable_2: { // wxRadioBox::Enable } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Enable((int) *n,enable); + bool Result = This->Enable(*n,enable); rt.addBool(Result); break; } @@ -19916,7 +19953,7 @@ case wxRadioBox_GetString: { // wxRadioBox::GetString wxRadioBox *This = (wxRadioBox *) getPtr(bp,memenv); bp += 4; unsigned int * n = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetString((int) *n); + wxString Result = This->GetString(*n); rt.add(Result); break; } @@ -19924,7 +19961,7 @@ case wxRadioBox_SetSelection: { // wxRadioBox::SetSelection wxRadioBox *This = (wxRadioBox *) getPtr(bp,memenv); bp += 4; int * n = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((int) *n); + This->SetSelection(*n); break; } case wxRadioBox_Show_2: { // wxRadioBox::Show @@ -19937,7 +19974,7 @@ case wxRadioBox_Show_2: { // wxRadioBox::Show } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Show((int) *n,show); + bool Result = This->Show(*n,show); rt.addBool(Result); break; } @@ -19966,7 +20003,7 @@ case wxRadioBox_GetItemHelpText: { // wxRadioBox::GetItemHelpText wxRadioBox *This = (wxRadioBox *) getPtr(bp,memenv); bp += 4; unsigned int * n = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetItemHelpText((int) *n); + wxString Result = This->GetItemHelpText(*n); rt.add(Result); break; } @@ -19974,7 +20011,7 @@ case wxRadioBox_GetItemToolTip: { // wxRadioBox::GetItemToolTip wxRadioBox *This = (wxRadioBox *) getPtr(bp,memenv); bp += 4; unsigned int * item = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxToolTip * Result = (wxToolTip*)This->GetItemToolTip((int) *item); + wxToolTip * Result = (wxToolTip*)This->GetItemToolTip(*item); rt.addRef(getRef((void *)Result,memenv), "wxToolTip"); break; } @@ -19999,7 +20036,7 @@ case wxRadioBox_IsItemEnabled: { // wxRadioBox::IsItemEnabled wxRadioBox *This = (wxRadioBox *) getPtr(bp,memenv); bp += 4; unsigned int * n = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsItemEnabled((int) *n); + bool Result = This->IsItemEnabled(*n); rt.addBool(Result); break; } @@ -20007,7 +20044,7 @@ case wxRadioBox_IsItemShown: { // wxRadioBox::IsItemShown wxRadioBox *This = (wxRadioBox *) getPtr(bp,memenv); bp += 4; unsigned int * n = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->IsItemShown((int) *n); + bool Result = This->IsItemShown(*n); rt.addBool(Result); break; } @@ -20018,7 +20055,7 @@ case wxRadioBox_SetItemHelpText: { // wxRadioBox::SetItemHelpText wxString helpText = wxString(bp, wxConvUTF8); bp += *helpTextLen+((8-((4+ *helpTextLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetItemHelpText((int) *n,helpText); + This->SetItemHelpText(*n,helpText); break; } case wxRadioBox_SetItemToolTip: { // wxRadioBox::SetItemToolTip @@ -20028,7 +20065,7 @@ case wxRadioBox_SetItemToolTip: { // wxRadioBox::SetItemToolTip wxString text = wxString(bp, wxConvUTF8); bp += *textLen+((8-((4+ *textLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetItemToolTip((int) *item,text); + This->SetItemToolTip(*item,text); break; } case wxRadioButton_new_0: { // wxRadioButton::wxRadioButton @@ -20067,7 +20104,7 @@ case wxRadioButton_new_4: { // wxRadioButton::wxRadioButton validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxRadioButton * Result = new EwxRadioButton(parent,(wxWindowID) *id,label,pos,size,style,*validator); + wxRadioButton * Result = new EwxRadioButton(parent,*id,label,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxRadioButton"); break; @@ -20104,7 +20141,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,label,pos,size,style,*validator); + bool Result = This->Create(parent,*id,label,pos,size,style,*validator); rt.addBool(Result); break; } @@ -20119,7 +20156,7 @@ case wxRadioButton_SetValue: { // wxRadioButton::SetValue wxRadioButton *This = (wxRadioButton *) getPtr(bp,memenv); bp += 4; bool * val = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetValue((bool) *val); + This->SetValue(*val); break; } case wxSlider_new_6: { // wxSlider::wxSlider @@ -20153,7 +20190,7 @@ case wxSlider_new_6: { // wxSlider::wxSlider validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxSlider * Result = new EwxSlider(parent,(wxWindowID) *id,(int) *value,(int) *minValue,(int) *maxValue,pos,size,style,*validator); + wxSlider * Result = new EwxSlider(parent,*id,*value,*minValue,*maxValue,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxSlider"); break; @@ -20196,7 +20233,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,(int) *value,(int) *minValue,(int) *maxValue,pos,size,style,*validator); + bool Result = This->Create(parent,*id,*value,*minValue,*maxValue,pos,size,style,*validator); rt.addBool(Result); break; } @@ -20246,14 +20283,14 @@ case wxSlider_SetLineSize: { // wxSlider::SetLineSize wxSlider *This = (wxSlider *) getPtr(bp,memenv); bp += 4; int * lineSize = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetLineSize((int) *lineSize); + This->SetLineSize(*lineSize); break; } case wxSlider_SetPageSize: { // wxSlider::SetPageSize wxSlider *This = (wxSlider *) getPtr(bp,memenv); bp += 4; int * pageSize = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPageSize((int) *pageSize); + This->SetPageSize(*pageSize); break; } case wxSlider_SetRange: { // wxSlider::SetRange @@ -20261,21 +20298,21 @@ case wxSlider_SetRange: { // wxSlider::SetRange int * minValue = (int *) bp; bp += 4; int * maxValue = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRange((int) *minValue,(int) *maxValue); + This->SetRange(*minValue,*maxValue); break; } case wxSlider_SetThumbLength: { // wxSlider::SetThumbLength wxSlider *This = (wxSlider *) getPtr(bp,memenv); bp += 4; int * lenPixels = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetThumbLength((int) *lenPixels); + This->SetThumbLength(*lenPixels); break; } case wxSlider_SetValue: { // wxSlider::SetValue wxSlider *This = (wxSlider *) getPtr(bp,memenv); bp += 4; int * value = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetValue((int) *value); + This->SetValue(*value); break; } case wxDialog_new_4: { // wxDialog::wxDialog @@ -20304,7 +20341,7 @@ case wxDialog_new_4: { // wxDialog::wxDialog style = (long)*(int *) bp; bp += 4; } break; }}; - wxDialog * Result = new EwxDialog(parent,(wxWindowID) *id,title,pos,size,style); + wxDialog * Result = new EwxDialog(parent,*id,title,pos,size,style); newPtr((void *) Result, 2, memenv); rt.addRef(getRef((void *)Result,memenv), "wxDialog"); break; @@ -20343,7 +20380,7 @@ case wxDialog_Create: { // wxDialog::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,title,pos,size,style); + bool Result = This->Create(parent,*id,title,pos,size,style); rt.addBool(Result); break; } @@ -20351,7 +20388,7 @@ case wxDialog_CreateButtonSizer: { // wxDialog::CreateButtonSizer wxDialog *This = (wxDialog *) getPtr(bp,memenv); bp += 4; int * flags = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxSizer * Result = (wxSizer*)This->CreateButtonSizer((long) *flags); + wxSizer * Result = (wxSizer*)This->CreateButtonSizer(*flags); rt.addRef(getRef((void *)Result,memenv), "wxSizer"); break; } @@ -20359,7 +20396,7 @@ case wxDialog_CreateStdDialogButtonSizer: { // wxDialog::CreateStdDialogButtonSi wxDialog *This = (wxDialog *) getPtr(bp,memenv); bp += 4; int * flags = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxStdDialogButtonSizer * Result = (wxStdDialogButtonSizer*)This->CreateStdDialogButtonSizer((long) *flags); + wxStdDialogButtonSizer * Result = (wxStdDialogButtonSizer*)This->CreateStdDialogButtonSizer(*flags); rt.addRef(getRef((void *)Result,memenv), "wxStdDialogButtonSizer"); break; } @@ -20367,7 +20404,7 @@ case wxDialog_EndModal: { // wxDialog::EndModal wxDialog *This = (wxDialog *) getPtr(bp,memenv); bp += 4; int * retCode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EndModal((int) *retCode); + This->EndModal(*retCode); break; } case wxDialog_GetAffirmativeId: { // wxDialog::GetAffirmativeId @@ -20395,14 +20432,14 @@ case wxDialog_SetAffirmativeId: { // wxDialog::SetAffirmativeId wxDialog *This = (wxDialog *) getPtr(bp,memenv); bp += 4; int * affirmativeId = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetAffirmativeId((int) *affirmativeId); + This->SetAffirmativeId(*affirmativeId); break; } case wxDialog_SetReturnCode: { // wxDialog::SetReturnCode wxDialog *This = (wxDialog *) getPtr(bp,memenv); bp += 4; int * returnCode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetReturnCode((int) *returnCode); + This->SetReturnCode(*returnCode); break; } case wxDialog_Show: { // wxDialog::Show @@ -20498,7 +20535,7 @@ case wxColourData_GetCustomColour: { // wxColourData::GetCustomColour wxColourData *This = (wxColourData *) getPtr(bp,memenv); bp += 4; int * i = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxColour Result = This->GetCustomColour((int) *i); + wxColour Result = This->GetCustomColour(*i); rt.add(Result); break; } @@ -20506,7 +20543,7 @@ case wxColourData_SetChooseFull: { // wxColourData::SetChooseFull wxColourData *This = (wxColourData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetChooseFull((bool) *flag); + This->SetChooseFull(*flag); break; } case wxColourData_SetColour: { // wxColourData::SetColour @@ -20529,7 +20566,7 @@ case wxColourData_SetCustomColour: { // wxColourData::SetCustomColour int * colourA = (int *) bp; bp += 4; wxColour colour = wxColour(*colourR,*colourG,*colourB,*colourA); if(!This) throw wxe_badarg(0); - This->SetCustomColour((int) *i,colour); + This->SetCustomColour(*i,colour); break; } case wxPalette_new_0: { // wxPalette::wxPalette @@ -20570,7 +20607,7 @@ case wxPalette_GetPixel: { // wxPalette::GetPixel unsigned int * green = (unsigned int *) bp; bp += 4; unsigned int * blue = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetPixel((char) *red,(char) *green,(char) *blue); + int Result = This->GetPixel(*red,*green,*blue); rt.addInt(Result); break; } @@ -20581,7 +20618,7 @@ case wxPalette_GetRGB: { // wxPalette::GetRGB wxPalette *This = (wxPalette *) getPtr(bp,memenv); bp += 4; int * pixel = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetRGB((int) *pixel,&red,&green,&blue); + bool Result = This->GetRGB(*pixel,&red,&green,&blue); rt.addBool(Result); rt.addUint(red); rt.addUint(green); @@ -20800,7 +20837,7 @@ case wxFileDialog_SetFilterIndex: { // wxFileDialog::SetFilterIndex wxFileDialog *This = (wxFileDialog *) getPtr(bp,memenv); bp += 4; int * filterIndex = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFilterIndex((int) *filterIndex); + This->SetFilterIndex(*filterIndex); break; } case wxFileDialog_SetMessage: { // wxFileDialog::SetMessage @@ -20834,7 +20871,7 @@ case wxPickerBase_SetInternalMargin: { // wxPickerBase::SetInternalMargin wxPickerBase *This = (wxPickerBase *) getPtr(bp,memenv); bp += 4; int * newmargin = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetInternalMargin((int) *newmargin); + This->SetInternalMargin(*newmargin); break; } case wxPickerBase_GetInternalMargin: { // wxPickerBase::GetInternalMargin @@ -20848,14 +20885,14 @@ case wxPickerBase_SetTextCtrlProportion: { // wxPickerBase::SetTextCtrlProportio wxPickerBase *This = (wxPickerBase *) getPtr(bp,memenv); bp += 4; int * prop = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetTextCtrlProportion((int) *prop); + This->SetTextCtrlProportion(*prop); break; } case wxPickerBase_SetPickerCtrlProportion: { // wxPickerBase::SetPickerCtrlProportion wxPickerBase *This = (wxPickerBase *) getPtr(bp,memenv); bp += 4; int * prop = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPickerCtrlProportion((int) *prop); + This->SetPickerCtrlProportion(*prop); break; } case wxPickerBase_GetTextCtrlProportion: { // wxPickerBase::GetTextCtrlProportion @@ -20977,7 +21014,7 @@ case wxFilePickerCtrl_new_3: { // wxFilePickerCtrl::wxFilePickerCtrl validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxFilePickerCtrl * Result = new EwxFilePickerCtrl(parent,(wxWindowID) *id,path,message,wildcard,pos,size,style,*validator); + wxFilePickerCtrl * Result = new EwxFilePickerCtrl(parent,*id,path,message,wildcard,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxFilePickerCtrl"); break; @@ -21030,7 +21067,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,path,message,wildcard,pos,size,style,*validator); + bool Result = This->Create(parent,*id,path,message,wildcard,pos,size,style,*validator); rt.addBool(Result); break; } @@ -21095,7 +21132,7 @@ case wxDirPickerCtrl_new_3: { // wxDirPickerCtrl::wxDirPickerCtrl validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxDirPickerCtrl * Result = new EwxDirPickerCtrl(parent,(wxWindowID) *id,path,message,pos,size,style,*validator); + wxDirPickerCtrl * Result = new EwxDirPickerCtrl(parent,*id,path,message,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxDirPickerCtrl"); break; @@ -21142,7 +21179,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,path,message,pos,size,style,*validator); + bool Result = This->Create(parent,*id,path,message,pos,size,style,*validator); rt.addBool(Result); break; } @@ -21204,7 +21241,7 @@ case wxColourPickerCtrl_new_3: { // wxColourPickerCtrl::wxColourPickerCtrl validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxColourPickerCtrl * Result = new EwxColourPickerCtrl(parent,(wxWindowID) *id,col,pos,size,style,*validator); + wxColourPickerCtrl * Result = new EwxColourPickerCtrl(parent,*id,col,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxColourPickerCtrl"); break; @@ -21248,7 +21285,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,col,pos,size,style,*validator); + bool Result = This->Create(parent,*id,col,pos,size,style,*validator); rt.addBool(Result); break; } @@ -21324,7 +21361,7 @@ case wxDatePickerCtrl_new_3: { // wxDatePickerCtrl::wxDatePickerCtrl validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxDatePickerCtrl * Result = new EwxDatePickerCtrl(parent,(wxWindowID) *id,date,pos,size,style,*validator); + wxDatePickerCtrl * Result = new EwxDatePickerCtrl(parent,*id,date,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxDatePickerCtrl"); break; @@ -21427,7 +21464,7 @@ initial = (wxFont *) getPtr(bp,memenv); bp += 4; validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; - wxFontPickerCtrl * Result = new EwxFontPickerCtrl(parent,(wxWindowID) *id,*initial,pos,size,style,*validator); + wxFontPickerCtrl * Result = new EwxFontPickerCtrl(parent,*id,*initial,pos,size,style,*validator); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxFontPickerCtrl"); break; @@ -21466,7 +21503,7 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,*initial,pos,size,style,*validator); + bool Result = This->Create(parent,*id,*initial,pos,size,style,*validator); rt.addBool(Result); break; } @@ -21495,7 +21532,7 @@ case wxFontPickerCtrl_SetMaxPointSize: { // wxFontPickerCtrl::SetMaxPointSize wxFontPickerCtrl *This = (wxFontPickerCtrl *) getPtr(bp,memenv); bp += 4; unsigned int * max = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMaxPointSize((int) *max); + This->SetMaxPointSize(*max); break; } case wxFindReplaceDialog_new_0: { // wxFindReplaceDialog::wxFindReplaceDialog @@ -21554,7 +21591,7 @@ case wxFindReplaceData_new_0: { // wxFindReplaceData::wxFindReplaceData } case wxFindReplaceData_new_1: { // wxFindReplaceData::wxFindReplaceData unsigned int * flags = (unsigned int *) bp; bp += 4; - wxFindReplaceData * Result = new EwxFindReplaceData((int) *flags); + wxFindReplaceData * Result = new EwxFindReplaceData(*flags); newPtr((void *) Result, 1, memenv); rt.addRef(getRef((void *)Result,memenv), "wxFindReplaceData"); break; @@ -21584,7 +21621,7 @@ case wxFindReplaceData_SetFlags: { // wxFindReplaceData::SetFlags wxFindReplaceData *This = (wxFindReplaceData *) getPtr(bp,memenv); bp += 4; unsigned int * flags = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFlags((int) *flags); + This->SetFlags(*flags); break; } case wxFindReplaceData_SetFindString: { // wxFindReplaceData::SetFindString @@ -21725,7 +21762,7 @@ case wxSingleChoiceDialog_SetSelection: { // wxSingleChoiceDialog::SetSelection wxSingleChoiceDialog *This = (wxSingleChoiceDialog *) getPtr(bp,memenv); bp += 4; int * sel = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((int) *sel); + This->SetSelection(*sel); break; } case wxTextEntryDialog_new: { // wxTextEntryDialog::wxTextEntryDialog @@ -21831,7 +21868,7 @@ case wxFontData_EnableEffects: { // wxFontData::EnableEffects wxFontData *This = (wxFontData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableEffects((bool) *flag); + This->EnableEffects(*flag); break; } case wxFontData_GetAllowSymbols: { // wxFontData::GetAllowSymbols @@ -21880,7 +21917,7 @@ case wxFontData_SetAllowSymbols: { // wxFontData::SetAllowSymbols wxFontData *This = (wxFontData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetAllowSymbols((bool) *flag); + This->SetAllowSymbols(*flag); break; } case wxFontData_SetChosenFont: { // wxFontData::SetChosenFont @@ -21913,14 +21950,14 @@ case wxFontData_SetRange: { // wxFontData::SetRange int * minRange = (int *) bp; bp += 4; int * maxRange = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRange((int) *minRange,(int) *maxRange); + This->SetRange(*minRange,*maxRange); break; } case wxFontData_SetShowHelp: { // wxFontData::SetShowHelp wxFontData *This = (wxFontData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetShowHelp((bool) *flag); + This->SetShowHelp(*flag); break; } case wxFontDialog_new_0: { // wxFontDialog::wxFontDialog @@ -21997,7 +22034,7 @@ case wxProgressDialog_Update_2: { // wxProgressDialog::Update } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Update((int) *value,newmsg); + bool Result = This->Update(*value,newmsg); rt.addBool(Result); break; } @@ -22088,35 +22125,35 @@ case wxPageSetupDialogData_EnableHelp: { // wxPageSetupDialogData::EnableHelp wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableHelp((bool) *flag); + This->EnableHelp(*flag); break; } case wxPageSetupDialogData_EnableMargins: { // wxPageSetupDialogData::EnableMargins wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableMargins((bool) *flag); + This->EnableMargins(*flag); break; } case wxPageSetupDialogData_EnableOrientation: { // wxPageSetupDialogData::EnableOrientation wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableOrientation((bool) *flag); + This->EnableOrientation(*flag); break; } case wxPageSetupDialogData_EnablePaper: { // wxPageSetupDialogData::EnablePaper wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnablePaper((bool) *flag); + This->EnablePaper(*flag); break; } case wxPageSetupDialogData_EnablePrinter: { // wxPageSetupDialogData::EnablePrinter wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnablePrinter((bool) *flag); + This->EnablePrinter(*flag); break; } case wxPageSetupDialogData_GetDefaultMinMargins: { // wxPageSetupDialogData::GetDefaultMinMargins @@ -22199,7 +22236,7 @@ case wxPageSetupDialogData_GetMinMarginBottomRight: { // wxPageSetupDialogData:: case wxPageSetupDialogData_GetPaperId: { // wxPageSetupDialogData::GetPaperId wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxPaperSize Result = This->GetPaperId(); + int Result = This->GetPaperId(); rt.addInt(Result); break; } @@ -22228,14 +22265,14 @@ case wxPageSetupDialogData_SetDefaultInfo: { // wxPageSetupDialogData::SetDefaul wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetDefaultInfo((bool) *flag); + This->SetDefaultInfo(*flag); break; } case wxPageSetupDialogData_SetDefaultMinMargins: { // wxPageSetupDialogData::SetDefaultMinMargins wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetDefaultMinMargins((bool) *flag); + This->SetDefaultMinMargins(*flag); break; } case wxPageSetupDialogData_SetMarginTopLeft: { // wxPageSetupDialogData::SetMarginTopLeft @@ -22276,9 +22313,9 @@ case wxPageSetupDialogData_SetMinMarginBottomRight: { // wxPageSetupDialogData:: } case wxPageSetupDialogData_SetPaperId: { // wxPageSetupDialogData::SetPaperId wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; - int * id = (int *) bp; bp += 4; + wxPaperSize id = *(wxPaperSize *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetPaperId((wxPaperSize) *id); + This->SetPaperId(id); break; } case wxPageSetupDialogData_SetPaperSize_1_1: { // wxPageSetupDialogData::SetPaperSize @@ -22292,9 +22329,9 @@ case wxPageSetupDialogData_SetPaperSize_1_1: { // wxPageSetupDialogData::SetPape } case wxPageSetupDialogData_SetPaperSize_1_0: { // wxPageSetupDialogData::SetPaperSize wxPageSetupDialogData *This = (wxPageSetupDialogData *) getPtr(bp,memenv); bp += 4; - int * id = (int *) bp; bp += 4; + wxPaperSize id = *(wxPaperSize *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetPaperSize((wxPaperSize) *id); + This->SetPaperSize(id); break; } case wxPageSetupDialogData_SetPrintData: { // wxPageSetupDialogData::SetPrintData @@ -22364,28 +22401,28 @@ case wxPrintDialogData_EnableHelp: { // wxPrintDialogData::EnableHelp wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableHelp((bool) *flag); + This->EnableHelp(*flag); break; } case wxPrintDialogData_EnablePageNumbers: { // wxPrintDialogData::EnablePageNumbers wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnablePageNumbers((bool) *flag); + This->EnablePageNumbers(*flag); break; } case wxPrintDialogData_EnablePrintToFile: { // wxPrintDialogData::EnablePrintToFile wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnablePrintToFile((bool) *flag); + This->EnablePrintToFile(*flag); break; } case wxPrintDialogData_EnableSelection: { // wxPrintDialogData::EnableSelection wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnableSelection((bool) *flag); + This->EnableSelection(*flag); break; } case wxPrintDialogData_GetAllPages: { // wxPrintDialogData::GetAllPages @@ -22469,35 +22506,35 @@ case wxPrintDialogData_SetCollate: { // wxPrintDialogData::SetCollate wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCollate((bool) *flag); + This->SetCollate(*flag); break; } case wxPrintDialogData_SetFromPage: { // wxPrintDialogData::SetFromPage wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; int * v = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFromPage((int) *v); + This->SetFromPage(*v); break; } case wxPrintDialogData_SetMaxPage: { // wxPrintDialogData::SetMaxPage wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; int * v = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMaxPage((int) *v); + This->SetMaxPage(*v); break; } case wxPrintDialogData_SetMinPage: { // wxPrintDialogData::SetMinPage wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; int * v = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMinPage((int) *v); + This->SetMinPage(*v); break; } case wxPrintDialogData_SetNoCopies: { // wxPrintDialogData::SetNoCopies wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; int * v = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetNoCopies((int) *v); + This->SetNoCopies(*v); break; } case wxPrintDialogData_SetPrintData: { // wxPrintDialogData::SetPrintData @@ -22511,21 +22548,21 @@ case wxPrintDialogData_SetPrintToFile: { // wxPrintDialogData::SetPrintToFile wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPrintToFile((bool) *flag); + This->SetPrintToFile(*flag); break; } case wxPrintDialogData_SetSelection: { // wxPrintDialogData::SetSelection wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((bool) *flag); + This->SetSelection(*flag); break; } case wxPrintDialogData_SetToPage: { // wxPrintDialogData::SetToPage wxPrintDialogData *This = (wxPrintDialogData *) getPtr(bp,memenv); bp += 4; int * v = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetToPage((int) *v); + This->SetToPage(*v); break; } case wxPrintData_new_0: { // wxPrintData::wxPrintData @@ -22586,7 +22623,7 @@ case wxPrintData_GetOrientation: { // wxPrintData::GetOrientation case wxPrintData_GetPaperId: { // wxPrintData::GetPaperId wxPrintData *This = (wxPrintData *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxPaperSize Result = This->GetPaperId(); + int Result = This->GetPaperId(); rt.addInt(Result); break; } @@ -22615,49 +22652,49 @@ case wxPrintData_SetBin: { // wxPrintData::SetBin wxPrintData *This = (wxPrintData *) getPtr(bp,memenv); bp += 4; wxPrintBin bin = *(wxPrintBin *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetBin((wxPrintBin) bin); + This->SetBin(bin); break; } case wxPrintData_SetCollate: { // wxPrintData::SetCollate wxPrintData *This = (wxPrintData *) getPtr(bp,memenv); bp += 4; bool * flag = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCollate((bool) *flag); + This->SetCollate(*flag); break; } case wxPrintData_SetColour: { // wxPrintData::SetColour wxPrintData *This = (wxPrintData *) getPtr(bp,memenv); bp += 4; bool * colour = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetColour((bool) *colour); + This->SetColour(*colour); break; } case wxPrintData_SetDuplex: { // wxPrintData::SetDuplex wxPrintData *This = (wxPrintData *) getPtr(bp,memenv); bp += 4; wxDuplexMode duplex = *(wxDuplexMode *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetDuplex((wxDuplexMode) duplex); + This->SetDuplex(duplex); break; } case wxPrintData_SetNoCopies: { // wxPrintData::SetNoCopies wxPrintData *This = (wxPrintData *) getPtr(bp,memenv); bp += 4; int * v = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetNoCopies((int) *v); + This->SetNoCopies(*v); break; } case wxPrintData_SetOrientation: { // wxPrintData::SetOrientation wxPrintData *This = (wxPrintData *) getPtr(bp,memenv); bp += 4; int * orient = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetOrientation((int) *orient); + This->SetOrientation(*orient); break; } case wxPrintData_SetPaperId: { // wxPrintData::SetPaperId wxPrintData *This = (wxPrintData *) getPtr(bp,memenv); bp += 4; - int * sizeId = (int *) bp; bp += 4; + wxPaperSize sizeId = *(wxPaperSize *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetPaperId((wxPaperSize) *sizeId); + This->SetPaperId(sizeId); break; } case wxPrintData_SetPrinterName: { // wxPrintData::SetPrinterName @@ -22673,7 +22710,7 @@ case wxPrintData_SetQuality: { // wxPrintData::SetQuality wxPrintData *This = (wxPrintData *) getPtr(bp,memenv); bp += 4; int * quality = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetQuality((wxPrintQuality) *quality); + This->SetQuality(*quality); break; } case wxPrintPreview_new_2: { // wxPrintPreview::wxPrintPreview @@ -22772,7 +22809,7 @@ case wxPrintPreview_Print: { // wxPrintPreview::Print wxPrintPreview *This = (wxPrintPreview *) getPtr(bp,memenv); bp += 4; bool * interactive = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Print((bool) *interactive); + bool Result = This->Print(*interactive); rt.addBool(Result); break; } @@ -22780,7 +22817,7 @@ case wxPrintPreview_RenderPage: { // wxPrintPreview::RenderPage wxPrintPreview *This = (wxPrintPreview *) getPtr(bp,memenv); bp += 4; int * pageNum = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->RenderPage((int) *pageNum); + bool Result = This->RenderPage(*pageNum); rt.addBool(Result); break; } @@ -22795,7 +22832,7 @@ case wxPrintPreview_SetCurrentPage: { // wxPrintPreview::SetCurrentPage wxPrintPreview *This = (wxPrintPreview *) getPtr(bp,memenv); bp += 4; int * pageNum = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetCurrentPage((int) *pageNum); + bool Result = This->SetCurrentPage(*pageNum); rt.addBool(Result); break; } @@ -22817,7 +22854,7 @@ case wxPrintPreview_SetZoom: { // wxPrintPreview::SetZoom wxPrintPreview *This = (wxPrintPreview *) getPtr(bp,memenv); bp += 4; int * percent = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetZoom((int) *percent); + This->SetZoom(*percent); break; } case wxPreviewFrame_new: { // wxPreviewFrame::wxPreviewFrame @@ -22904,7 +22941,7 @@ case wxPreviewControlBar_new: { // wxPreviewControlBar::wxPreviewControlBar style = (long)*(int *) bp; bp += 4; } break; }}; - wxPreviewControlBar * Result = new EwxPreviewControlBar(preview,(long) *buttons,parent,pos,size,style); + wxPreviewControlBar * Result = new EwxPreviewControlBar(preview,*buttons,parent,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxPreviewControlBar"); break; @@ -22933,7 +22970,7 @@ case wxPreviewControlBar_SetZoomControl: { // wxPreviewControlBar::SetZoomContro wxPreviewControlBar *This = (wxPreviewControlBar *) getPtr(bp,memenv); bp += 4; int * zoom = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetZoomControl((int) *zoom); + This->SetZoomControl(*zoom); break; } case wxPrinter_new: { // wxPrinter::wxPrinter @@ -23089,7 +23126,7 @@ case wxXmlResource_CompareVersion: { // wxXmlResource::CompareVersion int * release = (int *) bp; bp += 4; int * revision = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->CompareVersion((int) *major,(int) *minor,(int) *release,(int) *revision); + int Result = This->CompareVersion(*major,*minor,*release,*revision); rt.addInt(Result); break; } @@ -23283,7 +23320,7 @@ case wxXmlResource_SetFlags: { // wxXmlResource::SetFlags wxXmlResource *This = (wxXmlResource *) getPtr(bp,memenv); bp += 4; int * flags = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFlags((int) *flags); + This->SetFlags(*flags); break; } case wxXmlResource_Unload: { // wxXmlResource::Unload @@ -23811,14 +23848,14 @@ case wxAuiManager_SetDockSizeConstraint: { // wxAuiManager::SetDockSizeConstrain double * width_pct = (double *) bp; bp += 8; double * height_pct = (double *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->SetDockSizeConstraint((double) *width_pct,(double) *height_pct); + This->SetDockSizeConstraint(*width_pct,*height_pct); break; } case wxAuiManager_SetFlags: { // wxAuiManager::SetFlags wxAuiManager *This = (wxAuiManager *) getPtr(bp,memenv); bp += 4; unsigned int * flags = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFlags((int) *flags); + This->SetFlags(*flags); break; } case wxAuiManager_SetManagedWindow: { // wxAuiManager::SetManagedWindow @@ -23887,7 +23924,7 @@ case wxAuiPaneInfo_BestSize_2: { // wxAuiPaneInfo::BestSize int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->BestSize((int) *x,(int) *y); + wxAuiPaneInfo * Result = &This->BestSize(*x,*y); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -23989,7 +24026,7 @@ case wxAuiPaneInfo_Direction: { // wxAuiPaneInfo::Direction wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4; int * direction = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->Direction((int) *direction); + wxAuiPaneInfo * Result = &This->Direction(*direction); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -24057,7 +24094,7 @@ case wxAuiPaneInfo_FloatingPosition_2: { // wxAuiPaneInfo::FloatingPosition int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->FloatingPosition((int) *x,(int) *y); + wxAuiPaneInfo * Result = &This->FloatingPosition(*x,*y); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -24076,7 +24113,7 @@ case wxAuiPaneInfo_FloatingSize_2: { // wxAuiPaneInfo::FloatingSize int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->FloatingSize((int) *x,(int) *y); + wxAuiPaneInfo * Result = &This->FloatingSize(*x,*y); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -24133,7 +24170,7 @@ case wxAuiPaneInfo_HasFlag: { // wxAuiPaneInfo::HasFlag wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4; unsigned int * flag = (unsigned int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->HasFlag((int) *flag); + bool Result = This->HasFlag(*flag); rt.addBool(Result); break; } @@ -24274,7 +24311,7 @@ case wxAuiPaneInfo_Layer: { // wxAuiPaneInfo::Layer wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4; int * layer = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->Layer((int) *layer); + wxAuiPaneInfo * Result = &This->Layer(*layer); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -24314,7 +24351,7 @@ case wxAuiPaneInfo_MaxSize_2: { // wxAuiPaneInfo::MaxSize int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->MaxSize((int) *x,(int) *y); + wxAuiPaneInfo * Result = &This->MaxSize(*x,*y); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -24347,7 +24384,7 @@ case wxAuiPaneInfo_MinSize_2: { // wxAuiPaneInfo::MinSize int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->MinSize((int) *x,(int) *y); + wxAuiPaneInfo * Result = &This->MinSize(*x,*y); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -24421,7 +24458,7 @@ case wxAuiPaneInfo_Position: { // wxAuiPaneInfo::Position wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->Position((int) *pos); + wxAuiPaneInfo * Result = &This->Position(*pos); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -24464,7 +24501,7 @@ case wxAuiPaneInfo_Row: { // wxAuiPaneInfo::Row wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4; int * row = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->Row((int) *row); + wxAuiPaneInfo * Result = &This->Row(*row); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -24480,7 +24517,7 @@ case wxAuiPaneInfo_SetFlag: { // wxAuiPaneInfo::SetFlag unsigned int * flag = (unsigned int *) bp; bp += 4; bool * option_state = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxAuiPaneInfo * Result = &This->SetFlag((int) *flag,(bool) *option_state); + wxAuiPaneInfo * Result = &This->SetFlag(*flag,*option_state); rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo"); break; } @@ -24631,7 +24668,7 @@ case wxAuiNotebook_DeletePage: { // wxAuiNotebook::DeletePage wxAuiNotebook *This = (wxAuiNotebook *) getPtr(bp,memenv); bp += 4; int * page = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->DeletePage((size_t) *page); + bool Result = This->DeletePage(*page); rt.addBool(Result); break; } @@ -24646,7 +24683,7 @@ case wxAuiNotebook_GetPage: { // wxAuiNotebook::GetPage wxAuiNotebook *This = (wxAuiNotebook *) getPtr(bp,memenv); bp += 4; int * page_idx = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxWindow * Result = (wxWindow*)This->GetPage((size_t) *page_idx); + wxWindow * Result = (wxWindow*)This->GetPage(*page_idx); rt.addRef(getRef((void *)Result,memenv), "wxWindow"); break; } @@ -24654,7 +24691,7 @@ case wxAuiNotebook_GetPageBitmap: { // wxAuiNotebook::GetPageBitmap wxAuiNotebook *This = (wxAuiNotebook *) getPtr(bp,memenv); bp += 4; int * page_idx = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxBitmap * Result = new wxBitmap(This->GetPageBitmap((size_t) *page_idx)); newPtr((void *) Result,3, memenv);; + wxBitmap * Result = new wxBitmap(This->GetPageBitmap(*page_idx)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } @@ -24677,7 +24714,7 @@ case wxAuiNotebook_GetPageText: { // wxAuiNotebook::GetPageText wxAuiNotebook *This = (wxAuiNotebook *) getPtr(bp,memenv); bp += 4; int * page_idx = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetPageText((size_t) *page_idx); + wxString Result = This->GetPageText(*page_idx); rt.add(Result); break; } @@ -24706,7 +24743,7 @@ bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->InsertPage((size_t) *page_idx,page,caption,select,*bitmap); + bool Result = This->InsertPage(*page_idx,page,caption,select,*bitmap); rt.addBool(Result); break; } @@ -24714,7 +24751,7 @@ case wxAuiNotebook_RemovePage: { // wxAuiNotebook::RemovePage wxAuiNotebook *This = (wxAuiNotebook *) getPtr(bp,memenv); bp += 4; int * page = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->RemovePage((size_t) *page); + bool Result = This->RemovePage(*page); rt.addBool(Result); break; } @@ -24738,7 +24775,7 @@ case wxAuiNotebook_SetPageBitmap: { // wxAuiNotebook::SetPageBitmap int * page = (int *) bp; bp += 4; wxBitmap *bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->SetPageBitmap((size_t) *page,*bitmap); + bool Result = This->SetPageBitmap(*page,*bitmap); rt.addBool(Result); break; } @@ -24749,7 +24786,7 @@ case wxAuiNotebook_SetPageText: { // wxAuiNotebook::SetPageText wxString text = wxString(bp, wxConvUTF8); bp += *textLen+((8-((4+ *textLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - bool Result = This->SetPageText((size_t) *page,text); + bool Result = This->SetPageText(*page,text); rt.addBool(Result); break; } @@ -24757,7 +24794,7 @@ case wxAuiNotebook_SetSelection: { // wxAuiNotebook::SetSelection wxAuiNotebook *This = (wxAuiNotebook *) getPtr(bp,memenv); bp += 4; int * new_page = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - size_t Result = This->SetSelection((size_t) *new_page); + size_t Result = This->SetSelection(*new_page); rt.addInt(Result); break; } @@ -24765,7 +24802,7 @@ case wxAuiNotebook_SetTabCtrlHeight: { // wxAuiNotebook::SetTabCtrlHeight wxAuiNotebook *This = (wxAuiNotebook *) getPtr(bp,memenv); bp += 4; int * height = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetTabCtrlHeight((int) *height); + This->SetTabCtrlHeight(*height); break; } case wxAuiNotebook_SetUniformBitmapSize: { // wxAuiNotebook::SetUniformBitmapSize @@ -24814,7 +24851,7 @@ case wxMDIParentFrame_new_4: { // wxMDIParentFrame::wxMDIParentFrame style = (long)*(int *) bp; bp += 4; } break; }}; - wxMDIParentFrame * Result = new EwxMDIParentFrame(parent,(wxWindowID) *id,title,pos,size,style); + wxMDIParentFrame * Result = new EwxMDIParentFrame(parent,*id,title,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxMDIParentFrame"); break; @@ -24871,7 +24908,7 @@ case wxMDIParentFrame_Create: { // wxMDIParentFrame::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,title,pos,size,style); + bool Result = This->Create(parent,*id,title,pos,size,style); rt.addBool(Result); break; } @@ -24899,7 +24936,7 @@ orient = *(wxOrientation *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - This->Tile((wxOrientation) orient); + This->Tile(orient); break; } case wxMDIChildFrame_new_0: { // wxMDIChildFrame::wxMDIChildFrame @@ -24934,7 +24971,7 @@ case wxMDIChildFrame_new_4: { // wxMDIChildFrame::wxMDIChildFrame style = (long)*(int *) bp; bp += 4; } break; }}; - wxMDIChildFrame * Result = new EwxMDIChildFrame(parent,(wxWindowID) *id,title,pos,size,style); + wxMDIChildFrame * Result = new EwxMDIChildFrame(parent,*id,title,pos,size,style); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxMDIChildFrame"); break; @@ -24973,7 +25010,7 @@ case wxMDIChildFrame_Create: { // wxMDIChildFrame::Create } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Create(parent,(wxWindowID) *id,title,pos,size,style); + bool Result = This->Create(parent,*id,title,pos,size,style); rt.addBool(Result); break; } @@ -25002,6 +25039,7 @@ case wxMDIClientWindow_new_0: { // wxMDIClientWindow::wxMDIClientWindow rt.addRef(getRef((void *)Result,memenv), "wxMDIClientWindow"); break; } +#if !wxCHECK_VERSION(2,9,0) case wxMDIClientWindow_new_2: { // wxMDIClientWindow::wxMDIClientWindow long style=0; wxMDIParentFrame *parent = (wxMDIParentFrame *) getPtr(bp,memenv); bp += 4; @@ -25016,6 +25054,7 @@ case wxMDIClientWindow_new_2: { // wxMDIClientWindow::wxMDIClientWindow rt.addRef(getRef((void *)Result,memenv), "wxMDIClientWindow"); break; } +#endif case wxMDIClientWindow_CreateClient: { // wxMDIClientWindow::CreateClient long style=wxVSCROLL|wxHSCROLL; wxMDIClientWindow *This = (wxMDIClientWindow *) getPtr(bp,memenv); bp += 4; @@ -25115,7 +25154,7 @@ case wxEvent_ResumePropagation: { // wxEvent::ResumePropagation wxEvent *This = (wxEvent *) getPtr(bp,memenv); bp += 4; int * propagationLevel = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ResumePropagation((int) *propagationLevel); + This->ResumePropagation(*propagationLevel); break; } case wxEvent_ShouldPropagate: { // wxEvent::ShouldPropagate @@ -25198,7 +25237,7 @@ case wxCommandEvent_SetInt: { // wxCommandEvent::SetInt wxCommandEvent *This = (wxCommandEvent *) getPtr(bp,memenv); bp += 4; int * i = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetInt((int) *i); + This->SetInt(*i); break; } case wxCommandEvent_SetString: { // wxCommandEvent::SetString @@ -25249,7 +25288,7 @@ case wxMouseEvent_Button: { // wxMouseEvent::Button wxMouseEvent *This = (wxMouseEvent *) getPtr(bp,memenv); bp += 4; int * but = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->Button((int) *but); + bool Result = This->Button(*but); rt.addBool(Result); break; } @@ -25713,14 +25752,14 @@ case wxCloseEvent_SetCanVeto: { // wxCloseEvent::SetCanVeto wxCloseEvent *This = (wxCloseEvent *) getPtr(bp,memenv); bp += 4; bool * canVeto = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCanVeto((bool) *canVeto); + This->SetCanVeto(*canVeto); break; } case wxCloseEvent_SetLoggingOff: { // wxCloseEvent::SetLoggingOff wxCloseEvent *This = (wxCloseEvent *) getPtr(bp,memenv); bp += 4; bool * logOff = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetLoggingOff((bool) *logOff); + This->SetLoggingOff(*logOff); break; } case wxCloseEvent_Veto: { // wxCloseEvent::Veto @@ -25740,7 +25779,7 @@ case wxShowEvent_SetShow: { // wxShowEvent::SetShow wxShowEvent *This = (wxShowEvent *) getPtr(bp,memenv); bp += 4; bool * show = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetShow((bool) *show); + This->SetShow(*show); break; } case wxShowEvent_GetShow: { // wxShowEvent::GetShow @@ -25865,21 +25904,21 @@ case wxUpdateUIEvent_Check: { // wxUpdateUIEvent::Check wxUpdateUIEvent *This = (wxUpdateUIEvent *) getPtr(bp,memenv); bp += 4; bool * check = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Check((bool) *check); + This->Check(*check); break; } case wxUpdateUIEvent_Enable: { // wxUpdateUIEvent::Enable wxUpdateUIEvent *This = (wxUpdateUIEvent *) getPtr(bp,memenv); bp += 4; bool * enable = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Enable((bool) *enable); + This->Enable(*enable); break; } case wxUpdateUIEvent_Show: { // wxUpdateUIEvent::Show wxUpdateUIEvent *This = (wxUpdateUIEvent *) getPtr(bp,memenv); bp += 4; bool * show = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Show((bool) *show); + This->Show(*show); break; } case wxUpdateUIEvent_GetChecked: { // wxUpdateUIEvent::GetChecked @@ -25954,7 +25993,7 @@ case wxUpdateUIEvent_ResetUpdateTime: { // wxUpdateUIEvent::ResetUpdateTime } case wxUpdateUIEvent_SetMode: { // wxUpdateUIEvent::SetMode wxUpdateUIMode mode = *(wxUpdateUIMode *) bp; bp += 4;; - wxUpdateUIEvent::SetMode((wxUpdateUIMode) mode); + wxUpdateUIEvent::SetMode(mode); break; } case wxUpdateUIEvent_SetText: { // wxUpdateUIEvent::SetText @@ -25968,7 +26007,7 @@ case wxUpdateUIEvent_SetText: { // wxUpdateUIEvent::SetText } case wxUpdateUIEvent_SetUpdateInterval: { // wxUpdateUIEvent::SetUpdateInterval int * updateInterval = (int *) bp; bp += 4; - wxUpdateUIEvent::SetUpdateInterval((long) *updateInterval); + wxUpdateUIEvent::SetUpdateInterval(*updateInterval); break; } case wxMouseCaptureChangedEvent_GetCapturedWindow: { // wxMouseCaptureChangedEvent::GetCapturedWindow @@ -25996,7 +26035,7 @@ case wxQueryNewPaletteEvent_SetPaletteRealized: { // wxQueryNewPaletteEvent::Set wxQueryNewPaletteEvent *This = (wxQueryNewPaletteEvent *) getPtr(bp,memenv); bp += 4; bool * realized = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPaletteRealized((bool) *realized); + This->SetPaletteRealized(*realized); break; } case wxQueryNewPaletteEvent_GetPaletteRealized: { // wxQueryNewPaletteEvent::GetPaletteRealized @@ -26017,7 +26056,7 @@ case wxNavigationKeyEvent_SetDirection: { // wxNavigationKeyEvent::SetDirection wxNavigationKeyEvent *This = (wxNavigationKeyEvent *) getPtr(bp,memenv); bp += 4; bool * bForward = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetDirection((bool) *bForward); + This->SetDirection(*bForward); break; } case wxNavigationKeyEvent_IsWindowChange: { // wxNavigationKeyEvent::IsWindowChange @@ -26031,7 +26070,7 @@ case wxNavigationKeyEvent_SetWindowChange: { // wxNavigationKeyEvent::SetWindowC wxNavigationKeyEvent *This = (wxNavigationKeyEvent *) getPtr(bp,memenv); bp += 4; bool * bIs = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWindowChange((bool) *bIs); + This->SetWindowChange(*bIs); break; } case wxNavigationKeyEvent_IsFromTab: { // wxNavigationKeyEvent::IsFromTab @@ -26045,7 +26084,7 @@ case wxNavigationKeyEvent_SetFromTab: { // wxNavigationKeyEvent::SetFromTab wxNavigationKeyEvent *This = (wxNavigationKeyEvent *) getPtr(bp,memenv); bp += 4; bool * bIs = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFromTab((bool) *bIs); + This->SetFromTab(*bIs); break; } case wxNavigationKeyEvent_GetCurrentFocus: { // wxNavigationKeyEvent::GetCurrentFocus @@ -26080,7 +26119,7 @@ case wxHelpEvent_SetOrigin: { // wxHelpEvent::SetOrigin wxHelpEvent *This = (wxHelpEvent *) getPtr(bp,memenv); bp += 4; wxHelpEvent::Origin origin = *(wxHelpEvent::Origin *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetOrigin((wxHelpEvent::Origin) origin); + This->SetOrigin(origin); break; } case wxHelpEvent_SetPosition: { // wxHelpEvent::SetPosition @@ -26108,12 +26147,14 @@ case wxContextMenuEvent_SetPosition: { // wxContextMenuEvent::SetPosition This->SetPosition(pos); break; } +#if !wxCHECK_VERSION(2,9,0) case wxIdleEvent_CanSend: { // wxIdleEvent::CanSend wxWindow *win = (wxWindow *) getPtr(bp,memenv); bp += 4; bool Result = wxIdleEvent::CanSend(win); rt.addBool(Result); break; } +#endif case wxIdleEvent_GetMode: { // wxIdleEvent::GetMode int Result = wxIdleEvent::GetMode(); rt.addInt(Result); @@ -26141,7 +26182,7 @@ case wxIdleEvent_MoreRequested: { // wxIdleEvent::MoreRequested } case wxIdleEvent_SetMode: { // wxIdleEvent::SetMode wxIdleMode mode = *(wxIdleMode *) bp; bp += 4;; - wxIdleEvent::SetMode((wxIdleMode) mode); + wxIdleEvent::SetMode(mode); break; } case wxGridEvent_AltDown: { // wxGridEvent::AltDown @@ -26529,7 +26570,7 @@ case wxStyledTextEvent_GetAlt: { // wxStyledTextEvent::GetAlt } case utils_wxGetKeyState: { // utils::wxGetKeyState wxKeyCode key = *(wxKeyCode *) bp; bp += 4;; - bool Result = ::wxGetKeyState((wxKeyCode) key); + bool Result = ::wxGetKeyState(key); rt.addBool(Result); break; } @@ -26549,7 +26590,7 @@ case utils_wxGetMouseState: { // utils::wxGetMouseState } case utils_wxSetDetectableAutoRepeat: { // utils::wxSetDetectableAutoRepeat bool * flag = (bool *) bp; bp += 4; - bool Result = ::wxSetDetectableAutoRepeat((bool) *flag); + bool Result = ::wxSetDetectableAutoRepeat(*flag); rt.addBool(Result); break; } @@ -26606,7 +26647,7 @@ case utils_wxIsBusy: { // utils::wxIsBusy } case utils_wxShutdown: { // utils::wxShutdown wxShutdownFlags wFlags = *(wxShutdownFlags *) bp; bp += 4;; - bool Result = ::wxShutdown((wxShutdownFlags) wFlags); + bool Result = ::wxShutdown(wFlags); rt.addBool(Result); break; } @@ -26659,7 +26700,7 @@ case utils_wxNewId: { // utils::wxNewId } case utils_wxRegisterId: { // utils::wxRegisterId int * id = (int *) bp; bp += 4; - ::wxRegisterId((long) *id); + ::wxRegisterId(*id); break; } case utils_wxGetCurrentId: { // utils::wxGetCurrentId @@ -26862,7 +26903,7 @@ case wxPrintout_SetLogicalOrigin: { // wxPrintout::SetLogicalOrigin int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetLogicalOrigin((wxCoord) *x,(wxCoord) *y); + This->SetLogicalOrigin(*x,*y); break; } case wxPrintout_OffsetLogicalOrigin: { // wxPrintout::OffsetLogicalOrigin @@ -26870,7 +26911,7 @@ case wxPrintout_OffsetLogicalOrigin: { // wxPrintout::OffsetLogicalOrigin int * xoff = (int *) bp; bp += 4; int * yoff = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->OffsetLogicalOrigin((wxCoord) *xoff,(wxCoord) *yoff); + This->OffsetLogicalOrigin(*xoff,*yoff); break; } case wxStyledTextCtrl_new_2: { // wxStyledTextCtrl::wxStyledTextCtrl @@ -26966,7 +27007,7 @@ case wxStyledTextCtrl_InsertText: { // wxStyledTextCtrl::InsertText wxString text = wxString(bp, wxConvUTF8); bp += *textLen+((8-((4+ *textLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->InsertText((int) *pos,text); + This->InsertText(*pos,text); break; } case wxStyledTextCtrl_ClearAll: { // wxStyledTextCtrl::ClearAll @@ -26992,7 +27033,7 @@ case wxStyledTextCtrl_GetCharAt: { // wxStyledTextCtrl::GetCharAt wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetCharAt((int) *pos); + int Result = This->GetCharAt(*pos); rt.addInt(Result); break; } @@ -27014,7 +27055,7 @@ case wxStyledTextCtrl_GetStyleAt: { // wxStyledTextCtrl::GetStyleAt wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetStyleAt((int) *pos); + int Result = This->GetStyleAt(*pos); rt.addInt(Result); break; } @@ -27028,7 +27069,7 @@ case wxStyledTextCtrl_SetUndoCollection: { // wxStyledTextCtrl::SetUndoCollectio wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * collectUndo = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetUndoCollection((bool) *collectUndo); + This->SetUndoCollection(*collectUndo); break; } case wxStyledTextCtrl_SelectAll: { // wxStyledTextCtrl::SelectAll @@ -27048,7 +27089,7 @@ case wxStyledTextCtrl_GetStyledText: { // wxStyledTextCtrl::GetStyledText int * startPos = (int *) bp; bp += 4; int * endPos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxMemoryBuffer * Result = new wxMemoryBuffer(This->GetStyledText((int) *startPos,(int) *endPos)); newPtr((void *) Result,3, memenv);; + wxMemoryBuffer * Result = new wxMemoryBuffer(This->GetStyledText(*startPos,*endPos)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxMemoryBuffer"); break; } @@ -27063,7 +27104,7 @@ case wxStyledTextCtrl_MarkerLineFromHandle: { // wxStyledTextCtrl::MarkerLineFro wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * handle = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->MarkerLineFromHandle((int) *handle); + int Result = This->MarkerLineFromHandle(*handle); rt.addInt(Result); break; } @@ -27071,7 +27112,7 @@ case wxStyledTextCtrl_MarkerDeleteHandle: { // wxStyledTextCtrl::MarkerDeleteHan wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * handle = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->MarkerDeleteHandle((int) *handle); + This->MarkerDeleteHandle(*handle); break; } case wxStyledTextCtrl_GetUndoCollection: { // wxStyledTextCtrl::GetUndoCollection @@ -27092,7 +27133,7 @@ case wxStyledTextCtrl_SetViewWhiteSpace: { // wxStyledTextCtrl::SetViewWhiteSpac wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * viewWS = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetViewWhiteSpace((int) *viewWS); + This->SetViewWhiteSpace(*viewWS); break; } case wxStyledTextCtrl_PositionFromPoint: { // wxStyledTextCtrl::PositionFromPoint @@ -27110,7 +27151,7 @@ case wxStyledTextCtrl_PositionFromPointClose: { // wxStyledTextCtrl::PositionFro int * x = (int *) bp; bp += 4; int * y = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->PositionFromPointClose((int) *x,(int) *y); + int Result = This->PositionFromPointClose(*x,*y); rt.addInt(Result); break; } @@ -27118,21 +27159,21 @@ case wxStyledTextCtrl_GotoLine: { // wxStyledTextCtrl::GotoLine wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->GotoLine((int) *line); + This->GotoLine(*line); break; } case wxStyledTextCtrl_GotoPos: { // wxStyledTextCtrl::GotoPos wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->GotoPos((int) *pos); + This->GotoPos(*pos); break; } case wxStyledTextCtrl_SetAnchor: { // wxStyledTextCtrl::SetAnchor wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * posAnchor = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetAnchor((int) *posAnchor); + This->SetAnchor(*posAnchor); break; } case wxStyledTextCtrl_GetCurLine: { // wxStyledTextCtrl::GetCurLine @@ -27156,7 +27197,7 @@ case wxStyledTextCtrl_ConvertEOLs: { // wxStyledTextCtrl::ConvertEOLs wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * eolMode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ConvertEOLs((int) *eolMode); + This->ConvertEOLs(*eolMode); break; } case wxStyledTextCtrl_GetEOLMode: { // wxStyledTextCtrl::GetEOLMode @@ -27170,7 +27211,7 @@ case wxStyledTextCtrl_SetEOLMode: { // wxStyledTextCtrl::SetEOLMode wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * eolMode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetEOLMode((int) *eolMode); + This->SetEOLMode(*eolMode); break; } case wxStyledTextCtrl_StartStyling: { // wxStyledTextCtrl::StartStyling @@ -27178,7 +27219,7 @@ case wxStyledTextCtrl_StartStyling: { // wxStyledTextCtrl::StartStyling int * pos = (int *) bp; bp += 4; int * mask = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StartStyling((int) *pos,(int) *mask); + This->StartStyling(*pos,*mask); break; } case wxStyledTextCtrl_SetStyling: { // wxStyledTextCtrl::SetStyling @@ -27186,7 +27227,7 @@ case wxStyledTextCtrl_SetStyling: { // wxStyledTextCtrl::SetStyling int * length = (int *) bp; bp += 4; int * style = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetStyling((int) *length,(int) *style); + This->SetStyling(*length,*style); break; } case wxStyledTextCtrl_GetBufferedDraw: { // wxStyledTextCtrl::GetBufferedDraw @@ -27200,14 +27241,14 @@ case wxStyledTextCtrl_SetBufferedDraw: { // wxStyledTextCtrl::SetBufferedDraw wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * buffered = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetBufferedDraw((bool) *buffered); + This->SetBufferedDraw(*buffered); break; } case wxStyledTextCtrl_SetTabWidth: { // wxStyledTextCtrl::SetTabWidth wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * tabWidth = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetTabWidth((int) *tabWidth); + This->SetTabWidth(*tabWidth); break; } case wxStyledTextCtrl_GetTabWidth: { // wxStyledTextCtrl::GetTabWidth @@ -27221,7 +27262,7 @@ case wxStyledTextCtrl_SetCodePage: { // wxStyledTextCtrl::SetCodePage wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * codePage = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCodePage((int) *codePage); + This->SetCodePage(*codePage); break; } case wxStyledTextCtrl_MarkerDefine: { // wxStyledTextCtrl::MarkerDefine @@ -27250,7 +27291,7 @@ case wxStyledTextCtrl_MarkerDefine: { // wxStyledTextCtrl::MarkerDefine } break; }}; if(!This) throw wxe_badarg(0); - This->MarkerDefine((int) *markerNumber,(int) *markerSymbol,foreground,background); + This->MarkerDefine(*markerNumber,*markerSymbol,foreground,background); break; } case wxStyledTextCtrl_MarkerSetForeground: { // wxStyledTextCtrl::MarkerSetForeground @@ -27262,7 +27303,7 @@ case wxStyledTextCtrl_MarkerSetForeground: { // wxStyledTextCtrl::MarkerSetForeg int * foreA = (int *) bp; bp += 4; wxColour fore = wxColour(*foreR,*foreG,*foreB,*foreA); if(!This) throw wxe_badarg(0); - This->MarkerSetForeground((int) *markerNumber,fore); + This->MarkerSetForeground(*markerNumber,fore); break; } case wxStyledTextCtrl_MarkerSetBackground: { // wxStyledTextCtrl::MarkerSetBackground @@ -27274,7 +27315,7 @@ case wxStyledTextCtrl_MarkerSetBackground: { // wxStyledTextCtrl::MarkerSetBackg int * backA = (int *) bp; bp += 4; wxColour back = wxColour(*backR,*backG,*backB,*backA); if(!This) throw wxe_badarg(0); - This->MarkerSetBackground((int) *markerNumber,back); + This->MarkerSetBackground(*markerNumber,back); break; } case wxStyledTextCtrl_MarkerAdd: { // wxStyledTextCtrl::MarkerAdd @@ -27282,7 +27323,7 @@ case wxStyledTextCtrl_MarkerAdd: { // wxStyledTextCtrl::MarkerAdd int * line = (int *) bp; bp += 4; int * markerNumber = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->MarkerAdd((int) *line,(int) *markerNumber); + int Result = This->MarkerAdd(*line,*markerNumber); rt.addInt(Result); break; } @@ -27291,21 +27332,21 @@ case wxStyledTextCtrl_MarkerDelete: { // wxStyledTextCtrl::MarkerDelete int * line = (int *) bp; bp += 4; int * markerNumber = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->MarkerDelete((int) *line,(int) *markerNumber); + This->MarkerDelete(*line,*markerNumber); break; } case wxStyledTextCtrl_MarkerDeleteAll: { // wxStyledTextCtrl::MarkerDeleteAll wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * markerNumber = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->MarkerDeleteAll((int) *markerNumber); + This->MarkerDeleteAll(*markerNumber); break; } case wxStyledTextCtrl_MarkerGet: { // wxStyledTextCtrl::MarkerGet wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->MarkerGet((int) *line); + int Result = This->MarkerGet(*line); rt.addInt(Result); break; } @@ -27314,7 +27355,7 @@ case wxStyledTextCtrl_MarkerNext: { // wxStyledTextCtrl::MarkerNext int * lineStart = (int *) bp; bp += 4; int * markerMask = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->MarkerNext((int) *lineStart,(int) *markerMask); + int Result = This->MarkerNext(*lineStart,*markerMask); rt.addInt(Result); break; } @@ -27323,7 +27364,7 @@ case wxStyledTextCtrl_MarkerPrevious: { // wxStyledTextCtrl::MarkerPrevious int * lineStart = (int *) bp; bp += 4; int * markerMask = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->MarkerPrevious((int) *lineStart,(int) *markerMask); + int Result = This->MarkerPrevious(*lineStart,*markerMask); rt.addInt(Result); break; } @@ -27332,7 +27373,7 @@ case wxStyledTextCtrl_MarkerDefineBitmap: { // wxStyledTextCtrl::MarkerDefineBit int * markerNumber = (int *) bp; bp += 4; wxBitmap *bmp = (wxBitmap *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->MarkerDefineBitmap((int) *markerNumber,*bmp); + This->MarkerDefineBitmap(*markerNumber,*bmp); break; } case wxStyledTextCtrl_MarkerAddSet: { // wxStyledTextCtrl::MarkerAddSet @@ -27340,7 +27381,7 @@ case wxStyledTextCtrl_MarkerAddSet: { // wxStyledTextCtrl::MarkerAddSet int * line = (int *) bp; bp += 4; int * set = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->MarkerAddSet((int) *line,(int) *set); + This->MarkerAddSet(*line,*set); break; } case wxStyledTextCtrl_MarkerSetAlpha: { // wxStyledTextCtrl::MarkerSetAlpha @@ -27348,7 +27389,7 @@ case wxStyledTextCtrl_MarkerSetAlpha: { // wxStyledTextCtrl::MarkerSetAlpha int * markerNumber = (int *) bp; bp += 4; int * alpha = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->MarkerSetAlpha((int) *markerNumber,(int) *alpha); + This->MarkerSetAlpha(*markerNumber,*alpha); break; } case wxStyledTextCtrl_SetMarginType: { // wxStyledTextCtrl::SetMarginType @@ -27356,14 +27397,14 @@ case wxStyledTextCtrl_SetMarginType: { // wxStyledTextCtrl::SetMarginType int * margin = (int *) bp; bp += 4; int * marginType = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMarginType((int) *margin,(int) *marginType); + This->SetMarginType(*margin,*marginType); break; } case wxStyledTextCtrl_GetMarginType: { // wxStyledTextCtrl::GetMarginType wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * margin = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetMarginType((int) *margin); + int Result = This->GetMarginType(*margin); rt.addInt(Result); break; } @@ -27372,14 +27413,14 @@ case wxStyledTextCtrl_SetMarginWidth: { // wxStyledTextCtrl::SetMarginWidth int * margin = (int *) bp; bp += 4; int * pixelWidth = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMarginWidth((int) *margin,(int) *pixelWidth); + This->SetMarginWidth(*margin,*pixelWidth); break; } case wxStyledTextCtrl_GetMarginWidth: { // wxStyledTextCtrl::GetMarginWidth wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * margin = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetMarginWidth((int) *margin); + int Result = This->GetMarginWidth(*margin); rt.addInt(Result); break; } @@ -27388,14 +27429,14 @@ case wxStyledTextCtrl_SetMarginMask: { // wxStyledTextCtrl::SetMarginMask int * margin = (int *) bp; bp += 4; int * mask = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMarginMask((int) *margin,(int) *mask); + This->SetMarginMask(*margin,*mask); break; } case wxStyledTextCtrl_GetMarginMask: { // wxStyledTextCtrl::GetMarginMask wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * margin = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetMarginMask((int) *margin); + int Result = This->GetMarginMask(*margin); rt.addInt(Result); break; } @@ -27404,14 +27445,14 @@ case wxStyledTextCtrl_SetMarginSensitive: { // wxStyledTextCtrl::SetMarginSensit int * margin = (int *) bp; bp += 4; bool * sensitive = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMarginSensitive((int) *margin,(bool) *sensitive); + This->SetMarginSensitive(*margin,*sensitive); break; } case wxStyledTextCtrl_GetMarginSensitive: { // wxStyledTextCtrl::GetMarginSensitive wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * margin = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetMarginSensitive((int) *margin); + bool Result = This->GetMarginSensitive(*margin); rt.addBool(Result); break; } @@ -27430,7 +27471,7 @@ case wxStyledTextCtrl_StyleSetForeground: { // wxStyledTextCtrl::StyleSetForegro int * foreA = (int *) bp; bp += 4; wxColour fore = wxColour(*foreR,*foreG,*foreB,*foreA); if(!This) throw wxe_badarg(0); - This->StyleSetForeground((int) *style,fore); + This->StyleSetForeground(*style,fore); break; } case wxStyledTextCtrl_StyleSetBackground: { // wxStyledTextCtrl::StyleSetBackground @@ -27442,7 +27483,7 @@ case wxStyledTextCtrl_StyleSetBackground: { // wxStyledTextCtrl::StyleSetBackgro int * backA = (int *) bp; bp += 4; wxColour back = wxColour(*backR,*backG,*backB,*backA); if(!This) throw wxe_badarg(0); - This->StyleSetBackground((int) *style,back); + This->StyleSetBackground(*style,back); break; } case wxStyledTextCtrl_StyleSetBold: { // wxStyledTextCtrl::StyleSetBold @@ -27450,7 +27491,7 @@ case wxStyledTextCtrl_StyleSetBold: { // wxStyledTextCtrl::StyleSetBold int * style = (int *) bp; bp += 4; bool * bold = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetBold((int) *style,(bool) *bold); + This->StyleSetBold(*style,*bold); break; } case wxStyledTextCtrl_StyleSetItalic: { // wxStyledTextCtrl::StyleSetItalic @@ -27458,7 +27499,7 @@ case wxStyledTextCtrl_StyleSetItalic: { // wxStyledTextCtrl::StyleSetItalic int * style = (int *) bp; bp += 4; bool * italic = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetItalic((int) *style,(bool) *italic); + This->StyleSetItalic(*style,*italic); break; } case wxStyledTextCtrl_StyleSetSize: { // wxStyledTextCtrl::StyleSetSize @@ -27466,7 +27507,7 @@ case wxStyledTextCtrl_StyleSetSize: { // wxStyledTextCtrl::StyleSetSize int * style = (int *) bp; bp += 4; int * sizePoints = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetSize((int) *style,(int) *sizePoints); + This->StyleSetSize(*style,*sizePoints); break; } case wxStyledTextCtrl_StyleSetFaceName: { // wxStyledTextCtrl::StyleSetFaceName @@ -27476,7 +27517,7 @@ case wxStyledTextCtrl_StyleSetFaceName: { // wxStyledTextCtrl::StyleSetFaceName wxString fontName = wxString(bp, wxConvUTF8); bp += *fontNameLen+((8-((4+ *fontNameLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->StyleSetFaceName((int) *style,fontName); + This->StyleSetFaceName(*style,fontName); break; } case wxStyledTextCtrl_StyleSetEOLFilled: { // wxStyledTextCtrl::StyleSetEOLFilled @@ -27484,7 +27525,7 @@ case wxStyledTextCtrl_StyleSetEOLFilled: { // wxStyledTextCtrl::StyleSetEOLFille int * style = (int *) bp; bp += 4; bool * filled = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetEOLFilled((int) *style,(bool) *filled); + This->StyleSetEOLFilled(*style,*filled); break; } case wxStyledTextCtrl_StyleResetDefault: { // wxStyledTextCtrl::StyleResetDefault @@ -27498,7 +27539,7 @@ case wxStyledTextCtrl_StyleSetUnderline: { // wxStyledTextCtrl::StyleSetUnderlin int * style = (int *) bp; bp += 4; bool * underline = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetUnderline((int) *style,(bool) *underline); + This->StyleSetUnderline(*style,*underline); break; } case wxStyledTextCtrl_StyleSetCase: { // wxStyledTextCtrl::StyleSetCase @@ -27506,7 +27547,7 @@ case wxStyledTextCtrl_StyleSetCase: { // wxStyledTextCtrl::StyleSetCase int * style = (int *) bp; bp += 4; int * caseForce = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetCase((int) *style,(int) *caseForce); + This->StyleSetCase(*style,*caseForce); break; } case wxStyledTextCtrl_StyleSetHotSpot: { // wxStyledTextCtrl::StyleSetHotSpot @@ -27514,7 +27555,7 @@ case wxStyledTextCtrl_StyleSetHotSpot: { // wxStyledTextCtrl::StyleSetHotSpot int * style = (int *) bp; bp += 4; bool * hotspot = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetHotSpot((int) *style,(bool) *hotspot); + This->StyleSetHotSpot(*style,*hotspot); break; } case wxStyledTextCtrl_SetSelForeground: { // wxStyledTextCtrl::SetSelForeground @@ -27526,7 +27567,7 @@ case wxStyledTextCtrl_SetSelForeground: { // wxStyledTextCtrl::SetSelForeground int * foreA = (int *) bp; bp += 4; wxColour fore = wxColour(*foreR,*foreG,*foreB,*foreA); if(!This) throw wxe_badarg(0); - This->SetSelForeground((bool) *useSetting,fore); + This->SetSelForeground(*useSetting,fore); break; } case wxStyledTextCtrl_SetSelBackground: { // wxStyledTextCtrl::SetSelBackground @@ -27538,7 +27579,7 @@ case wxStyledTextCtrl_SetSelBackground: { // wxStyledTextCtrl::SetSelBackground int * backA = (int *) bp; bp += 4; wxColour back = wxColour(*backR,*backG,*backB,*backA); if(!This) throw wxe_badarg(0); - This->SetSelBackground((bool) *useSetting,back); + This->SetSelBackground(*useSetting,back); break; } case wxStyledTextCtrl_GetSelAlpha: { // wxStyledTextCtrl::GetSelAlpha @@ -27552,7 +27593,7 @@ case wxStyledTextCtrl_SetSelAlpha: { // wxStyledTextCtrl::SetSelAlpha wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * alpha = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelAlpha((int) *alpha); + This->SetSelAlpha(*alpha); break; } case wxStyledTextCtrl_SetCaretForeground: { // wxStyledTextCtrl::SetCaretForeground @@ -27572,7 +27613,7 @@ case wxStyledTextCtrl_CmdKeyAssign: { // wxStyledTextCtrl::CmdKeyAssign int * modifiers = (int *) bp; bp += 4; int * cmd = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->CmdKeyAssign((int) *key,(int) *modifiers,(int) *cmd); + This->CmdKeyAssign(*key,*modifiers,*cmd); break; } case wxStyledTextCtrl_CmdKeyClear: { // wxStyledTextCtrl::CmdKeyClear @@ -27580,7 +27621,7 @@ case wxStyledTextCtrl_CmdKeyClear: { // wxStyledTextCtrl::CmdKeyClear int * key = (int *) bp; bp += 4; int * modifiers = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->CmdKeyClear((int) *key,(int) *modifiers); + This->CmdKeyClear(*key,*modifiers); break; } case wxStyledTextCtrl_CmdKeyClearAll: { // wxStyledTextCtrl::CmdKeyClearAll @@ -27594,7 +27635,7 @@ case wxStyledTextCtrl_SetStyleBytes: { // wxStyledTextCtrl::SetStyleBytes wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * length = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetStyleBytes((int) *length,&styleBytes); + This->SetStyleBytes(*length,&styleBytes); rt.addInt(styleBytes); break; } @@ -27603,7 +27644,7 @@ case wxStyledTextCtrl_StyleSetVisible: { // wxStyledTextCtrl::StyleSetVisible int * style = (int *) bp; bp += 4; bool * visible = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetVisible((int) *style,(bool) *visible); + This->StyleSetVisible(*style,*visible); break; } case wxStyledTextCtrl_GetCaretPeriod: { // wxStyledTextCtrl::GetCaretPeriod @@ -27617,7 +27658,7 @@ case wxStyledTextCtrl_SetCaretPeriod: { // wxStyledTextCtrl::SetCaretPeriod wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * periodMilliseconds = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCaretPeriod((int) *periodMilliseconds); + This->SetCaretPeriod(*periodMilliseconds); break; } case wxStyledTextCtrl_SetWordChars: { // wxStyledTextCtrl::SetWordChars @@ -27646,14 +27687,14 @@ case wxStyledTextCtrl_IndicatorSetStyle: { // wxStyledTextCtrl::IndicatorSetStyl int * indic = (int *) bp; bp += 4; int * style = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->IndicatorSetStyle((int) *indic,(int) *style); + This->IndicatorSetStyle(*indic,*style); break; } case wxStyledTextCtrl_IndicatorGetStyle: { // wxStyledTextCtrl::IndicatorGetStyle wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * indic = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->IndicatorGetStyle((int) *indic); + int Result = This->IndicatorGetStyle(*indic); rt.addInt(Result); break; } @@ -27666,14 +27707,14 @@ case wxStyledTextCtrl_IndicatorSetForeground: { // wxStyledTextCtrl::IndicatorSe int * foreA = (int *) bp; bp += 4; wxColour fore = wxColour(*foreR,*foreG,*foreB,*foreA); if(!This) throw wxe_badarg(0); - This->IndicatorSetForeground((int) *indic,fore); + This->IndicatorSetForeground(*indic,fore); break; } case wxStyledTextCtrl_IndicatorGetForeground: { // wxStyledTextCtrl::IndicatorGetForeground wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * indic = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxColour Result = This->IndicatorGetForeground((int) *indic); + wxColour Result = This->IndicatorGetForeground(*indic); rt.add(Result); break; } @@ -27686,7 +27727,7 @@ case wxStyledTextCtrl_SetWhitespaceForeground: { // wxStyledTextCtrl::SetWhitesp int * foreA = (int *) bp; bp += 4; wxColour fore = wxColour(*foreR,*foreG,*foreB,*foreA); if(!This) throw wxe_badarg(0); - This->SetWhitespaceForeground((bool) *useSetting,fore); + This->SetWhitespaceForeground(*useSetting,fore); break; } case wxStyledTextCtrl_SetWhitespaceBackground: { // wxStyledTextCtrl::SetWhitespaceBackground @@ -27698,7 +27739,7 @@ case wxStyledTextCtrl_SetWhitespaceBackground: { // wxStyledTextCtrl::SetWhitesp int * backA = (int *) bp; bp += 4; wxColour back = wxColour(*backR,*backG,*backB,*backA); if(!This) throw wxe_badarg(0); - This->SetWhitespaceBackground((bool) *useSetting,back); + This->SetWhitespaceBackground(*useSetting,back); break; } case wxStyledTextCtrl_GetStyleBits: { // wxStyledTextCtrl::GetStyleBits @@ -27713,14 +27754,14 @@ case wxStyledTextCtrl_SetLineState: { // wxStyledTextCtrl::SetLineState int * line = (int *) bp; bp += 4; int * state = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetLineState((int) *line,(int) *state); + This->SetLineState(*line,*state); break; } case wxStyledTextCtrl_GetLineState: { // wxStyledTextCtrl::GetLineState wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetLineState((int) *line); + int Result = This->GetLineState(*line); rt.addInt(Result); break; } @@ -27742,7 +27783,7 @@ case wxStyledTextCtrl_SetCaretLineVisible: { // wxStyledTextCtrl::SetCaretLineVi wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * show = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCaretLineVisible((bool) *show); + This->SetCaretLineVisible(*show); break; } case wxStyledTextCtrl_GetCaretLineBackground: { // wxStyledTextCtrl::GetCaretLineBackground @@ -27770,7 +27811,7 @@ case wxStyledTextCtrl_AutoCompShow: { // wxStyledTextCtrl::AutoCompShow wxString itemList = wxString(bp, wxConvUTF8); bp += *itemListLen+((8-((4+ *itemListLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->AutoCompShow((int) *lenEntered,itemList); + This->AutoCompShow(*lenEntered,itemList); break; } case wxStyledTextCtrl_AutoCompCancel: { // wxStyledTextCtrl::AutoCompCancel @@ -27812,7 +27853,7 @@ case wxStyledTextCtrl_AutoCompSetSeparator: { // wxStyledTextCtrl::AutoCompSetSe wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * separatorCharacter = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AutoCompSetSeparator((int) *separatorCharacter); + This->AutoCompSetSeparator(*separatorCharacter); break; } case wxStyledTextCtrl_AutoCompGetSeparator: { // wxStyledTextCtrl::AutoCompGetSeparator @@ -27835,7 +27876,7 @@ case wxStyledTextCtrl_AutoCompSetCancelAtStart: { // wxStyledTextCtrl::AutoCompS wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * cancel = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AutoCompSetCancelAtStart((bool) *cancel); + This->AutoCompSetCancelAtStart(*cancel); break; } case wxStyledTextCtrl_AutoCompGetCancelAtStart: { // wxStyledTextCtrl::AutoCompGetCancelAtStart @@ -27858,7 +27899,7 @@ case wxStyledTextCtrl_AutoCompSetChooseSingle: { // wxStyledTextCtrl::AutoCompSe wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * chooseSingle = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AutoCompSetChooseSingle((bool) *chooseSingle); + This->AutoCompSetChooseSingle(*chooseSingle); break; } case wxStyledTextCtrl_AutoCompGetChooseSingle: { // wxStyledTextCtrl::AutoCompGetChooseSingle @@ -27872,7 +27913,7 @@ case wxStyledTextCtrl_AutoCompSetIgnoreCase: { // wxStyledTextCtrl::AutoCompSetI wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * ignoreCase = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AutoCompSetIgnoreCase((bool) *ignoreCase); + This->AutoCompSetIgnoreCase(*ignoreCase); break; } case wxStyledTextCtrl_AutoCompGetIgnoreCase: { // wxStyledTextCtrl::AutoCompGetIgnoreCase @@ -27889,14 +27930,14 @@ case wxStyledTextCtrl_UserListShow: { // wxStyledTextCtrl::UserListShow wxString itemList = wxString(bp, wxConvUTF8); bp += *itemListLen+((8-((4+ *itemListLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->UserListShow((int) *listType,itemList); + This->UserListShow(*listType,itemList); break; } case wxStyledTextCtrl_AutoCompSetAutoHide: { // wxStyledTextCtrl::AutoCompSetAutoHide wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * autoHide = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AutoCompSetAutoHide((bool) *autoHide); + This->AutoCompSetAutoHide(*autoHide); break; } case wxStyledTextCtrl_AutoCompGetAutoHide: { // wxStyledTextCtrl::AutoCompGetAutoHide @@ -27910,7 +27951,7 @@ case wxStyledTextCtrl_AutoCompSetDropRestOfWord: { // wxStyledTextCtrl::AutoComp wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * dropRestOfWord = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AutoCompSetDropRestOfWord((bool) *dropRestOfWord); + This->AutoCompSetDropRestOfWord(*dropRestOfWord); break; } case wxStyledTextCtrl_AutoCompGetDropRestOfWord: { // wxStyledTextCtrl::AutoCompGetDropRestOfWord @@ -27925,7 +27966,7 @@ case wxStyledTextCtrl_RegisterImage: { // wxStyledTextCtrl::RegisterImage int * type = (int *) bp; bp += 4; wxBitmap *bmp = (wxBitmap *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->RegisterImage((int) *type,*bmp); + This->RegisterImage(*type,*bmp); break; } case wxStyledTextCtrl_ClearRegisteredImages: { // wxStyledTextCtrl::ClearRegisteredImages @@ -27945,14 +27986,14 @@ case wxStyledTextCtrl_AutoCompSetTypeSeparator: { // wxStyledTextCtrl::AutoCompS wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * separatorCharacter = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AutoCompSetTypeSeparator((int) *separatorCharacter); + This->AutoCompSetTypeSeparator(*separatorCharacter); break; } case wxStyledTextCtrl_AutoCompSetMaxWidth: { // wxStyledTextCtrl::AutoCompSetMaxWidth wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * characterCount = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AutoCompSetMaxWidth((int) *characterCount); + This->AutoCompSetMaxWidth(*characterCount); break; } case wxStyledTextCtrl_AutoCompGetMaxWidth: { // wxStyledTextCtrl::AutoCompGetMaxWidth @@ -27966,7 +28007,7 @@ case wxStyledTextCtrl_AutoCompSetMaxHeight: { // wxStyledTextCtrl::AutoCompSetMa wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * rowCount = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->AutoCompSetMaxHeight((int) *rowCount); + This->AutoCompSetMaxHeight(*rowCount); break; } case wxStyledTextCtrl_AutoCompGetMaxHeight: { // wxStyledTextCtrl::AutoCompGetMaxHeight @@ -27980,7 +28021,7 @@ case wxStyledTextCtrl_SetIndent: { // wxStyledTextCtrl::SetIndent wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * indentSize = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetIndent((int) *indentSize); + This->SetIndent(*indentSize); break; } case wxStyledTextCtrl_GetIndent: { // wxStyledTextCtrl::GetIndent @@ -27994,7 +28035,7 @@ case wxStyledTextCtrl_SetUseTabs: { // wxStyledTextCtrl::SetUseTabs wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * useTabs = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetUseTabs((bool) *useTabs); + This->SetUseTabs(*useTabs); break; } case wxStyledTextCtrl_GetUseTabs: { // wxStyledTextCtrl::GetUseTabs @@ -28009,14 +28050,14 @@ case wxStyledTextCtrl_SetLineIndentation: { // wxStyledTextCtrl::SetLineIndentat int * line = (int *) bp; bp += 4; int * indentSize = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetLineIndentation((int) *line,(int) *indentSize); + This->SetLineIndentation(*line,*indentSize); break; } case wxStyledTextCtrl_GetLineIndentation: { // wxStyledTextCtrl::GetLineIndentation wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetLineIndentation((int) *line); + int Result = This->GetLineIndentation(*line); rt.addInt(Result); break; } @@ -28024,7 +28065,7 @@ case wxStyledTextCtrl_GetLineIndentPosition: { // wxStyledTextCtrl::GetLineInden wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetLineIndentPosition((int) *line); + int Result = This->GetLineIndentPosition(*line); rt.addInt(Result); break; } @@ -28032,7 +28073,7 @@ case wxStyledTextCtrl_GetColumn: { // wxStyledTextCtrl::GetColumn wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetColumn((int) *pos); + int Result = This->GetColumn(*pos); rt.addInt(Result); break; } @@ -28040,7 +28081,7 @@ case wxStyledTextCtrl_SetUseHorizontalScrollBar: { // wxStyledTextCtrl::SetUseHo wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * show = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetUseHorizontalScrollBar((bool) *show); + This->SetUseHorizontalScrollBar(*show); break; } case wxStyledTextCtrl_GetUseHorizontalScrollBar: { // wxStyledTextCtrl::GetUseHorizontalScrollBar @@ -28054,7 +28095,7 @@ case wxStyledTextCtrl_SetIndentationGuides: { // wxStyledTextCtrl::SetIndentatio wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * show = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetIndentationGuides((bool) *show); + This->SetIndentationGuides(*show); break; } case wxStyledTextCtrl_GetIndentationGuides: { // wxStyledTextCtrl::GetIndentationGuides @@ -28068,7 +28109,7 @@ case wxStyledTextCtrl_SetHighlightGuide: { // wxStyledTextCtrl::SetHighlightGuid wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * column = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetHighlightGuide((int) *column); + This->SetHighlightGuide(*column); break; } case wxStyledTextCtrl_GetHighlightGuide: { // wxStyledTextCtrl::GetHighlightGuide @@ -28082,7 +28123,7 @@ case wxStyledTextCtrl_GetLineEndPosition: { // wxStyledTextCtrl::GetLineEndPosit wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetLineEndPosition((int) *line); + int Result = This->GetLineEndPosition(*line); rt.addInt(Result); break; } @@ -28111,14 +28152,14 @@ case wxStyledTextCtrl_SetCurrentPos: { // wxStyledTextCtrl::SetCurrentPos wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCurrentPos((int) *pos); + This->SetCurrentPos(*pos); break; } case wxStyledTextCtrl_SetSelectionStart: { // wxStyledTextCtrl::SetSelectionStart wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelectionStart((int) *pos); + This->SetSelectionStart(*pos); break; } case wxStyledTextCtrl_GetSelectionStart: { // wxStyledTextCtrl::GetSelectionStart @@ -28132,7 +28173,7 @@ case wxStyledTextCtrl_SetSelectionEnd: { // wxStyledTextCtrl::SetSelectionEnd wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelectionEnd((int) *pos); + This->SetSelectionEnd(*pos); break; } case wxStyledTextCtrl_GetSelectionEnd: { // wxStyledTextCtrl::GetSelectionEnd @@ -28146,7 +28187,7 @@ case wxStyledTextCtrl_SetPrintMagnification: { // wxStyledTextCtrl::SetPrintMagn wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * magnification = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPrintMagnification((int) *magnification); + This->SetPrintMagnification(*magnification); break; } case wxStyledTextCtrl_GetPrintMagnification: { // wxStyledTextCtrl::GetPrintMagnification @@ -28160,7 +28201,7 @@ case wxStyledTextCtrl_SetPrintColourMode: { // wxStyledTextCtrl::SetPrintColourM wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * mode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPrintColourMode((int) *mode); + This->SetPrintColourMode(*mode); break; } case wxStyledTextCtrl_GetPrintColourMode: { // wxStyledTextCtrl::GetPrintColourMode @@ -28184,7 +28225,7 @@ case wxStyledTextCtrl_FindText: { // wxStyledTextCtrl::FindText } break; }}; if(!This) throw wxe_badarg(0); - int Result = This->FindText((int) *minPos,(int) *maxPos,text,flags); + int Result = This->FindText(*minPos,*maxPos,text,flags); rt.addInt(Result); break; } @@ -28206,7 +28247,7 @@ case wxStyledTextCtrl_FormatRange: { // wxStyledTextCtrl::FormatRange int * pageRectH = (int *) bp; bp += 4; wxRect pageRect = wxRect(*pageRectX,*pageRectY,*pageRectW,*pageRectH); if(!This) throw wxe_badarg(0); - int Result = This->FormatRange((bool) *doDraw,(int) *startPos,(int) *endPos,draw,target,renderRect,pageRect); + int Result = This->FormatRange(*doDraw,*startPos,*endPos,draw,target,renderRect,pageRect); rt.addInt(Result); break; } @@ -28221,7 +28262,7 @@ case wxStyledTextCtrl_GetLine: { // wxStyledTextCtrl::GetLine wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetLine((int) *line); + wxString Result = This->GetLine(*line); rt.add(Result); break; } @@ -28236,7 +28277,7 @@ case wxStyledTextCtrl_SetMarginLeft: { // wxStyledTextCtrl::SetMarginLeft wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pixelWidth = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMarginLeft((int) *pixelWidth); + This->SetMarginLeft(*pixelWidth); break; } case wxStyledTextCtrl_GetMarginLeft: { // wxStyledTextCtrl::GetMarginLeft @@ -28250,7 +28291,7 @@ case wxStyledTextCtrl_SetMarginRight: { // wxStyledTextCtrl::SetMarginRight wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pixelWidth = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMarginRight((int) *pixelWidth); + This->SetMarginRight(*pixelWidth); break; } case wxStyledTextCtrl_GetMarginRight: { // wxStyledTextCtrl::GetMarginRight @@ -28272,7 +28313,7 @@ case wxStyledTextCtrl_SetSelection: { // wxStyledTextCtrl::SetSelection int * start = (int *) bp; bp += 4; int * end = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((int) *start,(int) *end); + This->SetSelection(*start,*end); break; } case wxStyledTextCtrl_GetSelectedText: { // wxStyledTextCtrl::GetSelectedText @@ -28287,7 +28328,7 @@ case wxStyledTextCtrl_GetTextRange: { // wxStyledTextCtrl::GetTextRange int * startPos = (int *) bp; bp += 4; int * endPos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxString Result = This->GetTextRange((int) *startPos,(int) *endPos); + wxString Result = This->GetTextRange(*startPos,*endPos); rt.add(Result); break; } @@ -28295,14 +28336,14 @@ case wxStyledTextCtrl_HideSelection: { // wxStyledTextCtrl::HideSelection wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * normal = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->HideSelection((bool) *normal); + This->HideSelection(*normal); break; } case wxStyledTextCtrl_LineFromPosition: { // wxStyledTextCtrl::LineFromPosition wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->LineFromPosition((int) *pos); + int Result = This->LineFromPosition(*pos); rt.addInt(Result); break; } @@ -28310,7 +28351,7 @@ case wxStyledTextCtrl_PositionFromLine: { // wxStyledTextCtrl::PositionFromLine wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->PositionFromLine((int) *line); + int Result = This->PositionFromLine(*line); rt.addInt(Result); break; } @@ -28319,7 +28360,7 @@ case wxStyledTextCtrl_LineScroll: { // wxStyledTextCtrl::LineScroll int * columns = (int *) bp; bp += 4; int * lines = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->LineScroll((int) *columns,(int) *lines); + This->LineScroll(*columns,*lines); break; } case wxStyledTextCtrl_EnsureCaretVisible: { // wxStyledTextCtrl::EnsureCaretVisible @@ -28341,7 +28382,7 @@ case wxStyledTextCtrl_SetReadOnly: { // wxStyledTextCtrl::SetReadOnly wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * readOnly = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetReadOnly((bool) *readOnly); + This->SetReadOnly(*readOnly); break; } case wxStyledTextCtrl_CanPaste: { // wxStyledTextCtrl::CanPaste @@ -28428,7 +28469,7 @@ case wxStyledTextCtrl_SetCaretWidth: { // wxStyledTextCtrl::SetCaretWidth wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pixelWidth = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCaretWidth((int) *pixelWidth); + This->SetCaretWidth(*pixelWidth); break; } case wxStyledTextCtrl_GetCaretWidth: { // wxStyledTextCtrl::GetCaretWidth @@ -28442,7 +28483,7 @@ case wxStyledTextCtrl_SetTargetStart: { // wxStyledTextCtrl::SetTargetStart wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetTargetStart((int) *pos); + This->SetTargetStart(*pos); break; } case wxStyledTextCtrl_GetTargetStart: { // wxStyledTextCtrl::GetTargetStart @@ -28456,7 +28497,7 @@ case wxStyledTextCtrl_SetTargetEnd: { // wxStyledTextCtrl::SetTargetEnd wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetTargetEnd((int) *pos); + This->SetTargetEnd(*pos); break; } case wxStyledTextCtrl_GetTargetEnd: { // wxStyledTextCtrl::GetTargetEnd @@ -28490,7 +28531,7 @@ case wxStyledTextCtrl_SetSearchFlags: { // wxStyledTextCtrl::SetSearchFlags wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * flags = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSearchFlags((int) *flags); + This->SetSearchFlags(*flags); break; } case wxStyledTextCtrl_GetSearchFlags: { // wxStyledTextCtrl::GetSearchFlags @@ -28507,7 +28548,7 @@ case wxStyledTextCtrl_CallTipShow: { // wxStyledTextCtrl::CallTipShow wxString definition = wxString(bp, wxConvUTF8); bp += *definitionLen+((8-((4+ *definitionLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->CallTipShow((int) *pos,definition); + This->CallTipShow(*pos,definition); break; } case wxStyledTextCtrl_CallTipCancel: { // wxStyledTextCtrl::CallTipCancel @@ -28535,7 +28576,7 @@ case wxStyledTextCtrl_CallTipSetHighlight: { // wxStyledTextCtrl::CallTipSetHigh int * start = (int *) bp; bp += 4; int * end = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->CallTipSetHighlight((int) *start,(int) *end); + This->CallTipSetHighlight(*start,*end); break; } case wxStyledTextCtrl_CallTipSetBackground: { // wxStyledTextCtrl::CallTipSetBackground @@ -28575,14 +28616,14 @@ case wxStyledTextCtrl_CallTipUseStyle: { // wxStyledTextCtrl::CallTipUseStyle wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * tabSize = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->CallTipUseStyle((int) *tabSize); + This->CallTipUseStyle(*tabSize); break; } case wxStyledTextCtrl_VisibleFromDocLine: { // wxStyledTextCtrl::VisibleFromDocLine wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->VisibleFromDocLine((int) *line); + int Result = This->VisibleFromDocLine(*line); rt.addInt(Result); break; } @@ -28590,7 +28631,7 @@ case wxStyledTextCtrl_DocLineFromVisible: { // wxStyledTextCtrl::DocLineFromVisi wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * lineDisplay = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->DocLineFromVisible((int) *lineDisplay); + int Result = This->DocLineFromVisible(*lineDisplay); rt.addInt(Result); break; } @@ -28598,7 +28639,7 @@ case wxStyledTextCtrl_WrapCount: { // wxStyledTextCtrl::WrapCount wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->WrapCount((int) *line); + int Result = This->WrapCount(*line); rt.addInt(Result); break; } @@ -28607,14 +28648,14 @@ case wxStyledTextCtrl_SetFoldLevel: { // wxStyledTextCtrl::SetFoldLevel int * line = (int *) bp; bp += 4; int * level = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFoldLevel((int) *line,(int) *level); + This->SetFoldLevel(*line,*level); break; } case wxStyledTextCtrl_GetFoldLevel: { // wxStyledTextCtrl::GetFoldLevel wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetFoldLevel((int) *line); + int Result = This->GetFoldLevel(*line); rt.addInt(Result); break; } @@ -28623,7 +28664,7 @@ case wxStyledTextCtrl_GetLastChild: { // wxStyledTextCtrl::GetLastChild int * line = (int *) bp; bp += 4; int * level = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetLastChild((int) *line,(int) *level); + int Result = This->GetLastChild(*line,*level); rt.addInt(Result); break; } @@ -28631,7 +28672,7 @@ case wxStyledTextCtrl_GetFoldParent: { // wxStyledTextCtrl::GetFoldParent wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->GetFoldParent((int) *line); + int Result = This->GetFoldParent(*line); rt.addInt(Result); break; } @@ -28640,7 +28681,7 @@ case wxStyledTextCtrl_ShowLines: { // wxStyledTextCtrl::ShowLines int * lineStart = (int *) bp; bp += 4; int * lineEnd = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ShowLines((int) *lineStart,(int) *lineEnd); + This->ShowLines(*lineStart,*lineEnd); break; } case wxStyledTextCtrl_HideLines: { // wxStyledTextCtrl::HideLines @@ -28648,14 +28689,14 @@ case wxStyledTextCtrl_HideLines: { // wxStyledTextCtrl::HideLines int * lineStart = (int *) bp; bp += 4; int * lineEnd = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->HideLines((int) *lineStart,(int) *lineEnd); + This->HideLines(*lineStart,*lineEnd); break; } case wxStyledTextCtrl_GetLineVisible: { // wxStyledTextCtrl::GetLineVisible wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetLineVisible((int) *line); + bool Result = This->GetLineVisible(*line); rt.addBool(Result); break; } @@ -28664,14 +28705,14 @@ case wxStyledTextCtrl_SetFoldExpanded: { // wxStyledTextCtrl::SetFoldExpanded int * line = (int *) bp; bp += 4; bool * expanded = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFoldExpanded((int) *line,(bool) *expanded); + This->SetFoldExpanded(*line,*expanded); break; } case wxStyledTextCtrl_GetFoldExpanded: { // wxStyledTextCtrl::GetFoldExpanded wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - bool Result = This->GetFoldExpanded((int) *line); + bool Result = This->GetFoldExpanded(*line); rt.addBool(Result); break; } @@ -28679,35 +28720,35 @@ case wxStyledTextCtrl_ToggleFold: { // wxStyledTextCtrl::ToggleFold wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ToggleFold((int) *line); + This->ToggleFold(*line); break; } case wxStyledTextCtrl_EnsureVisible: { // wxStyledTextCtrl::EnsureVisible wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnsureVisible((int) *line); + This->EnsureVisible(*line); break; } case wxStyledTextCtrl_SetFoldFlags: { // wxStyledTextCtrl::SetFoldFlags wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * flags = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetFoldFlags((int) *flags); + This->SetFoldFlags(*flags); break; } case wxStyledTextCtrl_EnsureVisibleEnforcePolicy: { // wxStyledTextCtrl::EnsureVisibleEnforcePolicy wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->EnsureVisibleEnforcePolicy((int) *line); + This->EnsureVisibleEnforcePolicy(*line); break; } case wxStyledTextCtrl_SetTabIndents: { // wxStyledTextCtrl::SetTabIndents wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * tabIndents = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetTabIndents((bool) *tabIndents); + This->SetTabIndents(*tabIndents); break; } case wxStyledTextCtrl_GetTabIndents: { // wxStyledTextCtrl::GetTabIndents @@ -28721,7 +28762,7 @@ case wxStyledTextCtrl_SetBackSpaceUnIndents: { // wxStyledTextCtrl::SetBackSpace wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * bsUnIndents = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetBackSpaceUnIndents((bool) *bsUnIndents); + This->SetBackSpaceUnIndents(*bsUnIndents); break; } case wxStyledTextCtrl_GetBackSpaceUnIndents: { // wxStyledTextCtrl::GetBackSpaceUnIndents @@ -28735,7 +28776,7 @@ case wxStyledTextCtrl_SetMouseDwellTime: { // wxStyledTextCtrl::SetMouseDwellTim wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * periodMilliseconds = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMouseDwellTime((int) *periodMilliseconds); + This->SetMouseDwellTime(*periodMilliseconds); break; } case wxStyledTextCtrl_GetMouseDwellTime: { // wxStyledTextCtrl::GetMouseDwellTime @@ -28750,7 +28791,7 @@ case wxStyledTextCtrl_WordStartPosition: { // wxStyledTextCtrl::WordStartPositio int * pos = (int *) bp; bp += 4; bool * onlyWordCharacters = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->WordStartPosition((int) *pos,(bool) *onlyWordCharacters); + int Result = This->WordStartPosition(*pos,*onlyWordCharacters); rt.addInt(Result); break; } @@ -28759,7 +28800,7 @@ case wxStyledTextCtrl_WordEndPosition: { // wxStyledTextCtrl::WordEndPosition int * pos = (int *) bp; bp += 4; bool * onlyWordCharacters = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->WordEndPosition((int) *pos,(bool) *onlyWordCharacters); + int Result = This->WordEndPosition(*pos,*onlyWordCharacters); rt.addInt(Result); break; } @@ -28767,7 +28808,7 @@ case wxStyledTextCtrl_SetWrapMode: { // wxStyledTextCtrl::SetWrapMode wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * mode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWrapMode((int) *mode); + This->SetWrapMode(*mode); break; } case wxStyledTextCtrl_GetWrapMode: { // wxStyledTextCtrl::GetWrapMode @@ -28781,7 +28822,7 @@ case wxStyledTextCtrl_SetWrapVisualFlags: { // wxStyledTextCtrl::SetWrapVisualFl wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * wrapVisualFlags = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWrapVisualFlags((int) *wrapVisualFlags); + This->SetWrapVisualFlags(*wrapVisualFlags); break; } case wxStyledTextCtrl_GetWrapVisualFlags: { // wxStyledTextCtrl::GetWrapVisualFlags @@ -28795,7 +28836,7 @@ case wxStyledTextCtrl_SetWrapVisualFlagsLocation: { // wxStyledTextCtrl::SetWrap wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * wrapVisualFlagsLocation = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWrapVisualFlagsLocation((int) *wrapVisualFlagsLocation); + This->SetWrapVisualFlagsLocation(*wrapVisualFlagsLocation); break; } case wxStyledTextCtrl_GetWrapVisualFlagsLocation: { // wxStyledTextCtrl::GetWrapVisualFlagsLocation @@ -28809,7 +28850,7 @@ case wxStyledTextCtrl_SetWrapStartIndent: { // wxStyledTextCtrl::SetWrapStartInd wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * indent = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetWrapStartIndent((int) *indent); + This->SetWrapStartIndent(*indent); break; } case wxStyledTextCtrl_GetWrapStartIndent: { // wxStyledTextCtrl::GetWrapStartIndent @@ -28823,7 +28864,7 @@ case wxStyledTextCtrl_SetLayoutCache: { // wxStyledTextCtrl::SetLayoutCache wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * mode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetLayoutCache((int) *mode); + This->SetLayoutCache(*mode); break; } case wxStyledTextCtrl_GetLayoutCache: { // wxStyledTextCtrl::GetLayoutCache @@ -28837,7 +28878,7 @@ case wxStyledTextCtrl_SetScrollWidth: { // wxStyledTextCtrl::SetScrollWidth wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pixelWidth = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetScrollWidth((int) *pixelWidth); + This->SetScrollWidth(*pixelWidth); break; } case wxStyledTextCtrl_GetScrollWidth: { // wxStyledTextCtrl::GetScrollWidth @@ -28854,7 +28895,7 @@ case wxStyledTextCtrl_TextWidth: { // wxStyledTextCtrl::TextWidth wxString text = wxString(bp, wxConvUTF8); bp += *textLen+((8-((4+ *textLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - int Result = This->TextWidth((int) *style,text); + int Result = This->TextWidth(*style,text); rt.addInt(Result); break; } @@ -28869,7 +28910,7 @@ case wxStyledTextCtrl_TextHeight: { // wxStyledTextCtrl::TextHeight wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->TextHeight((int) *line); + int Result = This->TextHeight(*line); rt.addInt(Result); break; } @@ -28877,7 +28918,7 @@ case wxStyledTextCtrl_SetUseVerticalScrollBar: { // wxStyledTextCtrl::SetUseVert wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * show = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetUseVerticalScrollBar((bool) *show); + This->SetUseVerticalScrollBar(*show); break; } case wxStyledTextCtrl_GetUseVerticalScrollBar: { // wxStyledTextCtrl::GetUseVerticalScrollBar @@ -28907,7 +28948,7 @@ case wxStyledTextCtrl_SetTwoPhaseDraw: { // wxStyledTextCtrl::SetTwoPhaseDraw wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * twoPhase = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetTwoPhaseDraw((bool) *twoPhase); + This->SetTwoPhaseDraw(*twoPhase); break; } case wxStyledTextCtrl_TargetFromSelection: { // wxStyledTextCtrl::TargetFromSelection @@ -28926,7 +28967,7 @@ case wxStyledTextCtrl_LinesSplit: { // wxStyledTextCtrl::LinesSplit wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pixelWidth = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->LinesSplit((int) *pixelWidth); + This->LinesSplit(*pixelWidth); break; } case wxStyledTextCtrl_SetFoldMarginColour: { // wxStyledTextCtrl::SetFoldMarginColour @@ -28938,7 +28979,7 @@ case wxStyledTextCtrl_SetFoldMarginColour: { // wxStyledTextCtrl::SetFoldMarginC int * backA = (int *) bp; bp += 4; wxColour back = wxColour(*backR,*backG,*backB,*backA); if(!This) throw wxe_badarg(0); - This->SetFoldMarginColour((bool) *useSetting,back); + This->SetFoldMarginColour(*useSetting,back); break; } case wxStyledTextCtrl_SetFoldMarginHiColour: { // wxStyledTextCtrl::SetFoldMarginHiColour @@ -28950,7 +28991,7 @@ case wxStyledTextCtrl_SetFoldMarginHiColour: { // wxStyledTextCtrl::SetFoldMargi int * foreA = (int *) bp; bp += 4; wxColour fore = wxColour(*foreR,*foreG,*foreB,*foreA); if(!This) throw wxe_badarg(0); - This->SetFoldMarginHiColour((bool) *useSetting,fore); + This->SetFoldMarginHiColour(*useSetting,fore); break; } case wxStyledTextCtrl_LineDown: { // wxStyledTextCtrl::LineDown @@ -29299,7 +29340,7 @@ case wxStyledTextCtrl_LineLength: { // wxStyledTextCtrl::LineLength wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->LineLength((int) *line); + int Result = This->LineLength(*line); rt.addInt(Result); break; } @@ -29308,21 +29349,21 @@ case wxStyledTextCtrl_BraceHighlight: { // wxStyledTextCtrl::BraceHighlight int * pos1 = (int *) bp; bp += 4; int * pos2 = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->BraceHighlight((int) *pos1,(int) *pos2); + This->BraceHighlight(*pos1,*pos2); break; } case wxStyledTextCtrl_BraceBadLight: { // wxStyledTextCtrl::BraceBadLight wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->BraceBadLight((int) *pos); + This->BraceBadLight(*pos); break; } case wxStyledTextCtrl_BraceMatch: { // wxStyledTextCtrl::BraceMatch wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->BraceMatch((int) *pos); + int Result = This->BraceMatch(*pos); rt.addInt(Result); break; } @@ -29337,14 +29378,14 @@ case wxStyledTextCtrl_SetViewEOL: { // wxStyledTextCtrl::SetViewEOL wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * visible = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetViewEOL((bool) *visible); + This->SetViewEOL(*visible); break; } case wxStyledTextCtrl_SetModEventMask: { // wxStyledTextCtrl::SetModEventMask wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * mask = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetModEventMask((int) *mask); + This->SetModEventMask(*mask); break; } case wxStyledTextCtrl_GetEdgeColumn: { // wxStyledTextCtrl::GetEdgeColumn @@ -29358,14 +29399,14 @@ case wxStyledTextCtrl_SetEdgeColumn: { // wxStyledTextCtrl::SetEdgeColumn wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * column = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetEdgeColumn((int) *column); + This->SetEdgeColumn(*column); break; } case wxStyledTextCtrl_SetEdgeMode: { // wxStyledTextCtrl::SetEdgeMode wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * mode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetEdgeMode((int) *mode); + This->SetEdgeMode(*mode); break; } case wxStyledTextCtrl_GetEdgeMode: { // wxStyledTextCtrl::GetEdgeMode @@ -29406,7 +29447,7 @@ case wxStyledTextCtrl_SearchNext: { // wxStyledTextCtrl::SearchNext wxString text = wxString(bp, wxConvUTF8); bp += *textLen+((8-((4+ *textLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - int Result = This->SearchNext((int) *flags,text); + int Result = This->SearchNext(*flags,text); rt.addInt(Result); break; } @@ -29417,7 +29458,7 @@ case wxStyledTextCtrl_SearchPrev: { // wxStyledTextCtrl::SearchPrev wxString text = wxString(bp, wxConvUTF8); bp += *textLen+((8-((4+ *textLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - int Result = This->SearchPrev((int) *flags,text); + int Result = This->SearchPrev(*flags,text); rt.addInt(Result); break; } @@ -29432,7 +29473,7 @@ case wxStyledTextCtrl_UsePopUp: { // wxStyledTextCtrl::UsePopUp wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * allowPopUp = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->UsePopUp((bool) *allowPopUp); + This->UsePopUp(*allowPopUp); break; } case wxStyledTextCtrl_SelectionIsRectangle: { // wxStyledTextCtrl::SelectionIsRectangle @@ -29446,7 +29487,7 @@ case wxStyledTextCtrl_SetZoom: { // wxStyledTextCtrl::SetZoom wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * zoom = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetZoom((int) *zoom); + This->SetZoom(*zoom); break; } case wxStyledTextCtrl_GetZoom: { // wxStyledTextCtrl::GetZoom @@ -29467,7 +29508,7 @@ case wxStyledTextCtrl_SetSTCFocus: { // wxStyledTextCtrl::SetSTCFocus wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * focus = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSTCFocus((bool) *focus); + This->SetSTCFocus(*focus); break; } case wxStyledTextCtrl_GetSTCFocus: { // wxStyledTextCtrl::GetSTCFocus @@ -29481,7 +29522,7 @@ case wxStyledTextCtrl_SetStatus: { // wxStyledTextCtrl::SetStatus wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * statusCode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetStatus((int) *statusCode); + This->SetStatus(*statusCode); break; } case wxStyledTextCtrl_GetStatus: { // wxStyledTextCtrl::GetStatus @@ -29495,7 +29536,7 @@ case wxStyledTextCtrl_SetMouseDownCaptures: { // wxStyledTextCtrl::SetMouseDownC wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * captures = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMouseDownCaptures((bool) *captures); + This->SetMouseDownCaptures(*captures); break; } case wxStyledTextCtrl_GetMouseDownCaptures: { // wxStyledTextCtrl::GetMouseDownCaptures @@ -29509,7 +29550,7 @@ case wxStyledTextCtrl_SetSTCCursor: { // wxStyledTextCtrl::SetSTCCursor wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * cursorType = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSTCCursor((int) *cursorType); + This->SetSTCCursor(*cursorType); break; } case wxStyledTextCtrl_GetSTCCursor: { // wxStyledTextCtrl::GetSTCCursor @@ -29523,7 +29564,7 @@ case wxStyledTextCtrl_SetControlCharSymbol: { // wxStyledTextCtrl::SetControlCha wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * symbol = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetControlCharSymbol((int) *symbol); + This->SetControlCharSymbol(*symbol); break; } case wxStyledTextCtrl_GetControlCharSymbol: { // wxStyledTextCtrl::GetControlCharSymbol @@ -29562,7 +29603,7 @@ case wxStyledTextCtrl_SetVisiblePolicy: { // wxStyledTextCtrl::SetVisiblePolicy int * visiblePolicy = (int *) bp; bp += 4; int * visibleSlop = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetVisiblePolicy((int) *visiblePolicy,(int) *visibleSlop); + This->SetVisiblePolicy(*visiblePolicy,*visibleSlop); break; } case wxStyledTextCtrl_DelLineLeft: { // wxStyledTextCtrl::DelLineLeft @@ -29595,7 +29636,7 @@ case wxStyledTextCtrl_SetXCaretPolicy: { // wxStyledTextCtrl::SetXCaretPolicy int * caretPolicy = (int *) bp; bp += 4; int * caretSlop = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetXCaretPolicy((int) *caretPolicy,(int) *caretSlop); + This->SetXCaretPolicy(*caretPolicy,*caretSlop); break; } case wxStyledTextCtrl_SetYCaretPolicy: { // wxStyledTextCtrl::SetYCaretPolicy @@ -29603,7 +29644,7 @@ case wxStyledTextCtrl_SetYCaretPolicy: { // wxStyledTextCtrl::SetYCaretPolicy int * caretPolicy = (int *) bp; bp += 4; int * caretSlop = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetYCaretPolicy((int) *caretPolicy,(int) *caretSlop); + This->SetYCaretPolicy(*caretPolicy,*caretSlop); break; } case wxStyledTextCtrl_GetPrintWrapMode: { // wxStyledTextCtrl::GetPrintWrapMode @@ -29622,7 +29663,7 @@ case wxStyledTextCtrl_SetHotspotActiveForeground: { // wxStyledTextCtrl::SetHots int * foreA = (int *) bp; bp += 4; wxColour fore = wxColour(*foreR,*foreG,*foreB,*foreA); if(!This) throw wxe_badarg(0); - This->SetHotspotActiveForeground((bool) *useSetting,fore); + This->SetHotspotActiveForeground(*useSetting,fore); break; } case wxStyledTextCtrl_SetHotspotActiveBackground: { // wxStyledTextCtrl::SetHotspotActiveBackground @@ -29634,21 +29675,21 @@ case wxStyledTextCtrl_SetHotspotActiveBackground: { // wxStyledTextCtrl::SetHots int * backA = (int *) bp; bp += 4; wxColour back = wxColour(*backR,*backG,*backB,*backA); if(!This) throw wxe_badarg(0); - This->SetHotspotActiveBackground((bool) *useSetting,back); + This->SetHotspotActiveBackground(*useSetting,back); break; } case wxStyledTextCtrl_SetHotspotActiveUnderline: { // wxStyledTextCtrl::SetHotspotActiveUnderline wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * underline = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetHotspotActiveUnderline((bool) *underline); + This->SetHotspotActiveUnderline(*underline); break; } case wxStyledTextCtrl_SetHotspotSingleLine: { // wxStyledTextCtrl::SetHotspotSingleLine wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * singleLine = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetHotspotSingleLine((bool) *singleLine); + This->SetHotspotSingleLine(*singleLine); break; } case wxStyledTextCtrl_ParaDownExtend: { // wxStyledTextCtrl::ParaDownExtend @@ -29673,7 +29714,7 @@ case wxStyledTextCtrl_PositionBefore: { // wxStyledTextCtrl::PositionBefore wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->PositionBefore((int) *pos); + int Result = This->PositionBefore(*pos); rt.addInt(Result); break; } @@ -29681,7 +29722,7 @@ case wxStyledTextCtrl_PositionAfter: { // wxStyledTextCtrl::PositionAfter wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->PositionAfter((int) *pos); + int Result = This->PositionAfter(*pos); rt.addInt(Result); break; } @@ -29690,7 +29731,7 @@ case wxStyledTextCtrl_CopyRange: { // wxStyledTextCtrl::CopyRange int * start = (int *) bp; bp += 4; int * end = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->CopyRange((int) *start,(int) *end); + This->CopyRange(*start,*end); break; } case wxStyledTextCtrl_CopyText: { // wxStyledTextCtrl::CopyText @@ -29700,14 +29741,14 @@ case wxStyledTextCtrl_CopyText: { // wxStyledTextCtrl::CopyText wxString text = wxString(bp, wxConvUTF8); bp += *textLen+((8-((4+ *textLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->CopyText((int) *length,text); + This->CopyText(*length,text); break; } case wxStyledTextCtrl_SetSelectionMode: { // wxStyledTextCtrl::SetSelectionMode wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * mode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelectionMode((int) *mode); + This->SetSelectionMode(*mode); break; } case wxStyledTextCtrl_GetSelectionMode: { // wxStyledTextCtrl::GetSelectionMode @@ -29845,7 +29886,7 @@ case wxStyledTextCtrl_Allocate: { // wxStyledTextCtrl::Allocate wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * bytes = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Allocate((int) *bytes); + This->Allocate(*bytes); break; } case wxStyledTextCtrl_FindColumn: { // wxStyledTextCtrl::FindColumn @@ -29853,7 +29894,7 @@ case wxStyledTextCtrl_FindColumn: { // wxStyledTextCtrl::FindColumn int * line = (int *) bp; bp += 4; int * column = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - int Result = This->FindColumn((int) *line,(int) *column); + int Result = This->FindColumn(*line,*column); rt.addInt(Result); break; } @@ -29868,7 +29909,7 @@ case wxStyledTextCtrl_SetCaretSticky: { // wxStyledTextCtrl::SetCaretSticky wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * useCaretStickyBehaviour = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCaretSticky((bool) *useCaretStickyBehaviour); + This->SetCaretSticky(*useCaretStickyBehaviour); break; } case wxStyledTextCtrl_ToggleCaretSticky: { // wxStyledTextCtrl::ToggleCaretSticky @@ -29881,7 +29922,7 @@ case wxStyledTextCtrl_SetPasteConvertEndings: { // wxStyledTextCtrl::SetPasteCon wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * convert = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPasteConvertEndings((bool) *convert); + This->SetPasteConvertEndings(*convert); break; } case wxStyledTextCtrl_GetPasteConvertEndings: { // wxStyledTextCtrl::GetPasteConvertEndings @@ -29901,7 +29942,7 @@ case wxStyledTextCtrl_SetCaretLineBackAlpha: { // wxStyledTextCtrl::SetCaretLine wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * alpha = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCaretLineBackAlpha((int) *alpha); + This->SetCaretLineBackAlpha(*alpha); break; } case wxStyledTextCtrl_GetCaretLineBackAlpha: { // wxStyledTextCtrl::GetCaretLineBackAlpha @@ -29927,7 +29968,7 @@ case wxStyledTextCtrl_SetLexer: { // wxStyledTextCtrl::SetLexer wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * lexer = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetLexer((int) *lexer); + This->SetLexer(*lexer); break; } case wxStyledTextCtrl_GetLexer: { // wxStyledTextCtrl::GetLexer @@ -29942,7 +29983,7 @@ case wxStyledTextCtrl_Colourise: { // wxStyledTextCtrl::Colourise int * start = (int *) bp; bp += 4; int * end = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->Colourise((int) *start,(int) *end); + This->Colourise(*start,*end); break; } case wxStyledTextCtrl_SetProperty: { // wxStyledTextCtrl::SetProperty @@ -29964,7 +30005,7 @@ case wxStyledTextCtrl_SetKeyWords: { // wxStyledTextCtrl::SetKeyWords wxString keyWords = wxString(bp, wxConvUTF8); bp += *keyWordsLen+((8-((4+ *keyWordsLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->SetKeyWords((int) *keywordSet,keyWords); + This->SetKeyWords(*keywordSet,keyWords); break; } case wxStyledTextCtrl_SetLexerLanguage: { // wxStyledTextCtrl::SetLexerLanguage @@ -30007,7 +30048,7 @@ case wxStyledTextCtrl_StyleSetSpec: { // wxStyledTextCtrl::StyleSetSpec wxString spec = wxString(bp, wxConvUTF8); bp += *specLen+((8-((4+ *specLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - This->StyleSetSpec((int) *styleNum,spec); + This->StyleSetSpec(*styleNum,spec); break; } case wxStyledTextCtrl_StyleSetFont: { // wxStyledTextCtrl::StyleSetFont @@ -30015,7 +30056,7 @@ case wxStyledTextCtrl_StyleSetFont: { // wxStyledTextCtrl::StyleSetFont int * styleNum = (int *) bp; bp += 4; wxFont *font = (wxFont *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetFont((int) *styleNum,*font); + This->StyleSetFont(*styleNum,*font); break; } case wxStyledTextCtrl_StyleSetFontAttr: { // wxStyledTextCtrl::StyleSetFontAttr @@ -30036,7 +30077,7 @@ encoding = *(wxFontEncoding *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - This->StyleSetFontAttr((int) *styleNum,(int) *size,faceName,(bool) *bold,(bool) *italic,(bool) *underline,(wxFontEncoding) encoding); + This->StyleSetFontAttr(*styleNum,*size,faceName,*bold,*italic,*underline,encoding); break; } case wxStyledTextCtrl_StyleSetCharacterSet: { // wxStyledTextCtrl::StyleSetCharacterSet @@ -30044,7 +30085,7 @@ case wxStyledTextCtrl_StyleSetCharacterSet: { // wxStyledTextCtrl::StyleSetChara int * style = (int *) bp; bp += 4; int * characterSet = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->StyleSetCharacterSet((int) *style,(int) *characterSet); + This->StyleSetCharacterSet(*style,*characterSet); break; } case wxStyledTextCtrl_StyleSetFontEncoding: { // wxStyledTextCtrl::StyleSetFontEncoding @@ -30052,14 +30093,14 @@ case wxStyledTextCtrl_StyleSetFontEncoding: { // wxStyledTextCtrl::StyleSetFontE int * style = (int *) bp; bp += 4; wxFontEncoding encoding = *(wxFontEncoding *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->StyleSetFontEncoding((int) *style,(wxFontEncoding) encoding); + This->StyleSetFontEncoding(*style,encoding); break; } case wxStyledTextCtrl_CmdKeyExecute: { // wxStyledTextCtrl::CmdKeyExecute wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * cmd = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->CmdKeyExecute((int) *cmd); + This->CmdKeyExecute(*cmd); break; } case wxStyledTextCtrl_SetMargins: { // wxStyledTextCtrl::SetMargins @@ -30067,7 +30108,7 @@ case wxStyledTextCtrl_SetMargins: { // wxStyledTextCtrl::SetMargins int * left = (int *) bp; bp += 4; int * right = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMargins((int) *left,(int) *right); + This->SetMargins(*left,*right); break; } case wxStyledTextCtrl_GetSelection: { // wxStyledTextCtrl::GetSelection @@ -30085,7 +30126,7 @@ case wxStyledTextCtrl_PointFromPosition: { // wxStyledTextCtrl::PointFromPositio wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - wxPoint Result = This->PointFromPosition((int) *pos); + wxPoint Result = This->PointFromPosition(*pos); rt.add(Result); break; } @@ -30093,32 +30134,14 @@ case wxStyledTextCtrl_ScrollToLine: { // wxStyledTextCtrl::ScrollToLine wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ScrollToLine((int) *line); + This->ScrollToLine(*line); break; } case wxStyledTextCtrl_ScrollToColumn: { // wxStyledTextCtrl::ScrollToColumn wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * column = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->ScrollToColumn((int) *column); - break; -} -case wxStyledTextCtrl_SendMsg: { // wxStyledTextCtrl::SendMsg - long wp=0; - long lp=0; - wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; - int * msg = (int *) bp; bp += 4; - while( * (int*) bp) { switch (* (int*) bp) { - case 1: {bp += 4; - wp = (long)*(int *) bp; bp += 4; - } break; - case 2: {bp += 4; - lp = (long)*(int *) bp; bp += 4; - } break; - }}; - if(!This) throw wxe_badarg(0); - long Result = This->SendMsg((int) *msg,wp,lp); - rt.addInt(Result); + This->ScrollToColumn(*column); break; } case wxStyledTextCtrl_SetVScrollBar: { // wxStyledTextCtrl::SetVScrollBar @@ -30146,7 +30169,7 @@ case wxStyledTextCtrl_SetLastKeydownProcessed: { // wxStyledTextCtrl::SetLastKey wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; bool * val = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetLastKeydownProcessed((bool) *val); + This->SetLastKeydownProcessed(*val); break; } case wxStyledTextCtrl_SaveFile: { // wxStyledTextCtrl::SaveFile @@ -30175,7 +30198,7 @@ case wxStyledTextCtrl_DoDragOver: { // wxStyledTextCtrl::DoDragOver int * y = (int *) bp; bp += 4; wxDragResult def = *(wxDragResult *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - int Result = This->DoDragOver((wxCoord) *x,(wxCoord) *y,(wxDragResult) def); + int Result = This->DoDragOver(*x,*y,def); rt.addInt(Result); break; } @@ -30187,7 +30210,7 @@ case wxStyledTextCtrl_DoDropText: { // wxStyledTextCtrl::DoDropText wxString data = wxString(bp, wxConvUTF8); bp += *dataLen+((8-((0+ *dataLen) & 7)) & 7); if(!This) throw wxe_badarg(0); - bool Result = This->DoDropText((long) *x,(long) *y,data); + bool Result = This->DoDropText(*x,*y,data); rt.addBool(Result); break; } @@ -30210,7 +30233,7 @@ case wxStyledTextCtrl_InsertTextRaw: { // wxStyledTextCtrl::InsertTextRaw int * pos = (int *) bp; bp += 4; const char * text = (const char*) Ecmd.bin[0]->base; if(!This) throw wxe_badarg(0); - This->InsertTextRaw((int) *pos,text); + This->InsertTextRaw(*pos,text); break; } case wxStyledTextCtrl_GetCurLineRaw: { // wxStyledTextCtrl::GetCurLineRaw @@ -30229,7 +30252,7 @@ case wxStyledTextCtrl_GetLineRaw: { // wxStyledTextCtrl::GetLineRaw wxStyledTextCtrl *This = (wxStyledTextCtrl *) getPtr(bp,memenv); bp += 4; int * line = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - char * Result = This->GetLineRaw((int) *line).data(); + char * Result = This->GetLineRaw(*line).data(); if(Result) { rt.addBinary(Result, strlen(Result)); } else {rt.addAtom("null");}; @@ -30249,7 +30272,7 @@ case wxStyledTextCtrl_GetTextRangeRaw: { // wxStyledTextCtrl::GetTextRangeRaw int * startPos = (int *) bp; bp += 4; int * endPos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - char * Result = This->GetTextRangeRaw((int) *startPos,(int) *endPos).data(); + char * Result = This->GetTextRangeRaw(*startPos,*endPos).data(); if(Result) { rt.addBinary(Result, strlen(Result)); } else {rt.addAtom("null");}; @@ -30400,19 +30423,19 @@ case wxNotebookEvent_SetOldSelection: { // wxNotebookEvent::SetOldSelection wxNotebookEvent *This = (wxNotebookEvent *) getPtr(bp,memenv); bp += 4; int * nOldSel = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetOldSelection((int) *nOldSel); + This->SetOldSelection(*nOldSel); break; } case wxNotebookEvent_SetSelection: { // wxNotebookEvent::SetSelection wxNotebookEvent *This = (wxNotebookEvent *) getPtr(bp,memenv); bp += 4; int * nSel = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((int) *nSel); + This->SetSelection(*nSel); break; } case wxFileDataObject_new: { // wxFileDataObject::wxFileDataObject wxFileDataObject * Result = new wxFileDataObject(); - newPtr((void *) Result, 212, memenv); + newPtr((void *) Result, 211, memenv); rt.addRef(getRef((void *)Result,memenv), "wxFileDataObject"); break; } @@ -30448,7 +30471,7 @@ case wxTextDataObject_new: { // wxTextDataObject::wxTextDataObject } break; }}; wxTextDataObject * Result = new wxTextDataObject(text); - newPtr((void *) Result, 213, memenv); + newPtr((void *) Result, 212, memenv); rt.addRef(getRef((void *)Result,memenv), "wxTextDataObject"); break; } @@ -30484,7 +30507,7 @@ case wxTextDataObject_destroy: { // wxTextDataObject::destroy case wxBitmapDataObject_new_1_1: { // wxBitmapDataObject::wxBitmapDataObject wxBitmap *bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4; wxBitmapDataObject * Result = new wxBitmapDataObject(*bitmap); - newPtr((void *) Result, 214, memenv); + newPtr((void *) Result, 213, memenv); rt.addRef(getRef((void *)Result,memenv), "wxBitmapDataObject"); break; } @@ -30496,7 +30519,7 @@ bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4; } break; }}; wxBitmapDataObject * Result = new wxBitmapDataObject(*bitmap); - newPtr((void *) Result, 214, memenv); + newPtr((void *) Result, 213, memenv); rt.addRef(getRef((void *)Result,memenv), "wxBitmapDataObject"); break; } @@ -30598,9 +30621,9 @@ case wxClipboard_UsePrimarySelection: { // wxClipboard::UsePrimarySelection } case wxClipboard_IsSupported: { // wxClipboard::IsSupported wxClipboard *This = (wxClipboard *) getPtr(bp,memenv); bp += 4; - const int * format = (const int *) bp; bp += 4; + wxDataFormatId format = *(wxDataFormatId *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - bool Result = This->IsSupported((wxDataFormatId) *format); + bool Result = This->IsSupported(format); rt.addBool(Result); break; } @@ -30620,7 +30643,7 @@ case wxSpinEvent_SetPosition: { // wxSpinEvent::SetPosition wxSpinEvent *This = (wxSpinEvent *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetPosition((int) *pos); + This->SetPosition(*pos); break; } case wxSplitterWindow_new_0: { // wxSplitterWindow::wxSplitterWindow @@ -30763,7 +30786,7 @@ case wxSplitterWindow_SetSashGravity: { // wxSplitterWindow::SetSashGravity bp += 4; /* Align */ double * gravity = (double *) bp; bp += 8; if(!This) throw wxe_badarg(0); - This->SetSashGravity((double) *gravity); + This->SetSashGravity(*gravity); break; } case wxSplitterWindow_SetSashPosition: { // wxSplitterWindow::SetSashPosition @@ -30776,28 +30799,28 @@ case wxSplitterWindow_SetSashPosition: { // wxSplitterWindow::SetSashPosition } break; }}; if(!This) throw wxe_badarg(0); - This->SetSashPosition((int) *position,redraw); + This->SetSashPosition(*position,redraw); break; } case wxSplitterWindow_SetSashSize: { // wxSplitterWindow::SetSashSize wxSplitterWindow *This = (wxSplitterWindow *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSashSize((int) *width); + This->SetSashSize(*width); break; } case wxSplitterWindow_SetMinimumPaneSize: { // wxSplitterWindow::SetMinimumPaneSize wxSplitterWindow *This = (wxSplitterWindow *) getPtr(bp,memenv); bp += 4; int * min = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetMinimumPaneSize((int) *min); + This->SetMinimumPaneSize(*min); break; } case wxSplitterWindow_SetSplitMode: { // wxSplitterWindow::SetSplitMode wxSplitterWindow *This = (wxSplitterWindow *) getPtr(bp,memenv); bp += 4; int * mode = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSplitMode((int) *mode); + This->SetSplitMode(*mode); break; } case wxSplitterWindow_SplitHorizontally: { // wxSplitterWindow::SplitHorizontally @@ -30884,7 +30907,7 @@ case wxSplitterEvent_SetSashPosition: { // wxSplitterEvent::SetSashPosition wxSplitterEvent *This = (wxSplitterEvent *) getPtr(bp,memenv); bp += 4; int * pos = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSashPosition((int) *pos); + This->SetSashPosition(*pos); break; } case wxHtmlWindow_new_0: { // wxHtmlWindow::wxHtmlWindow @@ -31053,7 +31076,7 @@ case wxHtmlWindow_SetBorders: { // wxHtmlWindow::SetBorders wxHtmlWindow *This = (wxHtmlWindow *) getPtr(bp,memenv); bp += 4; int * b = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetBorders((int) *b); + This->SetBorders(*b); break; } case wxHtmlWindow_SetFonts: { // wxHtmlWindow::SetFonts @@ -31098,7 +31121,7 @@ case wxHtmlWindow_SetRelatedStatusBar: { // wxHtmlWindow::SetRelatedStatusBar wxHtmlWindow *This = (wxHtmlWindow *) getPtr(bp,memenv); bp += 4; int * bar = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetRelatedStatusBar((int) *bar); + This->SetRelatedStatusBar(*bar); break; } case wxHtmlWindow_ToText: { // wxHtmlWindow::ToText @@ -31117,13 +31140,13 @@ case wxHtmlLinkEvent_GetLinkInfo: { // wxHtmlLinkEvent::GetLinkInfo } case wxSystemSettings_GetColour: { // wxSystemSettings::GetColour wxSystemColour index = *(wxSystemColour *) bp; bp += 4;; - wxColour Result = wxSystemSettings::GetColour((wxSystemColour) index); + wxColour Result = wxSystemSettings::GetColour(index); rt.add(Result); break; } case wxSystemSettings_GetFont: { // wxSystemSettings::GetFont wxSystemFont index = *(wxSystemFont *) bp; bp += 4;; - wxFont * Result = new wxFont(wxSystemSettings::GetFont((wxSystemFont) index)); newPtr((void *) Result,3, memenv);; + wxFont * Result = new wxFont(wxSystemSettings::GetFont(index)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxFont"); break; } @@ -31136,7 +31159,7 @@ case wxSystemSettings_GetMetric: { // wxSystemSettings::GetMetric win = (wxWindow *) getPtr(bp,memenv); bp += 4; } break; }}; - int Result = wxSystemSettings::GetMetric((wxSystemMetric) index,win); + int Result = wxSystemSettings::GetMetric(index,win); rt.addInt(Result); break; } @@ -31192,14 +31215,14 @@ case wxSystemOptions_SetOption_2_0: { // wxSystemOptions::SetOption wxString name = wxString(bp, wxConvUTF8); bp += *nameLen+((8-((4+ *nameLen) & 7)) & 7); int * value = (int *) bp; bp += 4; - wxSystemOptions::SetOption(name,(int) *value); + wxSystemOptions::SetOption(name,*value); break; } case wxAuiNotebookEvent_SetSelection: { // wxAuiNotebookEvent::SetSelection wxAuiNotebookEvent *This = (wxAuiNotebookEvent *) getPtr(bp,memenv); bp += 4; int * s = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetSelection((int) *s); + This->SetSelection(*s); break; } case wxAuiNotebookEvent_GetSelection: { // wxAuiNotebookEvent::GetSelection @@ -31213,7 +31236,7 @@ case wxAuiNotebookEvent_SetOldSelection: { // wxAuiNotebookEvent::SetOldSelectio wxAuiNotebookEvent *This = (wxAuiNotebookEvent *) getPtr(bp,memenv); bp += 4; int * s = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetOldSelection((int) *s); + This->SetOldSelection(*s); break; } case wxAuiNotebookEvent_GetOldSelection: { // wxAuiNotebookEvent::GetOldSelection @@ -31269,7 +31292,7 @@ case wxAuiManagerEvent_SetButton: { // wxAuiManagerEvent::SetButton wxAuiManagerEvent *This = (wxAuiManagerEvent *) getPtr(bp,memenv); bp += 4; int * b = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetButton((int) *b); + This->SetButton(*b); break; } case wxAuiManagerEvent_GetButton: { // wxAuiManagerEvent::GetButton @@ -31317,7 +31340,7 @@ case wxAuiManagerEvent_SetCanVeto: { // wxAuiManagerEvent::SetCanVeto wxAuiManagerEvent *This = (wxAuiManagerEvent *) getPtr(bp,memenv); bp += 4; bool * can_veto = (bool *) bp; bp += 4; if(!This) throw wxe_badarg(0); - This->SetCanVeto((bool) *can_veto); + This->SetCanVeto(*can_veto); break; } case wxAuiManagerEvent_CanVeto: { // wxAuiManagerEvent::CanVeto @@ -31329,7 +31352,7 @@ case wxAuiManagerEvent_CanVeto: { // wxAuiManagerEvent::CanVeto } case wxLogNull_new: { // wxLogNull::wxLogNull wxLogNull * Result = new wxLogNull(); - newPtr((void *) Result, 225, memenv); + newPtr((void *) Result, 224, memenv); rt.addRef(getRef((void *)Result,memenv), "wxLogNull"); break; } @@ -31416,10 +31439,10 @@ void WxeApp::delete_object(void *ptr, wxeRefData *refd) { case 101: delete (wxListItemAttr *) ptr; break; case 103: delete (wxTextAttr *) ptr; break; case 155: delete (wxAuiPaneInfo *) ptr; break; - case 212: /* delete (wxFileDataObject *) ptr;These objects must be deleted by owner object */ break; - case 213: /* delete (wxTextDataObject *) ptr;These objects must be deleted by owner object */ break; - case 214: /* delete (wxBitmapDataObject *) ptr;These objects must be deleted by owner object */ break; - case 225: delete (wxLogNull *) ptr; break; + case 211: /* delete (wxFileDataObject *) ptr;These objects must be deleted by owner object */ break; + case 212: /* delete (wxTextDataObject *) ptr;These objects must be deleted by owner object */ break; + case 213: /* delete (wxBitmapDataObject *) ptr;These objects must be deleted by owner object */ break; + case 224: delete (wxLogNull *) ptr; break; default: delete (wxObject *) ptr; }} diff --git a/lib/wx/c_src/gen/wxe_macros.h b/lib/wx/c_src/gen/wxe_macros.h index b24becae06..4b87c2340e 100644 --- a/lib/wx/c_src/gen/wxe_macros.h +++ b/lib/wx/c_src/gen/wxe_macros.h @@ -3201,155 +3201,154 @@ #define wxStyledTextCtrl_PointFromPosition 3370 #define wxStyledTextCtrl_ScrollToLine 3371 #define wxStyledTextCtrl_ScrollToColumn 3372 -#define wxStyledTextCtrl_SendMsg 3373 -#define wxStyledTextCtrl_SetVScrollBar 3374 -#define wxStyledTextCtrl_SetHScrollBar 3375 -#define wxStyledTextCtrl_GetLastKeydownProcessed 3376 -#define wxStyledTextCtrl_SetLastKeydownProcessed 3377 -#define wxStyledTextCtrl_SaveFile 3378 -#define wxStyledTextCtrl_LoadFile 3379 -#define wxStyledTextCtrl_DoDragOver 3380 -#define wxStyledTextCtrl_DoDropText 3381 -#define wxStyledTextCtrl_GetUseAntiAliasing 3382 -#define wxStyledTextCtrl_AddTextRaw 3383 -#define wxStyledTextCtrl_InsertTextRaw 3384 -#define wxStyledTextCtrl_GetCurLineRaw 3385 -#define wxStyledTextCtrl_GetLineRaw 3386 -#define wxStyledTextCtrl_GetSelectedTextRaw 3387 -#define wxStyledTextCtrl_GetTextRangeRaw 3388 -#define wxStyledTextCtrl_SetTextRaw 3389 -#define wxStyledTextCtrl_GetTextRaw 3390 -#define wxStyledTextCtrl_AppendTextRaw 3391 -#define wxArtProvider_GetBitmap 3392 -#define wxArtProvider_GetIcon 3393 -#define wxTreeEvent_GetKeyCode 3394 -#define wxTreeEvent_GetItem 3395 -#define wxTreeEvent_GetKeyEvent 3396 -#define wxTreeEvent_GetLabel 3397 -#define wxTreeEvent_GetOldItem 3398 -#define wxTreeEvent_GetPoint 3399 -#define wxTreeEvent_IsEditCancelled 3400 -#define wxTreeEvent_SetToolTip 3401 -#define wxNotebookEvent_GetOldSelection 3402 -#define wxNotebookEvent_GetSelection 3403 -#define wxNotebookEvent_SetOldSelection 3404 -#define wxNotebookEvent_SetSelection 3405 -#define wxFileDataObject_new 3406 -#define wxFileDataObject_AddFile 3407 -#define wxFileDataObject_GetFilenames 3408 -#define wxFileDataObject_destroy 3409 -#define wxTextDataObject_new 3410 -#define wxTextDataObject_GetTextLength 3411 -#define wxTextDataObject_GetText 3412 -#define wxTextDataObject_SetText 3413 -#define wxTextDataObject_destroy 3414 -#define wxBitmapDataObject_new_1_1 3415 -#define wxBitmapDataObject_new_1_0 3416 -#define wxBitmapDataObject_GetBitmap 3417 -#define wxBitmapDataObject_SetBitmap 3418 -#define wxBitmapDataObject_destroy 3419 -#define wxClipboard_new 3421 -#define wxClipboard_destruct 3422 -#define wxClipboard_AddData 3423 -#define wxClipboard_Clear 3424 -#define wxClipboard_Close 3425 -#define wxClipboard_Flush 3426 -#define wxClipboard_GetData 3427 -#define wxClipboard_IsOpened 3428 -#define wxClipboard_Open 3429 -#define wxClipboard_SetData 3430 -#define wxClipboard_UsePrimarySelection 3432 -#define wxClipboard_IsSupported 3433 -#define wxClipboard_Get 3434 -#define wxSpinEvent_GetPosition 3435 -#define wxSpinEvent_SetPosition 3436 -#define wxSplitterWindow_new_0 3437 -#define wxSplitterWindow_new_2 3438 -#define wxSplitterWindow_destruct 3439 -#define wxSplitterWindow_Create 3440 -#define wxSplitterWindow_GetMinimumPaneSize 3441 -#define wxSplitterWindow_GetSashGravity 3442 -#define wxSplitterWindow_GetSashPosition 3443 -#define wxSplitterWindow_GetSplitMode 3444 -#define wxSplitterWindow_GetWindow1 3445 -#define wxSplitterWindow_GetWindow2 3446 -#define wxSplitterWindow_Initialize 3447 -#define wxSplitterWindow_IsSplit 3448 -#define wxSplitterWindow_ReplaceWindow 3449 -#define wxSplitterWindow_SetSashGravity 3450 -#define wxSplitterWindow_SetSashPosition 3451 -#define wxSplitterWindow_SetSashSize 3452 -#define wxSplitterWindow_SetMinimumPaneSize 3453 -#define wxSplitterWindow_SetSplitMode 3454 -#define wxSplitterWindow_SplitHorizontally 3455 -#define wxSplitterWindow_SplitVertically 3456 -#define wxSplitterWindow_Unsplit 3457 -#define wxSplitterWindow_UpdateSize 3458 -#define wxSplitterEvent_GetSashPosition 3459 -#define wxSplitterEvent_GetX 3460 -#define wxSplitterEvent_GetY 3461 -#define wxSplitterEvent_GetWindowBeingRemoved 3462 -#define wxSplitterEvent_SetSashPosition 3463 -#define wxHtmlWindow_new_0 3464 -#define wxHtmlWindow_new_2 3465 -#define wxHtmlWindow_AppendToPage 3466 -#define wxHtmlWindow_GetOpenedAnchor 3467 -#define wxHtmlWindow_GetOpenedPage 3468 -#define wxHtmlWindow_GetOpenedPageTitle 3469 -#define wxHtmlWindow_GetRelatedFrame 3470 -#define wxHtmlWindow_HistoryBack 3471 -#define wxHtmlWindow_HistoryCanBack 3472 -#define wxHtmlWindow_HistoryCanForward 3473 -#define wxHtmlWindow_HistoryClear 3474 -#define wxHtmlWindow_HistoryForward 3475 -#define wxHtmlWindow_LoadFile 3476 -#define wxHtmlWindow_LoadPage 3477 -#define wxHtmlWindow_SelectAll 3478 -#define wxHtmlWindow_SelectionToText 3479 -#define wxHtmlWindow_SelectLine 3480 -#define wxHtmlWindow_SelectWord 3481 -#define wxHtmlWindow_SetBorders 3482 -#define wxHtmlWindow_SetFonts 3483 -#define wxHtmlWindow_SetPage 3484 -#define wxHtmlWindow_SetRelatedFrame 3485 -#define wxHtmlWindow_SetRelatedStatusBar 3486 -#define wxHtmlWindow_ToText 3487 -#define wxHtmlWindow_destroy 3488 -#define wxHtmlLinkEvent_GetLinkInfo 3489 -#define wxSystemSettings_GetColour 3490 -#define wxSystemSettings_GetFont 3491 -#define wxSystemSettings_GetMetric 3492 -#define wxSystemSettings_GetScreenType 3493 -#define wxSystemOptions_GetOption 3494 -#define wxSystemOptions_GetOptionInt 3495 -#define wxSystemOptions_HasOption 3496 -#define wxSystemOptions_IsFalse 3497 -#define wxSystemOptions_SetOption_2_1 3498 -#define wxSystemOptions_SetOption_2_0 3499 -#define wxAuiNotebookEvent_SetSelection 3500 -#define wxAuiNotebookEvent_GetSelection 3501 -#define wxAuiNotebookEvent_SetOldSelection 3502 -#define wxAuiNotebookEvent_GetOldSelection 3503 -#define wxAuiNotebookEvent_SetDragSource 3504 -#define wxAuiNotebookEvent_GetDragSource 3505 -#define wxAuiManagerEvent_SetManager 3506 -#define wxAuiManagerEvent_GetManager 3507 -#define wxAuiManagerEvent_SetPane 3508 -#define wxAuiManagerEvent_GetPane 3509 -#define wxAuiManagerEvent_SetButton 3510 -#define wxAuiManagerEvent_GetButton 3511 -#define wxAuiManagerEvent_SetDC 3512 -#define wxAuiManagerEvent_GetDC 3513 -#define wxAuiManagerEvent_Veto 3514 -#define wxAuiManagerEvent_GetVeto 3515 -#define wxAuiManagerEvent_SetCanVeto 3516 -#define wxAuiManagerEvent_CanVeto 3517 -#define wxLogNull_new 3518 -#define wxLogNull_destroy 3519 -#define wxTaskBarIcon_new 3520 -#define wxTaskBarIcon_destruct 3521 -#define wxTaskBarIcon_PopupMenu 3522 -#define wxTaskBarIcon_RemoveIcon 3523 -#define wxTaskBarIcon_SetIcon 3524 +#define wxStyledTextCtrl_SetVScrollBar 3373 +#define wxStyledTextCtrl_SetHScrollBar 3374 +#define wxStyledTextCtrl_GetLastKeydownProcessed 3375 +#define wxStyledTextCtrl_SetLastKeydownProcessed 3376 +#define wxStyledTextCtrl_SaveFile 3377 +#define wxStyledTextCtrl_LoadFile 3378 +#define wxStyledTextCtrl_DoDragOver 3379 +#define wxStyledTextCtrl_DoDropText 3380 +#define wxStyledTextCtrl_GetUseAntiAliasing 3381 +#define wxStyledTextCtrl_AddTextRaw 3382 +#define wxStyledTextCtrl_InsertTextRaw 3383 +#define wxStyledTextCtrl_GetCurLineRaw 3384 +#define wxStyledTextCtrl_GetLineRaw 3385 +#define wxStyledTextCtrl_GetSelectedTextRaw 3386 +#define wxStyledTextCtrl_GetTextRangeRaw 3387 +#define wxStyledTextCtrl_SetTextRaw 3388 +#define wxStyledTextCtrl_GetTextRaw 3389 +#define wxStyledTextCtrl_AppendTextRaw 3390 +#define wxArtProvider_GetBitmap 3391 +#define wxArtProvider_GetIcon 3392 +#define wxTreeEvent_GetKeyCode 3393 +#define wxTreeEvent_GetItem 3394 +#define wxTreeEvent_GetKeyEvent 3395 +#define wxTreeEvent_GetLabel 3396 +#define wxTreeEvent_GetOldItem 3397 +#define wxTreeEvent_GetPoint 3398 +#define wxTreeEvent_IsEditCancelled 3399 +#define wxTreeEvent_SetToolTip 3400 +#define wxNotebookEvent_GetOldSelection 3401 +#define wxNotebookEvent_GetSelection 3402 +#define wxNotebookEvent_SetOldSelection 3403 +#define wxNotebookEvent_SetSelection 3404 +#define wxFileDataObject_new 3405 +#define wxFileDataObject_AddFile 3406 +#define wxFileDataObject_GetFilenames 3407 +#define wxFileDataObject_destroy 3408 +#define wxTextDataObject_new 3409 +#define wxTextDataObject_GetTextLength 3410 +#define wxTextDataObject_GetText 3411 +#define wxTextDataObject_SetText 3412 +#define wxTextDataObject_destroy 3413 +#define wxBitmapDataObject_new_1_1 3414 +#define wxBitmapDataObject_new_1_0 3415 +#define wxBitmapDataObject_GetBitmap 3416 +#define wxBitmapDataObject_SetBitmap 3417 +#define wxBitmapDataObject_destroy 3418 +#define wxClipboard_new 3420 +#define wxClipboard_destruct 3421 +#define wxClipboard_AddData 3422 +#define wxClipboard_Clear 3423 +#define wxClipboard_Close 3424 +#define wxClipboard_Flush 3425 +#define wxClipboard_GetData 3426 +#define wxClipboard_IsOpened 3427 +#define wxClipboard_Open 3428 +#define wxClipboard_SetData 3429 +#define wxClipboard_UsePrimarySelection 3431 +#define wxClipboard_IsSupported 3432 +#define wxClipboard_Get 3433 +#define wxSpinEvent_GetPosition 3434 +#define wxSpinEvent_SetPosition 3435 +#define wxSplitterWindow_new_0 3436 +#define wxSplitterWindow_new_2 3437 +#define wxSplitterWindow_destruct 3438 +#define wxSplitterWindow_Create 3439 +#define wxSplitterWindow_GetMinimumPaneSize 3440 +#define wxSplitterWindow_GetSashGravity 3441 +#define wxSplitterWindow_GetSashPosition 3442 +#define wxSplitterWindow_GetSplitMode 3443 +#define wxSplitterWindow_GetWindow1 3444 +#define wxSplitterWindow_GetWindow2 3445 +#define wxSplitterWindow_Initialize 3446 +#define wxSplitterWindow_IsSplit 3447 +#define wxSplitterWindow_ReplaceWindow 3448 +#define wxSplitterWindow_SetSashGravity 3449 +#define wxSplitterWindow_SetSashPosition 3450 +#define wxSplitterWindow_SetSashSize 3451 +#define wxSplitterWindow_SetMinimumPaneSize 3452 +#define wxSplitterWindow_SetSplitMode 3453 +#define wxSplitterWindow_SplitHorizontally 3454 +#define wxSplitterWindow_SplitVertically 3455 +#define wxSplitterWindow_Unsplit 3456 +#define wxSplitterWindow_UpdateSize 3457 +#define wxSplitterEvent_GetSashPosition 3458 +#define wxSplitterEvent_GetX 3459 +#define wxSplitterEvent_GetY 3460 +#define wxSplitterEvent_GetWindowBeingRemoved 3461 +#define wxSplitterEvent_SetSashPosition 3462 +#define wxHtmlWindow_new_0 3463 +#define wxHtmlWindow_new_2 3464 +#define wxHtmlWindow_AppendToPage 3465 +#define wxHtmlWindow_GetOpenedAnchor 3466 +#define wxHtmlWindow_GetOpenedPage 3467 +#define wxHtmlWindow_GetOpenedPageTitle 3468 +#define wxHtmlWindow_GetRelatedFrame 3469 +#define wxHtmlWindow_HistoryBack 3470 +#define wxHtmlWindow_HistoryCanBack 3471 +#define wxHtmlWindow_HistoryCanForward 3472 +#define wxHtmlWindow_HistoryClear 3473 +#define wxHtmlWindow_HistoryForward 3474 +#define wxHtmlWindow_LoadFile 3475 +#define wxHtmlWindow_LoadPage 3476 +#define wxHtmlWindow_SelectAll 3477 +#define wxHtmlWindow_SelectionToText 3478 +#define wxHtmlWindow_SelectLine 3479 +#define wxHtmlWindow_SelectWord 3480 +#define wxHtmlWindow_SetBorders 3481 +#define wxHtmlWindow_SetFonts 3482 +#define wxHtmlWindow_SetPage 3483 +#define wxHtmlWindow_SetRelatedFrame 3484 +#define wxHtmlWindow_SetRelatedStatusBar 3485 +#define wxHtmlWindow_ToText 3486 +#define wxHtmlWindow_destroy 3487 +#define wxHtmlLinkEvent_GetLinkInfo 3488 +#define wxSystemSettings_GetColour 3489 +#define wxSystemSettings_GetFont 3490 +#define wxSystemSettings_GetMetric 3491 +#define wxSystemSettings_GetScreenType 3492 +#define wxSystemOptions_GetOption 3493 +#define wxSystemOptions_GetOptionInt 3494 +#define wxSystemOptions_HasOption 3495 +#define wxSystemOptions_IsFalse 3496 +#define wxSystemOptions_SetOption_2_1 3497 +#define wxSystemOptions_SetOption_2_0 3498 +#define wxAuiNotebookEvent_SetSelection 3499 +#define wxAuiNotebookEvent_GetSelection 3500 +#define wxAuiNotebookEvent_SetOldSelection 3501 +#define wxAuiNotebookEvent_GetOldSelection 3502 +#define wxAuiNotebookEvent_SetDragSource 3503 +#define wxAuiNotebookEvent_GetDragSource 3504 +#define wxAuiManagerEvent_SetManager 3505 +#define wxAuiManagerEvent_GetManager 3506 +#define wxAuiManagerEvent_SetPane 3507 +#define wxAuiManagerEvent_GetPane 3508 +#define wxAuiManagerEvent_SetButton 3509 +#define wxAuiManagerEvent_GetButton 3510 +#define wxAuiManagerEvent_SetDC 3511 +#define wxAuiManagerEvent_GetDC 3512 +#define wxAuiManagerEvent_Veto 3513 +#define wxAuiManagerEvent_GetVeto 3514 +#define wxAuiManagerEvent_SetCanVeto 3515 +#define wxAuiManagerEvent_CanVeto 3516 +#define wxLogNull_new 3517 +#define wxLogNull_destroy 3518 +#define wxTaskBarIcon_new 3519 +#define wxTaskBarIcon_destruct 3520 +#define wxTaskBarIcon_PopupMenu 3521 +#define wxTaskBarIcon_RemoveIcon 3522 +#define wxTaskBarIcon_SetIcon 3523 diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp index 69fcd4e362..527fabc315 100644 --- a/lib/wx/c_src/wxe_impl.cpp +++ b/lib/wx/c_src/wxe_impl.cpp @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2008-2011. All Rights Reserved. + * Copyright Ericsson AB 2008-2012. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -30,6 +30,11 @@ // Ok ugly but needed for wxBufferedDC crash workaround #define private public #include <wx/dcbuffer.h> + +#if defined(__WXMSW__) + #include <wx/msw/private.h> // for wxSetInstance +#endif + #undef private #include "wxe_impl.h" @@ -222,6 +227,11 @@ void *wxe_main_loop(void *vpdl) // This should be done in emulator but it's not in yet. #ifndef _WIN32 erts_thread_disable_fpe(); +#else + // Setup that wxWidgets should look for cursors and icons in + // this dll and not in werl.exe (which is the default) + HMODULE WXEHandle = GetModuleHandle(_T("wxe_driver")); + wxSetInstance((HINSTANCE) WXEHandle); #endif result = wxEntry(argc, argv); @@ -248,20 +258,30 @@ wxFrame * dummy_window; void create_dummy_window() { dummy_window = new wxFrame(NULL,-1, wxT("wx driver"), - wxDefaultPosition, wxSize(5,5), + wxPoint(0,0), wxSize(5,5), wxFRAME_NO_TASKBAR); + + wxMenuBar * menubar = new wxMenuBar(); + dummy_window->SetMenuBar(menubar); + // wx-2.9 Don't delete the app menubar correctly dummy_window->Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, (wxObjectEventFunction) (wxEventFunction) &WxeApp::dummy_close); + dummy_window->Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, + (wxObjectEventFunction) (wxEventFunction) &WxeApp::dummy_close); + dummy_window->Show(true); + // dummy_window->Show(false); } // wxMac really wants a top level window which command-q quits if there are no // windows open, and this will kill the thread, so restart the dummy_window each // time a we receive a close. void WxeApp::dummy_close(wxEvent& Ev) { - // fprintf(stderr, "Tried to close dummy window\r\n"); fflush(stderr); - create_dummy_window(); + if(Ev.GetEventType() == wxEVT_CLOSE_WINDOW) { + create_dummy_window(); + } } + // Init wx-widgets thread bool WxeApp::OnInit() { @@ -272,7 +292,7 @@ bool WxeApp::OnInit() wxe_batch_cb_saved = new wxList; cb_buff = NULL; - wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED); + // wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED); Hmm printpreview doesn't work in 2.9 with this this->Connect(wxID_ANY, wxEVT_IDLE, (wxObjectEventFunction) (wxEventFunction) &WxeApp::idle); @@ -290,7 +310,11 @@ bool WxeApp::OnInit() /* Create a dummy window so wxWidgets don't automagicly quits the main loop after the last window */ +#ifdef __DARWIN__ create_dummy_window(); +#else + SetExitOnFrameDelete(false); +#endif init_nonconsts(global_me, init_caller); erl_drv_mutex_lock(wxe_status_m); @@ -301,7 +325,9 @@ bool WxeApp::OnInit() } void WxeApp::shutdown(wxeMetaCommand& Ecmd) { +#ifdef __DARWIN__ delete dummy_window; +#endif ExitMainLoop(); } diff --git a/lib/wx/c_src/wxe_ps_init.c b/lib/wx/c_src/wxe_ps_init.c index a85f751024..025ea90f8b 100644 --- a/lib/wx/c_src/wxe_ps_init.c +++ b/lib/wx/c_src/wxe_ps_init.c @@ -25,12 +25,17 @@ #include <Cocoa/Cocoa.h> #include <objc/objc-runtime.h> +extern OSErr CPSSetProcessName (ProcessSerialNumber *psn, char *processname); + void * wxe_ps_init() { ProcessSerialNumber psn; NSAutoreleasePool *pool; // Enable GUI GetCurrentProcess(&psn); + char *app_title = getenv("WX_APP_TITLE"); + // Undocumented function (but no documented way of doing this exists) + CPSSetProcessName(&psn, app_title?app_title:"Erlang"); TransformProcessType(&psn, kProcessTransformToForegroundApplication); SetFrontProcess(&psn); // Enable Cocoa calls from Carbon app diff --git a/lib/wx/configure.in b/lib/wx/configure.in index 7b35fed672..c45d2285af 100755 --- a/lib/wx/configure.in +++ b/lib/wx/configure.in @@ -80,20 +80,20 @@ fi ## Otherwise skip building wxErlang AC_CHECK_SIZEOF(void *) -case $ac_cv_sizeof_void_p-$host_os in - 8-darwin*) - if test X"$WX_BUILDING_INSIDE_ERLSRC" != X"true" ; then - AC_MSG_ERROR([Can not use 64bits wxWidgets on Darwin]) - else - echo "Can not combine 64bits erlang with wxWidgets on MacOSX, wx will not be useable" > ./CONF_INFO - WXERL_CAN_BUILD_DRIVER=false - AC_MSG_WARN([Can not combine 64bits erlang with wxWidgets on MacOSX, wx will not be useable]) - fi - WXERL_CAN_BUILD_DRIVER=false - ;; - *) - ;; -esac +# case $ac_cv_sizeof_void_p-$host_os in +# 8-darwin*) +# if test X"$WX_BUILDING_INSIDE_ERLSRC" != X"true" ; then +# AC_MSG_ERROR([Can not use 64bits wxWidgets on Darwin]) +# else +# echo "Can not combine 64bits erlang with wxWidgets on MacOSX, wx will not be useable" > ./CONF_INFO +# WXERL_CAN_BUILD_DRIVER=false +# AC_MSG_WARN([Can not combine 64bits erlang with wxWidgets on MacOSX, wx will not be useable]) +# fi +# WXERL_CAN_BUILD_DRIVER=false +# ;; +# *) +# ;; +# esac PTHR_CFLAGS="-D_THREAD_SAFE -D_REENTRANT" @@ -155,7 +155,7 @@ case $host_os in OBJC_CFLAGS="-ObjC" fi fi - CFLAGS=$saved_CFLAGS + CFLAGS="$saved_CFLAGS -Wno-deprecated-declarations" CPPFLAGS="$CPPFLAGS -D_MACOSX $PTHR_CFLAGS" ;; mingw32) @@ -169,6 +169,7 @@ case $host_os in CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0500" ;; *) + CFLAGS="$CFLAGS -Wno-deprecated-declarations" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE $PTHR_CFLAGS" ;; esac @@ -252,6 +253,18 @@ else AC_CHECK_HEADERS([gl/gl.h],[],[],[#include <windows.h>]) fi +if test X"$host_os" != X"win32" ; then + AC_CHECK_HEADERS([GL/glu.h], [], + [AC_CHECK_HEADERS([OpenGL/glu.h])]) + if test X"$ac_cv_header_GL_glu_h" != Xyes && + test X"$ac_cv_header_OpenGL_glu_h" != Xyes + then + AC_MSG_WARN([No GLU headers found, wx will NOT be usable]) + fi +else + AC_CHECK_HEADERS([gl/glu.h],[],[],[#include <windows.h>]) +fi + AC_SUBST(GL_LIBS) CXXFLAGS="$CFLAGS $CPPFLAGS" @@ -308,7 +321,15 @@ if test "$cross_compiling" = "yes"; then echo "Cross compilation of the wx driver is not supported yet, wx will NOT be usable" > ./CONF_INFO WXERL_CAN_BUILD_DRIVER=false elif test X"$MIXED_CYGWIN_VC" == X"no" -a X"$MIXED_MSYS_VC" == X"no"; then - m4_include(wxwin.m4) + WX_VERSION=`wx-config --version` + case $WX_VERSION in + 2.8.*) + m4_include(wxwin-2.8.m4) + ;; + *) + m4_include(wxwin-2.9.m4) + ;; + esac AM_OPTIONS_WXCONFIG reqwx=2.8.4 @@ -395,12 +416,12 @@ else else CWXWIN_PROG=`cygpath -d "$PROGRAMFILES" | cygpath -f - 2>/dev/null` fi - CWXWIN3=$CWXWIN_PROG/wxWidgets-2.8 - CWXWIN4=$CWXWIN_PROG/wxMSW-2.8 - CWX_DOCUMENTED="/opt/local/pgm/wxMSW-2.8.* /opt/local/pgm/wxWidgets-2.8.*" + CWXWIN3=$CWXWIN_PROG/wxWidgets-2.*.* + CWXWIN4=$CWXWIN_PROG/wxMSW-2.*.* + CWX_DOCUMENTED="/opt/local/pgm/wxMSW-2.*.* /opt/local/pgm/wxWidgets-2.*.*" case $ac_cv_sizeof_void_p in 8) - CWX_DOCUMENTED="/opt/local64/pgm/wxMSW-2.8.* /opt/local64/pgm/wxWidgets-2.8.* $CWX_DOCUMENTED" + CWX_DOCUMENTED="/opt/local64/pgm/wxMSW-2.*.* /opt/local64/pgm/wxWidgets-2.*.* $CWX_DOCUMENTED" ;; *) true @@ -442,6 +463,7 @@ else fi fi done + if test -z "$WX_LIBS_STATIC"; then AC_MSG_RESULT([failed]) if test X"$WX_BUILDING_INSIDE_ERLSRC" != X"true" ; then @@ -621,6 +643,12 @@ fi dnl - if test "$WXERL_CAN_BUILD_DRIVER" != "false" AC_SUBST(WXERL_CAN_BUILD_DRIVER) +if test "x$GCC" = xyes; then + # Treat certain GCC warnings as errors + LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) + LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CXXFLAGS]) +fi + ############################################################################# dnl diff --git a/lib/wx/examples/demo/demo.erl b/lib/wx/examples/demo/demo.erl index 61e71af021..2f560096f5 100644 --- a/lib/wx/examples/demo/demo.erl +++ b/lib/wx/examples/demo/demo.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -32,6 +32,21 @@ -record(state, {win, demo, example, selector, log, code}). +%% For wx-2.9 usage +-ifndef(wxSTC_ERLANG_COMMENT_FUNCTION). +-define(wxSTC_ERLANG_COMMENT_FUNCTION, 14). +-define(wxSTC_ERLANG_COMMENT_MODULE, 15). +-define(wxSTC_ERLANG_COMMENT_DOC, 16). +-define(wxSTC_ERLANG_COMMENT_DOC_MACRO, 17). +-define(wxSTC_ERLANG_ATOM_QUOTED, 18). +-define(wxSTC_ERLANG_MACRO_QUOTED, 19). +-define(wxSTC_ERLANG_RECORD_QUOTED, 20). +-define(wxSTC_ERLANG_NODE_NAME_QUOTED, 21). +-define(wxSTC_ERLANG_BIFS, 22). +-define(wxSTC_ERLANG_MODULES, 23). +-define(wxSTC_ERLANG_MODULES_ATT, 24). +-endif. + start() -> start([]). @@ -78,6 +93,7 @@ init(Options) -> wxFrame:setMenuBar(Frame,MB), wxFrame:connect(Frame, command_menu_selected), + wxFrame:connect(Frame, close_window), _SB = wxFrame:createStatusBar(Frame,[]), @@ -179,6 +195,8 @@ create_subwindow(Parent, BoxLabel, Funs) -> %% Handled as in normal gen_server callbacks handle_info({'EXIT',_, wx_deleted}, State) -> {noreply,State}; +handle_info({'EXIT',_, shutdown}, State) -> + {noreply,State}; handle_info({'EXIT',_, normal}, State) -> {noreply,State}; handle_info(Msg, State) -> @@ -197,13 +215,13 @@ handle_cast(Msg, State) -> handle_event(#wx{event=#wxCommand{type=command_listbox_selected, cmdString=Ex}}, State = #state{demo={_,DemoSz}, example=Example, code=Code}) -> case Ex of - [] -> + [] -> {noreply, State}; _ -> wxSizer:detach(DemoSz, Example), - wxWindow:destroy(Example), + wx_object:call(Example, shutdown), unload_code(Code), - NewExample = load_example(Ex, State), + NewExample = load_example(Ex, State), wxSizer:add(DemoSz, NewExample, [{proportion,1}, {flag, ?wxEXPAND}]), wxSizer:layout(DemoSz), {noreply, State#state{example=NewExample}} @@ -247,9 +265,9 @@ handle_event(#wx{id = Id, ?wxICON_INFORMATION bor ?wxSTAY_ON_TOP}, {caption, "About"}])), - {noreply, State}; + {noreply, State}; ?wxID_EXIT -> - wx_object:get_pid(State#state.example) ! stop, + wx_object:call(State#state.example, shutdown), {stop, normal, State}; _ -> {noreply, State} @@ -265,9 +283,9 @@ handle_event(Ev,State) -> code_change(_, _, State) -> {stop, not_yet_implemented, State}. -terminate(_Reason, State) -> - wx_object:get_pid(State#state.example) ! stop, - timer:sleep(200), %% Give the example process some time to cleanup. +terminate(_Reason, State = #state{win=Frame}) -> + catch wx_object:call(State#state.example, shutdown), + wxFrame:destroy(Frame), wx:destroy(). %%%%%%%%%%%%%%%%% Internals %%%%%%%%%% @@ -275,8 +293,6 @@ terminate(_Reason, State) -> load_example(Ex, #state{demo={DemoPanel,DemoSz}, log=EvCtrl, code=Code}) -> ModStr = "ex_" ++ Ex, Mod = list_to_atom(ModStr), -%% WxDir = code:lib_dir(wx), -%% ModFile = filename:join([WxDir, "examples","demo", ModStr ++ ".erl"]), ModFile = ModStr ++ ".erl", load_code(Code, file:read_file(ModFile)), find(Code), @@ -312,7 +328,20 @@ code_area(Parent) -> {?wxSTC_ERLANG_MACRO, {40,144,170}}, {?wxSTC_ERLANG_RECORD, {40,100,20}}, {?wxSTC_ERLANG_SEPARATOR,{0,0,0}}, - {?wxSTC_ERLANG_NODE_NAME,{0,0,0}}], + {?wxSTC_ERLANG_NODE_NAME,{0,0,0}}, + %% Optional 2.9 stuff + {?wxSTC_ERLANG_COMMENT_FUNCTION, {160,53,35}}, + {?wxSTC_ERLANG_COMMENT_MODULE, {160,53,35}}, + {?wxSTC_ERLANG_COMMENT_DOC, {160,53,35}}, + {?wxSTC_ERLANG_COMMENT_DOC_MACRO, {160,53,35}}, + {?wxSTC_ERLANG_ATOM_QUOTED, {0,0,0}}, + {?wxSTC_ERLANG_MACRO_QUOTED, {40,144,170}}, + {?wxSTC_ERLANG_RECORD_QUOTED, {40,100,20}}, + {?wxSTC_ERLANG_NODE_NAME_QUOTED, {0,0,0}}, + {?wxSTC_ERLANG_BIFS, {130,40,172}}, + {?wxSTC_ERLANG_MODULES, {64,102,244}}, + {?wxSTC_ERLANG_MODULES_ATT, {64,102,244}} + ], SetStyle = fun({Style, Color}) -> ?stc:styleSetFont(Ed, Style, FixedFont), ?stc:styleSetForeground(Ed, Style, Color) diff --git a/lib/wx/examples/demo/demo_html_tagger.erl b/lib/wx/examples/demo/demo_html_tagger.erl index 243e5d659f..46bfe73676 100644 --- a/lib/wx/examples/demo/demo_html_tagger.erl +++ b/lib/wx/examples/demo/demo_html_tagger.erl @@ -485,7 +485,6 @@ is_keyword('not') -> true; is_keyword('of' ) -> true; is_keyword('or' ) -> true; is_keyword('orelse' ) -> true; -is_keyword('query' ) -> true; is_keyword('receive' ) -> true; is_keyword('rem' ) -> true; is_keyword('spec') -> true; diff --git a/lib/wx/examples/demo/ex_aui.erl b/lib/wx/examples/demo/ex_aui.erl index 50f077638d..70372caad8 100644 --- a/lib/wx/examples/demo/ex_aui.erl +++ b/lib/wx/examples/demo/ex_aui.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -32,7 +32,8 @@ -record(state, { parent, - config + config, + aui }). start(Config) -> @@ -47,12 +48,10 @@ init(Config) -> do_init(Config) -> Parent = proplists:get_value(parent, Config), Panel = wxPanel:new(Parent, []), - %% Setup sizers MainSizer = wxBoxSizer:new(?wxVERTICAL), - Manager = wxAuiManager:new([{managed_wnd, Panel} - ]), + Manager = wxAuiManager:new([{managed_wnd, Panel}]), Pane = ?pi:new(), ?pi:closeButton(Pane), @@ -79,8 +78,8 @@ do_init(Config) -> wxAuiManager:connect(Manager, aui_pane_button, [{skip,true}]), wxAuiManager:connect(Manager, aui_pane_maximize, [{skip,true}]), wxAuiManager:update(Manager), - - {Panel, #state{parent=Panel, config=Config}}. + process_flag(trap_exit, true), + {Panel, #state{parent=Panel, config=Config, aui=Manager}}. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Callbacks handled as normal gen_server callbacks @@ -88,6 +87,12 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel, aui=Manager}) -> + wxAuiManager:unInit(Manager), + wxAuiManager:destroy(Manager), + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. @@ -134,11 +139,10 @@ handle_event(Ev = #wx{}, State) -> io:format("~p\n", [Ev]), {noreply, State}. - code_change(_, _, State) -> {stop, ignore, State}. -terminate(_Reason, _State) -> +terminate(_Reason, _) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/wx/examples/demo/ex_button.erl b/lib/wx/examples/demo/ex_button.erl index 0dd0363933..41bf34e572 100644 --- a/lib/wx/examples/demo/ex_button.erl +++ b/lib/wx/examples/demo/ex_button.erl @@ -25,7 +25,8 @@ -include_lib("wx/include/wx.hrl"). -behaviour(wx_object). --export([start/1, init/1, terminate/2, code_change/3, +-export([start/1, init/1, + terminate/2, code_change/3, handle_info/2, handle_call/3, handle_cast/2, handle_event/2]). -record(state, @@ -120,6 +121,7 @@ do_init(Config) -> wxWindow:connect(Panel, command_button_clicked), wxWindow:setSizer(Panel, Sz), wxSizer:layout(Sz), + wxWindow:refresh(Panel), wxScrolledWindow:setScrollRate(Panel, 5, 5), {Panel, #state{parent=Panel, config=Config}}. @@ -149,6 +151,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p~n",[Msg]), {noreply,State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config,"Got Call ~p~n",[Msg]), {reply,ok,State}. @@ -160,7 +166,7 @@ handle_cast(Msg, State) -> code_change(_, _, State) -> {stop, ignore, State}. -terminate(_Reason, _State) -> +terminate(_Reason, _) -> ok. %%%%% a copy from wxwidgets samples. diff --git a/lib/wx/examples/demo/ex_canvas.erl b/lib/wx/examples/demo/ex_canvas.erl index 1ec4760f40..1f1d260276 100644 --- a/lib/wx/examples/demo/ex_canvas.erl +++ b/lib/wx/examples/demo/ex_canvas.erl @@ -140,6 +140,9 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. @@ -151,7 +154,7 @@ handle_cast(Msg, State) -> code_change(_, _, State) -> {stop, ignore, State}. -terminate(_Reason, _State) -> +terminate(_Reason, _) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/wx/examples/demo/ex_canvas_paint.erl b/lib/wx/examples/demo/ex_canvas_paint.erl index 9bc083766a..6873724655 100644 --- a/lib/wx/examples/demo/ex_canvas_paint.erl +++ b/lib/wx/examples/demo/ex_canvas_paint.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -207,6 +207,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. @@ -218,7 +222,7 @@ handle_cast(Msg, State) -> code_change(_, _, State) -> {stop, ignore, State}. -terminate(_Reason, _State) -> +terminate(_Reason, _) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -239,14 +243,17 @@ draw(Canvas, Bitmap, Fun) -> wxMemoryDC:destroy(MemoryDC). redraw(DC, Bitmap) -> - MemoryDC = wxMemoryDC:new(Bitmap), + try + MemoryDC = wxMemoryDC:new(Bitmap), - wxDC:blit(DC, {0,0}, - {wxBitmap:getWidth(Bitmap), wxBitmap:getHeight(Bitmap)}, - MemoryDC, {0,0}), - - wxMemoryDC:destroy(MemoryDC). + wxDC:blit(DC, {0,0}, + {wxBitmap:getWidth(Bitmap), wxBitmap:getHeight(Bitmap)}, + MemoryDC, {0,0}), + wxMemoryDC:destroy(MemoryDC) + catch error:{{badarg,_},_} -> %% Bitmap have been deleted + ok + end. -getPageInfo(_This) -> +getPageInfo(_This) -> {1,1,1,1}. diff --git a/lib/wx/examples/demo/ex_choices.erl b/lib/wx/examples/demo/ex_choices.erl index 2e456ae249..b4418293c1 100644 --- a/lib/wx/examples/demo/ex_choices.erl +++ b/lib/wx/examples/demo/ex_choices.erl @@ -143,6 +143,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n",[Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config,"Got Call ~p\n",[Msg]), {reply, {error,nyi}, State}. @@ -154,7 +158,7 @@ handle_cast(Msg, State) -> code_change(_, _, State) -> {stop, ignore, State}. -terminate(_Reason, _State) -> +terminate(_Reason, _) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/wx/examples/demo/ex_cursor.erl b/lib/wx/examples/demo/ex_cursor.erl index c1a558541b..2f1eaaf7c7 100644 --- a/lib/wx/examples/demo/ex_cursor.erl +++ b/lib/wx/examples/demo/ex_cursor.erl @@ -131,6 +131,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_dialogs.erl b/lib/wx/examples/demo/ex_dialogs.erl index b39344f8b1..5c47b51271 100644 --- a/lib/wx/examples/demo/ex_dialogs.erl +++ b/lib/wx/examples/demo/ex_dialogs.erl @@ -149,6 +149,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_frame_utils.erl b/lib/wx/examples/demo/ex_frame_utils.erl index a90642b355..4a59bb3a68 100644 --- a/lib/wx/examples/demo/ex_frame_utils.erl +++ b/lib/wx/examples/demo/ex_frame_utils.erl @@ -98,6 +98,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_gauge.erl b/lib/wx/examples/demo/ex_gauge.erl index ffc667ff05..c53dfb807b 100644 --- a/lib/wx/examples/demo/ex_gauge.erl +++ b/lib/wx/examples/demo/ex_gauge.erl @@ -114,6 +114,10 @@ handle_info(pulse, State=#state{undeterminate_gauge = Gauge=#gauge{obj = Obj}}) Timer = erlang:send_after(300, self(), pulse), {noreply, State#state{undeterminate_gauge = Gauge#gauge{timer = Timer}}}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config,"Got Call ~p\n",[Msg]), {reply,ok, State}. diff --git a/lib/wx/examples/demo/ex_gl.erl b/lib/wx/examples/demo/ex_gl.erl index 72dad2cf9d..6bb2d12dff 100644 --- a/lib/wx/examples/demo/ex_gl.erl +++ b/lib/wx/examples/demo/ex_gl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,7 +20,8 @@ -behaviour(wx_object). --export([init/1, code_change/3, handle_info/2, handle_event/2, +-export([init/1, code_change/3, handle_info/2, + handle_sync_event/3, handle_event/2, handle_call/3, handle_cast/2, terminate/2, start/1]). @@ -34,6 +35,7 @@ config, gl, canvas, + image, timer, time }). @@ -58,7 +60,7 @@ do_init(Config) -> %% Setup sizer Sizer = wxStaticBoxSizer:new(?wxHORIZONTAL, Panel, [{label, "wxGLCanvas"}]), - Opts = [{size, {300,300}}, {style, ?wxSUNKEN_BORDER}], + Opts = [{style, ?wxFULL_REPAINT_ON_RESIZE}], GLAttrib = [{attribList, [?WX_GL_RGBA, ?WX_GL_DOUBLEBUFFER, ?WX_GL_MIN_RED,8, @@ -67,34 +69,48 @@ do_init(Config) -> ?WX_GL_DEPTH_SIZE,24,0]}], Canvas = wxGLCanvas:new(Panel,Opts ++ GLAttrib), wxGLCanvas:connect(Canvas, size), + wxGLCanvas:connect(Canvas, paint, [callback]), - wxGLCanvas:setCurrent(Canvas), Image = wxImage:scale(wxImage:new("image.jpg"), 128,128), - GL = setup_gl(Canvas,Image), - Timer = timer:send_interval(20, self(), update), %% Add to sizers wxSizer:add(Sizer, Canvas, [{flag, ?wxEXPAND},{proportion, 1}]), wxWindow:setSizer(Panel,Sizer), wxSizer:layout(Sizer), + Timer = timer:send_interval(20, self(), update), {Panel, #state{parent = Panel, config = Config, - canvas = Canvas, - gl = GL, timer = Timer}}. + canvas = Canvas, image=Image, + timer = Timer}}. %% Event handling -handle_event(#wx{event = #wxSize{size = {W,H}}}, State) -> - case W =:= 0 orelse H =:= 0 of - true -> skip; - _ -> +handle_sync_event(_PaintEvent, _, #state{canvas=Canvas}) -> + %% Sync events are called from a temporary process, + %% we need to setup the gl canvas on cocoa for some reason + %% We do not really have to do anything, the timer event will refresh the painting + wxGLCanvas:setCurrent(Canvas), + DC= wxPaintDC:new(Canvas), + wxPaintDC:destroy(DC), + ok. + +handle_event(#wx{event = #wxSize{size = {W,H}}}, State = #state{gl=GL}) -> + if + GL =:= undefined -> + #state{canvas=Canvas, image=Image} = State, + wxGLCanvas:setCurrent(Canvas), + {noreply, State#state{gl=setup_gl(Canvas,Image)}}; + W =:= 0, H =:= 0 -> {noreply, State}; + true -> gl:viewport(0,0,W,H), gl:matrixMode(?GL_PROJECTION), gl:loadIdentity(), gl:ortho( -2.0, 2.0, -2.0*H/W, 2.0*H/W, -20.0, 20.0), gl:matrixMode(?GL_MODELVIEW), - gl:loadIdentity() - end, - {noreply, State}. + gl:loadIdentity(), + {noreply, State} + end. +handle_info(update, State=#state{gl=undefined}) -> + {noreply, State}; handle_info(update, State) -> S1 = update_rotation(State), GL = S1#state.gl, @@ -113,7 +129,13 @@ handle_info(stop, State) -> timer:cancel(State#state.timer), catch wxGLCanvas:destroy(State#state.canvas), {stop, normal, State}. - + +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + catch wxGLCanvas:destroy(State#state.canvas), + timer:cancel(State#state.timer), + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> io:format("Got Call ~p~n",[Msg]), {reply,ok,State}. @@ -125,11 +147,8 @@ handle_cast(Msg, State) -> code_change(_, _, State) -> {stop, not_yet_implemented, State}. -terminate(_Reason, State) -> - catch wxGLCanvas:destroy(State#state.canvas), - timer:cancel(State#state.timer), - timer:sleep(300). - +terminate(_Reason, _State) -> + ok. -define(VS, {{-0.5, -0.5, -0.5}, %1 diff --git a/lib/wx/examples/demo/ex_graphicsContext.erl b/lib/wx/examples/demo/ex_graphicsContext.erl index c356500d99..59bfe7ff64 100644 --- a/lib/wx/examples/demo/ex_graphicsContext.erl +++ b/lib/wx/examples/demo/ex_graphicsContext.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -25,8 +25,8 @@ %% wx_object callbacks -export([init/1, terminate/2, code_change/3, - handle_info/2, handle_call/3, -handle_cast/2, handle_event/2, handle_sync_event/3]). + handle_info/2, handle_call/3,handle_cast/2, + handle_event/2, handle_sync_event/3]). -include_lib("wx/include/wx.hrl"). @@ -57,11 +57,9 @@ do_init(Config) -> [{label, "wxGrapicsContext"}]), Win = wxPanel:new(Panel, []), - Pen = wxPen:new(), - Brush = wxBrush:new(?wxBLACK), - Font = wxFont:new(), - wxFont:setWeight(Font, ?wxBOLD), - + Pen = ?wxBLACK_PEN, + Brush = wxBrush:new({30, 175, 23, 127}), + Font = ?wxITALIC_FONT, wxPanel:connect(Win, paint, [callback]), %% Add to sizers @@ -94,6 +92,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. @@ -112,36 +114,26 @@ terminate(_Reason, _State) -> %% Local functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -draw(Win, Pen0, _Brush0, Font0) -> +draw(Win, Pen, Brush, Font) -> try Canvas = wxGraphicsContext:create(Win), - Pen = wxGraphicsContext:createPen(Canvas, Pen0), wxGraphicsContext:setPen(Canvas, Pen), - Brush = wxGraphicsContext:createLinearGradientBrush(Canvas, 0.0,0.0, 30.0,30.0, - {200,50,50,50}, - {200,50,50,200}), wxGraphicsContext:setBrush(Canvas, Brush), - Font = wxGraphicsContext:createFont(Canvas, Font0), - wxGraphicsContext:setFont(Canvas, Font), + wxGraphicsContext:setFont(Canvas, Font, {0, 0, 50}), wxGraphicsContext:drawRoundedRectangle(Canvas, 35.0,35.0, 100.0, 50.0, 10.0), - wxGraphicsContext:drawText(Canvas, "Welcome", 60.0, 55.0), + wxGraphicsContext:drawText(Canvas, "This text should be antialised", 60.0, 55.0), Path = wxGraphicsContext:createPath(Canvas), wxGraphicsPath:addCircle(Path, 0.0, 0.0, 40.0), wxGraphicsPath:closeSubpath(Path), - wxGraphicsContext:translate(Canvas, 100.0, 100.0), - - Brush2 = wxGraphicsContext:createLinearGradientBrush(Canvas, 0.0,0.0, 30.0,30.0, - {50,200,50,50}, - {50,50,200,50}), - wxGraphicsContext:setBrush(Canvas, Brush2), + wxGraphicsContext:translate(Canvas, 100.0, 250.0), - F = fun(_) -> + F = fun(N) -> wxGraphicsContext:scale(Canvas, 1.1, 1.1), - wxGraphicsContext:translate(Canvas, 3.0,3.0), + wxGraphicsContext:translate(Canvas, 15.0,-1.0*N), wxGraphicsContext:drawPath(Canvas, Path) end, - wx:foreach(F, lists:seq(1,5)), + wx:foreach(F, lists:seq(1,10)), ok catch _:{not_supported, _} -> Err = "wxGraphicsContext not available in this build of wxwidgets", diff --git a/lib/wx/examples/demo/ex_grid.erl b/lib/wx/examples/demo/ex_grid.erl index d1a9952ab2..e284836d5b 100644 --- a/lib/wx/examples/demo/ex_grid.erl +++ b/lib/wx/examples/demo/ex_grid.erl @@ -78,6 +78,10 @@ handle_event(#wx{event = #wxGrid{type = grid_cell_change, handle_info(_Msg, State) -> {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(_Msg, _From, State) -> {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_htmlWindow.erl b/lib/wx/examples/demo/ex_htmlWindow.erl index 564c790e48..af3d4c71f5 100644 --- a/lib/wx/examples/demo/ex_htmlWindow.erl +++ b/lib/wx/examples/demo/ex_htmlWindow.erl @@ -77,6 +77,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_listCtrl.erl b/lib/wx/examples/demo/ex_listCtrl.erl index 13096dfa52..2c62ac9d5f 100644 --- a/lib/wx/examples/demo/ex_listCtrl.erl +++ b/lib/wx/examples/demo/ex_listCtrl.erl @@ -58,8 +58,8 @@ do_init(Config) -> IL = wxImageList:new(16,16), wxImageList:add(IL, wxArtProvider:getBitmap("wxART_COPY", [{size, {16,16}}])), wxImageList:add(IL, wxArtProvider:getBitmap("wxART_MISSING_IMAGE", [{size, {16,16}}])), - wxImageList:add(IL, wxArtProvider:getBitmap("wxART_TICK_MARK", [{size, {16,16}}])), - wxImageList:add(IL, wxArtProvider:getBitmap("wxART_CROSS_MARK", [{size, {16,16}}])), + wxImageList:add(IL, wxArtProvider:getBitmap("wxART_QUESTION", [{size, {16,16}}])), + wxImageList:add(IL, wxArtProvider:getBitmap("wxART_WARNING", [{size, {16,16}}])), wxListCtrl:assignImageList(ListCtrl2, IL, ?wxIMAGE_LIST_SMALL), Fun = fun(Item) -> @@ -143,6 +143,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n",[Msg]), {noreply,State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config,"Got Call ~p\n",[Msg]), {reply,ok,State}. diff --git a/lib/wx/examples/demo/ex_notebook.erl b/lib/wx/examples/demo/ex_notebook.erl index fc38fdae08..5edcc65082 100644 --- a/lib/wx/examples/demo/ex_notebook.erl +++ b/lib/wx/examples/demo/ex_notebook.erl @@ -129,6 +129,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n",[Msg]), {noreply,State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config,"Got Call ~p\n",[Msg]), {reply,ok,State}. diff --git a/lib/wx/examples/demo/ex_pickers.erl b/lib/wx/examples/demo/ex_pickers.erl index 8013a5ba32..54f8c7a8e5 100644 --- a/lib/wx/examples/demo/ex_pickers.erl +++ b/lib/wx/examples/demo/ex_pickers.erl @@ -120,6 +120,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_popupMenu.erl b/lib/wx/examples/demo/ex_popupMenu.erl index d6778c5dc5..f48b00963d 100644 --- a/lib/wx/examples/demo/ex_popupMenu.erl +++ b/lib/wx/examples/demo/ex_popupMenu.erl @@ -86,6 +86,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_radioBox.erl b/lib/wx/examples/demo/ex_radioBox.erl index ab7685f41f..17a11d1054 100644 --- a/lib/wx/examples/demo/ex_radioBox.erl +++ b/lib/wx/examples/demo/ex_radioBox.erl @@ -103,6 +103,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n",[Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config,"Got Call ~p\n",[Msg]), {reply, {error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_sashWindow.erl b/lib/wx/examples/demo/ex_sashWindow.erl index d8a8958f28..9eb3b9b27e 100644 --- a/lib/wx/examples/demo/ex_sashWindow.erl +++ b/lib/wx/examples/demo/ex_sashWindow.erl @@ -112,6 +112,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_sizers.erl b/lib/wx/examples/demo/ex_sizers.erl index 7b9e8eb37f..ecd539cd62 100644 --- a/lib/wx/examples/demo/ex_sizers.erl +++ b/lib/wx/examples/demo/ex_sizers.erl @@ -97,6 +97,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_slider.erl b/lib/wx/examples/demo/ex_slider.erl index 612543ff26..4979e8b4f4 100644 --- a/lib/wx/examples/demo/ex_slider.erl +++ b/lib/wx/examples/demo/ex_slider.erl @@ -97,6 +97,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n",[Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config,"Got Call ~p\n",[Msg]), {reply, {error, nyi},State}. diff --git a/lib/wx/examples/demo/ex_splitterWindow.erl b/lib/wx/examples/demo/ex_splitterWindow.erl index 4f25b73293..ac2fbe0113 100644 --- a/lib/wx/examples/demo/ex_splitterWindow.erl +++ b/lib/wx/examples/demo/ex_splitterWindow.erl @@ -86,6 +86,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_static.erl b/lib/wx/examples/demo/ex_static.erl index 013bd5ac35..8cf477b55a 100644 --- a/lib/wx/examples/demo/ex_static.erl +++ b/lib/wx/examples/demo/ex_static.erl @@ -101,6 +101,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/demo/ex_textCtrl.erl b/lib/wx/examples/demo/ex_textCtrl.erl index d82884f30b..57088ad878 100644 --- a/lib/wx/examples/demo/ex_textCtrl.erl +++ b/lib/wx/examples/demo/ex_textCtrl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -51,27 +51,23 @@ do_init(Config) -> Sizer3 = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, "wxTextCtrl multiline"}]), - TextCtrl = wxTextCtrl:new(Panel, 1, [{value, "This is a single line wxTextCtrl"}, + TextCtrl = wxTextCtrl:new(Panel, 1, [{value, "This is a single line wxTextCtrl"}, {style, ?wxDEFAULT}]), TextCtrl2 = wxTextCtrl:new(Panel, 2, [{value, "password"}, - {style, ?wxDEFAULT bor - ?wxTE_PASSWORD}]), - TextCtrl3 = wxTextCtrl:new(Panel, 3, [{value, "This is a\n" - "multiline\n" - "wxTextCtrl"}, - {style, ?wxDEFAULT bor - ?wxTE_MULTILINE}]), + {style, ?wxDEFAULT bor ?wxTE_PASSWORD}]), + TextCtrl3 = wxTextCtrl:new(Panel, 3, [{value, "This is a\nmultiline\nwxTextCtrl"}, + {style, ?wxDEFAULT bor ?wxTE_MULTILINE}]), %% Add to sizers - wxSizer:add(Sizer, TextCtrl, [{flag, ?wxEXPAND}]), + wxSizer:add(Sizer, TextCtrl, [{flag, ?wxEXPAND}]), wxSizer:add(Sizer2, TextCtrl2, []), - wxSizer:add(Sizer3, TextCtrl3, [{flag, ?wxEXPAND}]), + wxSizer:add(Sizer3, TextCtrl3, [{flag, ?wxEXPAND}, {proportion, 1}]), wxSizer:add(MainSizer, Sizer, [{flag, ?wxEXPAND}]), wxSizer:addSpacer(MainSizer, 10), wxSizer:add(MainSizer, Sizer2, [{flag, ?wxEXPAND}]), wxSizer:addSpacer(MainSizer, 10), - wxSizer:add(MainSizer, Sizer3, [{flag, ?wxEXPAND}]), + wxSizer:add(MainSizer, Sizer3, [{flag, ?wxEXPAND}, {proportion, 1}]), wxPanel:setSizer(Panel, MainSizer), {Panel, #state{parent=Panel, config=Config}}. @@ -88,6 +84,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n",[Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config,"Got Call ~p\n",[Msg]), {reply, {error,nyi}, State}. diff --git a/lib/wx/examples/demo/ex_treeCtrl.erl b/lib/wx/examples/demo/ex_treeCtrl.erl index 611904500a..7698ab1f00 100644 --- a/lib/wx/examples/demo/ex_treeCtrl.erl +++ b/lib/wx/examples/demo/ex_treeCtrl.erl @@ -105,6 +105,10 @@ handle_info(Msg, State) -> demo:format(State#state.config, "Got Info ~p\n", [Msg]), {noreply, State}. +handle_call(shutdown, _From, State=#state{parent=Panel}) -> + wxPanel:destroy(Panel), + {stop, normal, ok, State}; + handle_call(Msg, _From, State) -> demo:format(State#state.config, "Got Call ~p\n", [Msg]), {reply,{error, nyi}, State}. diff --git a/lib/wx/examples/simple/menu.erl b/lib/wx/examples/simple/menu.erl index 0025a0b027..9e6b28b46b 100644 --- a/lib/wx/examples/simple/menu.erl +++ b/lib/wx/examples/simple/menu.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -105,7 +105,7 @@ create_frame(Wx) -> Frame = wxFrame:new(Wx, -1, "wxErlang menu sample", [{size, {600,400}}]), Path = filename:dirname(code:which(?MODULE)), - wxFrame:setIcon(Frame, wxIcon:new(filename:join(Path,"sample.xpm"))), + wxFrame:setIcon(Frame, wxIcon:new(filename:join(Path,"sample.xpm"), [{type, ?wxBITMAP_TYPE_XPM}])), wxFrame:createStatusBar(Frame,[]), wxFrame:connect(Frame, close_window), diff --git a/lib/wx/examples/simple/minimal.erl b/lib/wx/examples/simple/minimal.erl index bdff66e217..4782745dfc 100644 --- a/lib/wx/examples/simple/minimal.erl +++ b/lib/wx/examples/simple/minimal.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -41,8 +41,8 @@ start() -> create_window(Wx) -> Frame = wxFrame:new(Wx, -1, "Minimal wxErlang App", [{size, {600,400}}]), - Path = filename:dirname(code:which(?MODULE)), - wxFrame:setIcon(Frame, wxIcon:new(filename:join(Path,"sample.xpm"))), + Path = filename:dirname(code:which(?MODULE)), + wxFrame:setIcon(Frame, wxIcon:new(filename:join(Path,"sample.xpm"), [{type, ?wxBITMAP_TYPE_XPM}])), wxFrame:createStatusBar(Frame,[]), wxFrame:connect(Frame, close_window), diff --git a/lib/wx/examples/sudoku/sudoku_board.erl b/lib/wx/examples/sudoku/sudoku_board.erl index 4b26ff97da..ed9c62b7c8 100644 --- a/lib/wx/examples/sudoku/sudoku_board.erl +++ b/lib/wx/examples/sudoku/sudoku_board.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -27,7 +27,7 @@ -export([new/1, setup_board/2, clear_board/1, left/1, get_board_data/1,set_board_data/2, set_butt/3, butt_correct/3, - draw/3, + get_state/1, redraw/3, %% Callbacks init/1, handle_sync_event/3, handle_event/2, handle_info/2, handle_call/3, handle_cast/2, @@ -69,9 +69,8 @@ get_board_data(Board) -> set_board_data(Board, List) -> wx_object:call(Board, {set_board_data, List}). - -draw(Board, DC, Size) -> - wx_object:call(Board, {draw, DC, Size}). +get_state(Board) -> + wx_object:call(Board, get_state). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -85,26 +84,29 @@ init([ParentObj, ParentPid]) -> wxWindow:connect(Win, erase_background, []), wxWindow:connect(Win, key_up, [{skip, true}]), wxWindow:connect(Win, left_down, [{skip, true}]), - wxWindow:connect(Win, enter_window, [{skip, true}]), + wxWindow:connect(Win, enter_window, [{skip, true}]), %% Init pens and fonts Pen = wxPen:new({0,0,0}, [{width, 3}]), Fs0 = [{Sz,wxFont:new(Sz, ?wxSWISS, ?wxNORMAL, ?wxNORMAL,[])} || Sz <- [8,9,10,11,12,13,14,16,18,20,22,24,26,28,30,34,38,42,44,46]], - TestDC = wxClientDC:new(Win), + TestDC = wxMemoryDC:new(), + Bitmap = wxBitmap:new(256,256), + wxMemoryDC:selectObject(TestDC, Bitmap), + true = wxDC:isOk(TestDC), CW = fun({Sz,Font},Acc) -> case wxFont:ok(Font) of - true -> + true -> wxDC:setFont(TestDC, Font), - CH = wxDC:getCharHeight(TestDC), + CH = wxDC:getCharHeight(TestDC), [{CH,Sz,Font} | Acc]; false -> Acc end end, Fs = lists:foldl(CW, [], Fs0), - wxClientDC:destroy(TestDC), - {Win, #state{win=Win, board=[], pen=Pen, fonts=Fs, parent=ParentPid}}. + wxMemoryDC:destroy(TestDC), + {Win, #state{win=Win, board=[], pen=Pen, fonts=Fs,parent=ParentPid}}. handle_sync_event(#wx{event=#wxPaint{}}, _Obj, State = #state{win=Win}) -> %% io:format("EPaint~n",[]), @@ -119,22 +121,17 @@ handle_sync_event(#wx{event=#wxPaint{}}, _Obj, State = #state{win=Win}) -> handle_event(#wx{event=#wxMouse{type=enter_window}}, State = #state{win=Win}) -> wxWindow:setFocus(Win), %% Get keyboard focus {noreply,State}; -handle_event(#wx{event=#wxKey{keyCode=KeyC, x=X,y=Y}}, +handle_event(#wx{event=#wxKey{keyCode=KeyC}}, S = #state{parent=Pid, win=Win}) -> Val = if KeyC > 47, KeyC < 58 -> KeyC - $0; KeyC > 325, KeyC < 336 -> KeyC - 326; %% NUM LOCK true -> 0 end, - case get_butt(X,Y,S) of - error -> %% Mac don't get correct coordinates. - Global = wx_misc:getMousePosition(), - {CX,CY} = wxWindow:screenToClient(Win, Global), - case get_butt(CX,CY,S) of - error -> ignore; - Id -> Pid ! {set_val,Id,Val} - end; - Id -> - Pid ! {set_val,Id,Val} + Global = wx_misc:getMousePosition(), + {CX,CY} = wxWindow:screenToClient(Win, Global), + case get_butt(CX,CY,S) of + error -> ignore; + Id -> Pid ! {set_val,Id,Val} end, {noreply, S}; handle_event(#wx{event=#wxMouse{type=left_down,x=X,y=Y}}, @@ -205,9 +202,8 @@ handle_call({set_board_data, B},_From, S0) -> handle_call(left,_From, S = #state{board=B}) -> Res = 81 - length([ok || #sq{correct=C} <- B, C /= false]), {reply, Res, S}; -handle_call({draw, DC, Size},_From, S) -> - redraw(DC,Size,S), - {reply, ok, S}. +handle_call(get_state, _From, S) -> + {reply, {ok,S}, S}. handle_cast(Msg, State) -> io:format("Got cast ~p~n",[Msg]), diff --git a/lib/wx/examples/sudoku/sudoku_gui.erl b/lib/wx/examples/sudoku/sudoku_gui.erl index 3d0c95ffa7..5f3f1a2621 100644 --- a/lib/wx/examples/sudoku/sudoku_gui.erl +++ b/lib/wx/examples/sudoku/sudoku_gui.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -307,19 +307,19 @@ dialog(?PRINT_PAGE_SETUP, S = #gs{frame=Frame, print_psdd=PsDD0, print_d=PD0}) - wxPageSetupDialogData:destroy(PsDD0), wxPrintData:destroy(PD0), S#gs{print_psdd=PsDD, print_d=PD}; -dialog(?PRINT_PRE, S = #gs{frame=Frame, print_d=PD}) -> +dialog(?PRINT_PRE, S = #gs{frame=Frame, print_d=PD, board=Board}) -> + {ok, BoardS} = sudoku_board:get_state(Board), PDD = wxPrintDialogData:new(PD), - Printout1 = wxPrintout:new("Print", fun(This,Page) -> printout(This,Page,S) end, + Printout1 = wxPrintout:new("Print 1", fun(This,Page) -> printout(This,Page,BoardS, S) end, [{getPageInfo, fun getPageInfo/1}]), - Printout2 = wxPrintout:new("Print", fun(This,Page) -> printout(This,Page,S) end, + Printout2 = wxPrintout:new("Print 2", fun(This,Page) -> printout(This,Page,BoardS, S) end, [{getPageInfo, fun getPageInfo/1}]), - Preview = wxPrintPreview:new(Printout1, [{printoutForPrinting,Printout2},{data,PDD}]), + Preview = wxPrintPreview:new(Printout1, [{printoutForPrinting,Printout2},{data,PDD}]), case wxPrintPreview:isOk(Preview) of true -> PF = wxPreviewFrame:new(Preview, Frame, [{title, "Print Preview"}]), wxPreviewFrame:centre(PF, [{dir, ?wxBOTH}]), wxPreviewFrame:initialize(PF), - wxPreviewFrame:centre(PF), wxPreviewFrame:show(PF); false -> io:format("Could not create preview window.\n" @@ -327,10 +327,11 @@ dialog(?PRINT_PRE, S = #gs{frame=Frame, print_d=PD}) -> wxPrintPreview:destroy(Preview) end, S; -dialog(?PRINT, S = #gs{frame=Frame, print_d=PD}) -> +dialog(?PRINT, S = #gs{frame=Frame, print_d=PD, board=Board}) -> + {ok, BoardS} = sudoku_board:get_state(Board), PDD = wxPrintDialogData:new(PD), Printer = wxPrinter:new([{data,PDD}]), - Printout = wxPrintout:new("Print", fun(This,Page) -> printout(This,Page,S) end, + Printout = wxPrintout:new("Print", fun(This,Page) -> printout(This,Page,BoardS,S) end, [{getPageInfo, fun getPageInfo/1}]), case wxPrinter:print(Printer, Frame, Printout, [{prompt,true}]) of @@ -374,16 +375,14 @@ init_printer(S) -> getPageInfo(_This) -> {1,1,1,1}. -printout(This, _Page, #gs{board=Board, print_psdd=PsDD}) -> +printout(This, _Page, Board, #gs{print_psdd=PsDD}) -> MX = MY = 500, wxPrintout:fitThisSizeToPageMargins(This, {MX,MY}, PsDD), - + _DBG = {_X,_Y,W,H} = wxPrintout:getLogicalPageMarginsRect(This, PsDD), wxPrintout:offsetLogicalOrigin(This,(W-MX) div 2, (H-MY) div 2), -%% io:format("~p ->{~p,~p} ~n", [_DBG, (W-MX) div 2, (H-MY) div 2]), - DC = wxPrintout:getDC(This), - sudoku_board:draw(Board, DC, {500,500}), + sudoku_board:redraw(DC, {500,500}, Board), true. set_val(Id, Val, Board, G) -> diff --git a/lib/wx/include/wx.hrl b/lib/wx/include/wx.hrl index 62979908a6..a48c756dea 100644 --- a/lib/wx/include/wx.hrl +++ b/lib/wx/include/wx.hrl @@ -131,7 +131,7 @@ -type wxScrollWin() :: #wxScrollWin{}. %% Callback event: {@link wxScrollWinEvent} -record(wxPaint, {type :: wxPaintEventType()}). %% Callback event: {@link wxPaintEvent} --type wxPaintEventType() :: paint | paint_icon. +-type wxPaintEventType() :: paint. -type wxPaint() :: #wxPaint{}. %% Callback event: {@link wxPaintEvent} -record(wxChildFocus, {type :: wxChildFocusEventType()}). %% Callback event: {@link wxChildFocusEvent} @@ -252,7 +252,7 @@ wheelRotation :: integer(), wheelDelta :: integer(), linesPerAction :: integer()}). --type wxMouseEventType() :: left_down | left_up | middle_down | middle_up | right_down | right_up | motion | enter_window | leave_window | left_dclick | middle_dclick | right_dclick | mousewheel | nc_left_down | nc_left_up | nc_middle_down | nc_middle_up | nc_right_down | nc_right_up | nc_motion | nc_enter_window | nc_leave_window | nc_left_dclick | nc_middle_dclick | nc_right_dclick. +-type wxMouseEventType() :: left_down | left_up | middle_down | middle_up | right_down | right_up | motion | enter_window | leave_window | left_dclick | middle_dclick | right_dclick | mousewheel. -type wxMouse() :: #wxMouse{}. %% Callback event: {@link wxMouseEvent} -record(wxWindowCreate, {type :: wxWindowCreateEventType()}). %% Callback event: {@link wxWindowCreateEvent} @@ -292,10 +292,6 @@ -type wxIdleEventType() :: idle. -type wxIdle() :: #wxIdle{}. %% Callback event: {@link wxIdleEvent} --record(wxNcPaint, {type :: wxNcPaintEventType()}). %% Callback event: {@link wxNcPaintEvent} --type wxNcPaintEventType() :: nc_paint. --type wxNcPaint() :: #wxNcPaint{}. %% Callback event: {@link wxNcPaintEvent} - -record(wxColourPicker,{type :: wxColourPickerEventType(), %% Callback event: {@link wxColourPickerEvent} colour :: wx:wx_colour()}). -type wxColourPickerEventType() :: command_colourpicker_changed. @@ -312,8 +308,8 @@ -type wxTreeEventType() :: command_tree_begin_drag | command_tree_begin_rdrag | command_tree_begin_label_edit | command_tree_end_label_edit | command_tree_delete_item | command_tree_get_info | command_tree_set_info | command_tree_item_expanded | command_tree_item_expanding | command_tree_item_collapsed | command_tree_item_collapsing | command_tree_sel_changed | command_tree_sel_changing | command_tree_key_down | command_tree_item_activated | command_tree_item_right_click | command_tree_item_middle_click | command_tree_end_drag | command_tree_state_image_click | command_tree_item_gettooltip | command_tree_item_menu. -type wxTree() :: #wxTree{}. %% Callback event: {@link wxTreeEvent} --type event() :: wxAuiManager() | wxAuiNotebook() | wxCalendar() | wxChildFocus() | wxClose() | wxColourPicker() | wxCommand() | wxContextMenu() | wxDate() | wxDisplayChanged() | wxErase() | wxFileDirPicker() | wxFocus() | wxFontPicker() | wxGrid() | wxHelp() | wxHtmlLink() | wxIconize() | wxIdle() | wxJoystick() | wxKey() | wxList() | wxMaximize() | wxMenu() | wxMouse() | wxMouseCaptureChanged() | wxMove() | wxNavigationKey() | wxNcPaint() | wxNotebook() | wxPaint() | wxPaletteChanged() | wxQueryNewPalette() | wxSash() | wxScroll() | wxScrollWin() | wxSetCursor() | wxShow() | wxSize() | wxSpin() | wxSplitter() | wxStyledText() | wxSysColourChanged() | wxTaskBarIcon() | wxTree() | wxUpdateUI() | wxWindowCreate() | wxWindowDestroy(). --type wxEventType() :: wxAuiManagerEventType() | wxAuiNotebookEventType() | wxCalendarEventType() | wxChildFocusEventType() | wxCloseEventType() | wxColourPickerEventType() | wxCommandEventType() | wxContextMenuEventType() | wxDateEventType() | wxDisplayChangedEventType() | wxEraseEventType() | wxFileDirPickerEventType() | wxFocusEventType() | wxFontPickerEventType() | wxGridEventType() | wxHelpEventType() | wxHtmlLinkEventType() | wxIconizeEventType() | wxIdleEventType() | wxJoystickEventType() | wxKeyEventType() | wxListEventType() | wxMaximizeEventType() | wxMenuEventType() | wxMouseCaptureChangedEventType() | wxMouseEventType() | wxMoveEventType() | wxNavigationKeyEventType() | wxNcPaintEventType() | wxNotebookEventType() | wxPaintEventType() | wxPaletteChangedEventType() | wxQueryNewPaletteEventType() | wxSashEventType() | wxScrollEventType() | wxScrollWinEventType() | wxSetCursorEventType() | wxShowEventType() | wxSizeEventType() | wxSpinEventType() | wxSplitterEventType() | wxStyledTextEventType() | wxSysColourChangedEventType() | wxTaskBarIconEventType() | wxTreeEventType() | wxUpdateUIEventType() | wxWindowCreateEventType() | wxWindowDestroyEventType(). +-type event() :: wxAuiManager() | wxAuiNotebook() | wxCalendar() | wxChildFocus() | wxClose() | wxColourPicker() | wxCommand() | wxContextMenu() | wxDate() | wxDisplayChanged() | wxErase() | wxFileDirPicker() | wxFocus() | wxFontPicker() | wxGrid() | wxHelp() | wxHtmlLink() | wxIconize() | wxIdle() | wxJoystick() | wxKey() | wxList() | wxMaximize() | wxMenu() | wxMouse() | wxMouseCaptureChanged() | wxMove() | wxNavigationKey() | wxNotebook() | wxPaint() | wxPaletteChanged() | wxQueryNewPalette() | wxSash() | wxScroll() | wxScrollWin() | wxSetCursor() | wxShow() | wxSize() | wxSpin() | wxSplitter() | wxStyledText() | wxSysColourChanged() | wxTaskBarIcon() | wxTree() | wxUpdateUI() | wxWindowCreate() | wxWindowDestroy(). +-type wxEventType() :: wxAuiManagerEventType() | wxAuiNotebookEventType() | wxCalendarEventType() | wxChildFocusEventType() | wxCloseEventType() | wxColourPickerEventType() | wxCommandEventType() | wxContextMenuEventType() | wxDateEventType() | wxDisplayChangedEventType() | wxEraseEventType() | wxFileDirPickerEventType() | wxFocusEventType() | wxFontPickerEventType() | wxGridEventType() | wxHelpEventType() | wxHtmlLinkEventType() | wxIconizeEventType() | wxIdleEventType() | wxJoystickEventType() | wxKeyEventType() | wxListEventType() | wxMaximizeEventType() | wxMenuEventType() | wxMouseCaptureChangedEventType() | wxMouseEventType() | wxMoveEventType() | wxNavigationKeyEventType() | wxNotebookEventType() | wxPaintEventType() | wxPaletteChangedEventType() | wxQueryNewPaletteEventType() | wxSashEventType() | wxScrollEventType() | wxScrollWinEventType() | wxSetCursorEventType() | wxShowEventType() | wxSizeEventType() | wxSpinEventType() | wxSplitterEventType() | wxStyledTextEventType() | wxSysColourChangedEventType() | wxTaskBarIconEventType() | wxTreeEventType() | wxUpdateUIEventType() | wxWindowCreateEventType() | wxWindowDestroyEventType(). %% Hardcoded Records -record(wxMouseState, {x :: integer(), y :: integer(), @@ -420,78 +416,78 @@ -define(wxDateTime_Country_Unknown, 0). -define(wxDateTime_Country_Default, 1). -define(wxDateTime_Country_WesternEurope_Start, 2). --define(wxDateTime_Country_EEC, ?Country_WesternEurope_Start). --define(wxDateTime_France, (?Country_WesternEurope_Start+1)). --define(wxDateTime_Germany, (?Country_WesternEurope_Start+2)). --define(wxDateTime_UK, (?Country_WesternEurope_Start+3)). --define(wxDateTime_Country_WesternEurope_End, ?UK). --define(wxDateTime_Russia, (?UK+1)). --define(wxDateTime_USA, (?UK+2)). +-define(wxDateTime_Country_EEC, ?wxDateTime_Country_WesternEurope_Start). +-define(wxDateTime_France, (?wxDateTime_Country_WesternEurope_Start+1)). +-define(wxDateTime_Germany, (?wxDateTime_Country_WesternEurope_Start+2)). +-define(wxDateTime_UK, (?wxDateTime_Country_WesternEurope_Start+3)). +-define(wxDateTime_Country_WesternEurope_End, ?wxDateTime_UK). +-define(wxDateTime_Russia, (?wxDateTime_UK+1)). +-define(wxDateTime_USA, (?wxDateTime_UK+2)). % From class wxDateTime::GregorianAdoption -define(wxDateTime_Gr_Unknown, 0). -define(wxDateTime_Gr_Standard, 1). -define(wxDateTime_Gr_Alaska, 2). -define(wxDateTime_Gr_Albania, 3). --define(wxDateTime_Gr_Austria, ?Gr_Unknown). --define(wxDateTime_Gr_Austria_Brixen, (?Gr_Unknown+1)). --define(wxDateTime_Gr_Austria_Salzburg, ?Gr_Austria_Brixen). --define(wxDateTime_Gr_Austria_Tyrol, ?Gr_Austria_Brixen). --define(wxDateTime_Gr_Austria_Carinthia, (?Gr_Austria_Brixen+1)). --define(wxDateTime_Gr_Austria_Styria, ?Gr_Austria_Carinthia). --define(wxDateTime_Gr_Belgium, (?Gr_Austria_Carinthia+1)). --define(wxDateTime_Gr_Bulgaria, ?Gr_Unknown). --define(wxDateTime_Gr_Bulgaria_1, (?Gr_Unknown+1)). --define(wxDateTime_Gr_Bulgaria_2, (?Gr_Unknown+2)). --define(wxDateTime_Gr_Bulgaria_3, (?Gr_Unknown+3)). --define(wxDateTime_Gr_Canada, ?Gr_Unknown). --define(wxDateTime_Gr_China, ?Gr_Unknown). --define(wxDateTime_Gr_China_1, (?Gr_Unknown+1)). --define(wxDateTime_Gr_China_2, (?Gr_Unknown+2)). --define(wxDateTime_Gr_Czechoslovakia, (?Gr_Unknown+3)). --define(wxDateTime_Gr_Denmark, (?Gr_Unknown+4)). --define(wxDateTime_Gr_Egypt, (?Gr_Unknown+5)). --define(wxDateTime_Gr_Estonia, (?Gr_Unknown+6)). --define(wxDateTime_Gr_Finland, (?Gr_Unknown+7)). --define(wxDateTime_Gr_France, (?Gr_Unknown+8)). --define(wxDateTime_Gr_France_Alsace, (?Gr_Unknown+9)). --define(wxDateTime_Gr_France_Lorraine, (?Gr_Unknown+10)). --define(wxDateTime_Gr_France_Strasbourg, (?Gr_Unknown+11)). --define(wxDateTime_Gr_Germany, ?Gr_Unknown). --define(wxDateTime_Gr_Germany_Catholic, (?Gr_Unknown+1)). --define(wxDateTime_Gr_Germany_Prussia, (?Gr_Unknown+2)). --define(wxDateTime_Gr_Germany_Protestant, (?Gr_Unknown+3)). --define(wxDateTime_Gr_GreatBritain, (?Gr_Unknown+4)). --define(wxDateTime_Gr_Greece, (?Gr_Unknown+5)). --define(wxDateTime_Gr_Hungary, (?Gr_Unknown+6)). --define(wxDateTime_Gr_Ireland, ?Gr_GreatBritain). --define(wxDateTime_Gr_Italy, ?Gr_Standard). --define(wxDateTime_Gr_Japan, ?Gr_Unknown). --define(wxDateTime_Gr_Japan_1, (?Gr_Unknown+1)). --define(wxDateTime_Gr_Japan_2, (?Gr_Unknown+2)). --define(wxDateTime_Gr_Japan_3, (?Gr_Unknown+3)). --define(wxDateTime_Gr_Latvia, (?Gr_Unknown+4)). --define(wxDateTime_Gr_Lithuania, (?Gr_Unknown+5)). --define(wxDateTime_Gr_Luxemburg, (?Gr_Unknown+6)). --define(wxDateTime_Gr_Netherlands, ?Gr_Belgium). --define(wxDateTime_Gr_Netherlands_Groningen, (?Gr_Belgium+1)). --define(wxDateTime_Gr_Netherlands_Gelderland, (?Gr_Belgium+2)). --define(wxDateTime_Gr_Netherlands_Utrecht, (?Gr_Belgium+3)). --define(wxDateTime_Gr_Netherlands_Friesland, (?Gr_Belgium+4)). --define(wxDateTime_Gr_Norway, ?Gr_Denmark). --define(wxDateTime_Gr_Poland, ?Gr_Standard). --define(wxDateTime_Gr_Portugal, ?Gr_Standard). --define(wxDateTime_Gr_Romania, (?Gr_Standard+1)). --define(wxDateTime_Gr_Russia, (?Gr_Standard+2)). --define(wxDateTime_Gr_Scotland, ?Gr_GreatBritain). --define(wxDateTime_Gr_Spain, ?Gr_Standard). --define(wxDateTime_Gr_Sweden, ?Gr_Finland). --define(wxDateTime_Gr_Switzerland, ?Gr_Unknown). --define(wxDateTime_Gr_Switzerland_Catholic, (?Gr_Unknown+1)). --define(wxDateTime_Gr_Switzerland_Protestant, (?Gr_Unknown+2)). --define(wxDateTime_Gr_Turkey, (?Gr_Unknown+3)). --define(wxDateTime_Gr_USA, ?Gr_GreatBritain). --define(wxDateTime_Gr_Wales, ?Gr_GreatBritain). --define(wxDateTime_Gr_Yugoslavia, (?Gr_GreatBritain+1)). +-define(wxDateTime_Gr_Austria, ?wxDateTime_Gr_Unknown). +-define(wxDateTime_Gr_Austria_Brixen, (?wxDateTime_Gr_Unknown+1)). +-define(wxDateTime_Gr_Austria_Salzburg, ?wxDateTime_Gr_Austria_Brixen). +-define(wxDateTime_Gr_Austria_Tyrol, ?wxDateTime_Gr_Austria_Brixen). +-define(wxDateTime_Gr_Austria_Carinthia, (?wxDateTime_Gr_Austria_Brixen+1)). +-define(wxDateTime_Gr_Austria_Styria, ?wxDateTime_Gr_Austria_Carinthia). +-define(wxDateTime_Gr_Belgium, (?wxDateTime_Gr_Austria_Carinthia+1)). +-define(wxDateTime_Gr_Bulgaria, ?wxDateTime_Gr_Unknown). +-define(wxDateTime_Gr_Bulgaria_1, (?wxDateTime_Gr_Unknown+1)). +-define(wxDateTime_Gr_Bulgaria_2, (?wxDateTime_Gr_Unknown+2)). +-define(wxDateTime_Gr_Bulgaria_3, (?wxDateTime_Gr_Unknown+3)). +-define(wxDateTime_Gr_Canada, ?wxDateTime_Gr_Unknown). +-define(wxDateTime_Gr_China, ?wxDateTime_Gr_Unknown). +-define(wxDateTime_Gr_China_1, (?wxDateTime_Gr_Unknown+1)). +-define(wxDateTime_Gr_China_2, (?wxDateTime_Gr_Unknown+2)). +-define(wxDateTime_Gr_Czechoslovakia, (?wxDateTime_Gr_Unknown+3)). +-define(wxDateTime_Gr_Denmark, (?wxDateTime_Gr_Unknown+4)). +-define(wxDateTime_Gr_Egypt, (?wxDateTime_Gr_Unknown+5)). +-define(wxDateTime_Gr_Estonia, (?wxDateTime_Gr_Unknown+6)). +-define(wxDateTime_Gr_Finland, (?wxDateTime_Gr_Unknown+7)). +-define(wxDateTime_Gr_France, (?wxDateTime_Gr_Unknown+8)). +-define(wxDateTime_Gr_France_Alsace, (?wxDateTime_Gr_Unknown+9)). +-define(wxDateTime_Gr_France_Lorraine, (?wxDateTime_Gr_Unknown+10)). +-define(wxDateTime_Gr_France_Strasbourg, (?wxDateTime_Gr_Unknown+11)). +-define(wxDateTime_Gr_Germany, ?wxDateTime_Gr_Unknown). +-define(wxDateTime_Gr_Germany_Catholic, (?wxDateTime_Gr_Unknown+1)). +-define(wxDateTime_Gr_Germany_Prussia, (?wxDateTime_Gr_Unknown+2)). +-define(wxDateTime_Gr_Germany_Protestant, (?wxDateTime_Gr_Unknown+3)). +-define(wxDateTime_Gr_GreatBritain, (?wxDateTime_Gr_Unknown+4)). +-define(wxDateTime_Gr_Greece, (?wxDateTime_Gr_Unknown+5)). +-define(wxDateTime_Gr_Hungary, (?wxDateTime_Gr_Unknown+6)). +-define(wxDateTime_Gr_Ireland, ?wxDateTime_Gr_GreatBritain). +-define(wxDateTime_Gr_Italy, ?wxDateTime_Gr_Standard). +-define(wxDateTime_Gr_Japan, ?wxDateTime_Gr_Unknown). +-define(wxDateTime_Gr_Japan_1, (?wxDateTime_Gr_Unknown+1)). +-define(wxDateTime_Gr_Japan_2, (?wxDateTime_Gr_Unknown+2)). +-define(wxDateTime_Gr_Japan_3, (?wxDateTime_Gr_Unknown+3)). +-define(wxDateTime_Gr_Latvia, (?wxDateTime_Gr_Unknown+4)). +-define(wxDateTime_Gr_Lithuania, (?wxDateTime_Gr_Unknown+5)). +-define(wxDateTime_Gr_Luxemburg, (?wxDateTime_Gr_Unknown+6)). +-define(wxDateTime_Gr_Netherlands, ?wxDateTime_Gr_Belgium). +-define(wxDateTime_Gr_Netherlands_Groningen, (?wxDateTime_Gr_Belgium+1)). +-define(wxDateTime_Gr_Netherlands_Gelderland, (?wxDateTime_Gr_Belgium+2)). +-define(wxDateTime_Gr_Netherlands_Utrecht, (?wxDateTime_Gr_Belgium+3)). +-define(wxDateTime_Gr_Netherlands_Friesland, (?wxDateTime_Gr_Belgium+4)). +-define(wxDateTime_Gr_Norway, ?wxDateTime_Gr_Denmark). +-define(wxDateTime_Gr_Poland, ?wxDateTime_Gr_Standard). +-define(wxDateTime_Gr_Portugal, ?wxDateTime_Gr_Standard). +-define(wxDateTime_Gr_Romania, (?wxDateTime_Gr_Standard+1)). +-define(wxDateTime_Gr_Russia, (?wxDateTime_Gr_Standard+2)). +-define(wxDateTime_Gr_Scotland, ?wxDateTime_Gr_GreatBritain). +-define(wxDateTime_Gr_Spain, ?wxDateTime_Gr_Standard). +-define(wxDateTime_Gr_Sweden, ?wxDateTime_Gr_Finland). +-define(wxDateTime_Gr_Switzerland, ?wxDateTime_Gr_Unknown). +-define(wxDateTime_Gr_Switzerland_Catholic, (?wxDateTime_Gr_Unknown+1)). +-define(wxDateTime_Gr_Switzerland_Protestant, (?wxDateTime_Gr_Unknown+2)). +-define(wxDateTime_Gr_Turkey, (?wxDateTime_Gr_Unknown+3)). +-define(wxDateTime_Gr_USA, ?wxDateTime_Gr_GreatBritain). +-define(wxDateTime_Gr_Wales, ?wxDateTime_Gr_GreatBritain). +-define(wxDateTime_Gr_Yugoslavia, (?wxDateTime_Gr_GreatBritain+1)). % From class wxDateTime::Month -define(wxDateTime_Jan, 0). -define(wxDateTime_Feb, 1). @@ -537,34 +533,34 @@ -define(wxDateTime_GMT11, 24). -define(wxDateTime_GMT12, 25). -define(wxDateTime_GMT13, 26). --define(wxDateTime_WET, ?GMT0). --define(wxDateTime_WEST, ?GMT1). --define(wxDateTime_CET, ?GMT1). --define(wxDateTime_CEST, ?GMT2). --define(wxDateTime_EET, ?GMT2). --define(wxDateTime_EEST, ?GMT3). --define(wxDateTime_MSK, ?GMT3). --define(wxDateTime_MSD, ?GMT4). --define(wxDateTime_AST, ?GMT_4). --define(wxDateTime_ADT, ?GMT_3). --define(wxDateTime_EST, ?GMT_5). --define(wxDateTime_EDT, ?GMT_4). --define(wxDateTime_CST, ?GMT_6). --define(wxDateTime_CDT, ?GMT_5). --define(wxDateTime_MST, ?GMT_7). --define(wxDateTime_MDT, ?GMT_6). --define(wxDateTime_PST, ?GMT_8). --define(wxDateTime_PDT, ?GMT_7). --define(wxDateTime_HST, ?GMT_10). --define(wxDateTime_AKST, ?GMT_9). --define(wxDateTime_AKDT, ?GMT_8). --define(wxDateTime_A_WST, ?GMT8). --define(wxDateTime_A_CST, ?GMT13+1). --define(wxDateTime_A_EST, ?GMT10). --define(wxDateTime_A_ESST, ?GMT11). --define(wxDateTime_NZST, ?GMT12). --define(wxDateTime_NZDT, ?GMT13). --define(wxDateTime_UTC, ?GMT0). +-define(wxDateTime_WET, ?wxDateTime_GMT0). +-define(wxDateTime_WEST, ?wxDateTime_GMT1). +-define(wxDateTime_CET, ?wxDateTime_GMT1). +-define(wxDateTime_CEST, ?wxDateTime_GMT2). +-define(wxDateTime_EET, ?wxDateTime_GMT2). +-define(wxDateTime_EEST, ?wxDateTime_GMT3). +-define(wxDateTime_MSK, ?wxDateTime_GMT3). +-define(wxDateTime_MSD, ?wxDateTime_GMT4). +-define(wxDateTime_AST, ?wxDateTime_GMT_4). +-define(wxDateTime_ADT, ?wxDateTime_GMT_3). +-define(wxDateTime_EST, ?wxDateTime_GMT_5). +-define(wxDateTime_EDT, ?wxDateTime_GMT_4). +-define(wxDateTime_CST, ?wxDateTime_GMT_6). +-define(wxDateTime_CDT, ?wxDateTime_GMT_5). +-define(wxDateTime_MST, ?wxDateTime_GMT_7). +-define(wxDateTime_MDT, ?wxDateTime_GMT_6). +-define(wxDateTime_PST, ?wxDateTime_GMT_8). +-define(wxDateTime_PDT, ?wxDateTime_GMT_7). +-define(wxDateTime_HST, ?wxDateTime_GMT_10). +-define(wxDateTime_AKST, ?wxDateTime_GMT_9). +-define(wxDateTime_AKDT, ?wxDateTime_GMT_8). +-define(wxDateTime_A_WST, ?wxDateTime_GMT8). +-define(wxDateTime_A_CST, (?wxDateTime_GMT13+1)). +-define(wxDateTime_A_EST, ?wxDateTime_GMT10). +-define(wxDateTime_A_ESST, ?wxDateTime_GMT11). +-define(wxDateTime_NZST, ?wxDateTime_GMT12). +-define(wxDateTime_NZDT, ?wxDateTime_GMT13). +-define(wxDateTime_UTC, ?wxDateTime_GMT0). % From class wxDateTime::WeekDay -define(wxDateTime_Sun, 0). -define(wxDateTime_Mon, 1). @@ -579,7 +575,6 @@ -define(wxDateTime_Monday_First, 1). -define(wxDateTime_Sunday_First, 2). % From class wxDateTime::Year --define(wxDateTime_Inv_Year, ?SHRT_MIN). % From class wxDialog -define(wxDialog_ButtonSizerFlags, (?wxOK bor ?wxCANCEL bor ?wxYES bor ?wxNO bor ?wxHELP bor ?wxNO_DEFAULT)). % From class wxGrid @@ -760,6 +755,7 @@ -define(wxCLRP_DEFAULT_STYLE, 0). -define(wxCLRP_USE_TEXTCTRL, ?wxPB_USE_TEXTCTRL). -define(wxCLRP_SHOW_LABEL, 8). +% From "cmndata.h" % From "cmndata.h": wxPrintBin -define(wxPRINTBIN_DEFAULT, 0). -define(wxPRINTBIN_ONLYONE, 1). @@ -782,6 +778,8 @@ -define(wxC2S_NAME, 1). % From "confbase.h" -define(wxCONFIG_CASE_SENSITIVE, 0). +% From "cpp.h" +-define(wxEMPTY_PARAMETER_VALUE, ()). % From "datectrl.h" -define(wxDP_DEFAULT, 0). -define(wxDP_SPIN, 1). @@ -789,7 +787,6 @@ -define(wxDP_SHOWCENTURY, 4). -define(wxDP_ALLOWNONE, 8). % From "datetime.h" --define(wxInvalidDateTime, ?wxDefaultDateTime). % From "dcbuffer.h" -define(wxBUFFER_CLIENT_AREA, 2). -define(wxBUFFER_VIRTUAL_AREA, 1). @@ -1560,13 +1557,13 @@ % From "event.h" % From "event.h": Propagation_state -define(wxEVENT_PROPAGATE_NONE, 0). --define(wxEVENT_PROPAGATE_MAX, ?INT_MAX). % From "event.h": wxIdleMode -define(wxIDLE_PROCESS_ALL, 0). -define(wxIDLE_PROCESS_SPECIFIED, 1). % From "event.h": wxUpdateUIMode -define(wxUPDATE_UI_PROCESS_ALL, 0). -define(wxUPDATE_UI_PROCESS_SPECIFIED, 1). +% From "fdrepdlg.h" % From "fdrepdlg.h": wxFindReplaceDialogStyles -define(wxFR_REPLACEDIALOG, 1). -define(wxFR_NOUPDOWN, 2). @@ -1810,7 +1807,6 @@ -define(wxGA_VERTICAL, ?wxVERTICAL). -define(wxGA_HORIZONTAL, ?wxHORIZONTAL). % From "gdicmn.h" --define(wxGetDisplayDepth, ?wxDisplayDepth). % From "gdicmn.h": wxBitmapType -define(wxBITMAP_TYPE_INVALID, 0). -define(wxBITMAP_TYPE_BMP, 1). @@ -2091,7 +2087,6 @@ -define(wxLB_TOP, ?wxBK_TOP). -define(wxLB_DEFAULT, ?wxBK_DEFAULT). % From "log.h" --define(wxTRACE_OleCalls, ?wxEmptyString). -define(wxTraceRefCount, 8). -define(wxTraceResAlloc, 4). -define(wxTraceMessages, 2). @@ -2195,7 +2190,8 @@ -define(wxSYS_COLOUR_MENUHILIGHT, (?wxSYS_COLOUR_BTNHIGHLIGHT+9)). -define(wxSYS_COLOUR_MENUBAR, (?wxSYS_COLOUR_BTNHIGHLIGHT+10)). -define(wxSYS_COLOUR_LISTBOXTEXT, (?wxSYS_COLOUR_BTNHIGHLIGHT+11)). --define(wxSYS_COLOUR_MAX, (?wxSYS_COLOUR_BTNHIGHLIGHT+12)). +-define(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT, (?wxSYS_COLOUR_BTNHIGHLIGHT+12)). +-define(wxSYS_COLOUR_MAX, (?wxSYS_COLOUR_BTNHIGHLIGHT+13)). % From "settings.h": wxSystemFeature -define(wxSYS_CAN_DRAW_FRAME_DECORATIONS, 1). -define(wxSYS_CAN_ICONIZE_FRAME, 2). @@ -3797,6 +3793,7 @@ -define(wxRELEASE_NUMBER, wxe_util:get_const(wxRELEASE_NUMBER)). -define(wxMINOR_VERSION, wxe_util:get_const(wxMINOR_VERSION)). -define(wxMAJOR_VERSION, wxe_util:get_const(wxMAJOR_VERSION)). +% From "window.h" % From "window.h": wxWindowVariant -define(wxWINDOW_VARIANT_NORMAL, 0). -define(wxWINDOW_VARIANT_SMALL, 1). diff --git a/lib/wx/src/Makefile b/lib/wx/src/Makefile index 777fb7d998..26574ed86f 100644 --- a/lib/wx/src/Makefile +++ b/lib/wx/src/Makefile @@ -101,19 +101,19 @@ archive: opt # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk Makefile - sed -e 's;%GEN_MODS%;$(GEN_MODS);' $< > [email protected] - sed -e 's;%VSN%;$(VSN);' [email protected] > $@ - rm [email protected] + $(gen_verbose)sed -e 's;%GEN_MODS%;$(GEN_MODS);' $< > [email protected] + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' [email protected] > $@ + $(V_at)rm [email protected] $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk Makefile - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # Rules $(EBIN)/%.beam: $(ESRC)/%.erl $(HEADER_FILES) - $(ERLC) -W -bbeam $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(V_ERLC) -W -bbeam $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< $(EBIN)/%.beam: $(EGEN)/%.erl $(HEADER_FILES) - $(ERLC) -W -bbeam $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(V_ERLC) -W -bbeam $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< # ---------------------------------------------------- # Release Target diff --git a/lib/wx/src/gen/gl.erl b/lib/wx/src/gen/gl.erl index ff381683ee..8a8158c35e 100644 --- a/lib/wx/src/gen/gl.erl +++ b/lib/wx/src/gen/gl.erl @@ -1,7 +1,9 @@ +%% -*- coding: utf-8 -*- + %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -460,7 +462,7 @@ alphaFunc(Func,Ref) -> %% as (R s0 G s0 B s0 A s0), (R s1 G s1 B s1 A s1) and (R d G d B d A d), respectively. The color specified by {@link gl:blendColor/4} is referred to %% as (R c G c B c A c). They are understood to have integer values between 0 and (k R k G k B k A), where %% -%% k c= 2(m c)-1 +%% k c=2(m c)-1 %% %% and (m R m G m B m A) is the number of red, green, blue, and alpha bitplanes. %% @@ -489,12 +491,12 @@ alphaFunc(Func,Ref) -> %% %% In the table, %% -%% i= min(A s k A-A d) k/A +%% i=min(A s k A-A d) k/A %% %% To determine the blended RGBA values of a pixel, the system uses the following equations: %% %% -%% R d= min(k R R s s R+R d d R) G d= min(k G G s s G+G d d G) B d= min(k B B s s B+B d d B) A d= min(k A A s s A+A d d A) +%% R d=min(k R R s s R+R d d R) G d=min(k G G s s G+G d d G) B d=min(k B B s s B+B d d B) A d=min(k A A s s A+A d d A) %% %% Despite the apparent precision of the above equations, blending arithmetic is not exactly %% specified, because blending operates with imprecise integer color values. However, a blend @@ -503,7 +505,7 @@ alphaFunc(Func,Ref) -> %% , `Dfactor' is `?GL_ONE_MINUS_SRC_ALPHA', and A s is equal to k A, the equations %% reduce to simple replacement: %% -%% R d= R s G d= G s B d= B s A d= A s +%% R d=R s G d=G s B d=B s A d=A s %% %% %% @@ -643,7 +645,7 @@ lineWidth(Width) -> %% is 0, otherwise these fragments are sent to the frame buffer. Bit zero of `Pattern' %% is the least significant bit. %% -%% Antialiased lines are treated as a sequence of 1*width rectangles for purposes of stippling. +%% Antialiased lines are treated as a sequence of 1×width rectangles for purposes of stippling. %% Whether rectangle s is rasterized or not depends on the fragment rule described for %% aliased lines, counting rectangles rather than groups of fragments. %% @@ -690,7 +692,7 @@ polygonMode(Face,Mode) -> %% When `?GL_POLYGON_OFFSET_FILL', `?GL_POLYGON_OFFSET_LINE', or `?GL_POLYGON_OFFSET_POINT' %% is enabled, each fragment's `depth' value will be offset after it is interpolated %% from the `depth' values of the appropriate vertices. The value of the offset is -%% factor*DZ+r*units, where DZ is a measurement of the change in depth relative to the +%% factor×DZ+r×units, where DZ is a measurement of the change in depth relative to the %% screen area of the polygon, and r is the smallest value that is guaranteed to produce %% a resolvable offset for a given implementation. The offset is added before the depth test %% is performed and before the value is written into the depth buffer. @@ -709,10 +711,10 @@ polygonOffset(Factor,Units) -> %% fragments produced by rasterization, creating a pattern. Stippling is independent of polygon %% antialiasing. %% -%% `Pattern' is a pointer to a 32*32 stipple pattern that is stored in memory just +%% `Pattern' is a pointer to a 32×32 stipple pattern that is stored in memory just %% like the pixel data supplied to a {@link gl:drawPixels/5} call with height and `width' %% both equal to 32, a pixel format of `?GL_COLOR_INDEX', and data type of `?GL_BITMAP' -%% . That is, the stipple pattern is represented as a 32*32 array of 1-bit color indices +%% . That is, the stipple pattern is represented as a 32×32 array of 1-bit color indices %% packed in unsigned bytes. {@link gl:pixelStoref/2} parameters like `?GL_UNPACK_SWAP_BYTES' %% and `?GL_UNPACK_LSB_FIRST' affect the assembling of the bits into a stipple pattern. %% Pixel transfer operations (shift, offset, pixel map) are not applied to the stipple image, @@ -737,10 +739,10 @@ polygonStipple(Mask) -> %% @doc Return the polygon stipple pattern %% -%% ``gl:getPolygonStipple'' returns to `Pattern' a 32*32 polygon stipple pattern. +%% ``gl:getPolygonStipple'' returns to `Pattern' a 32×32 polygon stipple pattern. %% The pattern is packed into memory as if {@link gl:readPixels/7} with both `height' %% and `width' of 32, `type' of `?GL_BITMAP', and `format' of `?GL_COLOR_INDEX' -%% were called, and the stipple pattern were stored in an internal 32*32 color index buffer. +%% were called, and the stipple pattern were stored in an internal 32×32 color index buffer. %% Unlike {@link gl:readPixels/7} , however, pixel transfer operations (shift, offset, pixel %% map) are not applied to the returned stipple image. %% @@ -2635,7 +2637,7 @@ loadIdentity() -> %% and `M' points to an array of 16 single- or double-precision floating-point values %% m={m[0] m[1] ... m[15]}, then the modelview transformation M(v) does the following: %% -%% M(v)=(m[0] m[4] m[8] m[12] m[1] m[5] m[9] m[13] m[2] m[6] m[10] m[14] m[3] m[7] m[11] m[15])*(v[0] v[1] v[2] v[3]) +%% M(v)=(m[0] m[4] m[8] m[12] m[1] m[5] m[9] m[13] m[2] m[6] m[10] m[14] m[3] m[7] m[11] m[15])×(v[0] v[1] v[2] v[3]) %% %% Projection and texture transformations are similarly defined. %% @@ -2687,7 +2689,7 @@ multMatrixf({M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12}) -> %% (x 2(1-c)+c x y(1-c)-z s x z(1-c)+y s 0 y x(1-c)+z s y 2(1-c)+c y z(1-c)-x s 0 x z(1-c)-y s y z(1-c)+x s z 2(1-c)+c 0 0 0 0 %% 1) %% -%% Where c= cos(angle), s= sin(angle), and ||(x y z)||= 1 (if not, the GL will normalize this vector). +%% Where c=cos(angle), s=sin(angle), and ||(x y z)||=1 (if not, the GL will normalize this vector). %% %% If the matrix mode is either `?GL_MODELVIEW' or `?GL_PROJECTION', all objects %% drawn after ``gl:rotate'' is called are rotated. Use {@link gl:pushMatrix/0} and {@link gl:pushMatrix/0} @@ -3814,7 +3816,7 @@ rasterPos4sv({X,Y,Z,W}) -> rasterPos4s(X,Y,Z,W). %% ``gl:rect'' supports efficient specification of rectangles as two corner points. Each %% rectangle command takes four arguments, organized either as two consecutive pairs of (x y) %% coordinates or as two pointers to arrays, each containing an (x y) pair. The resulting rectangle -%% is defined in the z= 0 plane. +%% is defined in the z=0 plane. %% %% ``gl:rect''( `X1' , `Y1' , `X2' , `Y2' ) is exactly equivalent to the %% following sequence: glBegin(`?GL_POLYGON'); glVertex2( `X1' , `Y1' ); glVertex2( @@ -4684,9 +4686,9 @@ pixelZoom(Xfactor,Yfactor) -> %% is the number of pixels in a row (`?GL_PACK_ROW_LENGTH' if it is greater than 0, %% the width argument to the pixel routine otherwise), a is the value of `?GL_PACK_ALIGNMENT' %% , and s is the size, in bytes, of a single component (if a< s, then it is as if a= -%% s). In the case of 1-bit values, the location of the next row is obtained by skipping +%% s). In the case of 1-bit values, the location of the next row is obtained by skipping %% -%% k= 8 a |(n l)/(8 a)| +%% k=8 a |(n l)/(8 a)| %% %% components or indices. %% @@ -4708,7 +4710,7 @@ pixelZoom(Xfactor,Yfactor) -> %% a pixel image (`?GL_PACK_IMAGE_HEIGHT' if it is greater than 0, the height argument %% to the {@link gl:texImage3D/10} routine otherwise), a is the value of `?GL_PACK_ALIGNMENT' %% , and s is the size, in bytes, of a single component (if a< s, then it is as if -%% a= s). +%% a=s). %% %% The word `component' in this description refers to the nonindex values red, green, %% blue, alpha, and depth. Storage format `?GL_RGB', for example, has three components @@ -4758,9 +4760,9 @@ pixelZoom(Xfactor,Yfactor) -> %% is the number of pixels in a row (`?GL_UNPACK_ROW_LENGTH' if it is greater than 0, %% the width argument to the pixel routine otherwise), a is the value of `?GL_UNPACK_ALIGNMENT' %% , and s is the size, in bytes, of a single component (if a< s, then it is as if a= -%% s). In the case of 1-bit values, the location of the next row is obtained by skipping +%% s). In the case of 1-bit values, the location of the next row is obtained by skipping %% -%% k= 8 a |(n l)/(8 a)| +%% k=8 a |(n l)/(8 a)| %% %% components or indices. %% @@ -4781,8 +4783,8 @@ pixelZoom(Xfactor,Yfactor) -> %% the width argument to {@link gl:texImage3D/10} otherwise), h is the number of rows in %% an image (`?GL_UNPACK_IMAGE_HEIGHT' if it is greater than 0, the height argument %% to {@link gl:texImage3D/10} otherwise), a is the value of `?GL_UNPACK_ALIGNMENT', -%% and s is the size, in bytes, of a single component (if a< s, then it is as if a= -%% s). +%% and s is the size, in bytes, of a single component (if a< s, then it is as if a=s). +%% %% %% The word `component' in this description refers to the nonindex values red, green, %% blue, alpha, and depth. Storage format `?GL_RGB', for example, has three components @@ -5327,7 +5329,7 @@ readPixels(X,Y,Width,Height,Format,Type,Pixels) -> %% or `?GL_STENCIL_INDEX'. Each unsigned byte is treated as eight 1-bit pixels, with %% bit ordering determined by `?GL_UNPACK_LSB_FIRST' (see {@link gl:pixelStoref/2} ). %% -%% width*height pixels are read from memory, starting at location `Data' . By default, +%% width×height pixels are read from memory, starting at location `Data' . By default, %% these pixels are taken from adjacent memory locations, except that after all `Width' %% pixels are read, the read pointer is advanced to the next four-byte boundary. The four-byte %% row alignment is specified by {@link gl:pixelStoref/2} with argument `?GL_UNPACK_ALIGNMENT' @@ -5340,7 +5342,7 @@ readPixels(X,Y,Width,Height,Format,Type,Pixels) -> %% (see {@link gl:bindBuffer/2} ) while a block of pixels is specified, `Data' is treated %% as a byte offset into the buffer object's data store. %% -%% The width*height pixels that are read from memory are each operated on in the same +%% The width×height pixels that are read from memory are each operated on in the same %% way, based on the values of several parameters specified by {@link gl:pixelTransferf/2} %% and {@link gl:pixelMapfv/3} . The details of these operations, as well as the target buffer %% into which the pixels are drawn, are specific to the format of the pixels, as specified @@ -5366,10 +5368,10 @@ readPixels(X,Y,Width,Height,Format,Type,Pixels) -> %% %% The GL then converts the resulting indices or RGBA colors to fragments by attaching the %% current raster position `z' coordinate and texture coordinates to each pixel, then -%% assigning x and y window coordinates to the nth fragment such that x n= x r+n% -%% width +%% assigning x and y window coordinates to the nth fragment such that x n=x r+n% width +%% %% -%% y n= y r+|n/width| +%% y n=y r+|n/width| %% %% where (x r y r) is the current raster position. These pixel fragments are then treated just like %% the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, @@ -5391,9 +5393,9 @@ readPixels(X,Y,Width,Height,Format,Type,Pixels) -> %% the number of bits in the stencil buffer. The resulting stencil indices are then written %% to the stencil buffer such that the nth index is written to location %% -%% x n= x r+n% width +%% x n=x r+n% width %% -%% y n= y r+|n/width| +%% y n=y r+|n/width| %% %% where (x r y r) is the current raster position. Only the pixel ownership test, the scissor test, %% and the stencil writemask affect these write operations. @@ -5411,9 +5413,9 @@ readPixels(X,Y,Width,Height,Format,Type,Pixels) -> %% raster position color or color index and texture coordinates to each pixel, then assigning %% x and y window coordinates to the nth fragment such that %% -%% x n= x r+n% width +%% x n=x r+n% width %% -%% y n= y r+|n/width| +%% y n=y r+|n/width| %% %% where (x r y r) is the current raster position. These pixel fragments are then treated just like %% the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, @@ -5442,9 +5444,9 @@ readPixels(X,Y,Width,Height,Format,Type,Pixels) -> %% raster position `z' coordinate and texture coordinates to each pixel, then assigning %% x and y window coordinates to the nth fragment such that %% -%% x n= x r+n% width +%% x n=x r+n% width %% -%% y n= y r+|n/width| +%% y n=y r+|n/width| %% %% where (x r y r) is the current raster position. These pixel fragments are then treated just like %% the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, @@ -5810,7 +5812,7 @@ clearStencil(S) -> %% %% If the texture generation function is `?GL_OBJECT_LINEAR', the function %% -%% g= p 1*x o+p 2*y o+p 3*z o+p 4*w o +%% g=p 1×x o+p 2×y o+p 3×z o+p 4×w o %% %% is used, where g is the value computed for the coordinate named in `Coord' , p 1, %% p 2, p 3, and p 4 are the four values supplied in `Params' , and x o, y o, z o, @@ -5823,7 +5825,7 @@ clearStencil(S) -> %% %% If the texture generation function is `?GL_EYE_LINEAR', the function %% -%% g=(p 1)"*x e+(p 2)"*y e+(p 3)"*z e+(p 4)"*w e +%% g=(p 1)"×x e+(p 2)"×y e+(p 3)"×z e+(p 4)"×w e %% %% is used, where %% @@ -5847,14 +5849,14 @@ clearStencil(S) -> %% %% f=(f x f y f z) T be the reflection vector such that %% -%% f= u-2 n" (n") T u +%% f=u-2 n" (n") T u %% -%% Finally, let m= 2 ((f x) 2+(f y) 2+(f z+1) 2). Then the values assigned to the s and t texture coordinates +%% Finally, let m=2 ((f x) 2+(f y) 2+(f z+1) 2). Then the values assigned to the s and t texture coordinates %% are %% -%% s= f x/m+1/2 +%% s=f x/m+1/2 %% -%% t= f y/m+1/2 +%% t=f y/m+1/2 %% %% To enable or disable a texture-coordinate generation function, call {@link gl:enable/1} %% or {@link gl:enable/1} with one of the symbolic texture-coordinate names (`?GL_TEXTURE_GEN_S' @@ -6002,7 +6004,7 @@ texEnvi(Target,Pname,Param) -> %% `?GL_BLEND' Function </td><td>`?GL_ADD' Function </td></tr></tbody><tbody><tr><td> %% `?GL_ALPHA'</td><td> C v=</td><td> C p</td><td> C p</td><td> undefined </td><td> C p</td> %% <td> C p</td></tr><tr><td></td><td> A v=</td><td> A s</td><td> A p A s</td><td></td><td> -%% A v= A p A s</td><td> A p A s</td></tr><tr><td>`?GL_LUMINANCE'</td><td> C v=</td><td> +%% A v=A p A s</td><td> A p A s</td></tr><tr><td>`?GL_LUMINANCE'</td><td> C v=</td><td> %% C s</td><td> C p C s</td><td> undefined </td><td> C p (1-C s)+C c C s</td><td> C p+C s</td></tr> %% <tr><td> (or 1) </td><td> A v=</td><td> A p</td><td> A p</td><td></td><td> A p</td><td> A %% p</td></tr><tr><td>`?GL_LUMINANCE_ALPHA'</td><td> C v=</td><td> C s</td><td> C p C @@ -6034,11 +6036,11 @@ texEnvi(Target,Pname,Param) -> %% %% <table><tbody><tr><td>`?GL_COMBINE_RGB'</td><td>` Texture Function '</td></tr></tbody> %% <tbody><tr><td>`?GL_REPLACE'</td><td> Arg0</td></tr><tr><td>`?GL_MODULATE'</td><td> -%% Arg0*Arg1</td></tr><tr><td>`?GL_ADD'</td><td> Arg0+Arg1</td></tr><tr><td>`?GL_ADD_SIGNED' -%% </td><td> Arg0+Arg1-0.5</td></tr><tr><td>`?GL_INTERPOLATE'</td><td> Arg0*Arg2+Arg1*(1- +%% Arg0×Arg1</td></tr><tr><td>`?GL_ADD'</td><td> Arg0+Arg1</td></tr><tr><td>`?GL_ADD_SIGNED' +%% </td><td> Arg0+Arg1-0.5</td></tr><tr><td>`?GL_INTERPOLATE'</td><td> Arg0×Arg2+Arg1×(1- %% Arg2)</td> %% </tr><tr><td>`?GL_SUBTRACT'</td><td> Arg0-Arg1</td></tr><tr><td>`?GL_DOT3_RGB' -%% or `?GL_DOT3_RGBA'</td><td> 4*((((Arg0 r)-0.5)*((Arg1 r)-0.5))+(((Arg0 g)-0.5)*((Arg1 g)-0.5))+(((Arg0 b)-0.5)*((Arg1 b)-0.5)))</td></tr></tbody></table> +%% or `?GL_DOT3_RGBA'</td><td> 4×((((Arg0 r)-0.5)×((Arg1 r)-0.5))+(((Arg0 g)-0.5)×((Arg1 g)-0.5))+(((Arg0 b)-0.5)×((Arg1 b)-0.5)))</td></tr></tbody></table> %% %% The scalar results for `?GL_DOT3_RGB' and `?GL_DOT3_RGBA' are placed into each %% of the 3 (RGB) or 4 (RGBA) components on output. @@ -6049,8 +6051,8 @@ texEnvi(Target,Pname,Param) -> %% %% <table><tbody><tr><td>`?GL_COMBINE_ALPHA'</td><td>` Texture Function '</td></tr> %% </tbody><tbody><tr><td>`?GL_REPLACE'</td><td> Arg0</td></tr><tr><td>`?GL_MODULATE' -%% </td><td> Arg0*Arg1</td></tr><tr><td>`?GL_ADD'</td><td> Arg0+Arg1</td></tr><tr><td>`?GL_ADD_SIGNED' -%% </td><td> Arg0+Arg1-0.5</td></tr><tr><td>`?GL_INTERPOLATE'</td><td> Arg0*Arg2+Arg1*(1- +%% </td><td> Arg0×Arg1</td></tr><tr><td>`?GL_ADD'</td><td> Arg0+Arg1</td></tr><tr><td>`?GL_ADD_SIGNED' +%% </td><td> Arg0+Arg1-0.5</td></tr><tr><td>`?GL_INTERPOLATE'</td><td> Arg0×Arg2+Arg1×(1- %% Arg2)</td> %% </tr><tr><td>`?GL_SUBTRACT'</td><td> Arg0-Arg1</td></tr></tbody></table> %% @@ -6245,19 +6247,18 @@ getTexEnviv(Target,Pname) -> %% If the values for `?GL_TEXTURE_BORDER_COLOR' are specified with ``gl:texParameterIiv'' %% or ``gl:texParameterIuiv'', the values are stored unmodified with an internal data %% type of integer. If specified with ``gl:texParameteriv'', they are converted to floating -%% point with the following equation: f= 2 c+1 2 b-/1. If specified with ``gl:texParameterfv'' +%% point with the following equation: f=2 c+1 2 b-/1. If specified with ``gl:texParameterfv'' %% , they are stored unmodified as floating-point values. %% %% `?GL_TEXTURE_COMPARE_FUNC': Specifies the comparison operator used when `?GL_TEXTURE_COMPARE_MODE' %% is set to `?GL_COMPARE_REF_TO_TEXTURE'. Permissible values are: <table><tbody><tr><td> %% ` Texture Comparison Function '</td><td>` Computed result '</td></tr></tbody><tbody> -%% <tr><td>`?GL_LEQUAL'</td><td> result={1.0 0.0 &nbsp;&nbsp; r<=(D t) r>(D t))</td></tr><tr><td>`?GL_GEQUAL'</td><td> -%% result={1.0 0.0 &nbsp;&nbsp; r>=(D t) r<(D t))</td></tr><tr><td>`?GL_LESS'</td><td> result={1.0 0.0 &nbsp;&nbsp; r< -%% (D t) r>=(D t))</td></tr><tr><td>`?GL_GREATER' -%% </td><td> result={1.0 0.0 &nbsp;&nbsp; r>(D t) r<=(D t))</td></tr><tr><td>`?GL_EQUAL'</td><td> result={1.0 0.0 &nbsp;&nbsp; -%% r=(D t) r&ne;(D t))</td></tr><tr><td>`?GL_NOTEQUAL' -%% </td><td> result={1.0 0.0 &nbsp;&nbsp; r&ne;(D t) r=(D t))</td></tr><tr><td>`?GL_ALWAYS'</td><td> result= 1.0</td></tr><tr><td> -%% `?GL_NEVER'</td><td> result= 0.0</td></tr></tbody></table> where r is the current +%% <tr><td>`?GL_LEQUAL'</td><td> result={1.0 0.0 r<=(D t) r>(D t))</td></tr><tr><td>`?GL_GEQUAL'</td><td> +%% result={1.0 0.0 r>=(D t) r<(D t))</td></tr><tr><td>`?GL_LESS'</td><td> result={1.0 0.0 r<(D t) r>=(D t))</td></tr><tr><td>`?GL_GREATER' +%% </td><td> result={1.0 0.0 r>(D t) r<=(D t))</td></tr><tr><td>`?GL_EQUAL'</td><td> result={1.0 0.0 r=(D t) r&ne; +%% (D t))</td></tr><tr><td>`?GL_NOTEQUAL' +%% </td><td> result={1.0 0.0 r&ne;(D t) r=(D t))</td></tr><tr><td>`?GL_ALWAYS'</td><td> result=1.0</td></tr><tr><td> +%% `?GL_NEVER'</td><td> result=0.0</td></tr></tbody></table> where r is the current %% interpolated texture coordinate, and D t is the depth texture value sampled from the %% currently bound depth texture. result is assigned to the the red channel. %% @@ -6286,14 +6287,14 @@ getTexEnviv(Target,Pname) -> %% The other four use mipmaps. %% %% A mipmap is an ordered set of arrays representing the same image at progressively lower -%% resolutions. If the texture has dimensions 2 n*2 m, there are max(n m)+1 mipmaps. The first -%% mipmap is the original texture, with dimensions 2 n*2 m. Each subsequent mipmap has -%% dimensions 2(k-1)*2(l-1), where 2 k*2 l are the dimensions of the previous mipmap, until either -%% k= 0 or l= 0. At that point, subsequent mipmaps have dimension 1*2(l-1) or 2(k-1)*1 until -%% the final mipmap, which has dimension 1*1. To define the mipmaps, call {@link gl:texImage1D/8} +%% resolutions. If the texture has dimensions 2 n×2 m, there are max(n m)+1 mipmaps. The first +%% mipmap is the original texture, with dimensions 2 n×2 m. Each subsequent mipmap has +%% dimensions 2(k-1)×2(l-1), where 2 k×2 l are the dimensions of the previous mipmap, until either +%% k=0 or l=0. At that point, subsequent mipmaps have dimension 1×2(l-1) or 2(k-1)×1 until +%% the final mipmap, which has dimension 1×1. To define the mipmaps, call {@link gl:texImage1D/8} %% , {@link gl:texImage2D/9} , {@link gl:texImage3D/10} , {@link gl:copyTexImage1D/7} , or {@link gl:copyTexImage2D/8} %% with the `level' argument indicating the order of the mipmaps. Level 0 is the original -%% texture; level max(n m) is the final 1*1 mipmap. +%% texture; level max(n m) is the final 1×1 mipmap. %% %% `Params' supplies a function for minifying the texture as one of the following: %% @@ -7255,7 +7256,7 @@ map2f(Target,U1,U2,Ustride,Uorder,V1,V2,Vstride,Vorder,Points) -> %% `Query' can assume the following values: %% %% `?GL_COEFF': `V' returns the control points for the evaluator function. One-dimensional -%% evaluators return order control points, and two-dimensional evaluators return uorder*vorder +%% evaluators return order control points, and two-dimensional evaluators return uorder×vorder %% control points. Each control point consists of one, two, three, or four integer, single-precision %% floating-point, or double-precision floating-point values, depending on the type of the %% evaluator. The GL returns two-dimensional control points in row-major order, incrementing @@ -7330,9 +7331,9 @@ getMapiv(Target,Query,V) -> %% `?GL_AUTO_NORMAL', ``gl:evalCoord2'' generates surface normals analytically, regardless %% of the contents or enabling of the `?GL_MAP2_NORMAL' map. Let %% -%% m=((&PartialD; p)/(&PartialD; u))*((&PartialD; p)/(&PartialD; v)) +%% m=((&PartialD; p)/(&PartialD; u))×((&PartialD; p)/(&PartialD; v)) %% -%% Then the generated normal n is n= m/(||m||) +%% Then the generated normal n is n=m/(||m||) %% %% If automatic normal generation is disabled, the corresponding normal map `?GL_MAP2_NORMAL' %% , if enabled, is used to produce a normal. If neither automatic normal generation nor @@ -7393,17 +7394,17 @@ evalCoord2fv({U,V}) -> evalCoord2f(U,V). %% 0 maps exactly to `U1' , and integer grid coordinate `Un' maps exactly to `U2' %% . All other integer grid coordinates i are mapped so that %% -%% u= i(u2-u1)/un+u1 +%% u=i(u2-u1)/un+u1 %% %% ``gl:mapGrid2'' specifies two such linear mappings. One maps integer grid coordinate -%% i= 0 exactly to `U1' , and integer grid coordinate i= un exactly to `U2' . The -%% other maps integer grid coordinate j= 0 exactly to `V1' , and integer grid coordinate -%% j= vn exactly to `V2' . Other integer grid coordinates i and j are mapped such +%% i=0 exactly to `U1' , and integer grid coordinate i=un exactly to `U2' . The +%% other maps integer grid coordinate j=0 exactly to `V1' , and integer grid coordinate +%% j=vn exactly to `V2' . Other integer grid coordinates i and j are mapped such %% that %% -%% u= i(u2-u1)/un+u1 +%% u=i(u2-u1)/un+u1 %% -%% v= j(v2-v1)/vn+v1 +%% v=j(v2-v1)/vn+v1 %% %% The mappings specified by ``gl:mapGrid'' are used identically by {@link gl:evalMesh1/3} %% and {@link gl:evalPoint1/1} . @@ -7440,7 +7441,7 @@ mapGrid2f(Un,U1,U2,Vn,V1,V2) -> %% 1 ); where &Delta; u=(u 2-u 1)/n %% %% and n, u 1, and u 2 are the arguments to the most recent {@link gl:mapGrid1d/3} command. -%% The one absolute numeric requirement is that if i= n, then the value computed from i.&Delta; +%% The one absolute numeric requirement is that if i=n, then the value computed from i.&Delta; %% u+u 1 is exactly u 2. %% %% In the two-dimensional case, ``gl:evalPoint2'', let @@ -7452,8 +7453,8 @@ mapGrid2f(Un,U1,U2,Vn,V1,V2) -> %% where n, u 1, u 2, m, v 1, and v 2 are the arguments to the most recent {@link gl:mapGrid1d/3} %% command. Then the ``gl:evalPoint2'' command is equivalent to calling glEvalCoord2( i. %% &Delta; u+u 1, j.&Delta; v+v 1 ); The only absolute numeric requirements are -%% that if i= n, then the value computed from i.&Delta; u+u 1 is exactly u 2, and -%% if j= m, then the value computed from j.&Delta; v+v 1 is exactly v 2. +%% that if i=n, then the value computed from i.&Delta; u+u 1 is exactly u 2, and +%% if j=m, then the value computed from j.&Delta; v+v 1 is exactly v 2. %% %% See <a href="http://www.opengl.org/sdk/docs/man/xhtml/glEvalPoint.xml">external</a> documentation. -spec evalPoint1(I) -> ok when I :: integer(). @@ -7486,8 +7487,8 @@ evalPoint2(I,J) -> %% `type' is `?GL_POINTS' if `Mode' is `?GL_POINT', or `?GL_LINES' %% if `Mode' is `?GL_LINE'. %% -%% The one absolute numeric requirement is that if i= n, then the value computed from i. -%% &Delta; u+u 1 is exactly u 2. +%% The one absolute numeric requirement is that if i=n, then the value computed from i.&Delta; +%% u+u 1 is exactly u 2. %% %% In the two-dimensional case, ``gl:evalMesh2'', let .cp &Delta; u=(u 2-u 1)/n %% @@ -7516,8 +7517,8 @@ evalPoint2(I,J) -> %% ; i <= `I2' ; i += 1 ) glEvalCoord2( i.&Delta; u+u 1, j.&Delta; v+v 1 %% ); glEnd(); %% -%% In all three cases, the only absolute numeric requirements are that if i= n, then the -%% value computed from i.&Delta; u+u 1 is exactly u 2, and if j= m, then the value +%% In all three cases, the only absolute numeric requirements are that if i=n, then the +%% value computed from i.&Delta; u+u 1 is exactly u 2, and if j=m, then the value %% computed from j.&Delta; v+v 1 is exactly v 2. %% %% See <a href="http://www.opengl.org/sdk/docs/man/xhtml/glEvalMesh.xml">external</a> documentation. @@ -7578,21 +7579,21 @@ evalMesh2(Mode,I1,I2,J1,J2) -> %% (in the case that `?GL_FOG_COORD_SRC' is `?GL_FOG_COORD'). The equation for `?GL_LINEAR' %% fog is f=(end-c)/(end-start) %% -%% The equation for `?GL_EXP' fog is f= e(-(density. c)) +%% The equation for `?GL_EXP' fog is f=e(-(density. c)) %% -%% The equation for `?GL_EXP2' fog is f= e(-(density. c)) 2 +%% The equation for `?GL_EXP2' fog is f=e(-(density. c)) 2 %% %% Regardless of the fog mode, f is clamped to the range [0 1] after it is computed. Then, %% if the GL is in RGBA color mode, the fragment's red, green, and blue colors, represented %% by C r, are replaced by %% -%% (C r)"= f*C r+(1-f)*C f +%% (C r)"=f×C r+(1-f)×C f %% %% Fog does not affect a fragment's alpha component. %% %% In color index mode, the fragment's color index i r is replaced by %% -%% (i r)"= i r+(1-f)*i f +%% (i r)"=i r+(1-f)×i f %% %% %% @@ -7664,44 +7665,45 @@ fogiv(Pname,Params) -> %% is fed back as some number of floating-point values, as determined by `Type' . Colors %% are fed back as four values in RGBA mode and one value in color index mode. %% -%% feedbackList feedbackItem feedbackList | feedbackItem +%% feedbackList ← feedbackItem feedbackList | feedbackItem %% -%% feedbackItem point | lineSegment | polygon | bitmap | pixelRectangle | passThru +%% feedbackItem ← point | lineSegment | polygon | bitmap | pixelRectangle | passThru %% -%% point `?GL_POINT_TOKEN' vertex +%% point ←`?GL_POINT_TOKEN' vertex %% -%% lineSegment `?GL_LINE_TOKEN' vertex vertex | `?GL_LINE_RESET_TOKEN' vertex +%% lineSegment ←`?GL_LINE_TOKEN' vertex vertex | `?GL_LINE_RESET_TOKEN' vertex %% vertex %% -%% polygon `?GL_POLYGON_TOKEN' n polySpec +%% polygon ←`?GL_POLYGON_TOKEN' n polySpec %% -%% polySpec polySpec vertex | vertex vertex vertex +%% polySpec ← polySpec vertex | vertex vertex vertex %% -%% bitmap `?GL_BITMAP_TOKEN' vertex +%% bitmap ←`?GL_BITMAP_TOKEN' vertex %% -%% pixelRectangle `?GL_DRAW_PIXEL_TOKEN' vertex | `?GL_COPY_PIXEL_TOKEN' vertex +%% pixelRectangle ←`?GL_DRAW_PIXEL_TOKEN' vertex | `?GL_COPY_PIXEL_TOKEN' vertex +%% %% -%% passThru `?GL_PASS_THROUGH_TOKEN' value +%% passThru ←`?GL_PASS_THROUGH_TOKEN' value %% -%% vertex 2d | 3d | 3dColor | 3dColorTexture | 4dColorTexture +%% vertex ← 2d | 3d | 3dColor | 3dColorTexture | 4dColorTexture %% -%% 2d value value +%% 2d ← value value %% -%% 3d value value value +%% 3d ← value value value %% -%% 3dColor value value value color +%% 3dColor ← value value value color %% -%% 3dColorTexture value value value color tex +%% 3dColorTexture ← value value value color tex %% -%% 4dColorTexture value value value value color tex +%% 4dColorTexture ← value value value value color tex %% -%% color rgba | index +%% color ← rgba | index %% -%% rgba value value value value +%% rgba ← value value value value %% -%% index value +%% index ← value %% -%% tex value value value value +%% tex ← value value value value %% %% `value' is a floating-point number, and `n' is a floating-point integer giving %% the number of vertices in the polygon. `?GL_POINT_TOKEN', `?GL_LINE_TOKEN', `?GL_LINE_RESET_TOKEN' @@ -7886,13 +7888,13 @@ blendColor(Red,Green,Blue,Alpha) -> %% blend factors are denoted (s R s G s B s A) and (d R d G d B d A), respectively. For these equations all color components %% are understood to have values in the range [0 1]. <table><tbody><tr><td>` Mode '</td><td> %% ` RGB Components '</td><td>` Alpha Component '</td></tr></tbody><tbody><tr><td>`?GL_FUNC_ADD' -%% </td><td> Rr= R s s R+R d d R Gr= G s s G+G d d G Br= B s s B+B d d B</td><td> Ar= -%% A s s A+A d d A</td></tr><tr><td>`?GL_FUNC_SUBTRACT'</td><td> Rr= R s s R-R d d -%% R Gr= G s s G-G d d G Br= B s s B-B d d B</td><td> Ar= A s s A-A d d A</td></tr><tr> -%% <td>`?GL_FUNC_REVERSE_SUBTRACT'</td><td> Rr= R d d R-R s s R Gr= G d d G-G s s G -%% Br= B d d B-B s s B</td><td> Ar= A d d A-A s s A</td></tr><tr><td>`?GL_MIN'</td><td> -%% Rr= min(R s R d) Gr= min(G s G d) Br= min(B s B d)</td><td> Ar= min(A s A d)</td></tr><tr><td>`?GL_MAX'</td><td> Rr= -%% max(R s R d) Gr= max(G s G d) Br= max(B s B d)</td><td> Ar= max(A s A d)</td></tr></tbody></table> +%% </td><td> Rr=R s s R+R d d R Gr=G s s G+G d d G Br=B s s B+B d d B</td><td> Ar=A s +%% s A+A d d A</td></tr><tr><td>`?GL_FUNC_SUBTRACT'</td><td> Rr=R s s R-R d d R Gr=G +%% s s G-G d d G Br=B s s B-B d d B</td><td> Ar=A s s A-A d d A</td></tr><tr><td>`?GL_FUNC_REVERSE_SUBTRACT' +%% </td><td> Rr=R d d R-R s s R Gr=G d d G-G s s G Br=B d d B-B s s B</td><td> Ar=A d +%% d A-A s s A</td></tr><tr><td>`?GL_MIN'</td><td> Rr=min(R s R d) Gr=min(G s G d) Br=min(B s B d)</td><td> Ar=min +%% (A s A d)</td></tr><tr><td>`?GL_MAX'</td><td> Rr=max(R s R d) Gr=max(G s G d) Br=max(B s B d)</td><td> Ar=max(A s A d)</td></tr></tbody> +%% </table> %% %% The results of these equations are clamped to the range [0 1]. %% @@ -9062,7 +9064,7 @@ sampleCoverage(Value,Invert) -> %% %% `ImageSize' must be equal to: %% -%% b s*|width b/w|*|height b/h|*|depth b/d| +%% b s×|width b/w|×|height b/h|×|depth b/d| %% %% See <a href="http://www.opengl.org/sdk/docs/man/xhtml/glCompressedTexImage3D.xml">external</a> documentation. -spec compressedTexImage3D(Target, Level, Internalformat, Width, Height, Depth, Border, ImageSize, Data) -> ok when Target :: enum(),Level :: integer(),Internalformat :: enum(),Width :: integer(),Height :: integer(),Depth :: integer(),Border :: integer(),ImageSize :: integer(),Data :: offset()|mem(). @@ -9124,7 +9126,7 @@ compressedTexImage3D(Target,Level,Internalformat,Width,Height,Depth,Border,Image %% %% `ImageSize' must be equal to: %% -%% b s*|width b/w|*|height b/h| +%% b s×|width b/w|×|height b/h| %% %% See <a href="http://www.opengl.org/sdk/docs/man/xhtml/glCompressedTexImage2D.xml">external</a> documentation. -spec compressedTexImage2D(Target, Level, Internalformat, Width, Height, Border, ImageSize, Data) -> ok when Target :: enum(),Level :: integer(),Internalformat :: enum(),Width :: integer(),Height :: integer(),Border :: integer(),ImageSize :: integer(),Data :: offset()|mem(). @@ -9181,7 +9183,7 @@ compressedTexImage2D(Target,Level,Internalformat,Width,Height,Border,ImageSize,D %% %% `ImageSize' must be equal to: %% -%% b s*|width b/w| +%% b s×|width b/w| %% %% See <a href="http://www.opengl.org/sdk/docs/man/xhtml/glCompressedTexImage1D.xml">external</a> documentation. -spec compressedTexImage1D(Target, Level, Internalformat, Width, Border, ImageSize, Data) -> ok when Target :: enum(),Level :: integer(),Internalformat :: enum(),Width :: integer(),Border :: integer(),ImageSize :: integer(),Data :: offset()|mem(). @@ -9502,7 +9504,7 @@ multiTexCoord4sv(Target,{S,T,R,Q}) -> multiTexCoord4s(Target,S,T,R,Q). %% and `M' points to an array of 16 single- or double-precision floating-point values %% m={m[0] m[1] ... m[15]}, then the modelview transformation M(v) does the following: %% -%% M(v)=(m[0] m[1] m[2] m[3] m[4] m[5] m[6] m[7] m[8] m[9] m[10] m[11] m[12] m[13] m[14] m[15])*(v[0] v[1] v[2] v[3]) +%% M(v)=(m[0] m[1] m[2] m[3] m[4] m[5] m[6] m[7] m[8] m[9] m[10] m[11] m[12] m[13] m[14] m[15])×(v[0] v[1] v[2] v[3]) %% %% Projection and texture transformations are similarly defined. %% @@ -9569,7 +9571,7 @@ multTransposeMatrixd({M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12}) -> %% is referred to as (R c G c B c A c). They are understood to have integer values between 0 and (k R k G k B %% k A), where %% -%% k c= 2(m c)-1 +%% k c=2(m c)-1 %% %% and (m R m G m B m A) is the number of red, green, blue, and alpha bitplanes. %% @@ -9601,12 +9603,12 @@ multTransposeMatrixd({M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12}) -> %% %% In the table, %% -%% i= min(A s 1-(A d)) +%% i=min(A s 1-(A d)) %% %% To determine the blended RGBA values of a pixel, the system uses the following equations: %% %% -%% R d= min(k R R s s R+R d d R) G d= min(k G G s s G+G d d G) B d= min(k B B s s B+B d d B) A d= min(k A A s s A+A d d A) +%% R d=min(k R R s s R+R d d R) G d=min(k G G s s G+G d d G) B d=min(k B B s s B+B d d B) A d=min(k A A s s A+A d d A) %% %% Despite the apparent precision of the above equations, blending arithmetic is not exactly %% specified, because blending operates with imprecise integer color values. However, a blend @@ -9615,7 +9617,7 @@ multTransposeMatrixd({M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12}) -> %% , `DstRGB' is `?GL_ONE_MINUS_SRC_ALPHA', and A s is equal to k A, the equations %% reduce to simple replacement: %% -%% R d= R s G d= G s B d= B s A d= A s +%% R d=R s G d=G s B d=B s A d=A s %% %% %% @@ -9899,7 +9901,7 @@ secondaryColorPointer(Size,Type,Stride,Pointer) -> %% current modelview and projection matrices, nor by the viewport-to-window transform. The %% z coordinate of the current raster position is updated in the following manner: %% -%% z={n f(n+z*(f-n)) if z<= 0 if z>= 1(otherwise)) +%% z={n f(n+z×(f-n)) if z<= 0 if z>= 1(otherwise)) %% %% where n is `?GL_DEPTH_RANGE''s near value, and f is `?GL_DEPTH_RANGE''s %% far value. See {@link gl:depthRange/2} . @@ -10397,13 +10399,13 @@ getBufferParameteriv(Target,Pname) -> %% blend factors are denoted (s R s G s B s A) and (d R d G d B d A), respectively. For these equations all color components %% are understood to have values in the range [0 1]. <table><tbody><tr><td>` Mode '</td><td> %% ` RGB Components '</td><td>` Alpha Component '</td></tr></tbody><tbody><tr><td>`?GL_FUNC_ADD' -%% </td><td> Rr= R s s R+R d d R Gr= G s s G+G d d G Br= B s s B+B d d B</td><td> Ar= -%% A s s A+A d d A</td></tr><tr><td>`?GL_FUNC_SUBTRACT'</td><td> Rr= R s s R-R d d -%% R Gr= G s s G-G d d G Br= B s s B-B d d B</td><td> Ar= A s s A-A d d A</td></tr><tr> -%% <td>`?GL_FUNC_REVERSE_SUBTRACT'</td><td> Rr= R d d R-R s s R Gr= G d d G-G s s G -%% Br= B d d B-B s s B</td><td> Ar= A d d A-A s s A</td></tr><tr><td>`?GL_MIN'</td><td> -%% Rr= min(R s R d) Gr= min(G s G d) Br= min(B s B d)</td><td> Ar= min(A s A d)</td></tr><tr><td>`?GL_MAX'</td><td> Rr= -%% max(R s R d) Gr= max(G s G d) Br= max(B s B d)</td><td> Ar= max(A s A d)</td></tr></tbody></table> +%% </td><td> Rr=R s s R+R d d R Gr=G s s G+G d d G Br=B s s B+B d d B</td><td> Ar=A s +%% s A+A d d A</td></tr><tr><td>`?GL_FUNC_SUBTRACT'</td><td> Rr=R s s R-R d d R Gr=G +%% s s G-G d d G Br=B s s B-B d d B</td><td> Ar=A s s A-A d d A</td></tr><tr><td>`?GL_FUNC_REVERSE_SUBTRACT' +%% </td><td> Rr=R d d R-R s s R Gr=G d d G-G s s G Br=B d d B-B s s B</td><td> Ar=A d +%% d A-A s s A</td></tr><tr><td>`?GL_MIN'</td><td> Rr=min(R s R d) Gr=min(G s G d) Br=min(B s B d)</td><td> Ar=min +%% (A s A d)</td></tr><tr><td>`?GL_MAX'</td><td> Rr=max(R s R d) Gr=max(G s G d) Br=max(B s B d)</td><td> Ar=max(A s A d)</td></tr></tbody> +%% </table> %% %% The results of these equations are clamped to the range [0 1]. %% @@ -11626,11 +11628,11 @@ useProgram(Program) -> %% %% The commands ``gl:uniformMatrix{2|3|4|2x3|3x2|2x4|4x2|3x4|4x3}fv'' are used to modify %% a matrix or an array of matrices. The numbers in the command name are interpreted as the -%% dimensionality of the matrix. The number `2' indicates a 2 � 2 matrix (i.e., 4 values), -%% the number `3' indicates a 3 � 3 matrix (i.e., 9 values), and the number `4' -%% indicates a 4 � 4 matrix (i.e., 16 values). Non-square matrix dimensionality is explicit, +%% dimensionality of the matrix. The number `2' indicates a 2 × 2 matrix (i.e., 4 values), +%% the number `3' indicates a 3 × 3 matrix (i.e., 9 values), and the number `4' +%% indicates a 4 × 4 matrix (i.e., 16 values). Non-square matrix dimensionality is explicit, %% with the first number representing the number of columns and the second number representing -%% the number of rows. For example, `2x4' indicates a 2 � 4 matrix with 2 columns and +%% the number of rows. For example, `2x4' indicates a 2 × 4 matrix with 2 columns and %% 4 rows (i.e., 8 values). If `Transpose' is `?GL_FALSE', each matrix is assumed %% to be supplied in column major order. If `Transpose' is `?GL_TRUE', each matrix %% is assumed to be supplied in row major order. The `Count' argument indicates the @@ -12753,7 +12755,7 @@ drawElementsInstanced(Mode,Count,Type,Indices,Primcount) -> %% %% When a buffer object is attached to a buffer texture, the buffer object's data store %% is taken as the texture's texel array. The number of texels in the buffer texture's texel -%% array is given by buffer_size components� sizeof( base_type/) +%% array is given by buffer_size components×sizeof( base_type/) %% %% where `buffer_size' is the size of the buffer object, in basic machine units and %% components and base type are the element count and base data type for elements, as specified @@ -14576,14 +14578,14 @@ bindSampler(Unit,Sampler) -> %% to compute the texture value. The other four use mipmaps. %% %% A mipmap is an ordered set of arrays representing the same image at progressively lower -%% resolutions. If the texture has dimensions 2 n*2 m, there are max(n m)+1 mipmaps. The first -%% mipmap is the original texture, with dimensions 2 n*2 m. Each subsequent mipmap has -%% dimensions 2(k-1)*2(l-1), where 2 k*2 l are the dimensions of the previous mipmap, until either -%% k= 0 or l= 0. At that point, subsequent mipmaps have dimension 1*2(l-1) or 2(k-1)*1 until -%% the final mipmap, which has dimension 1*1. To define the mipmaps, call {@link gl:texImage1D/8} +%% resolutions. If the texture has dimensions 2 n×2 m, there are max(n m)+1 mipmaps. The first +%% mipmap is the original texture, with dimensions 2 n×2 m. Each subsequent mipmap has +%% dimensions 2(k-1)×2(l-1), where 2 k×2 l are the dimensions of the previous mipmap, until either +%% k=0 or l=0. At that point, subsequent mipmaps have dimension 1×2(l-1) or 2(k-1)×1 until +%% the final mipmap, which has dimension 1×1. To define the mipmaps, call {@link gl:texImage1D/8} %% , {@link gl:texImage2D/9} , {@link gl:texImage3D/10} , {@link gl:copyTexImage1D/7} , or {@link gl:copyTexImage2D/8} %% with the `level' argument indicating the order of the mipmaps. Level 0 is the original -%% texture; level max(n m) is the final 1*1 mipmap. +%% texture; level max(n m) is the final 1×1 mipmap. %% %% `Params' supplies a function for minifying the texture as one of the following: %% @@ -14695,13 +14697,12 @@ bindSampler(Unit,Sampler) -> %% `?GL_TEXTURE_COMPARE_FUNC': Specifies the comparison operator used when `?GL_TEXTURE_COMPARE_MODE' %% is set to `?GL_COMPARE_REF_TO_TEXTURE'. Permissible values are: <table><tbody><tr><td> %% ` Texture Comparison Function '</td><td>` Computed result '</td></tr></tbody><tbody> -%% <tr><td>`?GL_LEQUAL'</td><td> result={1.0 0.0 &nbsp;&nbsp; r<=(D t) r>(D t))</td></tr><tr><td>`?GL_GEQUAL'</td><td> -%% result={1.0 0.0 &nbsp;&nbsp; r>=(D t) r<(D t))</td></tr><tr><td>`?GL_LESS'</td><td> result={1.0 0.0 &nbsp;&nbsp; r< -%% (D t) r>=(D t))</td></tr><tr><td>`?GL_GREATER' -%% </td><td> result={1.0 0.0 &nbsp;&nbsp; r>(D t) r<=(D t))</td></tr><tr><td>`?GL_EQUAL'</td><td> result={1.0 0.0 &nbsp;&nbsp; -%% r=(D t) r&ne;(D t))</td></tr><tr><td>`?GL_NOTEQUAL' -%% </td><td> result={1.0 0.0 &nbsp;&nbsp; r&ne;(D t) r=(D t))</td></tr><tr><td>`?GL_ALWAYS'</td><td> result= 1.0</td></tr><tr><td> -%% `?GL_NEVER'</td><td> result= 0.0</td></tr></tbody></table> where r is the current +%% <tr><td>`?GL_LEQUAL'</td><td> result={1.0 0.0 r<=(D t) r>(D t))</td></tr><tr><td>`?GL_GEQUAL'</td><td> +%% result={1.0 0.0 r>=(D t) r<(D t))</td></tr><tr><td>`?GL_LESS'</td><td> result={1.0 0.0 r<(D t) r>=(D t))</td></tr><tr><td>`?GL_GREATER' +%% </td><td> result={1.0 0.0 r>(D t) r<=(D t))</td></tr><tr><td>`?GL_EQUAL'</td><td> result={1.0 0.0 r=(D t) r&ne; +%% (D t))</td></tr><tr><td>`?GL_NOTEQUAL' +%% </td><td> result={1.0 0.0 r&ne;(D t) r=(D t))</td></tr><tr><td>`?GL_ALWAYS'</td><td> result=1.0</td></tr><tr><td> +%% `?GL_NEVER'</td><td> result=0.0</td></tr></tbody></table> where r is the current %% interpolated texture coordinate, and D t is the texture value sampled from the currently %% bound texture. result is assigned to R t. %% @@ -15774,11 +15775,11 @@ getProgramPipelineiv(Pipeline,Pname) -> %% %% The commands ``gl:programUniformMatrix{2|3|4|2x3|3x2|2x4|4x2|3x4|4x3}fv'' are used %% to modify a matrix or an array of matrices. The numbers in the command name are interpreted -%% as the dimensionality of the matrix. The number `2' indicates a 2 � 2 matrix (i.e., -%% 4 values), the number `3' indicates a 3 � 3 matrix (i.e., 9 values), and the number `4' -%% indicates a 4 � 4 matrix (i.e., 16 values). Non-square matrix dimensionality is explicit, +%% as the dimensionality of the matrix. The number `2' indicates a 2 × 2 matrix (i.e., +%% 4 values), the number `3' indicates a 3 × 3 matrix (i.e., 9 values), and the number `4' +%% indicates a 4 × 4 matrix (i.e., 16 values). Non-square matrix dimensionality is explicit, %% with the first number representing the number of columns and the second number representing -%% the number of rows. For example, `2x4' indicates a 2 � 4 matrix with 2 columns and +%% the number of rows. For example, `2x4' indicates a 2 × 4 matrix with 2 columns and %% 4 rows (i.e., 8 values). If `Transpose' is `?GL_FALSE', each matrix is assumed %% to be supplied in column major order. If `Transpose' is `?GL_TRUE', each matrix %% is assumed to be supplied in row major order. The `Count' argument indicates the diff --git a/lib/wx/src/gen/glu.erl b/lib/wx/src/gen/glu.erl index 2c82c9792f..dc64c3c3a7 100644 --- a/lib/wx/src/gen/glu.erl +++ b/lib/wx/src/gen/glu.erl @@ -1,7 +1,9 @@ +%% -*- coding: utf-8 -*- + %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -91,19 +93,19 @@ tesselate({Nx,Ny,Nz}, Vs) -> %% ). %% %% A series of mipmap levels from `Base' to `Max' is built by decimating `Data' -%% in half until size 1*1 is reached. At each level, each texel in the halved mipmap +%% in half until size 1×1 is reached. At each level, each texel in the halved mipmap %% level is an average of the corresponding two texels in the larger mipmap level. {@link gl:texImage1D/8} %% is called to load these mipmap levels from `Base' to `Max' . If `Max' is %% larger than the highest mipmap level for the texture of the specified size, then a GLU %% error code is returned (see {@link glu:errorString/1} ) and nothing is loaded. %% %% For example, if `Level' is 2 and `Width' is 16, the following levels are possible: -%% 16*1, 8*1, 4*1, 2*1, 1*1. These correspond to levels 2 through 6 respectively. -%% If `Base' is 3 and `Max' is 5, then only mipmap levels 8*1, 4*1 and 2*1 +%% 16×1, 8×1, 4×1, 2×1, 1×1. These correspond to levels 2 through 6 respectively. +%% If `Base' is 3 and `Max' is 5, then only mipmap levels 8×1, 4×1 and 2×1 %% are loaded. However, if `Max' is 7, then an error is returned and nothing is loaded %% since `Max' is larger than the highest mipmap level which is, in this case, 6. %% -%% The highest mipmap level can be derived from the formula log 2(width*2 level). +%% The highest mipmap level can be derived from the formula log 2(width×2 level). %% %% See the {@link gl:texImage1D/8} reference page for a description of the acceptable values %% for `Type' parameter. See the {@link gl:drawPixels/5} reference page for a description @@ -134,13 +136,13 @@ build1DMipmapLevels(Target,InternalFormat,Width,Format,Type,Level,Base,Max,Data) %% can fit the requested texture. If not, `Width' is continually halved until it fits. %% %% Next, a series of mipmap levels is built by decimating a copy of `Data' in half -%% until size 1*1 is reached. At each level, each texel in the halved mipmap level is an +%% until size 1×1 is reached. At each level, each texel in the halved mipmap level is an %% average of the corresponding two texels in the larger mipmap level. %% %% {@link gl:texImage1D/8} is called to load each of these mipmap levels. Level 0 is a copy %% of `Data' . The highest level is (log 2)(width). For example, if `Width' is 64 and the implementation -%% can store a texture of this size, the following mipmap levels are built: 64*1, 32*1, -%% 16*1, 8*1, 4*1, 2*1, and 1*1. These correspond to levels 0 through 6, respectively. +%% can store a texture of this size, the following mipmap levels are built: 64×1, 32×1, +%% 16×1, 8×1, 4×1, 2×1, and 1×1. These correspond to levels 0 through 6, respectively. %% %% %% See the {@link gl:texImage1D/8} reference page for a description of the acceptable values @@ -163,22 +165,22 @@ build1DMipmaps(Target,InternalFormat,Width,Format,Type,Data) -> %% ). %% %% A series of mipmap levels from `Base' to `Max' is built by decimating `Data' -%% in half along both dimensions until size 1*1 is reached. At each level, each texel +%% in half along both dimensions until size 1×1 is reached. At each level, each texel %% in the halved mipmap level is an average of the corresponding four texels in the larger %% mipmap level. (In the case of rectangular images, the decimation will ultimately reach -%% an N*1 or 1*N configuration. Here, two texels are averaged instead.) {@link gl:texImage2D/9} +%% an N×1 or 1×N configuration. Here, two texels are averaged instead.) {@link gl:texImage2D/9} %% is called to load these mipmap levels from `Base' to `Max' . If `Max' is %% larger than the highest mipmap level for the texture of the specified size, then a GLU %% error code is returned (see {@link glu:errorString/1} ) and nothing is loaded. %% %% For example, if `Level' is 2 and `Width' is 16 and `Height' is 8, the -%% following levels are possible: 16*8, 8*4, 4*2, 2*1, 1*1. These correspond to +%% following levels are possible: 16×8, 8×4, 4×2, 2×1, 1×1. These correspond to %% levels 2 through 6 respectively. If `Base' is 3 and `Max' is 5, then only mipmap -%% levels 8*4, 4*2, and 2*1 are loaded. However, if `Max' is 7, then an error is +%% levels 8×4, 4×2, and 2×1 are loaded. However, if `Max' is 7, then an error is %% returned and nothing is loaded since `Max' is larger than the highest mipmap level %% which is, in this case, 6. %% -%% The highest mipmap level can be derived from the formula log 2(max(width height)*2 level). +%% The highest mipmap level can be derived from the formula log 2(max(width height)×2 level). %% %% See the {@link gl:texImage1D/8} reference page for a description of the acceptable values %% for `Format' parameter. See the {@link gl:drawPixels/5} reference page for a description @@ -214,15 +216,15 @@ build2DMipmapLevels(Target,InternalFormat,Width,Height,Format,Type,Level,Base,Ma %% .) %% %% Next, a series of mipmap levels is built by decimating a copy of `Data' in half -%% along both dimensions until size 1*1 is reached. At each level, each texel in the halved +%% along both dimensions until size 1×1 is reached. At each level, each texel in the halved %% mipmap level is an average of the corresponding four texels in the larger mipmap level. -%% (In the case of rectangular images, the decimation will ultimately reach an N*1 or 1*N +%% (In the case of rectangular images, the decimation will ultimately reach an N×1 or 1×N %% configuration. Here, two texels are averaged instead.) %% %% {@link gl:texImage2D/9} is called to load each of these mipmap levels. Level 0 is a copy %% of `Data' . The highest level is (log 2)(max(width height)). For example, if `Width' is 64 and `Height' %% is 16 and the implementation can store a texture of this size, the following mipmap levels -%% are built: 64*16, 32*8, 16*4, 8*2, 4*1, 2*1, and 1*1 These correspond to +%% are built: 64×16, 32×8, 16×4, 8×2, 4×1, 2×1, and 1×1 These correspond to %% levels 0 through 6, respectively. %% %% See the {@link gl:texImage1D/8} reference page for a description of the acceptable values @@ -245,7 +247,7 @@ build2DMipmaps(Target,InternalFormat,Width,Height,Format,Type,Data) -> %% ). %% %% A series of mipmap levels from `Base' to `Max' is built by decimating `Data' -%% in half along both dimensions until size 1*1*1 is reached. At each level, each texel +%% in half along both dimensions until size 1×1×1 is reached. At each level, each texel %% in the halved mipmap level is an average of the corresponding eight texels in the larger %% mipmap level. (If exactly one of the dimensions is 1, four texels are averaged. If exactly %% two of the dimensions are 1, two texels are averaged.) {@link gl:texImage3D/10} is called @@ -254,13 +256,13 @@ build2DMipmaps(Target,InternalFormat,Width,Height,Format,Type,Data) -> %% is returned (see {@link glu:errorString/1} ) and nothing is loaded. %% %% For example, if `Level' is 2 and `Width' is 16, `Height' is 8 and `Depth' -%% is 4, the following levels are possible: 16*8*4, 8*4*2, 4*2*1, 2*1*1, 1*1*1. +%% is 4, the following levels are possible: 16×8×4, 8×4×2, 4×2×1, 2×1×1, 1×1×1. %% These correspond to levels 2 through 6 respectively. If `Base' is 3 and `Max' -%% is 5, then only mipmap levels 8*4*2, 4*2*1, and 2*1*1 are loaded. However, if `Max' +%% is 5, then only mipmap levels 8×4×2, 4×2×1, and 2×1×1 are loaded. However, if `Max' %% is 7, then an error is returned and nothing is loaded, since `Max' is larger than %% the highest mipmap level which is, in this case, 6. %% -%% The highest mipmap level can be derived from the formula log 2(max(width height depth)*2 level). +%% The highest mipmap level can be derived from the formula log 2(max(width height depth)×2 level). %% %% See the {@link gl:texImage1D/8} reference page for a description of the acceptable values %% for `Format' parameter. See the {@link gl:drawPixels/5} reference page for a description @@ -295,7 +297,7 @@ build3DMipmapLevels(Target,InternalFormat,Width,Height,Depth,Format,Type,Level,B %% it fits. %% %% Next, a series of mipmap levels is built by decimating a copy of `Data' in half -%% along all three dimensions until size 1*1*1 is reached. At each level, each texel in +%% along all three dimensions until size 1×1×1 is reached. At each level, each texel in %% the halved mipmap level is an average of the corresponding eight texels in the larger %% mipmap level. (If exactly one of the dimensions is 1, four texels are averaged. If exactly %% two of the dimensions are 1, two texels are averaged.) @@ -303,8 +305,8 @@ build3DMipmapLevels(Target,InternalFormat,Width,Height,Depth,Format,Type,Level,B %% {@link gl:texImage3D/10} is called to load each of these mipmap levels. Level 0 is a copy %% of `Data' . The highest level is (log 2)(max(width height depth)). For example, if `Width' is 64, `Height' %% is 16, and `Depth' is 32, and the implementation can store a texture of this size, -%% the following mipmap levels are built: 64*16*32, 32*8*16, 16*4*8, 8*2*4, 4*1*2, -%% 2*1*1, and 1*1*1. These correspond to levels 0 through 6, respectively. +%% the following mipmap levels are built: 64×16×32, 32×8×16, 16×4×8, 8×2×4, 4×1×2, +%% 2×1×1, and 1×1×1. These correspond to levels 0 through 6, respectively. %% %% See the {@link gl:texImage1D/8} reference page for a description of the acceptable values %% for `Format' parameter. See the {@link gl:drawPixels/5} reference page for a description @@ -334,7 +336,7 @@ checkExtension(ExtName,ExtString) -> %% @doc Draw a cylinder %% %% ``glu:cylinder'' draws a cylinder oriented along the `z' axis. The base of the -%% cylinder is placed at `z' = 0 and the top at z= height. Like a sphere, a cylinder +%% cylinder is placed at `z' = 0 and the top at z=height. Like a sphere, a cylinder %% is subdivided around the `z' axis into slices and along the `z' axis into stacks. %% %% @@ -380,7 +382,7 @@ deleteQuadric(Quad) -> %% the -`z' axis. %% %% If texturing has been turned on (with {@link glu:quadricTexture/2} ), texture coordinates -%% are generated linearly such that where r= outer, the value at (`r', 0, 0) is (1, +%% are generated linearly such that where r=outer, the value at (`r', 0, 0) is (1, %% 0.5), at (0, `r', 0) it is (0.5, 1), at (-`r', 0, 0) it is (0, 0.5), and at %% (0, -`r', 0) it is (0.5, 0). %% @@ -451,11 +453,11 @@ getString(Name) -> %% %% Let `UP' be the vector (upX upY upZ). %% -%% Then normalize as follows: f= F/(||F||) +%% Then normalize as follows: f=F/(||F||) %% -%% UP"= UP/(||UP||) +%% UP"=UP/(||UP||) %% -%% Finally, let s= f*UP", and u= s*f. +%% Finally, let s=f×UP", and u=s×f. %% %% M is then constructed as follows: M=(s[0] s[1] s[2] 0 u[0] u[1] u[2] 0-f[0]-f[1]-f[2] 0 0 0 0 1) %% @@ -481,7 +483,7 @@ newQuadric() -> %% @doc Define a 2D orthographic projection matrix %% %% ``glu:ortho2D'' sets up a two-dimensional orthographic viewing region. This is equivalent -%% to calling {@link gl:ortho/6} with near= -1 and far= 1. +%% to calling {@link gl:ortho/6} with near=-1 and far=1. %% %% See <a href="http://www.opengl.org/sdk/docs/man/xhtml/gluOrtho2D.xml">external</a> documentation. -spec ortho2D(Left, Right, Bottom, Top) -> ok when Left :: float(),Right :: float(),Bottom :: float(),Top :: float(). @@ -490,7 +492,7 @@ ortho2D(Left,Right,Bottom,Top) -> %% @doc Draw an arc of a disk %% -%% ``glu:partialDisk'' renders a partial disk on the z= 0 plane. A partial disk is similar +%% ``glu:partialDisk'' renders a partial disk on the z=0 plane. A partial disk is similar %% to a full disk, except that only the subset of the disk from `Start' through `Start' %% + `Sweep' is included (where 0 degrees is along the +f2yf axis, 90 degrees along %% the +`x' axis, 180 degrees along the -`y' axis, and 270 degrees along the -`x' @@ -508,7 +510,7 @@ ortho2D(Left,Right,Bottom,Top) -> %% Otherwise, they point along the -`z' axis. %% %% If texturing is turned on (with {@link glu:quadricTexture/2} ), texture coordinates are -%% generated linearly such that where r= outer, the value at (`r', 0, 0) is (1.0, +%% generated linearly such that where r=outer, the value at (`r', 0, 0) is (1.0, %% 0.5), at (0, `r', 0) it is (0.5, 1.0), at (-`r', 0, 0) it is (0.0, 0.5), and %% at (0, -`r', 0) it is (0.5, 0.0). %% @@ -521,7 +523,7 @@ partialDisk(Quad,Inner,Outer,Slices,Loops,Start,Sweep) -> %% %% ``glu:perspective'' specifies a viewing frustum into the world coordinate system. In %% general, the aspect ratio in ``glu:perspective'' should match the aspect ratio of the -%% associated viewport. For example, aspect= 2.0 means the viewer's angle of view is twice +%% associated viewport. For example, aspect=2.0 means the viewer's angle of view is twice %% as wide in `x' as it is in `y'. If the viewport is twice as wide as it is tall, %% it displays the image without distortion. %% @@ -532,9 +534,9 @@ partialDisk(Quad,Inner,Outer,Slices,Loops,Start,Sweep) -> %% %% Given `f' defined as follows: %% -%% f= cotangent(fovy/2) The generated matrix is +%% f=cotangent(fovy/2) The generated matrix is %% -%% (f/aspect 0 0 0 0 f 0 0 0 0(zFar+zNear)/(zNear-zFar)(2*zFar*zNear)/(zNear-zFar) 0 0 -1 0) +%% (f/aspect 0 0 0 0 f 0 0 0 0(zFar+zNear)/(zNear-zFar)(2×zFar×zNear)/(zNear-zFar) 0 0 -1 0) %% %% See <a href="http://www.opengl.org/sdk/docs/man/xhtml/gluPerspective.xml">external</a> documentation. -spec perspective(Fovy, Aspect, ZNear, ZFar) -> ok when Fovy :: float(),Aspect :: float(),ZNear :: float(),ZFar :: float(). @@ -577,16 +579,16 @@ pickMatrix(X,Y,DelX,DelY,{V1,V2,V3,V4}) -> %% To compute the coordinates, let v=(objX objY objZ 1.0) represented as a matrix with 4 rows and 1 column. %% Then ``glu:project'' computes v" as follows: %% -%% v"= P*M*v +%% v"=P×M×v %% %% where P is the current projection matrix `Proj' and M is the current modelview -%% matrix `Model' (both represented as 4*4 matrices in column-major order). +%% matrix `Model' (both represented as 4×4 matrices in column-major order). %% %% The window coordinates are then computed as follows: %% -%% winX= view(0)+view(2)*(v"(0)+1)/2 +%% winX=view(0)+view(2)×(v"(0)+1)/2 %% -%% winY= view(1)+view(3)*(v"(1)+1)/2 +%% winY=view(1)+view(3)×(v"(1)+1)/2 %% %% winZ=(v"(2)+1)/2 %% @@ -703,7 +705,7 @@ scaleImage(Format,WIn,HIn,TypeIn,DataIn,WOut,HOut,TypeOut,DataOut) -> %% point toward the center of the sphere. %% %% If texturing is turned on (with {@link glu:quadricTexture/2} ), then texture coordinates -%% are generated so that `t' ranges from 0.0 at z=-radius to 1.0 at z= radius (`t' +%% are generated so that `t' ranges from 0.0 at z=-radius to 1.0 at z=radius (`t' %% increases linearly along longitudinal lines), and `s' ranges from 0.0 at the +`y' %% axis, to 0.25 at the +`x' axis, to 0.5 at the -`y' axis, to 0.75 at the -`x' %% axis, and back to 1.0 at the +`y' axis. @@ -723,7 +725,7 @@ sphere(Quad,Radius,Slices,Stacks) -> %% To compute the coordinates (objX objY objZ), ``glu:unProject'' multiplies the normalized device coordinates %% by the inverse of `Model' * `Proj' as follows: %% -%% (objX objY objZ W)= INV(P M) ((2(winX-view[0]))/(view[2])-1(2(winY-view[1]))/(view[3])-1 2(winZ)-1 1) INV denotes matrix inversion. W is an unused variable, included for consistent +%% (objX objY objZ W)=INV(P M) ((2(winX-view[0]))/(view[2])-1(2(winY-view[1]))/(view[3])-1 2(winZ)-1 1) INV denotes matrix inversion. W is an unused variable, included for consistent %% matrix notation. %% %% See <a href="http://www.opengl.org/sdk/docs/man/xhtml/gluUnProject.xml">external</a> documentation. diff --git a/lib/wx/src/gen/wxCalendarCtrl.erl b/lib/wx/src/gen/wxCalendarCtrl.erl index 01d171800b..2a476c5e92 100644 --- a/lib/wx/src/gen/wxCalendarCtrl.erl +++ b/lib/wx/src/gen/wxCalendarCtrl.erl @@ -75,6 +75,8 @@ update/1,updateWindowUI/1,updateWindowUI/2,validate/1,warpPointer/3]). -export_type([wxCalendarCtrl/0]). +-deprecated([enableYearChange/1,enableYearChange/2]). + %% @hidden parent_class(wxControl) -> true; parent_class(wxWindow) -> true; diff --git a/lib/wx/src/gen/wxClientDC.erl b/lib/wx/src/gen/wxClientDC.erl index 7dfebe4068..cb75fdc58d 100644 --- a/lib/wx/src/gen/wxClientDC.erl +++ b/lib/wx/src/gen/wxClientDC.erl @@ -54,6 +54,8 @@ startPage/1]). -export_type([wxClientDC/0]). +-deprecated([new/0]). + %% @hidden parent_class(wxWindowDC) -> true; parent_class(wxDC) -> true; diff --git a/lib/wx/src/gen/wxClipboard.erl b/lib/wx/src/gen/wxClipboard.erl index 8f1d59f603..c7336fcc47 100644 --- a/lib/wx/src/gen/wxClipboard.erl +++ b/lib/wx/src/gen/wxClipboard.erl @@ -130,8 +130,9 @@ usePrimarySelection(#wx_ref{type=ThisT,ref=ThisRef}, Options) <<ThisRef:32/?UI, 0:32,BinOpt/binary>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxclipboard.html#wxclipboardissupported">external documentation</a>. +%%<br /> Format = ?wxDF_INVALID | ?wxDF_TEXT | ?wxDF_BITMAP | ?wxDF_METAFILE | ?wxDF_SYLK | ?wxDF_DIF | ?wxDF_TIFF | ?wxDF_OEMTEXT | ?wxDF_DIB | ?wxDF_PALETTE | ?wxDF_PENDATA | ?wxDF_RIFF | ?wxDF_WAVE | ?wxDF_UNICODETEXT | ?wxDF_ENHMETAFILE | ?wxDF_FILENAME | ?wxDF_LOCALE | ?wxDF_PRIVATE | ?wxDF_HTML | ?wxDF_MAX -spec isSupported(This, Format) -> boolean() when - This::wxClipboard(), Format::integer(). + This::wxClipboard(), Format::wx:wx_enum(). isSupported(#wx_ref{type=ThisT,ref=ThisRef},Format) when is_integer(Format) -> ?CLASS(ThisT,wxClipboard), diff --git a/lib/wx/src/gen/wxCursor.erl b/lib/wx/src/gen/wxCursor.erl index b9e3a8e3f7..423e444f2f 100644 --- a/lib/wx/src/gen/wxCursor.erl +++ b/lib/wx/src/gen/wxCursor.erl @@ -35,6 +35,8 @@ saveFile/4,setDepth/2,setHeight/2,setMask/2,setPalette/2,setWidth/2]). -export_type([wxCursor/0]). +-deprecated([new/3,new/4]). + %% @hidden parent_class(wxBitmap) -> true; parent_class(_Class) -> erlang:error({badtype, ?MODULE}). diff --git a/lib/wx/src/gen/wxDC.erl b/lib/wx/src/gen/wxDC.erl index 9f57978849..42d5d7b1df 100644 --- a/lib/wx/src/gen/wxDC.erl +++ b/lib/wx/src/gen/wxDC.erl @@ -50,6 +50,8 @@ -export([parent_class/1]). -export_type([wxDC/0]). +-deprecated([computeScaleAndOrigin/1]). + %% @hidden parent_class(_Class) -> erlang:error({badtype, ?MODULE}). @@ -63,9 +65,10 @@ blit(This,DestPt={DestPtX,DestPtY},Sz={SzW,SzH},Source,SrcPt={SrcPtX,SrcPtY}) blit(This,DestPt,Sz,Source,SrcPt, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxdc.html#wxdcblit">external documentation</a>. +%%<br /> Rop = integer -spec blit(This, DestPt, Sz, Source, SrcPt, [Option]) -> boolean() when This::wxDC(), DestPt::{X::integer(), Y::integer()}, Sz::{W::integer(), H::integer()}, Source::wxDC(), SrcPt::{X::integer(), Y::integer()}, - Option :: {rop, integer()} + Option :: {rop, wx:wx_enum()} | {useMask, boolean()} | {srcPtMask, {X::integer(), Y::integer()}}. blit(#wx_ref{type=ThisT,ref=ThisRef},{DestPtX,DestPtY},{SzW,SzH},#wx_ref{type=SourceT,ref=SourceRef},{SrcPtX,SrcPtY}, Options) @@ -310,11 +313,12 @@ drawPolygon(This,Points) drawPolygon(This,Points, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxdc.html#wxdcdrawpolygon">external documentation</a>. +%%<br /> FillStyle = integer -spec drawPolygon(This, Points, [Option]) -> ok when This::wxDC(), Points::[{X::integer(), Y::integer()}], Option :: {xoffset, integer()} | {yoffset, integer()} - | {fillStyle, integer()}. + | {fillStyle, wx:wx_enum()}. drawPolygon(#wx_ref{type=ThisT,ref=ThisRef},Points, Options) when is_list(Points),is_list(Options) -> ?CLASS(ThisT,wxDC), @@ -417,9 +421,10 @@ floodFill(This,Pt={PtX,PtY},Col) floodFill(This,Pt,Col, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxdc.html#wxdcfloodfill">external documentation</a>. +%%<br /> Style = integer -spec floodFill(This, Pt, Col, [Option]) -> boolean() when This::wxDC(), Pt::{X::integer(), Y::integer()}, Col::wx:wx_colour(), - Option :: {style, integer()}. + Option :: {style, wx:wx_enum()}. floodFill(#wx_ref{type=ThisT,ref=ThisRef},{PtX,PtY},Col, Options) when is_integer(PtX),is_integer(PtY),tuple_size(Col) =:= 3; tuple_size(Col) =:= 4,is_list(Options) -> ?CLASS(ThisT,wxDC), @@ -855,8 +860,9 @@ setLayoutDirection(#wx_ref{type=ThisT,ref=ThisRef},Dir) <<ThisRef:32/?UI,Dir:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxdc.html#wxdcsetlogicalfunction">external documentation</a>. +%%<br /> Function = integer -spec setLogicalFunction(This, Function) -> ok when - This::wxDC(), Function::integer(). + This::wxDC(), Function::wx:wx_enum(). setLogicalFunction(#wx_ref{type=ThisT,ref=ThisRef},Function) when is_integer(Function) -> ?CLASS(ThisT,wxDC), @@ -864,8 +870,9 @@ setLogicalFunction(#wx_ref{type=ThisT,ref=ThisRef},Function) <<ThisRef:32/?UI,Function:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxdc.html#wxdcsetmapmode">external documentation</a>. +%%<br /> Mode = integer -spec setMapMode(This, Mode) -> ok when - This::wxDC(), Mode::integer(). + This::wxDC(), Mode::wx:wx_enum(). setMapMode(#wx_ref{type=ThisT,ref=ThisRef},Mode) when is_integer(Mode) -> ?CLASS(ThisT,wxDC), diff --git a/lib/wx/src/gen/wxGraphicsContext.erl b/lib/wx/src/gen/wxGraphicsContext.erl index 1dfa0dd405..575e48d7af 100644 --- a/lib/wx/src/gen/wxGraphicsContext.erl +++ b/lib/wx/src/gen/wxGraphicsContext.erl @@ -40,6 +40,8 @@ -export([getRenderer/1,isNull/1,parent_class/1]). -export_type([wxGraphicsContext/0]). +-deprecated([createLinearGradientBrush/7,createRadialGradientBrush/8]). + %% @hidden parent_class(wxGraphicsObject) -> true; parent_class(_Class) -> erlang:error({badtype, ?MODULE}). @@ -225,9 +227,10 @@ drawLines(This,Points) drawLines(This,Points, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxgraphicscontext.html#wxgraphicscontextdrawlines">external documentation</a>. +%%<br /> FillStyle = integer -spec drawLines(This, Points, [Option]) -> ok when This::wxGraphicsContext(), Points::[{X::float(), Y::float()}], - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. drawLines(#wx_ref{type=ThisT,ref=ThisRef},Points, Options) when is_list(Points),is_list(Options) -> ?CLASS(ThisT,wxGraphicsContext), @@ -247,9 +250,10 @@ drawPath(This,Path) drawPath(This,Path, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxgraphicscontext.html#wxgraphicscontextdrawpath">external documentation</a>. +%%<br /> FillStyle = integer -spec drawPath(This, Path, [Option]) -> ok when This::wxGraphicsContext(), Path::wxGraphicsPath:wxGraphicsPath(), - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. drawPath(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=PathT,ref=PathRef}, Options) when is_list(Options) -> ?CLASS(ThisT,wxGraphicsContext), @@ -331,9 +335,10 @@ fillPath(This,Path) fillPath(This,Path, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxgraphicscontext.html#wxgraphicscontextfillpath">external documentation</a>. +%%<br /> FillStyle = integer -spec fillPath(This, Path, [Option]) -> ok when This::wxGraphicsContext(), Path::wxGraphicsPath:wxGraphicsPath(), - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. fillPath(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=PathT,ref=PathRef}, Options) when is_list(Options) -> ?CLASS(ThisT,wxGraphicsContext), diff --git a/lib/wx/src/gen/wxGraphicsPath.erl b/lib/wx/src/gen/wxGraphicsPath.erl index 56b853899a..246ea489ec 100644 --- a/lib/wx/src/gen/wxGraphicsPath.erl +++ b/lib/wx/src/gen/wxGraphicsPath.erl @@ -197,13 +197,14 @@ contains(This,C={CX,CY}) %% <br /> Also:<br /> %% contains(This, C, [Option]) -> boolean() when<br /> %% This::wxGraphicsPath(), C::{X::float(), Y::float()},<br /> -%% Option :: {fillStyle, integer()}.<br /> +%% Option :: {fillStyle, wx:wx_enum()}.<br /> %% +%%<br /> FillStyle = integer -spec contains(This, X, Y) -> boolean() when This::wxGraphicsPath(), X::number(), Y::number(); (This, C, [Option]) -> boolean() when This::wxGraphicsPath(), C::{X::float(), Y::float()}, - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. contains(This,X,Y) when is_record(This, wx_ref),is_number(X),is_number(Y) -> @@ -218,9 +219,10 @@ contains(#wx_ref{type=ThisT,ref=ThisRef},{CX,CY}, Options) <<ThisRef:32/?UI,0:32,CX:64/?F,CY:64/?F, BinOpt/binary>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxgraphicspath.html#wxgraphicspathcontains">external documentation</a>. +%%<br /> FillStyle = integer -spec contains(This, X, Y, [Option]) -> boolean() when This::wxGraphicsPath(), X::number(), Y::number(), - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. contains(#wx_ref{type=ThisT,ref=ThisRef},X,Y, Options) when is_number(X),is_number(Y),is_list(Options) -> ?CLASS(ThisT,wxGraphicsPath), diff --git a/lib/wx/src/gen/wxGraphicsRenderer.erl b/lib/wx/src/gen/wxGraphicsRenderer.erl index 21082bde23..2b64f86182 100644 --- a/lib/wx/src/gen/wxGraphicsRenderer.erl +++ b/lib/wx/src/gen/wxGraphicsRenderer.erl @@ -32,6 +32,8 @@ -export([parent_class/1]). -export_type([wxGraphicsRenderer/0]). +-deprecated([createLinearGradientBrush/7,createRadialGradientBrush/8]). + %% @hidden parent_class(_Class) -> erlang:error({badtype, ?MODULE}). diff --git a/lib/wx/src/gen/wxGridCellEditor.erl b/lib/wx/src/gen/wxGridCellEditor.erl index e84cdeb49a..4f86e307b5 100644 --- a/lib/wx/src/gen/wxGridCellEditor.erl +++ b/lib/wx/src/gen/wxGridCellEditor.erl @@ -31,6 +31,8 @@ -export([parent_class/1]). -export_type([wxGridCellEditor/0]). +-deprecated([endEdit/4,paintBackground/3]). + %% @hidden parent_class(_Class) -> erlang:error({badtype, ?MODULE}). diff --git a/lib/wx/src/gen/wxIdleEvent.erl b/lib/wx/src/gen/wxIdleEvent.erl index 4749026446..a19fdcc48e 100644 --- a/lib/wx/src/gen/wxIdleEvent.erl +++ b/lib/wx/src/gen/wxIdleEvent.erl @@ -38,6 +38,8 @@ resumePropagation/2,shouldPropagate/1,skip/1,skip/2,stopPropagation/1]). -export_type([wxIdleEvent/0]). +-deprecated([canSend/1]). + %% @hidden parent_class(wxEvent) -> true; parent_class(_Class) -> erlang:error({badtype, ?MODULE}). diff --git a/lib/wx/src/gen/wxImage.erl b/lib/wx/src/gen/wxImage.erl index c21b5d4789..0edaee2979 100644 --- a/lib/wx/src/gen/wxImage.erl +++ b/lib/wx/src/gen/wxImage.erl @@ -424,9 +424,10 @@ getImageCount(Name) getImageCount(Name, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wximage.html#wximagegetimagecount">external documentation</a>. +%%<br /> Type = ?wxBITMAP_TYPE_INVALID | ?wxBITMAP_TYPE_BMP | ?wxBITMAP_TYPE_BMP_RESOURCE | ?wxBITMAP_TYPE_RESOURCE | ?wxBITMAP_TYPE_ICO | ?wxBITMAP_TYPE_ICO_RESOURCE | ?wxBITMAP_TYPE_CUR | ?wxBITMAP_TYPE_CUR_RESOURCE | ?wxBITMAP_TYPE_XBM | ?wxBITMAP_TYPE_XBM_DATA | ?wxBITMAP_TYPE_XPM | ?wxBITMAP_TYPE_XPM_DATA | ?wxBITMAP_TYPE_TIF | ?wxBITMAP_TYPE_TIF_RESOURCE | ?wxBITMAP_TYPE_GIF | ?wxBITMAP_TYPE_GIF_RESOURCE | ?wxBITMAP_TYPE_PNG | ?wxBITMAP_TYPE_PNG_RESOURCE | ?wxBITMAP_TYPE_JPEG | ?wxBITMAP_TYPE_JPEG_RESOURCE | ?wxBITMAP_TYPE_PNM | ?wxBITMAP_TYPE_PNM_RESOURCE | ?wxBITMAP_TYPE_PCX | ?wxBITMAP_TYPE_PCX_RESOURCE | ?wxBITMAP_TYPE_PICT | ?wxBITMAP_TYPE_PICT_RESOURCE | ?wxBITMAP_TYPE_ICON | ?wxBITMAP_TYPE_ICON_RESOURCE | ?wxBITMAP_TYPE_ANI | ?wxBITMAP_TYPE_IFF | ?wxBITMAP_TYPE_TGA | ?wxBITMAP_TYPE_MACCURSOR | ?wxBITMAP_TYPE_MACCURSOR_RESOURCE | ?wxBITMAP_TYPE_ANY -spec getImageCount(Name, [Option]) -> integer() when Name::unicode:chardata(), - Option :: {type, integer()}. + Option :: {type, wx:wx_enum()}. getImageCount(Name, Options) when is_list(Name),is_list(Options) -> Name_UC = unicode:characters_to_binary([Name,0]), @@ -687,9 +688,10 @@ rescale(This,Width,Height) rescale(This,Width,Height, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wximage.html#wximagerescale">external documentation</a>. +%%<br /> Quality = integer -spec rescale(This, Width, Height, [Option]) -> wxImage() when This::wxImage(), Width::integer(), Height::integer(), - Option :: {quality, integer()}. + Option :: {quality, wx:wx_enum()}. rescale(#wx_ref{type=ThisT,ref=ThisRef},Width,Height, Options) when is_integer(Width),is_integer(Height),is_list(Options) -> ?CLASS(ThisT,wxImage), @@ -819,9 +821,10 @@ scale(This,Width,Height) scale(This,Width,Height, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wximage.html#wximagescale">external documentation</a>. +%%<br /> Quality = integer -spec scale(This, Width, Height, [Option]) -> wxImage() when This::wxImage(), Width::integer(), Height::integer(), - Option :: {quality, integer()}. + Option :: {quality, wx:wx_enum()}. scale(#wx_ref{type=ThisT,ref=ThisRef},Width,Height, Options) when is_integer(Width),is_integer(Height),is_list(Options) -> ?CLASS(ThisT,wxImage), diff --git a/lib/wx/src/gen/wxMDIClientWindow.erl b/lib/wx/src/gen/wxMDIClientWindow.erl index 344dcdbbaf..bfdba336f8 100644 --- a/lib/wx/src/gen/wxMDIClientWindow.erl +++ b/lib/wx/src/gen/wxMDIClientWindow.erl @@ -69,6 +69,8 @@ update/1,updateWindowUI/1,updateWindowUI/2,validate/1,warpPointer/3]). -export_type([wxMDIClientWindow/0]). +-deprecated([new/1,new/2]). + %% @hidden parent_class(wxWindow) -> true; parent_class(wxEvtHandler) -> true; diff --git a/lib/wx/src/gen/wxMouseEvent.erl b/lib/wx/src/gen/wxMouseEvent.erl index 97ea9e908f..29a4f13ba8 100644 --- a/lib/wx/src/gen/wxMouseEvent.erl +++ b/lib/wx/src/gen/wxMouseEvent.erl @@ -19,7 +19,7 @@ %% @doc See external documentation: <a href="http://www.wxwidgets.org/manuals/stable/wx_wxmouseevent.html">wxMouseEvent</a>. %% <dl><dt>Use {@link wxEvtHandler:connect/3.} with EventType:</dt> -%% <dd><em>left_down</em>, <em>left_up</em>, <em>middle_down</em>, <em>middle_up</em>, <em>right_down</em>, <em>right_up</em>, <em>motion</em>, <em>enter_window</em>, <em>leave_window</em>, <em>left_dclick</em>, <em>middle_dclick</em>, <em>right_dclick</em>, <em>mousewheel</em>, <em>nc_left_down</em>, <em>nc_left_up</em>, <em>nc_middle_down</em>, <em>nc_middle_up</em>, <em>nc_right_down</em>, <em>nc_right_up</em>, <em>nc_motion</em>, <em>nc_enter_window</em>, <em>nc_leave_window</em>, <em>nc_left_dclick</em>, <em>nc_middle_dclick</em>, <em>nc_right_dclick</em></dd></dl> +%% <dd><em>left_down</em>, <em>left_up</em>, <em>middle_down</em>, <em>middle_up</em>, <em>right_down</em>, <em>right_up</em>, <em>motion</em>, <em>enter_window</em>, <em>leave_window</em>, <em>left_dclick</em>, <em>middle_dclick</em>, <em>right_dclick</em>, <em>mousewheel</em></dd></dl> %% See also the message variant {@link wxEvtHandler:wxMouse(). #wxMouse{}} event record type. %% %% <p>This class is derived (and can use functions) from: diff --git a/lib/wx/src/gen/wxPageSetupDialogData.erl b/lib/wx/src/gen/wxPageSetupDialogData.erl index 7c453a9872..4850e62925 100644 --- a/lib/wx/src/gen/wxPageSetupDialogData.erl +++ b/lib/wx/src/gen/wxPageSetupDialogData.erl @@ -194,7 +194,8 @@ getMinMarginBottomRight(#wx_ref{type=ThisT,ref=ThisRef}) -> <<ThisRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxpagesetupdialogdata.html#wxpagesetupdialogdatagetpaperid">external documentation</a>. --spec getPaperId(This) -> integer() when +%%<br /> Res = ?wxPAPER_NONE | ?wxPAPER_LETTER | ?wxPAPER_LEGAL | ?wxPAPER_A4 | ?wxPAPER_CSHEET | ?wxPAPER_DSHEET | ?wxPAPER_ESHEET | ?wxPAPER_LETTERSMALL | ?wxPAPER_TABLOID | ?wxPAPER_LEDGER | ?wxPAPER_STATEMENT | ?wxPAPER_EXECUTIVE | ?wxPAPER_A3 | ?wxPAPER_A4SMALL | ?wxPAPER_A5 | ?wxPAPER_B4 | ?wxPAPER_B5 | ?wxPAPER_FOLIO | ?wxPAPER_QUARTO | ?wxPAPER_10X14 | ?wxPAPER_11X17 | ?wxPAPER_NOTE | ?wxPAPER_ENV_9 | ?wxPAPER_ENV_10 | ?wxPAPER_ENV_11 | ?wxPAPER_ENV_12 | ?wxPAPER_ENV_14 | ?wxPAPER_ENV_DL | ?wxPAPER_ENV_C5 | ?wxPAPER_ENV_C3 | ?wxPAPER_ENV_C4 | ?wxPAPER_ENV_C6 | ?wxPAPER_ENV_C65 | ?wxPAPER_ENV_B4 | ?wxPAPER_ENV_B5 | ?wxPAPER_ENV_B6 | ?wxPAPER_ENV_ITALY | ?wxPAPER_ENV_MONARCH | ?wxPAPER_ENV_PERSONAL | ?wxPAPER_FANFOLD_US | ?wxPAPER_FANFOLD_STD_GERMAN | ?wxPAPER_FANFOLD_LGL_GERMAN | ?wxPAPER_ISO_B4 | ?wxPAPER_JAPANESE_POSTCARD | ?wxPAPER_9X11 | ?wxPAPER_10X11 | ?wxPAPER_15X11 | ?wxPAPER_ENV_INVITE | ?wxPAPER_LETTER_EXTRA | ?wxPAPER_LEGAL_EXTRA | ?wxPAPER_TABLOID_EXTRA | ?wxPAPER_A4_EXTRA | ?wxPAPER_LETTER_TRANSVERSE | ?wxPAPER_A4_TRANSVERSE | ?wxPAPER_LETTER_EXTRA_TRANSVERSE | ?wxPAPER_A_PLUS | ?wxPAPER_B_PLUS | ?wxPAPER_LETTER_PLUS | ?wxPAPER_A4_PLUS | ?wxPAPER_A5_TRANSVERSE | ?wxPAPER_B5_TRANSVERSE | ?wxPAPER_A3_EXTRA | ?wxPAPER_A5_EXTRA | ?wxPAPER_B5_EXTRA | ?wxPAPER_A2 | ?wxPAPER_A3_TRANSVERSE | ?wxPAPER_A3_EXTRA_TRANSVERSE | ?wxPAPER_DBL_JAPANESE_POSTCARD | ?wxPAPER_A6 | ?wxPAPER_JENV_KAKU2 | ?wxPAPER_JENV_KAKU3 | ?wxPAPER_JENV_CHOU3 | ?wxPAPER_JENV_CHOU4 | ?wxPAPER_LETTER_ROTATED | ?wxPAPER_A3_ROTATED | ?wxPAPER_A4_ROTATED | ?wxPAPER_A5_ROTATED | ?wxPAPER_B4_JIS_ROTATED | ?wxPAPER_B5_JIS_ROTATED | ?wxPAPER_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_A6_ROTATED | ?wxPAPER_JENV_KAKU2_ROTATED | ?wxPAPER_JENV_KAKU3_ROTATED | ?wxPAPER_JENV_CHOU3_ROTATED | ?wxPAPER_JENV_CHOU4_ROTATED | ?wxPAPER_B6_JIS | ?wxPAPER_B6_JIS_ROTATED | ?wxPAPER_12X11 | ?wxPAPER_JENV_YOU4 | ?wxPAPER_JENV_YOU4_ROTATED | ?wxPAPER_P16K | ?wxPAPER_P32K | ?wxPAPER_P32KBIG | ?wxPAPER_PENV_1 | ?wxPAPER_PENV_2 | ?wxPAPER_PENV_3 | ?wxPAPER_PENV_4 | ?wxPAPER_PENV_5 | ?wxPAPER_PENV_6 | ?wxPAPER_PENV_7 | ?wxPAPER_PENV_8 | ?wxPAPER_PENV_9 | ?wxPAPER_PENV_10 | ?wxPAPER_P16K_ROTATED | ?wxPAPER_P32K_ROTATED | ?wxPAPER_P32KBIG_ROTATED | ?wxPAPER_PENV_1_ROTATED | ?wxPAPER_PENV_2_ROTATED | ?wxPAPER_PENV_3_ROTATED | ?wxPAPER_PENV_4_ROTATED | ?wxPAPER_PENV_5_ROTATED | ?wxPAPER_PENV_6_ROTATED | ?wxPAPER_PENV_7_ROTATED | ?wxPAPER_PENV_8_ROTATED | ?wxPAPER_PENV_9_ROTATED | ?wxPAPER_PENV_10_ROTATED +-spec getPaperId(This) -> wx:wx_enum() when This::wxPageSetupDialogData(). getPaperId(#wx_ref{type=ThisT,ref=ThisRef}) -> ?CLASS(ThisT,wxPageSetupDialogData), @@ -280,8 +281,9 @@ setMinMarginBottomRight(#wx_ref{type=ThisT,ref=ThisRef},{PtX,PtY}) <<ThisRef:32/?UI,PtX:32/?UI,PtY:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxpagesetupdialogdata.html#wxpagesetupdialogdatasetpaperid">external documentation</a>. +%%<br /> Id = ?wxPAPER_NONE | ?wxPAPER_LETTER | ?wxPAPER_LEGAL | ?wxPAPER_A4 | ?wxPAPER_CSHEET | ?wxPAPER_DSHEET | ?wxPAPER_ESHEET | ?wxPAPER_LETTERSMALL | ?wxPAPER_TABLOID | ?wxPAPER_LEDGER | ?wxPAPER_STATEMENT | ?wxPAPER_EXECUTIVE | ?wxPAPER_A3 | ?wxPAPER_A4SMALL | ?wxPAPER_A5 | ?wxPAPER_B4 | ?wxPAPER_B5 | ?wxPAPER_FOLIO | ?wxPAPER_QUARTO | ?wxPAPER_10X14 | ?wxPAPER_11X17 | ?wxPAPER_NOTE | ?wxPAPER_ENV_9 | ?wxPAPER_ENV_10 | ?wxPAPER_ENV_11 | ?wxPAPER_ENV_12 | ?wxPAPER_ENV_14 | ?wxPAPER_ENV_DL | ?wxPAPER_ENV_C5 | ?wxPAPER_ENV_C3 | ?wxPAPER_ENV_C4 | ?wxPAPER_ENV_C6 | ?wxPAPER_ENV_C65 | ?wxPAPER_ENV_B4 | ?wxPAPER_ENV_B5 | ?wxPAPER_ENV_B6 | ?wxPAPER_ENV_ITALY | ?wxPAPER_ENV_MONARCH | ?wxPAPER_ENV_PERSONAL | ?wxPAPER_FANFOLD_US | ?wxPAPER_FANFOLD_STD_GERMAN | ?wxPAPER_FANFOLD_LGL_GERMAN | ?wxPAPER_ISO_B4 | ?wxPAPER_JAPANESE_POSTCARD | ?wxPAPER_9X11 | ?wxPAPER_10X11 | ?wxPAPER_15X11 | ?wxPAPER_ENV_INVITE | ?wxPAPER_LETTER_EXTRA | ?wxPAPER_LEGAL_EXTRA | ?wxPAPER_TABLOID_EXTRA | ?wxPAPER_A4_EXTRA | ?wxPAPER_LETTER_TRANSVERSE | ?wxPAPER_A4_TRANSVERSE | ?wxPAPER_LETTER_EXTRA_TRANSVERSE | ?wxPAPER_A_PLUS | ?wxPAPER_B_PLUS | ?wxPAPER_LETTER_PLUS | ?wxPAPER_A4_PLUS | ?wxPAPER_A5_TRANSVERSE | ?wxPAPER_B5_TRANSVERSE | ?wxPAPER_A3_EXTRA | ?wxPAPER_A5_EXTRA | ?wxPAPER_B5_EXTRA | ?wxPAPER_A2 | ?wxPAPER_A3_TRANSVERSE | ?wxPAPER_A3_EXTRA_TRANSVERSE | ?wxPAPER_DBL_JAPANESE_POSTCARD | ?wxPAPER_A6 | ?wxPAPER_JENV_KAKU2 | ?wxPAPER_JENV_KAKU3 | ?wxPAPER_JENV_CHOU3 | ?wxPAPER_JENV_CHOU4 | ?wxPAPER_LETTER_ROTATED | ?wxPAPER_A3_ROTATED | ?wxPAPER_A4_ROTATED | ?wxPAPER_A5_ROTATED | ?wxPAPER_B4_JIS_ROTATED | ?wxPAPER_B5_JIS_ROTATED | ?wxPAPER_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_A6_ROTATED | ?wxPAPER_JENV_KAKU2_ROTATED | ?wxPAPER_JENV_KAKU3_ROTATED | ?wxPAPER_JENV_CHOU3_ROTATED | ?wxPAPER_JENV_CHOU4_ROTATED | ?wxPAPER_B6_JIS | ?wxPAPER_B6_JIS_ROTATED | ?wxPAPER_12X11 | ?wxPAPER_JENV_YOU4 | ?wxPAPER_JENV_YOU4_ROTATED | ?wxPAPER_P16K | ?wxPAPER_P32K | ?wxPAPER_P32KBIG | ?wxPAPER_PENV_1 | ?wxPAPER_PENV_2 | ?wxPAPER_PENV_3 | ?wxPAPER_PENV_4 | ?wxPAPER_PENV_5 | ?wxPAPER_PENV_6 | ?wxPAPER_PENV_7 | ?wxPAPER_PENV_8 | ?wxPAPER_PENV_9 | ?wxPAPER_PENV_10 | ?wxPAPER_P16K_ROTATED | ?wxPAPER_P32K_ROTATED | ?wxPAPER_P32KBIG_ROTATED | ?wxPAPER_PENV_1_ROTATED | ?wxPAPER_PENV_2_ROTATED | ?wxPAPER_PENV_3_ROTATED | ?wxPAPER_PENV_4_ROTATED | ?wxPAPER_PENV_5_ROTATED | ?wxPAPER_PENV_6_ROTATED | ?wxPAPER_PENV_7_ROTATED | ?wxPAPER_PENV_8_ROTATED | ?wxPAPER_PENV_9_ROTATED | ?wxPAPER_PENV_10_ROTATED -spec setPaperId(This, Id) -> ok when - This::wxPageSetupDialogData(), Id::integer(). + This::wxPageSetupDialogData(), Id::wx:wx_enum(). setPaperId(#wx_ref{type=ThisT,ref=ThisRef},Id) when is_integer(Id) -> ?CLASS(ThisT,wxPageSetupDialogData), @@ -293,8 +295,9 @@ setPaperId(#wx_ref{type=ThisT,ref=ThisRef},Id) %% setPaperSize(This, Sz) -> ok when<br /> %% This::wxPageSetupDialogData(), Sz::{W::integer(), H::integer()}.<br /> %% +%%<br /> Id = ?wxPAPER_NONE | ?wxPAPER_LETTER | ?wxPAPER_LEGAL | ?wxPAPER_A4 | ?wxPAPER_CSHEET | ?wxPAPER_DSHEET | ?wxPAPER_ESHEET | ?wxPAPER_LETTERSMALL | ?wxPAPER_TABLOID | ?wxPAPER_LEDGER | ?wxPAPER_STATEMENT | ?wxPAPER_EXECUTIVE | ?wxPAPER_A3 | ?wxPAPER_A4SMALL | ?wxPAPER_A5 | ?wxPAPER_B4 | ?wxPAPER_B5 | ?wxPAPER_FOLIO | ?wxPAPER_QUARTO | ?wxPAPER_10X14 | ?wxPAPER_11X17 | ?wxPAPER_NOTE | ?wxPAPER_ENV_9 | ?wxPAPER_ENV_10 | ?wxPAPER_ENV_11 | ?wxPAPER_ENV_12 | ?wxPAPER_ENV_14 | ?wxPAPER_ENV_DL | ?wxPAPER_ENV_C5 | ?wxPAPER_ENV_C3 | ?wxPAPER_ENV_C4 | ?wxPAPER_ENV_C6 | ?wxPAPER_ENV_C65 | ?wxPAPER_ENV_B4 | ?wxPAPER_ENV_B5 | ?wxPAPER_ENV_B6 | ?wxPAPER_ENV_ITALY | ?wxPAPER_ENV_MONARCH | ?wxPAPER_ENV_PERSONAL | ?wxPAPER_FANFOLD_US | ?wxPAPER_FANFOLD_STD_GERMAN | ?wxPAPER_FANFOLD_LGL_GERMAN | ?wxPAPER_ISO_B4 | ?wxPAPER_JAPANESE_POSTCARD | ?wxPAPER_9X11 | ?wxPAPER_10X11 | ?wxPAPER_15X11 | ?wxPAPER_ENV_INVITE | ?wxPAPER_LETTER_EXTRA | ?wxPAPER_LEGAL_EXTRA | ?wxPAPER_TABLOID_EXTRA | ?wxPAPER_A4_EXTRA | ?wxPAPER_LETTER_TRANSVERSE | ?wxPAPER_A4_TRANSVERSE | ?wxPAPER_LETTER_EXTRA_TRANSVERSE | ?wxPAPER_A_PLUS | ?wxPAPER_B_PLUS | ?wxPAPER_LETTER_PLUS | ?wxPAPER_A4_PLUS | ?wxPAPER_A5_TRANSVERSE | ?wxPAPER_B5_TRANSVERSE | ?wxPAPER_A3_EXTRA | ?wxPAPER_A5_EXTRA | ?wxPAPER_B5_EXTRA | ?wxPAPER_A2 | ?wxPAPER_A3_TRANSVERSE | ?wxPAPER_A3_EXTRA_TRANSVERSE | ?wxPAPER_DBL_JAPANESE_POSTCARD | ?wxPAPER_A6 | ?wxPAPER_JENV_KAKU2 | ?wxPAPER_JENV_KAKU3 | ?wxPAPER_JENV_CHOU3 | ?wxPAPER_JENV_CHOU4 | ?wxPAPER_LETTER_ROTATED | ?wxPAPER_A3_ROTATED | ?wxPAPER_A4_ROTATED | ?wxPAPER_A5_ROTATED | ?wxPAPER_B4_JIS_ROTATED | ?wxPAPER_B5_JIS_ROTATED | ?wxPAPER_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_A6_ROTATED | ?wxPAPER_JENV_KAKU2_ROTATED | ?wxPAPER_JENV_KAKU3_ROTATED | ?wxPAPER_JENV_CHOU3_ROTATED | ?wxPAPER_JENV_CHOU4_ROTATED | ?wxPAPER_B6_JIS | ?wxPAPER_B6_JIS_ROTATED | ?wxPAPER_12X11 | ?wxPAPER_JENV_YOU4 | ?wxPAPER_JENV_YOU4_ROTATED | ?wxPAPER_P16K | ?wxPAPER_P32K | ?wxPAPER_P32KBIG | ?wxPAPER_PENV_1 | ?wxPAPER_PENV_2 | ?wxPAPER_PENV_3 | ?wxPAPER_PENV_4 | ?wxPAPER_PENV_5 | ?wxPAPER_PENV_6 | ?wxPAPER_PENV_7 | ?wxPAPER_PENV_8 | ?wxPAPER_PENV_9 | ?wxPAPER_PENV_10 | ?wxPAPER_P16K_ROTATED | ?wxPAPER_P32K_ROTATED | ?wxPAPER_P32KBIG_ROTATED | ?wxPAPER_PENV_1_ROTATED | ?wxPAPER_PENV_2_ROTATED | ?wxPAPER_PENV_3_ROTATED | ?wxPAPER_PENV_4_ROTATED | ?wxPAPER_PENV_5_ROTATED | ?wxPAPER_PENV_6_ROTATED | ?wxPAPER_PENV_7_ROTATED | ?wxPAPER_PENV_8_ROTATED | ?wxPAPER_PENV_9_ROTATED | ?wxPAPER_PENV_10_ROTATED -spec setPaperSize(This, Id) -> ok when - This::wxPageSetupDialogData(), Id::integer(); + This::wxPageSetupDialogData(), Id::wx:wx_enum(); (This, Sz) -> ok when This::wxPageSetupDialogData(), Sz::{W::integer(), H::integer()}. setPaperSize(#wx_ref{type=ThisT,ref=ThisRef},Id) diff --git a/lib/wx/src/gen/wxPaintDC.erl b/lib/wx/src/gen/wxPaintDC.erl index 9e81bc31af..6648f278bb 100644 --- a/lib/wx/src/gen/wxPaintDC.erl +++ b/lib/wx/src/gen/wxPaintDC.erl @@ -54,6 +54,8 @@ startPage/1]). -export_type([wxPaintDC/0]). +-deprecated([new/0]). + %% @hidden parent_class(wxWindowDC) -> true; parent_class(wxDC) -> true; diff --git a/lib/wx/src/gen/wxPaintEvent.erl b/lib/wx/src/gen/wxPaintEvent.erl index a13db607a4..80ac7d78ce 100644 --- a/lib/wx/src/gen/wxPaintEvent.erl +++ b/lib/wx/src/gen/wxPaintEvent.erl @@ -19,7 +19,7 @@ %% @doc See external documentation: <a href="http://www.wxwidgets.org/manuals/stable/wx_wxpaintevent.html">wxPaintEvent</a>. %% <dl><dt>Use {@link wxEvtHandler:connect/3.} with EventType:</dt> -%% <dd><em>paint</em>, <em>paint_icon</em></dd></dl> +%% <dd><em>paint</em></dd></dl> %% See also the message variant {@link wxEvtHandler:wxPaint(). #wxPaint{}} event record type. %% %% <p>This class is derived (and can use functions) from: diff --git a/lib/wx/src/gen/wxPen.erl b/lib/wx/src/gen/wxPen.erl index 8b8aafddba..681a7edebc 100644 --- a/lib/wx/src/gen/wxPen.erl +++ b/lib/wx/src/gen/wxPen.erl @@ -113,8 +113,9 @@ isOk(#wx_ref{type=ThisT,ref=ThisRef}) -> <<ThisRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxpen.html#wxpensetcap">external documentation</a>. +%%<br /> CapStyle = integer -spec setCap(This, CapStyle) -> ok when - This::wxPen(), CapStyle::integer(). + This::wxPen(), CapStyle::wx:wx_enum(). setCap(#wx_ref{type=ThisT,ref=ThisRef},CapStyle) when is_integer(CapStyle) -> ?CLASS(ThisT,wxPen), @@ -140,8 +141,9 @@ setColour(#wx_ref{type=ThisT,ref=ThisRef},Red,Green,Blue) <<ThisRef:32/?UI,Red:32/?UI,Green:32/?UI,Blue:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxpen.html#wxpensetjoin">external documentation</a>. +%%<br /> JoinStyle = integer -spec setJoin(This, JoinStyle) -> ok when - This::wxPen(), JoinStyle::integer(). + This::wxPen(), JoinStyle::wx:wx_enum(). setJoin(#wx_ref{type=ThisT,ref=ThisRef},JoinStyle) when is_integer(JoinStyle) -> ?CLASS(ThisT,wxPen), diff --git a/lib/wx/src/gen/wxPostScriptDC.erl b/lib/wx/src/gen/wxPostScriptDC.erl index 2eb25b6a8e..5329d4562e 100644 --- a/lib/wx/src/gen/wxPostScriptDC.erl +++ b/lib/wx/src/gen/wxPostScriptDC.erl @@ -53,6 +53,8 @@ startPage/1]). -export_type([wxPostScriptDC/0]). +-deprecated([getResolution/0,setResolution/1]). + %% @hidden parent_class(wxDC) -> true; parent_class(_Class) -> erlang:error({badtype, ?MODULE}). diff --git a/lib/wx/src/gen/wxPrintData.erl b/lib/wx/src/gen/wxPrintData.erl index 2cb8dd3c5f..79ba26afab 100644 --- a/lib/wx/src/gen/wxPrintData.erl +++ b/lib/wx/src/gen/wxPrintData.erl @@ -102,7 +102,8 @@ getOrientation(#wx_ref{type=ThisT,ref=ThisRef}) -> <<ThisRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxprintdata.html#wxprintdatagetpaperid">external documentation</a>. --spec getPaperId(This) -> integer() when +%%<br /> Res = ?wxPAPER_NONE | ?wxPAPER_LETTER | ?wxPAPER_LEGAL | ?wxPAPER_A4 | ?wxPAPER_CSHEET | ?wxPAPER_DSHEET | ?wxPAPER_ESHEET | ?wxPAPER_LETTERSMALL | ?wxPAPER_TABLOID | ?wxPAPER_LEDGER | ?wxPAPER_STATEMENT | ?wxPAPER_EXECUTIVE | ?wxPAPER_A3 | ?wxPAPER_A4SMALL | ?wxPAPER_A5 | ?wxPAPER_B4 | ?wxPAPER_B5 | ?wxPAPER_FOLIO | ?wxPAPER_QUARTO | ?wxPAPER_10X14 | ?wxPAPER_11X17 | ?wxPAPER_NOTE | ?wxPAPER_ENV_9 | ?wxPAPER_ENV_10 | ?wxPAPER_ENV_11 | ?wxPAPER_ENV_12 | ?wxPAPER_ENV_14 | ?wxPAPER_ENV_DL | ?wxPAPER_ENV_C5 | ?wxPAPER_ENV_C3 | ?wxPAPER_ENV_C4 | ?wxPAPER_ENV_C6 | ?wxPAPER_ENV_C65 | ?wxPAPER_ENV_B4 | ?wxPAPER_ENV_B5 | ?wxPAPER_ENV_B6 | ?wxPAPER_ENV_ITALY | ?wxPAPER_ENV_MONARCH | ?wxPAPER_ENV_PERSONAL | ?wxPAPER_FANFOLD_US | ?wxPAPER_FANFOLD_STD_GERMAN | ?wxPAPER_FANFOLD_LGL_GERMAN | ?wxPAPER_ISO_B4 | ?wxPAPER_JAPANESE_POSTCARD | ?wxPAPER_9X11 | ?wxPAPER_10X11 | ?wxPAPER_15X11 | ?wxPAPER_ENV_INVITE | ?wxPAPER_LETTER_EXTRA | ?wxPAPER_LEGAL_EXTRA | ?wxPAPER_TABLOID_EXTRA | ?wxPAPER_A4_EXTRA | ?wxPAPER_LETTER_TRANSVERSE | ?wxPAPER_A4_TRANSVERSE | ?wxPAPER_LETTER_EXTRA_TRANSVERSE | ?wxPAPER_A_PLUS | ?wxPAPER_B_PLUS | ?wxPAPER_LETTER_PLUS | ?wxPAPER_A4_PLUS | ?wxPAPER_A5_TRANSVERSE | ?wxPAPER_B5_TRANSVERSE | ?wxPAPER_A3_EXTRA | ?wxPAPER_A5_EXTRA | ?wxPAPER_B5_EXTRA | ?wxPAPER_A2 | ?wxPAPER_A3_TRANSVERSE | ?wxPAPER_A3_EXTRA_TRANSVERSE | ?wxPAPER_DBL_JAPANESE_POSTCARD | ?wxPAPER_A6 | ?wxPAPER_JENV_KAKU2 | ?wxPAPER_JENV_KAKU3 | ?wxPAPER_JENV_CHOU3 | ?wxPAPER_JENV_CHOU4 | ?wxPAPER_LETTER_ROTATED | ?wxPAPER_A3_ROTATED | ?wxPAPER_A4_ROTATED | ?wxPAPER_A5_ROTATED | ?wxPAPER_B4_JIS_ROTATED | ?wxPAPER_B5_JIS_ROTATED | ?wxPAPER_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_A6_ROTATED | ?wxPAPER_JENV_KAKU2_ROTATED | ?wxPAPER_JENV_KAKU3_ROTATED | ?wxPAPER_JENV_CHOU3_ROTATED | ?wxPAPER_JENV_CHOU4_ROTATED | ?wxPAPER_B6_JIS | ?wxPAPER_B6_JIS_ROTATED | ?wxPAPER_12X11 | ?wxPAPER_JENV_YOU4 | ?wxPAPER_JENV_YOU4_ROTATED | ?wxPAPER_P16K | ?wxPAPER_P32K | ?wxPAPER_P32KBIG | ?wxPAPER_PENV_1 | ?wxPAPER_PENV_2 | ?wxPAPER_PENV_3 | ?wxPAPER_PENV_4 | ?wxPAPER_PENV_5 | ?wxPAPER_PENV_6 | ?wxPAPER_PENV_7 | ?wxPAPER_PENV_8 | ?wxPAPER_PENV_9 | ?wxPAPER_PENV_10 | ?wxPAPER_P16K_ROTATED | ?wxPAPER_P32K_ROTATED | ?wxPAPER_P32KBIG_ROTATED | ?wxPAPER_PENV_1_ROTATED | ?wxPAPER_PENV_2_ROTATED | ?wxPAPER_PENV_3_ROTATED | ?wxPAPER_PENV_4_ROTATED | ?wxPAPER_PENV_5_ROTATED | ?wxPAPER_PENV_6_ROTATED | ?wxPAPER_PENV_7_ROTATED | ?wxPAPER_PENV_8_ROTATED | ?wxPAPER_PENV_9_ROTATED | ?wxPAPER_PENV_10_ROTATED +-spec getPaperId(This) -> wx:wx_enum() when This::wxPrintData(). getPaperId(#wx_ref{type=ThisT,ref=ThisRef}) -> ?CLASS(ThisT,wxPrintData), @@ -190,8 +191,9 @@ setOrientation(#wx_ref{type=ThisT,ref=ThisRef},Orient) <<ThisRef:32/?UI,Orient:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxprintdata.html#wxprintdatasetpaperid">external documentation</a>. +%%<br /> SizeId = ?wxPAPER_NONE | ?wxPAPER_LETTER | ?wxPAPER_LEGAL | ?wxPAPER_A4 | ?wxPAPER_CSHEET | ?wxPAPER_DSHEET | ?wxPAPER_ESHEET | ?wxPAPER_LETTERSMALL | ?wxPAPER_TABLOID | ?wxPAPER_LEDGER | ?wxPAPER_STATEMENT | ?wxPAPER_EXECUTIVE | ?wxPAPER_A3 | ?wxPAPER_A4SMALL | ?wxPAPER_A5 | ?wxPAPER_B4 | ?wxPAPER_B5 | ?wxPAPER_FOLIO | ?wxPAPER_QUARTO | ?wxPAPER_10X14 | ?wxPAPER_11X17 | ?wxPAPER_NOTE | ?wxPAPER_ENV_9 | ?wxPAPER_ENV_10 | ?wxPAPER_ENV_11 | ?wxPAPER_ENV_12 | ?wxPAPER_ENV_14 | ?wxPAPER_ENV_DL | ?wxPAPER_ENV_C5 | ?wxPAPER_ENV_C3 | ?wxPAPER_ENV_C4 | ?wxPAPER_ENV_C6 | ?wxPAPER_ENV_C65 | ?wxPAPER_ENV_B4 | ?wxPAPER_ENV_B5 | ?wxPAPER_ENV_B6 | ?wxPAPER_ENV_ITALY | ?wxPAPER_ENV_MONARCH | ?wxPAPER_ENV_PERSONAL | ?wxPAPER_FANFOLD_US | ?wxPAPER_FANFOLD_STD_GERMAN | ?wxPAPER_FANFOLD_LGL_GERMAN | ?wxPAPER_ISO_B4 | ?wxPAPER_JAPANESE_POSTCARD | ?wxPAPER_9X11 | ?wxPAPER_10X11 | ?wxPAPER_15X11 | ?wxPAPER_ENV_INVITE | ?wxPAPER_LETTER_EXTRA | ?wxPAPER_LEGAL_EXTRA | ?wxPAPER_TABLOID_EXTRA | ?wxPAPER_A4_EXTRA | ?wxPAPER_LETTER_TRANSVERSE | ?wxPAPER_A4_TRANSVERSE | ?wxPAPER_LETTER_EXTRA_TRANSVERSE | ?wxPAPER_A_PLUS | ?wxPAPER_B_PLUS | ?wxPAPER_LETTER_PLUS | ?wxPAPER_A4_PLUS | ?wxPAPER_A5_TRANSVERSE | ?wxPAPER_B5_TRANSVERSE | ?wxPAPER_A3_EXTRA | ?wxPAPER_A5_EXTRA | ?wxPAPER_B5_EXTRA | ?wxPAPER_A2 | ?wxPAPER_A3_TRANSVERSE | ?wxPAPER_A3_EXTRA_TRANSVERSE | ?wxPAPER_DBL_JAPANESE_POSTCARD | ?wxPAPER_A6 | ?wxPAPER_JENV_KAKU2 | ?wxPAPER_JENV_KAKU3 | ?wxPAPER_JENV_CHOU3 | ?wxPAPER_JENV_CHOU4 | ?wxPAPER_LETTER_ROTATED | ?wxPAPER_A3_ROTATED | ?wxPAPER_A4_ROTATED | ?wxPAPER_A5_ROTATED | ?wxPAPER_B4_JIS_ROTATED | ?wxPAPER_B5_JIS_ROTATED | ?wxPAPER_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED | ?wxPAPER_A6_ROTATED | ?wxPAPER_JENV_KAKU2_ROTATED | ?wxPAPER_JENV_KAKU3_ROTATED | ?wxPAPER_JENV_CHOU3_ROTATED | ?wxPAPER_JENV_CHOU4_ROTATED | ?wxPAPER_B6_JIS | ?wxPAPER_B6_JIS_ROTATED | ?wxPAPER_12X11 | ?wxPAPER_JENV_YOU4 | ?wxPAPER_JENV_YOU4_ROTATED | ?wxPAPER_P16K | ?wxPAPER_P32K | ?wxPAPER_P32KBIG | ?wxPAPER_PENV_1 | ?wxPAPER_PENV_2 | ?wxPAPER_PENV_3 | ?wxPAPER_PENV_4 | ?wxPAPER_PENV_5 | ?wxPAPER_PENV_6 | ?wxPAPER_PENV_7 | ?wxPAPER_PENV_8 | ?wxPAPER_PENV_9 | ?wxPAPER_PENV_10 | ?wxPAPER_P16K_ROTATED | ?wxPAPER_P32K_ROTATED | ?wxPAPER_P32KBIG_ROTATED | ?wxPAPER_PENV_1_ROTATED | ?wxPAPER_PENV_2_ROTATED | ?wxPAPER_PENV_3_ROTATED | ?wxPAPER_PENV_4_ROTATED | ?wxPAPER_PENV_5_ROTATED | ?wxPAPER_PENV_6_ROTATED | ?wxPAPER_PENV_7_ROTATED | ?wxPAPER_PENV_8_ROTATED | ?wxPAPER_PENV_9_ROTATED | ?wxPAPER_PENV_10_ROTATED -spec setPaperId(This, SizeId) -> ok when - This::wxPrintData(), SizeId::integer(). + This::wxPrintData(), SizeId::wx:wx_enum(). setPaperId(#wx_ref{type=ThisT,ref=ThisRef},SizeId) when is_integer(SizeId) -> ?CLASS(ThisT,wxPrintData), diff --git a/lib/wx/src/gen/wxPrintout.erl b/lib/wx/src/gen/wxPrintout.erl index ab96a09c09..c75edd2b5a 100644 --- a/lib/wx/src/gen/wxPrintout.erl +++ b/lib/wx/src/gen/wxPrintout.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -61,7 +61,8 @@ new(Title, OnPrintPage) -> %% <pre>OnBeginDocument(This,StartPage,EndPage) -> boolean() </pre> %% <pre>OnEndDocument(This) -> term() </pre> %% <pre>HasPage(This,Page)} -> boolean() </pre> -%% <pre>GetPageInfo(This) -> {MinPage:.integer(), MaxPage::integer(), PageFrom::integer(), PageTo::integer()} </pre> +%% <pre>GetPageInfo(This) -> {MinPage::integer(), MaxPage::integer(), +%% PageFrom::integer(), PageTo::integer()} </pre> %% The <b>This</b> argument is the wxPrintout object reference to this object %% <br /> NOTE: The callbacks may not call other processes. new(Title, OnPrintPage, Opts) when is_list(Title), is_function(OnPrintPage), is_list(Opts) -> diff --git a/lib/wx/src/gen/wxStyledTextCtrl.erl b/lib/wx/src/gen/wxStyledTextCtrl.erl index f6dc2176b7..55ac410407 100644 --- a/lib/wx/src/gen/wxStyledTextCtrl.erl +++ b/lib/wx/src/gen/wxStyledTextCtrl.erl @@ -95,18 +95,18 @@ redo/1,registerImage/3,replaceSelection/2,replaceTarget/2,saveFile/2, scrollToColumn/2,scrollToLine/2,searchAnchor/1,searchInTarget/2,searchNext/3, searchPrev/3,selectAll/1,selectionDuplicate/1,selectionIsRectangle/1, - sendMsg/2,sendMsg/3,setAnchor/2,setBackSpaceUnIndents/2,setBufferedDraw/2, - setCaretForeground/2,setCaretLineBackAlpha/2,setCaretLineBackground/2, - setCaretLineVisible/2,setCaretPeriod/2,setCaretSticky/2,setCaretWidth/2, - setCharsDefault/1,setCodePage/2,setControlCharSymbol/2,setCurrentPos/2, - setEOLMode/2,setEdgeColour/2,setEdgeColumn/2,setEdgeMode/2,setFoldExpanded/3, - setFoldFlags/2,setFoldLevel/3,setFoldMarginColour/3,setFoldMarginHiColour/3, - setHScrollBar/2,setHighlightGuide/2,setHotspotActiveBackground/3, - setHotspotActiveForeground/3,setHotspotActiveUnderline/2,setHotspotSingleLine/2, - setIndent/2,setIndentationGuides/2,setKeyWords/3,setLastKeydownProcessed/2, - setLayoutCache/2,setLexer/2,setLexerLanguage/2,setLineIndentation/3, - setLineState/3,setMarginLeft/2,setMarginMask/3,setMarginRight/2,setMarginSensitive/3, - setMarginType/3,setMarginWidth/3,setMargins/3,setModEventMask/2,setMouseDownCaptures/2, + setAnchor/2,setBackSpaceUnIndents/2,setBufferedDraw/2,setCaretForeground/2, + setCaretLineBackAlpha/2,setCaretLineBackground/2,setCaretLineVisible/2, + setCaretPeriod/2,setCaretSticky/2,setCaretWidth/2,setCharsDefault/1, + setCodePage/2,setControlCharSymbol/2,setCurrentPos/2,setEOLMode/2, + setEdgeColour/2,setEdgeColumn/2,setEdgeMode/2,setFoldExpanded/3,setFoldFlags/2, + setFoldLevel/3,setFoldMarginColour/3,setFoldMarginHiColour/3,setHScrollBar/2, + setHighlightGuide/2,setHotspotActiveBackground/3,setHotspotActiveForeground/3, + setHotspotActiveUnderline/2,setHotspotSingleLine/2,setIndent/2,setIndentationGuides/2, + setKeyWords/3,setLastKeydownProcessed/2,setLayoutCache/2,setLexer/2, + setLexerLanguage/2,setLineIndentation/3,setLineState/3,setMarginLeft/2, + setMarginMask/3,setMarginRight/2,setMarginSensitive/3,setMarginType/3, + setMarginWidth/3,setMargins/3,setModEventMask/2,setMouseDownCaptures/2, setMouseDwellTime/2,setPasteConvertEndings/2,setPrintColourMode/2, setPrintMagnification/2,setProperty/3,setReadOnly/2,setSTCCursor/2, setSTCFocus/2,setSavePoint/1,setScrollWidth/2,setSearchFlags/2,setSelAlpha/2, @@ -3897,29 +3897,6 @@ scrollToColumn(#wx_ref{type=ThisT,ref=ThisRef},Column) wxe_util:cast(?wxStyledTextCtrl_ScrollToColumn, <<ThisRef:32/?UI,Column:32/?UI>>). -%% @equiv sendMsg(This,Msg, []) --spec sendMsg(This, Msg) -> integer() when - This::wxStyledTextCtrl(), Msg::integer(). - -sendMsg(This,Msg) - when is_record(This, wx_ref),is_integer(Msg) -> - sendMsg(This,Msg, []). - -%% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxstyledtextctrl.html#wxstyledtextctrlsendmsg">external documentation</a>. --spec sendMsg(This, Msg, [Option]) -> integer() when - This::wxStyledTextCtrl(), Msg::integer(), - Option :: {wp, integer()} - | {lp, integer()}. -sendMsg(#wx_ref{type=ThisT,ref=ThisRef},Msg, Options) - when is_integer(Msg),is_list(Options) -> - ?CLASS(ThisT,wxStyledTextCtrl), - MOpts = fun({wp, Wp}, Acc) -> [<<1:32/?UI,Wp:32/?UI>>|Acc]; - ({lp, Lp}, Acc) -> [<<2:32/?UI,Lp:32/?UI>>|Acc]; - (BadOpt, _) -> erlang:error({badoption, BadOpt}) end, - BinOpt = list_to_binary(lists:foldl(MOpts, [<<0:32>>], Options)), - wxe_util:call(?wxStyledTextCtrl_SendMsg, - <<ThisRef:32/?UI,Msg:32/?UI, BinOpt/binary>>). - %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxstyledtextctrl.html#wxstyledtextctrlsetvscrollbar">external documentation</a>. -spec setVScrollBar(This, Bar) -> ok when This::wxStyledTextCtrl(), Bar::wxScrollBar:wxScrollBar(). diff --git a/lib/wx/src/gen/wxSystemSettings.erl b/lib/wx/src/gen/wxSystemSettings.erl index a3bae5c85f..630162afd2 100644 --- a/lib/wx/src/gen/wxSystemSettings.erl +++ b/lib/wx/src/gen/wxSystemSettings.erl @@ -35,7 +35,7 @@ parent_class(_Class) -> erlang:error({badtype, ?MODULE}). -type wxSystemSettings() :: wx:wx_object(). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxsystemsettings.html#wxsystemsettingsgetcolour">external documentation</a>. -%%<br /> Index = ?wxSYS_COLOUR_SCROLLBAR | ?wxSYS_COLOUR_BACKGROUND | ?wxSYS_COLOUR_DESKTOP | ?wxSYS_COLOUR_ACTIVECAPTION | ?wxSYS_COLOUR_INACTIVECAPTION | ?wxSYS_COLOUR_MENU | ?wxSYS_COLOUR_WINDOW | ?wxSYS_COLOUR_WINDOWFRAME | ?wxSYS_COLOUR_MENUTEXT | ?wxSYS_COLOUR_WINDOWTEXT | ?wxSYS_COLOUR_CAPTIONTEXT | ?wxSYS_COLOUR_ACTIVEBORDER | ?wxSYS_COLOUR_INACTIVEBORDER | ?wxSYS_COLOUR_APPWORKSPACE | ?wxSYS_COLOUR_HIGHLIGHT | ?wxSYS_COLOUR_HIGHLIGHTTEXT | ?wxSYS_COLOUR_BTNFACE | ?wxSYS_COLOUR_3DFACE | ?wxSYS_COLOUR_BTNSHADOW | ?wxSYS_COLOUR_3DSHADOW | ?wxSYS_COLOUR_GRAYTEXT | ?wxSYS_COLOUR_BTNTEXT | ?wxSYS_COLOUR_INACTIVECAPTIONTEXT | ?wxSYS_COLOUR_BTNHIGHLIGHT | ?wxSYS_COLOUR_BTNHILIGHT | ?wxSYS_COLOUR_3DHIGHLIGHT | ?wxSYS_COLOUR_3DHILIGHT | ?wxSYS_COLOUR_3DDKSHADOW | ?wxSYS_COLOUR_3DLIGHT | ?wxSYS_COLOUR_INFOTEXT | ?wxSYS_COLOUR_INFOBK | ?wxSYS_COLOUR_LISTBOX | ?wxSYS_COLOUR_HOTLIGHT | ?wxSYS_COLOUR_GRADIENTACTIVECAPTION | ?wxSYS_COLOUR_GRADIENTINACTIVECAPTION | ?wxSYS_COLOUR_MENUHILIGHT | ?wxSYS_COLOUR_MENUBAR | ?wxSYS_COLOUR_LISTBOXTEXT | ?wxSYS_COLOUR_MAX +%%<br /> Index = ?wxSYS_COLOUR_SCROLLBAR | ?wxSYS_COLOUR_BACKGROUND | ?wxSYS_COLOUR_DESKTOP | ?wxSYS_COLOUR_ACTIVECAPTION | ?wxSYS_COLOUR_INACTIVECAPTION | ?wxSYS_COLOUR_MENU | ?wxSYS_COLOUR_WINDOW | ?wxSYS_COLOUR_WINDOWFRAME | ?wxSYS_COLOUR_MENUTEXT | ?wxSYS_COLOUR_WINDOWTEXT | ?wxSYS_COLOUR_CAPTIONTEXT | ?wxSYS_COLOUR_ACTIVEBORDER | ?wxSYS_COLOUR_INACTIVEBORDER | ?wxSYS_COLOUR_APPWORKSPACE | ?wxSYS_COLOUR_HIGHLIGHT | ?wxSYS_COLOUR_HIGHLIGHTTEXT | ?wxSYS_COLOUR_BTNFACE | ?wxSYS_COLOUR_3DFACE | ?wxSYS_COLOUR_BTNSHADOW | ?wxSYS_COLOUR_3DSHADOW | ?wxSYS_COLOUR_GRAYTEXT | ?wxSYS_COLOUR_BTNTEXT | ?wxSYS_COLOUR_INACTIVECAPTIONTEXT | ?wxSYS_COLOUR_BTNHIGHLIGHT | ?wxSYS_COLOUR_BTNHILIGHT | ?wxSYS_COLOUR_3DHIGHLIGHT | ?wxSYS_COLOUR_3DHILIGHT | ?wxSYS_COLOUR_3DDKSHADOW | ?wxSYS_COLOUR_3DLIGHT | ?wxSYS_COLOUR_INFOTEXT | ?wxSYS_COLOUR_INFOBK | ?wxSYS_COLOUR_LISTBOX | ?wxSYS_COLOUR_HOTLIGHT | ?wxSYS_COLOUR_GRADIENTACTIVECAPTION | ?wxSYS_COLOUR_GRADIENTINACTIVECAPTION | ?wxSYS_COLOUR_MENUHILIGHT | ?wxSYS_COLOUR_MENUBAR | ?wxSYS_COLOUR_LISTBOXTEXT | ?wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT | ?wxSYS_COLOUR_MAX -spec getColour(Index) -> wx:wx_colour4() when Index::wx:wx_enum(). getColour(Index) diff --git a/lib/wx/src/gen/wxWindowDC.erl b/lib/wx/src/gen/wxWindowDC.erl index babb3c0e90..4515f0e6b9 100644 --- a/lib/wx/src/gen/wxWindowDC.erl +++ b/lib/wx/src/gen/wxWindowDC.erl @@ -53,6 +53,8 @@ startPage/1]). -export_type([wxWindowDC/0]). +-deprecated([new/0]). + %% @hidden parent_class(wxDC) -> true; parent_class(_Class) -> erlang:error({badtype, ?MODULE}). diff --git a/lib/wx/src/gen/wxe_debug.hrl b/lib/wx/src/gen/wxe_debug.hrl index 297d99324a..6f4fa3fe34 100644 --- a/lib/wx/src/gen/wxe_debug.hrl +++ b/lib/wx/src/gen/wxe_debug.hrl @@ -3154,156 +3154,155 @@ wxdebug_table() -> {3370, {wxStyledTextCtrl, pointFromPosition, 1}}, {3371, {wxStyledTextCtrl, scrollToLine, 1}}, {3372, {wxStyledTextCtrl, scrollToColumn, 1}}, - {3373, {wxStyledTextCtrl, sendMsg, 2}}, - {3374, {wxStyledTextCtrl, setVScrollBar, 1}}, - {3375, {wxStyledTextCtrl, setHScrollBar, 1}}, - {3376, {wxStyledTextCtrl, getLastKeydownProcessed, 0}}, - {3377, {wxStyledTextCtrl, setLastKeydownProcessed, 1}}, - {3378, {wxStyledTextCtrl, saveFile, 1}}, - {3379, {wxStyledTextCtrl, loadFile, 1}}, - {3380, {wxStyledTextCtrl, doDragOver, 3}}, - {3381, {wxStyledTextCtrl, doDropText, 3}}, - {3382, {wxStyledTextCtrl, getUseAntiAliasing, 0}}, - {3383, {wxStyledTextCtrl, addTextRaw, 1}}, - {3384, {wxStyledTextCtrl, insertTextRaw, 2}}, - {3385, {wxStyledTextCtrl, getCurLineRaw, 1}}, - {3386, {wxStyledTextCtrl, getLineRaw, 1}}, - {3387, {wxStyledTextCtrl, getSelectedTextRaw, 0}}, - {3388, {wxStyledTextCtrl, getTextRangeRaw, 2}}, - {3389, {wxStyledTextCtrl, setTextRaw, 1}}, - {3390, {wxStyledTextCtrl, getTextRaw, 0}}, - {3391, {wxStyledTextCtrl, appendTextRaw, 1}}, - {3392, {wxArtProvider, getBitmap, 2}}, - {3393, {wxArtProvider, getIcon, 2}}, - {3394, {wxTreeEvent, getKeyCode, 0}}, - {3395, {wxTreeEvent, getItem, 0}}, - {3396, {wxTreeEvent, getKeyEvent, 0}}, - {3397, {wxTreeEvent, getLabel, 0}}, - {3398, {wxTreeEvent, getOldItem, 0}}, - {3399, {wxTreeEvent, getPoint, 0}}, - {3400, {wxTreeEvent, isEditCancelled, 0}}, - {3401, {wxTreeEvent, setToolTip, 1}}, - {3402, {wxNotebookEvent, getOldSelection, 0}}, - {3403, {wxNotebookEvent, getSelection, 0}}, - {3404, {wxNotebookEvent, setOldSelection, 1}}, - {3405, {wxNotebookEvent, setSelection, 1}}, - {3406, {wxFileDataObject, new, 0}}, - {3407, {wxFileDataObject, addFile, 1}}, - {3408, {wxFileDataObject, getFilenames, 0}}, - {3409, {wxFileDataObject, 'Destroy', undefined}}, - {3410, {wxTextDataObject, new, 1}}, - {3411, {wxTextDataObject, getTextLength, 0}}, - {3412, {wxTextDataObject, getText, 0}}, - {3413, {wxTextDataObject, setText, 1}}, - {3414, {wxTextDataObject, 'Destroy', undefined}}, - {3415, {wxBitmapDataObject, new_1_1, 1}}, - {3416, {wxBitmapDataObject, new_1_0, 1}}, - {3417, {wxBitmapDataObject, getBitmap, 0}}, - {3418, {wxBitmapDataObject, setBitmap, 1}}, - {3419, {wxBitmapDataObject, 'Destroy', undefined}}, - {3421, {wxClipboard, new, 0}}, - {3422, {wxClipboard, destruct, 0}}, - {3423, {wxClipboard, addData, 1}}, - {3424, {wxClipboard, clear, 0}}, - {3425, {wxClipboard, close, 0}}, - {3426, {wxClipboard, flush, 0}}, - {3427, {wxClipboard, getData, 1}}, - {3428, {wxClipboard, isOpened, 0}}, - {3429, {wxClipboard, open, 0}}, - {3430, {wxClipboard, setData, 1}}, - {3432, {wxClipboard, usePrimarySelection, 1}}, - {3433, {wxClipboard, isSupported, 1}}, - {3434, {wxClipboard, get, 0}}, - {3435, {wxSpinEvent, getPosition, 0}}, - {3436, {wxSpinEvent, setPosition, 1}}, - {3437, {wxSplitterWindow, new_0, 0}}, - {3438, {wxSplitterWindow, new_2, 2}}, - {3439, {wxSplitterWindow, destruct, 0}}, - {3440, {wxSplitterWindow, create, 2}}, - {3441, {wxSplitterWindow, getMinimumPaneSize, 0}}, - {3442, {wxSplitterWindow, getSashGravity, 0}}, - {3443, {wxSplitterWindow, getSashPosition, 0}}, - {3444, {wxSplitterWindow, getSplitMode, 0}}, - {3445, {wxSplitterWindow, getWindow1, 0}}, - {3446, {wxSplitterWindow, getWindow2, 0}}, - {3447, {wxSplitterWindow, initialize, 1}}, - {3448, {wxSplitterWindow, isSplit, 0}}, - {3449, {wxSplitterWindow, replaceWindow, 2}}, - {3450, {wxSplitterWindow, setSashGravity, 1}}, - {3451, {wxSplitterWindow, setSashPosition, 2}}, - {3452, {wxSplitterWindow, setSashSize, 1}}, - {3453, {wxSplitterWindow, setMinimumPaneSize, 1}}, - {3454, {wxSplitterWindow, setSplitMode, 1}}, - {3455, {wxSplitterWindow, splitHorizontally, 3}}, - {3456, {wxSplitterWindow, splitVertically, 3}}, - {3457, {wxSplitterWindow, unsplit, 1}}, - {3458, {wxSplitterWindow, updateSize, 0}}, - {3459, {wxSplitterEvent, getSashPosition, 0}}, - {3460, {wxSplitterEvent, getX, 0}}, - {3461, {wxSplitterEvent, getY, 0}}, - {3462, {wxSplitterEvent, getWindowBeingRemoved, 0}}, - {3463, {wxSplitterEvent, setSashPosition, 1}}, - {3464, {wxHtmlWindow, new_0, 0}}, - {3465, {wxHtmlWindow, new_2, 2}}, - {3466, {wxHtmlWindow, appendToPage, 1}}, - {3467, {wxHtmlWindow, getOpenedAnchor, 0}}, - {3468, {wxHtmlWindow, getOpenedPage, 0}}, - {3469, {wxHtmlWindow, getOpenedPageTitle, 0}}, - {3470, {wxHtmlWindow, getRelatedFrame, 0}}, - {3471, {wxHtmlWindow, historyBack, 0}}, - {3472, {wxHtmlWindow, historyCanBack, 0}}, - {3473, {wxHtmlWindow, historyCanForward, 0}}, - {3474, {wxHtmlWindow, historyClear, 0}}, - {3475, {wxHtmlWindow, historyForward, 0}}, - {3476, {wxHtmlWindow, loadFile, 1}}, - {3477, {wxHtmlWindow, loadPage, 1}}, - {3478, {wxHtmlWindow, selectAll, 0}}, - {3479, {wxHtmlWindow, selectionToText, 0}}, - {3480, {wxHtmlWindow, selectLine, 1}}, - {3481, {wxHtmlWindow, selectWord, 1}}, - {3482, {wxHtmlWindow, setBorders, 1}}, - {3483, {wxHtmlWindow, setFonts, 3}}, - {3484, {wxHtmlWindow, setPage, 1}}, - {3485, {wxHtmlWindow, setRelatedFrame, 2}}, - {3486, {wxHtmlWindow, setRelatedStatusBar, 1}}, - {3487, {wxHtmlWindow, toText, 0}}, - {3488, {wxHtmlWindow, 'Destroy', undefined}}, - {3489, {wxHtmlLinkEvent, getLinkInfo, 0}}, - {3490, {wxSystemSettings, getColour, 1}}, - {3491, {wxSystemSettings, getFont, 1}}, - {3492, {wxSystemSettings, getMetric, 2}}, - {3493, {wxSystemSettings, getScreenType, 0}}, - {3494, {wxSystemOptions, getOption, 1}}, - {3495, {wxSystemOptions, getOptionInt, 1}}, - {3496, {wxSystemOptions, hasOption, 1}}, - {3497, {wxSystemOptions, isFalse, 1}}, - {3498, {wxSystemOptions, setOption_2_1, 2}}, - {3499, {wxSystemOptions, setOption_2_0, 2}}, - {3500, {wxAuiNotebookEvent, setSelection, 1}}, - {3501, {wxAuiNotebookEvent, getSelection, 0}}, - {3502, {wxAuiNotebookEvent, setOldSelection, 1}}, - {3503, {wxAuiNotebookEvent, getOldSelection, 0}}, - {3504, {wxAuiNotebookEvent, setDragSource, 1}}, - {3505, {wxAuiNotebookEvent, getDragSource, 0}}, - {3506, {wxAuiManagerEvent, setManager, 1}}, - {3507, {wxAuiManagerEvent, getManager, 0}}, - {3508, {wxAuiManagerEvent, setPane, 1}}, - {3509, {wxAuiManagerEvent, getPane, 0}}, - {3510, {wxAuiManagerEvent, setButton, 1}}, - {3511, {wxAuiManagerEvent, getButton, 0}}, - {3512, {wxAuiManagerEvent, setDC, 1}}, - {3513, {wxAuiManagerEvent, getDC, 0}}, - {3514, {wxAuiManagerEvent, veto, 1}}, - {3515, {wxAuiManagerEvent, getVeto, 0}}, - {3516, {wxAuiManagerEvent, setCanVeto, 1}}, - {3517, {wxAuiManagerEvent, canVeto, 0}}, - {3518, {wxLogNull, new, 0}}, - {3519, {wxLogNull, 'Destroy', undefined}}, - {3520, {wxTaskBarIcon, new, 0}}, - {3521, {wxTaskBarIcon, destruct, 0}}, - {3522, {wxTaskBarIcon, popupMenu, 1}}, - {3523, {wxTaskBarIcon, removeIcon, 0}}, - {3524, {wxTaskBarIcon, setIcon, 2}}, + {3373, {wxStyledTextCtrl, setVScrollBar, 1}}, + {3374, {wxStyledTextCtrl, setHScrollBar, 1}}, + {3375, {wxStyledTextCtrl, getLastKeydownProcessed, 0}}, + {3376, {wxStyledTextCtrl, setLastKeydownProcessed, 1}}, + {3377, {wxStyledTextCtrl, saveFile, 1}}, + {3378, {wxStyledTextCtrl, loadFile, 1}}, + {3379, {wxStyledTextCtrl, doDragOver, 3}}, + {3380, {wxStyledTextCtrl, doDropText, 3}}, + {3381, {wxStyledTextCtrl, getUseAntiAliasing, 0}}, + {3382, {wxStyledTextCtrl, addTextRaw, 1}}, + {3383, {wxStyledTextCtrl, insertTextRaw, 2}}, + {3384, {wxStyledTextCtrl, getCurLineRaw, 1}}, + {3385, {wxStyledTextCtrl, getLineRaw, 1}}, + {3386, {wxStyledTextCtrl, getSelectedTextRaw, 0}}, + {3387, {wxStyledTextCtrl, getTextRangeRaw, 2}}, + {3388, {wxStyledTextCtrl, setTextRaw, 1}}, + {3389, {wxStyledTextCtrl, getTextRaw, 0}}, + {3390, {wxStyledTextCtrl, appendTextRaw, 1}}, + {3391, {wxArtProvider, getBitmap, 2}}, + {3392, {wxArtProvider, getIcon, 2}}, + {3393, {wxTreeEvent, getKeyCode, 0}}, + {3394, {wxTreeEvent, getItem, 0}}, + {3395, {wxTreeEvent, getKeyEvent, 0}}, + {3396, {wxTreeEvent, getLabel, 0}}, + {3397, {wxTreeEvent, getOldItem, 0}}, + {3398, {wxTreeEvent, getPoint, 0}}, + {3399, {wxTreeEvent, isEditCancelled, 0}}, + {3400, {wxTreeEvent, setToolTip, 1}}, + {3401, {wxNotebookEvent, getOldSelection, 0}}, + {3402, {wxNotebookEvent, getSelection, 0}}, + {3403, {wxNotebookEvent, setOldSelection, 1}}, + {3404, {wxNotebookEvent, setSelection, 1}}, + {3405, {wxFileDataObject, new, 0}}, + {3406, {wxFileDataObject, addFile, 1}}, + {3407, {wxFileDataObject, getFilenames, 0}}, + {3408, {wxFileDataObject, 'Destroy', undefined}}, + {3409, {wxTextDataObject, new, 1}}, + {3410, {wxTextDataObject, getTextLength, 0}}, + {3411, {wxTextDataObject, getText, 0}}, + {3412, {wxTextDataObject, setText, 1}}, + {3413, {wxTextDataObject, 'Destroy', undefined}}, + {3414, {wxBitmapDataObject, new_1_1, 1}}, + {3415, {wxBitmapDataObject, new_1_0, 1}}, + {3416, {wxBitmapDataObject, getBitmap, 0}}, + {3417, {wxBitmapDataObject, setBitmap, 1}}, + {3418, {wxBitmapDataObject, 'Destroy', undefined}}, + {3420, {wxClipboard, new, 0}}, + {3421, {wxClipboard, destruct, 0}}, + {3422, {wxClipboard, addData, 1}}, + {3423, {wxClipboard, clear, 0}}, + {3424, {wxClipboard, close, 0}}, + {3425, {wxClipboard, flush, 0}}, + {3426, {wxClipboard, getData, 1}}, + {3427, {wxClipboard, isOpened, 0}}, + {3428, {wxClipboard, open, 0}}, + {3429, {wxClipboard, setData, 1}}, + {3431, {wxClipboard, usePrimarySelection, 1}}, + {3432, {wxClipboard, isSupported, 1}}, + {3433, {wxClipboard, get, 0}}, + {3434, {wxSpinEvent, getPosition, 0}}, + {3435, {wxSpinEvent, setPosition, 1}}, + {3436, {wxSplitterWindow, new_0, 0}}, + {3437, {wxSplitterWindow, new_2, 2}}, + {3438, {wxSplitterWindow, destruct, 0}}, + {3439, {wxSplitterWindow, create, 2}}, + {3440, {wxSplitterWindow, getMinimumPaneSize, 0}}, + {3441, {wxSplitterWindow, getSashGravity, 0}}, + {3442, {wxSplitterWindow, getSashPosition, 0}}, + {3443, {wxSplitterWindow, getSplitMode, 0}}, + {3444, {wxSplitterWindow, getWindow1, 0}}, + {3445, {wxSplitterWindow, getWindow2, 0}}, + {3446, {wxSplitterWindow, initialize, 1}}, + {3447, {wxSplitterWindow, isSplit, 0}}, + {3448, {wxSplitterWindow, replaceWindow, 2}}, + {3449, {wxSplitterWindow, setSashGravity, 1}}, + {3450, {wxSplitterWindow, setSashPosition, 2}}, + {3451, {wxSplitterWindow, setSashSize, 1}}, + {3452, {wxSplitterWindow, setMinimumPaneSize, 1}}, + {3453, {wxSplitterWindow, setSplitMode, 1}}, + {3454, {wxSplitterWindow, splitHorizontally, 3}}, + {3455, {wxSplitterWindow, splitVertically, 3}}, + {3456, {wxSplitterWindow, unsplit, 1}}, + {3457, {wxSplitterWindow, updateSize, 0}}, + {3458, {wxSplitterEvent, getSashPosition, 0}}, + {3459, {wxSplitterEvent, getX, 0}}, + {3460, {wxSplitterEvent, getY, 0}}, + {3461, {wxSplitterEvent, getWindowBeingRemoved, 0}}, + {3462, {wxSplitterEvent, setSashPosition, 1}}, + {3463, {wxHtmlWindow, new_0, 0}}, + {3464, {wxHtmlWindow, new_2, 2}}, + {3465, {wxHtmlWindow, appendToPage, 1}}, + {3466, {wxHtmlWindow, getOpenedAnchor, 0}}, + {3467, {wxHtmlWindow, getOpenedPage, 0}}, + {3468, {wxHtmlWindow, getOpenedPageTitle, 0}}, + {3469, {wxHtmlWindow, getRelatedFrame, 0}}, + {3470, {wxHtmlWindow, historyBack, 0}}, + {3471, {wxHtmlWindow, historyCanBack, 0}}, + {3472, {wxHtmlWindow, historyCanForward, 0}}, + {3473, {wxHtmlWindow, historyClear, 0}}, + {3474, {wxHtmlWindow, historyForward, 0}}, + {3475, {wxHtmlWindow, loadFile, 1}}, + {3476, {wxHtmlWindow, loadPage, 1}}, + {3477, {wxHtmlWindow, selectAll, 0}}, + {3478, {wxHtmlWindow, selectionToText, 0}}, + {3479, {wxHtmlWindow, selectLine, 1}}, + {3480, {wxHtmlWindow, selectWord, 1}}, + {3481, {wxHtmlWindow, setBorders, 1}}, + {3482, {wxHtmlWindow, setFonts, 3}}, + {3483, {wxHtmlWindow, setPage, 1}}, + {3484, {wxHtmlWindow, setRelatedFrame, 2}}, + {3485, {wxHtmlWindow, setRelatedStatusBar, 1}}, + {3486, {wxHtmlWindow, toText, 0}}, + {3487, {wxHtmlWindow, 'Destroy', undefined}}, + {3488, {wxHtmlLinkEvent, getLinkInfo, 0}}, + {3489, {wxSystemSettings, getColour, 1}}, + {3490, {wxSystemSettings, getFont, 1}}, + {3491, {wxSystemSettings, getMetric, 2}}, + {3492, {wxSystemSettings, getScreenType, 0}}, + {3493, {wxSystemOptions, getOption, 1}}, + {3494, {wxSystemOptions, getOptionInt, 1}}, + {3495, {wxSystemOptions, hasOption, 1}}, + {3496, {wxSystemOptions, isFalse, 1}}, + {3497, {wxSystemOptions, setOption_2_1, 2}}, + {3498, {wxSystemOptions, setOption_2_0, 2}}, + {3499, {wxAuiNotebookEvent, setSelection, 1}}, + {3500, {wxAuiNotebookEvent, getSelection, 0}}, + {3501, {wxAuiNotebookEvent, setOldSelection, 1}}, + {3502, {wxAuiNotebookEvent, getOldSelection, 0}}, + {3503, {wxAuiNotebookEvent, setDragSource, 1}}, + {3504, {wxAuiNotebookEvent, getDragSource, 0}}, + {3505, {wxAuiManagerEvent, setManager, 1}}, + {3506, {wxAuiManagerEvent, getManager, 0}}, + {3507, {wxAuiManagerEvent, setPane, 1}}, + {3508, {wxAuiManagerEvent, getPane, 0}}, + {3509, {wxAuiManagerEvent, setButton, 1}}, + {3510, {wxAuiManagerEvent, getButton, 0}}, + {3511, {wxAuiManagerEvent, setDC, 1}}, + {3512, {wxAuiManagerEvent, getDC, 0}}, + {3513, {wxAuiManagerEvent, veto, 1}}, + {3514, {wxAuiManagerEvent, getVeto, 0}}, + {3515, {wxAuiManagerEvent, setCanVeto, 1}}, + {3516, {wxAuiManagerEvent, canVeto, 0}}, + {3517, {wxLogNull, new, 0}}, + {3518, {wxLogNull, 'Destroy', undefined}}, + {3519, {wxTaskBarIcon, new, 0}}, + {3520, {wxTaskBarIcon, destruct, 0}}, + {3521, {wxTaskBarIcon, popupMenu, 1}}, + {3522, {wxTaskBarIcon, removeIcon, 0}}, + {3523, {wxTaskBarIcon, setIcon, 2}}, {-1, {mod, func, -1}} ]. diff --git a/lib/wx/src/gen/wxe_funcs.hrl b/lib/wx/src/gen/wxe_funcs.hrl index fe35cb1374..e6aced6e09 100644 --- a/lib/wx/src/gen/wxe_funcs.hrl +++ b/lib/wx/src/gen/wxe_funcs.hrl @@ -3151,153 +3151,152 @@ -define(wxStyledTextCtrl_PointFromPosition, 3370). -define(wxStyledTextCtrl_ScrollToLine, 3371). -define(wxStyledTextCtrl_ScrollToColumn, 3372). --define(wxStyledTextCtrl_SendMsg, 3373). --define(wxStyledTextCtrl_SetVScrollBar, 3374). --define(wxStyledTextCtrl_SetHScrollBar, 3375). --define(wxStyledTextCtrl_GetLastKeydownProcessed, 3376). --define(wxStyledTextCtrl_SetLastKeydownProcessed, 3377). --define(wxStyledTextCtrl_SaveFile, 3378). --define(wxStyledTextCtrl_LoadFile, 3379). --define(wxStyledTextCtrl_DoDragOver, 3380). --define(wxStyledTextCtrl_DoDropText, 3381). --define(wxStyledTextCtrl_GetUseAntiAliasing, 3382). --define(wxStyledTextCtrl_AddTextRaw, 3383). --define(wxStyledTextCtrl_InsertTextRaw, 3384). --define(wxStyledTextCtrl_GetCurLineRaw, 3385). --define(wxStyledTextCtrl_GetLineRaw, 3386). --define(wxStyledTextCtrl_GetSelectedTextRaw, 3387). --define(wxStyledTextCtrl_GetTextRangeRaw, 3388). --define(wxStyledTextCtrl_SetTextRaw, 3389). --define(wxStyledTextCtrl_GetTextRaw, 3390). --define(wxStyledTextCtrl_AppendTextRaw, 3391). --define(wxArtProvider_GetBitmap, 3392). --define(wxArtProvider_GetIcon, 3393). --define(wxTreeEvent_GetKeyCode, 3394). --define(wxTreeEvent_GetItem, 3395). --define(wxTreeEvent_GetKeyEvent, 3396). --define(wxTreeEvent_GetLabel, 3397). --define(wxTreeEvent_GetOldItem, 3398). --define(wxTreeEvent_GetPoint, 3399). --define(wxTreeEvent_IsEditCancelled, 3400). --define(wxTreeEvent_SetToolTip, 3401). --define(wxNotebookEvent_GetOldSelection, 3402). --define(wxNotebookEvent_GetSelection, 3403). --define(wxNotebookEvent_SetOldSelection, 3404). --define(wxNotebookEvent_SetSelection, 3405). --define(wxFileDataObject_new, 3406). --define(wxFileDataObject_AddFile, 3407). --define(wxFileDataObject_GetFilenames, 3408). --define(wxFileDataObject_destroy, 3409). --define(wxTextDataObject_new, 3410). --define(wxTextDataObject_GetTextLength, 3411). --define(wxTextDataObject_GetText, 3412). --define(wxTextDataObject_SetText, 3413). --define(wxTextDataObject_destroy, 3414). --define(wxBitmapDataObject_new_1_1, 3415). --define(wxBitmapDataObject_new_1_0, 3416). --define(wxBitmapDataObject_GetBitmap, 3417). --define(wxBitmapDataObject_SetBitmap, 3418). --define(wxBitmapDataObject_destroy, 3419). --define(wxClipboard_new, 3421). --define(wxClipboard_destruct, 3422). --define(wxClipboard_AddData, 3423). --define(wxClipboard_Clear, 3424). --define(wxClipboard_Close, 3425). --define(wxClipboard_Flush, 3426). --define(wxClipboard_GetData, 3427). --define(wxClipboard_IsOpened, 3428). --define(wxClipboard_Open, 3429). --define(wxClipboard_SetData, 3430). --define(wxClipboard_UsePrimarySelection, 3432). --define(wxClipboard_IsSupported, 3433). --define(wxClipboard_Get, 3434). --define(wxSpinEvent_GetPosition, 3435). --define(wxSpinEvent_SetPosition, 3436). --define(wxSplitterWindow_new_0, 3437). --define(wxSplitterWindow_new_2, 3438). --define(wxSplitterWindow_destruct, 3439). --define(wxSplitterWindow_Create, 3440). --define(wxSplitterWindow_GetMinimumPaneSize, 3441). --define(wxSplitterWindow_GetSashGravity, 3442). --define(wxSplitterWindow_GetSashPosition, 3443). --define(wxSplitterWindow_GetSplitMode, 3444). --define(wxSplitterWindow_GetWindow1, 3445). --define(wxSplitterWindow_GetWindow2, 3446). --define(wxSplitterWindow_Initialize, 3447). --define(wxSplitterWindow_IsSplit, 3448). --define(wxSplitterWindow_ReplaceWindow, 3449). --define(wxSplitterWindow_SetSashGravity, 3450). --define(wxSplitterWindow_SetSashPosition, 3451). --define(wxSplitterWindow_SetSashSize, 3452). --define(wxSplitterWindow_SetMinimumPaneSize, 3453). --define(wxSplitterWindow_SetSplitMode, 3454). --define(wxSplitterWindow_SplitHorizontally, 3455). --define(wxSplitterWindow_SplitVertically, 3456). --define(wxSplitterWindow_Unsplit, 3457). --define(wxSplitterWindow_UpdateSize, 3458). --define(wxSplitterEvent_GetSashPosition, 3459). --define(wxSplitterEvent_GetX, 3460). --define(wxSplitterEvent_GetY, 3461). --define(wxSplitterEvent_GetWindowBeingRemoved, 3462). --define(wxSplitterEvent_SetSashPosition, 3463). --define(wxHtmlWindow_new_0, 3464). --define(wxHtmlWindow_new_2, 3465). --define(wxHtmlWindow_AppendToPage, 3466). --define(wxHtmlWindow_GetOpenedAnchor, 3467). --define(wxHtmlWindow_GetOpenedPage, 3468). --define(wxHtmlWindow_GetOpenedPageTitle, 3469). --define(wxHtmlWindow_GetRelatedFrame, 3470). --define(wxHtmlWindow_HistoryBack, 3471). --define(wxHtmlWindow_HistoryCanBack, 3472). --define(wxHtmlWindow_HistoryCanForward, 3473). --define(wxHtmlWindow_HistoryClear, 3474). --define(wxHtmlWindow_HistoryForward, 3475). --define(wxHtmlWindow_LoadFile, 3476). --define(wxHtmlWindow_LoadPage, 3477). --define(wxHtmlWindow_SelectAll, 3478). --define(wxHtmlWindow_SelectionToText, 3479). --define(wxHtmlWindow_SelectLine, 3480). --define(wxHtmlWindow_SelectWord, 3481). --define(wxHtmlWindow_SetBorders, 3482). --define(wxHtmlWindow_SetFonts, 3483). --define(wxHtmlWindow_SetPage, 3484). --define(wxHtmlWindow_SetRelatedFrame, 3485). --define(wxHtmlWindow_SetRelatedStatusBar, 3486). --define(wxHtmlWindow_ToText, 3487). --define(wxHtmlWindow_destroy, 3488). --define(wxHtmlLinkEvent_GetLinkInfo, 3489). --define(wxSystemSettings_GetColour, 3490). --define(wxSystemSettings_GetFont, 3491). --define(wxSystemSettings_GetMetric, 3492). --define(wxSystemSettings_GetScreenType, 3493). --define(wxSystemOptions_GetOption, 3494). --define(wxSystemOptions_GetOptionInt, 3495). --define(wxSystemOptions_HasOption, 3496). --define(wxSystemOptions_IsFalse, 3497). --define(wxSystemOptions_SetOption_2_1, 3498). --define(wxSystemOptions_SetOption_2_0, 3499). --define(wxAuiNotebookEvent_SetSelection, 3500). --define(wxAuiNotebookEvent_GetSelection, 3501). --define(wxAuiNotebookEvent_SetOldSelection, 3502). --define(wxAuiNotebookEvent_GetOldSelection, 3503). --define(wxAuiNotebookEvent_SetDragSource, 3504). --define(wxAuiNotebookEvent_GetDragSource, 3505). --define(wxAuiManagerEvent_SetManager, 3506). --define(wxAuiManagerEvent_GetManager, 3507). --define(wxAuiManagerEvent_SetPane, 3508). --define(wxAuiManagerEvent_GetPane, 3509). --define(wxAuiManagerEvent_SetButton, 3510). --define(wxAuiManagerEvent_GetButton, 3511). --define(wxAuiManagerEvent_SetDC, 3512). --define(wxAuiManagerEvent_GetDC, 3513). --define(wxAuiManagerEvent_Veto, 3514). --define(wxAuiManagerEvent_GetVeto, 3515). --define(wxAuiManagerEvent_SetCanVeto, 3516). --define(wxAuiManagerEvent_CanVeto, 3517). --define(wxLogNull_new, 3518). --define(wxLogNull_destroy, 3519). --define(wxTaskBarIcon_new, 3520). --define(wxTaskBarIcon_destruct, 3521). --define(wxTaskBarIcon_PopupMenu, 3522). --define(wxTaskBarIcon_RemoveIcon, 3523). --define(wxTaskBarIcon_SetIcon, 3524). +-define(wxStyledTextCtrl_SetVScrollBar, 3373). +-define(wxStyledTextCtrl_SetHScrollBar, 3374). +-define(wxStyledTextCtrl_GetLastKeydownProcessed, 3375). +-define(wxStyledTextCtrl_SetLastKeydownProcessed, 3376). +-define(wxStyledTextCtrl_SaveFile, 3377). +-define(wxStyledTextCtrl_LoadFile, 3378). +-define(wxStyledTextCtrl_DoDragOver, 3379). +-define(wxStyledTextCtrl_DoDropText, 3380). +-define(wxStyledTextCtrl_GetUseAntiAliasing, 3381). +-define(wxStyledTextCtrl_AddTextRaw, 3382). +-define(wxStyledTextCtrl_InsertTextRaw, 3383). +-define(wxStyledTextCtrl_GetCurLineRaw, 3384). +-define(wxStyledTextCtrl_GetLineRaw, 3385). +-define(wxStyledTextCtrl_GetSelectedTextRaw, 3386). +-define(wxStyledTextCtrl_GetTextRangeRaw, 3387). +-define(wxStyledTextCtrl_SetTextRaw, 3388). +-define(wxStyledTextCtrl_GetTextRaw, 3389). +-define(wxStyledTextCtrl_AppendTextRaw, 3390). +-define(wxArtProvider_GetBitmap, 3391). +-define(wxArtProvider_GetIcon, 3392). +-define(wxTreeEvent_GetKeyCode, 3393). +-define(wxTreeEvent_GetItem, 3394). +-define(wxTreeEvent_GetKeyEvent, 3395). +-define(wxTreeEvent_GetLabel, 3396). +-define(wxTreeEvent_GetOldItem, 3397). +-define(wxTreeEvent_GetPoint, 3398). +-define(wxTreeEvent_IsEditCancelled, 3399). +-define(wxTreeEvent_SetToolTip, 3400). +-define(wxNotebookEvent_GetOldSelection, 3401). +-define(wxNotebookEvent_GetSelection, 3402). +-define(wxNotebookEvent_SetOldSelection, 3403). +-define(wxNotebookEvent_SetSelection, 3404). +-define(wxFileDataObject_new, 3405). +-define(wxFileDataObject_AddFile, 3406). +-define(wxFileDataObject_GetFilenames, 3407). +-define(wxFileDataObject_destroy, 3408). +-define(wxTextDataObject_new, 3409). +-define(wxTextDataObject_GetTextLength, 3410). +-define(wxTextDataObject_GetText, 3411). +-define(wxTextDataObject_SetText, 3412). +-define(wxTextDataObject_destroy, 3413). +-define(wxBitmapDataObject_new_1_1, 3414). +-define(wxBitmapDataObject_new_1_0, 3415). +-define(wxBitmapDataObject_GetBitmap, 3416). +-define(wxBitmapDataObject_SetBitmap, 3417). +-define(wxBitmapDataObject_destroy, 3418). +-define(wxClipboard_new, 3420). +-define(wxClipboard_destruct, 3421). +-define(wxClipboard_AddData, 3422). +-define(wxClipboard_Clear, 3423). +-define(wxClipboard_Close, 3424). +-define(wxClipboard_Flush, 3425). +-define(wxClipboard_GetData, 3426). +-define(wxClipboard_IsOpened, 3427). +-define(wxClipboard_Open, 3428). +-define(wxClipboard_SetData, 3429). +-define(wxClipboard_UsePrimarySelection, 3431). +-define(wxClipboard_IsSupported, 3432). +-define(wxClipboard_Get, 3433). +-define(wxSpinEvent_GetPosition, 3434). +-define(wxSpinEvent_SetPosition, 3435). +-define(wxSplitterWindow_new_0, 3436). +-define(wxSplitterWindow_new_2, 3437). +-define(wxSplitterWindow_destruct, 3438). +-define(wxSplitterWindow_Create, 3439). +-define(wxSplitterWindow_GetMinimumPaneSize, 3440). +-define(wxSplitterWindow_GetSashGravity, 3441). +-define(wxSplitterWindow_GetSashPosition, 3442). +-define(wxSplitterWindow_GetSplitMode, 3443). +-define(wxSplitterWindow_GetWindow1, 3444). +-define(wxSplitterWindow_GetWindow2, 3445). +-define(wxSplitterWindow_Initialize, 3446). +-define(wxSplitterWindow_IsSplit, 3447). +-define(wxSplitterWindow_ReplaceWindow, 3448). +-define(wxSplitterWindow_SetSashGravity, 3449). +-define(wxSplitterWindow_SetSashPosition, 3450). +-define(wxSplitterWindow_SetSashSize, 3451). +-define(wxSplitterWindow_SetMinimumPaneSize, 3452). +-define(wxSplitterWindow_SetSplitMode, 3453). +-define(wxSplitterWindow_SplitHorizontally, 3454). +-define(wxSplitterWindow_SplitVertically, 3455). +-define(wxSplitterWindow_Unsplit, 3456). +-define(wxSplitterWindow_UpdateSize, 3457). +-define(wxSplitterEvent_GetSashPosition, 3458). +-define(wxSplitterEvent_GetX, 3459). +-define(wxSplitterEvent_GetY, 3460). +-define(wxSplitterEvent_GetWindowBeingRemoved, 3461). +-define(wxSplitterEvent_SetSashPosition, 3462). +-define(wxHtmlWindow_new_0, 3463). +-define(wxHtmlWindow_new_2, 3464). +-define(wxHtmlWindow_AppendToPage, 3465). +-define(wxHtmlWindow_GetOpenedAnchor, 3466). +-define(wxHtmlWindow_GetOpenedPage, 3467). +-define(wxHtmlWindow_GetOpenedPageTitle, 3468). +-define(wxHtmlWindow_GetRelatedFrame, 3469). +-define(wxHtmlWindow_HistoryBack, 3470). +-define(wxHtmlWindow_HistoryCanBack, 3471). +-define(wxHtmlWindow_HistoryCanForward, 3472). +-define(wxHtmlWindow_HistoryClear, 3473). +-define(wxHtmlWindow_HistoryForward, 3474). +-define(wxHtmlWindow_LoadFile, 3475). +-define(wxHtmlWindow_LoadPage, 3476). +-define(wxHtmlWindow_SelectAll, 3477). +-define(wxHtmlWindow_SelectionToText, 3478). +-define(wxHtmlWindow_SelectLine, 3479). +-define(wxHtmlWindow_SelectWord, 3480). +-define(wxHtmlWindow_SetBorders, 3481). +-define(wxHtmlWindow_SetFonts, 3482). +-define(wxHtmlWindow_SetPage, 3483). +-define(wxHtmlWindow_SetRelatedFrame, 3484). +-define(wxHtmlWindow_SetRelatedStatusBar, 3485). +-define(wxHtmlWindow_ToText, 3486). +-define(wxHtmlWindow_destroy, 3487). +-define(wxHtmlLinkEvent_GetLinkInfo, 3488). +-define(wxSystemSettings_GetColour, 3489). +-define(wxSystemSettings_GetFont, 3490). +-define(wxSystemSettings_GetMetric, 3491). +-define(wxSystemSettings_GetScreenType, 3492). +-define(wxSystemOptions_GetOption, 3493). +-define(wxSystemOptions_GetOptionInt, 3494). +-define(wxSystemOptions_HasOption, 3495). +-define(wxSystemOptions_IsFalse, 3496). +-define(wxSystemOptions_SetOption_2_1, 3497). +-define(wxSystemOptions_SetOption_2_0, 3498). +-define(wxAuiNotebookEvent_SetSelection, 3499). +-define(wxAuiNotebookEvent_GetSelection, 3500). +-define(wxAuiNotebookEvent_SetOldSelection, 3501). +-define(wxAuiNotebookEvent_GetOldSelection, 3502). +-define(wxAuiNotebookEvent_SetDragSource, 3503). +-define(wxAuiNotebookEvent_GetDragSource, 3504). +-define(wxAuiManagerEvent_SetManager, 3505). +-define(wxAuiManagerEvent_GetManager, 3506). +-define(wxAuiManagerEvent_SetPane, 3507). +-define(wxAuiManagerEvent_GetPane, 3508). +-define(wxAuiManagerEvent_SetButton, 3509). +-define(wxAuiManagerEvent_GetButton, 3510). +-define(wxAuiManagerEvent_SetDC, 3511). +-define(wxAuiManagerEvent_GetDC, 3512). +-define(wxAuiManagerEvent_Veto, 3513). +-define(wxAuiManagerEvent_GetVeto, 3514). +-define(wxAuiManagerEvent_SetCanVeto, 3515). +-define(wxAuiManagerEvent_CanVeto, 3516). +-define(wxLogNull_new, 3517). +-define(wxLogNull_destroy, 3518). +-define(wxTaskBarIcon_new, 3519). +-define(wxTaskBarIcon_destruct, 3520). +-define(wxTaskBarIcon_PopupMenu, 3521). +-define(wxTaskBarIcon_RemoveIcon, 3522). +-define(wxTaskBarIcon_SetIcon, 3523). diff --git a/lib/wx/src/wxe_util.erl b/lib/wx/src/wxe_util.erl index 3022b7f3f2..a31c3e30b8 100644 --- a/lib/wx/src/wxe_util.erl +++ b/lib/wx/src/wxe_util.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -233,10 +233,16 @@ priv_dir(Driver0, Silent) -> {ok, _} -> Priv; {error, _} -> - opt_error_log(Silent, - "ERROR: Could not find \'~s\' in: ~s~n", - [Driver, Priv]), - erlang:error({load_driver, "No driver found"}) + SrcPriv = filename:join(Priv, erlang:system_info(system_architecture)), + case file:read_file_info(filename:join(SrcPriv, Driver)) of + {ok, _} -> + SrcPriv; + {error, _} -> + opt_error_log(Silent, + "ERROR: Could not find \'~s\' in: ~s~n", + [Driver, Priv]), + erlang:error({load_driver, "No driver found"}) + end end. strip(Src, Src) -> diff --git a/lib/wx/test/wx_basic_SUITE.erl b/lib/wx/test/wx_basic_SUITE.erl index e240bbcfe8..cf17818a9d 100644 --- a/lib/wx/test/wx_basic_SUITE.erl +++ b/lib/wx/test/wx_basic_SUITE.erl @@ -308,12 +308,12 @@ data_types(_Config) -> ?m({_,_}, wxWindow:getSize(Frame)), %% DateTime - DateTime = calendar:now_to_datetime(erlang:now()), + DateTime = {Date, _Time} = calendar:now_to_datetime(erlang:now()), io:format("DateTime ~p ~n",[DateTime]), Cal = ?mt(wxCalendarCtrl, wxCalendarCtrl:new(Frame, ?wxID_ANY, [{date,DateTime}])), - ?m(DateTime, wxCalendarCtrl:getDate(Cal)), + ?m({Date,_}, wxCalendarCtrl:getDate(Cal)), ?m(true, is_boolean(wxCalendarCtrl:setDate(Cal,DateTime))), - ?m(DateTime, wxCalendarCtrl:getDate(Cal)), + ?m({Date,_}, wxCalendarCtrl:getDate(Cal)), wxClientDC:destroy(CDC), %%wx_test_lib:wx_destroy(Frame,Config). diff --git a/lib/wx/test/wx_class_SUITE.erl b/lib/wx/test/wx_class_SUITE.erl index 6ed7243c5b..22bfa53e0a 100644 --- a/lib/wx/test/wx_class_SUITE.erl +++ b/lib/wx/test/wx_class_SUITE.erl @@ -82,13 +82,14 @@ calendarCtrl(Config) -> true -> ?log("DateAttr is null~n",[]); false -> - ?log("DateAttr is useable~n",[]) + ?log("DateAttr is useable~n",[]), + DateAttr = ?mt(wxCalendarDateAttr, wxCalendarDateAttr:new()), + wxCalendarDateAttr:setBackgroundColour(DateAttr, {0,243,0}), + wxCalendarCtrl:setAttr(Cal, Day, DateAttr), + DateAttr1 = ?mt(wxCalendarDateAttr, wxCalendarCtrl:getAttr(Cal,Day)), + io:format("DateAttr ~p~n",[DateAttr1]), + ?m({0,243,0,255}, wxCalendarDateAttr:getBackgroundColour(DateAttr1)) end, - DateAttr = ?mt(wxCalendarDateAttr, wxCalendarDateAttr:new()), - wxCalendarDateAttr:setBackgroundColour(DateAttr, {0,243,0}), - wxCalendarCtrl:setAttr(Cal, Day, DateAttr), - DateAttr1 = ?mt(wxCalendarDateAttr, wxCalendarCtrl:getAttr(Cal,Day)), - ?m({0,243,0,255}, wxCalendarDateAttr:getBackgroundColour(DateAttr1)), ?m({YMD, _},wxCalendarCtrl:getDate(Cal)), @@ -476,7 +477,9 @@ taskBarIcon(Config) -> Wx = wx:new(), Frame = wxFrame:new(Wx, ?wxID_ANY, "Frame"), TBI = wxTaskBarIcon:new(), - Icon = wxIcon:new(filename:join(code:priv_dir(debugger), "erlang_bug.png")), + Image = wxImage:new(filename:join(code:priv_dir(debugger), "erlang_bug.png")), + io:format("Image ~p~n",[wxImage:ok(Image)]), + Icon = wxIcon:new(filename:join(code:priv_dir(debugger), "erlang_bug.png"), [{type, ?wxBITMAP_TYPE_PNG}]), wxTaskBarIcon:setIcon(TBI, Icon, [{tooltip, "Testing wxTaskBarIcon"}]), wxWindow:show(Frame), wxTaskBarIcon:connect(TBI, taskbar_left_down, [{callback, fun(Ev,_) -> io:format("Left clicked: ~p~n",[Ev]) end}]), diff --git a/lib/wx/test/wx_event_SUITE.erl b/lib/wx/test/wx_event_SUITE.erl index 8f364049b4..53a2ee7d7b 100644 --- a/lib/wx/test/wx_event_SUITE.erl +++ b/lib/wx/test/wx_event_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2011. All Rights Reserved. +%% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -301,35 +301,70 @@ connect_in_callback(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo); connect_in_callback(Config) -> Wx = ?mr(wx_ref, wx:new()), + %% wx:debug([driver,trace]), + %% io:format("gdb -p ~s~n",[os:getpid()]), Frame = wxFrame:new(Wx, ?wxID_ANY, "Connect in callback"), Panel = wxPanel:new(Frame, []), - + + Tester = self(), + + %% Connect in callbacks works different in 2.9 + %% such that new events are not fired until the previous + %% callback have returned. + + %% That means that a callback can not wait for other events + %% in receive since they will not come. + %% It also means that you can not attach a new callback directly from + %% the callback since that callback will be removed when the temporary + %% process that executes the outer callback (may) die(s) before the callback + %% is invoked + + %% Thus connect in callbacks needs to done in a another process, and + %% not in the fun directly + Env = wx:get_env(), + TestWindow = + fun() -> + wx:set_env(Env), + Me = self(), + F1 = wxFrame:new(Frame, ?wxID_ANY, "Frame size event"), + wxFrame:connect(F1,size,[{callback, + fun(_,_) -> + io:format("CB2 got size~n",[]), + Me ! {continue, F1} + end}]), + wxWindow:show(F1), + receive + {continue, F1} -> Tester ! {continue, F1} + end + end, wxFrame:connect(Frame,size, - [{callback, - fun(#wx{event=#wxSize{}},_SizeEv) -> - io:format("Frame got size~n",[]), - F1 = wxFrame:new(Frame, ?wxID_ANY, "Frame size event"), - CBPid = self(), - wxFrame:connect(F1,size,[{callback, - fun(_,_) -> - io:format("CB2 got size~n",[]), - CBPid ! continue - end}]), - wxWindow:show(F1), - receive continue -> wxFrame:destroy(F1) end + [{callback, + fun(#wx{event=#wxSize{}},_SizeEv) -> + io:format("Frame got size~n",[]), + spawn(TestWindow) end}]), wxPanel:connect(Panel,size, - [{callback, - fun(#wx{event=#wxSize{}},_SizeEv) -> + [{callback, + fun(#wx{event=#wxSize{}},_SizeEv) -> io:format("Panel got size~n",[]), - F1 = wxFrame:new(Frame, ?wxID_ANY, "Panel size event"), - wxFrame:connect(F1,size), - wxWindow:show(F1), - receive #wx{event=#wxSize{}} -> wxFrame:destroy(F1) end - end}]), + spawn(fun() -> + wx:set_env(Env), + F1 = wxFrame:new(Frame, ?wxID_ANY, + "Panel size event"), + wxFrame:connect(F1,size), + wxWindow:show(F1), + receive + #wx{event=#wxSize{}} -> + io:format("All Fine ~n",[]), + wxFrame:destroy(F1) + end + end) + end}]), wxFrame:show(Frame), + + ok = receive {continue, F1} -> wxFrame:destroy(F1) + after 5000 -> timeout end, wx_test_lib:flush(), - wx_test_lib:wx_destroy(Frame, Config). %% Test that event callback which triggers another callback works diff --git a/lib/wx/test/wx_opengl_SUITE.erl b/lib/wx/test/wx_opengl_SUITE.erl index e8fdf603d6..f351bc93ed 100644 --- a/lib/wx/test/wx_opengl_SUITE.erl +++ b/lib/wx/test/wx_opengl_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2011. All Rights Reserved. +%% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -92,10 +92,22 @@ canvas(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo); canvas(Config) -> WX = ?mr(wx_ref, wx:new()), Frame = wxFrame:new(WX,1,"Hello 3D-World",[]), - Attrs = [{attribList, [?WX_GL_RGBA,?WX_GL_DOUBLEBUFFER,0]}], - Canvas = ?mt(wxGLCanvas, wxGLCanvas:new(Frame, Attrs)), + Attrs = [{attribList, [?WX_GL_RGBA, + ?WX_GL_DOUBLEBUFFER, + ?WX_GL_MIN_RED,8, + ?WX_GL_MIN_GREEN,8, + ?WX_GL_MIN_BLUE,8, + ?WX_GL_DEPTH_SIZE,24,0]}], + Canvas = ?mt(wxGLCanvas, wxGLCanvas:new(Frame, [{style,?wxFULL_REPAINT_ON_RESIZE}| + Attrs])), + wxFrame:connect(Frame, show), ?m(true, wxWindow:show(Frame)), + + receive #wx{event=#wxShow{}} -> ok + after 1000 -> exit(show_timeout) + end, + ?m(false, wx:is_null(wxGLCanvas:getContext(Canvas))), ?m({'EXIT', {{error, no_gl_context,_},_}}, gl:getString(?GL_VENDOR)), @@ -111,7 +123,7 @@ canvas(Config) -> %%gl:frustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 ), gl:ortho( -2.0, 2.0, -2.0*H/W, 2.0*H/W, -20.0, 20.0), gl:matrixMode(?GL_MODELVIEW), - gl:loadIdentity(), + gl:loadIdentity(), gl:enable(?GL_DEPTH_TEST), gl:depthFunc(?GL_LESS), {R,G,B,_} = wxWindow:getBackgroundColour(Frame), @@ -122,7 +134,7 @@ canvas(Config) -> ?m([], flush()), Env = wx:get_env(), Tester = self(), - spawn_link(fun() -> + spawn_link(fun() -> wx:set_env(Env), ?m(ok, wxGLCanvas:setCurrent(Canvas)), ?m(ok, drawBox(1, Data)), @@ -131,11 +143,20 @@ canvas(Config) -> %% This may fail when window is deleted catch draw_loop(2,Data,Canvas) end), + %% Needed on mac with wx-2.9 + wxGLCanvas:connect(Canvas, paint, + [{callback, fun(_,_) -> + wxGLCanvas:setCurrent(Canvas), + DC= wxPaintDC:new(Canvas), + wxPaintDC:destroy(DC) + end}]), + + ?m_receive(works), ?m([], flush()), io:format("Undef func ~p ~n", [catch gl:uniform1d(2, 0.75)]), timer:sleep(500), - ?m([], flush()), + flush(), wx_test_lib:wx_destroy(Frame, Config). flush() -> @@ -150,6 +171,8 @@ flush(Collected) -> draw_loop(Deg,Data,Canvas) -> timer:sleep(15), + {NW,NH} = wxGLCanvas:getClientSize(Canvas), + gl:viewport(0,0,NW,NH), drawBox(Deg,Data), ?m(ok, wxGLCanvas:swapBuffers(Canvas)), draw_loop(Deg+1, Data,Canvas). @@ -181,7 +204,12 @@ glu_tesselation(Config) -> Frame = wxFrame:new(WX,1,"Hello 3D-World",[]), Attrs = [{attribList, [?WX_GL_RGBA,?WX_GL_DOUBLEBUFFER,0]}], Canvas = ?mt(wxGLCanvas, wxGLCanvas:new(Frame, Attrs)), + wxFrame:connect(Frame, show), ?m(true, wxWindow:show(Frame)), + + receive #wx{event=#wxShow{}} -> ok + after 1000 -> exit(show_timeout) + end, ?m(ok, wxGLCanvas:setCurrent(Canvas)), {RL1,RB1} = ?m({_,_}, glu:tesselate({0,0,1}, [{-1,0,0},{1,0,0},{0,1,0}])), diff --git a/lib/wx/test/wx_xtra_SUITE.erl b/lib/wx/test/wx_xtra_SUITE.erl index 02a0672594..a2d4c26319 100644 --- a/lib/wx/test/wx_xtra_SUITE.erl +++ b/lib/wx/test/wx_xtra_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -111,6 +111,7 @@ app_dies(_Config) -> oops(Die,?LINE), wxFrame:show(Frame), oops(Die,?LINE), + timer:sleep(100), %% Let the window be shown before DC can be created DC0 = wxClientDC:new(Win), oops(Die,?LINE), DC = wxBufferedDC:new(DC0), @@ -134,7 +135,7 @@ app_dies2(Test, N) -> end. oops(Die, Line) when (Die =:= last) orelse (Die =< Line) -> - timer:sleep(500), + timer:sleep(300), ?log(" Exits at line ~p~n",[Line]), exit({oops, Die}); oops(_,_) -> ok. @@ -191,8 +192,12 @@ menu_item_debug(Config) -> wxFrame:connect(Frame, close_window), wxPanel:new(Frame), - create_menus(Frame), + MenuBar = create_menus(Frame), wxWindow:show(Frame), + N = wxMenuBar:getMenuCount(MenuBar), + io:format("No of menus ~p~n",[N]), + [io:format("Menu ~p ~p~n",[Id, wxMenuBar:getLabelTop(MenuBar, Id)]) + || Id <- lists:seq(0, N-1)], wx_test_lib:wx_destroy(Frame,Config). @@ -224,14 +229,15 @@ create_menus(Frame) -> || Id <- lists:seq(600, 620)], ?m(ok,wxFrame:connect(Frame, command_menu_selected)), - ?m(true, wxMenuBar:append(MenuBar, File, "&File")), - ?m(true, wxMenuBar:append(MenuBar, Help, "&Help")), - ?m(true, wxMenuBar:append(MenuBar, T1, "T1")), - ?m(true, wxMenuBar:append(MenuBar, T2, "T2")), - ?m(true, wxMenuBar:append(MenuBar, T3, "T3")), - ?m(true, wxMenuBar:append(MenuBar, T4, "T4")), - ?m(true, wxMenuBar:append(MenuBar, T5, "T5")), - ?m(true, wxMenuBar:append(MenuBar, T6, "T6")), - - ?m(ok, wxFrame:setMenuBar(Frame,MenuBar)). + ?m(true, wxMenuBar:insert(MenuBar, 0,File, "&File")), + ?m(true, wxMenuBar:insert(MenuBar, 1,Help, "&Help")), + ?m(true, wxMenuBar:insert(MenuBar, 2,T1, "T1")), + ?m(true, wxMenuBar:insert(MenuBar, 3,T2, "T2")), + ?m(true, wxMenuBar:insert(MenuBar, 4,T3, "T3")), + ?m(true, wxMenuBar:insert(MenuBar, 5,T4, "T4")), + ?m(true, wxMenuBar:insert(MenuBar, 6,T5, "T5")), + ?m(true, wxMenuBar:insert(MenuBar, 7,T6, "T6")), + + ?m(ok, wxFrame:setMenuBar(Frame,MenuBar)), + MenuBar. diff --git a/lib/wx/wxwin.m4 b/lib/wx/wxwin-2.8.m4 index 52c55e2e6e..52c55e2e6e 100644 --- a/lib/wx/wxwin.m4 +++ b/lib/wx/wxwin-2.8.m4 diff --git a/lib/wx/wxwin-2.9.m4 b/lib/wx/wxwin-2.9.m4 new file mode 100644 index 0000000000..1c50dcc272 --- /dev/null +++ b/lib/wx/wxwin-2.9.m4 @@ -0,0 +1,1060 @@ +dnl --------------------------------------------------------------------------- +dnl Author: wxWidgets development team, +dnl Francesco Montorsi, +dnl Bob McCown (Mac-testing) +dnl Creation date: 24/11/2001 +dnl RCS-ID: $Id$ +dnl --------------------------------------------------------------------------- + +dnl =========================================================================== +dnl Table of Contents of this macro file: +dnl ------------------------------------- +dnl +dnl SECTION A: wxWidgets main macros +dnl - WX_CONFIG_OPTIONS +dnl - WX_CONFIG_CHECK +dnl - WXRC_CHECK +dnl - WX_STANDARD_OPTIONS +dnl - WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS +dnl - WX_DETECT_STANDARD_OPTION_VALUES +dnl +dnl SECTION B: wxWidgets-related utilities +dnl - WX_LIKE_LIBNAME +dnl - WX_ARG_ENABLE_YESNOAUTO +dnl - WX_ARG_WITH_YESNOAUTO +dnl +dnl SECTION C: messages to the user +dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG +dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN +dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_END +dnl - WX_BOOLOPT_SUMMARY +dnl +dnl The special "WX_DEBUG_CONFIGURE" variable can be set to 1 to enable extra +dnl debug output on stdout from these macros. +dnl =========================================================================== + + +dnl --------------------------------------------------------------------------- +dnl Macros for wxWidgets detection. Typically used in configure.in as: +dnl +dnl AC_ARG_ENABLE(...) +dnl AC_ARG_WITH(...) +dnl ... +dnl WX_CONFIG_OPTIONS +dnl ... +dnl ... +dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1]) +dnl if test "$wxWin" != 1; then +dnl AC_MSG_ERROR([ +dnl wxWidgets must be installed on your system +dnl but wx-config script couldn't be found. +dnl +dnl Please check that wx-config is in path, the directory +dnl where wxWidgets libraries are installed (returned by +dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or +dnl equivalent variable and wxWidgets version is 2.3.4 or above. +dnl ]) +dnl fi +dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" +dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" +dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" +dnl +dnl LIBS="$LIBS $WX_LIBS" +dnl +dnl If you want to support standard --enable-debug/unicode/shared options, you +dnl may do the following: +dnl +dnl ... +dnl AC_CANONICAL_SYSTEM +dnl +dnl # define configure options +dnl WX_CONFIG_OPTIONS +dnl WX_STANDARD_OPTIONS([debug,unicode,shared,toolkit,wxshared]) +dnl +dnl # basic configure checks +dnl ... +dnl +dnl # we want to always have DEBUG==WX_DEBUG and UNICODE==WX_UNICODE +dnl WX_DEBUG=$DEBUG +dnl WX_UNICODE=$UNICODE +dnl +dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS +dnl WX_CONFIG_CHECK([2.8.0], [wxWin=1],,[html,core,net,base],[$WXCONFIG_FLAGS]) +dnl WX_DETECT_STANDARD_OPTION_VALUES +dnl +dnl # write the output files +dnl AC_CONFIG_FILES([Makefile ...]) +dnl AC_OUTPUT +dnl +dnl # optional: just to show a message to the user +dnl WX_STANDARD_OPTIONS_SUMMARY_MSG +dnl +dnl --------------------------------------------------------------------------- + + +dnl --------------------------------------------------------------------------- +dnl WX_CONFIG_OPTIONS +dnl +dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and +dnl --wx-config command line options +dnl --------------------------------------------------------------------------- + +AC_DEFUN([WX_CONFIG_OPTIONS], +[ + AC_ARG_WITH(wxdir, + [ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH], + [ wx_config_name="$withval/wx-config" + wx_config_args="--inplace"]) + AC_ARG_WITH(wx-config, + [ --with-wx-config=CONFIG wx-config script to use (optional)], + wx_config_name="$withval" ) + AC_ARG_WITH(wx-prefix, + [ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)], + wx_config_prefix="$withval", wx_config_prefix="") + AC_ARG_WITH(wx-exec-prefix, + [ --with-wx-exec-prefix=PREFIX + Exec prefix where wxWidgets is installed (optional)], + wx_config_exec_prefix="$withval", wx_config_exec_prefix="") +]) + +dnl Helper macro for checking if wx version is at least $1.$2.$3, set's +dnl wx_ver_ok=yes if it is: +AC_DEFUN([_WX_PRIVATE_CHECK_VERSION], +[ + wx_ver_ok="" + if test "x$WX_VERSION" != x ; then + if test $wx_config_major_version -gt $1; then + wx_ver_ok=yes + else + if test $wx_config_major_version -eq $1; then + if test $wx_config_minor_version -gt $2; then + wx_ver_ok=yes + else + if test $wx_config_minor_version -eq $2; then + if test $wx_config_micro_version -ge $3; then + wx_ver_ok=yes + fi + fi + fi + fi + fi + fi +]) + +dnl --------------------------------------------------------------------------- +dnl WX_CONFIG_CHECK(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]]) +dnl +dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC +dnl (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME +dnl environment variable to override the default name of the wx-config script +dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this +dnl case the macro won't even waste time on tests for its existence. +dnl +dnl Optional WX-LIBS argument contains comma- or space-separated list of +dnl wxWidgets libraries to link against. If it is not specified then WX_LIBS +dnl and WX_LIBS_STATIC will contain flags to link with all of the core +dnl wxWidgets libraries. +dnl +dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config +dnl invocation command in present. It can be used to fine-tune lookup of +dnl best wxWidgets build available. +dnl +dnl Example use: +dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1], [wxWin=0], [html,core,net] +dnl [--unicode --debug]) +dnl --------------------------------------------------------------------------- + +dnl +dnl Get the cflags and libraries from the wx-config script +dnl +AC_DEFUN([WX_CONFIG_CHECK], +[ + dnl do we have wx-config name: it can be wx-config or wxd-config or ... + if test x${WX_CONFIG_NAME+set} != xset ; then + WX_CONFIG_NAME=wx-config + fi + + if test "x$wx_config_name" != x ; then + WX_CONFIG_NAME="$wx_config_name" + fi + + dnl deal with optional prefixes + if test x$wx_config_exec_prefix != x ; then + wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix" + WX_LOOKUP_PATH="$wx_config_exec_prefix/bin" + fi + if test x$wx_config_prefix != x ; then + wx_config_args="$wx_config_args --prefix=$wx_config_prefix" + WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin" + fi + if test "$cross_compiling" = "yes"; then + wx_config_args="$wx_config_args --host=$host_alias" + fi + + dnl don't search the PATH if WX_CONFIG_NAME is absolute filename + if test -x "$WX_CONFIG_NAME" ; then + AC_MSG_CHECKING(for wx-config) + WX_CONFIG_PATH="$WX_CONFIG_NAME" + AC_MSG_RESULT($WX_CONFIG_PATH) + else + AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH") + fi + + if test "$WX_CONFIG_PATH" != "no" ; then + WX_VERSION="" + + min_wx_version=ifelse([$1], ,2.2.1,$1) + if test -z "$5" ; then + AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version]) + else + AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)]) + fi + + dnl don't add the libraries ($4) to this variable as this would result in + dnl an error when it's used with --version below + WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5" + + WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null` + wx_config_major_version=`echo $WX_VERSION | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + wx_config_minor_version=`echo $WX_VERSION | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + wx_config_micro_version=`echo $WX_VERSION | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + wx_requested_major_version=`echo $min_wx_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + wx_requested_minor_version=`echo $min_wx_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + wx_requested_micro_version=`echo $min_wx_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + _WX_PRIVATE_CHECK_VERSION([$wx_requested_major_version], + [$wx_requested_minor_version], + [$wx_requested_micro_version]) + + if test -n "$wx_ver_ok"; then + AC_MSG_RESULT(yes (version $WX_VERSION)) + WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs $4` + + dnl is this even still appropriate? --static is a real option now + dnl and WX_CONFIG_WITH_ARGS is likely to contain it if that is + dnl what the user actually wants, making this redundant at best. + dnl For now keep it in case anyone actually used it in the past. + AC_MSG_CHECKING([for wxWidgets static library]) + WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs $4 2>/dev/null` + if test "x$WX_LIBS_STATIC" = "x"; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + fi + + dnl starting with version 2.2.6 wx-config has --cppflags argument + wx_has_cppflags="" + if test $wx_config_major_version -gt 2; then + wx_has_cppflags=yes + else + if test $wx_config_major_version -eq 2; then + if test $wx_config_minor_version -gt 2; then + wx_has_cppflags=yes + else + if test $wx_config_minor_version -eq 2; then + if test $wx_config_micro_version -ge 6; then + wx_has_cppflags=yes + fi + fi + fi + fi + fi + + dnl starting with version 2.7.0 wx-config has --rescomp option + wx_has_rescomp="" + if test $wx_config_major_version -gt 2; then + wx_has_rescomp=yes + else + if test $wx_config_major_version -eq 2; then + if test $wx_config_minor_version -ge 7; then + wx_has_rescomp=yes + fi + fi + fi + if test "x$wx_has_rescomp" = x ; then + dnl cannot give any useful info for resource compiler + WX_RESCOMP= + else + WX_RESCOMP=`$WX_CONFIG_WITH_ARGS --rescomp` + fi + + if test "x$wx_has_cppflags" = x ; then + dnl no choice but to define all flags like CFLAGS + WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4` + WX_CPPFLAGS=$WX_CFLAGS + WX_CXXFLAGS=$WX_CFLAGS + + WX_CFLAGS_ONLY=$WX_CFLAGS + WX_CXXFLAGS_ONLY=$WX_CFLAGS + else + dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS + WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags $4` + WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags $4` + WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4` + + WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"` + WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"` + fi + + ifelse([$2], , :, [$2]) + + else + + if test "x$WX_VERSION" = x; then + dnl no wx-config at all + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(no (version $WX_VERSION is not new enough)) + fi + + WX_CFLAGS="" + WX_CPPFLAGS="" + WX_CXXFLAGS="" + WX_LIBS="" + WX_LIBS_STATIC="" + WX_RESCOMP="" + + if test ! -z "$5"; then + + wx_error_message=" + The configuration you asked for $PACKAGE_NAME requires a wxWidgets + build with the following settings: + $5 + but such build is not available. + + To see the wxWidgets builds available on this system, please use + 'wx-config --list' command. To use the default build, returned by + 'wx-config --selected-config', use the options with their 'auto' + default values." + + fi + + wx_error_message=" + The requested wxWidgets build couldn't be found. + $wx_error_message + + If you still get this error, then check that 'wx-config' is + in path, the directory where wxWidgets libraries are installed + (returned by 'wx-config --libs' command) is in LD_LIBRARY_PATH + or equivalent variable and wxWidgets version is $1 or above." + + ifelse([$3], , AC_MSG_ERROR([$wx_error_message]), [$3]) + + fi + else + + WX_CFLAGS="" + WX_CPPFLAGS="" + WX_CXXFLAGS="" + WX_LIBS="" + WX_LIBS_STATIC="" + WX_RESCOMP="" + + ifelse([$3], , :, [$3]) + + fi + + AC_SUBST(WX_CPPFLAGS) + AC_SUBST(WX_CFLAGS) + AC_SUBST(WX_CXXFLAGS) + AC_SUBST(WX_CFLAGS_ONLY) + AC_SUBST(WX_CXXFLAGS_ONLY) + AC_SUBST(WX_LIBS) + AC_SUBST(WX_LIBS_STATIC) + AC_SUBST(WX_VERSION) + AC_SUBST(WX_RESCOMP) + + dnl need to export also WX_VERSION_MINOR and WX_VERSION_MAJOR symbols + dnl to support wxpresets bakefiles (we export also WX_VERSION_MICRO for completeness): + WX_VERSION_MAJOR="$wx_config_major_version" + WX_VERSION_MINOR="$wx_config_minor_version" + WX_VERSION_MICRO="$wx_config_micro_version" + AC_SUBST(WX_VERSION_MAJOR) + AC_SUBST(WX_VERSION_MINOR) + AC_SUBST(WX_VERSION_MICRO) +]) + +dnl --------------------------------------------------------------------------- +dnl Get information on the wxrc program for making C++, Python and xrs +dnl resource files. +dnl +dnl AC_ARG_ENABLE(...) +dnl AC_ARG_WITH(...) +dnl ... +dnl WX_CONFIG_OPTIONS +dnl ... +dnl WX_CONFIG_CHECK(2.6.0, wxWin=1) +dnl if test "$wxWin" != 1; then +dnl AC_MSG_ERROR([ +dnl wxWidgets must be installed on your system +dnl but wx-config script couldn't be found. +dnl +dnl Please check that wx-config is in path, the directory +dnl where wxWidgets libraries are installed (returned by +dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or +dnl equivalent variable and wxWidgets version is 2.6.0 or above. +dnl ]) +dnl fi +dnl +dnl WXRC_CHECK([HAVE_WXRC=1], [HAVE_WXRC=0]) +dnl if test "x$HAVE_WXRC" != x1; then +dnl AC_MSG_ERROR([ +dnl The wxrc program was not installed or not found. +dnl +dnl Please check the wxWidgets installation. +dnl ]) +dnl fi +dnl +dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" +dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" +dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" +dnl +dnl LDFLAGS="$LDFLAGS $WX_LIBS" +dnl --------------------------------------------------------------------------- + +dnl --------------------------------------------------------------------------- +dnl WXRC_CHECK([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS +dnl resources. The variable WXRC will be set and substituted in the configure +dnl script and Makefiles. +dnl +dnl Example use: +dnl WXRC_CHECK([wxrc=1], [wxrc=0]) +dnl --------------------------------------------------------------------------- + +dnl +dnl wxrc program from the wx-config script +dnl +AC_DEFUN([WXRC_CHECK], +[ + AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler]) + + if test "x$WX_CONFIG_NAME" = x; then + AC_MSG_ERROR([The wxrc tests must run after wxWidgets test.]) + else + + AC_MSG_CHECKING([for wxrc]) + + if test "x$WXRC" = x ; then + dnl wx-config --utility is a new addition to wxWidgets: + _WX_PRIVATE_CHECK_VERSION(2,5,3) + if test -n "$wx_ver_ok"; then + WXRC=`$WX_CONFIG_WITH_ARGS --utility=wxrc` + fi + fi + + if test "x$WXRC" = x ; then + AC_MSG_RESULT([not found]) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT([$WXRC]) + ifelse([$1], , :, [$1]) + fi + + AC_SUBST(WXRC) + fi +]) + +dnl --------------------------------------------------------------------------- +dnl WX_LIKE_LIBNAME([output-var] [prefix], [name]) +dnl +dnl Sets the "output-var" variable to the name of a library named with same +dnl wxWidgets rule. +dnl E.g. for output-var=='lib', name=='test', prefix='mine', sets +dnl the $lib variable to: +dnl 'mine_gtk2ud_test-2.8' +dnl if WX_PORT=gtk2, WX_UNICODE=1, WX_DEBUG=1 and WX_RELEASE=28 +dnl --------------------------------------------------------------------------- +AC_DEFUN([WX_LIKE_LIBNAME], + [ + wx_temp="$2""_""$WX_PORT" + + dnl add the [u][d] string + if test "$WX_UNICODE" = "1"; then + wx_temp="$wx_temp""u" + fi + if test "$WX_DEBUG" = "1"; then + wx_temp="$wx_temp""d" + fi + + dnl complete the name of the lib + wx_temp="$wx_temp""_""$3""-$WX_VERSION_MAJOR.$WX_VERSION_MINOR" + + dnl save it in the user's variable + $1=$wx_temp + ]) + +dnl --------------------------------------------------------------------------- +dnl WX_ARG_ENABLE_YESNOAUTO/WX_ARG_WITH_YESNOAUTO +dnl +dnl Two little custom macros which define the ENABLE/WITH configure arguments. +dnl Macro arguments: +dnl $1 = the name of the --enable / --with feature +dnl $2 = the name of the variable associated +dnl $3 = the description of that feature +dnl $4 = the default value for that feature +dnl $5 = additional action to do in case option is given with "yes" value +dnl --------------------------------------------------------------------------- +AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO], + [AC_ARG_ENABLE($1, + AC_HELP_STRING([--enable-$1], [$3 (default is $4)]), + [], [enableval="$4"]) + + dnl Show a message to the user about this option + AC_MSG_CHECKING([for the --enable-$1 option]) + if test "$enableval" = "yes" ; then + AC_MSG_RESULT([yes]) + $2=1 + $5 + elif test "$enableval" = "no" ; then + AC_MSG_RESULT([no]) + $2=0 + elif test "$enableval" = "auto" ; then + AC_MSG_RESULT([will be automatically detected]) + $2="auto" + else + AC_MSG_ERROR([ + Unrecognized option value (allowed values: yes, no, auto) + ]) + fi + ]) + +AC_DEFUN([WX_ARG_WITH_YESNOAUTO], + [AC_ARG_WITH($1, + AC_HELP_STRING([--with-$1], [$3 (default is $4)]), + [], [withval="$4"]) + + dnl Show a message to the user about this option + AC_MSG_CHECKING([for the --with-$1 option]) + if test "$withval" = "yes" ; then + AC_MSG_RESULT([yes]) + $2=1 + $5 + dnl NB: by default we don't allow --with-$1=no option + dnl since it does not make much sense ! + elif test "$6" = "1" -a "$withval" = "no" ; then + AC_MSG_RESULT([no]) + $2=0 + elif test "$withval" = "auto" ; then + AC_MSG_RESULT([will be automatically detected]) + $2="auto" + else + AC_MSG_ERROR([ + Unrecognized option value (allowed values: yes, auto) + ]) + fi + ]) + + +dnl --------------------------------------------------------------------------- +dnl WX_STANDARD_OPTIONS([options-to-add]) +dnl +dnl Adds to the configure script one or more of the following options: +dnl --enable-[debug|unicode|shared|wxshared|wxdebug] +dnl --with-[gtk|msw|motif|x11|mac|dfb] +dnl --with-wxversion +dnl Then checks for their presence and eventually set the DEBUG, UNICODE, SHARED, +dnl PORT, WX_SHARED, WX_DEBUG, variables to one of the "yes", "no", "auto" values. +dnl +dnl Note that e.g. UNICODE != WX_UNICODE; the first is the value of the +dnl --enable-unicode option (in boolean format) while the second indicates +dnl if wxWidgets was built in Unicode mode (and still is in boolean format). +dnl --------------------------------------------------------------------------- +AC_DEFUN([WX_STANDARD_OPTIONS], + [ + + dnl the following lines will expand to WX_ARG_ENABLE_YESNOAUTO calls if and only if + dnl the $1 argument contains respectively the debug,unicode or shared options. + + dnl be careful here not to set debug flag if only "wxdebug" was specified + ifelse(regexp([$1], [\bdebug]), [-1],, + [WX_ARG_ENABLE_YESNOAUTO([debug], [DEBUG], [Build in debug mode], [auto])]) + + ifelse(index([$1], [unicode]), [-1],, + [WX_ARG_ENABLE_YESNOAUTO([unicode], [UNICODE], [Build in Unicode mode], [auto])]) + + ifelse(regexp([$1], [\bshared]), [-1],, + [WX_ARG_ENABLE_YESNOAUTO([shared], [SHARED], [Build as shared library], [auto])]) + + dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-toolkit since it's an option + dnl which must be able to accept the auto|gtk1|gtk2|msw|... values + ifelse(index([$1], [toolkit]), [-1],, + [ + AC_ARG_WITH([toolkit], + AC_HELP_STRING([--with-toolkit], + [Build against a specific wxWidgets toolkit (default is auto)]), + [], [withval="auto"]) + + dnl Show a message to the user about this option + AC_MSG_CHECKING([for the --with-toolkit option]) + if test "$withval" = "auto" ; then + AC_MSG_RESULT([will be automatically detected]) + TOOLKIT="auto" + else + TOOLKIT="$withval" + + dnl PORT must be one of the allowed values + if test "$TOOLKIT" != "gtk1" -a "$TOOLKIT" != "gtk2" -a \ + "$TOOLKIT" != "msw" -a "$TOOLKIT" != "motif" -a \ + "$TOOLKIT" != "osx_carbon" -a "$TOOLKIT" != "osx_cocoa" -a \ + "$TOOLKIT" != "dfb" -a "$TOOLKIT" != "x11"; then + AC_MSG_ERROR([ + Unrecognized option value (allowed values: auto, gtk1, gtk2, msw, motif, osx_carbon, osx_cocoa, dfb, x11) + ]) + fi + + AC_MSG_RESULT([$TOOLKIT]) + fi + ]) + + dnl ****** IMPORTANT ******* + dnl Unlike for the UNICODE setting, you can build your program in + dnl shared mode against a static build of wxWidgets. Thus we have the + dnl following option which allows these mixtures. E.g. + dnl + dnl ./configure --disable-shared --with-wxshared + dnl + dnl will build your library in static mode against the first available + dnl shared build of wxWidgets. + dnl + dnl Note that's not possible to do the viceversa: + dnl + dnl ./configure --enable-shared --without-wxshared + dnl + dnl Doing so you would try to build your library in shared mode against a static + dnl build of wxWidgets. This is not possible (you would mix PIC and non PIC code) ! + dnl A check for this combination of options is in WX_DETECT_STANDARD_OPTION_VALUES + dnl (where we know what 'auto' should be expanded to). + dnl + dnl If you try to build something in ANSI mode against a UNICODE build + dnl of wxWidgets or in RELEASE mode against a DEBUG build of wxWidgets, + dnl then at best you'll get ton of linking errors ! + dnl ************************ + + ifelse(index([$1], [wxshared]), [-1],, + [ + WX_ARG_WITH_YESNOAUTO( + [wxshared], [WX_SHARED], + [Force building against a shared build of wxWidgets, even if --disable-shared is given], + [auto], [], [1]) + ]) + + dnl Just like for SHARED and WX_SHARED it may happen that some adventurous + dnl peoples will want to mix a wxWidgets release build with a debug build of + dnl his app/lib. So, we have both DEBUG and WX_DEBUG variables. + ifelse(index([$1], [wxdebug]), [-1],, + [ + WX_ARG_WITH_YESNOAUTO( + [wxdebug], [WX_DEBUG], + [Force building against a debug build of wxWidgets, even if --disable-debug is given], + [auto], [], [1]) + ]) + + dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-wxversion since it's an option + dnl which accepts the "auto|2.6|2.7|2.8|2.9|3.0" etc etc values + ifelse(index([$1], [wxversion]), [-1],, + [ + AC_ARG_WITH([wxversion], + AC_HELP_STRING([--with-wxversion], + [Build against a specific version of wxWidgets (default is auto)]), + [], [withval="auto"]) + + dnl Show a message to the user about this option + AC_MSG_CHECKING([for the --with-wxversion option]) + if test "$withval" = "auto" ; then + AC_MSG_RESULT([will be automatically detected]) + WX_RELEASE="auto" + else + + wx_requested_major_version=`echo $withval | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\1/'` + wx_requested_minor_version=`echo $withval | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\2/'` + + dnl both vars above must be exactly 1 digit + if test "${#wx_requested_major_version}" != "1" -o \ + "${#wx_requested_minor_version}" != "1" ; then + AC_MSG_ERROR([ + Unrecognized option value (allowed values: auto, 2.6, 2.7, 2.8, 2.9, 3.0) + ]) + fi + + WX_RELEASE="$wx_requested_major_version"".""$wx_requested_minor_version" + AC_MSG_RESULT([$WX_RELEASE]) + fi + ]) + + if test "$WX_DEBUG_CONFIGURE" = "1"; then + echo "[[dbg]] DEBUG: $DEBUG, WX_DEBUG: $WX_DEBUG" + echo "[[dbg]] UNICODE: $UNICODE, WX_UNICODE: $WX_UNICODE" + echo "[[dbg]] SHARED: $SHARED, WX_SHARED: $WX_SHARED" + echo "[[dbg]] TOOLKIT: $TOOLKIT, WX_TOOLKIT: $WX_TOOLKIT" + echo "[[dbg]] VERSION: $VERSION, WX_RELEASE: $WX_RELEASE" + fi + ]) + + +dnl --------------------------------------------------------------------------- +dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS +dnl +dnl Sets the WXCONFIG_FLAGS string using the SHARED,DEBUG,UNICODE variable values +dnl which are different from "auto". +dnl Thus this macro needs to be called only once all options have been set. +dnl --------------------------------------------------------------------------- +AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS], + [ + if test "$WX_SHARED" = "1" ; then + WXCONFIG_FLAGS="--static=no " + elif test "$WX_SHARED" = "0" ; then + WXCONFIG_FLAGS="--static=yes " + fi + + if test "$WX_DEBUG" = "1" ; then + WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=yes " + elif test "$WX_DEBUG" = "0" ; then + WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=no " + fi + + dnl The user should have set WX_UNICODE=UNICODE + if test "$WX_UNICODE" = "1" ; then + WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=yes " + elif test "$WX_UNICODE" = "0" ; then + WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=no " + fi + + if test "$TOOLKIT" != "auto" ; then + WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--toolkit=$TOOLKIT " + fi + + if test "$WX_RELEASE" != "auto" ; then + WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--version=$WX_RELEASE " + fi + + dnl strip out the last space of the string + WXCONFIG_FLAGS=${WXCONFIG_FLAGS% } + + if test "$WX_DEBUG_CONFIGURE" = "1"; then + echo "[[dbg]] WXCONFIG_FLAGS: $WXCONFIG_FLAGS" + fi + ]) + + +dnl --------------------------------------------------------------------------- +dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG] +dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +dnl Outputs the given MSG. Then searches the given STRING in the wxWidgets +dnl additional CPP flags and put the result of the search in WX_$RESULTVAR +dnl also adding the "yes" or "no" message result to MSG. +dnl --------------------------------------------------------------------------- +AC_DEFUN([_WX_SELECTEDCONFIG_CHECKFOR], + [ + if test "$$1" = "auto" ; then + + dnl The user does not have particular preferences for this option; + dnl so we will detect the wxWidgets relative build setting and use it + AC_MSG_CHECKING([$3]) + + dnl set WX_$1 variable to 1 if the $WX_SELECTEDCONFIG contains the $2 + dnl string or to 0 otherwise. + dnl NOTE: 'expr match STRING REGEXP' cannot be used since on Mac it + dnl doesn't work; we use 'expr STRING : REGEXP' instead + WX_$1=$(expr "$WX_SELECTEDCONFIG" : ".*$2.*") + + if test "$WX_$1" != "0"; then + WX_$1=1 + AC_MSG_RESULT([yes]) + ifelse([$4], , :, [$4]) + else + WX_$1=0 + AC_MSG_RESULT([no]) + ifelse([$5], , :, [$5]) + fi + else + + dnl Use the setting given by the user + WX_$1=$$1 + fi + ]) + +dnl --------------------------------------------------------------------------- +dnl WX_DETECT_STANDARD_OPTION_VALUES +dnl +dnl Detects the values of the following variables: +dnl 1) WX_RELEASE +dnl 2) WX_UNICODE +dnl 3) WX_DEBUG +dnl 4) WX_SHARED (and also WX_STATIC) +dnl 5) WX_PORT +dnl from the previously selected wxWidgets build; this macro in fact must be +dnl called *after* calling the WX_CONFIG_CHECK macro. +dnl +dnl Note that the WX_VERSION_MAJOR, WX_VERSION_MINOR symbols are already set +dnl by WX_CONFIG_CHECK macro +dnl --------------------------------------------------------------------------- +AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], + [ + dnl IMPORTANT: WX_VERSION contains all three major.minor.micro digits, + dnl while WX_RELEASE only the major.minor ones. + WX_RELEASE="$WX_VERSION_MAJOR""$WX_VERSION_MINOR" + if test $WX_RELEASE -lt 26 ; then + + AC_MSG_ERROR([ + Cannot detect the wxWidgets configuration for the selected wxWidgets build + since its version is $WX_VERSION < 2.6.0; please install a newer + version of wxWidgets. + ]) + fi + + dnl The wx-config we are using understands the "--selected_config" + dnl option which returns an easy-parseable string ! + WX_SELECTEDCONFIG=$($WX_CONFIG_WITH_ARGS --selected_config) + + if test "$WX_DEBUG_CONFIGURE" = "1"; then + echo "[[dbg]] Using wx-config --selected-config" + echo "[[dbg]] WX_SELECTEDCONFIG: $WX_SELECTEDCONFIG" + fi + + + dnl we could test directly for WX_SHARED with a line like: + dnl _WX_SELECTEDCONFIG_CHECKFOR([SHARED], [shared], + dnl [if wxWidgets was built in SHARED mode]) + dnl but wx-config --selected-config DOES NOT outputs the 'shared' + dnl word when wx was built in shared mode; it rather outputs the + dnl 'static' word when built in static mode. + if test $WX_SHARED = "1"; then + STATIC=0 + elif test $WX_SHARED = "0"; then + STATIC=1 + elif test $WX_SHARED = "auto"; then + STATIC="auto" + fi + + dnl Now set the WX_UNICODE, WX_DEBUG, WX_STATIC variables + _WX_SELECTEDCONFIG_CHECKFOR([UNICODE], [unicode], + [if wxWidgets was built with UNICODE enabled]) + _WX_SELECTEDCONFIG_CHECKFOR([DEBUG], [debug], + [if wxWidgets was built in DEBUG mode]) + _WX_SELECTEDCONFIG_CHECKFOR([STATIC], [static], + [if wxWidgets was built in STATIC mode]) + + dnl init WX_SHARED from WX_STATIC + if test "$WX_STATIC" != "0"; then + WX_SHARED=0 + else + WX_SHARED=1 + fi + + AC_SUBST(WX_UNICODE) + AC_SUBST(WX_DEBUG) + AC_SUBST(WX_SHARED) + + dnl detect the WX_PORT to use + if test "$TOOLKIT" = "auto" ; then + + dnl The user does not have particular preferences for this option; + dnl so we will detect the wxWidgets relative build setting and use it + AC_MSG_CHECKING([which wxWidgets toolkit was selected]) + + WX_GTKPORT1=$(expr "$WX_SELECTEDCONFIG" : ".*gtk1.*") + WX_GTKPORT2=$(expr "$WX_SELECTEDCONFIG" : ".*gtk2.*") + WX_MSWPORT=$(expr "$WX_SELECTEDCONFIG" : ".*msw.*") + WX_MOTIFPORT=$(expr "$WX_SELECTEDCONFIG" : ".*motif.*") + WX_OSXCOCOAPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_cocoa.*") + WX_OSXCARBONPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_carbon.*") + WX_X11PORT=$(expr "$WX_SELECTEDCONFIG" : ".*x11.*") + WX_DFBPORT=$(expr "$WX_SELECTEDCONFIG" : ".*dfb.*") + + WX_PORT="unknown" + if test "$WX_GTKPORT1" != "0"; then WX_PORT="gtk1"; fi + if test "$WX_GTKPORT2" != "0"; then WX_PORT="gtk2"; fi + if test "$WX_MSWPORT" != "0"; then WX_PORT="msw"; fi + if test "$WX_MOTIFPORT" != "0"; then WX_PORT="motif"; fi + if test "$WX_OSXCOCOAPORT" != "0"; then WX_PORT="osx_cocoa"; fi + if test "$WX_OSXCARBONPORT" != "0"; then WX_PORT="osx_carbon"; fi + if test "$WX_X11PORT" != "0"; then WX_PORT="x11"; fi + if test "$WX_DFBPORT" != "0"; then WX_PORT="dfb"; fi + + dnl NOTE: backward-compatible check for wx2.8; in wx2.9 the mac + dnl ports are called 'osx_cocoa' and 'osx_carbon' (see above) + WX_MACPORT=$(expr "$WX_SELECTEDCONFIG" : ".*mac.*") + if test "$WX_MACPORT" != "0"; then WX_PORT="mac"; fi + + dnl check at least one of the WX_*PORT has been set ! + + if test "$WX_PORT" = "unknown" ; then + AC_MSG_ERROR([ + Cannot detect the currently installed wxWidgets port ! + Please check your 'wx-config --cxxflags'... + ]) + fi + + AC_MSG_RESULT([$WX_PORT]) + else + + dnl Use the setting given by the user + if test -z "$TOOLKIT" ; then + WX_PORT=$TOOLKIT + else + dnl try with PORT + WX_PORT=$PORT + fi + fi + + AC_SUBST(WX_PORT) + + if test "$WX_DEBUG_CONFIGURE" = "1"; then + echo "[[dbg]] Values of all WX_* options after final detection:" + echo "[[dbg]] WX_DEBUG: $WX_DEBUG" + echo "[[dbg]] WX_UNICODE: $WX_UNICODE" + echo "[[dbg]] WX_SHARED: $WX_SHARED" + echo "[[dbg]] WX_RELEASE: $WX_RELEASE" + echo "[[dbg]] WX_PORT: $WX_PORT" + fi + + dnl Avoid problem described in the WX_STANDARD_OPTIONS which happens when + dnl the user gives the options: + dnl ./configure --enable-shared --without-wxshared + dnl or just do + dnl ./configure --enable-shared + dnl but there is only a static build of wxWidgets available. + if test "$WX_SHARED" = "0" -a "$SHARED" = "1"; then + AC_MSG_ERROR([ + Cannot build shared library against a static build of wxWidgets ! + This error happens because the wxWidgets build which was selected + has been detected as static while you asked to build $PACKAGE_NAME + as shared library and this is not possible. + Use the '--disable-shared' option to build $PACKAGE_NAME + as static library or '--with-wxshared' to use wxWidgets as shared library. + ]) + fi + + dnl now we can finally update the DEBUG,UNICODE,SHARED options + dnl to their final values if they were set to 'auto' + if test "$DEBUG" = "auto"; then + DEBUG=$WX_DEBUG + fi + if test "$UNICODE" = "auto"; then + UNICODE=$WX_UNICODE + fi + if test "$SHARED" = "auto"; then + SHARED=$WX_SHARED + fi + if test "$TOOLKIT" = "auto"; then + TOOLKIT=$WX_PORT + fi + + dnl in case the user needs a BUILD=debug/release var... + if test "$DEBUG" = "1"; then + BUILD="debug" + elif test "$DEBUG" = "0" -o "$DEBUG" = ""; then + BUILD="release" + fi + + dnl respect the DEBUG variable adding the optimize/debug flags + dnl NOTE: the CXXFLAGS are merged together with the CPPFLAGS so we + dnl don't need to set them, too + if test "$DEBUG" = "1"; then + CXXFLAGS="$CXXFLAGS -g -O0" + CFLAGS="$CFLAGS -g -O0" + else + CXXFLAGS="$CXXFLAGS -O2" + CFLAGS="$CFLAGS -O2" + fi + ]) + +dnl --------------------------------------------------------------------------- +dnl WX_BOOLOPT_SUMMARY([name of the boolean variable to show summary for], +dnl [what to print when var is 1], +dnl [what to print when var is 0]) +dnl +dnl Prints $2 when variable $1 == 1 and prints $3 when variable $1 == 0. +dnl This macro mainly exists just to make configure.ac scripts more readable. +dnl +dnl NOTE: you need to use the [" my message"] syntax for 2nd and 3rd arguments +dnl if you want that m4 avoid to throw away the spaces prefixed to the +dnl argument value. +dnl --------------------------------------------------------------------------- +AC_DEFUN([WX_BOOLOPT_SUMMARY], + [ + if test "x$$1" = "x1" ; then + echo $2 + elif test "x$$1" = "x0" ; then + echo $3 + else + echo "$1 is $$1" + fi + ]) + +dnl --------------------------------------------------------------------------- +dnl WX_STANDARD_OPTIONS_SUMMARY_MSG +dnl +dnl Shows a summary message to the user about the WX_* variable contents. +dnl This macro is used typically at the end of the configure script. +dnl --------------------------------------------------------------------------- +AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG], + [ + echo + echo " The wxWidgets build which will be used by $PACKAGE_NAME $PACKAGE_VERSION" + echo " has the following settings:" + WX_BOOLOPT_SUMMARY([WX_DEBUG], [" - DEBUG build"], [" - RELEASE build"]) + WX_BOOLOPT_SUMMARY([WX_UNICODE], [" - UNICODE mode"], [" - ANSI mode"]) + WX_BOOLOPT_SUMMARY([WX_SHARED], [" - SHARED mode"], [" - STATIC mode"]) + echo " - VERSION: $WX_VERSION" + echo " - PORT: $WX_PORT" + ]) + + +dnl --------------------------------------------------------------------------- +dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN, WX_STANDARD_OPTIONS_SUMMARY_MSG_END +dnl +dnl Like WX_STANDARD_OPTIONS_SUMMARY_MSG macro but these two macros also gives info +dnl about the configuration of the package which used the wxpresets. +dnl +dnl Typical usage: +dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN +dnl echo " - Package setting 1: $SETTING1" +dnl echo " - Package setting 2: $SETTING1" +dnl ... +dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_END +dnl +dnl --------------------------------------------------------------------------- +AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN], + [ + echo + echo " ----------------------------------------------------------------" + echo " Configuration for $PACKAGE_NAME $PACKAGE_VERSION successfully completed." + echo " Summary of main configuration settings for $PACKAGE_NAME:" + WX_BOOLOPT_SUMMARY([DEBUG], [" - DEBUG build"], [" - RELEASE build"]) + WX_BOOLOPT_SUMMARY([UNICODE], [" - UNICODE mode"], [" - ANSI mode"]) + WX_BOOLOPT_SUMMARY([SHARED], [" - SHARED mode"], [" - STATIC mode"]) + ]) + +AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_END], + [ + WX_STANDARD_OPTIONS_SUMMARY_MSG + echo + echo " Now, just run make." + echo " ----------------------------------------------------------------" + echo + ]) + + +dnl --------------------------------------------------------------------------- +dnl Deprecated macro wrappers +dnl --------------------------------------------------------------------------- + +AC_DEFUN([AM_OPTIONS_WXCONFIG], [WX_CONFIG_OPTIONS]) +AC_DEFUN([AM_PATH_WXCONFIG], [ + WX_CONFIG_CHECK([$1],[$2],[$3],[$4],[$5]) +]) +AC_DEFUN([AM_PATH_WXRC], [WXRC_CHECK([$1],[$2])]) diff --git a/lib/xmerl/src/Makefile b/lib/xmerl/src/Makefile index ce1aa11fba..d5ce3fe6ff 100644 --- a/lib/xmerl/src/Makefile +++ b/lib/xmerl/src/Makefile @@ -166,34 +166,34 @@ EDOC_PATHS = \ -pa $(EDOC_APP)/ebin -pa $(XMERL_APP)/ebin -pa $(SYNTAX_TOOLS_APP)/ebin $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ xmerl_xpath_parse.erl: xmerl_xpath_parse.yrl - $(ERLC) -o $(ESRC) $< + $(yecc_verbose)$(ERLC) -o $(ESRC) $< xmerl_b64Bin.erl: xmerl_b64Bin.yrl - $(ERLC) -o $(ESRC) $< + $(yecc_verbose)$(ERLC) -o $(ESRC) $< xmerl_sax_parser_list.erl: xmerl_sax_parser_list.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_list.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_list.erlsrc xmerl_sax_parser_base.erlsrc >$@ xmerl_sax_parser_latin1.erl: xmerl_sax_parser_latin1.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_latin1.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_latin1.erlsrc xmerl_sax_parser_base.erlsrc >$@ xmerl_sax_parser_utf8.erl: xmerl_sax_parser_utf8.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_utf8.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_utf8.erlsrc xmerl_sax_parser_base.erlsrc >$@ xmerl_sax_parser_utf16be.erl: xmerl_sax_parser_utf16be.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_utf16be.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_utf16be.erlsrc xmerl_sax_parser_base.erlsrc >$@ xmerl_sax_parser_utf16le.erl: xmerl_sax_parser_utf16le.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_utf16le.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_utf16le.erlsrc xmerl_sax_parser_base.erlsrc >$@ $(EBIN)/%.beam: %.erl - $(ERLC) $(ERL_COMPILE_FLAGS) -o $(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) -o $(EBIN) $< $(DOCDIR)/%.html: %.erl $(ERL) -noshell $(EDOC_PATHS) \ diff --git a/make/fakefop b/make/fakefop index bbe81ef3b1..b64428bbd1 100755 --- a/make/fakefop +++ b/make/fakefop @@ -1,10 +1,9 @@ #!/bin/sh # -# Copyright Tuncer Ayaz 2010. All Rights Reserved. -# # %CopyrightBegin% # -# Copyright Ericsson AB 2010. All Rights Reserved. +# Copyright Tuncer Ayaz 2010-2013. All Rights Reserved. +# Copyright Ericsson AB 2010-2013. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -22,92 +21,85 @@ # Author: Tuncer Ayaz # -if [ $# -lt 4 ] +if [ $# -lt 6 ] then - echo "Usage: fakefop -fo IGNORED -pdf OUTFILE" + echo "Usage: fakefop -c IGNORED -fo IGNORED -pdf OUTFILE" exit 1 fi -OUTFILE=$4 -NAME=`basename $4 .pdf` +OUTFILE=$6 + +echo -n -e '%PDF-1.4\n%\0342\0343\0317\0323\n\n' > $OUTFILE -echo Write $OUTFILE -cat > $OUTFILE <<EndOfFile -%PDF-1.4 +cat >> $OUTFILE <<EndOfFile 1 0 obj - << /Type /Catalog - /Outlines 2 0 R - /Pages 3 0 R - >> +<< + /Type /Catalog + /Pages 2 0 R +>> endobj 2 0 obj - << /Type /Outlines - /Count 0 - >> +<< + /Type /Pages + /Kids [ 3 0 R ] + /Count 1 +>> endobj 3 0 obj - << /Type /Pages - /Kids [4 0 R] - /Count 1 +<< + /Type /Page + /Parent 2 0 R + /MediaBox [ 0 0 612 492 ] + /Contents 5 0 R + /Resources << + /Font << + /F1 4 0 R + >> >> +>> endobj 4 0 obj - << /Type /Page - /Parent 3 0 R - /MediaBox [0 0 612 492] - /Contents 5 0 R - /Resources << /ProcSet 6 0 R - /Font << /F1 7 0 R >> - >> - >> +<< + /Type /Font + /Subtype /Type1 + /Name /F1 + /BaseFont /Helvetica + /Encoding /StandardEncoding +>> endobj 5 0 obj - << /Length 73 >> +<< + /Length 74 +>> stream - BT - /F1 24 Tf - 10 400 Td - ($NAME) Tj - ET - BT - /F1 24 Tf - 10 350 Td - (\(placeholder PDF generated without FOP\)) Tj - ET +BT +/F1 24 Tf +10 400 Td +(\(placeholder PDF generated with fakefop\)) Tj +ET endstream endobj -6 0 obj - [/PDF /Text] -endobj -7 0 obj - << /Type /Font - /Subtype /Type1 - /Name /F1 - /BaseFont /Helvetica - /Encoding /MacRomanEncoding - >> -endobj xref -0 8 -0000000000 65535 f -0000000009 00000 n -0000000074 00000 n -0000000120 00000 n -0000000179 00000 n -0000000364 00000 n -0000000466 00000 n -0000000496 00000 n +0 6 +0000000000 65536 f +0000000016 00000 n +0000000070 00000 n +0000000136 00000 n +0000000291 00000 n +0000000410 00000 n trailer - << /Size 8 - /Root 1 0 R - >> +<< + /Size 6 + /Root 1 0 R +>> + startxref -625 +536 %%EOF EndOfFile diff --git a/make/otp.mk.in b/make/otp.mk.in index 90f448d4a0..fca9cf3cff 100644 --- a/make/otp.mk.in +++ b/make/otp.mk.in @@ -25,6 +25,11 @@ .3 .1 .fig .dvi .tex .class .java .pdf .fo .psframe .pscrop .el .elc # ---------------------------------------------------- +# Output +# ---------------------------------------------------- +include $(ERL_TOP)/make/output.mk + +# ---------------------------------------------------- # Cross Compiling # ---------------------------------------------------- CROSS_COMPILING = @CROSS_COMPILING@ @@ -104,19 +109,19 @@ ESRC = . endif $(EBIN)/%.beam: $(EGEN)/%.erl - $(ERLC) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< $(EBIN)/%.beam: $(ESRC)/%.erl - $(ERLC) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< ifeq ($(NATIVE_LIBS_ENABLED),yes) # Special rule for the HIPE bootstrap w/ native libs ../boot_ebin/%.beam: $(ESRC)/%.erl - $(ERLC) $(ERL_COMPILE_FLAGS) -o../boot_ebin $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) -o../boot_ebin $< endif .erl.beam: - $(ERLC) $(ERL_COMPILE_FLAGS) -o$(dir $@) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) -o$(dir $@) $< # # When .erl files are automatically created GNU make removes them if @@ -131,10 +136,10 @@ endif ## $(ERLC) $(IDL_FLAGS) $< $(EGEN)/%.erl: $(ESRC)/%.yrl - $(ERLC) $(YRL_FLAGS) -o$(EGEN) $< + $(yecc_verbose)$(ERLC) $(YRL_FLAGS) -o$(EGEN) $< $(EGEN)/%.erl: $(ESRC)/%.xrl - $(ERLC) $(XRL_FLAGS) -o$(EGEN) $< + $(leex_verbose)$(ERLC) $(XRL_FLAGS) -o$(EGEN) $< # ---------------------------------------------------- # SNMP language section @@ -149,16 +154,16 @@ endif $(SNMP_BIN_TARGET_DIR)/%.bin: %.mib - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< $(SNMP_HRL_TARGET_DIR)/%.hrl: $(SNMP_BIN_TARGET_DIR)/%.bin - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -o $(SNMP_HRL_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -o $(SNMP_HRL_TARGET_DIR) $< .mib.bin: - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) $< .bin.hrl: - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin $< # ---------------------------------------------------- # Java language section @@ -170,11 +175,11 @@ JAVA_DEST_ROOT = ../priv/ endif .java.class: - CLASSPATH=$(CLASSPATH) $(JAVA) $(JAVA_OPTIONS) $< + $(javac_verbose)CLASSPATH=$(CLASSPATH) $(JAVA) $(JAVA_OPTIONS) $< $(JAVA_DEST_ROOT)$(JAVA_CLASS_SUBDIR)%.class: %.java - CLASSPATH=$(CLASSPATH) $(JAVA) $(JAVA_OPTIONS) -d $(JAVA_DEST_ROOT) $< + $(javac_verbose)CLASSPATH=$(CLASSPATH) $(JAVA) $(JAVA_OPTIONS) -d $(JAVA_DEST_ROOT) $< # ---------------------------------------------------- # Emacs byte code compiling @@ -183,7 +188,7 @@ EMACS_COMPILER=emacs-20 EMACS_COMPILE_OPTIONS=-q --no-site-file -batch -f batch-byte-compile .el.elc: - $(EMACS_COMPILER) $(EMACS_COMPILE_OPTIONS) $< + $(emacs_verbose)$(EMACS_COMPILER) $(EMACS_COMPILE_OPTIONS) $< # ---------------------------------------------------- # Documentation section @@ -250,6 +255,7 @@ DEFAULT_GIF_FILES = $(HTMLDIR)/min_head.gif # XSLTPROC = @XSLTPROC@ FOP = @FOP@ +XMLLINT = @XMLLINT@ DOCGEN=$(ERL_TOP)/lib/erl_docgen FOP_CONFIG = $(DOCGEN)/priv/fop.xconf diff --git a/make/otp_ded.mk.in b/make/otp_ded.mk.in index e719312473..e2232acbb1 100644 --- a/make/otp_ded.mk.in +++ b/make/otp_ded.mk.in @@ -37,7 +37,7 @@ DED__NOWARN_CFLAGS = @DED_EMU_THR_DEFS@ @DED_CFLAGS@ DED_THR_DEFS = @DED_THR_DEFS@ DED_EMU_THR_DEFS = @DED_EMU_THR_DEFS@ DED_WARN_FLAGS = @WFLAGS@ -DED_CFLAGS = @WFLAGS@ @DED_EMU_THR_DEFS@ @DED_CFLAGS@ +DED_CFLAGS = @WERRORFLAGS@ @WFLAGS@ @DED_EMU_THR_DEFS@ @DED_CFLAGS@ DED_LIBS = @LIBS@ DED_EXT = @DED_EXT@ ERLANG_OSTYPE = @ERLANG_OSTYPE@ diff --git a/make/otp_release_targets.mk b/make/otp_release_targets.mk index 0be0a2de56..65a2e62979 100644 --- a/make/otp_release_targets.mk +++ b/make/otp_release_targets.mk @@ -106,6 +106,9 @@ $(HTMLDIR)/$(APPLICATION).eix: $(XML_FILES) $(SPECS_FILES) docs: $(HTMLDIR)/$(APPLICATION).eix +xmllint: $(XML_FILES) + $(XMLLINT) --noout --valid --nodefdtd --loaddtd --path $(DOCGEN)/priv/dtd:$(DOCGEN)/priv/dtd_html_entities $(XML_FILES) + # ---------------------------------------------------- # Local documentation target for testing # ---------------------------------------------------- diff --git a/make/output.mk.in b/make/output.mk.in new file mode 100644 index 0000000000..2f1a1d3a79 --- /dev/null +++ b/make/output.mk.in @@ -0,0 +1,112 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode +# ---------------------------------------------------- +# Make include file for otp +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2012. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# Author: Anthony Ramine +# ---------------------------------------------------- + +ifeq ($(V),) +V = @DEFAULT_VERBOSITY@ +endif + +ifeq ($(V),0) +v_p = 0 +else +v_p = 1 +endif + +V_at_0 = @ +V_at = $(V_at_$(V)) + +V_colon_0 = @: "" +V_colon = $(V_colon_$(V)) + +ar_verbose_0 = @echo " AR "$@; +ar_verbose = $(ar_verbose_$(V)) +V_AR = $(ar_verbose)$(AR) + +asn_verbose_0 = @echo " ASN "$@; +asn_verbose = $(asn_verbose_$(V)) + +cc_verbose_0 = @echo " CC "$@; +cc_verbose = $(cc_verbose_$(V)) +V_CC = $(cc_verbose)$(CC) + +dia_verbose_0 = @echo " DIA "$@; +dia_verbose = $(dia_verbose_$(V)) + +dtrace_verbose_0 = @echo " DTRACE "$@; +dtrace_verbose = $(dtrace_verbose_$(V)) + +emacs_verbose_0 = @echo " EMACS "$@; +emacs_verbose = $(emacs_verbose_$(V)) + +emu_cc_verbose_0 = @echo " EMU_CC "$@; +emu_cc_verbose = $(emu_cc_verbose_$(V)) +V_EMU_CC = $(emu_cc_verbose)$(EMU_CC) + +erlc_verbose_0 = @echo " ERLC "$@; +erlc_verbose = $(erlc_verbose_$(V)) +V_ERLC = $(erlc_verbose)$(ERLC) + +gen_verbose_0 = @echo " GEN "$@; +gen_verbose = $(gen_verbose_$(V)) + +javac_verbose_0 = @echo " JAVAC "$@; +javac_verbose = $(javac_verbose_$(V)) +V_JAVAC = $(javac_verbose)$(JAVAC) + +ld_verbose_0 = @echo " LD "$@; +ld_verbose = $(ld_verbose_$(V)) +V_LD = $(ld_verbose)$(LD) + +leex_verbose_0 = @echo " LEEX "$@; +leex_verbose = $(leex_verbose_$(V)) + +lex_verbose_0 = @echo " LEX "$@; +lex_verbose = $(lex_verbose_$(V)) +V_LEX = $(lex_verbose)$(LEX) + +m4_verbose_0 = @echo " M4 "$@; +m4_verbose = $(m4_verbose_$(V)) + +make_verbose_0 = @echo " MAKE "$@; +make_verbose = $(make_verbose_$(V)) + +mc_verbose_0 = @echo " MC "$@; +mc_verbose = $(mc_verbose_$(V)) +V_MC = $(mc_verbose)$(MC) + +ranlib_verbose_0 = @echo " RANLIB "$@; +ranlib_verbose = $(ranlib_verbose_$(V)) +V_RANLIB = $(ranlib_verbose)$(RANLIB) + +rc_verbose_0 = @echo " RC "$@; +rc_verbose = $(rc_verbose_$(V)) +V_RC = $(rc_verbose)$(RC) + +snmp_verbose_0 = @echo " SNMP "$@; +snmp_verbose = $(snmp_verbose_$(V)) + +vsn_verbose_0 = @echo " VSN "$@; +vsn_verbose = $(vsn_verbose_$(V)) + +yecc_verbose_0 = @echo " YECC "$@; +yecc_verbose = $(yecc_verbose_$(V)) diff --git a/make/run_make.mk b/make/run_make.mk index b7a5a64847..1b4213107f 100644 --- a/make/run_make.mk +++ b/make/run_make.mk @@ -25,19 +25,20 @@ # # ---------------------------------------------------- +include $(ERL_TOP)/make/output.mk include $(ERL_TOP)/make/target.mk .PHONY: valgrind opt debug purify quantify purecov valgrind gcov gprof lcnt: - $(MAKE) -f $(TARGET)/Makefile TYPE=$@ + $(make_verbose)$(MAKE) -f $(TARGET)/Makefile TYPE=$@ plain smp frag smp_frag: - $(MAKE) -f $(TARGET)/Makefile FLAVOR=$@ + $(make_verbose)$(MAKE) -f $(TARGET)/Makefile FLAVOR=$@ clean generate depend docs release release_spec release_docs release_docs_spec \ tests release_tests release_tests_spec: - $(MAKE) -f $(TARGET)/Makefile $@ + $(make_verbose)$(MAKE) -f $(TARGET)/Makefile $@ @@ -295,7 +295,7 @@ chk_eq() check_config_helpers () { - aclocals="./aclocal.m4 ./lib/erl_interface/aclocal.m4 ./lib/odbc/aclocal.m4 ./lib/wx/aclocal.m4" + aclocals="./aclocal.m4 ./lib/erl_interface/aclocal.m4 ./lib/odbc/aclocal.m4 ./lib/wx/aclocal.m4 ./lib/megaco/aclocal.m4" install_shs="./lib/common_test/priv/auxdir/install-sh ./lib/erl_interface/src/auxdir/install-sh ./lib/test_server/src/install-sh" config_guesses="./lib/common_test/priv/auxdir/config.guess ./lib/erl_interface/src/auxdir/config.guess ./lib/test_server/src/config.guess" config_subs="./lib/common_test/priv/auxdir/config.sub ./lib/erl_interface/src/auxdir/config.sub ./lib/test_server/src/config.sub" |