VisualGST

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

VisualGST

MrGwen
Hi,

Here is the patch to fix the bug with the parse_and_send_attribute and
allow it to parse attributes with more than one arg ;-)

static mst_Boolean
parse_and_send_attribute (gst_parser *p, OOP receiverOOP)
{
  OOP selectorOOP, *args;
  tree_node keyword, value, stmt;
  int i, nb = 0;

#if 0
  printf ("parse attribute\n");
#endif
  lex_skip_mandatory (p, '<');
  keyword = parse_keyword_expression (p, NULL, EXPR_KEYWORD);

  selectorOOP = _gst_compute_keyword_selector (keyword->v_expr.expression);
  nb = _gst_selector_num_args (selectorOOP);
  args = malloc (sizeof (*args) * nb);
  i = 0;
  for (stmt = keyword->v_expr.expression; stmt; stmt =
stmt->v_list.next)
    {
      value = stmt->v_list.value;
      value = _gst_make_statement_list (&value->location, value);
      args[i] = _gst_execute_statements (NULL, value, UNDECLARED_NONE, true);
      if (!args[i])
        {
          _gst_had_error = true;
          break ;
        }
      i = i + 1;
    }

  if (!_gst_had_error)
      _gst_nvmsg_send (receiverOOP, selectorOOP, args, i);

  lex_skip_mandatory (p, '>');
  return !_gst_had_error;
}

Gwen

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: VisualGST

MrGwen
arg it seems I don't free the memory :D
may be a alloca should be better

On Mon, Sep 13, 2010 at 5:02 PM, Gwenaël Casaccio <[hidden email]> wrote:

> Hi,
>
> Here is the patch to fix the bug with the parse_and_send_attribute and
> allow it to parse attributes with more than one arg ;-)
>
> static mst_Boolean
> parse_and_send_attribute (gst_parser *p, OOP receiverOOP)
> {
>  OOP selectorOOP, *args;
>  tree_node keyword, value, stmt;
>  int i, nb = 0;
>
> #if 0
>  printf ("parse attribute\n");
> #endif
>  lex_skip_mandatory (p, '<');
>  keyword = parse_keyword_expression (p, NULL, EXPR_KEYWORD);
>
>  selectorOOP = _gst_compute_keyword_selector (keyword->v_expr.expression);
>  nb = _gst_selector_num_args (selectorOOP);
>  args = malloc (sizeof (*args) * nb);
>  i = 0;
>  for (stmt = keyword->v_expr.expression; stmt; stmt =
> stmt->v_list.next)
>    {
>      value = stmt->v_list.value;
>      value = _gst_make_statement_list (&value->location, value);
>      args[i] = _gst_execute_statements (NULL, value, UNDECLARED_NONE, true);
>      if (!args[i])
>        {
>          _gst_had_error = true;
>          break ;
>        }
>      i = i + 1;
>    }
>
>  if (!_gst_had_error)
>      _gst_nvmsg_send (receiverOOP, selectorOOP, args, i);
>
>  lex_skip_mandatory (p, '>');
>  return !_gst_had_error;
> }
>
> Gwen
>

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk