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

📄 cp_process.c

📁 这是一个Linux下的集成开发环境
💻 C
📖 第 1 页 / 共 4 页
字号:
            if( scope_global == 0 && scope_g[0] )            {               scope_global = scope_g;            }            Proc.Type = get_variable_type( scope_global                                         , scope                                         , name                                         , Expr->lineno_beg                                         , Expr->charno_beg                                         , Expr->lineno_end                                         , Expr->charno_end                                         , acScope                                         , acRetType                                         , acRetDefine /* 16.02.98 rigo */                                         , &paf_type                                         , &paf_scope                                         );            if( paf_type == PAF_MACRO_DEF && *acRetDefine )	/* 16.02.98 */            {               if (!macro_chain)               {                  objname[sizeof(objname) - 1] = '\0';                  macro_chain = SearchTableCreate(100, SEARCH_HASH_TABLE, NULL);                  mac_ent.key = object;                  mac_ent.key_len = -1;                  mac_ent.data = NULL;                  mac_ent.data_len = 0;                  mac_ent.flag = SEARCH_DUP_KEY;                  macro_chain->add(&macro_chain,mac_ent);               }               /* new message with acRetDefine */               mac_ent.key = acRetDefine;               mac_ent.key_len = -1;               /* We have to check whether the name is already in the                * chain because that would cause an end less loop!*/               if (!macro_chain->search(&macro_chain, mac_ent))               {                  macro_chain->add(&macro_chain,mac_ent);                  f_TypeDestroy (Proc.Type);                  /* We generate xref call only for the first macro in the chain. */                  if (first_time)                  {                     int paf_access = PAF_REF_READ;                     first_time = 0;                     Put_cross_ref( paf_type                         , scope_g[0] ? PAF_MBR_FUNC_DEF : PAF_FUNC_DEF                         , paf_scope                         , scope_g                         , sym_name_g                         , arg_types_g                         , ( paf_type == PAF_REF_TO_LOCAL_VAR ) ? sym_name_g : acScope                         , name                         , 0                         , filename_g                         , Expr->lineno_beg                         , paf_access                         );                  }                  strncpy(objname, acRetDefine, sizeof(objname) - 1);                  object = objname;                  continue;               }            }            break;         }         if (macro_chain)         {            macro_chain->destroy(&macro_chain);            macro_chain = NULL;         }         if( paf_type )         {            int paf_access = 0;            if( access & WRITE ) paf_access |= PAF_REF_WRITE | PAF_REF_READ;            if( access & READ  ) paf_access |= PAF_REF_READ ;            if( pass           ) paf_access |= PAF_REF_PASS ;            /* This will output a known variable reference 	       (e.g. predefined local variable ref, global variable ref, etc.)	       	        Example:     local_var = 5;	     */            Put_cross_ref( paf_type                         , scope_g[0] ? PAF_MBR_FUNC_DEF : PAF_FUNC_DEF                         , paf_scope                         , scope_g                         , sym_name_g                         , arg_types_g                         , ( paf_type == PAF_REF_TO_LOCAL_VAR ) ? sym_name_g : acScope                         , name                         , 0                         , filename_g                         , Expr->lineno_beg                         , paf_access                         );         }         else         {            int paf_access = 0;            if( access & WRITE ) paf_access |= PAF_REF_WRITE | PAF_REF_READ;            if( access & READ  ) paf_access |= PAF_REF_READ ;            if( pass           ) paf_access |= PAF_REF_PASS ;            /* This will output a undefined variable reference. */            Put_cross_ref( PAF_REF_UNDEFINED                         , scope_g[0] ? PAF_MBR_FUNC_DEF : PAF_FUNC_DEF                         , PAF_REF_SCOPE_GLOBAL                         , scope_g                         , sym_name_g                         , arg_types_g/*                       , scope_global 23.02.97 rigo */                         , scope_name                         , name                         , 0                         , filename_g                         , Expr->lineno_beg                         , paf_access                         );         }         if( access & READ )         {/*          printf( "read : %s.%s\n", scope ? scope : scope_global, Expr->name ); */         }         if( access & WRITE )         {/*          printf( "write: %s.%s\n", scope ? scope : scope_global, Expr->name ); */         }      }      Proc.name = strdup_m( object );  /* itt kerdeses, hogy nem                                                a name-t kellene-e atadni ? */      Proc.scope = strdup_m( scope );      Proc.lineno_beg = Expr->lineno_beg;      Proc.charno_beg = Expr->charno_beg;      Proc.lineno_end = Expr->lineno_end;      Proc.charno_end = Expr->charno_end;      break;      }         case OPERATOR_TYPE             :#ifdef PRINT_EXPR      f_TypeToString( Expr->Type, Proc.ac, 1 );#endif      /* feloldjuk a typedef-eket */      Expr->Type = f_TypeBasic( Expr->Type, Expr->lineno_beg );      /* a Type-ban megbuvo kifejezeseket feldolgozzuk */      f_TypeProcess( Expr->Type );      if( Expr->lineno_beg != 0 )      {/* test okbol atmenetileg kikommentezve         if( test_fp )         {            fprintf( test_fp                   ,"%d xref_l %d.%d %d.%d\n"                   , PAF_HIGH                   , Expr->lineno_beg                   , Expr->charno_beg                   , Expr->lineno_end                   , Expr->charno_end                   );         }*/      }      Proc.Type = Expr->Type;      Expr->Type = 0;      Proc.name = 0;      Proc.scope = 0;      break;         default:      printf( "Expr->_operator: %d (Expr: %d)\n", Expr->_operator, (int) Expr );      f_InternalError( 53 );   }   tab--;   return Proc;}/* static Proc_t f_exprlist( List_t ListExpr, int access, char *scope, char *arglist, int pass ) 15.01.98 rigo */static Proc_t f_exprlist( List_t ListExpr, int access, char *scope, LongString *parglist, int pass ) /* 15.01.98 rigo */{   Elem_t Elem;   Proc_t Proc;   Proc_t Proc1;/* char type[10000]; 15.01.98 rigo */   static char type[10000]; /* 15.01.98 rigo */   int bFirst; /* 15.01.98 rigo */#ifdef PRINT_EXPR   Proc.ac[0] = 0;#endif/* arglist[0] = 0; 15.01.98 rigo */   bFirst = True; /* 15.01.98 rigo */   for( Elem = d_ElemFirst( ListExpr ); Elem; Elem = Elem->ElemNext )   {      Expr_t Expr = (Expr_t) Elem;      Proc1 = f_expr( Expr, READ, 0, 0, pass );      f_TypeToString( Proc1.Type, type, 0 );#ifdef PRINT_EXPR      if( Proc.ac[0] == 0 )      {         strcat( Proc.ac, Proc1.ac );      }      else      {         strcat( Proc.ac, "," );         strcat( Proc.ac, Proc1.ac );      }#endif      if( parglist ) /* 15.01.98 rigo */      {/*       if( arglist[0] == 0 ) 15.01.98 rigo */         if( bFirst ) /* 15.01.98 rigo */         {/*          strcat( arglist, type ); 15.01.98 rigo */            parglist->append( parglist, type, -1 ); /* 15.01.98 rigo */            bFirst = False; /* 15.01.98 rigo */         }         else         {/*          strcat( arglist, "," ); 15.01.98 rigo *//*          strcat( arglist, type ); 15.01.98 rigo */            parglist->append( parglist, "," , -1 ); /* 15.01.98 rigo */            parglist->append( parglist, type, -1 ); /* 15.01.98 rigo */         }      }      ProcDestroy( 56, Proc1 );   }   Proc.Type = 0;   Proc.name = 0;   Proc.scope = 0;   return Proc;}static void ProcDestroy( int i, Proc_t Proc ){   if( Proc.Type ) f_TypeDestroy( Proc.Type );   if( Proc.name ) ckfree( (char*)Proc.name );   if( Proc.scope ) ckfree( (char*)Proc.scope );   Proc.Type = 0;   Proc.name = 0;   Proc.scope = 0;}static char *strdup_m( char *pc ){   if( pc == 0 ) return 0;   return        SN_StrDup( pc );}static char *f_TypeToScope( Type_t Type ){   if( Type && Type->Name )   {      return Type->Name->pcName;   }   else   {      return 0;   }}static Type_t get_variable_type( char *scope_global, char *scope, char *name, int lineno_beg, int charno_beg, int lineno_end, int charno_end, char *scope_ret, char *type_ret, char *define_ret, int *paf_type_ret, int *paf_scope_ret ){   Type_t Type;   Type_t TypeReturn;   *paf_scope_ret = PAF_REF_SCOPE_GLOBAL;#ifdef PRINT   printf( "--> search    : get_variable_type: <%s> <%s> %s\n"         , scope_global ? scope_global : ""         , scope ? scope : ""         , name         );#endif   if( scope )   {      /* itt majd a SymtabClass -ban kell keresni */   }   else   {      if(( Type = (Type_t) SymtabFind( SymtabVariable, name )))      {         TypeReturn = f_TypeDuplicate( Type );         *paf_type_ret = PAF_REF_TO_LOCAL_VAR;         *paf_scope_ret = PAF_REF_SCOPE_LOCAL;         if( test_fp )         {            fprintf( test_fp                   ,"%d xref_l %d.%d %d.%d\n"                   , PAF_HIGH                   , lineno_beg                   , charno_beg                   , lineno_end                   , charno_end                   );         }         return TypeReturn;      }   }   *paf_type_ret = my_Get_symbol( scope_global                                     , scope                                     , name                                     , 0                                     , scope_ret                                     , type_ret                                     , define_ret /* 16.02.98 rigo */                                     , 0 );   if( *paf_type_ret  )   {#ifdef PRINT      printf( "<-- found     : get_variable_type: <%s> <%s> %s **** |%s|%s|%s|%d|\n"            , scope_global ? scope_global : ""            , scope ? scope : ""            , name            , scope_ret            , type_ret            , define_ret /* 16.02.98 rigo */            , *paf_type_ret            );#endif      if( test_fp )      {         fprintf( test_fp                ,"%d xref_g %d.%d %d.%d\n"                , PAF_HIGH                , lineno_beg                , charno_beg                , lineno_end                , charno_end                );      }      TypeReturn = f_TypeFromString( type_ret );      if( TypeReturn )      {         /* leasunk a typedef-eken keresztul az igazi tipusig */         TypeReturn = f_TypeBasic( TypeReturn, lineno_beg );      }      else      {         TypeReturn = f_TypeCreateInt();      }   }   else   {#ifdef PRINT      printf( "<-- not found : get_variable_type: <%s> <%s> %s ****\n"            , scope_global ? scope_global : ""            , scope ? scope : ""            , name            );#endif      if( test_fp )      {         fprintf( test_fp                ,"%d xref_u %d.%d %d.%d\n"                , PAF_HIGH                , lineno_beg                , charno_beg                , lineno_end                , charno_end                );      }      TypeReturn = f_TypeCreateUnknown();   }   return TypeReturn;}static Type_t get_function_type( char *scope_global, char *scope, char *name, char *arglist, int lineno_beg, int charno_beg, int lineno_end, int charno_end, char *scope_ret, char* type_ret, char *define_ret, int *paf_type_ret, int *paf_scope_ret ){   Type_t TypeReturn;   *paf_scope_ret = PAF_REF_SCOPE_GLOBAL;#ifdef PRINT   printf( "--> search    : get_function_type: <%s> <%s> <%s> <%s> %s:%d.%d\n"         , scope_global ? scope_global : ""         , scope ? scope : ""         , name         , arglist         , filename_g         , f_lineno( 0 )         , f_charno( 0 )         );#endif   *paf_type_ret = my_Get_symbol( scope_global                                     , scope                                     , name                                     , arglist                                     , scope_ret                                     , type_ret                                     , define_ret /* 16.02.98 rigo */                                     , 0 );   if( *paf_type_ret )   {#ifdef PRINT      printf( "<-- found     : get_function_type: <%s> <%s> %s( %s ) **** |%s|%s|%s|%d|\n"            , scope_global ? scope_global : ""            , scope ? scope : ""            , name            , arglist

⌨️ 快捷键说明

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