📄 cp_process.c
字号:
case OPERATOR_SIZEOF_EXPRESSION: Proc1 = f_expr( Expr->Expr1, READ, scope, 0, pass ); Proc.Type = f_TypeCreateInt(); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "sizeof(%s)", Proc1.ac );#endif ProcDestroy( 32, Proc1 ); break; case OPERATOR_SIZEOF_TYPENAME : Proc1 = f_expr( Expr->Expr1, READ, scope, 0, pass ); Proc.Type = f_TypeCreateInt(); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "sizeof(%s)", Proc1.ac );#endif ProcDestroy( 33, Proc1 ); break; case OPERATOR_PRE_ICR : Proc1 = f_expr( Expr->Expr1, READ | WRITE, scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "++%s", Proc1.ac );#endif ProcDestroy( 34, Proc1 ); break; case OPERATOR_PRE_DECR : Proc1 = f_expr( Expr->Expr1, READ | WRITE, scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "--%s", Proc1.ac );#endif ProcDestroy( 35, Proc1 ); break; case OPERATOR_POST_ICR : Proc1 = f_expr( Expr->Expr1, READ | WRITE, scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "%s++", Proc1.ac );#endif ProcDestroy( 36, Proc1 ); break; case OPERATOR_POST_DECR : Proc1 = f_expr( Expr->Expr1, READ | WRITE, scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "%s--", Proc1.ac );#endif ProcDestroy( 37, Proc1 ); break; case OPERATOR_STAR : Proc1 = f_expr( Expr->Expr1, access, scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); f_TypeDelPointer( Proc.Type ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "*%s", Proc1.ac );#endif ProcDestroy( 38, Proc1 ); break; case OPERATOR_ET : Proc1 = f_expr( Expr->Expr1, access, scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); f_TypeAddPointer( Proc.Type ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "&%s", Proc1.ac );#endif ProcDestroy( 39, Proc1 ); break; case OPERATOR_UPLUS : Proc1 = f_expr( Expr->Expr1, READ, scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "+%s", Proc1.ac );#endif ProcDestroy( 40, Proc1 ); break; case OPERATOR_UMINUS : Proc1 = f_expr( Expr->Expr1, READ, scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "-%s", Proc1.ac );#endif ProcDestroy( 41, Proc1 ); break; case OPERATOR_NOT : Proc1 = f_expr( Expr->Expr1, READ, scope, 0, pass ); Proc.Type = f_TypeCreateInt(); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "!%s", Proc1.ac );#endif ProcDestroy( 42, Proc1 ); break; case OPERATOR_BNOT : Proc1 = f_expr( Expr->Expr1, READ, scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "~%s", Proc1.ac );#endif ProcDestroy( 43, Proc1 ); break; case OPERATOR_ARRAY : Proc1 = f_expr( Expr->Expr1, access, scope, 0, pass ); Proc2 = f_expr( Expr->Expr2, READ , scope, 0, pass ); ProcTypeAssign( Proc, Proc1 ); f_TypeDelPointer( Proc.Type ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "%s[%s]", Proc1.ac, Proc2.ac );#endif ProcDestroy( 44, Proc1 ); ProcDestroy( 45, Proc2 ); break; case OPERATOR_FUNCTION_CALL : Proc1 = f_expr( Expr->Expr1, READ, scope, 1, pass ); LongStringInit( &arglist, -1 );/* Proc2 = f_exprlist( Expr->ListExpr, READ, scope, arglist, 1 ); 15.01.98 rigo */ Proc2 = f_exprlist( Expr->ListExpr, READ, scope, &arglist, 1 ); /* 15.01.98 rigo */ if( Proc1.name ) {/* char acScope [10000]; 15.01.98 rigo *//* char acRetType[10000]; 15.01.98 rigo */ static char acScope [10000]; /* 15.01.98 rigo */ static char acRetType[10000]; /* 15.01.98 rigo */ char objname[1000]; static char acRetDefine[10000]; /* 16.02.98 rigo */ static char acArglist[10000]; /* 22.01.98 rigo */ int paf_type; int paf_scope; char *scope_global; char *scope_name; /* 16.02.98 rigo */ char *object; /* 16.02.98 rigo */ char *name; SearchTable *macro_chain = NULL; SearchEntry mac_ent; int first_time; if( arglist.buf ) /* 22.01.98 rigo */ { strcpy( acArglist, arglist.buf ); } else { acArglist[0] = 0; } object = Proc1.name; /* 16.02.98 rigo */ for (first_time = 1;;) { scope_name = get_scope( object ); name = get_name ( object ); scope_global = scope_name; if( scope_global == 0 && scope_g[0] ) { scope_global = scope_g; } Proc.Type = get_function_type( scope_global , Proc1.scope , name /* , arglist 15.01.98 rigo */ , acArglist /* 22.01.98 rigo */ , Proc1.lineno_beg , Proc1.charno_beg , Proc1.lineno_end , Proc1.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(¯o_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(¯o_chain, mac_ent)) { macro_chain->add(¯o_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 , acScope , name/* , arglist 15.01.98 rigo */ , acArglist /* 22.01.98 rigo */ , filename_g , Proc1.lineno_beg , paf_access ); } strncpy(objname, acRetDefine, sizeof(objname) - 1); object = objname; continue; } } break; } if (macro_chain) { macro_chain->destroy(¯o_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 ; 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 , acScope , name/* , arglist 15.01.98 rigo */ , acArglist /* 22.01.98 rigo */ , filename_g , Proc1.lineno_beg , paf_access ); } else { int paf_access = 0; *acRetDefine = '\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 ; 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/* , arglist 15.01.98 rigo */ , acArglist /* 22.01.98 rigo */ , filename_g , Proc1.lineno_beg , paf_access ); } } else { ProcTypeAssign( Proc, Proc1 ); f_TypeDelFunction( Proc.Type ); } Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "%s(%s)", Proc1.ac, Proc2.ac );#endif ProcDestroy( 46, Proc1 ); ProcDestroy( 47, Proc2 ); arglist.free( &arglist ); /* 15.01.98 rigo */ break; case OPERATOR_CONSTRUCTOR_CALL : Proc1 = f_expr( Expr->Expr1, READ, scope, 0, pass );/* Proc2 = f_exprlist( Expr->ListExpr, READ, scope, arglist, 1 ); 15.01.98 rigo */ Proc2 = f_exprlist( Expr->ListExpr, READ, scope, 0 , 1 ); /* 15.01.98 rigo */ ProcTypeAssign( Proc, Proc1 ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "%s(%s)", Proc1.ac, Proc2.ac );#endif ProcDestroy( 48, Proc1 ); ProcDestroy( 49, Proc2 ); break; case OPERATOR_DOT : pcOperator = "." ; goto label5; case OPERATOR_ARROW : pcOperator = "->" ; goto label5;label5: Proc1 = f_expr( Expr->Expr1, access, scope, 0, pass ); Proc2 = f_expr( Expr->Expr2, access, f_TypeToScope( Proc1.Type ), call, pass ); ProcTypeAssign( Proc, Proc2 );/* f_TypeDelPointer( Proc.Type ); 14.02.97 rigo: szerintem ez nem kell ide */ ProcNameAssign( Proc, Proc2 ); ProcScopAssign( Proc, Proc2 );#ifdef PRINT_EXPR sprintf( Proc.ac, "%s%s%s", Proc1.ac, pcOperator, Proc2.ac );#endif ProcDestroy( 50, Proc1 ); ProcDestroy( 51, Proc2 ); break; case OPERATOR_NEW : Proc1 = f_expr( Expr->Expr1, READ, scope, 0, pass );/* Proc2 = f_exprlist( Expr->ListExpr, READ, scope, arglist, 1 ); 15.01.98 rigo */ Proc2 = f_exprlist( Expr->ListExpr, READ, scope, 0 , 1 ); /* 15.01.98 rigo */ f_PutConstructorByNewOrDelete( Proc1.Type, Expr->Expr1->lineno_beg, CONSTRUCTOR ); if( Expr->Init ) f_InitProcess( Expr->Init ); ProcTypeAssign( Proc, Proc1 ); Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "new (%s)(%s)", Proc1.ac, Proc2.ac );#endif ProcDestroy( 52, Proc1 ); ProcDestroy( 53, Proc2 ); break; case OPERATOR_DELETE : Proc1 = f_expr( Expr->Expr1, READ, scope, 0, pass ); f_PutConstructorByNewOrDelete( Proc1.Type, 0 /* Expr->Expr1->lineno_beg */, DESTRUCTOR ); Proc.Type = f_TypeCreateInt(); /* esetleg void ? */ Proc.name = 0; Proc.scope = 0;#ifdef PRINT_EXPR sprintf( Proc.ac, "delete %s", Proc1.ac );#endif ProcDestroy( 55, Proc1 ); break; case OPERATOR_NAME : { char *object; /* 16.02.98 rigo */#ifdef PRINT_EXPR sprintf( Proc.ac, "%s", Expr->Name->pcName );#endif if( call ) { Proc.Type = 0; object = Expr->Name->pcName; } else {/* char acScope [10000]; 15.01.98 rigo *//* char acRetType[10000]; 15.01.98 rigo */ static char acScope [10000]; /* 15.01.98 rigo */ static char acRetType[10000]; /* 15.01.98 rigo */ static char acRetDefine[10000]; /* 18.02.98 rigo */ char objname[1000]; int paf_type; int paf_scope; char *scope_global; char *name; char *scope_name; /* 16.02.98 rigo */ SearchTable *macro_chain = NULL; SearchEntry mac_ent; int first_time; object = Expr->Name->pcName; for (first_time = 1;;) { scope_name = get_scope( object ); name = get_name ( object ); scope_global = scope_name;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -