Merge remote-tracking branch 'origin/master' into modern-harvey2

modern-harvey2
Doug Coleman 2018-06-29 03:17:55 -05:00
commit 69c000088d
9 changed files with 110 additions and 97 deletions

View File

@ -5,9 +5,6 @@ compiler:
os: os:
- linux - linux
- osx - osx
branches:
only:
- master
sudo: required sudo: required
dist: trusty dist: trusty
group: deprecated-2017Q4 group: deprecated-2017Q4

View File

@ -1,26 +1,10 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays kernel combinators assocs USING: accessors assocs combinators fry furnace.utilities
namespaces sequences splitting words html.components html.forms html.templates
fry urls multiline present html.templates.chloe.compiler html.templates.chloe.syntax kernel
xml namespaces present sequences splitting urls xml.data xml.syntax
xml.data xml.traversal xml.writer ;
xml.entities
xml.writer
xml.traversal
xml.syntax
html.components
html.forms
html.templates
html.templates.chloe
html.templates.chloe.compiler
html.templates.chloe.syntax
http
http.server
http.server.redirection
http.server.responses
io.streams.string
furnace.utilities ;
IN: furnace.chloe-tags IN: furnace.chloe-tags
! Chloe tags ! Chloe tags

View File

@ -83,7 +83,6 @@ SYMBOL: vocab-articles
] map ; ] map ;
: contains-funky-elements? ( element -- ? ) : contains-funky-elements? ( element -- ? )
B
{ {
$shuffle $shuffle
$complex-shuffle $complex-shuffle

View File

@ -1,36 +1,14 @@
! Copyright (C) 2003, 2010 Slava Pestov. ! Copyright (C) 2003, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel accessors sequences arrays namespaces splitting USING: accessors arrays assocs combinators
vocabs.loader destructors assocs debugger continuations combinators.short-circuit continuations debugger destructors fry
combinators combinators.short-circuit vocabs.refresh hashtables html html.streams html.templates http
tools.time math present vectors hashtables http.server.remapping http.server.requests http.server.responses
io io io.crlf io.encodings io.encodings.ascii io.encodings.iana
io.sockets io.encodings.utf8 io.servers io.sockets io.sockets.secure
io.sockets.secure io.streams.limited kernel logging logging.insomniac math
io.encodings mime.types namespaces present sequences splitting tools.time
io.encodings.iana urls vectors vocabs vocabs.refresh xml.writer ;
io.encodings.utf8
io.encodings.ascii
io.encodings.binary
io.streams.limited
io.streams.string
io.streams.throwing
io.servers
io.timeouts
io.crlf
fry logging logging.insomniac calendar urls
unicode
http
http.server.requests
http.server.responses
http.server.remapping
html.templates
html.streams
html
mime.types
math.order
xml.writer
vocabs ;
IN: http.server IN: http.server
GENERIC: write-response ( response -- ) GENERIC: write-response ( response -- )
@ -187,7 +165,7 @@ SYMBOL: params
[ [
local-address get local-address get
[ secure? "https" "http" ? >>protocol ] [ secure? "https" "http" ? >>protocol ]
[ port>> remap-port '[ _ or ] change-port ] [ port>> remap-port >>port ]
bi bi
] change-url drop ; ] change-url drop ;

View File

@ -91,11 +91,13 @@ set_downloader() {
test_program_installed wget test_program_installed wget
if [[ $? -ne 0 ]] ; then if [[ $? -ne 0 ]] ; then
DOWNLOADER=wget DOWNLOADER=wget
DOWNLOADER_NAME=wget
return return
fi fi
test_program_installed curl test_program_installed curl
if [[ $? -ne 0 ]] ; then if [[ $? -ne 0 ]] ; then
DOWNLOADER="curl -f -O" DOWNLOADER="curl -f -O"
DOWNLOADER_NAME=curl
return return
fi fi
$ECHO "error: wget or curl required" $ECHO "error: wget or curl required"
@ -437,7 +439,7 @@ find_build_info() {
find_num_cores find_num_cores
set_cc set_cc
find_word_size find_word_size
find_branch set_current_branch
set_factor_binary set_factor_binary
set_factor_library set_factor_library
set_factor_image set_factor_image
@ -559,7 +561,38 @@ current_git_branch() {
git rev-parse --abbrev-ref HEAD git rev-parse --abbrev-ref HEAD
} }
find_branch() { check_url() {
if [[ $DOWNLOADER_NAME == 'wget' ]]; then
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then
return 0
else
return 1
fi
elif [[ $DOWNLOADER_NAME == 'curl' ]]; then
code=`curl -sL -w "%{http_code}\\n" "$1" -o /dev/null`
if [[ $code -eq 200 ]]; then return 0; else return 1; fi
else
$ECHO "error: wget or curl required in check_url"
exit_script 12
fi
}
# If we are on a branch, first try to get a boot image for that branch.
# Otherwise, just use `master`
set_boot_image_vars() {
set_current_branch
url="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/checksums.txt"
check_url $url
if [[ $? -eq 0 ]]; then
CHECKSUM_URL="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/checksums.txt"
BOOT_IMAGE_URL="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/${BOOT_IMAGE}"
else
CHECKSUM_URL="http://downloads.factorcode.org/images/master/checksums.txt"
BOOT_IMAGE_URL="http://downloads.factorcode.org/images/master/${BOOT_IMAGE}"
fi
}
set_current_branch() {
if [ -z ${TRAVIS_BRANCH} ]; then if [ -z ${TRAVIS_BRANCH} ]; then
CURRENT_BRANCH=$(current_git_branch) CURRENT_BRANCH=$(current_git_branch)
else else
@ -567,20 +600,15 @@ find_branch() {
fi fi
} }
checksum_url() { update_boot_image() {
find_branch set_boot_image_vars
echo "http://downloads.factorcode.org/images/$CURRENT_BRANCH/checksums.txt"
}
update_boot_images() {
find_branch
$ECHO "Deleting old images..." $ECHO "Deleting old images..."
$DELETE checksums.txt* > /dev/null 2>&1 $DELETE checksums.txt* > /dev/null 2>&1
# delete boot images with one or two characters after the dot # delete boot images with one or two characters after the dot
$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 $(checksum_url) 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' '`
@ -590,21 +618,16 @@ update_boot_images() {
$ECHO "Your disk boot image matches the one on factorcode.org." $ECHO "Your disk boot image matches the one on factorcode.org."
else else
$DELETE $BOOT_IMAGE > /dev/null 2>&1 $DELETE $BOOT_IMAGE > /dev/null 2>&1
get_boot_image; get_boot_image
fi fi
else else
get_boot_image get_boot_image
fi fi
} }
boot_image_url() {
find_branch
echo "http://downloads.factorcode.org/images/$CURRENT_BRANCH/$BOOT_IMAGE"
}
get_boot_image() { get_boot_image() {
$ECHO "Downloading boot image $BOOT_IMAGE." $ECHO "Downloading boot image $BOOT_IMAGE."
get_url $(boot_image_url) get_url "${BOOT_IMAGE_URL}"
} }
get_url() { get_url() {
@ -638,6 +661,7 @@ install() {
git_clone git_clone
cd_factor cd_factor
make_factor make_factor
set_boot_image_vars
get_boot_image get_boot_image
bootstrap bootstrap
} }
@ -650,7 +674,7 @@ update() {
} }
download_and_bootstrap() { download_and_bootstrap() {
update_boot_images update_boot_image
bootstrap bootstrap
} }
@ -713,6 +737,7 @@ usage() {
$ECHO " net-bootstrap - recompile, download a boot image, bootstrap" $ECHO " net-bootstrap - recompile, download a boot image, bootstrap"
$ECHO " make-target - find and print the os-arch-cpu string" $ECHO " make-target - find and print the os-arch-cpu string"
$ECHO " report - print the build variables" $ECHO " report - print the build variables"
$ECHO " update-boot-image - get the boot image for the current branch of for master"
$ECHO "" $ECHO ""
$ECHO "If you are behind a firewall, invoke as:" $ECHO "If you are behind a firewall, invoke as:"
$ECHO "env GIT_PROTOCOL=http $0 <command>" $ECHO "env GIT_PROTOCOL=http $0 <command>"
@ -746,6 +771,7 @@ case "$1" in
make-target) FIND_MAKE_TARGET=true; ECHO=false; find_build_info; exit_script ;; make-target) FIND_MAKE_TARGET=true; ECHO=false; find_build_info; exit_script ;;
report) find_build_info ;; report) find_build_info ;;
full-report) find_build_info; check_installed_programs; check_libraries ;; full-report) find_build_info; check_installed_programs; check_libraries ;;
update-boot-image) find_build_info; check_installed_programs; update_boot_image;;
*) usage ;; *) usage ;;
esac esac

View File

@ -16,8 +16,7 @@ CUDA-FUNCTION: helloWorld ( char* string-ptr )
[ [
context-device number>string context-device number>string
"CUDA device " ": " surround write "CUDA device " ": " surround write
"Hello World!" [ - ] B{ } map-index-as host>device &cuda-free "Hello World!" utf8 encode [ - ] B{ } map-index-as host>device &cuda-free
[ { 2 1 } { 6 1 1 } <grid> helloWorld ] [ { 2 1 } { 6 1 1 } <grid> helloWorld ]
[ 12 device>host >string print ] bi [ 12 device>host >string print ] bi
] with-destructors ] with-destructors

View File

@ -32,3 +32,8 @@ cpu ppc? [
] with-mapped-macho ] with-mapped-macho
] unit-test ] unit-test
] unless ] unless
! Throw an exception if the struct is not defined/handled
os macosx? [
{ } [ vm-path dylib-exports drop ] unit-test
] when

View File

@ -128,6 +128,15 @@ CONSTANT: LC_LAZY_LOAD_DYLIB 0x20
CONSTANT: LC_ENCRYPTION_INFO 0x21 CONSTANT: LC_ENCRYPTION_INFO 0x21
CONSTANT: LC_DYLD_INFO 0x22 CONSTANT: LC_DYLD_INFO 0x22
CONSTANT: LC_DYLD_INFO_ONLY 0x80000022 CONSTANT: LC_DYLD_INFO_ONLY 0x80000022
CONSTANT: LC_LOAD_UPWARD_DYLIB 0x80000023
CONSTANT: LC_VERSION_MIN_MACOSX 0x24
CONSTANT: LC_VERSION_MIN_IPHONEOS 0x25
CONSTANT: LC_FUNCTION_STARTS 0x26
CONSTANT: LC_DYLD_ENVIRONMENT 0x27
CONSTANT: LC_MAIN 0x80000028
CONSTANT: LC_DATA_IN_CODE 0x29
CONSTANT: LC_SOURCE_VERSION 0x2A
CONSTANT: LC_DYLIB_CODE_SIGN_DRS 0x2B
UNION-STRUCT: lc_str UNION-STRUCT: lc_str
{ offset uint } { offset uint }
@ -448,6 +457,12 @@ STRUCT: dyld_info_command
{ export_off uint } { export_off uint }
{ export_size uint } ; { export_size uint } ;
STRUCT: version_min_command
{ cmd uint32_t }
{ cmdsize uint32_t }
{ version uint32_t }
{ sdk uint32_t } ;
CONSTANT: REBASE_TYPE_POINTER 1 CONSTANT: REBASE_TYPE_POINTER 1
CONSTANT: REBASE_TYPE_TEXT_ABSOLUTE32 2 CONSTANT: REBASE_TYPE_TEXT_ABSOLUTE32 2
CONSTANT: REBASE_TYPE_TEXT_PCREL32 3 CONSTANT: REBASE_TYPE_TEXT_PCREL32 3
@ -514,6 +529,22 @@ STRUCT: fvmfile_command
{ name lc_str } { name lc_str }
{ header_addr uint } ; { header_addr uint } ;
STRUCT: entry_point_command
{ cmd uint32_t }
{ cmdsize uint32_t }
{ entryoff uint64_t }
{ stacksize uint64_t } ;
STRUCT: source_version_command
{ cmd uint32_t }
{ cmdsize uint32_t }
{ version uint64_t } ;
STRUCT: data_in_code_entry
{ offset uint32_t }
{ length uint16_t }
{ kind uint16_t } ;
! machine.h ! machine.h
CONSTANT: CPU_STATE_MAX 4 CONSTANT: CPU_STATE_MAX 4
CONSTANT: CPU_STATE_USER 0 CONSTANT: CPU_STATE_USER 0
@ -881,6 +912,15 @@ TYPED: 64-bit? ( macho: mach_header_32/64 -- ? )
{ LC_SUB_CLIENT [ sub_client_command ] } { LC_SUB_CLIENT [ sub_client_command ] }
{ LC_DYLD_INFO [ dyld_info_command ] } { LC_DYLD_INFO [ dyld_info_command ] }
{ LC_DYLD_INFO_ONLY [ dyld_info_command ] } { LC_DYLD_INFO_ONLY [ dyld_info_command ] }
{ LC_LOAD_UPWARD_DYLIB [ dylib_command ] }
{ LC_VERSION_MIN_MACOSX [ version_min_command ] }
{ LC_VERSION_MIN_IPHONEOS [ version_min_command ] }
{ LC_FUNCTION_STARTS [ linkedit_data_command ] }
{ LC_DYLD_ENVIRONMENT [ dylinker_command ] }
{ LC_MAIN [ entry_point_command ] }
{ LC_DATA_IN_CODE [ data_in_code_entry ] }
{ LC_SOURCE_VERSION [ source_version_command ] }
{ LC_DYLIB_CODE_SIGN_DRS [ linkedit_data_command ] }
} case ; } case ;
: read-command ( cmd -- next-cmd ) : read-command ( cmd -- next-cmd )

View File

@ -1,25 +1,10 @@
! Copyright (C) 2007, 2010 Slava Pestov ! Copyright (C) 2007, 2010 Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: namespaces assocs sorting sequences kernel accessors USING: accessors calendar db db.tuples db.types furnace.actions
hashtables db.types db.tuples db combinators furnace.auth furnace.boilerplate furnace.recaptcha
calendar calendar.format math.parser math.order syndication urls furnace.redirection furnace.syndication html.forms
xml.writer xmode.catalog validators http.server.dispatchers http.server.responses kernel math.parser
html.forms sequences sorting urls validators xmode.catalog ;
html.components
html.templates.chloe
http.server
http.server.dispatchers
http.server.redirection
http.server.responses
furnace
furnace.actions
furnace.redirection
furnace.auth
furnace.auth.login
furnace.boilerplate
furnace.recaptcha
furnace.syndication
furnace.conversations ;
IN: webapps.pastebin IN: webapps.pastebin
TUPLE: pastebin < dispatcher ; TUPLE: pastebin < dispatcher ;