external.c
1 //! @file external.c
2 //! @author J. Marcel van der Veer
3 //
4 //! @section Copyright
5 //
6 // This file is part of VIF - vintage FORTRAN compiler.
7 // Copyright 2020-2025 J. Marcel van der Veer <algol68g@xs4all.nl>.
8 //
9 //! @section License
10 //
11 // This program is free software; you can redistribute it and/or modify it
12 // under the terms of the GNU General Public License as published by the
13 // Free Software Foundation; either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful, but
17 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 // more details. You should have received a copy of the GNU General Public
20 // License along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 //! @section Synopsis
23 //!
24 //! Compile declarations.
25
26 #include <vif.h>
27
28 void externals (void)
29 {
30 int_4 rc;
31 while ((rc = scan (EXPECT_NONE)) != END_OF_LINE) {
32 if (TOKEN (",")) {
33 ;
34 } else if (rc == WORD || rc == DECLAR) {
35 if (rc == WORD && reserved (curlex)) {
36 ERROR (1501, "reserved symbol", curlex);
37 }
38 MODE mode;
39 extf_decl (curlex, &mode);
40 } else {
41 EXPECT (1502, "subprogram name");
42 }
43 }
44 }
45
46 void intrinsics (void)
47 {
48 int_4 rc;
49 while ((rc = scan (EXPECT_NONE)) != END_OF_LINE) {
50 if (TOKEN (",")) {
51 ;
52 } else if (!is_intrins (curlex, NO_MODE)){
53 EXPECT (1503, "intrinsic funcion name");
54 } else {
55 if (rc == WORD && reserved (curlex)) {
56 ERROR (1504, "reserved symbol", curlex);
57 }
58 NEW_RECORD (name);
59 bufcpy (name, curlex, RECLN);
60 compile_nested_intrinsic (name);
61 }
62 }
63 }
© 2002-2025 J.M. van der Veer (jmvdveer@xs4all.nl)
|