2 static char *RCSid
= "$Id$";
6 * The Regina Rexx Interpreter
7 * Copyright (C) 1992-1994 Anders Christensen <anders@pvv.unit.no>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the Free
21 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 static void set_line_nos( treenode
*ptr
, int lineno
, int charno
)
37 ptr
->lineno
= lineno
;
38 ptr
->charnr
= charno
;
41 for (i
=0; i
<sizeof(ptr
->p
)/sizeof(ptr
->p
[0]); i
++)
43 set_line_nos( ptr
->p
[i
], lineno
, charno
) ;
46 set_line_nos( ptr
->next
, lineno
, charno
) ;
49 /* Will do the "INTERPRET" work on a given streng. This function returns
50 * either NULL on error or the result string of the interpretation.
51 * The streng will be deleted.
53 streng
*dointerpret( tsd_t
*TSD
, streng
*string
)
56 nodeptr savecurrentnode
;
58 internal_parser_type parsing
;
60 fetch_string( TSD
, string
, &parsing
);
62 if (parsing
.result
!= 0)
64 Free_stringTSD(string
) ;
65 exiterror( ERR_YACC_SYNTAX
, 1, parsing
.tline
) ;
69 newtree
= parsing
.root
;
70 parsing
.kill
= string
;
72 set_line_nos( newtree
, TSD
->currentnode
->lineno
, TSD
->currentnode
->charnr
) ;
76 /* Save and restore currentnode around interpret. It is set within
77 * interpret and may result to illegal memory accesses in case of
78 * errors if it is not restored, FGC
80 savecurrentnode
= TSD
->currentnode
;
81 ptr
= interpret( TSD
, newtree
) ;
82 TSD
->currentnode
= savecurrentnode
;
84 DestroyInternalParsingTree( TSD
, &parsing
) ;