From 02f78e46f8df951f3f4a6cb8934f12caddb24fcf Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 3 Jan 2011 16:19:05 +0900 Subject: [PATCH] More expression docs. --- tools/qfcc/include/expr.h | 21 ++++++++++++++++----- tools/qfcc/source/expr.c | 6 ++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tools/qfcc/include/expr.h b/tools/qfcc/include/expr.h index fbe708f4e..2e22a51d9 100644 --- a/tools/qfcc/include/expr.h +++ b/tools/qfcc/include/expr.h @@ -487,14 +487,14 @@ expr_t *new_bind_expr (expr_t *e1, expr_t *e2); /** Create a reference to the global .self entity variable. - This is used for @self. + This is used for \@self. \return A new expression referencing the .self def. */ expr_t *new_self_expr (void); /** Create a reference to the .this entity field. - This is used for @this. + This is used for \@this. \return A new expression referencing the .this def. */ expr_t *new_this_expr (void); @@ -547,6 +547,14 @@ void inc_users (expr_t *e); decremented. */ void dec_users (expr_t *e); + +/** Convert a name to an expression of the appropriate type. + + Converts the expression in-place. If the exprssion is not a name + expression (ex_name), no converision takes place. + + \param e The expression to convert. +*/ void convert_name (expr_t *e); expr_t *append_expr (expr_t *block, expr_t *e); @@ -584,9 +592,12 @@ expr_t *cast_expr (struct type_s *t, expr_t *e); void init_elements (struct def_s *def, expr_t *eles); -expr_t *error (expr_t *e, const char *fmt, ...) __attribute__((format(printf, 2,3))); -expr_t *warning (expr_t *e, const char *fmt, ...) __attribute__((format(printf, 2,3))); -expr_t *notice (expr_t *e, const char *fmt, ...) __attribute__((format(printf, 2,3))); +expr_t *error (expr_t *e, const char *fmt, ...) + __attribute__((format(printf, 2,3))); +expr_t *warning (expr_t *e, const char *fmt, ...) + __attribute__((format(printf, 2,3))); +expr_t *notice (expr_t *e, const char *fmt, ...) + __attribute__((format(printf, 2,3))); const char *get_op_string (int op); diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 839b56889..b4d7f0120 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -141,16 +141,20 @@ convert_name (expr_t *e) expr_t *new; class_t *class; + /// Convert name to enum (integer constant). new = get_enum (name); if (new) goto convert; + /// Convert name to class. class = get_class (name, 0); if (class) { e->type = ex_def; e->e.def = class_pointer_def (class); return; } + + /// Convert name to def. d = get_def (NULL, name, current_scope, st_none); if (d) { if (d->global) { @@ -162,6 +166,8 @@ convert_name (expr_t *e) e->e.def = d; return; } + + /// Convert name to a class ivar in a message body. new = class_ivar_expr (current_class, name); if (new) goto convert;