mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 13:11:00 +00:00
[qfcc] Rename type attributes to properties
I had a feeling that attribute was wrong at the time, then I got reminded of properties.
This commit is contained in:
parent
6ff1704246
commit
e0e168620f
11 changed files with 69 additions and 69 deletions
|
@ -36,7 +36,7 @@
|
||||||
enum {
|
enum {
|
||||||
tf_null,
|
tf_null,
|
||||||
tf_eval,
|
tf_eval,
|
||||||
tf_attribute,
|
tf_property,
|
||||||
tf_function,
|
tf_function,
|
||||||
tf_field,
|
tf_field,
|
||||||
tf_pointer,
|
tf_pointer,
|
||||||
|
|
|
@ -331,7 +331,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int op; ///< type "function"
|
int op; ///< type "function"
|
||||||
const expr_t *params; ///< if dynamic
|
const expr_t *params; ///< if dynamic
|
||||||
const attribute_t *attrib;
|
const attribute_t *property;
|
||||||
const type_t *type;
|
const type_t *type;
|
||||||
const symbol_t *sym;
|
const symbol_t *sym;
|
||||||
} ex_type_t;
|
} ex_type_t;
|
||||||
|
|
|
@ -103,7 +103,7 @@ typedef struct type_s {
|
||||||
int allocated;
|
int allocated;
|
||||||
struct protocollist_s *protos;
|
struct protocollist_s *protos;
|
||||||
const char *encoding; ///< Objective-QC encoding
|
const char *encoding; ///< Objective-QC encoding
|
||||||
const expr_t *(*attrib) (const type_t *type, const attribute_t *attr);
|
const expr_t *(*property) (const type_t *type, const attribute_t *attr);
|
||||||
} type_t;
|
} type_t;
|
||||||
|
|
||||||
#define EV_TYPE(type) extern type_t type_##type;
|
#define EV_TYPE(type) extern type_t type_##type;
|
||||||
|
|
|
@ -343,7 +343,7 @@ is_algebra (const type_t *type)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
algebra_attrib (const type_t *type, const attribute_t *attr)
|
algebra_property (const type_t *type, const attribute_t *attr)
|
||||||
{
|
{
|
||||||
type = algebra_subtype (type, attr);
|
type = algebra_subtype (type, attr);
|
||||||
return new_type_expr (type);
|
return new_type_expr (type);
|
||||||
|
@ -419,7 +419,7 @@ algebra_type (const type_t *type, const expr_t *params)
|
||||||
t->type = ev_invalid;
|
t->type = ev_invalid;
|
||||||
t->alignment = (dim > 1 ? 4 : 2) * type->alignment;
|
t->alignment = (dim > 1 ? 4 : 2) * type->alignment;
|
||||||
t->algebra = algebra;
|
t->algebra = algebra;
|
||||||
t->attrib = algebra_attrib;
|
t->property = algebra_property;
|
||||||
algebra->algebra_type = t;
|
algebra->algebra_type = t;
|
||||||
return find_type (t);
|
return find_type (t);
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ algebra_mvec_type (algebra_t *algebra, pr_uint_t group_mask)
|
||||||
.algebra = (algebra_t *) mvec,
|
.algebra = (algebra_t *) mvec,
|
||||||
.freeable = true,
|
.freeable = true,
|
||||||
.allocated = true,
|
.allocated = true,
|
||||||
.attrib = algebra_attrib,
|
.property = algebra_property,
|
||||||
};
|
};
|
||||||
chain_type (type);
|
chain_type (type);
|
||||||
if (!(group_mask & (group_mask - 1))) {
|
if (!(group_mask & (group_mask - 1))) {
|
||||||
|
|
|
@ -107,7 +107,7 @@ get_op_string (int op)
|
||||||
case QC_REVERSE: return "@reverse";
|
case QC_REVERSE: return "@reverse";
|
||||||
case QC_DUAL: return "@dual";
|
case QC_DUAL: return "@dual";
|
||||||
case QC_UNDUAL: return "@undual";
|
case QC_UNDUAL: return "@undual";
|
||||||
case QC_ATTRIBUTE: return ".attribute";
|
case QC_ATTRIBUTE: return ".property";
|
||||||
case QC_AT_FUNCTION:return "@function";
|
case QC_AT_FUNCTION:return "@function";
|
||||||
case QC_AT_FIELD: return "@field";
|
case QC_AT_FIELD: return "@field";
|
||||||
case QC_AT_POINTER: return "@pointer";
|
case QC_AT_POINTER: return "@pointer";
|
||||||
|
@ -349,14 +349,14 @@ print_type_expr (dstring_t *dstr, const expr_t *e, int level, int id,
|
||||||
if (!str) {
|
if (!str) {
|
||||||
str = type_get_encoding (e->typ.type);
|
str = type_get_encoding (e->typ.type);
|
||||||
}
|
}
|
||||||
} else if (e->typ.attrib) {
|
} else if (e->typ.property) {
|
||||||
auto attrib = e->typ.attrib;
|
auto property = e->typ.property;
|
||||||
if (attrib->params) {
|
if (property->params) {
|
||||||
_print_expr (dstr, attrib->params, level + 1, id, nullptr);
|
_print_expr (dstr, property->params, level + 1, id, nullptr);
|
||||||
dasprintf (dstr, "%*se_%p -> e_%p;\n", indent, "", e,
|
dasprintf (dstr, "%*se_%p -> e_%p;\n", indent, "", e,
|
||||||
attrib->params);
|
property->params);
|
||||||
}
|
}
|
||||||
str = attrib->name;
|
str = property->name;
|
||||||
} else if (e->typ.sym) {
|
} else if (e->typ.sym) {
|
||||||
str = e->typ.sym->name;
|
str = e->typ.sym->name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,29 +76,29 @@ fetch_type (unsigned id, typectx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tf_attribute_func (progs_t *pr, void *data)
|
tf_property_func (progs_t *pr, void *data)
|
||||||
{
|
{
|
||||||
auto ctx = *(typectx_t **) data;
|
auto ctx = *(typectx_t **) data;
|
||||||
unsigned id = P_UINT (pr, 0);
|
unsigned id = P_UINT (pr, 0);
|
||||||
auto type = fetch_type (id, ctx);
|
auto type = fetch_type (id, ctx);
|
||||||
if (!type->attrib) {
|
if (!type->property) {
|
||||||
error (ctx->expr, "type doesn't support attributes");
|
error (ctx->expr, "type doesn't support attributes");
|
||||||
Sys_longjmp (ctx->jmpbuf);
|
Sys_longjmp (ctx->jmpbuf);
|
||||||
}
|
}
|
||||||
auto attr_params = &P_STRUCT (pr, pr_int_t, 1);
|
auto attr_params = &P_STRUCT (pr, pr_int_t, 1);
|
||||||
auto name = PR_GetString (pr, attr_params[0]);
|
auto name = PR_GetString (pr, attr_params[0]);
|
||||||
int count = attr_params[1];
|
int count = attr_params[1];
|
||||||
attribute_t *attrib = nullptr;
|
attribute_t *property = nullptr;
|
||||||
if (count) {
|
if (count) {
|
||||||
const expr_t *param_exprs[count] = {};
|
const expr_t *param_exprs[count] = {};
|
||||||
internal_error (ctx->expr, "not implemented");
|
internal_error (ctx->expr, "not implemented");
|
||||||
auto params = new_list_expr (nullptr);
|
auto params = new_list_expr (nullptr);
|
||||||
list_gather (¶ms->list, param_exprs, count);
|
list_gather (¶ms->list, param_exprs, count);
|
||||||
attrib = new_attribute (name, params);
|
property = new_attribute (name, params);
|
||||||
} else {
|
} else {
|
||||||
attrib = new_attribute (name, nullptr);
|
property = new_attribute (name, nullptr);
|
||||||
}
|
}
|
||||||
auto e = type->attrib (type, attrib);
|
auto e = type->property (type, property);
|
||||||
if (is_error (e)) {
|
if (is_error (e)) {
|
||||||
Sys_longjmp (ctx->jmpbuf);
|
Sys_longjmp (ctx->jmpbuf);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ static typectx_t *type_genfunc;
|
||||||
static bfunction_t type_functions[] = {
|
static bfunction_t type_functions[] = {
|
||||||
{}, // null function
|
{}, // null function
|
||||||
[tf_eval] = { .first_statement = 1 },
|
[tf_eval] = { .first_statement = 1 },
|
||||||
TF_FUNC(tf_attribute),
|
TF_FUNC(tf_property),
|
||||||
TF_FUNC(tf_function),
|
TF_FUNC(tf_function),
|
||||||
TF_FUNC(tf_field),
|
TF_FUNC(tf_field),
|
||||||
TF_FUNC(tf_pointer),
|
TF_FUNC(tf_pointer),
|
||||||
|
|
|
@ -84,9 +84,9 @@ check_type (const expr_t *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
check_attribute (const expr_t *arg)
|
check_property (const expr_t *arg)
|
||||||
{
|
{
|
||||||
if (arg->type != ex_type && !arg->typ.attrib) {
|
if (arg->type != ex_type && !arg->typ.property) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -132,7 +132,7 @@ single_type (int arg_count, const expr_t **args)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
single_type_attribute (int arg_count, const expr_t **args)
|
single_type_property (int arg_count, const expr_t **args)
|
||||||
{
|
{
|
||||||
if (arg_count < 1) {
|
if (arg_count < 1) {
|
||||||
return "too few arguments";
|
return "too few arguments";
|
||||||
|
@ -143,8 +143,8 @@ single_type_attribute (int arg_count, const expr_t **args)
|
||||||
if (!check_type (args[0])) {
|
if (!check_type (args[0])) {
|
||||||
return "first parameter must be a type";
|
return "first parameter must be a type";
|
||||||
}
|
}
|
||||||
if (!check_attribute (args[1])) {
|
if (!check_property (args[1])) {
|
||||||
return "second parameter must be a type attribute";
|
return "second parameter must be a type property";
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -189,16 +189,16 @@ single_type_opt_int_pair (int arg_count, const expr_t **args)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
evaluate_attribute (int arg_count, const expr_t **args, rua_ctx_t *ctx)
|
evaluate_property (int arg_count, const expr_t **args, rua_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
auto type = resolve_type (args[0], ctx);
|
auto type = resolve_type (args[0], ctx);
|
||||||
if (!type) {
|
if (!type) {
|
||||||
return error (args[0], "could not resolve type");
|
return error (args[0], "could not resolve type");
|
||||||
}
|
}
|
||||||
if (!type->attrib) {
|
if (!type->property) {
|
||||||
return error (args[0], "type doesn't support attributes");
|
return error (args[0], "type doesn't support properties");
|
||||||
} else {
|
} else {
|
||||||
auto e = type->attrib (type, args[1]->typ.attrib);
|
auto e = type->property (type, args[1]->typ.property);
|
||||||
if (!is_error (e)) {
|
if (!is_error (e)) {
|
||||||
e = eval_type (e, ctx);
|
e = eval_type (e, ctx);
|
||||||
}
|
}
|
||||||
|
@ -249,14 +249,14 @@ evaluate_int_op (int arg_count, const expr_t **args, rua_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const type_t *
|
static const type_t *
|
||||||
resolve_attribute (int arg_count, const expr_t **args, rua_ctx_t *ctx)
|
resolve_property (int arg_count, const expr_t **args, rua_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
auto type = resolve_type (args[0], ctx);
|
auto type = resolve_type (args[0], ctx);
|
||||||
if (type) {
|
if (type) {
|
||||||
if (!type->attrib) {
|
if (!type->property) {
|
||||||
error (args[0], "type doesn't support attributes");
|
error (args[0], "type doesn't support properties");
|
||||||
} else {
|
} else {
|
||||||
auto e = type->attrib (type, args[1]->typ.attrib);
|
auto e = type->property (type, args[1]->typ.property);
|
||||||
if (is_error (e)) {
|
if (is_error (e)) {
|
||||||
type = nullptr;
|
type = nullptr;
|
||||||
} else {
|
} else {
|
||||||
|
@ -502,21 +502,21 @@ static def_t *compute_val (const expr_t *arg, comp_ctx_t *ctx);
|
||||||
#define C(op, a, b, c) codespace_addcode (ctx->code, I(op, a, b, c), 1)
|
#define C(op, a, b, c) codespace_addcode (ctx->code, I(op, a, b, c), 1)
|
||||||
|
|
||||||
static def_t *
|
static def_t *
|
||||||
compute_attribute (int arg_count, const expr_t **args, comp_ctx_t *ctx)
|
compute_property (int arg_count, const expr_t **args, comp_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
auto type = compute_type (args[0], ctx);
|
auto type = compute_type (args[0], ctx);
|
||||||
auto res = compute_tmp (ctx);
|
auto res = compute_tmp (ctx);
|
||||||
auto attrib = args[1]->typ.attrib;
|
auto property = args[1]->typ.property;
|
||||||
int count = attrib->params ? list_count (&attrib->params->list) : 0;
|
int count = property->params ? list_count (&property->params->list) : 0;
|
||||||
// FIXME assumes simple 1-component types
|
// FIXME assumes simple 1-component types
|
||||||
auto attr_params = compute_sized_tmp (2 + 2 * count, ctx);
|
auto attr_params = compute_sized_tmp (2 + 2 * count, ctx);
|
||||||
def_t ndef = { .offset = attr_params->offset + 0, .space = ctx->data };
|
def_t ndef = { .offset = attr_params->offset + 0, .space = ctx->data };
|
||||||
def_t cdef = { .offset = attr_params->offset + 1, .space = ctx->data };
|
def_t cdef = { .offset = attr_params->offset + 1, .space = ctx->data };
|
||||||
D_STRING (&ndef) = compute_str (attrib->name, ctx);
|
D_STRING (&ndef) = compute_str (property->name, ctx);
|
||||||
D_INT (&cdef) = count;
|
D_INT (&cdef) = count;
|
||||||
if (count) {
|
if (count) {
|
||||||
const expr_t *params[count];
|
const expr_t *params[count];
|
||||||
list_scatter (&attrib->params->list, params);
|
list_scatter (&property->params->list, params);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
auto p = compute_type (params[i], ctx);
|
auto p = compute_type (params[i], ctx);
|
||||||
auto s = codespace_newstatement (ctx->code);
|
auto s = codespace_newstatement (ctx->code);
|
||||||
|
@ -530,7 +530,7 @@ compute_attribute (int arg_count, const expr_t **args, comp_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
C (OP_STORE_A_1, ctx->args[0], nullptr, type);
|
C (OP_STORE_A_1, ctx->args[0], nullptr, type);
|
||||||
C (OP_LEA_A, attr_params, nullptr, ctx->args[1]);
|
C (OP_LEA_A, attr_params, nullptr, ctx->args[1]);
|
||||||
C (OP_CALL_B, ctx->funcs[tf_attribute], nullptr, res);
|
C (OP_CALL_B, ctx->funcs[tf_property], nullptr, res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,11 +684,11 @@ compute_cols (int arg_count, const expr_t **args, comp_ctx_t *ctx)
|
||||||
|
|
||||||
static type_func_t type_funcs[] = {
|
static type_func_t type_funcs[] = {
|
||||||
[QC_ATTRIBUTE] = {
|
[QC_ATTRIBUTE] = {
|
||||||
.name = ".attribute",
|
.name = ".property",
|
||||||
.check_params = single_type_attribute,
|
.check_params = single_type_property,
|
||||||
.resolve = resolve_attribute,
|
.resolve = resolve_property,
|
||||||
.evaluate = evaluate_attribute,
|
.evaluate = evaluate_property,
|
||||||
.compute = compute_attribute,
|
.compute = compute_property,
|
||||||
},
|
},
|
||||||
[QC_AT_FUNCTION] = {
|
[QC_AT_FUNCTION] = {
|
||||||
.name = "@function",
|
.name = "@function",
|
||||||
|
@ -1036,9 +1036,9 @@ compute_type (const expr_t *arg, comp_ctx_t *ctx)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (arg->type == ex_field) {
|
if (arg->type == ex_field) {
|
||||||
// type attribute
|
// type property
|
||||||
const expr_t *args[2] = {arg->field.object, arg->field.member};
|
const expr_t *args[2] = {arg->field.object, arg->field.member};
|
||||||
return compute_attribute (2, args, ctx);
|
return compute_property (2, args, ctx);
|
||||||
}
|
}
|
||||||
if (arg->type != ex_type) {
|
if (arg->type != ex_type) {
|
||||||
internal_error (arg, "not a type expression");
|
internal_error (arg, "not a type expression");
|
||||||
|
|
|
@ -68,7 +68,7 @@ static int size_widths[7] = { 1, 2, 3, 2, 2, 1, 0 };
|
||||||
static int shadow_widths[7] = { 3, 3, 0, 4, 3, 0, 0 };
|
static int shadow_widths[7] = { 3, 3, 0, 4, 3, 0, 0 };
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
image_attrib (const type_t *type, const attribute_t *attr)
|
image_property (const type_t *type, const attribute_t *property)
|
||||||
{
|
{
|
||||||
auto image = &glsl_imageset.a[type->handle.extra];
|
auto image = &glsl_imageset.a[type->handle.extra];
|
||||||
|
|
||||||
|
@ -76,9 +76,9 @@ image_attrib (const type_t *type, const attribute_t *attr)
|
||||||
internal_error (0, "image has bogus dimension");
|
internal_error (0, "image has bogus dimension");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp (attr->name, "sample_type") == 0) {
|
if (strcmp (property->name, "sample_type") == 0) {
|
||||||
return new_type_expr (image->sample_type);
|
return new_type_expr (image->sample_type);
|
||||||
} else if (strcmp (attr->name, "image_coord") == 0) {
|
} else if (strcmp (property->name, "image_coord") == 0) {
|
||||||
int width = dim_widths[image->dim];
|
int width = dim_widths[image->dim];
|
||||||
if (!width) {
|
if (!width) {
|
||||||
return new_type_expr (&type_void);
|
return new_type_expr (&type_void);
|
||||||
|
@ -87,7 +87,7 @@ image_attrib (const type_t *type, const attribute_t *attr)
|
||||||
width += image->arrayed;
|
width += image->arrayed;
|
||||||
}
|
}
|
||||||
return new_type_expr (vector_type (&type_float, width));
|
return new_type_expr (vector_type (&type_float, width));
|
||||||
} else if (strcmp (attr->name, "size_type") == 0) {
|
} else if (strcmp (property->name, "size_type") == 0) {
|
||||||
int width = size_widths[image->dim];
|
int width = size_widths[image->dim];
|
||||||
if (!width) {
|
if (!width) {
|
||||||
return new_type_expr (&type_void);
|
return new_type_expr (&type_void);
|
||||||
|
@ -97,11 +97,11 @@ image_attrib (const type_t *type, const attribute_t *attr)
|
||||||
}
|
}
|
||||||
return new_type_expr (vector_type (&type_int, width));
|
return new_type_expr (vector_type (&type_int, width));
|
||||||
}
|
}
|
||||||
return error (0, "no attribute %s on %s", attr->name, type->name + 4);
|
return error (0, "no property %s on %s", property->name, type->name + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
sampled_image_attrib (const type_t *type, const attribute_t *attr)
|
sampled_image_property (const type_t *type, const attribute_t *property)
|
||||||
{
|
{
|
||||||
auto image = &glsl_imageset.a[type->handle.extra];
|
auto image = &glsl_imageset.a[type->handle.extra];
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ sampled_image_attrib (const type_t *type, const attribute_t *attr)
|
||||||
internal_error (0, "image has bogus dimension");
|
internal_error (0, "image has bogus dimension");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp (attr->name, "tex_coord") == 0) {
|
if (strcmp (property->name, "tex_coord") == 0) {
|
||||||
int width = dim_widths[image->dim];
|
int width = dim_widths[image->dim];
|
||||||
if (!width) {
|
if (!width) {
|
||||||
return new_type_expr (&type_void);
|
return new_type_expr (&type_void);
|
||||||
|
@ -118,8 +118,8 @@ sampled_image_attrib (const type_t *type, const attribute_t *attr)
|
||||||
width += image->arrayed;
|
width += image->arrayed;
|
||||||
}
|
}
|
||||||
return new_type_expr (vector_type (&type_float, width));
|
return new_type_expr (vector_type (&type_float, width));
|
||||||
} else if (strcmp (attr->name, "shadow_coord") == 0) {
|
} else if (strcmp (property->name, "shadow_coord") == 0) {
|
||||||
if (attr->params) {
|
if (property->params) {
|
||||||
} else {
|
} else {
|
||||||
int width = shadow_widths[image->dim];
|
int width = shadow_widths[image->dim];
|
||||||
if (!image->depth || !width) {
|
if (!image->depth || !width) {
|
||||||
|
@ -131,18 +131,18 @@ sampled_image_attrib (const type_t *type, const attribute_t *attr)
|
||||||
return new_type_expr (vector_type (&type_float, width));
|
return new_type_expr (vector_type (&type_float, width));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return image_attrib (type, attr);
|
return image_property (type, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
type_t type_glsl_image = {
|
type_t type_glsl_image = {
|
||||||
.type = ev_invalid,
|
.type = ev_invalid,
|
||||||
.meta = ty_struct,
|
.meta = ty_struct,
|
||||||
.attrib = image_attrib,
|
.property = image_property,
|
||||||
};
|
};
|
||||||
type_t type_glsl_sampled_image = {
|
type_t type_glsl_sampled_image = {
|
||||||
.type = ev_invalid,
|
.type = ev_invalid,
|
||||||
.meta = ty_struct,
|
.meta = ty_struct,
|
||||||
.attrib = sampled_image_attrib,
|
.property = sampled_image_property,
|
||||||
};
|
};
|
||||||
type_t type_glsl_sampler = {
|
type_t type_glsl_sampler = {
|
||||||
.type = ev_int,
|
.type = ev_int,
|
||||||
|
|
|
@ -1633,9 +1633,9 @@ find_image_sub (image_sub_t *sub, const char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
image_attrib (const type_t *type, const attribute_t *attr)
|
image_property (const type_t *type, const attribute_t *attr)
|
||||||
{
|
{
|
||||||
return type->handle.type->attrib (type, attr);
|
return type->handle.type->property (type, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static symbol_t *
|
static symbol_t *
|
||||||
|
@ -1759,7 +1759,7 @@ glsl_parse_image (const char *token, rua_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
t->handle.type = type.htype;
|
t->handle.type = type.htype;
|
||||||
t->handle.extra = index;
|
t->handle.extra = index;
|
||||||
t->attrib = image_attrib;
|
t->property = image_property;
|
||||||
|
|
||||||
return sym;
|
return sym;
|
||||||
invalid:
|
invalid:
|
||||||
|
|
|
@ -285,16 +285,16 @@ type_spec (const type_t *type)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
type_attribute (specifier_t spec, const attribute_t *attrib)
|
type_property (specifier_t spec, const attribute_t *property)
|
||||||
{
|
{
|
||||||
auto type_expr = spec.type_expr;
|
auto type_expr = spec.type_expr;
|
||||||
if (!type_expr) {
|
if (!type_expr) {
|
||||||
type_expr = new_type_expr (spec.type);
|
type_expr = new_type_expr (spec.type);
|
||||||
}
|
}
|
||||||
auto params = new_list_expr (type_expr);
|
auto params = new_list_expr (type_expr);
|
||||||
auto attr = new_type_expr (nullptr);
|
auto prop = new_type_expr (nullptr);
|
||||||
attr->typ.attrib = attrib;
|
prop->typ.property = property;
|
||||||
expr_append_expr (params, attr);
|
expr_append_expr (params, prop);
|
||||||
return new_type_function (QC_ATTRIBUTE, params);
|
return new_type_function (QC_ATTRIBUTE, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1160,7 +1160,7 @@ typespec_nonreserved
|
||||||
: TYPE_NAME %prec LOW
|
: TYPE_NAME %prec LOW
|
||||||
| TYPE_NAME[spec] '.' attribute
|
| TYPE_NAME[spec] '.' attribute
|
||||||
{
|
{
|
||||||
auto te = type_attribute ($spec, $attribute);
|
auto te = type_property ($spec, $attribute);
|
||||||
$$ = (specifier_t) { .type_expr = te };
|
$$ = (specifier_t) { .type_expr = te };
|
||||||
}
|
}
|
||||||
| OBJECT_NAME protocolrefs
|
| OBJECT_NAME protocolrefs
|
||||||
|
@ -1371,7 +1371,7 @@ type_ref
|
||||||
}
|
}
|
||||||
| TYPE_NAME[spec] '.' attribute
|
| TYPE_NAME[spec] '.' attribute
|
||||||
{
|
{
|
||||||
$$ = type_attribute ($spec, $attribute);
|
$$ = type_property ($spec, $attribute);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -2852,7 +2852,7 @@ obj_messageexpr
|
||||||
}
|
}
|
||||||
| '[' TYPE_NAME[spec] attrfunc ']'
|
| '[' TYPE_NAME[spec] attrfunc ']'
|
||||||
{
|
{
|
||||||
$$ = type_attribute ($spec, $attrfunc);
|
$$ = type_property ($spec, $attrfunc);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -1056,7 +1056,7 @@ alias_type (const type_t *type, const type_t *alias_chain, const char *name)
|
||||||
if (name) {
|
if (name) {
|
||||||
alias->name = save_string (name);
|
alias->name = save_string (name);
|
||||||
}
|
}
|
||||||
alias->attrib = type->attrib;
|
alias->property = type->property;
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue