1 /******************************************************************************
2 *
3 * Copyright (C) 2006, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * ID: include 18.10.06 0.0.A.
11 *
12 * Author: Alexey Krivonogov ( gentee )
13 *
14 * Summary: include command
15 *
16 ******************************************************************************/
17
18 #include "../genteeapi/gentee.h"
19 #include "bcodes.h"
20 #include "compile.h"
21
22 /*-----------------------------------------------------------------------------
23 *
24 * ID: include 22.11.06 0.0.A.
25 *
26 * Summary: include command
27 *
28 -----------------------------------------------------------------------------*/
29
30 plexem STDCALL include( plexem plex )
31 {
32 pstr filename;
33
34 plex = lexem_next( lexem_next( plex, LEXNEXT_IGNLINE ),
35 LEXNEXT_IGNLINE | LEXNEXT_LCURLY );
36 while ( 1 )
37 {
38 if ( lexem_isys( plex, LSYS_RCURLY ))
39 break;
40
41 if ( plex->type == LEXEM_STRING )
42 filename = lexem_getstr( plex );
43 else
44 msg( MMuststr | MSG_LEXERR, plex );
45 _compile->cur->pos = plex->pos;
46 compile_process( filename );
47
48 plex = lexem_next( plex, LEXNEXT_IGNLINE | LEXNEXT_IGNCOMMA );
49 }
50
51 return plex;
52 }
53
54