Changeset 1825


Ignore:
Timestamp:
Dec 29, 2005, 4:57:15 AM (15 years ago)
Author:
orlov
Message:
  • Added proper generation of imports in Java code.
Location:
to-imperative/trunk/compiler
Files:
7 edited

Legend:

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

    r1819 r1825  
    88
    99$box Exports;
     10
     11$table Inputs;
    1012
    1113$box Module-Name;
     
    8284      } :: e.entry,
    8385      <Store &Module-Name <Rfp2Java e.ModuleName>>,
     86      (<Domain &Inputs>)
    8487      ('public class '<? &Module-Name>' {'
    8588        (v.java e.entry)
    86        '}');;
     89       '}');
     90    ();
    8791  };
    8892
     
    98102      <Store &Ress e.ress>,
    99103      { <? &Entry> : t.name = <Store &Entry-Name <Rfp2Java t.name>>;; },
    100       <RFP-Extract-Qualifiers t.name> :: (e.qualifiers) e.n,
    101       <Store &Func-Name <Rfp2Java e.n>>,
     104//      <RFP-Extract-Qualifiers t.name> :: (e.qualifiers) e.n,
     105      <Store &Func-Name <Name-To-Java t.name>>,
    102106      ('static '<Access-Mode t.name>' 'e.return-type' '
    103107        <? &Func-Name>' ('<Var-Args-To-Java e.args e.ress>') throws RefalException')
     
    197201    (CONSTEXPR s.linkage t.name (e.comment) e.expr) =
    198202      {
    199         t.name : (STATIC e) = t.name;
    200         <RFP-Extract-Qualifiers t.name> :: (e.qualifiers) e.name = e.name;
     203        t.name : (STATIC e) = <Rfp2Java t.name>;
     204        //<RFP-Extract-Qualifiers t.name> :: (e.qualifiers) e.name = e.name;
     205        <Name-To-Java t.name>;
    201206      } :: e.n,
    202207      <Const-Expr-To-Java e.expr> :: e.a (e.j-expr),
    203       e.a ('static '<Access-Mode t.name>' final Expr '<Rfp2Java e.n>' = 'e.j-expr';');
     208      e.a ('static '<Access-Mode t.name>' final Expr 'e.n' = 'e.j-expr';');
    204209    (OBJ s.linkage s.tag t.name) =
    205210      <To-Chars s.tag> : s1 e2,
    206211      <RFP-Extract-Qualifiers t.name> :: (e.qualifiers) e.n,
    207       ('static '<Access-Mode t.name>' final Expr '<Rfp2Java e.n>
     212      ('static '<Access-Mode t.name>' final Expr '<Name-To-Java t.name>
    208213        ' = new Expr (new Named' s1 <To-Lower e2>' ("'e.n'"));');
    209214    (DECL-OBJ t.name) = ;
     
    484489  {
    485490    e.qualifiers : e.namespace e.cont = <Rfp2Java e.cont e.name>;
    486     <Rfp2Java (e.qualifiers e.name)>;
     491    <Bind &Inputs (e.qualifiers) ()>,
     492      <Rfp2Java (e.qualifiers e.name)>;
    487493  };
    488494
  • to-imperative/trunk/compiler/rfp_asail_java.rfi

    r1819 r1825  
    33// $Date$
    44
    5 $func RFP-ASAIL-To-Java t.ModuleName (e.exports) e.asail = e.java;
     5$func RFP-ASAIL-To-Java t.ModuleName (e.exports) e.asail = (e.inputs) e.java;
    66
  • to-imperative/trunk/compiler/rfp_lex.rf

    r1464 r1825  
    479479    v = e.dirname &RFP-Dir-Separator;
    480480    e = '.' &RFP-Dir-Separator;
    481   } :: e.dirname,
     481  } :: e.dirn,
    482482//  {
    483483//    e.name $iter { e.name : e1 '.' e2 = e1 &RFP-Dir-Separator e2; } :: e.name,
     
    487487    <In-Table? &RFP-Options CASE-INSENSITIVE> \!
    488488      {
    489         $trap <Open-Dir e.dirname> $with {
     489        $trap <Open-Dir e.dirn> $with {
    490490          e = $fail;
    491491        };
     
    498498              s.ci? : CI, <To-Upper e.basename> : e.NAME;
    499499            } =
    500             (<Try-Open e.dirname e.basename '.rfi'>);;
     500            (<Try-Open e.dirn e.basename '.rfi'>);;
    501501        };
    502502      } :: e.res,
    503503      e.res : (e.source) =
    504504      e.source;
    505     <Try-Open e.dirname e.name '.rfi'>;
    506   };
     505    <Try-Open e.dirn e.name '.rfi'>;
     506  } :: e.source,
     507  {
     508    <? &RFP-Boot-Path> :: e.tmp, e.tmp : e (e.dirname) e =
     509      <Bind &RFP-Includes (e.name) (BOOT e.dirn)>;
     510    <Bind &RFP-Includes (e.name) (LOCAL e.dirn)>;
     511  },
     512  e.source;
    507513
    508514Try-Open e.filename =
  • to-imperative/trunk/compiler/rfp_src.rf

    r683 r1825  
    7676  <RFP-File-Name e.path> :: e.file,
    7777  {
    78     e.file : e.module '.' e = e.module;
     78    e.file : $r e.module '.' e = e.module;
    7979    e.file;
    8080  };
  • to-imperative/trunk/compiler/rfp_src.rfi

    r683 r1825  
    3838
    3939$table RFP-Sources ;
     40$table RFP-Includes ;
  • to-imperative/trunk/compiler/rfpc.rf

    r1819 r1825  
    303303                  e.exports;
    304304              } :: e.exports,
    305               <RFP-ASAIL-To-Java t.asail-mod-name (e.exports) e.module> :: e.module,
     305              <RFP-ASAIL-To-Java t.asail-mod-name (e.exports) e.module> :: (e.inputs) e.module,
    306306              <Verbose "compilation from as-ail to java finished">,
    307307              <Open-Channel e.basename ('.java')> :: s.channel s.need-close?,
     
    309309                e.dirname : v =
    310310                  <PrintLN! s.channel
    311                   'package '<Subst (&RFP-Dir-Separator) (('.')) e.dirname>';'>;;
     311                  'package '<Subst (&RFP-Dir-Separator) (('.')) e.dirname>';\n'>;;
    312312              },
    313313              <PrintLN! s.channel 'import org.refal.plus.*;'>,
     314              {
     315                e.inputs : e (e.java-module) e,
     316                  <Lookup &RFP-Includes <To-Chars e.java-module>> : {
     317                    BOOT e = 'org.refal.plus.library.'e.java-module;
     318                    LOCAL e.path =
     319                      <Subst (&RFP-Dir-Separator) (('.')) e.path> e.java-module;
     320                } :: e.java-module,
     321                  <PrintLN! s.channel 'import 'e.java-module';'>,
     322                  $fail;;
     323              },
    314324              <CPP-Pretty-Print 0 s.channel () e.module>,
    315325              { s.need-close? : 1 = <Close-Channel s.channel>;; },
     
    324334  ((('I') ('ipath')) IPATH
    325335    ("dir") "add <dir> to the list of directories to be searched" "for .rfi files")
     336  ((('B') ('bootpath')) BPATH
     337    ("dir") "add <dir> to the list of directories to be searched" "for standard library .rfi files")
    326338  ((('ne') ('no-elaborate')) (BIND NO-ELABORATE))
    327339  ((('nc') ('no-check')) (BIND NO-CHECK)
     
    414426                  <? &RFP-Include-Path> : e1 (e2 &RFP-Dir-Separator),
    415427                    <Store &RFP-Include-Path e1 (e2)>;
     428                };
     429            };
     430          BPATH =
     431            <Store &RFP-Boot-Path <? &RFP-Boot-Path> (v.arg)>,
     432            {
     433              $iter
     434                # \{
     435                  <? &RFP-Boot-Path> : e1 (e2 &RFP-Dir-Separator),
     436                    <Store &RFP-Boot-Path e1 (e2)>;
    416437                };
    417438            };
     
    468489
    469490RFP-Set-Path =
    470   <Store &RFP-Include-Path <? &RFP-Include-Path> &RFP-Default-Include-Path>;
     491  <Store &RFP-Boot-Path <? &RFP-Boot-Path> &RFP-Default-Include-Path>,
     492  <Store &RFP-Include-Path <? &RFP-Include-Path> <? &RFP-Boot-Path>>;
    471493
    472494Get-Ready-To-Work e.Items =
  • to-imperative/trunk/compiler/rfpc.rfi

    r1386 r1825  
    2525$const RFP-Default-Include-Path = ('/usr/include/refal-plus')
    2626                                      ('/usr/local/include/refal-plus') ;
     27$box RFP-Boot-Path ;
    2728$box RFP-Include-Path ;
    2829$box RFP-Token-Stack ;
Note: See TracChangeset for help on using the changeset viewer.