Changeset 84af815 in tol for tol/bbasic/txtalgeb.cpp


Ignore:
Timestamp:
Mar 9, 2012, 3:54:00 PM (15 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
0fd52fc
Parents:
bfa6580
Message:

refs #1460, #1476, se implementa TextMatch en C (tomado de la implementación interna de tcl), ya no se recurre a Tcl_Eval, el argumento pattern se pasa por referencia evitando una copia temporal, se eliminan algunos warnings de compilación

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/bbasic/txtalgeb.cpp

    rbfa6580 r84af815  
    717717  {
    718718    const BChar* beginText;
    719     if(beginText = strstr(String() + from, txt.String()))
     719    if( (beginText = strstr(String() + from, txt.String())) )
    720720    {
    721721      indexText = (beginText - String());
    … …  
    849849  number = 0;
    850850  BChar* pos=Buffer();
    851   while(pos=strchr(pos, oldChar))
     851  while( (pos=strchr(pos, oldChar)) )
    852852  {
    853853    *pos = newChar;
    … …  
    907907        txt.ReallocateBuffer(2*txt.Size());
    908908      }
    909       if(pos=strstr(Buffer()+oldPos, oldText.String()))
     909      if( (pos=strstr(Buffer()+oldPos, oldText.String())) )
    910910      {
    911911        number++;
    … …  
    10621062
    10631063
    1064 //--------------------------------------------------------------------
    1065 BBool BText::Match(const BText pattern, BBool caseSensitive) const
     1064#include "StringMatch.cpp"
     1065
     1066//--------------------------------------------------------------------
     1067BBool BText::Match(const BText &pattern, BBool caseSensitive) const
    10661068
    10671069/*! Returns true if the pattern \a pattern makes match with the
    … …  
    10811083{
    10821084  assert(IsAllOk());
     1085  return Tol_StringCaseMatch( String(), pattern.String(), !caseSensitive );
     1086#if 0
    10831087  BBool Ok=BFALSE;
    10841088  if(!HasName() || !pattern.HasName()) { Ok=BFALSE; }
    … …  
    11201124  }
    11211125  return(Ok);
     1126#endif
    11221127}
    11231128
    … …  
    11391144  BText txt;
    11401145  BInt len;
    1141   if(len=strftime(buf, maxSize, fmt, localtime(&t)))
     1146  if( (len=strftime(buf, maxSize, fmt, localtime(&t))) )
    11421147  {
    11431148    txt.Copy(buf,len-1);
    … …  
    12251230  for(n=0; (n<maxItems) && pos && oldPos[0]; n++)
    12261231  {
    1227     if(pos = strchr(oldPos, sep))
     1232    if( (pos = strchr(oldPos, sep)) )
    12281233    {
    12291234      txt[n].Copy(oldPos, 0, pos-oldPos-1);
Note: See TracChangeset for help on using the changeset viewer.