Changeset 2040


Ignore:
Timestamp:
Jul 27, 2006, 5:00:40 PM (14 years ago)
Author:
orlov
Message:
  • New RTS option -break -- for breaking in functions compiled with -dbg.
  • Table support for Values and Entries new library functions.
Location:
to-imperative/trunk/runtime
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/runtime/rf_core.cc

    r1987 r2040  
    9393char** argv ;
    9494
     95int breakc ;
     96char** breakv ;
     97
    9598static int parse_RTS (int _argc, char** const _argv)
    9699{
     
    177180      continue;
    178181    }
    179     printf("Unknown RTS option %.25s\n", _argv[i]);
     182    if (strcmp("-break", _argv[i]) == 0) {
     183      i++;
     184      if (i < _argc) {
     185        breakv[breakc++] = _argv[i++];
     186        continue;
     187      }
     188      printf("RTS option -break requires parameter -- a name of function to break at\n");
     189      exit(-1);
     190    }
     191    printf("Unknown RTS option `%.25s'\n", _argv[i]);
    180192    exit(-1);
    181193  }
     
    222234    argc = 0;
    223235    argv = static_cast<char**>(alloca(_argc * sizeof(char*)));
     236    breakv = static_cast<char**>(alloca(_argc / 2 * sizeof(char*)));
    224237    for (int i = 0; i < _argc; )
    225238    {
  • to-imperative/trunk/runtime/rf_core.hh

    r1987 r2040  
    7676extern char** argv ;
    7777
     78extern int breakc ;
     79extern char** breakv ;
     80
    7881}
    7982
  • to-imperative/trunk/runtime/rf_table.cc

    r1266 r2040  
    365365}
    366366
    367 
    368 }
     367void list_values (TableNode const& _node, Expr& _res)
     368{
     369  if (_node.left != TableNode::nil) {   
     370    list_values( * _node.left, _res);
     371  }
     372  if (_node.right != TableNode::nil) {
     373    list_values( * _node.right, _res);
     374  }
     375  _res = _res + _node.val();
     376}
     377
     378void list_entries (TableNode const& _node, Expr& _res)
     379{
     380  if (_node.left != TableNode::nil) {   
     381    list_entries( * _node.left, _res);
     382  }
     383  if (_node.right != TableNode::nil) {
     384    list_entries( * _node.right, _res);
     385  }
     386  _res = _res + (_node.key() + _node.val())();
     387}
     388
     389
     390}
  • to-imperative/trunk/runtime/rf_table.hh

    r1378 r2040  
    3838  inline bool lookup (Expr const& _key, Expr& _val);
    3939  inline bool in_table (Expr const& _key);
    40   inline Expr domain ();
     40  inline Expr domain () const;
     41  inline Expr values () const;
     42  inline Expr entries () const;
    4143  inline void replace_table (Table const& _tab);
    4244  inline void bind (Expr const& _key, Expr const& _val);
     
    6466
    6567  friend void list_node (TableNode const&, Expr&) ;
     68  friend void list_values (TableNode const&, Expr&) ;
     69  friend void list_entries (TableNode const&, Expr&) ;
    6670  friend void copy_tree (TableNode const&, TableNode&) ;
    6771  friend void delete_tree (TableNode*) ;
  • to-imperative/trunk/runtime/rf_table.ih

    r1498 r2040  
    7171}
    7272
    73 inline Expr Table::domain ()
     73inline Expr Table::domain () const
    7474
    7575  Expr res = Expr();
    7676  if (root != TableNode::nil)
    7777    list_node(*root, res);   
     78  return res;
     79}
     80
     81inline Expr Table::values () const
     82
     83  Expr res = Expr();
     84  if (root != TableNode::nil)
     85    list_values(*root, res);   
     86  return res;
     87}
     88
     89inline Expr Table::entries () const
     90
     91  Expr res = Expr();
     92  if (root != TableNode::nil)
     93    list_entries(*root, res);   
    7894  return res;
    7995}
Note: See TracChangeset for help on using the changeset viewer.