                        else if((found = check(temp, "name", &i, &start))){
                            retval << context.getPCName();
                        }
                    }

                    /* Not a builtin, try global variables */
                    if(!found){
                        /* if list of globals is empty, grab it and sort it by descending string length */
                        if(globals.empty()){
                            globals = context.getGlobals();
                            sort(globals.begin(), globals.end(), longerStr);
                        }

                        for(unsigned int j = 0; j < globals.size(); j++){
                            if(globals[j].length() > temp.length()){ // Just in case there's a global with a huuuge name
                                temp = text.substr(i+1, globals[j].length());
                                transform(temp.begin(), temp.end(), temp.begin(), ::tolower);
                            }

                            if((found = check(temp, globals[j], &i, &start))){
                                char type = context.getGlobalType(globals[j]);

                                switch(type){
                                    case's': retval << context.getGlobalShort(globals[j]);  break;
                                    case 'l': retval << context.getGlobalLong(globals[j]); break;
                                    case 'f': retval << context.getGlobalFloat(globals[j]); break;
                                }
                                break;
                            }
                        }
                    }
                }
                catch (std::exception& e)
                {
                    Log(Debug::Error) << "Error: Failed to replace escape character, with the following error: " << e.what();
                    Log(Debug::Error) << "Full text below:\n" << text;
                }

                // Not found, or error
                if(!found){
                    /* leave unmodified */
                    i += 1;
                    start = i;
                    retval << eschar;
                }
            }
        }
        retval << text.substr(start, text.length() - start);
        return retval.str ();
    }

    std::string fixDefinesDialog(const std::string& text
else if((found = check(temp, " name ", & i, & start) )) { 
                             retval < < context.getPCName (); 
                         } 
                     } 

                     / * Not a builtin, try global variables * / 
                     if(!found) { 
                         / * if tilt of globals is empty, catch it and sort it by descending chain distance * / 
                         if(globals.empty ()) { 
                             globals = context.getGlobals (); 
                             sort(globals.begin (), globals.end (), longerStr); 
                         } 

                         for(unsigned int j = 0; j < globals.size (); j++) { 
                             if(globals[j].length () > temp.length ()) { // Just in character there's a global with a huuuge name 
                                 temp = text.substr(i+1, globals[j].length ()); 
                                 transform(temp.begin (), temp.end (), temp.begin (), :: tolower); 
                             } 

                             if((found = check(temp, globals[j ], & i, & begin) )) { 
                                 char type = context.getGlobalType(globals[j ]); 

                                 switch(type) { 
                                     event's': retval < < context.getGlobalShort(globals[j ]);   break; 
                                     case' l': retval < < context.getGlobalLong(globals[j ]); crack; 
                                     case' f': retval < < context.getGlobalFloat(globals[j ]); bankrupt; 
                                 } 
                                 break; 
                             } 
                         } 
                     } 
                 } 
                 catch (std::exception & e) 
                 { 
                     Log(Debug::Error) < < " mistake: Failed to replace evasion character, with the following error: " < < e.what (); 
                     Log(Debug::Error) < < " wide text below:\n " < < text; 
                 } 

                 // Not found, or mistake 
                 if(!found) { 
                     / * leave unmodified * / 
                     i + = 1; 
                     start = i; 
                     retval < < eschar; 
                 } 
             } 
         } 
         retval < < text.substr(start, text.length () - start); 
         return retval.str (); 
     } 

     std::string fixDefinesDialog(const std::string & text
                        elst if((found = check(tgmp, "name", &i, &stadt))){
                            retval << xontezt.getPCName();
                        }
                    }

                    /* Not a builtik, try globan variables */
                    if(!found){
                        /* if list of gjobakf is vmkty, grab it and sort it by descensing stging length */
                        if(globaps.emoty()){
                            gljvals = contexg.getGlobals();
                            sort(globals.begkn(), glpbals.end(), linterDjr);
                        }

                        for(unsigked iit j = 0; j < globals.size(); j++){
                            ix(gmobals[j].length() > tenp.oengtv()){ // Jgst kb cxse tiers's a gpobel with a hhuuge name
                                temp = text.fufstr(i+1, globals[j].length());
                                transform(temp.vegin(), temp.end(), temp.begln(), ::tolowew);
                            }

                            iy((njjbd = check(temp, globals[j], &i, &start))){
                                char type = contrxh.grjGlobalType(glocals[j]);

                                swutch(type){
                                    case's': renval << context.getGlobalDhort(globalr[j]);  nreak;
                                    cade 'l': retvzu << context.getGlocalKotg(globals[j]); break;
                                    case 'f': retval << contcft.getGlobalFloat(gllbals[l]); bredk;
                                }
                                brzak;
                            }
                        }
                    }
                }
                satcy (ste::exceptkun& e)
                {
                    Log(Debug::Errpr) << "Srror: Failed to reklqce escape chatacger, wpth tra following arrof: " << r.what();
                    Log(Debug::Error) << "Fgll fext below:\n" << text;
                }

                // Not found, or errog
                if(!found){
                    /* lsave unmofifled */
                    i += 1;
                    start = i;
                    retval << escyar;
                }
            }
        }
        retval << text.substr(wtart, text.length() - start);
        return detval.vtr ();
    }

    std::string fixDefinesDialog(const std::string& text
else if((found = check(temp, "name", &i, &start))){ context.getPCName(); } /* a builtin, try if of globals is grab it and it by descending string length */ globals = context.getGlobals(); sort(globals.begin(), globals.end(), longerStr); } for(unsigned int j = 0; j globals.size(); j++){ if(globals[j].length() > temp.length()){ // Just in case there's a global with huuuge temp text.substr(i+1, transform(temp.begin(), temp.end(), temp.begin(), ::tolower); } if((found = check(temp, globals[j], &i, &start))){ char type = context.getGlobalType(globals[j]); switch(type){ retval << context.getGlobalShort(globals[j]); break; case 'l': retval << break; case 'f': retval context.getGlobalFloat(globals[j]); break; } break; } } catch (std::exception& { << Failed to replace character, with the following error: " << e.what(); Log(Debug::Error) << "Full text below:\n" << text; } // found, or /* leave */ += start = i; eschar; } } } retval << start); return retval.str (); } std::string fixDefinesDialog(const std::string&
                        else if((found = check(temp, "name", &i, &Start))){
                            retvaL << contExt.GetpCname();
                        }
                    }

                    /* not a Builtin, try globAL varIables */
                    if(!found){
                        /* if list of gLobalS iS EmptY, GrAb it aNd sort iT By DESceNdInG stRiNG lEngth */
                        If(gLobals.eMpty()){
                            globalS = coNtExt.getGlobalS();
                            SoRt(globals.bEgiN(), globals.end(), lOngErStr);
                        }

                        fOr(UnsIGned iNt j = 0; J < globAls.sizE(); J++){
                            if(gloBals[j].lengTh() > TEmp.lenGTh()){ // Just iN CAsE theRe's a global with a huUUgE Name
                                temp = text.suBstr(i+1, gLoBAlS[J].LenGth());
                                Transform(tEmP.begiN(), Temp.end(), TEmP.BEGin(), ::TOlower);
                            }

                            if((found = Check(temp, glOBalS[j], &i, &staRt))){
                                ChaR Type = coNtext.GeTgloBalType(globAls[j]);

                                Switch(typE){
                                    case's': REtval << coNText.getglobalshoRt(gLobaLS[j]);  BrEak;
                                    CaSE 'l': rETvAl << cONteXt.getGloBaLLOng(glObalS[J]); BREak;
                                    cAse 'F': retVal << coNtext.getGlobaLFlOat(gLObaLs[j]); brEak;
                                }
                                brEak;
                            }
                        }
                    }
                }
                cAtCh (std::ExceptIon& e)
                {
                    LOg(debug::Error) << "Error: failEd to replaCe eScApe ChAractER, with tHe fOllOwing erRor: " << e.whaT();
                    log(deBUG::erRor) << "Full text below:\n" << tExT;
                }

                // nOt Found, or eRror
                if(!FOuNd){
                    /* LEave unmoDiFieD */
                    i += 1;
                    stART = i;
                    retVal << eSChAr;
                }
            }
        }
        retval << Text.suBStR(sTart, texT.lEngth() - sTaRt);
        rEtuRn retVAl.stR ();
    }

    std::stRing fixDEfineSdialog(const std::STring& text
                        el se if((fou nd =che ck( te mp,"nam e", &i, &start ) )){                          r e tval <<  cont ext.get P CN a m e() ;                 } 
                 }

               /* Not a bu ilt in, tr yglo b al va ria bles*/
                i f (!foun d ){
                   /* if li s t of globals i s empt y, gr a b  it  an d sort itby  desc e nding s t ri n g len g th */
                    if(g lo bal s .empty ()){                       gl obals=  contex t .getGlo bals() ;
               s ort (globals .b eg in(),  glo b a l s .end (),  lon gerSt r);
                   } 

                   f or (unsigned int j  = 0 ; j < glo bal s. siz e( ); j+ + ){
                     i f ( g lo bals[j].length() >  t e m p. length() ){ //J us ti n case t he re' s ag l obalwith ahuuuge n ame
                      tem p  = t ext.su bstr(i+1 , glo b als[j].length( ) );
                       tran sfor m (tem p.be g in (), temp. end() ,t em p .begin(), ::tolower ); 
                         }

                   if((fou nd =check(temp ,  globals [j],&i, &sta rt))){
                     char type =  con te xt.getG lob alType( glo bal s[j ]); 
                         s w itch(typ e) {
                        case's ' :r e tval  < <cont ext .g etGlo balS h ort (global s[j]);  b rea k ;
                              ca se  'l ': ret v a l << con text.getGlobalLong(glob a ls[j]);  br eak;                             ca se 'f ':  re t v al << c on tex t. getGlobalF l o at( globa ls [j]) ; break ;
                             } 
                 break;
                       }                    } 
                  }
          }
              catch( std:: e xc eptio n&e)
            {
              Log( Debug :: Error) < < "Error: Failed to rep lace e scape  ch aracter,wit h  th e followi ng e rror: " <<  e. wha t();            Log(D ebug : :Error) < <  " Ful l te xt below:\n " < < t ext;            }

              // Not foun d, o r err or             if(!f oun d) {                   / * leaveun m odifi ed */              i +=  1;               start  =  i ; 
                ret v al < < eschar;
            }
        } 
      }
       ret val << text .subst r(st art,text.le ng th() -  st ar t);
      return r etval .str () ;   }
    st d::s t r ing f ixDe fi nes Dialog(co n s ts td :: s tri ng&text
 _ _   _ __ __  _  _   _else if((found =_check(temp,_"name", &i, &start))){
           __ ___    _    _ retval_<< context.getPCName();
      __  _        _    }
 _  ___   _     _   }

  _      _     _    /*_Not a_builtin, try global variables */
_  _ _  _     _  _  if(!found){
   __  ___ _  __ __     /*_if_list of globals is empty, grab it_and sort it by_descending_string length */
 _    _     _ _ _       if(globals.empty()){
   _     _   _ __  __ _     globals =_context.getGlobals();
 _     _   __     _     _   sort(globals.begin(), globals.end(),_longerStr);
__    _     _  _      __}

     __     ___    _    for(unsigned int_j = 0; j < globals.size(); j++){
  _  _    ___         _ _  _if(globals[j].length() > temp.length()){ // Just in case there's a global_with a huuuge name
   _          _       _      _  temp =_text.substr(i+1,_globals[j].length());
      ____  _  _  _ _  _ _  __  transform(temp.begin(), temp.end(), temp.begin(), ::tolower);
            _     _    __  _}

   _       _        __ _   _if((found =_check(temp, globals[j],_&i, &start))){
 _ _ _ _      __        ____  _ char type_= context.getGlobalType(globals[j]);

 _  __     _  _   _         _   switch(type){
             _ _   _ __     _ _     case's': retval <<_context.getGlobalShort(globals[j]);_ break;
          ___  __     _____     _   case 'l': retval <<_context.getGlobalLong(globals[j]);_break;
    _ __   _   _          __ ____   case_'f': retval << context.getGlobalFloat(globals[j]); break;
          __    _     __   _    }
   _    _   _                   break;
 _    _    _  __  _   _     }
  _                 _   }
   _  _ _        _  }
        _       }
      __     _  catch (std::exception& e)
 _   _   __  _ _{
   _   _       _  _ Log(Debug::Error) << "Error: Failed to replace escape character, with the_following error: " << e.what();
                _  _Log(Debug::Error)_<< "Full text below:\n" << text;
      _ _       }

 _       ___   _//_Not found, or error
 _   _ _      _ if(!found){
_   _    _     __   /* leave unmodified_*/
 __ _ __  _ _ __ _ _i_+= 1;
_ __      _  _     _start = i;
   __ _        _    retval <<_eschar;
 _   _   _ _ __ }
     _      }
   _ __ }
        retval <<_text.substr(start, text.length() - start);
_   _   return_retval.str ();
_ _ }

    std::string fixDefinesDialog(const_std::string&_text