EnglishРусский  

   ..

   alias.c

   alias.h

   bcodes.c

   bcodes.h

   body.c

   compile.c

   compile.h

   define.c

   define.h

   desc.c

   expr.c

   extern.c

   for.c

   foreach.c

   func.c

   func.h

   global.c

   global.h

   goto.c

   if.c

   ifdef.c

   ifdef.h

   import.c

   import.h

   include.c

   include.h

   jump.c

   lexem.c

   lexem.h

   macro.c

   macro.h

   operlist.txt

   out.c

   out.h

   subfunc.c

   switch.c

   type.c

   type.h

   vars.c

   while.c

   with.c

Ads

Perfect Automation tool
All-In-One: Script editor, Launcher, Scheduler, Keyboard & Mouse Recorder. Try now!

CreateInstall
Freeware and commercial installers.

Cell Phone Batteries
Batteries Plus offers batteries for laptop, camcorder, cell phone, camera.

Gentee needs your help!
How to advertise with us
 
laptop battery

 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: ifdef 18.10.06 0.0.A.
11 *
12 * Author: Alexey Krivonogov ( gentee )
13 *
14 * Summary: ifdef command
15 *
16 ******************************************************************************/
17 
18 #include "ifdef.h"
19 #include "macro.h"
20 
21 /*-----------------------------------------------------------------------------
22 *
23 * ID: ifdef 22.11.06 0.0.A.
24 * 
25 * Summary: define command
26 *
27 -----------------------------------------------------------------------------*/
28 
29 plexem  STDCALL ifdef( plexem plex )
30 {
31    plexem    start = plex;
32    plexem    exp;
33    uint      ok;
34    uint      found = 0;
35    pmacrores lexval;
36    uint      bvalue;
37 
38 lelif:
39    exp = plex;
40 //   plex->type = LEXEM_SKIP;  // delete 'ifdef' or 'elif'
41 
42    plex = lexem_next( macroexpr( lexem_next( plex, LEXNEXT_IGNLINE ), 
43                       &lexval ), LEXNEXT_SKIPLINE );
44    bvalue = lexval->bvalue;
45    if ( !found )
46       found = bvalue;
47    else
48       bvalue = 0;
49 
50    while ( exp < plex ) // delete 'ifdef' or 'elif' and все лексемы в выражении
51    {
52       exp->type = LEXEM_SKIP;
53       exp++;
54    }
55 //   print("Lexval=%i %i\n", lexval.bvalue, lexval.vallexem.num.vint  );
56 lelse:
57    ok = 1;
58 
59    // SKIP LINE чтобы plex оставался прежним
60    // Можн заменить простой проверкой на LCURLY ?
61    plex = lexem_next( plex,  LEXNEXT_SKIPLINE | LEXNEXT_LCURLY );
62    plex->type = LEXEM_SKIP; // LCURLY
63    while ( ok )
64    {
65       plex = lexem_next( plex,  bvalue ? 0 : LEXNEXT_NOMACRO );
66       if ( lexem_isys( plex, LSYS_LCURLY ) || lexem_isys( plex, LSYS_COLLECT ))
67          ok++;
68       if ( lexem_isys( plex, LSYS_RCURLY ))
69          ok--;
70       if ( !bvalue )
71          plex->type = LEXEM_SKIP;
72    }
73    plex->type = LEXEM_SKIP;   // RCURLY
74 
75    plex = lexem_next( plex, LEXNEXT_SKIPLINE );
76 
77    if ( plex->type == LEXEM_KEYWORD )
78    {
79       if ( plex->key == KEY_ELIF )
80          goto lelif;
81 
82       if ( plex->key == KEY_ELSE )
83       {
84          bvalue = !found;
85          plex->type = LEXEM_SKIP;
86          plex = lexem_next( plex, LEXNEXT_SKIPLINE );
87          goto lelse;
88       }
89    }
90    return start;
91 }
92 
93  
Edit