72. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/12/2018 10:18:29 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

72.1 Files compared

# Location File Last Modified
1 MSSRe Build 4.zip\Applications\OncoTrax-E40 ONC_Parser.cpp Tue Apr 10 19:43:38 2018 UTC
2 MSSRe Build 4.zip\Applications\OncoTrax-E40 ONC_Parser.cpp Wed Apr 11 17:41:56 2018 UTC

72.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1350
Changed 1 2
Inserted 0 0
Removed 0 0

72.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

72.4 Active regular expressions

No regular expressions were active.

72.5 Comparison detail

  1   /********* ********** ********** ********** ********** ********** ********** ********** /
  2   /*  Packag e:      ON C – Oncolo gy                                                   * /
  3   /*  Date C reated: Ju l 26,2004                                                       * /
  4   /*  Site N ame:    Hi nes OIFO                                                        * /
  5   /*    Developers    Sergey Gav rilov  PII                                             */
  6   /*  Descri ption:  Im plementati on of the  TONCParser  class tha t encapsul ates     * /
  7   /*                 XM L parsing  functional ity for re quests pro cessed by  the      * /
  8   /*                 On cology Web -service                                             * /
  9   /********* ********** ********** ********** ********** ********** ********** ********** /
  10  
  11   #include " stdafx.h"
  12   #include " OncologyCG I.h"
  13   #include < fstream>
  14   #include < ctime>
  15   #include < string> 
  16  
  17   using name space std;  
  18  
  19   #define XM LPARSER        ((XML_ Parser)use rData)
  20   #define DE BUG_FILE_N AME "oncsr vXML"
  21   #define NA ACCR_RECOR D_LENGHTH  22824
  22  
  23  
  24   /********* ********** ********** ********** ********** ********** ********** ********** /
  25   /*                         LOCAL  DATA TYPE S DECLARAT IONS                           * /
  26   /********* ********** ********** ********** ********** ********** ********** ********** /
  27  
  28   typedef st ruct {
  29           co nst char*  name;        // Tag N ame
  30           TO NCTagCode  code;        // Tag C ode
  31   } TTagDef;
  32  
  33   /********* ********** ********** ********** ********** ********** ********** ********** /
  34   /*                          LOCA L FUNCTION  DECLARATI ONS                            * /
  35   /********* ********** ********** ********** ********** ********** ********** ********** /
  36  
  37   static voi d XMLCALL  TagEndHand ler(void * userData,  const XML_ Char *name );
  38   static voi d XMLCALL  TagStartHa ndler(void  *userData , const XM L_Char *na me, const  XML_Char * *atts);
  39   static voi d XMLCALL  TagTextHan dler(void  *userData,  const XML _Char *tex t, int len );
  40  
  41   /********* ********** ********** ********** ********** ********** ********** ********** /
  42   /*                          VARI ABLES                                                * /
  43   /********* ********** ********** ********** ********** ********** ********** ********** /
  44   char* Inpu tDataFileD ateTime;
  45  
  46   /********* ********** ********** ********** ********** ********** ********** ********** /
  47   /*                                 PARAMETE R PARSER                                  * /
  48   /********* ********** ********** ********** ********** ********** ********** ********** /
  49  
  50   TONCParser ::TONCPars er()
  51   {
  52           Re quest = NU LL;
  53   }
  54  
  55   //***** CR EATES THE  REQUEST OB JECT ACCOR DING TO TH E REQUEST  TAG CODE
  56  
  57   TONCReques t* TONCPar ser::creat eRequest(c onst TONCT agCode Tag Code, cons t XML_Char  **atts)
  58   {
  59           // --- Destro y the prev ious (inco mplete) re quest if i t exists
  60           de lete Reque st;
  61           // --- Create  the reque st object
  62           Re quest = TO NCRequest: :createReq uest(this,  TagCode,  atts);
  63           // ---
  64           re turn Reque st;
  65   }
  66  
  67   //***** RE TURNS VALU E OF THE A TTRIBUTE
  68  
  69   const XML_ Char* TONC Parser::ge tAttrVal(c onst XML_C har **atts , const ch ar* name)
  70   {
  71           st atic char  empty[1] =  "";
  72           co nst XML_Ch ar* val =  NULL;
  73           fo r( int i=0 ; atts[i];  i+=2 )
  74                    if(  !_stricmp( atts[i], n ame) )
  75                    {
  76                             val =  atts[i+1];
  77                             break;
  78                    }
  79                    retu rn val !=  NULL ? val  : empty;
  80   }
  81  
  82  
  83   /********* ********** ********** ********** ********** ********** ********** ********** /
  84   /* Extract  a substri ng from a  string in  between a  beginning  tag/string  and     * /
  85   /* an end  tag/string                                                                 * /
  86   /********* ********** ********** ********** ********** ********** ********** ********** /
  87   char* Extr actStringI nBetween(c har* sourc eString, c har* start Tag, char*  endTag, i nt fixedLe ngth)
  88   {
  89           ch ar* result  = NULL;
  90           ch ar* tempSt ring;
  91           ch ar* tempSt ring2;
  92           ch ar* traile rString;
  93           in t size = 0 ;
  94  
  95           if  (strlen(s ourceStrin g) > 0)
  96           {
  97                    temp String = s trstr(sour ceString,  startTag);
  98                    if ( tempString )
  99                    {                         
  100                             size =  (int) str len(tempSt ring) - (i nt) strlen (startTag)  + 1;
  101                             tempSt ring2 = (c har*) mall oc(size);
  102                             strncp y(tempStri ng2, tempS tring + st rlen(start Tag), strl en(tempStr ing) - str len(startT ag));
  103                             tempSt ring2[size  - 1] = 0;
  104                             traile rString =  strstr(tem pString2,  endTag);
  105                             size =  (int) str len(tempSt ring2) - ( int) strle n(trailerS tring);
  106                             if (fi xedLength  > 0)
  107                             {
  108                                      result =  (char*) m alloc(fixe dLength +  1);
  109                                      if (size  < fixedLe ngth)
  110                                      {
  111                                               strncpy(re sult, temp String2, s ize);
  112  
  113                                               for (int c ount = siz e; count <  fixedLeng th; count+ +)
  114                                               {
  115                                                       st rcat(resul t, " ");
  116                                               }
  117                                      }
  118                                      else
  119                                      {
  120                                               strncpy(re sult, temp String2, f ixedLength );
  121                                      }
  122                                      result[f ixedLength ] = 0;
  123                             }
  124                             else
  125                             {
  126                                      result =  (char*) m alloc(size  + 1);
  127                                      strncpy( result, te mpString2,  size);
  128                                      result[s ize] = 0;
  129                             }
  130                    }
  131           }
  132           re turn resul t;
  133   }
  134  
  135   /*****  Ge t a config uration va lue from t he INI fil e ****/
  136   char* TONC Parser::Ge tConfigVal ue(char* i niFileName , char* co nfigKeySta rtTag, cha r* configK eyEndTag)
  137   {
  138           ch ar* config Value;
  139  
  140           ch ar* allCon figInfo =  GetStringF romFile(in iFileName) ;
  141           if  (allConfi gInfo)
  142           {
  143                    conf igValue =  ExtractStr ingInBetwe en(allConf igInfo, co nfigKeySta rtTag, con figKeyEndT ag, 0);
  144           }
  145           
  146           re turn confi gValue;
  147   }
  148  
  149   char* TONC Parser::Ge tFileNameW ithPath(ch ar* fileNa me, bool d ebugFolder , char* ou tputSubFol derName)
  150   {
  151           ch ar* fileNa meWithPath  = (char*)  malloc(10 0);
  152  
  153           ch ar* path =  GetConfig Value(INI_ FILE_NAME,  OUTPUT_PA TH_CONFIG_ VALUE_STAR T_TAG, OUT PUT_PATH_C ONFIG_VALU E_END_TAG) ;
  154           if  (path)
  155           {
  156                    if ( (int) strl en(path) >  0)
  157                    {
  158                             strcpy (fileNameW ithPath, p ath);
  159                             strcat (fileNameW ithPath, " \\");
  160                             if (de bugFolder)
  161                             {
  162                                      strcat(f ileNameWit hPath, "DE BUG\\");
  163                             }
  164                             else
  165                             {
  166                                      strcat(f ileNameWit hPath, "DA TA\\");
  167                                      strcat(f ileNameWit hPath, out putSubFold erName);
  168                                      strcat(f ileNameWit hPath, "\\ ");
  169                             }
  170                    }
  171                    else
  172                    {
  173                             throw  TONCFault( EC_FOLDER_ NOT_EXISTS , path);
  174                    }
  175           }
  176           el se
  177           {
  178                    thro w TONCFaul t(EC_FOLDE R_NOT_EXIS TS, path);
  179           }
  180  
  181           st rcat(fileN ameWithPat h, fileNam e);
  182           re turn fileN ameWithPat h;
  183  
  184   }
  185  
  186   /********* ********** ********** ********** ********** ********** ********** ********** /
  187   /* Write t he medical  data to a n output f ile                                       * /
  188   /********* ********** ********** ********** ********** ********** ********** ********** /
  189   void TONCP arser::Wri teOutputFi le(char* m edicalData )
  190   {
  191           in t size = 0 ;
  192  
  193           si ze = (int)  strlen(me dicalData) ;
  194  
  195           if  (size > 0 )
  196           {
  197                    FILE  *outputFi le = NULL;
  198                    char  *outputFi leName = ( char*) mal loc(100);
  199  
  200                    //-- - Parse re quest stri ng and out put the pa rt of inpu t string t o a file
  201                    if ( outputFile Name != NU LL)   {
  202                             char*  dateTime =  GetCurren tDateTime( );
  203                             if (si ze == NAAC CR_RECORD_ LENGHTH)
  204                             {
  205                                      strcpy(o utputFileN ame, "ONCS RV_"); 
  206                             }
  207                             else
  208                             {
  209                                      strcpy(o utputFileN ame, "LNCS RV_"); 
  210                             }
  211  
  212                             strcat (outputFil eName, dat eTime);
  213  
  214                             // new  way to de termine ne w vs updat es is insp ecting the  record ty pe field -  position  1
  215                             // pos ition #1 h as "M" or  "A". This  is always  populated,  but keep  the logic  as it was  before,
  216                             // Che ck for a m odificatio n, and if  it's anyth ing else,  mark as ne w.
  217  
  218                             if (me dicalData[ 0] == 'M')
  219                             {
  220                                      outputFi leName = G etFileName WithPath(o utputFileN ame, false , "UPDATE" );
  221                             }
  222                             else
  223                             {
  224                                      outputFi leName = G etFileName WithPath(o utputFileN ame, false , "NEW");
  225                             }
  226  
  227                             //// p osition #2 635 has "U " or "N" o r BLANK
  228                             //if ( medicalDat a[2634] ==  'U')
  229                             //{
  230                             //       outputFi leName = G etFileName WithPath(o utputFileN ame, false , "UPDATE" );
  231                             //}
  232                             //else
  233                             //{
  234                             //       outputFi leName = G etFileName WithPath(o utputFileN ame, false , "NEW");
  235                             //}
  236  
  237                             output FileName[( int) strle n(outputFi leName)] =  0;
  238                    } 
  239  
  240                    if(( errno = fo pen_s(&out putFile, o utputFileN ame, "wb") ) == 0) {
  241                             fwrite (medicalDa ta, 1, siz e, outputF ile);
  242                             fflush (outputFil e);
  243                             fclose (outputFil e);
  244                             extern  char* Glo balOutputF ileName;
  245                             Global OutputFile Name = (ch ar*) mallo c(100);
  246                             strcpy (GlobalOut putFileNam e, outputF ileName);
  247                    }
  248           }
  249   }
  250  
  251  
  252   /*****  Ge t the curr ent date t ime to a s tring and  format it  as YYMMDDH HMMSS.  ** **/
  253   char* TONC Parser::Ge tCurrentDa teTime()
  254   {
  255           ti me_t rawti me;   
  256           st ruct tm *  timeinfo; 
  257           ch ar buffer  [80];    
  258           ti me ( &rawt ime );   
  259           ti meinfo = l ocaltime (  &rawtime  );    
  260           st rftime (bu ffer,80,"% Y%m%d%H%M% S",timeinf o);   
  261  
  262           re turn buffe r;
  263   }
  264  
  265   /*****  Ge t a string  from an e nvironment  variable  ****/
  266   char* TONC Parser::Ge tStringEnv ironmentVa riable(cha r* variabl eName)
  267   {
  268  
  269           lo ng double  number;
  270           in t i;
  271  
  272           ch ar *value;
  273       size_t  len;
  274  
  275       errno_ t err = _d upenv_s( & value, &le n, variabl eName );
  276  
  277           if  (  err ) 
  278           {
  279                    thro w TONCFaul t(EC_ENVIR ONMENT_VAR IABLE_NOT_ FOUND, "En vironment  variable n ot found." );
  280           }
  281  
  282           re turn value ;
  283   }
  284  
  285   /*****  Ge t the Debu g file nam e  *****/
  286   char* TONC Parser::Ge tDubugFile Name()
  287   {
  288           ch ar *fileNa me = (char *) malloc( 100);
  289  
  290           // --- Parse  request st ring and o utput the  part of in put string  to a file
  291           if  (fileName  != NULL)    {
  292                    if ( !InputData FileDateTi me)
  293                    {
  294                             InputD ataFileDat eTime = Ge tCurrentDa teTime();
  295                    }
  296                    strc py(fileNam e, DEBUG_F ILE_NAME);   
  297                    strc at(fileNam e, "_");    
  298                    strc at(fileNam e, InputDa taFileDate Time);   
  299                    strc at(fileNam e, ".in");    
  300                    file Name = Get FileNameWi thPath(fil eName, tru e, "");
  301                    file Name[(int)  strlen(fi leName)] =  0;
  302           } 
  303           re turn fileN ame;
  304   }
  305  
  306   /*****  Ge t a string  from a fi le ****/
  307   char* TONC Parser::Ge tStringFro mFile(char * fileName )
  308   {
  309           FI LE *inputF ile = NULL ;
  310           lo ng size;
  311           ch ar * buffe r = NULL;
  312           si ze_t resul t;
  313  
  314           if ((errno =  fopen_s(&i nputFile,  fileName,  "r")) == 0 ) {
  315                    // o btain file  size:
  316                    fsee k (inputFi le , 0 , S EEK_END);
  317                    size  = ftell ( inputFile) ;
  318                    rewi nd (inputF ile);
  319  
  320                    // a llocate me mory to co ntain the  whole file :
  321                    buff er = (char *) malloc  (sizeof(ch ar)*size);
  322                    if ( buffer !=  NULL) 
  323                    {
  324                             // cop y the file  into the  buffer:
  325                             result  = fread ( buffer, 1,  size, inp utFile);
  326                             buffer [(int) siz e] = 0;
  327                    }
  328  
  329                    // t erminate
  330                    fclo se (inputF ile);
  331           }
  332           re turn buffe r;
  333   }
  334   //***** RE ADS PARAME TERS OF TH E REQUEST  FROM THE S TDIN AND P ARSES THEM
  335  
  336   TONCReques t* TONCPar ser::parse Parameters (int conte nt_length,  char* deb ugFileName )
  337   {
  338           XM L_Parser P arser = XM L_ParserCr eateNS(NUL L, '^');
  339           in t bytes_re ad, rc = 0 ;
  340  
  341           XM L_SetEleme ntHandler( Parser, Ta gStartHand ler, TagEn dHandler);
  342           XM L_SetChara cterDataHa ndler(Pars er, TagTex tHandler);
  343           XM L_UseParse rAsHandler Arg(Parser );
  344           XM L_SetUserD ata(Parser , this);
  345  
  346           tr y
  347           {
  348                    do {
  349                             void*  buf = XML_ GetBuffer( Parser, BU FF_SIZE);
  350                             if( bu f == NULL  )
  351                                      throw TO NCFault(EC _XMLBUF_AL LOC);
  352  
  353                             memset (buf, 0, B UFF_SIZE);
  354                             bytes_ read = (co ntent_leng th > 0) &&  (content_ length < B UFF_SIZE)  ? content_ length : B UFF_SIZE;
  355                             bytes_ read = (in t)fread(bu f, 1, byte s_read, st din);
  356  
  357                             //Writ e the inpu t stream t o a debug  file
  358                             FILE * dumpFile =  NULL;
  359                             if((er rno = fope n_s(&dumpF ile, debug FileName,  "wb")) ==  0) {
  360                                      fwrite(b uf, 1, byt es_read, d umpFile);
  361                                      fflush(d umpFile);
  362                                      fclose(d umpFile);
  363                             }
  364  
  365                             if( XM L_ParseBuf fer(Parser , bytes_re ad, bytes_ read < BUF F_SIZE) !=  XML_STATU S_OK )
  366                                      throw TO NCFault(EC _BAD_XML);
  367  
  368                             if( co ntent_leng th > 0 )
  369                             {
  370                                      content_ length -=  bytes_read ;
  371                                      if( cont ent_length  <= 0 )
  372                                               bytes_read  = 0;
  373                             }
  374                    } wh ile( bytes _read == B UFF_SIZE ) ;
  375           }
  376           ca tch(...)
  377           {
  378                    int  ierror = X ML_GetErro rCode(Pars er);
  379                    XML_ SetUserDat a(Parser,  NULL);
  380                    XML_ ParserFree (Parser);
  381                    dele te Request ;
  382                    Requ est = NULL ;
  383                    thro w;
  384           }
  385  
  386           XM L_SetUserD ata(Parser , NULL);
  387           XM L_ParserFr ee(Parser) ;
  388  
  389           re turn Reque st;
  390   }
  391  
  392   /********* ********** ********** ********** ********** ********** ********** ********** /
  393   /*                                     TEXT  BUFFER                                   * /
  394   /********* ********** ********** ********** ********** ********** ********** ********** /
  395  
  396   TONCTextBu ffer::TONC TextBuffer ()
  397   {
  398           Bu fferLength  = 32000;   // Initia l size of  the text b uffer (in  bytes)
  399           Bu ffer = new  char[Buff erLength+1 ];
  400           cl ear();
  401   }
  402  
  403   TONCTextBu ffer::~TON CTextBuffe r()
  404   {
  405           de lete [] Bu ffer;
  406   }
  407  
  408   //***** AP PENDS THE  TEXT TO TH E BUFFER
  409  
  410   void TONCT extBuffer: :append(co nst XML_Ch ar* text,  int txtlen )
  411   {
  412           // --- Calcul ate the ac tual text  length
  413           if ( txtlen <  0 )
  414                    txtl en = (int) strlen(tex t);
  415  
  416           if ( txtlen >  0 )
  417           {
  418                    //-- - Expand t he buffer  if necessa ry
  419                    if(  (TextLengt h + txtlen ) > Buffer Length )
  420                    {
  421                             Buffer Length +=  __max(txtl en, 4096);   // Incre ment of th e text buf fer size ( in bytes)
  422                             XML_Ch ar* tmp =  new char[B ufferLengt h+1];
  423                             if( tm p == NULL  )
  424                                      throw TO NCFault(EC _NOT_ENOUG H_MEM);
  425   //JJB 1001 05
  426                             strcpy _s(tmp, si zeof(tmp),  Buffer);
  427                             delete  [] Buffer ;
  428                             Buffer  = tmp;
  429                    }
  430  
  431                    //-- - Append t he text to  the buffe r
  432   //JJB 1001 05 Added c onst
  433                    strn cat_s(Buff er, Buffer Length, te xt, txtlen );
  434                    Text Length +=  txtlen;
  435                    Buff er[TextLen gth] = '\0 ';
  436           }
  437   }
  438  
  439   //***** CL EARS THE B UFFER
  440  
  441   void TONCT extBuffer: :clear()
  442   {
  443           Bu ffer[0] =  '\0';
  444           Te xtLength =  0;
  445   }
  446  
  447   //***** CO PIES THE T EXT FROM T HE BUFFER  TO THE PRO VIDED VARI ABLE
  448  
  449   void TONCT extBuffer: :copyText( char* dst,  size_t ma xlen, bool  append0)
  450   {
  451   /*JJB 1001 05 ->
  452   This is on ly slightl y better t han strncp y; we don' t know the  size of d st
  453   */
  454           me mcpy(dst,  Buffer, ma xlen);
  455           if ( append0  )
  456                    dst[ maxlen] =  '\0';
  457   }
  458  
  459   /********* ********** ********** ********** ********** ********** ********** ********** /
  460   /*                                     XML  PATH                                      * /
  461   /********* ********** ********** ********** ********** ********** ********** ********** /
  462  
  463   TONCXMLPat h::TONCXML Path()
  464   {
  465           Bu fferLength  = 256;  / / Initial  size of th e path buf fer (in by tes)
  466           Bu ffer = new  char[Buff erLength+1 ];
  467           cl ear();
  468   }
  469  
  470   TONCXMLPat h::~TONCXM LPath()
  471   {
  472           de lete [] Bu ffer;
  473   }
  474  
  475   //***** CL EARS THE B UFFER
  476  
  477   void TONCX MLPath::cl ear()
  478   {
  479           Bu ffer[0] =  '\0';
  480           Pa thLength =  0;
  481   }
  482  
  483   //***** RE TURNS THE  CODE THAT  CORRESPOND S TO THE C URRENT PAT H
  484  
  485   static int  __cdecl t ag_compare (const voi d *td1, co nst void * td2)
  486   {
  487           re turn _stri cmp(((TTag Def*)td1)- >name, ((T TagDef*)td 2)->name);
  488   }
  489  
  490   TONCTagCod e TONCXMLP ath::getCo de()
  491   {
  492           //    !!! TAG  DEFINITIO NS MUST BE  LISTED IN  ALPHABETI CAL ORDER  (BY PATH)  !!!
  493           st atic TTagD ef tag_lis t[] = {
  494                    { "/ Envelope",                                                                                  SOAP_E NVELOPE            },
  495                    { "/ Envelope/B ody",                                                                            SOAP_B ODY                         },
  496  
  497                    { "/ Envelope/B ody/CS-CAL CULATE",                                            CS _CALCULATE              },
  498                    { "/ Envelope/B ody/CS-CAL CULATE/AGE ",                               CSC_AGE                            },
  499                    { "/ Envelope/B ody/CS-CAL CULATE/BEH AV",                             CSC_BEHAV                          },
  500   //JJB 1001 05
  501                    { "/ Envelope/B ody/CS-CAL CULATE/CSV ER_ORIGINA L",          CSC_VERO RIG                       },
  502                    { "/ Envelope/B ody/CS-CAL CULATE/DIA GNOSIS_YEA R",          CSC_DXYE AR                        },
  503                    { "/ Envelope/B ody/CS-CAL CULATE/EXT ",                               CSC_EXT                            },
  504                    { "/ Envelope/B ody/CS-CAL CULATE/EXT EVAL",                           CSC_EXTEVA L                       },
  505                    { "/ Envelope/B ody/CS-CAL CULATE/GRA DE",                             CSC_GRADE                          },
  506                    { "/ Envelope/B ody/CS-CAL CULATE/HIS T",                              CSC_HIST                           },
  507                    { "/ Envelope/B ody/CS-CAL CULATE/LNE XAM",                            CSC_LNEXAM                         },
  508                    { "/ Envelope/B ody/CS-CAL CULATE/LNP OS",                             CSC_LNPOS                          },
  509   //JJB 1001 05
  510                    { "/ Envelope/B ody/CS-CAL CULATE/LVI ",                               CSC_LVI                            },
  511                    { "/ Envelope/B ody/CS-CAL CULATE/MET S",                              CSC_METS                           },
  512                    { "/ Envelope/B ody/CS-CAL CULATE/MET SEVAL",                          CSC_METSEV AL             },
  513                    { "/ Envelope/B ody/CS-CAL CULATE/NOD ES",                             CSC_NODES                          },
  514                    { "/ Envelope/B ody/CS-CAL CULATE/NOD ESEVAL",                         CSC_NODESE VAL            },
  515   //JJB 1001 05
  516   //               { "/ Envelope/B ody/CS-CAL CULATE/SEX ",                               CSC_SEX                            },
  517                    { "/ Envelope/B ody/CS-CAL CULATE/SIT E",                              CSC_SITE                           },
  518                    { "/ Envelope/B ody/CS-CAL CULATE/SIZ E",                              CSC_SIZE                           },
  519                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 1",                              CSC_SSF1                           },
  520   //JJB 1001 05 -> This  is all re arranged t o keep sor ted
  521                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 10",                             CSC_SSF10                          },
  522                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 11",                             CSC_SSF11                          },
  523                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 12",                             CSC_SSF12                          },
  524                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 13",                             CSC_SSF13                          },
  525                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 14",                             CSC_SSF14                          },
  526                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 15",                             CSC_SSF15                          },
  527                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 16",                             CSC_SSF16                          },
  528                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 17",                             CSC_SSF17                          },
  529                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 18",                             CSC_SSF18                          },
  530                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 19",                             CSC_SSF19                          },
  531                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 2",                              CSC_SSF2                           },
  532                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 20",                             CSC_SSF20                          },
  533                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 21",                             CSC_SSF21                          },
  534                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 22",                             CSC_SSF22                          },
  535                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 23",                             CSC_SSF23                     },
  536                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 24",                             CSC_SSF24                          },
  537                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 25",                             CSC_SSF25                          },
  538                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 3",                              CSC_SSF3                           },
  539                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 4",                              CSC_SSF4                           },
  540                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 5",                              CSC_SSF5                           },
  541                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 6",                              CSC_SSF6                           },
  542                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 7",                              CSC_SSF7                           },
  543                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 8",                              CSC_SSF8                           },
  544                    { "/ Envelope/B ody/CS-CAL CULATE/SSF 9",                              CSC_SSF9                           },
  545   //JJB 1001 05 <-
  546                    { "/ Envelope/B ody/CS-GET -SCHEMA",                                           CS _GET_SCHEM A            },
  547                    { "/ Envelope/B ody/CS-GET -SCHEMA/DI SCRIMINATO R",          CSGS_DIS CRIMINATOR       },
  548                    { "/ Envelope/B ody/CS-GET -SCHEMA/HI ST",                             CSGS_HIST                          },
  549                    { "/ Envelope/B ody/CS-GET -SCHEMA/SI TE",                             CSGS_SITE                          },
  550  
  551                    { "/ Envelope/B ody/CS-GET -TABLES",                                           CS _GET_TABLE S            },
  552                    { "/ Envelope/B ody/CS-GET -TABLES/SC HEMA",                           CSGT_SCHEM A                       },
  553                    { "/ Envelope/B ody/CS-GET -TABLES/TA BLE",                            CSGT_TABLE                         },
  554  
  555                    { "/ Envelope/B ody/ED-GET -EDITINFO" ,                                        ED _GET_EDITI NFO          },
  556                    { "/ Envelope/B ody/ED-GET -EDITINFO/ EDIT",                           EDEI_EDIT                          },
  557                    { "/ Envelope/B ody/ED-GET -EDITINFO/ EDIT-SET",              EDEI_EDI TSET             },
  558                    { "/ Envelope/B ody/ED-GET -EDITINFO/ TEXT-WIDTH ",           EDEI_TEX TWIDTH           },
  559  
  560                    { "/ Envelope/B ody/ED-RUN -BATCH",                                            ED _RUN_BATCH              },
  561                    { "/ Envelope/B ody/ED-RUN -BATCH/NAA CCR-RECORD ",           EDRB_NAA CCR_RECORD       },
  562  
  563                    { "/ Envelope/B ody/GET-VE RSION",                                             GE T_VERSION                        }
  564           };
  565  
  566           TT agDef *ptr ;
  567           TT agDef tag  = {Buffer,  UNKNOWN_T AG};
  568           tr y
  569           {
  570                    ptr  = (TTagDef *)bsearch( &tag, tag_ list,
  571                             sizeof (tag_list) /sizeof(TT agDef), si zeof(TTagD ef), tag_c ompare);
  572           }
  573           ca tch(...)
  574           {
  575                    ptr  = NULL;
  576           }
  577           re turn ptr ! = NULL ? p tr->code :  UNKNOWN_T AG;
  578   }
  579  
  580   //***** RE TURNS THE  NAME OF TH E CURRENT  (LAST ADDE D) TAG
  581  
  582   const XML_ Char* TONC XMLPath::g etLastTag( )
  583   {
  584           co nst XML_Ch ar* ptr =  strrchr(Bu ffer, '/') ;
  585           re turn (ptr  != NULL ?  ptr+1 : Bu ffer);
  586   }
  587  
  588   //***** AD DS THE TAG  NAME TO T HE XML PAT H
  589  
  590   void TONCX MLPath::pu shTag(cons t XML_Char * tag_name )
  591   {
  592           st ring name  = Piece(ta g_name, "^ ", 2);
  593           if ( name ==  "" )
  594                    name  = "<unkno wn>";
  595           si ze_t dl =  name.lengt h() + 1;
  596  
  597           // --- Expand  the path  buffer if  necessary
  598           if ( (PathLen gth + dl)  > BufferLe ngth )
  599           {
  600                    Buff erLength + = __max(dl , 256);  / / Incremen mt of the  path buffe r size (in  bytes)
  601                    XML_ Char* tmp  = new char [BufferLen gth+1];
  602                    if(  tmp == NUL L )
  603                             throw  TONCFault( EC_NOT_ENO UGH_MEM);
  604   //JJB 1001 05
  605                    strc py_s(tmp,  sizeof(tmp ), Buffer) ;
  606                    dele te [] Buff er;
  607                    Buff er = tmp;
  608           }
  609  
  610           // --- Append  the tag n ame to the  path
  611   //JJB 1001 05 the str 's became  _s version s
  612           st rcat_s(Buf fer, Buffe rLength, " /");
  613           st rcat_s(Buf fer, Buffe rLength, n ame.c_str( ));
  614           Pa thLength + = dl;
  615   }
  616  
  617   //***** RE MOVES THE  CURRENT (L AST ADDED)  TAG NAME  FROM THE X ML PATH
  618  
  619   void TONCX MLPath::po pTag()
  620   {
  621           XM L_Char* pt r = strrch r(Buffer,  '/');
  622           Pa thLength =  (ptr != N ULL ? ptr  - Buffer :  0);
  623           Bu ffer[PathL ength] = ' \0';
  624   }
  625  
  626   /********* ********** ********** ********** ********** ********** ********** ********** /
  627   /*                             T AG HANDLER S FOR EXPA T                              * /
  628   /********* ********** ********** ********** ********** ********** ********** ********** /
  629  
  630   void XMLCA LL TagEndH andler(voi d *userDat a, const X ML_Char *n ame)
  631   {
  632           TO NCParser * Parser = ( TONCParser *)XML_GetU serData(XM LPARSER);
  633  
  634           // --- Pass t he tag to  to the req uest objec t for proc essing
  635           TO NCRequest*  Request =  Parser->g etRequest( );
  636           if ( Request  != NULL )
  637           {
  638                    TONC TagCode tc ode = Pars er->Path.g etCode();
  639                    Requ est->parse TagEnd(Par ser, tcode );
  640           }
  641  
  642           // --- Remove  the tag f rom the pa th (stack)
  643           Pa rser->Path .popTag();
  644   }
  645  
  646   void TagSt artHandler (void *use rData, con st XML_Cha r *name, c onst XML_C har **atts )
  647   {
  648           TO NCParser * Parser = ( TONCParser *)XML_GetU serData(XM LPARSER);
  649  
  650           // --- Check  if the cur rent tag d efines a r equest
  651           bo ol crf = ! _stricmp(P arser->Pat h.getPath( ), "/Envel ope/Body") ;
  652  
  653           // --- Append  the tag n ame to the  XML path  (stack)
  654           Pa rser->Path .pushTag(n ame);
  655  
  656           // --- Get th e code of  the curren t XML path
  657           TO NCTagCode  tcode = Pa rser->Path .getCode() ;
  658  
  659           // --- Clear  the buffer  for tag v alue
  660           Pa rser->TagT ext.clear( );
  661  
  662           // --- Get th e request  object or  create a n ew one
  663           TO NCRequest*  Request =  crf ? Par ser->creat eRequest(t code, atts ) : Parser ->getReque st();
  664  
  665           // --- Pass t he tag to  to the req uest objec t for proc essing
  666           if ( Request  != NULL )
  667                    Requ est->parse TagStart(P arser, tco de, atts);
  668   }
  669  
  670   void TagTe xtHandler( void *user Data, cons t XML_Char  *text, in t len)
  671   {
  672           TO NCParser * Parser = ( TONCParser *)XML_GetU serData(XM LPARSER);
  673  
  674           // --- Accumu late the t ext value  of the cur rent tag
  675           Pa rser->TagT ext.append (text, len );
  676   }