byte-arrays classes.struct classes.struct.private combinators
combinators.short-circuit cuda cuda.ffi fry generalizations
io.backend kernel locals macros math namespaces sequences
-variants words ;
+variants vocabs.loader words ;
QUALIFIED-WITH: alien.c-types c
IN: cuda.libraries
: add-cuda-library ( name abi path -- )
normalize-path <cuda-library>
dup name>> cuda-libraries get-global set-at ;
+
+{ "cuda.libraries" "prettyprint" } "cuda.prettyprint" require-when
--- /dev/null
+USING: accessors alien.prettyprint combinators
+combinators.short-circuit cuda.libraries cuda.syntax definitions
+effects kernel prettyprint.backend prettyprint.sections see
+see.private sequences words ;
+IN: cuda.prettyprint
+
+PREDICATE: cuda-function-word < word
+ def>> { [ length 14 = ] [ last \ cuda-invoke eq? ] } 1&& ;
+
+: pprint-cuda-library ( library -- )
+ [ \ CUDA-LIBRARY: [ text ] pprint-prefix ] when* ;
+
+: pprint-cuda-function ( word quot -- )
+ [
+ <block "(" text
+ [ def>> third ] [ stack-effect in>> ] bi
+ pprint-function-args
+ ")" text block>
+ ] bi ; inline
+
+M: cuda-function-word definer drop \ CUDA-FUNCTION: \ ; ;
+M: cuda-function-word definition drop f ;
+M: cuda-function-word synopsis*
+ {
+ [ seeing-word ]
+ [ definer. ]
+ [ [ pprint-word ] pprint-cuda-function ]
+ } cleave ;
+
! Copyright (C) 2010 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: alien.parser cuda cuda.libraries io.backend
-fry kernel lexer namespaces parser ;
+USING: alien.parser cuda.libraries fry kernel lexer namespaces
+parser ;
IN: cuda.syntax
SYNTAX: CUDA-LIBRARY: