remove stray tab
[mesa.git] / src / mesa / shader / slang / slang_compile_operation.h
index 65e33dc4a2073240cbfd65d511fa065ab0b7fc54..ad52b6690d5959f7934987abebaa3377243b4e3b 100644 (file)
@@ -32,10 +32,10 @@ extern "C" {
 
 /**
  * Types of slang operations.
- * These are the basic intermediate code representations.
+ * 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_
+typedef enum slang_operation_type_
 {
    slang_oper_none,
    slang_oper_block_no_new_scope,       /* "{" sequence "}" */
@@ -46,6 +46,8 @@ extern "C" {
    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] */
@@ -105,21 +107,46 @@ extern "C" {
 /**
  * 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;
-   unsigned int num_children;
-   float literal;            /**< Used for float, int and bool values */
-   slang_atom a_id;          /**< type: asm, identifier, call, field */
-   slang_variable_scope *locals;       /**< local vars for scope */
+   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 int slang_operation_construct(slang_operation *);
-extern void slang_operation_destruct(slang_operation *);
-extern int slang_operation_copy(slang_operation *, const 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