From cb54ca6402db79e19de05c69707dd4858b28ef35 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Thu, 20 Aug 2009 18:36:34 -0500 Subject: [PATCH 1/7] clarify 'deprecated' docs --- core/syntax/syntax-docs.factor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index a988e57365..cc4b080491 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -193,7 +193,8 @@ HELP: delimiter HELP: deprecated { $syntax ": foo ... ; deprecated" } -{ $description "Declares the most recently defined word as deprecated. If the " { $vocab-link "tools.deprecation" } " vocabulary is loaded, usages of deprecated words will be noted as they are made." } ; +{ $description "Declares the most recently defined word as deprecated. If the " { $vocab-link "tools.deprecation" } " vocabulary is loaded, usages of deprecated words will be noted by the " { $link "tools.errors" } " system." } +{ $notes "Code that uses deprecated words continues to function normally; the errors are purely informational. However, code that uses deprecated words should be updated, for the deprecated words are intended to be removed soon." } ; HELP: SYNTAX: { $syntax "SYNTAX: foo ... ;" } From c6b9a458815850ca2a8b6af8f606fe18d536de37 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Thu, 20 Aug 2009 18:36:55 -0500 Subject: [PATCH 2/7] $deprecated help markup --- basis/help/markup/markup.factor | 8 ++++++++ basis/help/stylesheet/stylesheet.factor | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/basis/help/markup/markup.factor b/basis/help/markup/markup.factor index 6f82a6f50b..2270088490 100644 --- a/basis/help/markup/markup.factor +++ b/basis/help/markup/markup.factor @@ -137,6 +137,14 @@ ALIAS: $slot $snippet ] with-nesting ] ($heading) ; +: $deprecated ( element -- ) + [ + deprecated-style get [ + last-element off + "This word is deprecated" $heading print-element + ] with-nesting + ] ($heading) ; + ! Images : $image ( element -- ) [ first write-image ] ($span) ; diff --git a/basis/help/stylesheet/stylesheet.factor b/basis/help/stylesheet/stylesheet.factor index 74d7f6c115..c7811a605d 100644 --- a/basis/help/stylesheet/stylesheet.factor +++ b/basis/help/stylesheet/stylesheet.factor @@ -85,6 +85,14 @@ H{ { wrap-margin 500 } } warning-style set-global +SYMBOL: deprecated-style +H{ + { page-color COLOR: gray90 } + { border-color COLOR: red } + { border-width 5 } + { wrap-margin 500 } +} deprecated-style set-global + SYMBOL: table-content-style H{ { wrap-margin 350 } From 6f6edd79acfb4d99f99220ccd402dd1db4fb4825 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Fri, 21 Aug 2009 21:17:15 -0500 Subject: [PATCH 3/7] combinators.smart: "keep-inputs" combinator --- basis/combinators/smart/smart-docs.factor | 12 +++++++++++- basis/combinators/smart/smart.factor | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/basis/combinators/smart/smart-docs.factor b/basis/combinators/smart/smart-docs.factor index 59b65d91cd..85545a730c 100644 --- a/basis/combinators/smart/smart-docs.factor +++ b/basis/combinators/smart/smart-docs.factor @@ -106,11 +106,21 @@ HELP: append-outputs-as { append-outputs append-outputs-as } related-words +HELP: drop-outputs +{ $values { "quot" quotation } } +{ $description "Calls a quotation and drops any values it leaves on the stack." } ; + +HELP: keep-inputs +{ $values { "quot" quotation } } +{ $description "Calls a quotation and preserves any values it takes off the stack." } ; + +{ drop-outputs keep-inputs } related-words ARTICLE: "combinators.smart" "Smart combinators" "A " { $emphasis "smart combinator" } " is a macro which reflects on the stack effect of an input quotation. The " { $vocab-link "combinators.smart" } " vocabulary implements a few simple smart combinators which look at the static stack effects of input quotations and generate code which produces or consumes the relevant number of stack values." $nl -"Call a quotation and discard all output values:" +"Call a quotation and discard all output values or preserve all input values:" { $subsection drop-outputs } +{ $subsection keep-inputs } "Take all input values from a sequence:" { $subsection input> '[ @ _ ndrop ] ; +MACRO: keep-inputs ( quot -- quot' ) + dup infer in>> '[ _ _ nkeep ] ; + MACRO: output>sequence ( quot exemplar -- newquot ) [ dup infer out>> ] dip '[ @ _ _ nsequence ] ; From 17a08cb07a926a2198771dd9879c6c20fe7e95e0 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Sat, 22 Aug 2009 20:15:13 -0500 Subject: [PATCH 4/7] gpu.shaders docs corrections --- extra/gpu/shaders/shaders-docs.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extra/gpu/shaders/shaders-docs.factor b/extra/gpu/shaders/shaders-docs.factor index d59fa1bc39..33b97d7a82 100755 --- a/extra/gpu/shaders/shaders-docs.factor +++ b/extra/gpu/shaders/shaders-docs.factor @@ -111,7 +111,7 @@ HELP: output-index { $notes "Named fragment shader outputs require OpenGL 3.0 or later and GLSL 1.30 or later, or OpenGL 2.0 or later and GLSL 1.20 or earlier with the " { $snippet "GL_EXT_gpu_shader4" } " extension." } ; HELP: program -{ $class-description "A " { $snippet "program" } " provides a specification for linking a " { $link program-instance } " in a graphics context. Programs are defined with " { $link POSTPONE: GLSL-PROGRAM: } " and instantiated in a context with " { $link } "." } ; +{ $class-description "A " { $snippet "program" } " provides a specification for linking a " { $link program-instance } " in a graphics context. Programs are defined with " { $link POSTPONE: GLSL-PROGRAM: } " and instantiated for a context with " { $link } "." } ; HELP: program-instance { $class-description "A " { $snippet "program-instance" } " is a shader " { $link program } " that has been compiled and linked for a graphics context using " { $link } "." } ; @@ -120,10 +120,10 @@ HELP: refresh-program { $values { "program" program } } -{ $description "Rereads the source code for every " { $link shader } " in " { $link program } " and attempts to refresh all the existing " { $link shader-instance } "s and " { $link program-instance } "s for those programs. If the new source code fails to compile or link, the existing instances are untouched; otherwise, they are updated on the fly to reference the newly compiled code." } ; +{ $description "Rereads the source code for every " { $link shader } " in " { $link program } " and attempts to refresh all the existing " { $link shader-instance } "s and " { $link program-instance } "s for those shaders. If any of the new source code fails to compile or link, the existing valid shader and program instances will remain untouched. However, subsequent attempts to compile new shader or program instances will still attempt to use the new source code. If the compilation and linking succeed, the existing shader and program instances will be updated on the fly to reference the newly compiled code." } ; HELP: shader -{ $class-description "A " { $snippet "shader" } " provides a block of GLSL source code that can be compiled into a " { $link shader-instance } " in a graphics context. Shaders are defined with " { $link POSTPONE: GLSL-SHADER: } " or " { $link POSTPONE: GLSL-SHADER-FILE: } " and instantiated in a context with " { $link } "." } ; +{ $class-description "A " { $snippet "shader" } " provides a block of GLSL source code that can be compiled into a " { $link shader-instance } " in a graphics context. Shaders are defined with " { $link POSTPONE: GLSL-SHADER: } " or " { $link POSTPONE: GLSL-SHADER-FILE: } " and instantiated for a context with " { $link } "." } ; HELP: shader-instance { $class-description "A " { $snippet "shader-instance" } " is a " { $link shader } " that has been compiled for a graphics context using " { $link } "." } ; From 4923c66cc9fc8f8c4bbbde8ee95985c970175d69 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Sat, 22 Aug 2009 21:03:39 -0500 Subject: [PATCH 5/7] memory.piles: and convenience words --- extra/memory/piles/piles-docs.factor | 16 ++++++++++++++++ extra/memory/piles/piles.factor | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/extra/memory/piles/piles-docs.factor b/extra/memory/piles/piles-docs.factor index c2bc29af1c..108c3535c9 100644 --- a/extra/memory/piles/piles-docs.factor +++ b/extra/memory/piles/piles-docs.factor @@ -32,6 +32,20 @@ HELP: pile-alloc } { $description "Requests " { $snippet "size" } " bytes from a " { $link pile } ". If the pile does not have enough space to satisfy the request, a " { $link not-enough-pile-space } " error is thrown." } ; +HELP: +{ $values + { "pile" pile } { "n" integer } { "c-type" "a C type" } + { "alien" alien } +} +{ $description "Requests enough space from a " { $link pile } " to hold " { $snippet "n" } " values of " { $snippet "c-type" } ". If the pile does not have enough space to satisfy the request, a " { $link not-enough-pile-space } " error is thrown." } ; + +HELP: +{ $values + { "pile" pile } { "c-type" "a C type" } + { "alien" alien } +} +{ $description "Requests enough space from a " { $link pile } " to hold a value of " { $snippet "c-type" } ". If the pile does not have enough space to satisfy the request, a " { $link not-enough-pile-space } " error is thrown." } ; + HELP: pile-empty { $values { "pile" pile } @@ -42,6 +56,8 @@ ARTICLE: "memory.piles" "Piles" "A " { $link pile } " is a block of raw memory. Portions of its memory can be allocated from the beginning of the pile in constant time, and the pile can be emptied and its pointer reset to the beginning." { $subsection } { $subsection pile-alloc } +{ $subsection } +{ $subsection } { $subsection pile-align } { $subsection pile-empty } "An example of the utility of piles is in video games. For example, the game Abuse was scripted with a Lisp dialect. In order to avoid stalls from traditional GC or heap-based allocators, the Abuse Lisp VM would allocate values from a preallocated pile over the course of a frame, and release the entire pile at the end of the frame." ; diff --git a/extra/memory/piles/piles.factor b/extra/memory/piles/piles.factor index b8a79b4824..651bf2ec6c 100644 --- a/extra/memory/piles/piles.factor +++ b/extra/memory/piles/piles.factor @@ -28,6 +28,12 @@ M: pile dispose [ + ] curry change-offset drop ] 2tri ; +: ( pile c-type -- alien ) + heap-size pile-alloc ; inline + +: ( pile n c-type -- alien ) + heap-size * pile-alloc ; inline + : pile-align ( pile align -- pile ) [ align ] curry change-offset ; From 556adeb9b4b15e6fe6941a9189ad89f982436817 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Sun, 23 Aug 2009 09:51:12 -0500 Subject: [PATCH 6/7] handle RGBA pngs (when inflate finally works) --- basis/images/png/png.factor | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/basis/images/png/png.factor b/basis/images/png/png.factor index 2469a6a72c..86247351c9 100755 --- a/basis/images/png/png.factor +++ b/basis/images/png/png.factor @@ -95,7 +95,11 @@ ERROR: unimplemented-color-type image ; unimplemented-color-type ; : decode-truecolor-alpha ( loading-png -- loading-png ) - unimplemented-color-type ; + [ ] dip { + [ png-image-bytes >>bitmap ] + [ [ width>> ] [ height>> ] bi 2array >>dim ] + [ drop RGBA >>component-order ubyte-components >>component-type ] + } cleave ; : decode-png ( loading-png -- loading-png ) dup color-type>> { From bbb220f892f84be7b962e34443fd7b303579ed2b Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Mon, 24 Aug 2009 19:43:19 -0500 Subject: [PATCH 7/7] make memory.piles load without auto-use --- extra/memory/piles/piles.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/memory/piles/piles.factor b/extra/memory/piles/piles.factor index 651bf2ec6c..46729c42be 100644 --- a/extra/memory/piles/piles.factor +++ b/extra/memory/piles/piles.factor @@ -1,5 +1,5 @@ ! (c)2009 Joe Groff bsd license -USING: accessors alien destructors kernel libc math ; +USING: accessors alien alien.c-types destructors kernel libc math ; IN: memory.piles TUPLE: pile