model_server/els/src/elsLanguage.cxx
/* Given symbolPtr, try to find elsLanguage of this symbol.
   1. Call symbolPtr::get_language(). If it returns C or CPP,
      return dummy elsLanguage pointers returned by
      get_els_language_for_c() and get_els_language_for_cpp()
      respectively.
   2. If symbolPtr::get_language() returns smt_ELS and sym is
      xrefSymbol, try to get definition file and use
      els_get_language() on that file. If not definition file
      can be found, get files where referenced and use
      els_get_language() on the first file found.
   3. Return NULL if everything fails.
*/
Given symbolPtr, try to find elsLanguage of this symbol.
1.
Given symbolPtr try to find elsLanguage of this symbol . 1 .
const elsLanguage* elsLanguage::get_els_language(symbolPtr& sym)
{
  Initialize(elsLanuage::get_els_language);
  const elsLanguage* ret = 0;
  smtLanguage smtLang = smtLanguage(sym.get_language());
  if (is_CPLUSPLUS(smtLang))
    ret = get_els_language_for_cpp();
  else if (is_C(smtLang))
    ret = get_els_language_for_c();
  else if (smtLang == smt_ELS)
    {
      if (sym.get_kind() == DD_MODULE)
	{
	  ret = els_get_language(sym.get_name());
	}
      else if ( sym.is_xrefSymbol())
	{
	  symbolPtr deffile;
	  deffile = sym->get_def_file(); 
	  if (deffile.xrisnotnull())
	    {
	      ret = (elsLanguage*)els_get_language(deffile.get_name());
	    }
	  else
	    {
	      symbolArr files;
	      sym->get_ref_files(files);
	      if (files.size() > 0)
		{
		  ret = (elsLanguage*)els_get_language(files[0].get_name());
		}
	    }
	}
    }
  return ret;
}
const elsLanguage * elsLanguage :: get_els_language ( symbolPtr & sym ) { Initialize ( elsLanuage :: get_els_language ) ; const elsLanguage * ret = 0 ; smtLanguage smtLang = smtLanguage ( sym . get_language ( ) ) ; if ( is_CPLUSPLUS ( smtLang ) ) ret = get_els_language_for_cpp ( ) ; else if ( is_C ( smtLang ) ) ret = get_els_language_for_c ( ) ; else if ( smtLang == smt_ELS ) { if ( sym . get_kind ( ) == DD_MODULE ) { ret = els_get_language ( sym . get_name ( ) ) ; } else if ( sym . is_xrefSymbol ( ) ) { symbolPtr deffile ; deffile = sym -> get_def_file ( ) ; if ( deffile . xrisnotnull ( ) ) { ret = ( elsLanguage * ) els_get_language ( deffile . get_name ( ) ) ; } else { symbolArr files ; sym -> get_ref_files ( files ) ; if ( files . size ( ) > 0 ) { ret = ( elsLanguage * ) els_get_language ( files [ 0 ] . get_name ( ) ) ; } } } } return ret ; }
Given symbolPtr, try to find elsLanguage of this symbol.
Given symbolPtr try to find elsLanguage of this symbol .
/* could not find definition file, try files where referenced */