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 | |
---|
31 | RFP-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 | |
---|
36 | RFP-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 | |
---|
43 | RFP-Src-Open-StdIN = |
---|
44 | STDIN &RFP-Get-Line-From-File ('StdIN') (); |
---|
45 | |
---|
46 | RFP-Get-Line-From-File s.channel = |
---|
47 | <Read-Line! s.channel>; |
---|
48 | |
---|
49 | RFP-Get-Line-From-StdIN e = |
---|
50 | <Read-Line>; |
---|
51 | |
---|
52 | RFP-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 | |
---|
56 | RFP-Next-Row s.row s.col = |
---|
57 | <"+" s.row 1> 1; |
---|
58 | |
---|
59 | RFP-Next-Column s.row s.col = |
---|
60 | s.row <"+" s.col 1>; |
---|
61 | |
---|
62 | RFP-Source-File-Name s.idx = |
---|
63 | <Lookup &RFP-Sources s.idx>; |
---|
64 | |
---|
65 | RFP-Dir-Name { |
---|
66 | $r e.base &RFP-Dir-Separator e = e.base; |
---|
67 | e = '.'; |
---|
68 | }; |
---|
69 | |
---|
70 | RFP-File-Name { |
---|
71 | $r e &RFP-Dir-Separator e.file = e.file; |
---|
72 | e.file = e.file; |
---|
73 | }; |
---|
74 | |
---|
75 | RFP-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 | }; |
---|