-/*\r
- * Mesa 3-D graphics library\r
- * Version: 6.5\r
- *\r
- * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included\r
- * in all copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-#if !defined SLANG_COMPILE_OPERATION_H\r
-#define SLANG_COMPILE_OPERATION_H\r
-\r
-#if defined __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-typedef enum slang_operation_type_\r
-{\r
- slang_oper_none,\r
- slang_oper_block_no_new_scope,\r
- slang_oper_block_new_scope,\r
- slang_oper_variable_decl,\r
- slang_oper_asm,\r
- slang_oper_break,\r
- slang_oper_continue,\r
- slang_oper_discard,\r
- slang_oper_return,\r
- slang_oper_expression,\r
- slang_oper_if,\r
- slang_oper_while,\r
- slang_oper_do,\r
- slang_oper_for,\r
- slang_oper_void,\r
- slang_oper_literal_bool,\r
- slang_oper_literal_int,\r
- slang_oper_literal_float,\r
- slang_oper_identifier,\r
- slang_oper_sequence,\r
- slang_oper_assign,\r
- slang_oper_addassign,\r
- slang_oper_subassign,\r
- slang_oper_mulassign,\r
- slang_oper_divassign,\r
- /*slang_oper_modassign,*/\r
- /*slang_oper_lshassign,*/\r
- /*slang_oper_rshassign,*/\r
- /*slang_oper_orassign,*/\r
- /*slang_oper_xorassign,*/\r
- /*slang_oper_andassign,*/\r
- slang_oper_select,\r
- slang_oper_logicalor,\r
- slang_oper_logicalxor,\r
- slang_oper_logicaland,\r
- /*slang_oper_bitor,*/\r
- /*slang_oper_bitxor,*/\r
- /*slang_oper_bitand,*/\r
- slang_oper_equal,\r
- slang_oper_notequal,\r
- slang_oper_less,\r
- slang_oper_greater,\r
- slang_oper_lessequal,\r
- slang_oper_greaterequal,\r
- /*slang_oper_lshift,*/\r
- /*slang_oper_rshift,*/\r
- slang_oper_add,\r
- slang_oper_subtract,\r
- slang_oper_multiply,\r
- slang_oper_divide,\r
- /*slang_oper_modulus,*/\r
- slang_oper_preincrement,\r
- slang_oper_predecrement,\r
- slang_oper_plus,\r
- slang_oper_minus,\r
- /*slang_oper_complement,*/\r
- slang_oper_not,\r
- slang_oper_subscript,\r
- slang_oper_call,\r
- slang_oper_field,\r
- slang_oper_postincrement,\r
- slang_oper_postdecrement\r
-} slang_operation_type;\r
-\r
-typedef struct slang_operation_\r
-{\r
- slang_operation_type type;\r
- struct slang_operation_ *children;\r
- unsigned int num_children;\r
- float literal; /* type: bool, literal_int, literal_float */\r
- slang_atom a_id; /* type: asm, identifier, call, field */\r
- slang_variable_scope *locals;\r
-} slang_operation;\r
-\r
-int slang_operation_construct (slang_operation *);\r
-void slang_operation_destruct (slang_operation *);\r
-int slang_operation_copy (slang_operation *, const slang_operation *);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
-\r
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.2
+ *
+ * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef SLANG_COMPILE_OPERATION_H
+#define SLANG_COMPILE_OPERATION_H
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * Types of slang operations.
+ * These are the types of the AST (abstract syntax tree) nodes.
+ * [foo] indicates a sub-tree or reference to another type of node
+ */
+typedef enum slang_operation_type_
+{
+ slang_oper_none,
+ slang_oper_block_no_new_scope, /* "{" sequence "}" */
+ slang_oper_block_new_scope, /* "{" sequence "}" */
+ slang_oper_variable_decl, /* [type] [var] or [var] = [expr] */
+ slang_oper_asm,
+ slang_oper_break, /* "break" statement */
+ slang_oper_continue, /* "continue" statement */
+ slang_oper_discard, /* "discard" (kill fragment) statement */
+ slang_oper_return, /* "return" [expr] */
+ slang_oper_goto, /* jump to label */
+ slang_oper_label, /* a jump target */
+ slang_oper_expression, /* [expr] */
+ slang_oper_if, /* "if" [0] then [1] else [2] */
+ slang_oper_while, /* "while" [cond] [body] */
+ slang_oper_do, /* "do" [body] "while" [cond] */
+ slang_oper_for, /* "for" [init] [while] [incr] [body] */
+ slang_oper_void, /* nop */
+ slang_oper_literal_bool, /* "true" or "false" */
+ slang_oper_literal_int, /* integer literal */
+ slang_oper_literal_float, /* float literal */
+ slang_oper_identifier, /* var name, func name, etc */
+ slang_oper_sequence, /* [expr] "," [expr] "," etc */
+ slang_oper_assign, /* [var] "=" [expr] */
+ slang_oper_addassign, /* [var] "+=" [expr] */
+ slang_oper_subassign, /* [var] "-=" [expr] */
+ slang_oper_mulassign, /* [var] "*=" [expr] */
+ slang_oper_divassign, /* [var] "/=" [expr] */
+ /*slang_oper_modassign, */
+ /*slang_oper_lshassign, */
+ /*slang_oper_rshassign, */
+ /*slang_oper_orassign, */
+ /*slang_oper_xorassign, */
+ /*slang_oper_andassign, */
+ slang_oper_select, /* [expr] "?" [expr] ":" [expr] */
+ slang_oper_logicalor, /* [expr] "||" [expr] */
+ slang_oper_logicalxor, /* [expr] "^^" [expr] */
+ slang_oper_logicaland, /* [expr] "&&" [expr] */
+ /*slang_oper_bitor, */
+ /*slang_oper_bitxor, */
+ /*slang_oper_bitand, */
+ slang_oper_equal, /* [expr] "==" [expr] */
+ slang_oper_notequal, /* [expr] "!=" [expr] */
+ slang_oper_less, /* [expr] "<" [expr] */
+ slang_oper_greater, /* [expr] ">" [expr] */
+ slang_oper_lessequal, /* [expr] "<=" [expr] */
+ slang_oper_greaterequal, /* [expr] ">=" [expr] */
+ /*slang_oper_lshift, */
+ /*slang_oper_rshift, */
+ slang_oper_add, /* [expr] "+" [expr] */
+ slang_oper_subtract, /* [expr] "-" [expr] */
+ slang_oper_multiply, /* [expr] "*" [expr] */
+ slang_oper_divide, /* [expr] "/" [expr] */
+ /*slang_oper_modulus, */
+ slang_oper_preincrement, /* "++" [var] */
+ slang_oper_predecrement, /* "--" [var] */
+ slang_oper_plus, /* "-" [expr] */
+ slang_oper_minus, /* "+" [expr] */
+ /*slang_oper_complement, */
+ slang_oper_not, /* "!" [expr] */
+ slang_oper_subscript, /* [expr] "[" [expr] "]" */
+ slang_oper_call, /* [func name] [param] [param] [...] */
+ slang_oper_field, /* i.e.: ".next" or ".xzy" or ".xxx" etc */
+ slang_oper_postincrement, /* [var] "++" */
+ slang_oper_postdecrement /* [var] "--" */
+} slang_operation_type;
+
+
+/**
+ * A slang_operation is basically a compiled instruction (such as assignment,
+ * a while-loop, a conditional, a multiply, a function call, etc).
+ * The AST (abstract syntax tree) is built from these nodes.
+ * NOTE: This structure could have been implemented as a union of simpler
+ * structs which would correspond to the operation types above.
+ */
+typedef struct slang_operation_
+{
+ slang_operation_type type;
+ struct slang_operation_ *children;
+ GLuint num_children;
+ GLfloat literal[4]; /**< Used for float, int and bool values */
+ slang_atom a_id; /**< type: asm, identifier, call, field */
+ slang_variable_scope *locals; /**< local vars for scope */
+ struct slang_function_ *fun; /**< If type == slang_oper_call */
+ struct slang_variable_ *var; /**< If type == slang_oper_identier */
+ slang_fully_specified_type *datatype; /**< Type of this operation */
+ slang_assembly_typeinfo ti;
+} slang_operation;
+
+
+extern GLboolean
+slang_operation_construct(slang_operation *);
+
+extern void
+slang_operation_destruct(slang_operation *);
+
+extern GLboolean
+slang_operation_copy(slang_operation *, const slang_operation *);
+
+extern slang_operation *
+slang_operation_new(GLuint count);
+
+extern void
+slang_operation_delete(slang_operation *oper);
+
+extern slang_operation *
+slang_operation_grow(GLuint *numChildren, slang_operation **children);
+
+extern slang_operation *
+slang_operation_insert(GLuint *numChildren, slang_operation **children,
+ GLuint pos);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SLANG_COMPILE_OPERATION_H */