source: to-imperative/trunk/compiler/rfp_src.rf @ 1825

Last change on this file since 1825 was 1825, checked in by orlov, 15 years ago
  • Added proper generation of imports in Java code.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1//
2// Copyright (C) 1999, 2000 Refal+ Development Group
3//
4// Refal+ is free software; you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation; either version 2 of the License, or
7// (at your option) any later version.
8//
9// Refal+ is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Refal+; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17//
18// $Source$
19// $Revision: 1825 $
20// $Date: 2005-12-29 01:57:15 +0000 (Thu, 29 Dec 2005) $
21// Author: Andrey Slepuhin <pooh@msu.ru>
22
23// rfp_src.rfi
24$use "rfpc" ; // rfpc.rfi
25
26$use StdIO ;
27$use Apply ;
28$use Arithm ;
29$use Table ;
30
31RFP-Src-Open-File e.filename =
32  <Channel> :: s.chl,
33  <Open-File s.chl e.filename "r">,
34  FILE &RFP-Get-Line-From-File (e.filename) (s.chl);
35
36RFP-Src-Close s.srctype s.getline-func (e.name) (e.src) =
37  s.srctype :
38  {
39    FILE = e.src : s.channel, <Close-Channel s.channel>;
40    STDIN = ;
41  };
42
43RFP-Src-Open-StdIN =
44  STDIN &RFP-Get-Line-From-File ('StdIN') ();
45
46RFP-Get-Line-From-File s.channel =
47  <Read-Line! s.channel>;
48
49RFP-Get-Line-From-StdIN e =
50  <Read-Line>;
51
52RFP-Src-Get-Line e.source =
53  e.source : s.srctype s.getline-func (e.name) (e.src),
54  <Apply s.getline-func e.src>;
55
56RFP-Next-Row s.row s.col =
57  <"+" s.row 1> 1;
58
59RFP-Next-Column s.row s.col =
60  s.row <"+" s.col 1>;
61
62RFP-Source-File-Name s.idx =
63  <Lookup &RFP-Sources s.idx>;
64
65RFP-Dir-Name {
66  $r e.base &RFP-Dir-Separator e = e.base;
67  e = '.';
68};
69
70RFP-File-Name {
71  $r e &RFP-Dir-Separator e.file = e.file;
72  e.file  = e.file;
73};
74
75RFP-Module-Name e.path =
76  <RFP-File-Name e.path> :: e.file,
77  {
78    e.file : $r e.module '.' e = e.module;
79    e.file;
80  };
Note: See TracBrowser for help on using the repository browser.