Changeset ef21614 in tol


Ignore:
Timestamp:
Mar 3, 2012, 11:12:15 AM (15 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
c300cb7
Parents:
53ea6a0
Message:

fixes #1460, evitamos pasar por el parser para que no se produzcan las sustituciones en los argumentos.

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@4285 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/real_type/datgrav.cpp

    r53ea6a0 ref21614  
    767767
    768768
    769 static char* structFinder_ = "Struct";
    770 static char* classFinder_  = "Class";
     769static const char* structFinder_ = "Struct";
     770static const char* classFinder_  = "Class";
    771771static BSyntaxObject* structGra_ = (BSyntaxObject*)structFinder_;
    772772static BSyntaxObject* classGra_  = (BSyntaxObject*)classFinder_;
    … …  
    20642064
    20652065
    2066 
     2066static BUserFunction *tclTextMatch = NULL;
    20672067//--------------------------------------------------------------------
    20682068  DeclareContensClass(BDat, BDatTemporary, BDatMatchText);
    … …  
    21132113  if(TolTclIsEnabled())
    21142114  {
    2115     BText expr = BText("TextMatch_Tcl(\"")+string+"\",\""+pattern+"\","+mode+")";
    2116     BSyntaxObject* uMatch = GraReal()->EvaluateExpr(expr);
    2117     if(uMatch)
    2118     {
    2119       contens_ = Real(uMatch)!=0;
    2120       DESTROY(uMatch);
    2121     }
    2122   }
    2123   else
    2124   {
    2125     Warning("Using internal version of TextMatch could cause invalid results. "
    2126     "Please use a TCL version of TOL like tolsh or tolbase.");
    2127     contens_ = (BReal)(string.Match(pattern, mode));
    2128   }
     2115    if ( tclTextMatch || ( tclTextMatch = (BUserFunction*)GraReal()->FindOperator( "TextMatch_Tcl" ) ) ) {
     2116      BList *args = Cons( Arg(1), NCons( Arg(2) ) );
     2117
     2118      if ( Arg(3) ) {
     2119        LstAppend( args, Arg(3) );
     2120      } else {
     2121        BUserDat *uMode = BContensDat::New( "", BDat(mode), "" );
     2122        uMode->PutName( "case" );
     2123        LstAppend( args, uMode );
     2124      }
     2125      BSyntaxObject *evalResult = tclTextMatch->Evaluator( args );
     2126      if ( evalResult ) {
     2127        contens_ = Dat( evalResult );
     2128      }
     2129      // DUDA: debo destruir args?
     2130      DESTROY( evalResult );
     2131      return;
     2132    }
     2133  }
     2134  Warning("Using internal version of TextMatch could cause invalid results. "
     2135          "Please use a TCL version of TOL like tolsh or tolbase.");
     2136  contens_ = (BReal)(string.Match(pattern, mode));
    21292137}
    21302138
Note: See TracChangeset for help on using the changeset viewer.