import statement question

Paul Thomas paulthomas2@wanadoo.fr
Wed Feb 21 18:08:00 GMT 2007


Tobias,
>> face namespace...
>>     
> I agree, but I didn't come up with something better.
> Suggestions?
>   

I don't know where the IMPORT matching is done - in match.c, 
interface.c, or?

Presumably, at present, the matching does

match the "IMPORT" and "::" then,
for (;;)
  if peek_char == eos then stage an OK exit
  match "name"
  if (gfc_get_ha_sym_tree ("name", &st))
      error "ambiguous"
  if (st->n.sym->ns == gfc_current_ns)
      error ("IMPORTing symbol from within interface")
  if (st->n.sym->attr.flavor != FL_DERIVED)
      error ("tying to IMPORT something that is not a derived type")

or something along these lines.

Then we have to add:

  gfc_new_symbol (name, gfc_current_ns)
  copy the attr
  copy the ts
  copy the components?

instead of pointing to the host symbol.

alternatively, I have wondered for a long time if

int ambiguous; in gfc_symtree is not out-of-order extravigant?
A bit-field, like symbol_attribute might be very useful.  Needless to 
say, imported  could be added to ambiguous.

Paul
 
 




More information about the Fortran mailing list