Merge branch 'master' of git://factorcode.org/git/factor into modern-harvey

modern-harvey2
Doug Coleman 2017-09-06 21:52:37 -05:00
commit d4612f2140
5 changed files with 73 additions and 102 deletions

View File

@ -2,7 +2,9 @@ USING: ui game.input tools.test kernel system threads calendar
combinators.short-circuit ; combinators.short-circuit ;
IN: game.input.tests IN: game.input.tests
os { [ windows? ] [ macosx? ] } 1|| [ ! os { [ windows? ] [ macosx? ] } 1|| [
! This test only works if a mouse is present. Issue #1844
os { [ macosx? ] } 1|| [
[ ] [ open-game-input ] unit-test [ ] [ open-game-input ] unit-test
[ ] [ 1 seconds sleep ] unit-test [ ] [ 1 seconds sleep ] unit-test
[ ] [ close-game-input ] unit-test [ ] [ close-game-input ] unit-test

View File

@ -11,54 +11,6 @@ ARTICLE: "windows.dragdrop-listener" "Dropping files onto listener window"
{ $subsections dragdrop-listener-window } { $subsections dragdrop-listener-window }
"Only one file at a time can be dropped." ; "Only one file at a time can be dropped." ;
HELP: +listener-dragdrop-wrapper+
{ $var-description "" } ;
HELP: <listener-dragdrop>
{ $values
{ "hWnd" null }
{ "object" object }
}
{ $description "" } ;
HELP: dragdrop-listener-window HELP: dragdrop-listener-window
{ $description "Run this word from a listener to activate drag-and-drop support for the listener window." $nl { $description "Run this word from a listener to activate drag-and-drop support for the listener window." $nl
"Note: if you get the \"" { $snippet "COM error 0x8007000e" } "\", you need to call " { $link ole-initialize } " first." } ; "Note: if you get the \"" { $snippet "COM error 0x8007000e" } "\", you need to call " { $link ole-initialize } " first." } ;
HELP: filecount-from-data-object
{ $values
{ "data-object" null }
{ "n" null }
}
{ $description "" } ;
HELP: filecount-from-hdrop
{ $values
{ "hdrop" null }
{ "n" null }
}
{ $description "" } ;
HELP: filenames-from-data-object
{ $values
{ "data-object" null }
{ "filenames" null }
}
{ $description "" } ;
HELP: filenames-from-hdrop
{ $values
{ "hdrop" null }
{ "filenames" null }
}
{ $description "" } ;
HELP: handle-data-object
{ $values
{ "handler" null } { "data-object" null }
{ "filenames" null }
}
{ $description "" } ;
HELP: listener-dragdrop
{ $class-description "" } ;

View File

@ -47,10 +47,11 @@ TUPLE: listener-dragdrop hWnd last-drop-effect ;
: <listener-dragdrop> ( hWnd -- object ) : <listener-dragdrop> ( hWnd -- object )
DROPEFFECT_NONE listener-dragdrop boa ; DROPEFFECT_NONE listener-dragdrop boa ;
<<
SYMBOL: +listener-dragdrop-wrapper+ SYMBOL: +listener-dragdrop-wrapper+
>>
<< <<
{ {
{ IDropTarget { { IDropTarget {
[ ! HRESULT DragEnter ( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect ) [ ! HRESULT DragEnter ( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
@ -80,7 +81,6 @@ SYMBOL: +listener-dragdrop-wrapper+
] ]
} } } }
} <com-wrapper> +listener-dragdrop-wrapper+ set-global } <com-wrapper> +listener-dragdrop-wrapper+ set-global
>> >>
: dragdrop-listener-window ( -- ) : dragdrop-listener-window ( -- )

111
build.sh
View File

@ -120,50 +120,50 @@ semver_into() {
export "$4=${BASH_REMATCH[3]}" export "$4=${BASH_REMATCH[3]}"
export "$5=${BASH_REMATCH[4]}" export "$5=${BASH_REMATCH[4]}"
elif [[ $1 =~ $CLANG_RE_OLD ]] ; then elif [[ $1 =~ $CLANG_RE_OLD ]] ; then
export "$2=${BASH_REMATCH[1]}" export "$2=${BASH_REMATCH[1]}"
export "$3=${BASH_REMATCH[2]}" export "$3=${BASH_REMATCH[2]}"
export "$4=0" export "$4=0"
export "$5=${BASH_REMATCH[3]}" export "$5=${BASH_REMATCH[3]}"
else else
echo "unsupported version number, please report a bug: $1" echo "unsupported version number, please report a bug: $1"
exit 123 exit 123
fi fi
} }
# issue 1440 # issue 1440
gcc_version_ok() { gcc_version_ok() {
GCC_VERSION=`gcc -dumpversion` GCC_VERSION=`gcc -dumpversion`
local GCC_MAJOR local GCC_MINOR local GCC_PATCH local GCC_SPECIAL local GCC_MAJOR local GCC_MINOR local GCC_PATCH local GCC_SPECIAL
semver_into $GCC_VERSION GCC_MAJOR GCC_MINOR GCC_PATCH GCC_SPECIAL semver_into $GCC_VERSION GCC_MAJOR GCC_MINOR GCC_PATCH GCC_SPECIAL
if [[ $GCC_MAJOR -lt 4 if [[ $GCC_MAJOR -lt 4
|| ( $GCC_MAJOR -eq 4 && $GCC_MINOR -lt 7 ) || ( $GCC_MAJOR -eq 4 && $GCC_MINOR -lt 7 )
|| ( $GCC_MAJOR -eq 4 && $GCC_MINOR -eq 7 && $GCC_PATCH -lt 3 ) || ( $GCC_MAJOR -eq 4 && $GCC_MINOR -eq 7 && $GCC_PATCH -lt 3 )
|| ( $GCC_MAJOR -eq 4 && $GCC_MINOR -eq 8 && $GCC_PATCH -eq 0 ) || ( $GCC_MAJOR -eq 4 && $GCC_MINOR -eq 8 && $GCC_PATCH -eq 0 )
]] ; then ]] ; then
echo "gcc version required >= 4.7.3, != 4.8.0, >= 4.8.1, got $GCC_VERSION" echo "gcc version required >= 4.7.3, != 4.8.0, >= 4.8.1, got $GCC_VERSION"
return 1 return 1
fi fi
return 0 return 0
} }
clang_version_ok() { clang_version_ok() {
CLANG_VERSION=`clang --version | head -n1` CLANG_VERSION=`clang --version | head -n1`
CLANG_VERSION_RE='^[a-zA-Z0-9 ]* version (.*)$' # 3.3-5 CLANG_VERSION_RE='^[a-zA-Z0-9 ]* version (.*)$' # 3.3-5
if [[ $CLANG_VERSION =~ $CLANG_VERSION_RE ]] ; then if [[ $CLANG_VERSION =~ $CLANG_VERSION_RE ]] ; then
export "CLANG_VERSION=${BASH_REMATCH[1]}" export "CLANG_VERSION=${BASH_REMATCH[1]}"
local CLANG_MAJOR local CLANG_MINOR local CLANG_PATCH local CLANG_SPECIAL local CLANG_MAJOR local CLANG_MINOR local CLANG_PATCH local CLANG_SPECIAL
semver_into "$CLANG_VERSION" CLANG_MAJOR CLANG_MINOR CLANG_PATCH CLANG_SPECIAL semver_into "$CLANG_VERSION" CLANG_MAJOR CLANG_MINOR CLANG_PATCH CLANG_SPECIAL
if [[ $CLANG_MAJOR -lt 3 if [[ $CLANG_MAJOR -lt 3
|| ( $CLANG_MAJOR -eq 3 && $CLANG_MINOR -le 1 ) || ( $CLANG_MAJOR -eq 3 && $CLANG_MINOR -le 1 )
]] ; then ]] ; then
echo "clang version required >= 3.1, got $CLANG_VERSION" echo "clang version required >= 3.1, got $CLANG_VERSION"
return 1 return 1
fi fi
else else
return 1 return 1
fi fi
return 0 return 0
} }
set_cc() { set_cc() {
@ -189,14 +189,6 @@ set_make() {
MAKE='make' MAKE='make'
} }
check_git_branch() {
BRANCH=`git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,'`
if [ "$BRANCH" != "master" ] ; then
$ECHO "git branch is $BRANCH, not master"
exit_script 3
fi
}
check_installed_programs() { check_installed_programs() {
ensure_program_installed chmod ensure_program_installed chmod
ensure_program_installed uname ensure_program_installed uname
@ -295,6 +287,17 @@ find_architecture() {
esac esac
} }
find_num_cores() {
$ECHO "Finding num cores..."
NUM_CORES=7ZZ
uname_s=`uname -s`
check_ret uname
case $uname_s in
CYGWIN_NT-5.2-WOW64 | *CYGWIN_NT* | *CYGWIN* | MINGW32*) NUM_CORES=$NUMBER_OF_PROCESSORS;;
*darwin* | *Darwin* | *linux* | *Linux*) NUM_CORES=$(getconf _NPROCESSORS_ONLN);;
esac
}
write_test_program() { write_test_program() {
#! Must be 'echo' #! Must be 'echo'
echo "#include <stdio.h>" > $C_WORD.c echo "#include <stdio.h>" > $C_WORD.c
@ -356,6 +359,7 @@ set_factor_image() {
echo_build_info() { echo_build_info() {
$ECHO OS=$OS $ECHO OS=$OS
$ECHO ARCH=$ARCH $ECHO ARCH=$ARCH
$ECHO NUM_CORES=$NUM_CORES
$ECHO WORD=$WORD $ECHO WORD=$WORD
$ECHO DEBUG=$DEBUG $ECHO DEBUG=$DEBUG
$ECHO FACTOR_BINARY=$FACTOR_BINARY $ECHO FACTOR_BINARY=$FACTOR_BINARY
@ -429,6 +433,7 @@ parse_build_info() {
find_build_info() { find_build_info() {
find_os find_os
find_architecture find_architecture
find_num_cores
set_cc set_cc
find_word_size find_word_size
set_factor_binary set_factor_binary
@ -536,7 +541,8 @@ make_clean() {
} }
make_factor() { make_factor() {
invoke_make CC=$CC CXX=$CXX $MAKE_TARGET -j5 $ECHO "Building factor with $NUM_CORES cores"
invoke_make CC=$CC CXX=$CXX $MAKE_TARGET -j$NUM_CORES
} }
make_clean_factor() { make_clean_factor() {
@ -544,6 +550,15 @@ make_clean_factor() {
make_factor make_factor
} }
current_git_branch() {
git rev-parse --abbrev-ref HEAD
}
checksum_url() {
branch=$(current_git_branch)
echo "http://downloads.factorcode.org/images/$branch/checksums.txt"
}
update_boot_images() { update_boot_images() {
$ECHO "Deleting old images..." $ECHO "Deleting old images..."
$DELETE checksums.txt* > /dev/null 2>&1 $DELETE checksums.txt* > /dev/null 2>&1
@ -551,7 +566,7 @@ update_boot_images() {
$DELETE $BOOT_IMAGE.{?,??} > /dev/null 2>&1 $DELETE $BOOT_IMAGE.{?,??} > /dev/null 2>&1
$DELETE temp/staging.*.image > /dev/null 2>&1 $DELETE temp/staging.*.image > /dev/null 2>&1
if [[ -f $BOOT_IMAGE ]] ; then if [[ -f $BOOT_IMAGE ]] ; then
get_url http://downloads.factorcode.org/images/latest/checksums.txt get_url $(checksum_url)
factorcode_md5=`cat checksums.txt|grep $BOOT_IMAGE|cut -f2 -d' '` factorcode_md5=`cat checksums.txt|grep $BOOT_IMAGE|cut -f2 -d' '`
set_md5sum set_md5sum
disk_md5=`$MD5SUM $BOOT_IMAGE|cut -f1 -d' '` disk_md5=`$MD5SUM $BOOT_IMAGE|cut -f1 -d' '`
@ -568,9 +583,14 @@ update_boot_images() {
fi fi
} }
boot_image_url() {
branch=$(current_git_branch)
echo "http://downloads.factorcode.org/images/$branch/$BOOT_IMAGE"
}
get_boot_image() { get_boot_image() {
$ECHO "Downloading boot image $BOOT_IMAGE." $ECHO "Downloading boot image $BOOT_IMAGE."
get_url http://downloads.factorcode.org/images/latest/$BOOT_IMAGE get_url $(boot_image_url)
} }
get_url() { get_url() {
@ -610,7 +630,6 @@ install() {
update() { update() {
get_config_info get_config_info
check_git_branch
git_fetch_factorcode git_fetch_factorcode
backup_factor backup_factor
make_clean_factor make_clean_factor

View File

@ -9,11 +9,9 @@ IN: git.tests
: with-empty-test-git-repo ( quot -- ) : with-empty-test-git-repo ( quot -- )
'[ '[
[ { "git" "init" } run-process drop
{ "git" "init" } run-process drop @
@ ] with-test-directory ; inline
] cleanup-unique-directory
] with-temp-directory ; inline
: with-zero-byte-file-repo ( quot -- ) : with-zero-byte-file-repo ( quot -- )
'[ '[