| 48 | */ |
| 49 | |
| 50 | gpre_fld* MET_context_field( gpre_ctx* context, const char* string) |
| 51 | { |
| 52 | SCHAR name[NAME_SIZE]; |
| 53 | |
| 54 | if (context->ctx_relation) { |
| 55 | return (MET_field(context->ctx_relation, string)); |
| 56 | } |
| 57 | |
| 58 | if (!context->ctx_procedure) { |
| 59 | return NULL; |
| 60 | } |
| 61 | |
| 62 | strcpy(name, string); |
| 63 | gpre_prc* procedure = context->ctx_procedure; |
| 64 | |
| 65 | // At this point the procedure should have been scanned, so all |
| 66 | // its fields are in the symbol table. |
| 67 | |
| 68 | gpre_fld* field = NULL; |
| 69 | for (gpre_sym* symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym) |
| 70 | { |
| 71 | if (symbol->sym_type == SYM_field && (field = (gpre_fld*) symbol->sym_object) && |
| 72 | field->fld_procedure == procedure) |
| 73 | { |
| 74 | return field; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | return field; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | /*____________________________________________________________ |
no test coverage detected