2009-07-17 02:06:34 -04:00
|
|
|
! Copyright (C) 2009 Joe Groff.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
USING: kernel namespaces combinators.short-circuit vocabs sequences
|
|
|
|
compiler.units tools.annotations tools.annotations.private fry words
|
|
|
|
opengl calendar accessors ascii ;
|
|
|
|
IN: opengl.annotations
|
|
|
|
|
|
|
|
TUPLE: gl-error-log
|
|
|
|
{ function word initial: t }
|
2013-03-23 23:00:41 -04:00
|
|
|
{ error gl-error-tuple }
|
2009-07-17 02:06:34 -04:00
|
|
|
{ timestamp timestamp } ;
|
|
|
|
|
|
|
|
gl-error-log [ V{ } clone ] initialize
|
|
|
|
|
|
|
|
: <gl-error-log> ( function code -- gl-error-log )
|
|
|
|
[ dup ] dip <gl-error> now gl-error-log boa ;
|
|
|
|
|
|
|
|
: log-gl-error ( function -- )
|
|
|
|
gl-error-code [ <gl-error-log> gl-error-log get push ] [ drop ] if* ;
|
|
|
|
|
|
|
|
: clear-gl-error-log ( -- )
|
|
|
|
V{ } clone gl-error-log set ;
|
|
|
|
|
|
|
|
: gl-function? ( word -- ? )
|
|
|
|
name>> { [ "glGetError" = not ] [ "gl" head? ] [ third LETTER? ] } 1&& ;
|
|
|
|
|
|
|
|
: gl-functions ( -- words )
|
2015-06-08 15:02:25 -04:00
|
|
|
"opengl.gl" lookup-vocab vocab-words [ gl-function? ] filter ;
|
2009-07-17 02:06:34 -04:00
|
|
|
|
|
|
|
: annotate-gl-functions ( quot -- )
|
|
|
|
[
|
|
|
|
[ gl-functions ] dip [ [ dup ] dip curry (annotate) ] curry each
|
|
|
|
] with-compilation-unit ;
|
|
|
|
|
|
|
|
: reset-gl-functions ( -- )
|
|
|
|
[ gl-functions [ (reset) ] each ] with-compilation-unit ;
|
|
|
|
|
|
|
|
: throw-gl-errors ( -- )
|
|
|
|
[ '[ @ _ (gl-error) ] ] annotate-gl-functions ;
|
|
|
|
|
|
|
|
: log-gl-errors ( -- )
|
|
|
|
[ '[ @ _ log-gl-error ] ] annotate-gl-functions ;
|