⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cp_declaration.c

📁 这是一个Linux下的集成开发环境
💻 C
📖 第 1 页 / 共 4 页
字号:
      {         if( Declarator->Name )         {            /* This will output a declaration of a local variable. */	    Put_cross_ref( PAF_REF_TO_LOCAL_VAR                        , scope_g[0] ? PAF_MBR_FUNC_DEF : PAF_FUNC_DEF                        , PAF_REF_SCOPE_LOCAL                        , scope_g                        , sym_name_g                        , arg_types_g                        , sym_name_g                        , Declarator->Name->pcName                        , 0                        , filename_g                        , Declaration->lineno                        , PAF_REF_WRITE                        );         }      }      f_DeclaratorProcess( Declarator );      /* ezt csak a vegen torolhetjuk, mert a Type alatti Declarator-ra         meg szuksegunk volt */      f_TypeDestroy( TypeToDestroy );      TypeToDestroy = 0;   }   f_TypeDestroy( TypeBasic );}static void _DeclarationSpecialProcess( DeclarationSpecial_t DeclarationSpecial, int record ){   Declaration_t Declaration;   for( Declaration = (Declaration_t) d_ElemFirst( DeclarationSpecial->ListDeclaration )      ; Declaration      ; Declaration = Declaration->DeclarationNext      )   {      f_DeclarationProcess( Declaration, record );   }   if( DeclarationSpecial->Declaration )   {      f_DeclarationProcess( Declaration, record );   }}extern void f_DeclarationSkip( void ){   f_StepTo( ';', '(', '{', 0 );   switch( token( 0 ))   {   case ';':      step( 1 );      break;   case '(':      step( 1 );      f_StepTo( ')', 0 );      step( 1 );      break;   case '{':      step( 1 );      f_StepTo( '}', 0 );      step( 1 );      break;   }}extern void f_DeclarationPrint( Declaration_t Declaration ){   Declarator_t Declarator;   for( Declarator = (Declarator_t) d_ElemFirst( Declaration->ListDeclarator )      ; Declarator      ; Declarator = Declarator->DeclaratorNext )   {      Type_t Type;      char acType[10000];  /* old: 1000 */      Type = f_TypeFromDeclarationAndDeclarator( Declaration, Declarator );      f_TypeToString( Type, acType, 1 );      printf( "processed type: %s ----- name: %s\n"            , acType            , Declarator->Name->pcName            );      Type->Declarator = 0;      f_TypeDestroy( Type );   }}extern void Put_cross_class_or_typedef_ref( int type, int scope_type, int scope_lev, char *fnc_cls, char *fnc, char *fnc_arg_types, char *scope, char *what, char *arg_types, char *file, int lineno, int acc ){   if( type )   {      Put_cross_ref( type                   , scope_type                   , scope_lev                   , fnc_cls                   , fnc                   , fnc_arg_types                   , scope                   , what                   , arg_types                   , file                   , lineno                   , acc                   );      /* Ha type == PAF_REF_TO_TYPE_DEF akkor, jobb lenne         ha azzal a tipussal dolgoznank, ami a typedef mogott van */      if( type == PAF_REF_TO_CLASS )      {         char acName[10000];   /* old: 1000 */         char acScope[10000];  /* old: 100 */         char acRetType[10000];/* old: 100 */         int paf_type_ret;         /* Ha van egyaltalan konstruktora a class-nak ? */         if(( paf_type_ret = Get_symbol( fnc_cls                                        , what                                        , what                                        , 0                                        , acScope                                        , acRetType                                        , NULL                                        , 0 )))         {            Put_cross_ref( PAF_REF_TO_MBR_FUNC                         , scope_type                         , scope_lev                         , fnc_cls                         , fnc                         , fnc_arg_types                         , acScope                         , what                         , arg_types                         , file                         , lineno                         , acc                         );         }         /* Ha van egyaltalan destruktora a class-nak ? */         sprintf( acName, "~%s", what );         if(( paf_type_ret = Get_symbol( fnc_cls                                        , what                                        , acName                                        , 0                                        , acScope                                        , acRetType                                        , NULL                                        , 0 )))         {            Put_cross_ref( PAF_REF_TO_MBR_FUNC                         , scope_type                         , scope_lev                         , fnc_cls                         , fnc                         , fnc_arg_types                         , acScope                         , acName                         , arg_types                         , file                         , lineno                         , acc                         );         }      }   }}/*** Feloldjuk a typedef-eket.** Az osszes kozbulso lepest lejelentjuk.*/extern Type_t f_TypeBasic( Type_t Type, int lineno ){   Type_t TypeBasic = Type;   Type_t TypeTempo = 0;   char *name;   int paf_type;   char acType[10000];  /* old: 1000 */   /*    * to break recursion in user's typedefs, like    *      typedef type1 type2;    *      typedef type2 type1;    * In the upoun case SN can hang for ever.    * (limited only for 3 levels)    */#  define PREV_I 3   char *name_prev[PREV_I] = {0, 0, 0};   int i=0, j=0, cmp_prev=0;      while( True )   {      name = f_NameFromType( TypeBasic );      if( name == 0 )      {         break;      }      /* see if this typedef has been visited */      cmp_prev = 0;      for (i=0; i<PREV_I; i++)      {	  if( name_prev[i] && strcmp( name_prev[i], name ) == 0 )	  {	      cmp_prev = 1;	      break;	  }      }      if (cmp_prev)          break;      if(( paf_type = Get_class_or_typedef( name, acType )) == 0 )      {	      break;      }         Put_cross_ref( paf_type                   , scope_g[0] ? PAF_MBR_FUNC_DEF : PAF_FUNC_DEF                   , PAF_REF_SCOPE_GLOBAL                   , scope_g[0] ? scope_g : 0                   , sym_name_g                   , arg_types_g                   , 0                   , name                   , 0                   , filename_g                   , lineno                   , PAF_REF_READ                   );      TypeTempo = f_TypeFromString( acType );      if( TypeTempo )      {         if( TypeTempo->Declarator == 0 )         {            if( TypeBasic )            {               TypeTempo->Declarator = TypeBasic->Declarator;               TypeBasic->Declarator = 0;            }         }         else         {            if( TypeBasic && TypeBasic->Declarator )            {               List_t ListOper = TypeTempo->Declarator->ListOper;               TypeTempo->Declarator->ListOper = TypeBasic->Declarator->ListOper;               TypeBasic->Declarator->ListOper = 0;               f_ListConcat( &(TypeTempo->Declarator->ListOper), ListOper );               TypeTempo->Declarator->Name = TypeBasic->Declarator->Name;               TypeBasic->Declarator->Name = 0;            }         }         f_TypeDestroy( TypeBasic );         TypeBasic = TypeTempo;         TypeTempo = 0;      }      else      {         break;      }      /* store visited types on the stack */      if (j>=PREV_I)         j = 0;      if( name_prev[j] )      {         ckfree( (char*)name_prev[j] );         name_prev[j] = 0;      }      name_prev[j] = name;      j++;      if( paf_type != PAF_REF_TO_TYPEDEF )      {         break;      }   }   if( name )   {      ckfree( (char*)name );      name = 0;   }   /* free visiting stack */   for (i=0; i<PREV_I; i++)     if( name_prev[i] )     {	ckfree( (char*)name_prev[i] );	name_prev[i] = 0;     }   return TypeBasic;}static Type_t f_TypeDeclaratorConcat( Type_t Type_a, Declarator_t Declarator ){   Type_t Type = f_TypeDuplicate( Type_a );   if( Type )   {      if( Type->Declarator == 0 )      {         Type->Declarator = Declarator;      }      else      {         Declarator_t Declarator2 = Type->Declarator;         Type->Declarator = Declarator;         Declarator = Declarator2;         f_ListConcat( &(Type->Declarator->ListOper), Declarator->ListOper );         Declarator->ListOper = 0;         f_DeclaratorDestroy( Declarator );      }   }   return Type;}/* a declaration eseteben, ha nem pointer tipusrol van szo, akkor a mode** alapjan CONSTRUCTOR es/vagy DESTRUCTOR jelentes*/extern void f_PutConstructor( Type_t Type, int lineno, int mode ){   if( Type && Type->Declarator )   {      Oper_t Oper = (Oper_t) d_ElemFirst( Type->Declarator->ListOper );      if( Oper == 0 || Oper->type == ARRAY ) /* tiszta class, vagy class t鰉b */      {         char *name;         if(( name = f_NameFromType( Type )))         {            int paf_type;            char acType[10000];  /* old: 1000 */            if(( paf_type = Get_class_or_typedef( name, acType )) == PAF_REF_TO_CLASS )            {               char acName[10000];     /* old: 1000 */               char acScope[10000];    /* old: 100 */               char acRetType[10000];  /* old: 100 */               int paf_type_ret;                     if( mode & CONSTRUCTOR )               {                  /* Ha van egyaltalan konstruktora a class-nak ? */                  if(( paf_type_ret = Get_symbol( scope_g[0] ? scope_g : 0                                                , name                                                , name                                                , 0                                                , acScope                                                , acRetType                                                , NULL                                                , 0 )))                  {                     Put_cross_ref( PAF_REF_TO_MBR_FUNC                                  , scope_g[0] ? PAF_MBR_FUNC_DEF : PAF_FUNC_DEF                                  , PAF_REF_SCOPE_GLOBAL                                  , scope_g[0] ? scope_g : 0                                  , sym_name_g                                  , arg_types_g                                  , acScope                                  , name                                  , 0                                  , filename_g                                  , lineno                                  , PAF_REF_READ                                  );                  }               }               if( mode & DESTRUCTOR )               {                  /* Ha van egyaltalan destruktora a class-nak ? */                  sprintf( acName, "~%s", name );                  if(( paf_type_ret = Get_symbol( scope_g[0] ? scope_g : 0                                                , name                                                , acName                                                , 0                                                , acScope                                                , acRetType                                                , NULL                                                , 0 )))                  {                     Put_cross_ref( PAF_REF_TO_MBR_FUNC                                  , scope_g[0] ? PAF_MBR_FUNC_DEF : PAF_FUNC_DEF                                  , PAF_REF_SCOPE_GLOBAL                                  , scope_g[0] ? scope_g : 0                                  , sym_name_g                                  , arg_types_g                                  , acScope                                  , acName                                  , 0                                  , filename_g                                  , lineno                                  , PAF_REF_READ                                  );                  }               }            }            ckfree( (char*)name );         }      }   }}/* a new es/vagy delete operatorok eseteben** a mode alapjan CONSTRUCTOR es/vagy DESTRUCTOR jelentes*/extern void f_PutConstructorByNewOrDelete( Type_t Type, int lineno, int mode ){   if( Type )   {      char *name;      if(( name = f_NameFromType( Type )))      {         int paf_type;         char acType[10000];  /* old: 1000 */         if(( paf_type = Get_class_or_typedef( name, acType )) == PAF_REF_TO_CLASS )         {            char acName[10000];     /* old: 1000 */            char acScope[10000];    /* old: 100 */            char acRetType[10000];  /* old: 100 */            int paf_type_ret;               if( mode & CONSTRUCTOR )            {               /* Ha van egyaltalan konstruktora a class-nak ? */               if(( paf_type_ret = Get_symbol( scope_g[0] ? scope_g : 0                                             , name                                             , name                                             , 0                                             , acScope                                             , acRetType                                             , NULL                                             , 0 )))               {                  Put_cross_ref( PAF_REF_TO_MBR_FUNC                               , scope_g[0] ? PAF_MBR_FUNC_DEF : PAF_FUNC_DEF                               , PAF_REF_SCOPE_GLOBAL                               , scope_g[0] ? scope_g : 0                               , sym_name_g                               , arg_types_g                               , acScope                               , name                               , 0                               , filename_g                               , lineno                               , PAF_REF_READ                               );               }            }            if( mode & DESTRUCTOR )            {               /* Ha van egyaltalan destruktora a class-nak ? */               sprintf( acName, "~%s", name );               if(( paf_type_ret = Get_symbol( scope_g[0] ? scope_g : 0                                             , name                                             , acName                                             , 0                                             , acScope                                             , acRetType                                             , NULL                                             , 0 )))               {                  Put_cross_ref( PAF_REF_TO_MBR_FUNC                               , scope_g[0] ? PAF_MBR_FUNC_DEF : PAF_FUNC_DEF                               , PAF_REF_SCOPE_GLOBAL                               , scope_g[0] ? scope_g : 0                               , sym_name_g                               , arg_types_g                               , acScope                               , acName                               , 0                               , filename_g                               , lineno                               , PAF_REF_READ                               );               }            }         }         ckfree( (char*)name );      }   }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -