mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 07:58:07 +02:00
Split slang_compile.c into several smaller files - it was just too big.
Minor fixes and cosmetic changes.
This commit is contained in:
parent
b2006a40eb
commit
9dc8bce88e
16 changed files with 1642 additions and 1069 deletions
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 2005 Brian Paul All Rights Reserved.
|
||||
* 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"),
|
||||
|
|
@ -124,7 +124,7 @@ static int sizeof_variable (slang_type_specifier *spec, slang_type_qualifier qua
|
|||
slang_storage_aggregate agg;
|
||||
|
||||
slang_storage_aggregate_construct (&agg);
|
||||
if (!_slang_aggregate_variable (&agg, spec, array_size, space->funcs, space->structs))
|
||||
if (!_slang_aggregate_variable (&agg, spec, array_size, space->funcs, space->structs, space->vars))
|
||||
{
|
||||
slang_storage_aggregate_destruct (&agg);
|
||||
return 0;
|
||||
|
|
@ -404,7 +404,7 @@ int dereference (slang_assembly_file *file, slang_operation *op,
|
|||
}
|
||||
|
||||
slang_storage_aggregate_construct (&agg);
|
||||
if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))
|
||||
if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs, space->vars))
|
||||
{
|
||||
slang_storage_aggregate_destruct (&agg);
|
||||
slang_assembly_typeinfo_destruct (&ti);
|
||||
|
|
@ -518,7 +518,7 @@ static int call_function_name_dummyint (slang_assembly_file *file, const char *n
|
|||
int result;
|
||||
|
||||
p2[0] = *params;
|
||||
if (!slang_operation_construct_a (p2 + 1))
|
||||
if (!slang_operation_construct (p2 + 1))
|
||||
return 0;
|
||||
p2[1].type = slang_oper_literal_int;
|
||||
result = call_function_name (file, name, p2, 2, 0, space, info);
|
||||
|
|
@ -618,7 +618,8 @@ static int equality (slang_assembly_file *file, slang_operation *op,
|
|||
|
||||
/* convert it to an aggregate */
|
||||
slang_storage_aggregate_construct (&agg);
|
||||
if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
|
||||
if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs,
|
||||
space->vars)))
|
||||
goto end;
|
||||
|
||||
/* compute the size of the agregate - there are two such aggregates on the stack */
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 2005 Brian Paul All Rights Reserved.
|
||||
* 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"),
|
||||
|
|
@ -115,7 +115,7 @@ int _slang_assemble_assignment (slang_assembly_file *file, slang_operation *op,
|
|||
}
|
||||
|
||||
slang_storage_aggregate_construct (&agg);
|
||||
if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))
|
||||
if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs, space->vars))
|
||||
{
|
||||
slang_storage_aggregate_destruct (&agg);
|
||||
slang_assembly_typeinfo_destruct (&ti);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 2005 Brian Paul All Rights Reserved.
|
||||
* 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"),
|
||||
|
|
@ -158,7 +158,8 @@ static int constructor_aggregate (slang_assembly_file *file, const slang_storage
|
|||
goto end1;
|
||||
|
||||
slang_storage_aggregate_construct (&agg);
|
||||
if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
|
||||
if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs,
|
||||
space->vars)))
|
||||
goto end2;
|
||||
|
||||
slang_storage_aggregate_construct (&flat_agg);
|
||||
|
|
@ -205,7 +206,8 @@ int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,
|
|||
goto end1;
|
||||
|
||||
slang_storage_aggregate_construct (&agg);
|
||||
if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
|
||||
if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs,
|
||||
space->vars)))
|
||||
goto end2;
|
||||
|
||||
size = _slang_sizeof_aggregate (&agg);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 2005 Brian Paul All Rights Reserved.
|
||||
* 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"),
|
||||
|
|
@ -257,7 +257,7 @@ int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *spa
|
|||
ti->spec._struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));
|
||||
if (ti->spec._struct == NULL)
|
||||
return 0;
|
||||
if (!slang_struct_construct_a (ti->spec._struct))
|
||||
if (!slang_struct_construct (ti->spec._struct))
|
||||
{
|
||||
slang_alloc_free (ti->spec._struct);
|
||||
ti->spec._struct = NULL;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 2005 Brian Paul All Rights Reserved.
|
||||
* 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"),
|
||||
|
|
@ -23,230 +23,41 @@
|
|||
*/
|
||||
|
||||
#if !defined SLANG_COMPILE_H
|
||||
#define SLANG_COMPILE_H
|
||||
#define SLANG_COMPILE_H
|
||||
|
||||
#include "slang_compile_variable.h"
|
||||
#include "slang_compile_struct.h"
|
||||
#include "slang_compile_operation.h"
|
||||
#include "slang_compile_function.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum slang_type_qualifier_
|
||||
{
|
||||
slang_qual_none,
|
||||
slang_qual_const,
|
||||
slang_qual_attribute,
|
||||
slang_qual_varying,
|
||||
slang_qual_uniform,
|
||||
slang_qual_out,
|
||||
slang_qual_inout,
|
||||
slang_qual_fixedoutput, /* internal */
|
||||
slang_qual_fixedinput /* internal */
|
||||
} slang_type_qualifier;
|
||||
|
||||
typedef enum slang_type_specifier_type_
|
||||
{
|
||||
slang_spec_void,
|
||||
slang_spec_bool,
|
||||
slang_spec_bvec2,
|
||||
slang_spec_bvec3,
|
||||
slang_spec_bvec4,
|
||||
slang_spec_int,
|
||||
slang_spec_ivec2,
|
||||
slang_spec_ivec3,
|
||||
slang_spec_ivec4,
|
||||
slang_spec_float,
|
||||
slang_spec_vec2,
|
||||
slang_spec_vec3,
|
||||
slang_spec_vec4,
|
||||
slang_spec_mat2,
|
||||
slang_spec_mat3,
|
||||
slang_spec_mat4,
|
||||
slang_spec_sampler1D,
|
||||
slang_spec_sampler2D,
|
||||
slang_spec_sampler3D,
|
||||
slang_spec_samplerCube,
|
||||
slang_spec_sampler1DShadow,
|
||||
slang_spec_sampler2DShadow,
|
||||
slang_spec_struct,
|
||||
slang_spec_array
|
||||
} slang_type_specifier_type;
|
||||
|
||||
slang_type_specifier_type slang_type_specifier_type_from_string (const char *);
|
||||
|
||||
typedef struct slang_type_specifier_
|
||||
{
|
||||
slang_type_specifier_type type;
|
||||
struct slang_struct_ *_struct; /* spec_struct */
|
||||
struct slang_type_specifier_ *_array; /* spec_array */
|
||||
} slang_type_specifier;
|
||||
|
||||
void slang_type_specifier_construct (slang_type_specifier *);
|
||||
void slang_type_specifier_destruct (slang_type_specifier *);
|
||||
int slang_type_specifier_copy (slang_type_specifier *, const slang_type_specifier *);
|
||||
int slang_type_specifier_equal (const slang_type_specifier *, const slang_type_specifier *);
|
||||
|
||||
typedef struct slang_fully_specified_type_
|
||||
{
|
||||
slang_type_qualifier qualifier;
|
||||
slang_type_specifier specifier;
|
||||
} slang_fully_specified_type;
|
||||
|
||||
typedef struct slang_variable_scope_
|
||||
{
|
||||
struct slang_variable_ *variables;
|
||||
unsigned int num_variables;
|
||||
struct slang_variable_scope_ *outer_scope;
|
||||
} slang_variable_scope;
|
||||
|
||||
typedef enum slang_operation_type_
|
||||
{
|
||||
slang_oper_none,
|
||||
slang_oper_block_no_new_scope,
|
||||
slang_oper_block_new_scope,
|
||||
slang_oper_variable_decl,
|
||||
slang_oper_asm,
|
||||
slang_oper_break,
|
||||
slang_oper_continue,
|
||||
slang_oper_discard,
|
||||
slang_oper_return,
|
||||
slang_oper_expression,
|
||||
slang_oper_if,
|
||||
slang_oper_while,
|
||||
slang_oper_do,
|
||||
slang_oper_for,
|
||||
slang_oper_void,
|
||||
slang_oper_literal_bool,
|
||||
slang_oper_literal_int,
|
||||
slang_oper_literal_float,
|
||||
slang_oper_identifier,
|
||||
slang_oper_sequence,
|
||||
slang_oper_assign,
|
||||
slang_oper_addassign,
|
||||
slang_oper_subassign,
|
||||
slang_oper_mulassign,
|
||||
slang_oper_divassign,
|
||||
/*slang_oper_modassign,*/
|
||||
/*slang_oper_lshassign,*/
|
||||
/*slang_oper_rshassign,*/
|
||||
/*slang_oper_orassign,*/
|
||||
/*slang_oper_xorassign,*/
|
||||
/*slang_oper_andassign,*/
|
||||
slang_oper_select,
|
||||
slang_oper_logicalor,
|
||||
slang_oper_logicalxor,
|
||||
slang_oper_logicaland,
|
||||
/*slang_oper_bitor,*/
|
||||
/*slang_oper_bitxor,*/
|
||||
/*slang_oper_bitand,*/
|
||||
slang_oper_equal,
|
||||
slang_oper_notequal,
|
||||
slang_oper_less,
|
||||
slang_oper_greater,
|
||||
slang_oper_lessequal,
|
||||
slang_oper_greaterequal,
|
||||
/*slang_oper_lshift,*/
|
||||
/*slang_oper_rshift,*/
|
||||
slang_oper_add,
|
||||
slang_oper_subtract,
|
||||
slang_oper_multiply,
|
||||
slang_oper_divide,
|
||||
/*slang_oper_modulus,*/
|
||||
slang_oper_preincrement,
|
||||
slang_oper_predecrement,
|
||||
slang_oper_plus,
|
||||
slang_oper_minus,
|
||||
/*slang_oper_complement,*/
|
||||
slang_oper_not,
|
||||
slang_oper_subscript,
|
||||
slang_oper_call,
|
||||
slang_oper_field,
|
||||
slang_oper_postincrement,
|
||||
slang_oper_postdecrement
|
||||
} slang_operation_type;
|
||||
|
||||
typedef struct slang_operation_
|
||||
{
|
||||
slang_operation_type type;
|
||||
struct slang_operation_ *children;
|
||||
unsigned int num_children;
|
||||
float literal; /* bool, literal_int, literal_float */
|
||||
char *identifier; /* asm, identifier, call, field */
|
||||
slang_variable_scope *locals;
|
||||
} slang_operation;
|
||||
|
||||
int slang_operation_construct_a (slang_operation *);
|
||||
void slang_operation_destruct (slang_operation *);
|
||||
|
||||
typedef struct slang_variable_
|
||||
{
|
||||
slang_fully_specified_type type;
|
||||
char *name;
|
||||
slang_operation *array_size; /* spec_array */
|
||||
slang_operation *initializer;
|
||||
unsigned int address;
|
||||
} slang_variable;
|
||||
|
||||
slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all);
|
||||
|
||||
typedef struct slang_struct_scope_
|
||||
{
|
||||
struct slang_struct_ *structs;
|
||||
unsigned int num_structs;
|
||||
struct slang_struct_scope_ *outer_scope;
|
||||
} slang_struct_scope;
|
||||
|
||||
struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, const char *, int);
|
||||
|
||||
typedef struct slang_struct_
|
||||
{
|
||||
char *name;
|
||||
slang_variable_scope *fields;
|
||||
slang_struct_scope *structs;
|
||||
} slang_struct;
|
||||
|
||||
int slang_struct_construct_a (slang_struct *);
|
||||
int slang_struct_copy (slang_struct *, const slang_struct *);
|
||||
|
||||
typedef enum slang_function_kind_
|
||||
{
|
||||
slang_func_ordinary,
|
||||
slang_func_constructor,
|
||||
slang_func_operator
|
||||
} slang_function_kind;
|
||||
|
||||
typedef struct slang_function_
|
||||
{
|
||||
slang_function_kind kind;
|
||||
slang_variable header;
|
||||
slang_variable_scope *parameters;
|
||||
unsigned int param_count;
|
||||
slang_operation *body;
|
||||
unsigned int address;
|
||||
} slang_function;
|
||||
|
||||
typedef struct slang_function_scope_
|
||||
{
|
||||
slang_function *functions;
|
||||
unsigned int num_functions;
|
||||
struct slang_function_scope_ *outer_scope;
|
||||
} slang_function_scope;
|
||||
|
||||
typedef enum slang_unit_type_
|
||||
{
|
||||
slang_unit_fragment_shader,
|
||||
slang_unit_vertex_shader,
|
||||
slang_unit_fragment_builtin,
|
||||
slang_unit_vertex_builtin
|
||||
} slang_unit_type;
|
||||
|
||||
} slang_unit_type;
|
||||
|
||||
typedef struct slang_var_pool_
|
||||
{
|
||||
GLuint next_addr;
|
||||
} slang_var_pool;
|
||||
|
||||
typedef struct slang_translation_unit_
|
||||
{
|
||||
slang_variable_scope globals;
|
||||
slang_function_scope functions;
|
||||
slang_struct_scope structs;
|
||||
slang_unit_type type;
|
||||
slang_unit_type type;
|
||||
struct slang_assembly_file_ *assembly;
|
||||
slang_var_pool global_pool;
|
||||
} slang_translation_unit;
|
||||
|
||||
void slang_translation_unit_construct (slang_translation_unit *);
|
||||
int slang_translation_unit_construct (slang_translation_unit *);
|
||||
void slang_translation_unit_destruct (slang_translation_unit *);
|
||||
|
||||
typedef struct slang_info_log_
|
||||
|
|
|
|||
133
src/mesa/shader/slang/slang_compile_function.c
Normal file
133
src/mesa/shader/slang/slang_compile_function.c
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file slang_compile_function.c
|
||||
* slang front-end compiler
|
||||
* \author Michal Krol
|
||||
*/
|
||||
|
||||
#include "imports.h"
|
||||
#include "slang_utility.h"
|
||||
#include "slang_compile_variable.h"
|
||||
#include "slang_compile_struct.h"
|
||||
#include "slang_compile_operation.h"
|
||||
#include "slang_compile_function.h"
|
||||
|
||||
/* slang_function */
|
||||
|
||||
int slang_function_construct (slang_function *func)
|
||||
{
|
||||
func->kind = slang_func_ordinary;
|
||||
if (!slang_variable_construct (&func->header))
|
||||
return 0;
|
||||
func->parameters = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
|
||||
if (func->parameters == NULL)
|
||||
{
|
||||
slang_variable_destruct (&func->header);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_variable_scope_construct (func->parameters))
|
||||
{
|
||||
slang_alloc_free (func->parameters);
|
||||
slang_variable_destruct (&func->header);
|
||||
return 0;
|
||||
}
|
||||
func->param_count = 0;
|
||||
func->body = NULL;
|
||||
func->address = ~0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void slang_function_destruct (slang_function *func)
|
||||
{
|
||||
slang_variable_destruct (&func->header);
|
||||
slang_variable_scope_destruct (func->parameters);
|
||||
slang_alloc_free (func->parameters);
|
||||
if (func->body != NULL)
|
||||
{
|
||||
slang_operation_destruct (func->body);
|
||||
slang_alloc_free (func->body);
|
||||
}
|
||||
}
|
||||
|
||||
/* slang_function_scope */
|
||||
|
||||
int slang_function_scope_construct (slang_function_scope *scope)
|
||||
{
|
||||
scope->functions = NULL;
|
||||
scope->num_functions = 0;
|
||||
scope->outer_scope = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void slang_function_scope_destruct (slang_function_scope *scope)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < scope->num_functions; i++)
|
||||
slang_function_destruct (scope->functions + i);
|
||||
slang_alloc_free (scope->functions);
|
||||
}
|
||||
|
||||
int slang_function_scope_find_by_name (slang_function_scope *funcs, const char *name, int all_scopes)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < funcs->num_functions; i++)
|
||||
if (slang_string_compare (name, funcs->functions[i].header.name) == 0)
|
||||
return 1;
|
||||
if (all_scopes && funcs->outer_scope != NULL)
|
||||
return slang_function_scope_find_by_name (funcs->outer_scope, name, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
slang_function *slang_function_scope_find (slang_function_scope *funcs, slang_function *fun,
|
||||
int all_scopes)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < funcs->num_functions; i++)
|
||||
{
|
||||
slang_function *f = funcs->functions + i;
|
||||
unsigned int j;
|
||||
|
||||
if (slang_string_compare (fun->header.name, f->header.name) != 0)
|
||||
continue;
|
||||
if (fun->param_count != f->param_count)
|
||||
continue;
|
||||
for (j = 0; j < fun->param_count; j++)
|
||||
{
|
||||
if (!slang_type_specifier_equal (&fun->parameters->variables[j].type.specifier,
|
||||
&f->parameters->variables[j].type.specifier))
|
||||
break;
|
||||
}
|
||||
if (j == fun->param_count)
|
||||
return f;
|
||||
}
|
||||
if (all_scopes && funcs->outer_scope != NULL)
|
||||
return slang_function_scope_find (funcs->outer_scope, fun, 1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
69
src/mesa/shader/slang/slang_compile_function.h
Normal file
69
src/mesa/shader/slang/slang_compile_function.h
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if !defined SLANG_COMPILE_FUNCTION_H
|
||||
#define SLANG_COMPILE_FUNCTION_H
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum slang_function_kind_
|
||||
{
|
||||
slang_func_ordinary,
|
||||
slang_func_constructor,
|
||||
slang_func_operator
|
||||
} slang_function_kind;
|
||||
|
||||
typedef struct slang_function_
|
||||
{
|
||||
slang_function_kind kind;
|
||||
slang_variable header;
|
||||
slang_variable_scope *parameters;
|
||||
unsigned int param_count;
|
||||
slang_operation *body;
|
||||
unsigned int address;
|
||||
} slang_function;
|
||||
|
||||
int slang_function_construct (slang_function *);
|
||||
void slang_function_destruct (slang_function *);
|
||||
|
||||
typedef struct slang_function_scope_
|
||||
{
|
||||
slang_function *functions;
|
||||
unsigned int num_functions;
|
||||
struct slang_function_scope_ *outer_scope;
|
||||
} slang_function_scope;
|
||||
|
||||
int slang_function_scope_construct (slang_function_scope *);
|
||||
void slang_function_scope_destruct (slang_function_scope *);
|
||||
int slang_function_scope_find_by_name (slang_function_scope *, const char *, int);
|
||||
slang_function *slang_function_scope_find (slang_function_scope *, slang_function *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
115
src/mesa/shader/slang/slang_compile_operation.c
Normal file
115
src/mesa/shader/slang/slang_compile_operation.c
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file slang_compile_operation.c
|
||||
* slang front-end compiler
|
||||
* \author Michal Krol
|
||||
*/
|
||||
|
||||
#include "imports.h"
|
||||
#include "slang_utility.h"
|
||||
#include "slang_compile_variable.h"
|
||||
#include "slang_compile_struct.h"
|
||||
#include "slang_compile_operation.h"
|
||||
#include "slang_compile_function.h"
|
||||
|
||||
/* slang_operation */
|
||||
|
||||
int slang_operation_construct (slang_operation *oper)
|
||||
{
|
||||
oper->type = slang_oper_none;
|
||||
oper->children = NULL;
|
||||
oper->num_children = 0;
|
||||
oper->literal = (float) 0;
|
||||
oper->identifier = NULL;
|
||||
oper->locals = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
|
||||
if (oper->locals == NULL)
|
||||
return 0;
|
||||
if (!slang_variable_scope_construct (oper->locals))
|
||||
{
|
||||
slang_alloc_free (oper->locals);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void slang_operation_destruct (slang_operation *oper)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < oper->num_children; i++)
|
||||
slang_operation_destruct (oper->children + i);
|
||||
slang_alloc_free (oper->children);
|
||||
slang_alloc_free (oper->identifier);
|
||||
slang_variable_scope_destruct (oper->locals);
|
||||
slang_alloc_free (oper->locals);
|
||||
}
|
||||
|
||||
int slang_operation_copy (slang_operation *x, const slang_operation *y)
|
||||
{
|
||||
slang_operation z;
|
||||
unsigned int i;
|
||||
|
||||
if (!slang_operation_construct (&z))
|
||||
return 0;
|
||||
z.type = y->type;
|
||||
z.children = (slang_operation *) slang_alloc_malloc (y->num_children * sizeof (slang_operation));
|
||||
if (z.children == NULL)
|
||||
{
|
||||
slang_operation_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
for (z.num_children = 0; z.num_children < y->num_children; z.num_children++)
|
||||
if (!slang_operation_construct (&z.children[z.num_children]))
|
||||
{
|
||||
slang_operation_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < z.num_children; i++)
|
||||
if (!slang_operation_copy (&z.children[i], &y->children[i]))
|
||||
{
|
||||
slang_operation_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
z.literal = y->literal;
|
||||
if (y->identifier != NULL)
|
||||
{
|
||||
z.identifier = slang_string_duplicate (y->identifier);
|
||||
if (z.identifier == NULL)
|
||||
{
|
||||
slang_operation_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (!slang_variable_scope_copy (z.locals, y->locals))
|
||||
{
|
||||
slang_operation_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
slang_operation_destruct (x);
|
||||
*x = z;
|
||||
return 1;
|
||||
}
|
||||
|
||||
117
src/mesa/shader/slang/slang_compile_operation.h
Normal file
117
src/mesa/shader/slang/slang_compile_operation.h
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if !defined SLANG_COMPILE_OPERATION_H
|
||||
#define SLANG_COMPILE_OPERATION_H
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum slang_operation_type_
|
||||
{
|
||||
slang_oper_none,
|
||||
slang_oper_block_no_new_scope,
|
||||
slang_oper_block_new_scope,
|
||||
slang_oper_variable_decl,
|
||||
slang_oper_asm,
|
||||
slang_oper_break,
|
||||
slang_oper_continue,
|
||||
slang_oper_discard,
|
||||
slang_oper_return,
|
||||
slang_oper_expression,
|
||||
slang_oper_if,
|
||||
slang_oper_while,
|
||||
slang_oper_do,
|
||||
slang_oper_for,
|
||||
slang_oper_void,
|
||||
slang_oper_literal_bool,
|
||||
slang_oper_literal_int,
|
||||
slang_oper_literal_float,
|
||||
slang_oper_identifier,
|
||||
slang_oper_sequence,
|
||||
slang_oper_assign,
|
||||
slang_oper_addassign,
|
||||
slang_oper_subassign,
|
||||
slang_oper_mulassign,
|
||||
slang_oper_divassign,
|
||||
/*slang_oper_modassign,*/
|
||||
/*slang_oper_lshassign,*/
|
||||
/*slang_oper_rshassign,*/
|
||||
/*slang_oper_orassign,*/
|
||||
/*slang_oper_xorassign,*/
|
||||
/*slang_oper_andassign,*/
|
||||
slang_oper_select,
|
||||
slang_oper_logicalor,
|
||||
slang_oper_logicalxor,
|
||||
slang_oper_logicaland,
|
||||
/*slang_oper_bitor,*/
|
||||
/*slang_oper_bitxor,*/
|
||||
/*slang_oper_bitand,*/
|
||||
slang_oper_equal,
|
||||
slang_oper_notequal,
|
||||
slang_oper_less,
|
||||
slang_oper_greater,
|
||||
slang_oper_lessequal,
|
||||
slang_oper_greaterequal,
|
||||
/*slang_oper_lshift,*/
|
||||
/*slang_oper_rshift,*/
|
||||
slang_oper_add,
|
||||
slang_oper_subtract,
|
||||
slang_oper_multiply,
|
||||
slang_oper_divide,
|
||||
/*slang_oper_modulus,*/
|
||||
slang_oper_preincrement,
|
||||
slang_oper_predecrement,
|
||||
slang_oper_plus,
|
||||
slang_oper_minus,
|
||||
/*slang_oper_complement,*/
|
||||
slang_oper_not,
|
||||
slang_oper_subscript,
|
||||
slang_oper_call,
|
||||
slang_oper_field,
|
||||
slang_oper_postincrement,
|
||||
slang_oper_postdecrement
|
||||
} slang_operation_type;
|
||||
|
||||
typedef struct slang_operation_
|
||||
{
|
||||
slang_operation_type type;
|
||||
struct slang_operation_ *children;
|
||||
unsigned int num_children;
|
||||
float literal; /* type: bool, literal_int, literal_float */
|
||||
char *identifier; /* type: asm, identifier, call, field */
|
||||
slang_variable_scope *locals;
|
||||
} slang_operation;
|
||||
|
||||
int slang_operation_construct (slang_operation *);
|
||||
void slang_operation_destruct (slang_operation *);
|
||||
int slang_operation_copy (slang_operation *, const slang_operation *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
191
src/mesa/shader/slang/slang_compile_struct.c
Normal file
191
src/mesa/shader/slang/slang_compile_struct.c
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file slang_compile_struct.c
|
||||
* slang front-end compiler
|
||||
* \author Michal Krol
|
||||
*/
|
||||
|
||||
#include "imports.h"
|
||||
#include "slang_utility.h"
|
||||
#include "slang_compile_variable.h"
|
||||
#include "slang_compile_struct.h"
|
||||
#include "slang_compile_operation.h"
|
||||
#include "slang_compile_function.h"
|
||||
|
||||
/* slang_struct_scope */
|
||||
|
||||
int slang_struct_scope_construct (slang_struct_scope *scope)
|
||||
{
|
||||
scope->structs = NULL;
|
||||
scope->num_structs = 0;
|
||||
scope->outer_scope = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void slang_struct_scope_destruct (slang_struct_scope *scope)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < scope->num_structs; i++)
|
||||
slang_struct_destruct (scope->structs + i);
|
||||
slang_alloc_free (scope->structs);
|
||||
/* do not free scope->outer_scope */
|
||||
}
|
||||
|
||||
int slang_struct_scope_copy (slang_struct_scope *x, const slang_struct_scope *y)
|
||||
{
|
||||
slang_struct_scope z;
|
||||
unsigned int i;
|
||||
|
||||
if (!slang_struct_scope_construct (&z))
|
||||
return 0;
|
||||
z.structs = (slang_struct *) slang_alloc_malloc (y->num_structs * sizeof (slang_struct));
|
||||
if (z.structs == NULL)
|
||||
{
|
||||
slang_struct_scope_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
for (z.num_structs = 0; z.num_structs < y->num_structs; z.num_structs++)
|
||||
if (!slang_struct_construct (&z.structs[z.num_structs]))
|
||||
{
|
||||
slang_struct_scope_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < z.num_structs; i++)
|
||||
if (!slang_struct_copy (&z.structs[i], &y->structs[i]))
|
||||
{
|
||||
slang_struct_scope_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
z.outer_scope = y->outer_scope;
|
||||
slang_struct_scope_destruct (x);
|
||||
*x = z;
|
||||
return 1;
|
||||
}
|
||||
|
||||
slang_struct *slang_struct_scope_find (slang_struct_scope *stru, const char *name, int all_scopes)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < stru->num_structs; i++)
|
||||
if (slang_string_compare (name, stru->structs[i].name) == 0)
|
||||
return stru->structs + i;
|
||||
if (all_scopes && stru->outer_scope != NULL)
|
||||
return slang_struct_scope_find (stru->outer_scope, name, 1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* slang_struct */
|
||||
|
||||
int slang_struct_construct (slang_struct *stru)
|
||||
{
|
||||
stru->name = NULL;
|
||||
stru->fields = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
|
||||
if (stru->fields == NULL)
|
||||
return 0;
|
||||
if (!slang_variable_scope_construct (stru->fields))
|
||||
{
|
||||
slang_alloc_free (stru->fields);
|
||||
return 0;
|
||||
}
|
||||
stru->structs = (slang_struct_scope *) slang_alloc_malloc (sizeof (slang_struct_scope));
|
||||
if (stru->structs == NULL)
|
||||
{
|
||||
slang_variable_scope_destruct (stru->fields);
|
||||
slang_alloc_free (stru->fields);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_struct_scope_construct (stru->structs))
|
||||
{
|
||||
slang_variable_scope_destruct (stru->fields);
|
||||
slang_alloc_free (stru->fields);
|
||||
slang_alloc_free (stru->structs);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void slang_struct_destruct (slang_struct *stru)
|
||||
{
|
||||
slang_alloc_free (stru->name);
|
||||
slang_variable_scope_destruct (stru->fields);
|
||||
slang_alloc_free (stru->fields);
|
||||
slang_struct_scope_destruct (stru->structs);
|
||||
slang_alloc_free (stru->structs);
|
||||
}
|
||||
|
||||
int slang_struct_copy (slang_struct *x, const slang_struct *y)
|
||||
{
|
||||
slang_struct z;
|
||||
|
||||
if (!slang_struct_construct (&z))
|
||||
return 0;
|
||||
if (y->name != NULL)
|
||||
{
|
||||
z.name = slang_string_duplicate (y->name);
|
||||
if (z.name == NULL)
|
||||
{
|
||||
slang_struct_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (!slang_variable_scope_copy (z.fields, y->fields))
|
||||
{
|
||||
slang_struct_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_struct_scope_copy (z.structs, y->structs))
|
||||
{
|
||||
slang_struct_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
slang_struct_destruct (x);
|
||||
*x = z;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int slang_struct_equal (const slang_struct *x, const slang_struct *y)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (x->fields->num_variables != y->fields->num_variables)
|
||||
return 0;
|
||||
for (i = 0; i < x->fields->num_variables; i++)
|
||||
{
|
||||
slang_variable *varx = x->fields->variables + i;
|
||||
slang_variable *vary = y->fields->variables + i;
|
||||
if (slang_string_compare (varx->name, vary->name) != 0)
|
||||
return 0;
|
||||
if (!slang_type_specifier_equal (&varx->type.specifier, &vary->type.specifier))
|
||||
return 0;
|
||||
if (varx->type.specifier.type == slang_spec_array)
|
||||
{
|
||||
/* TODO compare array sizes */
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
61
src/mesa/shader/slang/slang_compile_struct.h
Normal file
61
src/mesa/shader/slang/slang_compile_struct.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if !defined SLANG_COMPILE_STRUCT_H
|
||||
#define SLANG_COMPILE_STRUCT_H
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct slang_struct_scope_
|
||||
{
|
||||
struct slang_struct_ *structs;
|
||||
unsigned int num_structs;
|
||||
struct slang_struct_scope_ *outer_scope;
|
||||
} slang_struct_scope;
|
||||
|
||||
int slang_struct_scope_construct (slang_struct_scope *);
|
||||
void slang_struct_scope_destruct (slang_struct_scope *);
|
||||
int slang_struct_scope_copy (slang_struct_scope *, const slang_struct_scope *);
|
||||
struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, const char *, int);
|
||||
|
||||
typedef struct slang_struct_
|
||||
{
|
||||
char *name;
|
||||
struct slang_variable_scope_ *fields;
|
||||
slang_struct_scope *structs;
|
||||
} slang_struct;
|
||||
|
||||
int slang_struct_construct (slang_struct *);
|
||||
void slang_struct_destruct (slang_struct *);
|
||||
int slang_struct_copy (slang_struct *, const slang_struct *);
|
||||
int slang_struct_equal (const slang_struct *, const slang_struct *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
371
src/mesa/shader/slang/slang_compile_variable.c
Normal file
371
src/mesa/shader/slang/slang_compile_variable.c
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file slang_compile_variable.c
|
||||
* slang front-end compiler
|
||||
* \author Michal Krol
|
||||
*/
|
||||
|
||||
#include "imports.h"
|
||||
#include "slang_utility.h"
|
||||
#include "slang_compile_variable.h"
|
||||
#include "slang_compile_struct.h"
|
||||
#include "slang_compile_operation.h"
|
||||
#include "slang_compile_function.h"
|
||||
|
||||
/* slang_type_specifier_type */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
slang_type_specifier_type type;
|
||||
} type_specifier_type_name;
|
||||
|
||||
static type_specifier_type_name type_specifier_type_names[] = {
|
||||
{ "void", slang_spec_void },
|
||||
{ "bool", slang_spec_bool },
|
||||
{ "bvec2", slang_spec_bvec2 },
|
||||
{ "bvec3", slang_spec_bvec3 },
|
||||
{ "bvec4", slang_spec_bvec4 },
|
||||
{ "int", slang_spec_int },
|
||||
{ "ivec2", slang_spec_ivec2 },
|
||||
{ "ivec3", slang_spec_ivec3 },
|
||||
{ "ivec4", slang_spec_ivec4 },
|
||||
{ "float", slang_spec_float },
|
||||
{ "vec2", slang_spec_vec2 },
|
||||
{ "vec3", slang_spec_vec3 },
|
||||
{ "vec4", slang_spec_vec4 },
|
||||
{ "mat2", slang_spec_mat2 },
|
||||
{ "mat3", slang_spec_mat3 },
|
||||
{ "mat4", slang_spec_mat4 },
|
||||
{ "sampler1D", slang_spec_sampler1D },
|
||||
{ "sampler2D", slang_spec_sampler2D },
|
||||
{ "sampler3D", slang_spec_sampler3D },
|
||||
{ "samplerCube", slang_spec_samplerCube },
|
||||
{ "sampler1DShadow", slang_spec_sampler1DShadow },
|
||||
{ "sampler2DShadow", slang_spec_sampler2DShadow },
|
||||
{ NULL, slang_spec_void }
|
||||
};
|
||||
|
||||
slang_type_specifier_type slang_type_specifier_type_from_string (const char *name)
|
||||
{
|
||||
type_specifier_type_name *p = type_specifier_type_names;
|
||||
while (p->name != NULL)
|
||||
{
|
||||
if (slang_string_compare (p->name, name) == 0)
|
||||
break;
|
||||
p++;
|
||||
}
|
||||
return p->type;
|
||||
}
|
||||
|
||||
const char *slang_type_specifier_type_to_string (slang_type_specifier_type type)
|
||||
{
|
||||
type_specifier_type_name *p = type_specifier_type_names;
|
||||
while (p->name != NULL)
|
||||
{
|
||||
if (p->type == type)
|
||||
break;
|
||||
p++;
|
||||
}
|
||||
return p->name;
|
||||
}
|
||||
|
||||
/* slang_type_specifier */
|
||||
|
||||
int slang_type_specifier_construct (slang_type_specifier *spec)
|
||||
{
|
||||
spec->type = slang_spec_void;
|
||||
spec->_struct = NULL;
|
||||
spec->_array = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void slang_type_specifier_destruct (slang_type_specifier *spec)
|
||||
{
|
||||
if (spec->_struct != NULL)
|
||||
{
|
||||
slang_struct_destruct (spec->_struct);
|
||||
slang_alloc_free (spec->_struct);
|
||||
}
|
||||
if (spec->_array != NULL)
|
||||
{
|
||||
slang_type_specifier_destruct (spec->_array);
|
||||
slang_alloc_free (spec->_array);
|
||||
}
|
||||
}
|
||||
|
||||
int slang_type_specifier_copy (slang_type_specifier *x, const slang_type_specifier *y)
|
||||
{
|
||||
slang_type_specifier z;
|
||||
|
||||
if (!slang_type_specifier_construct (&z))
|
||||
return 0;
|
||||
z.type = y->type;
|
||||
if (z.type == slang_spec_struct)
|
||||
{
|
||||
z._struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));
|
||||
if (z._struct == NULL)
|
||||
{
|
||||
slang_type_specifier_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_struct_construct (z._struct))
|
||||
{
|
||||
slang_alloc_free (z._struct);
|
||||
slang_type_specifier_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_struct_copy (z._struct, y->_struct))
|
||||
{
|
||||
slang_type_specifier_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (z.type == slang_spec_array)
|
||||
{
|
||||
z._array = (slang_type_specifier *) slang_alloc_malloc (sizeof (slang_type_specifier));
|
||||
if (z._array == NULL)
|
||||
{
|
||||
slang_type_specifier_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_type_specifier_construct (z._array))
|
||||
{
|
||||
slang_alloc_free (z._array);
|
||||
slang_type_specifier_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_type_specifier_copy (z._array, y->_array))
|
||||
{
|
||||
slang_type_specifier_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
slang_type_specifier_destruct (x);
|
||||
*x = z;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int slang_type_specifier_equal (const slang_type_specifier *x, const slang_type_specifier *y)
|
||||
{
|
||||
if (x->type != y->type)
|
||||
return 0;
|
||||
if (x->type == slang_spec_struct)
|
||||
return slang_struct_equal (x->_struct, y->_struct);
|
||||
if (x->type == slang_spec_array)
|
||||
return slang_type_specifier_equal (x->_array, y->_array);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* slang_fully_specified_type */
|
||||
|
||||
int slang_fully_specified_type_construct (slang_fully_specified_type *type)
|
||||
{
|
||||
type->qualifier = slang_qual_none;
|
||||
if (!slang_type_specifier_construct (&type->specifier))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void slang_fully_specified_type_destruct (slang_fully_specified_type *type)
|
||||
{
|
||||
slang_type_specifier_destruct (&type->specifier);
|
||||
}
|
||||
|
||||
int slang_fully_specified_type_copy (slang_fully_specified_type *x, const slang_fully_specified_type *y)
|
||||
{
|
||||
slang_fully_specified_type z;
|
||||
|
||||
if (!slang_fully_specified_type_construct (&z))
|
||||
return 0;
|
||||
z.qualifier = y->qualifier;
|
||||
if (!slang_type_specifier_copy (&z.specifier, &y->specifier))
|
||||
{
|
||||
slang_fully_specified_type_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
slang_fully_specified_type_destruct (x);
|
||||
*x = z;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* slang_variable_scope */
|
||||
|
||||
int slang_variable_scope_construct (slang_variable_scope *scope)
|
||||
{
|
||||
scope->variables = NULL;
|
||||
scope->num_variables = 0;
|
||||
scope->outer_scope = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void slang_variable_scope_destruct (slang_variable_scope *scope)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < scope->num_variables; i++)
|
||||
slang_variable_destruct (scope->variables + i);
|
||||
slang_alloc_free (scope->variables);
|
||||
/* do not free scope->outer_scope */
|
||||
}
|
||||
|
||||
int slang_variable_scope_copy (slang_variable_scope *x, const slang_variable_scope *y)
|
||||
{
|
||||
slang_variable_scope z;
|
||||
unsigned int i;
|
||||
|
||||
if (!slang_variable_scope_construct (&z))
|
||||
return 0;
|
||||
z.variables = (slang_variable *) slang_alloc_malloc (y->num_variables * sizeof (slang_variable));
|
||||
if (z.variables == NULL)
|
||||
{
|
||||
slang_variable_scope_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
for (z.num_variables = 0; z.num_variables < y->num_variables; z.num_variables++)
|
||||
if (!slang_variable_construct (&z.variables[z.num_variables]))
|
||||
{
|
||||
slang_variable_scope_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < z.num_variables; i++)
|
||||
if (!slang_variable_copy (&z.variables[i], &y->variables[i]))
|
||||
{
|
||||
slang_variable_scope_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
z.outer_scope = y->outer_scope;
|
||||
slang_variable_scope_destruct (x);
|
||||
*x = z;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* slang_variable */
|
||||
|
||||
int slang_variable_construct (slang_variable *var)
|
||||
{
|
||||
if (!slang_fully_specified_type_construct (&var->type))
|
||||
return 0;
|
||||
var->name = NULL;
|
||||
var->array_size = NULL;
|
||||
var->initializer = NULL;
|
||||
var->address = ~0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void slang_variable_destruct (slang_variable *var)
|
||||
{
|
||||
slang_fully_specified_type_destruct (&var->type);
|
||||
slang_alloc_free (var->name);
|
||||
if (var->array_size != NULL)
|
||||
{
|
||||
slang_operation_destruct (var->array_size);
|
||||
slang_alloc_free (var->array_size);
|
||||
}
|
||||
if (var->initializer != NULL)
|
||||
{
|
||||
slang_operation_destruct (var->initializer);
|
||||
slang_alloc_free (var->initializer);
|
||||
}
|
||||
}
|
||||
|
||||
int slang_variable_copy (slang_variable *x, const slang_variable *y)
|
||||
{
|
||||
slang_variable z;
|
||||
|
||||
if (!slang_variable_construct (&z))
|
||||
return 0;
|
||||
if (!slang_fully_specified_type_copy (&z.type, &y->type))
|
||||
{
|
||||
slang_variable_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (y->name != NULL)
|
||||
{
|
||||
z.name = slang_string_duplicate (y->name);
|
||||
if (z.name == NULL)
|
||||
{
|
||||
slang_variable_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (y->array_size != NULL)
|
||||
{
|
||||
z.array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
|
||||
if (z.array_size == NULL)
|
||||
{
|
||||
slang_variable_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_operation_construct (z.array_size))
|
||||
{
|
||||
slang_alloc_free (z.array_size);
|
||||
slang_variable_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_operation_copy (z.array_size, y->array_size))
|
||||
{
|
||||
slang_variable_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (y->initializer != NULL)
|
||||
{
|
||||
z.initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
|
||||
if (z.initializer == NULL)
|
||||
{
|
||||
slang_variable_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_operation_construct (z.initializer))
|
||||
{
|
||||
slang_alloc_free (z.initializer);
|
||||
slang_variable_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
if (!slang_operation_copy (z.initializer, y->initializer))
|
||||
{
|
||||
slang_variable_destruct (&z);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
slang_variable_destruct (x);
|
||||
*x = z;
|
||||
return 1;
|
||||
}
|
||||
|
||||
slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < scope->num_variables; i++)
|
||||
if (slang_string_compare (name, scope->variables[i].name) == 0)
|
||||
return scope->variables + i;
|
||||
if (all && scope->outer_scope != NULL)
|
||||
return _slang_locate_variable (scope->outer_scope, name, 1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
129
src/mesa/shader/slang/slang_compile_variable.h
Normal file
129
src/mesa/shader/slang/slang_compile_variable.h
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if !defined SLANG_COMPILE_VARIABLE_H
|
||||
#define SLANG_COMPILE_VARIABLE_H
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum slang_type_qualifier_
|
||||
{
|
||||
slang_qual_none,
|
||||
slang_qual_const,
|
||||
slang_qual_attribute,
|
||||
slang_qual_varying,
|
||||
slang_qual_uniform,
|
||||
slang_qual_out,
|
||||
slang_qual_inout,
|
||||
slang_qual_fixedoutput, /* internal */
|
||||
slang_qual_fixedinput /* internal */
|
||||
} slang_type_qualifier;
|
||||
|
||||
typedef enum slang_type_specifier_type_
|
||||
{
|
||||
slang_spec_void,
|
||||
slang_spec_bool,
|
||||
slang_spec_bvec2,
|
||||
slang_spec_bvec3,
|
||||
slang_spec_bvec4,
|
||||
slang_spec_int,
|
||||
slang_spec_ivec2,
|
||||
slang_spec_ivec3,
|
||||
slang_spec_ivec4,
|
||||
slang_spec_float,
|
||||
slang_spec_vec2,
|
||||
slang_spec_vec3,
|
||||
slang_spec_vec4,
|
||||
slang_spec_mat2,
|
||||
slang_spec_mat3,
|
||||
slang_spec_mat4,
|
||||
slang_spec_sampler1D,
|
||||
slang_spec_sampler2D,
|
||||
slang_spec_sampler3D,
|
||||
slang_spec_samplerCube,
|
||||
slang_spec_sampler1DShadow,
|
||||
slang_spec_sampler2DShadow,
|
||||
slang_spec_struct,
|
||||
slang_spec_array
|
||||
} slang_type_specifier_type;
|
||||
|
||||
slang_type_specifier_type slang_type_specifier_type_from_string (const char *);
|
||||
const char *slang_type_specifier_type_to_string (slang_type_specifier_type);
|
||||
|
||||
typedef struct slang_type_specifier_
|
||||
{
|
||||
slang_type_specifier_type type;
|
||||
struct slang_struct_ *_struct; /* type: spec_struct */
|
||||
struct slang_type_specifier_ *_array; /* type: spec_array */
|
||||
} slang_type_specifier;
|
||||
|
||||
int slang_type_specifier_construct (slang_type_specifier *);
|
||||
void slang_type_specifier_destruct (slang_type_specifier *);
|
||||
int slang_type_specifier_copy (slang_type_specifier *, const slang_type_specifier *);
|
||||
int slang_type_specifier_equal (const slang_type_specifier *, const slang_type_specifier *);
|
||||
|
||||
typedef struct slang_fully_specified_type_
|
||||
{
|
||||
slang_type_qualifier qualifier;
|
||||
slang_type_specifier specifier;
|
||||
} slang_fully_specified_type;
|
||||
|
||||
int slang_fully_specified_type_construct (slang_fully_specified_type *);
|
||||
void slang_fully_specified_type_destruct (slang_fully_specified_type *);
|
||||
int slang_fully_specified_type_copy (slang_fully_specified_type *, const slang_fully_specified_type *);
|
||||
|
||||
typedef struct slang_variable_scope_
|
||||
{
|
||||
struct slang_variable_ *variables;
|
||||
unsigned int num_variables;
|
||||
struct slang_variable_scope_ *outer_scope;
|
||||
} slang_variable_scope;
|
||||
|
||||
int slang_variable_scope_construct (slang_variable_scope *);
|
||||
void slang_variable_scope_destruct (slang_variable_scope *);
|
||||
int slang_variable_scope_copy (slang_variable_scope *, const slang_variable_scope *);
|
||||
|
||||
typedef struct slang_variable_
|
||||
{
|
||||
slang_fully_specified_type type;
|
||||
char *name;
|
||||
struct slang_operation_ *array_size; /* type: spec_array */
|
||||
struct slang_operation_ *initializer;
|
||||
unsigned int address;
|
||||
} slang_variable;
|
||||
|
||||
int slang_variable_construct (slang_variable *);
|
||||
void slang_variable_destruct (slang_variable *);
|
||||
int slang_variable_copy (slang_variable *, const slang_variable *);
|
||||
|
||||
slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 2005 Brian Paul All Rights Reserved.
|
||||
* 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"),
|
||||
|
|
@ -112,19 +112,20 @@ static int aggregate_matrix (slang_storage_aggregate *agg, slang_storage_type ba
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int aggregate_variables (slang_storage_aggregate *agg, const slang_variable_scope *vars,
|
||||
slang_function_scope *funcs, slang_struct_scope *structs)
|
||||
static int aggregate_variables (slang_storage_aggregate *agg, slang_variable_scope *vars,
|
||||
slang_function_scope *funcs, slang_struct_scope *structs, slang_variable_scope *globals)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < vars->num_variables; i++)
|
||||
if (!_slang_aggregate_variable (agg, &vars->variables[i].type.specifier,
|
||||
vars->variables[i].array_size, funcs, structs))
|
||||
vars->variables[i].array_size, funcs, structs, globals))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _slang_aggregate_variable (slang_storage_aggregate *agg, slang_type_specifier *spec,
|
||||
slang_operation *array_size, slang_function_scope *funcs, slang_struct_scope *structs)
|
||||
slang_operation *array_size, slang_function_scope *funcs, slang_struct_scope *structs,
|
||||
slang_variable_scope *vars)
|
||||
{
|
||||
switch (spec->type)
|
||||
{
|
||||
|
|
@ -166,7 +167,7 @@ int _slang_aggregate_variable (slang_storage_aggregate *agg, slang_type_specifie
|
|||
case slang_spec_sampler2DShadow:
|
||||
return aggregate_vector (agg, slang_stor_int, 1);
|
||||
case slang_spec_struct:
|
||||
return aggregate_variables (agg, spec->_struct->fields, funcs, structs);
|
||||
return aggregate_variables (agg, spec->_struct->fields, funcs, structs, vars);
|
||||
case slang_spec_array:
|
||||
{
|
||||
slang_storage_array *arr;
|
||||
|
|
@ -185,13 +186,12 @@ int _slang_aggregate_variable (slang_storage_aggregate *agg, slang_type_specifie
|
|||
if (arr->aggregate == NULL)
|
||||
return 0;
|
||||
slang_storage_aggregate_construct (arr->aggregate);
|
||||
if (!_slang_aggregate_variable (arr->aggregate, spec->_array, NULL, funcs, structs))
|
||||
if (!_slang_aggregate_variable (arr->aggregate, spec->_array, NULL, funcs, structs, vars))
|
||||
return 0;
|
||||
slang_assembly_file_construct (&file);
|
||||
space.funcs = funcs;
|
||||
space.structs = structs;
|
||||
/* XXX: vars! */
|
||||
space.vars = NULL;
|
||||
space.vars = vars;
|
||||
if (!_slang_assemble_operation (&file, array_size, 0, &flow, &space, &info, &stk))
|
||||
{
|
||||
slang_assembly_file_destruct (&file);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 2005 Brian Paul All Rights Reserved.
|
||||
* 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"),
|
||||
|
|
@ -85,7 +85,8 @@ void slang_storage_aggregate_construct (slang_storage_aggregate *);
|
|||
void slang_storage_aggregate_destruct (slang_storage_aggregate *);
|
||||
|
||||
int _slang_aggregate_variable (slang_storage_aggregate *, struct slang_type_specifier_ *,
|
||||
struct slang_operation_ *, struct slang_function_scope_ *, slang_struct_scope *);
|
||||
struct slang_operation_ *, struct slang_function_scope_ *, slang_struct_scope *,
|
||||
slang_variable_scope *);
|
||||
|
||||
/*
|
||||
returns total size (in machine units) of the given aggregate
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue