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

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

  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: goto 08.02.07 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( algen )
 13 *
 14 * Summary: Конструкции goto, label
 15 *
 16 ******************************************************************************/
 17 
 18 #include "func.h"
 19 
 20 /*-----------------------------------------------------------------------------
 21 *
 22 * ID: c_goto 08.02.07 0.0.A.
 23 *
 24 * Summary: The goto processing
 25 *
 26 -----------------------------------------------------------------------------*/
 27 plexem STDCALL c_goto( plexem curlex )
 28 {
 29    pflabel    curlabel; //Текущий элемент в стэке меток
 30    phashiuint phitem;   //Элемент хэштаблицы со смещением описания метки
 31    uint       offlabel; //Смещение в таблице меток
 32 
 33    out_debugtrace( curlex );
 34 
 35    if ( curlex->type == LEXEM_NAME )
 36    {
 37       out_add2uint( CGoto, 0 );
 38       phitem = (phashiuint)hash_create( &fd.nlabels, lexem_getname( curlex ) );
 39       //curlabel = newlabel;
 40       curlabel = (pflabel)buf_appendtype( &fd.blabels, sizeof( flabel ));
 41 
 42       curlabel->offbout = fd.bout->use - sizeof( uint );
 43       offlabel = phitem->val;
 44       if ( !offlabel || offlabel == -1)
 45       {  //Такого имени ещё нет
 46          curlabel->type = LABT_GTUNDEF;
 47          curlabel->hitem = phitem;//?phitem вроде постоянный
 48          curlabel->lex = curlex;
 49          phitem->val = -1;
 50       }
 51       else
 52       {         
 53          if ( (( pflabel )( fd.blabels.data + offlabel ))->type ==
 54                ( LABT_LABEL | (uint)( fd.bout == &fd.bsubout ? LABT_SUBFUNC : 0) ) )
 55          {  //Действующая метка
 56             curlabel->type = LABT_GTDEF;
 57             curlabel->link = offlabel;
 58          }
 59          else
 60          {            
 61             msg( MUnklabel | MSG_LEXNAMEERR, curlex );
 62          }
 63       }
 64    }
 65    else
 66       msg( MExpname | MSG_LEXERR, curlex );
 67    curlex = lexem_next( curlex, 0 );
 68    
 69    return curlex;
 70 }
 71 
 72 
 73 /*-----------------------------------------------------------------------------
 74 *
 75 * ID: c_label 08.02.07 0.0.A.
 76 *
 77 * Summary: The label processing
 78 *
 79 -----------------------------------------------------------------------------*/
 80 plexem STDCALL c_label( plexem curlex )
 81 {
 82    uint       offlabel; //Смещение в таблице меток
 83    phashiuint phitem;   //Элемент хэштаблицы со смещением описания метки
 84 
 85    if ( curlex->type == LEXEM_NAME )//Идентификатор
 86    {      
 87       phitem = (phashiuint)hash_create( &fd.nlabels, lexem_getname( curlex ) );
 88       if ( !phitem->val || phitem->val == -1 )
 89       {  //Такого имени ещё нет
 90          offlabel = j_label( LABT_LABEL |
 91                               (fd.bout == &fd.bsubout ? LABT_SUBFUNC : 0), (uint)phitem );
 92          phitem->val = offlabel;
 93       }
 94       else
 95          msg( MRedeflabel | MSG_LEXNAMEERR, curlex );
 96    }
 97    else
 98       msg( MExpname | MSG_LEXERR, curlex );
 99    return lexem_next( curlex, 0 );
100 }
101