Merge branch 'master' of git://factorcode.org/git/factor
commit
3d351bf95d
|
@ -11,23 +11,23 @@ IN: colors.constants
|
||||||
[ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip
|
[ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip
|
||||||
[ blank? ] trim-head { { CHAR: \s CHAR: - } } substitute swap ;
|
[ blank? ] trim-head { { CHAR: \s CHAR: - } } substitute swap ;
|
||||||
|
|
||||||
: parse-rgb.txt ( lines -- assoc )
|
: parse-colors ( lines -- assoc )
|
||||||
[ "!" head? not ] filter
|
[ "!" head? not ] filter
|
||||||
[ 11 cut [ " \t" split harvest ] dip suffix ] map
|
[ 11 cut [ " \t" split harvest ] dip suffix ] map
|
||||||
[ parse-color ] H{ } map>assoc ;
|
[ parse-color ] H{ } map>assoc ;
|
||||||
|
|
||||||
MEMO: rgb.txt ( -- assoc )
|
MEMO: colors ( -- assoc )
|
||||||
"resource:basis/colors/constants/rgb.txt"
|
"resource:basis/colors/constants/rgb.txt"
|
||||||
"resource:basis/colors/constants/factor-colors.txt"
|
"resource:basis/colors/constants/factor-colors.txt"
|
||||||
[ utf8 file-lines parse-rgb.txt ] bi@ assoc-union ;
|
[ utf8 file-lines parse-colors ] bi@ assoc-union ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: named-colors ( -- keys ) rgb.txt keys ;
|
: named-colors ( -- keys ) colors keys ;
|
||||||
|
|
||||||
ERROR: no-such-color name ;
|
ERROR: no-such-color name ;
|
||||||
|
|
||||||
: named-color ( name -- color )
|
: named-color ( name -- color )
|
||||||
dup rgb.txt at [ ] [ no-such-color ] ?if ;
|
dup colors at [ ] [ no-such-color ] ?if ;
|
||||||
|
|
||||||
SYNTAX: COLOR: scan named-color parsed ;
|
SYNTAX: COLOR: scan named-color parsed ;
|
|
@ -1,6 +1,6 @@
|
||||||
! Factor UI theme colors
|
! Factor UI theme colors
|
||||||
243 242 234 FactorLightLightTan
|
243 242 234 FactorLightTan
|
||||||
227 226 219 FactorLightTan
|
227 226 219 FactorTan
|
||||||
172 167 147 FactorDarkTan
|
172 167 147 FactorDarkTan
|
||||||
81 91 105 FactorLightSlateBlue
|
81 91 105 FactorLightSlateBlue
|
||||||
55 62 72 FactorDarkSlateBlue
|
55 62 72 FactorDarkSlateBlue
|
||||||
|
|
|
@ -129,6 +129,7 @@ IN: compiler.cfg.intrinsics
|
||||||
{ math.libm:ftanh [ drop "tanh" emit-unary-float-function ] }
|
{ math.libm:ftanh [ drop "tanh" emit-unary-float-function ] }
|
||||||
{ math.libm:fexp [ drop "exp" emit-unary-float-function ] }
|
{ math.libm:fexp [ drop "exp" emit-unary-float-function ] }
|
||||||
{ math.libm:flog [ drop "log" emit-unary-float-function ] }
|
{ math.libm:flog [ drop "log" emit-unary-float-function ] }
|
||||||
|
{ math.libm:flog10 [ drop "log10" emit-unary-float-function ] }
|
||||||
{ math.libm:fpow [ drop "pow" emit-binary-float-function ] }
|
{ math.libm:fpow [ drop "pow" emit-binary-float-function ] }
|
||||||
{ math.libm:facosh [ drop "acosh" emit-unary-float-function ] }
|
{ math.libm:facosh [ drop "acosh" emit-unary-float-function ] }
|
||||||
{ math.libm:fasinh [ drop "asinh" emit-unary-float-function ] }
|
{ math.libm:fasinh [ drop "asinh" emit-unary-float-function ] }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2005, 2009 Slava Pestov.
|
! Copyright (C) 2005, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: colors colors.constants io.styles literals namespaces ;
|
USING: colors colors.constants io.styles namespaces ;
|
||||||
IN: help.stylesheet
|
IN: help.stylesheet
|
||||||
|
|
||||||
SYMBOL: default-span-style
|
SYMBOL: default-span-style
|
||||||
|
@ -34,7 +34,7 @@ H{
|
||||||
{ font-style bold }
|
{ font-style bold }
|
||||||
{ wrap-margin 500 }
|
{ wrap-margin 500 }
|
||||||
{ foreground COLOR: gray20 }
|
{ foreground COLOR: gray20 }
|
||||||
{ page-color COLOR: FactorLightLightTan }
|
{ page-color COLOR: FactorLightTan }
|
||||||
{ inset { 5 5 } }
|
{ inset { 5 5 } }
|
||||||
} title-style set-global
|
} title-style set-global
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ SYMBOL: help-path-style
|
||||||
H{
|
H{
|
||||||
{ font-size 10 }
|
{ font-size 10 }
|
||||||
{ table-gap { 5 5 } }
|
{ table-gap { 5 5 } }
|
||||||
{ table-border $ transparent }
|
{ table-border COLOR: FactorLightTan }
|
||||||
} help-path-style set-global
|
} help-path-style set-global
|
||||||
|
|
||||||
SYMBOL: heading-style
|
SYMBOL: heading-style
|
||||||
|
@ -75,7 +75,7 @@ H{
|
||||||
|
|
||||||
SYMBOL: code-style
|
SYMBOL: code-style
|
||||||
H{
|
H{
|
||||||
{ page-color COLOR: FactorLightLightTan }
|
{ page-color COLOR: FactorLightTan }
|
||||||
{ inset { 5 5 } }
|
{ inset { 5 5 } }
|
||||||
{ wrap-margin f }
|
{ wrap-margin f }
|
||||||
} code-style set-global
|
} code-style set-global
|
||||||
|
@ -113,7 +113,7 @@ H{
|
||||||
SYMBOL: table-style
|
SYMBOL: table-style
|
||||||
H{
|
H{
|
||||||
{ table-gap { 5 5 } }
|
{ table-gap { 5 5 } }
|
||||||
{ table-border COLOR: FactorLightTan }
|
{ table-border COLOR: FactorTan }
|
||||||
} table-style set-global
|
} table-style set-global
|
||||||
|
|
||||||
SYMBOL: list-style
|
SYMBOL: list-style
|
||||||
|
|
|
@ -227,6 +227,18 @@ C: <vocab-author> vocab-author
|
||||||
] bi
|
] bi
|
||||||
] unless-empty ;
|
] unless-empty ;
|
||||||
|
|
||||||
|
: vocab-is-not-loaded ( vocab -- )
|
||||||
|
"Not loaded" $heading
|
||||||
|
"You must first load this vocabulary to browse its documentation and words."
|
||||||
|
print-element vocab-name "USE: " prepend 1array $code ;
|
||||||
|
|
||||||
|
: describe-words ( vocab -- )
|
||||||
|
{
|
||||||
|
{ [ dup vocab ] [ words $words ] }
|
||||||
|
{ [ dup find-vocab-root ] [ vocab-is-not-loaded ] }
|
||||||
|
[ drop ]
|
||||||
|
} cond ;
|
||||||
|
|
||||||
: words. ( vocab -- )
|
: words. ( vocab -- )
|
||||||
last-element off
|
last-element off
|
||||||
[ require ] [ words $words ] bi nl ;
|
[ require ] [ words $words ] bi nl ;
|
||||||
|
@ -243,7 +255,7 @@ C: <vocab-author> vocab-author
|
||||||
first {
|
first {
|
||||||
[ describe-help ]
|
[ describe-help ]
|
||||||
[ describe-metadata ]
|
[ describe-metadata ]
|
||||||
[ words $words ]
|
[ describe-words ]
|
||||||
[ describe-files ]
|
[ describe-files ]
|
||||||
[ describe-children ]
|
[ describe-children ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
|
@ -48,6 +48,7 @@ ARTICLE: "power-functions" "Powers and logarithms"
|
||||||
{ $subsection exp }
|
{ $subsection exp }
|
||||||
{ $subsection cis }
|
{ $subsection cis }
|
||||||
{ $subsection log }
|
{ $subsection log }
|
||||||
|
"Other logarithms:"
|
||||||
{ $subsection log1+ }
|
{ $subsection log1+ }
|
||||||
{ $subsection log10 }
|
{ $subsection log10 }
|
||||||
"Raising a number to a power:"
|
"Raising a number to a power:"
|
||||||
|
|
|
@ -33,6 +33,12 @@ IN: math.functions.tests
|
||||||
[ 0.0 ] [ 1.0 log ] unit-test
|
[ 0.0 ] [ 1.0 log ] unit-test
|
||||||
[ 1.0 ] [ e log ] unit-test
|
[ 1.0 ] [ e log ] unit-test
|
||||||
|
|
||||||
|
[ 0.0 ] [ 1.0 log10 ] unit-test
|
||||||
|
[ 1.0 ] [ 10.0 log10 ] unit-test
|
||||||
|
[ 2.0 ] [ 100.0 log10 ] unit-test
|
||||||
|
[ 3.0 ] [ 1000.0 log10 ] unit-test
|
||||||
|
[ 4.0 ] [ 10000.0 log10 ] unit-test
|
||||||
|
|
||||||
[ t ] [ 1 exp e 1.e-10 ~ ] unit-test
|
[ t ] [ 1 exp e 1.e-10 ~ ] unit-test
|
||||||
[ t ] [ 1.0 exp e 1.e-10 ~ ] unit-test
|
[ t ] [ 1.0 exp e 1.e-10 ~ ] unit-test
|
||||||
[ t ] [ -1 exp e * 1.0 1.e-10 ~ ] unit-test
|
[ t ] [ -1 exp e * 1.0 1.e-10 ~ ] unit-test
|
||||||
|
|
|
@ -173,7 +173,11 @@ M: float log1+ dup -1.0 >= [ flog1+ ] [ 1.0 + 0.0 rect> log ] if ; inline
|
||||||
|
|
||||||
: 10^ ( x -- y ) 10 swap ^ ; inline
|
: 10^ ( x -- y ) 10 swap ^ ; inline
|
||||||
|
|
||||||
: log10 ( x -- y ) log 10 log / ; inline
|
GENERIC: log10 ( x -- y ) foldable
|
||||||
|
|
||||||
|
M: real log10 >float flog10 ; inline
|
||||||
|
|
||||||
|
M: complex log10 log 10 log / ; inline
|
||||||
|
|
||||||
GENERIC: cos ( x -- y ) foldable
|
GENERIC: cos ( x -- y ) foldable
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ ARTICLE: "math.libm" "C standard library math functions"
|
||||||
{ $warning
|
{ $warning
|
||||||
"These functions are unsafe. The compiler special-cases them to operate on floats only. They can be called directly, however there is little reason to do so, since they only implement real-valued functions, and in some cases place restrictions on the domain:"
|
"These functions are unsafe. The compiler special-cases them to operate on floats only. They can be called directly, however there is little reason to do so, since they only implement real-valued functions, and in some cases place restrictions on the domain:"
|
||||||
{ $example "USE: math.functions" "2.0 acos ." "C{ 0.0 1.316957896924817 }" }
|
{ $example "USE: math.functions" "2.0 acos ." "C{ 0.0 1.316957896924817 }" }
|
||||||
{ $unchecked-example "USE: math.libm" "2 facos ." "0/0." } }
|
{ $unchecked-example "USE: math.libm" "2.0 facos ." "0/0." } }
|
||||||
"Trigonometric functions:"
|
"Trigonometric functions:"
|
||||||
{ $subsection fcos }
|
{ $subsection fcos }
|
||||||
{ $subsection fsin }
|
{ $subsection fsin }
|
||||||
|
@ -20,6 +20,7 @@ ARTICLE: "math.libm" "C standard library math functions"
|
||||||
"Exponentials and logarithms:"
|
"Exponentials and logarithms:"
|
||||||
{ $subsection fexp }
|
{ $subsection fexp }
|
||||||
{ $subsection flog }
|
{ $subsection flog }
|
||||||
|
{ $subsection flog10 }
|
||||||
"Powers:"
|
"Powers:"
|
||||||
{ $subsection fpow }
|
{ $subsection fpow }
|
||||||
{ $subsection fsqrt } ;
|
{ $subsection fsqrt } ;
|
||||||
|
@ -66,6 +67,10 @@ HELP: flog
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "y" real } }
|
||||||
{ $description "Calls the natural logarithm function from the C standard library. User code should call " { $link log } " instead." } ;
|
{ $description "Calls the natural logarithm function from the C standard library. User code should call " { $link log } " instead." } ;
|
||||||
|
|
||||||
|
HELP: flog10
|
||||||
|
{ $values { "x" real } { "y" real } }
|
||||||
|
{ $description "Calls the base 10 logarithm function from the C standard library. User code should call " { $link log10 } " instead." } ;
|
||||||
|
|
||||||
HELP: fpow
|
HELP: fpow
|
||||||
{ $values { "x" real } { "y" real } { "z" real } }
|
{ $values { "x" real } { "y" real } { "z" real } }
|
||||||
{ $description "Calls the power function (" { $snippet "z=x^y" } ") from the C standard library. User code should call " { $link ^ } " instead." } ;
|
{ $description "Calls the power function (" { $snippet "z=x^y" } ") from the C standard library. User code should call " { $link ^ } " instead." } ;
|
||||||
|
|
|
@ -39,6 +39,9 @@ IN: math.libm
|
||||||
: flog ( x -- y )
|
: flog ( x -- y )
|
||||||
"double" "libm" "log" { "double" } alien-invoke ;
|
"double" "libm" "log" { "double" } alien-invoke ;
|
||||||
|
|
||||||
|
: flog10 ( x -- y )
|
||||||
|
"double" "libm" "log10" { "double" } alien-invoke ;
|
||||||
|
|
||||||
: fpow ( x y -- z )
|
: fpow ( x y -- z )
|
||||||
"double" "libm" "pow" { "double" "double" } alien-invoke ;
|
"double" "libm" "pow" { "double" "double" } alien-invoke ;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2003, 2008 Slava Pestov.
|
! Copyright (C) 2003, 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays generic assocs io kernel math
|
USING: arrays generic assocs io kernel math
|
||||||
namespaces sequences strings io.styles vectors words
|
namespaces sequences strings vectors words
|
||||||
continuations ;
|
continuations ;
|
||||||
IN: prettyprint.config
|
IN: prettyprint.config
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ PRIVATE>
|
||||||
"at the top of the source file:" print nl
|
"at the top of the source file:" print nl
|
||||||
] with-style
|
] with-style
|
||||||
{
|
{
|
||||||
{ page-color COLOR: FactorLightLightTan }
|
{ page-color COLOR: FactorLightTan }
|
||||||
{ border-color COLOR: FactorDarkTan }
|
{ border-color COLOR: FactorDarkTan }
|
||||||
{ inset { 5 5 } }
|
{ inset { 5 5 } }
|
||||||
} [ manifest get pprint-manifest ] with-nesting
|
} [ manifest get pprint-manifest ] with-nesting
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
! Copyright (C) 2005, 2009 Daniel Ehrenberg
|
! Copyright (C) 2005, 2009 Daniel Ehrenberg
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel xml arrays math generic http.client
|
USING: accessors arrays assocs base64 calendar calendar.format
|
||||||
combinators hashtables namespaces io base64 sequences strings
|
combinators debugger generic hashtables http http.client
|
||||||
calendar xml.data xml.writer xml.traversal assocs math.parser
|
http.client.private io io.encodings.string io.encodings.utf8
|
||||||
debugger calendar.format math.order xml.syntax ;
|
kernel math math.order math.parser namespaces sequences strings
|
||||||
|
xml xml.data xml.syntax xml.traversal xml.writer ;
|
||||||
IN: xml-rpc
|
IN: xml-rpc
|
||||||
|
|
||||||
! * Sending RPC requests
|
! * Sending RPC requests
|
||||||
|
@ -174,9 +175,20 @@ TAG: array xml>item
|
||||||
] [ "Bad main tag name" server-error ] if
|
] [ "Bad main tag name" server-error ] if
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
: xml-post-data ( xml -- post-data )
|
||||||
|
xml>string utf8 encode "text/xml" <post-data> swap >>data ;
|
||||||
|
|
||||||
|
: rpc-post-request ( xml url -- request )
|
||||||
|
[ send-rpc xml-post-data ] [ "POST" <client-request> ] bi*
|
||||||
|
swap >>post-data ;
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
: post-rpc ( rpc url -- rpc )
|
: post-rpc ( rpc url -- rpc )
|
||||||
! This needs to do something in the event of an error
|
! This needs to do something in the event of an error
|
||||||
[ send-rpc ] dip http-post nip string>xml receive-rpc ;
|
rpc-post-request http-request nip string>xml receive-rpc ;
|
||||||
|
|
||||||
: invoke-method ( params method url -- response )
|
: invoke-method ( params method url -- response )
|
||||||
[ swap <rpc-method> ] dip post-rpc ;
|
[ swap <rpc-method> ] dip post-rpc ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include vm/Config.unix
|
include vm/Config.unix
|
||||||
PLAF_DLL_OBJS += vm/os-genunix.o vm/os-netbsd.o
|
PLAF_DLL_OBJS += vm/os-genunix.o vm/os-netbsd.o
|
||||||
CFLAGS += -export-dynamic
|
CFLAGS += -export-dynamic
|
||||||
LIBPATH = -L/usr/X11R6/lib -Wl,-rpath,/usr/X11R6/lib -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
|
LIBPATH = -L/usr/X11R7/lib -Wl,-rpath,/usr/X11R7/lib -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
|
||||||
LIBS = -lm -lssl -lcrypto $(X11_UI_LIBS)
|
LIBS = -lm -lssl -lcrypto $(X11_UI_LIBS)
|
||||||
|
|
Loading…
Reference in New Issue