Changeset 437a0af in tol


Ignore:
Timestamp:
Jan 5, 2011, 2:18:37 PM (16 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
beb3a50
Parents:
6562295
Message:

closes #1051

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

Location:
tol
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tol/TestUseTol.cpp

    r6562295 r437a0af  
    1313#include <string.h>
    1414
    15 void Tol_HciWriter( const BText & str )
     15void Tol_HciWriterEx( const BText & str, void *data )
    1616{
    17   std::cout << str.String();
     17  const char *name = (const char*)data;
     18 
     19  std::cout << name << ": " << str.String();
    1820}
    1921
    … …  
    128130  int lang = 1;
    129131  char *vmode = NULL;
    130   BOut::PutHciWriter( Tol_HciWriter );
     132  const char *name = "Tester";
     133  BOut::PutHciWriterEx( Tol_HciWriterEx, (void*)name );
    131134  InitTolKernel( lang, vmode );
    132135  std::cout << "\n";
  • tol/bbasic/out.cpp

    r6562295 r437a0af  
    9292//--------------------------------------------------------------------
    9393BTraceInit("out.cpp");
    94 BHciWriter BOut::hciWriter_;
    95 BHciWriter BOut::logHciWriter_;
     94BHciWriter BOut::hciWriter_=NULL;
     95BHciWriter BOut::logHciWriter_=NULL;
     96BHciWriterEx BOut::hciWriterEx_=NULL;
     97BHciWriterEx BOut::logHciWriterEx_=NULL;
     98void*      BOut::hciWriterExData_=NULL;
     99void*      BOut::logHciWriterExData_=NULL;
    96100BBool      BOut::initialized_;
    97101BBool      BOut::enabled_;
    … …  
    145149    BOut::hciWriter_   = NIL;
    146150    BOut::logHciWriter_ = NIL;
     151    BOut::hciWriterEx_   = NIL;
     152    BOut::logHciWriterEx_ = NIL;
     153    BOut::hciWriterExData_   = NIL;
     154    BOut::logHciWriterExData_ = NIL;
    147155    BOut::errorOpenTag_    = "<E>\nERROR: ";
    148156    BOut::errorCloseTag_   = "</E>\n";
    … …  
    524532{
    525533  if(!BOut::IsEnabled()) { return; }
    526   if(hciWriter_)    { (*hciWriter_)(txt); }
     534  if(hciWriter_) {
     535    (*hciWriter_)(txt);
     536  } else if( hciWriterEx_ ) {
     537    (*hciWriterEx_)( txt, hciWriterExData_ );   
     538  }
    527539}
    528540
    … …  
    535547//--------------------------------------------------------------------
    536548{
    537   if(logHciWriter_) { (*logHciWriter_)(txt); }
    538   else              { Std(txt); }
     549  if( logHciWriter_ ) {
     550    (*logHciWriter_)(txt);
     551  } else if ( logHciWriterEx_ ) {
     552    (*logHciWriterEx_)( txt, logHciWriterExData_ );
     553  } else {
     554    Std( txt );
     555  }
    539556}
    540557
  • tol/bbasic/tol_bout.h

    r6562295 r437a0af  
    4646//! pointer to user defined function
    4747typedef void (*BHciWriter)(const BText&);
     48typedef void (*BHciWriterEx)(const BText&, void*);
    4849
    4950
    … …  
    9798  static BHciWriter hciWriter_;
    9899  static BHciWriter logHciWriter_;
     100  static BHciWriterEx hciWriterEx_;
     101  static void       *hciWriterExData_;
     102  static BHciWriterEx logHciWriterEx_;
     103  static void       *logHciWriterExData_;
    99104
    100105  static BText errorOpenTag_; static BText errorCloseTag_;
    … …  
    131136  static       void   PutHciWriter(BHciWriter h) {
    132137      hciWriter_=h;
     138      hciWriterEx_=NULL;
     139  }
     140  static       void   PutHciWriterEx(BHciWriterEx h, void *ClientData) {
     141      hciWriter_=NULL;
     142      hciWriterEx_=h;
     143      hciWriterExData_ = ClientData;
    133144  }
    134145  static       void   PutLogHciWriter(BHciWriter h) {
    135146      logHciWriter_=h;
     147      logHciWriterEx_=NULL;
     148  }
     149  static       void   PutLogHciWriterEx(BHciWriterEx h, void *ClientData) {
     150      logHciWriter_=NULL;
     151      logHciWriterEx_=h;
     152      logHciWriterExData_ = ClientData;
    136153  }
    137154
Note: See TracChangeset for help on using the changeset viewer.