Changeset 3486


Ignore:
Timestamp:
Mar 11, 2008, 4:14:58 AM (13 years ago)
Author:
orlov
Message:
  • Some advances in compiling to T++.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/compiler/rfp_asail_tpp.rf

    r3485 r3486  
    33// $Date$
    44
    5 $use Apply Arithm Box Class Compare Convert CppMangle List StdIO Table;
     5$use Access Apply Arithm Box Class Compare Convert CppMangle List StdIO Table;
    66$use "rfpc";
    77$use "rfp_helper";
     
    3131$table Decls;
    3232$table Locals;
     33
     34$box Local_Static;
    3335
    3436$func ASAIL_To_CPP e.body = e.cpp_code;
     
    151153      <MapIn &Rfp2Cpp (<Paren e.ress>)> :: e.ress,
    152154      <MapIn &Id 'tout Expr ' (e.ress)> :: e.ress,
     155      <Store &Local_Static /*empty*/>,
     156      <ASAIL_To_CPP e.body> :: e.body,
    153157      <Extract_Qualifiers t.name> :: (e.qualifiers) e,
    154158      <Namespace_Control e.qualifiers>
    155159      ('tfun int '<Name_To_CPP "DECL-FUNC" t.name>' ('<Concat <Intersperse (', ') e.args e.ress>>') {'
    156         (e.trace_enter <ASAIL_To_CPP e.body> e.trace_exit)
     160        (e.trace_enter <Get &Local_Static> e.body e.trace_exit ('return 0;'))
    157161      '}');
    158162    (s.tag s.linkage t.name (e.args) (e.ress) e.body),
     
    250254        <Extract_Qualifiers t.name> (&Name_To_CPP "DECL-OBJ" t.name);
    251255      } :: (e.qualifiers) e (s.name_producer e.name_arg),
    252       <Bind &Locals ("DECL-OBJ" t.name) ()>,
    253       <Put &Const_Exprs (t.name (<Const_Expr_To_CPP e.expr>))>,
    254       <Namespace_Control e.qualifiers>
    255       (e.linkage 'Expr ' <Apply s.name_producer e.name_arg> ';');
     256      <Bind &Locals ("DECL-OBJ" t.name) (<Const_Expr_To_CPP e.comment>)>;
     257      //T/<Put &Const_Exprs (t.name (<Const_Expr_To_CPP e.expr>))>,
     258      //T/<Namespace_Control e.qualifiers>
     259      //T/(e.linkage 'Expr ' <Apply s.name_producer e.name_arg> ';');
    256260    (OBJ s.linkage s.tag t.name) =
    257261      <Bind &Locals ("DECL-OBJ" t.name) ()>,
     
    328332  "ERROR-EXPR" = 'err';
    329333  (STATIC t.name) =
    330     <Get &Current_Namespace> :: e.namespace,
    331     {
    332       <Get &Module_Name> : e.namespace = /*empty*/;
    333       <Get &Module_Name>'::';
    334     } :: e.prefix,
    335     e.prefix <Rfp2Cpp (STATIC t.name)>;
     334    <Rfp2Cpp (STATIC t.name)> :: e.n,
     335    <Put &Local_Static ('TExpr 'e.n';')>,
     336    <Lookup &Locals "DECL-OBJ" (STATIC t.name)> :: e.def,
     337    <Put &Local_Static ('((Expr&) 'e.n').init('e.def', '<Arithm.Sub <Length e.def> 2>');')>,
     338    e.n;
     339    //T/<Get &Current_Namespace> :: e.namespace,
     340    //T/{
     341    //T/  <Get &Module_Name> : e.namespace = /*empty*/;
     342    //T/  <Get &Module_Name>'::';
     343    //T/} :: e.prefix,
     344    //T/e.prefix <Rfp2Cpp (STATIC t.name)>;
    336345  (s.var_tag e.ns t.name) = <Rfp2Cpp (s.var_tag e.ns t.name)>;
    337346  s.sym, {
     
    422431    <Const_Expr_Aux (e.accum <Symbol_To_CPP s.sym>) e.rest>;
    423432  e.accum : v =
    424     {
    425       <CharsToBytes e.accum> : e s.c e,
    426         <Gt (s.c) (127)> =
    427         ' + rftype::Char::create_expr ("' e.accum '")' <Const_Expr_Aux () e.expr>;
    428       //' + Expr::create_seq<Char> (L"' e.accum '")' <Const-Expr-Aux () e.expr>;
    429       ' + rftype::Char::create_expr (L"' e.accum '")' <Const_Expr_Aux () e.expr>;
    430     };
     433    '"'e.accum'"' <Const_Expr_Aux () e.expr>;
     434//T/    {
     435//T/      <CharsToBytes e.accum> : e s.c e,
     436//T/        <Gt (s.c) (127)> =
     437//T/        ' + rftype::Char::create_expr ("' e.accum '")' <Const_Expr_Aux () e.expr>;
     438//T/      //' + Expr::create_seq<Char> (L"' e.accum '")' <Const-Expr-Aux () e.expr>;
     439//T/      ' + rftype::Char::create_expr (L"' e.accum '")' <Const_Expr_Aux () e.expr>;
     440//T/    };
    431441  e.expr : t.item e.rest, t.item : {
    432442    (PAREN e.paren_expr) =
Note: See TracChangeset for help on using the changeset viewer.