model_server/project_file/src/projModule.cxx
// projModule::language
//
// Sets the module's language type
:language
Sets the module's language type
: language Sets the module ' s language type
void projModule::language (fileLanguage new_lang)
{
    Initialize(projModule::language__fileLanguage);
    if (new_lang == commonTree::language)
	return;
    if (disbuild_analysis_mode()) {
	commonTree::language = new_lang;
        return;
    }
    projNode *pr = this->get_project();
    if (!pr || pr->root_project() != projNode::get_home_proj()->root_project()) {
	msg("You can only change modules belonging to your home project.", error_sev) << eom;
	return;
    } 
    symbolPtr syminxref = NULL_symbolPtr;
    app *ah = this->get_app();
    int symbol_found = 0;
    Xref* xr = pr->get_xref(1);
    if (xr) {
	symbolArr res;
	syminxref = lookup_file_symbol_in_xref(this->get_name(), xr);
	if (syminxref.xrisnotnull())
 	   symbol_found = 1;
    }
    symbolPtr xref_symb = pr->lookup_symbol (DD_MODULE, (char *)ln_name);
    symbolPtr xref_syminxrefb = syminxref.get_xrefSymbol();
    switch (commonTree::language) {
      case FILE_LANGUAGE_C:
      case FILE_LANGUAGE_CPP:
      case FILE_LANGUAGE_FORTRAN:
      case FILE_LANGUAGE_COBOL:
      case FILE_LANGUAGE_ESQL_C:
      case FILE_LANGUAGE_ESQL_CPP:
      case FILE_LANGUAGE_UNKNOWN:
	switch (new_lang) {
	  case FILE_LANGUAGE_C:
	  case FILE_LANGUAGE_CPP:
	  case FILE_LANGUAGE_FORTRAN:
	  case FILE_LANGUAGE_COBOL:
	  case FILE_LANGUAGE_ESQL_C:
	  case FILE_LANGUAGE_ESQL_CPP:
	    break;
	  default: {
	      if (this->get_app() || this->is_paraset_file()) {
		  int unload_flag = dis_question (T_CHANGELANG,
						  B_CHANGEANYWAY, B_CANCEL,
						  Q_LOSEASSOCCHANGE, get_name());
		  if (unload_flag == 1) {
		      unload_module();
		      OSapi_unlink (paraset_file_name());
		      invalidate_cache();
		      xr->remove_module (ln_name);
		      xr->remove_module_from_xref (ln_name);
		  }
	      }
          }
	  break;
	}
	break;
      case FILE_LANGUAGE_RAW: {
	  if (this->get_app() || this->is_paraset_file()) {
	      int unload_flag = dis_question (T_CHANGELANG,
					  B_CHANGEANYWAY, B_CANCEL,
					  Q_LOSEASSOCCHANGE, get_name());
	      if (unload_flag == 1) {
		  unload_module();
		  OSapi_unlink (paraset_file_name());
		  invalidate_cache();
		  xr->remove_module (ln_name);
		  xr->remove_module_from_xref (ln_name);
	      }
	  }
        } 
	break;
    }
    if (symbol_found)          xref_syminxrefb->set_language (new_lang, xr->get_lxref());
    if (xref_symb.xrisnotnull()) xref_symb->set_language (new_lang, xr->get_lxref());
    if (ah)              ah->language = new_lang;
    commonTree::language = new_lang;
    projHeader* h = this->get_header();
    obj_insert (h, REPLACE, pr, pr, NULL);
}
void projModule :: language ( fileLanguage new_lang ) { Initialize ( projModule :: language__fileLanguage ) ; if ( new_lang == commonTree :: language ) return ; if ( disbuild_analysis_mode ( ) ) { commonTree :: language = new_lang ; return ; } projNode * pr = this -> get_project ( ) ; if ( ! pr || pr -> root_project ( ) != projNode :: get_home_proj ( ) -> root_project ( ) ) { msg ( " " , error_sev ) << eom ; return ; } symbolPtr syminxref = NULL_symbolPtr ; app * ah = this -> get_app ( ) ; int symbol_found = 0 ; Xref * xr = pr -> get_xref ( 1 ) ; if ( xr ) { symbolArr res ; syminxref = lookup_file_symbol_in_xref ( this -> get_name ( ) , xr ) ; if ( syminxref . xrisnotnull ( ) ) symbol_found = 1 ; } symbolPtr xref_symb = pr -> lookup_symbol ( DD_MODULE , ( char * ) ln_name ) ; symbolPtr xref_syminxrefb = syminxref . get_xrefSymbol ( ) ; switch ( commonTree :: language ) { case FILE_LANGUAGE_C : case FILE_LANGUAGE_CPP : case FILE_LANGUAGE_FORTRAN : case FILE_LANGUAGE_COBOL : case FILE_LANGUAGE_ESQL_C : case FILE_LANGUAGE_ESQL_CPP : case FILE_LANGUAGE_UNKNOWN : switch ( new_lang ) { case FILE_LANGUAGE_C : case FILE_LANGUAGE_CPP : case FILE_LANGUAGE_FORTRAN : case FILE_LANGUAGE_COBOL : case FILE_LANGUAGE_ESQL_C : case FILE_LANGUAGE_ESQL_CPP : break ; default : { if ( this -> get_app ( ) || this -> is_paraset_file ( ) ) { int unload_flag = dis_question ( T_CHANGELANG , B_CHANGEANYWAY , B_CANCEL , Q_LOSEASSOCCHANGE , get_name ( ) ) ; if ( unload_flag == 1 ) { unload_module ( ) ; OSapi_unlink ( paraset_file_name ( ) ) ; invalidate_cache ( ) ; xr -> remove_module ( ln_name ) ; xr -> remove_module_from_xref ( ln_name ) ; } } } break ; } break ; case FILE_LANGUAGE_RAW : { if ( this -> get_app ( ) || this -> is_paraset_file ( ) ) { int unload_flag = dis_question ( T_CHANGELANG , B_CHANGEANYWAY , B_CANCEL , Q_LOSEASSOCCHANGE , get_name ( ) ) ; if ( unload_flag == 1 ) { unload_module ( ) ; OSapi_unlink ( paraset_file_name ( ) ) ; invalidate_cache ( ) ; xr -> remove_module ( ln_name ) ; xr -> remove_module_from_xref ( ln_name ) ; } } } break ; } if ( symbol_found ) xref_syminxrefb -> set_language ( new_lang , xr -> get_lxref ( ) ) ; if ( xref_symb . xrisnotnull ( ) ) xref_symb -> set_language ( new_lang , xr -> get_lxref ( ) ) ; if ( ah ) ah -> language = new_lang ; commonTree :: language = new_lang ; projHeader * h = this -> get_header ( ) ; obj_insert ( h , REPLACE , pr , pr , NULL ) ; }
projModule::language
Sets the module's language type
projModule :: language Sets the module ' s language type