├── .gitmodules
├── INSTALL
├── LICENSE
├── README.md
├── TODO
├── _oasis
├── doc
├── blog
│ └── announce.html
└── gloc_pipeline.png
├── essl_to_glsl
├── essl_to_hlsl
├── extlib
└── noise.glsl
├── gloc_js.html
├── glocide.css
├── glocide.xsl
├── sketch
├── esslpp_me.mly
├── eval.ml
├── glsl.mly
├── glsl_lex.ml
├── jssl.ml
├── quot.ml
├── rocaml.hs
├── sl.hs
└── sl.ml
├── src
├── .gitignore
├── Makefile
├── _tags
├── ce_lib.ml
├── doc.xml
├── doc.xsl
├── essl.mly
├── essl.mlypack
├── essl_lib.ml
├── esslpp.mly
├── esslpp.mlypack
├── esslpp_ce.mly
├── esslpp_ce.mlypack
├── esslpp_lex.ml
├── glo.atd
├── glo.ml
├── glo_lib.ml
├── glo_xml.ml
├── gloc.css
├── gloc.ml
├── gloc_js.ml
├── gloc_lib.ml
├── gloc_platform_js.js
├── gloc_posix.ml
├── gloc_xml.ml
├── glocode.xsl
├── glol.js
├── glol.ml
├── glol_js.ml
├── language.ml
├── libgloc.c
├── mymyocamlbuild.ml
├── myocamlbuild.ml
├── platform_posix.ml
├── pp.ml
├── pp_lib.ml
├── pptok.mly
├── punc.ml
└── sl_lib.ml
├── stdlib
├── math.glsl
└── matrix.glsl
└── test
├── Makefile
└── webgl
├── Makefile
├── dissolve
├── .gitignore
├── Makefile
├── essl.in
├── essl.out
├── essl.true
├── funfun.in
├── funfun.out
├── funfun.true
├── line.in
├── line.out
├── line.true
├── macros.in
├── macros.out
├── macros.true
├── meta.in
├── meta.out
├── meta.true
├── multidecl.in
├── multidecl.out
├── multidecl.true
├── nested_struct.in
├── nested_struct.out
├── nested_struct.true
├── newtype.in
├── newtype.out
├── newtype.true
├── overload.in
├── overload.out
├── overload.true
├── overload_interleave.in
├── overload_interleave.out
├── overload_interleave.true
├── pp_interleave.in
├── pp_interleave.out
├── pp_interleave.true
├── roundtrip_span.in
├── roundtrip_span.out
├── roundtrip_span.true
├── special_decl.in
├── special_decl.out
├── special_decl.true
├── templ.in
├── templ.out
├── templ.true
├── templ_open.in
├── templ_open.out
└── templ_open.true
├── error
├── .gitignore
├── Makefile
├── block_header.in
├── block_header.out
├── block_header.true
├── directive_fail.in
├── directive_fail.out
├── directive_fail.true
├── empty.in
├── empty.out
├── empty.true
├── empty_directive.in
├── empty_directive.out
├── empty_directive.true
├── invalid_character.in
├── invalid_character.out
├── invalid_character.true
├── invalid_character2.in
├── invalid_character2.out
├── invalid_character2.true
├── invalid_directive_location.in
├── invalid_directive_location.out
├── invalid_directive_location.true
├── invalid_directive_location2.in
├── invalid_directive_location2.out
├── invalid_directive_location2.true
├── invalid_octal.in
├── invalid_octal.out
├── invalid_octal.true
├── invalid_version_base.in
├── invalid_version_base.out
├── invalid_version_base.true
├── just_comments.in
├── just_comments.out
├── just_comments.true
├── line_directive.in
├── line_directive.out
├── line_directive.true
├── multiline_block_header.in
├── multiline_block_header.out
├── multiline_block_header.true
├── multiline_directive.in
├── multiline_directive.out
├── multiline_directive.true
├── multiline_directive2.in
├── multiline_directive2.out
├── multiline_directive2.true
├── nested_block_comments.in
├── nested_block_comments.out
├── nested_block_comments.true
├── no_eof_newline.in
├── no_eof_newline.out
├── no_eof_newline.true
├── tauto_cond.in
├── tauto_cond.out
├── tauto_cond.true
├── unknown_behavior.in
├── unknown_behavior.out
├── unknown_behavior.true
├── unknown_directive.in
├── unknown_directive.out
├── unknown_directive.true
├── unknown_directive2.in
├── unknown_directive2.out
├── unknown_directive2.true
├── unterminated_comment.in
├── unterminated_comment.out
├── unterminated_comment.true
├── unterminated_comment_footer.in
├── unterminated_comment_footer.out
├── unterminated_comment_footer.true
├── unterminated_comment_header.in
├── unterminated_comment_header.out
├── unterminated_comment_header.true
├── unterminated_cond.in
├── unterminated_cond.out
├── unterminated_cond.true
├── unterminated_cond2.in
├── unterminated_cond2.out
├── unterminated_cond2.true
├── unterminated_cond3.in
├── unterminated_cond3.out
├── unterminated_cond3.true
├── unterminated_cond4.in
├── unterminated_cond4.out
└── unterminated_cond4.true
├── essl
├── .gitignore
├── Makefile
├── anonymous_type.in
├── anonymous_type.out
├── anonymous_type.true
├── conditional_scope.in
├── conditional_scope.out
├── conditional_scope.true
├── conditional_struct.in
├── conditional_struct.out
├── conditional_struct.true
├── duplicate_fields.in
├── duplicate_fields.out
├── duplicate_fields.true
├── empty.in
├── empty.out
├── empty.true
├── fn_shadow.in
├── fn_shadow.out
├── fn_shadow.true
├── for_init_struct.in
├── for_init_struct.out
├── for_init_struct.true
├── for_init_struct_scope.in
├── for_init_struct_scope.out
├── for_init_struct_scope.true
├── loop_body_decl.in
├── loop_body_decl.out
├── loop_body_decl.true
├── prototype_struct.in
├── prototype_struct.out
├── prototype_struct.true
├── structural_typing.in
├── structural_typing.out
├── structural_typing.true
├── unnamed_struct.in
├── unnamed_struct.out
└── unnamed_struct.true
├── glo
├── .gitignore
├── Makefile
├── attributes.in
├── attributes.out
├── attributes.true
├── consts.in
├── consts.out
├── consts.true
├── empty_cond.in
├── empty_cond.out
├── empty_cond.true
├── head_comment.in
├── head_comment.out
├── head_comment.true
├── inmac.in
├── inmac.out
├── inmac.true
├── inopmac.in
├── inopmac.out
├── inopmac.true
├── line_directive.in
├── line_directive.out
├── line_directive.true
├── line_directive2.in
├── line_directive2.out
├── line_directive2.true
├── macro_shadow.in
├── macro_shadow.out
├── macro_shadow.true
├── multidecl.in
├── multidecl.out
├── multidecl.true
├── one_in_one_out.in
├── one_in_one_out.out
├── one_in_one_out.true
├── opmac.in
├── opmac.out
├── opmac.true
├── poly_macro.in
├── poly_macro.out
├── poly_macro.true
├── prototype.in
├── prototype.out
├── prototype.true
├── scope.in
├── scope.out
├── scope.true
├── struct.in
├── struct.out
├── struct.true
├── uniforms.in
├── uniforms.out
├── uniforms.true
├── varyings.in
├── varyings.out
├── varyings.true
├── version.in
├── version.out
└── version.true
├── glol
├── .gitignore
├── Makefile
├── annotate_glom.xsl
├── bad_behavior.001.terr
├── bad_behavior.001.tout
├── bad_behavior.argset
├── bad_behavior.eglo
├── bad_version.001.terr
├── bad_version.001.tout
├── bad_version.argset
├── bad_version.eglo
├── circ.001.terr
├── circ.001.tout
├── circ.002.terr
├── circ.002.tout
├── circ.argset
├── circ_a.glsl
├── circ_b.glsl
├── conflict.001.terr
├── conflict.001.tout
├── conflict.002.terr
├── conflict.002.tout
├── conflict.003.terr
├── conflict.003.tout
├── conflict.004.terr
├── conflict.004.tout
├── conflict.argset
├── conflict.glsl
├── conflict_a.glsl
├── conflict_b.glsl
├── conflict_c.glsl
├── conflict_d.glsl
├── define.001.terr
├── define.001.tout
├── define.argset
├── define.glsl
├── diamond.001.terr
├── diamond.001.tout
├── diamond.002.terr
├── diamond.002.tout
├── diamond.003.terr
├── diamond.003.tout
├── diamond.004.terr
├── diamond.004.tout
├── diamond.005.terr
├── diamond.005.tout
├── diamond.006.terr
├── diamond.006.tout
├── diamond.007.terr
├── diamond.007.tout
├── diamond.008.terr
├── diamond.008.tout
├── diamond.009.terr
├── diamond.009.tout
├── diamond.010.terr
├── diamond.010.tout
├── diamond.011.terr
├── diamond.011.tout
├── diamond.012.terr
├── diamond.012.tout
├── diamond.013.terr
├── diamond.013.tout
├── diamond.014.terr
├── diamond.014.tout
├── diamond.015.terr
├── diamond.015.tout
├── diamond.016.terr
├── diamond.016.tout
├── diamond.017.terr
├── diamond.017.tout
├── diamond.018.terr
├── diamond.018.tout
├── diamond.019.terr
├── diamond.019.tout
├── diamond.020.terr
├── diamond.020.tout
├── diamond.021.terr
├── diamond.021.tout
├── diamond.022.terr
├── diamond.022.tout
├── diamond.023.terr
├── diamond.023.tout
├── diamond.024.terr
├── diamond.024.tout
├── diamond.argset
├── diamond.touts
├── diamond_0.glsl
├── diamond_1a.glsl
├── diamond_1b.glsl
├── diamond_2.glsl
├── extension.001.terr
├── extension.001.tout
├── extension.argset
├── extension_a.glsl
├── extension_b.glsl
├── html_of_tests.xsl
├── meta.001.terr
├── meta.001.tout
├── meta.argset
├── meta.eglo
├── meta.mglo
├── monkey.001.terr
├── monkey.001.tout
├── monkey.002.terr
├── monkey.002.tout
├── monkey.003.terr
├── monkey.003.tout
├── monkey.004.terr
├── monkey.004.tout
├── monkey.argset
├── monkey_a.glsl
├── monkey_b.glsl
├── monkey_c.glsl
├── multipath.001.terr
├── multipath.001.tout
├── multipath.argset
├── multipath.eglo
├── multipath.glsl
├── multipath2.glsl
├── nomacro.001.terr
├── nomacro.001.tout
├── nomacro.argset
├── nomacro.glsl
├── nosym.001.terr
├── nosym.001.tout
├── nosym.argset
├── nosym.glsl
├── pragma.001.terr
├── pragma.001.tout
├── pragma.argset
├── pragma_a.glsl
├── pragma_b.glsl
├── regex_line_dir.001.terr
├── regex_line_dir.001.tout
├── regex_line_dir.argset
├── regex_line_dir.glsl
├── shadow.001.terr
├── shadow.001.tout
├── shadow.002.terr
├── shadow.002.tout
├── shadow.argset
├── shadow_a.glsl
├── shadow_b.glsl
├── shadow_glom.001.terr
├── shadow_glom.001.tout
├── shadow_glom.002.terr
├── shadow_glom.002.tout
├── shadow_glom.argset
├── sym.ml
├── test_glol.js
├── test_page.xml
├── version.001.terr
├── version.001.tout
├── version.argset
├── version_100.glsl
├── version_101.glsl
└── version_a.glsl
├── pp
├── .gitignore
├── Makefile
├── arg_commas.in
├── arg_commas.out
├── arg_commas.true
├── arg_flag.in
├── arg_flag.out
├── arg_flag.true
├── arg_scope.in
├── arg_scope.out
├── arg_scope.true
├── block_comments.in
├── block_comments.out
├── block_comments.true
├── builtin_macros.in
├── builtin_macros.out
├── builtin_macros.true
├── conditional_error.in
├── conditional_error.out
├── conditional_error.true
├── deferred_cond.in
├── deferred_cond.out
├── deferred_cond.true
├── defined_macro.in
├── defined_macro.out
├── defined_macro.true
├── directive_in_macro_args.in
├── directive_in_macro_args.out
├── directive_in_macro_args.true
├── directive_jumble.in
├── directive_jumble.out
├── directive_jumble.true
├── empty_cond.in
├── empty_cond.out
├── empty_cond.true
├── fnmacro_breaks.in
├── fnmacro_breaks.out
├── fnmacro_breaks.true
├── fnmacro_prescan.in
├── fnmacro_prescan.out
├── fnmacro_prescan.true
├── glom_pp.in
├── glom_pp.out
├── glom_pp.true
├── glom_pp_a.glsl
├── glom_pp_b.glsl
├── holy_version.in
├── holy_version.out
├── holy_version.true
├── invalid_version_number.in
├── invalid_version_number.out
├── invalid_version_number.true
├── macro_arity.in
├── macro_arity.out
├── macro_arity.true
├── macro_cond.in
├── macro_cond.out
├── macro_cond.true
├── macro_redef.in
├── macro_redef.out
├── macro_redef.true
├── macro_scopes.in
├── macro_scopes.out
├── macro_scopes.true
├── mscoped_directives.in
├── mscoped_directives.out
├── mscoped_directives.true
├── multi_branch.in
├── multi_branch.out
├── multi_branch.true
├── multiglo_pp.in
├── multiglo_pp.out
├── multiglo_pp.true
├── op_prec.in
├── op_prec.out
├── op_prec.true
├── poly_macro.in
├── poly_macro.out
├── poly_macro.true
├── prescan_cons.in
├── prescan_cons.out
├── prescan_cons.true
├── recursive_macro.in
├── recursive_macro.out
├── recursive_macro.true
├── reserved_ident.in
├── reserved_ident.out
├── reserved_ident.true
├── reserved_macro.in
├── reserved_macro.out
├── reserved_macro.true
├── short_circuit.in
├── short_circuit.out
├── short_circuit.true
├── unclosed_macro_arg.in
├── unclosed_macro_arg.out
├── unclosed_macro_arg.true
├── unclosed_macro_arg_paren.in
├── unclosed_macro_arg_paren.out
├── unclosed_macro_arg_paren.true
├── unsupported_cond_op.in
├── unsupported_cond_op.out
├── unsupported_cond_op.true
├── unsupported_float.in
├── unsupported_float.out
├── unsupported_float.true
├── wrong_macro_arity.in
├── wrong_macro_arity.out
└── wrong_macro_arity.true
└── ppp
├── .gitignore
├── Makefile
├── block_comments.in
├── block_comments.out
├── block_comments.true
├── block_comments2.in
├── block_comments2.out
├── block_comments2.true
├── defined_macro.in
├── defined_macro.out
├── defined_macro.true
├── line_scope.in
├── line_scope.out
├── line_scope.true
├── macro_args.in
├── macro_args.out
├── macro_args.true
├── macro_cond.in
├── macro_cond.out
├── macro_cond.true
├── macro_cond2.in
├── macro_cond2.out
├── macro_cond2.true
├── macro_scopes.in
├── macro_scopes.out
└── macro_scopes.true
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Pretty-Diff"]
2 | path = Pretty-Diff
3 | url = https://github.com/austincheney/Pretty-Diff.git
4 | [submodule "CodeMirror2"]
5 | path = CodeMirror2
6 | url = https://github.com/marijnh/CodeMirror2.git
7 |
--------------------------------------------------------------------------------
/INSTALL:
--------------------------------------------------------------------------------
1 |
2 | cd src/
3 | make gloc.d.byte
4 | ln -s `pwd`/gloc.d.byte /gloc
5 |
6 | Remember, you will need:
7 |
8 | - [GNU Make](http://www.gnu.org/software/make/)
9 | - [OCaml 3.12.0+](http://caml.inria.fr/)
10 | - [ulex](http://cduce.org/download.html)
11 | - [menhir](http://gallium.inria.fr/~fpottier/menhir/)
12 | - [ocaml-re](https://github.com/avsm/ocaml-re)
13 |
14 | You will also need recent versions of Martin Jambon's atdgen and friends
15 | in approximately this order:
16 |
17 | - [yojson 1.1+](https://github.com/mjambon/yojson)
18 | - [atd](https://github.com/MyLifeLabs/atd)
19 | - [atdgen](https://github.com/MyLifeLabs/atdgen)
20 |
21 | These software packages may be available in your operating system's
22 | package repository. See [the gloc GitHub wiki
23 | page](https://github.com/ashima/gloc/wiki) for more detailed
24 | installation information.
25 |
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2011 Ashima Arts. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions
5 | are met:
6 |
7 | Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 |
10 | Redistributions in binary form must reproduce the above
11 | copyright notice, this list of conditions and the following
12 | disclaimer in the documentation and/or other materials provided
13 | with the distribution.
14 |
15 | Neither the name of Ashima Arts, nor the names of any contributors
16 | may be used to endorse or promote products derived from this
17 | software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | POSSIBILITY OF SUCH DAMAGE.
31 |
--------------------------------------------------------------------------------
/TODO:
--------------------------------------------------------------------------------
1 | add
2 | - extension support
3 | - warn on defined as a macro
4 | - warn on comment nesting
5 | - macro redef errors/warnings
6 | - function cost annotations via cg
7 | - ternary emulation in conditionals with warning
8 |
9 |
--------------------------------------------------------------------------------
/_oasis:
--------------------------------------------------------------------------------
1 | OASISFormat: 0.2
2 | Name: gloc
3 | Version: 1.0.0
4 | Synopsis: WebGLSL/ESSL shader tools
5 | Authors: David Sheets
6 | License: BSD3
7 |
8 | Executable gloc
9 | Path: .
10 | BuildTools: ocamlbuild
11 | MainIs: src/gloc_posix.ml
12 |
13 |
--------------------------------------------------------------------------------
/doc/gloc_pipeline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/doc/gloc_pipeline.png
--------------------------------------------------------------------------------
/essl_to_glsl:
--------------------------------------------------------------------------------
1 | ../angleproject/samples/build/Default/essl_to_glsl
--------------------------------------------------------------------------------
/essl_to_hlsl:
--------------------------------------------------------------------------------
1 | ../angleproject/samples/build/Default/essl_to_hlsl
--------------------------------------------------------------------------------
/extlib/noise.glsl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/extlib/noise.glsl
--------------------------------------------------------------------------------
/gloc_js.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
41 |
42 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/glocide.css:
--------------------------------------------------------------------------------
1 | #sidebar { float: left; width: 17% }
2 |
3 | #glol ul { list-style: none }
4 | #glom ul { list-style: none }
5 |
--------------------------------------------------------------------------------
/sketch/esslpp_me.mly:
--------------------------------------------------------------------------------
1 | source_pbal
2 | : v=source_np+ {
3 | {(fuse_pptok (List.map proj_pptok_type v)) with v}
4 | }
5 | | l=LEFT_PAREN; s=source_pbal*; r=RIGHT_PAREN {
6 | let ch = (Punc l)::(List.rev (Punc r)::(List.rev s)) in
7 | {(fuse_pptok (List.map proj_pptok_type ch))
8 | with v=ch}
9 | }
10 |
11 | fmacro_args
12 | : v=source_ncnp+ {
13 | {(fuse_pptok (List.map proj_pptok_type v)) with v}
14 | }
15 | | l=LEFT_PAREN; s=source_pbal*; r=RIGHT_PAREN {
16 | let ch = (Punc l)::(List.rev (Punc r)::(List.rev s)) in
17 | {(fuse_pptok (List.map proj_pptok_type ch))
18 | with v=ch}
19 | }
20 |
--------------------------------------------------------------------------------
/sketch/eval.ml:
--------------------------------------------------------------------------------
1 | module Eval : SLSymantics = struct
2 | type 'a repr = float
3 |
4 | let float f = f
5 | let (+.) = (+.)
6 |
7 | let run = string_of_float
8 | end
9 |
--------------------------------------------------------------------------------
/sketch/jssl.ml:
--------------------------------------------------------------------------------
1 | open Printf
2 | open Quot
3 | type ('c,'sv,'dv) repr = ('c,'sv,'dv) code
4 |
5 | let bool b = literal (string_of_bool b)
6 | let float f = literal (string_of_float f)
7 |
8 | let lam fn = func fn
9 | let app = function
10 | | `Fn f ->
11 | if f#bound then (fun a -> literal (sprintf "%s(%s)" f#name (v a)))
12 | else f#fn
13 | | `Lit _ -> raise (Type_error "Cannot apply literal")
14 |
15 | let (&&) a b = literal (sprintf "(%s && %s)" (v a) (v b))
16 | let (||) a b = literal (sprintf "(%s || %s)" (v a) (v b))
17 |
18 | let (+:) x y = literal (sprintf "(%s + %s)" (v x) (v y))
19 | let (-:) x y = literal (sprintf "(%s - %s)" (v x) (v y))
20 | let ( *:)x y = literal (sprintf "(%s * %s)" (v x) (v y))
21 | let (/:) x y = literal (sprintf "(%s / %s)" (v x) (v y))
22 |
23 | let sqrt f = literal (sprintf "Math.sqrt(%s)" (v f))
24 |
25 | let leqf x y = literal (sprintf "(%s <= %s)" (v x) (v y))
26 |
27 | let bind name v = v#bind name
28 | let run r = r#string
29 |
--------------------------------------------------------------------------------
/sketch/quot.ml:
--------------------------------------------------------------------------------
1 | exception Unbound_call
2 |
3 | class ['sv,'dv] func f = object
4 | val name : string option = None
5 |
6 | method bound = match name with Some _ -> true | None -> false
7 | method bind name = {< name = Some name >}
8 | method name = match name with
9 | | Some n -> n
10 | | None -> raise Unbound_call
11 | method fn : 'dv = f
12 | end
13 |
14 | class ['t] literal (s : string) = object
15 | method v = s
16 | end
17 |
18 | exception Type_error of string
19 | type ('c,'sv,'dv) code = [ `Fn of ('sv,'dv) func | `Lit of ('dv) literal ]
20 |
21 | let func (f : ('c,'sa,'da) code -> ('c,'sb,'db) code as 'a)
22 | : ('c,'a,'da -> 'db) code
23 | = `Fn (new func f)
24 | let literal s = `Lit (new literal s)
25 |
26 | let v = function
27 | | `Lit l -> l#v
28 | | `Fn _ -> raise (Type_error "Cannot produce value of lambda")
29 |
--------------------------------------------------------------------------------
/sketch/sl.hs:
--------------------------------------------------------------------------------
1 | import Data.Map as Map
2 | import Control.Monad.State
3 |
4 | class SLSymantics repr where
5 | int :: Int -> repr Int
6 | bool :: Bool -> repr Bool
7 | float :: Float -> repr Float
8 | tup2:: (repr a, repr b) -> repr (a, b)
9 | lam :: (repr a -> repr b) -> repr (a -> b)
10 | app :: repr (a -> b) -> repr a -> repr b
11 | fix :: (repr a -> repr a) -> repr a
12 | and :: repr Bool -> repr Bool -> repr Bool
13 | or :: repr Bool -> repr Bool -> repr Bool
14 | add :: repr Int -> repr Int -> repr Int
15 | sub :: repr Int -> repr Int -> repr Int
16 | mul :: repr Int -> repr Int -> repr Int
17 | div :: repr Int -> repr Int -> repr Int
18 | addf:: repr Float -> repr Float -> repr Float
19 | subf:: repr Float -> repr Float -> repr Float
20 | mulf:: repr Float -> repr Float -> repr Float
21 | divf:: repr Float -> repr Float -> repr Float
22 | mod :: repr Int -> repr Int -> repr Int
23 | modf:: repr Float -> repr Float -> repr Float
24 | sqrt_:: repr Float -> repr Float
25 | leq :: repr Int -> repr Int -> repr Bool
26 | leqf:: repr Float -> repr Float -> repr Bool
27 | if_ :: repr Bool -> repr a -> repr a -> repr a
28 |
29 | newtype Bind = Bind { name :: String } deriving (Eq, Ord, Show)
30 |
31 | define f expr = modify $ insert f expr
32 |
33 | csqrt :: SLSymantics repr => State (Map Bind (repr (Float -> (Float, Float)))) ()
34 | csqrt = define (Bind "csqrt") $ lam
35 | (\x -> if_ (leqf (float 0.0) x)
36 | (tup2 (sqrt_ x, float 0.0))
37 | (tup2 (float 0.0, sqrt_ (mulf (float (-1.0)) x))))
38 |
39 | sl :: State (Map Bind (repr a)) () -> Map Bind (repr a)
40 | sl f = execState f empty
41 |
42 | quadroots :: SLSymantics repr => Map Bind (repr (Float -> (Float, Float)))
43 | quadroots = sl $ do csqrt
44 |
45 |
--------------------------------------------------------------------------------
/sketch/sl.ml:
--------------------------------------------------------------------------------
1 | (*class type ga = object
2 | method grade : int
3 | end
4 | *)
5 |
6 | module JS = Jssl
7 |
8 | module type SLSymantics = sig
9 | type ('c,'sv,'dv) repr
10 |
11 | val bool : bool -> ('c,bool,bool) repr
12 | val float : float -> ('c,float,float) repr
13 | (*val ga : ga -> ga repr*)
14 |
15 | val lam : (('c,'sa,'da) repr -> ('c,'sb,'db) repr as 'x)
16 | -> ('c,'x,'da -> 'db) repr
17 | val app : ('c,'x,'da -> 'db) repr
18 | -> (('c,'sa,'da) repr -> ('c,'sb,'db) repr as 'x)
19 |
20 | val (&&) : ('c,bool,bool) repr -> ('c,bool,bool) repr -> ('c,bool,bool) repr
21 | val (||) : ('c,bool,bool) repr -> ('c,bool,bool) repr -> ('c,bool,bool) repr
22 |
23 | val (+:) : ('c,float,float) repr -> ('c,float,float) repr
24 | -> ('c,float,float) repr
25 | val (-:) : ('c,float,float) repr -> ('c,float,float) repr
26 | -> ('c,float,float) repr
27 | val ( *:) : ('c,float,float) repr -> ('c,float,float) repr
28 | -> ('c,float,float) repr
29 | val (/:) : ('c,float,float) repr -> ('c,float,float) repr
30 | -> ('c,float,float) repr
31 |
32 | val sqrt : ('c,float,float) repr -> ('c,float,float) repr
33 |
34 | val leqf : ('c,float,float) repr -> ('c,float,float) repr
35 | -> ('c,bool,bool) repr
36 |
37 | val bind : string -> ('c,'s,'d) repr -> ('c,'s,'d) repr
38 | val run : ('c,'s,'d) repr -> string
39 | end
40 |
41 | let eval m =
42 | let module M = (val m : SLSymantics) in
43 | let open M in
44 | let csqrt a = (float 3.) +: a in
45 | run (csqrt (float 4.))
46 |
47 | ;;
48 | print_endline (eval (module JS : SLSymantics))
49 | ;;
50 | (*print_endline (eval (module GLSL : SLSymantics))
51 | ;;
52 | print_endline (eval (module Eval : SLSymantics))*)
53 |
--------------------------------------------------------------------------------
/src/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | *.annot
3 | _build/
4 |
--------------------------------------------------------------------------------
/src/_tags:
--------------------------------------------------------------------------------
1 | : package(re.str)
2 | : syntax(camlp4o), package(ulex)
3 | : package(atdgen)
4 | : package(ulex), package(atdgen), package(menhirLib), package(re.str), package(unix)
5 | : syntax(camlp4o), package(ulex), package(atdgen), package(menhirLib), package(re.str), package(js_of_ocaml), package(js_of_ocaml.syntax)
6 | : syntax(camlp4o), package(js_of_ocaml), package(js_of_ocaml.syntax)
7 |
8 | : package(atdgen), package(ulex), package(menhirLib), package(re.str)
9 | : package(atdgen), package(re.str)
10 | : package(atdgen), package(re.str)
11 | : syntax(camlp4o), package(js_of_ocaml), package(js_of_ocaml.syntax), package(re.str), package(atdgen), package(ulex), package(menhirLib)
12 | : package(atdgen)
13 | : package(re.str)
14 | : package(atdgen), package(re.str)
15 | : package(re.str), package(ulex), package(menhirLib)
16 | : package(menhirLib)
17 | : package(menhirLib)
18 |
19 | true: use_menhir
20 |
--------------------------------------------------------------------------------
/src/doc.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | gloc links our creativity! carpe ignem!
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/essl.mlypack:
--------------------------------------------------------------------------------
1 | pptok
2 | essl
3 |
--------------------------------------------------------------------------------
/src/esslpp.mlypack:
--------------------------------------------------------------------------------
1 | pptok
2 | esslpp
3 |
--------------------------------------------------------------------------------
/src/esslpp_ce.mlypack:
--------------------------------------------------------------------------------
1 | pptok
2 | esslpp_ce
3 |
--------------------------------------------------------------------------------
/src/glo.atd:
--------------------------------------------------------------------------------
1 | type 'a glo = {
2 | glo:version;
3 | target:(string * version);
4 | ?meta:meta option;
5 | ~units: 'a u list ;
6 | ~linkmap: (string * string) list
7 | }
8 |
9 | type meta = {
10 | copyright:(year * titled_href);
11 | ~author:titled_href list;
12 | ?license:titled_href option;
13 | ?library:titled_href option;
14 | ?version:(version * url) option;
15 | ?build:titled_href option;
16 | }
17 |
18 | type 'a u = {
19 | ~pdir: string list;
20 | ~edir: (string * string) list;
21 | ?vdir: int option;
22 | ~inu:string list;
23 | ~outu:string list;
24 | ~ina:string list;
25 | ~outa:string list;
26 | ~vary:string list;
27 | ~insym:string list;
28 | ~outsym:string list;
29 | ~inmac:string list;
30 | ~opmac:string list;
31 | ~outmac:string list;
32 | ~bmac:string list;
33 | source:'a;
34 | }
35 |
36 | type url = string
37 | type titled_href = (string * url)
38 | type year = int
39 | type version = (int * int * int)
40 | type glom = abstract
41 |
--------------------------------------------------------------------------------
/src/gloc_js.ml:
--------------------------------------------------------------------------------
1 | open Js
2 | open Dom_html
3 |
4 | external reg : string -> ('a -> 'b) -> unit = "register_ocaml_fn"
5 | external stdout : js_string t -> unit = "gloc_stdout"
6 | external stderr : js_string t -> unit = "gloc_stderr"
7 | external stdin : unit -> js_string t = "gloc_stdin"
8 | external fs_read : js_string t -> js_string t = "gloc_fs_read"
9 | external fs_write : js_string t -> js_string t -> unit = "gloc_fs_write"
10 |
11 | module Platform_js = struct
12 | let id = `JS
13 | let get_year () = (jsnew date_now ())##getFullYear ()
14 | let eprint s = stderr (string s)
15 | let out_of_filename fn fdf =
16 | let b = Buffer.create 1024 in
17 | let r = fdf b in
18 | (if fn="-" then stdout else fs_write (string fn))
19 | (string (Buffer.contents b));
20 | r
21 | let in_of_filename fn fdf = fdf (to_string (fs_read (string fn)))
22 | end
23 |
24 | module Gloc_js = Gloc.Make(Platform_js)
25 | open Gloc_js
26 |
27 | let gloc args =
28 | let args = Array.map to_string (to_array args) in
29 | let args = Array.of_list ("gloc"::(Array.to_list args)) in
30 | let exec_state = Gloc_lib.new_exec_state (Gloc_js.default_meta) in
31 | let (specs, anon) = arg_of_cli exec_state Gloc.cli in
32 | let () = Arg.parse_argv ~current:(ref 0) args specs anon Gloc.usage_msg in
33 | begin try gloc exec_state (fun () -> to_string (stdin ())) with
34 | | Gloc.Exit c -> ()
35 | | Gloc_lib.CompilerError(_,el) -> (* TODO: FIXME *)
36 | Platform_js.eprint "CompilerError:\n";
37 | List.iter (fun exn -> Platform_js.eprint ((Printexc.to_string exn)^"\n")) el
38 | | e -> Platform_js.eprint (Printexc.to_string e)
39 | end (* FIXME *)
40 | ;;
41 | reg "gloc" gloc
42 |
--------------------------------------------------------------------------------
/src/gloc_posix.ml:
--------------------------------------------------------------------------------
1 | module Gloc_posix = Gloc.Make(Platform_posix)
2 | open Gloc_posix
3 | ;;
4 |
5 | let meta = Gloc_posix.default_meta in
6 | let exec_state = Gloc_lib.new_exec_state meta in
7 | let (args, anon) = arg_of_cli exec_state Gloc.cli in
8 | let () = Arg.parse args anon Gloc.usage_msg in
9 | begin try gloc exec_state (fun () -> Platform_posix.string_of_inchan stdin)
10 | with Gloc.Exit code -> exit code
11 | end
12 |
--------------------------------------------------------------------------------
/src/language.ml:
--------------------------------------------------------------------------------
1 | (* Copyright (c) 2012 Ashima Arts. All rights reserved.
2 | * Author: David Sheets
3 | * Use of this source code is governed by a BSD-style license that can be
4 | * found in the LICENSE file.
5 | *)
6 |
7 | type dialect = WebGL
8 | type version = int * int * int
9 | type accuracy = Best | Preprocess (*| Decomment | Minify | Pretty | Obfuscate *)
10 | type bond = Error | Warn | Ignore
11 | type language = {dialect:dialect;
12 | version:version;
13 | bond:bond;
14 | }
15 |
16 | let accuracy_of_string = function
17 | | "best" -> Best
18 | | "preprocess" -> Preprocess
19 | | _ -> Best
20 | let string_of_dialect = function
21 | | WebGL -> "webgl"
22 |
23 | let with_bond bond = fun lang -> { lang with bond }
24 | let with_dialect = function
25 | | "webgl" -> (fun lang -> { lang with dialect=WebGL })
26 | | _ -> (fun lang -> lang)
27 |
28 | let target_of_language ({dialect; version}) =
29 | (string_of_dialect dialect, version)
30 |
--------------------------------------------------------------------------------
/src/libgloc.c:
--------------------------------------------------------------------------------
1 | // Stubs for browser-provided functions to generate linkable bytecode
2 | #include
3 | #define D(f) void f () { exit(1); }
4 |
5 | D(register_ocaml_fn)
6 |
7 | D(gloc_stdout)
8 | D(gloc_stderr)
9 | D(gloc_stdin)
10 | D(gloc_fs_read)
11 | D(gloc_fs_write)
12 |
--------------------------------------------------------------------------------
/src/mymyocamlbuild.ml:
--------------------------------------------------------------------------------
1 | open Ocamlbuild_plugin
2 | open Command
3 | ;;
4 |
5 | let atdgen t env builder =
6 | Cmd(S[A"atdgen";A("-j-std");A("-"^t);A(env "%.atd")])
7 | ;;
8 | rule "atd: atd -> _t.ml & _t.mli"
9 | ~prods:["%_t.mli"; "%_t.ml"]
10 | ~dep:"%.atd"
11 | (atdgen "t")
12 | ;;
13 | rule "atd: atd -> _v.ml & _v.mli"
14 | ~prods:["%_v.mli"; "%_v.ml"]
15 | ~dep:"%.atd"
16 | (atdgen "v")
17 | ;;
18 | rule "atd: atd -> _j.ml & _j.mli"
19 | ~prods:["%_j.mli"; "%_j.ml"]
20 | ~dep:"%.atd"
21 | (atdgen "j")
22 | ;;
23 | let _ = dispatch begin function
24 | | Before_rules ->
25 | rule "c stubs"
26 | ~prod:"%.o"
27 | ~dep:"%.c"
28 | begin fun env build ->
29 | let o = env "%.o" and c = env "%.c" in
30 | Cmd(S[A"gcc";A"-c";A"-o";P o;P c])
31 | end
32 | | After_rules ->
33 | rule "js_of_ocaml.d"
34 | ~prod:"%.d.js"
35 | ~dep:"%.d.byte"
36 | begin fun env build ->
37 | let byte = env "%.d.byte" in
38 | Cmd(S[A"js_of_ocaml";A"-pretty";A"-noinline";P byte])
39 | end;
40 | rule "js_of_ocaml"
41 | ~prod:"%.js"
42 | ~dep:"%.byte"
43 | begin fun env build ->
44 | let byte = env "%.byte" in
45 | Cmd(S[A"js_of_ocaml";P byte])
46 | end;
47 | flag ["ocaml"; "byte"; "link"] (S[A"-custom"]);
48 | dep ["ocaml"; "link"] ["libgloc.o"]
49 | | _ -> ()
50 | end
51 |
--------------------------------------------------------------------------------
/src/myocamlbuild.ml:
--------------------------------------------------------------------------------
1 | open Ocamlbuild_plugin
2 | open Command
3 | ;;
4 |
5 | let atdgen t env builder =
6 | Cmd(S[A"atdgen";A("-j-std");A("-"^t);A(env "%.atd")])
7 | ;;
8 | rule "atd: atd -> _t.ml & _t.mli"
9 | ~prods:["%_t.mli"; "%_t.ml"]
10 | ~dep:"%.atd"
11 | (atdgen "t")
12 | ;;
13 | rule "atd: atd -> _v.ml & _v.mli"
14 | ~prods:["%_v.mli"; "%_v.ml"]
15 | ~dep:"%.atd"
16 | (atdgen "v")
17 | ;;
18 | rule "atd: atd -> _j.ml & _j.mli"
19 | ~prods:["%_j.mli"; "%_j.ml"]
20 | ~dep:"%.atd"
21 | (atdgen "j")
22 | ;;
23 | let _ = dispatch begin function
24 | | Before_rules ->
25 | rule "c stubs"
26 | ~prod:"%.o"
27 | ~dep:"%.c"
28 | begin fun env build ->
29 | let o = env "%.o" and c = env "%.c" in
30 | Cmd(S[A"gcc";A"-c";A"-o";P o;P c])
31 | end
32 | | After_rules ->
33 | rule "js_of_ocaml.d"
34 | ~prod:"%.d.js"
35 | ~dep:"%.d.byte"
36 | begin fun env build ->
37 | let byte = env "%.d.byte" in
38 | Cmd(S[A"js_of_ocaml";A"-pretty";A"-noinline";P byte])
39 | end;
40 | rule "js_of_ocaml"
41 | ~prod:"%.js"
42 | ~dep:"%.byte"
43 | begin fun env build ->
44 | let byte = env "%.byte" in
45 | Cmd(S[A"js_of_ocaml";P byte])
46 | end;
47 | flag ["ocaml"; "byte"; "link"] (S[A"-custom"]);
48 | dep ["ocaml"; "link"] ["libgloc.o"]
49 | | _ -> ()
50 | end
51 |
--------------------------------------------------------------------------------
/src/platform_posix.ml:
--------------------------------------------------------------------------------
1 | let id = `POSIX
2 | let get_year () = (Unix.gmtime (Unix.time())).Unix.tm_year + 1900
3 | let eprint = prerr_string
4 |
5 | let string_of_inchan inchan =
6 | let s = String.create 1024 in
7 | let b = Buffer.create 1024 in
8 | let rec consume pos =
9 | let k = input inchan s 0 1024 in
10 | if k=0 then Buffer.contents b
11 | else begin Buffer.add_substring b s 0 k; consume (pos+k) end
12 | in consume 0
13 |
14 | let out_of_filename fn fdf =
15 | let b = Buffer.create 1024 in
16 | let r = fdf b in
17 | let fd = if fn="-" then stdout else open_out fn in
18 | Buffer.output_buffer fd b;
19 | close_out fd;
20 | r
21 |
22 | let in_of_filename fn fdf =
23 | let fd = if fn="-" then stdin else open_in fn in
24 | let s = string_of_inchan fd in
25 | close_in fd;
26 | fdf s
27 |
--------------------------------------------------------------------------------
/src/pptok.mly:
--------------------------------------------------------------------------------
1 | %%
2 |
3 | %public fuse_sep_list(LEFT,X,sep,RIGHT)
4 | : l=LEFT; xs = option(fuse_sep_nonempty_list(X,sep)); r=RIGHT
5 | { match xs with
6 | | None -> {(fuse_pptok [proj l; proj r]) with v=[]}
7 | | Some xs -> {(fuse_pptok [proj l; proj xs; proj r])
8 | with v=xs.v}
9 | }
10 |
11 | %public fuse_sep_nonempty_list(X,sep)
12 | : x=X { { x with v=[x] } }
13 | | x=X; s=sep; xs=fuse_sep_nonempty_list(X,sep) {
14 | {(fuse_pptok [proj x; proj s; proj xs]) with v=(x::xs.v)}
15 | }
16 |
17 | %public fuse_sep_slexpr_list(LEFT,X,sep,RIGHT)
18 | : l=LEFT; xs = option(fuse_sep_slexpr_nonempty_list(X,sep)); r=RIGHT
19 | { match xs with
20 | | None -> {(fuse_pptok [proj l; proj r]) with v=[]}
21 | | Some xs -> {(fuse_pptok [proj l; proj xs; proj r])
22 | with v=xs.v}
23 | }
24 |
25 | %public fuse_sep_slexpr_nonempty_list(X,sep)
26 | : x=X { { (proj_slexpr x) with v=[x] } }
27 | | x=X; s=sep; xs=fuse_sep_slexpr_nonempty_list(X,sep) {
28 | {(fuse_pptok [proj_slexpr x; proj s; proj xs]) with v=(x::xs.v)}
29 | }
30 |
--------------------------------------------------------------------------------
/src/punc.ml:
--------------------------------------------------------------------------------
1 | (* Copyright (c) 2011 Ashima Arts. All rights reserved.
2 | * Author: David Sheets
3 | * Use of this source code is governed by a BSD-style license that can be
4 | * found in the LICENSE file.
5 | *)
6 |
7 | type tok =
8 | LEFT_OP | RIGHT_OP | INC_OP | DEC_OP | LE_OP | GE_OP | EQ_OP | NE_OP
9 | | AND_OP | OR_OP | XOR_OP | MUL_ASSIGN | DIV_ASSIGN | ADD_ASSIGN | MOD_ASSIGN
10 | | LEFT_ASSIGN | RIGHT_ASSIGN | AND_ASSIGN | XOR_ASSIGN | OR_ASSIGN
11 | | SUB_ASSIGN | LEFT_PAREN | RIGHT_PAREN | LEFT_BRACKET | RIGHT_BRACKET
12 | | LEFT_BRACE | RIGHT_BRACE | DOT | COMMA | COLON | EQUAL | SEMICOLON | BANG
13 | | DASH | TILDE | PLUS | STAR | SLASH | PERCENT | LEFT_ANGLE | RIGHT_ANGLE
14 | | VERTICAL_BAR | CARET | AMPERSAND | QUESTION
15 |
--------------------------------------------------------------------------------
/test/Makefile:
--------------------------------------------------------------------------------
1 | DIRS := $(shell ls -l | grep '^d' | awk '{printf "%s.dir\n",$$9 }' )
2 |
3 | %.dir :
4 | cd $*; $(MAKE)
5 |
6 | .PHONY : all test
7 | all :
8 | @$(MAKE) test
9 | test : $(DIRS)
10 |
--------------------------------------------------------------------------------
/test/webgl/Makefile:
--------------------------------------------------------------------------------
1 | DIRS := $(shell ls -l | grep '^d' | awk '{printf "%s.dir\n",$$9 }' )
2 |
3 | %.dir :
4 | cd $*; $(MAKE)
5 |
6 | .PHONY : all test
7 | all :
8 | @$(MAKE) test
9 | test : $(DIRS)
10 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/.gitignore:
--------------------------------------------------------------------------------
1 | *.diff
2 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/Makefile:
--------------------------------------------------------------------------------
1 | PP = OCAMLRUNPARAM=b ../../../src/gloc.d.byte -c -v --dissolve
2 |
3 | INS := $(wildcard *.in)
4 | OUTS := $(INS:.in=.out)
5 |
6 | %.out : %.in %.true
7 | @$(PP) < $*.in &> $@ || true
8 | @if diff -u $*.true $@ > $*.diff; then \
9 | rm $*.diff;\
10 | else cat $*.diff;\
11 | fi
12 |
13 | .PHONY : all test clean
14 | all :
15 | @$(MAKE) clean
16 | @$(MAKE) test
17 | test : $(OUTS)
18 | @printf "Test failures: "
19 | @ls *.diff 2> /dev/null | wc -l
20 | clean :
21 | @rm *.out *.diff 2> /dev/null || true
22 | %.git : %.in %.out %.true
23 | git add $^
24 | %.new :
25 | touch $*.in
26 | echo "error" > $*.true
27 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/essl.in:
--------------------------------------------------------------------------------
1 | // Copyright 2012 Madness Inc. Eat @ Joe's
2 | int a;
3 | float b;
4 |
5 | void foo();
6 | void bar();
7 |
8 | void main() { b; }
9 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/essl.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": {
5 | "copyright": [ 2012, [ "Madness Inc.", "http://www.example.com/" ] ]
6 | },
7 | "units": [
8 | { "outsym": [ "a" ], "source": "#line 2 GLOC_0\nint a;" },
9 | { "outsym": [ "b" ], "source": "#line 3 GLOC_0\nfloat b;" },
10 | { "insym": [ "foo" ], "source": "#line 5 GLOC_0\nvoid foo();" },
11 | { "insym": [ "bar" ], "source": "#line 6 GLOC_0\nvoid bar();" },
12 | {
13 | "insym": [ "b" ],
14 | "outsym": [ "main" ],
15 | "source": "#line 8 GLOC_0\nvoid main() { b; }"
16 | }
17 | ],
18 | "linkmap": { "0": "#n=0" }
19 | }
20 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/essl.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": {
5 | "copyright": [ 2012, [ "Madness Inc.", "http://www.example.com/" ] ]
6 | },
7 | "units": [
8 | { "outsym": [ "a" ], "source": "#line 2 GLOC_0\nint a;" },
9 | { "outsym": [ "b" ], "source": "#line 3 GLOC_0\nfloat b;" },
10 | { "insym": [ "foo" ], "source": "#line 5 GLOC_0\nvoid foo();" },
11 | { "insym": [ "bar" ], "source": "#line 6 GLOC_0\nvoid bar();" },
12 | {
13 | "insym": [ "b" ],
14 | "outsym": [ "main" ],
15 | "source": "#line 8 GLOC_0\nvoid main() { b; }"
16 | }
17 | ],
18 | "linkmap": { "0": "#n=0" }
19 | }
20 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/funfun.in:
--------------------------------------------------------------------------------
1 | float h(struct k { int q; } arg);
2 | float j(struct n { int b; } arg) { return 0.2; }
3 |
4 | struct s { int q; } f(const in int a, inout int b, out float c);
5 |
6 | struct s2 { int q; } g(const in int a, inout int b, out float c) {
7 | return s2(a);
8 | }
9 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/funfun.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "h" ],
8 | "source": "#line 1 GLOC_0\nfloat h(struct k { int q; } arg);"
9 | },
10 | {
11 | "outsym": [ "j" ],
12 | "source":
13 | "#line 2 GLOC_0\nfloat j(struct n { int b; } arg) { return 0.2; }"
14 | },
15 | { "outsym": [ "s" ], "source": "#line 4 GLOC_0\nstruct s { int q; };" },
16 | {
17 | "insym": [ "s", "f" ],
18 | "source":
19 | "#line 4 GLOC_0\ns f(const in int a, inout int b, out float c);"
20 | },
21 | { "outsym": [ "s2" ], "source": "#line 6 GLOC_0\nstruct s2 { int q; };" },
22 | {
23 | "insym": [ "s2" ],
24 | "outsym": [ "g" ],
25 | "source":
26 | "#line 6 GLOC_0\ns2 g(const in int a, inout int b, out float c) {\n return s2(a);\n}"
27 | }
28 | ],
29 | "linkmap": { "0": "#n=0" }
30 | }
31 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/funfun.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "h" ],
8 | "source": "#line 1 GLOC_0\nfloat h(struct k { int q; } arg);"
9 | },
10 | {
11 | "outsym": [ "j" ],
12 | "source":
13 | "#line 2 GLOC_0\nfloat j(struct n { int b; } arg) { return 0.2; }"
14 | },
15 | { "outsym": [ "s" ], "source": "#line 4 GLOC_0\nstruct s { int q; };" },
16 | {
17 | "insym": [ "s", "f" ],
18 | "source":
19 | "#line 4 GLOC_0\ns f(const in int a, inout int b, out float c);"
20 | },
21 | { "outsym": [ "s2" ], "source": "#line 6 GLOC_0\nstruct s2 { int q; };" },
22 | {
23 | "insym": [ "s2" ],
24 | "outsym": [ "g" ],
25 | "source":
26 | "#line 6 GLOC_0\ns2 g(const in int a, inout int b, out float c) {\n return s2(a);\n}"
27 | }
28 | ],
29 | "linkmap": { "0": "#n=0" }
30 | }
31 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/line.in:
--------------------------------------------------------------------------------
1 | // Copyright 2012 Foo Blah.
2 | #line 2 0 // #n=module_a
3 | #define DBL(t) \
4 | t dbl(t a) { return a*2; }
5 | DBL(float)
6 | DBL(vec2)
7 | DBL(vec3)
8 | DBL(vec4)
9 |
10 | // Copyright 2012 Bar Baz.
11 | #line 9 1 // #n=module_b
12 | #define AVG(t) \
13 | t avg(t a, t b) { return (a+b)/2.0; }
14 | AVG(float)
15 | AVG(vec2)
16 | AVG(vec3)
17 | AVG(vec4)
18 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/line.out:
--------------------------------------------------------------------------------
1 | [
2 | [
3 | "[stdin]",
4 | {
5 | "glo": [ 1, 0, 0 ],
6 | "target": [ "webgl", [ 1, 0, 0 ] ],
7 | "meta": { "copyright": [ 2012, [ "Foo", "http://www.example.com/" ] ] },
8 | "units": [
9 | {
10 | "outmac": [ "DBL" ],
11 | "source":
12 | "#line 2 GLOC_0\n#define DBL(t)/*\\\n*/ t dbl( t a ) { return a * 2 ; }"
13 | },
14 | {
15 | "outsym": [ "dbl" ],
16 | "inmac": [ "DBL" ],
17 | "source":
18 | "#line 4 GLOC_0\nDBL(float)\nDBL(vec2)\nDBL(vec3)\nDBL(vec4)"
19 | }
20 | ],
21 | "linkmap": { "0": "#n=0" }
22 | }
23 | ],
24 | [
25 | "[stdin]",
26 | {
27 | "glo": [ 1, 0, 0 ],
28 | "target": [ "webgl", [ 1, 0, 0 ] ],
29 | "meta": { "copyright": [ 2012, [ "Bar", "http://www.example.net/" ] ] },
30 | "units": [
31 | {
32 | "outmac": [ "AVG" ],
33 | "source":
34 | "#line 9 GLOC_1\n#define AVG(t)/*\\\n*/ t avg( t a , t b ) { return ( a + b ) / 2.0 ; }"
35 | },
36 | {
37 | "outsym": [ "avg" ],
38 | "inmac": [ "AVG" ],
39 | "source":
40 | "#line 11 GLOC_1\nAVG(float)\nAVG(vec2)\nAVG(vec3)\nAVG(vec4)"
41 | }
42 | ],
43 | "linkmap": { "0": "#n=0", "1": "#n=module_b" }
44 | }
45 | ]
46 | ]
47 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/line.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/macros.in:
--------------------------------------------------------------------------------
1 | #define Q 1
2 | #define W 2
3 |
4 | #if Q < W+Z
5 | #define J 3
6 | void foo();
7 | void baz() { }
8 | #endif
9 |
10 | #if 1
11 | const int j = J;
12 | #endif
13 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/macros.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | { "outmac": [ "Q" ], "source": "#line 1 GLOC_0\n#define Q 1" },
7 | { "outmac": [ "W" ], "source": "#line 2 GLOC_0\n#define W 2" },
8 | {
9 | "insym": [ "foo" ],
10 | "outsym": [ "baz" ],
11 | "inmac": [ "Z", "W", "Q" ],
12 | "outmac": [ "J" ],
13 | "source":
14 | "#line 4 GLOC_0\n#if Q < W+Z\n#define J 3\nvoid foo();\nvoid baz() { }\n#endif"
15 | },
16 | {
17 | "insym": [ "J" ],
18 | "outsym": [ "j" ],
19 | "source": "#line 10 GLOC_0\n#if 1\nconst int j = J;\n#endif"
20 | }
21 | ],
22 | "linkmap": { "0": "#n=0" }
23 | }
24 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/macros.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | { "outmac": [ "Q" ], "source": "#line 1 GLOC_0\n#define Q 1" },
7 | { "outmac": [ "W" ], "source": "#line 2 GLOC_0\n#define W 2" },
8 | {
9 | "insym": [ "foo" ],
10 | "outsym": [ "baz" ],
11 | "inmac": [ "Z", "W", "Q" ],
12 | "outmac": [ "J" ],
13 | "source":
14 | "#line 4 GLOC_0\n#if Q < W+Z\n#define J 3\nvoid foo();\nvoid baz() { }\n#endif"
15 | },
16 | {
17 | "insym": [ "J" ],
18 | "outsym": [ "j" ],
19 | "source": "#line 10 GLOC_0\n#if 1\nconst int j = J;\n#endif"
20 | }
21 | ],
22 | "linkmap": { "0": "#n=0" }
23 | }
24 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/meta.in:
--------------------------------------------------------------------------------
1 | // Copyright 2012 Foo Corp Imaginary property preserved.
2 | // Author: Fiddlesticks McMonocle
3 | // Author: Gladhands Krishnamurthy
4 | // License: BSD-3-Clause
5 |
6 | void vert_main() {
7 |
8 | }
9 |
10 | void frag_main() {
11 |
12 | }
13 | // End: Copyright
14 | #line 15 0
15 | void funq(void) { h = 2; }
16 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/meta.out:
--------------------------------------------------------------------------------
1 | [
2 | [
3 | "[stdin]",
4 | {
5 | "glo": [ 1, 0, 0 ],
6 | "target": [ "webgl", [ 1, 0, 0 ] ],
7 | "meta": {
8 | "copyright": [ 2012, [ "Foo Corp", "http://www.example.com/" ] ],
9 | "author": [
10 | [ "Fiddlesticks McMonocle", "http://example.com/~mcmonocle/" ],
11 | [ "Gladhands Krishnamurthy", "" ]
12 | ],
13 | "license": [ "BSD-3-Clause", "" ]
14 | },
15 | "units": [
16 | {
17 | "outsym": [ "vert_main" ],
18 | "source": "#line 6 GLOC_0\nvoid vert_main() {\n\n}"
19 | },
20 | {
21 | "outsym": [ "frag_main" ],
22 | "source": "#line 10 GLOC_0\nvoid frag_main() {\n\n}"
23 | }
24 | ],
25 | "linkmap": { "0": "#n=0" }
26 | }
27 | ],
28 | [
29 | "[stdin]",
30 | {
31 | "glo": [ 1, 0, 0 ],
32 | "target": [ "webgl", [ 1, 0, 0 ] ],
33 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
34 | "units": [
35 | {
36 | "insym": [ "h" ],
37 | "outsym": [ "funq" ],
38 | "source":
39 | "#line 15 GLOC_0\n void funq ( void ) { h = 2 ; }"
40 | }
41 | ],
42 | "linkmap": { "0": "#n=0" }
43 | }
44 | ]
45 | ]
46 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/meta.true:
--------------------------------------------------------------------------------
1 | [
2 | [
3 | "[stdin]",
4 | {
5 | "glo": [ 1, 0, 0 ],
6 | "target": [ "webgl", [ 1, 0, 0 ] ],
7 | "meta": {
8 | "copyright": [ 2012, [ "Foo Corp", "http://www.example.com/" ] ],
9 | "author": [
10 | [ "Fiddlesticks McMonocle", "http://example.com/~mcmonocle/" ],
11 | [ "Gladhands Krishnamurthy", "" ]
12 | ],
13 | "license": [ "BSD-3-Clause", "" ]
14 | },
15 | "units": [
16 | {
17 | "outsym": [ "vert_main" ],
18 | "source": "#line 6 GLOC_0\nvoid vert_main() {\n\n}"
19 | },
20 | {
21 | "outsym": [ "frag_main" ],
22 | "source": "#line 10 GLOC_0\nvoid frag_main() {\n\n}"
23 | }
24 | ],
25 | "linkmap": { "0": "#n=0" }
26 | }
27 | ],
28 | [
29 | "[stdin]",
30 | {
31 | "glo": [ 1, 0, 0 ],
32 | "target": [ "webgl", [ 1, 0, 0 ] ],
33 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
34 | "units": [
35 | {
36 | "insym": [ "h" ],
37 | "outsym": [ "funq" ],
38 | "source": "#line 15 GLOC_0\nvoid funq(void) { h = 2; }"
39 | }
40 | ],
41 | "linkmap": { "0": "#n=0" }
42 | }
43 | ]
44 | ]
45 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/multidecl.in:
--------------------------------------------------------------------------------
1 | uniform struct s { int q; } a, b, c;
2 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/multidecl.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "s" ],
8 | "source": "#line 1 GLOC_0\n struct s { int q; };"
9 | },
10 | {
11 | "inu": [ "a" ],
12 | "insym": [ "s" ],
13 | "outsym": [ "a" ],
14 | "source": "#line 1 GLOC_0\nuniform s a;"
15 | },
16 | {
17 | "inu": [ "b" ],
18 | "insym": [ "s" ],
19 | "outsym": [ "b" ],
20 | "source": "#line 1 GLOC_0\nuniform s b;"
21 | },
22 | {
23 | "inu": [ "c" ],
24 | "insym": [ "s" ],
25 | "outsym": [ "c" ],
26 | "source": "#line 1 GLOC_0\nuniform s c;"
27 | }
28 | ],
29 | "linkmap": { "0": "#n=0" }
30 | }
31 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/multidecl.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "s" ],
8 | "source": "#line 1 GLOC_0\n struct s { int q; };"
9 | },
10 | {
11 | "inu": [ "a" ],
12 | "insym": [ "s" ],
13 | "outsym": [ "a" ],
14 | "source": "#line 1 GLOC_0\nuniform s a;"
15 | },
16 | {
17 | "inu": [ "b" ],
18 | "insym": [ "s" ],
19 | "outsym": [ "b" ],
20 | "source": "#line 1 GLOC_0\nuniform s b;"
21 | },
22 | {
23 | "inu": [ "c" ],
24 | "insym": [ "s" ],
25 | "outsym": [ "c" ],
26 | "source": "#line 1 GLOC_0\nuniform s c;"
27 | }
28 | ],
29 | "linkmap": { "0": "#n=0" }
30 | }
31 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/nested_struct.in:
--------------------------------------------------------------------------------
1 | struct s { float q; };
2 |
3 | struct h { s g; s b; } f(void) { return h(s(1.0),s(0.0)); }
4 |
5 | invariant varying struct n { h d; } vvv;
6 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/nested_struct.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | { "outsym": [ "s" ], "source": "#line 1 GLOC_0\nstruct s { float q; };" },
7 | {
8 | "insym": [ "s" ],
9 | "outsym": [ "h" ],
10 | "source": "#line 3 GLOC_0\nstruct h { s g; s b; };"
11 | },
12 | {
13 | "insym": [ "h", "s" ],
14 | "outsym": [ "f" ],
15 | "source":
16 | "#line 3 GLOC_0\nh f(void) { return h(s(1.0),s(0.0)); }"
17 | },
18 | {
19 | "insym": [ "h" ],
20 | "outsym": [ "n" ],
21 | "source": "#line 5 GLOC_0\n struct n { h d; };"
22 | },
23 | {
24 | "vary": [ "vvv" ],
25 | "insym": [ "n" ],
26 | "outsym": [ "vvv" ],
27 | "source": "#line 5 GLOC_0\ninvariant varying n vvv;"
28 | }
29 | ],
30 | "linkmap": { "0": "#n=0" }
31 | }
32 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/nested_struct.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | { "outsym": [ "s" ], "source": "#line 1 GLOC_0\nstruct s { float q; };" },
7 | {
8 | "insym": [ "s" ],
9 | "outsym": [ "h" ],
10 | "source": "#line 3 GLOC_0\nstruct h { s g; s b; };"
11 | },
12 | {
13 | "insym": [ "h", "s" ],
14 | "outsym": [ "f" ],
15 | "source":
16 | "#line 3 GLOC_0\nh f(void) { return h(s(1.0),s(0.0)); }"
17 | },
18 | {
19 | "insym": [ "h" ],
20 | "outsym": [ "n" ],
21 | "source": "#line 5 GLOC_0\n struct n { h d; };"
22 | },
23 | {
24 | "vary": [ "vvv" ],
25 | "insym": [ "n" ],
26 | "outsym": [ "vvv" ],
27 | "source": "#line 5 GLOC_0\ninvariant varying n vvv;"
28 | }
29 | ],
30 | "linkmap": { "0": "#n=0" }
31 | }
32 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/newtype.in:
--------------------------------------------------------------------------------
1 | struct k { float j; };
2 | struct s { int f; } q;
3 | s h;
4 | struct { struct { int f; } a; } j;
5 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/newtype.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | { "outsym": [ "k" ], "source": "#line 1 GLOC_0\nstruct k { float j; };" },
7 | { "outsym": [ "s" ], "source": "#line 2 GLOC_0\nstruct s { int f; };" },
8 | {
9 | "insym": [ "s" ],
10 | "outsym": [ "q" ],
11 | "source": "#line 2 GLOC_0\ns q;"
12 | },
13 | { "insym": [ "s" ], "outsym": [ "h" ], "source": "#line 3 GLOC_0\ns h;" },
14 | {
15 | "outsym": [ "j" ],
16 | "source": "#line 4 GLOC_0\nstruct { struct { int f; } a; } j;"
17 | }
18 | ],
19 | "linkmap": { "0": "#n=0" }
20 | }
21 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/newtype.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | { "outsym": [ "k" ], "source": "#line 1 GLOC_0\nstruct k { float j; };" },
7 | { "outsym": [ "s" ], "source": "#line 2 GLOC_0\nstruct s { int f; };" },
8 | {
9 | "insym": [ "s" ],
10 | "outsym": [ "q" ],
11 | "source": "#line 2 GLOC_0\ns q;"
12 | },
13 | { "insym": [ "s" ], "outsym": [ "h" ], "source": "#line 3 GLOC_0\ns h;" },
14 | {
15 | "outsym": [ "j" ],
16 | "source": "#line 4 GLOC_0\nstruct { struct { int f; } a; } j;"
17 | }
18 | ],
19 | "linkmap": { "0": "#n=0" }
20 | }
21 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/overload.in:
--------------------------------------------------------------------------------
1 | float euclidean(float k) { return k; }
2 | float euclidean(vec2 v) { return sqrt(v.x*v.x+v.y*v.y); }
3 | float euclidean(vec3 v) { return sqrt(v.x*v.x+v.y*v.y+v.z*v.z); }
4 | float euclidean(vec4 v) { return sqrt(v.x*v.x+v.y*v.y+v.z*v.z+v.w*v.w); }
5 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/overload.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "euclidean" ],
8 | "source":
9 | "#line 1 GLOC_0\nfloat euclidean(float k) { return k; }\nfloat euclidean(vec2 v) { return sqrt(v.x*v.x+v.y*v.y); }\nfloat euclidean(vec3 v) { return sqrt(v.x*v.x+v.y*v.y+v.z*v.z); }\nfloat euclidean(vec4 v) { return sqrt(v.x*v.x+v.y*v.y+v.z*v.z+v.w*v.w); }"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/overload.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "euclidean" ],
8 | "source":
9 | "#line 1 GLOC_0\nfloat euclidean(float k) { return k; }\nfloat euclidean(vec2 v) { return sqrt(v.x*v.x+v.y*v.y); }\nfloat euclidean(vec3 v) { return sqrt(v.x*v.x+v.y*v.y+v.z*v.z); }\nfloat euclidean(vec4 v) { return sqrt(v.x*v.x+v.y*v.y+v.z*v.z+v.w*v.w); }"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/overload_interleave.in:
--------------------------------------------------------------------------------
1 | precision highp float;
2 |
3 | float fst(vec2 v) { return v.x; }
4 | float snd(vec2 v) { return v.y; }
5 | float fst(vec3 v) { return v.x; }
6 | float snd(vec3 v) { return v.y; }
7 |
8 | bool is_even_dim(float) { return false; }
9 | bool is_odd_dim(float) { return true; }
10 | bool is_even_dim(vec2 v) { return is_odd_dim(v.x); }
11 | bool is_odd_dim(vec2 v) { return is_even_dim(v.x); }
12 | bool is_even_dim(vec3 v) { return is_odd_dim(v.xy); }
13 | bool is_odd_dim(vec3 v) { return is_even_dim(v.xy); }
14 |
15 | void main() {}
16 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/overload_interleave.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "fst" ],
8 | "source":
9 | "#line 3 GLOC_0\nfloat fst(vec2 v) { return v.x; }\n\nfloat fst(vec3 v) { return v.x; }"
10 | },
11 | {
12 | "outsym": [ "snd" ],
13 | "source":
14 | "#line 4 GLOC_0\nfloat snd(vec2 v) { return v.y; }\n\nfloat snd(vec3 v) { return v.y; }"
15 | },
16 | {
17 | "insym": [ "is_odd_dim" ],
18 | "outsym": [ "is_even_dim" ],
19 | "source":
20 | "#line 8 GLOC_0\nbool is_even_dim(float) { return false; }\n\nbool is_even_dim(vec2 v) { return is_odd_dim(v.x); }\n\nbool is_even_dim(vec3 v) { return is_odd_dim(v.xy); }"
21 | },
22 | {
23 | "insym": [ "is_even_dim" ],
24 | "outsym": [ "is_odd_dim" ],
25 | "source":
26 | "#line 9 GLOC_0\nbool is_odd_dim(float) { return true; }\n\nbool is_odd_dim(vec2 v) { return is_even_dim(v.x); }\n\nbool is_odd_dim(vec3 v) { return is_even_dim(v.xy); }"
27 | },
28 | { "outsym": [ "main" ], "source": "#line 15 GLOC_0\nvoid main() {}" }
29 | ],
30 | "linkmap": { "0": "#n=0" }
31 | }
32 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/overload_interleave.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/pp_interleave.in:
--------------------------------------------------------------------------------
1 | void main() {
2 | #if Z
3 | gl_Position = vec4(Z);
4 | #else
5 | gl_Position = vec4(1.);
6 | #endif
7 | }
8 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/pp_interleave.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 12 - 13:
2 | ESSL parse error: '{'
3 |
4 | Fatal: unrecoverable parse error (7)
5 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/pp_interleave.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/roundtrip_span.in:
--------------------------------------------------------------------------------
1 | // Copyright 2012 Foo Corp <> All Rights Reversed.
2 | // Version: 0.0.1
3 | // Author: A
4 | // Author: B
5 | // Author: C
6 | // Build: r4929f
7 |
8 | void f(void);
9 |
10 | //End: Copyright
11 |
12 | void j(void);
13 |
14 | // Copyright 2012 Bar Corp <> Something
15 | // Version: 0.1.0
16 | // License: BSD-3-Clause
17 | // Library: Magic Box
18 | #line 1 1
19 | void main() {
20 | gl_Position = vec4(1.);
21 | }
22 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/roundtrip_span.out:
--------------------------------------------------------------------------------
1 | [
2 | [
3 | "[stdin]",
4 | {
5 | "glo": [ 1, 0, 0 ],
6 | "target": [ "webgl", [ 1, 0, 0 ] ],
7 | "meta": {
8 | "copyright": [ 2012, [ "Foo Corp", "" ] ],
9 | "author": [ [ "A", "" ], [ "B", "" ], [ "C", "" ] ],
10 | "version": [ [ 0, 0, 1 ], "" ],
11 | "build": [ "r4929f", "http://www.example.com/" ]
12 | },
13 | "units": [
14 | {
15 | "insym": [ "f" ],
16 | "source": "#line 8 GLOC_0\n void f ( void ) ;"
17 | },
18 | {
19 | "insym": [ "j" ],
20 | "source": "#line 12 GLOC_0\n void j ( void ) ;"
21 | }
22 | ],
23 | "linkmap": { "0": "#n=0" }
24 | }
25 | ],
26 | [
27 | "[stdin]",
28 | {
29 | "glo": [ 1, 0, 0 ],
30 | "target": [ "webgl", [ 1, 0, 0 ] ],
31 | "meta": {
32 | "copyright": [ 2012, [ "Bar Corp", "" ] ],
33 | "license": [ "BSD-3-Clause", "" ],
34 | "library": [ "Magic Box", "http://example.com/magic" ],
35 | "version": [ [ 0, 1, 0 ], "mailto:bar@example.org" ]
36 | },
37 | "units": [
38 | {
39 | "outsym": [ "main" ],
40 | "source":
41 | "#line 1 GLOC_1\nvoid main() {\n gl_Position = vec4(1.);\n}"
42 | }
43 | ],
44 | "linkmap": { "1": "#n=1" }
45 | }
46 | ]
47 | ]
48 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/roundtrip_span.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/special_decl.in:
--------------------------------------------------------------------------------
1 | #define HSIZE 3
2 | invariant varying float foo;
3 | varying float bar;
4 | uniform struct my_s { vec2 v2; } h[HSIZE], hh[HSIZE], jj;
5 | attribute vec3 attr;
6 |
7 | struct s { float g; } fn(s h) { return h; }
8 | s fn(s h, s q) { return q; }
9 | s fn(struct { float g; } n) { return n; }
10 |
11 | float n=1.0, rr=2.0, y[10];
12 | const bool i=false;
13 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/templ.in:
--------------------------------------------------------------------------------
1 | #if 1
2 | #define T(t) t fn(t a, t b) { return t(a.x+b.x); }
3 |
4 | T(vec2)
5 | T(vec3)
6 | T(vec4)
7 | #undef T
8 | #endif
9 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/templ.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "fn" ],
8 | "source":
9 | "#line 1 GLOC_0\n#if 1\n#define T(t) t fn(t a, t b) { return t(a.x+b.x); }\n\nT(vec2)\nT(vec3)\nT(vec4)\n#undef T\n#endif"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/templ.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "fn" ],
8 | "source":
9 | "#line 1 GLOC_0\n#if 1\n#define T(t) t fn(t a, t b) { return t(a.x+b.x); }\n\nT(vec2)\nT(vec3)\nT(vec4)\n#undef T\n#endif"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/templ_open.in:
--------------------------------------------------------------------------------
1 | #define T(t) t lie(t x, t y) { return x*y - y*x; }
2 |
3 | T(mat2)
4 | T(mat3)
5 | T(mat4)
6 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/templ_open.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outmac": [ "T" ],
8 | "source":
9 | "#line 1 GLOC_0\n#define T(t) t lie(t x, t y) { return x*y - y*x; }"
10 | },
11 | {
12 | "outsym": [ "lie" ],
13 | "inmac": [ "T" ],
14 | "source": "#line 3 GLOC_0\nT(mat2)\nT(mat3)\nT(mat4)"
15 | }
16 | ],
17 | "linkmap": { "0": "#n=0" }
18 | }
19 |
--------------------------------------------------------------------------------
/test/webgl/dissolve/templ_open.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outmac": [ "T" ],
8 | "source":
9 | "#line 1 GLOC_0\n#define T(t) t lie(t x, t y) { return x*y - y*x; }"
10 | },
11 | {
12 | "outsym": [ "lie" ],
13 | "inmac": [ "T" ],
14 | "source": "#line 3 GLOC_0\nT(mat2)\nT(mat3)\nT(mat4)"
15 | }
16 | ],
17 | "linkmap": { "0": "#n=0" }
18 | }
19 |
--------------------------------------------------------------------------------
/test/webgl/error/.gitignore:
--------------------------------------------------------------------------------
1 | *.diff
2 |
--------------------------------------------------------------------------------
/test/webgl/error/Makefile:
--------------------------------------------------------------------------------
1 | PP = OCAMLRUNPARAM=b ../../../src/gloc.d.byte -e
2 |
3 | INS := $(wildcard *.in)
4 | OUTS := $(INS:.in=.out)
5 |
6 | %.out : %.in %.true
7 | @$(PP) < $*.in &> $@ || true
8 | @if diff -u $*.true $@ > $*.diff; then \
9 | rm $*.diff;\
10 | else cat $*.diff;\
11 | fi
12 |
13 | .PHONY : all test clean
14 | all :
15 | @$(MAKE) clean
16 | @$(MAKE) test
17 | test : $(OUTS)
18 | @printf "Test failures: "
19 | @ls *.diff 2> /dev/null | wc -l
20 | clean :
21 | @rm *.out *.diff 2> /dev/null || true
22 | %.git : %.in %.out %.true
23 | git add $^
24 | %.new :
25 | touch $*.in
26 | echo "error" > $*.true
27 |
--------------------------------------------------------------------------------
/test/webgl/error/block_header.in:
--------------------------------------------------------------------------------
1 | /* header */
2 |
--------------------------------------------------------------------------------
/test/webgl/error/block_header.out:
--------------------------------------------------------------------------------
1 | /*header */
2 |
--------------------------------------------------------------------------------
/test/webgl/error/block_header.true:
--------------------------------------------------------------------------------
1 | /*header */
2 |
--------------------------------------------------------------------------------
/test/webgl/error/directive_fail.in:
--------------------------------------------------------------------------------
1 | /* a header */ # /* an empty
2 | directive */ # /* the beginning of error */ error some error
3 |
--------------------------------------------------------------------------------
/test/webgl/error/directive_fail.out:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 13 - 14:
2 | invalid directive "#"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/directive_fail.true:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 13 - 14:
2 | invalid directive "#"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/empty.in:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/error/empty.in
--------------------------------------------------------------------------------
/test/webgl/error/empty.out:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/test/webgl/error/empty.true:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/test/webgl/error/empty_directive.in:
--------------------------------------------------------------------------------
1 | /* a header */
2 |
3 | /* here comes an empty directive */ # /* that was an empty directive */
4 |
--------------------------------------------------------------------------------
/test/webgl/error/empty_directive.out:
--------------------------------------------------------------------------------
1 | /*a header */
2 |
3 | /*here comes an empty directive that was an empty directive */
4 |
--------------------------------------------------------------------------------
/test/webgl/error/empty_directive.true:
--------------------------------------------------------------------------------
1 | /*a header */
2 |
3 | /*here comes an empty directive that was an empty directive */
4 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_character.in:
--------------------------------------------------------------------------------
1 | #error The $ isn't allowed (neither is the apostrophe)
2 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_character.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 11 - 12:
2 | unknown character '$'
3 |
4 | File 0, line 1, col 16 - 17:
5 | unknown character '''
6 |
7 | Fatal: unrecoverable preprocessor parse error (4)
8 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_character.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 11 - 12:
2 | unknown character '$'
3 |
4 | File 0, line 1, col 16 - 17:
5 | unknown character '''
6 |
7 | Fatal: unrecoverable preprocessor parse error (4)
8 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_character2.in:
--------------------------------------------------------------------------------
1 | #version \
2 | 100
3 |
4 | #define FOO
5 |
6 | #if def\
7 | ined FOO
8 |
9 | #endif
10 |
11 | void main() {
12 |
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_character2.out:
--------------------------------------------------------------------------------
1 | #version/*\
2 | */ 100
3 |
4 | #define FOO
5 |
6 | #if def/*\
7 | */ ined FOO
8 |
9 | #endif
10 |
11 | void main() {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_character2.true:
--------------------------------------------------------------------------------
1 | #error warn about line continuation support
2 | #version/*\
3 | */ 100
4 |
5 | #define FOO
6 |
7 | #if def/*\
8 | */ ined FOO
9 |
10 | #endif
11 |
12 | void main() {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_directive_location.in:
--------------------------------------------------------------------------------
1 | void main() { #error directives must be first semantic token on line
2 | #error so this is fine
3 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_directive_location.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 14 - 15:
2 | invalid directive location
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_directive_location.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 14 - 15:
2 | invalid directive location
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_directive_location2.in:
--------------------------------------------------------------------------------
1 | /* header */
2 | q #error directive must be first semantic token
3 | /* so this is fine */ #error OK
4 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_directive_location2.out:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 2 - 3:
2 | invalid directive location
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_directive_location2.true:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 2 - 3:
2 | invalid directive location
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_octal.in:
--------------------------------------------------------------------------------
1 | #if 9 == 09 // invalid octal is a cardinal sin
2 |
3 | #endif
4 | void main() {}
5 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_octal.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 9 - 11:
2 | invalid octal constant "09"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_octal.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 9 - 11:
2 | invalid octal constant "09"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_version_base.in:
--------------------------------------------------------------------------------
1 | #version 0144 // can only be decimal '100' no more no less and always
2 | // on the first line!
3 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_version_base.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 9 - 13:
2 | version must be specified in decimal
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/invalid_version_base.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 9 - 13:
2 | version must be specified in decimal
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/just_comments.in:
--------------------------------------------------------------------------------
1 | /* header */
2 | /* more header */
3 |
4 |
5 |
6 | /* trailer */
7 | /* more trailer */
8 |
--------------------------------------------------------------------------------
/test/webgl/error/just_comments.out:
--------------------------------------------------------------------------------
1 | /*header
2 | more header */
3 |
4 |
5 |
6 | /*trailer
7 | more trailer */
8 |
--------------------------------------------------------------------------------
/test/webgl/error/just_comments.true:
--------------------------------------------------------------------------------
1 | /*header
2 | more header */
3 |
4 |
5 |
6 | /*trailer
7 | more trailer */
8 |
--------------------------------------------------------------------------------
/test/webgl/error/line_directive.in:
--------------------------------------------------------------------------------
1 | #line 50
2 | #line 09
3 | #line 02
4 | #line 2 0xF
5 | #error error at file 15, line 2
6 | #line 0xF 010
7 | #error error at file 8, line 15
8 | #line 100 50
9 | #error error at file 50, line 100
10 |
--------------------------------------------------------------------------------
/test/webgl/error/line_directive.out:
--------------------------------------------------------------------------------
1 | File 0, line 50, col 6 - 8:
2 | invalid octal constant "09"
3 |
4 | File 0, line 9, col 6 - 8:
5 | line control arguments must be specified in decimal
6 |
7 | File 0, line 2, col 8 - 11:
8 | line control arguments must be specified in decimal
9 |
10 | File 15, line 3, col 6 - 9:
11 | line control arguments must be specified in decimal
12 |
13 | File 15, line 3, col 10 - 13:
14 | line control arguments must be specified in decimal
15 |
16 | Fatal: unrecoverable preprocessor parse error (4)
17 |
--------------------------------------------------------------------------------
/test/webgl/error/line_directive.true:
--------------------------------------------------------------------------------
1 | File 0, line 50, col 6 - 8:
2 | invalid octal constant "09"
3 |
4 | File 0, line 9, col 6 - 8:
5 | line control arguments must be specified in decimal
6 |
7 | File 0, line 2, col 8 - 11:
8 | line control arguments must be specified in decimal
9 |
10 | File 15, line 3, col 6 - 9:
11 | line control arguments must be specified in decimal
12 |
13 | File 15, line 3, col 10 - 13:
14 | line control arguments must be specified in decimal
15 |
16 | Fatal: unrecoverable preprocessor parse error (4)
17 |
--------------------------------------------------------------------------------
/test/webgl/error/multiline_block_header.in:
--------------------------------------------------------------------------------
1 | /* this
2 | is
3 | a
4 | test of multiline block comment headers */
5 |
--------------------------------------------------------------------------------
/test/webgl/error/multiline_block_header.out:
--------------------------------------------------------------------------------
1 | /*this
2 | is
3 | a
4 | test of multiline block comment headers */
5 |
--------------------------------------------------------------------------------
/test/webgl/error/multiline_block_header.true:
--------------------------------------------------------------------------------
1 | /*this
2 | is
3 | a
4 | test of multiline block comment headers */
5 |
--------------------------------------------------------------------------------
/test/webgl/error/multiline_directive.in:
--------------------------------------------------------------------------------
1 | #/* This directive spans multiple lines
2 | * as the spec allows comments (semantically equivalent to spaces)
3 | * to be present between the hash and the directive name */ version 100
4 |
--------------------------------------------------------------------------------
/test/webgl/error/multiline_directive.out:
--------------------------------------------------------------------------------
1 | /* This directive spans multiple lines
2 | * as the spec allows comments (semantically equivalent to spaces)
3 | * to be present between the hash and the directive name */#version 100
4 |
--------------------------------------------------------------------------------
/test/webgl/error/multiline_directive.true:
--------------------------------------------------------------------------------
1 | /* This directive spans multiple lines
2 | * as the spec allows comments (semantically equivalent to spaces)
3 | * to be present between the hash and the directive name */#version 100
4 |
--------------------------------------------------------------------------------
/test/webgl/error/multiline_directive2.in:
--------------------------------------------------------------------------------
1 | #version /*
2 | */100
3 |
4 | void main() {}
5 |
--------------------------------------------------------------------------------
/test/webgl/error/multiline_directive2.out:
--------------------------------------------------------------------------------
1 | #version/*
2 | */100
3 |
4 | void main() {}
5 |
--------------------------------------------------------------------------------
/test/webgl/error/multiline_directive2.true:
--------------------------------------------------------------------------------
1 | #version/*
2 | */100
3 |
4 | void main() {}
5 |
--------------------------------------------------------------------------------
/test/webgl/error/nested_block_comments.in:
--------------------------------------------------------------------------------
1 | /* this is an improperly /* nested
2 | comment */ */
3 |
--------------------------------------------------------------------------------
/test/webgl/error/nested_block_comments.out:
--------------------------------------------------------------------------------
1 | /*this is an improperly /* nested
2 | comment */ */
3 |
--------------------------------------------------------------------------------
/test/webgl/error/nested_block_comments.true:
--------------------------------------------------------------------------------
1 | /*this is an improperly /* nested
2 | comment */ */
3 |
--------------------------------------------------------------------------------
/test/webgl/error/no_eof_newline.in:
--------------------------------------------------------------------------------
1 | #if 6 == 6
2 | #pragma foo always
3 | #endif
4 | void main() { }
5 | #define HA
--------------------------------------------------------------------------------
/test/webgl/error/no_eof_newline.out:
--------------------------------------------------------------------------------
1 | #if 6 == 6
2 | #pragma foo always
3 | #endif
4 | void main() { }
5 | #define HA
6 |
--------------------------------------------------------------------------------
/test/webgl/error/no_eof_newline.true:
--------------------------------------------------------------------------------
1 | #if 6 == 6
2 | #pragma foo always
3 | #endif
4 | void main() { }
5 | #define HA
6 |
--------------------------------------------------------------------------------
/test/webgl/error/tauto_cond.in:
--------------------------------------------------------------------------------
1 | #if 1 == 1
2 |
3 | #endif
4 |
--------------------------------------------------------------------------------
/test/webgl/error/tauto_cond.out:
--------------------------------------------------------------------------------
1 | #if 1 == 1
2 |
3 | #endif
4 |
--------------------------------------------------------------------------------
/test/webgl/error/tauto_cond.true:
--------------------------------------------------------------------------------
1 | #if 1 == 1
2 |
3 | #endif
4 |
--------------------------------------------------------------------------------
/test/webgl/error/unknown_behavior.in:
--------------------------------------------------------------------------------
1 | #extension flarb : fizzle
2 |
--------------------------------------------------------------------------------
/test/webgl/error/unknown_behavior.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 19 - 25:
2 | unknown behavior "fizzle"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unknown_behavior.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 19 - 25:
2 | unknown behavior "fizzle"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unknown_directive.in:
--------------------------------------------------------------------------------
1 | #/* Here comes a bogus directive! */ bogus foo bar baz
2 |
--------------------------------------------------------------------------------
/test/webgl/error/unknown_directive.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 39 - 44:
2 | invalid directive "bogus"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unknown_directive.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 39 - 44:
2 | invalid directive "bogus"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unknown_directive2.in:
--------------------------------------------------------------------------------
1 | #bogus foo bar baz
2 |
--------------------------------------------------------------------------------
/test/webgl/error/unknown_directive2.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 1 - 6:
2 | invalid directive "bogus"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unknown_directive2.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 1 - 6:
2 | invalid directive "bogus"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_comment.in:
--------------------------------------------------------------------------------
1 | #version 100
2 | /* Here's an unterminated block comment
3 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_comment.out:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 2:
2 | unterminated comment
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_comment.true:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 2:
2 | unterminated comment
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_comment_footer.in:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | /* This is an unterminated comment in the footer of an empty shader
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_comment_footer.out:
--------------------------------------------------------------------------------
1 | File 0, line 4, col 2:
2 | unterminated comment
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_comment_footer.true:
--------------------------------------------------------------------------------
1 | File 0, line 4, col 2:
2 | unterminated comment
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_comment_header.in:
--------------------------------------------------------------------------------
1 | /* This is a comment without termination
2 | #error This error directive isn't real because it's inside a block comment
3 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_comment_header.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 2:
2 | unterminated comment
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_comment_header.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 2:
2 | unterminated comment
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond.in:
--------------------------------------------------------------------------------
1 | #if A = A
2 | // zzZZzzz
3 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 0 - 3:
2 | unterminated conditional "#if"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 0 - 3:
2 | unterminated conditional "#if"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond2.in:
--------------------------------------------------------------------------------
1 | #if 1 == 0
2 |
3 | #elif 1 == 1
4 |
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond2.out:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 0 - 5:
2 | unterminated conditional "#elif"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond2.true:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 0 - 5:
2 | unterminated conditional "#elif"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond3.in:
--------------------------------------------------------------------------------
1 | #version 100
2 | #ifdef FOO
3 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond3.out:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 0 - 6:
2 | unterminated conditional "#ifdef"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond3.true:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 0 - 6:
2 | unterminated conditional "#ifdef"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond4.in:
--------------------------------------------------------------------------------
1 | #version 100
2 | #define GLARG
3 | #ifndef GLARG
4 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond4.out:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 0 - 7:
2 | unterminated conditional "#ifndef"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/error/unterminated_cond4.true:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 0 - 7:
2 | unterminated conditional "#ifndef"
3 |
4 | Fatal: unrecoverable preprocessor parse error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/essl/.gitignore:
--------------------------------------------------------------------------------
1 | *.diff
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/Makefile:
--------------------------------------------------------------------------------
1 | PP = OCAMLRUNPARAM=b ../../../src/gloc.d.byte
2 |
3 | INS := $(wildcard *.in)
4 | OUTS := $(INS:.in=.out)
5 |
6 | %.out : %.in %.true
7 | @$(PP) < $*.in &> $@ || true
8 | @if diff -u $*.true $@ > $*.diff; then \
9 | rm $*.diff;\
10 | else cat $*.diff;\
11 | fi
12 |
13 | .PHONY : all test clean
14 | all :
15 | @$(MAKE) clean
16 | @$(MAKE) test
17 | test : $(OUTS)
18 | @printf "Test failures: "
19 | @ls *.diff 2> /dev/null | wc -l
20 | clean :
21 | @rm *.out *.diff 2> /dev/null || true
22 | %.git : %.in %.out %.true
23 | git add $^
24 | %.new :
25 | touch $*.in
26 | echo "error" > $*.true
27 |
--------------------------------------------------------------------------------
/test/webgl/essl/anonymous_type.in:
--------------------------------------------------------------------------------
1 | void main() {
2 | struct { int a; int b; int c; } s;
3 | s.a = 1;
4 | s.b = 2;
5 | s.c = 3;
6 | }
7 |
--------------------------------------------------------------------------------
/test/webgl/essl/anonymous_type.out:
--------------------------------------------------------------------------------
1 | #line 1 0/* #u=0 */
2 | void main() {
3 | struct { int a; int b; int c; } s;
4 | s.a = 1;
5 | s.b = 2;
6 | s.c = 3;
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/test/webgl/essl/anonymous_type.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/conditional_scope.in:
--------------------------------------------------------------------------------
1 | void main() {
2 | int k = 3;
3 |
4 | if (true) int g = k = 4;
5 | else int q = k = 5;
6 |
7 | g = 3; // error but angle doesn't
8 | q = 4; // error but angle doesn't
9 |
10 | if (true) int g = 4; // ok but angle errors
11 | else int k = 10; // ok but angle errors
12 |
13 | if (true) { int g = 10; } // ok
14 | else { int k = 20; } // ok
15 |
16 | gl_FragColor = vec4(1.);
17 | }
18 |
--------------------------------------------------------------------------------
/test/webgl/essl/conditional_scope.out:
--------------------------------------------------------------------------------
1 | #u=0 requires symbol 'true' which cannot be found.
2 |
3 | Fatal: unrecoverable link error (9)
4 |
--------------------------------------------------------------------------------
/test/webgl/essl/conditional_scope.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/conditional_struct.in:
--------------------------------------------------------------------------------
1 | precision highp float;
2 |
3 | void main() {
4 |
5 | if (false) struct s { int k; } q = s(0);
6 |
7 | gl_FragColor = vec4(float(s(q.k).k));
8 | }
9 |
--------------------------------------------------------------------------------
/test/webgl/essl/conditional_struct.out:
--------------------------------------------------------------------------------
1 | #u=0 requires symbol 'false' which cannot be found.
2 |
3 | Fatal: unrecoverable link error (9)
4 |
--------------------------------------------------------------------------------
/test/webgl/essl/conditional_struct.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/duplicate_fields.in:
--------------------------------------------------------------------------------
1 | precision highp float;
2 | struct { int q; };
3 | struct { float q; };
4 | void main() { }
5 |
--------------------------------------------------------------------------------
/test/webgl/essl/duplicate_fields.out:
--------------------------------------------------------------------------------
1 | #line 1 0/* #u=0 */
2 | precision highp float;
3 | struct { int q; };
4 | struct { float q; };
5 | void main() { }
6 |
7 |
--------------------------------------------------------------------------------
/test/webgl/essl/duplicate_fields.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/empty.in:
--------------------------------------------------------------------------------
1 | void main() {
2 | ;
3 | ;
4 | {}
5 | {;}
6 | {;{};}
7 | {;{;};}
8 |
9 | gl_FragColor = vec4(0.);
10 | }
11 |
--------------------------------------------------------------------------------
/test/webgl/essl/empty.out:
--------------------------------------------------------------------------------
1 | #line 1 0/* #u=0 */
2 | void main() {
3 | ;
4 | ;
5 | {}
6 | {;}
7 | {;{};}
8 | {;{;};}
9 |
10 | gl_FragColor = vec4(0.);
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/test/webgl/essl/empty.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/fn_shadow.in:
--------------------------------------------------------------------------------
1 | int f(int k) {
2 | int k = k + 3;
3 | return k;
4 | }
5 |
6 | void main() {
7 | gl_FragColor = vec4(f(100));
8 | }
9 |
--------------------------------------------------------------------------------
/test/webgl/essl/fn_shadow.out:
--------------------------------------------------------------------------------
1 | #line 1 0/* #u=0 */
2 | int f(int k) {
3 | int k = k + 3;
4 | return k;
5 | }
6 |
7 | void main() {
8 | gl_FragColor = vec4(f(100));
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/test/webgl/essl/fn_shadow.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/for_init_struct.in:
--------------------------------------------------------------------------------
1 | void main() {
2 | for (struct foo { int a; } j = foo(0); j.a < 10; j.a++) {}
3 |
4 | }
5 |
--------------------------------------------------------------------------------
/test/webgl/essl/for_init_struct.out:
--------------------------------------------------------------------------------
1 | #line 1 0/* #u=0 */
2 | void main() {
3 | for (struct foo { int a; } j = foo(0); j.a < 10; j.a++) {}
4 |
5 | }
6 |
7 |
--------------------------------------------------------------------------------
/test/webgl/essl/for_init_struct.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/for_init_struct_scope.in:
--------------------------------------------------------------------------------
1 | void main() {
2 | struct s { int a; };
3 | for (struct s { int k; } g = s(0); g.k < 10; g.k++) {}
4 | gl_FragColor = vec4(s(10).a);
5 | }
6 |
--------------------------------------------------------------------------------
/test/webgl/essl/for_init_struct_scope.out:
--------------------------------------------------------------------------------
1 | #line 1 0/* #u=0 */
2 | void main() {
3 | struct s { int a; };
4 | for (struct s { int k; } g = s(0); g.k < 10; g.k++) {}
5 | gl_FragColor = vec4(s(10).a);
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/test/webgl/essl/for_init_struct_scope.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/loop_body_decl.in:
--------------------------------------------------------------------------------
1 | void main() {
2 | int k = 0;
3 | for (int i = 0; i < 10; i++) int i = k+i; // error, redecl no new scope
4 | for (int i = 0; i < 10; i++) { int i = k+i; } // ok, compound nests
5 | while (k > 0) int k = k--; // error, redecl no new scope
6 | while (k > 0) { int k = k--; } // ok, compound nests
7 | do int k = 1; while (k != 0); // ok, do always introduces scope
8 | do { int k = 1; } while (k != 0); // ok, compound nests
9 | gl_FragColor = vec4(float(k));
10 | }
11 |
--------------------------------------------------------------------------------
/test/webgl/essl/loop_body_decl.out:
--------------------------------------------------------------------------------
1 | #line 1 0/* #u=0 */
2 | void main() {
3 | int k = 0;
4 | for (int i = 0; i < 10; i++) int i = k+i;/* error, redecl no new scope*/
5 | for (int i = 0; i < 10; i++) { int i = k+i; }/* ok, compound nests*/
6 | while (k > 0) int k = k--;/* error, redecl no new scope*/
7 | while (k > 0) { int k = k--; }/* ok, compound nests*/
8 | do int k = 1; while (k != 0);/* ok, do always introduces scope*/
9 | do { int k = 1; } while (k != 0);/* ok, compound nests*/
10 | gl_FragColor = vec4(float(k));
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/test/webgl/essl/loop_body_decl.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/prototype_struct.in:
--------------------------------------------------------------------------------
1 | precision highp float;
2 | struct q { int j; } myfun(q s) { return s; }
3 | float fun2(struct s { float m; } g) { return g.m; }
4 | s fun3(s g) { return g; }
5 |
6 | void main() {
7 | q j = myfun(q(14));
8 | float e = fun2(s(3.0));
9 | float f = (fun3(s(4.0))).m;
10 | }
11 |
--------------------------------------------------------------------------------
/test/webgl/essl/prototype_struct.out:
--------------------------------------------------------------------------------
1 | #u=0 requires symbol 's' which cannot be found.
2 |
3 | Fatal: unrecoverable link error (9)
4 |
--------------------------------------------------------------------------------
/test/webgl/essl/prototype_struct.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/structural_typing.in:
--------------------------------------------------------------------------------
1 | struct q { int j; };
2 | struct { int j; } j;
3 | q fn(struct { int j; } s) { struct q { int j; }; s.j = s.j+1; return s; }
4 | void main() {
5 | j.j = 12;
6 | q g = fn(j);
7 | }
8 |
--------------------------------------------------------------------------------
/test/webgl/essl/structural_typing.out:
--------------------------------------------------------------------------------
1 | #line 1 0/* #u=0 */
2 | struct q { int j; };
3 | struct { int j; } j;
4 | q fn(struct { int j; } s) { struct q { int j; }; s.j = s.j+1; return s; }
5 | void main() {
6 | j.j = 12;
7 | q g = fn(j);
8 | }
9 |
10 |
--------------------------------------------------------------------------------
/test/webgl/essl/structural_typing.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/essl/unnamed_struct.in:
--------------------------------------------------------------------------------
1 | precision highp float;
2 |
3 | struct { int q; };
4 |
5 | uniform struct { float k; } r;
6 |
7 | struct { float k; } id(struct { float k; } k) { return k; }
8 |
9 | void main() { id(r); }
10 |
--------------------------------------------------------------------------------
/test/webgl/essl/unnamed_struct.out:
--------------------------------------------------------------------------------
1 | #line 1 0/* #u=0 */
2 | precision highp float;
3 |
4 | struct { int q; };
5 |
6 | uniform struct { float k; } r;
7 |
8 | struct { float k; } id(struct { float k; } k) { return k; }
9 |
10 | void main() { id(r); }
11 |
12 |
--------------------------------------------------------------------------------
/test/webgl/essl/unnamed_struct.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/glo/.gitignore:
--------------------------------------------------------------------------------
1 | *.diff
2 |
--------------------------------------------------------------------------------
/test/webgl/glo/Makefile:
--------------------------------------------------------------------------------
1 | PP = OCAMLRUNPARAM=b ../../../src/gloc.d.byte -c -v
2 |
3 | INS := $(wildcard *.in)
4 | OUTS := $(INS:.in=.out)
5 |
6 | %.out : %.in %.true
7 | @$(PP) < $*.in &> $@ || true
8 | @if diff -u $*.true $@ > $*.diff; then \
9 | rm $*.diff;\
10 | else cat $*.diff;\
11 | fi
12 |
13 | .PHONY : all test clean
14 | all :
15 | @$(MAKE) clean
16 | @$(MAKE) test
17 | test : $(OUTS)
18 | @printf "Test failures: "
19 | @ls *.diff 2> /dev/null | wc -l
20 | clean :
21 | @rm *.out *.diff 2> /dev/null || true
22 | %.git : %.in %.out %.true
23 | git add $^
24 | %.new :
25 | touch $*.in
26 | echo "error" > $*.true
27 |
--------------------------------------------------------------------------------
/test/webgl/glo/attributes.in:
--------------------------------------------------------------------------------
1 | attribute vec3 p;
2 |
3 | vec3 get_p() { return p; }
4 |
--------------------------------------------------------------------------------
/test/webgl/glo/attributes.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "ina": [ "p" ],
8 | "outsym": [ "p", "get_p" ],
9 | "source":
10 | "#line 1 GLOC_0\nattribute vec3 p;\n\nvec3 get_p() { return p; }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/attributes.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "ina": [ "p" ],
8 | "outsym": [ "p", "get_p" ],
9 | "source":
10 | "#line 1 GLOC_0\nattribute vec3 p;\n\nvec3 get_p() { return p; }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/consts.in:
--------------------------------------------------------------------------------
1 | const float g = 0.2;
2 |
3 | vec2 myfun(vec2 m) {
4 | const vec2 f = vec2(g);
5 | return f+m;
6 | }
7 |
--------------------------------------------------------------------------------
/test/webgl/glo/consts.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "myfun", "g" ],
8 | "source":
9 | "#line 1 GLOC_0\nconst float g = 0.2;\n\nvec2 myfun(vec2 m) {\n const vec2 f = vec2(g);\n return f+m;\n}"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/consts.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "myfun", "g" ],
8 | "source":
9 | "#line 1 GLOC_0\nconst float g = 0.2;\n\nvec2 myfun(vec2 m) {\n const vec2 f = vec2(g);\n return f+m;\n}"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/empty_cond.in:
--------------------------------------------------------------------------------
1 | #if defined E
2 | #else
3 | #endif
4 |
5 | void main() {}
6 |
--------------------------------------------------------------------------------
/test/webgl/glo/empty_cond.out:
--------------------------------------------------------------------------------
1 | Fatal error: exception Pp_lib.ParserError("fusing empty pptok_expr list")
2 | Raised at file "glol.ml", line 51, characters 17-20
3 | Called from file "gloc_lib.ml", line 284, characters 15-39
4 | Re-raised at file "gloc_lib.ml", line 284, characters 56-57
5 | Called from file "gloc.ml", line 140, characters 34-62
6 | Called from file "list.ml", line 69, characters 12-15
7 | Called from file "gloc.ml", line 145, characters 4-44
8 | Called from file "gloc_posix.ml", line 9, characters 10-75
9 |
--------------------------------------------------------------------------------
/test/webgl/glo/empty_cond.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/glo/head_comment.in:
--------------------------------------------------------------------------------
1 | // Copyright: 2012 Foo
2 | void main() {}
3 |
--------------------------------------------------------------------------------
/test/webgl/glo/head_comment.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "main" ],
8 | "source":
9 | "#line 1 GLOC_0\n/* Copyright: 2012 Foo */\nvoid main() {}"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/head_comment.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "main" ],
8 | "source":
9 | "#line 1 GLOC_0\n/* Copyright: 2012 Foo */\nvoid main() {}"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/inmac.in:
--------------------------------------------------------------------------------
1 | #if INMAC
2 |
3 | void main() { gl_Position = vec4(1.); }
4 |
5 | #else
6 |
7 | void main() { gl_Position = vec4(0.); }
8 |
9 | #endif
10 |
--------------------------------------------------------------------------------
/test/webgl/glo/inmac.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "main" ],
8 | "inmac": [ "INMAC" ],
9 | "source":
10 | "#line 1 GLOC_0\n#if INMAC\n\nvoid main() { gl_Position = vec4(1.); }\n#else\n\n\nvoid main() { gl_Position = vec4(0.); }\n\n#endif"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/inmac.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "main" ],
8 | "inmac": [ "INMAC" ],
9 | "source":
10 | "#line 1 GLOC_0\n#if INMAC\n\nvoid main() { gl_Position = vec4(1.); }\n#else\n\n\nvoid main() { gl_Position = vec4(0.); }\n\n#endif"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/inopmac.in:
--------------------------------------------------------------------------------
1 | #if EXTMAC
2 | #define MYMAC vec4(1.)
3 | #else
4 | #define MYMAC vec4(0.)
5 | #endif
6 |
7 | void main() { gl_Position = MYMAC; }
8 |
--------------------------------------------------------------------------------
/test/webgl/glo/inopmac.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "main" ],
8 | "inmac": [ "EXTMAC" ],
9 | "opmac": [ "MYMAC" ],
10 | "source":
11 | "#line 1 GLOC_0\n#if EXTMAC\n#define MYMAC vec4(1.)\n#else\n#define MYMAC vec4(0.)\n#endif\n\nvoid main() { gl_Position = MYMAC; }"
12 | }
13 | ],
14 | "linkmap": { "0": "#n=0" }
15 | }
16 |
--------------------------------------------------------------------------------
/test/webgl/glo/inopmac.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "main" ],
8 | "inmac": [ "EXTMAC" ],
9 | "opmac": [ "MYMAC" ],
10 | "source":
11 | "#line 1 GLOC_0\n#if EXTMAC\n#define MYMAC vec4(1.)\n#else\n#define MYMAC vec4(0.)\n#endif\n\nvoid main() { gl_Position = MYMAC; }"
12 | }
13 | ],
14 | "linkmap": { "0": "#n=0" }
15 | }
16 |
--------------------------------------------------------------------------------
/test/webgl/glo/line_directive.in:
--------------------------------------------------------------------------------
1 | #line 1 1
2 | #define K 3
3 | #line 1 2
4 | #define Q 4
5 |
--------------------------------------------------------------------------------
/test/webgl/glo/line_directive.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "opmac": [ "Q", "K" ],
8 | "source": "#line 1 GLOC_1\n#define K 3\n#line 1 GLOC_2\n#define Q 4"
9 | }
10 | ],
11 | "linkmap": { "1": "#n=1", "2": "#n=2" }
12 | }
13 |
--------------------------------------------------------------------------------
/test/webgl/glo/line_directive.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "opmac": [ "Q", "K" ],
8 | "source": "#line 1 GLOC_1\n#define K 3\n#line 1 GLOC_2\n#define Q 4"
9 | }
10 | ],
11 | "linkmap": { "1": "#n=1", "2": "#n=2" }
12 | }
13 |
--------------------------------------------------------------------------------
/test/webgl/glo/line_directive2.in:
--------------------------------------------------------------------------------
1 | #line 2
2 | /*if*/#if defined E
3 | /*A */#/*very commented */line/*line directive */10/* */77// with trailing comment
4 | int foo() {
5 | #line 13 3
6 | return 1;
7 | }
8 | #/*elif*/elif defined F // comments trailing pp conditional
9 | #line 13 4
10 | int foo() {
11 | return 2;
12 | }
13 | #else
14 | int foo() {
15 | return 3;
16 | }
17 | #endif // comments trailing endif
18 |
--------------------------------------------------------------------------------
/test/webgl/glo/line_directive2.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "foo" ],
8 | "source":
9 | "#line 1 GLOC_0\n#line 2\n/*if*/#if defined E\n/*A very commented */ #line 10/**/ GLOC_77/* with trailing comment*/\nint foo() {\n#line 13 GLOC_3\n return 1;\n}\n#else\n#line 15\n/* elif*/ #if defined F/* comments trailing pp conditional*/\n#line 13 GLOC_4\nint foo() {\n return 2;\n}\n#else\nint foo() {\n return 3;\n}\n#endif/* comments trailing endif*/\n#line 20\n#endif/* comments trailing endif*/"
10 | }
11 | ],
12 | "linkmap": { "4": "#n=4", "77": "#n=77", "3": "#n=3", "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/line_directive2.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "foo" ],
8 | "source":
9 | "#line 1 GLOC_0\n#line 2\n/*if*/#if defined E\n/*A very commented */ #line 10/**/ GLOC_77/* with trailing comment*/\nint foo() {\n#line 13 GLOC_3\n return 1;\n}\n#else\n#line 15\n/* elif*/ #if defined F/* comments trailing pp conditional*/\n#line 13 GLOC_4\nint foo() {\n return 2;\n}\n#else\nint foo() {\n return 3;\n}\n#endif/* comments trailing endif*/\n#line 20\n#endif/* comments trailing endif*/"
10 | }
11 | ],
12 | "linkmap": { "4": "#n=4", "77": "#n=77", "3": "#n=3", "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/macro_shadow.in:
--------------------------------------------------------------------------------
1 | #if E
2 | #define X f
3 | #endif
4 |
5 | void main() { X(); }
6 |
--------------------------------------------------------------------------------
/test/webgl/glo/macro_shadow.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "X", "f" ],
8 | "outsym": [ "main" ],
9 | "inmac": [ "E" ],
10 | "opmac": [ "X" ],
11 | "source":
12 | "#line 1 GLOC_0\n#if E\n#define X f\n#endif\n\nvoid main() { X(); }"
13 | }
14 | ],
15 | "linkmap": { "0": "#n=0" }
16 | }
17 |
--------------------------------------------------------------------------------
/test/webgl/glo/macro_shadow.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "X", "f" ],
8 | "outsym": [ "main" ],
9 | "inmac": [ "E" ],
10 | "opmac": [ "X" ],
11 | "source":
12 | "#line 1 GLOC_0\n#if E\n#define X f\n#endif\n\nvoid main() { X(); }"
13 | }
14 | ],
15 | "linkmap": { "0": "#n=0" }
16 | }
17 |
--------------------------------------------------------------------------------
/test/webgl/glo/multidecl.in:
--------------------------------------------------------------------------------
1 | int x=2, y=x, z=q, h=z;
2 |
--------------------------------------------------------------------------------
/test/webgl/glo/multidecl.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "x", "q", "z" ],
8 | "outsym": [ "z", "y", "x", "h" ],
9 | "source": "#line 1 GLOC_0\nint x=2, y=x, z=q, h=z;"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/multidecl.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "q" ],
8 | "outsym": [ "z", "y", "x", "h" ],
9 | "source": "#line 1 GLOC_0\nint x=2, y=x, z=q, h=z;"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/one_in_one_out.in:
--------------------------------------------------------------------------------
1 | void main() {
2 | gl_Position = vec3(incoming);
3 | }
4 |
--------------------------------------------------------------------------------
/test/webgl/glo/one_in_one_out.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "incoming" ],
8 | "outsym": [ "main" ],
9 | "source":
10 | "#line 1 GLOC_0\nvoid main() {\n gl_Position = vec3(incoming);\n}"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/one_in_one_out.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "incoming" ],
8 | "outsym": [ "main" ],
9 | "source":
10 | "#line 1 GLOC_0\nvoid main() {\n gl_Position = vec3(incoming);\n}"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/opmac.in:
--------------------------------------------------------------------------------
1 | #define MYMAIN main
2 |
3 | void MYMAIN() { gl_Position = vec4(0.); }
4 |
--------------------------------------------------------------------------------
/test/webgl/glo/opmac.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "main" ],
8 | "opmac": [ "MYMAIN" ],
9 | "source":
10 | "#line 1 GLOC_0\n#define MYMAIN main\n\nvoid MYMAIN() { gl_Position = vec4(0.); }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/opmac.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "outsym": [ "main" ],
8 | "opmac": [ "MYMAIN" ],
9 | "source":
10 | "#line 1 GLOC_0\n#define MYMAIN main\n\nvoid MYMAIN() { gl_Position = vec4(0.); }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/poly_macro.in:
--------------------------------------------------------------------------------
1 | #define GP(t) t gp(t a,t b) { \
2 | return sum(prod(a,b),prod(b,a)); \
3 | }
4 |
5 | GP(vec2)
6 |
--------------------------------------------------------------------------------
/test/webgl/glo/poly_macro.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "prod", "sum" ],
8 | "outsym": [ "gp" ],
9 | "opmac": [ "GP" ],
10 | "source":
11 | "#line 1 GLOC_0\n#define GP(t) t gp(t a,t b) {/*\\\n*/ return sum(prod(a,b),prod(b,a));/*\\\n*/ }\n\nGP(vec2)"
12 | }
13 | ],
14 | "linkmap": { "0": "#n=0" }
15 | }
16 |
--------------------------------------------------------------------------------
/test/webgl/glo/poly_macro.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "prod", "sum" ],
8 | "outsym": [ "gp" ],
9 | "opmac": [ "GP" ],
10 | "source":
11 | "#line 1 GLOC_0\n#define GP(t) t gp(t a,t b) {/*\\\n*/ return sum(prod(a,b),prod(b,a));/*\\\n*/ }\n\nGP(vec2)"
12 | }
13 | ],
14 | "linkmap": { "0": "#n=0" }
15 | }
16 |
--------------------------------------------------------------------------------
/test/webgl/glo/prototype.in:
--------------------------------------------------------------------------------
1 | void f();
2 | int p(int);
3 |
4 | void f() { p(0); }
5 |
6 | struct s { int k; } g() { return s(10); }
7 |
8 | s n = g(20);
9 |
10 | void h(struct q { int a; } k);
11 | struct s2 { int k; } j();
12 |
13 | void main() { }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/prototype.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "p", "j", "h" ],
8 | "outsym": [ "s2", "s", "n", "main", "g", "f" ],
9 | "source":
10 | "#line 1 GLOC_0\nvoid f();\nint p(int);\n\nvoid f() { p(0); }\n\nstruct s { int k; } g() { return s(10); }\n\ns n = g(20);\n\nvoid h(struct q { int a; } k);\nstruct s2 { int k; } j();\n\nvoid main() { }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/prototype.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "p", "j", "h" ],
8 | "outsym": [ "s2", "s", "n", "main", "g", "f" ],
9 | "source":
10 | "#line 1 GLOC_0\nvoid f();\nint p(int);\n\nvoid f() { p(0); }\n\nstruct s { int k; } g() { return s(10); }\n\ns n = g(20);\n\nvoid h(struct q { int a; } k);\nstruct s2 { int k; } j();\n\nvoid main() { }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/scope.in:
--------------------------------------------------------------------------------
1 | int foo() {
2 | struct m { int b; } h;
3 | { struct x { int b; } e = x(3); struct q { int b; } d = q(2); h.b=d.b; }
4 | x f;
5 | z f;
6 | return m(1).b+h.b;
7 | }
8 |
--------------------------------------------------------------------------------
/test/webgl/glo/scope.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "x", "z" ],
8 | "outsym": [ "foo" ],
9 | "source":
10 | "#line 1 GLOC_0\nint foo() {\n struct m { int b; } h;\n { struct x { int b; } e = x(3); struct q { int b; } d = q(2); h.b=d.b; }\n x f;\n z f;\n return m(1).b+h.b;\n}"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/scope.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "x", "z" ],
8 | "outsym": [ "foo" ],
9 | "source":
10 | "#line 1 GLOC_0\nint foo() {\n struct m { int b; } h;\n { struct x { int b; } e = x(3); struct q { int b; } d = q(2); h.b=d.b; }\n x f;\n z f;\n return m(1).b+h.b;\n}"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/struct.in:
--------------------------------------------------------------------------------
1 | struct s { int f; } q = s(1);
2 |
3 | struct s6 { int f; } fun(struct s2 { int f; } a) {
4 | struct s3 { int f; } b = s3(3);
5 | struct s4 { int f; } c;
6 | struct s5 { int f; } d;
7 | s2 g = a;
8 | return s6(g.f);
9 | }
10 |
11 | s4 el;
12 |
--------------------------------------------------------------------------------
/test/webgl/glo/struct.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "s4" ],
8 | "outsym": [ "s6", "s", "q", "fun", "el" ],
9 | "source":
10 | "#line 1 GLOC_0\nstruct s { int f; } q = s(1);\n\nstruct s6 { int f; } fun(struct s2 { int f; } a) {\n struct s3 { int f; } b = s3(3);\n struct s4 { int f; } c;\n struct s5 { int f; } d;\n s2 g = a;\n return s6(g.f);\n}\n\ns4 el;"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/struct.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "insym": [ "s4" ],
8 | "outsym": [ "s6", "s", "q", "fun", "el" ],
9 | "source":
10 | "#line 1 GLOC_0\nstruct s { int f; } q = s(1);\n\nstruct s6 { int f; } fun(struct s2 { int f; } a) {\n struct s3 { int f; } b = s3(3);\n struct s4 { int f; } c;\n struct s5 { int f; } d;\n s2 g = a;\n return s6(g.f);\n}\n\ns4 el;"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/uniforms.in:
--------------------------------------------------------------------------------
1 | uniform vec3 pos;
2 | uniform struct S { int k; } s;
3 |
4 | vec3 get_pos() { return pos; }
5 |
--------------------------------------------------------------------------------
/test/webgl/glo/uniforms.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "inu": [ "s", "pos" ],
8 | "outsym": [ "s", "pos", "get_pos", "S" ],
9 | "source":
10 | "#line 1 GLOC_0\nuniform vec3 pos;\nuniform struct S { int k; } s;\n\nvec3 get_pos() { return pos; }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/uniforms.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "inu": [ "s", "pos" ],
8 | "outsym": [ "s", "pos", "get_pos", "S" ],
9 | "source":
10 | "#line 1 GLOC_0\nuniform vec3 pos;\nuniform struct S { int k; } s;\n\nvec3 get_pos() { return pos; }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/varyings.in:
--------------------------------------------------------------------------------
1 | varying vec3 gP;
2 |
3 | vec3 get_gP() { return gP; }
4 | void set_gP(vec3 p) { gP = p; }
5 |
--------------------------------------------------------------------------------
/test/webgl/glo/varyings.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "vary": [ "gP" ],
8 | "outsym": [ "set_gP", "get_gP", "gP" ],
9 | "source":
10 | "#line 1 GLOC_0\nvarying vec3 gP;\n\nvec3 get_gP() { return gP; }\nvoid set_gP(vec3 p) { gP = p; }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/varyings.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "vary": [ "gP" ],
8 | "outsym": [ "set_gP", "get_gP", "gP" ],
9 | "source":
10 | "#line 1 GLOC_0\nvarying vec3 gP;\n\nvec3 get_gP() { return gP; }\nvoid set_gP(vec3 p) { gP = p; }"
11 | }
12 | ],
13 | "linkmap": { "0": "#n=0" }
14 | }
15 |
--------------------------------------------------------------------------------
/test/webgl/glo/version.in:
--------------------------------------------------------------------------------
1 | #version 100
2 |
3 | void main() { }
4 |
--------------------------------------------------------------------------------
/test/webgl/glo/version.out:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "vdir": 100,
8 | "outsym": [ "main" ],
9 | "source": "#line 3 GLOC_0\nvoid main() { }"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glo/version.true:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "vdir": 100,
8 | "outsym": [ "main" ],
9 | "source": "#line 3 GLOC_0\nvoid main() { }"
10 | }
11 | ],
12 | "linkmap": { "0": "#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glol/.gitignore:
--------------------------------------------------------------------------------
1 | *.out
2 | *.err
3 | *.dout
4 | *.derr
5 | *.args
6 | *.argsym
7 | *.glo
8 | sym
9 |
--------------------------------------------------------------------------------
/test/webgl/glol/annotate_glom.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/test/webgl/glol/bad_behavior.001.terr:
--------------------------------------------------------------------------------
1 | bad_behavior.eglo#n=0 uses unknown extension behavior 'fizz'.
2 |
3 | Fatal: unrecoverable link error (9)
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/bad_behavior.001.tout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/bad_behavior.001.tout
--------------------------------------------------------------------------------
/test/webgl/glol/bad_behavior.argset:
--------------------------------------------------------------------------------
1 | bad_behavior.eglo
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/bad_behavior.eglo:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 1, 0, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | {
7 | "edir": [ ["all", "fizz"] ],
8 | "outsym": [ "main" ],
9 | "source": "#line 2 GLOC_0\nvoid main(){}"
10 | }
11 | ],
12 | "linkmap": { "0": "bad_behavior.eglo#n=0" }
13 | }
14 |
--------------------------------------------------------------------------------
/test/webgl/glol/bad_version.001.terr:
--------------------------------------------------------------------------------
1 | bad_version.eglo declares unsupported version 0.2.0.
2 |
3 | Fatal: unrecoverable link error (9)
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/bad_version.001.tout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/bad_version.001.tout
--------------------------------------------------------------------------------
/test/webgl/glol/bad_version.argset:
--------------------------------------------------------------------------------
1 | bad_version.eglo
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/bad_version.eglo:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 0, 2, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, [ "", "" ] ] },
5 | "units": [
6 | { "outsym": [ "main" ], "source": "#line 1 GLOC_0\nvoid main(){}" }
7 | ],
8 | "linkmap": { "0": "bad_version.eglo#n=0" }
9 | }
10 |
--------------------------------------------------------------------------------
/test/webgl/glol/circ.001.terr:
--------------------------------------------------------------------------------
1 | Circular dependency linking:
2 | circ_b.glsl#n=0
3 | circ_a.glsl#n=0
4 |
5 | Fatal: unrecoverable link error (9)
6 |
--------------------------------------------------------------------------------
/test/webgl/glol/circ.001.tout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/circ.001.tout
--------------------------------------------------------------------------------
/test/webgl/glol/circ.002.terr:
--------------------------------------------------------------------------------
1 | Circular dependency linking:
2 | circ_b.glsl#n=0
3 | circ_a.glsl#n=0
4 |
5 | Fatal: unrecoverable link error (9)
6 |
--------------------------------------------------------------------------------
/test/webgl/glol/circ.002.tout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/circ.002.tout
--------------------------------------------------------------------------------
/test/webgl/glol/circ.argset:
--------------------------------------------------------------------------------
1 | circ_a.glsl
2 | circ_b.glsl
3 |
--------------------------------------------------------------------------------
/test/webgl/glol/circ_a.glsl:
--------------------------------------------------------------------------------
1 | void a() { b(); }
2 |
3 | void main() { b(); }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/circ_b.glsl:
--------------------------------------------------------------------------------
1 | void b() { a(); }
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/conflict.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.001.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* conflict_a.glsl#n=0 */
3 | #define q 1
4 | void f() {}
5 | #undef q
6 | // End: Copyright
7 | // Copyright 2012 <> All rights reserved.
8 | #line 1 1/* conflict_b.glsl#n=0 */
9 | #define q 2
10 | void g() {}
11 | #undef q
12 | // End: Copyright
13 | // Copyright 2012 <> All rights reserved.
14 | #line 1 2/* conflict.glsl#n=0 */
15 | void main() {
16 | f();
17 | g();
18 | }
19 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.002.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/conflict.002.terr
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.002.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* conflict_a.glsl#n=0 */
3 | #define q 1
4 | void f() {}
5 | #undef q
6 | // End: Copyright
7 | // Copyright 2012 <> All rights reserved.
8 | #line 1 1/* conflict_d.glsl#n=0 */
9 | int q() { return 2; }
10 | void g() { }
11 | // End: Copyright
12 | // Copyright 2012 <> All rights reserved.
13 | #line 1 2/* conflict.glsl#n=0 */
14 | void main() {
15 | f();
16 | g();
17 | }
18 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.003.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/conflict.003.terr
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.003.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* conflict_c.glsl#n=0 */
3 | int q() { return 1; }
4 | void f() { }
5 | // End: Copyright
6 | // Copyright 2012 <> All rights reserved.
7 | #line 1 1/* conflict_b.glsl#n=0 */
8 | #define q 2
9 | void g() {}
10 | #undef q
11 | // End: Copyright
12 | // Copyright 2012 <> All rights reserved.
13 | #line 1 2/* conflict.glsl#n=0 */
14 | void main() {
15 | f();
16 | g();
17 | }
18 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.004.terr:
--------------------------------------------------------------------------------
1 | conflict_d.glsl#n=0 provides 'g' but exposes 'q' which conflicts with conflict_c.glsl#n=0
2 |
3 | Fatal: unrecoverable link error (9)
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.004.tout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/conflict.004.tout
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.argset:
--------------------------------------------------------------------------------
1 | conflict.glsl
2 |
3 | conflict_a.glsl
4 | conflict_c.glsl
5 |
6 | conflict_b.glsl
7 | conflict_d.glsl
8 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | f();
3 | g();
4 | }
5 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict_a.glsl:
--------------------------------------------------------------------------------
1 | #define q 1
2 | void f() {}
3 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict_b.glsl:
--------------------------------------------------------------------------------
1 | #define q 2
2 | void g() {}
3 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict_c.glsl:
--------------------------------------------------------------------------------
1 | int q() { return 1; }
2 | void f() { }
3 |
--------------------------------------------------------------------------------
/test/webgl/glol/conflict_d.glsl:
--------------------------------------------------------------------------------
1 | int q() { return 2; }
2 | void g() { }
3 |
--------------------------------------------------------------------------------
/test/webgl/glol/define.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/define.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/define.001.tout:
--------------------------------------------------------------------------------
1 | #define mymain main
2 | // Copyright 2012 <> All rights reserved.
3 | #define foo bar
4 |
5 | // End: Copyright
6 | // Copyright 2012 <> All rights reserved.
7 | #line 1 1/* define.glsl#n=0 */
8 | #if foo
9 | void mymain() {}
10 | #endif
11 |
--------------------------------------------------------------------------------
/test/webgl/glol/define.argset:
--------------------------------------------------------------------------------
1 | --define foo=bar
2 |
3 | --define baz=quux
4 |
5 | -D mymain=main -u mymain
6 |
7 | define.glsl
8 |
--------------------------------------------------------------------------------
/test/webgl/glol/define.glsl:
--------------------------------------------------------------------------------
1 | #if foo
2 | void mymain() {}
3 | #endif
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.001.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.002.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.002.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.002.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.003.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.003.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.003.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.004.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.004.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.004.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.005.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.005.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.005.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.006.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.006.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.006.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.007.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.007.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.007.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.008.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.008.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.008.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.009.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.009.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.009.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.010.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.010.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.010.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.011.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.011.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.011.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.012.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.012.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.012.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.013.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.013.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.013.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.014.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.014.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.014.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.015.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.015.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.015.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.016.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.016.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.016.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.017.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.017.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.017.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.018.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.018.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.018.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.019.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.019.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.019.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.020.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.020.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.020.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.021.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.021.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.021.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.022.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.022.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.022.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.023.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.023.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.023.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.024.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/diamond.024.terr
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.024.tout:
--------------------------------------------------------------------------------
1 | diamond.touts
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.argset:
--------------------------------------------------------------------------------
1 | diamond_0.glsl
2 | diamond_1a.glsl
3 | diamond_1b.glsl
4 | diamond_2.glsl
5 |
--------------------------------------------------------------------------------
/test/webgl/glol/diamond.touts:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* diamond_2.glsl#n=0 */
3 | void f2() { }
4 | // End: Copyright
5 | // Copyright 2012 <> All rights reserved.
6 | #line 1 1/* diamond_1a.glsl#n=0 */
7 | void f1a() { f2(); }
8 | // End: Copyright
9 | // Copyright 2012 <> All rights reserved.
10 | #line 1 2/* diamond_1b.glsl#n=0 */
11 | void f1b() { f2(); }
12 | // End: Copyright
13 | // Copyright 2012 <> All rights reserved.
14 | #line 1 3/* diamond_0.glsl#n=0 */
15 | void main() { f1a(); f1b(); }
16 |
--------------------------------------------------------------------------------
/test/webgl/glol/diamond_0.glsl:
--------------------------------------------------------------------------------
1 | void main() { f1a(); f1b(); }
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/diamond_1a.glsl:
--------------------------------------------------------------------------------
1 | void f1a() { f2(); }
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/diamond_1b.glsl:
--------------------------------------------------------------------------------
1 | void f1b() { f2(); }
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/diamond_2.glsl:
--------------------------------------------------------------------------------
1 | void f2() { }
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/extension.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/extension.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/extension.001.tout:
--------------------------------------------------------------------------------
1 | #extension all : warn
2 | #extension GL_OES_standard_derivatives : require
3 | // Copyright 2012 <> All rights reserved.
4 | #line 4 0/* extension_b.glsl#n=0 */
5 | varying highp float v;
6 |
7 | void foo() { }
8 | // End: Copyright
9 | // Copyright 2012 <> All rights reserved.
10 | #line 4 1/* extension_a.glsl#n=0 */
11 | varying highp float v;
12 |
13 | void main() {
14 | foo();
15 | }
16 |
--------------------------------------------------------------------------------
/test/webgl/glol/extension.argset:
--------------------------------------------------------------------------------
1 | extension_a.glsl extension_b.glsl
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/extension_a.glsl:
--------------------------------------------------------------------------------
1 | #extension all : warn
2 | #extension GL_OES_standard_derivatives : require
3 |
4 | varying highp float v;
5 |
6 | void main() {
7 | foo();
8 | }
9 |
--------------------------------------------------------------------------------
/test/webgl/glol/extension_b.glsl:
--------------------------------------------------------------------------------
1 | #extension all : warn
2 | #extension GL_OES_standard_derivatives : require
3 |
4 | varying highp float v;
5 |
6 | void foo() { }
7 |
--------------------------------------------------------------------------------
/test/webgl/glol/meta.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/meta.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/meta.001.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 Ashima Arts All rights reserved.
2 | // License: BSD-3-Clause
3 | // Author: David Sheets
4 | // Library: glol Test Suite
5 | // Version: 0.0.1 <>
6 | // Build: 9da7afcec5301211b879d021a6f73e2bf6023a89 <>
7 | #line 1 0/* meta.eglo#n=0 */
8 | void main() {}
9 |
--------------------------------------------------------------------------------
/test/webgl/glol/meta.argset:
--------------------------------------------------------------------------------
1 | --meta meta.mglo meta.eglo
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/meta.eglo:
--------------------------------------------------------------------------------
1 | void main() {}
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/meta.mglo:
--------------------------------------------------------------------------------
1 | {
2 | "glo": [ 0, 1, 0 ],
3 | "target": [ "webgl", [ 1, 0, 0 ] ],
4 | "meta": { "copyright": [ 2012, ["Ashima Arts", "http://ashimaarts.com/"] ],
5 | "author": [["David Sheets", "https://github.com/dsheets/"]],
6 | "license": ["BSD-3-Clause","http://www.spdx.org/licenses/BSD-3-Clause"],
7 | "library": ["glol Test Suite","https://github.com/ashima/gloc/tree/master/test/webgl/glol"],
8 | "version": [[0,0,1],""],
9 | "build": ["9da7afcec5301211b879d021a6f73e2bf6023a89",""]
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/test/webgl/glol/monkey.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/monkey.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/monkey.001.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* monkey.glo/monkey_c.glsl#n=0 */
3 | void bar() {
4 |
5 | }
6 | // End: Copyright
7 | // Copyright 2012 <> All rights reserved.
8 | #line 1 1/* monkey.glo/monkey_b.glsl#n=0 */
9 | void foo() {
10 |
11 | }
12 | // End: Copyright
13 | // Copyright 2012 <> All rights reserved.
14 | #line 1 2/* monkey.glo/monkey_a.glsl#n=0 */
15 | void main() {
16 | foo();
17 | }
18 |
--------------------------------------------------------------------------------
/test/webgl/glol/monkey.002.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/monkey.002.terr
--------------------------------------------------------------------------------
/test/webgl/glol/monkey.002.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* monkey.glo/monkey_c.glsl#n=0 */
3 | void bar() {
4 |
5 | }
6 | // End: Copyright
7 | // Copyright 2012 <> All rights reserved.
8 | #define foo bar
9 |
10 | // End: Copyright
11 | // Copyright 2012 <> All rights reserved.
12 | #line 1 2/* monkey.glo/monkey_a.glsl#n=0 */
13 | void main() {
14 | foo();
15 | }
16 |
--------------------------------------------------------------------------------
/test/webgl/glol/monkey.003.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/monkey.003.terr
--------------------------------------------------------------------------------
/test/webgl/glol/monkey.003.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* monkey.glo/monkey_b.glsl#n=0 */
3 | void foo() {
4 |
5 | }
6 | // End: Copyright
7 | // Copyright 2012 <> All rights reserved.
8 | #line 1 1/* monkey.glo/monkey_a.glsl#n=0 */
9 | void main() {
10 | foo();
11 | }
12 | // End: Copyright
13 | // Copyright 2012 <> All rights reserved.
14 | #line 1 2/* monkey.glo/monkey_c.glsl#n=0 */
15 | void bar() {
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/test/webgl/glol/monkey.004.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/monkey.004.terr
--------------------------------------------------------------------------------
/test/webgl/glol/monkey.004.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #define foo bar
3 |
4 | // End: Copyright
5 | // Copyright 2012 <> All rights reserved.
6 | #line 1 1/* monkey.glo/monkey_a.glsl#n=0 */
7 | void main() {
8 | foo();
9 | }
10 | // End: Copyright
11 | // Copyright 2012 <> All rights reserved.
12 | #line 1 2/* monkey.glo/monkey_c.glsl#n=0 */
13 | void bar() {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/test/webgl/glol/monkey.argset:
--------------------------------------------------------------------------------
1 | -u main
2 | -u bar
3 |
4 | monkey.glo
5 | --define foo=bar
6 |
--------------------------------------------------------------------------------
/test/webgl/glol/monkey_a.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | foo();
3 | }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/monkey_b.glsl:
--------------------------------------------------------------------------------
1 | void foo() {
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/monkey_c.glsl:
--------------------------------------------------------------------------------
1 | void bar() {
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/multipath.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/multipath.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/multipath.001.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* multipath.glsl#n=0 */
3 | void b() { }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/multipath.argset:
--------------------------------------------------------------------------------
1 | multipath.eglo -u b
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/multipath.eglo:
--------------------------------------------------------------------------------
1 | [["multipath.glsl",{"glo":[1,0,0],"target":["webgl",[1,0,0]],"meta":{"copyright":[2012,["",""]]},"units":[{"outsym":["a"],"source":"#line 1 GLOC_0\nvoid a() { }"}],"linkmap":{"0":"#n=0"}}],["multipath.glsl",{"glo":[1,0,0],"target":["webgl",[1,0,0]],"meta":{"copyright":[2012,["",""]]},"units":[{"outsym":["b"],"source":"#line 1 GLOC_0\nvoid b() { }"}],"linkmap":{"0":"#n=0"}}]]
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/multipath.glsl:
--------------------------------------------------------------------------------
1 | void a() { }
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/multipath2.glsl:
--------------------------------------------------------------------------------
1 | void b() { }
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/nomacro.001.terr:
--------------------------------------------------------------------------------
1 | nomacro.glsl#n=0 requires macro 'MISSING' which cannot be found.
2 |
3 | Fatal: unrecoverable link error (9)
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/nomacro.001.tout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/nomacro.001.tout
--------------------------------------------------------------------------------
/test/webgl/glol/nomacro.argset:
--------------------------------------------------------------------------------
1 | -u q nomacro.glsl
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/nomacro.glsl:
--------------------------------------------------------------------------------
1 | #if MISSING
2 | int q() { return 0; }
3 | #else
4 | int q() { return 1; }
5 | #endif
6 |
--------------------------------------------------------------------------------
/test/webgl/glol/nosym.001.terr:
--------------------------------------------------------------------------------
1 | nosym.glsl#n=0 requires symbol 'missing' which cannot be found.
2 |
3 | Fatal: unrecoverable link error (9)
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/nosym.001.tout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/nosym.001.tout
--------------------------------------------------------------------------------
/test/webgl/glol/nosym.argset:
--------------------------------------------------------------------------------
1 | nosym.glsl
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/nosym.glsl:
--------------------------------------------------------------------------------
1 | void main() { missing(); }
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/pragma.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/pragma.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/pragma.001.tout:
--------------------------------------------------------------------------------
1 | #pragma STDGL invariant(all)/* holy*/
2 | // Copyright 2012 <> All rights reserved.
3 | #line 1 0/* pragma_b.glsl#n=0 */
4 | #pragma optimize(on)
5 |
6 | void f() { }
7 |
8 | #pragma optimize(off)
9 | // End: Copyright
10 | // Copyright 2012 <> All rights reserved.
11 | #line 3 1/* pragma_a.glsl#n=0 */
12 | void main() { f(); }
13 |
--------------------------------------------------------------------------------
/test/webgl/glol/pragma.argset:
--------------------------------------------------------------------------------
1 | pragma_a.glsl pragma_b.glsl
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/pragma_a.glsl:
--------------------------------------------------------------------------------
1 | #pragma STDGL invariant(all) // holy
2 |
3 | void main() { f(); }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/pragma_b.glsl:
--------------------------------------------------------------------------------
1 | #pragma optimize(on)
2 |
3 | void f() { }
4 |
5 | #pragma optimize(off)
6 |
--------------------------------------------------------------------------------
/test/webgl/glol/regex_line_dir.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/regex_line_dir.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/regex_line_dir.001.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 211/* regex_line_dir.glsl#n=211 */
3 | void f() {}
4 | #line 1 21/* regex_line_dir.glsl#n=21 */
5 | void g() {}
6 | #line 1 2/* regex_line_dir.glsl#n=2 */
7 | void h() {}
8 | #line 1 2111/* regex_line_dir.glsl#n=2111 */
9 | void j() {}
10 | #line 1 21111/* regex_line_dir.glsl#n=21111 */
11 | void main() {}
12 |
--------------------------------------------------------------------------------
/test/webgl/glol/regex_line_dir.argset:
--------------------------------------------------------------------------------
1 | regex_line_dir.glsl
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/regex_line_dir.glsl:
--------------------------------------------------------------------------------
1 | #line 1 211
2 | void f() {}
3 | #line 1 21
4 | void g() {}
5 | #line 1 2
6 | void h() {}
7 | #line 1 2111
8 | void j() {}
9 | #line 1 21111
10 | void main() {}
11 |
--------------------------------------------------------------------------------
/test/webgl/glol/shadow.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/shadow.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/shadow.001.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* shadow_a.glsl#n=0 */
3 | void main() {
4 | /* a*/
5 | }
6 |
--------------------------------------------------------------------------------
/test/webgl/glol/shadow.002.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/shadow.002.terr
--------------------------------------------------------------------------------
/test/webgl/glol/shadow.002.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* shadow_b.glsl#n=0 */
3 | void main() {
4 | /* b*/
5 | }
6 |
--------------------------------------------------------------------------------
/test/webgl/glol/shadow.argset:
--------------------------------------------------------------------------------
1 | shadow_a.glsl
2 | shadow_b.glsl
3 |
--------------------------------------------------------------------------------
/test/webgl/glol/shadow_a.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | // a
3 | }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/shadow_b.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | // b
3 | }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/shadow_glom.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/shadow_glom.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/shadow_glom.001.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* shadow_glom.001.glo/shadow_a.glsl#n=0 */
3 | void main() {
4 | /* a*/
5 | }
6 |
--------------------------------------------------------------------------------
/test/webgl/glol/shadow_glom.002.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/shadow_glom.002.terr
--------------------------------------------------------------------------------
/test/webgl/glol/shadow_glom.002.tout:
--------------------------------------------------------------------------------
1 | // Copyright 2012 <> All rights reserved.
2 | #line 1 0/* shadow_glom.002.glo/shadow_b.glsl#n=0 */
3 | void main() {
4 | /* b*/
5 | }
6 |
--------------------------------------------------------------------------------
/test/webgl/glol/shadow_glom.argset:
--------------------------------------------------------------------------------
1 | shadow_glom.001.glo
2 | shadow_glom.002.glo
3 |
--------------------------------------------------------------------------------
/test/webgl/glol/test_page.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Tests
4 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/webgl/glol/version.001.terr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/glol/version.001.terr
--------------------------------------------------------------------------------
/test/webgl/glol/version.001.tout:
--------------------------------------------------------------------------------
1 | #version 100
2 | // Copyright 2012 <> All rights reserved.
3 | #line 3 0/* version_a.glsl#n=0 */
4 | void f() { }
5 | // End: Copyright
6 | // Copyright 2012 <> All rights reserved.
7 | #line 3 1/* version_100.glsl#n=0 */
8 | void main() { f(); }
9 |
--------------------------------------------------------------------------------
/test/webgl/glol/version.argset:
--------------------------------------------------------------------------------
1 | version_100.glsl version_a.glsl
2 |
--------------------------------------------------------------------------------
/test/webgl/glol/version_100.glsl:
--------------------------------------------------------------------------------
1 | #version 100
2 |
3 | void main() { f(); }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/version_101.glsl:
--------------------------------------------------------------------------------
1 | #version 101
2 |
3 | void main() { f(); }
4 |
--------------------------------------------------------------------------------
/test/webgl/glol/version_a.glsl:
--------------------------------------------------------------------------------
1 | #version 100
2 |
3 | void f() { }
4 |
--------------------------------------------------------------------------------
/test/webgl/pp/.gitignore:
--------------------------------------------------------------------------------
1 | *.diff
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/Makefile:
--------------------------------------------------------------------------------
1 | PP = OCAMLRUNPARAM=b ../../../src/gloc.d.byte -E
2 |
3 | INS := $(wildcard *.in)
4 | OUTS := $(INS:.in=.out)
5 |
6 | %.out : %.in %.true
7 | @$(PP) < $*.in &> $@ || true
8 | @if diff -u $*.true $@ > $*.diff; then \
9 | rm $*.diff;\
10 | else cat $*.diff;\
11 | fi
12 |
13 | .PHONY : all test clean
14 | all :
15 | @$(MAKE) clean
16 | @$(MAKE) test
17 | test : $(OUTS)
18 | @printf "Test failures: "
19 | @ls *.diff 2> /dev/null | wc -l
20 | clean :
21 | @rm *.out *.diff 2> /dev/null || true
22 | %.git : %.in %.out %.true
23 | git add $^
24 | %.new :
25 | touch $*.in
26 | echo "error" > $*.true
27 |
--------------------------------------------------------------------------------
/test/webgl/pp/arg_commas.in:
--------------------------------------------------------------------------------
1 | #define F(Q,) Q
2 |
3 | void main() { F(4); }
4 |
--------------------------------------------------------------------------------
/test/webgl/pp/arg_commas.out:
--------------------------------------------------------------------------------
1 |
2 |
3 | void main() { 4 ; }
4 |
--------------------------------------------------------------------------------
/test/webgl/pp/arg_commas.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/arg_flag.in:
--------------------------------------------------------------------------------
1 | #define A B A
2 | #define J(A) A
3 | void main() { J(A); }
4 |
--------------------------------------------------------------------------------
/test/webgl/pp/arg_flag.out:
--------------------------------------------------------------------------------
1 |
2 |
3 | void main() {
4 | #line 1
5 | B A
6 |
7 | ; }
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/arg_flag.true:
--------------------------------------------------------------------------------
1 |
2 |
3 | void main() {
4 | #line 1
5 | B A
6 |
7 | ; }
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/arg_scope.in:
--------------------------------------------------------------------------------
1 | #define J(h) h
2 | void main() { J(h); }
3 |
--------------------------------------------------------------------------------
/test/webgl/pp/arg_scope.out:
--------------------------------------------------------------------------------
1 |
2 | void main() { h ; }
3 |
--------------------------------------------------------------------------------
/test/webgl/pp/arg_scope.true:
--------------------------------------------------------------------------------
1 |
2 | void main() { h ; }
3 |
--------------------------------------------------------------------------------
/test/webgl/pp/block_comments.in:
--------------------------------------------------------------------------------
1 | // a header comment
2 | /* more
3 | header
4 | comments */
5 |
6 | /* pre-directive comment */#error OK
7 | #/* pre-command comment */error OK
8 | /**/#/**/error/*
9 | */OK part of/*
10 | */directive
11 |
12 | #error OK // eol comment
13 |
14 | /* comment */#/* more comment */// more comment
15 |
16 | // comment trailer
17 | /* more trailer
18 | comments
19 | */// final trailer
20 |
--------------------------------------------------------------------------------
/test/webgl/pp/block_comments.out:
--------------------------------------------------------------------------------
1 | File 0, line 6, col 27 - 36:
2 | /* pre-directive comment */ #error OK
3 |
4 | File 0, line 7, col 25 - 34:
5 | /* pre-command comment */ #error OK
6 |
7 | File 0, l8 c8 - l10 c11:
8 | /* */ #error/*
9 | */OK part of/*
10 | */directive
11 |
12 | File 0, line 12, col 0 - 9:
13 | #error OK/* eol comment*/
14 |
15 | Fatal: unrecoverable preprocessor error (5)
16 |
--------------------------------------------------------------------------------
/test/webgl/pp/block_comments.true:
--------------------------------------------------------------------------------
1 | File 0, line 6, col 27 - 36:
2 | /* pre-directive comment */ #error OK
3 |
4 | File 0, line 7, col 25 - 34:
5 | /* pre-command comment */ #error OK
6 |
7 | File 0, l8 c8 - l10 c11:
8 | /* */ #error/*
9 | */OK part of/*
10 | */directive
11 |
12 | File 0, line 12, col 0 - 9:
13 | #error OK/* eol comment*/
14 |
15 | Fatal: unrecoverable preprocessor error (5)
16 |
--------------------------------------------------------------------------------
/test/webgl/pp/builtin_macros.in:
--------------------------------------------------------------------------------
1 | void main() { gl_Position = vec4(__LINE__,__FILE__,__VERSION__,GL_ES); }
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/builtin_macros.out:
--------------------------------------------------------------------------------
1 | void main() { gl_Position = vec4(1 ,0 ,100 ,1 ); }
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/builtin_macros.true:
--------------------------------------------------------------------------------
1 | void main() { gl_Position = vec4(1 ,0 ,100 ,1 ); }
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/conditional_error.in:
--------------------------------------------------------------------------------
1 | #if 0
2 | #error this should never error
3 | #endif
4 | void main() {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/test/webgl/pp/conditional_error.out:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | void main() {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/test/webgl/pp/conditional_error.true:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | void main() {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/test/webgl/pp/deferred_cond.in:
--------------------------------------------------------------------------------
1 | #if E
2 | #define X 1
3 | #else
4 | #define X 2
5 | #endif
6 |
7 | void main() { X; }
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/deferred_cond.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 4 - 5:
2 | ambiguous preprocessor conditional branch: E
3 |
4 | Fatal: unrecoverable preprocessor divergence (6)
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/deferred_cond.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 4 - 5:
2 | ambiguous preprocessor conditional branch: E
3 |
4 | Fatal: unrecoverable preprocessor divergence (6)
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/defined_macro.in:
--------------------------------------------------------------------------------
1 | #define D defined
2 | #if D F
3 | void hidden() {}
4 | #endif
5 | #if D D
6 | void recurse() {}
7 | #endif
8 | #if !D Q
9 | #define Q 7
10 | void D(int);
11 | void main() {
12 | D(Q);
13 | }
14 | #endif
15 |
16 | void defined(int q) {
17 | #define defined 4 +
18 | D Q;
19 | }
20 |
21 | void foo() {
22 | defined(Q);
23 | }
24 |
--------------------------------------------------------------------------------
/test/webgl/pp/defined_macro.out:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | void recurse() {}
7 |
8 |
9 |
10 | void
11 | #line 1
12 | defined
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | (int);
22 | void main() {
23 | #line 1
24 | defined
25 | #line 12
26 | (
27 | #line 9
28 | 7
29 |
30 |
31 | );
32 | }
33 |
34 |
35 | void defined(int q) {
36 | 4 +
37 | #line 9
38 | 7
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | ;
48 | }
49 |
50 | void foo() {
51 | #line 17
52 | 4 +
53 |
54 |
55 |
56 |
57 | (
58 | #line 9
59 | 7
60 | #line 22
61 | );
62 | }
63 |
--------------------------------------------------------------------------------
/test/webgl/pp/defined_macro.true:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | void recurse() {}
7 |
8 |
9 |
10 | void
11 | #line 1
12 | defined
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | (int);
22 | void main() {
23 | #line 1
24 | defined
25 | #line 12
26 | (
27 | #line 9
28 | 7
29 |
30 |
31 | );
32 | }
33 |
34 |
35 | void defined(int q) {
36 | 4 +
37 | #line 9
38 | 7
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | ;
48 | }
49 |
50 | void foo() {
51 | #line 17
52 | 4 +
53 |
54 |
55 |
56 |
57 | (
58 | #line 9
59 | 7
60 | #line 22
61 | );
62 | }
63 |
--------------------------------------------------------------------------------
/test/webgl/pp/directive_in_macro_args.in:
--------------------------------------------------------------------------------
1 | #define Q(A,B) ((A)+(B))
2 |
3 | Q(
4 | #define J 4
5 | J
6 | #undef J
7 | ,
8 | #define J 5
9 | J)
10 |
11 | Q(
12 | #if J==5
13 | J
14 | #else
15 | 1
16 | #endif
17 | ,
18 | #if J!=5
19 | J
20 | #else
21 | 1
22 | #endif
23 | )
24 |
--------------------------------------------------------------------------------
/test/webgl/pp/directive_in_macro_args.out:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 1 - 2:
2 | unclosed macro argument list
3 |
4 | File 0, line 3, col 0 - 1:
5 | too few macro arguments: expected 2, got 1
6 |
7 | File 0, line 11, col 1 - 2:
8 | unclosed macro argument list
9 |
10 | File 0, line 11, col 0 - 1:
11 | too few macro arguments: expected 2, got 1
12 |
13 | Fatal: unrecoverable preprocessor error (5)
14 |
--------------------------------------------------------------------------------
/test/webgl/pp/directive_in_macro_args.true:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 1 - 2:
2 | unclosed macro argument list
3 |
4 | File 0, line 3, col 0 - 1:
5 | too few macro arguments: expected 2, got 1
6 |
7 | File 0, line 11, col 1 - 2:
8 | unclosed macro argument list
9 |
10 | File 0, line 11, col 0 - 1:
11 | too few macro arguments: expected 2, got 1
12 |
13 | Fatal: unrecoverable preprocessor error (5)
14 |
--------------------------------------------------------------------------------
/test/webgl/pp/directive_jumble.in:
--------------------------------------------------------------------------------
1 | #version 100
2 | /*comment*/#error foo
3 | #/*again*/error bar
4 | #error baz/*third*/
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/directive_jumble.out:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 11 - 21:
2 | /* comment */ #error foo
3 |
4 | File 0, line 3, col 9 - 19:
5 | /* again */ #error bar
6 |
7 | File 0, line 4, col 0 - 10:
8 | #error baz/*third*/
9 |
10 | Fatal: unrecoverable preprocessor error (5)
11 |
--------------------------------------------------------------------------------
/test/webgl/pp/directive_jumble.true:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 11 - 21:
2 | /* comment */ #error foo
3 |
4 | File 0, line 3, col 9 - 19:
5 | /* again */ #error bar
6 |
7 | File 0, line 4, col 0 - 10:
8 | #error baz/*third*/
9 |
10 | Fatal: unrecoverable preprocessor error (5)
11 |
--------------------------------------------------------------------------------
/test/webgl/pp/empty_cond.in:
--------------------------------------------------------------------------------
1 | #if defined E
2 | #else
3 | #endif
4 |
5 | void main() {}
6 |
--------------------------------------------------------------------------------
/test/webgl/pp/empty_cond.out:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | void main() {}
6 |
--------------------------------------------------------------------------------
/test/webgl/pp/empty_cond.true:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | void main() {}
6 |
--------------------------------------------------------------------------------
/test/webgl/pp/fnmacro_breaks.in:
--------------------------------------------------------------------------------
1 | void Q(int a,int b){}
2 |
3 | #define Q(A,B) ((A)+(B))
4 | #define P Q
5 | #define O Q(
6 | #define N Q(5
7 | #define M Q(6,
8 | #define L Q(7,8
9 | #define K Q(9,10)
10 | #define LP (
11 | #define RP )
12 | #define C ,
13 |
14 | #line 1000
15 |
16 | void foo();
17 |
18 | void main() {
19 | Q(1,2);
20 | P(3,4);
21 | O 3,4);
22 | N,6);
23 | M 7);
24 | L);
25 | K;
26 | P LP -1 C -2 RP;
27 | // Q(-3 C -4); // fails because C doesn't expand fast enough
28 | // Q(-3 , -4 RP; // fails because RP doesn't expand fast enough
29 |
30 | }
31 |
32 | #define H (6,7),Q
33 | #define G(X) APP(X)
34 | #define APP(ARGS,FN) FN ARGS
35 | #line 2000
36 |
37 | void foo() {
38 | APP((6,7),Q);
39 | G(H);
40 | }
41 |
--------------------------------------------------------------------------------
/test/webgl/pp/fnmacro_prescan.in:
--------------------------------------------------------------------------------
1 | #define A(B) ((B)/2)
2 | #define Z(A) ((A)*2)
3 | #define Q(A,B) A(B)
4 | #define J A(2) + Q
5 |
6 | void main() {
7 | Q(Z,Q(Z,7));
8 | J(Z,J(Z,7));
9 | }
10 |
--------------------------------------------------------------------------------
/test/webgl/pp/fnmacro_prescan.out:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | void main() {
7 | #line 2
8 | (( ( (
9 |
10 |
11 |
12 |
13 | 7
14 | #line 2
15 | )*2) ) * 2 )
16 |
17 |
18 |
19 |
20 | ;
21 | #line 1
22 | ((
23 |
24 |
25 | 2
26 | #line 1
27 | )/2)
28 |
29 |
30 | +
31 | #line 2
32 | ((
33 | #line 1
34 | ((
35 |
36 |
37 | 2
38 | #line 1
39 | )/2)
40 |
41 |
42 | +
43 | #line 2
44 | ((
45 |
46 |
47 |
48 |
49 |
50 | 7
51 | #line 2
52 | )*2) ) * 2 )
53 |
54 |
55 |
56 |
57 |
58 | ;
59 | }
60 |
--------------------------------------------------------------------------------
/test/webgl/pp/fnmacro_prescan.true:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | void main() {
7 | #line 2
8 | (( ( (
9 |
10 |
11 |
12 |
13 | 7
14 | #line 2
15 | )*2) ) * 2 )
16 |
17 |
18 |
19 |
20 | ;
21 | #line 1
22 | ((
23 |
24 |
25 | 2
26 | #line 1
27 | )/2)
28 |
29 |
30 | +
31 | #line 2
32 | ((
33 | #line 1
34 | ((
35 |
36 |
37 | 2
38 | #line 1
39 | )/2)
40 |
41 |
42 | +
43 | #line 2
44 | ((
45 |
46 |
47 |
48 |
49 |
50 | 7
51 | #line 2
52 | )*2) ) * 2 )
53 |
54 |
55 |
56 |
57 |
58 | ;
59 | }
60 |
--------------------------------------------------------------------------------
/test/webgl/pp/glom_pp.in:
--------------------------------------------------------------------------------
1 | [["glom_pp_a.glsl",{"glo":[0,1,0],"target":["webgl",[1,0,0]],"meta":{"copyright":[2011,["",""]],"author":[],"license":null,"library":null,"version":null,"build":null},"units":[{"insym":[],"outsym":["b","a"],"inmac":[],"opmac":[],"outmac":[],"source":"#line 1 GLOC_0\nvoid a() {}"}],"linkmap":{"0":"glom_pp_a.glsl#0"}}],["glom_pp_b.glsl",{"glo":[0,1,0],"target":["webgl",[1,0,0]],"meta":{"copyright":[2011,["",""]],"author":[],"license":null,"library":null,"version":null,"build":null},"units":[{"insym":[],"outsym":["b"],"inmac":[],"opmac":[],"outmac":[],"source":"#line 1 GLOC_0\nvoid b() {}"}],"linkmap":{"0":"glom_pp_b.glsl#0"}}]]
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/glom_pp.out:
--------------------------------------------------------------------------------
1 | Source '-' is a glom with multiple source units.
2 |
3 | Fatal: unrecoverable preprocessor divergence (6)
4 |
--------------------------------------------------------------------------------
/test/webgl/pp/glom_pp.true:
--------------------------------------------------------------------------------
1 | Source '-' is a glom with multiple source units.
2 |
3 | Fatal: unrecoverable preprocessor divergence (6)
4 |
--------------------------------------------------------------------------------
/test/webgl/pp/glom_pp_a.glsl:
--------------------------------------------------------------------------------
1 | void a() {}
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/glom_pp_b.glsl:
--------------------------------------------------------------------------------
1 | void b() {}
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/holy_version.in:
--------------------------------------------------------------------------------
1 | #error this is fine
2 | #version 100 // but Holy Version shalln't be preceded by a semantic token!
3 |
--------------------------------------------------------------------------------
/test/webgl/pp/holy_version.out:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 0 - 12:
2 | version must be first semantic token
3 |
4 | File 0, line 1, col 0 - 19:
5 | #error this is fine
6 |
7 | Fatal: unrecoverable preprocessor error (5)
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/holy_version.true:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 0 - 12:
2 | version must be first semantic token
3 |
4 | File 0, line 1, col 0 - 19:
5 | #error this is fine
6 |
7 | Fatal: unrecoverable preprocessor error (5)
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/invalid_version_number.in:
--------------------------------------------------------------------------------
1 | #version 101 // only 100
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/invalid_version_number.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 9 - 12:
2 | version 101 is unsupported
3 |
4 | Fatal: unrecoverable preprocessor error (5)
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/invalid_version_number.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 9 - 12:
2 | version 101 is unsupported
3 |
4 | Fatal: unrecoverable preprocessor error (5)
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_arity.in:
--------------------------------------------------------------------------------
1 | int Q;
2 | int J;
3 | void foo() {}
4 |
5 | #define Q() 7
6 | void main() {
7 | Q;
8 | Q();
9 | #undef Q
10 | #define Q J
11 | Q;
12 | #undef Q
13 | #define Q foo
14 | Q();
15 | }
16 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_arity.out:
--------------------------------------------------------------------------------
1 | int Q;
2 | int J;
3 | void foo() {}
4 |
5 |
6 | void main() {
7 | Q;
8 | #line 5
9 | 7
10 |
11 |
12 | ;
13 |
14 | J
15 | ;
16 |
17 | foo
18 | ();
19 | }
20 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_arity.true:
--------------------------------------------------------------------------------
1 | int Q;
2 | int J;
3 | void foo() {}
4 |
5 |
6 | void main() {
7 | Q;
8 | #line 5
9 | 7
10 |
11 |
12 | ;
13 |
14 | J
15 | ;
16 |
17 | foo
18 | ();
19 | }
20 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_cond.in:
--------------------------------------------------------------------------------
1 | #define Q
2 | #line 100
3 | #define J defined Q
4 | #if J
5 | void foo() {}
6 | #else
7 | void bad_foo() {}
8 | #endif
9 | #undef Q
10 | #if !J
11 | void remote_defined() {}
12 | #else
13 | void bad_remote_defined() {}
14 | #endif
15 |
16 | #line 1000
17 | #define A 1
18 | #define B 2
19 | #define OP defined
20 | #if OP A && OP B
21 | #define Q 7
22 | #endif
23 | int blah() { return Q; }
24 | #if OP W
25 | #define Q 77
26 | #endif
27 | void main() { gl_Position = Q; }
28 | #define defined Q
29 | #if defined < 100
30 | int baz() { return defined; }
31 | #endif
32 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_cond.out:
--------------------------------------------------------------------------------
1 | #line 102
2 | void foo() {}
3 |
4 |
5 |
6 |
7 |
8 | void remote_defined() {}
9 | #line 1006
10 | int blah() { return
11 | #line 1004
12 | 7
13 |
14 | ; }
15 |
16 |
17 |
18 | void main() { gl_Position =
19 | #line 1004
20 | 7
21 |
22 |
23 |
24 |
25 |
26 | ; }
27 |
28 |
29 | int baz() { return
30 | #line 1004
31 | 7
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | ; }
41 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_cond.true:
--------------------------------------------------------------------------------
1 | #line 102
2 | void foo() {}
3 |
4 |
5 |
6 |
7 |
8 | void remote_defined() {}
9 | #line 1006
10 | int blah() { return
11 | #line 1004
12 | 7
13 |
14 | ; }
15 |
16 |
17 |
18 | void main() { gl_Position =
19 | #line 1004
20 | 7
21 |
22 |
23 |
24 |
25 |
26 | ; }
27 |
28 |
29 | int baz() { return
30 | #line 1004
31 | 7
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | ; }
41 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_redef.in:
--------------------------------------------------------------------------------
1 | #define A
2 | #define A
3 |
4 | #define B 1
5 | #define B 1
6 |
7 | #define C 1
8 | //#define C 2 // this is the only illegal one
9 |
10 | void foo() {
11 | __LINE__;
12 | __FILE__;
13 | }
14 |
15 | #if GL_ES
16 | #define __FILE__ 6
17 | #else
18 | #define __FILE__ foo
19 | #endif
20 | #define __LINE__ 1000
21 |
22 | void bar() {
23 | __LINE__;
24 | __FILE__;
25 | }
26 |
27 | #undef __FILE__
28 | #undef __LINE__
29 |
30 | #if GL_ES
31 | #define __FILE__ 13
32 | #else
33 | #define __FILE__ bar
34 | #endif
35 | #define __LINE__ 6000
36 |
37 | void main() {
38 | __LINE__;
39 | __FILE__;
40 | }
41 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_redef.out:
--------------------------------------------------------------------------------
1 | File 0, line 16, col 8 - 16:
2 | "__FILE__" is a reserved macro and may not be redefined
3 |
4 | File 0, line 20, col 8 - 16:
5 | "__LINE__" is a reserved macro and may not be redefined
6 |
7 | File 0, line 27, col 7 - 15:
8 | "__FILE__" is a reserved macro and may not be undefined
9 |
10 | File 0, line 28, col 7 - 15:
11 | "__LINE__" is a reserved macro and may not be undefined
12 |
13 | File 0, line 31, col 8 - 16:
14 | "__FILE__" is a reserved macro and may not be redefined
15 |
16 | File 0, line 35, col 8 - 16:
17 | "__LINE__" is a reserved macro and may not be redefined
18 |
19 | Fatal: unrecoverable preprocessor error (5)
20 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_redef.true:
--------------------------------------------------------------------------------
1 | File 0, line 16, col 8 - 16:
2 | "__FILE__" is a reserved macro and may not be redefined
3 |
4 | File 0, line 20, col 8 - 16:
5 | "__LINE__" is a reserved macro and may not be redefined
6 |
7 | File 0, line 27, col 7 - 15:
8 | "__FILE__" is a reserved macro and may not be undefined
9 |
10 | File 0, line 28, col 7 - 15:
11 | "__LINE__" is a reserved macro and may not be undefined
12 |
13 | File 0, line 31, col 8 - 16:
14 | "__FILE__" is a reserved macro and may not be redefined
15 |
16 | File 0, line 35, col 8 - 16:
17 | "__LINE__" is a reserved macro and may not be redefined
18 |
19 | Fatal: unrecoverable preprocessor error (5)
20 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_scopes.in:
--------------------------------------------------------------------------------
1 | #define Q(A) foo((A)*2)
2 | void bar() {
3 | Q(6); Q;
4 | }
5 | #undef Q
6 |
7 | #define Q foo
8 | void main() {
9 | Q(7); Q;
10 | }
11 | #undef Q
12 |
13 | #define Q foo
14 | #define Q(A) foo((A)*2)
15 | void foo() {
16 | Q(10); Q (4); Q;
17 | }
18 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_scopes.out:
--------------------------------------------------------------------------------
1 |
2 | void bar() {
3 | #line 1
4 | foo((
5 |
6 | 6
7 | #line 1
8 | )*2)
9 |
10 | ; Q;
11 | }
12 |
13 |
14 |
15 | void main() {
16 | #line 7
17 | foo
18 |
19 | (7);
20 | #line 7
21 | foo
22 |
23 | ;
24 | }
25 |
26 |
27 |
28 |
29 | void foo() {
30 | #line 14
31 | foo((
32 |
33 | 10
34 | #line 14
35 | )*2)
36 |
37 | ;
38 | #line 14
39 | foo((
40 |
41 | 4
42 | #line 14
43 | )*2)
44 |
45 | ; Q;
46 | }
47 |
--------------------------------------------------------------------------------
/test/webgl/pp/macro_scopes.true:
--------------------------------------------------------------------------------
1 |
2 | void bar() {
3 | #line 1
4 | foo((
5 |
6 | 6
7 | #line 1
8 | )*2)
9 |
10 | ; Q;
11 | }
12 |
13 |
14 |
15 | void main() {
16 | #line 7
17 | foo
18 |
19 | (7);
20 | #line 7
21 | foo
22 |
23 | ;
24 | }
25 |
26 |
27 |
28 |
29 | void foo() {
30 | #line 14
31 | foo((
32 |
33 | 10
34 | #line 14
35 | )*2)
36 |
37 | ;
38 | #line 14
39 | foo((
40 |
41 | 4
42 | #line 14
43 | )*2)
44 |
45 | ; Q;
46 | }
47 |
--------------------------------------------------------------------------------
/test/webgl/pp/mscoped_directives.in:
--------------------------------------------------------------------------------
1 | #error __LINE__ is the line of the error directive
2 | #line __LINE__ __FILE__
3 | #ifdef GL_ES
4 | #define L 666 7
5 | #else
6 | #define L 666 "foo"
7 | #endif
8 | #line L
9 | void main() { return 0; } // error on line 666, file 7 or file "foo" if c++
10 |
--------------------------------------------------------------------------------
/test/webgl/pp/mscoped_directives.out:
--------------------------------------------------------------------------------
1 | File 0, line 2, col 0 - 5:
2 | invalid line argument
3 |
4 | File 0, line 6, col 14 - 15:
5 | unknown character '"'
6 |
7 | File 0, line 6, col 18 - 19:
8 | unknown character '"'
9 |
10 | File 0, line 8, col 0 - 5:
11 | invalid line argument
12 |
13 | Fatal: unrecoverable preprocessor parse error (4)
14 |
--------------------------------------------------------------------------------
/test/webgl/pp/mscoped_directives.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/multi_branch.in:
--------------------------------------------------------------------------------
1 | #ifdef Q
2 | #else
3 | #ifdef J
4 | #if K
5 | #endif
6 | #elif defined V
7 | #elif defined F
8 | #else
9 | void main() {}
10 | #endif
11 | #endif
12 |
--------------------------------------------------------------------------------
/test/webgl/pp/multi_branch.out:
--------------------------------------------------------------------------------
1 | #line 9
2 | void main() {}
3 |
--------------------------------------------------------------------------------
/test/webgl/pp/multi_branch.true:
--------------------------------------------------------------------------------
1 | #line 9
2 | void main() {}
3 |
--------------------------------------------------------------------------------
/test/webgl/pp/multiglo_pp.in:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsheets/gloc/d5917c072ec314ae93a61344da2407f520fac1b5/test/webgl/pp/multiglo_pp.in
--------------------------------------------------------------------------------
/test/webgl/pp/multiglo_pp.out:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/multiglo_pp.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/pp/op_prec.in:
--------------------------------------------------------------------------------
1 | #if -5 * +3 + +3 == -12
2 | void pos_neg_mul_add() {}
3 | #endif
4 |
5 | #if 3+12/2%5==4
6 | void add_div_mod() {}
7 | #endif
8 |
9 | #if 3+5<<1 == 2*2*2*2*2>>1
10 | void add_shift_mul_shift() {}
11 | #endif
12 |
13 | #if 4 + 3 < 8 == 5 > 2*2
14 | void add_rel_eq_rel_mul() {}
15 | #endif
16 |
17 | #if 4 != 3 == 1
18 | void neq_eq() {}
19 | #endif
20 |
21 | #if (2 | 4 != 3)==3
22 | void bitor_neq_paren_eq() {}
23 | #endif
24 |
25 | #if (15 & 11 ^ 31 & 15) == 4
26 | void bitand_bitxor_bitand() {}
27 | #endif
28 |
29 | #if (4 | 2 ^ 7 & 3) == 5
30 | void bitor_bitxor_bitand() {}
31 | #endif
32 |
33 | #if 0 || 4 && 0 == 0
34 | void or_and_eq() {}
35 | #endif
36 |
--------------------------------------------------------------------------------
/test/webgl/pp/op_prec.out:
--------------------------------------------------------------------------------
1 |
2 | void pos_neg_mul_add() {}
3 |
4 |
5 |
6 | void add_div_mod() {}
7 |
8 |
9 |
10 | void add_shift_mul_shift() {}
11 |
12 |
13 |
14 | void add_rel_eq_rel_mul() {}
15 |
16 |
17 |
18 | void neq_eq() {}
19 |
20 |
21 |
22 | void bitor_neq_paren_eq() {}
23 |
24 |
25 |
26 | void bitand_bitxor_bitand() {}
27 |
28 |
29 |
30 | void bitor_bitxor_bitand() {}
31 |
32 |
33 |
34 | void or_and_eq() {}
35 |
--------------------------------------------------------------------------------
/test/webgl/pp/op_prec.true:
--------------------------------------------------------------------------------
1 |
2 | void pos_neg_mul_add() {}
3 |
4 |
5 |
6 | void add_div_mod() {}
7 |
8 |
9 |
10 | void add_shift_mul_shift() {}
11 |
12 |
13 |
14 | void add_rel_eq_rel_mul() {}
15 |
16 |
17 |
18 | void neq_eq() {}
19 |
20 |
21 |
22 | void bitor_neq_paren_eq() {}
23 |
24 |
25 |
26 | void bitand_bitxor_bitand() {}
27 |
28 |
29 |
30 | void bitor_bitxor_bitand() {}
31 |
32 |
33 |
34 | void or_and_eq() {}
35 |
--------------------------------------------------------------------------------
/test/webgl/pp/poly_macro.in:
--------------------------------------------------------------------------------
1 | #define GP(t) t gp(t a,t b) { \
2 | return sum(prod(a,b),prod(b,a)); \
3 | }
4 |
5 | GP(vec2)
6 |
--------------------------------------------------------------------------------
/test/webgl/pp/poly_macro.out:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | vec2
6 | #line 1
7 | gp(
8 |
9 |
10 |
11 | vec2
12 | #line 1
13 | a,
14 |
15 |
16 |
17 | vec2
18 | #line 1
19 | b) {/*\
20 | */ return sum(prod(a,b),prod(b,a));/*\
21 | */ }
22 |
--------------------------------------------------------------------------------
/test/webgl/pp/poly_macro.true:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | vec2
6 | #line 1
7 | gp(
8 |
9 |
10 |
11 | vec2
12 | #line 1
13 | a,
14 |
15 |
16 |
17 | vec2
18 | #line 1
19 | b) {/*\
20 | */ return sum(prod(a,b),prod(b,a));/*\
21 | */ }
22 |
--------------------------------------------------------------------------------
/test/webgl/pp/prescan_cons.in:
--------------------------------------------------------------------------------
1 | #define LP (
2 | #define RP )
3 | #define C ,
4 | #define G(a,b,c) ((a)*(a)*(a)+(b)*(b)+(c))
5 | #define Q(F,A,B,C) F A B C
6 | #define L(A,S) A S A S A
7 |
8 |
9 |
10 |
11 |
12 |
13 | void main() {
14 | Q(G,LP,2 C 4 C 6,RP);
15 | Q(G,LP,L(Q(G,LP,2 C 4 C 6,RP),C),RP);
16 | }
17 |
--------------------------------------------------------------------------------
/test/webgl/pp/recursive_macro.in:
--------------------------------------------------------------------------------
1 | #define A B
2 | #define B A
3 | void main() { A; }
4 |
--------------------------------------------------------------------------------
/test/webgl/pp/recursive_macro.out:
--------------------------------------------------------------------------------
1 |
2 |
3 | void main() {
4 | #line 2
5 | A
6 | ; }
7 |
--------------------------------------------------------------------------------
/test/webgl/pp/recursive_macro.true:
--------------------------------------------------------------------------------
1 |
2 |
3 | void main() {
4 | #line 2
5 | A
6 | ; }
7 |
--------------------------------------------------------------------------------
/test/webgl/pp/reserved_ident.in:
--------------------------------------------------------------------------------
1 | #define __FOO__
2 | #define GL_BAR
3 | void main() {
4 | asm;
5 | }
6 |
--------------------------------------------------------------------------------
/test/webgl/pp/reserved_ident.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 8 - 15:
2 | "__FOO__" is a reserved macro and may not be redefined
3 |
4 | File 0, line 2, col 8 - 14:
5 | "GL_BAR" is a reserved macro and may not be redefined
6 |
7 | File 0, line 4, col 5 - 8:
8 | "asm" is a reserved keyword and may not be used
9 |
10 | Fatal: unrecoverable preprocessor error (5)
11 |
--------------------------------------------------------------------------------
/test/webgl/pp/reserved_ident.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 8 - 15:
2 | "__FOO__" is a reserved macro and may not be redefined
3 |
4 | File 0, line 2, col 8 - 14:
5 | "GL_BAR" is a reserved macro and may not be redefined
6 |
7 | File 0, line 4, col 5 - 8:
8 | "asm" is a reserved keyword and may not be used
9 |
10 | Fatal: unrecoverable preprocessor error (5)
11 |
--------------------------------------------------------------------------------
/test/webgl/pp/reserved_macro.in:
--------------------------------------------------------------------------------
1 | precision highp float;
2 | #define asm 5
3 | #define vec2 vec3
4 |
5 | vec2 foo() { return vec2(asm); }
6 |
7 | void main() {
8 | asm;
9 | }
10 |
--------------------------------------------------------------------------------
/test/webgl/pp/reserved_macro.out:
--------------------------------------------------------------------------------
1 | precision highp float;
2 |
3 | vec3
4 |
5 | foo() { return
6 | #line 3
7 | vec3
8 |
9 | (
10 | #line 2
11 | 5
12 |
13 |
14 | ); }
15 |
16 | void main() {
17 | #line 2
18 | 5
19 |
20 |
21 |
22 |
23 |
24 | ;
25 | }
26 |
--------------------------------------------------------------------------------
/test/webgl/pp/reserved_macro.true:
--------------------------------------------------------------------------------
1 | precision highp float;
2 |
3 | vec3
4 |
5 | foo() { return
6 | #line 3
7 | vec3
8 |
9 | (
10 | #line 2
11 | 5
12 |
13 |
14 | ); }
15 |
16 | void main() {
17 | #line 2
18 | 5
19 |
20 |
21 |
22 |
23 |
24 | ;
25 | }
26 |
--------------------------------------------------------------------------------
/test/webgl/pp/short_circuit.in:
--------------------------------------------------------------------------------
1 | #if 3 == 3 || W
2 | void w() {}
3 | #endif
4 |
5 | #if 4 || J
6 | void j() {}
7 | #endif
8 |
9 | #if 0 && Q
10 | void q() {}
11 | #endif
12 |
13 | #if 0 && Y
14 | void y() {}
15 | #endif
16 |
17 | #if 1 && F
18 | void f() {}
19 | #endif
20 |
21 | #if 0 || G
22 | void g() {}
23 | #endif
24 |
--------------------------------------------------------------------------------
/test/webgl/pp/short_circuit.out:
--------------------------------------------------------------------------------
1 | File 0, line 17, col 9 - 10:
2 | ambiguous preprocessor conditional branch: F
3 |
4 | File 0, line 21, col 9 - 10:
5 | ambiguous preprocessor conditional branch: G
6 |
7 | Fatal: unrecoverable preprocessor divergence (6)
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/short_circuit.true:
--------------------------------------------------------------------------------
1 | File 0, line 17, col 9 - 10:
2 | ambiguous preprocessor conditional branch: F
3 |
4 | File 0, line 21, col 9 - 10:
5 | ambiguous preprocessor conditional branch: G
6 |
7 | Fatal: unrecoverable preprocessor divergence (6)
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/unclosed_macro_arg.in:
--------------------------------------------------------------------------------
1 | #define F(A) (A)
2 | void main() {
3 | F ( 5
4 | }
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/unclosed_macro_arg.out:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 7 - 8:
2 | unclosed macro argument list
3 |
4 | Fatal: unrecoverable preprocessor error (5)
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/unclosed_macro_arg.true:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 7 - 8:
2 | unclosed macro argument list
3 |
4 | Fatal: unrecoverable preprocessor error (5)
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/unclosed_macro_arg_paren.in:
--------------------------------------------------------------------------------
1 | #define F(A) (A)
2 | void main() {
3 | F ( ( 5
4 | }
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/unclosed_macro_arg_paren.out:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 9 - 10:
2 | unclosed inner parenthesis in macro argument list
3 |
4 | File 0, line 3, col 7 - 8:
5 | unclosed macro argument list
6 |
7 | Fatal: unrecoverable preprocessor error (5)
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/unclosed_macro_arg_paren.true:
--------------------------------------------------------------------------------
1 | File 0, line 3, col 9 - 10:
2 | unclosed inner parenthesis in macro argument list
3 |
4 | File 0, line 3, col 7 - 8:
5 | unclosed macro argument list
6 |
7 | Fatal: unrecoverable preprocessor error (5)
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/unsupported_cond_op.in:
--------------------------------------------------------------------------------
1 | #if 0,1
2 | #define X
3 | #else
4 | #define Y
5 | #endif
6 |
--------------------------------------------------------------------------------
/test/webgl/pp/unsupported_cond_op.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 5 - 6:
2 | "," is not supported in preprocessor expressions
3 |
4 | Fatal: unrecoverable preprocessor error (5)
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/unsupported_cond_op.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 5 - 6:
2 | "," is not supported in preprocessor expressions
3 |
4 | Fatal: unrecoverable preprocessor error (5)
5 |
--------------------------------------------------------------------------------
/test/webgl/pp/unsupported_float.in:
--------------------------------------------------------------------------------
1 | #if 1.2 < 3.4
2 | #define HOORAY
3 | #else
4 | #error oops
5 | #endif
6 |
7 | void main() {}
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/unsupported_float.out:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 4 - 7:
2 | floating point is not supported in preprocessor expressions
3 |
4 | File 0, line 1, col 10 - 13:
5 | floating point is not supported in preprocessor expressions
6 |
7 | Fatal: unrecoverable preprocessor error (5)
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/unsupported_float.true:
--------------------------------------------------------------------------------
1 | File 0, line 1, col 4 - 7:
2 | floating point is not supported in preprocessor expressions
3 |
4 | File 0, line 1, col 10 - 13:
5 | floating point is not supported in preprocessor expressions
6 |
7 | Fatal: unrecoverable preprocessor error (5)
8 |
--------------------------------------------------------------------------------
/test/webgl/pp/wrong_macro_arity.in:
--------------------------------------------------------------------------------
1 | #define G() 5
2 | #define F(A) (A)
3 | void main() {
4 | F((3,2));
5 | F();
6 | F(5,3);
7 | G();
8 | G(3);
9 | G(3,4);
10 | }
11 |
--------------------------------------------------------------------------------
/test/webgl/pp/wrong_macro_arity.out:
--------------------------------------------------------------------------------
1 | File 0, line 6, col 5 - 6:
2 | too many macro arguments: expected 1, got 2
3 |
4 | File 0, line 8, col 5 - 6:
5 | too many macro arguments: expected 0, got 1
6 |
7 | File 0, line 9, col 5 - 6:
8 | too many macro arguments: expected 0, got 2
9 |
10 | Fatal: unrecoverable preprocessor error (5)
11 |
--------------------------------------------------------------------------------
/test/webgl/pp/wrong_macro_arity.true:
--------------------------------------------------------------------------------
1 | File 0, line 6, col 5 - 6:
2 | too many macro arguments: expected 1, got 2
3 |
4 | File 0, line 8, col 5 - 6:
5 | too many macro arguments: expected 0, got 1
6 |
7 | File 0, line 9, col 5 - 6:
8 | too many macro arguments: expected 0, got 2
9 |
10 | Fatal: unrecoverable preprocessor error (5)
11 |
--------------------------------------------------------------------------------
/test/webgl/ppp/.gitignore:
--------------------------------------------------------------------------------
1 | *.diff
2 |
--------------------------------------------------------------------------------
/test/webgl/ppp/Makefile:
--------------------------------------------------------------------------------
1 | PP = OCAMLRUNPARAM=b ../../../src/gloc.d.byte -e
2 |
3 | INS := $(wildcard *.in)
4 | OUTS := $(INS:.in=.out)
5 |
6 | %.out : %.in %.true
7 | @$(PP) < $*.in &> $@ || true
8 | @if diff -u $*.true $@ > $*.diff; then \
9 | rm $*.diff;\
10 | else cat $*.diff;\
11 | fi
12 |
13 | .PHONY : all test clean
14 | all :
15 | @$(MAKE) clean
16 | @$(MAKE) test
17 | test : $(OUTS)
18 | @printf "Test failures: "
19 | @ls *.diff 2> /dev/null | wc -l
20 | clean :
21 | @rm *.out *.diff 2> /dev/null || true
22 | %.git : %.in %.out %.true
23 | git add $^
24 | %.new :
25 | touch $*.in
26 | echo "error" > $*.true
27 |
--------------------------------------------------------------------------------
/test/webgl/ppp/block_comments.in:
--------------------------------------------------------------------------------
1 | // a header comment
2 | /* more
3 | header
4 | comments */
5 |
6 | /* pre-directive comment */#pragma OK
7 | #/* pre-command comment */pragma OK
8 | /**/#/**/pragma/*
9 | */OK part of/*
10 | */directive
11 |
12 | #pragma OK // eol comment
13 |
14 | /* comment */#/* more comment */// more comment
15 |
16 | // comment trailer
17 | /* more trailer
18 | comments
19 | */// final trailer
20 |
--------------------------------------------------------------------------------
/test/webgl/ppp/block_comments.out:
--------------------------------------------------------------------------------
1 | /* a header comment
2 | more
3 | header
4 | comments */
5 |
6 | /*pre-directive comment */ #pragma OK
7 | /* pre-command comment */#pragma OK
8 | /* */ #pragma/*
9 | */OK part of/*
10 | */directive
11 |
12 | #pragma OK/* eol comment*/
13 |
14 | /*comment more comment more comment*/
15 |
16 | /* comment trailer
17 | more trailer
18 | comments
19 | final trailer*/
20 |
--------------------------------------------------------------------------------
/test/webgl/ppp/block_comments.true:
--------------------------------------------------------------------------------
1 | /* a header comment
2 | more
3 | header
4 | comments */
5 |
6 | /*pre-directive comment */ #pragma OK
7 | /* pre-command comment */#pragma OK
8 | /* */ #pragma/*
9 | */OK part of/*
10 | */directive
11 |
12 | #pragma OK/* eol comment*/
13 |
14 | /*comment more comment more comment*/
15 |
16 | /* comment trailer
17 | more trailer
18 | comments
19 | final trailer*/
20 |
--------------------------------------------------------------------------------
/test/webgl/ppp/block_comments2.in:
--------------------------------------------------------------------------------
1 | /* A comment header */
2 |
3 | #if 4 == 4
4 | /* A pre-directive comment */ #pragma 1
5 |
6 | # /* A pre-command comment */ pragma 2
7 |
8 | #pragma /* a pre-argument comment */ 3
9 |
10 | #pragma 4 /* a trailing comment */
11 |
12 | #pragma 5 // a c++-style comment
13 |
14 | #pragma 6 /* a multiline trailing comment
15 | that is followed by additional arguments */ and more error args
16 |
17 | #define MYMACRO(a,b) /*
18 | */ this should be part of /*
19 | */ the macro. This is still part of /*
20 | */ the macro.
21 |
22 | #endif
23 |
24 | #/*
25 | */pragma/*
26 | */this/*
27 | */is/*
28 | */all/*
29 | */one/*
30 | */directive
31 |
32 | #/* and
33 | */pragma/*
34 | here's*/another/* see what i did there with a naughty apostrophe?
35 | *//*
36 | */single directive
37 |
38 | /* a comment trailer */
39 | // more trailer
40 | /* even more trailer */
41 |
--------------------------------------------------------------------------------
/test/webgl/ppp/block_comments2.out:
--------------------------------------------------------------------------------
1 | /*A comment header */
2 |
3 | #if 4 == 4
4 | /*A pre-directive comment */ #pragma 1
5 |
6 | /* A pre-command comment */ #pragma 2
7 |
8 | #pragma/* a pre-argument comment */ 3
9 |
10 | #pragma 4/* a trailing comment */
11 |
12 | #pragma 5/* a c++-style comment*/
13 |
14 | #pragma 6/* a multiline trailing comment
15 | that is followed by additional arguments */ and more error args
16 |
17 | #define MYMACRO(a,b)/*
18 | */ this should be part of/*
19 | */ the macro. This is still part of/*
20 | */ the macro.
21 |
22 | #endif
23 |
24 | /*
25 | */ #pragma/*
26 | */this/*
27 | */is/*
28 | */all/*
29 | */one/*
30 | */directive
31 |
32 | /* and
33 | */ #pragma/*
34 | here's*/another/*see what i did there with a naughty apostrophe?
35 |
36 | */single directive
37 |
38 | /*a comment trailer
39 | more trailer
40 | even more trailer */
41 |
--------------------------------------------------------------------------------
/test/webgl/ppp/block_comments2.true:
--------------------------------------------------------------------------------
1 | /*A comment header */
2 |
3 | #if 4 == 4
4 | /*A pre-directive comment */ #pragma 1
5 |
6 | /* A pre-command comment */ #pragma 2
7 |
8 | #pragma/* a pre-argument comment */ 3
9 |
10 | #pragma 4/* a trailing comment */
11 |
12 | #pragma 5/* a c++-style comment*/
13 |
14 | #pragma 6/* a multiline trailing comment
15 | that is followed by additional arguments */ and more error args
16 |
17 | #define MYMACRO(a,b)/*
18 | */ this should be part of/*
19 | */ the macro. This is still part of/*
20 | */ the macro.
21 |
22 | #endif
23 |
24 | /*
25 | */ #pragma/*
26 | */this/*
27 | */is/*
28 | */all/*
29 | */one/*
30 | */directive
31 |
32 | /* and
33 | */ #pragma/*
34 | here's*/another/*see what i did there with a naughty apostrophe?
35 |
36 | */single directive
37 |
38 | /*a comment trailer
39 | more trailer
40 | even more trailer */
41 |
--------------------------------------------------------------------------------
/test/webgl/ppp/defined_macro.in:
--------------------------------------------------------------------------------
1 | #define Q 7
2 | #define defined Q
3 | #if defined < 100
4 | int baz() { return defined; }
5 | void main() {}
6 | #endif
7 |
--------------------------------------------------------------------------------
/test/webgl/ppp/defined_macro.out:
--------------------------------------------------------------------------------
1 | #define Q 7
2 | #define defined Q
3 | #if defined < 100
4 | int baz() { return defined; }
5 | void main() {}
6 | #endif
7 |
--------------------------------------------------------------------------------
/test/webgl/ppp/defined_macro.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/ppp/line_scope.in:
--------------------------------------------------------------------------------
1 | #line 1000
2 | #define L __LINE__
3 | #define F __FILE__
4 |
5 | #line 2000
6 | void baz() {
7 | int line = L;
8 | int file = F;
9 | line = L;
10 | #if 0
11 | #line 3000
12 | #endif
13 | line = L;
14 | file = F;
15 | #if 1
16 | #line 4000
17 | #endif
18 | line = L;
19 | #line 4000
20 | line = L;
21 | file = F;
22 | }
23 |
--------------------------------------------------------------------------------
/test/webgl/ppp/line_scope.out:
--------------------------------------------------------------------------------
1 | #line 1000
2 | #define L __LINE__
3 | #define F __FILE__
4 |
5 | #line 2000
6 | void baz() {
7 | int line = L;
8 | int file = F;
9 | line = L;
10 | #if 0
11 | #line 3000
12 | #endif
13 | line = L;
14 | file = F;
15 | #if 1
16 | #line 4000
17 | #endif
18 | line = L;
19 | #line 4000
20 | line = L;
21 | file = F;
22 | }
23 |
--------------------------------------------------------------------------------
/test/webgl/ppp/line_scope.true:
--------------------------------------------------------------------------------
1 | #line 1000
2 | #define L __LINE__
3 | #define F __FILE__
4 |
5 | #line 2000
6 | void baz() {
7 | int line = L;
8 | int file = F;
9 | line = L;
10 | #if 0
11 | #line 3000
12 | #endif
13 | line = L;
14 | file = F;
15 | #if 1
16 | #line 4000
17 | #endif
18 | line = L;
19 | #line 4000
20 | line = L;
21 | file = F;
22 | }
23 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_args.in:
--------------------------------------------------------------------------------
1 | #define B A
2 | #define A 2
3 | #define Q(A,B) ((A)+(B))
4 |
5 | void main() {
6 | Q(B,A);
7 | }
8 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_args.out:
--------------------------------------------------------------------------------
1 | #define B A
2 | #define A 2
3 | #define Q(A,B) ((A)+(B))
4 |
5 | void main() {
6 | Q(B,A);
7 | }
8 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_args.true:
--------------------------------------------------------------------------------
1 | #define B A
2 | #define A 2
3 | #define Q(A,B) ((A)+(B))
4 |
5 | void main() {
6 | Q(B,A);
7 | }
8 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_cond.in:
--------------------------------------------------------------------------------
1 | #define Q
2 | #line 100
3 | #define J defined Q
4 | #if J
5 | void foo() {}
6 | #endif
7 | #undef Q
8 | #if !J
9 | void remote_defined() {}
10 | #endif
11 |
12 | #line 1000
13 | #define A 1
14 | #define B 2
15 | #define OP defined
16 | #if OP A && OP B
17 | #define Q 7
18 | #endif
19 | int blah() { return Q; }
20 | #if OP 5
21 | #define Q 77
22 | #endif
23 | void main() { gl_Position = Q; }
24 | #define defined Q
25 | #if defined < 100
26 | int baz() { return defined; }
27 | #endif
28 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_cond.out:
--------------------------------------------------------------------------------
1 | #define Q
2 | #line 100
3 | #define J defined Q
4 | #if J
5 | void foo() {}
6 | #endif
7 | #undef Q
8 | #if !J
9 | void remote_defined() {}
10 | #endif
11 |
12 | #line 1000
13 | #define A 1
14 | #define B 2
15 | #define OP defined
16 | #if OP A && OP B
17 | #define Q 7
18 | #endif
19 | int blah() { return Q; }
20 | #if OP 5
21 | #define Q 77
22 | #endif
23 | void main() { gl_Position = Q; }
24 | #define defined Q
25 | #if defined < 100
26 | int baz() { return defined; }
27 | #endif
28 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_cond.true:
--------------------------------------------------------------------------------
1 | File 0, l1002 c11 - l1007 c8:
2 | error parsing conditional expression "defined 5"
3 |
4 | Fatal: unrecoverable preprocessor error (4)
5 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_cond2.in:
--------------------------------------------------------------------------------
1 | #define Q
2 | #line 100
3 | #define J defined Q
4 | #if J
5 | void foo() {}
6 | #endif
7 | #undef Q
8 | #if !J
9 | void remote_defined() {}
10 | #endif
11 |
12 | #line 1000
13 | #define A 1
14 | #define B 2
15 | #define OP defined
16 | #if OP A && OP B
17 | #define Q 7
18 | #endif
19 | int blah() { return Q; }
20 |
21 |
22 |
23 | void main() { gl_Position = vec4(Q); }
24 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_cond2.out:
--------------------------------------------------------------------------------
1 | #define Q
2 | #line 100
3 | #define J defined Q
4 | #if J
5 | void foo() {}
6 | #endif
7 | #undef Q
8 | #if !J
9 | void remote_defined() {}
10 | #endif
11 |
12 | #line 1000
13 | #define A 1
14 | #define B 2
15 | #define OP defined
16 | #if OP A && OP B
17 | #define Q 7
18 | #endif
19 | int blah() { return Q; }
20 |
21 |
22 |
23 | void main() { gl_Position = vec4(Q); }
24 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_cond2.true:
--------------------------------------------------------------------------------
1 | error
2 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_scopes.in:
--------------------------------------------------------------------------------
1 | #define Q(A) foo((A)*2)
2 | void bar() {
3 | Q(6);
4 | }
5 | #undef Q
6 |
7 | #define Q foo
8 | void main() {
9 | Q(7); Q;
10 | }
11 | #undef Q
12 |
13 | #define Q foo
14 | #define Q(A) foo((A)*2)
15 | void foo() {
16 | Q(10); Q (4); Q;
17 | }
18 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_scopes.out:
--------------------------------------------------------------------------------
1 | #define Q(A) foo((A)*2)
2 | void bar() {
3 | Q(6);
4 | }
5 | #undef Q
6 |
7 | #define Q foo
8 | void main() {
9 | Q(7); Q;
10 | }
11 | #undef Q
12 |
13 | #define Q foo
14 | #define Q(A) foo((A)*2)
15 | void foo() {
16 | Q(10); Q (4); Q;
17 | }
18 |
--------------------------------------------------------------------------------
/test/webgl/ppp/macro_scopes.true:
--------------------------------------------------------------------------------
1 | #define Q(A) foo((A)*2)
2 | void bar() {
3 | Q(6);
4 | }
5 | #undef Q
6 |
7 | #define Q foo
8 | void main() {
9 | Q(7); Q;
10 | }
11 | #undef Q
12 |
13 | #define Q foo
14 | #define Q(A) foo((A)*2)
15 | void foo() {
16 | Q(10); Q (4); Q;
17 | }
18 |
--------------------------------------------------------------------------------