Changeset fa36f29 in mainline for uspace/app/sbi/src/symbol.c
- Timestamp:
- 2010-02-27T17:59:14Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 94d484a
- Parents:
- 09ababb7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/symbol.c
r09ababb7 rfa36f29 40 40 static stree_symbol_t *symbol_search_global(stree_program_t *prog, 41 41 stree_ident_t *name); 42 static stree_symbol_t *symbol_find_epoint_rec(stree_program_t *prog, 43 stree_ident_t *name, stree_csi_t *csi); 42 44 static stree_ident_t *symbol_get_ident(stree_symbol_t *symbol); 43 45 … … 92 94 93 95 if (symbol == NULL) { 94 printf("Error: Symbol '%s' not found \n", strtab_get_str(name->sid));96 printf("Error: Symbol '%s' not found.\n", strtab_get_str(name->sid)); 95 97 exit(1); 96 98 } … … 111 113 stree_symbol_t *symbol; 112 114 stree_ident_t *mbr_name; 115 stree_symbol_t *base_csi_sym; 116 stree_csi_t *base_csi; 117 118 (void) prog; 119 120 /* Look in new members in this class. */ 113 121 114 122 node = list_first(&scope->members); … … 146 154 } 147 155 156 /* Try inherited members. */ 157 if (scope->base_csi_ref != NULL) { 158 base_csi_sym = symbol_xlookup_in_csi(prog, 159 csi_to_symbol(scope)->outer_csi, scope->base_csi_ref); 160 base_csi = symbol_to_csi(base_csi_sym); 161 assert(base_csi != NULL); 162 163 return symbol_search_csi(prog, base_csi, name); 164 } 165 166 /* No match */ 148 167 return NULL; 149 168 } … … 176 195 } 177 196 197 /** Find entry point. */ 198 stree_symbol_t *symbol_find_epoint(stree_program_t *prog, stree_ident_t *name) 199 { 200 list_node_t *node; 201 stree_modm_t *modm; 202 stree_symbol_t *entry, *etmp; 203 204 entry = NULL; 205 206 node = list_first(&prog->module->members); 207 while (node != NULL) { 208 modm = list_node_data(node, stree_modm_t *); 209 if (modm->mc == mc_csi) { 210 etmp = symbol_find_epoint_rec(prog, name, modm->u.csi); 211 if (etmp != NULL) { 212 if (entry != NULL) { 213 printf("Error: Duplicate entry point.\n"); 214 exit(1); 215 } 216 entry = etmp; 217 } 218 } 219 node = list_next(&prog->module->members, node); 220 } 221 222 return entry; 223 } 224 225 static stree_symbol_t *symbol_find_epoint_rec(stree_program_t *prog, 226 stree_ident_t *name, stree_csi_t *csi) 227 { 228 list_node_t *node; 229 stree_csimbr_t *csimbr; 230 stree_symbol_t *entry, *etmp; 231 232 entry = NULL; 233 234 node = list_first(&csi->members); 235 while (node != NULL) { 236 csimbr = list_node_data(node, stree_csimbr_t *); 237 238 switch (csimbr->cc) { 239 case csimbr_csi: 240 etmp = symbol_find_epoint_rec(prog, name, csimbr->u.csi); 241 if (etmp != NULL) { 242 if (entry != NULL) { 243 printf("Error: Duplicate entry point.\n"); 244 exit(1); 245 } 246 entry = etmp; 247 } 248 break; 249 case csimbr_fun: 250 if (csimbr->u.fun->name->sid == name->sid) { 251 if (entry != NULL) { 252 printf("Error: Duplicate entry point.\n"); 253 exit(1); 254 } 255 entry = fun_to_symbol(csimbr->u.fun); 256 } 257 default: 258 break; 259 } 260 261 node = list_next(&csi->members, node); 262 } 263 264 return entry; 265 } 266 178 267 stree_csi_t *symbol_to_csi(stree_symbol_t *symbol) 179 268 {
Note:
See TracChangeset
for help on using the changeset viewer.