]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorJoe Groff <arcata@gmail.com>
Mon, 24 Aug 2009 23:04:44 +0000 (18:04 -0500)
committerJoe Groff <arcata@gmail.com>
Mon, 24 Aug 2009 23:04:44 +0000 (18:04 -0500)
basis/combinators/smart/smart-docs.factor
basis/combinators/smart/smart.factor
basis/help/markup/markup.factor
basis/help/stylesheet/stylesheet.factor
basis/images/png/png.factor
core/syntax/syntax-docs.factor
extra/gpu/shaders/shaders-docs.factor
extra/memory/piles/piles-docs.factor
extra/memory/piles/piles.factor

index 59b65d91cd2128f62497af370d46b4e31df4f894..85545a730c417bcbafabb46d0e8208895fd095c3 100644 (file)
@@ -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<sequence }
 "Store all output values to a sequence:"
index 751a1f52e10e83fb40a407c0ddeb65b6a5d6a394..cece9d844baecd9fc7a58ab71e701f63ab0e38a7 100644 (file)
@@ -7,6 +7,9 @@ IN: combinators.smart
 MACRO: drop-outputs ( quot -- quot' )
     dup infer out>> '[ @ _ ndrop ] ;
 
+MACRO: keep-inputs ( quot -- quot' )
+    dup infer in>> '[ _ _ nkeep ] ;
+
 MACRO: output>sequence ( quot exemplar -- newquot )
     [ dup infer out>> ] dip
     '[ @ _ _ nsequence ] ;
index 6f82a6f50be97c8bf74c05c15dab9875e5620846..2270088490140e2e713ebf8348f93b429d564e63 100644 (file)
@@ -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) ;
index 74d7f6c115f20210546447e25a36360daaae42bb..c7811a605d95a56e756827b3ffb0b6b1a1ef30e6 100644 (file)
@@ -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 }
index 2469a6a72cee023fa0e5ac8fe22aa46888a59d98..86247351c92fab7b1fb033a0dc8dc55566e7914c 100755 (executable)
@@ -95,7 +95,11 @@ ERROR: unimplemented-color-type image ;
     unimplemented-color-type ;
 
 : decode-truecolor-alpha ( loading-png -- loading-png )
-    unimplemented-color-type ;
+    [ <image> ] 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>> {
index a988e5736581a7038b5c577267bde75ca96fc542..cc4b080491f77f4c2a1330a80b8bf2ec71f3c236 100644 (file)
@@ -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 ... ;" }
index d59fa1bc391f3bf52e84893d90085f361753006b..33b97d7a8268e274e9901d49a5e61c4dab8cb6a5 100755 (executable)
@@ -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 <program-instance> } "." } ;
+{ $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 <program-instance> } "." } ;
 
 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 <program-instance> } "." } ;
@@ -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 <shader-instance> } "." } ;
+{ $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 <shader-instance> } "." } ;
 
 HELP: shader-instance
 { $class-description "A " { $snippet "shader-instance" } " is a " { $link shader } " that has been compiled for a graphics context using " { $link <shader-instance> } "." } ;
index c2bc29af1cc8f9faee4d7b51696b387e6ffa33e5..108c3535c96280feebaa709b8fcea09da90532f7 100644 (file)
@@ -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: <pile-c-array>
+{ $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: <pile-c-object>
+{ $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 <pile> }
 { $subsection pile-alloc }
+{ $subsection <pile-c-array> }
+{ $subsection <pile-c-object> }
 { $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." ;
index b8a79b4824f51587cc3a066733aed6da6e46a2e3..651bf2ec6c71e8e666d1b50ff4cc3b53827bf115 100644 (file)
@@ -28,6 +28,12 @@ M: pile dispose
         [ + ] curry change-offset drop
     ] 2tri ;
 
+: <pile-c-object> ( pile c-type -- alien )
+    heap-size pile-alloc ; inline
+
+: <pile-c-array> ( pile n c-type -- alien )
+    heap-size * pile-alloc ; inline
+
 : pile-align ( pile align -- pile )
     [ align ] curry change-offset ;